* Sebastian Hammer, Adam Dickmeiss
*
* $Log: client.c,v $
- * Revision 1.84 1999-06-01 14:29:11 adam
+ * Revision 1.85 1999-06-16 11:55:24 adam
+ * Added APDU log to client.
+ *
+ * Revision 1.84 1999/06/01 14:29:11 adam
* Work on Extended Services.
*
* Revision 1.83 1999/05/26 15:24:26 adam
#include <yaz-util.h>
-#include <comstack.h>
#include <tcpip.h>
#ifdef USE_XTIMOSI
#include <xmosi.h>
#define C_PROMPT "Z> "
static ODR out, in, print; /* encoding and decoding streams */
+static FILE *apdu_file = 0;
static COMSTACK conn = 0; /* our z-association */
static Z_IdAuthentication *auth = 0; /* our current auth definition */
static char *databaseNames[128];
odr_perror(out, "Encoding APDU");
exit(1);
}
+ if (apdu_file)
+ {
+ z_APDU(print, &a, 0, 0);
+ odr_reset(print);
+ }
buf = odr_getbuf(out, &len, 0);
if (cs_put(conn, buf, len) < 0)
{
exit(1);
}
setvbuf(stdout, 0, _IONBF, 0);
+ if (apdu_file)
+ odr_setprint(print, apdu_file);
#if CCL2RPN
bibset = ccl_qual_mk ();
fprintf(stderr, "---------\n");
exit(1);
}
-#if 0
- if (!z_APDU(print, &apdu, 0))
+ if (apdu_file && !z_APDU(print, &apdu, 0, 0))
{
odr_perror(print, "Failed to print incoming APDU");
odr_reset(print);
continue;
}
-#endif
switch(apdu->which)
{
case Z_APDU_initResponse:
int ret;
int opened = 0;
- while ((ret = options("m:v:", argv, argc, &arg)) != -2)
+ while ((ret = options("a:m:v:", argv, argc, &arg)) != -2)
{
switch (ret)
{
exit (1);
}
break;
+ case 'a':
+ if (!strcmp(arg, "-"))
+ apdu_file=stderr;
+ else
+ apdu_file=fopen(arg, "a");
+ break;
case 'v':
log_init (log_mask_str(arg), "", NULL);
break;
default:
- fprintf (stderr, "Usage: %s [-m <marclog>] [<server-addr>]\n",
+ fprintf (stderr, "Usage: %s [-m <marclog>] [ -m <apdulog>] "
+ "[<server-addr>]\n",
prog);
exit (1);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: xmosi.c,v $
- * Revision 1.16 1997-09-17 12:10:30 adam
+ * Revision 1.17 1999-06-16 11:55:24 adam
+ * Added APDU log to client.
+ *
+ * Revision 1.16 1997/09/17 12:10:30 adam
* YAZ version 1.4.
*
* Revision 1.15 1997/05/14 06:53:34 adam
* up in a t_mosiaddr in a netbuf (on a stick).
*/
-int MDF *mosi_strtoaddr_ex(const char *str, struct netbuf *ret)
+int *mosi_strtoaddr_ex(const char *str, struct netbuf *ret)
{
struct sockaddr_in *add = xmalloc(sizeof(struct sockaddr_in));
struct t_mosiaddr *mosiaddr = xmalloc(sizeof(struct t_mosiaddr));
return 1;
}
-struct netbuf MDF *mosi_strtoaddr(const char *str)
+struct netbuf *mosi_strtoaddr(const char *str)
{
struct netbuf *ret = xmalloc(sizeof(struct netbuf));
return ret;
}
-struct netbuf MDF *mosi_straddr(COMSTACK h, const char *str)
+struct netbuf *mosi_straddr(COMSTACK h, const char *str)
{
mosi_state *st = h->cprivate;
struct netbuf *ret = &st->netbuf;