#include <TurnMsgLib.h>
Public Member Functions | |
| StunAttrIterator (u08bits *buf, size_t sz) throw (WrongStunBufferFormatException) | |
| template<class T > | |
| StunAttrIterator (T &msg) throw (WrongStunBufferFormatException) | |
| StunAttrIterator (u08bits *buf, size_t sz, u16bits attr_type) throw (WrongStunBufferFormatException) | |
| template<class T > | |
| StunAttrIterator (T &msg, u16bits attr_type) throw (WrongStunBufferFormatException) | |
| void | next () throw (EndOfStunMsgException) |
| bool | eof () const |
| bool | isAddr () const |
| int | getAddressFamily () const |
| int | getType () const |
| virtual | ~StunAttrIterator () |
| const u08bits * | getRawBuffer (size_t &sz) const throw (WrongStunAttrFormatException) |
Friends | |
| class | StunAttr |
Iterator class for attributes
Definition at line 73 of file TurnMsgLib.h.
| turn::StunAttrIterator::StunAttrIterator | ( | u08bits * | buf, |
| size_t | sz | ||
| ) | throw (WrongStunBufferFormatException) [inline] |
Iterator constructor: creates iterator on raw messagebuffer.
Definition at line 78 of file TurnMsgLib.h.
:
_buf(buf), _sz(sz) {
if(!stun_is_command_message_str(_buf, _sz)) {
throw WrongStunBufferFormatException();
}
_sar = stun_attr_get_first_str(_buf, _sz);
}
| turn::StunAttrIterator::StunAttrIterator | ( | T & | msg | ) | throw (WrongStunBufferFormatException) [inline] |
Iterator constructor: create iterator over message.
Definition at line 90 of file TurnMsgLib.h.
:
_buf(msg.getRawBuffer()), _sz(msg.getSize()) {
if(!stun_is_command_message_str(_buf, _sz)) {
throw WrongStunBufferFormatException();
}
_sar = stun_attr_get_first_str(_buf, _sz);
}
| turn::StunAttrIterator::StunAttrIterator | ( | u08bits * | buf, |
| size_t | sz, | ||
| u16bits | attr_type | ||
| ) | throw (WrongStunBufferFormatException) [inline] |
Iterator constructor: creates iterator over raw buffer, starting from first location of an attribute of particular type.
Definition at line 102 of file TurnMsgLib.h.
:
_buf(buf), _sz(sz) {
if(!stun_is_command_message_str(_buf, _sz)) {
throw WrongStunBufferFormatException();
}
_sar = stun_attr_get_first_by_type_str(_buf, _sz, attr_type);
}
| turn::StunAttrIterator::StunAttrIterator | ( | T & | msg, |
| u16bits | attr_type | ||
| ) | throw (WrongStunBufferFormatException) [inline] |
Iterator constructor: creates iterator over message, starting from first location of an attribute of particular type.
Definition at line 115 of file TurnMsgLib.h.
:
_buf(msg.getRawBuffer()), _sz(msg.getSize()) {
if(!stun_is_command_message_str(_buf, _sz)) {
throw WrongStunBufferFormatException();
}
_sar = stun_attr_get_first_by_type_str(_buf, _sz, attr_type);
}
| virtual turn::StunAttrIterator::~StunAttrIterator | ( | ) | [inline, virtual] |
| bool turn::StunAttrIterator::eof | ( | ) | const [inline] |
| int turn::StunAttrIterator::getAddressFamily | ( | ) | const [inline] |
Return address family attribute value (if the iterator at the "address family" attribute.
Definition at line 150 of file TurnMsgLib.h.
{
return stun_get_requested_address_family(_sar);
}
| const u08bits* turn::StunAttrIterator::getRawBuffer | ( | size_t & | sz | ) | const throw (WrongStunAttrFormatException) [inline] |
Return raw memroy field of the attribute value. If the attribute value length is zero (0), then return NULL.
Definition at line 170 of file TurnMsgLib.h.
{
int len = stun_attr_get_len(_sar);
if(len<0)
throw WrongStunAttrFormatException();
sz = (size_t)len;
const u08bits *value = stun_attr_get_value(_sar);
return value;
}
| int turn::StunAttrIterator::getType | ( | ) | const [inline] |
Get attribute type
Definition at line 157 of file TurnMsgLib.h.
{
return stun_attr_get_type(_sar);
}
| bool turn::StunAttrIterator::isAddr | ( | ) | const [inline] |
Is the iterator at an address attribute
Definition at line 143 of file TurnMsgLib.h.
{
return stun_attr_is_addr(_sar);
}
| void turn::StunAttrIterator::next | ( | ) | throw (EndOfStunMsgException) [inline] |
Moves iterator to next attribute location
Definition at line 126 of file TurnMsgLib.h.
{
if(!_sar) {
throw EndOfStunMsgException();
}
_sar = stun_attr_get_next_str(_buf,_sz,_sar);
}
friend class StunAttr [friend] |
Definition at line 178 of file TurnMsgLib.h.
1.8.0