Commit 30275785 authored by Youness Alaoui's avatar Youness Alaoui

Remove some turn defines and use an enum instead (StunUsageTurnRequestPorts) and document a little

parent 8a92ba94
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg, size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg,
uint8_t *buffer, size_t buffer_len, uint8_t *buffer, size_t buffer_len,
StunMessage *previous_response, StunMessage *previous_response,
uint32_t request_props, StunUsageTurnRequestPorts request_props,
int32_t bandwidth, int32_t lifetime, int32_t bandwidth, int32_t lifetime,
uint8_t *username, size_t username_len, uint8_t *username, size_t username_len,
uint8_t *password, size_t password_len, uint8_t *password, size_t password_len,
...@@ -108,9 +108,6 @@ size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg, ...@@ -108,9 +108,6 @@ size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg,
} else if (request_props & STUN_USAGE_TURN_REQUEST_PORT_EVEN) { } else if (request_props & STUN_USAGE_TURN_REQUEST_PORT_EVEN) {
req |= REQUESTED_PROPS_E; req |= REQUESTED_PROPS_E;
} }
if (request_props & STUN_USAGE_TURN_REQUEST_PORT_PRESERVING) {
req |= REQUESTED_PROPS_P;
}
if (stun_message_append32 (msg, STUN_ATTRIBUTE_REQUESTED_PORT_PROPS, if (stun_message_append32 (msg, STUN_ATTRIBUTE_REQUESTED_PORT_PROPS,
req) != STUN_MESSAGE_RETURN_SUCCESS) req) != STUN_MESSAGE_RETURN_SUCCESS)
......
...@@ -53,12 +53,33 @@ ...@@ -53,12 +53,33 @@
extern "C" { extern "C" {
# endif # endif
/**
* StunUsageTurnRequestPorts:
* @STUN_USAGE_TURN_REQUEST_PORT_NORMAL: Request a normal port
* @STUN_USAGE_TURN_REQUEST_PORT_EVEN: Request an even port
* @STUN_USAGE_TURN_REQUEST_PORT_EVEN_AND_RESERVE: Request an even port and
* reserve the next higher port
*
* This enum is used to specify which port configuration you want when creating
* a new Allocation
*/
typedef enum {
STUN_USAGE_TURN_REQUEST_PORT_NORMAL = 0,
STUN_USAGE_TURN_REQUEST_PORT_EVEN = 1,
STUN_USAGE_TURN_REQUEST_PORT_EVEN_AND_RESERVE = 2
} StunUsageTurnRequestPorts;
#define STUN_USAGE_TURN_REQUEST_PORT_NORMAL (0) /**
#define STUN_USAGE_TURN_REQUEST_PORT_EVEN (1) * StunUsageTurnCompatibility:
#define STUN_USAGE_TURN_REQUEST_PORT_EVEN_AND_RESERVE (1<<1) * @STUN_USAGE_TURN_COMPATIBILITY_DRAFT9: Use the specification compatible with
#define STUN_USAGE_TURN_REQUEST_PORT_PRESERVING (1<<2) * TURN Draft 09
* @STUN_USAGE_TURN_COMPATIBILITY_GOOGLE: Use the specification compatible with
* Google Talk's relay server
* @STUN_USAGE_TURN_COMPATIBILITY_MSN: Use the specification compatible with
* MSN TURN servers
*
* Specifies which TURN specification compatibility to use
*/
typedef enum { typedef enum {
STUN_USAGE_TURN_COMPATIBILITY_DRAFT9, STUN_USAGE_TURN_COMPATIBILITY_DRAFT9,
STUN_USAGE_TURN_COMPATIBILITY_GOOGLE, STUN_USAGE_TURN_COMPATIBILITY_GOOGLE,
...@@ -76,8 +97,8 @@ typedef enum { ...@@ -76,8 +97,8 @@ typedef enum {
size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg, size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg,
uint8_t *buffer, size_t buffer_len, uint8_t *buffer, size_t buffer_len,
StunMessage *previous_request, StunMessage *previous_response,
uint32_t request_ports, StunUsageTurnRequestPorts request_ports,
int32_t bandwidth, int32_t lifetime, int32_t bandwidth, int32_t lifetime,
uint8_t *username, size_t username_len, uint8_t *username, size_t username_len,
uint8_t *password, size_t password_len, uint8_t *password, size_t password_len,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment