Commit d6c98d4a authored by Pekka Pessi's avatar Pekka Pessi

Updated tport_keepalive() prototype.

Implemented tport_is_updating(), added tport_has_been_updated().

darcs-hash:20060327175627-88462-d200c213d8818545121fa380d44eac1a0f4e76b9.gz
parent 44604e68
......@@ -343,7 +343,8 @@ TPORT_DLL char *tport_hostport(char buf[], int bufsize,
su_sockaddr_t const *su, int with_port);
/** Initialize STUN keepalives. */
int tport_keepalive(tport_t *tp, tp_name_t *tpn);
int tport_keepalive(tport_t *tp, su_addrinfo_t const *ai,
tag_type_t tag, tag_value_t value, ...);
/* ---------------------------------------------------------------------- */
/* SigComp-related functions */
......
......@@ -267,7 +267,18 @@ int tport_has_tls(tport_t const *self)
/** Return true if transport is being updated. */
int tport_is_updating(tport_t const *self)
{
return 0; /* XXX */
tport_primary_t *pri;
if (tport_is_master(self)) {
for (pri = self->tp_master->mr_primaries; pri; pri = pri->pri_next)
if (pri->pri_updating)
return 1;
}
else if (tport_is_primary(self)) {
return self->tp_pri->pri_updating;
}
return 0;
}
/** Test if transport has been closed */
......@@ -372,14 +383,14 @@ static void tport_parse(tport_t *self, int complete, su_time_t now);
static tport_primary_t *tport_alloc_primary(tport_master_t *mr,
tport_vtable_t const *vtable,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit);
static tport_primary_t *tport_listen(tport_master_t *mr,
tport_vtable_t const *vtable,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t *tags);
static void tport_zap_primary(tport_primary_t *);
......@@ -530,7 +541,7 @@ void tport_destroy(tport_t *self)
static
tport_primary_t *tport_alloc_primary(tport_master_t *mr,
tport_vtable_t const *vtable,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......@@ -629,7 +640,7 @@ void tport_zap_primary(tport_primary_t *pri)
static
tport_primary_t *tport_listen(tport_master_t *mr,
tport_vtable_t const *vtable,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t *tags)
{
......@@ -731,6 +742,17 @@ int tport_bind_socket(int socket,
return 0;
}
/** Indicate stack that a transport has been updated */
void tport_has_been_updated(tport_t *self)
{
self->tp_pri->pri_updating = 0;
if (self->tp_master->mr_tpac->tpac_address)
self->tp_master->mr_tpac->tpac_address(self->tp_master->mr_stack, self);
}
static
int tport_set_events(tport_t *self, int set, int clear)
{
......@@ -3704,7 +3726,8 @@ int tport_error_event(tport_t *self)
if (tport_is_udp(self)) {
errcode = tport_udp_error(self, name);
} else {
}
else {
/* Process error event for basic transport. */
errcode = su_soerror(self->tp_socket);
}
......@@ -4481,7 +4504,16 @@ int tport_set_compression(tport_t *self, char const *comp)
return (self == NULL || comp) ? -1 : 0;
}
int tport_keepalive(tport_t *tp, tp_name_t *tpn)
int tport_keepalive(tport_t *tp, su_addrinfo_t const *ai,
tag_type_t tag, tag_value_t value, ...)
{
return 0;
if (tp && tp->tp_pri && tp->tp_pri->pri_vtable->vtp_keepalive) {
int retval;
ta_list ta;
ta_start(ta, tag, value);
retval = tp->tp_pri->pri_vtable->vtp_keepalive(tp, ai, ta_args(ta));
ta_end(ta);
return retval;
}
return -1;
}
......@@ -256,6 +256,7 @@ struct tport_primary {
tport_threadpool_t *pri_threadpool; /**< Worker threads */
unsigned pri_thrpsize;
unsigned pri_updating:1; /**< Currently updating address */
unsigned pri_natted:1; /**< Using natted address */
unsigned pri_has_tls:1; /**< Supports tls */
unsigned:0;
......@@ -335,7 +336,7 @@ struct tport_vtable
int vtp_pri_size; /* Size of primary tport */
int (*vtp_init_primary)(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai, tagi_t const *,
char const **return_culprit);
void (*vtp_deinit_primary)(tport_primary_t *pri);
......@@ -358,6 +359,8 @@ struct tport_vtable
tp_name_t const *tpn,
struct sigcomp_compartment *cc,
unsigned mtu);
int (*vtp_keepalive)(tport_t *self, su_addrinfo_t const *ai,
tagi_t const *taglist);
};
/** Test if transport is needs connect() before sending. */
......@@ -372,6 +375,8 @@ static inline int tport_is_connected(tport_t const *self)
return self->tp_connected;
}
void tport_has_been_updated(tport_t *tport);
int tport_init_compression(tport_primary_t *pri,
char const *compression,
tagi_t const *tl);
......@@ -387,9 +392,9 @@ void tport_zap_secondary(tport_t *self);
int tport_bind_socket(int socket,
su_addrinfo_t *ai,
char const **return_culprit);
void tport_close(tport_t *self);
int tport_error_event(tport_t *self);
void tport_recv_event(tport_t *self);
void tport_send_event(tport_t *self);
......@@ -430,7 +435,7 @@ extern tport_vtable_t const tport_udp_vtable;
extern tport_vtable_t const tport_udp_client_vtable;
int tport_udp_init_primary(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *,
tagi_t const *,
char const **return_culprit);
......@@ -444,11 +449,11 @@ extern tport_vtable_t const tport_tcp_vtable;
extern tport_vtable_t const tport_tcp_client_vtable;
int tport_tcp_init_primary(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *, tagi_t const *,
char const **return_culprit);
int tport_tcp_init_client(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *, tagi_t const *,
char const **return_culprit);
int tport_tcp_init_secondary(tport_t *self, int socket, int accepted);
......
......@@ -102,7 +102,7 @@ union tport_su_msg_arg
};
int tport_threadpool_init_primary(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *,
tagi_t const *,
char const **return_culprit);
......@@ -164,7 +164,7 @@ static void thrp_udp_send_report(tport_threadpool_t *thrp,
/** Launch threads in the tport pool. */
int tport_threadpool_init_primary(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......
......@@ -49,7 +49,7 @@
#include <sofia-sip/http_header.h>
static int tport_http_connect_init_primary(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *,
tagi_t const *,
char const **return_culprit);
......@@ -94,7 +94,7 @@ tport_vtable_t const tport_http_connect_vtable =
};
static int tport_http_connect_init_primary(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......
......@@ -57,11 +57,11 @@
#define TP_SCTP_MSG_MAX (32768)
static int tport_sctp_init_primary(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *, tagi_t const *,
char const **return_culprit);
static int tport_sctp_init_client(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *, tagi_t const *,
char const **return_culprit);
static int tport_sctp_init_secondary(tport_t *self, int socket, int accepted);
......@@ -112,7 +112,7 @@ tport_vtable_t const tport_sctp_vtable =
#define NEXT_VTABLE &tport_sctp_vtable
static int tport_sctp_init_primary(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......@@ -124,7 +124,7 @@ static int tport_sctp_init_primary(tport_primary_t *pri,
}
static int tport_sctp_init_client(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......
......@@ -90,7 +90,7 @@ tport_vtable_t const tport_tcp_client_vtable =
};
int tport_tcp_init_primary(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......@@ -132,7 +132,7 @@ int tport_tcp_init_primary(tport_primary_t *pri,
}
int tport_tcp_init_client(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......
......@@ -52,15 +52,15 @@
#include <tport_tls.h>
static int tport_tls_init_primary(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *, tagi_t const *,
char const **return_culprit);
static int tport_tls_init_client(tport_primary_t *,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *, tagi_t const *,
char const **return_culprit);
static int tport_tls_init_master(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit);
......@@ -124,7 +124,7 @@ tport_vtable_t const tport_tls_client_vtable =
};
static int tport_tls_init_primary(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......@@ -136,7 +136,7 @@ static int tport_tls_init_primary(tport_primary_t *pri,
}
static int tport_tls_init_client(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......@@ -147,7 +147,7 @@ static int tport_tls_init_client(tport_primary_t *pri,
}
static int tport_tls_init_master(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......
......@@ -93,7 +93,7 @@ tport_vtable_t const tport_udp_vtable =
};
int tport_udp_init_primary(tport_primary_t *pri,
tp_name_t const tpn[1],
tp_name_t tpn[1],
su_addrinfo_t *ai,
tagi_t const *tags,
char const **return_culprit)
......
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