?? tdiclient.h
字號:
TDIClnEventReceive(PVOID, CONNECTION_CONTEXT, ULONG, ULONG, ULONG, PULONG, PVOID, PIRP *);
NTSTATUS
TDIClnIoCompRtnRecv(PDEVICE_OBJECT, PIRP, PVOID);
NTSTATUS
TDIClnIoCompRtnRecvDGram(PDEVICE_OBJECT, PIRP, PVOID);
NTSTATUS
TDIClnIoCompRtnAcc(PDEVICE_OBJECT, PIRP, PVOID);
NTSTATUS
HTTPFetch(IN pTDIClientExtension, IN pTDIClientTestStr, IN OUT PULONG);
NTSTATUS
NSLookup(IN pTDIClientExtension, IN pTDIClientTestStr, IN OUT PULONG);
NTSTATUS
GetNSInfo(pTDIClientExtension);
#endif // End #ifdef JADriverKernelMode.
#define FILE_DEVICE_TDIClient 0x00008A00
#define TDIClient_TEST (ULONG) CTL_CODE(FILE_DEVICE_TDIClient, \
0x01, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS \
)
#define TDIClient_TEST2 (ULONG) CTL_CODE(FILE_DEVICE_TDIClient, \
0x02, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS \
)
#define TDIClient_TEST3 (ULONG) CTL_CODE(FILE_DEVICE_TDIClient, \
0x03, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS \
)
typedef enum
{
TDIClientUnknown,
TDIClientClient,
TDIClientServer,
TDIClientURL,
TDIClientDNS
}
TDIClientOperType;
#define DNSTimeoutValue 5 // 5 seconds.
#define charDfltRmtAddr "192.168.1.5"
#define charDfltServerAddr "192.168.1.2"
#define charDfltPort "5004"
#define NSLookupQueryId 0x4a41
#define GetNetwkAddr(a, b, c, d) /* Get address in network form; eg, GetNetwkAddr(192, 168, 1, 5) => 0x0501a8c0. */ \
(a + (b<<8) + (c<<16) + (d<<24))
#define GetNetwkAddrDw(a) /* Get address of a doubleword (4 bytes) in network form; */ \
/* eg, GetNetwkAddrDw(-xc0a80105) => 0x0501a8c0. */ \
(((a&0xFF)<<24) + ((a&0xFF00)<<8) + ((a&0xFF0000)>>8) + ((a&0xFF000000)>>24))
#define GetNetwkPort(a) /* Get port in network form; eg, GetNetwkPort(5004) => 0x8c13. */ \
(((0xFF&a)<<8) + ((0xFF00&a)>>8))
#define TDIClientPort 5004
#define TDIClientRecvBfrLen 1024
#define TDIClnUDPBfrMaxLen 512 /* Per RFC 1035, page 32. */
#define TDIClnLabelMaxLen 63 /* Label is a one-byte length field followed by that number of bytes. */
/* 63 is per RFC 1035, page 8. */
#define TDIClnHostAddr 1 /* Host address. 1 (called "A") is per RFC 1035, page 12. */
#define TDIClnCanonicalName 5 /* Canonical name for an alias. 5 (called "CNAME") is per RFC 1035, page 12. */
#define TDIClnDomainNameMaxLen 255 /* 255 is per RFC 1035, page 8. */
#define TDIClnDNSInternetClass 1 /* 1 (called "Internet") is per RFC 1035, page 13. */
typedef unsigned long ULONG;
typedef unsigned short USHORT;
typedef struct _TDIClientTestStr
{
ULONG rc; // Return code.
ULONG ulBuffer; // Number of bytes returned in Buffer below (fields before Buffer not counted).
ULONG ulKernelSent; // Total number of bytes kernel routine sent.
ULONG ulKernelReceived; // Total number of bytes kernel routine received.
TDIClientOperType InOperType; // Operation.
char InDestAddr[256]; // IP address or IP name, depending on operation.
char InDestPort[8];
char InDNServerIPAddr[16];
char InURIResource[64];
char Buffer[1];
}
TDIClientTestStr, * pTDIClientTestStr;
typedef struct _myDNSQuery
{
USHORT QueryId;
union
{
USHORT QueryFields;
struct
{
// Note: These bit fields are reversed from the big-endian mapping of RFC 1035 but will yield, via the MS x86 compiler,
// the desired big-endian mapping.
USHORT RecursDesired : 1; // 1 ==> recursion desired.
USHORT Truncd : 1; // 1 ==> message truncated. Meaningful only in responses.
USHORT AuthAnsw : 1; // 1 ==> authoritative answer. Meaningful only in responses.
USHORT OpcodeFd : 4; // 0 ==> standard query.
USHORT QryReqFd : 1; // 0 ==> query; 1 ==> response.
USHORT RespCode : 4; // Response code: 0 ==> success;
// 1 ==> format error;
// 2 ==> server error;
// 3 ==> name error;
// 4 ==> not implemented;
// 5 ==> refused.
USHORT ZReserved : 3; // Reserved.
USHORT RecursAvail : 1; // 1 ==> recursion available in server.
};
};
USHORT QuestionCnt; // Number of entries in question section.
USHORT AnswerCount; // Number of resource records (RRs) in answer section.
USHORT NSRRCount; // Number of name-server RRs in authority-records section.
USHORT AddRRCount; // Number of RRs in addition records section.
char QuestionSec[1]; // Beginning of question section.
}
MyDNSQuery, * pMyDNSQuery;
// Map codes in RespCode above.
#define TDIClnRespCodeOK 0
#define TDIClnRespCodeFmtErr 1
#define TDIClnRespCodeSvrErr 2
#define TDIClnRespCodeNameErr 3
#define TDIClnRespCodeNotImplErr 4
#define TDIClnRespCodeRefusedErr 5
typedef struct _MyDNSRR // Map resource record (RR) AFTER name field, which may be a name
{ // or an offset to a name.
USHORT RRType; // RR type code.
USHORT RRClass; // Class of data in RRData.
ULONG RRTTL; // Time to live, in seconds.
USHORT RRDataLn; // Size of RRData.
char RRData[1]; // Response record data. Interpretation depends on RRType and RRClass.
}
MyDNSRR, * pMyDNSRR;
#define TDIClnCanonRRLen (2 + /* Length relative pointer */ \
FIELD_OFFSET(MyDNSRR, RRData) + /* Length of fixed RR fields */ \
2) /* Length of relative pointer */
#define TDIClnAddrRRLen (2 + /* Length relative pointer */ \
FIELD_OFFSET(MyDNSRR, RRData) + /* Length of fixed RR fields */ \
4) /* Length of IP address. */
//***************************************************************************//
// //
// User-space routine prototypes. //
// //
//***************************************************************************//
void
ShowNSData(pMyDNSQuery);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -