2
eXosip - This is the eXtended osip library.
3
Copyright (C) 2002, 2003 Aymeric MOIZARD - jack@atosc.org
5
eXosip is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
eXosip is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
extern eXosip_t eXosip;
29
int eXosip_reg_init(eXosip_reg_t **jr, char *from, char *proxy, char *contact, char* route)
33
*jr = (eXosip_reg_t*) osip_malloc(sizeof(eXosip_reg_t));
34
if (*jr==NULL) return -1;
36
if (r_id > 1000000) /* keep it non-negative */
40
(*jr)->r_reg_period = 3600; /* delay between registration */
41
(*jr)->r_aor = osip_strdup(from); /* sip identity */
42
(*jr)->r_contact = osip_strdup(contact); /* sip identity */
43
(*jr)->r_registrar = osip_strdup(proxy); /* registrar */
44
(*jr)->r_route = osip_strdup(route); /* outbound proxy */
46
(*jr)->r_realms = NULL; /* list of realms */
48
(*jr)->r_last_tr = NULL;
55
void eXosip_reg_free(eXosip_reg_t *jreg)
58
osip_free(jreg->r_aor);
59
osip_free(jreg->r_contact);
60
osip_free(jreg->r_registrar);
62
osip_free(jreg->r_realms);
65
if (jreg->r_last_tr != NULL)
67
if (jreg->r_last_tr->state==IST_TERMINATED ||
68
jreg->r_last_tr->state==ICT_TERMINATED ||
69
jreg->r_last_tr->state== NICT_TERMINATED ||
70
jreg->r_last_tr->state==NIST_TERMINATED)
72
OSIP_TRACE(osip_trace(__FILE__,__LINE__,OSIP_INFO1,NULL,
73
"Release a terminated transaction\n"));
74
__eXosip_delete_jinfo(jreg->r_last_tr);
75
if (jreg->r_last_tr!=NULL)
76
osip_list_add(eXosip.j_transactions, jreg->r_last_tr, 0);
80
OSIP_TRACE(osip_trace(__FILE__,__LINE__,OSIP_INFO1,NULL,
81
"Release a non-terminated transaction\n"));
82
__eXosip_delete_jinfo(jreg->r_last_tr);
83
if (jreg->r_last_tr!=NULL)
84
osip_list_add(eXosip.j_transactions, jreg->r_last_tr, 0);
91
int _eXosip_reg_find(eXosip_reg_t **reg, osip_transaction_t *tr)
95
if (tr==NULL) return -1;
97
for (jreg = eXosip.j_reg; jreg!=NULL; jreg = jreg->next)
99
if (jreg->r_last_tr==tr)