summaryrefslogtreecommitdiff
path: root/examples/Logger/simple-server/Logging_Handler.h
blob: 2d15b5a62959a1fc907eb3b48081e8c7f4deb22d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* -*- C++ -*- */
// $Id$


// ============================================================================
//
// = LIBRARY
//    examples
// 
// = FILENAME
//    Logging_Handler.h 
//
// = AUTHOR
//    Doug Schmidt 
// 
// ============================================================================

#if !defined (_CLIENT_HANDLER_H)
#define _CLIENT_HANDLER_H

#include "ace/Event_Handler.h"
#include "ace/INET_Addr.h"
#include "ace/SOCK_Stream.h"

class Logging_Handler : public ACE_Event_Handler
  // = TITLE
  //     Receive client message from the remote clients.
  // 
  // = DESCRIPTION
  //     This class demonstrates how to receive messages from remote
  //     clients using the notification mechanisms in the
  //     <ACE_Reactor>.  In addition, it also illustrates how to
  //     utilize the <ACE_Reactor> timer mechanisms, as well.
{
public:
  Logging_Handler (void);  

  // = Hooks for opening and closing handlers.
  virtual int open (void);
  virtual int close (void);

  operator ACE_SOCK_Stream &();
  // Conversion operators.

protected:
  // = Demultiplexing hooks.
  virtual ACE_HANDLE get_handle (void) const;
  virtual int handle_input (ACE_HANDLE);
  virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
  virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); 

  // = Really should be private...
  virtual ~Logging_Handler (void); 
  // Ensure dynamic allocation.

private:
  char host_name_[MAXHOSTNAMELEN + 1];
  // Host we are connected to.

  ACE_SOCK_Stream cli_stream_; 
  // Connection with client 
};

#endif /* _CLIENT_HANDLER_H */