#include <ECG_CDR_Message_Receiver.h>
Collaboration diagram for TAO_ECG_UDP_Request_Entry:

Public Types | |
| enum | { ECG_DEFAULT_FRAGMENT_BUFSIZ = 8 } |
Public Member Functions | |
| TAO_ECG_UDP_Request_Entry (CORBA::Boolean byte_order, CORBA::ULong request_id, CORBA::ULong request_size, CORBA::ULong fragment_count) | |
| Initialize the fragment, allocating memory, etc. | |
| ~TAO_ECG_UDP_Request_Entry (void) | |
| int | validate_fragment (CORBA::Boolean byte_order, CORBA::ULong request_size, CORBA::ULong fragment_size, CORBA::ULong fragment_offset, CORBA::ULong fragment_id, CORBA::ULong fragment_count) const |
| Validate a fragment, it should be rejected if it is invalid.. | |
| int | test_received (CORBA::ULong fragment_id) const |
| Has fragment_id been received? | |
| void | mark_received (CORBA::ULong fragment_id) |
| Mark fragment_id as received, reset timeout counter... | |
| int | complete (void) const |
| Is the message complete? | |
| char * | fragment_buffer (CORBA::ULong fragment_offset) |
| Return a buffer for the fragment at offset fragment_offset. | |
Private Member Functions | |
| TAO_ECG_UDP_Request_Entry (const TAO_ECG_UDP_Request_Entry &rhs) | |
| TAO_ECG_UDP_Request_Entry & | operator= (const TAO_ECG_UDP_Request_Entry &rhs) |
Private Attributes | |
| CORBA::Boolean | byte_order_ |
| CORBA::ULong | request_id_ |
| CORBA::ULong | request_size_ |
| CORBA::ULong | fragment_count_ |
| ACE_Message_Block | payload_ |
| CORBA::ULong * | received_fragments_ |
| This is a bit vector, used to keep track of the received buffers. | |
| int | own_received_fragments_ |
| CORBA::ULong | received_fragments_size_ |
| CORBA::ULong | default_received_fragments_ [ECG_DEFAULT_FRAGMENT_BUFSIZ] |
When a request arrives in fragments this object is used to keep track of the incoming data.
Definition at line 56 of file ECG_CDR_Message_Receiver.h.
|
|
Definition at line 59 of file ECG_CDR_Message_Receiver.h.
00059 {
00060 ECG_DEFAULT_FRAGMENT_BUFSIZ = 8
00061 };
|
|
||||||||||||||||||||
|
Initialize the fragment, allocating memory, etc.
Definition at line 37 of file ECG_CDR_Message_Receiver.cpp. References ACE_NEW, default_received_fragments_, ECG_DEFAULT_FRAGMENT_BUFSIZ, fragment_count_, ACE_CDR::grow(), own_received_fragments_, payload_, received_fragments_, received_fragments_size_, request_size_, and ACE_Message_Block::wr_ptr().
00041 : byte_order_ (byte_order) 00042 , request_id_ (request_id) 00043 , request_size_ (request_size) 00044 , fragment_count_ (fragment_count) 00045 { 00046 ACE_CDR::grow (&this->payload_, this->request_size_); 00047 this->payload_.wr_ptr (request_size_); 00048 00049 this->received_fragments_ = this->default_received_fragments_; 00050 this->own_received_fragments_ = 0; 00051 const int bits_per_ulong = sizeof(CORBA::ULong) * CHAR_BIT; 00052 this->received_fragments_size_ = 00053 this->fragment_count_ / bits_per_ulong + 1; 00054 if (this->received_fragments_size_ > ECG_DEFAULT_FRAGMENT_BUFSIZ) 00055 { 00056 ACE_NEW (this->received_fragments_, 00057 CORBA::ULong[this->received_fragments_size_]); 00058 this->own_received_fragments_ = 1; 00059 } 00060 00061 for (CORBA::ULong i = 0; i < this->received_fragments_size_; ++i) 00062 this->received_fragments_[i] = 0; 00063 CORBA::ULong idx = this->fragment_count_ / bits_per_ulong; 00064 CORBA::ULong bit = this->fragment_count_ % bits_per_ulong; 00065 this->received_fragments_[idx] = (0xFFFFFFFF << bit); 00066 } |
|
|
Definition at line 27 of file ECG_CDR_Message_Receiver.cpp. References own_received_fragments_, and received_fragments_.
00028 {
00029 if (this->own_received_fragments_)
00030 {
00031 this->own_received_fragments_ = 0;
00032 delete[] this->received_fragments_;
00033 }
00034 }
|
|
|
|
|
|
Is the message complete?
Definition at line 115 of file ECG_CDR_Message_Receiver.cpp. References received_fragments_, and received_fragments_size_.
00116 {
00117 for (CORBA::ULong i = 0;
00118 i < this->received_fragments_size_;
00119 ++i)
00120 {
00121 if (this->received_fragments_[i] != 0xFFFFFFFF)
00122 return 0;
00123 }
00124 return 1;
00125 }
|
|
|
Return a buffer for the fragment at offset fragment_offset.
Definition at line 128 of file ECG_CDR_Message_Receiver.cpp. References payload_, and ACE_Message_Block::rd_ptr().
|
|
|
Mark fragment_id as received, reset timeout counter...
Definition at line 102 of file ECG_CDR_Message_Receiver.cpp. References ACE_SET_BITS, and fragment_count_.
00103 {
00104 // Assume out-of-range fragments as received, so they are dropped...
00105 if (fragment_id > this->fragment_count_)
00106 return;
00107
00108 const int bits_per_ulong = sizeof(CORBA::ULong) * CHAR_BIT;
00109 CORBA::ULong idx = fragment_id / bits_per_ulong;
00110 CORBA::ULong bit = fragment_id % bits_per_ulong;
00111 ACE_SET_BITS (this->received_fragments_[idx], 1<<bit);
00112 }
|
|
|
|
|
|
Has fragment_id been received?
Definition at line 89 of file ECG_CDR_Message_Receiver.cpp. References ACE_BIT_ENABLED, and fragment_count_.
00090 {
00091 // Assume out-of-range fragments as received, so they are dropped...
00092 if (fragment_id > this->fragment_count_)
00093 return 1;
00094
00095 const int bits_per_ulong = sizeof(CORBA::ULong) * CHAR_BIT;
00096 CORBA::ULong idx = fragment_id / bits_per_ulong;
00097 CORBA::ULong bit = fragment_id % bits_per_ulong;
00098 return ACE_BIT_ENABLED (this->received_fragments_[idx], 1<<bit);
00099 }
|
|
||||||||||||||||||||||||||||
|
Validate a fragment, it should be rejected if it is invalid..
Definition at line 69 of file ECG_CDR_Message_Receiver.cpp. References fragment_count_, and request_size_.
00075 {
00076 if (byte_order != this->byte_order_
00077 || request_size != this->request_size_
00078 || fragment_count != this->fragment_count_)
00079 return 0;
00080
00081 if (fragment_offset >= request_size
00082 || fragment_offset + fragment_size > request_size)
00083 return 0;
00084
00085 return 1;
00086 }
|
|
|
This attributes should remain constant in all the fragments, used for validation.... Definition at line 99 of file ECG_CDR_Message_Receiver.h. |
|
|
Definition at line 110 of file ECG_CDR_Message_Receiver.h. Referenced by TAO_ECG_UDP_Request_Entry(). |
|
|
Definition at line 102 of file ECG_CDR_Message_Receiver.h. Referenced by mark_received(), TAO_ECG_UDP_Request_Entry(), test_received(), and validate_fragment(). |
|
|
Definition at line 108 of file ECG_CDR_Message_Receiver.h. Referenced by TAO_ECG_UDP_Request_Entry(), and ~TAO_ECG_UDP_Request_Entry(). |
|
|
Definition at line 104 of file ECG_CDR_Message_Receiver.h. Referenced by fragment_buffer(), and TAO_ECG_UDP_Request_Entry(). |
|
|
This is a bit vector, used to keep track of the received buffers.
Definition at line 107 of file ECG_CDR_Message_Receiver.h. Referenced by complete(), TAO_ECG_UDP_Request_Entry(), and ~TAO_ECG_UDP_Request_Entry(). |
|
|
Definition at line 109 of file ECG_CDR_Message_Receiver.h. Referenced by complete(), and TAO_ECG_UDP_Request_Entry(). |
|
|
Definition at line 100 of file ECG_CDR_Message_Receiver.h. |
|
|
Definition at line 101 of file ECG_CDR_Message_Receiver.h. Referenced by TAO_ECG_UDP_Request_Entry(), and validate_fragment(). |
1.3.6