nidas  v1.2-1520
Public Member Functions | Protected Attributes | List of all members
nidas::util::DatagramPacket Class Reference

#include <DatagramPacket.h>

Inheritance diagram for nidas::util::DatagramPacket:
Inheritance graph
[legend]

Public Member Functions

 DatagramPacket (char *buf, int length)
 
 DatagramPacket (char *buf, int length, const Inet4Address &add, int port)
 Create a DatagramPacket for sending. More...
 
 DatagramPacket (char *buf, int length, const SocketAddress &add)
 
virtual void * getDataVoidPtr ()
 Get the pointer to the data portion of the packet. More...
 
virtual const void * getConstDataVoidPtr () const
 
char * getData ()
 
void setData (char *val)
 Set the pointer to the data portion of the packet. More...
 
SocketAddressgetSocketAddress () const
 
void setSocketAddress (const SocketAddress &val)
 
struct sockaddr * getSockAddrPtr ()
 
struct sockaddr * getConstSockAddrPtr () const
 
int getSockAddrLen () const
 
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

char * data
 
int maxlength
 allocated length in bytes of contents. More...
 
int length
 length of datagram that was read or will be sent. More...
 
SocketAddressaddr
 The destination address for a send, or the remote senders address after a receive. More...
 

Constructor & Destructor Documentation

nidas::util::DatagramPacket::DatagramPacket ( char *  buf,
int  length 
)
inline
nidas::util::DatagramPacket::DatagramPacket ( char *  buf,
int  length,
const Inet4Address add,
int  port 
)
inline

Create a DatagramPacket for sending.

Parameters
bufallocated space for contents. Pointer is owned by caller, not by the DatagramPacket - the DatagramPacket destructor does not delete it in its destructor.
lengthlength of allocated space. Inet4Address to send packet to. port number to send packet to.
nidas::util::DatagramPacket::DatagramPacket ( char *  buf,
int  length,
const SocketAddress add 
)
inline

Member Function Documentation

virtual const void* nidas::util::DatagramPacketT< char >::getConstDataVoidPtr ( ) const
inlinevirtualinherited
struct sockaddr* nidas::util::DatagramPacketBase::getConstSockAddrPtr ( ) const
inlineinherited
char * nidas::util::DatagramPacketT< char >::getData ( )
inlineinherited
virtual void* nidas::util::DatagramPacketT< char >::getDataVoidPtr ( )
inlinevirtualinherited

Get the pointer to the data portion of the packet.

Implements nidas::util::DatagramPacketBase.

References nidas::util::DatagramPacketT< DataT >::data.

virtual int nidas::util::DatagramPacketBase::getLength ( ) const
inlinevirtualinherited

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 nidas::util::DatagramPacketBase::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().

int nidas::util::DatagramPacketBase::getMaxLength ( ) const
inlineinherited

Return the allocated length in bytes of the data.

References nidas::util::DatagramPacketBase::maxlength.

Referenced by PacketReader::loop().

int nidas::util::DatagramPacketBase::getSockAddrLen ( ) const
inlineinherited
struct sockaddr* nidas::util::DatagramPacketBase::getSockAddrPtr ( )
inlineinherited
SocketAddress& nidas::util::DatagramPacketBase::getSocketAddress ( ) const
inlineinherited
void nidas::util::DatagramPacketT< char >::setData ( char *  val)
inlineinherited

Set the pointer to the data portion of the packet.

/param val Pointer to an allocated section of memory. This pointer is owned by the caller, it is not deleted by the DatagramPacket destructor.

References nidas::util::DatagramPacketT< DataT >::data.

virtual void nidas::util::DatagramPacketBase::setLength ( int  val)
inlinevirtualinherited

Set the value for the current number of bytes in data.

/param val Number of bytes, must be <= max length.

References nidas::util::DatagramPacketBase::length.

Referenced by PacketReader::checkPacket().

void nidas::util::DatagramPacketBase::setMaxLength ( int  val)
inlineinherited

Set the allocated length in bytes of the data.

/param val Number of bytes allocated in data.

References nidas::util::DatagramPacketBase::maxlength.

void nidas::util::DatagramPacketBase::setSocketAddress ( const SocketAddress val)
inlineinherited

Member Data Documentation

SocketAddress* nidas::util::DatagramPacketBase::addr
protectedinherited
char * nidas::util::DatagramPacketT< char >::data
protectedinherited
int nidas::util::DatagramPacketBase::length
protectedinherited

length of datagram that was read or will be sent.

Must be <= maxlength.

Referenced by nidas::util::DatagramPacketBase::getLength(), nidas::util::DatagramPacketBase::operator=(), and nidas::util::DatagramPacketBase::setLength().

int nidas::util::DatagramPacketBase::maxlength
protectedinherited

The documentation for this class was generated from the following file: