Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# TAO_ECG_UDP_Sender Class Reference

Send events received from a "local" EC using UDP. More...

`#include <EC_Gateway_UDP.h>`

Inheritance diagram for TAO_ECG_UDP_Sender

[legend]
Collaboration diagram for TAO_ECG_UDP_Sender:

[legend]
List of all members.

## Public Types
enum | { ECG_HEADER_SIZE = 32, ECG_MIN_MTU = 32 + 8, ECG_MAX_MTU = 65536, ECG_DEFAULT_MTU = 1024 }
## Public Methods
| TAO_ECG_UDP_Sender (void)
int | get_local_addr (ACE_INET_Addr& addr)
| Get the local endpoint used to send the events.
void | init (RtecEventChannelAdmin::EventChannel_ptr lcl_ec, RtecUDPAdmin::AddrServer_ptr addr_server, TAO_ECG_UDP_Out_Endpoint *endpoint, CORBA::Environment &env = TAO_default_environment ())
int | mtu (CORBA::ULong mtu)
CORBA::ULong | mtu (void) const
void | shutdown (CORBA::Environment & = TAO_default_environment ())
| Disconnect and shutdown the sender, no further connections will work unless init() is called again.
void | open (RtecEventChannelAdmin::ConsumerQOS &sub, CORBA::Environment &env = TAO_default_environment ())
| Connect (or reconnect) to the EC with the given subscriptions.
void | close (CORBA::Environment &env = TAO_default_environment ())
| Disconnect from the EC, but reconnection is still possible.
virtual void | disconnect_push_consumer (CORBA::Environment & = TAO_default_environment ()) throw (CORBA::SystemException)
| The PushConsumer methods.
virtual void | push (const RtecEventComm::EventSet &events, CORBA::Environment & = TAO_default_environment ()) throw (CORBA::SystemException)
## Private Methods
ACE_SOCK_Dgram& | dgram (void)
| Return the datagram...
void | send_fragment (const RtecUDPAdmin::UDP_Addr& udp_addr, CORBA::ULong request_id, CORBA::ULong request_size, CORBA::ULong fragment_size, CORBA::ULong fragment_offset, CORBA::ULong fragment_id, CORBA::ULong fragment_count, iovec iov[], int iovcnt, CORBA::Environment &env = TAO_default_environment ())
CORBA::ULong | compute_fragment_count (const ACE_Message_Block* begin, const ACE_Message_Block* end, int iov_size, CORBA::ULong max_fragment_payload, CORBA::ULong& total_length)
## Private Attributes
RtecEventChannelAdmin::EventChannel_var | lcl_ec_
| The remote and the local EC, so we can reconnect when the subscription list changes.
RtecEventChannelAdmin::ProxyPushSupplier_var | supplier_proxy_
| We talk to the EC (as a consumer) using this proxy.
RtecUDPAdmin::AddrServer_var | addr_server_
| We query this object to determine where are the events sent.
TAO_ECG_UDP_Out_Endpoint* | endpoint_
| The datagram used to sendto(), this object is *not* owned by the UDP_Sender.
CORBA::ULong | mtu_
| The MTU for this sender...

## Detailed Description

Send events received from a "local" EC using UDP.

This class connect as a consumer to an EventChannel and it sends the events using UDP, the UDP address can be a normal IP address or it can be a multicast group. The UDP address is obtained from a RtecUDPAdmin::AddrServer class. It marshalls the events using TAO CDR classes.

## MESSAGE FORMAT

