STUN module (rfc5389)

UInt8Attribute

Implements a STUN/TURN attribute that holds an 8-bit integer.

UInt8Attribute

#include <icy/stun/attributes.h>

Inherits: Attribute

Implements a STUN/TURN attribute that holds an 8-bit integer.

Public Methods

ReturnNameDescription
UInt8Attribute#### Parameters
UInt8AttributeCopy constructor.
std::unique_ptr< Attribute >clone virtualReturns a deep copy of this attribute.
uint8_tvalue const inline#### Returns
voidsetValue inlineSets the stored 8-bit value.
boolgetBit constReturns the state of a single bit within the stored byte.
voidsetBitSets or clears a single bit within the stored byte.
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.

UInt8Attribute

UInt8Attribute(uint16_t type)

Parameters

  • type Wire type code for the concrete attribute.

UInt8Attribute

UInt8Attribute(const UInt8Attribute & r)

Copy constructor.


clone

virtual

virtual std::unique_ptr< Attribute > clone()

Returns a deep copy of this attribute.


value

const inline

inline uint8_t value() const

Returns

The stored 8-bit value.


setValue

inline

inline void setValue(uint8_t bits)

Sets the stored 8-bit value.

Parameters

  • bits Value to store.

getBit

const

bool getBit(int index) const

Returns the state of a single bit within the stored byte.

Parameters

  • index Bit position (0 = LSB, 7 = MSB).

Returns

true if the bit is set.


setBit

void setBit(int index, bool value)

Sets or clears a single bit within the stored byte.

Parameters

  • index Bit position (0 = LSB, 7 = MSB).

  • value true to set, false to clear.


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.

Public Static Attributes

ReturnNameDescription
constexpr uint16_tSize static

Size

static

constexpr uint16_t Size = 1

Private Attributes

ReturnNameDescription
uint8_t_bits

_bits

uint8_t _bits