Possible compatibility problems with earlier versions marked with '*'.
+* Added const modifier to buffer parameter for some ODR/BER encoding
+routines: ber_dectag, ber_declen, odp_more_chunks, completeBER,
+completeWAIS, odr_dumpBER.
+
Fixed bug in client.c which caused a crash when a scanResponse didn't
contain positionOfTerm.
/*
- * Copyright (c) 1995-1998 Index Data.
+ * Copyright (c) 1995-1999 Index Data.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation, in whole or in part, for any purpose, is hereby granted,
- * Copyright (C) 1995-1998, Index Data.
+ * Copyright (C) 1995-1999, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
Compilation and installation for YAZ
- $Id: README,v 1.23 1998-09-22 09:41:21 adam Exp $
+ $Id: README,v 1.24 1999-01-08 11:23:12 adam Exp $
The primary output of the source here is the lib/libyaz.a library,
which contains support functions for implementing the server or client
/*
- * Copyright (c) 1995-1998, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: tcpip.c,v $
- * Revision 1.25 1998-07-07 15:49:23 adam
+ * Revision 1.26 1999-01-08 11:23:14 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.25 1998/07/07 15:49:23 adam
* Added braces to avoid warning.
*
* Revision 1.24 1998/06/29 07:59:17 adam
#include <comstack.h>
#include <tcpip.h>
-/* Chas added the following 2, so we get the definition of completeBER */
+/* Chas added the following, so we get the definition of completeBER */
#include <odr.h>
-#include <prt.h>
int tcpip_close(COMSTACK h);
int tcpip_put(COMSTACK h, char *buf, int size);
char *tcpip_addrstr(COMSTACK h);
void *tcpip_straddr(COMSTACK h, const char *str);
-/*
- * Determine length/completeness of incoming packages
- */
-/* Chas: Removed the definition of completeBERfrom here, use the one in the */
-/* include directory as that as the extern "C" around it */
-/*int completeBER(unsigned char *buf, int len); */ /* from the ODR module */
-int completeWAIS(unsigned char *buf, int len); /* from waislen.c */
-
#undef TRACE_TCPIP
#ifdef TRACE_TCPIP
#define TRC(x) x
int written; /* -1 if we aren't writing */
int towrite; /* to verify against user input */
- int (*complete)(unsigned char *buf, int len); /* length/completeness */
+ int (*complete)(const unsigned char *buf, int len); /* length/comple. */
struct sockaddr_in addr; /* returned by cs_straddr */
char buf[128]; /* returned by cs_addrstr */
} tcpip_state;
/*
- * Copyright (c) 1995, Index Data.
+ * Copyright (c) 1995-1999, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: waislen.c,v $
- * Revision 1.3 1996-02-29 14:23:13 adam
+ * Revision 1.4 1999-01-08 11:23:15 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.3 1996/02/29 14:23:13 adam
* Bug fix.
*
* Revision 1.2 1996/02/26 18:34:44 adam
*/
#include <stdio.h>
+#include <comstack.h>
+#include <tcpip.h>
/*
* Return length of WAIS package or 0
*/
-int completeWAIS(unsigned char *buf, int len)
+int completeWAIS(const unsigned char *buf, int len)
{
int i, lval = 0;
/*
- * Copyright (c) 1995-1998, Index Data.
+ * Copyright (c) 1995-1999, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
- *
+ 9
* $Log: header.c,v $
- * Revision 1.6 1998-01-05 09:03:37 adam
+ * Revision 1.7 1999-01-08 11:23:13 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.6 1998/01/05 09:03:37 adam
* 1998.
*
* Revision 1.5 1997/07/02 14:12:52 adam
/*
- * Copyright (c) 1995-1998, Index Data.
+ * Copyright (c) 1995-1999, Index Data.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation, in whole or in part, for any purpose, is hereby granted,
* OF THIS SOFTWARE.
*
* $Log: odr.h,v $
- * Revision 1.26 1998-03-20 17:29:20 adam
+ * Revision 1.27 1999-01-08 11:23:17 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.26 1998/03/20 17:29:20 adam
* Include of odr_use.h in odr.h. Added prototype for odr_enum.
*
* Revision 1.25 1998/02/11 11:53:33 adam
typedef struct odr_constack
{
- unsigned char *base; /* starting point of data */
+ const unsigned char *base; /* starting point of data */
int base_offset;
int len; /* length of data, if known, else -1
(decoding only) */
- unsigned char *lenb; /* where to encode length */
+ const unsigned char *lenb; /* where to encode length */
int len_offset;
int lenlen; /* length of length-field */
} odr_constack;
int direction; /* the direction of this stream */
int error; /* current error state (0==OK) */
- unsigned char *buf; /* for encoding or decoding */
+ const unsigned char *buf; /* for encoding or decoding */
int buflen; /* size of buffer for encoding, len for decoding */
- unsigned char *bp; /* position in buffer */
+ const unsigned char *bp; /* position in buffer */
int left; /* bytes remaining in buffer */
odr_ecblock ecb; /* memory control block */
/*
- * Copyright (c) 1995-1998, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: prt.h,v $
- * Revision 1.24 1998-03-20 17:29:20 adam
+ * Revision 1.25 1999-01-08 11:23:18 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.24 1998/03/20 17:29:20 adam
* Include of odr_use.h in odr.h. Added prototype for odr_enum.
*
* Revision 1.23 1998/03/20 14:45:27 adam
YAZ_EXPORT int ber_boolean(ODR o, int *val);
YAZ_EXPORT int ber_tag(ODR o, void *p, int zclass, int tag, int *constructed, int opt);
YAZ_EXPORT int ber_enctag(ODR o, int zclass, int tag, int constructed);
-YAZ_EXPORT int ber_dectag(unsigned char *buf, int *zclass, int *tag, int *constructed);
+YAZ_EXPORT int ber_dectag(const unsigned char *buf, int *zclass, int *tag, int *constructed);
YAZ_EXPORT int odr_bool(ODR o, int **p, int opt);
YAZ_EXPORT int odr_integer(ODR o, int **p, int opt);
YAZ_EXPORT int odr_enum(ODR o, int **p, int opt);
YAZ_EXPORT int odr_implicit_settag(ODR o, int zclass, int tag);
YAZ_EXPORT int ber_enclen(ODR o, int len, int lenlen, int exact);
-YAZ_EXPORT int ber_declen(unsigned char *buf, int *len);
+YAZ_EXPORT int ber_declen(const unsigned char *buf, int *len);
YAZ_EXPORT char *odr_indent(ODR o);
YAZ_EXPORT int ber_null(ODR o);
YAZ_EXPORT int odr_null(ODR o, Odr_null **p, int opt);
YAZ_EXPORT int odr_set_end(ODR o);
YAZ_EXPORT int ber_octetstring(ODR o, Odr_oct *p, int cons);
YAZ_EXPORT int odr_octetstring(ODR o, Odr_oct **p, int opt);
-YAZ_EXPORT int odp_more_chunks(ODR o, unsigned char *base, int len);
+YAZ_EXPORT int odp_more_chunks(ODR o, const unsigned char *base, int len);
YAZ_EXPORT int odr_constructed_more(ODR o);
YAZ_EXPORT int odr_bitstring(ODR o, Odr_bitmask **p, int opt);
YAZ_EXPORT int ber_bitstring(ODR o, Odr_bitmask *p, int cons);
YAZ_EXPORT int odr_set_of(ODR o, Odr_fun type, void *p, int *num);
YAZ_EXPORT int odr_any(ODR o, Odr_any **p, int opt);
YAZ_EXPORT int ber_any(ODR o, Odr_any **p);
-YAZ_EXPORT int completeBER(unsigned char *buf, int len);
+YAZ_EXPORT int completeBER(const unsigned char *buf, int len);
YAZ_EXPORT void odr_begin(ODR o);
YAZ_EXPORT void odr_end(ODR o);
YAZ_EXPORT Odr_oid *odr_oiddup(ODR odr, Odr_oid *o);
YAZ_EXPORT int odr_grow_block(odr_ecblock *b, int min_bytes);
YAZ_EXPORT int odr_write(ODR o, unsigned char *buf, int bytes);
YAZ_EXPORT int odr_seek(ODR o, int whence, int offset);
-YAZ_EXPORT int odr_dumpBER(FILE *f, char *buf, int len);
+YAZ_EXPORT int odr_dumpBER(FILE *f, const char *buf, int len);
YAZ_EXPORT void odr_choice_bias(ODR o, int what);
YAZ_EXPORT void odr_choice_enable_bias(ODR o, int mode);
YAZ_EXPORT int odr_total(ODR o);
/*
- * Copyright (c) 1995, Index Data.
+ * Copyright (c) 1995-1999, Index Data.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation, in whole or in part, for any purpose, is hereby granted,
* OF THIS SOFTWARE.
*
* $Log: tcpip.h,v $
- * Revision 1.11 1998-06-22 11:32:38 adam
+ * Revision 1.12 1999-01-08 11:23:19 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.11 1998/06/22 11:32:38 adam
* Added 'conditional cs_listen' feature.
*
* Revision 1.10 1998/05/18 13:07:01 adam
extern "C" {
#endif
+YAZ_EXPORT int completeWAIS(const unsigned char *buf, int len);
YAZ_EXPORT struct sockaddr_in *tcpip_strtoaddr(const char *str);
YAZ_EXPORT COMSTACK tcpip_type(int s, int blocking, int protocol);
/*
- * Copyright (c) 1995, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_any.c,v $
- * Revision 1.14 1998-02-11 11:53:34 adam
+ * Revision 1.15 1999-01-08 11:23:20 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.14 1998/02/11 11:53:34 adam
* Changed code so that it compiles as C++.
*
* Revision 1.13 1997/05/14 06:53:56 adam
/*
* Return length of BER-package or 0.
*/
-int completeBER(unsigned char *buf, int len)
+int completeBER(const unsigned char *buf, int len)
{
int res, ll, zclass, tag, cons;
- unsigned char *b = buf;
+ const unsigned char *b = buf;
if (!len)
return 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_bit.c,v $
- * Revision 1.7 1995-09-29 17:12:16 quinn
+ * Revision 1.8 1999-01-08 11:23:21 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.7 1995/09/29 17:12:16 quinn
* Smallish
*
* Revision 1.6 1995/09/27 15:02:54 quinn
int ber_bitstring(ODR o, Odr_bitmask *p, int cons)
{
int res, len;
- unsigned char *base;
+ const unsigned char *base;
switch (o->direction)
{
/*
- * Copyright (c) 1995, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_int.c,v $
- * Revision 1.12 1996-07-06 19:58:33 quinn
+ * Revision 1.13 1999-01-08 11:23:22 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.12 1996/07/06 19:58:33 quinn
* System headerfiles gathered in yconfig
*
* Revision 1.11 1995/09/29 17:12:16 quinn
#include <string.h>
#include <odr.h>
-#include <prt.h>
static int ber_encinteger(ODR o, int val);
-static int ber_decinteger(unsigned char *buf, int *val);
+static int ber_decinteger(const unsigned char *buf, int *val);
int ber_integer(ODR o, int *val)
{
/*
* Returns: Number of bytes read or 0 if no match, -1 if error.
*/
-int ber_decinteger(unsigned char *buf, int *val)
+int ber_decinteger(const unsigned char *buf, int *val)
{
- unsigned char *b = buf, fill;
+ const unsigned char *b = buf;
+ unsigned char fill;
int res, len, remains;
union { int i; unsigned char c[sizeof(int)]; } tmp;
/*
- * Copyright (C) 1995, Index Data.
+ * Copyright (C) 1995-1999, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_len.c,v $
- * Revision 1.6 1995-09-29 17:12:17 quinn
+ * Revision 1.7 1999-01-08 11:23:23 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.6 1995/09/29 17:12:17 quinn
* Smallish
*
* Revision 1.5 1995/09/27 15:02:55 quinn
* len = -1 indefinite.
* len >= 0 Length.
*/
-int ber_declen(unsigned char *buf, int *len)
+int ber_declen(const unsigned char *buf, int *len)
{
- unsigned char *b = buf;
+ const unsigned char *b = buf;
int n;
if (*b == 0X80) /* Indefinite */
/*
- * Copyright (c) 1995, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_oct.c,v $
- * Revision 1.11 1998-02-11 11:53:34 adam
+ * Revision 1.12 1999-01-08 11:23:24 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.11 1998/02/11 11:53:34 adam
* Changed code so that it compiles as C++.
*
* Revision 1.10 1995/09/29 17:12:18 quinn
int ber_octetstring(ODR o, Odr_oct *p, int cons)
{
int res, len;
- unsigned char *base, *c;
+ const unsigned char *base;
+ unsigned char *c;
switch (o->direction)
{
/*
- * Copyright (c) 1995-1997, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ber_tag.c,v $
- * Revision 1.18 1998-02-11 11:53:34 adam
+ * Revision 1.19 1999-01-08 11:23:25 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.18 1998/02/11 11:53:34 adam
* Changed code so that it compiles as C++.
*
* Revision 1.17 1997/09/30 09:33:10 adam
/* ber_dectag
* Decode BER identifier octets. Return number of bytes read or -1 for error.
*/
-int ber_dectag(unsigned char *buf, int *zclass, int *tag, int *constructed)
+int ber_dectag(const unsigned char *buf, int *zclass, int *tag, int *constructed)
{
- unsigned char *b = buf;
+ const unsigned char *b = buf;
*zclass = *b >> 6;
*constructed = (*b >> 5) & 0X01;
/*
- * Copyright (c) 1995, Index Data.
+ * Copyright (c) 1995-1999, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dumpber.c,v $
- * Revision 1.9 1998-01-14 09:53:26 quinn
+ * Revision 1.10 1999-01-08 11:23:26 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.9 1998/01/14 09:53:26 quinn
* Added a bit more info to dump.
*
* Revision 1.8 1997/05/14 06:53:57 adam
#include <odr.h>
#include <stdio.h>
-static int do_dumpBER(FILE *f, char *buf, int len, int level, int offset)
+static int do_dumpBER(FILE *f, const char *buf, int len, int level, int offset)
{
int res, ll, zclass, tag, cons, lenlen, taglen;
- char *b = buf, *bp = buf;
+ const char *b = buf, *bp = buf;
if (!len)
return 0;
return b - buf;
}
-int odr_dumpBER(FILE *f, char *buf, int len)
+int odr_dumpBER(FILE *f, const char *buf, int len)
{
return do_dumpBER(f, buf, len, 0, 0);
}
/*
- * Copyright (c) 1995-1998, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_enum.c,v $
- * Revision 1.1 1998-03-20 14:45:01 adam
+ * Revision 1.2 1999-01-08 11:23:27 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.1 1998/03/20 14:45:01 adam
* Implemented odr_enum and odr_set_of.
*
*/
#include <odr.h>
-#include <prt.h>
/*
* Top level enum en/decoder.
/*
- * Copyright (c) 1995, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_int.c,v $
- * Revision 1.11 1998-02-11 11:53:34 adam
+ * Revision 1.12 1999-01-08 11:23:28 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.11 1998/02/11 11:53:34 adam
* Changed code so that it compiles as C++.
*
* Revision 1.10 1995/09/29 17:12:24 quinn
*/
#include <odr.h>
-#include <prt.h>
/*
* Top level integer en/decoder.
/*
- * Copyright (c) 1995-1998, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_util.c,v $
- * Revision 1.14 1998-10-13 15:58:36 adam
+ * Revision 1.15 1999-01-08 11:23:29 adam
+ * Added const modifier to some of the BER/ODR encoding routines.
+ *
+ * Revision 1.14 1998/10/13 15:58:36 adam
* Minor fix in odr_getoidbystr_nmem.
*
* Revision 1.13 1998/02/11 11:53:34 adam
return buf;
}
-int odp_more_chunks(ODR o, unsigned char *base, int len)
+int odp_more_chunks(ODR o, const unsigned char *base, int len)
{
if (!len)
return 0;