The messages header are encapsulated using CDR, with the following format: struct Header { octet byte_order_flags; // bit 0 represents the byte order as in GIOP 1.1 // bit 1 is set if this is the last fragment unsigned long request_id; // The request ID, senders must not send two requests with // the same ID, senders can be distinguished using recvfrom.. unsigned long request_size; // The size of this request, this can be used to pre-allocate // the request buffer. unsgined long fragment_size; // The size of this fragment, excluding the header... unsigned long fragment_offset; // Where does this fragment fit in the complete message... unsigned long fragment_id; // The ID of this fragment... unsigned long fragment_count; // The total number of fragments to expect in this request

//

Todo:
  This could be eliminated if efficient reassembly octet padding[4];

// Ensures the header ends at an 8-byte boundary. }; // size (in CDR stream) = 32

## Member Enumeration Documentation

anonymous enum

  | Enumeration values:
  ECG_HEADER_SIZE |
  ECG_MIN_MTU |
  ECG_MAX_MTU |
  ECG_DEFAULT_MTU |

## Constructor & Destructor Documentation

const char *get_rcsid_Event_ TAO_ECG_UDP_Sender::TAO_ECG_UDP_Sender ( | void )`[inline]`

## Member Function Documentation

void TAO_ECG_UDP_Sender::close ( | CORBA::Environment & env = TAO_default_environment () )

| Disconnect from the EC, but reconnection is still possible.

CORBA::ULong TAO_ECG_UDP_Sender::compute_fragment_count ( | const ACE_Message_Block * begin,
| const ACE_Message_Block * end,
| int iov_size,
| CORBA::ULong max_fragment_payload,
| CORBA::ULong & total_length )`[private]`

| Count the number of fragments that will be required to send the message blocks in the range [begin,end) The maximum fragment payload (i.e. the size without the header is also required); <total_length> returns the total message size.

ACE_INLINE ACE_SOCK_Dgram & TAO_ECG_UDP_Sender::dgram ( | void )`[private]`

| Return the datagram...

void TAO_ECG_UDP_Sender::disconnect_push_consumer ( | CORBA::Environment & = TAO_default_environment () ) throw (CORBA::SystemException)`[virtual]`

| The PushConsumer methods.

int TAO_ECG_UDP_Sender::get_local_addr ( | ACE_INET_Addr & addr )

| Get the local endpoint used to send the events.

void TAO_ECG_UDP_Sender::init ( | RtecEventChannelAdmin::EventChannel_ptr lcl_ec,
| RtecUDPAdmin::AddrServer_ptr addr_server,
| TAO_ECG_UDP_Out_Endpoint * endpoint,
| CORBA::Environment & env = TAO_default_environment () )

| To do its job this class requires to know the local EC it will connect to; it also requires to build an RT_Info for the local scheduler. It only keeps a copy of its SupplierProxy, used for later connection and disconnections. Todo: part of the RT_Info is hardcoded, we need to make it parametric.

ACE_INLINE CORBA::ULong TAO_ECG_UDP_Sender::mtu ( | void ) const

int TAO_ECG_UDP_Sender::mtu ( | CORBA::ULong mtu )

| The sender may need to fragment the message, otherwise the network may drop the packets. Setting the MTU can fail if the value is too small (at least the header + 8 bytes must fit).

void TAO_ECG_UDP_Sender::open ( | RtecEventChannelAdmin::ConsumerQOS & sub,
| CORBA::Environment & env = TAO_default_environment () )

| Connect (or reconnect) to the EC with the given subscriptions.

void TAO_ECG_UDP_Sender::push ( | const RtecEventComm::EventSet & events,
| CORBA::Environment & ACE_TRY_ENV = TAO_default_environment () ) throw (CORBA::SystemException)`[virtual]`

void TAO_ECG_UDP_Sender::send_fragment ( | const RtecUDPAdmin::UDP_Addr & udp_addr,
| CORBA::ULong request_id,
| CORBA::ULong request_size,
| CORBA::ULong fragment_size,
| CORBA::ULong fragment_offset,
| CORBA::ULong fragment_id,
| CORBA::ULong fragment_count,
| iovec iov[],
| int iovcnt,
| CORBA::Environment & env = TAO_default_environment () )`[private]`

| Send one fragment, the first entry in the iovec is used to send the header, the rest of the iovec array should contain pointers to the actual data.

void TAO_ECG_UDP_Sender::shutdown ( | CORBA::Environment & ACE_TRY_ENV = TAO_default_environment () )

| Disconnect and shutdown the sender, no further connections will work unless init() is called again.

## Member Data Documentation

RtecUDPAdmin::AddrServer_var TAO_ECG_UDP_Sender::addr_server_`[private]`

| We query this object to determine where are the events sent.

TAO_ECG_UDP_Out_Endpoint * TAO_ECG_UDP_Sender::endpoint_`[private]`

| The datagram used to sendto(), this object is *not* owned by the UDP_Sender.

RtecEventChannelAdmin::EventChannel_var TAO_ECG_UDP_Sender::lcl_ec_`[private]`

| The remote and the local EC, so we can reconnect when the subscription list changes.

CORBA::ULong TAO_ECG_UDP_Sender::mtu_`[private]`

| The MTU for this sender...

RtecEventChannelAdmin::ProxyPushSupplier_var TAO_ECG_UDP_Sender::supplier_proxy_`[private]`

| We talk to the EC (as a consumer) using this proxy.

The documentation for this class was generated from the following files:

- EC_Gateway_UDP.h
- EC_Gateway_UDP.cpp
- EC_Gateway_UDP.i