diff options
author | Mark Eichin <eichin@mit.edu> | 1994-06-10 03:36:08 +0000 |
---|---|---|
committer | Mark Eichin <eichin@mit.edu> | 1994-06-10 03:36:08 +0000 |
commit | 90864cc89d4323e379b5cc2270865627cd7fc665 (patch) | |
tree | 5a5458b3967c32bb7ef50b968f240a63744e966a /src/isode/h | |
parent | 9f848ddada00ab926f70bd892b199f875404e26a (diff) | |
download | krb5-90864cc89d4323e379b5cc2270865627cd7fc665.tar.gz krb5-90864cc89d4323e379b5cc2270865627cd7fc665.tar.xz krb5-90864cc89d4323e379b5cc2270865627cd7fc665.zip |
autoconfed isode for kerberos work
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3697 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/isode/h')
37 files changed, 9799 insertions, 0 deletions
diff --git a/src/isode/h/Makefile.in b/src/isode/h/Makefile.in new file mode 100644 index 0000000000..610ce8ecf8 --- /dev/null +++ b/src/isode/h/Makefile.in @@ -0,0 +1,92 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE header files +############################################################################### +srcdir = @srcdir@ +VPATH = @srcdir@ + +BUILDTOP = ../../ +TOPDIR = $(BUILDTOP) + +OPTIONS = -I. -I$(HDIR) $(PEPYPATH) $(KRBOPT) +CFLAGS = $(OPTIONS) $(LOPTIONS) + +HDIR = $(TOPDIR)isode/h/ +UTILDIR = $(TOPDIR)isode/util/ +INCDIRM = $(HDIR) +INCDIR = $(INCDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +KRBINC = $(TOPDIR)include/ +ISODEINCM= $(KRBINC)isode +ISODEINC= $(ISODEINCM)/ + +LIBES = libcompat.a +LLIBS = +HFILES = $(HDIR)manifest.h $(HDIR)general.h $(HDIR)config.h +LN = ln + + +############################################################################### +# +# NOTICE +# +# Acquisition, use, and distribution of this module and related +# materials are subject to the restrictions of a license agreement. +# Consult the Preface in the User's Manual for the full terms of +# this agreement. +# +############################################################################### + + +HEADERS = config.h \ + sys.dirent.h usr.dirent.h \ + general.h manifest.h isoaddrs.h sys.file.h \ + internet.h x25.h tp4.h dgram.h \ + cmd_srch.h isoservent.h logger.h tailor.h \ + mpkt.h \ + tpkt.h tsap.h \ + spkt.h ssap.h \ + pepsy.h \ + ppkt.h psap2.h psap.h \ + acpkt.h acsap.h \ + rtpkt.h rtsap.h \ + ropkt.h rosap.h \ + ronot.h \ + rosy.h + +FHEADERS= fpkt.h ftam.h + + +################################################################## +# Here it is... +################################################################## + +all:; -mkdir $(ISODEINCM) + @for h in $(HEADERS); do cp $$h $(ISODEINC)/$$h; done + -@echo copied $(HEADERS) + +inst-all:; -mkdir $(INCDIRM) + @for h in $(HEADERS); do $(MAKE) TARGET=$$h inst-target; done + +inst-ftam:; @for h in $(FHEADERS); do $(MAKE) TARGET=$$h inst-target; done + +inst-target: $(INCDIR)$(TARGET) + +$(INCDIR)$(TARGET): $(TARGET) + -cp $@ z$(TARGET) + sed -e 's%#include "\([^/]*\)"%#include "$(INCDIR)\1"%' \ + < $(TARGET) | \ + sed -e 's%#include "/usr/include/\(.*\)"%#include <\1>%' > $@ + -@ls -gls $@ + -@echo "" + +install: inst-all clean + +lint:; + +clean:; rm -f z* _* + +grind:; tgrind -lc $(HEADERS) diff --git a/src/isode/h/acpkt.h b/src/isode/h/acpkt.h new file mode 100644 index 0000000000..35ff43b413 --- /dev/null +++ b/src/isode/h/acpkt.h @@ -0,0 +1,327 @@ +/* acpkt.h - include file for association control providers (AcS-PROVIDER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:28:59 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:23 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:37:41 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:41 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _AcSAP_ +#include "acsap.h" /* definitions for AcS-USERs */ +#endif + +#ifndef _PSAP2_ +#include "psap2.h" /* definitions for PS-USERs */ +#endif + +/* */ + +#ifdef ACSE + +#define AC_ASN "acse pci version 1" + +#if USE_BUILTIN_OIDS +#define AC_ASN_OID str2oid ("2.2.1.0.1") +#else +#define AC_ASN_OID ode2oid (AC_ASN) +#endif + +#define acsapPsig(acb, sd) \ +{ \ + if ((acb = findacblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return acsaplose (aci, ACS_PARAMETER, NULLCP, \ + "invalid association descriptor"); \ + } \ + if (!(acb -> acb_flags & ACB_CONN)) { \ + (void) sigiomask (smask); \ + return acsaplose (aci, ACS_OPERATION, NULLCP, \ + "assocation descriptor not connected"); \ + } \ + if (acb -> acb_flags & ACB_FINN) { \ + (void) sigiomask (smask); \ + return acsaplose (aci, ACS_OPERATION, NULLCP, \ + "association descriptor finishing"); \ + } \ + if (acb -> acb_flags & ACB_RELEASE) { \ + (void) sigiomask (smask); \ + return acsaplose (aci, ACS_OPERATION, NULLCP, \ + "release in progress"); \ + } \ +} + +#define acsapFsig(acb, sd) \ +{ \ + if ((acb = findacblk (sd)) == NULL) {\ + (void) sigiomask (smask);\ + return acsaplose (aci, ACS_PARAMETER, NULLCP, \ + "invalid association descriptor"); \ + } \ + if (!(acb -> acb_flags & ACB_CONN)) { \ + (void) sigiomask (smask); \ + return acsaplose (aci, ACS_OPERATION, NULLCP, \ + "assocation descriptor not connected"); \ + } \ + if (!(acb -> acb_flags & ACB_FINN)) { \ + (void) sigiomask (smask); \ + return acsaplose (aci, ACS_OPERATION, NULLCP, \ + "association descriptor not finishing"); \ + } \ + if (acb -> acb_flags & ACB_RELEASE) { \ + (void) sigiomask (smask); \ + return acsaplose (aci, ACS_OPERATION, NULLCP, \ + "release in progress"); \ + } \ +} + +#define toomuchP(b,n,m,p) \ +{ \ + if (b == NULL) \ + n = 0; \ + else \ + if (n > m) \ + return acsaplose (aci, ACS_PARAMETER, NULLCP, \ + "too many %s user data elements", p); \ +} + +#ifdef __STDC__ +#define missingP(p) \ +{ \ + if (p == NULL) \ + return acsaplose (aci, ACS_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", #p); \ +} +#else +#define missingP(p) \ +{ \ + if (p == NULL) \ + return acsaplose (aci, ACS_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", "p"); \ +} +#endif +#ifndef lint +#ifndef __STDC__ +#define copyAcSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ + bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ +} +#else +#define copyAcSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ + bcopy (base, d -> d##_data, d -> d##_cc); \ +} +#endif +#else +#define copyAcSAPdata(base,len,d) bcopy (base, (char *) d, len) +#endif + + +#define ACS_USER_BASE ACS_USER_NULL +#define ACS_PROV_BASE ACS_PROV_NULL + + +int acpktlose (), acsaplose (); + +/* */ + +int ps2acslose (); + +struct type_ACS_Association__information *info2apdu (); +int apdu2info (); +#endif + +/* */ + +struct assocblk { + struct assocblk *acb_forw; /* doubly-linked list */ + struct assocblk *acb_back; /* .. */ + + int acb_fd; /* session/presentation descriptor */ + + short acb_flags; /* our state */ +#define ACB_NULL 0x0000 +#define ACB_CONN 0x0001 /* connected */ +#define ACB_FINN 0x0002 /* other side wants to finish */ +#define ACB_INIT 0x0004 /* this side initiated the association */ +#define ACB_ASYN 0x0008 /* asynchronous */ +#define ACB_TURN 0x0010 /* we have the turn */ +#define ACB_TWA 0x0020 /* two-way alternate */ +#define ACB_ACT 0x0040 /* activity in progress */ +#define ACB_PLEASE 0x0080 /* RTS: RT-TURN-PLEASE received + ROS on Session: sent S-PLEASE-TOKENS */ +#define ACB_TIMER 0x0100 /* ACTIVITY discarded due to timing + constraint */ +#define ACB_ROS 0x0200 /* ROS started association */ +#define ACB_RTS 0x0400 /* RTS .. */ +#define ACB_ACS 0x0800 /* ACS .. */ +#define ACB_CLOSING 0x1000 /* waiting to close */ +#define ACB_FINISH 0x2000 /* .. */ +#define ACB_STICKY 0x4000 /* ROS using RTS (ugh!) */ +#define ACB_RELEASE 0x8000 /* release in progress */ + + struct SSAPref acb_connect; /* session connection reference */ + + int acb_requirements; /* session requirements */ + int acb_owned; /* session tokens we own */ + int acb_avail; /* session tokens available */ + int acb_settings; /* initial settings */ + int acb_ssdusize; /* largest atomic SSDU */ + + IFP acb_uabort; /* disconnect underlying service */ + +/* ACSE */ + int acb_sversion; /* session service version number */ + int acb_id; /* ACSE context id */ + OID acb_context; /* application context name */ + int acb_offset; /* offset to ACSE PCI */ + /* negative means at END */ + PE acb_retry; /* final acpkt */ + +/* RTSE */ + int acb_rtsid; /* RTSE context id */ + int acb_ckpoint; /* checkpoint size */ + int acb_window; /* window size */ + int acb_actno; /* sending activity serial number */ + long acb_ssn; /* highest serial number sent */ + int acb_ack; /* highest serial number acknowledged */ + + IFP acb_pturnrequest; /* RT-TURN-PLEASE.REQUEST */ + IFP acb_gturnrequest; /* RT-TURN-GIVE.REQUEST */ + IFP acb_transferequest; /* RT-TRANSER.REQUEST */ + IFP acb_rtwaitrequest; /* RT-WAIT.REQUEST */ + IFP acb_rtsetindications;/* define vectors for INDICATION events */ + IFP acb_rtselectmask; /* map association descriptors for select () */ + IFP acb_rtpktlose; /* protocol-level abort */ + + int acb_priority; /* priority of please turn */ + struct AcSAPfinish acb_finish; + + char *acb_realbase; /* APDU in transit */ + char *acb_base; /* .. */ + int acb_len; /* .. */ + + IFP acb_uptrans; /* upcall for up-transfer */ + IFP acb_downtrans; /* upcall for down-transfer */ + + IFP acb_rtsindication; /* rts event handler */ + +/* ROSE */ + int acb_rosid; /* ROSE (SASE) context id */ + IFP acb_putosdu; /* osdu2acb */ + IFP acb_rowaitrequest; /* RO-WAIT.REQUEST */ + IFP acb_ready; /* get HDX permission */ + IFP acb_rosetindications;/* define vectors for INDICATION events */ + IFP acb_roselectmask; /* map association descriptors for select () */ + IFP acb_ropktlose; /* protocol-level abort */ + PE (*acb_getosdu) (); /* for users of THORN... */ + + PE acb_apdu; /* APDU buffered */ + + IFP acb_rosindication; /* ros event handler */ +}; +#define NULLACB ((struct assocblk *) 0) + +#define FREEACB(acb) \ +{ \ + if ((acb) -> acb_realbase) \ + free ((acb) -> acb_realbase); \ + else \ + if ((acb) -> acb_base) \ + free ((acb) -> acb_base); \ + (acb) -> acb_realbase = (acb) -> acb_base = NULL, (acb) -> acb_len = 0; \ +} + + +int freeacblk (); +struct assocblk *newacblk (), *findacblk (); + +/* */ + +#ifndef ACSE + + /* PConnect Types */ +#define PCONN_DTS 0 /* Data Transfer Syntax */ +#define PCONN_DATA 1 /* User Data */ +#define PCONN_DATA_CK 0 /* Checkpoint Size */ +#define PCONN_CK_DFLT 0 +#define PCONN_DATA_WD 1 /* Window Size */ +#define PCONN_WD_DFLT 3 +#define PCONN_DATA_DM 2 /* Dialogue-mode */ +#define PCONN_DM_MONO 0 /* monologue */ +#define PCONN_DM_TWA 1 /* two-way alternate */ +#define PCONN_DM_DFLT PCONN_DM_MONO +#define PCONN_DATA_CN 3 /* Connection Data */ +#define PCONN_DATA_AP 4 /* Application Protocol */ +#define PCONN_AP_DFLT 1 + + + /* PAccept Types */ +#define PACC_DTS 0 /* Data Transfer Syntax */ +#define PACC_DATA 1 /* User Data */ +#define PACC_DATA_CK 0 /* Checkpoint Size */ +#define PACC_CK_DFLT 0 +#define PACC_DATA_WD 1 /* Window Size */ +#define PACC_WD_DFLT 3 +#define PACC_DATA_CN 2 /* Connection Data */ + + + /* PRefuse Types */ +#define PREF_REASON 0 /* Refuse Reason */ + + + /* Data Transfer Syntax Types */ +#define DTS_SYNTAX 0 /* IMPLICIT INTEGER */ +#define SYN_X409 0 /* x.409 */ + + + /* Connection Data Types */ +#define CN_OPEN 0 /* Open */ +#define CN_RECOVER 1 /* Recover */ + + + /* Refuse codes */ +#define REFUSE_BUSY 0 /* Busy */ +#define REFUSE_RECOVER 1 /* Cannot recover */ +#define REFUSE_VALIDATE 2 /* Validation failure */ +#define REFUSE_MODE 3 /* Unacceptable dialogue mode */ + + + /* Abort codes */ +#define ABORT_LSP 0 /* Local system problem */ +#define ABORT_INV 1 /* Invalid parameter */ +#define ABORT_ACT 2 /* Unrecognized activity */ +#define ABORT_TMP 3 /* Temporary problem */ +#define ABORT_PROTO 4 /* Protocol error */ +#define ABORT_PERM 5 /* Permanent problem */ +#define ABORT_USER 6 /* User abort */ +#define ABORT_TRANS 7 /* Transfer completed */ +#endif diff --git a/src/isode/h/acsap.h b/src/isode/h/acsap.h new file mode 100644 index 0000000000..7581af6f0b --- /dev/null +++ b/src/isode/h/acsap.h @@ -0,0 +1,273 @@ +/* acsap.h - include file for association control users (AcS-USER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:02 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:25 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:37:44 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:41 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _AcSAP_ +#define _AcSAP_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif + +#ifndef _PSAP2_ +#include "psap2.h" /* definitions for PS-USERs */ +#endif + +/* */ + +#define NACDATA 3 /* arbitrary */ + +struct AcSAPstart { /* A-CONNECT.INDICATION */ + int acs_sd; /* association descriptor */ + + OID acs_context; /* application context name */ + + AEInfo acs_callingtitle; /* info on calling application-entity */ + AEInfo acs_calledtitle; /* info on called application-entity */ + + struct PSAPstart acs_start; /* info from P-CONNECT.INDICATION */ + + /* initial information from peer */ + int acs_ninfo; /* number of elements */ + PE acs_info[NACDATA]; /* data */ +}; +#define ACSFREE(acs) { \ + register int ACSI; \ + \ + if ((acs) -> acs_context) \ + oid_free ((acs) -> acs_context), (acs) -> acs_context = NULLOID; \ + \ + AEIFREE (&(acs) -> acs_callingtitle); \ + AEIFREE (&(acs) -> acs_calledtitle); \ + \ + PSFREE (&(acs) -> acs_start); \ + \ + for (ACSI = (acs) -> acs_ninfo - 1; ACSI >= 0; ACSI--) \ + if ((acs) -> acs_info[ACSI]) \ + pe_free ((acs) -> acs_info[ACSI]), \ + (acs) -> acs_info[ACSI] = NULLPE; \ + (acs) -> acs_ninfo = 0; \ +} + + +struct AcSAPconnect { + int acc_sd; /* association descriptor */ + + int acc_result; /* result */ +#define ACS_ACCEPT 0 /* Accepted */ +#define ACS_REJECT (-1) /* Release rejected */ + /* Rejected by responder: */ +#define ACS_PERMANENT 1 /* Permanent */ +#define ACS_TRANSIENT 2 /* Transient */ + + int acc_diagnostic; /* source-diagnostic */ + /* service-user */ +#define ACS_USER_NULL 3 /* null */ +#define ACS_USER_NOREASON 4 /* no reason given */ +#define ACS_CONTEXT 5 /* application context name not supported*/ +#define ACS_CALLING_AP_TITLE 6 /* calling AP title not recognized */ +#define ACS_CALLING_AP_ID 7 /* calling AP invocation-ID not recognized */ +#define ACS_CALLING_AE_QUAL 8 /* calling AE qualifier not recognized */ +#define ACS_CALLING_AE_ID 9 /* calling AE invocation-ID not recognized */ +#define ACS_CALLED_AP_TITLE 10 /* called AP title not recognized */ +#define ACS_CALLED_AP_ID 11 /* called AP invocation-ID not recognized */ +#define ACS_CALLED_AE_QUAL 12 /* called AE qualifier not recognized */ +#define ACS_CALLED_AE_ID 13 /* called AE invocation-ID not recognized */ + /* service-provider */ +#define ACS_PROV_NULL 14 /* null */ +#define ACS_PROV_NOREASON 15 /* no reason given */ +#define ACS_VERSION 16 /* no common acse version */ + + /* begin UNOFFICIAL */ +#define ACS_ADDRESS 17 /* Address unknown */ +#define ACS_REFUSED 18 /* Connect request refused on this network + connection */ +#define ACS_CONGEST 19 /* Local limit exceeded */ +#define ACS_PRESENTATION 20 /* Presentation disconnect */ +#define ACS_PROTOCOL 21 /* Protocol error */ +#define ACS_ABORTED 22 /* Peer aborted association */ +#define ACS_PARAMETER 23 /* Invalid parameter */ +#define ACS_OPERATION 24 /* Invalid operation */ +#define ACS_TIMER 25 /* Timer expired */ + /* end UNOFFICIAL */ + +#define ACS_FATAL(r) ((r) < ACS_PARAMETER) +#define ACS_OFFICIAL(r) ((r) < ACS_ADDRESS) + + OID acc_context; /* application context name */ + + AEInfo acc_respondtitle; /* info on responding application-entity */ + + struct PSAPconnect acc_connect;/* info from P-CONNECT.CONFIRMATION */ + + /* initial information from peer */ + int acc_ninfo; /* number of elements */ + PE acc_info[NACDATA]; /* data */ +}; +#define ACCFREE(acc) { \ + register int ACCI; \ + \ + if ((acc) -> acc_context) \ + oid_free ((acc) -> acc_context), (acc) -> acc_context = NULLOID; \ + \ + AEIFREE (&(acc) -> acc_respondtitle); \ + \ + PCFREE (&(acc) -> acc_connect); \ + \ + for (ACCI = (acc) -> acc_ninfo - 1; ACCI >= 0; ACCI--) \ + if ((acc) -> acc_info[ACCI]) \ + pe_free ((acc) -> acc_info[ACCI]), \ + (acc) -> acc_info[ACCI] = NULLPE; \ + (acc) -> acc_ninfo = 0; \ +} + + + +struct AcSAPfinish { /* A-RELEASE.INDICATION */ + int acf_reason; /* reason for release */ +#define ACF_NORMAL 0 /* normal */ +#define ACF_URGENT 1 /* urgent */ +#define ACF_USERDEFINED 30 /* user-defined */ + + /* release information from peer */ + int acf_ninfo; /* number of elements */ + PE acf_info[NACDATA]; /* data */ +}; +#define ACFFREE(acf) \ +{ \ + register int ACFI; \ + \ + for (ACFI = (acf) -> acf_ninfo - 1; ACFI >= 0; ACFI--) \ + if ((acf) -> acf_info[ACFI]) \ + pe_free ((acf) -> acf_info[ACFI]), \ + (acf) -> acf_info[ACFI] = NULLPE; \ + (acf) -> acf_ninfo = 0; \ +} + + +struct AcSAPrelease { /* A-RELEASE.CONFIRMATION */ + int acr_affirmative; /* T = connection released + NIL = request refused */ + + int acr_reason; /* reason for result */ +#define ACR_NORMAL 0 /* normal */ +#define ACR_NOTFINISHED 1 /* not finished */ +#define ACR_USERDEFINED 30 /* user-defined */ + + /* release information from peer */ + int acr_ninfo; /* number of elements */ + PE acr_info[NACDATA]; /* data */ +}; +#define ACRFREE(acr) \ +{ \ + register int ACRI; \ + \ + for (ACRI = (acr) -> acr_ninfo - 1; ACRI >= 0; ACRI--) \ + if ((acr) -> acr_info[ACRI]) \ + pe_free ((acr) -> acr_info[ACRI]), \ + (acr) -> acr_info[ACRI] = NULLPE; \ + (acr) -> acr_ninfo = 0; \ +} + + +struct AcSAPabort { /* A-{U,P}-ABORT.INDICATION */ + int aca_source; /* abort source */ +#define ACA_USER 0 /* service-user */ +#define ACA_PROVIDER 1 /* service-provider */ +#define ACA_LOCAL 2 /* local ACPM (UNOFFICIAL) */ + + int aca_reason; /* same codes as acc_result */ + + /* abort information from peer */ + int aca_ninfo; /* number of elements */ + PE aca_info[NACDATA]; /* data */ + + /* diagnostics from provider */ +#define ACA_SIZE 512 + int aca_cc; /* length */ + char aca_data[ACA_SIZE]; /* data */ +}; +#define ACAFREE(aca) \ +{ \ + register int ACAI; \ + \ + for (ACAI = (aca) -> aca_ninfo - 1; ACAI >= 0; ACAI--) \ + if ((aca) -> aca_info[ACAI]) \ + pe_free ((aca) -> aca_info[ACAI]), \ + (aca) -> aca_info[ACAI] = NULLPE; \ + (aca) -> aca_ninfo = 0; \ +} + + +struct AcSAPindication { + int aci_type; /* the union element present */ +#define ACI_FINISH 0x00 +#define ACI_ABORT 0x01 + + union { + struct AcSAPfinish aci_un_finish; + struct AcSAPabort aci_un_abort; + } aci_un; +#define aci_finish aci_un.aci_un_finish +#define aci_abort aci_un.aci_un_abort +}; + +/* */ + +extern char *acsapversion; + + +int AcInit (); /* A-ASSOCIATE.INDICATION */ + +int AcAssocResponse (); /* A-ASSOCIATE.RESPONSE */ + /* A-ASSOCIATE.REQUEST + (backwards-compatible) */ +#define AcAssocRequest(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17) \ + AcAsynAssocRequest (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,0) +int AcAsynAssocRequest (); /* A-(ASYN-)ASSOCIATE.REQUEST */ +int AcAsynRetryRequest (); /* A-ASYN-RETRY.REQUEST (pseudo) */ +int AcRelRequest (); /* A-RELEASE.REQUEST */ +int AcRelRetryRequest (); /* A-RELEASE-RETRY.REQUEST (pseudo) */ +int AcRelResponse (); /* A-RELEASE.RESPONSE */ +int AcUAbortRequest (); /* A-ABORT.REQUEST */ + +int AcFINISHser (); /* handle P-RELEASE.INDICATION */ +int AcABORTser (); /* handle P-{U,P}-ABORT.INDICATION */ + +int AcFindPCI (); /* return PCI used by ACSE */ + +char *AcErrString (); /* return AcSAP error code in string form */ + +#endif diff --git a/src/isode/h/cmd_srch.h b/src/isode/h/cmd_srch.h new file mode 100644 index 0000000000..f028ed01bc --- /dev/null +++ b/src/isode/h/cmd_srch.h @@ -0,0 +1,51 @@ +/* cmd_srch.h - command search structure */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:04 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:27 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:37:46 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:42 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _CMD_SRCH_ +#define _CMD_SRCH_ + +typedef struct cmd_table { + char *cmd_key; + int cmd_value; +} CMD_TABLE; + + +struct cm_args { + char *cm_key; + char *cm_value; +}; + +int cmd_srch (); +char *rcmd_srch (); + +#endif diff --git a/src/isode/h/config.h b/src/isode/h/config.h new file mode 100644 index 0000000000..5c554a9c99 --- /dev/null +++ b/src/isode/h/config.h @@ -0,0 +1,36 @@ +/* this should be enough for everything... */ + +#define VSPRINTF /* has vprintf(3s) routines */ +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ +#define GETDENTS /* has <dirent.h> */ + +#ifdef __svr4__ +/* SYS5 is for termio instead of sgttyb */ +#define SYS5 +/* SVR4 turns off strdup */ +#define SVR4 +#endif + +#ifdef mips +/* not sys5 */ +#define BSD42 +#endif + +#ifdef _AIX +/* SYS5 is also for fcntl.h instead of sys/fcntl.h */ +#define SYS5 +/* AIX lets manifest.h fix up SYS5NLY */ +#define AIX +#endif + +#ifdef __linux__ +/* SYS5 is for termio instead of sgttyb */ +#define SYS5 +#endif + +#ifdef sun +#ifndef __svr4__ +#define SUNOS4 +#endif +#endif diff --git a/src/isode/h/configure.in b/src/isode/h/configure.in new file mode 100644 index 0000000000..cdff2db09d --- /dev/null +++ b/src/isode/h/configure.in @@ -0,0 +1,2 @@ +AC_INIT(configure.in) +AC_OUTPUT(Makefile) diff --git a/src/isode/h/dgram.h b/src/isode/h/dgram.h new file mode 100644 index 0000000000..21842f6957 --- /dev/null +++ b/src/isode/h/dgram.h @@ -0,0 +1,47 @@ +/* dgram.h - datagram (CL-mode TS) abstractions */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:11 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:32 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:37:49 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:42 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _DGRAM_ +#define _DGRAM_ + +#define MAXDGRAM 8192 + + +int join_dgram_aux (); +int read_dgram_socket (); +int write_dgram_socket (); +int close_dgram_socket (); +int select_dgram_socket (); +int check_dgram_socket (); + +#endif diff --git a/src/isode/h/fpkt.h b/src/isode/h/fpkt.h new file mode 100644 index 0000000000..1e042094a7 --- /dev/null +++ b/src/isode/h/fpkt.h @@ -0,0 +1,280 @@ +/* fpkt.h - include file for FTAM provider (FS-PROVIDER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:13 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:34 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:37:51 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:43 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#include "FTAM-types.h" + +#ifndef _FTAM_ +#include "ftam.h" /* definitions for FS-USERs */ +#endif +#ifndef _AcSAP_ +#include "acsap.h" /* definitions for AcS-USERs */ +#endif + +/* */ + +#define FS_GEN(fsb) \ + ((fsb -> fsb_flags & FSB_INIT) ? FS_GEN_INITIATOR : FS_GEN_RESPONDER) + +#define ftamPsig(fsb, sd) \ +{ \ + if ((fsb = findfsblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ + "invalid ftam descriptor"); \ + } \ + if (!(fsb -> fsb_flags & FSB_CONN)) { \ + (void) sigiomask (smask); \ + return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, \ + "ftam descriptor not connected"); \ + } \ + if (fsb -> fsb_flags & FSB_FINN) { \ + (void) sigiomask (smask); \ + return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, \ + "ftam descriptor finishing"); \ + } \ +} + +#define ftamFsig(fsb, sd) \ +{ \ + if ((fsb = findfsblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ + "invalid ftam descriptor"); \ + } \ + if (!(fsb -> fsb_flags & FSB_CONN)) { \ + (void) sigiomask (smask); \ + return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, \ + "ftam descriptor not connected"); \ + } \ + if (!(fsb -> fsb_flags & FSB_FINN)) { \ + (void) sigiomask (smask); \ + return ftamlose (fti, FS_GEN (fsb), 0, NULLCP, \ + "ftam descriptor not finishing"); \ + } \ +} + +#define toomuchP(b,n,m,p) \ +{ \ + if (b == NULL) \ + n = 0; \ + else \ + if (n > m) \ + return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ + "too many %ss", p); \ +} + +#ifdef __STDC__ +#define missingP(p) \ +{ \ + if (p == NULL) \ + return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ + "mandatory parameter \"%s\" missing", #p); \ +} +#else +#define missingP(p) \ +{ \ + if (p == NULL) \ + return ftamlose (fti, FS_GEN_NOREASON, 0, NULLCP, \ + "mandatory parameter \"%s\" missing", "p"); \ +} +#endif +#ifndef lint +#ifndef __STDC__ +#define copyFTAMdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ + bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ +} +#else +#define copyFTAMdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ + bcopy (base, d -> d##_data, d -> d##_cc); \ +} +#endif +#else +#define copyFTAMdata(base,len,d) bcopy (base, (char *) d, len) +#endif + + +int ftamlose (), fpktlose (), ftamoops (); + +/* */ + +struct ftamblk { + struct ftamblk *fsb_forw; /* doubly-linked list */ + struct ftamblk *fsb_back; /* .. */ + + int fsb_fd; /* association descriptor */ + + short fsb_flags; /* our state */ +#define FSB_NULL 0x0000 +#define FSB_CONN 0x0001 /* connected */ +#define FSB_FINN 0x0002 /* other side wants to finish */ +#define FSB_INIT 0x0004 /* this side initiated the association */ +#define FSB_ASYN 0x0008 /* asynchronous */ +#define FSB_DECHARGE 0x0010 /* responder can using charging on deselect */ +#define FSB_CANCEL 0x0020 /* this side started F-CANCEL */ +#define FSB_COLLIDE 0x0040 /* collision */ + + short fsb_state; /* more state */ +#define FSB_INITIALIZED 0 /* initialized */ +#define FSB_MANAGEMENT 1 /* management */ +#define FSB_BULKBEGIN 2 /* bulk data begin */ +#define FSB_BULKEND 3 /* bulk data end */ +#define FSB_DATAIDLE 4 /* data transfer idle */ +#define FSB_LOCATE 5 /* locate in progress */ +#define FSB_ERASE 6 /* erase in progress */ +#define FSB_DATAREAD 7 /* data transfer read */ +#define FSB_DATAWRITE 8 /* data transfer write */ +#define FSB_DATAFIN1 9 /* data transfer done */ +#define FSB_DATAFIN2 10 /* .. */ +#define FSB_DATACANCEL 11 /* cancel in progress */ + + int fsb_group; /* group flags */ + + int fsb_srequirements; /* session requirements */ + int fsb_owned; /* session tokens we own */ + int fsb_avail; /* session tokens available */ + int fsb_settings; /* initial and resync settings */ + long fsb_ssn; /* serial number */ + struct SSAPref fsb_connect; /* session connection reference */ + int fsb_ssdusize; /* largest atomic SSDU */ + + int fsb_id; /* FTAM context id */ + int fsb_prequirements; /* presentation requirements */ + struct PSAPctxlist fsb_contexts;/* presentation contexts */ + struct FTAMcontentlist fsb_contents; /* FTAM document types */ + + OID fsb_context; /* application context */ + + int fsb_fqos; /* ftam-QoS */ + int fsb_class; /* service-class */ + int fsb_units; /* functional-units */ + /* mandatory functional-units */ +#define FUNITS_TRANSFER (FUNIT_GROUPING) +#define FUNITS_ACCESS (FUNIT_READ | FUNIT_WRITE | FUNIT_ACCESS) +#define FUNITS_MANAGE (FUNIT_LIMITED | FUNIT_GROUPING) +#define FUNITS_TM (FUNIT_LIMITED | FUNIT_GROUPING) +#define FUNITS_UNCONS (0) + + int fsb_attrs; /* attribute-groups */ + + IFP fsb_indication; /* event handler */ + + struct PSAPdata fsb_data; /* for screwy BDT stuff */ + + int fsb_cancelaction; /* handle CANCEL collisions */ + PE fsb_cancelshared; + struct FTAMdiagnostic *fsb_canceldiags; + int fsb_cancelndiag; + + IFP fsb_trace; /* user-defined tracing function */ +}; +#define NULLFSB ((struct ftamblk *) 0) + +int freefsblk (); +struct ftamblk *newfsblk (), *findfsblk (); + +#ifndef lint +#define fsbtrace(fsb,a) if ((fsb) -> fsb_trace) (*((fsb) -> fsb_trace)) a +#else +#define fsbtrace(fsb,a) FTraceHook a +#endif + +/* */ + +struct pair { + int p_mask; + int p_bitno; +}; + +extern struct pair fclass_pairs[], + funit_pairs[], + fattr_pairs[], + fname_pairs[], + fmode_pairs[], + frequested_pairs[], + fpermitted_pairs[]; +/* */ + +struct type_FTAM_Access__Control__List *acl2fpm (); +int fpm2acl (); + +struct type_FTAM_Read__Attributes *attr2fpm (); +int fpm2attr (); + +PE bits2fpm (); +int fpm2bits (); + +struct type_FTAM_Charging *chrg2fpm (); +int fpm2chrg (); + +struct type_FTAM_Concurrency__Access *conacc2fpm (); +int fpm2conacc (); + +struct type_FTAM_Concurrency__Control *conctl2fpm (); +int fpm2conctl (); +#define conctl_present(fc) \ + ((fc) -> fc_readlock != FLOCK_NOTREQD \ + || (fc) -> fc_insertlock != FLOCK_NOTREQD \ + || (fc) -> fc_replacelock != FLOCK_NOTREQD \ + || (fc) -> fc_extendlock != FLOCK_NOTREQD \ + || (fc) -> fc_eraselock != FLOCK_NOTREQD \ + || (fc) -> fc_readattrlock != FLOCK_NOTREQD \ + || (fc) -> fc_chngattrlock != FLOCK_NOTREQD \ + || (fc) -> fc_deletelock != FLOCK_NOTREQD) \ + + +struct type_FTAM_Diagnostic *diag2fpm (); +int fpm2diag (); + +struct type_FTAM_FADU__Identity *faduid2fpm (); +int fpm2faduid (); + +struct type_FTAM_Access__Passwords *pass2fpm (); +int fpm2pass (); +#define passes_present(fp) \ + ((fp) -> fp_read || (fp) -> fp_insert || (fp) -> fp_replace \ + || (fp) -> fp_extend || (fp) -> fp_erase || (fp) -> fp_readattr \ + || (fp) -> fp_chngattr || (fp) -> fp_delete) \ + +struct type_FTAM_Shared__ASE__Information *shared2fpm (); +int fpm2shared (); + +/* */ + +int acs2ftamlose (), acs2ftamabort (); +int ps2ftamlose (); diff --git a/src/isode/h/ftam.h b/src/isode/h/ftam.h new file mode 100644 index 0000000000..009002cb17 --- /dev/null +++ b/src/isode/h/ftam.h @@ -0,0 +1,1255 @@ +/* ftam.h - include file for FTAM users (FS-USER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:15 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:36 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:37:53 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:43 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _FTAM_ +#define _FTAM_ + +#ifndef _PSAP2_ +#include "psap2.h" /* definitions for PS-USERs */ +#endif +#include "logger.h" + +/* */ + + /* FTAM-QoS */ +#define FQOS_NORECOVERY 0 /* no-recovery */ +#define FQOS_CLASS1 1 /* class-1-recovery */ +#define FQOS_CLASS2 2 /* class-2-recovery */ +#define FQOS_CLASS3 3 /* class-3-recovery */ +#define MY_FQOS FQOS_NORECOVERY + + + /* Service-Class */ +#define FCLASS_UNCONS 0x01 /* unconstrained-class */ +#define FCLASS_MANAGE 0x02 /* management-class */ +#define FCLASS_TRANSFER 0x04 /* transfer-class */ +#define FCLASS_TM 0x08 /* transfer-and-management-class */ +#define FCLASS_ACCESS 0x10 /* access-class */ + + /* Functional-Units */ +#define FUNIT_READ 0x001 /* read */ +#define FUNIT_WRITE 0x002 /* write */ +#define FUNIT_ACCESS 0x004 /* file-access */ +#define FUNIT_LIMITED 0x008 /* limited-file-managment */ +#define FUNIT_ENHANCED 0x010 /* enhanced-file-management */ +#define FUNIT_GROUPING 0x020 /* grouping */ +#define FUNIT_FADULOCK 0x040 /* fadu-locking */ +#define FUNIT_RECOVERY 0x080 /* recovery */ +#define FUNIT_RESTART 0x100 /* restart-data-transfer */ +#define MY_FUNIT (FUNIT_READ | FUNIT_WRITE | FUNIT_ACCESS \ + | FUNIT_LIMITED | FUNIT_ENHANCED \ + | FUNIT_GROUPING | FUNIT_FADULOCK) + + /* Attribute-Groups */ +#define FATTR_STORAGE 0x01 /* storage */ +#define FATTR_SECURITY 0x02 /* security */ +#define FATTR_PRIVATE 0x04 /* private */ +#define MY_FATTR (FATTR_STORAGE | FATTR_SECURITY) + + + /* State-Result */ +#define FSTATE_SUCCESS 0 /* success */ +#define FSTATE_FAILURE 1 /* failure */ + + /* Action-Result */ +#define FACTION_SUCCESS 0 /* success */ +#define FACTION_TRANS 1 /* transient-error */ +#define FACTION_PERM 2 /* permanent-error */ + +/* */ + +struct FTAMcontent { + OID fc_dtn; /* Document-Type-Name */ + + /* associated presentation context info */ + int fc_id; /* identifier */ + int fc_result; /* status */ +}; + + +struct FTAMcontentlist { /* Contents-Type-List */ + int fc_ncontent; /* number of contents */ + +#define NFCONT (NPCTX - 2) /* not-so-arbitrary */ + struct FTAMcontent fc_contents[NFCONT]; +}; + +/* */ + +struct FTAMdiagnostic { /* Diagnostic */ + int ftd_type; /* diagnostic-type */ +#define DIAG_INFORM 0 /* informative */ +#define DIAG_TRANS 1 /* transient */ +#define DIAG_PERM 2 /* permanent */ + + int ftd_identifier; /* error-identifier */ +#define FS_CODE2OFF(c) ((c) % 1000) + +#define FS_GEN_BASE 0 /* General FTAM diagnostics */ +#define FS_GEN_NOREASON 0 /* No reason */ +#define FS_GEN_RESPONDER 1 /* Responder error (unspecific) */ +#define FS_GEN_SHUTDOWN 2 /* System shutdown */ +#define FS_GEN_MGMT 3 /* FTAM management problem (unspecific) */ +#define FS_GEN_MGMTACCT 4 /* FTAM management, bad account */ +#define FS_GEN_MGMTPASS 5 /* FTAM management, security not passed */ +#define FS_GEN_DELAY 6 /* Delay may be encountered */ +#define FS_GEN_INITIATOR 7 /* Initiator error (unspecific) */ +#define FS_GEN_SUBSEQ 8 /* Subsequent error */ +#define FS_GEN_TEMPORAL 9 /* Temporal insufficiency of resources */ +#define FS_GEN_VFSECURE 10 /* Access request violates VFS security */ +#define FS_GEN_LSECURE 11 /* Access request violates local security */ +#define FS_GEN_WAITING 12 /* Indications waiting (unofficial) */ + +#define FS_PRO_BASE 1000 /* Protocol and supporting service related + diagnostics */ +#define FS_PRO_CONFLICT 1000 /* Conflicting parameter values */ +#define FS_PRO_UNSUPORT 1001 /* Unsupported parameter values */ +#define FS_PRO_MANDATORY 1002 /* Mandatory parameter not set */ +#define FS_PRO_UNPARAM 1003 /* Unsupported parameter */ +#define FS_PRO_DUPARAM 1004 /* Duplicated parameter */ +#define FS_PRO_ILLEGAL 1005 /* Illegal parameter type */ +#define FS_PRO_UNTYPE 1006 /* Unsupported parameter type */ +#define FS_PRO_ERR 1007 /* FTAM protocol error (unspecific) */ +#define FS_PRO_ERRPROC 1008 /* FTAM protocol error, procedure error */ +#define FS_PRO_ERRFUNIT 1009 /* FTAM protocol error, functional unit error*/ +#define FS_PRO_ERRMSG 1010 /* FTAM protocol error, corruption error */ +#define FS_PRO_LOWFAIL 1011 /* Lower layer failure */ +#define FS_PRO_LOWADDR 1012 /* Lower layer addressing error */ +#define FS_PRO_TIMEOUT 1013 /* Timeout */ +#define FS_PRO_SHUTDOWN 1014 /* System shutdown */ +#define FS_PRO_GROUPING 1015 /* Illegal grouping sequence */ +#define FS_PRO_THRESH 1016 /* Grouping threshold violation */ +#define FS_PRO_PDU 1017 /* Specific PDU request inconsistent with the + current requested access */ + +#define FS_ACS_BASE 2000 /* Association related diagnostics */ +#define FS_ACS_USER 2000 /* Association with user not allowed */ +#define FS_ACS_2001 2001 /* not assigned, #2001 */ +#define FS_ACS_CLASS 2002 /* Unsupported service class */ +#define FS_ACS_FUNIT 2003 /* Unsupported functional unit */ +#define FS_ACS_GRP 2004 /* Attribute group error (unspecific) */ +#define FS_ACS_GRPSUP 2005 /* Attribute group not supported */ +#define FS_ACS_GRPALL 2006 /* Attribute group not allowed */ +#define FS_ACS_ACCT 2007 /* Bad account */ +#define FS_ACS_MGMT 2008 /* Association management (unspecific) */ +#define FS_ACS_MGMTADDR 2009 /* Association management - bad address */ +#define FS_ACS_MGMTACCT 2010 /* Association management - bad account */ +#define FS_ACS_CKPLARGE 2011 /* Checkpoint window error - too large */ +#define FS_ACS_CKPSMALL 2012 /* Checkpoint window error - too small */ +#define FS_ACS_CKPERR 2013 /* Checkpoint window error - unsupported */ +#define FS_ACS_QOS 2014 /* Communications QoS not supported */ +#define FS_ACS_IDENTITY 2015 /* Initiator identity unacceptable */ +#define FS_ACS_CONTEXT 2016 /* Context management refused */ +#define FS_ACS_ROLLBACK 2017 /* Rollback not available */ +#define FS_ACS_CNTRESP 2018 /* Contents type list cut by responder */ +#define FS_ACS_CNTPSAP 2019 /* Contents type list cut by Presentation + service */ +#define FS_ACS_PASSWORD 2020 /* Invalid filestore password */ +#define FS_ACS_SERVICES 2021 /* Incompatible service classes */ + +#define FS_SEL_BASE 3000 /* Selection related diagnostics */ +#define FS_SEL_FILENAME 3000 /* Filename not found */ +#define FS_SEL_MATCHED 3001 /* Selection attributes not matched */ +#define FS_SEL_INITIAL 3002 /* Initial attributes not possible */ +#define FS_SEL_ATTRNAME 3003 /* Bad attribute name */ +#define FS_SEL_NOEXIST 3004 /* Non-existent file */ +#define FS_SEL_EXISTS 3005 /* File already exists */ +#define FS_SEL_CREATE 3006 /* File can not be created */ +#define FS_SEL_DELETE 3007 /* File can not be deleted */ +#define FS_SEL_CONAVAIL 3008 /* Concurrency control not available */ +#define FS_SEL_CONSUPRT 3009 /* Concurrency control not supported */ +#define FS_SEL_CONPOSS 3010 /* Concurrency control not possible */ +#define FS_SEL_RESTRICT 3011 /* More restrictive lock */ +#define FS_SEL_BUSY 3012 /* File busy */ +#define FS_SEL_AVAIL 3013 /* File not available */ +#define FS_SEL_ACCAVAIL 3014 /* Access control not available */ +#define FS_SEL_ACCSUPRT 3015 /* Access control not supported */ +#define FS_SEL_ACCINCON 3016 /* Access control inconsistent */ +#define FS_SEL_TRUNC 3017 /* Filename truncated */ +#define FS_SEL_ALTER 3018 /* Initial attributes altered */ +#define FS_SEL_ACCOUNT 3019 /* Bad account */ +#define FS_SEL_CREEXIST 3020 /* Override selected existing file */ +#define FS_SEL_CREOLD 3021 /* Override deleted and recreated file + with old attributes */ +#define FS_SEL_CRENEW 3022 /* Create override deleted and recreated file + with new attributes */ +#define FS_SEL_CRELOSE 3023 /* Create override - not possible */ +#define FS_SEL_AMBIG 3024 /* Ambiguous file specification */ +#define FS_SEL_CREPASS 3025 /* Invalid create password */ +#define FS_SEL_DELPASS 3026 /* Invalid delete password on override */ +#define FS_SEL_ATRVALUE 3027 /* Bad attribute value */ +#define FS_SEL_VIOLATES 3028 /* Requested access violates permitted + actions */ +#define FS_SEL_NOTAVAIL 3029 /* Functional unit not available for requested + access */ +#define FS_SEL_CRENOSEL 3030 /* File created but not selected */ + +#define FS_MGT_BASE 4000 /* File management related diagnostics */ +#define FS_MGT_EXIST 4000 /* Attribute non-existant */ +#define FS_MGT_READ 4001 /* Attribute cannot be read */ +#define FS_MGT_CHANGE 4002 /* Attribute cannot be changed */ +#define FS_MGT_SUPPORT 4003 /* Attribute not supported */ +#define FS_MGT_NAME 4004 /* Bad attribute name */ +#define FS_MGT_VALUE 4005 /* Bad attribute value */ +#define FS_MGT_PARTIAL 4006 /* Attribute partially supported */ +#define FS_MGMT_DISTINCT 4007 /* Additional set attribute not distinct */ + +#define FS_ACC_BASE 5000 /* Access related diagnostics */ +#define FS_ACC_FADU 5000 /* Bad FADU (unspecific) */ +#define FS_ACC_FADUSIZE 5001 /* Bad FADU - size error */ +#define FS_ACC_FADUTYPE 5002 /* Bad FADU - type error */ +#define FS_ACC_FADUSPEC 5003 /* Bad FADU - poorly specified */ +#define FS_ACC_FADULOC 5004 /* Bad FADU - bad location */ +#define FS_ACC_EXIST 5005 /* FADU does not exist */ +#define FS_ACC_AVL 5006 /* FADU not available (unspecific) */ +#define FS_ACC_AVLREAD 5007 /* FADU not available for reading */ +#define FS_ACC_AVLWRITE 5008 /* FADU not available for writing */ +#define FS_ACC_AVLLOC 5009 /* FADU not available for location */ +#define FS_ACC_AVLERASE 5010 /* FADU not available for erasure */ +#define FS_ACC_INSERT 5011 /* FADU cannot be inserted */ +#define FS_ACC_REPLACE 5012 /* FADU cannot be replaced */ +#define FS_ACC_LOCATE 5013 /* FADU cannot be located */ +#define FS_ACC_ELEMENT 5014 /* Bad data element type */ +#define FS_ACC_OPAVAIL 5015 /* Operation not available */ +#define FS_ACC_OPSUPRT 5016 /* Operation not supported */ +#define FS_ACC_OPCONS 5017 /* Operation inconsistent */ +#define FS_ACC_CONAVAIL 5018 /* Concurrency control not available */ +#define FS_ACC_CONSUPRT 5019 /* Concurrency control not supported */ +#define FS_ACC_CONINCON 5020 /* Concurrency control inconsistent */ +#define FS_ACC_MODAVAIL 5021 /* Processing mode not available */ +#define FS_ACC_MODSUPRT 5022 /* Processing mode not supported */ +#define FS_ACC_MODINCON 5023 /* Processing mode inconsistent */ +#define FS_ACC_CTXAVAIL 5024 /* Access context not available */ +#define FS_ACC_CTXSUPRT 5025 /* Access context not supported */ +#define FS_ACC_WRITE 5026 /* Bad write (unspecific) */ +#define FS_ACC_READ 5027 /* Bad read (unspecific) */ +#define FS_ACC_LCL 5028 /* Local failure (unspecific) */ +#define FS_ACC_LCLSPACE 5029 /* Local failure - file space exhausted */ +#define FS_ACC_LCLDATA 5030 /* Local failure - data corrupted */ +#define FS_ACC_LCLDEV 5031 /* Local failure - device failure */ +#define FS_ACC_FFSEXCEED 5032 /* Future file size exceeded */ +#define FS_ACC_FFSINCRES 5034 /* Future file size increased */ +#define FS_ACC_FUNIT 5035 /* Functional unit invalid in processing + mode */ +#define FS_ACC_TYPINCON 5036 /* Contents type inconsistent */ +#define FS_ACC_TYPSIMPL 5037 /* Contents type simplified */ +#define FS_ACC_DUPLICATE 5038 /* Duplicate FADU name */ +#define FS_ACC_DAMAGED 5039 /* Damage to select/open regime */ +#define FS_ACC_NOLOCKS 5040 /* FADU locking not available on file */ +#define FS_ACC_LOCKED 5041 /* FADU locked by another user */ + +#define FS_RVY_BASE 6000 /* Recovery related diagnostics */ +#define FS_RVY_CKP 6000 /* Bad checkpoint (unspecific) */ +#define FS_RVY_UNIQUE 6001 /* Activity not unique */ +#define FS_RVY_WINDOW 6002 /* Checkpoint outside window */ +#define FS_RVY_EXISTS 6003 /* Activity no longer exists */ +#define FS_RVY_RECOG 6004 /* Activity not recognized */ +#define FS_RVY_NODOCKET 6005 /* No docket */ +#define FS_RVY_CODOCKET 6006 /* Corrupt docket */ +#define FS_RVY_WAITING 6007 /* File waiting restart */ +#define FS_RVY_RECOVERY 6008 /* Bad recovery point */ +#define FS_RVY_NOPOINT 6009 /* Non-existent recovery point */ +#define FS_RVY_MODAVAIL 6010 /* Recovery mode not available */ +#define FS_RVY_MODINCON 6011 /* Recovery mode inconsistent */ +#define FS_RVY_MODREDUCE 6012 /* Recovery mode reduced */ +#define FS_RVY_ACCAVAIL 6013 /* Access control not available */ +#define FS_RVY_ACCSUPRT 6014 /* Access control not supported */ +#define FS_RVY_ACCINCON 6015 /* Access control inconsistent */ +#define FS_RVY_TYPINCON 6016 /* Contents type inconsistent */ +#define FS_RVY_TYPSIMPL 6017 /* Contents type simplified */ + + int ftd_observer; /* error-observer */ + int ftd_source; /* error-source */ +#define EREF_NONE 0 /* no-categorizaton-possible */ +#define EREF_IFSU 1 /* initiating-file-service-user */ +#define EREF_IFPM 2 /* initiating-file-protocol-machine */ +#define EREF_SERV 3 /* service-supporting-the-file-protocol-machine */ +#define EREF_RFPM 4 /* responding-file-protocol-machine */ +#define EREF_RFSU 5 /* responding-file-service-user */ + + int ftd_delay; /* suggested-delay */ +#define DIAG_NODELAY (-1) + + /* further-details */ +#define FTD_SIZE 512 /* should be unlimited... */ + int ftd_cc; /* length */ + char ftd_data[FTD_SIZE]; /* data */ +}; + +/* */ + +struct FTAMcharging { /* Charging */ + int fc_ncharge; /* number of charges */ + +#define NFCHRG 5 /* arbitrary */ + struct fc_charge { + char *fc_resource; /* resource-identifier */ + char *fc_unit; /* charging-unit */ + int fc_value; /* charging-value */ + } fc_charges[NFCHRG]; +}; + +/* */ + +struct FTAMpasswords { /* Access-Passwords */ + char *fp_read; /* read-password */ + int fp_readlen; + + char *fp_insert; /* insert-password */ + int fp_insertlen; + + char *fp_replace; /* replace-password */ + int fp_replacelen; + + char *fp_extend; /* extend-password */ + int fp_extendlen; + + char *fp_erase; /* erase-password */ + int fp_eraselen; + + char *fp_readattr; /* read-attribute-password */ + int fp_readattrlen; + + char *fp_chngattr; /* change-attribute-password */ + int fp_chngattrlen; + + char *fp_delete; /* delete-password */ + int fp_deletelen; +}; +#define FPFREE(fp) \ +{ \ + register struct FTAMpasswords *FP = (fp); \ + \ + if (FP -> fp_read) \ + free (FP -> fp_read), FP -> fp_read = NULL; \ + if (FP -> fp_insert) \ + free (FP -> fp_insert), FP -> fp_insert = NULL; \ + if (FP -> fp_replace) \ + free (FP -> fp_replace), FP -> fp_replace = NULL; \ + if (FP -> fp_extend) \ + free (FP -> fp_extend), FP -> fp_extend = NULL; \ + if (FP -> fp_erase) \ + free (FP -> fp_erase), FP -> fp_erase = NULL; \ + if (FP -> fp_readattr) \ + free (FP -> fp_readattr), FP -> fp_readattr = NULL; \ + if (FP -> fp_chngattr) \ + free (FP -> fp_chngattr), FP -> fp_chngattr = NULL; \ + if (FP -> fp_delete) \ + free (FP -> fp_delete), FP -> fp_delete = NULL; \ +} + +/* */ + +struct FTAMconcurrency { /* Concurrency-Control/Concurrency-Access */ +#define FLOCK_SHARED 00 /* shared */ +#define FLOCK_EXCLUSIVE 01 /* exclusive */ +#define FLOCK_NOTREQD 02 /* not-required */ +#define FLOCK_NOACCESS 03 /* no-access */ +#define FLOCK_MASK 03 +#define FLOCK_PRESENT FLOCK_EXCLUSIVE +#define FLOCK_RESTRICT 01 + + char fc_readlock; + char fc_insertlock; + char fc_replacelock; + char fc_extendlock; + char fc_eraselock; + char fc_readattrlock; + char fc_chngattrlock; + char fc_deletelock; +}; +#define FCINIT(fc) \ +{ \ + (fc) -> fc_readlock = FLOCK_NOTREQD; \ + (fc) -> fc_insertlock = FLOCK_NOTREQD; \ + (fc) -> fc_replacelock = FLOCK_NOTREQD; \ + (fc) -> fc_eraselock = FLOCK_NOTREQD; \ + (fc) -> fc_extendlock = FLOCK_NOTREQD; \ + (fc) -> fc_readattrlock = FLOCK_NOTREQD; \ + (fc) -> fc_chngattrlock = FLOCK_NOTREQD; \ + (fc) -> fc_deletelock = FLOCK_NOTREQD; \ +} + +/* */ + +struct FTAMacelement { /* SET OF Access-Control-Element */ + int fe_actions; /* action-list */ +#define FA_PERM_READ 0x0001 /* read */ +#define FA_PERM_INSERT 0x0002 /* insert */ +#define FA_PERM_REPLACE 0x0004 /* replace */ +#define FA_PERM_EXTEND 0x0008 /* extend */ +#define FA_PERM_ERASE 0x0010 /* erase */ +#define FA_PERM_READATTR 0x0020 /* read-attribute */ +#define FA_PERM_CHNGATTR 0x0040 /* change-attribute */ +#define FA_PERM_DELETE 0x0080 /* delete-file */ + + struct FTAMconcurrency fe_concurrency; /* concurrency-access */ + + char *fe_identity; /* user-identity */ + + struct FTAMpasswords fe_passwords; + + AEI fe_aet; /* application-entity-title */ + + struct FTAMacelement *fe_next; +}; +#define FEFREE(fe) \ +{ \ + register struct FTAMacelement *FE, \ + *FN; \ + \ + for (FE = (fe); FE; FE = FN) { \ + FN = FE -> fe_next; \ + \ + if (FE -> fe_identity) \ + free (FE -> fe_identity), FE -> fe_identity = NULL; \ + \ + FPFREE (&FE -> fe_passwords); \ + \ + if (FE -> fe_aet) { \ + AEIFREE (FE -> fe_aet); \ + free ((char *) FE -> fe_aet), FE -> fe_aet = NULL; \ + } \ + \ + FE -> fe_next = NULL; \ + \ + free ((char *) FE); \ + } \ +} + +/* */ + +struct FTAMattributes { /* {Change,Create,Read,Select}-Attributes */ + long fa_present; /* values present */ + long fa_novalue; /* no value available */ +#define FA_NULL 0x00000 +#define FA_FILENAME 0x00001 /* filename */ +#define FA_ACTIONS 0x00002 /* permitted-actions */ +#define FA_CONTENTS 0x00004 /* contents-type */ +#define FA_ACCOUNT 0x00008 /* account */ +#define FA_DATE_CREATE 0x00010 /* date-and-time-of-creation */ +#define FA_DATE_MODIFY 0x00020 /* date-and-time-of-last-modification */ +#define FA_DATE_READ 0x00040 /* date-and-time-of-last-read-access */ +#define FA_DATE_ATTR 0x00080 /* date-and-time-of-last-attribute-modification */ +#define FA_ID_CREATE 0x00100 /* identity-of-creator */ +#define FA_ID_MODIFY 0x00200 /* identity-of-last-modifier */ +#define FA_ID_READ 0x00400 /* identity-of-last-reader */ +#define FA_ID_ATTR 0x00800 /* identity-of-last-attribute-modifier */ +#define FA_AVAILABILITY 0x01000 /* file-availability */ +#define FA_FILESIZE 0x02000 /* filesize */ +#define FA_FUTURESIZE 0x04000 /* future-filesize */ +#define FA_CONTROL 0x08000 /* access-control */ +#define FA_LEGAL 0x10000 /* legal-qualifications */ +#define FA_PRIVATE 0x20000 /* private-use */ + +#define FA_KERNEL (FA_FILENAME | FA_ACTIONS | FA_CONTENTS) +#define FA_STORAGE (FA_ACCOUNT | FA_DATE_CREATE | FA_DATE_MODIFY \ + | FA_DATE_READ | FA_DATE_ATTR | FA_ID_CREATE \ + | FA_ID_MODIFY | FA_ID_READ | FA_ID_ATTR \ + | FA_AVAILABILITY | FA_FILESIZE | FA_FUTURESIZE) +#define FA_SECURITY (FA_CONTROL | FA_LEGAL) + +#define NFFILE 5 /* arbitrary */ + int fa_nfile; /* filename */ + char *fa_files[NFFILE]; /* .. */ + + int fa_permitted; /* permitted-actions, + same as fe_actions, plus: */ +#define FA_PERM_TRAV 0x0100 /* traversal */ +#define FA_PERM_RVTRAV 0x0200 /* reverse-traversal */ +#define FA_PERM_RANDOM 0x0400 /* random-order */ +#define FA_PERM_TRAVERSAL (FA_PERM_TRAV | FA_PERM_RVTRAV \ + | FA_PERM_RANDOM) + + OID fa_contents; /* contents-type */ + PE fa_parameter; /* .. parameter */ + + char *fa_account; /* account */ + + /* date-and-time-of- ... */ + struct UTCtime fa_date_create; + struct UTCtime fa_date_modify; + struct UTCtime fa_date_read; + struct UTCtime fa_date_attribute; + + /* identity-of- ... */ + char *fa_id_create; + char *fa_id_modify; + char *fa_id_read; + char *fa_id_attribute; + + int fa_availability; /* file-availability */ +#define FA_AVAIL_IMMED 0 /* immediate */ +#define FA_AVAIL_DEFER 1 /* deferred */ + + int fa_filesize; /* filesize */ + int fa_futuresize; /* future-filesize */ + + struct FTAMacelement *fa_control;/* access-control */ + char *fa_legal; /* legal-qualification */ + + char *fa_private; /* XXX */ +}; + +void FAFREE (); + +/* */ + +struct FADUidentity { /* FADU-Identity */ + int fa_type; +#define FA_FIRSTLAST 0 /* first-last */ +#define FA_RELATIVE 1 /* relative */ +#define FA_BEGINEND 2 /* begin-end */ +#define FA_SINGLE 3 /* single-name */ +#define FA_NAMELIST 4 /* name-list */ +#define FA_FADUNUMBER 5 /* fadu-number */ + + union { + int fa_un_firstlast; +#define FA_FIRST 0 +#define FA_LAST 1 + + int fa_un_relative; +#define FA_PREVIOUS 0 +#define FA_CURRENT 1 +#define FA_NEXT 2 + + int fa_un_beginend; +#define FA_BEGIN 0 +#define FA_END 1 + + char *fa_un_singlename; + +#define NANAME 5 /* arbitrary */ + struct { + char *fa_un_names[NANAME]; + int fa_un_nname; + } fa_un_list; + + int fa_un_fadunumber; + } fa_un; +#define fa_firstlast fa_un.fa_un_firstlast +#define fa_relative fa_un.fa_un_relative +#define fa_beginend fa_un.fa_un_beginend +#define fa_singlename fa_un.fa_un_singlename +#define fa_names fa_un.fa_un_list.fa_un_names +#define fa_nname fa_un.fa_un_list.fa_un_nname +#define fa_fadunumber fa_un.fa_un_fadunumber +}; +#define FUFREE(fu) \ +{ \ + register int FUI; \ + \ + if ((fu) -> fa_singlename) \ + free ((fu) -> fa_singlename), (fu) -> fa_singlename = NULL; \ + \ + for (FUI = (fu) -> fa_nname - 1; FUI >= 0; FUI--) \ + if ((fu) -> fa_names[FUI]) \ + free ((fu) -> fa_names[FUI]), (fu) -> fa_names[FUI] = NULL; \ +} + +/* */ + +struct FTAMstart { /* F-INITIALIZE.INDICATION */ + int fts_sd; /* FTAM descriptor */ + + AEInfo fts_callingtitle; /* info on calling application-entity */ + AEInfo fts_calledtitle; /* info called application-entity */ + + struct PSAPaddr fts_calledaddr;/* called presentation address */ + struct PSAPaddr fts_callingaddr;/* calling presentation address */ + + OID fts_context; /* application context name */ + + int fts_manage; /* presentation-context-management */ + + int fts_class; /* service-class */ + + int fts_units; /* functional-units */ + int fts_attrs; /* attribute-groups */ + + PE fts_sharedASE; /* shared-ASE-information */ + + int fts_fqos; /* ftam-QoS */ + + struct FTAMcontentlist fts_contents;/* contents-type-list */ + + char *fts_initiator; /* initiator-identity */ + char *fts_account; /* account */ + char *fts_password; /* filestore-password */ + int fts_passlen; /* .. */ + + int fts_ssdusize; /* largest atomic SSDU */ + + struct QOStype fts_qos; /* Communications QoS */ +}; +#define FTSFREE(fts) \ +{ \ + register int FSI; \ + \ + AEIFREE (&(fts) -> fts_callingtitle); \ + AEIFREE (&(fts) -> fts_calledtitle); \ + if ((fts) -> fts_context) \ + oid_free ((fts) -> fts_context), (fts) -> fts_context = NULLOID; \ + \ + if ((fts) -> fts_sharedASE) \ + pe_free ((fts) -> fts_sharedASE), (fts) -> fts_sharedASE = NULLPE; \ + \ + for (FSI = (fts) -> fts_contents.fc_ncontent - 1; FSI >= 0; FSI--) \ + oid_free ((fts) -> fts_contents.fc_contents[FSI].fc_dtn), \ + (fts) -> fts_contents.fc_contents[FSI].fc_dtn = NULLOID; \ + (fts) -> fts_contents.fc_ncontent = 0; \ + \ + if ((fts) -> fts_initiator) \ + free ((fts) -> fts_initiator), (fts) -> fts_initiator = NULL; \ + if ((fts) -> fts_account) \ + free ((fts) -> fts_account), (fts) -> fts_account = NULL; \ + if ((fts) -> fts_password) \ + free ((fts) -> fts_password), (fts) -> fts_password = NULL; \ +} + + +struct FTAMconnect { /* F-INITIALIZE.CONFIRMATION */ + int ftc_sd; /* FTAM descriptor */ + + AEInfo ftc_respondtitle; /* responding application-entity title */ + + struct PSAPaddr ftc_respondaddr;/* responding presentation address */ + + OID ftc_context; /* application context name */ + + int ftc_state; /* state-result */ + int ftc_action; /* action-result */ + + int ftc_manage; /* presentation-context-management */ + + int ftc_class; /* service-class */ + + int ftc_units; /* functional-units */ + int ftc_attrs; /* attribute-groups */ + + PE ftc_sharedASE; /* shared-ASE-information */ + + int ftc_fqos; /* ftam-QoS */ + + struct FTAMcontentlist ftc_contents;/* contents-type-list */ + +#define NFDIAG 5 /* diagnostic */ + int ftc_ndiag; + struct FTAMdiagnostic ftc_diags[NFDIAG]; + + int ftc_ssdusize; /* largest atomic SSDU */ + + struct QOStype ftc_qos; /* communications QoS */ +}; +#define FTCFREE(ftc) \ +{ \ + register int FCI; \ + \ + AEIFREE (&(ftc) -> ftc_respondtitle); \ + if ((ftc) -> ftc_context) \ + oid_free ((ftc) -> ftc_context), (ftc) -> ftc_context = NULLOID; \ + \ + if ((ftc) -> ftc_sharedASE) \ + pe_free ((ftc) -> ftc_sharedASE), (ftc) -> ftc_sharedASE = NULLPE; \ + \ + for (FCI = (ftc) -> ftc_contents.fc_ncontent - 1; FCI >= 0; FCI--) \ + oid_free ((ftc) -> ftc_contents.fc_contents[FCI].fc_dtn), \ + (ftc) -> ftc_contents.fc_contents[FCI].fc_dtn = NULLOID; \ + (ftc) -> ftc_contents.fc_ncontent = 0; \ +} + + +struct FTAMfinish { /* F-TERMINATE.INDICATION */ + PE ftf_sharedASE; /* shared-ASE-information */ +}; +#define FTFFREE(ftf) \ +{ \ + if ((ftf) -> ftf_sharedASE) \ + pe_free ((ftf) -> ftf_sharedASE), (ftf) -> ftf_sharedASE = NULLPE; \ +} + +struct FTAMrelease { /* F-TERMINATE.CONFIRMATION */ + PE ftr_sharedASE; /* shared-ASE-information */ + /* charging */ + struct FTAMcharging ftr_charges; +}; +#define FTRFREE(ftr) \ +{ \ + register int FRI; \ + register struct fc_charge *FC; \ + \ + if ((ftr) -> ftr_sharedASE) \ + pe_free ((ftr) -> ftr_sharedASE), (ftr) -> ftr_sharedASE = NULLPE; \ + \ + for (FC = (ftr) -> ftr_charges.fc_charges, FRI = (ftr) -> ftr_charges.fc_ncharge - 1; \ + FRI >= 0; \ + FC++, FRI--) { \ + if (FC -> fc_resource) \ + free (FC -> fc_resource), FC -> fc_resource = NULL; \ + if (FC -> fc_unit) \ + free (FC -> fc_unit), FC -> fc_unit = NULL; \ + } \ + (ftr) -> ftr_charges.fc_ncharge = 0; \ +} + + +struct FTAMabort { /* F-{U,P}-ABORT.INDICATION */ + int fta_peer; /* T = F-U-ABORT.INDICATION + NIL = F-P-ABORT.INDICATION */ + + int fta_action; /* action-result */ + + int fta_ndiag; /* diagnostic */ + struct FTAMdiagnostic fta_diags[NFDIAG]; +}; + + +struct FTAMselect { /* F-SELECT.* */ + /* RESPONSE only */ + int ftse_state; /* state-result */ + int ftse_action; /* action-result */ + + /* attributes (FILENAME only) */ + struct FTAMattributes ftse_attrs; +#define FA_SEL_ATTRS FA_FILENAME + + /* REQUEST only */ + int ftse_access; /* requested-access */ +#define FA_REQ_MASK (FA_PERM_READ | FA_PERM_INSERT | FA_PERM_REPLACE \ + | FA_PERM_EXTEND | FA_PERM_ERASE \ + | FA_PERM_READATTR | FA_PERM_CHNGATTR \ + | FA_PERM_DELETE) + /* access-passwords */ + struct FTAMpasswords ftse_pwds; + /* concurrency-control */ + struct FTAMconcurrency ftse_conctl; + PE ftse_sharedASE; /* shared-ASE-information */ + char *ftse_account; /* account */ + + /* RESPONSE only */ + int ftse_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftse_diags[NFDIAG]; +}; +#define FTSEFREE(ftse) \ +{ \ + FAFREE (&((ftse) -> ftse_attrs)); \ + FPFREE (&((ftse) -> ftse_pwds)); \ + if ((ftse) -> ftse_sharedASE) \ + pe_free ((ftse) -> ftse_sharedASE), (ftse) -> ftse_sharedASE = NULLPE; \ + if ((ftse) -> ftse_account) \ + free ((ftse) -> ftse_account), (ftse) -> ftse_account = NULLCP; \ +} + + +struct FTAMdeselect { /* F-DESELECT.* */ + /* RESPONSE only */ + int ftde_action; /* action-result */ + + PE ftde_sharedASE; /* shared-ASE-information */ + + /* RESPONSE only */ + /* charging */ + struct FTAMcharging ftde_charges; + int ftde_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftde_diags[NFDIAG]; +}; +#define FTDEFREE(ftde) \ +{ \ + register int FDEI; \ + register struct fc_charge *FC; \ + \ + for (FC = (ftde) -> ftde_charges.fc_charges, FDEI = (ftde) -> ftde_charges.fc_ncharge - 1; \ + FDEI >= 0; \ + FC++, FDEI--) { \ + if (FC -> fc_resource) \ + free (FC -> fc_resource), FC -> fc_resource = NULL; \ + if (FC -> fc_unit) \ + free (FC -> fc_unit), FC -> fc_unit = NULL; \ + } \ + (ftde) -> ftde_charges.fc_ncharge = 0; \ + if ((ftde) -> ftde_sharedASE) \ + pe_free ((ftde) -> ftde_sharedASE), (ftde) -> ftde_sharedASE = NULLPE; \ +} + + +struct FTAMcreate { /* F-CREATE.* */ + /* RESPONSE only */ + int ftce_state; /* state-result */ + int ftce_action; /* action-result */ + + /* REQUEST only */ + int ftce_override; /* override */ +#define FOVER_FAIL 0 /* fail, if already exists */ +#define FOVER_SELECT 1 /* select, if it already exists */ +#define FOVER_WRITE 2 /* zero-truncate, if it already exists */ +#define FOVER_DELETE 3 /* delete, if it already exists */ + + /* initial-attributes */ + struct FTAMattributes ftce_attrs; +#define FA_CRE_ATTRS (FA_FILENAME | FA_ACTIONS | FA_CONTENTS | FA_ACCOUNT \ + | FA_AVAILABILITY | FA_FUTURESIZE | FA_CONTROL \ + | FA_LEGAL | FA_PRIVATE) + + /* REQUEST only */ + char *ftce_create; /* create-password */ + int ftce_crelen; /* .. */ + int ftce_access; /* requested-access */ + /* access-passwords */ + struct FTAMpasswords ftce_pwds; + /* concurrency-control */ + struct FTAMconcurrency ftce_conctl; + + PE ftce_sharedASE; /* shared-ASE-information */ + + /* REQUEST only */ + char *ftce_account; /* account */ + + /* RESPONSE only */ + int ftce_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftce_diags[NFDIAG]; +}; +#define FTCEFREE(ftce) \ +{ \ + FAFREE (&((ftce) -> ftce_attrs)); \ + if ((ftce) -> ftce_create) \ + free ((ftce) -> ftce_create), (ftce) -> ftce_create = NULLCP; \ + FPFREE (&((ftce) -> ftce_pwds)); \ + if ((ftce) -> ftce_sharedASE) \ + pe_free ((ftce) -> ftce_sharedASE), (ftce) -> ftce_sharedASE = NULLPE; \ + if ((ftce) -> ftce_account) \ + free ((ftce) -> ftce_account), (ftce) -> ftce_account = NULLCP; \ +} + + +struct FTAMdelete { /* F-DELETE.* */ + /* RESPONSE only */ + int ftxe_action; /* action-result */ + + PE ftxe_sharedASE; /* shared-ASE-information */ + + /* RESPONSE only */ + /* charging */ + struct FTAMcharging ftxe_charges; + int ftxe_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftxe_diags[NFDIAG]; +}; +#define FTXEFREE(ftxe) \ +{ \ + register int FXEI; \ + register struct fc_charge *FC; \ + \ + if ((ftxe) -> ftxe_sharedASE) \ + pe_free ((ftxe) -> ftxe_sharedASE), (ftxe) -> ftxe_sharedASE = NULLPE; \ + \ + for (FC = (ftxe) -> ftxe_charges.fc_charges, FXEI = (ftxe) -> ftxe_charges.fc_ncharge - 1; \ + FXEI >= 0; \ + FC++, FXEI--) { \ + if (FC -> fc_resource) \ + free (FC -> fc_resource), FC -> fc_resource = NULL; \ + if (FC -> fc_unit) \ + free (FC -> fc_unit), FC -> fc_unit = NULL; \ + } \ + (ftxe) -> ftxe_charges.fc_ncharge = 0; \ +} + + +struct FTAMreadattr { /* F-READ-ATTRIB.* */ + /* RESPONSE only */ + int ftra_action; /* action-result */ + + /* REQUEST only */ + int ftra_attrnames; /* attribute names (from fa_present) */ + + /* RESPONSE only */ + struct FTAMattributes ftra_attrs; + int ftra_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftra_diags[NFDIAG]; +}; +#define FTRAFREE(ftra) \ +{ \ + FAFREE (&((ftra) -> ftra_attrs)); \ +} + + +struct FTAMchngattr { /* F-CHANGE-ATTRIB.* */ + /* RESPONSE only */ + int ftca_action; /* action-result */ + + struct FTAMattributes ftca_attrs; +#define FA_CHG_ATTRS (FA_FILENAME | FA_ACCOUNT | FA_AVAILABILITY \ + | FA_FUTURESIZE | FA_CONTROL | FA_LEGAL \ + | FA_PRIVATE) + + /* RESPONSE only */ + int ftca_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftca_diags[NFDIAG]; +}; +#define FTCAFREE(ftca) \ +{ \ + FAFREE (&((ftca) -> ftca_attrs)); \ +} + + +struct FTAMopen { /* F-OPEN.* */ + /* RESPONSE only */ + int ftop_state; /* state-result */ + int ftop_action; /* action-result */ + + /* REQUEST only */ + int ftop_mode; /* processing-mode (read..erase) */ +#define FA_MODE_MASK (FA_PERM_READ | FA_PERM_INSERT | FA_PERM_REPLACE \ + | FA_PERM_EXTEND | FA_PERM_ERASE) + + OID ftop_contents; /* contents-type */ + PE ftop_parameter; /* .. */ + /* concurrency-control */ + struct FTAMconcurrency ftop_conctl; + PE ftop_sharedASE; /* shared-ASE-information */ + + /* REQUEST only */ + int ftop_locking; /* enable-fadu-locking */ + + /* RESPONSE only */ + int ftop_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftop_diags[NFDIAG]; +}; +#define FTOPFREE(ftop) \ +{ \ + if ((ftop) -> ftop_contents) \ + oid_free ((ftop) -> ftop_contents), \ + (ftop) -> ftop_contents = NULLOID; \ + if ((ftop) -> ftop_parameter) \ + pe_free ((ftop) -> ftop_parameter), \ + (ftop) -> ftop_parameter = NULLPE; \ + if ((ftop) -> ftop_sharedASE) \ + pe_free ((ftop) -> ftop_sharedASE), (ftop) -> ftop_sharedASE = NULLPE; \ +} + + +struct FTAMclose { /* F-CLOSE.* */ + int ftcl_action; /* action-result */ + + PE ftcl_sharedASE; /* shared-ASE-information */ + + int ftcl_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftcl_diags[NFDIAG]; +}; +#define FTCLFREE(ftcl) \ +{ \ + if ((ftcl) -> ftcl_sharedASE) \ + pe_free ((ftcl) -> ftcl_sharedASE), (ftcl) -> ftcl_sharedASE = NULLPE; \ +} + + +struct FTAMgroup { + int ftg_threshold; /* threshold */ + + int ftg_flags; +#define FTG_NULL 0x0000 +#define FTG_BEGIN 0x0001 /* have begin */ +#define FTG_SELECT 0x0002 /* .. select */ +#define FTG_CREATE 0x0004 /* .. create */ +#define FTG_RDATTR 0x0008 /* .. read attribute */ +#define FTG_CHATTR 0x0010 /* .. change attribute */ +#define FTG_OPEN 0x0020 /* .. open */ +#define FTG_CLOSE 0x0040 /* .. close */ +#define FTG_DESELECT 0x0080 /* .. deselect */ +#define FTG_DELETE 0x0100 /* .. delete */ +#define FTG_END 0x0200 /* .. end */ + + union { + struct FTAMselect ftg_un1_select; + struct FTAMcreate ftg_un1_create; + struct FTAMclose ftg_un1_close; + } ftg_un1; +#define ftg_select ftg_un1.ftg_un1_select +#define ftg_create ftg_un1.ftg_un1_create +#define ftg_close ftg_un1.ftg_un1_close + + struct FTAMreadattr ftg_readattr; + + struct FTAMchngattr ftg_chngattr; + + union { + struct FTAMdeselect ftg_un2_deselect; + struct FTAMdelete ftg_un2_delete; + struct FTAMopen ftg_un2_open; + } ftg_un2; +#define ftg_deselect ftg_un2.ftg_un2_deselect +#define ftg_delete ftg_un2.ftg_un2_delete +#define ftg_open ftg_un2.ftg_un2_open +}; +#define FTGFREE(ftg) \ +{ \ + if ((ftg) -> ftg_flags & FTG_SELECT) { \ + FTSEFREE (&((ftg) -> ftg_select)); \ + } \ + else \ + if ((ftg) -> ftg_flags & FTG_CREATE) { \ + FTCEFREE (&((ftg) -> ftg_create)); \ + } \ + else \ + if ((ftg) -> ftg_flags & FTG_CLOSE) \ + FTCLFREE (&((ftg) -> ftg_close)); \ + \ + if ((ftg) ->ftg_flags & FTG_RDATTR) \ + FTRAFREE (&((ftg) -> ftg_readattr)); \ + \ + if ((ftg) ->ftg_flags & FTG_CHATTR) \ + FTCAFREE (&((ftg) -> ftg_chngattr)); \ + \ + if ((ftg) -> ftg_flags & FTG_DESELECT) { \ + FTDEFREE (&((ftg) -> ftg_deselect)); \ + } \ + else \ + if ((ftg) -> ftg_flags & FTG_DELETE) { \ + FTXEFREE (&((ftg) -> ftg_delete)); \ + } \ + else \ + if ((ftg) -> ftg_flags & FTG_OPEN) \ + FTOPFREE (&((ftg) -> ftg_open)); \ +} + + +struct FTAMaccess { /* F-{LOCATE,ERASE}.{INDICATION,CONFIRMATION} */ + int ftac_operation; +#define FA_OPS_LOCATE 0 /* locate */ +#define FA_OPS_ERASE 1 /* erase */ + + /* CONFIRMATION only */ + int ftac_action; /* action-result */ + + /* *.INDICATION OR F-LOCATE.CONFIRMATION */ + /* fadu-identity */ + struct FADUidentity ftac_identity; + + /* F-LOCATE.INDICATION only */ + int ftac_locking; /* fadu-lock (on, off) */ + + /* CONFIRMATION only */ + int ftac_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftac_diags[NFDIAG]; +}; +#define FTACFREE(ftac) \ +{ \ + FUFREE (&((ftac) -> ftac_identity)); \ +} + + +struct FTAMreadwrite { /* F-{READ,WRITE}.INDICATION */ + int ftrw_operation; /* fadu-operation */ +#define FA_OPS_READ (-1) /* read (pseudo) */ +#define FA_OPS_INSERT 0 /* insert */ +#define FA_OPS_REPLACE 1 /* replace */ +#define FA_OPS_EXTEND 2 /* extend */ + + /* fadu-identity */ + struct FADUidentity ftrw_identity; + + /* F-READ.INDICATION only */ + int ftrw_context; /* access-context */ +#define FA_ACC_HA 0 /* hierarchical-all-data-units */ +#define FA_ACC_HN 1 /* hierarchical-no-data-units */ +#define FA_ACC_FA 2 /* flat-all-data-units */ +#define FA_ACC_FL 3 /* flat-one-level-data-units */ +#define FA_ACC_FS 4 /* flat-single-data-unit */ +#define FA_ACC_UA 5 /* unstructured-all-data-units */ +#define FA_ACC_US 6 /* unstructured-single-data-unit */ + int ftrw_level; /* level for FL */ + + int ftrw_locking; /* fadu-lock */ +}; +#define FTRWFREE(ftrw) \ +{ \ + FUFREE (&((ftrw) -> ftrw_identity)); \ +} + + +struct FTAMdataend { /* F-DATA-END.INDICATION */ + int ftda_action; /* action-result */ + + int ftda_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftda_diags[NFDIAG]; +}; + + +struct FTAMtransend { /* F-TRANSFER-END.{INDICATION,CONFIRMATION} */ + /* RESPONSE only */ + int ftre_action; /* action-result */ + + PE ftre_sharedASE; /* shared-ASE-information */ + + /* RESPONSE only */ + int ftre_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftre_diags[NFDIAG]; +}; +#define FTREFREE(ftre) \ +{ \ + if ((ftre) -> ftre_sharedASE) \ + pe_free ((ftre) -> ftre_sharedASE), (ftre) -> ftre_sharedASE = NULLPE; \ +} + + +struct FTAMcancel { /* F-CANCEL.{INDICATION,CONFIRMATION} */ + int ftcn_action; /* action-result */ + + PE ftcn_sharedASE; /* shared-ASE-information */ + + int ftcn_ndiag; /* diagnostic */ + struct FTAMdiagnostic ftcn_diags[NFDIAG]; +}; +#define FTCNFREE(ftcn) \ +{ \ + if ((ftcn) -> ftcn_sharedASE) \ + pe_free ((ftcn) -> ftcn_sharedASE), (ftcn) -> ftcn_sharedASE = NULLPE; \ +} + + +struct FTAMindication { + int fti_type; /* the union element present */ +#define FTI_FINISH 0x00 +#define FTI_ABORT 0x01 +#define FTI_MANAGEMENT 0x02 +#define FTI_BULKBEGIN 0x03 +#define FTI_BULKEND 0x04 +#define FTI_ACCESS 0x05 +#define FTI_READWRITE 0x06 +#define FTI_DATA 0x07 +#define FTI_DATAEND 0x08 +#define FTI_CANCEL 0x09 +#define FTI_TRANSEND 0x10 + + union { + struct FTAMfinish fti_un_finish; + struct FTAMabort fti_un_abort; + struct FTAMgroup fti_un_group; + struct FTAMaccess fti_un_access; + struct FTAMreadwrite fti_un_readwrite; + struct PSAPdata fti_un_data; + struct FTAMdataend fti_un_dataend; + struct FTAMcancel fti_un_cancel; + struct FTAMtransend fti_un_transend; + } fti_un; +#define fti_finish fti_un.fti_un_finish +#define fti_abort fti_un.fti_un_abort +#define fti_group fti_un.fti_un_group +#define fti_access fti_un.fti_un_access +#define fti_readwrite fti_un.fti_un_readwrite +#define fti_data fti_un.fti_un_data +#define fti_dataend fti_un.fti_un_dataend +#define fti_cancel fti_un.fti_un_cancel +#define fti_transend fti_un.fti_un_transend +}; + +/* when FTAMindication has PSAPdata, the pe_context indicates whether + each data is from the FTAM PCI or is a data element. + + FTAM PCI - PE_DFLT_CTX + + data element - anything else + + three different types of data in the FTAM PCI are handled by the user: + + Node-Descriptor-Data-Element ::= [APPLICATION 0] ... + Enter-Subtree-Data-Element ::= [APPLICATION 1] ... + Exit-Subtree-Data-Element ::= [APPLICATION 2] ... + */ + +#define FADU_NODESCR 0 /* Node-Descriptor-Data-Element */ +#define FADU_ENTERTREE 1 /* Enter-Subtree-Data-Element */ +#define FADU_EXITREE 2 /* Exit-Subtree-Data-Element */ + +/* */ + +extern char *ftamversion; + +extern LLog _ftam_log, *ftam_log; + + +int FInit (); /* F-INITIALIZE.INDICATION */ +int FInitializeResponse (); /* F-INITIALIZE.RESPONSE */ +int FInitializeRequest (); /* F-INITIALIZE.REQUEST */ +int FTerminateRequest (); /* F-TERMINATE.REQUEST */ +int FTerminateResponse (); /* F-TERMINATE.RESPONSE */ +int FUAbortRequest (); /* F-U-ABORT.REQUEST */ + +int FWaitRequest (); /* F-WAIT.REQUEST (pseudo) */ + +int FManageRequest (); /* F-MANAGE.REQUEST (group) */ +int FManageResponse (); /* F-MANAGE.RESPONSE (group) */ +int FBulkBeginRequest (); /* F-BULK-BEGIN.REQUEST (group) */ +int FBulkBeginResponse (); /* F-BULK-BEGIN.RESPONSE (group) */ +int FBulkEndRequest (); /* F-BULK-END.REQUEST (group) */ +int FBulkEndResponse (); /* F-BULK-END.RESPONSE (group) */ + +int FAccessRequest (); /* F-{LOCATE,ERASE}.REQUEST */ +int FAccessResponse (); /* F-{LOCATE,ERASE}.RESPONSE */ + +int FReadWriteRequest (); /* F-{READ,WRITE}.REQUEST */ +int FDataRequest (); /* F-DATA.REQUEST */ +int FDataEndRequest (); /* F-DATA-END.REQUEST */ +int FCancelRequest (); /* F-CANCEL.REQUEST */ +int FCancelResponse (); /* F-CANCEL.RESPONSE */ +int FTransEndRequest (); /* F-TRANSFER-END.REQUEST */ +int FTransEndResponse (); /* F-TRANSFER-END.RESPONSE */ + +int FSetIndications (); /* define vector for INDICATION events */ +int FSelectMask (); /* map ftam descriptors for select() */ + +int FHookRequest (); /* set tracing */ +int FTraceHook (); /* user-defined tracing */ + +char *FErrString (); /* return FTAM error code in string form */ + +/* */ + +struct isodocument { + char *id_entry; + + OID id_type; + + OID id_abstract; + OID id_transfer; + OID id_model; + OID id_constraint; +}; + +int setisodocument (), endisodocument (); + +struct isodocument *getisodocument (); + +struct isodocument *getisodocumentbyentry (); +struct isodocument *getisodocumentbytype (); + +#endif diff --git a/src/isode/h/general.h b/src/isode/h/general.h new file mode 100644 index 0000000000..feaa247f40 --- /dev/null +++ b/src/isode/h/general.h @@ -0,0 +1,293 @@ +/* general.h - general compatibility */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:17 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:42 eichin + * autoconfed isode for kerberos work + * + * Revision 1.3 1994/06/07 23:08:23 eichin + * hide calloc/malloc/realloc from ultrix too + * + * Revision 1.1 1994/05/31 20:37:55 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:44 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _GENERAL_ +#define _GENERAL_ + +#ifndef _CONFIG_ +#include "config.h" /* system-specific configuration */ +#endif + + +/* target-dependent defines: + + BSDFORK - target has BSD vfork + BSDLIBC - target has real BSD libc + BSDSTRS - target has BSD strings + SWABLIB - target has byteorder(3n) routines + */ + +#ifdef SOCKETS +#define SWABLIB +#endif + +#ifdef WINTLI +#define SWABLIB +#endif + +#ifdef EXOS +#define SWABLIB +#endif + + +#ifdef BSD42 +#define BSDFORK +#define BSDLIBC +#define BSDSTRS +#endif + +#ifdef SVR4_UCB +#ifndef SVR4 +#define SVR4 +#endif +#endif + +#ifdef SVR4 +#ifndef SVR3 +#define SVR3 +#endif +#endif + +#ifdef ROS +#undef BSDFORK +#undef BSDLIBC +#define BSDSTRS +#ifndef BSD42 +#define BSD42 +#endif +#undef SWABLIB +#endif + +#ifdef SYS5 +#undef BSDFORK +#undef BSDLIBC +#undef BSDSTRS +#endif + +#ifdef sgi +#undef BSDFORK +#undef BSDLIBC +#undef BSDSTRS +#endif + +#ifdef HPUX +#define BSDFORK +#undef BSDLIBC +#undef BSDSTRS +#undef SWABLIB +#endif + +#ifdef pyr +#undef SWABLIB +#endif + +#ifdef XOS +#undef SWABLIB +#endif + +#ifdef XOS_2 +#undef SWABLIB +#endif + +#ifdef apollo +#undef SWABLIB +#endif + +#ifdef AUX +#undef BSDFORK +#define BSDSTRS +#undef SWABLIB +#define BSDLIBC +#endif + +#ifndef BSDFORK +#define vfork fork +#endif + +/* STRINGS */ + +#ifdef SVR4 +#include <stdio.h> +#include <stdlib.h> + +#else /* SVR4 */ + +/* sprintf already defined in stdio.h on SunOS 4.1.1 -- SJL +#if defined(BSDSTRS) && !defined(BSD44) && (!defined(BSD43) || defined(SUNOS4) || defined(vax) || defined(RT) || (defined(mips) && defined(ultrix))) && !defined(XOS_2) +#if !(defined(__STDC__) && defined(__GNUC__) && defined(mips) && defined(ultrix)) +char *sprintf (); +#endif +#else +int sprintf (); +#endif + */ + +char *getenv (); +char *mktemp (); + +#endif /* SVR4 */ + +#ifdef __STDC__ +#include <malloc.h> +#else +#ifndef _AIX +#ifndef mips +char *calloc (), *malloc (), *realloc (); +#endif +#endif +#endif + + +#ifndef BSDSTRS +#ifndef AIX +#define index strchr +#define rindex strrchr +#endif +#include <string.h> +#else +#include <strings.h> +#endif + +#if defined(SYS5) && !defined(AIX) && !defined(XOS) && !defined(XOS_2) +#include <memory.h> + +#define bcopy(b1,b2,length) (void) memcpy ((b2), (b1), (length)) +#define bcmp(b1,b2,length) memcmp ((b1), (b2), (length)) +#define bzero(b,length) (void) memset ((b), 0, (length)) +#endif +/* HEXIFY */ + +int explode (), implode (); + +/* SPRINTB */ + +char *sprintb (); + +/* STR2VEC */ + +#define NVEC 100 +#define NSLACK 10 + + +#define str2vec(s,v) str2vecX ((s), (v), 0, NULLIP, NULL, 1) + +int str2vecX (); + +/* STR2ELEM */ + +#define NELEM 20 + +int str2elem (); + +/* STR2SEL */ + +int str2sel (); +char *sel2str (); + +/* GETPASS */ + +char *getpassword (); + +/* BADUSER */ + +int baduser (); + +/* UTILITIES */ + +extern char chrcnv[], nochrcnv[]; + + +int lexequ (), lexnequ (); + +int log_tai (); + +int sstr2arg (); + +char *smalloc (), *strdup (); + +/* MISC */ + +char *sys_errname (); + +#ifdef lint +#define insque(e,p) INSQUE ((char *) (e), (char *) (p)) +#define remque(e) REMQUE ((char *) (e)) +#endif + + +void asprintf (), _asprintf (); + +void isodetailor (); /* also in tailor.h */ + + +/* time */ + +#ifndef makedev +#include <sys/types.h> +#endif +#ifndef OSX +#ifndef BSD42 +#include <time.h> +#else +#ifndef timerisset +#include <sys/time.h> +#endif +#endif +#endif + +#ifndef __STDC__ +extern time_t time (); +#endif + + +/* ntohs etc */ + +#ifndef linux +#ifndef ntohs +unsigned short ntohs (); +#endif +#ifndef htons +unsigned short htons (); +#endif +#ifndef ntohl +unsigned long ntohl (); +#endif +#ifndef htonl +unsigned long htonl (); +#endif +#endif + +#endif diff --git a/src/isode/h/internet.h b/src/isode/h/internet.h new file mode 100644 index 0000000000..6d9947bc23 --- /dev/null +++ b/src/isode/h/internet.h @@ -0,0 +1,186 @@ +/* internet.h - TCP/IP abstractions */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:19 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:43 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:37:56 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:45 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _INTERNET_ +#define _INTERNET_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif + +/* SOCKETS */ + +#include "sys/socket.h" + +#ifndef SOMAXCONN +#define SOMAXCONN 5 +#endif + +#if defined(WIN) || defined(WINTLI) +#include "sys/in.h" +#else + +#ifdef SVR4 /* Has a different defn for NULLVP */ +#ifdef NULLVP +#undef NULLVP +#endif +#endif /* SVR4 */ +#include "netinet/in.h" +#ifdef SVR4 /* Put back the ISODE defn */ +#ifdef NULLVP +#undef NULLVP +#endif +#define NULLVP ((char **) 0) +#endif /* SVR4 */ + +#endif /* defined(WIN) || defined(WINTLI) */ + +int start_tcp_client (); +int start_tcp_server (); + +#ifdef SOCKETS +int join_tcp_client (); +int join_tcp_server (); + +#define read_tcp_socket read +#define write_tcp_socket write +#define select_tcp_socket selsocket +#endif + +#ifdef WINTLI +int join_tcp_client (); +int join_tcp_server (); + +#define select_tcp_socket selsocket +#endif + +#ifdef EXOS + +#ifdef SYS5 +#define join_tcp_client(s,f) \ + (accept ((s), (struct sockaddr *) (f)) != NOTOK ? (s) : NOTOK) +#define join_tcp_server(s,t) connect ((s), (struct sockaddr *) (t)) + +#define read_tcp_socket read +#define write_tcp_socket write +#define close_tcp_socket close +#define select_tcp_socket selsocket +#endif +#endif + +int read_tcp_socket (); +int write_tcp_socket (); +int close_tcp_socket (); + +int select_tcp_socket (); + +/* UDP */ + +#ifdef SOCKETS +#ifndef _DGRAM_ +#include "dgram.h" +#endif + +int start_udp_server (); +#define start_udp_client start_udp_server + +#define join_udp_server(fd,sock) \ + join_dgram_aux ((fd), (struct sockaddr *) (sock), 0) +#define join_udp_client(fd,sock) \ + join_dgram_aux ((fd), (struct sockaddr *) (sock), 1) + +#define read_udp_socket read_dgram_socket +#define write_udp_socket write_dgram_socket +#define close_udp_socket close_dgram_socket + +#define select_udp_socket select_dgram_socket +#define check_udp_socket check_dgram_socket +#endif + +/* NETDB */ + +#if defined(SOCKETS) || defined (WINTLI) || defined (WIN) +#include <netdb.h> +#endif + + +#if defined(BIND) && !defined(h_addr) +#define h_addr h_addr_list[0] +#endif + +#define inaddr_copy(hp,sin) \ + bcopy ((hp) -> h_addr, (char *) &((sin) -> sin_addr), (hp) -> h_length) + + +#ifdef EXOS +struct hostent { + char *h_name; /* official name */ + char **h_aliases; /* alias list */ + int h_addrtype; /* address type: AF_INET */ + int h_length; /* address length: sizeof (u_long) == 4 */ + char *h_addr; /* address value: (struct in_addr *) */ +}; + +struct servent { + char *s_name; /* official name */ + char **s_aliases; /* alias list */ + int s_port; /* port number */ + char *s_proto; /* protocol beneath service */ +}; + + +struct hostent *gethostbyaddr (), *gethostbyname (); +struct servent *getservbyname (); +#endif + + +struct hostent *gethostbystring (); + +/* INET */ + +/* under BSD42, we could simply include <arpa/inet.h> instead. However, + the definition of inet_addr contained therein causes problems with some + compilers. */ + +char *inet_ntoa (); +#ifndef DG +u_long inet_addr (); +#ifndef HPUX +u_long inet_network (); +#else +int inet_network (); +#endif +#else +struct in_addr inet_addr (), inet_network (); +#endif +#endif diff --git a/src/isode/h/isoaddrs.h b/src/isode/h/isoaddrs.h new file mode 100644 index 0000000000..baf03152f6 --- /dev/null +++ b/src/isode/h/isoaddrs.h @@ -0,0 +1,287 @@ +/* isoaddrs.h - ISODE addressing */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:21 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:45 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:37:58 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:45 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _ISOADDRS_ +#define _ISOADDRS_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif + +/* */ + +#ifdef NULLPE +typedef struct AEInfo { /* "real" directory services! */ + PE aei_ap_title; + PE aei_ae_qualifier; + + int aei_ap_id; + int aei_ae_id; + + int aei_flags; +#define AEI_NULL 0x00 +#define AEI_AP_ID 0x01 +#define AEI_AE_ID 0x02 +} AEInfo, *AEI; +#define NULLAEI ((AEI) 0) +#define AEIFREE(aei) { \ + if ((aei) -> aei_ap_title) \ + pe_free ((aei) -> aei_ap_title), \ + (aei) -> aei_ap_title = NULLPE; \ + if ((aei) -> aei_ae_qualifier) \ + pe_free ((aei) -> aei_ae_qualifier), \ + (aei) -> aei_ae_qualifier = NULLPE; \ +} + +#define str2aei(d,q) _str2aei ((d), (q), NULLCP, 0, NULLCP, NULLCP) +#define str2aeinfo(string,context,interactive,userdn,passwd) \ + _str2aei ((string), NULLCP, (context), (interactive), (userdn), \ + (passwd)) +AEI _str2aei (); + +char *sprintaei (); +#endif + +/* */ + +struct NSAPaddr { /* this structure shouldn't have holes in it */ + long na_stack; /* TS-stack */ +#define NA_NSAP 0 /* native COTS */ +#define NA_TCP 1 /* RFC1006/TCP */ +#define NA_X25 2 /* TP0/X.25 */ +#define NA_BRG 3 /* TP0-bridge */ + + long na_community; /* internal community # */ +#define SUBNET_REALNS (-1) /* hard-wired */ +#define SUBNET_INT_X25 1 +/* (unused) +#define SUBNET_JANET 2 + */ +#define SUBNET_INTERNET 3 +#define SUBNET_DYNAMIC 100 /* dynamic start here... */ + + union { + struct na_nsap { /* real network service */ +#define NASIZE 64 /* 20 ought to do it */ + char na_nsap_address[NASIZE]; + char na_nsap_addrlen; + } un_na_nsap; + + struct na_tcp { /* emulation via RFC1006 */ +#define NSAP_DOMAINLEN 63 + char na_tcp_domain[NSAP_DOMAINLEN + 1]; + + u_short na_tcp_port; /* non-standard TCP port */ + u_short na_tcp_tset; /* transport set */ +#define NA_TSET_TCP 0x0001 /* .. TCP */ +#define NA_TSET_UDP 0x0002 /* .. UDP */ + } un_na_tcp; + + struct na_x25 { /* X.25 (assume single subnet) */ +#define NSAP_DTELEN 36 + char na_x25_dte[NSAP_DTELEN + 1]; /* Numeric DTE + Link */ + char na_x25_dtelen; /* number of digits used */ + +/* Conventionally, the PID sits at the first head bytes of user data and so + * should probably not be mentioned specially. A macro might do it, if + * necessary. + */ + +#define NPSIZE 4 + char na_x25_pid[NPSIZE]; /* X.25 protocol id */ + char na_x25_pidlen; /* .. */ + +#define CUDFSIZE 16 + char na_x25_cudf[CUDFSIZE];/* call user data field */ + char na_x25_cudflen; /* .. */ +/* + * X25 Facilities field. + */ +#define FACSIZE 6 + char na_x25_fac[FACSIZE]; /* X.25 facilities */ + char na_x25_faclen; /* .. */ + } un_na_x25; + } na_un; +#define na_address na_un.un_na_nsap.na_nsap_address +#define na_addrlen na_un.un_na_nsap.na_nsap_addrlen + +#define na_domain na_un.un_na_tcp.na_tcp_domain +#define na_port na_un.un_na_tcp.na_tcp_port +#define na_tset na_un.un_na_tcp.na_tcp_tset + +#define na_dte na_un.un_na_x25.na_x25_dte +#define na_dtelen na_un.un_na_x25.na_x25_dtelen +#define na_pid na_un.un_na_x25.na_x25_pid +#define na_pidlen na_un.un_na_x25.na_x25_pidlen +#define na_cudf na_un.un_na_x25.na_x25_cudf +#define na_cudflen na_un.un_na_x25.na_x25_cudflen +#define na_fac na_un.un_na_x25.na_x25_fac +#define na_faclen na_un.un_na_x25.na_x25_faclen + +/* for backwards compatibility... these two will be removed after ISODE 7.0 */ +#define na_type na_stack +#define na_subnet na_community +}; +#define NULLNA ((struct NSAPaddr *) 0) + + +struct TSAPaddr { +#define NTADDR 8 /* according to NIST OIW */ + struct NSAPaddr ta_addrs[NTADDR]; /* choice of network addresses */ + int ta_naddr; + +#define TSSIZE 64 + int ta_selectlen; + + union un_ta_type { /* TSAP selector */ + char ta_un_selector[TSSIZE]; + + u_short ta_un_port; + } un_ta; +#define ta_selector un_ta.ta_un_selector +#define ta_port un_ta.ta_un_port +}; +#define NULLTA ((struct TSAPaddr *) 0) + + +struct SSAPaddr { + struct TSAPaddr sa_addr; /* transport address */ + +#define SSSIZE 64 + int sa_selectlen; + + union { /* SSAP selector */ + char sa_un_selector[SSSIZE]; + + u_short sa_un_port; + } un_sa; +#define sa_selector un_sa.sa_un_selector +#define sa_port un_sa.sa_un_port +}; +#define NULLSA ((struct SSAPaddr *) 0) + + +struct PSAPaddr { + struct SSAPaddr pa_addr; /* session address */ + +#define PSSIZE 64 + int pa_selectlen; + + union { /* PSAP selector */ + char pa_un_selector[PSSIZE]; + + u_short pa_un_port; + } un_pa; +#define pa_selector un_pa.pa_un_selector +#define pa_port un_pa.pa_un_port +}; +#define NULLPA ((struct PSAPaddr *) 0) + +struct PSAPaddr *aei2addr (); /* application entity title to PSAPaddr */ + +/* */ + +#ifdef NULLPE +char *alias2name (); + +extern PE (*acsap_lookup) (); +#endif + + +#ifdef NULLOID +struct isoentity { /* for stub directory service */ + OIDentifier ie_identifier; + char *ie_descriptor; + + struct PSAPaddr ie_addr; +}; + +int setisoentity (), endisoentity (); + +struct isoentity *getisoentity (); + +AEI oid2aei (); +#endif + + + /* old-style */ +struct PSAPaddr *is2paddr (); /* service entry to PSAPaddr */ +struct SSAPaddr *is2saddr (); /* service entry to SSAPaddr */ +struct TSAPaddr *is2taddr (); /* service entry to TSAPaddr */ + +/* */ + +struct PSAPaddr *str2paddr (); /* string encoding to PSAPaddr */ +struct SSAPaddr *str2saddr (); /* string encoding to SSAPaddr */ +struct TSAPaddr *str2taddr (); /* string encoding to TSAPaddr */ + +#define paddr2str(pa,na) _paddr2str ((pa), (na), 0) + +char *_paddr2str (); /* PSAPaddr to string encoding */ +char *saddr2str (); /* SSAPaddr to string encoding */ +char *taddr2str (); /* TSAPaddr to string encoding */ + +struct NSAPaddr *na2norm (); /* normalize NSAPaddr */ + +char *na2str (); /* pretty-print NSAPaddr */ +char *pa2str (); /* pretty-print PSAPaddr */ + +/* */ + +int isodeserver (); /* generic server dispatch */ + +int iserver_init (); /* phase 1 */ +int iserver_wait (); /* phase 2 */ +fd_set iserver_mask (); /* linkage */ + +/* */ + +/* all of this really should be in "isoqos.h" ... */ + +struct QOStype { + /* transport QOS */ + int qos_reliability; /* "reliability" element */ +#define HIGH_QUALITY 0 +#define LOW_QUALITY 1 + + /* session QOS */ + int qos_sversion; /* session version required */ + int qos_extended; /* extended control */ + int qos_maxtime; /* for SPM response during S-CONNECT */ +}; +#define NULLQOS ((struct QOStype *) 0) + +#endif diff --git a/src/isode/h/isoservent.h b/src/isode/h/isoservent.h new file mode 100644 index 0000000000..02c7c8a91f --- /dev/null +++ b/src/isode/h/isoservent.h @@ -0,0 +1,64 @@ +/* isoservent.h - ISODE services database access routines */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:23 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:47 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:00 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:46 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _ISOSERVENT_ +#define _ISOSERVENT_ + + +struct isoservent { + char *is_entity; /* name of entity */ + char *is_provider; /* name of service provider */ + +#define ISSIZE 64 /* xSAP selector/ID */ + int is_selectlen; + union { + char is_un_selector[ISSIZE]; + unsigned short is_un_port; + } un_is; +#define is_selector un_is.is_un_selector +#define is_port un_is.is_un_port + + char **is_vec; /* exec vector */ + char **is_tail; /* next free slot in vector */ +}; + + +int setisoservent (), endisoservent (); + +struct isoservent *getisoservent (); + +struct isoservent *getisoserventbyname (); +struct isoservent *getisoserventbyselector (); +struct isoservent *getisoserventbyport (); + +#endif diff --git a/src/isode/h/logger.h b/src/isode/h/logger.h new file mode 100644 index 0000000000..81e2e3b9ad --- /dev/null +++ b/src/isode/h/logger.h @@ -0,0 +1,178 @@ +/* logger.h - logging routines */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:24 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:50 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:02 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:46 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _LOGGER_ +#define _LOGGER_ + +#include "manifest.h" + +/* */ + +typedef struct ll_struct { + char *ll_file; /* path name to logging file */ + + char *ll_hdr; /* text to put in opening line */ + char *ll_dhdr; /* dynamic header - changes */ + + int ll_events; /* interesting events */ +#define LLOG_NONE 0 +#define LLOG_FATAL 0x01 /* fatal errors */ +#define LLOG_EXCEPTIONS 0x02 /* exceptional events */ +#define LLOG_NOTICE 0x04 /* informational notices */ +#define LLOG_PDUS 0x08 /* PDU printing */ +#define LLOG_TRACE 0x10 /* program tracing */ +#define LLOG_DEBUG 0x20 /* full debugging */ +#define LLOG_ALL 0xff +#define LLOG_MASK \ + "\020\01FATAL\02EXCEPTIONS\03NOTICE\04PDUS\05TRACE\06DEBUG" + + int ll_syslog; /* interesting events to send to syslog */ + /* takes same values as ll_events */ + + int ll_msize; /* max size for log, in Kbytes */ + + int ll_stat; /* assorted switches */ +#define LLOGNIL 0x00 +#define LLOGCLS 0x01 /* keep log closed, except when writing */ +#define LLOGCRT 0x02 /* create log if necessary */ +#define LLOGZER 0x04 /* truncate log when limits reached */ +#define LLOGERR 0x08 /* log closed due to (soft) error */ +#define LLOGTTY 0x10 /* also log to stderr */ +#define LLOGHDR 0x20 /* static header allocated */ +#define LLOGDHR 0x40 /* dynamic header allocated */ + + int ll_fd; /* file descriptor */ +} LLog; + +/* */ + +#define SLOG(lp,event,what,args) \ +if (lp -> ll_events & (event)) { \ + (void) ll_log (lp, event, what, "%s", ll_preset args); \ +} \ +else + +#ifndef LLOG +#define LLOG(lp,event,args) SLOG (lp, event, NULLCP, args) +#endif + +#ifdef DEBUG +#define DLOG(lp,event,args) SLOG (lp, event, NULLCP, args) +#else +#define DLOG(lp,event,args) +#endif + + +#ifdef DEBUG + +#ifdef PEPSY_VERSION + +#ifdef __STDC__ + +#define PLOGP(lp,args,pe,text,rw) \ + if ((lp) -> ll_events & LLOG_PDUS) { \ + pvpdu (lp, print_##args##_P, pe, text, rw); \ + } \ + else + +#define PLOG(lp,fnx,pe,text,rw) \ + if ((lp) -> ll_events & LLOG_PDUS) { \ + pvpdu (lp, fnx##_P, pe, text, rw); \ + } \ + else + +#else + +#define PLOGP(lp,args,pe,text,rw) \ + if ((lp) -> ll_events & LLOG_PDUS) { \ + pvpdu (lp, print_/* */args/* */_P, pe, text, rw); \ + } \ + else + +#define PLOG(lp,fnx,pe,text,rw) \ + if ((lp) -> ll_events & LLOG_PDUS) { \ + pvpdu (lp, fnx/* */_P, pe, text, rw); \ + } \ + else + +#endif + +#else /* !PEPSY_VERSION */ + +#define PLOG(lp,fnx,pe,text,rw) \ + if ((lp) -> ll_events & LLOG_PDUS) { \ + vpdu (lp, fnx, pe, text, rw); \ + } \ + else + +#endif /* !PEPSY_VERSION */ + +#ifdef lint +#undef PLOGP +#define pvpdu(lp,cookie,pe,text,rw) \ + _pvpdu(lp, pe, text, rw) +#define PLOGP(lp,args,pe,text,rw) \ + _pvpdu (lp, pe, text, rw); +#endif + +#ifndef PLOGP +#define PLOGP(lp,args,pe,text,rw) \ + if ((lp) -> ll_events & LLOG_PDUS) { \ + pvpdu (lp, 0, (struct modtype *) 0, pe, text, rw); \ + } \ + else +#endif + +#else /* !DEBUG */ +#define PLOG(lp,fnx,pe,text,rw) +#define PLOGP(lp,args,pe,text,rw) +#endif + + +int ll_open (); +int ll_log (), _ll_log (); +int ll_close (); + +void ll_hdinit (); +void ll_dbinit (); + +int ll_printf (); +int ll_sync (); + +char *ll_preset (); + +int ll_check (); + +int ll_defmhdr (); +IFP ll_setmhdr (); +#endif diff --git a/src/isode/h/manifest.h b/src/isode/h/manifest.h new file mode 100644 index 0000000000..d7271844a3 --- /dev/null +++ b/src/isode/h/manifest.h @@ -0,0 +1,344 @@ +/* manifest.h - manifest constants */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:26 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:51 eichin + * autoconfed isode for kerberos work + * + * Revision 1.4 1994/06/03 06:44:53 eichin + * put sys/select.h in correct place + * + * Revision 1.2 1994/06/03 00:55:09 eichin + * new configury (to copy headers to correct place) + * tweak NULLVP to work under svr4 + * + * Revision 1.1 1994/05/31 20:38:06 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:47 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _MANIFEST_ +#define _MANIFEST_ + + /* current ISODE distribution: major*10+minor */ +#define ISODE 70 + +#ifndef _CONFIG_ +#include "config.h" /* system-specific configuration */ +#endif + + +/* target-dependent defines: + + SYS5NLY - target has SYS5 types only, no BSD types + + BSDSIGS - target supports BSD signals + + */ + +#ifdef BSD42 +#undef SYS5NLY +#define BSDSIGS +#endif + + +#ifdef ROS +#undef SYS5NLY +#define BSDSIGS + +#ifndef BSD42 +#define BSD42 +#endif + +#endif + + +#ifdef SYS5 +#define SYS5NLY +#undef BSDSIGS + +#ifdef mc68000 +#undef SYS5NLY +#endif + +#ifdef OSX +#undef SYS5NLY +#endif + +#ifdef XOS_2 +#undef SYS5NLY +#define SIGEMT SIGSEGV +#endif + +#if defined(WIN) || defined (WINTLI) +#undef SYS5NLY +#endif + +#ifdef sun +#undef SYS5NLY +#endif + +#ifdef linux +#undef SYS5NLY +#endif + +#ifdef sgi +#undef SYS5NLY +#endif + +#ifdef SVR4 +#undef SYS5NLY +#endif + +#ifdef HPUX +#undef SYS5NLY +#define BSDSIGS +#undef SIGPOLL +#endif + +#ifdef AIX +#undef SYS5NLY +#define BSDSIGS +#define SIGEMT SIGUSR1 + + +int (*_signal ()) (); + +#define signal _signal +#endif + +#ifdef AUX +#undef SYS5NLY +#define BSDSIGS +#endif +#endif + +#ifdef SVR4 +#ifndef SVR3 +#define SVR3 +#endif +#endif + + +#ifdef NSIG + +#ifndef sigmask +#define sigmask(s) (1 << ((s) - 1)) +#endif + +#ifdef XOS_2 +#define _SIGIO SIGEMT +#else +#ifdef SIGPOLL +#define _SIGIO SIGPOLL +#else +#ifdef SIGUSR1 +#define _SIGIO SIGUSR1 +#else +#define _SIGIO SIGEMT +#endif +#endif +#endif + +typedef int SBV; +#ifndef lint +#define sigioblock() (_iosignals_set ? sigblock (sigmask (_SIGIO)) : 0) +#define sigiomask(s) (_iosignals_set ? sigsetmask (s) : 0) +#else +#define sigioblock() sigblock (sigmask (_SIGIO)) +#define sigiomask(s) sigsetmask (s) +#endif +extern int _iosignals_set; + +#define siginblock() sigblock (sigmask (SIGINT)) +#define siginmask(s) sigsetmask (s) + +#endif + +/* TYPES */ + +#ifndef NOTOK +#define NOTOK (-1) +#define OK 0 +#define DONE 1 +#define CONNECTING_1 OK +#define CONNECTING_2 2 +#endif + +#ifdef SVR4 +#ifdef NULLVP +#undef NULLVP +#endif +#endif + +#ifdef linux +/* + * Unfortunately, ISODE assumes that NULL is 0, instead of ((void *) 0). + * This is wrong, but it's simpler to redefine NULL than to try to + * make all of the changes necessary to fix ISODE. Sigh.... + */ +#undef NULL +#define NULL 0 +#endif + +#ifndef NULLCP +typedef char *CP; +#define NULLCP ((char *) 0) +#ifndef NULLVP +#define NULLVP ((char **) 0) +#endif +#endif + +#ifndef INTDEF +#define INTDEF long +#endif + +typedef INTDEF integer; +#define NULLINT ((integer) 0) +#define NULLINTP ((integer *) 0) + +#ifndef makedev +#include <sys/types.h> +#if defined(WIN) || defined(WINTLI) +#include "sys/inet.h" +#ifndef NFDBITS +typedef struct fd_set { int fds_bits[1]; } fd_set; +#endif +#endif + +#ifdef SYS5NLY +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#endif +#endif + +#ifdef AIX +/* needed for fd_set under AIX --eichin */ +#include <sys/select.h> +#endif + +#ifndef linux +#ifndef FD_SET +#define FD_SETSIZE (sizeof (fd_set) * 8) + +#define FD_SET(f,s) ((s)->fds_bits[0] |= (1 << (f))) +#define FD_CLR(f,s) ((s)->fds_bits[0] &= ~(1 << (f))) +#define FD_ISSET(f,s) ((s)->fds_bits[0] & (1 << (f))) +#define FD_ZERO(s) ((s)->fds_bits[0] = 0) +#endif +#endif + +#define NULLFD ((fd_set *) 0) + + +#undef IP +typedef int *IP; +#define NULLIP ((IP) 0) + + +typedef int (*IFP) (); +#define NULLIFP ((IFP) 0) + + +typedef void (*VFP) (); +#define NULLVFP ((VFP) 0) + + +#ifndef SFD +#if !defined(SVR3) && !defined(SUNOS4) && !defined(BSD44) && !defined(ultrix) && !(defined linux) +#define SFD int +#define SFP IFP +#else +#define SFD void +#define SFP VFP +#endif +#endif + + +struct udvec { /* looks like a BSD iovec... */ + caddr_t uv_base; + int uv_len; + + int uv_inline; +}; + + +struct qbuf { + struct qbuf *qb_forw; /* doubly-linked list */ + struct qbuf *qb_back; /* .. */ + + int qb_len; /* length of data */ + char *qb_data; /* current pointer into data */ + char qb_base[1]; /* extensible... */ +}; + +#define QBFREE(qb) \ +{ \ + register struct qbuf *QB, \ + *QP; \ + \ + for (QB = (qb) -> qb_forw; QB != (qb); QB = QP) { \ + QP = QB -> qb_forw; \ + remque (QB); \ + free ((char *) QB); \ + } \ +} + + +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + + +#if (defined(SYS5) && !defined(linux)) + +#if !defined(WINTLI) && !defined(WIN) +#ifndef sun +#define getdtablesize() _NFILE +#endif +#else +#define getdtablesize() (_NFILE - 1) +#endif + +#endif + +#if defined(RT) || defined (HPUX) +#define ntohs(x) (x) +#define htons(x) (x) +#define ntohl(x) (x) +#define htonl(x) (x) +#endif + +/* POSIX */ + +#ifndef SETSID +#if defined(SUNOS41) || defined(BSD44) +#define SETSID +#endif +#endif + +#endif diff --git a/src/isode/h/mpkt.h b/src/isode/h/mpkt.h new file mode 100644 index 0000000000..f6c20ef4e8 --- /dev/null +++ b/src/isode/h/mpkt.h @@ -0,0 +1,68 @@ +/* mpkt.h - defines the report format for management */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:28 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:53 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:08 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:49 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + +#include "isoaddrs.h" + + +struct MReport { + u_short type; +#define OPREQIN 1 +#define OPREQOUT 2 +#define USERDT 3 +#define USERDR 4 +#define DISCREQ 5 +#define PROTERR 6 +#define CONGEST 7 +#define CONFIGBAD 8 +#define OPREQINBAD 9 +#define OPREQOUTBAD 10 +#define SOURCEADDR 11 +#define STARTLISTEN 12 +#define ENDLISTEN 13 + + long id; /* process id */ + u_short cid; /* connection fd */ + + union { + struct { + int a, b, c, d, e, f; + } gp; + + struct { + int tsel_len; + char tsel[TSSIZE]; + struct NSAPaddr nsap; + } taddr; + } u; +}; + +int TManGen (); diff --git a/src/isode/h/pepdefs.h b/src/isode/h/pepdefs.h new file mode 100644 index 0000000000..9d1d211b17 --- /dev/null +++ b/src/isode/h/pepdefs.h @@ -0,0 +1,56 @@ +/* pepdefs.h */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:30 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:55 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:10 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:49 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef PEPDEF_DEFINITIONS +#define PEPDEF_DEFINITIONS +/* + * Globally known pep definitions + */ + +typedef struct { + char *md_name; /* Name of this module */ + int md_nentries; /* Number of entries */ + tpe **md_etab; /* Pointer to encoding tables */ + tpe **md_dtab; /* Pointer to decoding tables */ + ptpe **md_ptab; /* Pointer to Printing tables */ + PE (*md_eucode)(); /* User code for encoding */ + PE (*md_ducode)(); /* User code for decoding */ + PE (*md_pucode)(); /* User code for printing */ + + } modtyp; + +#ifndef NULL +#define NULL (char *)0 +#endif + +#endif diff --git a/src/isode/h/pepsy.h b/src/isode/h/pepsy.h new file mode 100644 index 0000000000..0ac84b452e --- /dev/null +++ b/src/isode/h/pepsy.h @@ -0,0 +1,237 @@ +/* pepsy.h */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:32 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:57 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:12 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:50 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef PEPSY_DEFINITIONS +#define PEPSY_DEFINITIONS + +#ifndef PEPYPARM +#define PEPYPARM char * +#endif + +/* + * Definitions for pep tables + */ + +#ifdef notdef +typedef struct { + int pe_type; /* Type of entry */ + integer pe_ucode; /* index to user's code if any */ + int pe_tag; /* Tag of this entry if any */ + int pe_flags; /* Flags */ +} tpe; +#define NULLTPE ((tpe *)0) +#endif + +typedef struct { + int pe_type; /* Type of entry */ + integer pe_ucode; /* index to user's code if any */ + int pe_tag; /* Tag of this entry if any */ + int pe_flags; /* Flags */ + char **pe_typename; /* User defined name of variable */ +} ptpe; +#define tpe ptpe +#define NULLTPE ((tpe *)0) +#define NULLPTPE ((ptpe *)0) + +/* extract a pointer from the pointer table */ +#define GPTR(mod, ind, type) ((type )(mod)->md_ptrtab[ind]) +/* tricky situation with the "type" - it must not contain the brackets of the + * cast because we supply them here + */ + +/* macros for getting values of default flexibly */ +#define IVAL(mod, x) ((x)->pe_ucode) /* Integer value */ +#define PVAL(mod, x) (GPTR(mod, (x)->pe_tag, char *)) /* (char *) */ +#define TVAL(mod, x) ((x)->pe_flags) /* Type - Integer value */ +#define RVAL(mod, x) (*GPTR(mod, (x)->pe_tag, double *)) /* double */ + +/* macros for getting the function pointer (for a FN_CALL entry) */ +#define FN_PTR(mod, x) (*GPTR(mod, (x)->pe_ucode, IFP )) /* function ptr */ + +/* macros for getting other more general pointers transparently */ +#define EXT2MOD(mod, x) (GPTR(mod, (x)->pe_ucode, modtyp *)) + +/* Types */ +#define PE_START (-1) +#define PE_END 0 +#define XOBJECT 3 +#define UCODE 6 +#define MEMALLOC 7 +#define SCTRL 8 +#define CH_ACT 9 +#define OPTL 10 /* Optionals field offset */ +#define BOPTIONAL 11 /* optional test for next */ +#define FFN_CALL 12 /* call the free function */ +#define FREE_ONLY 13 /* the next item is only for freeing code */ + +/* types that generate data */ +#define TYPE_DATA 20 + +#define ANY (TYPE_DATA + 0) +#define INTEGER (TYPE_DATA + 1) +#define BOOLEAN (TYPE_DATA + 2) +#define OBJECT (TYPE_DATA + 3) /* This generates data */ +#define BITSTRING (TYPE_DATA + 4) +#define OCTETSTRING (TYPE_DATA + 5) +#define SET_START (TYPE_DATA + 6) +#define SEQ_START (TYPE_DATA + 7) +#define SEQOF_START (TYPE_DATA + 8) +#define SETOF_START (TYPE_DATA + 9) +#define CHOICE_START (TYPE_DATA + 10) +#define REALTYPE (TYPE_DATA + 11) /* ASN.1 Real */ +#define T_NULL (TYPE_DATA + 12) +#define T_OID (TYPE_DATA + 13) +#define ETAG (TYPE_DATA + 14) /*so set_find in pr_set is executed*/ +#define IMP_OBJ (TYPE_DATA + 15) /*so set_find in pr_set is executed*/ +#define EXTOBJ (TYPE_DATA + 16) /* External reference object */ +#define EXTMOD (TYPE_DATA + 17) /* External module for above object */ +#define OBJID (TYPE_DATA + 18) /* Object Identifier */ +#define DFLT_F (TYPE_DATA + 19)/* Default value for following entry */ +#define DFLT_B (TYPE_DATA + 20)/* default value for previous entry */ +#define T_STRING (TYPE_DATA + 21)/* [[ s ptr ]] supporting entry */ +#define OCTET_PTR (TYPE_DATA + 22)/* [[ o ptr $ len]] str entry */ +#define OCTET_LEN (TYPE_DATA + 23)/* [[ o ptr $ len]] len entry */ +#define BITSTR_PTR (TYPE_DATA + 24)/* [[ x ptr $ len]] str entry */ +#define BITSTR_LEN (TYPE_DATA + 25)/* [[ x ptr $ len]] len entry */ +#define FN_CALL (TYPE_DATA + 26)/* call a function to do the work */ + +#if PEPSY_VERSION >= 2 +#define STYPE_DATA (TYPE_DATA + 50) /* Below here are the S* items */ +#else +#define STYPE_DATA (TYPE_DATA + 30) /* Below here are the S* items */ +#endif +/* Optimised - No indirection to cope with ISODE optimisation */ +#define SBITSTRING (STYPE_DATA + 0) /* No offset */ +#define SOBJID (STYPE_DATA + 1) /* Object Identifier - No offset */ +#define SREALTYPE (STYPE_DATA + 2) /* ASN.1 Real */ +#define SANY (STYPE_DATA + 3) +#define SEXTOBJ (STYPE_DATA + 4) /* External reference object */ +#define SOBJECT (STYPE_DATA + 5) /* This generates data */ +#define SOCTETSTRING (STYPE_DATA + 6) /* No offset */ +#define SEXTERNAL (STYPE_DATA + 7) /* External to be encoded */ +#define SSEQ_START (STYPE_DATA + 8) /* SEQUENCE don't indirect */ +#define SSET_START (STYPE_DATA + 9) /* SET don't do an indirection */ +#define SSEQOF_START (STYPE_DATA + 10) /* SEQOF - no indirection */ +#define SSETOF_START (STYPE_DATA + 11) /* SETOF - no indirection */ +#define SCHOICE_START (STYPE_DATA + 12) /* CHOICE - no indirection */ + +#define ISDTYPE(p) (p->pe_type >= TYPE_DATA) + +/* User code indexes */ + +#define NONE 0 /* No User code */ +/* Standard Tags */ + +#define T_BOOL 1 +#define T_INTEGER 2 +#define T_OCTETSTRING 4 +#define T_OBJIDENT 6 +#define T_EXTERNAL 8 +#define T_REAL 9 +#define T_ENUMERATED 10 +#define T_SEQ 16 +#define T_SET 17 +#define T_IA5 22 +#define T_GRAPHIC 25 + +/* Flags */ + +/* Use values 0-3 bottom two bits at the moment */ +/* This has to be changed if the values for the 4 below are changed in ISODE */ +#define FL_CLASS 0xf +/* Class specification */ +#define FL_UNIVERSAL PE_CLASS_UNIV +#define FL_APPLICATION PE_CLASS_APPL +#define FL_CONTEXT PE_CLASS_CONT +#define FL_PRIVATE PE_CLASS_PRIV + + +#define FL_IMPLICIT 0100 +#define FL_DEFAULT 0200 +#define FL_OPTIONAL 0400 + +#define OPTIONAL(p) ((p)->pe_flags & FL_OPTIONAL) +#define DEFAULT(p) ((p)->pe_flags & FL_DEFAULT) + +#define FL_PRTAG 01000 /* only for printing - print the tag */ + +#define PRINT_TAG(p) ((p)->pe_flags & FL_PRTAG) + +#define FL_USELECT 02000 /* user code selects */ + +#define IF_USELECT(p) ((p) -> pe_flags & FL_USELECT) + + +#define CLASS(p) ((PElementClass)((p)->pe_flags & FL_CLASS)) +#define TAG(p) ((PElementID)((p)->pe_tag)) + +/* signed version of above - needed for tag == -1 */ +#define STAG(p) ((p)->pe_tag) + +#define TESTBIT(p, bit) ((p) & (1 << (bit))) +#define SETBIT(p, bit) ((p) |= (1 << (bit))) +#define CLRBIT(p, bit) ((p) &= ~(1 << (bit))) + +/* To support the OPTIONAL << field $ bitno >> construct */ +#define BITTEST(p, bit) (((p)[(bit)/8]) & (0x80 >> (bit) % 8)) +#define BITSET(p, bit) (((p)[(bit)/8]) |= (0x80 >> (bit) % 8)) +#define BITCLR(p, bit) (((p)[(bit)/8]) &= ~(0x80 >> (bit) % 8)) + +/* compute the number of char's required to support x bits */ +#define NBITS2NCHARS(x) (((x) + 7)/8) + +/* + * The module table. One per module which gives access to everything one needs + * to know about the modules types + */ + +typedef struct { + char *md_name; /* Name of this module */ + int md_nentries; /* Number of entries */ + tpe **md_etab; /* Pointer to encoding tables */ + tpe **md_dtab; /* Pointer to decoding tables */ + ptpe **md_ptab; /* Pointer to printing tables */ + int (*md_eucode)(); /* User code for encoding */ + int (*md_ducode)(); /* User code for decoding */ + int (*md_pucode)(); /* User code for printing */ + caddr_t *md_ptrtab; /* pointer table */ + + } modtyp; +#define NULLMODTYP ((modtyp *)0) + + +#define LOTSOFBITS 128 + + +int enc_f (), dec_f (), fre_obj (); +#endif diff --git a/src/isode/h/ppkt.h b/src/isode/h/ppkt.h new file mode 100644 index 0000000000..edd7336c5c --- /dev/null +++ b/src/isode/h/ppkt.h @@ -0,0 +1,303 @@ +/* ppkt.h - include file for presentation providers (PS-PROVIDER) */ + +/* + * $Header$ + * + * RFC1085 (LPP) support contributed by the Wollongong Group, Inc. + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:33 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:17:59 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:14 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:50 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _PSAP2_ +#include "psap2.h" /* definitions for PS-USERs */ +#endif + +#include "ssap.h" /* definitinos for SS-USERs */ + +/* */ + +#define psapPsig(pb, sd) \ +{ \ + if ((pb = findpblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return psaplose (pi, PC_PARAMETER, NULLCP, \ + "invalid presentation descriptor"); \ + } \ + if (!(pb -> pb_flags & PB_CONN)) { \ + (void) sigiomask (smask); \ + return psaplose (pi, PC_OPERATION, NULLCP, \ + "presentation descriptor not connected"); \ + } \ + if (pb -> pb_flags & PB_FINN) { \ + (void) sigiomask (smask); \ + return psaplose (pi, PC_OPERATION, NULLCP, \ + "presentation descriptor finishing"); \ + } \ + if (pb -> pb_flags & PB_RELEASE) { \ + (void) sigiomask (smask); \ + return psaplose (pi, PC_OPERATION, NULLCP, \ + "release in progress"); \ + } \ +} + +#define psapFsig(pb, sd) \ +{ \ + if ((pb = findpblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return psaplose (pi, PC_PARAMETER, NULLCP, \ + "invalid presentation descriptor"); \ + } \ + if (!(pb -> pb_flags & PB_CONN)) { \ + (void) sigiomask (smask); \ + return psaplose (pi, PC_OPERATION, NULLCP, \ + "presentation descriptor not connected"); \ + } \ + if (!(pb -> pb_flags & PB_FINN)) { \ + (void) sigiomask (smask); \ + return psaplose (pi, PC_OPERATION, NULLCP, \ + "presentation descriptor not finishing"); \ + } \ + if (pb -> pb_flags & PB_RELEASE) { \ + (void) sigiomask (smask); \ + return psaplose (pi, PC_OPERATION, NULLCP, \ + "release in progress"); \ + } \ +} + +#define toomuchP(b,n,m,p) \ +{ \ + if (b == NULL) \ + n = 0; \ + else \ + if (n > m) \ + return psaplose (pi, PC_PARAMETER, NULLCP, \ + "too many %s user data elements", p); \ +} + +#ifdef __STDC__ +#define missingP(p) \ +{ \ + if (p == NULL) \ + return psaplose (pi, PC_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", #p); \ +} +#else +#define missingP(p) \ +{ \ + if (p == NULL) \ + return psaplose (pi, PC_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", "p"); \ +} +#endif + +#ifndef lint +#ifndef __STDC__ +#define copyPSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ + bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ +} +#else +#define copyPSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ + bcopy (base, d -> d##_data, d -> d##_cc); \ +} +#endif +#else +#define copyPSAPdata(base,len,d) bcopy (base, (char *) d, len) +#endif + + +#define pylose(p) \ + ppktlose (pb, pi, PC_UNRECOGNIZED, (p), NULLCP, "%s", PY_pepy) + + +int ppktlose (), psaplose (); + +/* */ + +#define DFLT_ASN "iso asn.1 abstract syntax" +#define DFLT_ATN BER + +#if USE_BUILTIN_OIDS +#define DFLT_ASN_OID str2oid ("1.0.8824") +#define DFLT_ATN_OID str2oid ("2.1.1") +#else +#define DFLT_ASN_OID ode2oid (DFLT_ASN) +#define DFLT_ATN_OID ode2oid (DFLT_ATN) +#endif + +#define atn_is_ok(pb,atn) atn_is_ber ((pb), (atn)) +#define atn_is_ber(pb,atn) (!oid_cmp (pb -> pb_ber, atn)) + + +struct psapblk { + struct psapblk *pb_forw; /* doubly-linked list */ + struct psapblk *pb_back; /* .. */ + + int pb_fd; /* session descriptor */ + + short pb_flags; /* our state */ +#define PB_NULL 0x00 +#define PB_CONN 0x01 /* connected */ +#define PB_FINN 0x02 /* other side wants to finish */ +#define PB_ASYN 0x04 /* asynchronous */ +#define PB_DFLT 0x10 /* respond with default context result */ +#define PB_RELEASE 0x20 /* release in progress */ +#define PB_MAGIC 0x40 /* backwards compat hack */ + +#ifndef LPP + char *pb_retry; /* initial/final ppkt */ + char *pb_realbase; + int pb_len; +#else + PE pb_retry; + PE pb_response; + + struct type_PS_SessionConnectionIdentifier *pb_reference; + + PS pb_stream; + + int pb_reliability; + + int pb_maxtries; + int pb_tries; +#endif + + int pb_ncontext; /* presentation context set */ + struct PSAPcontext pb_contexts[NPCTX]; + + OID pb_asn; /* default: abstract syntax name */ + OID pb_atn; /* .. abstract transfer name */ + int pb_dctxid; /* .. id */ + int pb_result; /* response */ + + OID pb_ber; /* BER */ + + int pb_prequirements; /* presentation requirements */ + + int pb_srequirements; /* our session requirements */ + int pb_urequirements; /* user's session requirements */ + int pb_owned; /* session tokens we own */ + int pb_avail; /* session tokens available */ + int pb_ssdusize; /* largest atomic SSDU */ + +#ifdef LPP + struct NSAPaddr pb_initiating; /* initiator */ +#endif + struct PSAPaddr pb_responding; /* responder */ + + IFP pb_DataIndication; /* INDICATION handlers */ + IFP pb_TokenIndication; /* .. */ + IFP pb_SyncIndication; /* .. */ + IFP pb_ActivityIndication; /* .. */ + IFP pb_ReportIndication; /* .. */ + IFP pb_ReleaseIndication; /* .. */ + IFP pb_AbortIndication; /* .. */ + +#ifdef LPP + IFP pb_retryfnx; + IFP pb_closefnx; + IFP pb_selectfnx; + IFP pb_checkfnx; +#endif +}; +#define NULLPB ((struct psapblk *) 0) + +int freepblk (); +struct psapblk *newpblk (), *findpblk (); + +#ifndef LPP +#define PC_PROV_BASE PC_NOTSPECIFIED +#define PC_ABORT_BASE \ + (PC_UNRECOGNIZED - int_PS_Abort__reason_unrecognized__ppdu) +#define PC_REASON_BASE \ + (PC_ABSTRACT - int_PS_provider__reason_abstract__syntax__not__supported) + + +struct type_PS_User__data *info2ppdu (); +int ppdu2info (); + +int info2ssdu (), ssdu2info (), qbuf2info (); + +struct qbuf *info2qb (); +int qb2info (); + +struct type_PS_Identifier__list *silly_list (); + +int ss2pslose (), ss2psabort (); + + +struct pair { + int p_mask; + int p_bitno; +}; + +extern struct pair preq_pairs[], sreq_pairs[]; +#endif + +/* */ + +#define REASON_BASE PC_NOTSPECIFIED + +#ifndef LPP +#define PPDU_NONE (-1) +#define PPDU_CP 0 +#define PPDU_CPA 1 +#define PPDU_CPR 2 +#define PPDU_ARU 3 +#define PPDU_ARP 4 +#define PPDU_TD 7 +#define PPDU_RS 12 +#define PPDU_RSA 13 +#else +#define PR_KERNEL 0x0000 /* kernel (yuk) */ + +#define NPCTX_PS 2 /* maximum number of contexts */ +#define NPDATA_PS 1 /* maximum number of PDVs in a request */ +#define PCI_ROSE 1 /* PCI for SASE using ROSE */ +#define PCI_ACSE 3 /* PCI for ACSE */ + +#define PT_TCP 'T' /* TCP providing backing */ +#define PT_UDP 'U' /* UDP providing backing */ + +#define NULLRF ((struct type_PS_SessionConnectionIdentifier *) 0) + + +#define pslose(pi,reason) \ + (reason != PS_ERR_NONE && reason != PS_ERR_IO \ + ? psaplose ((pi), PC_CONGEST, NULLCP, "%s", ps_error (reason)) \ + : psaplose ((pi), PC_SESSION, NULLCP, NULLCP)) + + +int pdu2sel (), refcmp (); +struct SSAPref *pdu2ref (); +#endif diff --git a/src/isode/h/psap.h b/src/isode/h/psap.h new file mode 100644 index 0000000000..2a1ac51bf9 --- /dev/null +++ b/src/isode/h/psap.h @@ -0,0 +1,654 @@ +/* psap.h - include file for presentation users (PS-USER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:36 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:00 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:16 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:51 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _PSAP_ +#define _PSAP_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif +#include <math.h> + +/* */ + +#ifndef USE_BUILTIN_OIDS +#define USE_BUILTIN_OIDS 1 +#endif + + +typedef struct OIDentifier { + int oid_nelem; /* number of sub-identifiers */ + + unsigned int *oid_elements; /* the (ordered) list of sub-identifiers */ +} OIDentifier, *OID; +#define NULLOID ((OID) 0) + +OID ode2oid (); +int oid_cmp (), elem_cmp (); +OID oid_cpy (); +int oid_free (); +#define oid2ode(i) oid2ode_aux ((i), 1) +char *oid2ode_aux (); +char *sprintoid (); +OID str2oid (); + +/* */ + +typedef u_char PElementClass; + +typedef u_char PElementForm; + +typedef u_short PElementID; /* 0..16383 are meaningful (14 bits) */ +#define PE_ID_BITS 14 + +#define PE_ID(class,code) \ + ((int) ((((code) & 0x3fff) << 2) | ((class) & 0x0003))) + +typedef int PElementLen; + + +typedef u_char byte, *PElementData; +#define NULLPED ((PElementData) 0) + +#define PEDalloc(s) ((PElementData) malloc ((unsigned int) (s))) + +#define PEDrealloc(p, s) ((PElementData) \ + realloc ((char *) (p), (unsigned int) (s))) + +#define PEDfree(p) free ((char *) (p)) + +#define PEDcmp(b1, b2, length) \ + bcmp ((char *) (b1), (char *) (b2), (int) (length)) + +#define PEDcpy(b1, b2, length) \ + bcopy ((char *) (b1), (char *) (b2), (int) (length)) + +/* */ + +typedef struct PElement { + int pe_errno; /* Error codes */ +#define PE_ERR_NONE 0 /* No error */ +#define PE_ERR_OVER 1 /* Overflow */ +#define PE_ERR_NMEM 2 /* Out of memory */ +#define PE_ERR_BIT 3 /* No such bit */ +#define PE_ERR_UTCT 4 /* Malformed universal timestring */ +#define PE_ERR_GENT 5 /* Malformed generalized timestring */ +#define PE_ERR_MBER 6 /* No such member */ +#define PE_ERR_PRIM 7 /* Not a primitive form */ +#define PE_ERR_CONS 8 /* Not a constructor form */ +#define PE_ERR_TYPE 9 /* Class/ID mismatch in constructor */ +#define PE_ERR_OID 10 /* Malformed object identifier */ +#define PE_ERR_BITS 11 /* Malformed bitstring */ +#define PE_ERR_NOSUPP 12 /* Type not supported */ +#define PE_ERR_SIGNED 13 /* Signed integer not expected */ + + /* for the PSAP */ + int pe_context; /* indirect reference */ +#define PE_DFLT_CTX 0 /* the default context */ + +#define PE_ID_XTND 0x1f /* distinguished ID for extension bits */ +#define PE_ID_MORE 0x80 /* more to come flag */ +#define PE_ID_MASK 0x7f /* value in extension byte */ +#define PE_ID_SHIFT 7 + +#define PE_CLASS_MASK 0xc0 /* identifier class bits (8-7) */ +#define PE_CLASS_SHIFT 6 +#define PE_FORM_MASK 0x20 /* identifier form bit (6) */ +#define PE_FORM_SHIFT 5 +#define PE_CODE_MASK 0x1f /* identifier code bits (5-1) + ... */ +#define PE_CODE_SHIFT 0 + + PElementClass pe_class; +#define PE_CLASS_UNIV 0x0 /* Universal */ +#define PE_CLASS_APPL 0x1 /* Application-wide */ +#define PE_CLASS_CONT 0x2 /* Context-specific */ +#define PE_CLASS_PRIV 0x3 /* Private-use */ + + PElementForm pe_form; +#define PE_FORM_PRIM 0x0 /* PRIMitive */ +#define PE_FORM_CONS 0x1 /* CONStructor */ +#define PE_FORM_ICONS 0x2 /* internal: Inline CONStructor */ + + PElementID pe_id; /* should be extensible, 14 bits for now */ + /* Pseudo Types */ +#define PE_UNIV_EOC 0x000 /* End-of-contents */ + + /* Built-in Types */ +#define PE_PRIM_BOOL 0x001 /* Boolean */ +#define PE_PRIM_INT 0x002 /* Integer */ +#define PE_PRIM_BITS 0x003 /* Bitstring */ +#define PE_PRIM_OCTS 0x004 /* Octetstring */ +#define PE_PRIM_NULL 0x005 /* Null */ +#define PE_PRIM_OID 0x006 /* Object identifier */ +#define PE_PRIM_ODE 0x007 /* Object descriptor */ +#define PE_CONS_EXTN 0x008 /* External */ +#define PE_PRIM_REAL 0x009 /* Real */ +#define PE_PRIM_ENUM 0x00a /* Enumerated type */ +#define PE_PRIM_ENCR 0x00b /* Encrypted */ +#define PE_CONS_SEQ 0x010 /* Sequence */ +#define PE_CONS_SET 0x011 /* Set */ + + /* Defined Types */ +#define PE_DEFN_NUMS 0x012 /* Numeric String */ +#define PE_DEFN_PRTS 0x013 /* Printable String */ +#define PE_DEFN_T61S 0x014 /* T.61 String */ +#define PE_DEFN_VTXS 0x015 /* Videotex String */ +#define PE_DEFN_IA5S 0x016 /* IA5 String */ +#define PE_DEFN_UTCT 0x017 /* UTC Time */ +#define PE_DEFN_GENT 0x018 /* Generalized Time */ +#define PE_DEFN_GFXS 0x019 /* Graphics string (ISO2375) */ +#define PE_DEFN_VISS 0x01a /* Visible string */ +#define PE_DEFN_GENS 0x01b /* General string */ +#define PE_DEFN_CHRS 0x01c /* Character string */ + + PElementLen pe_len; +#define PE_LEN_XTND 0x80 /* long or indefinite form */ +#define PE_LEN_SMAX 127 /* largest short form */ +#define PE_LEN_MASK 0x7f /* mask to get number of bytes in length */ +#define PE_LEN_INDF (-1) /* indefinite length */ + + PElementLen pe_ilen; + + union { + PElementData un_pe_prim; /* PRIMitive value */ + struct PElement *un_pe_cons; /* CONStructor head */ + } pe_un1; +#define pe_prim pe_un1.un_pe_prim +#define pe_cons pe_un1.un_pe_cons + + union { + int un_pe_cardinal; /* cardinality of list */ + int un_pe_nbits; /* number of bits in string */ + } pe_un2; +#define pe_cardinal pe_un2.un_pe_cardinal +#define pe_nbits pe_un2.un_pe_nbits + + int pe_inline; /* for "ultra-efficient" PElements */ + char *pe_realbase; /* .. */ + + int pe_offset; /* offset of element in sequence */ + + struct PElement *pe_next; + + int pe_refcnt; /* hack for ANYs in pepy */ + +#ifdef DEBUG + struct PElement *pe_link; /* malloc debugging... */ +#endif +} PElement, *PE; +#define NULLPE ((PE) 0) +#define NULLPEP ((PE *) 0) + +#define pe_seterr(pe, e, v) ((pe) -> pe_errno = (e), (v)) + + +extern int pe_allocs; +extern int pe_frees; +extern int pe_most; +extern PE pe_list; +#ifdef DEBUG +extern PE pe_active; +#endif + +PE pe_alloc (); +int pe_free (); +int pe_cmp (); +PE pe_cpy (); +int pe_pullup (); +PE pe_expunge (); +int pe_extract (); + +PE str2pe (); +PE qb2pe (); + +extern int pe_maxclass; +extern char *pe_classlist[]; + +extern int pe_maxuniv; +extern char *pe_univlist[]; + +extern int pe_maxappl; +extern char **pe_applist; + +extern int pe_maxpriv; +extern char **pe_privlist; + +/* */ + +typedef struct UTCtime { + int ut_year; + int ut_mon; + int ut_mday; + int ut_hour; + int ut_min; + int ut_sec; + + int ut_usec; + + int ut_zone; + + int ut_flags; +#define UT_NULL 0x00 +#define UT_ZONE 0x01 +#define UT_SEC 0x02 +#define UT_USEC 0x04 +} UTCtime, *UTC; +#define NULLUTC ((UTC) 0) + + +void tm2ut (); +long gtime (); +struct tm *ut2tm (); + +/* */ + +extern char *psapversion; + + +int prim2flag (); +PE flag2prim (); +#define bool2prim(b) flag2prim ((b), PE_CLASS_UNIV, PE_PRIM_BOOL) + +integer prim2num (); +PE num2prim (); +#define int2prim(i) num2prim ((integer) (i), PE_CLASS_UNIV, PE_PRIM_INT) + + +#define prim2enum(i) prim2num((i)) +#define enum2prim(a,b,c) num2prim((a), (b), (c)) +#define enumint2prim(i) enum2prim ((i), PE_CLASS_UNIV, PE_PRIM_ENUM) + + +/* psap REAL parameters - tons of 'em */ +#define PE_REAL_FLAGS 0300 /* flag bits of real */ +#define PE_REAL_BINENC 0200 /* binary encoding */ +#define PE_REAL_DECENC 0000 /* decimal encoding */ +#define PE_REAL_SPECENC 0100 /* special encoding */ + +#define PE_REAL_B_S 0100 /* sign bit */ +#define PE_REAL_B_BASE 0060 /* base bits */ +#define PE_REAL_B_B2 0000 +#define PE_REAL_B_B8 0020 +#define PE_REAL_B_B16 0040 + +#define PE_REAL_B_F 0014 /* factor bits */ +#define PE_REAL_B_EXP 0003 /* exponent type bits */ +#define PE_REAL_B_EF1 0000 +#define PE_REAL_B_EF2 0001 +#define PE_REAL_B_EF3 0002 +#define PE_REAL_B_EF4 0003 + +#define PE_REAL_PLUSINF 0200 +#define PE_REAL_MINUSINF 0201 + +#ifndef HUGE +#ifdef MAXFLOAT +#define PE_REAL_INFINITY MAXFLOAT +#else +#define PE_REAL_INFINITY 99.e99 +#endif +#else +#define PE_REAL_INFINITY HUGE +#endif + +double prim2real (); +PE real2prim (); +#define double2prim(i) real2prim ((i), PE_CLASS_UNIV, PE_PRIM_REAL) + + +char *prim2str (); +PE str2prim (); +struct qbuf *prim2qb (); +PE qb2prim_aux (); /* really should be qb2pe () */ +#define qb2prim(q,c,i) qb2prim_aux ((q), (c), (i), 0) +#define oct2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_PRIM_OCTS) +#define ia5s2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_IA5S) +#define nums2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_NUMS) +#define prts2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_PRTS) +#define t61s2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_T61S) +#define vtxs2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_VTXS) +#define gfxs2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_GFXS) +#define viss2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_VISS) +#define gens2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_GENS) +#define chrs2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_DEFN_CHRS) +#define ode2prim(s,len) str2prim ((s), (len), \ + PE_CLASS_UNIV, PE_PRIM_ODE) + +PE prim2bit (); +PE bit2prim (); + +int bit_on (), bit_off (); +int bit_test (); + +OID prim2oid (); +PE obj2prim (); +#define oid2prim(o) obj2prim ((o), PE_CLASS_UNIV, PE_PRIM_OID) + +UTC prim2time (); +#define prim2utct(pe) prim2time ((pe), 0) +#define prim2gent(pe) prim2time ((pe), 1) +PE time2prim (); +#define utct2prim(u) time2prim ((u), 0, PE_CLASS_UNIV, PE_DEFN_UTCT) +#define gent2prim(u) time2prim ((u), 1, PE_CLASS_UNIV, PE_DEFN_GENT) +char *time2str (); +#define utct2str(u) time2str ((u), 0) +#define gent2str(u) time2str ((u), 1) +UTC str2utct (), str2gent (); + +PE prim2set (); +#define set2prim(pe) (pe) +int set_add (), set_addon (), set_del (); +PE set_find (); +#define first_member(pe) ((pe) -> pe_cons) +#define next_member(pe,p) ((p) -> pe_next) + +#define prim2seq(pe) (prim2set (pe)) +#define seq2prim(pe) (pe) +int seq_add (), seq_addon (), seq_del (); +PE seq_find (); + + +char *pe_error (); + +/* */ + +#ifdef SVR4_UCB +#ifdef PS /* ucb define PS in sys/sparc/reg.h for "portability" !?! */ +#undef PS +#endif +#endif + +typedef struct { + int ps_errno; /* Error codes */ +#define PS_ERR_NONE 0 /* No error */ +#define PS_ERR_OVERID 1 /* Overflow in ID */ +#define PS_ERR_OVERLEN 2 /* Overflow in length */ +#define PS_ERR_NMEM 3 /* Out of memory */ +#define PS_ERR_EOF 4 /* End of file */ +#define PS_ERR_EOFID 5 /* End of file reading extended ID */ +#define PS_ERR_EOFLEN 6 /* End of file reading extended length */ +#define PS_ERR_LEN 7 /* Length mismatch */ +#define PS_ERR_TRNC 8 /* Truncated */ +#define PS_ERR_INDF 9 /* Indefinite length in primitive form */ +#define PS_ERR_IO 10 /* I/O error */ +#define PS_ERR_EXTRA 11 /* Extraneous octets */ +#define PS_ERR_XXX 12 /* XXX */ + + union { + caddr_t un_ps_addr; + struct { + char *st_ps_base; + int st_ps_cnt; + char *st_ps_ptr; + int st_ps_bufsiz; + } un_ps_st; + struct { + struct udvec *uv_ps_head; + struct udvec *uv_ps_cur; + struct udvec *uv_ps_end; + int uv_ps_elems; + int uv_ps_slop; + int uv_ps_cc; + } un_ps_uv; + } ps_un; +#define ps_addr ps_un.un_ps_addr +#define ps_base ps_un.un_ps_st.st_ps_base +#define ps_cnt ps_un.un_ps_st.st_ps_cnt +#define ps_ptr ps_un.un_ps_st.st_ps_ptr +#define ps_bufsiz ps_un.un_ps_st.st_ps_bufsiz +#define ps_head ps_un.un_ps_uv.uv_ps_head +#define ps_cur ps_un.un_ps_uv.uv_ps_cur +#define ps_end ps_un.un_ps_uv.uv_ps_end +#define ps_elems ps_un.un_ps_uv.uv_ps_elems +#define ps_slop ps_un.un_ps_uv.uv_ps_slop +#define ps_cc ps_un.un_ps_uv.uv_ps_cc + + caddr_t ps_extra; /* for George's recursive PStreams */ + + int ps_inline; /* for "ultra-efficient" PStreams */ + + int ps_scratch; /* XXX */ + + int ps_byteno; /* byte position */ + + IFP ps_primeP; + IFP ps_readP; + IFP ps_writeP; + IFP ps_flushP; + IFP ps_closeP; +} PStream, *PS; +#define NULLPS ((PS) 0) + +#define ps_seterr(ps, e, v) ((ps) -> ps_errno = (e), (v)) + + +PS ps_alloc (); +void ps_free (); + +int ps_io (); +#define ps_read(ps, data, cc) ps_io ((ps), (ps) -> ps_readP, (data), (cc), 0) +#define ps_write(ps, data, cc) ps_write_aux ((ps), (data), (cc), 0) +#define ps_write_aux(ps, data, cc, in_line) \ + ps_io ((ps), (ps) -> ps_writeP, (data), (cc), (in_line)) + +int ps_flush (); + +int std_open (); +#define std_setup(ps, fp) ((ps) -> ps_addr = (caddr_t) (fp), OK) + +int str_open (); +int str_setup (); + +int dg_open (); +int dg_setup (); + +int fdx_open (); +int fdx_setup (); + +int qbuf_open (); +#define qbuf_setup(ps, qb) ((ps) -> ps_addr = (caddr_t) (qb), OK) + +#define ts_open dg_open +#define ts_setup(p,f,s) dg_setup ((p), (f), (s), ts_read, ts_write) +int ts_read (), ts_write (); + +int uvec_open (); +int uvec_setup (); + + +#define ps2pe(ps) ps2pe_aux ((ps), 1, 1) +PE ps2pe_aux (); +#define pe2ps(ps, pe) pe2ps_aux ((ps), (pe), 1) +int pe2ps_aux (); + + +PE pl2pe (); +int pe2pl (); + + +extern int ps_len_strategy; +#define PS_LEN_SPAG 0 +#define PS_LEN_INDF 1 +#define PS_LEN_LONG 2 + +int ps_get_abs (); + + +char *ps_error (); + +/* */ + +struct isobject { + char *io_descriptor; + + OIDentifier io_identity; +}; + +int setisobject (), endisobject (); + +struct isobject *getisobject (); + +struct isobject *getisobjectbyname (); +struct isobject *getisobjectbyoid (); + +/* */ + +extern int Len; +extern char *Qcp; +extern char *Ecp; + +int pe2qb_f (); + + +extern int Byteno; +extern int Qbrefs; +extern struct qbuf *Hqb; +extern struct qbuf *Fqb; +extern struct qbuf *Qb; + +#define qbuf2pe(qb, len, result) (Byteno = 0, Hqb = qb, \ + Fqb = (Qb = (qb) -> qb_forw), \ + qbuf2pe_f (result)) +PE qbuf2pe_f (); +char *qb2str (); +struct qbuf *str2qb (); +int qb_free (); + +int pe2ssdu (); +PE ssdu2pe (); + +void pe2text (), text2pe (); + +int pe2uvec (); + +char *int2strb (); +int strb2int (); + +PE strb2bitstr (); +char *bitstr2strb (); + +/* */ + +extern char PY_pepy[]; + +void PY_advise (); +int PY_pp (); + +int testdebug (); + +int vpush (), vpop (); +int vname (), vtag (); +int vprint (); +int vstring (), vunknown (); + +char *bit2str (); + +int vpushfp (), vpopfp (); + +int vpushstr (), vpopstr (); + +int vpushpp (), vpopp (); + +#ifdef PEPSY_VERSION +/* handle calls to the vunknown print routine */ +#define vunknown_P 0, ((modtyp *) 0) + +/* + * vpdu now comes out of the closet as a real pepsy function "pvpdu" we + * keep the #define for vpdu for backwards compatiability of other peoples' + * code + */ +#ifdef __STDC__ +#define vpdu(lp,fnx,pe,text,rw) \ +{ \ + pvpdu ((lp), fnx##_P, (pe), (text), (rw)); \ +} +#else /* __STDC__ */ +#define vpdu(lp,fnx,pe,text,rw) \ +{ \ + pvpdu ((lp), fnx/**/_P, (pe), (text), (rw)); \ +} +#endif /* __STDC__ */ + +#else + /* Backwards compatibility with posy/pepy */ +#define vpdu(lp,fnx,pe,text,rw) \ +{ \ + int fnx (); \ + \ + _vpdu ((lp), fnx, (pe), (text), (rw)); \ +} + +int _vpdu (); +#endif + +/* pepy string definitions */ +extern char *pepy_strings[]; + +#define PEPY_ERR_BAD (pepy_strings[0]) +#define PEPY_ERR_BAD_BITS (pepy_strings[1]) +#define PEPY_ERR_BAD_BOOLEAN (pepy_strings[2]) +#define PEPY_ERR_BAD_CLASS (pepy_strings[3]) +#define PEPY_ERR_BAD_CLASS_FORM_ID (pepy_strings[4]) +#define PEPY_ERR_BAD_FORM (pepy_strings[5]) +#define PEPY_ERR_BAD_INTEGER (pepy_strings[6]) +#define PEPY_ERR_BAD_OID (pepy_strings[7]) +#define PEPY_ERR_BAD_OCTET (pepy_strings[8]) +#define PEPY_ERR_BAD_REAL (pepy_strings[9]) +#define PEPY_ERR_BAD_SEQ (pepy_strings[10]) +#define PEPY_ERR_BAD_SET (pepy_strings[11]) +#define PEPY_ERR_TOO_MANY_BITS (pepy_strings[12]) +#define PEPY_ERR_TOO_MANY_ELEMENTS (pepy_strings[13]) +#define PEPY_ERR_UNKNOWN_CHOICE (pepy_strings[14]) +#define PEPY_ERR_UNK_COMP (pepy_strings[15]) +#define PEPY_ERR_INIT_FAILED (pepy_strings[16]) +#define PEPY_ERR_INVALID_CHOICE (pepy_strings[17]) +#define PEPY_ERR_MISSING (pepy_strings[18]) +#define PEPY_ERR_NOMEM (pepy_strings[19]) +#define PEPY_ERR_TOO_MANY_TAGGED (pepy_strings[20]) +#define PEPY_ERR_EXTRA_MEMBERS (pepy_strings[21]) + +#endif diff --git a/src/isode/h/psap2.h b/src/isode/h/psap2.h new file mode 100644 index 0000000000..d9b33edb58 --- /dev/null +++ b/src/isode/h/psap2.h @@ -0,0 +1,539 @@ +/* psap2.h - include file for presentation users (PS-USER) continued */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:38 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:03 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:18 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:51 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _PSAP2_ +#define _PSAP2_ + +#ifndef _PSAP_ +#include "psap.h" /* definitions for PS-USERs */ +#endif +#ifndef _SSAP_ +#include "ssap.h" /* definitions for SS-USERs */ +#endif +#ifndef _ISOADDRS_ +#include "isoaddrs.h" /* definitions of ISO addresses */ +#endif + +/* */ + +#define NPDATA 125 /* arbitrary */ + + +struct PSAPcontext { /* presentation context */ + int pc_id; /* identifier */ + + OID pc_asn; /* abstract syntax name */ + + OID pc_atn; /* abstract transfer name */ + /* NULLOID if provider should handle it */ + + int pc_result; /* same codes as pc_result below */ +}; + +struct PSAPctxlist { /* list of presentation contexts */ + int pc_nctx; /* number of contexts */ + +#define NPCTX 10 /* arbitrary */ + struct PSAPcontext pc_ctx[NPCTX]; +}; +#define NULLPC ((struct PSAPctxlist *) 0) + + +#define BER "basic encoding of a single asn.1 type" + +#if USE_BUILTIN_OIDS +#define BER_OID str2oid ("2.1.1") +#else +#define BER_OID ode2oid (BER) +#endif + + +struct SSAPref *addr2ref (); /* address to session reference */ + +char *sprintref (); /* return session reference in string form */ + +/* */ + +struct PSAPstart { /* P-CONNECT.INDICATION */ + int ps_sd; /* PRESENTATION descriptor */ + + + struct PSAPaddr ps_calling; /* address of peer calling */ + struct PSAPaddr ps_called; /* address of peer called */ + + struct PSAPctxlist ps_ctxlist;/* list of proposed contexts */ + + OID ps_defctx; /* name of proposed default context */ + int ps_defctxresult; /* what the provider thinks about it */ + + int ps_prequirements; /* presentation requirements */ + + int ps_srequirements; /* session requirements */ + int ps_settings; /* initial settings of tokens */ + long ps_isn; /* initial serial number */ + + struct SSAPref ps_connect; /* session connection identifier */ + + int ps_ssdusize; /* largest atomic SSDU */ + + struct QOStype ps_qos; /* quality of service */ + + /* initial data from peer */ + int ps_ninfo; /* number of elements */ + PE ps_info[NPDATA]; /* data */ +}; +#define PSFREE(ps) \ +{ \ + register int PSI; \ + \ + for (PSI = (ps) -> ps_ctxlist.pc_nctx - 1; PSI >= 0; PSI--) { \ + oid_free ((ps) -> ps_ctxlist.pc_ctx[PSI].pc_asn); \ + oid_free ((ps) -> ps_ctxlist.pc_ctx[PSI].pc_atn); \ + (ps) -> ps_ctxlist.pc_ctx[PSI].pc_asn = \ + (ps) -> ps_ctxlist.pc_ctx[PSI].pc_atn = NULLOID; \ + } \ + (ps) -> ps_ctxlist.pc_nctx = 0; \ + if ((ps) -> ps_defctx) \ + oid_free ((ps) -> ps_defctx), (ps) -> ps_defctx = NULLOID; \ + for (PSI = (ps) -> ps_ninfo - 1; PSI >= 0; PSI--) \ + if ((ps) -> ps_info[PSI]) \ + pe_free ((ps) -> ps_info[PSI]), (ps) -> ps_info[PSI] = NULLPE; \ + (ps) -> ps_ninfo = 0; \ +} + + +struct PSAPconnect { /* P-CONNECT.CONFIRMATION */ + int pc_sd; /* PRESENTATION descriptor */ + + struct PSAPaddr pc_responding;/* address of peer responding */ + + struct PSAPctxlist pc_ctxlist;/* the list of negotiated contexts */ + + int pc_defctxresult; /* result for proposed default context name */ + + int pc_prequirements; /* presentation requirements */ + + int pc_srequirements; /* session requirements */ + int pc_settings; /* initial settings of tokens */ + int pc_please; /* tokens requested by PS-user */ + long pc_isn; /* initial serial number */ + + struct SSAPref pc_connect; /* session connection identifier */ + + int pc_ssdusize; /* largest atomic SSDU */ + + struct QOStype pc_qos; /* quality of service */ + + int pc_result; /* result */ +#define PC_ACCEPT (-1) + +#define PC_REJECTED 0 /* Rejected by peer */ + /* Provider-reason */ +#define PC_NOTSPECIFIED 1 /* Reason not specified */ +#define PC_CONGEST 2 /* Temporary congestion */ +#define PC_EXCEEDED 3 /* Local limit exceeded */ +#define PC_ADDRESS 4 /* Called presentation address unknown */ +#define PC_VERSION 5 /* Protocol version not supported */ +#define PC_DEFAULT 6 /* Default context not supported */ +#define PC_READABLE 7 /* User-data not readable */ +#define PC_AVAILABLE 8 /* No PSAP available */ + /* Abort-reason */ +#define PC_UNRECOGNIZED 9 /* Unrecognized PPDU */ +#define PC_UNEXPECTED 10 /* Unexpected PPDU */ +#define PC_SSPRIMITIVE 11 /* Unexpected session service primitive */ +#define PC_PPPARAM1 12 /* Unrecognized PPDU parameter */ +#define PC_PPPARAM2 13 /* Unexpected PPDU parameter */ +#define PC_INVALID 14 /* Invalid PPDU parameter value */ + /* Provider-reason */ +#define PC_ABSTRACT 15 /* Abstract syntax not supported */ +#define PC_TRANSFER 16 /* Proposed transfer syntaxes not supported */ +#define PC_DCSLIMIT 17 /* Local limit on DCS exceeded */ + /* begin UNOFFICIAL */ +#define PC_REFUSED 18 /* Connect request refused on this network + connection */ +#define PC_SESSION 19 /* Session disconnect */ +#define PC_PROTOCOL 20 /* Protocol error */ +#define PC_ABORTED 21 /* Peer aborted connection */ +#define PC_PARAMETER 22 /* Invalid parameter */ +#define PC_OPERATION 23 /* Invalid operation */ +#define PC_TIMER 24 /* Timer expired */ +#define PC_WAITING 25 /* Indications waiting */ + /* end UNOFFICIAL */ + +#define PC_FATAL(r) ((r) < PC_PARAMETER) +#define PC_OFFICIAL(r) ((r) < PC_REFUSED) + + /* initial data from peer */ + int pc_ninfo; /* number of elements */ + PE pc_info[NPDATA]; /* data */ +}; +#define PCFREE(pc) \ +{ \ + register int PCI; \ + \ + for (PCI = (pc) -> pc_ctxlist.pc_nctx - 1; PCI >= 0; PCI--) { \ + oid_free ((pc) -> pc_ctxlist.pc_ctx[PCI].pc_asn); \ + oid_free ((pc) -> pc_ctxlist.pc_ctx[PCI].pc_atn); \ + (pc) -> pc_ctxlist.pc_ctx[PCI].pc_asn = \ + (pc) -> pc_ctxlist.pc_ctx[PCI].pc_atn = NULLOID; \ + } \ + (pc) -> pc_ctxlist.pc_nctx = 0; \ + for (PCI = (pc) -> pc_ninfo - 1; PCI >= 0; PCI--) \ + if ((pc) -> pc_info[PCI]) \ + pe_free ((pc) -> pc_info[PCI]), (pc) -> pc_info[PCI] = NULLPE; \ + (pc) -> pc_ninfo = 0; \ +} + + + /* PRESENTATION requirements */ +#define PR_MANAGEMENT 0x0001 /* context management */ +#define PR_RESTORATION 0x0002 /* context restoration */ + +#define PR_MYREQUIRE 0x0000 + + +struct PSAPdata { /* P-READ.INDICATION */ + int px_type; /* type of indication */ + /* same values as sx_type */ + + int px_ninfo; /* number of elements */ + PE px_info[NPDATA]; /* data */ +}; +#define PXFREE(px) \ +{ \ + register int PXI; \ + \ + for (PXI = (px) -> px_ninfo - 1; PXI >= 0; PXI--) \ + if ((px) -> px_info[PXI]) \ + pe_free ((px) -> px_info[PXI]), (px) -> px_info[PXI] = NULLPE; \ + (px) -> px_ninfo = 0; \ +} + + +struct PSAPtoken { /* P-{TOKEN-*,GIVE-CONTROL}.INDICATION */ + int pt_type; /* type of indication */ + /* same values as st_type */ + + u_char pt_tokens; /* tokens offered/wanted */ + /* same values as st_tokens */ + + u_char pt_owned; /* tokens owned by user */ + + + /* PLEASE TOKEN only */ + int pt_ninfo; /* number of elements */ + PE pt_info[NPDATA]; /* data */ +}; +#define PTFREE(pt) \ +{ \ + register int PTI; \ + \ + for (PTI = (pt) -> pt_ninfo - 1; PTI >= 0; PTI--) \ + if ((pt) -> pt_info[PTI]) \ + pe_free ((pt) -> pt_info[PTI]), (pt) -> pt_info[PTI] = NULLPE; \ + (pt) -> pt_ninfo = 0; \ +} + + +struct PSAPsync { /* P-*-SYNC.{INDICATION,CONFIRMATION} */ + int pn_type; /* type of indication/confirmation */ + /* same values as sn_type */ + + int pn_options; /* options (!!) */ + /* same values as sn_options */ + + long pn_ssn; /* serial number */ + /* same values as sn_ssn */ + + int pn_settings; /* new token settings (RESYNC only) */ + + /* sync data from peer */ + int pn_ninfo; /* number of elements */ + PE pn_info[NPDATA]; /* data */ +}; +#define PNFREE(pn) \ +{ \ + register int PNI; \ + \ + for (PNI = (pn) -> pn_ninfo - 1; PNI >= 0; PNI--) \ + if ((pn) -> pn_info[PNI]) \ + pe_free ((pn) -> pn_info[PNI]), (pn) -> pn_info[PNI] = NULLPE; \ + (pn) -> pn_ninfo = 0; \ +} + + +struct PSAPactivity { /* P-ACTIVITY-*.{INDICATION,CONFIRMATION} */ + int pv_type; /* type of indication/confirmation */ + /* same values as sv_type */ + + struct SSAPactid pv_id; /* START/RESUME activity identifier */ + + struct SSAPactid pv_oid; /* RESUME old activity identifier */ + struct SSAPref pv_connect;/* old connection identifier */ + + long pv_ssn; /* RESUME/END Serial number */ + + int pv_reason; /* INTERRUPT/DISCARD */ + /* same values as sp_reason */ + + /* activity DATA from peer */ + int pv_ninfo; /* number of elements */ + PE pv_info[NPDATA]; /* data */ +}; +#define PVFREE(pv) \ +{ \ + register int PVI; \ + \ + for (PVI = (pv) -> pv_ninfo - 1; PVI >= 0; PVI--) \ + if ((pv) -> pv_info[PVI]) \ + pe_free ((pv) -> pv_info[PVI]), (pv) -> pv_info[PVI] = NULLPE; \ + (pv) -> pv_ninfo = 0; \ +} + + +struct PSAPreport { /* P-{U,P}-EXCEPTION-REPORT.INDICATION */ + int pp_peer; /* T = P-U-EXCEPTION-REPORT.INDICATION: + pp_reason/pp_info both meaningful + NIL = P-P-EXCEPTION-REPORT.INDICATION: + pp_reason == SP_NOREASON, or + pp_reason == SP_PROTOCOL */ + int pp_reason; /* same values as sp_reason */ + + /* report DATA from peer */ + int pp_ninfo; /* number of elements */ + PE pp_info[NPDATA]; /* data */ +}; +#define PPFREE(pp) \ +{ \ + register int PPI; \ + \ + for (PPI = (pp) -> pp_ninfo - 1; PPI >= 0; PPI--) \ + if ((pp) -> pp_info[PPI]) \ + pe_free ((pp) -> pp_info[PPI]), (pp) -> pp_info[PPI] = NULLPE; \ + (pp) -> pp_ninfo = 0; \ +} + + +struct PSAPfinish { /* P-RELEASE.INDICATION */ + /* release DATA from peer */ + int pf_ninfo; /* number of elements */ + PE pf_info[NPDATA]; /* data */ +}; +#define PFFREE(pf) \ +{ \ + register int PFI; \ + \ + for (PFI = (pf) -> pf_ninfo - 1; PFI >= 0; PFI--) \ + if ((pf) -> pf_info[PFI]) \ + pe_free ((pf) -> pf_info[PFI]), (pf) -> pf_info[PFI] = NULLPE; \ + (pf) -> pf_ninfo = 0; \ +} + + +struct PSAPrelease { /* P-RELEASE.CONFIRMATION */ + int pr_affirmative; /* T = connection released + NIL = request refused */ + + /* release DATA from peer */ + int pr_ninfo; /* number of elements */ + PE pr_info[NPDATA]; /* data */ +}; +#define PRFREE(pr) \ +{ \ + register int PRI; \ + \ + for (PRI = (pr) -> pr_ninfo - 1; PRI >= 0; PRI--) \ + if ((pr) -> pr_info[PRI]) \ + pe_free ((pr) -> pr_info[PRI]), (pr) -> pr_info[PRI] = NULLPE; \ + (pr) -> pr_ninfo = 0; \ +} + + +struct PSAPabort { /* P-{U,P}-ABORT.INDICATION */ + int pa_peer; /* T = P-U-ABORT.INDICATION: + pa_info/pa_ninfo is meaningful + NIL = P-P-ABORT.INDICATION: + pa_reason/pa_ppdu is meaningful, + pa_data contains diagnostics */ + + int pa_reason; /* same codes as pc_result */ + + /* abort information from peer */ + int pa_ninfo; /* number of elements */ + PE pa_info[NPDATA]; /* data */ + + /* diagnostics from provider */ +#define PA_SIZE 512 + int pa_cc; /* length */ + char pa_data[PA_SIZE]; /* data */ +}; +#define PAFREE(pa) \ +{ \ + register int PAI; \ + \ + for (PAI = (pa) -> pa_ninfo - 1; PAI >= 0; PAI--) \ + if ((pa) -> pa_info[PAI]) \ + pe_free ((pa) -> pa_info[PAI]), (pa) -> pa_info[PAI] = NULLPE; \ + (pa) -> pa_ninfo = 0; \ +} + + +struct PSAPindication { + int pi_type; /* the union element present */ +#define PI_DATA 0x00 +#define PI_TOKEN 0x01 +#define PI_SYNC 0x02 +#define PI_ACTIVITY 0x03 +#define PI_REPORT 0x04 +#define PI_FINISH 0x05 +#define PI_ABORT 0x06 + + union { + struct PSAPdata pi_un_data; + struct PSAPtoken pi_un_token; + struct PSAPsync pi_un_sync; + struct PSAPactivity pi_un_activity; + struct PSAPreport pi_un_report; + struct PSAPfinish pi_un_finish; + struct PSAPabort pi_un_abort; + } pi_un; +#define pi_data pi_un.pi_un_data +#define pi_token pi_un.pi_un_token +#define pi_sync pi_un.pi_un_sync +#define pi_activity pi_un.pi_un_activity +#define pi_report pi_un.pi_un_report +#define pi_finish pi_un.pi_un_finish +#define pi_abort pi_un.pi_un_abort +}; + +/* */ + +extern char *psap2version; + + +int PExec (); /* SERVER only */ +int PInit (); /* P-CONNECT.INDICATION */ + +int PConnResponse (); /* P-CONNECT.RESPONSE */ + /* P-CONNECT.REQUEST (backwards-compatible) */ +#define PConnRequest(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \ + PAsynConnRequest (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,0) +int PAsynConnRequest (); /* P-(ASYN-)CONNECT.REQUEST */ +int PAsynRetryRequest (); /* P-ASYN-RETRY.REQUEST (pseudo) */ +int PDataRequest (); /* P-DATA.REQUEST */ +int PDataRequestAux (); /* P-[*-]DATA.REQUEST */ +#define PPDU_TTD 8 +#define PPDU_TE 9 +#define PPDU_TC 10 +#define PPDU_TCC 11 + +#define PExpdRequest(s,d,n,p) \ + PDataRequestAux ((s), (d), (n), (p), "expedited", SExpdRequest, \ + "SExpdRequest", "P-EXPEDITED-DATA user-data", PPDU_TE) + +#define PTypedRequest(s,d,n,p) \ + PDataRequestAux ((s), (d), (n), (p), "typed", STypedRequest, \ + "STypedRequest", "P-TYPED-DATA user-data", PPDU_TTD) + +#define PCapdRequest(s,d,n,p) \ + PDataRequestAux ((s), (d), (n), (p), "capability", SCapdRequest, \ + "SCapdRequest", "P-CAPABILITY-DATA user-data", PPDU_TC) + +#define PCapdResponse(s,d,n,p) \ + PDataRequestAux ((s), (d), (n), (p), "capability", SCapdResponse, \ + "SCapdResponse","P-CAPABILITY-DATA user-data",PPDU_TCC) + +int PReadRequest (); /* P-READ.REQUEST (pseudo) */ +int PGTokenRequest (); /* P-TOKEN-GIVE.REQUEST */ +int PPTokenRequest (); /* P-TOKEN-PLEASE.REQUEST */ +int PGControlRequest (); /* P-CONTROL-GIVE.REQUEST */ +int PMajSyncRequestAux (); /* P-{MAJOR-SYNC,ACTIVITY-END}.REQUEST */ + +#define PMajSyncRequest(s,i,d,n,p) \ + PMajSyncRequestAux ((s), (i), (d), (n), (p), "majorsync", \ + SMajSyncRequest, "SMajSyncRequest") + +#define PActEndRequest(s,i,d,n,p) \ + PMajSyncRequestAux ((s), (i), (d), (n), (p), "activity end", \ + SActEndRequest, "SActEndRequest") + +int PMajSyncResponseAux (); /* P-{MAJOR-SYNC,ACTIVITY-END}.RESPONSE */ + +#define PMajSyncResponse(s,d,n,p) \ + PMajSyncResponseAux ((s), (d), (n), (p), "majorsync", \ + SMajSyncResponse, "SMajSyncResponse") + +#define PActEndResponse(s,d,n,p) \ + PMajSyncResponseAux ((s), (d), (n), (p), "activity end", \ + SActEndResponse, "SActEndResponse") + +int PMinSyncRequest (); /* P-MINOR-SYNC.REQUEST */ +int PMinSyncResponse (); /* P-MINOR-SYNC.RESPONSE */ +int PReSyncRequest (); /* P-RESYNCHRONIZE.REQUEST */ +int PReSyncResponse (); /* P-RESYNCHRONIZE.RESPONSE */ +int PActStartRequest (); /* P-ACTIVITY-START.REQUEST */ +int PActResumeRequest (); /* P-ACTIVITY-RESUME.REQUEST */ +int PActIntrRequestAux (); /* P-ACTIVITY-{INTERRUPT,DISCARD}.REQUEST */ + +#define PActIntrRequest(s,r,p) \ + PActIntrRequestAux ((s), (r), (p), \ + SActIntrRequest, "SActIntrRequest") + +#define PActDiscRequest(s,r,p) \ + PActIntrRequestAux ((s), (r), (p), \ + SActDiscRequest, "SActDiscRequest") + +int PActIntrResponseAux (); /* P-ACTIVITY-{INTERRUPT,DISCARD}.RESPONSE */ + +#define PActIntrResponse(s,p) \ + PActIntrResponseAux ((s), (p), \ + SActIntrResponse, "SActIntrResponse") + +#define PActDiscResponse(s,p) \ + PActIntrResponseAux ((s), (p), \ + SActDiscResponse, "SActDiscResponse") + +int PUAbortRequest (); /* P-U-ABORT.REQUEST */ +int PUReportRequest (); /* P-U-EXCEPTION-REPORT.REQUEST */ +int PRelRequest (); /* P-RELEASE.REQUEST */ +int PRelRetryRequest (); /* P-RELEASE-RETRY.REQUEST (pseudo) */ +int PRelResponse (); /* P-RELEASE.RESPONSE */ + +int PSetIndications (); /* define vectors for INDICATION events */ +int PSelectMask (); /* map presentation descriptors for select() */ + +char *PErrString (); /* return PSAP error code in string form */ + +#define PLocalHostName getlocalhost +char *PLocalHostName (); /* return name of local host (sigh) */ +#endif diff --git a/src/isode/h/ronot.h b/src/isode/h/ronot.h new file mode 100644 index 0000000000..4174ebc9e6 --- /dev/null +++ b/src/isode/h/ronot.h @@ -0,0 +1,98 @@ +/* ronote.h - Additions to properly support ABSTRACT-BIND */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:40 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:06 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:20 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:52 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + +#ifndef _RoNot_ +#define _RoNot_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif + +#ifndef _AcSAP_ +#include "acsap.h" /* definitions for AcS-USERs */ +#endif + +#ifndef _RoSAP_ +#include "rosap.h" /* definitions for RoS-USERs */ +#endif + +#define BIND_RESULT 1 /* indicates a bind result occured */ +#define BIND_ERROR 2 /* indicates a bind error occured */ + +struct RoNOTindication { + int rni_reason; /* reason for failure */ +#define RBI_ACSE 1 /* ACSE provider failed */ +#define RBI_SET_ROSE_PRES 2 /* Failed to set ROS-USER */ +#define RBI_ENC_BIND_ARG 3 /* Failed encoding bind argument */ +#define RBI_ENC_BIND_RES 4 /* Failed encoding bind result */ +#define RBI_ENC_BIND_ERR 5 /* Failed encoding bind error */ +#define RBI_ENC_UNBIND_ARG 6 /* Failed encoding unbind argument */ +#define RBI_ENC_UNBIND_RES 7 /* Failed encoding unbind result */ +#define RBI_ENC_UNBIND_ERR 8 /* Failed encoding unbind error */ +#define RBI_DEC_BIND_ARG 9 /* Failed decoding bind argument */ +#define RBI_DEC_BIND_RES 10 /* Failed decoding bind result */ +#define RBI_DEC_BIND_ERR 11 /* Failed decoding bind error */ +#define RBI_DEC_UNBIND_ARG 12 /* Failed decoding unbind argument */ +#define RBI_DEC_UNBIND_RES 13 /* Failed decoding unbind result */ +#define RBI_DEC_UNBIND_ERR 14 /* Failed decoding unbind error */ +#define RBI_DEC_NINFO 15 /* Erroneous number of user infos */ + + /* diagnostics from provider */ +#define RB_SIZE 512 + int rni_cc; /* length */ + char rni_data[RB_SIZE]; /* data */ +}; + +#ifndef lint +#ifndef __STDC__ +#define copyRoNOTdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ + bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ +} +#else +#define copyRoNOTdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ + bcopy (base, d -> d##_data, d -> d##_cc); \ +} +#endif +#else +#define copyRoNOTdata(base,len,d) bcopy (base, (char *) d, len) +#endif + +#endif diff --git a/src/isode/h/ropkt.h b/src/isode/h/ropkt.h new file mode 100644 index 0000000000..f1682d5eb6 --- /dev/null +++ b/src/isode/h/ropkt.h @@ -0,0 +1,218 @@ +/* ropkt.h - include file for remote operation providers (RoS-PROVIDER) */ + +/* + * $Header$ + * + * Based on an TCP-based implementation by George Michaelson of University + * College London. + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:42 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:08 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:22 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:52 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _RoSAP_ +#include "rosap.h" /* definitions for RoS-USERs */ +#endif + +#include "acpkt.h" /* definitions for AcS-PROVIDERs */ + +#ifndef _RtSAP_ +#include "rtsap.h" /* definitions for RtS-USERs */ +#endif + +#ifndef _PSAP2_ +#include "psap2.h" /* definitions for PS-USERs */ +#endif + +#ifndef _SSAP_ +#include "ssap.h" /* definitions for SS-USERs */ +#endif + +/* */ + +#define rosapPsig(acb, sd) \ +{ \ + if ((acb = findacblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_PARAMETER, NULLCP, \ + "invalid association descriptor"); \ + } \ + if (!(acb -> acb_flags & ACB_CONN)) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor not connected"); \ + } \ + if (acb -> acb_flags & ACB_CLOSING) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_WAITING, NULLCP, NULLCP); \ + } \ + if (acb -> acb_flags & ACB_FINN) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor finishing"); \ + } \ + if (acb -> acb_putosdu == NULLIFP) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor not bound"); \ + } \ +} + +#define rosapXsig(acb, sd) \ +{ \ + if ((acb = findacblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_PARAMETER, NULLCP, \ + "invalid association descriptor"); \ + } \ + if (!(acb -> acb_flags & ACB_CONN)) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor not connected"); \ + } \ + if (acb -> acb_flags & ACB_FINN) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor finishing"); \ + } \ + if (acb -> acb_putosdu == NULLIFP) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor not bound"); \ + } \ +} + +#define rosapFsig(acb, sd) \ +{ \ + if ((acb = findacblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_PARAMETER, NULLCP, \ + "invalid association descriptor"); \ + } \ + if (!(acb -> acb_flags & ACB_ROS)) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "not an association descriptor for ROS"); \ + } \ + if (!(acb -> acb_flags & ACB_CONN)) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor not connected"); \ + } \ + if (!(acb -> acb_flags & ACB_FINN)) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor not finishing"); \ + } \ + if (acb -> acb_putosdu == NULLIFP) { \ + (void) sigiomask (smask); \ + return rosaplose (roi, ROS_OPERATION, NULLCP, \ + "association descriptor not bound"); \ + } \ +} + +#ifdef __STDC__ +#define missingP(p) \ +{ \ + if (p == NULL) \ + return rosaplose (roi, ROS_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing",#p); \ +} +#else +#define missingP(p) \ +{ \ + if (p == NULL) \ + return rosaplose (roi, ROS_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", "p"); \ +} +#endif + + +#ifndef lint +#ifndef __STDC__ +#define copyRoSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ + bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ +} +#else +#define copyRoSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ + bcopy (base, d -> d##_data, d -> d##_cc); \ +} +#endif +#else +#define copyRoSAPdata(base,len,d) bcopy (base, (char *) d, len) +#endif + + +#define pylose() \ + ropktlose (acb, roi, ROS_PROTOCOL, NULLCP, "%s", PY_pepy) + + +int ropktlose (), rosapreject (), rosaplose (); + +/* */ + +int acb2osdu (); + + +int ro2rtswrite (), ro2rtswait (), ro2rtsready (), ro2rtsasync (), + ro2rtsmask (); + + +int ro2pswrite (), ro2pswait (), ro2psasync (), ro2psmask (); + + +int ss2roslose (), ss2rosabort (); +int ro2sswrite (), ro2sswait (), ro2ssasync (), ro2ssmask (), ro2sslose (), + ro2ssready (); + +/* */ + + /* APDU types */ +#define APDU_INVOKE 1 /* Invoke */ +#define APDU_RESULT 2 /* Return result */ +#define APDU_ERROR 3 /* Return error */ +#define APDU_REJECT 4 /* Reject */ + +#define APDU_UNKNOWN (-1) /* anything other than the above */ + + + /* Reject APDU types */ +#define REJECT_GENERAL 0 /* General Problem */ +#define REJECT_GENERAL_BASE ROS_GP_UNRECOG +#define REJECT_INVOKE 1 /* Invoke Problem */ +#define REJECT_INVOKE_BASE ROS_IP_DUP +#define REJECT_RESULT 2 /* Return Result Problem */ +#define REJECT_RESULT_BASE ROS_RRP_UNRECOG +#define REJECT_ERROR 3 /* Return Error Problem */ +#define REJECT_ERROR_BASE ROS_REP_UNRECOG +#define REJECT_COMPLETE 4 /* more Invoke Problem codes */ diff --git a/src/isode/h/rosap.h b/src/isode/h/rosap.h new file mode 100644 index 0000000000..1c2195b6ab --- /dev/null +++ b/src/isode/h/rosap.h @@ -0,0 +1,289 @@ +/* rosap.h - include file for remote operation users (RoS-USER) */ + +/* + * $Header$ + * + * Based on an TCP-based implementation by George Michaelson of University + * College London. + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:44 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:10 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:24 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:53 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _RoSAP_ +#define _RoSAP_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif + +#ifndef _AcSAP_ +#include "acsap.h" /* definitions for AcS-USERs */ +#endif + +/* */ + +struct RoSAPaddr { /* RoSAP address (old-style)*/ + struct SSAPaddr roa_addr; + + u_short roa_port; +}; +#define NULLRoA ((struct RoSAPaddr *) 0) + +/* */ + +#define ROS_MYREQUIRE SR_DUPLEX/* for direct users of ACSE */ + + +struct RoSAPstart { /* RO-BEGIN.INDICATION */ + int ros_sd; /* ROS descriptor */ + + struct RoSAPaddr ros_initiator;/* unique identifier */ + + u_short ros_port; /* application number */ + + PE ros_data; /* initial DATA from peer */ +}; +#define ROSFREE(ros) \ +{ \ + if ((ros) -> ros_data) \ + pe_free ((ros) -> ros_data), (ros) -> ros_data = NULLPE; \ +} + +struct RoSAPconnect { /* RO-BEGIN.CONFIRMATION */ + int roc_sd; /* ROS descriptor */ + + int roc_result; /* result */ +#define ROS_ACCEPT (-1) + + /* RO-BEGIN.REQUEST */ +#define ROS_VALIDATE 0 /* Authentication failure */ +#define ROS_BUSY 1 /* Busy */ + + /* General Problem */ +#define ROS_GP_UNRECOG 2 /* Unrecognized APDU */ +#define ROS_GP_MISTYPED 3 /* Mistyped APDU */ +#define ROS_GP_STRUCT 4 /* Badly structured APDU */ + + /* Invoke Problem */ +#define ROS_IP_DUP 5 /* Duplicate invocation */ +#define ROS_IP_UNRECOG 6 /* Unrecognized operation */ +#define ROS_IP_MISTYPED 7 /* Mistyped argument */ +#define ROS_IP_LIMIT 8 /* Resource limitation */ +#define ROS_IP_RELEASE 9 /* Initiator releasing */ +#define ROS_IP_UNLINKED 10 /* Unrecognized linked ID */ +#define ROS_IP_LINKED 11 /* Linked response unexpected */ +#define ROS_IP_CHILD 12 /* Unexpected child operation */ + + /* Return Result Problem */ +#define ROS_RRP_UNRECOG 13 /* Unrecognized invocation */ +#define ROS_RRP_UNEXP 14 /* Result response unexpected */ +#define ROS_RRP_MISTYPED 15 /* Mistyped result */ + + /* Return Error Problem */ +#define ROS_REP_UNRECOG 16 /* Unrecognized invocation */ +#define ROS_REP_UNEXP 17 /* Error response unexpected */ +#define ROS_REP_RECERR 18 /* Unrecognized error */ +#define ROS_REP_UNEXPERR 19 /* Unexpected error */ +#define ROS_REP_MISTYPED 20 /* Mistyped parameter */ + + /* begin UNOFFICIAL */ +#define ROS_ADDRESS 21 /* Address unknown */ +#define ROS_REFUSED 22 /* Connect request refused on this network + connection */ +#define ROS_SESSION 23 /* Session disconnect */ +#define ROS_PROTOCOL 24 /* Protocol error */ +#define ROS_CONGEST 25 /* Congestion at RoSAP */ +#define ROS_REMOTE 26 /* Remote system problem */ +#define ROS_DONE 27 /* Association done via async handler */ +#define ROS_ABORTED 28 /* Peer aborted association */ +#define ROS_RTS 29 /* RTS disconnect */ +#define ROS_PRESENTATION 30 /* Presentation disconnect */ +#define ROS_ACS 31 /* ACS disconnect */ +#define ROS_PARAMETER 32 /* Invalid parameter */ +#define ROS_OPERATION 33 /* Invalid operation */ +#define ROS_TIMER 34 /* Timer expired */ +#define ROS_WAITING 35 /* Indications waiting */ +#define ROS_APDU 36 /* APDU not transferred */ +#define ROS_INTERRUPTED 37 /* stub interrupted */ + /* end UNOFFICIAL */ + +#define ROS_FATAL(r) (!(ROS_OFFICIAL (r)) && (r) < ROS_PARAMETER) +#define ROS_OFFICIAL(r) ((r) < ROS_ADDRESS) + + PE roc_data; /* initial DATA from peer */ +}; +#define ROCFREE(roc) \ +{ \ + if ((roc) -> roc_data) \ + pe_free ((roc) -> roc_data), (roc) -> roc_data = NULLPE; \ +} + + + /* Operation Classes */ +#define ROS_SYNC 0 /* synchronous mode with result or error */ +#define ROS_ASYNC 1 /* asynchronous mode with result or error */ + + /* APDU priorities */ +#define ROS_NOPRIO 0 /* no priority */ + + +struct RoSAPinvoke { /* RO-INVOKE.INDICATION */ + int rox_id; /* invokeID */ + + int rox_linkid; /* linkedID */ + int rox_nolinked; /* non-zero if no linkedID present */ + + int rox_op; /* operation */ + PE rox_args; /* arguments */ +}; +#define ROXFREE(rox) \ +{ \ + if ((rox) -> rox_args) \ + pe_free ((rox) -> rox_args), (rox) -> rox_args = NULLPE; \ +} + + +struct RoSAPresult { /* RO-RESULT.INDICATION */ + int ror_id; /* invokeID */ + + int ror_op; /* operation */ + PE ror_result; /* result */ +}; +#define RORFREE(ror) \ +{ \ + if ((ror) -> ror_result) \ + pe_free ((ror) -> ror_result), (ror) -> ror_result = NULLPE; \ +} + + +struct RoSAPerror { /* RO-ERROR.INDICATION */ + int roe_id; /* invokeID */ + + int roe_error; /* error */ + PE roe_param; /* parameter */ +}; +#define ROEFREE(roe) \ +{ \ + if ((roe) -> roe_param) \ + pe_free ((roe) -> roe_param), (roe) -> roe_param = NULLPE; \ +} + + +struct RoSAPureject { /* RO-U-REJECT.INDICATION */ + int rou_id; /* invokeID */ + int rou_noid; /* .. is not present */ + + int rou_reason; /* reason (same as roc_result) */ +}; + + +struct RoSAPpreject { /* RO-P-REJECT.INDICATION */ + int rop_reason; /* reason (same as roc_result) */ + + /* APDU not transferred (reason is ROS_APDU) */ + int rop_id; /* invokeID */ + PE rop_apdu; /* APDU */ + + /* additional failure data from provider */ +#define ROP_SIZE 512 + int rop_cc; /* length */ + char rop_data[ROP_SIZE]; /* data */ +}; +#define ROPFREE(rop) \ +{ \ + if ((rop) -> rop_apdu) \ + pe_free ((rop) -> rop_apdu), (rop) -> rop_apdu = NULLPE; \ +} + + +struct RoSAPend { /* RO-END.INDICATION */ + int roe_dummy; /* not used */ +}; + + +struct RoSAPindication { + int roi_type; /* the union element present */ +#define ROI_INVOKE 0x00 +#define ROI_RESULT 0x01 +#define ROI_ERROR 0x02 +#define ROI_UREJECT 0x03 +#define ROI_PREJECT 0x04 +#define ROI_END 0x05 +#define ROI_FINISH 0x06 + + union { + struct RoSAPinvoke roi_un_invoke; + struct RoSAPresult roi_un_result; + struct RoSAPerror roi_un_error; + struct RoSAPureject roi_un_ureject; + struct RoSAPpreject roi_un_preject; + struct RoSAPend roi_un_end; + struct AcSAPfinish roi_un_finish; + } roi_un; +#define roi_invoke roi_un.roi_un_invoke +#define roi_result roi_un.roi_un_result +#define roi_error roi_un.roi_un_error +#define roi_ureject roi_un.roi_un_ureject +#define roi_preject roi_un.roi_un_preject +#define roi_end roi_un.roi_un_end +#define roi_finish roi_un.roi_un_finish +}; + +/* */ + +extern char *rosapversion; + +int RoExec (); /* SERVER only */ +int RoInit (); /* RO-BEGIN.INDICATION */ + +int RoBeginResponse (); /* RO-BEGIN.RESPONSE */ +int RoBeginRequest (); /* RO-BEGIN.REQUEST */ +int RoEndRequest (); /* RO-END.REQUEST */ +int RoEndResponse (); /* RO-END.RESPONSE */ + +int RoInvokeRequest (); /* RO-INVOKE.REQUEST */ +int RoResultRequest (); /* RO-RESULT.REQUEST */ +int RoErrorRequest (); /* RO-ERROR.REQUEST */ +int RoURejectRequest (); /* RO-U-REJECT.REQUEST */ +#define RoRejectURequest RoURejectRequest +int RoIntrRequest (); /* RO-INVOKE.REQUEST (interruptable) */ +int RoWaitRequest (); /* RO-WAIT.REQUEST (pseudo) */ + +int RoSetIndications (); /* define vectors for INDICATION events */ +int RoSelectMask (); /* map remote operation descriptors for + select() */ + +int RoSetService (); /* bind underlying service */ +int RoRtService (), RoPService (), RoSService (); +int RoSetThorn (); + +char *RoErrString (); /* return RoSAP error code in string form */ +#endif diff --git a/src/isode/h/rosy.h b/src/isode/h/rosy.h new file mode 100644 index 0000000000..6767d056c5 --- /dev/null +++ b/src/isode/h/rosy.h @@ -0,0 +1,214 @@ +/* rosy.h - include file for ROSY users */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:46 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:12 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:26 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:53 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _ROSY_ +#define _ROSY_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif + +#ifndef _RoSAP_ +#include "rosap.h" /* definitions for RoS-USERs */ +#endif + +/* */ + +#ifdef PEPSY_VERSION +#include "pepsy.h" +#endif + +#ifdef PEPSY_DEFINITIONS +/* This is really to change the name of the function RyOperation but the macro + * is unselective so we have to change the name of the structure as well, which + * shouldn't cause any problems + */ +#define RyOperation PRyOperation +#endif PEPSY_DEFINITIONS +struct RyOperation { + char *ryo_name; /* operation name */ + int ryo_op; /* operation code */ + +#ifdef PEPSY_DEFINITIONS + modtyp *ryo_arg_mod; /* pointer to table for arguement type */ + int ryo_arg_index; /* index to entry in tables */ +#else + IFP ryo_arg_encode; /* encodes argument */ + IFP ryo_arg_decode; /* decodes .. */ + IFP ryo_arg_free; /* frees .. */ +#endif + + int ryo_result; /* result possible */ +#ifdef PEPSY_DEFINITIONS + modtyp *ryo_res_mod; /* pointer to table for result type */ + int ryo_res_index; /* index to entry in tables */ +#else + IFP ryo_res_encode; /* encodes result */ + IFP ryo_res_decode; /* decodes .. */ + IFP ryo_res_free; /* frees .. */ +#endif + + struct RyError **ryo_errors;/* errors possible */ +}; + + + +struct RyError { + char *rye_name; /* error name */ + int rye_err; /* error code */ + +#ifdef PEPSY_DEFINITIONS + modtyp *rye_param_mod; /* pointer to table for result type */ + int rye_param_index; /* index to entry in tables */ +#else + IFP rye_param_encode; /* encodes parameter */ + IFP rye_param_decode; /* decodes .. */ + IFP rye_param_free; /* frees .. */ +#endif +}; + +/* */ + +struct opsblk { + struct opsblk *opb_forw; /* doubly-linked list */ + struct opsblk *opb_back; /* .. */ + + short opb_flags; /* our state */ +#define OPB_NULL 0x0000 +#define OPB_EVENT 0x0001 /* event present */ +#define OPB_INITIATOR 0x0002 /* initiator block */ +#define OPB_RESPONDER 0x0004 /* responder block */ + + int opb_fd; /* association descriptor */ + int opb_id; /* invoke ID */ + + IFP opb_resfnx; /* result vector */ + IFP opb_errfnx; /* error vector */ + + struct RyOperation *opb_ryo;/* entry in operation table */ + + struct RoSAPindication opb_event; /* resulting event */ + caddr_t opb_out; /* event parameter */ +#ifdef PEPSY_DEFINITIONS + modtyp *opb_free_mod; /* pointer to table for result type */ + int opb_free_index; /* index to entry in tables */ +#else + IFP opb_free; /* free routine for event parameter */ +#endif + + PE opb_pe; /* for Simon */ +}; +#define NULLOPB ((struct opsblk *) 0) + + + + +struct dspblk { + struct dspblk *dsb_forw; /* doubly-linked list */ + struct dspblk *dsb_back; /* .. */ + + int dsb_fd; /* association descriptor */ + /* NOTOK-valued is wildcard for RyWait */ + + struct RyOperation *dsb_ryo;/* entry in operation table */ + + IFP dsb_vector; /* dispatch vector */ +}; +#define NULLDSB ((struct dspblk *) 0) + + + +#define RY_RESULT (-1) /* distinguishes RESULTs from ERRORs */ +#define RY_REJECT (-2) /* distinguishes REJECTs from ERRORs */ + +/* */ +/* Change the names to use the pepsy based rosy library */ +#ifdef PEPSY_DEFINITIONS +#define RyDiscard PRyDiscard +#define RyDispatch PRyDispatch +#define RyDsError PRyDsError +#define RyDsResult PRyDsResult +#define RyDsUReject PRyDsUReject +#define RyGenID PRyGenID +#define RyLose PRyLose +#define RyOpInvoke PRyOpInvoke +#define RyStub PRyStub +#define RyWait PRyWait +#define RyWaitAux PRyWaitAux +#define finddsblk Pfinddsblk +#define finderrbyerr Pfinderrbyerr +#define finderrbyname Pfinderrbyname +#define findopblk Pfindopblk +#define findopbyname Pfindopbyname +#define findopbyop Pfindopbyop +#define firstopblk Pfirstopblk +#define freedsblk Pfreedsblk +#define freeopblk Pfreeopblk +#define losedsblk Plosedsblk +#define loseopblk Ploseopblk +#define newdsblk Pnewdsblk +#define newopblk Pnewopblk +#endif + +int RyWait (); /* WAIT */ + + /* Initiator */ +int RyStub (); /* STUB */ +#define ROS_INTR 2 /* invoke stub but return on interrupt */ +int RyDiscard (); /* DISCARD */ +int RyOperation (); /* OPERATION */ +int RyOpInvoke (); /* INVOKE */ +int RyGenID (); /* generate unique invoke ID */ + + /* Responder */ +int RyDispatch (); /* DISPATCH */ +int RyDsResult (); /* RESULT */ +int RyDsError (); /* ERROR */ +int RyDsUReject (); /* U-REJECT */ + +int RyLose (); /* clean-up after association termination */ + +struct RyOperation *findopbyop (), *findopbyname (); + +struct RyError *finderrbyerr (), *finderrbyname (); + +int freeopblk (), loseopblk (); +struct opsblk *newopblk (), *findopblk (), *firstopblk (); + +int freedsblk (), losedsblk (); +struct dspblk *newdsblk (), *finddsblk (); + +#endif diff --git a/src/isode/h/rtpkt.h b/src/isode/h/rtpkt.h new file mode 100644 index 0000000000..e120ef22e1 --- /dev/null +++ b/src/isode/h/rtpkt.h @@ -0,0 +1,223 @@ +/* rtpkt.h - include file for reliable transfer providers (RtS-PROVIDER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:47 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:14 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:27 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:54 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _RtSAP_ +#include "rtsap.h" /* definitions for RtS-USERs */ +#endif + +#include "acpkt.h" /* definitions for AcS-PROVIDERs */ + +#ifndef _SSAP_ +#include "ssap.h" /* definitions for SS-USERs */ +#endif + +/* */ + +#define rtsapPsig(acb, sd) \ +{ \ + if ((acb = findacblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return rtsaplose (rti, RTS_PARAMETER, NULLCP, \ + "invalid association descriptor"); \ + } \ + if (!(acb -> acb_flags & ACB_RTS)) { \ + (void) sigiomask (smask); \ + return rtsaplose (rti, RTS_OPERATION, NULLCP, \ + "not an association descriptor for RTS"); \ + } \ + if (!(acb -> acb_flags & ACB_CONN)) { \ + (void) sigiomask (smask); \ + return rtsaplose (rti, RTS_OPERATION, NULLCP, \ + "association descriptor not connected"); \ + } \ + if (acb -> acb_flags & ACB_FINN) { \ + (void) sigiomask (smask); \ + return rtsaplose (rti, RTS_OPERATION, NULLCP, \ + "association descriptor finishing"); \ + } \ +} + +#define rtsapFsig(acb, sd) \ +{ \ + if ((acb = findacblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return rtsaplose (rti, RTS_PARAMETER, NULLCP, \ + "invalid association descriptor"); \ + } \ + if (!(acb -> acb_flags & ACB_RTS)) { \ + (void) sigiomask (smask); \ + return rtsaplose (rti, RTS_OPERATION, NULLCP, \ + "not an association descriptor for RTS"); \ + } \ + if (!(acb -> acb_flags & ACB_CONN)) { \ + (void) sigiomask (smask); \ + return rtsaplose (rti, RTS_OPERATION, NULLCP, \ + "association descriptor not connected"); \ + } \ + if (!(acb -> acb_flags & ACB_FINN)) { \ + (void) sigiomask (smask); \ + return rtsaplose (rti, RTS_OPERATION, NULLCP, \ + "association descriptor not finishing"); \ + } \ +} + +#ifdef __STDC__ +#define missingP(p) \ +{ \ + if (p == NULL) \ + return rtsaplose (rti, RTS_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", #p); \ +} +#else +#define missingP(p) \ +{ \ + if (p == NULL) \ + return rtsaplose (rti, RTS_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", "p"); \ +} +#endif + + +#ifndef lint +#ifndef __STDC__ +#define copyRtSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ + bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ +} +#else +#define copyRtSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ + bcopy (base, d -> d##_data, d -> d##_cc); \ +} +#endif +#else +#define copyRtSAPdata(base,len,d) bcopy (base, (char *) d, len) +#endif + + +#define pylose() \ + rtpktlose (acb, rti, RTS_PROTOCOL, NULLCP, "%s", PY_pepy) + + +/* would really prefer to determine DEFAULT_CKPOINT dynamically, but can't + since need to know it *before* doing the A-ASSOCIATE.REQUEST or + S-CONNECT.REQUEST... */ + +#define DEFAULT_CKPOINT (65518 >> 10) +#define DEFAULT_WINDOW PCONN_WD_DFLT + + +#define RTS_MYREQUIRE (SR_EXCEPTIONS | SR_ACTIVITY | SR_HALFDUPLEX \ + | SR_MINORSYNC) + + +#define RT_ASN "rtse pci version 1" + +#if USE_BUILTIN_OIDS +#define RT_ASN_OID str2oid ("2.3.0") +#else +#define RT_ASN_OID ode2oid (RT_ASN) +#endif + +int rtpktlose (), rtsaplose (); + +/* */ + +#define SetPS2RtService(acb) \ +{ \ + (acb) -> acb_pturnrequest = rt2pspturn; \ + (acb) -> acb_gturnrequest = rt2psgturn; \ + (acb) -> acb_transferequest = rt2pstrans; \ + (acb) -> acb_rtwaitrequest = rt2pswait; \ + (acb) -> acb_rtsetindications = rt2psasync; \ + (acb) -> acb_rtselectmask = rt2psmask; \ + (acb) -> acb_rtpktlose = rt2pslose; \ +} + +int acs2rtslose (), acs2rtsabort (), ps2rtslose (); +int rt2pspturn (), rt2psgturn (), rt2pstrans (), rt2pswait (), + rt2psasync (), rt2psmask (), rt2pslose (); + + +#define SetSS2RtService(acb) \ +{ \ + (acb) -> acb_pturnrequest = rt2sspturn; \ + (acb) -> acb_gturnrequest = rt2ssgturn; \ + (acb) -> acb_transferequest = rt2sstrans; \ + (acb) -> acb_rtwaitrequest = rt2sswait; \ + (acb) -> acb_rtsetindications = rt2ssasync; \ + (acb) -> acb_rtselectmask = rt2ssmask; \ + (acb) -> acb_rtpktlose = rt2sslose; \ +} + +int ss2rtslose (), ss2rtsabort (); +int rt2sspturn (), rt2ssgturn (), rt2sstrans (), rt2sswait (), + rt2ssasync (), rt2ssmask (), rt2sslose (); + +/* */ + /* RTORQ apdu */ +#define RTORQ_CKPOINT 0 /* checkpointSize tag */ +#define RTORQ_CK_DFLT 0 /* default */ +#define RTORQ_WINDOW 1 /* windowSize tag */ +#define RTORQ_WD_DFLT 3 /* default */ +#define RTORQ_DIALOGUE 2 /* dialogueMode tag */ +#define RTORQ_DM_MONO 0 /* monologue */ +#define RTORQ_DM_TWA 1 /* two-way alternate */ +#define RTORQ_DM_DFLT RTORQ_DM_MONO +#define RTORQ_CONNDATA 3 /* connectionDataRQ tag */ +#define RTORQ_CD_OPEN 0 /* open tag */ +#define RTORQ_CD_RCVR 1 /* recover tag */ + + /* RTOAC apdu */ +#define RTOAC_CKPOINT 0 /* checkpointSize tag */ +#define RTOAC_CK_DFLT 0 /* default */ +#define RTOAC_WINDOW 1 /* windowSize tag */ +#define RTOAC_WD_DFLT 3 /* default */ +#define RTOAC_CONNDATA 2 /* connectionDataAC */ +#define RTOAC_CD_OPEN 0 /* open tag */ +#define RTOAC_CD_RCVR 1 /* recover tag */ + + /* RTORJ apdu */ +#define RTORJ_REFUSE 0 /* refuseReason tag */ +#define RTORJ_USERDATA 1 /* userDataRJ */ + + /* RTAB apdu */ +#define RTAB_REASON 0 /* abortReason tag */ +#define RTAB_REFLECT 1 /* relectedParameter tag */ +#define RTAB_USERDATA 2 /* userDataAB */ + +extern int rtsap_priority; diff --git a/src/isode/h/rtsap.h b/src/isode/h/rtsap.h new file mode 100644 index 0000000000..e4a4711c69 --- /dev/null +++ b/src/isode/h/rtsap.h @@ -0,0 +1,236 @@ +/* rtsap.h - include file for reliable transfer users (RtS-USER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:49 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:15 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:29 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:54 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _RtSAP_ +#define _RtSAP_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif + +#ifndef _AcSAP_ +#include "acsap.h" /* definitions for AcS-USERs */ +#endif + +/* */ + +struct RtSAPaddr { /* RtSAP address (old-style) */ + struct SSAPaddr rta_addr; + + u_short rta_port; +}; +#define NULLRtA ((struct RtSAPaddr *) 0) + +/* */ + +struct RtSAPstart { /* RT-OPEN.INDICATION */ + int rts_sd; /* RTS descriptor */ + + struct RtSAPaddr rts_initiator;/* address */ + + int rts_mode; /* dialogue mode */ +#define RTS_MONOLOGUE 0 /* monologue */ +#define RTS_TWA 1 /* two-way alternate */ + + int rts_turn; /* initial turn */ +#define RTS_INITIATOR 0 /* the initiator */ +#define RTS_RESPONDER 1 /* the responder */ + + u_short rts_port; /* application number */ + + PE rts_data; /* initial DATA from peer */ + + struct AcSAPstart rts_start;/* info from A-ASSOCIATE.INDICATION */ +}; +#define RTSFREE(rts) \ +{ \ + if ((rts) -> rts_data) \ + pe_free ((rts) -> rts_data), (rts) -> rts_data = NULLPE; \ + ACSFREE (&((rts) -> rts_start)); \ +} + + +struct RtSAPconnect { /* RT-OPEN.CONFIRMATION */ + int rtc_sd; /* RTS descriptor */ + + int rtc_result; /* disposition */ +#define RTS_ACCEPT (-1) + + /* RT-OPEN.REQUEST */ +#define RTS_BUSY 0 /* Busy */ +#define RTS_RECOVER 1 /* Cannot recover */ +#define RTS_VALIDATE 2 /* Validation failure */ +#define RTS_MODE 3 /* Unacceptable dialogue mode */ +#define RTS_REJECT 4 /* Rejected by responder */ + + PE rtc_data; /* initial DATA from peer */ + + struct AcSAPconnect rtc_connect;/* info from A-ASSOCIATE.CONFIRMATION */ +}; +#define RTCFREE(rtc) \ +{ \ + if ((rtc) -> rtc_data) \ + pe_free ((rtc) -> rtc_data), (rtc) -> rtc_data = NULLPE; \ + ACCFREE (&((rtc) -> rtc_connect)); \ +} + + +struct RtSAPturn { /* RT-TURN-{GIVE,PLEASE}.INDICATION */ + int rtu_please; /* T = RT-TURN-PLEASE.INDICATION + NIL = RT-TURN-GIVE.INDICATION */ + + int rtu_priority; /* priority, iff rtu_please == T */ +}; + + +struct RtSAPtransfer { /* RT-TRANSFER.INDICATION */ + PE rtt_data; +}; +#define RTTFREE(rtt) \ +{ \ + if ((rtt) -> rtt_data) \ + pe_free ((rtt) -> rtt_data), (rtt) -> rtt_data = NULLPE; \ +} + + +struct RtSAPabort { /* RT-{U,P}-ABORT.INDICATION */ + int rta_peer; /* T = RT-U-ABORT.INDICATION + NIL = RT-P-ABORT.INDICATION */ + + int rta_reason; /* reason */ + /* begin UNOFFICIAL */ +#define RTS_ADDRESS 5 /* Address unknown */ +#define RTS_REFUSED 6 /* Connect request refused on this network + connection */ +#define RTS_SESSION 7 /* Session disconnect */ +#define RTS_PROTOCOL 8 /* Protocol error */ +#define RTS_CONGEST 9 /* Congestion at RtSAP */ +#define RTS_REMOTE 10 /* Remote system problem */ +#define RTS_PRESENTATION 11 /* Presentation disconnect */ +#define RTS_ACS 12 /* ACS disconnect */ +#define RTS_ABORTED 13 /* Peer aborted association */ +#define RTS_PARAMETER 14 /* Invalid parameter */ +#define RTS_OPERATION 15 /* Invalid operation */ +#define RTS_TIMER 16 /* Timer expired */ +#define RTS_WAITING 17 /* Indications waiting */ +#define RTS_TRANSFER 18 /* Transfer failure (not really unofficial) */ + /* end UNOFFICIAL */ + +#define RTS_FATAL(r) ((r) < RTS_PARAMETER) +#define RTS_OFFICIAL(r) ((r) < RTS_ADDRESS) + + PE rta_udata; /* failure data from user */ + + /* additional failure data from provider */ +#define RTA_SIZE 512 + int rta_cc; /* length */ + char rta_data[RTA_SIZE]; /* data */ +}; +#define RTAFREE(rta) \ +{ \ + if ((rta) -> rta_udata) \ + pe_free ((rta) -> rta_udata), (rta) -> rta_udata = NULLPE; \ +} + + +struct RtSAPclose { /* RT-CLOSE.INDICATION */ + int rtc_dummy; +}; + + +struct RtSAPindication { + int rti_type; /* the union element present */ +#define RTI_TURN 0x00 +#define RTI_TRANSFER 0x01 +#define RTI_ABORT 0x02 +#define RTI_CLOSE 0x03 +#define RTI_FINISH 0x04 + + union { + struct RtSAPturn rti_un_turn; + struct RtSAPtransfer rti_un_transfer; + struct RtSAPabort rti_un_abort; + struct RtSAPclose rti_un_close; + struct AcSAPfinish rti_un_finish; + } rti_un; +#define rti_turn rti_un.rti_un_turn +#define rti_transfer rti_un.rti_un_transfer +#define rti_abort rti_un.rti_un_abort +#define rti_close rti_un.rti_un_close +#define rti_finish rti_un.rti_un_finish +}; + +/* */ + +extern char *rtsapversion; + + /* RTSE primitives */ +int RtInit_Aux (); /* RT-OPEN.INDICATION */ +#define RtInit(vecp,vec,rts,rti) \ + RtInit_Aux((vecp),(vec),(rts),(rti),NULLOID) +int RtOpenResponse (); /* RT-OPEN.RESPONSE */ +#define RtOpenRequest(mode,turn,ctx,ct1,ct2,ca1,ca2,ctxl,defc,data,qos,rtc,rti)\ + RtOpenRequest2((mode),(turn),(ctx),(ct1),(ct2),(ca1),(ca2),\ + (ctxl),(defc),(data),(qos),NULLOID,(rtc),(rti)) +int RtOpenRequest2 (); /* RT-OPEN.REQUEST */ +int RtCloseRequest (); /* RT-CLOSE.REQUEST */ +int RtCloseResponse (); /* RT-CLOSE.RESPONSE */ +int RtUAbortRequest (); /* RT-U-ABORT.REQUEST */ + + /* X.410 primitives */ +int RtExec (); /* SERVER only */ +int RtBInit (); /* RT-BEGIN.INDICATION (X.410 OPEN.INDICATION) */ +int RtBeginResponse (); /* RT-BEGIN.RESPONSE (X.410 OPEN.RESPONSE) */ +int RtBeginRequest2 (); /* RT-BEGIN.REQUEST (X.410 OPEN.REQUEST) */ +#define RtBeginRequest(called, mode, turn, data, rtc, rti) \ + RtBeginRequest2((called), NULLRtA, (mode), (turn), (data), (rtc), (rti)) +int RtEndRequest (); /* RT-END.REQUEST (X.410 CLOSE.REQUEST) */ +int RtEndResponse (); /* RT-END.RESPONSE (X.410 CLOSE.RESPONSE) */ + +int RtPTurnRequest (); /* RT-TURN-PLEASE.REQUEST */ +int RtGTurnRequest (); /* RT-TURN-GIVE.REQUEST */ +int RtTransferRequest (); /* RT-TRANSFER.REQUEST */ +int RtWaitRequest (); /* RT-WAIT.REQUEST (pseudo) */ + +int RtSetIndications (); /* define vectors for INDICATION events */ +int RtSelectMask (); /* map reliable transfer descriptors for + select() */ + +int RtSetDownTrans (); /* set downtrans upcall */ +int RtSetUpTrans (); /* set uptrans upcall */ + +char *RtErrString (); /* return RtSAP error code in string form */ +#endif diff --git a/src/isode/h/spkt.h b/src/isode/h/spkt.h new file mode 100644 index 0000000000..3f0a23fa3b --- /dev/null +++ b/src/isode/h/spkt.h @@ -0,0 +1,943 @@ +/* spkt.h - include file for session providers (SS-PROVIDER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:52 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:18 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:31 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:55 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _SSAP_ +#include "ssap.h" /* definitions for SS-USERs */ +#endif + +#include "tsap.h" /* definitions for TS-USERs */ + + +/* */ + +#define ssapPsig(sb, sd) \ +{ \ + if ((sb = findsblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "invalid session descriptor"); \ + } \ + if (!(sb -> sb_flags & SB_CONN)) {\ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "session descriptor not connected"); \ + } \ + if (sb -> sb_flags & SB_FINN) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "session descriptor finishing"); \ + } \ + if (sb -> sb_flags & SB_RELEASE) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "release in progress"); \ + } \ + if (sb -> sb_flags & SB_MAP) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "majorsync in progress"); \ + } \ + if (sb -> sb_flags & SB_RS) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "resync in progress"); \ + } \ + if (sb -> sb_flags & SB_RA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your resync response"); \ + } \ + if (sb -> sb_flags & SB_AI) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "activity interrupt/discard in progress"); \ + } \ + if (sb -> sb_flags & SB_AIA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your activity interrupt/discard response"); \ + } \ + if (sb -> sb_flags & (SB_ED | SB_EDACK | SB_ERACK)) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "exception in progress"); \ + } \ +} + +#define ssapXsig(sb, sd) \ +{ \ + if ((sb = findsblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "invalid session descriptor"); \ + } \ + if (!(sb -> sb_flags & SB_CONN)) {\ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "session descriptor not connected"); \ + } \ + if (sb -> sb_flags & SB_FINN) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "session descriptor finishing"); \ + } \ + if (sb -> sb_flags & SB_RELEASE) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "release in progress"); \ + } \ + if (sb -> sb_flags & SB_RS) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "resync in progress"); \ + } \ + if (sb -> sb_flags & SB_RA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your resync response"); \ + } \ + if (sb -> sb_flags & SB_AI) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "activity interrupt/discard in progress"); \ + } \ + if (sb -> sb_flags & SB_AIA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your activity interrupt/discard response"); \ + } \ + if (sb -> sb_flags & SB_ED) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "exception in progress"); \ + } \ +} + +#define ssapRsig(sb, sd) \ +{ \ + if ((sb = findsblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "invalid session descriptor"); \ + } \ + if (!(sb -> sb_flags & SB_CONN)) {\ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "session descriptor not connected"); \ + } \ + if (sb -> sb_flags & SB_FINN) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "session descriptor finishing"); \ + } \ + if (sb -> sb_flags & SB_RELEASE) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "release in progress"); \ + } \ + if (sb -> sb_flags & SB_RS) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "resync in progress"); \ + } \ + if (sb -> sb_flags & SB_AI) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "activity interrupt/discard in progress"); \ + } \ + if (sb -> sb_flags & SB_AIA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your activity interrupt/discard response"); \ + } \ + if (sb -> sb_flags & SB_AE) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "activity end in progress"); \ + } \ + if (sb -> sb_flags & SB_ED) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "exception in progress"); \ + } \ +} + +#define ssapAsig(sb, sd) \ +{ \ + if ((sb = findsblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "invalid session descriptor"); \ + } \ + if (!(sb -> sb_flags & SB_CONN)) {\ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "session descriptor not connected"); \ + } \ + if (sb -> sb_flags & SB_FINN) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "session descriptor finishing"); \ + } \ + if (sb -> sb_flags & SB_RELEASE) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "release in progress"); \ + } \ + if (sb -> sb_flags & SB_MAA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your majorsync response"); \ + } \ + if (sb -> sb_flags & SB_RS) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "resync in progress"); \ + } \ + if (sb -> sb_flags & SB_AI) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "activity interrupt/discard in response"); \ + } \ + if (sb -> sb_flags & (SB_ED | SB_EDACK | SB_ERACK)) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "exception in progress"); \ + } \ +} + +#define ssapFsig(sb, sd) \ +{ \ + if ((sb = findsblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "invalid session descriptor"); \ + } \ + if (!(sb -> sb_flags & SB_CONN)) {\ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "session descriptor not connected"); \ + } \ + if (!(sb -> sb_flags & SB_FINN)) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "session descriptor not finishing"); \ + } \ + if (sb -> sb_flags & SB_RELEASE) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "release in progress"); \ + } \ + if (sb -> sb_flags & SB_MAA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your majorsync response"); \ + } \ + if (sb -> sb_flags & SB_RS) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "resync in progress"); \ + } \ + if (sb -> sb_flags & SB_RA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your resync response"); \ + } \ + if (sb -> sb_flags & SB_AI) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "activity interrupt/discard in progress"); \ + } \ + if (sb -> sb_flags & SB_AIA) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "awaiting your activity interrupt/discard response"); \ + } \ + if (sb -> sb_flags & (SB_ED | SB_EDACK | SB_ERACK)) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_OPERATION, NULLCP, \ + "exception in progress"); \ + } \ +} + +#ifdef __STDC__ +#define missingP(p) \ +{ \ + if (p == NULL) \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", #p); \ +} +#else +#define missingP(p) \ +{ \ + if (p == NULL) \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", "p"); \ +} +#endif + +#define refmuchP(sr) \ +{ \ + if ((sr) -> sr_ulen > SREF_USER_SIZE \ + || (sr) -> sr_clen > SREF_COMM_SIZE \ + || (sr) -> sr_alen > SREF_ADDT_SIZE \ + || (sr) -> sr_vlen > SREF_USER_SIZE) \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "bad format for reference"); \ +} + +#define idmuchP(sd) \ +{ \ + if ((sd) -> sd_len > SID_DATA_SIZE) \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "bad format for activity ID"); \ +} + +#define toomuchP(sb,b,n,m,p) \ +{ \ + if (b == NULL) \ + n = 0; \ + else \ + if (n > (sb -> sb_version < SB_VRSN2 ? m : ENCLOSE_MAX)) { \ + (void) sigiomask (smask); \ + return ssaplose (si, SC_PARAMETER, NULLCP, \ + "too much %s user data, %d octets", p, n); \ + } \ +} + + +#define NULLTX ((struct TSAPdata *) 0) +#define NULLSD ((struct SSAPactid *) 0) +#define NULLSR ((struct SSAPref *) 0) + + +#ifndef lint +#ifndef __STDC__ +#define copySSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ + bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ +} + +#define copySPKTdata(s,d) \ +{ \ + d -> d/* */_data = s -> s_udata, d -> d/* */_cc = s -> s_ulen; \ + s -> s_udata = NULL; \ +} +#else +#define copySSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ + bcopy (base, d -> d##_data, d -> d##_cc); \ +} + +#define copySPKTdata(s, d) \ +{ \ + d -> d##_data = s -> s_udata, d -> d##_cc = s -> s_ulen; \ + s -> s_udata = NULL; \ +} +#endif +#else +#define copySSAPdata(base,len,d) bcopy (base, (char *) d, len) + +#define copySPKTdata(s,d) bcopy (s -> s_udata, (char *) d, s -> s_ulen) +#endif + + +#define AB_TIM 30 /* drain for 30 seconds on ABORTs */ +#define RF_TIM 30 /* drain for 30 seconds on REFUSEs */ + + +#define SC_REFUSE (SC_BASE << 1) /* larger than any sc_reason */ + + +int spktlose (), ssaplose (); + +/* */ + +struct ssapblk { + struct ssapblk *sb_forw; /* doubly-linked list */ + struct ssapblk *sb_back; /* .. */ + + int sb_fd; /* transport descriptor */ + + int sb_version; /* version number of protocol */ +#define SB_VRSN1 0 /* 1 */ +#define SB_VRSN2 1 /* 2 */ +#define SB_ALLVRSNS ((1 << SB_VRSN1) | (1 << SB_VRSN2)) + int sb_vrsnmask; /* for initiating SPM... */ + + long sb_flags; /* our state */ +#define SB_NULL 0x000000 +#define SB_CONN 0x000001/* connected */ +#define SB_FINN 0x000002/* other side wants to finish */ +#define SB_INIT 0x000004/* this side initiated the session */ +#define SB_ASYN 0x000008/* asynchronous */ +#define SB_EXPD 0x000010/* expedited service available on transport */ +#define SB_CD 0x000020/* CD request in progress */ +#define SB_CDA 0x000040/* awaiting CD response from user */ +#define SB_GTC 0x000080/* GTC request in progress */ +#define SB_MAP 0x000100/* MAP request in progress */ +#define SB_MAA 0x000200/* awaiting MAP response from user */ +#define SB_AE 0x000400/* MAP is really AE */ +#define SB_RS 0x000800/* RS request in progress */ +#define SB_RA 0x001000/* awaiting RS response from user */ +#define SB_AI 0x002000/* AI request in progress */ +#define SB_AIA 0x004000/* awaiting AI response from user */ +#define SB_ED 0x008000/* user exception in progress */ +#define SB_EDACK 0x010000/* awaiting user exception to be cleared */ +#define SB_ERACK 0x020000/* awaiting provider exception to be cleared */ +#define SB_Vact 0x040000/* activity in progress */ +#define SB_Vsc 0x080000/* okay to reply to minorsync */ +#define SB_Vnextact 0x100000/* activity MAP sent/received */ +#define SB_RELEASE 0x200000/* release in progress */ + +#define SB_ASYNC_CONN 0x400000/* connections are async */ +#define SB_TS_CONN 0x800000/* TS is established */ + + struct TSAPconnect sb_tc; + struct ssapkt *sb_retry; /* initial/final spkt */ + + long sb_V_A; /* lowest unconfirmed ssn */ + long sb_V_M; /* next ssn */ + long sb_V_R; /* lowest ssn for resynchronization */ + int sb_rs; /* resynchronization type + (an SYNC_xxx code, plus...) */ +#define SYNC_INTR 3 /* Activity Interrupt */ +#define SYNC_DISC 4 /* Activity Discard */ + long sb_rsn; /* resync serial number */ + u_char sb_rsettings; /* proposed token settings */ + + int sb_pr; /* SPDU to prepare for (an SPDU code) */ + struct ssapkt *sb_xspdu; /* saved expedited SPDU + (really should be a linked list!) */ + + struct ssapkt *sb_spdu; /* for concatenated SPDUs */ + + struct qbuf sb_qbuf; /* for segmented (T)SSDUs */ + int sb_len; /* .. */ + int sb_code; /* .. */ + + u_char sb_options; /* connect options */ + u_char sb_settings; /* tokens settings on connect */ + + u_short sb_tsdu_us; /* our max TSDU size */ + u_short sb_tsdu_them; /* their max TSDU size */ +#define BAD_TSDU_SIZE(s) ((s) ? (s) < DT_MINSIZE : 0) +#define GET_TSDU_SIZE(s) ((s) < DT_MINSIZE ? 0 : (s)) + + u_char sb_owned; /* tokens we own */ + u_short sb_requirements; /* functional units selected */ + + struct SSAPaddr sb_initiating; /* initiator */ + struct SSAPaddr sb_responding; /* responder */ + + int sb_maxtime; /* for SPM response during S-CONNECT */ + + IFP sb_DataIndication; /* INDICATION handlers */ + IFP sb_TokenIndication; /* .. */ + IFP sb_SyncIndication; /* .. */ + IFP sb_ActivityIndication; /* .. */ + IFP sb_ReportIndication; /* .. */ + IFP sb_ReleaseIndication; /* .. */ + IFP sb_AbortIndication; /* .. */ +}; +#define NULLBP ((struct ssapblk *) 0) + +int freesblk (); +struct ssapblk *newsblk (), *findsblk (); + + +int ts2sslose (); + +int spkt2sd (); +struct ssapkt *sb2spkt (); + +/* SPKT datastructure */ + +struct ssapkt { + int s_errno; + + int s_mask; + + u_char s_code; +#define SPDU_CN 0x0d /* CONNECT */ +#define SPDU_AC 0x0e /* ACCEPT */ +#define SPDU_RF 0x0c /* REFUSE */ +#define SPDU_FN 0x09 /* FINISH */ +#define SPDU_DN 0x0a /* DISCONNECT */ +#define SPDU_NF 0x08 /* NOT FINISHED */ +#define SPDU_AB 0x19 /* ABORT */ +#define SPDU_AA 0x1a /* ABORT ACCEPT */ +#define SPDU_DT SPDU_GT /* DATA TRANSFER */ +#define SPDU_EX 0x05 /* EXPEDITED */ +#define SPDU_TD 0x21 /* TYPED DATA */ +#define SPDU_CD 0x3d /* CAPABILITY DATA */ +#define SPDU_CDA 0x3e /* CAPABILITY DATA ACK */ +#define SPDU_GT 0x01 /* GIVE TOKENS */ +#define SPDU_PT 0x02 /* PLEASE TOKENS */ +#define SPDU_GTC 0x15 /* GIVE TOKENS CONFIRM */ +#define SPDU_GTA 0x16 /* GIVE TOKENS ACK */ +#define SPDU_MIP 0x31 /* MINOR SYNCHRONIZATION POINT */ +#define SPDU_MIA 0x32 /* MINOR SYNC ACK */ +#define SPDU_MAP 0x29 /* MAJOR SYNCHRONIZATION POINT */ +#define SPDU_MAA 0x2a /* MAJOR SYNC ACK */ +#define SPDU_RS 0x35 /* RESYNCHRONIZE */ +#define SPDU_RA 0x22 /* RESYNCHRONIZE ACK */ +#define SPDU_PR 0x07 /* PREPARE */ +#define SPDU_ER 0x00 /* EXCEPTION REPORT */ +#define SPDU_ED 0x30 /* EXCEPTION DATA */ +#define SPDU_AS 0x2d /* ACTIVITY START */ +#define SPDU_AR 0x1d /* ACTIVITY RESUME */ +#define SPDU_AI SPDU_AB /* ACTIVITY INTERRUPT */ +#define SPDU_AIA SPDU_AA /* ACTIVITY INTERRUPT ACK */ +#define SPDU_AD 0x39 /* ACTIVITY DISCARD */ +#define SPDU_ADA 0x3a /* ACTIVITY DISCARD ACK */ +#define SPDU_AE SPDU_MAP/* ACTIVITY END */ +#define SPDU_AEA SPDU_MAA/* ACTIVITY END ACK */ + + u_long s_li; +#define SPDU_MAXLEN 65535 /* segment if SSDU larger */ + +/* A nice magic number: + for the GT SPDU, 2 octets + for the DT SPDU, 2 octets + 3 octets for the enclosure option + + 2 + 2 + 3 = 7 + */ +#define SSDU_MAGIC 7 + + union { + struct { /* CONNECT/ACCEPT SPDU */ +#define SMASK_CN_REF 0x0001 + struct SSAPref un_cn_reference; + + struct { +#define SMASK_CN_OPT 0x0002 + u_char un_cn_options; +#define CR_OPT_NULL 0x00 +#define CR_OPT_EXTD 0x01 /* will receive extended concatenated SPDUs, + this implementation DOESN'T; segmenting is + enough... */ +#define CR_OPT_MASK CR_OPT_EXTD + +#define SMASK_CN_TSDU 0x0004 + u_short un_cn_tsdu_init; + u_short un_cn_tsdu_resp; + +#define SMASK_CN_VRSN 0x0008 + u_char un_cn_version; + +#define SMASK_CN_ISN 0x0010 +#define SIZE_CN_ISN 6 + u_long un_cn_isn; + +#define SMASK_CN_SET 0x0020 + u_char un_settings; + } un_cn_item; + +#define SMASK_AC_TOKEN 0x0040 + u_char un_ac_token;/* ACCEPT SPDU only */ + +#define SMASK_CN_REQ 0x0080 + u_short un_cn_requirements; + +#define SMASK_CN_CALLING 0x0100 + char un_cn_calling[SSSIZE]; + int un_cn_callinglen; + +#define SMASK_CN_CALLED 0x0200 + char un_cn_called[SSSIZE]; + int un_cn_calledlen; + } un_cn; +#define CN_SIZE 512 +#define CONNECT_MAX 10240 /* someday support CDO/OA SPDUs and Data + Overflow PI... */ +#define CN_BASE_SIZE 56 +#define AC_SIZE 512 +#define AC_BASE_SIZE 62 + + struct { /* REFUSE SPDU */ +#define SMASK_RF_REF 0x0001 + struct SSAPref un_rf_reference; + +#define SMASK_RF_DISC 0x0002 + u_char un_rf_disconnect; +#define RF_DISC_RELEASE 0x01 /* release transport connection */ +#define RF_DISC_MASK RF_DISC_RELEASE + +#define SMASK_RF_REQ 0x0004 + u_short un_rf_requirements; + +#define SMASK_RF_VRSN 0x0008 + u_char un_rf_version; + + char *un_rf_rdata; + int un_rf_rlen; + } un_rf; +#define RF_SIZE 513 +#define RF_BASE_SIZE 13 + + struct { /* FINISH SPDU */ +#define SMASK_FN_DISC 0x0001 + u_char un_fn_disconnect; +#define FN_DISC_RELEASE 0x01 /* release transport connection */ +#define FN_DISC_MASK FN_DISC_RELEASE + } un_fn; +#define FN_SIZE 512 +#define FN_BASE_SIZE 6 + + /* DISCONNECT SPDU */ +#define DN_SIZE 512 +#define DN_BASE_SIZE 3 + + /* NOT FINISHED SPDU */ +#define NF_SIZE 512 +#define NF_BASE_SIZE 3 + + struct { /* ABORT SPDU */ +#define SMASK_AB_DISC 0x0001 + u_char un_ab_disconnect; +#define AB_DISC_RELEASE 0x01 /* release transport connection */ +#define AB_DISC_USER 0x02 /* user abort */ +#define AB_DISC_PROTO 0x04 /* protocol error */ +#define AB_DISC_UNKNOWN 0x08 /* no reason */ +#define AB_DISC_MASK (AB_DISC_RELEASE | AB_DISC_USER | AB_DISC_PROTO \ + | AB_DISC_UNKNOWN) + +#define SMASK_AB_REFL 0x0002 +#define AB_REFL_SIZE 9 + u_char un_ab_reflect[AB_REFL_SIZE]; + } un_ab; +#define AB_SIZE 9 +#define AB_BASE_SIZE 17 +#define SMASK_SPDU_AB 0x0004 + /* to distinguish between AB and AI SPDUs */ + + + /* ABORT ACCEPT SPDU */ +#define AA_SIZE 0 +#define AA_BASE_SIZE 0 +#define SMASK_SPDU_AA 0x0001 /* to distinguish between AA and AIA SPDUs */ + + + /* DATA TRANSFER SPDU */ +#define DT_SIZE 65535 +#define DT_MINSIZE 64 /* don't segment if MSS < this */ +#define DT_BASE_SIZE 3 + + /* EXPEDITED DATA SPDU */ +#define EX_SIZE SX_EXSIZE +#define EX_BASE_SIZE 0 + + /* TYPED DATA SPDU */ +#define TD_SIGHS 65535 /* should be TD_SIZE, but <tsap.h> + got there first */ +#define TD_MINSIZE 64 /* don't segment if MSS < this */ +#define TD_BASE_SIZE 3 + + /* CAPABILITY DATA SPDU */ +#define CD_SIZE SX_CDSIZE +#define CD_BASE_SIZE 3 + + /* CAPABILITY DATA ACK SPDU */ +#define CDA_SIZE SX_CDASIZE +#define CDA_BASE_SIZE 3 + + struct { /* GIVE TOKENS SPDU */ +#define SMASK_GT_TOKEN 0x0001 + u_char un_gt_token; + } un_gt; +#define GT_SIZE 0 +#define GT_BASE_SIZE 3 +#define SMASK_SPDU_GT 0x0002 /* to distinguish between DT and GT SPDUs */ + + struct { /* PLEASE TOKENS SPDU */ +#define SMASK_PT_TOKEN 0x0001 + u_char un_pt_token; + } un_pt; +#define PT_SIZE 512 +#define PT_BASE_SIZE 6 + + /* GIVE TOKENS CONFIRM SPDU */ +#define GTC_SIZE 0 +#define GTC_BASE_SIZE 0 + + /* GIVE TOKENS ACK SPDU */ +#define GTA_SIZE 0 +#define GTA_BASE_SIZE 0 + + struct { /* MINOR SYNC POINT SPDU */ +#define SMASK_MIP_SYNC 0x0001 + u_char un_mip_sync; +#define MIP_SYNC_NOEXPL 0x01 /* NO EXPLICIT ACK REQUIRED */ +#define MIP_SYNC_MASK MIP_SYNC_NOEXPL + +#define SMASK_MIP_SERIAL 0x0002 + u_long un_mip_serial; + } un_mip; +#define MIP_SIZE 512 +#define MIP_BASE_SIZE 14 + + struct { /* MINOR SYNC ACK SPDU */ +#define SMASK_MIA_SERIAL 0x0001 + u_long un_mia_serial; + } un_mia; +#define MIA_SIZE 512 +#define MIA_BASE_SIZE 11 + + struct { /* MAJOR SYNC POINT SPDU */ +#define SMASK_MAP_SYNC 0x0001 + u_char un_map_sync; +#define MAP_SYNC_NOEND 0x01 /* ACTIVITY NOT ENDED (i.e., MAP not AE) */ +#define MAP_SYNC_MASK MAP_SYNC_NOEND + +#define SMASK_MAP_SERIAL 0x0002 + u_long un_map_serial; + } un_map; +#define MAP_SIZE 512 +#define MAP_BASE_SIZE 14 + + struct { /* MAJOR SYNC ACK SPDU */ +#define SMASK_MAA_SERIAL 0x0001 + u_long un_maa_serial; + } un_maa; +#define MAA_SIZE 512 +#define MAA_BASE_SIZE 11 + + struct { /* RESYNCHRONIZE SPDU */ +#define SMASK_RS_SET 0x0001 + u_char un_rs_settings; + +#define SMASK_RS_TYPE 0x0002 + u_char un_rs_type; +#define SYNC_OK(r) (((unsigned) (r)) <= SYNC_SET) + +#define SMASK_RS_SSN 0x0004 + u_long un_rs_serial; + } un_rs; +#define RS_SIZE 512 +#define RS_BASE_SIZE 17 + + struct { /* RESYNCHRONIZE ACK SPDU */ +#define SMASK_RA_SET 0x0001 + u_char un_ra_settings; + +#define SMASK_RA_SSN 0x0002 + u_long un_ra_serial; + } un_ra; +#define RA_SIZE 512 +#define RA_BASE_SIZE 14 + + struct { /* PREPARE SPDU */ +#define SMASK_PR_TYPE 0x0001 + u_char un_pr_type; +#define PR_MAA 1 /* expect SPDU_MAA */ +#define PR_RS 2 /* expect SPDU_RS */ +#define PR_RA 3 /* expect SPDU_RA */ +#define PR_AB 4 /* expect SPDU_AB */ +#define PR_MAX PR_AB + } un_pr; +#define PR_SIZE 0 +#define PR_BASE_SIZE 3 + + /* EXCEPTION REPORT SPDU */ +#define ER_SIZE 0 +#define ER_BASE_SIZE 0 + + struct { /* EXCEPTION DATA SPDU */ +#define SMASK_ED_REASON 0x0001 + u_char un_ed_reason; +#define SP_OK(r) (((r) < SP_PROCEDURAL \ + && (r) != SP_RSVD1 \ + && (r) != SP_RSVD2) \ + || (r) == SP_DEMAND) + } un_ed; +#define ED_SIZE 512 +#define ED_BASE_SIZE 6 + + struct { /* ACTIVITY START SPDU */ +#define SMASK_AS_ID 0x0001 + struct SSAPactid un_as_id; + } un_as; +#define AS_SIZE 512 +#define AS_BASE_SIZE 11 + + struct { /* ACTIVITY RESUME SPDU */ + struct { +#define SMASK_AR_REF 0x0001 + struct SSAPref un_ar_reference; + +#define SMASK_AR_OID 0x0002 + struct SSAPactid un_ar_oid; + +#define SMASK_AR_SSN 0x0004 + u_long un_ar_serial; + } un_ar_link; + +#define SMASK_AR_ID 0x0008 + struct SSAPactid un_ar_id; + } un_ar; +#define AR_SIZE 512 +#define AR_BASE_SIZE 29 + + struct { /* ACTIVITY INTERRUPT (ABORT) SPDU */ +#define SMASK_AI_REASON 0x0001 /* don't collide with SMASK_AB_DISC */ + u_char un_ai_reason; + } un_ai; +#define AI_SIZE 0 +#define AI_BASE_SIZE 3 + + /* ACTIVITY INTERRUPT (ABORT) ACK SPDU */ +#define AIA_SIZE 0 +#define AIA_BASE_SIZE 0 + + + struct { /* ACTIVITY DISCARD SPDU */ +#define SMASK_AD_REASON 0x0001 + u_char un_ad_reason; + } un_ad; +#define AD_SIZE 0 +#define AD_BASE_SIZE 3 + + /* ACTIVITY DISCARD ACK SPDU */ +#define ADA_SIZE 0 +#define ADA_BASE_SIZE 0 + + /* ACTIVITY END (MAJOR SYNC) SPDU */ +#define AE_SIZE 512 +#define AE_BASE_SIZE 8 + + /* ACTIVITY END (MAJOR SYNC) ACK SPDU */ +#define AEA_SIZE MAA_SIZE +#define AEA_BASE_SIZE MAA_BASE_SIZE + } s_un; +#define s_cn_reference s_un.un_cn.un_cn_reference +#define s_options s_un.un_cn.un_cn_item.un_cn_options +#define s_tsdu_init s_un.un_cn.un_cn_item.un_cn_tsdu_init +#define s_tsdu_resp s_un.un_cn.un_cn_item.un_cn_tsdu_resp +#define s_cn_version s_un.un_cn.un_cn_item.un_cn_version +#define s_isn s_un.un_cn.un_cn_item.un_cn_isn +#define s_settings s_un.un_cn.un_cn_item.un_settings +#define s_ac_token s_un.un_cn.un_ac_token +#define s_cn_require s_un.un_cn.un_cn_requirements +#define s_calling s_un.un_cn.un_cn_calling +#define s_callinglen s_un.un_cn.un_cn_callinglen +#define s_called s_un.un_cn.un_cn_called +#define s_calledlen s_un.un_cn.un_cn_calledlen + +#define s_rf_reference s_un.un_rf.un_rf_reference +#define s_rf_disconnect s_un.un_rf.un_rf_disconnect +#define s_rf_require s_un.un_rf.un_rf_requirements +#define s_rf_version s_un.un_rf.un_rf_version +#define s_rdata s_un.un_rf.un_rf_rdata +#define s_rlen s_un.un_rf.un_rf_rlen + +#define s_fn_disconnect s_un.un_fn.un_fn_disconnect + +#define s_ab_disconnect s_un.un_ab.un_ab_disconnect +#define s_reflect s_un.un_ab.un_ab_reflect + +#define s_gt_token s_un.un_gt.un_gt_token + +#define s_pt_token s_un.un_pt.un_pt_token + +#define s_mip_sync s_un.un_mip.un_mip_sync +#define s_mip_serial s_un.un_mip.un_mip_serial + +#define s_mia_serial s_un.un_mia.un_mia_serial + +#define s_map_sync s_un.un_map.un_map_sync +#define s_map_serial s_un.un_map.un_map_serial + +#define s_maa_serial s_un.un_maa.un_maa_serial + +#define s_rs_settings s_un.un_rs.un_rs_settings +#define s_rs_type s_un.un_rs.un_rs_type +#define s_rs_serial s_un.un_rs.un_rs_serial + +#define s_ra_settings s_un.un_ra.un_ra_settings +#define s_ra_serial s_un.un_ra.un_ra_serial + +#define s_pr_type s_un.un_pr.un_pr_type + +#define s_ed_reason s_un.un_ed.un_ed_reason + +#define s_as_id s_un.un_as.un_as_id + +#define s_ar_reference s_un.un_ar.un_ar_link.un_ar_reference +#define s_ar_oid s_un.un_ar.un_ar_link.un_ar_oid +#define s_ar_serial s_un.un_ar.un_ar_link.un_ar_serial +#define s_ar_id s_un.un_ar.un_ar_id + +#define s_ai_reason s_un.un_ai.un_ai_reason + +#define s_ad_reason s_un.un_ad.un_ad_reason + + +#define SMASK_ENCLOSE 0x2000 + u_char s_enclose; +#define ENCL_BEGIN 0x01 /* beginning of SSDU */ +#define ENCL_END 0x02 /* end of SSDU */ +#define ENCL_MASK (ENCL_BEGIN | ENCL_END) +#define ENCLOSE_MAX 65400 /* maximum size of enclosure per segment + less slop; slop varies based on SPDU, but + we'll always assume the worst case */ +#define SEGMENT_MAX 65528 /* for things other than S-DATA and + S-TYPED-DATA under version 2 we allow only + ONE enclosure */ + +#define SMASK_UDATA_PGI 0x4000 + char *s_udata; /* user data PGI */ + int s_ulen; /* .. */ + +#define SMASK_SPDU_EXPD 0x8000 /* SPDU arrived on the expedited connection */ + + struct qbuf s_qbuf; /* user info */ + int s_qlen; /* .. */ +}; +#define NULLSPKT ((struct ssapkt *) 0) + + +int freespkt (); +struct ssapkt *newspkt (); + +void text2spkt (), spkt2text (); + +int spkt2tsdu (); +struct ssapkt *tsdu2spkt (); + +char *spkt2str (); +struct ssapkt *str2spkt (); diff --git a/src/isode/h/ssap.h b/src/isode/h/ssap.h new file mode 100644 index 0000000000..ad521fc879 --- /dev/null +++ b/src/isode/h/ssap.h @@ -0,0 +1,518 @@ +/* ssap.h - include file for session users (SS-USER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:29:54 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:21 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:34 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:56 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _SSAP_ +#define _SSAP_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif +#ifndef _ISOADDRS_ +#include "isoaddrs.h" +#endif + +/* */ + +struct SSAPactid { /* Activity Identifier */ +#define SID_DATA_SIZE 6 + u_char sd_len; + char sd_data[SID_DATA_SIZE]; +}; + +struct SSAPref { /* SSAP reference */ + /* USER reference */ +#define SREF_USER_SIZE 64 + u_char sr_ulen; + char sr_udata[SREF_USER_SIZE]; + + /* COMMON reference */ +#define SREF_COMM_SIZE 64 + u_char sr_clen; + char sr_cdata[SREF_COMM_SIZE]; + + /* ADDITIONAL reference */ +#define SREF_ADDT_SIZE 4 + u_char sr_alen; + char sr_adata[SREF_ADDT_SIZE]; + + /* for S-ACTIVITY-RESUME */ + u_char sr_vlen; + char sr_vdata[SREF_USER_SIZE]; + +#define sr_calling sr_udata +#define sr_calling_len sr_ulen +#define sr_called sr_vdata +#define sr_called_len sr_vlen +}; + +/* */ + +struct SSAPstart { /* S-CONNECT.INDICATION */ + int ss_sd; /* SESSION descriptor */ + + struct SSAPref ss_connect; /* session connection identifier */ + + struct SSAPaddr ss_calling; /* address of peer calling */ + struct SSAPaddr ss_called; /* address of peer called */ + + int ss_requirements; /* session requirements */ + int ss_settings; /* initial settings of tokens */ + long ss_isn; /* initial serial number */ + + int ss_ssdusize; /* largest atomic SSDU */ + + struct QOStype ss_qos; /* quality of service */ + + /* initial DATA from peer */ +#define SS_SIZE 512 + int ss_cc; /* length */ + char *ss_data; /* data */ +}; +#define SSFREE(ss) \ +{ \ + if ((ss) -> ss_data) \ + free ((ss) -> ss_data), (ss) -> ss_data = NULL; \ +} + + +struct SSAPconnect { /* S-CONNECT.CONFIRMATION */ + int sc_sd; /* SESSION descriptor */ + + struct SSAPref sc_connect; /* session connection identifier */ + + struct SSAPaddr sc_responding;/* address of peer responding */ + + int sc_result; /* result */ +#define SC_ACCEPT (-1) + +#define SC_BASE 0x80 /* reject by SSAP-provider */ +#define SC_SSAPID (SC_BASE + 1) /* SSAP identifier unknown */ +#define SC_SSUSER (SC_BASE + 2) /* SS-user not attached to SSAP */ +#define SC_CONGEST (SC_BASE + 3) /* Congestion at SSAP */ +#define SC_VERSION (SC_BASE + 4) /* Proposed protocol versions not + supported */ + + /* begin UNOFFICIAL */ +#define SC_ADDRESS (SC_BASE + 5) /* Address unknown */ +#define SC_REFUSED (SC_BASE + 6) /* Connect request refused on this + network connection */ +#define SC_TRANSPORT (SC_BASE + 7) /* Transport disconnect */ +#define SC_ABORT (SC_BASE + 8) /* Provider-initiated abort */ +#define SC_PROTOCOL (SC_BASE + 9) /* Protocol error */ +#define SC_PARAMETER (SC_BASE + 10) /* Invalid parameter */ +#define SC_OPERATION (SC_BASE + 11) /* Invalid operation */ +#define SC_TIMER (SC_BASE + 12) /* Timer expired */ +#define SC_WAITING (SC_BASE + 13) /* Indications waiting */ + /* end UNOFFICIAL */ + + /* reject by SSAP-user */ +#define SC_NOTSPECIFIED 0 /* Reason not specified */ +#define SC_CONGESTION 1 /* Temporary congestion */ +#define SC_REJECTED 2 /* Rejected */ + +#ifdef notdef +#define SC_FATAL(r) ((r) < SC_BASE || (r) < SC_PARAMETER) +#define SC_OFFICIAL(r) ((r) < SC_BASE || (r) < SC_ADDRESS) +#else +#define SC_FATAL(r) ((r) < SC_PARAMETER) +#define SC_OFFICIAL(r) ((r) < SC_ADDRESS) +#endif + + int sc_requirements; /* session requirements */ + int sc_settings; /* initial assignment of tokens */ + int sc_please; /* tokens requested by SS-user + (S-TOKEN-PLEASE.INDICATION) */ + long sc_isn; /* initial serial number */ + + int sc_ssdusize; /* largest atomic SSDU */ + + struct QOStype sc_qos; /* quality of service */ + + /* initial DATA from peer */ +#ifdef HPUX +#undef SC_SIZE +#endif +#define SC_SIZE 512 + int sc_cc; /* length */ + char *sc_data; /* data */ + char *sc_realdata; /* real head of data */ +}; +#define SCFREE(sc) \ +{ \ + if ((sc) -> sc_realdata) \ + free ((sc) -> sc_realdata), \ + (sc) -> sc_realdata = (sc) -> sc_data = NULL; \ + else \ + if ((sc) -> sc_data) \ + free ((sc) -> sc_data), (sc) -> sc_data = NULL; \ +} + + + /* SESSION requirements */ +#define SR_HALFDUPLEX 0x0001 /* half-duplex */ +#define SR_DUPLEX 0x0002 /* full-duplex */ +#define SR_EXPEDITED 0x0004 /* expedited data transfer */ +#define SR_MINORSYNC 0x0008 /* minor synchronize */ +#define SR_MAJORSYNC 0x0010 /* major synchronize */ +#define SR_RESYNC 0x0020 /* resynchronize */ +#define SR_ACTIVITY 0x0040 /* activity management */ +#define SR_NEGOTIATED 0x0080 /* negotiated release */ +#define SR_CAPABILITY 0x0100 /* capability data transfer */ +#define SR_EXCEPTIONS 0x0200 /* exceptions reporting */ +#define SR_TYPEDATA 0x0400 /* typed data transfer */ +#define SR_SYMMETRIC 0x0800 /* symmetric synchronize */ + +#define SR_RLS_EXISTS SR_NEGOTIATED +#define SR_MAJ_EXISTS (SR_MAJORSYNC | SR_ACTIVITY) +#define SR_ACT_EXISTS SR_ACTIVITY +#define SR_MIN_EXISTS SR_MINORSYNC +#define SR_DAT_EXISTS SR_HALFDUPLEX + +#define SR_TOKENS (SR_RLS_EXISTS | SR_MAJ_EXISTS | SR_ACT_EXISTS \ + | SR_MIN_EXISTS | SR_DAT_EXISTS) + +#define SR_BASUBSET (SR_HALFDUPLEX | SR_TYPEDATA | SR_CAPABILITY \ + | SR_MINORSYNC | SR_EXCEPTIONS | SR_ACTIVITY) +#define SR_BCSUBSET (SR_HALFDUPLEX | SR_DUPLEX) +#define SR_BSSUBSET (SR_NEGOTIATED | SR_HALFDUPLEX | SR_DUPLEX \ + | SR_TYPEDATA | SR_MINORSYNC | SR_MAJORSYNC \ + | SR_RESYNC) +#define SR_MYREQUIRE (SR_BASUBSET | SR_BCSUBSET | SR_BSSUBSET \ + | SR_EXPEDITED) +#define SR_DEFAULT (SR_HALFDUPLEX | SR_MINORSYNC | SR_ACTIVITY \ + | SR_CAPABILITY | SR_EXCEPTIONS) + + /* SESSION tokens */ +#define ST_INIT_VALUE 0x00 /* initiator's side */ +#define ST_RESP_VALUE 0x01 /* responder's side */ +#define ST_CALL_VALUE 0x02 /* called SS-user's choice */ +#define ST_RSVD_VALUE 0x03 /* reserved */ + +#define ST_MASK 0x03 + +#define ST_RLS_SHIFT 6 /* release token */ +#define ST_MAJ_SHIFT 4 /* major/activity token */ +#define ST_ACT_SHIFT ST_MAJ_SHIFT +#define ST_MIN_SHIFT 2 /* synchronize-minor token */ +#define ST_DAT_SHIFT 0 /* data token */ + +#define dotokens() \ +{ \ + dotoken (SR_RLS_EXISTS, ST_RLS_SHIFT, ST_RLS_TOKEN, "release"); \ + dotoken (SR_MAJ_EXISTS, ST_MAJ_SHIFT, ST_MAJ_TOKEN, "majorsync"); \ + dotoken (SR_MIN_EXISTS, ST_MIN_SHIFT, ST_MIN_TOKEN, "minorsync"); \ + dotoken (SR_DAT_EXISTS, ST_DAT_SHIFT, ST_DAT_TOKEN, "data"); \ +} + + +struct SSAPdata { /* S-READ.INDICATION */ + int sx_type; /* type of indication */ +#define SX_NORMAL 0x00 /* S-DATA.INDICATION */ +#define SX_EXPEDITED 0x01 /* S-EXPEDITED-DATA.INDICATION */ +#define SX_TYPED 0x02 /* S-TYPED-DATA.INDICATION */ +#define SX_CAPDIND 0x03 /* S-CAPABILITY-DATA.INDICATION */ +#define SX_CAPDCNF 0x04 /* S-CAPABILITY-DATA.CONFIRMATION */ + +#define SX_EXSIZE 14 /* EXPEDITED DATA (XSSDU) only */ +#define SX_CDSIZE 512 /* CAPABILITY DATA only */ +#define SX_CDASIZE 512 /* CAPABILITY DATA ACK only */ + int sx_cc; /* total length */ + struct qbuf sx_qbuf; /* chained data */ +}; +#define SXFREE(sx) QBFREE (&((sx) -> sx_qbuf)) + + +struct SSAPtoken { /* S-{TOKEN-*,GIVE-CONTROL}.INDICATION */ + int st_type; /* type of indication */ +#define ST_GIVE 0x00 /* S-TOKEN-GIVE.INDICATION */ +#define ST_PLEASE 0x01 /* S-TOKEN-PLEASE.INDICATION */ +#define ST_CONTROL 0x02 /* S-GIVE-CONTROL.INDICATION */ + + u_char st_tokens; /* tokens offered/wanted */ +#define ST_RLS_TOKEN (0x01 << ST_RLS_SHIFT) +#define ST_MAJ_TOKEN (0x01 << ST_MAJ_SHIFT) +#define ST_ACT_TOKEN (0x01 << ST_ACT_SHIFT) +#define ST_MIN_TOKEN (0x01 << ST_MIN_SHIFT) +#define ST_DAT_TOKEN (0x01 << ST_DAT_SHIFT) + + u_char st_owned; /* tokens owned by user */ + +#define ST_SIZE 512 /* PLEASE TOKEN only */ + int st_cc; /* length */ + char *st_data; /* data */ +}; +#define STFREE(st) \ +{ \ + if ((st) -> st_data) \ + free ((st) -> st_data), (st) -> st_data = NULL; \ +} + + +struct SSAPsync { /* S-*-SYNC.{INDICATION,CONFIRMATION} */ + int sn_type; /* type of indication/confirmation */ +#define SN_MAJORIND 0x00 /* S-MAJOR-SYNC.INDICATION */ +#define SN_MAJORCNF 0x01 /* S-MAJOR-SYNC.CONFIRMATION */ +#define SN_MINORIND 0x02 /* S-MINOR-SYNC.INDICATION */ +#define SN_MINORCNF 0x03 /* S-MINOR-SYNC.CONFIRMATION */ +#define SN_RESETIND 0x04 /* S-RESYNCHRONIZE.INDICATION */ +#define SN_RESETCNF 0x05 /* S-RESYNCHRONIZE.CONFIRMATION */ + + int sn_options; /* options (!!) */ + /* for S-MINOR-SYNC.INDICATION */ +#define SYNC_CONFIRM 1 /* wants confirmation */ +#define SYNC_NOCONFIRM 0 /* .. nope */ + /* for S-RESYNCHRONIZE.INDICATION */ +#define SYNC_RESTART 0 /* restart */ +#define SYNC_ABANDON 1 /* abandon */ +#define SYNC_SET 2 /* set */ + + long sn_ssn; /* serial number */ +#define SERIAL_NONE (-1L) /* No SSN */ +#define SERIAL_MIN 000000L /* the min SSN */ +#define SERIAL_MAX 999998L /* the max SSN */ + + int sn_settings; /* new token settings (RESYNC only) */ + + /* sync data from peer */ +#define SN_SIZE 512 + int sn_cc; /* length */ + char *sn_data; /* data */ +}; +#define SNFREE(sn) \ +{ \ + if ((sn) -> sn_data) \ + free ((sn) -> sn_data), (sn) -> sn_data = NULL; \ +} + + +struct SSAPactivity { /* S-ACTIVITY-*.{INDICATION,CONFIRMATION} */ + int sv_type; /* type of indication/confirmation */ +#define SV_START 0x00 /* S-ACTIVITY-START.INDICATION */ +#define SV_RESUME 0x01 /* S-ACTIVITY-RESUME.INDICATION */ +#define SV_INTRIND 0x02 /* S-ACTIVITY-INTERRUPT.INDICATION */ +#define SV_INTRCNF 0x03 /* S-ACTIVITY-INTERRUPT.CONFIRMATION */ +#define SV_DISCIND 0x04 /* S-ACTIVITY-DISCARD.INDICATION */ +#define SV_DISCCNF 0x05 /* S-ACTIVITY-DISCARD.CONFIRMATION */ +#define SV_ENDIND 0x06 /* S-ACTIVITY-END.INDICATION */ +#define SV_ENDCNF 0x07 /* S-ACTIVITY-END.CONFIRMATION */ + + struct SSAPactid sv_id; /* START/RESUME activity identifier */ + + struct SSAPactid sv_oid; /* RESUME old activity identifier */ + struct SSAPref sv_connect;/* old connection identifier */ + + long sv_ssn; /* RESUME/END Serial number */ + + int sv_reason; /* INTERRUPT/DISCARD */ + /* same values as sp_reason */ + + /* activity DATA from peer */ +#define SV_SIZE 512 + int sv_cc; /* length */ + char *sv_data; /* data */ +}; +#define SVFREE(sv) \ +{ \ + if ((sv) -> sv_data) \ + free ((sv) -> sv_data), (sv) -> sv_data = NULL; \ +} + + +struct SSAPreport { /* S-{U,P}-EXCEPTION-REPORT.INDICATION */ + int sp_peer; /* T = S-U-EXCEPTION-REPORT.INDICATION: + sp_reason/sp_data both meaningful + NIL = S-P-EXCEPTION-REPORT.INDICATION: + sp_reason == SP_NOREASON, or + sp_reason == SP_PROTOCOL */ + int sp_reason; +#define SP_NOREASON 0 /* No specific reason stated */ +#define SP_JEOPARDY 1 /* User receiving ability jeopardized */ +#define SP_RSVD1 2 /* reserved */ +#define SP_SEQUENCE 3 /* User sequence error */ +#define SP_RSVD2 4 /* reserved */ +#define SP_LOCAL 5 /* Local SS-user error */ +#define SP_PROCEDURAL 6 /* Unrecoverable procedural error */ +#define SP_DEMAND 128 /* Demand data token */ + +#define SP_PROTOCOL (-1) /* SS-provider protocol error */ + + /* report DATA from peer */ +#define SP_SIZE 512 + int sp_cc; /* length */ + char *sp_data; /* data */ +}; +#define SPFREE(sp) \ +{ \ + if ((sp) -> sp_data) \ + free ((sp) -> sp_data), (sp) -> sp_data = NULL; \ +} + + +struct SSAPfinish { /* S-RELEASE.INDICATION */ + /* release DATA from peer */ +#define SF_SIZE 512 + int sf_cc; /* length */ + char *sf_data; /* data */ +}; +#define SFFREE(sf) \ +{ \ + if ((sf) -> sf_data) \ + free ((sf) -> sf_data), (sf) -> sf_data = NULL; \ +} + + +struct SSAPrelease { /* S-RELEASE.CONFIRMATION */ + int sr_affirmative; /* T = connection released + NIL = request refused */ + + /* release DATA from peer */ +#define SR_SIZE 512 + int sr_cc; /* length */ + char *sr_data; /* data */ +}; +#define SRFREE(sr) \ +{ \ + if ((sr) -> sr_data) \ + free ((sr) -> sr_data), (sr) -> sr_data = NULL; \ +} + + +struct SSAPabort { /* S-{U,P}-ABORT.INDICATION */ + int sa_peer; /* T = S-U-ABORT.INDICATION: + sa_info/sa_cc is meaningful + NIL = S-P-ABORT.INDICATION: + sa_reason is meaningful, + sa_data/sa_cc contains diagnostics */ + + int sa_reason; /* same codes as sc_result */ + + /* abort DATA from peer */ +#define SA_SIZE 512 /* N.B.: the ISO DIS says 9, but we use + 512 instead so ASE-level aborts will work + reasonably */ + int sa_cc; /* length */ + char *sa_info; /* data (from the peer) */ + char *sa_realinfo; /* real head of data */ + char sa_data[512]; /* data (for messages from provider) */ +}; +#define SAFREE(sa) \ +{ \ + if ((sa) -> sa_realinfo) \ + free ((sa) -> sa_realinfo), (sa) -> sa_realinfo = NULL; \ +} + + +struct SSAPindication { + int si_type; /* the union element present */ +#define SI_DATA 0x00 +#define SI_TOKEN 0x01 +#define SI_SYNC 0x02 +#define SI_ACTIVITY 0x03 +#define SI_REPORT 0x04 +#define SI_FINISH 0x05 +#define SI_ABORT 0x06 + + union { + struct SSAPdata si_un_data; + struct SSAPtoken si_un_token; + struct SSAPsync si_un_sync; + struct SSAPactivity si_un_activity; + struct SSAPreport si_un_report; + struct SSAPfinish si_un_finish; + struct SSAPabort si_un_abort; + } si_un; +#define si_data si_un.si_un_data +#define si_token si_un.si_un_token +#define si_sync si_un.si_un_sync +#define si_activity si_un.si_un_activity +#define si_report si_un.si_un_report +#define si_finish si_un.si_un_finish +#define si_abort si_un.si_un_abort +}; + +/* */ + +extern char *ssapversion; + + +int SExec (); /* SERVER only */ +int SInit (); /* S-CONNECT.INDICATION */ + +int SConnResponse (); /* S-CONNECT.RESPONSE */ +int SConnRequest (); /* S-CONNECT.REQUEST (backwards-compatible) */ +#define SConnRequest(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) \ + SAsynConnRequest (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,0) +int SAsynConnRequest (); /* S-(ASYN-)CONNECT.REQUEST */ +int SAsynRetryRequest (); /* S-ASYN-RETRY.REQUEST (pseudo) */ +int SDataRequest (); /* S-DATA.REQUEST */ +int SSendRequest (); /* S-SEND.REQUEST (segmented) */ +int SWriteRequest (); /* S-WRITE.REQUEST (pseudo) */ +int SExpdRequest (); /* S-EXPEDITED-DATA.REQUEST */ +int STypedRequest (); /* S-TYPED-DATA.REQUEST */ +int SCapdRequest (); /* S-CAPABILITY-DATA.REQUEST */ +int SCapdResponse (); /* S-CAPABILITY-DATA.RESPONSE */ +int SReadRequest (); /* S-READ.REQUEST (pseudo) */ +int SGTokenRequest (); /* S-TOKEN-GIVE.REQUEST */ +int SPTokenRequest (); /* S-TOKEN-PLEASE.REQUEST */ +int SGControlRequest (); /* S-CONTROL-GIVE.REQUEST */ +int SMajSyncRequest (); /* S-MAJOR-SYNC.REQUEST */ +int SMajSyncResponse (); /* S-MAJOR-SYNC.RESPONSE */ +int SMinSyncRequest (); /* S-MINOR-SYNC.REQUEST */ +int SMinSyncResponse (); /* S-MINOR-SYNC.RESPONSE */ +int SReSyncRequest (); /* S-RESYNCHRONIZE.REQUEST */ +int SReSyncResponse (); /* S-RESYNCHRONIZE.RESPONSE */ +int SActStartRequest (); /* S-ACTIVITY-START.REQUEST */ +int SActResumeRequest (); /* S-ACTIVITY-RESUME.REQUEST */ +int SActIntrRequest (); /* S-ACTIVITY-INTERRUPT.REQUEST */ +int SActIntrResponse (); /* S-ACTIVITY-INTERRUPT.RESPONSE */ +int SActDiscRequest (); /* S-ACTIVITY-DISCARD.REQUEST */ +int SActDiscResponse (); /* S-ACTIVITY-DISCARD.RESPONSE */ +int SActEndRequest (); /* S-ACTIVITY-END.REQUEST */ +int SActEndResponse (); /* S-ACTIVITY-END.RESPONSE */ +int SUAbortRequest (); /* S-U-ABORT.REQUEST */ +int SUReportRequest (); /* S-U-EXCEPTION-REPORT.REQUEST */ +int SRelRequest (); /* S-RELEASE.REQUEST */ +int SRelRetryRequest (); /* S-RELEASE-RETRY.REQUEST (pseudo) */ +int SRelResponse (); /* S-RELEASE.RESPONSE */ + +int SSetIndications (); /* define vectors for INDICATION events */ +int SSelectMask (); /* map session descriptors for select() */ + +char *SErrString (); /* return SSAP error code in string form */ + +#define SLocalHostName getlocalhost +char *SLocalHostName (); /* return name of local host (sigh) */ +#endif diff --git a/src/isode/h/sys.dirent.h b/src/isode/h/sys.dirent.h new file mode 100644 index 0000000000..b29694ade3 --- /dev/null +++ b/src/isode/h/sys.dirent.h @@ -0,0 +1,51 @@ +/* + <sys/dirent.h> -- file system independent directory entry (SVR3) + + last edit: 25-Apr-1987 D A Gwyn + + prerequisite: <sys/types.h> +*/ + + +/* The following nonportable ugliness could have been avoided by defining + DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments. */ +#define DIRENTBASESIZ (((struct dirent *)0)->d_name \ + - (char *)&((struct dirent *)0)->d_ino) +#define DIRENTSIZ( namlen ) ((DIRENTBASESIZ + sizeof(long) + (namlen)) \ + / sizeof(long) * sizeof(long)) + +/* DAG -- the following was moved from <dirent.h>, which was the wrong place */ +#define MAXNAMLEN 512 /* maximum filename length */ + +#ifndef NAME_MAX +#define NAME_MAX (MAXNAMLEN - 1) /* DAG -- added for POSIX */ +#endif + + +#ifdef dirent +#undef dirent +#else +#ifdef AUX +#define dirent _dirent +#endif +#endif + +struct dirent /* data from getdents()/readdir() */ + { +#ifdef apollo + long d_ino; /* inode number of entry */ + unsigned short d_reclen; /* length of this record */ + unsigned short d_namlen; /* length of string in d_name */ + off_t d_off; /* offset of disk directory entry */ + char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */ +#else + long d_ino; /* inode number of entry */ + off_t d_off; /* offset of disk directory entry */ + unsigned short d_reclen; /* length of this record */ + char d_name[1]; /* name of file */ /* non-POSIX */ +#endif + }; + +#ifdef XOS_2 +#define S_ISDIR( mode ) (((mode) & S_IFMT) == S_IFDIR) +#endif diff --git a/src/isode/h/sys.file.h b/src/isode/h/sys.file.h new file mode 100644 index 0000000000..465e1faf22 --- /dev/null +++ b/src/isode/h/sys.file.h @@ -0,0 +1,58 @@ +/* sys.file.h - system independent sys/file.h */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:30:00 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:25 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:39 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:57 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + +#ifndef _ISODE_SYS_FILE_H +#define _ISODE_SYS_FILE_H + +#include "general.h" + +/* Beware the ordering is important to avoid symbol clashes */ + +#ifndef SVR4_UCB +#include <sys/ioctl.h> +#endif + +#ifdef BSD42 +#include <sys/file.h> +#else +#ifdef SYS5 +#include <fcntl.h> +#else +#include <sys/fcntl.h> +#endif +#endif + +#ifdef SYS5 +#include <termio.h> +#endif + +#endif diff --git a/src/isode/h/tailor.h b/src/isode/h/tailor.h new file mode 100644 index 0000000000..c5f91a45c4 --- /dev/null +++ b/src/isode/h/tailor.h @@ -0,0 +1,177 @@ +/* tailor.h - ISODE tailoring */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:30:03 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:27 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:41 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:57 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _TAILOR_ +#define _TAILOR_ + +#ifndef _LOGGER_ +#include "logger.h" +#endif + + +/* SYSTEM AREAS */ + +extern char *isodename; +extern char *isodebinpath; +extern char *isodesbinpath; +extern char *isodetcpath; +extern char *isodelogpath; + + +/* LOGGING */ + +extern LLog *compat_log, _compat_log; +extern LLog *addr_log, _addr_log; +extern LLog *tsap_log, _tsap_log; +extern LLog *ssap_log, _ssap_log; +extern LLog *psap_log, _psap_log; +extern LLog *psap2_log, _psap2_log; +extern LLog *acsap_log, _acsap_log; +extern LLog *rtsap_log, _rtsap_log; +extern LLog *rosap_log, _rosap_log; + + +/* TRANSPORT-SWITCH */ + +extern int ts_stacks; +#define TS_NONE 0x00 +#define TS_TCP 0x01 +#define TS_X25 0x02 +#define TS_BRG 0x04 +#define TS_TP4 0x08 +#define TS_X2584 0x10 +#define TS_ALL 0xff + +struct ts_interim { + char *ts_name; /* community name, also MACRO name */ + char *ts_value; /* .. MACRO value */ + + int ts_subnet; /* internal key */ + int ts_syntax; /* same values as na_stack */ + + char ts_prefix[20]; /* NSAP prefix */ + int ts_length; /* .. and length */ +}; +extern struct ts_interim ts_interim[]; + +extern int ts_communities[]; +extern int ts_comm_nsap_default; +extern int ts_comm_x25_default; +extern int ts_comm_tcp_default; + +extern char *tsb_addresses[]; +extern int tsb_communities[]; + +extern char *tsb_default_address; + + + +/* X.25 */ + +#ifdef X25 +extern char *x25_local_dte; +extern char *x25_local_pid; + +extern char x25_intl_zero; +extern char x25_strip_dnic; +extern char *x25_dnic_prefix; + +extern u_char reverse_charge; +extern u_short recvpktsize; +extern u_short sendpktsize; +extern u_char recvwndsize; +extern u_char sendwndsize; +extern u_char recvthruput; +extern u_char sendthruput; +extern u_char cug_req; +extern u_char cug_index; +extern u_char fast_select_type; +extern u_char rpoa_req; +extern u_short rpoa; + +extern LLog *x25_log, _x25_log; + +#ifdef CAMTEC_CCL +extern char x25_outgoing_port; +#endif + +#ifdef ULTRIX_X25 +extern char *x25_default_template; +extern char *x25_default_filter; +extern char *x25_default_class; +#endif +#endif + + +/* BRIDGE X.25 */ + +#ifdef BRIDGE_X25 +extern char *x25_bridge_host; +extern char *x25_bridge_addr; +extern char *x25_bridge_listen; +extern char *x25_bridge_pid; +extern char *x25_bridge_discrim; +#endif + +#if defined (BRIDGE_X25) || defined (X25) +extern u_short x25_bridge_port; +#endif + + +/* SESSION */ + +extern int ses_ab_timer; +extern int ses_dn_timer; +extern int ses_rf_timer; + + +/* USER-FRIENDLY NAMESERVICE */ + +extern char ns_enabled; +extern char *ns_address; + + +/* ROUTINES */ + +void isodetailor (); +int isodesetvar (); +void isodexport (); + +#define isodefile(file,ispgm) \ + _isodefile ((ispgm) ? isodesbinpath : isodetcpath, (file)) + +char *_isodefile (); + +char *getlocalhost (); + +#endif diff --git a/src/isode/h/tp4.h b/src/isode/h/tp4.h new file mode 100644 index 0000000000..7a19ce05de --- /dev/null +++ b/src/isode/h/tp4.h @@ -0,0 +1,157 @@ +/* tp4.h - TP4 abstractions */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:30:05 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:29 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:43 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:58 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _TP4_ +#define _TP4_ + +/* */ + +#ifdef BSD_TP4 +#ifndef SOCK_STREAM +#include <sys/socket.h> +#endif +#include <netiso/iso.h> +#include <netiso/iso_errno.h> +#include <netiso/tp_user.h> + +union sockaddr_osi { + struct sockaddr_iso osi_sockaddr; + char osi_bigaddr[104]; +}; + +union osi_control_msg { + struct { + struct cmsghdr ocm_cmhdr; + char ocm_cmdata[128 - sizeof (struct cmsghdr)]; + } ocm_control; + + char ocm_data[128]; +}; + +int gen2tp4 (), tp42gen (); + + +#define CLTS /* have CL-mode transport service */ + +#ifndef _DGRAM_ +#include "dgram.h" +#endif + +int start_clts_server (); +#define start_clts_client start_clts_server + +#define join_clts_server(fd,sock) \ + join_dgram_aux ((fd), (struct sockaddr *) (sock), 0) +#define join_clts_client(fd,sock) \ + join_dgram_aux ((fd), (struct sockaddr *) (sock), 1) + +#define read_clts_socket read_dgram_socket +#define write_clts_socket write_dgram_socket +#define close_clts_socket close_dgram_socket + +#define select_clts_socket select_dgram_socket +#define check_clts_socket check_dgram_socket +#endif + +/* SunLink OSI */ + +#ifdef SUN_TP4 +#if defined(SUNLINK_6_0) && !defined(SUNLINK_5_2) +#define SUNLINK_5_2 +#endif + +#ifndef SUNLINK_6_0 +#include <sys/ieee802.h> +#else +#include <net/if_ieee802.h> +#endif +#ifndef SOCK_STREAM +#include <sys/socket.h> +#endif +#include <netosi/osi.h> +#ifdef SUNLINK_5_2 +#include <netosi/osi_profile.h> +#endif +#include <netosi/osi_addr.h> +#include <netosi/osi_error.h> +#include <netosi/tp_event.h> + + +#define MSG_OOB 0x1 /* process out-of-band data */ + + +struct tp4pkt { + union { + TP_MSG tp_msg; + TP_MSG_CONNECT tp_connect; + TP_MSG_DATA tp_data; + TP_MSG_X_DATA tp_x_data; + TP_MSG_DISCONNECT tp_disconnect; + } tp_un; +#define tp4_event tp_un.tp_msg.tp_event +#define tp4_called tp_un.tp_connect.dst_address +#define tp4_calling tp_un.tp_connect.src_address +#define tp4_expedited tp_un.tp_connect.expedited_selected +#define tp4_qos tp_un.tp_connect.tp_qos +#define tp4_eot tp_un.tp_data.eot +#define tp4_reason tp_un.tp_disconnect.reason +}; + +struct tp4pkt *newtp4pkt (); +#define freetp4pkt(tp) cfree ((char *) (tp)) + +int gen2tp4 (), tp42gen (); +#endif + +#ifdef TLI_TP +#include <tiuser.h> +#define select_tp4_socket selsocket +#endif + +/* */ + +#ifdef BSD_TP4 +#define close_tp4_socket close +#define select_tp4_socket selsocket +#endif + +#ifdef SUN_TP4 +#define close_tp4_socket close +#define select_tp4_socket selsocket +#endif + +int close_tp4_socket (); +int select_tp4_socket (); + +#endif + diff --git a/src/isode/h/tpkt.h b/src/isode/h/tpkt.h new file mode 100644 index 0000000000..f905abcbfb --- /dev/null +++ b/src/isode/h/tpkt.h @@ -0,0 +1,499 @@ +/* tpkt.h - include file for transport providers (TS-PROVIDER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:30:07 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:30 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:45 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:58 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#include "tsap.h" /* definitions for TS-USERs */ + +/* */ + + +#define tsapPsig(tb, sd) \ +{ \ + if ((tb = findtblk (sd)) == NULL) { \ + (void) sigiomask (smask); \ + return tsaplose (td, DR_PARAMETER, NULLCP, \ + "invalid transport descriptor"); \ + } \ + if (!(tb -> tb_flags & TB_CONN)) { \ + (void) sigiomask (smask); \ + return tsaplose (td, DR_OPERATION, NULLCP, \ + "transport descriptor not connected"); \ + } \ +} + +#ifdef __STDC__ +#define missingP(p) \ +{ \ + if (p == NULL) \ + return tsaplose (td, DR_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", #p); \ +} +#else +#define missingP(p) \ +{ \ + if (p == NULL) \ + return tsaplose (td, DR_PARAMETER, NULLCP, \ + "mandatory parameter \"%s\" missing", "p"); \ +} +#endif + +#define toomuchP(b,n,m,p) \ +{ \ + if (b == NULL) \ + n = 0; \ + else \ + if (n > m) \ + return tsaplose (td, DR_PARAMETER, NULLCP, \ + "too much %s user data, %d octets", p, n); \ +} + +#define copyTPKTdata(t,base,len) \ +{ \ + register struct udvec *uv = t -> t_udvec; \ + if (len > 0) \ + uv -> uv_base = base, uv -> uv_len = len, uv++; \ + uv -> uv_base = NULL; \ +} + +#ifndef lint +#ifndef __STDC__ +#define copyTSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d/* */_cc = min (i, sizeof d -> d/* */_data)) > 0) \ + bcopy (base, d -> d/* */_data, d -> d/* */_cc); \ +} +#else +#define copyTSAPdata(base,len,d) \ +{ \ + register int i = len; \ + if ((d -> d##_cc = min (i, sizeof d -> d##_data)) > 0) \ + bcopy (base, d -> d##_data, d -> d##_cc); \ +} +#endif +#else +#define copyTSAPdata(base,len,d) bcopy (base, (char *) d, len) +#endif + + +int tpktlose (), tsaplose (); + +/* */ + +struct tsapADDR { + struct NSAPaddr ta_addr; + int ta_present; + + int ta_selectlen; + + union un_ta_type un_ta; +}; + + /* network type codes: + must be outside [0-9A-Fa-f] */ +#define NT_TCP 'T' /* TCP */ +#define NT_X25 'X' /* X.25 */ +#define NT_BRG 'G' /* Bridge */ +#define NT_BSD 'Z' /* 4.4BSD */ +#define NT_SUN 'S' /* SunLink OSI */ +#define NT_TLI 't' /* TLI */ +#define NT_X2584 'N' /* X25(84) NSAP */ + +struct tsapblk { + struct tsapblk *tb_forw; /* doubly-linked list */ + struct tsapblk *tb_back; /* .. */ + + int tb_fd; /* file descriptor */ + + char tb_flags; /* our state */ +#define TB_NULL 0x00 +#define TB_CONN 0x01 /* connected */ +#define TB_ASYN 0x02 /* asynchronous */ +#define TB_EXPD 0x04 /* expedited transfer selected */ +#define TB_TCP 0x08 /* underlying service is TCP */ +#define TB_X25 0x10 /* .. is X.25 */ +#define TB_BRG 0x20 /* .. is Bridge */ +#define TB_TP0 (TB_TCP | TB_X25 | TB_BRG) +#define TB_TP4 0x40 /* .. is TP4 */ + /* all TP4's use this value as it make + sense to have only one TP4 service + compiled in... */ +#define TB_STACKS (TB_TP0|TB_TP4) /* all TS stacks */ +#define TB_QWRITES 0x80 /* queued writes OK */ + + char *tb_magic; /* generic pointer */ + + /* saved retry variables */ + char *tb_data; /* saved user data */ + int tb_cc; /* saved user data count */ + char tb_expedited; /* saved expedited */ + struct TSAPaddr *tb_called; /* saved addresses */ + struct TSAPaddr *tb_calling;/* .. */ + + struct tsapkt *tb_retry; /* initial tpkt */ + + u_short tb_srcref; /* source reference */ + u_short tb_dstref; /* destination reference */ + + int tb_tsdusize; /* maximum TSDU size */ + int tb_tpduslop; /* .. */ + int tb_tpdusize; /* for tp0ts */ + + int tb_sent; /* TPDU bytes sent */ + int tb_recv; /* TPDU bytes recv */ + + struct QOStype tb_qos; /* quality of service */ + + struct qbuf tb_qbuf; /* for segmented TSDUs */ + int tb_len; /* .. */ + + struct tsapADDR tb_initiating;/* initiator */ + struct tsapADDR tb_responding;/* responder */ + + IFP tb_retryfnx; /* resume async connection */ + + IFP tb_connPfnx; /* TP connect */ + IFP tb_retryPfnx; /* TP retry connect */ + IFP tb_startPfnx; /* TP start accept */ + IFP tb_acceptPfnx; /* TP accept */ + IFP tb_writePfnx; /* TP write data */ + IFP tb_readPfnx; /* TP read data */ + IFP tb_discPfnx; /* TP disconnect */ + IFP tb_losePfnx; /* TP loses */ + + IFP tb_drainPfnx; /* TP drain queued writes */ + IFP tb_queuePfnx; /* TP note queued writes */ + struct qbuf tb_qwrites; /* queue of writes to retry */ + + IFP tb_initfnx; /* init for read from network */ + IFP tb_readfnx; /* read from network */ + IFP tb_writefnx; /* write to network */ + IFP tb_closefnx; /* close network */ + IFP tb_selectfnx; /* select network */ + IFP tb_checkfnx; /* check network prior to select */ + IFP tb_nreadfnx; /* estimate of octets waiting to be read */ + + IFP tb_DataIndication; /* INDICATION handlers */ + IFP tb_DiscIndication; /* .. */ + +#ifdef MGMT + IFP tb_manfnx; /* for management reports */ + int tb_pdus; /* PDUs sent */ + int tb_pdur; /* PDUs recv */ + int tb_bytes; /* bytes sent since last report */ + int tb_byter; /* bytes recv .. */ +#endif +}; +#define NULLBP ((struct tsapblk *) 0) + + +int freetblk (); +struct tsapblk *newtblk (), *findtblk (); + +/* TPKT datastructure */ + +struct tsapkt { + int t_errno; + + struct { + u_char pk_vrsn; +#define TPKT_VRSN 3 + + u_char pk_rsrvd; + + u_short pk_length; +#define TPKT_MAXLEN 0xffff + } t_pkthdr; +#define t_vrsn t_pkthdr.pk_vrsn +#define t_rsrvd t_pkthdr.pk_rsrvd +#define t_length t_pkthdr.pk_length + +#define TPKT_HDRLEN(t) (sizeof ((t) -> t_pkthdr) + sizeof ((t) -> t_li) \ + + sizeof ((t) -> t_code)) + + struct { + u_char tp_li; +#ifndef lint +#ifndef __STDC__ +#define TPDU_MINLEN(t,c) (c/* */_SIZE(t) + sizeof ((t) -> t_code)) +#else +#define TPDU_MINLEN(t,c) (c##_SIZE(t) + sizeof ((t) -> t_code)) +#endif +#else +#define TPDU_MINLEN(t,c) (sizeof ((t) -> t_code)) +#endif +#define TPDU_MAXLEN(t) \ + (min (0xfe, (t) -> t_length - sizeof ((t) -> t_pkthdr) \ + - sizeof ((t) -> t_li))) +#define TPDU_USRLEN(t) \ + ((t) -> t_length - sizeof ((t) -> t_pkthdr) \ + - sizeof ((t) -> t_li) - (t) -> t_li) + + u_char tp_code; +#define TPDU_CODE(t) ((t) -> t_code & 0xf0) +#define TPDU_CR 0xe0 /* CONNECTION REQUEST */ +#define TPDU_CC 0xd0 /* CONNECTION CONFIRMATION */ +#define TPDU_DR 0x80 /* DISCONNECT REQUEST */ +#define TPDU_DC 0xc0 /* DISCONNECT CONFIRMATION */ +#define TPDU_DT 0xf0 /* DATA */ +#define TPDU_ED 0x10 /* EXPEDITED DATA */ +#define TPDU_AK 0x60 /* ACKNOWLEDGE */ +#define TPDU_EA 0x20 /* EXPEDITED ACKNOWLEDGE */ +#define TPDU_RJ 0x50 /* REJECT */ +#define TPDU_ER 0x70 /* ERROR */ + + union { + struct { + /* FIXED part */ + u_short un_cr_dstref; + u_short un_cr_srcref; + + u_char un_cr_class; +#define CR_CLASS(t) ((t) -> t_cr.cr_class & 0xf0) +#define CR_CLASS_TP0 0x00 /* class 0 */ +#define CR_CLASS_TP1 0x10 /* .. 1 */ +#define CR_CLASS_TP2 0x20 /* .. 2 */ +#define CR_CLASS_TP3 0x30 /* .. 3 */ +#define CR_CLASS_TP4 0x40 /* .. 4 */ +#define CR_OPT_EXTD 0x02 /* extended formats in classes 2-4 */ +#define CR_OPT_EXPL 0x01 /* explicit flow control in class 2 */ + + /* VARIABLE part */ + char un_cr_called[TSSIZE]; + int un_cr_calledlen; + + char un_cr_calling[TSSIZE]; + int un_cr_callinglen; + + u_char un_cr_tpdusize; + + u_short un_cr_options; + + u_char un_cr_alternate; + } un_cr; +#define cr_dstref un_cr_dstref +#define cr_srcref un_cr_srcref +#define cr_class un_cr_class +#define cr_tpdusize un_cr_tpdusize +#define cr_options un_cr_options +#define cr_alternate un_cr_alternate +#define CR_SIZE(t) 5 + +#define un_cc un_cr +#define cc_dstref un_cr_dstref +#define cc_srcref un_cr_srcref +#define cc_class un_cr_class +#define cc_tpdusize un_cr_tpdusize +#define cc_options un_cr_options +#define CC_SIZE(t) 5 + + struct { + /* FIXED part */ + u_short un_dr_dstref; + u_short un_dr_srcref; + u_char un_dr_reason; + } un_dr; +#define dr_dstref un_dr_dstref +#define dr_srcref un_dr_srcref +#define dr_reason un_dr_reason +#define DR_SIZE(t) 5 + + struct { + /* FIXED part */ + u_char un_dt_nr; +#define DT_EOT 0x80 + } un_dt; +#define dt_nr un_dt_nr +#define DT_SIZE(t) 1 +#define DT_MAGIC (2 + 1) + +/* Expedited service is not allowed in TP0, but for testing purposes, + we permit it when the underlying service is TCP. Note we use a + non-standard packet format (identical to the DT format). + */ +#define un_ed un_dt +#define ed_nr un_dt_nr +#define ED_SIZE(t) 1 + + struct { + /* FIXED part */ + u_short un_er_dstref; + u_char un_er_reject; +#define ER_REJ_NOTSPECIFIED 0x00 /* Reason not specified */ +#define ER_REJ_CODE 0x01 /* Invalid parameter code */ +#define ER_REJ_TPDU 0x02 /* Invalid TPDU type */ +#define ER_REJ_VALUE 0x03 /* Invalid parameter value */ + } un_er; +#define er_dstref un_er_dstref +#define er_reject un_er_reject +#define ER_SIZE(t) 3 + } tp_un; +#define tp_cr tp_un.un_cr +#define tp_cc tp_un.un_cc +#define tp_dr tp_un.un_dr +#define tp_dt tp_un.un_dt +#define tp_ed tp_un.un_ed +#define tp_er tp_un.un_er + + int tp_vlen; + char *tp_vbase; + + struct qbuf *tp_qbuf; /* fd2tpkt ONLY */ + +#define NTPUV 12 /* really should be + MSG_MAXIOVLEN - 4 */ + struct udvec tp_udvec[NTPUV]; /* tpkt2fd ONLY */ + } t_tpdu; +#define t_li t_tpdu.tp_li +#define t_code t_tpdu.tp_code +#define t_cr t_tpdu.tp_un.un_cr +#define t_called t_tpdu.tp_un.un_cr.un_cr_called +#define t_calledlen t_tpdu.tp_un.un_cr.un_cr_calledlen +#define t_calling t_tpdu.tp_un.un_cr.un_cr_calling +#define t_callinglen t_tpdu.tp_un.un_cr.un_cr_callinglen +#define t_tpdusize t_tpdu.tp_un.un_cr.un_cr_tpdusize +#define t_options t_tpdu.tp_un.un_cr.un_cr_options +#define t_alternate t_tpdu.tp_un.un_cr.un_cr_alternate +#define t_cc t_tpdu.tp_un.un_cc +#define t_dr t_tpdu.tp_un.un_dr +#define t_dt t_tpdu.tp_un.un_dt +#define t_ed t_tpdu.tp_un.un_ed +#define t_er t_tpdu.tp_un.un_er + +#define t_vdata t_tpdu.tp_vbase +#define t_vlen t_tpdu.tp_vlen + +#define t_qbuf t_tpdu.tp_qbuf + +#define t_udvec t_tpdu.tp_udvec +}; +#define NULLPKT ((struct tsapkt *) 0) + + +int freetpkt (); +struct tsapkt *newtpkt (); + +void text2tpkt (), tpkt2text (); + +int tpkt2fd (); +struct tsapkt *fd2tpkt (); + +char *tpkt2str (); +struct tsapkt *str2tpkt (); + +/* VARIABLE DATA codes, from ISO8073: */ + + /* for CR/CC TPDUs */ +#define VDAT_TSAP_SRV 0xc2 /* TSAP ID of the calling TSAP */ +#define VDAT_TSAP_CLI 0xc1 /* TSAP ID of the called TSAP */ +#define VDAT_SIZE 0xc0 /* TPDU SIZE */ +#define SIZE_8K 0x0d /* 8192 */ +#define SIZE_4K 0x0c /* 4096 */ +#define SIZE_2K 0x0b /* 2048 */ +#define SIZE_1K 0x0a /* 1024 */ +#define SIZE_512 0x09 /* 512 */ +#define SIZE_256 0x08 /* 256 */ +#define SIZE_128 0x07 /* 128 */ +#define SIZE_DFLT SIZE_128 +#define SIZE_MAXTP0 SIZE_2K +#define VDAT_VRSN 0xc4 /* Version number */ +#define VDAT_SECURITY 0xc5 /* Security parameters */ +#define VDAT_CHECKSUM 0xc3 /* Checksum */ +#define VDAT_OPTIONS 0xc6 /* Additional option selections */ +#define OPT_NEXPEDITE 0x08 /* Use network expedited */ +#define OPT_CONFIRM 0x04 /* Use receipt confirmation */ +#define OPT_CHECKSUM 0x02 /* Use 16-bit checksum */ +#define OPT_TEXPEDITE 0x01 /* Use transport expedited */ +#define VDAT_ALTERNATE 0xc7 /* Alterated protocol class(es) */ +#define ALT_TP0 0x01 /* class 0 */ +#define ALT_TP1 0x02 /* class 1 */ +#define ALT_TP2 0x04 /* class 2 */ +#define ALT_TP3 0x08 /* class 3 */ +#define ALT_TP4 0x10 /* class 4 */ +#define VDAT_ACKTIME 0x85 /* Acknowledge time */ +#define VDAT_THROUGHPUT 0x89 /* Throughput */ +#define VDAT_ERRORATE 0x86 /* Residual error rate */ +#define VDAT_PRIORITY 0x87 /* Priority */ +#define VDAT_DELAY 0x88 /* Transit delay */ +#define VDAT_TTR 0x8b /* Reassignment time */ + + /* for DR TPDUs */ +#define VDAT_ADDITIONAL 0xe0 /* Additional information */ + + /* for AK TPDUs */ +#define VDAT_SUBSEQ 0x8c /* Sub-sequence number */ +#define VDAT_FLOWCTL 0x8b /* Flow control confirmation */ + + /* for ER TPDUs */ +#define VDAT_INVALID 0xc1 /* invalid TPDU */ + +/* */ + +/* TP0 is the protocol */ + +int tp0init (); +int tp0write (); + + +/* TCP is NS-provider */ + +int tcpopen (); + +char *tcpsave (); +int tcprestore (); + + +/* X.25 is NS-provider */ + +int x25open (); + +char *x25save (); +int x25restore (); + + +/* Bridge is NS-provider */ + +int bridgeopen (); +int bridgediscrim (); + +char *bridgesave (); +int bridgerestore (); + + +/* TP4 is the protocol and the TS-provider */ + +int tp4init (); + +int tp4open (); + +char *tp4save (); +int tp4restore (); diff --git a/src/isode/h/tsap.h b/src/isode/h/tsap.h new file mode 100644 index 0000000000..7c2146500b --- /dev/null +++ b/src/isode/h/tsap.h @@ -0,0 +1,207 @@ +/* tsap.h - include file for transport users (TS-USER) */ + +/* + * $Header$ + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:30:09 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:33 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:47 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:33:59 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _TSAP_ +#define _TSAP_ + +#ifndef _MANIFEST_ +#include "manifest.h" +#endif +#ifndef _GENERAL_ +#include "general.h" +#endif +#ifndef _ISOADDRS_ +#include "isoaddrs.h" +#endif + +/* */ + +struct TSAPstart { /* T-CONNECT.INDICATON */ + int ts_sd; /* TRANSPORT descriptor */ + + struct TSAPaddr ts_calling; /* address of peer calling */ + struct TSAPaddr ts_called; /* address of peer called */ + + int ts_expedited; /* EXPEDITED DATA ok */ + + int ts_tsdusize; /* largest atomic TSDU */ + + struct QOStype ts_qos; /* quality of service */ + + /* initial DATA from peer */ +#define TS_SIZE 32 + int ts_cc; /* length */ + char ts_data[TS_SIZE]; /* data */ +}; + + +struct TSAPconnect { /* T-CONNECT.CONFIRMATION */ + int tc_sd; /* TRANSPORT descriptor */ + + struct TSAPaddr tc_responding;/* address of peer responding */ + + int tc_expedited; /* EXPEDITED DATA ok */ + + int tc_tsdusize; /* largest atomic TSDU */ + + struct QOStype tc_qos; /* quality of service */ + + /* initial DATA from peer */ +#define TC_SIZE 32 + int tc_cc; /* length */ + char tc_data[TC_SIZE]; /* data */ +}; + + +struct TSAPdata { /* T-READ.INDICATION */ + int tx_expedited; + + /* DATA from peer */ +#define TX_SIZE 16 /* EXPEDITED DATA only */ + int tx_cc; /* total length */ + struct qbuf tx_qbuf; /* chained data */ +}; +#define TXFREE(tx) QBFREE (&((tx) -> tx_qbuf)) + + +struct TSAPdisconnect { /* T-DISCONNECT.INDICATION */ + int td_reason; /* reason for DISCONNECT, from ISO8072: */ +#define DR_BASE 0x80 +#define DR_NORMAL (DR_BASE + 0) /* NORMAL disconnect by SESSION + entity */ +#define DR_REMOTE (DR_BASE + 1) /* Remote TRANSPORT entity congested at + connect request time */ +#define DR_CONNECT (DR_BASE + 2) /* Connection negotiation failed */ +#define DR_DUPLICATE (DR_BASE + 3) /* Duplicate source reference detected + for the same pair of NSAPs */ +#define DR_MISMATCH (DR_BASE + 4) /* Mismatched references */ +#define DR_PROTOCOL (DR_BASE + 5) /* Protocol error */ +#define DR_OVERFLOW (DR_BASE + 7) /* Reference overflow */ +#define DR_REFUSED (DR_BASE + 8) /* Connect request refused on this + network connection */ +#define DR_LENGTH (DR_BASE + 10) /* Header or parameter length + invalid */ + + /* begin UNOFFICIAL */ +#define DR_NETWORK (DR_BASE + 11) /* Network disconnect */ +#define DR_PARAMETER (DR_BASE + 12) /* Invalid parameter */ +#define DR_OPERATION (DR_BASE + 13) /* Invalid operation */ +#define DR_TIMER (DR_BASE + 14) /* Timer expired */ +#define DR_WAITING (DR_BASE + 15) /* Indications waiting */ + /* end UNOFFICIAL */ + +#define DR_UNKNOWN 0 /* Reason not specifed */ +#define DR_CONGEST 1 /* Congestion at TSAP */ +#define DR_SESSION 2 /* Session entity not attached to + TSAP */ +#define DR_ADDRESS 3 /* Address unknown */ + +#ifdef notdef +#define DR_FATAL(r) ((r) < DR_BASE || (r) < DR_PARAMETER) +#define DR_OFFICIAL(r) ((r) < DR_BASE || (r) < DR_NETWORK) +#else +#define DR_FATAL(r) ((r) < DR_PARAMETER) +#define DR_OFFICIAL(r) ((r) < DR_NETWORK) +#endif + +#define DR_CONS 256 /* Base for CONS reson codes */ +#define DR_CONS_UNDEFINED DR_CONS+0 /* Undefined */ + /* originator: NS_PROVIDER */ +#define DR_CONS_PROVIDER DR_CONS+224 /* GENERIC */ +#define DR_CP_DIS_TRANS DR_CONS+225 /* Disconnect - transient */ +#define DR_CP_DIS_PERM DR_CONS+226 /* Disconnect - permanent */ +#define DR_CP_REJ_UNSPEC_TRANS DR_CONS+227 /* Reject - transient */ +#define DR_CP_REJ_UNSPEC_PERM DR_CONS+228 /* Reject - permanent */ +#define DR_CP_REJ_NO_QOS_TRANS DR_CONS+229 /* No QOS - transient */ +#define DR_CP_REJ_NO_QOS_PERM DR_CONS+230 /* No QOS - permanent */ +#define DR_CP_REJ_NSAP_UNREACH_TRANS DR_CONS+231 /* NSAP unreachable */ +#define DR_CP_REJ_NSAP_UNREACH_PERM DR_CONS+232 /* NSAP unreachable */ +#define DR_CP_RESET_UNSPEC DR_CONS+233 /* Unspecified RESET */ +#define DR_CP_RESET_CONGESTION DR_CONS+234 /* RESET due to congestion */ +#define DR_CP_REJ_NSAP_UNKNOWN_PERM DR_CONS+235 /* Unknown NSAP */ + /* originator: NS_USER */ +#define DR_CONS_USER DR_CONS+240 /* GENERIC */ +#define DR_CU_DIS_NORMAL DR_CONS+241 /* Normal disconnect */ +#define DR_CU_DIS_ABNORMAL DR_CONS+242 /* Abnormal disconnect */ +#define DR_CU_REJ_UNSPEC_TRANS DR_CONS+244 /* Reject - transient */ +#define DR_CU_REJ_UNSPEC_PERM DR_CONS+245 /* Reject - permanent */ +#define DR_CU_REJ_NO_QOS_TRANS DR_CONS+246 /* No QOS - transient */ +#define DR_CU_REJ_NO_QOS_PERM DR_CONS+247 /* No QOS - permanent */ +#define DR_CU_REJ_INCOMPAT DR_CONS+248 /* Incompatable NS user data */ +#define DR_CU_RESET_USER_RESYNCH DR_CONS+250 /* User RESET */ + + /* disconnect DATA from peer */ +#define TD_SIZE 64 + int td_cc; /* length */ + char td_data[TD_SIZE]; /* data */ +}; + +/* */ + +extern char *tsapversion; + + +int TInit (); /* T-CONNECT.INDICATION */ + +int TConnResponse (); /* T-CONNECT.RESPONSE */ + /* T-CONNECT.REQUEST (backwards-compatible) */ +#define TConnRequest(a1,a2,a3,a4,a5,a6,a7,a8) \ + TAsynConnRequest(a1,a2,a3,a4,a5,a6,a7,a8,0) +int TAsynConnRequest (); /* T-(ASYN-)CONNECT.REQUEST */ +int TAsynRetryRequest (); /* T-ASYN-RETRY.REQUEST (pseudo) */ +int TDataRequest (); /* T-DATA.REQUEST */ +int TWriteRequest (); /* T-WRITE.REQUEST (pseudo) */ +int TExpdRequest (); /* T-EXPEDITED-DATA.REQUEST */ +int TReadRequest (); /* T-READ.REQUEST (pseudo) */ +int TDiscRequest (); /* T-DISCONNECT.REQUEST */ + +int TSetIndications (); /* define vectors for INDICATION events */ +int TSelectMask (); /* map transport descriptors for select() */ +int TSelectOctets (); /* estimate of octets that might be returned */ +int TGetAddresses (); /* get TSAPs */ +int TSetManager (); /* defining transport manager */ + +char *TErrString (); /* return TSAP error code in string form */ + +int TNetListen (); /* start listenting on an TSAP */ +int TNetUnique (); /* start listenting on a set of unique TSAPs */ +#define TNetAccept(p,v,n,r,w,e,s,t) \ + TNetAcceptAux ((p), (v), NULLIP, NULLTA, (n), (r), (w), (e), (s), (t)) +int TNetAcceptAux (); /* accept a call on an TSAP */ +int TNetClose (); /* stop listening on an TSAP */ +int TSetQueuesOK (); /* enable/disable queued (non-blocking) + writes */ + +#define TLocalHostName getlocalhost +char *TLocalHostName (); /* return name of local host (sigh) */ +#endif diff --git a/src/isode/h/usr.dirent.h b/src/isode/h/usr.dirent.h new file mode 100644 index 0000000000..6b460a98d7 --- /dev/null +++ b/src/isode/h/usr.dirent.h @@ -0,0 +1,63 @@ +/* usr.dirent.h - ISODE's version of DAG's SVR3 directory access routines */ + +/* + <dirent.h> -- definitions for SVR3 directory access routines + + last edit: 25-Apr-1987 D A Gwyn + + Prerequisite: <sys/types.h> +*/ + +#ifndef _CONFIG_ +#include "config.h" /* system-specific configuration */ +#endif +#ifndef GETDENTS +#if defined(SUNOS4) +#define GETDENTS +#endif +#endif + +#ifdef GETDENTS +#include <dirent.h> +#else +#include "sys.dirent.h" + +#define DIRBUF 8192 /* buffer size for fs-indep. dirs */ + /* must in general be larger than the filesystem buffer size */ + +typedef struct + { + int dd_fd; /* file descriptor */ + int dd_loc; /* offset in block */ + int dd_size; /* amount of valid data */ + char *dd_buf; /* -> directory block */ + } DIR; /* stream data from opendir() */ + +#define opendir _opendir +#define readdir _readdir +#define telldir _telldir +#define seekdir _seekdir +#define rewinddir _rewinddir +#define closedir _closedir + +extern DIR *opendir(); +extern struct dirent *readdir(); +extern off_t telldir(); +extern void seekdir(); +extern void rewinddir(); +extern int closedir(); + +#ifndef NULL +#define NULL 0 /* DAG -- added for convenience */ +#endif +#endif /* not GETDENTS */ + +#define getcwd _getcwd + +extern char *getcwd (); + + +#define scandir _scandir +#define alphasort _alphasort + +extern char *direntversion; diff --git a/src/isode/h/x25.h b/src/isode/h/x25.h new file mode 100644 index 0000000000..9cd2cff3dc --- /dev/null +++ b/src/isode/h/x25.h @@ -0,0 +1,276 @@ +/* x25.h - X.25 abstractions */ + +/* + * $Header$ + * + * Contributed by John Pavel, Department of Trade and Industry/National + * Physical Laboratory in the UK + * + * + * $Log$ + * Revision 1.1 1994/06/10 03:30:13 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 94/06/10 03:18:37 eichin + * autoconfed isode for kerberos work + * + * Revision 1.1 1994/05/31 20:38:51 eichin + * reduced-isode release from /mit/isode/isode-subset/src + * + * Revision 8.0 91/07/17 12:34:00 isode + * Release 7.0 + * + * + */ + +/* + * NOTICE + * + * Acquisition, use, and distribution of this module and related + * materials are subject to the restrictions of a license agreement. + * Consult the Preface in the User's Manual for the full terms of + * this agreement. + * + */ + + +#ifndef _X25_ +#define _X25_ + +/* + * + * #defines for generic addressing & TSEL encoded addresses. + * + */ + +#ifndef _INTERNET_ +#include <sys/socket.h> +#endif + +#ifdef SUN_X25 +#include <sys/ioctl.h> +#include <sys/param.h> +#include <sys/mbuf.h> +#include <sundev/syncstat.h> +#include <netx25/x25_pk.h> +#include <netx25/x25_ctl.h> +#include <netx25/x25_ioctl.h> +#endif + +#ifdef HPUX_X25 +#include <x25/x25.h> +#include <x25/x25addrstr.h> +#include <x25/x25ioctls.h> +#include <x25/x25str.h> +#include <x25/x25codes.h> + +#define MAX_EVENT_SIZE 34 +typedef struct x25addrstr X25_ADDR; +typedef struct x25_userdata X25_USERDATA; +typedef struct { + X25_ADDR addr; + X25_USERDATA cudf; + } CONN_DB; +typedef struct x25_cause_diag X25_CAUSE_DIAG; +typedef struct x25_msg_stat X25_MSG_STAT; +typedef struct x25_facilities CCITT_FACILITY_DB; +typedef struct facility_dB_S { +#define REVCHARGE 0x01 +#define FAST_OFF 0 +#define FAST_SELECT 1 +#define FAST_ACPT_CLR 2 +#define FAST_CLR_ONLY 1 +#define CCITT_FAST_OFF 0 +#define CCITT_FAST_SELECT 0x80 +#define CCITT_FAST_ACPT_CLR 0x80 +#define CCITT_FAST_CLR_ONLY 0xC0 + u_char t_01; + /* Bit 0: rev-charge allowed */ + /* Bit 7: restricted fast-select (CLR only) */ + /* Bit 8: fast-select allowd */ + + u_char t_02; + /* Bits 0-3: send-thruput */ + /* Bits 4-7: recv-thruput */ + +#define CCITT_CUG 1 +#define CCITT_CUG_EXTENDED 3 + u_char t_03_sel; + u_short t_03; + /* closed user group in 2- or 4-digit BCD */ + +#define REQ_CHARGE_INF 1 + u_char t_04; + /* Bit 0: charging information requested */ + +#define ACK_EXPECTED 0x01 +#define NACK_EXPECTED 0x02 + u_char t_07; + /* Bit 0: send ACK */ + /* Bit 1: send NACK */ + + u_char t_08; + /* called line address modified notification */ +define CCITT_OUTCUG_EXTENDED 3 + u_char t_09_sel; + u_short t_09; + /* closed user group in 2- or 4-digit BCD */ + + u_char t_41_sel; + u_short t_41; + /* bilateral closed user group in 4-digit BCD */ + + u_char t_42 [2]; + /* Byte 0: recv-pcktsize (log2) */ + /* Byte 1: send-pcktsize (log2) */ + + u_char t_43 [2]; + /* Byte 0: recv-windowsize */ + /* Byte 1: send-windowsize */ + +#define CCITT_RPOA 1 + u_char t_44_sel; + u_short t_44; + /* RPOA transit number */ + + u_char t_49_sel; + u_short t_49; + /* Transit delay selection and indication */ + + u_char *t_c1; + /* call duration charge-information */ + /* Byte 0: length of fac. parm. field */ + u_char *t_c2; + /* segment count charge-information */ + /* Byte 0: length of fac. parm. field */ + + u_char *t_c3; + /* call deflection/restriction notification */ + /* Byte 0: length of fac. parm. field */ + /* Byte 1: deflection reason */ + + u_char *t_c4; + /* RPOA extended format */ + /* Byte 0: length of fac. parm. field */ + + u_char *t_c5; + /* monetary unit charge-information */ + /* Byte 0: length of fac. parm. field */ + + u_char *t_c6; + /* NUI selection */ + /* Byte 0: length of fac. parm. field */ + + u_char *t_d1; + /* CALL deflection */ + /* Byte 0: length of fac. parm. field */ + /* Byte 1: deflection reason from remote DTE */ + /* Byte 2: length of alt. DTE (in digits) */ +} FACILITY_DB; +#endif + + +#include <sys/protosw.h> +#include <sys/domain.h> +#include <sys/socketvar.h> +#include <sys/errno.h> +#include <net/if.h> + +#ifdef CAMTEC +#include <cci.h> +typedef struct ccontrolp CONN_DB; +#undef NTPUV +#define NTPUV 2 /* CAMTEC allows only 2 iov's per read/write */ +#endif + +#ifdef CAMTEC_CCL +#include <sys/ioctl.h> +#include <sys/param.h> +#include <sys/types.h> +#include <sys/uio.h> +#include <netccl/ccl.h> + +typedef struct ccliovec CONN_DB; +#endif + + +#ifdef UBC_X25 +#include <netccitt/x25_sockaddr.h> +#ifdef BSD44 +#include <sys/ioctl.h> +#endif + +#define X25_PACKETSIZE 128 + +typedef struct x25_sockaddr CONN_DB; +#endif + + +#ifdef ULTRIX_X25 +#include <netx25/x25.h> +#include <stdio.h> +#include <sys/time.h> + +typedef struct NSAPaddr CONN_DB; /* + * address translation is delayed until + * connect()/accept() time and returns + * as fields in a packed structure. calls + * to an X25Encode() X25Decode() routine + * unpacks this directly into the ISODE + * NSAPaddr buffer. not as simple as + * some but DEC like to be different (sigh) + */ + +#define select_x25_socket selsocket +#define read_x25_socket read +#define write_x25_socket write + +#endif /* ULTRIX_X25 */ +/* */ + +#ifdef SUN_X25 +#define close_x25_socket close +#define select_x25_socket selsocket +#define read_x25_socket read +#define write_x25_socket write +#endif + +#ifdef HPUX_X25 +#define REST_TYPE 2 +#define select_x25_socket selsocket +#define read_x25_socket read +#define write_x25_socket write +#endif + +#if defined(UBC_X25) || defined(CAMTEC_CCL) +#define close_x25_socket close +#define select_x25_socket selsocket +#endif + +#ifndef RECV_DIAG +#define RECV_DIAG 0 +#define DIAG_TYPE 1 +#define WAIT_CONFIRMATION 2 +#endif + +int start_x25_client (); +int start_x25_server (); +int join_x25_client (); +int join_x25_server (); +int read_x25_socket (); +int write_x25_socket (); +int close_x25_socket (); +int select_x25_socket (); + +struct NSAPaddr *if2gen(); +CONN_DB *gen2if(); + + +#define ADDR_LOCAL 0 +#define ADDR_REMOTE 1 +#define ADDR_LISTEN 2 +#define SEPARATOR ':' + + +#define MAXNSDU 2048 /* must be equal to largest TP0 TPDU */ +#endif |