* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.208 2003-09-04 18:51:49 adam Exp $
+ * $Id: client.c,v 1.209 2003-10-17 14:13:59 adam Exp $
*/
#include <stdio.h>
static char *codeset = 0; /* character set for output */
static int hex_dump = 0;
+static char *dump_file_prefix = 0;
static ODR out, in, print; /* encoding and decoding streams */
#if HAVE_XML2
static ODR srw_sr_odr_out = 0;
printf("\n");
}
}
+ if (dump_file_prefix)
+ {
+ static int no = 0;
+ if (++no < 1000 && strlen(dump_file_prefix) < 500)
+ {
+ char fname[1024];
+ FILE *of;
+ sprintf (fname, "%s.%03d.raw", dump_file_prefix, no);
+ of = fopen(fname, "wb");
+
+ fwrite (buf, 1, len, of);
+
+ fclose(of);
+ }
+ }
}
void add_otherInfos(Z_APDU *a)
if (ber_file)
odr_dumpBER(ber_file, buf, len);
/* printf ("sending APDU of size %d\n", len); */
+ do_hex_dump(buf, len);
if (cs_put(conn, buf, len) < 0)
{
fprintf(stderr, "cs_put: %s", cs_errmsg(cs_errno(conn)));
close_session();
return 0;
}
- do_hex_dump(buf,len);
odr_reset(out); /* release the APDU structure */
return 1;
}
/* we don't odr_reset(out), since we may need the buffer again */
+ do_hex_dump(buf_out, len_out);
+
r = cs_put(conn, buf_out, len_out);
odr_destroy(o);
buf_out = odr_getbuf(out, &len_out, 0);
+ do_hex_dump(buf_out, len_out);
+
cs_put(conn, buf_out, len_out);
odr_reset(out);
if (codeset)
outputCharset = xstrdup(codeset);
- while ((ret = options("k:c:q:a:b:m:v:p:u:t:Vx", argv, argc, &arg)) != -2)
+ while ((ret = options("k:c:q:a:b:m:v:p:u:t:Vxd:", argv, argc, &arg)) != -2)
{
switch (ret)
{
strcat (open_command, arg);
}
break;
+ case 'd':
+ dump_file_prefix = arg;
+ break;
case 'k':
kilobytes = atoi(arg);
break;
fprintf (stderr, "Usage: %s [-m <marclog>] [ -a <apdulog>] "
"[-b berdump] [-c cclfields] \n"
"[-q cqlfields] [-p <proxy-addr>] [-u <auth>] "
- "[-k size] [-V] [<server-addr>]\n",
+ "[-k size] [-d dump] [-V] [<server-addr>]\n",
prog);
exit (1);
}