wire in tport error callback to nua_stack_tport_error
This commit is contained in:
parent
9cc550ee18
commit
0ce92e4cee
|
@ -149,6 +149,9 @@ struct nta_agent_s
|
|||
nta_update_magic_t *sa_update_magic;
|
||||
nta_update_tport_f *sa_update_tport;
|
||||
|
||||
nta_error_magic_t *sa_error_magic;
|
||||
nta_error_tport_f *sa_error_tport;
|
||||
|
||||
su_time_t sa_now; /**< Timestamp in microsecond resolution. */
|
||||
uint32_t sa_next; /**< Timestamp for next agent_timer. */
|
||||
uint32_t sa_millisec; /**< Timestamp in milliseconds. */
|
||||
|
@ -2720,6 +2723,10 @@ void agent_tp_error(nta_agent_t *agent,
|
|||
"nta_agent: tport: %s%s%s\n",
|
||||
remote ? remote : "", remote ? ": " : "",
|
||||
su_strerror(errcode));
|
||||
|
||||
if (agent->sa_error_tport) {
|
||||
agent->sa_error_tport(agent->sa_error_magic, agent, tport);
|
||||
}
|
||||
}
|
||||
|
||||
/** Handle updated transport addresses */
|
||||
|
@ -11783,6 +11790,18 @@ int nta_agent_bind_tport_update(nta_agent_t *agent,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** Bind transport error callback */
|
||||
int nta_agent_bind_tport_error(nta_agent_t *agent,
|
||||
nta_error_magic_t *magic,
|
||||
nta_error_tport_f *callback)
|
||||
{
|
||||
if (!agent)
|
||||
return su_seterrno(EFAULT), -1;
|
||||
agent->sa_error_magic = magic;
|
||||
agent->sa_error_tport = callback;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Check if public transport binding is in progress */
|
||||
int nta_agent_tport_is_updating(nta_agent_t *agent)
|
||||
{
|
||||
|
|
|
@ -54,6 +54,11 @@ typedef TPORT_T tport_t;
|
|||
#endif
|
||||
typedef NTA_UPDATE_MAGIC_T nta_update_magic_t;
|
||||
|
||||
#ifndef NTA_ERROR_MAGIC_T
|
||||
#define NTA_ERROR_MAGIC_T void
|
||||
#endif
|
||||
typedef NTA_ERROR_MAGIC_T nta_error_magic_t;
|
||||
|
||||
struct sigcomp_compartment;
|
||||
struct sigcomp_udvm;
|
||||
|
||||
|
@ -77,11 +82,18 @@ SOFIAPUBFUN void nta_compartment_decref(struct sigcomp_compartment **);
|
|||
|
||||
typedef void nta_update_tport_f(nta_update_magic_t *, nta_agent_t *);
|
||||
|
||||
typedef void nta_error_tport_f(nta_error_magic_t *, nta_agent_t *, tport_t *);
|
||||
|
||||
SOFIAPUBFUN
|
||||
int nta_agent_bind_tport_update(nta_agent_t *agent,
|
||||
nta_update_magic_t *magic,
|
||||
nta_update_tport_f *);
|
||||
|
||||
SOFIAPUBFUN
|
||||
int nta_agent_bind_tport_error(nta_agent_t *agent,
|
||||
nta_error_magic_t *magic,
|
||||
nta_error_tport_f *callback);
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* !defined NTA_TPORT_H */
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <sofia-sip/sip_status.h>
|
||||
|
||||
#define NTA_UPDATE_MAGIC_T struct nua_s
|
||||
#define NTA_ERROR_MAGIC_T struct nua_s
|
||||
|
||||
#include "nua_stack.h"
|
||||
|
||||
|
@ -1138,6 +1139,7 @@ static int nua_register_usage_shutdown(nua_handle_t *nh,
|
|||
#endif
|
||||
|
||||
static void nua_stack_tport_update(nua_t *nua, nta_agent_t *nta);
|
||||
static void nua_stack_tport_error(nua_t *nua, nta_agent_t *nta, tport_t *tport);
|
||||
static int nua_registration_add_contact_and_route(nua_handle_t *nh,
|
||||
nua_registration_t *nr,
|
||||
msg_t *msg,
|
||||
|
@ -1372,6 +1374,7 @@ nua_stack_init_registrations(nua_t *nua)
|
|||
}
|
||||
|
||||
nta_agent_bind_tport_update(nua->nua_nta, (nta_update_magic_t *)nua, nua_stack_tport_update);
|
||||
nta_agent_bind_tport_error(nua->nua_nta, (nta_error_magic_t *)nua, nua_stack_tport_error);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1476,6 +1479,12 @@ int nua_registration_from_via(nua_registration_t **list,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
void nua_stack_tport_error(nua_t *nua, nta_agent_t *nta, tport_t *tport)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static
|
||||
void nua_stack_tport_update(nua_t *nua, nta_agent_t *nta)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue