spring cleaning

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4795 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-03-29 22:31:56 +00:00
parent a021945cef
commit 3a54126261
143 changed files with 22413 additions and 31567 deletions
+59 -63
View File
@@ -38,59 +38,57 @@
#define _SWITCH_STUN_PARSER_H
SWITCH_BEGIN_EXTERN_C
#define SWITCH_STUN_DEFAULT_PORT 3478
#define SWITCH_STUN_PACKET_MIN_LEN 20
typedef enum {
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
typedef enum {
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
} switch_stun_message_t;
typedef enum {
SWITCH_STUN_ATTR_MAPPED_ADDRESS = 0x0001, /* Address */
SWITCH_STUN_ATTR_RESPONSE_ADDRESS = 0x0002, /* Address */
SWITCH_STUN_ATTR_CHANGE_REQUEST = 0x0003, /* UInt32 */
SWITCH_STUN_ATTR_SOURCE_ADDRESS = 0x0004, /* Address */
SWITCH_STUN_ATTR_CHANGED_ADDRESS = 0x0005, /* Address */
SWITCH_STUN_ATTR_USERNAME = 0x0006, /* ByteString, multiple of 4 bytes */
SWITCH_STUN_ATTR_PASSWORD = 0x0007, /* ByteString, multiple of 4 bytes */
SWITCH_STUN_ATTR_MESSAGE_INTEGRITY = 0x0008, /* ByteString, 20 bytes */
SWITCH_STUN_ATTR_ERROR_CODE = 0x0009, /* ErrorCode */
SWITCH_STUN_ATTR_UNKNOWN_ATTRIBUTES = 0x000a, /* UInt16List */
SWITCH_STUN_ATTR_REFLECTED_FROM = 0x000b, /* Address */
SWITCH_STUN_ATTR_TRANSPORT_PREFERENCES = 0x000c, /* TransportPrefs */
SWITCH_STUN_ATTR_LIFETIME = 0x000d, /* UInt32 */
SWITCH_STUN_ATTR_ALTERNATE_SERVER = 0x000e, /* Address */
SWITCH_STUN_ATTR_MAGIC_COOKIE = 0x000f, /* ByteString, 4 bytes */
SWITCH_STUN_ATTR_BANDWIDTH = 0x0010, /* UInt32 */
SWITCH_STUN_ATTR_DESTINATION_ADDRESS = 0x0011, /* Address */
SWITCH_STUN_ATTR_SOURCE_ADDRESS2 = 0x0012, /* Address */
SWITCH_STUN_ATTR_DATA = 0x0013, /* ByteString */
SWITCH_STUN_ATTR_OPTIONS = 0x8001 /* UInt32 */
SWITCH_STUN_ATTR_MAPPED_ADDRESS = 0x0001, /* Address */
SWITCH_STUN_ATTR_RESPONSE_ADDRESS = 0x0002, /* Address */
SWITCH_STUN_ATTR_CHANGE_REQUEST = 0x0003, /* UInt32 */
SWITCH_STUN_ATTR_SOURCE_ADDRESS = 0x0004, /* Address */
SWITCH_STUN_ATTR_CHANGED_ADDRESS = 0x0005, /* Address */
SWITCH_STUN_ATTR_USERNAME = 0x0006, /* ByteString, multiple of 4 bytes */
SWITCH_STUN_ATTR_PASSWORD = 0x0007, /* ByteString, multiple of 4 bytes */
SWITCH_STUN_ATTR_MESSAGE_INTEGRITY = 0x0008, /* ByteString, 20 bytes */
SWITCH_STUN_ATTR_ERROR_CODE = 0x0009, /* ErrorCode */
SWITCH_STUN_ATTR_UNKNOWN_ATTRIBUTES = 0x000a, /* UInt16List */
SWITCH_STUN_ATTR_REFLECTED_FROM = 0x000b, /* Address */
SWITCH_STUN_ATTR_TRANSPORT_PREFERENCES = 0x000c, /* TransportPrefs */
SWITCH_STUN_ATTR_LIFETIME = 0x000d, /* UInt32 */
SWITCH_STUN_ATTR_ALTERNATE_SERVER = 0x000e, /* Address */
SWITCH_STUN_ATTR_MAGIC_COOKIE = 0x000f, /* ByteString, 4 bytes */
SWITCH_STUN_ATTR_BANDWIDTH = 0x0010, /* UInt32 */
SWITCH_STUN_ATTR_DESTINATION_ADDRESS = 0x0011, /* Address */
SWITCH_STUN_ATTR_SOURCE_ADDRESS2 = 0x0012, /* Address */
SWITCH_STUN_ATTR_DATA = 0x0013, /* ByteString */
SWITCH_STUN_ATTR_OPTIONS = 0x8001 /* UInt32 */
} switch_stun_attribute_t;
typedef enum {
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
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
} switch_stun_error_t;
typedef enum {
@@ -138,7 +136,7 @@ SWITCH_DECLARE(void) switch_stun_random_string(char *buf, uint16_t len, char *se
\param len the length of the data
\return a stun packet pointer to buf to use as an access point
*/
SWITCH_DECLARE(switch_stun_packet_t *)switch_stun_packet_parse(uint8_t *buf, uint32_t len);
SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t * buf, uint32_t len);
/*!
\brief Obtain a printable string form of a given value
@@ -146,7 +144,7 @@ SWITCH_DECLARE(switch_stun_packet_t *)switch_stun_packet_parse(uint8_t *buf, uin
\param value the value to look up
\return a sring version of value
*/
SWITCH_DECLARE(const char *)switch_stun_value_to_name(int32_t type, uint32_t value);
SWITCH_DECLARE(const char *) switch_stun_value_to_name(int32_t type, uint32_t value);
/*!
@@ -156,7 +154,8 @@ SWITCH_DECLARE(const char *)switch_stun_value_to_name(int32_t type, uint32_t val
\param port the port
\return true or false
*/
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t *port);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute,
char *ipstr, uint16_t * port);
/*!
\brief Extract a username from a packet attribute
@@ -165,7 +164,8 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_s
\param len the maximum size of the username buffer
\return a pointer to the username or NULL
*/
SWITCH_DECLARE(char *)switch_stun_packet_attribute_get_username(switch_stun_packet_attribute_t *attribute, char *username, uint16_t len);
SWITCH_DECLARE(char *) switch_stun_packet_attribute_get_username(switch_stun_packet_attribute_t *attribute,
char *username, uint16_t len);
/*!
@@ -175,10 +175,8 @@ SWITCH_DECLARE(char *)switch_stun_packet_attribute_get_username(switch_stun_pack
\param buf a pointer to data to use for the packet
\return a pointer to a ready-to-use stun packet
*/
SWITCH_DECLARE(switch_stun_packet_t *)switch_stun_packet_build_header(switch_stun_message_t type,
char *id,
uint8_t *buf
);
SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_stun_message_t type,
char *id, uint8_t * buf);
/*!
\brief Add a username packet attribute
@@ -187,7 +185,8 @@ SWITCH_DECLARE(switch_stun_packet_t *)switch_stun_packet_build_header(switch_stu
\param ulen the length of the username
\return true or false
*/
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_packet_t *packet, char *username, uint16_t ulen);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_packet_t *packet, char *username,
uint16_t ulen);
/*!
@@ -197,7 +196,8 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_pa
\param port the port of the mapped address
\return true or false
*/
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_stun_packet_t *packet, char *ipstr, uint16_t port);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_stun_packet_t *packet, char *ipstr,
uint16_t port);
/*!
\brief Perform a stun lookup
@@ -209,12 +209,10 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_s
\param pool the memory pool to use
\return SUCCESS or FAIL
*/
SWITCH_DECLARE(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);
SWITCH_DECLARE(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);
@@ -241,9 +239,7 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup (char **ip,
///\}
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
* Local Variables:
* mode:c