Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_GIOP_Message_Generator_Parser_10 Class Reference

Implementation for GIOP v1.0. More...

#include <GIOP_Message_Generator_Parser_10.h>

Inheritance diagram for TAO_GIOP_Message_Generator_Parser_10:

Inheritance graph
[legend]
Collaboration diagram for TAO_GIOP_Message_Generator_Parser_10:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual int write_request_header (const TAO_Operation_Details &opdetails, TAO_Target_Specification &spec, TAO_OutputCDR &msg)
 Write the request header in to <msg>. More...

virtual int write_locate_request_header (CORBA::ULong request_id, TAO_Target_Specification &spec, TAO_OutputCDR &msg)
 Write the LocateRequest header. More...

virtual int write_reply_header (TAO_OutputCDR &output, TAO_Pluggable_Reply_Params_Base &reply ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Write the reply header in to <output>. More...

virtual int write_locate_reply_mesg (TAO_OutputCDR &output, CORBA::ULong request_id, TAO_GIOP_Locate_Status_Msg &status)
 Writes the locate _reply message in to the <output>. More...

virtual int parse_request_header (TAO_ServerRequest &)
 Parse the Request Header from the incoming stream. This will do a version specific parsing of the incoming Request header. More...

virtual int parse_locate_header (TAO_GIOP_Locate_Request_Header &)
 Parse the LocateRequest Header from the incoming stream. This will do a version specific parsing of the incoming Request header. More...

virtual int parse_reply (TAO_InputCDR &input, TAO_Pluggable_Reply_Params &params)
 Parse the reply message from the server. More...

virtual int parse_locate_reply (TAO_InputCDR &input, TAO_Pluggable_Reply_Params &params)
 Parse the reply message from the server. More...

virtual CORBA::Octet major_version (void)
 Our versions. More...

virtual CORBA::Octet minor_version (void)

Detailed Description

Implementation for GIOP v1.0.

Definition at line 32 of file GIOP_Message_Generator_Parser_10.h.


Member Function Documentation

CORBA::Octet TAO_GIOP_Message_Generator_Parser_10::major_version void    [virtual]
 

Our versions.

Implements TAO_GIOP_Message_Generator_Parser.

Definition at line 446 of file GIOP_Message_Generator_Parser_10.cpp.

00447 {
00448   // Any harm in hardcoding??
00449   return (CORBA::Octet) 1;
00450 }

CORBA::Octet TAO_GIOP_Message_Generator_Parser_10::minor_version void    [virtual]
 

Implements TAO_GIOP_Message_Generator_Parser.

Reimplemented in TAO_GIOP_Message_Generator_Parser_11.

Definition at line 453 of file GIOP_Message_Generator_Parser_10.cpp.

00454 {
00455   // Any harm in hardcoding??
00456   return 0;
00457 }

int TAO_GIOP_Message_Generator_Parser_10::parse_locate_header TAO_GIOP_Locate_Request_Header   [virtual]
 

Parse the LocateRequest Header from the incoming stream. This will do a version specific parsing of the incoming Request header.

Implements TAO_GIOP_Message_Generator_Parser.

Definition at line 373 of file GIOP_Message_Generator_Parser_10.cpp.

References TAO_GIOP_Locate_Request_Header::incoming_stream, TAO_GIOP_Locate_Request_Header::profile, ACE_InputCDR::read_ulong, TAO_GIOP_Locate_Request_Header::request_id, and TAO_Tagged_Profile::unmarshall_object_key.

00376 {
00377   // Get the stream
00378   TAO_InputCDR &msg = request.incoming_stream ();
00379 
00380   CORBA::Boolean hdr_status = 1;
00381 
00382   // Get the request id
00383   CORBA::ULong req_id = 0;
00384   hdr_status = msg.read_ulong (req_id);
00385 
00386   // Store it in the Locate request classes
00387   request.request_id (req_id);
00388 
00389   // Get the object key
00390   hdr_status =
00391     hdr_status && request.profile ().unmarshall_object_key (msg);
00392 
00393   return hdr_status ? 0 : -1;
00394 }

int TAO_GIOP_Message_Generator_Parser_10::parse_locate_reply TAO_InputCDR   input,
TAO_Pluggable_Reply_Params   params
[virtual]
 

Parse the reply message from the server.

Reimplemented from TAO_GIOP_Message_Generator_Parser.

Definition at line 428 of file GIOP_Message_Generator_Parser_10.cpp.

References ACE_InputCDR::exchange_data_blocks, TAO_Pluggable_Reply_Params::input_cdr_, and TAO_GIOP_Message_Generator_Parser::parse_locate_reply.

00432 {
00433   if (TAO_GIOP_Message_Generator_Parser::parse_locate_reply (cdr,
00434                                                              params) == -1)
00435 
00436     return -1;
00437 
00438   // Steal the contents in to the reply CDR and loose ownership of the
00439   // data block.
00440   params.input_cdr_.exchange_data_blocks (cdr);
00441 
00442   return 0;
00443 }

int TAO_GIOP_Message_Generator_Parser_10::parse_reply TAO_InputCDR   input,
TAO_Pluggable_Reply_Params   params
[virtual]
 

Parse the reply message from the server.

Reimplemented from TAO_GIOP_Message_Generator_Parser.

Definition at line 399 of file GIOP_Message_Generator_Parser_10.cpp.

References ACE_DEBUG, ACE_TEXT, ACE_InputCDR::exchange_data_blocks, TAO_Pluggable_Reply_Params::input_cdr_, LM_DEBUG, TAO_GIOP_Message_Generator_Parser::parse_reply, and TAO_Pluggable_Reply_Params_Base::svc_ctx_.

00403 {
00404   // Read the service context list first
00405   if ((cdr >> params.svc_ctx_) == 0)
00406     {
00407       if (TAO_debug_level >     0)
00408         ACE_DEBUG ((LM_DEBUG,
00409                     ACE_TEXT ("TAO (%P|%t) parse_reply, ")
00410                     ACE_TEXT ("extracting context\n")));
00411       return -1;
00412     }
00413 
00414   // Call the base class for further processing
00415   if (TAO_GIOP_Message_Generator_Parser::parse_reply (cdr,
00416                                                       params) == -1)
00417     return -1;
00418 
00419   // Steal rest of the contents in to the reply params and loose
00420   // ownership of the  data block.
00421   params.input_cdr_.exchange_data_blocks (cdr);
00422 
00423   return 0;
00424 }

int TAO_GIOP_Message_Generator_Parser_10::parse_request_header TAO_ServerRequest   [virtual]
 

Parse the Request Header from the incoming stream. This will do a version specific parsing of the incoming Request header.

Implements TAO_GIOP_Message_Generator_Parser.

Definition at line 283 of file GIOP_Message_Generator_Parser_10.cpp.

References ACE_InputCDR::good_bit, TAO_ServerRequest::incoming, TAO_ServerRequest::operation, TAO_ServerRequest::profile, ACE_InputCDR::rd_ptr, ACE_InputCDR::read_octet, ACE_InputCDR::read_ulong, TAO_ServerRequest::request_id, TAO_ServerRequest::request_service_info, TAO_ServerRequest::requesting_principal, TAO_ServerRequest::response_expected, ACE_InputCDR::skip_bytes, TAO_ServerRequest::sync_with_server, and TAO_Tagged_Profile::unmarshall_object_key.

00285 {
00286   // Tear out the service context ... we currently ignore it, but it
00287   // should probably be passed to each ORB service as appropriate
00288   // (e.g. transactions, security).
00289   //
00290   // NOTE: As security support kicks in, this is a good place to
00291   // verify a digital signature, if that is required in this security
00292   // environment.  It may be required even when using IPSEC security
00293   // infrastructure.
00294 
00295   // Get the input CDR in the request class
00296   TAO_InputCDR& input = request.incoming ();
00297 
00298   IOP::ServiceContextList &service_info =
00299     request.request_service_info ();
00300 
00301   input >> service_info;
00302 
00303   CORBA::Boolean hdr_status =
00304     (CORBA::Boolean) input.good_bit ();
00305 
00306   CORBA::ULong req_id;
00307 
00308   // Get the rest of the request header ...
00309   hdr_status = hdr_status && input.read_ulong (req_id);
00310 
00311   request.request_id (req_id);
00312 
00313   CORBA::Octet response_flags;
00314   hdr_status = hdr_status && input.read_octet (response_flags);
00315   request.response_expected ((response_flags != 0));
00316 
00317   // This is not supported now in GIOP 1.1
00318   request.sync_with_server (0);
00319 
00320   // We use ad-hoc demarshalling here: there is no need to increase
00321   // the reference count on the CDR message block, because this key
00322   // will not outlive the request (or the message block).
00323 
00324   hdr_status =
00325     hdr_status && request.profile ().unmarshall_object_key (input);
00326 
00327   // According to the CORBA 2.6.1 (and older) specification, the operation
00328   // name is an IDL Identifier. Identifiers must be composed of ASCII letters,
00329   // numbers, and underscores, starting with a letter. Based on this, and
00330   // the fact that I could find no text explicitly requiring operation name
00331   // translation, nor could others in the CORBA community, the operation name
00332   // will not be translated regardless of the translation of other strings.
00333   //
00334   CORBA::ULong length = 0;
00335   hdr_status = hdr_status && input.read_ulong (length);
00336 
00337   if (hdr_status)
00338     {
00339       // Do not include NULL character at the end.
00340       // @@ This is not getting demarshaled using the codeset
00341       //    translators!
00342 
00343       // Notice that there are no memory allocations involved
00344       // here!
00345       request.operation (input.rd_ptr (),
00346                          length - 1,
00347                          0 /* TAO_ServerRequest does NOT own string */);
00348       hdr_status = input.skip_bytes (length);
00349     }
00350 
00351   if (hdr_status)
00352     {
00353       /**** This has been deprecated in 2.4 ****/
00354       /*CORBA::Principal_var principal;
00355 
00356       input >> principal.out ();
00357 
00358       request.requesting_principal (principal.in ()); */
00359 
00360       CORBA_OctetSeq oct_seq;
00361       input >> oct_seq;
00362       request.requesting_principal (oct_seq);
00363       hdr_status = (CORBA::Boolean) input.good_bit ();
00364     }
00365 
00366 
00367   return hdr_status ? 0 : -1;
00368 }

int TAO_GIOP_Message_Generator_Parser_10::write_locate_reply_mesg TAO_OutputCDR   output,
CORBA::ULong    request_id,
TAO_GIOP_Locate_Status_Msg   status
[virtual]
 

Writes the locate _reply message in to the <output>.

Implements TAO_GIOP_Message_Generator_Parser.

Definition at line 251 of file GIOP_Message_Generator_Parser_10.cpp.

References ACE_DEBUG, ACE_TEXT, TAO_GIOP_Locate_Status_Msg::forward_location_var, LM_DEBUG, TAO_GIOP_Locate_Status_Msg::status, TAO_GIOP_OBJECT_FORWARD, and ACE_OutputCDR::write_ulong.

00256 {
00257   // Make the header for the locate request
00258   output.write_ulong (request_id);
00259   output.write_ulong (status_info.status);
00260 
00261   if (status_info.status == TAO_GIOP_OBJECT_FORWARD)
00262     {
00263       CORBA::Object_ptr object_ptr =
00264         status_info.forward_location_var.in ();
00265 
00266       if ((output << object_ptr) == 0)
00267         {
00268           if (TAO_debug_level > 0)
00269             {
00270               ACE_DEBUG ((
00271                   LM_DEBUG,
00272                   ACE_TEXT ("TAO (%P|%t|%N|%l) write_locate_reply_mesg-")
00273                   ACE_TEXT (" cannot marshal object reference\n")
00274                 ));
00275             }
00276         }
00277     }
00278 
00279   return 1;
00280 }

int TAO_GIOP_Message_Generator_Parser_10::write_locate_request_header CORBA::ULong    request_id,
TAO_Target_Specification   spec,
TAO_OutputCDR   msg
[virtual]
 

Write the LocateRequest header.

Implements TAO_GIOP_Message_Generator_Parser.

Definition at line 89 of file GIOP_Message_Generator_Parser_10.cpp.

References ACE_DEBUG, ACE_TEXT, LM_DEBUG, and TAO_Target_Specification::object_key.

00093 {
00094   msg << request_id;
00095 
00096   // In this case we cannot recognise anything other than the Object
00097   // key as the address disposition variable. But we do a sanity check
00098   // anyway.
00099   const TAO_ObjectKey *key = spec.object_key ();
00100   if (key)
00101     {
00102       // Everything is fine
00103       msg << *key;
00104     }
00105   else
00106     {
00107       if (TAO_debug_level)
00108         ACE_DEBUG ((LM_DEBUG,
00109                     ACE_TEXT ("(%N | %l) Unable to handle this request \n")));
00110       return 0;
00111     }
00112 
00113   return 1;
00114 }

int TAO_GIOP_Message_Generator_Parser_10::write_reply_header TAO_OutputCDR   output,
TAO_Pluggable_Reply_Params_Base &reply    ACE_ENV_ARG_DECL
throw (CORBA::SystemException) [virtual]
 

Write the reply header in to <output>.

Implements TAO_GIOP_Message_Generator_Parser.

Definition at line 118 of file GIOP_Message_Generator_Parser_10.cpp.

References ACE_ENV_ARG_DECL, ACE_ENV_ARG_NOT_USED, ACE_THROW_RETURN, TAO_Unbounded_Base_Sequence::length, ACE_CDR::LONG_ALIGN, ACE_CDR::MAX_ALIGNMENT, ptr_arith_t, TAO_SVC_CONTEXT_ALIGN, and CORBA::ULong.

00124 {
00125   // Write the service context list.
00126 #if (TAO_HAS_MINIMUM_CORBA == 1)
00127   output << reply.service_context_notowned ();
00128   ACE_ENV_ARG_NOT_USED; // FUZZ: ignore check_for_ace_check
00129 #else
00130   if (reply.is_dsi_ == 0)
00131     {
00132       output << reply.service_context_notowned ();
00133     }
00134   else
00135     {
00136       // If lazy evaluation is enabled then we are going to insert an
00137       // extra node at the end of the service context list, just to
00138       // force the appropriate padding.
00139       // But first we take it out any of them..
00140       CORBA::ULong count = 0;
00141       IOP::ServiceContextList &svc_ctx =
00142         reply.service_context_notowned ();
00143       CORBA::ULong l = svc_ctx.length ();
00144       CORBA::ULong i;
00145 
00146       for (i = 0; i != l; ++i)
00147         {
00148           if (svc_ctx[i].context_id == TAO_SVC_CONTEXT_ALIGN)
00149             {
00150               continue;
00151             }
00152 
00153           count++;
00154         }
00155 
00156       // Now increment it to account for the last dummy one...
00157       count++;
00158 
00159       // Now marshal the rest of the service context objects
00160       output << count;
00161       for (i = 0; i != l; ++i)
00162         {
00163           if (svc_ctx[i].context_id == TAO_SVC_CONTEXT_ALIGN)
00164             {
00165               continue;
00166             }
00167 
00168           output << svc_ctx[i];
00169         }
00170 
00171     }
00172 
00173   if (reply.is_dsi_ == 1)
00174     {
00175       // @@ Much of this code is GIOP 1.1 specific and should be
00176       ptr_arith_t target = reply.dsi_nvlist_align_;
00177 
00178       ptr_arith_t current =
00179         ptr_arith_t (output.current_alignment ()) % ACE_CDR::MAX_ALIGNMENT;
00180 
00181       CORBA::ULong pad = 0;
00182 
00183       if (target == 0)
00184         {
00185           // We want to generate adequate padding to start the request
00186           // id on a 8 byte boundary, two cases:
00187           // - If the dummy tag starts on a 4 byte boundary and the
00188           //   dummy sequence has 0 elements then we have:
00189           //   4:tag 8:sequence_length 4:sequence_body 4:request_id
00190           //   8:payload
00191           // - If the dummy tag starts on an 8 byte boundary, with 4
00192           //   elements we get:
00193           //   8:tag 4:sequence_length 8:sequence_body 4:request_id
00194           //   8:payload
00195           if (current != 0 && current <= ACE_CDR::LONG_ALIGN)
00196             {
00197               pad = 4;
00198             }
00199         }
00200       else if (target != ACE_CDR::LONG_ALIGN)
00201         {
00202           // The situation reverses, we want to generate adequate
00203           // padding to start the request id on a 4 byte boundary, two
00204           // cases:
00205           // - If the dummy tag starts on a 4 byte boundary and the
00206           //   dummy sequence has 4 elements then we have:
00207           //   4:tag 8:sequence_length 4:sequence_body 8:request_id
00208           //   4:payload
00209           // - If the dummy tag starts on an 8 byte boundary, with 0
00210           //   elements we get:
00211           //   8:tag 4:sequence_length 8:sequence_body 8:request_id
00212           //   4:payload
00213           if (current > ACE_CDR::LONG_ALIGN)
00214             {
00215               pad = 4;
00216             }
00217         }
00218       else if (target == ACE_CDR::MAX_ALIGNMENT)
00219         {
00220           pad = 0;
00221         }
00222       else
00223         {
00224           // <target> can only have the values above
00225           ACE_THROW_RETURN (CORBA::MARSHAL (),
00226                             0);
00227         }
00228 
00229       output << CORBA::ULong (TAO_SVC_CONTEXT_ALIGN);
00230       output << pad;
00231 
00232       for (CORBA::ULong j = 0; j != pad; ++j)
00233         {
00234           output << ACE_OutputCDR::from_octet(0);
00235         }
00236     }
00237 #endif /* TAO_HAS_MINIMUM_CORBA */
00238 
00239   // Write the request ID
00240   output.write_ulong (reply.request_id_);
00241 
00242   // Write the reply status
00243   this->marshal_reply_status (output,
00244                               reply);
00245 
00246   return 1;
00247 }

int TAO_GIOP_Message_Generator_Parser_10::write_request_header const TAO_Operation_Details   opdetails,
TAO_Target_Specification   spec,
TAO_OutputCDR   msg
[virtual]
 

Write the request header in to <msg>.

Implements TAO_GIOP_Message_Generator_Parser.

Definition at line 27 of file GIOP_Message_Generator_Parser_10.cpp.

References ACE_DEBUG, ACE_TEXT, LM_DEBUG, TAO_Target_Specification::object_key, TAO_Operation_Details::opname, TAO_Operation_Details::opname_len, TAO_Operation_Details::request_id, TAO_Operation_Details::request_service_info, TAO_Operation_Details::response_flags, TAO_TWOWAY_RESPONSE_FLAG, and ACE_OutputCDR::write_string.

00031 {
00032   // Write the service context list
00033   msg << opdetails.request_service_info ();
00034 
00035   // The request ID
00036   msg << opdetails.request_id ();
00037 
00038   const CORBA::Octet response_flags = opdetails.response_flags ();
00039 
00040   // Write the response flags
00041   if (response_flags == TAO_TWOWAY_RESPONSE_FLAG)
00042     msg << CORBA::Any::from_octet (1);
00043   else
00044     msg << CORBA::Any::from_octet (0);
00045 
00046   // In this case we cannot recognise anything other than the Object
00047   // key as the address disposition variable. But we do a sanity check
00048   // anyway.
00049   const TAO_ObjectKey *key = spec.object_key ();
00050   if (key)
00051     {
00052       // Put in the object key
00053       msg << *key;
00054     }
00055   else
00056     {
00057       if (TAO_debug_level)
00058         ACE_DEBUG ((LM_DEBUG,
00059                     ACE_TEXT ("(%N |%l) Unable to handle this request \n")));
00060       return 0;
00061     }
00062 
00063   msg.write_string (opdetails.opname_len (),
00064                     opdetails.opname ());
00065 
00066   // Last element of request header is the principal; no portable way
00067   // to get it, we just pass empty principal (convention: indicates
00068   // "anybody").  Steps upward in security include passing an
00069   // unverified user ID, and then verifying the message (i.e. a dummy
00070   // service context entry is set up to hold a digital signature for
00071   // this message, then patched shortly before it's sent).
00072 
00073   /***** This has been deprecated in the 2.4 spec ******/
00074   //static CORBA::Principal_ptr principal = 0;
00075   //msg << principal;
00076 
00077   // This is now introduced in 2.4 spec
00078   CORBA::OctetSeq req_principal (0);
00079   req_principal.length (0);
00080   msg << req_principal;
00081 
00082   return 1;
00083 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:16:49 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002