nidas
v1.2-1520
|
Abstract base class for a UDP datagram. More...
#include <DatagramPacket.h>
Public Member Functions | |
DatagramPacketBase (int l) | |
Create a DatagramPacketBase for receiving. More... | |
DatagramPacketBase (int l, const Inet4Address &add, int port) | |
Create a DatagramPacketBase for sending. More... | |
DatagramPacketBase (int l, const SocketAddress &add) | |
DatagramPacketBase (const DatagramPacketBase &x) | |
Copy constructor. More... | |
DatagramPacketBase & | operator= (const DatagramPacketBase &rhs) |
Assignment operator. More... | |
virtual | ~DatagramPacketBase () |
Virtual destructor. More... | |
SocketAddress & | getSocketAddress () const |
void | setSocketAddress (const SocketAddress &val) |
struct sockaddr * | getSockAddrPtr () |
struct sockaddr * | getConstSockAddrPtr () const |
int | getSockAddrLen () const |
virtual void * | getDataVoidPtr ()=0 |
Get the pointer to the data portion of the packet. More... | |
virtual const void * | getConstDataVoidPtr () const =0 |
virtual void | setLength (int val) |
Set the value for the current number of bytes in data. More... | |
virtual int | getLength () const |
Get the value for the current number of bytes in data. More... | |
void | setMaxLength (int val) |
Set the allocated length in bytes of the data. More... | |
int | getMaxLength () const |
Return the allocated length in bytes of the data. More... | |
Protected Attributes | |
int | maxlength |
allocated length in bytes of contents. More... | |
int | length |
length of datagram that was read or will be sent. More... | |
SocketAddress * | addr |
The destination address for a send, or the remote senders address after a receive. More... | |
Abstract base class for a UDP datagram.
Patterned after java.net.DatagramPacket.
|
inline |
Create a DatagramPacketBase for receiving.
buf | allocated space for contents. Pointer is owned by caller, not by the DatagramPacketBase - the DatagramPacketBase destructor does not delete it in its destructor. |
length | length of allocated space. |
|
inline |
Create a DatagramPacketBase for sending.
buf | allocated space for contents. Pointer is owned by caller, not by the DatagramPacketBase - the DatagramPacketBase destructor does not delete it in its destructor. |
length | length of allocated space. Inet4Address to send packet to. port number to send packet to. |
|
inline |
|
inline |
Copy constructor.
|
inlinevirtual |
Virtual destructor.
References addr.
|
pure virtual |
|
inline |
References addr, and nidas::util::SocketAddress::getConstSockAddrPtr().
|
pure virtual |
Get the pointer to the data portion of the packet.
Implemented in nidas::util::DatagramPacketT< DataT >, nidas::util::DatagramPacketT< McSocketData >, and nidas::util::DatagramPacketT< char >.
|
inlinevirtual |
Get the value for the current number of bytes in data.
Either the number of bytes read in a received packet, or the number of bytes to send().
References length.
Referenced by PacketReader::checkPacket(), PacketReader::logBadPacket(), PacketReader::loop(), nidas::core::DerivedDataReader::run(), WriterThread::run(), nidas::util::McSocketListener::run(), and nidas::util::McSocketMulticaster< SocketTT >::run().
|
inline |
Return the allocated length in bytes of the data.
References maxlength.
Referenced by PacketReader::loop().
|
inline |
References addr, and nidas::util::SocketAddress::getSockAddrLen().
|
inline |
References addr, and nidas::util::SocketAddress::getSockAddrPtr().
|
inline |
References addr.
Referenced by PacketReader::logBadPacket(), PacketReader::loop(), nidas::util::McSocketListener::run(), and nidas::util::McSocketMulticaster< SocketTT >::run().
|
inline |
Assignment operator.
References addr, nidas::util::SocketAddress::clone(), length, and maxlength.
|
inlinevirtual |
Set the value for the current number of bytes in data.
/param val Number of bytes, must be <= max length.
References length.
Referenced by PacketReader::checkPacket().
|
inline |
Set the allocated length in bytes of the data.
/param val Number of bytes allocated in data.
References maxlength.
|
inline |
References addr, and nidas::util::SocketAddress::clone().
Referenced by nidas::util::McSocketMulticaster< SocketTT >::run().
|
protected |
The destination address for a send, or the remote senders address after a receive.
Referenced by getConstSockAddrPtr(), getSockAddrLen(), getSockAddrPtr(), getSocketAddress(), operator=(), setSocketAddress(), and ~DatagramPacketBase().
|
protected |
length of datagram that was read or will be sent.
Must be <= maxlength.
Referenced by getLength(), operator=(), and setLength().
|
protected |
allocated length in bytes of contents.
Referenced by getMaxLength(), operator=(), and setMaxLength().