FreeCalypso > hg > themwi-system-sw
annotate smpp-trx-sa/pdu_out.c @ 225:243ed87880a1
smpp-send: implement sending via local socket
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 05 Aug 2023 12:52:33 -0800 |
parents | 9d6e8d99d2b1 |
children |
rev | line source |
---|---|
222
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements all functions related to sending outgoing PDUs |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * to the SMPP server. |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <strings.h> |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <unistd.h> |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 extern int tcpsock; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 static unsigned req_out_seq = 1; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 static void |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 pdu_to_tcp(pdu, pdulen) |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 u_char *pdu; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 unsigned pdulen; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 { |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 int cc; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 cc = write(tcpsock, pdu, pdulen); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 if (cc != pdulen) { |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 perror("write to TCP socket"); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 log_fatal_error("error writing to TCP socket"); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 exit(1); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 } |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 } |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 void |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 send_bind_req(system_id, password) |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 char *system_id, *password; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 { |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 u_char bind_req[64], *dp; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 unsigned bind_req_len, slen; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 dp = bind_req + 4; /* length will be filled last */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 /* command_id */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 *dp++ = 0x09; /* bind_transceiver */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 /* empty command_status */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 /* sequence_number */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 *dp++ = 1; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 /* system_id */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 slen = strlen(system_id) + 1; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 bcopy(system_id, dp, slen); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 dp += slen; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 /* password */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 slen = strlen(password) + 1; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 bcopy(password, dp, slen); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 dp += slen; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 /* system_type */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 strcpy(dp, "SMPP"); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 dp += 5; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 /* interface_version */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 *dp++ = 0x34; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 /* addr_ton */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 /* addr_npi */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 /* address_range */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 *dp++ = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 bind_req_len = dp - bind_req; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 bind_req[0] = bind_req_len >> 24; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 bind_req[1] = bind_req_len >> 16; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 bind_req[2] = bind_req_len >> 8; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 bind_req[3] = bind_req_len; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 pdu_to_tcp(bind_req, bind_req_len); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 log_sent_pdu(bind_req, bind_req_len); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 } |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 void |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 send_enq_link_resp(rx_hdr) |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 u_char *rx_hdr; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 { |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 u_char resp[16]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 /* command_length */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 resp[0] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 resp[1] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 resp[2] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 resp[3] = 16; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 /* command_id */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 resp[4] = rx_hdr[4] | 0x80; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 resp[5] = rx_hdr[5]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 resp[6] = rx_hdr[6]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 resp[7] = rx_hdr[7]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 /* command_status */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 resp[8] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 resp[9] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 resp[10] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 resp[11] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 /* sequence_number */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 resp[12] = rx_hdr[12]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 resp[13] = rx_hdr[13]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 resp[14] = rx_hdr[14]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 resp[15] = rx_hdr[15]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 /* good to go */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 pdu_to_tcp(resp, 16); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 } |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 void |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 send_message_resp(rx_hdr) |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 u_char *rx_hdr; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 { |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 u_char resp[17]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 /* command_length */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 resp[0] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 resp[1] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 resp[2] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 resp[3] = 17; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 /* command_id */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 resp[4] = rx_hdr[4] | 0x80; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 resp[5] = rx_hdr[5]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 resp[6] = rx_hdr[6]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 resp[7] = rx_hdr[7]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 /* command_status */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 resp[8] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 resp[9] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 resp[10] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 resp[11] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 /* sequence_number */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 resp[12] = rx_hdr[12]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 resp[13] = rx_hdr[13]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 resp[14] = rx_hdr[14]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 resp[15] = rx_hdr[15]; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 /* empty message_id */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 resp[16] = 0; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 /* good to go */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 pdu_to_tcp(resp, 17); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 log_sent_pdu(resp, 17); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 } |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 void |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 send_pdu_from_localsock(pdu, pdulen) |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 u_char *pdu; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 unsigned pdulen; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 { |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 /* assign incrementing sequence number */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 req_out_seq++; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 if (req_out_seq > 0x7FFFFFFF) |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 req_out_seq = 1; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 pdu[12] = req_out_seq >> 24; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 pdu[13] = req_out_seq >> 16; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 pdu[14] = req_out_seq >> 8; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 pdu[15] = req_out_seq; |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 /* good to go */ |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 pdu_to_tcp(pdu, pdulen); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 log_sent_pdu(pdu, pdulen); |
9d6e8d99d2b1
smpp-trx-sa: new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 } |