00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Pluggable_Messaging_Utils.h 00006 * 00007 * $Id: Pluggable_Messaging_Utils.h 73791 2006-07-27 20:54:56Z wotte $ 00008 * 00009 * Utility classes for the TAO pluggable messaging framework. 00010 * 00011 * @author Balachandran Natarajan <bala@cs.wustl.edu> 00012 */ 00013 //============================================================================= 00014 00015 00016 #ifndef TAO_PLUGGABLE_MESSAGING_UTILS_H 00017 #define TAO_PLUGGABLE_MESSAGING_UTILS_H 00018 00019 #include /**/ "ace/pre.h" 00020 00021 #include "tao/IOP_IORC.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 # pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 class TAO_Transport; 00030 00031 /** 00032 * @class TAO_Pluggable_Reply_Params_Base 00033 * 00034 * @brief TAO_Pluggable_Acceptor_Params 00035 * 00036 * This represents a set of data that would be assembled by the 00037 * acceptor to pass to the connector. This base class is used by 00038 * TAO_ServerRequest. The child class TAO_Pluggable_Reply_Params 00039 * is used on the client side, and contains an additional 00040 * TAO_InputCDR member, not needed on the server side. 00041 */ 00042 class TAO_Export TAO_Pluggable_Reply_Params_Base 00043 { 00044 public: 00045 /// Constructor. 00046 TAO_Pluggable_Reply_Params_Base (void); 00047 00048 /// The IOP service context list. 00049 IOP::ServiceContextList svc_ctx_; 00050 00051 /// The request id for which the reply we (connector) has received. 00052 CORBA::ULong request_id_; 00053 00054 // @@ Bala: this is (again) an GIOPism (to coin a word). Other 00055 // protocol may choose to send different *messages* instead. 00056 // @@ Carlos: I agree. Please see above. 00057 /// The reply status. 00058 CORBA::ULong reply_status_; 00059 00060 /** 00061 * Since this class no longer contains an NVList, this is the 00062 * way to determine if the request was DSI, so we can use Carlos' 00063 * service context list no-deep-copy optimization. 00064 */ 00065 CORBA::Boolean is_dsi_; 00066 00067 /// Info required for DSI optimization that pads the outgoing 00068 /// CDR stream according to the alignment of the NVList. 00069 ptrdiff_t dsi_nvlist_align_; 00070 00071 /** 00072 * Get and Set methods for the service context list that we dont 00073 * own. This is useful for cases where the application objects own 00074 * a service context list and would like to pass on their contents 00075 * without a copy. 00076 */ 00077 IOP::ServiceContextList &service_context_notowned (void); 00078 void service_context_notowned (IOP::ServiceContextList *svc); 00079 00080 /// A flag that indicates if there is any data is going to get 00081 /// marshalled in the reply 00082 CORBA::Boolean argument_flag_; 00083 00084 protected: 00085 /// The service context list that we don't own. 00086 IOP::ServiceContextList *service_context_; 00087 }; 00088 00089 /** 00090 * @class TAO_Pluggable_Reply_Params 00091 * 00092 * @brief TAO_Pluggable_Connector_Params 00093 * 00094 */ 00095 class TAO_Export TAO_Pluggable_Reply_Params 00096 : public TAO_Pluggable_Reply_Params_Base 00097 { 00098 public: 00099 /// Constructor. 00100 TAO_Pluggable_Reply_Params (TAO_Transport *t); 00101 00102 /// The stream with the non-demarshaled reply. This stream will be 00103 /// passed up to the stubs to demarshal the parameter values. 00104 TAO_InputCDR *input_cdr_; 00105 00106 TAO_Transport *transport_; 00107 }; 00108 00109 // @@ Bala: this is a GIOPism too, there is no such thing as locate 00110 // request in HTTP (the basis for SOAP and XIOP), i don't know about 00111 // HTTP-NG, but i wouldn't be surprised if it had. Furthermore, some 00112 // very influential people (Michi) is arguing against it in the OMG. 00113 // 00114 // @@Carlos: Yes, I also saw some of Michi's ideas. Even if OMG 00115 // decides to remove this, can I point that we may have to support that 00116 // for the existsing GIOP1.0,1.1 & GIOP 1.2. Above all, the enum type 00117 // contains things that I know of today. I can go ahead and add HTTP-NG 00118 // stuff. They all seem to be in Working Draft stage. So, I am just 00119 // keeping off. I dont want to add something for the kick of it :-) 00120 enum TAO_Pluggable_Header_Type 00121 { 00122 TAO_PLUGGABLE_MESSAGE_REQUEST_HEADER = 0, 00123 TAO_PLUGGABLE_MESSAGE_LOCATE_REQUEST_HEADER 00124 }; 00125 00126 00127 /** 00128 * Provide an external interface for the users of this pluggable 00129 * messaging framework to denote existing message types. This has 00130 * an inspiration from GIOP. So if anybody wants to add more message 00131 * types you are welcome but please do not change the numbering 00132 * scheme as this would affect GIOP. 00133 * 00134 * @note 00135 * We may not need everything here. It would be good if we 00136 * have only the following messages TAO_PLUGGABLE_MESSAGE_REQUEST, 00137 * TAO_PLUGGABLE_MESSAGE_REPLY, 00138 * TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION, 00139 * TAO_PLUGGABLE_MESSAGE_MESSAGE_ERROR. Changes will be made once 00140 * the rest of the stuff gets ready to roll 00141 */ 00142 enum TAO_Pluggable_Message_Type 00143 { 00144 TAO_PLUGGABLE_MESSAGE_REQUEST = 0, // sent by client. 00145 TAO_PLUGGABLE_MESSAGE_REPLY = 1, // by server. 00146 TAO_PLUGGABLE_MESSAGE_CANCELREQUEST = 2, // by client. 00147 TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST = 3, // by client. 00148 TAO_PLUGGABLE_MESSAGE_LOCATEREPLY = 4, 00149 TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION = 5, 00150 TAO_PLUGGABLE_MESSAGE_MESSAGERROR = 6, 00151 TAO_PLUGGABLE_MESSAGE_FRAGMENT = 7 00152 }; 00153 00154 // @@ Bala: This is a hopeless GIOPism. 00155 // @@ Carlos: Agreed. 00156 00157 /** 00158 * Provide an external interface for the users of this pluggable 00159 * messaging framework to denote existing Exception types. This has 00160 * an inspiration from GIOP. So if anybody wants to add more message 00161 * types you are welcome but please do not change the numbering 00162 * scheme as this would affect GIOP. 00163 */ 00164 enum TAO_Pluggable_Message_Exception_Type 00165 { 00166 /// Request completed successfully 00167 TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION = 0, 00168 00169 /// Request terminated with user exception 00170 TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION, 00171 00172 /// Request terminated with system exception 00173 TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION, 00174 00175 /// Reply is a location forward type 00176 TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD, 00177 00178 /// PLUGGABLE_MESSAGE 1.2, Reply is a location forward perm type.. 00179 TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM, 00180 00181 /// GIOP1.2, 00182 TAO_PLUGGABLE_MESSAGE_NEEDS_ADDRESSING_MODE 00183 }; 00184 00185 TAO_END_VERSIONED_NAMESPACE_DECL 00186 00187 #if defined (__ACE_INLINE__) 00188 #include "tao/Pluggable_Messaging_Utils.inl" 00189 #endif /* __ACE_INLINE__ */ 00190 00191 #include /**/ "ace/post.h" 00192 00193 #endif /* TAO_PLUGGABLE_MESSAGING_UTILS_H */