#include <TurnMsgLib.h>
Public Member Functions | |
StunMsgChannel (u16bits cn, int length) | |
StunMsgChannel (u08bits *buffer, size_t total_sz, size_t sz, bool constructed) throw (WrongStunBufferFormatException) | |
virtual | ~StunMsgChannel () |
u16bits | getChannelNumber () const |
void | setChannelNumber (u16bits cn) |
size_t | getLength () const |
void | setLength (size_t len) |
Protected Member Functions | |
virtual void | constructBuffer () |
virtual bool | check () |
Channel message
Definition at line 1087 of file TurnMsgLib.h.
turn::StunMsgChannel::StunMsgChannel | ( | u16bits | cn, |
int | length | ||
) | [inline] |
Definition at line 1089 of file TurnMsgLib.h.
: _cn(cn), _len(length) {};
turn::StunMsgChannel::StunMsgChannel | ( | u08bits * | buffer, |
size_t | total_sz, | ||
size_t | sz, | ||
bool | constructed | ||
) | throw (WrongStunBufferFormatException) [inline] |
Definition at line 1090 of file TurnMsgLib.h.
: StunMsg(buffer,total_sz,sz,constructed),_cn(0) { if(constructed) { if(!stun_is_channel_message_str(buffer,sz,&_cn)) { throw WrongStunBufferFormatException(); } if(_sz>0xFFFF || _sz<4) throw WrongStunBufferFormatException(); _len = _sz-4; } else { if(total_sz>0xFFFF || total_sz<4) throw WrongStunBufferFormatException(); _len = 0; } }
virtual turn::StunMsgChannel::~StunMsgChannel | ( | ) | [inline, virtual] |
Definition at line 1109 of file TurnMsgLib.h.
{}
virtual bool turn::StunMsgChannel::check | ( | ) | [inline, protected, virtual] |
Implements turn::StunMsg.
Definition at line 1139 of file TurnMsgLib.h.
{ if(!_constructed) return false; u16bits cn = 0; if(!stun_is_channel_message_str(_buffer,_sz,&cn)) { return false; } if(_cn != cn) { return false; } return true; }
virtual void turn::StunMsgChannel::constructBuffer | ( | ) | [inline, protected, virtual] |
Implements turn::StunMsg.
Definition at line 1134 of file TurnMsgLib.h.
{ stun_init_channel_message_str(_cn,_buffer,&_sz,(int)_len); _constructed = true; }
u16bits turn::StunMsgChannel::getChannelNumber | ( | ) | const [inline] |
Definition at line 1111 of file TurnMsgLib.h.
{
return _cn;
}
size_t turn::StunMsgChannel::getLength | ( | ) | const [inline] |
Get length of message itself (excluding the 4 channel number bytes)
Definition at line 1122 of file TurnMsgLib.h.
{
return _len;
}
void turn::StunMsgChannel::setChannelNumber | ( | u16bits | cn | ) | [inline] |
Definition at line 1115 of file TurnMsgLib.h.
{ _cn = cn; }
void turn::StunMsgChannel::setLength | ( | size_t | len | ) | [inline] |
Set length of message itself (excluding the 4 channel number bytes)
Definition at line 1129 of file TurnMsgLib.h.
{ _len = len; }