Annotation of mstools/h/winsock.h, revision 1.1

1.1     ! root        1: #ifndef _WINSOCKAPI_
        !             2: #define _WINSOCKAPI_
        !             3: 
        !             4: /*
        !             5:  * Pull in WINDOWS.H if necessary
        !             6:  */
        !             7: #ifndef _INC_WINDOWS
        !             8: #include <WINDOWS.H>
        !             9: #endif /* _INC_WINDOWS */
        !            10: 
        !            11: #ifndef FAR
        !            12: #define FAR far
        !            13: #endif  /* FAR */
        !            14: 
        !            15: 
        !            16: /*
        !            17:  * Basic system type definitions, taken from the BSD file sys/types.h.
        !            18:  */
        !            19: 
        !            20: typedef  unsigned char           u_char;
        !            21: typedef  unsigned short          u_short;
        !            22: typedef  unsigned int            u_int;
        !            23: typedef  unsigned long           u_long;
        !            24: typedef  unsigned short          ushort;                 /* sys III compat */
        !            25: 
        !            26: /*
        !            27:  * The new type to be used in all
        !            28:  * instances which refer to sockets.
        !            29:  */
        !            30: typedef unsigned int            SOCKET;
        !            31: 
        !            32: /*
        !            33:  * Select uses arrays of SOCKETs.  These macros manipulate such
        !            34:  * arrays.  FD_SETSIZE may be defined by the user before including
        !            35:  * this file, but the default here should be >= 64.
        !            36:  *
        !            37:  * CAVEAT IMPLEMENTOR and USER: THESE MACROS AND TYPES MUST BE
        !            38:  * INCLUDED IN WINSOCK.H EXACTLY AS SHOWN HERE.
        !            39:  */
        !            40: 
        !            41: #ifndef FD_SETSIZE
        !            42: #define FD_SETSIZE              64
        !            43: #endif /* FD_SETSIZE */
        !            44: 
        !            45: typedef struct fd_set {
        !            46:         short fd_count;                                 /* how many are SET? */
        !            47:         SOCKET fd_array[FD_SETSIZE];                    /* an array of SOCKETs */
        !            48: } fd_set;
        !            49: 
        !            50: extern int FAR __WSAFDIsSet(SOCKET, fd_set FAR *);
        !            51: 
        !            52: #define FD_CLR(fd, set) { \
        !            53:         int __i; \
        !            54:         for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count ; __i++) { \
        !            55:                 if (((fd_set FAR *)(set))->fd_array[__i] == fd) { \
        !            56:                         while (__i < ((fd_set FAR *)(set))->fd_count-1) { \
        !            57:                                 ((fd_set FAR *)(set))->fd_array[__i] = \
        !            58:                                         ((fd_set FAR*)(set))->fd_array[__i+1]; \
        !            59:                                 __i++; \
        !            60:                         } \
        !            61:                         ((fd_set FAR *)(set))->fd_count--; \
        !            62:                         break; \
        !            63:                 } \
        !            64:         } \
        !            65: }
        !            66: 
        !            67: #define FD_SET(fd, set) { \
        !            68:         if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) \
        !            69:                 ((fd_set FAR *)(set))->fd_array[((fd_set FAR *)(set))->fd_count++] = fd; }
        !            70: 
        !            71: #define FD_ZERO(set) ((fd_set FAR *)(set))->fd_count=0
        !            72: 
        !            73: #define FD_ISSET(fd, set) __WSAFDIsSet((int)fd, (fd_set FAR *)set)
        !            74: 
        !            75: /*
        !            76:  * Structure used in select() call, taken from the BSD file sys/time.h.
        !            77:  */
        !            78: struct timeval {
        !            79:         long                    tv_sec;                         /* seconds */
        !            80:         long                    tv_usec;                        /* and microseconds */
        !            81: };
        !            82: 
        !            83: /*
        !            84:  * Operations on timevals.
        !            85:  *
        !            86:  * NB: timercmp does not work for >= or <=.
        !            87:  */
        !            88: #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
        !            89: 
        !            90: #define timercmp(tvp, uvp, cmp) \
        !            91:         ((tvp)->tv_sec cmp (uvp)->tv_sec || \
        !            92:         (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
        !            93: 
        !            94: #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
        !            95: 
        !            96: /*
        !            97:  * Commands for ioctlsocket(),  taken from the BSD file fcntl.h.
        !            98:  *
        !            99:  *
        !           100:  * Ioctl's have the command encoded in the lower word,
        !           101:  * and the size of any in or out parameters in the upper
        !           102:  * word.  The high 2 bits of the upper word are used
        !           103:  * to encode the in/out status of the parameter; for now
        !           104:  * we restrict parameters to at most 128 bytes.
        !           105:  */
        !           106: #define IOCPARM_MASK            0x7f            /* parameters must be < 128 bytes */
        !           107: #define IOC_VOID                0x20000000      /* no parameters */
        !           108: #define IOC_OUT                 0x40000000      /* copy out parameters */
        !           109: #define IOC_IN                  0x80000000      /* copy in parameters */
        !           110: #define  IOC_INOUT              (IOC_IN|IOC_OUT)
        !           111:                                                 /* 0x20000000 distinguishes new &
        !           112:                                                    old ioctl's */
        !           113: #define _IO(x,y)                (IOC_VOID|('x'<<8)|y)
        !           114: 
        !           115: #define _IOR(x,y,t)             (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y)
        !           116: 
        !           117: #define _IOW(x,y,t)             (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y)
        !           118: 
        !           119: #define FIONREAD                _IOR(f, 127, int)       /* get # bytes to read */
        !           120: #define FIONBIO                 _IOW(f, 126, int)       /* set/clear non-blocking i/o */
        !           121: #define FIOASYNC                _IOW(f, 125, int)       /* set/clear async i/o */
        !           122: 
        !           123: /* Socket I/O Controls */
        !           124: #define SIOCSHIWAT              _IOW(s,  0, int)        /* set high watermark */
        !           125: #define SIOCGHIWAT              _IOR(s,  1, int)        /* get high watermark */
        !           126: #define SIOCSLOWAT              _IOW(s,  2, int)        /* set low watermark */
        !           127: #define SIOCGLOWAT              _IOR(s,  3, int)        /* get low watermark */
        !           128: #define SIOCATMARK              _IOR(s,  7, int)        /* at oob mark? */
        !           129: 
        !           130: /*
        !           131:  * Structures returned by network data base library, taken from the
        !           132:  * BSD file netdb.h.  All addresses are supplied in host order, and
        !           133:  * returned in network order (suitable for use in system calls).
        !           134:  */
        !           135: 
        !           136: struct hostent {
        !           137:         char FAR *              h_name;                 /* official name of host */
        !           138:         char FAR * FAR *        h_aliases;              /* alias list */
        !           139:         int                     h_addrtype;             /* host address type */
        !           140:         int                     h_length;               /* length of address */
        !           141:         char FAR * FAR *        h_addr_list;            /* list of addresses */
        !           142: #define  h_addr                 h_addr_list[0]          /* address, for backward compat */
        !           143: };
        !           144: 
        !           145: /*
        !           146:  * Assumption here is that a network number
        !           147:  * fits in 32 bits -- probably a poor one.
        !           148:  */
        !           149: struct  netent {
        !           150:         char FAR *              n_name;                 /* official name of net */
        !           151:         char FAR * FAR *        n_aliases;              /* alias list */
        !           152:         int                     n_addrtype;             /* net address type */
        !           153:         unsigned long           n_net;                  /* network # */
        !           154: };
        !           155: 
        !           156: struct  servent {
        !           157:         char FAR *              s_name;                 /* official service name */
        !           158:         char FAR * FAR *        s_aliases;              /* alias list */
        !           159:         int                     s_port;                 /* port # */
        !           160:         char FAR *              s_proto;                /* protocol to use */
        !           161: };
        !           162: 
        !           163: struct  protoent {
        !           164:         char FAR *              p_name;                 /* official protocol name */
        !           165:         char FAR * FAR *        p_aliases;              /* alias list */
        !           166:         int                     p_proto;                /* protocol # */
        !           167: };
        !           168: 
        !           169: 
        !           170: /*
        !           171:  * Constants and structures defined by the internet system,
        !           172:  * Per RFC 790, September 1981, taken from the BSD file netinet/in.h.
        !           173:  */
        !           174: 
        !           175: /*
        !           176:  * Protocols
        !           177:  */
        !           178: #define IPPROTO_IP             0                       /* dummy for IP */
        !           179: #define IPPROTO_ICMP           1                       /* control message protocol */
        !           180: #define IPPROTO_GGP            2                       /* gateway^2 (deprecated) */
        !           181: #define IPPROTO_TCP            6                       /* tcp */
        !           182: #define IPPROTO_PUP            12                      /* pup */
        !           183: #define IPPROTO_UDP            17                      /* user datagram protocol */
        !           184: #define IPPROTO_IDP            22                      /* xns idp */
        !           185: #define IPPROTO_ND             77                      /* UNOFFICIAL net disk proto */
        !           186: 
        !           187: #define IPPROTO_RAW            255                     /* raw IP packet */
        !           188: #define IPPROTO_MAX            256
        !           189: 
        !           190: /*
        !           191:  * Port/socket numbers: network standard functions
        !           192:  */
        !           193: #define IPPORT_ECHO            7
        !           194: #define IPPORT_DISCARD         9
        !           195: #define IPPORT_SYSTAT          11
        !           196: #define IPPORT_DAYTIME         13
        !           197: #define IPPORT_NETSTAT         15
        !           198: #define IPPORT_FTP             21
        !           199: #define IPPORT_TELNET          23
        !           200: #define IPPORT_SMTP            25
        !           201: #define IPPORT_TIMESERVER      37
        !           202: #define IPPORT_NAMESERVER      42
        !           203: #define IPPORT_WHOIS           43
        !           204: #define IPPORT_MTP             57
        !           205: 
        !           206: /*
        !           207:  * Port/socket numbers: host specific functions
        !           208:  */
        !           209: #define IPPORT_TFTP            69
        !           210: #define IPPORT_RJE             77
        !           211: #define IPPORT_FINGER          79
        !           212: #define IPPORT_TTYLINK         87
        !           213: #define IPPORT_SUPDUP          95
        !           214: 
        !           215: /*
        !           216:  * UNIX TCP sockets
        !           217:  */
        !           218: #define IPPORT_EXECSERVER      512
        !           219: #define IPPORT_LOGINSERVER     513
        !           220: #define IPPORT_CMDSERVER       514
        !           221: #define IPPORT_EFSSERVER       520
        !           222: 
        !           223: /*
        !           224:  * UNIX UDP sockets
        !           225:  */
        !           226: #define IPPORT_BIFFUDP         512
        !           227: #define IPPORT_WHOSERVER       513
        !           228: #define IPPORT_ROUTESERVER     520
        !           229:                                 /* 520+1 also used */
        !           230: 
        !           231: /*
        !           232:  * Ports < IPPORT_RESERVED are reserved for
        !           233:  * privileged processes (e.g. root).
        !           234:  */
        !           235: #define IPPORT_RESERVED 1024
        !           236: 
        !           237: /*
        !           238:  * Link numbers
        !           239:  */
        !           240: #define IMPLINK_IP             155
        !           241: #define IMPLINK_LOWEXPER       156
        !           242: #define IMPLINK_HIGHEXPER      158
        !           243: 
        !           244: /*
        !           245:  * Internet address (old style... should be updated)
        !           246:  */
        !           247: struct in_addr {
        !           248:         union {
        !           249:                 struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
        !           250:                 struct { u_short s_w1,s_w2; } S_un_w;
        !           251:                 u_long S_addr;
        !           252:         } S_un;
        !           253: #define  s_addr S_un.S_addr     /* can be used for most tcp & ip code */
        !           254: };
        !           255: 
        !           256: /*
        !           257:  * Definitions of bits in internet address integers.
        !           258:  * On subnets, the decomposition of addresses to host and net parts
        !           259:  * is done according to subnet mask, not the masks here.
        !           260:  */
        !           261: #define IN_CLASSA(i)            (((long)(i) & 0x80000000) == 0)
        !           262: #define IN_CLASSA_NET           0xff000000
        !           263: #define IN_CLASSA_NSHIFT        24
        !           264: #define IN_CLASSA_HOST          0x00ffffff
        !           265: #define IN_CLASSA_MAX           128
        !           266: 
        !           267: #define IN_CLASSB(i)            (((long)(i) & 0xc0000000) == 0x80000000)
        !           268: #define IN_CLASSB_NET           0xffff0000
        !           269: #define IN_CLASSB_NSHIFT        16
        !           270: #define IN_CLASSB_HOST          0x0000ffff
        !           271: #define IN_CLASSB_MAX           65536
        !           272: 
        !           273: #define IN_CLASSC(i)            (((long)(i) & 0xc0000000) == 0xc0000000)
        !           274: #define IN_CLASSC_NET           0xffffff00
        !           275: #define IN_CLASSC_NSHIFT        8
        !           276: #define IN_CLASSC_HOST          0x000000ff
        !           277: 
        !           278: #define INADDR_ANY              (u_long)0x00000000
        !           279: #define INADDR_LOOPBACK 0x7f000001
        !           280: #define INADDR_BROADCAST        (u_long)0xffffffff      /* must be masked */
        !           281: 
        !           282: /*
        !           283:  * Socket address, internet style.
        !           284:  */
        !           285: struct sockaddr_in {
        !           286:         short                   sin_family;
        !           287:         u_short                 sin_port;
        !           288:         struct in_addr          sin_addr;
        !           289:         char                    sin_zero[8];
        !           290: };
        !           291: 
        !           292: #define WSADESCRIPTION_LEN      256
        !           293: #define WSASYS_STATUS_LEN       128
        !           294: 
        !           295: typedef struct WSAData {
        !           296:         WORD                    wVersion;
        !           297:         WORD                    wHighVersion;
        !           298:         char                    szDescription[WSADESCRIPTION_LEN+1];
        !           299:         char                    szSystemStatus[WSASYS_STATUS_LEN+1];
        !           300:         int                     iMaxSockets;
        !           301:         int                     iMaxUdpDg;
        !           302: } WSADATA;
        !           303: 
        !           304: typedef WSADATA FAR *LPWSADATA;
        !           305: 
        !           306: /*
        !           307:  * Options for use with [gs]etsockopt at the IP level.
        !           308:  */
        !           309: #define IP_OPTIONS              1               /* set/get IP per-packet options */
        !           310: 
        !           311: /*
        !           312:  * Definitions related to sockets: types, address families, options,
        !           313:  * taken from the BSD file sys/socket.h.
        !           314:  */
        !           315: 
        !           316: /*
        !           317:  * This is used instead of -1, since the
        !           318:  * SOCKET type is unsigned.
        !           319:  */
        !           320: #define INVALID_SOCKET          (SOCKET)(~0)
        !           321: #define SOCKET_ERROR            (-1)
        !           322: 
        !           323: /*
        !           324:  * Types
        !           325:  */
        !           326: #define SOCK_STREAM             1               /* stream socket */
        !           327: #define SOCK_DGRAM              2               /* datagram socket */
        !           328: #define SOCK_RAW                3               /* raw-protocol interface */
        !           329: #define SOCK_RDM                4               /* reliably-delivered message */
        !           330: #define SOCK_SEQPACKET          5               /* sequenced packet stream */
        !           331: 
        !           332: /*
        !           333:  * Option flags per-socket.
        !           334:  */
        !           335: #define SO_DEBUG                0x0001          /* turn on debugging info recording */
        !           336: #define SO_ACCEPTCONN           0x0002          /* socket has had listen() */
        !           337: #define SO_REUSEADDR            0x0004          /* allow local address reuse */
        !           338: #define SO_KEEPALIVE            0x0008          /* keep connections alive */
        !           339: #define SO_DONTROUTE            0x0010          /* just use interface addresses */
        !           340: #define SO_BROADCAST            0x0020          /* permit sending of broadcast msgs */
        !           341: #define SO_USELOOPBACK          0x0040          /* bypass hardware when possible */
        !           342: #define SO_LINGER               0x0080          /* linger on close if data present */
        !           343: #define SO_OOBINLINE            0x0100          /* leave received OOB data in line */
        !           344: 
        !           345: #define SO_DONTLINGER           (unsigned int) (~SO_LINGER)
        !           346: 
        !           347: /*
        !           348:  * Additional options.
        !           349:  */
        !           350: #define SO_SNDBUF               0x1001          /* send buffer size */
        !           351: #define SO_RCVBUF               0x1002          /* receive buffer size */
        !           352: #define SO_SNDLOWAT             0x1003          /* send low-water mark */
        !           353: #define SO_RCVLOWAT             0x1004          /* receive low-water mark */
        !           354: #define SO_SNDTIMEO             0x1005          /* send timeout */
        !           355: #define SO_RCVTIMEO             0x1006          /* receive timeout */
        !           356: #define SO_ERROR                0x1007          /* get error status and clear */
        !           357: #define SO_TYPE                 0x1008          /* get socket type */
        !           358: 
        !           359: /*
        !           360:  * Address families.
        !           361:  */
        !           362: #define AF_UNSPEC               0               /* unspecified */
        !           363: #define AF_UNIX                 1               /* local to host (pipes, portals) */
        !           364: #define AF_INET                 2               /* internetwork: UDP, TCP, etc. */
        !           365: #define AF_IMPLINK              3               /* arpanet imp addresses */
        !           366: #define AF_PUP                  4               /* pup protocols: e.g. BSP */
        !           367: #define AF_CHAOS                5               /* mit CHAOS protocols */
        !           368: #define AF_NS                   6               /* XEROX NS protocols */
        !           369: #define AF_NBS                  7               /* nbs protocols */
        !           370: #define AF_ECMA                 8               /* european computer manufacturers */
        !           371: #define AF_DATAKIT              9               /* datakit protocols */
        !           372: #define AF_CCITT                10              /* CCITT protocols, X.25 etc */
        !           373: #define AF_SNA                  11              /* IBM SNA */
        !           374: #define AF_DECnet               12              /* DECnet */
        !           375: #define AF_DLI                  13              /* Direct data link interface */
        !           376: #define AF_LAT                  14              /* LAT */
        !           377: #define AF_HYLINK               15              /* NSC Hyperchannel */
        !           378: #define AF_APPLETALK            16              /* AppleTalk */
        !           379: 
        !           380: #define AF_MAX                  17
        !           381: 
        !           382: /*
        !           383:  * Structure used by kernel to store most
        !           384:  * addresses.
        !           385:  */
        !           386: struct sockaddr {
        !           387:         u_short                 sa_family;      /* address family */
        !           388:         char                    sa_data[14];    /* up to 14 bytes of direct address */
        !           389: };
        !           390: 
        !           391: /*
        !           392:  * Structure used by kernel to pass protocol
        !           393:  * information in raw sockets.
        !           394:  */
        !           395: struct sockproto {
        !           396:         u_short                 sp_family;      /* address family */
        !           397:         u_short                 sp_protocol;    /* protocol */
        !           398: };
        !           399: 
        !           400: /*
        !           401:  * Protocol families, same as address families for now.
        !           402:  */
        !           403: #define PF_UNSPEC               AF_UNSPEC
        !           404: #define PF_UNIX                 AF_UNIX
        !           405: #define PF_INET                 AF_INET
        !           406: #define PF_IMPLINK              AF_IMPLINK
        !           407: #define PF_PUP                  AF_PUP
        !           408: #define PF_CHAOS                AF_CHAOS
        !           409: #define PF_NS                   AF_NS
        !           410: #define PF_NBS                  AF_NBS
        !           411: #define PF_ECMA                 AF_ECMA
        !           412: #define PF_DATAKIT              AF_DATAKIT
        !           413: #define PF_CCITT                AF_CCITT
        !           414: #define PF_SNA                  AF_SNA
        !           415: #define PF_DECnet               AF_DECnet
        !           416: #define PF_DLI                  AF_DLI
        !           417: #define PF_LAT                  AF_LAT
        !           418: #define PF_HYLINK               AF_HYLINK
        !           419: #define PF_APPLETALK            AF_APPLETALK
        !           420: 
        !           421: #define PF_MAX                  AF_MAX
        !           422: 
        !           423: /*
        !           424:  * Structure used for manipulating linger option.
        !           425:  */
        !           426: struct  linger {
        !           427:         u_short                 l_onoff;        /* option on/off */
        !           428:         u_short                 l_linger;       /* linger time */
        !           429: };
        !           430: 
        !           431: /*
        !           432:  * Level number for (get/set)sockopt() to apply to socket itself.
        !           433:  */
        !           434: #define SOL_SOCKET              0xffff          /* options for socket level */
        !           435: 
        !           436: /*
        !           437:  * Maximum queue length specifiable by listen.
        !           438:  */
        !           439: #define  SOMAXCONN              5
        !           440: 
        !           441: #define  MSG_OOB                0x1             /* process out-of-band data */
        !           442: #define  MSG_PEEK               0x2             /* peek at incoming message */
        !           443: #define  MSG_DONTROUTE          0x4             /* send without using routing tables */
        !           444: 
        !           445: #define  MSG_MAXIOVLEN          16
        !           446: 
        !           447: /*
        !           448:  * Define constant based on rfc883, used by gethostbyxxxx() calls.
        !           449:  */
        !           450: #define  MAXGETHOSTSTRUCT       1024
        !           451: 
        !           452: /*
        !           453:  * All WinSock error constants are biased by WSABASEERR from the "normal"
        !           454:  */
        !           455: #define WSABASEERR              10000
        !           456: /*
        !           457:  * WinSockAPI definitions of regular Microsoft C error constants
        !           458:  */
        !           459: #define WSAEINTR                (WSABASEERR+4)
        !           460: #define WSAEBADF                (WSABASEERR+9)
        !           461: #define WSAEFAULT               (WSABASEERR+14)
        !           462: #define WSAEINVAL               (WSABASEERR+22)
        !           463: #define WSAEMFILE               (WSABASEERR+24)
        !           464: 
        !           465: /*
        !           466:  * WinSockAPI definitions of regular Berkeley error constants
        !           467:  */
        !           468: #define WSAEWOULDBLOCK          (WSABASEERR+35)
        !           469: #define WSAEINPROGRESS          (WSABASEERR+36)
        !           470: #define WSAEALREADY             (WSABASEERR+37)
        !           471: #define WSAENOTSOCK             (WSABASEERR+38)
        !           472: #define WSAEDESTADDRREQ         (WSABASEERR+39)
        !           473: #define WSAEMSGSIZE             (WSABASEERR+40)
        !           474: #define WSAEPROTOTYPE           (WSABASEERR+41)
        !           475: #define WSAENOPROTOOPT          (WSABASEERR+42)
        !           476: #define WSAEPROTONOSUPPORT      (WSABASEERR+43)
        !           477: #define WSAESOCKTNOSUPPORT      (WSABASEERR+44)
        !           478: #define WSAEOPNOTSUPP           (WSABASEERR+45)
        !           479: #define WSAEPFNOSUPPORT         (WSABASEERR+46)
        !           480: #define WSAEAFNOSUPPORT         (WSABASEERR+47)
        !           481: #define WSAEADDRINUSE           (WSABASEERR+48)
        !           482: #define WSAEADDRNOTAVAIL        (WSABASEERR+49)
        !           483: #define WSAENETDOWN             (WSABASEERR+50)
        !           484: #define WSAENETUNREACH          (WSABASEERR+51)
        !           485: #define WSAENETRESET            (WSABASEERR+52)
        !           486: #define WSAECONNABORTED         (WSABASEERR+53)
        !           487: #define WSAECONNRESET           (WSABASEERR+54)
        !           488: #define WSAENOBUFS              (WSABASEERR+55)
        !           489: #define WSAEISCONN              (WSABASEERR+56)
        !           490: #define WSAENOTCONN             (WSABASEERR+57)
        !           491: #define WSAESHUTDOWN            (WSABASEERR+58)
        !           492: #define WSAETOOMANYREFS         (WSABASEERR+59)
        !           493: #define WSAETIMEDOUT            (WSABASEERR+60)
        !           494: #define WSAECONNREFUSED         (WSABASEERR+61)
        !           495: #define WSAELOOP                (WSABASEERR+62)
        !           496: #define WSAENAMETOOLONG         (WSABASEERR+63)
        !           497: #define WSAEHOSTDOWN            (WSABASEERR+64)
        !           498: #define WSAEHOSTUNREACH         (WSABASEERR+65)
        !           499: #define WSAENOTEMPTY            (WSABASEERR+66)
        !           500: #define WSAEPROCLIM             (WSABASEERR+67)
        !           501: #define WSAEUSERS               (WSABASEERR+68)
        !           502: #define WSAEDQUOT               (WSABASEERR+69)
        !           503: #define WSAESTALE               (WSABASEERR+70)
        !           504: #define WSAEREMOTE              (WSABASEERR+71)
        !           505: 
        !           506: /*
        !           507:  * Extended WinSockAPI error constant definitions
        !           508:  */
        !           509: #define WSASYSNOTREADY          (WSABASEERR+91)
        !           510: #define WSAVERNOTSUPPORTED      (WSABASEERR+92)
        !           511: 
        !           512: /*
        !           513:  * Error return codes from gethostbyname() and gethostbyaddr()
        !           514:  * (when using the resolver). Note that these errors are
        !           515:  * retrieved via WSAGetLastError() and must therefore follow
        !           516:  * the rules for avoiding clashes with error numbers from
        !           517:  * specific implementations or language run-time systems.
        !           518:  * For this reason the codes are based at WSABASEERR+1001
        !           519:  */
        !           520: 
        !           521: #define h_errno         WSAGetLastError()
        !           522: 
        !           523: #define WSAHOST_NOT_FOUND       (WSABASEERR+1001)
        !           524:                                 /* Authoritative Answer: Host not found */
        !           525: #define WSATRY_AGAIN            (WSABASEERR+1002)
        !           526:                                 /* Non-Authoritative: Host not found, or SERVERFAIL */
        !           527: #define WSANO_RECOVERY          (WSABASEERR+1003)
        !           528:                                 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
        !           529: #define WSANO_DATA              (WSABASEERR+1004)
        !           530:                                 /* Valid name, no data record of requested type */
        !           531: #define WSANO_ADDRESS            WSANO_DATA
        !           532:                                 /* no address, look for MX record */
        !           533: 
        !           534: #define HOST_NOT_FOUND          WSAHOST_NOT_FOUND
        !           535:                                 /* Authoritative Answer: Host not found */
        !           536: #define TRY_AGAIN               WSATRY_AGAIN
        !           537:                                 /* Non-Authoritative: Host not found, or SERVERFAIL */
        !           538: #define NO_RECOVERY             WSANO_RECOVERY
        !           539:                                 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
        !           540: #define NO_DATA                 WSANO_DATA
        !           541:                                 /* Valid name, no data record of requested type */
        !           542: #define NO_ADDRESS              WSANO_ADDRESS
        !           543:                                 /* no address, look for MX record */
        !           544: 
        !           545: /*
        !           546:  * WinSockAPI errors redefined as regular Berkeley error constants
        !           547:  */
        !           548: 
        !           549: #if 0
        !           550: #define EWOULDBLOCK             WSAEWOULDBLOCK
        !           551: #define EINPROGRESS             WSAEINPROGRESS
        !           552: #define EALREADY                WSAEALREADY
        !           553: #define ENOTSOCK                WSAENOTSOCK
        !           554: #define EDESTADDRREQ            WSAEDESTADDRREQ
        !           555: #define EMSGSIZE                WSAEMSGSIZE
        !           556: #define EPROTOTYPE              WSAEPROTOTYPE
        !           557: #define ENOPROTOOPT             WSAENOPROTOOPT
        !           558: #define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
        !           559: #define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
        !           560: #define EOPNOTSUPP              WSAEOPNOTSUPP
        !           561: #define EPFNOSUPPORT            WSAEPFNOSUPPORT
        !           562: #define EAFNOSUPPORT            WSAEAFNOSUPPORT
        !           563: #define EADDRINUSE              WSAEADDRINUSE
        !           564: #define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
        !           565: #define ENETDOWN                WSAENETDOWN
        !           566: #define ENETUNREACH             WSAENETUNREACH
        !           567: #define ENETRESET               WSAENETRESET
        !           568: #define ECONNABORTED            WSAECONNABORTED
        !           569: #define ECONNRESET              WSAECONNRESET
        !           570: #define ENOBUFS                 WSAENOBUFS
        !           571: #define EISCONN                 WSAEISCONN
        !           572: #define ENOTCONN                WSAENOTCONN
        !           573: #define ESHUTDOWN               WSAESHUTDOWN
        !           574: #define ETOOMANYREFS            WSAETOOMANYREFS
        !           575: #define ETIMEDOUT               WSAETIMEDOUT
        !           576: #define ECONNREFUSED            WSAECONNREFUSED
        !           577: #define ELOOP                   WSAELOOP
        !           578: #define ENAMETOOLONG            WSAENAMETOOLONG
        !           579: #define EHOSTDOWN               WSAEHOSTDOWN
        !           580: #define EHOSTUNREACH            WSAEHOSTUNREACH
        !           581: #define ENOTEMPTY               WSAENOTEMPTY
        !           582: #define EPROCLIM                WSAEPROCLIM
        !           583: #define EUSERS                  WSAEUSERS
        !           584: #define EDQUOT                  WSAEDQUOT
        !           585: #define ESTALE                  WSAESTALE
        !           586: #define EREMOTE                 WSAEREMOTE
        !           587: #endif
        !           588: 
        !           589: /* Socket function prototypes */
        !           590: 
        !           591: SOCKET PASCAL accept (SOCKET s, struct sockaddr FAR *addr, int FAR *addrlen);
        !           592: 
        !           593: int PASCAL bind (SOCKET s, struct sockaddr FAR *addr, int namelen);
        !           594: 
        !           595: int PASCAL closesocket (SOCKET s);
        !           596: 
        !           597: int PASCAL connect (SOCKET s, struct sockaddr FAR *name, int namelen);
        !           598: 
        !           599: int PASCAL ioctlsocket (SOCKET s, int cmd, u_long FAR *arg);
        !           600: 
        !           601: int PASCAL getpeername (SOCKET s, struct sockaddr FAR *name, int FAR * namelen);
        !           602: 
        !           603: int PASCAL getsockname (SOCKET s, struct sockaddr FAR *name, int FAR * namelen);
        !           604: 
        !           605: int PASCAL getsockopt (SOCKET s, int level, int optname, char FAR *optval,
        !           606:                 int FAR *optlen);
        !           607: 
        !           608: u_long PASCAL htonl (u_long hostlong);
        !           609: 
        !           610: u_short PASCAL htons (u_short hostshort);
        !           611: 
        !           612: #if 0
        !           613: struct in_addr PASCALinet_addr (char FAR *cp);
        !           614: #else
        !           615: unsigned long PASCAL inet_addr (char FAR *cp);
        !           616: #endif
        !           617: 
        !           618: 
        !           619: char FAR * PASCAL inet_ntoa (struct in_addr in);
        !           620: 
        !           621: int PASCAL listen (SOCKET s, int backlog);
        !           622: 
        !           623: u_long PASCAL ntohl (u_long netlong);
        !           624: 
        !           625: u_short PASCAL ntohs (u_short netshort);
        !           626: 
        !           627: int PASCAL recv (SOCKET s, char FAR *buf, int len, int flags);
        !           628: 
        !           629: int PASCAL recvfrom (SOCKET s, char FAR *buf, int len, int flags, struct
        !           630:                 sockaddr FAR *from, int FAR * fromlen);
        !           631: 
        !           632: long PASCAL select (int nfds, fd_set FAR *readfds, fd_set far *writefds,
        !           633:                 fd_set FAR *exceptfds, struct timeval far *timeout);
        !           634: 
        !           635: int PASCAL send (SOCKET s, char FAR *buf, int len, int flags);
        !           636: 
        !           637: int PASCAL sendto (SOCKET s, char FAR *buf, int len, int flags, struct
        !           638:                 sockaddr FAR *to, int tolen);
        !           639: 
        !           640: int PASCAL setsockopt (SOCKET s, int level, int optname, char far *optval,
        !           641:                 int optlen);
        !           642: 
        !           643: int PASCAL shutdown (SOCKET s, int how);
        !           644: 
        !           645: SOCKET PASCAL socket (int af, int type, int protocol);
        !           646: 
        !           647: /* Database function prototypes */
        !           648: 
        !           649: struct hostent FAR * PASCAL gethostbyaddr(char FAR * addr, int len,int type);
        !           650: 
        !           651: struct hostent FAR * PASCAL gethostbyname(char FAR * name);
        !           652: 
        !           653: struct servent FAR * PASCAL getservbyport(int port, char FAR * proto);
        !           654: 
        !           655: struct servent FAR * PASCAL getservbyname(char FAR * name, char FAR * proto);
        !           656: 
        !           657: struct protoent FAR * PASCAL getprotobynumber(int proto);
        !           658: 
        !           659: struct protoent FAR * PASCAL getprotobyname(char FAR * name);
        !           660: 
        !           661: /* Microsoft Windows Extension function prototypes */
        !           662: 
        !           663: int PASCAL WSAStartup(WORD wVersionRequired, LPWSADATA lpWSAData);
        !           664: 
        !           665: int PASCAL WSACleanup();
        !           666: 
        !           667: void PASCAL WSASetLastError(int iError);
        !           668: 
        !           669: int PASCAL WSAGetLastError();
        !           670: 
        !           671: BOOL PASCAL WSAIsBlocking();
        !           672: 
        !           673: int PASCAL WSAUnhookBlockingHook();
        !           674: 
        !           675: FARPROC PASCAL WSASetBlockingHook(FARPROC lpBlockFunc);
        !           676: 
        !           677: int PASCAL WSACancelBlockingCall();
        !           678: 
        !           679: HANDLE PASCAL WSAAsyncGetServByName(HWND hWnd, unsigned int wMsg, char FAR * name,
        !           680:                 char FAR * proto, char FAR * buf, int buflen);
        !           681: 
        !           682: HANDLE PASCAL WSAAsyncGetServByPort(HWND hWnd, unsigned int wMsg, int port,
        !           683:                 char FAR * proto, char FAR * buf, int buflen);
        !           684: 
        !           685: HANDLE PASCAL WSAAsyncGetProtoByName(HWND hWnd, unsigned int wMsg, char FAR * name,
        !           686:                 char FAR * buf, int buflen);
        !           687: 
        !           688: HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND hWnd, unsigned int wMsg, int number,
        !           689:                 char FAR * buf, int buflen);
        !           690: 
        !           691: HANDLE PASCAL WSAAsyncGetHostByName(HWND hWnd, unsigned int wMsg, char FAR * name,
        !           692:                 char FAR * buf, int buflen);
        !           693: 
        !           694: HANDLE PASCAL WSAAsyncGetHostByAddr(HWND hWnd, unsigned int wMsg, char FAR *addr, int len,
        !           695:                 int type, char FAR * buf, int buflen);
        !           696: 
        !           697: int PASCAL WSACancelAsyncRequest(HANDLE hAsyncTaskHandle);
        !           698: 
        !           699: int PASCAL WSASelectWindow(SOCKET s, HWND hWnd, unsigned int wMsg, long lEvent);
        !           700: 
        !           701: /* Microsoft Windows Extended data types */
        !           702: typedef struct sockaddr SOCKADDR;
        !           703: typedef struct sockaddr *PSOCKADDR;
        !           704: typedef struct sockaddr FAR *LPSOCKADDR;
        !           705: 
        !           706: typedef struct sockaddr_in SOCKADDR_IN;
        !           707: typedef struct sockaddr_in *PSOCKADDR_IN;
        !           708: typedef struct sockaddr_in FAR *LPSOCKADDR_IN;
        !           709: 
        !           710: typedef struct linger LINGER;
        !           711: typedef struct linger *PLINGER;
        !           712: typedef struct linger FAR *LPLINGER;
        !           713: 
        !           714: typedef struct in_addr IN_ADDR;
        !           715: typedef struct in_addr *PIN_ADDR;
        !           716: typedef struct in_addr FAR *LPIN_ADDR;
        !           717: 
        !           718: typedef struct fd_set FD_SET;
        !           719: typedef struct fd_set PFD_SET;
        !           720: typedef struct fd_set LPFD_SET;
        !           721: 
        !           722: typedef struct hostent HOSTENT;
        !           723: typedef struct hostent *PHOSTENT;
        !           724: typedef struct hostent FAR *LPHOSTENT;
        !           725: 
        !           726: typedef struct servent SERVENT;
        !           727: typedef struct servent *PSERVENT;
        !           728: typedef struct servent FAR *LPSERVENT;
        !           729: 
        !           730: typedef struct protoent PROTOENT;
        !           731: typedef struct protoent *PPROTOENT;
        !           732: typedef struct protoent FAR *LPPROTOENT;
        !           733: 
        !           734: #endif  /* _WINSOCKAPI_ */
        !           735: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.