home *** CD-ROM | disk | FTP | other *** search
- /*
-
- myTCPIncludes.h
-
- Header file for MacTCP Library
-
- 11/28/94 mc - Created.
- */
-
- #pragma once
-
- #ifndef __MACTCP_LIB_H
- #define __MACTCP_LIB_H
-
- #include <MacTCP.h>
- #include <MacTCPExtras.h>
- #include <AddressXlation.h>
-
- // Library error codes
- enum {
-
- tcpBaseErr=23100, // the base for the TCP portion of the library
- tcpNilPB, // the TCPiopb pointer was nil.
- tcpNilStream, // the ioCRefNum field of the TCPiopb was nil.
- tcpNilRefNum, // the ioRefNum field of the TCPiopb was nil.
-
- udpBaseErr=23150, // the base error for the UDP portion of the library
- udpNilPB, // the UDPiopb pointer was nil.
- udpNilRefNum, // the ioCRefNum field of the UDPiopb was nil
- udpNilStream, // the udpStream field of the UDPiopb was nil
- udpPortNil, // the starting port for UDPMultiCreate was 0 (not allowed).
-
- ipBaseErr=23250, // base error value for the IP portion of the library
- ipNilRefNum, // the IPiopb ioCRefNum was nil.
-
- getipBaseErr=23300, // the base address for the GetIP portion of the library
- getipNilPB, // the GetIPParmBlkPtr was nil
- getipNilRefNum, // the ioCRefNum was nil
-
- dnrBaseErr=23050, // base error number for the resolver portion of the library
- dnrNoResolver // The resolver is not open.
- };
-
- typedef pascal void (*ExitToShellProcPtr)(void);
-
- enum {
- uppExitToShellProcInfo=kPascalStackBased
- };
-
- #if USESROUTINEDESCRIPTORS
- typedef UniversalProcPtr ExitToShellUPP;
-
- #define CallExitToShellProc(routine)\
- CallUniversalProc((UniversalProcPtr)routine,uppExitToShellProcInfo)
- #define NewExitToShellProc(routine)\
- (ExitToShellUPP)NewRoutineDescriptor((ProcPtr)(routine),uppExitToShellProcInfo,GetCurrentISA())
- #else
- typedef ExitToShellProcPtr ExitToShellUPP;
-
- #define CallExitToShellProc(routine) \
- (*routine)()
- #define NewExitToShellProc(routine) \
- (ExitToShellUPP)(routine)
- #endif
-
- #define DisposeExitToShellProc(routine) \
- DisposeRoutineDescriptor(routine)
-
- #ifndef NewHostInfoProc
-
- // these defines are missing from AddressXlation.h Apple supplies
- #if GENERATINGCFM
-
- #define NewHostInfoProc(userRoutine) \
- (HInfoUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppHInfoProcInfo, GetCurrentArchitecture())
-
- #else
-
- #define NewHostInfoProc(userRoutine) ((HInfoUPP)userRoutine)
-
- #endif
-
- #define DisposeHostInfoProc(routine)\
- DisposeRoutineDescriptor((UniversalProcPtr)routine)
- // -------------------------
-
- #endif /* NewHostInfoProc */
-
- #ifndef NEWBLOCK
- #define NEWBLOCK
-
- #define NEWPTR(a,b) ((a)NewPtr(b))
- #define DISPOSEPTR(a) (DisposePtr((Ptr)a))
-
- #define NEWHDL(a,b) ((a)NewHandle(b))
- #define DISPOSEHDL(a) (DisposeHandle((Handle)a))
- #endif /* NEWBLOCK */
-
- // ••• Pointer Allocation Definitions
-
- #define NewGetIPParmBlkPtr() NEWPTR(GetAddrParamBlock*,sizeof(GetAddrParamBlock))
- #define DisposeGetIPParmBlkPtr(a) DISPOSEPTR(a)
-
- #define Newnbp_entryPtr() NEWPTR(nbp_entryPtr,sizeof(nbp_entry))
- #define Disposenbp_entryPtr(a) DISPOSEPTR(a)
-
- #define NewEnet_addrPtr() NEWPTR(Enet_addrPtr,sizeof(Enet_addr))
- #define DisposeEnet_addrPtr(a) DISPOSEPTR(a)
-
- #define Newarp_entryPtr() NEWPTR(arp_entryPtr,sizeof(arp_entry))
- #define Disposearp_entryPtr(a) DISPOSEPTR(a)
-
- #define NewLAPStatsPtr() NEWPTR(LAPStatsPtr,sizeof(LAPStats))
- #define DisposeLAPStatsPtr(a) DISPOSEPTR(a)
-
- #define NewIPEchoPtr() NEWPTR(IPEchoPBPtr,sizeof(IPEchoPB))
- #define DisposeIPEchoPtr(a) DISPOSEPTR(a)
-
- #define NewLAPStatsPBPtr() NEWPTR(LAPStatsPBPtr,sizeof(LAPStatsPB))
- #define DisposeLAPStatsPBPtr(a) DISPOSEPTR(a)
-
- #define NewIPParmBlkPtr() NEWPTR(IPParmBlkPtr,sizeof(IPParamBlock))
- #define DisposeIPParmBlkPtr(a) DISPOSEPTR(a)
-
- #define NewICMPEchoInfoPtr() NEWPTR(ICMPEchoInfoPtr,sizeof(ICMPEchoInfo))
- #define DisposeICMPEchoInfoPtr(a) DISPOSEPTR(a)
-
- #define NewICMPParmBlkPtr() NEWPTR(ICMPParmBlkPtr,sizeof(ICMPParmBlk))
- #define DisposeICMPParmBlkPtr(a) DISPOSEPTR(a)
-
- #define NewTCPCreatePtr() NEWPTR(TCPCreatePBPtr,sizeof(TCPCreatePB))
- #define DisposeTCPCreatePtr(a) DISPOSEPTR(a)
-
- #define NewTCPOpenPtr() NEWPTR(TCPOpenPBPtr,sizeof(TCPOpenPB))
- #define DisposeTCPOpenPtr(a) DISPOSEPTR(a)
-
- #define NewTCPSendPtr() NEWPTR(TCPSendPBPtr,sizeof(TCPSendPB))
- #define DisposeTCPSendPtr(a) DISPOSEPTR(a)
-
- #define NewTCPReceivePtr() NEWPTR(TCPReceivePBPtr,sizeof(TCPReceivePB))
- #define DisposeTCPReceivePtr(a) DISPOSEPTR(a)
-
- #define NewTCPClosePtr() NEWPTR(TCPClosePBPtr,sizeof(TCPClosePB))
- #define DisposeTCPClosePtr(a) DISPOSEPTR(a)
-
- #define NewHistoBucketPtr() NEWPTR(HistoBucketPtr,sizeof(HistoBucket))
- #define DisposeHistoBucketPtr(a) DISPOSEPTR(a)
-
- #define NewTCPConnectionStatsPtr() NEWPTR(TCPConnectionStatsPBPtr,sizeof(TCPConnectionStatsPB))
- #define DisposeTCPConnectionStatsPtr(a) DISPOSEPTR(a)
-
- #define NewTCPStatusPtr() NEWPTR(TCPStatusPBPtr,sizeof(TCPStatusPB))
- #define DisposeTCPStatusPtr(a) DISPOSEPTR(a)
-
- #define NewTCPAbortPtr() NEWPTR(TCPAbortPBPtr,sizeof(TCPAbortPB))
- #define DisposeTCPAbortPtr(a) DISPOSEPTR(a)
-
- #define NewTCPParamPtr() NEWPTR(TCPParamPBPtr,sizeof(TCPParamPB))
- #define DisposeTCPParamPtr(a) DISPOSEPTR(a)
-
- #define NewTCPStatsPtr() NEWPTR(TCPStatsPBPtr,sizeof(TCPStatsPB))
- #define DisposeTCPStatsPtr(a) DISPOSEPTR(a)
-
- #define NewTCPGlobalInfoPtr() NEWPTR(TCPGlobalInfoPBPtr,sizeof(TCPGlobalInfoPB))
- #define DisposeTCPGlobalInfoPtr(a) DISPOSEPTR(a)
-
- #define NewTCPiopbPtr() NEWPTR(TCPiopb *,sizeof(TCPiopb))
- #define DisposeTCPiopbPtr(a) DISPOSEPTR(a);
-
- #define NewUDPCreatePtr() NEWPTR(UDPCreatePBPtr,sizeof(UDPCreatePB))
- #define DisposeUDPCreatePtr(a) DISPOSEPTR(a)
-
- #define NewUDPSendPtr() NEWPTR(UDPSendPBPtr,sizeof(UDPSendPB))
- #define DisposeUDPSendPtr(a) DISPOSEPTR(a)
-
- #define NewUDPReceivePtr() NEWPTR(UDPReceivePBPtr,sizeof(UDPReceivePB))
- #define DisposeUDPReceivePtr(a) DISPOSEPTR(a)
-
- #define NewUDPMTUPtr() NEWPTR(UDPMTUPBPtr,sizeof(UDPMTUPB))
- #define DisposeUDPMTUPtr(a) DISPOSEPTR(a)
-
- #define NewUDPiopbPtr() NEWPTR(UDPiopb *,sizeof(UDPiopb))
- #define DisposeUDPiopbPtr(a) DISPOSEPTR(a);
-
-
- /*
- Library Function Prototypes
- */
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- // MacTCP.c
- OSErr OpenMacTCP(short*,Boolean patchExitToShell);
- OSErr KillMacTCP(void);
-
- // GetMyIPAddr.c
- OSErr GetMyIPAddr(GetAddrParamBlock* pb,Boolean async);
-
- // IP.c
- OSErr IP_EchoICMP(struct ICMPParamBlock * pb,Boolean async);
- OSErr IP_LAPStats(struct ICMPParamBlock * pb,Boolean async);
-
- // TCP.c
- OSErr TCP_Create(TCPiopb * pb,Boolean async);
- OSErr TCP_PassiveOpen(TCPiopb * pb,Boolean async);
- OSErr TCP_ActiveOpen(TCPiopb * pb,Boolean async);
- OSErr TCP_Send(TCPiopb * pb,Boolean async);
- OSErr TCP_NoCopyRcv(TCPiopb * pb,Boolean async);
- OSErr TCP_RcvBfrReturn(TCPiopb * pb,Boolean async);
- OSErr TCP_Rcv(TCPiopb * pb,Boolean async);
- OSErr TCP_Close(TCPiopb * pb,Boolean async);
- OSErr TCP_Abort(TCPiopb * pb,Boolean async);
- OSErr TCP_Status(TCPiopb * pb,Boolean async);
- OSErr TCP_ExtendedStat(TCPiopb * pb,Boolean async);
- OSErr TCP_Release(TCPiopb * pb,Boolean async);
- OSErr TCP_GlobalInfo(TCPiopb * pb,Boolean async);
-
- // UDP.c
- OSErr UDP_Create(UDPiopb * pb,Boolean async);
- OSErr UDP_Read(UDPiopb * pb,Boolean async);
- OSErr UDP_BfrReturn(UDPiopb * pb,Boolean async);
- OSErr UDP_Write(UDPiopb * pb,Boolean async);
- OSErr UDP_Release(UDPiopb * pb,Boolean async);
- OSErr UDP_MaxMTUSize(UDPiopb * pb,Boolean async);
- OSErr UDP_Status(UDPiopb * pb,Boolean async);
- OSErr UDP_MultiCreate(UDPiopb * pb,Boolean async);
- OSErr UDP_MultiSend(UDPiopb * pb,Boolean async);
- OSErr UDP_MultiRead(UDPiopb * pb,Boolean async);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-