#include <Token_Request_Reply.h>
Collaboration diagram for ACE_Token_Request:
Public Types | |
enum | OPERATION { ACQUIRE, RELEASE, RENEW, REMOVE, TRY_ACQUIRE } |
Operation types. More... | |
Public Member Functions | |
ACE_Token_Request (void) | |
Default constructor. | |
ACE_Token_Request (int token_type, int proxy_type, ACE_UINT32 operation, const ACE_TCHAR token_name[], const ACE_TCHAR client_id[], const ACE_Synch_Options &options) | |
ACE_UINT32 | length (void) const |
Get the length of the encoded/decoded message. | |
void | length (ACE_UINT32) |
Set the length of the encoded/decoded message. | |
int | proxy_type (void) const |
Get the type of proxy. | |
void | proxy_type (int proxy_type) |
Set the type of proxy. | |
int | token_type (void) const |
Get the type of token. | |
void | token_type (int token_type) |
Set the type of token. | |
ACE_UINT32 | operation_type (void) const |
Get the type of the operation. | |
void | operation_type (ACE_UINT32) |
Set the type of the operation. | |
ACE_UINT32 | requeue_position (void) const |
void | requeue_position (ACE_UINT32) |
ACE_UINT32 | notify (void) const |
Get notify. These should be used when acquire is the operation type. | |
void | notify (ACE_UINT32) |
Set notify. These should be used when acquire is the operation type. | |
ACE_Synch_Options & | options (void) const |
Get the timeout. | |
void | options (const ACE_Synch_Options &options) |
Set the timeout. | |
ACE_TCHAR * | token_name (void) const |
ACE_TCHAR * | client_id (void) const |
void | token_name (const ACE_TCHAR *token_name, const ACE_TCHAR *client_id) |
int | encode (void *&) |
Encode the message before transmission. | |
int | decode (void) |
void | dump (void) const |
Print out the values of the message for debugging purposes. | |
Private Attributes | |
ACE_Token_Request::Transfer | transfer_ |
ACE_TCHAR * | token_name_ |
Pointer to the beginning of the token name in this->data_. | |
ACE_TCHAR * | client_id_ |
Pointer to the beginning of the client id in this->data_;. | |
ACE_Synch_Options | options_ |
Holds arg, sec, usec, etc. |
This class is implemented to minimize data copying. In particular, all marshaling is done in situ...
Definition at line 45 of file Token_Request_Reply.h.
|
Operation types.
Definition at line 49 of file Token_Request_Reply.h.
00050 { 00051 /// Acquire the token. 00052 ACQUIRE, 00053 /// Release the token. 00054 RELEASE, 00055 /// Renew the token. 00056 RENEW, 00057 /// Remove the token. 00058 REMOVE, 00059 // Try to acquire the token. 00060 TRY_ACQUIRE 00061 }; |
|
Default constructor.
Definition at line 17 of file Token_Request_Reply.cpp.
00018 : token_name_ (0), 00019 client_id_ (0) 00020 { 00021 } |
|
Definition at line 25 of file Token_Request_Reply.cpp. References ACE_TCHAR, ACE_Token_Request::Transfer::arg_, ACE_Token_Request::Transfer::data_, ACE_OS::memset(), notify(), operation_type(), options(), proxy_type(), requeue_position(), token_name(), and token_type().
00031 { 00032 this->token_type (token_type); 00033 this->proxy_type (proxy_type); 00034 this->operation_type (operation_type); 00035 this->requeue_position (0); // to avoid Purify UMR 00036 this->notify (0); // to avoid Purify UMR 00037 transfer_.arg_ = 0; // to avoid Purify UMR 00038 ACE_OS::memset (transfer_.data_, 0, sizeof transfer_.data_); // to avoid Purify UMR 00039 this->token_name (token_name, client_id); 00040 this->options (options); 00041 } |
|
Referenced by dump(). |
|
Decode message after reception. This must be called to set the internal options. Definition at line 57 of file Token_Request_Reply.cpp. References ACE_MAXTOKENNAMELEN, ACE_TCHAR, ACE_TOKEN_REQUEST_HEADER_SIZE, ACE_Token_Request::Transfer::arg_, ACE_Token_Request::Transfer::data_, length(), ACE_Token_Request::Transfer::sec_, ACE_Synch_Options::set(), ACE_OS::strlen(), ACE_Token_Request::Transfer::use_timeout_, and ACE_Token_Request::Transfer::usec_.
00058 { 00059 this->token_name_ = this->transfer_.data_; 00060 00061 options_.set (transfer_.use_timeout_ == 1 ? ACE_Synch_Options::USE_TIMEOUT : 0, 00062 ACE_Time_Value (transfer_.sec_, transfer_.usec_), 00063 (void *) transfer_.arg_); 00064 00065 // Decode the variable-sized portion. 00066 size_t token_len = ACE_OS::strlen (this->token_name_); 00067 00068 // Check to make sure this->tokenName_ isn't too long! 00069 if (token_len >= ACE_MAXTOKENNAMELEN) 00070 { 00071 errno = ENAMETOOLONG; 00072 return -1; 00073 } 00074 else // Skip this->tokenName_ + '\0' + ':'. 00075 this->client_id_ = 00076 &this->token_name_[(token_len + 2) * sizeof (ACE_TCHAR)]; 00077 00078 // Fixed size header 00079 // token_name_ plus '\0' 00080 // ':' 00081 // client_id_ plus '\0' 00082 size_t data_size = ACE_TOKEN_REQUEST_HEADER_SIZE 00083 + ACE_OS::strlen (this->token_name_) + 1 00084 + ACE_OS::strlen (this->client_id_) + 1 00085 + 1; 00086 00087 // Make sure the message was correctly received and framed. 00088 return this->length () == data_size ? 0 : -1; 00089 } |
|
Print out the values of the message for debugging purposes.
Definition at line 94 of file Token_Request_Reply.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACQUIRE, client_id(), LM_DEBUG, operation_type(), options(), proxy_type(), RELEASE, RENEW, ACE_Synch_Options::timeout(), token_name(), token_type(), and ACE_Time_Value::usec().
00095 { 00096 #if defined (ACE_HAS_DUMP) 00097 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00098 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\nlength = %d\ntoken name = %s\nclient id = %s\n"), 00099 this->length (), this->token_name (), this->client_id ())); 00100 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("type = "))); 00101 00102 if (this->token_type () == ACE_Tokens::MUTEX) 00103 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("MUTEX\n"))); 00104 else // == ACE_Tokens::RWLOCK 00105 { 00106 if (this->proxy_type () == ACE_RW_Token::READER) 00107 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RLOCK\n"))); 00108 else // == WRITER 00109 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("WLOCK\n"))); 00110 } 00111 00112 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("operation = "))); 00113 switch (this->operation_type ()) 00114 { 00115 case ACE_Token_Request::ACQUIRE: 00116 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACQUIRE\n"))); 00117 break; 00118 case ACE_Token_Request::RELEASE: 00119 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RELEASE\n"))); 00120 break; 00121 case ACE_Token_Request::RENEW: 00122 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RENEW\n"))); 00123 break; 00124 default: 00125 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("<unknown operation type> = %d\n"), this->operation_type ())); 00126 break; 00127 } 00128 00129 if (this->options ()[ACE_Synch_Options::USE_TIMEOUT] == 0) 00130 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("blocking forever\n"))); 00131 else 00132 { 00133 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"), 00134 this->options ().timeout ().sec (), this->options ().timeout ().usec ())); 00135 } 00136 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00137 #endif /* ACE_HAS_DUMP */ 00138 } |
|
Encode the message before transmission.
Definition at line 47 of file Token_Request_Reply.cpp. References length(). Referenced by ACE_Remote_Token_Proxy::request_reply().
|
|
Set the length of the encoded/decoded message.
|
|
Get the length of the encoded/decoded message.
|
|
Set notify. These should be used when acquire is the operation type.
|
|
Get notify. These should be used when acquire is the operation type.
Referenced by ACE_Token_Request(), and ACE_Remote_Token_Proxy::acquire(). |
|
Set the type of the operation.
|
|
Get the type of the operation.
Referenced by ACE_Token_Request(), and dump(). |
|
Set the timeout.
|
|
Get the timeout.
Referenced by ACE_Token_Request(), and dump(). |
|
Set the type of proxy.
|
|
Get the type of proxy.
Referenced by ACE_Token_Request(), and dump(). |
|
Set the requeue position. These should be used when renew is the operation type. |
|
Get the requeue position. These should be used when renew is the operation type. Referenced by ACE_Token_Request(), and ACE_Remote_Token_Proxy::renew(). |
|
|
|
Referenced by ACE_Token_Request(), and dump(). |
|
Set the type of token.
|
|
Get the type of token.
Referenced by ACE_Token_Request(), and dump(). |
|
Pointer to the beginning of the client id in this->data_;.
Definition at line 192 of file Token_Request_Reply.h. |
|
Holds arg, sec, usec, etc.
Definition at line 195 of file Token_Request_Reply.h. |
|
Pointer to the beginning of the token name in this->data_.
Definition at line 189 of file Token_Request_Reply.h. |
|
|