TAO_RTEvent
2.0.8
|
Receives UDP and Multicast messages. More...
#include <ECG_CDR_Message_Receiver.h>
Classes | |
struct | Mcast_Header |
Helper for decoding, validating and storing mcast header. More... | |
class | Requests |
Public Member Functions | |
int | handle_input (ACE_SOCK_Dgram &dgram, TAO_ECG_CDR_Processor *cdr_processor) |
TAO_ECG_CDR_Message_Receiver (CORBA::Boolean check_crc) | |
Initialization and termination methods. | |
~TAO_ECG_CDR_Message_Receiver (void) | |
Initialization and termination methods. | |
void | init (TAO_ECG_Refcounted_Endpoint ignore_from) |
void | shutdown (void) |
Initialization and termination methods. | |
Static Public Attributes | |
static TAO_ECG_UDP_Request_Entry | Request_Completed_ |
Private Types | |
enum | { ECG_DEFAULT_MAX_FRAGMENTED_REQUESTS = 1024, ECG_DEFAULT_FRAGMENTED_REQUESTS_MIN_PURGE_COUNT = 32 } |
typedef ACE_Hash_Map_Manager < ACE_INET_Addr, Requests *, ACE_Null_Mutex > | Request_Map |
Private Member Functions | |
int | mark_received (const ACE_INET_Addr &from, CORBA::ULong request_id) |
int | process_fragment (const ACE_INET_Addr &from, const Mcast_Header &header, char *data_buf, TAO_ECG_CDR_Processor *cdr_processor) |
Request_Map::ENTRY * | get_source_entry (const ACE_INET_Addr &from) |
Private Attributes | |
TAO_ECG_Refcounted_Endpoint | ignore_from_ |
Ignore any events coming from this IP address. | |
Request_Map | request_map_ |
size_t | max_requests_ |
Serializes use of <request_map_>. | |
size_t | min_purge_count_ |
CORBA::Boolean | check_crc_ |
Flag to indicate whether CRC should be computed and checked. |
Receives UDP and Multicast messages.
5) Make status array size and purge_count configurable.
This class receives UDP and Multicast message fragments, assembles them (described in detail below), and passes complete messages in the form of cdr streams to the calling classes.
This class is used by various Gateway classes (Senders/Receivers) responsible for federating Event Channels with UDP/Mcast.
= REASSEMBLY Fragmentation is described in ECG_CDR_Message_Sender.h Whenever an incomplete fragment is received (one with fragment_count > 1) we allocate an entry for the message in an map indexed by (host,port,request_id). The entry contains the buffer, a bit vector to keep track of the fragments received so far, and a timeout counter. This timeout counter is set to 0 on each (new) fragment arrival, and incremented on a regular basis. If the counter reaches a maximum value the message is dropped. Once all the fragments have been received the message is sent up to the calling classes, and the memory reclaimed.
typedef ACE_Hash_Map_Manager<ACE_INET_Addr, Requests*, ACE_Null_Mutex> TAO_ECG_CDR_Message_Receiver::Request_Map [private] |
anonymous enum [private] |
TAO_ECG_CDR_Message_Receiver::TAO_ECG_CDR_Message_Receiver | ( | CORBA::Boolean | check_crc | ) |
Initialization and termination methods.
TAO_ECG_CDR_Message_Receiver::~TAO_ECG_CDR_Message_Receiver | ( | void | ) |
Initialization and termination methods.
TAO_ECG_CDR_Message_Receiver::Request_Map::ENTRY * TAO_ECG_CDR_Message_Receiver::get_source_entry | ( | const ACE_INET_Addr & | from | ) | [private] |
int TAO_ECG_CDR_Message_Receiver::handle_input | ( | ACE_SOCK_Dgram & | dgram, |
TAO_ECG_CDR_Processor * | cdr_processor | ||
) |
Main method: read the data from dgram and either pass ready data to cdr_processor or update the <request_map_> if the request is not yet complete. Returns 1 if data was read successfully and accepted by <cdr_processor> without errors. Returns 0 if there were no errors, but no data has been passed to <cdr_processor>, either due to request being incomplete (not all fragments received), or it being a duplicate. Returns -1 if there were errors.
void TAO_ECG_CDR_Message_Receiver::init | ( | TAO_ECG_Refcounted_Endpoint | ignore_from | ) |
ignore_from | Endpoint used to remove events generated by the same process. |
int TAO_ECG_CDR_Message_Receiver::mark_received | ( | const ACE_INET_Addr & | from, |
CORBA::ULong | request_id | ||
) | [private] |
Returns 1 on success, 0 if <request_id> has already been received or is below current request range, and -1 on error.
int TAO_ECG_CDR_Message_Receiver::process_fragment | ( | const ACE_INET_Addr & | from, |
const Mcast_Header & | header, | ||
char * | data_buf, | ||
TAO_ECG_CDR_Processor * | cdr_processor | ||
) | [private] |
Returns 1 if complete request is received and <event> is populated, 0 if request has only partially been received or is a duplicate, and -1 on error.
void TAO_ECG_CDR_Message_Receiver::shutdown | ( | void | ) |
Initialization and termination methods.
Flag to indicate whether CRC should be computed and checked.
Ignore any events coming from this IP address.
size_t TAO_ECG_CDR_Message_Receiver::max_requests_ [private] |
Serializes use of <request_map_>.
Size of a fragmented requests array, i.e., max number of partially received requests kept at any given time per source.
size_t TAO_ECG_CDR_Message_Receiver::min_purge_count_ [private] |
Minimum number of requests purged from a fragmented requests array when the range of requests represented there needs to be shifted.
Represents any request that has been fully received and serviced, to simplify the internal logic.
The map containing all the incoming requests which have been partially received.