|
Data Structures |
| struct | switch_stun_packet_header_t |
| struct | switch_stun_packet_attribute_t |
| struct | switch_stun_packet_t |
| struct | switch_stun_ip_t |
Defines |
| #define | SWITCH_STUN_DEFAULT_PORT 3478 |
| #define | SWITCH_STUN_PACKET_MIN_LEN 20 |
| #define | SWITCH_STUN_ATTRIBUTE_MIN_LEN 8 |
| #define | switch_stun_attribute_padded_length(attribute) ((uint16_t)(attribute->length + (sizeof(uint32_t)-1)) & ~sizeof(uint32_t)) |
| | Obtain the padded length of an attribute's value.
|
| #define | switch_stun_packet_first_attribute(packet, attribute) attribute = (switch_stun_packet_attribute_t *)(&packet->first_attribute); |
| | set a switch_stun_packet_attribute_t pointer to point at the first attribute in a packet
|
| #define | switch_stun_packet_next_attribute(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length(attribute))) && ((void *)attribute < end) && attribute->length && ((void *)(attribute + switch_stun_attribute_padded_length(attribute)) < end)) |
| | Increment an attribute pointer to the next attribute in it's packet.
|
| #define | switch_stun_packet_length(packet) ntohs(packet->header.length) + (sizeof(switch_stun_packet_header_t)) |
| | Obtain the correct length in bytes of a stun packet.
|
Enumerations |
| enum | switch_stun_message_t {
SWITCH_STUN_BINDING_REQUEST = 0x0001,
SWITCH_STUN_BINDING_RESPONSE = 0x0101,
SWITCH_STUN_BINDING_ERROR_RESPONSE = 0x0111,
SWITCH_STUN_SHARED_SECRET_REQUEST = 0x0002,
SWITCH_STUN_SHARED_SECRET_RESPONSE = 0x0102,
SWITCH_STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112,
SWITCH_STUN_ALLOCATE_REQUEST = 0x0003,
SWITCH_STUN_ALLOCATE_RESPONSE = 0x0103,
SWITCH_STUN_ALLOCATE_ERROR_RESPONSE = 0x0113,
SWITCH_STUN_SEND_REQUEST = 0x0004,
SWITCH_STUN_SEND_RESPONSE = 0x0104,
SWITCH_STUN_SEND_ERROR_RESPONSE = 0x0114,
SWITCH_STUN_DATA_INDICATION = 0x0115
} |
| enum | switch_stun_attribute_t {
SWITCH_STUN_ATTR_MAPPED_ADDRESS = 0x0001,
SWITCH_STUN_ATTR_RESPONSE_ADDRESS = 0x0002,
SWITCH_STUN_ATTR_CHANGE_REQUEST = 0x0003,
SWITCH_STUN_ATTR_SOURCE_ADDRESS = 0x0004,
SWITCH_STUN_ATTR_CHANGED_ADDRESS = 0x0005,
SWITCH_STUN_ATTR_USERNAME = 0x0006,
SWITCH_STUN_ATTR_PASSWORD = 0x0007,
SWITCH_STUN_ATTR_MESSAGE_INTEGRITY = 0x0008,
SWITCH_STUN_ATTR_ERROR_CODE = 0x0009,
SWITCH_STUN_ATTR_UNKNOWN_ATTRIBUTES = 0x000a,
SWITCH_STUN_ATTR_REFLECTED_FROM = 0x000b,
SWITCH_STUN_ATTR_TRANSPORT_PREFERENCES = 0x000c,
SWITCH_STUN_ATTR_LIFETIME = 0x000d,
SWITCH_STUN_ATTR_ALTERNATE_SERVER = 0x000e,
SWITCH_STUN_ATTR_MAGIC_COOKIE = 0x000f,
SWITCH_STUN_ATTR_BANDWIDTH = 0x0010,
SWITCH_STUN_ATTR_DESTINATION_ADDRESS = 0x0011,
SWITCH_STUN_ATTR_SOURCE_ADDRESS2 = 0x0012,
SWITCH_STUN_ATTR_DATA = 0x0013,
SWITCH_STUN_ATTR_OPTIONS = 0x8001
} |
| enum | switch_stun_error_t {
SWITCH_STUN_ERROR_BAD_REQUEST = 400,
SWITCH_STUN_ERROR_UNAUTHORIZED = 401,
SWITCH_STUN_ERROR_UNKNOWN_ATTRIBUTE = 420,
SWITCH_STUN_ERROR_STALE_CREDENTIALS = 430,
SWITCH_STUN_ERROR_INTEGRITY_CHECK_FAILURE = 431,
SWITCH_STUN_ERROR_MISSING_USERNAME = 432,
SWITCH_STUN_ERROR_USE_TLS = 433,
SWITCH_STUN_ERROR_SERVER_ERROR = 500,
SWITCH_STUN_ERROR_GLOBAL_FAILURE = 600
} |
| enum | switch_stun_type_t { SWITCH_STUN_TYPE_PACKET_TYPE,
SWITCH_STUN_TYPE_ATTRIBUTE,
SWITCH_STUN_TYPE_ERROR
} |
Functions |
| void | switch_stun_random_string (char *buf, uint16_t len, char *set) |
| | Writes random characters into a buffer.
|
| switch_stun_packet_t * | switch_stun_packet_parse (uint8_t *buf, uint32_t len) |
| | Prepare a raw packet for parsing.
|
| const char * | switch_stun_value_to_name (int32_t type, uint32_t value) |
| | Obtain a printable string form of a given value.
|
| uint8_t | switch_stun_packet_attribute_get_mapped_address (switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t *port) |
| | Extract a mapped address (IP:PORT) from a packet attribute.
|
| char * | switch_stun_packet_attribute_get_username (switch_stun_packet_attribute_t *attribute, char *username, uint16_t len) |
| | Extract a username from a packet attribute.
|
| switch_stun_packet_t * | switch_stun_packet_build_header (switch_stun_message_t type, char *id, uint8_t *buf) |
| | Prepare a new outbound packet of a certian type and id.
|
| uint8_t | switch_stun_packet_attribute_add_username (switch_stun_packet_t *packet, char *username, uint16_t ulen) |
| | Add a username packet attribute.
|
| uint8_t | switch_stun_packet_attribute_add_binded_address (switch_stun_packet_t *packet, char *ipstr, uint16_t port) |
| | Add a binded address packet attribute.
|
| switch_status_t | switch_stun_lookup (char **ip, switch_port_t *port, char *stunip, switch_port_t stunport, char **err, switch_memory_pool_t *pool) |
| | Perform a stun lookup.
|