patch: turn client: add stun_msg to handler

This commit is contained in:
Alfred E. Heggestad 2011-10-03 18:14:52 +00:00
parent 3e294a96dc
commit 1123872f12
5 changed files with 15 additions and 7 deletions

View file

@ -12,6 +12,7 @@ enum {
typedef void(turnc_h)(int err, uint16_t scode, const char *reason,
const struct sa *relay_addr,
const struct sa *mapped_addr,
const struct stun_msg *msg,
void *arg);
typedef void(turnc_perm_h)(void *arg);
typedef void(turnc_chan_h)(void *arg);

View file

@ -114,11 +114,12 @@ static int send_binding_request(struct icem *icem, struct icem_comp *comp)
static void turnc_handler(int err, uint16_t scode, const char *reason,
const struct sa *relay, const struct sa *mapped,
void *arg)
const struct stun_msg *msg, void *arg)
{
struct icem_comp *comp = arg;
struct icem *icem = comp->icem;
struct cand *lcand;
(void)msg;
--icem->nstun;

View file

@ -96,7 +96,8 @@ static void timeout(void *arg)
err = chanbind_request(chan, true);
if (err)
chan->turnc->th(err, 0, NULL, NULL, NULL, chan->turnc->arg);
chan->turnc->th(err, 0, NULL, NULL, NULL, NULL,
chan->turnc->arg);
}
@ -136,7 +137,7 @@ static void chanbind_resp_handler(int err, uint16_t scode, const char *reason,
}
out:
chan->turnc->th(err, scode, reason, NULL, NULL, chan->turnc->arg);
chan->turnc->th(err, scode, reason, NULL, NULL, msg, chan->turnc->arg);
}

View file

@ -70,7 +70,8 @@ static void timeout(void *arg)
err = createperm_request(perm, true);
if (err)
perm->turnc->th(err, 0, NULL, NULL, NULL, perm->turnc->arg);
perm->turnc->th(err, 0, NULL, NULL, NULL, NULL,
perm->turnc->arg);
}
@ -111,7 +112,7 @@ static void createperm_resp_handler(int err, uint16_t scode,
}
out:
perm->turnc->th(err, scode, reason, NULL, NULL, perm->turnc->arg);
perm->turnc->th(err, scode, reason, NULL, NULL, msg, perm->turnc->arg);
}

View file

@ -73,7 +73,7 @@ static void timeout(void *arg)
err = refresh_request(turnc, turnc->lifetime, true,
refresh_resp_handler, turnc);
if (err)
turnc->th(err, 0, NULL, NULL, NULL, turnc->arg);
turnc->th(err, 0, NULL, NULL, NULL, NULL, turnc->arg);
}
@ -116,6 +116,9 @@ static void allocate_resp_handler(int err, uint16_t scode, const char *reason,
break;
case 300:
if (turnc->proto == IPPROTO_TCP)
break;
alt = stun_msg_attr(msg, STUN_ATTR_ALT_SERVER);
if (!alt)
break;
@ -149,6 +152,7 @@ static void allocate_resp_handler(int err, uint16_t scode, const char *reason,
turnc->th(err, scode, reason,
rel ? &rel->v.xor_relay_addr : NULL,
map ? &map->v.xor_mapped_addr : NULL,
msg,
turnc->arg);
}
@ -206,7 +210,7 @@ static void refresh_resp_handler(int err, uint16_t scode, const char *reason,
}
out:
turnc->th(err, scode, reason, NULL, NULL, turnc->arg);
turnc->th(err, scode, reason, NULL, NULL, msg, turnc->arg);
}