⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wsockdos.h

📁 Libnet is a cross-platform library aimed at game developers. It has an abstract high level API, whic
💻 H
📖 第 1 页 / 共 2 页
字号:
/*---------------------------------------------------------------- * wsock.h - declarations for the Winsock driver *---------------------------------------------------------------- *  libnet is (c) Copyright Chad Catlett and George Foot 1997-1998 * *  Individual sections of this file are copyrighted by their *  authors. * *  Please look in `docs' for details, documentation and *  distribution conditions. *//* *  This information came from various sources, notably: * *    - `winsock.h' header file I found on www.stardust.com (general *      constants and data types) *      URL: http://www.stardust.com/ * *    - `wsock.h' header file I found somewhere (vxd indices) * *    - Dan Hedlund's WSOCK library (farptrx functions) *      URL: http://www.rangenet.com/markiv/wsock.html * *  Please send comments/queries/complaints about any of this to me: * *    George Foot <george.foot@merton.oxford.ac.uk> */#ifndef libnet_included_file_wsock_h#define libnet_included_file_wsock_h/*----------------------------------------------------------------* * sort out a few things so the winsock.h stuff can be read *----------------------------------------------------------------*/#define FAR/*----------------------------------------------------------------* * winsock.h (abridged) *----------------------------------------------------------------*//* WINSOCK.H--definitions to be used with the WINSOCK.DLL * * This header file corresponds to version 1.1 of the Windows Sockets specification. * * This file includes parts which are Copyright (c) 1982-1986 Regents * of the University of California.  All rights reserved.  The * Berkeley Software License Agreement specifies the terms and * conditions for redistribution. *//* * Basic system type definitions, taken from the BSD file sys/types.h. */typedef unsigned char   u_char;typedef unsigned short  u_short;typedef unsigned int    u_int;typedef unsigned long   u_long;/* * The new type to be used in all * instances which refer to sockets. */typedef u_int           SOCKET;/* * Commands for ioctlsocket(),  taken from the BSD file fcntl.h. * * * Ioctl's have the command encoded in the lower word, * and the size of any in or out parameters in the upper * word.  The high 2 bits of the upper word are used * to encode the in/out status of the parameter; for now * we restrict parameters to at most 128 bytes. */#define IOCPARM_MASK    0x7f            /* parameters must be < 128 bytes */#define IOC_VOID        0x20000000      /* no parameters */#define IOC_OUT         0x40000000      /* copy out parameters */#define IOC_IN          0x80000000      /* copy in parameters */#define IOC_INOUT       (IOC_IN|IOC_OUT)					/* 0x20000000 distinguishes new &					   old ioctl's */#define _IO(x,y)        (IOC_VOID|(x<<8)|y)#define _IOR(x,y,t)     (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)#define _IOW(x,y,t)     (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)#define FIONREAD    _IOR('f', 127, u_long) /* get # bytes to read */#define FIONBIO     _IOW('f', 126, u_long) /* set/clear non-blocking i/o */#define FIOASYNC    _IOW('f', 125, u_long) /* set/clear async i/o *//* Socket I/O Controls */#define SIOCSHIWAT  _IOW('s',  0, u_long)  /* set high watermark */#define SIOCGHIWAT  _IOR('s',  1, u_long)  /* get high watermark */#define SIOCSLOWAT  _IOW('s',  2, u_long)  /* set low watermark */#define SIOCGLOWAT  _IOR('s',  3, u_long)  /* get low watermark */#define SIOCATMARK  _IOR('s',  7, u_long)  /* at oob mark? *//* * Structures returned by network data base library, taken from the * BSD file netdb.h.  All addresses are supplied in host order, and * returned in network order (suitable for use in system calls). */struct  hostent {	char    FAR * h_name;           /* official name of host */	char    FAR * FAR * h_aliases;  /* alias list */	short   h_addrtype;             /* host address type */	short   h_length;               /* length of address */	char    FAR * FAR * h_addr_list; /* list of addresses */#define h_addr  h_addr_list[0]          /* address, for backward compat */};/* * It is assumed here that a network number * fits in 32 bits. */struct  netent {	char    FAR * n_name;           /* official name of net */	char    FAR * FAR * n_aliases;  /* alias list */	short   n_addrtype;             /* net address type */	u_long  n_net;                  /* network # */};struct  servent {	char    FAR * s_name;           /* official service name */	char    FAR * FAR * s_aliases;  /* alias list */	short   s_port;                 /* port # */	char    FAR * s_proto;          /* protocol to use */};struct  protoent {	char    FAR * p_name;           /* official protocol name */	char    FAR * FAR * p_aliases;  /* alias list */	short   p_proto;                /* protocol # */};/* * Constants and structures defined by the internet system, * Per RFC 790, September 1981, taken from the BSD file netinet/in.h. *//* * Protocols */#define IPPROTO_IP              0               /* dummy for IP */#define IPPROTO_ICMP            1               /* control message protocol */#define IPPROTO_GGP             2               /* gateway^2 (deprecated) */#define IPPROTO_TCP             6               /* tcp */#define IPPROTO_PUP             12              /* pup */#define IPPROTO_UDP             17              /* user datagram protocol */#define IPPROTO_IDP             22              /* xns idp */#define IPPROTO_ND              77              /* UNOFFICIAL net disk proto */#define IPPROTO_RAW             255             /* raw IP packet */#define IPPROTO_MAX             256/* * Internet address (old style... should be updated) */struct in_addr {	union {		struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;		struct { u_short s_w1,s_w2; } S_un_w;		u_long S_addr;	} S_un;#define s_addr  S_un.S_addr				/* can be used for most tcp & ip code */#define s_host  S_un.S_un_b.s_b2				/* host on imp */#define s_net   S_un.S_un_b.s_b1				/* network */#define s_imp   S_un.S_un_w.s_w2				/* imp */#define s_impno S_un.S_un_b.s_b4				/* imp # */#define s_lh    S_un.S_un_b.s_b3				/* logical host */};#define INADDR_ANY              (u_long)0x00000000#define INADDR_LOOPBACK         0x7f000001#define INADDR_BROADCAST        (u_long)0xffffffff #define INADDR_NONE             0xffffffff/* * Socket address, internet style. */struct sockaddr_in {	short   sin_family;	u_short sin_port;	struct  in_addr sin_addr;	char    sin_zero[8];};/* * Options for use with [gs]etsockopt at the IP level. */#define IP_OPTIONS      1               /* set/get IP per-packet options *//* * Definitions related to sockets: types, address families, options, * taken from the BSD file sys/socket.h. *//* * This is used instead of -1, since the * SOCKET type is unsigned. */#define INVALID_SOCKET  (SOCKET)(~0)#define SOCKET_ERROR            (-1)/* * Types */#define SOCK_STREAM     1               /* stream socket */#define SOCK_DGRAM      2               /* datagram socket */#define SOCK_RAW        3               /* raw-protocol interface */#define SOCK_RDM        4               /* reliably-delivered message */#define SOCK_SEQPACKET  5               /* sequenced packet stream *//* * Option flags per-socket. */#define SO_DEBUG        0x0001          /* turn on debugging info recording */#define SO_ACCEPTCONN   0x0002          /* socket has had listen() */#define SO_REUSEADDR    0x0004          /* allow local address reuse */#define SO_KEEPALIVE    0x0008          /* keep connections alive */#define SO_DONTROUTE    0x0010          /* just use interface addresses */#define SO_BROADCAST    0x0020          /* permit sending of broadcast msgs */#define SO_USELOOPBACK  0x0040          /* bypass hardware when possible */#define SO_LINGER       0x0080          /* linger on close if data present */#define SO_OOBINLINE    0x0100          /* leave received OOB data in line */#define SO_DONTLINGER   (u_int)(~SO_LINGER)/* * Additional options. */#define SO_SNDBUF       0x1001          /* send buffer size */#define SO_RCVBUF       0x1002          /* receive buffer size */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -