+static int send_gdu(Z_GDU *gdu)
+{
+ if (z_GDU(out, &gdu, 0, 0))
+ {
+ /* encode OK */
+ char *buf_out;
+ int len_out;
+ int r;
+ if (apdu_file)
+ {
+ if (!z_GDU(print, &gdu, 0, 0))
+ printf("Failed to print outgoing SRU package\n");
+ odr_reset(print);
+ }
+ buf_out = odr_getbuf(out, &len_out, 0);
+
+ /* 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);
+
+ if (r >= 0)
+ return 2;
+ }
+ return 0;
+}
+
+static int send_srw_host_path(Z_SRW_PDU *sr, const char *host_port,
+ char *path)