Merge branch 'sru_2_0' of ssh://git.indexdata.com/home/git/pub/yaz into sru_2_0
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 1 Oct 2013 13:19:59 +0000 (15:19 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 1 Oct 2013 13:19:59 +0000 (15:19 +0200)
12 files changed:
NEWS
include/yaz/backend.h
include/yaz/comstack.h
include/yaz/icu.h
include/yaz/icu_I18N.h
include/yaz/oid_util.h
src/Makefile.am
src/statserv.c
src/tcpip.c
src/unix.c
src/waislen.c [deleted file]
win/makefile

diff --git a/NEWS b/NEWS
index a3417af..18e35e0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
+Increase various buffers in GFS's statserv_options_block
 Change many 'unsigned char *' to 'char *' for ODR-related utilties.
 This change makes many type-casts redundant, and, thus simplifies code.
 
+Remove last bits of WAIS support.
+
 Remove member 'size' from Odr_oct.
 
 Slim down the public part of 'struct odr'. Most elements are not part
index 8ae3f3f..67f9360 100644 (file)
@@ -324,25 +324,26 @@ typedef struct bend_initresult
     void *handle;              /* private handle to the backend module */
 } bend_initresult;
 
+#define BEND_NAME_MAX 1024
+
 /** \brief control block for server */
 typedef struct statserv_options_block
 {
     int dynamic;                  /**< fork on incoming requests */
     int threads;                  /**< use threads */
     int one_shot;                 /**< one session then exit(1) */
-    char apdufile[ODR_MAXNAME+1]; /**< file for pretty-printed PDUs */
-    char logfile[ODR_MAXNAME+1];  /**< file for diagnostic output */
-    char default_listen[1024];    /**< 0 == no default listen */
+    char apdufile[BEND_NAME_MAX]; /**< file for pretty-printed PDUs */
+    char logfile[BEND_NAME_MAX];  /**< file for diagnostic output */
     enum oid_proto default_proto; /**< PROTO_SR or PROTO_Z3950 */
     int idle_timeout;             /**< how many minutes to wait before closing */
     int maxrecordsize;            /**< maximum value for negotiation */
-    char configname[ODR_MAXNAME+1]; /**< given to the backend in bend_init */
-    char setuid[ODR_MAXNAME+1];     /**< setuid to this user after binding */
+    char configname[BEND_NAME_MAX]; /**< given to the backend in bend_init */
+    char setuid[BEND_NAME_MAX];   /**< setuid to this user after binding */
     void (*bend_start)(struct statserv_options_block *p);
     void (*bend_stop)(struct statserv_options_block *p);
     int (*options_func)(int argc, char **argv);
     int (*check_ip)(void *cd, const char *addr, int len, int type);
-    char daemon_name[128];
+    char daemon_name[BEND_NAME_MAX];
     int inetd;                    /**< Do we use the inet deamon or not */
 
     void *handle;                 /**< Handle */
@@ -351,17 +352,16 @@ typedef struct statserv_options_block
 #ifdef WIN32
     /* We only have these members for the windows version */
     /* They seemed a bit large to have them there in general */
-    char service_name[128];         /**< NT Service Name */
-    char app_name[128];             /**< Application Name */
-    char service_dependencies[128]; /**< The services we are dependent on */
-    char service_display_name[128]; /**< The service display name */
+    char service_name[BEND_NAME_MAX];/**< NT Service Name */
+    char app_name[BEND_NAME_MAX];  /**< Application Name */
+    char service_dependencies[BEND_NAME_MAX];
+    char service_display_name[BEND_NAME_MAX];
 #endif /* WIN32 */
-    struct bend_soap_handler *soap_handlers;
-    char pid_fname[128];            /**< pid fname */
-    int background;                 /**< auto daemon */
-    char cert_fname[128];           /**< SSL certificate fname */
-    char xml_config[128];           /**< XML config filename */
-    int keepalive;                  /**< keep alive if HTTP 1.1 (default: 1) */
+    char pid_fname[BEND_NAME_MAX]; /**< pid fname */
+    int background;                /**< auto daemon */
+    char cert_fname[BEND_NAME_MAX];/**< SSL certificate fname */
+    char xml_config[BEND_NAME_MAX];/**< XML config filename */
+    int keepalive;                 /**< keep alive if HTTP 1.1 (default: 1) */
 } statserv_options_block;
 
 YAZ_EXPORT int statserv_main(
index 9c74e71..8b6cc9f 100644 (file)
@@ -39,8 +39,6 @@
 
 YAZ_BEGIN_CDECL
 
-#define COMSTACK_DEFAULT_TIMEOUT -1  /* not used yet */
-
 struct comstack;
 typedef struct comstack *COMSTACK;
 typedef COMSTACK (*CS_TYPE)(int s, int flags, int protocol, void *vp);
@@ -50,7 +48,6 @@ struct comstack
     CS_TYPE type;
     int cerrno;     /* current error code of this stack */
     int iofile;    /* UNIX file descriptor for iochannel */
-    int timeout;   /* how long to wait for trailing blocks (ignored for now) */
     void *cprivate;/* state info for lower stack */
     int max_recv_bytes;      /* max size of incoming package */
     int state;     /* current state */
@@ -134,8 +131,6 @@ YAZ_EXPORT int cs_set_ssl_ctx(COMSTACK cs, void *ctx);
 YAZ_EXPORT int cs_set_ssl_certificate_file(COMSTACK cs, const char *fname);
 YAZ_EXPORT int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len);
 YAZ_EXPORT void cs_set_max_recv_bytes(COMSTACK cs, int max_recv_bytes);
