summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h
blob: e63b7c30acc5b4e458eba317327f3f995068e208 (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file   HTIOP_Acceptor_Impl.h
 *
 *  @author Priyanka Gontla <gontla_p@ociweb.com>
 */
//=============================================================================


#ifndef HTIOP_ACCEPTOR_IMPL_H
#define HTIOP_ACCEPTOR_IMPL_H
#include /**/ "ace/pre.h"

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

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

#include "tao/corbafwd.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

// Forward declarations.
class TAO_ORB_Core;

namespace TAO
{
  namespace HTIOP
  {
    /**
     * @class Creation_Strategy
     *
     * @brief Creates a Svc_Handler and set the ORB_Core pointer on it.
     */
    template <class SVC_HANDLER>
    class Creation_Strategy : public ACE_Creation_Strategy<SVC_HANDLER>
    {
    public:
      /**
       * Constructor.
      */
      Creation_Strategy (TAO_ORB_Core *orb_core);

      /// Create a SVC_HANDLER  and set the ORB_Core pointer on it.
      int make_svc_handler (SVC_HANDLER *&sh);

    protected:
      /// Pointer to the ORB Core.
      TAO_ORB_Core *orb_core_;
    };

    template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
    class Accept_Strategy : public ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>
    {
    public:
      /// Constructor.
      Accept_Strategy (TAO_ORB_Core *orb_core);

      /// Initialize the <peer_acceptor_> with <local_addr>.  If the
      /// process runs out of handles, purge some "old" connections.
      int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
                bool restart = false);

      /// Delegates to the <accept> method of the PEER_ACCEPTOR. If the
      /// process runs out of handles, purge some "old" connections.
      int accept_svc_handler (SVC_HANDLER *svc_handler);

    protected:
      /// Base class.
      typedef ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> ACCEPT_STRATEGY_BASE;

      /// Pointer to the ORB Core.
      TAO_ORB_Core *orb_core_;
    };

    /**
     * @class Concurrency_Strategy
     *
     * @brief Activates the Svc_Handler.
     */
    template <class SVC_HANDLER>
    class Concurrency_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER>
    {
    public:
      /// Constructor.
      Concurrency_Strategy (TAO_ORB_Core *orb_core);

      /**
       * Activates the Svc_Handler.
       */
      int activate_svc_handler (SVC_HANDLER *svc_handler,
                                void *arg);

    protected:
      /// Base class.
      typedef ACE_Concurrency_Strategy<SVC_HANDLER> CONCURRENCY_STRATEGY_BASE;

      /// Pointer to the ORB Core.
      TAO_ORB_Core *orb_core_;
    };
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL

#include "orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp"

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