2 ** Copyright 2002 Addison Wesley. All Rights Reserved.
5 #ifndef _AC_CLIENT_LOGGING_DAEMON_H
6 #define _AC_CLIENT_LOGGING_DAEMON_H
8 #include "ace/Handle_Set.h"
9 #include "ace/Log_Record.h"
10 #include "ace/SOCK_Stream.h"
11 #include "ace/Svc_Handler.h"
12 #include "ace/Synch_Traits.h"
14 class AC_CLD_Connector
;
16 class AC_Output_Handler
17 : public ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_MT_SYNCH
> {
19 enum { QUEUE_MAX
= sizeof (ACE_Log_Record
) * ACE_IOV_MAX
};
21 virtual int open (void *); // Initialization hook method.
23 // Entry point into the <AC_Output_Handler>.
24 virtual int put (ACE_Message_Block
*, ACE_Time_Value
* = 0);
27 AC_CLD_Connector
*connector_
;
29 // Handle disconnects from the logging server.
30 virtual int handle_input (ACE_HANDLE handle
);
32 // Hook method forwards log records to server logging daemon.
35 // Send the buffered log records using a gather-write operation.
36 virtual int send (ACE_Message_Block
*chunk
[], size_t &count
);
39 class AC_Input_Handler
40 : public ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_NULL_SYNCH
> {
42 AC_Input_Handler (AC_Output_Handler
*handler
= 0)
43 : output_handler_ (handler
) {}
44 virtual int open (void *); // Initialization hook method.
45 virtual int close (u_long
= 0); // Shutdown hook method.
48 // Reactor hook methods.
49 virtual int handle_input (ACE_HANDLE handle
);
50 virtual int handle_close (ACE_HANDLE
= ACE_INVALID_HANDLE
,
51 ACE_Reactor_Mask
= 0);
53 // Pointer to the output handler.
54 AC_Output_Handler
*output_handler_
;
56 // Keep track of connected client handles.
57 ACE_Handle_Set connected_clients_
;
60 #endif /* _AC_CLIENT_LOGGING_DAEMON_H */