#include <conexus/ipv6_udpposet.h>
Inheritance diagram for Conexus::IPv6::UDPPoset:
Although multicasting is a better solution, sometimes multicasting is not possible with certain architectures; 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.
Public Types | |
typedef std::multimap< int, Address > | Destinations |
Class typedef to destinations container. | |
typedef ConexusPointer< UDPPoset > | pointer |
Class typedef to smart pointer. | |
typedef std::multimap< int, Address > | Destinations |
Class typedef to destinations container. | |
typedef ConexusPointer< UDPPoset > | pointer |
Class typedef to smart pointer. | |
typedef std::multimap< int, Address > | Destinations |
Class typedef to destinations container. | |
typedef ConexusPointer< UDPPoset > | pointer |
Class typedef to smart pointer. | |
Public Member Functions | |
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 Destinations & | destinations () |
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. | |
UDPPoset (uint16_t localport=0) | |
Constructor. | |
virtual | ~UDPPoset () throw () |
Destructor. | |
virtual void | bind () throw ( bind_exception ) |
Bypasses parent UDP methods and goes straight to grandparent IP methods. | |
virtual void | bind (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 (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. | |
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 Destinations & | destinations () |
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. | |
virtual const std::string & | object_type () |
String identifier of class. | |
UDPPoset (uint16_t localport=0) | |
Constructor. | |
virtual | ~UDPPoset () throw () |
Destructor. | |
virtual void | bind () throw ( bind_exception ) |
Bypasses parent UDP methods and goes straight to grandparent IP methods. | |
virtual void | bind (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 (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. | |
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 Destinations & | destinations () |
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. | |
virtual const std::string & | object_type () |
String identifier of class. | |
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. | |
static UDPPoset::pointer | create (uint16_t localport=0) |
Returns a smart pointer to a new object. | |
static UDPPoset::pointer | create (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 ssize_t | write_data (long int timeout, const Data data) throw (write_exception) |
Overloads the Socket ancestor send method to ensure that the socket is connected before trying to send. | |
virtual void | on_local_interface_changed (unsigned which) |
Do nothing when parent callback occurs. | |
virtual void | on_remote_address_changed (unsigned which) |
Do nothing when parent callback occurs. | |
virtual ssize_t | write_data (long int timeout, Data::const_pointer data) throw (write_exception) |
Overloads the Socket ancestor send method to ensure that the socket is connected before trying to send. | |
virtual void | on_local_interface_changed (unsigned which) |
Do nothing when parent callback occurs. | |
virtual void | on_remote_address_changed (unsigned which) |
Do nothing when parent callback occurs. | |
virtual ssize_t | write_data (long int timeout, Data::const_pointer data) 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. | |
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. | |
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. |
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.
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.
bool Conexus::IPv6::UDPPoset::add_destination | ( | const Address & | destination, | |
int | priority = 0 , |
|||
bool | singleton = true | |||
) |
Add the destination with the given priority.
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. |
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 );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 3, false );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 5, false );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 3, false ); my_udpposet.add_destination( address1, 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 );
virtual 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.
virtual void Conexus::IPv6::UDPPoset::connect | ( | 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.
bool Conexus::IPv6::UDPPoset::add_destination | ( | const Address & | destination, | |
int | priority = 0 , |
|||
bool | singleton = true | |||
) |
Add the destination with the given priority.
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. |
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 );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 3, false );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 5, false );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 3, false ); my_udpposet.add_destination( address1, 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 );
virtual 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.
virtual void Conexus::IPv6::UDPPoset::connect | ( | 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.
bool Conexus::IPv6::UDPPoset::add_destination | ( | const Address & | destination, | |
int | priority = 0 , |
|||
bool | singleton = true | |||
) |
Add the destination with the given priority.
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. |
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 );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 3, false );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 5, false );
UDPPoset my_udpposet; my_udpposet.add_destination( address1, 5, false ); my_udpposet.add_destination( address1, 3, false ); my_udpposet.add_destination( address1, 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 );