RTP Audio System  2.0.0
SocketMessage< size > Class Template Reference

Socket Message. More...

#include <tdmessage.h>

List of all members.

Public Member Functions

 SocketMessage ()
void clear ()
SocketAddressgetAddress () const
void setAddress (const SocketAddress &address, const integer family=AF_UNSPEC)
void setBuffer (void *buffer, const size_t buffersize)
void * addHeader (const size_t payloadLength, const int level, const int type)
cmsghdr * getFirstHeader ()
cmsghdr * getNextHeader (cmsghdr *prev)
int getFlags () const
void setFlags (const int flags)

Public Attributes

msghdr Header
sockaddr_storage Address
struct iovec IOVector
char Control [CMSG_SPACE(size)]

Private Attributes

cmsghdr * NextMsg

Detailed Description

template<const size_t size>
class SocketMessage< size >

Socket Message.

This template class manages manages message structures used by sendmsg() and recvmsg(). The template parameter gives the size of the control data block.

Author:
Thomas Dreibholz
Version:
1.0

Constructor & Destructor Documentation

template<const size_t size>
SocketMessage< size >::SocketMessage ( ) [inline]

Constructor.


Member Function Documentation

template<const size_t size>
void* SocketMessage< size >::addHeader ( const size_t  payloadLength,
const int  level,
const int  type 
) [inline]

Add control header of given cmsg level and type. Returns NULL, if there is not enough free space in the control data block. The new control header is cleared (i.e. all bytes set to 0).

Parameters:
payloadSize of payload.
levelLevel (e.g. IPPROTO_SCTP).
typeType (e.g. SCTP_INIT).
Returns:
Pointer to begin of *payload* area.
template<const size_t size>
void SocketMessage< size >::clear ( ) [inline]

Clear structure.

template<const size_t size>
SocketAddress* SocketMessage< size >::getAddress ( ) const [inline]

Get address as SocketAddress object. Note: This address has to be freed using delete operator!

Returns:
SocketAddress object.
template<const size_t size>
cmsghdr* SocketMessage< size >::getFirstHeader ( ) [inline]

Get first cmsg header in control block.

Returns:
First cmsg header or NULL, if there are none.
template<const size_t size>
int SocketMessage< size >::getFlags ( ) const [inline]

Get flags.

Returns:
Flags.
template<const size_t size>
cmsghdr* SocketMessage< size >::getNextHeader ( cmsghdr *  prev) [inline]

Get next cmsg header in control block.

Parameters:
prevPrevious cmsg header.
Returns:
Next cmsg header or NULL, if there are no more.
template<const size_t size>
void SocketMessage< size >::setAddress ( const SocketAddress address,
const integer  family = AF_UNSPEC 
) [inline]

Set address.

Parameters:
addressSocketAddress object.
typeAddress type (AF_UNSPEC to take default from address).
template<const size_t size>
void SocketMessage< size >::setBuffer ( void *  buffer,
const size_t  buffersize 
) [inline]

Set buffer.

Parameters:
bufferBuffer.
bufferSizeSize of buffer.
template<const size_t size>
void SocketMessage< size >::setFlags ( const int  flags) [inline]

Set flags.

Parameters:
flagsFlags.

Member Data Documentation

template<const size_t size>
sockaddr_storage SocketMessage< size >::Address

Storage for address.

template<const size_t size>
char SocketMessage< size >::Control[CMSG_SPACE(size)]

Control data block, its size is given by the template parameter.

template<const size_t size>
msghdr SocketMessage< size >::Header

msghdr structure.

template<const size_t size>
struct iovec SocketMessage< size >::IOVector

iovec structure.

template<const size_t size>
cmsghdr* SocketMessage< size >::NextMsg [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines