STUN module (rfc5389)

UInt16ListAttribute

Implements a STUN/TURN attribute that holds a list of attribute type codes.

UInt16ListAttribute

#include <icy/stun/attributes.h>

Inherits: Attribute

Implements a STUN/TURN attribute that holds a list of attribute type codes. Used by the UNKNOWN-ATTRIBUTES attribute (RFC 5389 section 15.9).

Public Methods

ReturnNameDescription
UInt16ListAttribute#### Parameters
UInt16ListAttributeCopy constructor; duplicates the type list.
std::unique_ptr< Attribute >clone virtualReturns a deep copy of this attribute.
size_tsize const#### Returns
uint16_tgetType constReturns the type code at the given list position.
voidsetTypeOverwrites the type code at the given list position.
voidaddTypeAppends a type code to the list and updates the attribute size.
voidread virtualReads the body (not the type or size) for this type of attribute from the given buffer.
voidwrite virtual constWrites the body (not the type or size) to the given buffer.

UInt16ListAttribute

UInt16ListAttribute(uint16_t type, uint16_t size)

Parameters

  • type Wire type code for the concrete attribute.

  • size Initial body length in bytes.


UInt16ListAttribute

UInt16ListAttribute(const UInt16ListAttribute & r)

Copy constructor; duplicates the type list.


clone

virtual

virtual std::unique_ptr< Attribute > clone()

Returns a deep copy of this attribute.


size

const

size_t size() const

Returns

Number of attribute type codes in the list.


getType

const

uint16_t getType(int index) const

Returns the type code at the given list position.

Parameters

  • index Zero-based list index.

Returns

Attribute type code at index.


setType

void setType(int index, uint16_t value)

Overwrites the type code at the given list position.

Parameters

  • index Zero-based list index.

  • value New attribute type code.


addType

void addType(uint16_t value)

Appends a type code to the list and updates the attribute size.

Parameters


read

virtual

virtual void read(BitReader & reader)

Reads the body (not the type or size) for this type of attribute from the given buffer.

Parameters

  • reader Source bit reader positioned at the attribute body.

write

virtual const

virtual void write(BitWriter & writer) const

Writes the body (not the type or size) to the given buffer.

Parameters

  • writer Destination bit writer.

Private Attributes

ReturnNameDescription
std::vector< uint16_t >_attrTypes

_attrTypes

std::vector< uint16_t > _attrTypes