-/*
- AddressXlation.h
- MacTCP name to address translation routines.
-
- Copyright Apple Computer, Inc. 1988-91
- All rights reserved
-
-*/
+/*
+ File: AddressXlation.h
+
+ Contains: TCP Manager interfaces for dnr.c
+
+ Version: Use with MacTCP 2.0.6 and Universal Interfaces 2.1b1
+ in ÒMPW PrereleaseÓ on ETO #17
+
+ Copyright: © 1984-1995 by Apple Computer, Inc.
+ All rights reserved.
+
+ Bugs?: If you find a problem with this file, send the file and version
+ information (from above) and the problem description to:
+
+ Internet: apple.bugs@applelink.apple.com
+ AppleLink: APPLE.BUGS
+
+*/
+
#ifndef __ADDRESSXLATION__
#define __ADDRESSXLATION__
-#ifndef __MACTCPCOMMONTYPES__
-#include "MacTCPCommonTypes.h"
+
+#ifndef __TYPES__
+#include <Types.h>
+#endif
+/* #include <ConditionalMacros.h> */
+
+#ifndef __MACTCP__
+#include <MacTCP.h>
+#endif
+/* #include <AppleTalk.h> */
+/* #include <OSUtils.h> */
+/* #include <MixedMode.h> */
+/* #include <Memory.h> */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if STRUCTALIGNMENTSUPPORTED
+#pragma options align=mac68k
+#endif
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
#endif
-#define NUM_ALT_ADDRS 4
+/*
+ Developer Notes:
+
+ When the various calls are made to the dnr code, you must set up
+ a NewRoutineDescriptor for every non-nil completion routine and/or
+ notifyProc parameter. Otherwise, the 68K dnr code, will not
+ correctly call your routine.
+ 1. For the call to EnumCache, use NewEnumResultProc to set up a
+ universal procptr to pass as the enumResultProc parameter.
+ 2. For the calls to StrToAddr and AddrToName, use NewResultProc to
+ set up a ResultUPP universal procptr to pass as the ResultProc
+ parameter.
+ 3. For the calls to HInfo and MXInfo, use NewResultProc2Proc to
+ set up a ResultProc2UPP universal procptr to pass as the ResultProc
+ parameter.
+ 4. The DNR selector symbol HINFO has been changed to HXINFO due to
+ conflict with the same symbol in the AddressXLation.h header
+*/
+
+enum {
+ NUM_ALT_ADDRS = 4
+};
+
+struct hostInfo {
+ long rtnCode;
+ char cname[255];
+ SInt8 filler; /* Filler for proper byte alignment */
+ unsigned long addr[NUM_ALT_ADDRS];
+};
+typedef struct hostInfo hostInfo;
+
+
+enum {
+ A = 1,
+ NS = 2,
+ CNAME = 5,
+ HINFO = 13,
+ MX = 15,
+ lastClass = 32767
+};
+
+typedef unsigned short AddrClasses;
+
+/* Domain Name Resolver code selectors */
-typedef struct hostInfo {
- long rtnCode;
- char cname[255];
- unsigned long addr[NUM_ALT_ADDRS];
+enum {
+ OPENRESOLVER = 1,
+ CLOSERESOLVER = 2,
+ STRTOADDR = 3,
+ ADDRTOSTR = 4,
+ ENUMCACHE = 5,
+ ADDRTONAME = 6,
+ HXINFO = 7, /* changed from HINFO due to symbol conflict*/
+ MXINFO = 8
};
-typedef enum AddrClasses {
- A = 1,
- NS,
- CNAME = 5,
- HINFO = 13,
- MX = 15,
- lastClass = 32767
-} AddrClasses;
-
-typedef struct HInfoRec {
- char cpuType[30];
- char osType[30];
- };
-
-typedef struct MXRec {
- unsigned short preference;
- char exchange[255];
- };
-
-typedef struct returnRec {
- long rtnCode;
- char cname[255];
+struct HInfoRec {
+ char cpuType[30];
+ char osType[30];
+};
+typedef struct HInfoRec HInfoRec;
+
+struct MXRec {
+ unsigned short preference;
+ char exchange[255];
+};
+typedef struct MXRec MXRec;
+
+struct returnRec {
+ long rtnCode;
+ char cname[255];
+ SInt8 filler; /* Filler for proper byte alignment */
union {
- unsigned long addr[NUM_ALT_ADDRS];
- struct HInfoRec hinfo;
- struct MXRec mx;
- } rdata;
+ unsigned long addr[NUM_ALT_ADDRS];
+ struct HInfoRec hinfo;
+ struct MXRec mx;
+ } rdata;
};
+typedef struct returnRec returnRec;
-typedef struct cacheEntryRecord {
- char *cname;
- unsigned short type;
- unsigned short cacheClass;
- unsigned long ttl;
+struct cacheEntryRecord {
+ char *cname;
+ unsigned short ctype;
+ unsigned short cacheClass;
+ unsigned long ttl;
union {
- char *name;
- ip_addr addr;
- } rdata;
+ char *name;
+ ip_addr addr;
+ } rdata;
};
+typedef struct cacheEntryRecord cacheEntryRecord;
-#ifdef __cplusplus
-extern "C" {
+typedef pascal void (*EnumResultProcPtr)(struct cacheEntryRecord *cacheEntryRecordPtr, Ptr userDataPtr);
+typedef pascal void (*ResultProcPtr)(struct hostInfo *hostInfoPtr, Ptr userDataPtr);
+typedef pascal void (*ResultProc2ProcPtr)(struct returnRec *returnRecPtr, Ptr userDataPtr);
+
+#if GENERATINGCFM
+typedef UniversalProcPtr EnumResultUPP;
+typedef UniversalProcPtr ResultUPP;
+typedef UniversalProcPtr ResultProc2UPP;
+#else
+typedef EnumResultProcPtr EnumResultUPP;
+typedef ResultProcPtr ResultUPP;
+typedef ResultProc2ProcPtr ResultProc2UPP;
#endif
-#ifdef THINK_C
+enum {
+ uppEnumResultProcInfo = kPascalStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct cacheEntryRecord*)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr))),
+ uppResultProcInfo = kPascalStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct hostInfo*)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr))),
+ uppResultProc2ProcInfo = kPascalStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct returnRec*)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
+};
- typedef ProcPtr EnumResultProcPtr;
- typedef ProcPtr ResultProcPtr;
- typedef ProcPtr ResultProc2Ptr;
-
+#if GENERATINGCFM
+#define NewEnumResultProc(userRoutine) \
+ (EnumResultUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppEnumResultProcInfo, GetCurrentArchitecture())
+#define NewResultProc(userRoutine) \
+ (ResultUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppResultProcInfo, GetCurrentArchitecture())
+#define NewResultProc2Proc(userRoutine) \
+ (ResultProc2UPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppResultProc2ProcInfo, GetCurrentArchitecture())
#else
+#define NewEnumResultProc(userRoutine) \
+ ((EnumResultUPP) (userRoutine))
+#define NewResultProc(userRoutine) \
+ ((ResultUPP) (userRoutine))
+#define NewResultProc2Proc(userRoutine) \
+ ((ResultProc2UPP) (userRoutine))
+#endif
- typedef pascal void (*EnumResultProcPtr)(struct cacheEntryRecord *cacheEntryRecordPtr, char *userDataPtr);
- typedef pascal void (*ResultProcPtr)(struct hostInfo *hostInfoPtr, char *userDataPtr);
- typedef pascal void (*ResultProc2Ptr)(struct returnRec *returnRecPtr, char *userDataPtr);
-
+#if GENERATINGCFM
+#define CallEnumResultProc(userRoutine, cacheEntryRecordPtr, userDataPtr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppEnumResultProcInfo, (cacheEntryRecordPtr), (userDataPtr))
+#define CallResultProc(userRoutine, hostInfoPtr, userDataPtr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppResultProcInfo, (hostInfoPtr), (userDataPtr))
+#define CallResultProc2Proc(userRoutine, returnRecPtr, userDataPtr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppResultProc2ProcInfo, (returnRecPtr), (userDataPtr))
+#else
+#define CallEnumResultProc(userRoutine, cacheEntryRecordPtr, userDataPtr) \
+ (*(userRoutine))((cacheEntryRecordPtr), (userDataPtr))
+#define CallResultProc(userRoutine, hostInfoPtr, userDataPtr) \
+ (*(userRoutine))((hostInfoPtr), (userDataPtr))
+#define CallResultProc2Proc(userRoutine, returnRecPtr, userDataPtr) \
+ (*(userRoutine))((returnRecPtr), (userDataPtr))
#endif
extern OSErr OpenResolver(char *fileName);
-
-extern OSErr StrToAddr(char *hostName, struct hostInfo *hostInfoPtr, ResultProcPtr ResultProc, char *userDataPtr);
-
+extern OSErr StrToAddr(char *hostName, struct hostInfo *hostInfoPtr, ResultUPP ResultProc, char *userDataPtr);
extern OSErr AddrToStr(unsigned long addr, char *addrStr);
+extern OSErr EnumCache(EnumResultUPP enumResultProc, Ptr userDataPtr);
+extern OSErr AddrToName(ip_addr addr, struct hostInfo *hostInfoPtr, ResultUPP ResultProc, Ptr userDataPtr);
+extern OSErr HInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2UPP resultProc, Ptr userDataPtr);
+extern OSErr MXInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2UPP resultProc, Ptr userDataPtr);
+extern OSErr CloseResolver(void);
+/*
+ Universal ProcPtrs declaration for each of the dnr selector code calls.
+*/
+typedef OSErr (*OpenResolverProcPtr)(UInt32 selector, char *filename);
+typedef OSErr (*CloseResolverProcPtr)(UInt32 selector);
+typedef OSErr (*StrToAddrProcPtr)(UInt32 selector, char *hostName, struct hostInfo *rtnStruct, ResultUPP resultproc, Ptr userDataPtr);
+typedef OSErr (*AddrToStrProcPtr)(UInt32 selector, unsigned long addr, char *addrStr);
+typedef OSErr (*EnumCacheProcPtr)(UInt32 selector, EnumResultUPP resultproc, Ptr userDataPtr);
+typedef OSErr (*AddrToNameProcPtr)(UInt32 selector, UInt32 addr, struct hostInfo *rtnStruct, ResultUPP resultproc, Ptr userDataPtr);
+typedef OSErr (*HInfoProcPtr)(UInt32 selector, char *hostName, struct returnRec *returnRecPtr, ResultProc2UPP resultProc, Ptr userDataPtr);
+typedef OSErr (*MXInfoProcPtr)(UInt32 selector, char *hostName, struct returnRec *returnRecPtr, ResultProc2UPP resultProc, Ptr userDataPtr);
-extern OSErr EnumCache(EnumResultProcPtr enumResultProc, char *userDataPtr);
+#if GENERATINGCFM
+typedef UniversalProcPtr OpenResolverUPP;
+typedef UniversalProcPtr CloseResolverUPP;
+typedef UniversalProcPtr StrToAddrUPP;
+typedef UniversalProcPtr AddrToStrUPP;
+typedef UniversalProcPtr EnumCacheUPP;
+typedef UniversalProcPtr AddrToNameUPP;
+typedef UniversalProcPtr HInfoUPP;
+typedef UniversalProcPtr MXInfoUPP;
+#else
+typedef OpenResolverProcPtr OpenResolverUPP;
+typedef CloseResolverProcPtr CloseResolverUPP;
+typedef StrToAddrProcPtr StrToAddrUPP;
+typedef AddrToStrProcPtr AddrToStrUPP;
+typedef EnumCacheProcPtr EnumCacheUPP;
+typedef AddrToNameProcPtr AddrToNameUPP;
+typedef HInfoProcPtr HInfoUPP;
+typedef MXInfoProcPtr MXInfoUPP;
+#endif
-extern OSErr AddrToName(ip_addr addr, struct hostInfo *hostInfoPtr, ResultProcPtr ResultProc, char *userDataPtr);
+enum {
+ uppOpenResolverProcInfo = kCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*))),
+ uppCloseResolverProcInfo = kCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32))),
+ uppStrToAddrProcInfo = kCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(struct hostInfo*)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(ResultUPP)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(Ptr))),
+ uppAddrToStrProcInfo = kCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(unsigned long)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(char*))),
+ uppEnumCacheProcInfo = kCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EnumResultUPP)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr))),
+ uppAddrToNameProcInfo = kCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(UInt32)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(struct hostInfo*)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(ResultUPP)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(Ptr))),
+ uppHInfoProcInfo = kCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(struct returnRec*)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(ResultProc2UPP)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(Ptr))),
+ uppMXInfoProcInfo = kCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(struct returnRec*)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(ResultProc2UPP)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(Ptr)))
+};
-extern OSErr HInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2Ptr resultProc, char *userDataPtr);
+#if GENERATINGCFM
+#define CallOpenResolverProc(userRoutine, selector, filename) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppOpenResolverProcInfo, (selector), (filename))
+#define CallCloseResolverProc(userRoutine, selector) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppCloseResolverProcInfo, (selector))
+#define CallStrToAddrProc(userRoutine, selector, hostName, rtnStruct, resultproc, userDataPtr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppStrToAddrProcInfo, (selector), (hostName), (rtnStruct), (resultproc), (userDataPtr))
+#define CallAddrToStrProc(userRoutine, selector, addr, addrStr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppAddrToStrProcInfo, (selector), (addr), (addrStr))
+#define CallEnumCacheProc(userRoutine, selector, resultproc, userDataPtr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppEnumCacheProcInfo, (selector), (resultproc), (userDataPtr))
+#define CallAddrToNameProc(userRoutine, selector, addr, rtnStruct, resultproc, userDataPtr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppAddrToNameProcInfo, (selector), (addr), (rtnStruct), (resultproc), (userDataPtr))
+#define CallHInfoProc(userRoutine, selector, hostName, returnRecPtr, resultProc, userDataPtr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppHInfoProcInfo, (selector), (hostName), (returnRecPtr), (resultProc), (userDataPtr))
+#define CallMXInfoProc(userRoutine, selector, hostName, returnRecPtr, resultProc, userDataPtr) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppMXInfoProcInfo, (selector), (hostName), (returnRecPtr), (resultProc), (userDataPtr))
+#else
+#define CallOpenResolverProc(userRoutine, selector, filename) \
+ (*(userRoutine))((selector), (filename))
+#define CallCloseResolverProc(userRoutine, selector) \
+ (*(userRoutine))((selector))
+#define CallStrToAddrProc(userRoutine, selector, hostName, rtnStruct, resultproc, userDataPtr) \
+ (*(userRoutine))((selector), (hostName), (rtnStruct), (resultproc), (userDataPtr))
+#define CallAddrToStrProc(userRoutine, selector, addr, addrStr) \
+ (*(userRoutine))((selector), (addr), (addrStr))
+#define CallEnumCacheProc(userRoutine, selector, resultproc, userDataPtr) \
+ (*(userRoutine))((selector), (resultproc), (userDataPtr))
+#define CallAddrToNameProc(userRoutine, selector, addr, rtnStruct, resultproc, userDataPtr) \
+ (*(userRoutine))((selector), (addr), (rtnStruct), (resultproc), (userDataPtr))
+#define CallHInfoProc(userRoutine, selector, hostName, returnRecPtr, resultProc, userDataPtr) \
+ (*(userRoutine))((selector), (hostName), (returnRecPtr), (resultProc), (userDataPtr))
+#define CallMXInfoProc(userRoutine, selector, hostName, returnRecPtr, resultProc, userDataPtr) \
+ (*(userRoutine))((selector), (hostName), (returnRecPtr), (resultProc), (userDataPtr))
+#endif
-extern OSErr MXInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2Ptr resultProc, char *userDataPtr);
-extern OSErr CloseResolver(void);
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import off
+#endif
+
+#if STRUCTALIGNMENTSUPPORTED
+#pragma options align=reset
+#endif
#ifdef __cplusplus
}
+Thu Mar 28 17:57:04 1996 Theodore Y. Ts'o <tytso@dcl>
+
+ * AddressXlation.h: Updated to use latest versions from the Apple's
+ MacTCP Universal Interface. (For PowerPC port).
+
+ * MacTCP.h: New header file from Apple's Universal Interface
+
+ * GetMyIPAddr.h, MacTCPCommonTypes.h, TCPPB.h, UDPPB.h: Removed
+ old MacTCP header files.
+
Wed Mar 13 17:43:35 1996 Ken Raeburn <raeburn@cygnus.com>
* configure.in: Use AC_HEADER_STDARG.
+++ /dev/null
-/*
- GetMyIPAddr.h
- C definitions of parameter block entries needed for IP calls
-
- Copyright Apple Computer, Inc. 1989
- All rights reserved
-
-*/
-
-#ifndef __GETMYIPADDR__
-#define __GETMYIPADDR__
-
-#ifndef __MACTCPCOMMONTYPES__
-#include "MacTCPCommonTypes.h"
-#endif
-
-#define ipctlGetAddr 15 /* csCode to get our IP address */
-
-#define GetIPParamBlockHeader \
- struct QElem *qLink; \
- short qType; \
- short ioTrap; \
- Ptr ioCmdAddr; \
- ProcPtr ioCompletion; \
- OSErr ioResult; \
- StringPtr ioNamePtr; \
- short ioVRefNum; \
- short ioCRefNum; \
- short csCode
-
-struct GetAddrParamBlock {
- GetIPParamBlockHeader; /* standard I/O header */
- ip_addr ourAddress; /* our IP address */
- long ourNetMask; /* our IP net mask */
- };
-
-#endif
--- /dev/null
+/*
+ File: MacTCP.h
+
+ Contains: TCP Manager Interfaces.
+
+ Version: Technology: MacTCP 2.0.6
+ Package: Universal Interfaces 2.1§1 in ÒMPW PrereleaseÓ on ETO #17
+
+ Copyright: © 1984-1995 by Apple Computer, Inc.
+ All rights reserved.
+
+ Bugs?: If you find a problem with this file, use the Apple Bug Reporter
+ stack. Include the file and version information (from above)
+ in the problem description and send to:
+ Internet: apple.bugs@applelink.apple.com
+ AppleLink: APPLE.BUGS
+
+*/
+
+#ifndef __MACTCP__
+#define __MACTCP__
+
+
+#ifndef __TYPES__
+#include <Types.h>
+#endif
+/* #include <ConditionalMacros.h> */
+
+#ifndef __APPLETALK__
+#include <AppleTalk.h>
+#endif
+/* #include <OSUtils.h> */
+/* #include <MixedMode.h> */
+/* #include <Memory.h> */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=mac68k
+#endif
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+/*
+Developer Notes:
+ 0. This MacTCP header replaces what used to be defined in the following header files
+ MacTCPCommonTypes.h
+ GetMyIPAddr.h
+ MiscIPPB.h
+ TCPPB.h
+ UDPPB.h
+
+ When the various control calls are made to the ip driver, you must set up a
+ NewRoutineDescriptor for every non-nil completion routine and/or notifyProc parameter.
+ Otherwise, the 68K driver code, will not correctly call your routine.
+ 1. For ipctlGetAddr Control calls, use NewGetIPIOCompletionProc
+ to set up a GetIPIOCompletionUPP universal procptr to pass as
+ the ioCompletion parameter.
+ 2. For the ipctlEchoICMP and ipctlLAPStats Control calls, use
+ NewIPIOCompletion to set up a IPIOCompletionUPP universal procptr
+ to pass in the ioCompletion field of the parameter block.
+ 3. For TCPCreatePB Control calls, use NewTCPNotifyProc to set up a
+ TCPNotifyUPP universal procptr to pass in the notifyProc field
+ of the parameter block
+ 4. For all of the TCP Control calls using the TCPiopb parameter block,
+ use NewTCPIOCompletionProc to set up a TCPIOCompletionUPP
+ universal procptr to pass in the ioCompletion field of the paramter
+ block.
+ 5. For UDBCreatePB Control calls, use NewUDPNotifyProc to set up a
+ UDPNotifyUPP universal procptr to pass in the notifyProc field
+ of the parameter block
+ 6. For all of the UDP Control calls using the UDPiopb parameter block,
+ use NewUDPIOCompletionProc to set up a UDPIOCompletionUPP
+ universal procptr to pass in the ioCompletion field of the paramter
+ block.
+ 7. For all calls implementing a notifyProc or ioCompletion routine
+ which was set up using a NewTCPRoutineProc call, do not call
+ DisposeRoutineSDescriptor on the universal procptr until
+ after the completion or notify proc has completed.
+*/
+/* MacTCP return Codes in the range -23000 through -23049 */
+
+enum {
+ inProgress = 1, /* I/O in progress */
+ ipBadLapErr = -23000, /* bad network configuration */
+ ipBadCnfgErr = -23001, /* bad IP configuration error */
+ ipNoCnfgErr = -23002, /* missing IP or LAP configuration error */
+ ipLoadErr = -23003, /* error in MacTCP load */
+ ipBadAddr = -23004, /* error in getting address */
+ connectionClosing = -23005, /* connection is closing */
+ invalidLength = -23006,
+ connectionExists = -23007, /* request conflicts with existing connection */
+ connectionDoesntExist = -23008, /* connection does not exist */
+ insufficientResources = -23009, /* insufficient resources to perform request */
+ invalidStreamPtr = -23010,
+ streamAlreadyOpen = -23011,
+ connectionTerminated = -23012,
+ invalidBufPtr = -23013,
+ invalidRDS = -23014,
+ invalidWDS = -23014,
+ openFailed = -23015,
+ commandTimeout = -23016,
+ duplicateSocket = -23017
+};
+
+/* Error codes from internal IP functions */
+enum {
+ ipDontFragErr = -23032, /* Packet too large to send w/o fragmenting */
+ ipDestDeadErr = -23033, /* destination not responding */
+ icmpEchoTimeoutErr = -23035, /* ICMP echo timed-out */
+ ipNoFragMemErr = -23036, /* no memory to send fragmented pkt */
+ ipRouteErr = -23037, /* can't route packet off-net */
+ nameSyntaxErr = -23041,
+ cacheFault = -23042,
+ noResultProc = -23043,
+ noNameServer = -23044,
+ authNameErr = -23045,
+ noAnsErr = -23046,
+ dnrErr = -23047,
+ outOfMemory = -23048
+};
+
+enum {
+ BYTES_16WORD = 2, /* bytes per = 16, bit ip word */
+ BYTES_32WORD = 4, /* bytes per = 32, bit ip word */
+ BYTES_64WORD = 8 /* bytes per = 64, bit ip word */
+};
+
+/* 8-bit quantity */
+typedef UInt8 b_8;
+
+/* 16-bit quantity */
+typedef UInt16 b_16;
+
+/* 32-bit quantity */
+typedef UInt32 b_32;
+
+/* IP address is 32-bits */
+typedef b_32 ip_addr;
+
+struct ip_addrbytes {
+ union {
+ b_32 addr;
+ UInt8 byte[4];
+ } a;
+};
+typedef struct ip_addrbytes ip_addrbytes;
+
+struct wdsEntry {
+ unsigned short length; /* length of buffer */
+ Ptr ptr; /* pointer to buffer */
+};
+typedef struct wdsEntry wdsEntry;
+
+struct rdsEntry {
+ unsigned short length; /* length of buffer */
+ Ptr ptr; /* pointer to buffer */
+};
+typedef struct rdsEntry rdsEntry;
+
+typedef unsigned long BufferPtr;
+
+typedef unsigned long StreamPtr;
+
+
+enum {
+ netUnreach = 0,
+ hostUnreach = 1,
+ protocolUnreach = 2,
+ portUnreach = 3,
+ fragReqd = 4,
+ sourceRouteFailed = 5,
+ timeExceeded = 6,
+ parmProblem = 7,
+ missingOption = 8,
+ lastICMPMsgType = 32767
+};
+
+typedef unsigned short ICMPMsgType;
+
+typedef b_16 ip_port;
+
+struct ICMPReport {
+ StreamPtr streamPtr;
+ ip_addr localHost;
+ ip_port localPort;
+ ip_addr remoteHost;
+ ip_port remotePort;
+ short reportType;
+ unsigned short optionalAddlInfo;
+ unsigned long optionalAddlInfoPtr;
+};
+typedef struct ICMPReport ICMPReport;
+
+/* csCode to get our IP address */
+
+enum {
+ ipctlGetAddr = 15
+};
+
+typedef void (*GetIPIOCompletionProcPtr)(struct GetAddrParamBlock *iopb);
+
+#if GENERATINGCFM
+typedef UniversalProcPtr GetIPIOCompletionUPP;
+#else
+typedef GetIPIOCompletionProcPtr GetIPIOCompletionUPP;
+#endif
+
+#define GetIPParamBlockHeader \
+ struct QElem* qLink; \
+ short qType; \
+ short ioTrap; \
+ Ptr ioCmdAddr; \
+ GetIPIOCompletionUPP ioCompletion; \
+ OSErr ioResult; \
+ StringPtr ioNamePtr; \
+ short ioVRefNum; \
+ short ioCRefNum; \
+ short csCode
+struct GetAddrParamBlock {
+ struct QElem *qLink;
+ short qType;
+ short ioTrap;
+ Ptr ioCmdAddr;
+ GetIPIOCompletionUPP ioCompletion;
+ OSErr ioResult;
+ StringPtr ioNamePtr;
+ short ioVRefNum;
+ short ioCRefNum;
+ short csCode; /* standard I/O header */
+ ip_addr ourAddress; /* our IP address */
+ long ourNetMask; /* our IP net mask */
+};
+typedef struct GetAddrParamBlock GetAddrParamBlock;
+
+/* control codes */
+
+enum {
+ ipctlEchoICMP = 17, /* send icmp echo */
+ ipctlLAPStats = 19 /* get lap stats */
+};
+
+typedef void (*IPIOCompletionProcPtr)(struct ICMPParamBlock *iopb);
+
+#if GENERATINGCFM
+typedef UniversalProcPtr IPIOCompletionUPP;
+#else
+typedef IPIOCompletionProcPtr IPIOCompletionUPP;
+#endif
+
+#define IPParamBlockHeader \
+ struct QElem* qLink; \
+ short qType; \
+ short ioTrap; \
+ Ptr ioCmdAddr; \
+ IPIOCompletionUPP ioCompletion; \
+ OSErr ioResult; \
+ StringPtr ioNamePtr; \
+ short ioVRefNum; \
+ short ioCRefNum; \
+ short csCode
+struct ICMPParamBlock {
+ struct QElem *qLink;
+ short qType;
+ short ioTrap;
+ Ptr ioCmdAddr;
+ IPIOCompletionUPP ioCompletion;
+ OSErr ioResult;
+ StringPtr ioNamePtr;
+ short ioVRefNum;
+ short ioCRefNum;
+ short csCode; /* standard I/O header */
+ short params[11];
+ struct {
+ unsigned long echoRequestOut; /* time in ticks of when the echo request went out */
+ unsigned long echoReplyIn; /* time in ticks of when the reply was received */
+ struct rdsEntry echoedData; /* data received in responce */
+ Ptr options;
+ unsigned long userDataPtr;
+ } icmpEchoInfo;
+};
+typedef pascal void (*ICMPEchoNotifyProcPtr)(struct ICMPParamBlock *iopb);
+
+#if GENERATINGCFM
+typedef UniversalProcPtr ICMPEchoNotifyUPP;
+#else
+typedef ICMPEchoNotifyProcPtr ICMPEchoNotifyUPP;
+#endif
+
+struct IPParamBlock {
+ struct QElem *qLink;
+ short qType;
+ short ioTrap;
+ Ptr ioCmdAddr;
+ IPIOCompletionUPP ioCompletion;
+ OSErr ioResult;
+ StringPtr ioNamePtr;
+ short ioVRefNum;
+ short ioCRefNum;
+ short csCode; /* standard I/O header */
+ union {
+ struct {
+ ip_addr dest; /* echo to IP address */
+ wdsEntry data;
+ short timeout;
+ Ptr options;
+ unsigned short optLength;
+ ICMPEchoNotifyUPP icmpCompletion;
+ unsigned long userDataPtr;
+ } IPEchoPB;
+ struct {
+ struct LAPStats *lapStatsPtr;
+ } LAPStatsPB;
+ } csParam;
+};
+union LAPStatsAddrXlation {
+ struct arp_entry *arp_table;
+ struct nbp_entry *nbp_table;
+};
+struct LAPStats {
+ short ifType;
+ char *ifString;
+ short ifMaxMTU;
+ long ifSpeed;
+ short ifPhyAddrLength;
+ char *ifPhysicalAddress;
+ union LAPStatsAddrXlation AddrXlation;
+ short slotNumber;
+};
+typedef struct LAPStats LAPStats;
+
+struct nbp_entry {
+ ip_addr ip_address; /* IP address */
+ AddrBlock at_address; /* matching AppleTalk address */
+ Boolean gateway; /* TRUE if entry for a gateway */
+ Boolean valid; /* TRUE if LAP address is valid */
+ Boolean probing; /* TRUE if NBP lookup pending */
+ SInt8 afiller; /* Filler for proper byte alignment */
+ long age; /* ticks since cache entry verified */
+ long access; /* ticks since last access */
+ SInt8 filler[116]; /* for internal use only !!! */
+};
+struct Enet_addr {
+ b_16 en_hi;
+ b_32 en_lo;
+};
+typedef struct Enet_addr Enet_addr;
+
+struct arp_entry {
+ short age; /* cache aging field */
+ b_16 protocol; /* Protocol type */
+ ip_addr ip_address; /* IP address */
+ Enet_addr en_address; /* matching Ethernet address */
+};
+typedef struct arp_entry arp_entry;
+
+/* number of ARP table entries */
+
+enum {
+ ARP_TABLE_SIZE = 20
+};
+
+enum {
+ NBP_TABLE_SIZE = 20, /* number of NBP table entries */
+ NBP_MAX_NAME_SIZE = 16 + 10 + 2
+};
+
+/* Command codes */
+enum {
+ TCPCreate = 30,
+ TCPPassiveOpen = 31,
+ TCPActiveOpen = 32,
+ TCPSend = 34,
+ TCPNoCopyRcv = 35,
+ TCPRcvBfrReturn = 36,
+ TCPRcv = 37,
+ TCPClose = 38,
+ TCPAbort = 39,
+ TCPStatus = 40,
+ TCPExtendedStat = 41,
+ TCPRelease = 42,
+ TCPGlobalInfo = 43,
+ TCPCtlMax = 49
+};
+
+enum {
+ TCPClosing = 1,
+ TCPULPTimeout = 2,
+ TCPTerminate = 3,
+ TCPDataArrival = 4,
+ TCPUrgent = 5,
+ TCPICMPReceived = 6,
+ lastEvent = 32767
+};
+
+typedef unsigned short TCPEventCode;
+
+
+enum {
+ TCPRemoteAbort = 2,
+ TCPNetworkFailure = 3,
+ TCPSecPrecMismatch = 4,
+ TCPULPTimeoutTerminate = 5,
+ TCPULPAbort = 6,
+ TCPULPClose = 7,
+ TCPServiceError = 8,
+ lastReason = 32767
+};
+
+typedef unsigned short TCPTerminationReason;
+
+typedef pascal void (*TCPNotifyProcPtr)(StreamPtr tcpStream, unsigned short eventCode, Ptr userDataPtr, unsigned short terminReason, struct ICMPReport *icmpMsg);
+
+#if GENERATINGCFM
+typedef UniversalProcPtr TCPNotifyUPP;
+#else
+typedef TCPNotifyProcPtr TCPNotifyUPP;
+#endif
+
+typedef unsigned short tcp_port;
+
+/* ValidityFlags */
+
+enum {
+ timeoutValue = 0x80,
+ timeoutAction = 0x40,
+ typeOfService = 0x20,
+ precedence = 0x10
+};
+
+/* TOSFlags */
+enum {
+ lowDelay = 0x01,
+ throughPut = 0x02,
+ reliability = 0x04
+};
+
+struct TCPCreatePB {
+ Ptr rcvBuff;
+ unsigned long rcvBuffLen;
+ TCPNotifyUPP notifyProc;
+ Ptr userDataPtr;
+};
+typedef struct TCPCreatePB TCPCreatePB;
+
+struct TCPOpenPB {
+ SInt8 ulpTimeoutValue;
+ SInt8 ulpTimeoutAction;
+ SInt8 validityFlags;
+ SInt8 commandTimeoutValue;
+ ip_addr remoteHost;
+ tcp_port remotePort;
+ ip_addr localHost;
+ tcp_port localPort;
+ SInt8 tosFlags;
+ SInt8 precedence;
+ Boolean dontFrag;
+ SInt8 timeToLive;
+ SInt8 security;
+ SInt8 optionCnt;
+ SInt8 options[40];
+ Ptr userDataPtr;
+};
+typedef struct TCPOpenPB TCPOpenPB;
+
+struct TCPSendPB {
+ SInt8 ulpTimeoutValue;
+ SInt8 ulpTimeoutAction;
+ SInt8 validityFlags;
+ Boolean pushFlag;
+ Boolean urgentFlag;
+ SInt8 filler; /* Filler for proper byte alignment */
+ Ptr wdsPtr;
+ unsigned long sendFree;
+ unsigned short sendLength;
+ Ptr userDataPtr;
+};
+typedef struct TCPSendPB TCPSendPB;
+
+/* for receive and return rcv buff calls */
+/* Note: the filler in the following structure is in a different location than */
+/* that specified in the Programmer's Guide. */
+struct TCPReceivePB {
+ SInt8 commandTimeoutValue;
+ Boolean markFlag;
+ Boolean urgentFlag;
+ SInt8 filler; /* Filler for proper byte alignment */
+ Ptr rcvBuff;
+ unsigned short rcvBuffLen;
+ Ptr rdsPtr;
+ unsigned short rdsLength;
+ unsigned short secondTimeStamp;
+ Ptr userDataPtr;
+};
+typedef struct TCPReceivePB TCPReceivePB;
+
+struct TCPClosePB {
+ SInt8 ulpTimeoutValue;
+ SInt8 ulpTimeoutAction;
+ SInt8 validityFlags;
+ SInt8 filler; /* Filler for proper byte alignment */
+ Ptr userDataPtr;
+};
+typedef struct TCPClosePB TCPClosePB;
+
+struct HistoBucket {
+ unsigned short value;
+ unsigned long counter;
+};
+typedef struct HistoBucket HistoBucket;
+
+
+enum {
+ NumOfHistoBuckets = 7
+};
+
+struct TCPConnectionStats {
+ unsigned long dataPktsRcvd;
+ unsigned long dataPktsSent;
+ unsigned long dataPktsResent;
+ unsigned long bytesRcvd;
+ unsigned long bytesRcvdDup;
+ unsigned long bytesRcvdPastWindow;
+ unsigned long bytesSent;
+ unsigned long bytesResent;
+ unsigned short numHistoBuckets;
+ struct HistoBucket sentSizeHisto[NumOfHistoBuckets];
+ unsigned short lastRTT;
+ unsigned short tmrSRTT;
+ unsigned short rttVariance;
+ unsigned short tmrRTO;
+ SInt8 sendTries;
+ SInt8 sourchQuenchRcvd;
+};
+typedef struct TCPConnectionStats TCPConnectionStats;
+
+struct TCPStatusPB {
+ SInt8 ulpTimeoutValue;
+ SInt8 ulpTimeoutAction;
+ long unused;
+ ip_addr remoteHost;
+ tcp_port remotePort;
+ ip_addr localHost;
+ tcp_port localPort;
+ SInt8 tosFlags;
+ SInt8 precedence;
+ SInt8 connectionState;
+ SInt8 filler; /* Filler for proper byte alignment */
+ unsigned short sendWindow;
+ unsigned short rcvWindow;
+ unsigned short amtUnackedData;
+ unsigned short amtUnreadData;
+ Ptr securityLevelPtr;
+ unsigned long sendUnacked;
+ unsigned long sendNext;
+ unsigned long congestionWindow;
+ unsigned long rcvNext;
+ unsigned long srtt;
+ unsigned long lastRTT;
+ unsigned long sendMaxSegSize;
+ struct TCPConnectionStats *connStatPtr;
+ Ptr userDataPtr;
+};
+typedef struct TCPStatusPB TCPStatusPB;
+
+struct TCPAbortPB {
+ Ptr userDataPtr;
+};
+typedef struct TCPAbortPB TCPAbortPB;
+
+struct TCPParam {
+ unsigned long tcpRtoA;
+ unsigned long tcpRtoMin;
+ unsigned long tcpRtoMax;
+ unsigned long tcpMaxSegSize;
+ unsigned long tcpMaxConn;
+ unsigned long tcpMaxWindow;
+};
+typedef struct TCPParam TCPParam;
+
+struct TCPStats {
+ unsigned long tcpConnAttempts;
+ unsigned long tcpConnOpened;
+ unsigned long tcpConnAccepted;
+ unsigned long tcpConnClosed;
+ unsigned long tcpConnAborted;
+ unsigned long tcpOctetsIn;
+ unsigned long tcpOctetsOut;
+ unsigned long tcpOctetsInDup;
+ unsigned long tcpOctetsRetrans;
+ unsigned long tcpInputPkts;
+ unsigned long tcpOutputPkts;
+ unsigned long tcpDupPkts;
+ unsigned long tcpRetransPkts;
+};
+typedef struct TCPStats TCPStats;
+
+typedef StreamPtr *StreamPPtr;
+
+struct TCPGlobalInfoPB {
+ struct TCPParam *tcpParamPtr;
+ struct TCPStats *tcpStatsPtr;
+ StreamPPtr tcpCDBTable[1];
+ Ptr userDataPtr;
+ unsigned short maxTCPConnections;
+};
+typedef struct TCPGlobalInfoPB TCPGlobalInfoPB;
+
+typedef void (*TCPIOCompletionProcPtr)(struct TCPiopb *iopb);
+
+#if GENERATINGCFM
+typedef UniversalProcPtr TCPIOCompletionUPP;
+#else
+typedef TCPIOCompletionProcPtr TCPIOCompletionUPP;
+#endif
+
+struct TCPiopb {
+ SInt8 fill12[12];
+ TCPIOCompletionUPP ioCompletion;
+ short ioResult;
+ Ptr ioNamePtr;
+ short ioVRefNum;
+ short ioCRefNum;
+ short csCode;
+ StreamPtr tcpStream;
+ union {
+ struct TCPCreatePB create;
+ struct TCPOpenPB open;
+ struct TCPSendPB send;
+ struct TCPReceivePB receive;
+ struct TCPClosePB close;
+ struct TCPAbortPB abort;
+ struct TCPStatusPB status;
+ struct TCPGlobalInfoPB globalInfo;
+ } csParam;
+};
+typedef struct TCPiopb TCPiopb;
+
+
+enum {
+ UDPCreate = 20,
+ UDPRead = 21,
+ UDPBfrReturn = 22,
+ UDPWrite = 23,
+ UDPRelease = 24,
+ UDPMaxMTUSize = 25,
+ UDPStatus = 26,
+ UDPMultiCreate = 27,
+ UDPMultiSend = 28,
+ UDPMultiRead = 29,
+ UDPCtlMax = 29
+};
+
+enum {
+ UDPDataArrival = 1,
+ UDPICMPReceived = 2,
+ lastUDPEvent = 32767
+};
+
+typedef unsigned short UDPEventCode;
+
+typedef pascal void (*UDPNotifyProcPtr)(StreamPtr udpStream, unsigned short eventCode, Ptr userDataPtr, struct ICMPReport *icmpMsg);
+
+#if GENERATINGCFM
+typedef UniversalProcPtr UDPNotifyUPP;
+#else
+typedef UDPNotifyProcPtr UDPNotifyUPP;
+#endif
+
+typedef unsigned short udp_port;
+
+/* for create and release calls */
+struct UDPCreatePB {
+ Ptr rcvBuff;
+ unsigned long rcvBuffLen;
+ UDPNotifyUPP notifyProc;
+ unsigned short localPort;
+ Ptr userDataPtr;
+ udp_port endingPort;
+};
+typedef struct UDPCreatePB UDPCreatePB;
+
+struct UDPSendPB {
+ unsigned short reserved;
+ ip_addr remoteHost;
+ udp_port remotePort;
+ Ptr wdsPtr;
+ Boolean checkSum;
+ SInt8 filler; /* Filler for proper byte alignment */
+ unsigned short sendLength;
+ Ptr userDataPtr;
+ udp_port localPort;
+};
+typedef struct UDPSendPB UDPSendPB;
+
+/* for receive and buffer return calls */
+struct UDPReceivePB {
+ unsigned short timeOut;
+ ip_addr remoteHost;
+ udp_port remotePort;
+ Ptr rcvBuff;
+ unsigned short rcvBuffLen;
+ unsigned short secondTimeStamp;
+ Ptr userDataPtr;
+ ip_addr destHost; /* only for use with multi rcv */
+ udp_port destPort; /* only for use with multi rcv */
+};
+typedef struct UDPReceivePB UDPReceivePB;
+
+struct UDPMTUPB {
+ unsigned short mtuSize;
+ ip_addr remoteHost;
+ Ptr userDataPtr;
+};
+typedef struct UDPMTUPB UDPMTUPB;
+
+typedef void (*UDPIOCompletionProcPtr)(struct UDPiopb *iopb);
+
+#if GENERATINGCFM
+typedef UniversalProcPtr UDPIOCompletionUPP;
+#else
+typedef UDPIOCompletionProcPtr UDPIOCompletionUPP;
+#endif
+
+struct UDPiopb {
+ SInt8 fill12[12];
+ UDPIOCompletionUPP ioCompletion;
+ short ioResult;
+ Ptr ioNamePtr;
+ short ioVRefNum;
+ short ioCRefNum;
+ short csCode;
+ StreamPtr udpStream;
+ union {
+ struct UDPCreatePB create;
+ struct UDPSendPB send;
+ struct UDPReceivePB receive;
+ struct UDPMTUPB mtu;
+ } csParam;
+};
+typedef struct UDPiopb UDPiopb;
+
+
+#if GENERATINGCFM
+#else
+#endif
+
+enum {
+ uppGetIPIOCompletionProcInfo = kCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct GetAddrParamBlock*))),
+ uppIPIOCompletionProcInfo = kCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct ICMPParamBlock*))),
+ uppICMPEchoNotifyProcInfo = kPascalStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct ICMPParamBlock*))),
+ uppTCPNotifyProcInfo = kPascalStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(StreamPtr)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(unsigned short)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(unsigned short)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(struct ICMPReport*))),
+ uppTCPIOCompletionProcInfo = kCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct TCPiopb*))),
+ uppUDPNotifyProcInfo = kPascalStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(StreamPtr)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(unsigned short)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(struct ICMPReport*))),
+ uppUDPIOCompletionProcInfo = kCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct UDPiopb*)))
+};
+
+#if GENERATINGCFM
+#define NewGetIPIOCompletionProc(userRoutine) \
+ (GetIPIOCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppGetIPIOCompletionProcInfo, GetCurrentArchitecture())
+#define NewIPIOCompletionProc(userRoutine) \
+ (IPIOCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppIPIOCompletionProcInfo, GetCurrentArchitecture())
+#define NewICMPEchoNotifyProc(userRoutine) \
+ (ICMPEchoNotifyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppICMPEchoNotifyProcInfo, GetCurrentArchitecture())
+#define NewTCPNotifyProc(userRoutine) \
+ (TCPNotifyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTCPNotifyProcInfo, GetCurrentArchitecture())
+#define NewTCPIOCompletionProc(userRoutine) \
+ (TCPIOCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTCPIOCompletionProcInfo, GetCurrentArchitecture())
+#define NewUDPNotifyProc(userRoutine) \
+ (UDPNotifyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppUDPNotifyProcInfo, GetCurrentArchitecture())
+#define NewUDPIOCompletionProc(userRoutine) \
+ (UDPIOCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppUDPIOCompletionProcInfo, GetCurrentArchitecture())
+#else
+#define NewGetIPIOCompletionProc(userRoutine) \
+ ((GetIPIOCompletionUPP) (userRoutine))
+#define NewIPIOCompletionProc(userRoutine) \
+ ((IPIOCompletionUPP) (userRoutine))
+#define NewICMPEchoNotifyProc(userRoutine) \
+ ((ICMPEchoNotifyUPP) (userRoutine))
+#define NewTCPNotifyProc(userRoutine) \
+ ((TCPNotifyUPP) (userRoutine))
+#define NewTCPIOCompletionProc(userRoutine) \
+ ((TCPIOCompletionUPP) (userRoutine))
+#define NewUDPNotifyProc(userRoutine) \
+ ((UDPNotifyUPP) (userRoutine))
+#define NewUDPIOCompletionProc(userRoutine) \
+ ((UDPIOCompletionUPP) (userRoutine))
+#endif
+
+#if GENERATINGCFM
+#define CallGetIPIOCompletionProc(userRoutine, iopb) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppGetIPIOCompletionProcInfo, (iopb))
+#define CallIPIOCompletionProc(userRoutine, iopb) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppIPIOCompletionProcInfo, (iopb))
+#define CallICMPEchoNotifyProc(userRoutine, iopb) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppICMPEchoNotifyProcInfo, (iopb))
+#define CallTCPNotifyProc(userRoutine, tcpStream, eventCode, userDataPtr, terminReason, icmpMsg) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppTCPNotifyProcInfo, (tcpStream), (eventCode), (userDataPtr), (terminReason), (icmpMsg))
+#define CallTCPIOCompletionProc(userRoutine, iopb) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppTCPIOCompletionProcInfo, (iopb))
+#define CallUDPNotifyProc(userRoutine, udpStream, eventCode, userDataPtr, icmpMsg) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppUDPNotifyProcInfo, (udpStream), (eventCode), (userDataPtr), (icmpMsg))
+#define CallUDPIOCompletionProc(userRoutine, iopb) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppUDPIOCompletionProcInfo, (iopb))
+#else
+#define CallGetIPIOCompletionProc(userRoutine, iopb) \
+ (*(userRoutine))((iopb))
+#define CallIPIOCompletionProc(userRoutine, iopb) \
+ (*(userRoutine))((iopb))
+#define CallICMPEchoNotifyProc(userRoutine, iopb) \
+ (*(userRoutine))((iopb))
+#define CallTCPNotifyProc(userRoutine, tcpStream, eventCode, userDataPtr, terminReason, icmpMsg) \
+ (*(userRoutine))((tcpStream), (eventCode), (userDataPtr), (terminReason), (icmpMsg))
+#define CallTCPIOCompletionProc(userRoutine, iopb) \
+ (*(userRoutine))((iopb))
+#define CallUDPNotifyProc(userRoutine, udpStream, eventCode, userDataPtr, icmpMsg) \
+ (*(userRoutine))((udpStream), (eventCode), (userDataPtr), (icmpMsg))
+#define CallUDPIOCompletionProc(userRoutine, iopb) \
+ (*(userRoutine))((iopb))
+#endif
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import off
+#endif
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=reset
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MACTCP__ */
+++ /dev/null
-/*
- MacTCPCommonTypes.h
- C type definitions used throughout MacTCP.
-
- Copyright Apple Computer, Inc. 1988-91
- All rights reserved
-
-*/
-
-#ifndef __MACTCPCOMMONTYPES__
-#define __MACTCPCOMMONTYPES__
-
-#ifndef __TYPES__
-#include <Types.h>
-#endif /* __TYPES__ */
-
-/* MacTCP return Codes in the range -23000 through -23049 */
-#define inProgress 1 /* I/O in progress */
-
-#define ipBadLapErr -23000 /* bad network configuration */
-#define ipBadCnfgErr -23001 /* bad IP configuration error */
-#define ipNoCnfgErr -23002 /* missing IP or LAP configuration error */
-#define ipLoadErr -23003 /* error in MacTCP load */
-#define ipBadAddr -23004 /* error in getting address */
-#define connectionClosing -23005 /* connection is closing */
-#define invalidLength -23006
-#define connectionExists -23007 /* request conflicts with existing connection */
-#define connectionDoesntExist -23008 /* connection does not exist */
-#define insufficientResources -23009 /* insufficient resources to perform request */
-#define invalidStreamPtr -23010
-#define streamAlreadyOpen -23011
-#define connectionTerminated -23012
-#define invalidBufPtr -23013
-#define invalidRDS -23014
-#define invalidWDS -23014
-#define openFailed -23015
-#define commandTimeout -23016
-#define duplicateSocket -23017
-
-/* Error codes from internal IP functions */
-#define ipDontFragErr -23032 /* Packet too large to send w/o fragmenting */
-#define ipDestDeadErr -23033 /* destination not responding */
-#define icmpEchoTimeoutErr -23035 /* ICMP echo timed-out */
-#define ipNoFragMemErr -23036 /* no memory to send fragmented pkt */
-#define ipRouteErr -23037 /* can't route packet off-net */
-
-#define nameSyntaxErr -23041
-#define cacheFault -23042
-#define noResultProc -23043
-#define noNameServer -23044
-#define authNameErr -23045
-#define noAnsErr -23046
-#define dnrErr -23047
-#define outOfMemory -23048
-
-#define BYTES_16WORD 2 /* bytes per 16 bit ip word */
-#define BYTES_32WORD 4 /* bytes per 32 bit ip word */
-#define BYTES_64WORD 8 /* bytes per 64 bit ip word */
-
-typedef unsigned char b_8; /* 8-bit quantity */
-typedef unsigned short b_16; /* 16-bit quantity */
-typedef unsigned long b_32; /* 32-bit quantity */
-
-typedef b_32 ip_addr; /* IP address is 32-bits */
-
-typedef struct ip_addrbytes {
- union {
- b_32 addr;
- char byte[4];
- } a;
- } ip_addrbytes;
-
-typedef struct wdsEntry {
- unsigned short length; /* length of buffer */
- char * ptr; /* pointer to buffer */
- } wdsEntry;
-
-typedef struct rdsEntry {
- unsigned short length; /* length of buffer */
- char * ptr; /* pointer to buffer */
- } rdsEntry;
-
-typedef unsigned long BufferPtr;
-
-typedef unsigned long StreamPtr;
-
-typedef enum ICMPMsgType {
- netUnreach, hostUnreach, protocolUnreach, portUnreach, fragReqd,
- sourceRouteFailed, timeExceeded, parmProblem, missingOption,
- lastICMPMsgType = 32767
- } ICMPMsgType;
-
-typedef b_16 ip_port;
-
-typedef struct ICMPReport {
- StreamPtr streamPtr;
- ip_addr localHost;
- ip_port localPort;
- ip_addr remoteHost;
- ip_port remotePort;
- short reportType;
- unsigned short optionalAddlInfo;
- unsigned long optionalAddlInfoPtr;
- } ICMPReport;
-
-
-typedef OSErr (*OSErrProcPtr)();
-typedef Ptr (*PtrProcPtr)();
-typedef Boolean (*BooleanProcPtr)();
-typedef void (*voidProcPtr)();
-
-#endif /* __MACTCPCOMMONTYPES__ */
+++ /dev/null
-/*
- TCPPB.h
- C definitions of parameter block entries needed for TCP calls
-
- Copyright Apple Computer, Inc. 1988-91
- All rights reserved
-
-*/
-
-
-/* Command codes */
-
-#define TCPCreate 30
-#define TCPPassiveOpen 31
-#define TCPActiveOpen 32
-#define TCPSend 34
-#define TCPNoCopyRcv 35
-#define TCPRcvBfrReturn 36
-#define TCPRcv 37
-#define TCPClose 38
-#define TCPAbort 39
-#define TCPStatus 40
-#define TCPExtendedStat 41
-#define TCPRelease 42
-#define TCPGlobalInfo 43
-#define TCPCtlMax 49
-
-typedef enum TCPEventCode {
- TCPClosing = 1,
- TCPULPTimeout,
- TCPTerminate,
- TCPDataArrival,
- TCPUrgent,
- TCPICMPReceived,
- lastEvent = 32767
-} TCPEventCode;
-
-typedef enum TCPTerminationReason {
- TCPRemoteAbort = 2,
- TCPNetworkFailure,
- TCPSecPrecMismatch,
- TCPULPTimeoutTerminate,
- TCPULPAbort,
- TCPULPClose,
- TCPServiceError,
- lastReason = 32767
-} TCPTerminationReason;
-
-#ifdef THINK_C
-typedef ProcPtr TCPNotifyProc;
-#else
-typedef pascal void (*TCPNotifyProc) (
- StreamPtr tcpStream,
- unsigned short eventCode,
- Ptr userDataPtr,
- unsigned short terminReason,
- struct ICMPReport *icmpMsg);
-#endif
-
-typedef void (*TCPIOCompletionProc) (struct TCPiopb *iopb);
-
-typedef unsigned short tcp_port;
-
-typedef unsigned char byte;
-
-enum { /* ValidityFlags */
- timeoutValue = 0x80,
- timeoutAction = 0x40,
- typeOfService = 0x20,
- precedence = 0x10
-};
-
-enum { /* TOSFlags */
- lowDelay = 0x01,
- throughPut = 0x02,
- reliability = 0x04
-};
-
-typedef struct TCPCreatePB {
- Ptr rcvBuff;
- unsigned long rcvBuffLen;
- TCPNotifyProc notifyProc;
- Ptr userDataPtr;
-}TCPCreatePB;
-
-typedef struct TCPOpenPB {
- byte ulpTimeoutValue;
- byte ulpTimeoutAction;
- byte validityFlags;
- byte commandTimeoutValue;
- ip_addr remoteHost;
- tcp_port remotePort;
- ip_addr localHost;
- tcp_port localPort;
- byte tosFlags;
- byte precedence;
- Boolean dontFrag;
- byte timeToLive;
- byte security;
- byte optionCnt;
- byte options[40];
- Ptr userDataPtr;
-}TCPOpenPB;
-
-typedef struct TCPSendPB {
- byte ulpTimeoutValue;
- byte ulpTimeoutAction;
- byte validityFlags;
- Boolean pushFlag;
- Boolean urgentFlag;
- Ptr wdsPtr;
- unsigned long sendFree;
- unsigned short sendLength;
- Ptr userDataPtr;
-}TCPSendPB;
-
-
-typedef struct TCPReceivePB { /* for receive and return rcv buff calls */
- byte commandTimeoutValue;
- byte filler;
- Boolean markFlag;
- Boolean urgentFlag;
- Ptr rcvBuff;
- unsigned short rcvBuffLen;
- Ptr rdsPtr;
- unsigned short rdsLength;
- unsigned short secondTimeStamp;
- Ptr userDataPtr;
-}TCPReceivePB;
-
-typedef struct TCPClosePB {
- byte ulpTimeoutValue;
- byte ulpTimeoutAction;
- byte validityFlags;
- Ptr userDataPtr;
-}TCPClosePB;
-
-typedef struct HistoBucket {
- unsigned short value;
- unsigned long counter;
-};
-
-#define NumOfHistoBuckets 7
-
-typedef struct TCPConnectionStats {
- unsigned long dataPktsRcvd;
- unsigned long dataPktsSent;
- unsigned long dataPktsResent;
- unsigned long bytesRcvd;
- unsigned long bytesRcvdDup;
- unsigned long bytesRcvdPastWindow;
- unsigned long bytesSent;
- unsigned long bytesResent;
- unsigned short numHistoBuckets;
- struct HistoBucket sentSizeHisto[NumOfHistoBuckets];
- unsigned short lastRTT;
- unsigned short tmrSRTT;
- unsigned short rttVariance;
- unsigned short tmrRTO;
- byte sendTries;
- byte sourchQuenchRcvd;
-}TCPConnectionStats;
-
-typedef struct TCPStatusPB {
- byte ulpTimeoutValue;
- byte ulpTimeoutAction;
- long unused;
- ip_addr remoteHost;
- tcp_port remotePort;
- ip_addr localHost;
- tcp_port localPort;
- byte tosFlags;
- byte precedence;
- byte connectionState;
- unsigned short sendWindow;
- unsigned short rcvWindow;
- unsigned short amtUnackedData;
- unsigned short amtUnreadData;
- Ptr securityLevelPtr;
- unsigned long sendUnacked;
- unsigned long sendNext;
- unsigned long congestionWindow;
- unsigned long rcvNext;
- unsigned long srtt;
- unsigned long lastRTT;
- unsigned long sendMaxSegSize;
- struct TCPConnectionStats *connStatPtr;
- Ptr userDataPtr;
-}TCPStatusPB;
-
-typedef struct TCPAbortPB {
- Ptr userDataPtr;
-}TCPAbortPB;
-
-typedef struct TCPParam {
- unsigned long tcpRtoA;
- unsigned long tcpRtoMin;
- unsigned long tcpRtoMax;
- unsigned long tcpMaxSegSize;
- unsigned long tcpMaxConn;
- unsigned long tcpMaxWindow;
-}TCPParam;
-
-typedef struct TCPStats {
- unsigned long tcpConnAttempts;
- unsigned long tcpConnOpened;
- unsigned long tcpConnAccepted;
- unsigned long tcpConnClosed;
- unsigned long tcpConnAborted;
- unsigned long tcpOctetsIn;
- unsigned long tcpOctetsOut;
- unsigned long tcpOctetsInDup;
- unsigned long tcpOctetsRetrans;
- unsigned long tcpInputPkts;
- unsigned long tcpOutputPkts;
- unsigned long tcpDupPkts;
- unsigned long tcpRetransPkts;
-}TCPStats;
-
-typedef struct TCPGlobalInfoPB {
- struct TCPParam *tcpParamPtr;
- struct TCPStats *tcpStatsPtr;
- StreamPtr *tcpCDBTable;
- Ptr userDataPtr;
- unsigned short maxTCPConnections;
-}TCPGlobalInfoPB;
-
-typedef struct TCPiopb {
- char fill12[12];
- TCPIOCompletionProc ioCompletion;
- short ioResult;
- char *ioNamePtr;
- short ioVRefNum;
- short ioCRefNum;
- short csCode;
- StreamPtr tcpStream;
- union {
- struct TCPCreatePB create;
- struct TCPOpenPB open;
- struct TCPSendPB send;
- struct TCPReceivePB receive;
- struct TCPClosePB close;
- struct TCPAbortPB abort;
- struct TCPStatusPB status;
- struct TCPGlobalInfoPB globalInfo;
- } csParam;
-}TCPiopb;
-
+++ /dev/null
-/*
- UDPPB.h
- C definitions of parameter block entries needed for UDP calls
-
- Copyright Apple Computer, Inc. 1988-89
- All rights reserved
-
-*/
-
-#define UDPCreate 20
-#define UDPRead 21
-#define UDPBfrReturn 22
-#define UDPWrite 23
-#define UDPRelease 24
-#define UDPMaxMTUSize 25
-#define UDPCtlMax 29
-
-typedef enum UDPEventCode {
- UDPDataArrival = 1,
- UDPICMPReceived,
- lastUDPEvent = 65535
- };
-
-typedef pascal void (*UDPNotifyProc) (
- StreamPtr udpStream,
- unsigned short eventCode,
- Ptr userDataPtr,
- struct ICMPReport *icmpMsg);
-
-typedef void (*UDPIOCompletionProc) (struct UDPiopb *iopb);
-
-typedef unsigned short udp_port;
-
-typedef struct UDPCreatePB { /* for create and release calls */
- Ptr rcvBuff;
- unsigned long rcvBuffLen;
- UDPNotifyProc notifyProc;
- unsigned short localPort;
- Ptr userDataPtr;
-} UDPCreatePB;
-
-typedef struct UDPSendPB {
- unsigned short reserved;
- ip_addr remoteHost;
- udp_port remotePort;
- Ptr wdsPtr;
- Boolean checkSum;
- unsigned short sendLength;
- Ptr userDataPtr;
-} UDPSendPB;
-
-typedef struct UDPReceivePB { /* for receive and buffer return calls */
- unsigned short timeOut;
- ip_addr remoteHost;
- udp_port remotePort;
- Ptr rcvBuff;
- unsigned short rcvBuffLen;
- unsigned short secondTimeStamp;
- Ptr userDataPtr;
-} UDPReceivePB;
-
-typedef struct UDPMTUPB {
- unsigned short mtuSize;
- ip_addr remoteHost;
- Ptr userDataPtr;
-} UDPMTUPB;
-
-typedef struct UDPiopb {
- char fill12[12];
- UDPIOCompletionProc ioCompletion;
- short ioResult;
- char *ioNamePtr;
- short ioVRefNum;
- short ioCRefNum;
- short csCode;
- StreamPtr udpStream;
- union {
- struct UDPCreatePB create;
- struct UDPSendPB send;
- struct UDPReceivePB receive;
- struct UDPMTUPB mtu;
- } csParam;
-} UDPiopb;
-