Conexus::IPv6::UDP Class Reference
[Classes for communicating via IP version 6 socketsClasses for communicating via IP version 6 socketsClasses for communicating via IP version 6 sockets]

#include <conexus/ipv6_udp.h>

Inheritance diagram for Conexus::IPv6::UDP:

Inheritance graph
[legend]
List of all members.

Detailed Description

This class encapsulates a socket used for UDP/IP communications.

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


Public Types

typedef ConexusPointer< UDPpointer
typedef ConexusPointer< UDPpointer
typedef ConexusPointer< UDPpointer

Public Member Functions

virtual ssize_t input_available ()
virtual void bind () throw ( bind_exception )
virtual void bind (const Conexus::Address &a) throw ( bind_exception )
virtual void close () throw ( close_exception )
virtual int output_pending ()
 Returns the size in bytes of the local send queue.
virtual void connect () throw ( connect_exception )
virtual void connect (const Address &a) throw ( connect_exception )
virtual void set_write_without_connect (bool value=true)
 There are some circumstances in which it may be desirable to set a default address and have the send method transparently call the sendto method without connecting rather than connecting and calling the send method.
virtual bool write_without_connect () const
void add_multicast_interface (unsigned iface_index)
void add_multicast_interface (const std::string &iface_name)
void remove_multicast_interface (unsigned iface_index)
void remove_multicast_interface (const std::string &iface_name)
bool is_multicast_interface (unsigned iface_index)
bool is_multicast_interface (const std::string &iface_name)
virtual bool suppress_multicast_join () const
virtual void set_suppress_multicast_join (bool value=true)
virtual int multicast_hops ()
 Returns the multicast ttl of the currently associated address.
virtual void set_multicast_hops (int hops)
 Sets the multicast ttl of the currently associated address to hops.
virtual bool multicast_loopback ()
 If true multicast packets are looped back to local sockets.
virtual void set_multicast_loopback (bool loop)
 If parameter loop is true then multicast packets are looped back to local sockets.
 UDP (uint16_t localport=0, uint16_t remoteport=0)
virtual ssize_t input_available ()
virtual void bind () throw ( bind_exception )
virtual void bind (Conexus::Address &a) throw ( bind_exception )
virtual void close () throw ( close_exception )
virtual int output_pending ()
 Returns the size in bytes of the local send queue.
virtual void connect () throw ( connect_exception )
virtual void connect (Address &a) throw ( connect_exception )
virtual void set_write_without_connect (bool value=true)
 There are some circumstances in which it may be desirable to set a default address and have the send method transparently call the sendto method without connecting rather than connecting and calling the send method.
virtual bool write_without_connect () const
virtual bool multicast_auto_join () const
virtual void set_multicast_auto_join (bool value=true)
virtual int multicast_hops ()
 Returns the multicast ttl of the currently associated interface.
virtual void set_multicast_hops (int hops)
 Sets the multicast ttl of the currently associated interface to hops.
virtual bool multicast_loop ()
 If true multicast packets are looped back to local sockets.
virtual void set_multicast_loop (bool loop)
 If parameter loop is true then multicast packets are looped back to local sockets.
virtual const std::string & object_type ()
 All data output on this socket is accumulated into a single datagram that is transmitted when the socket is uncorked.
 UDP (uint16_t localport=0, uint16_t remoteport=0)
virtual ssize_t input_available ()
virtual void bind () throw ( bind_exception )
virtual void bind (Conexus::Address &a) throw ( bind_exception )
virtual void close () throw ( close_exception )
virtual int output_pending ()
 Returns the size in bytes of the local send queue.
virtual void connect () throw ( connect_exception )
virtual void connect (Address &a) throw ( connect_exception )
virtual void set_write_without_connect (bool value=true)
 There are some circumstances in which it may be desirable to set a default address and have the send method transparently call the sendto method without connecting rather than connecting and calling the send method.
virtual bool write_without_connect () const
virtual bool multicast_auto_join () const
virtual void set_multicast_auto_join (bool value=true)
virtual int multicast_hops ()
 Returns the multicast ttl of the currently associated interface.
virtual void set_multicast_hops (int hops)
 Sets the multicast ttl of the currently associated interface to hops.
virtual bool multicast_loop ()
 If true multicast packets are looped back to local sockets.
virtual void set_multicast_loop (bool loop)
 If parameter loop is true then multicast packets are looped back to local sockets.
virtual const std::string & object_type ()
 All data output on this socket is accumulated into a single datagram that is transmitted when the socket is uncorked.

Static Public Member Functions

static pointer create (uint16_t localport=0, uint16_t remoteport=0)
static pointer create (const struct in6_addr &local_if, uint16_t localport=0, uint16_t remoteport=0)
static pointer create (const std::string &local_if, uint16_t localport=0, uint16_t remoteport=0)
static unsigned int default_multicast_hops ()
static void set_default_multicast_hops (unsigned int hops)
static bool default_multicast_loopback ()
static void set_default_multicast_loopback (bool loopback)
static UDP::pointer create (uint16_t localport=0, uint16_t remoteport=0)
static UDP::pointer create (uint16_t localport=0, uint16_t remoteport=0)

Protected Member Functions

 UDP (const struct in6_addr &local_if, uint16_t localport, uint16_t remoteport)
 UDP (const std::string &local_if, uint16_t localport, uint16_t remoteport)