-YAZ_EXPORT int completeWAIS(const char *buf, int len);
-
 YAZ_EXPORT void cs_print_session_info(COMSTACK cs);
 
 /*
@@ -152,10 +147,6 @@ YAZ_EXPORT void cs_print_session_info(COMSTACK cs);
 #define CSBUFSIZE  7
 #define CSLASTERROR CSBUFSIZE  /* must be the value of last CS error */
 
-/* backwards compatibility */
-#define CS_SR     PROTO_SR
-#define CS_Z3950  PROTO_Z3950
-
 #define CS_FLAGS_BLOCKING 1
 #define CS_FLAGS_NUMERICHOST 2
 
index 007e29b..973cc5d 100644 (file)
@@ -55,7 +55,7 @@ YAZ_EXPORT void icu_chain_destroy(yaz_icu_chain_t chain);
 */
 YAZ_EXPORT yaz_icu_chain_t icu_chain_xml_config(const xmlNode *xml_node,
                                                 int sort,
-                                                UErrorCode * status);
+                                                UErrorCode *status);
 /** \brief pass string to ICU for parsing/tokenization/etc
     \param chain ICU chain to be used for parsing
     \param src8cstr input C string (null-terminated)
@@ -64,7 +64,7 @@ YAZ_EXPORT yaz_icu_chain_t icu_chain_xml_config(const xmlNode *xml_node,
     \retval 1 success
 */
 YAZ_EXPORT int icu_chain_assign_cstr(yaz_icu_chain_t chain,
-                                     const char * src8cstr,
+                                     const char *src8cstr,
                                      UErrorCode *status);
 
 /** \brief returns one token (if any)
index d61c007..16d8aaa 100644 (file)
@@ -47,7 +47,7 @@
 
 /* declared structs and functions */
 
