RTP Audio System
2.0.0
|
#include <tdmessage.h>
Public Member Functions | |
SocketMessage () | |
void | clear () |
SocketAddress * | getAddress () 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 |
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.
SocketMessage< size >::SocketMessage | ( | ) | [inline] |
Constructor.
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).
payload | Size of payload. |
level | Level (e.g. IPPROTO_SCTP). |
type | Type (e.g. SCTP_INIT). |
void SocketMessage< size >::clear | ( | ) | [inline] |
Clear structure.
SocketAddress* SocketMessage< size >::getAddress | ( | ) | const [inline] |
Get address as SocketAddress object. Note: This address has to be freed using delete operator!
cmsghdr* SocketMessage< size >::getFirstHeader | ( | ) | [inline] |
Get first cmsg header in control block.
int SocketMessage< size >::getFlags | ( | ) | const [inline] |
Get flags.
cmsghdr* SocketMessage< size >::getNextHeader | ( | cmsghdr * | prev | ) | [inline] |
Get next cmsg header in control block.
prev | Previous cmsg header. |
void SocketMessage< size >::setAddress | ( | const SocketAddress & | address, |
const integer | family = AF_UNSPEC |
||
) | [inline] |
Set address.
address | SocketAddress object. |
type | Address type (AF_UNSPEC to take default from address). |
void SocketMessage< size >::setBuffer | ( | void * | buffer, |
const size_t | buffersize | ||
) | [inline] |
Set buffer.
buffer | Buffer. |
bufferSize | Size of buffer. |
void SocketMessage< size >::setFlags | ( | const int | flags | ) | [inline] |
Set flags.
flags | Flags. |
sockaddr_storage SocketMessage< size >::Address |
Storage for address.
char SocketMessage< size >::Control[CMSG_SPACE(size)] |
Control data block, its size is given by the template parameter.
msghdr SocketMessage< size >::Header |
msghdr structure.
struct iovec SocketMessage< size >::IOVector |
iovec structure.
cmsghdr* SocketMessage< size >::NextMsg [private] |