conexus logo

Conexus::IPv6::UDPPoset Class Reference
[IPv6 EndpointsConexus I/O Endpoints]

This class aggregates a single data transmission to multiple UDP addresses. More...

#include <ipv6_udpposet.h>

Inheritance diagram for Conexus::IPv6::UDPPoset:

Inheritance graph
[legend]

List of all members.

Public Types

typedef std::multimap< int,
Address > 
Destinations
 TODO Revisit and see if possible to add multicast support.
typedef ConexusPointer< UDPPosetpointer
 Class typedef to smart pointer.

Public Member Functions

 CONEXUS_ENDPOINT_GENERIC_CREATE ()
virtual ~UDPPoset () throw ()
 Destructor.
virtual void bind () throw ( bind_exception )
 Bypasses parent UDP methods and goes straight to grandparent IP methods.
virtual void bind (const Conexus::Address &a) throw ( bind_exception )
 Bypasses parent UDP methods and goes straight to grandparent IP methods.
virtual void close () throw ( close_exception )
 Bypasses parent UDP methods and goes straight to grandparent IP methods.
virtual void connect () throw ( connect_exception )
 UDPPoset cannot connect; always throws exception::connect::no_udpposet_connect().
virtual void connect (const Address &a) throw ( connect_exception )
 UDPPoset cannot connect; always throws exception::connect::no_udpposet_connect().
virtual void set_write_without_connect (bool value=true)
 Has no effect, write without connect must always be true.
bool add_destination (const Address &destination, int priority=0, bool singleton=true)
 Add the destination with the given priority.
bool add_destination (uint32_t host, uint16_t port, int priority=0, bool singleton=true)
bool add_destination (const struct in6_addr &host, uint16_t port, int priority=0, bool singleton=true)
bool add_destination (const std::string &host, uint16_t port, int priority=0, bool singleton=true)
void remove_destination (const Address &destination, int priority)
 Removes all instances of a destination for a specific priority level.
void remove_destination (const Address &destination)
 Removes all instances of a destination for all priority levels.
bool is_destination (const Address &destination)
 True if the address is a destination at any priority level.
bool is_destination (const Address &destination, int priority)
 True if the address is a destination at the specified priority level.
std::set< int > priorities (const Address &destination)
 Returns a set of the priority levels this destination is associated with or a vector of size zero if not present as a destination.
const Destinationsdestinations ()
 Returns a constant reference to the map used to store destinations.
sigc::signal< void, Address, int > signal_destination_added ()
 Signal emitted when a destination is added.
sigc::signal< void, Address, int > signal_destination_removed ()
 Signal emitted when a destination is removed.

Static Public Member Functions

static UDPPoset::pointer create (uint16_t localport=0)
 Returns a smart pointer to a new object.
static UDPPoset::pointer create (const struct in6_addr &local_if, uint16_t localport=0)
 Returns a smart pointer to a new object.
static UDPPoset::pointer create (const std::string &local_if, uint16_t localport=0)
 Returns a smart pointer to a new object.

Protected Member Functions

 UDPPoset (const struct in6_addr &local_if, uint16_t localport=0)
 Constructor.
 UDPPoset (const std::string &local_if, uint16_t localport=0)
 Constructor.
virtual void on_local_address_changed ()
 Do nothing when parent callback occurs.
virtual void on_remote_address_changed ()
 Do nothing when parent callback occurs.
virtual size_t write_data (const Data data, Timeout timeout) throw (write_exception)
 Overloads the Socket ancestor send method to ensure that the socket is connected before trying to send.

Protected Attributes

Destinations m_addresses
 Destination addresses.
sigc::signal< void, Address, int > m_signal_destination_added
 Signal emitted when a destination is added.
sigc::signal< void, Address, int > m_signal_destination_removed
 Signal emitted when a destination is removed.


Detailed Description

This class aggregates a single data transmission to multiple UDP addresses.

Although multicasting is generally a better solution, sometimes multicasting is not possible with certain frameworks; hence UDPPoset.

The advantage of UDPPoset over a vector of UDP sockets is that each instantiation of a UDP socket will use a local port. In contrast, the UDPPoset class will use a single port for all outgoing UDP traffic. Like the UDP class it inherits from, it is capable of receiving transmissions, but only for the single local port.

UDPPoset will only accept UDP unicast addresses; not multicast; not broadcast.

The name poset, or partially ordered set, was used since UDP destinations of equal priority have no guarantees on ordering. Priority is a numeric value, and transmissions will occur from the highest priority first to the lowest priority last.

Author:
Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>

Member Typedef Documentation

typedef std::multimap<int,Address> Conexus::IPv6::UDPPoset::Destinations

TODO Revisit and see if possible to add multicast support.

TODO examine adding socket pools Class typedef to destinations container

typedef ConexusPointer<UDPPoset> Conexus::IPv6::UDPPoset::pointer

Class typedef to smart pointer.

Reimplemented from Conexus::IPv6::UDP.

Examples:
ipv6_udpposet_client.cpp.


Constructor & Destructor Documentation

Conexus::IPv6::UDPPoset::UDPPoset ( const struct in6_addr &  local_if,
uint16_t  localport = 0 
) [protected]

Constructor.

References Conexus::IPv6::UDP::m_write_without_connect.

Referenced by create().

Conexus::IPv6::UDPPoset::UDPPoset ( const std::string &  local_if,
uint16_t  localport = 0 
) [protected]

Conexus::IPv6::UDPPoset::~UDPPoset (  )  throw () [virtual]

Destructor.


Member Function Documentation

bool Conexus::IPv6::UDPPoset::add_destination ( const std::string &  host,
uint16_t  port,
int  priority = 0,
bool  singleton = true 
)

References add_destination().

bool Conexus::IPv6::UDPPoset::add_destination ( const struct in6_addr &  host,
uint16_t  port,
int  priority = 0,
bool  singleton = true 
)

References add_destination().

bool Conexus::IPv6::UDPPoset::add_destination ( uint32_t  host,
uint16_t  port,
int  priority = 0,
bool  singleton = true 
)

References add_destination().

bool Conexus::IPv6::UDPPoset::add_destination ( const Address &  destination,
int  priority = 0,
bool  singleton = true 
)

Add the destination with the given priority.

Parameters:
destination The destination address to add to the poset
priority The priority level to add this destination to
singleton If true, this will be the only priority level the destination will occur at, and there will only be a single occurrence at this priority level.
The underlying model is a multimap from priority to destination. Unless the singleton parameter is used duplicate destinations will be allowed for the same priority level as well as multiple priority levels.

What this means is that multiple transmissions will occur to the same destination. However, the use of the singleton parameter, which defaults to true, will ensure the uniqueness of a destination in the transmission set.

Examples:

 UDPPoset my_udpposet;
 my_udpposet.add_destination( address1, 5 );
 my_udpposet.add_destination( address1, 3 );
Result: one transmission to address1 at priority level 3

 UDPPoset my_udpposet;
 my_udpposet.add_destination( address1, 5, false );
 my_udpposet.add_destination( address1, 3, false );
Result: two transmissions to address1 at priority levels 5 and 3

 UDPPoset my_udpposet;
 my_udpposet.add_destination( address1, 5, false );
 my_udpposet.add_destination( address1, 5, false );
Result: two transmissions to address1 at priority level 5

 UDPPoset my_udpposet;
 my_udpposet.add_destination( address1, 5, false );
 my_udpposet.add_destination( address1, 3, false );
 my_udpposet.add_destination( address1, 1 );
Result: one transmission to address1 at priority level 1

 UDPPoset my_udpposet;
 my_udpposet.add_destination( address1, 5, false );
 my_udpposet.add_destination( address1, 3, false );
 my_udpposet.add_destination( address1, 1 );
 my_udpposet.add_destination( address1, 0, false );
Result: two transmissions to address1 at priority levels 1 and 0

References m_addresses, m_signal_destination_added, and remove_destination().

Referenced by add_destination().

void Conexus::IPv6::UDPPoset::bind ( const Conexus::Address a  )  throw ( bind_exception ) [virtual]

Bypasses parent UDP methods and goes straight to grandparent IP methods.

Reimplemented from Conexus::IPv6::UDP.

References Conexus::IPv6::IP::bind().

void Conexus::IPv6::UDPPoset::bind (  )  throw ( bind_exception ) [virtual]

Bypasses parent UDP methods and goes straight to grandparent IP methods.

Reimplemented from Conexus::IPv6::UDP.

void Conexus::IPv6::UDPPoset::close (  )  throw ( close_exception ) [virtual]

Bypasses parent UDP methods and goes straight to grandparent IP methods.

Reimplemented from Conexus::IPv6::UDP.

Conexus::IPv6::UDPPoset::CONEXUS_ENDPOINT_GENERIC_CREATE (  ) 

Reimplemented from Conexus::IPv6::UDP.

