Possible compatibility problems with earlier versions marked with '*'.
+On UNIX when POSIX threads are available, a separate library libyazthread
+is created. Programmers should link with that library and the yaz library
+when using threads. The reason for the split was that some applications
+on Linux, such as Apache, doesn't work well when using shared objects that
+relies on threads.
+
+Added SSL support for the COMSTACK. You start yaz-client and yaz-ztest
+(or any frontend server) in SSL mode by specifying ssl: followed by
+address.
+
Added feature for CCL module. Virtual structure s=al or s=ol generates
and-list and or-list respectively instead of phrase search.
Added some OID's.
* Added prefix "yaz_" for the functions log_init.., log_file.. and
-log_mask_str. This was done to avoid name conflicts with other
-libraries (say other PHP extensions).
+log_mask_str. This was done to avoid name conflicts with other libraries
+(such as other PHP extensions).
Added raw OID member for preferred record syntax (request_format_raw)
and returned record syntax (output_format_raw) for backend fetch method.
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
+@SET_MAKE@
+
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
done; \
- rev="$$rev ."; \
+ test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
See the file LICENSE for details.
Compilation and installation instructions for YAZ
- $Id: README,v 1.31 2000-04-05 07:39:54 adam Exp $
+ $Id: README,v 1.32 2000-11-23 10:58:32 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
-role of Z39.50/SR.
+role of Z39.50.
Windows programmers: refer to the file windows.txt which describes how
to build the software using Microsoft Visual C++.
dnl This is just to silence aclocal about the macro not being used
ifelse([AC_DISABLE_FAST_INSTALL])dnl
+# Define a conditional.
+
+AC_DEFUN(AM_CONDITIONAL,
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi])
+
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: client.c,v $
- * Revision 1.107 2000-11-16 13:11:07 adam
+ * Revision 1.108 2000-11-23 10:58:32 adam
+ * SSL comstack support. Separate POSIX thread support library.
+ *
+ * Revision 1.107 2000/11/16 13:11:07 adam
* Changed because ccl_rpn_query sets attribute set.
*
* Revision 1.106 2000/11/13 09:44:59 adam
session_mem = NULL;
}
}
+ t = tcpip_type;
base[0] = '\0';
if (sscanf (arg, "%100[^/]/%100s", type_and_host, base) < 1)
return 0;
if (strncmp (type_and_host, "tcp:", 4) == 0)
host = type_and_host + 4;
+ else if (strncmp (type_and_host, "ssl:", 4) == 0)
+ {
+#if HAVE_OPENSSL_SSL_H
+ t = ssl_type;
+#else
+ printf ("SSL not supported\n");
+#endif
+ host = type_and_host + 4;
+ }
else
host = type_and_host;
if (*base)
cmd_base (base);
- t = tcpip_type;
protocol = PROTO_Z3950;
if (!(conn = cs_create(t, 1, protocol)))
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: tcpip.c,v $
- * Revision 1.33 2000-09-04 08:27:11 adam
+ * Revision 1.34 2000-11-23 10:58:32 adam
+ * SSL comstack support. Separate POSIX thread support library.
+ *
+ * Revision 1.33 2000/09/04 08:27:11 adam
* Work on error handling for tcpip_accept.
*
* Revision 1.32 1999/11/30 13:47:11 adam
#endif
#include <errno.h>
#include <fcntl.h>
+#if HAVE_OPENSSL_SSL_H
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#endif
#include <yaz/comstack.h>
#include <yaz/tcpip.h>
int (*check_ip)(void *cd, const char *a, int len, int type),
void *cd);
+#if HAVE_OPENSSL_SSL_H
+int ssl_get(COMSTACK h, char **buf, int *bufsize);
+int ssl_put(COMSTACK h, char *buf, int size);
+#endif
+
COMSTACK tcpip_accept(COMSTACK h);
char *tcpip_addrstr(COMSTACK h);
void *tcpip_straddr(COMSTACK h, const char *str);
-#undef TRACE_TCPIP
-#ifdef TRACE_TCPIP
+#if 0
#define TRC(x) x
#else
#define TRC(X)
#endif
+/* this state is used for both SSL and straight TCP/IP */
typedef struct tcpip_state
{
char *altbuf; /* alternate buffer for surplus data */
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 */
+#if HAVE_OPENSSL_SSL_H
+ SSL_CTX *ctx;
+ SSL_CTX *ctx_alloc;
+ SSL *ssl;
+#endif
} tcpip_state;
#ifdef WIN32
return 1;
}
#else
-
static int proto_number = 0;
static int tcpip_init (void)
return 1;
}
#endif
+
/*
* This function is always called through the cs_create() macro.
* s >= 0: socket has already been established for us.
*/
-COMSTACK tcpip_type(int s, int blocking, int protocol)
+COMSTACK tcpip_type(int s, int blocking, int protocol, void *vp)
{
COMSTACK p;
tcpip_state *state;
#endif
return 0;
+ p->io_pending = 0;
p->iofile = s;
p->type = tcpip_type;
p->protocol = (enum oid_proto) protocol;
p->cerrno = 0;
p->stackerr = 0;
+#if HAVE_OPENSSL_SSL_H
+ state->ctx = state->ctx_alloc = 0;
+ state->ssl = 0;
+#endif
+
state->altbuf = 0;
state->altsize = state->altlen = 0;
state->towrite = state->written = -1;
return p;
}
+#if HAVE_OPENSSL_SSL_H
+
+COMSTACK ssl_type(int s, int blocking, int protocol, void *vp)
+{
+ tcpip_state *state;
+ COMSTACK p;
+ yaz_log(LOG_LOG, "ssl_type begin");
+
+ p = tcpip_type (s, blocking, protocol, 0);
+ if (!p)
+ return 0;
+ p->f_get = ssl_get;
+ p->f_put = ssl_put;
+ p->type = ssl_type;
+ state = (tcpip_state *) p->cprivate;
+ if (vp)
+ state->ctx = vp;
+ else
+ {
+ SSL_load_error_strings();
+ OpenSSL_add_all_algorithms();
+
+ state->ctx = state->ctx_alloc = SSL_CTX_new (SSLv23_method());
+ if (!state->ctx)
+ {
+ tcpip_close(p);
+ return 0;
+ }
+ }
+ /* note: we don't handle already opened socket in SSL mode - yet */
+ yaz_log(LOG_LOG, "ssl_type end");
+ return p;
+}
+#endif
+
int tcpip_strtoaddr_ex(const char *str, struct sockaddr_in *add)
{
struct hostent *hp;
int tcpip_connect(COMSTACK h, void *address)
{
struct sockaddr_in *add = (struct sockaddr_in *)address;
+#if HAVE_OPENSSL_SSL_H
+ tcpip_state *sp = (tcpip_state *)h->cprivate;
+#endif
+ int r;
TRC(fprintf(stderr, "tcpip_connect\n"));
- if (connect(h->iofile, (struct sockaddr *) add, sizeof(*add)) < 0)
+ h->io_pending = 0;
+ if (h->state == CS_UNBND)
{
+ r = connect(h->iofile, (struct sockaddr *) add, sizeof(*add));
+ if (r < 0)
+ {
#ifdef WIN32
- if (WSAGetLastError() == WSAEWOULDBLOCK)
+ if (WSAGetLastError() == WSAEWOULDBLOCK)
+ {
+ h->state = CS_CONNECTING;
+ h->io_pending = CS_WANT_WRITE;
+ return 1;
+ }
#else
- if (errno == EINPROGRESS)
+ if (errno == EINPROGRESS)
+ {
+ h->state = CS_CONNECTING;
+ h->io_pending = CS_WANT_WRITE|CS_WANT_READ;
+ return 1;
+ }
#endif
- return 1;
- return -1;
+ return -1;
+ }
+ h->state = CS_CONNECTING;
+ }
+ if (h->state != CS_CONNECTING)
+ {
+ h->cerrno = CSOUTSTATE;
+ return -1;
+ }
+#if HAVE_OPENSSL_SSL_H
+ if (sp->ctx)
+ {
+ int res;
+
+ if (!sp->ssl)
+ {
+ sp->ssl = SSL_new (sp->ctx);
+ SSL_set_fd (sp->ssl, h->iofile);
+ }
+ res = SSL_connect (sp->ssl);
+ if (res <= 0)
+ {
+ int err = SSL_get_error(sp->ssl, res);
+ if (err == SSL_ERROR_WANT_READ)
+ {
+ yaz_log (LOG_LOG, "SSL_connect. want_read");
+ h->io_pending = CS_WANT_READ;
+ return 1;
+ }
+ if (err == SSL_ERROR_WANT_WRITE)
+ {
+ yaz_log (LOG_LOG, "SSL_connect. want_write");
+ h->io_pending = CS_WANT_WRITE;
+ return 1;
+ }
+ return -1;
+ }
}
+#endif
h->state = CS_DATAXFER;
return 0;
}
return 0;
}
+#define CERTF "ztest.pem"
+#define KEYF "ztest.pem"
+
int tcpip_bind(COMSTACK h, void *address, int mode)
{
struct sockaddr *addr = (struct sockaddr *)address;
unsigned long one = 1;
#endif
- TRC(fprintf(stderr, "tcpip_bind\n"));
+#if HAVE_OPENSSL_SSL_H
+ tcpip_state *sp = (tcpip_state *)h->cprivate;
+ if (sp->ctx)
+ {
+ if (sp->ctx_alloc)
+ {
+ int res;
+ res = SSL_CTX_use_certificate_file (sp->ctx, CERTF,
+ SSL_FILETYPE_PEM);
+ if (res <= 0)
+ {
+ ERR_print_errors_fp(stderr);
+ exit (2);
+ }
+ res = SSL_CTX_use_PrivateKey_file (sp->ctx, KEYF,
+ SSL_FILETYPE_PEM);
+ if (res <= 0)
+ {
+ ERR_print_errors_fp(stderr);
+ exit (3);
+ }
+ res = SSL_CTX_check_private_key (sp->ctx);
+ if (res <= 0)
+ {
+ ERR_print_errors_fp(stderr);
+ exit(5);
+ }
+ }
+ TRC (fprintf (stderr, "ssl_bind\n"));
+ }
+ else
+ {
+ TRC (fprintf (stderr, "tcpip_bind\n"));
+ }
+#else
+ TRC (fprintf (stderr, "tcpip_bind\n"));
+#endif
if (setsockopt(h->iofile, SOL_SOCKET, SO_REUSEADDR, (char*)
&one, sizeof(one)) < 0)
{
#endif
TRC(fprintf(stderr, "tcpip_accept\n"));
- if (h->state != CS_INCON)
- {
- h->cerrno = CSOUTSTATE;
- return 0;
- }
- if (!(cnew = (COMSTACK)xmalloc(sizeof(*cnew))))
- {
- h->cerrno = CSYSERR;
-#ifdef WIN32
- closesocket(h->newfd);
-#else
- close(h->newfd);
-#endif
- h->newfd = -1;
- return 0;
- }
- memcpy(cnew, h, sizeof(*h));
- cnew->iofile = h->newfd;
- if (!(state = (tcpip_state *)
- (cnew->cprivate = xmalloc(sizeof(tcpip_state)))))
+ if (h->state == CS_INCON)
{
- h->cerrno = CSYSERR;
- if (h->newfd != -1)
+ if (!(cnew = (COMSTACK)xmalloc(sizeof(*cnew))))
{
+ h->cerrno = CSYSERR;
#ifdef WIN32
closesocket(h->newfd);
#else
close(h->newfd);
#endif
h->newfd = -1;
+ return 0;
}
- return 0;
- }
+ memcpy(cnew, h, sizeof(*h));
+ cnew->iofile = h->newfd;
+ cnew->io_pending = 0;
+ if (!(state = (tcpip_state *)
+ (cnew->cprivate = xmalloc(sizeof(tcpip_state)))))
+ {
+ h->cerrno = CSYSERR;
+ if (h->newfd != -1)
+ {
#ifdef WIN32
- if (!cnew->blocking && ioctlsocket(cnew->iofile, FIONBIO, &tru) < 0)
+ closesocket(h->newfd);
#else
- if (!cnew->blocking && fcntl(cnew->iofile, F_SETFL, O_NONBLOCK) < 0)
+ close(h->newfd);
#endif
- {
- h->cerrno = CSYSERR;
- if (h->newfd != -1)
+ h->newfd = -1;
+ }
+ return 0;
+ }
+ if (!cnew->blocking &&
+#ifdef WIN32
+ (ioctlsocket(cnew->iofile, FIONBIO, &tru) < 0)
+#else
+ (!cnew->blocking && fcntl(cnew->iofile, F_SETFL, O_NONBLOCK) < 0)
+#endif
+ )
{
+ h->cerrno = CSYSERR;
+ if (h->newfd != -1)
+ {
#ifdef WIN32
- closesocket(h->newfd);
+ closesocket(h->newfd);
#else
- close(h->newfd);
+ close(h->newfd);
#endif
- h->newfd = -1;
+ h->newfd = -1;
+ }
+ xfree (cnew);
+ xfree (state);
+ return 0;
+ }
+ h->newfd = -1;
+ state->altbuf = 0;
+ state->altsize = state->altlen = 0;
+ state->towrite = state->written = -1;
+ state->complete = st->complete;
+ cnew->state = CS_ACCEPT;
+ h->state = CS_IDLE;
+
+#if HAVE_OPENSSL_SSL_H
+ state->ctx = st->ctx;
+ state->ctx_alloc = 0;
+ state->ssl = st->ssl;
+ if (state->ctx)
+ {
+ state->ssl = SSL_new (state->ctx);
+ SSL_set_fd (state->ssl, cnew->iofile);
}
- xfree (cnew);
- xfree (state);
+#endif
+ h = cnew;
+ }
+ if (h->state == CS_ACCEPT)
+ {
+#if HAVE_OPENSSL_SSL_H
+ tcpip_state *state = (tcpip_state *)h->cprivate;
+ if (state->ctx)
+ {
+ int res = SSL_accept (state->ssl);
+ TRC(fprintf(stderr, "SSL_accept\n"));
+ if (res <= 0)
+ {
+ int err = SSL_get_error(state->ssl, res);
+ if (err == SSL_ERROR_WANT_READ)
+ {
+ h->io_pending = CS_WANT_READ;
+ yaz_log (LOG_LOG, "SSL_accept. want_read");
+ return h;
+ }
+ if (err == SSL_ERROR_WANT_WRITE)
+ {
+ h->io_pending = CS_WANT_WRITE;
+ yaz_log (LOG_LOG, "SSL_accept. want_write");
+ return h;
+ }
+ cs_close (h);
+ return 0;
+ }
+ }
+#endif
+ }
+ else
+ {
+ h->cerrno = CSOUTSTATE;
return 0;
}
- h->newfd = -1;
- state->altbuf = 0;
- state->altsize = state->altlen = 0;
- state->towrite = state->written = -1;
- state->complete = st->complete;
- cnew->state = CS_DATAXFER;
- h->state = CS_IDLE;
- return cnew;
+ h->io_pending = 0;
+ h->state = CS_DATAXFER;
+ return h;
}
#define CS_TCPIP_BUFCHUNK 4096
sp->altbuf = tmpc;
sp->altsize = tmpi;
}
+ h->io_pending = 0;
while (!(berlen = (*sp->complete)((unsigned char *)*buf, hasread)))
{
if (!*bufsize)
else if (*bufsize - hasread < CS_TCPIP_BUFCHUNK)
if (!(*buf =(char *)xrealloc(*buf, *bufsize *= 2)))
return -1;
- if ((res = recv(h->iofile, *buf + hasread, CS_TCPIP_BUFCHUNK, 0)) < 0)
+ res = recv(h->iofile, *buf + hasread, CS_TCPIP_BUFCHUNK, 0);
+ TRC(fprintf(stderr, " recv res=%d, hasread=%d\n", res, hasread));
+ if (res < 0)
{
#ifdef WIN32
- if (WSAGetLastError() == WSAEWOULDBLOCK)
+ if (WSAGetLastError() == WSAEWOULDBLOCK)
+ {
+ h->io_pending = CS_WANT_READ;
break;
+ }
else
return -1;
#else
|| errno == EINPROGRESS
#endif
)
+ {
+ h->io_pending = CS_WANT_READ;
break;
- else if (errno == 0)
+ }
+ else if (errno == 0)
continue;
else
- return -1;
+ return -1;
#endif
}
- if (!res)
- return 0;
+ else if (!res)
+ return 0;
hasread += res;
- TRC(fprintf(stderr, " res=%d, hasread=%d\n", res, hasread));
}
- TRC(fprintf(stderr, " Out of read loop with hasread=%d, berlen=%d\n",
+ TRC (fprintf (stderr, " Out of read loop with hasread=%d, berlen=%d\n",
+ hasread, berlen));
+ /* move surplus buffer (or everything if we didn't get a BER rec.) */
+ if (hasread > berlen)
+ {
+ tomove = req = hasread - berlen;
+ rest = tomove % CS_TCPIP_BUFCHUNK;
+ if (rest)
+ req += CS_TCPIP_BUFCHUNK - rest;
+ if (!sp->altbuf)
+ {
+ if (!(sp->altbuf = (char *)xmalloc(sp->altsize = req)))
+ return -1;
+ } else if (sp->altsize < req)
+ if (!(sp->altbuf =(char *)xrealloc(sp->altbuf, sp->altsize = req)))
+ return -1;
+ TRC(fprintf(stderr, " Moving %d bytes to altbuf(0x%x)\n", tomove,
+ (unsigned) sp->altbuf));
+ memcpy(sp->altbuf, *buf + berlen, sp->altlen = tomove);
+ }
+ if (berlen < CS_TCPIP_BUFCHUNK - 1)
+ *(*buf + berlen) = '\0';
+ return berlen ? berlen : 1;
+}
+
+
+#if HAVE_OPENSSL_SSL_H
+/*
+ * Return: -1 error, >1 good, len of buffer, ==1 incomplete buffer,
+ * 0=connection closed.
+ */
+int ssl_get(COMSTACK h, char **buf, int *bufsize)
+{
+ tcpip_state *sp = (tcpip_state *)h->cprivate;
+ char *tmpc;
+ int tmpi, berlen, rest, req, tomove;
+ int hasread = 0, res;
+
+ TRC(fprintf(stderr, "ssl_get: bufsize=%d\n", *bufsize));
+ if (sp->altlen) /* switch buffers */
+ {
+ TRC(fprintf(stderr, " %d bytes in altbuf (0x%x)\n", sp->altlen,
+ (unsigned) sp->altbuf));
+ tmpc = *buf;
+ tmpi = *bufsize;
+ *buf = sp->altbuf;
+ *bufsize = sp->altsize;
+ hasread = sp->altlen;
+ sp->altlen = 0;
+ sp->altbuf = tmpc;
+ sp->altsize = tmpi;
+ }
+ h->io_pending = 0;
+ while (!(berlen = (*sp->complete)((unsigned char *)*buf, hasread)))
+ {
+ if (!*bufsize)
+ {
+ if (!(*buf = (char *)xmalloc(*bufsize = CS_TCPIP_BUFCHUNK)))
+ return -1;
+ }
+ else if (*bufsize - hasread < CS_TCPIP_BUFCHUNK)
+ if (!(*buf =(char *)xrealloc(*buf, *bufsize *= 2)))
+ return -1;
+ res = SSL_read (sp->ssl, *buf + hasread, CS_TCPIP_BUFCHUNK);
+ TRC(fprintf(stderr, " SSL_read res=%d, hasread=%d\n", res, hasread));
+ if (res <= 0)
+ {
+ int ssl_err = SSL_get_error(sp->ssl, res);
+ if (ssl_err == SSL_ERROR_WANT_READ)
+ {
+ h->io_pending = CS_WANT_READ;
+ yaz_log (LOG_LOG, "SSL_read. want_read");
+ break;
+ }
+ if (ssl_err == SSL_ERROR_WANT_WRITE)
+ {
+ h->io_pending = CS_WANT_WRITE;
+ yaz_log (LOG_LOG, "SSL_read. want_write");
+ break;
+ }
+ if (res == 0)
+ return 0;
+ return -1;
+ }
+ hasread += res;
+ }
+ TRC (fprintf (stderr, " Out of read loop with hasread=%d, berlen=%d\n",
hasread, berlen));
/* move surplus buffer (or everything if we didn't get a BER rec.) */
if (hasread > berlen)
*(*buf + berlen) = '\0';
return berlen ? berlen : 1;
}
+#endif
/*
* Returns 1, 0 or -1
struct tcpip_state *state = (struct tcpip_state *)h->cprivate;
TRC(fprintf(stderr, "tcpip_put: size=%d\n", size));
+ h->io_pending = 0;
if (state->towrite < 0)
{
state->towrite = size;
}
while (state->towrite > state->written)
{
- if ((res = send(h->iofile, buf + state->written, size -
- state->written, 0)) < 0)
- {
+ if ((res = send(h->iofile, buf + state->written, size -
+ state->written, 0)) < 0)
+ {
+ if (
#ifdef WIN32
- if (WSAGetLastError() == WSAEWOULDBLOCK)
+ WSAGetLastError() == WSAEWOULDBLOCK
#else
- if (errno == EAGAIN)
-#endif
- {
- TRC(fprintf(stderr, " Flow control stop\n"));
- return 1;
- }
- h->cerrno = CSYSERR;
- return -1;
- }
- state->written += res;
- TRC(fprintf(stderr, " Wrote %d, written=%d, nbytes=%d\n",
- res, state->written, size));
+ errno == EAGAIN
+#endif
+ )
+ {
+ TRC(fprintf(stderr, " Flow control stop\n"));
+ h->io_pending = CS_WANT_WRITE;
+ return 1;
+ }
+ h->cerrno = CSYSERR;
+ return -1;
+ }
+ state->written += res;
+ TRC(fprintf(stderr, " Wrote %d, written=%d, nbytes=%d\n",
+ res, state->written, size));
+ }
+ state->towrite = state->written = -1;
+ TRC(fprintf(stderr, " Ok\n"));
+ return 0;
+}
+
+
+#if HAVE_OPENSSL_SSL_H
+/*
+ * Returns 1, 0 or -1
+ * In nonblocking mode, you must call again with same buffer while
+ * return value is 1.
+ */
+int ssl_put(COMSTACK h, char *buf, int size)
+{
+ int res;
+ struct tcpip_state *state = (struct tcpip_state *)h->cprivate;
+
+ TRC(fprintf(stderr, "ssl_put: size=%d\n", size));
+ h->io_pending = 0;
+ if (state->towrite < 0)
+ {
+ state->towrite = size;
+ state->written = 0;
+ }
+ else if (state->towrite != size)
+ {
+ h->cerrno = CSWRONGBUF;
+ return -1;
+ }
+ while (state->towrite > state->written)
+ {
+ res = SSL_write (state->ssl, buf + state->written,
+ size - state->written);
+ if (res <= 0)
+ {
+ int ssl_err = SSL_get_error(state->ssl, res);
+ if (ssl_err == SSL_ERROR_WANT_READ)
+ {
+ h->io_pending = CS_WANT_READ;
+ yaz_log (LOG_LOG, "SSL_write. want_read");
+ return 1;
+ }
+ if (ssl_err == SSL_ERROR_WANT_WRITE)
+ {
+ h->io_pending = CS_WANT_WRITE;
+ yaz_log (LOG_LOG, "SSL_write. want_write");
+ return 1;
+ }
+ return -1;
+ }
+ state->written += res;
+ TRC(fprintf(stderr, " Wrote %d, written=%d, nbytes=%d\n",
+ res, state->written, size));
}
state->towrite = state->written = -1;
TRC(fprintf(stderr, " Ok\n"));
return 0;
}
+#endif
int tcpip_close(COMSTACK h)
{
TRC(fprintf(stderr, "tcpip_close\n"));
if (h->iofile != -1)
+ {
+#if HAVE_OPENSSL_SSL_H
+ if (sp->ssl)
+ {
+ SSL_shutdown (sp->ssl);
+ }
+#endif
#ifdef WIN32
closesocket(h->iofile);
#else
close(h->iofile);
#endif
+ }
if (sp->altbuf)
xfree(sp->altbuf);
+#if HAVE_OPENSSL_SSL_H
+ if (sp->ssl)
+ {
+ TRC (fprintf(stderr, "SSL_free\n"));
+ SSL_free (sp->ssl);
+ }
+ sp->ssl = 0;
+ if (sp->ctx_alloc)
+ SSL_CTX_free (sp->ctx_alloc);
+#endif
xfree(sp);
xfree(h);
return 0;
else
r = inet_ntoa(addr.sin_addr);
sprintf(buf, "tcp:%s", r);
+#if HAVE_OPENSSL_SSL_H
+ if (sp->ctx)
+ sprintf(buf, "ssl:%s", r);
+#endif
return buf;
}
ac_help="$ac_help
--disable-comp use old encoders, i.e. disable the YAZ ASN.1 Compiler"
ac_help="$ac_help
+ --with-openssl[=DIR] OpenSSL library in DIR"
+ac_help="$ac_help
--enable-tcpd[=PREFIX] enable TCP wrapper for server if available"
ac_help="$ac_help
- --enable-threads enable POSIX threads"
+ --disable-threads disable POSIX threads"
# Initialize some variables set by options.
# The variables have the same names as the options, with
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:572: checking for a BSD compatible install" >&5
+echo "configure:574: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:625: checking whether build environment is sane" >&5
+echo "configure:627: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:682: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:684: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:728: checking for working aclocal" >&5
+echo "configure:730: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:741: checking for working autoconf" >&5
+echo "configure:743: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:754: checking for working automake" >&5
+echo "configure:756: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:767: checking for working autoheader" >&5
+echo "configure:769: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:780: checking for working makeinfo" >&5
+echo "configure:782: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:797: checking for $ac_word" >&5
+echo "configure:799: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:827: checking for $ac_word" >&5
+echo "configure:829: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:878: checking for $ac_word" >&5
+echo "configure:880: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:910: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:912: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 921 "configure"
+#line 923 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:952: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:954: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:957: checking whether we are using GNU C" >&5
+echo "configure:959: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:966: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:985: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:987: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1017: checking how to run the C preprocessor" >&5
+echo "configure:1019: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1032 "configure"
+#line 1034 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1049 "configure"
+#line 1051 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1055: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1066 "configure"
+#line 1068 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1072: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1074: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1108: checking for a BSD compatible install" >&5
+echo "configure:1110: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1236: checking host system type" >&5
+echo "configure:1238: checking host system type" >&5
host_alias=$host
case "$host_alias" in
echo "$ac_t""$host" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1257: checking build system type" >&5
+echo "configure:1259: checking build system type" >&5
build_alias=$build
case "$build_alias" in
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1277: checking for $ac_word" >&5
+echo "configure:1279: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1316: checking for ld used by GCC" >&5
+echo "configure:1318: checking for ld used by GCC" >&5
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1340: checking for GNU ld" >&5
+echo "configure:1342: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1343: checking for non-GNU ld" >&5
+echo "configure:1345: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1379: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1381: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1395: checking for BSD-compatible nm" >&5
+echo "configure:1397: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1432: checking whether ln -s works" >&5
+echo "configure:1434: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
case "$host" in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 1481 "configure"' > conftest.$ac_ext
- if { (eval echo configure:1482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 1483 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1503: checking whether the C compiler needs -belf" >&5
+echo "configure:1505: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1508 "configure"
+#line 1510 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:1515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
HFILE=${srcdir}/asn/prt-proto.h
fi
echo $ac_n "checking whether proto.h needs to be generated""... $ac_c" 1>&6
-echo "configure:1641: checking whether proto.h needs to be generated" >&5
+echo "configure:1643: checking whether proto.h needs to be generated" >&5
yaz_include=${srcdir}/include/yaz
if test -r ${yaz_include}/proto.h && cmp -s $HFILE ${yaz_include}/proto.h; then
echo "$ac_t""no" 1>&6
fi
checkBoth=0
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1654: checking for connect" >&5
+echo "configure:1656: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1659 "configure"
+#line 1661 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
; return 0; }
EOF
-if { (eval echo configure:1682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
if test "$ac_cv_func_connect" = "no"; then
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:1703: checking for main in -lsocket" >&5
+echo "configure:1705: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1711 "configure"
+#line 1713 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
oldLibs=$LIBS
LIBS="$LIBS -lsocket -lnsl"
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:1744: checking for accept" >&5
+echo "configure:1746: checking for accept" >&5
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1749 "configure"
+#line 1751 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
; return 0; }
EOF
-if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_accept=yes"
else
fi
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1794: checking for gethostbyname" >&5
+echo "configure:1796: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1799 "configure"
+#line 1801 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
; return 0; }
EOF
-if { (eval echo configure:1822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:1840: checking for main in -lnsl" >&5
+echo "configure:1842: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1848 "configure"
+#line 1850 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
+openssl=no
+# Check whether --with-openssl or --without-openssl was given.
+if test "${with_openssl+set}" = set; then
+ withval="$with_openssl"
+ openssl=$withval
+fi
+
+if test "$openssl" = "yes"; then
+ echo $ac_n "checking for main in -lcrypto""... $ac_c" 1>&6
+echo "configure:1888: checking for main in -lcrypto" >&5
+ac_lib_var=`echo crypto'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lcrypto $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1896 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:1903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo crypto | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lcrypto $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ echo $ac_n "checking for SSL_new in -lssl""... $ac_c" 1>&6
+echo "configure:1931: checking for SSL_new in -lssl" >&5
+ac_lib_var=`echo ssl'_'SSL_new | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lssl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1939 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char SSL_new();
+
+int main() {
+SSL_new()
+; return 0; }
+EOF
+if { (eval echo configure:1950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo ssl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lssl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test "$ac_cv_lib_ssl_SSL_new" = "yes"; then
+ for ac_hdr in openssl/ssl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1982: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1987 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1992: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ fi
+fi
READLINE_LIBS=""
echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:1879: checking for readline in -lreadline" >&5
+echo "configure:2022: checking for readline in -lreadline" >&5
ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lreadline $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1887 "configure"
+#line 2030 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
readline()
; return 0; }
EOF
-if { (eval echo configure:1898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test "$ac_cv_lib_readline_readline" = "no"; then
echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:1920: checking for readline in -lreadline" >&5
+echo "configure:2063: checking for readline in -lreadline" >&5
ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lreadline $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1928 "configure"
+#line 2071 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
readline()
; return 0; }
EOF
-if { (eval echo configure:1939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for add_history in -lhistory""... $ac_c" 1>&6
-echo "configure:1961: checking for add_history in -lhistory" >&5
+echo "configure:2104: checking for add_history in -lhistory" >&5
ac_lib_var=`echo history'_'add_history | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lhistory $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1969 "configure"
+#line 2112 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
add_history()
; return 0; }
EOF
-if { (eval echo configure:1980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2005: checking for $ac_hdr" >&5
+echo "configure:2148: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2010 "configure"
+#line 2153 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2015: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
for ac_func in vsnprintf gettimeofday
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2045: checking for $ac_func" >&5
+echo "configure:2188: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2050 "configure"
+#line 2193 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:2073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
CPPFLAGS="$CPPFLAGS -I$enable_tcpd/include"
fi
echo $ac_n "checking for working tcpd.h""... $ac_c" 1>&6
-echo "configure:2111: checking for working tcpd.h" >&5
+echo "configure:2254: checking for working tcpd.h" >&5
LIBS="$LIBS -lwrap -lnsl"
cat > conftest.$ac_ext <<EOF
-#line 2114 "configure"
+#line 2257 "configure"
#include "confdefs.h"
#include <syslog.h>
#include <tcpd.h>
i = hosts_access(&request_info);
; return 0; }
EOF
-if { (eval echo configure:2125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
tcpd_ok=1
else
fi
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2148: checking for ANSI C header files" >&5
+echo "configure:2291: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2153 "configure"
+#line 2296 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2178 "configure"
+#line 2321 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2196 "configure"
+#line 2339 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 2217 "configure"
+#line 2360 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
exit (0); }
EOF
-if { (eval echo configure:2228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
enableval="$enable_threads"
enable_threads=$enableval
else
- enable_threads=no
+ enable_threads=yes
fi
+
if test "$enable_threads" = "yes"; then
+ OLIBS=$LIBS
echo $ac_n "checking for main in -lpthread""... $ac_c" 1>&6
-echo "configure:2264: checking for main in -lpthread" >&5
+echo "configure:2409: checking for main in -lpthread" >&5
ac_lib_var=`echo pthread'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2272 "configure"
+#line 2417 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for working POSIX Threads""... $ac_c" 1>&6
-echo "configure:2307: checking for working POSIX Threads" >&5
+echo "configure:2452: checking for working POSIX Threads" >&5
cat > conftest.$ac_ext <<EOF
-#line 2309 "configure"
+#line 2454 "configure"
#include "confdefs.h"
#include <pthread.h>
int func(void *p) { return 0; }
int r = pthread_create (&pthread_id, 0, func, 0);
; return 0; }
EOF
-if { (eval echo configure:2320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
thread_ok=yes
else
fi
rm -f conftest*
if test "$thread_ok" = "yes"; then
+ LIBTHREAD=-lpthread
echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_PTHREAD_H 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define _REENTRANT 1
-EOF
-
+ HAVETHREADS=1
else
+ LIBTHREAD=""
echo "$ac_t""no" 1>&6
+ HAVETHREADS=0
fi
+ LIBS=$OLIBS
+fi
+
+
+if test $HAVETHREADS = "1"; then
+ ISTHR_TRUE=
+ ISTHR_FALSE='#'
+else
+ ISTHR_TRUE='#'
+ ISTHR_FALSE=
fi
YAZ_SRC_ROOT=`pwd`
s%@ASNMODULE@%$ASNMODULE%g
s%@ILLMODULE@%$ILLMODULE%g
s%@ILLLIB@%$ILLLIB%g
+s%@LIBTHREAD@%$LIBTHREAD%g
+s%@ISTHR_TRUE@%$ISTHR_TRUE%g
+s%@ISTHR_FALSE@%$ISTHR_FALSE%g
s%@YAZ_SRC_ROOT@%$YAZ_SRC_ROOT%g
s%@SUBDIRS_VAR@%$SUBDIRS_VAR%g
dnl YAZ Toolkit, Index Data 1994-2000
dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.37 2000-10-11 10:40:56 adam Exp $
+dnl $Id: configure.in,v 1.38 2000-11-23 10:58:32 adam Exp $
AC_INIT(include/yaz/yaz-version.h)
AM_INIT_AUTOMAKE(yaz, 1.7)
dnl
fi
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
dnl
+dnl ------ Open SSL
+openssl=no
+AC_ARG_WITH(openssl, [ --with-openssl[=DIR] OpenSSL library in DIR], [openssl=$withval])
+if test "$openssl" = "yes"; then
+ AC_CHECK_LIB(crypto, main)
+ AC_CHECK_LIB(ssl, SSL_new)
+ if test "$ac_cv_lib_ssl_SSL_new" = "yes"; then
+ AC_CHECK_HEADERS(openssl/ssl.h)
+ fi
+fi
dnl ------ GNU Readline
READLINE_LIBS=""
AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline"])
fi
dnl
dnl ------ Threads
-AC_ARG_ENABLE(threads, [ --enable-threads enable POSIX threads],[enable_threads=$enableval],[enable_threads=no])
+AC_ARG_ENABLE(threads, [ --disable-threads disable POSIX threads],[enable_threads=$enableval],[enable_threads=yes])
+AC_SUBST(LIBTHREAD)
if test "$enable_threads" = "yes"; then
+ OLIBS=$LIBS
AC_CHECK_LIB(pthread,main)
AC_MSG_CHECKING(for working POSIX Threads)
AC_TRY_LINK([#include <pthread.h>
int r = pthread_create (&pthread_id, 0, func, 0);],
thread_ok=yes,thread_ok=no)
if test "$thread_ok" = "yes"; then
+ LIBTHREAD=-lpthread
AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PTHREAD_H)
- AC_DEFINE(_REENTRANT)
+ HAVETHREADS=1
else
+ LIBTHREAD=""
AC_MSG_RESULT(no)
+ HAVETHREADS=0
fi
+ LIBS=$OLIBS
fi
+AM_CONDITIONAL(ISTHR, test $HAVETHREADS = "1")
dnl ------ Using this for "in-source" yaz-config
AC_SUBST(YAZ_SRC_ROOT)
YAZ_SRC_ROOT=`pwd`
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
+@SET_MAKE@
+
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
done; \
- rev="$$rev ."; \
+ test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: comstack.h,v 1.2 2000-02-28 11:20:06 adam Exp $
+ * $Id: comstack.h,v 1.3 2000-11-23 10:58:32 adam Exp $
*/
#ifndef COMSTACK_H
struct comstack;
typedef struct comstack *COMSTACK;
-typedef COMSTACK (*CS_TYPE)(int s, int blocking, int protocol);
+typedef COMSTACK (*CS_TYPE)(int s, int blocking, int protocol, void *vp);
struct comstack
{
#define CS_INCON 2
#define CS_OUTCON 3
#define CS_DATAXFER 4
+#define CS_ACCEPT 5
+#define CS_CONNECT 6
int newfd; /* storing new descriptor between listen and accept */
int blocking; /* is this link (supposed to be) blocking? */
+ unsigned io_pending; /* flag to signal read / write op is incomplete */
int event; /* current event */
#define CS_NONE 0
-#define CS_CONNECT 1
+#define CS_CONNECTING 1
#define CS_DISCON 2
#define CS_LISTEN 3
#define CS_DATA 4
#define cs_listen_check(handle, ap, al, cf, cd) ((*(handle)->f_listen)(handle, ap, al, cf, cd))
#define cs_accept(handle) ((*(handle)->f_accept)(handle))
#define cs_close(handle) ((*(handle)->f_close)(handle))
-#define cs_create(type, blocking, proto) ((*type)(-1, blocking, proto))
+#define cs_create(type, blocking, proto) ((*type)(-1, blocking, proto, 0))
#define cs_createbysocket(sock, type, blocking, proto) \
- ((*type)(sock, blocking, proto))
+ ((*type)(sock, blocking, proto, 0))
#define cs_type(handle) ((handle)->type)
#define cs_fileno(handle) ((handle)->iofile)
#define cs_stackerr(handle) ((handle)->stackerr)
#define cs_getproto(handle) ((handle)->protocol)
#define cs_addrstr(handle) ((*(handle)->f_addrstr)(handle))
#define cs_straddr(handle, str) ((*(handle)->f_straddr)(handle, str))
+#define cs_want_read(handle) ((handle)->io_pending & CS_WANT_READ)
+#define cs_want_write(handle) ((handle)->io_pending & CS_WANT_WRITE)
+#define CS_WANT_READ 1
+#define CS_WANT_WRITE 2
YAZ_EXPORT const char *cs_strerror(COMSTACK h);
YAZ_EXPORT const char *cs_errmsg(int n);
* OF THIS SOFTWARE.
*
* $Log: tcpip.h,v $
- * Revision 1.2 2000-02-28 11:20:06 adam
+ * Revision 1.3 2000-11-23 10:58:32 adam
+ * SSL comstack support. Separate POSIX thread support library.
+ *
+ * Revision 1.2 2000/02/28 11:20:06 adam
* Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL.
*
* Revision 1.1 1999/11/30 13:47:11 adam
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);
+YAZ_EXPORT COMSTACK tcpip_type(int s, int blocking, int protocol, void *vp);
+YAZ_EXPORT COMSTACK ssl_type(int s, int blocking, int protocol, void *vp);
YAZ_END_CDECL
-#! /bin/sh
+#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
if [ -d $dst ]; then
instcmd=:
+ chmodcmd=""
else
instcmd=mkdir
fi
-## $Id: Makefile.am,v 1.8 2000-10-11 11:36:15 adam Exp $
+## $Id: Makefile.am,v 1.9 2000-11-23 10:58:32 adam Exp $
-lib_LTLIBRARIES = libyaz.la
+if ISTHR
+extra=libyazthread.la
+endif
+
+lib_LTLIBRARIES = libyaz.la $(extra)
# If the line below is omitted the LINK variable is
# not set in Makefile.in and it will NOT work ..
# No real sources
libyaz_la_SOURCES=
+libyazthread_la_SOURCES=nmem.c statserv.c
+
LDFLAGS=-version-info 1:0:0
+nmem.c:
+ ln -s $(srcdir)/../util/nmem.c
+
+statserv.c:
+ ln -s $(srcdir)/../server/statserv.c
+
+INCLUDES =-I$(srcdir)/../include -I$(srcdir)/../server -D_REENTRANT=1 -DHAVE_PTHREAD_H=1
+
bin_SCRIPTS = yaz-config
libyaz_la_LIBADD=../odr/libodr.la ../$(ASNMODULE)/libasn.la \
../comstack/libcomstack.la ../server/libserver.la \
../zutil/libzutil.la ../util/libutil.la ../ccl/libccl.la \
../retrieval/libret.la $(ILLLIB)
+
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
VERSION = @VERSION@
YAZ_SRC_ROOT = @YAZ_SRC_ROOT@
-lib_LTLIBRARIES = libyaz.la
+@ISTHR_TRUE@extra = libyazthread.la
+
+lib_LTLIBRARIES = libyaz.la $(extra)
# If the line below is omitted the LINK variable is
# not set in Makefile.in and it will NOT work ..
# No real sources
libyaz_la_SOURCES =
+libyazthread_la_SOURCES = nmem.c statserv.c
+
LDFLAGS = -version-info 1:0:0
+INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../server -D_REENTRANT=1 -DHAVE_PTHREAD_H=1
+
bin_SCRIPTS = yaz-config
libyaz_la_LIBADD = ../odr/libodr.la ../$(ASNMODULE)/libasn.la ../comstack/libcomstack.la ../server/libserver.la ../zutil/libzutil.la ../util/libutil.la ../ccl/libccl.la ../retrieval/libret.la $(ILLLIB)
../comstack/libcomstack.la ../server/libserver.la ../zutil/libzutil.la \
../util/libutil.la ../ccl/libccl.la ../retrieval/libret.la
libyaz_la_OBJECTS =
+libyazthread_la_LDFLAGS =
+libyazthread_la_LIBADD =
+libyazthread_la_OBJECTS = nmem.lo statserv.lo
SCRIPTS = $(bin_SCRIPTS)
CFLAGS = @CFLAGS@
TAR = gtar
GZIP_ENV = --best
-DEP_FILES = .deps/x.P
-SOURCES = $(libyaz_la_SOURCES) $(EXTRA_libyaz_la_SOURCES)
-OBJECTS = $(libyaz_la_OBJECTS)
+DEP_FILES = .deps/nmem.P .deps/statserv.P .deps/x.P
+SOURCES = $(libyaz_la_SOURCES) $(EXTRA_libyaz_la_SOURCES) $(libyazthread_la_SOURCES)
+OBJECTS = $(libyaz_la_OBJECTS) $(libyazthread_la_OBJECTS)
all: all-redirect
.SUFFIXES:
libyaz.la: $(libyaz_la_OBJECTS) $(libyaz_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libyaz_la_LDFLAGS) $(libyaz_la_OBJECTS) $(libyaz_la_LIBADD) $(LIBS)
+libyazthread.la: $(libyazthread_la_OBJECTS) $(libyazthread_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libyazthread_la_LDFLAGS) $(libyazthread_la_OBJECTS) $(libyazthread_la_LIBADD) $(LIBS)
+
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean distclean maintainer-clean
+nmem.c:
+ ln -s $(srcdir)/../util/nmem.c
+
+statserv.c:
+ ln -s $(srcdir)/../server/statserv.c
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Created: 1993-05-16
# Public domain
-# $Id: mkinstalldirs,v 1.1 2000-02-28 11:20:05 adam Exp $
+# $Id: mkinstalldirs,v 1.2 2000-11-23 10:58:32 adam Exp $
errstatus=0
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
-## $Id: Makefile.am,v 1.3 2000-04-05 07:39:55 adam Exp $
+## $Id: Makefile.am,v 1.4 2000-11-23 10:58:32 adam Exp $
noinst_LTLIBRARIES=libserver.la
LIBS =
-INCLUDES=-I$(srcdir)/../include
+INCLUDES=-I$(srcdir)/../include
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
LIBS =
-INCLUDES = -I$(srcdir)/../include
+INCLUDES = -I$(srcdir)/../include
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
* See the file LICENSE for details.
*
* $Log: seshigh.c,v $
- * Revision 1.110 2000-10-02 13:05:32 adam
+ * Revision 1.111 2000-11-23 10:58:32 adam
+ * SSL comstack support. Separate POSIX thread support library.
+ *
+ * Revision 1.110 2000/10/02 13:05:32 adam
* Fixed bug introduced by previous commit.
*
* Revision 1.109 2000/10/02 11:07:44 adam
anew->init = 0;
anew->client_chan = channel;
anew->client_link = link;
+ anew->cs_get_mask = 0;
+ anew->cs_put_mask = 0;
+ anew->cs_accept_mask = 0;
if (!(anew->decode = odr_createmem(ODR_DECODE)) ||
!(anew->encode = odr_createmem(ODR_ENCODE)))
return 0;
}
return;
}
- if (event & EVENT_INPUT || event & EVENT_WORK) /* input */
+ if (event & assoc->cs_accept_mask)
+ {
+ yaz_log (LOG_DEBUG, "ir_session (accept)");
+ if (!cs_accept (conn))
+ {
+ yaz_log (LOG_LOG, "accept failed");
+ destroy_association(assoc);
+ iochan_destroy(h);
+ }
+ iochan_clearflag (h, EVENT_OUTPUT|EVENT_OUTPUT);
+ if (conn->io_pending)
+ { /* cs_accept didn't complete */
+ assoc->cs_accept_mask =
+ ((conn->io_pending & CS_WANT_WRITE) ? EVENT_OUTPUT : 0) |
+ ((conn->io_pending & CS_WANT_READ) ? EVENT_INPUT : 0);
+
+ iochan_setflag (h, assoc->cs_accept_mask);
+ }
+ else
+ { /* cs_accept completed. Prepare for reading (cs_get) */
+ assoc->cs_accept_mask = 0;
+ assoc->cs_get_mask = EVENT_INPUT;
+ iochan_setflag (h, assoc->cs_get_mask);
+ }
+ return;
+ }
+ if ((event & assoc->cs_get_mask) || (event & EVENT_WORK)) /* input */
{
- if (event & EVENT_INPUT)
+ if ((assoc->cs_put_mask & EVENT_INPUT) == 0 && (event & assoc->cs_get_mask))
{
yaz_log(LOG_DEBUG, "ir_session (input)");
- assert(assoc && conn);
/* We aren't speaking to this fellow */
if (assoc->state == ASSOC_DEAD)
{
iochan_destroy(h);
return;
}
+ assoc->cs_get_mask = EVENT_INPUT;
if ((res = cs_get(conn, &assoc->input_buffer,
&assoc->input_buffer_len)) <= 0)
{
return;
}
else if (res == 1) /* incomplete read - wait for more */
+ {
+ if (conn->io_pending & CS_WANT_WRITE)
+ assoc->cs_get_mask |= EVENT_OUTPUT;
+ iochan_setflag(h, assoc->cs_get_mask);
return;
+ }
if (cs_more(conn)) /* more stuff - call us again later, please */
iochan_setevent(h, EVENT_INPUT);
do_close_req(assoc, Z_Close_systemProblem, msg, req);
}
}
- if (event & EVENT_OUTPUT)
+ if (event & assoc->cs_put_mask)
{
request *req = request_head(&assoc->outgoing);
+ assoc->cs_put_mask = 0;
yaz_log(LOG_DEBUG, "ir_session (output)");
req->state = REQUEST_PENDING;
switch (res = cs_put(conn, req->response, req->len_response))
{
- case -1:
- yaz_log(LOG_LOG, "Connection closed by client");
- cs_close(conn);
- destroy_association(assoc);
- iochan_destroy(h);
- break;
- case 0: /* all sent - release the request structure */
- yaz_log(LOG_DEBUG, "Wrote PDU, %d bytes", req->len_response);
- nmem_destroy(req->request_mem);
- request_deq(&assoc->outgoing);
- request_release(req);
- if (!request_head(&assoc->outgoing))
- iochan_clearflag(h, EVENT_OUTPUT);
- break;
- /* value of 1 -- partial send -- is simply ignored */
+ case -1:
+ yaz_log(LOG_LOG, "Connection closed by client");
+ cs_close(conn);
+ destroy_association(assoc);
+ iochan_destroy(h);
+ break;
+ case 0: /* all sent - release the request structure */
+ yaz_log(LOG_DEBUG, "Wrote PDU, %d bytes", req->len_response);
+ nmem_destroy(req->request_mem);
+ request_deq(&assoc->outgoing);
+ request_release(req);
+ if (!request_head(&assoc->outgoing))
+ { /* restore mask for cs_get operation ... */
+ iochan_clearflag(h, EVENT_OUTPUT|EVENT_INPUT);
+ iochan_setflag(h, assoc->cs_get_mask);
+ }
+ break;
+ default:
+ if (conn->io_pending & CS_WANT_WRITE)
+ assoc->cs_put_mask |= EVENT_OUTPUT;
+ if (conn->io_pending & CS_WANT_READ)
+ assoc->cs_put_mask |= EVENT_INPUT;
+ iochan_setflag(h, assoc->cs_put_mask);
}
}
if (event & EVENT_EXCEPT)
{
- yaz_log(LOG_DEBUG, "ir_session (exception)");
+ yaz_log(LOG_LOG, "ir_session (exception)");
cs_close(conn);
destroy_association(assoc);
iochan_destroy(h);
request_enq(&assoc->outgoing, req);
/* turn the work over to the ir_session handler */
iochan_setflag(assoc->client_chan, EVENT_OUTPUT);
+ assoc->cs_put_mask = EVENT_OUTPUT;
/* Is there more work to be done? give that to the input handler too */
#if 1
if (request_head(&assoc->incoming))
assoc->preferredMessageSize = *req->preferredMessageSize;
if (assoc->preferredMessageSize > assoc->maximumRecordSize)
assoc->preferredMessageSize = assoc->maximumRecordSize;
+
+#if 0
+ assoc->maximumRecordSize = 3000000;
+ assoc->preferredMessageSize = 3000000;
+#endif
+
resp->preferredMessageSize = &assoc->preferredMessageSize;
resp->maximumRecordSize = &assoc->maximumRecordSize;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: session.h,v $
- * Revision 1.23 2000-04-05 07:39:55 adam
+ * Revision 1.24 2000-11-23 10:58:32 adam
+ * SSL comstack support. Separate POSIX thread support library.
+ *
+ * Revision 1.23 2000/04/05 07:39:55 adam
* Added shared library support (libtool).
*
* Revision 1.22 2000/03/20 19:06:25 adam
int maximumRecordSize;
int version; /* highest version-bit set (2 or 3) */
+ unsigned cs_get_mask;
+ unsigned cs_put_mask;
+ unsigned cs_accept_mask;
+
struct bend_initrequest *init;
#if 0
int (*bend_sort) ();
* Chas Woodfield, Fretwell Downing Informatics.
*
* $Log: statserv.c,v $
- * Revision 1.66 2000-10-06 12:00:28 adam
+ * Revision 1.67 2000-11-23 10:58:32 adam
+ * SSL comstack support. Separate POSIX thread support library.
+ *
+ * Revision 1.66 2000/10/06 12:00:28 adam
* Fixed Handle leak for WIN32.
*
* Revision 1.65 2000/09/04 08:58:15 adam
}
}
+/* WIN32 statserv_closedown */
void statserv_closedown()
{
/* Shouldn't do anything if we are not initialized */
event_loop (&iochan);
}
-static void listener(IOCHAN h, int event)
+/* WIN32 listener */
+static void listener(IOCHAN h, int event)
{
COMSTACK line = (COMSTACK) iochan_getdata(h);
association *newas;
}
else if (event == EVENT_OUTPUT)
{
- COMSTACK new_line;
+ COMSTACK new_line = cs_accept(line);
IOCHAN new_chan;
char *a = NULL;
- if (!(new_line = cs_accept(line)))
+ if (!new_line)
{
yaz_log(LOG_FATAL, "Accept failed.");
- iochan_setflags(h, EVENT_INPUT | EVENT_EXCEPT); /* reset listener */
+ iochan_setflags(h, EVENT_INPUT | EVENT_EXCEPT);
return;
}
yaz_log(LOG_DEBUG, "Accept ok");
iochan_destroy(h);
return;
}
+ newas->cs_get_mask = EVENT_INPUT;
+ newas->cs_put_mask = 0;
+ newas->cs_accept_mask = 0;
+
yaz_log(LOG_DEBUG, "Setting timeout %d", control_block.idle_timeout);
iochan_setdata(new_chan, newas);
iochan_settimeout(new_chan, control_block.idle_timeout * 60);
static void *new_session (void *vp);
+/* UNIX listener */
static void listener(IOCHAN h, int event)
{
COMSTACK line = (COMSTACK) iochan_getdata(h);
/* in dynamic mode, only the child ever comes down here */
else if (event == EVENT_OUTPUT)
{
- COMSTACK new_line;
+ COMSTACK new_line = cs_accept(line);
- if (!(new_line = cs_accept(line)))
+ if (!new_line)
{
yaz_log(LOG_FATAL, "Accept failed.");
iochan_setflags(h, EVENT_INPUT | EVENT_EXCEPT); /* reset listener */
association *newas;
IOCHAN new_chan;
COMSTACK new_line = (COMSTACK) vp;
- if (!(new_chan = iochan_create(cs_fileno(new_line), ir_session,
- EVENT_INPUT)))
+
+ unsigned cs_get_mask, cs_accept_mask, mask =
+ ((new_line->io_pending & CS_WANT_WRITE) ? EVENT_OUTPUT : 0) |
+ ((new_line->io_pending & CS_WANT_READ) ? EVENT_INPUT : 0);
+
+ if (mask)
+ {
+ yaz_log (LOG_LOG, "new_session , accept incomplete");
+ cs_accept_mask = mask; /* accept didn't complete */
+ cs_get_mask = 0;
+ }
+ else
+ {
+ yaz_log (LOG_LOG, "new_session , accept complete");
+ cs_accept_mask = 0; /* accept completed. */
+ cs_get_mask = mask = EVENT_INPUT;
+ }
+
+ if (!(new_chan = iochan_create(cs_fileno(new_line), ir_session, mask)))
{
yaz_log(LOG_FATAL, "Failed to create iochan");
return 0;
yaz_log(LOG_FATAL, "Failed to create new assoc.");
return 0;
}
+ newas->cs_accept_mask = cs_accept_mask;
+ newas->cs_get_mask = cs_get_mask;
+
iochan_setdata(new_chan, newas);
iochan_settimeout(new_chan, control_block.idle_timeout * 60);
a = cs_addrstr(new_line);
yaz_log(LOG_LOG, "Accepted connection from %s", a ? a : "[Unknown]");
+
if (control_block.threads)
{
event_loop(&new_chan);
if (!where || sscanf(where, "%[^:]:%s", mode, addr) != 2)
{
- yaz_log (LOG_WARN, "%s: Address format: ('tcp'|'osi')':'<address>", me);
+ yaz_log (LOG_WARN, "%s: Address format: ('tcp'|'ssl')':'<address>",
+ me);
return;
}
if (!strcmp(mode, "tcp"))
type = tcpip_type;
- else if (!strcmp(mode, "osi"))
+ else if (!strcmp(mode, "ssl"))
{
-#ifdef USE_XTIMOSI
- type = mosi_type;
+#if HAVE_OPENSSL_SSL_H
+ type = ssl_type;
#else
- yaz_log (LOG_WARN, "OSI Transport not allowed by configuration.");
+ yaz_log (LOG_WARN, "SSL Transport not allowed by configuration.");
return;
#endif
}
else
{
- yaz_log (LOG_WARN, "You must specify either 'osi:' or 'tcp:'");
+ yaz_log (LOG_WARN, "You must specify either 'ssl:' or 'tcp:'");
return;
}
yaz_log(LOG_LOG, "Adding %s %s listener on %s",
/* We need to initialize the thread list */
ThreadList_Initialize();
#endif /* WIN32 */
-
+
#ifdef WIN32
if ((me = strrchr (argv[0], '\\')))
me++;
#endif
if (control_block.options_func(argc, argv))
return(1);
-
+
if (control_block.bend_start)
(*control_block.bend_start)(&control_block);
#ifdef WIN32
logf (LOG_LOG, "Starting server %s pid=%d", me, getpid());
#if 0
sigset_t sigs_to_block;
-
+
sigemptyset(&sigs_to_block);
sigaddset (&sigs_to_block, SIGTERM);
pthread_sigmask (SIG_BLOCK, &sigs_to_block, 0);
- pthread_create (&
-
-
+ /* missing... */
#endif
if (control_block.dynamic)
signal(SIGCHLD, catchchld);
}
-
+ signal (SIGPIPE, SIG_IGN);
signal (SIGTERM, sigterm);
if (*control_block.setuid)
{
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
## Copyright (C) 1994-2000, Index Data
## All rights reserved.
-## $Id: Makefile.am,v 1.7 2000-05-18 11:57:05 adam Exp $
+## $Id: Makefile.am,v 1.8 2000-11-23 10:58:33 adam Exp $
noinst_LTLIBRARIES = libutil.la
+#lib_LTLIBRARIES = libyazthread.la
+
bin_SCRIPTS = yaz-comp
EXTRA_DIST = yaz-comp
INCLUDES =-I$(srcdir)/../include
+libyazthread_la_INCLUDES=-I$(srcdir)/../include
+
noinst_PROGRAMS = marcdump
marcdump_LDADD = libutil.la
libutil_la_SOURCES=options.c log.c marcdisp.c oid.c wrbuf.c nmemsdup.c \
xmalloc.c readconf.c tpath.c nmem.c matchstr.c atoin.c
+
+#libyazthread_la_SOURCES=nmemthread.c xmalloc.c log.c
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
noinst_LTLIBRARIES = libutil.la
+#lib_LTLIBRARIES = libyazthread.la
+
bin_SCRIPTS = yaz-comp
EXTRA_DIST = yaz-comp
INCLUDES = -I$(srcdir)/../include
+libyazthread_la_INCLUDES = -I$(srcdir)/../include
+
noinst_PROGRAMS = marcdump
marcdump_LDADD = libutil.la
mostlyclean distclean maintainer-clean
+#libyazthread_la_SOURCES=nmemthread.c xmalloc.c log.c
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#!/bin/sh
-# $Id: yaz-config.in,v 1.3 2000-10-11 12:24:58 adam Exp $
+# $Id: yaz-config.in,v 1.4 2000-11-23 10:58:32 adam Exp $
yazprefix=@prefix@
yaz_echo_cflags=no
yaz_echo_libs=no
yaz_echo_lalibs=no
yaz_src_root=@YAZ_SRC_ROOT@
-yazlibs="@LIBS@"
+yazextralibs="@LIBS@"
YAZVERSION=@VERSION@
usage()
[--lalibs]
[--cflags]
[--tabs]
+Libraries:
+ threads
EOF
exit $1
}
--lalibs)
yaz_echo_lalibs=yes
;;
+ threads)
+ lib_thread=yes
+ ;;
-*)
yaz_echo_help=yes
;;
shift
done
+if test "$lib_thread" = "yes"; then
+ yazextralibs="@LIBTHREAD@ $yazextralibs"
+ lyaz="-lyazthread -lyaz"
+else
+ lyaz="-lyaz"
+fi
if test "$yaz_echo_source" = "yes"; then
YAZTAB=${yaz_src_root}/tab
YAZBIN=${yaz_src_root}/bin
- YAZLIB="-L${yaz_src_root}/lib/.libs -lyaz $yazlibs"
- YAZLALIB="${yaz_src_root}/lib/libyaz.la $yazlibs"
+ YAZLIB="-L${yaz_src_root}/lib/.libs $lyaz $yazextralibs"
+ if test "$lib_thread" = "yes"; then
+ YAZLALIB="${yaz_src_root}/lib/libyazthread.la ${yaz_src_root}/lib/libyaz.la $yazextralibs"
+ else
+ YAZLALIB="${yaz_src_root}/lib/libyazthread.la $yazextralibs"
+ fi
YAZINC="-I${yaz_src_root}/include"
else
YAZTAB=$yazprefix/share/yaz/tab
YAZBIN=$yazprefix/bin
if test "$yazprefix" = "/usr"; then
- YAZLIB="-lyaz $yazlibs"
+ YAZLIB="$lyaz $yazextralibs"
else
- YAZLIB="-L$yazprefix/lib -lyaz $yazlibs"
+ YAZLIB="-L$yazprefix/lib $lyaz $yazextralibs"
fi
YAZLALIB=$YAZLIB
if test "$yazprefix" = "/usr"; then
fi
fi
+if test "$lib_thread" = "yes"; then
+ YAZINC="$YAZINC -D_REENTRANT"
+fi
+
if test "$yaz_echo_help" = "yes"; then
usage 1 1>&2
fi
/usr/lib/libyaz.so
/usr/lib/libyaz.so.1
/usr/lib/libyaz.so.1.0.0
+/usr/lib/libyazthread.a
+/usr/lib/libyazthread.so
+/usr/lib/libyazthread.so.1
+/usr/lib/libyazthread.so.1.0.0
/usr/include/yaz
/usr/share/yaz/doc
/usr/share/aclocal/yaz.m4
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
-## $Id: Makefile.am,v 1.3 2000-04-05 07:39:55 adam Exp $
+## $Id: Makefile.am,v 1.4 2000-11-23 10:58:33 adam Exp $
bin_PROGRAMS=yaz-ztest
EXTRA_DIST=dummy-records dummy-words dummy-grs
-yaz_ztest_LDADD=../lib/libyaz.la
+if ISTHR
+extra=../lib/libyazthread.la
+endif
+yaz_ztest_LDADD=$(extra) ../lib/libyaz.la $(LIBTHREAD)
INCLUDES=-I$(srcdir)/../include
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
EXTRA_DIST = dummy-records dummy-words dummy-grs
-yaz_ztest_LDADD = ../lib/libyaz.la
+@ISTHR_TRUE@extra = ../lib/libyazthread.la
+yaz_ztest_LDADD = $(extra) ../lib/libyaz.la $(LIBTHREAD)
INCLUDES = -I$(srcdir)/../include
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
yaz_ztest_OBJECTS = ztest.o read-grs.o
-yaz_ztest_DEPENDENCIES = ../lib/libyaz.la
+@ISTHR_TRUE@yaz_ztest_DEPENDENCIES = ../lib/libyazthread.la \
+@ISTHR_TRUE@../lib/libyaz.la
+@ISTHR_FALSE@yaz_ztest_DEPENDENCIES = ../lib/libyaz.la
yaz_ztest_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
* Chas Woodfield, Fretwell Downing Datasystems.
*
* $Log: ztest.c,v $
- * Revision 1.34 2000-09-04 08:58:15 adam
+ * Revision 1.35 2000-11-23 10:58:33 adam
+ * SSL comstack support. Separate POSIX thread support library.
+ *
+ * Revision 1.34 2000/09/04 08:58:15 adam
* Added prefix yaz_ for most logging utility functions.
*
* Revision 1.33 2000/08/10 08:41:26 adam
r->output_format = r->request_format;
if (r->request_format == VAL_SUTRS)
{
+#if 0
+/* this section returns a huge record (for testing non-blocking write, etc) */
+ r->len = 980000;
+ r->record = odr_malloc (r->stream, r->len);
+ memset (r->record, 'x', r->len);
+#else
+/* this section returns a small record */
char buf[100];
sprintf(buf, "This is dummy SUTRS record number %d\n", r->number);
+
r->len = strlen(buf);
r->record = (char *) odr_malloc (r->stream, r->len+1);
strcpy(r->record, buf);
+#endif
}
else if (r->request_format == VAL_GRS1)
{
ILLLIB = @ILLLIB@
ILLMODULE = @ILLMODULE@
LD = @LD@
+LIBTHREAD = @LIBTHREAD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@