From: Adam Dickmeiss Date: Sun, 30 Dec 2001 22:21:11 +0000 (+0000) Subject: Scan for ZOOM. X-Git-Tag: YAZ.1.8.4~9 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=eab4041057c94f4fd3feffd76c1f987ca67da1c3;p=yaz-moved-to-github.git Scan for ZOOM. --- diff --git a/CHANGELOG b/CHANGELOG index 4279066..a06c51c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,14 @@ Possible compatibility problems with earlier versions marked with '*'. --- 1.8.4 2001/XX/XX +Scan for ZOOM API. New object ZOOM_scanset. New functions +ZOOM_connection_scan, ZOOM_scanset_size, ZOOM_scanset_term and +ZOOM_scanset_destroy. + +New ZOOM function, ZOOM_connection_last_event, that returns type +of last event (such as "receive data", "send data", "apdu received", +etc. + New ZOOM option, schema, that specifies shema OID for retrieval. New CCL feature. Qualifiers can be aliases for one or more diff --git a/include/yaz/zoom.h b/include/yaz/zoom.h index 61e7550..e321fd0 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -1,6 +1,6 @@ /* * Public header for ZOOM C. - * $Id: zoom.h,v 1.7 2001-11-18 21:14:23 adam Exp $ + * $Id: zoom.h,v 1.8 2001-12-30 22:21:11 adam Exp $ */ #include @@ -20,6 +20,7 @@ typedef struct ZOOM_connection_p *ZOOM_connection; typedef struct ZOOM_resultset_p *ZOOM_resultset; typedef struct ZOOM_task_p *ZOOM_task; typedef struct ZOOM_record_p *ZOOM_record; +typedef struct ZOOM_scanset_p *ZOOM_scanset; /* ----------------------------------------------------------- */ /* connections */ @@ -77,6 +78,18 @@ const char *ZOOM_connection_addinfo (ZOOM_connection c); #define ZOOM_ERROR_INTERNAL 10006 #define ZOOM_ERROR_TIMEOUT 10007 +ZOOM_EXPORT +int ZOOM_connection_last_event(ZOOM_connection cs); + +#define ZOOM_EVENT_NONE 0 +#define ZOOM_EVENT_CONNECT 1 +#define ZOOM_EVENT_SEND_DATA 2 +#define ZOOM_EVENT_RECV_DATA 3 +#define ZOOM_EVENT_TIMEOUT 4 +#define ZOOM_EVENT_UNKNOWN 5 +#define ZOOM_EVENT_SEND_APDU 6 +#define ZOOM_EVENT_RECV_APDU 7 + /* ----------------------------------------------------------- */ /* result sets */ @@ -104,7 +117,7 @@ size_t ZOOM_resultset_size (ZOOM_resultset r); /* retrieve records */ ZOOM_EXPORT void ZOOM_resultset_records (ZOOM_resultset r, ZOOM_record *recs, - size_t start, size_t count); + size_t start, size_t count); /* return record object at pos. Returns 0 if unavailable */ ZOOM_EXPORT @@ -130,7 +143,7 @@ ZOOM_EXPORT ZOOM_record ZOOM_record_clone (ZOOM_record srec); /* ----------------------------------------------------------- */ -/* searches */ +/* queries */ /* create search object */ ZOOM_EXPORT @@ -146,6 +159,19 @@ ZOOM_EXPORT int ZOOM_query_sortby(ZOOM_query s, const char *criteria); /* ----------------------------------------------------------- */ +/* scan */ +ZOOM_EXPORT +ZOOM_scanset ZOOM_connection_scan (ZOOM_connection c, const char *startterm); + +ZOOM_EXPORT +const char * ZOOM_scanset_term(ZOOM_scanset scan, size_t no, int *occ, size_t *len); + +ZOOM_EXPORT +size_t ZOOM_scanset_size(ZOOM_scanset scan); + +ZOOM_EXPORT +void ZOOM_scanset_destroy (ZOOM_scanset scan); +/* ----------------------------------------------------------- */ /* options */ typedef const char *(*ZOOM_options_callback)(void *handle, const char *name); @@ -182,8 +208,7 @@ void ZOOM_options_addref (ZOOM_options opt); /* poll for events on a number of connections. Returns positive integer if event occurred ; zero if none occurred and no more events are pending. The positive integer specifies the - connection for which the event occurred. There's no way to get - the details yet, sigh. */ + connection for which the event occurred. */ ZOOM_EXPORT int ZOOM_event (int no, ZOOM_connection *cs); diff --git a/win/makefile b/win/makefile index 851330f..cb376be 100644 --- a/win/makefile +++ b/win/makefile @@ -1,5 +1,5 @@ # makefile.mak - makefile for MS NMAKE -# $Id: makefile,v 1.30 2001-10-28 23:28:26 adam Exp $ +# $Id: makefile,v 1.31 2001-12-30 22:21:11 adam Exp $ # # Programmed by # HL: Heikki Levanto, Index Data @@ -84,14 +84,16 @@ ZOOMTST4=$(BINDIR)\zoomtst4.exe ZOOMTST5=$(BINDIR)\zoomtst5.exe ZOOMTST6=$(BINDIR)\zoomtst6.exe ZOOMTST7=$(BINDIR)\zoomtst7.exe - +ZOOMTST8=$(BINDIR)\zoomtst8.exe # shortcut names defined here dll : $(DLL) client: $(CLIENT) ztest: $(ZTEST) + zoomsh: $(ZOOMSH) $(ZOOMTST1) $(ZOOMTST2) $(ZOOMTST3) \ - $(ZOOMTST4) $(ZOOMTST5) $(ZOOMTST6) $(ZOOMTST7) + $(ZOOMTST4) $(ZOOMTST5) $(ZOOMTST6) $(ZOOMTST7) $(ZOOMTST8) + yaz_date_h: $(YAZ_DATE_H) ########################################################### @@ -216,6 +218,8 @@ YAZ_ZOOMTST6_OBJS = \ $(OBJDIR)\zoomtst6.obj YAZ_ZOOMTST7_OBJS = \ $(OBJDIR)\zoomtst7.obj +YAZ_ZOOMTST8_OBJS = \ + $(OBJDIR)\zoomtst8.obj YAZ_SERVER_OBJS= \ "$(OBJDIR)\eventl.obj" \ @@ -729,6 +733,19 @@ $(ZOOMTST7) : "$(BINDIR)" $(YAZ_ZOOMTST7_OBJS) /out:$(ZOOMTST7) << +$(ZOOMTST8) : "$(BINDIR)" $(YAZ_ZOOMTST8_OBJS) + @echo Linking $(ZOOMTST8) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMTST8_OBJS) + /pdb:"$(LIBDIR)\zoomtst8.pdb" + /map:"$(LIBDIR)\zoomtst8.map" + /out:$(ZOOMTST8) +<< + $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(DLL) @echo Linking the ztest $(ZTEST) $(LINK) @<< @@ -780,7 +797,7 @@ realclean: clean dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR) $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR): - if not exist "$@/$(NUL)" mkdir "$@" + if not exist "$@/$(NUL)" mkdir "$@" ########################################################### @@ -802,7 +819,10 @@ $(ILL_OBJS): $(ILL_CORE_FILES) $(ITEM_REQ_FILES) ########################################################### # # $Log: makefile,v $ -# Revision 1.30 2001-10-28 23:28:26 adam +# Revision 1.31 2001-12-30 22:21:11 adam +# Scan for ZOOM. +# +# Revision 1.30 2001/10/28 23:28:26 adam # Enable CCL-to-RPN for YAZ client on WIN32. # # Revision 1.29 2001/10/25 12:46:07 adam diff --git a/zoom/Makefile.am b/zoom/Makefile.am index db63437..da24039 100644 --- a/zoom/Makefile.am +++ b/zoom/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.1 2001-10-23 21:00:20 adam Exp $ +## $Id: Makefile.am,v 1.2 2001-12-30 22:21:11 adam Exp $ ## Copyright (C) 2001, Index Data INCLUDES = -I$(top_srcdir)/include @@ -15,8 +15,9 @@ zoomtst4_LDADD = $(zoomlibs) zoomtst5_LDADD = $(zoomlibs) zoomtst6_LDADD = $(zoomlibs) zoomtst7_LDADD = $(zoomlibs) +zoomtst8_LDADD = $(zoomlibs) -noinst_PROGRAMS = zoomtst1 zoomtst2 zoomtst3 zoomtst4 zoomtst5 zoomtst6 zoomtst7 +noinst_PROGRAMS = zoomtst1 zoomtst2 zoomtst3 zoomtst4 zoomtst5 zoomtst6 zoomtst7 zoomtst8 bin_PROGRAMS = zoomsh zoomtst1_SOURCES = zoomtst1.c @@ -26,4 +27,5 @@ zoomtst4_SOURCES = zoomtst4.c zoomtst5_SOURCES = zoomtst5.c zoomtst6_SOURCES = zoomtst6.c zoomtst7_SOURCES = zoomtst7.c +zoomtst8_SOURCES = zoomtst8.c zoomsh_SOURCES = zoomsh.c diff --git a/zoom/zoom-c.c b/zoom/zoom-c.c index 862811b..1da198d 100644 --- a/zoom/zoom-c.c +++ b/zoom/zoom-c.c @@ -1,5 +1,5 @@ /* - * $Id: zoom-c.c,v 1.14 2001-11-30 08:24:06 adam Exp $ + * $Id: zoom-c.c,v 1.15 2001-12-30 22:21:11 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -63,6 +63,7 @@ static ZOOM_Event ZOOM_connection_get_event(ZOOM_connection c) } else c->m_queue_back = 0; + c->last_event = event->kind; return event; } @@ -103,6 +104,9 @@ void ZOOM_connection_remove_task (ZOOM_connection c) break; case ZOOM_TASK_CONNECT: break; + case ZOOM_TASK_SCAN: + ZOOM_scanset_destroy (task->u.scan.scan); + break; default: assert (0); } @@ -149,6 +153,7 @@ ZOOM_connection ZOOM_connection_create (ZOOM_options options) c->async = 0; c->support_named_resultsets = 0; + c->last_event = ZOOM_EVENT_NONE; c->m_queue_front = 0; c->m_queue_back = 0; @@ -157,12 +162,13 @@ ZOOM_connection ZOOM_connection_create (ZOOM_options options) /* set database names. Take local databases (if set); otherwise take databases given in ZURL (if set); otherwise use Default */ -static char **set_DatabaseNames (ZOOM_connection con, int *num) +static char **set_DatabaseNames (ZOOM_connection con, ZOOM_options options, + int *num) { char **databaseNames; const char *c; int no = 2; - const char *cp = ZOOM_options_get (con->options, "databaseName"); + const char *cp = ZOOM_options_get (options, "databaseName"); if (!cp || !*cp) { @@ -551,15 +557,19 @@ static int encode_APDU(ZOOM_connection c, Z_APDU *a, ODR out) do_close (c); return -1; } + return 0; } static int send_APDU (ZOOM_connection c, Z_APDU *a) { + ZOOM_Event event; assert (a); if (encode_APDU(c, a, c->odr_out)) return -1; c->buf_out = odr_getbuf(c->odr_out, &c->len_out, 0); + event = ZOOM_Event_create (ZOOM_EVENT_SEND_APDU); + ZOOM_connection_put_event (c, event); odr_reset(c->odr_out); do_write (c); return 0; @@ -689,7 +699,7 @@ static int ZOOM_connection_send_search (ZOOM_connection c) search_req->query = r->r_query; search_req->databaseNames = - set_DatabaseNames (c, &search_req->num_databaseNames); + set_DatabaseNames (c, r->options, &search_req->num_databaseNames); /* get syntax (no need to provide unless piggyback is in effect) */ syntax = ZOOM_options_get (r->options, "preferredRecordSyntax"); @@ -1070,6 +1080,22 @@ static void sort_response (ZOOM_connection c, Z_SortResponse *res) response_diag (c, res->diagnostics[0]); } +static int scan_response (ZOOM_connection c, Z_ScanResponse *res) +{ + NMEM nmem = odr_extract_mem (c->odr_in); + ZOOM_scanset scan; + + if (!c->tasks || c->tasks->which != ZOOM_TASK_SCAN) + return 0; + scan = c->tasks->u.scan.scan; + + if (res->entries && res->entries->nonsurrogateDiagnostics) + response_diag(c, res->entries->nonsurrogateDiagnostics[0]); + scan->scan_response = res; + nmem_transfer (scan->odr->mem, nmem); + nmem_destroy (nmem); +} + static int send_sort (ZOOM_connection c) { ZOOM_resultset resultset; @@ -1219,6 +1245,110 @@ static int send_present (ZOOM_connection c) return 1; } +ZOOM_scanset ZOOM_connection_scan (ZOOM_connection c, const char *start) +{ + ZOOM_scanset scan = xmalloc (sizeof(*scan)); + + scan->connection = c; + scan->odr = odr_createmem (ODR_DECODE); + scan->options = ZOOM_options_create_with_parent (c->options); + scan->refcount = 1; + scan->scan_response = 0; + + if ((scan->termListAndStartPoint = + p_query_scan(scan->odr, PROTO_Z3950, &scan->attributeSet, + start))) + { + ZOOM_task task = ZOOM_connection_add_task (c, ZOOM_TASK_SCAN); + task->u.scan.scan = scan; + + (scan->refcount)++; + if (!c->async) + { + while (ZOOM_event (1, &c)) + ; + } + } + return scan; +} + +void ZOOM_scanset_destroy (ZOOM_scanset scan) +{ + if (!scan) + return; + (scan->refcount)--; + if (scan->refcount == 0) + { + odr_destroy (scan->odr); + + ZOOM_options_destroy (scan->options); + xfree (scan); + } +} + +int send_scan (ZOOM_connection c) +{ + ZOOM_scanset scan; + Z_APDU *apdu = zget_APDU(c->odr_out, Z_APDU_scanRequest); + Z_ScanRequest *req = apdu->u.scanRequest; + if (!c->tasks) + return 0; + assert (c->tasks->which == ZOOM_TASK_SCAN); + scan = c->tasks->u.scan.scan; + + req->termListAndStartPoint = scan->termListAndStartPoint; + req->attributeSet = scan->attributeSet; + + *req->numberOfTermsRequested = + ZOOM_options_get_int(scan->options, "number", 10); + + req->preferredPositionInResponse = + odr_intdup (c->odr_out, + ZOOM_options_get_int(scan->options, "position", 1)); + + req->stepSize = + odr_intdup (c->odr_out, + ZOOM_options_get_int(scan->options, "stepSize", 0)); + + req->databaseNames = set_DatabaseNames (c, scan->options, + &req->num_databaseNames); + + send_APDU (c, apdu); + + return 1; +} + +size_t ZOOM_scanset_size (ZOOM_scanset scan) +{ + if (!scan || !scan->scan_response || !scan->scan_response->entries) + return 0; + return scan->scan_response->entries->num_entries; +} + +const char *ZOOM_scanset_term (ZOOM_scanset scan, size_t i, int *occ, size_t *len) +{ + const char *term = 0; + size_t noent = ZOOM_scanset_size (scan); + Z_ScanResponse *res = scan->scan_response; + + *len = 0; + *occ = 0; + if (i >= noent) + return 0; + if (res->entries->entries[i]->which == Z_Entry_termInfo) + { + Z_TermInfo *t = res->entries->entries[i]->u.termInfo; + + if (t->term->which == Z_Term_general) + { + term = t->term->u.general->buf; + *len = t->term->u.general->len; + } + *occ = t->globalOccurrences ? *t->globalOccurrences : 0; + } + return term; +} + static int ZOOM_connection_exec_task (ZOOM_connection c) { ZOOM_task task = c->tasks; @@ -1250,6 +1380,10 @@ static int ZOOM_connection_exec_task (ZOOM_connection c) case ZOOM_TASK_CONNECT: if (do_connect(c)) return 1; + break; + case ZOOM_TASK_SCAN: + if (send_scan(c)) + return 1; } ZOOM_connection_remove_task (c); return 0; @@ -1286,7 +1420,8 @@ static void handle_apdu (ZOOM_connection c, Z_APDU *apdu) c->cookie_in = 0; if (cookie) c->cookie_in = xstrdup(cookie); - if (ODR_MASK_GET(initrs->options, Z_Options_namedResultSets)) + if (ODR_MASK_GET(initrs->options, Z_Options_namedResultSets) && + ODR_MASK_GET(initrs->protocolVersion, Z_ProtocolVersion_3)) c->support_named_resultsets = 1; if (c->tasks) { @@ -1310,6 +1445,10 @@ static void handle_apdu (ZOOM_connection c, Z_APDU *apdu) sort_response (c, apdu->u.sortResponse); if (!send_present (c)) ZOOM_connection_remove_task (c); + break; + case Z_APDU_scanResponse: + scan_response (c, apdu->u.scanResponse); + ZOOM_connection_remove_task (c); } } @@ -1317,6 +1456,10 @@ static int do_read (ZOOM_connection c) { int r; Z_APDU *apdu; + ZOOM_Event event; + + event = ZOOM_Event_create (ZOOM_EVENT_RECV_DATA); + ZOOM_connection_put_event (c, event); r = cs_get (c->cs, &c->buf_in, &c->len_in); if (r == 1) @@ -1328,8 +1471,11 @@ static int do_read (ZOOM_connection c) } else { + ZOOM_Event event; odr_reset (c->odr_in); odr_setbuf (c->odr_in, c->buf_in, r, 0); + event = ZOOM_Event_create (ZOOM_EVENT_RECV_APDU); + ZOOM_connection_put_event (c, event); if (!z_APDU (c->odr_in, &apdu, 0, 0)) { c->error = ZOOM_ERROR_DECODE; @@ -1346,7 +1492,11 @@ static int do_read (ZOOM_connection c) static int do_write_ex (ZOOM_connection c, char *buf_out, int len_out) { int r; + ZOOM_Event event; + event = ZOOM_Event_create(ZOOM_EVENT_SEND_DATA); + ZOOM_connection_put_event (c, event); + if ((r=cs_put (c->cs, buf_out, len_out)) < 0) { if (c->state == STATE_CONNECTING) @@ -1459,7 +1609,7 @@ int ZOOM_connection_error (ZOOM_connection c, const char **cp, int ZOOM_connection_do_io(ZOOM_connection c, int mask) { - ZOOM_Event event; + ZOOM_Event event = 0; #if 0 int r = cs_look(c->cs); yaz_log (LOG_LOG, "ZOOM_connection_do_io c=%p mask=%d cs_look=%d", @@ -1467,19 +1617,26 @@ int ZOOM_connection_do_io(ZOOM_connection c, int mask) if (r == CS_NONE) { + event = ZOOM_Event_create (ZOOM_EVENT_IO_CONNECT); c->error = ZOOM_ERROR_CONNECT; do_close (c); + ZOOM_connection_put_event (c, event); } else if (r == CS_CONNECT) { + event = ZOOM_Event_create (ZOOM_EVENT_IO_CONNECT); yaz_log (LOG_LOG, "calling rcvconnect"); if (cs_rcvconnect (c->cs) < 0) { c->error = ZOOM_ERROR_CONNECT; do_close (c); + ZOOM_connection_put_event (c, event); } else + { + ZOOM_connection_put_event (c, event); ZOOM_connection_send_init (c); + } } else { @@ -1492,12 +1649,17 @@ int ZOOM_connection_do_io(ZOOM_connection c, int mask) yaz_log (LOG_DEBUG, "ZOOM_connection_do_io c=%p mask=%d", c, mask); if (c->state == STATE_CONNECTING) { + event = ZOOM_Event_create (ZOOM_EVENT_CONNECT); if (mask & ZOOM_SELECT_WRITE) + { + ZOOM_connection_put_event (c, event); ZOOM_connection_send_init (c); + } else { c->error = ZOOM_ERROR_CONNECT; do_close (c); + ZOOM_connection_put_event (c, event); } } else if (c->state == STATE_ESTABLISHED) @@ -1509,15 +1671,21 @@ int ZOOM_connection_do_io(ZOOM_connection c, int mask) } else { + event = ZOOM_Event_create (ZOOM_EVENT_UNKNOWN); + ZOOM_connection_put_event (c, event); c->error = ZOOM_ERROR_INTERNAL; do_close (c); } #endif - event = ZOOM_Event_create (1); - ZOOM_connection_put_event (c, event); return 1; } +int ZOOM_connection_last_event(ZOOM_connection cs) +{ + if (!cs) + return ZOOM_EVENT_NONE; + return cs->last_event; +} int ZOOM_event (int no, ZOOM_connection *cs) { @@ -1544,8 +1712,15 @@ int ZOOM_event (int no, ZOOM_connection *cs) for (i = 0; imask) { - ZOOM_Event event = ZOOM_Event_create(0); + ZOOM_Event event = ZOOM_Event_create(ZOOM_EVENT_TIMEOUT); /* timeout and this connection was waiting */ c->error = ZOOM_ERROR_TIMEOUT; do_close (c); @@ -1665,7 +1840,7 @@ int ZOOM_event (int no, ZOOM_connection *cs) } if (r == 0 && c->mask) { - ZOOM_Event event = ZOOM_Event_create(0); + ZOOM_Event event = ZOOM_Event_create(ZOOM_EVENT_IO_TIMEOUT); /* timeout and this connection was waiting */ c->error = ZOOM_ERROR_TIMEOUT; do_close (c); diff --git a/zoom/zoom-p.h b/zoom/zoom-p.h index b3125a0..87f517e 100644 --- a/zoom/zoom-p.h +++ b/zoom/zoom-p.h @@ -1,11 +1,12 @@ /* * Private C header for ZOOM C. - * $Id: zoom-p.h,v 1.7 2001-11-28 23:00:19 adam Exp $ + * $Id: zoom-p.h,v 1.8 2001-12-30 22:21:11 adam Exp $ */ #include #include #include #include +#include typedef struct ZOOM_Event_p *ZOOM_Event; @@ -42,6 +43,7 @@ struct ZOOM_connection_p { char *cookie_in; int async; int support_named_resultsets; + int last_event; ZOOM_task tasks; ZOOM_options options; ZOOM_resultset resultsets; @@ -96,6 +98,16 @@ struct ZOOM_record_cache_p { ZOOM_record_cache next; }; +struct ZOOM_scanset_p { + int refcount; + ODR odr; + ZOOM_options options; + ZOOM_connection connection; + Z_AttributesPlusTerm *termListAndStartPoint; + Z_AttributeSetId *attributeSet; + Z_ScanResponse *scan_response; +}; + struct ZOOM_task_p { int running; int which; @@ -111,6 +123,10 @@ struct ZOOM_task_p { int count; } retrieve; #define ZOOM_TASK_CONNECT 3 +#define ZOOM_TASK_SCAN 4 + struct { + ZOOM_scanset scan; + } scan; } u; ZOOM_task next; }; @@ -122,10 +138,3 @@ struct ZOOM_Event_p { }; -#ifndef YAZ_DATE -COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp); -Odr_oid *yaz_str_to_z3950oid (ODR o, int oid_class, const char *str); -Z_SortKeySpecList *yaz_sort_spec (ODR out, const char *arg); -#else -#include -#endif diff --git a/zoom/zoomtst3.c b/zoom/zoomtst3.c index f7fbbca..cf55f4b 100644 --- a/zoom/zoomtst3.c +++ b/zoom/zoomtst3.c @@ -1,5 +1,5 @@ /* - * $Id: zoomtst3.c,v 1.4 2001-11-18 21:14:23 adam Exp $ + * $Id: zoomtst3.c,v 1.5 2001-12-30 22:21:11 adam Exp $ * * Asynchronous multi-target client doing search and piggyback retrieval */ @@ -53,8 +53,11 @@ int main(int argc, char **argv) r[i] = ZOOM_connection_search_pqf (z[i], argv[argc-1]); /* network I/O. pass number of connections and array of connections */ - while (ZOOM_event (no, z)) - ; + while ((i = ZOOM_event (no, z))) + { + printf ("no = %d event = %d\n", i-1, + ZOOM_connection_last_event(z[i-1])); + } /* no more to be done. Inspect results */ for (i = 0; i 0) + while (ZOOM_event (1, &z)) + ; + printf (" scan size = %d\n", ZOOM_scanset_size(scan)); + for (j = 0; j +#include + +#include +#include +#include + +int main(int argc, char **argv) +{ + int i; + int no = argc-2; + ZOOM_connection z[500]; /* allow at most 500 connections */ + ZOOM_scanset s[500]; /* and scan sets .. */ + ZOOM_options o = ZOOM_options_create (); + + if (argc < 3) + { + fprintf (stderr, "usage:\n%s target1 target2 ... targetN scan\n", + *argv); + exit (1); + } + if (no > 500) + no = 500; + + /* async mode */ + ZOOM_options_set (o, "async", "1"); + + /* connect to all */ + for (i = 0; i