-int icu_check_status (UErrorCode status);
+int icu_check_status(UErrorCode status);
 
 struct icu_buf_utf16
 {
@@ -105,40 +105,40 @@ UErrorCode icu_utf16_to_utf8(struct icu_buf_utf8 *dest8,
 
 struct icu_casemap;
 
-struct icu_casemap * icu_casemap_create(char action, UErrorCode *status);
+struct icu_casemap *icu_casemap_create(char action, UErrorCode *status);
 
 struct icu_casemap *icu_casemap_clone(struct icu_casemap *old);
 
-void icu_casemap_destroy(struct icu_casemap * casemap);
+void icu_casemap_destroy(struct icu_casemap *casemap);
 
-int icu_casemap_casemap(struct icu_casemap * casemap,
-                        struct icu_buf_utf16 * dest16,
-                        struct icu_buf_utf16 * src16,
+int icu_casemap_casemap(struct icu_casemap *casemap,
+                        struct icu_buf_utf16 *dest16,
+                        struct icu_buf_utf16 *src16,
                         UErrorCode *status,
                         const char *locale);
 
-int icu_utf16_casemap(struct icu_buf_utf16 * dest16,
-                      struct icu_buf_utf16 * src16,
+int icu_utf16_casemap(struct icu_buf_utf16 *dest16,
+                      struct icu_buf_utf16 *src16,
                       const char *locale, char action,
                       UErrorCode *status);
 
 void icu_sortkey8_from_utf16(UCollator *coll,
-                             struct icu_buf_utf8 * dest8,
-                             struct icu_buf_utf16 * src16,
-                             UErrorCode * status);
+                             struct icu_buf_utf8 *dest8,
+                             struct icu_buf_utf16 *src16,
+                             UErrorCode *status);
 
 struct icu_tokenizer;
 struct icu_tokenizer * icu_tokenizer_create(const char *locale, char action,
                                             UErrorCode *status);
 
 struct icu_tokenizer *icu_tokenizer_clone(struct icu_tokenizer *old);
-void icu_tokenizer_destroy(struct icu_tokenizer * tokenizer);
+void icu_tokenizer_destroy(struct icu_tokenizer *tokenizer);
 
-int icu_tokenizer_attach(struct icu_tokenizer * tokenizer,
-                         struct icu_buf_utf16 * src16, UErrorCode *status);
+int icu_tokenizer_attach(struct icu_tokenizer *tokenizer,
+                         struct icu_buf_utf16 *src16, UErrorCode *status);
 
-int32_t icu_tokenizer_next_token(struct icu_tokenizer * tokenizer,
-                                 struct icu_buf_utf16 * tkn16,
+int32_t icu_tokenizer_next_token(struct icu_tokenizer *tokenizer,
+                                 struct icu_buf_utf16 *tkn16,
                                  UErrorCode *status,
                                  size_t *start, size_t *len);
 
@@ -152,18 +152,17 @@ struct icu_transform * icu_transform_create(const char *id, char action,
 struct icu_transform *icu_transform_clone(struct icu_transform *old);
 void icu_transform_destroy(struct icu_transform * transform);
 
-int icu_transform_trans(struct icu_transform * transform,
-                        struct icu_buf_utf16 * dest16,
-                        const struct icu_buf_utf16 * src16,
+int icu_transform_trans(struct icu_transform *transform,
+                        struct icu_buf_utf16 *dest16,
+                        const struct icu_buf_utf16 *src16,
                         UErrorCode *status);
 
 struct icu_chain_step;
 
 int icu_chain_token_number(yaz_icu_chain_t chain);
 
-yaz_icu_chain_t icu_chain_create(const char * locale,
-                                 int sort,
-                                 UErrorCode * status);
+yaz_icu_chain_t icu_chain_create(const char *locale,
+                                 int sort, UErrorCode *status);
 
 #endif /* ICU_I18NL_H */
 
index e535770..fc141d3 100644 (file)
@@ -45,9 +45,6 @@ typedef enum oid_proto
 {
     PROTO_NOP=0,
     PROTO_Z3950,
-    PROTO_SR,
-    PROTO_GENERAL,
-    PROTO_WAIS,
     PROTO_HTTP
 } oid_proto;
 
index 2564e03..65bf742 100644 (file)
@@ -82,7 +82,7 @@ libyaz_la_SOURCES=base64.c version.c options.c log.c \
   odr_seq.c odr_oct.c ber_oct.c odr_bit.c ber_bit.c odr_oid.c \
   ber_oid.c odr_use.c odr_choice.c odr_any.c ber_any.c odr.c odr_mem.c \
   dumpber.c odr_enum.c odr-priv.h \
-  comstack.c tcpip.c waislen.c unix.c \
+  comstack.c tcpip.c unix.c \
   prt-ext.c \
   ill-get.c \
   zget.c yaz-ccl.c diag-entry.c diag-entry.h \
index f84c345..8dbcefb 100644 (file)
@@ -96,7 +96,6 @@ statserv_options_block control_block = {
     0,                          /* one shot (single session) */
     "",                         /* no PDUs */
     "",                         /* diagnostic output to stderr */
-    "tcp:@:9999",               /* default listener port */
     PROTO_Z3950,                /* default application protocol */
     900,                        /* idle timeout (seconds) */
     64*1024*1024,               /* maximum PDU size (approx.) to allow */
@@ -117,7 +116,6 @@ statserv_options_block control_block = {
     "",                         /* NT Service Dependencies */
     "Z39.50 Server",            /* NT Service Display Name */
 #endif /* WIN32 */
-    0,                          /* SOAP handlers */
     "",                         /* PID fname */
     0,                          /* background daemon */
     "",                         /* SSL certificate filename */
@@ -1253,8 +1251,8 @@ static int statserv_sc_main(yaz_sc_t s, int argc, char **argv)
     {
         xml_config_add_listeners();
 
-        if (!pListener && *control_block.default_listen)
-            add_listener(control_block.default_listen, 0);
+        if (!pListener)
+            add_listener("tcp:@:9999", 0);
 
 #ifndef WIN32
         if (control_block.dynamic)
@@ -1279,8 +1277,8 @@ static int statserv_sc_main(yaz_sc_t s, int argc, char **argv)
 
 static void option_copy(char *dst, const char *src)
 {
-    strncpy(dst, src ? src : "", 127);
-    dst[127] = '\0';
+    strncpy(dst, src ? src : "", BEND_NAME_MAX-1);
+    dst[BEND_NAME_MAX-1] = '\0';
 }
 
 int check_options(int argc, char **argv)
index e712c0e..5ed4c9b 100644 (file)
@@ -227,17 +227,13 @@ COMSTACK tcpip_type(int s, int flags, int protocol, void *vp)
     sp->altbuf = 0;
     sp->altsize = sp->altlen = 0;
     sp->towrite = sp->written = -1;
-    if (protocol == PROTO_WAIS)
-        sp->complete = completeWAIS;
-    else
-        sp->complete = cs_complete_auto;
+    sp->complete = cs_complete_auto;
 
     sp->connect_request_buf = 0;
     sp->connect_request_len = 0;
     sp->connect_response_buf = 0;
     sp->connect_response_len = 0;
 
-    p->timeout = COMSTACK_DEFAULT_TIMEOUT;
     TRC(fprintf(stderr, "Created new TCPIP comstack h=%p\n", p));
 
     return p;
index 7fe4b77..d9061f9 100644 (file)
@@ -165,12 +165,8 @@ COMSTACK unix_type(int s, int flags, int protocol, void *vp)
     state->altbuf = 0;
     state->altsize = state->altlen = 0;
     state->towrite = state->written = -1;
-    if (protocol == PROTO_WAIS)
-        state->complete = completeWAIS;
-    else
-        state->complete = cs_complete_auto;
+    state->complete = cs_complete_auto;
 
-    p->timeout = COMSTACK_DEFAULT_TIMEOUT;
     TRC(fprintf(stderr, "Created new UNIX comstack\n"));
 
     return p;
diff --git a/src/waislen.c b/src/waislen.c
deleted file mode 100644 (file)
index 7f7daf7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
- * See the file LICENSE for details.
- */
-/**
- * \file waislen.c
- * \brief Implements WAIS package handling
- */
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <yaz/comstack.h>
-/*
- * Return length of WAIS package or 0
- */
-int completeWAIS(const char *buf, int len)
-{
-    int i, lval = 0;
-
-    if (len < 25)
-        return 0;
-    if (*buf != '0')
-        return 0;
-    /* calculate length */
-    for (i = 0; i < 10; i++)
-        lval = lval * 10 + (buf[i] - '0');
-    lval += 25;
-    if (len >= lval)
-        return lval;
-    return 0;
-}
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
index 1f73065..3b9cf54 100644 (file)
@@ -420,7 +420,6 @@ MISC_OBJS= \
    $(OBJDIR)\ccl_stop_words.obj \
    $(OBJDIR)\comstack.obj \
    $(OBJDIR)\tcpip.obj \
-   $(OBJDIR)\waislen.obj \
    $(OBJDIR)\ber_any.obj \
    $(OBJDIR)\ber_bit.obj \
    $(OBJDIR)\ber_bool.obj \