[asterisk-commits] rizzo: branch rizzo/astobj2 r76487 - /team/rizzo/astobj2/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 23 07:51:59 CDT 2007
Author: rizzo
Date: Mon Jul 23 07:51:58 2007
New Revision: 76487
URL: http://svn.digium.com/view/asterisk?view=rev&rev=76487
Log:
rename the 'owner' of a sip_pkt as in trunk
Modified:
team/rizzo/astobj2/channels/chan_sip.c
Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=76487&r1=76486&r2=76487
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Mon Jul 23 07:51:58 2007
@@ -369,6 +369,7 @@
* our max-expire. This is a final state from which we do not
* recover (not sure how correctly).
*/
+
REG_STATE_TIMEOUT, /*!< Registration timed out */
/* XXX unused */
@@ -981,8 +982,8 @@
const char *s;
};
-/*! \brief Structure to handle SIP transfers. Dynamically allocated when needed */
-/* OEJ: Should be moved to string fields */
+/*! \brief Structure to handle SIP transfers. Dynamically allocated when needed
+ \note OEJ: Should be moved to string fields */
struct sip_refer {
char refer_to[AST_MAX_EXTENSION]; /*!< Place to store REFER-TO extension */
char refer_to_domain[AST_MAX_EXTENSION]; /*!< Place to store REFER-TO domain */
@@ -1138,7 +1139,16 @@
*/
};
-#ifdef USE_AO2 /* astobj2 implementation */
+/*
+ * Here we implement the container for dialogs (sip_pvt), defining
+ * generic wrapper functions to ease the transition from the current
+ * implementation (a single linked list) to a different container.
+ * In addition to a reference to the container, we need functions to lock/unlock
+ * the container and individual items, and functions to add/remove
+ * references to the individual items.
+ */
+
+#ifdef USE_AO2 /* astobj2 container */
#include "asterisk/astobj2.h"
ao2_container *dialogs;
@@ -1194,7 +1204,7 @@
int seqno; /*!< Sequence number */
char is_resp; /*!< 1 if this is a response packet (e.g. 200 OK), 0 if it is a request */
char is_fatal; /*!< non-zero if there is a fatal error */
- struct sip_pvt *pvt; /*!< Owner AST call */
+ struct sip_pvt *owner; /*!< Owner AST call */
int retransid; /*!< Retransmission ID */
int timer_a; /*!< SIP timer A, retransmission timer */
int timer_t1; /*!< SIP Timer T1, estimated RTT or 500 ms */
@@ -1309,8 +1319,7 @@
};
-
-/*! \brief Registrations with other SIP proxies.
+/*! \brief Registrations with other SIP proxies
* Created by sip_register(), the entry is linked in the 'regl' list,
* and never deleted (other than at 'sip reload' or module unload times).
* The entry always has a pending timeout, either waiting for an ACK to
@@ -2317,7 +2326,7 @@
static int retrans_pkt(void *data)
{
struct sip_pkt *pkt = data, *prev, *cur = NULL;
- struct sip_pvt *pvt = pkt->pvt; /* XXX we assume it is not null. maybe should check ? */
+ struct sip_pvt *pvt = pkt->owner; /* XXX we assume it is not null. maybe should check ? */
/* Lock channel PVT */
sip_pvt_lock(pvt);
@@ -2396,12 +2405,13 @@
for (prev = NULL, cur = pvt->packets; cur; prev = cur, cur = cur->next) {
if (cur == pkt) {
UNLINK(cur, pvt->packets, prev);
- pkt->pvt = pvt_unref(pvt); /* release the reference to the dialog */
+ pkt->owner = pvt_unref(pvt); /* release the reference to the dialog */
sip_pvt_unlock(pvt);
ast_free(pkt);
return 0;
}
}
+ /* error case */
ast_log(LOG_WARNING, "Weird, couldn't find packet owner!\n");
sip_pvt_unlock(pvt);
return 0;
@@ -2421,7 +2431,7 @@
pkt->data[len] = '\0';
pkt->packetlen = len;
pkt->method = sipmethod;
- pkt->pvt = pvt_ref(p);
+ pkt->owner = pvt_ref(p);
pkt->seqno = seqno;
pkt->is_resp = resp; /* mark as response */
if (mode == XMIT_CRITICAL)
@@ -2440,7 +2450,7 @@
pkt->next = p->packets;
p->packets = pkt;
- __sip_xmit(pkt->pvt, pkt->data, pkt->packetlen); /* Send packet */
+ __sip_xmit(pkt->owner, pkt->data, pkt->packetlen); /* Send packet */
if (sipmethod == SIP_INVITE) {
/* Note this is a pending invite */
p->pendinginvite = seqno;
@@ -2552,7 +2562,7 @@
cur->retransid = -1;
}
UNLINK(cur, p->packets, prev);
- cur->pvt = pvt_unref(cur->pvt);
+ pvt_unref(cur->owner);
ast_free(cur);
break;
}
@@ -3594,7 +3604,7 @@
p->packets = p->packets->next;
if (cp->retransid > -1)
ast_sched_del(sched, cp->retransid);
- cp->pvt = pvt_unref(cp->pvt);
+ pvt_unref(cp->owner);
ast_free(cp);
}
if (p->registry) {
More information about the asterisk-commits
mailing list