From 5f522de8b7a9e603dc1f1a8cf63417cb1dde08b0 Mon Sep 17 00:00:00 2001 From: CSRG Date: Thu, 21 Feb 1991 18:17:36 -0800 Subject: [PATCH] BSD 4_3_Net_2 development Work on file usr/src/contrib/isode/Makefile Work on file usr/src/contrib/isode/isode-test Work on file usr/src/contrib/isode/make Work on file usr/src/contrib/isode/acsap/Makefile Work on file usr/src/contrib/isode/acsap/acs.py Work on file usr/src/contrib/isode/acsap/acsapabort1.c Work on file usr/src/contrib/isode/acsap/acsapabort2.c Work on file usr/src/contrib/isode/acsap/acsapaddr.c Work on file usr/src/contrib/isode/acsap/acsapblock.c Work on file usr/src/contrib/isode/acsap/acsapdse.c Work on file usr/src/contrib/isode/acsap/acsaperror.c Work on file usr/src/contrib/isode/acsap/acsapfindpci.c Work on file usr/src/contrib/isode/acsap/acsapinitiat.c Work on file usr/src/contrib/isode/acsap/acsaplose.c Work on file usr/src/contrib/isode/acsap/acsapreleas1.c Work on file usr/src/contrib/isode/acsap/acsapreleas2.c Work on file usr/src/contrib/isode/acsap/acsapreleas3.c Work on file usr/src/contrib/isode/acsap/acsaprespond.c Work on file usr/src/contrib/isode/acsap/acsaprovider.c Work on file usr/src/contrib/isode/acsap/acsapstub.c Work on file usr/src/contrib/isode/acsap/acsaptest.c Work on file usr/src/contrib/isode/acsap/acserver1.c Work on file usr/src/contrib/isode/acsap/acserver2.c Work on file usr/src/contrib/isode/acsap/acsold.py Work on file usr/src/contrib/isode/acsap/aetdase.c Work on file usr/src/contrib/isode/acsap/aetseq.c Work on file usr/src/contrib/isode/acsap/dase.py Work on file usr/src/contrib/isode/acsap/dased.8c Work on file usr/src/contrib/isode/acsap/dased.c Work on file usr/src/contrib/isode/acsap/dse-c.c Work on file usr/src/contrib/isode/acsap/dse.py Work on file usr/src/contrib/isode/acsap/is2paddr.c Work on file usr/src/contrib/isode/acsap/is2saddr.c Work on file usr/src/contrib/isode/acsap/is2taddr.c Work on file usr/src/contrib/isode/acsap/isoalias.c Work on file usr/src/contrib/isode/acsap/isoentity.c Work on file usr/src/contrib/isode/acsap/libacsap.3n Work on file usr/src/contrib/isode/acsap/llib-lacsap Work on file usr/src/contrib/isode/acsap/make Work on file usr/src/contrib/isode/acsap/oid2aei.c Work on file usr/src/contrib/isode/acsap/sprintaei.c Work on file usr/src/contrib/isode/compat/Makefile Work on file usr/src/contrib/isode/compat/asprintf.c Work on file usr/src/contrib/isode/compat/baduser.c Work on file usr/src/contrib/isode/compat/bridge.c Work on file usr/src/contrib/isode/compat/camtec.c Work on file usr/src/contrib/isode/compat/chkpassword.c Work on file usr/src/contrib/isode/compat/chrcnv.c Work on file usr/src/contrib/isode/compat/cmd_srch.c Work on file usr/src/contrib/isode/compat/dgram.c Work on file usr/src/contrib/isode/compat/explode.c Work on file usr/src/contrib/isode/compat/general.c.org Work on file usr/src/contrib/isode/compat/getpassword.c Work on file usr/src/contrib/isode/compat/implode.c Work on file usr/src/contrib/isode/compat/inst-man.sh Work on file usr/src/contrib/isode/compat/internet.c Work on file usr/src/contrib/isode/compat/isoaddrs.c Work on file usr/src/contrib/isode/compat/isofiles.c Work on file usr/src/contrib/isode/compat/isohost.c Work on file usr/src/contrib/isode/compat/isologs.sh Work on file usr/src/contrib/isode/compat/isoman.rf Work on file usr/src/contrib/isode/compat/isoservent.c Work on file usr/src/contrib/isode/compat/lexequ.c Work on file usr/src/contrib/isode/compat/lexnequ.c Work on file usr/src/contrib/isode/compat/libicompat.3 Work on file usr/src/contrib/isode/compat/llib-lcompat Work on file usr/src/contrib/isode/compat/log_tai.c Work on file usr/src/contrib/isode/compat/logger.c Work on file usr/src/contrib/isode/compat/make Work on file usr/src/contrib/isode/compat/na2norm.c Work on file usr/src/contrib/isode/compat/na2str.c Work on file usr/src/contrib/isode/compat/nochrcnv.c Work on file usr/src/contrib/isode/compat/norm2na.c Work on file usr/src/contrib/isode/compat/pa2str.c Work on file usr/src/contrib/isode/compat/putenv.c Work on file usr/src/contrib/isode/compat/rcmd_srch.c Work on file usr/src/contrib/isode/compat/saddr2str.c Work on file usr/src/contrib/isode/compat/sel2str.c Work on file usr/src/contrib/isode/compat/select.c Work on file usr/src/contrib/isode/compat/serror.c Work on file usr/src/contrib/isode/compat/servbyname.c Work on file usr/src/contrib/isode/compat/servbyport.c Work on file usr/src/contrib/isode/compat/servbysel.c Work on file usr/src/contrib/isode/compat/signals.c Work on file usr/src/contrib/isode/compat/smalloc.c Work on file usr/src/contrib/isode/compat/sprintb.c Work on file usr/src/contrib/isode/compat/sstr2arg.c Work on file usr/src/contrib/isode/compat/str2elem.c Work on file usr/src/contrib/isode/compat/str2saddr.c Work on file usr/src/contrib/isode/compat/str2sel.c Work on file usr/src/contrib/isode/compat/str2taddr.c Work on file usr/src/contrib/isode/compat/str2vec.c Work on file usr/src/contrib/isode/compat/strdup.c Work on file usr/src/contrib/isode/compat/sunlink.c Work on file usr/src/contrib/isode/compat/taddr2str.c Work on file usr/src/contrib/isode/compat/tailor.c Work on file usr/src/contrib/isode/compat/ubcx25.c Work on file usr/src/contrib/isode/compat/x25addr.c Work on file usr/src/contrib/isode/config/OPTIONS Work on file usr/src/contrib/isode/support/aliases.local Work on file usr/src/contrib/isode/config/aliases.local Work on file usr/src/contrib/isode/config/apollo.h Work on file usr/src/contrib/isode/config/apollo.make Work on file usr/src/contrib/isode/config/aux.h Work on file usr/src/contrib/isode/config/aux.make Work on file usr/src/contrib/isode/config/bsd42.h Work on file usr/src/contrib/isode/config/bsd42.make Work on file usr/src/contrib/isode/config/bsd43-rt.h Work on file usr/src/contrib/isode/config/bsd43-rt.make Work on file usr/src/contrib/isode/config/bsd43.h Work on file usr/src/contrib/isode/config/bsd43.make Work on file usr/src/contrib/isode/config/bsd44.h Work on file usr/src/contrib/isode/h/config.h Work on file usr/src/contrib/isode/config/bsd44.make Work on file usr/src/contrib/isode/config/cheetah.h Work on file usr/src/contrib/isode/config/cheetah.make Work on file usr/src/contrib/isode/support/entities.local Work on file usr/src/contrib/isode/config/entities.local Work on file usr/src/contrib/isode/config/hpux.h Work on file usr/src/contrib/isode/config/hpux.make Work on file usr/src/contrib/isode/config/macros.local Work on file usr/src/contrib/isode/support/macros.local Work on file usr/src/contrib/isode/config/mips.h Work on file usr/src/contrib/isode/config/mips.make Work on file usr/src/contrib/isode/config/objects.local Work on file usr/src/contrib/isode/support/objects.local Work on file usr/src/contrib/isode/config/alpaca.h Work on file usr/src/contrib/isode/config/alpaca.make Work on file usr/src/contrib/isode/config/osx.h Work on file usr/src/contrib/isode/config/osx.make Work on file usr/src/contrib/isode/config/ros.h Work on file usr/src/contrib/isode/config/ros.make Work on file usr/src/contrib/isode/config/services.local Work on file usr/src/contrib/isode/support/services.local Work on file usr/src/contrib/isode/config/solbourne.h Work on file usr/src/contrib/isode/config/solbourne.make Work on file usr/src/contrib/isode/config/sunlink3.h Work on file usr/src/contrib/isode/config/sunlink3.make Work on file usr/src/contrib/isode/config/sunlink4.h Work on file usr/src/contrib/isode/config/sunlink4.make Work on file usr/src/contrib/isode/config/sunlink7.h Work on file usr/src/contrib/isode/config/sunlink7.make Work on file usr/src/contrib/isode/config/sunos3.h Work on file usr/src/contrib/isode/config/sunos3.make Work on file usr/src/contrib/isode/config/sunos4.h Work on file usr/src/contrib/isode/config/sunos4.make Work on file usr/src/contrib/isode/config/sys52-exos.h Work on file usr/src/contrib/isode/config/sys52-exos.make Work on file usr/src/contrib/isode/config/sys52-rt.h Work on file usr/src/contrib/isode/config/sys52-rt.make Work on file usr/src/contrib/isode/config/sys52-sun.h Work on file usr/src/contrib/isode/config/sys52-sun.make Work on file usr/src/contrib/isode/config/sys52-win.h Work on file usr/src/contrib/isode/config/sys52-win.make Work on file usr/src/contrib/isode/config/sys53.h Work on file usr/src/contrib/isode/config/sys53.make Work on file usr/src/contrib/isode/config/ultrix.h Work on file usr/src/contrib/isode/config/ultrix.make Work on file usr/src/contrib/isode/dirent/Makefile Work on file usr/src/contrib/isode/dirent/NOTES Work on file usr/src/contrib/isode/dirent/closedir.c Work on file usr/src/contrib/isode/dirent/directory.3c Work on file usr/src/contrib/isode/dirent/dirent.4 Work on file usr/src/contrib/isode/dirent/getcwd.c Work on file usr/src/contrib/isode/dirent/getdents.2 Work on file usr/src/contrib/isode/dirent/getdents.c Work on file usr/src/contrib/isode/dirent/llib-ldirent Work on file usr/src/contrib/isode/dirent/make Work on file usr/src/contrib/isode/dirent/opendir.c Work on file usr/src/contrib/isode/dirent/readdir.c Work on file usr/src/contrib/isode/dirent/rewinddir.c Work on file usr/src/contrib/isode/dirent/seekdir.c Work on file usr/src/contrib/isode/dirent/sys._dir.h Work on file usr/src/contrib/isode/dirent/telldir.c Work on file usr/src/contrib/isode/dirent/testdir.c Synthesized-from: CSRG/cd2/net.2 --- usr/src/contrib/isode/Makefile | 387 ++++++ usr/src/contrib/isode/acsap/Makefile | 314 +++++ usr/src/contrib/isode/acsap/acs.py | 318 +++++ usr/src/contrib/isode/acsap/acsapabort1.c | 137 ++ usr/src/contrib/isode/acsap/acsapabort2.c | 157 +++ usr/src/contrib/isode/acsap/acsapaddr.c | 200 +++ usr/src/contrib/isode/acsap/acsapblock.c | 133 ++ usr/src/contrib/isode/acsap/acsapdse.c | 124 ++ usr/src/contrib/isode/acsap/acsaperror.c | 84 ++ usr/src/contrib/isode/acsap/acsapfindpci.c | 64 + usr/src/contrib/isode/acsap/acsapinitiat.c | 612 +++++++++ usr/src/contrib/isode/acsap/acsaplose.c | 172 +++ usr/src/contrib/isode/acsap/acsapreleas1.c | 272 ++++ usr/src/contrib/isode/acsap/acsapreleas2.c | 157 +++ usr/src/contrib/isode/acsap/acsapreleas3.c | 122 ++ usr/src/contrib/isode/acsap/acsaprespond.c | 438 +++++++ usr/src/contrib/isode/acsap/acsaprovider.c | 193 +++ usr/src/contrib/isode/acsap/acsapstub.c | 329 +++++ usr/src/contrib/isode/acsap/acsaptest.c | 239 ++++ usr/src/contrib/isode/acsap/acserver1.c | 75 ++ usr/src/contrib/isode/acsap/acserver2.c | 233 ++++ usr/src/contrib/isode/acsap/acsold.py | 183 +++ usr/src/contrib/isode/acsap/aetdase.c | 669 ++++++++++ usr/src/contrib/isode/acsap/aetseq.c | 119 ++ usr/src/contrib/isode/acsap/dase.py | 152 +++ usr/src/contrib/isode/acsap/dased.8c | 79 ++ usr/src/contrib/isode/acsap/dased.c | 1044 ++++++++++++++++ usr/src/contrib/isode/acsap/dse-c.c | 218 ++++ usr/src/contrib/isode/acsap/dse.py | 63 + usr/src/contrib/isode/acsap/is2paddr.c | 64 + usr/src/contrib/isode/acsap/is2saddr.c | 66 + usr/src/contrib/isode/acsap/is2taddr.c | 66 + usr/src/contrib/isode/acsap/isoalias.c | 164 +++ usr/src/contrib/isode/acsap/isoentity.c | 198 +++ usr/src/contrib/isode/acsap/libacsap.3n | 145 +++ usr/src/contrib/isode/acsap/llib-lacsap | 343 +++++ usr/src/contrib/isode/acsap/make | 7 + usr/src/contrib/isode/acsap/oid2aei.c | 53 + usr/src/contrib/isode/acsap/sprintaei.c | 81 ++ usr/src/contrib/isode/compat/Makefile | 267 ++++ usr/src/contrib/isode/compat/asprintf.c | 108 ++ usr/src/contrib/isode/compat/baduser.c | 81 ++ usr/src/contrib/isode/compat/bridge.c | 428 +++++++ usr/src/contrib/isode/compat/camtec.c | 267 ++++ usr/src/contrib/isode/compat/chkpassword.c | 94 ++ usr/src/contrib/isode/compat/chrcnv.c | 75 ++ usr/src/contrib/isode/compat/cmd_srch.c | 48 + usr/src/contrib/isode/compat/dgram.c | 825 ++++++++++++ usr/src/contrib/isode/compat/explode.c | 62 + usr/src/contrib/isode/compat/general.c.org | 161 +++ usr/src/contrib/isode/compat/getpassword.c | 148 +++ usr/src/contrib/isode/compat/implode.c | 72 ++ usr/src/contrib/isode/compat/inst-man.sh | 167 +++ usr/src/contrib/isode/compat/internet.c | 699 +++++++++++ usr/src/contrib/isode/compat/isoaddrs.c | 1173 ++++++++++++++++++ usr/src/contrib/isode/compat/isofiles.c | 57 + usr/src/contrib/isode/compat/isohost.c | 87 ++ usr/src/contrib/isode/compat/isologs.sh | 36 + usr/src/contrib/isode/compat/isoman.rf | 8 + usr/src/contrib/isode/compat/isoservent.c | 140 +++ usr/src/contrib/isode/compat/lexequ.c | 64 + usr/src/contrib/isode/compat/lexnequ.c | 66 + usr/src/contrib/isode/compat/libicompat.3 | 28 + usr/src/contrib/isode/compat/llib-lcompat | 786 ++++++++++++ usr/src/contrib/isode/compat/log_tai.c | 125 ++ usr/src/contrib/isode/compat/logger.c | 614 +++++++++ usr/src/contrib/isode/compat/make | 7 + usr/src/contrib/isode/compat/na2norm.c | 162 +++ usr/src/contrib/isode/compat/na2str.c | 58 + usr/src/contrib/isode/compat/nochrcnv.c | 74 ++ usr/src/contrib/isode/compat/norm2na.c | 286 +++++ usr/src/contrib/isode/compat/pa2str.c | 81 ++ usr/src/contrib/isode/compat/putenv.c | 108 ++ usr/src/contrib/isode/compat/rcmd_srch.c | 46 + usr/src/contrib/isode/compat/saddr2str.c | 50 + usr/src/contrib/isode/compat/sel2str.c | 94 ++ usr/src/contrib/isode/compat/select.c | 316 +++++ usr/src/contrib/isode/compat/serror.c | 57 + usr/src/contrib/isode/compat/servbyname.c | 69 ++ usr/src/contrib/isode/compat/servbyport.c | 71 ++ usr/src/contrib/isode/compat/servbysel.c | 73 ++ usr/src/contrib/isode/compat/signals.c | 143 +++ usr/src/contrib/isode/compat/smalloc.c | 53 + usr/src/contrib/isode/compat/sprintb.c | 70 ++ usr/src/contrib/isode/compat/sstr2arg.c | 150 +++ usr/src/contrib/isode/compat/str2elem.c | 67 + usr/src/contrib/isode/compat/str2saddr.c | 49 + usr/src/contrib/isode/compat/str2sel.c | 128 ++ usr/src/contrib/isode/compat/str2taddr.c | 49 + usr/src/contrib/isode/compat/str2vec.c | 104 ++ usr/src/contrib/isode/compat/strdup.c | 60 + usr/src/contrib/isode/compat/sunlink.c | 642 ++++++++++ usr/src/contrib/isode/compat/taddr2str.c | 50 + usr/src/contrib/isode/compat/tailor.c | 961 ++++++++++++++ usr/src/contrib/isode/compat/ubcx25.c | 322 +++++ usr/src/contrib/isode/compat/x25addr.c | 1171 +++++++++++++++++ usr/src/contrib/isode/config/OPTIONS | 153 +++ usr/src/contrib/isode/config/aliases.local | 39 + usr/src/contrib/isode/config/alpaca.h | 48 + usr/src/contrib/isode/config/alpaca.make | 81 ++ usr/src/contrib/isode/config/apollo.h | 46 + usr/src/contrib/isode/config/apollo.make | 114 ++ usr/src/contrib/isode/config/aux.h | 45 + usr/src/contrib/isode/config/aux.make | 108 ++ usr/src/contrib/isode/config/bsd42.h | 36 + usr/src/contrib/isode/config/bsd42.make | 109 ++ usr/src/contrib/isode/config/bsd43-rt.h | 49 + usr/src/contrib/isode/config/bsd43-rt.make | 116 ++ usr/src/contrib/isode/config/bsd43.h | 39 + usr/src/contrib/isode/config/bsd43.make | 109 ++ usr/src/contrib/isode/config/bsd44.h | 56 + usr/src/contrib/isode/config/bsd44.make | 119 ++ usr/src/contrib/isode/config/cheetah.h | 45 + usr/src/contrib/isode/config/cheetah.make | 112 ++ usr/src/contrib/isode/config/entities.local | 26 + usr/src/contrib/isode/config/hpux.h | 42 + usr/src/contrib/isode/config/hpux.make | 112 ++ usr/src/contrib/isode/config/macros.local | 21 + usr/src/contrib/isode/config/mips.h | 46 + usr/src/contrib/isode/config/mips.make | 114 ++ usr/src/contrib/isode/config/objects.local | 38 + usr/src/contrib/isode/config/osx.h | 42 + usr/src/contrib/isode/config/osx.make | 90 ++ usr/src/contrib/isode/config/ros.h | 35 + usr/src/contrib/isode/config/ros.make | 108 ++ usr/src/contrib/isode/config/services.local | 41 + usr/src/contrib/isode/config/solbourne.h | 46 + usr/src/contrib/isode/config/solbourne.make | 110 ++ usr/src/contrib/isode/config/sunlink3.h | 46 + usr/src/contrib/isode/config/sunlink3.make | 113 ++ usr/src/contrib/isode/config/sunlink4.h | 56 + usr/src/contrib/isode/config/sunlink4.make | 113 ++ usr/src/contrib/isode/config/sunlink7.h | 56 + usr/src/contrib/isode/config/sunlink7.make | 100 ++ usr/src/contrib/isode/config/sunos3.h | 38 + usr/src/contrib/isode/config/sunos3.make | 111 ++ usr/src/contrib/isode/config/sunos4.h | 46 + usr/src/contrib/isode/config/sunos4.make | 138 +++ usr/src/contrib/isode/config/sys52-exos.h | 41 + usr/src/contrib/isode/config/sys52-exos.make | 109 ++ usr/src/contrib/isode/config/sys52-rt.h | 41 + usr/src/contrib/isode/config/sys52-rt.make | 111 ++ usr/src/contrib/isode/config/sys52-sun.h | 39 + usr/src/contrib/isode/config/sys52-sun.make | 112 ++ usr/src/contrib/isode/config/sys52-win.h | 38 + usr/src/contrib/isode/config/sys52-win.make | 109 ++ usr/src/contrib/isode/config/sys53.h | 38 + usr/src/contrib/isode/config/sys53.make | 108 ++ usr/src/contrib/isode/config/ultrix.h | 48 + usr/src/contrib/isode/config/ultrix.make | 109 ++ usr/src/contrib/isode/dirent/Makefile | 129 ++ usr/src/contrib/isode/dirent/NOTES | 108 ++ usr/src/contrib/isode/dirent/closedir.c | 42 + usr/src/contrib/isode/dirent/directory.3c | 198 +++ usr/src/contrib/isode/dirent/dirent.4 | 72 ++ usr/src/contrib/isode/dirent/getcwd.c | 202 +++ usr/src/contrib/isode/dirent/getdents.2 | 86 ++ usr/src/contrib/isode/dirent/getdents.c | 312 +++++ usr/src/contrib/isode/dirent/llib-ldirent | 114 ++ usr/src/contrib/isode/dirent/make | 7 + usr/src/contrib/isode/dirent/opendir.c | 76 ++ usr/src/contrib/isode/dirent/readdir.c | 52 + usr/src/contrib/isode/dirent/rewinddir.c | 43 + usr/src/contrib/isode/dirent/seekdir.c | 115 ++ usr/src/contrib/isode/dirent/sys._dir.h | 74 ++ usr/src/contrib/isode/dirent/telldir.c | 40 + usr/src/contrib/isode/dirent/testdir.c | 58 + usr/src/contrib/isode/h/config.h | 56 + usr/src/contrib/isode/isode-test | 88 ++ usr/src/contrib/isode/make | 7 + usr/src/contrib/isode/support/aliases.local | 39 + usr/src/contrib/isode/support/entities.local | 26 + usr/src/contrib/isode/support/macros.local | 21 + usr/src/contrib/isode/support/objects.local | 38 + usr/src/contrib/isode/support/services.local | 41 + 175 files changed, 26790 insertions(+) create mode 100644 usr/src/contrib/isode/Makefile create mode 100644 usr/src/contrib/isode/acsap/Makefile create mode 100644 usr/src/contrib/isode/acsap/acs.py create mode 100644 usr/src/contrib/isode/acsap/acsapabort1.c create mode 100644 usr/src/contrib/isode/acsap/acsapabort2.c create mode 100644 usr/src/contrib/isode/acsap/acsapaddr.c create mode 100644 usr/src/contrib/isode/acsap/acsapblock.c create mode 100644 usr/src/contrib/isode/acsap/acsapdse.c create mode 100644 usr/src/contrib/isode/acsap/acsaperror.c create mode 100644 usr/src/contrib/isode/acsap/acsapfindpci.c create mode 100644 usr/src/contrib/isode/acsap/acsapinitiat.c create mode 100644 usr/src/contrib/isode/acsap/acsaplose.c create mode 100644 usr/src/contrib/isode/acsap/acsapreleas1.c create mode 100644 usr/src/contrib/isode/acsap/acsapreleas2.c create mode 100644 usr/src/contrib/isode/acsap/acsapreleas3.c create mode 100644 usr/src/contrib/isode/acsap/acsaprespond.c create mode 100644 usr/src/contrib/isode/acsap/acsaprovider.c create mode 100644 usr/src/contrib/isode/acsap/acsapstub.c create mode 100644 usr/src/contrib/isode/acsap/acsaptest.c create mode 100644 usr/src/contrib/isode/acsap/acserver1.c create mode 100644 usr/src/contrib/isode/acsap/acserver2.c create mode 100644 usr/src/contrib/isode/acsap/acsold.py create mode 100644 usr/src/contrib/isode/acsap/aetdase.c create mode 100644 usr/src/contrib/isode/acsap/aetseq.c create mode 100644 usr/src/contrib/isode/acsap/dase.py create mode 100644 usr/src/contrib/isode/acsap/dased.8c create mode 100644 usr/src/contrib/isode/acsap/dased.c create mode 100644 usr/src/contrib/isode/acsap/dse-c.c create mode 100644 usr/src/contrib/isode/acsap/dse.py create mode 100644 usr/src/contrib/isode/acsap/is2paddr.c create mode 100644 usr/src/contrib/isode/acsap/is2saddr.c create mode 100644 usr/src/contrib/isode/acsap/is2taddr.c create mode 100644 usr/src/contrib/isode/acsap/isoalias.c create mode 100644 usr/src/contrib/isode/acsap/isoentity.c create mode 100644 usr/src/contrib/isode/acsap/libacsap.3n create mode 100644 usr/src/contrib/isode/acsap/llib-lacsap create mode 100644 usr/src/contrib/isode/acsap/make create mode 100644 usr/src/contrib/isode/acsap/oid2aei.c create mode 100644 usr/src/contrib/isode/acsap/sprintaei.c create mode 100644 usr/src/contrib/isode/compat/Makefile create mode 100644 usr/src/contrib/isode/compat/asprintf.c create mode 100644 usr/src/contrib/isode/compat/baduser.c create mode 100644 usr/src/contrib/isode/compat/bridge.c create mode 100644 usr/src/contrib/isode/compat/camtec.c create mode 100644 usr/src/contrib/isode/compat/chkpassword.c create mode 100644 usr/src/contrib/isode/compat/chrcnv.c create mode 100644 usr/src/contrib/isode/compat/cmd_srch.c create mode 100644 usr/src/contrib/isode/compat/dgram.c create mode 100644 usr/src/contrib/isode/compat/explode.c create mode 100644 usr/src/contrib/isode/compat/general.c.org create mode 100644 usr/src/contrib/isode/compat/getpassword.c create mode 100644 usr/src/contrib/isode/compat/implode.c create mode 100644 usr/src/contrib/isode/compat/inst-man.sh create mode 100644 usr/src/contrib/isode/compat/internet.c create mode 100644 usr/src/contrib/isode/compat/isoaddrs.c create mode 100644 usr/src/contrib/isode/compat/isofiles.c create mode 100644 usr/src/contrib/isode/compat/isohost.c create mode 100644 usr/src/contrib/isode/compat/isologs.sh create mode 100644 usr/src/contrib/isode/compat/isoman.rf create mode 100644 usr/src/contrib/isode/compat/isoservent.c create mode 100644 usr/src/contrib/isode/compat/lexequ.c create mode 100644 usr/src/contrib/isode/compat/lexnequ.c create mode 100644 usr/src/contrib/isode/compat/libicompat.3 create mode 100644 usr/src/contrib/isode/compat/llib-lcompat create mode 100644 usr/src/contrib/isode/compat/log_tai.c create mode 100644 usr/src/contrib/isode/compat/logger.c create mode 100644 usr/src/contrib/isode/compat/make create mode 100644 usr/src/contrib/isode/compat/na2norm.c create mode 100644 usr/src/contrib/isode/compat/na2str.c create mode 100644 usr/src/contrib/isode/compat/nochrcnv.c create mode 100644 usr/src/contrib/isode/compat/norm2na.c create mode 100644 usr/src/contrib/isode/compat/pa2str.c create mode 100644 usr/src/contrib/isode/compat/putenv.c create mode 100644 usr/src/contrib/isode/compat/rcmd_srch.c create mode 100644 usr/src/contrib/isode/compat/saddr2str.c create mode 100644 usr/src/contrib/isode/compat/sel2str.c create mode 100644 usr/src/contrib/isode/compat/select.c create mode 100644 usr/src/contrib/isode/compat/serror.c create mode 100644 usr/src/contrib/isode/compat/servbyname.c create mode 100644 usr/src/contrib/isode/compat/servbyport.c create mode 100644 usr/src/contrib/isode/compat/servbysel.c create mode 100644 usr/src/contrib/isode/compat/signals.c create mode 100644 usr/src/contrib/isode/compat/smalloc.c create mode 100644 usr/src/contrib/isode/compat/sprintb.c create mode 100644 usr/src/contrib/isode/compat/sstr2arg.c create mode 100644 usr/src/contrib/isode/compat/str2elem.c create mode 100644 usr/src/contrib/isode/compat/str2saddr.c create mode 100644 usr/src/contrib/isode/compat/str2sel.c create mode 100644 usr/src/contrib/isode/compat/str2taddr.c create mode 100644 usr/src/contrib/isode/compat/str2vec.c create mode 100644 usr/src/contrib/isode/compat/strdup.c create mode 100644 usr/src/contrib/isode/compat/sunlink.c create mode 100644 usr/src/contrib/isode/compat/taddr2str.c create mode 100644 usr/src/contrib/isode/compat/tailor.c create mode 100644 usr/src/contrib/isode/compat/ubcx25.c create mode 100644 usr/src/contrib/isode/compat/x25addr.c create mode 100644 usr/src/contrib/isode/config/OPTIONS create mode 100644 usr/src/contrib/isode/config/aliases.local create mode 100644 usr/src/contrib/isode/config/alpaca.h create mode 100644 usr/src/contrib/isode/config/alpaca.make create mode 100644 usr/src/contrib/isode/config/apollo.h create mode 100644 usr/src/contrib/isode/config/apollo.make create mode 100644 usr/src/contrib/isode/config/aux.h create mode 100644 usr/src/contrib/isode/config/aux.make create mode 100644 usr/src/contrib/isode/config/bsd42.h create mode 100644 usr/src/contrib/isode/config/bsd42.make create mode 100644 usr/src/contrib/isode/config/bsd43-rt.h create mode 100644 usr/src/contrib/isode/config/bsd43-rt.make create mode 100644 usr/src/contrib/isode/config/bsd43.h create mode 100644 usr/src/contrib/isode/config/bsd43.make create mode 100644 usr/src/contrib/isode/config/bsd44.h create mode 100644 usr/src/contrib/isode/config/bsd44.make create mode 100644 usr/src/contrib/isode/config/cheetah.h create mode 100644 usr/src/contrib/isode/config/cheetah.make create mode 100644 usr/src/contrib/isode/config/entities.local create mode 100644 usr/src/contrib/isode/config/hpux.h create mode 100644 usr/src/contrib/isode/config/hpux.make create mode 100644 usr/src/contrib/isode/config/macros.local create mode 100644 usr/src/contrib/isode/config/mips.h create mode 100644 usr/src/contrib/isode/config/mips.make create mode 100644 usr/src/contrib/isode/config/objects.local create mode 100644 usr/src/contrib/isode/config/osx.h create mode 100644 usr/src/contrib/isode/config/osx.make create mode 100644 usr/src/contrib/isode/config/ros.h create mode 100644 usr/src/contrib/isode/config/ros.make create mode 100644 usr/src/contrib/isode/config/services.local create mode 100644 usr/src/contrib/isode/config/solbourne.h create mode 100644 usr/src/contrib/isode/config/solbourne.make create mode 100644 usr/src/contrib/isode/config/sunlink3.h create mode 100644 usr/src/contrib/isode/config/sunlink3.make create mode 100644 usr/src/contrib/isode/config/sunlink4.h create mode 100644 usr/src/contrib/isode/config/sunlink4.make create mode 100644 usr/src/contrib/isode/config/sunlink7.h create mode 100644 usr/src/contrib/isode/config/sunlink7.make create mode 100644 usr/src/contrib/isode/config/sunos3.h create mode 100644 usr/src/contrib/isode/config/sunos3.make create mode 100644 usr/src/contrib/isode/config/sunos4.h create mode 100644 usr/src/contrib/isode/config/sunos4.make create mode 100644 usr/src/contrib/isode/config/sys52-exos.h create mode 100644 usr/src/contrib/isode/config/sys52-exos.make create mode 100644 usr/src/contrib/isode/config/sys52-rt.h create mode 100644 usr/src/contrib/isode/config/sys52-rt.make create mode 100644 usr/src/contrib/isode/config/sys52-sun.h create mode 100644 usr/src/contrib/isode/config/sys52-sun.make create mode 100644 usr/src/contrib/isode/config/sys52-win.h create mode 100644 usr/src/contrib/isode/config/sys52-win.make create mode 100644 usr/src/contrib/isode/config/sys53.h create mode 100644 usr/src/contrib/isode/config/sys53.make create mode 100644 usr/src/contrib/isode/config/ultrix.h create mode 100644 usr/src/contrib/isode/config/ultrix.make create mode 100644 usr/src/contrib/isode/dirent/Makefile create mode 100644 usr/src/contrib/isode/dirent/NOTES create mode 100644 usr/src/contrib/isode/dirent/closedir.c create mode 100644 usr/src/contrib/isode/dirent/directory.3c create mode 100644 usr/src/contrib/isode/dirent/dirent.4 create mode 100644 usr/src/contrib/isode/dirent/getcwd.c create mode 100644 usr/src/contrib/isode/dirent/getdents.2 create mode 100644 usr/src/contrib/isode/dirent/getdents.c create mode 100644 usr/src/contrib/isode/dirent/llib-ldirent create mode 100644 usr/src/contrib/isode/dirent/make create mode 100644 usr/src/contrib/isode/dirent/opendir.c create mode 100644 usr/src/contrib/isode/dirent/readdir.c create mode 100644 usr/src/contrib/isode/dirent/rewinddir.c create mode 100644 usr/src/contrib/isode/dirent/seekdir.c create mode 100644 usr/src/contrib/isode/dirent/sys._dir.h create mode 100644 usr/src/contrib/isode/dirent/telldir.c create mode 100644 usr/src/contrib/isode/dirent/testdir.c create mode 100644 usr/src/contrib/isode/h/config.h create mode 100644 usr/src/contrib/isode/isode-test create mode 100644 usr/src/contrib/isode/make create mode 100644 usr/src/contrib/isode/support/aliases.local create mode 100644 usr/src/contrib/isode/support/entities.local create mode 100644 usr/src/contrib/isode/support/macros.local create mode 100644 usr/src/contrib/isode/support/objects.local create mode 100644 usr/src/contrib/isode/support/services.local diff --git a/usr/src/contrib/isode/Makefile b/usr/src/contrib/isode/Makefile new file mode 100644 index 0000000000..143a1ad98e --- /dev/null +++ b/usr/src/contrib/isode/Makefile @@ -0,0 +1,387 @@ +########################################################################## +# Instructions to Make, for compilation of ISODE processes +########################################################################## + +############################################################################### +# +# $Header: /f/osi/RCS/Makefile,v 7.9 91/02/22 09:13:48 mrose Interim $ +# +# +# $Log: Makefile,v $ +# Revision 7.9 91/02/22 09:13:48 mrose +# Interim 6.8 +# +# Revision 7.8 91/01/15 09:30:05 mrose +# update +# +# Revision 7.7 90/10/15 18:18:32 mrose +# iaed +# +# Revision 7.6 90/07/29 16:47:38 mrose +# test +# +# Revision 7.5 90/07/27 08:49:43 mrose +# update +# +# Revision 7.4 90/07/09 14:30:11 mrose +# sync +# +# Revision 7.3 90/07/01 21:07:55 mrose +# pepsy +# +# Revision 7.2 90/03/27 07:53:29 mrose +# partial +# +# Revision 7.1 90/03/05 23:04:11 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:21:28 mrose +# Release 6.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. +# +############################################################################### + + +################################################################## +# Here it is... +################################################################## + +DIRS = h compat dirent tsap ssap psap pepsy pepy psap2 \ + acsap rosap rtsap ronot rosy support imisc +OTHERS = dsap ftam ftam2 ftam-ftp ftp-ftam others psap2-lpp quipu \ + snmp vt + + +all:; @for i in $(DIRS); \ + do (echo "cd $$i; $(MAKE) all"; \ + cd $$i; $(MAKE) all); \ + done + +inst-all:; @for i in $(BINDIR) $(SBINDIR) $(ETCDIR) $(LOGDIR) \ + $(LIBDIR) $(LINTDIR) $(MANDIR); \ + do (echo $$i X | \ + sed -e 's%\(.*\)/ X%if test ! -d \1; then mkdir \1; chmod 555 \1; fi%' | \ + sh -ve); \ + done + @echo $(LOGDIR) X | \ + sed -e 's%\(.*\)/ X%chmod 777 \1%' | \ + sh -ve + @for i in $(DIRS); \ + do (echo "cd $$i; $(MAKE) inst-all"; \ + cd $$i; $(MAKE) inst-all); \ + done + +install: inst-all clean + +lint:; @for i in $(DIRS); \ + do (echo "cd $$i; $(MAKE) lint"; \ + cd $$i; $(MAKE) lint); \ + done + +clean:; rm -f *.a *.so.* llib-l* _* *.tmp config/_* util/inst-man.sh + @for i in $(DIRS) $(OTHERS); \ + do (echo "cd $$i; $(MAKE) clean"; \ + cd $$i; $(MAKE) clean); \ + done + +test:; PATH=$$PATH:${BINDIR} sh isode-test + +grind:; @for i in $(DIRS) $(OTHERS); \ + do (echo "cd $$i; $(MAKE) grind"; \ + cd $$i; $(MAKE) grind); \ + done + +once-only:; @touch h/*.h h/quipu/*.h + @touch dsap/dsaptailor dsap/oidtable.*.local quipu/quiputailor + +distribution: clean once-only READ-ME QUIPU-READ-ME + @cd doc; make clean + +READ-ME: isode-gen.8 + nroff -man isode-gen.8 > isode-gen.tmp + mv isode-gen.tmp $@ + +QUIPU-READ-ME: quipu-new.8 + nroff -ms quipu-new.8 > quipu-new.tmp + mv quipu-new.tmp $@ + +inst-partial:; cd h; $(MAKE) inst-all + cd pepsy; $(MAKE) inst-all + cd pepy; $(MAKE) inst-all + cd support; $(MAKE) macros inst-libisode + + +################################################################## +# everything +################################################################## + +everything: all true + ./make all-ftam all-ftam-ftp all-vt all-quipu all-snmp all-lpp + @echo "a great album by mtr's favorite rock band" + +inst-everything: inst-all true + ./make inst-ftam inst-ftam-ftp inst-vt inst-quipu inst-snmp \ + inst-lpp + +true:; + + +################################################################## +# ftam +################################################################## + +FTAM = ftam ftam2 + + +all-ftam:; @for i in $(FTAM); \ + do (echo "cd $$i; $(MAKE) all"; \ + cd $$i; $(MAKE) all); \ + done + +inst-ftam:; @for i in $(FTAM); \ + do (echo "cd $$i; $(MAKE) inst-all"; \ + cd $$i; $(MAKE) inst-all); \ + done + +install-ftam:; @for i in $(FTAM); \ + do (echo "cd $$i; $(MAKE) install"; \ + cd $$i; $(MAKE) install); \ + done + +lint-ftam:; @for i in $(FTAM); \ + do (echo "cd $$i; $(MAKE) lint"; \ + cd $$i; $(MAKE) lint); \ + done + + +################################################################## +# ftam-ftp +################################################################## + +FTAM-FTP= ftam-ftp ftp-ftam + + +all-ftam-ftp:; @for i in $(FTAM-FTP); \ + do (echo "cd $$i; $(MAKE) all"; \ + cd $$i; $(MAKE) all); \ + done + +inst-ftam-ftp:; @for i in $(FTAM-FTP); \ + do (echo "cd $$i; $(MAKE) inst-all"; \ + cd $$i; $(MAKE) inst-all); \ + done + +install-ftam-ftp:; @for i in $(FTAM-FTP); \ + do (echo "cd $$i; $(MAKE) install"; \ + cd $$i; $(MAKE) install); \ + done + +lint-ftam-ftp:; @for i in $(FTAM-FTP); \ + do (echo "cd $$i; $(MAKE) lint"; \ + cd $$i; $(MAKE) lint); \ + done + + +################################################################## +# vt +################################################################## + +VT = vt + + +all-vt:; @for i in $(VT); \ + do (echo "cd $$i; $(MAKE) all"; \ + cd $$i; $(MAKE) all); \ + done + +inst-vt:; @for i in $(VT); \ + do (echo "cd $$i; $(MAKE) inst-all"; \ + cd $$i; $(MAKE) inst-all); \ + done + +install-vt:; @for i in $(VT); \ + do (echo "cd $$i; $(MAKE) install"; \ + cd $$i; $(MAKE) install); \ + done + +lint-vt:; @for i in $(VT); \ + do (echo "cd $$i; $(MAKE) lint"; \ + cd $$i; $(MAKE) lint); \ + done + + +################################################################## +# quipu +################################################################## + +QUIPU = dsap quipu + + +all-quipu:; cd h/quipu; $(MAKE) all + @for i in $(QUIPU); \ + do (echo "cd $$i; $(MAKE) all"; \ + cd $$i; $(MAKE) all); \ + done + cd acsap; $(MAKE) dased + cd support; $(MAKE) iaed + +inst-quipu:; cd h/quipu; $(MAKE) inst-all + @for i in $(QUIPU); \ + do (echo "cd $$i; $(MAKE) inst-all"; \ + cd $$i; $(MAKE) inst-all); \ + done + cd acsap; $(MAKE) inst-dased man-dased + cd support; $(MAKE) inst-iaed man-iaed + +install-quipu:; cd h/quipu; $(MAKE) install + @for i in $(QUIPU); \ + do (echo "cd $$i; $(MAKE) install"; \ + cd $$i; $(MAKE) install); \ + done + cd acsap; $(MAKE) inst-dased man-dased + cd support; $(MAKE) inst-iaed man-iaed + +lint-quipu:; cd h/quipu; $(MAKE) lint + @for i in $(QUIPU); \ + do (echo "cd $$i; $(MAKE) lint"; \ + cd $$i; $(MAKE) lint); \ + done + cd acsap; $(MAKE) l-dased + cd support; $(MAKE) l-iaed + + +################################################################## +# snmp +################################################################## + +SNMP = snmp + + +all-snmp:; @for i in $(SNMP); \ + do (echo "cd $$i; $(MAKE) all"; \ + cd $$i; $(MAKE) all); \ + done + +inst-snmp:; @for i in $(SNMP); \ + do (echo "cd $$i; $(MAKE) inst-all"; \ + cd $$i; $(MAKE) inst-all); \ + done + +install-snmp:; @for i in $(SNMP); \ + do (echo "cd $$i; $(MAKE) install"; \ + cd $$i; $(MAKE) install); \ + done + +lint-snmp:; @for i in $(SNMP); \ + do (echo "cd $$i; $(MAKE) lint"; \ + cd $$i; $(MAKE) lint); \ + done + + +################################################################## +# lpp +################################################################## + +LPP = h compat psap pepsy pepy acsap rosap ronot rosy psap2-lpp +LPP-AUX = support imisc + + +all-lpp:; @for i in $(LPP); \ + do (echo "cd $$i; $(MAKE) all"; \ + cd $$i; $(MAKE) all); \ + done + @for i in $(LPP-AUX); \ + do (echo "cd $$i; $(MAKE) all-lpp"; \ + cd $$i; $(MAKE) all-lpp); \ + done + +inst-lpp:; @for i in $(LPP); \ + do (echo "cd $$i; $(MAKE) inst-all"; \ + cd $$i; $(MAKE) inst-all); \ + done + @for i in $(LPP-AUX); \ + do (echo "cd $$i; $(MAKE) inst-lpp"; \ + cd $$i; $(MAKE) inst-lpp); \ + done + +install-lpp:; @for i in $(LPP); \ + do (echo "cd $$i; $(MAKE) install"; \ + cd $$i; $(MAKE) install); \ + done + @for i in $(LPP-AUX); \ + do (echo "cd $$i; $(MAKE) install-lpp"; \ + cd $$i; $(MAKE) install-lpp); \ + done + +lint-lpp:; @for i in $(LPP); \ + do (echo "cd $$i; $(MAKE) lint"; \ + cd $$i; $(MAKE) lint); \ + done + @for i in $(LPP-AUX); \ + do (echo "cd $$i; $(MAKE) lint-lpp"; \ + cd $$i; $(MAKE) lint-lpp); \ + done + + +################################################################## +# image +################################################################## + +image:; find . -name RCS -a -exec rm -rf {} \; -a -prune + rm -f CHECK-OUT config/CONFIG.make h/config.h \ + support/aliases.local support/entities.local \ + support/macros.local support/objects.local \ + support/services.local + cp dsap/common/protected.c /tmp/protected.c + -unifdef -UHAVE_PROTECTED < /tmp/protected.c \ + > dsap/common/protected.c + rm -f /tmp/protected.c + + +################################################################## +# zap +################################################################## + +zap:; rm -rf $(INCDIRM) + rm -f $(BINDIR)pepy \ + $(BINDIR)posy \ + $(BINDIR)rosy + rm -f $(LIBDIR)libicompat.a \ + $(LIBDIR)libdirent.a \ + $(LIBDIR)libtsap.a \ + $(LIBDIR)libssap.a \ + $(LIBDIR)libpsap.a \ + $(LIBDIR)libpepy.a \ + $(LIBDIR)libpsap2.a \ + $(LIBDIR)libacsap.a \ + $(LIBDIR)librtsap.a \ + $(LIBDIR)libronot.a \ + $(LIBDIR)librosap.a \ + $(LIBDIR)librosy.a \ + $(LIBDIR)libisode.a \ + $(LIBDIR)libdsap.a \ + $(LIBDIR)libquipu.a + rm -f $(LINTDIR)llib-licompat* \ + $(LINTDIR)llib-ldirent* \ + $(LINTDIR)llib-ltsap* \ + $(LINTDIR)llib-lssap* \ + $(LINTDIR)llib-lpsap* \ + $(LINTDIR)llib-lpsap2* \ + $(LINTDIR)llib-lacsap* \ + $(LINTDIR)llib-lrtsap* \ + $(LINTDIR)llib-lronot* \ + $(LINTDIR)llib-lrosap* \ + $(LINTDIR)llib-lrosy* \ + $(LINTDIR)llib-lisode* \ + $(LINTDIR)llib-ldsap* \ + $(LINTDIR)llib-lquipu* diff --git a/usr/src/contrib/isode/acsap/Makefile b/usr/src/contrib/isode/acsap/Makefile new file mode 100644 index 0000000000..e98119c5bb --- /dev/null +++ b/usr/src/contrib/isode/acsap/Makefile @@ -0,0 +1,314 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE AcSAP processes +############################################################################### + +############################################################################### +# +# $Header: /f/osi/acsap/RCS/Makefile,v 7.11 91/02/22 09:13:58 mrose Interim $ +# +# +# $Log: Makefile,v $ +# Revision 7.11 91/02/22 09:13:58 mrose +# Interim 6.8 +# +# Revision 7.10 91/01/24 14:49:52 mrose +# update +# +# Revision 7.9 90/12/23 18:38:56 mrose +# update +# +# Revision 7.8 90/11/20 15:33:24 mrose +# update +# +# Revision 7.7 90/10/15 18:19:25 mrose +# zap-AET +# +# Revision 7.6 90/07/27 08:41:38 mrose +# update +# +# Revision 7.5 90/07/09 14:30:21 mrose +# sync +# +# Revision 7.4 90/07/01 21:01:46 mrose +# pepsy +# +# Revision 7.3 90/03/06 13:55:40 mrose +# touch-up +# +# Revision 7.2 89/12/20 01:40:07 mrose +# touch-up +# +# Revision 7.1 89/12/19 16:18:05 mrose +# dgram +# +# Revision 7.0 89/11/23 21:21:41 mrose +# Release 6.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. +# +############################################################################### + + +PEPYPATH= -DPEPYPATH + +.SUFFIXES: .py .c .o + + +LIBES = libacsap.a $(TOPDIR)libpepy.a $(TOPDIR)libpepsy.a \ + $(TOPDIR)libpsap.a $(TOPDIR)libtsap.a $(TOPDIR)libcompat.a +LLIBS = $(TOPDIR)llib-lpsap2 $(TOPDIR)llib-lpsap $(TOPDIR)llib-lcompat +HFILES = $(HDIR)acsap.h $(HDIR)psap2.h $(HDIR)psap.h \ + $(HDIR)ssap.h $(HDIR)isoaddrs.h \ + $(HDIR)manifest.h $(HDIR)general.h $(HDIR)config.h + + +################################################################## +# Here it is... +################################################################## + +all: libacsap acsaptest +inst-all: inst-headers # inst-libacsap manuals +install: inst-all clean +lint: l-libacsap l-acsaptest + + +################################################################ +# libacsap +################################################################ + +CFILES = acsaprovider.c acsapblock.c acsaperror.c acsaplose.c \ + acsaprespond.c acsapinitiat.c acsapreleas1.c acsapreleas2.c \ + acsapreleas3.c acsapabort1.c acsapabort2.c acsapfindpci.c \ + acsapaddr.c \ + acsapdse.c aetdase.c isoalias.c \ + acsapstub.c aetseq.c isoentity.c \ + oid2aei.c sprintaei.c \ + is2paddr.c is2saddr.c is2taddr.c \ + acserver1.c acserver2.c \ + dse-c.c +PYFILES = acs.py acsold.py dse.py ns.py +OFILES = acsaprovider.o acsapblock.o acsaperror.o acsaplose.o \ + acsaprespond.o acsapinitiat.o acsapreleas1.o acsapreleas2.o \ + acsapreleas3.o acsapabort1.o acsapabort2.o acsapfindpci.o \ + acsapaddr.o \ + acsapdse.o aetdase.o isoalias.o \ + acsapstub.o aetseq.o isoentity.o \ + oid2aei.o sprintaei.o \ + is2paddr.o is2saddr.o is2taddr.o \ + acserver1.o acserver2.o \ + dse-c.o \ + $(OSTRINGS) + +HEADERS = ACS.ph ACS-types.h ACS_defs.h ACS_pre_defs.h \ + DSE.ph DSE-types.h DSE_defs.h DSE_pre_defs.h +# Possibly DASE and OACS as well + + +inst-libacsap: $(LIBDIR)libacsap.a $(LINTDIR)llib-lacsap + +$(LIBDIR)libacsap.a: libacsap.a + -rm -f $@ + cp libacsap.a $@ + @$(UTILDIR)make-lib.sh $(SYSTEM) $@ -ranlib + -@ls -gls $@ + -@echo "" + +$(LINTDIR)llib-lacsap: llib-lacsap + -cp $@ zllib-lacsap + -rm -f $@ + sed -e 's%#include "\(.*\)"%#include "$(INCDIR)\1"%' \ + < llib-lacsap | \ + sed -e 's%#include "/usr/include/\(.*\)"%#include <\1>%' > $@ + @$(UTILDIR)inst-lint.sh $(SYSTEM) $(OPTIONS) $@ + -@ls -gls $@ $@.ln + -@echo "" + +inst-headers:; @for h in $(HEADERS); do $(MAKE) TARGET=$$h inst-target; done + +inst-target: $(PEPSYDIR)$(TARGET) + +$(PEPSYDIR)$(TARGET): $(TARGET) + -cp $@ z$(TARGET) + cp $(TARGET) $@ + -@ls -gls $@ + -@echo "" + +libacsap: libacsap.a true + -@rm -f $(TOPDIR)h/ACS*.h $(TOPDIR)h/OACS*.h + -@$(LN) ACS-types.h $(TOPDIR)h/ACS-types.h + -@$(LN) ACS_defs.h $(TOPDIR)h/ACS_defs.h + -@$(LN) ACS_pre_defs.h $(TOPDIR)h/ACS_pre_defs.h + -@$(LN) OACS-types.h $(TOPDIR)h/OACS-types.h + -@$(LN) OACS_defs.h $(TOPDIR)h/OACS_defs.h + -@$(LN) OACS_pre_defs.h $(TOPDIR)h/OACS_pre_defs.h + +libacsap.a: acsapvrsn.o + -rm -f $@ + @$(UTILDIR)make-lib.sh $(SYSTEM) $(ARFLAGS) $@ $(OFILES) \ + ACS_tables.o OACS_tables.o DSE_tables.o DASE_tables.o \ + acsapvrsn.o + -@rm -f $(TOPDIR)libacsap.a $(TOPDIR)llib-lacsap + -@$(LN) libacsap.a $(TOPDIR)libacsap.a + -@$(LN) llib-lacsap $(TOPDIR)llib-lacsap + -@ls -l $@ + -@echo "AcSAP library built normally" + +ACS_tables.o: ACS_tables.c ACS-types.h + +ACS_tables.c ACS-types.h: acs.py $(TOPDIR)pepsy/xpepsy + $(TOPDIR)pepsy/xpepsy -A -f -h -m acs.py + +OACS_tables.o: OACS_tables.c OACS-types.h + +OACS_tables.c OACS-types.h: acsold.py $(TOPDIR)pepsy/xpepsy + $(TOPDIR)pepsy/xpepsy -A -f -h -m acsold.py + sed -e 's/decode_/parse_/' < OACS_defs.h > OACS_defs.tmp + mv OACS_defs.tmp OACS_defs.h + +DSE_tables.o: DSE_tables.c DSE-types.h + +DSE_tables.c DSE-types.h: dse.py $(TOPDIR)pepsy/xpepsy + $(TOPDIR)pepsy/xpepsy -A -f -h -m dse.py + +DASE_tables.o: DASE_tables.c DASE-types.h + +DASE_tables.c DASE-types.h: dase.py $(TOPDIR)pepsy/xpepsy + $(TOPDIR)pepsy/xpepsy -A -f -h -m dase.py + +acsapvrsn.c: $(OFILES) ACS_tables.o OACS_tables.o DSE_tables.o DASE_tables.o + @$(UTILDIR)version.sh acsap > $@ + +l-libacsap: ACS_tables.c OACS_tables.c DSE_tables.c DASE_tables.c true + $(LINT) $(LFLAGS) $(CFILES) ACS_tables.c OACS_tables.c \ + DSE_tables.c DASE_tables.c $(LLIBS) \ + | grep -v "warning: possible pointer alignment problem" + +acsaprovider.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)tailor.h \ + $(HDIR)logger.h +acsapblock.o: $(HDIR)acpkt.h $(HFILES) +acsaperror.o: $(HFILES) +acsaplose.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)tailor.h \ + $(HDIR)logger.h +acsaprespond.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)tailor.h \ + $(HDIR)logger.h +acsapinitiat.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)isoservent.h \ + $(HDIR)tailor.h $(HDIR)logger.h +acsapreleas1.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)tailor.h \ + $(HDIR)logger.h +acsapreleas2.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)tailor.h \ + $(HDIR)logger.h +acsapreleas3.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)tailor.h \ + $(HDIR)logger.h +acsapabort1.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)tailor.h \ + $(HDIR)logger.h +acsapabort2.o: ACS-types.h $(HDIR)acpkt.h $(HFILES) $(HDIR)tailor.h \ + $(HDIR)logger.h +acsapabort2.o: $(HDIR)acpkt.h $(HFILES) +acsapaddr.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h +acsapdse.o: DSE-types.h $(HDIR)psap.h $(HDIR)manifest.h $(HDIR)general.h \ + $(HDIR)config.h $(HDIR)isoaddrs.h $(HDIR)tailor.h \ + $(HDIR)logger.h +aetdase.o: DASE-types.h $(HDIR)psap.h $(HDIR)manifest.h $(HDIR)general.h \ + $(HDIR)config.h $(HDIR)tsap.h $(HDIR)isoaddrs.h \ + $(HDIR)dgram.h $(HDIR)tailor.h $(HDIR)logger.h +isoalias.o: $(HDIR)manifest.h $(HDIR)general.h $(HDIR)config.h \ + $(HDIR)tailor.h $(HDIR)logger.h +acsapstub.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h +aetseq.o: $(HFILES) +isoentity.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h +oid2aei.o: $(HFILES) +sprintaei.o: $(HFILES) +is2paddr.o: $(HFILES) +is2saddr.o: $(HFILES) +is2taddr.o: $(HFILES) +acserver1.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h +acserver2.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h +acsold.o: $(HDIR)acpkt.h $(HFILES) +acsold.o: acsold.c +acsold.c: acsold.py +dse-c.o: DSE-types.h + + +################################################################ +# acsaptest +################################################################ + +acsaptest: acsaptest.o $(LIBES) + $(LDCC) $(LDFLAGS) -o $@ acsaptest.o $(LIBES) $(LSOCKET) + +acsaptest.o: $(HFILES) $(HDIR)isoservent.h $(HDIR)tailor.h $(HDIR)logger.h \ + acsaptest.c + $(CC) $(CFLAGS) -c $*.c + +l-acsaptest:; $(LINT) $(LFLAGS) acsaptest.c llib-lacsap $(LLIBS) \ + | grep -v "warning: possible pointer alignment problem" + + +################################################################ +# dased +################################################################ + +inst-dased: $(SBINDIR)dased + +$(SBINDIR)dased: xdased + -cp $@ zxdased + -rm -f $@ + cp xdased $@ + -@ls -gls $@ + -@echo "" + +dased: xdased + +xdased: dased.o DASE_tables.o $(TOPDIR)libdsap.a $(TOPDIR)libisode.a + $(LDCC) $(LDFLAGS) -o $@ dased.o DASE_tables.o \ + $(LIBDSAP) $(LIBISODE) $(LSOCKET) $(LIBGDBM) + +dased.o: $(HDIR)manifest.h $(HDIR)config.h DASE-types.h $(HDIR)psap.h \ + $(HDIR)general.h $(HDIR)tsap.h $(HDIR)isoaddrs.h \ + $(HDIR)dgram.h $(HDIR)tailor.h $(HDIR)logger.h + $(CC) $(CFLAGS) -c $*.c + +l-dased:; $(LINT) $(LFLAGS) dased.c $(TOPDIR)llib-ldsap llib-lacsap \ + $(LLIBS) \ + | grep -v "warning: possible pointer alignment problem" + +man-dased:; @$(UTILDIR)inst-man.sh $(MANOPTS) dased.8c + -@echo "" + + +################################################################ +# manual pages +################################################################ + +MANUALS = libacsap.3n + +manuals:; @$(UTILDIR)inst-man.sh $(MANOPTS) $(MANUALS) + -@echo "" + + +################################################################ +# clean +################################################################ + +clean:; rm -f *.o *.a *.ph ACS* OACS* DSE* DASE* x* z* _* core \ + acsaptest acsapvrsn.c $(TOPDIR)h/ACS*.h \ + $(TOPDIR)h/OACS*.h + +grind:; iprint Makefile + tgrind -lc $(CFILES) acsapvrsn.c acsaptest.c llib-lacsap + tgrind -lpepy -d $(TOPDIR)pepy/grindefs $(PYFILES) + @echo $(MANUALS) | \ + tr " " "\012" | \ + sed -e "s%.*%itroff -man &%" | \ + sh -ve + +true:; diff --git a/usr/src/contrib/isode/acsap/acs.py b/usr/src/contrib/isode/acsap/acs.py new file mode 100644 index 0000000000..9d0d8293ef --- /dev/null +++ b/usr/src/contrib/isode/acsap/acs.py @@ -0,0 +1,318 @@ +-- acs.py - AcSAP definitions +-- lifted directly from ISO8650 + +-- $Header: /f/osi/acsap/RCS/acs.py,v 7.2 91/02/22 09:14:00 mrose Interim $ +-- +-- +-- $Log: acs.py,v $ +-- Revision 7.2 91/02/22 09:14:00 mrose +-- Interim 6.8 +-- +-- Revision 7.1 90/07/09 14:30:23 mrose +-- sync +-- +-- Revision 7.0 89/11/23 21:21:43 mrose +-- Release 6.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. +-- +-- + + +--* ACSE-1 *-- ACS DEFINITIONS ::= + +%{ +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acs.py,v 7.2 91/02/22 09:14:00 mrose Interim $"; +#endif +%} + +BEGIN + +-- ACSE-1 refers to ACSE version 1 + +ACSE-apdu ::= + CHOICE { + aarq + AARQ-apdu, + + aare + AARE-apdu, + + rlrq + RLRQ-apdu, + + rlre + RLRE-apdu, + + abrt + ABRT-apdu + } + + +AARQ-apdu ::= + [APPLICATION 0] + IMPLICIT SEQUENCE { + protocol-version[0] + IMPLICIT BIT STRING { + version1(0) + } + DEFAULT { version1 }, + + application-context-name[1] + Application-context-name, + + called-AP-title[2] + AP-title + OPTIONAL, + + called-AE-qualifier[3] + AE-qualifier + OPTIONAL, + + called-AP-invocation-id[4] + AP-invocation-id + OPTIONAL, + + called-AE-invocation-id[5] + AE-invocation-id + OPTIONAL, + + calling-AP-title[6] + AP-title + OPTIONAL, + + calling-AE-qualifier[7] + AE-qualifier + OPTIONAL, + + calling-AP-invocation-id[8] + AP-invocation-id + OPTIONAL, + + calling-AE-invocation-id[9] + AE-invocation-id + OPTIONAL, + + implementation-information[29] + IMPLICIT Implementation-data + OPTIONAL, + + user-information[30] + IMPLICIT Association-information + OPTIONAL + } + + +AARE-apdu ::= + [APPLICATION 1] + IMPLICIT SEQUENCE { + protocol-version[0] + IMPLICIT BIT STRING { + version1(0) + } + DEFAULT { version1 }, + + application-context-name[1] + Application-context-name, + + result[2] + --* Associate-result, *-- + INTEGER { --* *-- + accepted(0), --* *-- + rejected-permanent(1), --* *-- + rejected-transient(2) --* *-- + }, --* *-- + + result-source-diagnostic[3] + Associate-source-diagnostic, + + responding-AP-title[4] + AP-title + OPTIONAL, + + responding-AE-qualifier[5] + AE-qualifier + OPTIONAL, + + responding-AP-invocation-id[6] + AP-invocation-id + OPTIONAL, + + responding-AE-invocation-id[7] + AE-invocation-id + OPTIONAL, + + implementation-information[29] + IMPLICIT Implementation-data + OPTIONAL, + + user-information[30] + IMPLICIT Association-information + OPTIONAL + } + + +RLRQ-apdu ::= + [APPLICATION 2] + IMPLICIT SEQUENCE { + reason[0] + IMPLICIT --* Release-request-reason *-- + INTEGER { --* *-- + normal(0), --* *-- + urgent(1), --* *-- + user-defined(30) --* *-- + } --* *-- + OPTIONAL, + + user-information[30] + IMPLICIT Association-information + OPTIONAL + } + + +RLRE-apdu ::= + [APPLICATION 3] + IMPLICIT SEQUENCE { + reason[0] + IMPLICIT --* Release-response-reason *-- + INTEGER { --* *-- + normal(0), --* *-- + not-finished(1), --* *-- + user-defined(30) --* *-- + } --* *-- + OPTIONAL, + + user-information[30] + IMPLICIT Association-information + OPTIONAL + } + + +ABRT-apdu ::= + [APPLICATION 4] + IMPLICIT SEQUENCE { + abort-source[0] + --* IMPLICIT ABRT-source, *-- + IMPLICIT INTEGER { --* *-- + acse-service-user(0), --* *-- + acse-service-provider(1) --* *-- + }, --* *-- + + + user-information[30] + IMPLICIT Association-information + OPTIONAL + } + +ABRT-source ::= + INTEGER { + acse-service-user(0), + acse-service-provider(1) + } + + +Application-context-name ::= + OBJECT IDENTIFIER + + +AP-title ::= + ANY + -- The exact definition and values used for AP-title + -- should be chosen taking into account the ongoing + -- work in the areas of naming, the Directory, and the + -- Registration Authority procedures for AP-titles, + -- AE-titles and AE-qualifiers. + +AE-qualifier ::= + ANY + -- The exact definition and values used for AE-qualifier + -- should be chosen taking into account the ongoing + -- work in the areas of naming, the Directory, and the + -- Registration Authority procedures for AP-titles, + -- AE-titles and AE-qualifiers. + +-- As defined in ISO 7498-3, an application-entity title is composed of +-- an application-process title and an application-entity qualifier. +-- The ACSE protocol provides for the transfer of an application-entity +-- title value by the transfer of its component values. However, the +-- following data type is provided by reference for other International +-- Standards that require a single syntactic structure for AE-titles. + +AE-title ::= + SEQUENCE { + title --* *-- + AP-title, + + qualifier --* *-- + AE-qualifier + } + +AE-invocation-id ::= + INTEGER + +AP-invocation-id ::= + INTEGER + + +Associate-result ::= + INTEGER { + accepted(0), + rejected-permanent(1), + rejected-transient(2) + } + +Associate-source-diagnostic ::= + CHOICE { + acse-service-user[1] + INTEGER { + null(0), + no-reason-given(1), + application-context-name-not-supported(2), + calling-AP-title-not-recognized(3), + calling-AP-invocation-identifier-not-recognized(4), + calling-AE-qualifier-not-recognized(5), + calling-AE-invocation-id-not-recognized(6), + called-AP-title-not-recognized(7), + called-AP-invocation-identifier-not-recognized(8), + called-AE-qualifier-not-recognized(9), + called-AE-invocation-id-not-recognized(10) + }, + + acse-service-provider[2] + INTEGER { + null(0), + no-reason-given(1), + no-common-acse-version(2) + } + } + +Association-information ::= + SEQUENCE OF + EXTERNAL + +Implementation-data ::= + GraphicString + +Release-request-reason ::= + INTEGER { + normal(0), + urgent(1), + user-defined(30) + } + +Release-response-reason ::= + INTEGER { + normal(0), + not-finished(1), + user-defined(30) + } + +END diff --git a/usr/src/contrib/isode/acsap/acsapabort1.c b/usr/src/contrib/isode/acsap/acsapabort1.c new file mode 100644 index 0000000000..cabf65b33c --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapabort1.c @@ -0,0 +1,137 @@ +/* acsapabort1.c - ACPM: user abort */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapabort1.c,v 7.2 91/02/22 09:14:02 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapabort1.c,v 7.2 91/02/22 09:14:02 mrose Interim $ + * + * + * $Log: acsapabort1.c,v $ + * Revision 7.2 91/02/22 09:14:02 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/01 21:01:49 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:44 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#include "tailor.h" + +/* A-ABORT.REQUEST */ + +int AcUAbortRequest (sd, data, ndata, aci) +int sd; +PE *data; +int ndata; +struct AcSAPindication *aci; +{ + SBV smask; + int result; + register struct assocblk *acb; + PE pe; + struct PSAPindication pis; + register struct PSAPindication *pi = &pis; + register struct PSAPabort *pa = &pi -> pi_abort; + register struct type_ACS_ABRT__apdu *pdu; + + toomuchP (data, ndata, NACDATA, "release"); + missingP (aci); + + smask = sigioblock (); + + if ((acb = findacblk (sd)) == NULL) { + (void) sigiomask (smask); + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid association descriptor"); + } + + pdu = NULL; + pe = NULLPE; + if (acb -> acb_sversion == 1) { + if ((result = PUAbortRequest (acb -> acb_fd, data, ndata, pi)) + == NOTOK) { + (void) ps2acslose (acb, aci, "PUAbortRequest", pa); + if (PC_FATAL (pa -> pa_reason)) + goto out2; + else + goto out1; + } + + result = OK; + acb -> acb_fd = NOTOK; + goto out2; + } + + if ((pdu = (struct type_ACS_ABRT__apdu *) calloc (1, sizeof *pdu)) + == NULL) { + result = acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); + goto out2; + } + pdu -> abort__source = int_ACS_abort__source_acse__service__user; + if (data + && ndata > 0 + && (pdu -> user__information = info2apdu (acb, aci, data, ndata)) + == NULL) + goto out2; + + result = encode_ACS_ABRT__apdu (&pe, 1, 0, NULLCP, pdu); + + free_ACS_ABRT__apdu (pdu); + pdu = NULL; + + if (result == NOTOK) { + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "error encoding PDU: %s", + PY_pepy); + goto out2; + } + pe -> pe_context = acb -> acb_id; + + PLOGP (acsap_log,ACS_ACSE__apdu, pe, "ABRT-apdu", 0); + + if ((result = PUAbortRequest (acb -> acb_fd, &pe, 1, pi)) == NOTOK) { + (void) ps2acslose (acb, aci, "PUAbortRequest", pa); + if (PC_FATAL (pa -> pa_reason)) + goto out2; + else + goto out1; + } + + result = OK; + acb -> acb_fd = NOTOK; + +out2: ; + freeacblk (acb); + +out1: ; + if (pe) + pe_free (pe); + if (pdu) + free_ACS_ABRT__apdu (pdu); + + (void) sigiomask (smask); + + return result; +} diff --git a/usr/src/contrib/isode/acsap/acsapabort2.c b/usr/src/contrib/isode/acsap/acsapabort2.c new file mode 100644 index 0000000000..5949d740b1 --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapabort2.c @@ -0,0 +1,157 @@ +/* acsapabort2.c - ACPM: interpret abort */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapabort2.c,v 7.2 91/02/22 09:14:03 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapabort2.c,v 7.2 91/02/22 09:14:03 mrose Interim $ + * + * + * $Log: acsapabort2.c,v $ + * Revision 7.2 91/02/22 09:14:03 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/01 21:01:51 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:45 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#ifdef DEBUG +#include "tailor.h" +#endif + +/* handle P-{U,P}-ABORT.INDICATION */ + +int AcABORTser (sd, pa, aci) +int sd; +register struct PSAPabort *pa; +register struct AcSAPindication *aci; +{ + SBV smask; + int result; + register struct assocblk *acb; + + missingP (pa); + missingP (aci); + + smask = sigioblock (); + + if ((acb = findacblk (sd)) == NULL) { + (void) sigiomask (smask); + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid association descriptor"); + } + + result = ps2acsabort (acb, pa, aci); + + (void) sigiomask (smask); + + return result; +} + +/* */ + +int ps2acsabort (acb, pa, aci) +register struct assocblk *acb; +register struct PSAPabort *pa; +register struct AcSAPindication *aci; +{ + int result; + PE pe; + register struct AcSAPabort *aca = &aci -> aci_abort; + struct type_ACS_ACSE__apdu *pdu; + register struct type_ACS_ABRT__apdu *abrt; + + result = OK; + pdu = NULL; + + if (!pa -> pa_peer) { + if (PC_FATAL (pa -> pa_reason)) + acb -> acb_fd = NOTOK; + + (void) ps2acslose (acb, aci, NULLCP, pa); + goto out; + } + + if (pa -> pa_ninfo == 0) { + (void) acsaplose (aci, ACS_ABORTED, NULLCP, NULLCP); + if (acb -> acb_sversion == 1) + aca -> aca_source = ACA_PROVIDER; + goto out; + } + + bzero ((char *) aci, sizeof *aci); + aci -> aci_type = ACI_ABORT; + + if (acb -> acb_sversion == 1) { + register int i; + + aca -> aca_reason = ACS_ABORTED; + aca -> aca_source = ACA_USER; + if ((i = pa -> pa_ninfo) > NACDATA) + i = NACDATA; + while (i-- > 0) { + aca -> aca_info[i] = pa -> pa_info[i]; + pa -> pa_info[i] = NULLPE; + } + goto out; + } + + result = decode_ACS_ACSE__apdu (pe = pa -> pa_info[0], 1, NULLIP, NULLVP, + &pdu); + +#ifdef DEBUG + if (result == OK && (acsap_log -> ll_events & LLOG_PDUS)) + pvpdu (acsap_log, print_ACS_ACSE__apdu_P, pe, "ACSE-apdu", 1); +#endif + + pe_free (pe); + pe = pa -> pa_info[0] = NULLPE; + + if (result == NOTOK) { + (void) acsaplose (aci, ACS_PROTOCOL, NULLCP, "%s", PY_pepy); + goto out; + } + + if (pdu -> offset != type_ACS_ACSE__apdu_abrt) { + result = acsaplose (aci, ACS_PROTOCOL, NULLCP, + "unexpected PDU %d on P-U-ABORT", pdu -> offset); + goto out; + } + + abrt = pdu -> un.abrt; + aca -> aca_reason = ACS_ABORTED; + aca -> aca_source = abrt -> abort__source; + (void) apdu2info (acb, aci, abrt -> user__information, aca -> aca_info, + &aca -> aca_ninfo); + +out: ; + acb -> acb_fd = NOTOK; + PAFREE (pa); + if (pdu) + free_ACS_ACSE__apdu (pdu); + + return result; +} diff --git a/usr/src/contrib/isode/acsap/acsapaddr.c b/usr/src/contrib/isode/acsap/acsapaddr.c new file mode 100644 index 0000000000..e896c471dd --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapaddr.c @@ -0,0 +1,200 @@ +/* acsapaddr.c - application entity information -- lookup */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapaddr.c,v 7.5 91/02/22 09:14:04 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapaddr.c,v 7.5 91/02/22 09:14:04 mrose Interim $ + * + * + * $Log: acsapaddr.c,v $ + * Revision 7.5 91/02/22 09:14:04 mrose + * Interim 6.8 + * + * Revision 7.4 90/12/11 10:51:54 mrose + * lock-and-load + * + * Revision 7.3 90/10/29 18:37:47 mrose + * updates + * + * Revision 7.2 90/07/27 08:41:46 mrose + * update + * + * Revision 7.1 90/07/09 14:30:27 mrose + * sync + * + * Revision 7.0 89/11/23 21:21:45 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "isoaddrs.h" +#include "tailor.h" + + +#ifndef NOSTUB +AEI str2aei_stub (); +struct PSAPaddr *aei2addr_stub (); +#endif + +AEI str2aei_dse (); +struct PSAPaddr *aei2addr_dse (); + +/* DATA */ + +#ifndef NOSTUB +static char fallback1[BUFSIZ], + fallback2[BUFSIZ]; +#endif + +static struct PSAPaddr *(*lookup) () = NULL; + +/* */ + +/* backwards compatibility... */ + +static struct mapping { + char *m_key; + char *m_value; +} sac2cn[] = { + "iso ftam", "filestore", + "iso vt", "terminal", + "iso cmip", "mib", + "isode passwd lookup demo", + "passwdstore", + "isode shell", "shell", + "IRP Z39.50", "Z39.50", + "pp qmgr interface","pp qmgr", + + NULL +}; + +/* */ + +AEI _str2aei (designator, qualifier, context, interactive, userdn, + passwd) +char *designator, + *qualifier, + *context, + *userdn, + *passwd; +int interactive; +{ + AEI aei; + register struct mapping *m; + + if (qualifier == NULLCP) { + if (context) + for (m = sac2cn; m -> m_key; m++) + if (strcmp (m -> m_key, context) == 0) { + qualifier = m -> m_value; + break; + } + + if (qualifier == NULLCP) + qualifier = context ? context: "default"; + } + + if (context == NULLCP) { + for (m = sac2cn; m -> m_key; m++) + if (strcmp (m -> m_value, qualifier) == 0) { + context = m -> m_key; + break; + } + + if (context == NULLCP) + context = qualifier; + } + + isodetailor (NULLCP, 0); + LLOG (addr_log, LLOG_TRACE, + ("str2aei \"%s\" \"%s\" \"%s\" %d", + designator, qualifier, context, interactive)); + + aei = NULL, lookup = NULL; + PY_pepy[0] = NULL; + + if (ns_enabled) { + if (aei = str2aei_dse (designator, context, interactive, userdn, + passwd)) { + lookup = aei2addr_dse; +#ifndef NOSTUB + (void) strcpy (fallback1, designator); + (void) strcpy (fallback2, qualifier); + goto out; +#endif + } + else + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("DSE lookup of service \"%s\" \"%s\" \"%s\" failed", + designator, context, qualifier)); + } + +#ifndef NOSTUB + if (aei = str2aei_stub (designator, qualifier)) + lookup = aei2addr_stub; + else + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("stub DSE lookup of service \"%s\" \"%s\" \"%s\" failed", + designator, context, qualifier)); +#endif + +#ifndef NOSTUB +out: ; +#endif + SLOG (addr_log, LLOG_TRACE, NULLCP, + ("str2aei returns %s", aei ? sprintaei (aei) : "NULLAEI")); + + return aei; +} + +/* */ + +struct PSAPaddr *aei2addr (aei) +AEI aei; +{ + struct PSAPaddr *pa; + + isodetailor (NULLCP, 0); + SLOG (addr_log, LLOG_TRACE, NULLCP, ("aei2addr %s", sprintaei (aei))); + + PY_pepy[0] = NULL; + + if (lookup) { + pa = (*lookup) (aei); +#ifndef NOSTUB + if (pa == NULLPA + && lookup == aei2addr_dse + && (aei = str2aei_stub (fallback1, fallback2)) + && (pa = aei2addr_stub (aei))) { + SLOG (addr_log, LLOG_NOTICE, NULLCP, + ("fallback use of stub DSE succeeded")); + } +#endif + + lookup = NULL; + } + else + pa = NULLPA; + + SLOG (addr_log, LLOG_TRACE, NULLCP, + ("aei2addr returns %s", paddr2str (pa, NULLNA))); + + return pa; +} diff --git a/usr/src/contrib/isode/acsap/acsapblock.c b/usr/src/contrib/isode/acsap/acsapblock.c new file mode 100644 index 0000000000..38d1ea3e6b --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapblock.c @@ -0,0 +1,133 @@ +/* acsapblock.c - manage association blocks */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapblock.c,v 7.2 91/02/22 09:14:05 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapblock.c,v 7.2 91/02/22 09:14:05 mrose Interim $ + * + * + * $Log: acsapblock.c,v $ + * Revision 7.2 91/02/22 09:14:05 mrose + * Interim 6.8 + * + * Revision 7.1 91/01/24 14:49:54 mrose + * update + * + * Revision 7.0 89/11/23 21:21:46 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "acpkt.h" + +/* DATA */ + +static int once_only = 0; +static struct assocblk assocque; +static struct assocblk *ACHead = &assocque; + +/* ASSOCIATION BLOCKS */ + +struct assocblk *newacblk () { + register struct assocblk *acb; + + acb = (struct assocblk *) calloc (1, sizeof *acb); + if (acb == NULL) + return NULL; + + acb -> acb_fd = NOTOK; + acb -> acb_actno = 1; + + if (once_only == 0) { + ACHead -> acb_forw = ACHead -> acb_back = ACHead; + once_only++; + } + + insque (acb, ACHead -> acb_back); + + return acb; +} + +/* */ + +freeacblk (acb) +register struct assocblk *acb; +{ + if (acb == NULL) + return; + + if (acb -> acb_flags & ACB_STICKY) { + acb -> acb_flags &= ~ACB_STICKY; + return; + } + + if (acb -> acb_fd != NOTOK && acb -> acb_uabort) + if (acb -> acb_flags & ACB_ACS) { + if (acb -> acb_flags & ACB_RTS) {/* recurse */ + struct AcSAPindication acis; + + (void) (*acb -> acb_uabort) (acb -> acb_fd, NULLPEP, 0, &acis); + return; + } + else { + struct PSAPindication pis; + + (void) (*acb -> acb_uabort) (acb -> acb_fd, NULLPEP, 0, &pis); + } + } + else { + struct SSAPindication sis; + + (void) (*acb -> acb_uabort) (acb -> acb_fd, NULLCP, 0, &sis); + } + + if (acb -> acb_flags & ACB_FINISH) + ACFFREE (&acb -> acb_finish); + + if (acb -> acb_context) + oid_free (acb -> acb_context); + if (acb -> acb_retry) + pe_free (acb -> acb_retry); + + FREEACB (acb); + + if (acb -> acb_apdu) + pe_free (acb -> acb_apdu); + + remque (acb); + + free ((char *) acb); +} + +/* */ + +struct assocblk *findacblk (sd) +register int sd; +{ + register struct assocblk *acb; + + if (once_only == 0) + return NULL; + + for (acb = ACHead -> acb_forw; acb != ACHead; acb = acb -> acb_forw) + if (acb -> acb_fd == sd) + return acb; + + return NULL; +} diff --git a/usr/src/contrib/isode/acsap/acsapdse.c b/usr/src/contrib/isode/acsap/acsapdse.c new file mode 100644 index 0000000000..7fc2a15826 --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapdse.c @@ -0,0 +1,124 @@ +/* acsapdse.c - application entity info -- directory service interface */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapdse.c,v 7.4 91/02/22 09:14:06 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapdse.c,v 7.4 91/02/22 09:14:06 mrose Interim $ + * + * + * $Log: acsapdse.c,v $ + * Revision 7.4 91/02/22 09:14:06 mrose + * Interim 6.8 + * + * Revision 7.3 90/12/11 10:51:56 mrose + * lock-and-load + * + * Revision 7.2 90/07/09 14:30:29 mrose + * sync + * + * Revision 7.1 90/07/01 21:01:53 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:47 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "DSE-types.h" +#include "psap.h" +#include "isoaddrs.h" +#include "tailor.h" + +/* DATA */ + +static AEInfo aeis; +static struct PSAPaddr pas; + +extern PE name2value_dase (); + +PE (*acsap_lookup) () = name2value_dase; + +/* */ + +AEI str2aei_dse (string, context, ontty, userdn, passwd) +char *string, + *context, + *userdn, + *passwd; +int ontty; +{ + char *alias, + name[BUFSIZ]; + PE pe; + register AEI aei = &aeis; + register struct PSAPaddr *pa = &pas; + static int first_time = 1; + + if (first_time) + first_time = 0; + else { + AEIFREE (aei); + } + bzero ((char *) aei, sizeof *aei); + + if ((alias = alias2name (string)) == NULL) + alias = string; + (void) strcpy (name, alias); + + if (acsap_lookup == NULL) { + PY_advise (NULLCP, "str2aei_dse: acsap_lookup function not set"); + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy)); + return NULLAEI; + } + + bzero ((char *) pa, sizeof *pa); + if (pe = (*acsap_lookup) (name, context, ontty, userdn, passwd, + &aei -> aei_ap_title)) { + if (parse_DSE_PSAPaddr (pe, 1, NULLIP, NULLVP, (char *) pa) == NOTOK) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("parse of presentationAddress failed: %s", PY_pepy)); + } + else + PLOG (addr_log, print_DSE_PSAPaddr, pe, "address", 1); + + pe_free (pe); + } + else + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("directory returns no value")); + + return (aei -> aei_ap_title ? aei : NULLAEI); +} + +/* */ + +struct PSAPaddr *aei2addr_dse (aei) +AEI aei; +{ + register struct PSAPaddr *pa; + + if (aei != &aeis) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("aei2addr_dse cache miss on %s", sprintaei (aei))); + + return NULLPA; + } + + return ((pa = &pas) -> pa_addr.sa_addr.ta_naddr > 0 ? pa : NULLPA); +} diff --git a/usr/src/contrib/isode/acsap/acsaperror.c b/usr/src/contrib/isode/acsap/acsaperror.c new file mode 100644 index 0000000000..af1ad53629 --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsaperror.c @@ -0,0 +1,84 @@ +/* acsaperror.c - return AcSAP error code in string form */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsaperror.c,v 7.2 91/02/22 09:14:07 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsaperror.c,v 7.2 91/02/22 09:14:07 mrose Interim $ + * + * + * $Log: acsaperror.c,v $ + * Revision 7.2 91/02/22 09:14:07 mrose + * Interim 6.8 + * + * Revision 7.1 91/01/11 07:09:04 mrose + * jpo + * + * Revision 7.0 89/11/23 21:21:48 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "acsap.h" + +/* */ + +static char *reject_err0[] = { + "Accepted", + "Permanent", + "Transient", + "Rejected by service-user: null", + "Rejected by service-user: no reason given", + "Application context name not supported", + "Calling AP title not recognized", + "Calling AP invocation-ID not recognized", + "Calling AE qualifier not recognized", + "Calling AE invocation-ID not recognized", + "Called AP title not recognized", + "Called AP invocation-ID not recognized", + "Called AE qualifier not recognized", + "Called AE invocation-ID not recognized", + "Rejected by service-provider: null", + "Rejected by service-provider: no reason given", + "No common acse version", + "Address unknown", + "Connect request refused on this network connection", + "Local limit exceeded", + "Presentation disconnect", + "Protocol error", + "Peer aborted association", + "Invalid parameter", + "Invalid operation", + "Timer expired" +}; + +static int reject_err0_cnt = sizeof reject_err0 / sizeof reject_err0[0]; + +/* */ + +char *AcErrString (code) +register int code; +{ + static char buffer[50]; + + if (code < reject_err0_cnt) + return reject_err0[code]; + + (void) sprintf (buffer, "unknown error code %d", code); + return buffer; +} diff --git a/usr/src/contrib/isode/acsap/acsapfindpci.c b/usr/src/contrib/isode/acsap/acsapfindpci.c new file mode 100644 index 0000000000..a80e5b8bfc --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapfindpci.c @@ -0,0 +1,64 @@ +/* acsapfindpci.c - find PCI for ACSE */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapfindpci.c,v 7.1 91/02/22 09:14:08 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapfindpci.c,v 7.1 91/02/22 09:14:08 mrose Interim $ + * + * + * $Log: acsapfindpci.c,v $ + * Revision 7.1 91/02/22 09:14:08 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:21:49 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#define ACSE +#include "acpkt.h" + +/* */ + +int AcFindPCI (sd, pci, aci) +int sd; +int *pci; +struct AcSAPindication *aci; +{ + SBV smask; + register struct assocblk *acb; + + missingP (pci); + missingP (aci); + + smask = sigioblock (); + + if ((acb = findacblk (sd)) == NULL) { + (void) sigiomask (smask); + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid association descriptor"); + } + + *pci = acb -> acb_id; + + (void) sigiomask (smask); + + return OK; +} diff --git a/usr/src/contrib/isode/acsap/acsapinitiat.c b/usr/src/contrib/isode/acsap/acsapinitiat.c new file mode 100644 index 0000000000..b42720f4c3 --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapinitiat.c @@ -0,0 +1,612 @@ +/* acsapinitiat.c - ACPM: initiator */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapinitiat.c,v 7.4 91/02/22 09:14:09 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapinitiat.c,v 7.4 91/02/22 09:14:09 mrose Interim $ + * + * + * $Log: acsapinitiat.c,v $ + * Revision 7.4 91/02/22 09:14:09 mrose + * Interim 6.8 + * + * Revision 7.3 90/08/18 00:48:49 mrose + * touch-up + * + * Revision 7.2 90/07/09 14:30:32 mrose + * sync + * + * Revision 7.1 90/07/01 21:01:55 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:50 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#include "isoservent.h" +#include "tailor.h" + +/* A-(ASYN-)ASSOCIATE.REQUEST */ + +int AcAsynAssocRequest (context, callingtitle, calledtitle, callingaddr, + calledaddr, ctxlist, defctxname, prequirements, srequirements, isn, + settings, ref, data, ndata, qos, acc, aci, async) +OID context; +AEI callingtitle, + calledtitle; +struct PSAPaddr *callingaddr, + *calledaddr; +int prequirements, + srequirements, + settings, + ndata, + async; +long isn; +struct PSAPctxlist *ctxlist; +OID defctxname; +struct SSAPref *ref; +PE *data; +struct QOStype *qos; +struct AcSAPconnect *acc; +struct AcSAPindication *aci; +{ + SBV smask; + int result; + + isodetailor (NULLCP, 0); + + missingP (context); +#ifdef notdef + missingP (callingtitle); + missingP (calledtitle); +#endif + +/* let presentation provider catch errors in presentation parameters */ +/* except this one... */ + missingP (ctxlist); + + toomuchP (data, ndata, NACDATA, "initial"); + if (data) { /* XXX: probably should have a more intensive check... */ + register int i; + register PE *pep; + + for (pep = data, i = ndata; i > 0; pep++, i--) + if ((*pep) -> pe_context == PE_DFLT_CTX) + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "default context not allowed for user-data at slot %d", + pep - data); + } + missingP (acc); + missingP (aci); + + smask = sigioblock (); + + result = AcAssocRequestAux (context, callingtitle, calledtitle, + callingaddr, calledaddr, ctxlist, defctxname, prequirements, + srequirements, isn, settings, ref, data, ndata, qos, acc, aci, + async); + + (void) sigiomask (smask); + + return result; +} + +/* */ + +static int AcAssocRequestAux (context, callingtitle, calledtitle, callingaddr, + calledaddr, ctxlist, defctxname, prequirements, srequirements, isn, + settings, ref, data, ndata, qos, acc, aci, async) +OID context; +AEI callingtitle, + calledtitle; +struct PSAPaddr *callingaddr, + *calledaddr; +int prequirements, + srequirements, + settings, + ndata, + async; +long isn; +struct PSAPctxlist *ctxlist; +OID defctxname; +struct SSAPref *ref; +PE *data; +struct QOStype *qos; +struct AcSAPconnect *acc; +struct AcSAPindication *aci; +{ + register int i; + int result; + PE pe; + register struct assocblk *acb; + register struct PSAPcontext *pp; + register struct PSAPconnect *pc = &acc -> acc_connect; + struct PSAPindication pis; + register struct PSAPindication *pi = &pis; + register struct PSAPabort *pa = &pi -> pi_abort; + register struct type_ACS_AARQ__apdu *pdu; + + if ((acb = newacblk ()) == NULL) + return acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); + + pe = NULLPE; + if ((pdu = (struct type_ACS_AARQ__apdu *) calloc (1, sizeof *pdu)) + == NULL) { +no_mem: ; + result = acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); + goto out; + } + pdu -> application__context__name = context; + if (calledtitle) { + pdu -> called__AP__title = calledtitle -> aei_ap_title; + pdu -> called__AE__qualifier = calledtitle -> aei_ae_qualifier; + if (calledtitle -> aei_flags & AEI_AP_ID) + pdu -> called__AP__invocation__id = + (struct type_ACS_AP__invocation__id *) + &calledtitle -> aei_ap_id; + if (calledtitle -> aei_flags & AEI_AE_ID) + pdu -> called__AE__invocation__id = + (struct type_ACS_AE__invocation__id *) + &calledtitle -> aei_ae_id; + } + if (callingtitle) { + pdu -> calling__AP__title = callingtitle -> aei_ap_title; + pdu -> calling__AE__qualifier = callingtitle -> aei_ae_qualifier; + if (callingtitle -> aei_flags & AEI_AP_ID) + pdu -> calling__AP__invocation__id = + (struct type_ACS_AP__invocation__id *) + &callingtitle -> aei_ap_id; + if (callingtitle -> aei_flags & AEI_AE_ID) + pdu -> calling__AE__invocation__id = + (struct type_ACS_AE__invocation__id *) + &callingtitle -> aei_ae_id; + } + if (data + && ndata > 0 + && (pdu -> user__information = info2apdu (acb, aci, data, ndata)) + == NULL) + goto out; + + result = encode_ACS_AARQ__apdu (&pe, 1, 0, NULLCP, pdu); + + if (pdu -> user__information) + free_ACS_Association__information (pdu -> user__information); + free ((char *) pdu); + pdu = NULL; + + if (result == NOTOK) { + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "error encoding PDU: %s", + PY_pepy); + goto out; + } + + if (ctxlist -> pc_nctx >= NPCTX) { + result = acsaplose (aci, ACS_PARAMETER, NULLCP, + "too many contexts"); + goto out; + } + + { + register int ctx; + register OID oid; + + if ((oid = ode2oid (AC_ASN)) == NULLOID) { + result = acsaplose (aci, ACS_PARAMETER, NULLCP, + "%s: unknown", AC_ASN); + goto out; + } + + for (pp = ctxlist -> pc_ctx, i = ctxlist -> pc_nctx - 1; + i >= 0; + pp++, i--) + if (oid_cmp (pp -> pc_asn, oid)) { + if (acb -> acb_rosid == PE_DFLT_CTX) + acb -> acb_rosid = pp -> pc_id; + break; + } + + ctx = 1; + for (pp = ctxlist -> pc_ctx, i = ctxlist -> pc_nctx - 1; + i >= 0; + i--, pp++) { + if (oid_cmp (pp -> pc_asn, oid) == 0) { + acb -> acb_id = pp -> pc_id; + acb -> acb_offset = pp - ctxlist -> pc_ctx; + + pp = NULL; + goto ready; + } + + if (ctx <= pp -> pc_id) + ctx = pp -> pc_id + 2; + } + pp -> pc_id = ctx; + if ((pp -> pc_asn = oid_cpy (oid)) == NULLOID) + goto no_mem; + if (pp -> pc_atn = ode2oid (BER)) + pp -> pc_atn = oid_cpy (pp -> pc_atn); + + acb -> acb_id = pp -> pc_id; + acb -> acb_offset = -1; + + ctxlist -> pc_nctx++; + } +ready: ; + pe -> pe_context = acb -> acb_id; + + PLOGP (acsap_log,ACS_ACSE__apdu, pe, "AARQ-apdu", 0); + + bzero ((char *) acc, sizeof *acc); + + result = PAsynConnRequest (callingaddr, calledaddr, + ctxlist, defctxname, prequirements, srequirements, isn, + settings, ref, &pe, 1, qos, pc, pi, async); + + if (pp) { + oid_free (pp -> pc_asn); + if (pp -> pc_atn) + oid_free (pp -> pc_atn); + pp -> pc_asn = pp -> pc_atn = NULLOID; + ctxlist -> pc_nctx--; + } + + pe_free (pe); + pe = NULLPE; + + if (result == NOTOK) { + (void) ps2acslose (NULLACB, aci, "PAsynConnRequest", pa); + goto out; + } + + acb -> acb_fd = pc -> pc_sd; + acb -> acb_flags |= ACB_ACS; + acb -> acb_uabort = PUAbortRequest; + + if (async) { + switch (result) { + case CONNECTING_1: + case CONNECTING_2: + acc -> acc_sd = acb -> acb_fd; + return result; + } + } + if ((result = AcAsynRetryAux (acb, pc, pi, acc, aci)) == DONE && !async) + result = OK; + return result; + +out: ; + if (pdu) { + if (pdu -> user__information) + free_ACS_Association__information (pdu -> user__information); + free ((char *) pdu); + } + if (pe) + pe_free (pe); + + freeacblk (acb); + + return result; +} + +/* A-ASYN-RETRY.REQUEST (pseudo) */ + +int AcAsynRetryRequest (sd, acc, aci) +int sd; +struct AcSAPconnect *acc; +struct AcSAPindication *aci; +{ + SBV smask; + int result; + register struct assocblk *acb; + register struct PSAPconnect *pc; + struct PSAPindication pis; + register struct PSAPindication *pi = &pis; + register struct PSAPabort *pa = &pi -> pi_abort; + + missingP (acc); + missingP (aci); + + smask = sigioblock (); + + 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, + "association descriptor connected"); + } + + pc = &acc -> acc_connect; + bzero ((char *) acc, sizeof *acc); + + switch (result = PAsynRetryRequest (acb -> acb_fd, pc, pi)) { + case NOTOK: + acb -> acb_fd = NOTOK; + (void) ps2acslose (acb, aci, "PAsynRetryRequest", pa); + freeacblk (acb); + break; + + case CONNECTING_1: + case CONNECTING_2: + break; + + case DONE: + result = AcAsynRetryAux (acb, pc, pi, acc, aci); + break; + } + + (void) sigiomask (smask); + + return result; +} + +/* */ + +static int AcAsynRetryAux (acb, pc, pi, acc, aci) +register struct assocblk *acb; +struct PSAPconnect *pc; +struct PSAPindication *pi; +struct AcSAPconnect *acc; +struct AcSAPindication *aci; +{ + register int i; + int result; + PE pe; + register struct PSAPcontext *pp; + register struct PSAPabort *pa = &pi -> pi_abort; + struct type_ACS_ACSE__apdu *pdu; + register struct type_ACS_AARE__apdu *aare; + + if (pc -> pc_result == PC_ABORTED) { + (void) ps2acsabort (acb, pa, aci); + + acc -> acc_sd = NOTOK; + acc -> acc_result = ACS_ABORTED; + + return DONE; + } + + pe = NULLPE; + pdu = NULL; + + if (pc -> pc_ninfo < 1) { + if (pc -> pc_result != PC_ACCEPT) { + bzero ((char *) pa, sizeof *pa); + pa -> pa_reason = pc -> pc_result; + acb -> acb_fd = NOTOK; + (void) ps2acslose (acb, aci, "PAsynConnRequest(pseudo)", pa); + + acc -> acc_sd = NOTOK; + acc -> acc_result = aci -> aci_abort.aca_reason; + + result = DONE; + } + else + result = acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, NULLCP); + goto out; + } + + acb -> acb_fd = pc -> pc_sd; + acb -> acb_sversion = pc -> pc_qos.qos_sversion; + + result = decode_ACS_ACSE__apdu (pe = pc -> pc_info[0], 1, NULLIP, NULLVP, + &pdu); + +#ifdef DEBUG + if (result == OK && (acsap_log -> ll_events & LLOG_PDUS)) + pvpdu (acsap_log, print_ACS_ACSE__apdu_P, pe, "ACSE-apdu", 1); +#endif + + pe_free (pe); + pe = pc -> pc_info[0] = NULLPE; + + if (result == NOTOK) { + (void) acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, "%s", PY_pepy); + goto out; + } + + if (pdu -> offset != type_ACS_ACSE__apdu_aare) { + result = acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, + "unexpected PDU %d on P-CONNECT", pdu -> offset); + goto out; + } + + aare = pdu -> un.aare; + switch (aare -> result) { + case int_ACS_result_accepted: + if (pc -> pc_result != PC_ACCEPT) { + result = acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, + "not accepted [%s]", + PErrString (pc -> pc_result)); + goto out; + } + + acb -> acb_flags |= ACB_CONN; + + acc -> acc_sd = acb -> acb_fd; + acc -> acc_result = ACS_ACCEPT; + + if ((i = acb -> acb_offset) < 0) + i = pc -> pc_ctxlist.pc_nctx - 1; + pp = pc -> pc_ctxlist.pc_ctx + i; + if (pp -> pc_id != acb -> acb_id) { + result = acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, + "ACSE PCI not found"); + goto out; + } + if (pp -> pc_result != PC_ACCEPT) { + result = acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, + "ACSE PCI rejected"); + goto out; + } + + if (acb -> acb_offset < 0) + pc -> pc_ctxlist.pc_nctx--; + + for (pp = pc -> pc_ctxlist.pc_ctx; i >= 0; i--, pp++) + if (pp -> pc_id != acb -> acb_id + && pp -> pc_result == PC_ACCEPT) { + acb -> acb_rosid = pp -> pc_id; + break; + } + break; + + case int_ACS_result_rejected__permanent: + acc -> acc_result = ACS_PERMANENT; + goto rejected; + + case int_ACS_result_rejected__transient: + acc -> acc_result = ACS_TRANSIENT; +rejected: ; + if (pc -> pc_result != PC_ACCEPT) + acb -> acb_fd = NOTOK; + acc -> acc_sd = NOTOK; + if (acb -> acb_offset < 0 + && (i = pc -> pc_ctxlist.pc_nctx - 1) >= 0) + pc -> pc_ctxlist.pc_nctx = i; + break; + } + + switch (aare -> result__source__diagnostic -> offset) { + case type_ACS_Associate__source__diagnostic_acse__service__user: + acc -> acc_diagnostic = + aare -> result__source__diagnostic -> un.acse__service__user + + ACS_USER_BASE; + break; + + case type_ACS_Associate__source__diagnostic_acse__service__provider: + default: + acc -> acc_diagnostic = + aare -> result__source__diagnostic -> un.acse__service__provider + + ACS_PROV_BASE; + break; + } + + if ((result = apdu2info (acb, aci, aare -> user__information, + acc -> acc_info, &acc -> acc_ninfo)) == NOTOK) + goto out; + + acc -> acc_context = aare -> application__context__name; + aare -> application__context__name = NULLOID; + acc -> acc_respondtitle.aei_ap_title = aare -> responding__AP__title; + aare -> responding__AP__title = NULLPE; + acc -> acc_respondtitle.aei_ae_qualifier = + aare -> responding__AE__qualifier; + aare -> responding__AE__qualifier = NULLPE; + if (aare -> responding__AP__invocation__id) { + acc -> acc_respondtitle.aei_ap_id = + aare -> responding__AP__invocation__id -> parm; + acc -> acc_respondtitle.aei_flags |= AEI_AP_ID; + } + if (aare -> responding__AE__invocation__id) { + acc -> acc_respondtitle.aei_ae_id = + aare -> responding__AE__invocation__id -> parm; + acc -> acc_respondtitle.aei_flags |= AEI_AE_ID; + } + + for (i = pc -> pc_ninfo - 1; i >= 0; i--) + if (pc -> pc_info[i]) { + pe_free (pc -> pc_info[i]); + pc -> pc_info[i] = NULL; + } + pc -> pc_ninfo = 0; + + free_ACS_ACSE__apdu (pdu); + + if (pc -> pc_result != PC_ACCEPT) + freeacblk (acb); + + return DONE; + +out: ; + if (pc -> pc_ninfo > 0 && pe == pc -> pc_info[0]) + pe = NULLPE; + PCFREE (pc); + if (pe) + pe_free (pe); + if (pdu) + free_ACS_ACSE__apdu (pdu); + + freeacblk (acb); + + return result; +} + +/* A-ASYN-NEXT.REQUEST (pseudo) */ + +int AcAsynNextRequest (sd, acc, aci) +int sd; +struct AcSAPconnect *acc; +struct AcSAPindication *aci; +{ + SBV smask; + int result; + register struct assocblk *acb; + register struct PSAPconnect *pc; + struct PSAPindication pis; + register struct PSAPindication *pi = &pis; + register struct PSAPabort *pa = &pi -> pi_abort; + + missingP (acc); + missingP (aci); + + smask = sigioblock (); + + 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, + "association descriptor connected"); + } + + pc = &acc -> acc_connect; + bzero ((char *) acc, sizeof *acc); + + switch (result = PAsynNextRequest (acb -> acb_fd, pc, pi)) { + case NOTOK: + acb -> acb_fd = NOTOK; + (void) ps2acslose (acb, aci, "PAsynRetryRequest", pa); + freeacblk (acb); + break; + + case CONNECTING_1: + case CONNECTING_2: + break; + + case DONE: + result = AcAsynRetryAux (acb, pc, pi, acc, aci); + break; + } + + (void) sigiomask (smask); + + return result; +} diff --git a/usr/src/contrib/isode/acsap/acsaplose.c b/usr/src/contrib/isode/acsap/acsaplose.c new file mode 100644 index 0000000000..1bfe5bd29c --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsaplose.c @@ -0,0 +1,172 @@ +/* acsaplose.c - ACPM: you lose */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsaplose.c,v 7.2 91/02/22 09:14:11 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsaplose.c,v 7.2 91/02/22 09:14:11 mrose Interim $ + * + * + * $Log: acsaplose.c,v $ + * Revision 7.2 91/02/22 09:14:11 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/01 21:01:58 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:52 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#include "tailor.h" + +/* */ + +#ifndef lint +int acpktlose (va_alist) +va_dcl +{ + int reason, + result; + PE pe; + register struct assocblk *acb; + register struct AcSAPindication *aci; + struct PSAPindication pis; + struct type_ACS_ABRT__apdu pdus; + register struct type_ACS_ABRT__apdu *pdu = &pdus; + va_list ap; + + va_start (ap); + + acb = va_arg (ap, struct assocblk *); + aci = va_arg (ap, struct AcSAPindication *); + reason = va_arg (ap, int); + + result = _acsaplose (aci, reason, ap); + + va_end (ap); + + if (acb == NULLACB || acb -> acb_fd == NOTOK) + return result; + + if (acb -> acb_sversion == 1) { + if (PUAbortRequest (acb -> acb_fd, NULLPEP, 0, &pis) != NOTOK) + acb -> acb_fd = NOTOK; + + return result; + } + + pdu -> abort__source = int_ACS_abort__source_acse__service__provider; + pdu -> user__information = NULL; + + pe = NULLPE; + if (encode_ACS_ABRT__apdu (&pe, 1, 0, NULLCP, pdu) != NOTOK) { + pe -> pe_context = acb -> acb_id; + + PLOGP (acsap_log,ACS_ACSE__apdu, pe, "ABRT-apdu", 0); + + if (PUAbortRequest (acb -> acb_fd, &pe, 1, &pis) != NOTOK) + acb -> acb_fd = NOTOK; + } + if (pe) + pe_free (pe); + + return result; +} +#else +/* VARARGS5 */ + +int acpktlose (acb, aci, reason, what, fmt) +struct assocblk *acb; +struct AcSAPindication *aci; +int reason; +char *what, + *fmt; +{ + return acpktlose (acb, aci, reason, what, fmt); +} +#endif + +/* */ + +#ifndef lint +int acsaplose (va_alist) +va_dcl +{ + int reason, + result; + struct AcSAPindication *aci; + va_list ap; + + va_start (ap); + + aci = va_arg (ap, struct AcSAPindication *); + reason = va_arg (ap, int); + + result = _acsaplose (aci, reason, ap); + + va_end (ap); + + return result; +} +#else +/* VARARGS4 */ + +int acsaplose (aci, reason, what, fmt) +struct AcSAPindication *aci; +int reason; +char *what, + *fmt; +{ + return acsaplose (aci, reason, what, fmt); +} +#endif + +/* */ + +#ifndef lint +static int _acsaplose (aci, reason, ap) /* what, fmt, args ... */ +register struct AcSAPindication *aci; +int reason; +va_list ap; +{ + register char *bp; + char buffer[BUFSIZ]; + register struct AcSAPabort *aca; + + if (aci) { + bzero ((char *) aci, sizeof *aci); + aci -> aci_type = ACI_ABORT; + aca = &aci -> aci_abort; + + asprintf (bp = buffer, ap); + bp += strlen (bp); + + aca -> aca_source = ACA_LOCAL; + aca -> aca_reason = reason; + copyAcSAPdata (buffer, bp - buffer, aca); + } + + return NOTOK; +} +#endif diff --git a/usr/src/contrib/isode/acsap/acsapreleas1.c b/usr/src/contrib/isode/acsap/acsapreleas1.c new file mode 100644 index 0000000000..dfc9734fb4 --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapreleas1.c @@ -0,0 +1,272 @@ +/* acsapreleas1.c - ACPM: initiate release */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapreleas1.c,v 7.2 91/02/22 09:14:12 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapreleas1.c,v 7.2 91/02/22 09:14:12 mrose Interim $ + * + * + * $Log: acsapreleas1.c,v $ + * Revision 7.2 91/02/22 09:14:12 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/01 21:02:02 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:54 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#include "tailor.h" + +/* A-RELEASE.REQUEST */ + +int AcRelRequest (sd, reason, data, ndata, secs, acr, aci) +int sd; +int reason; +PE *data; +int ndata; +int secs; +struct AcSAPrelease *acr; +struct AcSAPindication *aci; +{ + SBV smask; + int result; + register struct assocblk *acb; + register struct type_ACS_RLRQ__apdu *rlrq; + + switch (reason) { + case ACF_NORMAL: + case ACF_URGENT: + case ACF_USERDEFINED: + break; + + default: + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid value for reason parameter"); + } + toomuchP (data, ndata, NACDATA, "release"); + if (data) { /* XXX: probably should have a more intensive check... */ + register int i; + register PE *pep; + + for (pep = data, i = ndata; i > 0; pep++, i--) + if ((*pep) -> pe_context == PE_DFLT_CTX) + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "default context not allowed for user-data at slot %d", + pep - data); + } + missingP (acr); + missingP (aci); + + smask = sigioblock (); + + acsapPsig (acb, sd); + + if ((rlrq = (struct type_ACS_RLRQ__apdu *) calloc (1, sizeof *rlrq)) + == NULL) { + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); + goto out2; + } + rlrq -> optionals |= opt_ACS_RLRQ__apdu_reason; + rlrq -> reason = reason; + if (data + && ndata > 0 + && (rlrq -> user__information = info2apdu (acb, aci, data, ndata)) + == NULL) + goto out2; + + result = encode_ACS_RLRQ__apdu (&acb -> acb_retry, 1, 0, NULLCP, rlrq); + + free_ACS_RLRQ__apdu (rlrq); + rlrq = NULL; + + if (result == NOTOK) { + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "error encoding PDU: %s", + PY_pepy); + goto out2; + } + acb -> acb_retry -> pe_context = acb -> acb_id; + + PLOGP (acsap_log,ACS_ACSE__apdu, acb -> acb_retry, "RLRQ-apdu", 0); + + result = AcRelRetryRequestAux (acb, secs, acr, aci); + goto out1; + +out2: ; + if (acb -> acb_retry) { + pe_free (acb -> acb_retry); + acb -> acb_retry = NULLPE; + } + freeacblk (acb); + if (rlrq) + free_ACS_RLRQ__apdu (rlrq); + result = NOTOK; + +out1: ; + (void) sigiomask (smask); + + return result; +} + +/* A-RELEASE-RETRY.REQUEST (pseudo) */ + +int AcRelRetryRequest (sd, secs, acr, aci) +int sd; +int secs; +struct AcSAPrelease *acr; +struct AcSAPindication *aci; +{ + SBV smask; + int result; + register struct assocblk *acb; + + missingP (acr); + missingP (aci); + + smask = sigioblock (); + + if ((acb = findacblk (sd)) == NULL) + result = acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid association descriptor"); + else + if (!(acb -> acb_flags & ACB_RELEASE)) + result = acsaplose (aci, ACS_OPERATION, "release not in progress"); + else + result = AcRelRetryRequestAux (acb, secs, acr, aci); + + (void) sigiomask (smask); + + return result; +} + +/* */ + +static int AcRelRetryRequestAux (acb, secs, acr, aci) +register struct assocblk *acb; +int secs; +struct AcSAPrelease *acr; +struct AcSAPindication *aci; +{ + int result; + char *id = acb -> acb_flags & ACB_RELEASE ? "PRelRetryRequest" + : "PRelRequest"; + PE pe; + struct PSAPrelease prs; + register struct PSAPrelease *pr = &prs; + struct PSAPindication pis; + register struct PSAPabort *pa = &pis.pi_abort; + struct type_ACS_ACSE__apdu *pdu = NULL; + register struct type_ACS_RLRE__apdu *rlre; + + bzero ((char *) pr, sizeof *pr); + + if ((result = (acb -> acb_flags & ACB_RELEASE) + ? PRelRetryRequest (acb -> acb_fd, secs, pr, &pis) + : PRelRequest (acb -> acb_fd, &acb -> acb_retry, 1, + secs, pr, &pis)) == NOTOK) { + if (pa -> pa_reason == PC_TIMER) { + acb -> acb_flags |= ACB_RELEASE; + + return ps2acslose (NULLACB, aci, id, pa); + } + + if (pa -> pa_peer) { + (void) AcABORTser (acb -> acb_fd, pa, aci); + goto out1; + } + if (PC_FATAL (pa -> pa_reason)) { + (void) ps2acslose (acb, aci, id, pa); + goto out2; + } + else { + (void) ps2acslose (NULLACB, aci, id, pa); + goto out1; + } + } + + bzero ((char *) acr, sizeof *acr); + + if (pr -> pr_ninfo == 0) { + result = acsaplose (aci, ACS_PROTOCOL, NULLCP, + "no user-data on P-RELEASE"); + goto out3; + } + + result = decode_ACS_ACSE__apdu (pe = pr -> pr_info[0], 1, NULLIP, NULLVP, + &pdu); + +#ifdef DEBUG + if (result == OK && (acsap_log -> ll_events & LLOG_PDUS)) + pvpdu (acsap_log, print_ACS_ACSE__apdu_P, pe, "ACSE-apdu", 1); +#endif + + pe_free (pe); + pe = pr -> pr_info[0] = NULLPE; + + if (result == NOTOK) { + (void) acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, "%s", PY_pepy); + goto out3; + } + + if (pdu -> offset != type_ACS_ACSE__apdu_rlre) { + (void) acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, + "unexpected PDU %d on P-RELEASE", pdu -> offset); + goto out3; + } + + rlre = pdu -> un.rlre; + if (rlre -> optionals & opt_ACS_RLRE__apdu_reason) + acr -> acr_reason = rlre -> reason; + else + acr -> acr_reason = int_ACS_reason_normal; + if (apdu2info (acb, aci, rlre -> user__information, acr -> acr_info, + &acr -> acr_ninfo) == NOTOK) + goto out3; + + if (acr -> acr_affirmative = pr -> pr_affirmative) { + acb -> acb_fd = NOTOK; + result = OK; + } + else + result = DONE; + +out3: ; + PRFREE (pr); + +out2: ; + if (result == DONE) + result = OK; + else + freeacblk (acb), acb = NULLACB; +out1: ; + if (acb && acb -> acb_retry) { + pe_free (acb -> acb_retry); + acb -> acb_retry = NULLPE; + } + if (pdu) + free_ACS_ACSE__apdu (pdu); + + return result; +} diff --git a/usr/src/contrib/isode/acsap/acsapreleas2.c b/usr/src/contrib/isode/acsap/acsapreleas2.c new file mode 100644 index 0000000000..3323dedb4e --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapreleas2.c @@ -0,0 +1,157 @@ +/* acsapreleas2.c - ACPM: respond to release */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapreleas2.c,v 7.2 91/02/22 09:14:13 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapreleas2.c,v 7.2 91/02/22 09:14:13 mrose Interim $ + * + * + * $Log: acsapreleas2.c,v $ + * Revision 7.2 91/02/22 09:14:13 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/01 21:02:04 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:55 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#include "tailor.h" + +/* A-RELEASE.RESPONSE */ + +int AcRelResponse (sd, status, reason, data, ndata, aci) +int sd; +int status, + reason; +PE *data; +int ndata; +struct AcSAPindication *aci; +{ + SBV smask; + int code, + result; + register struct assocblk *acb; + PE pe; + struct PSAPindication pis; + register struct PSAPabort *pa = &pis.pi_abort; + register struct type_ACS_RLRE__apdu *pdu; + + switch (status) { + case ACS_ACCEPT: + code = SC_ACCEPT; + break; + + case ACS_REJECT: + code = SC_REJECTED; + break; + + default: + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid value for status parameter"); + } + switch (reason) { + case ACR_NORMAL: + case ACR_NOTFINISHED: + case ACR_USERDEFINED: + break; + + default: + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid value for reason parameter"); + } + toomuchP (data, ndata, NACDATA, "release"); + if (data) { /* XXX: probably should have a more intensive check... */ + register int i; + register PE *pep; + + for (pep = data, i = ndata; i > 0; pep++, i--) + if ((*pep) -> pe_context == PE_DFLT_CTX) + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "default context not allowed for user-data at slot %d", + pep - data); + } + missingP (aci); + + smask = sigioblock (); + + acsapFsig (acb, sd); + + pe = NULLPE; + if ((pdu = (struct type_ACS_RLRE__apdu *) calloc (1, sizeof *pdu)) + == NULL) { + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); + goto out2; + } + pdu -> optionals |= opt_ACS_RLRE__apdu_reason; + pdu -> reason = reason; + if (data + && ndata > 0 + && (pdu -> user__information = info2apdu (acb, aci, data, ndata)) + == NULL) + goto out2; + + result = encode_ACS_RLRE__apdu (&pe, 1, 0, NULLCP, pdu); + + free_ACS_RLRE__apdu (pdu); + pdu = NULL; + + if (result == NOTOK) { + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "error encoding PDU: %s", + PY_pepy); + goto out2; + } + pe -> pe_context = acb -> acb_id; + + PLOGP (acsap_log,ACS_ACSE__apdu, pe, "RLRE-apdu", 0); + + if ((result = PRelResponse (acb -> acb_fd, code, &pe, 1, &pis)) == NOTOK) { + (void) ps2acslose (acb, aci, "PRelResponse", pa); + if (PC_FATAL (pa -> pa_reason)) + goto out2; + else + goto out1; + } + + if (status == ACS_ACCEPT) + acb -> acb_fd = NOTOK; + else + acb -> acb_flags &= ~ACB_FINN; + + result = OK; + +out2: ; + if (result == NOTOK || status == ACS_ACCEPT) + freeacblk (acb); +out1: ; + if (pe) + pe_free (pe); + if (pdu) + free_ACS_RLRE__apdu (pdu); + + (void) sigiomask (smask); + + return result; +} diff --git a/usr/src/contrib/isode/acsap/acsapreleas3.c b/usr/src/contrib/isode/acsap/acsapreleas3.c new file mode 100644 index 0000000000..2fa3e06d63 --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapreleas3.c @@ -0,0 +1,122 @@ +/* acsapreleas3.c - ACPM: interpret release */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapreleas3.c,v 7.2 91/02/22 09:14:15 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapreleas3.c,v 7.2 91/02/22 09:14:15 mrose Interim $ + * + * + * $Log: acsapreleas3.c,v $ + * Revision 7.2 91/02/22 09:14:15 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/01 21:02:06 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:56 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#ifdef DEBUG +#include "tailor.h" +#endif + +/* handle P-RELEASE.INDICATION */ + +int AcFINISHser (sd, pf, aci) +int sd; +register struct PSAPfinish *pf; +register struct AcSAPindication *aci; +{ + SBV smask; + int result; + PE pe; + register struct assocblk *acb; + register struct AcSAPfinish *acf; + struct type_ACS_ACSE__apdu *pdu; + register struct type_ACS_RLRQ__apdu *rlrq; + + missingP (pf); + missingP (aci); + + smask = sigioblock (); + + acsapPsig (acb, sd); + + bzero ((char *) aci, sizeof *aci); + aci -> aci_type = ACI_FINISH; + acf = &aci -> aci_finish; + + pdu = NULL; + + if (pf -> pf_ninfo < 1) { + result = acsaplose (aci, ACS_PROTOCOL, NULLCP, + "no user-data on P-RELEASE"); + goto out; + } + + result = decode_ACS_ACSE__apdu (pe = pf -> pf_info[0], 1, NULLIP, NULLVP, + &pdu); + +#ifdef DEBUG + if (result == OK && (acsap_log -> ll_events & LLOG_PDUS)) + pvpdu (acsap_log, print_ACS_ACSE__apdu_P, pe, "ACSE-apdu", 1); +#endif + + pe_free (pe); + pe = pf -> pf_info[0] = NULLPE; + + if (result == NOTOK) { + result = acsaplose (aci, ACS_PROTOCOL, NULLCP, "%s", PY_pepy); + goto out; + } + + if (pdu -> offset != type_ACS_ACSE__apdu_rlrq) { + result = acsaplose (aci, ACS_PROTOCOL, NULLCP, + "unexpected PDU %d on P-RELEASE", pdu -> offset); + goto out; + } + + rlrq = pdu -> un.rlrq; + if (rlrq -> optionals & opt_ACS_RLRQ__apdu_reason) + acf -> acf_reason = rlrq -> reason; + else + acf -> acf_reason = int_ACS_reason_normal; + result = apdu2info (acb, aci, rlrq -> user__information, acf -> acf_info, + &acf -> acf_ninfo); + +out: ; + if (result == NOTOK) + freeacblk (acb); + else + acb -> acb_flags |= ACB_FINN; + + PFFREE (pf); + if (pdu) + free_ACS_ACSE__apdu (pdu); + + (void) sigiomask (smask); + + return result; +} diff --git a/usr/src/contrib/isode/acsap/acsaprespond.c b/usr/src/contrib/isode/acsap/acsaprespond.c new file mode 100644 index 0000000000..cb9e5999dc --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsaprespond.c @@ -0,0 +1,438 @@ +/* acsaprespond.c - ACPM: responder */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsaprespond.c,v 7.4 91/02/22 09:14:16 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsaprespond.c,v 7.4 91/02/22 09:14:16 mrose Interim $ + * + * + * $Log: acsaprespond.c,v $ + * Revision 7.4 91/02/22 09:14:16 mrose + * Interim 6.8 + * + * Revision 7.3 90/11/04 19:14:31 mrose + * update + * + * Revision 7.2 90/07/09 14:30:38 mrose + * sync + * + * Revision 7.1 90/07/01 21:02:08 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:21:57 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#include "tailor.h" + +/* A-ASSOCIATE.INDICATION */ + +int AcInit (vecp, vec, acs, aci) +int vecp; +char **vec; +struct AcSAPstart *acs; +struct AcSAPindication *aci; +{ + register int i; + int ctx, + result; + register struct assocblk *acb; + register struct PSAPstart *ps; + struct PSAPindication pis; + register struct PSAPindication *pi = &pis; + register struct PSAPabort *pa = &pi -> pi_abort; + PE pe = NULLPE; + struct type_ACS_ACSE__apdu *pdu; + register struct type_ACS_AARQ__apdu *aarq; + + isodetailor (NULLCP, 0); + + missingP (vec); + missingP (acs); + missingP (aci); + + ps = &acs -> acs_start; + if ((acb = newacblk ()) == NULL) + return acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); + + bzero ((char *) acs, sizeof *acs); + + if (PInit (vecp, vec, ps, pi) == NOTOK) { + (void) ps2acslose (acb, aci, "PInit", pa); + goto out1; + } + + acb -> acb_flags |= ACB_ACS; + acb -> acb_fd = ps -> ps_sd; + acb -> acb_sversion = ps -> ps_qos.qos_sversion; + acb -> acb_uabort = PUAbortRequest; + + pdu = NULL; + if (ps -> ps_ninfo < 1) { + (void) acsaplose (aci, ACS_PROTOCOL, NULLCP, + "no user-data on P-CONNECT"); + goto out2; + } + + result = decode_ACS_ACSE__apdu (pe = ps -> ps_info[0], 1, NULLIP, NULLVP, + &pdu); + +#ifdef DEBUG + if (result == OK && (acsap_log -> ll_events & LLOG_PDUS)) + pvpdu (acsap_log, print_ACS_ACSE__apdu_P, pe, "ACSE-apdu", 1); +#endif + + ctx = pe -> pe_context; + + pe_free (pe); + pe = ps -> ps_info[0] = NULLPE; + + if (result == NOTOK) { + (void) acsaplose (aci, ACS_PROTOCOL, NULLCP, "%s", PY_pepy); + goto out2; + } + + if (pdu -> offset != type_ACS_ACSE__apdu_aarq) { + (void) acsaplose (aci, ACS_PROTOCOL, NULLCP, + "unexpected PDU %d on P-CONNECT", pdu -> offset); + goto out2; + } + + aarq = pdu -> un.aarq; + + if ((acb -> acb_context = oid_cpy (aarq -> application__context__name)) + == NULLOID) { + (void) acsaplose (aci, ACS_CONGEST, NULLCP, NULLCP); + goto out2; + } + + { + register OID oid; + register struct PSAPcontext *pp; + + if ((oid = ode2oid (AC_ASN)) == NULLOID) { + (void) acsaplose (aci, ACS_PARAMETER, NULLCP, + "%s: unknown", AC_ASN); + goto out2; + } + + for (pp = ps -> ps_ctxlist.pc_ctx, i = ps -> ps_ctxlist.pc_nctx - 1; + i >= 0; + pp++, i--) + if (pp -> pc_id == ctx) { + if (oid_cmp (pp -> pc_asn, oid)) { + (void) acsaplose (aci, ACS_PROTOCOL, NULLCP, + "wrong ASN for ACSE"); + goto out2; + } + if (pp -> pc_result != PC_ACCEPT) { + (void) acsaplose (aci, ACS_PROTOCOL, NULLCP, + "PCI for ACSE not accepted"); + goto out2; + } + + acb -> acb_id = ctx; + } + else + if (acb -> acb_rosid == PE_DFLT_CTX) + acb -> acb_rosid = pp -> pc_id; + + if (acb -> acb_id == PE_DFLT_CTX) { + (void) acsaplose (aci, ACS_PROTOCOL, NULLCP, + "unable to find PCI for ACSE"); + goto out2; + } + } + + acs -> acs_sd = acb -> acb_fd; + + if (apdu2info (acb, aci, aarq -> user__information, acs -> acs_info, + &acs -> acs_ninfo) == NOTOK) + goto out2; + + acs -> acs_context = aarq -> application__context__name; + aarq -> application__context__name = NULLOID; + acs -> acs_callingtitle.aei_ap_title = aarq -> calling__AP__title; + aarq -> calling__AP__title = NULLPE; + acs -> acs_callingtitle.aei_ae_qualifier = + aarq -> calling__AE__qualifier; + aarq -> calling__AE__qualifier = NULLPE; + if (aarq -> calling__AP__invocation__id) { + acs -> acs_callingtitle.aei_ap_id = + aarq -> calling__AP__invocation__id -> parm; + acs -> acs_callingtitle.aei_flags |= AEI_AP_ID; + } + if (aarq -> calling__AE__invocation__id) { + acs -> acs_callingtitle.aei_ae_id = + aarq -> calling__AE__invocation__id -> parm; + acs -> acs_callingtitle.aei_flags |= AEI_AE_ID; + } + acs -> acs_calledtitle.aei_ap_title = aarq -> called__AP__title; + aarq -> called__AP__title = NULLPE; + acs -> acs_calledtitle.aei_ae_qualifier = + aarq -> called__AE__qualifier; + aarq -> called__AE__qualifier = NULLPE; + if (aarq -> called__AP__invocation__id) { + acs -> acs_calledtitle.aei_ap_id = + aarq -> called__AP__invocation__id -> parm; + acs -> acs_calledtitle.aei_flags |= AEI_AP_ID; + } + if (aarq -> called__AE__invocation__id) { + acs -> acs_calledtitle.aei_ae_id = + aarq -> called__AE__invocation__id -> parm; + acs -> acs_calledtitle.aei_flags |= AEI_AE_ID; + } + + for (i = ps -> ps_ninfo - 1; i >= 0; i--) + if (ps -> ps_info[i]) { + pe_free (ps -> ps_info[i]); + ps -> ps_info[i] = NULL; + } + ps -> ps_ninfo = 0; + + free_ACS_ACSE__apdu (pdu); + + return OK; + +out2: ; + if (pdu) + free_ACS_ACSE__apdu (pdu); + +/* XXX: should do AARE APDU, but can't given any useful info... */ + (void) PConnResponse (ps -> ps_sd, PC_REJECTED, NULLPA, &ps -> ps_ctxlist, + ps -> ps_defctxresult, 0, 0, SERIAL_NONE, 0, + &ps -> ps_connect, NULLPEP, 0, &pis); + + PSFREE (ps); + +out1: ; + freeacblk (acb); + + return NOTOK; +} + +/* A-ASSOCIATE.RESPONSE */ + +int AcAssocResponse (sd, status, reason, context, respondtitle, + respondaddr, ctxlist, defctxresult, prequirements, srequirements, isn, + settings, ref, data, ndata, aci) +int sd; +int status, + reason; +OID context; +AEI respondtitle; +struct PSAPaddr *respondaddr; +int prequirements, + srequirements, + settings, + ndata; +long isn; +struct PSAPctxlist *ctxlist; +int defctxresult; +struct SSAPref *ref; +PE *data; +struct AcSAPindication *aci; +{ + int pstatus, + result; + PE pe; + register struct assocblk *acb; + struct PSAPindication pis; + register struct PSAPindication *pi = &pis; + register struct PSAPabort *pa = &pi -> pi_abort; + register struct type_ACS_AARE__apdu *pdu; + + if ((acb = findacblk (sd)) == NULL || (acb -> acb_flags & ACB_CONN)) + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid association descriptor"); + switch (status) { + case ACS_ACCEPT: + pstatus = PC_ACCEPT; + if (reason != ACS_USER_NULL) { +bad_reason: ; + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "invalid value for reason parameter"); + } + break; + + case ACS_PERMANENT: + case ACS_TRANSIENT: + pstatus = PC_REJECTED; + switch (reason) { + case ACS_USER_NOREASON: + case ACS_CONTEXT: + case ACS_CALLING_AP_TITLE: + case ACS_CALLING_AP_ID: + case ACS_CALLING_AE_QUAL: + case ACS_CALLING_AE_ID: + case ACS_CALLED_AP_TITLE: + case ACS_CALLED_AP_ID: + case ACS_CALLED_AE_QUAL: + case ACS_CALLED_AE_ID: + break; + + default: + goto bad_reason; + } + break; + + default: + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "bad value for status parameter"); + } +#ifdef notdef + missingP (context); + missingP (respondtitle); +#endif + +/* let presentation provider catch errors in presentation parameters */ + + toomuchP (data, ndata, NACDATA, "initial"); + if (data) { /* XXX: probably should have a more intensive check... */ + register int i; + register PE *pep; + + for (pep = data, i = ndata; i > 0; pep++, i--) + if ((*pep) -> pe_context == PE_DFLT_CTX) + return acsaplose (aci, ACS_PARAMETER, NULLCP, + "default context not allowed for user-data at slot %d", + pep - data); + } + missingP (aci); + + pe = NULLPE; + if ((pdu = (struct type_ACS_AARE__apdu *) calloc (1, sizeof *pdu)) + == NULL) { +no_mem: ; + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); + goto out2; + } + pdu -> application__context__name = context ? context : acb -> acb_context; + pdu -> result = status; + if ((pdu -> result__source__diagnostic = + (struct type_ACS_Associate__source__diagnostic *) malloc + (sizeof (struct type_ACS_Associate__source__diagnostic))) == NULL) + goto no_mem; + pdu -> result__source__diagnostic -> offset = + type_ACS_Associate__source__diagnostic_acse__service__user; + pdu -> result__source__diagnostic -> un.acse__service__user = + reason - ACS_USER_BASE; + if (respondtitle) { + pdu -> responding__AP__title = respondtitle -> aei_ap_title; + pdu -> responding__AE__qualifier = respondtitle -> aei_ae_qualifier; + if (respondtitle -> aei_flags & AEI_AP_ID) + pdu -> responding__AP__invocation__id = + (struct type_ACS_AP__invocation__id *) + &respondtitle -> aei_ap_id; + if (respondtitle -> aei_flags & AEI_AE_ID) + pdu -> responding__AE__invocation__id = + (struct type_ACS_AE__invocation__id *) + &respondtitle -> aei_ae_id; + } + if (data + && ndata > 0 + && (pdu -> user__information = info2apdu (acb, aci, data, ndata)) + == NULL) + goto out2; + + result = encode_ACS_AARE__apdu (&pe, 1, 0, NULLCP, pdu); + + free_ACS_Associate__source__diagnostic (pdu -> result__source__diagnostic); + if (pdu -> user__information) + free_ACS_Association__information (pdu -> user__information); + free ((char *) pdu); + pdu = NULL; + + if (result == NOTOK) { + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "error encoding PDU: %s", + PY_pepy); + goto out2; + } + + if (ctxlist) { + register int i; + register struct PSAPcontext *pp; + + if (ctxlist -> pc_nctx > NPCTX) { + (void) acsaplose (aci, ACS_PARAMETER, NULLCP, "too many contexts"); + goto out1; + } + + for (pp = ctxlist -> pc_ctx, i = ctxlist -> pc_nctx - 1; + i >= 0; + i--, pp++) + if (acb -> acb_id == pp -> pc_id) { + if (pp -> pc_result != PC_ACCEPT) { + (void) acsaplose (aci, ACS_PARAMETER, NULLCP, + "PCI for ACSE not accepted"); + goto out1; + } + } + else + if (pp -> pc_result == PC_ACCEPT) + acb -> acb_rosid = pp -> pc_id; + } + pe -> pe_context = acb -> acb_id; + + PLOGP (acsap_log,ACS_ACSE__apdu, pe, "AARE-apdu", 0); + + result = PConnResponse (acb -> acb_fd, pstatus, respondaddr, + ctxlist, defctxresult, prequirements, srequirements, isn, + settings, ref, &pe, 1, pi); + + pe_free (pe); + pe = NULLPE; + + if (result == NOTOK) { + (void) ps2acslose (acb, aci, "PConnResponse", pa); + if (PC_FATAL (pa -> pa_reason)) + goto out2; + else + goto out1; + } + + if (status == ACS_ACCEPT) + acb -> acb_flags |= ACB_CONN; + else { + acb -> acb_fd = NOTOK; + freeacblk (acb); + } + + return OK; + +out2: ; + freeacblk (acb); +out1: ; + if (pdu) { + if (pdu -> result__source__diagnostic) + free_ACS_Associate__source__diagnostic (pdu -> result__source__diagnostic); + if (pdu -> user__information) + free_ACS_Association__information (pdu -> user__information); + free ((char *) pdu); + } + if (pe) + pe_free (pe); + + return NOTOK; +} + diff --git a/usr/src/contrib/isode/acsap/acsaprovider.c b/usr/src/contrib/isode/acsap/acsaprovider.c new file mode 100644 index 0000000000..f4356da79e --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsaprovider.c @@ -0,0 +1,193 @@ +/* acsaprovider.c - implement the association control protocol */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsaprovider.c,v 7.1 91/02/22 09:14:18 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsaprovider.c,v 7.1 91/02/22 09:14:18 mrose Interim $ + * + * + * $Log: acsaprovider.c,v $ + * Revision 7.1 91/02/22 09:14:18 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:21:59 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "ACS-types.h" +#define ACSE +#include "acpkt.h" +#include "tailor.h" + +/* PSAP interface */ + +int ps2acslose (acb, aci, event, pa) +register struct assocblk *acb; +register struct AcSAPindication *aci; +char *event; +register struct PSAPabort *pa; +{ + int reason; + char *cp, + buffer[BUFSIZ]; + + if (event) + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + (pa -> pa_cc > 0 ? "%s: %s [%*.*s]": "%s: %s", event, + PErrString (pa -> pa_reason), pa -> pa_cc, pa -> pa_cc, + pa -> pa_data)); + + cp = ""; + switch (pa -> pa_reason) { + case PC_ADDRESS: + reason = ACS_ADDRESS; + break; + + case PC_REFUSED: + reason = ACS_REFUSED; + break; + + case PC_CONGEST: + reason = ACS_CONGEST; + break; + + case PC_PARAMETER: + reason = ACS_PARAMETER; + break; + + case PC_OPERATION: + reason = ACS_OPERATION; + break; + + case PC_TIMER: + reason = ACS_TIMER; + break; + + default: + (void) sprintf (cp = buffer, " (%s at presentation)", + PErrString (pa -> pa_reason)); + case PC_SESSION: + reason = ACS_PRESENTATION; + break; + } + + if (ACS_FATAL (reason)) { + if (pa -> pa_cc > 0) + return acpktlose (acb, aci, reason, NULLCP, "%*.*s%s", + pa -> pa_cc, pa -> pa_cc, pa -> pa_data, cp); + else + return acpktlose (acb, aci, reason, NULLCP, "%s", + *cp ? cp + 1 : cp); + } + else { + if (pa -> pa_cc > 0) + return acsaplose (aci, reason, NULLCP, "%*.*s%s", + pa -> pa_cc, pa -> pa_cc, pa -> pa_data, cp); + else + return acsaplose (aci, reason, NULLCP, "%s", + *cp ? cp + 1 : cp); + } +} + +/* INTERNAL */ + +/* + Owing to laziness on our part, we use only ASN.1 transfer syntax. + */ + +/* ARGSUSED */ + +struct type_ACS_Association__information *info2apdu (acb, aci, data, ndata) +struct assocblk *acb; +struct AcSAPindication *aci; +PE *data; +int ndata; +{ + register PE pe; + struct type_ACS_Association__information *info; + register struct type_ACS_Association__information **pp, + *p; + register struct type_UNIV_EXTERNAL *q; + + for (pp = &info; ndata-- > 0; pp = &p -> next) { + if ((*pp = p = (struct type_ACS_Association__information *) + calloc (1, sizeof *p)) == NULL + || (p -> EXTERNAL = (struct type_UNIV_EXTERNAL *) + calloc (1, sizeof *q)) == NULL + || (p -> EXTERNAL -> encoding = (struct choice_UNIV_0 *) + malloc (sizeof (struct choice_UNIV_0))) == NULL) + goto out; + q = p -> EXTERNAL; + + if (!(acb -> acb_flags & ACB_CONN) + && (q -> direct__reference = oid_cpy (ode2oid (BER))) + == NULLOID) + goto out; + q -> indirect__reference = (pe = *data++) -> pe_context; + q -> encoding -> offset = choice_UNIV_0_single__ASN1__type; + (q -> encoding -> un.single__ASN1__type = pe) -> pe_refcnt++; + } + (*pp) = NULL; + + return info; + +out: ; + free_ACS_Association__information (info); + + (void) acsaplose (aci, ACS_CONGEST, NULLCP, "out of memory"); + + return NULL; +} + +/* */ + +/* ARGSUSED */ + +int apdu2info (acb, aci, info, data, ndata) +struct assocblk *acb; +struct AcSAPindication *aci; +struct type_ACS_Association__information *info; +PE *data; +int *ndata; +{ + register int i; + register PE pe; + register struct type_UNIV_EXTERNAL *q; + + for (i = 0; info; info = info -> next, i++) { + if (i > NACDATA) + return acpktlose (acb, aci, ACS_CONGEST, NULLCP, + "too much user information"); + + q = info -> EXTERNAL; + if (q -> encoding -> offset != choice_UNIV_0_single__ASN1__type) + return acpktlose (acb, aci, ACS_PROTOCOL, NULLCP, + "EXTERNAL data not single-ASN1-type"); + + (pe = q -> encoding -> un.single__ASN1__type) -> pe_refcnt++; + pe -> pe_context = q -> indirect__reference; + + *data++ = pe; + } + *ndata = i; + + return OK; +} diff --git a/usr/src/contrib/isode/acsap/acsapstub.c b/usr/src/contrib/isode/acsap/acsapstub.c new file mode 100644 index 0000000000..c27d6454a0 --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsapstub.c @@ -0,0 +1,329 @@ +/* acsapstub.c - application entity titles -- stub directory service */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapstub.c,v 7.6 91/02/22 09:14:19 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsapstub.c,v 7.6 91/02/22 09:14:19 mrose Interim $ + * + * RFC1085 (LPP) support contributed by the Wollongong Group, Inc. + * + * + * $Log: acsapstub.c,v $ + * Revision 7.6 91/02/22 09:14:19 mrose + * Interim 6.8 + * + * Revision 7.5 90/11/21 11:29:36 mrose + * sun + * + * Revision 7.4 90/11/04 19:14:37 mrose + * update + * + * Revision 7.3 90/11/04 14:22:31 mrose + * update + * + * Revision 7.2 90/10/15 18:19:28 mrose + * zap-AET + * + * Revision 7.1 90/07/09 14:30:41 mrose + * sync + * + * Revision 7.0 89/11/23 21:22:00 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "psap.h" +#include "isoaddrs.h" +#include "internet.h" +#include "tailor.h" + + +#define fetch_aet str2aet_seq + +/* DATA */ + +static struct isoentity ies; + +/* */ + +AEI str2aei_stub (designator, qualifier) +char *designator, + *qualifier; +{ +#ifdef LPP + register int n; + int tcp_port, + udp_port; + register struct servent *sp; +#endif + register char *cp; + register struct NSAPaddr *na; + register struct isoentity *ie = &ies; + + if (fetch_aet (designator, qualifier, &ies) == NOTOK) { +#ifdef LPP + if (lpp_aet (designator, qualifier, &ies) != NOTOK) + goto found_it; +#endif + + return NULLAEI; + } + + if (ie -> ie_addr.pa_addr.sa_addr.ta_naddr <= 0) { + register int i; + register struct TSAPaddr *ta = &ie -> ie_addr.pa_addr.sa_addr; + + na = ta -> ta_addrs, ta -> ta_naddr = 1; + bzero ((char *) na, sizeof *na); + + /* guess at what sort of address we have on our hands */ + + if ((i = strlen (cp = designator)) > 6 + && cp[0] == '4' && cp[2] == '0' && cp[3] == '0') { + na -> na_stack = NA_NSAP; + na -> na_community = ts_comm_nsap_default; + na -> na_addrlen = implode ((u_char *) na -> na_address, + cp, strlen (cp)); + goto found_it; + } + + if (i <= NSAP_DTELEN + 1) + for (; *cp; cp++) + if (!isxdigit ((u_char) *cp)) + break; + if (*cp) { + register struct hostent *hp = gethostbystring (designator); + + if (index (cp, '@') || index (cp, '=') || index (cp, ',')) + return NULLAEI; + + na -> na_stack = NA_TCP; + na -> na_community = ts_comm_tcp_default; + if (hp) { +#ifdef h_addr + register char **ap; +#endif + + (void) strcpy (na -> na_domain, + inet_ntoa (*(struct in_addr *) hp -> h_addr)); +#ifdef h_addr + for (ap = hp -> h_addr_list + 1; *ap; ap++) { + ta -> ta_naddr++, na++; + + if (ta -> ta_naddr >= NTADDR) + break; + + bzero ((char *) na, sizeof *na); + na -> na_stack = NA_TCP; + na -> na_community = ts_comm_tcp_default; + (void) strcpy (na -> na_domain, + inet_ntoa (*(struct in_addr *) *ap)); + } +#endif + } + else + /* hostname not in /etc/hosts or NIS */ + return (NULLAEI); + } + else { + (void) strcpy (na -> na_dte, designator); + na -> na_dtelen = strlen (na -> na_dte); +#ifdef BRIDGE_X25 + na -> na_stack = bridgediscrim (na) ? NA_BRG : NA_X25; +#else + na -> na_stack = NA_X25; +#endif + na -> na_community = ts_comm_x25_default; + } + } + +#ifdef LPP + for (na = ie -> ie_addr.pa_addr.sa_addr.ta_addrs, + n = ie -> ie_addr.pa_addr.sa_addr.ta_naddr; + n > 0; + na++, n--) + if (na -> na_stack == NA_TCP && na -> na_port == 0) { + cp = strncmp (qualifier, "isode ", 6) ? qualifier : qualifier + 6; + if (sp = getservbyname (cp, "lpp")) + tcp_port = udp_port = sp -> s_port; + else { + tcp_port = (sp = getservbyname (cp, "tcp")) ? sp -> s_port : 0; + udp_port = (sp = getservbyname (cp, "udp")) ? sp -> s_port : 0; + } + break; + } + + for (na = ie -> ie_addr.pa_addr.sa_addr.ta_addrs, + n = ie -> ie_addr.pa_addr.sa_addr.ta_naddr; + n > 0; + na++, n--) + if (na -> na_stack == NA_TCP && na -> na_port == 0) { + register struct TSAPaddr *ta; + + if (tcp_port) { + na -> na_port = (u_short) tcp_port; + na -> na_tset = NA_TSET_TCP; + + if (udp_port + && (ta = &ie -> ie_addr.pa_addr.sa_addr) -> ta_naddr + < NTADDR) { + register struct NSAPaddr *ua = + ta -> ta_addrs + ta -> ta_naddr++; + + bzero ((char *) ua, sizeof *ua); + ua -> na_stack = NA_TCP; + ua -> na_community = ts_comm_tcp_default; + (void) strncpy (ua -> na_domain, na -> na_domain, + sizeof ua -> na_domain); + ua -> na_port = (u_short) udp_port; + ua -> na_tset = NA_TSET_UDP; + } + } + else + if (udp_port) { + na -> na_port = (u_short) udp_port; + na -> na_tset = NA_TSET_UDP; + } + } +#endif + +found_it: ; + if (addr_log -> ll_events & LLOG_DEBUG) + _printent (ie); + + return oid2aei (&ie -> ie_identifier); +} + +/* */ + +#ifdef LPP +static unsigned int elements[NELEM + 1]; +static char objent[BUFSIZ]; + + +static int lpp_aet (designator, qualifier, ie) +char *designator, + *qualifier; +register struct isoentity *ie; +{ + register int nelem; + int tcp_port, + udp_port; + char *cp; + register struct servent *sp; + register OID oid = &ie -> ie_identifier; + register struct PSAPaddr *pa = &ie -> ie_addr; + register struct TSAPaddr *ta = &pa -> pa_addr.sa_addr; + register struct NSAPaddr *na; + + cp = strncmp (qualifier, "isode ", 6) ? qualifier : qualifier + 6; + if (sp = getservbyname (cp, "lpp")) + tcp_port = udp_port = sp -> s_port; + else + if ((tcp_port = (sp = getservbyname (cp, "tcp")) ? sp -> s_port : 0) + == 0 + && (udp_port = (sp = getservbyname (cp, "udp")) ? sp -> s_port + : 0) == 0) + return NOTOK; + + nelem = 0; + elements[nelem++] = 1, elements[nelem++] = 17, elements[nelem++] = 4, + elements[nelem++] = 0, elements[nelem++] = 0; + + oid -> oid_elements = elements; + oid -> oid_nelem = nelem; + (void) sprintf (ie -> ie_descriptor = objent, "%s-%s", designator, + qualifier); + + (void) bzero ((char *) pa, sizeof *pa); + na = ta -> ta_addrs; + if (tcp_port) { + na -> na_stack = NA_TCP; + na -> na_community = ts_comm_tcp_default; + (void) strncpy (na -> na_domain, designator, sizeof na -> na_domain); + na -> na_port = (u_short) tcp_port; + na -> na_tset = NA_TSET_TCP; + na++; + } + if (udp_port) { + na -> na_stack = NA_TCP; + na -> na_community = ts_comm_tcp_default; + (void) strncpy (na -> na_domain, designator, sizeof na -> na_domain); + na -> na_port = (u_short) udp_port; + na -> na_tset = NA_TSET_UDP; + na++; + } + ta -> ta_naddr = na - ta -> ta_addrs; + + return OK; +} +#endif + +/* */ + +struct PSAPaddr *aei2addr_stub (aei) +AEI aei; +{ + register struct isoentity *ie = &ies; + register struct PSAPaddr *pa; + + if (aei -> aei_ap_title + ? oid_cmp (&ie -> ie_identifier, prim2oid (aei -> aei_ap_title)) + : ie -> ie_identifier.oid_nelem > 0) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("aei2addr_stub cache miss on %s", sprintaei (aei))); + + return NULLPA; + } + pa = &ie -> ie_addr; + if (addr_log -> ll_events & LLOG_DEBUG) + _printent (ie); + + return (pa -> pa_addr.sa_addr.ta_naddr > 0 ? pa : NULLPA); +} + +/* */ + +#ifdef LPP +/* ARGSUSED */ + +AEI str2aei_dse (designator, qualifier, context, interactive) +char *designator, + *qualifier, + *context; +int interactive; +{ + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("DSE lookup not supported for LPP")); + return NULLAEI; +} + + +/* ARGSUSED */ + +struct PSAPaddr *aei2addr_dse (aei) +AEI aei; +{ + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("DSE lookup not supported for LPP")); + + return NULLPA; +} +#endif diff --git a/usr/src/contrib/isode/acsap/acsaptest.c b/usr/src/contrib/isode/acsap/acsaptest.c new file mode 100644 index 0000000000..4b01e7614f --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsaptest.c @@ -0,0 +1,239 @@ +/* acsaptest.c - test out -lacsap */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acsaptest.c,v 7.7 91/02/22 09:14:21 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acsaptest.c,v 7.7 91/02/22 09:14:21 mrose Interim $ + * + * + * $Log: acsaptest.c,v $ + * Revision 7.7 91/02/22 09:14:21 mrose + * Interim 6.8 + * + * Revision 7.6 91/02/19 09:18:25 mrose + * update + * + * Revision 7.5 90/12/11 10:51:58 mrose + * lock-and-load + * + * Revision 7.4 90/11/04 19:14:41 mrose + * update + * + * Revision 7.3 90/07/27 08:41:44 mrose + * update + * + * Revision 7.2 90/07/09 14:30:43 mrose + * sync + * + * Revision 7.1 90/07/01 21:02:11 mrose + * pepsy + * + * Revision 7.0 89/11/23 21:22:01 mrose + * Release 6.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 +#define ACSE +#include "acpkt.h" +#include "isoservent.h" +#include "tailor.h" +#include "psap.h" +#include "DSE-types.h" +#include "UNIV-types.h" + + +#define NULLIE ((struct isoentity *) 0) + + +char *macro2str (); +struct TSAPaddr *ta2norm (); + +/* */ + +/* ARGSUSED */ + +main (argc, argv, envp) +int argc; +char **argv, + **envp; +{ + AEI aei; + register struct PSAPaddr *pa; + register struct isoentity *ie; + register struct isobject *io; + register struct isoservent *is; + + isodetailor (argv[0], 1); + + argc--, argv++; + switch (argc) { + case 1: + if (strcmp (*argv, "-version") == 0) { + printf ("%s\n", acsapversion); + break; + } + if (!(pa = str2paddr (*argv))) + goto you_lose; + printent (NULLIE, NULLAEI, pa); + break; + + case 2: + case 3: + if (strcmp (argv[0], "-macro") == 0) { + char *cp; + + if ((cp = macro2str (argv[1])) == NULL) + goto you_lose; + printf ("%s\n", cp); + break; + } + +#undef UFN +#ifdef UFN + { +#include "quipu/ufn.h" + + ufn_notify = 1; + + (void) set_lookup_ufn (0); + } +#endif + + if (!(aei = _str2aei (argv[0], *argv[1] ? argv[1] : NULLCP, + argv[2], isatty (fileno (stdin)), NULLCP, + NULLCP))) { + fprintf (stderr, "name translation failed: %s\n", PY_pepy); + goto you_lose; + } + printent (NULLIE, aei, NULLPA); + + if (!(pa = aei2addr (aei))) { + fprintf (stderr, "address translation failed\n"); + goto you_lose; + } + printent (NULLIE, NULLAEI, pa); + break; + + default: + printf ("ISO Entities Database\n"); + while (ie = getisoentity ()) + printent (ie, oid2aei (&ie -> ie_identifier), &ie -> ie_addr); + + printf ("\nISO Objects Database\n"); + while (io = getisobject ()) + printobj (io); + + printf ("\nISO Services Database\n"); + while (is = getisoservent ()) + printsrv (is); + break; + } + + exit (0); /* NOTREACHED */ + +you_lose: ; + fprintf (stderr, "no such luck\n"); + exit (1); /* NOTREACHED */ +} + +/* */ + +static printent (ie, aei, pa) +register struct isoentity *ie; +AEI aei; +register struct PSAPaddr *pa; +{ + if (ie) + printf ("Entity: %s (%s)\n", ie -> ie_descriptor, + oid2ode (&ie -> ie_identifier)); + + if (aei) + printf ("AE info: %s\n", sprintaei (aei)); + + if (pa) { + struct PSAPaddr pas; + register struct TSAPaddr *ta = &pa -> pa_addr.sa_addr; + PE pe; + + printf ("Address: %s\n", paddr2str (pa, NULLNA)); + + pe = NULLPE; + if (build_DSE_PSAPaddr (&pe, 1, NULL, NULLCP, (char *) pa) == NOTOK) { + printf ("build of PSAPaddr failed: %s\n", PY_pepy); + goto dont_touch; + } + + bzero ((char *) &pas, sizeof pas); + if (parse_DSE_PSAPaddr (pe, 1, NULLIP, NULLVP, (char *) &pas) ==NOTOK){ + printf ("parse of PSAPaddr failed: %s\n", PY_pepy); + goto dont_touch; + } + + (void) print_DSE_PSAPaddr (pe, 1, NULLIP, NULLVP, NULLCP); + + if (bcmp ((char *) pa, (char *) &pas, sizeof pas)) { + printf ("*** NOT EQUAL ***\n"); + printf ("\told %s\n", paddr2str (pa, NULLNA)); + printf ("\tnew %s\n", paddr2str (&pas, NULLNA)); + } + +dont_touch: ; + if (pe) + pe_free (pe); + + { + struct TSAPaddr *tz = ta2norm (ta); + + if (tz) { + if (bcmp ((char *) ta, (char *) tz, sizeof *tz)) + printf ("NORM: %s\n", taddr2str (tz)); + } + else + printf ("*** ta2norm FAILED ***\n"); + } + + } + + if (ie || aei || pa) + printf ("\n"); +} + +/* */ + +static printobj (io) +register struct isobject *io; +{ + printf ("ODE: \"%s\"\nOID: %s\n\n", io -> io_descriptor, + sprintoid (&io -> io_identity)); +} + +/* */ + +static printsrv (is) +register struct isoservent *is; +{ + register int n = is -> is_tail - is -> is_vec - 1; + register char **ap = is -> is_vec; + + printf ("ENT: \"%s\" PRV: \"%s\" SEL: %s\n", + is -> is_entity, is -> is_provider, + sel2str (is -> is_selector, is -> is_selectlen, 1)); + + for (; n >= 0; ap++, n--) + printf ("\t%d: \"%s\"\n", ap - is -> is_vec, *ap); + printf ("\n"); +} diff --git a/usr/src/contrib/isode/acsap/acserver1.c b/usr/src/contrib/isode/acsap/acserver1.c new file mode 100644 index 0000000000..1b8f7566ce --- /dev/null +++ b/usr/src/contrib/isode/acsap/acserver1.c @@ -0,0 +1,75 @@ +/* acserver1.c - generic server dispatch */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acserver1.c,v 7.4 91/02/22 09:14:23 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acserver1.c,v 7.4 91/02/22 09:14:23 mrose Interim $ + * + * + * $Log: acserver1.c,v $ + * Revision 7.4 91/02/22 09:14:23 mrose + * Interim 6.8 + * + * Revision 7.3 90/10/29 18:37:49 mrose + * updates + * + * Revision 7.2 90/07/09 14:30:45 mrose + * sync + * + * Revision 7.1 90/02/19 13:07:05 mrose + * update + * + * Revision 7.0 89/11/23 21:22:02 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "tsap.h" +#include +#ifdef BSD42 +#include +#endif +#ifdef SYS5 +#include +#endif +#include "tailor.h" + +/* */ + +int isodeserver (argc, argv, aei, initfnx, workfnx, losefnx, td) +int argc; +char **argv; +AEI aei; +IFP initfnx, + workfnx, + losefnx; +struct TSAPdisconnect *td; +{ + if (iserver_init (argc, argv, aei, initfnx, td) == NOTOK) + return NOTOK; + + for (;;) { + int result; + + if ((result = iserver_wait (initfnx, workfnx, losefnx, 0, NULLFD, + NULLFD, NULLFD, NOTOK, td)) != OK) + return (result == DONE ? OK : result); + } +} diff --git a/usr/src/contrib/isode/acsap/acserver2.c b/usr/src/contrib/isode/acsap/acserver2.c new file mode 100644 index 0000000000..acc1f439cf --- /dev/null +++ b/usr/src/contrib/isode/acsap/acserver2.c @@ -0,0 +1,233 @@ +/* acserver2.c - generic server dispatch */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/acserver2.c,v 7.4 91/02/22 09:14:24 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/acserver2.c,v 7.4 91/02/22 09:14:24 mrose Interim $ + * + * + * $Log: acserver2.c,v $ + * Revision 7.4 91/02/22 09:14:24 mrose + * Interim 6.8 + * + * Revision 7.3 90/10/29 18:37:51 mrose + * updates + * + * Revision 7.2 90/07/09 14:30:46 mrose + * sync + * + * Revision 7.1 90/02/19 13:07:07 mrose + * update + * + * Revision 7.0 89/11/23 21:22:03 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "tsap.h" +#include +#ifdef BSD42 +#include +#endif +#ifdef SYS5 +#include +#endif +#include "tailor.h" + +/* */ + +static int is_nfds; +static fd_set is_mask; +static char is_single; + +/* */ + +int iserver_init (argc, argv, aei, initfnx, td) +int argc; +char **argv; +AEI aei; +IFP initfnx; +struct TSAPdisconnect *td; +{ + int fd; + + isodetailor (NULLCP, 0); + + is_nfds = 0; + FD_ZERO (&is_mask); + + if (argc > 1) { + is_single = 1; + if ((fd = (*initfnx) (argc, argv)) == NOTOK) + return tsaplose (td, DR_NETWORK, NULLCP, "initialization failed"); + + is_nfds = fd + 1; + FD_SET (fd, &is_mask); + } + else { + struct PSAPaddr *pa; + is_single = 0; + + if ((pa = aei2addr (aei)) == NULLPA) + return tsaplose (td, DR_ADDRESS, NULLCP, + "address translation failed"); + + if (TNetListen (&pa -> pa_addr.sa_addr, td) == NOTOK) + return NOTOK; + + if (!isatty (2)) { + int i; + + for (i = 0; i < 5; i++) { + switch (fork ()) { + case NOTOK: + sleep (5); + continue; + + case OK: + break; + + default: + _exit (0); + } + break; + } + + (void) chdir ("/"); + + if ((fd = open ("/dev/null", O_RDWR)) != NOTOK) { + if (fd != 0) + (void) dup2 (fd, 0), (void) close (fd); + (void) dup2 (0, 1); + (void) dup2 (0, 2); + } + +#ifdef SETSID + (void) setsid (); +#endif +#ifdef TIOCNOTTY + if ((fd = open ("/dev/tty", O_RDWR)) != NOTOK) { + (void) ioctl (fd, TIOCNOTTY, NULLCP); + (void) close (fd); + } +#else +#ifdef SYS5 + (void) setpgrp (); + (void) signal (SIGINT, SIG_IGN); + (void) signal (SIGQUIT, SIG_IGN); +#endif +#endif + isodexport (NULLCP); /* re-initialize logfiles */ + } + } + + return OK; +} + +/* */ + +int iserver_wait (initfnx, workfnx, losefnx, nfds, rfds, wfds, efds, secs, + td) +IFP initfnx, + workfnx, + losefnx; +int nfds; +fd_set *rfds, + *wfds, + *efds; +int secs; +struct TSAPdisconnect *td; +{ + int fd, + vecp; + fd_set ifds, + ofds, + xfds; + char *vec[4]; + + ifds = is_mask; /* struct copy */ + FD_ZERO (&ofds); + FD_ZERO (&xfds); + if (is_nfds > nfds) + nfds = is_nfds + 1; + + if (rfds) + for (fd = 0; fd < nfds; fd++) + if (FD_ISSET (fd, rfds)) + FD_SET (fd, &ifds); + if (wfds) + ofds = *wfds; + if (efds) + xfds = *efds; + + if (TNetAccept (&vecp, vec, nfds, &ifds, &ofds, &xfds, secs, td) + == NOTOK) { + (void) (*losefnx) (td); + + return OK; + } + if (wfds) + *wfds = ofds; + if (efds) + *efds = xfds; + + if (vecp > 0 && (fd = (*initfnx) (vecp, vec)) != NOTOK) { + if (fd >= is_nfds) + is_nfds = fd + 1; + FD_SET (fd, &is_mask); + } + + for (fd = 0; fd < nfds; fd++) + if (FD_ISSET (fd, &is_mask) && FD_ISSET (fd, &ifds)) { + if (workfnx == NULLIFP) { + (void) TNetClose (NULLTA, td); + return tsaplose (td, DR_OPERATION, NULLCP, + "no worker routine for connected fd"); + } + FD_CLR (fd, &ifds); + if ((*workfnx) (fd) == NOTOK) { + FD_CLR (fd, &is_mask); + if (is_nfds == fd + 1) + is_nfds--; + + if (is_single) { + int xd; + + for (xd = 0; xd < nfds; xd++) + if (FD_ISSET (xd, &is_mask)) + break; + if (rfds) + FD_ZERO (rfds); + if (xd >= is_nfds) + return DONE; + } + } + } + if (rfds) + *rfds = ifds; + return OK; +} + +/* */ + +fd_set iserver_mask () +{ + return is_mask; +} diff --git a/usr/src/contrib/isode/acsap/acsold.py b/usr/src/contrib/isode/acsap/acsold.py new file mode 100644 index 0000000000..842496efdd --- /dev/null +++ b/usr/src/contrib/isode/acsap/acsold.py @@ -0,0 +1,183 @@ +-- acsold.py - AcSAP definitions for old-style applications + +-- $Header: /f/osi/acsap/RCS/acsold.py,v 7.3 91/02/22 09:14:27 mrose Interim $ +-- +-- +-- $Log: acsold.py,v $ +-- Revision 7.3 91/02/22 09:14:27 mrose +-- Interim 6.8 +-- +-- Revision 7.2 90/07/01 21:02:14 mrose +-- pepsy +-- +-- Revision 7.1 90/01/11 18:34:59 mrose +-- real-sync +-- +-- Revision 7.0 89/11/23 21:22:04 mrose +-- Release 6.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. +-- +-- + + +OACS DEFINITIONS ::= + +BEGIN + +-- these are used by pre-ACSE versions of ROS and RTS +-- they are not part of the 8650 standard, but are included here for use +-- by old-style applications + +PConnect ::= + SET { + [0] + IMPLICIT DataTransferSyntax, + + pUserData[1] + IMPLICIT SET { + checkpointSize[0] + IMPLICIT INTEGER + DEFAULT 0, + + windowSize[1] + IMPLICIT INTEGER + DEFAULT 3, + + dialogueMode[2] + IMPLICIT INTEGER { + monologue(0), twa(1) + } + DEFAULT monologue, + + [3] + ConnectionData, + + applicationProtocol[4] + --* IMPLICIT INTEGER { *-- + --* p1(1), p3(3) *-- + --* } *-- + IMPLICIT INTEGER + DEFAULT --* p1 *-- 1, + + protocolVersion[5] + IMPLICIT INTEGER + OPTIONAL + } + } + +PAccept ::= + SET { + [0] + IMPLICIT DataTransferSyntax, + + pUserData[1] + IMPLICIT SET { + checkpointSize[0] + IMPLICIT INTEGER + DEFAULT 0, + + windowsize[1] + IMPLICIT INTEGER + DEFAULT 3, + + [2] + ConnectionData + } + } + +PRefuse ::= + SET { + [0] + IMPLICIT RefuseReason + } + +DataTransferSyntax ::= + SET { + [0] + IMPLICIT INTEGER { x409(0) } + } + +ConnectionData ::= + CHOICE { + open[0] -- ACS user data + ANY, + recover[1] + IMPLICIT SessionConnectionIdentifier + + } + +SessionConnectionIdentifier ::= + SEQUENCE { + CallingSSUserReference, + + CommonReference, + + [0] + IMPLICIT AdditionalReferenceInformation + OPTIONAL + } + +CallingSSUserReference ::= + SSAPAddress -- of the initiator + +CommonReference ::= + UTCTime + +AdditionalReferenceInformation ::= + T61String + +SSAPAddress ::= + T61String + + +RefuseReason ::= + INTEGER { + busy(0), + cannotRecover(1), + validationFailure(2), + unacceptableDialogueMode(3) + } + + +-- similarly, this is used during a provider-initiated abort + +AbortInformation ::= + SET { + [0] + IMPLICIT AbortReason + OPTIONAL, + + reflectedParameter[1] + IMPLICIT BITSTRING + OPTIONAL + } + +AbortReason ::= + INTEGER { + localSystemProblem(0), + + invalidParameter(1), -- reflectedParameter supplied + + unrecognizedActivity(2), + + temporaryProblem(3), -- the ACS cannot accept a session + -- for a period of time + + protocolError(4) -- ACS level protocol error + } + + +-- these are definitions from CCITT X.410 + +Priority ::= + INTEGER + +END diff --git a/usr/src/contrib/isode/acsap/aetdase.c b/usr/src/contrib/isode/acsap/aetdase.c new file mode 100644 index 0000000000..a654a57454 --- /dev/null +++ b/usr/src/contrib/isode/acsap/aetdase.c @@ -0,0 +1,669 @@ +/* aetdase.c - DASE-based DSE */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/aetdase.c,v 7.6 91/02/22 09:14:28 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/aetdase.c,v 7.6 91/02/22 09:14:28 mrose Interim $ + * + * + * $Log: aetdase.c,v $ + * Revision 7.6 91/02/22 09:14:28 mrose + * Interim 6.8 + * + * Revision 7.5 91/01/07 12:39:41 mrose + * update + * + * Revision 7.4 90/12/23 18:39:01 mrose + * update + * + * Revision 7.3 90/12/11 10:52:00 mrose + * lock-and-load + * + * Revision 7.2 90/10/29 18:37:54 mrose + * updates + * + * Revision 7.1 90/07/09 14:30:48 mrose + * sync + * + * Revision 7.0 90/07/07 16:11:32 mrose + * *** empty log message *** + * + */ + +/* + * 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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include +#include +#include "DASE-types.h" +#include "psap.h" +#include "tsap.h" +#include "dgram.h" +#include "tailor.h" + + +/* DATA */ + +static int stayopen = 0; + +static struct TSAPconnect tcs; +static PS ps = NULLPS; + + +static int armed = 0; +static int interrupted; +static jmp_buf intrenv; + +SFD intrser (); + + +struct element_DASE_1 *read_el (); + +/* LOOKUP */ + +/* ARGSUSED */ + +PE name2value_dase (name, context, ontty, userdn, passwd, real_name) +char *name, + *context, + *userdn, + *passwd; +int ontty; +PE *real_name; +{ + int done, + err, + nfds, + vecp; + fd_set ifds; + char *vec[NVEC + 1]; + PE pe = NULLPE, + result = NULLPE; + SFP istat; + register struct type_DASE_Query__REQ *parm = NULL; + + *real_name = NULLPE; + + if (ontty) { + istat = signal (SIGINT, intrser); + interrupted = 0; + } + + if (ps == NULLPS && dase_init () == NOTOK) { + if (ontty) + (void) signal (SIGINT, istat); + + return NULLPE; + } + err = 0; + + if (*name == '@') { + vec[vecp = 0] = name; + vecp++; + } + else + if ((vecp = sstr2arg (name, NVEC, vec, ",")) == NOTOK) { + PY_advise (NULLCP, "invalid name"); + goto out; + } + + if ((parm = (struct type_DASE_Query__REQ *) calloc (1, sizeof *parm)) + == NULL) { +no_mem: ; + PY_advise (NULLCP, "name2value_dase: out of memory"); + goto out; + } + { + register char **vp; + register struct element_DASE_0 *dl, + **dp; + + dp = &parm -> name; + for (vp = vec; vecp > 0; vp++, vecp--) { + if ((dl = (struct element_DASE_0 *) calloc (1, sizeof *dl)) + == NULL) + goto no_mem; + *dp = dl; + dp = &dl -> next; + + if ((dl -> IA5String = str2qb (*vp, strlen (*vp), 1)) == NULL) + goto no_mem; + } + } + parm -> interactive = ontty ? 1 : 0; + if ((parm -> envlist = read_el ()) == NULL) + goto out; + if ((parm -> context = str2qb (context, strlen (context), 1)) == NULL) + goto no_mem; + if (userdn + && (parm -> userdn = str2qb (userdn, strlen (userdn), 1)) == NULL) + goto no_mem; + if (passwd + && (parm -> passwd = str2qb (passwd, strlen (passwd), 1)) == NULL) + goto no_mem;; + + if (encode_DASE_Query__REQ (&pe, 1, NULL, NULLCP, parm) == NOTOK) + goto out; + + if ((err = pe2ps (ps, pe)) == NOTOK) { + PY_advise (NULLCP, "unable to write query [%s]", + ps_error (ps -> ps_errno)); + goto out; + } + PLOGP (addr_log,DASE_Message, pe, "message", 0); + + FD_ZERO (&ifds); + + nfds = tcs.tc_sd + 1; + FD_SET (tcs.tc_sd, &ifds); + + for (done = 0; !done; ) { + fd_set rfds; + struct type_DASE_Provider__RSP *rsp = NULL; + PE in; + + if (!interrupted) { + rfds = ifds; /* struct copy */ + + (void) xselect (nfds, &rfds, NULLFD, NULLFD, NOTOK); + } + + if (interrupted) { + PY_advise (NULLCP, "interrupted"); + break; + } + + if (!FD_ISSET (tcs.tc_sd, &rfds)) + continue; + + if ((in = ps2pe (ps)) == NULLPE) { + PY_advise (NULLCP, "unable to read response [%s]", + ps_error (ps -> ps_errno)); + err++; + break; + } + + if (decode_DASE_Provider__RSP (in, 1, NULLIP, NULLVP, &rsp) == NOTOK) { +you_lose: ; + pe_free (in); + if (rsp) + free_DASE_Provider__RSP (rsp); + err++; + break; + } + PLOGP (addr_log,DASE_Message, in, "message", 1); + + switch (rsp -> offset) { + case type_DASE_Provider__RSP_callback: + if (!ontty) { + PY_advise (NULLCP, "unexpected callback from nameservice"); + goto you_lose; + } + if (dase_callback (rsp -> un.callback) == NOTOK) + goto you_lose; + break; + + case type_DASE_Provider__RSP_answer: + { + register char *pp, + *ep; + register struct qbuf *p, + *q; + register struct type_DASE_Query__RSP *ans + = rsp -> un.answer; + + if ((q = ans -> friendly) && ontty) { + printf ("[ using "); + print_qb (q); + printf (" ]\n"); + (void) fflush (stdout); + } + *real_name = ans -> name, ans -> name = NULLPE; + result = ans -> value, ans -> value = NULLPE; + ep = (pp = PY_pepy) + BUFSIZ - 1; + if (q = ans -> diagnostic) + for (p = q -> qb_forw; + p != q && pp < ep; + pp += p -> qb_len, p = p -> qb_forw) + bcopy (p -> qb_data, pp, p -> qb_len); + *pp = NULL; + + done = 1; + } + break; + + default: + PY_advise (NULLCP, "unexpected response from nameservice: %d", + rsp -> offset); + goto you_lose; + } + + pe_free (in); + free_DASE_Provider__RSP (rsp); + } + +out: ; + if (result == NULLPE) + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy)); + if (parm) + free_DASE_Query__REQ (parm); + if (pe) + pe_free (pe); + if (ps && (err || !stayopen)) { + struct TSAPdisconnect tds; + + (void) TDiscRequest (tcs.tc_sd, NULLCP, 0, &tds); + ps_free (ps); + ps = NULLPS; + } + + if (ontty) + (void) signal (SIGINT, istat); + + return result; +} + +/* */ + +static int dase_init () { + int i, + nfds; + fd_set ifds; + register struct TSAPaddr *tz; + register struct TSAPconnect *tc = &tcs; + struct TSAPdisconnect tds; + register struct TSAPdisconnect *td = &tds; + + if ((tz = str2taddr (ns_address)) == NULL) { + PY_advise (NULLCP, "unable to parse nameservice address \"%s\"", + ns_address); +out: ; + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy)); + return NOTOK; + } + + if ((i = TAsynConnRequest (NULLTA, tz, 0, NULLCP, 0, NULLQOS, tc, td, 1)) + == NOTOK) { +you_lose: ; + PY_advise (NULLCP, td -> td_cc > 0 + ? "unable to connect to nameservice: [%s] %*.*s" + : "unable to connect to nameservice: [%s]", + TErrString (td -> td_reason), + td -> td_cc, td -> td_cc, td -> td_data); + goto out; + } + + FD_ZERO (&ifds); + + nfds = tc -> tc_sd + 1; + FD_SET (tc -> tc_sd, &ifds); + + while (i == CONNECTING_1 || i == CONNECTING_2) { + fd_set mask, + *rmask, + *wmask; + + if (!interrupted) { + mask = ifds; /* struct copy */ + if (i == CONNECTING_2) + rmask = &mask, wmask = NULLFD; + else + rmask = NULLFD, wmask = &mask; + + (void) xselect (nfds, rmask, wmask, NULLFD, NOTOK); + } + + if (interrupted) { + PY_advise (NULLCP, "interrupted"); + goto oops; + } + + if ((rmask && !FD_ISSET (tc -> tc_sd, rmask)) + || (wmask && !FD_ISSET (tc -> tc_sd, wmask))) + continue; + + if ((i = TAsynRetryRequest (tc -> tc_sd, tc, td)) == NOTOK) + goto you_lose; + } + + if ((ps = ps_alloc (dg_open)) == NULLPS + || dg_setup (ps, tc -> tc_sd, MAXDGRAM, ts_read, ts_write, NULLIFP) + == NOTOK) { + if (ps == NULLPS) + PY_advise (NULLCP, "ps_alloc: out of memory"); + else { + PY_advise (NULLCP, "dg_setup: %s", ps_error (ps -> ps_errno)); + ps_free (ps); + ps = NULL; + } + +oops: ; + (void) TDiscRequest (tcs.tc_sd, NULLCP, 0, td); + goto out; + } + + return OK; +} + +/* */ + +static int dase_callback (arg) +register struct type_DASE_Callback__REQ *arg; +{ + register int i, + j; + int result; + register struct element_DASE_3 *choice; + struct type_DASE_Callback__RSP *rsp = NULL; + register struct type_DASE_Callback__RSP **rp = &rsp; + PE pe = NULLPE; + + i = 0; + for (choice = arg -> choices; choice; choice = choice -> next) + i++; + + if (i > 10) { + printf ("%d imprecise matches for '", i); + print_qb (arg -> string); + printf ("', select fron them [y/n] ? "); + if (yesno () != OK) + goto send_rsp; + } + else { + printf ("Please select from the following %d match%s for '", + i, i != 1 ? "es" : ""); + print_qb (arg -> string); + printf ("':\n"); + } + + j = 1; + for (choice = arg -> choices; choice; choice = choice -> next) { + register struct type_DASE_Callback__RSP *yes; + + printf (" "); + print_qb (choice -> Pair -> friendly); + printf (" [y/n] ? "); + + switch (yesno ()) { + case DONE: + goto send_rsp; + + case NOTOK: + default: + break; + + case OK: + if ((yes = (struct type_DASE_Callback__RSP *) + calloc (1, sizeof *yes)) == NULL) { + PY_advise (NULLCP, "dase_callback: out of memory"); + result = NOTOK; + goto out; + } + *rp = yes, rp = &yes -> next; + + yes -> IA5String = choice -> Pair -> complete; + choice -> Pair -> complete = NULL; + break; + } + + if ((j++ % 10) == 0 && choice -> next) { + printf ("Continue (%d more) [y/n] ? ", i - j + 1); + if (yesno () != OK) + break; + } + } + +send_rsp: ; + if ((result = encode_DASE_Callback__RSP (&pe, 1, NULL, NULLCP, rsp)) + == NOTOK) + goto out; + if ((result = pe2ps (ps, pe)) == NOTOK) + PY_advise (NULLCP, "unable to write callback [%s]", + ps_error (ps -> ps_errno)); + else { + PLOGP (addr_log,DASE_Message, pe, "message", 0); + + result = OK; + } + +out: ; + if (rsp) + free_DASE_Callback__RSP (rsp); + if (pe) + pe_free (pe); + + return result; +} + +/* */ + +static int yesno () { + int x, + y, + result; + + if (interrupted) { + interrupted = 0; + return DONE; + } + + switch (setjmp (intrenv)) { + case OK: + armed++; + break; + + case NOTOK: + default: + printf ("\n"); + armed = 0; + return DONE; + } + +again: ; + x = y = getc (stdin); + while (y != '\n' && y != EOF) + y = getc (stdin); + + switch (x) { + case 'y': + case '\n': + result = OK; + break; + + case 'n': + result = NOTOK; + break; + + case EOF: + result = DONE; + clearerr (stdin); + break; + + default: + printf ("Please type 'y' or 'n': "); + goto again; + } + + armed = 0; + + return result; +} + + +static print_qb (q) +struct qbuf *q; +{ + register struct qbuf *p; + + for (p = q -> qb_forw; p != q; p = p -> qb_forw) + printf ("%*.*s", p -> qb_len, p -> qb_len, p -> qb_data); +} + +/* */ + +static struct element_DASE_1 *read_el () { + register int i; + register char *bp, + *cp; + char buffer[BUFSIZ], + ufnrc[BUFSIZ]; + FILE *fp; + struct element_DASE_1 *top; + register struct element_DASE_1 **etail; + register struct element_DASE_2 **dtail; + + if (bp = getenv ("UFNRC")) + (void) strcpy (ufnrc, bp); + else { + if ((bp = getenv ("HOME")) == NULL) + bp = "."; + + (void) sprintf (ufnrc, "%s/.ufnrc", bp); + } + + if ((fp = fopen (ufnrc, "r")) == NULL) { + (void) strcpy (ufnrc, isodefile ("ufnrc", 0)); + + if ((fp = fopen (ufnrc, "r")) == NULL) { + PY_advise (ufnrc, "unable to read"); + return NULL; + } + } + + top = NULL, etail = &top, dtail = NULL; + + for (i = 0; fgets (bp = buffer, sizeof buffer, fp); i++) { + register struct element_DASE_2 *dl; + + if (*buffer == '#') + continue; + if (bp = index (buffer, '\n')) + *bp = NULL; + + bp = buffer; + if (*bp == NULL) { + dtail = NULL; + continue; + } + + if (!isspace (*bp)) { + register char *dp; + register struct element_DASE_1 *el; + register struct type_DASE_Environment *fl; + + if ((el = (struct element_DASE_1 *) calloc (1, sizeof *el)) + == NULL) { +no_mem: ; + PY_advise (NULLCP, "real_el: out of memory"); + +out: ; + for (; top; top = el) { + el = top -> next; + + free_DASE_Environment (top -> Environment); + free ((char *) top); + } + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy)); + (void) fclose (fp); + return NULL; + } + *etail = el; + etail = &el -> next; + + if ((fl = (struct type_DASE_Environment *) calloc (1, sizeof *fl)) + == NULL) + goto no_mem; + el -> Environment = fl; + dtail = &fl -> path; + + if ((cp = index (bp, ':')) == NULL) { + PY_advise (NULLCP, "%s: missing ':' at line %d", ufnrc, i); + goto out; + } + *cp++ = NULL; + + if (dp = index (bp, ',')) { + *dp++ = NULL; + + while (isspace (*dp)) + dp++; + fl -> upper = *dp == '+' ? 32767 : atoi (dp); + } + else + fl -> upper = 0; + + fl -> lower = atoi (bp); + if (fl -> upper == 0) + fl -> upper = fl -> lower; + + bp = cp; + } + else + if (!dtail) { + PY_advise (NULLCP, "%s: unexpected blank at start of line %d", + ufnrc, i); + goto out; + } + + if ((dl = (struct element_DASE_2 *) calloc (1, sizeof *dl)) == NULL) + goto no_mem; + *dtail = dl; + dtail = &dl -> next; + + while (isspace (*bp)) + bp++; + if ((dl -> IA5String = str2qb (bp, strlen (bp), 1)) == NULL) + goto no_mem; + } + + (void) fclose (fp); + + return top; +} + +/* */ + +/* ARGSUSED */ + +static SFD intrser (sig) +int sig; +{ +#ifndef BSDSIGS + (void) signal (SIGINT, intrser); +#endif + + if (armed) + longjmp (intrenv, NOTOK); + + interrupted++; +} + +/* */ + +set_lookup_dase (flag) +char flag; +{ + if (!(stayopen = flag) && ps) { + struct TSAPdisconnect tds; + + (void) TDiscRequest (tcs.tc_sd, NULLCP, 0, &tds); + ps_free (ps); + ps = NULLPS; + } + + acsap_lookup = name2value_dase; +} diff --git a/usr/src/contrib/isode/acsap/aetseq.c b/usr/src/contrib/isode/acsap/aetseq.c new file mode 100644 index 0000000000..cb55d10a80 --- /dev/null +++ b/usr/src/contrib/isode/acsap/aetseq.c @@ -0,0 +1,119 @@ +/* aetseq.c - application entity titles -- sequential lookup */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/aetseq.c,v 7.1 91/02/22 09:14:30 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/aetseq.c,v 7.1 91/02/22 09:14:30 mrose Interim $ + * + * + * $Log: aetseq.c,v $ + * Revision 7.1 91/02/22 09:14:30 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:22:07 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "isoaddrs.h" + +/* DATA */ + +static char objent[BUFSIZ]; +static struct isoentity ies; + +/* */ + +int str2aet_seq (designator, qualifier, iep) +char *designator, + *qualifier; +struct isoentity *iep; +{ + int hitdes, + hitqual; + char descriptor[BUFSIZ], + desdflt[BUFSIZ], + qualdflt[BUFSIZ]; + register struct isoentity *ie; + struct isoentity ids, + iqs; + + (void) sprintf (objent, "%s-%s", designator, qualifier); + (void) sprintf (desdflt, "%s-%s", designator, "default"); + (void) sprintf (qualdflt, "%s-%s", "default", qualifier); + hitdes = hitqual = 0; + bzero ((char *) &ids, sizeof ids); + bzero ((char *) &iqs, sizeof iqs); + + ie = NULL; + + if (!setisoentity (0)) + return NOTOK; + while (_startisoentity (descriptor) == OK) { + if (strcmp (descriptor, objent) == 0) { + if (_stopisoentity (descriptor, &ies) != OK) + continue; + + ie = &ies; + break; + } + + if (!hitdes && strcmp (descriptor, desdflt) == 0) { + if (_stopisoentity (descriptor, &ies) != OK) + continue; + ies.ie_descriptor = objent; + + hitdes++; + ids = ies; /* struct copy */ + continue; + } + + if (!hitqual && strcmp (descriptor, qualdflt) == 0) { + if (_stopisoentity (descriptor, &ies) != OK) + continue; + ies.ie_descriptor = objent; + + hitqual++; + iqs = ies; /* struct copy */ + continue; + } + } + (void) endisoentity (); + + if (!ie && hitqual) { + ie = &ies; + *ie = iqs; /* struct copy */ + + if (hitdes) { + bcopy ((char *) ids.ie_addr.pa_addr.sa_addr.ta_addrs, + (char *) ie -> ie_addr.pa_addr.sa_addr.ta_addrs, + sizeof ie -> ie_addr.pa_addr.sa_addr.ta_addrs); + ie -> ie_addr.pa_addr.sa_addr.ta_naddr = + ids.ie_addr.pa_addr.sa_addr.ta_naddr; + } + } + + if (ie) { + *iep = *ie; /* struct copy */ + return OK; + } + + return NOTOK; +} diff --git a/usr/src/contrib/isode/acsap/dase.py b/usr/src/contrib/isode/acsap/dase.py new file mode 100644 index 0000000000..665a7176ca --- /dev/null +++ b/usr/src/contrib/isode/acsap/dase.py @@ -0,0 +1,152 @@ +-- dase.py - co-resident DASE + +-- $Header: /f/osi/acsap/RCS/dase.py,v 7.3 91/02/22 09:14:31 mrose Interim $ +-- +-- +-- $Log: dase.py,v $ +-- Revision 7.3 91/02/22 09:14:31 mrose +-- Interim 6.8 +-- +-- Revision 7.2 90/12/11 10:52:03 mrose +-- lock-and-load +-- +-- Revision 7.1 90/07/09 14:30:53 mrose +-- sync +-- +-- Revision 7.0 90/07/07 16:11:33 mrose +-- *** empty log message *** +-- + +-- +-- 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. +-- +-- + + +DASE DEFINITIONS ::= + +%{ +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/dase.py,v 7.3 91/02/22 09:14:31 mrose Interim $"; +#endif +%} + +BEGIN + +Query-REQ ::= + [0] IMPLICIT + SEQUENCE { + name -- e.g., "cs, ucl, gb" + SEQUENCE OF + IA5String, + + interactive -- true IFF allow callbacks + BOOLEAN, + + envlist -- search list + SEQUENCE OF + Environment, + + context -- e.g., "iso ftam" + IA5String, + + userdn -- DN for binding + IA5String + OPTIONAL, + + passwd -- for simple authentication + IA5String + OPTIONAL + } + +Environment ::= + SEQUENCE { + upper + INTEGER, + + lower + INTEGER, + + path + SEQUENCE OF + IA5String + } + +Callback-REQ ::= + [1] IMPLICIT + SEQUENCE { + string -- e.g., "smith" + IA5String, + + choices -- list of possible matches + SEQUENCE OF + Pair + } + +Pair ::= + SEQUENCE { + friendly + IA5String, + + complete + IA5String + } + +Callback-RSP ::= + [2] IMPLICIT + SEQUENCE OF + IA5String + +Query-RSP ::= + [3] IMPLICIT + SEQUENCE { + friendly[0] -- friendly name + IA5String + OPTIONAL, + + name[1] -- a DN in Directory ASN + ANY + OPTIONAL, + + value[2] -- a PSAPaddr in Directory ASN + ANY + OPTIONAL, + + diagnostic[3] -- in case of error + IA5String + OPTIONAL + } + + +-- auxiliary types to make coding easier + +Message ::= + CHOICE { + query-request + Query-REQ, + + callback-request + Callback-REQ, + + callback-response + Callback-RSP, + + query-response + Query-RSP + } + +Provider-RSP ::= + CHOICE { + callback + Callback-REQ, + + answer + Query-RSP + } + +END diff --git a/usr/src/contrib/isode/acsap/dased.8c b/usr/src/contrib/isode/acsap/dased.8c new file mode 100644 index 0000000000..3e28af13d4 --- /dev/null +++ b/usr/src/contrib/isode/acsap/dased.8c @@ -0,0 +1,79 @@ +.TH DASED 8C "07 Jul 1990" +.\" $Header: /f/osi/acsap/RCS/dased.8c,v 7.5 91/02/22 09:14:32 mrose Interim $ +.\" +.\" +.\" $Log: dased.8c,v $ +.\" Revision 7.5 91/02/22 09:14:32 mrose +.\" Interim 6.8 +.\" +.\" Revision 7.4 90/12/19 09:16:00 mrose +.\" touch-up +.\" +.\" Revision 7.3 90/12/17 22:12:48 mrose +.\" -call +.\" +.\" Revision 7.2 90/12/11 10:52:05 mrose +.\" lock-and-load +.\" +.\" Revision 7.1 90/07/09 14:30:55 mrose +.\" sync +.\" +.\" Revision 7.0 90/07/07 16:30:47 mrose +.\" *** empty log message *** +.\" +.SH NAME +dased \- stand-alone DASE +.SH SYNOPSIS +.in +.5i +.ti -.6i +.B \*(SDdased +\%[\-d] +\%[\-a\0address] +\%[\-c\0DSA-name-or-address] +\%[\-u\0username] \%[\-p\0password] +.in -.5i +.SH DESCRIPTION +The \fIdased\fR program is used as a name/address resolver for the ISODE. +If the tailoring option \fIns_enable\fR is \*(lqon\*(rq, +then ISODE programs may contact \fIdased\fR to map service +descriptions into Distinguished Names and Presentation Addresses. +.PP +The \fIns_address\fR tailoring option indicates the transport address +which \fIdased\fR should listen on. +This may be overriden with the `\-a' option. +.PP +Note that unlike previous versions of the nameservice, +\fIdased\fR uses the OSI CO-mode transport service as backing. +As such, +any valid OSI transport address may be used for listening. +.PP +By default, +\fIdased\fR will use non-authentication when binding to the Directory. +If desired, +a username (DN) and a password can be supplied using the `\-u' and `\-p' +switches can be used (respectively). +Further, +\fIdased\fR will connect to the default local DSA +(the first entry in the \fIdsaptailor\fR file). +If desired, +the name or address of another DSA can be suppoed using the `\-c' switch. +.SH "DEBUG OPERATION" +If \fIdased\fR is started interactively, +or if the `\-d' switch is given, +then debug mode is entered. +In this case, +all logging activity is displayed on the user's terminal, +the logging information is more verbose, +and \fIdased\fR will terminate after it handles the first incoming connection +(this allows \fIdased\fR to be run under a debugger). +.SH FILES +.nf +.ta \w'\*(LDtsapd.log 'u +\*(EDisotailor ISODE tailoring file +\*(LDdased.log log file +.re +.fi +.SH "SEE ALSO" +isotailor(5) +.SH AUTHOR +Marshall T. Rose diff --git a/usr/src/contrib/isode/acsap/dased.c b/usr/src/contrib/isode/acsap/dased.c new file mode 100644 index 0000000000..133f71632d --- /dev/null +++ b/usr/src/contrib/isode/acsap/dased.c @@ -0,0 +1,1044 @@ +/* dased.c - stand-alone DASE */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/dased.c,v 7.9 91/02/22 09:14:33 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/dased.c,v 7.9 91/02/22 09:14:33 mrose Interim $ + * + * + * $Log: dased.c,v $ + * Revision 7.9 91/02/22 09:14:33 mrose + * Interim 6.8 + * + * Revision 7.8 91/01/07 12:39:44 mrose + * update + * + * Revision 7.7 90/12/23 18:39:06 mrose + * update + * + * Revision 7.6 90/12/17 22:12:53 mrose + * -call + * + * Revision 7.5 90/12/11 10:52:08 mrose + * lock-and-load + * + * Revision 7.4 90/11/04 19:14:45 mrose + * update + * + * Revision 7.3 90/10/29 18:37:57 mrose + * updates + * + * Revision 7.2 90/07/27 08:41:41 mrose + * update + * + * Revision 7.1 90/07/09 14:30:57 mrose + * sync + * + * Revision 7.0 90/07/07 16:11:31 mrose + * *** empty log message *** + * + */ + +/* + * 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 +#include +#include +#include "manifest.h" +#include +#ifdef BSD42 +#include +#endif +#ifdef SYS5 +#include +#endif +#include "DASE-types.h" +#include "psap.h" +#include "tsap.h" +#include "dgram.h" +#include "tailor.h" + +#include "quipu/ufn.h" +#include "quipu/util.h" +#include "quipu/read.h" +#include "quipu/dua.h" +#include "quipu/bind.h" + + +#ifdef DEBUG +#define STATS +#endif + +/* */ + +static int debug = 0; +static int nbits = FD_SETSIZE; + +static LLog _pgm_log = { + "dased.log", NULLCP, NULLCP, + LLOG_FATAL | LLOG_EXCEPTIONS | LLOG_NOTICE, LLOG_FATAL, + -1, LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; + +static LLog *pgm_log = &_pgm_log; + +static char *pgmname = "dased"; + +static struct TSAPaddr tas; + +static int isbound = 0; +static int prebind = 0; +extern int dsap_ad; + +static DN userdn = NULL; +static char passwd[DBA_MAX_PASSWD_LEN]; + +static PS ps; +static PS nps; + + +int dns_compar (); +DNS dase_interact (), just_say_no (); +PE name2psap (); + +void adios (), advise (), ts_adios (), ts_advise (); + + +char *dn2str (); +PE grab_pe (); + +/* */ + +/* ARGSUSED */ + +main (argc, argv, envp) +int argc; +char **argv, + **envp; +{ + int vecp; + char *vec[4]; + struct TSAPdisconnect tds; + register struct TSAPdisconnect *td = &tds; + + arginit (argv); + envinit (); + + advise (LLOG_NOTICE, NULLCP, "listening on %s", taddr2str (&tas)); + if (TNetListen (&tas, td) == NOTOK) + ts_adios (td, "TNetListen failed"); + + for (;;) { + int nfds, + secs; + fd_set ifds, + *rfds; + + if (!isbound && prebind) + (void) bind_to_dsa (); + + if (isbound) { + rfds = &ifds; + + nfds = dsap_ad + 1; + + FD_ZERO (rfds); + FD_SET (dsap_ad, rfds); + + secs = NOTOK; + } + else + nfds = 0, rfds = NULLFD, secs = prebind ? 5 * 60L : NOTOK; + + if (TNetAcceptAux (&vecp, vec, NULLIP, NULLTA, nfds, rfds, NULLFD, + NULLFD, secs, td) == NOTOK) { + ts_advise (td, LLOG_EXCEPTIONS, "TNetAccept failed"); + continue; + } + + if (rfds && FD_ISSET (dsap_ad, rfds)) { /* DSA timed us out... */ + if (debug) + advise (LLOG_DEBUG, NULLCP, "unbound from directory"); + + (void) ds_unbind (); + isbound = 0; + } + + if (vecp <= 0) + continue; + + if (debug) + break; + + switch (TNetFork (vecp, vec, td)) { + case OK: + ll_hdinit (pgm_log, pgmname); + break; + + case NOTOK: + ts_advise (td, LLOG_EXCEPTIONS, "TNetFork failed"); + continue; + + default: + if (isbound) { + if (dsap_ad != NOTOK) + (void) close (dsap_ad), dsap_ad = NOTOK; + isbound = 0; + } + continue; + } + break; + } + + dased (vecp, vec); +} + +/* DASE */ + +static dased (vecp, vec) +int vecp; +char **vec; +{ + int sd; + struct TSAPstart tss; + register struct TSAPstart *ts = &tss; + struct TSAPdisconnect tds; + register struct TSAPdisconnect *td = &tds; + + if (TInit (vecp, vec, ts, td) == NOTOK) + ts_adios (td, "T-CONNECT.INDICATION failed"); + + sd = ts -> ts_sd; + advise (LLOG_NOTICE, NULLCP, "T-CONNECT.INDICATION: <%d, %s, %s, %d, %d>", + ts -> ts_sd, taddr2str (&ts -> ts_calling), + taddr2str (&ts -> ts_called), ts -> ts_expedited, + ts -> ts_tsdusize); + + if (TConnResponse (sd, NULLTA, 0, NULLCP, 0, NULLQOS, td) == NOTOK) + ts_adios (td, "T-CONNECT.RESPONSE failed"); + + if ((ps = ps_alloc (dg_open)) == NULLPS) + adios (NULLCP, "ps_alloc: out of memory"); + if (dg_setup (ps, sd, MAXDGRAM, ts_read, ts_write, NULLIFP) == NOTOK) + adios (NULLCP, "dg_setup: %s", ps_error (ps -> ps_errno)); + + for (;;) { + struct type_DASE_Query__REQ *req; + PE pe; + + if ((pe = ps2pe (ps)) == NULLPE) { + if (ps -> ps_errno == PS_ERR_NONE) { + advise (LLOG_NOTICE, NULLCP, "T-DISCONNECT.INDICATION"); + break; + } + else + adios (NULLCP, "ps2pe: %s", ps_error (ps -> ps_errno)); + } + + if (decode_DASE_Query__REQ (pe, 1, NULLIP, NULLVP, &req) == NOTOK) + adios (NULLCP, "decode_DASE_Query__REQ: %s", PY_pepy); + PLOGP (pgm_log,DASE_Message, pe, "message", 1); + + dase_aux (req); + + free_DASE_Query__REQ (req); + pe_free (pe); + } + + if (isbound) { + if (debug) + advise (LLOG_DEBUG, NULLCP, "unbound from directory"); + + (void) ds_unbind (); + isbound = 0; + } + + exit (0); +} + +/* */ + +static dase_aux (req) +register struct type_DASE_Query__REQ *req; +{ + register int i; + int vecp; + register char **vp; + char *context, + **vec; + register struct type_DASE_Query__RSP *rsp; + register struct element_DASE_0 *d0; + register struct element_DASE_1 *d1; + envlist el; + register envlist en, + *ep; + DN *dn; + DNS dns; + PE pe; + + if ((rsp = (struct type_DASE_Query__RSP *) calloc (1, sizeof *rsp)) + == NULL) { +no_mem: ; + adios (NULLCP, "out of memory"); + } + + vec = NULL, el = NULL, context = NULL, dns = NULL; + + i = 1; + for (d0 = req -> name; d0; d0 = d0 -> next) + i++; + if ((vec = (char **) calloc ((unsigned) i, sizeof *vec)) == NULL) + goto no_mem; + for (vp = vec, d0 = req -> name; d0; vp++, d0 = d0 -> next) + if ((*vp = qb2str (d0 -> IA5String)) == NULL) + goto no_mem; +#ifdef STATS + else + advise (LLOG_NOTICE, NULLCP, "lookup: %s", *vp); +#endif + vecp = i - 1; + + el = NULL, ep = ⪙ + for (d1 = req -> envlist; d1; d1 = d1 -> next) { + struct type_DASE_Environment *ev = d1 -> Environment; + register struct element_DASE_2 *d2; + register struct dn_seq **dp; + + if ((en = (envlist) calloc (1, sizeof *en)) == NULL) + goto no_mem; + *ep = en, ep = &en -> Next; + + en -> Upper = ev -> upper; + en -> Lower = ev -> lower; + + dp = &en -> Dns; + for (d2 = ev -> path; d2; d2 = d2 -> next) { + char *cp; + register struct dn_seq *ds; + + if ((ds = (struct dn_seq *) calloc (1, sizeof *ds)) == NULL) + goto no_mem; + *dp = ds, dp = &ds -> dns_next; + + if ((cp = qb2str (d2 -> IA5String)) == NULL) + goto no_mem; + if (*cp != '-') + ds -> dns_dn = str2dn (cp); + free (cp); + + if (*cp != '-' && ds -> dns_dn == NULLDN) { + PY_advise (NULLCP, "bad DN in environment (%s)", cp); + goto send_rsp; + } + } + } + + if ((context = qb2str (req -> context)) == NULL) + goto no_mem; +#ifdef STATS + advise (LLOG_NOTICE, NULLCP, "context: %s", context); +#endif + + if (req -> userdn) { + int changed = 0; + char *cp; + DN newdn; + + if ((cp = qb2str (req -> userdn)) == NULL) + goto no_mem; +#ifdef STATS + advise (LLOG_NOTICE, NULLCP, "userdn: %s", cp); +#endif + if ((newdn = str2dn (*cp != '@' ? cp : cp + 1)) == NULLDN) { + PY_advise (NULLCP, "bad DN for userdn (%s)", cp); + free (cp); + goto send_rsp; + } + if (!userdn || dn_cmp (userdn, newdn)) + changed++; + if (userdn) + dn_free (userdn); + userdn = newdn; + free (cp); + + if (req -> passwd) { + if ((cp = qb2str (req -> passwd)) == NULL) + goto no_mem; + if (strcmp (passwd, cp)) + changed++; + (void) strcpy (passwd, cp); + free (cp); + } + else { + if (passwd[0]) + changed++; + passwd[0] = NULL; + } + + if (isbound && changed) { + (void) ds_unbind (); + isbound = 0; + } + } + + if (!isbound && bind_to_dsa () == NOTOK) + goto send_rsp; + + PY_pepy[0] = NULL; + pe = NULLPE; + if (vecp == 1 && *vec[0] == '@') { + static DN dnstat; + + if ((dnstat = str2dn (vec[0])) == NULLDN) { + PY_advise (NULLCP, "invalid name"); + goto send_rsp; + } + + rsp -> value = name2psap (*(dn = &dnstat)); + goto all_done; + } + + if (!aet_match (vecp, vec, req -> interactive ? dase_interact + : just_say_no, + &dns, el, context)) { + if (PY_pepy[0] == NULL) + PY_advise (NULLCP, "unable to resolve name"); + goto send_rsp; + } + + if (dns == NULL) { + PY_advise (NULLCP, "search failed to find anything"); + goto send_rsp; + } + dn = NULL; + + if (dns -> dns_next) { + if (req -> interactive) + (void) dnSelect (vec[0], &dns, dase_interact, el -> Dns); + + for (; dns; dns = dns -> dns_next) { + dn = &dns -> dns_dn; + if (rsp -> value = name2psap (*dn)) + break; + } + } + else { + dn = &dns -> dns_dn; + rsp -> value = name2psap (*dn); + } + +all_done: ; + if (dn) { + (void) encode_IF_DistinguishedName (&rsp -> name, 1, NULL, NULLCP,*dn); +#ifdef STATS + advise (LLOG_NOTICE, NULLCP, "answer: %s", dn2str (*dn)); +#endif + + ufn_dn_print_aux (nps, *dn, NULLDN, 0); + ps_print (nps, " "); + *--nps -> ps_ptr = NULL, nps -> ps_cnt++; + + rsp -> friendly = str2qb (nps -> ps_base, strlen (nps -> ps_base), 1); + + nps -> ps_ptr = nps -> ps_base, nps -> ps_cnt = nps -> ps_bufsiz; + + dn_free (*dn); + *dn = NULLDN; + } + +send_rsp: ; + if (PY_pepy[0]) { + advise (LLOG_NOTICE, NULLCP, "diagnostic: %s", PY_pepy); + + if ((rsp -> diagnostic = str2qb (PY_pepy, strlen (PY_pepy), 1)) + == NULL) + goto no_mem; + } + + if (encode_DASE_Query__RSP (&pe, 1, NULL, NULLCP, rsp) == NOTOK) + adios (NULLCP, "encode_DASE_Query__RSP: %s", PY_pepy); + if (pe2ps (ps, pe) == NOTOK) + adios (NULLCP, "pe2ps: %s", ps_error (ps -> ps_errno)); + PLOGP (pgm_log,DASE_Message, pe, "message", 0); + + free_DASE_Query__RSP (rsp); + pe_free (pe); + + if (vec) { + for (vp = vec; *vp; vp++) + free (*vp); + free ((char *) vec); + } + + for (; el; el = en) { + en = el -> Next; + + dn_seq_free (el -> Dns); + free ((char *) el); + } + + if (context) + free (context); + + if (dns) + dn_seq_free (dns); +} + +/* */ + +static bind_to_dsa () +{ + struct ds_bind_arg ba; + struct ds_bind_arg br; + struct ds_bind_error be; + static int very_first_time = 1; + + if (isbound) { + if (debug) + advise (LLOG_DEBUG, NULLCP, "unbound from directory"); + + (void) ds_unbind (); + isbound = 0; + } + + make_bind_args (&ba, &br, &be); + + if (ds_bind (&ba, &be, &br) == DS_OK) { + isbound = 1; + very_first_time = 0; + if (debug) + advise (LLOG_DEBUG, NULLCP, "bound to directory"); + + return OK; + } + + PY_advise (NULLCP, "unable to bind to directory (%s)", + be.dbe_type == DBE_TYPE_SECURITY ? "security error" + : "DSA unavailable"); + if (prebind && very_first_time) + very_first_time = 0; + else + advise (LLOG_EXCEPTIONS, NULLCP, "%s", PY_pepy); + + return NOTOK; +} + +/* */ + +static int make_bind_args (ba, br, be) +register struct ds_bind_arg *ba, + *br; +register struct ds_bind_error *be; +{ + bzero ((char *) ba, sizeof *ba); + bzero ((char *) br, sizeof *br); + bzero ((char *) be, sizeof *be); + + ba -> dba_version = DBA_VERSION_V1988; + if (ba -> dba_dn = userdn) + ba -> dba_auth_type = DBA_AUTH_SIMPLE; + if (ba -> dba_passwd_len = strlen (passwd)) + (void) strcpy (ba -> dba_passwd, passwd); +} + +/* */ + +static DNS dase_interact (dns, dn, s) +DNS dns; +DN dn; +char *s; +{ + register int i; + register struct type_DASE_Callback__REQ *req = NULL; + register struct element_DASE_3 **dp; + struct type_DASE_Callback__RSP *rsp = NULL; + register struct type_DASE_Callback__RSP *rp; + DNS ds, + *dq; + PE pe = NULLPE; + + if (dns == NULLDNS) + return NULL; + + i = 0; + for (ds = dns; ds; ds = ds -> dns_next) + i++; + + if (i > 1) { + struct dn_seq **base, + **bp, + **ep; + + if (base = (struct dn_seq **) malloc ((unsigned) (i * sizeof *base))) { + ep = base; + for (ds = dns; ds; ds = ds -> dns_next) + *ep++ = ds; + + qsort ((char *) base, i, sizeof *base, dns_compar); + + bp = base; + ds = dns = *bp++; + while (bp < ep) { + ds -> dns_next = *bp; + ds = *bp++; + } + ds -> dns_next = NULL; + + free ((char *) base); + } + } + + if ((req = (struct type_DASE_Callback__REQ *) calloc (1, sizeof *req)) + == NULL) { +no_mem: ; + advise (LLOG_EXCEPTIONS, NULLCP, "out of memory"); +out: ; + if (req) + free_DASE_Callback__REQ (req); + if (rsp) + free_DASE_Callback__RSP (rsp); + if (pe) + pe_free (pe); + + dn_seq_free (dns); + return NULL; + } + if ((req -> string = str2qb (s, strlen (s), 1)) == NULL) + goto no_mem; + + dp = &req -> choices; + for (; dns; dns = ds) { + register struct element_DASE_3 *d3; + register struct type_DASE_Pair *pair; + + if ((d3 = (struct element_DASE_3 *) calloc (1, sizeof *d3)) == NULL) + goto no_mem; + *dp = d3, dp = &d3 -> next; + + if ((pair = (struct type_DASE_Pair *) calloc (1, sizeof *pair)) + == NULL) + goto no_mem; + d3 -> Pair = pair; + + dn_print (nps, dns -> dns_dn, EDBOUT); + ps_print (nps, " "); + *--nps -> ps_ptr = NULL, nps -> ps_cnt++; + + pair -> complete = str2qb (nps -> ps_base, strlen (nps -> ps_base), 1); + + nps -> ps_ptr = nps -> ps_base, nps -> ps_cnt = nps -> ps_bufsiz; + + ufn_dn_print_aux (nps, dns -> dns_dn, dn, 0); + ps_print (nps, " "); + *--nps -> ps_ptr = NULL, nps -> ps_cnt++; + + pair -> friendly = str2qb (nps -> ps_base, strlen (nps -> ps_base), 1); + + nps -> ps_ptr = nps -> ps_base, nps -> ps_cnt = nps -> ps_bufsiz; + + if (pair -> complete == NULL || pair -> friendly == NULL) + goto no_mem; + + ds = dns -> dns_next; + + dn_free (dns -> dns_dn); + free ((char *) dns); + } + + dns = NULL; + + if (encode_DASE_Callback__REQ (&pe, 1, NULL, NULLCP, req) == NOTOK) { + advise (LLOG_EXCEPTIONS, NULLCP, "encode_DASE_Callback__REQ: %s", + PY_pepy); + goto out; + } + if (pe2ps (ps, pe) == NOTOK) + adios (NULLCP, "pe2ps: %s", ps_error (ps -> ps_errno)); + PLOGP (pgm_log,DASE_Message, pe, "message", 0); + + free_DASE_Callback__REQ (req); + req = NULL; + pe_free (pe); + + if ((pe = ps2pe (ps)) == NULLPE) + adios (NULLCP, "ps2pe: %s", ps_error (ps -> ps_errno)); + + if (decode_DASE_Callback__RSP (pe, 1, NULLIP, NULLVP, &rsp) == NOTOK) { + advise (LLOG_EXCEPTIONS, NULLCP, "decode_DASE_Callback__RSP: %s", + PY_pepy); + goto out; + } + PLOGP (pgm_log,DASE_Message, pe, "message", 1); + + dq = &dns; + for (rp = rsp; rp; rp = rp -> next) { + char *cp; + + if ((ds = (struct dn_seq *) calloc (1, sizeof *ds)) == NULL) + goto no_mem; + *dq = ds, dq = &ds -> dns_next; + + if ((cp = qb2str (rp -> IA5String)) == NULL) + goto no_mem; + ds -> dns_dn = str2dn (cp); + free (cp); + } + + free_DASE_Callback__RSP (rsp); + pe_free (pe); + + return dns; +} + +/* */ + +static int dns_compar (a, b) +struct dn_seq **a, + **b; +{ + int i; + DN adn, + bdn; + + for (adn = (*a) -> dns_dn; adn -> dn_parent; adn = adn -> dn_parent) + continue; + for (bdn = (*b) -> dns_dn; bdn -> dn_parent; bdn = bdn -> dn_parent) + continue; + + i = rdn_cmp (adn -> dn_rdn, bdn -> dn_rdn); + return (i == (-1) || i == 1 ? i : 0); +} + +/* */ + +/* ARGSUSED */ + +static DNS just_say_no (dns, dn, s) +DNS dns; +DN dn; +char *s; +{ + dn_seq_free (dns); + + return NULL; +} + +/* */ + +static PE name2psap (dn) +DN dn; +{ + int i; + AttributeType at; + PE pe; +static struct ds_read_arg read_arg = + { + default_common_args, + NULLDN, /* read_arg DN */ + { /* entry info selection */ + FALSE, + NULLATTR, + EIS_ATTRIBUTESANDVALUES + } + }; + struct DSError error; + struct ds_read_result result; + + if ((at = AttrT_new (DSAADDRESS_OID)) == NULLAttrT) { + PY_advise (NULLCP, "build of attribute failed (%s)", DSAADDRESS_OID); + return NULLPE; + } + + read_arg.rda_common.ca_servicecontrol.svc_prio = SVC_PRIO_HIGH; + read_arg.rda_object = dn; + read_arg.rda_eis.eis_select = as_comp_new (AttrT_cpy (at), NULLAV, + NULLACL_INFO); + + i = ds_read (&read_arg, &error, &result); + + AttrT_free (at); + as_free (read_arg.rda_eis.eis_select); + + if (i != DS_OK) { + PY_advise (NULLCP, "DAP lookup failed (%s)", dn2str (dn)); + return NULLPE; + } + + if (result.rdr_entry.ent_attr == NULLATTR) { + PY_advise (NULLCP, "no '%s' attribute in entry '%s'", + DSAADDRESS_OID, dn2str (dn)); + return NULLPE; + } + + pe = grab_pe (&result.rdr_entry.ent_attr -> attr_value -> avseq_av); + as_free (result.rdr_entry.ent_attr); + return pe; +} + +/* INIT */ + +static arginit (vec) +char **vec; +{ + int argp; + register char *ap; + char **argptr, + *args[4]; + register struct TSAPaddr *ta = NULL; + + if (pgmname = rindex (*vec, '/')) + pgmname++; + if (pgmname == NULL || *pgmname == NULL) + pgmname = *vec; + + isodetailor (pgmname, 0); + ll_hdinit (pgm_log, pgmname); + + quipu_syntaxes (); + + argp = 0; + args[argp++] = pgmname; + for (argptr = vec, argptr++; ap = *argptr; argptr++) { + if (*ap == '-') + switch (*++ap) { + case 'a': + case 'u': + case 'p': + if ((ap = *++argptr) == NULL || *ap == '-') + break; + continue; + + case 'c': + if ((ap = *++argptr) == NULL || *ap == '-') + break; + args[argp++] = "-c"; + args[argp++] = ap; + break; + + default: + continue; + } + + break; + } + args[argp] = NULLCP; + + dsap_init (&argp, (argptr = args, &argptr)); + + userdn = NULLDN, passwd[0] = NULL; + for (vec++; ap = *vec; vec++) { + if (*ap == '-') + switch (*++ap) { + case 'a': + if ((ap = *++vec) == NULL || *ap == '-') + adios (NULLCP, "usage: %s -a address", pgmname); + if ((ta = str2taddr (ap)) == NULLTA) + adios (NULLCP, "bad address \"%s\"", ap); + continue; + + case 'b': + prebind++; + continue; + + case 'd': + debug++; + continue; + + case 'c': + if ((ap = *++vec) == NULL || *ap == '-') + adios (NULLCP, "usage: %s -c DSA-name-or-address", + pgmname); + continue; + + case 'u': + if ((ap = *++vec) == NULL || *ap == '-') + adios (NULLCP, "usage: %s -u username", pgmname); + if ((userdn = str2dn (*ap != '@' ? ap : ap + 1)) == NULLDN) + adios (NULLCP, "invalid DN for username: %s", ap); + bzero ((char *) ap, strlen (ap)); + continue; + + case 'p': + if ((ap = *++vec) == NULL || *ap == '-') + adios (NULLCP, "usage: %s -p passwd", pgmname); + (void) strcpy (passwd, ap); + bzero ((char *) ap, strlen (ap)); + continue; + + default: + adios (NULLCP, "unknown switch -%s", ap); + } + + adios (NULLCP, "usage: %s [switches]", pgmname); + } + + if (ta == NULL && (ta = str2taddr (ns_address)) == NULLTA) + adios (NULLCP, "bad default address \"%s\"", ns_address); + tas = *ta; /* struct copy */ + + if ((nps = ps_alloc (str_open)) == NULLPS) + adios (NULLCP, "ps_alloc: out of memory"); + if (str_setup (nps, NULLCP, 0, 0) == NOTOK) + adios (NULLCP, "str_setup: %s", ps_error (ps -> ps_errno)); +} + +/* */ + +static envinit () { + int i, + sd; + + nbits = getdtablesize (); + + if (debug == 0 && !(debug = isatty (2))) { + for (i = 0; i < 5; i++) { + switch (fork ()) { + case NOTOK: + sleep (5); + continue; + + case OK: + break; + + default: + _exit (0); + } + break; + } + + (void) chdir ("/"); + + if ((sd = open ("/dev/null", O_RDWR)) == NOTOK) + adios ("/dev/null", "unable to read"); + if (sd != 0) + (void) dup2 (sd, 0), (void) close (sd); + (void) dup2 (0, 1); + (void) dup2 (0, 2); + +#ifdef SETSID + if (setsid () == NOTOK) + advise (LLOG_EXCEPTIONS, "failed", "setsid"); +#endif +#ifdef TIOCNOTTY + if ((sd = open ("/dev/tty", O_RDWR)) != NOTOK) { + (void) ioctl (sd, TIOCNOTTY, NULLCP); + (void) close (sd); + } +#else +#ifdef SYS5 + (void) setpgrp (); + (void) signal (SIGINT, SIG_IGN); + (void) signal (SIGQUIT, SIG_IGN); +#endif +#endif + } + else + ll_dbinit (pgm_log, pgmname); + +#ifndef sun /* damn YP... */ + for (sd = 3; sd < nbits; sd++) + if (pgm_log -> ll_fd != sd) + (void) close (sd); +#endif + + (void) signal (SIGPIPE, SIG_IGN); + + ll_hdinit (pgm_log, pgmname); + advise (LLOG_NOTICE, NULLCP, "starting"); +} + +/* ERRORS */ + +#ifndef lint +static void adios (va_alist) +va_dcl +{ + va_list ap; + + va_start (ap); + + _ll_log (pgm_log, LLOG_FATAL, ap); + + va_end (ap); + + _exit (1); +} +#else +/* VARARGS */ + +static void adios (what, fmt) +char *what, + *fmt; +{ + adios (what, fmt); +} +#endif + + +#ifndef lint +static void advise (va_alist) +va_dcl +{ + int code; + va_list ap; + + va_start (ap); + + code = va_arg (ap, int); + + _ll_log (pgm_log, code, ap); + + va_end (ap); +} +#else +/* VARARGS */ + +static void advise (code, what, fmt) +char *what, + *fmt; +int code; +{ + advise (code, what, fmt); +} +#endif + +/* */ + +static void ts_adios (td, event) +register struct TSAPdisconnect *td; +char *event; +{ + ts_advise (td, LLOG_EXCEPTIONS, event); + + exit (1); +} + +/* */ + +static void ts_advise (td, code, event) +register struct TSAPdisconnect *td; +int code; +char *event; +{ + char buffer[BUFSIZ]; + + if (td -> td_cc > 0) + (void) sprintf (buffer, "[%s] %*.*s", + TErrString (td -> td_reason), + td -> td_cc, td -> td_cc, td -> td_data); + else + (void) sprintf (buffer, "[%s]", TErrString (td -> td_reason)); + + advise (code, NULLCP, "%s: %s", event, buffer); +} diff --git a/usr/src/contrib/isode/acsap/dse-c.c b/usr/src/contrib/isode/acsap/dse-c.c new file mode 100644 index 0000000000..582489f7e7 --- /dev/null +++ b/usr/src/contrib/isode/acsap/dse-c.c @@ -0,0 +1,218 @@ +/* dse-c.c - DSE wrapper for pepsy */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/dse-c.c,v 7.5 91/02/22 09:14:36 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/dse-c.c,v 7.5 91/02/22 09:14:36 mrose Interim $ + * + * + * $Log: dse-c.c,v $ + * Revision 7.5 91/02/22 09:14:36 mrose + * Interim 6.8 + * + * Revision 7.4 90/12/23 18:39:11 mrose + * update + * + * Revision 7.3 90/08/08 14:01:58 mrose + * stuff + * + * Revision 7.2 90/07/27 08:41:47 mrose + * update + * + * Revision 7.1 90/07/09 14:31:01 mrose + * sync + * + * Revision 7.0 90/07/01 19:51:16 mrose + * *** empty log message *** + * + */ + +/* + * 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. + * + */ + +/* LINTLIBRARY */ + + +#include +#include "psap.h" +#include "isoaddrs.h" +#include "tailor.h" +#include "DSE-types.h" + + +#define advise PY_advise + + +extern struct type_DSE_PSAPaddr *psap2dse (); + +/* */ + +int build_DSE_PSAPaddr (pe, explicit, len, buffer, parm) +PE *pe; +int explicit; +int len; +char *buffer; +char *parm; +{ + int result; + register struct PSAPaddr *pa = (struct PSAPaddr *) parm; + struct type_DSE_PSAPaddr *dse; + + if ((dse = psap2dse (pa)) == NULL) + return NOTOK; + + result = encode_DSE_PSAPaddr (pe, explicit, len, buffer, dse); + + free_DSE_PSAPaddr (dse); + + return result; +} + +/* */ + +static struct type_DSE_PSAPaddr *psap2dse (pa) +register struct PSAPaddr *pa; +{ + register int n; + register struct type_DSE_PSAPaddr *dse; + register struct SSAPaddr *sa = &pa -> pa_addr; + register struct TSAPaddr *ta = &sa -> sa_addr; + register struct NSAPaddr *na; + register struct member_DSE_0 *nDSE, + **oDSE; + + if ((dse = (struct type_DSE_PSAPaddr *) calloc (1, sizeof *dse)) == NULL) { + advise (NULLCP, "psap2dse: out of memory"); + return NULL; + } + + if (pa -> pa_selectlen > 0) + dse -> pSelector = str2qb (pa -> pa_selector, pa -> pa_selectlen, 1); + + if (sa -> sa_selectlen > 0) + dse -> sSelector = str2qb (sa -> sa_selector, sa -> sa_selectlen, 1); + + if (ta -> ta_selectlen > 0) + dse -> tSelector = str2qb (ta -> ta_selector, ta -> ta_selectlen, 1); + + oDSE = &dse -> nAddress; + for (na = ta -> ta_addrs, n = ta -> ta_naddr; n > 0; na++, n--) { + register struct NSAPaddr *ca; + + if ((nDSE = (struct member_DSE_0 *) calloc (1, sizeof *nDSE)) + == NULL) { + advise (NULLCP, "psap2dse: out of memory"); +losing: ; + free_DSE_PSAPaddr (dse); + return NULL; + } + *oDSE = nDSE; + oDSE = &nDSE -> next; + + if ((ca = na2norm (na)) == NULLNA) { + advise (NULLCP, "unable to normalize address"); + goto losing; + } + + nDSE -> member_DSE_1 = str2qb (ca -> na_address, ca -> na_addrlen, 1); + } + + return dse; +} + +/* */ + +int parse_DSE_PSAPaddr (pe, explicit, len, buffer, parm) +register PE pe; +int explicit; +int *len; +char **buffer; +char *parm; +{ + int result; + register struct PSAPaddr *pa = (struct PSAPaddr *) parm; + struct type_DSE_PSAPaddr *dse; + + if (decode_DSE_PSAPaddr (pe, explicit, len, buffer, &dse) == NOTOK) + return NOTOK; + + result = dse2psap (dse, pa); + + free_DSE_PSAPaddr (dse); + + return result; +} + +/* */ + +static int dse2psap (dse, pa) +register struct type_DSE_PSAPaddr *dse; +register struct PSAPaddr *pa; +{ + register struct SSAPaddr *sa = &pa -> pa_addr; + register struct TSAPaddr *ta = &sa -> sa_addr; + register struct member_DSE_0 *nDSE; + + bzero ((char *) pa, sizeof *pa); + + pa -> pa_selectlen = gstring (pa -> pa_selector, + sizeof pa -> pa_selector, + dse -> pSelector, "psap selector"); + + sa -> sa_selectlen = gstring (sa -> sa_selector, sizeof sa -> sa_selector, + dse -> sSelector, "ssap selector"); + + ta -> ta_selectlen = gstring (ta -> ta_selector, sizeof ta -> ta_selector, + dse -> tSelector, "tsap selector"); + + for (nDSE = dse -> nAddress; nDSE; nDSE = nDSE -> next) { + char *p; + + if (ta -> ta_naddr >= NTADDR) { + advise (NULLCP, "too many network addresses"); + return NOTOK; + } + + p = qb2str (nDSE->member_DSE_1); + if (norm2na (p, nDSE -> member_DSE_1 -> qb_len, + &ta -> ta_addrs[ta -> ta_naddr++]) == NOTOK) + return NOTOK; + free (p); + } + + return OK; +} + +/* */ + +static int gstring (buf, buflen, qb, w) +char *buf; +int buflen; +struct qbuf *qb; +char *w; +{ + char *p; + + if (qb == NULL || qb -> qb_len <= 0) + return 0; + + if (qb -> qb_len > buflen) { + advise (NULLCP, "%s too long", w); + return 0; + } + + p = qb2str (qb); + bcopy (p, buf, qb -> qb_len); + free (p); + + return qb -> qb_len; +} diff --git a/usr/src/contrib/isode/acsap/dse.py b/usr/src/contrib/isode/acsap/dse.py new file mode 100644 index 0000000000..591525a2f5 --- /dev/null +++ b/usr/src/contrib/isode/acsap/dse.py @@ -0,0 +1,63 @@ +-- dse.py - X.500 PresentationAddress syntax + +-- $Header: /f/osi/acsap/RCS/dse.py,v 7.4 91/02/22 09:14:37 mrose Interim $ +-- +-- +-- $Log: dse.py,v $ +-- Revision 7.4 91/02/22 09:14:37 mrose +-- Interim 6.8 +-- +-- Revision 7.3 90/08/08 14:02:00 mrose +-- stuff +-- +-- Revision 7.2 90/07/09 14:31:05 mrose +-- sync +-- +-- Revision 7.1 89/12/04 08:44:12 mrose +-- touch-up +-- +-- Revision 7.0 89/11/23 21:22:09 mrose +-- Release 6.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. +-- +-- + + +DSE DEFINITIONS ::= + +%{ +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/dse.py,v 7.4 91/02/22 09:14:37 mrose Interim $"; +#endif +%} + +BEGIN + +PSAPaddr ::= + SEQUENCE { + pSelector[0] + OCTET STRING + OPTIONAL, + + sSelector[1] + OCTET STRING + OPTIONAL, + + tSelector[2] + OCTET STRING + OPTIONAL, + + nAddress[3] + SET OF + OCTET STRING + } + +END diff --git a/usr/src/contrib/isode/acsap/is2paddr.c b/usr/src/contrib/isode/acsap/is2paddr.c new file mode 100644 index 0000000000..921e9e7784 --- /dev/null +++ b/usr/src/contrib/isode/acsap/is2paddr.c @@ -0,0 +1,64 @@ +/* is2paddr.c - old-style P-ADDR lookup */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/is2paddr.c,v 7.2 91/02/22 09:14:38 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/is2paddr.c,v 7.2 91/02/22 09:14:38 mrose Interim $ + * + * + * $Log: is2paddr.c,v $ + * Revision 7.2 91/02/22 09:14:38 mrose + * Interim 6.8 + * + * Revision 7.1 90/03/05 23:02:18 mrose + * touch-up + * + * Revision 7.0 89/11/23 21:22:10 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "isoaddrs.h" +#include "isoservent.h" + +/* */ + +struct PSAPaddr *is2paddr (host, service, is) +char *host, + *service; +struct isoservent *is; +{ + AEI aei; + struct PSAPaddr *pa; + + if ((aei = str2aei (host, service)) == NULLAEI + || (pa = aei2addr (aei)) == NULLPA) + return NULLPA; + + if (is && strcmp (is -> is_provider, "psap") == 0) { + if (is -> is_selectlen > PSSIZE) /* XXX */ + return NULLPA; + + bcopy (is -> is_selector, pa -> pa_selector, + pa -> pa_selectlen = is -> is_selectlen); + } + + return pa; +} diff --git a/usr/src/contrib/isode/acsap/is2saddr.c b/usr/src/contrib/isode/acsap/is2saddr.c new file mode 100644 index 0000000000..327be1fab7 --- /dev/null +++ b/usr/src/contrib/isode/acsap/is2saddr.c @@ -0,0 +1,66 @@ +/* is2saddr.c - old-style S-ADDR lookup */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/is2saddr.c,v 7.2 91/02/22 09:14:39 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/is2saddr.c,v 7.2 91/02/22 09:14:39 mrose Interim $ + * + * + * $Log: is2saddr.c,v $ + * Revision 7.2 91/02/22 09:14:39 mrose + * Interim 6.8 + * + * Revision 7.1 90/03/05 23:02:21 mrose + * touch-up + * + * Revision 7.0 89/11/23 21:22:10 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "isoaddrs.h" +#include "isoservent.h" + +/* */ + +struct SSAPaddr *is2saddr (host, service, is) +char *host, + *service; +struct isoservent *is; +{ + AEI aei; + struct PSAPaddr *pa; + struct SSAPaddr *sa; + + if ((aei = str2aei (host, service)) == NULLAEI + || (pa = aei2addr (aei)) == NULLPA) + return NULLSA; + + sa = &pa -> pa_addr; + if (is && strcmp (is -> is_provider, "ssap") == 0) { + if (is -> is_selectlen > SSSIZE) /* XXX */ + return NULLSA; + + bcopy (is -> is_selector, sa -> sa_selector, + sa -> sa_selectlen = is -> is_selectlen); + } + + return sa; +} diff --git a/usr/src/contrib/isode/acsap/is2taddr.c b/usr/src/contrib/isode/acsap/is2taddr.c new file mode 100644 index 0000000000..f716362d83 --- /dev/null +++ b/usr/src/contrib/isode/acsap/is2taddr.c @@ -0,0 +1,66 @@ +/* is2taddr.c - old-style T-ADDR lookup */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/is2taddr.c,v 7.2 91/02/22 09:14:40 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/is2taddr.c,v 7.2 91/02/22 09:14:40 mrose Interim $ + * + * + * $Log: is2taddr.c,v $ + * Revision 7.2 91/02/22 09:14:40 mrose + * Interim 6.8 + * + * Revision 7.1 90/03/05 23:02:24 mrose + * touch-up + * + * Revision 7.0 89/11/23 21:22:11 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "isoaddrs.h" +#include "isoservent.h" + +/* */ + +struct TSAPaddr *is2taddr (host, service, is) +char *host, + *service; +struct isoservent *is; +{ + AEI aei; + struct PSAPaddr *pa; + struct TSAPaddr *ta; + + if ((aei = str2aei (host, service)) == NULLAEI + || (pa = aei2addr (aei)) == NULLPA) + return NULLTA; + + ta = &pa -> pa_addr.sa_addr; + if (is && strcmp (is -> is_provider, "tsap") == 0) { + if (is -> is_selectlen > TSSIZE) /* XXX */ + return NULLTA; + + bcopy (is -> is_selector, ta -> ta_selector, + ta -> ta_selectlen = is -> is_selectlen); + } + + return ta; +} diff --git a/usr/src/contrib/isode/acsap/isoalias.c b/usr/src/contrib/isode/acsap/isoalias.c new file mode 100644 index 0000000000..d99be796e6 --- /dev/null +++ b/usr/src/contrib/isode/acsap/isoalias.c @@ -0,0 +1,164 @@ +/* isoalias.c - application entity info -- directory service utilities */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/isoalias.c,v 7.2 91/02/22 09:14:41 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/isoalias.c,v 7.2 91/02/22 09:14:41 mrose Interim $ + * + * + * $Log: isoalias.c,v $ + * Revision 7.2 91/02/22 09:14:41 mrose + * Interim 6.8 + * + * Revision 7.1 90/01/11 18:35:01 mrose + * real-sync + * + * Revision 7.0 89/11/23 21:22:12 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + +/* DATA */ + +static char *isoaliases = "isoaliases"; + + +#define PBUCKETS 128 +#define PHASH(nm) \ + (((nm)[1]) ? (((chrcnv[((nm)[0])] - chrcnv[((nm)[1])]) & 0x1f) \ + + ((chrcnv[(nm)[2]]) & 0x5f)) \ + : (chrcnv[(nm)[0]]) & 0x7f) + +struct pair { + char *p_name; + char *p_value; + + struct pair *p_chain; +}; + +static int inited = 0; +static struct pair *Pbuckets[PBUCKETS]; + +/* */ + +char *alias2name (name) +char *name; +{ + register struct pair *p; + + if (!inited) + read_aliases (); + + for (p = Pbuckets[PHASH (name)]; + p && lexequ (p -> p_name, name); + p = p -> p_chain) + continue; + + return (p ? p -> p_value : NULL); +} + +/* */ + +static int read_aliases () +{ + register char *hp; + char buffer[BUFSIZ]; + + if (inited) + return; + inited = 1; + + bzero ((char *) Pbuckets, sizeof Pbuckets); + + read_file (isodefile (isoaliases, 0)); + + if ((hp = getenv ("HOME")) == NULL) + hp = "."; + (void) sprintf (buffer, "%s/.isode_aliases", hp); + read_file (buffer); +} + +/* */ + +static int read_file (file) +char *file; +{ + register char *cp; + char buffer[BUFSIZ + 1], + *vec[NVEC + NSLACK + 1]; + register FILE *fp; + + if ((fp = fopen (file, "r")) == NULL) + return; + + while (fgets (buffer, sizeof buffer, fp)) { + if (*buffer == '#') + continue; + if (cp = index (buffer, '\n')) + *cp = NULL; + if (str2vec (buffer, vec) < 2) + continue; + + if (add_alias (vec[0], vec[1]) == NOTOK) + break; + } + + (void) fclose (fp); +} + +/* */ + +int add_alias (name, value) +char *name, + *value; +{ + int i; + register struct pair *p; + + if (!inited) + read_aliases (); + + if ((p = (struct pair *) calloc (1, sizeof *p)) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("calloc of alias structure failed")); + return NOTOK; + } + + if ((p -> p_name = malloc ((unsigned) (strlen (name) + 1))) == NULL + || (p -> p_value = malloc ((unsigned) (strlen (value) + 1))) + == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("malloc of alias structure failed")); + if (p -> p_name) + free (p -> p_name); + free ((char *) p); + return NOTOK; + } + (void) strcpy (p -> p_name, name); + (void) strcpy (p -> p_value, value); + + p -> p_chain = Pbuckets[i = PHASH (p -> p_name)]; + Pbuckets[i] = p; + + return OK; +} diff --git a/usr/src/contrib/isode/acsap/isoentity.c b/usr/src/contrib/isode/acsap/isoentity.c new file mode 100644 index 0000000000..e6322b83f9 --- /dev/null +++ b/usr/src/contrib/isode/acsap/isoentity.c @@ -0,0 +1,198 @@ +/* isoentity.c - application entity titles -- sequential lookup utilities */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/isoentity.c,v 7.4 91/02/22 09:14:42 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/isoentity.c,v 7.4 91/02/22 09:14:42 mrose Interim $ + * + * + * $Log: isoentity.c,v $ + * Revision 7.4 91/02/22 09:14:42 mrose + * Interim 6.8 + * + * Revision 7.3 90/12/23 18:39:15 mrose + * update + * + * Revision 7.2 90/10/29 18:38:00 mrose + * updates + * + * Revision 7.1 90/08/08 14:11:40 mrose + * update + * + * Revision 7.0 89/11/23 21:22:13 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "psap.h" +#include "isoaddrs.h" +#include "tailor.h" + +/* DATA */ + +static char *isoentities = "isoentities"; + +static FILE *servf = NULL; +static int stayopen = 0; + +static int mask; +static int vecp; +static char buffer[BUFSIZ + 1]; +static char *vec[NVEC + NSLACK + 1]; + +static struct isoentity ies; + +/* */ + +int setisoentity (f) +int f; +{ + if (servf == NULL) + servf = fopen (isodefile (isoentities, 0), "r"); + else + rewind (servf); + stayopen |= f; + + return (servf != NULL); +} + + +int endisoentity () { + if (servf && !stayopen) { + (void) fclose (servf); + servf = NULL; + } + + return 1; +} + +/* */ + +struct isoentity *getisoentity () { + static char descriptor[BUFSIZ]; + + if (servf == NULL + && (servf = fopen (isodefile (isoentities, 0), "r")) == NULL) + return NULL; + + while (_startisoentity (descriptor) == OK) + if (_stopisoentity (descriptor, (struct isoentity *) NULL) == OK) + return (&ies); + + return NULL; +} + +/* */ + +int _startisoentity (descriptor) +char *descriptor; +{ + register char *cp, + *dp; + char *ep; + + ep = (dp = buffer) + sizeof buffer; + while (fgets (dp, ep - dp, servf) != NULL) { + if (*buffer == '#') + continue; + if (*dp == '\n' && dp == buffer) + continue; + if (cp = index (buffer, '\n')) { + *cp-- = NULL; + if (*cp == '\\') { + if ((dp = cp) + 1 >= ep) + dp = buffer; + continue; + } + } + + switch (vecp = str2vecX (buffer, vec, 5 + 1, &mask, NULL, 1)) { + case 3: /* no address */ + case 4: /* new-style */ + break; + + default: + continue; + } + + (void) sprintf (descriptor, "%s-%s", vec[0], vec[1]); + + return OK; + } + + return DONE; +} + +/* */ + +int _stopisoentity (descriptor, iep) +char *descriptor; +struct isoentity *iep; +{ + register int i; + register struct isoentity *ie = &ies; + OID oid = &ie -> ie_identifier; + struct PSAPaddr *pa = &ie -> ie_addr; + struct PSAPaddr *pz; + static unsigned int elements[NELEM + 1]; + + bzero ((char *) ie, sizeof *ie); + + if (strcmp (vec[2], "NULL") == 0) + elements[i = 0] = 0; + else + if ((i = str2elem (vec[2], elements)) <= 1) + return NOTOK; + oid -> oid_elements = elements; + oid -> oid_nelem = i; + ie -> ie_descriptor = descriptor; + + switch (vecp) { + case 3: /* no address */ + break; + + case 4: /* new-style */ + if (pz = str2paddr (vec[3])) + *pa = *pz; /* struct copy */ + break; + } + + if (iep) + *iep = *ie; /* struct copy */ + + return OK; +} + +/* */ + +_printent (ie) +register struct isoentity *ie; +{ + LLOG (addr_log, LLOG_DEBUG, + ("Entity: %s (%s)", ie -> ie_descriptor, + oid2ode (&ie -> ie_identifier))); + + (void) ll_printf (addr_log, "Address: %s\n", + paddr2str (&ie -> ie_addr, NULLNA)); + + (void) ll_printf (addr_log, "///////\n"); + + (void) ll_sync (addr_log); +} diff --git a/usr/src/contrib/isode/acsap/libacsap.3n b/usr/src/contrib/isode/acsap/libacsap.3n new file mode 100644 index 0000000000..c71c618bbf --- /dev/null +++ b/usr/src/contrib/isode/acsap/libacsap.3n @@ -0,0 +1,145 @@ +.TH LIBACSAP 3N "23 Sep 1986" +.\" $Header: /f/osi/acsap/RCS/libacsap.3n,v 7.1 91/02/22 09:14:44 mrose Interim $ +.\" +.\" +.\" $Log: libacsap.3n,v $ +.\" Revision 7.1 91/02/22 09:14:44 mrose +.\" Interim 6.8 +.\" +.\" Revision 7.0 89/11/23 21:22:14 mrose +.\" Release 6.0 +.\" +.SH NAME +libacsap \- Application Control Services library +.SH SYNOPSIS +.B "#include " +.sp +\fIcc\fR\0...\0\fB\-lacsap\fR +.SH DESCRIPTION +The \fIlibacsap\fR library contains a set of routine which implement +association control services. +In essence, +they implement an Association Control Service Entity (ACSE) interface for +user applications. +.PP +Although the ISO model is symmetric, +this implmentation is based on a client/server paradigm and hence asymmetric. +The information herein is skeltal: +consult the \fIUser's Manual\fR for actual examples of how ISO servers and +clients are coded and interact with the \fIlibacsap\fR library. +.SH ADDRESSES +Two objects are used to address an application using an ACSE: +application entity information and a presentation address. +The former object denotes the particular application desired; +the latter denotes where this application is located. +.SH "SERVER INITIALIZATION" +A program providing an ISO service is usually invoked under \fItsapd\fR\0(8c), +with the argument vector listed in the ISODE services database. +The server's very first action is to re\-capture the ACSE state as +recorded by \fItsapd\fR. +This is accomplished by calling \fBAcInit\fR. +Information returned by this call is equivalent to the parameters passed by a +A\-ASSOCIATE.INDICATION event. +If the call is successful, +the program can then examine the argument vector that was passed via +\fIexecvp\fR +(it's important to call \fBAcInit\fR prior to reading \fBargc\fR and +\fBargv\fR). +If the call to \fBAcInit\fR is not successful, +information returned by the call indicates the reason for failure. +.PP +After examining the information provided by \fBAcInit\fR +(and possibly the argument vector), +the server should either accept or reject the connection. +If accepting, the \fBAcAssocResponse\fR routine is called with the parameter +\fBstatus\fR set to +.sp +.in +.5i +.nf +.ta \w'ACS_NOTSPECIFIED 'u +ACS_ACCEPT association accepted +.re +.fi +.in -.5i +.sp +(which corresponds to the accepting A\-ASSOCIATE.RESPONSE action). +If the call is successful, +the interaction is henceforth symmetric. +If un\-successful, +information returned by the call indicates the reason for failure. +If rejecting, the \fBAcAssocResponse\fR routine is also called, +but with the parameter \fBstatus\fR set to one of: +.sp +.in +.5i +.nf +.ta \w'ACS_NOTSPECIFIED 'u +ACS_PERMANENT permanent +ACS_TRANSIENT transient +.re +.fi +.in -.5i +.sp +(which corresponds to the refusing A\-ASSOCIATE.RESPONSE action), +and the program may exit. +.SH "CLIENT INITIALIZATION" +A program requesting an ISO service calls \fBAcAssocRequest\fR +(which corresponds to the A\-ASSOCIATE.REQUEST action). +If successful (depending on the responder's choice of \fBresult\fR), +the interaction is henceforth symmetric. +If un\-successful, +information returned by the call indicates the reason for failure. +.SH ASSOCIATION\-DESCRIPTORS +Once a connection has been established via a successful return from +\fBAcAssocResponse\fR (for servers) or \fBAcAssocRequest\fR (for clients), +a connection is referenced by a small integer +(returned in a structure passed to these calls) called a +\fIassociation\-descriptor\fR. +This association\-descriptor appears as an argument to the other application +service elements being used by the application +(e.g., the reliable transfer service entity (RTSE), or the +remote operates service entity (ROSE)). +.SH "ASSOCIATION RELEASE" +The routine \fBAcRelRequest\fR is used to release an association. +This triggers a P\-RELEASE.INDICATION event for the other peer. +The peer should use the \fBAcFINISHser\fR routine to map this into an +A\-RELEASE.INDICATION event. +It should then use the routine \fBAcRelResponse\fR to either accept or reject +the request to release the association. +.SH "ASSOCIATION ABORT" +The routine \fBAcUAbortRequest\fR is used to unilaterally abort an +association. +This triggers a P\-U\-ABORT.INDICATION event for the other peer. +The peer should use the \fBAcABORTser\fR routine to map this into an +A\-ABORT.INDICATION event. +.PP +Finally, +the routine \fBAcErrString\fR takes a failure code from a \fBAcSAPabort\fR +structure and returns a null\-terminated diagnostic string. +.SH FILES +.nf +.ta \w'\*(EDisoservices 'u +\*(EDisoentities ISODE entities database +\*(EDisobjects ISODE objects database +\*(EDisoservices ISODE services database +.re +.fi +.SH "SEE ALSO" +isoentities(5), isobjects (5), isoservices(5), tsapd(8c), +.br +\fIThe ISO Development Environment: User's Manual\fR, +.br +ISO 8649: +\fIInformation Processing Systems \-\- Open Systems Interconnection +\-\- +Service Definition for the Association Control Service Element\fR, +.SH DIAGNOSTICS +All routines return the manifest constant \fBNOTOK\fR (\-1) on error. +In addition, +those routines which take a pointer to a \fBAcSAPindication\fR structure +fill\-in the structure as appropriate. +.SH AUTHOR +Marshall T. Rose +.SH BUGS +Do not confuse association\-descriptors with file\-descriptors. +Unlike file\-descriptors which are implemented by the kernel, +association\-descriptors do not work across \fIfork\fRs and \fIexec\fRs. diff --git a/usr/src/contrib/isode/acsap/llib-lacsap b/usr/src/contrib/isode/acsap/llib-lacsap new file mode 100644 index 0000000000..b49b91432d --- /dev/null +++ b/usr/src/contrib/isode/acsap/llib-lacsap @@ -0,0 +1,343 @@ +/* llib-lacsap - lint library for -lacsap */ + +/* + * $Header: /f/osi/acsap/RCS/llib-lacsap,v 7.4 91/02/22 09:14:45 mrose Interim $ + * + * + * $Log: llib-lacsap,v $ + * Revision 7.4 91/02/22 09:14:45 mrose + * Interim 6.8 + * + * Revision 7.3 90/12/23 18:39:16 mrose + * update + * + * Revision 7.2 90/12/11 10:52:12 mrose + * lock-and-load + * + * Revision 7.1 90/07/09 14:31:18 mrose + * sync + * + * Revision 7.0 89/11/23 21:22:15 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include "acsap.h" +#include "tsap.h" +#include "isoservent.h" + +/* */ + +/* A-ASSOCIATE.INDICATION */ + +int AcInit (vecp, vec, acs, aci) +int vecp; +char **vec; +struct AcSAPstart *acs; +struct AcSAPindication *aci; +{ + return AcInit (vecp, vec, acs, aci); +} + + +/* A-ASSOCIATE.RESPONSE */ + +int AcAssocResponse (sd, status, reason, context, respondtitle, + respondaddr, ctxlist, defctxresult, prequirements, srequirements, isn, + settings, ref, data, ndata, aci) +int sd; +int status, + reason; +OID context; +AEI respondtitle; +struct PSAPaddr *respondaddr; +int prequirements, + srequirements, + settings, + ndata; +long isn; +struct PSAPctxlist *ctxlist; +int defctxresult; +struct SSAPref *ref; +PE *data; +struct AcSAPindication *aci; +{ + return AcAssocResponse (sd, status, reason, context, respondtitle, + respondaddr, ctxlist, defctxresult, prequirements, srequirements, + isn, settings, ref, data, ndata, aci); +} + + +/* A-(ASYN-)ASSOCIATE.REQUEST */ + +int AcAsynAssocRequest (context, callingtitle, calledtitle, callingaddr, + calledaddr, ctxlist, defctxname, prequirements, srequirements, isn, + settings, ref, data, ndata, qos, acc, aci, async) +OID context; +AEI callingtitle, + calledtitle; +struct PSAPaddr *callingaddr, + *calledaddr; +int prequirements, + srequirements, + settings, + ndata, + async; +long isn; +struct PSAPctxlist *ctxlist; +OID defctxname; +struct SSAPref *ref; +PE *data; +struct QOStype *qos; +struct AcSAPconnect *acc; +struct AcSAPindication *aci; +{ + return AcAsynAssocRequest (context, callingtitle, calledtitle, callingaddr, + calledaddr, ctxlist, defctxname, prequirements, srequirements, isn, + settings, ref, data, ndata, qos, acc, aci, async); +} + + +/* A-ASYN-RETRY.REQUEST (pseudo) */ + +int AcAsynRetryRequest (sd, acc, aci) +int sd; +struct AcSAPconnect *acc; +struct AcSAPindication *aci; +{ + return AcAsynRetryRequest (sd, acc, aci); +} + + +/* A-ASYN-NEXT.REQUEST (pseudo) */ + +int AcAsynNextRequest (sd, acc, aci) +int sd; +struct AcSAPconnect *acc; +struct AcSAPindication *aci; +{ + return AcAsynNextRequest (sd, acc, aci); +} + + +/* A-RELEASE.REQUEST */ + +int AcRelRequest (sd, reason, data, ndata, secs, acr, aci) +int sd; +int reason; +PE *data; +int ndata; +int secs; +struct AcSAPrelease *acr; +struct AcSAPindication *aci; +{ + return AcRelRequest (sd, reason, data, ndata, secs, acr, aci); +} + + +/* A-RELEASE-RETRY.REQUEST (pseudo) */ + +int AcRelRetryRequest (sd, secs, acr, aci) +int sd; +int secs; +struct AcSAPrelease *acr; +struct AcSAPindication *aci; +{ + return AcRelRetryRequest (sd, secs, acr, aci); +} + + +/* A-RELEASE.RESPONSE */ + +int AcRelResponse (sd, status, reason, data, ndata, aci) +int sd; +int status, + reason; +PE *data; +int ndata; +struct AcSAPindication *aci; +{ + return AcRelResponse (sd, status, reason, data, ndata, aci); +} + + +/* A-ABORT.REQUEST */ + +int AcUAbortRequest (sd, data, ndata, aci) +int sd; +PE *data; +int ndata; +struct AcSAPindication *aci; +{ + return AcUAbortRequest (sd, data, ndata, aci); +} + + +/* handle P-RELEASE.INDICATION */ + +int AcFINISHser (sd, pf, aci) +int sd; +struct PSAPfinish *pf; +struct AcSAPindication *aci; +{ + return AcFINISHser (sd, pf, aci); +} + + +/* handle P-{U,P}-ABORT.INDICATION */ + +int AcABORTser (sd, pa, aci) +int sd; +struct PSAPabort *pa; +struct AcSAPindication *aci; +{ + return AcABORTser (sd, pa, aci); +} + + +/* return PCI used by ACSE */ + +int AcFindPCI (sd, pci, aci) +int sd; +int *pci; +struct AcSAPindication *aci; +{ + return AcFindPCI (sd, pci, aci); +} + + +/* return AcSAP error code in string form */ + +char *AcErrString (code) +int code; +{ + return AcErrString (code); +} + + +/* string to application entity info */ + +AEI _str2aei (designator, qualifier, context, interactive, userdn, + password) +char *designator, + *qualifier, + *context, + *userdn, + *password; +int interactive; +{ + return _str2aei (designator, qualifier, context, interactive, userdn, + password); +} + + +char *sprintaei (aei) +AEI aei; +{ + return sprintaei (aei); +} + + +/* application entity info to PSAPaddr */ + +struct PSAPaddr *aei2addr (aei) +AEI aei; +{ + return aei2addr (aei); +} + + +int setisoentity (f) +int f; +{ + return setisoentity (f); +} + + +int endisoentity () +{ + return endisoentity (); +} + +struct isoentity *getisoentity () +{ + return getisoentity (); +} + + +AEI oid2aei (oid) +OID oid; +{ + return oid2aei (oid); +} + + +/* old-style */ + +struct PSAPaddr *is2paddr (host, service, is) +char *host, + *service; +struct isoservent *is; +{ + return is2paddr (host, service, is); +} + + +/* old-style */ + +struct SSAPaddr *is2saddr (host, service, is) +char *host, + *service; +struct isoservent *is; +{ + return is2saddr (host, service, is); +} + + +/* old-style */ + +struct TSAPaddr *is2taddr (host, service, is) +char *host, + *service; +struct isoservent *is; +{ + return is2taddr (host, service, is); +} + + +/* "user-friendly" name service */ + +set_lookup_dase (flag) +char flag; +{ + set_lookup_dase (flag); +} + + + +/* generic server dispatch */ + +int isodeserver (argc, argv, aei, initfnx, workfnx, losefnx, td) +int argc; +char **argv; +AEI aei; +IFP initfnx, + workfnx, + losefnx; +struct TSAPdisconnect *td; +{ + return isodeserver (argc, argv, aei, initfnx, workfnx, losefnx, td); +} diff --git a/usr/src/contrib/isode/acsap/make b/usr/src/contrib/isode/acsap/make new file mode 100644 index 0000000000..4120803e07 --- /dev/null +++ b/usr/src/contrib/isode/acsap/make @@ -0,0 +1,7 @@ +: run this script through /bin/sh +M=/bin/make +if [ -f /usr/bin/make ]; then + M=/usr/bin/make +fi + +exec $M MODULE=acsap TOPDIR=../ -f ../config/CONFIG.make -f Makefile ${1+"$@"} diff --git a/usr/src/contrib/isode/acsap/oid2aei.c b/usr/src/contrib/isode/acsap/oid2aei.c new file mode 100644 index 0000000000..eeb4ce4c39 --- /dev/null +++ b/usr/src/contrib/isode/acsap/oid2aei.c @@ -0,0 +1,53 @@ +/* oid2aei.c - application entity titles -- OID to AE info */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/oid2aei.c,v 7.1 91/02/22 09:14:48 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/oid2aei.c,v 7.1 91/02/22 09:14:48 mrose Interim $ + * + * + * $Log: oid2aei.c,v $ + * Revision 7.1 91/02/22 09:14:48 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:22:18 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "isoaddrs.h" + +/* */ + +AEI oid2aei (oid) +OID oid; +{ + static AEInfo aeinfo; + AEI aei = &aeinfo; + static PE pe = NULLPE; + + if (pe) + pe_free (pe); + + bzero ((char *) aei, sizeof *aei); + aei -> aei_ap_title = pe = obj2prim (oid, PE_CLASS_UNIV, PE_PRIM_OID); + + return aei; +} diff --git a/usr/src/contrib/isode/acsap/sprintaei.c b/usr/src/contrib/isode/acsap/sprintaei.c new file mode 100644 index 0000000000..e1f3b6562a --- /dev/null +++ b/usr/src/contrib/isode/acsap/sprintaei.c @@ -0,0 +1,81 @@ +/* sprintaei.c - manage AE info */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/acsap/RCS/sprintaei.c,v 7.1 91/02/22 09:14:49 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/acsap/RCS/sprintaei.c,v 7.1 91/02/22 09:14:49 mrose Interim $ + * + * + * $Log: sprintaei.c,v $ + * Revision 7.1 91/02/22 09:14:49 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:22:18 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "isoaddrs.h" + +/* */ + +char *sprintaei (aei) +AEI aei; +{ + register char *cp; + char *bp; + static int i; + static char buffer1[BUFSIZ], + buffer2[BUFSIZ]; + + bp = cp = (i++ % 2) ? buffer1 : buffer2; + + *cp++ = '<'; + + if (aei -> aei_ap_title) { + vpushstr (cp); + vunknown (aei -> aei_ap_title); + vpopstr (); + cp += strlen (cp); + } + *cp++ = ','; + + if (aei -> aei_ae_qualifier) { + vpushstr (cp); + vunknown (aei -> aei_ae_qualifier); + vpopstr (); + cp += strlen (cp); + } + *cp++ = ','; + + if (aei -> aei_flags & AEI_AE_ID) { + (void) sprintf (cp, "%d", aei -> aei_ae_id); + cp += strlen (cp); + } + *cp++ = ','; + + if (aei -> aei_flags & AEI_AP_ID) { + (void) sprintf (cp, "%d", aei -> aei_ap_id); + cp += strlen (cp); + } + (void) strcpy (cp, ">"); + + return bp; +} diff --git a/usr/src/contrib/isode/compat/Makefile b/usr/src/contrib/isode/compat/Makefile new file mode 100644 index 0000000000..cdfcd55a3b --- /dev/null +++ b/usr/src/contrib/isode/compat/Makefile @@ -0,0 +1,267 @@ +############################################################################### +# Instructions to Make, for compilation of UNIX compatibility library +############################################################################### + +############################################################################### +# +# $Header: /f/osi/compat/RCS/Makefile,v 7.9 91/02/22 09:14:52 mrose Interim $ +# +# +# $Log: Makefile,v $ +# Revision 7.9 91/02/22 09:14:52 mrose +# Interim 6.8 +# +# Revision 7.8 91/01/14 13:32:22 mrose +# kerberos +# +# Revision 7.7 90/12/23 18:39:28 mrose +# update +# +# Revision 7.6 90/08/08 14:02:55 mrose +# stuff +# +# Revision 7.5 90/07/27 08:41:54 mrose +# update +# +# Revision 7.4 90/07/09 14:31:26 mrose +# sync +# +# Revision 7.3 90/04/18 08:44:38 mrose +# MANDIR +# +# Revision 7.2 89/12/19 16:17:52 mrose +# dgram +# +# Revision 7.1 89/11/30 23:53:13 mrose +# pa2str +# +# Revision 7.0 89/11/23 21:22:52 mrose +# Release 6.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. +# +############################################################################### + + +LIBES = libcompat.a +LLIBS = +HFILES = $(HDIR)manifest.h $(HDIR)general.h $(HDIR)config.h + + +################################################################## +# Here it is... +################################################################## + +all: libcompat mandefs +inst-all: inst-mandefs inst-isologs # inst-libcompat manuals +install: inst-all clean +lint: l-libcompat + + +################################################################ +# libcompat +################################################################ + +CFILES = general.c logger.c select.c signals.c \ + asprintf.c explode.c implode.c isofiles.c isohost.c sel2str.c \ + serror.c sprintb.c str2elem.c str2sel.c str2vec.c \ + tailor.c \ + baduser.c chkpassword.c getpassword.c putenv.c \ + chrcnv.c cmd_srch.c lexequ.c lexnequ.c log_tai.c nochrcnv.c \ + rcmd_srch.c smalloc.c sstr2arg.c strdup.c \ + isoservent.c servbyname.c servbyport.c servbysel.c \ + isoaddrs.c str2saddr.c str2taddr.c saddr2str.c taddr2str.c\ + na2norm.c norm2na.c na2str.c pa2str.c \ + internet.c \ + dgram.c \ + bridge.c camtec.c sunlink.c ubcx25.c x25addr.c +OFILES = general.o logger.o select.o signals.o \ + asprintf.o explode.o implode.o isofiles.o isohost.o sel2str.o \ + serror.o sprintb.o str2elem.o str2sel.o str2vec.o \ + tailor.o \ + baduser.o chkpassword.o getpassword.o putenv.o \ + chrcnv.o cmd_srch.o lexequ.o lexnequ.o log_tai.o nochrcnv.o \ + rcmd_srch.o smalloc.o sstr2arg.o strdup.o \ + isoservent.o servbyname.o servbyport.o servbysel.o \ + isoaddrs.o str2saddr.o str2taddr.o saddr2str.o taddr2str.o \ + na2norm.o norm2na.o na2str.o pa2str.o \ + internet.o \ + dgram.o \ + bridge.o camtec.o sunlink.o ubcx25.o x25addr.o \ + $(OSTRINGS) + + +inst-libcompat: $(LIBDIR)libicompat.a $(LINTDIR)llib-licompat + +$(LIBDIR)libicompat.a: libcompat.a + -rm -f $@ + cp libcompat.a $@ + @$(UTILDIR)make-lib.sh $(SYSTEM) $@ -ranlib + -@ls -gls $@ + -@echo "" + +$(LINTDIR)llib-licompat: llib-lcompat + -cp $@ zllib-lcompat + -rm -f $@ + sed -e 's%#include "\(.*\)"%#include "$(INCDIR)\1"%' \ + < llib-lcompat | \ + sed -e 's%#include "/usr/include/\(.*\)"%#include <\1>%' > $@ + @$(UTILDIR)inst-lint.sh $(SYSTEM) $(OPTIONS) $@ + -@ls -gls $@ $@.ln + -@echo "" + +libcompat: libcompat.a + +libcompat.a: compatvrsn.o + -rm -f $@ + @$(UTILDIR)make-lib.sh $(SYSTEM) $(ARFLAGS) $@ $(OFILES) \ + compatvrsn.o + -@rm -f $(TOPDIR)libcompat.a $(TOPDIR)llib-lcompat + -@$(LN) libcompat.a $(TOPDIR)libcompat.a + -@$(LN) llib-lcompat $(TOPDIR)llib-lcompat + -@ls -l $@ + -@echo "COMPAT library built normally" + +compatvrsn.c: $(OFILES) + @$(UTILDIR)version.sh compat > $@ + +l-libcompat:; $(LINT) $(LFLAGS) -DBINPATH=\"$(BINDIR)\" \ + -DETCPATH=\"$(ETCDIR)\" -DSBINPATH=\"$(SBINDIR)\" \ + -DLOGPATH=\"$(LOGDIR)\" $(CFILES) compatvrsn.c \ + | grep -v "warning: possible pointer alignment problem" + +general.o: $(HFILES) +logger.o: $(HFILES) $(HDIR)logger.h $(HDIR)tailor.h +select.o: $(HFILES) $(HDIR)logger.h $(HDIR)tailor.h +signals.o: $(HFILES) +asprintf.o: $(HFILES) +explode.o: $(HFILES) +implode.o: $(HFILES) +isofiles.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h +isohost.o: $(HFILES) $(HDIR)internet.h $(HDIR)tailor.h $(HDIR)logger.h +sel2str.o: $(HFILES) $(HDIR)isoaddrs.h +serror.o: $(HFILES) +sprintb.o: $(HFILES) +str2elem.o: $(HFILES) +str2sel.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h +str2vec.o: $(HFILES) +tailor.o: $(HFILES) $(HDIR)isoaddrs.h $(HDIR)tailor.h $(HDIR)logger.h \ + $(TOPDIR)config/CONFIG.make + $(CC) $(LIBCFLAGS) -DBINPATH=\"$(BINDIR)\" \ + -DETCPATH=\"$(ETCDIR)\" -DSBINPATH=\"$(SBINDIR)\" \ + -DLOGPATH=\"$(LOGDIR)\" -c $*.c +baduser.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h +chkpassword.o: $(HFILES) +getpassword.o: $(HFILES) +putenv.o: $(HFILES) +chrcnv.o: $(HFILES) +cmd_srch.o: $(HFILES) $(HDIR)cmd_srch.h +lexequ.o: $(HFILES) +lexnequ.o: $(HFILES) +log_tai.o: $(HFILES) $(HDIR)logger.h +nochrcnv.o: $(HFILES) +rcmd_srch.o: $(HFILES) $(HDIR)cmd_srch.h +smalloc.o: $(HFILES) $(HDIR)tailor.h +sstr2arg.o: $(HFILES) +strdup.o: $(HFILES) +isoservent.o: $(HFILES) $(HDIR)isoservent.h $(HDIR)tailor.h $(HDIR)logger.h +servbyname.o: $(HFILES) $(HDIR)isoservent.h $(HDIR)tailor.h $(HDIR)logger.h +servbyport.o: $(HFILES) $(HDIR)isoservent.h $(HDIR)tailor.h $(HDIR)logger.h +servbysel.o: $(HFILES) $(HDIR)isoservent.h $(HDIR)tailor.h $(HDIR)logger.h +isoaddrs.o: $(HFILES) $(HDIR)isoaddrs.h $(HDIR)internet.h $(HDIR)tailor.h \ + $(HDIR)logger.h +str2saddr.o: $(HFILES) $(HDIR)isoaddrs.h +str2taddr.o: $(HFILES) $(HDIR)isoaddrs.h +saddr2str.o: $(HFILES) $(HDIR)isoaddrs.h +taddr2str.o: $(HFILES) $(HDIR)isoaddrs.h +na2norm.o: $(HFILES) $(HDIR)isoaddrs.h $(HDIR)internet.h $(HDIR)tailor.h \ + $(HDIR)logger.h +norm2na.o: $(HDIR)psap.h $(HFILES) $(HDIR)isoaddrs.h $(HDIR)tailor.h \ + $(HDIR)logger.h +na2str.o: $(HFILES) $(HDIR)isoaddrs.h +pa2str.o: $(HFILES) $(HDIR)isoaddrs.h +internet.o: $(HFILES) $(HDIR)internet.h +dgram.o: $(HFILES) $(HDIR)tailor.h $(HDIR)logger.h \ + $(HDIR)dgram.h $(HDIR)internet.h $(HDIR)tp4.h +bridge.o: $(HFILES) $(HDIR)internet.h $(HDIR)internet.h $(HDIR)tailor.h \ + $(HDIR)logger.h $(HDIR)tpkt.h $(HDIR)tsap.h +camtec.o: $(HFILES) $(HDIR)x25.h $(HDIR)tailor.h $(HDIR)logger.h \ + $(HDIR)tpkt.h $(HDIR)tsap.h +sunlink.o: $(HFILES) $(HDIR)isoaddrs.h $(HDIR)x25.h $(HDIR)tailor.h \ + $(HDIR)logger.h +ubcx25.o: $(HFILES) $(HDIR)x25.h $(HDIR)tailor.h $(HDIR)logger.h \ + $(HDIR)tpkt.h $(HDIR)tsap.h +x25addr.o: $(HFILES) $(HDIR)x25.h $(HDIR)tailor.h $(HDIR)logger.h \ + $(HDIR)tpkt.h $(HDIR)tsap.h + + +################################################################ +# mandefs +################################################################ + +inst-mandefs: $(UTILDIR)inst-man.sh + +mandefs: $(UTILDIR)inst-man.sh + +$(UTILDIR)inst-man.sh: inst-man.sh Makefile $(TOPDIR)config/CONFIG.make + -cp $@ zxinst-man.sh + -rm -f $@ + cat inst-man.sh | \ + sed -e 's%@(BINDIR)%$(BINDIR)%' | \ + sed -e 's%@(ETCDIR)%$(ETCDIR)%' | \ + sed -e 's%@(INCDIR)%$(INCDIR)%' | \ + sed -e 's%@(LOGDIR)%$(LOGDIR)%' | \ + sed -e 's%@(SBINDIR)%$(SBINDIR)%' | \ + sed -e 's%@(MANDIR)%$(MANDIR)%' > $@ + chmod a+x $@ + -@ls -gls $@ + -@echo "" + + +################################################################ +# isologs +################################################################ + +inst-isologs: $(SBINDIR)isologs + +$(SBINDIR)isologs: isologs.sh Makefile + -cp $@ zxisologs + -rm -f $@ + sed -e 's%@(ETCDIR)%$(ETCDIR)%' < isologs.sh | \ + sed -e 's%@(LOGDIR)%$(LOGDIR)%' > $@ + chmod a+rx $@ + -@ls -gls $@ + -@echo "" + + +################################################################ +# manual pages +################################################################ + +MANUALS = libicompat.3 + +manuals:; @$(UTILDIR)inst-man.sh $(MANOPTS) $(MANUALS) + -@echo "" + + +################################################################ +# clean +################################################################ + +clean:; rm -f *.o *.a z* _* core compatvrsn.c + +grind:; iprint Makefile + tgrind -lc $(CFILES) compatvrsn.c llib-lcompat + @echo $(MANUALS) | \ + tr " " "\012" | \ + sed -e "s%.*%itroff -man &%" | \ + sh -ve diff --git a/usr/src/contrib/isode/compat/asprintf.c b/usr/src/contrib/isode/compat/asprintf.c new file mode 100644 index 0000000000..e1fa299a0c --- /dev/null +++ b/usr/src/contrib/isode/compat/asprintf.c @@ -0,0 +1,108 @@ +/* asprintf.c - sprintf with errno */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/asprintf.c,v 7.2 91/02/22 09:14:54 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/asprintf.c,v 7.2 91/02/22 09:14:54 mrose Interim $ + * + * + * $Log: asprintf.c,v $ + * Revision 7.2 91/02/22 09:14:54 mrose + * Interim 6.8 + * + * Revision 7.1 90/02/19 13:07:10 mrose + * update + * + * Revision 7.0 89/11/23 21:22:54 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" + +/* DATA */ + +extern int errno; + +/* */ + +void asprintf (bp, ap) /* what, fmt, args, ... */ +char *bp; +va_list ap; +{ + char *what; + + what = va_arg (ap, char *); + + _asprintf (bp, what, ap); +} + + +void _asprintf (bp, what, ap) /* fmt, args, ... */ +register char *bp; +char *what; +va_list ap; +{ + register int eindex; + char *fmt; + + eindex = errno; + + *bp = NULL; + fmt = va_arg (ap, char *); + + if (fmt) { +#ifndef VSPRINTF + struct _iobuf iob; +#endif + +#ifndef VSPRINTF +#ifdef pyr + bzero ((char *) &iob, sizeof iob); + iob._file = _NFILE; +#endif + iob._flag = _IOWRT | _IOSTRG; +#if !defined(vax) && !defined(pyr) + iob._ptr = (unsigned char *) bp; +#else + iob._ptr = bp; +#endif + iob._cnt = BUFSIZ; + _doprnt (fmt, ap, &iob); + putc (NULL, &iob); +#else + (void) vsprintf (bp, fmt, ap); +#endif + bp += strlen (bp); + + } + + if (what) { + if (*what) { + (void) sprintf (bp, " %s: ", what); + bp += strlen (bp); + } + (void) strcpy (bp, sys_errname (eindex)); + bp += strlen (bp); + } + + errno = eindex; +} diff --git a/usr/src/contrib/isode/compat/baduser.c b/usr/src/contrib/isode/compat/baduser.c new file mode 100644 index 0000000000..3d406cff98 --- /dev/null +++ b/usr/src/contrib/isode/compat/baduser.c @@ -0,0 +1,81 @@ +/* baduser.c - check file of bad users */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/baduser.c,v 7.1 91/02/22 09:14:56 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/baduser.c,v 7.1 91/02/22 09:14:56 mrose Interim $ + * + * + * $Log: baduser.c,v $ + * Revision 7.1 91/02/22 09:14:56 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:22:54 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + +/* */ + +int baduser (file, user) +char *file, + *user; +{ + int hit, + tries; + register char *bp; + char buffer[BUFSIZ]; + FILE *fp; + + hit = 0; + for (tries = 0; tries < 2 && !hit; tries++) { + switch (tries) { + case 0: + if (file) { + bp = isodefile (file, 0); + break; + } + tries++; + /* and fall */ + default: + bp = "/etc/ftpusers"; + break; + } + if ((fp = fopen (bp, "r")) == NULL) + continue; + + while (fgets (buffer, sizeof buffer, fp)) { + if (bp = index (buffer, '\n')) + *bp = NULL; + if (strcmp (buffer, user) == 0) { + hit++; + break; + } + } + + (void) fclose (fp); + } + + + return hit; +} diff --git a/usr/src/contrib/isode/compat/bridge.c b/usr/src/contrib/isode/compat/bridge.c new file mode 100644 index 0000000000..46dfee6777 --- /dev/null +++ b/usr/src/contrib/isode/compat/bridge.c @@ -0,0 +1,428 @@ +/* bridge.c - X.25 abstractions for TCP bridge to X25 */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/bridge.c,v 7.2 91/02/22 09:14:58 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/bridge.c,v 7.2 91/02/22 09:14:58 mrose Interim $ + * + * Contributed by Julian Onions, Nottingham University in the UK + * + * + * $Log: bridge.c,v $ + * Revision 7.2 91/02/22 09:14:58 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/09 14:31:32 mrose + * sync + * + * Revision 7.0 89/11/23 21:22:55 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" +#include "internet.h" +#include "tpkt.h" + +/* TCP/X.25 BRIDGE */ + +#ifdef BRIDGE_X25 + + +static int assfd[FD_SETSIZE]; +static char bridge_inited = 0; + +/* */ + +/* ARGSUSED */ + +int start_bridge_client (local) +struct NSAPaddr *local; +{ + int sd; + u_short port; + register struct servent *sp; + + if ((sp = getservbyname ("x25bridge", "tcp")) == NULL) + port = x25_bridge_port; + else + port = sp -> s_port; + + if ((sd = in_connect (x25_bridge_host, port)) == NOTOK) + return NOTOK; + + if (write_tcp_socket (sd, "\01", 1) != 1) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("initial write")); + + (void) close_tcp_socket (sd); + return NOTOK; + } + + return sd; +} + +/* */ + +static int in_connect (addr, port) +char *addr; +u_short port; +{ + int sd; + struct sockaddr_in in_socket; + register struct sockaddr_in *isock = &in_socket; + register struct hostent *hp; + + if ((hp = gethostbystring (addr)) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s: unknown host", addr)); + + return NOTOK; + } + + bzero ((char *) isock, sizeof *isock); + isock -> sin_family = hp -> h_addrtype; + isock -> sin_port = port; + inaddr_copy (hp, isock); + + if ((sd = start_tcp_client ((struct sockaddr_in *) NULL, 0)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("start_tcp_client")); + + return NOTOK; + } + + if (join_tcp_server (sd, isock) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("join_tcp_server")); + + (void) close_tcp_socket (sd); + return NOTOK; + } + + return sd; +} + +/* */ + +int join_bridge_server (fd, remote) +int fd; +register struct NSAPaddr *remote; +{ + if (remote != NULLNA) + remote -> na_stack = NA_BRG, remote -> na_community = ts_comm_x25_default; + if (bridge_write_nsap_addr (fd, remote, write_tcp_socket) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, ("write of NSAP failed")); + + return NOTOK; + } + + return fd; +} + +/* */ + +int start_bridge_server (local, backlog, opt1, opt2) +struct NSAPaddr *local; +int backlog, + opt1, + opt2; +{ + int len, + new, + sd; + u_short port; + struct servent *sp; + struct sockaddr_in in_socket; + register struct sockaddr_in *isock = &in_socket; + + if (bridge_inited == 0) { + for (sd = 0; sd < FD_SETSIZE; sd++) + assfd[sd] = NOTOK; + bridge_inited = 1; + } + if ((sp = getservbyname ("x25bridge", "tcp")) == NULL) + port = x25_bridge_port; + else + port = sp -> s_port; + + if ((sd = in_connect (x25_bridge_host, port)) == NOTOK) + return NOTOK; + + if (write_tcp_socket (sd, "\02", 1) != 1) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("initial write")); + + (void) close_tcp_socket (sd); + return NOTOK; + } + + if (local != NULLNA) + local -> na_stack = NA_BRG, local -> na_community = ts_comm_x25_default; + if (local != NULLNA && local -> na_dtelen == 0) + { + (void) strcpy (local -> na_dte, x25_bridge_addr); + local -> na_dtelen = strlen(x25_bridge_addr); + } + if (local != NULLNA) { + DLOG (compat_log, LLOG_DEBUG, + ("addr", "type=%d '%s' len=%d", + local -> na_stack, local -> na_dte,local -> na_dtelen)); + DLOG (compat_log, LLOG_DEBUG, + ("addr", "pid='%s'(%d) fac='%s'(%d) cudf='%s'(%d)", + local -> na_pid, local -> na_pidlen, + local -> na_fac, local -> na_faclen, + local -> na_pid, local -> na_pidlen, + local -> na_cudf, local -> na_cudflen)); + } + + if (bridge_write_nsap_addr (sd, local, write_tcp_socket) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, ("write of NSAP failed")); + + (void) close_tcp_socket (sd); + return NOTOK; + } + + if ((new = in_listen (backlog, opt1, opt2)) == NOTOK) { + (void) close_tcp_socket (sd); + return NOTOK; + } + + len = sizeof *isock; + if (getsockname (new, (struct sockaddr *) isock, &len) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("getsockname")); + +out: ; + (void) close_tcp_socket (sd); + (void) close_tcp_socket (new); + return NOTOK; + } + + isock -> sin_family = htons (isock -> sin_family); + if (write_tcp_socket (sd, (char *)isock, sizeof *isock) != sizeof *isock) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("write of sockaddr_in")); + + goto out; + } + assfd[new] = sd; + + return new; +} + +int get_bridge_assfd(fd) +int fd; +{ + if (!bridge_inited) + return NOTOK; + return assfd[fd]; +} + +/* */ + +static int in_listen (backlog, opt1, opt2) +int backlog, + opt1, + opt2; +{ + int sd; + char *cp; + struct sockaddr_in lo_socket; + register struct sockaddr_in *lsock = &lo_socket; + register struct hostent *hp; + + if ((hp = gethostbystring (cp = getlocalhost ())) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s: unknown host", cp)); + + return NOTOK; + } + + bzero ((char *) lsock, sizeof *lsock); + lsock -> sin_family = hp -> h_addrtype; + inaddr_copy (hp, lsock); + + if ((sd = start_tcp_server (lsock, backlog, opt1, opt2)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("start_tcp_server")); + + return NOTOK; + } + + return sd; +} + +/* */ + +int join_bridge_client (fd, remote) +int fd; +struct NSAPaddr *remote; +{ + int new; + struct sockaddr_in in_socket; + struct NSAPaddr sock; + + if ((new = join_tcp_client (fd, &in_socket)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("join_tcp_client")); + + return NOTOK; + } + + if (bridge_read_nsap_addr (new, &sock, read_tcp_socket) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("read of NSAP")); + + (void) close_tcp_socket (new); + return NOTOK; + } + DLOG (compat_log, LLOG_DEBUG, + ("addr", "type=%d '%s' len=%d", sock.na_stack, sock.na_dte, + sock.na_dtelen)); + DLOG (compat_log, LLOG_DEBUG, + ("addr", "pid='%s'(%d) fac='%s'(%d) cudf='%s'(%d)", + sock.na_pid, sock.na_pidlen, + sock.na_fac, sock.na_faclen, + sock.na_pid, sock.na_pidlen, + sock.na_cudf, sock.na_cudflen)); + sock.na_stack = ntohl (sock.na_stack); + *remote = sock; + DLOG (compat_log, LLOG_DEBUG, + ("addr", "type=%d '%s' len=%d", + remote -> na_stack, remote -> na_dte,remote -> na_dtelen)); + DLOG (compat_log, LLOG_DEBUG, + ("addr", "pid='%s'(%d) fac='%s'(%d) cudf='%s'(%d)", + remote -> na_pid, remote -> na_pidlen, + remote -> na_fac, remote -> na_faclen, + remote -> na_pid, remote -> na_pidlen, + remote -> na_cudf, remote -> na_cudflen)); + return new; +} + +int close_bridge_socket (sd) +int sd; +{ + if (bridge_inited && assfd[sd] != NOTOK) + (void) close_tcp_socket (assfd[sd]); + assfd[sd] = NOTOK; + return close_tcp_socket (sd); +} + +/* ARGSUSED */ + +int bridgediscrim (na) +struct NSAPaddr *na; +{ +#ifndef X25 + return 1; /* must be bridge */ +#else + int len = strlen (x25_bridge_discrim); + + if (len == 1 && *x25_bridge_discrim == '-') + return 0; + + return (len == 0 ? 1 + : strncmp (na -> na_dte, x25_bridge_discrim, len) == 0); +#endif +} +#endif + +/* + * Structure is as follows :- + * 0-1 type + * 2-17 dte + * 18 dte len + * 19-22 pid + * 23 pid len + * 24-39 user data + * 40 user data len + * 41-46 facilities + * 47 facility length + */ + +int bridge_write_nsap_addr (fd, nsap, writefnx) +int fd; +struct NSAPaddr *nsap; +IFP writefnx; +{ + u_short na_stack; + char buffer[50]; + + if (nsap == NULLNA || (na_stack = nsap -> na_stack) != NA_BRG) + return NOTOK; + na_stack = htons(na_stack); + bcopy ((char *)&na_stack, buffer, sizeof(na_stack)); + bcopy (nsap -> na_dte, &buffer[2], 16); + buffer[18] = nsap -> na_dtelen; + bcopy (nsap -> na_pid, &buffer[19], 4); + buffer[23] = nsap -> na_pidlen; + bcopy (nsap -> na_cudf, &buffer[24], 16); + buffer[40] = nsap -> na_cudflen; + bcopy (nsap -> na_fac, &buffer[41], 6); + buffer[47] = nsap -> na_faclen; + if ((*writefnx) (fd, buffer, 48) != 48) + return NOTOK; + return OK; +} + +int bridge_read_nsap_addr (fd, nsap, readfnx) +int fd; +struct NSAPaddr *nsap; +IFP readfnx; +{ + u_short na_stack; + char buffer[50]; + + if (readx (fd, buffer, 48, readfnx) != 48) + return NOTOK; + bcopy (buffer, (char *)&na_stack, sizeof(na_stack)); + na_stack = ntohs(na_stack); + if (na_stack != NA_BRG) + return NOTOK; + nsap -> na_stack = na_stack; + bcopy (&buffer[2], nsap -> na_dte, 16); + nsap -> na_dtelen = buffer[18]; + bcopy (&buffer[19], nsap -> na_pid, 4); + nsap -> na_pidlen = buffer[23]; + bcopy (&buffer[24], nsap -> na_cudf, 16); + nsap -> na_cudflen = buffer[40]; + bcopy (&buffer[41], nsap -> na_fac, 6); + nsap -> na_faclen = buffer[47]; + return OK; +} + +static int readx (fd, buffer, n, readfnx) +int fd; +char *buffer; +int n; +IFP readfnx; +{ + register int i, + cc; + register char *bp; + + for (bp = buffer, i = n; i > 0; bp += cc, i -= cc) { + switch (cc = (*readfnx) (fd, bp, i)) { + case NOTOK: + return (i = bp - buffer) ? i : NOTOK; + + case OK: + break; + + default: + continue; + } + break; + } + + return (bp - buffer); +} diff --git a/usr/src/contrib/isode/compat/camtec.c b/usr/src/contrib/isode/compat/camtec.c new file mode 100644 index 0000000000..500dc92050 --- /dev/null +++ b/usr/src/contrib/isode/compat/camtec.c @@ -0,0 +1,267 @@ +/* camtec.c - X.25, CONS abstractions for CAMTEC CCL */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/camtec.c,v 7.3 91/02/22 09:15:02 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/camtec.c,v 7.3 91/02/22 09:15:02 mrose Interim $ + * + * Contributed by Keith Ruttle, CAMTEC Electronics Ltd + * + * + * $Log: camtec.c,v $ + * Revision 7.3 91/02/22 09:15:02 mrose + * Interim 6.8 + * + * Revision 7.2 91/01/14 13:33:46 mrose + * loader + * + * Revision 7.1 90/07/09 14:31:37 mrose + * sync + * + * Revision 7.0 89/11/23 21:22:56 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" + +#ifdef X25 + +#include "x25.h" +#include "isoaddrs.h" + + +#ifdef CAMTEC_CCL + +#include "tailor.h" +#include "tpkt.h" + +/* 4.[23] UNIX: CCL X25 */ + + +static char calling_dte[NSAP_DTELEN + 1]; + +/* */ + +int start_x25_client (local) +struct NSAPaddr *local; +{ + int sd, pgrp; + CONN_DB l_iov; + + if (local != NULLNA) + local -> na_stack = NA_X25, local -> na_community = ts_comm_x25_default; + if ((sd = socket (AF_CCL, SOCK_STREAM, CCLPROTO_X25)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("socket")); + return NOTOK; /* Error can be found in errno */ + } + + pgrp = getpid(); + if (ioctl(sd, SIOCSPGRP, &pgrp)) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("SIOCSPGRP")); + return NOTOK; /* Error can be found in errno */ + } + + l_iov.ccl_iovec[0].iov_base = calling_dte; + gen2if(local, &l_iov, ADDR_LOCAL); + + return sd; +} + +/* */ + +int start_x25_server (local, backlog, opt1, opt2) +struct NSAPaddr *local; +int backlog, + opt1, + opt2; +{ + int sd, pgrp; + CONN_DB b_iov; + char param1[128]; + + b_iov.ccl_iovec[0].iov_base = param1; + + if ((sd = socket (AF_CCL, SOCK_STREAM, CCLPROTO_X25)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("socket")); + return NOTOK; /* Can't get an X.25 socket */ + } + + pgrp = getpid(); + if (ioctl(sd, SIOCSPGRP, &pgrp)) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("SIOCSPGRP")); + return NOTOK; /* Error can be found in errno */ + } + + if (local != NULLNA) { + local -> na_stack = NA_X25, local -> na_community = ts_comm_x25_default; + if (local -> na_dtelen == 0) { + (void) strcpy (local -> na_dte, x25_local_dte); + local -> na_dtelen = strlen(x25_local_dte); + if (local -> na_pidlen == 0 && *x25_local_pid) + local -> na_pidlen = + str2sel (x25_local_pid, -1, local -> na_pid, NPSIZE); + } + } + + (void) gen2if (local, &b_iov, ADDR_LISTEN); + if (bind (sd, &b_iov, sizeof(b_iov)) != NOTOK) { + if (ioctl(sd, CCL_AUTO_ACCEPT, 1) < 0) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", + ("CCL_AUTO_ACCEPT")); + close (sd); + return NOTOK; + } + (void) listen (sd, backlog); + return sd; + } + + (void) close (sd); + return NOTOK; +} + +/* */ + +int join_x25_client (fd, remote) +int fd; +struct NSAPaddr *remote; +{ + CONN_DB sck; + struct iovec *iov; + int i, len = 0; + int nfd; + char param1[128]; + char param2[128]; + char param3[128]; + char param4[256]; + + iov = &(sck.ccl_iovec[0]); + if((nfd = accept (fd, (char *) 0, &len)) == NOTOK) + return NOTOK; + iov[0].iov_base = param1; + iov[1].iov_base = param2; + iov[2].iov_base = param3; + iov[3].iov_base = param4; + iov[0].iov_len = iov[1].iov_len = iov[2].iov_len = 128; + iov[3].iov_len = 256; + iov[4].iov_len = iov[5].iov_len = iov[6].iov_len = 0; + if (ioctl(nfd, CCL_FETCH_CONNECT, &iov[0]) < 0) + return NOTOK; + (void) if2gen (remote, &sck, ADDR_REMOTE); + ioctl (nfd, CCL_SEND_TYPE, 0); + return nfd; +} + +int join_x25_server (fd, remote) +int fd; +struct NSAPaddr *remote; +{ + CONN_DB zsck; + CONN_DB *sck = &zsck; + int r; + struct iovec *iov = &( zsck.ccl_iovec[0] ); + char param1[128]; + char param3[128]; + char param4[256]; + + if (remote == NULLNA || remote -> na_stack != NA_X25) + { + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("Invalid type na%d", remote->na_stack)); + return NOTOK; + } + + iov[0].iov_base = param1; + iov[1].iov_base = calling_dte; + iov[1].iov_len = strlen(calling_dte); + iov[2].iov_base = param3; + iov[3].iov_base = param4; + iov[4].iov_len = iov[5].iov_len = iov[6].iov_len = 0; + + (void) gen2if (remote, sck, ADDR_REMOTE); + if ((r = connect (fd, sck, sizeof (CONN_DB))) >= 0) + ioctl (fd, CCL_SEND_TYPE, 0); + bzero(calling_dte, sizeof calling_dte ); + return (r); +} + +int read_x25_socket (fd, buffer, len) +int fd, len; +char *buffer; +{ + static u_char mode; + int cc, count = 0, total = len; + char *p = buffer; + + do { + cc = recv (fd, p, total, 0); + switch (cc) { + case NOTOK: + if (errno == ECONNRESET) { + struct iovec iov[7]; + char parm[34]; + int i; + iov[0].iov_base = parm; + iov[0].iov_len = 1; + iov[1].iov_base = parm + 1; + iov[1].iov_len = 32; + for (i = 2; i < 7; i++) { + iov[i].iov_base = (char *)0; + iov[i].iov_len = 0; + } + ioctl(fd, CCL_FETCH_RESET, iov); + elucidate_x25_err( 1 << RECV_DIAG, iov[0].iov_base); + } + case 0: + return cc; + + default: + ioctl (fd, CCL_RECV_TYPE, &mode); + count += cc; + p += cc; + total -= cc; + break; + } + } while (total > 0 && (mode & MORE_DATA)); + + DLOG (compat_log, LLOG_DEBUG, + ("X25 read, total %d", count )); + return count; +} + +int write_x25_socket (fd, buffer, len) +int fd, len; +char *buffer; +{ + int count; + int cc; + + count = send(fd, buffer, len, 0); + DLOG (compat_log, LLOG_DEBUG, + ("X25 write, total %d/%d", count, len)); + return count; +} +#else /* CAMTEC_CCL */ +int _sunlink_stub2 () {}; +#endif /* CAMTEC_CCL */ +#else /* X25 */ +int _sunlink_stub () {}; +#endif /* X25 */ diff --git a/usr/src/contrib/isode/compat/chkpassword.c b/usr/src/contrib/isode/compat/chkpassword.c new file mode 100644 index 0000000000..979eb855d7 --- /dev/null +++ b/usr/src/contrib/isode/compat/chkpassword.c @@ -0,0 +1,94 @@ +/* chkpassword.c - check the password */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/chkpassword.c,v 7.1 91/02/22 09:15:03 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/chkpassword.c,v 7.1 91/02/22 09:15:03 mrose Interim $ + * + * + * $Log: chkpassword.c,v $ + * Revision 7.1 91/02/22 09:15:03 mrose + * Interim 6.8 + * + * Revision 7.0 91/01/14 11:00:31 mrose + * *** empty log message *** + * + */ + +/* + * 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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" + + +char *crypt (); + + +#ifdef KRB_PASSWD +#include +#endif + +/* L.McLoughlin added kerberos passwd checking - based on original + * code from xnlock by S. Lacey. + * Takes the username, the password from the password file, and the passwd + * the user is trying to use. + * Returns 1 if the passwd matches otherwise 0. + */ + +#ifndef KRB_PASSWD +/* ARGSUSED */ +#endif + +int chkpassword ( usrname, pwpass, usrpass ) +char *usrname; +char *pwpass; +char *usrpass; +{ +#ifdef KRB_PASSWD + char realm[REALM_SZ]; + int krbval; + + /* + * check to see if the passwd is `*krb*' + * if it is, use kerberos + */ + + if (strcmp(pwpass, "*krb*") == 0) { + /* + * use kerberos, first of all find the realm + */ + if (krb_get_lrealm(realm, 1) != KSUCCESS) { + (void) strncpy(realm, KRB_REALM, sizeof(realm)); + } + + /* + * now check the passwd + */ + krbval = krb_get_pw_in_tkt(usrname, "", + realm, "krbtgt", + realm, + DEFAULT_TKT_LIFE, usrpass); + + return (krbval == INTK_OK);; + } +#endif + + /* + * use passwd file password + */ + return (strcmp(crypt(usrpass, pwpass), pwpass) == 0); +} diff --git a/usr/src/contrib/isode/compat/chrcnv.c b/usr/src/contrib/isode/compat/chrcnv.c new file mode 100644 index 0000000000..364afd6460 --- /dev/null +++ b/usr/src/contrib/isode/compat/chrcnv.c @@ -0,0 +1,75 @@ +/* chrcnv.c - character conversion table */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/chrcnv.c,v 7.1 91/02/22 09:15:04 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/chrcnv.c,v 7.1 91/02/22 09:15:04 mrose Interim $ + * + * + * $Log: chrcnv.c,v $ + * Revision 7.1 91/02/22 09:15:04 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:22:58 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" + +/* */ + +char /* character conversion table */ + chrcnv[] = /* lower to upper case letters */ +{ + '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7', + '\10', '\t', '\n', '\13', '\14', '\r', '\16', '\17', + '\20', '\21', '\22', '\23', '\24', '\25', '\26', '\27', + '\30', '\31', '\32', '\33', '\34', '\35', '\36', '\37', + ' ', '!', '"', '#', '$', '%', '&', '\47', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7', + '\10', '\t', '\n', '\13', '\14', '\r', '\16', '\17', + '\20', '\21', '\22', '\23', '\24', '\25', '\26', '\27', + '\30', '\31', '\32', '\33', '\34', '\35', '\36', '\37', + ' ', '!', '"', '#', '$', '%', '&', '\47', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177' +}; + diff --git a/usr/src/contrib/isode/compat/cmd_srch.c b/usr/src/contrib/isode/compat/cmd_srch.c new file mode 100644 index 0000000000..c89a2da35b --- /dev/null +++ b/usr/src/contrib/isode/compat/cmd_srch.c @@ -0,0 +1,48 @@ +/* cmd_srch.c - search a lookup table: return numeric value */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/cmd_srch.c,v 7.1 91/02/22 09:15:06 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/cmd_srch.c,v 7.1 91/02/22 09:15:06 mrose Interim $ + * + * + * $Log: cmd_srch.c,v $ + * Revision 7.1 91/02/22 09:15:06 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:22:58 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include "manifest.h" +#include "cmd_srch.h" + +/* */ + +/* map a string onto a value */ + +cmd_srch(str, cmd) +register char *str; +register CMD_TABLE *cmd; +{ + for(;cmd->cmd_key != NULLCP; cmd++) + if(lexequ(str, cmd->cmd_key) == 0) + return(cmd->cmd_value); + return(cmd->cmd_value); +} diff --git a/usr/src/contrib/isode/compat/dgram.c b/usr/src/contrib/isode/compat/dgram.c new file mode 100644 index 0000000000..1a5e001dd2 --- /dev/null +++ b/usr/src/contrib/isode/compat/dgram.c @@ -0,0 +1,825 @@ +/* dgram.c - datagram (CL-mode TS) abstractions */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/dgram.c,v 7.11 91/02/22 09:15:07 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/dgram.c,v 7.11 91/02/22 09:15:07 mrose Interim $ + * + * + * $Log: dgram.c,v $ + * Revision 7.11 91/02/22 09:15:07 mrose + * Interim 6.8 + * + * Revision 7.10 91/01/10 04:10:25 mrose + * set_check_fd + * + * Revision 7.9 91/01/07 12:39:50 mrose + * update + * + * Revision 7.8 90/12/17 22:17:21 mrose + * marv + * + * Revision 7.7 90/07/09 14:31:43 mrose + * sync + * + * Revision 7.6 90/04/23 00:08:08 mrose + * touch-up + * + * Revision 7.5 90/01/11 18:35:03 mrose + * real-sync + * + * Revision 7.4 89/12/19 17:57:34 mrose + * touch-up + * + * Revision 7.3 89/12/19 15:15:31 mrose + * dgram + * + * Revision 7.2 89/12/17 18:30:11 mrose + * foo + * + * Revision 7.1 89/12/11 16:22:25 mrose + * more dgram + * + * Revision 7.0 89/12/01 10:42:35 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + +#include "dgram.h" +#ifdef TCP +#include "internet.h" +#endif +#ifdef TP4 +#include "tp4.h" +#endif + + +#if defined(SOCKETS) && (defined(TCP) || defined(CLTS)) +#ifndef DEBUG +#define action(s,f,i) +#endif + +extern int errno; + +/* */ + +union sockaddr_un { /* 'cause sizeof (struct sockaddr_iso) == 32 */ + struct sockaddr sa; + +#ifdef TCP + struct sockaddr_in sin; +#endif + +#ifdef BSD_TP4 + union sockaddr_osi sosi; +#endif +}; + + +struct dgramblk { + int dgram_parent; + union sockaddr_un dgram_peer; +#ifdef BSD44 + u_char dgram_addrlen; +#endif + + struct qbuf dgram_queue; +}; + + +static int maxpeers = 0; +static struct dgramblk *peers = NULL; + +/* */ + +#ifdef TCP + +/* ARGSUSED */ + +int start_udp_server (sock, backlog, opt1, opt2) +struct sockaddr_in *sock; +int backlog, + opt1, + opt2; +{ + register int port; + int sd; +#ifdef BSD43 + int onoff; +#endif + register struct dgramblk *up, + *vp; + + if (peers == NULL) { + maxpeers = getdtablesize (); + peers = (struct dgramblk *) calloc ((unsigned)maxpeers, sizeof *peers); + if (peers == NULL) + return NOTOK; + + for (vp = (up = peers) + maxpeers; up < vp; up++) { + up -> dgram_parent = NOTOK; + up -> dgram_queue.qb_forw = up -> dgram_queue.qb_back = + &up -> dgram_queue; + } + } + + if ((sd = socket (AF_INET, SOCK_DGRAM, 0)) == NOTOK) + return NOTOK; + + if (sock -> sin_port != 0) { + action ("BIND", sd, (struct sockaddr *) sock); + + if (bind (sd, (struct sockaddr *) sock, sizeof *sock) != NOTOK) + goto got_socket; + + (void) close (sd); + return NOTOK; + } + else + sock -> sin_family = AF_INET; + + for (port = IPPORT_RESERVED;; port++) { + sock -> sin_port = htons ((u_short) port); + + action ("BIND", sd, (struct sockaddr *) sock); + + if (bind (sd, (struct sockaddr *) sock, sizeof *sock) != NOTOK) + break; + + switch (errno) { + case EADDRINUSE: + continue; + + case EADDRNOTAVAIL: + default: + (void) close (sd); + return NOTOK; + } + } + +got_socket: ; +#ifdef DEBUG + { + int len = sizeof *sock; + + action ("FOO1", sd, (struct sockaddr *) sock); + if (getsockname (sd, (struct sockaddr *) sock, &len) != NOTOK) + action ("FOO2", sd, (struct sockaddr *) sock); + } +#endif + +#ifndef BSD43 + if (opt1) + (void) setsockopt (sd, SOL_SOCKET, opt1, NULLCP, 0); + if (opt2) + (void) setsockopt (sd, SOL_SOCKET, opt2, NULLCP, 0); +#else + onoff = 1; + if (opt1) + (void) setsockopt (sd, SOL_SOCKET, opt1, (char *)&onoff, sizeof onoff); + if (opt2) + (void) setsockopt (sd, SOL_SOCKET, opt2, (char *)&onoff, sizeof onoff); +#endif + + (void) set_check_fd (sd, check_dgram_socket, NULLCP); + return (peers[sd].dgram_parent = sd); +} +#endif + +/* */ + +#ifdef BSD_TP4 + +/* ARGSUSED */ + +int start_clts_server (sock, backlog, opt1, opt2) +union sockaddr_osi *sock; +int backlog, + opt1, + opt2; +{ + int sd; +#ifdef BSD43 + int onoff; +#endif + u_char *cp; + register struct dgramblk *up, + *vp; + struct sockaddr_iso *ifaddr = &sock -> osi_sockaddr; + + if (peers == NULL) { + maxpeers = getdtablesize (); + peers = (struct dgramblk *) calloc ((unsigned)maxpeers, sizeof *peers); + if (peers == NULL) + return NOTOK; + + for (vp = (up = peers) + maxpeers; up < vp; up++) { + up -> dgram_parent = NOTOK; + up -> dgram_queue.qb_forw = up -> dgram_queue.qb_back = + &up -> dgram_queue; + } + } + + if ((sd = socket (AF_ISO, SOCK_DGRAM, 0)) == NOTOK) + return NOTOK; + + if (ifaddr -> siso_tlen != 0) { + action ("BIND", sd, (struct sockaddr *) ifaddr); + + if (bind (sd, (struct sockaddr *) ifaddr, (int) ifaddr -> siso_len) + != NOTOK) + goto got_socket; + + (void) close (sd); + return NOTOK; + } + else + ifaddr -> siso_family = AF_ISO; + + { + int pid; + u_char *dp, + *ep, + *fp; + + pid = getpid (); + cp = fp = (u_char *) ifaddr -> siso_data + ifaddr -> siso_nlen; + for (ep = (dp = (u_char *) &pid) + sizeof pid; dp < ep; dp++) + *cp++ = *dp; + ifaddr -> siso_tlen = (cp - fp) + 1; + ifaddr -> siso_slen = ifaddr -> siso_plen = 0; + ifaddr -> siso_len = sizeof *ifaddr; + } + + for (*cp = 0x00; *cp < 0xff; *cp += 1) { + action ("BIND", sd, (struct sockaddr *) ifaddr); + + if (bind (sd, (struct sockaddr *) ifaddr, (int) ifaddr -> siso_len) + != NOTOK) + goto got_socket; + + switch (errno) { + case EADDRINUSE: + continue; + + case EADDRNOTAVAIL: + default: + (void) close (sd); + return NOTOK; + } + } + (void) close (sd); + errno = EADDRNOTAVAIL; + return NOTOK; + +got_socket: ; +#ifdef DEBUG + { + int len = sizeof *sock; + + action ("FOO1", sd, ifaddr); + if (getsockname (sd, (struct sockaddr *) ifaddr, &len) != NOTOK) + action ("FOO2", sd, ifaddr); + } +#endif + +#ifndef BSD43 + if (opt1) + (void) setsockopt (sd, SOL_SOCKET, opt1, NULLCP, 0); + if (opt2) + (void) setsockopt (sd, SOL_SOCKET, opt2, NULLCP, 0); +#else + onoff = 1; + if (opt1) + (void) setsockopt (sd, SOL_SOCKET, opt1, (char *)&onoff, sizeof onoff); + if (opt2) + (void) setsockopt (sd, SOL_SOCKET, opt2, (char *)&onoff, sizeof onoff); +#endif + + (void) set_check_fd (sd, check_dgram_socket, NULLCP); + return (peers[sd].dgram_parent = sd); +} +#endif + +/* */ + +int join_dgram_aux (fd, sock, newfd) +int fd, + newfd; +struct sockaddr *sock; +{ + int nfds, + sd; + fd_set ifds; + register struct qbuf *qb; + register struct dgramblk *up; + + if (fd < 0 || fd >= maxpeers || peers[fd].dgram_parent != fd) { + errno = EINVAL; + return NOTOK; + } + + if (newfd) { + FD_ZERO (&ifds); + + nfds = fd + 1; + FD_SET (fd, &ifds); + if (select_dgram_socket (nfds, &ifds, NULLFD, NULLFD, OK) == NOTOK) + return NOTOK; + + up = &peers[fd]; + if ((qb = up -> dgram_queue.qb_forw) == &up -> dgram_queue) { + errno = EWOULDBLOCK; + return NOTOK; + } + + if ((sd = dup (fd)) == NOTOK) + return NOTOK; + (void) set_check_fd (fd, check_dgram_socket, NULLCP); + + up = &peers[sd]; +#ifdef BSD44 + bcopy (qb -> qb_base, (caddr_t) sock, + ((struct sockaddr *) qb -> qb_base) -> sa_len); +#else + *sock = *((struct sockaddr *) qb -> qb_base); /* struct copy */ +#endif + + remque (qb); + insque (qb, up -> dgram_queue.qb_back); + } + else + up = &peers[fd]; + + up -> dgram_parent = fd; +#ifdef BSD44 + if (sock -> sa_len == 0) + sock -> sa_len = sizeof *sock; + bcopy ((caddr_t) sock, (caddr_t) &up -> dgram_peer, sock -> sa_len); + { + struct sockaddr_in *sin; + + up -> dgram_addrlen = sock -> sa_family != AF_INET ? sock -> sa_len + : sizeof *sin - sizeof sin -> sin_zero; + } +#else + up -> dgram_peer.sa = *sock; /* struct copy */ +#endif + + action ("JOIN", newfd ? sd : fd, sock); + + return (newfd ? sd : OK); +} + +/* */ + +int read_dgram_socket (fd, q) +int fd; +struct qbuf **q; +{ + int nfds; + fd_set ifds, + mask; + register struct qbuf *qb; + register struct dgramblk *up; + + if (fd < 0 + || fd >= maxpeers + || (up = &peers[fd]) -> dgram_parent == NOTOK) { + errno = EINVAL; + return NOTOK; + } + + if ((qb = up -> dgram_queue.qb_forw) == &up -> dgram_queue) { + FD_ZERO (&mask); + + nfds = fd + 1; + FD_SET (fd, &mask); + for (ifds = mask;; ifds = mask) { + if (select_dgram_socket (nfds, &ifds, NULLFD, NULLFD, NOTOK) + == NOTOK) + return NOTOK; + + if ((qb = up -> dgram_queue.qb_forw) != &up -> dgram_queue) + break; + } + } + + remque (qb); + qb -> qb_forw = qb -> qb_back = qb; + + *q = qb; + + return qb -> qb_len; +} + +/* */ + +int hack_dgram_socket (fd, sock) +int fd; +struct sockaddr *sock; +{ + register struct dgramblk *up; + + if (fd < 0 + || fd >= maxpeers + || (up = &peers[fd]) -> dgram_parent != fd) { + errno = EINVAL; + return NOTOK; + } + + if (sock == NULL) { + bzero ((caddr_t) &up -> dgram_peer, sizeof up -> dgram_peer); + return OK; + } + +#ifdef BSD44 + if (sock -> sa_len == 0) + sock -> sa_len = sizeof *sock; + bcopy ((caddr_t) sock, (caddr_t) &up -> dgram_peer, sock -> sa_len); + up -> dgram_addrlen = 0; +#else + up -> dgram_peer.sa = *sock; /* struct copy */ +#endif + + action ("HACK", fd, sock); + + return OK; +} + + +int write_dgram_socket (fd, qb) +int fd; +register struct qbuf *qb; +{ + register struct dgramblk *up; + + if (fd < 0 + || fd >= maxpeers + || (up = &peers[fd]) -> dgram_parent == NOTOK + || up -> dgram_peer.sa.sa_family == 0) { + errno = EINVAL; + return NOTOK; + } + + action ("SENDTO", fd, &up -> dgram_peer.sa); + +#ifdef BSD44 + return sendto (fd, qb -> qb_data, qb -> qb_len, NULL, + &up -> dgram_peer.sa, (int) up -> dgram_peer.sa.sa_len); +#else + return sendto (fd, qb -> qb_data, qb -> qb_len, NULL, + &up -> dgram_peer.sa, sizeof up -> dgram_peer.sa); +#endif +} + + +/* */ + +int close_dgram_socket (fd) +int fd; +{ + register struct dgramblk *up, + *vp; + + if (fd < 0 + || fd >= maxpeers + || (up = &peers[fd]) -> dgram_parent == NOTOK) { + errno = EINVAL; + return NOTOK; + } + + action ("CLOSE", fd, &up -> dgram_peer.sa); + + up -> dgram_parent = NOTOK; + bzero ((char *) &up -> dgram_peer, sizeof up -> dgram_peer); + QBFREE (&up -> dgram_queue); + + for (vp = (up = peers) + maxpeers; up < vp; up++) + if (up -> dgram_parent == fd) + up -> dgram_parent = up - peers; + + (void) set_check_fd (fd, NULLIFP, NULLCP); + return close (fd); +} + +/* */ + +int select_dgram_socket (nfds, rfds, wfds, efds, secs) +int nfds; +fd_set *rfds, + *wfds, + *efds; +int secs; +{ + register int fd; + int cc, + mfds, + result; + fd_set ifds, + jfds; + register struct qbuf *qb; + register struct dgramblk *up, + *vp; + struct dgramblk *wp; + union sockaddr_un *sock; + + if (rfds) { + jfds = *rfds; + + if (secs != OK) + for (vp = (up = peers) + maxpeers, fd = 0; up < vp; up++, fd++) + if (up -> dgram_parent != NOTOK + && FD_ISSET (fd, &jfds) + && up -> dgram_queue.qb_forw != &up -> dgram_queue) { + secs = OK; + break; + } + } + + if ((result = selsocket (nfds, rfds, wfds, efds, secs)) == NOTOK + || rfds == NULLFD) + return result; + + ifds = *rfds; + if ((mfds = nfds) > maxpeers) + mfds = maxpeers; + for (fd = 0, up = peers; fd < mfds; fd++, up++) + if (FD_ISSET (fd, &ifds)) { + int slen; + u_char len; + char *data; + + FD_CLR (fd, &ifds); + + if (up -> dgram_parent == NOTOK) + continue; + + if ((qb = (struct qbuf *) malloc ((unsigned) (sizeof *qb + + (slen + = sizeof *sock) + + MAXDGRAM))) + == NULL) + return NOTOK; + + sock = (union sockaddr_un *) qb -> qb_base; + qb -> qb_data = qb -> qb_base + slen; + if ((cc = recvfrom (fd, qb -> qb_data, MAXDGRAM, NULL, + &sock -> sa, &slen)) == NOTOK) { + free ((char *) qb); + return NOTOK; + } +#ifdef BSD44 + sock -> sa.sa_len = slen; +#endif + qb -> qb_len = cc; + + action ("RECVFROM", fd, &sock -> sa); + + vp = up; + data = sock -> sa.sa_data; + switch (sock -> sa.sa_family) { + case AF_INET: /* XXX: doesn't take into account padding */ + len = sizeof sock -> sa.sa_data + - sizeof sock -> sin.sin_zero; + break; + + default: +#ifdef BSD44 + len = sock -> sa.sa_len; +#else + len = sizeof sock -> sa; +#endif + break; + } + if ( +#ifdef BSD44 + len != up -> dgram_addrlen || +#endif + bcmp (data, up -> dgram_peer.sa.sa_data, (int) len) + != 0) { + for (wp = (vp = peers) + maxpeers; vp < wp; vp++) + if (vp != up + && vp -> dgram_parent == up -> dgram_parent +#ifdef BSD44 + && len == vp -> dgram_addrlen +#endif + && bcmp (data, vp -> dgram_peer.sa.sa_data, + (int) len) == 0) + break; + if (vp >= wp + && (vp = &peers[up -> dgram_parent]) + -> dgram_peer.sa.sa_family != 0) { + free ((char *) qb); + continue; + } + } + + insque (qb, vp -> dgram_queue.qb_back); + + if (--result <= 0 + || (result = selsocket (nfds, &ifds, NULLFD, NULLFD, OK)) + <= 0) + break; + + } + + for (vp = (up = peers) + maxpeers, fd = 0; up < vp; up++, fd++) + if (up -> dgram_parent != NOTOK && FD_ISSET (fd, &jfds)) + if (up -> dgram_queue.qb_forw != &up -> dgram_queue) + FD_SET (fd, rfds); + else + FD_CLR (fd, rfds); + + result = 0; + ifds = *rfds; + if (wfds) + for (fd = 0; fd < nfds; fd++) + if (FD_ISSET (fd, wfds)) + FD_SET (fd, &ifds); + if (efds) + for (fd = 0; fd < nfds; fd++) + if (FD_ISSET (fd, efds)) + FD_SET (fd, &ifds); + for (fd = 0; fd < nfds; fd++) + if (FD_ISSET (fd, &ifds)) + result++; + + return result; +} + +/* */ + +int check_dgram_socket (fd) +int fd; +{ + int nfds; + fd_set ifds; + + FD_ZERO (&ifds); + + nfds = fd + 1; + FD_SET (fd, &ifds); + + return select_dgram_socket (nfds, &ifds, NULLFD, NULLFD, OK); +} + +/* */ + +#ifdef DEBUG + +#ifdef TCP +#include "isoaddrs.h" + + +static inetprint (sin, bp) +struct sockaddr_in *sin; +char *bp; +{ + (void) sprintf (bp, "Internet=%s+%d+%d", inet_ntoa (sin -> sin_addr), + (int) ntohs (sin -> sin_port), NA_TSET_UDP); +} +#endif + +/* */ + +#ifdef CLTS +/* prints OSI address using the format described in: + + "A string encoding of Presentation Address" + + S.E. Kille, Research Note RN/89/14, February 1989 + Department of Computer Science + University College London + + */ + +#ifndef SSEL +#define SSEL(s) ((s)->siso_tlen + TSEL(s)) +#define PSEL(s) ((s)->siso_slen + SSEL(s)) +#endif + + +static isoprint (siso, bp) +register struct sockaddr_iso *siso; +char *bp; +{ + int didone = 0; + + if (siso -> siso_plen) { + hexprint (bp, siso -> siso_plen, PSEL (siso), "'", "'H"); + bp += strlen (bp); + *bp++ = '/'; + didone++; + } + if (siso -> siso_slen || didone) { + hexprint (bp, siso -> siso_slen, SSEL (siso), "'", "'H"); + bp += strlen (bp); + *bp++ = '/'; + didone++; + } + if (siso -> siso_tlen || didone) { + hexprint (bp, siso -> siso_tlen, TSEL (siso), "'", "'H"); + bp += strlen (bp); + *bp++ = '/'; + didone++; + } + hexprint (bp, siso -> siso_nlen, siso -> siso_data, "NS+", ""); +} + + +static hexprint (bp, n, buf, start, stop) +char *bp; +int n; +u_char *buf; +char *start, + *stop; +{ + register u_char *in = buf, *top = in + n; + + if (n == 0) + return; + + (void) strcpy (bp, start); + bp += strlen (bp); + + while (in < top) { + (void) sprintf (bp, "%02x", *in++ & 0xff); + bp += 2; + } + + (void) strcpy (bp, stop); +} +#endif + +/* */ + +static struct printent { + int p_family; + IFP p_function; +} ents[] = { +#ifdef TCP + AF_INET, inetprint, +#endif + +#ifdef CLTS + AF_ISO, isoprint, +#endif + + NULL +}; + +static action (s, fd, sock) +char *s; +int fd; +struct sockaddr *sock; +{ + char buffer[BUFSIZ]; + register struct printent *p; + + if (!(compat_log -> ll_events & LLOG_TRACE)) + return; + + for (p = ents; p -> p_family; p++) + if (p -> p_family == sock -> sa_family) + break; + if (!p -> p_family) { + DLOG (compat_log, LLOG_EXCEPTIONS, + ("unknown dgram address family 0x%x", sock -> sa_family)); + return; + } + + (void) (*p -> p_function) (sock, buffer); + + DLOG (compat_log, LLOG_TRACE, ("%-10.10s %d %s", s, fd, buffer)); +} +#endif + +#else + +/* */ + +int dgram_dummy () {} + +#endif diff --git a/usr/src/contrib/isode/compat/explode.c b/usr/src/contrib/isode/compat/explode.c new file mode 100644 index 0000000000..fb955a681a --- /dev/null +++ b/usr/src/contrib/isode/compat/explode.c @@ -0,0 +1,62 @@ +/* explode.c - explode octets into ascii */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/explode.c,v 7.1 91/02/22 09:15:09 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/explode.c,v 7.1 91/02/22 09:15:09 mrose Interim $ + * + * + * $Log: explode.c,v $ + * Revision 7.1 91/02/22 09:15:09 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:22:59 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" + +/* DATA */ + +static char nib2hex[0x10] = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' +}; + +/* */ + +int explode (a, b, n) +register char *a; +register u_char *b; +register int n; +{ + register int i; + register u_char c; + + for (i = 0; i < n; i++) { + c = *b++; + *a++ = nib2hex[(c & 0xf0) >> 4]; + *a++ = nib2hex[(c & 0x0f)]; + } + *a = NULL; + + return (n * 2); +} diff --git a/usr/src/contrib/isode/compat/general.c.org b/usr/src/contrib/isode/compat/general.c.org new file mode 100644 index 0000000000..78e849234d --- /dev/null +++ b/usr/src/contrib/isode/compat/general.c.org @@ -0,0 +1,161 @@ +/* general.c - general utilities for emulation of 4.2BSD */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/general.c,v 7.3 91/02/22 09:15:10 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/general.c,v 7.3 91/02/22 09:15:10 mrose Interim $ + * + * + * $Log: general.c,v $ + * Revision 7.3 91/02/22 09:15:10 mrose + * Interim 6.8 + * + * Revision 7.2 91/02/12 18:30:43 mrose + * update + * + * Revision 7.1 91/01/14 13:33:48 mrose + * loader + * + * Revision 7.0 89/11/23 21:23:00 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" + +/* Berkeley UNIX: 4.2 */ + +#ifdef BSD42 + +/* Simply including "general.h" is sufficient. */ + +int _general_stub () {}; + +#endif + +/* non-Berkeley UNIX */ + +#ifndef BSDLIBC + +#ifndef lint + +struct qelem { + struct qelem *q_forw; + struct qelem *q_back; + char q_data[1]; /* extensible */ +}; + + +insque (elem, pred) +struct qelem *elem, + *pred; +{ + pred -> q_forw -> q_back = elem; + elem -> q_forw = pred -> q_forw; + elem -> q_back = pred; + pred -> q_forw = elem; +} + + +remque (elem) +struct qelem *elem; +{ + elem -> q_forw -> q_back = elem -> q_back; + elem -> q_back -> q_forw = elem -> q_forw; +} + +#endif +#endif + +/* DUP2 */ + +#ifndef BSD42 +#ifdef SYS5 +#include +#endif + + +extern int errno; + + +int dup2 (d1, d2) +register int d1, + d2; +{ + int d; + + if (d1 == d2) + return OK; + + (void) close (d2); +#ifdef F_DUPFD + if ((d = fcntl (d1, F_DUPFD, d2)) == NOTOK) + return NOTOK; +#else + if ((d = dup2_aux (d1, d2)) == NOTOK) + return NOTOK; +#endif + if (d == d2) + return OK; + + errno = 0; + return NOTOK; +} + + +#ifndef F_DUPFD +dup2_aux (d1, d2) +int d1, + d2; +{ + int fd, + result; + + if ((fd = dup (d1)) == NOTOK || fd == d2) + return fd; + + result = dup2_aux (d1, d2); + + (void) close (fd); + + return result; +} +#endif +#endif + +/* BYTEORDER */ + +#ifndef SWABLIB + +/* ROS and HP-UX don't seem to have these in libc.a */ + +#undef ntohs +u_short ntohs (netshort) u_short netshort; { return netshort; } + +#undef htons +u_short htons (hostshort) u_short hostshort; { return hostshort; } + +#undef ntohl +u_long ntohl (netlong) u_long netlong; { return netlong; } + +#undef htonl +u_long htonl (hostlong) u_long hostlong; { return hostlong; } + +#endif diff --git a/usr/src/contrib/isode/compat/getpassword.c b/usr/src/contrib/isode/compat/getpassword.c new file mode 100644 index 0000000000..9916b5b644 --- /dev/null +++ b/usr/src/contrib/isode/compat/getpassword.c @@ -0,0 +1,148 @@ +/* getpassword.c - generic read-the-password-from-the-tty */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/getpassword.c,v 7.2 91/02/22 09:15:11 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/getpassword.c,v 7.2 91/02/22 09:15:11 mrose Interim $ + * + * + * $Log: getpassword.c,v $ + * Revision 7.2 91/02/22 09:15:11 mrose + * Interim 6.8 + * + * Revision 7.1 90/11/21 11:29:39 mrose + * sun + * + * Revision 7.0 89/11/23 21:23:01 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#ifdef BSD42 +#include +#endif +#ifdef SYS5 +#include +#include +#endif +#include + + +#ifdef BSD44 +char *getpass (); +#endif + +/* */ + +/* roll our own since want to get past UNIX's limit of 8 octets... */ + +char *getpassword (prompt) +char *prompt; +{ +#ifndef BSD44 + register int c; + int flags, + isopen; + register char *bp, + *ep; +#if !defined(SYS5) && !defined(XOS_2) + struct sgttyb sg; +#else + struct termio sg; +#endif + SFP istat; + FILE *fp; + static char buffer[BUFSIZ]; + +#ifdef SUNLINK_7_0 + fp = stdin, isopen = 0; /* will help greatly to work off a script */ +#else + if ((c = open ("/dev/tty", O_RDWR)) != NOTOK && (fp = fdopen (c, "r"))) + setbuf (fp, NULLCP), isopen = 1; + else { + if (c != NOTOK) + (void) close (c); + + fp = stdin, isopen = 0; + } +#endif + + istat = signal (SIGINT, SIG_IGN); + +#if !defined(SYS5) && !defined(XOS_2) + (void) gtty (fileno (fp), &sg); + flags = sg.sg_flags; + sg.sg_flags &= ~ECHO; + (void) stty (fileno (fp), &sg); +#else + (void) ioctl (fileno (fp), TCGETA, (char *) &sg); + flags = sg.c_lflag; + sg.c_lflag &= ~ECHO; + (void) ioctl (fileno (fp), TCSETAW, (char *) &sg); +#endif + +#ifdef SUNLINK_7_0 + fprintf (stdout, "%s", prompt); + (void) fflush (stdout); +#else + fprintf (stderr, "%s", prompt); + (void) fflush (stderr); +#endif + + for (ep = (bp = buffer) + sizeof buffer - 1; (c = getc (fp)) != EOF;) +#ifndef apollo + if (c == '\n') +#else + if (c == '\n' || c == '\r') +#endif + break; + else + if (bp < ep) + *bp++ = c; + *bp = NULL; + +#ifdef SUNLINK_7_0 + fprintf (stdout, "\n"); + (void) fflush (stdout); +#else + fprintf (stderr, "\n"); + (void) fflush (stderr); +#endif + +#if !defined(SYS5) && !defined(XOS_2) + sg.sg_flags = flags; + (void) stty (fileno (fp), &sg); +#else + sg.c_lflag = flags; + (void) ioctl (fileno (fp), TCSETAW, (char *) &sg); +#endif + + (void) signal (SIGINT, istat); + + if (isopen) + (void) fclose (fp); + + return buffer; +#else + return getpass (prompt); +#endif +} diff --git a/usr/src/contrib/isode/compat/implode.c b/usr/src/contrib/isode/compat/implode.c new file mode 100644 index 0000000000..3b363b3a3a --- /dev/null +++ b/usr/src/contrib/isode/compat/implode.c @@ -0,0 +1,72 @@ +/* implode.c - explode ascii into octets */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/implode.c,v 7.1 91/02/22 09:15:12 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/implode.c,v 7.1 91/02/22 09:15:12 mrose Interim $ + * + * + * $Log: implode.c,v $ + * Revision 7.1 91/02/22 09:15:12 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:02 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" + +/* DATA */ + +static char hex2nib[0x80] = { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + +/* */ +int implode (a, b, n) +register u_char *a; +register char *b; +register int n; +{ + register int i; + + for (i = 0; i < n; i += 2) { + *a++ = (hex2nib[b[0] & 0x7f] << 4) | (hex2nib[b[1] & 0x7f]); + b += 2; + } + + return (n / 2); +} diff --git a/usr/src/contrib/isode/compat/inst-man.sh b/usr/src/contrib/isode/compat/inst-man.sh new file mode 100644 index 0000000000..50f4e33944 --- /dev/null +++ b/usr/src/contrib/isode/compat/inst-man.sh @@ -0,0 +1,167 @@ +: run this script through /bin/sh + +# for a non standard base directory, set MANDIR + +# set MANOPTS in config/CONFIG.make -- may be one of: +# -bsd42 man/ +# -bsd44 cat/thing.0 +# -ros man/ -- using /etc/install +# -sys5 _man/man/ +# -aix _man/man/ +# -local manl/.l +# -l man/.l +# -hpux hpux + +BINDIR="@(BINDIR)" +ETCDIR="@(ETCDIR)" +INCDIR="@(INCDIR)" +LOGDIR="@(LOGDIR)" +SBINDIR="@(SBINDIR)" +MANDIR="@(MANDIR)" + +M=BSD42 + +if test ! -d ${MANDIR} +then + echo "inst-man: ${MANDIR} non-existant directory" 1>&2 + exit 0 +fi + +for A in $* +do + case $A in + -bsd42) M=BSD42 + ;; + + -bsd44) M=BSD44 + ;; + + -ros) M=ROS + ;; + + -local) M=LOCAL + ;; + + -l) M=L + ;; + + -sys5) M=SYS5 + ;; + + -aix) M=AIX + ;; + + -hpux) M=HPUX + ;; + + -*) echo "inst-man: $A unknown" 1>&2 + exit 1 + ;; + + *) if test ! -f $A + then + exit 0 + fi + F=`basename $A` + E=`echo $F | sed -e "s%^.*\.\([1-8]\).*%\1%"` + + X=/tmp/$F + rm -f $X + echo '.ds BD @(BINDIR)' > $X + echo '.ds ED @(ETCDIR)' >> $X + echo '.ds ID @(INCDIR)' >> $X + echo '.ds LD @(LOGDIR)' >> $X + echo '.ds SD @(SBINDIR)' >> $X + cat $A >> $X + + case $M in + BSD42) + echo install -m 0644 -c $X ${MANDIR}man$E/$F + install -m 0644 -c $X ${MANDIR}man$E/$F + ;; + + BSD44) + echo "nroff -man $X > ${MANDIR}cat$E/$F" | \ + sed -e 's%\.\([1-8]\)[1-8cn]*$%.0%' | \ + sh -ve + ;; + + LOCAL) + (cd /tmp ; \ + echo $F | \ + sed -e "s%.*%install -m 0644 -c & ${MANDIR}manl/&%" | \ + sed -e 's%\.[1-8cn]*$%.l%' | \ + sh -ve) + ;; + + L) + (cd /tmp ; \ + echo "install -m 0644 -c $F ${MANDIR}man$E/$F" | \ + sed -e 's%\.\([1-8]\)[1-8cn]*$%.\1l%' | \ + sh -ve) + ;; + + SYS5|AIX) + case $E in + 3) D=p_man ;; + 5) D=p_man E=4 ;; + 8) D=a_man E=1 ;; + *) D=u_man ;; + esac + echo /etc/install -m 0644 -f ${MANDIR}$D/man$E $X + /etc/install -m 0644 -f ${MANDIR}$D/man$E $X + case $D in + a_man) + F=`basename $A .8c`.1m + echo mv ${MANDIR}$D/man$E/$A \ + ${MANDIR}$D/man$E/$F + mv ${MANDIR}$D/man$E/$A ${MANDIR}$D/man$E/$F + ;; + + p_man) + if [ "$E" = "4" ]; then + F=`basename $A .5`.4 + echo mv ${MANDIR}$D/man$E/$A \ + ${MANDIR}$D/man$E/$F + mv ${MANDIR}$D/man$E/$A \ + ${MANDIR}$D/man$E/$F + fi + ;; + esac + ;; + + HPUX) + case $E in + 5) E=4 ;; + 8) E=1m ;; + esac + echo /etc/install -m 0644 -f ${MANDIR}man$E $X + /etc/install -m 0644 -f ${MANDIR}man$E $X + case $E in + 4) F=`basename $A .5`.4 + echo mv ${MANDIR}man$E/$A ${MANDIR}man$E/$F + mv ${MANDIR}man$E/$A ${MANDIR}man$E/$F + ;; + + 1m) F=`basename $A .8c`.1m + echo mv ${MANDIR}man$E/$A ${MANDIR}man$E/$F + mv ${MANDIR}man$E/$A ${MANDIR}man$E/$F + ;; + esac + ;; + + ROS) + echo /etc/install -m 0644 -c $X ${MANDIR}man$E/$F + /etc/install -m 0644 -c $X ${MANDIR}man$E/$F + ;; + + *) echo "inst-man: mode botch" 1>&2 + exit 1 + ;; + esac + rm -f $X + ;; + esac +done + +exit 0 diff --git a/usr/src/contrib/isode/compat/internet.c b/usr/src/contrib/isode/compat/internet.c new file mode 100644 index 0000000000..8cb50116c7 --- /dev/null +++ b/usr/src/contrib/isode/compat/internet.c @@ -0,0 +1,699 @@ +/* internet.c - TCP/IP abstractions */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/internet.c,v 7.3 91/02/22 09:15:14 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/internet.c,v 7.3 91/02/22 09:15:14 mrose Interim $ + * + * + * $Log: internet.c,v $ + * Revision 7.3 91/02/22 09:15:14 mrose + * Interim 6.8 + * + * Revision 7.2 90/11/21 11:29:41 mrose + * sun + * + * Revision 7.1 90/01/11 18:35:06 mrose + * real-sync + * + * Revision 7.0 89/11/23 21:23:03 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + +/* */ + +#ifdef TCP +#include "internet.h" + + +extern int errno; + +/* Berkeley UNIX: 4.2 */ + +#ifdef SOCKETS + +/* For real networking, nothing is better than 4BSD! */ + + +int start_tcp_client (sock, priv) +struct sockaddr_in *sock; +int priv; +{ + register int port; + int eindex, + sd; +#ifdef BSD43 + int onoff; +#endif + + if ((sd = socket (AF_INET, SOCK_STREAM, 0)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("socket")); + return NOTOK; + } + + if (sock == NULL) + goto got_socket; + + for (port = IPPORT_RESERVED - priv;; priv ? port-- : port++) { + sock -> sin_port = htons ((u_short) port); + + if (bind (sd, (struct sockaddr *) sock, sizeof *sock) != NOTOK) + break; + + switch (errno) { + case EADDRINUSE: + if (!priv || (port >= IPPORT_RESERVED / 2)) + continue; /* else fall */ + + case EADDRNOTAVAIL: + default: + eindex = errno; + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("bind")); + (void) close_tcp_socket (sd); + errno = eindex; + return NOTOK; + } + } + +got_socket: ; +#ifndef BSD43 + if (setsockopt (sd, SOL_SOCKET, SO_KEEPALIVE, NULLCP, 0) == NOTOK) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("set SO_KEEPALIVE")); +#else + onoff = 1; + if (setsockopt (sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &onoff, + sizeof onoff) == NOTOK) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("set SO_KEEPALIVE")); +#endif + + return sd; +} + +/* */ + +int start_tcp_server (sock, backlog, opt1, opt2) +struct sockaddr_in *sock; +int backlog, + opt1, + opt2; +{ + register int port; + int eindex, + sd; +#ifdef BSD43 + int onoff; +#endif + + if ((sd = socket (AF_INET, SOCK_STREAM, 0)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("socket")); + return NOTOK; + } + + if (sock -> sin_port != 0) { + if (bind (sd, (struct sockaddr *) sock, sizeof *sock) != NOTOK) + goto got_socket; + + eindex = errno; + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("bind")); + (void) close_tcp_socket (sd); + errno = eindex; + return NOTOK; + } + + for (port = IPPORT_RESERVED;; port++) { + sock -> sin_port = htons ((u_short) port); + + if (bind (sd, (struct sockaddr *) sock, sizeof *sock) != NOTOK) + break; + + switch (errno) { + case EADDRINUSE: + continue; + + case EADDRNOTAVAIL: + default: + eindex = errno; + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("bind")); + (void) close_tcp_socket (sd); + errno = eindex; + return NOTOK; + } + } + +got_socket: ; +#ifndef BSD43 + if (setsockopt (sd, SOL_SOCKET, SO_KEEPALIVE, NULLCP, 0) == NOTOK) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("set SO_KEEPALIVE")); + if (opt1 && setsockopt (sd, SOL_SOCKET, opt1, NULLCP, 0) == NOTOK) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", + ("set socket option 0x%x", opt1)); + if (opt2 && setsockopt (sd, SOL_SOCKET, opt2, NULLCP, 0) == NOTOK) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", + ("set socket option 0x%x", opt2)); +#else + onoff = 1; + if (setsockopt (sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &onoff, + sizeof onoff) == NOTOK) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("set SO_KEEPALIVE")); + if (opt1 + && setsockopt (sd, SOL_SOCKET, opt1, (char *) &onoff, sizeof onoff) + == NOTOK) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", + ("set socket option 0x%x", opt1)); + if (opt2 + && setsockopt (sd, SOL_SOCKET, opt2, (char *) &onoff, sizeof onoff) + == NOTOK) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", + ("set socket option 0x%x", opt2)); +#endif + + (void) listen (sd, backlog); + + return sd; +} + +/* */ + +int join_tcp_client (fd, sock) +int fd; +struct sockaddr_in *sock; +{ + int eindex, + len = sizeof *sock, + result; + + if ((result = accept (fd, (struct sockaddr *) sock, &len)) == NOTOK) { + eindex = errno; + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("accept")); + errno = eindex; + } + + return result; +} + +/* */ + +int join_tcp_server (fd, sock) +int fd; +struct sockaddr_in *sock; +{ + int eindex, + result; + + if ((result = connect (fd, (struct sockaddr *) sock, sizeof *sock)) + == NOTOK) { + eindex = errno; + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("connect")); + errno = eindex; + } + + return result; +} + +/* */ + +close_tcp_socket (fd) +int fd; +{ +#ifdef never_do_this_if_from_join_tcp_client + (void) shutdown (fd, 2); +#endif + + return (close (fd)); +} + +#endif + +/* AT&T UNIX: 5r3 using TLI */ + + +/* AT&T UNIX: 5 with EXOS 8044 TCP/IP card */ + +#ifdef EXOS + +/* If we had a getsockname() for the EXOS card, then we could postpone some + of the binding until connect time. But since we don't, our hand is forced + and we must prematurely bind the sockets to IP addresses. */ + + +start_tcp_client (sock, priv) +struct sockaddr_in *sock; +int priv; +{ + register int port; + int sd; + register struct hostent *hp; + + if (sock == NULL) + return socket (SOCK_STREAM, 0, (struct sockaddr *) 0, SO_KEEPALIVE); + + if (sock -> sin_addr.s_addr == 0) { + if ((hp = gethostbyname ("localhost")) == NULL) { + errno = EADDRNOTAVAIL; + return NOTOK; + } + sock -> sin_family = hp -> h_addrtype; + inaddr_copy (hp, sock); + } + + for (port = IPPORT_RESERVED - priv;; priv ? port-- : port++) { + sock -> sin_port = htons ((u_short) port); + + if ((sd = socket (SOCK_STREAM, 0, (struct sockaddr *) sock, + SO_KEEPALIVE)) != NOTOK) + return sd; + + switch (errno) { + case EADDRINUSE: + if (!priv || (port >= IPPORT_RESERVED / 2)) + continue; /* else fall */ + + case EADDRNOTAVAIL: + default: + return NOTOK; + } + } +} + +/* */ + +int start_tcp_server (sock, backlog, opt1, opt2) +struct sockaddr_in *sock; +int backlog, + opt1, + opt2; +{ + register int port; + int sd; + register struct hostent *hp; + + if (backlog != 1) + return socket (SOCK_STREAM, 0, (struct sockaddr *) sock, + SO_ACCEPTCONN | SO_KEEPALIVE | opt1 | opt2); + + if (sock -> sin_addr.s_addr == 0) { + if ((hp = gethostbyname ("localhost")) == NULL) { + errno = EADDRNOTAVAIL; + return NOTOK; + } + sock -> sin_family = hp -> h_addrtype; + inaddr_copy (hp, sock); + } + + for (port = IPPORT_RESERVED;; port++) { + sock -> sin_port = htons ((u_short) port); + + if ((sd = socket (SOCK_STREAM, 0, (struct sockaddr *) sock, + SO_ACCEPTCONN | SO_KEEPALIVE | opt1 | opt2)) != NOTOK) + return sd; + + switch (errno) { + case EADDRINUSE: + continue; + + case EADDRNOTAVAIL: + default: + return NOTOK; + } + } +} + +#endif + +/* GETHOSTENT PLUS */ + +static char *empty = NULL; +#ifdef h_addr +static char *addrs[2] = { NULL }; +#endif + +struct hostent *gethostbystring (s) +char *s; +{ + register struct hostent *h; +#ifndef DG + static u_long iaddr; +#else + static struct in_addr iaddr; +#endif + static struct hostent hs; + + iaddr = inet_addr (s); +#ifndef DG + if (iaddr == NOTOK) +#else + if (iaddr.s_addr == NOTOK) +#endif + return gethostbyname (s); + + h = &hs; + h -> h_name = s; + h -> h_aliases = ∅ + h -> h_addrtype = AF_INET; + h -> h_length = sizeof (iaddr); +#ifdef h_addr + h -> h_addr_list = addrs; + bzero ((char *) addrs, sizeof addrs); +#endif + h -> h_addr = (char *) &iaddr; + + return h; +} + +/* AT&T UNIX: 5 with EXOS 8044 TCP/IP card */ + +#ifdef EXOS + +long rhost (); +char *raddr (); + + +struct hostent *gethostbyaddr (addr, len, type) +char *addr; +int len, + type; +{ + long iaddr; + char *name; + static char buffer[BUFSIZ]; + static struct hostent hs; + register struct hostent *h = &hs; + + if (len != sizeof (long) || type != AF_INET) + return NULL; + bcopy (addr, (char *) &iaddr, len); + if ((name = raddr (iaddr)) == NULL) + return NULL; + + (void) strcpy (buffer, name); + free (name); + + h -> h_name = buffer; + h -> h_aliases = ∅ + h -> h_addrtype = type; + h -> h_length = len; + h -> h_addr = addr; + + return h; +} + + +struct hostent *gethostbyname (name) +char *name; +{ + static long iaddr; + static char buffer[BUFSIZ]; + static struct hostent hs; + register struct hostent *h = &hs; + + if ((iaddr = rhost (&name)) == NOTOK) + return NULL; + + (void) strcpy (buffer, name); + free (name); + + h -> h_name = buffer; + h -> h_aliases = ∅ + h -> h_addrtype = AF_INET; + h -> h_length = sizeof (iaddr); + h -> h_addr = (char *) &iaddr; + + return h; + +} + +/* */ + +/* really only need the "tsap" entry in this table... but why not? */ + +static struct servent services[] = { + "tsap", NULL, 102, "tcp", + "miscellany", NULL, 17000, "lpp", + + "echo", NULL, 7, "tcp", /* Network standard functions */ + "echo", NULL, 7, "udp", + "sink", NULL, 9, "tcp", + "sink", NULL, 9, "udp", + "users", NULL, 11, "tcp", + "users", NULL, 11, "udp", + "daytime", NULL, 13, "tcp", + "daytime", NULL, 13, "udp", + "netstat", NULL, 15, "tcp", + "netstat", NULL, 15, "udp", + "qotd", NULL, 17, "tcp", + "qotd", NULL, 17, "udp", + "chargen", NULL, 19, "tcp", + "chargen", NULL, 19, "udp", + "ftp", NULL, 21, "tcp", + "telnet", NULL, 23, "tcp", + "smtp", NULL, 25, "tcp", + "imagen", NULL, 35, "udp", + "time", NULL, 37, "tcp", + "time", NULL, 37, "udp", + "name", NULL, 42, "tcp", + "name", NULL, 42, "udp", + "whois", NULL, 43, "tcp", + "whois", NULL, 43, "udp", + "nameserver", NULL, 53, "tcp", + "nameserver", NULL, 53, "udp", + "mtp", NULL, 57, "tcp", + "hostnames", NULL, 101, "tcp", + "pop", NULL, 109, "tcp", + "pwdgen", NULL, 129, "tcp", + "pwdgen", NULL, 129, "udp", + "x25bridge", NULL, 146, "tcp", + "iso-ip", NULL, 147, "udp", + + "tftp", NULL, 69, "udp", /* Host specific functions */ + "rje", NULL, 77, "tcp", + "nmui", NULL, 77, "udp", + "finger", NULL, 79, "tcp", + "finger", NULL, 79, "udp", + "link", NULL, 87, "tcp", + "supdup", NULL, 95, "tcp", + "path", NULL, 117, "tcp", + + "exec", NULL, 512, "tcp", /* UNIX TCP sockets */ + "login", NULL, 513, "tcp", + "shell", NULL, 514, "tcp", + "printer", NULL, 515, "tcp", + "rfile", NULL, 522, "tcp", + "ingreslock", NULL, 1524, "tcp", + + "biff", NULL, 512, "udp", /* UNIX UDP sockets */ + "who", NULL, 513, "udp", + "syslog", NULL, 514, "udp", + "talk", NULL, 517, "udp", + "routed", NULL, 520, "udp", + "router_1", NULL, 521, "udp", + + NULL, &empty, 0, NULL +}; + + + +struct servent *getservbyname (name, proto) +register char *name, + *proto; +{ + register struct servent *s; + + for (s = services; s -> s_name; s++) + if (strcmp (name, s -> s_name) == 0 + && strcmp (proto, s -> s_proto) == 0) { + if (s -> s_aliases == NULL) { + s -> s_aliases = ∅ + s -> s_port = htons ((u_short) s -> s_port); + } + + return s; + } + + return NULL; +} + +/* */ + +#define s2a(b) (((int) (b)) & 0xff) + +char *inet_ntoa (in) +struct in_addr in; +{ + register char *s = (char *) ∈ + static char addr[4 * 3 + 3 + 1]; + + (void) sprintf (addr, "%d.%d.%d.%d", + s2a (s[0]), s2a (s[1]), s2a (s[2]), s2a (s[3])); + + return addr; +} + + +u_long inet_addr (cp) +char *cp; +{ + register int base; + register char c; + register u_long val; + u_long parts[4]; + register u_long *pp = parts; + + for (;;) { + val = 0, base = 10; + if (*cp == '0') + base = 8, cp++; + if (*cp == 'x' || *cp == 'X') + base = 16, cp++; + + for (; isxdigit ((u_char) (c = *cp)); cp++) + if (base == 16) + val = (val << 4) + (c + 10 - (islower ((u_char) c) ? 'a' : 'A')); + else + if (isdigit ((u_char) c)) + val = (val * base) + (c - '0'); + else + break; + + switch (*cp) { + case '.': + if (pp >= parts + 4) + return NOTOK; + *pp++ = val, cp++; + continue; + + default: + if (*cp && !isspace ((u_char) *cp)) + return NOTOK; + *pp++ = val; + break; + } + + break; + } + + switch (pp - parts) { + case 1: + val = parts[0]; + break; + + case 2: + val = ((parts[0] & 0xff) << 24) + | (parts[1] & 0xffffff); + break; + + case 3: + val = ((parts[0] & 0xff) << 24) + | ((parts[1] & 0xff) << 16) + | (parts[2] & 0xffff); + break; + + case 4: + val = ((parts[0] & 0xff) << 24) + | ((parts[1] & 0xff) << 16) + | ((parts[2] & 0xff) << 8) + | (parts[3] & 0xff); + break; + + default: + return NOTOK; + } + + return htonl (val); +} + +u_long inet_network (cp) +char *cp; +{ + register int base; + register char c; + register u_long val; + u_long parts[4]; + register u_long *pp = parts; + + for (;;) { + val = 0, base = 10; + if (*cp == '0') + base = 8, cp++; + if (*cp == 'x' || *cp == 'X') + base = 16, cp++; + + for (; isxdigit ((u_char) (c = *cp)); cp++) + if (base == 16) + val = (val << 4) + (c + 10 - (islower ((u_char) c) ? 'a' : 'A')); + else + if (isdigit ((u_char) c)) + val = (val * base) + (c - '0'); + else + break; + + switch (*cp) { + case '.': + if (pp >= parts + 4) + return NOTOK; + *pp++ = val, cp++; + continue; + + default: + if (*cp && !isspace ((u_char) *cp)) + return NOTOK; + *pp++ = val; + break; + } + + break; + } + + switch (pp - parts) { + case 1: + val = (parts[0] & 0xff) << 24; + break; + + case 2: + val = ((parts[0] & 0xff) << 24) + | ((parts[1] & 0xff) << 16); + break; + + case 3: + val = ((parts[0] & 0xff) << 24) + | ((parts[1] & 0xff) << 16) + | ((parts[2] & 0xff) << 8) + break; + + case 4: + val = ((parts[0] & 0xff) << 24) + | ((parts[1] & 0xff) << 16) + | ((parts[2] & 0xff) << 8) + | (parts[3] & 0xff); + break; + + default: + return NOTOK; + } + + return htonl (val); +} +#endif +#endif diff --git a/usr/src/contrib/isode/compat/isoaddrs.c b/usr/src/contrib/isode/compat/isoaddrs.c new file mode 100644 index 0000000000..f17d50b3a7 --- /dev/null +++ b/usr/src/contrib/isode/compat/isoaddrs.c @@ -0,0 +1,1173 @@ +/* isoaddrs.c - simple parsing of ISODE addresses */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/isoaddrs.c,v 7.6 91/02/22 09:15:16 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/isoaddrs.c,v 7.6 91/02/22 09:15:16 mrose Interim $ + * + * + * $Log: isoaddrs.c,v $ + * Revision 7.6 91/02/22 09:15:16 mrose + * Interim 6.8 + * + * Revision 7.5 90/12/23 18:39:31 mrose + * update + * + * Revision 7.4 90/12/11 10:52:46 mrose + * lock-and-load + * + * Revision 7.3 90/11/21 11:29:45 mrose + * sun + * + * Revision 7.2 90/07/09 14:31:51 mrose + * sync + * + * Revision 7.1 90/01/11 18:35:10 mrose + * real-sync + * + * Revision 7.0 89/11/23 21:23:05 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" +#include "internet.h" +#include "tailor.h" + +/* DATA */ + +static char *isomacros = "isomacros"; + +#define MBUCKETS 128 +#define MHASH(nm) \ + (((nm)[1]) ? (((chrcnv[((nm)[0])] - chrcnv[((nm)[1])]) & 0x1f) \ + + ((chrcnv[(nm)[2]]) & 0x5f)) \ + : (chrcnv[(nm)[0]]) & 0x7f) + +struct macro { + char *m_name; + char *m_value; + + struct macro *m_chain; +}; + +static int inited = 0; +static struct macro *Mbuckets[MBUCKETS]; + +/* MACROS */ + +static struct macro *name2macro (name) +char *name; +{ + register struct macro *m; + + read_macros (); + + for (m = Mbuckets[MHASH (name)]; + m && lexequ (m -> m_name, name); + m = m -> m_chain) + continue; + + if (m) + LLOG (addr_log, LLOG_DEBUG, + ("MACRO \"%s\" VALUE \"%s\"", m -> m_name, m -> m_value)); + else + LLOG (addr_log, LLOG_DEBUG, + ("lookup of MACRO \"%s\" failed", name)); + + return m; +} + +/* */ + +static struct macro *value2macro (value) +char *value; +{ + register int i, + j, + k; + register struct macro *m, + *p, + **np, + **pp; + + read_macros (); + + p = NULL, i = 0; + k = strlen (value); + for (pp = (np = Mbuckets) + MBUCKETS; np < pp; np++) + for (m = *np; m; m = m -> m_chain) + if ((j = strlen (m -> m_value)) <= k + && j > i + && strncmp (value, m -> m_value, j) == 0) + p = m, i = j; + + if (p) + LLOG (addr_log, LLOG_DEBUG, + ("MACRO \"%s\" VALUE \"%s\" differential %d", + p -> m_name, p -> m_value, k - strlen (p -> m_value))); + else + LLOG (addr_log, LLOG_DEBUG, + ("lookup of VALUE \"%s\" failed", value)); + + return p; +} + +/* */ + +static int read_macros () +{ + register char *hp; + char buffer[BUFSIZ]; + + if (inited) + return; + inited = 1; + + bzero ((char *) Mbuckets, sizeof Mbuckets); + + read_file (isodefile (isomacros, 0)); + + if ((hp = getenv ("HOME")) == NULL) + hp = "."; + (void) sprintf (buffer, "%s/.isode_macros", hp); + read_file (buffer); +} + +/* */ + +static int read_file (file) +char *file; +{ + register char *cp; + char buffer[BUFSIZ + 1], + *vec[NVEC + NSLACK + 1]; + register FILE *fp; + + if ((fp = fopen (file, "r")) == NULL) + return; + + while (fgets (buffer, sizeof buffer, fp)) { + if (*buffer == '#') + continue; + if (cp = index (buffer, '\n')) + *cp = NULL; + if (str2vec (buffer, vec) < 2) + continue; + + if (add_macro (vec[0], vec[1]) == NOTOK) + break; + } + + (void) fclose (fp); +} + +/* */ + +static int add_macro (name, value) +char *name, + *value; +{ + int i; + register char *cp; + char buffer[BUFSIZ]; + register struct macro *m, + *p; + + if (cp = index (value, '=')) { + *cp++ = NULL; + if ((p = name2macro (value)) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("macro \"%s\" references non-existant macro \"%s\"", + name, value)); + return OK; + } + + (void) sprintf (value = buffer, "%s%s", p -> m_value, cp); + } + + if ((m = (struct macro *) calloc (1, sizeof *m)) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("calloc of macro structure failed")); + return NOTOK; + } + if ((m -> m_name = malloc ((unsigned) (strlen (name) + 1))) == NULL + || (m -> m_value = malloc ((unsigned) (strlen (value) + 1))) + == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("malloc of alias structure failed")); + if (m -> m_name) + free (m -> m_name); + free ((char *) m); + return NOTOK; + } + (void) strcpy (m -> m_name, name); + (void) strcpy (m -> m_value, value); + + m -> m_chain = Mbuckets[i = MHASH (m -> m_name)]; + Mbuckets[i] = m; + + return OK; +} + +/* */ + +char *macro2str (name) +char *name; +{ + register struct macro *m = name2macro (name); + + return (m ? m -> m_value : NULLCP); +} + +/* STR2PADDR */ + +#define PS_INIT 0 /* or */ +#define PS_SEL1 1 /* .. got one selector already */ +#define PS_SEL2 2 /* .. got two selectors already */ +#define PS_SEL3 3 /* */ + + +static struct afi_info { + char *p_name; + char *p_dec0, *p_hex0, *p_dec1, *p_hex1, *p_ia5; + int p_idi_len, p_dec_dsp_len, p_hex_dsp_len; +} afi_entries[] = { + "X121", "36", "37", "52", "53", NULL, 14, 24, 9, + "DCC", "38", "39", NULL, NULL, NULL, 3, 35, 14, + "TELEX", "40", "41", "54", "55", NULL, 8, 30, 12, + "PSTN", "42", "43", "56", "57", NULL, 12, 26, 10, + "ISDN", "44", "45", "58", "59", NULL, 15, 23, 9, + "ICD", "46", "47", NULL, NULL, NULL, 4, 34, 13, + "LOCAL", "48", "49", NULL, NULL, "50", 0, 38, 19, + + NULL +}; +#define p_ia5_dsp_len(pp) \ + (pp -> p_ia5 == NULL ? NOTOK : (pp -> p_dec_dsp_len >> 1)) + + +static char sel1[TSSIZE]; +static char sel2[TSSIZE]; +static char sel3[TSSIZE]; +static char *sels[3] = { + sel1, sel2, sel3 +}; + + +#define IMPLODE(intres,octres,octval,intval,losing,loslab) \ +{ \ + register int z = (intval); \ + register char *y = (octval); \ + register char *zp = y + z; \ + \ + while (zp-- > y) \ + if (!isxdigit ((u_char) *zp)) { \ +loslab: ; \ + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, \ + ("invalid hexstring: \"%*.*s\"", \ + z, z, y)); \ + return (losing); \ + } \ + if (z % 2) \ + goto loslab; \ + (intres) = implode ((u_char *) (octres), y, z); \ +} + +/* */ + +struct PSAPaddr *str2paddr (str) +char *str; +{ + register int state, + *lp; + int j, + lens[3]; + register char *cp, + *dp, + *ep, + *fp, + *np, + **sp; + char buf1[BUFSIZ], + buf2[BUFSIZ], + nsap[NASIZE * 2 + 1]; + register struct macro *m; + register struct afi_info *pp; + static int i = 0; + static struct PSAPaddr pas[2]; + register struct PSAPaddr *pa = &pas[i++]; + register struct SSAPaddr *sa = &pa -> pa_addr; + register struct TSAPaddr *ta = &sa -> sa_addr; + register struct NSAPaddr *na = ta -> ta_addrs; + + i = i % 2; + + bzero ((char *) pa, sizeof *pa); + (void) strcpy (buf1, str); + + state = PS_INIT; + sp = sels, lp = lens; + + for (cp = buf1; *cp; ) + switch (state) { + case PS_INIT: + case PS_SEL1: + case PS_SEL2: + switch (*cp) { + case '"': /* '"' '"' */ + if ((cp = index (dp = cp + 1, '"')) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("missing double-quote in selector: %s", + str)); + return NULLPA; + } + *cp++ = NULL; + (void) strcpy (*sp, dp); + *lp = strlen (dp); + break; + + case '#': /* '#' */ + j = 0; + for (cp++; isdigit ((u_char) *cp); cp++) + j = j * 10 + *cp - '0'; + if (j > 0xffff) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("invalid #-style selector: %s", str)); + return NULLPA; + } + (*sp)[0] = (j >> 8) & 0xff; + (*sp)[1] = j & 0xff; + *lp = 2; + break; + + case '\'': /* "'" "'H" */ + if ((cp = index (dp = cp + 1, '\'')) == NULL) { +missing_quoteH: ; + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("missing 'H in selector: %s",str)); + return NULLPA; + } + *cp++ = NULL; + if (*cp++ != 'H') + goto missing_quoteH; + IMPLODE (*lp, *sp, dp, strlen (dp), NULLPA, L1); + break; + + case '/': /* empty selector */ + *lp = 0; + break; + + default: + goto stuff_selectors; + } + sp++, lp++; + if (*cp++ != '/') { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("missing selector seperator at position %d: %s", + cp - buf1, str)); + return NULLPA; + } + state++; + break; + +stuff_selectors: ; + state = PS_SEL3; + /* and fall */ + + case PS_SEL3: + if ((cp = index (ep = cp, '|')) == NULL) + cp = ep + strlen (ep); + else + *cp++ = NULL; + + if (dp = index (ep, '=')) { + *dp++ = NULL; + if ((m = name2macro (ep)) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("non-existant macro \"%s\"", ep)); + return NULLPA; + } + (void) sprintf (ep = buf2, "%s%s", m -> m_value, dp); + } + + { + register int k, + l, + n; + register struct ts_interim *ts, + *tp; + + tp = NULL, n = 0; + k = strlen (ep); + for (ts = ts_interim; ts -> ts_name; ts++) + if (ts -> ts_value + && (l = strlen (ts -> ts_value)) <= k + && l > n + && strncmp (ep, ts -> ts_value, l) == 0) + tp = ts, n = l; + if (tp) + na -> na_community = tp -> ts_subnet; + else { + /* Assume all the AFI+IDI[+DSP] formats are + * SUBNET_REALNS until later. Note that the X121 format + * without a DSP is converted to SUBNET_INT_X25 later. + */ + for (pp = afi_entries; pp -> p_name; pp++) + if (strncmp (pp -> p_name, ep, + strlen (pp -> p_name) - 1) == 0 && + ep[strlen (pp -> p_name)] == '+') + break; + if (!pp -> p_name) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unable to determine community for %s",ep)); + return NULLPA; + } + na -> na_community = SUBNET_REALNS; + } + } + + if ((ep = index (dp = ep, '+')) == NULL) { +missing_seperator: ; + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("missing network-address seperator: %s", str)); + return NULLPA; + } + *ep++ = NULL; + if (ta -> ta_naddr >= NTADDR) { +#ifdef h_addr +too_many: ; +#endif + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("too many network addresses starting at position %d: %s", + dp - buf1 + 1, str)); + return pa; + } + + na -> na_stack = NA_NSAP; + if (lexequ (dp, "NS") == 0) { + IMPLODE (na -> na_addrlen, na -> na_address, ep, + strlen (ep), NULLPA, L2); + } + else { + int len; + char padchar; + + for (pp = afi_entries; pp -> p_name; pp++) + if (lexequ (pp -> p_name, dp) == 0) + break; + if (!pp -> p_name) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unknown AFI \"%s\": %s", dp, str)); + return NULLPA; + } + if ((ep = index (dp = ep, '+')) == NULL) + ep = dp + strlen (dp); + else + *ep++ = NULL; + for (fp = dp; *fp; fp++) + if (!isdigit ((u_char) *fp)) + break; + if (*fp) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("invalid IDI \"%s\": %s", dp, cp)); + return NULLPA; + } + if (lexequ (pp -> p_name, "X121") == 0 && + *ep == NULL) { + /* X121 form -- should be more general + * Only applies if the DSP is NULL + */ + (void) strcpy (nsap, dp); + if ((na -> na_dtelen = strlen (nsap)) > NSAP_DTELEN) { + dp = nsap; + goto invalid_dte; + } + (void) strcpy (na -> na_dte, nsap); +#ifdef BRIDGE_X25 + na -> na_stack = bridgediscrim (na) ? NA_BRG : NA_X25; +#else + na -> na_stack = NA_X25; +#endif + na -> na_community = SUBNET_INT_X25; + goto next; + } + switch (*ep) { + case 'd': + case NULL: + if (*dp == '0' && pp -> p_dec1 != NULL) + fp = pp -> p_dec1, padchar = '1'; + else + fp = pp -> p_dec0, padchar = '0'; + (void) strcpy (nsap, fp); + fp = nsap + strlen (nsap); + for (len = pp -> p_idi_len - strlen (dp); + len > 0; + len--) + *fp++ = padchar; + (void) strcpy (fp, dp); + fp += strlen (fp); + if (*ep != NULL) + (void) strcpy (fp, ep + 1); + goto handle_dsp; + + case 'x': + if (*dp == '0' && pp -> p_hex1 != NULL) + fp = pp -> p_hex1, padchar = '1'; + else + fp = pp -> p_hex0, padchar = '0'; + (void) strcpy (nsap, fp); + fp = nsap + strlen (nsap); + for (len = pp -> p_idi_len - strlen (dp); + len > 0; + len--) + *fp++ = padchar; + (void) strcpy (fp, dp); + /* Odd length IDI padded below */ + goto handle_dsp; + + case 'l': + if (pp -> p_ia5 == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("No IA5 syntax for AFI \"%s\"", + pp -> p_name)); + return NULLPA; + } + (void) strcpy (nsap, pp -> p_ia5); + goto handle_dsp; + +handle_dsp: ; + np = nsap, dp = na -> na_address; + while (*np) { + *dp = (*np++ - '0') << 4; + if (*np) + *dp++ |= (*np++ - '0') & 0x0f; + else + *dp++ |= 0x0f; + } + na -> na_addrlen = dp - na -> na_address; + if (*ep == 'x') { + IMPLODE (j, dp, ep + 1, strlen (ep + 1), + NULLPA, L3); + na -> na_addrlen += j; + } + else + if (*ep == 'l') { + (void) strcpy (dp, ep + 1); + na -> na_addrlen += strlen (ep + 1); + } + break; + + default: + if (*dp == '0' && pp -> p_dec1 != NULL) + fp = pp -> p_dec1, padchar = '1'; + else + fp = pp -> p_dec0, padchar = '0'; + (void) strcpy (nsap, fp); + fp = nsap + strlen (nsap); + for (len = pp -> p_idi_len - strlen (dp); + len > 0; + len--) + *fp++ = padchar; + (void) strcpy (fp, dp); + if (strncmp ("RFC-1006+", ep, + sizeof "RFC-1006+" - 1) == 0) { +#ifdef h_addr + register char **ap; +#endif + register struct hostent *hp; + + na -> na_stack = NA_TCP; + ep += sizeof "RFC-1006+" - 1; + if ((ep = index (dp = ep, '+')) == NULL) + goto missing_seperator; + *ep++ = NULL; + if ((ep = index (dp = ep, '+')) == NULL) + ep = dp + strlen (dp); + else + *ep++ = NULL; + + if ((hp = gethostbystring (dp)) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("%s: unknown host", dp)); + return NULLPA; + } + (void) strcpy (na -> na_domain, + inet_ntoa (*(struct in_addr *) + hp -> h_addr)); + if (*ep) { + if ((ep = index (dp = ep, '+')) == NULL) + ep = dp + strlen (dp); + else + *ep++ = NULL; + na -> na_port = htons ((u_short) atoi(dp)); + + if (*ep) + na -> na_tset = atoi (ep); + } +#ifdef h_addr + for (ap = hp -> h_addr_list + 1; *ap; ap++) { + ta -> ta_naddr++, na++; + + if (ta -> ta_naddr >= NTADDR) + goto too_many; + bcopy ((char *) (na - 1), (char *) na, + sizeof *na); + (void) strcpy (na -> na_domain, + inet_ntoa (*(struct in_addr *) *ap)); + } +#endif + break; + } + if (strncmp ("X.25(80)+", ep, + sizeof "X.25(80)+" - 1) == 0) { + na -> na_stack = NA_X25; + ep += sizeof "X.25(80)+" - 1; + if ((ep = index (dp = ep, '+')) == NULL) + goto missing_seperator; + *ep++ = NULL; + if ((ep = index (dp = ep, '+')) == NULL) + ep = dp + strlen (dp); + else + *ep++ = NULL; + for (np = dp; *np; np++) + if (!isdigit ((u_char) *np)) { +invalid_dte: ; + SLOG (addr_log, LLOG_EXCEPTIONS, + NULLCP, + ("invalid DTE \"%s\": %s", + dp, str)); + return NULLPA; + } + if (np - dp > NSAP_DTELEN + 1) + goto invalid_dte; + (void) strcpy (na -> na_dte, dp); + na -> na_dtelen = strlen (na -> na_dte); + if (*ep) { + char *cudf, + *clen; + + if ((ep = index (dp = ep, '+')) == NULL) + goto missing_seperator; + *ep++ = NULL; + + if (lexequ (dp, "CUDF") == 0) { + cudf = na -> na_cudf; + clen = &na -> na_cudflen; + j = sizeof na -> na_cudf; + } + else + if (lexequ (dp, "PID") == 0) { + cudf = na -> na_pid; + clen = &na -> na_pidlen; + j = sizeof na -> na_pid; + } + else { +invalid_field: ; + SLOG (addr_log, LLOG_EXCEPTIONS, + NULLCP, + ("invalid field \"%s\": %s", + dp, str)); + return NULLPA; + } + if (j * 2 < strlen (ep)) + goto invalid_field; + IMPLODE (j, cudf, ep, strlen (ep), + NULLPA, L4); + *clen = j & 0xff; + } +#ifdef BRIDGE_X25 + na -> na_stack = bridgediscrim (na) ? NA_BRG + : NA_X25; +#endif + break; + } +#ifdef notdef + if (lexequ ("ECMA-117-Binary", ep) == 0) { + /* some day support this... */ + break; + } + if (lexequ ("ECMA-117-Decimal", ep) == 0) { + /* some day support this... */ + break; + } +#endif + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unknown DSP \"%s\": %s", ep, str)); + return NULLPA; + } + } +next: ; + ta -> ta_naddr++, na++; + break; + } + + switch (sp - sels) { + case 3: /* PSEL+SSEL+TSEL */ + bcopy (*--sp, ta -> ta_selector, + ta -> ta_selectlen = *--lp); + bcopy (*--sp, sa -> sa_selector, + sa -> sa_selectlen = *--lp); + bcopy (*--sp, pa -> pa_selector, + pa -> pa_selectlen = *--lp); + break; + + case 2: /* SSEL+TSEL */ + bcopy (*--sp, ta -> ta_selector, + ta -> ta_selectlen = *--lp); + bcopy (*--sp, sa -> sa_selector, + sa -> sa_selectlen = *--lp); + break; + + case 1: /* TSEL */ + bcopy (*--sp, ta -> ta_selector, + ta -> ta_selectlen = *--lp); + break; + + default: + break; + } + + return pa; +} + +/* */ + +int macro2comm (name, ts) +char *name; +register struct ts_interim *ts; +{ + int j, + len; + register char *ap, + *cp, + *dp, + *ep, + *fp, + *np; + char padchar, + addr[NASIZE * 2 + 1], + buffer[BUFSIZ]; + register struct afi_info *pp; + + ts -> ts_length = 0, ts -> ts_syntax = NA_NSAP; + if ((cp = macro2str (name)) == NULLCP) + return NOTOK; + ts -> ts_value = cp; + (void) strcpy (buffer, cp); + ap = addr; + + if ((ep = index (dp = buffer, '+')) == NULL) + ep = dp + strlen (dp); + else + *ep++ = NULL; + + if (lexequ (dp, "NS") == 0) { + IMPLODE (ts -> ts_length, ts -> ts_prefix, ep, strlen (ep), + NOTOK, L5); + + return OK; + } + + for (pp = afi_entries; pp -> p_name; pp++) + if (lexequ (pp -> p_name, dp) == 0) + break; + if (!pp -> p_name) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unknown AFI \"%s\": %s", dp, cp)); + return NOTOK; + } + + if (!ep) { + /* No IDI */ + (void) strcpy (ap, pp -> p_dec0); + ap += strlen (ap); + goto out; + } + + if ((ep = index (dp = ep, '+')) == NULL) + ep = dp + strlen (dp); + else + *ep++ = NULL; + + for (fp = dp; *fp; fp++) + if (!isdigit ((u_char) *fp)) + break; + if (*fp) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("invalid IDI \"%s\": %s", dp, cp)); + return NOTOK; + } + + if (lexequ (pp -> p_name, "X121") == 0 && *ep == NULL) { + /* Only used if there is no DSP */ + (void) strcpy (ap, dp); + ap += strlen (ap); + + ts -> ts_syntax = NA_X25; + ts -> ts_subnet = SUBNET_INT_X25; + goto out; + } + + switch (*ep) { + case 'd': + case NULL: + if (*dp == '0' && pp -> p_dec1 != NULL) + fp = pp -> p_dec1, padchar = '1'; + else + fp = pp -> p_dec0, padchar = '0'; + (void) strcpy (ap, fp); + ap += strlen (ap); + for (len = pp -> p_idi_len - strlen (dp); len > 0; len--) + *ap++ = padchar; + (void) strcpy (ap, dp); + ap += strlen (ap); + if (*ep != NULL) + (void) strcpy (ap, ep + 1); + break; + + case 'x': + if (*dp == '0' && pp -> p_hex1 != NULL) + fp = pp -> p_hex1, padchar = '1'; + else + fp = pp -> p_hex0, padchar = '0'; + (void) strcpy (ap, fp); + ap += strlen (ap); + for (len = pp -> p_idi_len - strlen (dp); len > 0; len--) + *ap++ = padchar; + (void) strcpy (ap, dp); + /* Odd length IDI padded below */ + break; + + case 'l': + if (pp -> p_ia5 == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("No IA5 syntax for AFI \"%s\": %s", pp -> p_name, cp)); + return NOTOK; + } + (void) strcpy (ap, pp -> p_ia5); + break; + + default: + if (*dp == '0' && pp -> p_dec1 != NULL) + fp = pp -> p_dec1, padchar = '1'; + else + fp = pp -> p_dec0, padchar = '0'; + (void) strcpy (ap, fp); + ap += strlen (ap); + for (len = pp -> p_idi_len - strlen (dp); len > 0; len--) + *ap++ = padchar; + (void) strcpy (ap, dp); + ap += strlen (ap); + + if ((ep = index (dp = ep, '+')) == NULL) + ep = dp + strlen (dp); + else + *ep++ = NULL; + if (lexequ (dp, "RFC-1006") == 0) + ts -> ts_syntax = NA_TCP; + else + if (lexequ (dp, "X.25(80)") == 0) + ts -> ts_syntax = NA_X25; + else { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unknown DSP \"%s\": %s", dp, cp)); + return NOTOK; + } + if ((ep = index (dp = ep, '+')) == NULL) + ep = dp + strlen (dp); + else + *ep++ = NULL; + + (void) strcpy (ap, dp); + + if (*ep) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("invalid MACRO for community \"%s\": %s", name, cp)); + return NOTOK; + } + break; + } + +out: ; + ap = addr, np = ts -> ts_prefix; + while (*ap) { + *np = (*ap++ - '0') << 4; + if (*ap) + *np++ |= (*ap++ - '0') & 0x0f; + else + *np++ |= 0x0f; + } + switch (*ep) { + case 'x': + IMPLODE (j, np, ep + 1, strlen (ep + 1), NOTOK, L6); + np += j; + break; + + case 'l': + (void) strcpy (np, ep + 1); + np += strlen (ep + 1); + break; + + default: + break; + } + ts -> ts_length = np - ts -> ts_prefix; + + return OK; +} + +/* PADDR2STR */ + +static char *SEL2STR (sel, len) +char *sel; +int len; +{ + register char *cp, + *dp, + *ep; + static char buffer[PSSIZE * 2 + 4]; + + if (len <= 0) + return ""; + + cp = buffer; + *cp++ = '"'; + for (ep = (dp = sel) + len; dp < ep; dp++) { + switch (*dp) { + case '+': + case '-': + case '.': + break; + + default: + if (!isalnum ((u_char) *dp)) { + cp = buffer; + *cp++ = '\''; + cp += explode (cp, (u_char *) sel, len); + (void) strcpy (cp, "'H"); + return buffer; + } + break; + } + + *cp++ = *dp; + } + *cp++ = '"'; + *cp = NULL; + + return buffer; +} + +/* */ + +char *_paddr2str (pa, na, compact) +register struct PSAPaddr *pa; +register struct NSAPaddr *na; +int compact; +{ + register int n; + int first; + register char *bp, + *cp, + *dp; + register struct macro *m; + register struct SSAPaddr *sa; + register struct TSAPaddr *ta; + register struct NSAPaddr *ca; + static int i = 0; + static char buf1[BUFSIZ], + buf2[BUFSIZ]; + static char *bufs[] = { buf1, buf2 }; + + bp = cp = bufs[i++]; + i = i % 2; + + if (pa == NULLPA) { +bad_pa: ; + (void) strcpy (bp, "NULLPA"); + return bp; + } + sa = &pa -> pa_addr; + ta = &sa -> sa_addr; + + if (na) + n = 1; + else + if ((n = ta -> ta_naddr) > 0) + na = ta -> ta_addrs; + + if (pa -> pa_selectlen > 0) { + (void) sprintf (cp, "%s/", + SEL2STR (pa -> pa_selector, pa -> pa_selectlen)); + cp += strlen (cp); + } + if (sa -> sa_selectlen > 0 || bp != cp) { + (void) sprintf (cp, "%s/", + SEL2STR (sa -> sa_selector, sa -> sa_selectlen)); + cp += strlen (cp); + } + if (ta -> ta_selectlen > 0 || bp != cp) { + (void) sprintf (cp, "%s/", + SEL2STR (ta -> ta_selector, ta -> ta_selectlen)); + cp += strlen (cp); + } + + for (first = 1; n > 0; na++, n--) { + register struct ts_interim *ts; + + if (first) + first = 0; + else + *cp++ = '|'; + + if (compact > 0) { + if ((ca = na2norm (na)) == NULLNA) + goto bad_pa; + + (void) strcpy (cp, "NS+"); + cp += strlen (cp); + + cp += explode (cp, (u_char *) ca -> na_address, ca -> na_addrlen); + *cp = NULL; + continue; + } + + for (ts = ts_interim; ts -> ts_name; ts++) + if (ts -> ts_subnet == na -> na_community) + break; + if (!ts -> ts_name) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unable to find community #%d", na -> na_community)); + goto bad_pa; + } + if (!ts -> ts_value) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("community \"%s\" (subnet #%d) has no corresponding MACRO", + ts -> ts_name, na -> na_community)); + goto bad_pa; + } + (void) strcpy (dp = cp, ts -> ts_value); + cp += strlen (cp) - 1; + if (*cp != '+') + *++cp = '+', *++cp = NULL; + else + cp++; + + switch (na -> na_stack) { + case NA_NSAP: + /* TBD Use afi_info to pretty print as AFI+IDI+DSP */ + (void) strcpy (cp = dp, "NS+"); + cp += strlen (cp); + + cp += explode (cp, (u_char *) na -> na_address, na -> na_addrlen); + *cp = NULL; + break; + + case NA_TCP: + (void) strcpy (cp, na -> na_domain); + cp += strlen (cp); + if (na -> na_port) { + (void) sprintf (cp, "+%d", (int) ntohs (na -> na_port)); + cp += strlen (cp); + + if (na -> na_tset) { + (void) sprintf (cp, "+%d", (int) na -> na_tset); + cp += strlen (cp); + } + } + break; + + case NA_X25: + case NA_BRG: + if (na -> na_community == SUBNET_INT_X25 + && na -> na_cudflen == 0 + && na -> na_pidlen == 0 + && na -> na_dte[0] != '0') { + (void) sprintf (cp = dp, "X121+%s", na -> na_dte); + cp += strlen (cp); + } + else { + (void) strcpy (cp, na -> na_dte); + cp += strlen (cp); + if (na -> na_pidlen > 0) { + (void) strcpy (cp, "+PID+"); + cp += strlen (cp); + + cp += explode (cp, (u_char *) na -> na_pid, + (int) na -> na_pidlen); + } + else + if (na -> na_cudflen > 0) { + (void) strcpy (cp, "+CUDF+"); + cp += strlen (cp); + + cp += explode (cp, (u_char *) na -> na_cudf, + (int) na -> na_cudflen); + } + *cp = NULL; + } + break; + + default: + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unknown address type 0x%x", na -> na_stack)); + goto bad_pa; + } + + SLOG (addr_log, LLOG_DEBUG, NULLCP, ("dp = %s",dp)); + + if (!compact && (m = value2macro (dp))) { + char buffer[BUFSIZ]; + + (void) sprintf (buffer, "%s=%s", m -> m_name, + dp + strlen (m -> m_value)); + (void) strcpy (dp, buffer); + cp = dp + strlen (dp); + } + } + *cp = NULL; + + return bp; +} + +/* */ + +#ifdef PEP_TEST +free_macros () { + register int i; + register struct macro *m, + *p; + + for (i = MBUCKETS; i-- > 0; ) + for (p = Mbuckets[i]; p; p = m) { + m = p -> m_chain; + + if (p -> m_name) + free (p -> m_name); + if (p -> m_value) + free (p -> m_value); + + free (p); + } +} +#endif diff --git a/usr/src/contrib/isode/compat/isofiles.c b/usr/src/contrib/isode/compat/isofiles.c new file mode 100644 index 0000000000..32a4b35961 --- /dev/null +++ b/usr/src/contrib/isode/compat/isofiles.c @@ -0,0 +1,57 @@ +/* isofiles.c - ISODE files */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/isofiles.c,v 7.1 91/02/22 09:15:20 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/isofiles.c,v 7.1 91/02/22 09:15:20 mrose Interim $ + * + * + * $Log: isofiles.c,v $ + * Revision 7.1 91/02/22 09:15:20 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:07 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + +/* */ + +char *_isodefile (path, file) +char *path, + *file; +{ + static char buffer[BUFSIZ]; + + isodetailor (NULLCP, 0); /* not really recursive */ + + if (*file == '/' + || (*file == '.' + && (file[1] == '/' + || (file[1] == '.' && file[2] == '/')))) + (void) strcpy (buffer, file); + else + (void) sprintf (buffer, "%s%s", path, file); + + return buffer; +} diff --git a/usr/src/contrib/isode/compat/isohost.c b/usr/src/contrib/isode/compat/isohost.c new file mode 100644 index 0000000000..ad92d7ec48 --- /dev/null +++ b/usr/src/contrib/isode/compat/isohost.c @@ -0,0 +1,87 @@ +/* isohost.c - getlocalhost */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/isohost.c,v 7.1 91/02/22 09:15:21 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/isohost.c,v 7.1 91/02/22 09:15:21 mrose Interim $ + * + * + * $Log: isohost.c,v $ + * Revision 7.1 91/02/22 09:15:21 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:08 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#ifdef TCP +#include "internet.h" +#endif +#include "tailor.h" +#ifdef SYS5 +#include +#endif + +/* */ + +char *getlocalhost () { + register char *cp; +#ifdef TCP + register struct hostent *hp; +#endif +#ifdef SYS5 + struct utsname uts; +#endif + static char buffer[BUFSIZ]; + + if (buffer[0]) + return buffer; + + isodetailor (NULLCP, 0); + if (*isodename) + (void) strcpy (buffer, isodename); + else { +#if !defined(SOCKETS) && !defined(SYS5) + (void) strcpy (buffer, "localhost"); +#endif +#ifdef SOCKETS + (void) gethostname (buffer, sizeof buffer); +#endif +#ifdef SYS5 + (void) uname (&uts); + (void) strcpy (buffer, uts.nodename); +#endif + +#ifdef TCP + if (hp = gethostbyname (buffer)) + (void) strcpy (buffer, hp -> h_name); + else + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("%s: unknown host", buffer)); +#endif + + if (cp = index (buffer, '.')) + *cp = NULL; + } + + return buffer; +} diff --git a/usr/src/contrib/isode/compat/isologs.sh b/usr/src/contrib/isode/compat/isologs.sh new file mode 100644 index 0000000000..4cf9c6a703 --- /dev/null +++ b/usr/src/contrib/isode/compat/isologs.sh @@ -0,0 +1,36 @@ +: run this script through /bin/sh + +x=`fgrep logpath @(ETCDIR)isotailor 2>/dev/null | awk '{ print $2 }'` +if [ "x$x" != x ]; then + cd $x +else + cd @(LOGDIR) +fi + +rm -f iso.*.log ros.*.log [0-9]*.log + +for A in [a-z]*.log +do + x=2 + while [ $x -gt 0 ]; + do + y=`expr $x - 1` + mv $A-$y $A-$x >/dev/null 2>&1 + x=$y + done + + if [ ! -f $A ]; + then + continue + fi + + if [ -s $A ]; + then + mv $A $A-0 >/dev/null 2>&1 + fi + + > $A + chmod 666 $A +done + +exit 0 diff --git a/usr/src/contrib/isode/compat/isoman.rf b/usr/src/contrib/isode/compat/isoman.rf new file mode 100644 index 0000000000..1fc21935ff --- /dev/null +++ b/usr/src/contrib/isode/compat/isoman.rf @@ -0,0 +1,8 @@ +.\" isoman.rf - include file for ISODE manual entries +.\" Sat Nov 4 23:15:36 1989 Marshall T. Rose + +.ds BD @(BINDIR) +.ds ED @(ETCDIR) +.ds ID @(INCDIR) +.ds LD @(LOGDIR) +.ds SD @(SBINDIR) diff --git a/usr/src/contrib/isode/compat/isoservent.c b/usr/src/contrib/isode/compat/isoservent.c new file mode 100644 index 0000000000..2a40487bea --- /dev/null +++ b/usr/src/contrib/isode/compat/isoservent.c @@ -0,0 +1,140 @@ +/* isoservent.c - look-up ISODE services */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/isoservent.c,v 7.2 91/02/22 09:15:23 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/isoservent.c,v 7.2 91/02/22 09:15:23 mrose Interim $ + * + * + * $Log: isoservent.c,v $ + * Revision 7.2 91/02/22 09:15:23 mrose + * Interim 6.8 + * + * Revision 7.1 90/12/23 18:39:36 mrose + * update + * + * Revision 7.0 89/11/23 21:23:11 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "isoservent.h" +#include "tailor.h" + +/* DATA */ + +static char *isoservices = "isoservices"; + +static FILE *servf = NULL; +static int stayopen = 0; + +static struct isoservent iss; + +/* */ + +int setisoservent (f) +int f; +{ + if (servf == NULL) + servf = fopen (isodefile (isoservices, 0), "r"); + else + rewind (servf); + stayopen |= f; + + return (servf != NULL); +} + + +int endisoservent () { + if (servf && !stayopen) { + (void) fclose (servf); + servf = NULL; + } + + return 1; +} + +/* */ + +struct isoservent *getisoservent () { + int mask, + vecp; + register char *cp; + register struct isoservent *is = &iss; + static char buffer[BUFSIZ + 1], + file[BUFSIZ]; + static char *vec[NVEC + NSLACK + 1]; + + if (servf == NULL + && (servf = fopen (isodefile (isoservices, 0), "r")) == NULL) + return NULL; + + bzero ((char *) is, sizeof *is); + + while (fgets (buffer, sizeof buffer, servf) != NULL) { + if (*buffer == '#') + continue; + if (cp = index (buffer, '\n')) + *cp = NULL; + if ((vecp = str2vecX (buffer, vec, 1 + 1, &mask, NULL, 1)) < 3) + continue; + + if ((cp = index (vec[0], '/')) == NULL) + continue; + *cp++ = NULL; + + is -> is_provider = vec[0]; + is -> is_entity = cp; + is -> is_selectlen = str2sel (vec[1], (mask & (1 << 1)) ? 1 : 0, + is -> is_selector, ISSIZE); + + is -> is_vec = vec + 2; + is -> is_tail = vec + vecp; + + if (strcmp (cp = is -> is_vec[0], "tsapd-bootstrap")) + (void) strcpy (is -> is_vec[0] = file, isodefile (cp, 1)); + + return is; + } + + return NULL; +} + +/* */ + +#ifdef DEBUG +_printsrv (is) +register struct isoservent *is; +{ + register int n = is -> is_tail - is -> is_vec - 1; + register char **ap = is -> is_vec; + + LLOG (addr_log, LLOG_DEBUG, + ("\tENT: \"%s\" PRV: \"%s\" SEL: %s", + is -> is_entity, is -> is_provider, + sel2str (is -> is_selector, is -> is_selectlen, 1))); + + for (; n >= 0; ap++, n--) + LLOG (addr_log, LLOG_DEBUG, + ("\t\t%d: \"%s\"\n", ap - is -> is_vec, *ap)); +} +#endif diff --git a/usr/src/contrib/isode/compat/lexequ.c b/usr/src/contrib/isode/compat/lexequ.c new file mode 100644 index 0000000000..acc1b8aebe --- /dev/null +++ b/usr/src/contrib/isode/compat/lexequ.c @@ -0,0 +1,64 @@ +/* lexequ.c - Compare two strings ignoring case */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/lexequ.c,v 7.2 91/02/22 09:15:25 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/lexequ.c,v 7.2 91/02/22 09:15:25 mrose Interim $ + * + * + * $Log: lexequ.c,v $ + * Revision 7.2 91/02/22 09:15:25 mrose + * Interim 6.8 + * + * Revision 7.1 90/10/15 18:19:55 mrose + * sync + * + * Revision 7.0 89/11/23 21:23:12 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" + +/* */ + +lexequ (str1, str2) +register char *str1, + *str2; +{ + if (str1 == NULL) + if (str2 == NULL) + return (0); + else + return (-1); + + if (str2 == NULL) + return (1); + + while (chrcnv[*str1] == chrcnv[*str2]) { + if (*str1++ == NULL) + return (0); + str2++; + } + + if (chrcnv[*str1] > chrcnv[*str2]) + return (1); + else + return (-1); +} diff --git a/usr/src/contrib/isode/compat/lexnequ.c b/usr/src/contrib/isode/compat/lexnequ.c new file mode 100644 index 0000000000..611e5b69b4 --- /dev/null +++ b/usr/src/contrib/isode/compat/lexnequ.c @@ -0,0 +1,66 @@ +/* lexnequ.c - Compare two strings ignoring case upto n octets */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/lexnequ.c,v 7.1 91/02/22 09:15:26 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/lexnequ.c,v 7.1 91/02/22 09:15:26 mrose Interim $ + * + * + * $Log: lexnequ.c,v $ + * Revision 7.1 91/02/22 09:15:26 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:13 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" + +/* */ + +lexnequ (str1, str2, len) +register char *str1, + *str2; +int len; +{ + register int count = 1; + + if (str1 == NULL) + if (str2 == NULL) + return (0); + else + return (1); + + if (str2 == NULL) + return (-1); + + while (chrcnv[*str1] == chrcnv[*str2++]) { + if (count++ >= len) + return (0); + if (*str1++ == NULL) + return (0); + } + + str2--; + if (chrcnv[*str1] > chrcnv[*str2]) + return (1); + else + return (-1); +} diff --git a/usr/src/contrib/isode/compat/libicompat.3 b/usr/src/contrib/isode/compat/libicompat.3 new file mode 100644 index 0000000000..a62b9b00c3 --- /dev/null +++ b/usr/src/contrib/isode/compat/libicompat.3 @@ -0,0 +1,28 @@ +.TH LIBICOMPAT 3 "03 Jul 1986" +.\" $Header: /f/osi/compat/RCS/libicompat.3,v 7.1 91/02/22 09:15:27 mrose Interim $ +.\" +.\" +.\" $Log: libicompat.3,v $ +.\" Revision 7.1 91/02/22 09:15:27 mrose +.\" Interim 6.8 +.\" +.\" Revision 7.0 89/11/23 21:23:14 mrose +.\" Release 6.0 +.\" +.SH NAME +libicompat \- compatibility library +.SH SYNOPSIS +\fIcc\fR\0...\0\fB\-licompat\fR +.SH DESCRIPTION +The \fIlibicompat\fR library makes an attempt of providing an interface for +similar services under different operating systems. +Currently, the library works on most variants of Berkeley UNIX and AT&T UNIX. +.SH FILES +None +.SH DIAGNOSTICS +.SH AUTHOR +Marshall T. Rose +.SH BUGS +To misquote M.A.\0Padlipsky, +\*(lqsometimes when you try to make an apple look like an orange you get back +something that smells like a lemon.\*(rq diff --git a/usr/src/contrib/isode/compat/llib-lcompat b/usr/src/contrib/isode/compat/llib-lcompat new file mode 100644 index 0000000000..164118fdf7 --- /dev/null +++ b/usr/src/contrib/isode/compat/llib-lcompat @@ -0,0 +1,786 @@ +/* llib-licompat - lint library for -licompat */ + +/* + * $Header: /f/osi/compat/RCS/llib-lcompat,v 7.10 91/02/22 09:15:28 mrose Interim $ + * + * + * $Log: llib-lcompat,v $ + * Revision 7.10 91/02/22 09:15:28 mrose + * Interim 6.8 + * + * Revision 7.9 91/01/14 13:32:39 mrose + * kerberos + * + * Revision 7.8 91/01/07 12:39:53 mrose + * update + * + * Revision 7.7 90/12/23 18:39:38 mrose + * update + * + * Revision 7.6 90/11/21 11:35:26 mrose + * update + * + * Revision 7.5 90/08/08 14:02:57 mrose + * stuff + * + * Revision 7.4 90/02/19 13:07:13 mrose + * update + * + * Revision 7.3 90/01/11 18:35:13 mrose + * real-sync + * + * Revision 7.2 89/12/19 16:17:55 mrose + * dgram + * + * Revision 7.1 89/11/30 23:53:14 mrose + * pa2str + * + * Revision 7.0 89/11/23 21:23:14 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "manifest.h" +#include "general.h" +#include "isoaddrs.h" +#include "isoservent.h" +#include "logger.h" +#ifdef TCP +#include "internet.h" +#endif +#ifdef X25 +#include "x25.h" +#endif +#ifdef TP4 +#include "tp4.h" +#endif + +/* */ + +/* EMULATION */ + +#ifdef SYS5 +int dup2 (d1, d2) +int d1, + d2; +{ + return dup2 (d1, d2); +} +#endif + + +#ifndef SWABLIB +#undef ntohs +u_short ntohs (netshort) u_short netshort; { return ntohs (netshort); } + +#undef htons +u_short htons (hostshort) u_short hostshort; { return htons (hostshort); } + +#undef ntohl +u_long ntohl (netlong) u_long netlong; { return ntohl (netlong); } + +#undef htonl +u_long htonl (hostlong) u_long hostlong; { return htonl (hostlong); } +#endif + + +int ll_open (lp) +LLog *lp; +{ + return ll_open (lp); +} + + +int ll_close (lp) +LLog *lp; +{ + return ll_close (lp); +} + + +/* VARARGS4 */ + +int ll_log (lp, event, what, fmt) +LLog *lp; +int event; +char *what, + *fmt; +{ + return ll_log (lp, event, what, fmt); +} + + +int _ll_log (lp, event, ap) +LLog *lp; +int event; +va_list ap; +{ + return _ll_log (lp, event, ap); +} + + +void ll_hdinit (lp, prefix) +LLog *lp; +char *prefix; +{ + ll_hdinit (lp, prefix); +} + + +void ll_dbinit (lp, prefix) +LLog *lp; +char *prefix; +{ + ll_dbinit (lp, prefix); +} + + +/* VARARGS2 */ + +int ll_printf (lp, fmt) +LLog *lp; +char *fmt; +{ + return ll_printf (lp, fmt); +} + + +int ll_sync (lp) +LLog *lp; +{ + return ll_sync (lp); +} + + +/* VARARGS1 */ + +char *ll_preset (fmt) +char *fmt; +{ + return ll_preset (fmt); +} + + +int ll_check (lp) +LLog *lp; +{ + return ll_check (lp); +} + + +int ll_defmhdr (bufferp, headerp, dheaderp) +char *bufferp, + *headerp, + *dheaderp; +{ + return ll_defmhdr (bufferp, headerp, dheaderp); +} + + +IFP ll_setmhdr (make_header_routine) +IFP make_header_routine; +{ + return ll_setmhdr (make_header_routine); +} + + +int selsocket (nfds, rfds, wfds, efds, secs) +int nfds; +fd_set *rfds, + *wfds, + *efds; +int secs; +{ + return selsocket (nfds, rfds, wfds, efds, secs); +} + + +IFP set_check_fd (fd, fnx, data) +int fd; +IFP fnx; +caddr_t data; +{ + return set_check_fd (fd, fnx, data); +} + + +int xselect (nfds, rfds, wfds, efds, secs) +int nfds; +fd_set *rfds, + *wfds, + *efds; +int secs; +{ + return xselect (nfds, rfds, wfds, efds, secs); +} + + +#ifdef BSDSIGS +#ifdef AIX +IFP signal (sig, func) +int sig; +IFP func; +{ + return signal (sig, func); +} +#endif +#else +int sigblock (mask) +int mask; +{ + return sigblock (mask); +} + +int sigsetmask (mask) +int mask; +{ + return sigsetmask (mask); +} +#endif + +/* UTILITY */ + +void asprintf (bp, ap) +char *bp; +va_list ap; +{ + asprintf (bp, ap); +} + + +void _asprintf (bp, what, ap) +char *bp, + *what; +va_list ap; +{ + _asprintf (bp, what, ap); +} + + +int expode (a, b, n) +char *a; +u_char *b; +int n; +{ + return explode (a, b, n); +} + + +int implode (a, b, n) +u_char *a; +char *b; +int n; +{ + return implode (a, b, n); +} + + +char *_isodefile (path, file) +char *path, + *file; +{ + return _isodefile (path, file); +} + + +char *getlocalhost () +{ + return getlocalhost (); +} + + +char *sel2str (sel, len, quoted) +char *sel; +int len, + quoted; +{ + return sel2str (sel, len, quoted); +} + + +char *sys_errname (i) +int i; +{ + return sys_errname (i); +} + + +char *sprintb (v, bits) +int v; +char *bits; +{ + return sprintb (v, bits); +} + + +int str2elem (s, elements) +char *s; +unsigned int elements[]; +{ + return str2elem (s, elements); +} + + +int str2sel (s, quoted, sel, n) +char *s, + *sel; +int quoted, + n; +{ + return str2sel (s, quoted, sel, n); +} + + +int str2vecX (s, vec, nmask, mask, brk, docomma) +char *s, + **vec, + brk; +int nmask, + *mask, + docomma; +{ + return str2vecX (s, vec, nmask, mask, brk, docomma); +} + + +int chkpassword (usrname, pwpass, usrpass) +char *usrname; +char *pwpass; +char *usrpass; +{ + return chkpassword (usrname, pwpass, usrpass); +} + + +char *getpassword (prompt) +char *prompt; +{ + return getpassword (prompt); +} + + +int baduser (file, user) +char *file, + *user; +{ + return baduser (file, user); +} + + +int setenv (name, value) +char *name, + *value; +{ + return setenv (name, value); +} + + +int unsetenv (name) +char *name; +{ + unsetenv (name); +} + + +#include "cmd_srch.h" + +int cmd_src (str, cmd) +char *str; +CMD_TABLE *cmd; +{ + return cmd_src (str, cmd); +} + + +int lexequ (str1, str2) +char *str1, + *str2; +{ + return lexequ (str1, str2); +} + + +int lexnequ (str1, str2, len) +char *str1, + *str2; +int len; +{ + return lexnequ (str1, str2, len); +} + + +int log_tai (lgptr, av, ac) +LLog *lgptr; +char **av; +int ac; +{ + log_tai (lgptr, av, ac); +} + + +char *rcmd_srch (val, cmd) +int val; +CMD_TABLE *cmd; +{ + return rcmd_srch (val, cmd); +} + + +char *strdup (str) +char *str; +{ + return strdup (str); +} + + +int sstr2arg (srcptr, maxpf, argv, dlmstr) +char *srcptr; +int maxpf; +char *argv[], + *dlmstr; +{ + return sstr2arg (srcptr, maxpf, argv, dlmstr); +} + + +char *smalloc (size) +int size; +{ + return smalloc (size); +} + + +char *isodesetailor (file) +char *file; +{ + return isodesetailor (file); +} + + +void isodetailor (myname, wantuser) +char *myname; +int wantuser; +{ + isodetailor (myname, wantuser); +} + +int isodesetvar (name, value, dynamic) +char *name, + *value; +int dynamic; +{ + return isodesetvar (name, value, dynamic); +} + + +void isodexport (myname) +char *myname; +{ + isodexport (myname); +} + + +/* ISOSERVENT */ + +int setisoservent (f) +int f; +{ + return setisoservent (f); +} + + +int endisoservent () { + return endisoservent (); +} + + +struct isoservent *getisoservent () { + return getisoservent (); +} + + +struct isoservent *getisoserventbyname (entity, provider) +char *entity, + *provider; +{ + return getisoserventbyname (entity, provider); +} + + +struct isoservent *getisoserventbyselector (provider, selector, selectlen) +char *provider, + *selector; +int selectlen; +{ + return getisoserventbyselector (provider, selector, selectlen); +} + + +struct isoservent *getisoserventbyport (provider, port) +char *provider; +unsigned short port; +{ + return getisoserventbyport (provider, port); +} + +/* NETWORK */ + +struct PSAPaddr *str2paddr (str) +char *str; +{ + return str2paddr (str); +} + + +struct TSAPaddr *str2taddr (str) +char *str; +{ + return str2taddr (str); +} + + +char *_paddr2str (pa, na, compact) +struct PSAPaddr *pa; +struct NSAPaddr *na; +int compact; +{ + return _paddr2str (pa, na, compact); +} + + +char *saddr2str (sa) +struct SSAPaddr *sa; +{ + return saddr2str (sa); +} + + +char *taddr2str (ta) +struct TSAPaddr *ta; +{ + return taddr2str (ta); +} + + +struct NSAPaddr *na2norm (na) +struct NSAPaddr *na; +{ + return na2norm (na); +} + + +int norm2na (p, len, na) +char *p; +int len; +struct NSAPaddr *na; +{ + return norm2na (p, len, na); +} + + +char *na2str (na) +struct NSAPaddr *na; +{ + return na2str (na); +} + + +char *pa2str (pa) +struct PSAPaddr *pa; +{ + return pa2str (pa); +} + +/* TCP */ + +#ifdef TCP + +int start_tcp_client (sock, priv) +struct sockaddr_in *sock; +int priv; +{ + return start_tcp_client (sock, priv); +} + + +int start_tcp_server (sock, backlog, opt1, opt2) +struct sockaddr_in *sock; +int backlog, + opt1, + opt2; +{ + return start_tcp_server (sock, backlog, opt1, opt2); +} + + +#ifndef join_tcp_client +int join_tcp_client (fd, sock) +int fd; +struct sockaddr_in *sock; +{ + return join_tcp_client (fd, sock); +} +#endif + + +struct hostent *gethostbystring (s) +char *s; +{ + return gethostbystring (s); +} + + +#ifdef EXOS +struct hostent *gethostbyaddr (addr, len, type) +char *addr; +int len, + type; +{ + return gethostbyaddr (addr, len, type); +} + + +struct hostent *gethostbyname (name) +char *name; +{ + return gethostbyname (name); +} + + +struct servent *getservbyname (name, proto) +char *name, + *proto; +{ + return getservbyname (name, proto); +} + + +char *inet_ntoa (in) +struct in_addr in; +{ + return inet_ntoa (in); +} + + +u_long inet_addr (cp) +char *cp; +{ + return inet_addr (cp); +} +#endif + +#endif + +/* DGRAM */ + +#if defined(SOCKETS) && (defined(TCP) || defined(CLTS)) + +#ifdef TCP +int start_udp_server (sock, backlog, opt1, opt2) +struct sockaddr_in *sock; +int backlog, + opt1, + opt2; +{ + return start_udp_server (sock, backlog, opt1, opt2); +} +#endif + + +#ifdef CLTS +int start_clts_server (sock, backlog, opt1, opt2) +union sockaddr_osi *sock; +int backlog, + opt1, + opt2; +{ + return start_clts_server (sock, backlog, opt1, opt2); +} +#endif + + +int join_dgram_aux (fd, sock, newfd) +int fd, + newfd; +struct sockaddr *sock; +{ + return join_dgram_aux (fd, sock, newfd); +} + + +int read_dgram_socket (fd, qb) +int fd; +struct qbuf **qb; +{ + return read_dgram_socket (fd, qb); +} + + +int hack_dgram_socket (fd, sock) +int fd; +struct sockaddr *sock; +{ + return hack_dgram_socket (fd, sock); +} + + +int write_dgram_socket (fd, qb) +int fd; +struct qbuf *qb; +{ + return write_dgram_socket (fd, qb); +} + + +int close_dgram_socket (fd) +int fd; +{ + return close_dgram_socket (fd); +} + + +int select_dgram_socket (nfds, rfds, wfds, efds, secs) +int nfds; +fd_set *rfds, + *wfds, + *efds; +int secs; +{ + return select_dgram_socket (nfds, rfds, wfds, efds, secs); +} +#endif + +/* X.25 */ + +#ifdef X25 +CONN_DB *gen2if (generic, specific, context) +struct NSAPaddr *generic; +CONN_DB *specific; +int context; +{ + return gen2if (generic, specific, context); +} + + +struct NSAPaddr *if2gen (generic, specific, context) +struct NSAPaddr *generic; +CONN_DB *specific; +int context; +{ + return if2gen (generic, specific, context); +} +#endif diff --git a/usr/src/contrib/isode/compat/log_tai.c b/usr/src/contrib/isode/compat/log_tai.c new file mode 100644 index 0000000000..fc9e478dcf --- /dev/null +++ b/usr/src/contrib/isode/compat/log_tai.c @@ -0,0 +1,125 @@ +/* log_tai.c - system tailoring routines */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/log_tai.c,v 7.1 91/02/22 09:15:30 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/log_tai.c,v 7.1 91/02/22 09:15:30 mrose Interim $ + * + * + * $Log: log_tai.c,v $ + * Revision 7.1 91/02/22 09:15:30 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:16 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "cmd_srch.h" +#include "general.h" +#include "manifest.h" +#include "logger.h" + +/* */ + +#define LG_FILE 1 +#define LG_SFLAGS 2 +#define LG_DFLAGS 3 +#define LG_LEVEL 4 +#define LG_SIZE 5 +#define LG_DLEVEL 6 + +static CMD_TABLE log_tbl[] = { + "FILE", LG_FILE, + "SFLAGS", LG_SFLAGS, + "DFLAGS", LG_DFLAGS, + "LEVEL", LG_LEVEL, + "SLEVEL", LG_LEVEL, + "DLEVEL", LG_DLEVEL, + "SIZE", LG_SIZE, + 0, -1, +}; + +static CMD_TABLE log_lvltbl[] = { + "NONE", LLOG_NONE, + "FATAL", LLOG_FATAL, + "EXCEPTIONS", LLOG_EXCEPTIONS, + "NOTICE", LLOG_NOTICE, + "TRACE", LLOG_TRACE, + "DEBUG", LLOG_DEBUG, + "PDUS", LLOG_PDUS, + "ALL", LLOG_ALL, + 0, -1 +}; + +static CMD_TABLE log_flgtbl[] = { + "CLOSE", LLOGCLS, + "CREATE", LLOGCRT, + "ZERO", LLOGZER, + "TTY", LLOGTTY, + 0, -1 +}; + +/* */ + +log_tai(lgptr, av, ac) /* for now only alter the level - files etc later */ +LLog *lgptr; +char **av; +int ac; +{ + register int i; + register char *p; + int val; + + for(i = 0; i < ac; i++) + { + if((p = index(av[i], '=')) == NULLCP) + continue; + *p++ = NULL; + switch(cmd_srch(av[i], log_tbl)) + { + case LG_LEVEL: + val = cmd_srch(p,log_lvltbl); + if (val != -1) + lgptr->ll_events |= val; + break; + case LG_DLEVEL: + val = cmd_srch(p,log_lvltbl); + if (val != -1) + lgptr->ll_events &= ~ val; + break; + case LG_FILE: + lgptr->ll_file = strdup (p); + break; + case LG_SFLAGS: + val = cmd_srch(p,log_flgtbl); + if (val != -1) + lgptr->ll_stat |= val; + break; + case LG_DFLAGS: + val = cmd_srch(p,log_flgtbl); + if (val != -1) + lgptr->ll_stat &= ~ val; + break; + case LG_SIZE: + lgptr->ll_msize = atoi(p); + break; + } + } +} diff --git a/usr/src/contrib/isode/compat/logger.c b/usr/src/contrib/isode/compat/logger.c new file mode 100644 index 0000000000..8428c1d22d --- /dev/null +++ b/usr/src/contrib/isode/compat/logger.c @@ -0,0 +1,614 @@ +/* logger.c - system logging routines */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/logger.c,v 7.6 91/02/22 09:15:32 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/logger.c,v 7.6 91/02/22 09:15:32 mrose Interim $ + * + * + * $Log: logger.c,v $ + * Revision 7.6 91/02/22 09:15:32 mrose + * Interim 6.8 + * + * Revision 7.5 90/11/21 11:29:50 mrose + * sun + * + * Revision 7.4 90/10/23 20:40:43 mrose + * update + * + * Revision 7.3 90/08/14 14:25:18 mrose + * CHKINT + * + * Revision 7.2 90/04/23 00:08:12 mrose + * touch-up + * + * Revision 7.1 90/02/19 13:07:17 mrose + * update + * + * Revision 7.0 89/11/23 21:23:17 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "logger.h" +#include "tailor.h" + +#ifdef NULL +#undef NULL +#endif +#include +#ifndef NULL +#define NULL 0 +#endif +#ifdef BSD42 +#include +#endif +#ifdef SYS5 +#include +#endif +#include + +#ifndef BSD42 +#include +#else +#ifndef timerisset +#include +#endif +#endif + +#ifndef SYS5 +#include +#endif + +/* */ + +struct ll_private { + int ll_checks; +#define CHKINT 15 /* call ll_check 1 in every 15 uses... */ +}; + +static struct ll_private *llp = NULL; +static IFP _ll_header_routine = ll_defmhdr; + + +long lseek (), time (); + +/* */ + +int ll_open (lp) +register LLog *lp; +{ + int mask, + mode; + char *bp, + buffer[BUFSIZ]; + struct stat st; + + if (llp == NULL + && (llp = (struct ll_private *) + calloc ((unsigned int) getdtablesize (), + sizeof *llp)) == NULL) + goto you_lose; + + if (lp -> ll_file == NULLCP + || *lp -> ll_file == NULL) { +you_lose: ; + (void) ll_close (lp); + lp -> ll_stat |= LLOGERR; + return NOTOK; + } + + lp -> ll_stat &= ~LLOGERR; + + if (lp -> ll_fd != NOTOK) + return OK; + + if (strcmp (lp -> ll_file, "-") == 0) { + lp -> ll_stat |= LLOGTTY; + return OK; + } + + (void) sprintf (bp = buffer, _isodefile (isodelogpath, lp -> ll_file), + getpid ()); + + mode = O_WRONLY | O_APPEND; + if (stat (bp, &st) == NOTOK && (lp -> ll_stat & LLOGCRT)) + mode |= O_CREAT; + + mask = umask (~0666); + lp -> ll_fd = open (bp, mode, 0666); + (void) umask (mask); + + if (ll_check (lp) == NOTOK) + return (NOTOK); + if (lp -> ll_fd != NOTOK) + llp[lp -> ll_fd].ll_checks = CHKINT; + + return (lp -> ll_fd != NOTOK ? OK : NOTOK); +} + +/* */ + +int ll_close (lp) +register LLog *lp; +{ + int status; + + if (lp -> ll_fd == NOTOK) + return OK; + + status = close (lp -> ll_fd); + lp -> ll_fd = NOTOK; + + return status; +} + +/* */ + +#ifndef lint +int ll_log (va_alist) +va_dcl +{ + int event, + result; + LLog *lp; + va_list ap; + + va_start (ap); + + lp = va_arg (ap, LLog *); + event = va_arg (ap, int); + + result = _ll_log (lp, event, ap); + + va_end (ap); + + return result; +} +#else +/* VARARGS4 */ + +int ll_log (lp, event, what, fmt) +LLog *lp; +int event; +char *what, + *fmt; +{ + return ll_log (lp, event, what, fmt); +} +#endif + +/* */ + +int _ll_log (lp, event, ap) /* what, fmt, args ... */ +register LLog *lp; +int event; +va_list ap; +{ + int cc, + status; + register char *bp; + char *what, + buffer[BUFSIZ]; + + if (!(lp -> ll_events & event)) + return OK; + + bp = buffer; + + /* Create header */ + (*_ll_header_routine)(bp, lp -> ll_hdr, lp -> ll_dhdr); + + bp += strlen (bp); + + what = va_arg (ap, char *); + + _asprintf (bp, what, ap); + +#ifndef SYS5 + if (lp -> ll_syslog & event) { + int priority; + + switch (event) { + case LLOG_FATAL: + priority = LOG_ERR; + break; + + case LLOG_EXCEPTIONS: + priority = LOG_WARNING; + break; + + case LLOG_NOTICE: + priority = LOG_INFO; + break; + + case LLOG_PDUS: + case LLOG_TRACE: + case LLOG_DEBUG: + priority = LOG_DEBUG; + break; + + default: + priority = LOG_NOTICE; + break; + } + + (void) syslog (priority, "%s", buffer + 13); + + if (lp -> ll_stat & LLOGCLS) + (void) closelog (); + } +#endif + + if (!(lp -> ll_stat & LLOGTTY) + && lp -> ll_fd == NOTOK + && strcmp (lp -> ll_file, "-") == 0) + lp -> ll_stat |= LLOGTTY; + + if (lp -> ll_stat & LLOGTTY) { + (void) fflush (stdout); + + if (lp -> ll_fd != NOTOK) + (void) fprintf (stderr, "LOGGING: "); + (void) fputs (bp, stderr); + (void) fputc ('\n', stderr); + (void) fflush (stderr); + } + bp += strlen (bp); + + if (lp -> ll_fd == NOTOK) { + if ((lp -> ll_stat & (LLOGERR | LLOGTTY)) == (LLOGERR | LLOGTTY)) + return OK; + if (ll_open (lp) == NOTOK) + return NOTOK; + } + else + if ((!llp || llp[lp -> ll_fd].ll_checks-- < 0) + && ll_check (lp) == NOTOK) + return NOTOK; + + *bp++ = '\n', *bp = NULL; + cc = bp - buffer; + + if ((status = write (lp -> ll_fd, buffer, cc)) != cc) { + if (status == NOTOK) { + (void) ll_close (lp); +error: ; + lp -> ll_stat |= LLOGERR; + return NOTOK; + } + + status = NOTOK; + } + else + status = OK; + + if ((lp -> ll_stat & LLOGCLS) && ll_close (lp) == NOTOK) + goto error; + + return status; +} + +/* */ + +void ll_hdinit (lp, prefix) +register LLog *lp; +char *prefix; +{ + register char *cp, + *up; + char buffer[BUFSIZ], + user[10]; + + if (prefix == NULLCP) { + if ((lp -> ll_stat & LLOGHDR) && strlen (lp -> ll_hdr) == 25) + (cp = lp -> ll_hdr)[8] = NULL; + else + cp = "unknown"; + } + else { + if ((cp = rindex (prefix, '/'))) + cp++; + if (cp == NULL || *cp == NULL) + cp = prefix; + } + + if ((up = getenv ("USER")) == NULLCP + && (up = getenv ("LOGNAME")) == NULLCP) { + (void) sprintf (user, "#%d", getuid ()); + up = user; + } + (void) sprintf (buffer, "%-8.8s %05d (%-8.8s)", + cp, getpid () % 100000, up); + + if (lp -> ll_stat & LLOGHDR) + free (lp -> ll_hdr); + lp -> ll_stat &= ~LLOGHDR; + + if ((lp -> ll_hdr = malloc ((unsigned) (strlen (buffer) + 1))) == NULLCP) + return; + + (void) strcpy (lp -> ll_hdr, buffer); + lp -> ll_stat |= LLOGHDR; +} + +/* */ + +void ll_dbinit (lp, prefix) +register LLog *lp; +char *prefix; +{ + register char *cp; + char buffer[BUFSIZ]; + + ll_hdinit (lp, prefix); + + if (prefix) { + if ((cp = rindex (prefix, '/'))) + cp++; + if (cp == NULL || *cp == NULL) + cp = prefix; + + (void) sprintf (buffer, "./%s.log", cp); + + if ((lp -> ll_file = malloc ((unsigned) (strlen (buffer) + 1))) + == NULLCP) + return; + + (void) strcpy (lp -> ll_file, buffer); + } + + lp -> ll_events |= LLOG_ALL; + lp -> ll_stat |= LLOGTTY; +} + +/* */ + +#ifndef lint +int ll_printf (va_alist) +va_dcl +{ + int result; + LLog *lp; + va_list ap; + + va_start (ap); + + lp = va_arg (ap, LLog *); + + result = _ll_printf (lp, ap); + + va_end (ap); + + return result; +} +#else +/* VARARGS2 */ + +int ll_printf (lp, fmt) +LLog *lp; +char *fmt; +{ + return ll_printf (lp, fmt); +} +#endif + +/* */ + +#ifndef lint +static +#endif +int _ll_printf (lp, ap) /* fmt, args ... */ +register LLog *lp; +va_list ap; +{ + int cc, + status; + register char *bp; + char buffer[BUFSIZ]; + char *fmt; + va_list fp = ap; + + fmt = va_arg (fp, char *); + if (strcmp (fmt, "%s") != 0) { + bp = buffer; + _asprintf (bp, NULLCP, ap); + } + else { + bp = NULL; + fmt = va_arg (fp, char *); + } + + if (!(lp -> ll_stat & LLOGTTY) + && lp -> ll_fd == NOTOK + && strcmp (lp -> ll_file, "-") == 0) + lp -> ll_stat |= LLOGTTY; + + if (lp -> ll_stat & LLOGTTY) { + (void) fflush (stdout); + + if (bp) + (void) fputs (bp, stderr); + else + (void) fputs (fmt, stderr); + (void) fflush (stderr); + } + if (bp) + bp += strlen (bp); + + if (lp -> ll_fd == NOTOK) { + if ((lp -> ll_stat & (LLOGERR | LLOGTTY)) == (LLOGERR | LLOGTTY)) + return OK; + if (ll_open (lp) == NOTOK) + return NOTOK; + } + else + if ((!llp || llp[lp -> ll_fd].ll_checks-- < 0) + && ll_check (lp) == NOTOK) + return NOTOK; + + if (bp) + cc = bp - buffer; + else + cc = strlen (fmt); + + if ((status = write (lp -> ll_fd, bp ? buffer : fmt, cc)) != cc) { + if (status == NOTOK) { + (void) ll_close (lp); + lp -> ll_stat |= LLOGERR; + return NOTOK; + } + + status = NOTOK; + } + else + status = OK; + + return status; +} + +/* */ + +int ll_sync (lp) +register LLog *lp; +{ + if (lp -> ll_stat & LLOGCLS) + return ll_close (lp); + + return OK; +} + +/* */ + +#ifndef lint +char *ll_preset (va_alist) +va_dcl +{ + va_list ap; + static char buffer[BUFSIZ]; + + va_start (ap); + + _asprintf (buffer, NULLCP, ap); + + va_end (ap); + + return buffer; +} +#else +/* VARARGS1 */ + +char *ll_preset (fmt) +char *fmt; +{ + return ll_preset (fmt); +} +#endif + +/* */ + +int ll_check (lp) +register LLog *lp; +{ +#ifndef BSD42 + int fd; + char buffer[BUFSIZ]; +#endif + long size; + struct stat st; + + if ((size = lp -> ll_msize) <= 0) + return OK; + + if (llp && lp -> ll_fd != NOTOK) + llp[lp -> ll_fd].ll_checks = CHKINT; + if (lp -> ll_fd == NOTOK + || (fstat (lp -> ll_fd, &st) != NOTOK + && st.st_size < (size <<= 10))) + return OK; + + if (!(lp -> ll_stat & LLOGZER)) { + (void) ll_close (lp); + +#ifndef BSD42 +error: ; +#endif + lp -> ll_stat |= LLOGERR; + return NOTOK; + } + +#ifdef BSD42 +#ifdef SUNOS4 + (void) ftruncate (lp -> ll_fd, (off_t) 0); +#else + (void) ftruncate (lp -> ll_fd, 0); +#endif + (void) lseek (lp -> ll_fd, 0L, 0); + return OK; +#else + (void) sprintf (buffer, _isodefile (isodelogpath, lp -> ll_file), + getpid ()); + if ((fd = open (buffer, O_WRONLY | O_APPEND | O_TRUNC)) == NOTOK) + goto error; + (void) close (fd); + return OK; +#endif +} + +/* */ + +/* + * ll_defmhdr - Default "make header" routine. + */ +int ll_defmhdr(bufferp, headerp, dheaderp) +char *bufferp; /* Buffer pointer */ +char *headerp; /* Static header string */ +char *dheaderp; /* Dynamic header string */ +{ + long clock; + register struct tm *tm; + + (void) time (&clock); + tm = localtime (&clock); + + (void) sprintf (bufferp, "%2d/%2d %2d:%02d:%02d %s %s ", + tm -> tm_mon + 1, tm -> tm_mday, + tm -> tm_hour, tm -> tm_min, tm -> tm_sec, + headerp ? headerp : "", + dheaderp ? dheaderp : ""); +} + +/* */ + +/* + * ll_setmhdr - Set "make header" routine, overriding default. + */ +IFP ll_setmhdr (make_header_routine) +IFP make_header_routine; +{ + IFP result = _ll_header_routine; + + _ll_header_routine = make_header_routine; + + return result; + +} diff --git a/usr/src/contrib/isode/compat/make b/usr/src/contrib/isode/compat/make new file mode 100644 index 0000000000..e8e326991d --- /dev/null +++ b/usr/src/contrib/isode/compat/make @@ -0,0 +1,7 @@ +: run this script through /bin/sh +M=/bin/make +if [ -f /usr/bin/make ]; then + M=/usr/bin/make +fi + +exec $M MODULE=compat TOPDIR=../ -f ../config/CONFIG.make -f Makefile ${1+"$@"} diff --git a/usr/src/contrib/isode/compat/na2norm.c b/usr/src/contrib/isode/compat/na2norm.c new file mode 100644 index 0000000000..96ec5d9854 --- /dev/null +++ b/usr/src/contrib/isode/compat/na2norm.c @@ -0,0 +1,162 @@ +/* na2norm.c - normalize NSAPaddr */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/na2norm.c,v 7.3 91/02/22 09:15:36 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/na2norm.c,v 7.3 91/02/22 09:15:36 mrose Interim $ + * + * + * $Log: na2norm.c,v $ + * Revision 7.3 91/02/22 09:15:36 mrose + * Interim 6.8 + * + * Revision 7.2 90/08/08 14:03:00 mrose + * stuff + * + * Revision 7.1 90/07/09 14:32:04 mrose + * sync + * + * Revision 7.0 89/11/23 21:23:18 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" +#include "internet.h" +#include "tailor.h" + +/* Encoding based on + + "An interim approach to use of Network Addresses", + S.E. Kille, January 16, 1989 + + */ + +/* */ + +struct NSAPaddr *na2norm (na) +register struct NSAPaddr *na; +{ + int ilen; + register char *cp, + *dp; + char nsap[NASIZE * 2 + 1]; + register struct hostent *hp; + register struct ts_interim *ts; + static struct NSAPaddr nas; + register struct NSAPaddr *ca = &nas; + + if (na -> na_stack == NA_NSAP) { + *ca = *na; /* struct copy */ + return ca; + } + + bzero ((char *) ca, sizeof *ca); + ca -> na_stack = NA_NSAP; + + for (ts = ts_interim; ts -> ts_name; ts++) + if (ts -> ts_subnet == na -> na_community) + break; + if (!ts -> ts_name) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unable to find community #%d", na -> na_community)); + return NULLNA; + } + + cp = nsap; + switch (na -> na_stack) { + case NA_TCP: + if ((hp = gethostbystring (na -> na_domain)) == NULL) { + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("%s: unknown host", na -> na_domain)); + return NULLNA; + } +#define s2a(b) (((int) (b)) & 0xff) + (void) sprintf (cp, "%03d%03d%03d%03d", + s2a (hp -> h_addr[0]), + s2a (hp -> h_addr[1]), + s2a (hp -> h_addr[2]), + s2a (hp -> h_addr[3])); + cp += strlen (cp); +#undef s2a + + if (na -> na_port) { + (void) sprintf (cp, "%05d", (int) ntohs (na -> na_port)); + cp += strlen (cp); + + if (na -> na_tset || na -> na_tset != NA_TSET_TCP) { + (void) sprintf (cp, "%05d", (int) na -> na_tset); + cp += strlen (cp); + } + } + break; + + case NA_X25: + case NA_BRG: + if (na -> na_community == SUBNET_INT_X25 + && na -> na_cudflen == 0 + && na -> na_pidlen == 0 + && na -> na_dte[0] != '0') { /* SEK - X121 form */ + /* should be more general */ + (void) sprintf (nsap, "36%014s", na -> na_dte); + ts = NULL; + break; + } + + if (ilen = na -> na_pidlen & 0xff) + *cp++ = '1', dp = na -> na_pid; + else + if (ilen = na -> na_cudflen & 0xff) + *cp++ = '2', dp = na -> na_cudf; + else + *cp++ = '0'; + if (ilen) { + (void) sprintf (cp, "%01d", ilen); + cp += strlen (cp); + + for (; ilen-- > 0; cp += 3) + (void) sprintf (cp, "%03d", *dp++ & 0xff); + } + (void) strcpy (cp, na -> na_dte); + break; + + default: + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("unknown address type 0x%x", na -> na_stack)); + return NULLNA; + } + + cp = nsap, dp = ca -> na_address; + if (ts) { + bcopy (ts -> ts_prefix, dp, ts -> ts_length); + dp += ts -> ts_length; + } + while (*cp) { + *dp = (*cp++ - '0') << 4; + if (*cp) + *dp++ |= (*cp++ - '0') & 0x0f; + else + *dp++ |= 0x0f; + } + ca -> na_addrlen = dp - ca -> na_address; + + return ca; +} diff --git a/usr/src/contrib/isode/compat/na2str.c b/usr/src/contrib/isode/compat/na2str.c new file mode 100644 index 0000000000..caba25543e --- /dev/null +++ b/usr/src/contrib/isode/compat/na2str.c @@ -0,0 +1,58 @@ +/* na2str.c - pretty-print NSAPaddr */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/na2str.c,v 7.2 91/02/22 09:15:37 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/na2str.c,v 7.2 91/02/22 09:15:37 mrose Interim $ + * + * + * $Log: na2str.c,v $ + * Revision 7.2 91/02/22 09:15:37 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/09 14:32:05 mrose + * sync + * + * Revision 7.0 89/11/23 21:23:19 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" + +/* Network Address to String */ + +char *na2str (na) +register struct NSAPaddr *na; +{ + switch (na -> na_stack) { + case NA_TCP: + return na -> na_domain; + + case NA_X25: + case NA_BRG: + return na -> na_dte; + + case NA_NSAP: + default: + return sel2str (na -> na_address, na -> na_addrlen, 0); + } +} diff --git a/usr/src/contrib/isode/compat/nochrcnv.c b/usr/src/contrib/isode/compat/nochrcnv.c new file mode 100644 index 0000000000..fa45539c37 --- /dev/null +++ b/usr/src/contrib/isode/compat/nochrcnv.c @@ -0,0 +1,74 @@ +/* nochrcnv.c - character conversion table, no case folding */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/nochrcnv.c,v 7.1 91/02/22 09:15:38 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/nochrcnv.c,v 7.1 91/02/22 09:15:38 mrose Interim $ + * + * + * $Log: nochrcnv.c,v $ + * Revision 7.1 91/02/22 09:15:38 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:20 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" + +/* */ + +char /* straight mapping - Non case sensive */ + /* used for consistency */ + nochrcnv[] = +{ + '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7', + '\10', '\11', '\12', '\13', '\14', '\15', '\16', '\17', + '\20', '\21', '\22', '\23', '\24', '\25', '\26', '\27', + '\30', '\31', '\32', '\33', '\34', '\35', '\36', '\37', + '\40', '\41', '\42', '\43', '\44', '\45', '\46', '\47', + '\50', '\51', '\52', '\53', '\54', '\55', '\56', '\57', + '\60', '\61', '\62', '\63', '\64', '\65', '\66', '\67', + '\70', '\71', '\72', '\73', '\74', '\75', '\77', '\77', + '\100', '\101', '\102', '\103', '\104', '\105', '\106', '\107', + '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117', + '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127', + '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\177', '\177', + '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7', + '\10', '\11', '\12', '\13', '\14', '\15', '\16', '\17', + '\20', '\21', '\22', '\23', '\24', '\25', '\26', '\27', + '\30', '\31', '\32', '\33', '\34', '\35', '\36', '\37', + '\40', '\41', '\42', '\43', '\44', '\45', '\46', '\47', + '\50', '\51', '\52', '\53', '\54', '\55', '\56', '\57', + '\60', '\61', '\62', '\63', '\64', '\65', '\66', '\67', + '\70', '\71', '\72', '\73', '\74', '\75', '\77', '\77', + '\100', '\101', '\102', '\103', '\104', '\105', '\106', '\107', + '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117', + '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127', + '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\177', '\177' +}; diff --git a/usr/src/contrib/isode/compat/norm2na.c b/usr/src/contrib/isode/compat/norm2na.c new file mode 100644 index 0000000000..07018febcc --- /dev/null +++ b/usr/src/contrib/isode/compat/norm2na.c @@ -0,0 +1,286 @@ +/* norm2na.c - normalize NSAPaddr to NSAP struct */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/norm2na.c,v 7.3 91/02/22 09:15:39 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/norm2na.c,v 7.3 91/02/22 09:15:39 mrose Interim $ + * + * + * $Log: norm2na.c,v $ + * Revision 7.3 91/02/22 09:15:39 mrose + * Interim 6.8 + * + * Revision 7.2 90/12/11 10:52:50 mrose + * lock-and-load + * + * Revision 7.1 90/08/08 14:03:02 mrose + * stuff + * + * Revision 7.0 90/08/05 16:01:25 mrose + * *** empty log message *** + * + * + */ + +/* + * 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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "psap.h" +#include "isoaddrs.h" +#include "tailor.h" + +/* Encoding on "unrealNS" addresses based on + + "An interim approach to use of Network Addresses", + S.E. Kille, January 16, 1989 + + */ + +/* */ + +int norm2na (p, len, na) +char *p; +int len; +struct NSAPaddr *na; +{ + na -> na_stack = NA_NSAP; + + if ((len == 8) && ((p[0] == 0x36) || (p[0] == 0x37))) { + int xlen; /* SEK - X121 form */ + register char *cp, + *cp2, + *dp; + char nsap[14]; + + dp = nsap; + for (cp2 = (cp = p + 1) + 7; cp < cp2; cp++) { + register int j; + + if ((j = ((*cp & 0xf0) >> 4)) > 9) + goto concrete; + *dp++ = j + '0'; + + if ((j = (*cp & 0x0f)) > 9) { + if (j != 0x0f) + goto concrete; + } + else + *dp++ = j + '0'; + } + + for (cp = nsap, xlen = 14; *cp == '0'; cp++, xlen--) + continue; + na -> na_dtelen = xlen; + for (cp2 = na -> na_dte; xlen-- > 0; ) + *cp2++ = *cp++; + *cp2 = NULL; +#ifdef BRIDGE_X25 + na -> na_stack = bridgediscrim (na) ? NA_BRG : NA_X25; +#else + na -> na_stack = NA_X25; +#endif + na -> na_community = SUBNET_INT_X25; + } + else { + register struct ts_interim *ts, + *tp; + + tp = NULL; + for (ts = ts_interim; ts -> ts_name; ts++) + if (len > ts -> ts_length + && (tp == NULL || ts -> ts_length > tp -> ts_length) + && bcmp (p, ts -> ts_prefix, ts -> ts_length) == 0) + tp = ts; + if (tp) { + int i, + ilen, + rlen; + register char *cp, + *dp, + *ep; + char nsap[NASIZE * 2 + 1]; + + if (tp -> ts_syntax == NA_NSAP) + goto lock_and_load; + dp = nsap; + for (cp = p + tp -> ts_length, ep = p + len; + cp < ep; + cp++) { + register int j; + + if ((j = ((*cp & 0xf0) >> 4)) > 9) { +concrete: ; + LLOG (addr_log, LLOG_EXCEPTIONS, + ("invalid concrete encoding")); + goto realNS; + } + *dp++ = j + '0'; + + if ((j = (*cp & 0x0f)) > 9) { + if (j != 0x0f) + goto concrete; + } + else + *dp++ = j + '0'; + } + *dp = NULL; + + cp = nsap; +lock_and_load: ; + na -> na_community = tp -> ts_subnet; + switch (na -> na_stack = tp -> ts_syntax) { + case NA_NSAP: + goto unrealNS; + + case NA_X25: + if (strlen (cp) < 1) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("missing DTE+CUDF indicator: %s", nsap)); + goto realNS; + } + (void) sscanf (cp, "%1d", &i); + cp += 1; + switch (i) { + case 0: /* DTE only */ + break; + + case 1: /* DTE+PID */ + case 2: /* DTE+CUDF */ + if (strlen (cp) < 1) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("missing DTE+CUDF indicator: %s", + nsap)); + goto realNS; + } + (void) sscanf (cp, "%1d", &ilen); + cp += 1; + rlen = ilen * 3; + if (strlen (cp) < rlen) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("bad DTE+CUDF length: %s", nsap)); + goto realNS; + } + if (i == 1) { + if (ilen > NPSIZE) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("PID too long: %s", nsap)); + goto realNS; + } + dp = na -> na_pid; + na -> na_pidlen = ilen; + } + else { + if (ilen > CUDFSIZE) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("CUDF too long: %s", nsap)); + goto realNS; + } + dp = na -> na_cudf; + na -> na_cudflen = ilen; + } + for (; rlen > 0; rlen -= 3) { + (void) sscanf (cp, "%3d", &i); + cp += 3; + + if (i > 255) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("invalid PID/CUDF: %s", nsap)); + goto realNS; + } + *dp++ = i & 0xff; + } + break; + + default: + LLOG (addr_log, LLOG_EXCEPTIONS, + ("invalid DTE+CUDF indicator: %s", nsap)); + goto realNS; + } + (void) strcpy (na -> na_dte, cp); + na -> na_dtelen = strlen (na -> na_dte); + +#ifdef BRIDGE_X25 + if (bridgediscrim (na)) + na -> na_stack = NA_BRG; +#endif + break; + + case NA_TCP: + if (strlen (cp) < 12) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("missing IP address: %s", nsap)); + goto realNS; + } + { + int q[4]; + + (void) sscanf (cp, "%3d%3d%3d%3d", q, q + 1, q + 2, + q + 3); + (void) sprintf (na -> na_domain, + "%d.%d.%d.%d", q[0], q[1], q[2], q[3]); + } + cp += 12; + + if (*cp) { + if (strlen (cp) < 5) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("missing port: %s", nsap)); + goto realNS; + } + (void) sscanf (cp, "%5d", &i); + cp += 5; + na -> na_port = htons ((u_short) i); + + if (*cp) { + if (strlen (cp) < 5) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("missing tset: %s", nsap)); + goto realNS; + } + (void) sscanf (cp, "%5d", &i); + cp += 5; + na -> na_tset = (u_short) i; + + if (*cp) + LLOG (addr_log, LLOG_EXCEPTIONS, + ("extra TCP information: %s", nsap)); + } + } + break; + + default: + LLOG (addr_log, LLOG_NOTICE, + ("unknown syntax %d for DSP: %s", ts -> ts_syntax, + nsap)); + goto realNS; + } + } + else { +realNS: ; + na -> na_stack = NA_NSAP; + na -> na_community = SUBNET_REALNS; +unrealNS: ; + if (len > sizeof na -> na_address) { + LLOG (addr_log, LLOG_EXCEPTIONS, + ("NSAP address too long: %d octets", len)); + return NOTOK; + } + bcopy (p, na -> na_address, na -> na_addrlen = len); + } + } + + return OK; +} diff --git a/usr/src/contrib/isode/compat/pa2str.c b/usr/src/contrib/isode/compat/pa2str.c new file mode 100644 index 0000000000..c5b215a548 --- /dev/null +++ b/usr/src/contrib/isode/compat/pa2str.c @@ -0,0 +1,81 @@ +/* pa2str.c - pretty-print PSAPaddr */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/pa2str.c,v 7.2 91/02/22 09:15:40 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/pa2str.c,v 7.2 91/02/22 09:15:40 mrose Interim $ + * + * + * $Log: pa2str.c,v $ + * Revision 7.2 91/02/22 09:15:40 mrose + * Interim 6.8 + * + * Revision 7.1 90/11/21 11:29:53 mrose + * sun + * + * Revision 7.0 89/11/30 20:55:02 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" + +/* Presentation Address to String */ + +char *pa2str (px) +register struct PSAPaddr *px; +{ + register char *bp; + struct PSAPaddr pas; + register struct PSAPaddr *pa = &pas; + register struct TSAPaddr *ta = &pa -> pa_addr.sa_addr; + static char buffer[BUFSIZ]; + + bp = buffer; + + *pa = *px; /* struct copy */ + if (ta -> ta_selectlen > 0 + && ta -> ta_selectlen < sizeof ta -> ta_selector) { + register char *dp, + *ep; + register struct TSAPaddr *tz; + + for (ep = (dp = ta -> ta_selector) + ta -> ta_selectlen, *ep = NULL; + dp < ep; + dp++) + if (!isprint ((u_char) *dp) && *dp != ' ') + break; + if (dp >= ep && (tz = str2taddr (ta -> ta_selector))) { + pa -> pa_addr.sa_addr = *tz; /* struct copy */ + (void) sprintf (bp, "%s through TS bridge at ", + paddr2str (pa, NULLNA)); + bp += strlen (bp); + + bzero ((char *) pa, sizeof *pa); + *ta = px -> pa_addr.sa_addr; /* struct copy */ + ta -> ta_selectlen = 0; + } + } + (void) strcpy (bp, paddr2str (pa, NULLNA)); + + return buffer; +} diff --git a/usr/src/contrib/isode/compat/putenv.c b/usr/src/contrib/isode/compat/putenv.c new file mode 100644 index 0000000000..70f34e1d88 --- /dev/null +++ b/usr/src/contrib/isode/compat/putenv.c @@ -0,0 +1,108 @@ +/* putenv.c - generic putenv() */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/putenv.c,v 7.1 91/02/22 09:15:41 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/putenv.c,v 7.1 91/02/22 09:15:41 mrose Interim $ + * + * + * $Log: putenv.c,v $ + * Revision 7.1 91/02/22 09:15:41 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:21 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" + +/* */ + +extern char **environ; + +/* */ + +int setenv (name, value) +register char *name, + *value; +{ + register int i; + register char **ep, + **nep, + *cp; + + if ((cp = malloc ((unsigned) (strlen (name) + strlen (value) + 2))) + == NULL) + return 1; + (void) sprintf (cp, "%s=%s", name, value); + + for (ep = environ, i = 0; *ep; ep++, i++) + if (nvmatch (name, *ep)) { + *ep = cp; + return 0; + } + + if ((nep = (char **) malloc ((unsigned) ((i + 2) * sizeof *nep))) + == NULL) { + free (cp); + return 1; + } + for (ep = environ, i = 0; *ep; nep[i++] = *ep++) + continue; + nep[i++] = cp; + nep[i] = NULL; + environ = nep; + return 0; +} + +/* */ + +int unsetenv (name) +char *name; +{ + char **ep, + **nep; + + for (ep = environ; *ep; ep++) + if (nvmatch (name, *ep)) + break; + if (*ep == NULL) + return 1; + + for (nep = ep + 1; *nep; nep++) + continue; + *ep = *--nep; + *nep = NULL; + return 0; +} + +/* */ + +static nvmatch (s1, s2) +register char *s1, + *s2; +{ + while (*s1 == *s2++) + if (*s1++ == '=') + return 1; + + return (*s1 == '\0' && *--s2 == '='); +} diff --git a/usr/src/contrib/isode/compat/rcmd_srch.c b/usr/src/contrib/isode/compat/rcmd_srch.c new file mode 100644 index 0000000000..59ef591d23 --- /dev/null +++ b/usr/src/contrib/isode/compat/rcmd_srch.c @@ -0,0 +1,46 @@ +/* rcmd_srch.c: search a lookup table: return string value */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/rcmd_srch.c,v 7.1 91/02/22 09:15:42 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/rcmd_srch.c,v 7.1 91/02/22 09:15:42 mrose Interim $ + * + * + * $Log: rcmd_srch.c,v $ + * Revision 7.1 91/02/22 09:15:42 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:22 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include "manifest.h" +#include "cmd_srch.h" + +/* */ + +char *rcmd_srch(val, cmd) +register int val; +register CMD_TABLE *cmd; +{ + for(;cmd->cmd_key != NULLCP; cmd++) + if(val == cmd->cmd_value) + return(cmd->cmd_key); + return(NULLCP); +} diff --git a/usr/src/contrib/isode/compat/saddr2str.c b/usr/src/contrib/isode/compat/saddr2str.c new file mode 100644 index 0000000000..a3afc2a3df --- /dev/null +++ b/usr/src/contrib/isode/compat/saddr2str.c @@ -0,0 +1,50 @@ +/* saddr2str.c - SSAPaddr to string value */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/saddr2str.c,v 7.1 91/02/22 09:15:43 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/saddr2str.c,v 7.1 91/02/22 09:15:43 mrose Interim $ + * + * + * $Log: saddr2str.c,v $ + * Revision 7.1 91/02/22 09:15:43 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:22 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" + +/* */ + +char *saddr2str (sa) +register struct SSAPaddr *sa; +{ + struct PSAPaddr pas; + register struct PSAPaddr *pa = &pas; + + bzero ((char *) pa, sizeof *pa); + pa -> pa_addr = *sa; /* struct copy */ + + return paddr2str (pa, NULLNA); +} diff --git a/usr/src/contrib/isode/compat/sel2str.c b/usr/src/contrib/isode/compat/sel2str.c new file mode 100644 index 0000000000..5034ee2165 --- /dev/null +++ b/usr/src/contrib/isode/compat/sel2str.c @@ -0,0 +1,94 @@ +/* sel2str.c - selector to string */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/sel2str.c,v 7.2 91/02/22 09:15:44 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/sel2str.c,v 7.2 91/02/22 09:15:44 mrose Interim $ + * + * + * $Log: sel2str.c,v $ + * Revision 7.2 91/02/22 09:15:44 mrose + * Interim 6.8 + * + * Revision 7.1 90/11/21 11:29:55 mrose + * sun + * + * Revision 7.0 89/11/23 21:23:23 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" + +/* */ + +char *sel2str (sel, len, quoted) +char *sel; +int len, + quoted; +{ + register char *cp, + *dp, + *ep; + static int i = 0; + static char buf1[NASIZE * 2 + 1], + buf2[NASIZE * 2 + 1], + buf3[NASIZE * 2 + 1], + buf4[NASIZE * 2 + 1]; + static char *bufs[] = { buf1, buf2, buf3, buf4 }; + + cp = bufs[i++]; + i = i % 4; + + if (quoted) { +#ifndef NOGOSIP + if (len == 2) { + if (quoted < 0) + goto ugly; + (void) sprintf (cp, "#%d", + (sel[0] & 0xff) << 8 | (sel[1] & 0xff)); + goto out; + } +#endif + + for (ep = (dp = sel) + len; dp < ep; dp++) + if (!isprint ((u_char) *dp)) + goto ugly; + + if (len > NASIZE * 2) + len = NASIZE * 2; + + (void) sprintf (cp, len ? "\"%*.*s\"" : "\"\"", len, len, sel); + } + else { +ugly: ; + if (len > NASIZE) /* XXX */ + len = NASIZE; + + cp[explode (cp, (u_char *) sel, len)] = NULL; + } +#ifndef NOGOSIP +out: ; +#endif + + return cp; +} diff --git a/usr/src/contrib/isode/compat/select.c b/usr/src/contrib/isode/compat/select.c new file mode 100644 index 0000000000..dc30ea3b26 --- /dev/null +++ b/usr/src/contrib/isode/compat/select.c @@ -0,0 +1,316 @@ +/* select.c - select() abstractions */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/select.c,v 7.6 91/02/22 09:15:45 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/select.c,v 7.6 91/02/22 09:15:45 mrose Interim $ + * + * + * $Log: select.c,v $ + * Revision 7.6 91/02/22 09:15:45 mrose + * Interim 6.8 + * + * Revision 7.5 91/01/07 12:39:56 mrose + * update + * + * Revision 7.4 90/11/21 11:35:31 mrose + * update + * + * Revision 7.3 90/05/22 19:33:29 mrose + * update + * + * Revision 7.2 89/12/05 22:04:41 mrose + * touch-up + * + * Revision 7.1 89/11/30 23:53:31 mrose + * touch-up + * + * Revision 7.0 89/11/23 21:23:24 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "manifest.h" +#include "tailor.h" +#include + + +extern int errno; + + +int xselect_blocking_on_intr = 0; + +/* */ + +#ifdef SOCKETS + +#include + + +/* Synchronous multiplexing: + < 0 : block indefinately + = 0 : poll + > 0 : wait + */ + +int selsocket (nfds, rfds, wfds, efds, secs) +int nfds; +fd_set *rfds, + *wfds, + *efds; +int secs; +{ + int n; + fd_set ifds, + ofds, + xfds; + struct timeval tvs; + register struct timeval *tv = &tvs; + + if (secs != NOTOK) + tv -> tv_sec = secs, tv -> tv_usec = 0; + else + tv = NULL; + + if (rfds) + ifds = *rfds; + if (wfds) + ofds = *wfds; + if (efds) + xfds = *efds; + for (;;) { + switch (n = select (nfds, rfds, wfds, efds, tv)) { + case OK: + if (secs == NOTOK) + break; + return OK; + + case NOTOK: + if (xselect_blocking_on_intr + && errno == EINTR + && secs == NOTOK) + continue; + /* else fall... */ + + default: + return n; + } + + if (rfds) + *rfds = ifds; + if (wfds) + *wfds = ofds; + if (efds) + *efds = xfds; + } +} +#endif + +/* */ + +#ifdef EXOS + +#ifdef SYS5 + +/* There seems to be a bug in the SYS5 EXOS select() routine when a socket can + be read immediately (don't know about write). The bug is that select() + returns ZERO, and the mask is zero'd as well. The code below explicitly + checks for this case. +*/ + +#include "sys/soioctl.h" + + +int selsocket (nfds, rfds, wfds, efds, secs) +int nfds; +fd_set *rfds, + *wfds, + *efds; +int secs; +{ + register int fd; + int n; + fd_set ifds, + ofds; + long nbytes, + usecs; + + if (secs != NOTOK) + usecs = secs * 1000; + else + usecs = 0xffff; /* used to be ~(1L << (8 * sizeof usecs - 1)) */ + + if (rfds) + ifds = *rfds; + if (wfds) + ofds = *wfds; + if (efds) + FD_ZERO (efds); + + for (;;) { + switch (n = select (nfds + 1, rfds, wfds, usecs)) { /* +1 for UNISYS */ + case OK: + if (rfds) + for (fd = 0; fd < nfds; fd++) + if (FD_ISSET (fd, &ifds) + && ioctl (fd, FIONREAD, (char *) &nbytes) + != NOTOK + && nbytes > 0) { + FD_SET (fd, rfds); + n++; + } + if (n == 0 && secs == NOTOK) + break; + return n; + + case NOTOK: + default: + return n; + } + + if (rfds) + *rfds = ifds; + if (wfds) + *wfds = ofds; + } +} +#endif +#endif + +/* */ + +/* This routine used to be used for devices that didn't support real select. + Those devices are no longer supported. + + Instead the routine is used to check if an I/O abstraction has some data + buffered in user-space for reading... + */ + +static IFP sfnx[FD_SETSIZE] = { NULL }; +static caddr_t sdata[FD_SETSIZE] = { NULL }; + + +IFP set_check_fd (fd, fnx, data) +int fd; +IFP fnx; +caddr_t data; +{ + IFP ofnx; + + if (fd < 0 || fd >= FD_SETSIZE) + return NULLIFP; + + ofnx = sfnx[fd]; + sfnx[fd] = fnx, sdata[fd] = data; + + return ofnx; +} + +/* */ + +int xselect (nfds, rfds, wfds, efds, secs) +int nfds; +fd_set *rfds, + *wfds, + *efds; +int secs; +{ + register int fd; + int n; + fd_set ifds, + ofds, + xfds; + static int nsysfds = NOTOK; + + if (nsysfds == NOTOK) + nsysfds = getdtablesize (); + if (nfds > FD_SETSIZE) + nfds = FD_SETSIZE; + if (nfds > nsysfds + 1) + nfds = nsysfds + 1; + + FD_ZERO (&ifds); + n = 0; + + for (fd = 0; fd < nfds; fd++) + if (sfnx[fd] != NULLIFP + && rfds + && FD_ISSET (fd, rfds) + && (*sfnx[fd]) (fd, sdata[fd]) == DONE) { + FD_SET (fd, &ifds); + n++; + } + + if (n > 0) { + *rfds = ifds; /* struct copy */ + if (wfds) + FD_ZERO (wfds); + if (efds) + FD_ZERO (efds); + + return n; + } + + if (rfds) + ifds = *rfds; /* struct copy */ + if (wfds) + ofds = *wfds; /* struct copy */ + if (efds) + xfds = *efds; /* struct copy */ + + if ((n = selsocket (nfds, rfds, wfds, efds, secs)) != NOTOK) + return n; + + if (errno == EBADF) { + struct stat st; + + if (rfds) + FD_ZERO (rfds); + if (wfds) + FD_ZERO (wfds); + if (efds) + FD_ZERO (efds); + + n = 0; + for (fd = 0; fd < nfds; fd++) + if (((rfds && FD_ISSET (fd, &ifds)) + || (wfds && FD_ISSET (fd, &ofds)) + || (efds && FD_ISSET (fd, &xfds))) + && fstat (fd, &st) == NOTOK) { + if (rfds && FD_ISSET (fd, &ifds)) + FD_SET (fd, rfds); + if (wfds && FD_ISSET (fd, &ofds)) + FD_SET (fd, wfds); + if (efds && FD_ISSET (fd, &xfds)) + FD_SET (fd, efds); + + SLOG (compat_log, LLOG_EXCEPTIONS, "", + ("fd %d has gone bad", fd)); + n++; + } + + if (n) + return n; + + errno = EBADF; + } + + return NOTOK; +} diff --git a/usr/src/contrib/isode/compat/serror.c b/usr/src/contrib/isode/compat/serror.c new file mode 100644 index 0000000000..2b57876807 --- /dev/null +++ b/usr/src/contrib/isode/compat/serror.c @@ -0,0 +1,57 @@ +/* serror.c - get system error */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/serror.c,v 7.2 91/02/22 09:15:47 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/serror.c,v 7.2 91/02/22 09:15:47 mrose Interim $ + * + * + * $Log: serror.c,v $ + * Revision 7.2 91/02/22 09:15:47 mrose + * Interim 6.8 + * + * Revision 7.1 91/01/11 07:09:12 mrose + * jpo + * + * Revision 7.0 89/11/23 21:23:25 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" + +/* DATA */ + +extern int sys_nerr; +extern char *sys_errlist[]; + +/* */ + +char *sys_errname (i) +int i; +{ + static char buffer[30]; + + if (0 < i && i < sys_nerr) + return sys_errlist[i]; + (void) sprintf (buffer, "Error %d", i); + + return buffer; +} diff --git a/usr/src/contrib/isode/compat/servbyname.c b/usr/src/contrib/isode/compat/servbyname.c new file mode 100644 index 0000000000..fa2d0b256c --- /dev/null +++ b/usr/src/contrib/isode/compat/servbyname.c @@ -0,0 +1,69 @@ +/* servbyname.c - getisoserventbyname */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/servbyname.c,v 7.1 91/02/22 09:15:48 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/servbyname.c,v 7.1 91/02/22 09:15:48 mrose Interim $ + * + * + * $Log: servbyname.c,v $ + * Revision 7.1 91/02/22 09:15:48 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:26 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoservent.h" +#include "tailor.h" + +/* */ + +struct isoservent *getisoserventbyname (entity, provider) +char *entity, + *provider; +{ + register struct isoservent *is; + + isodetailor (NULLCP, 0); + DLOG (addr_log, LLOG_TRACE, + ("getisoserventbyname \"%s\" \"%s\"", entity, provider)); + + (void) setisoservent (0); + while (is = getisoservent ()) + if (strcmp (entity, is -> is_entity) == 0 + && strcmp (provider, is -> is_provider) == 0) + break; + (void) endisoservent (); + + if (is) { +#ifdef DEBUG + if (addr_log -> ll_events & LLOG_DEBUG) + _printsrv (is); +#endif + } + else + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("lookup of local service %s/%s failed", provider, entity)); + + return is; +} diff --git a/usr/src/contrib/isode/compat/servbyport.c b/usr/src/contrib/isode/compat/servbyport.c new file mode 100644 index 0000000000..e18cd7cbbb --- /dev/null +++ b/usr/src/contrib/isode/compat/servbyport.c @@ -0,0 +1,71 @@ +/* servbyport.c - getisoserventbyport */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/servbyport.c,v 7.1 91/02/22 09:15:49 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/servbyport.c,v 7.1 91/02/22 09:15:49 mrose Interim $ + * + * + * $Log: servbyport.c,v $ + * Revision 7.1 91/02/22 09:15:49 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:27 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoservent.h" +#include "tailor.h" + +/* */ + +struct isoservent *getisoserventbyport (provider, port) +char *provider; +unsigned short port; +{ + register struct isoservent *is; + + isodetailor (NULLCP, 0); + DLOG (addr_log, LLOG_TRACE, + ("getisoserventbyport \"%s\" %d", provider, (int) ntohs (port))); + + (void) setisoservent (0); + while (is = getisoservent ()) + if (sizeof (port) == is -> is_selectlen + && port == is -> is_port + && strcmp (provider, is -> is_provider) == 0) + break; + (void) endisoservent (); + + if (is) { +#ifdef DEBUG + if (addr_log -> ll_events & LLOG_DEBUG) + _printsrv (is); +#endif + } + else + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("lookup of local service %s/%d failed", + provider, (int) ntohs (port))); + + return is; +} diff --git a/usr/src/contrib/isode/compat/servbysel.c b/usr/src/contrib/isode/compat/servbysel.c new file mode 100644 index 0000000000..ab85eff013 --- /dev/null +++ b/usr/src/contrib/isode/compat/servbysel.c @@ -0,0 +1,73 @@ +/* servbysel.c - getisoserventbyselector */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/servbysel.c,v 7.1 91/02/22 09:15:50 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/servbysel.c,v 7.1 91/02/22 09:15:50 mrose Interim $ + * + * + * $Log: servbysel.c,v $ + * Revision 7.1 91/02/22 09:15:50 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:27 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoservent.h" +#include "tailor.h" + +/* */ + +struct isoservent *getisoserventbyselector (provider, selector, selectlen) +char *provider, + *selector; +int selectlen; +{ + register struct isoservent *is; + + isodetailor (NULLCP, 0); + DLOG (addr_log, LLOG_TRACE, + ("getisoserventbyselector \"%s\" %s", + provider, sel2str (selector, selectlen, 1))); + + (void) setisoservent (0); + while (is = getisoservent ()) + if (selectlen == is -> is_selectlen + && bcmp (selector, is -> is_selector, is -> is_selectlen) == 0 + && strcmp (provider, is -> is_provider) == 0) + break; + (void) endisoservent (); + + if (is) { +#ifdef DEBUG + if (addr_log -> ll_events & LLOG_DEBUG) + _printsrv (is); +#endif + } + else + SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, + ("lookup of local service %s %s failed", + provider, sel2str (selector, selectlen, 1))); + + return is; +} diff --git a/usr/src/contrib/isode/compat/signals.c b/usr/src/contrib/isode/compat/signals.c new file mode 100644 index 0000000000..a365ce1f85 --- /dev/null +++ b/usr/src/contrib/isode/compat/signals.c @@ -0,0 +1,143 @@ +/* signals.c - signal handling */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/signals.c,v 7.2 91/02/22 09:15:51 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/signals.c,v 7.2 91/02/22 09:15:51 mrose Interim $ + * + * + * $Log: signals.c,v $ + * Revision 7.2 91/02/22 09:15:51 mrose + * Interim 6.8 + * + * Revision 7.1 90/10/29 18:38:03 mrose + * updates + * + * Revision 7.0 89/11/23 21:23:28 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#ifndef BADSIG +#define BADSIG ((SFP) -1) +#endif +#include "manifest.h" + +/* */ + +int _iosignals_set = 0; + +/* Berkeley UNIX: 4.2 */ + +#ifndef XOS_2 +#ifdef BSDSIGS + +/* Simply including is sufficient for everything but AIX */ + +#ifdef AIX /* #define'd to be _signal */ +IFP signal (sig, func) +int sig; +IFP func; +{ + struct sigvec sv1, + sv2; + + sv1.sv_handler = func; + sv1.sv_mask = sv1.sv_onstack = 0; + return (sigvec (sig, &sv1, &sv2) != NOTOK ? sv2.sv_handler : BADSIG); +} +#endif + +#else + +/* AT&T UNIX: 5 */ + + +/* Probably a race condition or two in this code */ + + +static int blocked = 0; +static int pending = 0; + +static SFP handler[NSIG]; + + +static int sigser (sig) +int sig; +{ + (void) signal (sig, sigser); + + pending |= sigmask (sig); +} + +/* */ + +int sigblock (mask) +int mask; +{ + register int sig, + smask; + long omask = blocked; + + if (mask == 0) + return blocked; + + for (sig = 1, smask = sigmask (sig); sig < NSIG; sig++, smask <<= 1) + if ((smask & mask) && !(smask & blocked)) { + pending &= ~smask; + handler[sig] = signal (sig, sigser); + blocked |= smask; + } + + return omask; +} + + +int sigsetmask (mask) +int mask; +{ + register int sig, + smask; + long omask = blocked; + + for (sig = 1, smask = sigmask (sig); sig < NSIG; sig++, smask <<= 1) + if (smask & mask) { + if (smask & blocked) + continue; + + pending &= ~smask; + handler[sig] = signal (sig, sigser); + blocked |= smask; + } + else + if (smask & blocked) { + blocked &= ~smask; + (void) signal (sig, handler[sig] != BADSIG ? handler[sig] + : SIG_DFL); + if (smask & pending) { + pending &= ~smask; + (void) kill (getpid (), sig); + } + } + + return omask; +} + +#endif +#endif diff --git a/usr/src/contrib/isode/compat/smalloc.c b/usr/src/contrib/isode/compat/smalloc.c new file mode 100644 index 0000000000..36f1ce1645 --- /dev/null +++ b/usr/src/contrib/isode/compat/smalloc.c @@ -0,0 +1,53 @@ +/* smalloc.c - error checking malloc */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/smalloc.c,v 7.1 91/02/22 09:15:52 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/smalloc.c,v 7.1 91/02/22 09:15:52 mrose Interim $ + * + * + * $Log: smalloc.c,v $ + * Revision 7.1 91/02/22 09:15:52 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:33 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + +/* */ + +char * +smalloc(size) +int size; +{ + register char *ptr; + + if ((ptr = malloc((unsigned) size)) == NULL){ + LLOG (compat_log,LLOG_FATAL, ("malloc() failure")); + abort (); + /* NOTREACHED */ + } + + return(ptr); +} diff --git a/usr/src/contrib/isode/compat/sprintb.c b/usr/src/contrib/isode/compat/sprintb.c new file mode 100644 index 0000000000..fd8c2e7263 --- /dev/null +++ b/usr/src/contrib/isode/compat/sprintb.c @@ -0,0 +1,70 @@ +/* sprintb.c - sprintf on bits */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/sprintb.c,v 7.1 91/02/22 09:15:53 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/sprintb.c,v 7.1 91/02/22 09:15:53 mrose Interim $ + * + * + * $Log: sprintb.c,v $ + * Revision 7.1 91/02/22 09:15:53 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:33 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" + +/* */ + +char *sprintb (v, bits) +register int v; +register char *bits; +{ + register int i, + j; + register char c, + *bp; + static char buffer[BUFSIZ]; + + (void) sprintf (buffer, bits && *bits == 010 ? "0%o" : "0x%x", v); + bp = buffer + strlen (buffer); + + if (bits && *++bits) { + j = 0; + *bp++ = '<'; + while (i = *bits++) + if (v & (1 << (i - 1))) { + if (j++) + *bp++ = ','; + for (; (c = *bits) > 32; bits++) + *bp++ = c; + } + else + for (; *bits > 32; bits++) + continue; + *bp++ = '>'; + *bp = NULL; + } + + return buffer; +} diff --git a/usr/src/contrib/isode/compat/sstr2arg.c b/usr/src/contrib/isode/compat/sstr2arg.c new file mode 100644 index 0000000000..d42b81e412 --- /dev/null +++ b/usr/src/contrib/isode/compat/sstr2arg.c @@ -0,0 +1,150 @@ +/* sstr2arg: convert string into argument list */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/sstr2arg.c,v 7.3 91/02/22 09:15:54 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/sstr2arg.c,v 7.3 91/02/22 09:15:54 mrose Interim $ + * + * + * $Log: sstr2arg.c,v $ + * Revision 7.3 91/02/22 09:15:54 mrose + * Interim 6.8 + * + * Revision 7.2 90/10/16 11:20:29 mrose + * partial-backoff-from-jpo + * + * Revision 7.1 90/10/15 18:19:57 mrose + * sync + * + * Revision 7.0 89/11/23 21:23:34 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "manifest.h" +#include + +extern int errno; + +/* */ + +/* + stash a pointer to each field into the passed array. any common seperators + split the words. extra white-space between fields is ignored. + + specially-interpreted characters: + double-quote, backslash (preceding a special char with a backslash + removes its interpretation. A backslash not followed by a special is + used to preface an octal specification for one character a string begun + with double-quote has only double-quote and backslash as special + characters. + +*/ + + + + +sstr2arg (srcptr, maxpf, argv, dlmstr) +register char *srcptr; /* source data */ +int maxpf; /* maximum number of permitted fields */ +char *argv[]; /* where to put the pointers */ +char *dlmstr; /* Delimiting character */ +{ + char gotquote; /* currently parsing quoted string */ + register int ind; + register char *destptr; + + if (srcptr == 0) { + errno = EINVAL; /* emulate system-call failure */ + return (NOTOK); + } + + for (ind = 0, maxpf -= 2;; ind++) { + if (ind >= maxpf) { + errno = E2BIG; /* emulate system-call failure */ + return (NOTOK); + } + + /* Skip leading white space */ + for (; *srcptr == '\t' || *srcptr == ' '; srcptr++); + + argv [ind] = srcptr; + destptr = srcptr; + + for (gotquote = 0; ; ) { + register char *cp; + + for (cp = dlmstr; (*cp != '\0') && (*cp != *srcptr); cp++); + + if (*cp != '\0') + { + if (gotquote) { /* don't interpret the char */ + *destptr++ = *srcptr++; + continue; + } + + srcptr++; + *destptr = '\0'; + goto nextarg; + } else { + switch (*srcptr) { + default: /* just copy it */ + *destptr++ = *srcptr++; + break; + + case '\"': /* beginning or end of string */ + gotquote = (gotquote) ? 0 : 1 ; + srcptr++; /* just toggle */ + break; + + case '\\': /* quote next character */ + srcptr++; /* skip the back-slash */ + switch (*srcptr) { + /* Octal character */ + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + *destptr = '\0'; + do + *destptr = (*destptr << 3) | (*srcptr++ - '0'); + while (*srcptr >= '0' && *srcptr <= '7'); + destptr++; + break; + /* C escape char */ + case 'b': *destptr++ = '\b'; srcptr++; break; + case 'n': *destptr++ = '\n'; srcptr++; break; + case 'r': *destptr++ = '\r'; srcptr++; break; + case 't': *destptr++ = '\t'; srcptr++; break; + /* Boring -- just copy ASIS */ + default: + *destptr++ = *srcptr++; + } + break; + + case '\0': + *destptr = '\0'; + ind++; + argv[ind] = (char *) 0; + return (ind); + } + } + } + nextarg: + continue; + } +} diff --git a/usr/src/contrib/isode/compat/str2elem.c b/usr/src/contrib/isode/compat/str2elem.c new file mode 100644 index 0000000000..5b619cd157 --- /dev/null +++ b/usr/src/contrib/isode/compat/str2elem.c @@ -0,0 +1,67 @@ +/* str2elem.c - string to list of integers */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/str2elem.c,v 7.2 91/02/22 09:15:55 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/str2elem.c,v 7.2 91/02/22 09:15:55 mrose Interim $ + * + * + * $Log: str2elem.c,v $ + * Revision 7.2 91/02/22 09:15:55 mrose + * Interim 6.8 + * + * Revision 7.1 90/11/21 11:29:57 mrose + * sun + * + * Revision 7.0 89/11/23 21:23:35 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" + +/* */ + +int str2elem (s, elements) +char *s; +unsigned int elements[]; +{ + register int i; + register unsigned int *ip; + register char *cp, + *dp; + + ip = elements, i = 0; + for (cp = s; *cp && i <= NELEM; cp = ++dp) { + for (dp = cp; isdigit ((u_char) *dp); dp++) + continue; + if ((cp == dp) || (*dp && *dp != '.')) + break; + *ip++ = (unsigned int) atoi (cp), i++; + if (*dp == NULL) + break; + } + if (*dp || i >= NELEM) + return NOTOK; + *ip = 0; + + return i; +} diff --git a/usr/src/contrib/isode/compat/str2saddr.c b/usr/src/contrib/isode/compat/str2saddr.c new file mode 100644 index 0000000000..2a07230f6e --- /dev/null +++ b/usr/src/contrib/isode/compat/str2saddr.c @@ -0,0 +1,49 @@ +/* str2saddr.c - string value to SSAPaddr */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/str2saddr.c,v 7.1 91/02/22 09:15:56 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/str2saddr.c,v 7.1 91/02/22 09:15:56 mrose Interim $ + * + * + * $Log: str2saddr.c,v $ + * Revision 7.1 91/02/22 09:15:56 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:36 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" + +/* */ + +struct SSAPaddr *str2saddr (str) +char *str; +{ + register struct PSAPaddr *pa; + + if (pa = str2paddr (str)) + return (&pa -> pa_addr); + + return NULLSA; +} diff --git a/usr/src/contrib/isode/compat/str2sel.c b/usr/src/contrib/isode/compat/str2sel.c new file mode 100644 index 0000000000..59037d9d36 --- /dev/null +++ b/usr/src/contrib/isode/compat/str2sel.c @@ -0,0 +1,128 @@ +/* str2sel.c - string to selector */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/str2sel.c,v 7.2 91/02/22 09:15:57 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/str2sel.c,v 7.2 91/02/22 09:15:57 mrose Interim $ + * + * + * $Log: str2sel.c,v $ + * Revision 7.2 91/02/22 09:15:57 mrose + * Interim 6.8 + * + * Revision 7.1 90/11/21 11:29:59 mrose + * sun + * + * Revision 7.0 89/11/23 21:23:37 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + + +#define QUOTE '\\' + +/* STR2SEL */ + +int str2sel (s, quoted, sel, n) +char *s, + *sel; +int quoted, + n; +{ + int i, + r; + register char *cp; + + if (*s == NULL) + return 0; + + if (quoted <= 0) { + for (cp = s; *cp; cp++) + if (!isxdigit ((u_char) *cp)) + break; + + if (*cp == NULL && (i = (cp - s)) >= 2 && (i & 0x01) == 0) { + if (i > (r = n * 2)) + i = r; + i = implode ((u_char *) sel, s, i); + if ((r = (n - i)) > 0) + bzero (sel + i, r); + return i; + } + if (*s == '#') { /* gosip style, network byte-order */ + i = atoi (s + 1); + sel[0] = (i >> 8) & 0xff; + sel[1] = i & 0xff; + + return 2; + } + + DLOG (compat_log, LLOG_EXCEPTIONS, ("invalid selector \"%s\"", s)); + } + + for (cp = sel; *s && n > 0; cp++, s++, n--) + if (*s != QUOTE) + *cp = *s; + else + switch (*++s) { + case 'b': + *cp = '\b'; + break; + case 'f': + *cp = '\f'; + break; + case 'n': + *cp = '\n'; + break; + case 'r': + *cp = '\r'; + break; + case 't': + *cp = '\t'; + break; + + case NULL: + s--; + case QUOTE: + *cp = QUOTE; + break; + + default: + if (!isdigit ((u_char) *s)) { + *cp++ = QUOTE; + *cp = *s; + break; + } + r = *s != '0' ? 10 : 8; + for (i = 0; isdigit ((u_char) *s); s++) + i = i * r + *s - '0'; + s--; + *cp = toascii (i); + break; + } + if (n > 0) + *cp = NULL; + + return (cp - sel); +} diff --git a/usr/src/contrib/isode/compat/str2taddr.c b/usr/src/contrib/isode/compat/str2taddr.c new file mode 100644 index 0000000000..d023e7ca69 --- /dev/null +++ b/usr/src/contrib/isode/compat/str2taddr.c @@ -0,0 +1,49 @@ +/* str2taddr.c - string value to TSAPaddr */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/str2taddr.c,v 7.1 91/02/22 09:16:00 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/str2taddr.c,v 7.1 91/02/22 09:16:00 mrose Interim $ + * + * + * $Log: str2taddr.c,v $ + * Revision 7.1 91/02/22 09:16:00 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:38 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" + +/* */ + +struct TSAPaddr *str2taddr (str) +char *str; +{ + register struct PSAPaddr *pa; + + if (pa = str2paddr (str)) + return (&pa -> pa_addr.sa_addr); + + return NULLTA; +} diff --git a/usr/src/contrib/isode/compat/str2vec.c b/usr/src/contrib/isode/compat/str2vec.c new file mode 100644 index 0000000000..8bfe847a4d --- /dev/null +++ b/usr/src/contrib/isode/compat/str2vec.c @@ -0,0 +1,104 @@ +/* str2vec.c - string to vector */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/str2vec.c,v 7.3 91/02/22 09:16:01 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/str2vec.c,v 7.3 91/02/22 09:16:01 mrose Interim $ + * + * + * $Log: str2vec.c,v $ + * Revision 7.3 91/02/22 09:16:01 mrose + * Interim 6.8 + * + * Revision 7.2 90/12/23 18:39:41 mrose + * update + * + * Revision 7.1 90/11/21 11:30:02 mrose + * sun + * + * Revision 7.0 89/11/23 21:23:39 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" + + +#define QUOTE '\\' + +/* */ + +int str2vecX (s, vec, nmask, mask, brk, docomma) +register char *s, + **vec, + brk; +int nmask, + *mask, + docomma; +{ + register int i; + char comma = docomma ? ',' : ' '; + + if (mask) + *mask = 0; + + for (i = 0; i <= NVEC;) { + vec[i] = NULL; + if (brk > 0) { + if (i > 0 && *s == brk) + *s++ = NULL; + } + else + while (isspace ((u_char) *s) || *s == comma) + *s++ = NULL; + if (*s == NULL) + break; + + if (*s == '"') { + if (i < nmask) + *mask |= 1 << i; + for (vec[i++] = ++s; *s != NULL && *s != '"'; s++) + if (*s == QUOTE) { + if (*++s == '"') + (void) strcpy (s - 1, s); + s--; + } + if (*s == '"') + *s++ = NULL; + continue; + } + if (*s == QUOTE && *++s != '"') + s--; + vec[i++] = s; + + if (brk > 0) { + if (*s != brk) + for (s++; *s != NULL && *s != brk; s++) + continue; + } + else + for (s++; *s != NULL && !isspace ((u_char) *s) && *s != comma; s++) + continue; + } + vec[i] = NULL; + + return i; +} diff --git a/usr/src/contrib/isode/compat/strdup.c b/usr/src/contrib/isode/compat/strdup.c new file mode 100644 index 0000000000..6d1366fc6d --- /dev/null +++ b/usr/src/contrib/isode/compat/strdup.c @@ -0,0 +1,60 @@ +/* strdup.c - create a duplicate copy of the given string */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/strdup.c,v 7.3 91/02/22 09:16:05 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/strdup.c,v 7.3 91/02/22 09:16:05 mrose Interim $ + * + * + * $Log: strdup.c,v $ + * Revision 7.3 91/02/22 09:16:05 mrose + * Interim 6.8 + * + * Revision 7.2 90/11/04 19:14:52 mrose + * update + * + * Revision 7.1 90/10/15 18:19:58 mrose + * sync + * + * Revision 7.0 89/11/23 21:23:40 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + +/* */ + +char *strdup (str) +register char *str; +{ + register char *ptr; + + if ((ptr = malloc((unsigned) (strlen (str) + 1))) == NULL){ + LLOG (compat_log,LLOG_FATAL, ("strdup malloc() failure")); + abort (); + /* NOTREACHED */ + } + + (void) strcpy (ptr, str); + + return ptr; +} diff --git a/usr/src/contrib/isode/compat/sunlink.c b/usr/src/contrib/isode/compat/sunlink.c new file mode 100644 index 0000000000..c9369e7c55 --- /dev/null +++ b/usr/src/contrib/isode/compat/sunlink.c @@ -0,0 +1,642 @@ +/* sunlink.c - X.25 abstractions for SunLink X25 */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/sunlink.c,v 7.6 91/02/22 09:16:06 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/sunlink.c,v 7.6 91/02/22 09:16:06 mrose Interim $ + * + * Contributed by John Pavel, Department of Trade and Industry/National + * Physical Laboratory in the UK + * + * + * $Log: sunlink.c,v $ + * Revision 7.6 91/02/22 09:16:06 mrose + * Interim 6.8 + * + * Revision 7.5 91/01/14 13:33:49 mrose + * loader + * + * Revision 7.4 91/01/07 12:39:59 mrose + * update + * + * Revision 7.3 90/10/15 18:19:36 mrose + * sync + * + * Revision 7.2 90/07/27 08:41:49 mrose + * update + * + * Revision 7.1 90/07/09 14:32:22 mrose + * sync + * + * Revision 7.0 89/11/23 21:23:42 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" + +/* SUN UNIX: SunLink X25 */ + +#ifdef X25 + +#include "x25.h" +#include "isoaddrs.h" + +#ifdef SUN_X25 + +#define CALLING 0 +#define CALLED 1 +#define PROBE (-1) + +/* */ + +#ifdef DEBUG +void print_x25_facilities (); +#endif + +/* */ + +/* ARGSUSED */ + +int start_x25_client (local, priv) +struct NSAPaddr *local; +int priv; +{ + int sd; + + if ((sd = socket (AF_X25, SOCK_STREAM, 0)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("socket")); + return NOTOK; + } + + return sd; +} + +/* */ + +int start_x25_server (local, backlog, opt1, opt2) +struct NSAPaddr *local; +int backlog, + opt1, + opt2; +{ + CONN_DB sbuf, + xbuf; + CONN_DB *sock = &sbuf, + *xs = &xbuf; + int sd, onoff; + + if ((sd = socket (AF_X25, SOCK_STREAM, 0)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("socket")); + return NOTOK; + } + + onoff = 0; + if (ioctl (sd, X25_CALL_ACPT_APPROVAL, (char *) &onoff) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", + ("X25_CALL_ACPT_APPROVAL")); + (void) close_x25_socket (sd); + return NOTOK; + } + + if (ioctl (sd, X25_RD_HOSTADR, (char *) xs) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("X25_RD_HOSTADR")); + (void) close_x25_socket (sd); + return NOTOK; + } + /* if null DTE in /etc/x25params + then ALWAYS use null DTE for + listen if PID is specified */ + if (xs -> hostlen == 0 && local -> na_pidlen > 0) { + if (local -> na_pidlen > NPSIZE) + local -> na_pidlen = NPSIZE; + *sock = *xs; /* struct copy */ + bzero((char *) sock -> data, NPSIZE); + bcopy (local -> na_pid, (char *) sock -> data, local -> na_pidlen); + bcopy (local -> na_cudf, (char *) sock -> data + NPSIZE, + local -> na_cudflen); + sock -> datalen = local -> na_pidlen + local -> na_cudflen; + } + else + sock = gen2if(local, sock, ADDR_LISTEN); + + /* Adopt the convention that if a null DTE is given, + we should get the one from /etc/x25params */ + if(!local->na_dtelen) { + /* Now set the generic local address */ + local = if2gen(local, xs, ADDR_LOCAL); + /* Modified by INRIA to avoid a null local address */ + if (!local->na_dtelen) { + local->na_dtelen = 1; + local->na_dte[0] = '0'; + } + } + + if (bind (sd, (struct sockaddr *) sock, sizeof(CONN_DB)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("bind")); + (void) close_x25_socket (sd); + return NOTOK; + } + +#ifndef BSD43 + if (opt1) + (void) setsockopt (sd, SOL_SOCKET, opt1, NULLCP, 0); + if (opt2) + (void) setsockopt (sd, SOL_SOCKET, opt2, NULLCP, 0); +#else + onoff = 1; + if (opt1) + (void) setsockopt (sd, SOL_SOCKET, opt1, (char *)&onoff, sizeof onoff); + if (opt2) + (void) setsockopt (sd, SOL_SOCKET, opt2, (char *)&onoff, sizeof onoff); +#endif + + if (set_x25_facilities(sd, CALLED, "Acceptable") == NOTOK) { + (void) close_x25_socket (sd); + return NOTOK; + } + + (void) listen (sd, backlog); + + return sd; +} + +/* */ + +int join_x25_server (fd, remote) +register int fd; +register struct NSAPaddr *remote; +{ + CONN_DB sbuf; + CONN_DB *sock = &sbuf; + register int nfd; + + if ((sock = gen2if (remote, sock, ADDR_REMOTE)) == NULL) + return NOTOK; + + if (set_x25_facilities(fd, CALLING, "Proposed") == NOTOK) + return NOTOK; +#ifdef ANY_LINK + sock -> hostlen |= ANY_LINK; +#endif + if ((nfd = connect (fd, (struct sockaddr *)sock, sizeof (CONN_DB))) + == NOTOK) { + if (compat_log -> ll_events & LLOG_EXCEPTIONS) + (void) log_cause_and_diag(fd); /* Sun's documentation throwns + no light as to whether, or + not this will result in any + useful information */ + } +#ifdef DEBUG + else + if (compat_log -> ll_events & LLOG_DEBUG) + (void) log_x25_facilities(fd, CALLING, "Effective Calling"); +#endif +#ifdef ANY_LINK + sock -> hostlen &= ~ANY_LINK; +#endif + remote = if2gen (remote, sock, ADDR_REMOTE); + + return nfd; +} + +/* */ + +int join_x25_client (fd, remote) +int fd; +struct NSAPaddr *remote; +{ + CONN_DB sbuf; + CONN_DB *sock = &sbuf; + int len = sizeof *sock; + int nfd; + + if ((nfd = accept (fd, (struct sockaddr *) sock, &len)) == NOTOK) { + if (compat_log -> ll_events & LLOG_EXCEPTIONS) + (void) log_cause_and_diag(fd); /* Sun's documentation throwns + no light as to whether, or + not this will result in any + useful information */ + } +#ifdef DEBUG + else + if (compat_log -> ll_events & LLOG_DEBUG) + (void) log_x25_facilities(fd, CALLED, "Effective Called"); +#endif + if (nfd < 0) return nfd; + + /* May also need to send call accept packet if using + * FAST_ACPT_CLR, or X25_CALL_ACPT_APPROVAL + * there was a SUNLINK bug in this area + * + * May as well try it -- if it fails, so what ?? + */ + if (ioctl(nfd,X25_SEND_CALL_ACPT, NULLCP) < 0) + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("X25_SEND_CALL_ACPT")); + + remote = if2gen (remote, sock, ADDR_REMOTE); + + return nfd; +} + +/* */ + +/* There is a bug whereby if the thruput is set, calls fail. pb@cl.cam.ac.uk */ + +int sun_fixed_thruput = 0; + +/* Set up X.25 Facilities. Note that setting even one value causes + the default (/etc/x25params) values to be set explicitly on the + call request (and probably also call accept). This can screw + things up, if your /etc/x25params has not been properly + localised as is normally the case. */ + +int set_x25_facilities(sd, coc, caption) +int sd, coc; +char *caption; +{ + FACILITY_DB facilities; + + bzero ((char *) &facilities, sizeof facilities); + + if (coc != CALLED + && ioctl (sd, X25_RD_FACILITY, (char *) &facilities) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("X25_RD_FACILITY")); + return NOTOK; + } + + if (coc == PROBE + || !(coc == CALLED + || reverse_charge || recvpktsize || sendpktsize + || recvwndsize || sendwndsize || recvthruput + || sendthruput || cug_req /* || cug_index */ + || fast_select_type || rpoa_req /* || rpoa */)) { + if (facilities.recvpktsize) + recvpktsize = facilities.recvpktsize; + if (facilities.sendpktsize) + sendpktsize = facilities.sendpktsize; + + return OK; + } + + if (reverse_charge) + facilities.reverse_charge = reverse_charge; + if (recvpktsize) + facilities.recvpktsize = recvpktsize; + if (sendpktsize) + facilities.sendpktsize = sendpktsize; + if (recvwndsize) + facilities.recvwndsize = recvwndsize; + if (sendwndsize) + facilities.sendwndsize = sendwndsize; + if (sun_fixed_thruput) { /* get round Sun bug */ + if (recvthruput) + facilities.recvthruput = recvthruput; + if (sendthruput) + facilities.sendthruput = sendthruput; + } + else + facilities.recvthruput = facilities.sendthruput = 0; + if (cug_req) + facilities.cug_req = cug_req; + if (cug_index) + facilities.cug_index = cug_index; + if (fast_select_type) + facilities.fast_select_type = fast_select_type; + /* May as well accept FCS calls */ + else + if (coc == CALLED) + facilities.fast_select_type = FAST_ACPT_CLR; + if (rpoa_req) + facilities.rpoa_req = rpoa_req; + if (rpoa) + facilities.rpoa = rpoa; + +#define DO_NOT_USE_FACILITIES +#ifndef DO_NOT_USE_FACILITIES +#ifdef DEBUG + if (compat_log -> ll_events & LLOG_DEBUG) + print_x25_facilities (facilities, coc, caption); +#endif + + if (ioctl (sd, X25_WR_FACILITY, (char *) &facilities) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("X25_WR_FACILITY")); + return NOTOK; + } +#endif + +#ifdef notyet + if (facilities.recvpktsize) + recvpktsize = facilities.recvpktsize; + if (facilities.sendpktsize) + sendpktsize = facilities.sendpktsize; +#endif + + return OK; +} + +/* */ + +int log_cause_and_diag(fd) +int fd; +{ + X25_CAUSE_DIAG diag; + + if (ioctl(fd, X25_RD_CAUSE_DIAG, (char *) &diag) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("X25_RD_CAUSE_DIAG")); + return NOTOK; + } + + return elucidate_x25_err ((int) diag.flags, (char *) diag.data); + +} + +/* */ + +#ifdef DEBUG + +static int log_x25_facilities (fd, coc, caption) +int fd; +int coc; +char *caption; +{ + FACILITY_DB f; + + if (ioctl (fd, X25_RD_FACILITY, (char *) &f) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("X25_RD_FACILITY")); + return NOTOK; + } + + print_x25_facilities (f, coc, caption); + + return OK; +} + +/* */ + +static void print_x25_facilities (f, coc, caption) +FACILITY_DB f; +int coc; +char *caption; +{ + int baud; + + DLOG (compat_log, LLOG_DEBUG, ("%s X.25 Facilities:", caption)); + + switch (f.reverse_charge) { + case 0: + DLOG (compat_log, LLOG_DEBUG, ((coc == CALLED) + ? "reverse charging not requested" + : "reverse charging not allowed")); + break; + + case 1: + DLOG (compat_log, LLOG_DEBUG, ((coc == CALLING) + ? "reverse charging requested" + : "reverse charging allowed")); + break; + + default: + DLOG (compat_log, LLOG_DEBUG, ("invalid reverse_charge: %d", + f.reverse_charge)); + break; + } + + switch (f.recvpktsize) { + case 0: + DLOG (compat_log, LLOG_DEBUG, ("default recv packet size")); + break; + + case 16: + case 32: + case 64: + case 128: + case 256: + case 512: + case 1024: + DLOG (compat_log, LLOG_DEBUG, ("recv packet size %d", + f.recvpktsize)); + break; + + default: + DLOG (compat_log, LLOG_DEBUG, ("invalid recv packet size %d", + f.recvpktsize)); + break; + } + + switch (f.sendpktsize) { + case 0: + DLOG (compat_log, LLOG_DEBUG, ("default send packet size")); + break; + + case 16: + case 32: + case 64: + case 128: + case 256: + case 512: + case 1024: + DLOG (compat_log, LLOG_DEBUG, ("send packet size %d", + f.sendpktsize)); + break; + + default: + DLOG (compat_log, LLOG_DEBUG, ("invalid send packet size %d", + f.sendpktsize)); + break; + } + + DLOG (compat_log, LLOG_DEBUG, + (f.recvwndsize == 0 ? "default recv window size" + : 1 <= f.recvwndsize && f.recvwndsize <= 127 + ? "recv window size %d" + : "invalid recv window size %d", + f.recvwndsize)); + + DLOG (compat_log, LLOG_DEBUG, + (f.sendwndsize == 0 ? "default send window size" + : 1 <= f.sendwndsize && f.sendwndsize <= 127 + ? "send window size %d" + : "invalid send window size %d", + f.sendwndsize)); + + switch (f.recvthruput) { + case 0: + DLOG (compat_log, LLOG_DEBUG, ("default recv throughput")); + break; + + case 3: + baud = 75; +print_recv: ; + DLOG (compat_log, LLOG_DEBUG, ("recv throughput %dbps", baud)); + break; + + case 4: + baud = 150; + goto print_recv; + + case 5: + baud = 300; + goto print_recv; + + case 6: + baud = 600; + goto print_recv; + + case 7: + baud = 1200; + goto print_recv; + + case 8: + baud = 2400; + goto print_recv; + + case 9: + baud = 4800; + goto print_recv; + + case 10: + baud = 9600; + goto print_recv; + + case 11: + baud = 19200; + goto print_recv; + + case 12: + baud = 48000; + goto print_recv; + + default: + DLOG (compat_log, LLOG_DEBUG, ("invalid recv throughput %d", + f.recvthruput)); + break; + } + + switch (f.sendthruput) { + case 0: + DLOG (compat_log, LLOG_DEBUG, ("default send throughput")); + break; + + case 3: + baud = 75; +print_send: ; + DLOG (compat_log, LLOG_DEBUG, ("send throughput %dbps", baud)); + break; + + case 4: + baud = 150; + goto print_send; + + case 5: + baud = 300; + goto print_send; + + case 6: + baud = 600; + goto print_send; + + case 7: + baud = 1200; + goto print_send; + + case 8: + baud = 2400; + goto print_send; + + case 9: + baud = 4800; + goto print_send; + + case 10: + baud = 9600; + goto print_send; + + case 11: + baud = 19200; + goto print_send; + + case 12: + baud = 48000; + goto print_send; + + default: + DLOG (compat_log, LLOG_DEBUG, ("invalid send throughput %d", + f.sendthruput)); + break; + } + + switch (f.cug_req) { + case 0: + DLOG (compat_log, LLOG_DEBUG, ("no closed user group")); + break; + + case 1: + DLOG (compat_log, LLOG_DEBUG, ("closed user group 0x%x (BCD)", + f.cug_req)); + break; + + default: + DLOG (compat_log, LLOG_DEBUG, ("invalid closed user group %d", + f.cug_req)); + break; + } + + switch (f.fast_select_type) { + case FAST_OFF: + DLOG (compat_log, LLOG_DEBUG, ("don't use fast select")); + break; + + case FAST_CLR_ONLY: + DLOG (compat_log, LLOG_DEBUG, ("clear is fast select response")); + break; + + case FAST_ACPT_CLR: + DLOG (compat_log, LLOG_DEBUG, + ("clear or call accepted is fast select response")); + break; + + default: + DLOG (compat_log, LLOG_DEBUG, ("invalid fast select type %d", + f.fast_select_type)); + break; + } + + switch (f.rpoa_req) { + case 0: + DLOG (compat_log, LLOG_DEBUG, ("no RPOA transit request")); + break; + + case 1: + DLOG (compat_log, LLOG_DEBUG, ("RPOA transit request 0x%x", + f.rpoa_req)); + break; + + default: + DLOG (compat_log, LLOG_DEBUG, ("invalid RPOA transit request %d", + f.rpoa_req)); + } +} +#endif +#endif +#else +int _sunlink_stub () {}; +#endif diff --git a/usr/src/contrib/isode/compat/taddr2str.c b/usr/src/contrib/isode/compat/taddr2str.c new file mode 100644 index 0000000000..40974e0559 --- /dev/null +++ b/usr/src/contrib/isode/compat/taddr2str.c @@ -0,0 +1,50 @@ +/* taddr2str.c - TSAPaddr to string value */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/taddr2str.c,v 7.1 91/02/22 09:16:08 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/taddr2str.c,v 7.1 91/02/22 09:16:08 mrose Interim $ + * + * + * $Log: taddr2str.c,v $ + * Revision 7.1 91/02/22 09:16:08 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:23:44 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" + +/* */ + +char *taddr2str (ta) +register struct TSAPaddr *ta; +{ + struct PSAPaddr pas; + register struct PSAPaddr *pa = &pas; + + bzero ((char *) pa, sizeof *pa); + pa -> pa_addr.sa_addr = *ta; /* struct copy */ + + return paddr2str (pa, NULLNA); +} diff --git a/usr/src/contrib/isode/compat/tailor.c b/usr/src/contrib/isode/compat/tailor.c new file mode 100644 index 0000000000..0944d98f37 --- /dev/null +++ b/usr/src/contrib/isode/compat/tailor.c @@ -0,0 +1,961 @@ +/* tailor.c - ISODE tailoring */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/tailor.c,v 7.9 91/02/22 09:16:09 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/tailor.c,v 7.9 91/02/22 09:16:09 mrose Interim $ + * + * + * $Log: tailor.c,v $ + * Revision 7.9 91/02/22 09:16:09 mrose + * Interim 6.8 + * + * Revision 7.8 90/11/21 11:35:35 mrose + * update + * + * Revision 7.7 90/10/15 18:19:40 mrose + * sync + * + * Revision 7.6 90/07/09 14:32:25 mrose + * sync + * + * Revision 7.5 90/03/08 08:01:12 mrose + * ending + * + * Revision 7.4 90/02/19 13:07:20 mrose + * update + * + * Revision 7.3 90/01/11 18:35:16 mrose + * real-sync + * + * Revision 7.2 89/12/12 16:14:57 mrose + * localHost + * + * Revision 7.1 89/11/30 23:53:32 mrose + * touch-up + * + * Revision 7.0 89/11/23 21:23:45 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "isoaddrs.h" +#include "tailor.h" + + +#define SUBNET_MAX (6 + 10) /* maximum number of subnet entries */ + +/* DATA */ + +struct pair { + char *p_name; + int p_value; +}; + + +static char *isotailor = "isotailor"; + + +char *isodename = ""; + +char *isodebinpath = BINPATH; +char *isodesbinpath = SBINPATH; +char *isodetcpath = ETCPATH; +char *isodelogpath = LOGPATH; + + +static struct pair ll_pairs[] = { + "none", LLOG_NONE, + "fatal", LLOG_FATAL, + "exceptions", LLOG_EXCEPTIONS, + "notice", LLOG_NOTICE, + "pdus", LLOG_PDUS, + "trace", LLOG_TRACE, + "debug", LLOG_DEBUG, + "all", LLOG_ALL, + + NULL +}; + +static char *compatdebug = "none"; +LLog _compat_log = { + "%d.log", NULLCP, "compat", LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *compat_log = &_compat_log; + +static char *addrdebug = "none"; +LLog _addr_log = { + "%d.log", "addr", NULLCP, LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *addr_log = &_addr_log; + +static char *tsapdebug = "none"; +LLog _tsap_log = { + "%d.tpkt", "tsap", NULLCP, LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *tsap_log = &_tsap_log; + +static char *ssapdebug = "none"; +LLog _ssap_log = { + "%d.spkt", "ssap", NULLCP, LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *ssap_log = &_ssap_log; + +static char *psapdebug = "none"; +LLog _psap_log = { + "%d.pe", NULLCP, "psap", LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *psap_log = &_psap_log; + +static char *psap2debug = "none"; +LLog _psap2_log = { + "%d.ppkt", "psap2", NULLCP, LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *psap2_log = &_psap2_log; + +static char *acsapdebug = "none"; +LLog _acsap_log = { + "%d.acpkt", "acsap", NULLCP, LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *acsap_log = &_acsap_log; + +static char *rtsapdebug = "none"; +LLog _rtsap_log = { + "%d.rtpkt", "rtsap", NULLCP, LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *rtsap_log = &_rtsap_log; + +static char *rosapdebug = "none"; +LLog _rosap_log = { + "%d.ropkt", "rosap", NULLCP, LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *rosap_log = &_rosap_log; + + +#define TS_MASK "\020\01TCP\02X25\03BRG\04TP4" + +static struct pair ts_pairs[] = { + "tcp", TS_TCP, + "x25", TS_X25, + "bridge", TS_BRG, + "tp4", TS_TP4, + "all", TS_ALL, + + NULL +}; + +static char *_ts_stacks = "all"; +int ts_stacks = TS_ALL; + +static char *_ts_interim = ""; +struct ts_interim ts_interim[SUBNET_MAX + 1] = { + "realNS", NULL, SUBNET_REALNS, NA_NSAP, "", 0, + "Int-X25", NULL, SUBNET_INT_X25, NA_X25, "", 0, + "Internet", NULL, SUBNET_INTERNET, NA_TCP, "", 0, + "Janet", NULL, SUBNET_DYNAMIC - 1, NA_X25, "", 0, + "localTCP", NULL, SUBNET_DYNAMIC - 2, NA_TCP, "", 0, + "IXI", NULL, SUBNET_DYNAMIC - 3, NA_X25, "", 0, + + NULL +}; + +static char *_ts_communities = "all"; +int ts_communities[SUBNET_MAX + 1]; + +static char *_ts_comm_nsap_default = "realNS"; +int ts_comm_nsap_default = SUBNET_REALNS; + +static char *_ts_comm_x25_default = "Int-X25"; +int ts_comm_x25_default = SUBNET_INT_X25; + +static char *_ts_comm_tcp_default = "Internet"; +int ts_comm_tcp_default = SUBNET_INTERNET; + +int tsb_communities[SUBNET_MAX + 1]; +char *tsb_addresses[SUBNET_MAX + 1]; +static char *_tsb_config = ""; +char *tsb_default_address = "undefined"; + + +#ifdef X25 +char *x25_local_dte = ""; +char *x25_local_pid = ""; + +static char *x25_intl_zero_str = "off"; +char x25_intl_zero = 0; + +static char *x25_strip_dnic_str = "off"; +char x25_strip_dnic = 0; + +char *x25_dnic_prefix = ""; + + /* 0 = don't request/allow reverse charging + * 1 = reverse charge request/allowed + */ +static char *reverse_charge_default = "0"; +u_char reverse_charge = 0; + + /* 0= default recv packet size. + * 16, 32, 64, 128, + * 256, 512, 1024 + * ( octets in decimal ) + */ +static char *recvpktsize_default = "0"; +u_short recvpktsize = 0; + + /* same as above, but for send packet size */ +static char *sendpktsize_default = "0"; +u_short sendpktsize = 0; + + /* 0= default recv window size. + * 7, 127 ( in decimal ) + */ +static char *recvwndsize_default = "0"; +u_char recvwndsize = 0; + + /* same as above, but for send window size */ +static char *sendwndsize_default = "0"; +u_char sendwndsize = 0; + + /* 0= default recv throughtput. + * 3= 75 8= 2400 + * 4= 150 9= 4800 + * 5= 300 10= 9600 + * 6= 600 11= 19200 + * 7= 1200 12= 48000 + * ( bps in decimal ) + */ +static char *recvthruput_default = "0"; +u_char recvthruput = 0; + + /* same as above, but for send throughput */ + /* 1 = use closed user group in cug_index */ +static char *sendthruput_default = "0"; +u_char sendthruput = 0; + + /* 0 = no closed user group. */ + /* 1 = use closed user group in cug_index */ +static char *cug_req_default = "0"; +u_char cug_req = 0; + + /* valid when cug_req= 1. + * 0x00 ~ 0x99 ( closed user group in BCD) + */ +static char *cug_index_default = "0"; +u_char cug_index = 0; + + /* 0= don't use fast select + * 1= clear is fast select response + * 2= clear or call accepted + * is fast select response + */ +static char *fast_select_type_default = "0"; +u_char fast_select_type = 0; + + /* 0= no RPOA transit request + * 1= use RPOA transit request in rpoa + */ +static char *rpoa_req_default = "0"; +u_char rpoa_req = 0; + + /* valid when rpoa_req= 1 */ + /* 0x0000 ~ 0x9999 (RPOA transit group in BCD) */ +static char *rpoa_default = "0"; +u_short rpoa = 0; + +static char *x25debug = "none"; +static LLog _x25_log = { + "x25log", "x25", NULLCP, LLOG_NONE, LLOG_NONE, -1, + LLOGCLS | LLOGCRT | LLOGZER, NOTOK +}; +LLog *x25_log = &_x25_log; + +#ifdef CAMTEC_CCL +static char *x25_outgoing_port_str = "A"; +char x25_outgoing_port = 'A'; +#endif +#endif + + +#ifdef BRIDGE_X25 +char *x25_bridge_host = "x25bridge"; +char *x25_bridge_addr = "000021000018"; +char *x25_bridge_listen = ""; +char *x25_bridge_pid = ""; +char *x25_bridge_discrim = "0000"; +#endif + + +#if defined (BRIDGE_X25) || defined (X25) +static char *x25_bridge_port_default = "146"; +u_short x25_bridge_port = 0; +#endif + + +static char *_ses_ab_timer = "30"; /* drain for 30 seconds on ABORTs */ +int ses_ab_timer = 30; + +static char *_ses_dn_timer = "30"; /* drain for 30 seconds on DISCONNECTs */ +int ses_dn_timer = 30; + +static char *_ses_rf_timer = "30"; /* drain for 30 seconds on REFUSEs */ +int ses_rf_timer = 30; + + +char ns_enabled = 0; +static char *usens = "off"; + +char *ns_address = "undefined"; + +/* */ + +static struct bind { + char *b_key; + + char **b_value; + int b_dynamic; +} binds[] = { + "localname", &isodename, 0, + "binpath", &isodebinpath, 0, + "sbinpath", &isodesbinpath, 0, + "etcpath", &isodetcpath, 0, + "logpath", &isodelogpath, 0, + + "compatlevel", &compatdebug, 0, + "compatfile", &_compat_log.ll_file, 0, + + "addrlevel", &addrdebug, 0, + "addrfile", &_addr_log.ll_file, 0, + + "tsaplevel", &tsapdebug, 0, + "tsapfile", &_tsap_log.ll_file, 0, + + "ssaplevel", &ssapdebug, 0, + "ssapfile", &_ssap_log.ll_file, 0, + + "psaplevel", &psapdebug, 0, + "psapfile", &_psap_log.ll_file, 0, + + "psap2level", &psap2debug, 0, + "psap2file", &_psap2_log.ll_file, 0, + + "acsaplevel", &acsapdebug, 0, + "acsapfile", &_acsap_log.ll_file, 0, + + "rtsaplevel", &rtsapdebug, 0, + "rtsapfile", &_rtsap_log.ll_file, 0, + + "rosaplevel", &rosapdebug, 0, + "rosapfile", &_rosap_log.ll_file, 0, + + "ts_stacks", &_ts_stacks, 0, + "ts_interim", &_ts_interim, 0, + "ts_communities", &_ts_communities, 0, + + "default_nsap_community", &_ts_comm_nsap_default, 0, + "default_x25_community", &_ts_comm_x25_default, 0, + "default_tcp_community", &_ts_comm_tcp_default, 0, + + "tsb_communities", &_tsb_config, 0, + "tsb_default_address", &tsb_default_address, 0, + +#ifdef X25 + "x25_local_dte", &x25_local_dte, 0, + "x25_local_pid", &x25_local_pid, 0, + "x25_dnic_prefix", &x25_dnic_prefix, 0, + "x25_intl_zero", &x25_intl_zero_str, 0, + "x25_strip_dnic", &x25_strip_dnic_str, 0, + + "reverse_charge", &reverse_charge_default, 0, + "recvpktsize", &recvpktsize_default, 0, + "sendpktsize", &sendpktsize_default, 0, + "recvwndsize", &recvwndsize_default, 0, + "sendwndsize", &sendwndsize_default, 0, + "recvthruput", &recvthruput_default, 0, + "sendthruput", &sendthruput_default, 0, + "cug_req", &cug_req_default, 0, + "cug_index", &cug_index_default, 0, + "fast_select_type", &fast_select_type_default, 0, + "rpoa_req", &rpoa_req_default, 0, + "rpoa", &rpoa_default, 0, + + "x25level", &x25debug, 0, + "x25file", &_x25_log.ll_file, 0, + +#ifdef CAMTEC_CCL + "x25_outgoing_port", &x25_outgoing_port_str, 0, +#endif +#endif + +#ifdef BRIDGE_X25 + "x25_bridge_host", &x25_bridge_host, 0, + "x25_bridge_addr", &x25_bridge_addr, 0, + "x25_bridge_listen", &x25_bridge_listen, 0, + "x25_bridge_pid", &x25_bridge_pid, 0, + "x25_bridge_discrim", &x25_bridge_discrim, 0, +#endif + +#if defined (BRIDGE_X25) || defined (X25) + "x25_bridge_port", &x25_bridge_port_default,0, +#endif + + + "ses_abort_timer", &_ses_ab_timer, 0, + "ses_disconnect_timer", &_ses_dn_timer, 0, + "ses_refuse_timer", &_ses_rf_timer, 0, + + "ns_enable", &usens, 0, + "ns_address", &ns_address, 0, + + NULL +}; + + +int tailor_read (); +char *tailor_value (); + +/* */ + +char *isodesetailor (file) +char *file; +{ + char *ofile = isotailor; + + if ((isotailor = file) == NULLCP) + isotailor = "isotailor"; + + return ofile; +} + +/* */ + +void isodetailor (myname, wantuser) +char *myname; +int wantuser; +{ + register char *hp, + *mp; + char buffer[BUFSIZ]; + static int inited = 0; + + if (inited) + return; + inited = 1; + + tsb_addresses[0] = NULL; + + tailor_read (isodefile (isotailor, 0)); + + if (wantuser) { + if ((hp = getenv ("HOME")) == NULL) + hp = "."; + if (myname) { + if (mp = rindex (myname, '/')) + mp++; + if (mp == NULL || *mp == NULL) + mp = myname; + } + else + mp = "isode"; + (void) sprintf (buffer, "%s/.%s_tailor", hp, mp); + tailor_read (buffer); + } + + isodexport (myname); +} + +/* */ + +static int tailor_read (file) +char *file; +{ + register char *bp, + *cp; + char buffer[BUFSIZ]; + register FILE *fp; + + if (fp = fopen (file, "r")) { + while (fgets (buffer, sizeof buffer, fp)) { + if ((cp = index (buffer, '\n')) == NULL) { + fprintf (stderr, "%s: line too long\n", file); + break; + } + *cp = NULL; + if (*buffer == '#' || *buffer == NULL) + continue; + if ((bp = index (buffer, ':')) == NULL) { + fprintf (stderr, "%s: invalid syntax in \"%s\"\n", + file, buffer); + break; + } + for (cp = bp - 1; cp >= buffer; cp--) + if (isspace ((u_char) *cp)) + *cp = NULL; + else + break; + + *bp++ = NULL; + while (isspace ((u_char) *bp)) + *bp++ = NULL; + + for (cp = bp + strlen (bp) - 1; cp >= bp; cp--) + if (isspace ((u_char) *cp)) + *cp = NULL; + else + break; + + if ((cp = tailor_value (bp)) + && isodesetvar (buffer, cp, 1) == NOTOK) + free (cp); + } + + (void) fclose (fp); + } +} + +/* */ + +int isodesetvar (name, value, dynamic) +char *name, + *value; +int dynamic; +{ + register struct bind *b; + + for (b = binds; b -> b_key; b++) + if (strcmp (b -> b_key, name) == 0) { + if (b -> b_dynamic && *b -> b_value) + free (*b -> b_value); + *b -> b_value = value, b -> b_dynamic = dynamic; + return OK; + } + + return NOTOK; +} + +/* */ + +void isodexport (myname) +char *myname; +{ + compat_log -> ll_events = events_value (ll_pairs, compatdebug, "compatlevel"); + addr_log -> ll_events = events_value (ll_pairs, addrdebug, "addrlevel"); + tsap_log -> ll_events = events_value (ll_pairs, tsapdebug, "tsaplevel"); + ssap_log -> ll_events = events_value (ll_pairs, ssapdebug, "ssaplevel"); + psap_log -> ll_events = events_value (ll_pairs, psapdebug, "psaplevel"); + psap2_log -> ll_events = events_value (ll_pairs, psap2debug, "psap2level"); + acsap_log -> ll_events = events_value (ll_pairs, acsapdebug, "acsaplevel"); + rtsap_log -> ll_events = events_value (ll_pairs, rtsapdebug, "rtsaplevel"); + rosap_log -> ll_events = events_value (ll_pairs, rosapdebug, "rosaplevel"); +#ifdef X25 + x25_log -> ll_events = events_value (ll_pairs, x25debug, "x25level"); +#endif + + ll_hdinit (compat_log, myname); + ll_hdinit (addr_log, myname); + ll_hdinit (tsap_log, myname); + ll_hdinit (ssap_log, myname); + ll_hdinit (psap_log, myname); + ll_hdinit (psap2_log, myname); + ll_hdinit (acsap_log, myname); + ll_hdinit (rtsap_log, myname); + ll_hdinit (rosap_log, myname); +#ifdef X25 + ll_hdinit (x25_log, myname); +#endif + + ts_stacks = events_value (ts_pairs, _ts_stacks, "ts_stacks"); +#ifndef TCP + ts_stacks &= ~TS_TCP; +#endif +#ifndef X25 + ts_stacks &= ~TS_X25; +#endif +#ifndef BRIDGE_X25 + ts_stacks &= ~TS_BRG; +#endif +#ifndef TP4 + ts_stacks &= ~TS_TP4; +#endif + + { + register int *ip, + *jp, + *kp; + int j; + register char *cp, + *adrp, + **ap, + **cpp; + register struct ts_interim *ts; + static struct ts_interim *te = NULL; + char buffer[BUFSIZ], + *vec[NVEC + NSLACK + 1]; + + if (te) + te -> ts_name = NULL; + for (ts = ts_interim; ts -> ts_name; ts++) + if (macro2comm (ts -> ts_name, ts) == NOTOK) + fprintf (stderr, "internal error for community \"%s\"\n", + ts -> ts_name); + if (te == NULL) + te = ts; + + (void) strcpy (buffer, _ts_interim); + (void) str2vec (buffer, ap = vec); + j = SUBNET_DYNAMIC; + while (cp = *ap++) { + register struct ts_interim *tp; + + ts -> ts_subnet = 0; + if (macro2comm (cp, ts) == NOTOK) { + fprintf (stderr, "invalid community name \"%s\"\n", cp); + break; + } + for (tp = ts_interim; tp < ts; tp++) + if (tp -> ts_length == ts -> ts_length + && bcmp (tp -> ts_prefix, ts -> ts_prefix, + tp -> ts_length) == 0) { + fprintf (stderr, + "duplicate prefixes for communities \"%s\" and \"%s\"\n", + tp -> ts_name, cp); + break; + } + if (tp < ts) + continue; + + ts -> ts_name = strdup (cp); + if (ts -> ts_subnet == 0) + ts -> ts_subnet = j++; + ts++; + } + ts -> ts_name = NULL; + + (void) strcpy (buffer, _ts_communities); + (void) str2vec (buffer, ap = vec); + ip = ts_communities; + while (cp = *ap++) { + if (strcmp (cp, "all") == 0) { + for (ts = ts_interim; ts -> ts_name; ts++) { + for (jp = ts_communities; jp < ip; jp++) + if (*jp == ts -> ts_subnet) + break; + if (jp >= ip) + *ip++ = ts -> ts_subnet; + } + break; + } + + for (ts = ts_interim; ts -> ts_name; ts++) + if (lexequ (ts -> ts_name, cp) == 0) + break; + if (!ts -> ts_name) { + fprintf (stderr, + "unknown community name \"%s\" for variable ts_communities\n", + cp); + continue; + } + + for (jp = ts_communities; jp < ip; jp++) + if (*jp == ts -> ts_subnet) + break; + if (jp >= ip) + *ip++ = ts -> ts_subnet; + } + *ip = NULL; + + for (ap = tsb_addresses; *ap; ap++) + free (*ap); + (void) strcpy (buffer, _tsb_config); + (void) str2vec (buffer, ap = vec); + ip = tsb_communities, cpp = tsb_addresses; + while (cp = *ap++) { + if ((adrp = *ap++) == NULLCP) { + fprintf (stderr, + "missing address for tsb_community \"%s\"\n", cp); + break; + } + + for (ts = ts_interim; ts -> ts_name; ts++) + if (lexequ (ts -> ts_name, cp) == 0) + break; + if (!ts -> ts_name) { + fprintf (stderr, + "unknown community name \"%s\" for variable tsb_communities\n", + cp); + continue; + } + + for (jp = tsb_communities; jp < ip; jp++) + if (*jp == ts -> ts_subnet) + break; + if (jp >= ip) { + *ip++ = ts -> ts_subnet, *cpp++ = strdup (adrp); + + for (kp = ts_communities; *kp; kp++) + if (*kp == ts -> ts_subnet) + break; + if (!*kp) + *kp++ = ts -> ts_subnet, *kp = NULL; + } + } + *ip = NULL, *cpp = NULLCP; + + cp = _ts_comm_nsap_default; + for (ts = ts_interim; ts -> ts_name; ts++) + if (lexequ (ts -> ts_name, cp) == 0) + break; + if (ts -> ts_name && ts -> ts_syntax == NA_NSAP) + ts_comm_nsap_default = ts -> ts_subnet; + else + fprintf (stderr, + "bad community name \"%s\" for variable default_nsap_community\n", + cp); + + cp = _ts_comm_x25_default; + for (ts = ts_interim; ts -> ts_name; ts++) + if (lexequ (ts -> ts_name, cp) == 0) + break; + if (ts -> ts_name && ts -> ts_syntax == NA_X25) + ts_comm_x25_default = ts -> ts_subnet; + else + fprintf (stderr, + "bad community name \"%s\" for variable default_x25_community\n", + cp); + + cp = _ts_comm_tcp_default; + for (ts = ts_interim; ts -> ts_name; ts++) + if (lexequ (ts -> ts_name, cp) == 0) + break; + if (ts -> ts_name && ts -> ts_syntax == NA_TCP) + ts_comm_tcp_default = ts -> ts_subnet; + else + fprintf (stderr, + "bad community name \"%s\" for variable default_tcp_community\n", + cp); + + if (addr_log -> ll_events & LLOG_DEBUG) { + LLOG (addr_log, LLOG_DEBUG, + ("ts_stacks: %s", sprintb (ts_stacks, TS_MASK))); + + for (ts = ts_interim; ts -> ts_name; ts++) { + LLOG (addr_log, LLOG_DEBUG, + ("community %s value \"%s\" subnet %d syntax %d", + ts -> ts_name, ts -> ts_value ? ts -> ts_value : "", + ts -> ts_subnet, ts -> ts_syntax)); + buffer[explode(buffer, (u_char *) ts -> ts_prefix, + ts -> ts_length)] = NULL; + LLOG (addr_log, LLOG_DEBUG, + (" prefix \"%s\" (%d octets)", buffer, + ts -> ts_length)); + } + + for (ip = ts_communities; *ip; ip++) + LLOG (addr_log, LLOG_DEBUG, ("community %d enabled", *ip)); + + LLOG (addr_log, LLOG_DEBUG, + ("default communities: nsap=%d x25=%d tcp=%d", + ts_comm_nsap_default, ts_comm_x25_default, + ts_comm_tcp_default)); + + for (ip = tsb_communities, cpp = tsb_addresses; *ip; ip++, cpp++) { + LLOG (addr_log, LLOG_DEBUG, + ("TSB for community %d residing at %s", *ip, *cpp)); + if (str2taddr (*cpp) == NULLTA) + LLOG (addr_log, LLOG_EXCEPTIONS, + ("invalid address for TSB to community %d: %s", + *ip, *cpp)); + } + } + } + +#ifdef X25 + reverse_charge = (u_char) atoi (reverse_charge_default); + recvpktsize = (u_short) atoi (recvpktsize_default); + sendpktsize = (u_short) atoi (sendpktsize_default); + recvwndsize = (u_char) atoi (recvwndsize_default); + sendwndsize = (u_char) atoi (sendwndsize_default); + recvthruput = (u_char) atoi (recvthruput_default); + sendthruput = (u_char) atoi (sendthruput_default); + cug_req = (u_char) atoi (cug_req_default); + cug_index = (u_char) atoi (cug_index_default); + fast_select_type = (u_char) atoi (fast_select_type_default); + rpoa_req = atoi (rpoa_req_default); + rpoa = (u_short) atoi (rpoa_default); + +#ifdef CAMTEC_CCL + x25_outgoing_port = *x25_outgoing_port_str; +#endif + + x25_intl_zero = !strcmp (x25_intl_zero_str, "on"); + x25_strip_dnic = !strcmp (x25_strip_dnic_str, "on"); +#endif + +#if defined (BRIDGE_X25) || defined (X25) + x25_bridge_port = htons ((u_short) atoi (x25_bridge_port_default)); +#endif + + ns_enabled = !strcmp (usens, "on"); +} + +/* */ + +#define QUOTE '\\' + + +static char *tailor_value (s) +register char *s; +{ + register int i, + r; + register char *bp; + char buffer[BUFSIZ]; + + for (bp = buffer; *s; bp++, s++) + if (*s != QUOTE) + *bp = *s; + else + switch (*++s) { + case '0': + *bp = '\0'; + break; + case 'b': + *bp = '\b'; + break; + case 'f': + *bp = '\f'; + break; + case 'n': + *bp = '\n'; + break; + case 'r': + *bp = '\r'; + break; + case 't': + *bp = '\t'; + break; + + case NULL: s--; + case QUOTE: + *bp = QUOTE; + break; + + default: + if (!isdigit ((u_char) *s)) { + *bp++ = QUOTE; + *bp = *s; + break; + } + r = *s != '0' ? 10 : 8; + for (i = 0; isdigit ((u_char) *s); s++) + i = i * r + *s - '0'; + s--; + *bp = toascii (i); + break; + } + *bp = NULL; + + if ((bp = malloc ((unsigned) (strlen (buffer) + 1))) != NULL) + (void) strcpy (bp, buffer); + + return bp; +} + +/* */ + +static int events_value (pairs, s, var) +struct pair *pairs; +char *s, + *var; +{ + int value; + register char *cp, + **ap; + register struct pair *pp; + char buffer[BUFSIZ], + *vec[NVEC + NSLACK + 1]; + + value = 0; + (void) strcpy (buffer, s); + (void) str2vec (buffer, ap = vec); + while (cp = *ap++) { + for (pp = pairs; pp -> p_name; pp++) + if (strcmp (pp -> p_name, cp) == 0) { + value |= pp -> p_value; + break; + } + if (!pp -> p_name) + fprintf (stderr, "unknown value \"%s\" for variable %s\n", + cp, var); + } + + return value; +} + +/* */ + +#ifdef PEP_TEST +tailorfree () { + register struct bind *b; + + for (b = binds; b -> b_key; b++) + if (b -> b_dynamic && *b -> b_value) { + free (*b -> b_value); + *b -> b_value = NULL; + } + + ll_hdfree (compat_log); + ll_hdfree (addr_log); + ll_hdfree (tsap_log); + ll_hdfree (ssap_log); + ll_hdfree (psap_log); + ll_hdfree (psap2_log); + ll_hdfree (acsap_log); + ll_hdfree (rtsap_log); + ll_hdfree (rosap_log); +#ifdef X25 + ll_hdfree (x25_log); +#endif + + free_macros (); + free_bp (); + free_oid (); +} + + +ll_hdfree (lp) +register LLog *lp; +{ + if (lp -> ll_stat & LLOGHDR) + free (lp -> ll_hdr); + lp -> ll_stat &= ~LLOGHDR; +} +#endif diff --git a/usr/src/contrib/isode/compat/ubcx25.c b/usr/src/contrib/isode/compat/ubcx25.c new file mode 100644 index 0000000000..6f8b4e5e45 --- /dev/null +++ b/usr/src/contrib/isode/compat/ubcx25.c @@ -0,0 +1,322 @@ +/* ubcx25.c - X.25 abstractions for UBC X25 */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/ubcx25.c,v 7.4 91/02/22 09:16:13 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/ubcx25.c,v 7.4 91/02/22 09:16:13 mrose Interim $ + * + * Contributed by Julian Onions, Nottingham University in the UK + * + * + * $Log: ubcx25.c,v $ + * Revision 7.4 91/02/22 09:16:13 mrose + * Interim 6.8 + * + * Revision 7.3 91/01/14 13:33:53 mrose + * loader + * + * Revision 7.2 90/07/09 14:32:28 mrose + * sync + * + * Revision 7.1 89/12/07 01:08:02 mrose + * queued writes + * + * Revision 7.0 89/11/23 21:23:47 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +#include +#include +#include "general.h" +#include "manifest.h" +#include "tailor.h" +#include "tpkt.h" + +/* 4.[23] UNIX: UBC X25 */ + +#ifdef X25 +#ifdef UBC_X25 + +#include "x25.h" +#include + +#define X25_MBIT 0x40 +#define X25_QBIT 0x80 + +/* */ + +int start_x25_client (local) +struct NSAPaddr *local; +{ + int sd, pgrp; + + if (local != NULLNA) + local -> na_stack = NA_X25, local -> na_community = ts_comm_x25_default; + if ((sd = socket (AF_CCITT, SOCK_STREAM, 0)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("socket")); + return NOTOK; /* Error can be found in errno */ + } + + pgrp = getpid(); + if (ioctl(sd, SIOCSPGRP, &pgrp)) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("SIOCSPGRP")); + return NOTOK; /* Error can be found in errno */ + } + + return sd; +} + +/* */ + +int start_x25_server (local, backlog, opt1, opt2) +struct NSAPaddr *local; +int backlog, + opt1, + opt2; +{ + int sd, pgrp; +#ifdef notyet +#ifdef BSD43 + int onoff; +#endif +#endif + CONN_DB zsck; + CONN_DB *sck = &zsck; + + if ((sd = socket (AF_CCITT, SOCK_STREAM, 0)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("socket")); + return NOTOK; /* Can't get an X.25 socket */ + } + + pgrp = getpid(); + if (ioctl(sd, SIOCSPGRP, &pgrp)) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("SIOCSPGRP")); + return NOTOK; /* Error can be found in errno */ + } + + if (local != NULLNA) { + local -> na_stack = NA_X25, local -> na_community = ts_comm_x25_default; + if (local -> na_dtelen == 0) { + (void) strcpy (local -> na_dte, x25_local_dte); + local -> na_dtelen = strlen(x25_local_dte); + if (local -> na_pidlen == 0 && *x25_local_pid) + local -> na_pidlen = + str2sel (x25_local_pid, -1, local -> na_pid, NPSIZE); + } + } + + (void) gen2if (local, sck, ADDR_LISTEN); + if (bind (sd, sck, sizeof(CONN_DB)) == NOTOK) { + SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("bind")); + (void) close_x25_socket (sd); + return NOTOK; + } + + +#ifdef notyet /* not sure if these are supported... */ +#ifndef BSD43 + if (opt1) + (void) setsockopt (sd, SOL_SOCKET, opt1, NULLCP, 0); + if (opt2) + (void) setsockopt (sd, SOL_SOCKET, opt2, NULLCP, 0); +#else + onoff = 1; + if (opt1) + (void) setsockopt (sd, SOL_SOCKET, opt1, (char *)&onoff, sizeof onoff); + if (opt2) + (void) setsockopt (sd, SOL_SOCKET, opt2, (char *)&onoff, sizeof onoff); +#endif +#endif + + (void) listen (sd, backlog); + + return sd; +} + +/* */ + +int join_x25_client (fd, remote) +int fd; +struct NSAPaddr *remote; +{ + CONN_DB sck; + int len = sizeof sck; + int nfd; + + if((nfd = accept (fd, (struct sockaddr *) &sck, &len)) == NOTOK) + return NOTOK; + (void) if2gen (remote, &sck, ADDR_REMOTE); + return nfd; +} + +int join_x25_server (fd, remote) +int fd; +struct NSAPaddr *remote; +{ + CONN_DB zsck; + CONN_DB *sck = &zsck; + + if (remote == NULLNA || remote -> na_stack != NA_X25) + { + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("Invalid type na%d", remote->na_stack)); + return NOTOK; + } + (void) gen2if (remote, sck, ADDR_REMOTE); + return connect (fd, sck, sizeof (CONN_DB)); +} + +int read_x25_socket (fd, buffer, len) +int fd, len; +char *buffer; +{ + static u_char mode; + static struct iovec iov[2] = { + (char *)&mode, 1, + "", 0 + }; + char *p = buffer; + int cc, count = 0, total = len; + + do { + iov[1].iov_base = p; + iov[1].iov_len = total > X25_PACKETSIZE ? X25_PACKETSIZE : total; + + switch (cc = readv (fd, iov, 2)) { + /* + * for the -1,0 & 1 cases these returns should be ok + * if it's the first time through, then they are valid anyway + * later stages means the M bit is set so there must + * be more data else someone is violating the + * protocol badly. + */ + + case NOTOK: + case 0: + return cc; + + case 1: + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("strange return from read_x25_socket")); + return NOTOK; + + default: + cc --; /* discount the info byte */ + count += cc; + p += cc; + total -= cc; + } + } while (len > 0 && (mode & X25_MBIT)); + DLOG (compat_log, LLOG_DEBUG, ("X25 read, total %d/%d", count, len)); + + return count; +} + +#ifdef UBC_X25_WRITEV +/* God this all very bizarre - iovecs work on read but not write!! */ + +/* + * OK, this is due to a bug in UBC implementation. It may or may not + * be fixed in later versions. If writev allows you to write single + * bytes in the first vector then use this version. It's much more + * efficient. + */ + +int write_x25_socket (fd, buffer, len) +int fd, len; +char *buffer; +{ + static u_char mode; + static struct iovec iov[2] = { + (char *)&mode, 1, + "", 0 + }; + int cc; + char *p = buffer; + int count, total = 0; + + do { + count = len > X25_PACKETSIZE ? X25_PACKETSIZE : len; + mode = len > X25_PACKETSIZE ? X25_MBIT : 0; + iov[1].iov_base = p; + iov[1].iov_len = count; + switch (cc = writev (fd, iov, 2)) + { + case NOTOK: + case 0: + return cc; + + case 1: + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("strange return from write_x25_socket")); + return NOTOK; + + default: + cc --; + len -= cc; + p += cc; + total += cc; + } + } while (len > 0); + DLOG (compat_log, LLOG_DEBUG, ("X25 write, total %d/%d", total, len)); + return total; +} +#else +int write_x25_socket (fd, buffer, len) +int fd, len; +char *buffer; +{ + char mybuffer[X25_PACKETSIZE+1]; + char *p = buffer; + int count, total = 0; + int cc; + + do { + count = len > X25_PACKETSIZE ? X25_PACKETSIZE : len; + mybuffer[0] = len > X25_PACKETSIZE ? X25_MBIT : 0; + bcopy (p, &mybuffer[1], count); + switch (cc = write (fd, mybuffer, count + 1)) + { + case NOTOK: + case 0: + return cc; + + case 1: + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("strange return from write_x25_socket")); + return NOTOK; + + default: + cc --; + len -= cc; + p += cc; + total += cc; + } + } while (len > 0); + DLOG (compat_log, LLOG_DEBUG, ("X25 write, total %d/%d", total, len)); + return total; +} +#endif + +#else /* UBC_X25 */ +int _ubcx25_stub2 () {}; +#endif /* UBC_X25 */ +#else /* X25 */ +int _ubcx25_stub () {}; +#endif /* X25 */ diff --git a/usr/src/contrib/isode/compat/x25addr.c b/usr/src/contrib/isode/compat/x25addr.c new file mode 100644 index 0000000000..7784daecf6 --- /dev/null +++ b/usr/src/contrib/isode/compat/x25addr.c @@ -0,0 +1,1171 @@ +/* x25addr.c - X.25 level generic <-> interface address munging */ + +#ifndef lint +static char *rcsid = "$Header: /f/osi/compat/RCS/x25addr.c,v 7.6 91/02/22 09:16:14 mrose Interim $"; +#endif + +/* + * $Header: /f/osi/compat/RCS/x25addr.c,v 7.6 91/02/22 09:16:14 mrose Interim $ + * + * Contributed by George Michaelson, Julian Onions, and John Pavel + * + * + * $Log: x25addr.c,v $ + * Revision 7.6 91/02/22 09:16:14 mrose + * Interim 6.8 + * + * Revision 7.5 91/01/14 13:33:56 mrose + * loader + * + * Revision 7.4 91/01/07 12:40:04 mrose + * update + * + * Revision 7.3 90/07/09 14:32:30 mrose + * sync + * + * Revision 7.2 89/12/11 16:21:42 mrose + * comments + * + * Revision 7.1 89/12/11 01:36:14 mrose + * SUN_X25_HACK + * + * Revision 7.0 89/11/23 21:23:49 mrose + * Release 6.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. + * + */ + + +/* LINTLIBRARY */ + +/* + * for *really* generic address translation + */ + +#include +#include +#include "general.h" +#include "manifest.h" + +#ifdef X25 +#include "tailor.h" +#include "tpkt.h" +#include +#include "x25.h" + +#ifndef DEBUG +#define DEBUG +#endif + +/* */ + +/* + * convert from the generic X25 structure to interface specific + */ +/* ARGSUSED */ +CONN_DB *gen2if (generic, specific, context) +struct NSAPaddr *generic; +CONN_DB *specific; +int context; +{ + int dtelen; + char dte[NSAP_DTELEN + 1]; +#ifdef CAMTEC_CCL + struct iovec *iov; +#endif + + if (generic == NULLNA + || specific == (CONN_DB *) 0 + || generic -> na_stack != NA_X25) + return (CONN_DB *)0; + + if (x25_dnic_prefix && *x25_dnic_prefix) { + /* need DNIC on local calls? */ + register int i; + + if ( strncmp(generic -> na_dte, x25_dnic_prefix, + i = strlen(x25_dnic_prefix)) == 0 ) + { + if (x25_strip_dnic) bcopy(generic -> na_dte + i, dte, dtelen = + generic -> na_dtelen - i); + else bcopy (generic -> na_dte, dte, dtelen = generic -> na_dtelen); + } + else + if (x25_intl_zero) + { + bcopy(generic -> na_dte, dte + 1, dtelen = generic-> na_dtelen); + *dte = '0', dtelen++; + } + else bcopy(generic -> na_dte, dte, dtelen = generic -> na_dtelen); + + } + else bcopy (generic -> na_dte, dte, dtelen = generic -> na_dtelen); + dte[dtelen] = NULL; + +#ifdef SUN_X25_HACK + /* + * If your X.25 provider expects to receive the subaddress alone + * on listen requests, and you are using SunLink X.25, you may need + * to enable SUN_X25_HACK in your config file. This will allow you + * to use x25_local_dte in isotailor to specify a dte mask to be + * stripped when listening, and thus use full DTE strings in + * isoentities and QUIPU EDB files. You will also have to use the + * tsapd -a option to specify the listen address in + * /etc/rc.local and other tsapd startups since by default this equals + * x25_local_dte and thus will be masked to unless overridden + * with full DTE + subaddress. + */ + + /* + * in ADDR_LISTEN context, it may be neccessary to only listen + * on the sub-address, because certain PTT-provided networks + * remove the local DTE from incoming CR packets. + * + * SunLink X.25 listen asserts whatever DTE it is given as a simple + * string-compare, and will never receive inbound calls that bear + * only the sub-address if you assert the full DTE. + * + * this behaviour is orthogonal to any requirements to remove DNIC + * or add a leading 0 on outbound calls, and so needs a separate + * test. It uses tailor variable x25_local_dte to assert the local + * DTE *without* subaddress which should be tested for and stripped + * when detected. + */ + + if ((context == ADDR_LISTEN) && x25_local_dte && *x25_local_dte) + { + register int i; + + if ( strncmp(generic -> na_dte, x25_local_dte, + i = strlen(x25_local_dte)) == 0 ) + { + bcopy(generic -> na_dte + i, dte, dtelen = + generic -> na_dtelen - i); + dte[dtelen] = NULL; + } + } +#endif + + DLOG (x25_log, LLOG_DEBUG, + ("gen2if %s -> %s, %d octets; PID %s", + generic -> na_dte, dte, dtelen, + sel2str (generic -> na_pid, (int) generic -> na_pidlen,1))); + + +#ifndef CAMTEC_CCL + bzero ((char *)specific, sizeof *specific); +#endif + +#ifdef UBC_X25 + if ((specific -> xaddr_len = dtelen) != 0) { + bcopy (dte, specific -> xaddr_addr, + dtelen); + specific -> xaddr_len = dtelen; + specific -> xaddr_facilities = 0; + bcopy (generic -> na_pid, specific -> xaddr_proto, + generic -> na_pidlen); + bcopy (generic -> na_cudf, specific -> xaddr_userdata, + generic -> na_cudflen); + } +#endif + +#ifdef SUN_X25 + specific -> hostlen = char2bcd (dte, specific -> host); + + /* Zero PID */ + if (generic -> na_pidlen) { /* non-null PID */ + if (generic -> na_pidlen > NPSIZE) { + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("PID too long (%d > %d)", generic -> na_pidlen, NPSIZE)); + return (CONN_DB *)0; + } else { + bzero((char *)specific -> data, NPSIZE); + bcopy (generic -> na_pid, (char *)specific -> data, + generic -> na_pidlen); + bcopy (generic -> na_cudf, (char *) specific -> data + NPSIZE, + generic -> na_cudflen); + specific -> datalen = generic -> na_pidlen + generic -> na_cudflen; + } + } else { /* Null PID (just copy in CUDF, the first four octets of which + will be the PID in any case) */ + bcopy (generic -> na_cudf, (char *)specific -> data, + generic -> na_cudflen); + specific -> datalen = generic -> na_cudflen; + } +#endif + +#ifdef CAMTEC_CCL + switch (context) { + case ADDR_REMOTE: + iov = &(specific -> ccl_iovec[0]); + if (x25_outgoing_port == '#') { + char *a, *b; + int i; + + iov -> iov_len = dtelen + 4; + bzero(iov -> iov_base, iov -> iov_len + 1); + a = iov -> iov_base; + b = dte; + *a++ = '#'; + *a++ = '['; + for (i = 0; i < dtelen; i++) { + if (i == 2) *a++ = ':'; + else if (i == 14) *a++ = ']'; + *a++ = *b++; + } + } + else { + iov -> iov_len = dtelen+1; + bcopy(dte, (iov -> iov_base)+1, dtelen); + *(iov -> iov_base) = x25_outgoing_port; + } + break; + + case ADDR_LOCAL: + iov = &(specific -> ccl_iovec[0]); + strncpy(iov -> iov_base, generic -> na_dte, generic -> na_dtelen); + iov -> iov_base[generic -> na_dtelen] = '\0'; + return (specific); + + case ADDR_LISTEN: + iov = &(specific -> ccl_iovec[0]); + if (generic -> na_pidlen) + { /* listen on a PID */ + register int i; + iov -> iov_base[0] = 'C'; + bcopy(generic -> na_pid, iov -> iov_base + 1, + i = generic -> na_pidlen); + iov -> iov_len = i + 1; + } + else + if (generic -> na_dtelen < 6) + { /* listen on a subaddress */ + register int i; + iov -> iov_base[0] = 'S'; + bcopy(generic -> na_dte, iov -> iov_base + 1, + i = generic -> na_dtelen); + iov -> iov_len = i + 1; + } + else /* full DTE */ + bcopy(dte, iov -> iov_base, + iov -> iov_len = dtelen); + return (specific); + } + /* + * CUDF & PID must be merged. malloc initailly PIDsize space + * and bzero it. this may be UK net specific action which + * ensures we do NOT fall foul of listeners which use pid + * to match as well as "true" cudf & DTE. + */ + + (iov = &(specific -> ccl_iovec[2])) -> iov_len = 0; + if (generic -> na_faclen != 0) + bcopy (generic -> na_fac, iov -> iov_base, + iov -> iov_len = min( generic -> na_faclen, FACSIZE) ); + iov++; + if ( (iov -> iov_len = generic -> na_pidlen) != 0) + bcopy (generic -> na_pid, iov -> iov_base, generic -> na_pidlen); + + /* + * if there is any other user data add that in now... + * actually cudf is a variable length field so this is + * all very suspect. + */ + + if (generic -> na_cudflen != 0) + bcopy(generic -> na_cudf, iov -> iov_base + iov -> iov_len, + generic -> na_cudflen), iov -> iov_len += generic -> na_cudflen; +#endif + + return(specific); +} + +/* */ + +/* + * convert from interface specific format to generic X.25 structure + */ +/* ARGSUSED */ +struct NSAPaddr *if2gen (generic, specific, context) +struct NSAPaddr *generic; +CONN_DB *specific; +int context; +{ + int dtelen; + char dte[NSAP_DTELEN + 1]; +#ifdef CAMTEC_CCL + struct iovec *iov; +#endif + + if (generic == NULLNA || specific == (CONN_DB *) 0) + return NULLNA; + bzero ((char *)generic, sizeof *generic); + bzero (dte, sizeof dte); + dtelen = 0; + + generic -> na_stack = NA_X25; + generic -> na_community = ts_comm_x25_default; + +#ifdef UBC_X25 + if (specific -> xaddr_len != 0) { + bcopy (specific -> xaddr_addr, dte, specific -> xaddr_len); + dtelen = specific -> xaddr_len; + bcopy (specific -> xaddr_proto, generic -> na_pid, + sizeof(specific -> xaddr_proto)); + generic -> na_pidlen = sizeof specific -> xaddr_proto; + bcopy (specific -> xaddr_userdata, generic -> na_cudf, + sizeof(specific -> xaddr_userdata)); + generic -> na_cudflen = sizeof specific -> xaddr_userdata; + } +#endif + +#ifdef SUN_X25 + dtelen = bcd2char (specific -> host, dte, (int) specific -> hostlen); + + if (specific -> datalen > NPSIZE) { /* have some real user data after the PID */ + bcopy((char *)specific -> data, generic -> na_pid, + generic -> na_pidlen = NPSIZE); + bcopy((char *) specific -> data + generic -> na_pidlen, + generic -> na_cudf, + generic -> na_cudflen = specific -> datalen - generic -> na_pidlen); + } + else { /* PID only */ + bcopy((char *)specific -> data, generic -> na_pid, + generic -> na_pidlen = specific -> datalen); + generic -> na_cudflen = 0; + } + +#endif + +#ifdef CAMTEC_CCL + switch (context) { + case ADDR_REMOTE: + + iov = &(specific -> ccl_iovec[1]); + if (iov -> iov_len) { + if (*(iov->iov_base) == '#') { + char *a; + + a = iov -> iov_base; + while (*a && iov -> iov_len) { + if (*a == ']') { + iov -> iov_len--; + a++; + break; + } + iov -> iov_len--; + a++; + } + if (*a == 0 || iov -> iov_len == 0) + dtelen = 0; + else { + dtelen = iov -> iov_len; + bcopy (a, dte, dtelen); + } + } + else { + dtelen = iov -> iov_len - 1; + bcopy ((iov -> iov_base)+1, dte, + dtelen); + } + } + else dtelen = 0; + break; + + case ADDR_LOCAL: + iov = &(specific -> ccl_iovec[0]); + if (iov -> iov_len) { + dtelen = iov -> iov_len -1; + bcopy ((iov -> iov_base)+1, dte, + dtelen); + } + else dtelen = 0; + break; + + case ADDR_LISTEN: + return NULLNA; + } + + if ( (iov = &(specific -> ccl_iovec[2])) -> iov_len ) + bcopy( iov -> iov_base, generic -> na_fac, + generic -> na_faclen = min( iov -> iov_len, FACSIZE)); + + if ( ++iov -> iov_len) + { + bcopy( iov -> iov_base, generic -> na_pid, + generic -> na_pidlen = min( iov -> iov_len, NPSIZE)); + if ( iov -> iov_len > NPSIZE) + bcopy( iov -> iov_base + NPSIZE, generic -> na_cudf, + generic -> na_cudflen = min(iov -> iov_len - NPSIZE, CUDFSIZE)); + } +#endif + + if (x25_dnic_prefix && *x25_dnic_prefix) { + register int i; + + i = 0; + if (x25_intl_zero && dte[0] == '0' && dte[1] != '0') + i = 1; + else + if (x25_dnic_prefix + && *x25_dnic_prefix + && x25_strip_dnic + && dtelen < 12) /* local call... */ + bcopy (x25_dnic_prefix, generic -> na_dte, + generic -> na_dtelen = strlen (x25_dnic_prefix)); + + bcopy (dte + i, generic -> na_dte + generic -> na_dtelen, dtelen - i); + generic -> na_dtelen += dtelen - i; + } + else + bcopy (dte, generic -> na_dte, generic -> na_dtelen = dtelen); + + DLOG (x25_log, LLOG_DEBUG, + ("if2gen %s -> %s, %d octets; PID %s", + dte, generic -> na_dte, generic -> na_dtelen, + sel2str (generic -> na_pid, (int) generic -> na_pidlen,1))); + + return(generic); +} + +/* */ + +elucidate_x25_err (flags, pkt) +int flags; +char * pkt; +{ + char * cp; + + if (flags & (1 << RECV_DIAG)) { + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + (( flags & (1 << DIAG_TYPE) ) ? "cleared 0x%02x" : "reset 0x%02x", + pkt[0] )); + + if ((flags) & (1 << DIAG_TYPE)) /* cleared */ + switch(pkt[0]) { + case 0x00: + cp = "DTE Clearing"; + break; + + case 0x01: + cp = "Number Busy"; + break; + + case 0x09: + cp = "Out of Order"; + break; + + case 0x11: + cp = "Remote Procedure Error"; + break; + + case 0x19: + cp = "Reverse Charging not subscribed"; + break; + + case 0x03: + cp = "Invalid Facility Request"; + break; + + case 0x0B: + cp = "Access Barred"; + break; + + case 0x13: + cp = "Local Procedure Error"; + break; + + case 0x05: + cp = "Network Congestion"; + break; + + case 0x0D: + cp = "Not Obtainable"; + break; + + case 0x21: + cp = "DTE Incompatible Call"; + break; + + case 0x29: + cp = "Fast Select Acceptance not Subscribed"; + break; + + default: + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("clearing cause 0x2%x", pkt[0])); + goto next; + } + else /* reset */ + switch(pkt[0]) { + case 0x00: + cp = "DTE Reset"; + break; + + case 0x01: + cp = "Out of Order (PVC Only)"; + break; + + case 0x03: + cp = "Remote Procedure Error"; + break; + + case 0x05: + cp = "Local Procedure Error"; + break; + + case 0x07: + cp = "Network Congestion"; + break; + + case 0x09: + cp = "Remote DTE Operational (PVC Only)"; + break; + + case 0x0F: + cp = "Network Operational (PVC Only"; + break; + + default: + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("resetting cause 0x%2x", pkt[0])); + goto next; + + } + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, ("%s%s", + ( flags & (1 << DIAG_TYPE) ) ? "clearing cause " : + "resetting cause ", cp)); + +next: ; + /* The following may only be applicable to PSS in the UK */ + /* In any case, if someone is keen, they can stuff it all + into a text file and read it out */ + + switch (pkt[1]) { + case 0x00: + cp = "NO ADDITIONAL INFORMATION"; + break; + + case 0x01: + cp = "INVALID P(S)\tRESET"; + break; + + case 0x02: + cp = "INVALID P(R)\tRESET"; + break; + + case 0x11: + cp = "PACKET TYPE INVALID FOR STATE r1\tRESTART"; + break; + + case 0x12: + cp = "PACKET TYPE INVALID FOR STATE r2\tRESTART"; + break; + + case 0x13: + cp = "PACKET TYPE INVALID FOR STATE r3\tRESTART"; + break; + + case 0x14: + cp = "PACKET TYPE INVALID FOR STATE p1\tCLEAR"; + break; + + case 0x15: + cp = "PACKET TYPE INVALID FOR STATE p2\tCLEAR"; + break; + + case 0x16: + cp = "PACKET TYPE INVALID FOR STATE p3\tCLEAR"; + break; + + case 0x17: + cp = "PACKET TYPE INVALID FOR STATE p4\tCLEAR"; + break; + + case 0x18: + cp = "PACKET TYPE INVALID FOR STATE p5\tRESET"; + break; + + case 0x19: + cp = "PACKET TYPE INVALID FOR STATE p6\tCLEAR"; + break; + + case 0x1A: + cp = "PACKET TYPE INVALID FOR STATE p7\tCLEAR"; + break; + + case 0x1B: + cp = "PACKET TYPE INVALID FOR STATE d1\tRESET"; + break; + + case 0x1C: + cp = "PACKET TYPE INVALID FOR STATE d2\tRESET"; + break; + + case 0x1D: + cp = "PACKET TYPE INVALID FOR STATE d3\tRESET"; + break; + + case 0x20: + cp = "PACKET NOT ALLOWED"; + break; + + case 0x21: + cp = "UNIDENTIFIABLE PACKET"; + break; + + case 0x22: + cp = "CALL ON ONE-WAY LOGICAL CHANNEL\tCLEAR"; + break; + + case 0x23: + cp = "INVALID PACKET TYPE ON PVC\tRESET"; + break; + + case 0x24: + cp = "PACKET ON UNASSIGNED LCN\tCLEAR"; + break; + + case 0x25: + cp = "REJECT NOT SUBSCRIBED TO\tRESET"; + break; + + case 0x26: + cp = "PACKET TOO SHORT\tRESET"; + break; + + case 0x27: + cp = "PACKET TOO LONG\tRESET"; + break; + + case 0x28: + cp = "INVALID GFI\tCLEAR"; + break; + + case 0x29: + cp = "RESTART WITH NON-ZERO BITS 5-16"; + break; + + case 0x2A: + cp = "PACKET TYPE NOT COMPATIBLE WITH FACILITY\tCLEAR"; + break; + + case 0x2B: + cp = "UNAUTHORISED INTERRUPT CONF\tRESET"; + break; + + case 0x2C: + cp = "UNAUTHORISED INTERRUPT\tRESET"; + break; + + case 0x31: + cp = "TIMER EXPIRED; INCOMING CALL"; + break; + + case 0x32: + cp = "TIMER EXPIRED;\tCLEAR INDICATION"; + break; + + case 0x33: + cp = "TIMER EXPIRED;\tRESET INDICATION"; + break; + + case 0x34: + cp = "TIMER EXPIRED;\tRESTART IND"; + break; + + case 0x40: + cp = "UNSPECIFIED CALL SET-UP PROBLEM CLEAR"; + break; + + case 0x41: + cp = "FACILITY CODE NOT ALLOWED\tCLEAR"; + break; + + case 0x42: + cp = "FACILITY PARAMETER NOT ALLOWED\tCLEAR"; + break; + + case 0x43: + cp = "INVALID CALLED ADDRESS\tCLEAR"; + break; + + case 0x44: + cp = "INVALID CALLING ADDRESS\tCLEAR"; + break; + + case 0x90: + cp = "DTE/DCE CONGESTION\tRESET"; + break; + + case 0x91: + cp = "RECEIVED FAST SELECT CLEAR REQUEST"; + break; + + case 0x92: + cp = "LINE RESTARTING BY INMC COMMAND\tRESTART"; + break; + + case 0xA0: + cp = "NON-ZERO RESET CAUSE FROM DTE\tRESET"; + break; + + case 0xA1: + cp = "DATA PACKET TOO LONG\tRESET"; + break; + + case 0xA2: + cp = "INTERRUPT PACKET TOO LONG\tRESET"; + break; + + case 0xA3: + cp = "INT PACKET TOO SHORT; NO USER DATA\tRESET"; + break; + + case 0xA4: + cp = "INT CONFIRMATION PACKET TOO LONG\tRESET"; + break; + + case 0xA5: + cp = "RR PACKET TOO LONG\tRESET"; + break; + + case 0xA6: + cp = "RNR PACKET TOO LONG\tRESET"; + break; + + case 0xA7: + cp = "RESET PACKET TOO LONG\tRESET"; + break; + + case 0xA8: + cp = "RESET CONF PACKET TOO LONG\tRESET"; + break; + + case 0xA9: + cp = "INVALID `Q' BIT IN DATA PACKET\tRESET"; + break; + + case 0xAA: + cp = "PACKET WINDOW RANGE EXCEEDED\tRESET"; + break; + + case 0xAB: + cp = "UNABLE TO TRANSMIT PACKET\tRESET"; + break; + + case 0xAC: + cp = "diagnostic `Q' BIT SET IN NON-DATA PACKET\tRESET"; + break; + + case 0xAD: + cp = "OUTSTANDING PACKET COUNT LESS THAN ZERO\tRESET"; + break; + + case 0xAE: + cp = "RETRANSMISSION ERROR\tRESET"; + break; + + case 0xAF: + cp = "RESET PACKET TOO SHORT (NO CAUSE)\tRESET"; + break; + + case 0xB0: + cp = "REJECT PACKET TOO LONG\tRESET"; + break; + + case 0xB1: + cp = "INVALID 1D PACKET\tRESET"; + break; + + case 0xB2: + cp = "UNSUCCESSFUL RECONNECTION RESNC\tCLEAR"; + break; + + case 0xB3: + cp = "NON-RECONNECT CALL IN STATE C1\tCLEAR"; + break; + + case 0xB4: + cp = "SECOND 1D PACKET FROM DTE\tCLEAR"; + break; + + case 0xB5: + cp = "BAD DATA TRANSFER STATE IN RECONNECT\tCLEAR"; + break; + + case 0xB6: + cp = "PACKET FORMAT INVALID\tCLEAR"; + break; + + case 0xB7: + cp = "FACILITY BYTE COUNT TOO LARGE\tCLEAR"; + break; + + case 0xB8: + cp = "INVALID PACKET DETECTED\tCLEAR"; + break; + + case 0xB9: + cp = "FACILITY/UTILITY FIELD BYTE COUNT > 63\tCLEAR"; + break; + + case 0xBA: + cp = "OUTGOING CALLS BARRED\tCLEAR"; + break; + + case 0xBB: + cp = "INCOMING CALLS BARRED\tCLEAR"; + break; + + case 0xBC: + cp = "CLEARING OF PVC\tCLEAR"; + break; + + case 0xBD: + cp = "CALLED ADDRESS TOO LONG\tCLEAR"; + break; + + case 0xBE: + cp = "CALLED ADDRESS TOO SHORT\tCLEAR"; + break; + + case 0xBF: + cp = "CALLING ADDRESS TOO LONG\tCLEAR"; + break; + + case 0xC0: + cp = "CALLING ADDRESS TOO SHORT\tCLEAR"; + break; + + case 0xC1: + cp = "BCD ERROR IN CALL ADDRESS\tCLEAR"; + break; + + case 0xC2: + cp = "BCD ERROR IN CALLING ADDRESS\tCLEAR"; + break; + + case 0xC3: + cp = "USER DATA FIELD TOO LONG\tCLEAR"; + break; + + case 0xC4: + cp = "NO BUFFER AVAILABLE\tCLEAR"; + break; + + case 0xC5: + cp = "LOCAL DTE IS NOT ENHANCED\tCLEAR"; + break; + + case 0xC6: + cp = "FACILITY NEGOTIATION INVALID\tCLEAR"; + break; + + case 0xC7: + cp = "MANDATORY UTILITY NOT INPUT\tCLEAR"; + break; + + case 0xC8: + cp = "BUFFER NO AVAILABLE FOR TNIC\tCLEAR"; + break; + + case 0xC9: + cp = "OVERFLOW OF TNIC IN BUFFER\tCLEAR"; + break; + + case 0xCA: + cp = "DTE LINE CONGESTED\tCLEAR"; + break; + + case 0xCB: + cp = "TABLE ERROR IN PACKET PROCEDURES"; + break; + + case 0xCC: + cp = "INSERT TABLE OVERFLOW"; + break; + + case 0xCD: + cp = "DELETE TABLE OVERFLOW"; + break; + + case 0xD0: + cp = "TRUNK LINE RESTART\tRESTART"; + break; + + case 0xD1: + cp = "INVALID EVENT IN STATE p2"; + break; + + case 0xD2: + cp = "INVALID EVENT IN STATE p3"; + break; + + case 0xD3: + cp = "INVALID 1D EVENT IN STATE d1"; + break; + + case 0xD4: + cp = "CALL COLLISION ON TRUNK LINE"; + break; + + case 0xD5: + cp = "NO BUFFER AVAILABLE"; + break; + + case 0xD6: + + cp = "CALL COLLISION ON DTE LINE"; + break; + + case 0xD7: + cp = "DTE RESTART"; + break; + + case 0xD8: + cp = "CALL REQUEST TO TRUNK LINE TIMEOUT"; + break; + + case 0xD9: + cp = "RECONNECT SET-UP TIMED OUT"; + break; + + case 0xDA: + cp = "INVALID OUTPUT SIDE STATE"; + break; + + case 0xDB: + cp = "ERROR DETECTED IN BLINK PACKET QUEUE PROCEDURE"; + break; + + case 0xDC: + cp = "RESET INDICATION RETRANSMISSION COUNT EXPIRED"; + break; + + case 0xDD: + cp = "INVALID OUTPUT SIDE STATE"; + break; + + case 0xDE: + cp = "BLIND BUFFER QUEUE OVERFLOW IN STATE d4"; + break; + + case 0xDF: + cp = "BLIND BUFFER QUEUE OVERFLOW IN STATE c1"; + break; + + case 0xE0: + cp = "BLIND BUFFER QUEUE OVERFLOW IN STATE c2"; + break; + + case 0xE1: + cp = "CLEAR PACKET BYTE COUNT TOO LARGE OR TOO SMALL"; + break; + + case 0xE2: + cp = "NON-ZERO\tCLEAR CAUSE"; + break; + + case 0xE3: + cp = "CLEAR CONF PACKET BYTE COUNT TOO SMALL OR TOO LARGE"; + break; + + case 0xE4: + cp = "CALL COLLISION"; + break; + + case 0xE5: + cp = "INVALID TP LOAD REQUEST CALL PKT"; + break; + + case 0xE6: + cp = "MAXIMUM HOPCOUNT EXCEEDED"; + break; + + case 0xE7: + cp = "ROUTING LOOP DETECTED"; + break; + + case 0xE8: + cp = "PVC CALL REQUEST FAILURE"; + break; + + case 0xE9: + cp = "RECONNECT CALL REQUEST FAILED"; + break; + + case 0xEA: + cp = "NO LC AVAILABLE ON OUTPUT SIDE"; + break; + + case 0xEB: + cp = "NO BUFFER AVAILABLE"; + break; + + case 0xEC: + cp = "CALL REDIRECTION CLEAR"; + break; + + case 0xED: + cp = "NO PATH ROUTE CALL"; + break; + + case 0xEE: + cp = "CALL ROUTED TO DTE LINE"; + break; + + case 0xEF: + cp = "CALL CANNOT BE REROUTED"; + break; + + case 0xF0: + cp = "ADDRESS NOT IN ROUTING TABLES"; + break; + + case 0xF1: + cp = "ROUTING TABLE CHANGE DURING CALL ROUTING"; + break; + + case 0xF2: + cp = "NO LC AVAILABLE ON FAKE TRUNK"; + break; + + case 0xF3: + cp = "REMOTE DTE DOWN ON A PVC"; + break; + + case 0xF4: + cp = "INVALID EVENT DETECTED"; + break; + + case 0xF5: + cp = "INVALID PACKET RECEIVED; STATE d4"; + break; + + case 0xF6: + cp = "INVALID PACKET RECEIVED; STATE d5"; + break; + + case 0xF7: + cp = "INVALID PACKET RECEIVED; STATE p8"; + break; + + case 0xF8: + cp = "INTERNAL PROCESSING FAILURE"; + break; + + case 0xF9: + cp = "INVALID RESTART INDICATION"; + break; + + case 0xFA: + cp = "LINE STATUS CHANGE IN STATE r4"; + break; + + case 0xFB: + cp = "INVALID PACKET RECEIVED; STATE r4"; + break; + + case 0xFC: + cp = "INVALID PACKET RECEIVED; STATE r3"; + break; + + case 0xFD: + cp = "LINE STATUS CHANGE IN STATE r2"; + break; + + case 0xFE: + cp = "LINE STATUS CHANGE IN STATE r1"; + break; + + case 0xFF: + cp = "LINE STATUS CHANGE IN STATE r0"; + break; + + default: + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("diagnostic: 0x%2x", pkt[1])); + goto done; + } + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, ("diagnostic %s", cp)); + } + else /* Not RECV_DIAG */ + if (flags) + SLOG (compat_log, LLOG_EXCEPTIONS, NULLCP, + ("diag flags: 0x%02x", flags)); + +done: ; + return OK; +} + +/* */ + +#ifdef SUN_X25 +static int char2bcd (s, d) +register char *s; +register u_char *d; +{ + register int c, + i; + + for (i = 0; *s; i++) { + if ((c = *s++) >= 'a' && c <= 'f') + c -= 'a' + 0x0a; + else + if (c >= 'A' && c <= 'F') + c -= 'A' + 0x0a; + else + if (c >= '0' && c <= '9') + c -= '0'; + else + c = 0; + + if (i & 1) + *d++ |= c & 0xf; + else + *d = (c & 0xf) << 4; + } + + return i; +} + +/* */ + +static int bcd2char (s, d, len) +register u_char *s; +register char *d; +int len; +{ + register int i, + g; + + for (i = 0; i < len; i++) { + g = s[i >> 1]; + if ((i & 1) == 0) + g >>= 4; + g &= 0xf; + + if (g < 0x0a) + *d++ = g + '0'; + else + *d++ = g + 'a' - 0x0a; + } + + *d = NULL; + + return len; +} +#endif +#else +int _x25addr_stub () {}; +#endif diff --git a/usr/src/contrib/isode/config/OPTIONS b/usr/src/contrib/isode/config/OPTIONS new file mode 100644 index 0000000000..975071070e --- /dev/null +++ b/usr/src/contrib/isode/config/OPTIONS @@ -0,0 +1,153 @@ +[ OPTIONS - Thu Dec 7 11:27:40 1989 - compile-time options - /mtr ] + + + Look at the skeleton files provided to get the flare of things. In + addition, when porting to non-standard UNIX variants, consult the + files h/{general,manifest}.h to find other strange #defines + + +1. Operating Systems + + Choose one of BSD42, SYS5, or ROS. In addition, some of these + have suboptions. + +#define BSD42 Berkeley UNIX +#define WRITEV real Berkeley UNIX (has writev syscall) +#define SUNOS4 with Sun's enhancements (SunOS4.0 or later) +#define SUNOS41 SunOS4.1 +#define BSD43 4.3BSD or later +#define BSD43_Tahoe 4.3BSD Tahoe release +#define BSD44 4.4BSD to be precise! (not out yet) +#define OSX Olivetti's version + +#define SYS5 AT&T UNIX +#define SVR3 System V Release 3 +#define HPUX SVR2 with HP's enhancements +#define AIX SVR2 with IBM's enhancements +#define AUX SVR2 with Apple's enhancements + +#define ROS Ridge's emulation of UNIX + +#define VSPRINTF libc includes vsprintf() and vfprintf () + + +2. Network/Transport options + + Choose any combination of TCP, X25, BRIDGE_X25, or TP4. For + TCP: SOCKETS, WINTLI and EXOS are mutually exclusive, and WIN and BIND are + suboptions to SOCKETS. For X25: SUN_X25, CAMTEC, CAMTEC_CCL, and UBC_X25 + are mutually exclusive. For TP4: WIN, SUN_TP4 are mutually exclusive. + +#define TCP support TCP/IP with TP0 +#define SOCKETS provided by SOCKETS +#define WIN emulated via WIN/TCP for SVR2 +#define WINTLI provided by WIN/TCP STREAMS +#define EXOS provided by EXOS 8044 card +#define BIND if BIND is used (the gethostent struct + has an h_addrlist field in ) + you may need to add "-lresolv" to the LSOCKET + definition in CONFIG.make + +#define X25 support X.25 with TP0 +#define SUN_X25 using SunLink X.25 version 4.0 or 5.0 +#define SUN_X25_HACK to enable local subaddress masking + (see comments in compat/x25addr.c) +#define CAMTEC using CAMTEC interface +#define CAMTEC_CCL using CAMTEC interface with sockets +#define UBC_X25 using UBC X.25 +#define UBC_X25_WRITEV able to use writev for X.25, + not all versions of UBC code + support this. + +#define BRIDGE_X25 use a TCP/X.25 gateway + (requires #ifdef TCP) + +#define TP4 support real TP4 +#define SUN_TP4 provided by SunLink OSI +#define SUNLINK_5_2 using SunLink OSI release 5.2 or greater +#define SUNLINK_6_0 using SunLink OSI release 6.0 or greater +#define SUNLINK_7_0 using SunLink OSI release 7.0 or greater +#define BSD_TP4 provided by UCB/UWisc + +#define NOGOSIP assume TSEL uniquely distinguishes service + (makes tsapd a LOT smaller and faster) + + +3. Directory Services + + By default, support for both the OSI Directory and the stub DSE is + compiled. However, to enable access to the Directory (via a + lightweight access protocol), the isotailor variable ns_enabled + must be turned "on". If the nameservice fails, then the stub DSE + will be consulted. + + While not advised at this point you can disable fallback to the stub + DSE by also choosing NOSTUB. Disabling the fallback mode implies + that all name to address resolution will depend on the DSE and will + fail if it is not operational. + +#define NOSTUB do not use stub DSE when resolving names + + + +4. UNIX Directory compatability routines + + If your system supports a getdents() call, then define + +#define GETDENTS + + This will make the directory compatibility library a no-op. + Otherwise, define one of: + +#define UFS original UNIX filesystem (14-character name limit) +#define BFS Berkeley UNIX filesystem (long names) +#define NFS getdirentries() system call + + +5. imisc options + +These are used by the imisc daemon to exec the rfinger program. + +#define RFINGER "path" where rfinger lives +#define RFOPT1 "switch" switches +#define RFOPT2 "switch" switches + + +6. Anonymous login for ftam, etc. + +This defaults to + +#define ANON "ftp" + +You can set it to something else if you like. For example, to have anonymous +ftam but not anonymous ftp (due to the numerous security holes in anonymous +ftp), then just define ANON to be "ftam" and replace the "ftp" username in +the /etc/passwd file with "ftam" instead. + + +7. Management Instrumentation + +DO NOT SET THIS UNLESS YOU KNOW WHAT YOU ARE DOING (i.e., if you had to read +this file, then you shouldn't set this option!) + +#define MGMT to enable management instrumentation in libtsap + + +8. PEPSY options + +#define PEPSY_REALS real support for pepsy + add "-lm" to LSOCKET in CONFIG.make + + +9. KERBEROS options + +If you want the FTAM responder to use Kerberos for authentication, you can use +the option below. If enabled, Kerberos will be enabled if the pw_passwd field +is the three-character sequence "*krb*". + +#define KRB_PASSWD enable Kerberos checking + +You must also add these three lines to your CONFIG.make file + +KRBOPT = -I +KRBLIB = -lkrb -ldes diff --git a/usr/src/contrib/isode/config/aliases.local b/usr/src/contrib/isode/config/aliases.local new file mode 100644 index 0000000000..6e2c02ad76 --- /dev/null +++ b/usr/src/contrib/isode/config/aliases.local @@ -0,0 +1,39 @@ +############################################################################### +# +# isoaliases - ISODE alias file +# +# Mappings between user-friendly strings and distinguished names +# +# +# $Header: /f/osi/config/RCS/aliases.local,v 7.1 91/02/22 09:16:18 mrose Interim $ +# +# +# $Log: aliases.local,v $ +# Revision 7.1 91/02/22 09:16:18 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:25:36 mrose +# Release 6.0 +# +############################################################################### + + +############################################################################### +# +# Syntax: +# +# +# +# Each token is separated by LWSP, though double-quotes may be +# used to prevent separation +# +# Maybe in the future we'll support a macro facility! +# +############################################################################### + +############################################################################### +# locally defined aliases +# (this section is empty unless you're running an OSI Directory...) +############################################################################### + + diff --git a/usr/src/contrib/isode/config/alpaca.h b/usr/src/contrib/isode/config/alpaca.h new file mode 100644 index 0000000000..f20606e15b --- /dev/null +++ b/usr/src/contrib/isode/config/alpaca.h @@ -0,0 +1,48 @@ +/* osi.h - site configuration file for osi (SunOS) */ + +/* + * $Header: /f/osi/config/RCS/osi.h,v 7.2 91/02/22 09:16:43 mrose Interim $ + * + * + * $Log: osi.h,v $ + * Revision 7.2 91/02/22 09:16:43 mrose + * Interim 6.8 + * + * Revision 7.1 90/10/15 18:17:59 mrose + * zap-AET + * + * Revision 7.0 89/11/23 21:26:11 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ + +#define VSPRINTF /* libc has vsprintf */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define X25 /* support for X.25 */ +#define SUN_X25 /* using SunLink X.25 V5.2 */ + +#define NFS /* network filesystem -- has getdirentries() */ + +#define ANON "anon" /* guest login for ftam */ + +#endif diff --git a/usr/src/contrib/isode/config/alpaca.make b/usr/src/contrib/isode/config/alpaca.make new file mode 100644 index 0000000000..ca903ac4f6 --- /dev/null +++ b/usr/src/contrib/isode/config/alpaca.make @@ -0,0 +1,81 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for osi (SunOS) +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/osi.make,v 7.9 91/02/22 09:16:44 mrose Interim $ +############################################################################### + +############################################################################### +# +# 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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/spool/isode/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# -O loses... +CFLAGS = -pipe $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = +ARFLAGS = + +LN = ln + +# native to 4.2BSD UNIX +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/apollo.h b/usr/src/contrib/isode/config/apollo.h new file mode 100644 index 0000000000..58fac542c8 --- /dev/null +++ b/usr/src/contrib/isode/config/apollo.h @@ -0,0 +1,46 @@ +/* apollo.h - site configuration file for Apollo */ + +/* + * $Header: /f/osi/config/RCS/apollo.h,v 7.1 91/02/22 09:16:19 mrose Interim $ + * + * Contributed by John Brezak, Apollo Computer, Inc. + * + * + * $Log: apollo.h,v $ + * Revision 7.1 91/02/22 09:16:19 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:25:37 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#ifdef notdef /* Don Preuss at Apollo says no longer needed*/ +#ifdef __STDC__ /* thinks it's ANSI C, but it isn't! */ +#undef __STDC__ +#endif +#endif + +#endif diff --git a/usr/src/contrib/isode/config/apollo.make b/usr/src/contrib/isode/config/apollo.make new file mode 100644 index 0000000000..b47ea619df --- /dev/null +++ b/usr/src/contrib/isode/config/apollo.make @@ -0,0 +1,114 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for Apollo +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/apollo.make,v 7.9 91/02/22 09:16:20 mrose Interim $ +# +# Contributed by John Brezak, Apollo Computer, Inc. +# +# +# $Log: apollo.make,v $ +# Revision 7.9 91/02/22 09:16:20 mrose +# Interim 6.8 +# +# Revision 7.8 91/01/14 13:35:53 mrose +# again +# +# Revision 7.7 91/01/14 13:30:52 mrose +# kerberos +# +# Revision 7.6 90/11/20 15:31:15 mrose +# update +# +# Revision 7.5 90/10/15 18:17:54 mrose +# zap-AET +# +# Revision 7.4 90/07/27 08:42:32 mrose +# update +# +# Revision 7.3 90/07/01 21:02:23 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:44:56 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:55:44 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:25:38 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +TOPDIR = /isode/ +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /isode/bin/ +SBINDIR = /isode/etc/ +ETCDIR = /isode/etc/ +LOGDIR = /isode/logs/ +MANDIR = /isode/man/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /isode/lib/ +LINTDIR = /isode/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + +OPTIONS = -I/isode/h -A systype,any -A cpu,3000 $(PEPYPATH) $(KRBOPT) + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = #-s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c diff --git a/usr/src/contrib/isode/config/aux.h b/usr/src/contrib/isode/config/aux.h new file mode 100644 index 0000000000..9937a44aae --- /dev/null +++ b/usr/src/contrib/isode/config/aux.h @@ -0,0 +1,45 @@ +/* aux.h - config file for A/UX running 1.1 */ + +/* + * $Header: /f/osi/config/RCS/aux.h,v 7.1 91/02/22 09:16:22 mrose Interim $ + * + * Contributed by Julian Onions, Nottingham University + * + * + * $Log: aux.h,v $ + * Revision 7.1 91/02/22 09:16:22 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:25:39 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define SYS5 /* AT&T UNIX */ +#define AUX /* with Apple's enhancements */ +#define WRITEV /* that include the writev call */ + +#define VSPRINTF + +#define TCP /* has TCP/IP */ +#define SOCKETS /* provided by sockets */ + +#define NFS /* network file system -- has getdirentries */ + +#define RFINGER "/usr/ucb/finger" + +#endif diff --git a/usr/src/contrib/isode/config/aux.make b/usr/src/contrib/isode/config/aux.make new file mode 100644 index 0000000000..36df837587 --- /dev/null +++ b/usr/src/contrib/isode/config/aux.make @@ -0,0 +1,108 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for A/UX 1.1 +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/aux.make,v 7.8 91/02/22 09:16:23 mrose Interim $ +# +# +# $Log: aux.make,v $ +# Revision 7.8 91/02/22 09:16:23 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:35:56 mrose +# again +# +# Revision 7.6 91/01/14 13:30:55 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:17 mrose +# update +# +# Revision 7.4 90/07/27 08:42:31 mrose +# update +# +# Revision 7.3 90/07/01 21:02:24 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:44:58 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:55:46 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:25:39 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = //usr/local/etc/ +ETCDIR = //usr/local/etc/ +LOGDIR = /tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/local/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -sys5 +MANDIR = /usr/man/ +MANOPTS = -sys5 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc -B /usr/lib/big/ +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +..c.o:; $(CC) $(LIBCFLAGS) -c $*.c + diff --git a/usr/src/contrib/isode/config/bsd42.h b/usr/src/contrib/isode/config/bsd42.h new file mode 100644 index 0000000000..be828ed3db --- /dev/null +++ b/usr/src/contrib/isode/config/bsd42.h @@ -0,0 +1,36 @@ +/* bsd42.h - site configuration file for 4.2BSD UNIX */ + +/* + * $Header: /f/osi/config/RCS/bsd42.h,v 7.1 91/02/22 09:16:24 mrose Interim $ + * + * + * $Log: bsd42.h,v $ + * Revision 7.1 91/02/22 09:16:24 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:25:40 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#endif diff --git a/usr/src/contrib/isode/config/bsd42.make b/usr/src/contrib/isode/config/bsd42.make new file mode 100644 index 0000000000..284fab093b --- /dev/null +++ b/usr/src/contrib/isode/config/bsd42.make @@ -0,0 +1,109 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for 4.2BSD UNIX +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/bsd42.make,v 7.8 91/02/22 09:16:25 mrose Interim $ +# +# +# $Log: bsd42.make,v $ +# Revision 7.8 91/02/22 09:16:25 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:35:58 mrose +# again +# +# Revision 7.6 91/01/14 13:30:58 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:19 mrose +# update +# +# Revision 7.4 90/07/27 08:42:30 mrose +# update +# +# Revision 7.3 90/07/01 21:02:26 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:01 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:55:48 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:25:56 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/bsd43-rt.h b/usr/src/contrib/isode/config/bsd43-rt.h new file mode 100644 index 0000000000..dd1fe0a721 --- /dev/null +++ b/usr/src/contrib/isode/config/bsd43-rt.h @@ -0,0 +1,49 @@ +/* bsd43-rt.h - site configuration file for RT PC running 4.3BSD UNIX */ + +/* + * $Header: /f/osi/config/RCS/bsd43-rt.h,v 7.2 91/02/22 09:16:26 mrose Interim $ + * + * Contributed by Jacob Rekhter, T.J. Watson Research Center, IBM Corp. + * + * + * $Log: bsd43-rt.h,v $ + * Revision 7.2 91/02/22 09:16:26 mrose + * Interim 6.8 + * + * Revision 7.1 90/01/27 10:25:59 mrose + * touch-up + * + * Revision 7.0 89/11/23 21:25:57 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define RT /* RT/PC */ + +#if defined(__STDC__) && defined(__HIGHC__) + /* hc thinks it's ANSI C, but it isn't! */ +#undef __STDC__ +#endif + +#endif diff --git a/usr/src/contrib/isode/config/bsd43-rt.make b/usr/src/contrib/isode/config/bsd43-rt.make new file mode 100644 index 0000000000..51eb8a700a --- /dev/null +++ b/usr/src/contrib/isode/config/bsd43-rt.make @@ -0,0 +1,116 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for RT PC running +# 4.3BSD UNIX +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/bsd43-rt.make,v 7.9 91/02/22 09:16:27 mrose Interim $ +# +# Contributed by Jacob Rekhter, T.J. Watson Research Center, IBM Corp. +# +# +# $Log: bsd43-rt.make,v $ +# Revision 7.9 91/02/22 09:16:27 mrose +# Interim 6.8 +# +# Revision 7.8 91/01/14 13:36:00 mrose +# again +# +# Revision 7.7 91/01/14 13:31:02 mrose +# kerberos +# +# Revision 7.6 90/11/20 15:31:21 mrose +# update +# +# Revision 7.5 90/07/27 08:42:28 mrose +# update +# +# Revision 7.4 90/07/01 21:02:27 mrose +# pepsy +# +# Revision 7.3 90/04/18 08:45:03 mrose +# MANDIR +# +# Revision 7.2 90/03/06 13:55:50 mrose +# touch-up +# +# Revision 7.1 90/01/27 10:26:02 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:25:57 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = hc +# don't use -O with hc 2.1s on RT/4.3 +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/bsd43.h b/usr/src/contrib/isode/config/bsd43.h new file mode 100644 index 0000000000..1868ec4250 --- /dev/null +++ b/usr/src/contrib/isode/config/bsd43.h @@ -0,0 +1,39 @@ +/* bsd43.h - site configuration file for 4.3BSD UNIX */ + +/* + * $Header: /f/osi/config/RCS/bsd43.h,v 7.1 91/02/22 09:16:28 mrose Interim $ + * + * + * $Log: bsd43.h,v $ + * Revision 7.1 91/02/22 09:16:28 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:25:58 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define NFS /* network file system -- has getdirentries */ + +#endif diff --git a/usr/src/contrib/isode/config/bsd43.make b/usr/src/contrib/isode/config/bsd43.make new file mode 100644 index 0000000000..5bd6561528 --- /dev/null +++ b/usr/src/contrib/isode/config/bsd43.make @@ -0,0 +1,109 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for 4.3BSD UNIX +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/bsd43.make,v 7.8 91/02/22 09:16:29 mrose Interim $ +# +# +# $Log: bsd43.make,v $ +# Revision 7.8 91/02/22 09:16:29 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:03 mrose +# again +# +# Revision 7.6 91/01/14 13:31:06 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:23 mrose +# update +# +# Revision 7.4 90/07/27 08:42:27 mrose +# update +# +# Revision 7.3 90/07/01 21:02:28 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:05 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:55:52 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:25:59 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/bsd44.h b/usr/src/contrib/isode/config/bsd44.h new file mode 100644 index 0000000000..fcd631b491 --- /dev/null +++ b/usr/src/contrib/isode/config/bsd44.h @@ -0,0 +1,56 @@ +/* bsd44.h - site configuration file for 4.4BSD UNIX */ + +/* + * $Header: /f/osi/config/RCS/bsd44.h,v 7.3 91/02/22 09:16:30 mrose Interim $ + * + * + * $Log: bsd44.h,v $ + * Revision 7.3 91/02/22 09:16:30 mrose + * Interim 6.8 + * + * Revision 7.2 91/01/10 16:13:03 mrose + * x25 + * + * Revision 7.1 90/07/09 14:32:41 mrose + * sync + * + * Revision 7.0 89/11/23 21:26:00 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ +#define BSD44 /* 4.4BSD to be precise! */ + +#define X25 +#define UBC_X25 +#define UBC_X25_WRITEV + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define TP4 /* has TP4 */ +#define BSD_TP4 /* provided by UCB/UWisc */ + +#define GETDENTS /* has getdirent(2) call */ +#define NFS /* network file system -- has getdirentries */ + +#endif diff --git a/usr/src/contrib/isode/config/bsd44.make b/usr/src/contrib/isode/config/bsd44.make new file mode 100644 index 0000000000..fc1b4d2458 --- /dev/null +++ b/usr/src/contrib/isode/config/bsd44.make @@ -0,0 +1,119 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for 4.4BSD UNIX +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/bsd44.make,v 7.10 91/02/22 09:16:31 mrose Interim $ +# +# +# $Log: bsd44.make,v $ +# Revision 7.10 91/02/22 09:16:31 mrose +# Interim 6.8 +# +# Revision 7.9 91/01/14 13:36:06 mrose +# again +# +# Revision 7.8 91/01/14 13:31:08 mrose +# kerberos +# +# Revision 7.7 90/11/20 15:31:26 mrose +# update +# +# Revision 7.6 90/07/27 08:42:26 mrose +# update +# +# Revision 7.5 90/07/09 14:32:44 mrose +# sync +# +# Revision 7.4 90/07/01 21:02:30 mrose +# pepsy +# +# Revision 7.3 90/04/18 08:45:07 mrose +# MANDIR +# +# Revision 7.2 90/03/06 13:55:54 mrose +# touch-up +# +# Revision 7.1 90/01/11 18:35:20 mrose +# real-sync +# +# Revision 7.0 89/11/23 21:26:01 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/isode/ +SBINDIR = /usr/sbin/ +ETCDIR = /etc/ +LOGDIR = /var/log/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/libdata/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/share/man/ +MANOPTS = -bsd44 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +# since flex is now standard (ugh!) +LEX = /usr/old/lex + +LN = ln + +# -lutil for vt (of all things) +LSOCKET = -lutil $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/cheetah.h b/usr/src/contrib/isode/config/cheetah.h new file mode 100644 index 0000000000..07601d2255 --- /dev/null +++ b/usr/src/contrib/isode/config/cheetah.h @@ -0,0 +1,45 @@ +/* cheetah.h - site configuration file for cheetah (SunOS) */ + +/* + * $Header: /f/osi/config/RCS/cheetah.h,v 7.2 91/02/22 09:16:32 mrose Interim $ + * + * + * $Log: cheetah.h,v $ + * Revision 7.2 91/02/22 09:16:32 mrose + * Interim 6.8 + * + * Revision 7.1 90/10/15 18:17:56 mrose + * zap-AET + * + * Revision 7.0 89/11/23 21:26:01 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define NFS /* network filesystem -- has getdirentries() */ + +#define ANON "anon" /* guest login for ftam */ + +#endif diff --git a/usr/src/contrib/isode/config/cheetah.make b/usr/src/contrib/isode/config/cheetah.make new file mode 100644 index 0000000000..ecfe886c1c --- /dev/null +++ b/usr/src/contrib/isode/config/cheetah.make @@ -0,0 +1,112 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for cheetah (SunOS) +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/cheetah.make,v 7.9 91/02/22 09:16:33 mrose Interim $ +# +# +# $Log: cheetah.make,v $ +# Revision 7.9 91/02/22 09:16:33 mrose +# Interim 6.8 +# +# Revision 7.8 91/01/14 13:36:10 mrose +# again +# +# Revision 7.7 91/01/14 13:31:11 mrose +# kerberos +# +# Revision 7.6 90/11/20 15:31:28 mrose +# update +# +# Revision 7.5 90/10/15 18:17:57 mrose +# zap-AET +# +# Revision 7.4 90/07/27 08:42:25 mrose +# update +# +# Revision 7.3 90/07/01 21:02:31 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:09 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:55:56 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:02 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -DDEBUG $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/uci/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/spool/isode/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -local + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = -g $(OPTIONS) -temp=/usr/tmp +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -g +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/entities.local b/usr/src/contrib/isode/config/entities.local new file mode 100644 index 0000000000..afafb99a44 --- /dev/null +++ b/usr/src/contrib/isode/config/entities.local @@ -0,0 +1,26 @@ +############################################################################### +# +# $Header: /f/osi/config/RCS/entities.local,v 7.1 91/02/22 09:16:34 mrose Interim $ +# +# +# $Log: entities.local,v $ +# Revision 7.1 91/02/22 09:16:34 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:03 mrose +# Release 6.0 +# +############################################################################### + + +# templates for local services: 1.17.4.1 +# local additions go here... + + +# local additions end here (do not remove this line) + + +# examples of specific services: 1.17.4.2 +# this section is empty + + diff --git a/usr/src/contrib/isode/config/hpux.h b/usr/src/contrib/isode/config/hpux.h new file mode 100644 index 0000000000..a0af88330e --- /dev/null +++ b/usr/src/contrib/isode/config/hpux.h @@ -0,0 +1,42 @@ +/* hpux.h - site configuration file for HP-UX */ + +/* + * $Header: /f/osi/config/RCS/hpux.h,v 7.2 91/02/22 09:16:35 mrose Interim $ + * + * + * $Log: hpux.h,v $ + * Revision 7.2 91/02/22 09:16:35 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/09 14:32:47 mrose + * sync + * + * Revision 7.0 89/11/23 21:26:04 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define SYS5 /* AT&T UNIX */ +#define HPUX /* with HP's enhancements */ +#define VSPRINTF /* libc includes vsprintf and vfprintf */ + +#define TCP /* has TCP/IP */ +#define SOCKETS /* provided by sockets */ + +#define GETDENTS /* has getdirent(2) call */ + +#endif diff --git a/usr/src/contrib/isode/config/hpux.make b/usr/src/contrib/isode/config/hpux.make new file mode 100644 index 0000000000..d898532710 --- /dev/null +++ b/usr/src/contrib/isode/config/hpux.make @@ -0,0 +1,112 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for HP-UX +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/hpux.make,v 7.9 91/02/22 09:16:38 mrose Interim $ +# +# +# $Log: hpux.make,v $ +# Revision 7.9 91/02/22 09:16:38 mrose +# Interim 6.8 +# +# Revision 7.8 91/01/14 13:36:13 mrose +# again +# +# Revision 7.7 91/01/14 13:31:13 mrose +# kerberos +# +# Revision 7.6 90/11/20 15:31:32 mrose +# update +# +# Revision 7.5 90/10/15 22:54:05 mrose +# typo +# +# Revision 7.4 90/07/27 08:42:23 mrose +# update +# +# Revision 7.3 90/07/01 21:02:32 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:11 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:55:58 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:04 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -sys5 +MANDIR = /usr/man/ +MANOPTS = -hpux + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# may need +Ns2000 +Nd3000 to make compiler use larger tables on the Series 300 +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -ns +ARFLAGS = + +LN = ln + +# TCP/IP is native to HP-UX, but we still need a non-standard library +LSOCKET = -lbsdipc $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c diff --git a/usr/src/contrib/isode/config/macros.local b/usr/src/contrib/isode/config/macros.local new file mode 100644 index 0000000000..f55516f620 --- /dev/null +++ b/usr/src/contrib/isode/config/macros.local @@ -0,0 +1,21 @@ +############################################################################### +# +# $Header: /f/osi/config/RCS/macros.local,v 7.1 91/02/22 09:16:39 mrose Interim $ +# +# +# $Log: macros.local,v $ +# Revision 7.1 91/02/22 09:16:39 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:05 mrose +# Release 6.0 +# +############################################################################### + + +############################################################################### +# locally defined macros +# (this section is usually empty...) +############################################################################### + + diff --git a/usr/src/contrib/isode/config/mips.h b/usr/src/contrib/isode/config/mips.h new file mode 100644 index 0000000000..1dedb4a98a --- /dev/null +++ b/usr/src/contrib/isode/config/mips.h @@ -0,0 +1,46 @@ +/* mips.h - site configuration file for RISC/OS */ + +/* + * $Header: /f/osi/config/RCS/mips.h,v 7.2 91/02/22 09:16:40 mrose Interim $ + * + * + * $Log: mips.h,v $ + * Revision 7.2 91/02/22 09:16:40 mrose + * Interim 6.8 + * + * Revision 7.1 90/03/26 09:57:04 mrose + * MIPS + * + * Revision 7.0 89/11/23 21:26:06 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define MIPS /* RISC/OS */ + +#define NFS /* network file system -- has getdirentries */ + +#define BIND + +#endif diff --git a/usr/src/contrib/isode/config/mips.make b/usr/src/contrib/isode/config/mips.make new file mode 100644 index 0000000000..0ea0c8881e --- /dev/null +++ b/usr/src/contrib/isode/config/mips.make @@ -0,0 +1,114 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for RISC/OS +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/mips.make,v 7.9 91/02/22 09:16:41 mrose Interim $ +# +# +# $Log: mips.make,v $ +# Revision 7.9 91/02/22 09:16:41 mrose +# Interim 6.8 +# +# Revision 7.8 91/01/14 13:36:16 mrose +# again +# +# Revision 7.7 91/01/14 13:31:15 mrose +# kerberos +# +# Revision 7.6 90/11/20 15:31:34 mrose +# update +# +# Revision 7.5 90/07/27 08:42:22 mrose +# update +# +# Revision 7.4 90/07/01 21:02:34 mrose +# pepsy +# +# Revision 7.3 90/04/18 08:45:13 mrose +# MANDIR +# +# Revision 7.2 90/03/26 09:57:06 mrose +# MIPS +# +# Revision 7.1 90/03/06 13:56:00 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:07 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/isode/ +SBINDIR = /usr/etc/isode/sbin/ +ETCDIR = /usr/etc/isode/etc/ +LOGDIR = /usr/spool/isode/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +### LINTDIR IS WRONG ### +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -mips +MANDIR = /usr/man/ +MANOPTS = -sys5 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) +LNLIST = -lmld + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/objects.local b/usr/src/contrib/isode/config/objects.local new file mode 100644 index 0000000000..42e3f2edc0 --- /dev/null +++ b/usr/src/contrib/isode/config/objects.local @@ -0,0 +1,38 @@ +############################################################################### +# +# isobjects - ISODE Objects Database +# +# Mappings between object descriptors and object identifiers +# +# +# $Header: /f/osi/config/RCS/objects.local,v 7.1 91/02/22 09:16:42 mrose Interim $ +# +# +# $Log: objects.local,v $ +# Revision 7.1 91/02/22 09:16:42 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:10 mrose +# Release 6.0 +# +############################################################################### + + +############################################################################### +# +# Syntax: +# +# +# +# Each token is separated by LWSP, though double-quotes may be +# used to prevent separation +# +############################################################################### + + +############################################################################### +# locally defined objects +# (this section is usually empty...) +############################################################################### + + diff --git a/usr/src/contrib/isode/config/osx.h b/usr/src/contrib/isode/config/osx.h new file mode 100644 index 0000000000..b11991ab55 --- /dev/null +++ b/usr/src/contrib/isode/config/osx.h @@ -0,0 +1,42 @@ +/* osx.h - site configuration file for Olivetti LSX 30xx */ + +/* + * $Header: /f/osi/config/RCS/osx.h,v 7.1 91/02/22 09:16:45 mrose Interim $ + * + * + * $Log: osx.h,v $ + * Revision 7.1 91/02/22 09:16:45 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:26:12 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX (sort of) */ +#define XOS_2 /* Olivetti's version */ + +#define VSPRINTF + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* 4.2BSD sockets */ +#define NOGOSIP +#define TSBRIDGE + +#define NFS +#endif diff --git a/usr/src/contrib/isode/config/osx.make b/usr/src/contrib/isode/config/osx.make new file mode 100644 index 0000000000..54db5068ae --- /dev/null +++ b/usr/src/contrib/isode/config/osx.make @@ -0,0 +1,90 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for +# Olivetti LSX 30xx +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/osx.make,v 7.8 91/02/22 09:16:46 mrose Interim $ +# +# +# $Log: osx.make,v $ +# Revision 7.8 91/02/22 09:16:46 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:14 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -I$(TOPDIR)hstubssap $(PEPYPATH) -DDEBUG $(KRBOPT) +PROOF = /usr2/proof/ISODE-6.7b/ + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = $(PROOF)bin/ +SBINDIR = $(PROOF)etc/ +ETCDIR = $(PROOF)etc/ +LOGDIR = /usr/tmp/ +INCDIRM = $(PROOF)src/include/isode +INCDIR = $(INCDIRM)/ +LOCINC = $(TOPDIR)hstubssap/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = $(PROOF)src/lib/ +LINTDIR = $(PROOF)src/lib/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP= $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/ros.h b/usr/src/contrib/isode/config/ros.h new file mode 100644 index 0000000000..986f81f7cf --- /dev/null +++ b/usr/src/contrib/isode/config/ros.h @@ -0,0 +1,35 @@ +/* ros.h - site configuration file for ROS */ + +/* + * $Header: /f/osi/config/RCS/ros.h,v 7.1 91/02/22 09:16:47 mrose Interim $ + * + * + * $Log: ros.h,v $ + * Revision 7.1 91/02/22 09:16:47 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:26:15 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define ROS /* Ridge's emulation of UNIX */ + +#define TCP /* has TCP/IP */ +#define SOCKETS /* provided by sockets */ + +#endif diff --git a/usr/src/contrib/isode/config/ros.make b/usr/src/contrib/isode/config/ros.make new file mode 100644 index 0000000000..c2ac697225 --- /dev/null +++ b/usr/src/contrib/isode/config/ros.make @@ -0,0 +1,108 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for ROS +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/ros.make,v 7.8 91/02/22 09:16:48 mrose Interim $ +# +# +# $Log: ros.make,v $ +# Revision 7.8 91/02/22 09:16:48 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:25 mrose +# again +# +# Revision 7.6 91/01/14 13:31:22 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:40 mrose +# update +# +# Revision 7.4 90/07/27 08:42:18 mrose +# update +# +# Revision 7.3 90/07/01 21:02:37 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:19 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:08 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:16 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -I/usr/4.2/include $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/4.2/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -ros +MANDIR = /usr/man/ +MANOPTS = -ros + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = rc +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhu $(OPTIONS) +LD = ld +LDCC = $(LD) +LDFLAGS = -V 5 -s /usr/4.2/lib/crt0.o +ARFLAGS = + +LN = ln + +# get 4.2BSD libc +LSOCKET = /usr/4.2/lib/libc.a $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c diff --git a/usr/src/contrib/isode/config/services.local b/usr/src/contrib/isode/config/services.local new file mode 100644 index 0000000000..351470b881 --- /dev/null +++ b/usr/src/contrib/isode/config/services.local @@ -0,0 +1,41 @@ +############################################################################### +# +# isoservices - ISODE Services Database +# +# Mappings between services, selectors, and programs +# +# +# $Header: /f/osi/config/RCS/services.local,v 7.1 91/02/22 09:16:50 mrose Interim $ +# +# +# $Log: services.local,v $ +# Revision 7.1 91/02/22 09:16:50 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:17 mrose +# Release 6.0 +# +############################################################################### + + +############################################################################### +# +# Syntax: +# +# / ... +# +# Each token is separated by LWSP, though double-quotes may be +# used to prevent separation +# +############################################################################### + + +############################################################################### +# locally defined services +# (this section is usually empty...) +############################################################################### + + + +# local additions end here (do not remove this line) + diff --git a/usr/src/contrib/isode/config/solbourne.h b/usr/src/contrib/isode/config/solbourne.h new file mode 100644 index 0000000000..a5a5c3ba23 --- /dev/null +++ b/usr/src/contrib/isode/config/solbourne.h @@ -0,0 +1,46 @@ +/* solbourne.h - site configuration file for solbournes */ + +/* + * $Header: /f/osi/config/RCS/solbourne.h,v 7.2 91/02/22 09:16:50 mrose Interim $ + * + * + * $Log: solbourne.h,v $ + * Revision 7.2 91/02/22 09:16:50 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/09 14:32:55 mrose + * sync + * + * Revision 7.0 89/11/23 21:26:17 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define SUNOS4 /* with Sun's enhancements */ +#define WRITEV /* (sort of) real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define GETDENTS /* has getdirent(2) call */ +#define NFS /* network filesystem -- has getdirentries */ + +#endif diff --git a/usr/src/contrib/isode/config/solbourne.make b/usr/src/contrib/isode/config/solbourne.make new file mode 100644 index 0000000000..276f25e755 --- /dev/null +++ b/usr/src/contrib/isode/config/solbourne.make @@ -0,0 +1,110 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for solbournes +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/solbourne.make,v 7.8 91/02/22 09:16:51 mrose Interim $ +# +# +# $Log: solbourne.make,v $ +# Revision 7.8 91/02/22 09:16:51 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:28 mrose +# again +# +# Revision 7.6 91/01/14 13:31:25 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:42 mrose +# update +# +# Revision 7.4 90/07/27 08:42:17 mrose +# update +# +# Revision 7.3 90/07/01 21:02:39 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:21 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:10 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:18 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/spool/isode/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# -O loses... +CFLAGS = -pipe $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/sunlink3.h b/usr/src/contrib/isode/config/sunlink3.h new file mode 100644 index 0000000000..4b3a11a7b9 --- /dev/null +++ b/usr/src/contrib/isode/config/sunlink3.h @@ -0,0 +1,46 @@ +/* sunlink3.h - site configuration file for SunLink OSI 5.2 on SunOS 3 */ + +/* + * $Header: /f/osi/config/RCS/sunlink3.h,v 7.1 91/02/22 09:16:53 mrose Interim $ + * + * + * $Log: sunlink3.h,v $ + * Revision 7.1 91/02/22 09:16:53 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:26:19 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define X25 /* has X.25 */ +#define SUN_X25 /* provided by SunLink X.25 */ + +#define TP4 /* has TP4 */ +#define SUN_TP4 /* provided by SunLink OSI */ +#define SUNLINK_5_2 /* define if using SunLink OSI release 5.2 + or greater */ + +#define NFS /* network filesystem -- has getdirentries() */ + +#endif diff --git a/usr/src/contrib/isode/config/sunlink3.make b/usr/src/contrib/isode/config/sunlink3.make new file mode 100644 index 0000000000..598ba24a07 --- /dev/null +++ b/usr/src/contrib/isode/config/sunlink3.make @@ -0,0 +1,113 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for +# SunLink OSI 6.0 on SunOS 3 +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sunlink3.make,v 7.8 91/02/22 09:16:53 mrose Interim $ +# +# +# $Log: sunlink3.make,v $ +# Revision 7.8 91/02/22 09:16:53 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:31 mrose +# again +# +# Revision 7.6 91/01/14 13:31:27 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:44 mrose +# update +# +# Revision 7.4 90/07/27 08:42:16 mrose +# update +# +# Revision 7.3 90/07/01 21:02:40 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:23 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:12 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:20 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -I/usr/sunlink/osi/sys $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# -O loses... +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s -L/usr/sunlink/osi/lib +ARFLAGS = + +LN = ln + +LSOCKET = -losi $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +# -x may be harmful on earlier releases of SunOS, your mileage may vary... + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/sunlink4.h b/usr/src/contrib/isode/config/sunlink4.h new file mode 100644 index 0000000000..565f1a8052 --- /dev/null +++ b/usr/src/contrib/isode/config/sunlink4.h @@ -0,0 +1,56 @@ +/* sunlink4.h - site configuration file for SunLink OSI 6.0 on SunOS 4 */ + +/* + * $Header: /f/osi/config/RCS/sunlink4.h,v 7.2 91/02/22 09:16:55 mrose Interim $ + * + * + * $Log: sunlink4.h,v $ + * Revision 7.2 91/02/22 09:16:55 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/09 14:32:58 mrose + * sync + * + * Revision 7.0 89/11/23 21:26:21 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define SUNOS4 /* with Sun's enhancements */ +#define WRITEV /* real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define X25 /* has X.25 */ +#define SUN_X25 /* provided by SunLink X.25 */ + +#define TP4 /* has TP4 */ +#define SUN_TP4 /* provided by SunLink OSI */ +#define SUNLINK_5_2 /* define if using SunLink OSI release 5.2 + or greater */ +#define SUNLINK_6_0 /* define if using SunLink OSI release 6.0 + or greater */ + +#define GETDENTS /* has getdirent(2) call */ +#define NFS /* network filesystem -- has getdirentries() */ + +#endif diff --git a/usr/src/contrib/isode/config/sunlink4.make b/usr/src/contrib/isode/config/sunlink4.make new file mode 100644 index 0000000000..7fc02eb335 --- /dev/null +++ b/usr/src/contrib/isode/config/sunlink4.make @@ -0,0 +1,113 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for +# SunLink OSI 6.0 on SunOS 4 +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sunlink4.make,v 7.8 91/02/22 09:16:56 mrose Interim $ +# +# +# $Log: sunlink4.make,v $ +# Revision 7.8 91/02/22 09:16:56 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:35 mrose +# again +# +# Revision 7.6 91/01/14 13:31:29 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:47 mrose +# update +# +# Revision 7.4 90/07/27 08:42:14 mrose +# update +# +# Revision 7.3 90/07/01 21:02:41 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:25 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:13 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:21 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -I/usr/sunlink/osi/sys $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# -O loses... +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s -L/usr/sunlink/osi/lib +ARFLAGS = + +LN = ln + +LSOCKET = -losi $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +# -x may be harmful on earlier releases of SunOS, your mileage may vary... + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/sunlink7.h b/usr/src/contrib/isode/config/sunlink7.h new file mode 100644 index 0000000000..ea6bce1d38 --- /dev/null +++ b/usr/src/contrib/isode/config/sunlink7.h @@ -0,0 +1,56 @@ +/* sunlink7.h - site configuration file for SunLink OSI and X.25 7.0 on + SunOS 4 */ + +/* + * $Header: /f/osi/config/RCS/sunlink7.h,v 7.1 91/02/22 09:16:57 mrose Interim $ + * + * + * $Log: sunlink7.h,v $ + * Revision 7.1 91/02/22 09:16:57 mrose + * Interim 6.8 + * + * Revision 7.0 90/11/20 15:39:48 mrose + * *** empty log message *** + * + */ + +/* + * 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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define SUNOS4 /* with Sun's enhancements */ +#define WRITEV /* real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define X25 /* has X.25 */ +#define SUN_X25 /* provided by SunLink X.25 */ + +#define TP4 /* has TP4 */ +#define SUN_TP4 /* provided by SunLink OSI */ +#define SUNLINK_5_2 /* define if using SunLink OSI release 5.2 + or greater */ +#define SUNLINK_6_0 /* define if using SunLink OSI release 6.0 + or greater */ +#define SUNLINK_7_0 /* define if using SunLink OSI release 7.0 + or greater */ + +#define GETDENTS /* has getdirent(2) call */ +#define NFS /* network filesystem -- has getdirentries() */ + +#endif diff --git a/usr/src/contrib/isode/config/sunlink7.make b/usr/src/contrib/isode/config/sunlink7.make new file mode 100644 index 0000000000..122a052f83 --- /dev/null +++ b/usr/src/contrib/isode/config/sunlink7.make @@ -0,0 +1,100 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for +# SunLink OSI and X.25 7.0 on SunOS 4 +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sunlink7.make,v 7.4 91/02/22 09:16:58 mrose Interim $ +# +# +# $Log: sunlink7.make,v $ +# Revision 7.4 91/02/22 09:16:58 mrose +# Interim 6.8 +# +# Revision 7.3 91/01/14 13:36:39 mrose +# again +# +# Revision 7.2 91/01/14 13:31:32 mrose +# kerberos +# +# Revision 7.1 90/12/11 10:32:58 mrose +# sync +# +# Revision 7.0 90/11/20 15:39:49 mrose +# *** empty log message *** +# +############################################################################## + +############################################################################## +# +# 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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -I/usr/sunlink/osi/include $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/isode/local/bin/ +SBINDIR = /usr/isode/etc/ +ETCDIR = /usr/isode/etc/ +LOGDIR = /usr/isode/tmp/ +INCDIRM = /usr/isode/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/isode/lib/ +LINTDIR = /usr/isode/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a + +SYSTEM = -bsd42 +MANDIR = /usr/isode/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# -O loses... +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s -L/usr/sunlink/osi/lib +ARFLAGS = + +LN = ln + +LSOCKET = -losi $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +# -x may be harmful on earlier releases of SunOS, your mileage may vary... + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/sunos3.h b/usr/src/contrib/isode/config/sunos3.h new file mode 100644 index 0000000000..6cd9d8ddd1 --- /dev/null +++ b/usr/src/contrib/isode/config/sunos3.h @@ -0,0 +1,38 @@ +/* sunos3.h - site configuration file for SunOS release 3 */ + +/* + * $Header: /f/osi/config/RCS/sunos3.h,v 7.1 91/02/22 09:16:59 mrose Interim $ + * + * + * $Log: sunos3.h,v $ + * Revision 7.1 91/02/22 09:16:59 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:26:22 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define NFS /* network filesystem -- has getdirentries() */ + +#endif diff --git a/usr/src/contrib/isode/config/sunos3.make b/usr/src/contrib/isode/config/sunos3.make new file mode 100644 index 0000000000..1ebe715299 --- /dev/null +++ b/usr/src/contrib/isode/config/sunos3.make @@ -0,0 +1,111 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for SunOS +# release 3 +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sunos3.make,v 7.8 91/02/22 09:17:00 mrose Interim $ +# +# +# $Log: sunos3.make,v $ +# Revision 7.8 91/02/22 09:17:00 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:46 mrose +# again +# +# Revision 7.6 91/01/14 13:31:35 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:50 mrose +# update +# +# Revision 7.4 90/07/27 08:42:13 mrose +# update +# +# Revision 7.3 90/07/01 21:02:17 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:27 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:15 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:23 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# -O loses... +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/sunos4.h b/usr/src/contrib/isode/config/sunos4.h new file mode 100644 index 0000000000..74344975ea --- /dev/null +++ b/usr/src/contrib/isode/config/sunos4.h @@ -0,0 +1,46 @@ +/* sunos4.h - site configuration file for SunOS release 4 */ + +/* + * $Header: /f/osi/config/RCS/sunos4.h,v 7.2 91/02/22 09:17:01 mrose Interim $ + * + * + * $Log: sunos4.h,v $ + * Revision 7.2 91/02/22 09:17:01 mrose + * Interim 6.8 + * + * Revision 7.1 90/07/09 14:33:01 mrose + * sync + * + * Revision 7.0 89/11/23 21:26:24 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define SUNOS4 /* with Sun's enhancements */ +#define WRITEV /* (sort of) real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define GETDENTS /* has getdirent(2) call */ +#define NFS /* network filesystem -- has getdirentries */ + +#endif diff --git a/usr/src/contrib/isode/config/sunos4.make b/usr/src/contrib/isode/config/sunos4.make new file mode 100644 index 0000000000..11f1071f51 --- /dev/null +++ b/usr/src/contrib/isode/config/sunos4.make @@ -0,0 +1,138 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for SunOS +# release 4 +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sunos4.make,v 7.9 91/02/22 09:17:02 mrose Interim $ +# +# +# $Log: sunos4.make,v $ +# Revision 7.9 91/02/22 09:17:02 mrose +# Interim 6.8 +# +# Revision 7.8 91/01/14 13:36:49 mrose +# again +# +# Revision 7.7 91/01/14 13:31:36 mrose +# kerberos +# +# Revision 7.6 90/12/23 17:23:41 mrose +# update +# +# Revision 7.5 90/11/20 15:31:52 mrose +# update +# +# Revision 7.4 90/07/27 08:42:09 mrose +# update +# +# Revision 7.3 90/07/01 21:02:43 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:29 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:16 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:25 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Shared libraries +############################################################################### + +# You can build a shared version of the ISODE library on suns under +# SunOS 4.0 or greater. For non sparc based architecture, any +# release greater than 4.0 will do. However, due to a bug in the +# compiler and the size of ISODE, you will not be able to build a +# shared ISODE unless you have SunOS 4.1 or greater. + +# First, comment out the definitions of LIBISODE and LIBDSAP above + +# Second, uncomment these three lines: + +#SHAREDLIB= shared +#LIBISODE= -L$(TOPDIR) -lisode +#LIBDSAP= -L$(TOPDIR) -ldsap + +# Third, add +# -pic Sun 3 +# -PIC Sparc +# to LIBCFLAGS below + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# -O loses... +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/config/sys52-exos.h b/usr/src/contrib/isode/config/sys52-exos.h new file mode 100644 index 0000000000..e178ac051a --- /dev/null +++ b/usr/src/contrib/isode/config/sys52-exos.h @@ -0,0 +1,41 @@ +/* sys52-exos.h - site configuration file for SVR2 with EXOS 8044 card */ + +/* + * $Header: /f/osi/config/RCS/sys52-exos.h,v 7.1 91/02/22 09:17:03 mrose Interim $ + * + * + * $Log: sys52-exos.h,v $ + * Revision 7.1 91/02/22 09:17:03 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:26:26 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define SYS5 /* AT&T UNIX */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP */ +#define EXOS /* provided by EXOS 8044 card */ + +#ifdef sgi /* screwy compiler! */ +#define register +#endif + +#endif diff --git a/usr/src/contrib/isode/config/sys52-exos.make b/usr/src/contrib/isode/config/sys52-exos.make new file mode 100644 index 0000000000..ba23a6c105 --- /dev/null +++ b/usr/src/contrib/isode/config/sys52-exos.make @@ -0,0 +1,109 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for SVR2 with +# EXOS 8044 card +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sys52-exos.make,v 7.8 91/02/22 09:17:04 mrose Interim $ +# +# +# $Log: sys52-exos.make,v $ +# Revision 7.8 91/02/22 09:17:04 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:52 mrose +# again +# +# Revision 7.6 91/01/14 13:31:38 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:54 mrose +# update +# +# Revision 7.4 90/07/27 08:42:06 mrose +# update +# +# Revision 7.3 90/07/01 21:02:44 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:33 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:18 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:26 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -I/usr/include/EXOS $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -sys5 +MANDIR = /usr/man/ +MANOPTS = -sys5 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -ns +ARFLAGS = + +LN = ln + +# EXOS 8044 TCP/IP software +LSOCKET = -lsocket $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c diff --git a/usr/src/contrib/isode/config/sys52-rt.h b/usr/src/contrib/isode/config/sys52-rt.h new file mode 100644 index 0000000000..eda61b1359 --- /dev/null +++ b/usr/src/contrib/isode/config/sys52-rt.h @@ -0,0 +1,41 @@ +/* sys52-rt.h - site configuration file for RT PC running AIX */ + +/* + * $Header: /f/osi/config/RCS/sys52-rt.h,v 7.1 91/02/22 09:17:05 mrose Interim $ + * + * Contributed by by Jacob Rekhter, T.J. Watson Research Center, IBM Corp. + * + * + * $Log: sys52-rt.h,v $ + * Revision 7.1 91/02/22 09:17:05 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:26:27 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define SYS5 /* AT&T UNIX */ +#define AIX /* with IBMs running AIX */ +#define RT /* on the RT/PC */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP */ +#define SOCKETS /* provided by sockets */ + +#endif diff --git a/usr/src/contrib/isode/config/sys52-rt.make b/usr/src/contrib/isode/config/sys52-rt.make new file mode 100644 index 0000000000..3139197d48 --- /dev/null +++ b/usr/src/contrib/isode/config/sys52-rt.make @@ -0,0 +1,111 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for RT PC +# running AIX +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sys52-rt.make,v 7.8 91/02/22 09:17:06 mrose Interim $ +# +# Contributed by by Jacob Rekhter, T.J. Watson Research Center, IBM Corp. +# +# +# $Log: sys52-rt.make,v $ +# Revision 7.8 91/02/22 09:17:06 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:55 mrose +# again +# +# Revision 7.6 91/01/14 13:31:39 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:31:57 mrose +# update +# +# Revision 7.4 90/07/27 08:42:05 mrose +# update +# +# Revision 7.3 90/07/01 21:02:46 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:34 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:20 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:28 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -I/usr/include/bsd -DDEBUG -Nn2000 $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -aix +MANDIR = /usr/man/ +MANOPTS = -aix + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -ns +ARFLAGS = + +LN = ln + +# AIX TCP/IP software +LSOCKET = -lsock -lbsd $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c diff --git a/usr/src/contrib/isode/config/sys52-sun.h b/usr/src/contrib/isode/config/sys52-sun.h new file mode 100644 index 0000000000..a21e907bca --- /dev/null +++ b/usr/src/contrib/isode/config/sys52-sun.h @@ -0,0 +1,39 @@ +/* sys52-sun.h - site configuration file for SUN's SVR2 Compatiblity Package */ + +/* + * $Header: /f/osi/config/RCS/sys52-sun.h,v 7.1 91/02/22 09:17:07 mrose Interim $ + * + * + * $Log: sys52-sun.h,v $ + * Revision 7.1 91/02/22 09:17:07 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:26:29 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define SYS5 /* AT&T UNIX emulation */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP */ +#define SOCKETS /* provided by sockets */ + +#define NFS /* network filesystem -- has getdirentries() */ + +#endif diff --git a/usr/src/contrib/isode/config/sys52-sun.make b/usr/src/contrib/isode/config/sys52-sun.make new file mode 100644 index 0000000000..13513a6334 --- /dev/null +++ b/usr/src/contrib/isode/config/sys52-sun.make @@ -0,0 +1,112 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes under SUN's SVR2 +# Compatibility Package +# +# BE SURE TO HAVE /usr/5bin FIRST IN YOUR $PATH +# +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sys52-sun.make,v 7.8 91/02/22 09:17:10 mrose Interim $ +# +# +# $Log: sys52-sun.make,v $ +# Revision 7.8 91/02/22 09:17:10 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:57 mrose +# again +# +# Revision 7.6 91/01/14 13:31:41 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:32:02 mrose +# update +# +# Revision 7.4 90/07/27 08:42:03 mrose +# update +# +# Revision 7.3 90/07/01 21:02:48 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:35 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:21 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:30 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +# -O loses... +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c diff --git a/usr/src/contrib/isode/config/sys52-win.h b/usr/src/contrib/isode/config/sys52-win.h new file mode 100644 index 0000000000..78f9af4363 --- /dev/null +++ b/usr/src/contrib/isode/config/sys52-win.h @@ -0,0 +1,38 @@ +/* sys52-win.h - site configuration file for SVR2 with WIN/TCP */ + +/* + * $Header: /f/osi/config/RCS/sys52-win.h,v 7.1 91/02/22 09:17:11 mrose Interim $ + * + * + * $Log: sys52-win.h,v $ + * Revision 7.1 91/02/22 09:17:11 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:26:30 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define SYS5 /* AT&T UNIX */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP */ +#define SOCKETS /* provided by sockets */ +#define WIN /* emulated by WIN/TCP for SVR2 */ + +#endif diff --git a/usr/src/contrib/isode/config/sys52-win.make b/usr/src/contrib/isode/config/sys52-win.make new file mode 100644 index 0000000000..7feda50b78 --- /dev/null +++ b/usr/src/contrib/isode/config/sys52-win.make @@ -0,0 +1,109 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for SVR2 with +# WIN/TCP +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sys52-win.make,v 7.8 91/02/22 09:17:12 mrose Interim $ +# +# +# $Log: sys52-win.make,v $ +# Revision 7.8 91/02/22 09:17:12 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:36:59 mrose +# again +# +# Revision 7.6 91/01/14 13:31:42 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:32:05 mrose +# update +# +# Revision 7.4 90/07/27 08:42:00 mrose +# update +# +# Revision 7.3 90/07/01 21:02:50 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:37 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:22 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:31 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h -I/usr/netinclude $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -sys5 +MANDIR = /usr/man/ +MANOPTS = -sys5 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = +ARFLAGS = + +LN = ln + +# WIN TCP/IP software +LSOCKET = -lnet $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c diff --git a/usr/src/contrib/isode/config/sys53.h b/usr/src/contrib/isode/config/sys53.h new file mode 100644 index 0000000000..3601e1289d --- /dev/null +++ b/usr/src/contrib/isode/config/sys53.h @@ -0,0 +1,38 @@ +/* sys53.h - site configuration file for generic SVR3 */ + +/* + * $Header: /f/osi/config/RCS/sys53.h,v 7.1 91/02/22 09:17:13 mrose Interim $ + * + * + * $Log: sys53.h,v $ + * Revision 7.1 91/02/22 09:17:13 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:28:02 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define SYS5 /* AT&T UNIX */ +#define SVR3 /* Systems V Release 3 */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP */ +#define SOCKETS /* provided by sockets */ + +#endif diff --git a/usr/src/contrib/isode/config/sys53.make b/usr/src/contrib/isode/config/sys53.make new file mode 100644 index 0000000000..e2e383fc1d --- /dev/null +++ b/usr/src/contrib/isode/config/sys53.make @@ -0,0 +1,108 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for generic SVR3 +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/sys53.make,v 7.8 91/02/22 09:17:14 mrose Interim $ +# +# +# $Log: sys53.make,v $ +# Revision 7.8 91/02/22 09:17:14 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:37:01 mrose +# again +# +# Revision 7.6 91/01/14 13:31:44 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:32:07 mrose +# update +# +# Revision 7.4 90/07/27 08:41:59 mrose +# update +# +# Revision 7.3 90/07/01 21:02:54 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:38 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:24 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:28:03 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +# add -Iwhatever to get include files for socket calls +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -sys5 +MANDIR = /usr/man/ +MANOPTS = -sys5 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c diff --git a/usr/src/contrib/isode/config/ultrix.h b/usr/src/contrib/isode/config/ultrix.h new file mode 100644 index 0000000000..694526900d --- /dev/null +++ b/usr/src/contrib/isode/config/ultrix.h @@ -0,0 +1,48 @@ +/* ultrix.h - site configuration file for Ultrix 3.1 */ + +/* + * $Header: /f/osi/config/RCS/ultrix.h,v 7.3 91/02/22 09:17:15 mrose Interim $ + * + * + * $Log: ultrix.h,v $ + * Revision 7.3 91/02/22 09:17:15 mrose + * Interim 6.8 + * + * Revision 7.2 90/10/17 14:32:31 mrose + * update + * + * Revision 7.1 90/07/09 14:33:09 mrose + * sync + * + * Revision 7.0 89/11/23 21:26:32 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ +#define BSD43 /* 4.3BSD networking or later */ + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ +#define BIND /* has h_addr_list in netdb.h */ + +#define GETDENTS /* has getdirent(2) call */ + +#endif diff --git a/usr/src/contrib/isode/config/ultrix.make b/usr/src/contrib/isode/config/ultrix.make new file mode 100644 index 0000000000..fcc68efe0c --- /dev/null +++ b/usr/src/contrib/isode/config/ultrix.make @@ -0,0 +1,109 @@ +############################################################################### +# Instructions to Make, for compilation of ISODE processes for Ultrix 3.1 +############################################################################### + +############################################################################### +# +# $Header: /f/osi/config/RCS/ultrix.make,v 7.8 91/02/22 09:17:16 mrose Interim $ +# +# +# $Log: ultrix.make,v $ +# Revision 7.8 91/02/22 09:17:16 mrose +# Interim 6.8 +# +# Revision 7.7 91/01/14 13:37:03 mrose +# again +# +# Revision 7.6 91/01/14 13:31:45 mrose +# kerberos +# +# Revision 7.5 90/11/20 15:32:10 mrose +# update +# +# Revision 7.4 90/07/27 08:41:57 mrose +# update +# +# Revision 7.3 90/07/01 21:02:56 mrose +# pepsy +# +# Revision 7.2 90/04/18 08:45:39 mrose +# MANDIR +# +# Revision 7.1 90/03/06 13:56:25 mrose +# touch-up +# +# Revision 7.0 89/11/23 21:26:33 mrose +# Release 6.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. +# +############################################################################### + + +############################################################################### +# Options +############################################################################### + +OPTIONS = -I. -I$(TOPDIR)h $(PEPYPATH) $(KRBOPT) + +HDIR = $(TOPDIR)h/ +UTILDIR = $(TOPDIR)util/ +BINDIR = /usr/local/bin/ +SBINDIR = /usr/etc/ +ETCDIR = /usr/etc/ +LOGDIR = /usr/tmp/ +INCDIRM = /usr/include/isode +INCDIR = $(INCDIRM)/ +PEPYDIRM= $(INCDIR)pepy +PEPYDIR = $(PEPYDIRM)/ +PEPSYDIRM= $(INCDIR)pepsy +PEPSYDIR= $(PEPSYDIRM)/ +LIBDIR = /usr/lib/ +LINTDIR = /usr/lib/lint/ + +LIBISODE= $(TOPDIR)libisode.a +LIBDSAP = $(TOPDIR)libdsap.a + +SYSTEM = -bsd42 +MANDIR = /usr/man/ +MANOPTS = -bsd42 + + +############################################################################### +# Programs and Libraries +############################################################################### + +MAKE = ./make DESTDIR=$(DESTDIR) $(MFLAGS) -k +SHELL = /bin/sh + +CC = cc +CFLAGS = -O $(OPTIONS) +LIBCFLAGS= $(CFLAGS) +LINT = lint +LFLAGS = -bhuz $(OPTIONS) +LD = ld +LDCC = $(CC) +LDFLAGS = -s +ARFLAGS = + +LN = ln + +LSOCKET = $(KRBLIB) + + +############################################################################### +# Generation Rules for library modules +############################################################################### + +.c.o:; $(CC) $(LIBCFLAGS) -c $*.c + -ld -x -r $@ + mv a.out $@ diff --git a/usr/src/contrib/isode/dirent/Makefile b/usr/src/contrib/isode/dirent/Makefile new file mode 100644 index 0000000000..1f6efa3101 --- /dev/null +++ b/usr/src/contrib/isode/dirent/Makefile @@ -0,0 +1,129 @@ +############################################################################### +# Instructions to Make, for compilation of UNIX compatibility library +############################################################################### + + +############################################################################### +# +# This package was generously supplied by Doug Gwyn. It is a public domain +# implementation of the SVR3 directory access routines. +# +# I have slightly edited the package to produce a stand-alone library +# (normally it updates libc.a). The reason for this, is that the package +# is used primarily for ISODE's ftam responder, and it's too much heartburn +# to ask someone to reload libc.a just for that (sorry, doug!) +# +# I've also prepended a "_" to the names to avoid any conflicts with routines +# which might already be installed (especially for lint) +# +############################################################################### + +LIBES = libdirent.a $(TOPDIR)libcompat.a +LLIBS = +HFILES = $(HDIR)usr.dirent.h $(HDIR)sys.dirent.h + + +################################################################## +# Here it is... +################################################################## + +all: libdirent testdir +inst-all: # inst-libdirent manuals +install: install +lint: l-libdirent l-testdir + + +################################################################ +# libdirent +################################################################ + +CFILES = closedir.c getdents.c opendir.c readdir.c rewinddir.c \ + seekdir.c telldir.c getcwd.c scandir.c +OFILES = closedir.o getdents.o opendir.o readdir.o rewinddir.o \ + seekdir.o telldir.o getcwd.o scandir.o + + +inst-libdirent: $(LIBDIR)libdirent.a $(LINTDIR)llib-ldirent + +$(LIBDIR)libdirent.a: libdirent.a + -rm -f $@ + cp libdirent.a $@ + @$(UTILDIR)make-lib.sh $(SYSTEM) $@ -ranlib + -@ls -gls $@ + -@echo "" + +$(LINTDIR)llib-ldirent: llib-ldirent + -cp $@ zllib-ldirent + -rm -f $@ + sed -e 's%#include "\(.*\)"%#include "$(INCDIR)\1"%' \ + < llib-ldirent | \ + sed -e 's%#include "/usr/include/\(.*\)"%#include <\1>%' > $@ + @$(UTILDIR)inst-lint.sh $(SYSTEM) $(OPTIONS) $@ + -@ls -gls $@ $@.ln + -@echo "" + +libdirent: libdirent.a + +libdirent.a: direntvrsn.o + -rm -f $@ + @$(UTILDIR)make-lib.sh $(SYSTEM) $(ARFLAGS) $@ $(OFILES) \ + direntvrsn.o + -@rm -f $(TOPDIR)libdirent.a $(TOPDIR)llib-ldirent + -@$(LN) libdirent.a $(TOPDIR)libdirent.a + -@$(LN) llib-ldirent $(TOPDIR)llib-ldirent + -@ls -l $@ + -@echo "DIRENT library built normally" + +direntvrsn.c: $(OFILES) + @$(UTILDIR)version.sh dirent > $@ + +l-libdirent:; $(LINT) $(LFLAGS) $(CFILES) direntvrsn.c $(LLIBS) \ + | grep -v "warning: possible pointer alignment problem" + +closedir.o: $(HFILES) +getdents.o: $(HFILES) $(HDIR)config.h +opendir.o: $(HFILES) +readdir.o: $(HFILES) +rewinddir.o: $(HFILES) +seekdir.o: $(HFILES) +telldir.o: $(HFILES) +getcwd.o: $(HFILES) +scandir.o: $(HFILES) + + +################################################################ +# testdir +################################################################ + +testdir: testdir.o $(LIBES) + $(LDCC) $(LDFLAGS) -o $@ testdir.o $(LIBES) $(LSOCKET) + +testdir.o: $(HFILES) + $(CC) $(CFLAGS) -c $*.c + +l-testdir:; $(LINT) $(LFLAGS) testdir.c llib-ldirent \ + | grep -v "warning: possible pointer alignment problem" + + +################################################################ +# manual pages +################################################################ + +MANUALS = directory.3c dirent.4 getdents.2 + +manuals:; @$(UTILDIR)inst-man.sh $(MANOPTS) $(MANUALS) + -@echo "" + + +################################################################ +# clean +################################################################ + +clean:; rm -f *.o *.a z* _* core testdir direntvrsn.c + +grind:; iprint Makefile + tgrind -lc $(CFILES) direntvrsn.c testdir.c + @echo $(MANUALS) | \ + tr " " "\012" | \ + sed -e "s%.*%itroff -man &%" | \ + sh -ve diff --git a/usr/src/contrib/isode/dirent/NOTES b/usr/src/contrib/isode/dirent/NOTES new file mode 100644 index 0000000000..b51adc7f3e --- /dev/null +++ b/usr/src/contrib/isode/dirent/NOTES @@ -0,0 +1,108 @@ + + +NOTES FOR NEARLY-POSIX-COMPATIBLE C LIBRARY DIRECTORY-ACCESS ROUTINES + + +Older UNIX C libraries lacked support for reading directories, so historically +programs had knowledge of UNIX directory structure hard-coded into them. When +Berkeley changed the format of directories for 4.2BSD, it became necessary to +change programs to work with the new structure. Fortunately, Berkeley designed +a small set of directory access routines to encapsulate knowledge of the new +directory format so that user programs could deal with directory entries as an +abstract data type. (Unfortunately, they didn't get it quite right.) The +interface to these routines was nearly independent of the particular +implementation of directories on any given UNIX system; this has become a +particularly important requirement with the advent of heterogeneous network +filesystems such as NFS. + +It has consequently become possible to write portable applications that search +directories by restricting all directory access to use these new interface +routines. The sources supplied here are a total rewrite of Berkeley's code, +incorporating ideas from a variety of sources and conforming as closely to +published standards as possible, and are in the PUBLIC DOMAIN to encourage +their widespread adoption. They support four methods of access to system +directories: the original UNIX filesystem via read(), the 4.2BSD filesystem via +read(), NFS and native filesystems via getdirentries(), and SVR3 getdents(). +The other three types are accomplished by appropriate emulation of the SVR3 +getdents() system call, which attains portability at the cost of slightly more +data movement than absolutely necessary for some systems. These routines +should be added to the standard C library on all UNIX systems, and all existing +and future applications should be changed to use this interface. Once this is +done, there should be no portability problems due to differences in underlying +directory structures among UNIX systems. (When porting your applications to +other UNIX systems, you can always carry this package around with you.) + +An additional benefit of these routines is that they buffer directory input, +which provides improved access speed over raw read()s of one entry at a time. + +One annoying compatibility problem has arisen along the way, namely that the +original Berkeley interface used the same name, struct direct, for the new data +structure as had been used for the original UNIX filesystem directory record +structure. This name was changed by the IEEE 1003.1 (POSIX) Working Group to +"struct dirent" and was picked up for SVR3 under the new name; it is also the +name used in this portable package. I believe it is necessary to bite the +bullet and adopt the new non-conflicting name. Code using a 4.2BSD-compatible +package needs to be slightly revised to work with this new package, as follows: + Change + #include /* Ninth Edition UNIX */ + or + #include /* 4.2BSD */ + or + #include /* BRL System V emulation */ + to + #include /* if not already #included */ + #include + + Change + struct direct + to + struct dirent + + Change + (anything)->d_namlen + to + strlen( (anything)->d_name ) + +There is a minor compatibility problem in that the closedir() function was +originally defined to have type void, but IEEE 1003.1 changed this to type int, +which is what this implementation supports (even though I disagree with the +change). However, the difference does not affect most applications. + +Another minor problem is that IEEE 1003.1 defined the d_name member of a struct +dirent to be an array of maximum length; this does not permit use of compact +variable-length entries directly from a directory block buffer. This part of +the specification is incompatible with efficient use of the getdents() system +call, and I have therefore chosen to follow the SVID specification instead of +IEEE 1003.1 (which I hope is changed for the final-use standard). This +deviation should have little or no impact on sensibly-coded applications, since +the relevant d_name length is that given by strlen(), not the declared array +size. + +Error handling is not completely satisfactory, due to the variety of possible +failure modes in a general setting. For example, the rewinddir() function +might fail, but there is no good way to indicate this. I have tried to +follow the specifications in IEEE 1003.1 and the SVID as closely as possible, +but there are minor deviations in this regard. Applications should not rely +too heavily on exact failure mode semantics. + +Please do not change the new standard interface in any way, as that would +defeat the major purpose of this package! (It's okay to alter the internal +implementation if you really have to, although I tried to make this unnecessary +for the vast majority of UNIX variants.) + +Installation instructions can be found in the file named INSTALL. + +This implementation is provided by: + + Douglas A. Gwyn + U.S. Army Ballistic Research Laboratory + SLCBR-VL-V + Aberdeen Proving Ground, MD 21005-5066 + + (301)278-6647 + + Gwyn@BRL.MIL or seismo!brl!gwyn + +This is UNSUPPORTED, use-at-your-own-risk, free software in the public domain. +However, I would appreciate hearing of any actual bugs you find in this +implementation and/or any improvements you come up with. diff --git a/usr/src/contrib/isode/dirent/closedir.c b/usr/src/contrib/isode/dirent/closedir.c new file mode 100644 index 0000000000..409a909e15 --- /dev/null +++ b/usr/src/contrib/isode/dirent/closedir.c @@ -0,0 +1,42 @@ +/* + closedir -- close a directory stream + + last edit: 25-Apr-1987 D A Gwyn +*/ + +#include +#include +#include "usr.dirent.h" + +#ifndef GETDENTS +typedef char *pointer; /* (void *) if you have it */ + +extern void free(); +extern int close(); + +extern int errno; + +#ifndef NULL +#define NULL 0 +#endif + +int +closedir( dirp ) + register DIR *dirp; /* stream from opendir() */ + { + register int fd; + + if ( dirp == NULL || dirp->dd_buf == NULL ) + { + errno = EFAULT; + return -1; /* invalid pointer */ + } + + fd = dirp-> dd_fd; + free( (pointer)dirp->dd_buf ); + free( (pointer)dirp ); + return close( fd ); + } +#else +int _closedir_stub () {}; +#endif diff --git a/usr/src/contrib/isode/dirent/directory.3c b/usr/src/contrib/isode/dirent/directory.3c new file mode 100644 index 0000000000..7fa628923d --- /dev/null +++ b/usr/src/contrib/isode/dirent/directory.3c @@ -0,0 +1,198 @@ +.TH DIRECTORY 3C "Standard Extension" +.SH NAME +opendir, readdir, telldir, seekdir, rewinddir, closedir \- directory operations +.SH SYNOPSIS +.B "#include " +.br +.B "#include " +.P +.B "DIR \(**opendir (dirname)" +.br +.B "char \(**dirname;" +.P +.B "struct dirent \(**readdir (dirp)" +.br +.B "DIR \(**dirp;" +.P +.B "off_t telldir (dirp)" +.br +.B "DIR \(**dirp;" +.P +.B "void seekdir (dirp, loc)" +.br +.B "DIR \(**dirp;" +.br +.B "off_t loc;" +.P +.B "void rewinddir (dirp)" +.br +.B "DIR \(**dirp;" +.P +.B "int closedir (dirp)" +.br +.B "DIR \(**dirp;" +.SH DESCRIPTION +.I Opendir +establishes a connection between +the directory named by +.I dirname +and a unique object of type +.SM DIR +known as a +.I "directory stream" +that it creates. +.I Opendir +returns a pointer to be used to identify the +directory stream +in subsequent operations. +A +.SM NULL +pointer is returned if +.I dirname +cannot be accessed or is not a directory, +or if +.I opendir +is unable to create the +.SM DIR +object +(perhaps due to insufficient memory). +.P +.I Readdir +returns a pointer to an internal structure +containing information about the next active directory entry. +No inactive entries are reported. +The internal structure may be overwritten by +another operation on the same +directory stream; +the amount of storage needed to hold a copy +of the internal structure is given by the value of a macro, +.IR DIRENTSIZ(strlen(direntp\->d_name)) , +not by +.I "sizeof(struct\ dirent)" +as one might expect. +A +.SM NULL +pointer is returned +upon reaching the end of the directory, +upon detecting an invalid location in the directory, +or upon occurrence of an error while reading the directory. +.P +.I Telldir +returns the current position associated with the named +directory stream +for later use as an argument to +.IR seekdir . +.P +.I Seekdir +sets the position of the next +.I readdir +operation on the named +directory stream. +The new position reverts to the one associated with the +directory stream +when the +.I telldir +operation from which +.I loc +was obtained was performed. +.P +.I Rewinddir +resets the position of the named +directory stream +to the beginning of the directory. +All buffered data for the directory stream is discarded, +thereby guaranteeing that the actual +file system directory will be referred to for the next +.I readdir +on the +directory stream. +.P +.I Closedir +closes the named +directory stream; +internal resources used for the +directory stream are liberated, +and subsequent use of the associated +.SM DIR +object is no longer valid. +.I Closedir +returns a value of zero if no error occurs, +\-1 otherwise. +.P +There are several possible errors that can occur +as a result of these operations; +the external integer variable +.I errno +is set to indicate the specific error. +.RI ( Readdir 's +detection of the normal end of a directory +is not considered to be an error.) +.SH EXAMPLE +Sample code which searches the current working directory for entry +.IR name : +.sp +.P +.ft B + dirp = opendir( "." ); +.br + while ( (dp = readdir( dirp )) != NULL ) +.br + if ( strcmp( dp\->d_name, name ) == 0 ) +.br + { +.br + (void) closedir( dirp ); +.br + return FOUND; +.br + } +.br + (void) closedir( dirp ); +.br + return NOT_FOUND; +.ft P +.sp +.SH "SEE ALSO" +getdents(2), dirent(4). +.SH WARNINGS +Entries for "." and ".." +may not be reported for some file system types. +.P +The value returned by +.I telldir +need not have any simple interpretation +and should only be used as an argument to +.IR seekdir . +Similarly, +the +.I loc +argument to +.I seekdir +must be obtained from a previous +.I telldir +operation on the same +directory stream. +.P +.I Telldir +and +.I seekdir +are unreliable when used in conjunction with +file systems that perform directory compaction or expansion +or when the directory stream has been closed and reopened. +It is best to avoid using +.I telldir +and +.I seekdir +altogether. +.P +The exact set of +.I errno +values and meanings may vary among implementations. +.P +Because directory entries can dynamically +appear and disappear, +and because directory contents are buffered +by these routines, +an application may need to continually rescan +a directory to maintain an accurate picture +of its active entries. diff --git a/usr/src/contrib/isode/dirent/dirent.4 b/usr/src/contrib/isode/dirent/dirent.4 new file mode 100644 index 0000000000..581fd22dc9 --- /dev/null +++ b/usr/src/contrib/isode/dirent/dirent.4 @@ -0,0 +1,72 @@ +.TH DIRENT 4 "Standard Extension" +.SH NAME +dirent \- file system independent directory entry +.SH SYNOPSIS +.B "#include " +.br +.B "#include " +.SH DESCRIPTION +Different file system types +may have different directory entries. +The +.I dirent +structure defines a +file system independent directory entry, +which contains information common to +directory entries in different file system types. +A set of these structures is returned by the +.IR getdents (2) +system call. +.P +The +.I dirent +structure is defined below. +.sp +struct dirent { +.br + long d_ino; +.br + off_t d_off; +.br + unsigned short d_reclen; +.br + char d_name[1]; +.br + }; +.P +.sp +The field +.I d_ino +is a number which is unique +for each file in the file system. +The field +.I d_off\^ +represents an offset of that directory entry +in the actual file system directory. +The field +.I d_name +is the beginning of the character array +giving the name of the directory entry. +This name is null terminated +and may have at most +.SM NAME_MAX +characters in addition to the null terminator. +This results in file system independent directory entries +being variable-length entities. +The value of +.I d_reclen +is the record length of this entry. +This length is defined to be the number of bytes +between the beginning of the current entry and the next one, +adjusted so that the next entry +will start on a long boundary. +.SH FILES +\*(IDsys.dirent.h +.SH "SEE ALSO" +getdents(2). +.SH WARNING +The field +.I d_off\^ +does not have a simple interpretation +for some file system types +and should not be used directly by applications. diff --git a/usr/src/contrib/isode/dirent/getcwd.c b/usr/src/contrib/isode/dirent/getcwd.c new file mode 100644 index 0000000000..228fd77154 --- /dev/null +++ b/usr/src/contrib/isode/dirent/getcwd.c @@ -0,0 +1,202 @@ +/* + getcwd -- get current working directory name (POSIX and SVID compatible) + + last edit: 21-Sep-1987 D A Gwyn + + This public-domain getcwd() routine can be used to replace the UNIX + System V library routine (which uses popen() to capture the output of + the "pwd" command). Once that is done, "pwd" can be reimplemented as + just puts(getcwd()). + + This implementation depends on every directory having entries for + "." and "..". It also depends on the internals of the + data structures to some degree. + + I considered using chdir() to ascend the hierarchy, followed by a + final chdir() to the path being returned by getcwd() to restore the + location, but decided that error recovery was too difficult that way. + The algorithm I settled on was inspired by my rewrite of the "pwd" + utility, combined with the dotdots[] array trick from the SVR2 shell. +*/ + +#include +#include +#include "usr.dirent.h" +#include + +typedef char *pointer; /* (void *) if you have it */ + +extern void free(); +extern pointer malloc(); +extern int fstat(), stat(); + +extern int errno; /* normally done by */ + +#ifndef NULL +#define NULL 0 /* amorphous null pointer constant */ +#endif + +#ifndef NAME_MAX +#define NAME_MAX 255 /* maximum directory entry size */ +#endif + +char * +getcwd( buf, size ) /* returns pointer to CWD pathname */ + char *buf; /* where to put name (NULL to malloc) */ + int size; /* size of buf[] or malloc()ed memory */ + { + static char dotdots[] = +"../../../../../../../../../../../../../../../../../../../../../../../../../.."; + char *dotdot; /* -> dotdots[.], right to left */ + DIR *dirp; /* -> parent directory stream */ + struct dirent *dir; /* -> directory entry */ + struct stat stat1, stat2; /* info from stat() */ + struct stat *d = &stat1; /* -> info about "." */ + struct stat *dd = &stat2; /* -> info about ".." */ + register char *buffer; /* local copy of buf, or malloc()ed */ + char *bufend; /* -> buffer[size] */ + register char *endp; /* -> end of reversed string */ + register char *dname; /* entry name ("" for root) */ + int serrno = errno; /* save entry errno */ + + if ( size == 0 ) + { + errno = EINVAL; /* invalid argument */ + return NULL; + } + + if ( (buffer = buf) == NULL /* wants us to malloc() the string */ + && (buffer = (char *)malloc( (unsigned)size )) == NULL + ) { + errno = ENOMEM; /* cannot malloc() specified size */ + return NULL; + } + + if ( stat( ".", dd ) != 0 ) /* prime the pump */ + goto error; /* errno already set */ + + endp = buffer; /* initially, empty string */ + bufend = &buffer[size]; + + for ( dotdot = &dotdots[sizeof(dotdots)]; dotdot != dotdots; ) + { + dotdot -= 3; /* include one more "/.." section */ + /* (first time is actually "..") */ + + /* swap stat() info buffers */ + { + register struct stat *temp = d; + + d = dd; /* new current dir is old parent dir */ + dd = temp; + } + + if ( (dirp = opendir( dotdot )) == NULL ) /* new parent */ + goto error; /* errno already set */ + + if ( fstat( dirp->dd_fd, dd ) != 0 ) + { + serrno = errno; /* set by fstat() */ + (void)closedir( dirp ); + errno = serrno; /* in case closedir() clobbered it */ + goto error; + } + + if ( d->st_dev == dd->st_dev ) + { /* not crossing a mount point */ + if ( d->st_ino == dd->st_ino ) + { /* root directory */ + dname = ""; + goto append; + } + + do + if ( (dir = readdir( dirp )) == NULL ) + { + (void)closedir( dirp ); + errno = ENOENT; /* missing entry */ + goto error; + } + while ( dir->d_ino != d->st_ino ); + } + else { /* crossing a mount point */ + struct stat t; /* info re. test entry */ + char name[sizeof(dotdots) + 1 + NAME_MAX]; + + (void)strcpy( name, dotdot ); + dname = &name[strlen( name )]; + *dname++ = '/'; + + do { + if ( (dir = readdir( dirp )) == NULL ) + { + (void)closedir( dirp ); + errno = ENOENT; /* missing entry */ + goto error; + } + + (void)strcpy( dname, dir->d_name ); + /* must fit if NAME_MAX is not a lie */ + } + while ( stat( name, &t ) != 0 + || t.st_ino != d->st_ino + || t.st_dev != d->st_dev + ); + } + + dname = dir->d_name; + + /* append "/" and reversed dname string onto buffer */ + append: + if ( endp != buffer /* avoid trailing / in final name */ + || dname[0] == '\0' /* but allow "/" when CWD is root */ + ) + *endp++ = '/'; + + { + register char *app; /* traverses dname string */ + + for ( app = dname; *app != '\0'; ++app ) + ; + + if ( app - dname >= bufend - endp ) + { + (void)closedir( dirp ); + errno = ERANGE; /* won't fit allotted space */ + goto error; + } + + while ( app != dname ) + *endp++ = *--app; + } + + (void)closedir( dirp ); + + if ( dname[0] == '\0' ) /* reached root; wrap it up */ + { + register char *startp; /* -> buffer[.] */ + + *endp = '\0'; /* plant null terminator */ + + /* straighten out reversed pathname string */ + for ( startp = buffer; --endp > startp; ++startp ) + { + char temp = *endp; + + *endp = *startp; + *startp = temp; + } + + errno = serrno; /* restore entry errno */ + return buffer; + } + } + + errno = ENOMEM; /* actually, algorithm failure */ + + error: + if ( buf == NULL ) + free( (pointer)buffer ); + + return NULL; + } diff --git a/usr/src/contrib/isode/dirent/getdents.2 b/usr/src/contrib/isode/dirent/getdents.2 new file mode 100644 index 0000000000..ed0fecadae --- /dev/null +++ b/usr/src/contrib/isode/dirent/getdents.2 @@ -0,0 +1,86 @@ +.TH GETDENTS 2 "Standard Extension" +.SH NAME +getdents \- get directory entries in a file system independent format +.SH SYNOPSIS +.B "#include " +.br +.B "#include " +.P +.B "int getdents (fildes, buf, nbyte)" +.br +.B "int fildes;" +.br +.B "char \(**buf;" +.br +.B "unsigned nbyte;" +.SH DESCRIPTION +.I Fildes +is a file descriptor obtained from an +.IR open (2) +or +.IR dup (2) +system call. +.P +.I Getdents +attempts to read +.I nbyte +bytes from the directory associated with +.I fildes +and to format them as +file system independent entries +in the buffer pointed to by +.IR buf . +Since the file system independent directory entries +are of variable length, +in most cases the actual number of bytes returned +will be less than +.IR nbyte . +.P +The file system independent directory entry is specified by the +.I dirent +structure. +For a description of this see +.IR dirent (4). +.P +On devices capable of seeking, +.I getdents +starts at a position in the file given by +the file pointer associated with +.IR fildes . +Upon return from +.IR getdents , +the file pointer has been incremented +to point to the next directory entry. +.P +This system call was developed in order to implement the +.I readdir +routine +[for a description see +.IR directory (3C)] +and should not be used for other purposes. +.SH "SEE ALSO" +directory(3C), dirent(4). +.SH DIAGNOSTICS +Upon successful completion +a non-negative integer is returned +indicating the number of bytes of +.I buf\^ +actually filled. +(This need not be the number actually used +in the actual directory file.)\|\| +A value of zero +indicates the end of the directory has been reached. +If +.I getdents +fails for any other reason, +a value of \-1 is returned and +the external integer variable +.I errno +is set to indicate the error. +.SH WARNINGS +Entries for "." and ".." +may not be reported for some file system types. +.P +The exact set of +.I errno +values and meanings may vary among implementations. diff --git a/usr/src/contrib/isode/dirent/getdents.c b/usr/src/contrib/isode/dirent/getdents.c new file mode 100644 index 0000000000..3033b3fea6 --- /dev/null +++ b/usr/src/contrib/isode/dirent/getdents.c @@ -0,0 +1,312 @@ +/* + getdents -- get directory entries in a file system independent format + (SVR3 system call emulation) + + last edit: 06-Jul-1987 D A Gwyn + + This single source file supports several different methods of + getting directory entries from the operating system. Define + whichever one of the following describes your system: + + GETDENTS getdents() system call native, this library is unnecessary + + UFS original UNIX filesystem (14-character name limit) + BFS 4.2BSD (also 4.3BSD) native filesystem (long names) + NFS getdirentries() system call + + Also define any of the following that are pertinent: + + ATT_SPEC check user buffer address for longword alignment + BSD_SYSV BRL UNIX System V emulation environment on 4.nBSD + UNK have _getdents() system call, but kernel may not + support it + + If your C library has a getdents() system call interface, but you + can't count on all kernels on which your application binaries may + run to support it, change the system call interface name to + _getdents() and define "UNK" to enable the system-call validity + test in this "wrapper" around _getdents(). + + If your system has a getdents() system call that is guaranteed + to always work, you shouldn't be using this source file at all. +*/ + +#ifndef lint /* for strings... */ +static char *rcsid="$Header: /f/osi/dirent/RCS/getdents.c,v 7.2 91/02/22 09:17:25 mrose Interim $"; +#endif + +#include "config.h" + +#if !defined(SVR3) && !defined(apollo) && !defined(GETDENTS) + +#include +#include +#ifdef BSD_SYSV +#include "sys._dir.h" /* BSD flavor, not System V */ +#else +#ifndef AIX +#include +#else +#include "/usr/include/sys/dir.h" +#endif +#undef MAXNAMLEN /* avoid conflict with SVR3 */ + /* Good thing we don't need to use the DIRSIZ() macro! */ +#ifdef d_ino /* 4.3BSD/NFS using d_fileno */ +#undef d_ino /* (not absolutely necessary) */ +#else +#define d_fileno d_ino /* (struct direct) member */ +#endif +#endif +#include "sys.dirent.h" +#include + +#ifndef NFS +#ifdef BSD42 +#define BFS +#else +#define UFS +#endif +#endif + +#ifdef UNK +#ifndef UFS +#include "***** ERROR ***** UNK applies only to UFS" +/* One could do something similar for getdirentries(), but I didn't bother. */ +#endif +#include +#endif + +#if defined(UFS) + defined(BFS) + defined(NFS) != 1 /* sanity check */ +#include "***** ERROR ***** exactly one of UFS, BFS, or NFS must be defined" +#endif + +#ifdef UFS +#define RecLen( dp ) (sizeof(struct direct)) /* fixed-length entries */ +#else /* BFS || NFS */ +#define RecLen( dp ) ((dp)->d_reclen) /* variable-length entries */ +#endif + +#ifdef NFS +#ifdef BSD_SYSV +#define getdirentries _getdirentries /* package hides this system call */ +#endif +extern int getdirentries(); +static long dummy; /* getdirentries() needs basep */ +#define GetBlock( fd, buf, n ) getdirentries( fd, buf, (int)n, &dummy ) +#else /* UFS || BFS */ +#ifdef BSD_SYSV +#define read _read /* avoid emulation overhead */ +#endif +extern int read(); +#define GetBlock( fd, buf, n ) read( fd, buf, (unsigned)n ) +#endif + +#ifdef UNK +extern int _getdents(); /* actual system call */ +#endif + +extern char *strncpy(); +extern int fstat(); +extern off_t lseek(); + +extern int errno; + +#ifndef DIRBLKSIZ +#define DIRBLKSIZ 4096 /* directory file read buffer size */ +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif + +#ifndef S_ISDIR /* macro to test for directory file */ +#define S_ISDIR( mode ) (((mode) & S_IFMT) == S_IFDIR) +#endif + +#ifdef UFS + +/* + The following routine is necessary to handle DIRSIZ-long entry names. + Thanks to Richard Todd for pointing this out. +*/ + +static int +NameLen( name ) /* return # chars in embedded name */ + char name[]; /* -> name embedded in struct direct */ + { + register char *s; /* -> name[.] */ + register char *stop = &name[DIRSIZ]; /* -> past end of name field */ + + for ( s = &name[1]; /* (empty names are impossible) */ + *s != '\0' /* not NUL terminator */ + && ++s < stop; /* < DIRSIZ characters scanned */ + ) + ; + + return s - name; /* # valid characters in name */ + } + +#else /* BFS || NFS */ + +extern int strlen(); + +#define NameLen( name ) strlen( name ) /* names are always NUL-terminated */ + +#endif + +#ifdef UNK +static enum { maybe, no, yes } state = maybe; + /* does _getdents() work? */ + +/*ARGSUSED*/ +static void +sig_catch( sig ) + int sig; /* must be SIGSYS */ + { + state = no; /* attempted _getdents() faulted */ + } +#endif + +int +getdents( fildes, buf, nbyte ) /* returns # bytes read; + 0 on EOF, -1 on error */ + int fildes; /* directory file descriptor */ + char *buf; /* where to put the (struct dirent)s */ + unsigned nbyte; /* size of buf[] */ + { + int serrno; /* entry errno */ + off_t offset; /* initial directory file offset */ + struct stat statb; /* fstat() info */ + union { + char dblk[DIRBLKSIZ]; + /* directory file block buffer */ + struct direct dummy; /* just for alignment */ + } u; /* (avoids having to malloc()) */ + register struct direct *dp; /* -> u.dblk[.] */ + register struct dirent *bp; /* -> buf[.] */ + +#ifdef UNK + switch ( state ) + { + void (*shdlr)(); /* entry SIGSYS handler */ + register int retval; /* return from _getdents() if any */ + + case yes: /* _getdents() is known to work */ + return _getdents( fildes, buf, nbyte ); + + case maybe: /* first time only */ + shdlr = signal( SIGSYS, sig_catch ); + retval = _getdents( fildes, buf, nbyte ); /* try it */ + (void)signal( SIGSYS, shdlr ); + + if ( state == maybe ) /* SIGSYS did not occur */ + { + state = yes; /* so _getdents() must have worked */ + return retval; + } + /* else fall through into emulation */ + +/* case no: /* fall through into emulation */ + } +#endif + + if ( buf == NULL +#ifdef ATT_SPEC + || (unsigned long)buf % sizeof(long) != 0 /* ugh */ +#endif + ) { + errno = EFAULT; /* invalid pointer */ + return -1; + } + + if ( fstat( fildes, &statb ) != 0 ) + return -1; /* errno set by fstat() */ + + if ( !S_ISDIR( statb.st_mode ) ) + { + errno = ENOTDIR; /* not a directory */ + return -1; + } + + if ( (offset = lseek( fildes, (off_t)0, SEEK_CUR )) < 0 ) + return -1; /* errno set by lseek() */ + +#ifdef BFS /* no telling what remote hosts do */ + if ( (unsigned long)offset % DIRBLKSIZ != 0 ) + { + errno = ENOENT; /* file pointer probably misaligned */ + return -1; + } +#endif + + serrno = errno; /* save entry errno */ + + for ( bp = (struct dirent *)buf; bp == (struct dirent *)buf; ) + { /* convert next directory block */ + int size; + + do size = GetBlock( fildes, u.dblk, DIRBLKSIZ ); + while ( size == -1 && errno == EINTR ); + + if ( size <= 0 ) + return size; /* EOF or error (EBADF) */ + + for ( dp = (struct direct *)u.dblk; + (char *)dp < &u.dblk[size]; + dp = (struct direct *)((char *)dp + RecLen( dp )) + ) { +#ifndef UFS + if ( dp->d_reclen <= 0 ) + { + errno = EIO; /* corrupted directory */ + return -1; + } +#endif + + if ( dp->d_fileno != 0 ) + { /* non-empty; copy to user buffer */ + register int reclen = + DIRENTSIZ( NameLen( dp->d_name ) ); + + if ( (char *)bp + reclen > &buf[nbyte] ) + { + errno = EINVAL; + return -1; /* buf too small */ + } + + bp->d_ino = dp->d_fileno; + bp->d_off = offset + ((char *)dp - u.dblk); + bp->d_reclen = reclen; + (void)strncpy( bp->d_name, dp->d_name, +#ifdef UFS + DIRSIZ ); + /* be sure d_name is NULL-terminated */ + bp->d_name[DIRSIZ] = NULL; +#else + reclen - DIRENTBASESIZ ); + /* adds NUL padding */ +#endif + + bp = (struct dirent *)((char *)bp + reclen); + } + } + +#ifndef BFS /* 4.2BSD screwed up; fixed in 4.3BSD */ + if ( (char *)dp > &u.dblk[size] ) + { + errno = EIO; /* corrupted directory */ + return -1; + } +#endif + } + + errno = serrno; /* restore entry errno */ + return (char *)bp - buf; /* return # bytes read */ + } +#else +int _getdents_stub () {}; +#endif diff --git a/usr/src/contrib/isode/dirent/llib-ldirent b/usr/src/contrib/isode/dirent/llib-ldirent new file mode 100644 index 0000000000..81707748a5 --- /dev/null +++ b/usr/src/contrib/isode/dirent/llib-ldirent @@ -0,0 +1,114 @@ +/* llib-ldirent - lint library for -ldirent */ + +/* + * $Header: /f/osi/dirent/RCS/llib-ldirent,v 7.1 91/02/22 09:17:27 mrose Interim $ + * + * + * $Log: llib-ldirent,v $ + * Revision 7.1 91/02/22 09:17:27 mrose + * Interim 6.8 + * + * Revision 7.0 89/11/23 21:31:00 mrose + * Release 6.0 + * + */ + +/* + * This package was generously supplied by Doug Gwyn. It is a public domain + * implementation of the SVR3 directory access routines. + * + * I have slightly edited the package to produce a stand-alone library + * (normally it updates libc.a). The reason for this, is that the package + * is used primarily for ISODE's ftam responder, and it's too much heartburn + * to ask someone to reload libc.a just for that (sorry, doug!) + * + * I've also prepended a "_" to the names to avoid any conflicts with routines + * which might already be installed (especially for lint) + * + */ + + +/* LINTLIBRARY */ + +#include "general.h" +#include "manifest.h" +#include "usr.dirent.h" + +/* */ + +#ifndef GETDENTS +/* open a directory stream */ + +DIR *opendir (name) +char *name; +{ + return opendir (name); +} + + +/* read next entry from a directory stream */ + +struct dirent *readdir (dp) +DIR *dp; +{ + return readdir (dp); +} + + +/* report directory stream position */ + +off_t telldir (dp) +DIR *dp; +{ + return telldir (dp); +} + + +/* reposition a directory stream */ + +void seekdir (dp, loc) +DIR *dp; +off_t loc; +{ + seekdir (dp, loc); +} + + +/* rewind a directory stream */ + +void rewinddir (dp) +DIR *dp; +{ + rewinddir (dp); +} + + +/* close a directory stream */ + +int closedir (dp) +DIR *dp; +{ + return closedir (dp); +} + + +/* get directory entries in a FS independent format */ + +int getdents (fd, buffer, n) +int fd; +char *buffer; +unsigned int n; +{ + return getdents (fd, buffer, n); +} + +#endif + +/* get current working directory name */ + +char *getcwd (buffer, n) +char *buffer; +int n; +{ + return getcwd (buffer, n); +} diff --git a/usr/src/contrib/isode/dirent/make b/usr/src/contrib/isode/dirent/make new file mode 100644 index 0000000000..2f895e6f53 --- /dev/null +++ b/usr/src/contrib/isode/dirent/make @@ -0,0 +1,7 @@ +: run this script through /bin/sh +M=/bin/make +if [ -f /usr/bin/make ]; then + M=/usr/bin/make +fi + +exec $M MODULE=dirent TOPDIR=../ -f ../config/CONFIG.make -f Makefile ${1+"$@"} diff --git a/usr/src/contrib/isode/dirent/opendir.c b/usr/src/contrib/isode/dirent/opendir.c new file mode 100644 index 0000000000..addd0bb833 --- /dev/null +++ b/usr/src/contrib/isode/dirent/opendir.c @@ -0,0 +1,76 @@ +/* + opendir -- open a directory stream + + last edit: 16-Jun-1987 D A Gwyn +*/ + +#include +#include +#include +#include "usr.dirent.h" + +#ifndef GETDENTS +#ifdef BSD_SYSV +#define open _open /* avoid emulation overhead */ +#endif + +typedef char *pointer; /* (void *) if you have it */ + +extern void free(); +extern pointer malloc(); +extern int open(), close(), fstat(); + +extern int errno; + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef O_RDONLY +#define O_RDONLY 0 +#endif + +#ifndef S_ISDIR /* macro to test for directory file */ +#define S_ISDIR( mode ) (((mode) & S_IFMT) == S_IFDIR) +#endif + +DIR * +opendir( dirname ) + char *dirname; /* name of directory */ + { + register DIR *dirp; /* -> malloc'ed storage */ + register int fd; /* file descriptor for read */ + struct stat sbuf; /* result of fstat() */ + + if ( (fd = open( dirname, O_RDONLY )) < 0 ) + return NULL; /* errno set by open() */ + + if ( fstat( fd, &sbuf ) != 0 || !S_ISDIR( sbuf.st_mode ) ) + { + (void)close( fd ); + errno = ENOTDIR; + return NULL; /* not a directory */ + } + + if ( (dirp = (DIR *)malloc( sizeof(DIR) )) == NULL + || (dirp->dd_buf = (char *)malloc( (unsigned)DIRBUF )) == NULL + ) { + register int serrno = errno; + /* errno set to ENOMEM by sbrk() */ + + if ( dirp != NULL ) + free( (pointer)dirp ); + + (void)close( fd ); + errno = serrno; + return NULL; /* not enough memory */ + } + + dirp->dd_fd = fd; + dirp->dd_loc = dirp->dd_size = 0; /* refill needed */ + + return dirp; + } +#else +int _opendir_stub () {}; +#endif diff --git a/usr/src/contrib/isode/dirent/readdir.c b/usr/src/contrib/isode/dirent/readdir.c new file mode 100644 index 0000000000..4069703099 --- /dev/null +++ b/usr/src/contrib/isode/dirent/readdir.c @@ -0,0 +1,52 @@ +/* + readdir -- read next entry from a directory stream + + last edit: 25-Apr-1987 D A Gwyn +*/ + +#include +#include +#include "usr.dirent.h" + +#ifndef GETDENTS +extern int getdents(); /* SVR3 system call, or emulation */ + +extern int errno; + +#ifndef NULL +#define NULL 0 +#endif + +struct dirent * +readdir( dirp ) + register DIR *dirp; /* stream from opendir() */ + { + register struct dirent *dp; /* -> directory data */ + + if ( dirp == NULL || dirp->dd_buf == NULL ) + { + errno = EFAULT; + return NULL; /* invalid pointer */ + } + + do { + if ( dirp->dd_loc >= dirp->dd_size ) /* empty or obsolete */ + dirp->dd_loc = dirp->dd_size = 0; + + if ( dirp->dd_size == 0 /* need to refill buffer */ + && (dirp->dd_size = + getdents( dirp->dd_fd, dirp->dd_buf, (unsigned)DIRBUF ) + ) <= 0 + ) + return NULL; /* EOF or error */ + + dp = (struct dirent *)&dirp->dd_buf[dirp->dd_loc]; + dirp->dd_loc += dp->d_reclen; + } + while ( dp->d_ino == 0L ); /* don't rely on getdents() */ + + return dp; + } +#else +int _readdir_stub () {}; +#endif diff --git a/usr/src/contrib/isode/dirent/rewinddir.c b/usr/src/contrib/isode/dirent/rewinddir.c new file mode 100644 index 0000000000..a7d30f8a7f --- /dev/null +++ b/usr/src/contrib/isode/dirent/rewinddir.c @@ -0,0 +1,43 @@ +/* + rewinddir -- rewind a directory stream + + last edit: 25-Apr-1987 D A Gwyn + + This is not simply a call to seekdir(), because seekdir() + will use the current buffer whenever possible and we need + rewinddir() to forget about buffered data. +*/ + +#include +#include +#include "usr.dirent.h" + +#ifndef GETDENTS +extern off_t lseek(); + +extern int errno; + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +void +rewinddir( dirp ) + register DIR *dirp; /* stream from opendir() */ + { + if ( dirp == NULL || dirp->dd_buf == NULL ) + { + errno = EFAULT; + return; /* invalid pointer */ + } + + dirp->dd_loc = dirp->dd_size = 0; /* invalidate buffer */ + (void)lseek( dirp->dd_fd, (off_t)0, SEEK_SET ); /* may set errno */ + } +#else +int _rewinddir_stub () {}; +#endif diff --git a/usr/src/contrib/isode/dirent/seekdir.c b/usr/src/contrib/isode/dirent/seekdir.c new file mode 100644 index 0000000000..48e1d0738d --- /dev/null +++ b/usr/src/contrib/isode/dirent/seekdir.c @@ -0,0 +1,115 @@ +/* + seekdir -- reposition a directory stream + + last edit: 24-May-1987 D A Gwyn + + An unsuccessful seekdir() will in general alter the current + directory position; beware. + + NOTE: 4.nBSD directory compaction makes seekdir() & telldir() + practically impossible to do right. Avoid using them! +*/ + +#include +#include +#include "usr.dirent.h" + +#ifndef GETDENTS +extern off_t lseek(); + +extern int errno; + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +typedef int bool; /* Boolean data type */ +#define false 0 +#define true 1 + +void +seekdir( dirp, loc ) + register DIR *dirp; /* stream from opendir() */ + register off_t loc; /* position from telldir() */ + { + register bool rewind; /* "start over when stymied" flag */ + + if ( dirp == NULL || dirp->dd_buf == NULL ) + { + errno = EFAULT; + return; /* invalid pointer */ + } + + /* A (struct dirent)'s d_off is an invented quantity on 4.nBSD + NFS-supporting systems, so it is not safe to lseek() to it. */ + + /* Monotonicity of d_off is heavily exploited in the following. */ + + /* This algorithm is tuned for modest directory sizes. For + huge directories, it might be more efficient to read blocks + until the first d_off is too large, then back up one block, + or even to use binary search on the directory blocks. I + doubt that the extra code for that would be worthwhile. */ + + if ( dirp->dd_loc >= dirp->dd_size /* invalid index */ + || ((struct dirent *)&dirp->dd_buf[dirp->dd_loc])->d_off > loc + /* too far along in buffer */ + ) + dirp->dd_loc = 0; /* reset to beginning of buffer */ + /* else save time by starting at current dirp->dd_loc */ + + for ( rewind = true; ; ) + { + register struct dirent *dp; + + /* See whether the matching entry is in the current buffer. */ + + if ( (dirp->dd_loc < dirp->dd_size /* valid index */ + || readdir( dirp ) != NULL /* next buffer read */ + && (dirp->dd_loc = 0, true) /* beginning of buffer set */ + ) + && (dp = (struct dirent *)&dirp->dd_buf[dirp->dd_loc])->d_off + <= loc /* match possible in this buffer */ + ) { + for ( /* dp initialized above */ ; + (char *)dp < &dirp->dd_buf[dirp->dd_size]; + dp = (struct dirent *)((char *)dp + dp->d_reclen) + ) + if ( dp->d_off == loc ) + { /* found it! */ + dirp->dd_loc = + (char *)dp - dirp->dd_buf; + return; + } + + rewind = false; /* no point in backing up later */ + dirp->dd_loc = dirp->dd_size; /* set end of buffer */ + } + else /* whole buffer past matching entry */ + if ( !rewind ) + { /* no point in searching further */ + errno = EINVAL; + return; /* no entry at specified loc */ + } + else { /* rewind directory and start over */ + rewind = false; /* but only once! */ + + dirp->dd_loc = dirp->dd_size = 0; + + if ( lseek( dirp->dd_fd, (off_t)0, SEEK_SET ) + != 0 + ) + return; /* errno already set (EBADF) */ + + if ( loc == 0 ) + return; /* save time */ + } + } + } +#else +int _seekdir_stub () {}; +#endif diff --git a/usr/src/contrib/isode/dirent/sys._dir.h b/usr/src/contrib/isode/dirent/sys._dir.h new file mode 100644 index 0000000000..f18153e924 --- /dev/null +++ b/usr/src/contrib/isode/dirent/sys._dir.h @@ -0,0 +1,74 @@ +/* + -- definitions for 4.2,4.3BSD directories + + last edit: 25-Apr-1987 D A Gwyn + + A directory consists of some number of blocks of DIRBLKSIZ bytes each, + where DIRBLKSIZ is chosen such that it can be transferred to disk in a + single atomic operation (e.g., 512 bytes on most machines). + + Each DIRBLKSIZ-byte block contains some number of directory entry + structures, which are of variable length. Each directory entry has the + beginning of a (struct direct) at the front of it, containing its + filesystem-unique ident number, the length of the entry, and the length + of the name contained in the entry. These are followed by the NUL- + terminated name padded to a (long) boundary with 0 bytes. The maximum + length of a name in a directory is MAXNAMELEN. + + The macro DIRSIZ(dp) gives the amount of space required to represent a + directory entry. Free space in a directory is represented by entries + that have dp->d_reclen > DIRSIZ(dp). All DIRBLKSIZ bytes in a + directory block are claimed by the directory entries; this usually + results in the last entry in a directory having a large dp->d_reclen. + When entries are deleted from a directory, the space is returned to the + previous entry in the same directory block by increasing its + dp->d_reclen. If the first entry of a directory block is free, then + its dp->d_fileno is set to 0; entries other than the first in a + directory do not normally have dp->d_fileno set to 0. + + prerequisite: +*/ + +#if defined(accel) || defined(sun) || defined(vax) +#define DIRBLKSIZ 512 /* size of directory block */ +#else +#ifdef alliant +#define DIRBLKSIZ 4096 /* size of directory block */ +#else +#ifdef gould +#define DIRBLKSIZ 1024 /* size of directory block */ +#else +#ifdef ns32000 /* Dynix System V */ +#define DIRBLKSIZ 2600 /* size of directory block */ +#else /* be conservative; multiple blocks are okay but fractions are not */ +#define DIRBLKSIZ 4096 /* size of directory block */ +#endif +#endif +#endif +#endif + +#define MAXNAMELEN 255 /* maximum filename length */ +/* NOTE: not MAXNAMLEN, which has been preempted by SVR3 */ + +struct direct /* data from read()/_getdirentries() */ + { + unsigned long d_fileno; /* unique ident of entry */ + unsigned short d_reclen; /* length of this record */ + unsigned short d_namlen; /* length of string in d_name */ + char d_name[MAXNAMELEN+1]; /* NUL-terminated filename */ + /* typically shorter */ + }; + +/* + The DIRSIZ macro gives the minimum record length which will hold the + directory entry. This requires the amount of space in a (struct + direct) without the d_name field, plus enough space for the name with a + terminating NUL character, rounded up to a (long) boundary. + + (Note that Berkeley didn't properly compensate for struct padding, + but we nevertheless have to use the same size as the actual system.) +*/ + +#define DIRSIZ( dp ) ((sizeof(struct direct) - (MAXNAMELEN+1) \ + + sizeof(long) + (dp)->d_namlen) \ + / sizeof(long) * sizeof(long)) diff --git a/usr/src/contrib/isode/dirent/telldir.c b/usr/src/contrib/isode/dirent/telldir.c new file mode 100644 index 0000000000..341a808d43 --- /dev/null +++ b/usr/src/contrib/isode/dirent/telldir.c @@ -0,0 +1,40 @@ +/* + telldir -- report directory stream position + + last edit: 25-Apr-1987 D A Gwyn + + NOTE: 4.nBSD directory compaction makes seekdir() & telldir() + practically impossible to do right. Avoid using them! +*/ + +#include +#include +#include "usr.dirent.h" + +#ifndef GETDENTS +extern off_t lseek(); + +extern int errno; + +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif + +off_t +telldir( dirp ) /* return offset of next entry */ + DIR *dirp; /* stream from opendir() */ + { + if ( dirp == NULL || dirp->dd_buf == NULL ) + { + errno = EFAULT; + return -1; /* invalid pointer */ + } + + if ( dirp->dd_loc < dirp->dd_size ) /* valid index */ + return ((struct dirent *)&dirp->dd_buf[dirp->dd_loc])->d_off; + else /* beginning of next directory block */ + return lseek( dirp->dd_fd, (off_t)0, SEEK_CUR ); + } +#else +int _telldir_stub () {}; +#endif diff --git a/usr/src/contrib/isode/dirent/testdir.c b/usr/src/contrib/isode/dirent/testdir.c new file mode 100644 index 0000000000..c629aa5335 --- /dev/null +++ b/usr/src/contrib/isode/dirent/testdir.c @@ -0,0 +1,58 @@ +/* + testdir -- basic test for C library directory access routines + + last edit: 25-Apr-1987 D A Gwyn +*/ + +#include +#include +#include "usr.dirent.h" + +extern void exit(); +extern int strcmp(); + +main( argc, argv ) + int argc; + register char **argv; + { + register DIR *dirp; + register struct dirent *dp; + int nerrs = 0; /* total not found */ + + if ( (dirp = opendir( "." )) == NULL ) + { + (void)fprintf( stderr, "Cannot open \".\" directory\n" ); + exit( 1 ); + } + + if (argc == 1) { + while (dp = readdir (dirp)) + printf ("ino=%d len=%d name=\"%s\"\n", + dp -> d_ino, strlen (dp -> d_name), dp -> d_name); + (void) closedir (dirp); + exit (0); + } + + while ( --argc > 0 ) + { + ++argv; + + while ( (dp = readdir( dirp )) != NULL ) + if ( strcmp( dp->d_name, *argv ) == 0 ) + { + (void)printf( "\"%s\" found.\n", *argv ); + break; + } + + if ( dp == NULL ) + { + (void)printf( "\"%s\" not found.\n", *argv ); + ++nerrs; + } + + rewinddir( dirp ); + } + + (void)closedir( dirp ); + exit( nerrs ); + } diff --git a/usr/src/contrib/isode/h/config.h b/usr/src/contrib/isode/h/config.h new file mode 100644 index 0000000000..fcd631b491 --- /dev/null +++ b/usr/src/contrib/isode/h/config.h @@ -0,0 +1,56 @@ +/* bsd44.h - site configuration file for 4.4BSD UNIX */ + +/* + * $Header: /f/osi/config/RCS/bsd44.h,v 7.3 91/02/22 09:16:30 mrose Interim $ + * + * + * $Log: bsd44.h,v $ + * Revision 7.3 91/02/22 09:16:30 mrose + * Interim 6.8 + * + * Revision 7.2 91/01/10 16:13:03 mrose + * x25 + * + * Revision 7.1 90/07/09 14:32:41 mrose + * sync + * + * Revision 7.0 89/11/23 21:26:00 mrose + * Release 6.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 _CONFIG_ +#define _CONFIG_ + +#define BSD42 /* Berkeley UNIX */ +#define WRITEV /* real Berkeley UNIX */ +#define BSD43 /* 4.3BSD or later */ +#define BSD44 /* 4.4BSD to be precise! */ + +#define X25 +#define UBC_X25 +#define UBC_X25_WRITEV + +#define VSPRINTF /* has vprintf(3s) routines */ + +#define TCP /* has TCP/IP (of course) */ +#define SOCKETS /* provided by sockets */ + +#define TP4 /* has TP4 */ +#define BSD_TP4 /* provided by UCB/UWisc */ + +#define GETDENTS /* has getdirent(2) call */ +#define NFS /* network file system -- has getdirentries */ + +#endif diff --git a/usr/src/contrib/isode/isode-test b/usr/src/contrib/isode/isode-test new file mode 100644 index 0000000000..3d100056e7 --- /dev/null +++ b/usr/src/contrib/isode/isode-test @@ -0,0 +1,88 @@ +: run this script through /bin/sh + +# A program to test out the isode services etc. +# +# Pretty simple minded - but gives some indications. +# +# Julian Onions 15/1/86 + +# usage : isode-test [ hostname ] +if [ ! -f support/xisoc ]; then + PATH=$PATH:/usr/local/bin export PATH + P1= P2= +else + P1=support/x P2=imisc/x +fi + +error=0 fast=0 +if [ "x$1" = "x-lpp" ]; then + fast=1 S=-lpp + shift +else + S= +fi + +if [ "x$1" = "x-iaed" ]; then + ECHO= SSAP= RECHO= + shift +else + ECHO=echo SSAP=ssap RECHO=ros_echo +fi + +IMISC=${P2}imisc${S} ISOC=${P1}isoc + +if [ $# -gt 0 ]; then + host="$1" + echo "Hostname set to $host" +elif host="`hostname`"; then + echo "Hostname set to $host" +elif host="`uname`"; then + echo "Hostname set to $host" +else + echo -n "I give up, what is your host name? " + read host +fi + +for i in utctime gentime time users chargen qotd finger pwdgen +do +echo "$i:" +$IMISC "$host" $i || error=`expr $error + 1` +done + +for i in ping sink echo +do +echo "$i:" +$IMISC -c 100 -l 1020 "$host" $i || error=`expr $error + 1` +done + +if [ $fast = 1 ]; then + echo "Test done, Errors: $error" + exit $error +fi + +for i in $ECHO isode/echo +do +echo "rosap $i:" +$ISOC "$host" rosap $i < /etc/passwd || error=`expr $error + 1` +done + +for i in $ECHO $RECHO "isode/rtse echo" isode/ros_echo +do +echo "rtsap $i:" +$ISOC "$host" rtsap "$i" < /etc/passwd || error=`expr $error + 1` +done + +for i in $ECHO isode/echo +do +echo "psap $i:" +$ISOC "$host" psap $i < /etc/passwd || error=`expr $error + 1` +done + +for i in $SSAP tsap +do +echo "$i echo:" +$ISOC "$host" $i echo < /etc/passwd || error=`expr $error + 1` +done + +echo "Test done, Errors: $error" +exit $error diff --git a/usr/src/contrib/isode/make b/usr/src/contrib/isode/make new file mode 100644 index 0000000000..d60c67951e --- /dev/null +++ b/usr/src/contrib/isode/make @@ -0,0 +1,7 @@ +: run this script through /bin/sh +M=/bin/make +if [ -f /usr/bin/make ]; then + M=/usr/bin/make +fi + +exec $M TOPDIR= -f config/CONFIG.make -f Makefile ${1+"$@"} diff --git a/usr/src/contrib/isode/support/aliases.local b/usr/src/contrib/isode/support/aliases.local new file mode 100644 index 0000000000..6e2c02ad76 --- /dev/null +++ b/usr/src/contrib/isode/support/aliases.local @@ -0,0 +1,39 @@ +############################################################################### +# +# isoaliases - ISODE alias file +# +# Mappings between user-friendly strings and distinguished names +# +# +# $Header: /f/osi/config/RCS/aliases.local,v 7.1 91/02/22 09:16:18 mrose Interim $ +# +# +# $Log: aliases.local,v $ +# Revision 7.1 91/02/22 09:16:18 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:25:36 mrose +# Release 6.0 +# +############################################################################### + + +############################################################################### +# +# Syntax: +# +# +# +# Each token is separated by LWSP, though double-quotes may be +# used to prevent separation +# +# Maybe in the future we'll support a macro facility! +# +############################################################################### + +############################################################################### +# locally defined aliases +# (this section is empty unless you're running an OSI Directory...) +############################################################################### + + diff --git a/usr/src/contrib/isode/support/entities.local b/usr/src/contrib/isode/support/entities.local new file mode 100644 index 0000000000..afafb99a44 --- /dev/null +++ b/usr/src/contrib/isode/support/entities.local @@ -0,0 +1,26 @@ +############################################################################### +# +# $Header: /f/osi/config/RCS/entities.local,v 7.1 91/02/22 09:16:34 mrose Interim $ +# +# +# $Log: entities.local,v $ +# Revision 7.1 91/02/22 09:16:34 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:03 mrose +# Release 6.0 +# +############################################################################### + + +# templates for local services: 1.17.4.1 +# local additions go here... + + +# local additions end here (do not remove this line) + + +# examples of specific services: 1.17.4.2 +# this section is empty + + diff --git a/usr/src/contrib/isode/support/macros.local b/usr/src/contrib/isode/support/macros.local new file mode 100644 index 0000000000..f55516f620 --- /dev/null +++ b/usr/src/contrib/isode/support/macros.local @@ -0,0 +1,21 @@ +############################################################################### +# +# $Header: /f/osi/config/RCS/macros.local,v 7.1 91/02/22 09:16:39 mrose Interim $ +# +# +# $Log: macros.local,v $ +# Revision 7.1 91/02/22 09:16:39 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:05 mrose +# Release 6.0 +# +############################################################################### + + +############################################################################### +# locally defined macros +# (this section is usually empty...) +############################################################################### + + diff --git a/usr/src/contrib/isode/support/objects.local b/usr/src/contrib/isode/support/objects.local new file mode 100644 index 0000000000..42e3f2edc0 --- /dev/null +++ b/usr/src/contrib/isode/support/objects.local @@ -0,0 +1,38 @@ +############################################################################### +# +# isobjects - ISODE Objects Database +# +# Mappings between object descriptors and object identifiers +# +# +# $Header: /f/osi/config/RCS/objects.local,v 7.1 91/02/22 09:16:42 mrose Interim $ +# +# +# $Log: objects.local,v $ +# Revision 7.1 91/02/22 09:16:42 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:10 mrose +# Release 6.0 +# +############################################################################### + + +############################################################################### +# +# Syntax: +# +# +# +# Each token is separated by LWSP, though double-quotes may be +# used to prevent separation +# +############################################################################### + + +############################################################################### +# locally defined objects +# (this section is usually empty...) +############################################################################### + + diff --git a/usr/src/contrib/isode/support/services.local b/usr/src/contrib/isode/support/services.local new file mode 100644 index 0000000000..351470b881 --- /dev/null +++ b/usr/src/contrib/isode/support/services.local @@ -0,0 +1,41 @@ +############################################################################### +# +# isoservices - ISODE Services Database +# +# Mappings between services, selectors, and programs +# +# +# $Header: /f/osi/config/RCS/services.local,v 7.1 91/02/22 09:16:50 mrose Interim $ +# +# +# $Log: services.local,v $ +# Revision 7.1 91/02/22 09:16:50 mrose +# Interim 6.8 +# +# Revision 7.0 89/11/23 21:26:17 mrose +# Release 6.0 +# +############################################################################### + + +############################################################################### +# +# Syntax: +# +# / ... +# +# Each token is separated by LWSP, though double-quotes may be +# used to prevent separation +# +############################################################################### + + +############################################################################### +# locally defined services +# (this section is usually empty...) +############################################################################### + + + +# local additions end here (do not remove this line) + -- 2.20.1