summaryrefslogtreecommitdiff
path: root/stun
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2009-02-23 17:49:25 -0500
committerYouness Alaoui <youness.alaoui@collabora.co.uk>2009-02-23 17:49:25 -0500
commit30275785558717bf20d186a0a283df9db7160ef9 (patch)
treee1535b17f0cc53771311425ee046725b605374ac /stun
parent8a92ba9443784526b34e3537988ae6e7d1a56740 (diff)
downloadlibnice-30275785558717bf20d186a0a283df9db7160ef9.tar.gz
Remove some turn defines and use an enum instead (StunUsageTurnRequestPorts) and document a little
Diffstat (limited to 'stun')
-rw-r--r--stun/usages/turn.c5
-rw-r--r--stun/usages/turn.h35
2 files changed, 29 insertions, 11 deletions
diff --git a/stun/usages/turn.c b/stun/usages/turn.c
index 7a44e53..dc327d9 100644
--- a/stun/usages/turn.c
+++ b/stun/usages/turn.c
@@ -68,7 +68,7 @@
size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg,
uint8_t *buffer, size_t buffer_len,
StunMessage *previous_response,
- uint32_t request_props,
+ StunUsageTurnRequestPorts request_props,
int32_t bandwidth, int32_t lifetime,
uint8_t *username, size_t username_len,
uint8_t *password, size_t password_len,
@@ -108,9 +108,6 @@ size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg,
} else if (request_props & STUN_USAGE_TURN_REQUEST_PORT_EVEN) {
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,
req) != STUN_MESSAGE_RETURN_SUCCESS)
diff --git a/stun/usages/turn.h b/stun/usages/turn.h
index 40df090..39f5f15 100644
--- a/stun/usages/turn.h
+++ b/stun/usages/turn.h
@@ -53,12 +53,33 @@
extern "C" {
# 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)
-#define STUN_USAGE_TURN_REQUEST_PORT_EVEN_AND_RESERVE (1<<1)
-#define STUN_USAGE_TURN_REQUEST_PORT_PRESERVING (1<<2)
-
+/**
+ * StunUsageTurnCompatibility:
+ * @STUN_USAGE_TURN_COMPATIBILITY_DRAFT9: Use the specification compatible with
+ * 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 {
STUN_USAGE_TURN_COMPATIBILITY_DRAFT9,
STUN_USAGE_TURN_COMPATIBILITY_GOOGLE,
@@ -76,8 +97,8 @@ typedef enum {
size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg,
uint8_t *buffer, size_t buffer_len,
- StunMessage *previous_request,
- uint32_t request_ports,
+ StunMessage *previous_response,
+ StunUsageTurnRequestPorts request_ports,
int32_t bandwidth, int32_t lifetime,
uint8_t *username, size_t username_len,
uint8_t *password, size_t password_len,