Use =default for skeleton copy constructor
[ACE_TAO.git] / ACE / netsvcs / lib / Client_Logging_Handler.h
blob3917776d05ed594cfb68bae13fe19cca82621350
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Client_Logging_Handler.h
7 * @author Doug Schmidt <schmidt@.cs.wustl.edu>
8 */
9 //=============================================================================
12 #ifndef ACE_CLIENT_LOGGER_H
13 #define ACE_CLIENT_LOGGER_H
15 #include "ace/SPIPE_Stream.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/SOCK_Stream.h"
22 #include "ace/Svc_Handler.h"
23 #include "ace/svc_export.h"
25 #if (ACE_HAS_STREAM_LOG_MSG_IPC == 1)
26 #define LOGGING_STREAM ACE_SPIPE_STREAM
27 #define LOGGING_ACCEPTOR ACE_SPIPE_ACCEPTOR
28 #define LOGGING_ADDR ACE_SPIPE_Addr
29 #else
30 #define LOGGING_STREAM ACE_SOCK_STREAM
31 #define LOGGING_ACCEPTOR ACE_SOCK_ACCEPTOR
32 #define LOGGING_ADDR ACE_INET_Addr
33 #endif /* ACE_HAS_STREAM_LOG_MSG_IPC == 1 */
35 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
36 template class ACE_Svc_Export ACE_Svc_Handler<LOGGING_STREAM, ACE_NULL_SYNCH>;
37 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
39 /**
40 * @class ACE_Client_Logging_Handler
42 * @brief This client logging daemon is a mediator that receives logging
43 * records from local applications processes and forwards them to
44 * the server logging daemon running on another host.
46 * The default implementation uses an ACE_SPIPE_Stream to
47 * receive the logging message from the application and an
48 * ACE_SOCK_Stream to forward the logging message to the
49 * server. However, on platforms that don't support
50 * <ACE_SPIPEs> (e.g., Win32) we use sockets instead.
52 class ACE_Svc_Export ACE_Client_Logging_Handler :
53 public ACE_Svc_Handler<LOGGING_STREAM, ACE_NULL_SYNCH>
55 public:
56 /// Default constructor. @a handle is where the output is sent.
57 ACE_Client_Logging_Handler (ACE_HANDLE handle = ACE_STDERR);
59 /// Activate this instance of the ACE_Client_Logging_Handler
60 /// (called by the ACE_Client_Logging_Acceptor).
61 virtual int open (void * = 0);
63 /// Return the handle of the IPC endpoint.
64 virtual ACE_HANDLE get_handle () const;
66 /// Called when object is removed from the ACE_Reactor.
67 virtual int close (u_long);
69 private:
70 /// Handle SIGPIPE.
71 virtual int handle_signal (int signum,
72 siginfo_t *,
73 ucontext_t *);
75 /// Receive logging records from applications.
76 virtual int handle_input (ACE_HANDLE);
78 /**
79 * Receive logging records from applications. This is necessary to
80 * handle madness with UNIX select, which can't deal with MSG_BAND
81 * data easily due to its overly simple interface... This just
82 * calls handle_input().
84 virtual int handle_exception (ACE_HANDLE);
86 /// Called back when it's ok to send.
87 virtual int handle_output (ACE_HANDLE);
89 /// Send the @a log_record to the logging server.
90 int send (ACE_Log_Record &log_record);
92 /// This is either a SOCKET (if we're connected to a logging server)
93 /// or ACE_STDERR.
94 ACE_HANDLE logging_output_;
97 ACE_SVC_FACTORY_DECLARE (ACE_Client_Logging_Acceptor)
99 #endif /* ACE_CLIENT_LOGGER_H */