#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 Methods | |
| ACE_Token_Request (void) | |
| Default constructor. More... | |
| 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. More... | |
| void | length (ACE_UINT32) |
| Set the length of the encoded/decoded message. More... | |
| int | proxy_type (void) const |
| Get the type of proxy. More... | |
| void | proxy_type (int proxy_type) |
| Set the type of proxy. More... | |
| int | token_type (void) const |
| Get the type of token. More... | |
| void | token_type (int token_type) |
| Set the type of token. More... | |
| ACE_UINT32 | operation_type (void) const |
| Get the type of the operation. More... | |
| void | operation_type (ACE_UINT32) |
| Set the type of the operation. More... | |
| ACE_UINT32 | requeue_position (void) const |
| Get the requeue position. These should be used when renew is the operation type. More... | |
| void | requeue_position (ACE_UINT32) |
| Set the requeue position. These should be used when renew is the operation type. More... | |
| ACE_UINT32 | notify (void) const |
| Get notify. These should be used when acquire is the operation type. More... | |
| void | notify (ACE_UINT32) |
| Set notify. These should be used when acquire is the operation type. More... | |
| ACE_Synch_Options & | options (void) const |
| void | options (const ACE_Synch_Options &options) |
| 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. More... | |
| int | decode (void) |
| Decode message after reception. This must be called to set the internal options. More... | |
| void | dump (void) const |
| Print out the values of the message for debugging purposes. More... | |
Private Attributes | |
| ACE_Token_Request::Transfer | transfer_ |
| ACE_TCHAR * | token_name_ |
| Pointer to the beginning of the token name in this->data_. More... | |
| ACE_TCHAR * | client_id_ |
| Pointer to the beginning of the client id in this->data_;. More... | |
| ACE_Synch_Options | options_ |
| Holds arg, sec, usec, etc. More... | |
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 16 of file Token_Request_Reply.cpp.
00017 : token_name_ (0), 00018 client_id_ (0) 00019 { 00020 } |
|
||||||||||||||||||||||||||||
|
token_type - MUTEX, RWLOCK proxy_type - MUTEX, RLOCK, WLOCK (acquires mean different things) operation - method token_name client_id options - we check USE_TIMEOUT and use the arg. Definition at line 24 of file Token_Request_Reply.cpp. References ACE_TCHAR, ACE_Token_Request::Transfer::arg_, client_id, ACE_Token_Request::Transfer::data_, ACE_OS_String::memset, notify, operation_type, options, proxy_type, requeue_position, token_name, token_type, and transfer_.
00030 {
00031 this->token_type (token_type);
00032 this->proxy_type (proxy_type);
00033 this->operation_type (operation_type);
00034 this->requeue_position (0); // to avoid Purify UMR
00035 this->notify (0); // to avoid Purify UMR
00036 transfer_.arg_ = 0; // to avoid Purify UMR
00037 ACE_OS::memset (transfer_.data_, 0, sizeof transfer_.data_); // to avoid Purify UMR
00038 this->token_name (token_name, client_id);
00039 this->options (options);
00040 }
|
|
|
Referenced by ACE_Token_Request, and dump. |
|
|
Decode message after reception. This must be called to set the internal options.
Definition at line 56 of file Token_Request_Reply.cpp. References ACE_MAXTOKENNAMELEN, ACE_TOKEN_REQUEST_HEADER_SIZE, ACE_Token_Request::Transfer::arg_, client_id_, ACE_Token_Request::Transfer::data_, length, options_, ACE_Token_Request::Transfer::sec_, ACE_Synch_Options::set, ACE_OS_String::strlen, token_name_, transfer_, ACE_Synch_Options::USE_TIMEOUT, ACE_Token_Request::Transfer::use_timeout_, and ACE_Token_Request::Transfer::usec_.
00057 {
00058 this->token_name_ = this->transfer_.data_;
00059
00060 options_.set (transfer_.use_timeout_ == 1 ? ACE_Synch_Options::USE_TIMEOUT : 0,
00061 ACE_Time_Value (transfer_.sec_, transfer_.usec_),
00062 (void *) transfer_.arg_);
00063
00064 // Decode the variable-sized portion.
00065 int token_len = ACE_OS::strlen (this->token_name_);
00066
00067 // Check to make sure this->tokenName_ isn't too long!
00068 if (token_len >= ACE_MAXTOKENNAMELEN)
00069 {
00070 errno = ENAMETOOLONG;
00071 return -1;
00072 }
00073 else // Skip this->tokenName_ + '\0' + ':'.
00074 this->client_id_ =
00075 &this->token_name_[(token_len + 2) * sizeof (ACE_TCHAR)];
00076
00077 // Fixed size header
00078 // token_name_ plus '\0'
00079 // ':'
00080 // client_id_ plus '\0'
00081 size_t data_size = ACE_TOKEN_REQUEST_HEADER_SIZE
00082 + ACE_OS::strlen (this->token_name_) + 1
00083 + ACE_OS::strlen (this->client_id_) + 1
00084 + 1;
00085
00086 // Make sure the message was correctly received and framed.
00087 return this->length () == data_size ? 0 : -1;
00088 }
|
|
|
Print out the values of the message for debugging purposes.
Definition at line 93 of file Token_Request_Reply.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACQUIRE, client_id, LM_DEBUG, ACE_Tokens::MUTEX, operation_type, options, proxy_type, ACE_RW_Token::READER, RELEASE, RENEW, ACE_Synch_Options::timeout, token_name, token_type, ACE_Synch_Options::USE_TIMEOUT, and ACE_Time_Value::usec.
00094 {
00095 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00096 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\nlength = %d\ntoken name = %s\nclient id = %s\n"),
00097 this->length (), this->token_name (), this->client_id ()));
00098 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("type = ")));
00099
00100 if (this->token_type () == ACE_Tokens::MUTEX)
00101 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("MUTEX\n")));
00102 else // == ACE_Tokens::RWLOCK
00103 {
00104 if (this->proxy_type () == ACE_RW_Token::READER)
00105 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RLOCK\n")));
00106 else // == WRITER
00107 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("WLOCK\n")));
00108 }
00109
00110 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("operation = ")));
00111 switch (this->operation_type ())
00112 {
00113 case ACE_Token_Request::ACQUIRE:
00114 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACQUIRE\n")));
00115 break;
00116 case ACE_Token_Request::RELEASE:
00117 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RELEASE\n")));
00118 break;
00119 case ACE_Token_Request::RENEW:
00120 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RENEW\n")));
00121 break;
00122 default:
00123 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("<unknown operation type> = %d\n"), this->operation_type ()));
00124 break;
00125 }
00126
00127 if (this->options ()[ACE_Synch_Options::USE_TIMEOUT] == 0)
00128 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("blocking forever\n")));
00129 else
00130 {
00131 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"),
00132 this->options ().timeout ().sec (), this->options ().timeout ().usec ()));
00133 }
00134 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00135 }
|
|
|
Encode the message before transmission.
Definition at line 46 of file Token_Request_Reply.cpp. References length, and transfer_. 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. |
|
|
|
|
|
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 190 of file Token_Request_Reply.h. Referenced by decode. |
|
|
Holds arg, sec, usec, etc.
Definition at line 193 of file Token_Request_Reply.h. Referenced by decode. |
|
|
Pointer to the beginning of the token name in this->data_.
Definition at line 187 of file Token_Request_Reply.h. Referenced by decode. |
|
|
Referenced by ACE_Token_Request, decode, and encode. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002