Commit 28b3433a authored by Per Cederqvist's avatar Per Cederqvist

Initial revision

parent d58bbce4
.\" Copyright (c) 1991-1992 Peter Eriksson and Per Cederqvist of the
.\" Lysator Academic Computer Association
.\" All rights reserved
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement: ``This product includes software developed by
.\" Peter Eriksson and Per Cederqvist of Lysator in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of Lysator nor the names of its contributors may
.\" 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
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" @(#)isc.3x 1.0 (Lysator) 2/3/92
.\"
.TH ISC 3X "February 3, 1992" "Release 1.0" "ISC LIBRARY"
.SH NAME
isc_initialize, isc_shutdown, isc_listentcp, isc_unlisten,
isc_opentcp, isc_openfile, isc_openfd, isc_close,
isc_enable, isc_disable,
isc_sessions, isc_getnextevent, isc_dispose,
isc_flush, isc_write, isc_putc, isc_printf,
isc_allocmsg, isc_reallocmsg, isc_freemsg, isc_mkstrmsg,
isc_setmaxmsgsize, isc_setallocfn, isc_setlogfn,
isc_setabortfn \- server-client subroutines
.SH SYNOPSIS
.LP
.B "#include <isc.h>"
.LP
.nf
.B IscMaster *
.B " isc_initialize (IscConfig *cfg)"
.PP
.B void
.B " isc_shutdown(IscMaster *mcb)"
.PP
.B int
.B " isc_listentcp(IscMaster *mcb, const char *service);"
.PP
.B void
.B " isc_unlisten(IscMaster *mcb, int listen_return_val);"
.PP
.B "IscSession *"
.B " isc_opentcp(IscMaster *mcb, const char *host, const char *service)"
.PP
.B "IscSession *"
.B " isc_openfile(IscMaster *mcb, const char *path, int mode)"
.PP
.B "IscSession *"
.B " isc_openfd(IscMaster *mcb, int fd)"
.PP
.B "void"
.B " isc_close (IscSession *scb)"
.PP
.B "int"
.B " isc_sessions (IscMaster *mcb)"
.PP
.B "IscEvent *"
.B " isc_getnextevent (IscMaster *mcb, long timeout)"
.PP
.B "void"
.B " isc_dispose (IscEvent *ecb)"
.PP
.B "void"
.B " isc_flush (IscSession *scb)"
.PP
.B "int"
.B " isc_write (IscSession *scb, const void *buf, size_t len)"
.PP
.B "int"
.B " isc_printf (IscSession *scb, const char *format, ...)"
.PP
.B "int"
.B " isc_putc (int chr, IscSession *scb)"
.PP
.B "IscMessage *"
.B " isc_allocmsg(size_t size);"
.PP
.B "IscMessage *"
.B " isc_reallocmsg(IscMessage *msg, size_t size);"
.PP
.B "void"
.B " isc_freemsg(IscMessage *msg);"
.PP
.B "IscMessage *"
.B " isc_mkstrmsg(const char *str);"
.PP
.B "void"
.B " isc_setmaxmsgsize (IscMaster *mcb, size_t size)"
.PP
.B "void"
.B " isc_setlogfn (void (*logfnp)(const char *fmt, va_list AP))"
.PP
.B "void"
.B " isc_setallocfn (void * (*mallocfn)(size_t size),"
.B " void * (*reallocfn)(void *buf, size_t size),"
.B " void (*freefn)(void *buf))"
.PP
.B "void"
.B " isc_setabortfn (void (*abortfn)(const char *msg))"
.SH TYPES
.nf
.B "typedef struct"
.B "{"
.B " int version; /* Current version is 2 */"
.B " struct"
.B " {"
.B " int msgsize; /* -1 = use defaults */"
.B " int queuedsize; /* -1 = use defaults */"
.B " int dequeuelen; /* -1 = use defaults */"
.B " } max;"
.B " struct"
.B " {"
.B " unsigned inhibit_dns_lookup : 1; /* Do not map IP number -> name */"
.B " unsigned late_connect : 1; /* Do non-blocking connect()s */"
.B " }"
.B "}"
.PP
.B typedef enum
.B {
.B " ISC_EVENT_ERROR,"
.B " ISC_EVENT_TIMEOUT,"
.B " ISC_EVENT_LOGIN,"
.B " ISC_EVENT_LOGOUT,"
.B " ISC_EVENT_MESSAGE,"
.B "} IscEventType;"
.PP
.B typedef enum
.B {
.B " ISC_TYPE_UNKNOWN,"
.B " ISC_TYPE_TCP,"
.B " ISC_TYPE_FILE"
.B "} IscSessionType;"
.PP
.B "typedef enum"
.B "{"
.B " ISC_STATE_UNKNOWN,"
.B " ISC_STATE_CONNECTING,"
.B " ISC_STATE_RUNNING,"
.B " ISC_STATE_DISABLED,"
.B " ISC_STATE_CLOSING"
.B "} IscSessionState;"
.PP
.B typedef struct isc_msg
.B {
.B " int size;"
.B " int length;"
.B " char *buffer;"
.B } IscMessage;
.PP
.B typedef struct isc_mcb
.B {
.B " int port;"
.B " int fd;"
.B " int maxmsgsize;"
.B " int maxqueuedsize;"
.B " int maxdequeuelen;"
.B " struct isc_scb *sessions;"
.B } IscMaster;
.PP
.B typedef struct isc_scb
.B {
.B " struct isc_scb * prev;"
.B " struct isc_scb * next;"
.B " IscMaster * mcb;"
.B " IscSessionType type;"
.B " IscSessionState state;"
.B " int fd;
.B " IscMsgQueue * rd_msg_q;"
.B " IscMsgQueue * wr_msg_q;"
.B " char sendbuf[2048];"
.B " int sendindex;"
.B " union"
.B " {"
.B " struct"
.B " {"
.B " char * hostname;"
.B " int rport;"
.B " int lport;"
.B " } tcp;"
.B " struct"
.B " {"
.B " char * pathname;"
.B " int openmode;"
.B " } file;"
.B " } info;"
.B " time_t logintime;"
.B " time_t idlesince;"
.B " struct"
.B " {"
.B " struct"
.B " {"
.B " long bytes;"
.B " long packets;"
.B " } rx, tx;"
.B " } stats;"
.B ""
.B " ISC_UDGTYPE * udg; /* Reserved for user defined usage */"
.B "} IscSession;"
.PP
.B typedef struct isc_ecb
.B {
.B " IscEventType event;"
.B " IscSession * session;"
.B " IscMessage * msg;"
.B } IscEvent;
.SH DESCRIPTION
These functions implement an interface to the TCP/IP streams facitiliy.
The functions are obtained with the loader option
.BR \-lisc .
(More to come here...)
.PP
.SH DIAGNOSTICS
(And here... :\-)
.PP
.SH BUGS
Hehe... I'm sure they exists...
.SH GUILTY
Peter Eriksson <pen@lysator.liu.se> &
Per Cederqvist <ceder@lysator.liu.se>
ISC is Copyright (c) 1991 Lysator Computer Club, Linkoping University, Sweden,
in cooperation with the International Syndicate of Computation.
All rights reserved.
.\" @(#)isc_initialize.3x 1.0 92/02/13 Lysator
.\" Copyright (c) 1992 Peter Eriksson and Per Cederqvist of Lysator
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement: ``This product includes software developed by
.\" Peter Eriksson and Per Cederqvist of Lysator'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of Lysator nor the names of its contributors may
.\" 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
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.TH ISC_INITIALIZE 3X "13 February 1992" "Release 1.0" "ISC LIBRARY"
.SH NAME
isc_initialize \- create a master control structure
.SH SYNOPSIS
.nf
.ft B
#include <isc.h>
.ft
.fi
.LP
.nf
.ft B
IscMaster *isc_initialize(cfg)
IscConfig *cfg;
.ft R
.fi
.SH DESCRIPTION
This function initializes an ISC master structure to be ready
to handle sessions. It returns a pointer to a master structure
that can be used as the argument in subsequent calls to functions
that create new sessions to associate a session with a master
control structure. It is also used when closing down a master
structure or removing sessions from a master structure.
.SH ARGUMENTS
The
.I cfg
argument can either be a
.SM NULL
pointer to force a set of system defaults
or point to a structure that should contain various default
values to be used by the system. The structure is defined in
.BR <isc.h>
and includes the following members:
.br
.ne 6
.LP
.RS
.nf
.ft B
.ta +\w'IscSessionConfig\0'u+\w'session;\0'u
int version;
IscSessionConfig session;
.ft R
.fi
.DT
.RE
.LP
Here
.B version
should be assigned the current configuration structure
version number that for this version is
.SM 1004.
The
.B IscSessionConfig
structure is also defined in the same file and has the
following members:
.br
.ne 6
.LP
.RS
.nf
.ft B
.ta +\w'struct\0'u+\w'unsigned\0'u+\w'no_host2ip_lookup;\0'u
struct
{
int msgsize;
int queuedsize;
int dequeuelen;
int openretries;
int backlog;
} max;
.ft R
.fi
.DT
.RE
.LP
Here
.B msgsize
specifies the maximum number of characters that will be
read or written to the underlying file descriptor in
any one call. (Ie, the maximum packet size.)
.LP
The
.B queuedsize
member specifies the maximum number of packets to queue before
closing down the session. This is used both for incoming
and outgoing packets.
.LP
The
.B dequeuelen
member specifies the maximum number of packets to transmit
at any one time. This is so a session with many queued packets
wont use up all server resources.
.LP
The
.B openretries
member specifies the maximum number of retries that will be made
when binding and/or connecting a session to a service.
.LP
The
.B backlog
member specifies the maximum number of concurrent outstanding TCP/IP
connections as specified by the
.BR listen(2)
system call.
It is possible to assign these members the value
.SM -1
to get the system default value.
.SH RETURN VALUES
The returned value is a pointer to a master control structure,
or NULL if an error occurs.
.SH ERRORS
.TP 10
.SM EINVAL
.I cfg
is an invalid configuration struct
.SH SEE ALSO
.BR isc (3x)
.\" @(#)isc_opentcp.3x 1.0 92/02/03 Lysator
.\" Copyright (c) 1992 Peter Eriksson and Per Cederqvist of Lysator
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement: ``This product includes software developed by
.\" Peter Eriksson and Per Cederqvist of Lysator'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of Lysator nor the names of its contributors may
.\" 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
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.TH ISC_OPENTCP 3X "3 February 1992" "Release 1.0" "ISC LIBRARY"
.SH NAME
isc_opentcp \- open a TCP/IP connection and associate it with an ISC session
.SH SYNOPSIS
.nf
.ft B
#include <isc.h>
.ft
.fi
.LP
.nf
.ft B
IscSession *isc_opentcp(IscMaster *mcb,
const char *host,
const char *service)
.ft R
.fi
.SH DESCRIPTION
.IX "isc_opentcp()" "" "\fLisc_opentcp()\fP function"
.LP
.B isc_opentcp(\|)
opens a new TCP/IP connection to a remote service. The session is
inserted into the master control structure specified.
.LP
The
.I mcb
argument must point to a previously allocated master structure as
returned by the
.B isc_initialize(\|)
function call.
.LP
The
.I host
argument can either be NULL for a local connection or a null terminated
string containing either a domain name or an IP number in decimal notation.
.LP
The
.I service
argument is a null termnated string containing either a port number or a
service name as specified by the
.BR /etc/services
file.
.SH RETURN VALUES
.LP
.B isc_opentcp(\|)
returns a non-\s-1NULL\s0 pointer to a
session value suitable for use with subsequent
.SM ISC
functions calls.
On failure, it returns
.SM NULL and
no memory is allocated and no connection is initiated.
.br
.ne 6
.SH FILES
.PD 0
.TP 20
.B /etc/services
.TP
.B /etc/hosts
.PD
.SH "SEE ALSO"
.BR isc (3x)
.BR isc_initialize (3x)
.BR isc_shutdown (3x)
.BR isc_listentcp (3x)
.BR isc_unlisten (3x)
.BR isc_openfile (3x)
.BR isc_openfd (3x)
.BR isc_close (3x)
.BR isc_enable (3x)
.BR isc_disable (3x)
.BR isc_sessions (3x)
.BR isc_getnextevent (3x)
.BR isc_dispose (3x)
.BR isc_flush (3x)
.BR isc_write (3x)
.BR isc_putc (3x)
.BR isc_printf (3x)
.\" @(#)isc_shutdown.3x 1.0 92/02/13 Lysator
.\" Copyright (c) 1992 Peter Eriksson and Per Cederqvist of Lysator
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement: ``This product includes software developed by
.\" Peter Eriksson and Per Cederqvist of Lysator'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of Lysator nor the names of its contributors may
.\" 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
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.TH ISC_SHUTDOWN 3X "13 February 1992" "Release 1.0" "ISC LIBRARY"
.SH NAME
isc_shutdown \- close down an ISC master control structure
.SH SYNOPSIS
.nf
.ft B
#include <isc.h>
.ft
.fi
.LP
.nf
.ft B
void isc_shutdown(mcb)
IscMaster *mcb;
.ft R
.fi
.SH DESCRIPTION
.IX "isc_shutdown()" "" "\fLisc_shutdown()\fP function"
.LP
.B isc_shutdown(\|)
closes all active sessions in the master control structure and
frees all memory allocated by session under control by that
master structure. The sessions are also closed on call to
.BR exit(2v).
.SH RETURN VALUES
.LP
.B isc_shutdown (\|)
has no return value.
.br
.ne 6
.SH SEE ALSO
.BR isc (3x)
.BR exit (2v)
.\" @(#)isc_unlisten.3x 1.0 92/02/03 Lysator
.\" Copyright (c) 1992 Peter Eriksson and Per Cederqvist of Lysator
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement: ``This product includes software developed by
.\" Peter Eriksson and Per Cederqvist of Lysator'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of Lysator nor the names of its contributors may
.\" 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
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.TH ISC_UNLISTEN 3X "3 February 1992" "Release 1.0" "ISC LIBRARY"
.SH NAME
isc_unlisten \- remove a listening port from an ISC master structure
.SH SYNOPSIS
.nf
.ft B
#include <isc.h>
.ft
.fi
.LP
.nf
.ft B
int isc_unlisten(IscMaster *mcb, int index)
.ft R
.fi
.SH DESCRIPTION
.IX "isc_unlisten()" "" "\fLisc_unlisten()\fP function"
.LP
.B isc_unlisten(\|)
is used to remove listening port from the specified
master control structure and close the associated file descriptor.
.LP
The
.I mcb
argument must point to a previously allocated master structure as
returned by the
.I isc_initialize(\|)
function call.
.LP
The
.I index
argument must be a value previously returned from the
.B isc_listentcp(\|)
function call.
.SH RETURN VALUES
.LP
.B isc_unlisten(\|) returns 0 on success. On failure it
returns \-1 and sets
.B errno
to indicate the error.
.br
.ne 6
.SH "SEE ALSO"
.BR isc (3x)
.BR isc_initialize (3x)
.BR isc_shutdown (3x)
.BR isc_listentcp (3x)
.BR isc_opentcp (3x)
.BR isc_openfile (3x)
.BR isc_openfd (3x)
.BR isc_close (3x)
.BR isc_enable (3x)
.BR isc_disable (3x)
.BR isc_sessions (3x)
.BR isc_getnextevent (3x)
.BR isc_dispose (3x)
.BR isc_flush (3x)
.BR isc_write (3x)
.BR isc_putc (3x)
.BR isc_printf (3x)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment