AddressAttribute
AddressAttribute
#include <icy/stun/attributes.h>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.
Public Methods
| Return | Name | Description |
|---|---|---|
AddressAttribute | #### Parameters | |
AddressAttribute | Copy constructor; duplicates the stored address. | |
std::unique_ptr< Attribute > | clone virtual | Returns a deep copy of this attribute. |
stun::AddressFamily | family const inline | #### Returns |
net::Address | address virtual const | #### Returns |
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. |
void | setAddress virtual inline | Sets the address to encode into this attribute. |
bool | isXorType const inline | #### Returns |
AddressAttribute
AddressAttribute(uint16_t type, bool ipv4)Parameters
typeWire type code (e.g. XorMappedAddress::TypeID).ipv4When true, initialises the size for IPv4; otherwise IPv6.
AddressAttribute
AddressAttribute(const AddressAttribute & r)Copy constructor; duplicates the stored address.
clone
virtual
virtual std::unique_ptr< Attribute > clone()Returns a deep copy of this attribute.
family
const inline
inline stun::AddressFamily family() constReturns
The STUN address family (IPv4, IPv6, or Undefined) of the stored address.
address
virtual const
virtual net::Address address() constReturns
The decoded socket address stored in this attribute.
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
readerSource bit reader positioned at the attribute body.
write
virtual const
virtual void write(BitWriter & writer) constWrites the body (not the type or size) to the given buffer.
Parameters
writerDestination bit writer.
setAddress
virtual inline
virtual inline void setAddress(const net::Address & addr)Sets the address to encode into this attribute.
Parameters
addrAddress to store.
isXorType
const inline
inline bool isXorType() constReturns
true if this attribute type uses XOR encoding (RFC 5389).
Public Static Attributes
IPv4Size
static
constexpr uint16_t IPv4Size = 8IPv6Size
static
constexpr uint16_t IPv6Size = 20Private Attributes
| Return | Name | Description |
|---|---|---|
net::Address | _address |
_address
net::Address _address