void Conexus::IPv6::UDPPoset::connect ( const Address &  a  )  throw ( connect_exception ) [virtual]

UDPPoset cannot connect; always throws exception::connect::no_udpposet_connect().

Since UDPPoset relies on sendto() to perform transmission, it cannot connect since sendto() ignores the to parameter when connected.

Reimplemented from Conexus::IPv6::UDP.

void Conexus::IPv6::UDPPoset::connect (  )  throw ( connect_exception ) [virtual]

UDPPoset cannot connect; always throws exception::connect::no_udpposet_connect().

Since UDPPoset relies on sendto() to perform transmission, it cannot connect since sendto() ignores the to parameter when connected.

Reimplemented from Conexus::IPv6::UDP.

UDPPoset::pointer Conexus::IPv6::UDPPoset::create ( const std::string &  local_if,
uint16_t  localport = 0 
) [static]

Returns a smart pointer to a new object.

References UDPPoset().

UDPPoset::pointer Conexus::IPv6::UDPPoset::create ( const struct in6_addr &  local_if,
uint16_t  localport = 0 
) [static]

Returns a smart pointer to a new object.

References UDPPoset().

UDPPoset::pointer Conexus::IPv6::UDPPoset::create ( uint16_t  localport = 0  )  [static]

Returns a smart pointer to a new object.

Examples:
ipv6_udpposet_client.cpp.

References UDPPoset().

const UDPPoset::Destinations & Conexus::IPv6::UDPPoset::destinations (  ) 

Returns a constant reference to the map used to store destinations.

References m_addresses.

bool Conexus::IPv6::UDPPoset::is_destination ( const Address &  destination,
int  priority 
)

True if the address is a destination at the specified priority level.

References m_addresses.

bool Conexus::IPv6::UDPPoset::is_destination ( const Address &  destination  ) 

True if the address is a destination at any priority level.

References m_addresses.

void Conexus::IPv6::UDPPoset::on_local_address_changed (  )  [protected, virtual]

Do nothing when parent callback occurs.

Reimplemented from Conexus::IPv6::UDP.

References Conexus::Endpoint::close_and_reopen(), and Conexus::Socket::is_bound().

void Conexus::IPv6::UDPPoset::on_remote_address_changed (  )  [protected, virtual]

Do nothing when parent callback occurs.

Reimplemented from Conexus::IPv6::UDP.

std::set< int > Conexus::IPv6::UDPPoset::priorities ( const Address &  destination  ) 

Returns a set of the priority levels this destination is associated with or a vector of size zero if not present as a destination.

References m_addresses.

void Conexus::IPv6::UDPPoset::remove_destination ( const Address &  destination  ) 

Removes all instances of a destination for all priority levels.

References m_addresses, and m_signal_destination_removed.

void Conexus::IPv6::UDPPoset::remove_destination ( const Address &  destination,
int  priority 
)

Removes all instances of a destination for a specific priority level.

References m_addresses, and m_signal_destination_removed.

Referenced by add_destination().

void Conexus::IPv6::UDPPoset::set_write_without_connect ( bool  value = true  )  [virtual]

Has no effect, write without connect must always be true.

Reimplemented from Conexus::IPv6::UDP.

sigc::signal< void, Address, int > Conexus::IPv6::UDPPoset::signal_destination_added (  ) 

Signal emitted when a destination is added.

References m_signal_destination_added.

sigc::signal< void, Address, int > Conexus::IPv6::UDPPoset::signal_destination_removed (  ) 

Signal emitted when a destination is removed.

References m_signal_destination_removed.

size_t Conexus::IPv6::UDPPoset::write_data ( const Data  data,
Timeout  timeout 
) throw (write_exception) [protected, virtual]

Overloads the Socket ancestor send method to ensure that the socket is connected before trying to send.

Reimplemented from Conexus::IPv6::UDP.

References Conexus::ENDPOINT_OPENED, and Conexus::Socket::writeto().


Member Data Documentation

sigc::signal<void,Address,int> Conexus::IPv6::UDPPoset::m_signal_destination_added [protected]

Signal emitted when a destination is added.

Referenced by add_destination(), and signal_destination_added().

sigc::signal<void,Address,int> Conexus::IPv6::UDPPoset::m_signal_destination_removed [protected]

Signal emitted when a destination is removed.

Referenced by remove_destination(), and signal_destination_removed().


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

Generated on Wed Jul 8 15:51:28 2009 for conexus by doxygen 1.5.8