allow setting hostname/port for vpcd/vicc interfaces
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user