|
HOME
SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port
FAQ
Documentation
Licensing
Download
Development (Trac)
Projects using pjsip
Mailing List
Open Source Links
About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono <bennylp pjsip.org>
|
|
Home --> Documentations --> PJNATH Reference
STUN Message Representation and Parsing
[STUN Library]
Detailed Description
|
Data Structures |
| struct | pj_stun_msg_hdr |
| struct | pj_stun_attr_hdr |
| struct | pj_stun_sockaddr_attr |
| struct | pj_stun_empty_attr |
| struct | pj_stun_string_attr |
| struct | pj_stun_uint_attr |
| struct | pj_stun_uint64_attr |
| struct | pj_stun_binary_attr |
| struct | pj_stun_msgint_attr |
| struct | pj_stun_errcode_attr |
| struct | pj_stun_unknown_attr |
| struct | pj_stun_msg |
Defines |
| #define | PJ_STUN_MAGIC 0x2112A442 |
| #define | PJ_STUN_GET_METHOD(msg_type) ((msg_type) & 0xFEEF) |
| #define | PJ_STUN_IS_REQUEST(msg_type) (((msg_type) & 0x0110) == 0x0000) |
| #define | PJ_STUN_IS_SUCCESS_RESPONSE(msg_type) (((msg_type) & 0x0110) == 0x0100) |
| #define | PJ_STUN_SUCCESS_RESPONSE_BIT (0x0100) |
| #define | PJ_STUN_IS_ERROR_RESPONSE(msg_type) (((msg_type) & 0x0110) == 0x0110) |
| #define | PJ_STUN_ERROR_RESPONSE_BIT (0x0110) |
| #define | PJ_STUN_IS_RESPONSE(msg_type) (((msg_type) & 0x0100) == 0x0100) |
| #define | PJ_STUN_IS_INDICATION(msg_type) (((msg_type) & 0x0110) == 0x0010) |
| #define | PJ_STUN_INDICATION_BIT (0x0010) |
| #define | PJ_STUN_GET_CH_NB(u32) ((pj_uint16_t)(u32>>16)) |
| #define | PJ_STUN_SET_CH_NB(chnum) (((pj_uint32_t)chnum) << 16) |
| #define | PJ_STUN_GET_PROP_TYPE(u32) (u32 >> 24) |
| #define | PJ_STUN_SET_PROP_TYPE(PropType) (PropType << 24) |
| #define | PJ_STUN_GET_RT_PROTO(u32) (u32 >> 24) |
| #define | PJ_STUN_SET_RT_PROTO(proto) (((pj_uint32_t)(proto)) << 24) |
Typedefs |
| typedef struct pj_stun_uint_attr | pj_stun_fingerprint_attr |
| typedef struct pj_stun_string_attr | pj_stun_realm_attr |
| typedef struct pj_stun_string_attr | pj_stun_nonce_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_mapped_addr_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_xor_mapped_addr_attr |
| typedef struct pj_stun_string_attr | pj_stun_software_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_alt_server_attr |
| typedef struct pj_stun_uint_attr | pj_stun_refresh_interval_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_response_addr_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_changed_addr_attr |
| typedef struct pj_stun_uint_attr | pj_stun_change_request_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_src_addr_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_reflected_from_attr |
| typedef struct pj_stun_string_attr | pj_stun_username_attr |
| typedef struct pj_stun_string_attr | pj_stun_password_attr |
| typedef struct pj_stun_uint_attr | pj_stun_channel_number_attr |
| typedef struct pj_stun_uint_attr | pj_stun_lifetime_attr |
| typedef struct pj_stun_uint_attr | pj_stun_bandwidth_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_peer_addr_attr |
| typedef struct pj_stun_binary_attr | pj_stun_data_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_relayed_addr_attr |
| typedef struct pj_stun_uint_attr | pj_stun_req_addr_type |
| typedef struct pj_stun_uint_attr | pj_stun_req_props_attr |
| typedef struct pj_stun_uint_attr | pj_stun_req_transport_attr |
| typedef struct pj_stun_uint64_attr | pj_stun_res_token_attr |
typedef struct
pj_stun_sockaddr_attr | pj_stun_xor_reflected_from_attr |
| typedef struct pj_stun_uint_attr | pj_stun_priority_attr |
| typedef struct pj_stun_empty_attr | pj_stun_use_candidate_attr |
| typedef struct pj_stun_uint_attr | pj_stun_timer_val_attr |
| typedef struct pj_stun_uint64_attr | pj_stun_ice_controlling_attr |
| typedef struct pj_stun_uint64_attr | pj_stun_ice_controlled_attr |
| typedef struct pj_stun_uint_attr | pj_stun_icmp_attr |
Enumerations |
| enum | pj_stun_method_e {
PJ_STUN_BINDING_METHOD = 1,
PJ_STUN_SHARED_SECRET_METHOD = 2,
PJ_STUN_ALLOCATE_METHOD = 3,
PJ_STUN_REFRESH_METHOD = 4,
PJ_STUN_SEND_METHOD = 6,
PJ_STUN_DATA_METHOD = 7,
PJ_STUN_CHANNEL_BIND_METHOD = 9,
PJ_STUN_METHOD_MAX
} |
| enum | pj_stun_msg_class_e {
PJ_STUN_REQUEST_CLASS = 0,
PJ_STUN_INDICATION_CLASS = 1,
PJ_STUN_SUCCESS_CLASS = 2,
PJ_STUN_ERROR_CLASS = 3
} |
| enum | pj_stun_msg_type {
PJ_STUN_BINDING_REQUEST = 0x0001,
PJ_STUN_BINDING_RESPONSE = 0x0101,
PJ_STUN_BINDING_ERROR_RESPONSE = 0x0111,
PJ_STUN_SHARED_SECRET_REQUEST = 0x0002,
PJ_STUN_SHARED_SECRET_RESPONSE = 0x0102,
PJ_STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112,
PJ_STUN_ALLOCATE_REQUEST = 0x0003,
PJ_STUN_ALLOCATE_RESPONSE = 0x0103,
PJ_STUN_ALLOCATE_ERROR_RESPONSE = 0x0113,
PJ_STUN_REFRESH_REQUEST = 0x0004,
PJ_STUN_REFRESH_RESPONSE = 0x0104,
PJ_STUN_REFRESH_ERROR_RESPONSE = 0x0114,
PJ_STUN_SEND_INDICATION = 0x0016,
PJ_STUN_DATA_INDICATION = 0x0017,
PJ_STUN_CHANNEL_BIND_REQUEST = 0x0009,
PJ_STUN_CHANNEL_BIND_RESPONSE = 0x0109,
PJ_STUN_CHANNEL_BIND_ERROR_RESPONSE = 0x0119
} |
| enum | pj_stun_attr_type {
PJ_STUN_ATTR_MAPPED_ADDR = 0x0001,
PJ_STUN_ATTR_RESPONSE_ADDR = 0x0002,
PJ_STUN_ATTR_CHANGE_REQUEST = 0x0003,
PJ_STUN_ATTR_SOURCE_ADDR = 0x0004,
PJ_STUN_ATTR_CHANGED_ADDR = 0x0005,
PJ_STUN_ATTR_USERNAME = 0x0006,
PJ_STUN_ATTR_PASSWORD = 0x0007,
PJ_STUN_ATTR_MESSAGE_INTEGRITY = 0x0008,
PJ_STUN_ATTR_ERROR_CODE = 0x0009,
PJ_STUN_ATTR_UNKNOWN_ATTRIBUTES = 0x000A,
PJ_STUN_ATTR_REFLECTED_FROM = 0x000B,
PJ_STUN_ATTR_CHANNEL_NUMBER = 0x000C,
PJ_STUN_ATTR_LIFETIME = 0x000D,
PJ_STUN_ATTR_MAGIC_COOKIE = 0x000F,
PJ_STUN_ATTR_BANDWIDTH = 0x0010,
PJ_STUN_ATTR_PEER_ADDR = 0x0012,
PJ_STUN_ATTR_DATA = 0x0013,
PJ_STUN_ATTR_REALM = 0x0014,
PJ_STUN_ATTR_NONCE = 0x0015,
PJ_STUN_ATTR_RELAYED_ADDR = 0x0016,
PJ_STUN_ATTR_REQ_ADDR_TYPE = 0x0017,
PJ_STUN_ATTR_REQ_PROPS = 0x0018,
PJ_STUN_ATTR_REQ_TRANSPORT = 0x0019,
PJ_STUN_ATTR_XOR_MAPPED_ADDR = 0x0020,
PJ_STUN_ATTR_TIMER_VAL = 0x0021,
PJ_STUN_ATTR_RESERVATION_TOKEN = 0x0022,
PJ_STUN_ATTR_XOR_REFLECTED_FROM = 0x0023,
PJ_STUN_ATTR_PRIORITY = 0x0024,
PJ_STUN_ATTR_USE_CANDIDATE = 0x0025,
PJ_STUN_ATTR_ICMP = 0x0030,
PJ_STUN_ATTR_END_MANDATORY_ATTR,
PJ_STUN_ATTR_START_EXTENDED_ATTR = 0x8021,
PJ_STUN_ATTR_SOFTWARE = 0x8022,
PJ_STUN_ATTR_ALTERNATE_SERVER = 0x8023,
PJ_STUN_ATTR_REFRESH_INTERVAL = 0x8024,
PJ_STUN_ATTR_FINGERPRINT = 0x8028,
PJ_STUN_ATTR_ICE_CONTROLLED = 0x8029,
PJ_STUN_ATTR_ICE_CONTROLLING = 0x802a,
PJ_STUN_ATTR_END_EXTENDED_ATTR
} |
| enum | pj_stun_status {
PJ_STUN_SC_TRY_ALTERNATE = 300,
PJ_STUN_SC_BAD_REQUEST = 400,
PJ_STUN_SC_UNAUTHORIZED = 401,
PJ_STUN_SC_UNKNOWN_ATTRIBUTE = 420,
PJ_STUN_SC_ALLOCATION_MISMATCH = 437,
PJ_STUN_SC_STALE_NONCE = 438,
PJ_STUN_SC_TRANSITIONING = 439,
PJ_STUN_SC_WRONG_CREDENTIALS = 441,
PJ_STUN_SC_UNSUPP_TRANSPORT_PROTO = 442,
PJ_STUN_SC_INVALID_IP_ADDR = 443,
PJ_STUN_SC_INVALID_PORT = 444,
PJ_STUN_SC_OPER_TCP_ONLY = 445,
PJ_STUN_SC_CONNECTION_FAILURE = 446,
PJ_STUN_SC_CONNECTION_TIMEOUT = 447,
PJ_STUN_SC_ALLOCATION_QUOTA_REACHED = 486,
PJ_STUN_SC_ROLE_CONFLICT = 487,
PJ_STUN_SC_SERVER_ERROR = 500,
PJ_STUN_SC_INSUFFICIENT_CAPACITY = 507,
PJ_STUN_SC_INSUFFICIENT_PORT_CAPACITY = 508,
PJ_STUN_SC_GLOBAL_FAILURE = 600
} |
| enum | pj_stun_decode_options {
PJ_STUN_IS_DATAGRAM = 1,
PJ_STUN_CHECK_PACKET = 2,
PJ_STUN_NO_AUTHENTICATE = 4,
PJ_STUN_NO_FINGERPRINT_CHECK = 8
} |
Functions |
| const char * | pj_stun_get_method_name (unsigned msg_type) |
| const char * | pj_stun_get_class_name (unsigned msg_type) |
| const char * | pj_stun_get_attr_name (unsigned attr_type) |
| pj_str_t | pj_stun_get_err_reason (int err_code) |
| int | pj_stun_set_padding_char (int chr) |
| pj_status_t | pj_stun_msg_init (pj_stun_msg *msg, unsigned msg_type, pj_uint32_t magic, const pj_uint8_t tsx_id[12]) |
| pj_status_t | pj_stun_msg_create (pj_pool_t *pool, unsigned msg_type, pj_uint32_t magic, const pj_uint8_t tsx_id[12], pj_stun_msg **p_msg) |
| pj_stun_msg * | pj_stun_msg_clone (pj_pool_t *pool, const pj_stun_msg *msg) |
| pj_status_t | pj_stun_msg_create_response (pj_pool_t *pool, const pj_stun_msg *req_msg, unsigned err_code, const pj_str_t *err_msg, pj_stun_msg **p_response) |
| pj_status_t | pj_stun_msg_add_attr (pj_stun_msg *msg, pj_stun_attr_hdr *attr) |
| pj_status_t | pj_stun_msg_encode (pj_stun_msg *msg, pj_uint8_t *pkt_buf, pj_size_t buf_size, unsigned options, const pj_str_t *key, pj_size_t *p_msg_len) |
| pj_status_t | pj_stun_msg_check (const pj_uint8_t *pdu, pj_size_t pdu_len, unsigned options) |
| pj_status_t | pj_stun_msg_decode (pj_pool_t *pool, const pj_uint8_t *pdu, pj_size_t pdu_len, unsigned options, pj_stun_msg **p_msg, pj_size_t *p_parsed_len, pj_stun_msg **p_response) |
| char * | pj_stun_msg_dump (const pj_stun_msg *msg, char *buffer, unsigned length, unsigned *printed_len) |
| pj_stun_attr_hdr * | pj_stun_msg_find_attr (const pj_stun_msg *msg, int attr_type, unsigned start_index) |
| pj_stun_attr_hdr * | pj_stun_attr_clone (pj_pool_t *pool, const pj_stun_attr_hdr *attr) |
| pj_status_t | pj_stun_sockaddr_attr_init (pj_stun_sockaddr_attr *attr, int attr_type, pj_bool_t xor_ed, const pj_sockaddr_t *addr, unsigned addr_len) |
| pj_status_t | pj_stun_sockaddr_attr_create (pj_pool_t *pool, int attr_type, pj_bool_t xor_ed, const pj_sockaddr_t *addr, unsigned addr_len, pj_stun_sockaddr_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_sockaddr_attr (pj_pool_t *pool, pj_stun_msg *msg, int attr_type, pj_bool_t xor_ed, const pj_sockaddr_t *addr, unsigned addr_len) |
| pj_status_t | pj_stun_string_attr_init (pj_stun_string_attr *attr, pj_pool_t *pool, int attr_type, const pj_str_t *value) |
| pj_status_t | pj_stun_string_attr_create (pj_pool_t *pool, int attr_type, const pj_str_t *value, pj_stun_string_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_string_attr (pj_pool_t *pool, pj_stun_msg *msg, int attr_type, const pj_str_t *value) |
| pj_status_t | pj_stun_uint_attr_create (pj_pool_t *pool, int attr_type, pj_uint32_t value, pj_stun_uint_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_uint_attr (pj_pool_t *pool, pj_stun_msg *msg, int attr_type, pj_uint32_t value) |
| pj_status_t | pj_stun_uint64_attr_create (pj_pool_t *pool, int attr_type, const pj_timestamp *value, pj_stun_uint64_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_uint64_attr (pj_pool_t *pool, pj_stun_msg *msg, int attr_type, const pj_timestamp *value) |
| pj_status_t | pj_stun_msgint_attr_create (pj_pool_t *pool, pj_stun_msgint_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_msgint_attr (pj_pool_t *pool, pj_stun_msg *msg) |
| pj_status_t | pj_stun_errcode_attr_create (pj_pool_t *pool, int err_code, const pj_str_t *err_reason, pj_stun_errcode_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_errcode_attr (pj_pool_t *pool, pj_stun_msg *msg, int err_code, const pj_str_t *err_reason) |
| pj_status_t | pj_stun_unknown_attr_create (pj_pool_t *pool, unsigned attr_cnt, const pj_uint16_t attr[], pj_stun_unknown_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_unknown_attr (pj_pool_t *pool, pj_stun_msg *msg, unsigned attr_cnt, const pj_uint16_t attr[]) |
| pj_status_t | pj_stun_binary_attr_init (pj_stun_binary_attr *attr, pj_pool_t *pool, int attr_type, const pj_uint8_t *data, unsigned length) |
| pj_status_t | pj_stun_binary_attr_create (pj_pool_t *pool, int attr_type, const pj_uint8_t *data, unsigned length, pj_stun_binary_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_binary_attr (pj_pool_t *pool, pj_stun_msg *msg, int attr_type, const pj_uint8_t *data, unsigned length) |
| pj_status_t | pj_stun_empty_attr_create (pj_pool_t *pool, int attr_type, pj_stun_empty_attr **p_attr) |
| pj_status_t | pj_stun_msg_add_empty_attr (pj_pool_t *pool, pj_stun_msg *msg, int attr_type) |
Define Documentation
| #define PJ_STUN_ERROR_RESPONSE_BIT (0x0110) |
The error response bit in the message type.
| #define PJ_STUN_GET_CH_NB |
( |
u32 |
|
) |
((pj_uint16_t)(u32>>16)) |
Get 16bit channel number from 32bit integral value. Note that uint32 attributes are always stored in host byte order after they have been parsed from the PDU, so no need to do ntohs() here.
| #define PJ_STUN_GET_METHOD |
( |
msg_type |
|
) |
((msg_type) & 0xFEEF) |
Retrieve the STUN method from the message-type field of the STUN message.
| #define PJ_STUN_GET_PROP_TYPE |
( |
u32 |
|
) |
(u32 >> 24) |
Get the 8bit Prop-type value from a 32bit integral value of TURN TURN REQUESTED-PROPS attribute.
| #define PJ_STUN_GET_RT_PROTO |
( |
u32 |
|
) |
(u32 >> 24) |
Get protocol value from 32bit TURN REQUESTED-TRANSPORT attribute.
| #define PJ_STUN_INDICATION_BIT (0x0010) |
The error response bit in the message type.
| #define PJ_STUN_IS_ERROR_RESPONSE |
( |
msg_type |
|
) |
(((msg_type) & 0x0110) == 0x0110) |
Determine if the message type is an error response.
| #define PJ_STUN_IS_INDICATION |
( |
msg_type |
|
) |
(((msg_type) & 0x0110) == 0x0010) |
Determine if the message type is an indication message.
| #define PJ_STUN_IS_REQUEST |
( |
msg_type |
|
) |
(((msg_type) & 0x0110) == 0x0000) |
Determine if the message type is a request.
| #define PJ_STUN_IS_RESPONSE |
( |
msg_type |
|
) |
(((msg_type) & 0x0100) == 0x0100) |
Determine if the message type is a response.
| #define PJ_STUN_IS_SUCCESS_RESPONSE |
( |
msg_type |
|
) |
(((msg_type) & 0x0110) == 0x0100) |
Determine if the message type is a successful response.
| #define PJ_STUN_MAGIC 0x2112A442 |
| #define PJ_STUN_SET_CH_NB |
( |
chnum |
|
) |
(((pj_uint32_t)chnum) << 16) |
Convert 16bit channel number into 32bit integral value. Note that uint32 attributes will be converted to network byte order when the attribute is written to packet, so no need to do htons() here.
| #define PJ_STUN_SET_PROP_TYPE |
( |
PropType |
|
) |
(PropType << 24) |
Convert 8bit Prop-type value to a 32bit integral value of TURN REQUESTED-PROPS attribute.
| #define PJ_STUN_SET_RT_PROTO |
( |
proto |
|
) |
(((pj_uint32_t)(proto)) << 24) |
Convert protocol value to be placed in 32bit TURN REQUESTED-TRANSPORT attribute.
| #define PJ_STUN_SUCCESS_RESPONSE_BIT (0x0100) |
The response bit in the message type.
Typedef Documentation
This describes STUN ALTERNATE-SERVER attribute. The alternate server represents an alternate transport address for a different STUN server to try. It is encoded in the same way as MAPPED-ADDRESS.
This describes STUN BANDWIDTH attribute. The bandwidth attribute represents the peak bandwidth, measured in kbits per second, that the client expects to use on the binding. The value represents the sum in the receive and send directions.
This structure describes STUN CHANGE-REQUEST attribute. The CHANGE-REQUEST attribute is used by the client to request that the server use a different address and/or port when sending the response.
Bit 29 of the value is the "change IP" flag. If true, it requests the server to send the Binding Response with a different IP address than the one the Binding Request was received on.
Bit 30 of the value is the "change port" flag. If true, it requests the server to send the Binding Response with a different port than the one the Binding Request was received on.
Note that the usage of this attribute has been deprecated by the RFC 3489-bis standard.
This structure describes STUN CHANGED-ADDRESS attribute. The CHANGED-ADDRESS attribute indicates the IP address and port where responses would have been sent from if the "change IP" and "change port" flags had been set in the CHANGE-REQUEST attribute of the Binding Request. The attribute is always present in a Binding Response, independent of the value of the flags. Its syntax is identical to MAPPED-ADDRESS.
Note that the usage of this attribute has been deprecated by the RFC 3489-bis standard.
This describes TURN CHANNEL-NUMBER attribute. In this library, this attribute is represented with 32bit integer. Application may use PJ_STUN_GET_CH_NB() and PJ_STUN_SET_CH_NB() to extract/set channel number value from the 32bit integral value.
The CHANNEL-NUMBER attribute contains the number of the channel. It is a 16-bit unsigned integer, followed by a two-octet RFFU field which MUST be set to 0 on transmission and ignored on reception.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Channel Number | RFFU |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This describes the STUN DATA attribute. The DATA attribute is present in Send Indications and Data Indications. It contains raw payload data that is to be sent (in the case of a Send Request) or was received (in the case of a Data Indication)..
This structure describes STUN FINGERPRINT attribute. The FINGERPRINT attribute can be present in all STUN messages. It is computed as the CRC-32 of the STUN message up to (but excluding) the FINGERPRINT attribute itself, xor-d with the 32 bit value 0x5354554e
This describes ICE-CONTROLLED attribute.
This describes ICE-CONTROLLING attribute.
This describes TURN ICMP attribute
This describes STUN LIFETIME attribute. The lifetime attribute represents the duration for which the server will maintain an allocation in the absence of data traffic either from or to the client. It is a 32 bit value representing the number of seconds remaining until expiration.
This structure describes STUN MAPPED-ADDRESS attribute. The MAPPED-ADDRESS attribute indicates the mapped transport address.
This describes STUN NONCE attribute. The NONCE attribute is present in requests and in error responses. It contains a sequence of qdtext or quoted-pair, which are defined in RFC 3261 [11]. See RFC 2617 [7] for guidance on selection of nonce values in a server.
This describes STUN PASSWORD attribute. If the message type is Shared Secret Response it MUST include the PASSWORD attribute.
This describes the STUN PEER-ADDRESS attribute. The PEER-ADDRESS specifies the address and port of the peer as seen from the TURN server. It is encoded in the same way as XOR-MAPPED- ADDRESS.
This describes the PRIORITY attribute from draft-ietf-mmusic-ice-13. The PRIORITY attribute indicates the priority that is to be associated with a peer reflexive candidate, should one be discovered by this check. It is a 32 bit unsigned integer, and has an attribute type of 0x0024.
This describes STUN REALM attribute. The REALM attribute is present in requests and responses. It contains text which meets the grammar for "realm" as described in RFC 3261 [11], and will thus contain a quoted string (including the quotes).
This describes the STUN REFLECTED-FROM attribute. The REFLECTED-FROM attribute is present only in Binding Responses, when the Binding Request contained a RESPONSE-ADDRESS attribute. The attribute contains the identity (in terms of IP address) of the source where the request came from. Its purpose is to provide traceability, so that a STUN server cannot be used as a reflector for denial-of-service attacks.
This describes STUN REFRESH-INTERVAL attribute. The REFRESH-INTERVAL indicates the number of milliseconds that the server suggests the client should use between refreshes of the NAT bindings between the client and server.
This describes the STUN RELAYED-ADDRESS attribute. The RELAYED-ADDRESS is present in Allocate responses. It specifies the address and port that the server allocated to the client. It is encoded in the same way as XOR-MAPPED-ADDRESS.
This describes the REQUESTED-ADDRESS-TYPE attribute. The REQUESTED-ADDRESS-TYPE attribute is used by clients to request the allocation of a specific address type from a server. The following is the format of the REQUESTED-ADDRESS-TYPE attribute.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Family | Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This describes the TURN REQUESTED-PROPS attribute, encoded as STUN 32bit integer attribute. Few macros are provided to manipulate the values in this attribute: PJ_STUN_GET_PROP_TYPE(), and PJ_STUN_SET_PROP_TYPE().
This attribute allows the client to request that the allocation have certain properties, and by the server to indicate which properties are supported. The attribute is 32 bits long. Its format is:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Prop-type | Reserved = 0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The field labeled "Prop-type" is an 8-bit field specifying the desired property. The rest of the attribute is RFFU (Reserved For Future Use) and MUST be set to 0 on transmission and ignored on reception.
The "Prop-type" field is formatted as follows:
0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+
|E|R|P| |
+-+-+-+-+-+-+-+-+
The bits in "Prop-type" are:
E: If 1, the port number for the relayed-transport-address must be even. If 0, the port number can be even or odd.
R: If 1, the server must reserve the next highest port for a subsequent allocation. If 0, no such reservation is requested. If the client sets the R bit to 1, it MUST also set the E bit to 1 (however, the E bit may be 1 when the R bit is 0).
P: If 1, the allocation must be a Preserving allocation. If 0, the allocation can be either Preserving or Non-Preserving.
This describes the TURN REQUESTED-TRANSPORT attribute, encoded in STUN generic integer attribute.
This attribute is used by the client to request a specific transport protocol for the allocated transport address. It has the following format:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Protocol | RFFU |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The Protocol field specifies the desired protocol. The codepoints used in this field are taken from those allowed in the Protocol field in the IPv4 header and the NextHeader field in the IPv6 header [Protocol-Numbers]. This specification only allows the use of codepoint 17 (User Datagram Protocol).
The RFFU field is set to zero on transmission and ignored on receiption. It is reserved for future uses.
This describes the TURN RESERVATION-TOKEN attribute. The RESERVATION-TOKEN attribute contains a token that uniquely identifies a relayed transport address being held in reserve by the server. The server includes this attribute in a success response to tell the client about the token, and the client includes this attribute in a subsequent Allocate request to request the server use that relayed transport address for the allocation.
The attribute value is a 64-bit-long field containing the token value.
This structure describes STUN RESPONSE-ADDRESS attribute. The RESPONSE-ADDRESS attribute indicates where the response to a Binding Request should be sent. Its syntax is identical to MAPPED- ADDRESS.
Note that the usage of this attribute has been deprecated by the RFC 3489-bis standard.
This describes STUN SOFTWARE attribute. The SOFTWARE attribute contains a textual description of the software being used by the agent sending the message. It is used by clients and servers. Its value SHOULD include manufacturer and version number.
This structure describes STUN SOURCE-ADDRESS attribute. The SOURCE-ADDRESS attribute is present in Binding Responses. It indicates the source IP address and port that the server is sending the response from. Its syntax is identical to that of MAPPED- ADDRESS.
Note that the usage of this attribute has been deprecated by the RFC 3489-bis standard.
This describes the STUN TIMER-VAL attribute. The TIMER-VAL attribute is used only in conjunction with the Set Active Destination response. It conveys from the server, to the client, the value of the timer used in the server state machine.
This describes the USE-CANDIDATE attribute from draft-ietf-mmusic-ice-13. The USE-CANDIDATE attribute indicates that the candidate pair resulting from this check should be used for transmission of media. The attribute has no content (the Length field of the attribute is zero); it serves as a flag.
This describes STUN USERNAME attribute. The USERNAME attribute is used for message integrity. It identifies the shared secret used in the message integrity check. Consequently, the USERNAME MUST be included in any request that contains the MESSAGE-INTEGRITY attribute.
This describes STUN XOR-MAPPED-ADDRESS attribute (which has the same format as STUN MAPPED-ADDRESS attribute). The XOR-MAPPED-ADDRESS attribute is present in responses. It provides the same information that would present in the MAPPED- ADDRESS attribute but because the NAT's public IP address is obfuscated through the XOR function, STUN messages are able to pass through NATs which would otherwise interfere with STUN.
This describes the XOR-REFLECTED-FROM attribute, as described by draft-macdonald-behave-nat-behavior-discovery-00. The XOR-REFLECTED-FROM attribute is used in place of the REFLECTED- FROM attribute. It provides the same information, but because the NAT's public address is obfuscated through the XOR function, It can pass through a NAT that would otherwise attempt to translate it to the private network address. XOR-REFLECTED-FROM has identical syntax to XOR-MAPPED-ADDRESS.
Enumeration Type Documentation
This enumeration describes STUN attribute types. - Enumerator:
-
| PJ_STUN_ATTR_MAPPED_ADDR |
MAPPED-ADDRESS. |
| PJ_STUN_ATTR_RESPONSE_ADDR |
RESPONSE-ADDRESS (deprcatd) |
| PJ_STUN_ATTR_CHANGE_REQUEST |
CHANGE-REQUEST (deprecated) |
| PJ_STUN_ATTR_SOURCE_ADDR |
SOURCE-ADDRESS (deprecated) |
| PJ_STUN_ATTR_CHANGED_ADDR |
CHANGED-ADDRESS (deprecatd) |
| PJ_STUN_ATTR_USERNAME |
USERNAME attribute. |
| PJ_STUN_ATTR_PASSWORD |
was PASSWORD attribute. |
| PJ_STUN_ATTR_MESSAGE_INTEGRITY |
MESSAGE-INTEGRITY. |
| PJ_STUN_ATTR_ERROR_CODE |
ERROR-CODE. |
| PJ_STUN_ATTR_UNKNOWN_ATTRIBUTES |
UNKNOWN-ATTRIBUTES. |
| PJ_STUN_ATTR_REFLECTED_FROM |
REFLECTED-FROM (deprecatd) |
| PJ_STUN_ATTR_CHANNEL_NUMBER |
TURN CHANNEL-NUMBER |
| PJ_STUN_ATTR_LIFETIME |
TURN LIFETIME attr. |
| PJ_STUN_ATTR_MAGIC_COOKIE |
MAGIC-COOKIE attr (deprec) |
| PJ_STUN_ATTR_BANDWIDTH |
TURN BANDWIDTH (deprec) |
| PJ_STUN_ATTR_PEER_ADDR |
TURN PEER-ADDRESS attr. |
| PJ_STUN_ATTR_DATA |
DATA attribute. |
| PJ_STUN_ATTR_REALM |
REALM attribute. |
| PJ_STUN_ATTR_NONCE |
NONCE attribute. |
| PJ_STUN_ATTR_RELAYED_ADDR |
RELAYED-ADDRESS attribute. |
| PJ_STUN_ATTR_REQ_ADDR_TYPE |
REQUESTED-ADDRESS-TYPE |
| PJ_STUN_ATTR_REQ_PROPS |
REQUESTED-PROPS |
| PJ_STUN_ATTR_REQ_TRANSPORT |
REQUESTED-TRANSPORT |
| PJ_STUN_ATTR_XOR_MAPPED_ADDR |
XOR-MAPPED-ADDRESS |
| PJ_STUN_ATTR_TIMER_VAL |
TIMER-VAL attribute. |
| PJ_STUN_ATTR_RESERVATION_TOKEN |
TURN RESERVATION-TOKEN |
| PJ_STUN_ATTR_XOR_REFLECTED_FROM |
XOR-REFLECTED-FROM |
| PJ_STUN_ATTR_PRIORITY |
PRIORITY |
| PJ_STUN_ATTR_USE_CANDIDATE |
USE-CANDIDATE |
| PJ_STUN_ATTR_ICMP |
ICMP (TURN) |
| PJ_STUN_ATTR_SOFTWARE |
SOFTWARE attribute. |
| PJ_STUN_ATTR_ALTERNATE_SERVER |
ALTERNATE-SERVER. |
| PJ_STUN_ATTR_REFRESH_INTERVAL |
REFRESH-INTERVAL. |
| PJ_STUN_ATTR_FINGERPRINT |
FINGERPRINT attribute. |
| PJ_STUN_ATTR_ICE_CONTROLLED |
ICE-CCONTROLLED attribute. |
| PJ_STUN_ATTR_ICE_CONTROLLING |
ICE-CCONTROLLING attribute |
STUN decoding options - Enumerator:
-
| PJ_STUN_IS_DATAGRAM |
Tell the decoder that the message was received from datagram oriented transport (such as UDP). |
| PJ_STUN_CHECK_PACKET |
Tell pj_stun_msg_decode() to check the validity of the STUN message by calling pj_stun_msg_check() before starting to decode the packet. |
| PJ_STUN_NO_AUTHENTICATE |
This option current is only valid for pj_stun_session_on_rx_pkt(). When specified, it tells the session NOT to authenticate the message. |
| PJ_STUN_NO_FINGERPRINT_CHECK |
Disable FINGERPRINT verification. This option can be used when calling pj_stun_msg_check() and pj_stun_msg_decode() to disable the verification of FINGERPRINT, for example when the STUN usage says when FINGERPRINT mechanism shall not be used. |
STUN method constants. - Enumerator:
-
| PJ_STUN_BINDING_METHOD |
STUN Binding method as defined by RFC 3489-bis. |
| PJ_STUN_SHARED_SECRET_METHOD |
STUN Shared Secret method as defined by RFC 3489-bis. |
| PJ_STUN_ALLOCATE_METHOD |
STUN/TURN Allocate method as defined by draft-ietf-behave-turn |
| PJ_STUN_REFRESH_METHOD |
STUN/TURN Refresh method as defined by draft-ietf-behave-turn |
| PJ_STUN_SEND_METHOD |
STUN/TURN Send indication as defined by draft-ietf-behave-turn |
| PJ_STUN_DATA_METHOD |
STUN/TURN Data indication as defined by draft-ietf-behave-turn |
| PJ_STUN_CHANNEL_BIND_METHOD |
STUN/TURN ChannelBind as defined by draft-ietf-behave-turn |
| PJ_STUN_METHOD_MAX |
All known methods. |
STUN message classes constants. - Enumerator:
-
| PJ_STUN_REQUEST_CLASS |
This specifies that the message type is |
|