#include <icy/stun/attributes.h>Subclassed by:
AddressAttribute,ErrorCode,FlagAttribute,MessageIntegrity,StringAttribute,UInt16ListAttribute,UInt32Attribute,UInt64Attribute,UInt8Attribute
The virtual base class for all STUN/TURN attributes.
| Return | Name | Description |
|---|---|---|
std::unique_ptr< Attribute > | clone | Returns a deep copy of this attribute. |
void | read | Reads the body (not the type or size) for this type of attribute from the given buffer. |
void | write const | Writes the body (not the type or size) to the given buffer. |
uint16_t | type const | #### Returns |
uint16_t | size const | #### Returns |
uint16_t | paddingBytes const inline | #### Returns |
uint16_t | paddedBytes const inline | #### Returns |
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 | #### Returns |
std::unique_ptr< Attribute > clone()Returns a deep copy of this attribute.
void read(BitReader & reader)Reads the body (not the type or size) for this type of attribute from the given buffer.
reader Source bit reader positioned at the attribute body.const
void write(BitWriter & writer) constWrites the body (not the type or size) to the given buffer.
writer Destination bit writer.const
uint16_t type() constThe wire type code for this attribute.
const
uint16_t size() constThe body length of this attribute in bytes (before padding).
const inline
inline uint16_t paddingBytes() constThe 4-byte alignment padding required for this attribute body.
const inline
inline uint16_t paddedBytes() constThe body length including 4-byte alignment padding.
const
void consumePadding(BitReader & reader) constAdvances the reader past any 4-byte alignment padding that follows this attribute's body.
reader Reader to advance.const
void writePadding(BitWriter & writer) constWrites zero-fill padding bytes to align this attribute to a 4-byte boundary.
writer Writer to append padding to.std::string typeString()Human-readable name for this attribute's type.
| Return | Name | Description |
|---|---|---|
constexpr uint16_t | TypeID static |
static
constexpr uint16_t TypeID = 0| 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 | Returns the 4-byte alignment padding required for a body of size bytes. |
constexpr uint16_t | paddedBytes static inline | Returns the body length including 4-byte alignment padding. |
std::string | typeString static | #### Parameters |
static
static std::unique_ptr< Attribute > create(uint16_t type, uint16_t size)Creates an attribute of the given wire type and body size. Returns nullptr if the type is unknown or the size is invalid.
type Wire type code (one of Attribute::Type).
size Body length in bytes as read from the wire header.
Owning pointer to the new attribute, or nullptr on failure.
static inline
static inline constexpr uint16_t paddingBytes(uint16_t size)Returns the 4-byte alignment padding required for a body of size bytes.
static inline
static inline constexpr uint16_t paddedBytes(uint16_t size)Returns the body length including 4-byte alignment padding.
static
static std::string typeString(uint16_t type)type Wire type code.Human-readable name for the given type code.
uint16_t _typeuint16_t _sizeAttribute(uint16_t type, uint16_t size)type Wire type code for this attribute.
size Initial body length in bytes.
void setLength(uint16_t size)Updates the stored body length.
size New body length in bytes.| Name | Description |
|---|---|
Type |
enum Type| 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 |