Commit c821f02f authored by Pekka Pessi's avatar Pekka Pessi

Added nta_agent_bind_tport_update(), nta_agent_tport_is_updating() functions.

Added tport_is_updating(), too. Removed NTATAG_UPDATE_TPORT().

darcs-hash:20060320190931-65a35-1e677ba9916a56c65239aa1d7981f4ec822f9cca.gz
parent 36dd432f
......@@ -799,7 +799,6 @@ static
int agent_set_params(nta_agent_t *agent, tagi_t *tags)
{
int n, m;
nta_update_tport_f *update_tport = agent->sa_update_tport;
unsigned bad_req_mask = agent->sa_bad_req_mask;
unsigned bad_resp_mask = agent->sa_bad_resp_mask;
unsigned maxsize = agent->sa_maxsize;
......@@ -845,7 +844,6 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
n = tl_gets(tags,
NTATAG_MCLASS_REF(mclass),
NTATAG_UPDATE_TPORT_REF(update_tport),
NTATAG_BAD_REQ_MASK_REF(bad_req_mask),
NTATAG_BAD_RESP_MASK_REF(bad_resp_mask),
NTATAG_ALIASES_REF(aliases),
......@@ -894,8 +892,6 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
if (mclass != NONE)
agent->sa_mclass = mclass ? mclass : sip_default_mclass();
agent->sa_update_tport = update_tport;
m = 0;
for (tport = agent->sa_tports; tport; tport = tport_next(tport)) {
m = tport_set_params(tport, TAG_NEXT(tags));
......@@ -1938,7 +1934,7 @@ static void agent_update_tport(nta_agent_t *self, tport_t *tport)
agent_init_via(self, 0);
if (self->sa_update_tport) {
self->sa_update_tport(self->sa_magic, self);
self->sa_update_tport(self->sa_update_magic, self);
}
else {
/* XXX - we should do something else? */
......@@ -9915,6 +9911,24 @@ nta_compartment_decref(struct sigcomp_compartment **pcc)
#endif
/** Bind transport update callback */
int nta_agent_bind_tport_update(nta_agent_t *agent,
nta_update_magic_t *magic,
nta_update_tport_f *callback)
{
if (!agent)
return su_seterrno(EFAULT), -1;
agent->sa_update_magic = magic;
agent->sa_update_tport = callback;
return 0;
}
/** Check if public transport binding is in progress */
int nta_agent_tport_is_updating(nta_agent_t *agent)
{
return agent && tport_is_updating(agent->sa_tports);
}
/** Initiate STUN keepalive controller to TPORT */
int nta_tport_keepalive(nta_outgoing_t *orq)
{
......
......@@ -94,6 +94,8 @@ struct nta_agent_s
su_timer_t *sa_timer;
nta_agent_magic_t *sa_magic;
nta_message_f *sa_callback;
nta_update_magic_t*sa_update_magic;
nta_update_tport_f*sa_update_tport;
su_time_t sa_now; /**< Timestamp in microsecond resolution. */
......
......@@ -50,7 +50,6 @@
tag_typedef_t ntatag_any = NSTAG_TYPEDEF(*);
tag_typedef_t ntatag_mclass = PTRTAG_TYPEDEF(mclass);
tag_typedef_t ntatag_update_tport = PTRTAG_TYPEDEF(update_tport);
tag_typedef_t ntatag_bad_req_mask = UINTTAG_TYPEDEF(bad_req_mask);
tag_typedef_t ntatag_bad_resp_mask = UINTTAG_TYPEDEF(bad_resp_mask);
......
......@@ -63,15 +63,6 @@ NTA_DLL extern tag_typedef_t ntatag_mclass;
NTA_DLL extern tag_typedef_t ntatag_mclass_ref;
#define NTATAG_MCLASS_REF(x) ntatag_mclass_ref, tag_ptr_vr(&(x), (x))
NTA_DLL extern tag_typedef_t ntatag_update_tport;
/** Transport update callback. @HI */
#define NTATAG_UPDATE_TPORT(x) \
ntatag_update_tport, tag_ptr_v((x))
NTA_DLL extern tag_typedef_t ntatag_update_tport_ref;
#define NTATAG_UPDATE_TPORT_REF(x) \
ntatag_update_tport_ref, tag_ptr_vr(&(x), (x))
NTA_DLL extern tag_typedef_t ntatag_bad_req_mask;
/** Mask for bad request messages.
*
......
......@@ -48,6 +48,11 @@ struct tport_s;
typedef TPORT_T tport_t;
#endif
#ifndef NTA_UPDATE_MAGIC_T
#define NTA_UPDATE_MAGIC_T void
#endif
typedef NTA_UPDATE_MAGIC_T nta_update_magic_t;
struct sigcomp_compartment;
struct sigcomp_udvm;
......@@ -65,7 +70,11 @@ nta_outgoing_compartment(nta_outgoing_t *orq);
void
nta_compartment_decref(struct sigcomp_compartment **);
typedef void nta_update_tport_f(nta_agent_magic_t *, nta_agent_t *);
typedef void nta_update_tport_f(nta_update_magic_t *, nta_agent_t *);
int nta_agent_bind_tport_update(nta_agent_t *agent,
nta_update_magic_t *magic,
nta_update_tport_f *);
SOFIA_END_DECLS
......
......@@ -268,8 +268,8 @@ TPORT_DLL int tport_is_tcp(tport_t const *self);
/** Test if transport has TLS. */
TPORT_DLL int tport_has_tls(tport_t const *tport);
/** Test if transport has just been accepted. */
TPORT_DLL int tport_is_newly_accepted(tport_t *self);
/** Return true if transport is being updated. */
TPORT_DLL int tport_is_updating(tport_t const *self);
/** Set transport magic. */
TPORT_DLL void tport_set_magic(tport_t *self, tp_magic_t *magic);
......
......@@ -686,6 +686,12 @@ int tport_has_tls(tport_t const *self)
#endif
}
/** Return true if transport is being updated. */
int tport_is_updating(tport_t const *self)
{
return 0; /* XXX */
}
/** Test if transport has been closed */
static inline int tport_is_closed(tport_t const *self)
{
......
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