Commit 23847045 authored by Olivier Crête's avatar Olivier Crête

Replace the SERVER attribute with the SOFTWARE attribute per draft 17

parent dda21433
...@@ -74,10 +74,10 @@ bool stun_has_cookie (const StunMessage *msg) ...@@ -74,10 +74,10 @@ bool stun_has_cookie (const StunMessage *msg)
} }
int stun_message_append_server (StunMessage *msg) int stun_message_append_software (StunMessage *msg)
{ {
static const char server[] = PACKAGE_STRING; static const char software[] = PACKAGE_STRING;
// assert (strlen (server) < 128); // assert (strlen (software) < 128);
return stun_message_append_string (msg, STUN_ATTRIBUTE_SERVER, server); return stun_message_append_string (msg, STUN_ATTRIBUTE_SOFTWARE, software);
} }
...@@ -56,7 +56,7 @@ uint32_t stun_fingerprint (const uint8_t *msg, size_t len); ...@@ -56,7 +56,7 @@ uint32_t stun_fingerprint (const uint8_t *msg, size_t len);
bool stun_has_cookie (const StunMessage *msg); bool stun_has_cookie (const StunMessage *msg);
int stun_message_append_server (StunMessage *msg); int stun_message_append_software (StunMessage *msg);
#endif /* _STUN_3489BIS_H */ #endif /* _STUN_3489BIS_H */
......
...@@ -354,8 +354,8 @@ bool stun_agent_init_response (StunAgent *agent, StunMessage *msg, ...@@ -354,8 +354,8 @@ bool stun_agent_init_response (StunAgent *agent, StunMessage *msg,
stun_message_get_method (request), id)) { stun_message_get_method (request), id)) {
if (agent->compatibility == STUN_COMPATIBILITY_3489BIS && if (agent->compatibility == STUN_COMPATIBILITY_3489BIS &&
agent->usage_flags & STUN_AGENT_USAGE_ADD_SERVER) { agent->usage_flags & STUN_AGENT_USAGE_ADD_SOFTWARE) {
stun_message_append_server (msg); stun_message_append_software (msg);
} }
return TRUE; return TRUE;
} }
...@@ -386,8 +386,8 @@ bool stun_agent_init_error (StunAgent *agent, StunMessage *msg, ...@@ -386,8 +386,8 @@ bool stun_agent_init_error (StunAgent *agent, StunMessage *msg,
stun_message_get_method (request), id)) { stun_message_get_method (request), id)) {
if (agent->compatibility == STUN_COMPATIBILITY_3489BIS && if (agent->compatibility == STUN_COMPATIBILITY_3489BIS &&
agent->usage_flags & STUN_AGENT_USAGE_ADD_SERVER) { agent->usage_flags & STUN_AGENT_USAGE_ADD_SOFTWARE) {
stun_message_append_server (msg); stun_message_append_software (msg);
} }
if (stun_message_append_error (msg, err) == 0) { if (stun_message_append_error (msg, err) == 0) {
return TRUE; return TRUE;
......
...@@ -82,7 +82,7 @@ typedef enum { ...@@ -82,7 +82,7 @@ typedef enum {
#define STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS 0x0001 #define STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS 0x0001
#define STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS 0x0002 #define STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS 0x0002
#define STUN_AGENT_USAGE_USE_FINGERPRINT 0x0004 #define STUN_AGENT_USAGE_USE_FINGERPRINT 0x0004
#define STUN_AGENT_USAGE_ADD_SERVER 0x0008 #define STUN_AGENT_USAGE_ADD_SOFTWARE 0x0008
#define STUN_AGENT_USAGE_IGNORE_CREDENTIALS 0x0010 #define STUN_AGENT_USAGE_IGNORE_CREDENTIALS 0x0010
#define STUN_AGENT_USAGE_FORCE_VALIDATER 0x0020 #define STUN_AGENT_USAGE_FORCE_VALIDATER 0x0020
......
...@@ -122,7 +122,7 @@ typedef enum ...@@ -122,7 +122,7 @@ typedef enum
/* Optional attributes */ /* Optional attributes */
/* 0x8000-0x8021 */ /* reserved */ /* 0x8000-0x8021 */ /* reserved */
STUN_ATTRIBUTE_SERVER=0x8022, /* RFC3489bis-11 */ STUN_ATTRIBUTE_SOFTWARE=0x8022, /* RFC3489bis-17 */
STUN_ATTRIBUTE_ALTERNATE_SERVER=0x8023, /* RFC3489bis-11 */ STUN_ATTRIBUTE_ALTERNATE_SERVER=0x8023, /* RFC3489bis-11 */
STUN_ATTRIBUTE_REFRESH_INTERVAL=0x8024, /* wing-nat-control-04 */ STUN_ATTRIBUTE_REFRESH_INTERVAL=0x8024, /* wing-nat-control-04 */
/* 0x8025 */ /* reserved */ /* 0x8025 */ /* reserved */
......
...@@ -265,7 +265,7 @@ static int run (int family, int protocol, unsigned port) ...@@ -265,7 +265,7 @@ static int run (int family, int protocol, unsigned port)
stun_agent_init (&agent, known_attributes, stun_agent_init (&agent, known_attributes,
STUN_COMPATIBILITY_3489BIS, STUN_AGENT_USAGE_ADD_SERVER | STUN_COMPATIBILITY_3489BIS, STUN_AGENT_USAGE_ADD_SOFTWARE |
STUN_AGENT_USAGE_USE_FINGERPRINT); STUN_AGENT_USAGE_USE_FINGERPRINT);
for (;;) for (;;)
......
...@@ -168,7 +168,7 @@ StunUsageBindReturn stun_usage_bind_run (const struct sockaddr *srv, ...@@ -168,7 +168,7 @@ StunUsageBindReturn stun_usage_bind_run (const struct sockaddr *srv,
stun_agent_init (&agent, STUN_ALL_KNOWN_ATTRIBUTES, stun_agent_init (&agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_3489BIS, STUN_COMPATIBILITY_3489BIS,
STUN_AGENT_USAGE_ADD_SERVER | STUN_AGENT_USAGE_ADD_SOFTWARE |
STUN_AGENT_USAGE_USE_FINGERPRINT); STUN_AGENT_USAGE_USE_FINGERPRINT);
len = stun_usage_bind_create (&agent, &req, req_buf, sizeof(req_buf)); len = stun_usage_bind_create (&agent, &req, req_buf, sizeof(req_buf));
......
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