Home
STUN module (rfc5389)

UInt32Attribute

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

UInt32Attribute

#include <icy/stun/attributes.h>
class UInt32Attribute

Defined in src/stun/include/icy/stun/attributes.h:269

Inherits: Attribute

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

List of all members

NameKindOwner
UInt32AttributefunctionDeclared here
UInt32AttributefunctionDeclared here
clonefunctionDeclared here
valuefunctionDeclared here
setValuefunctionDeclared here
getBitfunctionDeclared here
setBitfunctionDeclared here
readfunctionDeclared here
writefunctionDeclared here
SizevariableDeclared here
_bitsvariableDeclared here
~AttributefunctionInherited from Attribute
clonefunctionInherited from Attribute
readfunctionInherited from Attribute
writefunctionInherited from Attribute
typefunctionInherited from Attribute
sizefunctionInherited from Attribute
paddingBytesfunctionInherited from Attribute
paddedBytesfunctionInherited from Attribute
consumePaddingfunctionInherited from Attribute
writePaddingfunctionInherited from Attribute
typeStringfunctionInherited from Attribute
TypeIDvariableInherited from Attribute
createfunctionInherited from Attribute
paddingBytesfunctionInherited from Attribute
paddedBytesfunctionInherited from Attribute
typeStringfunctionInherited from Attribute
_typevariableInherited from Attribute
_sizevariableInherited from Attribute
AttributefunctionInherited from Attribute
setLengthfunctionInherited from Attribute
TypeenumInherited from Attribute

Inherited from Attribute

KindNameDescription
function~Attribute virtual inline
functionclone virtualReturns a deep copy of this attribute.
functionread virtualReads the body (not the type or size) for this type of attribute from the given buffer.
functionwrite virtual constWrites the body (not the type or size) to the given buffer.
functiontype const
functionsize const
functionpaddingBytes const inline
functionpaddedBytes const inline
functionconsumePadding constAdvances the reader past any 4-byte alignment padding that follows this attribute's body.
functionwritePadding constWrites zero-fill padding bytes to align this attribute to a 4-byte boundary.
functiontypeString
variableTypeID static constexpr
functioncreate staticCreates an attribute of the given wire type and body size. Returns nullptr if the type is unknown or the size is invalid.
functionpaddingBytes static inline constexprReturns the 4-byte alignment padding required for a body of size bytes.
functionpaddedBytes static inline constexprReturns the body length including 4-byte alignment padding.
functiontypeString static
variable_type
variable_size
functionAttribute
functionsetLengthUpdates the stored body length.
enumType

Public Methods

ReturnNameDescription
UInt32Attribute
UInt32AttributeCopy constructor.
std::unique_ptr< Attribute >clone virtual overrideReturns a deep copy of this attribute.
uint32_tvalue const inline
voidsetValue inlineSets the stored 32-bit value.
boolgetBit constReturns the state of a single bit within the stored word.
voidsetBitSets or clears a single bit within the stored word.
voidread virtual overrideReads the body (not the type or size) for this type of attribute from the given buffer.
voidwrite virtual const overrideWrites the body (not the type or size) to the given buffer.

UInt32Attribute

UInt32Attribute(uint16_t type)

Defined in src/stun/include/icy/stun/attributes.h:273

Parameters

  • type Wire type code for the concrete attribute.

UInt32Attribute

UInt32Attribute(const UInt32Attribute & r)

Defined in src/stun/include/icy/stun/attributes.h:276

Copy constructor.


clone

virtual override

virtual std::unique_ptr< Attribute > clone() override

Defined in src/stun/include/icy/stun/attributes.h:279

Returns a deep copy of this attribute.

Reimplements

value

const inline

inline uint32_t value() const

Defined in src/stun/include/icy/stun/attributes.h:284

Returns

The stored 32-bit value.


setValue

inline

inline void setValue(uint32_t bits)

Defined in src/stun/include/icy/stun/attributes.h:288

Sets the stored 32-bit value.

Parameters

  • bits Value to store.

getBit

const

bool getBit(int index) const

Defined in src/stun/include/icy/stun/attributes.h:293

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

Parameters

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

Returns

true if the bit is set.


setBit

void setBit(int index, bool value)

Defined in src/stun/include/icy/stun/attributes.h:298

Sets or clears a single bit within the stored word.

Parameters

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

  • value true to set, false to clear.


read

virtual override

virtual void read(BitReader & reader) override

Defined in src/stun/include/icy/stun/attributes.h:300

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.
Reimplements

write

virtual const override

virtual void write(BitWriter & writer) const override

Defined in src/stun/include/icy/stun/attributes.h:301

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

Parameters

  • writer Destination bit writer.
Reimplements

Public Static Attributes

ReturnNameDescription
constexpr uint16_tSize static constexpr

Size

static constexpr

constexpr uint16_t Size = 4

Defined in src/stun/include/icy/stun/attributes.h:281

Private Attributes

ReturnNameDescription
uint32_t_bits

_bits

uint32_t _bits

Defined in src/stun/include/icy/stun/attributes.h:304