diff --git a/pcsc-relay/src/pcsc-relay.c b/pcsc-relay/src/pcsc-relay.c index a8a708d..f861aa5 100644 --- a/pcsc-relay/src/pcsc-relay.c +++ b/pcsc-relay/src/pcsc-relay.c @@ -173,7 +173,12 @@ int main (int argc, char **argv) default: exit(2); } - vpcdport = args_info.port_arg; + vpcdport = args_info.vpcd_port_arg; + if (args_info.vpcd_hostname_given) + vpcdhostname = args_info.vpcd_hostname_arg; + viccport = args_info.vicc_port_arg; + if (args_info.vicc_hostname_given) + vicchostname = args_info.vicc_hostname_arg; verbose = args_info.verbose_given; diff --git a/pcsc-relay/src/pcsc-relay.ggo.in b/pcsc-relay/src/pcsc-relay.ggo.in index aace70f..09730cd 100644 --- a/pcsc-relay/src/pcsc-relay.ggo.in +++ b/pcsc-relay/src/pcsc-relay.ggo.in @@ -11,20 +11,38 @@ option "connector" c values="pcsc","vicc" default="pcsc" enum optional +option "foreground" f + "Stay in foreground" + flag on +option "verbose" v + "Use (several times) to be more verbose" + multiple + optional + +section "PC/SC connector" option "reader" r "Number of the PC/SC reader to use (-1 for autodetect)" int default="-1" optional -option "port" p - "Port to listen for virtual smart card" + +section "Virtual Smart Card connector" +option "vpcd-port" p + "Port for communicating virtual smart card" int default="35963" optional -option "foreground" f - "Stay in foreground" - flag off -option "verbose" v - "Use (several times) to be more verbose" - multiple +option "vpcd-hostname" n + "Hostname for connecting to virtual smart card" + string default="wait for an incoming connection" + optional + +section "Virtual Smart Card Reader emulator" +option "vicc-port" P + "Port to listen for virtual smart card reader" + int default="35963" + optional +option "vicc-hostname" N + "Hostname for connecting to virtual smart card reader" + string default="wait for an incoming connection" optional text " diff --git a/pcsc-relay/src/pcsc-relay.h b/pcsc-relay/src/pcsc-relay.h index 394645f..77a463b 100644 --- a/pcsc-relay/src/pcsc-relay.h +++ b/pcsc-relay/src/pcsc-relay.h @@ -58,6 +58,9 @@ extern struct sc_driver driver_pcsc; extern unsigned int readernum; extern struct sc_driver driver_vpcd; extern unsigned int vpcdport; +extern char *vpcdhostname; +extern unsigned int viccport; +extern char *vicchostname; void hexdump(const char *label, unsigned char *buf, size_t len); diff --git a/pcsc-relay/src/vicc.c b/pcsc-relay/src/vicc.c index 3cd921e..d172bcd 100644 --- a/pcsc-relay/src/vicc.c +++ b/pcsc-relay/src/vicc.c @@ -28,6 +28,11 @@ +unsigned int viccport = VPCDPORT; +char *vicchostname = NULL; + + + static int _vicc_connect(driver_data_t **driver_data) { struct vicc_ctx *ctx; @@ -37,7 +42,7 @@ static int _vicc_connect(driver_data_t **driver_data) return 0; - ctx = vicc_init(NULL, vpcdport); + ctx = vicc_init(vicchostname, viccport); if (!ctx) { RELAY_ERROR("Could not initialize connection to VPCD\n"); return 0; @@ -45,7 +50,7 @@ static int _vicc_connect(driver_data_t **driver_data) *driver_data = ctx; INFO("Waiting for VPCD on port %hu for %ld seconds\n", - (unsigned short) vpcdport, secs); + (unsigned short) viccport, secs); if (vicc_connect(ctx, secs, 0)) return 1; diff --git a/pcsc-relay/src/vpcd-driver.c b/pcsc-relay/src/vpcd-driver.c index b0cea8f..d24d66e 100644 --- a/pcsc-relay/src/vpcd-driver.c +++ b/pcsc-relay/src/vpcd-driver.c @@ -29,6 +29,7 @@ unsigned int vpcdport = VPCDPORT; +char *vpcdhostname = NULL; static int vpcd_connect(driver_data_t **driver_data) @@ -41,7 +42,7 @@ static int vpcd_connect(driver_data_t **driver_data) return 0; - ctx = vicc_init(NULL, vpcdport); + ctx = vicc_init(vpcdhostname, vpcdport); if (!ctx) { RELAY_ERROR("Could not initialize connection to virtual ICC\n"); return 0;