FreeCalypso > hg > sms-coding-utils
annotate gen-pdu/message.c @ 29:aae078d9eaa6
immigrate sms-pdu-decode and pcm-sms-decode here
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Jun 2024 02:39:21 +0000 |
parents | 590b0b5bcbbb |
children |
rev | line source |
---|---|
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements TPDU encoding of actual messages, after all |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * settings have been captured. |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <ctype.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdio.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <string.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <strings.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "error.h" |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 extern int dir_mo, include_sca; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 extern u_char sc_addr[12], user_addr[12]; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 extern u_char mr_byte, pid_byte, dcs_byte; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 extern u_char scts_buf[7]; |
18
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
18 extern u_char vp_format, vp_buf[7]; |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 extern int is_septet, scts_is_set; |
16
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
20 extern int flag_rp, flag_sr, flag_lp, flag_mms, flag_rd; |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 extern int input_lineno; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 static void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 emit_first_octet(udhi) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 u_char fo; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
18
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
29 if (dir_mo) { |
16
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
30 fo = flag_rd ? 5 : 1; |
18
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
31 fo |= vp_format; |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
32 } else { |
16
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
33 fo = flag_mms ? 0 : 4; |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
34 if (flag_lp) |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
35 fo |= 0x08; |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
36 } |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
37 if (flag_sr) |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
38 fo |= 0x20; |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 if (udhi) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 fo |= 0x40; |
16
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
41 if (flag_rp) |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
42 fo |= 0x80; |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 printf("%02X", fo); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 static void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 make_pdu(udl, ud_buf, ud_octets, udhi) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 u_char *ud_buf; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 unsigned udl, ud_octets; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 if (include_sca) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 emit_hex_out(sc_addr, sc_addr[0] + 1, stdout); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 emit_first_octet(udhi); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 if (dir_mo) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 printf("%02X", mr_byte); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 emit_hex_out(user_addr, ((user_addr[0] + 1) >> 1) + 2, stdout); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 printf("%02X", pid_byte); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 printf("%02X", dcs_byte); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 if (!dir_mo) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 if (!scts_is_set) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 set_auto_scts(); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 emit_hex_out(scts_buf, 7, stdout); |
18
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
63 } else if (vp_format == 0x10) |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
64 printf("%02X", vp_buf[0]); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
65 else if (vp_format) |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
66 emit_hex_out(vp_buf, 7, stdout); |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 printf("%02X", udl); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 emit_hex_out(ud_buf, ud_octets, stdout); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 putchar('\n'); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 static void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 cmd_msg_common(arg, udhi) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 char *arg; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 u_char input[160], ud7[160], octbuf[140]; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 unsigned input_len, udhl, udhl1, udh_chars, plain_chars; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 unsigned udl, udl_octets; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 for (input_len = 0; ; input_len++) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 while (isspace(*arg)) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 arg++; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 if (!*arg) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 break; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 if (!isxdigit(arg[0]) || !isxdigit(arg[1])) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 fprintf(stderr, ERR_PREFIX "invalid hex string\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 if (input_len >= 160) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 toolong: fprintf(stderr, ERR_PREFIX "hex string is too long\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 input[input_len] = (decode_hex_digit(arg[0]) << 4) | |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 decode_hex_digit(arg[1]); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 arg += 2; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 if (!is_septet && input_len > 140) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 goto toolong; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 if (udhi) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 if (!input_len) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 fprintf(stderr, ERR_PREFIX |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 "empty message is invalid with UDHI\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 udhl = input[0]; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 udhl1 = udhl + 1; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 if (udhl1 > input_len) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 fprintf(stderr, ERR_PREFIX "UDHL exceeds UD length\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 if (!is_septet) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 make_pdu(input_len, input, input_len, udhi); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 return; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 if (udhi) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 udh_chars = (udhl1 * 8 + 6) / 7; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 else { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 udhl1 = 0; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 udh_chars = 0; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 plain_chars = input_len - udhl1; |
12
0fe95ca922c7
sms-gen-tpdu: check the high bit of GSM7 msg input
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
127 if (check_high_bit(input + udhl1, plain_chars) < 0) { |
0fe95ca922c7
sms-gen-tpdu: check the high bit of GSM7 msg input
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
128 fprintf(stderr, ERR_PREFIX "high bit set in GSM7 data\n", |
0fe95ca922c7
sms-gen-tpdu: check the high bit of GSM7 msg input
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
129 input_lineno); |
0fe95ca922c7
sms-gen-tpdu: check the high bit of GSM7 msg input
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
130 exit(1); |
0fe95ca922c7
sms-gen-tpdu: check the high bit of GSM7 msg input
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
131 } |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 udl = udh_chars + plain_chars; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 if (udl > 160) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 fprintf(stderr, ERR_PREFIX |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 "message exceeds 160 septets after UDH\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 udl_octets = (udl * 7 + 7) / 8; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 bzero(ud7, 160); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 bcopy(input + udhl1, ud7 + udh_chars, plain_chars); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 gsm7_pack(ud7, octbuf, udl_octets); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 if (udhi) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 bcopy(input, octbuf, udhl1); |
10
17dd30989c0b
sms-gen-tpdu: fix bug in GSM7 data source
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
145 make_pdu(udl, octbuf, udl_octets, udhi); |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 cmd_msg_plain(argc, argv) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 char **argv; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 cmd_msg_common(argv[1], 0); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 cmd_msg_udh(argc, argv) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 char **argv; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 cmd_msg_common(argv[1], 1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 } |