stun
Classes
| Name | Description |
|---|---|
AddressAttribute | 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. |
Attribute | The virtual base class for all STUN/TURN attributes. |
ErrorCode | Implements the STUN ERROR-CODE attribute (RFC 5389 section 15.6). Encodes a 3-digit error code as a class (hundreds digit) and number (tens + units digits), plus an optional UTF-8 reason phrase. |
FlagAttribute | Implements a zero-length STUN/TURN flag attribute (presence implies the flag is set). |
Message | STUN/TURN protocol message with method, class, transaction ID, and attributes. |
MessageIntegrity | Implements the STUN MESSAGE-INTEGRITY attribute (RFC 5389 section 15.4). On write, computes an HMAC-SHA1 over the message bytes preceding this attribute when a key is set. On read, captures the raw HMAC bytes and the input bytes needed to verify them later via verifyHmac(). |
StringAttribute | Implements a STUN/TURN attribute that holds an arbitrary byte string. Used for Username, Password, Realm, Nonce, Software, Data, and similar attributes. |
Transaction | STUN request/response transaction with timeout and retry logic. Extends the generic net::Transaction with STUN-specific transaction ID matching and response class inference (Success, Error, or Indication). |
UInt16ListAttribute | Implements a STUN/TURN attribute that holds a list of attribute type codes. Used by the UNKNOWN-ATTRIBUTES attribute (RFC 5389 section 15.9). |
UInt32Attribute | Implements a STUN/TURN attribute that holds a 32-bit integer. |
UInt64Attribute | Implements a STUN/TURN attribute that holds a 64-bit integer. |
UInt8Attribute | Implements a STUN/TURN attribute that holds an 8-bit integer. |
Enumerations
| Name | Description |
|---|---|
AddressFamily | STUN address types as defined in RFC 5389. NB: Undefined is not part of the STUN spec. |
AddressFamily
enum AddressFamilyDefined in src/stun/include/icy/stun/stun.h:47
STUN address types as defined in RFC 5389. NB: Undefined is not part of the STUN spec.
| Value | Description |
|---|---|
Undefined | Not a valid STUN address family; used as a sentinel. |
IPv4 | IPv4 transport address. |
IPv6 | IPv6 transport address. |
Typedefs
| Return | Name | Description |
|---|---|---|
std::string | TransactionID | Fixed-width 12-byte STUN transaction identifier stored as raw bytes. |
TransactionID
using TransactionID = std::stringDefined in src/stun/include/icy/stun/message.h:27
Fixed-width 12-byte STUN transaction identifier stored as raw bytes.
Functions
| Return | Name | Description |
|---|---|---|
constexpr bool | isValidMethod constexpr | Returns true if methodType corresponds to a recognised STUN/TURN method. Used during parsing to reject malformed packets. |
isValidMethod
constexpr
constexpr constexpr bool isValidMethod(uint16_t methodType)Defined in src/stun/include/icy/stun/message.h:224
Returns true if methodType corresponds to a recognised STUN/TURN method. Used during parsing to reject malformed packets.
Returns
true if the method is one of the defined MethodType values.
Parameters
| Parameter | Type | Description |
|---|---|---|
methodType | uint16_t | Raw method bits extracted from the message type field. |
Variables
| Return | Name | Description |
|---|---|---|
constexpr int | kAttributeHeaderSize constexpr | Bytes in a STUN attribute header. |
constexpr int | kMessageHeaderSize constexpr | Bytes in the fixed STUN message header. |
constexpr int | kTransactionIdOffset constexpr | Byte offset of the transaction ID inside the message header. |
constexpr int | kTransactionIdLength constexpr | Length in bytes of a STUN transaction ID. |
constexpr uint32_t | kMagicCookie constexpr | RFC 5389 magic cookie used by modern STUN/TURN messages. |
constexpr int | kMagicCookieLength constexpr | Length in bytes of the magic cookie field. |
kAttributeHeaderSize
constexpr
constexpr int kAttributeHeaderSize = 4Defined in src/stun/include/icy/stun/stun.h:37
Bytes in a STUN attribute header.
kMessageHeaderSize
constexpr
constexpr int kMessageHeaderSize = 20Defined in src/stun/include/icy/stun/stun.h:38
Bytes in the fixed STUN message header.
kTransactionIdOffset
constexpr
constexpr int kTransactionIdOffset = 8Defined in src/stun/include/icy/stun/stun.h:39
Byte offset of the transaction ID inside the message header.
kTransactionIdLength
constexpr
constexpr int kTransactionIdLength = 12Defined in src/stun/include/icy/stun/stun.h:40
Length in bytes of a STUN transaction ID.
kMagicCookie
constexpr
constexpr uint32_t kMagicCookie = 0x2112A442Defined in src/stun/include/icy/stun/stun.h:41
RFC 5389 magic cookie used by modern STUN/TURN messages.
kMagicCookieLength
constexpr
constexpr int kMagicCookieLength = sizeof(kMagicCookie)Defined in src/stun/include/icy/stun/stun.h:42
Length in bytes of the magic cookie field.
