TDIClient.h
资源名称:虚拟串口驱动程序.rar [点击查看]
上传用户:zanmei2
上传日期:2010-03-06
资源大小:775k
文件大小:3k
源码类别:
通讯编程文档
开发平台:
C/C++
- #ifndef __TDICLIENT_H_
- #define __TDICLIENT_H_
- #include <ntddk.h>
- #include <initguid.h>
- #include "tdi.h"
- #include "tdikrnl.h"
- #include "main.h"
- #define wcharNetDevName L"\Device\Udp"
- // Network Byte Order 0x1771 (6001) -> 0x7717
- #define LOCAL_PORT 0x7117
- // Remote peer port 6002
- #define REMOTE_PORT 0x7217
- // Remote peer address 192.168.1.1
- #define REMOTE_ADDRESS 0x101a8c0
- NTSTATUS
- TDIOpenTransportAddress(
- PWSTR pTransDevName, // Transport device name.
- PHANDLE pHandle, // Output handle address.
- PFILE_OBJECT * ppAddrFileObj, // Output address file object.
- USHORT Port // Port to open.
- );
- NTSTATUS
- TDIClnSetEventHandler(
- PFILE_OBJECT pAddrFileObj, // Address file object.
- PDEVICE_OBJECT pTcpDevObj, // TDI driver's device object.
- LONG EventType, // Type of event.
- PVOID pEventHandler, // Event handler routine.
- PVOID pEventContext // Context for event handler.
- );
- NTSTATUS TDIEventRecvDatagram(
- IN PVOID TdiEventContext,
- IN LONG SourceAddressLength,
- IN PVOID SourceAddress,
- IN LONG OptionsLength,
- IN PVOID Options,
- IN ULONG ReceiveDatagramFlags,
- IN ULONG BytesIndicated,
- IN ULONG BytesAvailable,
- OUT ULONG *BytesTaken,
- IN PVOID Tsdu,
- OUT PIRP *IoRequestPacket
- );
- NTSTATUS TDIEventError(
- IN PVOID TdiEventContext, // The endpoint's file object.
- IN NTSTATUS Status // Status code indicating error type.
- );
- NTSTATUS TDIEventChainedReceiveDatagram(
- IN PVOID TdiEventContext,
- IN LONG SourceAddressLength,
- IN PVOID SourceAddress,
- IN LONG OptionsLength,
- IN PVOID Options,
- IN ULONG ReceiveDatagramFlags,
- IN ULONG ReceiveDatagramLength,
- IN ULONG StartingOffset,
- IN PMDL Tsdu,
- IN PVOID TsduDescriptor
- );
- PIRP TDIBuildRecvRemainderIrp( PDEVICE_EXTENSION deviceExtension );
- NTSTATUS
- TDIRecvRemainderCompRoutine(
- PDEVICE_OBJECT DeviceObject, // TDI driver's device object.
- PIRP pIrp, // Address of completed Irp.
- PVOID pCtx // Pointer to context.
- );
- NTSTATUS TDIBuildRecvContext( PRECV_CONTEXT lpContext);
- NTSTATUS TDIFreeRecvContext( PRECV_CONTEXT lpContext );
- VOID CopyToRingBuffer(
- PDEVICE_EXTENSION deviceExtension,
- PUCHAR LinearBuffer,
- ULONG BytesIndicated );
- VOID TDIBuildSendDatagramInfo( PTA_ADDRESS lpAddress );
- #endif