FreeCalypso > hg > themwi-interim
comparison mtctest/setup.c @ 6:33d8b3177540
mtctest compiles in the new environment
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 09 Jun 2024 01:55:28 +0000 |
parents | e7b192a5dee5 |
children | 44c1d4d787e9 |
comparison
equal
deleted
inserted
replaced
5:e7b192a5dee5 | 6:33d8b3177540 |
---|---|
6 #include <sys/types.h> | 6 #include <sys/types.h> |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <ctype.h> | 8 #include <ctype.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 #include <stdbool.h> | |
11 #include <stdlib.h> | 12 #include <stdlib.h> |
12 #include <string.h> | 13 #include <string.h> |
13 #include <strings.h> | 14 #include <strings.h> |
15 | |
16 #include <themwi/nanp/number_db_v2.h> | |
17 #include <themwi/nanp/number_lookup.h> | |
18 #include <themwi/nanp/number_utils.h> | |
19 | |
14 #include "../include/mncc.h" | 20 #include "../include/mncc.h" |
15 #include "../include/gsm48_const.h" | 21 #include "../include/gsm48_const.h" |
16 #include "../include/number_db_v2.h" | |
17 #include "../libnumdb2/lookup_func.h" | |
18 | 22 |
19 struct gsm_mncc setup_msg; | 23 struct gsm_mncc setup_msg; |
20 | 24 |
21 static void | 25 static void |
22 set_called_number(arg) | 26 set_called_number(arg) |
23 char *arg; | 27 char *arg; |
24 { | 28 { |
25 int rc, ndig; | 29 int rc, ndig; |
26 char short_num[5], long_num[12]; | 30 char short_num[5], long_num[12]; |
27 struct short_number_rec *snum; | 31 const struct short_number_rec *snum; |
28 | 32 |
29 if (!strncmp(arg, "imsi:", 5)) { | 33 if (!strncmp(arg, "imsi:", 5)) { |
30 rc = grok_imsi_user_arg(arg, setup_msg.imsi); | 34 rc = grok_imsi_user_arg(arg, setup_msg.imsi); |
31 if (rc < 0) { | 35 if (rc < 0) { |
32 fprintf(stderr, | 36 fprintf(stderr, |
40 if (arg[1] != '1') { | 44 if (arg[1] != '1') { |
41 fprintf(stderr, | 45 fprintf(stderr, |
42 "error: plus-format call destination number must begin with 1\n"); | 46 "error: plus-format call destination number must begin with 1\n"); |
43 exit(1); | 47 exit(1); |
44 } | 48 } |
45 if (grok_number_string(arg+1, 1) != 11) { | 49 if (grok_number_string(arg+1, true) != 11) { |
46 bad_plus1: fprintf(stderr, | 50 bad_plus1: fprintf(stderr, |
47 "error: malformed +1 call destination number\n"); | 51 "error: malformed +1 call destination number\n"); |
48 exit(1); | 52 exit(1); |
49 } | 53 } |
50 dehyphen_number_string(arg+1, setup_msg.called.number); | 54 dehyphen_number_string(arg+1, setup_msg.called.number); |
53 setup_msg.called.type = GSM48_TON_INTERNATIONAL; | 57 setup_msg.called.type = GSM48_TON_INTERNATIONAL; |
54 setup_msg.called.plan = GSM48_NPI_ISDN_E164; | 58 setup_msg.called.plan = GSM48_NPI_ISDN_E164; |
55 setup_msg.fields |= MNCC_F_CALLED; | 59 setup_msg.fields |= MNCC_F_CALLED; |
56 return; | 60 return; |
57 } | 61 } |
58 ndig = grok_number_string(arg, 1); | 62 ndig = grok_number_string(arg, true); |
59 switch (ndig) { | 63 switch (ndig) { |
60 case 4: | 64 case 4: |
61 dehyphen_number_string(arg, short_num); | 65 dehyphen_number_string(arg, short_num); |
62 if (read_number_db() < 0) { | 66 if (read_number_db() < 0) { |
63 fprintf(stderr, "error reading number database\n"); | 67 fprintf(stderr, "error reading number database\n"); |