NETLIB_SRC.BCKpìðNETLIB_SRC.BCKbBACKUP DESCRIP.MMS,COMPATIBILITY.C,CONNECT.C,DNS.C,DNS_MXLOOK.C,DNS_QUERY.C,LINEMODE.C,MEM.C,MISC.C,NAMEADDR.C,NETLIB_SRI.C,NETLIB_SRI_SUPPORT.C,NETLIB_UCX.C,NETLIB_CMU.C,NETLIB_VECTOR.MAR,NETLIB_SHRXFR.MAR,NETLIB_SRI.H,NETLIB_MULTINET.H,NETLIB_TCPWARE.H,NETLIB_PATHWAY.H,NETLIB_UCX.H,NETLIB_CMU.H,UCX$INETDEF.H,NETLIB.H,NETLIBDEF.H,NETLIBDEF.R32,NETLIB.OPT,NETLIB.ALPHA_OPT,NETLIB_SHRXFR.OPT,NETLIB_SHRXFR.ALPHA_OPT,NETLIB_DOC.SDML,NETLIB_INST.SDML,GENERATE_SYMBOLS.COM,CHECK_VERSION.COM,NETLIB_VERSION.H,NETLIB_VERSION.OPT,NETLIB022.SDML MG_KIT:[NETLIB]NETLIB_SRC.BCK/SAVE/INTERCHANGE/BLOCK=8192/NOCRC/GROU=0 MADISON AÅt$õú›V7.1 _PRAETO:: € _PRAETO$DKA0: V6.2 Þð*[NETLIB]DESCRIP.MMS;62+,ì ./€ 4j`-ç 0ª123KÿPWO56“Û _ÔÞ›7T_ÔÞ›89¹AJ(ú›G€HˆªJÿ!++! DESCRIP.MMS!3! MMS (MMK) description file for building NETLIB.!8! N.B.: If you are on an AXP system and using DEC/MMS,:! use the command MMS/MACRO=(__AXP__=1) to build MMK,:! so you get the right linker options file. This may:! or may not work; some versions of MMS may not be6! able to handle some of the syntax in this file.!4! 21-SEP-1994 V1.0 Madison Initial commenting.7! 31-OCT-1994 V2.0 Madison Rewrite for NETLIB V2.?! 30-SEP-1996 V2.1 Madison Fixups for non-MadGoat builds.;! 27-NOV-1997 V2.2 Madison Separate out version info.!--!+?! The following three lines control all the version informationH! embedded throughout the code, linker options files, and documentation.!-NUM_VERSION = 022TEXT_VERSION = V2.2GSMATCH = LEQUAL,1,7.IFDEF __MADGOAT_BUILD__MG_FACILITY = NETLIB.IFDEF __VAX__MG_VMSVER = V53.ELSEMG_VMSVER = V15.ENDIF.INCLUDE MG_TOOLS:HEADER.MMS .IFDEF LIS2MFLAGS = $(MFLAGS)/LIST=MG_ETC:$(MMS$TARGET_FNAME)2CFLAGS = $(CFLAGS)/LIST=MG_ETC:$(MMS$TARGET_FNAME)BLINKFLAGS = $(LINKFLAGS)/MAP=MG_ETC:$(MMS$TARGET_FNAME)/CROSS/FULL.ENDIF.ELSEETCDIR =KITDIR =SRCDIR = SYS$DISK:[]BINDIR =.ENDIF.IFDEF __MMK_V32__.IFDEF __AXP__ ARCH = AXP#OPTFILE = $(SRCDIR)NETLIB.ALPHA_OPT*XFROPTF = $(SRCDIR)NETLIB_SHRXFR.ALPHA_OPT.ELSE ARCH = VAXOPTFILE = $(SRCDIR)NETLIB.OPT$XFROPTF = $(SRCDIR)NETLIB_SHRXFR.OPT.ENDIF%VERFILE = $(SRCDIR)NETLIB_VERSION.OPT.IFDEF __MADGOAT_BUILD__.ELSEBINDIR = [.BIN-$(ARCH)].FIRSTJ @ IF F$PARSE("[.BIN-$(ARCH)]") .EQS. "" THEN CREATE/DIR [.BIN-$(ARCH)], @ DEFINE BIN_DIR SYS$DISK:[.BIN-$(ARCH)]{}.C{[.BIN-$(ARCH)]}.OBJ :{}.MAR{[.BIN-$(ARCH)]}.OBJ : .IFDEF DBGCFLAGS = $(CFLAGS)$(DBG)/NOOPTLINKFLAGS = $(LINKFLAGS)$(DBG)MFLAGS = $(MFLAGS)$(DBG).ELSE LINKFLAGS = $(LINKFLAGS)/NOTRACE.ENDIF.ENDIF.ELSE ! MMK pre-V3.2, or MMS.IFDEF __AXP__OPT = .ALPHA_OPT.ELSE OPT = .OPT.ENDIFOPTFILE = NETLIB$(OPT)XFROPTF = NETLIB_SHRXFR$(OPT)VERFILE = NETLIB_VERSION.OPT.ENDIF.IFDEF __AXP__VEC =CMUSHR =.ELSE%CMUSHR = ,$(BINDIR)NETLIB_CMU_SHR.EXE!vec = ,$(BINDIR)NETLIB_VECTOR.OBJ.ENDIF;MULTINET_MODULES = NETLIB_SRI, NETLIB_MULTINET, NAMEADDR TCPWARE_MODULES = NETLIB_UCX:PATHWAY_MODULES = NETLIB_SRI, NETLIB_PATHWAY, NAMEADDRUCX_MODULES = NETLIB_UCX'CMU_MODULES = NETLIB_CMU, NAMEADDRCCOMMON_MODULES = MEM, LINEMODE, MISC, CONNECT, COMPATIBILITY, -* DNS, DNS_QUERY, DNS_MXLOOK.FIRSTG @ @$(SRCDIR)CHECK_VERSION $(VERFILE) "$(TEXT_VERSION)" "$(GSMATCH)":ALL : NETLIBDEF$(L32), $(BINDIR)NETLIB_SHRXFR.EXE, -L $(BINDIR)NETLIB_MULTINET_SHR.EXE, $(BINDIR)NETLIB_UCX_SHR.EXE, -- $(BINDIR)NETLIB_TCPWARE_SHR.EXE,-5 $(BINDIR)NETLIB_PATHWAY_SHR.EXE $(CMUSHR) @ !$(BINDIR)NETLIB_SHRXFR.EXE -E : $(BINDIR)NETLIB_SHRXFR.OBJ $(VEC), $(XFROPTF), $(VERFILE)X $(LINK)$(LINKFLAGS)/SHARE $(VERFILE)/OPT, $(XFROPTF)/OPT, $(BINDIR)NETLIB_SHRXFR.OBJ"$(BINDIR)NETLIB_MULTINET_SHR.EXE -? : $(BINDIR)NETLIB_MULTINET.OLB($(MULTINET_MODULES)),-X $(BINDIR)NETLIB_COMMON.OLB($(COMMON_MODULES)) $(VEC), $(OPTFILE), $(VERFILE)U $(LIBR)/COMPRESS/OUTPUT=$(BINDIR)NETLIB_MULTINET.OLB $(BINDIR)NETLIB_MULTINET.OLB_ $(LINK) $(LINKFLAGS)/SHARE $(VERFILE)/OPT, $(OPTFILE)/OPT, $(BINDIR)NETLIB_MULTINET.OLB/LIB$(BINDIR)NETLIB_UCX_SHR.EXE -5 : $(BINDIR)NETLIB_UCX.OLB($(UCX_MODULES)),-X $(BINDIR)NETLIB_COMMON.OLB($(COMMON_MODULES)) $(VEC), $(OPTFILE), $(VERFILE)K $(LIBR)/COMPRESS/OUTPUT=$(BINDIR)NETLIB_UCX.OLB $(BINDIR)NETLIB_UCX.OLBQ $(LIBR)/COMPRESS/OUTPUT=$(BINDIR)NETLIB_COMMON.OLB $(BINDIR)NETLIB_COMMON.OLBZ $(LINK) $(LINKFLAGS)/SHARE $(VERFILE)/OPT, $(OPTFILE)/OPT, $(BINDIR)NETLIB_UCX.OLB/LIB!$(BINDIR)NETLIB_TCPWARE_SHR.EXE -= : $(BINDIR)NETLIB_TCPWARE.OLB($(TCPWARE_MODULES)),-X $(BINDIR)NETLIB_COMMON.OLB($(COMMON_MODULES)) $(VEC), $(OPTFILE), $(VERFILE)S $(LIBR)/COMPRESS/OUTPUT=$(BINDIR)NETLIB_TCPWARE.OLB $(BINDIR)NETLIB_TCPWARE.OLB^ $(LINK) $(LINKFLAGS)/SHARE $(VERFILE)/OPT, $(OPTFILE)/OPT, $(BINDIR)NETLIB_TCPWARE.OLB/LIB!$(BINDIR)NETLIB_PATHWAY_SHR.EXE -= : $(BINDIR)NETLIB_PATHWAY.OLB($(PATHWAY_MODULES)),-X $(BINDIR)NETLIB_COMMON.OLB($(COMMON_MODULES)) $(VEC), $(OPTFILE), $(VERFILE)S $(LIBR)/COMPRESS/OUTPUT=$(BINDIR)NETLIB_PATHWAY.OLB $(BINDIR)NETLIB_PATHWAY.OLB^ $(LINK) $(LINKFLAGS)/SHARE $(VERFILE)/OPT, $(OPTFILE)/OPT, $(BINDIR)NETLIB_PATHWAY.OLB/LIB$(BINDIR)NETLIB_CMU_SHR.EXE -5 : $(BINDIR)NETLIB_CMU.OLB($(CMU_MODULES)),-X $(BINDIR)NETLIB_COMMON.OLB($(COMMON_MODULES)) $(VEC), $(OPTFILE), $(VERFILE)K $(LIBR)/COMPRESS/OUTPUT=$(BINDIR)NETLIB_CMU.OLB $(BINDIR)NETLIB_CMU.OLBZ $(LINK) $(LINKFLAGS)/SHARE $(VERFILE)/OPT, $(OPTFILE)/OPT, $(BINDIR)NETLIB_CMU.OLB/LIBB$(BINDIR)NETLIB_UCX.OBJ : NETLIB.H, NETLIBDEF.H, NETLIB_UCX.HB$(BINDIR)NETLIB_SRI.OBJ : NETLIB.H, NETLIBDEF.H, NETLIB_SRI.HB$(BINDIR)NETLIB_CMU.OBJ : NETLIB.H, NETLIBDEF.H, NETLIB_CMU.HM$(BINDIR)NETLIB_MULTINET.OBJ : NETLIB_SRI_SUPPORT.C, NETLIB.H, NETLIBDEF.H, -/ NETLIB_SRI.H, NETLIB_MULTINET.HN $(CC)$(CFLAGS)/DEFINE=(MULTINET,MODULE_NAME=NETLIB_MULTINET) $(MMS$SOURCE)N!$(BINDIR)NETLIB_TCPWARE.OBJ : NETLIB_SRI_SUPPORT.C, NETLIB.H, NETLIBDEF.H, -/! NETLIB_SRI.H, NETLIB_TCPWARE.HM! $(CC)$(CFLAGS)/DEFINE=(TCPWARE,MODULE_NAME=NETLIB_TCPWARE) $(MMS$SOURCE)M$(BINDIR)NETLIB_PATHWAY.OBJ : NETLIB_SRI_SUPPORT.C, NETLIB.H, NETLIBDEF.H, -. NETLIB_SRI.H, NETLIB_PATHWAY.HL $(CC)$(CFLAGS)/DEFINE=(PATHWAY,MODULE_NAME=NETLIB_PATHWAY) $(MMS$SOURCE)$(BINDIR)MEM.OBJ, -$(BINDIR)LINEMODE.OBJ, -$(BINDIR)DNS.OBJ, -$(BINDIR)DNS_QUERY.OBJ, -$(BINDIR)DNS_MXLOOK.OBJ, -$(BINDIR)CONNECT.OBJ, -2$(BINDIR)NAMEADDR.OBJ : NETLIB.H, NETLIBDEF.H*$(BINDIR)COMPATIBILITY.OBJ : NETLIBDEF.HL$(BINDIR)MISC.OBJ : NETLIB.H, NETLIBDEF.H, $(SRCDIR)NETLIB_VERSION.H;$(SRCDIR)NETLIB_VERSION.H : $(SRCDIR)NETLIB_VERSION.OPT- @ open/read x $(SRCDIR)NETLIB_VERSION.OPT @ read x __cmd @ close x @ '__cmd @ define/user sys$input nl: @ create $(MMS$TARGET)! @ open/append x $(MMS$TARGET), @ WRITE x "#ifndef __NETLIB_VERSION_H__", @ WRITE x "#define __NETLIB_VERSION_H__"8 @ WRITE x "#define NETLIB_T_VERSION """, ident, """"1 @ WRITE x "#endià NETLIB_SRC.BCKì ç [NETLIB]DESCRIP.MMS;62j-ñf /* __NETLIB_VERSION_H__ */" @ CLOSE x!++?! End of dependencies for binaries. Kit dependencies follow.!--DOC = DOCUMENTjDOCFLAGS = /CONTENTS/NOPRINT/OUTPUT=$(MMS$TARGET)/DEVICE=BLANK_PAGES/SYMBOLS=$(ETCDIR)DYNAMIC_SYMBOLS.SDMLWBRFLAGS = /CONTENTS/NOPRINT/OUTPUT=$(MMS$TARGET)/SYMBOLS=$(ETCDIR)DYNAMIC_SYMBOLS.SDMLL$(KITDIR)NETLIB_DOC.PS : NETLIB_DOC.SDML, $(ETCDIR)DYNAMIC_SYMBOLS.SDML] @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEFINE/USER DECC$SHR SYS$SYSROOT:[SYSLIB]DECC$SHR: $(DOC) $(DOCFLAGS) $(MMS$SOURCE) SOFTWARE.REFERENCE PSM$(KITDIR)NETLIB_DOC.TXT : NETLIB_DOC.SDML, $(ETCDIR)DYNAMIC_SYMBOLS.SDML] @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEFINE/USER DECC$SHR SYS$SYSROOT:[SYSLIB]DECC$SHR< $(DOC) $(DOCFLAGS) $(MMS$SOURCE) SOFTWARE.REFERENCE MAILN$(KITDIR)NETLIB_DOC.DECW$BOOK : NETLIB_DOC.SDML, $(ETCDIR)DYNAMIC_SYMBOLS.SDML] @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEFINE/USER DECC$SHR SYS$SYSROOT:[SYSLIB]DECC$SHR> $(DOC) $(BRFLAGS) $(MMS$SOURCE) SOFTWARE.ONLINE BOOKREADERN$(KITDIR)NETLIB_INST.PS : NETLIB_INST.SDML, $(ETCDIR)DYNAMIC_SYMBOLS.SDML] @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEFINE/USER DECC$SHR SYS$SYSROOT:[SYSLIB]DECC$SHR: $(DOC) $(DOCFLAGS) $(MMS$SOURCE) SOFTWARE.REFERENCE PSO$(KITDIR)NETLIB_INST.TXT : NETLIB_INST.SDML, $(ETCDIR)DYNAMIC_SYMBOLS.SDML] @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEFINE/USER DECC$SHR SYS$SYSROOT:[SYSLIB]DECC$SHR< $(DOC) $(DOCFLAGS) $(MMS$SOURCE) SOFTWARE.REFERENCE MAILP$(KITDIR)NETLIB_INST.DECW$BOOK : NETLIB_INST.SDML, $(ETCDIR)DYNAMIC_SYMBOLS.SDML] @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEFINE/USER DECC$SHR SYS$SYSROOT:[SYSLIB]DECC$SHR> $(DOC) $(BRFLAGS) $(MMS$SOURCE) SOFTWARE.ONLINE BOOKREADERM$(ETCDIR)DYNAMIC_SYMBOLS.SDML : GENERATE_SYMBOLS.COM, NETLIB_VERSION.OPT8 @ @GENERATE_SYMBOLS NETLIB_VERSION.OPT $(MMS$TARGET)5DOCS : $(KITDIR)NETLIB_DOC.DECW$BOOK,-. $(KITDIR)NETLIB_DOC.PS,-/ $(KITDIR)NETLIB_DOC.TXT,-6 $(KITDIR)NETLIB_INST.DECW$BOOK,-/ $(KITDIR)NETLIB_INST.PS,-. $(KITDIR)NETLIB_INST.TXT @ !7KIT : $(KITDIR)NETLIB$(NUM_VERSION).ZIP @ !3$(KITDIR)NETLIB$(NUM_VERSION).ZIP : AAAREADME.DOC,-Y $(KITDIR)NETLIB$(NUM_VERSION).A, $(KITDIR)NETLIB$(NUM_VERSION).B, -X $(KITDIR)NETLIB$(NUM_VERSION).C, $(KITDIR)NETLIB$(NUM_VERSION).D,-- $(KITDIR)NETLIB_SRC.BCKE IF F$SEARCH("$(MMS$TARGET)") .NES. "" THEN DELETE $(MMS$TARGET);*/ $(ZIP)/VMS $(MMS$TARGET) $(MMS$SOURCE_LIST)XAXPKIT : $(KITDIR)NETLIB$(NUM_VERSION).A, $(KITDIR)NETLIB$(NUM_VERSION).C-$(KITDIR)NETLIB$(NUM_VERSION).RELEASE_NOTES -N : NETLIB$(NUM_VERSION).SDML, $(ETCDIR)DYNAMIC_SYMBOLS.SDML] @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEFINE/USER DECC$SHR SYS$SYSROOT:[SYSLIB]DECC$SHR< $(DOC) $(DOCFLAGS) $(MMS$SOURCE) SOFTWARE.REFERENCE MAIL1$(KITDIR)NETLIB$(NUM_VERSION).A : KITINSTAL.COM,-* NETLIB_INSTALL.COM,-/ NETLIB_USER_INSTALL.COM,-3 NETLIB_STARTUP_TEMPLATE.COM,-A $(KITDIR)NETLIB$(NUM_VERSION).RELEASE_NOTES" PURGE/NOLOG $(MMS$SOURCE_LIST)T BACKUP $(MMS$SOURCE_LIST) $(MMS$TARGET)/SAVE/INTERCHANGE/BLOCK=8192/NOCRC/GROU=0/$(KITDIR)NETLIB$(NUM_VERSION).B : NETLIB.OPT, -) NETLIB_SHRXFR.OPT,-* NETLIB_VERSION.OPT,-2 $(BINVAX)NETLIB_SHRXFR.OBJ,-2 $(BINVAX)NETLIB_VECTOR.OBJ,-2 $(BINVAX)NETLIB_COMMON.OLB,-/ $(BINVAX)NETLIB_CMU.OLB,-/ $(BINVAX)NETLIB_UCX.OLB,-4 $(BINVAX)NETLIB_MULTINET.OLB,-3 $(BINVAX)NETLIB_TCPWARE.OLB,-3 $(BINVAX)NETLIB_PATHWAY.OLB,-0 $(BINVAX)NETLIB_SHRXFR.OBJ" PURGE/NOLOG $(MMS$SOURCE_LIST)T BACKUP $(MMS$SOURCE_LIST) $(MMS$TARGET)/SAVE/INTERCHANGE/BLOCK=8192/NOCRC/GROU=05$(KITDIR)NETLIB$(NUM_VERSION).C : NETLIB.ALPHA_OPT, -/ NETLIB_SHRXFR.ALPHA_OPT,-* NETLIB_VERSION.OPT,-2 $(BINAXP)NETLIB_SHRXFR.OBJ,-2 $(BINAXP)NETLIB_COMMON.OLB,-/ $(BINAXP)NETLIB_UCX.OLB,-4 $(BINAXP)NETLIB_MULTINET.OLB,-3 $(BINAXP)NETLIB_TCPWARE.OLB,-3 $(BINAXP)NETLIB_PATHWAY.OLB,-0 $(BINAXP)NETLIB_SHRXFR.OBJ" PURGE/NOLOG $(MMS$SOURCE_LIST)T BACKUP $(MMS$SOURCE_LIST) $(MMS$TARGET)/SAVE/INTERCHANGE/BLOCK=8192/NOCRC/GROU=0>$(KITDIR)NETLIB$(NUM_VERSION).D : NETLIBDEF.H, NETLIBDEF.R32,-6 NETLIBDEF.L32, NETLIBDEF.L32E, -. LIBRARY.DECW$BOOKSHELF,-- NETLIB.DECW$BOOKSHELF,-2 ECHOCLIENT.C, ECHOSERVER.C,-/ ECHOSERVER_STANDALONE.C,-5 $(KITDIR)NETLIB_DOC.DECW$BOOK,-. $(KITDIR)NETLIB_DOC.PS,-/ $(KITDIR)NETLIB_DOC.TXT,-6 $(KITDIR)NETLIB_INST.DECW$BOOK,-/ $(KITDIR)NETLIB_INST.PS,-. $(KITDIR)NETLIB_INST.TXT" PURGE/NOLOG $(MMS$SOURCE_LIST)T BACKUP $(MMS$SOURCE_LIST) $(MMS$TARGET)/SAVE/INTERCHANGE/BLOCK=8192/NOCRC/GROU=0,$(KITDIR)NETLIB_SRC.BCK : DESCRIP.MMS,-: COMPATIBILITY.C, CONNECT.C, DNS.C, -> DNS_MXLOOK.C, DNS_QUERY.C, LINEMODE.C, -2 MEM.C, MISC.C, NAMEADDR.C, -; NETLIB_SRI.C, NETLIB_SRI_SUPPORT.C, -3 NETLIB_UCX.C, NETLIB_CMU.C, -= NETLIB_VECTOR.MAR, NETLIB_SHRXFR.MAR, -8 NETLIB_SRI.H, NETLIB_MULTINET.H, -; NETLIB_TCPWARE.H, NETLIB_PATHWAY.H, -B NETLIB_UCX.H, NETLIB_CMU.H, UCX$INETDEF.H, -= NETLIB.H, NETLIBDEF.H, NETLIBDEF.R32, -5 NETLIB.OPT, NETLIB.ALPHA_OPT, -B NETLIB_SHRXFR.OPT, NETLIB_SHRXFR.ALPHA_OPT,-9 NETLIB_DOC.SDML, NETLIB_INST.SDML,-? GENERATE_SYMBOLS.COM, CHECK_VERSION.COM,-< NETLIB_VERSION.H, NETLIB_VERSION.OPT,-/ NETLIB$(NUM_VERSION).SDML" PURGE/NOLOG $(MMS$SOURCE_LIST)T BACKUP $(MMS$SOURCE_LIST) $(MMS$TARGET)/SAVE/INTERCHANGE/BLOCK=8192/NOCRC/GROU=0ÿÿà NETLIB_SRC.BCKê ç [NETLIB]COMPATIBILITY.C;29Z?$×ð*[NETLIB]COMPATIBILITY.C;29+,ê .?/€ 4Z?8-ç 0ª123KÿPWO956_Lþ¿Á˜7Édþ¿Á˜8j(yçvš9¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**,** ABSTRACT: Pre-V2 compatibility routines.**** MODULE DESCRIPTION:**G** This module contains wrapper routines for NETLIB V2 that implementO** the V1 programming interface, for compatibility with V1-based applications.**J** N.B.: This compatibility may be removed in a future release of NETLIB.F** Existing applications should migrate to the V2 API, and all new/** applications should use only the V2 API.**** AUTHOR: M. MadisonM** COPYRIGHT © 1994, 1995 MADGOAT SOFTWARE. ALL RIGHTS RESERVED.**** CREATION DATE: 25-OCT-1994**** MODIFICATION HISTORY:**1** 25-OCT-1994 V1.0 Madison Initial coding.F** 13-NOV-1994 V1.1 Madison Another V1 compatibility hack -- for%** udp_receive.@** 17-NOV-1994 V1.1-1 Madison A shutdown call on disconnect.B** 11-JAN-1995 V1.1-2 Madison Fix shutdown call on disconnect;0** add default timeout.F** 11-JAN-1995 V1.1-3 Madison Fixed invocation of default timeout.D** 17-FEB-1995 V1.1-4 Madison Allow SS$_LINKDISCON as success on,** tcp_disconnect.**--*/#include "netlibdef.h"#include #include #include #include #include #include #include /*0** A few handy macros and structure definitions*/$#define OK(x) $VMS_STATUS_SUCCESS(x)F#define VERIFY_CONTEXT(p,c) {if (p == 0) return SS$_BADPARAM; c = *p;}"#define SETARGCOUNT(x) va_count(x)#ifdef __ALPHA#pragma member_alignment save#pragma nomember_alignment#endif2 typedef struct {unsigned int low, high;} TIME;#ifdef __ALPHA #pragma member_alignment restore#endif/*:** These constants are from the V1 programming interface.*/#define NET_K_TCP 1#define NET_K_UDP 2#define NET_M_PUSH 1#define NET_M_NOTRM 2/*:** Context structure for tracking a V1-style "connection"*/ struct COMPATCTX { struct NETLIBIOSBDEF iosb; void *ctx; unsigned int proto; unsigned int rcvsinlen; void (*astadr)(); void *astprm; unsigned short *retlenp; struct INADDRDEF *retaddr; unsigned short *retport;% struct NETLIBIOSBDEF *user_iosb; struct SINDEF rcvsin; };/*** Forward declarations*/5 unsigned int net_assign(struct COMPATCTX **xctx);F unsigned int net_bind(struct COMPATCTX **xctx, unsigned int proto,8 unsigned short port, unsigned int threads,$ unsigned int notpass);9 unsigned int net_get_address(struct COMPATCTX **xctx,? struct dsc$descriptor *host, unsigned int alsize,> struct INADDRDEF *alist, unsigned int *alcount);: unsigned int net_addr_to_name(struct COMPATCTX **xctx,B struct INADDRDEF addr, struct dsc$descriptor *name);7 unsigned int net_deassign(struct COMPATCTX **xctx);6 unsigned int net_get_info(struct COMPATCTX **xctx,> struct INADDRDEF *remadr, unsigned int *remport,? struct INADDRDEF *lcladr, unsigned int *lclport);R unsigned int net_get_hostname(struct dsc$descriptor *name, unsigned int *len);5 unsigned int tcp_connect(struct COMPATCTX **xctx,> struct dsc$descriptor *node, unsigned int port);: unsigned int tcp_connect_addr(struct COMPATCTX **xctx,9 struct INADDRDEF *addr, unsigned int port);4 unsigned int tcp_accept(struct COMPATCTX **xctx,D struct COMPATCTX **newctx, struct NETLIBIOSBDEF *iosb,. void (*astadr)(), void *astprm);9 unsigned int tcp_disconnect(struct COMPATCTX **xctx);N unsigned int tcp_send(struct COMPATCTX **xctx, struct dsc$descriptor *str,= unsigned int flags, struct NETLIBIOSBDEF *iosb,. void (*astadr)(), void *astprm);Q unsigned int tcp_receive(struct COMPATCTX **xctx, struct dsc$descriptor *str,I struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm, TIME *timeout);R unsigned int tcp_get_line(struct COMPATCTX **xctx, struct dsc$descriptor *str,I struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm, TIME *timeout);I unsigned int udp_send(struct COMPATCTX **xctx, struct INADDRDEF addr,E unsigned short port, void *buf, unsigned short buflen);C unsigned int udp_receive(struct COMPATCTX **xctx, void *bufptr,= unsigned short bufsize, unsigned short *buflen,? struct INADDRDEF *srcaddr, unsigned int *srcport,8 TIME *timeout, struct NETLIBIOSBDEF *iosb,. void (*astadr)(), void *astprm);; static void udp_read_completion(struct COMPATCTX *ctx);B unsigned int net_set_trace_routine(unsigned int (*routine)());L unsigned int dns_mxlook(struct dsc$descriptor *name, unsigned int *size,? unsigned int *count, struct MXRRDEF *mxrr);/*** OWN storage*/; static unsigned int ctxsize = sizeof(struct COMPATCTX);8 static unsigned int sinsize = sizeof(struct SINDEF);; static unsigned int inasize = sizeof(struct INADDRDEF);U static unsigned int which[2] = {NETLIB_K_LOOKUP_DNS, NETLIB_K_LOOKUP_HOST_TABLE};N static unsigned int type[2] = {NETLIB_K_TYPE_STREAM, NETLIB_K_TYPE_DGRAM}; /***++** ROUTINE: net_assign**** FUNCTIONAL DESCRIPTION:**>** Creates a V1 API network context. Under V1, this routineB** would also assign a channel to the network device. While this;** no longer happens, applications should not be affected.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** NET_ASSIGN ctxptr**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**9** COMPLETION CODES: SS$_NORMAL, or any from LIB$GET_VM.**** SIDE EFFECTS: None.****--*/3unsigned int net_assign (struct COMPATCTX **xctx) { unsigned int status; struct COMPATCTX *ctx;( status = lib$get_vm(&ctxsize, &ctx);# if (!OK(status)) return status; memset(ctx, 0, ctxsize); *xctx = ctx; return SS$_NORMAL;} /* net_assign */ /***++** ROUTINE: net_bind**** FUNCTIONAL DESCRIPTION:**?** Binds a network context to a particular port. For passive<** connections, also establishes the context as a listener.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**C** NETLIB_BIND ctxptr, protocol [,port] [,backlog] [,notpassive]**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/Cunsigned int net_bind (struct COMPATCTX **xctx, unsigned int proto,8 unsigned short port, unsigned int threads,% unsigned int notpass) { struct COMPATCTX *ctx; struct SINDEF sin; struct NETLIBIOSBDEF iosb; unsigned int status; int argc, passive;/*%** Make sure we have a valid context*/à NETLIB_SRC.BCKê ç [NETLIB]COMPATIBILITY.C;29Z?òÛ VERIFY_CONTEXT(xctx, ctx);/*&** Make sure we have enough arguments*/ SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;/*1** Use TCP if they specified an invalid protocol*/* if (proto < 1 || proto > 2) proto = 1;/*** Create a V2 socket*/6 status = netlib_socket(&ctx->ctx, &type[proto-1]);# if (!OK(status)) return status;/*** Passive mode?*/H passive = (argc > 4) ? !notpass : ((argc > 2 && port != 0) ? 1 : 0);/*** Bind the V2 socket*/! memset(&sin, 0, sizeof(sin));( sin.sin_w_family = NETLIB_K_AF_INET;= sin.sin_w_port = (argc > 2) ? netlib_word_swap(port) : 0;; status = netlib_bind(&ctx->ctx, &sin, &sinsize, &iosb);0 if (OK(status)) status = iosb.iosb_w_status; if (!OK(status)) { netlib_close(&ctx->ctx); ctx->ctx = 0; return status; }/*2** For a passive open, establish the listener now*/ if (passive) {I status = netlib_listen(&ctx->ctx, (argc > 3) ? &threads : 0, &iosb);1 if (OK(status)) status = iosb.iosb_w_status; if (!OK(status)) {! netlib_close(&ctx->ctx); ctx->ctx = 0; } } return status; } /* net_bind */ /***++** ROUTINE: net_get_address**** FUNCTIONAL DESCRIPTION:**3** Looks up a host name, returning an IP address.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**A** NET_GET_ADDRESS ctxptr, hostname, listsize, alist [,acount]**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/6unsigned int net_get_address (struct COMPATCTX **xctx,? struct dsc$descriptor *host, unsigned int alsize,? struct INADDRDEF *alist, unsigned int *alcount) { struct COMPATCTX *ctx; unsigned int status; int argc, i, temp; VERIFY_CONTEXT(xctx, ctx); SETARGCOUNT(argc);% if (argc < 4) return SS$_INSFARG;5 if (host == 0 || alist == 0) return SS$_BADPARAM; if (ctx->ctx == 0) {' status = netlib_socket(&ctx->ctx);$ if (!OK(status)) return status; temp = 1; } else temp = 0; for (i = 0; i < 2; i++) {: status = netlib_name_to_address(&ctx->ctx, &which[i],? host, alist, &alsize, (argc > 4) ? alcount : 0); if (OK(status)) break; } if (temp) { netlib_close(&ctx->ctx); ctx->ctx = 0; } return status;} /* net_get_address */ /***++** ROUTINE: net_addr_to_name**** FUNCTIONAL DESCRIPTION:**3** Looks up an IP address, returning a host name.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**3** NET_ADDR_TO_NAME ctxptr, ip-address, hostname**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/7unsigned int net_addr_to_name (struct COMPATCTX **xctx,C struct INADDRDEF addr, struct dsc$descriptor *name) { struct COMPATCTX *ctx; unsigned int status; int argc, i, temp; VERIFY_CONTEXT(xctx, ctx); SETARGCOUNT(argc);% if (argc < 3) return SS$_INSFARG;' if (name == 0) return SS$_BADPARAM; if (ctx->ctx == 0) {' status = netlib_socket(&ctx->ctx);$ if (!OK(status)) return status; temp = 1; } else temp = 0; for (i = 0; i < 2; i++) {K status = netlib_address_to_name(&ctx->ctx, &which[i], &addr, &inasize,% name); if (OK(status)) break; } if (temp) { netlib_close(&ctx->ctx); ctx->ctx = 0; } return status;} /* net_addr_to_name */ /***++** ROUTINE: net_deassign**** FUNCTIONAL DESCRIPTION:**&** Closes down a V1 network context.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** NET_DEASSIGN ctxptr**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**1** COMPLETION CODES: SS$_NORMAL always returned.**** SIDE EFFECTS: None.****--*/5unsigned int net_deassign (struct COMPATCTX **xctx) { struct COMPATCTX *ctx; VERIFY_CONTEXT(xctx, ctx); if (ctx->ctx != 0) { netlib_close(&ctx->ctx); ctx->ctx = 0; } lib$free_vm(&ctxsize, &ctx); *xctx = 0; return SS$_NORMAL;} /* net_deassign */ /***++** ROUTINE: net_get_info**** FUNCTIONAL DESCRIPTION:**G** Gets the local and/or remote socket information (address and port)** for a connection.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**C** NET_GET_INFO ctxptr, [remadr] [,remport] [,lcladr] [,lclport]**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/3unsigned int net_get_info (struct COMPATCTX **xctx,> struct INADDRDEF *remadr, unsigned int *remport,@ struct INADDRDEF *lcladr, unsigned int *lclport) { struct COMPATCTX *ctx; struct SINDEF sin; unsigned int status; unsigned int retlen; int argc; VERIFY_CONTEXT(xctx, ctx); SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;* if (ctx->ctx == 0) return SS$_NOLINKS;/*4** Get the remote information, if they asked for it*/4 if (remadr != 0 || (argc > 2 && remport != 0)) {E status = netlib_getpeername(&ctx->ctx, &sin, &sinsize, &retlen);$ if (!OK(status)) return status;= if (argc > 2 && remport != 0) *remport = sin.sin_w_port;/ if (remadr != 0) *remadr = sin.sin_x_addr; }/*7** Now get the local information, if they asked for it*/ if (argc > 3) {E status = netlib_getsockname(&ctx->ctx, &sin, &sinsize, &retlen); if (OK(status)) {3 if (lcladr != 0) *lcladr = sin.sin_x_addr;A if (argc > 4 && lclport != 0) *lclport = sin.sin_w_port; } } return status;} /* net_get_info */ /***++** ROUTINE: net_get_hostname**** FUNCTIONAL DESCRIPTION:**$** Returns the local IP host name.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**)** NET_GET_HOSTNAME hostname [,retlen]**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/Punsigned int net_get_hostname (struct dsc$descriptor *name, unsigned int *len) { unsigned int status; unsigned short retlen; int argc; SETARGCOUNT(argc);0 status = netlib_get_hostname(name, &retlen);: if (OK(status) && argc > 1 && len != 0) *len = retlen; return status;} /* net_get_hostname */ /***++** ROUTINE: tcp_connect**** FUNCTIONAL DESCRIPTION:**=** Performs an active open to establish a TCP connection to** a remote system (by name).**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**(** TCP_CONNECT ctxptr, hostname, port**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/2unsigned int tcp_connect (struct COMPATCTX **xctx,? struct dsc$descriptor *node, unsigned int port) { struct COMPATCTX *ctx; unsigned short p; unsigned int status; VERIFY_CONTEXT(xctx, ctx); if (ctx->cà NETLIB_SRC.BCKê ç [NETLIB]COMPATIBILITY.C;29Z?oBtx == 0) {< status = netlib_socket(&ctx->ctx, &type[ctx->proto-1]);$ if (!OK(status)) return status; } p = port;7 return netlib_connect_by_name(&ctx->ctx, node, &p);} /* tcp_connect */ /***++** ROUTINE: tcp_connect_addr**** FUNCTIONAL DESCRIPTION:**9** Performs an active open to establish a connection to** a remote system by address.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**,** TCP_CONNECT_ADDR ctxptr, addrptr, port**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/7unsigned int tcp_connect_addr (struct COMPATCTX **xctx,: struct INADDRDEF *addr, unsigned int port) { struct COMPATCTX *ctx; struct SINDEF sin; unsigned int status; VERIFY_CONTEXT(xctx, ctx); if (ctx->ctx == 0) {< status = netlib_socket(&ctx->ctx, &type[ctx->proto-1]);$ if (!OK(status)) return status; }! memset(&sin, 0, sizeof(sin));( sin.sin_w_family = NETLIB_K_AF_INET;, sin.sin_w_port = netlib_word_swap(port); sin.sin_x_addr = *addr;5 return netlib_connect(&ctx->ctx, &sin, &sinsize);} /* tcp_connect */ /***++** ROUTINE: tcp_accept**** FUNCTIONAL DESCRIPTION:**B** Accepts an incoming TCP connection (passive open completion).**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**>** TCP_ACCEPT ctxptr, newctxptr [,iosb] [,astadr] [,astprm]**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.i**** COMPLETION CODES: See code.r**** SIDE EFFECTS: None.****--*/1unsigned int tcp_accept (struct COMPATCTX **xctx,lB struct COMPATCTX **xnew, struct NETLIBIOSBDEF *iosb,/ void (*astadr)(), void *astprm) {o struct COMPATCTX *ctx, *new; int argc;  SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;M VERIFY_CONTEXT(xctx, ctx); VERIFY_CONTEXT(xnew, new);7 return netlib_accept(&ctx->ctx, &new->ctx, 0, 0, 0,99 (argc > 2) ? iosb : 0, (argc > 3) ? astadr : 0,.# (argc > 4) ? astprm : 0);1} /* tcp_accept */ n/***++** ROUTINE: tcp_disconnect**** FUNCTIONAL DESCRIPTION:i**"** Closes down a TCP connection.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** TCP_DISCONNECT ctxptr **** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.n**** COMPLETION CODES: See code.-**** SIDE EFFECTS: None.****--*/7unsigned int tcp_disconnect (struct COMPATCTX **xctx) {c struct COMPATCTX *ctx; unsigned int status;< static unsigned int shuttype = NETLIB_K_SHUTDOWN_SENDER; VERIFY_CONTEXT(xctx, ctx);) if (ctx->ctx == 0) return SS$_NORMAL;3 status = netlib_shutdown(&ctx->ctx, &shuttype);? if (!OK(status) && status != SS$_LINKDISCON) return status;p% status = netlib_close(&ctx->ctx); ! if (OK(status)) ctx->ctx = 0;n return status;} /* tcp_disconnect */ v/***++** ROUTINE: tcp_sende**** FUNCTIONAL DESCRIPTION:d**9** Sends data on a TCP connection, possibly followed byt** a CR/LF sequence.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**B** TCP_SEND ctxptr, strdsc [,flags] [,iosb] [,astadr] [,astprm]**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.E**** SIDE EFFECTS: None.****--*/Kunsigned int tcp_send (struct COMPATCTX **xctx, struct dsc$descriptor *str,v> unsigned int flags, struct NETLIBIOSBDEF *iosb,0 void (*astadr)(), void *astprm) { struct COMPATCTX *ctx; unsigned int f;I int argc;  VERIFY_CONTEXT(xctx, ctx); SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG; & if (str == 0) return SS$_BADPARAM;* if (ctx->ctx == 0) return SS$_NOLINKS; f = (argc > 2) ? flags : 0;e if (f & NET_M_NOTRM) {E return netlib_write(&ctx->ctx, str, 0, 0, (argc > 3) ? iosb : 0,@ (argc > 4) ? astadr : 0, (argc > 5) ? astprm : 0); } else {C return netlib_writeline(&ctx->ctx, str, (argc > 3) ? iosb : 0,n@ (argc > 4) ? astadr : 0, (argc > 5) ? astprm : 0); }a} /* tcp_send */ t/***++** ROUTINE: tcp_receive**** FUNCTIONAL DESCRIPTION:**%** Reads data off a TCP connection.C**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**G** TCP_RECEIVE ctxptr, bufdsc [,iosb] [,astadr] [,astprm] [,timeout]s**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.n**** COMPLETION CODES: See code.***** SIDE EFFECTS: None.****--*/Nunsigned int tcp_receive (struct COMPATCTX **xctx, struct dsc$descriptor *str,I struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm,n TIME *timeout) { struct COMPATCTX *ctx; struct dsc$descriptor dsc; unsigned int status; int argc;a VERIFY_CONTEXT(xctx, ctx); SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;i& if (str == 0) return SS$_BADPARAM;* if (ctx->ctx == 0) return SS$_NOLINKS;/*J** HACK to support broken MGFTP code, which passes us a static descriptor,** which is set up as a dynamic descriptor!*/K status = lib$analyze_sdesc(str, &dsc.dsc$w_length, &dsc.dsc$a_pointer);D$ dsc.dsc$b_dtype = DSC$K_DTYPE_T;$ dsc.dsc$b_class = DSC$K_CLASS_S;J return netlib_read(&ctx->ctx, &dsc, 0, 0, 0, (argc > 5) ? timeout : 0,> (argc > 2) ? iosb : 0, (argc > 3) ? astadr : 0,( (argc > 4) ? astprm : 0);} /* tcp_receive */t p/***++** ROUTINE: tcp_get_line **** FUNCTIONAL DESCRIPTION:n**G** Reads a "line" of data (a string of characters which is terminatedr3** with a CR/LF sequence) from the TCP connection. **B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**I** TCP_GET_LINE ctxptr, bufdsc [,iosb] [,astadr] [,astprm], [,timeout]E**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.t**** COMPLETION CODES: See code.M**** SIDE EFFECTS: None.****--*/Ounsigned int tcp_get_line (struct COMPATCTX **xctx, struct dsc$descriptor *str,rI struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm,s TIME *timeout) { struct COMPATCTX *ctx;2 static unsigned int flags = NETLIB_M_ALLOW_LF;( static TIME default_timeout = {1,0}; static int did_timeout = 0;e< static $DESCRIPTOR(default_timeoutdsc, "0 00:10:00.00"); int argc;= VERIFY_CONTEXT(xctx, ctx); SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;Y& if (str == 0) return SS$_BADPARAM;* if (ctx->ctx == 0) return SS$_NOLINKS;Z if (!did_timeout) did_timeout = OK(sys$bintim(&default_timeoutdsc, &default_timeout));5 return netlib_readline(&ctx->ctx, str, 0, &flags,lG (argc > 5 && timeout != 0) ? timeout : &default_timeout,> (argc > 2) ? iosb : 0, (argc > 3) ? astadr : 0,( (argc > 4) ? astprm : 0);} /* tcp_get_line */ T/***++** ROUTINE: udp_sendO**** FUNCTIONAL DESCRIPTION:N**** Sends a UDP datagram.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**4** UDP_SEND ctxptr, address, port, bufptr, buflen**** IMPLICIT INPUTS: None.**** IMPLICà NETLIB_SRC.BCKê ç [NETLIB]COMPATIBILITY.C;29Z?˨-IT OUTPUTS: None. **** COMPLETION CODES: See code. **** SIDE EFFECTS: None.****--*/Funsigned int udp_send (struct COMPATCTX **xctx, struct INADDRDEF addr,B unsigned short port, void *buf, unsigned short buflen) { struct COMPATCTX *ctx; struct SINDEF sin; struct dsc$descriptor dsc; VERIFY_CONTEXT(xctx, ctx);* if (ctx->ctx == 0) return SS$_NOLINKS;$ dsc.dsc$b_dtype = DSC$K_DTYPE_T;$ dsc.dsc$b_class = DSC$K_CLASS_S; dsc.dsc$w_length = buflen; dsc.dsc$a_pointer = buf;! memset(&sin, 0, sizeof(sin));e( sin.sin_w_family = NETLIB_K_AF_INET; sin.sin_x_addr = addr;, sin.sin_w_port = netlib_word_swap(port);9 return netlib_write(&ctx->ctx, &dsc, &sin, &sinsize);n} /* udp_send */ /***++** ROUTINE: udp_receive**** FUNCTIONAL DESCRIPTION:M**** Receives a UDP datagram.;**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**>** UDP_RECEIVE ctxptr, bufptr, bufsize [,retlen] [,srcaddr]@** [,srcport] [,timeout] [,iosb] [,astadr] [,astprm]**D** N.B.: for synchronous calls, srcport should be the address of aC** longword. For asynchronous calls, it should be the address2** of a word.**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES: See code.)**** SIDE EFFECTS: None.****--*/@unsigned int udp_receive (struct COMPATCTX **xctx, void *bufptr,= unsigned short bufsize, unsigned short *buflen,i? struct INADDRDEF *srcaddr, unsigned int *srcport,i8 TIME *timeout, struct NETLIBIOSBDEF *iosb,/ void (*astadr)(), void *astprm) {  struct COMPATCTX *ctx; struct SINDEF sin; struct dsc$descriptor dsc; unsigned int status; int argc;t VERIFY_CONTEXT(xctx, ctx); SETARGCOUNT(argc);% if (argc < 3) return SS$_INSFARG;) if (bufptr == 0) return SS$_BADPARAM;s* if (ctx->ctx == 0) return SS$_NOLINKS;$ dsc.dsc$b_dtype = DSC$K_DTYPE_T;$ dsc.dsc$b_class = DSC$K_CLASS_S; dsc.dsc$a_pointer = bufptr;x dsc.dsc$w_length = bufsize;" if (argc > 8 && astadr != 0) {" ctx->retaddr = srcaddr; / ctx->retport = (unsigned short *) srcport;D ctx->retlenp = buflen;u ctx->user_iosb = iosb;P ctx->astadr = astadr;+ ctx->astprm = (argc > 9) ? astprm : 0; @ return netlib_read(&ctx->ctx, &dsc, &ctx->rcvsin, &sinsize,8 &ctx->rcvsinlen, timeout, &ctx->iosb,- udp_read_completion, ctx);* }EA status = netlib_read(&ctx->ctx, &dsc, &ctx->rcvsin, &sinsize,A &ctx->rcvsinlen, (argc > 6) ? timeout : 0, &ctx->iosb);  if (OK(status)) {hC if (argc > 3 && buflen != 0) *buflen = ctx->iosb.iosb_w_count;sE if (argc > 4 && srcaddr != 0) *srcaddr = ctx->rcvsin.sin_x_addr;s" if (argc > 5 && srcport != 0)= *srcport = netlib_word_swap(ctx->rcvsin.sin_w_port);( }4K if (argc > 7 && iosb != 0) memcpy(iosb, &ctx->iosb, sizeof(ctx->iosb)); return status;} /* udp_receive */e b/***++ ** ROUTINE: udp_read_completion**** FUNCTIONAL DESCRIPTION: **G** AST completion routine for asynchronous UDP_READ calls. Does somem<** pre-processing before invoking the caller's AST routine.**** RETURNS: void **** PROTOTYPE:**** UDP_READ_COMPLETION ctx**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/9static void udp_read_completion (struct COMPATCTX *ctx) {/*E** Stash the originating address and port, if the caller wanted themc*/& if (OK(ctx->iosb.iosb_w_status)) {E if (ctx->retaddr != 0) *(ctx->retaddr) = ctx->rcvsin.sin_x_addr;r if (ctx->retport != 0)CD *(ctx->retport) = netlib_word_swap(ctx->rcvsin.sin_w_port);E if (ctx->retlenp != 0) *(ctx->retlenp) = ctx->iosb.iosb_w_count;n }n/*$** Stash the IOSB, if it was wanted*/S if (ctx->user_iosb != 0) memcpy(ctx->user_iosb, &ctx->iosb, sizeof(ctx->iosb));X/*#** Invoke the caller's AST routiner*/ (*ctx->astadr)(ctx->astprm);} /* udp_read_completion */; /***++"** ROUTINE: net_set_trace_routine**** FUNCTIONAL DESCRIPTION:**C** This routine was used in the V1 interface for tracing activity ;** of the MX lookup routine. It no longer has any effect.e**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**"** NET_SET_TRACE_ROUTINE rtnptr**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **1** COMPLETION CODES: SS$_NORMAL always returned.**** SIDE EFFECTS: None.****--*/@unsigned int net_set_trace_routine (unsigned int (*routine)()) { return SS$_NORMAL;} /* net_set_trace_routine */o a/***++** ROUTINE: dns_mxlookN**** FUNCTIONAL DESCRIPTION:)**A** Looks up MX RR's in the DNS for a domain name. Returns themtE** in an array of special structures (the same structure is used for*'** the V2 equivalent of this routine). **B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**5** DNS_MXLOOK name, mxrrsize [,mxrrcount], mxrrptrE**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None._**** COMPLETION CODES: See code.;**** SIDE EFFECTS: None.****--*/Hunsigned int dns_mxlook(struct dsc$descriptor *name, unsigned int *size,? unsigned int *count, struct MXRRDEF *mxrr) {N void *ctx; unsigned int status;! status = netlib_socket(&ctx);# if (!OK(status)) return status;NA status = netlib_dns_mx_lookup(&ctx, name, mxrr, size, count);R netlib_close(&ctx);T return status;} /* dns_mxlook */ÿÿ,lclport]**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/3unsigned int net_get_info (struct COMPATCTX **xctx,> stà NETLIB_SRC.BCKë ç [NETLIB]CONNECT.C;9Owüð*[NETLIB]CONNECT.C;9+,ë ./€ 4O‚-ç 0ª123KÿPWO56ä¢múª˜7™¶múª˜8—͈çvš9¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**** ABSTRACT: Connect by name.**** MODULE DESCRIPTION:**=** This module contains the NETLIB_CONNECT_BY_NAME routine,E** which does establishes an active TCP connect to a remote host and&** port by name, rather than address.**** AUTHOR: M. MadisonM** COPYRIGHT © 1994, 1995 MADGOAT SOFTWARE. ALL RIGHTS RESERVED.**** CREATION DATE: 25-OCT-1994**** MODIFICATION HISTORY:**1** 25-OCT-1994 V1.0 Madison Initial coding.E** 17-NOV-1994 V1.0-1 Madison Don't use _both_ DNS & host tables!E** 19-JAN-1994 V1.0-2 Madison Fix connect() call completion args.**--*/#include "netlib.h"/*0** Context structure used to track our progress*/ struct Connect_Context { struct NETLIBIOSBDEF iosb; struct dsc$descriptor dsc; unsigned int ctxsize; char *name; struct CTX *ctx; int state;- unsigned int adrcnt, htadrcnt, nsadrcnt; int curadr; void (*astadr)(); void *astprm;% struct NETLIBIOSBDEF *user_iosb; struct SINDEF sin; struct INADDRDEF *adrlst;/ struct INADDRDEF htadrlst[8], nsadrlst[8]; };/*** Forward declarations*/: unsigned int netlib_connect_by_name(struct CTX **xctx,? struct dsc$descriptor *dsc, unsigned short *port,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);@ static unsigned int do_connect(struct Connect_Context *con);/*** OWN storage*/5 static unsigned int usedns = NETLIB_K_LOOKUP_DNS;< static unsigned int useht = NETLIB_K_LOOKUP_HOST_TABLE;8 static unsigned int sinsize = sizeof(struct SINDEF);/*** External references*/F unsigned int netlib_name_to_address(struct CTX **, unsigned int *,: struct dsc$descriptor *, struct INADDRDEF *,# unsigned int *, ...);? unsigned int netlib_connect(struct CTX **, struct SINDEF *,# unsigned int *, ...);O unsigned int netlib_strtoaddr(struct dsc$descriptor *, struct INADDRDEF *); /***++#** ROUTINE: netlib_connect_by_name**** FUNCTIONAL DESCRIPTION:**D** Connects to a remote host/port by name. The name is looked up,D** then a connection is tried to each address until a connection is,** established, or we run out of addresses.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**M** NETLIB_CONNECT_BY_NAME ctxptr, namdsc, port [,iosb] [,astadr] [,astprm]**I** ctxptr: NETLIB context, longword (unsigned), read only, by referenceD** namdsc: char_string, character string, read only, by descriptorD** port: word_unsigned, word (unsigned), read only, by referenceK** iosb: io_status_block, quadword (unsigned), write only, by reference?** astadr: ast_procedure, procedure value, call, by reference?** astprm: user_arg, longword (unsigned), read only, by value**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:2** SS$_NORMAL: normal successful completion*** SS$_INSFARG: not enough arguments'** SS$_BADPARAM: invalid argument2** Codes from LIB$GET_VM, LIB$ANALYZE_SDESC, and'** other NETLIB network status codes.**** SIDE EFFECTS: None.****--*/7unsigned int netlib_connect_by_name (struct CTX **xctx,? struct dsc$descriptor *dsc, unsigned short *port,K struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm) { struct Connect_Context *con; struct CTX *ctx; struct INADDRDEF addr; unsigned int status, size; unsigned short namlen; char *namp; int argc;/*** Verify the arguments*/ VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 3) return SS$_INSFARG;3 if (dsc == 0 || port == 0) return SS$_BADPARAM;/*/** Allocate and fill in the connection context*/4 status = lib$analyze_sdesc(dsc, &namlen, &namp);# if (!OK(status)) return status;3 size = namlen + sizeof(struct Connect_Context);% status = lib$get_vm(&size, &con);# if (!OK(status)) return status; memset(con, 0, size);# con->name = (char *) (con + 1);$ memcpy(con->name, namp, namlen);, INIT_SDESC(con->dsc, namlen, con->name); con->ctx = ctx;- con->sin.sin_w_family = NETLIB_K_AF_INET;2 con->sin.sin_w_port = netlib_word_swap(*port); con->ctxsize = size;: size = sizeof(con->htadrlst)/sizeof(con->htadrlst[0]);5 if (argc > 3 && iosb != 0) con->user_iosb = iosb;" if (argc > 4 && astadr != 0) { con->astadr = astadr;( if (argc > 5) con->astprm = astprm; }/*>** If they provided us with a dotted-decimal IP address, fake@** out do_connect to make it look like we looked up the address ** via DNS.*/1 if (OK(netlib_strtoaddr(&con->dsc, &addr))) {* con->iosb.iosb_w_status = SS$_NORMAL; con->nsadrcnt = 1; con->nsadrlst[0] = addr;A if (con->astadr != 0) return sys$dclast(do_connect, con, 0); return do_connect(con); }/*B** Make lookup via host table synchronous and in main-line thread<** because we can't call it from AST level for all packages*/A status = netlib_name_to_address(&con->ctx, &useht, &con->dsc,@ con->htadrlst, &size, &con->htadrcnt, &con->iosb);' if (!OK(status)) con->htadrcnt = 0;: size = sizeof(con->nsadrlst)/sizeof(con->nsadrlst[0]);/*E** For an asynch call, do the DNS lookup and have DO_CONNECT invoked** as the AST routine*/" if (argc > 4 && astadr != 0) {C status = netlib_name_to_address(&con->ctx, &usedns, &con->dsc,? con->nsadrlst, &size, &con->nsadrcnt, &con->iosb, do_connect, con);7 if (!OK(status)) lib$free_vm(&con->ctxsize, &con); return status; }/**** Synchronous call: do the DNS lookup...*/B status = netlib_name_to_address(&con->ctx, &usedns, &con->dsc,@ con->nsadrlst, &size, &con->nsadrcnt, &con->iosb);/*D** ... if it failed, fall back on the host table lookup info we got*/ if (!OK(status)) {- con->iosb.iosb_w_status = SS$_ENDOFFILE; con->nsadrcnt = 0; }/*0** Just call DO_CONNECT to complete this for us*/ return do_connect(con);} /* netlib_connect_by_name */ /***++** ROUTINE: do_connect**** FUNCTIONAL DESCRIPTION:**;** Completion routine for NETLIB_CONNECT_BY_NAME. Can be@** invoked as a regular main-line routine or an AST completion.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**#** DO_CONNECT connection-context**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**5** COMPLETION CODES: Any NETLIB network status code.**** SIDE EFFECTS: None.****--*/>static unsigned int do_connect (struct Connect_Context *con) { unsigned int status; int done;/*;** We implement our FSM as a loop for the synchronous case*/ done = 0; while (!done) {& status à NETLIB_SRC.BCKë ç [NETLIB]CONNECT.C;9OF|= con->iosb.iosb_w_status; switch (con->state) {/*F** Initial state -- if the DNS lookup failed, fall back on host table4** entry. Otherwise, start trying the connections.*/ case 0:# if (con->nsadrcnt == 0) {' if (con->htadrcnt == 0) {7 con->iosb.iosb_w_status = SS$_ENDOFFILE; done = 1; break; }* con->adrlst = con->htadrlst;* con->adrcnt = con->htadrcnt; } else {* con->adrlst = con->nsadrlst;* con->adrcnt = con->nsadrcnt; } con->state = 1; /* and fall through *//*!** State 1: Attempt a connection*/ case 1:; con->sin.sin_x_addr = con->adrlst[con->curadr++]; con->state = 2;A status = netlib_connect(&con->ctx, &con->sin, &sinsize,C &con->iosb, (con->astadr == 0) ? 0 : do_connect,7 (con->astadr == 0) ? 0 : con);$ if (!OK(status)) done = 1;, else if (con->astadr != 0) return; break;/*D** State 2: connect() completion status check. If we're successfulB** or we've run out of addresses, we're done. Otherwise, we loop** back up and try again.*/ case 2:A if (OK(status) || con->curadr >= con->adrcnt) done = 1; con->state = 1; break; } }/*B** We're done, one way or another. Fill in the caller's IOSB and(** call back the AST, if there was one.*/ if (con->user_iosb != 0); memcpy(con->user_iosb, &con->iosb, sizeof(con->iosb));6 if (con->astadr != 0) (*con->astadr)(con->astprm);/*+** We're done with this context -- free it*/% lib$free_vm(&con->ctxsize, &con);/*'** Synchronous completion occurs here.*/ return status;} /* do_connect */ÿÿà  NETLIB_SRC.BCKí ç [NETLIB]DNS.C;20Z´îà*[NETLIB]DNS.C;20+,í ./€ 4ZÜ-ç 0ª123KÿPWO56uÊË ›70ò Ë ›89¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**#** ABSTRACT: DNS resolver support.**** MODULE DESCRIPTION:**D** This module contains support routines for implementing NETLIB's!** Domain Name Service resolver.**** AUTHOR: M. Madison7** COPYRIGHT © 1994, 1996 MADGOAT SOFTWARE."** ALL RIGHTS RESERVED.**** CREATION DATE: 22-OCT-1994**** MODIFICATION HISTORY:**1** 22-OCT-1994 V1.0 Madison Initial coding.B** 17-NOV-1994 V1.1 Madison Removed socket from DNS context.2** 18-NOV-1994 V1.2 Madison Add retry count.H** 12-FEB-1996 V1.2-1 Madison Fixed rather stupid bug in expandname.Z** 04-MAR-1997 V1.2-2 Madison Fixed stupid bug in dns_init (counter/ptr update order).**--*/#include "netlib.h"#include /*** Forward declarations*/4 unsigned int netlib___dns_init(struct CTX *ctx);4 void netlib___free_dns_context(struct CTX *ctx);I int netlib_dns_skipname(unsigned char *bufp, unsigned short *buflen);R unsigned int netlib_dns_expandname(unsigned char *buf, unsigned short *buflen,A unsigned char *bufp, struct dsc$descriptor *namdsc,? unsigned short *retlen, unsigned short *bufchrs);/*** OWN storage*/6 static $DESCRIPTOR(default_timeout, "0 00:00:05");/*** External references*/- int netlib___get_nameservers(QUEUE *nsq);F int netlib___get_domain(char *, unsigned short, unsigned short *); /***++** ROUTINE: netlib___dns_init**** FUNCTIONAL DESCRIPTION:**2** Initializes an internal DNS resolver context.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**'** netlib___dns_init(struct CTX *ctx)**1** ctx: NETLIB context, modify, by reference.**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/2unsigned int netlib___dns_init (struct CTX *ctx) { struct DOMAIN *dom; unsigned int status; ITMLST lnmlst[3]; int i, maxidx; unsigned int size; unsigned short buflen; char buf[256];7 static unsigned int socktype = NETLIB_K_TYPE_DGRAM;8 static unsigned int ctxsize = sizeof(struct DNSCTX);/ static $DESCRIPTOR(tabnam, "LNM$FILE_DEV");7 static $DESCRIPTOR(lognam, "NETLIB_SEARCH_DOMAIN");/*%** Allocate the DNS resolver context*/0 status = lib$get_vm(&ctxsize, &ctx->dnsctx);# if (!OK(status)) return status;! INIT_QUEUE(ctx->dnsctx->nsq);" INIT_QUEUE(ctx->dnsctx->domq);/*:** Get the list of name servers we're supposed to contact*/; if (netlib___get_nameservers(&ctx->dnsctx->nsq) == 0) {) lib$free_vm(&ctxsize, &ctx->dnsctx); ctx->dnsctx = 0; ctx->flags |= CTX_M_NO_DNS; return SS$_UNSUPPORTED; }/*B** Get the list of NETLIB search domains, or the package-specific ** ones.*/G ITMLST_INIT(lnmlst[0], LNM$_MAX_INDEX, sizeof(maxidx), &maxidx, 0);' ITMLST_INIT(lnmlst[1], 0, 0, 0, 0);9 if (OK(sys$trnlnm(0, &tabnam, &lognam, 0, lnmlst))) {: ITMLST_INIT(lnmlst[0], LNM$_INDEX, sizeof(i), &i, 0);D ITMLST_INIT(lnmlst[1], LNM$_STRING, sizeof(buf), buf, &buflen);( ITMLST_INIT(lnmlst[2], 0, 0, 0, 0);$ for (i = 0; i <= maxidx; i++) {M if (OK(sys$trnlnm(0, &tabnam, &lognam, 0, lnmlst)) && buflen != 0) {0 size = buflen + sizeof(struct DOMAIN);, if (OK(lib$get_vm(&size, &dom))) {# dom->length = buflen;- memcpy(dom->name, buf, buflen);' dom->name[buflen] = '\0';8 queue_insert(dom, ctx->dnsctx->domq.tail); } } }@ } else if (netlib___get_domain(buf, sizeof(buf), &buflen)) { char *cp, *cp1; int remain; cp = buf; remain = buflen;/*I** A search domain must have at least two parts, to avoid the ".com.edu"I** problem, which is why we check to make sure that the remaining domain ** string has at least one dot.*/ while (remain > 0) {' cp1 = memchr(cp, '.', remain); if (cp1 == 0) break;/ size = remain + sizeof(struct DOMAIN);+ if (OK(lib$get_vm(&size, &dom))) { dom->length = remain;( memcpy(dom->name, cp, remain);# dom->name[remain] = '\0';4 queue_insert(dom, ctx->dnsctx->domq.tail); }" remain -= (cp1 - cp) + 1; cp = cp1 + 1; } }8 sys$bintim(&default_timeout, &ctx->dnsctx->timeout);! ctx->dnsctx->retry_count = 4; return SS$_NORMAL;} /* netlib___dns_init */  /***++&** ROUTINE: netlib___free_dns_context**** FUNCTIONAL DESCRIPTION:**&** Deallocates the resolver context.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**/** netlib___free_dns_context(struct CTX *ctx)**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/2void netlib___free_dns_context (struct CTX *ctx) { struct NAMESERVER *ns; struct DOMAIN *d; unsigned int size;! if (ctx->dnsctx == 0) return;% size = sizeof(struct NAMESERVER);M while (queue_remove(ctx->dnsctx->nsq.head, &ns)) lib$free_vm(&size, &ns);6 while (queue_remove(ctx->dnsctx->domq.head, &d)) {. size = sizeof(struct DOMAIN) + d->length; lib$free_vm(&size, &d); }! size = sizeof(struct DNSCTX);% lib$free_vm(&size, &ctx->dnsctx); ctx->dnsctx = 0;!} /* netlib___free_dns_context */ /***++ ** ROUTINE: netlib_dns_skipname**** FUNCTIONAL DESCRIPTION:**@** Utility routine for skipping over a name in a DNS response.F** Handles the compressed form of domain string that DNS packets use.**** RETURNS: longword_signed**E** The number of bytes to be skipped in the DNS packet is returned.**** PROTOTYPE:**&** NETLIB_DNS_SKIPNAME bufp, buflen**B** bufp: char_string, character string, read only, by referenceC** buflen: word_unsigned, word (unsigned), read only, by reference**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/Gint netlib_dns_skipname (unsigned char *bufp, unsigned short *buflen) { unsigned char *cp, *eom; cp = bufp; eom = cp + *buflen;" while (cp < eom && *cp != 0) { if (*cp >= 64) cp++; else cp += *cp + 1; } return (cp - bufp) + 1;} /* netlib_dns_skipname */ /***++"** ROUTINE: netlib_dns_expandname**** FUNCTIONAL DESCRIPTION:**C** Expands a domain string from a DNS reply packet into somethingE** human-readable. The string is returned, along with the number ofK** bytes in the DNS packet that composed the name (which won't necessarilyG** be the same as the string length because of the compression used in** DNS packets).**>** RETURNS: cond_value, condition value, write only, by value**** PROTOTYPE:**H** NETLIB_DNS_EXPANDNAME buf, buflen, bufp, namdsc [,retlen] [,count]**C** buf: char_string, character string, read only, by referenceD** buflen: word_unsigned, word (unsigned), read only, by reference?** bufp: pointer, longword (unsigned), modify, by referenceE** namdsc: char_string, character string, write only, by descriptorE** retlen: word_unsigned, word (unsigned), write only, by referenceE** count: word_unsigned, word (unsigned),  NETLIB_SRC.BCKí ç [NETLIB]DNS.C;20Z write only, by reference**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/Ounsigned int netlib_dns_expandname (unsigned char *buf, unsigned short *buflen,= unsigned char *bufp, struct dsc$descriptor *namdsc,; unsigned short *retlen, unsigned short *countp) { int argc, indirect; struct dsc$descriptor dsc; char name[256], *namp;! unsigned short namlen, count; unsigned int status; SETARGCOUNT(argc); namp = name; indirect = 0; count = 0; while (*bufp != 0) { if (*bufp < 64) {+ if (!indirect) count += *bufp + 1;. if (namp-name+*bufp < sizeof(name)) {& memcpy(namp, bufp+1, *bufp); namp += *bufp; *namp++ = '.'; } bufp += *bufp + 1; } else {# if (!indirect) count += 2; indirect = 1;K bufp = buf + (netlib_word_swap(*(unsigned short *)bufp) - 0xc000);7 if (bufp - buf > *buflen) return SS$_BADPARAM; } }G if (!indirect) count += 1; /* for the extra null byte at the end */) INIT_SDESC(dsc, (namp-name)-1, name);* status = lib$scopy_dxdx(&dsc, namdsc);# if (!OK(status)) return status;; if (argc > 4 && retlen != 0) *retlen = namp - name - 1;1 if (argc > 5 && countp != 0) *countp = count; return SS$_NORMAL;} /* netlib_dns_expandname */ÿÿà  NETLIB_SRC.BCKî ç [NETLIB]DNS_MXLOOK.C;8[¼ ð*[NETLIB]DNS_MXLOOK.C;8+,î ./€ 4[À-ç 0ª123KÿPWO56° yM‰„˜7ðâˆM‰„˜86Àçvš9¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**'** ABSTRACT: DNS MX RR lookup routines**** MODULE DESCRIPTION:**?** This module contains routines for implementing MX resource6** record lookups in the DNS using NETLIB's resolver.**** AUTHOR: M. MadisonG** COPYRIGHT © 1994, MADGOAT SOFTWARE. ALL RIGHTS RESERVED.**** CREATION DATE: 25-OCT-1994**** MODIFICATION HISTORY:**1** 25-OCT-1994 V1.0 Madison Initial coding.**--*/#include "netlib.h"/*** Forward declarations*/: unsigned int netlib___dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);A static unsigned int mxlook_completion(struct DNSREQ *dnsreq);/*** External references*/4 unsigned int netlib___dns_init(struct CTX *ctx);S unsigned int netlib_dns_query(struct CTX **xctx, struct dsc$descriptor *namdsc,6 unsigned int *class, unsigned int *type,: unsigned char *buf, unsigned short *bufsize,> unsigned int *flags, struct NETLIBIOSBDEF *iosb,. void (*astadr)(), void *astprm);I int netlib_dns_skipname(unsigned char *bufp, unsigned short *buflen);R unsigned int netlib_dns_expandname(unsigned char *buf, unsigned short *buflen,A unsigned char *bufp, struct dsc$descriptor *namdsc,? unsigned short *retlen, unsigned short *bufchrs); /***++#** ROUTINE: netlib___dns_mx_lookup**** FUNCTIONAL DESCRIPTION:**?** Performs an MX RR lookup, returning the information in the** special MXRRDEF structure.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**E** NETLIB___DNS_MX_LOOKUP ctx, namdsc, mxrr, mxrrsize [,mxrrcount]4** [,iosb] [,astadr] [,astprm]**Q** ctx: NETLIB context address, longword (unsigned), read only, by referenceD** namdsc: char_string, character string, read only, by descriptorM** mxrr: MXRRDEF structure, longword (unsigned), write only, by referenceM** mxrrsize: longword_unsigned, longword (unsigned), read only, by referenceO** mxrrcount: longword_unsigned, longword (unsigned), write only, by referenceL** iosb: I/O status block, quadword (unsigned), write only, by reference>** astadr: ast_procedure, procedure mask, call, by reference?** astprm: user_arg, longword (unsigned), read only, by value**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/6unsigned int netlib___dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,K struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm) { struct CTX *ctx; struct DNSREQ *dnsreq; struct IOR *ior; unsigned short bufsize; unsigned int status; int argc;6 static unsigned int class = NETLIB_K_DNS_CLASS_IN;5 static unsigned int type = NETLIB_K_DNS_TYPE_MX;< static unsigned int queryflags = NETLIB_M_DOMAIN_SEARCH; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);/*** Check arguments*/% if (argc < 4) return SS$_INSFARG;G if (namdsc == 0 || mxrr == 0 || mxrrsize == 0) return SS$_BADPARAM;/*C** If NETLIB___DNS_INIT couldn't initialize the resolver, we don't** do DNS stuff*/: if (ctx->flags & CTX_M_NO_DNS) return SS$_UNSUPPORTED;/*)** Initialize the resolver, if necessary*/ if (ctx->dnsctx == 0) {% status = netlib___dns_init(ctx);- if (!OK(status)) return SS$_UNSUPPORTED; }/*K** Allocate a DNS request block (also gets us a generic I/O request block)*/2 GET_DNSREQ(dnsreq, ctx, (argc > 5) ? iosb : 0,+ (argc > 6) ? astadr : 0,, (argc > 7) ? astprm : 0);/*+** Fill in the request and start the query*/ ior = dnsreq->ior; ior->arg[0].address = mxrr;% ior->arg[1].longword = *mxrrsize;5 ior->arg[2].address = (argc > 4) ? mxrrcount : 0;" bufsize = sizeof(dnsreq->buf);: status = netlib_dns_query(&ctx, namdsc, &class, &type,% dnsreq->buf, &bufsize, &queryflags, &ior->iosb,& (ior->astadr == 0) ? 0 = : (void (*)()) mxlook_completion, dnsreq);( if (ior->astadr != 0) return status; if (!OK(status)) { FREE_DNSREQ(dnsreq); return status; }/*>** We get to this point if the query completed synchronously.*/% return mxlook_completion(dnsreq);} /* netlib___dns_mx_lookup */ /***++** ROUTINE: mxlook_completion**** FUNCTIONAL DESCRIPTION:**>** Completion routine for NETLIB___DNS_MXLOOKUP. Can eitherA** be called as an AST routine or in the main-line thread if the&** DNS query completed synchronously.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**"** MXLOOK_COMPLETION dnsrequest**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/?static unsigned int mxlook_completion (struct DNSREQ *dnsreq) {" struct IOR *ior = dnsreq->ior;/ struct MXRRDEF *mxrr = ior->arg[0].address;. unsigned int *count = ior->arg[2].address;$ struct dsc$descriptor dsc, dsc2;" struct NETLIB_DNS_HEADER *hdr; unsigned char *cp; char name[256];0 unsigned short retlen, remain, buflen, skip;, int i, n, ancount, qdcount, type, class;/*&** Check the completion status first.*/' if (!OK(ior->iosb.iosb_w_status)) { if (ior->iosbp != 0) {= ior->iosbp->iosb_w_status = ior->iosb.iosb_w_status;' ior->iosbp->iosb_w_count = 0;' ior->iosbp->iosb_l_unused = 0; } if (count != 0) *count = 0;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm); FREE_DNSREQ(dnsreq);$ return ior->iosb.iosb_w_status; }/*7** Status was OK, so let's parse out the reply packet.*/3 hdr = (struct NETLIB_DNS_HEADER *) dnsreq->buf;3 ancount = netlib_word_swap(hdr->dns_w_ancount);3 qdcount = netlib_word_swap(hdr->dns_w_qdcount);/*N** We treat all failures as "end of file" (no such name or domain) responses.*/; if (hdr->dns_v_reply_code != NETLIB_K_DNS_RC_SUCCESS) {/ ior->iosbp->iosb_w_status = SS$_ENDOFFILE;" ior->iosbp->iosb_w_count = 0;# ior->iosbp->iosb_l_unused = 0; if (count != 0) *count = 0;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm); FREE_DNSREQ(dnsreq); return SS$_ENDOFFILE; }/*** Skip over the question*/$ buflen = ior->iosb.iosb_w_count;$ remain = buflen - sizeof(*hdr);$ cp = dnsreq->buf + sizeof(*hdr); while (qdcount-- > 0) {. i = netlib_dns_skipname(cp, &remain) + 4; cà  NETLIB_SRC.BCKî ç [NETLIB]DNS_MXLOOK.C;8[j,p += i; remain -= i; }/*6** Now parse out the answers, looking for the MX RRs.*/( INIT_SDESC(dsc, sizeof(name), name); n = 0;E while (ancount-- > 0 && remain > 0 && n < ior->arg[1].longword) {[ if (!OK(netlib_dns_expandname(dnsreq->buf, &buflen, cp, &dsc, &retlen, &skip))) break; cp += skip; remain -= skip;4 type = netlib_word_swap(*(unsigned short *)cp); cp += 2; remain -= 2;5 class = netlib_word_swap(*(unsigned short *)cp);3 cp += 6; remain -= 6; /* skip over TTL, too */1 i = netlib_word_swap(*(unsigned short *)cp); cp += 2; remain -= 2;( if (type == NETLIB_K_DNS_TYPE_MX) {M mxrr[n].mxrr_l_preference = netlib_word_swap(*(unsigned short *)cp);C INIT_SDESC(dsc2, NETLIB_S_MXRR_NAME, mxrr[n].mxrr_t_name);T netlib_dns_expandname(dnsreq->buf, &buflen, cp + 2, &dsc2, &retlen, &skip);( mxrr[n].mxrr_l_length = retlen; n++; } cp += i; remain -= i; }/*D** Fill in the status and RR count information and either call back)** (for an AST) or return to the caller.*/ if (count != 0) *count = n; if (ior->iosbp != 0) {, ior->iosbp->iosb_w_status = SS$_NORMAL;# ior->iosbp->iosb_w_count = n;# ior->iosbp->iosb_l_unused = 0; }1 if (ior->astadr) (*ior->astadr)(ior->astprm); FREE_DNSREQ(dnsreq); return SS$_NORMAL;} /* mxlook_completion */ÿÿà  NETLIB_SRC.BCKï ç [NETLIB]DNS_QUERY.C;23Y1sð*[NETLIB]DNS_QUERY.C;23+,ï .1/€ 4Y1%&-ç 0ª123KÿPWO&56𓼌„˜7Pô©¼Œ„˜8°Ñçvš9¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**E** ABSTRACT: Formulates and sends DNS queries, preprocesses replies.**** MODULE DESCRIPTION:**6** This module is the core of NETLIB's DNS resolver.**** AUTHOR: M. MadisonG** COPYRIGHT © 1994, MADGOAT SOFTWARE. ALL RIGHTS RESERVED.**** CREATION DATE: 24-OCT-1994**** MODIFICATION HISTORY:**1** 24-OCT-1994 V1.0 Madison Initial coding.8** 17-NOV-1994 V1.1 Madison Connect to nameserver.=** 18-NOV-1994 V1.2 Madison Restructure asynch queries.**--*/#include "netlib.h"/*** Forward routines*/S unsigned int netlib_dns_query(struct CTX **xctx, struct dsc$descriptor *namdsc,6 unsigned int *class, unsigned int *type,: unsigned char *buf, unsigned short *bufsize,> unsigned int *flags, struct NETLIBIOSBDEF *iosb,. void (*astadr)(), void *astprm);8 static unsigned int do_query(struct DNSREQ *dnsreq);@ static unsigned int query_nameserver(struct DNSREQ *dnsreq);8 static void query_completion(struct DNSREQ *dnsreq);0 static void do_write(struct DNSREQ *dnsreq);/ static void do_read(struct DNSREQ *dnsreq);/*** External references*/4 unsigned int netlib___dns_init(struct CTX *ctx);3 unsigned int netlib_socket(struct CTX **, ...);K unsigned int netlib_connect(struct CTX **, void *, unsigned int *,...);K unsigned int netlib_write(struct CTX **, struct dsc$descriptor *, ...);J unsigned int netlib_read(struct CTX **, struct dsc$descriptor *, ...);- unsigned int netlib_close(struct CTX **); /***++** ROUTINE: netlib_dns_query**** FUNCTIONAL DESCRIPTION:**B** Formulates a DNS query, sends it out, and obtains a reply (if** possible).**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**?** NETLIB_DNS_QUERY ctx, namdsc, [class], type, buf, bufsize8** [,flags] [,iosb] [,astadr] [,astprm]**O** ctx: NETLIB context address, longword_unsigned, read only, by referenceD** namdsc: char_string, character string, read only, by descriptorL** class: longword_unsigned, longword (unsigned), read only, by referenceL** type: longword_unsigned, longword (unsigned), read only, by referenceG** buf: varying_arg, longword (unsigned), write only, by referenceD** bufsize: word_unsigned, word (unsigned), read only, by referenceH** flags: mask_longword, longword (unsigned), read only, by referenceK** iosb: io_status_block, quadword (unsigned), write only, by reference?** astadr: ast_procedure, procedure value, call, by reference?** astprm: user_arg, longword (unsigned), read only, by value**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/Ounsigned int netlib_dns_query(struct CTX **xctx, struct dsc$descriptor *namdsc,7 unsigned int *xclass, unsigned int *type,: unsigned char *buf, unsigned short *bufsize,? unsigned int *xflags, struct NETLIBIOSBDEF *iosb,/ void (*astadr)(), void *astprm) { struct CTX *ctx; struct DNSREQ *dnsreq; struct IOR *ior;! struct NETLIB_DNS_HEADER *hp;& unsigned int class, flags, status; unsigned short namlen; char *name; int argc;/*"** Sanity-check the argument list*/ VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 6) return SS$_INSFARG;R if (namdsc == 0 || type == 0 || buf == 0 || bufsize == 0) return SS$_BADPARAM;/*B** Make sure we're doing DNS, and initialize the resolver context ** if needed*/: if (ctx->flags & CTX_M_NO_DNS) return SS$_UNSUPPORTED; if (ctx->dnsctx == 0) {% status = netlib___dns_init(ctx);- if (!OK(status)) return SS$_UNSUPPORTED; }/*** Process the input arguments*/7 status = lib$analyze_sdesc(namdsc, &namlen, &name);# if (!OK(status)) return status;3 if (xclass == 0) class = NETLIB_K_DNS_CLASS_IN; else class = *xclass;@ if (argc < 7 || xflags == 0) flags = NETLIB_M_DOMAIN_SEARCH; else flags = *xflags;/*%** Allocate DNS & I/O request blocks*/2 GET_DNSREQ(dnsreq, ctx, (argc > 7) ? iosb : 0,+ (argc > 8) ? astadr : 0,, (argc > 9) ? astprm : 0);/*&** Initialize the domain search stuff*/M if ((flags & NETLIB_M_DOMAIN_SEARCH) && memchr(name, '.', namlen) == 0) {- dnsreq->curdom = ctx->dnsctx->domq.head; } else { dnsreq->curdom = 0; }/*B** Fill in the DNS request block and call DO_QUERY to do the work*/ dnsreq->query_name = name;# dnsreq->query_namlen = namlen; dnsreq->query_flags = flags; dnsreq->query_rbuf = buf;& dnsreq->query_rbufsize = *bufsize; dnsreq->query_class = class; dnsreq->query_type = *type; dnsreq->ctx = ctx;3 dnsreq->retries = ctx->dnsctx->retry_count; return do_query(dnsreq);} /* netlib_dns_query */ /***++** ROUTINE: do_query**** FUNCTIONAL DESCRIPTION:**K** Does the actual work of formatting a query. Calls on QUERY_NAMESERVER,** to send the query out and get the reply.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** DO_QUERY dnsrequest**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/6static unsigned int do_query (struct DNSREQ *dnsreq) {" struct IOR *ior = dnsreq->ior;" struct CTX *ctx = dnsreq->ctx;$ struct DNSCTX *dc = ctx->dnsctx;! struct NETLIB_DNS_HEADER *hp; char *anchor, *cp; unsigned char *bp; int i, j; unsigned int status;/*G** This is set up as a loop for synchronous queries. For asynchronous>** queries, we return as soon as the query has been sent out.*/ while (1) {/*** Format the query header*/3 hp = (struct NETLIB_DNS_HEADER *) dnsreq->buf;5 memset(hp, 0, sizeof(struct NETLIB_DNS_HEADER));' hp->dns_w_queryid = ++dc->queryid;. hp->dns_v_opcode = NETLIB_K_DNS_OP_STDQ;Y hp->dns_v_recursion_desired = (dnsreq->query_flags & NETLIB_M_NO_RECURSION) ? 0 : 1;- hp->dns_w_qdcount = netlib_word_swap(1);/*/** Fill in the question -- the name part first*/9 bp = dnsreq->buf + sizeof(struct NETLIB_DNS_HEADER);! anchor = dnsreq->query_name; i = dnsreq->query_namlen; while (i > 0) {% cp = memchr(anchor, '.', i); if (cp == 0) { *bp++ = i;) memcpy(bp, anchor, i); bp += i; break; } else { j = cp - anchor; *bp++ = j; memcpy(bp, anchor, j); bp += j; i -= j + 1; } anchor = cp + 1; }/*9** And the search domain, if we're doing search domains.*/ if (dnsreq->curdom == 0) {J dnsreq->curdom = (dnsreq-à NETLIB_SRC.BCKï ç [NETLIB]DNS_QUERY.C;23Y1«™>query_flags & NETLIB_M_DOMAIN_SEARCH) ?? dc->domq.head : (struct DOMAIN *) &dc->domq; } else {' anchor = dnsreq->curdom->name;$ i = dnsreq->curdom->length;( if (i >= 1 && *anchor == '.') { anchor++; i--; } while (i > 0) {& cp = memchr(anchor, '.', i); if (cp == 0) { *bp++ = i;- memcpy(bp, anchor, i); bp += i; break; } else { j = cp - anchor; *bp++ = j;$ memcpy(bp, anchor, j); bp += j; i -= j + 1; } anchor = cp + 1; }0 dnsreq->curdom = dnsreq->curdom->flink; }/*1** Terminate the name, insert the type and class*/ *bp++ = '\0';L *(unsigned short *) bp = netlib_word_swap(dnsreq->query_type); bp += 2;M *(unsigned short *) bp = netlib_word_swap(dnsreq->query_class); bp += 2;' dnsreq->buflen = bp - dnsreq->buf;/*$** Start with the first name server*/" dnsreq->curns = dc->nsq.head;/*(** If ASTADR is 0, this is synchronous.*/ if (ior->astadr == 0) {/*G** Loop through all the nameservers until we get a successful response'** back, or we run out of nameservers.*/B while (dnsreq->curns != (struct NAMESERVER *) &dc->nsq) {, status = query_nameserver(dnsreq); if (OK(status)) break;/ dnsreq->curns = dnsreq->curns->flink; }/*D** Check status and verify the reply code from the server. If it'sG** not a successful reply, move on to the next search domain; if we'veF** run through all the search domains, return the ENDOFFILE error (no** such host or domain).*/ if (!OK(status)) {# status = SS$_UNREACHABLE;J } else if (dnsreq->replylen > sizeof(struct NETLIB_DNS_HEADER)) {? hp = (struct NETLIB_DNS_HEADER *) dnsreq->query_rbuf;@ if (hp->dns_v_reply_code == NETLIB_K_DNS_RC_SUCCESS) {" status = SS$_NORMAL; } else {B if (dnsreq->curdom != (struct DOMAIN *) &dc->domq) {< continue; /* back to top of while(1) loop */ }% status = SS$_ENDOFFILE; }& } else status = SS$_PROTOCOL;/*D** Return the results to the caller (still in synch I/O processing)*/ if (ior->iosbp != 0) {- ior->iosbp->iosb_w_status = status;6 ior->iosbp->iosb_w_count = dnsreq->replylen;( ior->iosbp->iosb_l_unused = 0; } FREE_DNSREQ(dnsreq); return status;/*D** For asynchronous calls, just fire off a query and do the rest of1** the processing in the AST completion routine.*/ } else {) return query_nameserver(dnsreq); } } /* while (1) */7 return SS$_DATACHECK; /* should never reach here */} /* do_query */ /***++** ROUTINE: query_nameserver**** FUNCTIONAL DESCRIPTION:**$** Sends a query to a name server.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**!** QUERY_NAMESERVER dnsrequest**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/>static unsigned int query_nameserver (struct DNSREQ *dnsreq) {" struct IOR *ior = dnsreq->ior;" struct CTX *ctx = dnsreq->ctx;, struct DNSCTX *dc = dnsreq->ctx->dnsctx;( struct NETLIB_DNS_HEADER *hp1, *hp2; struct dsc$descriptor dsc;! unsigned int status, sinsize;4 static unsigned int dgram = NETLIB_K_TYPE_DGRAM;/*** Set up the socket address*/1 memset(&dnsreq->sin, 0, sizeof(dnsreq->sin));0 dnsreq->sin.sin_w_family = NETLIB_K_AF_INET;2 dnsreq->sin.sin_w_port = netlib_word_swap(53);1 dnsreq->sin.sin_x_addr = dnsreq->curns->addr;/*A** Create the socket and "connect" it to the server. We do thisH** so we can find out right away whether or not the server is listeningE** on that UDP port, rather than waiting for the reply timeout if weJ** were to use sendto/recvfrom. It's also more efficient to do a connect(** in BSD-based TCP/IP implementations.*/H status = ior->iosb.iosb_w_status = netlib_socket(&ior->ctx, &dgram); if (OK(status)) {# sinsize = sizeof(dnsreq->sin); if (ior->astadr != 0) {C status = netlib_connect(&ior->ctx, &dnsreq->sin, &sinsize,6 &ior->iosb, do_write, dnsreq);' if (OK(status)) return status;* ior->iosb.iosb_w_status = status; } else {D status = netlib_connect(&ior->ctx, &dnsreq->sin, &sinsize); if (OK(status)) {7 INIT_SDESC(dsc, dnsreq->buflen, dnsreq->buf);C status = netlib_write(&ior->ctx, &dsc, 0, 0, &ior->iosb);; if (OK(status)) status = ior->iosb.iosb_w_status;0 else ior->iosb.iosb_w_status = status; } }. if (!OK(status)) netlib_close(&ior->ctx); } if (!OK(status)) { ior->ctx = 0;) if (ior->astadr == 0) return status; query_completion(dnsreq); return SS$_NORMAL; }/*G** OK, we've got ourselves connected and sent off the query. Now readL** the reply. This loop handles synchronous reads; asynch reply processing#** is handled in QUERY_COMPLETION.*/ while (1) {A INIT_SDESC(dsc, dnsreq->query_rbufsize, dnsreq->query_rbuf);N status = netlib_read(&ior->ctx, &dsc, 0, 0, 0, &dc->timeout, &ior->iosb);/*8** Make sure that the reply is to the query we sent out*/ if (OK(status)) {G if (ior->iosb.iosb_w_count < sizeof(struct NETLIB_DNS_HEADER)) continue;8 hp1 = (struct NETLIB_DNS_HEADER *) dnsreq->buf;? hp2 = (struct NETLIB_DNS_HEADER *) dnsreq->query_rbuf;8 if (hp1->dns_w_queryid == hp2->dns_w_queryid) {4 dnsreq->replylen = ior->iosb.iosb_w_count;" netlib_close(&ior->ctx); ior->ctx = 0; return SS$_NORMAL; }/*?** If the reply timed out, try again. This is UDP, after all.*/ } else {B if ((status == SS$_TIMEOUT) && (--dnsreq->retries > 0)) {7 INIT_SDESC(dsc, dnsreq->buflen, dnsreq->buf);C status = netlib_write(&ior->ctx, &dsc, 0, 0, &ior->iosb);# if (OK(status)) continue; }! netlib_close(&ior->ctx); ior->ctx = 0; return status; } }7 return SS$_DATACHECK; /* should never reach here */} /* query_nameserver */ /***++** ROUTINE: query_completion**** FUNCTIONAL DESCRIPTION:**2** Completion processing for a reply to a query.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**!** QUERY_COMPLETION dnsrequest**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/6static void query_completion (struct DNSREQ *dnsreq) {" struct IOR *ior = dnsreq->ior;" struct CTX *ctx = dnsreq->ctx;$ struct DNSCTX *dc = ctx->dnsctx;( struct NETLIB_DNS_HEADER *hp1, *hp2; struct dsc$descriptor dsc; unsigned int status;/*I** If completion status was OK, verify that the response is to the query5** we sent out. If it wasn't queue up another read.*/% status = ior->iosb.iosb_w_status;S if (OK(status) && ior->iosb.iosb_w_count >= sizeof(struct NETLIB_DNS_Hà NETLIB_SRC.BCKï ç [NETLIB]DNS_QUERY.C;23Y16EADER)) {4 hp1 = (struct NETLIB_DNS_HEADER *) dnsreq->buf;; hp2 = (struct NETLIB_DNS_HEADER *) dnsreq->query_rbuf;4 if (hp1->dns_w_queryid == hp2->dns_w_queryid) {4 if (ior->ctx != 0) netlib_close(&ior->ctx); ior->ctx = 0; if (ior->iosbp != 0)< memcpy(ior->iosbp, &ior->iosb, sizeof(ior->iosb));% (*ior->astadr)(ior->astprm); FREE_DNSREQ(dnsreq); return; } else {E INIT_SDESC(dsc, dnsreq->query_rbufsize, dnsreq->query_rbuf);E status = netlib_read(&ior->ctx, &dsc, 0, 0, 0, &dc->timeout,9 &ior->iosb, query_completion, dnsreq); if (OK(status)) return; } }/*'** If we timed out, re-send the query.*/= if ((status == SS$_TIMEOUT) && (--dnsreq->retries > 0)) {2 INIT_SDESC(dsc, dnsreq->buflen, dnsreq->buf);1 status = netlib_write(&ior->ctx, &dsc, 0, 0,1 &ior->iosb, do_read, dnsreq); if (OK(status)) return; }/*?** Done with this connection. Don't need the socket any more.*/ if (ior->ctx != 0) { netlib_close(&ior->ctx); ior->ctx = 0; }/*@** Set things up for moving on to next server; if we've run outC** of servers, move on to next search domain. If we've run out of9** those, we report the last error we got to the caller.*/) dnsreq->curns = dnsreq->curns->flink;: if (dnsreq->curns == (struct NAMESERVER *) &dc->nsq) {9 if (dnsreq->curdom == (struct DOMAIN *) &dc->domq) {I if (ior->iosbp != 0) < memcpy(ior->iosbp, &ior->iosb, sizeof(ior->iosb));% (*ior->astadr)(ior->astprm);  FREE_DNSREQ(dnsreq);D return; }/*** Next query*/ do_query(dnsreq); return; }E/*** Next nameserver**/ query_nameserver(dnsreq);} /* query_completion */ /***++** ROUTINE: do_writes**** FUNCTIONAL DESCRIPTION:-**B** Queue a write to the nameserver (for asynch queries). Called%** as completion AST on the connect.***B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** DO_WRITE dnsreqc**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.s**** COMPLETION CODES: See code.n**** SIDE EFFECTS: None.****--*/.static void do_write (struct DNSREQ *dnsreq) {" struct IOR *ior = dnsreq->ior; struct dsc$descriptor dsc; unsigned int status;% status = ior->iosb.iosb_w_status;n if (OK(status)) {c2 INIT_SDESC(dsc, dnsreq->buflen, dnsreq->buf);O status = netlib_write(&ior->ctx, &dsc, 0, 0, &ior->iosb, do_read, dnsreq);t }i if (OK(status)) return;)% ior->iosb.iosb_w_status = status;  query_completion(dnsreq);s} /* do_write */ n/***++** ROUTINE: do_read**** FUNCTIONAL DESCRIPTION:n**B** Queues a read to the nameserver (for asynch queries). Called"** as completion AST to DO_WRITE.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** DO_READ dnsrequest**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None._**** COMPLETION CODES: See code.P**** SIDE EFFECTS: None.****--*/-static void do_read (struct DNSREQ *dnsreq) {." struct IOR *ior = dnsreq->ior;, struct DNSCTX *dc = dnsreq->ctx->dnsctx; struct dsc$descriptor dsc; unsigned int status;% status = ior->iosb.iosb_w_status;  if (OK(status)) {dA INIT_SDESC(dsc, dnsreq->query_rbufsize, dnsreq->query_rbuf);iA status = netlib_read(&ior->ctx, &dsc, 0, 0, 0, &dc->timeout, : &ior->iosb, query_completion, dnsreq); }o if (OK(status)) return;y% ior->iosb.iosb_w_status = status;d query_completion(dnsreq);y} /* do_read */ ÿÿf: varying_arg, longword (unsigned), write only, by referenceD** bufsize: word_unsigned, word (unsigned), read only, by referenceH** flags: mask_longword, longword (unsigned), read only, by referenceK** à NETLIB_SRC.BCK$ç [NETLIB]LINEMODE.C;20S#–Öð*[NETLIB]LINEMODE.C;20+,$.#/€ 4S# Š-ç 0ª123KÿPWO!56,„]óú›7núš]óú›89G€HˆªJÿ/***++** FACILITY: NETLIB**1** ABSTRACT: Line-mode send and receive routines**** MODULE DESCRIPTION:**<** This module contains routines for sending and receivingD** "lines" of ASCII data, with CR/LF terminators at the end of eachC** line. It is layered on top of the raw NETLIB_READ/NETLIB_WRITEC** routines, and contains no code dependent on a particular TCP/IPC** implementation. They do assume, however, that the TCP protocol#** is being used, rather than UDP.****** AUTHOR: M. Madison<** COPYRIGHT © 1994, 1997, 1998 MADGOAT SOFTWARE."** ALL RIGHTS RESERVED.**** CREATION DATE: 22-OCT-1994**** MODIFICATION HISTORY:**1** 22-OCT-1994 V1.0 Madison Initial coding.9** 09-JAN-1995 V1.0-1 Madison Read data in 1K chunks.D** 11-JAN-1995 V1.0-2 Madison Fix timeout reference in readline.M** 13-JAN-1995 V1.0-3 Madison Fix split CR/LF handling in parse_out_line.4** 25-JAN-1995 V1.0-4 Madison Fix for CR w/o LF.H** 31-AUG-1995 V1.0-5 Madison Change writeline to write entire line,<** including terminator, in one write.:** Works around cc:Mail gateway bug.N** 19-JAN-1997 V1.0-6 Madison Async read should return NETLIB_READ status.R** 01-JUN-1997 V1.0-7 Madison Catch NETLIB_READ status in readline_continue().O** 27-NOV-1997 V1.1 Madison Add NETLIB_M_FLUSH flag to netlib_readline().1** 14-DEC-1997 V1.1-1 Madison Fix flush code.K** 02-JAN-1998 V1.1-2 Madison Make relaxed line mode even more relaxed.**--*/#include "netlib.h"/*** Forward declarations*/O unsigned int netlib_readline(struct CTX **xctx, struct dsc$descriptor *dsc,@ unsigned short *retlen, unsigned int *flagp,> TIME *timeout, struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm);3 static void readline_continue(struct IOR *ior);J static int parse_out_line(struct CTX *ctx, struct dsc$descriptor *dsc,, unsigned short *retlen);P unsigned int netlib_writeline(struct CTX **xctx, struct dsc$descriptor *dsc,1 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm);2 static void writeline_finish(struct IOR *ior);/*** OWN storage*/% static $DESCRIPTOR(crlf, "\r\n");/*** External references*/= unsigned int netlib_read(struct CTX **xctx, void *, ...);> unsigned int netlib_write(struct CTX **xctx, void *, ...); /***++** ROUTINE: netlib_readline**** FUNCTIONAL DESCRIPTION:**A** Reads in a line. The terminating CR/LF pair is not includedC** in the data returned to the caller. The caller may specify theE** NETLIB_M_ALLOW_LF flag to permit interoperation with senders thatB** may erroneously terminate lines with just linefeeds instead of** CR/LF pairs.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**C** NETLIB_READLINE ctx, dsc [,retlen] [,flag] [,timeout] [,iosb])** [,astadr] [,astprm]**M** ctx: NETLIB session context, longword (unsigned), modify, by referenceD** dsc: char_string, character string, write only, by descriptorD** retlen: word_unsigned, word (unsigned), write only, by referenceG** flag: mask_longword, longword (unsigned), read only, by referenceC** timeout: delta_time, quadword (signed), read only, by reference?** iosb: IO_status_block, quadword, write only, by referenceD** astadr: ast_procedure, procedure entry mask, CALL , by reference>** astprm: user_arg, longword (unsigned), read only, by value**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/Lunsigned int netlib_readline (struct CTX **xctx, struct dsc$descriptor *dsc,@ unsigned short *retlen, unsigned int *flagp,> TIME *timeout, struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm) { struct CTX *ctx; struct NETLIBIOSBDEF myiosb; struct dsc$descriptor sdsc; unsigned int status; unsigned short len; int argc; VERIFY_CTX(xctx, ctx) SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;D if (argc < 4 || flagp == 0) ctx->line_flags = NETLIB_M_ALLOW_LF;" else ctx->line_flags = *flagp; if (ctx->linebuf == 0) {. static unsigned int size = CTX_S_LINEBUF;/ status = lib$get_vm(&size, &ctx->linebuf);$ if (!OK(status)) return status; ctx->line_remain = 0;4 ctx->linebufp = ctx->lineanchor = ctx->linebuf; } len = 0; while (1) {* if (parse_out_line(ctx, dsc, &len)) { status = SS$_NORMAL; break; }A INIT_SDESC(sdsc, CTX_S_LINEBUF-(ctx->linebufp-ctx->linebuf)," ctx->linebufp);< if (sdsc.dsc$w_length > 1024) sdsc.dsc$w_length = 1024;# if (argc > 6 && astadr != 0) { struct IOR *ior;B GET_IOR(ior, ctx, iosb, astadr, (argc > 7) ? astprm : 0);# ctx->line_retlen = retlen; ctx->line_dsc = dsc;$ ctx->line_tmo = timeout;F return netlib_read(xctx, &sdsc, 0, 0, 0, timeout, &ior->iosb,, readline_continue, ior); }S status = netlib_read(xctx, &sdsc, 0, 0, 0, (argc > 4) ? timeout : 0, &myiosb); if (!OK(status)) break;, ctx->line_remain = myiosb.iosb_w_count; } /* while *// if (argc > 2 && retlen != 0) *retlen = len; if (argc > 5 && iosb != 0) {" iosb->iosb_w_status = status; iosb->iosb_w_count = len; }" if (argc > 6 && astadr != 0) {4 sys$dclast(astadr, (argc > 7) ? astprm : 0, 0); return SS$_NORMAL; } return status;} /* netlib_readline */ /***++** ROUTINE: readline_continue**** FUNCTIONAL DESCRIPTION:**D** Internal routine for coninuation of a line-mode read operation.N** Continues reading data until the line termination sequence is encountered.J** Completes the operation by returning the line (without terminators) to** the caller.**** RETURNS: void**** PROTOTYPE:**** READLINE_CONTINUE ior**L** ior: struct IOR, internal I/O request structure, modify, by reference**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/1static void readline_continue (struct IOR *ior) { struct CTX *ctx = ior->ctx; struct dsc$descriptor sdsc; unsigned int status; unsigned short len;' if (!OK(ior->iosb.iosb_w_status)) { if (ior->iosbp != 0) {$ ior->iosbp->iosb_w_status =" ior->iosb.iosb_w_status;& ior->iosbp->iosb_w_count = 0; }8 if (ctx->line_retlen != 0) *(ctx->line_retlen) = 0;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm); FREE_IOR(ior); return; }. ctx->line_remain = ior->ioà NETLIB_SRC.BCK$ç [NETLIB]LINEMODE.C;20S# Osb.iosb_w_count;3 if (parse_out_line(ctx, ctx->line_dsc, &len)) { if (ior->iosbp != 0) {0 ior->iosbp->iosb_w_status = SS$_NORMAL;( ior->iosbp->iosb_w_count = len; }: if (ctx->line_retlen != 0) *(ctx->line_retlen) = len;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm); FREE_IOR(ior); return; } P INIT_SDESC(sdsc, CTX_S_LINEBUF-(ctx->linebufp-ctx->linebuf), ctx->linebufp);; if (sdsc.dsc$w_length > 1024) sdsc.dsc$w_length = 1024;I status = netlib_read(&ctx, &sdsc, 0, 0, 0, ctx->line_tmo, &ior->iosb,, readline_continue, ior); if (!OK(status)) {= if (ior->iosbp != 0) ior->iosbp->iosb_w_status = status;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm); FREE_IOR(ior); } return;} /* readline_continue */ /***++** ROUTINE: parse_out_line**** FUNCTIONAL DESCRIPTION:**@** Utility routine for parsing a line out of a buffer of data.**** RETURNS: int (boolean)**** PROTOTYPE:**%** PARSE_OUT_LINE ctx, dsc, retlen**F** ctx: struct CTX, NETLIB context structure, modify, by referenceD** dsc: char_string, character string, write only, by descriptorD** retlen: word_unsigned, word (unsigned), write only, by reference**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:+** 1: line termination sequence found+** 0: termination sequence not found**** SIDE EFFECTS: None.****--*/Gstatic int parse_out_line (struct CTX *ctx, struct dsc$descriptor *dsc,- unsigned short *retlen) { unsigned short len; unsigned char *cp;+ if (ctx->line_flags & NETLIB_M_FLUSH) { len = ctx->line_remain; if (len != 0)0 str$copy_r(dsc, &len, ctx->lineanchor); *retlen = len; ctx->line_remain = 0;4 ctx->linebufp = ctx->lineanchor = ctx->linebuf; return 1; }" while (ctx->line_remain > 0) {, if (ctx->flags & CTX_M_LINE_FOUND_CR) {, ctx->flags &= ~CTX_M_LINE_FOUND_CR;& if (*ctx->linebufp == '\n') {6 len = (ctx->linebufp - ctx->lineanchor) - 1;1 str$copy_r(dsc, &len, ctx->lineanchor); *retlen = len; ctx->line_remain -= 1; ctx->linebufp += 1;* ctx->lineanchor = ctx->linebufp; return 1; } }8 cp = memchr(ctx->linebufp, '\r', ctx->line_remain); /*7 ** If we're in relaxed line mode, check to see if8 ** a linefeed precedes the carriage return we just8 ** found. If so, treat it as though we didn't get ** the carriage return. */< if (cp != 0 && (ctx->line_flags & NETLIB_M_ALLOW_LF) &&E memchr(ctx->linebufp, '\n', cp-ctx->linebufp) != 0) cp = 0; if (cp == 0) {3 if (ctx->line_flags & NETLIB_M_ALLOW_LF) {= cp = memchr(ctx->linebufp, '\n', ctx->line_remain); if (cp != 0) {) len = cp - ctx->lineanchor;5 str$copy_r(dsc, &len, ctx->lineanchor); *retlen = len;5 len -= (ctx->linebufp-ctx->lineanchor);* ctx->line_remain -= len + 1;' ctx->linebufp += len + 1;. ctx->lineanchor = ctx->linebufp; return 1; } }+ ctx->linebufp += ctx->line_remain; ctx->line_remain = 0; } else {< if ((cp - ctx->linebufp) == (ctx->line_remain-1)) {, ctx->flags |= CTX_M_LINE_FOUND_CR;, ctx->linebufp += ctx->line_remain; ctx->line_remain = 0; } else {" if (*(cp + 1) == '\n') {) len = cp - ctx->lineanchor;5 str$copy_r(dsc, &len, ctx->lineanchor); *retlen = len;5 len -= (ctx->linebufp-ctx->lineanchor);* ctx->line_remain -= len + 2;' ctx->linebufp += len + 2;. ctx->lineanchor = ctx->linebufp; return 1; } else {; ctx->line_remain -= (cp - ctx->linebufp) + 1;% ctx->linebufp = cp + 1; } } } }= if (ctx->linebufp - ctx->lineanchor >= CTX_S_LINEBUF-2) {+ len = ctx->linebufp - ctx->lineanchor;, str$copy_r(dsc, &len, ctx->lineanchor); ctx->line_remain = 0;4 ctx->lineanchor = ctx->linebufp = ctx->linebuf; *retlen = len; return 1; } if (ctx->line_remain > 0 ||L (ctx->linebufp - ctx->linebuf == CTX_S_LINEBUF-ctx->line_remain)) {< len = ctx->line_remain + ctx->linebufp-ctx->lineanchor;1 memmove(ctx->linebuf, ctx->lineanchor, len);( ctx->linebufp = ctx->linebuf + len;$ ctx->lineanchor = ctx->linebuf; ctx->line_remain = 0; } return 0;} /* parse_out_line */ /***++** ROUTINE: netlib_writeline**** FUNCTIONAL DESCRIPTION:**>** Writes a line of data to the network, adding a CR/LF pair** as a line terminator.**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**;** NETLIB_WRITELINE ctx, dsc [,iosb] [,astadr] [,astprm]**M** ctx: NETLIB session context, longword (unsigned), modify, by referenceC** dsc: char_string, character string, read only, by descriptor?** iosb: IO_status_block, quadword, write only, by referenceD** astadr: ast_procedure, procedure entry mask, CALL , by reference>** astprm: user_arg, longword (unsigned), read only, by value**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: See code.**** SIDE EFFECTS: None.****--*/Munsigned int netlib_writeline (struct CTX **xctx, struct dsc$descriptor *dsc,1 struct NETLIBIOSBDEF *iosb,7 void (*astadr)(), void *astprm) { struct CTX *ctx; struct IOR *ior; struct NETLIBIOSBDEF myiosb; struct dsc$descriptor sdsc; char *line, *bufptr; unsigned short len, buflen; unsigned int status, count; int argc; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;& if (dsc == 0) return SS$_BADPARAM;6 status = lib$analyze_sdesc(dsc, &buflen, &bufptr);# if (!OK(status)) return status;/*8** Make sure our write buffer is large enough to handle0** the entire string plus the terminating CRLF.*/$ if (buflen+2 > ctx->wlinesize) { if (ctx->wlinebuf != 0) {6 lib$free_vm(&ctx->wlinesize, &ctx->wlinebuf); ctx->wlinebuf = 0; ctx->wlinesize = 0; }< ctx->wlinesize = ((buflen < 2046) ? 2046 : buflen) + 2;: status = lib$get_vm(&ctx->wlinesize, &ctx->wlinebuf); if (!OK(status)) { ctx->wlinesize = 0; ctx->wlinebuf = 0; return status; } }/*<** Now copy the user's data into our buffer and tack on the** terminating CRLF.**>** We do this because some applications are broken and assume@** that one entire line can be read in in a single read, rather>** than actually parsing the stream of data coming in for the%** line termination sequence. Sigh.*/* memcpy(ctx->wlinebuf, bufptr, buflen);# ctx->wlinebuf[buflen++] = '\r';# ctx->wlinebuf[buflen++] = '\n';, INIT_SDESC(sdsc, buflen, ctx->wlinebuf);" if (argc > 3 && astadr != 0) {> GET_IOR(ior, ctx, iosb, astadr, (argc > 4) ? astprm : 0);7 return netlib_write(xctx, &sdsc, 0, 0, &ior->iosb,% writeline_finish, ior)à NETLIB_SRC.BCK$ç [NETLIB]LINEMODE.C;20S#¯¥; }6 status = netlib_write(xctx, &sdsc, 0, 0, &myiosb); if (argc > 2 && iosb != 0) {0 iosb->iosb_w_status = myiosb.iosb_w_status;. iosb->iosb_w_count = myiosb.iosb_w_count; iosb->iosb_l_unused = 0; } return status;} /* netlib_writeline */ /***++** ROUTINE: writeline_finish**** FUNCTIONAL DESCRIPTION:**D** Completes an asynchronous NETLIB_WRITELINE operation by fillingE** in the user's IOSB and calling the user's AST completion routine.**** RETURNS: void**** PROTOTYPE:**5** WRITELINE_FINISH ior ! called at AST level**L** ior: struct IOR, internal I/O request structure, modify, by reference**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/0static void writeline_finish (struct IOR *ior) { if (ior->iosbp != 0) {9 ior->iosbp->iosb_w_status = ior->iosb.iosb_w_status;8 ior->iosbp->iosb_w_count = ior->iosb.iosb_w_count; }6 if (ior->astadr != 0) (*ior->astadr)(ior->astprm); FREE_IOR(ior);} /* writeline_finish */ÿÿà NETLIB_SRC.BCKú ç [NETLIB]MEM.C;7WÈÙà*[NETLIB]MEM.C;7+,ú ./€ 4Wp-ç 0ª123KÿPWO56ë:¤7[™7US¤7[™8ãEèvš9¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**(** ABSTRACT: Memory management routines**** MODULE DESCRIPTION:**** tbs**** AUTHOR: M. Madison1** COPYRIGHT © 1994, MADGOAT SOFTWARE."** ALL RIGHTS RESERVED.**** CREATION DATE: 02-APR-1994**** MODIFICATION HISTORY:**1** 02-APR-1994 V1.0 Madison Initial coding.2** 09-NOV-1994 V1.1 Madison Add IOR, DNSREQ.E** 31-AUG-1995 V1.1-1 Madison Update free_ctx() to free wlinebuf.**--*/#define __NETLIB_MODULE_MEM__#include "netlib.h"#include /*** Forward declarations*/A unsigned int netlib___alloc_ctx(struct CTX **, unsigned int);1 unsigned int netlib___free_ctx(struct CTX *);3 unsigned int netlib___alloc_ior(struct IOR **);1 unsigned int netlib___free_ior(struct IOR *);9 unsigned int netlib___alloc_dnsreq(struct DNSREQ **);7 unsigned int netlib___free_dnsreq(struct DNSREQ *);/*** OWN and GLOBAL storage*/$ static unsigned int ctxzone = 0;: static unsigned int CTX_S_CTXDEF = sizeof(struct CTX);$ static unsigned int iorzone = 0;: static unsigned int IOR_S_IORDEF = sizeof(struct IOR);' static unsigned int dnsreqzone = 0;C static unsigned int DNSREQ_S_DNSREQDEF = sizeof(struct DNSREQ);#pragma nostandard9 globaldef unsigned int netlib_synch_efn = 0xffffffff;: globaldef unsigned int netlib_asynch_efn = 0xffffffff;#pragma standard- static QUEUE iorque = {&iorque, &iorque};6 static QUEUE dnsreqque = {&dnsreqque, &dnsreqque};/*** External references*/1 void netlib___free_dns_context(struct CTX *); /***++** ROUTINE: netlib___alloc_ctx**** FUNCTIONAL DESCRIPTION:**** Allocates some memory.**** RETURNS: cond_value**** PROTOTYPE:**5** netlib___alloc_ctx(unsigned int size, void *ptr)**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/Lunsigned int netlib___alloc_ctx (struct CTX **ctxp, unsigned int specsize) { struct CTX *ctx;+ unsigned int status, fullsize, aststat; aststat = sys$setast(0);) if (netlib_synch_efn == 0xffffffff) {, status = lib$get_ef(&netlib_synch_efn); if (!OK(status)) {2 if (aststat == SS$_WASSET) sys$setast(1); return status; } }* if (netlib_asynch_efn == 0xffffffff) {- status = lib$get_ef(&netlib_asynch_efn); if (!OK(status)) {2 if (aststat == SS$_WASSET) sys$setast(1); return status; } }' fullsize = specsize + CTX_S_CTXDEF; if (ctxzone == 0) {+ unsigned int algorithm=LIB$K_VM_FIXED;@ unsigned int flags=LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA;J status = lib$create_vm_zone(&ctxzone, &algorithm, &fullsize, &flags); if (!OK(status)) {2 if (aststat == SS$_WASSET) sys$setast(1); return status; } }- if (aststat == SS$_WASSET) sys$setast(1);3 status = lib$get_vm(&fullsize, &ctx, &ctxzone); if (OK(status)) { ctx->specctx = ctx + 1;" ctx->specctx_size = specsize;= if (!OK(status)) lib$free_vm(&fullsize, &ctx, &ctxzone); *ctxp = ctx; return SS$_NORMAL; } return status;} /* netlib___alloc_ctx */ /***++** ROUTINE: netlib___free_ctx**** FUNCTIONAL DESCRIPTION:**** Frees a block of memory.**** RETURNS: void**** PROTOTYPE:**%** netlib___free_ctx(struct CMD *c)**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/2unsigned int netlib___free_ctx (struct CTX *ctx) { unsigned int fullsize; if (ctx->linebuf != 0) { fullsize = CTX_S_LINEBUF;+ lib$free_vm(&fullsize, &ctx->linebuf); }4 if (ctx->wlinebuf != 0 && ctx->wlinesize != 0) {2 lib$free_vm(&ctx->wlinesize, &ctx->wlinebuf); }# netlib___free_dns_context(ctx);0 fullsize = ctx->specctx_size + CTX_S_CTXDEF;2 return lib$free_vm(&fullsize, &ctx, &ctxzone);} /* netlib___free_ctx */ /***++** ROUTINE: netlib___alloc_ior**** FUNCTIONAL DESCRIPTION:**** Allocates some memory.**** RETURNS: cond_value**** PROTOTYPE:**5** netlib___alloc_ior(unsigned int size, void *ptr)**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/5unsigned int netlib___alloc_ior (struct IOR **iorp) { struct IOR *ior;" unsigned int status, fullsize; if (iorzone == 0) {+ unsigned int algorithm=LIB$K_VM_FIXED;@ unsigned int flags=LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA; int i;N status = lib$create_vm_zone(&iorzone, &algorithm, &IOR_S_IORDEF, &flags);$ if (!OK(status)) return status; for (i = 0; i < 8; i++) {9 if (!OK(lib$get_vm(&IOR_S_IORDEF, &ior))) break;( queue_insert(ior, iorque.tail); } }* if (queue_remove(iorque.head, &ior)) {" memset(ior, 0, IOR_S_IORDEF); *iorp = ior; return SS$_NORMAL; }7 status = lib$get_vm(&IOR_S_IORDEF, &ior, &iorzone); if (OK(status)) *iorp = ior; return status;} /* netlib___alloc_ior */ /***++** ROUTINE: netlib___free_ior**** FUNCTIONAL DESCRIPTION:**** Frees a block of memory.**** RETURNS: void**** PROTOTYPE:**%** netlib___free_ior(struct CMD *c)**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/2unsigned int netlib___free_ior (struct IOR *ior) {# queue_insert(ior, iorque.tail); return SS$_NORMAL;} /* netlib___free_ior */ /***++"** ROUTINE: netlib___alloc_dnsreq**** FUNCTIONAL DESCRIPTION:**** Allocates some memory.**** RETURNS: cond_value**** PROTOTYPE:**8** netlib___alloc_dnsreq(unsigned int size, void *ptr)**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/>unsigned int netlib___alloc_dnsreq (struct DNSREQ **dnsreqp) { struct DNSREQ *dnsreq;" unsigned int status, fullsize; if (dnsreqzone == 0) {+ unsigned int algorithm=LIB$K_VM_FIXED;@ unsigned int flags=LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA;W status = lib$create_vm_zone(&dnsreqzone, &algorithm, &DNSREQ_S_DNSREQDEF, &flags);$ if (!OK(status)) return status; }0 if (queue_remove(dnsreqque.head, &dnsreq)) {+ memset(dnsreq, 0, DNSREQ_S_DNSREQDEF); *dnsreqp = dnsreq; return SS$_NORMAL; }C status = lib$get_vm(&DNSREQ_S_DNSREQDEF, &dnsreq, &dnsreqzone);& if (OK(status)) *dnsreqp = dnsreq; return status;} /* netlib___alloc_dnsreq */ /***++!** ROUTINE: netlib___free_dnsreq**** FUNCTIONAL DESCRIPTION:**** Frees a block of memory.**** RETURNS: void**** PROTOTYPE:**(** netlib___free_dnsreq(struct CMD *c)**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/;unsigned int netlib___free_dnsreq (struct DNSREQ *dnsreq) {) queue_insert(dnsreq, dnsreqque.tail); return SS$_NORMAL;} /* netlib___free_dnsreq */ÿÿ NETLIB_SRC.BCKû ç [NETLIB]MISC.C;6[ýMà*[NETLIB]MISC.C;6+,û ./€ 4[L-ç 0ª123KÿPWO56\!ªÒÞ›7 0 && i < 4; i++) { val = 0;$ while (*cp != '.' && len > 0) {. if (!isdigit(*cp)) return SS$_IVADDR;& val = val * 10 + (*cp - '0'); cp++; len--; } parts[i] = val; cp++; len--; } switch (i) { case 0: return SS$_IVADDR; case 1: val = parts[0]; break;< case 2: val = (parts[0] << 24) | (parts[1] & 0xffffff); break;A case 3: val = (parts[0] << 24) | ((parts[1] & 0xff) << 16) |' (parts[2] & 0xffff); break;A case 4: val = (parts[0] << 24) | ((parts[1] & 0xff) << 16) |= ((parts[2] & 0xff) << 8) | (parts[3] & 0xff); break; }- a->inaddr_l_addr = netlib_long_swap(val); return SS$_NORMAL;} /* netlib_strtoaddr */ /***++** ROUTINE: netlib_addrtostr**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/6unsigned int netlib_addrtostr (struct INADDRDEF *addr,F struct dsc$descriptor *dsc, unsigned short *len) { int argc;2 static $DESCRIPTOR(faodsc, "!UB.!UB.!UB.!UB"); SETARGCOUNT(argc);: return lib$sys_fao(&faodsc, (argc > 2) ? len : 0, dsc,1 (addr->inaddr_l_addr) & 0xff,1 (addr->inaddr_l_addr >> 8) & 0xff,1 (addr->inaddr_l_addr >> 16) & 0xff,2 (addr->inaddr_l_addr >> 24) & 0xff);} /* netlib_addrtostr */ /***++!** ROUTINE: netlib___find_symbol**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Nunsigned int netlib___find_symbol (char *imgnam, char *symnam, void *symptr) {) struct dsc$descriptor imgdsc, symdsc;" lib$establish(lib$sig_to_ret);/ INIT_SDESC(imgdsc, strlen(imgnam), imgnam);/ INIT_SDESC(symdsc, strlen(symnam), symnam);7 return find_image_symbol(&imgdsc, &symdsc, symptr);} /* netlib___find_symbol */ /***++** ROUTINE: find_image_symbol**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Estatic unsigned int find_image_symbol (struct dsc$descriptor *imgdsc,= struct dsc$descriptor *symdsc, void *symptr) {9 return lib$find_image_symbol(imgdsc, symdsc, symptr);} /* find_image_symbol */ /***++** ROUTINE: netlib_hton_long**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/5unsigned int netlib_hton_long (unsigned int *value) {$ return netlib_long_swap(*value);} /* netlib_hton_long */ /***++** ROUTINE: netlib_ntoh_long**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/5unsigned int netlib_ntoh_long (unsigned int *value) {$ return netlib_long_swap(*value);} /* netlib_ntoh_long */ /***++** ROUTINE: netlib_hton_word**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, wordword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/9unsigned short netlib_hton_word (unsigned short *value) {$ return netlib_word_swap(*value);} /* netlib_hton_word */ /***++** ROUTINE: netlib_ntoh_word**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, wordword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/9unsigned short netlib_ntoh_word (unsigned short *value) {$ return netlib_word_swap(*value);} /* netlib_ntoh_word */ /***++** ROUTINE: netlib_version**** FUNCTIONAL DESCRIPTION:**'** Returns the NETLIB version string.**S** RETURNS: cond_value, condition value, longword (unsigned), write only, by value**** PROTOTYPE:**"** NETLIB_VERSION ver [,retlen]**E** ver: char_string, character string, write only, by descriptorE** retlen: word_unsigned, word (unsigned), write only, by reference**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: None.**** SIDE EFFECTS: None.****--*/Runsigned int netlib_version (struct dsc$descriptor *ver, unsigned short *retlen) { int argc; unsigned int status;4 static char ve NETLIB_SRC.BCKû ç [NETLIB]MISC.C;6[`Ôrsion_string[] = NETLIB_T_VERSION;& static $DESCRIPTOR(faodsc, "!AD"); SETARGCOUNT(argc);% if (argc < 1) return SS$_INSFARG;& if (ver == 0) return SS$_BADPARAM;= return lib$sys_fao(&faodsc, (argc > 1 ? retlen : 0), ver,9 sizeof(version_string)-1, version_string);} /* netlib_version */ÿÿà NETLIB_SRC.BCKü ç [NETLIB]NAMEADDR.C;16[#ª¸ð*[NETLIB]NAMEADDR.C;16+,ü .#/€ 4[#Ü-ç 0ª123KÿPWO56ÞÃÁˆy˜7^Ôˆy˜8^vèvš9¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**?** ABSTRACT: DNS resolver routines - support for doing our own2** DNS gethostbyname/gethostbyaddr support.**** MODULE DESCRIPTION:**** tbs**** AUTHOR: M. MadisonG** COPYRIGHT © 1994, MADGOAT SOFTWARE. ALL RIGHTS RESERVED.**** CREATION DATE: 22-OCT-1994**** MODIFICATION HISTORY:**1** 22-OCT-1994 V1.0 Madison Initial coding.F** 17-NOV-1994 V1.1 Madison Fixed handling of DNS lookup errors.**--*/#include "netlib.h"/*** Forward declarations*/; unsigned int netlib___dns_name_to_addr(struct CTX *ctx,H struct dsc$descriptor *namdsc, struct INADDRDEF *addrlist,9 unsigned int listsize, unsigned int *count,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);G static unsigned int name_to_addr_completion(struct DNSREQ *dnsreq);; unsigned int netlib___dns_addr_to_name(struct CTX *ctx,@ struct INADDRDEF *addrlist, unsigned int addrsize,D struct dsc$descriptor *namdsc, unsigned short *retlen,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);G static unsigned int addr_to_name_completion(struct DNSREQ *dnsreq);/*** External references*/S unsigned int netlib_dns_query(struct CTX **xctx, struct dsc$descriptor *namdsc,6 unsigned int *class, unsigned int *type,: unsigned char *buf, unsigned short *bufsize,> unsigned int *flags, struct NETLIBIOSBDEF *iosb,. void (*astadr)(), void *astprm);I int netlib_dns_skipname(unsigned char *bufp, unsigned short *buflen);R unsigned int netlib_dns_expandname(unsigned char *buf, unsigned short *buflen,A unsigned char *bufp, struct dsc$descriptor *namdsc,? unsigned short *retlen, unsigned short *bufchrs);4 unsigned int netlib___dns_init(struct CTX *ctx);  /***++&** ROUTINE: netlib___dns_name_to_addr**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/8unsigned int netlib___dns_name_to_addr (struct CTX *ctx,H struct dsc$descriptor *namdsc, struct INADDRDEF *addrlist,9 unsigned int listsize, unsigned int *count,K struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm) { unsigned short bufsize; unsigned int status; struct DNSREQ *dnsreq; struct IOR *ior;6 static unsigned int class = NETLIB_K_DNS_CLASS_IN;4 static unsigned int type = NETLIB_K_DNS_TYPE_A;< static unsigned int queryflags = NETLIB_M_DOMAIN_SEARCH;: if (ctx->flags & CTX_M_NO_DNS) return SS$_UNSUPPORTED; if (ctx->dnsctx == 0) {% status = netlib___dns_init(ctx);- if (!OK(status)) return SS$_UNSUPPORTED; }2 GET_DNSREQ(dnsreq, ctx, iosb, astadr, astprm); ior = dnsreq->ior;# ior->arg[0].address = addrlist;$ ior->arg[1].longword = listsize; ior->arg[2].address = count;" bufsize = sizeof(dnsreq->buf);: status = netlib_dns_query(&ctx, namdsc, &class, &type,% dnsreq->buf, &bufsize, &queryflags, &ior->iosb,! (astadr == 0) ? 0 C : (void (*)()) name_to_addr_completion, dnsreq);# if (astadr != 0) return status;+ return name_to_addr_completion(dnsreq);!} /* netlib___dns_name_to_addr */ /***++$** ROUTINE: name_to_addr_completion**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Estatic unsigned int name_to_addr_completion (struct DNSREQ *dnsreq) {" struct IOR *ior = dnsreq->ior; struct CTX *ctx = ior->ctx;2 struct INADDRDEF *alist = ior->arg[0].address;. unsigned int *count = ior->arg[2].address; struct dsc$descriptor dsc;" struct NETLIB_DNS_HEADER *hdr; unsigned char *cp; char name[256];0 unsigned short retlen, remain, buflen, skip;, int i, n, ancount, qdcount, type, class;' if (!OK(ior->iosb.iosb_w_status)) { unsigned int status; if (ior->iosbp != 0) {= ior->iosbp->iosb_w_status = ior->iosb.iosb_w_status;' ior->iosbp->iosb_w_count = 0;' ior->iosbp->iosb_l_unused = 0; } if (count != 0) *count = 0;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm);& status = ior->iosb.iosb_w_status; FREE_DNSREQ(dnsreq); return status; }3 hdr = (struct NETLIB_DNS_HEADER *) dnsreq->buf;3 ancount = netlib_word_swap(hdr->dns_w_ancount);3 qdcount = netlib_word_swap(hdr->dns_w_qdcount);; if (hdr->dns_v_reply_code != NETLIB_K_DNS_RC_SUCCESS) {/ ior->iosbp->iosb_w_status = SS$_ENDOFFILE;" ior->iosbp->iosb_w_count = 0;# ior->iosbp->iosb_l_unused = 0; if (count != 0) *count = 0;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm); FREE_DNSREQ(dnsreq); return SS$_ENDOFFILE; }$ buflen = ior->iosb.iosb_w_count;$ remain = buflen - sizeof(*hdr);$ cp = dnsreq->buf + sizeof(*hdr); while (qdcount-- > 0) {. i = netlib_dns_skipname(cp, &remain) + 4; cp += i; remain -= i; }( INIT_SDESC(dsc, sizeof(name), name); n = 0;E while (ancount-- > 0 && remain > 0 && n < ior->arg[1].longword) {[ if (!OK(netlib_dns_expandname(dnsreq->buf, &buflen, cp, &dsc, &retlen, &skip))) break; cp += skip; remain -= skip;4 type = netlib_word_swap(*(unsigned short *)cp); cp += 2; remain -= 2;5 class = netlib_word_swap(*(unsigned short *)cp);3 cp += 6; remain -= 6; /* skip over TTL, too */1 i = netlib_word_swap(*(unsigned short *)cp); cp += 2; remain -= 2;' if (type == NETLIB_K_DNS_TYPE_A) {9 alist[n++].inaddr_l_addr = *(unsigned long *)cp; } cp += i; remain -= i; }  if (count != 0) *count = n; if (ior->iosbp != 0) {, ior->iosbp->iosb_w_status = SS$_NORMAL;# ior->iosbp->iosb_w_count = n;# ior->iosbp->iosb_l_unused = 0; }1 if (ior->astadr) (*ior->astadr)(ior->astprm); FREE_DNSREQ(dnsreq); return SS$_NORMAL;} /* name_to_addr_completion */ /***++&** ROUTINE: netlib___dns_addr_to_name**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/8unsigned int netlib___dns_addr_to_name (struct CTX *ctx,= struct INADDRDEF *xaddr, unsigned int addrà NETLIB_SRC.BCKü ç [NETLIB]NAMEADDR.C;16[#7!size,D struct dsc$descriptor *namdsc, unsigned short *retlen,K struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm) { struct dsc$descriptor dsc; struct IOR *ior; struct DNSREQ *dnsreq; char tmp[256]; unsigned short bufsize; unsigned int status; unsigned char *addr;6 static unsigned int class = NETLIB_K_DNS_CLASS_IN;6 static unsigned int type = NETLIB_K_DNS_TYPE_PTR;< static unsigned int queryflags = NETLIB_M_DOMAIN_SEARCH;: if (ctx->flags & CTX_M_NO_DNS) return SS$_UNSUPPORTED; if (ctx->dnsctx == 0) {% status = netlib___dns_init(ctx);- if (!OK(status)) return SS$_UNSUPPORTED; }2 GET_DNSREQ(dnsreq, ctx, iosb, astadr, astprm); ior = dnsreq->ior;! ior->arg[0].address = namdsc;! ior->arg[1].address = retlen;# addr = (unsigned char *) xaddr;= INIT_SDESC(dsc, sprintf(tmp, "%d.%d.%d.%d.in-addr.arpa.",9 addr[3], addr[2], addr[1], addr[0]), tmp);" bufsize = sizeof(dnsreq->buf);8 status = netlib_dns_query(&ctx, &dsc, &class, &type,% dnsreq->buf, &bufsize, &queryflags, &ior->iosb,! (astadr == 0) ? 0 C : (void (*)()) addr_to_name_completion, dnsreq);# if (astadr != 0) return status;+ return addr_to_name_completion(dnsreq);!} /* netlib___dns_addr_to_name */ /***++$** ROUTINE: addr_to_name_completion**** FUNCTIONAL DESCRIPTION:**)** tbs **B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Estatic unsigned int addr_to_name_completion (struct DNSREQ *dnsreq) {" struct IOR *ior = dnsreq->ior; struct CTX *ctx = ior->ctx;8 struct dsc$descriptor *namdsc = ior->arg[0].address;2 unsigned short *retlenp = ior->arg[1].address; struct dsc$descriptor dsc;" struct NETLIB_DNS_HEADER *hdr; unsigned char *cp;3 unsigned short retlen, remain, buflen, n, skip; char name[256];) int i, ancount, qdcount, type, class; unsigned int status;' if (!OK(ior->iosb.iosb_w_status)) { if (ior->iosbp != 0) {= ior->iosbp->iosb_w_status = ior->iosb.iosb_w_status;' ior->iosbp->iosb_w_count = 0;' ior->iosbp->iosb_l_unused = 0; }$ if (retlenp != 0) *retlenp = 0;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm);& status = ior->iosb.iosb_w_status; FREE_DNSREQ(dnsreq); return status; }3 hdr = (struct NETLIB_DNS_HEADER *) dnsreq->buf;3 ancount = netlib_word_swap(hdr->dns_w_ancount);3 qdcount = netlib_word_swap(hdr->dns_w_qdcount);; if (hdr->dns_v_reply_code != NETLIB_K_DNS_RC_SUCCESS) {/ ior->iosbp->iosb_w_status = SS$_ENDOFFILE;" ior->iosbp->iosb_w_count = 0;# ior->iosbp->iosb_l_unused = 0;$ if (retlenp != 0) *retlenp = 0;7 if (ior->astadr != 0) (*ior->astadr)(ior->astprm); FREE_DNSREQ(dnsreq); return SS$_ENDOFFILE; }$ buflen = ior->iosb.iosb_w_count;$ remain = buflen - sizeof(*hdr);$ cp = dnsreq->buf + sizeof(*hdr); while (qdcount-- > 0) {. i = netlib_dns_skipname(cp, &remain) + 4; cp += i; remain -= i; }( INIT_SDESC(dsc, sizeof(name), name); status = SS$_NORMAL;) while (ancount-- > 0 && remain > 0) {[ if (!OK(netlib_dns_expandname(dnsreq->buf, &buflen, cp, &dsc, &retlen, &skip))) break; cp += skip; remain -= skip;4 type = netlib_word_swap(*(unsigned short *)cp); cp += 2; remain -= 2;5 class = netlib_word_swap(*(unsigned short *)cp);3 cp += 6; remain -= 6; /* skip over TTL, too */1 i = netlib_word_swap(*(unsigned short *)cp); cp += 2; remain -= 2;) if (type == NETLIB_K_DNS_TYPE_PTR) {Q status = netlib_dns_expandname(dnsreq->buf, &buflen, cp, namdsc, &n, 0); break; } cp += i; remain -= i; } 1 if (OK(status) && retlenp != 0) *retlenp = n; if (ior->iosbp != 0) {( ior->iosbp->iosb_w_status = status;3 ior->iosbp->iosb_w_count = OK(status) ? n: 0;# ior->iosbp->iosb_l_unused = 0; }1 if (ior->astadr) (*ior->astadr)(ior->astprm); FREE_DNSREQ(dnsreq); return status;} /* addr_to_name_completion */ÿÿà  NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI.C;43XT tð*[NETLIB]NETLIB_SRI.C;43+,.T/€ 4XTRV-ç 0ª123KÿPWOS56|Kn¹úQ›7H¹úQ›89¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**8** ABSTRACT: Routines specific to the SRI-QIO interface'** (MultiNet, TCPware, Pathway).**** MODULE DESCRIPTION:**** tbs**** AUTHOR: M. MadisonC** COPYRIGHT © 1994, 1995, 1996, 1997 MADGOAT SOFTWARE."** ALL RIGHTS RESERVED.**** CREATION DATE: 20-OCT-1994**** MODIFICATION HISTORY:**1** 20-OCT-1994 V1.0 Madison Initial coding.M** 17-NOV-1994 V1.0-1 Madison Wasn't mapping 0-length read to LINKDISCON.K** 08-JUN-1995 V1.0-2 Madison Don't wipe out COPY_FROM flag with TIMED.B** 13-JUN-1995 V1.0-3 Madison Second try at the COPY_FROM fix.=** 13-OCT-1995 V1.0-4 Madison Free IOR's on $QIO failure.F** 11-FEB-1996 V1.0-5 Madison Fix argcnt check in netlib_shutdown.C** 01-JUN-1997 V1.0-6 Madison Use a flag to indicate a timeout.**--*/#include "netlib_sri.h"#include "netlib.h"/*** Forward declarations*/E unsigned int netlib_socket(struct CTX **xctx, unsigned int *type,* unsigned int *family);7 unsigned int netlib_server_setup(struct CTX **xctx,; struct SINDEF *sa, unsigned int *salen);B unsigned int netlib_bind(struct CTX **xctx, struct SINDEF *sa,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);7 static unsigned int io_completion(struct IOR *ior);H unsigned int netlib_getsockname(struct CTX **ctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);H unsigned int netlib_getpeername(struct CTX **ctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);D unsigned int netlib_connect(struct CTX **ctx, struct SINDEF *sa,) unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);K unsigned int netlib_write(struct CTX **ctx, struct dsc$descriptor *dsc,: struct SINDEF *sa, unsigned int *salen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);J unsigned int netlib_read(struct CTX **ctx, struct dsc$descriptor *dsc,; struct SINDEF *sa, unsigned int *sasize,2 unsigned int *salen, TIME *tmo,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);4 static unsigned int io_timeout(struct IOR *ior);K unsigned int netlib_shutdown(struct CTX **xctx, unsigned int *shuttype,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);1 unsigned int netlib_close(struct CTX **xctx);H unsigned int netlib_listen(struct CTX **xctx, unsigned int *backlog,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);F unsigned int netlib_accept(struct CTX **ctx, struct CTX **xnewctx,; struct SINDEF *sa, unsigned int *sasize,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);5 unsigned int netlib_setsockopt(struct CTX **xctx,= unsigned int *level, unsigned int *option,5 void *value, unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);5 unsigned int netlib_getsockopt(struct CTX **xctx,= unsigned int *level, unsigned int *option,6 void *value, unsigned int *valsize,( unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);P unsigned int netlib_name_to_address(struct CTX **xctx, unsigned int *whichp,1 struct dsc$descriptor *namdsc,. struct INADDRDEF *addrlist,? unsigned int *listsize, unsigned int *count,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);P unsigned int netlib_address_to_name(struct CTX **xctx, unsigned int *whichp,* struct INADDRDEF *addr,* unsigned int *addrsize,1 struct dsc$descriptor *namdsc,* unsigned short *retlen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);H static unsigned int netlib___cvt_status(struct NETLIBIOSBDEF *iosb);X static void netlib___cvt_iosb(struct NETLIBIOSBDEF *dst, struct NETLIBIOSBDEF *src);8 unsigned int netlib_dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);/*** OWN storage*/. static $DESCRIPTOR(inetdevice, "_INET0:");( static unsigned short errorvec[] = {@ SS$_ABORT, SS$_ABORT, SS$_NOSUCHNODE, SS$_ABORT, SS$_ABORT,C SS$_NOSUCHNODE, SS$_ABORT, SS$_ABORT, SS$_BADPARAM, SS$_ABORT,? SS$_ABORT, SS$_INSFMEM, SS$_NOPRIV, SS$_ACCVIO, SS$_ABORT,? SS$_ABORT, SS$_FILALRACC, SS$_ABORT, SS$_ABORT, SS$_ABORT,> SS$_ABORT, SS$_BADPARAM, SS$_ABORT, SS$_ABORT, SS$_ABORT,; SS$_ABORT, SS$_ABORT, SS$_ABORT, SS$_ABORT, SS$_ABORT,M SS$_ABORT, SS$_LINKDISCON, SS$_BADPARAM, SS$_TOOMUCHDATA, SS$_SUSPENDED,J SS$_ABORT, SS$_ABORT, SS$_NOTNETDEV, SS$_NOSUCHNODE, SS$_TOOMUCHDATA,M SS$_PROTOCOL, SS$_PROTOCOL, SS$_PROTOCOL, SS$_PROTOCOL, SS$_ILLCNTRFUNC,J SS$_PROTOCOL, SS$_PROTOCOL, SS$_DUPLNAM, SS$_IVADDR, SS$_UNREACHABLE,L SS$_UNREACHABLE, SS$_RESET, SS$_LINKABORT, SS$_CONNECFAIL, SS$_INSFMEM,B SS$_FILALRACC, SS$_NOLINKS, SS$_SHUT, SS$_ABORT, SS$_TIMEOUT,B SS$_REJECT, SS$_ABORT, SS$_ABORT, SS$_SHUT, SS$_UNREACHABLE};/*** External references*/; unsigned int netlib___dns_name_to_addr(struct CTX *ctx,H struct dsc$descriptor *namdsc, struct INADDRDEF *addrlist,9 unsigned int listsize, unsigned int *count,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);: unsigned int netlib___ht_name_to_addr(struct CTX *ctx,H struct dsc$descriptor *namdsc, struct INADDRDEF *addrlist,9 unsigned int listsize, unsigned int *count,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);; unsigned int netlib___dns_addr_to_name(struct CTX *ctx,@ struct INADDRDEF *addrlist, unsigned int addrsize,D struct dsc$descriptor *namdsc, unsigned short *retlen,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);: unsigned int netlib___ht_addr_to_name(struct CTX *ctx,@ struct INADDRDEF *addrlist, unsigned intà NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI.C;43XT–í addrsize,D struct dsc$descriptor *namdsc, unsigned short *retlen,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);O unsigned int netlib_strtoaddr(struct dsc$descriptor *, struct INADDRDEF *);: unsigned int netlib___dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm); /***++** ROUTINE: netlib_socket**** FUNCTIONAL DESCRIPTION:**** Create a "socket".**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Bunsigned int netlib_socket (struct CTX **xctx, unsigned int *type,+ unsigned int *family) { struct CTX *ctx; struct NETLIBIOSBDEF myiosb; unsigned int status, af, ty; int argc; SETARGCOUNT(argc);% if (argc < 1) return SS$_INSFARG;4 status = netlib___alloc_ctx(&ctx, SPECCTX_SIZE);# if (!OK(status)) return status;7 status = sys$assign(&inetdevice, &ctx->chan, 0, 0); if (!OK(status)) { netlib___free_ctx(ctx); return status; }A ty = (argc >= 2 && type != 0) ? *type : NETLIB_K_TYPE_STREAM;A af = (argc >= 3 && family != 0) ? *family : NETLIB_K_AF_INET;> status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SOCKET, &myiosb, 0, 0,# af, ty, 0, 0, 0, 0);: if (OK(status)) status = netlib___cvt_status(&myiosb); if (!OK(status)) { sys$dassgn(ctx->chan); netlib___free_ctx(ctx); return status; } *xctx = ctx; return SS$_NORMAL;} /* netlib_socket */ /***++ ** ROUTINE: netlib_server_setup**** FUNCTIONAL DESCRIPTION:**** Create a "server_setup".**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Gunsigned int netlib_server_setup (struct CTX **xctx, struct SINDEF *sa,. unsigned int *salen) { struct CTX *ctx; unsigned int status;, static $DESCRIPTOR(device, "SYS$INPUT");4 status = netlib___alloc_ctx(&ctx, SPECCTX_SIZE);# if (!OK(status)) return status;3 status = sys$assign(&device, &ctx->chan, 0, 0); if (!OK(status)) { netlib___free_ctx(ctx); return status; } *xctx = ctx; return SS$_NORMAL;} /* netlib_server_setup */ /***++** ROUTINE: netlib_bind**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/?unsigned int netlib_bind (struct CTX **xctx, struct SINDEF *sa,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; struct NETLIBIOSBDEF myiosb; unsigned int status; int argc; static unsigned int one = 1; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);3 if (sa == 0 || salen == 0) return SS$_BADPARAM;< if (*salen < sizeof(struct SINDEF)) return SS$_BADPARAM;3 if (!(ctx->flags & CTX_M_USER_SET_REUSEADDR)) {C sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETSOCKOPT, 0, 0, 0,? NETLIB_K_LEVEL_SOCKET, NETLIB_K_OPTION_REUSEADDR,' &one, sizeof(one), 0, 0); }" if (argc > 4 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);I status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_BIND, &ior->iosb,? io_completion, ior, sa, *salen, 0, 0, 0, 0);$ if (!OK(status)) FREE_IOR(ior); } else {F status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_BIND, &myiosb,1 0, 0, sa, *salen, 0, 0, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);A if (argc > 3 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); } return status;} /* netlib_bind */ /***++** ROUTINE: io_completion**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/5static unsigned int io_completion (struct IOR *ior) { struct CTX *ctx; ctx = ior->ctx;( ior->iorflags |= IOR_M_IO_COMPLETED;; if (ior->iorflags & IOR_M_IO_TIMED) sys$cantim(ior, 0);T if (ior->iosb.iosb_w_status == SS$_CANCEL && (ior->iorflags & IOR_M_IO_TIMEOUT))+ ior->iosb.iosb_w_status = SS$_TIMEOUT;- if (ior->iorflags & IOR_M_CHECK_LENGTH &&D OK(ior->iosb.iosb_w_status) && ior->iosb.iosb_w_count == 0). ior->iosb.iosb_w_status = SS$_LINKDISCON;C if (ior->iosbp != 0) netlib___cvt_iosb(ior->iosbp, &ior->iosb);, if (ior->iorflags & IOR_M_COPY_LENGTH) {> if (OK(ior->iosb.iosb_w_status) && ior->spec_retlen != 0)@ *(unsigned int *) ior->spec_retlen = ior->spec_length;) ior->iorflags &= ~IOR_M_COPY_LENGTH; }* if (ior->iorflags & IOR_M_COPY_FROM) {B if (OK(ior->iosb.iosb_w_status) && ior->spec_userfrom != 0) { unsigned int len;( len = ior->specior.from.length;< if (len > ior->spec_length) len = ior->spec_length;E memcpy(ior->spec_userfrom, &ior->specior.from.address, len);L if (ior->spec_retlen != 0) *(unsigned int *)ior->spec_retlen = len; }' ior->iorflags &= ~IOR_M_COPY_FROM; }+ if (ior->iorflags & IOR_M_COPY_FROM2) {B if (OK(ior->iosb.iosb_w_status) && ior->spec_userfrom != 0) { unsigned int len;) len = ior->specior.from2.length;< if (len > ior->spec_length) len = ior->spec_length;F memcpy(ior->spec_userfrom, &ior->specior.from2.address, len);L if (ior->spec_retlen != 0) *(unsigned int *)ior->spec_retlen = len; }( ior->iorflags &= ~IOR_M_COPY_FROM2; }, if (ior->iorflags & IOR_M_NEW_CONTEXT) {' if (OK(ior->iosb.iosb_w_status)) {P *((struct CTX **) ior->spec_xnewctx) = (struct CTX *) ior->spec_newctx; } else {= sys$dassgn(((struct CTX *) ior->spec_newctx)->chan);< netlib___free_ctx((struct CTX *) ior->spec_newctx); }) ior->iorflags &= ~IOR_M_NEW_CONTEXT; }8 if (ior->astadr != 0) (*(ior->astadr))(ior->astprm); FREE_IOR(ior); return SS$_NORMAL;} /* io_completion */ /***++** ROUTINE: netlib_getsockname**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Funsigned int netlib_getsockname (struct CTX **xctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) {à NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI.C;43XT2 struct CTX *ctx; unsigned int status; int argc; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);4 if (sa == 0 || sasize == 0) return SS$_BADPARAM;" if (argc > 5 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0); ior->spec_length = *sasize; ior->spec_retlen = salen;' ior->iorflags = IOR_M_COPY_LENGTH;P status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_GETSOCKNAME, &ior->iosb,= io_completion, ior, sa, &ior->spec_length, 0, 0, 0, 0);$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb; unsigned int length; length = *sasize;D status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_GETSOCKNAME, &myiosb,2 0, 0, sa, &length, 0, 0, 0, 0);1 if (argc > 3 && salen != 0) *salen = length;; if (OK(status)) status = netlib___cvt_status(&myiosb);A if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); } return status;} /* netlib_getsockname */ /***++** ROUTINE: netlib_getpeername**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Funsigned int netlib_getpeername (struct CTX **xctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,i0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc;H VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);4 if (sa == 0 || sasize == 0) return SS$_BADPARAM;" if (argc > 5 && astadr != 0) { struct IOR *ior;9> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0); ior->spec_length = *sasize; ior->spec_retlen = salen;' ior->iorflags = IOR_M_COPY_LENGTH;_P status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_GETPEERNAME, &ior->iosb,= io_completion, ior, sa, &ior->spec_length,f 0, 0, 0, 0); $ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;  unsigned int length; length = *sasize;D status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_GETPEERNAME, &myiosb,t2 0, 0, sa, &length, 0, 0, 0, 0);1 if (argc > 3 && salen != 0) *salen = length;n; if (OK(status)) status = netlib___cvt_status(&myiosb);rA if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);d }  return status;} /* netlib_getpeername */ g/***++** ROUTINE: netlib_connecto**** FUNCTIONAL DESCRIPTION:s**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.e**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Bunsigned int netlib_connect (struct CTX **xctx, struct SINDEF *sa,) unsigned int *salen,X0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc;  VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);3 if (sa == 0 || salen == 0) return SS$_BADPARAM; < if (*salen < sizeof(struct SINDEF)) return SS$_BADPARAM;" if (argc > 4 && astadr != 0) { struct IOR *ior;v> GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);L status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_CONNECT, &ior->iosb,2 io_completion, ior, sa, *salen, 0, 0, 0, 0);*$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;eI status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_CONNECT, &myiosb,1 0, 0, sa, *salen, 0, 0, 0, 0);,; if (OK(status)) status = netlib___cvt_status(&myiosb); A if (argc > 3 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);o }t return status;} /* netlib_connect */ n/***++** ROUTINE: netlib_writet**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.d**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Iunsigned int netlib_write (struct CTX **xctx, struct dsc$descriptor *dsc,c: struct SINDEF *sa, unsigned int *salen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; void *bufptr;, unsigned int status; unsigned short buflen; int argc;x VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);6 status = lib$analyze_sdesc(dsc, &buflen, &bufptr);# if (!OK(status)) return status; " if (argc > 5 && astadr != 0) { struct IOR *ior;i> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0);N status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_WRITEVBLK, &ior->iosb,= io_completion, ior, bufptr, buflen, 0, sa, - (salen == 0) ? 0 : *salen,c 0);$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;dB status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_WRITEVBLK,4 &myiosb, 0, 0, bufptr, buflen, 0,' (argc > 2) ? sa : 0, = (argc > 3 && salen != 0) ? *salen : 0, 0); ; if (OK(status)) status = netlib___cvt_status(&myiosb);sA if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);t }X return status;} /* netlib_write */ /***++** ROUTINE: netlib_read**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:g****** SIDE EFFECTS: None.****--*/Hunsigned int netlib_read (struct CTX **xctx, struct dsc$descriptor *dsc,; struct SINDEF *sa, unsigned int *sasize,(6 unsigned int *salen, TIME *timeout,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; struct IOR *ior; int argc, do_from; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);E if (dsc->dsc$b_dtype != DSC$K_DTYPE_T && dsc->dsc$b_dtype != 0) {C return SS$_BADPARAM;, }SE if (dsc->dsc$b_class != DSC$K_CLASS_S && dsc->dsc$b_class != 0) {A return SS$_BADPARAM;I }AC do_from = (argc > 3 && sa != 0 && sasize != 0 && *sasize != 0);," if (argc > 7 && astadr != 0) {> GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0); if (do_from) {BF ior->specior.from.length = sizeof(ior->specior.from.address);! ior->spec_userfrom = sa;A$ ior->spec_length = *sasize;" ior->spec_retlen = salen;) ior->iorflags = IOR_M_COPY_FROM;P } else ior->iorflags = 0; if (timeout != 0) {) ior->iorflags |= IOR_M_IO_TIMED;J status = sys$setimr(netlib_asynch_efn, timeout, io_timeout, ior); if (!OK(status)) {I FREE_IOR(ior); return staà NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI.C;43XT¯ž-tus; } }) ior->iorflags |= IOR_M_CHECK_LENGTH; M status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_READVBLK, &ior->iosb, : io_completion, ior, dsc->dsc$a_pointer,( dsc->dsc$w_length, 0,4 do_from ? &ior->specior.from : 0,? do_from ? sizeof(ior->specior.from) : 0, 0);  if (!OK(status)) {n. if (timeout != 0) sys$cantim(ior, 0); FREE_IOR(ior);, } } else { struct {  unsigned short length;g struct SINDEF address;t } from;! struct NETLIBIOSBDEF myiosb;* int timed_out;d timed_out = 0;t( from.length = sizeof(from.address);$ if (argc > 5 && timeout != 0) {$ GET_IOR(ior, ctx, 0, 0, 0);( ior->iorflags = IOR_M_IO_TIMED;J status = sys$setimr(netlib_asynch_efn, timeout, io_timeout, ior); if (!OK(status)) {t FREE_IOR(ior); return status; } }A status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_READVBLK,s! &myiosb, 0, 0, < dsc->dsc$a_pointer, dsc->dsc$w_length, 0,' do_from ? &from : 0,t2 do_from ? sizeof(from) : 0, 0);$ if (argc > 5 && timeout != 0) { sys$cantim(ior, 0);6 timed_out = ior->iorflags & IOR_M_IO_TIMEOUT; FREE_IOR(ior);* } if (OK(status)) {= if (timed_out && myiosb.iosb_w_status == SS$_CANCEL)o- myiosb.iosb_w_status = SS$_TIMEOUT;_/ status = netlib___cvt_status(&myiosb); 4 if (OK(status) && myiosb.iosb_w_count == 0)9 status = myiosb.iosb_w_status = SS$_LINKDISCON; }A if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);e! if (OK(status) && do_from) { unsigned int len; len = from.length;t* if (len > *sasize) len = *sasize;( memcpy(sa, &from.address, len);2 if (argc > 4 && salen != 0) *salen = len; } }i return status;} /* netlib_read */n r/***++** ROUTINE: io_timeout **** FUNCTIONAL DESCRIPTION:G**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/2static unsigned int io_timeout (struct IOR *ior) {> if (ior->iorflags & IOR_M_IO_COMPLETED) return SS$_NORMAL;& ior->iorflags |= IOR_M_IO_TIMEOUT;& return sys$cancel(ior->ctx->chan);} /* io_timeout */ /***++** ROUTINE: netlib_shutdown**** FUNCTIONAL DESCRIPTION:t**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.i**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Hunsigned int netlib_shutdown (struct CTX **xctx, unsigned int *shuttype,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc;I VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);" if (argc > 3 && astadr != 0) { struct IOR *ior;s> GET_IOR(ior, ctx, iosb, astadr, (argc > 4) ? astprm : 0);M status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SHUTDOWN, &ior->iosb,d& io_completion, ior,C (shuttype == 0) ? 0 : *shuttype, 0, 0, 0, 0, 0);t$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb; J status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SHUTDOWN, &myiosb,E 0, 0, (argc > 1 && shuttype != 0) ? *shuttype : 0," 0, 0, 0, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);aA if (argc > 2 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); }  return status;} /* netlib_shutdown */L T/***++** ROUTINE: netlib_closeC**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.***** COMPLETION CODES:****** SIDE EFFECTS: None.****--*//unsigned int netlib_close (struct CTX **xctx) { struct CTX *ctx; unsigned int status; VERIFY_CTX(xctx, ctx);# status = sys$dassgn(ctx->chan);)# if (!OK(status)) return status;n netlib___free_ctx(ctx);n *xctx = 0; return SS$_NORMAL;} /* netlib_close */ /***++** ROUTINE: netlib_listen**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.I**** COMPLETION CODES:(****** SIDE EFFECTS: None.****--*/Eunsigned int netlib_listen (struct CTX **xctx, unsigned int *backlog,i. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc;, VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);" if (argc > 3 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 4) ? astprm : 0);K status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_LISTEN, &ior->iosb,O& io_completion, ior,A (backlog == 0) ? 0 : *backlog, 0, 0, 0, 0, 0); $ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;PH status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_LISTEN, &myiosb,C 0, 0, (argc > 1 && backlog != 0) ? *backlog : 0, " 0, 0, 0, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);rA if (argc > 2 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);M }$ return status;} /* netlib_listen */a /***++** ROUTINE: netlib_accept**** FUNCTIONAL DESCRIPTION:s**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.N**** COMPLETION CODES:s****** SIDE EFFECTS: None.****--*/Dunsigned int netlib_accept (struct CTX **xctx, struct CTX **xnewctx,; struct SINDEF *sa, unsigned int *sasize,iC unsigned int *salen, struct NETLIBIOSBDEF *iosb,&4 void (*astadr)(), void *astprm) { struct CTX *ctx, *newctx;  unsigned int status; int argc;_ VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG; * if (xnewctx == 0) return SS$_BADPARAM;7 status = netlib___alloc_ctx(&newctx, SPECCTX_SIZE);o# if (!OK(status)) return status;i: status = sys$assign(&inetdevice, &newctx->chan, 0, 0); if (!OK(status)) { netlib___free_ctx(newctx); return status;l }O" if (argc > 6 && astadr != 0) { struct IOR *ior;o> GET_IOR(ior, ctx, iosb, astadr, (argc > 7) ? astprm : 0);D ior->specior.from2.length = sizeof(ior->specior.from2.address);1 ior->spec_userfrom = (sasize == 0) ? 0 : sa;_4 ior->spec_length = (sasize == 0) ? 0 : *sasize; ior->spec_retlen = salen;! ior->spec_xnewctx = xnewctx;; ior->spec_newctx = newctx;I' ior->iorflags = IOR_M_NEW_CONTEXT;i! if (ior->spec_userfrom != 0) + ior->iorflaà NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI.C;43XTy’<gs |= IOR_M_COPY_FROM2; N status = sys$qio(netlib_asynch_efn, newctx->chan, IO$_ACCEPT, &ior->iosb,& io_completion, ior,C &ior->specior.from2, sizeof(ior->specior.from2),C' ctx->chan, 0, 0, 0);r$ if (!OK(status)) FREE_IOR(ior); } else { struct {= unsigned int length;m struct SINDEF address;e } from;! struct NETLIBIOSBDEF myiosb;*( from.length = sizeof(from.address);B status = sys$qiow(netlib_synch_efn, newctx->chan, IO$_ACCEPT,! &myiosb, 0, 0, ' &from, sizeof(from),*' ctx->chan, 0, 0, 0);*; if (OK(status)) status = netlib___cvt_status(&myiosb);*A if (argc > 5 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);_ if (OK(status)) { *xnewctx = newctx; 2 if (argc > 3 && sa != 0 && sasize != 0) { unsigned int len;  len = from.length;+ if (len > *sasize) len = *sasize; ) memcpy(sa, &from.address, len);n3 if (argc > 4 && salen != 0) *salen = len;, } } }c return status;} /* netlib_accept */$ D/***++** ROUTINE: netlib_setsockopt**** FUNCTIONAL DESCRIPTION:G**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.i**** COMPLETION CODES:h****** SIDE EFFECTS: None.****--*/2unsigned int netlib_setsockopt (struct CTX **xctx,= unsigned int *level, unsigned int *option,r5 void *value, unsigned int *vallen, . struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status, lev; int argc;, VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG;tF if (option == 0 || value == 0 || vallen == 0) return SS$_BADPARAM;0 if (level == 0) lev = NETLIB_K_LEVEL_SOCKET; else lev = *level;O if (lev == NETLIB_K_LEVEL_SOCKET && *option == NETLIB_K_OPTION_REUSEADDR) { , ctx->flags |= CTX_M_USER_SET_REUSEADDR; }N" if (argc > 6 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 7) ? astprm : 0);O status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SETSOCKOPT, &ior->iosb,C4 io_completion, ior, lev, *option,) value, *vallen, 0, 0);,$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb; C status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETSOCKOPT,vF &myiosb, 0, 0, lev, *option, value, *vallen, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);A if (argc > 5 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);r }& return status;} /* netlib_setsockopt */I i/***++** ROUTINE: netlib_getsockopt**** FUNCTIONAL DESCRIPTION:s**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None._**** COMPLETION CODES:s****** SIDE EFFECTS: None.****--*/2unsigned int netlib_getsockopt (struct CTX **xctx,= unsigned int *level, unsigned int *option, 6 void *value, unsigned int *valsize,( unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status, lev; int argc;a VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG; G if (option == 0 || value == 0 || valsize == 0) return SS$_BADPARAM;:0 if (level == 0) lev = NETLIB_K_LEVEL_SOCKET; else lev = *level;" if (argc > 7 && astadr != 0) { struct IOR *ior;e> GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0); ior->spec_retlen = vallen;e! ior->spec_length = *valsize;' ior->iorflags = IOR_M_COPY_LENGTH;O status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_GETSOCKOPT, &ior->iosb, 4 io_completion, ior, lev, *option,3 value, &ior->spec_length, 0, 0);i$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;  unsigned int length;t length = *valsize;(C status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_GETSOCKOPT,f6 &myiosb, 0, 0, lev, *option, value," &length, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);,A if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);,A if (OK(status) && argc > 5 && vallen != 0) *vallen = length;i }, return status;} /* netlib_getsockopt */  /***++#** ROUTINE: netlib_name_to_address **** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Munsigned int netlib_name_to_address (struct CTX **xctx, unsigned int *whichp,i1 struct dsc$descriptor *namdsc, . struct INADDRDEF *addrlist,? unsigned int *listsize, unsigned int *count,*. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; struct INADDRDEF addr; unsigned int status, which; int argc;r VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG;rK if (namdsc == 0 || addrlist == 0 || listsize == 0) return SS$_BADPARAM;. if (OK(netlib_strtoaddr(namdsc, &addr))) { addrlist[0] = addr;, if (argc > 5 && count != 0) *count = 1;! if (argc > 6 && iosb != 0) {(* iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = 1;! iosb->iosb_l_unused = 0;( }# if (argc > 7 && astadr != 0) {i? return sys$dclast(astadr, (argc > 8) ? astprm : 0, 0);0 } else {  return SS$_NORMAL;c } }R1 if (whichp == 0) which = NETLIB_K_LOOKUP_DNS;n else which = *whichp;a' if (which == NETLIB_K_LOOKUP_DNS) {sG return netlib___dns_name_to_addr(ctx, namdsc, addrlist, *listsize, ! (argc > 5) ? count : 0, ! (argc > 6) ? iosb : 0,t" (argc > 7) ? astadr : 0,# (argc > 8) ? astprm : 0);0 }rE return netlib___ht_name_to_addr(ctx, namdsc, addrlist, *listsize, ! (argc > 5) ? count : 0,:! (argc > 6) ? iosb : 0,u" (argc > 7) ? astadr : 0,# (argc > 8) ? astprm : 0);b} /* netlib_name_to_address */ /***++#** ROUTINE: netlib_address_to_name **** FUNCTIONAL DESCRIPTION:e**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.n**** COMPLETION CODES:S****** SIDE EFFECTS: None.****--*/Munsigned int netlib_address_to_name (struct CTX **xctx, unsigned int *whichp,t* struct INADDRDEF *addr,* unsigned int *addrsize,1 struct dsc$descriptor *namdsc,** unsigned short *retlen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), và NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI.C;43XTä Koid *astprm) { struct CTX *ctx; unsigned int status, which;; int argc;C VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG;$G if (addr == 0 || addrsize == 0 || namdsc == 0) return SS$_BADPARAM;c1 if (whichp == 0) which = NETLIB_K_LOOKUP_DNS;  else which = *whichp; ' if (which == NETLIB_K_LOOKUP_DNS) {&C return netlib___dns_addr_to_name(ctx, addr, *addrsize, namdsc," (argc > 5) ? retlen : 0," (argc > 6) ? iosb : 0," (argc > 7) ? astadr : 0,# (argc > 8) ? astprm : 0);m }sA return netlib___ht_addr_to_name(ctx, addr, *addrsize, namdsc,s" (argc > 5) ? retlen : 0," (argc > 6) ? iosb : 0," (argc > 7) ? astadr : 0,# (argc > 8) ? astprm : 0);{} /* netlib_address_to_name */ T/***++ ** ROUTINE: netlib___cvt_status**** FUNCTIONAL DESCRIPTION:i**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.c**** COMPLETION CODES:B****** SIDE EFFECTS: None.****--*/Fstatic unsigned int netlib___cvt_status (struct NETLIBIOSBDEF *iosb) { int errnum;_= if (iosb->iosb_w_status == SS$_NORMAL) return SS$_NORMAL;oB else if (iosb->iosb_w_status == SS$_CANCEL) return SS$_CANCEL;D else if (iosb->iosb_w_status == SS$_TIMEOUT) return SS$_TIMEOUT;1 errnum = (iosb->iosb_w_status & 0x7fff) >> 3;rH if (errnum > sizeof(errorvec)/sizeof(errorvec[0])) return SS$_ABORT; return errorvec[errnum-1];} /* netlib___cvt_status */0 /***++** ROUTINE: netlib___cvt_iosb**** FUNCTIONAL DESCRIPTION:)**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:;****** SIDE EFFECTS: None.****--*/9static void netlib___cvt_iosb (struct NETLIBIOSBDEF *dst,B0 struct NETLIBIOSBDEF *src) { int errnum;$! switch (src->iosb_w_status) {  case SS$_NORMAL: case SS$_LINKDISCON: case SS$_TIMEOUT:( case SS$_CANCEL:- dst->iosb_w_status = src->iosb_w_status;n break; default:1 errnum = (src->iosb_w_status & 0x7fff) >> 3;F dst->iosb_w_status = D (errnum > sizeof(errorvec)/sizeof(errorvec[0])) ? SS$_ABORT: : errorvec[errnum-1]; } * dst->iosb_w_count = src->iosb_w_count; dst->iosb_l_unused = 0;m} /* netlib___cvt_iosb */  /***++!** ROUTINE: netlib_dns_mx_lookupC**** FUNCTIONAL DESCRIPTION:&**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:d****** SIDE EFFECTS: None.****--*/4unsigned int netlib_dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,K struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm) {* struct CTX *ctx; int argc; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 4) return SS$_INSFARG;n? return netlib___dns_mx_lookup(xctx, namdsc, mxrr, mxrrsize,{; (argc > 4) ? mxrrcount : 0, (argc > 5) ? iosb : 0,R; (argc > 6) ? astadr : 0, (argc > 7) ? astprm : 0);c} /* netlib_dns_mx_lookup */ÿÿtimeout */ /***++** ROUTINE: netlib_shutdown**** FUNCTIONAL DESCRIPTION:t**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.i**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Hunsigned int netlib_shutdown (struct CTX **xctx, unsigned int *shuttypà NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI_SUPPORT.C;11YLvð*[NETLIB]NETLIB_SRI_SUPPORT.C;11+,./€ 4Yä-ç 0ª123KÿPWO56Šî§ðñQ›7b¶ðñQ›89¹AJ(ú›G€HˆªJÿ #ifdef __DECC#pragma module MODULE_NAME#else#module MODULE_NAME#endif/***++** FACILITY: NETLIB**<** ABSTRACT: Routines specific to MultiNet/TCPware/PathWay.**** MODULE DESCRIPTION:**** tbs**** AUTHOR: M. Madison=** COPYRIGHT © 1994, 1995, 1997 MADGOAT SOFTWARE."** ALL RIGHTS RESERVED.**** CREATION DATE: 20-OCT-1994**** MODIFICATION HISTORY:**1** 20-OCT-1994 V1.0 Madison Initial coding.2** 02-AUG-1995 V1.0-1 Madison Fix for PathWay.:** 12-OCT-1995 V1.0-2 Madison Another fix for PathWay.6** 01-JUN-1997 V1.0-3 Madison Another PathWay fix.**--*/#include "netlib_sri.h"#include "netlib.h"#include #include #include #if defined(MULTINET)#include "netlib_multinet.h"#elif defined(TCPWARE)#include "netlib_tcpware.h"#elif defined(PATHWAY)#include "netlib_pathway.h"#endif/*** Forward declarations*/L unsigned int netlib_get_hostname(void *bufdsc, unsigned short *retlenp);: unsigned int netlib___ht_name_to_addr(struct CTX *ctx,D struct dsc$descriptor *namdsc, struct INADDRDEF *addrlist,5 unsigned int listsize, unsigned int *count,% struct NETLIBIOSBDEF *iosb,( void (*astadr), void *astprm);: unsigned int netlib___ht_addr_to_name(struct CTX *ctx,8 struct INADDRDEF *addr, unsigned int addrsize,@ struct dsc$descriptor *bufdsc, unsigned short *retlen,% struct NETLIBIOSBDEF *iosb,( void (*astadr), void *astprm);- int netlib___get_nameservers(QUEUE *nsq);F int netlib___get_domain(char *, unsigned short, unsigned short *);/*** OWN storage*/: static $DESCRIPTOR(nameserver_tabnam, "LNM$FILE_DEV");/*** External references*/P unsigned int netlib___find_symbol(char *imgnam, char *symnam, void *symptr);S unsigned int netlib_strtoaddr(struct dsc$descriptor *dsc, struct INADDRDEF *a); /***++ ** ROUTINE: netlib_get_hostname**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Junsigned int netlib_get_hostname (void *bufdsc, unsigned short *retlenp) { char buf[256]; unsigned int status; unsigned short retlen;$ static int (*gethostname)() = 0; int argc; SETARGCOUNT(argc); if (gethostname == 0) { int i, j;M for (i = 0; i < sizeof(socket_library)/sizeof(socket_library[0]); i++) {S for (j = 0; j < sizeof(gethostname_ent)/sizeof(gethostname_ent[0]); j++) {: status = netlib___find_symbol(socket_library[i],6 gethostname_ent[j], &gethostname); if (OK(status)) break; } }$ if (!OK(status)) return status; }? if ((*gethostname)(buf, sizeof(buf)) < 0) return SS$_ABORT; retlen = strlen(buf);. status = str$copy_r(bufdsc, &retlen, buf);# if (!OK(status)) return status;4 if (argc > 1 && retlenp != 0) *retlenp = retlen; return SS$_NORMAL;} /* netlib_get_hostname */ /***++%** ROUTINE: netlib___ht_name_to_addr**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/7unsigned int netlib___ht_name_to_addr (struct CTX *ctx,D struct dsc$descriptor *bufdsc, struct INADDRDEF *addrlist,5 unsigned int listsize, unsigned int *count,% struct NETLIBIOSBDEF *iosb,) void (*astadr), void *astprm) {  char *namp, name[256]; unsigned short namlen; unsigned int status; struct hostent *hp;3 static struct hostent *(*_gethostbyname)() = 0; int argc, i, j;2 if (lib$ast_in_prog()) return SS$_UNSUPPORTED; SETARGCOUNT(argc);7 status = lib$analyze_sdesc(bufdsc, &namlen, &namp);# if (!OK(status)) return status;9 if (namlen > sizeof(name)-1) namlen = sizeof(name)-1; memcpy(name, namp, namlen); name[namlen] = '\0'; if (_gethostbyname == 0) {M for (i = 0; i < sizeof(socket_library)/sizeof(socket_library[0]); i++) {Y for (j = 0; j < sizeof(_gethostbyname_ent)/sizeof(_gethostbyname_ent[0]); j++) {: status = netlib___find_symbol(socket_library[i],< _gethostbyname_ent[j], &_gethostbyname); if (OK(status)) break; } }$ if (!OK(status)) return status; }! hp = (*_gethostbyname)(name);& if (hp == 0) return SS$_ENDOFFILE;O for (i = 0, j = 0; (j < listsize) && (hp->h_addr_list[i] != 0); i++, j++) {> addrlist[j] = *((struct INADDRDEF *) hp->h_addr_list[i]); }+ if (argc > 4 && count != 0) *count = j; if (argc > 5 && iosb != 0) {& iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = j; iosb->iosb_l_unused = 0; }P if (argc > 6 && astadr != 0) sys$dclast(astadr, (argc > 7) ? astprm : 0, 0); return SS$_NORMAL; } /* netlib___ht_name_to_addr */ /***++%** ROUTINE: netlib___ht_addr_to_name**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/7unsigned int netlib___ht_addr_to_name (struct CTX *ctx,8 struct INADDRDEF *addr, unsigned int addrsize,@ struct dsc$descriptor *bufdsc, unsigned short *retlen,% struct NETLIBIOSBDEF *iosb,) void (*astadr), void *astprm) { unsigned int status; unsigned short len; struct hostent *hp;3 static struct hostent *(*_gethostbyaddr)() = 0; int argc;2 if (lib$ast_in_prog()) return SS$_UNSUPPORTED; SETARGCOUNT(argc); if (_gethostbyaddr == 0) { int i, j;M for (i = 0; i < sizeof(socket_library)/sizeof(socket_library[0]); i++) {Y for (j = 0; j < sizeof(_gethostbyaddr_ent)/sizeof(_gethostbyaddr_ent[0]); j++) {: status = netlib___find_symbol(socket_library[i],< _gethostbyaddr_ent[j], &_gethostbyaddr); if (OK(status)) break; } }$ if (!OK(status)) return status; }= hp = (*_gethostbyaddr)(addr, addrsize, NETLIB_K_AF_INET);& if (hp == 0) return SS$_ENDOFFILE; len = strlen(hp->h_name);2 status = str$copy_r(bufdsc, &len, hp->h_name);# if (!OK(status)) return status;/ if (argc > 4 && retlen != 0) *retlen = len; if (argc > 5 && iosb != 0) {& iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = len; iosb->iosb_l_unused = 0; }P if (argc > 6 && astadrà NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI_SUPPORT.C;11YÑï != 0) sys$dclast(astadr, (argc > 7) ? astprm : 0, 0); return SS$_NORMAL; } /* netlib___ht_addr_to_name */ /***++%** ROUTINE: netlib___get_nameservers**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/+int netlib___get_nameservers (QUEUE *nsq) { struct NAMESERVER *ns; struct INADDRDEF a;) struct dsc$descriptor dsc, lognamdsc; ITMLST lnmlst[4];! char name[256], *cp, *anchor;& unsigned int status, size, maxidx; unsigned short namlen; int index, i, remain;< static unsigned int ns_size = sizeof(struct NAMESERVER);/ static $DESCRIPTOR(localhost, "127.0.0.1");A ITMLST_INIT(lnmlst[0], LNM$_INDEX, sizeof(index), &index, 0);E ITMLST_INIT(lnmlst[1], LNM$_STRING, sizeof(name), name, &namlen);G ITMLST_INIT(lnmlst[2], LNM$_MAX_INDEX, sizeof(maxidx), &maxidx, 0);' ITMLST_INIT(lnmlst[3], 0, 0, 0, 0);#ifdef PATHWAY/*F** For PathWay, we're only supposed to use DNS if INET_DOMAIN_NAME is ** defined*/@ INIT_SDESC(dsc, strlen(domain_lognam[0]), domain_lognam[0]);F if (!OK(sys$trnlnm(0, &nameserver_tabnam, &dsc, 0, &lnmlst[3]))) { return 0; }#endif /* PATHWAY */R for (i = 0; i < sizeof(nameserver_lognam)/sizeof(nameserver_lognam[0]); i++) {O INIT_SDESC(lognamdsc, strlen(nameserver_lognam[i]), nameserver_lognam[i]);K status = sys$trnlnm(0, &nameserver_tabnam, &lognamdsc, 0, &lnmlst[2]); if (OK(status)) break; } if (!OK(status)) {#ifdef PATHWAY/*C** For PathWay, if INET_NAMESERVER_LIST is not defined at all, butB** INET_DOMAIN_NAME is defined, we're supposed to assume that the** server is the local host.*/( status = lib$get_vm(&ns_size, &ns); if (OK(status)) {K netlib_strtoaddr((struct dsc$descriptor *) &localhost, &ns->addr);% queue_insert(ns, nsq->tail); return 1; }#endif /* PATHWAY */ return 0; }' ITMLST_INIT(lnmlst[2], 0, 0, 0, 0);/ for (index = 0; index <= maxidx; index++) {G status = sys$trnlnm(0, &nameserver_tabnam, &lognamdsc, 0, lnmlst);+ if (!OK(status) || namlen == 0) break;5 for (anchor = name, remain = namlen; remain > 0;8 remain -= i+1, anchor = cp+1) {/*8** PathWay separates addresses with blanks, not commas.*/* cp = memchr(anchor, ',', remain);7 if (cp == 0) cp = memchr(anchor, ' ', remain);! if (cp == 0) i = remain; else i = cp - anchor;$ INIT_SDESC(dsc, i, anchor);/*E** PathWay uses 0.0.0.0 in place of 127.0.0.1 to refer to the server** running on the local host.*/; if (i == 7 && memcmp(anchor, "0.0.0.0", i) == 0) {E netlib_strtoaddr((struct dsc$descriptor *) &localhost, &a); } else {8 if (!OK(netlib_strtoaddr(&dsc, &a))) continue; }, status = lib$get_vm(&ns_size, &ns); if (!OK(status)) break; ns->addr = a;% queue_insert(ns, nsq->tail); } } return index; } /* netlib___get_nameservers */ /***++ ** ROUTINE: netlib___get_domain**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Uint netlib___get_domain (char *buf, unsigned short bufsize, unsigned short *retlen) {) struct dsc$descriptor dsc, lognamdsc; ITMLST lnmlst[2]; char name[256], *cp; unsigned int status; unsigned short namlen; int i;E ITMLST_INIT(lnmlst[0], LNM$_STRING, sizeof(name), name, &namlen);' ITMLST_INIT(lnmlst[1], 0, 0, 0, 0);J for (i = 0; i < sizeof(domain_lognam)/sizeof(domain_lognam[0]); i++) {G INIT_SDESC(lognamdsc, strlen(domain_lognam[i]), domain_lognam[i]);G status = sys$trnlnm(0, &nameserver_tabnam, &lognamdsc, 0, lnmlst); if (OK(status)) { cp = name; break; } } if (!OK(status)) {) INIT_SDESC(dsc, sizeof(name), name);; if (!OK(netlib_get_hostname(&dsc, &namlen))) return 0;$ cp = memchr(name, '.', namlen); if (cp == 0) return 0; cp += 1; namlen -= (cp - name); }/ if (memchr(cp, '.', namlen) == 0) return 0;/ if (namlen > bufsize-1) namlen = bufsize-1; memcpy(buf, cp, namlen); *retlen = namlen; return 1;} /* netlib___get_domain */ÿÿà   NETLIB_SRC.BCKç [NETLIB]NETLIB_UCX.C;46Wbèð*[NETLIB]NETLIB_UCX.C;46+,.b/€ 4Wb_à-ç 0ª123KÿPWO`56(g…zbY›72O¢zbY›89¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**'** ABSTRACT: Routines specific to UCX.**** MODULE DESCRIPTION:**** tbs**** AUTHOR: M. MadisonC** COPYRIGHT © 1994, 1995, 1996, 1997 MADGOAT SOFTWARE."** ALL RIGHTS RESERVED.**** CREATION DATE: 26-OCT-1994**** MODIFICATION HISTORY:**1** 26-OCT-1994 V1.0 Madison Initial coding.E** 09-JAN-1995 V1.0-1 Madison Fix some missing args on some QIOs.C** 19-JAN-1995 V1.0-2 Madison Handle 0-length writes specially.B** 28-FEB-1995 V1.0-3 Madison Fix missing arg on $DCLAST call.A** 24-JUL-1995 V1.0-4 Madison Fix netlib___get_nameservers().<** 13-OCT-1995 V1.0-5 Madison Free IORs on $QIO failure.D** 11-FEB-1996 V1.0-6 Madison Fix argc check in netlib_shutdown.L** 01-JUN-1997 V1.0-7 Madison Use a flag to indicate a timeout happened.C** 10-JUN-1997 V1.0-8 Goatley Fix dumb netlib___cvt_status bug.**--*/#include "netlib_ucx.h"#include "netlib.h"#include /*3** We don't actually do any cond_value conversions%** because we're using the UCX ones.*/;#define netlib___cvt_status(_iosb) ((_iosb)->iosb_w_status)(#define netlib___cvt_iosb(_dst, _src) {\8 (_dst)->iosb_w_status = (_src)->iosb_w_status;\7 (_dst)->iosb_w_count = (_src)->iosb_w_count;\$ (_dst)->iosb_l_unused = 0;}/*@** This is so we don't need UCX$IPC.OLB when we link with VAX C*/ #ifdef __DECC$#define gethostname decc$gethostname#else$#define gethostname vaxc$gethostname#endif/*** Forward declarations*/E unsigned int netlib_socket(struct CTX **xctx, unsigned int *type,* unsigned int *family);J unsigned int netlib_server_setup(struct CTX **xctx, struct SINDEF *sa,) unsigned int *salen);B unsigned int netlib_bind(struct CTX **xctx, struct SINDEF *sa,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);7 static unsigned int io_completion(struct IOR *ior);H unsigned int netlib_getsockname(struct CTX **ctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);H unsigned int netlib_getpeername(struct CTX **ctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);D unsigned int netlib_connect(struct CTX **ctx, struct SINDEF *sa,) unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);K unsigned int netlib_write(struct CTX **ctx, struct dsc$descriptor *dsc,: struct SINDEF *sa, unsigned int *salen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);J unsigned int netlib_read(struct CTX **ctx, struct dsc$descriptor *dsc,; struct SINDEF *sa, unsigned int *sasize,2 unsigned int *salen, TIME *tmo,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);4 static unsigned int io_timeout(struct IOR *ior);K unsigned int netlib_shutdown(struct CTX **xctx, unsigned int *shuttype,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);1 unsigned int netlib_close(struct CTX **xctx);H unsigned int netlib_listen(struct CTX **xctx, unsigned int *backlog,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);F unsigned int netlib_accept(struct CTX **ctx, struct CTX **xnewctx,; struct SINDEF *sa, unsigned int *sasize,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);5 unsigned int netlib_setsockopt(struct CTX **xctx,= unsigned int *level, unsigned int *option,5 void *value, unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);5 unsigned int netlib_getsockopt(struct CTX **xctx,= unsigned int *level, unsigned int *option,6 void *value, unsigned int *valsize,( unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);P unsigned int netlib_name_to_address(struct CTX **xctx, unsigned int *whichp,1 struct dsc$descriptor *namdsc,. struct INADDRDEF *addrlist,? unsigned int *listsize, unsigned int *count,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);P unsigned int netlib_address_to_name(struct CTX **xctx, unsigned int *whichp,* struct INADDRDEF *addr,* unsigned int *addrsize,1 struct dsc$descriptor *namdsc,* unsigned short *retlen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);L unsigned int netlib_get_hostname(void *bufdsc, unsigned short *retlenp);- int netlib___get_nameservers(QUEUE *nsq);W int netlib___get_domain(char *buf, unsigned short bufsize, unsigned short *retlen);8 unsigned int netlib_dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);/*** OWN storage*/1 static $DESCRIPTOR(inetdevice, "UCX$DEVICE");: static $DESCRIPTOR(nameserver_tabnam, "LNM$FILE_DEV");> static unsigned int hostent_size = sizeof(struct HOSTENT);/*** External references*/O unsigned int netlib_strtoaddr(struct dsc$descriptor *, struct INADDRDEF *);! int gethostname(void *, int);: unsigned int netlib___dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm); /***++** ROUTINE: netlib_socket**** FUNCTIONAL DESCRIPTION:**** Create a "socket".**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Bunsigned int netlib_socket (struct CTX **xctx, unsigned int *type,+ unsigned int *family) { struct CTX *ctx; struct NETLIBIOSBDEF myiosb; struct { unsigned short protocol; unsigned char type; unsigned char domain; } sockdef; unsigned int status, af, ty; int arà! NETLIB_SRC.BCKç [NETLIB]NETLIB_UCX.C;46Wbu€gc; SETARGCOUNT(argc);% if (argc < 1) return SS$_INSFARG;4 status = netlib___alloc_ctx(&ctx, SPECCTX_SIZE);# if (!OK(status)) return status;7 status = sys$assign(&inetdevice, &ctx->chan, 0, 0); if (!OK(status)) { netlib___free_ctx(ctx); return status; }K sockdef.type = (argc >= 2 && type != 0) ? *type : NETLIB_K_TYPE_STREAM;M sockdef.domain = (argc >= 3 && family != 0) ? *family : NETLIB_K_AF_INET;H sockdef.protocol = (sockdef.type == NETLIB_K_TYPE_DGRAM) ? UCX$C_UDP4 : UCX$C_TCP;? status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETMODE, &myiosb, 0, 0,( &sockdef, 0, 0, 0, 0, 0);: if (OK(status)) status = netlib___cvt_status(&myiosb); if (!OK(status)) { sys$dassgn(ctx->chan); netlib___free_ctx(ctx); return status; } *xctx = ctx; return SS$_NORMAL;} /* netlib_socket */ /***++ ** ROUTINE: netlib_server_setup**** FUNCTIONAL DESCRIPTION:**** Create a "server_setup".**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Gunsigned int netlib_server_setup (struct CTX **xctx, struct SINDEF *sa,/ unsigned int *salen) { struct CTX *ctx; struct NETLIBIOSBDEF myiosb; struct { unsigned short protocol; unsigned char type; unsigned char domain; } sockdef; unsigned int status;* static $DESCRIPTOR(device, "SYS$NET");4 status = netlib___alloc_ctx(&ctx, SPECCTX_SIZE);# if (!OK(status)) return status;3 status = sys$assign(&device, &ctx->chan, 0, 0); if (!OK(status)) { netlib___free_ctx(ctx); return status; }! sockdef.protocol = UCX$C_TCP;( sockdef.type = INET_PROTYP$C_STREAM; sockdef.domain = UCX$C_AUXS;? status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETMODE, &myiosb, 0, 0,( &sockdef, 0, 0, 0, 0, 0);: if (OK(status)) status = netlib___cvt_status(&myiosb); if (!OK(status)) { sys$dassgn(ctx->chan); netlib___free_ctx(ctx); return status; } *xctx = ctx; return SS$_NORMAL;} /* netlib_server_setup */ /***++** ROUTINE: netlib_bind**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/?unsigned int netlib_bind (struct CTX **xctx, struct SINDEF *sa,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; ITMLST2 sockdsc; int argc; static unsigned int one = 1; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 3) return SS$_INSFARG;3 if (sa == 0 || salen == 0) return SS$_BADPARAM;< if (*salen < sizeof(struct SINDEF)) return SS$_BADPARAM;3 if (!(ctx->flags & CTX_M_USER_SET_REUSEADDR)) { ITMLST2 rulst, sockopt;C ITMLST2_INIT(rulst, UCX$C_SOCKOPT, sizeof(sockopt), &sockopt);I ITMLST2_INIT(sockopt, NETLIB_K_OPTION_REUSEADDR, sizeof(one), &one);@ sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETMODE, 0, 0, 0,% 0, 0, 0, 0, &rulst, 0); }) ITMLST2_INIT(sockdsc, 0, *salen, sa);" if (argc > 4 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);L status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SETMODE, &ior->iosb,@ io_completion, ior, 0, 0, &sockdsc, 0, 0, 0);$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;I status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETMODE, &myiosb,2 0, 0, 0, 0, &sockdsc, 0, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);A if (argc > 3 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); } return status;} /* netlib_bind */ /***++** ROUTINE: io_completion**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/5static unsigned int io_completion (struct IOR *ior) { struct CTX *ctx = ior->ctx;( ior->iorflags |= IOR_M_IO_COMPLETED;; if (ior->iorflags & IOR_M_IO_TIMED) sys$cantim(ior, 0);T if (ior->iosb.iosb_w_status == SS$_CANCEL && (ior->iorflags & IOR_M_IO_TIMEOUT))+ ior->iosb.iosb_w_status = SS$_TIMEOUT;C if (ior->iosbp != 0) netlib___cvt_iosb(ior->iosbp, &ior->iosb);, if (ior->iorflags & IOR_M_COPY_LENGTH) {> if (OK(ior->iosb.iosb_w_status) && ior->spec_retlen != 0)@ *(unsigned int *) ior->spec_retlen = ior->spec_length;) ior->iorflags &= ~IOR_M_COPY_LENGTH; }* if (ior->iorflags & IOR_M_COPY_FROM) {B if (OK(ior->iosb.iosb_w_status) && ior->spec_userfrom != 0) { unsigned int len;$ len = ior->specior.fromlen;< if (len > ior->spec_length) len = ior->spec_length;= memcpy(ior->spec_userfrom, &ior->specior.from, len);L if (ior->spec_retlen != 0) *(unsigned int *)ior->spec_retlen = len; }( ior->iorflags &= ~IOR_M_COPY_FROM; }+ if (ior->iorflags & IOR_M_COPY_ADDRS) { struct HOSTENT *h; h = ior->spec_hostent;' if (OK(ior->iosb.iosb_w_status)) { char *base; unsigned int *offlst; int i; base = (char *) h; i = 0;' if (h->addrlist_offset != 0) {8 struct INADDRDEF *alist = ior->spec_useralist;> offlst = (unsigned int *) (base+h->addrlist_offset);: while (i < ior->spec_length && offlst[i] != 0) {B alist[i] = *(struct INADDRDEF *) (base + offlst[i]); i++; } }J if (ior->spec_retlen != 0) *(unsigned int *)ior->spec_retlen = i; }$ lib$free_vm(&hostent_size, &h);( ior->iorflags &= ~IOR_M_COPY_ADDRS; }. if (ior->iorflags & IOR_M_COPY_HOSTNAME) { struct HOSTENT *h; h = ior->spec_hostent;' if (OK(ior->iosb.iosb_w_status)) {< str$copy_r(ior->spec_usrdsc, &ior->specior.fromlen,$ h->buffer);# if (ior->spec_retlen != 0)/ *(unsigned short *)ior->spec_retlen =3 ior->specior.fromlen; }$ lib$free_vm(&hostent_size, &h);+ ior->iorflags &= ~IOR_M_COPY_HOSTNAME; }, if (ior->iorflags & IOR_M_NEW_CONTEXT) {' if (OK(ior->iosb.iosb_w_status)) {? *(struct CTX **) ior->spec_xnewctx = ior->spec_newctx; } else {< sys$dassgn(((struct CTX *)ior->spec_newctx)->chan);< netlib___free_ctx((struct CTX *) ior->spec_newctx); }, ior->iorflags &= ~IOR_M_NEW_CONTEXT; }8 if (ior->astadr != 0) (*(ior->astadr))(ior->astprm); FREE_IOR(ior); return SS$_NORMAL;} /* io_completion */ /***++** ROUTINE: netlib_getsockname**** FUNCTIONAL DESCRIPTION:**** tbs**B** à" NETLIB_SRC.BCKç [NETLIB]NETLIB_UCX.C;46WbÑjRETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Funsigned int netlib_getsockname (struct CTX **xctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; ITMLST slst; int argc; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);4 if (sa == 0 || sasize == 0) return SS$_BADPARAM;" if (argc > 5 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0);: ITMLST_INIT(slst, 0, *sasize, sa, &ior->spec_length); ior->spec_retlen = salen;' ior->iorflags = IOR_M_COPY_LENGTH;N status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SENSEMODE, &ior->iosb,= io_completion, ior, 0, 0, &slst, 0, 0, 0);$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb; unsigned short length;0 ITMLST_INIT(slst, 0, *sasize, sa, &length);B status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SENSEMODE, &myiosb,/ 0, 0, 0, 0, &slst, 0, 0, 0);1 if (argc > 3 && salen != 0) *salen = length;; if (OK(status)) status = netlib___cvt_status(&myiosb);A if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);  }T return status;} /* netlib_getsockname */ N/***++** ROUTINE: netlib_getpeernamea**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.n**** COMPLETION CODES:-****** SIDE EFFECTS: None.****--*/Funsigned int netlib_getpeername (struct CTX **xctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,$0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) { struct CTX *ctx; ITMLST slst; unsigned int status; int argc;c VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 3) return SS$_INSFARG;p4 if (sa == 0 || sasize == 0) return SS$_BADPARAM;" if (argc > 5 && astadr != 0) { struct IOR *ior;i> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0);: ITMLST_INIT(slst, 0, *sasize, sa, &ior->spec_length); ior->spec_length = *sasize; ior->spec_retlen = salen;' ior->iorflags = IOR_M_COPY_LENGTH;(N status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SENSEMODE, &ior->iosb,= io_completion, ior, 0, 0, 0, &slst, 0, 0);d$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;h unsigned short length;d0 ITMLST_INIT(slst, 0, *sasize, sa, &length);B status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SENSEMODE,8 &myiosb, 0, 0, 0, 0, 0, &slst, 0, 0);1 if (argc > 3 && salen != 0) *salen = length;i; if (OK(status)) status = netlib___cvt_status(&myiosb); A if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);) }  return status;} /* netlib_getpeername */ E/***++** ROUTINE: netlib_connect **** FUNCTIONAL DESCRIPTION:b**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.s**** COMPLETION CODES:s****** SIDE EFFECTS: None.****--*/Bunsigned int netlib_connect (struct CTX **xctx, struct SINDEF *sa,) unsigned int *salen,i0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; ITMLST2 sname; int argc;  VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);3 if (sa == 0 || salen == 0) return SS$_BADPARAM;,< if (*salen < sizeof(struct SINDEF)) return SS$_BADPARAM;' ITMLST2_INIT(sname, 0, *salen, sa); $ if (argc > 4 && astadr != 0) {  struct IOR *ior;n> GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);K status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_ACCESS, &ior->iosb,r> io_completion, ior, 0, 0, &sname, 0, 0, 0);$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;sH status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_ACCESS, &myiosb,0 0, 0, 0, 0, &sname, 0, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);vA if (argc > 3 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);t }  return status;} /* netlib_connect */ /***++** ROUTINE: netlib_write**** FUNCTIONAL DESCRIPTION:O**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.a**** COMPLETION CODES:s****** SIDE EFFECTS: None.****--*/Iunsigned int netlib_write (struct CTX **xctx, struct dsc$descriptor *dsc,*: struct SINDEF *sa, unsigned int *salen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; void *bufptr;a unsigned int status; unsigned short buflen; ITMLST2 sname, *snaddr; int argc;l VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);6 status = lib$analyze_sdesc(dsc, &buflen, &bufptr);# if (!OK(status)) return status; ! if (argc > 3 && salen != 0) {( ITMLST2_INIT(sname, 0, *salen, sa); snaddr = &sname;  } else snaddr = 0;" if (argc > 5 && astadr != 0) { struct IOR *ior; > GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0); if (buflen == 0) {c. ior->iosb.iosb_w_status = SS$_NORMAL;$ ior->iosb.iosb_w_count = 0;% ior->iosb.iosb_l_unused = 0;C4 status = sys$dclast(io_completion, ior, 0); } else {iF status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_WRITEVBLK, &ior->iosb,> io_completion, ior, bufptr, buflen, snaddr, 0, 0, 0);( if (!OK(status)) FREE_IOR(ior); } } else {! struct NETLIBIOSBDEF myiosb;e if (buflen == 0) { 4 status = myiosb.iosb_w_status = SS$_NORMAL;! myiosb.iosb_w_count = 0; " myiosb.iosb_l_unused = 0; } else { F status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_WRITEVBLK,9 &myiosb, 0, 0, bufptr, buflen, snaddr, 0, 0, 0);? if (OK(status)) status = netlib___cvt_status(&myiosb);_ }A if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);g }r return status;} /* netlib_write */ d/***++** ROUTINE: netlib_read**** FUNCTIONAL DESCRIPTION:c**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.***** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Hunsigned int netlib_read (struct CTX **xctx, struct dsc$descriptor *dsc,; struct SINDEF *sa, unsigned int *sasize,n6 unsigned int *salen, TIME *timeout,. à# NETLIB_SRC.BCKç [NETLIB]NETLIB_UCX.C;46WbLó- struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; struct IOR *ior; unsigned int status; ITMLST sname;c int argc, do_from; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);E if (dsc->dsc$b_dtype != DSC$K_DTYPE_T && dsc->dsc$b_dtype != 0) {p return SS$_BADPARAM;T }tE if (dsc->dsc$b_class != DSC$K_CLASS_S && dsc->dsc$b_class != 0) { return SS$_BADPARAM;u }wC do_from = (argc > 3 && sa != 0 && sasize != 0 && *sasize != 0);" if (argc > 7 && astadr != 0) { struct IOR *ior;o> GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0);> if (do_from) ITMLST_INIT(sname, 0, sizeof(struct SINDEF),9 &ior->specior.from, &ior->specior.fromlen);a if (do_from) {t! ior->spec_userfrom = sa;F$ ior->spec_length = *sasize;" ior->spec_retlen = salen;) ior->iorflags = IOR_M_COPY_FROM;  } else ior->iorflags = 0; if (timeout != 0) {) ior->iorflags |= IOR_M_IO_TIMED;cJ status = sys$setimr(netlib_asynch_efn, timeout, io_timeout, ior); if (!OK(status)) {r FREE_IOR(ior); return status; } }M status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_READVBLK, &ior->iosb, : io_completion, ior, dsc->dsc$a_pointer,E dsc->dsc$w_length, do_from ? &sname : 0, 0, 0, 0);0 if (!OK(status)) {_. if (timeout != 0) sys$cantim(ior, 0); FREE_IOR(ior);X } } else {! struct NETLIBIOSBDEF myiosb;C struct SINDEF from; unsigned short fromlen; int timed_out; > if (do_from) ITMLST_INIT(sname, 0, sizeof(struct SINDEF), &from, &fromlen);t timed_out = 0;b$ if (argc > 5 && timeout != 0) {$ GET_IOR(ior, ctx, 0, 0, 0);( ior->iorflags = IOR_M_IO_TIMED;J status = sys$setimr(netlib_asynch_efn, timeout, io_timeout, ior); if (!OK(status)) {_ FREE_IOR(ior); return status; } }A status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_READVBLK, ! &myiosb, 0, 0,9 dsc->dsc$a_pointer, dsc->dsc$w_length,C2 do_from ? &sname : 0, 0, 0, 0);$ if (argc > 5 && timeout != 0) { sys$cantim(ior, 0);6 timed_out = ior->iorflags & IOR_M_IO_TIMEOUT; FREE_IOR(ior);g } if (OK(status)) {= if (timed_out && myiosb.iosb_w_status == SS$_CANCEL) - myiosb.iosb_w_status = SS$_TIMEOUT; / status = netlib___cvt_status(&myiosb);e }A if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);! if (OK(status) && do_from) {c unsigned int len; len = fromlen;s* if (len > *sasize) len = *sasize; memcpy(sa, &from, len);2 if (argc > 4 && salen != 0) *salen = len; } } return status;} /* netlib_read */e y/***++** ROUTINE: io_timeoutk**** FUNCTIONAL DESCRIPTION:t**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.y**** COMPLETION CODES:)****** SIDE EFFECTS: None.****--*/2static unsigned int io_timeout (struct IOR *ior) {> if (ior->iorflags & IOR_M_IO_COMPLETED) return SS$_NORMAL;& ior->iorflags |= IOR_M_IO_TIMEOUT;& return sys$cancel(ior->ctx->chan);} /* io_timeout */ :/***++** ROUTINE: netlib_shutdown**** FUNCTIONAL DESCRIPTION::**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.(**** COMPLETION CODES:I****** SIDE EFFECTS: None.****--*/Hunsigned int netlib_shutdown (struct CTX **xctx, unsigned int *shuttype,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc;  VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);" if (argc > 3 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 4) ? astprm : 0);O status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_DEACCESS|IO$M_SHUTDOWN,;< &ior->iosb, io_completion, ior, 0, 0, 0, : (shuttype == 0) ? 0 : *shuttype, 0, 0);$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb; 3 status = sys$qiow(netlib_synch_efn, ctx->chan,7 IO$_DEACCESS|IO$M_SHUTDOWN, &myiosb,c! 0, 0, 0, 0, 0, F (argc > 1 && shuttype != 0) ? *shuttype : 0, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);EA if (argc > 2 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);o }0 return status;} /* netlib_shutdown */  /***++** ROUTINE: netlib_closeo**** FUNCTIONAL DESCRIPTION:i**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.s**** COMPLETION CODES:o****** SIDE EFFECTS: None.****--*//unsigned int netlib_close (struct CTX **xctx) {_ struct CTX *ctx; unsigned int status; VERIFY_CTX(xctx, ctx);# status = sys$dassgn(ctx->chan);y# if (!OK(status)) return status;* netlib___free_ctx(ctx);: *xctx = 0; return SS$_NORMAL;} /* netlib_close */ */***++** ROUTINE: netlib_listen**** FUNCTIONAL DESCRIPTION:c**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.(**** COMPLETION CODES:S****** SIDE EFFECTS: None.****--*/Eunsigned int netlib_listen (struct CTX **xctx, unsigned int *backlog,). struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc;  VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);" if (argc > 3 && astadr != 0) { struct IOR *ior; > GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);L status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SETMODE, &ior->iosb,0 io_completion, ior, 0, 0, 0, 8 (backlog == 0) ? 4 : *backlog, 0, 0);$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;(I status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETMODE, &myiosb,O! 0, 0, 0, 0, 0,oD (argc > 1 && backlog != 0) ? *backlog : 4, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb); A if (argc > 2 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);i } return status;} /* netlib_listen */ /***++** ROUTINE: netlib_accept**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.D**** COMPLETION CODES:;****** SIDE EFFECTS: None.****--*/Dunsigned int netlib_accept (struct CTX **xctx, struct CTX **xnewctx,; struct SINDEF *sa, unsigned int *sasize,oC unsigned int *salen, struct NETLIBIOSBDEF *iosb,_4 void (*asà$ NETLIB_SRC.BCKç [NETLIB]NETLIB_UCX.C;46Wbšÿ<tadr)(), void *astprm) { struct CTX *ctx, *newctx;( ITMLST sname;a unsigned int status; int argc;s VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;e* if (xnewctx == 0) return SS$_BADPARAM;7 status = netlib___alloc_ctx(&newctx, SPECCTX_SIZE);r# if (!OK(status)) return status;&: status = sys$assign(&inetdevice, &newctx->chan, 0, 0); if (!OK(status)) { netlib___free_ctx(newctx);{ return status;s }w" if (argc > 6 && astadr != 0) { struct IOR *ior;o> GET_IOR(ior, ctx, iosb, astadr, (argc > 7) ? astprm : 0);1 ior->spec_userfrom = (sasize == 0) ? 0 : sa;r4 ior->spec_length = (sasize == 0) ? 0 : *sasize; ior->spec_retlen = salen;! ior->spec_xnewctx = xnewctx;t ior->spec_newctx = newctx;s1 ITMLST_INIT(sname, 0, sizeof(struct SINDEF),A5 &ior->specior.from, &ior->specior.fromlen);:7 ior->iorflags = IOR_M_COPY_FROM|IOR_M_NEW_CONTEXT;*K status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_ACCESS|IO$M_ACCEPT,v2 &ior->iosb, io_completion, ior,6 0, 0, &sname, &newctx->chan, 0, 0);$ if (!OK(status)) FREE_IOR(ior); } else { struct SINDEF from;! struct NETLIBIOSBDEF myiosb;c unsigned short fromlen;1 ITMLST_INIT(sname, 0, sizeof(struct SINDEF),e &from, &fromlen); K status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_ACCESS|IO$M_ACCEPT,i' &myiosb, 0, 0, 0, 0,n0 &sname, &newctx->chan, 0, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb); A if (argc > 5 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);> if (OK(status)) { *xnewctx = newctx;T2 if (argc > 3 && sa != 0 && sasize != 0) { unsigned int len;  len = fromlen;+ if (len > *sasize) len = *sasize;i! memcpy(sa, &from, len);3 if (argc > 4 && salen != 0) *salen = len;O } } }  return status;} /* netlib_accept */t ,/***++** ROUTINE: netlib_setsockopt**** FUNCTIONAL DESCRIPTION:E**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/2unsigned int netlib_setsockopt (struct CTX **xctx,= unsigned int *level, unsigned int *option, 5 void *value, unsigned int *vallen, . struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status, lev;* ITMLST2 optdsc;, int argc;g VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG;*F if (option == 0 || value == 0 || vallen == 0) return SS$_BADPARAM;0 if (level == 0) lev = NETLIB_K_LEVEL_SOCKET; else lev = *level;O if (lev == NETLIB_K_LEVEL_SOCKET && *option == NETLIB_K_OPTION_REUSEADDR) {g, ctx->flags |= CTX_M_USER_SET_REUSEADDR; }O" if (argc > 6 && astadr != 0) { struct IOR *ior;t> GET_IOR(ior, ctx, iosb, astadr, (argc > 7) ? astprm : 0);A ITMLST2_INIT(ior->specior.sockopt, *option, *vallen, value);O ITMLST2_INIT(optdsc,<> (lev == NETLIB_K_LEVEL_SOCKET) ? UCX$C_SOCKOPT : lev,> sizeof(ior->specior.sockopt), &ior->specior.sockopt);L status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SETMODE, &ior->iosb,? io_completion, ior, 0, 0, 0, 0, &optdsc, 0);i$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;C ITMLST2 sockopt;u4 ITMLST2_INIT(sockopt, *option, *vallen, value); ITMLST2_INIT(optdsc, > (lev == NETLIB_K_LEVEL_SOCKET) ? UCX$C_SOCKOPT : lev,$ sizeof(sockopt), &sockopt);@ status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETMODE,: &myiosb, 0, 0, 0, 0, 0, 0, &optdsc, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb); A if (argc > 5 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);g }& return status;} /* netlib_setsockopt */) a/***++** ROUTINE: netlib_getsockopt**** FUNCTIONAL DESCRIPTION:b**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:n****** SIDE EFFECTS: None.****--*/2unsigned int netlib_getsockopt (struct CTX **xctx,= unsigned int *level, unsigned int *option,s6 void *value, unsigned int *valsize,( unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status, lev;i ITMLST2 optdsc;u int argc;  VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG;EG if (option == 0 || value == 0 || valsize == 0) return SS$_BADPARAM;0 if (level == 0) lev = NETLIB_K_LEVEL_SOCKET; else lev = *level;" if (argc > 7 && astadr != 0) { struct IOR *ior; > GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0);= ITMLST_INIT(ior->specior.sockopt_get, *option, *valsize,y) value, &ior->spec_length);r ITMLST2_INIT(optdsc,p> (lev == NETLIB_K_LEVEL_SOCKET) ? UCX$C_SOCKOPT : lev,F sizeof(ior->specior.sockopt_get), &ior->specior.sockopt_get); ior->spec_retlen = vallen;x' ior->iorflags = IOR_M_COPY_LENGTH; N status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SENSEMODE, &ior->iosb,? io_completion, ior, 0, 0, 0, 0, 0, &optdsc);i$ if (!OK(status)) FREE_IOR(ior); } else { ITMLST sockopt_get;! struct NETLIBIOSBDEF myiosb;r unsigned short length;RA ITMLST_INIT(sockopt_get, *option, *valsize, value, &length);e ITMLST2_INIT(optdsc,*> (lev == NETLIB_K_LEVEL_SOCKET) ? UCX$C_SOCKOPT : lev,, sizeof(sockopt_get), &sockopt_get);B status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SENSEMODE,: &myiosb, 0, 0, 0, 0, 0, 0, 0, &optdsc);; if (OK(status)) status = netlib___cvt_status(&myiosb);iA if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); A if (OK(status) && argc > 5 && vallen != 0) *vallen = length; }d return status;} /* netlib_getsockopt */s t/***++#** ROUTINE: netlib_name_to_address **** FUNCTIONAL DESCRIPTION:x**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.,**** COMPLETION CODES:d****** SIDE EFFECTS: None.****--*/Munsigned int netlib_name_to_address (struct CTX **xctx, unsigned int *whichp,a1 struct dsc$descriptor *namdsc,=. struct INADDRDEF *addrlist,? unsigned int *listsize, unsigned int *count,i. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; struct INADDRDEF addr; struct NETLIBIOSBDEF myiosb; struct HOSTENT hostent;o% unsigned int status, subfunction; ITMLST2 subfdsc; ITMLST2 entdsc;! unsigned short helen; int argc;l VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSà% NETLIB_SRC.BCKç [NETLIB]NETLIB_UCX.C;46WbfKFARG;sK if (namdsc == 0 || addrlist == 0 || listsize == 0) return SS$_BADPARAM;o. if (OK(netlib_strtoaddr(namdsc, &addr))) { addrlist[0] = addr;, if (argc > 5 && count != 0) *count = 1;! if (argc > 6 && iosb != 0) {n* iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = 1;! iosb->iosb_l_unused = 0;  }# if (argc > 7 && astadr != 0) {s? return sys$dclast(astadr, (argc > 8) ? astprm : 0, 0);r } else { return SS$_NORMAL;d } }I" if (argc > 7 && astadr != 0) { struct IOR *ior;,> GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0);< status = lib$get_vm(&hostent_size, &ior->spec_hostent); if (!OK(status)) {  FREE_IOR(ior);* return status;n } ior->specior.subfunction =dH (INETACP$C_HOSTENT_OFFSET << 8) | INETACP_FUNC$C_GETHOSTBYNAME;? ITMLST2_INIT(subfdsc, 0, sizeof(ior->specior.subfunction),n) &ior->specior.subfunction); > ITMLST2_INIT(entdsc, 0, hostent_size, ior->spec_hostent); $ ior->spec_useralist = addrlist;" ior->spec_length = *listsize; ior->spec_retlen = count;& ior->iorflags = IOR_M_COPY_ADDRS;O status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_ACPCONTROL, &ior->iosb,d8 io_completion, ior, &subfdsc, namdsc,9 &ior->specior.fromlen, &entdsc, 0, 0);$$ if (!OK(status)) FREE_IOR(ior); return status;  }  subfunction =0H (INETACP$C_HOSTENT_OFFSET << 8) | INETACP_FUNC$C_GETHOSTBYNAME;@ ITMLST2_INIT(subfdsc, 0, sizeof(subfunction), &subfunction);4 ITMLST2_INIT(entdsc, 0, hostent_size, &hostent);K status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_ACPCONTROL, &myiosb,r> 0, 0, &subfdsc, namdsc, &helen, &entdsc, 0, 0);: if (OK(status)) status = netlib___cvt_status(&myiosb);@ if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); if (OK(status)) {  char *base; unsigned int *offlst; int i;_ base = (char *) &hostent; i = 0;t( if (hostent.addrlist_offset != 0) {B offlst = (unsigned int *) (base+hostent.addrlist_offset);2 while (i < *listsize && offlst[i] != 0) {A addrlist[i] = *(struct INADDRDEF *) (base + offlst[i]);  i++; } }, if (argc > 5 && count != 0) *count = i; }e return status; } /* netlib_name_to_address */ _/***++#** ROUTINE: netlib_address_to_name;**** FUNCTIONAL DESCRIPTION:}**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:o****** SIDE EFFECTS: None.****--*/Munsigned int netlib_address_to_name (struct CTX **xctx, unsigned int *whichp,>* struct INADDRDEF *addr,* unsigned int *addrsize,1 struct dsc$descriptor *namdsc, * unsigned short *retlen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; struct NETLIBIOSBDEF myiosb;$ ITMLST2 subfdsc, entdsc, adrdsc;% unsigned int status, subfunction; char buf[1024];t unsigned short length; int argc;; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG; G if (addr == 0 || addrsize == 0 || namdsc == 0) return SS$_BADPARAM;AC if (*addrsize != sizeof(struct INADDRDEF)) return SS$_BADPARAM;u- ITMLST2_INIT(adrdsc, 0, *addrsize, addr);i" if (argc > 7 && astadr != 0) { struct IOR *ior; struct HOSTENT *h;d> GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0);, status = lib$get_vm(&hostent_size, &h); if (!OK(status)) {, FREE_IOR(ior);  return status;  } ior->spec_usrdsc = namdsc;u ior->spec_retlen = retlen;* ior->specior.subfunction =? (INETACP$C_TRANS << 8) | INETACP_FUNC$C_GETHOSTBYADDR;c? ITMLST2_INIT(subfdsc, 0, sizeof(ior->specior.subfunction),T. &ior->specior.subfunction);; ITMLST2_INIT(entdsc, 0, sizeof(h->buffer), h->buffer);S ior->spec_hostent = h; ) ior->iorflags = IOR_M_COPY_HOSTNAME; O status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_ACPCONTROL, &ior->iosb,u9 io_completion, ior, &subfdsc, &adrdsc, 9 &ior->specior.fromlen, &entdsc, 0, 0);:$ if (!OK(status)) FREE_IOR(ior); return status;L }PH subfunction = (INETACP$C_TRANS << 8) | INETACP_FUNC$C_GETHOSTBYADDR;@ ITMLST2_INIT(subfdsc, 0, sizeof(subfunction), &subfunction);. ITMLST2_INIT(entdsc, 0, sizeof(buf), buf);K status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_ACPCONTROL, &myiosb,/@ 0, 0, &subfdsc, &adrdsc, &length, &entdsc, 0, 0);: if (OK(status)) status = netlib___cvt_status(&myiosb);@ if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); if (OK(status)) {i& str$copy_r(namdsc, &length, buf);3 if (argc > 5 && retlen != 0) *retlen = length;r }& return status;} /* netlib_address_to_name */ /***++** ROUTINE: x**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.0**** COMPLETION CODES:R****** SIDE EFFECTS: None.****--*/Junsigned int netlib_get_hostname (void *bufdsc, unsigned short *retlenp) { char buf[256]; unsigned int status; unsigned short retlen; int argc;  SETARGCOUNT(argc);< if (gethostname(buf, sizeof(buf)) < 0) return SS$_ABORT; retlen = strlen(buf);m. status = str$copy_r(bufdsc, &retlen, buf);# if (!OK(status)) return status;4 if (argc > 1 && retlenp != 0) *retlenp = retlen; return SS$_NORMAL;} /* netlib_get_hostname */S P/***++%** ROUTINE: netlib___get_nameservers,**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None./**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/+int netlib___get_nameservers (QUEUE *nsq) {, struct NAMESERVER *ns; struct INADDRDEF a;( struct CTX *tmpctx;s) struct dsc$descriptor dsc, lognamdsc;x ITMLST lnmlst[2];S. char name[256], lognam[256], *cp, *anchor;& unsigned int status, size, maxidx; unsigned short namlen; int index, i, remain;c static unsigned int one = 1; tmpctx = 0;E ITMLST_INIT(lnmlst[0], LNM$_STRING, sizeof(name), name, &namlen); ' ITMLST_INIT(lnmlst[1], 0, 0, 0, 0);I% INIT_SDESC(lognamdsc, 0, lognam);N+ for (index = 0; index <= 16; index++) {(L lognamdsc.dsc$w_length = sprintf(lognam, "UCX$BIND_SERVER%03d", index);G status = sys$trnlnm(0, &nameserver_tabnam, &lognamdsc, 0, lnmlst); . if (!OK(status) || namlen == 0) continue;5 for (anchor = name, remain = namlen; remain > 0;N8 remain -= i+1, anchor = cp+1) {* cp = memchr(anchor, ',', remain);! if (cp == 0) i = remain;  else i = cp - anchor;$ INIT_SDESC(dsc, i, anchor);/ if (!OK(netlib_strtoaddr(&dsc, &a))) {, if (tmpctx == 0) {> if (!OK(netlib_sockeà& NETLIB_SRC.BCKç [NETLIB]NETLIB_UCX.C;46Wb£Œ Zt(&tmpctx, 0, 0))) continue; } G if (!OK(netlib_name_to_address(&tmpctx, 0, &dsc, &a, &one, 0,_( 0, 0, 0))) continue; }* size = sizeof(struct NAMESERVER);) status = lib$get_vm(&size, &ns);4 if (!OK(status)) break; ns->addr = a;% queue_insert(ns, nsq->tail);  } }c+ if (tmpctx != 0) netlib_close(&tmpctx);s return index;i } /* netlib___get_nameservers */ :/***++ ** ROUTINE: netlib___get_domain**** FUNCTIONAL DESCRIPTION:N**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Uint netlib___get_domain (char *buf, unsigned short bufsize, unsigned short *retlen) {d struct dsc$descriptor dsc; ITMLST lnmlst[2];t char name[256], *cp; unsigned int status; unsigned short namlen;5 static $DESCRIPTOR(lognamdsc, "UCX$BIND_DOMAIN"); / static $DESCRIPTOR(tabnam, "LNM$FILE_DEV");YE ITMLST_INIT(lnmlst[0], LNM$_STRING, sizeof(name), name, &namlen);I' ITMLST_INIT(lnmlst[1], 0, 0, 0, 0);$; status = sys$trnlnm(0, &tabnam, &lognamdsc, 0, lnmlst);Z if (OK(status)) cp = name; else {) INIT_SDESC(dsc, sizeof(name), name);c; if (!OK(netlib_get_hostname(&dsc, &namlen))) return 0;c$ cp = memchr(name, '.', namlen); if (cp == 0) return 0;s cp += 1;  namlen -= (cp - name);T }r/ if (memchr(cp, '.', namlen) == 0) return 0; / if (namlen > bufsize-1) namlen = bufsize-1;  memcpy(buf, cp, namlen); *retlen = namlen; return 1;e} /* netlib___get_domain */c =/***++!** ROUTINE: netlib_dns_mx_lookup**** FUNCTIONAL DESCRIPTION:(**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.O**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/4unsigned int netlib_dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,K struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm) {f struct CTX *ctx; int argc;w VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 4) return SS$_INSFARG;0? return netlib___dns_mx_lookup(xctx, namdsc, mxrr, mxrrsize,t; (argc > 4) ? mxrrcount : 0, (argc > 5) ? iosb : 0, ; (argc > 6) ? astadr : 0, (argc > 7) ? astprm : 0); } /* netlib_dns_mx_lookup */ÿÿ= newctx;T2 if (argc > 3 && sa != 0 && sasize != 0) { unsigned int len;  len = fromlen;+ if (len > *sasize) len = *sasize;i! memcpy(sa, &from, len);3 if (argc > 4 && salen != 0) *salen = len;O } } } à' NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.C;57X~…ð*[NETLIB]NETLIB_CMU.C;57+,.~/€ 4X~u*-ç 0ª123KÿPWOv56XzêúQ›7-c3êúQ›89¹AJ(ú›G€HˆªJÿ/***++** FACILITY: NETLIB**.** ABSTRACT: Routines specific to CMU TCP/IP.**** MODULE DESCRIPTION:**** tbs**** AUTHOR: M. Madison=** COPYRIGHT © 1994, 1995, 1997 MADGOAT SOFTWARE."** ALL RIGHTS RESERVED.**** CREATION DATE: 26-OCT-1994**** MODIFICATION HISTORY:**1** 31-OCT-1994 V1.0 Madison Initial coding.:** 19-NOV-1994 V1.1 Madison Add CMU resolver bypass.;** 09-JAN-1995 V1.1-1 Madison Fix $CANTIM coding error.H** 13-JAN-1995 V1.1-2 Madison Fix potential memory leaks, timer bug.B** 23-JAN-1995 V1.1-3 Madison Fix ASTPRM check on async close.3** 17-FEB-1995 V1.1-4 Madison Fix UDP connects.@** 28-FEB-1995 V1.1-5 Madison UDP sockets need to be OPENed;4** arg missing on $DCLAST.K** 08-JUN-1995 V1.1-6 Madison COPY_FROM was getting wiped out by TIMED.2** 13-OCT-1995 V1.2 Madison Lots more fixes.C** 01-JUN-1997 V1.2-1 Madison Use a flag to indicate a timeout.**--*/#include "netlib_cmu.h"#include "netlib.h"#include /*** Forward declarations*/E unsigned int netlib_socket(struct CTX **xctx, unsigned int *type,* unsigned int *family);J unsigned int netlib_server_setup(struct CTX **xctx, struct SINDEF *sa,) unsigned int *salen);B unsigned int netlib_bind(struct CTX **xctx, struct SINDEF *sa,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);7 static unsigned int io_completion(struct IOR *ior);H unsigned int netlib_getsockname(struct CTX **ctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);H unsigned int netlib_getpeername(struct CTX **ctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);D unsigned int netlib_connect(struct CTX **ctx, struct SINDEF *sa,) unsigned int *salen,0 struct NETLIBIOSBDEF *iosb,5 void (*astadr)(), void *astprm);K unsigned int netlib_write(struct CTX **ctx, struct dsc$descriptor *dsc,: struct SINDEF *sa, unsigned int *salen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);J unsigned int netlib_read(struct CTX **ctx, struct dsc$descriptor *dsc,; struct SINDEF *sa, unsigned int *sasize,2 unsigned int *salen, TIME *tmo,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);4 static unsigned int io_timeout(struct IOR *ior);K unsigned int netlib_shutdown(struct CTX **xctx, unsigned int *shuttype,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);1 unsigned int netlib_close(struct CTX **xctx);H unsigned int netlib_listen(struct CTX **xctx, unsigned int *backlog,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);F unsigned int netlib_accept(struct CTX **ctx, struct CTX **xnewctx,; struct SINDEF *sa, unsigned int *sasize,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);5 unsigned int netlib_setsockopt(struct CTX **xctx,= unsigned int *level, unsigned int *option,5 void *value, unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);5 unsigned int netlib_getsockopt(struct CTX **xctx,= unsigned int *level, unsigned int *option,6 void *value, unsigned int *valsize,( unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);P unsigned int netlib_name_to_address(struct CTX **xctx, unsigned int *whichp,1 struct dsc$descriptor *namdsc,. struct INADDRDEF *addrlist,? unsigned int *listsize, unsigned int *count,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);P unsigned int netlib_address_to_name(struct CTX **xctx, unsigned int *whichp,* struct INADDRDEF *addr,* unsigned int *addrsize,1 struct dsc$descriptor *namdsc,* unsigned short *retlen,. struct NETLIBIOSBDEF *iosb,3 void (*astadr)(), void *astprm);L unsigned int netlib_get_hostname(void *bufdsc, unsigned short *retlenp);- int netlib___get_nameservers(QUEUE *nsq);W int netlib___get_domain(char *buf, unsigned short bufsize, unsigned short *retlen);H static unsigned int netlib___cvt_status(struct NETLIBIOSBDEF *iosb);X static void netlib___cvt_iosb(struct NETLIBIOSBDEF *dst, struct NETLIBIOSBDEF *src);N static void expand(char *, unsigned int, unsigned char *, unsigned int *);8 unsigned int netlib_dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);) static int bypass_cmu_resolver(void);/*** OWN storage*/2 static $DESCRIPTOR(inetdevice, "INET$DEVICE");/ static $DESCRIPTOR(backup_device, "_IP0:");= static unsigned int rr_info_size = sizeof(struct CMU_RR);A static unsigned int name_info_size = sizeof(struct CMU_AtoN);A static unsigned int addr_info_size = sizeof(struct CMU_NtoA);E static unsigned int conn_info_size = sizeof(struct CMU_ConnInfo);/*** External references*/O unsigned int netlib_strtoaddr(struct dsc$descriptor *, struct INADDRDEF *);; unsigned int netlib___dns_name_to_addr(struct CTX *ctx,H struct dsc$descriptor *namdsc, struct INADDRDEF *addrlist,9 unsigned int listsize, unsigned int *count,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);; unsigned int netlib___dns_addr_to_name(struct CTX *ctx,@ struct INADDRDEF *addrlist, unsigned int addrsize,D struct dsc$descriptor *namdsc, unsigned short *retlen,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm);: unsigned int netlib___dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,J struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm); /***++** ROUTINE: netlib_socket**** FUNCTIONAL DESCRIPTION:**** Create a "socket".**B** RETURNS: cond_value, longword (unsigned), wrà( NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.C;57X~´ˆite only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Bunsigned int netlib_socket (struct CTX **xctx, unsigned int *type,+ unsigned int *family) { struct CTX *ctx; struct { unsigned short protocol; unsigned char type; unsigned char domain; } sockdef; unsigned int status, af, ty; int argc; SETARGCOUNT(argc);% if (argc < 1) return SS$_INSFARG;4 status = netlib___alloc_ctx(&ctx, SPECCTX_SIZE);# if (!OK(status)) return status;7 status = sys$assign(&inetdevice, &ctx->chan, 0, 0);K if (!OK(status)) status = sys$assign(&backup_device, &ctx->chan, 0, 0); if (!OK(status)) { netlib___free_ctx(ctx); return status; } ctx->specctx->socket_type =< (argc < 2 || type == 0) ? NETLIB_K_TYPE_STREAM : *type; *xctx = ctx; return SS$_NORMAL;} /* netlib_socket */ /***++ ** ROUTINE: netlib_server_setup**** FUNCTIONAL DESCRIPTION:**** Create a "server_setup".**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/Gunsigned int netlib_server_setup (struct CTX **xctx, struct SINDEF *sa,/ unsigned int *salen) { struct CTX *ctx; struct NETLIBIOSBDEF iosb;" unsigned int status, type, af;3 if (sa == 0 || salen == 0) return SS$_BADPARAM; type = NETLIB_K_TYPE_STREAM; af = NETLIB_K_AF_INET;- status = netlib_socket(&ctx, &type, &af);< status = sys$qiow(netlib_synch_efn, ctx->chan, IO__OPEN, &iosb, 0, 0,6 0, 0, netlib_word_swap(sa->sin_w_port),& 0, CMU_K_PROTO_TCP, 0);8 if (OK(status)) status = netlib___cvt_status(&iosb); if (!OK(status)) { sys$dassgn(ctx->chan); netlib___free_ctx(ctx); return status; } *xctx = ctx; return SS$_NORMAL;} /* netlib_server_setup */ /***++** ROUTINE: netlib_bind**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/?unsigned int netlib_bind (struct CTX **xctx, struct SINDEF *sa,C unsigned int *salen, struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc; static unsigned int one = 1; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);3 if (sa == 0 || salen == 0) return SS$_BADPARAM;< if (*salen < sizeof(struct SINDEF)) return SS$_BADPARAM;. ctx->specctx->local_addr = sa->sin_x_addr;@ ctx->specctx->local_port = netlib_word_swap(sa->sin_w_port);< if (ctx->specctx->socket_type == NETLIB_K_TYPE_STREAM) {! if (argc > 3 && iosb != 0) {* iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = 0;! iosb->iosb_l_unused = 0; }# if (argc > 4 && astadr != 0) {8 sys$dclast(astadr, (argc > 5) ? astprm : 0, 0); } return SS$_NORMAL; }" if (argc > 4 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);) ior->iorflags |= IOR_M_SET_OPENFLAG;I status = sys$qio(netlib_asynch_efn, ctx->chan, IO__OPEN, &ior->iosb,F io_completion, ior, 0, 0, ctx->specctx->local_port,; CMU_M_OPEN_UDPDATA, CMU_K_PROTO_UDP, 0);$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;F status = sys$qiow(netlib_synch_efn, ctx->chan, IO__OPEN, &myiosb,8 0, 0, 0, 0, ctx->specctx->local_port,; CMU_M_OPEN_UDPDATA, CMU_K_PROTO_UDP, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb);A if (argc > 3 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);; if (OK(status)) ctx->specctx->flags |= SPECCTX_M_OPEN; } return status;} /* netlib_bind */ /***++** ROUTINE: io_completion**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/5static unsigned int io_completion (struct IOR *ior) {( ior->iorflags |= IOR_M_IO_COMPLETED;; if (ior->iorflags & IOR_M_IO_TIMED) sys$cantim(ior, 0);T if (ior->iosb.iosb_w_status == SS$_CANCEL && (ior->iorflags & IOR_M_IO_TIMEOUT))+ ior->iosb.iosb_w_status = SS$_TIMEOUT;C if (ior->iosbp != 0) netlib___cvt_iosb(ior->iosbp, &ior->iosb);* if (ior->iorflags & IOR_M_COPY_FROM) {B if (OK(ior->iosb.iosb_w_status) && ior->spec_userfrom != 0) { unsigned int len; struct SINDEF *sa;! sa = ior->spec_userfrom;% len = sizeof(struct SINDEF);< if (len > ior->spec_length) len = ior->spec_length;; if (len >= 2) sa->sin_w_family = NETLIB_K_AF_INET;' if (len >= 4) sa->sin_w_port =? netlib_word_swap(ior->specior.from.ipa_w_srcport);H if (len >= 8) sa->sin_x_addr = ior->specior.from.ipa_x_srcaddr;6 if (len > 8) memset(sa->sin_x_mbz, 0, len-8);M if (ior->spec_retlen != 0) *(unsigned int *) ior->spec_retlen = len; }' ior->iorflags &= ~IOR_M_COPY_FROM; }. if (ior->iorflags & IOR_M_COPY_CI_LOCAL) {' if (OK(ior->iosb.iosb_w_status)) {! struct CMU_ConnInfo *ci; struct SINDEF *sa; int len;" ci = ior->spec_conn_info;! sa = ior->spec_userfrom;% len = sizeof(struct SINDEF);@ if (ior->spec_usersize < len) len = ior->spec_usersize;; if (len >= 2) sa->sin_w_family = NETLIB_K_AF_INET;N if (len >= 4) sa->sin_w_port = netlib_word_swap(ci->ci_l_local_port);? if (len >= 8) sa->sin_x_addr = ci->ci_x_local_address;6 if (len > 8) memset(sa->sin_x_mbz, 0, len-8);L if (ior->spec_retlen != 0) *(unsigned int *)ior->spec_retlen = len; }8 lib$free_vm(&conn_info_size, &ior->spec_conn_info);+ ior->iorflags &= ~IOR_M_COPY_CI_LOCAL; }/ if (ior->iorflags & IOR_M_COPY_CI_REMOTE) {' if (OK(ior->iosb.iosb_w_status)) {! struct CMU_ConnInfo *ci; struct SINDEF *sa; int len;" ci = ior->spec_conn_info; sa = ior->spec_userfrom;% len = sizeof(struct SINDEF);@ if (ior->spec_usersize < len) len = ior->spec_usersize;; if (len >= 2) sa->sin_w_family = NETLIB_K_AF_INET;O if (len >= 4) sa->sin_w_port = netlib_word_swap(ci->ci_l_remote_port);@ if (len >= 8) sa->sin_x_addr = ci->ci_x_remote_address;6 if (len > 8) memset(sa->sin_x_mbz, 0, len-8);L if (ior->spec_retlen != 0) *(unsigned int *)ior->spec_retlen = len; }8 lib$free_vm(&conn_info_size, &ior->spec_conn_info);, ior->iorflags &= ~IOR_M_COPY_CI_REMOTE; }+ if (ior->iorflags & IOR_M_COPY_ADDRS) {' if (OK(ior->iosb.iosb_w_status)) {! struct INADDRDEF *alist;5 struct CMU_NtoA *à) NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.C;57X~)ntoa = ior->spec_addr_info; int i;# alist = ior->spec_userbuf;K for (i = 0; i < ior->spec_length && i < ntoa->ntoa_l_count; i++) {* alist[i] = ntoa->ntoa_x_addr[i]; }J if (ior->spec_retlen != 0) *(unsigned int *)ior->spec_retlen = i; }8 lib$free_vm(&addr_info_size, &ior->spec_addr_info);( ior->iorflags &= ~IOR_M_COPY_ADDRS; }. if (ior->iorflags & IOR_M_COPY_HOSTNAME) {* if (OK(ior->iosb.iosb_w_status)) {$ struct dsc$descriptor *dsc;3 struct CMU_AtoN *ni = ior->spec_name_info;! dsc = ior->spec_userbuf;? str$copy_r(dsc, &ni->aton_l_namelen, ni->aton_t_name);% if (ior->spec_retlen != 0) {G *(unsigned short *) ior->spec_retlen = ni->aton_l_namelen; } }8 lib$free_vm(&name_info_size, &ior->spec_name_info);+ ior->iorflags &= ~IOR_M_COPY_HOSTNAME; }+ if (ior->iorflags & IOR_M_COPY_MXRRS) {' if (OK(ior->iosb.iosb_w_status)) { struct MXRRDEF *mxrr;/ struct CMU_RR *rr = ior->spec_rr_info; unsigned int i, len; int remain; unsigned char *cp;" mxrr = ior->spec_userbuf; cp = rr->rr_x_data + 1;& remain = rr->rr_w_length - 1; i = 0;5 while (remain > 0 && i < ior->spec_length) {2 len = *(unsigned short *)cp; cp += 2;@ mxrr[i].mxrr_l_preference = *(unsigned short *) cp;A expand(mxrr[i].mxrr_t_name, NETLIB_S_MXRR_NAME, cp + 2,' &mxrr[i].mxrr_l_length);P remain -= len + 2; cp += len;U i++;o }J if (ior->spec_retlen != 0) *(unsigned int *)ior->spec_retlen = i; }4 lib$free_vm(&rr_info_size, &ior->spec_rr_info);( ior->iorflags &= ~IOR_M_COPY_MXRRS; } , if (ior->iorflags & IOR_M_NEW_CONTEXT) {' if (OK(ior->iosb.iosb_w_status)) {? *(struct CTX **) ior->spec_xnewctx = ior->spec_newctx; - ior->iorflags &= ~IOR_M_NEW_CONTEXT;o' if (ior->spec_userfrom != 0) {. unsigned int len;$ len = ior->spec_length;& ior->iosb.iosb_w_status =B netlib_getpeername(&(struct CTX *) ior->spec_newctx,+ ior->spec_userfrom, &len,*, ior->spec_retlen, ior->iosbp,) ior->astadr, ior->astprm);9, if (OK(ior->iosb.iosb_w_status)) { FREE_IOR(ior); return SS$_NORMAL; } else {M if (ior->iosbp != 0) netlib___cvt_iosb(ior->iosbp, &ior->iosb);rA sys$dassgn(((struct CTX *)ior->spec_newctx)->chan);nA netlib___free_ctx((struct CTX *) ior->spec_newctx);i }i } } else {*< sys$dassgn(((struct CTX *)ior->spec_newctx)->chan);< netlib___free_ctx((struct CTX *) ior->spec_newctx); }) ior->iorflags &= ~IOR_M_NEW_CONTEXT;n }t- if (ior->iorflags & IOR_M_SET_OPENFLAG) {*% if (OK(ior->iosb.iosb_w_status))u4 ior->ctx->specctx->flags |= SPECCTX_M_OPEN; }t8 if (ior->astadr != 0) (*(ior->astadr))(ior->astprm); FREE_IOR(ior); return SS$_NORMAL;} /* io_completion */  /***++** ROUTINE: netlib_getsockname **** FUNCTIONAL DESCRIPTION:i**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.L**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Funsigned int netlib_getsockname (struct CTX **xctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen, 0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; ITMLST slst; int argc;F VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);4 if (sa == 0 || sasize == 0) return SS$_BADPARAM;" if (argc > 5 && astadr != 0) { struct IOR *ior;*> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0);@ status = lib$get_vm(&conn_info_size, &ior->spec_conn_info); if (!OK(status)) {  FREE_IOR(ior);B return status;  }" ior->spec_usersize = *sasize; ior->spec_userfrom = sa;s ior->spec_retlen = salen;) ior->iorflags = IOR_M_COPY_CI_LOCAL;nI status = sys$qio(netlib_asynch_efn, ctx->chan, IO__INFO, &ior->iosb, < io_completion, ior, ior->spec_conn_info, / conn_info_size, 0, 0, 0, 0);i$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;E struct CMU_ConnInfo ci;= status = sys$qiow(netlib_synch_efn, ctx->chan, IO__INFO,t& &myiosb, 0, 0, &ci,/ conn_info_size, 0, 0, 0, 0); ; if (OK(status)) status = netlib___cvt_status(&myiosb);nA if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);, if (OK(status)) { int len;e% len = sizeof(struct SINDEF); * if (*sasize < len) len = *sasize;; if (len >= 2) sa->sin_w_family = NETLIB_K_AF_INET;nM if (len >= 4) sa->sin_w_port = netlib_word_swap(ci.ci_l_local_port);s> if (len >= 8) sa->sin_x_addr = ci.ci_x_local_address;6 if (len > 8) memset(sa->sin_x_mbz, 0, len-8);2 if (argc > 3 && salen != 0) *salen = len; } }i return status;} /* netlib_getsockname */ /***++** ROUTINE: netlib_getpeernames**** FUNCTIONAL DESCRIPTION:a**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.N**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Funsigned int netlib_getpeername (struct CTX **xctx, struct SINDEF *sa,? unsigned int *sasize, unsigned int *salen,r0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; ITMLST slst; int argc;d VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);4 if (sa == 0 || sasize == 0) return SS$_BADPARAM;" if (argc > 5 && astadr != 0) { struct IOR *ior;t> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0);@ status = lib$get_vm(&conn_info_size, &ior->spec_conn_info); if (!OK(status)) {r FREE_IOR(ior);  return status;s } ior->spec_userfrom = sa;T" ior->spec_usersize = *sasize; ior->spec_retlen = salen;* ior->iorflags = IOR_M_COPY_CI_REMOTE;I status = sys$qio(netlib_asynch_efn, ctx->chan, IO__INFO, &ior->iosb,;< io_completion, ior, ior->spec_conn_info, / conn_info_size, 0, 0, 0, 0); $ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;  struct CMU_ConnInfo ci;= status = sys$qiow(netlib_synch_efn, ctx->chan, IO__INFO,_& &myiosb, 0, 0, &ci,/ conn_info_size, 0, 0, 0, 0);C; if (OK(status)) status = netlib___cvt_status(&myiosb);tA if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);c if (OK(status)) { int len;t% len = sizeof(struct SINDEF);d* if (*sasize < len) len = *sasize;; if (len >= 2) sa->sin_w_family = NETLIB_K_AF_INET;IN if (len >= 4) sa->sin_w_port = netlib_word_swap(ci.ci_l_remote_à* NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.C;57X~û-port);? if (len >= 8) sa->sin_x_addr = ci.ci_x_remote_address;t6 if (len > 8) memset(sa->sin_x_mbz, 0, len-8);2 if (argc > 3 && salen != 0) *salen = len; } }  return status;} /* netlib_getpeername */ /***++** ROUTINE: netlib_connecto**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:u****** SIDE EFFECTS: None.****--*/Bunsigned int netlib_connect (struct CTX **xctx, struct SINDEF *sa,) unsigned int *salen,,0 struct NETLIBIOSBDEF *iosb,6 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc;* VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);3 if (sa == 0 || salen == 0) return SS$_BADPARAM;E< if (*salen < sizeof(struct SINDEF)) return SS$_BADPARAM;/*?** For UDP sockets, save the remote address/port for later use**/; if (ctx->specctx->socket_type == NETLIB_K_TYPE_DGRAM) {*0 ctx->specctx->remote_addr = sa->sin_x_addr;0 ctx->specctx->remote_port = sa->sin_w_port;# if (argc > 4 && astadr != 0) {* struct IOR *ior;XB GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);M status = sys$qio(netlib_asynch_efn, ctx->chan, IO__OPEN, &ior->iosb,a/ io_completion, ior, 0, 0, 0,r; CMU_M_OPEN_UDPDATA, CMU_K_PROTO_UDP, 0);=( if (!OK(status)) FREE_IOR(ior); } else {t% struct NETLIBIOSBDEF myiosb;sJ status = sys$qiow(netlib_synch_efn, ctx->chan, IO__OPEN, &myiosb,! 0, 0, 0, 0, 0,0; CMU_M_OPEN_UDPDATA, CMU_K_PROTO_UDP, 0);? if (OK(status)) status = netlib___cvt_status(&myiosb);E if (argc > 3 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);t } return status;; }n" if (argc > 4 && astadr != 0) { struct IOR *ior;t> GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);I status = sys$qio(netlib_asynch_efn, ctx->chan, IO__OPEN, &ior->iosb,l& io_completion, ior,1 &sa->sin_x_addr.inaddr_l_addr,U4 netlib_word_swap(sa->sin_w_port),, ctx->specctx->local_port,: CMU_M_OPEN_ACTIVE|CMU_M_OPEN_BYADDRESS,' CMU_K_PROTO_TCP, 0); $ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;aL status = sys$qiow(netlib_synch_efn, ctx->chan, IO__OPEN, &myiosb, 0, 0,1 &sa->sin_x_addr.inaddr_l_addr,I4 netlib_word_swap(sa->sin_w_port),, ctx->specctx->local_port,: CMU_M_OPEN_ACTIVE|CMU_M_OPEN_BYADDRESS,' CMU_K_PROTO_TCP, 0);,; if (OK(status)) status = netlib___cvt_status(&myiosb); A if (argc > 3 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);s }g return status;} /* netlib_connect */ r/***++** ROUTINE: netlib_write **** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.e**** COMPLETION CODES:******* SIDE EFFECTS: None.****--*/Iunsigned int netlib_write (struct CTX **xctx, struct dsc$descriptor *dsc,S: struct SINDEF *sa, unsigned int *salen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; void *bufptr;  unsigned int status; unsigned short buflen; struct CMU_IPAddr ipa; int argc, do_address;; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);6 status = lib$analyze_sdesc(dsc, &buflen, &bufptr);# if (!OK(status)) return status;)= if ((ctx->specctx->socket_type == NETLIB_K_TYPE_DGRAM) &&x3 !(ctx->specctx->flags & SPECCTX_M_OPEN)) {a! struct NETLIBIOSBDEF myiosb;eF status = sys$qiow(netlib_synch_efn, ctx->chan, IO__OPEN, &myiosb,8 0, 0, 0, 0, ctx->specctx->local_port,; CMU_M_OPEN_UDPDATA, CMU_K_PROTO_UDP, 0);0; if (OK(status)) status = netlib___cvt_status(&myiosb);s$ if (!OK(status)) return status;+ ctx->specctx->flags |= SPECCTX_M_OPEN;  }  do_address = 0;r! if (argc > 3 && salen != 0) {  do_address = 1;" memset(&ipa, 0, sizeof(ipa));K if (*salen >= 4) ipa.ipa_w_dstport = netlib_word_swap(sa->sin_w_port);a9 if (*salen >= 8) ipa.ipa_x_dstaddr = sa->sin_x_addr; 2 ipa.ipa_w_srcport = ctx->specctx->local_port;2 ipa.ipa_x_srcaddr = ctx->specctx->local_addr;B } else if (ctx->specctx->socket_type == NETLIB_K_TYPE_DGRAM) { do_address = 1;" memset(&ipa, 0, sizeof(ipa));E ipa.ipa_w_dstport = netlib_word_swap(ctx->specctx->remote_port); 3 ipa.ipa_x_dstaddr = ctx->specctx->remote_addr; 2 ipa.ipa_w_srcport = ctx->specctx->local_port;2 ipa.ipa_x_srcaddr = ctx->specctx->local_addr; }i" if (argc > 5 && astadr != 0) { struct IOR *ior;> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0); if (buflen == 0) {. ior->iosb.iosb_w_status = SS$_NORMAL;$ ior->iosb.iosb_w_count = 0;% ior->iosb.iosb_l_unused = 0;U4 status = sys$dclast(io_completion, ior, 0); } else {RR status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_WRITEVBLK, &ior->iosb,? io_completion, ior, bufptr, buflen, 0, 1, 0,n* do_address ? &ipa : 0);( if (!OK(status)) FREE_IOR(ior); } } else {! struct NETLIBIOSBDEF myiosb;  if (buflen == 0) {m4 status = myiosb.iosb_w_status = SS$_NORMAL;! myiosb.iosb_w_count = 0;T" myiosb.iosb_l_unused = 0; } else {TF status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_WRITEVBLK,: &myiosb, 0, 0, bufptr, buflen, 0, 1, 0,* do_address ? &ipa : 0);? if (OK(status)) status = netlib___cvt_status(&myiosb);* }A if (argc > 4 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);N } return status;} /* netlib_write */ p/***++** ROUTINE: netlib_read**** FUNCTIONAL DESCRIPTION:T**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:t****** SIDE EFFECTS: None.****--*/Hunsigned int netlib_read (struct CTX **xctx, struct dsc$descriptor *dsc,; struct SINDEF *sa, unsigned int *sasize,l6 unsigned int *salen, TIME *timeout,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; struct IOR *ior; unsigned int status; int argc, do_from; VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);E if (dsc->dsc$b_dtype != DSC$K_DTYPE_T && dsc->dsc$b_dtype != 0) {  return SS$_BADPARAM;  }nE if (dsc->dsc$b_class != DSC$K_CLASS_S && dsc->dsc$b_class != 0) {i return SS$_BADPARAM;  }i= if ((ctx->specctx->socket_type == NETLIB_K_TYPE_DGRAM) &&,3 !(ctx->specctx->flags & SPECCTX_M_OPEN)) {n! struct NETLIBIOSBDEF myiosb; F status = sys$qiow(netlib_synch_efn, ctx->chan, IO__OPEN, &mà+ NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.C;57X~b<yiosb,8 0, 0, 0, 0, ctx->specctx->local_port,; CMU_M_OPEN_UDPDATA, CMU_K_PROTO_UDP, 0);.; if (OK(status)) status = netlib___cvt_status(&myiosb); $ if (!OK(status)) return status;+ ctx->specctx->flags |= SPECCTX_M_OPEN;  }=C do_from = (argc > 3 && sa != 0 && sasize != 0 && *sasize != 0);i" if (argc > 7 && astadr != 0) {> GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0); if (do_from) { ! ior->spec_userfrom = sa; $ ior->spec_length = *sasize;" ior->spec_retlen = salen;) ior->iorflags = IOR_M_COPY_FROM;i } else ior->iorflags = 0;* ior->iorflags &= ~IOR_M_IO_COMPLETED;! if (timeout != 0) { t) ior->iorflags |= IOR_M_IO_TIMED;iJ status = sys$setimr(netlib_asynch_efn, timeout, io_timeout, ior); if (!OK(status)) {r FREE_IOR(ior); return status; } }M status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_READVBLK, &ior->iosb,a: io_completion, ior, dsc->dsc$a_pointer,% dsc->dsc$w_length,>> do_from ? &ior->specior.from : 0, 0, 0, 0); if (!OK(status)) {;. if (timeout != 0) sys$cantim(ior, 0); FREE_IOR(ior);p } } else {! struct NETLIBIOSBDEF myiosb;  struct CMU_IPAddr from; int timed_out;M timed_out = 0;$ if (argc > 5 && timeout != 0) {$ GET_IOR(ior, ctx, 0, 0, 0);( ior->iorflags = IOR_M_IO_TIMED;J status = sys$setimr(netlib_asynch_efn, timeout, io_timeout, ior); if (!OK(status)) {  FREE_IOR(ior); return status; } }A status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_READVBLK,p! &myiosb, 0, 0, 9 dsc->dsc$a_pointer, dsc->dsc$w_length,p1 do_from ? &from : 0, 0, 0, 0);O$ if (argc > 5 && timeout != 0) { sys$cantim(ior, 0);6 timed_out = ior->iorflags & IOR_M_IO_TIMEOUT; FREE_IOR(ior);s } if (OK(status)) {= if (timed_out && myiosb.iosb_w_status == SS$_CANCEL) - myiosb.iosb_w_status = SS$_TIMEOUT;o/ status = netlib___cvt_status(&myiosb);; }A if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);(! if (OK(status) && do_from) {  unsigned int len;% len = sizeof(struct SINDEF); * if (len > *sasize) len = *sasize;; if (len >= 2) sa->sin_w_family = NETLIB_K_AF_INET;_' if (len >= 4) sa->sin_w_port =x/ netlib_word_swap(from.ipa_w_srcport);; if (len >= 8) sa->sin_x_addr = from.ipa_x_srcaddr; 6 if (len > 8) memset(sa->sin_x_mbz, 0, len-8);2 if (argc > 4 && salen != 0) *salen = len; } }r return status;} /* netlib_read */X ;/***++** ROUTINE: io_timeout **** FUNCTIONAL DESCRIPTION:(**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:e****** SIDE EFFECTS: None.****--*/2static unsigned int io_timeout (struct IOR *ior) {> if (ior->iorflags & IOR_M_IO_COMPLETED) return SS$_NORMAL;& ior->iorflags |= IOR_M_IO_TIMEOUT;& return sys$cancel(ior->ctx->chan);} /* io_timeout */ -/***++** ROUTINE: netlib_shutdown**** FUNCTIONAL DESCRIPTION:R**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:n****** SIDE EFFECTS: None.****--*/Hunsigned int netlib_shutdown (struct CTX **xctx, unsigned int *shuttype,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status; int argc;  VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);" if (argc > 3 && astadr != 0) { struct IOR *ior;e> GET_IOR(ior, ctx, iosb, astadr, (argc > 4) ? astprm : 0);J status = sys$qio(netlib_asynch_efn, ctx->chan, IO__CLOSE, &ior->iosb,9 io_completion, ior, 0, 0, 0, 0, 0, 0);n$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;nG status = sys$qiow(netlib_synch_efn, ctx->chan, IO__CLOSE, &myiosb,*+ 0, 0, 0, 0, 0, 0, 0, 0);*; if (OK(status)) status = netlib___cvt_status(&myiosb);*A if (argc > 2 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);_ }n return status;} /* netlib_shutdown */  /***++** ROUTINE: netlib_closeg**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.C**** COMPLETION CODES:O****** SIDE EFFECTS: None.****--*//unsigned int netlib_close (struct CTX **xctx) {  struct CTX *ctx; unsigned int status; VERIFY_CTX(xctx, ctx);# status = sys$dassgn(ctx->chan);m# if (!OK(status)) return status;o netlib___free_ctx(ctx);  *xctx = 0; return SS$_NORMAL;} /* netlib_close */ c/***++** ROUTINE: netlib_listen**** FUNCTIONAL DESCRIPTION:t**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.n**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Eunsigned int netlib_listen (struct CTX **xctx, unsigned int *backlog, . struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; int argc;  VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc); if (argc > 2 && iosb != 0) {& iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = 0; iosb->iosb_l_unused = 0;{ } N if (argc > 3 && astadr != 0) sys$dclast(astadr, argc > 4 ? astprm : 0, 0); return SS$_NORMAL;} /* netlib_listen */m /***++** ROUTINE: netlib_accept**** FUNCTIONAL DESCRIPTION:r**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.)**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Dunsigned int netlib_accept (struct CTX **xctx, struct CTX **xnewctx,; struct SINDEF *sa, unsigned int *sasize,lC unsigned int *salen, struct NETLIBIOSBDEF *iosb, 4 void (*astadr)(), void *astprm) { struct CTX *ctx, *newctx;E ITMLST sname;* unsigned int status; int argc;/ VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 2) return SS$_INSFARG;u* if (xnewctx == 0) return SS$_BADPARAM;7 status = netlib___alloc_ctx(&newctx, SPECCTX_SIZE); # if (!OK(status)) return status;a: status = sys$assign(&inetdevice, &newctx->chan, 0, 0);N if (!OK(status)) status = sys$assign(&backup_device, &newctx->chan, 0, 0); if (!OK(status)) { netlib___free_ctx(newctx);; return status;& }r" if (argc > 6 && astadr != 0) { struct IOR *ior;s> GET_IOR(ior, ctx, iosb, astadr, (argc > 7) ? astprm : 0);1 ior->spec_userfrom = (sasize == 0) ? 0 : sa;s4 ior->spec_length = (sasize == 0) ? 0 à, NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.C;57X~ÆnK: *sasize; ior->spec_retlen = salen;! ior->spec_xnewctx = xnewctx;e ior->spec_newctx = newctx;r' ior->iorflags = IOR_M_NEW_CONTEXT;M@ status = sys$qio(netlib_asynch_efn, newctx->chan, IO__OPEN,2 &ior->iosb, io_completion, ior,5 0, 0, ctx->specctx->local_port, 0, ' CMU_K_PROTO_TCP, 0);!$ if (!OK(status)) FREE_IOR(ior); } else {! struct NETLIBIOSBDEF myiosb;c@ status = sys$qiow(netlib_synch_efn, newctx->chan, IO__OPEN,' &myiosb, 0, 0, 0, 0,oD ctx->specctx->local_port, 0, CMU_K_PROTO_TCP, 0);; if (OK(status)) status = netlib___cvt_status(&myiosb); A if (argc > 5 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);  if (OK(status)) { *xnewctx = newctx;=2 if (argc > 3 && sa != 0 && sasize != 0) {: status = netlib_getpeername(&newctx, sa, sasize,9 (argc > 4) ? salen : 0, 0, 0, 0); 4 if (!OK(status)) sys$dassgn(newctx->chan); } } }i, if (!OK(status)) netlib___free_ctx(ctx); return status;} /* netlib_accept */g /***++** ROUTINE: netlib_setsockopt**** FUNCTIONAL DESCRIPTION:***** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.e**** COMPLETION CODES:******* SIDE EFFECTS: None.****--*/2unsigned int netlib_setsockopt (struct CTX **xctx,= unsigned int *level, unsigned int *option,n5 void *value, unsigned int *vallen, . struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status, lev;t int argc;  VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG; F if (option == 0 || value == 0 || vallen == 0) return SS$_BADPARAM;0 if (level == 0) lev = NETLIB_K_LEVEL_SOCKET; else lev = *level; if (argc > 5 && iosb != 0) {& iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = 0; iosb->iosb_l_unused = 0;r }sN if (argc > 6 && astadr != 0) sys$dclast(astadr, argc > 7 ? astprm : 0, 0); return SS$_NORMAL;} /* netlib_setsockopt */  T/***++** ROUTINE: netlib_getsockopt**** FUNCTIONAL DESCRIPTION:y**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.!**** COMPLETION CODES:****** SIDE EFFECTS: None.****--*/2unsigned int netlib_getsockopt (struct CTX **xctx,= unsigned int *level, unsigned int *option,06 void *value, unsigned int *valsize,( unsigned int *vallen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; unsigned int status, lev;r int argc;r VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG;0G if (option == 0 || value == 0 || valsize == 0) return SS$_BADPARAM;o0 if (level == 0) lev = NETLIB_K_LEVEL_SOCKET; else lev = *level;- if (argc > 5 && vallen != 0) *vallen = 0;_ if (argc > 6 && iosb != 0) {& iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = 0; iosb->iosb_l_unused = 0;  } N if (argc > 7 && astadr != 0) sys$dclast(astadr, argc > 8 ? astprm : 0, 0); return SS$_NORMAL;} /* netlib_getsockopt */$ w/***++#** ROUTINE: netlib_name_to_address,**** FUNCTIONAL DESCRIPTION:i**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.**** COMPLETION CODES:O****** SIDE EFFECTS: None.****--*/Munsigned int netlib_name_to_address (struct CTX **xctx, unsigned int *whichp,b1 struct dsc$descriptor *namdsc,n. struct INADDRDEF *addrlist,? unsigned int *listsize, unsigned int *count,*. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; struct CMU_NtoA ntoa; struct INADDRDEF addr; struct NETLIBIOSBDEF myiosb; unsigned int status; unsigned short namlen; char *namp, nambuf[256]; int argc;c VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG;BK if (namdsc == 0 || addrlist == 0 || listsize == 0) return SS$_BADPARAM;t. if (OK(netlib_strtoaddr(namdsc, &addr))) { addrlist[0] = addr;, if (argc > 5 && count != 0) *count = 1;! if (argc > 6 && iosb != 0) {X* iosb->iosb_w_status = SS$_NORMAL; iosb->iosb_w_count = 1;! iosb->iosb_l_unused = 0;s }# if (argc > 7 && astadr != 0) {s? return sys$dclast(astadr, (argc > 8) ? astprm : 0, 0);f } else {M return SS$_NORMAL;B } }e if (bypass_cmu_resolver()) {G return netlib___dns_name_to_addr(ctx, namdsc, addrlist, *listsize,>! (argc > 5) ? count : 0, ! (argc > 6) ? iosb : 0,O" (argc > 7) ? astadr : 0,# (argc > 8) ? astprm : 0); } 7 status = lib$analyze_sdesc(namdsc, &namlen, &namp);P# if (!OK(status)) return status;e= if (namlen > sizeof(nambuf)-1) namlen = sizeof(nambuf)-1;;! memcpy(nambuf, namp, namlen);; nambuf[namlen] = '\0';" if (argc > 7 && astadr != 0) { struct IOR *ior;*> GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0);@ status = lib$get_vm(&addr_info_size, &ior->spec_addr_info); if (!OK(status)) {  FREE_IOR(ior);s return status;P }" ior->spec_userbuf = addrlist;" ior->spec_length = *listsize; ior->spec_retlen = count;& ior->iorflags = IOR_M_COPY_ADDRS;J status = sys$qio(netlib_asynch_efn, ctx->chan, IO__GTHST, &ior->iosb,& io_completion, ior,8 &ior->spec_addr_info, addr_info_size,7 CMU_K_GTHST_NAMEADDR, nambuf, 0, 0);R if (!OK(status)) {(< lib$free_vm(&addr_info_size, &ior->spec_addr_info); FREE_IOR(ior);S } return status;b }_F status = sys$qiow(netlib_synch_efn, ctx->chan, IO__GTHST, &myiosb,) 0, 0, &ntoa, sizeof(ntoa),s3 CMU_K_GTHST_NAMEADDR, nambuf, 0, 0);x: if (OK(status)) status = netlib___cvt_status(&myiosb);@ if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); if (OK(status)) { int i;s? for (i = 0; i < *listsize && i < ntoa.ntoa_l_count; i++) {O+ addrlist[i] = ntoa.ntoa_x_addr[i];  }, if (argc > 5 && count != 0) *count = i; }i return status; } /* netlib_name_to_address */ /***++#** ROUTINE: netlib_address_to_namey**** FUNCTIONAL DESCRIPTION:,**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.i**** COMPLETION CODES:e****** SIDE EFFECTS: None.****--*/Munsigned int netlib_address_to_name (struct CTX **xctx, unsigned int *whichp,** struct INADDRDEF *addr,* unsigned int *addrsize,1 struct dsc$descriptor *namdsc,** à- NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.C;57X~[÷Z unsigned short *retlen,. struct NETLIBIOSBDEF *iosb,4 void (*astadr)(), void *astprm) { struct CTX *ctx; struct NETLIBIOSBDEF myiosb; struct CMU_AtoN aton;  unsigned int status; int argc;n VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 5) return SS$_INSFARG;r if (bypass_cmu_resolver()) {C return netlib___dns_addr_to_name(ctx, addr, *addrsize, namdsc, " (argc > 5) ? retlen : 0," (argc > 6) ? iosb : 0," (argc > 7) ? astadr : 0,# (argc > 8) ? astprm : 0);y }SG if (addr == 0 || addrsize == 0 || namdsc == 0) return SS$_BADPARAM;nC if (*addrsize != sizeof(struct INADDRDEF)) return SS$_BADPARAM;0" if (argc > 7 && astadr != 0) { struct IOR *ior;c> GET_IOR(ior, ctx, iosb, astadr, (argc > 8) ? astprm : 0);@ status = lib$get_vm(&name_info_size, &ior->spec_name_info); if (!OK(status)) {w FREE_IOR(ior);h return status;  } ior->spec_userbuf = namdsc;0 ior->spec_retlen = (unsigned int *) retlen;) ior->iorflags = IOR_M_COPY_HOSTNAME;sJ status = sys$qio(netlib_asynch_efn, ctx->chan, IO__GTHST, &ior->iosb,& io_completion, ior,7 ior->spec_name_info, name_info_size,&D CMU_K_GTHST_ADDRNAME, addr->inaddr_l_addr, 0, 0); if (!OK(status)) {s< lib$free_vm(&name_info_size, &ior->spec_name_info); FREE_IOR(ior);  } return status;n }sF status = sys$qiow(netlib_synch_efn, ctx->chan, IO__GTHST, &myiosb,) 0, 0, &aton, sizeof(aton), @ CMU_K_GTHST_ADDRNAME, addr->inaddr_l_addr, 0, 0);: if (OK(status)) status = netlib___cvt_status(&myiosb);@ if (argc > 6 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); if (OK(status)) { @ str$copy_r(namdsc, &aton.aton_l_namelen, aton.aton_t_name);! if (argc > 5 && retlen != 0) ' *retlen = aton.aton_l_namelen;O }B return status;} /* netlib_address_to_name */ c/***++ ** ROUTINE: netlib_get_hostname**** FUNCTIONAL DESCRIPTION:d**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.O**** COMPLETION CODES: ****** SIDE EFFECTS: None.****--*/Junsigned int netlib_get_hostname (void *bufdsc, unsigned short *retlenp) { char buf[256]; ITMLST lnmlst[2];I unsigned int status; unsigned short retlen; int argc;_- static $DESCRIPTOR(tabnam, "LNM$SYSTEM"); 5 static $DESCRIPTOR(lognam, "INTERNET_HOST_NAME");  SETARGCOUNT(argc);C ITMLST_INIT(lnmlst[0], LNM$_STRING, sizeof(buf), buf, &retlen); ' ITMLST_INIT(lnmlst[1], 0, 0, 0, 0);d8 status = sys$trnlnm(0, &tabnam, &lognam, 0, lnmlst);> if (OK(status)) status = str$copy_r(bufdsc, &retlen, buf);# if (!OK(status)) return status;4 if (argc > 1 && retlenp != 0) *retlenp = retlen; return SS$_NORMAL;} /* netlib_get_hostname */{ /***++%** ROUTINE: netlib___get_nameserversS**** FUNCTIONAL DESCRIPTION:_**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:;****** SIDE EFFECTS: None.****--*/+int netlib___get_nameservers (QUEUE *nsq) {i struct NAMESERVER *ns; struct INADDRDEF a;  struct CTX *tmpctx;n) struct dsc$descriptor dsc, lognamdsc;. ITMLST lnmlst[4]; . char name[256], lognam[256], *cp, *anchor;& unsigned int status, size, maxidx; unsigned short namlen; int index, i, remain;! static unsigned int one = 1;: static $DESCRIPTOR(nameserver_tabnam, "LNM$FILE_DEV"); tmpctx = 0;eA ITMLST_INIT(lnmlst[0], LNM$_INDEX, sizeof(index), &index, 0);:E ITMLST_INIT(lnmlst[1], LNM$_STRING, sizeof(name), name, &namlen);P' ITMLST_INIT(lnmlst[2], 0, 0, 0, 0);:% INIT_SDESC(lognamdsc, 0, lognam);+ for (index = 0; index <= 16; index++) {FK lognamdsc.dsc$w_length = sprintf(lognam, "NETLIB_NAMESERVERS", index);)G status = sys$trnlnm(0, &nameserver_tabnam, &lognamdsc, 0, lnmlst); . if (!OK(status) || namlen == 0) continue;5 for (anchor = name, remain = namlen; remain > 0;*8 remain -= i+1, anchor = cp+1) {* cp = memchr(anchor, ',', remain);! if (cp == 0) i = remain;r else i = cp - anchor;$ INIT_SDESC(dsc, i, anchor);/ if (!OK(netlib_strtoaddr(&dsc, &a))) { if (tmpctx == 0) {> if (!OK(netlib_socket(&tmpctx, 0, 0))) continue; }(G if (!OK(netlib_name_to_address(&tmpctx, 0, &dsc, &a, &one, 0,L( 0, 0, 0))) continue; }* size = sizeof(struct NAMESERVER);) status = lib$get_vm(&size, &ns); if (!OK(status)) break; ns->addr = a;% queue_insert(ns, nsq->tail);c } }+ if (tmpctx != 0) netlib_close(&tmpctx);  return index; } /* netlib___get_nameservers */ x/***++ ** ROUTINE: netlib___get_domain**** FUNCTIONAL DESCRIPTION:0**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:0****** SIDE EFFECTS: None.****--*/Uint netlib___get_domain (char *buf, unsigned short bufsize, unsigned short *retlen) { struct dsc$descriptor dsc; ITMLST lnmlst[2]; char name[256], *cp; unsigned int status; unsigned short namlen;3 static $DESCRIPTOR(lognamdsc, "NETLIB_DOMAIN");e/ static $DESCRIPTOR(tabnam, "LNM$FILE_DEV");E ITMLST_INIT(lnmlst[0], LNM$_STRING, sizeof(name), name, &namlen);C' ITMLST_INIT(lnmlst[1], 0, 0, 0, 0); ; status = sys$trnlnm(0, &tabnam, &lognamdsc, 0, lnmlst);  if (OK(status)) cp = name; else {) INIT_SDESC(dsc, sizeof(name), name);C; if (!OK(netlib_get_hostname(&dsc, &namlen))) return 0;f$ cp = memchr(name, '.', namlen); if (cp == 0) return 0; cp += 1; namlen -= (cp - name);* }_/ if (memchr(cp, '.', namlen) == 0) return 0;/ if (namlen > bufsize-1) namlen = bufsize-1;* memcpy(buf, cp, namlen); *retlen = namlen; return 1;*} /* netlib___get_domain */ /***++ ** ROUTINE: netlib___cvt_status**** FUNCTIONAL DESCRIPTION:I**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:r****** SIDE EFFECTS: None.****--*/Fstatic unsigned int netlib___cvt_status (struct NETLIBIOSBDEF *iosb) { struct CMUIosb *cmuiosb;E if (iosb->iosb_w_status != SS$_ABORT) return iosb->iosb_w_status;i& cmuiosb = (struct CMUIosb *) iosb;" switch (cmuiosb->cmu_status) { case NET$_IR: case NET$_UCT:  case NET$_CSE: case NET$_VTF:* return SS$_INSFMEM; case NET$_IFC:* case NET$_IPC:I case NET$_IFS:* case NET$_ILP:a case NET$_NUC:e case NET$_CIP:l case NET$_CDE:: case NET$_FSU:* return SS$_BADPARAM;* case NET$_NOPRV:e case NET$_NOINA:C case NET$_NOANA:E return SS$_NOPRIV; case NET$_Cà. NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.C;57X~ÿiC: case NET$_CR: case NET$_CCAN: case NET$_KILL: return SS$_LINKDISCON;n case NET$_UNN:  case NET$_UNA:e case NET$_UNU:N return SS$_IVADDR;  case NET$_BTS:a return SS$_IVBUFLEN;u case NET$_URC:E case NET$_NRT: return SS$_UNREACHABLE; case NET$_CTO:C case NET$_TWT:E case NET$_FTO:  case NET$_NMLTO:S return SS$_TIMEOUT; case NET$_TE: case NET$_NSEXIT: return SS$_SHUT;E case NET$_DSNOADDR: case NET$_DSNONAME: case NET$_DSNAMERR: case NET$_DSREFEXC: return SS$_ENDOFFILE; case NET$_CREF: return SS$_REJECT;, default:O return SS$_ABORT; }n} /* netlib___cvt_status */ /***++** ROUTINE: netlib___cvt_iosb**** FUNCTIONAL DESCRIPTION:T**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None. **** COMPLETION CODES:c****** SIDE EFFECTS: None.****--*/9static void netlib___cvt_iosb (struct NETLIBIOSBDEF *dst,$0 struct NETLIBIOSBDEF *src) {2 dst->iosb_w_status = netlib___cvt_status(src);* dst->iosb_w_count = src->iosb_w_count; dst->iosb_l_unused = 0;U} /* netlib___cvt_iosb */! s/***++ ** ROUTINE: netlib_dns_mxlookup**** FUNCTIONAL DESCRIPTION: **** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.(**** COMPLETION CODES:c****** SIDE EFFECTS: None.****--*/4unsigned int netlib_dns_mx_lookup(struct CTX **xctx,B struct dsc$descriptor *namdsc, struct MXRRDEF *mxrr,> unsigned int *mxrrsize, unsigned int *mxrrcount,K struct NETLIBIOSBDEF *iosb, void (*astadr)(), void *astprm) {  struct CTX *ctx; struct IOR *ior; struct NETLIBIOSBDEF myiosb; struct CMU_RR rr_info; char *namp, nambuf[256]; unsigned short namlen; unsigned int status; int argc;n VERIFY_CTX(xctx, ctx); SETARGCOUNT(argc);% if (argc < 4) return SS$_INSFARG;lG if (namdsc == 0 || mxrr == 0 || mxrrsize == 0) return SS$_BADPARAM;s if (bypass_cmu_resolver()) {@ return netlib___dns_mx_lookup(xctx, namdsc, mxrr, mxrrsize,< (argc > 4) ? mxrrcount : 0, (argc > 5) ? iosb : 0,< (argc > 6) ? astadr : 0, (argc > 7) ? astprm : 0); }v7 status = lib$analyze_sdesc(namdsc, &namlen, &namp); # if (!OK(status)) return status; = if (namlen > sizeof(nambuf)-2) namlen = sizeof(nambuf)-2;a! memcpy(nambuf, namp, namlen);t+ if (memchr(nambuf, '.', namlen) != 0) { 9 if (nambuf[namlen-1] != '.') nambuf[namlen++] = '.';( } nambuf[namlen] = '\0'; " if (argc > 6 && astadr != 0) {> GET_IOR(ior, ctx, iosb, astadr, (argc > 6) ? astprm : 0);< status = lib$get_vm(&rr_info_size, &ior->spec_rr_info); if (!OK(status)) {{ FREE_IOR(ior);s return status;- }! ior->spec_userbuf = mxrr;d" ior->spec_length = *mxrrsize;" ior->spec_retlen = mxrrcount;& ior->iorflags = IOR_M_COPY_MXRRS;J status = sys$qio(netlib_asynch_efn, ctx->chan, IO__GTHST, &ior->iosb,5 io_completion, ior, ior->spec_rr_info,t rr_info_size,% CMU_K_GTHST_DNSLOOKUP,v0 nambuf, NETLIB_K_DNS_TYPE_MX, 0); if (!OK(status)) {8 lib$free_vm(&rr_info_size, &ior->spec_rr_info); FREE_IOR(ior);  } return status;n }nF status = sys$qiow(netlib_synch_efn, ctx->chan, IO__GTHST, &myiosb,/ 0, 0, &rr_info, sizeof(rr_info),i% CMU_K_GTHST_DNSLOOKUP, 0 nambuf, NETLIB_K_DNS_TYPE_MX, 0);: if (OK(status)) status = netlib___cvt_status(&myiosb);@ if (argc > 5 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb); if (OK(status)) {n unsigned int i, len;x int remain; unsigned char *cp;f cp = rr_info.rr_x_data + 1;& remain = rr_info.rr_w_length - 1; i = 0;t* while (remain > 0 && i < *mxrrsize) {. len = *(unsigned short *)cp; cp += 2;< mxrr[i].mxrr_l_preference = *(unsigned short *) cp;@ expand(mxrr[i].mxrr_t_name, NETLIB_S_MXRR_NAME, cp + 2,' &mxrr[i].mxrr_l_length);i remain -= len + 2;  cp += len;a i++;l }4 if (argc > 4 && mxrrcount != 0) *mxrrcount = i; }  return status;} /* netlib_dns_mx_lookup */ i/***++** ROUTINE: x**** FUNCTIONAL DESCRIPTION:***** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.***** COMPLETION CODES:******* SIDE EFFECTS: None.****--*/3static void expand (char *out, unsigned int maxlen,i5 unsigned char *in, unsigned int *len) {i unsigned char *cp; char *cp1; unsigned int i; cp1 = out; cp = in; while ((cp1-out) < maxlen) { i = *cp++;s if (i == 0) break;," if (cp1 != out) *cp1++ = '.';' if ((cp1-out) + i > maxlen) break;; memcpy(cp1, cp, i); cp1 += i; cp += i; }u *len = (cp1 - out); } /* expand */ ;/***++ ** ROUTINE: bypass_cmu_resolver**** FUNCTIONAL DESCRIPTION:**** tbs**B** RETURNS: cond_value, longword (unsigned), write only, by value**** PROTOTYPE:**** tbs**** IMPLICIT INPUTS: None.**** IMPLICIT OUTPUTS: None.K**** COMPLETION CODES:a****** SIDE EFFECTS: None.****--*/'static int bypass_cmu_resolver (void) {a! static unsigned int zero = 0;s/ static $DESCRIPTOR(tabnam, "LNM$FILE_DEV");s= static $DESCRIPTOR(lognam, "NETLIB_BYPASS_CMU_RESOLVER"); 9 return OK(sys$trnlnm(0, &tabnam, &lognam, 0, &zero));a} /* bypass_cmu_resolver */ ÿÿ;f } else {M return SS$_NORMAL;B } }e if (bypass_cmu_resolver()) {G return netlib___dns_name_to_addr(ctx, namdsc, addrlist, *listsize,>! (argc > 5) ? count : 0, ! (argc > 6) ? iosb : 0,O" (argc > 7) ? astadr : 0,# (argc > 8) ? astprm : 0); } 7 status = lib$analyze_sdesc(namdsc, &namlen, &namp);P# if (!OK(status)) return status;e= if (namlen > sizeof(nambuf)-1) namà/ NETLIB_SRC.BCK!ç ETLIB]NETLIB_VECTOR.MAR;4DnMð*[NETLIB]NETLIB_VECTOR.MAR;4+,!./€ 4D²-ç 0ª123KÿPWO56ê¦ÁÇÞ›7€¨ÏÇÞ›89¹AJ(ú›G€HˆªJÿ  .TITLE NETLIB_VECTOR .IDENT /V2.1/;; FACILITY: NETLIB;D; ABSTRACT: This module defines the transfer vectors for the NETLIB0; common network routines library.;; AUTHOR: M. Madison;; MODIFICATION HISTORY:;0; 28-JAN-1991 V1.0 Madison Initial coding.;; 04-DEC-1991 V1.1 Madison Add NET_SET_TRACE_ROUTINE.2; 24-OCT-1994 V2.0 Madison All new for V2.0.6; 27-NOV-1997 V2.1 Madison Added NETLIB_VERSION.; .DISABLE GLOBAL;,; Macro to generate a transfer vector entry.; .MACRO ROUTINE NAME .EXTRN NAME .ALIGN QUAD .TRANSFER NAME .MASK NAME JMP NAME+2 .ENDM; .PSECT $$NETLIB_VECTOR -, PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT,QUAD;,; Old routines - for compatibility with V1; ROUTINE NET_ASSIGN ROUTINE NET_BIND ROUTINE NET_DEASSIGN ROUTINE NET_GET_ADDRESS ROUTINE NET_ADDR_TO_NAME ROUTINE NET_GET_INFO ROUTINE NET_GET_HOSTNAME; ROUTINE TCP_CONNECT ROUTINE TCP_CONNECT_ADDR ROUTINE TCP_DISCONNECT ROUTINE TCP_ACCEPT ROUTINE TCP_SEND ROUTINE TCP_RECEIVE ROUTINE TCP_GET_LINE; ROUTINE UDP_SEND ROUTINE UDP_RECEIVE ROUTINE DNS_MXLOOK ROUTINE NET_SET_TRACE_ROUTINE;; New, Improved Routines !; ROUTINE NETLIB_SOCKET ROUTINE NETLIB_SERVER_SETUP ROUTINE NETLIB_BIND ROUTINE NETLIB_GETSOCKNAME ROUTINE NETLIB_GETPEERNAME ROUTINE NETLIB_CONNECT ROUTINE NETLIB_WRITE ROUTINE NETLIB_WRITELINE ROUTINE NETLIB_READ ROUTINE NETLIB_READLINE ROUTINE NETLIB_SHUTDOWN ROUTINE NETLIB_CLOSE ROUTINE NETLIB_LISTEN ROUTINE NETLIB_ACCEPT ROUTINE NETLIB_GET_HOSTNAME ROUTINE NETLIB_SETSOCKOPT ROUTINE NETLIB_GETSOCKOPT# ROUTINE NETLIB_NAME_TO_ADDRESS# ROUTINE NETLIB_ADDRESS_TO_NAME ROUTINE NETLIB_DNS_QUERY ROUTINE NETLIB_DNS_SKIPNAME" ROUTINE NETLIB_DNS_EXPANDNAME ROUTINE NETLIB_STRTOADDR ROUTINE NETLIB_ADDRTOSTR# ROUTINE NETLIB_CONNECT_BY_NAME! ROUTINE NETLIB_DNS_MX_LOOKUP ROUTINE NETLIB_HTON_LONG ROUTINE NETLIB_NTOH_LONG ROUTINE NETLIB_HTON_WORD ROUTINE NETLIB_NTOH_WORD ROUTINE NETLIB_VERSION; .ENDÿÿà0 NETLIB_SRC.BCKç [NETLIB]NETLIB_SHRXFR.MAR;12C{"ð*[NETLIB]NETLIB_SHRXFR.MAR;12+,./€ 4C„-ç 0ª123KÿPWO56‰±÷ÆÞ›7fô%÷ÆÞ›89¹AJ(ú›G€HˆªJÿ  .TITLE NETLIB_SHRXFR .IDENT /V2.1/;; FACILITY: NETLIB;; ABSTRACT: tbs;; AUTHOR: M. Madison;; MODIFICATION HISTORY:;2; 24-OCT-1994 V2.0 Madison All new for V2.0.4; 27-NOV-1997 V2.1 Madison Add NETLIB_VERSION.;0 .NTYPE R22TYPE,R22 ; get symbol type for "R22"0R22TYPE = -5 ; type 5 = register .IF EQ,R22TYPEEVAX = 1 BIGPAGE = 1ADDRESSBITS = 32 .ENDC .DISABLE GLOBAL .EXTRN LIB$FIND_IMAGE_SYMBOL4 .PSECT $$$COPYRIGHT,SHR,NOEXE,RD,NOWRT,PIC,GBL,QUADC .ASCII /Copyright © 1994, MadGoat Software. All Rights Reserved./1 .PSECT DATAPSECT,NOSHR,NOEXE,RD,WRT,PIC,GBL,QUADIMGNAM: .ASCID /NETLIB_SHR// .PSECT CODEPSECT,SHR,EXE,RD,NOWRT,PIC,GBL,QUAD;,; Macro to generate a transfer vector entry.; .MACRO ROUTINE NAME .PSECT DATAPSECT .ALIGN LONG NAME'_PTR: .LONG 0 NAME'_STR: .ASCID /NAME/ .PSECT CODEPSECT .IF DF,EVAX-NAME:: .CALL_ENTRY MAX_ARGS=14,HOME_ARGS=TRUE .IFF .ENTRY NAME,^M<> .ENDC TSTL NAME'_PTR BNEQ 5$ PUSHAL NAME'_PTR PUSHAQ NAME'_STR PUSHAQ IMGNAM! CALLS #3,G^LIB$FIND_IMAGE_SYMBOL BLBC R0,10$5$: CALLG (AP),@NAME'_PTR10$: RET .ENDM;,; Old routines - for compatibility with V1; ROUTINE NET_ASSIGN ROUTINE NET_BIND ROUTINE NET_DEASSIGN ROUTINE NET_GET_ADDRESS ROUTINE NET_ADDR_TO_NAME ROUTINE NET_GET_INFO ROUTINE NET_GET_HOSTNAME; ROUTINE TCP_CONNECT ROUTINE TCP_CONNECT_ADDR ROUTINE TCP_DISCONNECT ROUTINE TCP_ACCEPT ROUTINE TCP_SEND ROUTINE TCP_RECEIVE ROUTINE TCP_GET_LINE; ROUTINE UDP_SEND ROUTINE UDP_RECEIVE ROUTINE DNS_MXLOOK ROUTINE NET_SET_TRACE_ROUTINE;; New, Improved Routines !; ROUTINE NETLIB_SOCKET ROUTINE NETLIB_SERVER_SETUP ROUTINE NETLIB_BIND ROUTINE NETLIB_GETSOCKNAME ROUTINE NETLIB_GETPEERNAME ROUTINE NETLIB_CONNECT ROUTINE NETLIB_WRITE ROUTINE NETLIB_WRITELINE ROUTINE NETLIB_READ ROUTINE NETLIB_READLINE ROUTINE NETLIB_SHUTDOWN ROUTINE NETLIB_CLOSE ROUTINE NETLIB_LISTEN ROUTINE NETLIB_ACCEPT ROUTINE NETLIB_GET_HOSTNAME ROUTINE NETLIB_SETSOCKOPT ROUTINE NETLIB_GETSOCKOPT# ROUTINE NETLIB_NAME_TO_ADDRESS# ROUTINE NETLIB_ADDRESS_TO_NAME ROUTINE NETLIB_DNS_QUERY ROUTINE NETLIB_DNS_SKIPNAME" ROUTINE NETLIB_DNS_EXPANDNAME ROUTINE NETLIB_STRTOADDR ROUTINE NETLIB_ADDRTOSTR# ROUTINE NETLIB_CONNECT_BY_NAME! ROUTINE NETLIB_DNS_MX_LOOKUP ROUTINE NETLIB_HTON_LONG ROUTINE NETLIB_NTOH_LONG ROUTINE NETLIB_HTON_WORD ROUTINE NETLIB_NTOH_WORD ROUTINE NETLIB_VERSION .ENDÿÿà1 NETLIB_SRC.BCKç [NETLIB]NETLIB_SRI.H;69ŸØð*[NETLIB]NETLIB_SRI.H;6+,./€ 49-ç 0ª123KÿPWO56Þ„Æëny˜7Þ¹Òëny˜8÷êvš9¹AJ(ú›G€HˆªJÿ#ifndef __NETLIB_SRI_H__#define __NETLIB_SRI_H__#ifndef __NETLIB_BUILD__#define __NETLIB_BUILD__#endif#include "netlibdef.h"#include ##define IOR_M_COPY_LENGTH (1<<16)##define IOR_M_COPY_FROM (1<<17)##define IOR_M_NEW_CONTEXT (1<<18)##define IOR_M_COPY_FROM2 (1<<19)$#define IOR_M_CHECK_LENGTH (1<<20)(#define spec_retlen arg[0].address)#define spec_length arg[1].longword)#define spec_userfrom arg[2].address+#define spec_newctx arg[3].address(#define spec_xnewctx arg[4].address#define __SPECCTX void#define SPECCTX_SIZE 0 struct SPECIOR { struct { unsigned short length; struct SINDEF address; } from; struct { unsigned int length; struct SINDEF address; } from2; }; #define __SPECIOR struct SPECIOR#define IO$S_FCODE 6 #define IO$_SEND (IO$_WRITEVBLK)"#define IO$_RECEIVE (IO$_READVBLK)3#define IO$_SOCKET (IO$_ACCESS | (0 << IO$S_FCODE))1#define IO$_BIND (IO$_ACCESS | (1 << IO$S_FCODE))3#define IO$_LISTEN (IO$_ACCESS | (2 << IO$S_FCODE))3#define IO$_ACCEPT (IO$_ACCESS | (3 << IO$S_FCODE))4#define IO$_CONNECT (IO$_ACCESS | (4 << IO$S_FCODE))7#define IO$_SETSOCKOPT (IO$_ACCESS | (5 << IO$S_FCODE))7#define IO$_GETSOCKOPT (IO$_ACCESS | (6 << IO$S_FCODE))2#define IO$_IOCTL (IO$_ACCESS | (8 << IO$S_FCODE))9#define IO$_ACCEPT_WAIT (IO$_ACCESS | (10 << IO$S_FCODE))9#define IO$_NETWORK_PTY (IO$_ACCESS | (11 << IO$S_FCODE))6#define IO$_SHUTDOWN (IO$_ACCESS | (12 << IO$S_FCODE))9#define IO$_GETSOCKNAME (IO$_ACCESS | (13 << IO$S_FCODE))9#define IO$_GETPEERNAME (IO$_ACCESS | (15 << IO$S_FCODE))4#define IO$_SELECT (IO$_ACCESS | (17 << IO$S_FCODE))#endif /* __NETLIB_SRI_H__ */ÿÿà2 NETLIB_SRC.BCKç ETLIB]NETLIB_MULTINET.H;2@QVð*[NETLIB]NETLIB_MULTINET.H;2+,./€ 4@T-ç 0ª123KÿPWO56$‹uPl˜7üì›uPl˜8¿8¼évš9¹AJ(ú›G€HˆªJÿ#ifndef __NETLIB_MULTINET_H__#define __NETLIB_MULTINET_H__/*** NETLIB_MULTINET.H**;** MultiNet-specific definitions for NETLIB_SRI_SUPPORT.C.**** 25-OCT-1994*/@ static char *socket_library[] = {"MULTINET_SOCKET_LIBRARY"};@ static char *nameserver_lognam[] = {"MULTINET_NAMESERVERS"};5 static char *gethostname_ent[] = {"GETHOSTNAME"};; static char *_gethostbyname_ent[] = {"_GETHOSTBYNAME"};; static char *_gethostbyaddr_ent[] = {"_GETHOSTBYADDR"};< static char *domain_lognam[] = {"MULTINET_LOCALDOMAIN"};"#endif /* __NETLIB_MULTINET_H__ */ÿÿà3 NETLIB_SRC.BCKç [NETLIB]NETLIB_TCPWARE.H;3TâÏð*[NETLIB]NETLIB_TCPWARE.H;3+,./€ 4TÈ-ç 0ª123KÿPWO56 ˆ=or˜7ìP$=or˜8<¯@êvš9¹AJ(ú›G€HˆªJÿ#ifndef __NETLIB_TCPWARE_H__#define __NETLIB_TCPWARE_H__/*** NETLIB_TCPWARE.H**:** TCPware-specific definitions for NETLIB_SRI_SUPPORT.C.**** 25-OCT-1994*/M static char *socket_library[] = {"TCPWARE_SOCKLIB_SHR", "TCPIP_SOCKLIB"};T static char *nameserver_lognam[] = {"TCPWARE_NAMESERVERS", "TCPIP_NAMESERVERS"};L static char *gethostname_ent[] = {"TCPWARE_GETHOSTNAME", "GETHOSTNAME"};S static char *_gethostbyname_ent[] = {"TCPWARE_GETHOSTBYNAME", "GETHOSTBYADDR"};S static char *_gethostbyaddr_ent[] = {"TCPWARE_GETHOSTBYADDR", "GETHOSTBYNAME"};P static char *domain_lognam[] = {"TCPWARE_LOCALDOMAIN", "TCPIP_LOCALDOMAIN"};!#endif /* __NETLIB_TCPWARE_H__ */ÿÿà4 NETLIB_SRC.BCKç [NETLIB]NETLIB_PATHWAY.H;6@¶äð*[NETLIB]NETLIB_PATHWAY.H;6+,./€ 4@4-ç 0ª123KÿPWO56ns;|™7®µJ|™8}kËévš9¹AJ(ú›G€HˆªJÿ#ifndef __NETLIB_PATHWAY_H__#define __NETLIB_PATHWAY_H__/*** NETLIB_PATHWAY.H**:** TCPware-specific definitions for NETLIB_SRI_SUPPORT.C.**** 25-OCT-1994*// static char *socket_library[] = {"TWGLIB"};@ static char *nameserver_lognam[] = {"INET_NAMESERVER_LIST"};5 static char *gethostname_ent[] = {"GETHOSTNAME"};: static char *_gethostbyname_ent[] = {"GETHOSTBYNAME"};: static char *_gethostbyaddr_ent[] = {"GETHOSTBYADDR"};8 static char *domain_lognam[] = {"INET_DOMAIN_NAME"};!#endif /* __NETLIB_PATHWAY_H__ */ÿÿà5 NETLIB_SRC.BCKç [NETLIB]NETLIB_UCX.H;6:!¤ð*[NETLIB]NETLIB_UCX.H;6+,./€ 4:-ç 0ª123KÿPWO56ÿN>ž”š7öA\>ž”š89¹AJ(ú›G€HˆªJÿ#ifndef __NETLIB_UCX_H__#define __NETLIB_UCX_H__#ifndef __NETLIB_BUILD__#define __NETLIB_BUILD__#endif#include "netlibdef.h"#include #include "ucx$inetdef.h" typedef struct item_list_2 {# unsigned short bufsiz, itmcod; void *bufadr; } ITMLST2;'#define ITMLST2_INIT(_i, _c, _s, _a) {\: _i.bufsiz = (_s); _i.itmcod = (_c); _i.bufadr = (_a);}(#define spec_retlen arg[0].address%#define spec_length arg[1].word)#define spec_userfrom arg[2].address+#define spec_newctx arg[3].address(#define spec_xnewctx arg[4].address(#define spec_hostent arg[4].address*#define spec_useralist arg[5].address(#define spec_usrdsc arg[5].address##define IOR_M_COPY_LENGTH (1<<16)##define IOR_M_COPY_FROM (1<<17)##define IOR_M_NEW_CONTEXT (1<<18)##define IOR_M_COPY_ADDRS (1<<19)##define IOR_M_COPY_HOSTNAME (1<<20)#define __SPECCTX void#define SPECCTX_SIZE 0 struct SPECIOR { unsigned short fromlen; unsigned int subfunction; struct SINDEF from; ITMLST2 sockopt; struct {' unsigned short bufsiz, itmcod; void *bufadr, *retlen; } sockopt_get; }; #define __SPECIOR struct SPECIOR struct HOSTENT { unsigned int name_offset;$ unsigned int alias_list_offset; unsigned int addrtype; unsigned int addrlen;" unsigned int addrlist_offset; unsigned char buffer[492]; };#endif /* __NETLIB_UCX_H__ */ÿÿà6 NETLIB_SRC.BCKç [NETLIB]NETLIB_CMU.H;15.¢ð*[NETLIB]NETLIB_CMU.H;15+,./€ 4. -ç 0ª123KÿPWO 56.îÓå|™7nFýÓå|™8úwévš9¹AJ(ú›G€HˆªJÿ#ifndef __NETLIB_CMU_H__#define __NETLIB_CMU_H__#ifndef __NETLIB_BUILD__#define __NETLIB_BUILD__#endif#include "netlibdef.h"#include #define IO__OPEN IO$_CREATE#define IO__CLOSE IO$_DELETE"#define IO__STATUS IO$_ACPCONTROL#define IO__INFO IO$_MODIFY #define IO__GTHST IO$_SKIPFILE #define CMU_K_GTHST_LOCAL_HOST 0#define CMU_K_GTHST_NAMEADDR 1#define CMU_K_GTHST_ADDRNAME 2#define CMU_K_GTHST_DNSLOOKUP 3#define CMU_M_OPEN_ACTIVE 1#define CMU_M_OPEN_UDPDATA 1#define CMU_M_OPEN_NOWAIT 2#define CMU_M_OPEN_BYADDRESS 4#define CMU_K_PROTO_TCP 0#define CMU_K_PROTO_UDP 1 struct CMU_ConnInfo {$ unsigned char ci_b_remote_host;# unsigned char ci_b_local_host;! char ci_t_foreign_host[128]; unsigned short ci_w_fill1;# unsigned int ci_l_remote_port; char ci_t_local_host[128];" unsigned int ci_l_local_port;) struct INADDRDEF ci_x_local_address;* struct INADDRDEF ci_x_remote_address; }; struct CMU_IPAddr {$ struct INADDRDEF ipa_x_srcaddr;$ struct INADDRDEF ipa_x_dstaddr;" unsigned short ipa_w_srcport;" unsigned short ipa_w_dstport; unsigned int ipa_l_fill1; }; struct CMU_NtoA { unsigned int ntoa_l_count;& struct INADDRDEF ntoa_x_addr[20];! unsigned int ntoa_l_namelen; char ntoa_t_name[128]; }; struct CMU_AtoN {! unsigned int aton_l_namelen; char aton_t_name[128]; }; struct CMU_RR { unsigned short rr_w_length;" unsigned char rr_x_data[512]; }; struct CMUIosb { unsigned short status; unsigned short count; unsigned long cmu_status; }; #define __SPECCTX struct SPECCTX struct SPECCTX { unsigned int socket_type; unsigned int flags;"#define SPECCTX_M_OPEN (1<<0), unsigned short local_port, remote_port;. struct INADDRDEF local_addr, remote_addr; };-#define SPECCTX_SIZE (sizeof(struct SPECCTX))(#define spec_retlen arg[0].address%#define spec_length arg[1].word)#define spec_userfrom arg[2].address+#define spec_newctx arg[3].address(#define spec_xnewctx arg[4].address(#define spec_userbuf arg[5].address*#define spec_addr_info arg[6].address*#define spec_name_info arg[6].address(#define spec_rr_info arg[6].address*#define spec_conn_info arg[6].address*#define spec_usersize arg[7].longword##define IOR_M_COPY_LENGTH (1<<16)##define IOR_M_COPY_FROM (1<<17)##define IOR_M_NEW_CONTEXT (1<<18)##define IOR_M_COPY_ADDRS (1<<19)##define IOR_M_COPY_HOSTNAME (1<<20)$#define IOR_M_COPY_CI_REMOTE (1<<21)##define IOR_M_COPY_CI_LOCAL (1<<22)##define IOR_M_COPY_MXRRS (1<<23)$#define IOR_M_SET_OPENFLAG (1<<24) struct SPECIOR { unsigned short fromlen; struct CMU_IPAddr from; struct CMU_NtoA addr_info; }; #define __SPECIOR struct SPECIOR#define NET$_IR 0X0863800A#define NET$_IFC 0X08638012#define NET$_IPC 0X0863801A#define NET$_UCT 0X08638022#define NET$_IFS 0X0863802A#define NET$_ILP 0X08638032#define NET$_NUC 0X0863803A#define NET$_CSE 0X08638042#define NET$_NOPRV 0X0863804A#define NET$_CIP 0X08638052#define NET$_CDE 0X0863805A#define NET$_CR 0X08638062#define NET$_FSU 0X0863806A#define NET$_UNN 0X08638072#define NET$_VTF 0X0863807A#define NET$_CREF 0X08638082#define NET$_CCAN 0X0863808A#define NET$_FIP 0X08638092#define NET$_BTS 0X0863809A#define NET$_IHI 0X086380A2#define NET$_BDI 0X086380AA#define NET$_EPD 0X086380B2#define NET$_URC 0X086380BA#define NET$_IGF 0X086380C2#define NET$_UNA 0X086380CA#define NET$_UNU 0X086380D2#define NET$_CC 0X086380DA#define NET$_CTO 0X086380E2#define NET$_TWT 0X086380EA#define NET$_TE 0X086380F2#define NET$_FTO 0X086380FA#define NET$_NYI 0X08638102#define NET$_NOPN 0X0863810A#define NET$_NOINA 0X08638112#define NET$_NOANA 0X0863811A#define NET$_NOADR 0X08638122#define NET$_GTHFUL 0X0863812A#define NET$_DAE 0X08638132#define NET$_NMLTO 0X0863813A#define NET$_NSEXIT 0X08638142#define NET$_NONS 0X0863814A#define NET$_NSQFULL 0X08638152#define NET$_DSDOWN 0X0863815A#define NET$_DSNODS 0X08638162 #define NET$_DSINCOMP 0X0863816A #define NET$_DSNOADDR 0X08638172 #define NET$_DSNONAME 0X0863817A #define NET$_DSFMTERR 0X08638182 #define NET$_DSSRVERR 0X0863818A #define NET$_DSNAMERR 0X08638192 #define NET$_DSNOTIMP 0X0863819A #define NET$_DSREFUSD 0X086381A2 #define NET$_DSNONSRV 0X086381AA #define NET$_DSUNKERR 0X086381B2 #define NET$_DSREFEXC 0X086381BA #define NET$_GREENERR 0X086381C2!#define NET$_GP_INVREQ 0X086381CA!#define NET$_GP_INVINF 0X086381D2!#define NET$_GP_INVNAM 0X086381DA!#define NET$_GP_INVADR 0X086381E2!#define NET$_GP_INVMBX 0X086381EA!#define NET$_GP_INVCLS 0X086381F2!#define NET$_GP_RSBUSY 0X086381FA!#define NET$_GP_NONMSR 0X08638202!#define NET$_GP_NOHINF 0X0863820A!#define NET$_GP_NOTFND 0X08638212!#define NET$_GP_UNKMBX 0X0863821A!#define NET$_GP_NOTIMP 0X08638222!#define NET$_GP_TOOBIG 0X0863822A!#define NET$_GP_NSDOWN 0X08638232#define NET$_NRT 0X0863823A#define NET$_KILL 0X08638242#endif /* __NETLIB_CMU_H__ */ÿÿà7 NETLIB_SRC.BCK^ç [NETLIB]UCX$INETDEF.H;2„iÈÍð*[NETLIB]UCX$INETDEF.H;2+,^.i/€ 4„i[Z-ç 0ª123KÿPWO\5 6(€Œ¨2Ú—7ñ®Ñ|mš89¹AJ(ú›G€HˆªJÿ‚/********************************************************************************************************************************/„/* Created 28-JUL-1992 13:52:16 by VAX-11 SDL V3.0-2 Source: 9-JUN-1992 22:23:57 WORK2$:[UCX.V2.BL23.NET.][SRC]INET_USER.SD */‚/********************************************************************************************************************************/ /*** MODULE $ARPREQDEF ***/#define ARP$M_IN_USE 1#define ARP$M_COM 2#define ARP$M_PERM 4#define ARP$M_PUBL 8#define ARP$M_USETRAILERS 16#define ARP$C_LENGTH 34#define ARP$K_LENGTH 34struct ARPREQDEF {N char ARP$T_PA [16]; /* IP address */N/* $SOCKADDRINDEF defines offsets */N char ARP$T_HA [16]; /* Ethernet hardware address */N/* $SOCKADDRDEF defines offsets */N union { /* */N unsigned short int ARP$W_FLAGS; /* flags */N struct { /* */N unsigned ARP$V_IN_USE : 1; /* ARP entry is in use */N unsigned ARP$V_COM : 1; /* ARP entry is complete */N unsigned ARP$V_PERM : 1; /* ARP entry is pemanent */N unsigned ARP$V_PUBL : 1; /* ARP entry is public */N unsigned ARP$V_USETRAILERS : 1; /* hosts uses trailers */& unsigned ARP$V_fill_0 : 3; } ARP$R_O_FLAGS; } ARP$R_OVLY; } ; /*** MODULE $IFREQDEF ***/#define IFR$M_IFF_UP 1#define IFR$M_IFF_BROADCAST 2#define IFR$M_IFF_DEBUG 4#define IFR$M_IFF_LOOPBACK 8 #define IFR$M_IFF_POINTOPOINT 16#define IFR$M_IFF_NOTRAILERS 32#define IFR$M_IFF_RUNNING 64#define IFR$M_IFF_NOARP 128#define IFR$M_IFF_PROMISC 256#define IFR$M_IFF_ALLMULTI 512#define IFR$M_IFF_DYNPROTO 1024#define IFR$M_IFF_MOP 2048#define IFR$M_IFF_NONAME 16384#define IFR$M_IFF_CLUSTER 32768#define IFR$C_LENGTH 32#define IFR$K_LENGTH 32struct IFREQDEF {N char IFR$T_NAME [16]; /* device name */ union {N char IFR$T_ADDR [16]; /* SOCKADDRIN structure */N char IFR$T_DSTADDR [16]; /* SOCKADDRIN structure */N char IFR$T_BROADADDR [16]; /* SOCKADDRIN structure */ union {N unsigned short int IFR$W_FLAGS; /* flags */ struct {N unsigned IFR$V_IFF_UP : 1; /* Interface is up */O unsigned IFR$V_IFF_BROADCAST : 1; /* Broadcast address valid */N unsigned IFR$V_IFF_DEBUG : 1; /* Turn on tracing */P unsigned IFR$V_IFF_LOOPBACK : 1; /* Interface set to loopback */Z unsigned IFR$V_IFF_POINTOPOINT : 1; /* Interface is point-to-point link */N unsigned IFR$V_IFF_NOTRAILERS : 1; /* Avoid use of trailers */N unsigned IFR$V_IFF_RUNNING : 1; /* Resources are allocated */R unsigned IFR$V_IFF_NOARP : 1; /* No address resolution protocol */N unsigned IFR$V_IFF_PROMISC : 1; /* Receive all packets */W unsigned IFR$V_IFF_ALLMULTI : 1; /* Receive all multicasting packets */X unsigned IFR$V_IFF_DYNPROTO : 1; /* Support dynamic proto dispatching */P unsigned IFR$V_IFF_MOP : 1; /* Device in MOP mode; not in use */N unsigned IFR$V_IFF_RESERVE : 2; /* SPARE bits */P unsigned IFR$V_IFF_NONAME : 1; /* Interface cluster name flag */R unsigned IFR$V_IFF_CLUSTER : 1; /* Interface is a cluster IFNET */% } IFR$R_DUMMY_1_BITS;N int *IFR$L_DATA; /* pointer to data */! } IFR$R_DUMMY_1_OVRL; } IFR$R_DUMMY; } ; /*** MODULE $INETERRDEF ***/N#define EPERM 1 /* Not owner */N#define ENOENT 2 /* No such file or directory */N#define ESRCH 3 /* No such process */N#define EINTR 4 /* Interrupted system call */N#define EIO 5 /* I/O error */N#define ENXIO 6 /* No such device or address */N#define E2BIG 7 /* Arg list too long */N#define ENOEXEC 8 /* Exec format error */N#define EBADF 9 /* Bad file number */N#define ECHILD 10 /* No children */N#define EAGAIN 11 /* No more processes */N#define ENOMEM 12 /* Not enough core */N#define EACCES 13 /* Permission denied */N#define EFAULT 14 /* Bad address */N#define ENOTBLK 15 /* Block device required */N#define EBUSY 16 /* Mount device busy */N#define EEXIST 17 /* File exists */N#define EXDEV 18 /* Cross-device link */N#define ENODEV 19 /* No such device */N#define ENOTDIR 20 /* Not a directory */N#define EISDIR 21 /* Is a directory */N#define EINVAL 22 /* Invalid argument */N#define ENFILE 23 /* File table overflow */N#define EMFILE 24 /* Too many open files */N#define ENOTTY 25 /* Not a typewriter */N#define ETXTBSY 26 /* Text file busy */N#define EFBIG 27 /* File too large */N#define ENOSPC 28 /* No space left on device */N#define ESPIPE 29 /* Illegal seek */N#define EROFS 30 /* Read-only file system */N#define EMLINK 31 /* Too many links */N#define EPIPE 32 /* Broken pipe */N/* math software */N#define EDOM 33 /* Argument too large */N#define ERANGE 34 /* Result too large */N/* non-blocking and interrupt i/o */N#define EWOULDBLOCK 35 /* Operation would block */N#define EINPROGRESS 36 /* Operationà8 NETLIB_SRC.BCK^ç [NETLIB]UCX$INETDEF.H;2„iùM now in progress */N#define EALREADY 37 /* Operation already in progress */N/* ipc/network software */N/* argument errors */N#define ENOTSOCK 38 /* Socket operation on non-socket */N#define EDESTADDRREQ 39 /* Destination address required */N#define EMSGSIZE 40 /* Message too long */N#define EPROTOTYPE 41 /* Protocol wrong type for socket */N#define ENOPROTOOPT 42 /* Protocol not available */N#define EPROTONOSUPPORT 43 /* Protocol not supported */N#define ESOCKTNOSUPPORT 44 /* Socket type not supported */P#define EOPNOTSUPP 45 /* Operation not supported on socket */N#define EPFNOSUPPORT 46 /* Protocol family not supported */^#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */N#define EADDRINUSE 48 /* Address already in use */N#define EADDRNOTAVAIL 49 /* Can't assign requested address */N/* operational errors */N#define ENETDOWN 50 /* Network is down */N#define ENETUNREACH 51 /* Network is unreachable */R#define ENETRESET 52 /* Network dropped connection on reset */O#define ECONNABORTED 53 /* Software caused connection abort */N#define ECONNRESET 54 /* Connection reset by peer */N#define ENOBUFS 55 /* No buffer space available */N#define EISCONN 56 /* Socket is already connected */N#define ENOTCONN 57 /* Socket is not connected */O#define ESHUTDOWN 58 /* Can't send after socket shutdown */ P#define ETOOMANYREFS 59 /* Too many references: can't splice */N#define ETIMEDOUT 60 /* Connection timed out */N#define ECONNREFUSED 61 /* Connection refused */P#define ELOOP 62 /* Too many levels of symbolic links */N#define ENAMETOOLONG 63 /* File name too long */N/* should be rearranged */N#define EHOSTDOWN 64 /* Host is down */N#define EHOSTUNREACH 65 /* No route to host */N#define ENOTEMPTY 66 /* Directory not empty */N/* quotas & mush */N#define EPROCLIM 67 /* Too many processes */N#define EUSERS 68 /* Too many users */N#define EDQUOT 69 /* Disc quota exceeded */N/* IPC errors */N#define ENOMSG 70 /* No message of desired type */N#define EIDRM 71 /* Identifier removed */N/* Alignment error of some type (i.e., cluster, page, block ...) */N#define EALIGN 72 /* alignment error */ /*** MODULE $INETSYMDEF ***/#define DVI$_ACP_TCP 2#define INET$C_ICMP 1 #define INET$C_RAW_IP 255 #define INET$C_TCP 6#define INET$C_UDP 17f#define INET$C_AUXS 127 #define INET$C_REXEC 128#define IPPROTO$C_ICMP 1#define IPPROTO$C_RAW_IP 255#define IPPROTO$C_TCP 6/#define IPPROTO$C_UDP 17#define IPPROTO$C_AUXS 127#define IPPROTO$C_REXEC 128N/* */#define UCX$C_ICMP 1#define UCX$C_RAW_IP 255#define UCX$C_TCP 6l#define UCX$C_UDP 17#define UCX$C_AUXS 127#define UCX$C_REXEC 128rN/* */N/* Ports < IP_PROTO$C_RESERVED are reserved for */N/* privileged processes (e.g. root). */N/* */ #define IP_PROTO$C_RESERVED 1024N#define INET_PROTYP$C_STREAM 1 /* stream type */N#define INET_PROTYP$C_DGRAM 2 /* datagram type */N#define INET_PROTYP$C_RAW 3 /* raw type */N/* */#define UCX$C_STREAM 1#define UCX$C_DGRAM 2d#define UCX$C_RAW 3;N#define INET$C_IPOPT 0 /* IP opt type parameter */N#define INET$C_SOCKOPT 1 /* setsockopt type parameter */N#define INET$C_IOCTL 2 /* ioctl type parameter */N#define INET$C_DATA 3 /* data */N#define INET$C_SOCK_NAME 4 /* socket name */#define INET$C_RESERVE_1 5N#define INET$C_TCPOPT 6 /* TCP option type */N/* */#define UCX$C_IPOPT 0 #define UCX$C_SOCKOPT 1d#define UCX$C_TCPOPT 6#define UCX$C_IOCTL 2 #define UCX$C_DATA 3N#define INET$C_DSC_RCV 0 /* discard received messages */N#define INET$C_DSC_SND 1 /* discard sent messages */N#define INET$C_DSC_ALL 2 /* discard all messages */#define UCX$C_DSC_RCV 0 #define UCX$C_DSC_SND 1 #define UCX$C_DSC_ALL 2*#define UCX$C_SO_SNDBUF 4097#define UCX$C_SO_RCVBUF 4098#define UCX$C_SO_SNDLOWAT 4099#define UCX$C_SO_RCVLOWAT 4100#define UCX$C_SO_SNDTIMEO 4101#define UCX$C_SO_RCVTIMEO 4102#define UCX$C_SO_ERROR 4103 #define UCX$C_SO_TYPE 4104$#define UCX$C_SO_NO_RCV_CHKSUM 16384$#define UCX$C_SO_NO_SND_CHKSUM 32768 #define UCX$C_SO_NO_CHKSUM 49152N/*;constant ( */E/*; DEBUGGING */ J/*; ,ACCEPTCONN */J/*; ,REUSEADDR */J/*; ,KEEPALIVE */J/*; ,DONTROUTE */J/*; ,BROADCAST */J/*; ,USELOOPBACK */J/*; ,LINGER */J/*; ,OOBINLINE */J/*; ) equals 1 increment 1 prefix UCX$ tag C counter #types; */#define INET$C_TCPOPT_EOL 0 #define INET$C_TCPOPT_NOP 1Y#define INET$C_TCPOPT_MAXSEG 2S#define INET$C_TCP_NODELAY 1 /* don't delay send to coalesce packets */eN#define INET$C_TCP_MAXSEG 2 /* set maximum segment size */N#define INET$C_TCP_PROBE_IDLE 128 /* probe idle timer */N#define INET$C_TCP_DROP_IDLE 129 /* drop idle timer */#define UCX$C_TCPOPT_EOL 0#define UCX$C_TCPOPT_NOP 1#define UCX$C_TCPOPT_MAXSEG 2y#define UCX$C_TCP_NODELAY 1M#define UCX$C_TCP_MAXSEG 2 #define UCX$C_TCP_PROBE_IDLE 128#define UCX$C_TCP_DROP_IDLà9 NETLIB_SRC.BCK^ç [NETLIB]UCX$INETDEF.H;2„idÔE 129 #define INET$C_IP_TOS 3i#define INET$C_IP_TTL 4/#define UCX$C_IP_TOS 3#define UCX$C_IP_TTL 4N#define INET$C_AF_UNSPEC 0 /* unspecified */N#define INET$C_AF_UNIX 1 /* local to host (pipes, portals) */N#define INET$C_AF_INET 2 /* internetwork: UDP, TCP, etc. */N#define INET$C_AF_MAX 3 /* maximum value */#define INET$C_INADDR_ANY 0 "#define INET$C_INADDR_BROADCAST -1N/* */#define UCX$C_AF_UNSPEC 0y#define UCX$C_AF_UNIX 1c#define UCX$C_AF_INET 2 #define UCX$C_AF_MAX 3#define UCX$C_INADDR_ANY 0!#define UCX$C_INADDR_BROADCAST -1 N/* */#define INET$M_MSG_OOB 1#define INET$M_MSG_PEEK 2A#define INET$M_MSG_DONTROUTE 4#define INET$M_DUMMYN_4 8 #define INET$M_DUMMYN_5 16#define INET$M_MSG_PURGE 32t#define INET$M_MSG_NBIO 64#define INET$M_MSG_BLOCKALL 128 struct MSGBITS { struct {sN/* */N unsigned INET$V_MSG_OOB : 1; /* turn on event logging, not used */N unsigned INET$V_MSG_PEEK : 1; /* socket has had LISTEN */N unsigned INET$V_MSG_DONTROUTE : 1; /* use only the interface addr */N/* */N unsigned INET$V_DUMMYN_4 : 1; /* reserve space */N/* */N unsigned INET$V_DUMMYN_5 : 1; /* reserve space */N/* */N unsigned INET$V_MSG_PURGE : 1; /* Purge I/O */N unsigned INET$V_MSG_NBIO : 1; /* NON-block I/O */N unsigned INET$V_MSG_BLOCKALL : 1; /* record TCP I/O */ } INET$R_MSG_BITS; } ;fN#define INET$C_MSG_OOB 1 /* process out-of-band data */N#define INET$C_MSG_PEEK 2 /* peek at incoming message */N#define INET$C_MSG_DONTROUTE 4 /* send without */N/* using routing tables */N#define INET$C_MSG_PURGE 32 /* block read until fill buffer */N#define INET$C_MSG_NBIO 64 /* block read until fill buffer */N#define INET$C_MSG_BLOCKALL 128 /* block read until fill buffer */#define INET$C_MSG_MAXIOVLEN 16 N/* */N#define UCX$C_MSG_OOB 1 /* process out-of-band data */N#define UCX$C_MSG_PEEK 2 /* peek at incoming message */N#define UCX$C_MSG_DONTROUTE 4 /* send without */N/* using routing tables */N#define UCX$C_MSG_PURGE 32 /* block read until fill buffer */N#define UCX$C_MSG_NBIO 64 /* block read until fill buffer */N#define UCX$C_MSG_BLOCKALL 128 /* block read until fill buffer */#define UCX$C_MSG_MAXIOVLEN 16#define UCX$M_MSG_OOB 1 #define UCX$M_MSG_PEEK 2#define UCX$M_MSG_DONTROUTE 4 #define UCX$M_DUMMYX_4 8#define UCX$M_DUMMYX_5 16 #define UCX$M_MSG_PURGE 32#define UCX$M_MSG_NBIO 646#define UCX$M_MSG_BLOCKALL 128struct MSGBITS_1 { struct {IN/* */N unsigned UCX$V_MSG_OOB : 1; /* turn on event logging, not used */N unsigned UCX$V_MSG_PEEK : 1; /* socket has had LISTEN */N unsigned UCX$V_MSG_DONTROUTE : 1; /* use only the interface addr */N/* */N unsigned UCX$V_DUMMYX_4 : 1; /* reserve space */N/* */N unsigned UCX$V_DUMMYX_5 : 1; /* reserve space */N/* */N unsigned UCX$V_MSG_PURGE : 1; /* Purge I/O */N unsigned UCX$V_MSG_NBIO : 1; /* NON-block I/O */N unsigned UCX$V_MSG_BLOCKALL : 1; /* record TCP I/O */ } UCX$R_MSG_BITS;2 } ; #define UCX$M_DEBUGGING 1 #define UCX$M_ACCEPTCONN 2#define UCX$M_REUSEADDR 4<#define UCX$M_KEEPALIVE 8s#define UCX$M_DONTROUTE 16#define UCX$M_BROADCAST 32#define UCX$M_USELOOPBACK 64#define UCX$M_LINGER 128#define UCX$M_OOBINLINE 256 #define UCX$M_DUMMYM_2 512#define UCX$M_DUMMYM_3 1024/#define UCX$M_DUMMYM_4 2048 #define UCX$M_DUMMYM_5 4096T#define UCX$M_DUMMYM_6 8192e!#define UCX$M_NO_RCV_CHKSUM 16384N!#define UCX$M_NO_SND_CHKSUM 32768tN#define UCX$C_DEBUG 1 /* turn on event logging, not used */N#define UCX$C_ACCEPTCONN 2 /* socket has had LISTEN */N#define UCX$C_REUSEADDR 4 /* allow local address reuse */N#define UCX$C_KEEPALIVE 8 /* keep connection alive */N#define UCX$C_DONTROUTE 16 /* use only the interface addr */N#define UCX$C_BROADCAST 32 /* allow broadcasting */N#define UCX$C_USELOOPBACK 64 /* loopback interface, not used */N#define UCX$C_LINGER 128 /* linger at close */N#define UCX$C_OOBINLINE 256 /* leave received OOB data in line */N#define UCX$C_NO_RCV_CHKSUM 16384 /* no receive checksum calculation */N#define UCX$C_NO_SND_CHKSUM 32768 /* no send checksum calculation */N#define UCX$M_NO_CHKSUM 49152 /* no checksum calculation */N#define UCX$C_NO_CHKSUM 49152 /* no checksum calculation */N/* */N#define UCX$C_SNDBUF 4097 /* send buffer size */N#define UCX$C_RCVBUF 4098 /* receive buffer size */N#define UCX$C_SNDLOWAT 4099 /* send low-water mark */N#define UCX$C_RCVLOWAT 4100 /* receive low-water mark */N#define UCX$C_SNDTIMEO 4101 /* send timeout */N#define UCX$C_RCVTIMEO 4102 /* receive timeout */N#define UCX$C_ERROR 4103 /* get error status and clear */N#define UCX$C_TYPE 4104 /* get socket type */N/* */N#define UCX$M_SNDBUF 4097 /* send buffer size */N#define UCX$M_RCVBUF 4098 /* receive buffer size */N#define UCX$M_SNDLOWAT 4099 /* send low-water mark */N#define UCX$M_RCVLOWAT 4100 /* receive low-water mark */N#define UCX$M_SNDTIMEO 4101 /* send timeout */N#define UCX$M_RCVTIMEO 4102 /* receive timeout */N#define UCX$M_ERROR 4103 /* get error status and clear */N#define UCX$M_TYPE 4104 /* get socket type */struct SOCKOPTDEF {PN union { /* */N unà: NETLIB_SRC.BCK^ç [NETLIB]UCX$INETDEF.H;2„iÀ>-signed short int UCX$W_OPTIONS; /* Socket options, see socket.h */ struct {XN/* */N/* Socket options bits. */N/* */O unsigned UCX$V_DEBUGGING : 1; /* turn on event logging, not used */CN unsigned UCX$V_ACCEPTCONN : 1; /* socket has had LISTEN */N unsigned UCX$V_REUSEADDR : 1; /* allow local address reuse */N unsigned UCX$V_KEEPALIVE : 1; /* keep connection alive */N unsigned UCX$V_DONTROUTE : 1; /* use only the interface addr */N unsigned UCX$V_BROADCAST : 1; /* allow broadcasting */N unsigned UCX$V_USELOOPBACK : 1; /* loopback interface, not used */N unsigned UCX$V_LINGER : 1; /* linger at close */P unsigned UCX$V_OOBINLINE : 1; /* leave received OOB data in line */N/* */N/* */N unsigned UCX$V_DUMMYM_2 : 1; /* reserve space */N unsigned UCX$V_DUMMYM_3 : 1; /* reserve space */N unsigned UCX$V_DUMMYM_4 : 1; /* reserve space */N unsigned UCX$V_DUMMYM_5 : 1; /* reserve space */N unsigned UCX$V_DUMMYM_6 : 1; /* reserve space */N/* */S unsigned UCX$V_NO_RCV_CHKSUM : 1; /* no receive checksum calculation */dP unsigned UCX$V_NO_SND_CHKSUM : 1; /* no send checksum calculation */N/* */N/* Additional options, not kept in so_options. */N/* */ } UCX$R_OPT_BITS;  } UCX$R_OPT_OVRLY; } ;  i/*** MODULE $OPTDEF ***/#define OPT$C_SET_LENGTH 8#define OPT$K_SET_LENGTH 8#define OPT$C_GET_LENGTH 12 #define OPT$K_GET_LENGTH 12 struct OPTDEF {iN unsigned short int OPT$W_LENGTH; /* length */N unsigned short int OPT$W_NAME; /* name */N int *OPT$L_ADDRESS; /* address */N int *OPT$L_RET_LENGTH; /* address */ } ;d /*** MODULE $RTENTRYDEF ***/N/* */N/* We distinguish between routes to hosts and routes to networks, */N/* preferring the former if available. For each route we infer */N/* the interface to use from the gateway address supplied when */N/* the route was entered. Routes that forward packets through */N/* gateways are marked so that the output routines know to address the */N/* gateway rather than the ultimate destination. */N/* */#define RT$M_RTF_UP 1 #define RT$M_RTF_GATEWAY 2#define RT$M_RTF_HOST 4e#define RT$M_RTF_DYNAMIC 8#define RT$M_RTF_MODIFIED 16#define RT$C_LENGTH 52#define RT$K_LENGTH 52struct RTENTRYDEF { N unsigned long int RT$L_HASH; /* Hash link */ union { struct {lN unsigned short int RT$W_DST_SIN_FAMILY; /* Address type */N unsigned short int RT$W_DST_SIN_PORT; /* Port number */N unsigned long int RT$L_DST_SIN_ADDR; /* Internet address */N char RT$T_DST_SIN_ZERO [8]; /* Unused space */ } RT$R_DST_FIELDS;N char RT$T_DST [16]; /* Destination SOCKADDR structure */ } RT$R_DST_OVRLY;t union { struct { N unsigned short int RT$W_GATEWAY_SIN_FAMILY; /* Address type */N unsigned short int RT$W_GATEWAY_SIN_PORT; /* Port number */N unsigned long int RT$L_GATEWAY_SIN_ADDR; /* Internet address */N char RT$T_GATEWAY_SIN_ZERO [8]; /* Unused space */" } RT$R_GATEWAY_FIELDS;N char RT$T_GATEWAY [16]; /* Gateway SOCKADDR structure */ } RT$R_GATEWAY_OVRLY; union {N unsigned short int RT$W_FLAGS; /* up/down?, host/net */ struct {sN unsigned RT$V_RTF_UP : 1; /* route useable */N unsigned RT$V_RTF_GATEWAY : 1; /* destination is a gateway */N unsigned RT$V_RTF_HOST : 1; /* host entry (net otherwise) */R unsigned RT$V_RTF_DYNAMIC : 1; /* created dynamically (by redirect) */N unsigned RT$V_RTF_MODIFIED : 1; /* changed by redirect */% unsigned RT$V_fill_1 : 3;N } RT$R_FLAGS_BITS; } RT$R_FLAGS_OVRLY;dN unsigned short int RT$W_REFCNT; /* # held references */N unsigned long int RT$L_USE; /* raw # packets forwarded */S unsigned long int RT$L_IFP; /* pointer to the IFNET interface to use */MN unsigned long int RT$L_NEXT; /* pointer to the next RTENTRY */ } ;$ O/*** MODULE $SIOCDEF ***/ N#define FIONREAD -2147195265 /* Get # bytes to read */N#define FIONBIO -2147195266 /* non block I/O */N#define FIOASYNC -2147195267 /* asynch I/O */N#define SIOCSHIWAT -2147192064 /* high water mark */N#define SIOCGHIWAT 1074033409 /* high water mark */N#define SIOCSLOWAT -2147192062 /* low water mark */N#define SIOCGLOWAT 1074033411 /* low water mark */N#define SIOCATMARK 1074033415 /* at OOB mark */N#define SIOCSPGRP -2147192056 /* Process group */N#define SIOCGPGRP 1074033417 /* Process group */N#define SIOCADDRT -2144046582 /* add RT */N#define SIOCDELRT -2144046581 /* delete RT */N#define SIOCGETRT -1070304725 /* get RT */N#define SIOCSIFADDR -2145359604 /* set IF address */N#define SIOCGIFADDR -1071617779 /* Get IF address */N#define SIOCSIFDSTADDR -2145359602 /* Destination addr */N#define SIOCGIFDSTADDR -1071617777 /* BDestination addr */N#define SIOCSIFFLAGS -2145359600 /* IF flags */N#define SIOCGIFFLAGS -1071617775 /* IF flags */N#define SIOCGIFBRDADDR -1071617774 /* Broadcast addr */N#define SIOCSIFBRDADDR -2145359597 /* Broadcats addr */N#define SIOCGIFCONF -1073190636 /* IF configuration */N#define SIOCGIFNETMASK -1071617771 /* Network mask */N#define SIOCSIFNETMASK -2145359594 /* Network mask */N#define SIOCSARP -2145097442 /* set ARP */N#define SIOCGARP -1071355617 /* get ARP à; NETLIB_SRC.BCK^ç [NETLIB]UCX$INETDEF.H;2„i]§< */N#define SIOCDARP -2145097440 /* delete ARP */N#define SIOCARPREQ -1071355608 /* ARP request */N#define SIOCENABLBACK -2145359583 /* enable loopback */N#define SIOCDISABLBACK -2145359582 /* disable loopback */N#define SIOCSTATE -1072273117 /* state */ O/*** MODULE $SOCKETOPTDEF ***/N/* */N/* Socket options data structure. */N/* */#define SOCKOPT$M_DEBUG 1 #define SOCKOPT$M_ACCEPTCONN 2#define SOCKOPT$M_REUSEADDR 4 #define SOCKOPT$M_KEEPALIVE 8 #define SOCKOPT$M_DONTROUTE 16#define SOCKOPT$M_BROADCAST 32 #define SOCKOPT$M_USELOOPBACK 64#define SOCKOPT$M_LINGER 128#define SOCKOPT$M_OOBINLINE 256 #define SOCKOPT$M_DUMMYB_2 512#define SOCKOPT$M_DUMMYB_3 1024E#define SOCKOPT$M_DUMMYB_4 2048r#define SOCKOPT$M_DUMMYB_5 4096d#define SOCKOPT$M_DUMMYB_6 8192n%#define SOCKOPT$M_NO_RCV_CHKSUM 16384n%#define SOCKOPT$M_NO_SND_CHKSUM 32768 N#define SOCKOPT$M_NO_CHKSUM 49152 /* no checksum calculation */N#define SOCKOPT$C_NO_CHKSUM 49152 /* no checksum calculation */N/* */N#define SOCKOPT$C_SNDBUF 4097 /* send buffer size */N#define SOCKOPT$C_RCVBUF 4098 /* receive buffer size */N#define SOCKOPT$C_SNDLOWAT 4099 /* send low-water mark */N#define SOCKOPT$C_RCVLOWAT 4100 /* receive low-water mark */N#define SOCKOPT$C_SNDTIMEO 4101 /* send timeout */N#define SOCKOPT$C_RCVTIMEO 4102 /* receive timeout */N#define SOCKOPT$C_ERROR 4103 /* get error status and clear */N#define SOCKOPT$C_TYPE 4104 /* get socket type */N#define SOCKOPT$M_SNDBUF 4097 /* send buffer size */N#define SOCKOPT$M_RCVBUF 4098 /* receive buffer size */N#define SOCKOPT$M_SNDLOWAT 4099 /* send low-water mark */N#define SOCKOPT$M_RCVLOWAT 4100 /* receive low-water mark */N#define SOCKOPT$M_SNDTIMEO 4101 /* send timeout */N#define SOCKOPT$M_RCVTIMEO 4102 /* receive timeout */N#define SOCKOPT$M_ERROR 4103 /* get error status and clear */N#define SOCKOPT$M_TYPE 4104 /* get socket type */N#define SOCKOPT$C_DEBUG 1 /* turn on event logging, not used */N#define SOCKOPT$C_ACCEPTCONN 2 /* socket has had LISTEN */N#define SOCKOPT$C_REUSEADDR 4 /* allow local address reuse */N#define SOCKOPT$C_KEEPALIVE 8 /* keep connection alive */N#define SOCKOPT$C_DONTROUTE 16 /* use only the interface addr */N#define SOCKOPT$C_BROADCAST 32 /* allow broadcasting */N#define SOCKOPT$C_USELOOPBACK 64 /* loopback interface, not used */N#define SOCKOPT$C_LINGER 128 /* linger at close */N#define SOCKOPT$C_OOBINLINE 256 /* leave received OOB data in line */N#define SOCKOPT$C_NO_RCV_CHKSUM 16384 /* no receive checksum calculation */N#define SOCKOPT$C_NO_SND_CHKSUM 32768 /* no send checksum calculation */#define SOCKOPT$C_LENGTH 2#define SOCKOPT$K_LENGTH 2struct SOCKETOPTDEF {tN union { /* */Q unsigned short int SOCKOPT$W_OPTIONS; /* Socket options, see socket.h */T struct {nN/* */N/* Socket options bits. */N/* */O unsigned SOCKOPT$V_DEBUG : 1; /* turn on event logging, not used */RN unsigned SOCKOPT$V_ACCEPTCONN : 1; /* socket has had LISTEN */N unsigned SOCKOPT$V_REUSEADDR : 1; /* allow local address reuse */N unsigned SOCKOPT$V_KEEPALIVE : 1; /* keep connection alive */O unsigned SOCKOPT$V_DONTROUTE : 1; /* use only the interface addr */ N unsigned SOCKOPT$V_BROADCAST : 1; /* allow broadcasting */R unsigned SOCKOPT$V_USELOOPBACK : 1; /* loopback interface, not used */N unsigned SOCKOPT$V_LINGER : 1; /* linger at close */T unsigned SOCKOPT$V_OOBINLINE : 1; /* leave received OOB data in line */N/* */N/* */N unsigned SOCKOPT$V_DUMMYB_2 : 1; /* reserve space */N unsigned SOCKOPT$V_DUMMYB_3 : 1; /* reserve space */N unsigned SOCKOPT$V_DUMMYB_4 : 1; /* reserve space */N unsigned SOCKOPT$V_DUMMYB_5 : 1; /* reserve space */N unsigned SOCKOPT$V_DUMMYB_6 : 1; /* reserve space */N/* */W unsigned SOCKOPT$V_NO_RCV_CHKSUM : 1; /* no receive checksum calculation */nT unsigned SOCKOPT$V_NO_SND_CHKSUM : 1; /* no send checksum calculation */N/* Additional options, not kept in so_options. */N/* */! } SOCKOPT$R_OPT_BITS;  } SOCKOPT$R_OPT_OVRLY; } ;  /*** MODULE $INETSOCKOPTDEF ***/N/* */N/* Socket options data structure. */N/* */#define INET$M_DEBUG 1#define INET$M_ACCEPTCONN 2 #define INET$M_REUSEADDR 4#define INET$M_KEEPALIVE 8#define INET$M_DONTROUTE 16y#define INET$M_BROADCAST 32 #define INET$M_USELOOPBACK 640#define INET$M_LINGER 128a#define INET$M_OOBINLINE 256#define INET$M_DUMMYB_2 512 #define INET$M_DUMMYB_3 1024#define INET$M_DUMMYB_4 2048#define INET$M_DUMMYB_5 4096#define INET$M_DUMMYB_6 8192"#define INET$M_NO_RCV_CHKSUM 16384"#define INET$M_NO_SND_CHKSUM 32768N#define INET$M_NO_CHKSUM 49152 /* no checksum calculation */N#define INET$C_NO_CHKSUM 49152 /* no checksum calculation */N/* */N#define INET$C_SNDBUF 4097 /* send buffer size */N#define INET$C_RCVBUF 4098 /* receive buffer size */N#define INET$C_SNDLOWAT 4099 /* send low-water mark */N#define INET$C_RCVLOWAT 4100 /* receive low-water mark */N#define INET$C_SNDTIMEO 4101 /* send timeout */N#define INET$C_RCVTIMEO 4102 /* receive timeout */N#define INET$C_ERROR 4103 /* get error status and clear */N#define INET$C_TYPE 4104 /* get socket type */N/* */N#define INET$M_SNDBUF 4097 /* send à< NETLIB_SRC.BCK^ç [NETLIB]UCX$INETDEF.H;2„i‹«Kbuffer size */N#define INET$M_RCVBUF 4098 /* receive buffer size */N#define INET$M_SNDLOWAT 4099 /* send low-water mark */N#define INET$M_RCVLOWAT 4100 /* receive low-water mark */N#define INET$M_SNDTIMEO 4101 /* send timeout */N#define INET$M_RCVTIMEO 4102 /* receive timeout */N#define INET$M_ERROR 4103 /* get error status and clear */N#define INET$M_TYPE 4104 /* get socket type */N#define INET$C_DEBUG 1 /* turn on event logging, not used */N#define INET$C_ACCEPTCONN 2 /* socket has had LISTEN */N#define INET$C_REUSEADDR 4 /* allow local address reuse */N#define INET$C_KEEPALIVE 8 /* keep connection alive */N#define INET$C_DONTROUTE 16 /* use only the interface addr */N#define INET$C_BROADCAST 32 /* allow broadcasting */N#define INET$C_USELOOPBACK 64 /* loopback interface, not used */N#define INET$C_LINGER 128 /* linger at close */N#define INET$C_OOBINLINE 256 /* leave received OOB data in line */N#define INET$C_NO_RCV_CHKSUM 16384 /* no receive checksum calculation */N#define INET$C_NO_SND_CHKSUM 32768 /* no send checksum calculation */#define INET$C_LENGTH 2K#define INET$K_LENGTH 2nstruct INETSOCKOPTDEF {EN union { /* */N unsigned short int INET$W_OPTIONS; /* Socket options, see socket.h */ struct {6N/* */N/* Socket options bits. */N/* */N unsigned INET$V_DEBUG : 1; /* turn on event logging, not used */N unsigned INET$V_ACCEPTCONN : 1; /* socket has had LISTEN */N unsigned INET$V_REUSEADDR : 1; /* allow local address reuse */N unsigned INET$V_KEEPALIVE : 1; /* keep connection alive */N unsigned INET$V_DONTROUTE : 1; /* use only the interface addr */N unsigned INET$V_BROADCAST : 1; /* allow broadcasting */O unsigned INET$V_USELOOPBACK : 1; /* loopback interface, not used *//N unsigned INET$V_LINGER : 1; /* linger at close */Q unsigned INET$V_OOBINLINE : 1; /* leave received OOB data in line */dN/* */N/* */N unsigned INET$V_DUMMYB_2 : 1; /* reserve space */N unsigned INET$V_DUMMYB_3 : 1; /* reserve space */N unsigned INET$V_DUMMYB_4 : 1; /* reserve space */N unsigned INET$V_DUMMYB_5 : 1; /* reserve space */N unsigned INET$V_DUMMYB_6 : 1; /* reserve space */N/* */T unsigned INET$V_NO_RCV_CHKSUM : 1; /* no receive checksum calculation */Q unsigned INET$V_NO_SND_CHKSUM : 1; /* no send checksum calculation */KN/* Additional options, not kept in so_options. */N/* */ } INET$R_OPT_BITS; } INET$R_OPT_OVRLY;  } ;f /*** MODULE $SOCKADDRDEF ***/ N#define AF_UNSPEC 0 /* unspecified socket family */N#define AF_INET 2 /* INET socket family */#define SA$C_LENGTH 16#define SA$K_LENGTH 16struct SOCKADDR {KN unsigned short int SA$W_FAMILY; /* address family */N char SA$T_DATA [14]; /* up to 14 bytes of address */ } ;O P/*** MODULE $SOCKADDRINDEF ***/ #define SIN$C_LENGTH 16 #define SIN$K_LENGTH 16 struct SOCKADDRIN { N unsigned short int SIN$W_FAMILY; /* address family */N unsigned short int SIN$W_PORT; /* 2 bytes specifying a port */N unsigned long int SIN$L_ADDR; /* 4 bytes specifying an IP address */N char SIN$T_ZERO [8]; /* 8 bytes */ } ;  /*** MODULE $INETACPSYMDEF ***/nN/*+ */N/* Define ACP HOST/NET data base subroutine calls subfunction codes */N/* */N/*- */N#define INETACP$C_ALIASES 1 /* aliases */N#define INETACP$C_TRANS 2 /* translate ASCII string in binary */N#define INETACP$C_HOSTENT 3 /* get back a HOSTENT */N#define INETACP$C_NETENT 4 /* get back a NETENT */N#define INETACP$C_HOSTENT_OFFSET 5 /* get back a HOSTENT */N#define INETACP$C_NETENT_OFFSET 6 /* get back a NETENT */N#define INETACPC$C_ALIASES 1 /* aliases */N#define INETACPC$C_TRANS 2 /* translate ASCII string in binary */N#define INETACPC$C_HOSTENT 3 /* get back a HOSTENT */N#define INETACPC$C_NETENT 4 /* get back a NETENT */N#define INETACPC$C_HOSTENT_OFFSET 5 /* get back a HOSTENT */N#define INETACPC$C_NETENT_OFFSET 6 /* get back a NETENT */ /*** MODULE $INETACPFSYMDEF ***/N/*+ */N/* Define ACP control subfunction codes */N/* */N/*- */Q#define INETACP_FUNC$C_GETHOSTBYNAME 1 /* Subroutine call of GET_HOST_BY_NAME */PQ#define INETACP_FUNC$C_GETHOSTBYADDR 2 /* Subroutine call of GET_HOST_BY_ADDR */ P#define INETACP_FUNC$C_GETNETBYNAME 3 /* Subroutine call of GET_NET_BY_NAME */Q#define INETACP_FUNC$C_GETNETBYADDR 4 /* Subroutine call of GET_NET_BY_ADDR */N/* */ f/*** MODULE $NETENTDEF ***/NN#define NET$C_LENGTH 16 /* */N#define NET$K_LENGTH 16 /* */struct NETENTDEF {N int *NET$L_N_NAME; /* pointer to the network name */U int *NET$L_N_ALIASES; /* pointer to array of pointers to aliases */dN unsigned long int NET$L_N_ADDRTYPE; /* Network address type */N unsigned long int NET$L_N_NET; /* Network address */ } ; N/* */N/* Structures returned by network */N/* data base library. All addresses */N/* are supplied in host order, and */N/* returned in network order (suitable */N/* for use in system calà= NETLIB_SRC.BCK^ç [NETLIB]UCX$INETDEF.H;2„i2Zls). */N/* */ /*** MODULE $HOSTENTDEF ***/N#define HOST$L_H_ADDR 16 /* */N#define HOST$C_LENGTH 20 /* */N#define HOST$K_LENGTH 20 /* */struct HOSTENTDEF { N int *HOST$L_H_NAME; /* pointer to the host name */U int *HOST$L_H_ALIASES; /* pointer to array of pointers to aliases */fN unsigned long int HOST$L_H_ADDRTYPE; /* Host address type */N unsigned long int HOST$L_H_LENGTH; /* Length of address */W int *HOST$L_H_ADDR_LIST; /* Pointer to array of pointers to addresses */  } ; à> NETLIB_SRC.BCKÿ ç [NETLIB]NETLIB.H;33YX‡ð*[NETLIB]NETLIB.H;33+,ÿ ./€ 4Y ì-ç 0ª123KÿPWO 56µ…>ïQ›7¥9’>ïQ›89¹AJ(ú›G€HˆªJÿ#ifndef NETLIB_H_LOADED#define NETLIB_H_LOADED/* ** NETLIB.H**"** Main #include file for NETLIB.**A** COPYRIGHT © 1993,1997 MADGOAT SOFTWARE. ALL RIGHTS RESERVED.**** MODIFICATION HISTORY:**0** 29-Sep-1993 Madison Initial commenting..** 31-May-1997 Madison Fix queue access.*/#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef __DECC#include #else#pragma builtins#endif#ifndef __NETLIB_BUILD__#define __NETLIB_BUILD__#endif#include "netlibdef.h"#ifdef __ALPHA#pragma member_alignment save#pragma nomember_alignment#endif,typedef struct { void *head, *tail; } QUEUE;3typedef struct { unsigned int long1, long2; } TIME;&typedef struct dsc$descriptor DESCRIP;Ptypedef struct { unsigned short bufsiz, itmcod; void *bufadr, *retlen; } ITMLST;#ifdef __ALPHA #pragma member_alignment restore#endif/*** Handy macros*/$#define OK(s) $VMS_STATUS_SUCCESS(s)U#define INIT_DYNDSCPTR(str) {str->dsc$w_length = 0; str->dsc$a_pointer = (void *) 0;\M str->dsc$b_class = DSC$K_CLASS_D; str->dsc$b_dtype = DSC$K_DTYPE_T;}Q#define INIT_DYNDESC(str) {str.dsc$w_length = 0; str.dsc$a_pointer = (void *) 0;\K str.dsc$b_class = DSC$K_CLASS_D; str.dsc$b_dtype = DSC$K_DTYPE_T;}Y#define INIT_SDESC(str,len,ptr) {str.dsc$w_length=(len);str.dsc$a_pointer=(void *)(ptr);\G str.dsc$b_class=DSC$K_CLASS_S; str.dsc$b_dtype=DSC$K_DTYPE_T;}B#define ITMLST_INIT(itm,c,s,a,r) {itm.bufsiz=(s); itm.itmcod=(c);\) itm.bufadr=(a); itm.retlen=(r);}5#define INIT_QUEUE(que) {que.head = que.tail = &que;}"#define SETARGCOUNT(x) va_count(x)D#define VERIFY_CTX(x,c) {if ((x) == 0) return SS$_BADPARAM; c = *x;}H#define GET_IOR(x, _ctx, _iosb, _astadr, _astprm) {unsigned int status;\* status = netlib___alloc_ior(&x);\< if (!OK(status)) return status; (x)->ctx = (_ctx);\K (x)->iosbp=(_iosb); (x)->astadr=(_astadr); (x)->astprm=(_astprm);})#define FREE_IOR(x) netlib___free_ior(x);K#define GET_DNSREQ(x, _ctx, _iosb, _astadr, _astprm) {unsigned int status;\- status = netlib___alloc_dnsreq(&x);\) if (!OK(status)) return status;\3 status = netlib___alloc_ior(&((x)->ior));\D if (!OK(status)) {netlib___free_dnsreq(x); return status;}\! (x)->ior->ctx = (_ctx);\> (x)->ior->iosbp=(_iosb); (x)->ior->astadr=(_astadr);\% (x)->ior->astprm=(_astprm);}O#define FREE_DNSREQ(x) {netlib___free_ior(((x)->ior));netlib___free_dnsreq(x);}#ifdef __ALPHAL#define queue_insert(item,pred) __PAL_INSQUEL((void *)(pred),(void *)(item))U#define queue_remove(entry,addr) (__PAL_REMQUEL((void *)(entry),(void *)(addr)) >= 0)#else2#define queue_insert(item,pred) _INSQUE(item,pred);#define queue_remove(entry,addr) (_REMQUE(entry,addr) != 2)#endif/*** Generic context structure*/#ifndef __SPECCTX#define __SPECCTX void#endif struct NAMESERVER {& struct NAMESERVER *flink, *blink; struct INADDRDEF addr; }; struct DOMAIN {" struct DOMAIN *flink, *blink; int length; char name[1]; }; struct DNSCTX { QUEUE nsq; QUEUE domq; TIME timeout; int retry_count; unsigned int flags; unsigned short queryid; };#define CTX_S_LINEBUF 32768 struct CTX { struct CTX *flink, *blink; TIME exptime; unsigned int flags;*#define CTX_M_USER_SET_REUSEADDR (1<<0)'#define CTX_M_LINE_FOUND_CR (1<<1)$#define CTX_M_NO_DNS (1<<2) unsigned short chan; __SPECCTX *specctx; unsigned int specctx_size;4 unsigned char *linebuf, *linebufp, *lineanchor;% struct dsc$descriptor *line_dsc;! unsigned short *line_retlen; unsigned int line_flags; int line_remain; TIME *line_tmo; unsigned char *wlinebuf; int wlinesize; struct DNSCTX *dnsctx; };#define SPECIOR_SPACE 64#ifndef __SPECIOR#define __SPECIOR void *#endif#pragma nostandard struct IOR { struct IOR *flink, *blink; struct NETLIBIOSBDEF iosb; TIME timeout; struct CTX *ctx;! struct NETLIBIOSBDEF *iosbp; unsigned int iorflags;'#define IOR_M_IO_COMPLETED (1<<0)&#define IOR_M_IO_TIMED (1<<1)'#define IOR_M_IO_TIMEOUT (1<<2) void (*astadr)(); void *astprm; union { void *address; unsigned int longword; unsigned short word; } arg[8]; variant_union {4 unsigned char specior_space[SPECIOR_SPACE]; __SPECIOR specior; } specior_overlay; };#pragma standard struct DNSREQ {" struct DNSREQ *flink, *blink; struct IOR *ior; struct CTX *ctx; struct NAMESERVER *curns; struct DOMAIN *curdom; char *query_name;! unsigned short query_namlen; unsigned int query_flags; unsigned char *query_rbuf;! unsigned int query_rbufsize; unsigned int query_class; unsigned int query_type;# unsigned int buflen, replylen; int retries; struct SINDEF sin; struct SINDEF rsin; unsigned char buf[1024]; };#ifndef __NETLIB_MODULE_MEM__#pragma nostandard, globalref unsigned int netlib_synch_efn;- globalref unsigned int netlib_asynch_efn;#pragma standardA unsigned int netlib___alloc_ctx(struct CTX **, unsigned int);1 unsigned int netlib___free_ctx(struct CTX *);3 unsigned int netlib___alloc_ior(struct IOR **);1 unsigned int netlib___free_ior(struct IOR *);9 unsigned int netlib___alloc_dnsreq(struct DNSREQ **);7 unsigned int netlib___free_dnsreq(struct DNSREQ *);#endif#endif /* NETLIB_H_LOADED */ÿÿà? NETLIB_SRC.BCK ç [NETLIB]NETLIBDEF.H;19\6ùð*[NETLIB]NETLIBDEF.H;19+, ./€ 4\p-ç 0ª123KÿPWO56qÜI²ÑÞ›7vPX²ÑÞ›89¹AJ(ú›G€HˆªJÿ/*** NETLIBDEF.H**-** Definitions for use with NETLIB routines.**C** COPYRIGHT © 1993, 1997 MADGOAT SOFTWARE. ALL RIGHTS RESERVED.**** MODIFICATION HISTORY:**,** 29-Sep-1993 Madison Initial coding.E** 11-Mar-1997 Madison DNS updates, courtesy Claudio Allocchio.0** 27-Nov-1997 Madison Add NETLIB_M_FLUSH.*/#ifndef __NETLIBDEF_H_LOADED__#define __NETLIBDEF_H_LOADED__##define NETLIB_K_TYPE_STREAM 1##define NETLIB_K_TYPE_DGRAM 2(#define NETLIB_K_OPTION_REUSEADDR 0x04(#define NETLIB_K_OPTION_KEEPALIVE 0x08(#define NETLIB_K_OPTION_BROADCAST 0x20)#define NETLIB_K_OPTION_SNDBUF 0x1001)#define NETLIB_K_OPTION_RCVBUF 0x1002*#define NETLIB_K_OPTION_SNDLOWAT 0x1003*#define NETLIB_K_OPTION_RCVLOWAT 0x1004(#define NETLIB_K_LEVEL_SOCKET 0xffff##define NETLIB_K_AF_INET 2##define NETLIB_K_LOOKUP_DNS 1&#define NETLIB_K_LOOKUP_HOST_TABLE 2&#define NETLIB_K_SHUTDOWN_RECEIVER 0&#define NETLIB_K_SHUTDOWN_SENDER 1%#define NETLIB_K_SHUTDOWN_BOTH 2'#define NETLIB_M_ALLOW_LF (1<<0)&#define NETLIB_M_FLUSH (1<<1))#define NETLIB_M_DOMAIN_SEARCH (1<<0)(#define NETLIB_M_NO_RECURSION (1<<1)##define NETLIB_K_DNS_TYPE_A 0x01##define NETLIB_K_DNS_TYPE_NS 0x02##define NETLIB_K_DNS_TYPE_MD 0x03##define NETLIB_K_DNS_TYPE_MF 0x04&#define NETLIB_K_DNS_TYPE_CNAME 0x05$#define NETLIB_K_DNS_TYPE_SOA 0x06##define NETLIB_K_DNS_TYPE_MB 0x07##define NETLIB_K_DNS_TYPE_MG 0x08##define NETLIB_K_DNS_TYPE_MR 0x09%#define NETLIB_K_DNS_TYPE_NULL 0x0A$#define NETLIB_K_DNS_TYPE_WKS 0x0B$#define NETLIB_K_DNS_TYPE_PTR 0x0C&#define NETLIB_K_DNS_TYPE_HINFO 0x0D&#define NETLIB_K_DNS_TYPE_MINFO 0x0E##define NETLIB_K_DNS_TYPE_MX 0x0F$#define NETLIB_K_DNS_TYPE_TXT 0x10&#define NETLIB_K_DNS_TYPE_RP 0x11&#define NETLIB_K_DNS_TYPE_AFSDB 0x12&#define NETLIB_K_DNS_TYPE_X25 0x13&#define NETLIB_K_DNS_TYPE_ISDN 0x14&#define NETLIB_K_DNS_TYPE_RT 0x15&#define NETLIB_K_DNS_TYPE_NSAP 0x16'#define NETLIB_K_DNS_TYPE_NSAP_PTR 0x17&#define NETLIB_K_DNS_TYPE_SIG 0x18&#define NETLIB_K_DNS_TYPE_KEY 0x19&#define NETLIB_K_DNS_TYPE_PX 0x1A&#define NETLIB_K_DNS_TYPE_GPOS 0x1B&#define NETLIB_K_DNS_TYPE_AAAA 0x1C&#define NETLIB_K_DNS_TYPE_LOC 0x1D&#define NETLIB_K_DNS_TYPE_UINFO 0x64&#define NETLIB_K_DNS_TYPE_UID 0x65&#define NETLIB_K_DNS_TYPE_GID 0x66&#define NETLIB_K_DNS_TYPE_UNSPEC 0x67&#define NETLIB_K_DNS_TYPE_AXFR 0xFC&#define NETLIB_K_DNS_TYPE_MAILB 0xFD&#define NETLIB_K_DNS_TYPE_MAILA 0xFE)#define NETLIB_K_DNS_QTYPE_ALL 0xFF$#define NETLIB_K_DNS_CLASS_IN 0x01$#define NETLIB_K_DNS_CLASS_CS 0x02$#define NETLIB_K_DNS_CLASS_CH 0x03$#define NETLIB_K_DNS_CLASS_HS 0x04&#define NETLIB_K_DNS_QCLASS_ALL 0xFF #define NETLIB_K_DNS_OP_STDQ 0 #define NETLIB_K_DNS_OP_INVQ 1"#define NETLIB_K_DNS_OP_STATUS 2##define NETLIB_K_DNS_RC_SUCCESS 0"#define NETLIB_K_DNS_RC_FMTERR 1##define NETLIB_K_DNS_RC_SRVFAIL 2"#define NETLIB_K_DNS_RC_NAMERR 3"#define NETLIB_K_DNS_RC_NOTIMP 4"#define NETLIB_K_DNS_RC_REFUSE 5#ifdef __ALPHA#pragma member_alignment save#pragma nomember_alignment#endif#pragma nostandard struct NETLIB_DNS_HEADER {" unsigned short dns_w_queryid; variant_union {$ unsigned short dns_w_flags; variant_struct {6 unsigned int dns_v_recursion_desired : 1;/ unsigned int dns_v_truncated : 1;/ unsigned int dns_v_authoritative : 1;- unsigned int dns_v_opcode : 4;, unsigned int dns_v_reply : 1;/ unsigned int dns_v_reply_code : 4;/ unsigned int dns_v_xx_unsused_xx : 3;6 unsigned int dns_v_recursion_available : 1; } dns_x_flags; } dns_r_flags_overlay;" unsigned short dns_w_qdcount;" unsigned short dns_w_ancount;" unsigned short dns_w_nscount;" unsigned short dns_w_arcount; };#pragma standard struct SOCKADDRDEF {& unsigned short sockaddr_w_family;( unsigned char sockaddr_x_data[14]; }; struct INADDRDEF {! unsigned long inaddr_l_addr; }; struct SINDEF {! unsigned short sin_w_family; unsigned short sin_w_port;! struct INADDRDEF sin_x_addr; unsigned char sin_x_mbz[8]; }; struct NETLIBIOSBDEF {" unsigned short iosb_w_status;! unsigned short iosb_w_count;" unsigned long iosb_l_unused; };#define NETLIB_S_MXRR_NAME 128 struct MXRRDEF {$ unsigned int mxrr_l_preference; unsigned int mxrr_l_length;/ char mxrr_t_name[NETLIB_S_MXRR_NAME]; };#ifdef __ALPHA #pragma member_alignment restore#endif>#define netlib_word_swap(x) ((((x)>>8)&0xff)|(((x)&0xff)<<8 ))\#define netlib_long_swap(x) ((((x)>>24)&0xff)|(((x)>>8)&0xff00)|(((x)&0xff00)<<8)|((x)<<24))#ifndef __NETLIB_BUILD__#ifdef __cplusplus extern "C" {#endif3 unsigned int netlib_socket(void **socket, ...);S unsigned int netlib_server_setup(void **socket, void *sa, unsigned int *salen);P unsigned int netlib_bind(void **socket, void *sa, unsigned int *salen, ...);< unsigned int netlib_getsockname(void **socket, void *sa,> unsigned int *sasize, unsigned int *salen, ...);< unsigned int netlib_getpeername(void **socket, void *sa,> unsigned int *sasize, unsigned int *salen, ...);S unsigned int netlib_connect(void **socket, void *sa, unsigned int *salen, ...);@ unsigned int netlib_write(void **socket, void *bufdsc, ...);D unsigned int netlib_writeline(void **socket, void *bufdsc, ...);? unsigned int netlib_read(void **socket, void *bufdsc, ...);C unsigned int netlib_readline(void **socket, void *bufdsc, ...);5 unsigned int netlib_shutdown(void **socket, ...);2 unsigned int netlib_close(void **socket, ...);3 unsigned int netlib_listen(void **socket, ...);C unsigned int netlib_accept(void **socket, void **newsock, ...);8 unsigned int netlib_get_hostname(void *bufdsc, ...);F unsigned int netlib_setsockopt(void **socket, unsigned int *level,L unsigned int *option, void *value, unsigned int *vallen, ...);F unsigned int netlib_getsockopt(void **socket, unsigned int *level,N unsigned int *option, void *buffer, unsigned int *bufsize, ...);Y unsigned int netlib_name_to_address(void **socket, unsigned int *which, void *namdsc,? void *addrlist, unsigned int *addrlistsize, ...);V unsigned int netlib_address_to_name(void *socket, unsigned int *which, void *addr,9 unsigned int *addrsize, void *namdsc, ...);I int netlib_dns_skipname(unsigned char *bufp, unsigned short *buflen);R unsigned int netlib_dns_expandname(unsigned char *buf, unsigned short *buflen,6 unsigned char *bufp, void *namdsc, ...);> unsigned int netlib_dns_query(void **socket, void *namdsc,6 unsià@ NETLIB_SRC.BCK ç [NETLIB]NETLIBDEF.H;19\g´gned int *class, unsigned int *type,@ unsigned char *buf, unsigned short *bufsize, ...);B unsigned int netlib_strtoaddr(void *dsc, struct INADDRDEF *a);G unsigned int netlib_addrtostr(struct INADDRDEF *a, void *dsc, ...);6 unsigned int netlib_connect_by_name(void **socket,4 void *dsc, unsigned short *port, ...);? unsigned int netlib_dns_mx_lookup(void **socket, void *dsc,7 void *mxrr, unsigned int *mxrrsize, ...);7 unsigned int netlib_hton_long(unsigned int *value);7 unsigned int netlib_ntoh_long(unsigned int *value);; unsigned short netlib_hton_word(unsigned short *value);; unsigned short netlib_ntoh_word(unsigned short *value);2 unsigned int netlib_version(void *dsc, ...);#ifdef __cplusplus}#endif!#endif /* not __NETLIB_BUILD__ */##endif /* __NETLIBDEF_H_LOADED__ */ÿÿàA NETLIB_SRC.BCKç [NETLIB]NETLIBDEF.R32;5@s!ð*[NETLIB]NETLIBDEF.R32;5+,./€ 4@ Â-ç 0ª123KÿPWO 56€0‡ãÃÞ›7Ïð•ãÃÞ›89¹AJ(ú›G€HˆªJÿ!++! NETLIBDEF.R32! -! Definitions for use with NETLIB routines.! =! COPYRIGHT © 1994, MADGOAT SOFTWARE. ALL RIGHTS RESERVED.! ! MODIFICATION HISTORY:! 7! 04-NOV-1994 Madison Initial coding (for V2.0).0! 27-NOV-1997 Madison Add NETLIB_M_FLUSH.!--LITERAL! NETLIB_K_TYPE_STREAM = 1,! NETLIB_K_TYPE_DGRAM = 2,$ NETLIB_K_OPTION_REUSEADDR = 4,$ NETLIB_K_OPTION_KEEPALIVE = 8,% NETLIB_K_OPTION_BROADCAST = 32,& NETLIB_K_OPTION_SNDBUF = %X'1001',& NETLIB_K_OPTION_RCVBUF = %X'1002',+ NETLIB_K_OPTION_SNDLOWAT = %X'1003',+ NETLIB_K_OPTION_RCVLOWAT = %X'1004',% NETLIB_K_LEVEL_SOCKET = %X'FFFF', NETLIB_K_AF_INET = 2, NETLIB_K_LOOKUP_DNS = 1,$ NETLIB_K_LOOKUP_HOST_TABLE = 2,$ NETLIB_K_SHUTDOWN_RECEIVER = 0,$ NETLIB_K_SHUTDOWN_SENDER = 1, NETLIB_K_SHUTDOWN_BOTH = 2;LITERAL NETLIB_M_ALLOW_LF = 1, NETLIB_M_FLUSH = 2;LITERAL NETLIB_M_DOMAIN_SEARCH = 1, NETLIB_M_NO_RECURSION = 2;LITERAL" NETLIB_K_DNS_TYPE_A = %X'01'," NETLIB_K_DNS_TYPE_NS = %X'02'," NETLIB_K_DNS_TYPE_MD = %X'03'," NETLIB_K_DNS_TYPE_MF = %X'04',% NETLIB_K_DNS_TYPE_CNAME = %X'05',# NETLIB_K_DNS_TYPE_SOA = %X'06'," NETLIB_K_DNS_TYPE_MB = %X'07'," NETLIB_K_DNS_TYPE_MG = %X'08'," NETLIB_K_DNS_TYPE_MR = %X'09',$ NETLIB_K_DNS_TYPE_NULL = %X'0A',# NETLIB_K_DNS_TYPE_WKS = %X'0B',# NETLIB_K_DNS_TYPE_PTR = %X'0C',% NETLIB_K_DNS_TYPE_HINFO = %X'0D',% NETLIB_K_DNS_TYPE_MINFO = %X'0E'," NETLIB_K_DNS_TYPE_MX = %X'0F',# NETLIB_K_DNS_TYPE_TXT = %X'10',$ NETLIB_K_DNS_QTYPE_ALL = %X'FF',# NETLIB_K_DNS_CLASS_IN = %X'01',# NETLIB_K_DNS_CLASS_CS = %X'02',# NETLIB_K_DNS_CLASS_CH = %X'03',# NETLIB_K_DNS_CLASS_HS = %X'04',% NETLIB_K_DNS_QCLASS_ALL = %X'FF', NETLIB_K_DNS_OP_STDQ = 0, NETLIB_K_DNS_OP_INVQ = 1, NETLIB_K_DNS_OP_STATUS = 2, NETLIB_K_DNS_RC_SUCCESS = 0, NETLIB_K_DNS_RC_FMTERR = 1, NETLIB_K_DNS_RC_SRVFAIL = 2, NETLIB_K_DNS_RC_NAMERR = 3, NETLIB_K_DNS_RC_NOTIMP = 4, NETLIB_K_DNS_RC_REFUSE = 5;LITERAL DNS_S_HEADER = 12;MACRO% DNS_W_QUERYID = 0,0,16,0%,% DNS_W_FLAGS = 2,0,16,0%,' DNS_V_RECURSION_DESIRED = 2,0,1,0%,$ DNS_V_TRUNCATED = 2,1,1,0%,' DNS_V_AUTHORITATIVE = 2,2,1,0%,$ DNS_V_OPCODE = 2,3,4,0%,$ DNS_V_REPLY = 2,7,1,0%,$ DNS_V_REPLY_CODE = 2,8,4,0%,* DNS_V_RECURSION_AVAILABLE = 2,15,1,0%,% DNS_W_QDCOUNT = 4,0,16,0%,% DNS_W_ANCOUNT = 6,0,16,0%,% DNS_W_NSCOUNT = 8,0,16,0%,& DNS_W_ARCOUNT = 10,0,16,0%,7 NETLIB_DNS_HEADER = BLOCK [DNS_S_HEADER,BYTE]%;LITERAL! SOCKADDR_S_SOCKADDRDEF = 16, SOCKADDR_S_DATA = 14;MACRO& SOCKADDR_W_FAMILY = 0,0,16,0%,$ SOCKADDR_X_DATA = 2,0,0,0%,@ SOCKADDRDEF = BLOCK [SOCKADDR_S_SOCKADDRDEF,BYTE]%;LITERAL INADDR_S_INADDRDEF = 4;MACRO% INADDR_L_ADDR = 0,0,32,0%,: INADDRDEF = BLOCK [INADDR_S_INADDRDEF,BYTE]%;LITERAL SIN_S_SINDEF = 16, SIN_S_MBZ = 8;MACRO% SIN_W_FAMILY = 0,0,16,0%,$ SIN_W_PORT = 2,0,16,0%,$ SIN_X_ADDR = 4,0,32,0%," SIN_X_MBZ = 8,0,0,0%,3 SINDEF = BLOCK [SIN_S_SINDEF,BYTE]%;LITERAL IOSB_S_IOSBDEF = 8;MACRO% IOSB_W_STATUS = 0,0,16,0%,% IOSB_W_COUNT = 2,0,16,0%,% IOSB_L_UNUSED = 4,0,32,0%,5 IOSBDEF = BLOCK [IOSB_S_IOSBDEF,BYTE]%;LITERAL MXRR_S_MXRRDEF = 136, MXRR_S_NAME = 128," NETLIB_S_MXRR_NAME = 128;MACRO& MXRR_L_PREFERENCE = 0,0,32,0%,% MXRR_L_LENGTH = 4,0,32,0%,$ MXRR_T_NAME = 8,0,0,0%,5 MXRRDEF = BLOCK [MXRR_S_MXRRDEF,BYTE]%;!+)! Definitions for V1 NETLIB - OBSOLETE!!-LITERAL NET_K_TCP = 1, NET_K_UDP = 2, NET_M_PUSH = 1, NET_M_NOTRM = 2;MACRO NET_V_PUSH = 0,0,1,0%, NET_V_NOTRM = 0,1,1,0%;ÿÿà B NETLIB_SRC.BCKç [NETLIB]NETLIB.OPT;26:à(ð*[NETLIB]NETLIB.OPT;26+,./€ 4:ð-ç 0ª123KÿPWO56„ÉÓÑÞ›7¥BßÑÞ›89¹AJ(ú›G€HˆªJÿ3CLUSTER=$$NETLIB_VECTOR,,,BIN_DIR:NETLIB_VECTOR.OBJCLUSTER=$$NETLIB_CPYRGT!PSECT_ATTR=$$$COPYRIGHT,NOWRT,SHR$COLLECT=$$NETLIB_CPYRGT,$$$COPYRIGHT:BIN_DIR:NETLIB_COMMON.OLB/INCLUDE=(DNS,DNS_MXLOOK)/LIBRARYSYS$SHARE:VAXCRTL/SHAREÿÿàC NETLIB_SRC.BCKý ç ETLIB]NETLIB.ALPHA_OPT;29:†–ð*[NETLIB]NETLIB.ALPHA_OPT;29+,ý ./€ 4:Æ-ç 0ª123KÿPWO56ÞKØÆÞ›7#WWØÆÞ›89¹AJ(ú›G€HˆªJÿ!PSECT_ATTR=$$$COPYRIGHT,NOWRT,SHRCLUSTER=$$NETLIB_CPYRGT$COLLECT=$$NETLIB_CPYRGT,$$$COPYRIGHT:BIN_DIR:NETLIB_COMMON.OLB/INCLUDE=(DNS,DNS_MXLOOK)/LIBRARYSYMBOL_VECTOR=(-! NET_ASSIGN = PROCEDURE,- NET_BIND = PROCEDURE,-" NET_DEASSIGN = PROCEDURE,-" NET_GET_ADDRESS = PROCEDURE,-" NET_ADDR_TO_NAME = PROCEDURE,-" NET_GET_INFO = PROCEDURE,-" NET_GET_HOSTNAME = PROCEDURE,-" TCP_CONNECT = PROCEDURE,-" TCP_CONNECT_ADDR = PROCEDURE,-" TCP_DISCONNECT = PROCEDURE,-! TCP_ACCEPT = PROCEDURE,- TCP_SEND = PROCEDURE,-" TCP_RECEIVE = PROCEDURE,-" TCP_GET_LINE = PROCEDURE,- UDP_SEND = PROCEDURE,-" UDP_RECEIVE = PROCEDURE,-! DNS_MXLOOK = PROCEDURE,-' NET_SET_TRACE_ROUTINE = PROCEDURE,-" NETLIB_SOCKET = PROCEDURE,-% NETLIB_SERVER_SETUP = PROCEDURE,-" NETLIB_BIND = PROCEDURE,-$ NETLIB_GETSOCKNAME = PROCEDURE,-$ NETLIB_GETPEERNAME = PROCEDURE,-" NETLIB_CONNECT = PROCEDURE,-" NETLIB_WRITE = PROCEDURE,-" NETLIB_WRITELINE = PROCEDURE,-" NETLIB_READ = PROCEDURE,-" NETLIB_READLINE = PROCEDURE,-" NETLIB_SHUTDOWN = PROCEDURE,-" NETLIB_CLOSE = PROCEDURE,-" NETLIB_LISTEN = PROCEDURE,-" NETLIB_ACCEPT = PROCEDURE,-% NETLIB_GET_HOSTNAME = PROCEDURE,-# NETLIB_SETSOCKOPT = PROCEDURE,-# NETLIB_GETSOCKOPT = PROCEDURE,-( NETLIB_NAME_TO_ADDRESS = PROCEDURE,-( NETLIB_ADDRESS_TO_NAME = PROCEDURE,-" NETLIB_DNS_QUERY = PROCEDURE,-% NETLIB_DNS_SKIPNAME = PROCEDURE,-' NETLIB_DNS_EXPANDNAME = PROCEDURE,-" NETLIB_STRTOADDR = PROCEDURE,-" NETLIB_ADDRTOSTR = PROCEDURE,-( NETLIB_CONNECT_BY_NAME = PROCEDURE,-& NETLIB_DNS_MX_LOOKUP = PROCEDURE,-" NETLIB_HTON_LONG = PROCEDURE,-" NETLIB_NTOH_LONG = PROCEDURE,-" NETLIB_HTON_WORD = PROCEDURE,-" NETLIB_NTOH_WORD = PROCEDURE,-! NETLIB_VERSION = PROCEDURE)ÿÿàD NETLIB_SRC.BCKç [NETLIB]NETLIB_SHRXFR.OPT;213C=ð*[NETLIB]NETLIB_SHRXFR.OPT;21+,./€ 436-ç 0ª123KÿPWO56‚ŸÄÆÞ›7„ÒÆÞ›89¹AJ(ú›G€HˆªJÿ3CLUSTER=$$NETLIB_VECTOR,,,BIN_DIR:NETLIB_VECTOR.OBJÿÿàE NETLIB_SRC.BCKç "[NETLIB]NETLIB_SHRXFR.ALPHA_OPT;19(J"*[NETLIB]NETLIB_SHRXFR.ALPHA_OPT;19+,./€ 4(&-ç 0ª123KÿPWO56¿¥ÏÞÆÞ›7O‘ÛÞÆÞ›89¹AJ(ú›G€HˆªJÿSYMBOL_VECTOR=(-! NET_ASSIGN = PROCEDURE,- NET_BIND = PROCEDURE,-" NET_DEASSIGN = PROCEDURE,-" NET_GET_ADDRESS = PROCEDURE,-" NET_ADDR_TO_NAME = PROCEDURE,-" NET_GET_INFO = PROCEDURE,-" NET_GET_HOSTNAME = PROCEDURE,-" TCP_CONNECT = PROCEDURE,-" TCP_CONNECT_ADDR = PROCEDURE,-" TCP_DISCONNECT = PROCEDURE,-! TCP_ACCEPT = PROCEDURE,- TCP_SEND = PROCEDURE,-" TCP_RECEIVE = PROCEDURE,-" TCP_GET_LINE = PROCEDURE,- UDP_SEND = PROCEDURE,-" UDP_RECEIVE = PROCEDURE,-! DNS_MXLOOK = PROCEDURE,-' NET_SET_TRACE_ROUTINE = PROCEDURE,-" NETLIB_SOCKET = PROCEDURE,-% NETLIB_SERVER_SETUP = PROCEDURE,-" NETLIB_BIND = PROCEDURE,-$ NETLIB_GETSOCKNAME = PROCEDURE,-$ NETLIB_GETPEERNAME = PROCEDURE,-" NETLIB_CONNECT = PROCEDURE,-" NETLIB_WRITE = PROCEDURE,-" NETLIB_WRITELINE = PROCEDURE,-" NETLIB_READ = PROCEDURE,-" NETLIB_READLINE = PROCEDURE,-" NETLIB_SHUTDOWN = PROCEDURE,-" NETLIB_CLOSE = PROCEDURE,-" NETLIB_LISTEN = PROCEDURE,-" NETLIB_ACCEPT = PROCEDURE,-% NETLIB_GET_HOSTNAME = PROCEDURE,-# NETLIB_SETSOCKOPT = PROCEDURE,-# NETLIB_GETSOCKOPT = PROCEDURE,-( NETLIB_NAME_TO_ADDRESS = PROCEDURE,-( NETLIB_ADDRESS_TO_NAME = PROCEDURE,-" NETLIB_DNS_QUERY = PROCEDURE,-% NETLIB_DNS_SKIPNAME = PROCEDURE,-' NETLIB_DNS_EXPANDNAME = PROCEDURE,-" NETLIB_STRTOADDR = PROCEDURE,-" NETLIB_ADDRTOSTR = PROCEDURE,-( NETLIB_CONNECT_BY_NAME = PROCEDURE,-& NETLIB_DNS_MX_LOOKUP = PROCEDURE,-" NETLIB_HTON_LONG = PROCEDURE,-" NETLIB_NTOH_LONG = PROCEDURE,-" NETLIB_HTON_WORD = PROCEDURE,-" NETLIB_NTOH_WORD = PROCEDURE,-! NETLIB_VERSION = PROCEDURE)ÿÿÐF NETLIB_SRC.BCKç [NETLIB]NETLIB_DOC.SDML;25dŒ‡Ñð*[NETLIB]NETLIB_DOC.SDML;25+,.Œ/€ 4dŒŒ®-ç 0ª123KÿPWO56˜—§ÎÞ›7‘ÿçÎÞ›89¹AJ(ú›G€HˆªJÿ(NETLIB_DOC_1) "(NETLIB Programmer's Guide)!�<ABSTRACT>(<REFERENCE>(RELMONTH))�;�<P>This manual contains information about NETLIB, a library�.�for TCP/IP network programming on VMS systems. �<ENDABSTRACT>�+�<REVISION_INFO>(This is an updated manual.)�D�<REVISION_INFO>(Operating System and Version:\VAX/VMS V5.2 or later;�OpenVMS Alpha V1.5 or later)3�<REVISION_INFO>(Software Version:\<REFERENCE>(VER))�6�<ENDTITLE_PAGE>(Matthew Madison<LINE>MadGoat Software)���<COPYRIGHT_PAGE>"�<PRINT_DATE>(<REFERENCE>(PRTDATE))C�<p>Permission is granted to copy and redistribute this document for��no commercial gain.�H�<P>The information in this document is subject to change without notice :�and should not be construed as a commitment by the author.9�The author assumes no responsibility for any errors that ��may appear in this document.D�<p><emphasis>(DISCLAIMER:\bold) The author, the author's employer,C� and MadGoat Software make no representations or warranties with�A� respect to the contents hereof and specifically disclaim any�Q� implied warranties of merchantability or fitness for any particular purpose.�S�<P>AXP, DEC, VAX, VMS, and OpenVMS are trademarks of Digital Equipment Corporation.�8�<P>UNIX is a trademark of Unix System Laboratories, Inc.R�<P>MultiNet and TCPware are registered trademarks of Process Software Corporation.-�<P>PathWay is a trademark of Attachmate, Inc.�O�<COPYRIGHT_DATE>(<REFERENCE>(COPYYEAR)\MadGoat Software. All Rights Reserved.)��<ENDCOPYRIGHT_PAGE>����<CONTENTS_FILE>����<PREFACE>(\NETLIB_DOC_2) ��<P>�H�There are several TCP/IP packages available for VMS systems today. EachJ�provides a VMS-style programming interface, using the $QIO system service,E�and most also provide a <quote>(socket) programming library, based on�0�the communications model developed for BSD UNIX.E�Unfortunately, there is no standard among all of the packages for the�G�$QIO-based programming interface (most, but not all, emulate Digital's,�B�at least to some degree), and the $QIO-based interface is not very �easy to use.�<P>�D�The socket libraries provided with these packages provide a somewhatL�easier-to-use programming interface, but don't permit VMS-style asynchronousG�programming (using ASTs), and generally require at least a re-LINK, and�E�sometimes source modifications, when moving from one vendor's library� �to another.��<P>�E�NETLIB was originally developed to support MadGoat Software's Message�I�Exchange mail package, which needed to support many TCP/IP packages doing�L�VMS-style asynchronous programming. NETLIB provides a consistent, VMS-styleF�interface for TCP/IP-based network programs, operating with all of theE�currently available TCP/IP packages available today for VMS (with one�=�minor exception). In addition, NETLIB allows for flexibility�A�in the use of a TCP/IP package, by selecting the vendor-dependent�0�library code at run-time, rather than link-time.��(�<head1>(Intended Audience\NETLIB_INST_3)H�<p>This manual is intended for programmers writing applications that use�NETLIB.�)�<head1>(Document Structure\NETLIB_INST_4)�J�<p>This document consists of an introductory chapter, a section containingJ�routine descriptions, and an appendix describing the status codes returned�by NETLIB routines.���(�<head1>(Related Documents\NETLIB_INST_5)M�<p>The <emphasis>(NETLIB Installation Guide) describes how to install NETLIB.��� �<endpreface>�<ENDFRONT_MATTER>���$�<CHAPTER>(Using NETLIB\NETLIB_DOC_3)�<P>�8�This chapter discusses the NETLIB programming interface.���<HEAD1>(Overview\NETLIB_DOC_4)B�<P>NETLIB provides a single programming interface that can be usedD�with almost any TCP/IP package for VMS systems. While every packageA�provides a $QIO interface and most also provide a socket library,�+�the advantages to using NETLIB instead are:��<list>(unnumbered)I�<le>NETLIB allows VMS-style asynchronous programming (using ASTs) without�@�having to use the $QIO interface directly. The $QIO programming'�interface varies from vendor to vendor.�I�<le>NETLIB selects its vendor-specific support code at run-time, allowing�F�you to switch between TCP/IP packages without re-linking your program.E�You can even have the same application, installed just once, run over�B�different TCP/IP packages at the same time on different nodes in a�VMScluster system.>�<le>NETLIB provides a VMS common language environment style ofC�programming interface, making it easier to use from other languages�:�than a UNIX-type socket library written for C programmers. �<endlist>���%�<head2>(NETLIB Services\NETLIB_DOC_5)�F�<P>NETLIB provides services for writing TCP/IP-based network programs,E�both client and server. Servers can either be standalone, AST-driven�D�programs, or can be single-threaded server processes <quote>(forked)@�by the <quote>(master server) provided with each TCP/IP package.�<p>�5�NETLIB services can be grouped into four basic areas:��<list>(unnumbered))�<le><emphasis>(Connection services\bold).�C�These routines provide the services necessary for performing TCP/IP� �network I/O.@�<le><emphasis>(Line-mode services\bold). These routines provideE�a line-oriented network reads and writes, for line-oriented protocols��that run over TCP.C�<le><emphasis>(DNS resolver services\bold). These routines provide�B�host name and address lookup services. A direct DNS query routine�is also provided.�>�<le><emphasis>(Utility routines\bold). These are routines for@�doing byte-order conversions, IP address parsing and formatting,!�and other miscellaneous services.� �<endlist>���"�<HEAD1>(Header files\NETLIB_DOC_6)�<P>�E�NETLIB includes header files for both C and BLISS programming, called�E�NETLIBDEF.H and NETLIBDEF.R32, respectively. The header files reside�J�in the NETLIB_DIR: directory. These files define constants and structures2�that are used by the NETLIB programming interface.��,�<HEAD1>(NETLIB Data Structures\NETLIB_DOC_7)�<P>�G�NETLIB uses several data structures in its programming interface. Some�E�of these data structures (INADDRDEF and SINDEF) are common to all BSD�K�socket-oriented programming libraries, one (MXRRDEF) is special to NETLIB. ��The header files provided�A�with NETLIB defines these structures for BLISS and C programmers.�)�<HEAD2>(INADDRDEF Structure\NETLIB_DOC_8)�K�<p>The INADDRDEF structure is used for passing an IP address. The contents�P�is (currently) a longword, in network byte order (see <reference>(byte_ordering)4�for more information). Its definition is (in C) is: �<interactive>�� struct INADDRDEF {!� unsigned long inaddr_l_addr;�� }��<endinteractive>&�<HEAD2>(SINDEF Structure\NETLIB_DOC_9)M�<P>The SINDEF structure defines an IP <quote>(socket,) which is a combination�B�of an IP address and a TCP or UDP port number. Its definition is: �<interactive>�� struct SINDEF {�!� unsigned short sin_w_family;�� unsigned short sin_w_port;�$� struct INADDRDEF sin_x_addr;#� unsigned char sin_x_mbz[8];�� }��<endinteractive>C�<cp>The <emphasis>(sin_w_family\bold) field should always be set to�H�NETLIB_K_AF_INET (value 2). The <emphà������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������G����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������H�������������asis>(sin_w_mbz\bold) field should�always be zeroed.�I�<cp>This is a specific form of the more general SOCKADDRDEF structure for�E�use with IP-based sockets. NETLIB currently only supports IP network�<�programming, so other types of addresses should not be used.��(�<HEAD2>(MXRRDEF Structure\NETLIB_DOC_10)I�<P>The MXRRDEF structure is used to return MX resource record information�"�in a call to NETLIB_DNS_MX_LOOKUP: �<interactive>�� struct MXRRDEF {'� unsigned int mxrr_l_preference;�#� unsigned int mxrr_l_length;�&� char mxrr_t_name[128];� }��<endinteractive>%�<p>This structure is NETLIB-specific.���2�<HEAD2>(NETLIB_DNS_HEADER Structure\NETLIB_DOC_11)I�<p>A domain name server accepts queries and returns replies prefixed with�G�with a standard header. A definition of this header is provided in the�D�NETLIB_DNS_HEADER structure. Refer to the NETLIBDEF header file andF�the appropriate DNS RFCs (such as RFC 1035) for more information aboutH�this header. Only those programs which use the NETLIB_DNS_QUERY routine!�will need this header definition.���0�<HEAD1>(Byte-Order Considerations\byte_ordering)�<P>�D�In NETLIB routines, addresses and port numbers are expected to be inF�<quote>(network order;) that is, with the high-order byte first. ThisG�is opposite the natural byte-order for VAX and AXP systems running VMS,�E�which places the low-order byte first. NETLIB provides routines that�C�can be used to reverse byte order for use in the calls which expect��it.���=�<HEAD1>(Synchronous vs. Asynchronous Operation\NETLIB_DOC_12)��<P>�E�Most NETLIB routines can be executed synchronously (where the routine�G�uses $QIOW) or asynchronously ($QIO is used instead of $QIOW). To have�T�a routine called asynchronously, specify a non-zero <emphasis>(astadr\bold) argumentK�(and, optionally, the <emphasis>(astprm\bold) argument, to have a parameter��passed to the AST routine).���'�<HEAD1>(I/O Status Block\NETLIB_DOC_13)��<P>�F�Most NETLIB routines include an optional parameter for a VMS-style I/ON�status block (IOSB), which is used to return status information to the callingF�program. The first word of the IOSB is the NETLIB status code for theF�call; the second word, for read and write operations, is the number ofJ�bytes transferred. The second longword of the IOSB is not used by NETLIB.��.�<HEAD1>(Linking NETLIB Programs\NETLIB_DOC_14)�<p>�F�To link your program with NETLIB, include the following line in a LINK �options file:� �<interactive>�� NETLIB_SHRXFR/SHARE��<endinteractive>�<p>�N�Referencing this logical name will link your program against NETLIB's transferG�vector, which at run-time will activate the appropriate vendor-specific�>�version of NETLIB (pointed to by the NETLIB_SHR logical name).��,�<HEAD1>(Contacting the Author\NETLIB_DOC_15)M�<p>There is no formal support for NETLIB. If you have Internet connectivity,�J�however, you may wish to subscribe to one or more of the following MadGoat�Software mailing lists:��<list>(simple)0�<le><emphasis>(Info-MadGoat@wkuvx1.wku.edu\bold)�<p>�D� Discussion of MadGoat Software products by users and MadGoat4� developers. To subscribe, send a message to4� <emphasis>(Info-MadGoat-Request@wkuvx1.wku.edu)D� with the word SUBSCRIBE in the first line of the body of the� message.4�<le><emphasis>(MadGoat-Announce@wkuvx1.wku.edu\bold)�<p>�D� Announcements of new releases and new products from MadGoat.'� To subscribe, send a message to�3�<emphasis>(MadGoat-Announce-Request@wkuvx1.wku.edu)�D� with the word SUBSCRIBE in the first line of the body of the� message.0�<le><emphasis>(MadGoat-Bugs@wkuvx1.wku.edu\bold)�<p>�H� Address for reporting bugs in MadGoat Software products. PleaseI� include the name of the package and version in the subject header�H� of the message, so the report can be more easily directed to the� appropriate developer. �<endlist>�����$�<part>(Routine Descriptions\rtnpart) �<part_page>�7�<title>(<reference>(rtnpart)\<reference>(rtnpart\text))� �<abstract>4�This part describes the each of the NETLIB routines. �<endabstract>��<endpart_page>(renumber)����&�<routine_section>(NETLIB Routines\RTN)��;�<set_template_heading>(rsdeflist\CONDITION VALUES RETURNED)���K�<comment>(----------------------------------------------------------------)�E�<routine>(NETLIB_ACCEPT\Accept an incoming connection\\NETLIB_DOC_16)��� �<overview>G�NETLIB_ACCEPT waits for an incoming connection and accepts it, creating�$�a new socket for the new connection. �<endoverview>����<format>�<frtn>(NETLIB_ACCEPT)�`�<fargs>(socket ,newsocket [,remaddr] [,remaddr-size] [,remaddr-len] [,iosb] [,astadr] [,astprm]) �<endformat>�=�<returns>(cond_value\longword (unsigned)\write only\by value)� �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)2�<argdef>Socket that was established as a listener.R�<argitem>(newsocket\longword_unsigned\longword (unsigned)\write only\by reference)H�<argdef>Socket for the accepted connection (created and returned by this �routine).�H�<argitem>(remaddr\structure\longword (unsigned)\write only\by reference)C�<argdef>Address of a socket_address structure into which the remote�;�address/port information for the new connection is written.�T�<argitem>(remaddr-size\longword_unsigned\longword (unsigned)\read only\by reference)7�<argdef>Size of the <emphasis>(remaddr\bold) structure.�T�<argitem>(remaddr-len\longword_unsigned\longword (unsigned)\write only\by reference)L�<argdef>Longword into which the actual returned lenght of the socket address �is written.�K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)�=�<argdef>I/O status block to receive the status for this call.�A�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)�P�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)�2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>��� �<description>�K�This routine is used as part of a <quote>(passive) open sequence, typically�G�by servers that bind a socket to a specific port number, then establish�K�a listener to handle the incoming connections. This call is used to accept�J�an incoming connection, creating a new socket for the new connection. TheK�listener socket is not affected by this call, so you can call NETLIB_ACCEPT�H�again to wait for another incoming connection on the same port after one�accept completes.��<p>�D�If you want to know the address and port number of the remote end ofI�the accepted connection, you can either use the <emphasis>(remaddr\bold),�Q�<emphasis>(remaddr-size\bold), and <emphasis>(remaddr-len\bold) arguments on this�<�call, or follow this call with a call to NETLIB_GETPEERNAME.�<enddescription>��K�<comment>(----------------------------------------------------------------)�T�<routine>(NETLIB_ADDRESS_TO_NAME\Get the host name for an IP address\\NETLIB_DOC_17)�� �<overview>H�NETLIB_ADDRESS_TO_NAME performs an inverse host lookup, returning a name�associated with an IP address. �<endoverview>����<format>�<frtn>(NETLIB_ADDRESS_TO_NAME)[�<fargs>(socket, [which], address, addrsize, hostname [,retlen] [,iosb] [,astadr] [,astprm])� �<endformat>�=�<returns>(cond_value\longword (unsigned)\write only\by value)� �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)I�<argdef>The socket about which you wish to obtain the option information.�M�<argitem>(which\longword_unsigned\longword (unsigned)\read only\by reference)�à���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������H����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������+È�������������N�<argdef>A code indicating the type of lookup to be performed. Possible valuesL�are NETLIB_K_LOOKUP_DNS (1), which requests that the name be looked up usingJ�the Domain Name System, and NETLIB_K_LOOKUP_HOST_TABLE (2), which requestsL�that the name be looked up in the local host table. If omitted, the defaultG�is NETLIB_K_LOOKUP_DNS. See the Description section for information on�2�package-specific restrictions with this parameter.G�<argitem>(address\structure\longword (unsigned)\read only\by reference)�F�<argdef>An INADDRDEF structure containing the address to be looked up.P�<argitem>(addrsize\longword_unsigned\longword (unsigned)\read only\by reference)Q�<argdef>The size of the address passed in the <emphasis>(address\bold) parameter.�I�<argitem>(hostname\char_string\character string\write only\by descriptor)�C�<argdef>A buffer into which the returned host name will be written.�G�<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)�7�<argdef>The returned length of the host name, in bytes.�K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)�=�<argdef>I/O status block to receive the status for this call.�A�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)�P�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)�2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>��� �<description>�L�This routine performs an address-to-name lookup on the specified IP address.E�Each TCP/IP package implements this function slightly differently, soC7�there are some restrictions on the use of this routine.m�<p> =�For MultiNet and Pathway, the <emphasis>(which\bold) argument G�is used to determine whether the lookup should occur using NETLIB's DNSRJ�resolver support or using the TCP/IP package's host-table access routines.M�For these packages, the host-table access method cannot be used at AST level.DG�Also, if a DNS lookup is attempted and the system is not configured forP/�DNS, an SS$_UNSUPPORTED error will be returned.s�<P>tF�For UCX, TCPware (NETLIB uses its UCX emulation mode), and CMU TCP/IP,5�the <emphasis>(which\bold) argument is ignored, sincewK�these packages do not provide separate access to DNS and local host tables.hF�For UCX, host table lookup will occur first, followed by a DNS lookup. �For CMU, this order is reversed.�<enddescription>��K�<comment>(----------------------------------------------------------------)oK�<routine>(NETLIB_ADDRTOSTR\Format an IP address to a string\\NETLIB_DOC_18)d�� �<overview>B�NETLIB_ADDRTOSTR is a utility routine for formatting an IP address�as a character string. �<endoverview>a���<format>�<frtn>(NETLIB_ADDRTOSTR)"�<fargs>(address, string [,retlen]) �<endformat> =�<returns>(cond_value\longword (unsigned)\write only\by value)i �<argdeflist>Q�<argitem>(address\INADDRDEF structure\longword (unsigned)\read only\by reference)�F�<argdef>An INADDRDEF structure containing the address to be formatted.G�<argitem>(string\char_string\character string\write only\by descriptor)_1�<argdef>The string to hold the formatted address.vG�<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)tD�<argdef>The number of characters written to <emphasis>(string\bold).�<endargdeflist>m�� �<description>dD�This is a utility routine which formats an IP address to a character(�string, using the dotted-decimal format.�<enddescription>��K�<comment>(----------------------------------------------------------------)tF�<routine>(NETLIB_BIND\Bind a socket to an address/port\\NETLIB_DOC_19)�� �<overview>=�NETLIB_BIND sets the address and/or port number for a socket.� �<endoverview>r���<format>�<frtn>(NETLIB_BIND)rI�<fargs>(socket, socket-address, sockaddr-len [,iosb] [,astadr] [,astprm]) �<endformat>-=�<returns>(cond_value\longword (unsigned)\write only\by value)e �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)�<argdef>Socket to be bound.iN�<argitem>(socket-address\structure\longword (unsigned)\read only\by reference)J�<argdef>Socket_address structure describing the addreses and port to which�the socket is to be bound.T�<argitem>(sockaddr-len\longword_unsigned\longword (unsigned)\read only\by reference)-�<argdef>Size of the socket address structure. K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)t=�<argdef>I/O status block to receive the status for this call.kA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)iP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)d2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>p�� �<description>tE�This routine is used primarily by server programs to bind a socket toeG�a particular port, and is typically followed by a call to NETLIB_LISTENs*�to open a passive connection on that port.I�<P>If a program does not bind a socket to a particular local address/portrE�combination, the underlying TCP/IP software will automatically assign_�an address and/or port.s�<enddescription>��K�<comment>(----------------------------------------------------------------) :�<routine>(NETLIB_CLOSE\Close down a socket\\NETLIB_DOC_20)�� �<overview>�NETLIB_CLOSE closes a socket.t �<endoverview>i���<format>�<frtn>(NETLIB_CLOSE)�<fargs>(socket) �<endformat>n=�<returns>(cond_value\longword (unsigned)\write only\by value)Q �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)�<argdef>Socket to be closed.�<endargdeflist>t�� �<description>nI�This routine deletes the specified socket, closing the associated network�N�communications channel, if one is open. Once closed, the socket can no longer=�be used; you must open a new one with the NETLIB_SOCKET call.c�<enddescription>��K�<comment>(----------------------------------------------------------------)fR�<routine>(NETLIB_CONNECT\Connect a socket to a remote address/port\\NETLIB_DOC_21)�� �<overview>:�NETLIB_CONNECT connects a socket to a remote address/port. �<endoverview>I���<format>�<frtn>(NETLIB_CONNECT)I�<fargs>(socket, socket-address, sockaddr-len [,iosb] [,astadr] [,astprm])s �<endformat>T=�<returns>(cond_value\longword (unsigned)\write only\by value)< �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)�<argdef>Socket to be connected.rN�<argitem>(socket-address\structure\longword (unsigned)\read only\by reference)J�<argdef>Socket_address structure describing the addreses and port to which�the socket is to be connected.T�<argitem>(sockaddr-len\longword_unsigned\longword (unsigned)\read only\by reference)-�<argdef>Size of the socket address structure.�K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)m=�<argdef>I/O status block to receive the status for this call.aA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)oP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)N2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist> �� �<description>eE�This routine is used primarily with TCP-based programs to establish adF�connection to a remote system. When used with UDP, this routine fixes;�the address to which subsequent UDP datagrams will be sent.��<enddescription>��K�<comment>(----------------------------------------------------------------)o]�<routine>(NETLIB_CONNECT_BY_NAME\Establish a TCP connection to a host by name\\NETLIB_DOC_22)S�� �<overview>G�NETLà���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������I����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������¶Q������-�������IB_CONNECT_BY_NAME establishes a TCP connection to a host using thee(�host's name, rather than its IP address. �<endoverview>s���<format>�<frtn>(NETLIB_CONNECT_BY_NAME);�<fargs>(socket, hostname, port [,iosb] [,astadr] [,astprm]) �<endformat>i=�<returns>(cond_value\longword (unsigned)\write only\by value) �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference):�<argdef>A STREAM-type socket allocated with NETLIB_SOCKET.H�<argitem>(hostname\char_string\character string\read only\by descriptor)I�<argdef>A character string containing either a host name or an IP addressw�in dotted-decimal format.aD�<argitem>(port\word_unsigned\word (unsigned)\read only\by reference)F�<argdef>The port number to connect to on the destination host. UnlikeA�the SIN_W_PORT field of a SINDEF (socket address) structure, this�A�number is specified in <emphasis>(host order), not network order.>D�NETLIB_CONNECT_BY_NAME will automatically convert the port number to�network order for you.K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference) =�<argdef>I/O status block to receive the status for this call.�A�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)rP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)u2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>:�� �<description>�E�This routine converts the specified name or dotted-decimal address to J�an IP address and uses NETLIB_CONNECT to connect to the specified host andG�port. If multiple addresses are returned by the host name lookup, eachLH�address will be tried until a connection is established or all addresses�have been tried.�<enddescription>��K�<comment>(----------------------------------------------------------------)�O�<routine>(NETLIB_DNS_EXPANDNAME\Expand a name in a DNS response\\NETLIB_DOC_23)i�� �<overview>L�NETLIB_DNS_EXPANDNAME is a utility routine used for extracting a domain name�from a DNS response. �<endoverview>i���<format>�<frtn>(NETLIB_DNS_EXPANDNAME)H>�<fargs>(bufstart, buflen, bufptr, name [,retlen] [,skipcount]) �<endformat>r=�<returns>(cond_value\longword (unsigned)\write only\by value)r �<argdeflist>B�<argitem>(bufstart\pointer\longword (unsigned)\read only\by value):�<argdef>A pointer to the start of the DNS response buffer.F�<argitem>(buflen\word_unsigned\word (unsigned)\read only\by reference))�<argdef>The size of the buffer, in bytes.i@�<argitem>(bufptr\pointer\longword (unsigned)\read only\by value)F�<argdef>A pointer to the area of the buffer containing the domain name�to be expanded.tE�<argitem>(name\char_string\character string\write only\by descriptor)oA�<argdef>A descriptor for a character string buffer into which thei�expanded name will be written.G�<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)a;�<argdef>The returned length of the expanded name, in bytes._J�<argitem>(skipcount\word_unsigned\word (unsigned)\write only\by reference)G�<argdef>The number of bytes in the buffer that were used for the domaino�name.e�<endargdeflist>.�� �<description>oB�This is a utility routine used when parsing a response returned byE�a call to NETLIB_DNS_QUERY. It expands a domain name stored in a DNShB�response out to the typical, human-readable, dotted-domain format.�<p>EF�This routine is needed because of the way domain names are representedJ�in DNS responses. Refer to RFC 1035 for further information on the format�of DNS queries and responses.v�<enddescription>��K�<comment>(----------------------------------------------------------------) S�<routine>(NETLIB_DNS_MX_LOOKUP\Look up MX records for a domain name\\NETLIB_DOC_24)p�� �<overview>D�NETLIB_DNS_MX_LOOKUP looks up a host name, returning any MX records. �<endoverview>e���<format>�<frtn>(NETLIB_DNS_MX_LOOKUP)[�<fargs>(socket, hostname, mxrrlist, mxrrlist-size [,mxrrcount] [,iosb] [,astadr] [,astprm])i �<endformat>o=�<returns>(cond_value\longword (unsigned)\write only\by value)G �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)0�<argdef>Any socket allocated with NETLIB_SOCKET.H�<argitem>(hostname\char_string\character string\read only\by descriptor)&�<argdef>The host name to be looked up.S�<argitem>(mxrrlist\array of structures\longword (unsigned)\write only\by reference)uH�<argdef>An array of MXRRDEF structures into which the MX records will be�written.U�<argitem>(mxrrlist-size\longword_unsigned\longword (unsigned)\read only\by reference)uF�<argdef>The number of elements in the <emphasis>(mxrrlist\bold) array.R�<argitem>(mxrrcount\longword_unsigned\longword (unsigned)\write only\by reference)M�<argdef>The actual number of MX records written to <emphasis>(mxrrlist\bold).nK�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)t=�<argdef>I/O status block to receive the status for this call. A�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)pP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)e2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>E�� �<description>)G�This routine performs a DNS lookup on the specified name, returning anye*�Mail Exchanger (MX) records for that name.�<p>-H�For MultiNet, TCPware, and Pathway, and UCX, this routine is a front-end6�that uses NETLIB_DNS_QUERY to perform the DNS queries.@�For CMU TCP/IP, the MX lookups are performed using NAMRES calls.�<enddescription>��K�<comment>(----------------------------------------------------------------)c>�<routine>(NETLIB_DNS_QUERY\Perform a DNS query\\NETLIB_DOC_25)�� �<overview>D�NETLIB_DNS_QUERY formats a domain name service query and returns the�response from a DNS server.( �<endoverview>_���<format>�<frtn>(NETLIB_DNS_QUERY)Z�<fargs>(socket, name, [class], type, buffer, bufsize [,flags] [,iosb] [,astadr] [,astprm]) �<endformat>\=�<returns>(cond_value\longword (unsigned)\write only\by value)r �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)G�<argdef>A socket allocated with NETLIB_SOCKET. Any socket can be used.eD�<argitem>(name\char_string\character string\read only\by descriptor)(�<argdef>The domain name to be looked up.M�<argitem>(class\longword_unsigned\longword (unsigned)\read only\by reference)�J�<argdef>The class of the query. For Internet domain names, this should beI�NETLIB_K_DNS_CLASS_IN, which is the default if this parameter is omitted.>L�<argitem>(type\longword_unsigned\longword (unsigned)\read only\by reference)K�<argdef>The type of query. Valid type codes are specified by Internet RFCsnN�on the DNS, the codes provided by NETLIB are listed in <reference>(dns_types).2�<table>(Domain Name Service query types\dns_types)�<table_setup>(3\25\5)f.�<table_heads>(Symbolic name\Value\Description)6�<table_row>(NETLIB_K_DNS_TYPE_A\1\Address (A) records)<�<table_row>(NETLIB_K_DNS_TYPE_NS\2\Name Server (NS) records)E�<table_row>(NETLIB_K_DNS_TYPE_CNAME\5\Canonical Name (CNAME) records)sE�<table_row>(NETLIB_K_DNS_TYPE_SOA\6\Start-of-Authority (SOA) records)tE�<table_row>(NETLIB_K_DNS_TYPE_WKS\11\Well-known-server (WKS) records)r;�<table_row>(NETLIB_K_DNS_TYPE_PTR\12\Pointer (PTR) records)cH�<table_row>(NETLIB_K_DNS_TYPE_HINFO\13\Host information (HINFO) records)@�<table_row>(NETLIB_K_DNS_TYPE_MX\15\Mail Exchanger (MX) records)8�<table_row>(NETLIB_K_DNS_TYPE_TXT\16\Text (TXT) records)A�<table_row>(NETLIB_K_DNS_QTYPE_ALL\255\Any available information)u �<endtable>I�<argitem>(buffer\varying_arg\lonà���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������J����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������»������<�������gword (unsigned)\write only\by reference),<�<argdef>A buffer into which the DNS response will be copied.G�<argitem>(bufsize\word_unsigned\word (unsigned)\read only\by reference)�6�<argdef>The size of <emphasis>(buffer\bold), in bytes.I�<argitem>(flags\longword_mask\longword (unsigned)\read only\by reference)-J�<argdef>A bitmask of flags specifying options for this query. Valid flagsF�are listed in <reference>(query_flags). If omitted, the default value�for this parameter is 1.5�<table>(Flag values for NETLIB_DNS_QUERY\query_flags)s�<table_setup>(3\25\5)f.�<table_heads>(Symbolic name\Value\Description)K�<table_row>(NETLIB_M_DOMAIN_SEARCH\1\Perform a domain search on the defaultt�domain.)C�<table_row>(NETLIB_M_NO_RECURSION\2\Specify a non-recursive query.)l �<endtable>K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)e=�<argdef>I/O status block to receive the status for this call. A�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)nP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)r2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist> �� �<description>OL�This routine formats a DNS query and returns the response from any answering>�name server. If the query fails, an error status is returned.�<p>pF�For MultiNet, TCPware, and Pathway, and UCX, the name servers that areK�queried are those specified for those packages. With MultiNet, for example,fB�the ones listed in the translation string for the logical name forL�MULTINET_NAMESERVERS are used. For the CMU TCP/IP package, the name serversJ�used by NAMRES are not available to NETLIB, so you must define the logicalI�name NETLIB_NAMESERVERS with the IP address(es) of the name server(s) yourH�want NETLIB to use. If no name servers can be found, SS$_UNSUPPORTED is �returned.w�<enddescription>��K�<comment>(----------------------------------------------------------------)eK�<routine>(NETLIB_DNS_SKIPNAME\Skip a name in a DNS response\\NETLIB_DOC_26)n�� �<overview>G�NETLIB_DNS_SKIPNAME is a utility routine used for parsing DNS responsest�which skips over a domain name.a �<endoverview>n���<format>�<frtn>(NETLIB_DNS_SKIPNAME)g�<fargs>(bufptr, buflen)t �<endformat>o@�<returns>(longword_signed\longword (signed)\write only\by value) �<argdeflist>@�<argitem>(bufptr\pointer\longword (unsigned)\read only\by value)D�<argdef>A pointer to the area of the DNS response buffer that begins�the name to be skipped. F�<argitem>(buflen\word_unsigned\word (unsigned)\read only\by reference)C�<argdef>A count of the number of bytes in the buffer, starting fromo�<emphasis>(bufptr\bold).�<endargdeflist>t�� �<description>iB�This is a utility routine used when parsing a response returned by@�a call to NETLIB_DNS_QUERY. It returns a count of the number ofC�bytes to skip allocated to the domain name positioned in the buffertC�at location <emphasis>(bufptr\bold). If the operation fails, -1 iso�returned to indicate an error.�<p>tF�This routine is needed because of the way domain names are representedJ�in DNS responses. Refer to RFC 1035 for further information on the format�of DNS queries and responses.n�<enddescription>��K�<comment>(----------------------------------------------------------------)hF�<routine>(NETLIB_GETPEERNAME\Get remote socket address\\NETLIB_DOC_27)�� �<overview>F�NETLIB_GETSOCKNAME returns the remote address and port information for�a connected socket.- �<endoverview>-���<format>�<frtn>(NETLIB_GETPEERNAME)>�<fargs>(socket, socket-address, sockaddr-size, sockaddr-retlen%� [,iosb] [,astadr] [,astprm]) �<endformat> =�<returns>(cond_value\longword (unsigned)\write only\by value)� �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference);�<argdef>Socket for which the information is to be returned.aO�<argitem>(socket-address\structure\longword (unsigned)\write only\by reference)�J�<argdef>Socket_address structure which will hold the returned address/port �information.U�<argitem>(sockaddr-size\longword_unsigned\longword (unsigned)\read only\by reference)f-�<argdef>Size of the socket address structure.nX�<argitem>(sockaddr-retlen\longword_unsigned\longword (unsigned)\write only\by reference)5�<argdef>Returned actual length of the socket address.iK�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)t=�<argdef>I/O status block to receive the status for this call.mA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)-P�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)k2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>t�� �<description> L�This routine is used to return the remote address and port information for a,�socket that is connected to a remote system.�<enddescription>��K�<comment>(----------------------------------------------------------------)eE�<routine>(NETLIB_GETSOCKNAME\Get local socket address\\NETLIB_DOC_28)s�� �<overview>E�NETLIB_GETSOCKNAME returns the local address and port information fors �a socket. �<endoverview>o���<format>�<frtn>(NETLIB_GETSOCKNAME)>�<fargs>(socket, socket-address, sockaddr-size, sockaddr-retlen%� [,iosb] [,astadr] [,astprm])s �<endformat>a=�<returns>(cond_value\longword (unsigned)\write only\by value)r �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference);�<argdef>Socket for which the information is to be returned.rO�<argitem>(socket-address\structure\longword (unsigned)\write only\by reference)sJ�<argdef>Socket_address structure which will hold the returned address/port �information.U�<argitem>(sockaddr-size\longword_unsigned\longword (unsigned)\read only\by reference) -�<argdef>Size of the socket address structure.lX�<argitem>(sockaddr-retlen\longword_unsigned\longword (unsigned)\write only\by reference)5�<argdef>Returned actual length of the socket address.tK�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)w=�<argdef>I/O status block to receive the status for this call.eA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)-P�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)f2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>s�� �<description>wK�This routine is used to return the local address and port information for a_(�socket that has been bound or connected.�<enddescription>��K�<comment>(----------------------------------------------------------------)s>�<routine>(NETLIB_GETSOCKOPT\Get socket options\\NETLIB_DOC_29)�� �<overview><�NETLIB_GETSOCKOPT gets the current state of a socket option. �<endoverview>p���<format>�<frtn>(NETLIB_GETSOCKOPT)lT�<fargs>(socket, level, option, value, valsize [,vallen] [,iosb] [,astadr] [,astprm]) �<endformat>f=�<returns>(cond_value\longword (unsigned)\write only\by value)/ �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)I�<argdef>The socket about which you wish to obtain the option information.tM�<argitem>(level\longword_unsigned\longword (unsigned)\read only\by reference)oH�<argdef><quote>(Level) of the option being set. The only level globallyG�supported is NETLIB_K_LEVEL_SOCKET (value X'FFFF'). Some packages alsoa'�support protocol-level option settings.(N�<argitem>(option\longword_unsigned\longword (unsigned)\read only\by reference)M�<argdef>Longword representing the option being set. Not all packages suà���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������K����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������"������K�������pport K�all options, but most support the ones listed in <reference>(option_table).)I�<P>Consult your package-specific documentation on other available optionsaL�and on option value ranges. The CMU TCP/IP package is not based on sockets,E�so this call will always return success status with 0 returned length( �on systems running that package.H�<argitem>(value\varying_arg\longword (unsigned)\write only\by reference)H�<argdef>Value to set for the option. Values vary from option to option.O�<argitem>(valsize\longword_unsigned\longword (unsigned)\read only\by reference)d>�<argdef>Size of the <emphasis>(value\bold) argument, in bytes.O�<argitem>(vallen\longword_unsigned\longword (unsigned)\write only\by reference) C�<argdef>Actual returned length of <emphasis>(value\bold), in bytes.aK�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)-=�<argdef>I/O status block to receive the status for this call.EA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)_P�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)s2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>e�� �<description>aM�This routine provides an interface to the <emphasis>(getsockopt\bold) serviceeB�provided by most TCP/IP packages (most are based on the BSD socketD�communications model). Note that not all options are available withF�all packages, and for the CMU TCP/IP this call is a no-operation -- itE�will always return a success status, with 0 as the returned length ofn�the option value.e�<enddescription>��K�<comment>(----------------------------------------------------------------) N�<routine>(NETLIB_GET_HOSTNAME\Get local host's name\\NETLIB_DOC_29_AND_A_HALF)�� �<overview>E�NETLIB_GET_HOSTNAME returns the Internet host name of the local host.r �<endoverview>n���<format>�<frtn>(NETLIB_GET_HOSTNAME)r�<fargs>(namdsc [,retlen])w �<endformat>a=�<returns>(cond_value\longword (unsigned)\write only\by value)m �<argdeflist>G�<argitem>(namdsc\char_string\character string\write only\by descriptor)sA�<argdef>Character string buffer that gets the returned host name.eG�<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)o-�<argdef>The returned length of the host name.t�<endargdeflist>s�� �<description>gB�This routine returns the name of the local host by translating theF�appropriate logical name defined for the TCP/IP package running on the�system.h�<enddescription>��K�<comment>(----------------------------------------------------------------)tW�<routine>(NETLIB_HTON_LONG\Convert host-order longword to network order\\NETLIB_DOC_30)u�� �<overview>B�NETLIB_HTON_LONG is a utility routine for converting a longword in8�the local host's byte order to a network-order longword. �<endoverview>-���<format>�<frtn>(NETLIB_HTON_LONG)�<fargs>(value) �<endformat>PD�<returns>(longword_unsigned\longword (unsigned)\write only\by value) �<argdeflist>M�<argitem>(value\longword_unsigned\longword (unsigned)\read only\by reference)s%�<argdef>The longword to be converted.t�<endargdeflist>A�� �<description>(E�This is a utility routine which reverses the byte order of a longwordrA�to convert it from the native format for the local host (which iseF�<quote>(little-endian) for VAX and AXP systems running VMS) to network@�order (which is <quote>(big-endian)). The returned value is the�network-order longword.n�<enddescription>��K�<comment>(----------------------------------------------------------------)(S�<routine>(NETLIB_HTON_WORD\Convert host-order word to network order\\NETLIB_DOC_31) �� �<overview>>�NETLIB_HTON_WORD is a utility routine for converting a word in4�the local host's byte order to a network-order word. �<endoverview>i���<format>�<frtn>(NETLIB_HTON_WORD)�<fargs>(value) �<endformat>i<�<returns>(word_unsigned\word (unsigned)\write only\by value) �<argdeflist>E�<argitem>(value\word_unsigned\word (unsigned)\read only\by reference)s!�<argdef>The word to be converted.e�<endargdeflist>\�� �<description>eA�This is a utility routine which reverses the byte order of a wordrA�to convert it from the native format for the local host (which is F�<quote>(little-endian) for VAX and AXP systems running VMS) to network>�order (which is <quote>(big-endian)). The return value is the�network-order word.,�<enddescription>��K�<comment>(----------------------------------------------------------------)mG�<routine>(NETLIB_LISTEN\Listen for incoming connections\\NETLIB_DOC_32)r�� �<overview>B�NETLIB_LISTEN sets a socket up to listen for incoming connections. �<endoverview>-���<format>�<frtn>(NETLIB_LISTEN)-6�<fargs>(socket [,backlog] [,iosb] [,astadr] [,astprm]) �<endformat>o=�<returns>(cond_value\longword (unsigned)\write only\by value)O �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)*�<argdef>Socket to be set up as a listener.J�<argitem>(backlog\unsigned int\longword (unsigned)\read only\by reference)G�<argdef>The number of backlogged connections to allow on this listener.gK�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference) =�<argdef>I/O status block to receive the status for this call.aA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)oP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value) 2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>t�� �<description>\K�This routine is used as part of a <quote>(passive) open sequence, typicallyuG�by servers that bind a socket to a specific port number, then establishoM�a listener to handle the incoming connections. This call is usually followed O�by one or more invocations of NETLIB_ACCEPT to accept the incoming connections.b�<enddescription>��K�<comment>(----------------------------------------------------------------)vW�<routine>(NETLIB_NAME_TO_ADDRESS\Get the IP address(es) for a host name\\NETLIB_DOC_33)r�� �<overview>J�NETLIB_NAME_TO_ADDRESS looks up a host name, returning its IP address(es). �<endoverview>m���<format>�<frtn>(NETLIB_NAME_TO_ADDRESS)d�<fargs>(socket, [which], hostname, addrlist, addrlist-size [,addrcount] [,iosb] [,astadr] [,astprm]) �<endformat>m=�<returns>(cond_value\longword (unsigned)\write only\by value)a �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)I�<argdef>The socket about which you wish to obtain the option information.�M�<argitem>(which\longword_unsigned\longword (unsigned)\read only\by reference)oN�<argdef>A code indicating the type of lookup to be performed. Possible valuesL�are NETLIB_K_LOOKUP_DNS (1), which requests that the name be looked up usingJ�the Domain Name System, and NETLIB_K_LOOKUP_HOST_TABLE (2), which requestsL�that the name be looked up in the local host table. If omitted, the defaultG�is NETLIB_K_LOOKUP_DNS. See the Description section for information on 2�package-specific restrictions with this parameter.H�<argitem>(hostname\char_string\character string\read only\by descriptor)&�<argdef>The host name to be looked up.S�<argitem>(addrlist\array of structures\longword (unsigned)\write only\by reference)tI�<argdef>An array of INADDRDEF structures into which the addresses will bes�written.U�<argitem>(addrlist-size\longword_unsigned\longword (unsigned)\read only\by reference)nF�<argdef>The number of elements in the <emphasis>(addrlist\bold) array.R�<argitem>(addrcount\longword_unsigned\longword (unsigned)\write only\by reference)L�<argdef>The actual number of addresses written to <emphasis>(addrlist\à���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������L����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������Y.������Z�������bold).K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)e=�<argdef>I/O status block to receive the status for this call. A�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)eP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)e2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>��� �<description>BJ�This routine performs a name-to-address lookup on the specified host name.E�Each TCP/IP package implements this function slightly differently, soD7�there are some restrictions on the use of this routine.r�<p>E=�For MultiNet and Pathway, the <emphasis>(which\bold) argumentLG�is used to determine whether the lookup should occur using NETLIB's DNSLJ�resolver support or using the TCP/IP package's host-table access routines.M�For these packages, the host-table access method cannot be used at AST level.lG�Also, if a DNS lookup is attempted and the system is not configured fors/�DNS, an SS$_UNSUPPORTED error will be returned.r�<P> F�For UCX, TCPware (NETLIB uses its UCX emulation mode), and CMU TCP/IP,5�the <emphasis>(which\bold) argument is ignored, sinceiK�these packages do not provide separate access to DNS and local host tables.oF�For UCX, host table lookup will occur first, followed by a DNS lookup. �For CMU, this order is reversed.�<enddescription>��K�<comment>(----------------------------------------------------------------)tW�<routine>(NETLIB_NTOH_LONG\Convert network-order longword to host order\\NETLIB_DOC_34)��� �<overview>B�NETLIB_NTOH_LONG is a utility routine for converting a longword in0�the network byte order to a host-order longword. �<endoverview>(���<format>�<frtn>(NETLIB_NTOH_LONG)�<fargs>(value) �<endformat>>D�<returns>(longword_unsigned\longword (unsigned)\write only\by value) �<argdeflist>M�<argitem>(value\longword_unsigned\longword (unsigned)\read only\by reference)o%�<argdef>The longword to be converted.r�<endargdeflist>d�� �<description>oE�This is a utility routine which reverses the byte order of a longworduH�to convert it from network order to host order. The return value is the�host-order longword.�<enddescription>��K�<comment>(----------------------------------------------------------------)sS�<routine>(NETLIB_NTOH_WORD\Convert network-order word to host order\\NETLIB_DOC_35)��� �<overview>>�NETLIB_NTOH_WORD is a utility routine for converting a word in,�the network byte order to a host-order word. �<endoverview>,���<format>�<frtn>(NETLIB_NTOH_WORD)�<fargs>(value) �<endformat>o<�<returns>(word_unsigned\word (unsigned)\write only\by value) �<argdeflist>E�<argitem>(value\word_unsigned\word (unsigned)\read only\by reference)s!�<argdef>The word to be converted.A�<endargdeflist>e�� �<description>fA�This is a utility routine which reverses the byte order of a wordaA�to convert it from network order to host order. The return valuem�is the host-order word.-�<enddescription>��K�<comment>(----------------------------------------------------------------)SE�<routine>(NETLIB_READ\Receive data from remote system\\NETLIB_DOC_36)i�� �<overview>=�NETLIB_READ reads data sent by a remote system from a socket.� �<endoverview>����<format>�<frtn>(NETLIB_READ)PI�<fargs>(socket, buffer [,socket-address] [,sockaddr-size] [,sockaddr-len]o1� [,timeout] [,iosb] [,astadr] [,astprm])� �<endformat>p=�<returns>(cond_value\longword (unsigned)\write only\by value)o �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)/�<argdef>Socket to which data should be written. Y�<argitem>(buffer\unspecified\longword (unsigned)\write only\by descriptor (fixed-length))>E�<argdef>The address of a descriptor for a buffer to receive the data.oO�<argitem>(socket-address\structure\longword (unsigned)\write only\by reference)eL�<argdef>Socket_address structure to receive the addreses and port from whichK�the data is to be sent. Typically used only with unconnected UDP sockets).nU�<argitem>(sockaddr-size\longword_unsigned\longword (unsigned)\read only\by reference) S�<argdef>Size of the socket address structure. Typically used only with unconnectedr �UDP sockets.T�<argitem>(sockaddr-len\longword_unsigned\longword (unsigned)\read only\by reference)8�<argdef>Returned length of the socket address structure.1�Typically used only with unconnected UDP sockets.eF�<argitem>(timeout\delta_time\quadword (signed)\read only\by reference)M�<argdef>Amount of time that NETLIB_READ should wait for the read to complete.a�If omitted, no timeout is used.fK�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)]=�<argdef>I/O status block to receive the status for this call.wA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)tP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)s2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>k�� �<description>uB�This routine reads data from the socket into the specified buffer.D�The read will complete when the buffer is full, or if the read timesJ�out (if <emphasis>(timeout\bold) is specified). A fixed-length descriptorD�should be used for the buffer. To obtain the actual number of bytes+�read in this call, use an I/O status block.t�<enddescription>��K�<comment>(----------------------------------------------------------------)>F�<routine>(NETLIB_READLINE\Read a <quote>(line) of data\\NETLIB_DOC_37)�� �<overview>>�NETLIB_READLINE reads a <quote>(line) of data from the socket. �<endoverview>n���<format>�<frtn>(NETLIB_READLINE).Q�<fargs>(socket, buffer [,retlen] [,flags] [,timeout] [,iosb] [,astadr] [,astprm])e �<endformat>s=�<returns>(cond_value\longword (unsigned)\write only\by value)s �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference).�<argdef>Socket from which data should be read.G�<argitem>(buffer\char_string\character string\write only\by descriptor)eD�<argdef>The address of a descriptor for the buffer to hold the line.G�<argitem>(retlen\word_unsigned\word (unsigned)\write only\by reference)nE�<argdef>The address of a word which receives the actual length of theE�received line.C�<argitem>(flags\bitmask\longword (unsigned)\read only\by reference)[H�<argdef>The address of a bitmask containing flags controlling this call.O�Valid flags are listed in <reference>(readline_flags). If omitted, the defaultd�value for this parameter is 1.7�<table>(Flag values for NETLIB_READLINE\readline_flags) �<table_setup>(3\25\5)t.�<table_heads>(Symbolic name\Value\Description)X�<table_row>(NETLIB_M_ALLOW_LF\1\Allows a bare linefeed as a line terminator, in addition!� to a CR/LF sequence.)mU�<table_row>(NETLIB_M_FLUSH\2\Causes NETLIB_READLINE to return any data it may have in>U� its internal buffers. See the routine description for more information.)g �<endtable>F�<argitem>(timeout\delta_time\quadword (signed)\read only\by reference)H�<argdef>The address of a VMS delta time value specifying the timeout for �this read.K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)m=�<argdef>I/O status block to receive the status for this call.gA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)pP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)�2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>p�� �<description>oC�This routine is intended for TCP-based programs that use a protocolcH�whà���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������M����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������Ä·������i�������ich delimits commands and replies with carriage-return/linefeed pairs.E�It completes only when the specified buffer is full; when a complete,eE�terminated, line has been received; or if a timeout occurs. The linee.�terminator is stripped from the returned data.�<P>�I�The NETLIB_M_FLUSH flag was added in NETLIB V2.2, for those programs that,J�need to switch between line-mode reads using this routine and <quote>(raw)I�reads using NETLIB_READ on the same TCP stream. Use this flag after yourgG�last line-mode read, but before you switch to raw reads; it will returnoI�any data that NETLIB_READLINE has buffered but not yet processed. If the(E�internal buffer is empty when NETLIB_M_FLUSH is specified, the returnnJ�status will be SS$_NORMAL and the returned length will be zero; otherwise,E�the buffered data and its actual length will be returned, without anyn�line-mode processing performed.n�<enddescription>��K�<comment>(----------------------------------------------------------------)gV�<routine>(NETLIB_SERVER_SETUP\Socket setup for <quote>(forked) servers\\NETLIB_DOC_38) �<overview>C�NETLIB_SERVER_SETUP creates and sets up the socket used by a servervG�process <quote>(forked) from a TCP/IP package's <quote>(master server).n �<endoverview>k�<format>�<frtn>(NETLIB_SERVER_SETUP)u.�<fargs>(socket, socket-address, sockaddr-size) �<endformat> =�<returns>(cond_value\longword (unsigned)\write only\by value) �<argdeflist>O�<argitem>(socket\longword_unsigned\longword (unsigned)\write only\by reference)aB�<argdef>Returned socket handle for use in subsequent NETLIB calls.V�<argitem>(socket-address\special_structure\longword (unsigned)\read only\by reference)M�<argdef>Socket address describing port being opened. See note in descriptionc�section.U�<argitem>(sockaddr-size\longword_unsigned\longword (unsigned)\read only\by reference)rQ�<argdef>Size of the structure passed in <emphasis>(socket-address\bold) argument.t�<endargdeflist>E�� �<description>rC�This routine creates a NETLIB socket for the communications channelfI�in a server program invoked by a TCP/IP package's <quote>(master server.)s'�The <emphasis>(socket-address\bold) andl-�<emphasis>(sockaddr-size\bold) arguments must I�be provided, although for all packages except CMU TCP/IP they are ignored 8�(the actual address and port number are pre-determined).�<p>dG�On systems running TCPware, use a protocol type of BG_TCP for TCP-basedoH�services and BG_UDP for UDP-based services, when defining the service in�TCPware's NETCU utility.�<NOTE>@�For at least some TCP/IP packages, this routine should be calledC�<emphasis>(before) any language-specific I/O routines (for example,cJ�the <emphasis>(printf\bold) routine in the C run-time library) are called,I�to prevent the run-time system from interfering with the network channel.L �<ENDNOTE>v�<enddescription>��K�<comment>(----------------------------------------------------------------)f>�<routine>(NETLIB_SETSOCKOPT\Set socket options\\NETLIB_DOC_39)�� �<overview>4�NETLIB_SETSOCKOPT modifies attributes of a a socket. �<endoverview>g���<format>�<frtn>(NETLIB_SETSOCKOPT)cI�<fargs>(socket, level, option, value, vallen [,iosb] [,astadr] [,astprm]) �<endformat> =�<returns>(cond_value\longword (unsigned)\write only\by value)g �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)&�<argdef>The socket you wish to modify.M�<argitem>(level\longword_unsigned\longword (unsigned)\read only\by reference)nH�<argdef><quote>(Level) of the option being set. The only level globallyG�supported is NETLIB_K_LEVEL_SOCKET (value X'FFFF'). Some packages alsot'�support protocol-level option settings.-N�<argitem>(option\longword_unsigned\longword (unsigned)\read only\by reference)M�<argdef>Longword representing the option being set. Not all packages support K�all options, but most support the ones listed in <reference>(option_table).L$�<table>(Socket options\option_table)�<table_setup>(3\25\5)e.�<table_heads>(Symbolic name\Value\Description)J�<table_row>(NETLIB_K_OPTION_REUSEADDR\4\Allows a port number to be reused.I�Value is a longword, either 1 (on) or 0 (off). Default for most packagesdK�is off, but NETLIB turns this option on automatically unless you explicitlyn"�call NETLIB_SETSOCKOPT to set it.)J�<table_row>(NETLIB_K_OPTION_SNDBUF\4097\Sets socket buffer size for sends.>�Value is a longword, typically with a maximum value of 32768.)M�<table_row>(NETLIB_K_OPTION_RCVBUF\4098\Sets socket buffer size for receives.>>�Value is a longword, typically with a maximum value of 32768.) �<endtable>I�<P>Consult your package-specific documentation on other available optionsNL�and on option value ranges. The CMU TCP/IP package is not based on sockets,;�so this call has no effect on systems running that package.rG�<argitem>(value\varying_arg\longword (unsigned)\read only\by reference)uH�<argdef>Value to set for the option. Values vary from option to option.N�<argitem>(vallen\longword_unsigned\longword (unsigned)\read only\by reference)>�<argdef>Size of the <emphasis>(value\bold) argument, in bytes.K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)f=�<argdef>I/O status block to receive the status for this call.sA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)gP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)-2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>L�� �<description>iM�This routine provides an interface to the <emphasis>(setsockopt\bold) service B�provided by most TCP/IP packages (most are based on the BSD socketD�communications model). Note that not all options are available withA�all packages, and for the CMU TCP/IP this call is a no-operation.i�<enddescription>��K�<comment>(----------------------------------------------------------------)y@�<routine>(NETLIB_SHUTDOWN\Shut down a connection\\NETLIB_DOC_40)�� �<overview>D�NETLIB_SHUTDOWN shuts down a connection without deleting the socket. �<endoverview>g���<format>�<frtn>(NETLIB_SHUTDOWN)n7�<fargs>(socket [,shuttype] [,iosb] [,astadr] [,astprm])w �<endformat>r=�<returns>(cond_value\longword (unsigned)\write only\by value)t �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)*�<argdef>Socket to be set up as a listener.K�<argitem>(shuttype\unsigned int\longword (unsigned)\read only\by reference)lE�<argdef>Type of shutdown to be performed. Possible values are listedr7�in <reference>(shut_table). If omitted, the default ist�NETLIB_K_SHUTDOWN_RECEIVER.e"�<table>(Shutdown types\shut_table)�<table_setup>(3\25\5)i.�<table_heads>(Symbolic name\Value\Description)G�<table_row>(NETLIB_K_SHUTDOWN_RECEIVER\0\Prevent any further receives.)oB�<table_row>(NETLIB_K_SHUTDOWN_SENDER\1\Prevent any further sends.)I�<table_row>(NETLIB_K_SHUTDOWN_BOTH\2\Prevent any further sends/receives.)- �<endtable>C�<P>This parameter has no meaning when using the CMU TCP/IP package.sK�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)s=�<argdef>I/O status block to receive the status for this call.�A�<argitem>(astadr\procedure\longword (unsigned)\call\by reference),P�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)l2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>g�� �<description> @�This routine closes the network connection currently open on theF�specified socket, without deleting the socket. Any data still waitingD�to be received or sent can be discarded orà���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������N����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������`]������x������� retained by specifying an7�appropriate shutdown type in <emphasis>(shuttype\bold).UE�<P>For the CMU TCP/IP package, the shutdown type is not used; the CMUN-�close operation does not provide this option. �<enddescription>��K�<comment>(----------------------------------------------------------------)NN�<routine>(NETLIB_SOCKET\Create a NETLIB communication endpoint\\NETLIB_DOC_41)�� �<overview>H�NETLIB_SOCKET creates a <quote>(socket) -- that is, a local endpoint for�TCP/IP communication.o �<endoverview> ���<format>�<frtn>(NETLIB_SOCKET)m/�<fargs>(socket [,socket-type] [,socket-family])) �<endformat>y=�<returns>(cond_value\longword (unsigned)\write only\by value)c �<argdeflist>O�<argitem>(socket\longword_unsigned\longword (unsigned)\write only\by reference)dH�<argdef>The returned socket context, for use in subsequent NETLIB calls.U�<argitem>(socket-type\longword_unsigned \longword (unsigned)\read only\by referencee)tB�<argdef>Type of socket to be created. Allowed values are shown in;�<reference>(socket_type_table). If omitted, the default isk�NETLIB_K_TYPE_STREAM.i'�<table>(Socket types\socket_type_table)s�<table_setup>(3\25\5)t.�<table_heads>(Symbolic name\Value\Description)I�<table_row>(NETLIB_K_TYPE_STREAM\1\Connection-oriented socket (for TCP).) C�<table_row>(NETLIB_K_TYPE_DGRAM\2\Connectionless socket (for UDP).)_ �<endtable>U�<argitem>(socket-family\longword_unsigned\longword (unsigned)\read only\by reference)eO�<argdef>Address/protocol family. Only NETLIB_K_AF_INET (value 2) is permitted,o%�and is assumed by default if omitted. �<endargdeflist>s�� �<description>i?�This routine creates a <quote>(socket) (an endpoint for network D�communication). One socket is required for each network connection.D�This will be the first call in most NETLIB-based programs. The onlyA�exception to this rule is a program that is intended to be run ashH�a <quote>(forked) server from a TCP/IP package's <quote>(master server),7�which will use the NETLIB_SERVER_SETUP routine instead.s�<enddescription>��K�<comment>(----------------------------------------------------------------)rR�<routine>(NETLIB_STRTOADDR\Convert a dotted-address to binary form\\NETLIB_DOC_42)�� �<overview>G�NETLIB_STRTOADDR is a utility routine for converting a character stringa@�holding a dotted-decimal IP addreses into its binary equivalent. �<endoverview>i���<format>�<frtn>(NETLIB_STRTOADDR)�<fargs>(string, address) �<endformat>t=�<returns>(cond_value\longword (unsigned)\write only\by value)- �<argdeflist>F�<argitem>(string\char_string\character string\read only\by descriptor)9�<argdef>The string containing the dotted-decimal address. R�<argitem>(address\INADDRDEF structure\longword (unsigned)\write only\by reference)<�<argdef>An INADDRDEF structure to hold the returned address.�<endargdeflist>u�� �<description>�D�This is a utility routine which parses a character string containingK�an IP address in dotted-decimal format, returning the binary representation\H�of that address in network order (suitable for a call to NETLIB_CONNECT, �for example).o�<enddescription>��K�<comment>(----------------------------------------------------------------)oW�<routine>(NETLIB_VERSION\Obtain version information for NETLIB\\NETLIB_VERSION_DESCRIP)��� �<overview>K�NETLIB_VERSION returns a character string containing the version of NETLIB.E �<endoverview>C���<format>�<frtn>(NETLIB_VERSION)�<fargs>(verstr [,retlen])e �<endformat>B=�<returns>(cond_value\longword (unsigned)\write only\by value)e �<argdeflist>G�<argitem>(verstr\char_string\character string\write only\by descriptor)WH�<argdef>A character string into which the version information is copied.H�<argitem>(retlen\word_unsigned \word (unsigned)\write only\by reference)5�<argdef>The length of the version information string. �<endargdeflist>e�� �<description>�M�This routine, added in NETLIB V2.2, returns a copy of the version informationrM�for the NETLIB library installed on the running system. For V2.2, the stringh$�has the format <QUOTE>(NETLIB V2.2).�<NOTE>M�If you need to use this routine to make a run-time determination of available(L�NETLIB features, and you wish to be compatible with NETLIB versions prior toY�V2.2, you should dynamically locate this routine's symbol name via LIB$FIND_IMAGE_SYMBOL.fS�If the symbol is not found, then you are running a version of NETLIB that pre-datesd�V2.2.o �<ENDNOTE> �<enddescription>��K�<comment>(----------------------------------------------------------------)wA�<routine>(NETLIB_WRITE\Send data to remote system\\NETLIB_DOC_43)n�� �<overview>I�NETLIB_WRITE writes data to a socket for transmission to a remote system.i �<endoverview>m���<format>�<frtn>(NETLIB_WRITE)U�<fargs>(socket, buffer [,socket-address] [,sockaddr-len] [,iosb] [,astadr] [,astprm])o �<endformat> =�<returns>(cond_value\longword (unsigned)\write only\by value) �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)/�<argdef>Socket to which data should be written.pI�<argitem>(buffer\unspecified\longword (unsigned)\read only\by descriptor)o<�<argdef>The address of a descriptor for the data to be sent.N�<argitem>(socket-address\structure\longword (unsigned)\read only\by reference)J�<argdef>Socket_address structure describing the addreses and port to whichA�the data is to be sent. Used only with unconnected UDP sockets). T�<argitem>(sockaddr-len\longword_unsigned\longword (unsigned)\read only\by reference)I�<argdef>Size of the socket address structure. Used only with unconnected �UDP sockets.K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)d=�<argdef>I/O status block to receive the status for this call.lA�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)rP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)i2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>\�� �<description>eE�This routine writes the specified data to the socket for transmissionrC�to the remote system. For UDP sockets that have not been connectedbJ�to a specific remote address, the <emphasis>(socket-address\bold) argumentF�specifies the remote address/port to which the datagram is to be sent.�<enddescription>��K�<comment>(----------------------------------------------------------------)eK�<routine>(NETLIB_WRITELINE\Send data with CR/LF termination\\NETLIB_DOC_44)-�� �<overview>M�NETLIB_WRITELINE writes data to a socket for transmission to a remote system, '�terminating the data with a CR/LF pair.B �<endoverview> ���<format>�<frtn>(NETLIB_WRITELINE)3�<fargs>(socket, buffer [,iosb] [,astadr] [,astprm])E �<endformat>o=�<returns>(cond_value\longword (unsigned)\write only\by value)a �<argdeflist>N�<argitem>(socket\longword_unsigned\longword (unsigned)\read only\by reference)/�<argdef>Socket to which data should be written.rF�<argitem>(buffer\char_string\character string\read only\by descriptor)<�<argdef>The address of a descriptor for the data to be sent.K�<argitem>(iosb\io_status_block\longword (unsigned)\write only\by reference)t=�<argdef>I/O status block to receive the status for this call.)A�<argitem>(astadr\procedure\longword (unsigned)\call\by reference)eP�<argdef>Address of an AST routine to be invoked on completion of this operation.A�<argitem>(astprm\user_arg\longword (unsigned)\read only\by value)k2�<argdef>Parameter to be passed to the AST routine.�<endargdeflist>r�� �<description>eO�This routine functions identically to NETLIB_WRITE, but adds a carriage-return/vD�linefeed pair to the data sent to the remote system. It is intendedF�for TCP-baseà���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������O����������������������������� �����NETLIB_SRC.BCK�������������������ç ��[NETLIB]NETLIB_DOC.SDML;25�����������������������������������������������������������������������������������������������������d�����Œ�������������������������ýÄ� �����‡�������d programs that use a protocol which delimits commands and�responses with CR/LFs.�<note>D�If you use NETLIB_WRITELINE asynchronously, you should only have oneC�outstanding call at any given time, to ensure proper operation withi�all TCP/IP packages. �<endnote>n�<enddescription>���<endroutine_section>��%�<APPENDIX>(Status Codes\status_codes)a�<P>m@�NETLIB translates all TCP/IP status codes into the codes used by7�DEC TCP/IP Services. The status codes are described ineJ�<reference>(status_table). For synchronous NETLIB calls, these codes are J�returned in R0 and also in the IOSB, if one is specified; for asynchronousE�calls, you should always specify an IOSB to receive the status of ther�network I/O operation.�<P>fH�Some NETLIB routines may also return status codes from other facilities,;�such as the LIB$ and STR$ routines when processing strings.g��)�<table>(NETLIB Status Codes\status_table).�<table_setup>(2\20)�(�<table_heads>(Symbolic Name\Description)L�<table_row>(SS$_ABORT\Catch-all code for errors not covered by other codes.)G�<table_row>(SS$_INSFARG\Not enough arguments specified on NETLIB call.)iL�<table_row>(SS$_BADPARAM\Invalid value specified for an argument to a NETLIBE�call. This code can also be returned by the underlying TCP/IP driverd@�when an invalid value is specified for a network I/O operation.)9�<table_row>(SS$_NOSUCHNODE\Destination address required.)a3�<table_row>(SS$_INSFMEM\Memory allocation failure.)EG�<table_row>(SS$_NOPRIV\Insufficient privilege for requested operation.)o9�<table_row>(SS$_ACCVIO\Invalid memory address specified.)o4�<table_row>(SS$_FILALRACC\Socket already connected.)?�<table_row>(SS$_LINKDISCON\Network link has been disconnected.)U@�<table_row>(SS$_TOOMUCHDATA\Result too large for user's buffer.)5�<table_row>(SS$_SUSPENDED\I/O operation would block.)tN�<table_row>(SS$_NOTNETDEV\Network operation requested for non-network device.)E�<table_row>(SS$_PROTOCOL\Protocol type or option incorrect. Protocol-?�or socket type not supported. Other general protocol failure.)\?�<table_row>(SS$_ILLCNTRFUNC\Operation not supported on socket.)e5�<table_row>(SS$_DUPLNAM\Address/port already in use.)u(�<table_row>(SS$_IVADDR\Invalid address.)9�<table_row>(SS$_UNREACHABLE\Network or host unreachable.)i9�<table_row>(SS$_RESET\Network connection has been reset.)tB�<table_row>(SS$_LINKABORT\Connection aborted by network software.)I�<table_row>(SS$_CONNECFAIL\Connection failure, or reset by peer process.)l1�<table_row>(SS$_NOLINKS\Socket is not connected.)rK�<table_row>(SS$_SHUT\Socket, host, or network software has been shut down.).-�<table_row>(SS$_TIMEOUT\Operation timed out.)n+�<table_row>(SS$_REJECT\Connection refused.)g �<endtable> �<ENDAPPENDIX>nÿÿport being opened. See note in descriptionc�section.U�<argitem>(sockaddr-size\longword_unsigned\longword (unsigned)\read only\by reference)rQ�<argdef>Size of the structure passed in <emphasis>(socket-address\bold) argument.t�<endargdeflist>E�� �<description>rC�This routine creates a NETLIB socket for the communications channelfI�inà��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������P����������������������������� �����NETLIB_SRC.BCK�������������������ç ��ETLIB]NETLIB_INST.SDML;11����������������������������������������������������������������������������������������������������S������������������������������vÈð���������������*�[NETLIB]NETLIB_INST.SDML;11�+��,����.�����/��€ �4�S�������T��������������������-�ç ����0��ª�1����2���3������K�ÿ�P���W���O�����5���6�í&‰ÐËÞ›��7�¨N—ÐËÞ›��8����������9�¹AJ(ú›��G��€�H�ˆª�J�ÿ��������������������<FRONT_MATTER>(NETLIB_INST_1)��� �<TITLE_PAGE>"�<TITLE>(NETLIB Installation Guide)!�<ABSTRACT>(<REFERENCE>(RELMONTH))�B�<P>This manual describes the installation of NETLIB, a library for*�writing TCP/IP-based network applications. �<ENDABSTRACT>�(�<REVISION_INFO>(This an updated manual.)E�<REVISION_INFO>(Operating System and Version:\VAX/VMS V5.2 or later; ��OpenVMS Alpha V1.5 or later)3�<REVISION_INFO>(Software Version:\<REFERENCE>(VER))�6�<ENDTITLE_PAGE>(Matthew Madison<LINE>MadGoat Software)���<COPYRIGHT_PAGE>"�<PRINT_DATE>(<REFERENCE>(PRTDATE))C�<p>Permission is granted to copy and redistribute this document for��no commercial gain.�H�<P>The information in this document is subject to change without notice :�and should not be construed as a commitment by the author.9�The author assumes no responsibility for any errors that ��may appear in this document.H�<p><emphasis>(DISCLAIMER:\bold) The author, the author's employer, and?� MadGoat Software make no representations or warranties with�A� respect to the contents hereof and specifically disclaim any�Q� implied warranties of merchantability or fitness for any particular purpose.�S�<P>AXP, DEC, VAX, VMS, and OpenVMS are trademarks of Digital Equipment Corporation.�8�<P>UNIX is a trademark of Unix System Laboratories, Inc.R�<P>MultiNet and TCPware are registered trademarks of Process Software Corporation.-�<P>PathWay is a trademark of Attachmate, Inc.�O�<COPYRIGHT_DATE>(<REFERENCE>(COPYYEAR)\MadGoat Software. All Rights Reserved.)��<ENDCOPYRIGHT_PAGE>��<CONTENTS_FILE>��<PREFACE>(\NETLIB_INST_2)��<P>�H�There are several TCP/IP packages available for VMS systems today. EachJ�provides a VMS-style programming interface, using the $QIO system service,E�and most also provide a <quote>(socket) programming library, based on�0�the communications model developed for BSD UNIX.E�Unfortunately, there is no standard among all of the packages for the�G�$QIO-based programming interface (most, but not all, emulate Digital's,�B�at least to some degree), and the $QIO-based interface is not very �easy to use.�<P>�D�The socket libraries provided with these packages provide a somewhatL�easier-to-use programming interface, but don't permit VMS-style asynchronousG�programming (using ASTs), and generally require at least a re-LINK, and�E�sometimes source modifications, when moving from one vendor's library� �to another.��<P>�E�NETLIB was originally developed to support MadGoat Software's Message�I�Exchange mail package, which needed to support many TCP/IP packages doing�L�VMS-style asynchronous programming. NETLIB provides a consistent, VMS-styleF�interface for TCP/IP-based network programs, operating with all of theE�currently available TCP/IP packages available today for VMS (with one�@�minor exception). In addition, NETLIB allows for flexibility inA�in the use of a TCP/IP package, by selecting the vendor-dependent�0�library code at run-time, rather than link-time.��(�<head1>(Intended Audience\NETLIB_INST_3)7�<p>This manual is intended for system managers or users�1�responsible for installing and setting up NETLIB.�)�<head1>(Document Structure\NETLIB_INST_4)�C�<p>This document consists of two chapters. Chapter 1 describes the�E�installation of NETLIB, the network interface library used by NETLIB.�A�Chapter 2 describes the installation and configuration of NETLIB.���(�<head1>(Related Documents\NETLIB_INST_5)H�<p>The <emphasis>(NETLIB Programmer's Guide) describes how to use NETLIB1�and provides descriptions of the NETLIB routines.��� �<ENDPREFACE>�<ENDFRONT_MATTER>�4�<CHAPTER>(Preparing to Install NETLIB\NETLIB_INST_6)�<P>�I�This chapter describes the steps that should be taken prior to installing��NETLIB.���-�<HEAD1>(Prerequisite Software\NETLIB_INST_11)��<P>�F�NETLIB requires VAX/VMS V5.2 or later, or OpenVMS Alpha V1.5 or later.9�It supports any of the following TCP/IP packages for VMS:��<table>��<table_setup>(2\30)�0�<table_row>(CMU TCP/IP\(VAX only) V6.5 or later)6�<table_row>(DEC TCP/IP Services for VMS\V2.0 or later)6�<table_row>(PathWay from Attachmate, Inc.\any version)B�<table_row>(TCPware from Process Software Corporation\any version);�<table_row>(Cisco/Process MultiNet for OpenVMS\any version)� �<endtable>@�<P>The target packages do not have to be installed or running onA�the system in order for NETLIB to be installed; however, you must�B�be running the target package before any NETLIB-based applications�are run.*�<head1>(VMScluster Support\NETLIB_INST_12)�<P>�G�NETLIB supports all VMScluster configurations. For mixed VAX and Alpha�G�cluster configurations, you must install NETLIB twice, once for VAX and�F�once for Alpha. Different directories must be used for each platform.�<P>�G�If you are running different TCP/IP packages on different nodes in your�F�cluster, you can still install NETLIB just once (once per platform for/�mixed VAX/Alpha clusters) and select all of the�C�TCP/IP packages you use for the one installation. Follow the steps�B�described in <reference>(postinstall) to modify the NETLIB startupD�procedure for selecting the appropriate TCP/IP support on a per-node�basis.1�<head1>(Installation Requirements\NETLIB_INST_13)�+�<P>NETLIB requires the following resources:��<list>(unnumbered)F�<le>Approximately 3,000 (VAX) or 4,000 (Alpha) free disk blocks on theH�installation working device (the system disk, or the device specified in�the AWD option for VMSINSTAL).B�<le>Approximately 1,000 disk blocks after installation on the diskJ�where NETLIB is installed for common files, plus an additional 50 (VAX) or4�(150) Alpha disk blocks per TCP/IP package selected.5�<le>If NETLIB is installed system-wide, you will need�L�3 (VAX) or 7 (Alpha) global sections and 15 (VAX) or 30 (Alpha) global pagesI�for the common NETLIB transfer vector library, plus 3 (VAX) or 10 (Alpha)�I�global sections and approximately 50 (VAX) or 80 (Alpha) global pages for��each TCP/IP-specific library.�E�<le>Approximately 5 to 20 mintues for installation time, depending on�#�system type and installation media.�C�<le>If you are running CMU TCP/IP, the SYSGEN parameter MAXBUF must��be set to at least 2300. �<endlist>���%�<HEAD1>(Release Notes\NETLIB_INST_14)�E�<p>NETLIB is provided in a distribution kit suitable for installation�H�with VMSINSTAL. The release notes in the A save set of the distributionD�kit describe installation requirements for NETLIB. You can retrieve2�the release notes by using OPTIONS N on VMSINSTAL: �<interactive>�A�<s>($ )<u>(@SYS$UPDATE:VMSINSTAL NETLIB022 load-device OPTIONS N)��<endinteractive>?�<p>where <emphasis>(load-device) represents the location of the��NETLIB installation kit.��6�<chapter>(Installing NETLIB System-wide\NETLIB_INST_8)K�<P>This chapter describes the NETLIB installation process for a system-wide��NETLIB installation.;�<HEAD1>(Invoking the Installation Procedure\NETLIB_INST_15)�4�<P>NETLIB is installled using the VMSINSTAL utility: �<interactive>�7�<s>($ )<u>(@SYS$UPDATE:VMSINSTAL NETLIB022 load-device)��<endinteractive>F�<p>where <emphasis>(load-device) represents the location of the NETLIB�installation kit.�1�<SUBHEAD1>(Installà������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Q����������������������������� �����NETLIB_SRC.BCK�������������������ç ��ETLIB]NETLIB_INST.SDML;11����������������������������������������������������������������������������������������������������S������������������������������ëQ�������������ation Questions\NETLIB_INST_16)��<p>�?�The NETLIB installation procedure will ask you for a device and�J�directory specification for the location where NETLIB should be installed,J�and will ask you to select the TCP/IP package support you want to install.M�The procedure attempts to select automatically the appropriate TCP/IP support��for your system.F�<P>You will next be asked to specify a directory into which the NETLIBI�libraries will be installed. If NETLIB is already installed and started,�D�the installation procedure will provide the current NETLIB directoryJ�location as the default answer; otherwise, it will use SYS$COMMON:[SYSLIB]E�as the default. If the directory you specify does not already exist,�1�it will be created by the installation procedure.�A�<P>After selecting a directory, you will be asked if you want the�E�NETLIB programming support files and documentation installed. If so,�F�you will be asked for a directory into which the documentation will beL�placed (the programming support files go into the NETLIB library directory).>�<P>Once all questions, the appropriate binaries (VAX or Alpha)E�are loaded, and the requested libraries are created and moved to the �C�directory you specified. If you elected to install the programming�B�support and/or documentation, those files will be loaded and moved!�into the appropriate directories.���,�<HEAD1>(Post-Installation Steps\postinstall)C�<p>Once NETLIB has been installed, it should be started by invoking��its startup command procedure: �<interactive>�'�<s>($ )<u>(@SYS$STARTUP:NETLIB_STARTUP)��<endinteractive>:�<p>This should be done from a suitably privileged account.>�This invocation of NETLIB_STARTUP should also be added to your!�system startup command procedure.���>�<CHAPTER>(Installing NETLIB for Personal Use\personal_install)D�<P>If you are not a system manager but still want to use NETLIB, youD�can install a copy of NETLIB for your own personal use. To do this,;�create a temporary working directory and SET DEFAULT to it:� �<interactive>�$�<s>($ )<u>(CREATE/DIRECTORY [.TEMP])�<s>($ )<u>(SET DEFAULT [.TEMP])��<endinteractive>E�<p>Next, unload the contents of the NETLIB save sets into the working�5�directory. All installations require the A save set:� �<interactive>�0�<s>($ )<U>(BACKUP disk:[dir]NETLIB022.A/SAVE [])�<endinteractive>1�<P>For VAX systems, you will need the B save set:� �<interactive>�0�<s>($ )<U>(BACKUP disk:[dir]NETLIB022.B/SAVE [])�<endinteractive>3�<P>For Alpha systems, you will need the C save set:� �<interactive>�0�<s>($ )<U>(BACKUP disk:[dir]NETLIB022.C/SAVE [])�<endinteractive>3�<P>Next, invoke the user-install command procedure:� �<interactive>� �<S>($ )<U>(@NETLIB_USER_INSTALL)�<endinteractive>C�<p>Answer the questions from the installation script and the NETLIB�D�files will be created. Once the installation procedure is complete,3�you can delete the files and the working directory:� �<interactive>��<s>($ )<u>(SET DEFAULT [-])��<s>($ )<u>(DELETE [.TEMP]*.*;*)�*�<s>($ )<U>(SET PROTECTION=O:RWED TEMP.DIR)�<S>($ )<U>(DELETE TEMP.DIR;)�<ENDINTERACTIVE>�<P>�B�If you want to use the programming support files or documentation,5�use BACKUP to retrieve them from saveset NETLIB022.D.���3�<head1>(Personal NETLIB Restriction\NETLIB_INST_10)�G�<p>You cannot use a personal NETLIB with NETLIB-based applications that��are installed with privileges.����+�<chapter>(On-Line Documentation\online_doc)��<P>�H�The NETLIB documentation set is provided in a form suitable for use withD�the VMS DECwindows Bookreader program (VMS V5.3 and later). To makeL�the NETLIB on-line documentation available automatically through Bookreader,H�you should add a reference to the directory containing the documentationF�(if you elected to install those files) to the DECW$BOOK logical name.��+�<appendix>(CMU TCP/IP Considerations\cmuip)��<P>�F�All of the TCP/IP packages that NETLIB supports, with the exception ofF�CMU TCP/IP, are already based on the Berkeley socket model for networkL�programming, and all except CMU use the BIND (Berkeley Internet Name Daemon)/�software for performing domain name resolution.��<head1>(DNS Resolver\cmudns)I�<P>Emulating sockets over CMU TCP/IP is not difficult, but due to the way�L�the CMU name resolver, NAMRES, is implemented, performing BIND-style queriesH�requires some additional setup over the other TCP/IP packages. The listG�of DNS servers that NAMRES uses is not available to NETLIB, so you must�C�define an additional logical name for NETLIB's DNS_QUERY routine to��be used: �<interactive>�/�<S>($ )<U>(DEFINE NETLIB_NAMESERVERS "x.x.x.x")��<ENDINTERACTIVE>F�<P>Where <quote>(x.x.x.x) is the dotted-decimal IP address of the nameL�server that DNS_QUERY should use. You may specify more than one nameserver,J�by defining NETLIB_NAMESERVERS as a search-list logical name. The logicalG�name should be defined in the system logical name table to be available��to all users on the system.��� �<head1>(Bypassing NAMRES\bypass)�<p>�G�By default, NETLIB's support for the CMU TCP/IP package uses the native�I�NAMRES for all name and address lookups (routines NETLIB_NAME_TO_ADDRESS,�<�NETLIB_ADDRESS_TO_NAME, and NETLIB_DNS_MX_LOOKUP). However,H�you can configure NETLIB to bypass NAMRES and use NETLIB's name resolver.�routines instead by defining the logical name:�� �<INTERACTIVE>�6�<S>($ )<U>(DEFINE NETLIB_BYPASS_CMU_RESOLVER anyvalue)�<ENDINTERACTIVE>H�<P>The NETLIB_NAMESERVERS logical name <emphasis>(must also) be defined.F�If the above logical name is defined, NETLIB will automatically bypass9�NAMRES and use its own resolver routines for all lookups.�O�<P>Please note that NETLIB's name resolver, unlike NAMRES, <emphasis>(does not)�N�cache the results it gets (this is typical behavior for BIND-style resolvers).J�Bypassing NAMRES, therefore, can increase network traffic for DNS lookups.?�For this reason, when using bypass mode, you should ensure that�O�NETLIB_NAMESERVERS references only name servers that are on your local network.�G�<P>In addition, bypassing NAMRES will cause name lookups to be resolved�B�<emphasis>(only) through the Domain Name System. Local host table"�definitions will not be available. �<endappendix>�ÿÿ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������à������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������R����������������������������� �����NETLIB_SRC.BCK�����������������ö ��ç ��[NETLIB]GENERATE_SYMBOLS.COM;2�������������������������������������������������������������������������������������������������c������������������������������ÑÉð���������������*�[NETLIB]GENERATE_SYMBOLS.COM;2�+��,�ö ���.�����/��€ �4�c�������T�������������������-�ç ����0��ú�1����2���3������K�ÿ�P���W���O�����5���6�€u‹Î8;›��7�A¯ÜÒÐÞ›��8����������9�¹AJ(ú›��G��€�H�ˆª�J�ÿ�����������������$ v = 'F$VERIFY (0)� �$ SET := SET*�$ SET SYMBOL/SCOPE=(NOLOCAL,NOGLOBAL)/VERB�$!c�$ months = "/January/February/March/April/May/June/July/August/September/October/November/December"��$ now = F$CVTIME (, "ABSOLUTE")�!�$ year = F$CVTIME (now,, "YEAR")�-�$ mon = F$INTEGER (F$CVTIME (now,, "MONTH"))�&�$ month = F$ELEMENT (mon, "/", months).�$ amonth = F$CVTIME (now, "ABSOLUTE", "MONTH")�$ day = F$CVTIME (now,, "DAY")�$!�$ OPEN/READ in 'p1'��$ READ in line �$ CLOSE in�$ 'line' �$ CREATE 'p2'��$ OPEN/APPEND out 'p2'/�$ WRITE out "<DEFINE_SYMBOL>(COPYYEAR\''year')"�?�$ WRITE out "<DEFINE_SYMBOL>(RELDATE\''day'-''amonth'-''year')"�9�$ WRITE out "<DEFINE_SYMBOL>(RELMONTH\''month', ''year')"�>�$ WRITE out "<DEFINE_SYMBOL>(PRTDATE\''day' ''month' ''year')"+�$ WRITE out "<DEFINE_SYMBOL>(VER\''ident')"� �$ CLOSE out��$ EXIT 1+0*F$VERIFY(v)����������������������������������������������������������������������������������������������������������������������������������������������������������������������������à������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������S����������������������������� �����NETLIB_SRC.BCK�����������������é ��ç ��ETLIB]CHECK_VERSION.COM;4����������������������������������������������������������������������������������������������������Z������������������������������O÷ð���������������*�[NETLIB]CHECK_VERSION.COM;4�+��,�é ���.�����/��€ �4�Z�������0�������������������-�ç ����0��ú�1����2���3������K�ÿ�P���W���O�����5���6�l× —ÑÞ›��7�F—ÑÞ›��8����������9�¹AJ(ú›��G��€�H�ˆª�J�ÿ��������������������$ v = 'f$verify(0) �$ SET := SET*�$ SET SYMBOL/SCOPE=(NOLOCAL,NOGLOBAL)/VERB�$!-�$ IF F$SEARCH(p1) .EQS. "" THEN GOTO Generate��$ OPEN/READ x 'p1� �$readloop:�$ READ/END=endread x line�5�$ IF F$EXTRACT(0,1,line) .EQS. "!" THEN GOTO readloop�5�$ which = F$EDIT(F$ELEMENT(0,"=",line),"TRIM,UPCASE")�5�$ value = F$EDIT(F$ELEMENT(1,"=",line),"TRIM,UPCASE")�Z�$ IF which .EQS. "IDENT" .AND. value .NES. """NETLIB ''p2'""" THEN GOTO Close_And_GenerateQ�$ IF which .EQS. "GSMATCH" .AND. value .NES. "''p3'" THEN GOTO Close_And_Generate��$ GOTO readloop� �$endread:� �$ CLOSE x��$ EXIT 1+0*F$VERIFY(v)�$Close_And_Generate: �$ CLOSE x� �$Generate:�$ DEFINE/USER SYS$INPUT _NL: �$ CREATE 'p1'��$ OPEN/APPEND x 'p1'%�$ WRITE x "IDENT=""NETLIB ", p2, """"��$ WRITE X "GSMATCH=", p3 �$ CLOSE x��$ EXIT 1+0*F$VERIFY(v)ÿÿ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������à������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������T����������������������������� �����NETLIB_SRC.BCK�����������������"��ç ��[NETLIB]NETLIB_VERSION.H;3�����������������������������������������������������������������������������������������������������&������������������������������OŠð���������������*�[NETLIB]NETLIB_VERSION.H;3�+��,�"���.�����/��€ �4�&�������ˆ��������������������-�ç ����0��ú�1����2���3������K�ÿ�P���W���O�����5���6�B­ÑÞ›��7�GÁÑÞ›��8����������9�¹AJ(ú›��G��€�H�ˆª�J�ÿ���������������������#ifndef __NETLIB_VERSION_H__�#define __NETLIB_VERSION_H__&�#define NETLIB_T_VERSION "NETLIB V2.2"!�#endif /* __NETLIB_VERSION_H__ */�ÿÿ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������à��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������U����������������������������� �����NETLIB_SRC.BCK�����������������#��ç ��[NETLIB]NETLIB_VERSION.OPT;1���������������������������������������������������������������������������������������������������������������������������������×ð���������������*�[NETLIB]NETLIB_VERSION.OPT;1�+��,�#���.�����/��€ �4��������*��������������������-�ç ����0��ú�1����2���3������K�ÿ�P���W���O�����5���6�oi@ÆÞ›��7�2ºˆÆÞ›��8����������9�¹AJ(ú›��G��€�H�ˆª�J�ÿ�������������������IDENT="NETLIB V2.2"��GSMATCH=LEQUAL,1,7ÿÿ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������à��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������V����������������������������� �����NETLIB_SRC.BCK�����������������4��ç ��[NETLIB]NETLIB022.SDML;4�������������������������������������������������������������������������������������������������������[������������������������������Éð���������������*�[NETLIB]NETLIB022.SDML;4�+��,�4���.�����/��€ �4�[������ �D��������������������-�ç ����0��ú�1����2���3������K�ÿ�P���W���O� ����5���6�Heqôú›��7�Ålƒôú›��8����������9����������G��€�H�ˆª�J�ÿ�����������������������<FRONT_MATTER>�� �<TITLE_PAGE>�<TITLE>(NETLIB Release Notes)�!�<ABSTRACT>(<REFERENCE>(RELMONTH))�G�<P>This file contains the release notes for the NETLIB TCP/IP interface�J�library. It describes any last-minute features, restrictions, changes, or�additions made to NETLIB.� �<ENDABSTRACT>�*�<REVISION_INFO>(This is a revised manual.)D�<REVISION_INFO>(Operating System and Version:\VAX/VMS V5.2 or later;&� OpenVMS Alpha V1.5 or later)3�<REVISION_INFO>(Software Version:\<REFERENCE>(VER))�6�<ENDTITLE_PAGE>(Matthew Madison<LINE>MadGoat Software)���<COPYRIGHT_PAGE>"�<PRINT_DATE>(<REFERENCE>(PRTDATE))D�<p><emphasis>(DISCLAIMER:\bold) The author, the author's employer,C� and MadGoat Software make no representations or warranties with�A� respect to the contents hereof and specifically disclaim any�Q� implied warranties of merchantability or fitness for any particular purpose.�[�<P>AXP, DEC, ULTRIX, VAX, VMS, and OpenVMS are trademarks of Digital Equipment Corporation.�8�<P>UNIX is a trademark of Unix System Laboratories, Inc.<�<P>MultiNet is a registered trademark of Cisco Systems, Inc.E�<P>TCPware is a registered trademark of Process Software Corporation.�8�<P>PathWay is a registered trademark of Attachmate, Inc.O�<COPYRIGHT_DATE>(<REFERENCE>(COPYYEAR)\MadGoat Software. All Rights Reserved.)��<ENDCOPYRIGHT_PAGE>��<CONTENTS_FILE>��<ENDFRONT_MATTER>���&�<chapter>(Updates in <reference>(ver))=�<P><reference>(ver) is a minor update to V2.1B which includes��the following changes:�<list>(unnumbered)5�<le>A new flag, NETLIB_M_FLUSH, has been added to the�;�NETLIB_READLINE routine, to provide a way of getting at any�7�data that may have been buffered by the NETLIB_READLINE�A�routine. Use this flag when you want to use both NETLIB_READLINE�D�and NETLIB_READ on the same TCP input stream. For more information,<�see the description of NETLIB_READLINE in the documentation.?�<le>A new routine, NETLIB_VERSION, has been added, to allow for�E�dynamic retrieval of the current version of NETLIB you have installed��on the system.;�<le>The <quote>(relaxed) form of NETLIB_READLINE (using the�A�NETLIB_M_ALLOW_LF flag) has been further relaxed to better handle�%�lines terminated with bare linefeeds.� �<ENDLIST>��<HEAD>(Updates in V2.1B).�<p>The following change was included in V2.1B:�<list>(unnumbered)=�<le>A bug in the processing of status codes was inadvertently�<�introduced in the V2.1A changes, affecting UCX systems only,;�that would lead to incorrect status reports and potentially��to application failures. �<endlist>��<head>(Updates in V2.1A)0�<p>The following changes were included in V2.1A:�<list>(unnumbered)<�<le>NETLIB's DNS resolver code would not properly initialize1�on systems running PathWay. This has been fixed.�3�<le>Some potential race conditions were eliminated.�=�<le>If NETLIB_CLOSE was called on a socket that had a pending�<�timed I/O, the completion I/O status was mistakenly reported<�as SS$_TIMEOUT instead of SS$_CANCEL. Only genuine timeouts �are now reported as SS$_TIMEOUT. �<endlist>��<head>(Updates in V2.1)�;�<p>NETLIB V2.1 included the following changes from previous� �releases:��<list>(unnumbered)9�<le>The TCPware library now uses UCX emulation instead of�:�SRI emulation. If you developed a server with NETLIB that:�is started by TCPware's <quote>(master) server, you should:�use NETCU to change the protocol type from STREAM or DGRAM�to BG_TCP or BG_UDP.9�<le>The NETLIB_STARTUP.COM procedure has been enhanced to�<�automatically install all available NETLIB_*_SHR images, and;�to automatically define NETLIB_SHR at startup time based on�;�which TCP/IP package is running. The startup procedure now�:�also automatically adds the NETLIB documentation directory6�to the DECwindows Bookreader search list logical name.8�<le>There was a bug in the V2.0 DNS resolver code in the;�creation of the list of domains used for searching the DNS,�;�causing it to pad expanded names with nulls. This has been��fixed. �<endlist>���#�<chapter>(Known Bugs, Restrictions)��<P>�E�There are no known bugs in NETLIB. Known restrictions are documented��in the programmer's guide.ÿÿ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������à ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������