Commit fe7473cc authored by Martti Mela's avatar Martti Mela

async stun bind in tport, callback to NTA

darcs-hash:20060320211451-1b897-0d82d388697e45ffe3da9b6d4db6acabbed06ac7.gz
parent f24b8c13
......@@ -610,11 +610,16 @@ sip_via_t *nta_agent_via(nta_agent_t const *agent)
return agent ? agent->sa_vias : NULL;
}
/** Return a list of public @b Via headers.
/** Return a list of public (UPnP, STUN) @b Via headers.
*
* Return @b Via headers for all public transports.
* The function nta_agent_public_via() returns public @b Via headers for all activated
* transports.
*
* @param agent NTA agent object
*
* @return The function nta_agent_public_via() returns a list of sip_via_t objects
* used by the @a agent.
*/
sip_via_t *nta_agent_public_via(nta_agent_t const *agent)
{
......@@ -1289,7 +1294,7 @@ char const *stateless_branch(nta_agent_t *sa,
/* Local prototypes */
static int agent_create_master_transport(nta_agent_t *self, tagi_t *tags);
static int agent_init_via(nta_agent_t *self, int use_maddr);
static int agent_init_via(nta_agent_t *self, tport_t *primaries, int use_maddr);
static int agent_init_contact(nta_agent_t *self);
static void agent_recv_message(nta_agent_t *agent,
tport_t *tport,
......@@ -1511,7 +1516,7 @@ int nta_agent_add_tport(nta_agent_t *self,
tpn->tpn_comp ? tpn->tpn_comp : ""));
/* XXX - when to use maddr? */
if ((agent_init_via(self, 0)) < 0) {
if ((agent_init_via(self, tport_primaries(self->sa_tports), 0)) < 0) {
error = su_errno();
SU_DEBUG_1(("nta: cannot create Via headers\n"));
goto error;
......@@ -1581,7 +1586,7 @@ int agent_create_master_transport(nta_agent_t *self, tagi_t *tags)
/** Initialize Via headers. */
static
int agent_init_via(nta_agent_t *self, int use_maddr)
int agent_init_via(nta_agent_t *self, tport_t *primaries, int use_maddr)
{
sip_via_t *via = NULL, *new_via, *dup_via, *v, **vv = &via;
tport_t *tp;
......@@ -1599,7 +1604,7 @@ int agent_init_via(nta_agent_t *self, int use_maddr)
self->sa_tport_tls = 0;
/* Set via fields for the tports */
for (tp = tport_primaries(self->sa_tports); tp; tp = tport_next(tp)) {
for (tp = primaries; tp; tp = tport_next(tp)) {
int maddr, first_via;
tp_name_t tpn[1];
char const *comp = NULL;
......@@ -1691,7 +1696,7 @@ int agent_init_via(nta_agent_t *self, int use_maddr)
msg_header_free(self->sa_home, (void *)v);
/* Set via field magic for the tports */
for (tp = tport_primaries(self->sa_tports); tp; tp = tport_next(tp)) {
for (tp = primaries; tp; tp = tport_next(tp)) {
assert(via->v_common->h_data == tp);
v = tport_magic(tp);
tport_set_magic(tp, new_via);
......@@ -1931,7 +1936,12 @@ void agent_tp_error(nta_agent_t *agent,
/** Handle updated transport addresses */
static void agent_update_tport(nta_agent_t *self, tport_t *tport)
{
agent_init_via(self, 0);
/* Initialize non-natted Vias first */
agent_init_via(self, tport_primaries(self->sa_tports), 0);
/* Initialize natted Vias */
agent_init_via(self, tport_public_primaries(self->sa_tports), 0);
if (self->sa_update_tport) {
self->sa_update_tport(self->sa_update_magic, self);
......
......@@ -54,6 +54,12 @@ typedef struct stun_discovery_s stun_discovery_t;
/** STUN server context */
typedef STUN_MAGIC_T stun_magic_t;
#ifndef STUN_DISCOVERY_MAGIC_T
#define STUN_DISCOVERY_MAGIC_T struct stun_discovery_magic_t
#endif
/** STUN discovery_ context */
typedef STUN_DISCOVERY_MAGIC_T stun_discovery_magic_t;
extern char const stun_version[]; /**< Name and version of STUN software */
/**
......@@ -115,6 +121,15 @@ typedef enum stun_state_e {
} stun_state_t;
/* Per discovery */
typedef void (*stun_discovery_f)(stun_discovery_magic_t *magic,
stun_handle_t *sh,
stun_request_t *req,
stun_discovery_t *sd,
stun_action_t action,
stun_state_t event);
/* Used if no stun_discovery_f specified for a discovery */
typedef void (*stun_event_f)(stun_magic_t *magic,
stun_handle_t *sh,
stun_request_t *req,
......@@ -155,17 +170,23 @@ int stun_handle_request_shared_secret(stun_handle_t *sh);
/** Bind a socket using STUN. */
int stun_handle_bind(stun_handle_t *sh,
stun_discovery_f,
stun_discovery_magic_t *magic,
/* su_localinfo_t *my_addr, */
tag_type_t tag, tag_value_t value,
...);
int stun_handle_get_nattype(stun_handle_t *sh,
stun_discovery_f,
stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value,
...);
char const *stun_nattype(stun_discovery_t *sd);
int stun_handle_get_lifetime(stun_handle_t *sh,
stun_discovery_f,
stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value,
...);
......@@ -205,6 +226,9 @@ int stun_keepalive(stun_handle_t *sh,
int stun_keepalive_destroy(stun_handle_t *sh, su_socket_t s);
/* Return socket attached to discovery object */
su_socket_t stun_discovery_get_socket(stun_discovery_t *sd);
SOFIA_END_DECLS
#endif /* !defined(STUN_H) */
......@@ -71,6 +71,11 @@ extern tag_typedef_t stuntag_socket;
#define STUNTAG_SOCKET_REF(x) stuntag_socket_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_socket_ref;
#define STUNTAG_REGISTER_SOCKET(x) stuntag_register_socket, tag_int_v(x)
extern tag_typedef_t stuntag_register_socket;
#define STUNTAG_REGISTER_SOCKET_REF(x) stuntag_register_socket_ref, tag_int_vr(&(x))
extern tag_typedef_t stuntag_register_socket_ref;
#define STUNTAG_ACTION(x) stuntag_action, tag_int_v(x)
extern tag_typedef_t stuntag_action;
#define STUNTAG_ACTION_REF(x) stuntag_action_ref, tag_int_vr(&(x))
......
......@@ -110,7 +110,9 @@ typedef enum stun_nattype_e {
struct stun_discovery_s {
stun_discovery_t *sd_next, **sd_prev; /**< Linked list */
stun_handle_t *sd_handle;
stun_handle_t *sd_handle;
stun_discovery_f sd_callback;
stun_discovery_magic_t *sd_magic;
su_addrinfo_t sd_pri_info; /**< server primary info */
su_sockaddr_t sd_pri_addr[1]; /**< server primary address */
......@@ -282,7 +284,9 @@ int do_action(stun_handle_t *sh, stun_msg_t *binding_response);
int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg);
int process_binding_request(stun_request_t *req, stun_msg_t *binding_response);
stun_discovery_t *stun_discovery_create(stun_handle_t *sh,
stun_action_t action);
stun_action_t action,
stun_discovery_f sdf,
stun_discovery_magic_t *magic);
int stun_discovery_destroy(stun_discovery_t *sd);
int action_bind(stun_request_t *req, stun_msg_t *binding_response);
int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_response);
......@@ -497,7 +501,7 @@ int stun_handle_request_shared_secret(stun_handle_t *sh)
SU_DEBUG_9(("%s: %s: %s\n", __func__, "connect",
su_strerror(err)));
sd = stun_discovery_create(sh, stun_action_tls_query);
sd = stun_discovery_create(sh, stun_action_tls_query, NULL, NULL);
sd->sd_socket = s;
/* req = stun_request_create(sd); */
......@@ -632,7 +636,7 @@ void stun_handle_destroy(stun_handle_t *sh)
/** Create wait object and register it to the handle callback */
int assign_socket(stun_discovery_t *sd, su_socket_t s)
int assign_socket(stun_discovery_t *sd, su_socket_t s, int reg_socket)
{
stun_handle_t *sh = sd->sd_handle;
int events;
......@@ -663,6 +667,9 @@ int assign_socket(stun_discovery_t *sd, su_socket_t s)
}
sd->sd_socket = s;
if (reg_socket != 1)
return 0;
/* set socket asynchronous */
if (su_setblocking(s, 0) < 0) {
STUN_ERROR(errno, su_setblocking);
......@@ -815,6 +822,8 @@ static int get_localinfo(su_localinfo_t *clientinfo)
*
*/
int stun_handle_bind(stun_handle_t *sh,
stun_discovery_f sdf,
stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value,
...)
{
......@@ -823,7 +832,7 @@ int stun_handle_bind(stun_handle_t *sh,
stun_discovery_t *sd = NULL;
ta_list ta;
stun_action_t action = stun_action_binding_request;
int index;
int index, s_reg = 0;
enter;
......@@ -834,12 +843,13 @@ int stun_handle_bind(stun_handle_t *sh,
tl_gets(ta_args(ta),
STUNTAG_SOCKET_REF(s),
STUNTAG_REGISTER_SOCKET_REF(s_reg),
TAG_END());
ta_end(ta);
sd = stun_discovery_create(sh, action);
if ((index = assign_socket(sd, s)) < 0)
sd = stun_discovery_create(sh, action, sdf, magic);
if ((index = assign_socket(sd, s, s_reg)) < 0)
return -1;
req = stun_request_create(sd);
......@@ -871,7 +881,9 @@ su_sockaddr_t *stun_discovery_get_address(stun_discovery_t *sd)
}
stun_discovery_t *stun_discovery_create(stun_handle_t *sh,
stun_action_t action)
stun_action_t action,
stun_discovery_f sdf,
stun_discovery_magic_t *magic)
{
stun_discovery_t *sd = NULL;
......@@ -881,6 +893,8 @@ stun_discovery_t *stun_discovery_create(stun_handle_t *sh,
sd->sd_action = action;
sd->sd_handle = sh;
sd->sd_callback = sdf;
sd->sd_magic = magic;
sd->sd_lt_cur = 0;
sd->sd_lt = STUN_LIFETIME_EST;
......@@ -925,10 +939,12 @@ int stun_discovery_destroy(stun_discovery_t *sd)
int stun_handle_get_nattype(stun_handle_t *sh,
stun_discovery_f sdf,
stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value,
...)
{
int err = 0, index = 0;
int err = 0, index = 0, s_reg = 0;
ta_list ta;
char const *server = NULL;
stun_request_t *req = NULL;
......@@ -944,6 +960,7 @@ int stun_handle_get_nattype(stun_handle_t *sh,
tl_gets(ta_args(ta),
STUNTAG_SOCKET_REF(s),
STUNTAG_REGISTER_SOCKET_REF(s_reg),
STUNTAG_SERVER_REF(server),
TAG_END());
......@@ -954,8 +971,8 @@ int stun_handle_get_nattype(stun_handle_t *sh,
if (s < 0)
return errno = EFAULT, -1;
sd = stun_discovery_create(sh, stun_action_get_nattype);
if ((index = assign_socket(sd, s)) < 0)
sd = stun_discovery_create(sh, stun_action_get_nattype, sdf, magic);
if ((index = assign_socket(sd, s, s_reg)) < 0)
return errno = EFAULT, -1;
/* If no server given, use default address from stun_handle_create() */
......@@ -1618,14 +1635,26 @@ int process_get_lifetime(stun_request_t *req, stun_msg_t *binding_response)
if ((req->sr_state == stun_request_timeout) && (req->sr_from_y == -1)) {
SU_DEBUG_0(("%s: lifetime determination failed.\n", __func__));
sd->sd_state = stun_discovery_timeout;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
return 0;
}
if (abs(sd->sd_lt_cur - sd->sd_lt) <= STUN_LIFETIME_CI) {
sd->sd_state = stun_discovery_done;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
return 0;
}
......@@ -1713,7 +1742,12 @@ int action_bind(stun_request_t *req, stun_msg_t *binding_response)
memcpy(sd->sd_addr_seen_outside, sa, sizeof(su_sockaddr_t));
sd->sd_state = stun_bind_done;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
return 0;
......@@ -1767,7 +1801,13 @@ int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_response)
if (sd->sd_first && sd->sd_second && sd->sd_third && sd->sd_fourth) {
sd->sd_nattype = stun_nat_port_res_cone;
sd->sd_state = stun_discovery_done;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
/* stun_request_destroy(req); */
/* stun_discovery_destroy(sd); */
......@@ -1777,7 +1817,13 @@ int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_response)
/* Sudden network problem */
sd->sd_nattype = stun_nat_unknown;
sd->sd_state = stun_discovery_done;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
/* stun_request_destroy(req); */
/* stun_discovery_destroy(sd); */
......@@ -1787,7 +1833,13 @@ int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_response)
if (memcmp(li->li_addr, li->li_addr, 8) == 0) {
sd->sd_nattype = stun_sym_udp_fw;
sd->sd_state = stun_discovery_done;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
/* stun_request_destroy(req); */
/* stun_discovery_destroy(sd); */
......@@ -1815,7 +1867,13 @@ int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_response)
else if (sd->sd_first) {
sd->sd_nattype = stun_udp_blocked;
sd->sd_state = stun_discovery_done;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
/* stun_request_destroy(req); */
/* stun_discovery_destroy(sd); */
......@@ -1833,7 +1891,13 @@ int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_response)
}
sd->sd_state = stun_discovery_done;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
/* stun_request_destroy(req); */
/* stun_discovery_destroy(sd); */
......@@ -1846,7 +1910,13 @@ int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_response)
sd->sd_nattype = stun_nat_full_cone;
sd->sd_state = stun_discovery_done;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
/* stun_request_destroy(req); */
/* stun_discovery_destroy(sd); */
......@@ -1902,7 +1972,13 @@ void stun_sendto_timer_cb(su_root_magic_t *magic,
switch (action) {
case stun_action_binding_request:
sd->sd_state = stun_discovery_timeout;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
req->sr_state = stun_dispose_me;
break;
......@@ -1916,7 +1992,13 @@ void stun_sendto_timer_cb(su_root_magic_t *magic,
case stun_action_keepalive:
sd->sd_state = stun_discovery_timeout;
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
/* Use per discovery specific callback */
if (sd->sd_callback)
sd->sd_callback(sd->sd_magic, sh, req, sd, action, sd->sd_state);
else
sh->sh_callback(sh->sh_context, sh, req, sd, action, sd->sd_state);
stun_keepalive_destroy(sh, sd->sd_socket);
break;
......@@ -2239,13 +2321,15 @@ int stun_atoaddr(int ai_family,
int stun_handle_get_lifetime(stun_handle_t *sh,
stun_discovery_f sdf,
stun_discovery_magic_t *magic,
tag_type_t tag, tag_value_t value,
...)
{
stun_request_t *req = NULL;
stun_discovery_t *sd = NULL;
ta_list ta;
int s = -1, err, index = 0;
int s = -1, err, index = 0, s_reg = 0;
char ipaddr[SU_ADDRSIZE + 2] = { 0 };
char const *server = NULL;
su_socket_t sockfdy;
......@@ -2261,11 +2345,12 @@ int stun_handle_get_lifetime(stun_handle_t *sh,
tl_gets(ta_args(ta),
STUNTAG_SOCKET_REF(s),
STUNTAG_REGISTER_SOCKET_REF(s_reg),
STUNTAG_SERVER_REF(server),
TAG_END());
sd = stun_discovery_create(sh, stun_action_get_lifetime);
if ((index = assign_socket(sd, s)) < 0)
sd = stun_discovery_create(sh, stun_action_get_lifetime, sdf, magic);
if ((index = assign_socket(sd, s, s_reg)) < 0)
return errno = EFAULT, -1;
/* If no server given, use default address from stun_handle_create() */
......@@ -2405,12 +2490,8 @@ int stun_handle_process_message(stun_handle_t *sh, su_socket_t s,
su_sockaddr_t *sa, socklen_t salen,
void *data, int len)
{
int retval = -1, err = -1, dgram_len;
char ipaddr[SU_ADDRSIZE + 2];
int retval = -1;
stun_msg_t msg;
unsigned char dgram[20] = { 0 };
su_sockaddr_t recv;
socklen_t recv_len;
enter;
......@@ -2502,7 +2583,10 @@ int stun_keepalive(stun_handle_t *sh,
stun_keepalive_destroy(sh, s);
/*Ok, here we go */
sd = stun_discovery_create(sh, action);
sd = stun_discovery_create(sh, action, NULL, NULL); /* XXX --
specify last
params if
necessary */
sd->sd_socket = s;
sd->sd_timeout = timeout;
memcpy(sd->sd_pri_addr, sa, sizeof(*sa));
......@@ -2679,3 +2763,10 @@ int stun_process_request(su_socket_t s, stun_msg_t *req,
stun_send_message(s, &to_addr, &resp, NULL);
return 0;
}
su_socket_t stun_discovery_get_socket(stun_discovery_t *sd)
{
assert(sd);
return sd->sd_socket;
}
......@@ -422,7 +422,6 @@ int stun_encode_message_integrity(stun_attr_t *attr,
/* zero padding */
if (len % 64 == 0) {
void *sha_hmac;
padded_len = len + (64 - (len % 64));
padded_text = (unsigned char *) malloc(padded_len);
......
......@@ -128,6 +128,25 @@ tag_typedef_t stuntag_integrity = BOOLTAG_TYPEDEF(integrity);
*/
tag_typedef_t stuntag_socket = INTTAG_TYPEDEF(socket);
/**@def STUNTAG_REGISTER_SOCKET(x)
*
* Register socket for eventloop owned by STUN.
*
* @par Used with
* stun_handle_bind() \n
* stun_handle_get_lifetime() \n
* stun_handle_get_nattype() \n
*
* @par Parameter type
* int (su_register_socket_t)
*
* @par Values
* IPv4 (AF_INET) register_socket
*
* Corresponding tag taking reference parameter is STUNTAG_REGISTER_SOCKET_REF()
*/
tag_typedef_t stuntag_register_socket = INTTAG_TYPEDEF(register_socket);
/**@def STUNTAG_ACTION(x)
*
* Command action for STUN request.
......
......@@ -85,7 +85,7 @@ void stunc_callback(stunc_t *stunc, stun_handle_t *sh,
case stun_tls_connection_failed:
case stun_tls_connection_timeout:
SU_DEBUG_0(("%s: TLS query done, start binding process.\n", __func__));
if (stun_handle_bind(sh, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
if (stun_handle_bind(sh, NULL, NULL, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
SU_DEBUG_0(("%s: %s failed\n", __func__, "stun_handle_bind()"));
su_root_break(stun_handle_root(sh));
}
......@@ -112,12 +112,12 @@ void stunc_callback(stunc_t *stunc, stun_handle_t *sh,
(unsigned) ntohs(sa->su_port)));
/* su_root_break(stun_handle_root(sh)); */
if (stun_handle_get_nattype(sh, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
if (stun_handle_get_nattype(sh, NULL, NULL, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
SU_DEBUG_0(("%s: %s failed\n", __func__, "stun_handle_get_nattype()"));
su_root_break(stun_handle_root(sh));
}
if (stun_handle_get_lifetime(sh, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
if (stun_handle_get_lifetime(sh, NULL, NULL, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
SU_DEBUG_0(("%s: %s failed\n", __func__, "stun_handle_get_lifetime()"));
su_root_break(stun_handle_root(sh));
}
......@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
}
/* If no TSL query, start bind here */
if (stun_handle_bind(sh, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
if (stun_handle_bind(sh, NULL, NULL, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
SU_DEBUG_0(("%s: %s failed\n", __func__, "stun_handle_bind()"));
return -1;
}
......
......@@ -301,7 +301,7 @@ int torture_test_get_lifetime(char *localaddr)
atonetaddr(my_addr, localaddr);
addrlen = sizeof(*my_addr);
result = stun_handle_get_lifetime(se, &addr.li_addr, &addrlen, &lifetime); TEST(result, 0);
result = stun_handle_get_lifetime(se, NULL, &addr.li_addr, &addrlen, &lifetime); TEST(result, 0);
printf("Binding Lifetime determined to be: %d seconds\n", lifetime);
su_close(s);
......
......@@ -89,11 +89,12 @@
typedef struct tport_master tport_master_t;
typedef struct tport_nat_s tport_nat_t;
#define SU_WAKEUP_ARG_T struct tport_s
#define SU_TIMER_ARG_T struct tport_master
#define SU_ROOT_MAGIC_T struct tport_threadpool
#define SU_MSG_ARG_T union tport_su_msg_arg
#define STUN_MAGIC_T tport_master_t
#define SU_WAKEUP_ARG_T struct tport_s
#define SU_TIMER_ARG_T struct tport_master
#define SU_ROOT_MAGIC_T struct tport_threadpool
#define SU_MSG_ARG_T union tport_su_msg_arg
#define STUN_MAGIC_T tport_master_t
#define STUN_DISCOVERY_MAGIC_T struct tport_primary
#include <sofia-sip/su_wait.h>
......@@ -372,7 +373,8 @@ struct tport_master {
/** File to dump received and sent data */
FILE *mr_dump_file;
tport_primary_t *mr_primaries; /**< List of primary contacts */
tport_primary_t *mr_primaries; /**< List of primary contacts */
tport_primary_t *mr_public_primaries; /**< List of primary contacts */
tport_params_t mr_params[1];
......@@ -425,6 +427,9 @@ struct tport_master {
(tp)->tp_master->mr_tpac-> \
tpac_sigcomp_accept((tp)->tp_master->mr_stack, (tp), (msg))