#include <Name_Request_Reply.h>
Collaboration diagram for ACE_Name_Request:

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 Member Functions | |
| ACE_Name_Request (void) | |
| Default constructor. | |
| ACE_Name_Request (ACE_INT32 msg_type, const ACE_WCHAR_T name[], const ACE_UINT32 name_length, const ACE_WCHAR_T 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. | |
| void | init (void) |
| 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_WCHAR_T * | name (void) const |
| void | name (const ACE_WCHAR_T *) |
| const ACE_WCHAR_T * | value (void) const |
| void | value (const ACE_WCHAR_T *) |
| 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. | |
| int | decode (void) |
| Decode message after reception. | |
| void | dump (void) const |
| Print out the values of the message for debugging purposes. | |
Private Attributes | |
| Transfer | transfer_ |
| Transfer buffer. | |
| ACE_WCHAR_T * | name_ |
| Pointer to the beginning of the name in this->data_. | |
| ACE_WCHAR_T * | value_ |
| Pointer to the beginning of the value in this->data_;. | |
| char * | type_ |
| Pointer to the beginning of the type in this->data_;. | |
This class is implemented to minimize data copying. In particular, all marshaling is done in situ...
Definition at line 42 of file Name_Request_Reply.h.
|
|
Request message types.
Definition at line 46 of file Name_Request_Reply.h.
00047 {
00048 BIND = 01,
00049 REBIND = 02,
00050 RESOLVE = 03,
00051 UNBIND = 04,
00052 LIST_NAMES = 05,
00053 LIST_VALUES = 015,
00054 LIST_TYPES = 025,
00055 LIST_NAME_ENTRIES = 06,
00056 LIST_VALUE_ENTRIES = 016,
00057 LIST_TYPE_ENTRIES = 026,
00058 MAX_ENUM = 11,
00059 MAX_LIST = 3,
00060
00061 // Mask for bitwise operation used for table lookup
00062 /// Mask for lookup of operation
00063 OP_TABLE_MASK = 07,
00064 /// Mask for lookup of list_operation
00065 LIST_OP_MASK = 030,
00066
00067 /// Class-specific constant values.
00068 MAX_NAME_LENGTH = MAXPATHLEN + 1
00069 };
|
|
|
Default constructor.
Definition at line 18 of file Name_Request_Reply.cpp. References ACE_TRACE.
00019 {
00020 ACE_TRACE ("ACE_Name_Request::ACE_Name_Request");
00021 }
|
|
||||||||||||||||||||||||||||||||||||
|
Create a ACE_Name_Request message.
Definition at line 25 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_WCHAR_T, block_forever(), ACE_Name_Request::Transfer::block_forever_, ACE_Name_Request::Transfer::data_, length(), ACE_OS::memcpy(), msg_type(), name_len(), ACE_Time_Value::sec(), ACE_Name_Request::Transfer::sec_timeout_, transfer_, type_len(), ACE_Time_Value::usec(), ACE_Name_Request::Transfer::usec_timeout_, and value_len().
00034 {
00035 ACE_TRACE ("ACE_Name_Request::ACE_Name_Request");
00036 this->msg_type (t);
00037 this->name_len (name_length);
00038 this->value_len (value_length);
00039 this->type_len (type_length);
00040
00041 // If timeout is a NULL pointer, then block forever...
00042 if (timeout == 0)
00043 {
00044 this->transfer_.block_forever_ = 1;
00045 this->transfer_.sec_timeout_ = 0;
00046 this->transfer_.usec_timeout_ = 0;
00047 }
00048 else // Do a "timed wait."
00049 {
00050 this->block_forever (0);
00051 // Keep track of how long client is willing to wait.
00052 this->transfer_.sec_timeout_ = timeout->sec ();
00053 this->transfer_.usec_timeout_ = timeout->usec ();
00054 }
00055
00056 // Set up pointers and copy name value and type into request.
00057 this->name_ = this->transfer_.data_;
00058 this->value_ = &this->name_[name_length / sizeof (ACE_WCHAR_T) ];
00059 this->type_ = (char *)(&this->value_[value_length / sizeof (ACE_WCHAR_T)]); //
00060
00061 (void) ACE_OS::memcpy (this->name_,
00062 name,
00063 name_length);
00064 (void) ACE_OS::memcpy (this->value_,
00065 value,
00066 value_length);
00067 (void) ACE_OS::memcpy (this->type_,
00068 type,
00069 type_length);
00070
00071 // Compute size of the fixed portion of the message...
00072 size_t len = sizeof this->transfer_ - sizeof this->transfer_.data_;
00073
00074 // ... then add in the amount of the variable-sized portion.
00075 len += name_length + value_length + type_length ;
00076
00077 this->length (static_cast<ACE_UINT32> (len));
00078 }
|
|
|
Definition at line 179 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::block_forever_, and transfer_.
00180 {
00181 ACE_TRACE ("ACE_Name_Request::block_forever");
00182 this->transfer_.block_forever_ = bs;
00183 }
|
|
|
Definition at line 172 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::block_forever_, and transfer_. Referenced by ACE_Name_Request(), and dump().
00173 {
00174 ACE_TRACE ("ACE_Name_Request::block_forever");
00175 return this->transfer_.block_forever_;
00176 }
|
|
|
Decode message after reception.
Definition at line 297 of file Name_Request_Reply.cpp. References ACE_NTOHL, ACE_NTOHS, ACE_TRACE, ACE_UINT64, ACE_WCHAR_T, ACE_Name_Request::Transfer::block_forever_, ACE_Name_Request::Transfer::data_, ACE_Name_Request::Transfer::length_, ACE_Name_Request::Transfer::msg_type_, ACE_Name_Request::Transfer::name_len_, ACE_Name_Request::Transfer::sec_timeout_, ACE_CDR::swap_8(), transfer_, ACE_Name_Request::Transfer::type_len_, ACE_Name_Request::Transfer::usec_timeout_, and ACE_Name_Request::Transfer::value_len_.
00298 {
00299 ACE_TRACE ("ACE_Name_Request::decode");
00300 // Decode the fixed-sized portion first.
00301 this->transfer_.block_forever_ = ACE_NTOHL (this->transfer_.block_forever_);
00302 this->transfer_.usec_timeout_ = ACE_NTOHL (this->transfer_.usec_timeout_);
00303 #if defined (ACE_LITTLE_ENDIAN)
00304 ACE_UINT64 secs = this->transfer_.sec_timeout_;
00305 ACE_CDR::swap_8 ((const char *)&secs, (char *)&this->transfer_.sec_timeout_);
00306 #endif
00307 this->transfer_.length_ = ACE_NTOHL (this->transfer_.length_);
00308 this->transfer_.msg_type_ = ACE_NTOHL (this->transfer_.msg_type_);
00309 this->transfer_.name_len_ = ACE_NTOHL (this->transfer_.name_len_);
00310 this->transfer_.value_len_ = ACE_NTOHL (this->transfer_.value_len_);
00311 this->transfer_.type_len_ = ACE_NTOHL (this->transfer_.type_len_);
00312
00313 size_t nv_data_len =
00314 (this->transfer_.name_len_ + this->transfer_.value_len_)
00315 / sizeof (ACE_WCHAR_T);
00316
00317 for (size_t i = 0; i < nv_data_len; i++)
00318 this->transfer_.data_[i] =
00319 ACE_NTOHS (this->transfer_.data_[i]);
00320
00321 this->name_ = this->transfer_.data_;
00322 this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (ACE_WCHAR_T)];
00323 this->type_ = (char *)(&this->value_[this->transfer_.value_len_ / sizeof (ACE_WCHAR_T)]);
00324 this->type_[this->transfer_.type_len_] = '\0';
00325
00326 // Decode the variable-sized portion.
00327 return 0;
00328 }
|
|
|
Print out the values of the message for debugging purposes.
Definition at line 333 of file Name_Request_Reply.cpp. References ACE_DEBUG, ACE_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().
00334 {
00335 #if defined (ACE_HAS_DUMP)
00336 ACE_TRACE ("ACE_Name_Request::dump");
00337 ACE_DEBUG ((LM_DEBUG,
00338 ACE_TEXT ("*******\nlength = %d\n"),
00339 this->length ()));
00340 ACE_DEBUG ((LM_DEBUG,
00341 ACE_TEXT ("message-type = ")));
00342
00343 switch (this->msg_type ())
00344 {
00345 case ACE_Name_Request::BIND:
00346 ACE_DEBUG ((LM_DEBUG,
00347 ACE_TEXT ("BIND\n")));
00348 break;
00349 case ACE_Name_Request::REBIND:
00350 ACE_DEBUG ((LM_DEBUG,
00351 ACE_TEXT ("REBIND\n")));
00352 break;
00353 case ACE_Name_Request::RESOLVE:
00354 ACE_DEBUG ((LM_DEBUG,
00355 ACE_TEXT ("RESOLVE\n")));
00356 break;
00357 case ACE_Name_Request::UNBIND:
00358 ACE_DEBUG ((LM_DEBUG,
00359 ACE_TEXT ("UNBIND\n")));
00360 break;
00361 case ACE_Name_Request::LIST_NAMES:
00362 ACE_DEBUG ((LM_DEBUG,
00363 ACE_TEXT ("LIST_NAMES\n")));
00364 break;
00365 case ACE_Name_Request::LIST_VALUES:
00366 ACE_DEBUG ((LM_DEBUG,
00367 ACE_TEXT ("LIST_VALUES\n")));
00368 break;
00369 case ACE_Name_Request::LIST_TYPES:
00370 ACE_DEBUG ((LM_DEBUG,
00371 ACE_TEXT ("LIST_TYPES\n")));
00372 break;
00373 case ACE_Name_Request::LIST_NAME_ENTRIES:
00374 ACE_DEBUG ((LM_DEBUG,
00375 ACE_TEXT ("LIST_NAME_ENTRIES\n")));
00376 break;
00377 case ACE_Name_Request::LIST_VALUE_ENTRIES:
00378 ACE_DEBUG ((LM_DEBUG,
00379 ACE_TEXT ("LIST_VALUE_ENTRIES\n")));
00380 break;
00381 case ACE_Name_Request::LIST_TYPE_ENTRIES:
00382 ACE_DEBUG ((LM_DEBUG,
00383 ACE_TEXT ("LIST_TYPE_ENTRIES\n")));
00384 break;
00385 default:
00386 ACE_DEBUG ((LM_DEBUG,
00387 ACE_TEXT ("<unknown type> = %d\n"),
00388 this->msg_type ()));
00389 break;
00390 }
00391
00392 if (this->block_forever ())
00393 ACE_DEBUG ((LM_DEBUG,
00394 ACE_TEXT ("blocking forever\n")));
00395 else
00396 {
00397 #if !defined (ACE_NLOGGING)
00398 ACE_Time_Value tv = this->timeout ();
00399 #endif /* ! ACE_NLOGGING */
00400 ACE_DEBUG ((LM_DEBUG,
00401 ACE_TEXT ("waiting for %d secs and %d usecs\n"),
00402 tv.sec (),
00403 tv.usec ()));
00404 }
00405 ACE_DEBUG ((LM_DEBUG,
00406 ACE_TEXT ("*******\nname_len = %d\n"),
00407 this->name_len ()));
00408 ACE_DEBUG ((LM_DEBUG,
00409 ACE_TEXT ("*******\nvalue_len = %d\n"),
00410 this->value_len ()));
00411
00412 ACE_DEBUG ((LM_DEBUG,
00413 ACE_TEXT ("+++++++\n")));
00414 #endif /* ACE_HAS_DUMP */
00415 }
|
|
|
Encode the message before transmission.
Definition at line 262 of file Name_Request_Reply.cpp. References ACE_HTONL, ACE_HTONS, ACE_TRACE, ACE_UINT64, ACE_WCHAR_T, 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_, ACE_CDR::swap_8(), 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().
00263 {
00264 ACE_TRACE ("ACE_Name_Request::encode");
00265 // Compute the length *before* doing the marshaling.
00266
00267 ACE_UINT32 len = this->length ();
00268
00269 size_t nv_data_len =
00270 (this->transfer_.name_len_ + this->transfer_.value_len_)
00271 / sizeof (ACE_WCHAR_T);
00272
00273 for (size_t i = 0; i < nv_data_len; i++)
00274 this->transfer_.data_[i] =
00275 ACE_HTONS (this->transfer_.data_[i]);
00276
00277 buf = (void *) &this->transfer_;
00278 this->transfer_.block_forever_ = ACE_HTONL (this->transfer_.block_forever_);
00279 this->transfer_.usec_timeout_ = ACE_HTONL (this->transfer_.usec_timeout_);
00280 #if defined (ACE_LITTLE_ENDIAN)
00281 ACE_UINT64 secs = this->transfer_.sec_timeout_;
00282 ACE_CDR::swap_8 ((const char *)&secs, (char *)&this->transfer_.sec_timeout_);
00283 #endif
00284 this->transfer_.length_ = ACE_HTONL (this->transfer_.length_);
00285 this->transfer_.msg_type_ = ACE_HTONL (this->transfer_.msg_type_);
00286 this->transfer_.name_len_ = ACE_HTONL (this->transfer_.name_len_);
00287 this->transfer_.value_len_ = ACE_HTONL (this->transfer_.value_len_);
00288 this->transfer_.type_len_ = ACE_HTONL (this->transfer_.type_len_);
00289
00290 return len;
00291 }
|
|
|
Initialize length_ in order to ensure correct byte ordering before a request is sent. Definition at line 83 of file Name_Request_Reply.cpp. References ACE_TRACE, and length().
|
|
|
Definition at line 99 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::length_, and transfer_.
|
|
|
Definition at line 92 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::length_, and transfer_. Referenced by ACE_Name_Request(), encode(), and init().
|
|
|
Definition at line 115 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::msg_type_, and transfer_.
|
|
|
|
Definition at line 213 of file Name_Request_Reply.cpp. References ACE_TRACE, and ACE_OS::memcpy().
00214 {
00215 ACE_TRACE ("ACE_Name_Request::name");
00216 (void) ACE_OS::memcpy (this->name_,
00217 t,
00218 this->name_len ());
00219 }
|
|
|
Definition at line 206 of file Name_Request_Reply.cpp. References ACE_TRACE. 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 131 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::name_len_, and transfer_.
|
|
|
Definition at line 124 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::name_len_, and transfer_. Referenced by ACE_Name_Request(), 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 196 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_.
00197 {
00198 ACE_TRACE ("ACE_Name_Request::timeout");
00199 this->transfer_.sec_timeout_ = timeout.sec ();
00200 this->transfer_.usec_timeout_ = timeout.usec ();
00201 }
|
|
|
Definition at line 188 of file Name_Request_Reply.cpp. References ACE_Time_Value, ACE_TRACE, ACE_Name_Request::Transfer::sec_timeout_, and transfer_. Referenced by dump().
00189 {
00190 ACE_TRACE ("ACE_Name_Request::timeout");
00191 time_t sec = ACE_Utils::truncate_cast<time_t> (this->transfer_.sec_timeout_);
00192 return ACE_Time_Value (sec, this->transfer_.usec_timeout_);
00193 }
|
|
|
Definition at line 250 of file Name_Request_Reply.cpp. References ACE_TRACE, and ACE_OS::strsncpy().
00251 {
00252 ACE_TRACE ("ACE_Name_Request::type");
00253 ACE_OS::strsncpy (this->type_,
00254 c,
00255 sizeof this->type_);
00256 }
|
|
|
Definition at line 243 of file Name_Request_Reply.cpp. References ACE_TRACE. 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 163 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::type_len_.
|
|
|
Definition at line 156 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::type_len_. Referenced by ACE_Name_Request(), and ACE_Remote_Name_Space::resolve().
|
|
|
Definition at line 231 of file Name_Request_Reply.cpp. References ACE_TRACE, and ACE_OS::memcpy().
00232 {
00233 ACE_TRACE ("ACE_Name_Request::value");
00234
00235 (void) ACE_OS::memcpy (this->value_,
00236 c,
00237 this->value_len());
00238 }
|
|
|
Definition at line 224 of file Name_Request_Reply.cpp. References ACE_TRACE. 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 147 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::value_len_.
00148 {
00149 ACE_TRACE ("ACE_Name_Request::value_len");
00150 this->transfer_.value_len_ = t;
00151 }
|
|
|
Definition at line 140 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::value_len_. Referenced by ACE_Name_Request(), 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().
00141 {
00142 ACE_TRACE ("ACE_Name_Request::value_len");
00143 return this->transfer_.value_len_;
00144 }
|
|
|
Pointer to the beginning of the name in this->data_.
Definition at line 179 of file Name_Request_Reply.h. |
|
|
Transfer buffer.
Definition at line 176 of file Name_Request_Reply.h. Referenced by ACE_Name_Request(), 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 185 of file Name_Request_Reply.h. |
|
|
Pointer to the beginning of the value in this->data_;.
Definition at line 182 of file Name_Request_Reply.h. |
1.3.6