AddressAttribute
#include <icy/stun/attributes.h>
class AddressAttributeDefined in src/stun/include/icy/stun/attributes.h:164
- Inherits
Attribute
Implements a STUN/TURN attribute that contains a socket address. Handles XOR encoding/decoding for address and port as required by RFC 5389 section 15.2.
List of all members
| Name | Kind | Owner |
|---|---|---|
AddressAttribute | function | Declared here |
AddressAttribute | function | Declared here |
clone | function | Declared here |
family | function | Declared here |
address | function | Declared here |
read | function | Declared here |
write | function | Declared here |
setAddress | function | Declared here |
isXorType | function | Declared here |
IPv4Size | variable | Declared here |
IPv6Size | variable | Declared here |
_address | variable | Declared here |
~Attribute | function | Inherited from Attribute |
clone | function | Inherited from Attribute |
read | function | Inherited from Attribute |
write | function | Inherited from Attribute |
type | function | Inherited from Attribute |
size | function | Inherited from Attribute |
paddingBytes | function | Inherited from Attribute |
paddedBytes | function | Inherited from Attribute |
consumePadding | function | Inherited from Attribute |
writePadding | function | Inherited from Attribute |
typeString | function | Inherited from Attribute |
TypeID | variable | Inherited from Attribute |
create | function | Inherited from Attribute |
paddingBytes | function | Inherited from Attribute |
paddedBytes | function | Inherited from Attribute |
typeString | function | Inherited from Attribute |
_type | variable | Inherited from Attribute |
_size | variable | Inherited from Attribute |
Attribute | function | Inherited from Attribute |
setLength | function | Inherited from Attribute |
Type | enum | Inherited from Attribute |
Inherited from Attribute
| Kind | Name | Description |
|---|---|---|
function | ~Attribute virtual inline | |
function | clone virtual | Returns a deep copy of this attribute. |
function | read virtual | Reads the body (not the type or size) for this type of attribute from the given buffer. |
function | write virtual const | Writes the body (not the type or size) to the given buffer. |
function | type const | |
function | size const | |
function | paddingBytes const inline | |
function | paddedBytes const inline | |
function | consumePadding const | Advances the reader past any 4-byte alignment padding that follows this attribute's body. |
function | writePadding const | Writes zero-fill padding bytes to align this attribute to a 4-byte boundary. |
function | typeString | |
variable | TypeID static constexpr | |
function | 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. |
function | paddingBytes static inline constexpr | Returns the 4-byte alignment padding required for a body of size bytes. |
function | paddedBytes static inline constexpr | Returns the body length including 4-byte alignment padding. |
function | typeString static | |
variable | _type | |
variable | _size | |
function | Attribute | |
function | setLength | Updates the stored body length. |
enum | Type |
Public Methods
| Return | Name | Description |
|---|---|---|
AddressAttribute | ||
AddressAttribute | Copy constructor; duplicates the stored address. | |
std::unique_ptr< Attribute > | clone virtual override | Returns a deep copy of this attribute. |
stun::AddressFamily | family const inline | |
net::Address | address virtual const | |
void | read virtual override | Reads the body (not the type or size) for this type of attribute from the given buffer. |
void | write virtual const override | Writes the body (not the type or size) to the given buffer. |
void | setAddress virtual inline | Sets the address to encode into this attribute. |
bool | isXorType const inline |
AddressAttribute
AddressAttribute(uint16_t type, bool ipv4 = true)Defined in src/stun/include/icy/stun/attributes.h:169
Parameters
| Parameter | Type | Description |
|---|---|---|
type | uint16_t | Wire type code (e.g. XorMappedAddress::TypeID). |
ipv4 | bool | When true, initialises the size for IPv4; otherwise IPv6. |
AddressAttribute
AddressAttribute(const AddressAttribute & r)Defined in src/stun/include/icy/stun/attributes.h:172
Copy constructor; duplicates the stored address.
clone
virtual override
virtual std::unique_ptr< Attribute > clone() overrideDefined in src/stun/include/icy/stun/attributes.h:175
Returns a deep copy of this attribute.
Reimplements
family
const inline
inline stun::AddressFamily family() constDefined in src/stun/include/icy/stun/attributes.h:181
Returns
The STUN address family (IPv4, IPv6, or Undefined) of the stored address.
address
virtual const
virtual net::Address address() constDefined in src/stun/include/icy/stun/attributes.h:193
Returns
The decoded socket address stored in this attribute.
read
virtual override
virtual void read(BitReader & reader) overrideDefined in src/stun/include/icy/stun/attributes.h:196
Reads the body (not the type or size) for this type of attribute from the given buffer.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
reader | BitReader & | Source bit reader positioned at the attribute body. |
write
virtual const override
virtual void write(BitWriter & writer) const overrideDefined in src/stun/include/icy/stun/attributes.h:199
Writes the body (not the type or size) to the given buffer.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
writer | BitWriter & | Destination bit writer. |
setAddress
virtual inline
virtual inline void setAddress(const net::Address & addr)Defined in src/stun/include/icy/stun/attributes.h:203
Sets the address to encode into this attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
addr | const net::Address & | Address to store. |
isXorType
const inline
inline bool isXorType() constDefined in src/stun/include/icy/stun/attributes.h:217
Returns
true if this attribute type uses XOR encoding (RFC 5389).
Public Static Attributes
| Return | Name | Description |
|---|---|---|
constexpr uint16_t | IPv4Size static constexpr | |
constexpr uint16_t | IPv6Size static constexpr |
IPv4Size
static constexpr
constexpr uint16_t IPv4Size = 8Defined in src/stun/include/icy/stun/attributes.h:177
IPv6Size
static constexpr
constexpr uint16_t IPv6Size = 20Defined in src/stun/include/icy/stun/attributes.h:178
Private Attributes
| Return | Name | Description |
|---|---|---|
net::Address | _address |
_address
net::Address _addressType: net::Address
