FreeCalypso > hg > sms-coding-utils
annotate gen-pdu/settings.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 functions for various settings that come before |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * msg or msg-udh lines. |
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 <stdio.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <strings.h> |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "error.h" |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 extern int dir_mo, include_sca; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 extern u_char sc_addr[12], user_addr[12]; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 extern u_char mr_byte, pid_byte, dcs_byte; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 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
|
17 extern u_char vp_format, vp_buf[7]; |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 extern int is_septet, scts_is_set; |
16
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
19 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
|
20 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 extern int input_lineno; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 set_sc_addr(argc, argv) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 char **argv; |
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 int rc; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 if (!include_sca) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 fprintf(stderr, ERR_PREFIX |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 "sc-addr is not allowed in bare TPDU mode\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 rc = encode_phone_number_arg(argv[1], sc_addr, 0); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 if (rc < 0) { |
15
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
37 fprintf(stderr, ERR_PREFIX "invalid SC-address argument\n", |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 set_user_addr(argc, argv) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 char **argv; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 int rc; |
15
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
48 char *err_desc; |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
15
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
50 if (!strncmp(argv[1], "alpha:", 6)) { |
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
51 rc = encode_alpha_addr(argv[1] + 6, user_addr); |
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
52 err_desc = "alpha address"; |
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
53 } else { |
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
54 rc = encode_phone_number_arg(argv[1], user_addr, 1); |
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
55 err_desc = "phone number"; |
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
56 } |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 if (rc < 0) { |
15
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
58 fprintf(stderr, ERR_PREFIX "invalid %s argument\n", |
5854e48d0ef7
sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
59 input_lineno, err_desc); |
9
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 set_mr_byte(argc, argv) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 char **argv; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 char *endp; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 if (!dir_mo) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 fprintf(stderr, ERR_PREFIX "mr is not allowed in MT mode\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 mr_byte = strtoul(argv[1], &endp, 0); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 if (*endp) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 set_pid_byte(argc, argv) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 char **argv; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 char *endp; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 pid_byte = strtoul(argv[1], &endp, 0); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 if (*endp) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 fprintf(stderr, ERR_PREFIX "invalid byte value argument\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 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 set_dcs(argc, argv) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 char **argv; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 char *endp; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 dcs_byte = strtoul(argv[1], &endp, 0); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 if (*endp) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 if (!strcmp(argv[2], "septet")) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 is_septet = 1; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 else if (!strcmp(argv[2], "octet")) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 is_septet = 0; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 else { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 fprintf(stderr, ERR_PREFIX "invalid septet/octet mode kw\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 } |
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 void |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 set_scts(argc, argv) |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 char **argv; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 int rc; |
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 if (dir_mo) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 fprintf(stderr, ERR_PREFIX "sc-ts is not allowed in MO mode\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 rc = encode_gsm_sms_abstime(argv[1], scts_buf); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 if (rc < 0) { |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 fprintf(stderr, ERR_PREFIX "invalid timestamp argument\n", |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 input_lineno); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 exit(1); |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 } |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 scts_is_set = 1; |
003660a57f99
new program sms-gen-tpdu
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 } |
16
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
139 |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
140 void |
18
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
141 set_vp_abs(argc, argv) |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
142 char **argv; |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
143 { |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
144 int rc; |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
145 |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
146 if (!dir_mo) { |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
147 fprintf(stderr, ERR_PREFIX "vp-abs is not allowed in MT mode\n", |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
148 input_lineno); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
149 exit(1); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
150 } |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
151 rc = encode_gsm_sms_abstime(argv[1], vp_buf); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
152 if (rc < 0) { |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
153 fprintf(stderr, ERR_PREFIX "invalid timestamp argument\n", |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
154 input_lineno); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
155 exit(1); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
156 } |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
157 vp_format = 0x18; |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
158 } |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
159 |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
160 void |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
161 set_vp_rel(argc, argv) |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
162 char **argv; |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
163 { |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
164 char *endp; |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
165 |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
166 if (!dir_mo) { |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
167 fprintf(stderr, ERR_PREFIX "vp-rel is not allowed in MT mode\n", |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
168 input_lineno); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
169 exit(1); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
170 } |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
171 vp_buf[0] = strtoul(argv[1], &endp, 0); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
172 if (*endp) { |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
173 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n", |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
174 input_lineno); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
175 exit(1); |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
176 } |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
177 vp_format = 0x10; |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
178 } |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
179 |
590b0b5bcbbb
sms-gen-tpdu: support setting VP for MO
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
180 void |
16
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
181 set_flag_rp() |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
182 { |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
183 flag_rp = 1; |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
184 } |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
185 |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
186 void |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
187 set_flag_sr() |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
188 { |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
189 flag_sr = 1; |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
190 } |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
191 |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
192 void |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
193 set_flag_lp() |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
194 { |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
195 if (dir_mo) { |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
196 fprintf(stderr, ERR_PREFIX "lp is not allowed in MO mode\n", |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
197 input_lineno); |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
198 exit(1); |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
199 } |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
200 flag_lp = 1; |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
201 } |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
202 |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
203 void |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
204 set_flag_mms() |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
205 { |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
206 if (dir_mo) { |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
207 fprintf(stderr, ERR_PREFIX "mms is not allowed in MO mode\n", |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
208 input_lineno); |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
209 exit(1); |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
210 } |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
211 flag_mms = 1; |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
212 } |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
213 |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
214 void |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
215 set_flag_rd() |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
216 { |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
217 if (!dir_mo) { |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
218 fprintf(stderr, ERR_PREFIX "rd is not allowed in MT mode\n", |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
219 input_lineno); |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
220 exit(1); |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
221 } |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
222 flag_rd = 1; |
d9d722033ff1
sms-gen-tpdu: add support for first octet flags
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
223 } |