Commit 8b971219 authored by Youness Alaoui's avatar Youness Alaoui

Rename stun_has_cookie into stun_message_has_cookie

parent 7d5a2667
...@@ -70,7 +70,7 @@ uint32_t stun_fingerprint (const uint8_t *msg, size_t len) ...@@ -70,7 +70,7 @@ uint32_t stun_fingerprint (const uint8_t *msg, size_t len)
return htonl (crc32 (data, 3) ^ 0x5354554e); return htonl (crc32 (data, 3) ^ 0x5354554e);
} }
bool stun_has_cookie (const StunMessage *msg) bool stun_message_has_cookie (const StunMessage *msg)
{ {
StunTransactionId id; StunTransactionId id;
uint32_t cookie = htonl (STUN_MAGIC_COOKIE); uint32_t cookie = htonl (STUN_MAGIC_COOKIE);
......
...@@ -60,14 +60,14 @@ ...@@ -60,14 +60,14 @@
uint32_t stun_fingerprint (const uint8_t *msg, size_t len); uint32_t stun_fingerprint (const uint8_t *msg, size_t len);
/** /**
* stun_has_cookie: * stun_message_has_cookie:
* @msg: The #StunMessage * @msg: The #StunMessage
* *
* Checks if the STUN message has a RFC5389 compatible cookie * Checks if the STUN message has a RFC5389 compatible cookie
* *
* Returns: %TRUE if the cookie is present, %FALSE otherwise * Returns: %TRUE if the cookie is present, %FALSE otherwise
*/ */
bool stun_has_cookie (const StunMessage *msg); bool stun_message_has_cookie (const StunMessage *msg);
StunMessageReturn stun_message_append_software (StunMessage *msg); StunMessageReturn stun_message_append_software (StunMessage *msg);
......
...@@ -131,7 +131,7 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg, ...@@ -131,7 +131,7 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
/* TODO: reject it or not ? */ /* TODO: reject it or not ? */
if ((agent->compatibility == STUN_COMPATIBILITY_RFC5389 || if ((agent->compatibility == STUN_COMPATIBILITY_RFC5389 ||
agent->compatibility == STUN_COMPATIBILITY_WLM2009) && agent->compatibility == STUN_COMPATIBILITY_WLM2009) &&
!stun_has_cookie (msg)) { !stun_message_has_cookie (msg)) {
stun_debug ("STUN demux error: no cookie!\n"); stun_debug ("STUN demux error: no cookie!\n");
return STUN_VALIDATION_BAD_REQUEST; return STUN_VALIDATION_BAD_REQUEST;
} }
...@@ -470,7 +470,7 @@ size_t stun_agent_build_unknown_attributes_error (StunAgent *agent, ...@@ -470,7 +470,7 @@ size_t stun_agent_build_unknown_attributes_error (StunAgent *agent,
/* NOTE: Old RFC3489 compatibility: /* NOTE: Old RFC3489 compatibility:
* When counter is odd, duplicate one value for 32-bits padding. */ * When counter is odd, duplicate one value for 32-bits padding. */
if (!stun_has_cookie (request) && (counter & 1)) if (!stun_message_has_cookie (request) && (counter & 1))
ids[counter++] = ids[0]; ids[counter++] = ids[0];
if (stun_message_append_bytes (msg, STUN_ATTRIBUTE_UNKNOWN_ATTRIBUTES, if (stun_message_append_bytes (msg, STUN_ATTRIBUTE_UNKNOWN_ATTRIBUTES,
......
...@@ -320,7 +320,7 @@ stun_message_append (StunMessage *msg, StunAttribute type, size_t length) ...@@ -320,7 +320,7 @@ stun_message_append (StunMessage *msg, StunAttribute type, size_t length)
a = stun_setw (a, type); a = stun_setw (a, type);
/* NOTE: If cookie is not present, we need to force the attribute length /* NOTE: If cookie is not present, we need to force the attribute length
* to a multiple of 4 for compatibility with old RFC3489 */ * to a multiple of 4 for compatibility with old RFC3489 */
a = stun_setw (a, stun_has_cookie (msg) ? length : stun_align (length)); a = stun_setw (a, stun_message_has_cookie (msg) ? length : stun_align (length));
mlen += 4 + length; mlen += 4 + length;
/* Add padding if needed */ /* Add padding if needed */
......
...@@ -250,7 +250,7 @@ static int dgram_process (int sock, StunAgent *oldagent, StunAgent *newagent) ...@@ -250,7 +250,7 @@ static int dgram_process (int sock, StunAgent *oldagent, StunAgent *newagent)
{ {
case STUN_BINDING: case STUN_BINDING:
stun_agent_init_response (agent, &response, buf, sizeof (buf), &request); stun_agent_init_response (agent, &response, buf, sizeof (buf), &request);
if (stun_has_cookie (&request)) if (stun_message_has_cookie (&request))
stun_message_append_xor_addr (&response, stun_message_append_xor_addr (&response,
STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS,
mh.msg_name, mh.msg_namelen); mh.msg_name, mh.msg_namelen);
......
...@@ -263,7 +263,7 @@ stun_usage_ice_conncheck_create_reply (StunAgent *agent, StunMessage *req, ...@@ -263,7 +263,7 @@ stun_usage_ice_conncheck_create_reply (StunAgent *agent, StunMessage *req,
val = stun_message_append_xor_addr_full (msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, val = stun_message_append_xor_addr_full (msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS,
src, srclen, htonl (magic_cookie)); src, srclen, htonl (magic_cookie));
} else if (stun_has_cookie (msg)) { } else if (stun_message_has_cookie (msg)) {
val = stun_message_append_xor_addr (msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, val = stun_message_append_xor_addr (msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS,
src, srclen); src, srclen);
} else { } else {
......
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