Commit c4ae89dc authored by Pekka Pessi's avatar Pekka Pessi

Added NTATAG_UPDATE_TPORT().

darcs-hash:20060223202454-65a35-01f7dc4871f9b2b3dcf514827393a27165ba05be.gz
parent 0eab7f8a
......@@ -787,6 +787,7 @@ 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;
......@@ -832,6 +833,7 @@ 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),
......@@ -880,6 +882,8 @@ 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));
......@@ -1287,6 +1291,7 @@ static void agent_tp_error(nta_agent_t *agent,
tport_t *tport,
int errcode,
char const *remote);
static void agent_update_tport(nta_agent_t *agent, tport_t *);
/**For each transport, we have name used by tport module, SRV prefixes used
* for resolving, and NAPTR service/conversion.
......@@ -1322,7 +1327,8 @@ static tport_stack_class_t nta_agent_class[1] =
agent_recv_message,
agent_tp_error,
(void *)nta_msg_create_for_transport,
agent_sigcomp_accept
agent_sigcomp_accept,
agent_update_tport,
}};
......@@ -1854,6 +1860,19 @@ void agent_tp_error(nta_agent_t *agent,
su_strerror(errcode));
}
/** Handle updated transport addresses */
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);
}
else {
/* XXX - we should do something else? */
SU_DEBUG_3(("nta(%p): transport address updated\n", self));
}
}
/* ====================================================================== */
/* 3) Message dispatch */
......
......@@ -94,13 +94,14 @@ struct nta_agent_s
su_timer_t *sa_timer;
nta_agent_magic_t *sa_magic;
nta_message_f *sa_callback;
nta_update_tport_f*sa_update_tport;
su_time_t sa_now; /**< Timestamp in microsecond resolution. */
uint32_t sa_millisec; /**< Timestamp in milliseconds resolution. */
uint32_t sa_flags; /**< Message flags */
msg_mclass_t *sa_mclass;
sip_contact_t *sa_contact;
sip_via_t *sa_vias; /**< Via headers for all transports */
sip_contact_t *sa_aliases;/**< List of aliases for agent */
......
......@@ -50,6 +50,8 @@
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,6 +63,15 @@ 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.
*
......
......@@ -65,6 +65,8 @@ 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 *);
SOFIA_END_DECLS
#endif /* !defined NTA_TPORT_H */
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