summaryrefslogtreecommitdiff
path: root/trunk/TAO/tao/Strategies/COIOP_Transport.cpp
blob: 93c665bf99f2a6753cfe468030d9c1e1bfdcaa4e (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
// $Id$

#include "tao/Strategies/COIOP_Transport.h"

#if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)

#include "tao/Strategies/COIOP_Connection_Handler.h"
#include "tao/Strategies/COIOP_Acceptor.h"
#include "tao/Strategies/COIOP_Profile.h"
#include "tao/Acceptor_Registry.h"
#include "tao/operation_details.h"
#include "tao/Timeprobe.h"
#include "tao/CDR.h"
#include "tao/Transport_Mux_Strategy.h"
#include "tao/Wait_Strategy.h"
#include "tao/Stub.h"
#include "tao/ORB_Core.h"
#include "tao/debug.h"
#include "tao/Resume_Handle.h"
#include "tao/GIOP_Message_Base.h"
#include "tao/GIOP_Message_Lite.h"

ACE_RCSID (tao, COIOP_Transport, "$Id$")

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

TAO_COIOP_Transport::TAO_COIOP_Transport (TAO_COIOP_Connection_Handler *handler,
                                        TAO_ORB_Core *orb_core,
                                        CORBA::Boolean flag)
  : TAO_Transport (TAO_TAG_COIOP_PROFILE,
                   orb_core)
  , connection_handler_ (handler)
  , messaging_object_ (0)
{
/*
 * Hook to customize the messaging object when the concrete messaging
 * object is known a priori. In this case, the flag is ignored.
 */
//@@ MESSAGING_SPL_COMMENT_HOOK_START

  // @@ Michael: Set the input CDR size to ACE_MAX_DGRAM_SIZE so that
  //             we read the whole UDP packet on a single read.
  if (flag)
    {
      // Use the lite version of the protocol
      ACE_NEW (this->messaging_object_,
               TAO_GIOP_Message_Lite (orb_core));
    }
  else
    {
      // Use the normal GIOP object
      ACE_NEW (this->messaging_object_,
               TAO_GIOP_Message_Base (orb_core,
                                      this));
    }

//@@ MESSAGING_SPL_COMMENT_HOOK_END

}

TAO_COIOP_Transport::~TAO_COIOP_Transport (void)
{
  delete this->messaging_object_;
}

ACE_Event_Handler *
TAO_COIOP_Transport::event_handler_i (void)
{
  return this->connection_handler_;
}

TAO_Connection_Handler *
TAO_COIOP_Transport::connection_handler_i (void)
{
  return this->connection_handler_;
}

TAO_Pluggable_Messaging *
TAO_COIOP_Transport::messaging_object (void)
{
  return this->messaging_object_;
}

ssize_t
TAO_COIOP_Transport::send (iovec *,
                          int ,
                          size_t &bytes_transferred,
                          const ACE_Time_Value *)
{
  // We don't send data over the wire with COIOP
  bytes_transferred = 0;

  return 1;
}

ssize_t
TAO_COIOP_Transport::recv (char *,
                          size_t ,
                          const ACE_Time_Value *)
{
  return 0;
}

int
TAO_COIOP_Transport::handle_input (TAO_Resume_Handle &,
                                  ACE_Time_Value *,
                                  int /*block*/)
{
  return 0;
}


int
TAO_COIOP_Transport::register_handler (void)
{
  // We do never register register the handler with the reactor
  // as we never need to be informed about any incoming data,
  // assuming we only use one-ways.
  // If we would register and ICMP Messages would arrive, e.g
  // due to a not reachable server, we would get informed - as this
  // disturbs the general COIOP assumptions of not being
  // interested in any network failures, we ignore ICMP messages.
  return 0;
}


int
TAO_COIOP_Transport::send_request (TAO_Stub *,
                                  TAO_ORB_Core *,
                                  TAO_OutputCDR &,
                                  int,
                                  ACE_Time_Value *)
{
  return 0;
}

int
TAO_COIOP_Transport::send_message (TAO_OutputCDR &,
                                  TAO_Stub *,
                                  int,
                                  ACE_Time_Value *)
{
  return 1;
}

int
TAO_COIOP_Transport::send_message_shared (TAO_Stub *,
                                         int,
                                         const ACE_Message_Block *,
                                         ACE_Time_Value *)
{
  return 1;
}

int
TAO_COIOP_Transport::messaging_init (CORBA::Octet major,
                                    CORBA::Octet minor)
{
  this->messaging_object_->init (major, minor);
  return 1;
}

TAO_END_VERSIONED_NAMESPACE_DECL

#endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */