#include <conexus/ipv4_udpposet.h>
Inheritance diagram for Conexus::IPv4::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 boost::shared_ptr< UDPPoset > | pointer |
Class typedef to smart pointer. | |
Public Member Functions | |
UDPPoset (uint16_t localport=0) | |
Constructor. | |
virtual | ~UDPPoset () throw () |
Destructor. | |
virtual void | bind () throw ( bind_error ) |
Bypasses parent UDP methods and goes straight to grandparent IP methods. | |
virtual void | bind (Conexus::Address &a) throw ( bind_error ) |
Bypasses parent UDP methods and goes straight to grandparent IP methods. | |
virtual void | close () throw ( close_error ) |
Bypasses parent UDP methods and goes straight to grandparent IP methods. | |
virtual ssize_t | write (const void *data, size_t size) throw ( write_error ) |
Overloads the Socket ancestor send method to ensure that the socket is connected before trying to send. | |
virtual void | connect () throw ( connect_error ) |
UDPPoset cannot connect; always throws error::connect::no_udpposet_connect(). | |
virtual void | connect (Address &a) throw ( connect_error ) |
UDPPoset cannot connect; always throws error::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. | |
Protected Member Functions | |
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. | |
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. |
|
Add the destination with the given priority.
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 ); |
|
UDPPoset cannot connect; always throws error::connect::no_udpposet_connect().
Since UDPPoset relies on Reimplemented from Conexus::IPv4::UDP. |
|
UDPPoset cannot connect; always throws error::connect::no_udpposet_connect().
Since UDPPoset relies on Reimplemented from Conexus::IPv4::UDP. |