summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h
blob: 35c7786ddc82c2af9ace43357388065b2a812b3e (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// -*- C++ -*-

//=============================================================================
/**
 *  @file    SSLIOP_Acceptor.h
 *
 *  $Id$
 *
 *  IIOP/SSL specific acceptor processing
 *
 *
 *  @author Carlos O'Ryan <coryan@uci.edu>
 *  @author Ossama Othman <ossama@uci.edu>
 */
//=============================================================================


#ifndef TAO_SSLIOP_ACCEPTOR_H
#define TAO_SSLIOP_ACCEPTOR_H

#include /**/ "ace/pre.h"

#include "ace/config-all.h"

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

#include "IIOP_SSL_Acceptor.h"
#include "SSLIOP_Connection_Handler.h"
#include "SSLIOP_Accept_Strategy.h"

#include "orbsvcs/SSLIOPC.h"  /* CSIv1 */
#include "orbsvcs/CSIIOPC.h"  /* CSIv2 */

namespace TAO
{
  namespace SSLIOP
  {

    /**
     * @class Acceptor
     *
     * @brief The SSLIOP-specific bridge class for the concrete acceptor.
     */
    class TAO_SSLIOP_Export Acceptor
      : public IIOP_SSL_Acceptor
    {
    public:

      /// Constructor.
      Acceptor (::Security::QOP qop,
                const ACE_Time_Value & timeout);

      /// Destructor.
      ~Acceptor (void);

      typedef ACE_Strategy_Acceptor<Connection_Handler, ACE_SSL_SOCK_ACCEPTOR> BASE_ACCEPTOR;
      typedef TAO_Creation_Strategy<Connection_Handler> CREATION_STRATEGY;
      typedef TAO_Concurrency_Strategy<Connection_Handler> CONCURRENCY_STRATEGY;
      typedef Accept_Strategy ACCEPT_STRATEGY;

      /**
       * @name The TAO_Acceptor Methods
       *
       * Check the documentation in tao/Pluggable.h for details.
       */
      //@{
      virtual int open (TAO_ORB_Core *orb_core,
                        ACE_Reactor *reactor,
                        int version_major,
                        int version_minor,
                        const char *address,
                        const char *options = 0);
      virtual int open_default (TAO_ORB_Core *orb_core,
                                ACE_Reactor *reactor,
                                int version_major,
                                int version_minor,
                                const char *options = 0);
      virtual int close (void);
      virtual int create_profile (const TAO::ObjectKey &object_key,
                                  TAO_MProfile &mprofile,
                                  CORBA::Short priority);
      virtual int is_collocated (const TAO_Endpoint* endpoint);
      //@}

      /// Retrieve the CSIv1 SSLIOP::SSL component associated with the
      /// endpoints set up by this acceptor.
      const ::SSLIOP::SSL &ssl_component (void) const;

    private:

      /// Implement the common part of the open*() methods.
      int ssliop_open_i (TAO_ORB_Core *orb_core,
                         const ACE_INET_Addr& addr,
                         ACE_Reactor *reactor);

      /// Parse protocol specific options.
      int parse_options (const char *options);

      /// Ensure that neither the endpoint configuration nor the ORB
      /// configuration violate security measures.
      int verify_secure_configuration (TAO_ORB_Core *orb_core,
                                       int major,
                                       int minor);

      /// Helper method to add a new profile to the mprofile for
      /// each endpoint.
      int create_new_profile (const TAO::ObjectKey &object_key,
                              TAO_MProfile &mprofile,
                              CORBA::Short priority);

      /// Helper method to create a profile that contains all of
      /// our endpoints.
      int create_shared_profile (const TAO::ObjectKey &object_key,
                                 TAO_MProfile &mprofile,
                                 CORBA::Short priority);

    private:

      /// The concrete acceptor, as a pointer to it's base class.
      BASE_ACCEPTOR ssl_acceptor_;

      /**
       * @name Acceptor Strategies
       *
       * Strategies used when accepting an incoming connection.
       */
      CREATION_STRATEGY *creation_strategy_;
      CONCURRENCY_STRATEGY *concurrency_strategy_;
      ACCEPT_STRATEGY *accept_strategy_;

      /// The CSIv1 SSL component.
      /**
       * This is the SSLIOP endpoint-specific tagged component that is
       * embedded in a given IOR.
       */
      ::SSLIOP::SSL ssl_component_;

      /// The SSLIOP CSIv2 tagged component.
      /**
       *
       */
      CSIIOP::TLS_SEC_TRANS csiv2_component_;

      /// State that will be passed to each SSLIOP connection handler upon
      /// creation.
      Connection_Handler_State handler_state_;

      /// The accept() timeout.
      /**
       * This timeout includes the overall time to complete the SSL
       * handshake.  This includes both the TCP handshake and the SSL
       * handshake.
       */
      const ACE_Time_Value timeout_;

    };

  }  // End SSLIOP namespace.
}  // End TAO namespace.

#if defined(__ACE_INLINE__)
#include "SSLIOP_Acceptor.i"
#endif /* __ACE_INLINE__ */

#include /**/ "ace/post.h"

#endif  /* TAO_SSLIOP_ACCEPTOR_H */