TURN Server  1.5
 All Classes Files Functions Variables Typedefs Friends Defines
Public Member Functions | Friends
StunAttrIterator Class Reference

#include <TurnMsgLib.h>

List of all members.

Public Member Functions

 StunAttrIterator (u08bits *buf, size_t sz, stun_attr_ref sar) throw (WrongStunBufferFormatException)
 StunAttrIterator (u08bits *buf, size_t sz) throw (WrongStunBufferFormatException)
 StunAttrIterator (u08bits *buf, size_t sz, u16bits attr_type) throw (WrongStunBufferFormatException)
void next () throw (EndOfStunMsgException)
bool eof () const
bool isAddr () const
int getType () const
virtual ~StunAttrIterator ()
const u08bits * getRawBuffer (size_t &sz) const throw (WrongStunAttrFormatException)

Friends

class StunAttr

Detailed Description

Iterator class for attributes

Definition at line 71 of file TurnMsgLib.h.


Constructor & Destructor Documentation

StunAttrIterator::StunAttrIterator ( u08bits *  buf,
size_t  sz,
stun_attr_ref  sar 
) throw (WrongStunBufferFormatException) [inline]

Definition at line 73 of file TurnMsgLib.h.

                                                                                                            :
                _buf(buf), _sz(sz), _sar(sar) {
                if(!stun_is_command_message_str(buf, sz)) {
                        throw WrongStunBufferFormatException();
                }
        }
StunAttrIterator::StunAttrIterator ( u08bits *  buf,
size_t  sz 
) throw (WrongStunBufferFormatException) [inline]

Definition at line 80 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);
        }
StunAttrIterator::StunAttrIterator ( u08bits *  buf,
size_t  sz,
u16bits  attr_type 
) throw (WrongStunBufferFormatException) [inline]

Definition at line 88 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);
        }
virtual StunAttrIterator::~StunAttrIterator ( ) [inline, virtual]

Definition at line 115 of file TurnMsgLib.h.

{}

Member Function Documentation

bool StunAttrIterator::eof ( ) const [inline]

Definition at line 103 of file TurnMsgLib.h.

                         {
                return (!_sar);
        }
const u08bits* StunAttrIterator::getRawBuffer ( size_t &  sz) const throw (WrongStunAttrFormatException) [inline]

Definition at line 117 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);
                if(!value) value=(const u08bits*)"";
                return value;
        }
int StunAttrIterator::getType ( ) const [inline]

Definition at line 111 of file TurnMsgLib.h.

                            {
                return stun_attr_get_type(_sar);
        }
bool StunAttrIterator::isAddr ( ) const [inline]

Definition at line 107 of file TurnMsgLib.h.

                            {
                return stun_attr_is_addr(_sar);
        }
void StunAttrIterator::next ( ) throw (EndOfStunMsgException) [inline]

Definition at line 96 of file TurnMsgLib.h.

                                                 {
                if(!_sar) {
                        throw EndOfStunMsgException();
                }
                _sar = stun_attr_get_next_str(_buf,_sz,_sar);
        }

Friends And Related Function Documentation

friend class StunAttr [friend]

Definition at line 126 of file TurnMsgLib.h.


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