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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
// -*- C++ -*-
//=============================================================================
/**
* @file TAO_Server_Request.h
*
* $Id$
*
* Header file for CORBA's Server Skeleton Interface's
* "Server Request" type.
*
*
* @author Copyright 1994-1995 by Sun Microsystems Inc.
* @author Chris Cleeland
* @author Aniruddha Gokhale
*/
//=============================================================================
#ifndef TAO_SERVER_REQUEST_H
#define TAO_SERVER_REQUEST_H
#include /**/ "ace/pre.h"
#include "ace/SString.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "tao/Tagged_Profile.h"
#include "tao/Service_Context.h"
#include "tao/Object.h"
#include "tao/Transport_Selection_Guard.h"
#if TAO_HAS_INTERCEPTORS == 1
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
namespace TAO
{
class PICurrent;
class PICurrent_Impl;
}
TAO_END_VERSIONED_NAMESPACE_DECL
#include "tao/PortableInterceptorC.h"
#endif /* TAO_HAS_INTERCEPTORS == 1 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
class TAO_Pluggable_Messaging;
class TAO_Transport;
class TAO_AMH_Response_Handler;
namespace CORBA
{
class ORB;
typedef ORB *ORB_ptr;
class Exception;
}
namespace TAO
{
namespace CSD
{
class FW_Server_Request_Wrapper;
}
}
class TAO_Operation_Details;
/**
* @class TAO_ServerRequest
*
* @brief Class representing a ServerRequest object.
*
* Encapsulates CDR, transport and pluggable messaging
* components on the server side.
*/
class TAO_Export TAO_ServerRequest
{
public:
/// Declare FW_Server_Request_Wrapper a friend
/// This friendship makes the FW_Server_Request_Wrapper be able to
/// clone the TAO_ServerRequest.
friend class TAO::CSD::FW_Server_Request_Wrapper;
/// Declare TAO_AMH_Response_Handler a friend
/**
* The TAO_AMH_Response_Handler class needs to copy part of the
* state in a TAO_ServerRequest, however, we do not want to expose
* that state as public members of this class, neither do we want to
* add modifiers to the TAO_AMH_Response_Handler class that would
* allow us (the TAO_ServerRequest class) to set the state.
*
* Lucky for us, C++ is a language for adult developers, and allow
* us to use the evil "friend" declaration.
*
*/
friend class TAO_AMH_Response_Handler;
// Constructors.
TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
TAO_InputCDR &input,
TAO_OutputCDR &output,
TAO_Transport *transport,
TAO_ORB_Core *orb_core);
TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
CORBA::ULong request_id,
CORBA::Boolean response_expected,
CORBA::Boolean deferred_flag,
TAO::ObjectKey &object_key,
const char *operation,
TAO_OutputCDR &output,
TAO_Transport *transport,
TAO_ORB_Core *orb_core,
int &parse_error);
/// Constructor used by thru-POA collocated invocation path.
TAO_ServerRequest (TAO_ORB_Core * orb_core,
TAO_Operation_Details const & details,
CORBA::Object_ptr target);
/// Destructor.
~TAO_ServerRequest (void);
/**
* @name Request attributes.
*/
//@{
/// Return the operation name.
const char *operation (void) const;
/// Set the operation name.
void operation (const char *operation,
size_t length,
int release);
/// Return the length of the operation.
size_t operation_length (void) const;
//@}
/// Return the underlying ORB.
CORBA::ORB_ptr orb (void);
/// Return the ORB core pointer member.
TAO_ORB_Core *orb_core (void) const;
/// Start a Reply message.
void init_reply (void);
/// Retrieve the incoming stream.
TAO_InputCDR * incoming (void) const;
/// Retrieve the outgoing stream.
TAO_OutputCDR * outgoing (void) const;
/// Is the response expected?
CORBA::Boolean response_expected (void) const;
/// Should the reply be deferred?
CORBA::Boolean deferred_reply (void) const;
/// Set the response expected flag.
void response_expected (CORBA::Boolean response);
/// Should we return before dispatching the servant?
CORBA::Boolean sync_with_server (void) const;
/// Set the sync_with_server flag.
void sync_with_server (CORBA::Boolean sync_flag);
/// Used with reliable oneway requests.
void send_no_exception_reply (void);
TAO::ObjectKey &object_key (void);
/// Return the request TAO_Service_Context
TAO_Service_Context &request_service_context (void);
/// Return the reply TAO_Service_Context
TAO_Service_Context &reply_service_context (void);
IOP::ServiceContextList &reply_service_info (void);
IOP::ServiceContextList &request_service_info (void);
/// Return the underlying transport
TAO_Transport *transport ();
/// To handle System Exceptions at the lowest level, a method
/// returning the request_id_ is needed.
//@{
CORBA::ULong request_id (void);
void request_id (CORBA::ULong req);
//@}
/**
* Set the reference to the object the request should be forwarded
* to. This reference will only be used if set prior to calling
* init_reply().
*/
void forward_location (CORBA::Object_ptr forward_reference);
/// Get the forward_location.
CORBA::Object_ptr forward_location (void);
/// Get the exception type.
CORBA::ULong exception_type (void);
/// Set the exception type.
void exception_type (CORBA::ULong except_type);
/// Set the requesting principal
void requesting_principal (const CORBA::OctetSeq & principal);
/// Return the reference to the tagged profile
TAO_Tagged_Profile &profile (void);
void tao_send_reply (void);
void tao_send_reply_exception (CORBA::Exception&);
/// Set the boolean member to 1.
void is_dsi (void);
/// Set the member.
void dsi_nvlist_align (ptrdiff_t alignment);
// Get the operation details for the current request.
TAO_Operation_Details const * operation_details (void) const;
/// Set the argument_flag
void argument_flag (CORBA::Boolean flag);
/// Get the argument_flag
CORBA::Boolean argument_flag (void);
/// Returns @c true if the current request is collocated.
bool collocated (void) const;
#if TAO_HAS_INTERCEPTORS == 1
/// Send cached reply. Used in scenarios where the FTORB thinks that
/// this request is a duplicate
void send_cached_reply (CORBA::OctetSeq &ocs);
/// Return the octet sequence pointer through which the FTORB would
/// send the reply back.
void result_seq (CORBA::OctetSeq &ocs);
/// Check whether we got the result.
int got_result (void);
/// Return a reference to the number of interceptors pushed on to
/// the current interceptor flow stack.
/**
* @note It is a reference since the Portable Interceptor flow stack
* code must be able to modify this value and use that value
* at a later time without being forced to use TSS.
*/
size_t & interceptor_count (void);
/// Return a reference to the "request scope" PICurrent object.
TAO::PICurrent_Impl *rs_pi_current (void);
CORBA::Exception *caught_exception (void);
void caught_exception (CORBA::Exception *exception);
/// Set the status of the received reply.
void reply_status (PortableInterceptor::ReplyStatus s);
/// Get the status of the received reply.
PortableInterceptor::ReplyStatus reply_status (void);
#endif /* TAO_HAS_INTERCEPTORS == 1 */
private:
/// Default ctor only used to create a TAO_ServerRequest that is about
/// to be the target of a clone operation.
TAO_ServerRequest (void);
TAO_Pluggable_Messaging *mesg_base_;
/// Operation name.
const char* operation_;
/// Operation length.
size_t operation_len_;
/// Do we own the memory associated with operation_?
bool release_operation_;
CORBA::Object_var forward_location_;
/// Incoming stream.
TAO_InputCDR *incoming_;
/// Outgoing stream.
TAO_OutputCDR *outgoing_;
/// Transport class.
TAO_Transport *transport_;
/// 0: oneway (SYNC_NONE or SYNC_WITH_TRANSPORT)
/// 1: twoway, or oneway (SYNC_WITH_SERVER or SYNC_WITH_TARGET)
CORBA::Boolean response_expected_;
/**
* 0: Reply would be sent by the object of this class which is the
* default.
* 1: Reply would not be prepared by this class and it would be
* deferred for somebody.
*/
CORBA::Boolean deferred_reply_;
/// 1: oneway (SYNC_WITH_SERVER)
/// 0: anything else
CORBA::Boolean sync_with_server_;
/// Did we get passed to a CORBA::ServerRequest?
CORBA::Boolean is_dsi_;
/// Exception type (will be NO_EXCEPTION in the majority of the cases).
CORBA::ULong exception_type_;
/// A pointer to the ORB Core for the context where the request was
/// created.
TAO_ORB_Core *orb_core_;
/// Service Context info
TAO_Service_Context request_service_context_;
TAO_Service_Context reply_service_context_;
/// Unique identifier for a request.
CORBA::ULong request_id_;
/// The tagged profile that has the addressing information.
TAO_Tagged_Profile profile_;
/// Identifies the requester.
CORBA::OctetSeq_var requesting_principal_;
/// Used to pad CDR stream if we have used DSI.
ptrdiff_t dsi_nvlist_align_;
TAO_Operation_Details const * operation_details_;
/**
* An argument flag to indicate whether there is any data that is
* going to get marshaled along as a reply. The default will be 1
* which indicates that we have some data that needs to be sent back
* to the client.
*/
CORBA::Boolean argument_flag_;
#if TAO_HAS_INTERCEPTORS == 1
/// The number of interceptors pushed on to the current interceptor
/// flow stack.
size_t interceptor_count_;
/// The "Request Scope Current" (RSC) object, as required by
/// Portable Interceptors.
TAO::PICurrent_Impl *rs_pi_current_;
/// Used by the FTORB
CORBA::OctetSeq_var result_seq_;
/// Pointer to the caught exception.
CORBA::Exception * caught_exception_;
/// Reply status for the current request.
PortableInterceptor::ReplyStatus reply_status_;
#endif /* TAO_HAS_INTERCEPTORS == 1 */
/// An RAII (resource acquisition is initialization) class instance
/// for interfacing with TSS storage for the "current" transport.
TAO::Transport_Selection_Guard transport_selection_guard_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
# include "tao/TAO_Server_Request.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* TAO_SERVER_REQUEST_H */
|