MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / tm_repl_cancel

Function tm_repl_cancel

modules/tm/cluster.c:48–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 } while(0)
47
48static void tm_repl_cancel(bin_packet_t *packet, str *buf, struct receive_info *ri)
49{
50 int itmp;
51 char *tmp;
52 str stmp;
53 struct cell *t;
54 /* build a nice static message, exactly how t_lookupOriginalT() expects */
55 struct sip_msg msg;
56 struct via_body via;
57 struct via_param branch;
58
59 /* cleanup the structure */
60 memset(&msg, 0, sizeof(msg));
61
62 branch.value.s = NULL;
63 branch.value.len = 0;
64
65 TM_BIN_POP(int, &itmp, "via branch offset");
66 if (itmp != 0) {
67 TM_BIN_POP(int, &branch.value.len, "via branch length");
68
69 if (branch.value.len > MCOOKIE_LEN &&
70 !memcmp(buf->s + itmp, MCOOKIE,MCOOKIE_LEN))
71 branch.value.s = buf->s + itmp;
72 }
73
74 if (!branch.value.s) {
75 /* if there is no RFC3261 magic cookie in the branch param, we do the message
76 * parsing here, as we will need several headers for matching anyway */
77 msg.buf = buf->s;
78 msg.len = buf->len;
79 msg.rcv=*ri;
80 msg.ruri_q = Q_UNSPECIFIED;
81 msg.id=get_next_msg_no();
82
83 if (parse_msg(buf->s, buf->len, &msg) != 0) {
84 tmp = ip_addr2a(&(ri->src_ip));
85 LM_ERR("Unable to parse replicated CANCEL received from [%s:%d]\n",
86 tmp, ri->src_port);
87 return;
88 }
89
90 TM_BIN_POP(int, &itmp, "via host offset");
91 if (itmp != 0)
92 TM_BIN_POP(int, &itmp, "via host length");
93 TM_BIN_POP(int, &itmp, "via transport offset");
94 if (itmp != 0)
95 TM_BIN_POP(int, &msg.via1->transport.len, "via transport length");
96 TM_BIN_POP(int, &itmp, "via port");
97 } else {
98 msg.REQ_METHOD = METHOD_CANCEL;
99 msg.via1 = &via;
100 msg.via1->branch = &branch;
101
102 TM_BIN_POP(int, &itmp, "via host offset");
103 if (itmp != 0) {
104 msg.via1->host.s = buf->s + itmp;
105 TM_BIN_POP(int, &msg.via1->host.len, "via host length");

Callers 1

receive_tm_replFunction · 0.85

Calls 10

get_next_msg_noFunction · 0.85
ip_addr2aFunction · 0.85
set_tFunction · 0.85
reset_cancelled_tFunction · 0.85
t_lookupOriginalTFunction · 0.85
t_set_reasonFunction · 0.85
t_relay_toFunction · 0.85
t_unref_cellFunction · 0.85
get_tFunction · 0.85
free_sip_msgFunction · 0.85

Tested by

no test coverage detected