00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TAO_GIOP_MESSAGE_BASE_H
00015 #define TAO_GIOP_MESSAGE_BASE_H
00016
00017 #include "ace/pre.h"
00018
00019 #include "tao/TAO_Export.h"
00020
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif
00024
00025 #include "tao/Exception.h"
00026 #include "tao/Pluggable_Messaging_Utils.h"
00027 #include "tao/GIOP_Message_Generator_Parser_Impl.h"
00028 #include "tao/GIOP_Utils.h"
00029 #include "tao/GIOP_Message_State.h"
00030 #include "tao/GIOP_Fragmentation_Strategy.h"
00031 #include "tao/CDR.h"
00032 #include "tao/Incoming_Message_Stack.h"
00033
00034 #include "ace/Auto_Ptr.h"
00035
00036 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00037
00038 class TAO_Pluggable_Reply_Params;
00039 class TAO_Queued_Data;
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 class TAO_Export TAO_GIOP_Message_Base
00052 {
00053 public:
00054
00055 TAO_GIOP_Message_Base (TAO_ORB_Core *orb_core,
00056 TAO_Transport * transport,
00057 size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE);
00058
00059
00060 ~TAO_GIOP_Message_Base (void);
00061
00062
00063
00064 void init (CORBA::Octet major, CORBA::Octet minor);
00065
00066
00067
00068 int generate_request_header (TAO_Operation_Details &op,
00069 TAO_Target_Specification &spec,
00070 TAO_OutputCDR &cdr);
00071
00072
00073 int generate_locate_request_header (
00074 TAO_Operation_Details &op,
00075 TAO_Target_Specification &spec,
00076 TAO_OutputCDR &cdr);
00077
00078
00079 int generate_reply_header (
00080 TAO_OutputCDR &cdr,
00081 TAO_Pluggable_Reply_Params_Base ¶ms);
00082
00083 int generate_fragment_header (TAO_OutputCDR & cdr, CORBA::ULong request_id);
00084
00085
00086
00087
00088 int format_message (TAO_OutputCDR &cdr);
00089
00090
00091
00092
00093
00094
00095
00096
00097 int parse_next_message (TAO_Queued_Data &qd, size_t &mesg_length);
00098
00099
00100
00101
00102
00103 int extract_next_message (ACE_Message_Block &incoming, TAO_Queued_Data *&qd);
00104
00105
00106 int consolidate_node (TAO_Queued_Data *qd, ACE_Message_Block &incoming);
00107
00108
00109
00110 int process_request_message (TAO_Transport *transport, TAO_Queued_Data *qd);
00111
00112
00113
00114 int process_reply_message (
00115 TAO_Pluggable_Reply_Params &reply_info,
00116 TAO_Queued_Data *qd);
00117
00118
00119 int generate_exception_reply (
00120 TAO_OutputCDR &cdr,
00121 TAO_Pluggable_Reply_Params_Base ¶ms,
00122 const CORBA::Exception &x);
00123
00124
00125 size_t header_length (void) const;
00126
00127
00128 size_t fragment_header_length (
00129 const TAO_GIOP_Message_Version& giop_version) const;
00130
00131 TAO_OutputCDR &out_stream (void);
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 int consolidate_fragmented_message (TAO_Queued_Data *qd,
00143 TAO_Queued_Data *&msg);
00144
00145
00146
00147
00148
00149
00150 int discard_fragmented_message (const TAO_Queued_Data *cancel_request);
00151
00152
00153 TAO_GIOP_Fragmentation_Strategy * fragmentation_strategy (void);
00154
00155
00156
00157 bool is_ready_for_bidirectional (TAO_OutputCDR &msg) const;
00158
00159 private:
00160
00161 int process_request (TAO_Transport *transport,
00162 TAO_InputCDR &input,
00163 TAO_OutputCDR &output,
00164 TAO_GIOP_Message_Generator_Parser *);
00165
00166
00167 int process_locate_request (TAO_Transport *transport,
00168 TAO_InputCDR &input,
00169 TAO_OutputCDR &output,
00170 TAO_GIOP_Message_Generator_Parser *);
00171
00172
00173 TAO_GIOP_Message_Generator_Parser *get_parser (
00174 const TAO_GIOP_Message_Version &version) const;
00175
00176
00177 void dump_msg (const char *label, const u_char *ptr, size_t len);
00178
00179
00180
00181
00182 int write_protocol_header (GIOP::MsgType t,
00183 const TAO_GIOP_Message_Version& version,
00184 TAO_OutputCDR &msg);
00185
00186
00187
00188
00189
00190 int make_send_locate_reply (TAO_Transport *transport,
00191 TAO_GIOP_Locate_Request_Header &request,
00192 TAO_GIOP_Locate_Status_Msg &status,
00193 TAO_OutputCDR &output,
00194 TAO_GIOP_Message_Generator_Parser *);
00195
00196
00197 int send_error (TAO_Transport *transport);
00198
00199
00200 void send_close_connection (const TAO_GIOP_Message_Version &version,
00201 TAO_Transport *transport);
00202
00203
00204
00205 int send_reply_exception (TAO_Transport *transport,
00206 TAO_OutputCDR &cdr,
00207 CORBA::ULong request_id,
00208 IOP::ServiceContextList *svc_info,
00209 CORBA::Exception *x);
00210
00211
00212 int generate_locate_reply_header (
00213 TAO_OutputCDR &cdr,
00214 TAO_Pluggable_Reply_Params_Base ¶ms);
00215
00216
00217
00218 TAO_Queued_Data *make_queued_data (size_t sz);
00219
00220
00221
00222 int parse_request_id (const TAO_Queued_Data *qd, CORBA::ULong &request_id) const;
00223
00224
00225
00226 int parse_request_id (const TAO_InputCDR &cdr, CORBA::ULong &request_id) const;
00227
00228
00229
00230
00231
00232
00233
00234 void set_giop_flags (TAO_OutputCDR & msg) const;
00235
00236 private:
00237
00238 TAO_ORB_Core *orb_core_;
00239
00240
00241 TAO_GIOP_Message_Generator_Parser_Impl tao_giop_impl_;
00242
00243
00244
00245 TAO::Incoming_Message_Stack fragment_stack_;
00246
00247 protected:
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257 auto_ptr<TAO_GIOP_Fragmentation_Strategy> fragmentation_strategy_;
00258
00259
00260 TAO_OutputCDR out_stream_;
00261 };
00262
00263 TAO_END_VERSIONED_NAMESPACE_DECL
00264
00265 #include "ace/post.h"
00266
00267 #endif