diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-12-30 06:50:29 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-12-30 06:50:29 +0000 |
commit | a4a7690c336d4c8a16b3041c86d501ba38226e96 (patch) | |
tree | 9e9f93a98edd2591453f092d178ad29a1c5fb519 /examples/Reactor/Multicast/Log_Wrapper.cpp | |
parent | a5c4d8047ab58df5c45092e18ae503ad40518f0e (diff) | |
download | ATCD-unlabeled-4.1.2.tar.gz |
This commit was manufactured by cvs2svn to create branchunlabeled-4.1.2
'unlabeled-4.1.2'.
Diffstat (limited to 'examples/Reactor/Multicast/Log_Wrapper.cpp')
-rw-r--r-- | examples/Reactor/Multicast/Log_Wrapper.cpp | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/examples/Reactor/Multicast/Log_Wrapper.cpp b/examples/Reactor/Multicast/Log_Wrapper.cpp deleted file mode 100644 index 38b4cdea09f..00000000000 --- a/examples/Reactor/Multicast/Log_Wrapper.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -// client.C - -#include "Log_Wrapper.h" - -Log_Wrapper::Log_Wrapper (void) -{ - this->log_msg_.sequence_number = 0; - this->log_msg_.app_id = ACE_OS::getpid (); -} - -Log_Wrapper::~Log_Wrapper (void) -{ -} - -// Set the log_msg_ host address. - -int -Log_Wrapper::open (const int port, const char *mcast_addr) -{ - struct hostent *host_info; - struct utsname host_data; - - if (ACE_OS::uname (&host_data) < 0) - return -1; - - if ((host_info = ACE_OS::gethostbyname (host_data.nodename)) == NULL) - return -1; - else - ACE_OS::memcpy ((char *) &this->log_msg_.host, - (char *) host_info->h_addr, - host_info->h_length); - - // This starts out initialized to all zeros! - ACE_INET_Addr sockdg_addr; - - if (this->logger_.open (sockdg_addr) == -1) - return -1; - - if (this->server_.set (port, mcast_addr) == -1) - return -1; - - // success. - return 0; -} - -// Send the message to a logger object. -// This wrapper fills in all the log_record info for you. -// uses iovector stuff to make contiguous header and message. - -int -Log_Wrapper::log_message (ACE_Log_Priority type, char *message) -{ - this->log_msg_.type = type; this->log_msg_.time = time (0); - this->log_msg_.msg_length = strlen(message); - this->log_msg_.sequence_number++; - - iovec *iovp = new iovec[2]; - iovp[0].iov_base = (char *) &log_msg_; - iovp[0].iov_len = sizeof log_msg_; - iovp[1].iov_base = message; - iovp[1].iov_len = log_msg_.msg_length; - - logger_.send (iovp, 2, server_); - - delete iovp; - - // success. - return 0; -} - |