[asterisk-commits] rizzo: branch rizzo/astobj2 r47929 -
/team/rizzo/astobj2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Nov 22 07:36:10 MST 2006
Author: rizzo
Date: Wed Nov 22 08:36:09 2006
New Revision: 47929
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47929
Log:
use enum xmittype as an argument to __sip_reliable_xmit()
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=47929&r1=47928&r2=47929
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Wed Nov 22 08:36:09 2006
@@ -1338,7 +1338,7 @@
/*--- Transmitting responses and requests */
static int sipsock_read(int *id, int fd, short events, void *ignore);
static int __sip_xmit(struct sip_pvt *p, char *data, int len);
-static int __sip_reliable_xmit(struct sip_pvt *p, int seqno, int resp, char *data, int len, int fatal, int sipmethod);
+static int __sip_reliable_xmit(struct sip_pvt *p, int seqno, int resp, char *data, int len, enum xmittype mode, int sipmethod);
static int __transmit_response(struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable);
static int retrans_pkt(void *data);
static int transmit_sip_request(struct sip_pvt *p, struct sip_request *req);
@@ -1908,7 +1908,10 @@
return sip_debug_test_addr(sip_real_dst(p));
}
-/*! \brief Transmit SIP message */
+/*! \brief Transmit SIP message.
+ * This is the simplest form, that only calls sendto() but other than
+ * that makes no attempt at retransmitting the packet.
+ */
static int __sip_xmit(struct sip_pvt *p, char *data, int len)
{
int res;
@@ -2133,7 +2136,7 @@
/*! \brief Transmit packet with retransmits
\return 0 on success, -1 on failure to allocate packet
*/
-static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int resp, char *data, int len, int fatal, int sipmethod)
+static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int resp, char *data, int len, enum xmittype mode, int sipmethod)
{
struct sip_pkt *pkt;
int siptimer_a = DEFAULT_RETRANS;
@@ -2148,8 +2151,10 @@
pkt->seqno = seqno;
if (resp)
ast_set_flag(pkt, FLAG_RESPONSE);
- if (fatal)
+ if (mode == XMIT_CRITICAL)
ast_set_flag(pkt, FLAG_FATAL);
+ else if (mode != XMIT_RELIABLE)
+ ast_log(LOG_WARNING, "bad mode %d in __sip_reliable_xmit\n", mode);
pkt->timer_t1 = p->timer_t1; /* Set SIP timer T1 */
if (pkt->timer_t1)
siptimer_a = pkt->timer_t1 * 2;
@@ -2363,9 +2368,8 @@
append_history(p, reliable ? "TxRespRel" : "TxResp", "%s / %s - %s", tmp.data, get_header(&tmp, "CSeq"),
(tmp.method == SIP_RESPONSE || tmp.method == SIP_UNKNOWN) ? tmp.rlPart2 : sip_methods[tmp.method].text);
}
- res = (reliable) ?
- __sip_reliable_xmit(p, seqno, 1, req->data, req->len, (reliable == XMIT_CRITICAL), req->method) :
- __sip_xmit(p, req->data, req->len);
+ res = (reliable == XMIT_UNRELIABLE) ? __sip_xmit(p, req->data, req->len) :
+ __sip_reliable_xmit(p, seqno, 1, req->data, req->len, reliable, req->method);
if (res > 0)
return 0;
return res;
@@ -2390,9 +2394,8 @@
parse_copy(&tmp, req);
append_history(p, reliable ? "TxReqRel" : "TxReq", "%s / %s - %s", tmp.data, get_header(&tmp, "CSeq"), sip_methods[tmp.method].text);
}
- res = (reliable) ?
- __sip_reliable_xmit(p, seqno, 0, req->data, req->len, (reliable > 1), req->method) :
- __sip_xmit(p, req->data, req->len);
+ res = (reliable == XMIT_UNRELIABLE) ? __sip_xmit(p, req->data, req->len) :
+ __sip_reliable_xmit(p, seqno, 0, req->data, req->len, reliable, req->method);
return res;
}
More information about the asterisk-commits
mailing list