#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 15 of file Name_Request_Reply.cpp. References ACE_TRACE.
00016 {
00017 ACE_TRACE ("ACE_Name_Request::ACE_Name_Request");
00018 }
|
|
||||||||||||||||||||||||||||||||||||
|
Create a ACE_Name_Request message.
Definition at line 22 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().
00031 {
00032 ACE_TRACE ("ACE_Name_Request::ACE_Name_Request");
00033 this->msg_type (t);
00034 this->name_len (name_length);
00035 this->value_len (value_length);
00036 this->type_len (type_length);
00037
00038 // If timeout is a NULL pointer, then block forever...
00039 if (timeout == 0)
00040 {
00041 this->transfer_.block_forever_ = 1;
00042 this->transfer_.sec_timeout_ = 0;
00043 this->transfer_.usec_timeout_ = 0;
00044 }
00045 else // Do a "timed wait."
00046 {
00047 this->block_forever (0);
00048 // Keep track of how long client is willing to wait.
00049 this->transfer_.sec_timeout_ = timeout->sec ();
00050 this->transfer_.usec_timeout_ = timeout->usec ();
00051 }
00052
00053 // Set up pointers and copy name value and type into request.
00054 this->name_ = this->transfer_.data_;
00055 this->value_ = &this->name_[name_length / sizeof (ACE_WCHAR_T) ];
00056 this->type_ = (char *)(&this->value_[value_length / sizeof (ACE_WCHAR_T)]); //
00057
00058 (void) ACE_OS::memcpy (this->name_,
00059 name,
00060 name_length);
00061 (void) ACE_OS::memcpy (this->value_,
00062 value,
00063 value_length);
00064 (void) ACE_OS::memcpy (this->type_,
00065 type,
00066 type_length);
00067
00068 // Compute size of the fixed portion of the message...
00069 size_t len = sizeof this->transfer_ - sizeof this->transfer_.data_;
00070
00071 // ... then add in the amount of the variable-sized portion.
00072 len += name_length + value_length + type_length ;
00073
00074 this->length (static_cast<ACE_UINT32> (len));
00075 }
|
|
|
Definition at line 176 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::block_forever_, and transfer_.
00177 {
00178 ACE_TRACE ("ACE_Name_Request::block_forever");
00179 this->transfer_.block_forever_ = bs;
00180 }
|
|
|
Definition at line 169 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::block_forever_, and transfer_. Referenced by ACE_Name_Request(), and dump().
00170 {
00171 ACE_TRACE ("ACE_Name_Request::block_forever");
00172 return this->transfer_.block_forever_;
00173 }
|
|
|
Decode message after reception.
Definition at line 291 of file Name_Request_Reply.cpp. References ACE_TRACE, 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_, transfer_, ACE_Name_Request::Transfer::type_len_, ACE_Name_Request::Transfer::usec_timeout_, and ACE_Name_Request::Transfer::value_len_.
00292 {
00293 ACE_TRACE ("ACE_Name_Request::decode");
00294 // Decode the fixed-sized portion first.
00295 this->transfer_.block_forever_ = ntohl (this->transfer_.block_forever_);
00296 this->transfer_.usec_timeout_ = ntohl (this->transfer_.usec_timeout_);
00297 this->transfer_.sec_timeout_ = ntohl (this->transfer_.sec_timeout_);
00298 this->transfer_.length_ = ntohl (this->transfer_.length_);
00299 this->transfer_.msg_type_ = ntohl (this->transfer_.msg_type_);
00300 this->transfer_.name_len_ = ntohl (this->transfer_.name_len_);
00301 this->transfer_.value_len_ = ntohl (this->transfer_.value_len_);
00302 this->transfer_.type_len_ = ntohl (this->transfer_.type_len_);
00303
00304 size_t nv_data_len =
00305 (this->transfer_.name_len_ + this->transfer_.value_len_)
00306 / sizeof (ACE_WCHAR_T);
00307
00308 for (size_t i = 0; i < nv_data_len; i++)
00309 this->transfer_.data_[i] =
00310 ntohs (this->transfer_.data_[i]);
00311
00312 this->name_ = this->transfer_.data_;
00313 this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (ACE_WCHAR_T)];
00314 this->type_ = (char *)(&this->value_[this->transfer_.value_len_ / sizeof (ACE_WCHAR_T)]);
00315 this->type_[this->transfer_.type_len_] = '\0';
00316
00317 // Decode the variable-sized portion.
00318 return 0;
00319 }
|
|
|
Print out the values of the message for debugging purposes.
Definition at line 324 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().
00325 {
00326 #if defined (ACE_HAS_DUMP)
00327 ACE_TRACE ("ACE_Name_Request::dump");
00328 ACE_DEBUG ((LM_DEBUG,
00329 ACE_LIB_TEXT ("*******\nlength = %d\n"),
00330 this->length ()));
00331 ACE_DEBUG ((LM_DEBUG,
00332 ACE_LIB_TEXT ("message-type = ")));
00333
00334 switch (this->msg_type ())
00335 {
00336 case ACE_Name_Request::BIND:
00337 ACE_DEBUG ((LM_DEBUG,
00338 ACE_LIB_TEXT ("BIND\n")));
00339 break;
00340 case ACE_Name_Request::REBIND:
00341 ACE_DEBUG ((LM_DEBUG,
00342 ACE_LIB_TEXT ("REBIND\n")));
00343 break;
00344 case ACE_Name_Request::RESOLVE:
00345 ACE_DEBUG ((LM_DEBUG,
00346 ACE_LIB_TEXT ("RESOLVE\n")));
00347 break;
00348 case ACE_Name_Request::UNBIND:
00349 ACE_DEBUG ((LM_DEBUG,
00350 ACE_LIB_TEXT ("UNBIND\n")));
00351 break;
00352 case ACE_Name_Request::LIST_NAMES:
00353 ACE_DEBUG ((LM_DEBUG,
00354 ACE_LIB_TEXT ("LIST_NAMES\n")));
00355 break;
00356 case ACE_Name_Request::LIST_VALUES:
00357 ACE_DEBUG ((LM_DEBUG,
00358 ACE_LIB_TEXT ("LIST_VALUES\n")));
00359 break;
00360 case ACE_Name_Request::LIST_TYPES:
00361 ACE_DEBUG ((LM_DEBUG,
00362 ACE_LIB_TEXT ("LIST_TYPES\n")));
00363 break;
00364 case ACE_Name_Request::LIST_NAME_ENTRIES:
00365 ACE_DEBUG ((LM_DEBUG,
00366 ACE_LIB_TEXT ("LIST_NAME_ENTRIES\n")));
00367 break;
00368 case ACE_Name_Request::LIST_VALUE_ENTRIES:
00369 ACE_DEBUG ((LM_DEBUG,
00370 ACE_LIB_TEXT ("LIST_VALUE_ENTRIES\n")));
00371 break;
00372 case ACE_Name_Request::LIST_TYPE_ENTRIES:
00373 ACE_DEBUG ((LM_DEBUG,
00374 ACE_LIB_TEXT ("LIST_TYPE_ENTRIES\n")));
00375 break;
00376 default:
00377 ACE_DEBUG ((LM_DEBUG,
00378 ACE_LIB_TEXT ("<unknown type> = %d\n"),
00379 this->msg_type ()));
00380 break;
00381 }
00382
00383 if (this->block_forever ())
00384 ACE_DEBUG ((LM_DEBUG,
00385 ACE_LIB_TEXT ("blocking forever\n")));
00386 else
00387 {
00388 #if !defined (ACE_NLOGGING)
00389 ACE_Time_Value tv = this->timeout ();
00390 #endif /* ! ACE_NLOGGING */
00391 ACE_DEBUG ((LM_DEBUG,
00392 ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"),
00393 tv.sec (),
00394 tv.usec ()));
00395 }
00396 ACE_DEBUG ((LM_DEBUG,
00397 ACE_LIB_TEXT ("*******\nname_len = %d\n"),
00398 this->name_len ()));
00399 ACE_DEBUG ((LM_DEBUG,
00400 ACE_LIB_TEXT ("*******\nvalue_len = %d\n"),
00401 this->value_len ()));
00402
00403 ACE_DEBUG ((LM_DEBUG,
00404 ACE_LIB_TEXT ("+++++++\n")));
00405 #endif /* ACE_HAS_DUMP */
00406 }
|
|
|
Encode the message before transmission.
Definition at line 259 of file Name_Request_Reply.cpp. References ACE_TRACE, 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_, 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().
00260 {
00261 ACE_TRACE ("ACE_Name_Request::encode");
00262 // Compute the length *before* doing the marshaling.
00263
00264 ACE_UINT32 len = this->length ();
00265
00266 size_t nv_data_len =
00267 (this->transfer_.name_len_ + this->transfer_.value_len_)
00268 / sizeof (ACE_WCHAR_T);
00269
00270 for (size_t i = 0; i < nv_data_len; i++)
00271 this->transfer_.data_[i] =
00272 htons (this->transfer_.data_[i]);
00273
00274 buf = (void *) &this->transfer_;
00275 this->transfer_.block_forever_ = htonl (this->transfer_.block_forever_);
00276 this->transfer_.usec_timeout_ = htonl (this->transfer_.usec_timeout_);
00277 this->transfer_.sec_timeout_ = htonl (this->transfer_.sec_timeout_);
00278 this->transfer_.length_ = htonl (this->transfer_.length_);
00279 this->transfer_.msg_type_ = htonl (this->transfer_.msg_type_);
00280 this->transfer_.name_len_ = htonl (this->transfer_.name_len_);
00281 this->transfer_.value_len_ = htonl (this->transfer_.value_len_);
00282 this->transfer_.type_len_ = htonl (this->transfer_.type_len_);
00283
00284 return len;
00285 }
|
|
|
Initialize length_ in order to ensure correct byte ordering before a request is sent. Definition at line 80 of file Name_Request_Reply.cpp. References ACE_TRACE, and length().
|
|
|
Definition at line 96 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::length_, and transfer_.
|
|
|
Definition at line 89 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 112 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::msg_type_, and transfer_.
|
|
|
|
Definition at line 210 of file Name_Request_Reply.cpp. References ACE_TRACE, and ACE_OS::memcpy().
00211 {
00212 ACE_TRACE ("ACE_Name_Request::name");
00213 (void) ACE_OS::memcpy (this->name_,
00214 t,
00215 this->name_len ());
00216 }
|
|
|
Definition at line 203 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 128 of file Name_Request_Reply.cpp. References ACE_TRACE, ACE_Name_Request::Transfer::name_len_, and transfer_.
|
|
|
Definition at line 121 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 193 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_.
00194 {
00195 ACE_TRACE ("ACE_Name_Request::timeout");
00196 this->transfer_.sec_timeout_ = timeout.sec ();
00197 this->transfer_.usec_timeout_ = timeout.usec ();
00198 }
|
|
|
Definition at line 185 of file Name_Request_Reply.cpp. References ACE_Time_Value, and ACE_TRACE. Referenced by dump().
00186 {
00187 ACE_TRACE ("ACE_Name_Request::timeout");
00188 return ACE_Time_Value (this->transfer_.sec_timeout_,
00189 this->transfer_.usec_timeout_);
00190 }
|
|
|
Definition at line 247 of file Name_Request_Reply.cpp. References ACE_TRACE, and ACE_OS::strsncpy().
00248 {
00249 ACE_TRACE ("ACE_Name_Request::type");
00250 ACE_OS::strsncpy (this->type_,
00251 c,
00252 sizeof this->type_);
00253 }
|
|
|
Definition at line 240 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 160 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::type_len_.
|
|
|
Definition at line 153 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 228 of file Name_Request_Reply.cpp. References ACE_TRACE, and ACE_OS::memcpy().
00229 {
00230 ACE_TRACE ("ACE_Name_Request::value");
00231
00232 (void) ACE_OS::memcpy (this->value_,
00233 c,
00234 this->value_len());
00235 }
|
|
|
Definition at line 221 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 144 of file Name_Request_Reply.cpp. References ACE_TRACE, transfer_, and ACE_Name_Request::Transfer::value_len_.
00145 {
00146 ACE_TRACE ("ACE_Name_Request::value_len");
00147 this->transfer_.value_len_ = t;
00148 }
|
|
|
Definition at line 137 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().
00138 {
00139 ACE_TRACE ("ACE_Name_Request::value_len");
00140 return this->transfer_.value_len_;
00141 }
|
|
|
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