From: John Gilmore Date: Wed, 29 Mar 1995 02:12:14 +0000 (+0000) Subject: * k5-errors.h: Rename errors.h (which duplicated a standard Mac X-Git-Tag: krb5-1.0-beta5~428 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c2fb281de3dcbc03e65a33cbb05adaaef5b3f45a;p=krb5.git * k5-errors.h: Rename errors.h (which duplicated a standard Mac header name, causing a problem). * AddressXlation.h, GetMyIPAddr.h, MacTCPCommonTypes.h, TCPPB.h, UDPPB.h: Add MacTCP header files. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5293 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/krb5/AddressXlation.h b/src/include/krb5/AddressXlation.h new file mode 100644 index 000000000..b73055b98 --- /dev/null +++ b/src/include/krb5/AddressXlation.h @@ -0,0 +1,102 @@ +/* + AddressXlation.h + MacTCP name to address translation routines. + + Copyright Apple Computer, Inc. 1988-91 + All rights reserved + +*/ +#ifndef __ADDRESSXLATION__ +#define __ADDRESSXLATION__ + +#ifndef __MACTCPCOMMONTYPES__ +#include "MacTCPCommonTypes.h" +#endif + +#define NUM_ALT_ADDRS 4 + +typedef struct hostInfo { + long rtnCode; + char cname[255]; + unsigned long addr[NUM_ALT_ADDRS]; +}; + +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]; + union { + unsigned long addr[NUM_ALT_ADDRS]; + struct HInfoRec hinfo; + struct MXRec mx; + } rdata; +}; + +typedef struct cacheEntryRecord { + char *cname; + unsigned short type; + unsigned short cacheClass; + unsigned long ttl; + union { + char *name; + ip_addr addr; + } rdata; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef THINK_C + + typedef ProcPtr EnumResultProcPtr; + typedef ProcPtr ResultProcPtr; + typedef ProcPtr ResultProc2Ptr; + +#else + + 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); + +#endif + +extern OSErr OpenResolver(char *fileName); + +extern OSErr StrToAddr(char *hostName, struct hostInfo *hostInfoPtr, ResultProcPtr ResultProc, char *userDataPtr); + +extern OSErr AddrToStr(unsigned long addr, char *addrStr); + +extern OSErr EnumCache(EnumResultProcPtr enumResultProc, char *userDataPtr); + +extern OSErr AddrToName(ip_addr addr, struct hostInfo *hostInfoPtr, ResultProcPtr ResultProc, char *userDataPtr); + +extern OSErr HInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2Ptr resultProc, char *userDataPtr); + +extern OSErr MXInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2Ptr resultProc, char *userDataPtr); + +extern OSErr CloseResolver(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __ADDRESSXLATION__ */ diff --git a/src/include/krb5/ChangeLog b/src/include/krb5/ChangeLog index 69152b0bd..482fdd035 100644 --- a/src/include/krb5/ChangeLog +++ b/src/include/krb5/ChangeLog @@ -9,6 +9,11 @@ Tue Mar 28 18:02:41 1995 John Gilmore (gnu at toad.com) * macsock.h: Support connect(), recv(), send(), getmyipaddr(). (WSAGetLastError): Fix typo -- there's no argument to this macro. + * k5-errors.h: Rename errors.h (which duplicated a standard Mac + header name, causing a problem). + * AddressXlation.h, GetMyIPAddr.h, MacTCPCommonTypes.h, TCPPB.h, + UDPPB.h: Add MacTCP header files. + Mon Mar 27 09:33:10 1995 Chris Provenzano (proven@mit.edu) * func-proto.h (krb5_rd_req(), krb5_rd_req_decode(), krb5_mk_rep(), diff --git a/src/include/krb5/GetMyIPAddr.h b/src/include/krb5/GetMyIPAddr.h new file mode 100644 index 000000000..0727c3b4c --- /dev/null +++ b/src/include/krb5/GetMyIPAddr.h @@ -0,0 +1,37 @@ +/* + 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 diff --git a/src/include/krb5/MacTCPCommonTypes.h b/src/include/krb5/MacTCPCommonTypes.h new file mode 100644 index 000000000..b62ae262d --- /dev/null +++ b/src/include/krb5/MacTCPCommonTypes.h @@ -0,0 +1,112 @@ +/* + MacTCPCommonTypes.h + C type definitions used throughout MacTCP. + + Copyright Apple Computer, Inc. 1988-91 + All rights reserved + +*/ + +#ifndef __MACTCPCOMMONTYPES__ +#define __MACTCPCOMMONTYPES__ + +#ifndef __TYPES__ +#include +#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__ */ diff --git a/src/include/krb5/TCPPB.h b/src/include/krb5/TCPPB.h new file mode 100644 index 000000000..2a4afbb94 --- /dev/null +++ b/src/include/krb5/TCPPB.h @@ -0,0 +1,248 @@ +/* + 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; + diff --git a/src/include/krb5/UDPPB.h b/src/include/krb5/UDPPB.h new file mode 100644 index 000000000..a4e3fcdc2 --- /dev/null +++ b/src/include/krb5/UDPPB.h @@ -0,0 +1,84 @@ +/* + 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; + diff --git a/src/include/krb5/errors.h b/src/include/krb5/k5-errors.h similarity index 100% rename from src/include/krb5/errors.h rename to src/include/krb5/k5-errors.h