Commit c7072612 authored by Youness Alaoui's avatar Youness Alaoui

add a static const for all the known atttributes.. fixes stunbdc with stunserver.org

parent 3f29f7d2
...@@ -131,6 +131,39 @@ typedef enum ...@@ -131,6 +131,39 @@ typedef enum
} stun_attr_type_t; } stun_attr_type_t;
static const uint16_t STUN_ALL_KNOWN_ATTRIBUTES[] =
{
STUN_ATTRIBUTE_MAPPED_ADDRESS,
STUN_ATTRIBUTE_OLD_RESPONSE_ADDRESS,
STUN_ATTRIBUTE_OLD_CHANGE_REQUEST,
STUN_ATTRIBUTE_OLD_SOURCE_ADDRESS,
STUN_ATTRIBUTE_OLD_CHANGED_ADDRESS,
STUN_ATTRIBUTE_USERNAME,
STUN_ATTRIBUTE_OLD_PASSWORD,
STUN_ATTRIBUTE_MESSAGE_INTEGRITY,
STUN_ATTRIBUTE_ERROR_CODE,
STUN_ATTRIBUTE_UNKNOWN_ATTRIBUTES,
STUN_ATTRIBUTE_OLD_REFLECTED_FROM,
STUN_ATTRIBUTE_LIFETIME,
STUN_ATTRIBUTE_BANDWIDTH,
STUN_ATTRIBUTE_REMOTE_ADDRESS,
STUN_ATTRIBUTE_DATA,
STUN_ATTRIBUTE_REALM,
STUN_ATTRIBUTE_NONCE,
STUN_ATTRIBUTE_RELAY_ADDRESS,
STUN_ATTRIBUTE_REQUESTED_ADDRESS_TYPE,
STUN_ATTRIBUTE_REQUESTED_PORT_PROPS,
STUN_ATTRIBUTE_REQUESTED_TRANSPORT,
STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS,
STUN_ATTRIBUTE_TIMER_VAL,
STUN_ATTRIBUTE_REQUESTED_IP,
STUN_ATTRIBUTE_CONNECT_STAT,
STUN_ATTRIBUTE_PRIORITY,
STUN_ATTRIBUTE_USE_CANDIDATE,
STUN_ATTRIBUTE_XOR_INTERNAL_ADDRESS,
0
};
typedef uint8_t stun_transid_t[STUN_MESSAGE_TRANS_ID_LEN]; typedef uint8_t stun_transid_t[STUN_MESSAGE_TRANS_ID_LEN];
......
...@@ -63,17 +63,6 @@ struct stun_bind_s ...@@ -63,17 +63,6 @@ struct stun_bind_s
StunAgent agent; StunAgent agent;
}; };
static const uint16_t known_attributes[] = {
STUN_ATTRIBUTE_MAPPED_ADDRESS,
STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS,
STUN_ATTRIBUTE_XOR_INTERNAL_ADDRESS,
STUN_ATTRIBUTE_PRIORITY,
STUN_ATTRIBUTE_USE_CANDIDATE,
STUN_ATTRIBUTE_USERNAME,
STUN_ATTRIBUTE_MESSAGE_INTEGRITY,
STUN_ATTRIBUTE_ERROR_CODE,
0
};
/** Initialization/deinitization */ /** Initialization/deinitization */
...@@ -112,7 +101,7 @@ stun_bind_alloc (stun_bind_t **restrict context, int fd, ...@@ -112,7 +101,7 @@ stun_bind_alloc (stun_bind_t **restrict context, int fd,
return val; return val;
} }
stun_agent_init (&ctx->agent, known_attributes, stun_agent_init (&ctx->agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_3489BIS, STUN_COMPATIBILITY_3489BIS,
STUN_AGENT_USAGE_ADD_SERVER); STUN_AGENT_USAGE_ADD_SERVER);
...@@ -265,7 +254,7 @@ stun_bind_keepalive (int fd, const struct sockaddr *restrict srv, ...@@ -265,7 +254,7 @@ stun_bind_keepalive (int fd, const struct sockaddr *restrict srv,
StunAgent agent; StunAgent agent;
StunMessage msg; StunMessage msg;
stun_agent_init (&agent, known_attributes, stun_agent_init (&agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_3489BIS, STUN_COMPATIBILITY_3489BIS,
STUN_AGENT_USAGE_USE_FINGERPRINT); STUN_AGENT_USAGE_USE_FINGERPRINT);
stun_agent_init_indication (&agent, &msg, stun_agent_init_indication (&agent, &msg,
......
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