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

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

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

#include "ace/Acceptor.h"
#include "ace/Reactor.h"
#include "ace/Svc_Handler.h"
#include "ace/SOCK_Stream.h"
#include "tao/Acceptor_Impl.h"

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

#include "orbsvcs/HTIOP/HTIOP_Export.h"
#include "orbsvcs/HTIOP/HTIOP_Connection_Handler.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_ORB_Core;
// ****************************************************************

namespace TAO
{
  namespace HTIOP
  {
    /**
     * @class Completion_Handler
     *
     * @brief Helps the HTIOP Acceptor complete a connection.
     *
     * The Completion Handler owns a newly accepted connection until the
     * first data read. At that point, the session and data flow direction
     * are known so the stream may be handed off to either an existing
     * session, or to a newly created one.
     */
    typedef TAO_Creation_Strategy<Connection_Handler> CREATION_STRATEGY2;
    typedef TAO_Concurrency_Strategy<Connection_Handler> CONCURRENCY_STRATEGY2;

    typedef ACE_Svc_Handler<ACE_SOCK_STREAM,ACE_NULL_SYNCH> COMPLETION_BASE;

    class HTIOP_Export Completion_Handler : public COMPLETION_BASE
    {
    public:
      Completion_Handler (ACE_Thread_Manager* t = 0);
      /// Constructor.
      Completion_Handler (TAO_ORB_Core *orb_core,
                          CORBA::Boolean = false);

      /// Destructor.
      ~Completion_Handler ();

      /// Called by the <Strategy_Acceptor> when the handler is completely
      /// connected. Argument is unused.
      virtual int open (void *);

      //@{
      /** @name Event Handler overloads
       */
      virtual int handle_input (ACE_HANDLE);

      virtual int resume_handler ();
      virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
      //@}

    private:
      TAO_ORB_Core *orb_core_;
      ACE::HTBP::Channel *channel_;

      CREATION_STRATEGY2 *creation_strategy_;
      CONCURRENCY_STRATEGY2 *concurrency_strategy_;
    };
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL

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