Attribute
#include <icy/stun/attributes.h>
class AttributeDefined in src/stun/include/icy/stun/attributes.h:34
Public Methods
| Return | Name | Description |
|---|---|---|
~Attribute virtual inline | ||
std::unique_ptr< Attribute > | clone virtual | Returns a deep copy of this attribute. |
void | read virtual | Reads the body (not the type or size) for this type of attribute from the given buffer. |
void | write virtual const | Writes the body (not the type or size) to the given buffer. |
uint16_t | type const | |
uint16_t | size const | |
uint16_t | paddingBytes const inline | |
uint16_t | paddedBytes const inline | |
void | consumePadding const | Advances the reader past any 4-byte alignment padding that follows this attribute's body. |
void | writePadding const | Writes zero-fill padding bytes to align this attribute to a 4-byte boundary. |
std::string | typeString |
~Attribute
virtual inline
virtual inline ~Attribute()Defined in src/stun/include/icy/stun/attributes.h:83
clone
virtual
virtual std::unique_ptr< Attribute > clone()Defined in src/stun/include/icy/stun/attributes.h:86
Returns a deep copy of this attribute.
Reimplemented by
AddressAttribute::cloneUInt8Attribute::cloneUInt32Attribute::cloneUInt64Attribute::cloneFlagAttribute::cloneStringAttribute::cloneUInt16ListAttribute::cloneMessageIntegrity::cloneErrorCode::clone
read
virtual
virtual void read(BitReader & reader)Defined in src/stun/include/icy/stun/attributes.h:91
Reads the body (not the type or size) for this type of attribute from the given buffer.
Reimplemented by
FlagAttribute::readAddressAttribute::readUInt8Attribute::readUInt32Attribute::readUInt64Attribute::readStringAttribute::readUInt16ListAttribute::readMessageIntegrity::readErrorCode::read
Parameters
| Parameter | Type | Description |
|---|---|---|
reader | BitReader & | Source bit reader positioned at the attribute body. |
write
virtual const
virtual void write(BitWriter & writer) constDefined in src/stun/include/icy/stun/attributes.h:95
Writes the body (not the type or size) to the given buffer.
Reimplemented by
FlagAttribute::writeAddressAttribute::writeUInt8Attribute::writeUInt32Attribute::writeUInt64Attribute::writeStringAttribute::writeUInt16ListAttribute::writeMessageIntegrity::writeErrorCode::write
Parameters
| Parameter | Type | Description |
|---|---|---|
writer | BitWriter & | Destination bit writer. |
type
const
uint16_t type() constDefined in src/stun/include/icy/stun/attributes.h:105
Returns
The wire type code for this attribute.
size
const
uint16_t size() constDefined in src/stun/include/icy/stun/attributes.h:108
Returns
The body length of this attribute in bytes (before padding).
paddingBytes
const inline
inline uint16_t paddingBytes() constDefined in src/stun/include/icy/stun/attributes.h:123
Returns
The 4-byte alignment padding required for this attribute body.
paddedBytes
const inline
inline uint16_t paddedBytes() constDefined in src/stun/include/icy/stun/attributes.h:126
Returns
The body length including 4-byte alignment padding.
consumePadding
const
void consumePadding(BitReader & reader) constDefined in src/stun/include/icy/stun/attributes.h:131
Advances the reader past any 4-byte alignment padding that follows this attribute's body.
Parameters
| Parameter | Type | Description |
|---|---|---|
reader | BitReader & | Reader to advance. |
writePadding
const
void writePadding(BitWriter & writer) constDefined in src/stun/include/icy/stun/attributes.h:136
Writes zero-fill padding bytes to align this attribute to a 4-byte boundary.
Parameters
| Parameter | Type | Description |
|---|---|---|
writer | BitWriter & | Writer to append padding to. |
typeString
std::string typeString()Defined in src/stun/include/icy/stun/attributes.h:141
Returns
Human-readable name for this attribute's type.
Public Static Attributes
| Return | Name | Description |
|---|---|---|
constexpr uint16_t | TypeID static constexpr |
TypeID
static constexpr
constexpr uint16_t TypeID = 0Defined in src/stun/include/icy/stun/attributes.h:138
Public Static Methods
| Return | Name | Description |
|---|---|---|
std::unique_ptr< Attribute > | create static | Creates an attribute of the given wire type and body size. Returns nullptr if the type is unknown or the size is invalid. |
constexpr uint16_t | paddingBytes static inline constexpr | Returns the 4-byte alignment padding required for a body of size bytes. |
constexpr uint16_t | paddedBytes static inline constexpr | Returns the body length including 4-byte alignment padding. |
std::string | typeString static |
create
static
static std::unique_ptr< Attribute > create(uint16_t type, uint16_t size = 0)Defined in src/stun/include/icy/stun/attributes.h:102
Creates an attribute of the given wire type and body size. Returns nullptr if the type is unknown or the size is invalid.
Returns
Owning pointer to the new attribute, or nullptr on failure.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | uint16_t | Wire type code (one of Attribute::Type). |
size | uint16_t | Body length in bytes as read from the wire header. |
paddingBytes
static inline constexpr
constexpr static inline constexpr uint16_t paddingBytes(uint16_t size)Defined in src/stun/include/icy/stun/attributes.h:111
Returns the 4-byte alignment padding required for a body of size bytes.
paddedBytes
static inline constexpr
constexpr static inline constexpr uint16_t paddedBytes(uint16_t size)Defined in src/stun/include/icy/stun/attributes.h:117
Returns the body length including 4-byte alignment padding.
typeString
static
static std::string typeString(uint16_t type)Defined in src/stun/include/icy/stun/attributes.h:145
Returns
Human-readable name for the given type code.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | uint16_t | Wire type code. |
Protected Attributes
_type
uint16_t _typeDefined in src/stun/include/icy/stun/attributes.h:156
_size
uint16_t _sizeDefined in src/stun/include/icy/stun/attributes.h:157
Protected Methods
Attribute
Attribute(uint16_t type, uint16_t size = 0)Defined in src/stun/include/icy/stun/attributes.h:150
Parameters
| Parameter | Type | Description |
|---|---|---|
type | uint16_t | Wire type code for this attribute. |
size | uint16_t | Initial body length in bytes. |
setLength
void setLength(uint16_t size)Defined in src/stun/include/icy/stun/attributes.h:154
Updates the stored body length.
Parameters
| Parameter | Type | Description |
|---|---|---|
size | uint16_t | New body length in bytes. |
Public Types
| Name | Description |
|---|---|
Type |
Type
enum TypeDefined in src/stun/include/icy/stun/attributes.h:37
| Value | Description |
|---|---|
NotExist | |
MappedAddress | |
ResponseAddress | |
ChangeRequest | |
SourceAddress | |
ChangedAddress | |
Username | |
Password | |
MessageIntegrity | |
ErrorCode | |
Bandwidth | |
DestinationAddress | |
UnknownAttributes | |
ReflectedFrom | |
MagicCookie | |
Realm | |
Nonce | |
XorMappedAddress | |
Software | |
Options | |
AlternateServer | |
Fingerprint | |
ChannelNumber | TURN. |
Lifetime | |
XorPeerAddress | |
Data | |
XorRelayedAddress | |
EventPort | |
RequestedTransport | |
DontFragment | |
ReservationToken | 0x0021: Reserved (was TIMER-VAL) |
ConnectionID | TURN TCP. |
ICEControlled | ICE. |
ICEControlling | |
ICEPriority | |
ICEUseCandidate |
