Commit b08c2237 authored by Youness Alaoui's avatar Youness Alaoui

Stun agent usage flags are now into an enum too

parent 30275785
...@@ -49,7 +49,7 @@ static unsigned stun_agent_find_unknowns (StunAgent *agent, ...@@ -49,7 +49,7 @@ static unsigned stun_agent_find_unknowns (StunAgent *agent,
const StunMessage * msg, uint16_t *list, unsigned max); const StunMessage * msg, uint16_t *list, unsigned max);
void stun_agent_init (StunAgent *agent, const uint16_t *known_attributes, void stun_agent_init (StunAgent *agent, const uint16_t *known_attributes,
StunCompatibility compatibility, uint32_t usage_flags) StunCompatibility compatibility, StunAgentUsageFlags usage_flags)
{ {
int i; int i;
......
...@@ -86,14 +86,44 @@ typedef enum { ...@@ -86,14 +86,44 @@ typedef enum {
STUN_VALIDATION_UNKNOWN_ATTRIBUTE, STUN_VALIDATION_UNKNOWN_ATTRIBUTE,
} StunValidationStatus; } StunValidationStatus;
/**
#define STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS 0x0001 * StunAgentUsageFlags:
#define STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS 0x0002 * @STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS: The agent should be using the short
#define STUN_AGENT_USAGE_USE_FINGERPRINT 0x0004 * term credentials mechanism for authenticating STUN messages
#define STUN_AGENT_USAGE_ADD_SOFTWARE 0x0008 * @STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS: The agent should be using the long
#define STUN_AGENT_USAGE_IGNORE_CREDENTIALS 0x0010 * term credentials mechanism for authenticating STUN messages
#define STUN_AGENT_USAGE_NO_INDICATION_AUTH 0x0020 * @STUN_AGENT_USAGE_USE_FINGERPRINT: The agent should add the FINGERPRINT
#define STUN_AGENT_USAGE_FORCE_VALIDATER 0x0040 * attribute to the STUN messages it creates.
* @STUN_AGENT_USAGE_ADD_SOFTWARE: The agent should add the SOFTWARE attribute
* to the STUN messages it creates
* @STUN_AGENT_USAGE_IGNORE_CREDENTIALS: The agent should ignore any credentials
* in the STUN messages it receives (the MESSAGE-INTEGRITY attribute
* will never be validated by stun_agent_validate())
* @STUN_AGENT_USAGE_NO_INDICATION_AUTH: The agent should ignore credentials
* in the STUN messages it receives if the #StunClass of the message is
* #STUN_INDICATION (some implementation require #STUN_INDICATION messages to
* be authenticated, while others never add a MESSAGE-INTEGRITY attribute to a
* #STUN_INDICATION message)
* @STUN_AGENT_USAGE_FORCE_VALIDATER: The agent should always try to validate
* the password of a STUN message, even if it already knows what the password
* should be (a response to a previously created request). This means that the
* #StunMessageIntegrityValidate callback will always be called when there is
* a MESSAGE-INTEGRITY attribute.
*
* This enum defines a bitflag usages for a #StunAgent and they will define how
* the agent should behave, independently of the compatibility mode it uses.
* <para> See also: stun_agent_init() </para>
* <para> See also: stun_agent_validate() </para>
*/
typedef enum {
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS = (1 << 0),
STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS = (1 << 1),
STUN_AGENT_USAGE_USE_FINGERPRINT = (1 << 2),
STUN_AGENT_USAGE_ADD_SOFTWARE = (1 << 3),
STUN_AGENT_USAGE_IGNORE_CREDENTIALS = (1 << 4),
STUN_AGENT_USAGE_NO_INDICATION_AUTH = (1 << 5),
STUN_AGENT_USAGE_FORCE_VALIDATER = (1 << 6),
} StunAgentUsageFlags;
typedef struct { typedef struct {
...@@ -110,7 +140,7 @@ struct stun_agent_t { ...@@ -110,7 +140,7 @@ struct stun_agent_t {
StunCompatibility compatibility; StunCompatibility compatibility;
StunAgentSavedIds sent_ids[STUN_AGENT_MAX_SAVED_IDS]; StunAgentSavedIds sent_ids[STUN_AGENT_MAX_SAVED_IDS];
uint16_t *known_attributes; uint16_t *known_attributes;
uint32_t usage_flags; StunAgentUsageFlags usage_flags;
}; };
typedef struct { typedef struct {
......
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