wstype.h

来自「wince下的源代码集合打包」· C头文件 代码 · 共 1,011 行 · 第 1/2 页

H
1,011
字号
    //    //  The active connection for this socket (if any).    //    LPVXD_CONNECTION    ActiveConnection;    //    //  The send/receive queues associated with this socket.    //  These queues will by owned by either the Endpoint    //  (for datagram sockets) or the ActiveConnection (for    //  connected stream sockets).    //    LPVXD_QUEUES        SendReceiveQueues;    //    //  The following fields are used to restart a send that    //  was blocked due to insufficient buffer space or buffer    //  quota.    //    LIST_ENTRY          SendPendingList;    LPBYTE              SendPendingBuffer;    DWORD               SendPendingBufferLength;    DWORD               SendPendingFlags;    //ULONG               SendPendingIpAddress;    //USHORT              SendPendingIpPort;    PTRANSPORT_ADDRESS  SendPendingAddress;    PTRANSPORT_ADDRESS  ScratchAddress;    BOOL                SendPendingAddressValid;    //    //  IP Multicast support.    //    DWORD               MulticastTtl;    DWORD               MulticastIf;    BOOL                InRecv;                 /* wmz */    int                 RecvLen;                /* wmz */    NDIS_BUFFER         RecvNDISBuff;           /* wmz */    //    // Holds SendPendingAddress.    //    BYTE                Data[ANYSIZE_ARRAY];#ifdef DEBUG    DWORD               EndOfSocketSignature;#endif  // DEBUG} SOCK_INFO;////  Values for si_state.//#define SI_STATE_FIRST          1#define SI_STATE_OPEN           1#define SI_STATE_BOUND          2#define SI_STATE_LISTENING      3#define SI_STATE_PEND_ACCEPT    4#define SI_STATE_CONNECTING     5#define SI_STATE_CONNECTED      6#define SI_STATE_DISCONNECTED   7#define SI_STATE_CLOSING        8       // "gracefully" closing#define SI_STATE_CLOSED         9#define SI_STATE_NO_PROVIDER	10		// PnP provider unloaded beneath us#define SI_STATE_LAST           10////  Bit definitions for si_flags.//#define SI_FLAG_CONNRESET       0x0001#define SI_FLAG_CONNDOWN        0x0002	// read data available, but disconnected#define SI_FLAG_VALID_MASK      0x0003////  Bit definitions for si_options.//#define SI_OPT_BROADCAST        0x0001#define SI_OPT_DEBUG            0x0002#define SI_OPT_DONTROUTE        0x0004#define SI_OPT_KEEPALIVE        0x0008#define SI_OPT_OOBINLINE        0x0010#define SI_OPT_REUSEADDR        0x0020#define SI_OPT_STOPSENDS        0x0040#define SI_OPT_STOPRECVS        0x0080#define SI_OPT_BLOCKING         0x0100#define SI_OPT_VALID_MASK       0x01FF	#define SOCK_INFO_SIZE \    ( sizeof ( SOCK_INFO ) \      + Stack->MaxTdiAddressLength \      + Stack->MaxTdiAddressLength \      - ANYSIZE_ARRAY )#ifdef DEBUG#define SOCK_SIGNATURE          (DWORD)'kCoS'#define SOCK_SIGNATURE_X        (DWORD)'cosX'#define INIT_SOCK_SIG(p)        ((p)->Signature = SOCK_SIGNATURE)#define KILL_SOCK_SIG(p)        ((p)->Signature = SOCK_SIGNATURE_X)#define IS_VALID_SOCK(p)        (((p) != NULL) && ((p)->Signature == SOCK_SIGNATURE))#else   // !DEBUG#define INIT_SOCK_SIG(p)        (void)(p)#define KILL_SOCK_SIG(p)        (void)(p)#define IS_VALID_SOCK(p)        ((void)(p), TRUE)#endif  // DEBUG////  Possible endpoint states.////  N.B.  For each state, VXD_ENDPOINT_STATE_RECEIVE_OK is set if it is//        allowable to accept receive data on an endpoint in that state.//#define VXD_ENDPOINT_STATE_RECEIVE_OK   0x40000000typedef enum _VXD_ENDPOINT_STATE{    VxdEndpointStateOpen        = 1,    VxdEndpointStateBound       = 2 | VXD_ENDPOINT_STATE_RECEIVE_OK,    VxdEndpointStateListening   = 3 | VXD_ENDPOINT_STATE_RECEIVE_OK,    VxdEndpointStateClosing     = 4} VXD_ENDPOINT_STATE, FAR * LPVXD_ENDPOINT_STATE;////  An endpoint.//typedef struct _VXD_ENDPOINT{    //    //  Structure signature, for safety's sake.    //    DEBUG_SIGNATURE	//	// The stack associated with this endpoint.	//	LPVXD_STACK		Stack;	//    //  Global list of active endpoints.    //    LIST_ENTRY          OpenEndpointList;    //    //  Reference count.  This is the number of outstanding    //  reasons why we cannot delete this structure.  When    //  this value drops to zero, the structure gets deleted.    //    DWORD               References;    //    //  Private flags.    //    DWORD               Flags;    //    //  The TDI address object associated with this endpoint.    //    HANDLE              AddressObject;    //    //  Current state.    //    VXD_ENDPOINT_STATE  State;    //    //  The socket that was bound to this endpoint.    //    LPSOCK_INFO         BoundSocket;    //    //  The local address for this endpoint.    //    PSOCKADDR           LocalAddress;    DWORD               LocalAddressLength;    //    //  The number connection objects that reference this endpoint.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    DWORD               ConnectedConnections;    //    //  The number of failed connection object allocations    //  since the last successful replenish.  Whenever    //  EndpReplenishIdleConnections is called, it tries to add    //  this many connection objects to the idle queue.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    DWORD               FailedConnections;    //    //  The current & maximum number idle connection objects    //  queued on this endpoint.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    DWORD               NumQueuedConnections;    DWORD               MaxQueuedConnections;    //    //  Queue of idle connection objects.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    LIST_ENTRY          IdleConnectionQueue;    //    //  Queue of active connections objects.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    LIST_ENTRY          ActiveConnectionQueue;    //    //  The send & receive queues associated with this endpoint.    //    //  DATAGRAM SOCKETS ONLY    //    LPVXD_QUEUES        SendReceiveQueues;    //    // Holds LocalAddress.    //    BYTE                Data[ANYSIZE_ARRAY];};#define VXD_ENDPOINT_SIZE ( sizeof(VXD_ENDPOINT) + Stack->MaxSockaddrLength - ANYSIZE_ARRAY )#ifdef DEBUG#define ENDP_SIGNATURE          (DWORD)'pDnE'#define ENDP_SIGNATURE_X        (DWORD)'dneX'#define INIT_ENDP_SIG(p)        ((p)->Signature = ENDP_SIGNATURE)#define KILL_ENDP_SIG(p)        ((p)->Signature = ENDP_SIGNATURE_X)#define IS_VALID_ENDP(p)        (((p) != NULL) && ((p)->Signature == ENDP_SIGNATURE))#else   // !DEBUG#define INIT_ENDP_SIG(p)        (void)(p)#define KILL_ENDP_SIG(p)        (void)(p)#define IS_VALID_ENDP(p)        ((void)(p), TRUE)#endif  // DEBUG////  Possible connection states.////  N.B.  For each state, VXD_CONNECT_STATE_NEED_DISCONNECT//        is set if a connection object in that state requires//        a disconnect before being destroyed.////        VXD_CONNECT_STATE_RECEIVE_OK is set if data may be//        received on an connection object in that state.////        VXD_CONNECT_STATE_DEAD is set if the the connection is//        dead (meaning the peer has disconnected/aborted).//#define VXD_CONNECT_STATE_NEED_DISCONNECT   0x40000000#define VXD_CONNECT_STATE_RECEIVE_OK        0x20000000#define VXD_CONNECT_STATE_DEAD              0x10000000typedef enum _VXD_CONNECT_STATE{    VxdConnectionStateFree         = 1,    VxdConnectionStateUnaccepted   = 2 | VXD_CONNECT_STATE_NEED_DISCONNECT                                       | VXD_CONNECT_STATE_RECEIVE_OK,    VxdConnectionStateReturned     = 3 | VXD_CONNECT_STATE_NEED_DISCONNECT                                       | VXD_CONNECT_STATE_RECEIVE_OK,    VxdConnectionStateConnected    = 4 | VXD_CONNECT_STATE_NEED_DISCONNECT                                       | VXD_CONNECT_STATE_RECEIVE_OK,    VxdConnectionStateDisconnected = 5 | VXD_CONNECT_STATE_NEED_DISCONNECT                                       | VXD_CONNECT_STATE_DEAD,    VxdConnectionStateSendShutdown = 6 | VXD_CONNECT_STATE_RECEIVE_OK,    VxdConnectionStateBothShutdown = 7 | VXD_CONNECT_STATE_DEAD,    VxdConnectionStateAborted      = 8 | VXD_CONNECT_STATE_DEAD,    VxdConnectionStateClosing      = 9} VXD_CONNECT_STATE, FAR * LPVXD_CONNECT_STATE;////  A connection.//typedef struct _VXD_CONNECTION{    //    //  Structure signature, for safety's sake.    //    DEBUG_SIGNATURE	//	// The stack associated with this endpoint.	//	LPVXD_STACK		Stack;    //    //  Global list of active connections.    //    LIST_ENTRY          OpenConnectionList;    //    //  Reference count.  This is the number of outstanding    //  reasons why we cannot delete this structure.  When    //  this value drops to zero, the structure gets deleted.    //    DWORD               References;    //    //  Private flags.    //    DWORD               Flags;    //    //  The socket that "owns" this connection.    //    LPSOCK_INFO         OwningSocket;    //    //  The endpoint that contains the address object associated    //  with this connection.    //    LPVXD_ENDPOINT      OwningEndpoint;    //    //  Current state.    //    VXD_CONNECT_STATE   State;    //    //  The local & remote addresses for this connection.    //    PSOCKADDR           LocalAddress;    PSOCKADDR           RemoteAddress;    DWORD               LocalAddressLength;    DWORD               RemoteAddressLength;    //    //  The TDI context associated with this connection.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    CONNECTION_CONTEXT  ConnectionContext;    //    //  Links into a connection queue.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    LIST_ENTRY          ConnectionQueue;    //    //  Send and receive queues.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    LPVXD_QUEUES        SendReceiveQueues;    int                 IndicatedNotAccepted;   /* wmz */    //    // Holds LocalAddress and RemoteAddress.    //    BYTE                Data[ANYSIZE_ARRAY];};#define VXD_CONNECTION_SIZE(StackVxd) \    ( sizeof ( VXD_CONNECTION ) + ( 2 * (StackVxd)->MaxSockaddrLength ) - ANYSIZE_ARRAY )#ifdef DEBUG#define CONN_SIGNATURE          (DWORD)'nNoC'#define CONN_SIGNATURE_X        (DWORD)'nocX'#define INIT_CONN_SIG(p)        ((p)->Signature = CONN_SIGNATURE)#define KILL_CONN_SIG(p)        ((p)->Signature = CONN_SIGNATURE_X)#define IS_VALID_CONN(p)        (((p) != NULL) && ((p)->Signature == CONN_SIGNATURE))#else   // !DEBUG#define INIT_CONN_SIG(p)        (void)(p)#define KILL_CONN_SIG(p)        (void)(p)#define IS_VALID_CONN(p)        ((void)(p), TRUE)#endif  // DEBUG////  One of these structures is created before calling TdiConnect.//  These structures keep track of the connection data until the//  TdiConnect API completes.//typedef struct _VXD_TRACKER{    //    //  Structure signature, for safety's sake.    //    DEBUG_SIGNATURE    //    //  Connection information.    //    TDI_CONNECTION_INFORMATION  RequestInfo;    TDI_CONNECTION_INFORMATION  ReturnedInfo;    //    //  The target connection address.    //    PTRANSPORT_ADDRESS    RemoteAddress;    //    //  The connection object associated with this tracker.  We    //  "precreate" the connection object when we create the tracker    //  object.  This way, we don't need to hit the heap during    //  TdiConnect's completion handler.    //    LPVXD_CONNECTION            Connection;    //    // Holds RemoteAddress.    //    BYTE                Data[ANYSIZE_ARRAY];};#define VXD_TRACKER_SIZE ( sizeof ( VXD_TRACKER ) + Stack->MaxTdiAddressLength - ANYSIZE_ARRAY )#ifdef DEBUG#define TRAC_SIGNATURE          (DWORD)'cArT'#define TRAC_SIGNATURE_X        (DWORD)'artX'#define INIT_TRAC_SIG(p)        ((p)->Signature = TRAC_SIGNATURE)#define KILL_TRAC_SIG(p)        ((p)->Signature = TRAC_SIGNATURE_X)#define IS_VALID_TRAC(p)        (((p) != NULL) && ((p)->Signature == TRAC_SIGNATURE))#else   // !DEBUG#define INIT_TRAC_SIG(p)        (void)(p)#define KILL_TRAC_SIG(p)        (void)(p)#define IS_VALID_TRAC(p)        ((void)(p), TRUE)#endif  // DEBUG////  Just to make things a little prettier...//typedef TDI_ADDRESS_IP FAR *    LPTDI_ADDRESS_IP;typedef TDI_STATUS FAR *        LPTDI_STATUS;typedef TA_IP_ADDRESS FAR *     LPTA_IP_ADDRESS;typedef TRANSPORT_ADDRESS FAR * LPTRANSPORT_ADDRESS;#define Address00               Address[0].Address[0]#endif  // _WSTYPE_H_

⌨️ 快捷键说明

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