Commit 49eabfa9 authored by Pekka Pessi's avatar Pekka Pessi

Added stun_is_requested().

darcs-hash:20051018174131-65a35-6c1b6715be46ff2a36f5f9a0ee0ed3412bf1faae.gz
parent e01cfe8a
......@@ -83,6 +83,28 @@ struct stun_socket_s
int ss_state;
};
/**
* Check if a STUN engine should be created.
*
* Return true either there is a tag STUNTAG_SERVER() in list or if
* STUN_SERVER environment variable is set.
*
* @param tag,value,... tag-value list
*/
int stun_is_requested(tag_type_t tag, tag_value_t value, ...)
{
ta_list ta;
tagi_t const *t;
char const *stun_server;
ta_start(ta, tag, value);
t = tl_find(ta_args(ta), stuntag_server);
stun_server = t && t->t_value ? (char *)t->t_value : getenv("STUN_SERVER");
ta_end(ta);
return stun_server != NULL;
}
/**
* Creates a STUN engine
*
......
......@@ -46,6 +46,8 @@
typedef struct stun_engine_s stun_engine_t;
typedef struct stun_socket_s stun_socket_t;
int stun_is_requested(tag_type_t tag, tag_value_t value, ...);
stun_engine_t *stun_engine_tcreate(tag_type_t tag, tag_value_t value, ...);
stun_engine_t *stun_engine_create(char const *server, int use_msgint);
......
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