logrpn.c \
otherinfo.c pquery.c sortspec.c charneg.c initopt.c \
zoom-c.c zoom-z3950.c zoom-sru.c zoom-query.c zoom-record-cache.c \
+ zoom-event.c \
record_render.c zoom-socket.c zoom-opt.c zoom-p.h \
grs1disp.c zgdu.c soap.c srw.c srwutil.c uri.c \
opacdisp.c cclfind.c ccltoken.c cclerrms.c cclqual.c cclptree.c cclp.h \
static void resultset_destroy(ZOOM_resultset r);
static zoom_ret do_write_ex(ZOOM_connection c, char *buf_out, int len_out);
-ZOOM_API(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];
-}
-
static void initlog(void)
{
static int log_level_initialized = 0;
}
}
-ZOOM_Event ZOOM_Event_create(int kind)
-{
- ZOOM_Event event = (ZOOM_Event) xmalloc(sizeof(*event));
- event->kind = kind;
- event->next = 0;
- event->prev = 0;
- return event;
-}
-
-static void ZOOM_Event_destroy(ZOOM_Event event)
-{
- xfree(event);
-}
-
-void ZOOM_connection_put_event(ZOOM_connection c, ZOOM_Event event)
-{
- if (c->m_queue_back)
- {
- c->m_queue_back->prev = event;
- assert(c->m_queue_front);
- }
- else
- {
- assert(!c->m_queue_front);
- c->m_queue_front = event;
- }
- event->next = c->m_queue_back;
- event->prev = 0;
- c->m_queue_back = event;
-}
-
-static ZOOM_Event ZOOM_connection_get_event(ZOOM_connection c)
-{
- ZOOM_Event event = c->m_queue_front;
- if (!event)
- {
- c->last_event = ZOOM_EVENT_NONE;
- return 0;
- }
- assert(c->m_queue_back);
- c->m_queue_front = event->prev;
- if (c->m_queue_front)
- {
- assert(c->m_queue_back);
- c->m_queue_front->next = 0;
- }
- else
- c->m_queue_back = 0;
- c->last_event = event->kind;
- return event;
-}
-
-static void ZOOM_connection_remove_events(ZOOM_connection c)
-{
- ZOOM_Event event;
- while ((event = ZOOM_connection_get_event(c)))
- ZOOM_Event_destroy(event);
-}
-
-ZOOM_API(int) ZOOM_connection_peek_event(ZOOM_connection c)
-{
- ZOOM_Event event = c->m_queue_front;
-
- return event ? event->kind : ZOOM_EVENT_NONE;
-}
-
void ZOOM_connection_remove_tasks(ZOOM_connection c);
void ZOOM_set_dset_error(ZOOM_connection c, int error,
--- /dev/null
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2010 Index Data
+ * See the file LICENSE for details.
+ */
+/**
+ * \file zoom-event.c
+ * \brief Implements ZOOM Event stuff
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+#include "zoom-p.h"
+
+ZOOM_API(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];
+}
+
+struct ZOOM_Event_p {
+ int kind;
+ ZOOM_Event next;
+ ZOOM_Event prev;
+};
+
+ZOOM_Event ZOOM_Event_create(int kind)
+{
+ ZOOM_Event event = (ZOOM_Event) xmalloc(sizeof(*event));
+ event->kind = kind;
+ event->next = 0;
+ event->prev = 0;
+ return event;
+}
+
+
+ZOOM_Event ZOOM_connection_get_event(ZOOM_connection c)
+{
+ ZOOM_Event event = c->m_queue_front;
+ if (!event)
+ {
+ c->last_event = ZOOM_EVENT_NONE;
+ return 0;
+ }
+ assert(c->m_queue_back);
+ c->m_queue_front = event->prev;
+ if (c->m_queue_front)
+ {
+ assert(c->m_queue_back);
+ c->m_queue_front->next = 0;
+ }
+ else
+ c->m_queue_back = 0;
+ c->last_event = event->kind;
+ return event;
+}
+
+void ZOOM_connection_put_event(ZOOM_connection c, ZOOM_Event event)
+{
+ if (c->m_queue_back)
+ {
+ c->m_queue_back->prev = event;
+ assert(c->m_queue_front);
+ }
+ else
+ {
+ assert(!c->m_queue_front);
+ c->m_queue_front = event;
+ }
+ event->next = c->m_queue_back;
+ event->prev = 0;
+ c->m_queue_back = event;
+}
+
+void ZOOM_Event_destroy(ZOOM_Event event)
+{
+ xfree(event);
+}
+
+void ZOOM_connection_remove_events(ZOOM_connection c)
+{
+ ZOOM_Event event;
+ while ((event = ZOOM_connection_get_event(c)))
+ ZOOM_Event_destroy(event);
+}
+
+ZOOM_API(int) ZOOM_connection_peek_event(ZOOM_connection c)
+{
+ ZOOM_Event event = c->m_queue_front;
+
+ return event ? event->kind : ZOOM_EVENT_NONE;
+}
+
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
#include <yaz/xmalloc.h>
+struct ZOOM_options_entry {
+ char *name;
+ char *value;
+ int len; /* of `value', which may contain NULs */
+ struct ZOOM_options_entry *next;
+};
+
+struct ZOOM_options_p {
+ int refcount;
+ void *callback_handle;
+ ZOOM_options_callback callback_func;
+ struct ZOOM_options_entry *entries;
+ ZOOM_options parent1;
+ ZOOM_options parent2;
+};
+
static void set_value(struct ZOOM_options_entry **e,
const char *value, int len)
{
};
#endif
-struct ZOOM_options_entry {
- char *name;
- char *value;
- int len; /* of `value', which may contain NULs */
- struct ZOOM_options_entry *next;
-};
-
-struct ZOOM_options_p {
- int refcount;
- void *callback_handle;
- ZOOM_options_callback callback_func;
- struct ZOOM_options_entry *entries;
- ZOOM_options parent1;
- ZOOM_options parent2;
-};
-
-
typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
#define RECORD_HASH_SIZE 131
ZOOM_task next;
};
-struct ZOOM_Event_p {
- int kind;
- ZOOM_Event next;
- ZOOM_Event prev;
-};
-
typedef enum {
zoom_pending,
zoom_complete
void ZOOM_set_HTTP_error(ZOOM_connection c, int error,
const char *addinfo, const char *addinfo2);
+ZOOM_Event ZOOM_connection_get_event(ZOOM_connection c);
+void ZOOM_connection_remove_events(ZOOM_connection c);
+void ZOOM_Event_destroy(ZOOM_Event event);
+
/*
* Local variables:
* c-basic-offset: 4
$(OBJDIR)\srw.obj \
$(OBJDIR)\srwutil.obj \
$(OBJDIR)\zoom-c.obj \
+ $(OBJDIR)\zoom-event.obj \
$(OBJDIR)\zoom-record-cache.obj \
$(OBJDIR)\zoom-z3950.obj \
$(OBJDIR)\zoom-sru.obj \