Added ZOOM_get_event_str.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 20 Oct 2008 06:38:56 +0000 (08:38 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 20 Oct 2008 06:38:56 +0000 (08:38 +0200)
include/yaz/zoom.h
src/zoom-c.c

index f14942d..1a07437 100644 (file)
@@ -486,7 +486,9 @@ ZOOM_API(int)
 ZOOM_API(int)
     ZOOM_connection_peek_event(ZOOM_connection c);
 
 ZOOM_API(int)
     ZOOM_connection_peek_event(ZOOM_connection c);
 
-ZOOM_END_CDECL
+ZOOM_API(const char *)
+    ZOOM_get_event_str(int event);
+
 /*
  * Local variables:
  * c-basic-offset: 4
 /*
  * Local variables:
  * c-basic-offset: 4
index 2c12c6a..f61eab8 100644 (file)
@@ -41,6 +41,23 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c);
 static zoom_ret do_write_ex(ZOOM_connection c, char *buf_out, int len_out);
 static char *cql2pqf(ZOOM_connection c, const char *cql);
 
 static zoom_ret do_write_ex(ZOOM_connection c, char *buf_out, int len_out);
 static char *cql2pqf(ZOOM_connection c, const char *cql);
 
+const char *ZOOM_get_event_str(int event)
+{
+    static const char *ar[] = {
+        "NONE",
+        "CONNECT",
+        "SEND_DATA",
+        "RECV_DATA",
+        "TIMEOUT",
+        "UNKNOWN",
+        "SEND_APDU",
+        "RECV_APDU",
+        "RECV_RECORD",
+        "RECV_SEARCH",
+        "END"
+    };
+    return ar[event];
+}
 
 /*
  * This wrapper is just for logging failed lookups.  It would be nicer
 
 /*
  * This wrapper is just for logging failed lookups.  It would be nicer