#include <Name_Request_Reply.h>
Public Types | |
| enum | Constants { BIND = 01, REBIND = 02, RESOLVE = 03, UNBIND = 04, LIST_NAMES = 05, LIST_VALUES = 015, LIST_TYPES = 025, LIST_NAME_ENTRIES = 06, LIST_VALUE_ENTRIES = 016, LIST_TYPE_ENTRIES = 026, MAX_ENUM = 11, MAX_LIST = 3, OP_TABLE_MASK = 07, LIST_OP_MASK = 030, MAX_NAME_LENGTH = MAXPATHLEN + 1 } |
| Request message types. More... | |
Public Methods | |
| ACE_Name_Request (void) | |
| Default constructor. More... | |
| ACE_Name_Request (ACE_INT32 msg_type, const ACE_USHORT16 name[], const ACE_UINT32 name_length, const ACE_USHORT16 value[], const ACE_UINT32 value_length, const char type[], const ACE_UINT32 type_length, ACE_Time_Value *timeout=0) | |
| Create a <ACE_Name_Request> message. More... | |
| void | init (void) |
| Initialize length_ in order to ensure correct byte ordering before a request is sent. More... | |
| ACE_UINT32 | length (void) const |
| void | length (ACE_UINT32) |
| ACE_INT32 | msg_type (void) const |
| void | msg_type (ACE_INT32) |
| ACE_UINT32 | block_forever (void) const |
| void | block_forever (ACE_UINT32) |
| ACE_Time_Value | timeout (void) const |
| void | timeout (const ACE_Time_Value timeout) |
| const ACE_USHORT16 * | name (void) const |
| void | name (const ACE_USHORT16 *) |
| const ACE_USHORT16 * | value (void) const |
| void | value (const ACE_USHORT16 *) |
| const char * | type (void) const |
| void | type (const char *) |
| ACE_UINT32 | name_len (void) const |
| void | name_len (ACE_UINT32) |
| ACE_UINT32 | value_len (void) const |
| void | value_len (ACE_UINT32) |
| ACE_UINT32 | type_len (void) const |
| void | type_len (ACE_UINT32) |
| int | encode (void *&) |
| Encode the message before transmission. More... | |
| int | decode (void) |
| Decode message after reception. More... | |
| void | dump (void) const |
| Print out the values of the message for debugging purposes. More... | |
Private Attributes | |
| Transfer | transfer_ |
| Transfer buffer. More... | |
| ACE_USHORT16 * | name_ |
| Pointer to the beginning of the name in this->data_. More... | |
| ACE_USHORT16 * | value_ |
| Pointer to the beginning of the value in this->data_;. More... | |
| char * | type_ |
| Pointer to the beginning of the type in this->data_;. More... | |
This class is implemented to minimize data copying. In particular, all marshaling is done in situ...
Definition at line 40 of file Name_Request_Reply.h.
|
|
Request message types.
Definition at line 44 of file Name_Request_Reply.h.
00045 {
00046 BIND = 01,
00047 REBIND = 02,
00048 RESOLVE = 03,
00049 UNBIND = 04,
00050 LIST_NAMES = 05,
00051 LIST_VALUES = 015,
00052 LIST_TYPES = 025,
00053 LIST_NAME_ENTRIES = 06,
00054 LIST_VALUE_ENTRIES = 016,
00055 LIST_TYPE_ENTRIES = 026,
00056 MAX_ENUM = 11,
00057 MAX_LIST = 3,
00058
00059 // Mask for bitwise operation used for table lookup
00060 /// Mask for lookup of operation
00061 OP_TABLE_MASK = 07,
00062 /// Mask for lookup of list_operation
00063 LIST_OP_MASK = 030,
00064
00065 /// Class-specific constant values.
00066 MAX_NAME_LENGTH = MAXPATHLEN + 1
00067 };
|
|
|
Default constructor.
Definition at line 11 of file Name_Request_Reply.cpp. References ACE_TRACE.
00012 {
00013 ACE_TRACE ("ACE_Name_Request::ACE_Name_Request");
00014 }
|
|
||||||||||||||||||||||||||||||||||||
|
Create a <ACE_Name_Request> message.
Definition at line 18 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_USHORT16, and ACE_OS_String::memcpy.
00026 {
00027 ACE_TRACE ("ACE_Name_Request::ACE_Name_Request");
00028 this->msg_type (t);
00029 this->name_len (name_length);
00030 this->value_len (value_length);
00031 this->type_len (type_length);
00032
00033 // If timeout is a NULL pointer, then block forever...
00034 if (timeout == 0)
00035 {
00036 this->transfer_.block_forever_ = 1;
00037 this->transfer_.sec_timeout_ = 0;
00038 this->transfer_.usec_timeout_ = 0;
00039 }
00040 else // Do a "timed wait."
00041 {
00042 this->block_forever (0);
00043 // Keep track of how long client is willing to wait.
00044 this->transfer_.sec_timeout_ = timeout->sec ();
00045 this->transfer_.usec_timeout_ = timeout->usec ();
00046 }
00047
00048 // Set up pointers and copy name value and type into request.
00049 this->name_ = this->transfer_.data_;
00050 this->value_ = &this->name_[name_length / sizeof (ACE_USHORT16) ];
00051 this->type_ = (char *)(&this->value_[value_length / sizeof (ACE_USHORT16)]); //
00052
00053 (void) ACE_OS::memcpy (this->name_,
00054 name,
00055 name_length);
00056 (void) ACE_OS::memcpy (this->value_,
00057 value,
00058 value_length);
00059 (void) ACE_OS::memcpy (this->type_,
00060 type,
00061 type_length);
00062
00063 // Compute size of the fixed portion of the message...
00064 size_t len = sizeof this->transfer_ - sizeof this->transfer_.data_;
00065
00066 // ... then add in the amount of the variable-sized portion.
00067 len += name_length + value_length + type_length ;
00068
00069 this->length (ACE_static_cast (ACE_UINT32, len));
00070 }
|
|
|
Definition at line 171 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::block_forever_, and transfer_.
00172 {
00173 ACE_TRACE ("ACE_Name_Request::block_forever");
00174 this->transfer_.block_forever_ = bs;
00175 }
|
|
|
Definition at line 164 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::block_forever_, and transfer_. Referenced by dump.
00165 {
00166 ACE_TRACE ("ACE_Name_Request::block_forever");
00167 return this->transfer_.block_forever_;
00168 }
|
|
|
Decode message after reception.
Definition at line 286 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::block_forever_, ACE_Name_Request::Transfer::data_, ACE_Name_Request::Transfer::length_, ACE_Name_Request::Transfer::msg_type_, name_, ACE_Name_Request::Transfer::name_len_, ACE_Name_Request::Transfer::sec_timeout_, transfer_, type_, ACE_Name_Request::Transfer::type_len_, ACE_Name_Request::Transfer::usec_timeout_, value_, and ACE_Name_Request::Transfer::value_len_. Referenced by ACE_Name_Proxy::recv_reply.
00287 {
00288 ACE_TRACE ("ACE_Name_Request::decode");
00289 // Decode the fixed-sized portion first.
00290 this->transfer_.block_forever_ = ntohl (this->transfer_.block_forever_);
00291 this->transfer_.usec_timeout_ = ntohl (this->transfer_.usec_timeout_);
00292 this->transfer_.sec_timeout_ = ntohl (this->transfer_.sec_timeout_);
00293 this->transfer_.length_ = ntohl (this->transfer_.length_);
00294 this->transfer_.msg_type_ = ntohl (this->transfer_.msg_type_);
00295 this->transfer_.name_len_ = ntohl (this->transfer_.name_len_);
00296 this->transfer_.value_len_ = ntohl (this->transfer_.value_len_);
00297 this->transfer_.type_len_ = ntohl (this->transfer_.type_len_);
00298
00299 size_t nv_data_len =
00300 (this->transfer_.name_len_ + this->transfer_.value_len_)
00301 / sizeof (ACE_USHORT16);
00302
00303 for (size_t i = 0; i < nv_data_len; i++)
00304 this->transfer_.data_[i] =
00305 ntohs (this->transfer_.data_[i]);
00306
00307 this->name_ = this->transfer_.data_;
00308 this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (ACE_USHORT16)];
00309 this->type_ = (char *)(&this->value_[this->transfer_.value_len_ / sizeof (ACE_USHORT16)]);
00310 this->type_[this->transfer_.type_len_] = '\0';
00311
00312 // Decode the variable-sized portion.
00313 return 0;
00314 }
|
|
|
Print out the values of the message for debugging purposes.
Definition at line 319 of file Name_Request_Reply.cpp. References ACE_DEBUG, ACE_LIB_TEXT, ACE_TRACE, BIND, block_forever, LIST_NAME_ENTRIES, LIST_NAMES, LIST_TYPE_ENTRIES, LIST_TYPES, LIST_VALUE_ENTRIES, LIST_VALUES, LM_DEBUG, msg_type, REBIND, RESOLVE, ACE_Time_Value::sec, timeout, UNBIND, and ACE_Time_Value::usec.
00320 {
00321 ACE_TRACE ("ACE_Name_Request::dump");
00322 ACE_DEBUG ((LM_DEBUG,
00323 ACE_LIB_TEXT ("*******\nlength = %d\n"),
00324 this->length ()));
00325 ACE_DEBUG ((LM_DEBUG,
00326 ACE_LIB_TEXT ("message-type = ")));
00327
00328 switch (this->msg_type ())
00329 {
00330 case ACE_Name_Request::BIND:
00331 ACE_DEBUG ((LM_DEBUG,
00332 ACE_LIB_TEXT ("BIND\n")));
00333 break;
00334 case ACE_Name_Request::REBIND:
00335 ACE_DEBUG ((LM_DEBUG,
00336 ACE_LIB_TEXT ("REBIND\n")));
00337 break;
00338 case ACE_Name_Request::RESOLVE:
00339 ACE_DEBUG ((LM_DEBUG,
00340 ACE_LIB_TEXT ("RESOLVE\n")));
00341 break;
00342 case ACE_Name_Request::UNBIND:
00343 ACE_DEBUG ((LM_DEBUG,
00344 ACE_LIB_TEXT ("UNBIND\n")));
00345 break;
00346 case ACE_Name_Request::LIST_NAMES:
00347 ACE_DEBUG ((LM_DEBUG,
00348 ACE_LIB_TEXT ("LIST_NAMES\n")));
00349 break;
00350 case ACE_Name_Request::LIST_VALUES:
00351 ACE_DEBUG ((LM_DEBUG,
00352 ACE_LIB_TEXT ("LIST_VALUES\n")));
00353 break;
00354 case ACE_Name_Request::LIST_TYPES:
00355 ACE_DEBUG ((LM_DEBUG,
00356 ACE_LIB_TEXT ("LIST_TYPES\n")));
00357 break;
00358 case ACE_Name_Request::LIST_NAME_ENTRIES:
00359 ACE_DEBUG ((LM_DEBUG,
00360 ACE_LIB_TEXT ("LIST_NAME_ENTRIES\n")));
00361 break;
00362 case ACE_Name_Request::LIST_VALUE_ENTRIES:
00363 ACE_DEBUG ((LM_DEBUG,
00364 ACE_LIB_TEXT ("LIST_VALUE_ENTRIES\n")));
00365 break;
00366 case ACE_Name_Request::LIST_TYPE_ENTRIES:
00367 ACE_DEBUG ((LM_DEBUG,
00368 ACE_LIB_TEXT ("LIST_TYPE_ENTRIES\n")));
00369 break;
00370 default:
00371 ACE_DEBUG ((LM_DEBUG,
00372 ACE_LIB_TEXT ("<unknown type> = %d\n"),
00373 this->msg_type ()));
00374 break;
00375 }
00376
00377 if (this->block_forever ())
00378 ACE_DEBUG ((LM_DEBUG,
00379 ACE_LIB_TEXT ("blocking forever\n")));
00380 else
00381 {
00382 #if !defined (ACE_NLOGGING)
00383 ACE_Time_Value tv = this->timeout ();
00384 #endif /* ! ACE_NLOGGING */
00385 ACE_DEBUG ((LM_DEBUG,
00386 ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"),
00387 tv.sec (),
00388 tv.usec ()));
00389 }
00390 ACE_DEBUG ((LM_DEBUG,
00391 ACE_LIB_TEXT ("*******\nname_len = %d\n"),
00392 this->name_len ()));
00393 ACE_DEBUG ((LM_DEBUG,
00394 ACE_LIB_TEXT ("*******\nvalue_len = %d\n"),
00395 this->value_len ()));
00396
00397 ACE_DEBUG ((LM_DEBUG,
00398 ACE_LIB_TEXT ("+++++++\n")));
00399 }
|
|
|
Encode the message before transmission.
Definition at line 254 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::block_forever_, ACE_Name_Request::Transfer::data_, length, ACE_Name_Request::Transfer::length_, ACE_Name_Request::Transfer::msg_type_, ACE_Name_Request::Transfer::name_len_, ACE_Name_Request::Transfer::sec_timeout_, ssize_t, transfer_, ACE_Name_Request::Transfer::type_len_, ACE_Name_Request::Transfer::usec_timeout_, and ACE_Name_Request::Transfer::value_len_. Referenced by ACE_Name_Proxy::request_reply, and ACE_Name_Proxy::send_request.
00255 {
00256 ACE_TRACE ("ACE_Name_Request::encode");
00257 // Compute the length *before* doing the marshaling.
00258
00259 ssize_t len = this->length ();
00260
00261 size_t nv_data_len =
00262 (this->transfer_.name_len_ + this->transfer_.value_len_)
00263 / sizeof (ACE_USHORT16);
00264
00265 for (size_t i = 0; i < nv_data_len; i++)
00266 this->transfer_.data_[i] =
00267 htons (this->transfer_.data_[i]);
00268
00269 buf = (void *) &this->transfer_;
00270 this->transfer_.block_forever_ = htonl (this->transfer_.block_forever_);
00271 this->transfer_.usec_timeout_ = htonl (this->transfer_.usec_timeout_);
00272 this->transfer_.sec_timeout_ = htonl (this->transfer_.sec_timeout_);
00273 this->transfer_.length_ = htonl (this->transfer_.length_);
00274 this->transfer_.msg_type_ = htonl (this->transfer_.msg_type_);
00275 this->transfer_.name_len_ = htonl (this->transfer_.name_len_);
00276 this->transfer_.value_len_ = htonl (this->transfer_.value_len_);
00277 this->transfer_.type_len_ = htonl (this->transfer_.type_len_);
00278
00279 return len;
00280 }
|
|
|
Initialize length_ in order to ensure correct byte ordering before a request is sent.
Definition at line 75 of file Name_Request_Reply.cpp. References ACE_TRACE, and length.
|
|
|
Definition at line 91 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::length_, and transfer_.
|
|
|
Definition at line 84 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::length_, and transfer_. Referenced by encode, init, and ACE_Name_Proxy::recv_reply.
|
|
|
Definition at line 107 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::msg_type_, and transfer_.
|
|
|
Definition at line 100 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::msg_type_, and transfer_. Referenced by dump, ACE_Remote_Name_Space::list_name_entries, ACE_Remote_Name_Space::list_names, ACE_Remote_Name_Space::list_type_entries, ACE_Remote_Name_Space::list_types, ACE_Remote_Name_Space::list_value_entries, and ACE_Remote_Name_Space::list_values.
|
|
|
Definition at line 205 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_USHORT16, and ACE_OS_String::memcpy.
00206 {
00207 ACE_TRACE ("ACE_Name_Request::name");
00208 (void) ACE_OS::memcpy (this->name_,
00209 t,
00210 this->name_len ());
00211 }
|
|
|
Definition at line 198 of file Name_Request_Reply.cpp. References ACE_TRACE, and name_. Referenced by ACE_Remote_Name_Space::list_name_entries, ACE_Remote_Name_Space::list_names, ACE_Remote_Name_Space::list_type_entries, and ACE_Remote_Name_Space::list_value_entries.
|
|
|
Definition at line 123 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::name_len_, and transfer_.
|
|
|
Definition at line 116 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::name_len_, and transfer_. Referenced by ACE_Remote_Name_Space::list_name_entries, ACE_Remote_Name_Space::list_names, ACE_Remote_Name_Space::list_type_entries, and ACE_Remote_Name_Space::list_value_entries.
|
|
|
Definition at line 188 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Time_Value::sec, ACE_Name_Request::Transfer::sec_timeout_, transfer_, ACE_Time_Value::usec, and ACE_Name_Request::Transfer::usec_timeout_.
00189 {
00190 ACE_TRACE ("ACE_Name_Request::timeout");
00191 this->transfer_.sec_timeout_ = timeout.sec ();
00192 this->transfer_.usec_timeout_ = timeout.usec ();
00193 }
|
|
|
Definition at line 180 of file Name_Request_Reply.cpp. References ACE_TRACE. Referenced by dump.
00181 {
00182 ACE_TRACE ("ACE_Name_Request::timeout");
00183 return ACE_Time_Value (this->transfer_.sec_timeout_,
00184 this->transfer_.usec_timeout_);
00185 }
|
|
|
Definition at line 242 of file Name_Request_Reply.cpp. References ACE_TRACE, and ACE_OS_String::strsncpy.
00243 {
00244 ACE_TRACE ("ACE_Name_Request::type");
00245 ACE_OS::strsncpy (this->type_,
00246 c,
00247 sizeof this->type_);
00248 }
|
|
|
Definition at line 235 of file Name_Request_Reply.cpp. References ACE_TRACE, and type_. Referenced by ACE_Remote_Name_Space::list_name_entries, ACE_Remote_Name_Space::list_type_entries, ACE_Remote_Name_Space::list_types, ACE_Remote_Name_Space::list_value_entries, and ACE_Remote_Name_Space::resolve.
|
|
|
Definition at line 155 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::type_len_.
|
|
|
Definition at line 148 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::type_len_. Referenced by ACE_Remote_Name_Space::resolve.
|
|
|
Definition at line 223 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_USHORT16, and ACE_OS_String::memcpy.
00224 {
00225 ACE_TRACE ("ACE_Name_Request::value");
00226
00227 (void) ACE_OS::memcpy (this->value_,
00228 c,
00229 this->value_len());
00230 }
|
|
|
Definition at line 216 of file Name_Request_Reply.cpp. References ACE_TRACE, and value_. Referenced by ACE_Remote_Name_Space::list_name_entries, ACE_Remote_Name_Space::list_type_entries, ACE_Remote_Name_Space::list_value_entries, ACE_Remote_Name_Space::list_values, and ACE_Remote_Name_Space::resolve.
|
|
|
Definition at line 139 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::value_len_.
00140 {
00141 ACE_TRACE ("ACE_Name_Request::value_len");
00142 this->transfer_.value_len_ = t;
00143 }
|
|
|
Definition at line 132 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::value_len_. Referenced by ACE_Remote_Name_Space::list_name_entries, ACE_Remote_Name_Space::list_type_entries, ACE_Remote_Name_Space::list_value_entries, ACE_Remote_Name_Space::list_values, and ACE_Remote_Name_Space::resolve.
00133 {
00134 ACE_TRACE ("ACE_Name_Request::value_len");
00135 return this->transfer_.value_len_;
00136 }
|
|
|
Pointer to the beginning of the name in this->data_.
Definition at line 177 of file Name_Request_Reply.h. |
|
|
Transfer buffer.
Definition at line 174 of file Name_Request_Reply.h. Referenced by block_forever, decode, encode, length, msg_type, name_len, timeout, type_len, and value_len. |
|
|
Pointer to the beginning of the type in this->data_;.
Definition at line 183 of file Name_Request_Reply.h. |
|
|
Pointer to the beginning of the value in this->data_;.
Definition at line 180 of file Name_Request_Reply.h. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002