FreeCalypso > hg > osmo-playpen
comparison smsc-daemon/main.c @ 19:9ff041d85da5
proto-smsc-daemon: allow HLR GSUP server other than 127.0.0.1
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sat, 16 Dec 2023 22:23:23 +0000 |
| parents | d9db8661d9f3 |
| children |
comparison
equal
deleted
inserted
replaced
| 18:9c2c1444dca9 | 19:9ff041d85da5 |
|---|---|
| 77 gsup_ipa_dev.serno = smsc_ipa_name; | 77 gsup_ipa_dev.serno = smsc_ipa_name; |
| 78 } | 78 } |
| 79 | 79 |
| 80 int main(int argc, char **argv) | 80 int main(int argc, char **argv) |
| 81 { | 81 { |
| 82 char *server_host = "127.0.0.1"; | 82 const char *server_host; |
| 83 uint16_t server_port = OSMO_GSUP_PORT; | 83 uint16_t server_port = OSMO_GSUP_PORT; |
| 84 void *ctx = talloc_named_const(NULL, 0, "proto-smsc"); | 84 void *ctx = talloc_named_const(NULL, 0, "proto-smsc"); |
| 85 | 85 |
| 86 osmo_init_logging2(ctx, &smsc_log_info); | 86 osmo_init_logging2(ctx, &smsc_log_info); |
| 87 | 87 |
| 88 if (argc < 3 || argc > 4) { | 88 if (argc < 4 || argc > 5) { |
| 89 fprintf(stderr, "usage: %s ipa-name logfile [local-socket]\n", | 89 fprintf(stderr, |
| 90 "usage: %s hlr-ip ipa-name logfile [local-socket]\n", | |
| 90 argv[0]); | 91 argv[0]); |
| 91 exit(1); | 92 exit(1); |
| 92 } | 93 } |
| 93 set_ipa_name(argv[1]); | 94 server_host = argv[1]; |
| 94 open_log_file(argv[2]); | 95 set_ipa_name(argv[2]); |
| 96 open_log_file(argv[3]); | |
| 95 | 97 |
| 96 build_ipa_dev(); | 98 build_ipa_dev(); |
| 97 g_gc = osmo_gsup_client_create2(ctx, &gsup_ipa_dev, server_host, | 99 g_gc = osmo_gsup_client_create2(ctx, &gsup_ipa_dev, server_host, |
| 98 server_port, gsupc_read_cb, NULL); | 100 server_port, gsupc_read_cb, NULL); |
| 99 if (!g_gc) { | 101 if (!g_gc) { |
| 100 fprintf(stderr, "error: osmo_gsup_client_create2() failed\n"); | 102 fprintf(stderr, "error: osmo_gsup_client_create2() failed\n"); |
| 101 exit(1); | 103 exit(1); |
| 102 } | 104 } |
| 103 if (argv[3]) | 105 if (argv[4]) |
| 104 setup_local_socket(argv[3]); | 106 setup_local_socket(argv[4]); |
| 105 | 107 |
| 106 while (1) { | 108 while (1) { |
| 107 osmo_select_main(0); | 109 osmo_select_main(0); |
| 108 } | 110 } |
| 109 | 111 |