virtual void on_local_address_changed ()
virtual void on_remote_address_changed ()
virtual void join ()
 Issues a join on all multicast interfaces.
virtual void join (unsigned interface)
 Issues a join on the local address for the specified interface.
virtual void leave ()
 Issues a leave on all multicast interfaces.
virtual void leave (unsigned interface)
 Issues a leave on the local address for the specified interface.
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 join ()
 Joins the multicast group specified by addr.
virtual void leave ()
 Leaves the multicast group specified by addr.
virtual void on_local_interface_changed (unsigned which)
virtual void on_remote_address_changed (unsigned which)
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 Data::pointer read_data (long int timeout, size_t s=0) throw (read_exception)
 Receives a single datagram from the UDP socket up to s bytes in size; allocates any memory necessary as a smart pointer contained in the returned Data object.
virtual void join ()
 Joins the multicast group specified by addr.
virtual void leave ()
 Leaves the multicast group specified by addr.
virtual void on_local_interface_changed (unsigned which)
virtual void on_remote_address_changed (unsigned which)
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 Data::pointer read_data (long int timeout, size_t s=0) throw (read_exception)
 Receives a single datagram from the UDP socket up to s bytes in size; allocates any memory necessary as a smart pointer contained in the returned Data object.

Protected Attributes

bool m_write_without_connect
bool m_suppress_multicast_join
std::set< unsigned > m_multicast_interfaces
bool m_multicast_auto_join
ipv6_mreq * m_multicast_request
ipv6_mreq * m_multicast_request

Static Protected Attributes

static unsigned int m_default_hops
 All data output on this socket is accumulated into a single datagram that is transmitted when the socket is uncorked.
static bool m_default_loopback


Member Function Documentation

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

There are some circumstances in which it may be desirable to set a default address and have the send method transparently call the sendto method without connecting rather than connecting and calling the send method.

A specific example of this is when the remote address/port may occassionally be unavailable. In this case the destination may generate an ICMP UNREACHABLE message, and in accordance with RFC 1122 the local machine will fail any future sends on a connected port, throwing a write::connection_refused exception. If you want to ensure that the datagram is sent contrary to RFC 1122 you could set the default address, set send without connect and call send without throwing connection exceptions.

But, since this is contrary to RFC 1122 behavior you should really think about your design before setting this.

Reimplemented in Conexus::IPv6::UDPPoset, Conexus::IPv6::UDPPoset, and Conexus::IPv6::UDPPoset.

void Conexus::IPv6::UDP::join (  )  [protected, virtual]

Issues a join on all multicast interfaces.

If no interfaces have been specified, then the join is issued on the system default.

void Conexus::IPv6::UDP::leave (  )  [protected, virtual]

Issues a leave on all multicast interfaces.

If no interfaces have been specified, then the leave is issued on the system default.

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

There are some circumstances in which it may be desirable to set a default address and have the send method transparently call the sendto method without connecting rather than connecting and calling the send method.

A specific example of this is when the remote address/port may occassionally be unavailable. In this case the destination may generate an ICMP UNREACHABLE message, and in accordance with RFC 1122 the local machine will fail any future sends on a connected port, throwing a write::connection_refused exception. If you want to ensure that the datagram is sent contrary to RFC 1122 you could set the default address, set send without connect and call send without throwing connection exceptions.

But, since this is contrary to RFC 1122 behavior you should really think about your design before setting this.

Reimplemented in Conexus::IPv6::UDPPoset, Conexus::IPv6::UDPPoset, and Conexus::IPv6::UDPPoset.

virtual Data::pointer Conexus::IPv6::UDP::read_data ( long int  timeout,
size_t  s = 0 
) throw (read_exception) [protected, virtual]

Receives a single datagram from the UDP socket up to s bytes in size; allocates any memory necessary as a smart pointer contained in the returned Data object.

If s = 0 then receives the next pending datagram, however large it may be.

Reimplemented from Conexus::Socket.

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

There are some circumstances in which it may be desirable to set a default address and have the send method transparently call the sendto method without connecting rather than connecting and calling the send method.

A specific example of this is when the remote address/port may occassionally be unavailable. In this case the destination may generate an ICMP UNREACHABLE message, and in accordance with RFC 1122 the local machine will fail any future sends on a connected port, throwing a write::connection_refused exception. If you want to ensure that the datagram is sent contrary to RFC 1122 you could set the default address, set send without connect and call send without throwing connection exceptions.

But, since this is contrary to RFC 1122 behavior you should really think about your design before setting this.

Reimplemented in Conexus::IPv6::UDPPoset, Conexus::IPv6::UDPPoset, and Conexus::IPv6::UDPPoset.

virtual Data::pointer Conexus::IPv6::UDP::read_data ( long int  timeout,
size_t  s = 0 
) throw (read_exception) [protected, virtual]

Receives a single datagram from the UDP socket up to s bytes in size; allocates any memory necessary as a smart pointer contained in the returned Data object.

If s = 0 then receives the next pending datagram, however large it may be.

Reimplemented from Conexus::Socket.


The documentation for this class was generated from the following files:
Generated on Tue Mar 13 19:55:13 2007 by  doxygen 1.5.1