summaryrefslogtreecommitdiff
path: root/ACE/apps/Gateway/Gateway/Connection_Handler_Acceptor.h
blob: 5ab3accceed0e6e237254dbdb7effaf799b04857 (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++ -*- */

//=============================================================================
/**
 *  @file    Connection_Handler_Acceptor.h
 *
 *  $Id$
 *
 *  @author Doug Schmidt
 */
//=============================================================================

#ifndef _CONNECTION_HANDLER_ACCEPTOR
#define _CONNECTION_HANDLER_ACCEPTOR

#include "ace/Acceptor.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/SOCK_Acceptor.h"
#include "Connection_Handler.h"

// Forward declaration
class Event_Channel;

/**
 * @class Connection_Handler_Acceptor
 *
 * @brief A concrete factory class that setups connections to peerds
 * and produces a new Connection_Handler object to do the dirty
 * work...
 */
class Connection_Handler_Acceptor : public ACE_Acceptor<Connection_Handler, ACE_SOCK_ACCEPTOR>
{
public:
  /// Constructor.
  Connection_Handler_Acceptor (Event_Channel &,
                               char connection_role);

  /// Hook method for creating an appropriate <Connection_Handler>.
  virtual int make_svc_handler (Connection_Handler *&ch);

  /// Hook method for accepting a connection into the
  /// <Connection_Handler>.
  virtual int accept_svc_handler (Connection_Handler *ch);

protected:
  /// Make life easier later on.
  typedef ACE_Acceptor<Connection_Handler, ACE_SOCK_ACCEPTOR>
          inherited;

  /// Reference to the event channel.
  Event_Channel &event_channel_;

  /// Keeps track of what type of proxy we need to create.
  Connection_Config_Info connection_config_info_;

  /// Make the appropriate type of <Connection_Handler>.
  Connection_Handler_Factory connection_handler_factory_;
};

#endif /* _CONNECTION_HANDLER_ACCEPTOR */