diff --git a/doc/manuals/chapters/remsim-bankd.adoc b/doc/manuals/chapters/remsim-bankd.adoc new file mode 100644 index 0000000..a3e708d --- /dev/null +++ b/doc/manuals/chapters/remsim-bankd.adoc @@ -0,0 +1,51 @@ +== remsim-bankd + +=== Running + +remsim-bankd currently has the following command-line options: + +==== SYNOPSIS + +*remsim-bankd* [-h] [-i A.B.C.D] [-p <1-65535>] [-b <1-65535>] [-I A.B.C.D] [-P <1-65535> ] + +==== OPTIONS + +*-h, --help*:: + Print a short help message about the supported options +*-i, --server-ip A.B.C.D*:: + Specify the remote IP address of the remsim-server to which this bankd + shall establish its <> control connection +*-p, --server-port <1-65535>*:: + Specify the remote TCP port number of the remsim-server to whihc this bankd + shall establish its <> control connection +*-b, --bank-id <1-65535>*:: + Specify the numeric bank identifier of the SIM bank this bankd instance + operates. Must be unique among all banks connecting to the same remsim-server. +*-I, --bind-IP A.B.C.D*:: + Specify the local IP address to which the socket for incoming connections + from remsim-clients is bound to. +*-P, --bind-port <1-65535>*:: + Specify the local TCP port to whicc the socket for incoming connections + from remsim-clients is bound to. + +=== Logging + +remsim-bankd currently logs to stdout only, and the logging verbosity +is not yet configurable. However, as the libosmocore logging framework +is used, extending this is an easy modification. + +=== `bankd_pcsc_slots.csv` CSV file + +bankd expects a CSV file `bankd_pcsc_slots.csv` in the current working directory at startup. + +This CSV file specifies the mapping between the string names of the PCSC +readers and the <> bandk/slot numbers. The format is as follows: + +.Example: CSV file mapping bankd slots 0..4 to an ACS ACR33U-A1 reader slots +---- +"1","0","ACS ACR33 ICC Reader 00 00" +"1","1","ACS ACR33 ICC Reader 00 01" +"1","2","ACS ACR33 ICC Reader 00 02" +"1","3","ACS ACR33 ICC Reader 00 03" +"1","4","ACS ACR33 ICC Reader 00 04" +---- diff --git a/doc/manuals/chapters/remsim-client.adoc b/doc/manuals/chapters/remsim-client.adoc new file mode 100644 index 0000000..98ae4da --- /dev/null +++ b/doc/manuals/chapters/remsim-client.adoc @@ -0,0 +1,70 @@ +== simtrace2-remsim-client + +=== Running + +simtrace2-remsim-client currently has the following command-line options: + +==== SYNOPSIS + +*simtrace2-remsim-client* [...] + +==== OPTIONS + +*-h, --help*:: + Print a short help message about the supported options +*-s, --server-host A.B.C.D*:: + Specify the remote IP address / hostname of the remsim-server to which + this client shall establish its <> control connection +*-p, --server-port <1-65535>*:: + Specify the remote TCP port number of the remsim-server to which this client + shall establish its <> control connection +*-c, --client-id <1-65535>*:: + Specify the numeric client identifier of the SIM bank this bankd + instance operates. The tuple of client-id and client-slot must be unique + among all clients connecting to the same remsim-server. +*-n, --client-slot <0-65535>*:: + Specify the slot number served within this client. The tuple of + client-id and client-slot must be unique among all clients connecting + to the same remsim-server. +*-i, --gsmtap-ip A.B.C.D*:: + Specify the IP address (if any) to which APDU traces are sent in + GSMTAP format (useful for debugging; supported by wireshark). +*-k, --keep-running*:: + Specify if the remsim-client should terminate after handling one + session, or whether it should keep running. Fast respawn (i.e. no + --keep-running) is probably the more robust option at this point. +*-V, --usb-vendor*:: + Specify the USB Vendor ID of the USB device served by this client, + use e.g. 0x1d50 for SIMtrace2, sysmoQMOD and OWHW. +*-P, --usb-product*:: + Specify the USB Product ID of the USB device served by this client, + use e.g. 0x4004 for sysmoQMOD. +*-C, --usb-config*:: + Specify the USB Cofiguration number of the USB device served by this + client. Default will use current configuration of the device. +*-I, --usb-interface*:: + Specify the USB Interface number (within active configuration) of the + USB device served by this client. Default will use FIXME. +*-S, --usb-altsetting*:: + Specify the USB Alternate Setting to be used within the USB Interface + of the USB device served by this client. Default will use FIXME. +*-A, --usb-address <0-255>*:: + Specify the USB Address of the USB device served by this client. This + is useful in case multiple identical USB devices are attached to the + same host. However, the address changed at every re-enumeration and + it's therefor recommended to use the USB path (see below). +*-H, --usb-path*:: + Specify the USB path of the USB device served by this client. This is + usefule to disambiguate between multiple identical USB devices + attached to the same host. You don't need this if you have only one + SIM emulation device attached to your system. +*-a, --atr HEXSTRING*:: + Specify the initial ATR to be communicated to the modem/phone. Can + and will later be overridden by the ATR as specified by remsim-bankd + once a card has been mapped to this client. + +=== Logging + +remsim-client currently logs to stdout only, and the logging verbosity +is not yet configurable. However, as the libosmocore logging framework +is used, extending this is an easy modification. diff --git a/src/bankd_main.c b/src/bankd_main.c index 54c20ca..0b4a718 100644 --- a/src/bankd_main.c +++ b/src/bankd_main.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -215,9 +216,67 @@ static int bankd_srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t return 0; } +static void printf_help() +{ + printf( +" -h --help Print this help message\n" +" -i --server-host A.B.C.D remsim-server IP address (default: 127.0.0.1)\n" +" -p --server-port <1-65535> remsim-server TCP port (default: 9998)\n" +" -b --bank-id <1-65535> Bank Identifier of this SIM bank (default: 1)\n" +" -I --bind-ip A.B.C.D Local IP address to bind for incoming client\n" +" connections (default: INADDR_ANY)\n" +" -P --bind-port <1-65535> Local TCP port to bind for incoming client\n" +" connectionss (default: 9999)\n" + ); +} + +static int g_bind_port = 9999; +static char *g_bind_ip = NULL; void handle_options(int argc, char **argv) { + while (1) { + int option_index = 0, c; + static const struct option long_options[] = { + { "help", 0, 0, 'h' }, + { "server-host", 1, 0, 'i' }, + { "server-port", 1, 0, 'p' }, + { "bank-id", 1, 0, 'b' }, + { "component-name", 1, 0, 'N' }, + { "bind-ip", 1, 0, 'I' }, + { "bind-port", 1, 0, 'P' }, + { 0, 0, 0, 0 } + }; + + c = getopt_long(argc, argv, "hi:o:b:N:I:P:", long_options, &option_index); + if (c == -1) + break; + + switch (c) { + case 'h': + printf_help(); + exit(0); + break; + case 'i': + g_bankd->srvc.server_host = optarg; + break; + case 'p': + g_bankd->srvc.server_port = atoi(optarg); + break; + case 'b': + g_bankd->cfg.bank_id = atoi(optarg); + break; + case 'N': + OSMO_STRLCPY_ARRAY(g_bankd->srvc.own_comp_id.name, optarg); + break; + case 'I': + g_bind_ip = optarg; + break; + case 'P': + g_bind_port = atoi(optarg); + break; + } + } } int main(int argc, char **argv) @@ -253,7 +312,7 @@ int main(int argc, char **argv) } /* create listening socket for inbound client connections */ - rc = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 9999, OSMO_SOCK_F_BIND); + rc = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP, g_bind_ip, g_bind_port, OSMO_SOCK_F_BIND); if (rc < 0) exit(1); g_bankd->accept_fd = rc;