GIOP_Message_Generator_Parser_10.cpp File Reference

#include "tao/GIOP_Message_Generator_Parser_10.h"
#include "tao/GIOP_Utils.h"
#include "tao/GIOP_Message_Locate_Header.h"
#include "tao/operation_details.h"
#include "tao/debug.h"
#include "tao/Pluggable_Messaging_Utils.h"
#include "tao/TAO_Server_Request.h"
#include "tao/ORB_Constants.h"
#include "tao/CDR.h"
#include "tao/SystemException.h"
#include "ace/Log_Msg.h"
Include dependency graph for GIOP_Message_Generator_Parser_10.cpp:

Go to the source code of this file.

Functions

 ACE_RCSID (tao, GIOP_Message_Generator_Parser_10,"$Id: GIOP_Message_Generator_Parser_10.cpp 84443 2009-02-12 20:26:35Z johnnyw $") 1 bool TAO_GIOP_Message_Generator_Parser_10

Function Documentation

ACE_RCSID ( tao  ,
GIOP_Message_Generator_Parser_10  ,
"$Id: GIOP_Message_Generator_Parser_10.cpp 84443 2009-02-12 20:26:35Z johnnyw $"   
)

Definition at line 16 of file GIOP_Message_Generator_Parser_10.cpp.

00018                : GIOP_Message_Generator_Parser_10.cpp 84443 2009-02-12 20:26:35Z johnnyw $")
00019 
00020 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00021 
00022 bool
00023 TAO_GIOP_Message_Generator_Parser_10::write_request_header (
00024     const TAO_Operation_Details &opdetails,
00025     TAO_Target_Specification &spec,
00026     TAO_OutputCDR &msg)
00027 {
00028   // Write the service context list
00029   if (!(msg << opdetails.request_service_info ()))
00030     return false;
00031 
00032   // The request ID
00033   if (!(msg << opdetails.request_id ()))
00034     return false;
00035 
00036   CORBA::Octet const response_flags = opdetails.response_flags ();
00037 
00038   // Write the response flags
00039   if (response_flags == TAO_TWOWAY_RESPONSE_FLAG)
00040     {
00041       msg << ACE_OutputCDR::from_octet (1);
00042     }
00043   else
00044     {
00045       msg << ACE_OutputCDR::from_octet (0);
00046     }
00047 
00048   // In this case we cannot recognise anything other than the Object
00049   // key as the address disposition variable. But we do a sanity check
00050   // anyway.
00051   const TAO::ObjectKey *key = spec.object_key ();
00052 
00053   if (key)
00054     {
00055       // Put in the object key
00056       msg << *key;
00057     }
00058   else
00059     {
00060       if (TAO_debug_level)
00061         {
00062           ACE_ERROR ((LM_ERROR,
00063                       ACE_TEXT ("(%N |%l) Unable to handle this request\n")));
00064         }
00065       return false;
00066     }
00067 
00068   msg.write_string (opdetails.opname_len (), opdetails.opname ());
00069 
00070   // Last element of request header is the principal; no portable way
00071   // to get it, we just pass empty principal (convention: indicates
00072   // "anybody").  Steps upward in security include passing an
00073   // unverified user ID, and then verifying the message (i.e. a dummy
00074   // service context entry is set up to hold a digital signature for
00075   // this message, then patched shortly before it's sent).
00076 
00077   /***** This has been deprecated in the 2.4 spec ******/
00078 
00079 #if defined (TAO_PEER_REQUIRES_PRINCIPAL)
00080 
00081   char username[BUFSIZ];
00082   char *result =
00083     ACE_OS::cuserid (username,
00084                      BUFSIZ);
00085 
00086   if (result != 0)
00087     {
00088       const CORBA::ULong username_size =
00089         static_cast<CORBA::ULong> (ACE_OS::strlen (username));
00090 
00091       CORBA::Octet *buffer =
00092         CORBA::OctetSeq::allocbuf (username_size + 1);
00093 
00094       ACE_OS::memcpy (buffer,
00095                       username,
00096                       username_size + 1);
00097 
00098       req_principal.replace (username_size + 1,
00099                              username_size + 1,
00100                              buffer,
00101                              1);
00102     }
00103 
00104 #else
00105 
00106   CORBA::OctetSeq req_principal (0);
00107   req_principal.length (0);
00108 
00109 #endif /* TAO_PEER_REQUIRES_PRINCIPAL */
00110 
00111   msg << req_principal;
00112 
00113   return true;
00114 }

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Nov 22 23:24:08 2009 for TAO by  doxygen 1.6.1