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

Token_Request_Reply.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: Token_Request_Reply.i,v 1.1.1.3 2001/12/04 14:33:11 chad Exp $
00003 
00004 #if defined (ACE_HAS_TOKENS_LIBRARY)
00005 
00006 // = Set/get the length of the encoded/decoded message.
00007 
00008 ACE_INLINE ACE_UINT32
00009 ACE_Token_Request::length (void) const
00010 {
00011   return ntohl (this->transfer_.length_);
00012 }
00013 
00014 ACE_INLINE void 
00015 ACE_Token_Request::length (ACE_UINT32 l)
00016 {
00017   this->transfer_.length_ = htonl (l);
00018 }
00019 
00020 // = Set/get the type of the message.
00021 ACE_INLINE int
00022 ACE_Token_Request::token_type (void) const
00023 {
00024   return (int) ntohl (this->transfer_.token_type_);
00025 }
00026 
00027 ACE_INLINE void 
00028 ACE_Token_Request::token_type (int t)
00029 {
00030   this->transfer_.token_type_ = htonl ((ACE_UINT32) t);
00031 }
00032 
00033 // = Set/get the type of the message.
00034 ACE_INLINE int
00035 ACE_Token_Request::proxy_type (void) const
00036 {
00037   return (int) ntohl (this->transfer_.proxy_type_);
00038 }
00039 
00040 ACE_INLINE void
00041 ACE_Token_Request::proxy_type (int t)
00042 {
00043   this->transfer_.proxy_type_ = htonl ((ACE_UINT32) t);
00044 }
00045 
00046 // = Set/get the type of the message.
00047 ACE_INLINE ACE_UINT32
00048 ACE_Token_Request::operation_type (void) const
00049 {
00050   return ntohl (this->transfer_.operation_type_);
00051 }
00052 
00053 ACE_INLINE void 
00054 ACE_Token_Request::operation_type (ACE_UINT32 t)
00055 {
00056   this->transfer_.operation_type_ = htonl (t);
00057 }
00058 
00059 // = Set/get the requeue position
00060 ACE_INLINE ACE_UINT32 
00061 ACE_Token_Request::requeue_position (void) const
00062 {
00063   return ntohl (this->transfer_.requeue_position_);
00064 }
00065 
00066 ACE_INLINE void 
00067 ACE_Token_Request::requeue_position (ACE_UINT32 rq)
00068 {
00069   this->transfer_.requeue_position_ = htonl (rq);
00070 }
00071 
00072 // = Set/get the requeue position
00073 ACE_INLINE ACE_UINT32 
00074 ACE_Token_Request::notify (void) const
00075 {
00076   return ntohl (this->transfer_.notify_);
00077 }
00078 
00079 ACE_INLINE void 
00080 ACE_Token_Request::notify (ACE_UINT32 rq)
00081 {
00082   this->transfer_.notify_ = htonl (rq);
00083 }
00084 
00085 // = Set/get the blocking semantics.
00086 ACE_INLINE ACE_Synch_Options &
00087 ACE_Token_Request::options (void) const
00088 {
00089   return (ACE_Synch_Options &) options_;
00090 }
00091 
00092 ACE_INLINE void 
00093 ACE_Token_Request::options (const ACE_Synch_Options &opt)
00094 {
00095   // fight the friggin const from hell
00096   ACE_Synch_Options *options = (ACE_Synch_Options *) &opt;
00097 
00098   transfer_.use_timeout_ = options->operator[](ACE_Synch_Options::USE_TIMEOUT);
00099   if (transfer_.use_timeout_ == 1)
00100     {
00101       transfer_.usec_ = options->timeout ().usec ();
00102       transfer_.sec_ = options->timeout ().sec ();
00103     }
00104   else
00105     {
00106       transfer_.usec_ = 0;
00107       transfer_.sec_ = 0;
00108     }
00109 }
00110 
00111 // = Set/get the name of the token.
00112 ACE_INLINE ACE_TCHAR *
00113 ACE_Token_Request::token_name (void) const
00114 {
00115   return token_name_;
00116 }
00117 
00118 ACE_INLINE void 
00119 ACE_Token_Request::token_name (const ACE_TCHAR *token_name, 
00120                                const ACE_TCHAR *client_id)
00121 {
00122   size_t token_name_length = ACE_OS::strlen (token_name) + 1; // Add 1 for '\0'.
00123   size_t client_id_length = ACE_OS::strlen (client_id) + 1; // Add 1 for '\0'.
00124 
00125   // Set up pointers and copy token_name and client_id into request.
00126   token_name_ = this->transfer_.data_;
00127   client_id_  = &this->token_name_[token_name_length + 1]; // Add 1 for ':';
00128   client_id_[-1] = ACE_LIB_TEXT (':'); // Insert the ':' before this->clientId_.
00129 
00130   (void) ACE_OS::memcpy (this->token_name_, 
00131                          token_name, 
00132                          token_name_length * sizeof (ACE_TCHAR));
00133   (void) ACE_OS::memcpy (this->client_id_, 
00134                          client_id, 
00135                          client_id_length * sizeof (ACE_TCHAR));
00136 
00137   // Fixed length header size
00138   size_t len = ACE_TOKEN_REQUEST_HEADER_SIZE;
00139 
00140   // ... then add in the amount of the variable-sized portion. 
00141   len += token_name_length + client_id_length + 1;
00142 
00143   this->length (len);
00144 }
00145 
00146 // = Set/get the id of the client.
00147 ACE_INLINE ACE_TCHAR *
00148 ACE_Token_Request::client_id (void) const
00149 {
00150   return this->client_id_;
00151 }
00152 
00153 // ************************************************************
00154 // ************************************************************
00155 // ************************************************************
00156 
00157 // = Set/get the length of the encoded/decoded message.
00158 ACE_INLINE ACE_UINT32 
00159 ACE_Token_Reply::length (void) const
00160 {
00161   return ntohl (this->transfer_.length_);
00162 }
00163 
00164 ACE_INLINE void 
00165 ACE_Token_Reply::length (ACE_UINT32 l)
00166 {
00167   this->transfer_.length_ = htonl (l);
00168 }
00169 
00170 // = Set/get the errno of a failed reply.
00171 ACE_INLINE ACE_UINT32 
00172 ACE_Token_Reply::errnum (void) const
00173 {
00174   return ntohl (this->transfer_.errno_);
00175 }
00176 
00177 ACE_INLINE void 
00178 ACE_Token_Reply::errnum (ACE_UINT32 e)
00179 {
00180   this->transfer_.errno_ = htonl (e);
00181 }
00182 
00183 // = Set/get the length of the encoded/decoded message.
00184 ACE_INLINE ACE_UINT32 
00185 ACE_Token_Reply::arg (void) const
00186 {
00187   return ntohl (this->transfer_.arg_);
00188 }
00189 
00190 ACE_INLINE void 
00191 ACE_Token_Reply::arg (ACE_UINT32 arg)
00192 {
00193   this->transfer_.arg_ = htonl (arg);
00194 }
00195 
00196 #endif /* ACE_HAS_TOKENS_LIBRARY */

Generated on Mon Jun 16 11:21:58 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002