wstype.h

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

H
1,011
字号
/**********************************************************************//**                        Microsoft Windows                         **//**Copyright (c) 1995-2000 Microsoft Corporation.  All rights reserved.**//**********************************************************************//*    wstype.h	This file contains global type definitons for the AFVXD VxD.*/#ifndef _WSTYPE_H_#define _WSTYPE_H_////  Enumerated type for system capacity.//typedef enum _SYSTEM_SIZE{    SmallSystem = 1,    MediumSystem,    LargeSystem} SYSTEM_SIZE, FAR * LPSYSTEM_SIZE;////  Structure signatures are only defined in DEBUG builds.//#ifdef DEBUG#define DEBUG_SIGNATURE DWORD Signature;#else   // !DEBUG#define DEBUG_SIGNATURE#endif  // DEBUG////  Make life with TdiQueryInformation( TDI_QUERY_ADDRESS_INFO )//  a little easier...//typedef struct _TA_IP_ADDRESS_INFO{    ULONG ActivityCount;    TA_IP_ADDRESS IpAddr;} TA_IP_ADDRESS_INFO, FAR * LPTA_IP_ADDRESS_INFO;////  A TCP/UDP port.//typedef WORD    PORT, FAR * LPPORT;////  Forward references.//typedef struct _SOCK_INFO      SOCK_INFO,      FAR * LPSOCK_INFO;typedef struct _VXD_BUFFER     VXD_BUFFER,     FAR * LPVXD_BUFFER;typedef struct _VXD_QUEUES     VXD_QUEUES,     FAR * LPVXD_QUEUES;typedef struct _VXD_ENDPOINT   VXD_ENDPOINT,   FAR * LPVXD_ENDPOINT;typedef struct _VXD_CONNECTION VXD_CONNECTION, FAR * LPVXD_CONNECTION;typedef struct _VXD_TRACKER    VXD_TRACKER,    FAR * LPVXD_TRACKER;typedef struct _VXD_STACK      VXD_STACK,      FAR * LPVXD_STACK;// when declaring an array that has a variable size, use this// as a placeholder.#define ANYSIZE_ARRAY   1//// One of these is allocated for each stack VxD.// This information was originally stored in "globals.c."//typedef struct _VXD_STACK{////  Structure signature, for safety's sake.//    DEBUG_SIGNATURE//// 	The associated transport's device name//    PWSTR                   TransportName;////  The list of address family/socket type/protocol triples//  supported by this stack DLL.//    PWINSOCK_MAPPING        Mapping;////  TDI Dispatch Table for the transport.//    TDIDispatchTable      * TdiDispatch;////  Address size information.//    DWORD                   MinSockaddrLength;    DWORD                   MaxSockaddrLength;    DWORD                   MinTdiAddressLength;    DWORD                   MaxTdiAddressLength;////  Linked lists of all sockets, endpoints, and connections//  created by this VxD.//    LIST_ENTRY              OpenSocketList;    LIST_ENTRY              OpenEndpointList;    LIST_ENTRY              OpenConnectionList;////  Linked list of buffer objects associated with failed sends.//  Whenever a send fails due to insufficient resources within//  the TCP/IP stack, we put the buffer on this queue & retry//  later.//    LIST_ENTRY              SendRetryList;////  Count of pending sends.//    DWORD                   PendingSendCount;////  Linked list of socket objects awaiting buffer space.  Blocking//  sockets are enqueued here if they fail to acquire sufficient//  buffer space during send().//    LIST_ENTRY              SendsWaitingForBuffersList;	    WCHAR                   Names[1];}VXD_STACK,	FAR * LPVXD_STACK;#ifdef DEBUG#define STACK_SIGNATURE          (DWORD)'katS'#define STACK_SIGNATURE_X        (DWORD)'katX'#define INIT_STACK_SIG(h)        ((h)->Signature = STACK_SIGNATURE)#define KILL_STACK_SIG(h)        ((h)->Signature = STACK_SIGNATURE_X)#define IS_VALID_STACK(h)        (((h) != NULL) && ((h)->Signature == STACK_SIGNATURE))#else   // !DEBUG#define INIT_STACK_SIG(h)        (void)(h)#define KILL_STACK_SIG(h)        (void)(h)#define IS_VALID_STACK(h)        ((void)(h), TRUE)#endif  // DEBUG#define NAMES_TO_VXD_STACK(n) CONTAINING_RECORD((n),VXD_STACK,Names[0])#define STACK_FROM_SOCKET(s) (s)->Stack#define SOCKET_SET_STACK(s,h) ( (s)->Stack = (h) )#define STACK_FROM_CONNECTION(c) (c)->Stack#define CONNECTION_SET_STACK(c,h) ( (c)->Stack = (h) )#define STACK_FROM_ENDPOINT(e) (e)->Stack#define ENDPOINT_SET_STACK(e,h) ( (e)->Stack = (h) )#define STACK_FROM_QUEUE(q) (q)->OwningSocket->Stack////  A buffer object.//typedef struct _VXD_BUFFER{    //    //  Structure signature, for safety's sake.    //    DEBUG_SIGNATURE    //    //  Buffer queue links.  The semantics of these links depends    //  on the implied state of the buffer (free, acquired for send,    //  or acquired for recv):    //    //  Free:    //    //      GlobalFreeBufferList - Links the buffer into a global pool    //          of free buffer objects.    //    //  Acquired for send():    //    //      SendRetryBufferList - If the send failed due to insufficient    //          resources within TDI, this links the buffer into a    //          global pool of failed send requests awaiting retry.    //          Otherwise, this field is unused.    //    //      SendPendingBufferList - Links the buffer into a per-socket    //          pool of pending send requests.    //    //  Acquired for recv():    //    //      RecvGenericBufferList - Links the buffer into a per-socket    //          pool of all received data.    //    //      RecvSpecificBufferList - Links the buffer into a per-socket    //          pool of all received data of the same type (normal vs.    //          expedited).    //    LIST_ENTRY          BufferList0;    LIST_ENTRY          BufferList1;#define GlobalFreeBufferList    BufferList0#define SendRetryBufferList     BufferList0#define SendPendingBufferList   BufferList1#define RecvGenericBufferList   BufferList0#define RecvSpecificBufferList  BufferList1    //    //  The owning buffer list.  When this object is released,    //  it will be put back on the list indicated by this pointer.    //    //  If this field is NULL, then this object does not belong    //  on any buffer list.  When released, instead of being enqueued    //  onto the appropriate buffer list, it will be freed.    //    PLIST_ENTRY         OwningBufferList;    //    //  The free count for buffers of this size.  This field is    //  NULL for objects that don't belong on any buffer list.    //    LPDWORD             FreeCount;    //    //  The socket that owns this buffer.    //    LPSOCK_INFO         OwningSocket;    //    //  Private flags.    //    //  BUFF_FLAG_EXPEDITED will be set if this buffer contains    //  expedited data.    //    DWORD               Flags;    //    //  The size of the valid data within this buffer object.    //    DWORD               ValidDataLength;    //    //  The total number of BYTEs allocated to this    //  buffer object.    //    DWORD               AllocatedLength;    //    //  Head & tail pointers/offsets.  Data is written to the    //  buffer @ the head, and removed @ the tail.  When the    //  tail "catches up" with the head, the buffer object    //  (and associated storage objects) should be released.    //    DWORD               TailOffset;    //    //  The local or remote address (for datagrams only).    //    PTRANSPORT_ADDRESS  DatagramAddress;    //    //  Information for TDI send/receive requests.    //    TDI_CONNECTION_INFORMATION  TdiConnectionInfo;    //    //  TDI receive event context for asynchronous copy completion.    //    EventRcvBuffer      TdiReceiveBuffer;    //    //  Pre-created NDIS_BUFFER structure.    //    NDIS_BUFFER         NdisBuffer;    //    //  The actual buffer.    //    BYTE                *Buffer;    //    // Holds DatagramAddress and the actual Buffer.    //     BYTE                Data[ANYSIZE_ARRAY];};#define VXD_BUFFER_SIZE ( sizeof(VXD_BUFFER) + gMaxTdiAddressLength - ANYSIZE_ARRAY )#ifdef DEBUG#define BUFF_SIGNATURE          (DWORD)'fFuB'#define BUFF_SIGNATURE_X        (DWORD)'fubX'#define INIT_BUFF_SIG(p)        ((p)->Signature = BUFF_SIGNATURE)#define KILL_BUFF_SIG(p)        ((p)->Signature = BUFF_SIGNATURE_X)#define IS_VALID_BUFF(p)        (((p) != NULL) && ((p)->Signature == BUFF_SIGNATURE))#else   // !DEBUG#define INIT_BUFF_SIG(p)        (void)(p)#define KILL_BUFF_SIG(p)        (void)(p)#define IS_VALID_BUFF(p)        ((void)(p), TRUE)#endif  // DEBUG////  Send & receive queues.//typedef struct _VXD_QUEUES{    //    //  Structure signature, for safety's sake.    //    DEBUG_SIGNATURE    //    //  The owning socket.  This is used to add a new    //  reference to the socket just before we issue    //  a receive request to TDI to retrieve data    //  buffered within the transport.    //    LPSOCK_INFO         OwningSocket;    //    //  Used to implement send/receive buffer quotas.    //    DWORD               SendBufferSizeQuota;    DWORD               SendBytesPending;    DWORD               ReceiveBufferSizeQuota;    DWORD               ReceiveBytesQueued;    //    //  The number of BYTEs queued for recv() in the transport.    //    DWORD               ReceiveNormalBytes;    DWORD               ReceiveNormalFlags;    DWORD               ReceiveExpeditedBytes;    DWORD               ReceiveExpeditedFlags;    //    //  The send & receive buffers queues.    //    //  All sends pending with TDI are queued onto SendPendingQueue.    //    //  All receive data is queued onto RecvGenericQueue.  All    //  normal data is queued onto RecvNormalQueue, all expedited    //  data is queue onto RecvExpeditedQueue.    //    LIST_ENTRY          SendPendingQueue;    LIST_ENTRY          RecvGenericQueue;    LIST_ENTRY          RecvNormalQueue;    LIST_ENTRY          RecvExpeditedQueue;    //    //  Additional context for receive completion.    //    //  CONNECTION-ORIENTED SOCKETS ONLY    //    LPVOID              RecvContext;};#ifdef DEBUG#define QUEU_SIGNATURE          (DWORD)'uEuQ'#define QUEU_SIGNATURE_X        (DWORD)'euqX'#define INIT_QUEU_SIG(p)        ((p)->Signature = QUEU_SIGNATURE)#define KILL_QUEU_SIG(p)        ((p)->Signature = QUEU_SIGNATURE_X)#define IS_VALID_QUEU(p)        (((p) != NULL) && ((p)->Signature == QUEU_SIGNATURE))#else   // !DEBUG#define INIT_QUEU_SIG(p)        (void)(p)#define KILL_QUEU_SIG(p)        (void)(p)#define IS_VALID_QUEU(p)        ((void)(p), TRUE)#endif  // DEBUG////  Define a socket descriptor as viewed by this provider VxD.//typedef struct _SOCK_INFO{    //    //  Structure signature, for safety's sake.    //    DEBUG_SIGNATURE    LIST_ENTRY  si_socket_list;     // list of all active sockets	LIST_ENTRY	si_notify_list;		// list of notification objects PEGNOTIY for us	DWORD		si_error;			// we put errors which crop up, here...    LINGER      si_linger;          // linger options    LPVOID      si_localaddr;       // local address for this socket    LPVOID      si_remoteaddr;      // size of the local address    DWORD       si_localaddrlen;    // remote (peer) address for this socket    DWORD       si_remoteaddrlen;   // size of the remote address    DWORD       si_family;          // address family    DWORD       si_type;            // socket type    DWORD       si_protocol;        // protocol    DWORD       si_sendbufsize;     // send buffer size    DWORD       si_recvbufsize;     // receive buffer size    DWORD       si_flags;           // internal state status    DWORD       si_options;         // setsockopt() boolean options    DWORD       si_max_connects;    // max number of connects outstanding    DWORD       si_num_connects;    // number of connects waiting to be accepted    DWORD       si_state;           // current state    DWORD       si_ready;           // events ready to notify    DWORD       si_disabled_events; // disabled [async]select events    DWORD       si_owner_pid;       // owning process id (VM handle in 16 bits)									// PEG- This has the ProcessID of the owner    DWORD       si_handle;          // this socket's handle	DWORD       si_recvtimeout;		// receive timeout (ms)	DWORD       si_sendtimeout;		// send timeout (ms)	//	// The stack associated with this socket	//	LPVXD_STACK		Stack;////  The bit mask of notification events in which the stack//  VxD is interested.//    DWORD               NotificationEvents;////  The Stack DLL's socket context.//    PVOID               StackSocketContext;    //    //  Global list of open sockets.    //    LIST_ENTRY          OpenSocketList;    //    //  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 endpoint associated with this socket.    //    LPVXD_ENDPOINT      Endpoint;

⌨️ 快捷键说明

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