00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 #ifndef TAO_GIOP_MESSAGE_LITE_H
00015 #define TAO_GIOP_MESSAGE_LITE_H
00016 
00017 #include  "ace/pre.h"
00018 
00019 #include "tao/Pluggable_Messaging.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif 
00024 
00025 #include "tao/Pluggable_Messaging_Utils.h"
00026 #include "tao/GIOP_Utils.h"
00027 #include "tao/SystemException.h"
00028 #include "tao/CDR.h"
00029 
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 class TAO_Operation_Details;
00033 class TAO_Pluggable_Reply_Params;
00034 class TAO_GIOP_Locate_Request_Header;
00035 class TAO_Queued_Data;
00036 class TAO_ServerRequest;
00037 class TAO_GIOP_Message_Version;
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 class TAO_Export TAO_GIOP_Message_Lite : public TAO_Pluggable_Messaging
00048 {
00049 public:
00050 
00051 
00052   TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core,
00053                          size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE);
00054 
00055 
00056   virtual ~TAO_GIOP_Message_Lite (void);
00057 
00058 
00059   virtual void init (CORBA::Octet, CORBA::Octet);
00060 
00061 
00062   virtual void reset (void);
00063 
00064 
00065 
00066   virtual int generate_request_header (TAO_Operation_Details &op,
00067                                        TAO_Target_Specification &spec,
00068                                        TAO_OutputCDR &cdr);
00069 
00070 
00071   virtual int generate_locate_request_header (
00072       TAO_Operation_Details &op,
00073       TAO_Target_Specification &spec,
00074       TAO_OutputCDR &cdr);
00075 
00076 
00077   virtual int generate_reply_header (
00078       TAO_OutputCDR &cdr,
00079       TAO_Pluggable_Reply_Params_Base ¶ms
00080     );
00081 
00082   virtual int generate_fragment_header (TAO_OutputCDR & cdr,
00083                                         CORBA::ULong request_id);
00084 
00085 
00086 
00087 
00088   virtual int format_message (TAO_OutputCDR &cdr);
00089 
00090 private:
00091 
00092 
00093 
00094 
00095 
00096 
00097   int parse_incoming_messages (ACE_Message_Block &message_block);
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106   TAO_Pluggable_Message_Type message_type (void) const;
00107 
00108 public:
00109 
00110 
00111 
00112 
00113   virtual int parse_next_message (ACE_Message_Block &incoming,
00114                                   TAO_Queued_Data &qd,        
00115                                   size_t &mesg_length);      
00116 
00117 
00118 
00119 
00120 
00121 
00122   virtual int extract_next_message (ACE_Message_Block &incoming,
00123                                     TAO_Queued_Data *&qd);
00124 
00125 
00126   virtual int consolidate_node (TAO_Queued_Data *qd,
00127                                 ACE_Message_Block &incoming);
00128 
00129 
00130 
00131   virtual int process_request_message (TAO_Transport *transport,
00132                                        TAO_Queued_Data *qd);
00133 
00134 
00135 
00136   virtual int process_reply_message (
00137       TAO_Pluggable_Reply_Params &reply_info,
00138       TAO_Queued_Data *qd);
00139 
00140 
00141   virtual int generate_exception_reply (
00142       TAO_OutputCDR &cdr,
00143       TAO_Pluggable_Reply_Params_Base ¶ms,
00144       CORBA::Exception &x
00145     );
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156   virtual int consolidate_fragmented_message (TAO_Queued_Data *qd,
00157                                               TAO_Queued_Data *&msg);
00158 
00159 
00160 
00161 
00162 
00163 
00164   virtual int discard_fragmented_message (const TAO_Queued_Data *cancel_request);
00165 
00166 
00167   virtual TAO_GIOP_Fragmentation_Strategy * fragmentation_strategy (void);
00168 
00169 private:
00170 
00171 
00172 
00173 
00174   int write_protocol_header (TAO_GIOP_Message_Type t,
00175                              TAO_OutputCDR &msg);
00176 
00177 
00178   int process_request (TAO_Transport *transport,
00179                        TAO_InputCDR &input,
00180                        TAO_OutputCDR &output);
00181 
00182 
00183   int process_locate_request (TAO_Transport *transport,
00184                               TAO_InputCDR &input,
00185                               TAO_OutputCDR &output);
00186 
00187 
00188 
00189 
00190 
00191   int make_send_locate_reply (TAO_Transport *transport,
00192                               TAO_OutputCDR &output,
00193                               TAO_GIOP_Locate_Request_Header &request,
00194                               TAO_GIOP_Locate_Status_Msg &status);
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                               void *ctx);
00203 
00204 
00205 
00206   int send_reply_exception (TAO_Transport *transport,
00207                             TAO_ORB_Core* orb_core,
00208                             CORBA::ULong request_id,
00209                             IOP::ServiceContextList *svc_info,
00210                             CORBA::Exception *x);
00211 
00212 
00213   void dump_msg (const char *label,
00214                  const u_char *ptr,
00215                  size_t len);
00216 
00217   TAO_Queued_Data *make_queued_data (size_t sz);
00218 
00219 
00220   virtual int generate_locate_reply_header (
00221       TAO_OutputCDR & ,
00222       TAO_Pluggable_Reply_Params_Base & );
00223 
00224 
00225 
00226   virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg);
00227 
00228 
00229   virtual size_t header_length (void) const;
00230 
00231 
00232   virtual size_t fragment_header_length (CORBA::Octet major,
00233                                          CORBA::Octet minor) const;
00234 
00235   virtual TAO_OutputCDR &out_stream (void);
00236 
00237 private:
00238 
00239 
00240   int write_request_header (
00241       const TAO_Operation_Details &opdetails,
00242       TAO_Target_Specification &spec,
00243       TAO_OutputCDR &msg);
00244 
00245 
00246   int write_locate_request_header (
00247       CORBA::ULong request_id,
00248       TAO_Target_Specification &spec,
00249       TAO_OutputCDR &msg);
00250 
00251 
00252   int write_reply_header (
00253       TAO_OutputCDR &output,
00254       TAO_Pluggable_Reply_Params_Base &reply
00255       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00256     ACE_THROW_SPEC ((CORBA::SystemException));
00257 
00258 
00259   int write_locate_reply_mesg (
00260       TAO_OutputCDR &output,
00261       CORBA::ULong request_id,
00262       TAO_GIOP_Locate_Status_Msg &status);
00263 
00264 
00265 
00266   int parse_request_header (TAO_ServerRequest &);
00267 
00268 
00269 
00270   int parse_locate_header (
00271       TAO_GIOP_Locate_Request_Header &);
00272 
00273 
00274   int parse_reply (TAO_InputCDR &input,
00275                    TAO_Pluggable_Reply_Params ¶ms);
00276 
00277 
00278   int parse_locate_reply (TAO_InputCDR &input,
00279                           TAO_Pluggable_Reply_Params ¶ms);
00280 
00281 
00282   void init_queued_data (TAO_Queued_Data* qd) const;
00283 
00284 private:
00285 
00286 
00287   TAO_ORB_Core *orb_core_;
00288 
00289 
00290   CORBA::Octet message_type_;
00291 
00292 
00293   CORBA::ULong message_size_;
00294 
00295 
00296 
00297   CORBA::Octet byte_order_;
00298 
00299   TAO_OutputCDR cdr_;
00300 };
00301 
00302 TAO_END_VERSIONED_NAMESPACE_DECL
00303 
00304 #include  "ace/post.h"
00305 #endif