Conexus::IPv6::UDP Class Reference
[Classes 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 boost::shared_ptr<
UDP
pointer

Public Member Functions

 UDP (uint16_t localport=0, uint16_t remoteport=0)
virtual void bind () throw (bind_error)
virtual void bind (Conexus::Address &a) throw (bind_error)
virtual void close () throw (close_error)
int pending_input_datagram_size ()
 Returns the size in bytes of the next pending datagram, or 0 when no datagram is pending.
int pending_output_datagram_size ()
 Returns the size in bytes of the local send queue.
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 Data read (size_t s=-1) throw (read_error)
 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 connect () throw (connect_error)
virtual void connect (Address &a) throw (connect_error)
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.
bool write_without_connect () const
bool multicast_auto_join () const
void set_multicast_auto_join (bool value=true)
int multicast_hops ()
 Returns the multicast ttl of the currently associated interface.
void set_multicast_hops (int hops)
 Sets the multicast ttl of the currently associated interface to hops.
bool multicast_loop ()
 If true multicast packets are looped back to local sockets.
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 ()

Static Public Member Functions

static UDP::pointer create (uint16_t localport=0, uint16_t remoteport=0)

Protected Member Functions

void join ()
 Joins the multicast group specified by addr.
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)

Protected Attributes

bool m_write_without_connect
bool m_multicast_auto_join
ipv6_mreq * m_multicast_request


Member Function Documentation

void Conexus::IPv6::UDP::join  )  [protected]
 

Joins the multicast group specified by addr.

Parameters:
ifindex is the interface index of the interface that should join the multicast group, or 0 to indicate any interface.

void Conexus::IPv6::UDP::leave  )  [protected]
 

Leaves the multicast group specified by addr.

Parameters:
ifindex is the interface index of the interface that should leave the multicast group, or 0 to indicate any interface.

Data Conexus::IPv6::UDP::read size_t  s = -1  )  throw (read_error) [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.

void Conexus::IPv6::UDP::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.

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 error. 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 errors.

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


The documentation for this class was generated from the following files:
Generated on Sun Aug 6 12:17:15 2006 by  doxygen 1.4.6