summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1132550)
This function may be used to save APDUs for a connection to a WRBUF.
ZOOM_API(const char *)
ZOOM_get_event_str(int event);
ZOOM_API(const char *)
ZOOM_get_event_str(int event);
+#ifdef WRBUF_H
+
+/** \brief log APDUs to WRBUF
+ \param c connection
+ \param w WRBUF where APDUs are logged
+*/
+ZOOM_API(void) ZOOM_connection_save_apdu_wrbuf(ZOOM_connection c, WRBUF w);
+#endif
+
odr_set_stream(o, file, odr_FILE_write, odr_FILE_close);
}
odr_set_stream(o, file, odr_FILE_write, odr_FILE_close);
}
void odr_set_stream(ODR o, void *handle,
void (*stream_write)(ODR o,
void *handle, int type,
void odr_set_stream(ODR o, void *handle,
void (*stream_write)(ODR o,
void *handle, int type,
ZOOM_connection_remove_task(c);
}
ZOOM_connection_remove_task(c);
}
+static void odr_wrbuf_write(ODR o, void *handle, int type,
+ const char *buf, int len)
+{
+ WRBUF w = (WRBUF) handle;
+ wrbuf_write(w, buf, len);
+}
ZOOM_API(ZOOM_connection)
ZOOM_connection_create(ZOOM_options options)
ZOOM_API(ZOOM_connection)
ZOOM_connection_create(ZOOM_options options)
c->odr_in = odr_createmem(ODR_DECODE);
c->odr_out = odr_createmem(ODR_ENCODE);
c->odr_print = 0;
c->odr_in = odr_createmem(ODR_DECODE);
c->odr_out = odr_createmem(ODR_ENCODE);
c->odr_print = 0;
c->async = 0;
c->support_named_resultsets = 0;
c->async = 0;
c->support_named_resultsets = 0;
+ZOOM_API(void) ZOOM_connection_save_apdu_wrbuf(ZOOM_connection c, WRBUF w)
+{
+ if (c->odr_save)
+ {
+ odr_destroy(c->odr_save);
+ c->odr_save = 0;
+ }
+ if (w)
+ {
+ c->odr_save = odr_createmem(ODR_PRINT);
+ odr_set_stream(c->odr_save, w, odr_wrbuf_write, 0);
+ }
+}
/* set database names. Take local databases (if set); otherwise
take databases given in ZURL (if set); otherwise use Default */
/* set database names. Take local databases (if set); otherwise
take databases given in ZURL (if set); otherwise use Default */
xfree(c->diagset);
odr_destroy(c->odr_in);
odr_destroy(c->odr_out);
xfree(c->diagset);
odr_destroy(c->odr_in);
odr_destroy(c->odr_out);
+ if (c->odr_save)
+ odr_destroy(c->odr_save);
if (c->odr_print)
{
odr_setprint(c->odr_print, 0); /* prevent destroy from fclose'ing */
if (c->odr_print)
{
odr_setprint(c->odr_print, 0); /* prevent destroy from fclose'ing */
return zoom_complete;
if (c->odr_print)
z_GDU(c->odr_print, &gdu, 0, 0);
return zoom_complete;
if (c->odr_print)
z_GDU(c->odr_print, &gdu, 0, 0);
+ if (c->odr_save)
+ z_GDU(c->odr_save, &gdu, 0, 0);
c->buf_out = odr_getbuf(c->odr_out, &c->len_out, 0);
odr_reset(c->odr_out);
c->buf_out = odr_getbuf(c->odr_out, &c->len_out, 0);
odr_reset(c->odr_out);
{
if (c->odr_print)
z_GDU(c->odr_print, &gdu, 0, 0);
{
if (c->odr_print)
z_GDU(c->odr_print, &gdu, 0, 0);
+ if (c->odr_save)
+ z_GDU(c->odr_save, &gdu, 0, 0);
if (gdu->which == Z_GDU_Z3950)
ZOOM_handle_Z3950_apdu(c, gdu->u.z3950);
else if (gdu->which == Z_GDU_HTTP_Response)
if (gdu->which == Z_GDU_Z3950)
ZOOM_handle_Z3950_apdu(c, gdu->u.z3950);
else if (gdu->which == Z_GDU_HTTP_Response)
ODR odr_in;
ODR odr_out;
ODR odr_print;
ODR odr_in;
ODR odr_out;
ODR odr_print;
char *buf_in;
int len_in;
char *buf_out;
char *buf_in;
int len_in;
char *buf_out;
return zoom_complete;
if (c->odr_print)
z_GDU(c->odr_print, &gdu, 0, 0);
return zoom_complete;
if (c->odr_print)
z_GDU(c->odr_print, &gdu, 0, 0);
+ if (c->odr_save)
+ z_GDU(c->odr_save, &gdu, 0, 0);
c->buf_out = odr_getbuf(c->odr_out, &c->len_out, 0);
event = ZOOM_Event_create(ZOOM_EVENT_SEND_APDU);
c->buf_out = odr_getbuf(c->odr_out, &c->len_out, 0);
event = ZOOM_Event_create(ZOOM_EVENT_SEND_APDU);
}
if (c->odr_print)
z_APDU(c->odr_print, &a, 0, 0);
}
if (c->odr_print)
z_APDU(c->odr_print, &a, 0, 0);
+ if (c->odr_save)
+ z_APDU(c->odr_save, &a, 0, 0);
yaz_log(c->log_details, "%p encoding_APDU encoding OK", c);
return 0;
}
yaz_log(c->log_details, "%p encoding_APDU encoding OK", c);
return 0;
}