Commit 070a325c authored by Per Cederqvist's avatar Per Cederqvist

Merged in isc 0.99.

parent 08811b20
Makefile
dependencies
Makefile.in
aclocal.m4
config.cache
config.log
config.status
configure
isc-*
1998-07-06 Per Cederqvist <ceder@lysator.liu.se>
* Version 0.99 released.
Release preparations.
* NEWS: Updated.
* README: Updated.
......
#!/bin/sh -
#
# Copyright (c) 1987 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# distribution and use acknowledge that the software was developed
# by the University of California, Berkeley. The name of the
# University may not be used to endorse or promote products derived
# from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#)mkdep.sh 5.12 (Berkeley) 6/30/88
#
PATH=/bin:/usr/bin:/usr/ucb
export PATH
SED=""
MAKE=Makefile # default makefile name is "Makefile"
while :
do case "$1" in
# -f allows you to select a makefile name
-f)
MAKE=$2
shift; shift ;;
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
SED='s;\.o;;'
shift ;;
*)
break ;;
esac
done
if [ $# = 0 ] ; then
echo 'usage: gmkdep [-p] [-f makefile] [flags] file ...'
exit 1
fi
if [ ! -w $MAKE ]; then
echo "gmkdep: no writeable file \"$MAKE\""
exit 1
fi
TMP=/tmp/mkdep$$
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
cp $MAKE ${MAKE}.bak
sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
cat << _EOF_ >> $TMP
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
_EOF_
# If your compiler doesn't have -M, add it. If you can't, the next two
# lines will try and replace the "cc -M". The real problem is that this
# hack can't deal with anything that requires a search path, and doesn't
# even try for anything using bracket (<>) syntax.
#
# egrep '^#include[ ]*".*"' /dev/null $* |
# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
/usr/gnu/bin/gcc -M $* |
sed "
s; \./; ;g
$SED" |
awk '{
if ($1 != prev) {
if (rec != "")
print rec;
rec = $0;
prev = $1;
}
else {
if (length(rec $2) > 78) {
print rec;
rec = $0;
}
else
rec = rec " " $2
}
}
END {
print rec
}' >> $TMP
cat << _EOF_ >> $TMP
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
_EOF_
# copy to preserve permissions
cp $TMP $MAKE
rm -f ${MAKE}.bak $TMP
exit 0
#ifndef _STDDEF_H
#define _STDDEF_H
/* Signed type of difference of two pointers. */
#if defined(__GNUC__) && defined(__sparc__)
# if !defined(__sys_stdtypes_h)
# include <sys/stdtypes.h>
# endif
# define size_t _sys_size_t
# define ptrdiff_t _sys_ptrdiff_t
#endif
#ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */
#ifndef _T_PTRDIFF
#ifndef __PTRDIFF_T
#ifndef _PTRDIFF_T_
#ifndef ___int_ptrdiff_t_h
#define _PTRDIFF_T
#define _T_PTRDIFF
#define __PTRDIFF_T
#define _PTRDIFF_T_
#define ___int_ptrdiff_t_h
typedef long ptrdiff_t;
#endif /* ___int_ptrdiff_t_h */
#endif /* _PTRDIFF_T_ */
#endif /* __PTRDIFF_T */
#endif /* _T_PTRDIFF */
#endif /* _PTRDIFF_T */
/* Unsigned type of `sizeof' something. */
#ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
#ifndef _T_SIZE
#ifndef __SIZE_T
#ifndef _SIZE_T_
#ifndef ___int_size_t_h
#define _SIZE_T
#define _T_SIZE
#define __SIZE_T
#define _SIZE_T_
#define ___int_size_t_h
typedef unsigned long size_t;
#endif /* ___int_size_t_h */
#endif /* _SIZE_T_ */
#endif /* __SIZE_T */
#endif /* _T_SIZE */
#endif /* _SIZE_T */
/* A null pointer constant. */
#undef NULL /* in case <stdio.h> has defined it. */
#define NULL ((void *)0)
/* Offset of member MEMBER in a struct of type TYPE. */
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif /* _STDDEF_H */
INCDIRS=-I$(HOME)/include
LIBDIRS=-L$(HOME)/lib
SOURCES=tcp.c udp.c
CFLAGS= -g $(LIBDIRS) $(INCDIRS)
CC=gcc
tcp: tcp.c $(HOME)/include/isc.h $(HOME)/lib/libisc.a
gcc $(CFLAGS) -o tcp tcp.c -lisc -lansi
udp: udp.c $(HOME)/include/isc.h $(HOME)/lib/libisc.a
gcc $(CFLAGS) -o udp udp.c -lisc -lansi
clean:
rm -f *~ *.o a.out core tcp udp \#*\#
depend:
gmkdep $(INCDIRS) $(SOURCES)
# DO NOT DELETE THIS LINE -- mkdep uses it.
......@@ -2,7 +2,7 @@
** libmux.c A set of functions to implement a multiplexing
** protocol above the ISC library
**
** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
......
......@@ -2,7 +2,7 @@
** mux.h A set of functions to implement a multiplexing
** protocol above the ISC library
**
** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
......
#
# Makefile - for Manual pages
#
INSTROOT=/usr/local
MANROOT=$(INSTROOT)/man
MANSECT=man3
MANDIR=$(MANROOT)/$(MANSECT)
#
FILES= isc.3x isc_initialize.3x isc_shutdown.3x isc_openfd.3x \
isc_openfile.3x isc_opentcp.3x isc_close.3x isc_listentcp.3x \
isc_unlisten.3x
#
install:
cp $(FILES) $(MANDIR)
clean:
rm -f *~ \#*\#
all:
@echo "Nothing done."
.deps
Makefile
dependencies
isc-new.h
Makefile.in
Tue Aug 12 21:13:17 1997 Per Cederqvist <ceder@lysator.liu.se>
Port to NetBSD1.1/SPARC (patch from teddy@fukt.hk-r.se).
* isc_event.c: Include unistd.h (needed because of select) and
string.h (needed because of bzero).
Fri Jun 6 23:38:12 1997 Per Cederqvist <ceder@lysator.liu.se>
Port to AIX.
* isc_tcp.c: Don't declare sleep.
* isc_session.c: Don't declare read or write.
Sun Aug 4 03:24:47 1996 Per Cederqvist <ceder@lysator.liu.se>
* isc_event.c: Don't declare bzero.
Sat Aug 3 17:54:41 1996 Per Cederqvist <ceder@lysator.liu.se>
* isc_socket.c: Don't declare bzero.
* isc_event.c: Include <sys/select.h> if HAVE_SYS_SELECT_H.
Mon Jul 29 01:28:25 1996 Per Cederqvist <ceder@lysator.liu.se>
* isc.h (isc_printf): Tell GCC that the second argument is a
printf-style format string if HAVE_ATTRIBUTE_FORMAT_PRINTF is set.
Fri Sep 1 20:46:55 1995 Per Cederqvist (ceder@lysator.liu.se)
* isc_socket.c (isc_gethostname): Return NULL if given a NULL
IscAddress.
* isc_tcp.c (isc_createtcp): Fixed calls to setsockopt with
SO_LINGER and SO_REUSEADDR arguments. The old-style style
previously used should no longer be necessary on modern operating
systems, and in fact it no longer works everywere.
(isc_listentcp): Clear errno on each loop in the retry loop.
Sun Mar 6 20:46:04 1994 Per Cederqvist (ceder@lysator.liu.se)
* isc_output.c: Include sys/types.h.
Sat Mar 5 18:23:22 1994 Per Cederqvist (ceder@lysator.liu.se)
* Makefile.src: New file.
Mon Oct 18 13:20:39 1993 Per Cederqvist (ceder@lysator.liu.se)
* isc.h: Don't include any include files.
Sat Oct 16 17:47:44 1993 Per Cederqvist (ceder@lysator.liu.se)
* isc.h: Test HAVE_STDARG_H.
(isc_printf, isc_vprintf): Don't declare unless HAVE_STDARG_H.
* isc_stdout.c (isc_printf, isc_vprintf): Don't define unles
HAVE_STDARG_H.
Wed Oct 13 00:51:03 1993 Per Cederqvist (ceder@lysator.liu.se)
* printf.c (UCB_printf): Renamed _printf to UCB_printf (to avoid
conflicts on HPUX).
* isc_stdout.c (isc_printf): Update call to UCB_printf.
* isc_socket.c, isc_tcp.c, isc_udp.c: Dont include <sys/socket.h>
(included from "isc.h").
Sun Oct 10 17:00:49 1993 Per Cederqvist (ceder@lysator.liu.se)
* isc_alloc.c (calloc): don't declare (clashed with SunOS 5.2).
* isc_tcp.c (isc_createtcp): Don't try to set SO_DONTLINGER if
SO_DONTLINGER is undefined.
* isc_udp.c (isc_createudp): Likewise.
* Use O_NONBLOCK instead of FNDELAY if FNDELAY is undefined:
* isc_sesscion.c (isc_openfd): Do it.
* isc_tcp.c (isc_createtcp): Do it.
* isc_udp.c (isc_createudp): Do it.
* Don't declare the following functions, since they conflicts with
system include files on at least one version of Linux:
* isc_session.c, isc_tcp.c, isc_udp.c (memset): don't declare.
* isc_socket.c, isc_stdout.c, isc_tcp.c, isc_udp.c (memcpy): don't
declare.
* isc_tcp.c, isc_udp.c (setsockopt): don't declare.
* isc_tcp.c, isc_udp.c (atoi): don't declare.
* isc_udp.c (recvfrom, sendto): don't declare.
* printf.c (memchr): don't declare.
Fri Sep 24 16:16:36 1993 Per Cederqvist (ceder@lysator.liu.se)
* isc_event.c (isc_getnextevent): event->session was sometimes set
erronously if an error occured in select() or if a timeout occured.
Sun Jan 17 02:56:47 1993 Per Cederqvist (ceder@konrad)
* isc_session.c (isc_remove): Fix memory leak: Free the list-head.
* isc_tcp.c (isc_tcp_destroy_fn): Fix another memory leak: Pop any
remaining handlers.
Sun May 31 01:49:22 1992 Per Cederqvist (ceder@lysator)
* isc_master (isc_initialize): Allocate the master control block
with the allocator that is passed in IscConfig (if any).
#
# Makefile for libisc
#
# Copyright (c) 1992, 1993, 1994 Peter Eriksson and Per Cederqvist of the
# Lysator Academic Computer Association.
#
#
#
#
LK_STD
LK_STD_LIB([libisc-new$(PROFILE-LIB-SUFFIX).a],
[isc_event.o isc_session.o isc_abort.o isc_alloc.o isc_master.o\
isc_output.o isc_queue.o isc_message.o isc_handler.o\
isc_stdout.o isc_socket.o isc_tcp.o isc_udp.o printf.o])
LK_INSTALL_BUILT_HDRS(isc-new.h)
LK_ALL_C_DEPEND
LK_DESCEND
[tags:
etags -t *.[hc]]
[isc-new.h: isc.h
cp $(srcdir)/isc.h isc-new.h]
/*
** intern.h Definitions and prototypes used internally
**
** Copyright (c) 1991, 1992 Peter Eriksson and Per Cederqvist of the
** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
......
/*
** isc.h structures and defines used in a ISC server
**
** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
......@@ -143,6 +143,7 @@ typedef enum
ISC_STATE_RUNNING,
ISC_STATE_DISABLED,
ISC_STATE_CLOSING,
ISC_STATE_CLOSING2, /* An ISC_EVENT_LOGOUT has been generated. */
ISC_STATE_LISTENING
} IscSessionState;
......@@ -359,6 +360,7 @@ IscEvent
IscEventType event;
IscSession * session;
IscMessage * msg;
IscSession * listen_session;
};
......@@ -457,6 +459,12 @@ isc_getnextevent(IscMaster * mcb,
/*
** Wait for pending connections.
*/
IscEvent *
isc_wait(IscMaster *mcb, long timeout);
/*
** This should be used to discard an event when it has been processed.
*/
......@@ -505,27 +513,25 @@ isc_putc(int chr,
#ifdef ISC_PRINTF_SUPPORT
# ifndef HAVE_STDARG_H
# error isc_printf is not available on systems that lack stdarg.h.
# else
/*
** Put a formatted string on the transmit queue. Not available unless
** your system supports <stdarg.h>. Avoid these functions. They are
** likely to disappear in future versions of ISC.
** Put a formatted string on the transmit queue
*/
#ifdef HAVE_STDARG_H
extern int
isc_printf(IscSession * scb,
const char * format,
...)
# if HAVE_ATTRIBUTE_FORMAT_PRINTF
__attribute__ ((format (printf, 2, 3)))
# endif
;
#endif
...);
#ifdef HAVE_STDARG_H
extern int
isc_vprintf(IscSession * scb,
const char * format,
va_list AP);
# endif
#endif
......
/*
** isc_abort.c Route to handle fatal errors
**
** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
......@@ -10,7 +10,7 @@
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
# include <stdlib.h>
#endif
#ifdef HAVE_STDDEF_H
# include <stddef.h>
......
/*
** isc_alloc.c ISC storage allocation routines
**
** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
......@@ -38,16 +38,6 @@
#define ISC_MAGIC_FREE 0xEE47A37F
/*
** External declarations
*/
#if defined(__sun__) && !defined(__stdlib_h)
extern void *malloc(size_t);
/*extern void *calloc(int, size_t);*/
extern void *realloc(void *, size_t);
extern void free(void *);
#endif
/*
** Pointers to functions to handle storage allocation
*/
......@@ -74,14 +64,14 @@ isc_setallocfn(void * (*mallocfn)(size_t size),
void *
isc_malloc(size_t size)
{
unsigned int * buf;
unsigned long * buf;
if (isc_mallocfn)
buf = (unsigned int *) (*isc_mallocfn)(size + sizeof(unsigned int));
buf = (unsigned long *) (*isc_mallocfn)(size + sizeof(unsigned long));
else
{
buf = (unsigned int *) malloc(size + sizeof(unsigned int));
buf = (unsigned long *) malloc(size + sizeof(unsigned long));
if (!buf)
isc_abort("isc_malloc");
}
......@@ -95,33 +85,24 @@ isc_malloc(size_t size)
void *
isc_realloc(void *oldbuf, size_t size)
{
unsigned int *buf;
unsigned long *buf;
if (!oldbuf)
return isc_malloc(size);
buf = (unsigned int *) oldbuf;
switch (*--buf)
{
case ISC_MAGIC_ALLOC:
break;
case ISC_MAGIC_FREE:
isc_abort("isc_realloc");
default:
isc_abort("isc_realloc");
}
buf = (unsigned long *) oldbuf;
if (*--buf != ISC_MAGIC_ALLOC)
isc_abort("isc_realloc");
*buf = ISC_MAGIC_FREE;
if (isc_reallocfn)
buf = (unsigned int *) (*isc_reallocfn)((void *) buf,
size + sizeof(unsigned int));
buf = (unsigned long *) (*isc_reallocfn)((void *) buf,
size + sizeof(unsigned long));
else
{
buf = (void *) realloc((void *) buf, size + sizeof(unsigned int));
buf = (void *) realloc((void *) buf, size + sizeof(unsigned long));
if (!buf)
isc_abort("isc_realloc");
}
......@@ -135,24 +116,15 @@ isc_realloc(void *oldbuf, size_t size)
void
isc_free(void *buf)
{
unsigned int *ibuf;
unsigned long *ibuf;
if (!buf)
isc_abort("isc_free");
ibuf = (unsigned int *) buf;
switch (*--ibuf)
{
case ISC_MAGIC_ALLOC:
break;
case ISC_MAGIC_FREE:
isc_abort("isc_free");
default:
isc_abort("isc_free");
}
ibuf = (unsigned long *) buf;
if (*--ibuf != ISC_MAGIC_ALLOC)
isc_abort("isc_free");
*ibuf = ISC_MAGIC_FREE;
......
/*
** isc_event.c definitions of ISC subsystem routines
**
** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
** Lysator Academic Computer Association.
**
** history:
......@@ -18,7 +18,9 @@
#ifdef HAVE_STDARG_H
# include <stdarg.h>
#endif
#include <time.h>
#ifdef TIME_WITH_SYS_TIME
# include <time.h>
#endif
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
......@@ -30,10 +32,10 @@
# include <sys/select.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
# include <unistd.h> /* Needed on NetBSD1.1/SPARC due to select */
#endif
#ifdef HAVE_STRING_H
# include <string.h>
# include <string.h> /* Needed on NetBSD1.1/SPARC due to bzero */
#endif
#include "isc.h"
......@@ -41,17 +43,6 @@
/*
* External function declarations.
*/
/*extern void *bzero(void *buf, unsigned length);*/
extern time_t time(time_t *buf);
/*extern int select(int setsize,
fd_set *rs, fd_set *rw, fd_set *es,
struct timeval *wait);*/
IscEvent *