2008-08-29 Andy Grover <andy.grover@oracle.com>
+ * include/ddk/ndis.h (NDIS_MINIPORT_MAJOR_VERSION, NDIS_MINIPORT_MINOR_VERSION,
+ struct NDIS_TASK_OFFLOAD_HEADER, PROTOCOL_RESERVED_SIZE_IN_PACKET,
+ NdisGetFirstBufferFromPacketSafe, NdisMIndicateReceivePacket,
+ NdisSetPacketPoolProtocolId, NdisMInitializeTimer, NdisMSetPeriodicTimer,
+ NdisMCancelTimer): Define.
+ (enum NDIS_ENCAPSULATION, struct NDIS_ENCAPSULATION_FORMAT): move in file.
+ (struct _NDIS_PACKET): Define using _ANONYMOUS_UNION and ANONYMOUS_STRUCT to
+ eliminate warnings.
+ (NdisReinitializePacket): Rename from NdisReinitializePacketCounts.
+ * lib/ddk/ndis.def (NdisInitAnsiString, NdisInitUnicodeString, NdisMCancelTimer,
+ NdisMInitializeTimer, NdisMSetPeriodicTimer, NdisSetPacketPoolProtocolId):
+ Export.
+
+2008-08-29 Andy Grover <andy.grover@oracle.com>
+
* include/ddk/winddk.h (RtlStringCbCopyA, RtlStringCbPrintfA,
RtlStringCbVPrintfA): define in terms of POSIX string functions.
#if defined(NDIS50_MINIPORT)
#ifndef NDIS50
#define NDIS50
+#define NDIS_MINIPORT_MAJOR_VERSION 5
+#define NDIS_MINIPORT_MINOR_VERSION 0
#endif
#endif /* NDIS50_MINIPORT */
#if defined(NDIS51_MINIPORT)
#ifndef NDIS51
#define NDIS51
+#define NDIS_MINIPORT_MAJOR_VERSION 5
+#define NDIS_MINIPORT_MINOR_VERSION 1
#endif
#endif /* NDIS51_MINIPORT */
typedef struct _NDIS_PACKET {
NDIS_PACKET_PRIVATE Private;
- union {
- struct {
+ _ANONYMOUS_UNION union {
+ _ANONYMOUS_STRUCT struct {
UCHAR MiniportReserved[2 * sizeof(PVOID)];
UCHAR WrapperReserved[2 * sizeof(PVOID)];
- } s1;
- struct {
+ } DUMMYSTRUCTNAME;
+ _ANONYMOUS_STRUCT struct {
UCHAR MiniportReservedEx[3 * sizeof(PVOID)];
UCHAR WrapperReservedEx[sizeof(PVOID)];
- } s2;
- struct {
+ } DUMMYSTRUCTNAME;
+ _ANONYMOUS_STRUCT struct {
UCHAR MacReserved[4 * sizeof(PVOID)];
- } s3;
- } u;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
ULONG_PTR Reserved[2];
UCHAR ProtocolReserved[1];
} NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;
} V4ESP;
} NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC;
-typedef struct _NDIS_TASK_OFFLOAD {
- ULONG Version;
- ULONG Size;
- NDIS_TASK Task;
- ULONG OffsetNextTask;
- ULONG TaskBufferLength;
- UCHAR TaskBuffer[1];
-} NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
-
-/* NDIS_TASK_OFFLOAD_HEADER.Version constants */
-#define NDIS_TASK_OFFLOAD_VERSION 1
-
typedef enum _NDIS_ENCAPSULATION {
UNSPECIFIED_Encapsulation,
NULL_Encapsulation,
ULONG EncapsulationHeaderSize;
} NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
+typedef struct _NDIS_TASK_OFFLOAD_HEADER
+{
+ ULONG Version;
+ ULONG Size;
+ ULONG Reserved;
+ UCHAR OffsetFirstTask;
+ NDIS_ENCAPSULATION_FORMAT EncapsulationFormat;
+} NDIS_TASK_OFFLOAD_HEADER, *PNDIS_TASK_OFFLOAD_HEADER;
+
+typedef struct _NDIS_TASK_OFFLOAD {
+ ULONG Version;
+ ULONG Size;
+ NDIS_TASK Task;
+ ULONG OffsetNextTask;
+ ULONG TaskBufferLength;
+ UCHAR TaskBuffer[1];
+} NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
+
+/* NDIS_TASK_OFFLOAD_HEADER.Version constants */
+#define NDIS_TASK_OFFLOAD_VERSION 1
+
typedef struct _NDIS_TASK_TCP_IP_CHECKSUM {
struct {
ULONG IpOptionsSupported:1;
/*IN*/ UINT NumberOfDescriptors,
/*IN*/ UINT ProtocolReservedLength);
+#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
+
NDISAPI
VOID
DDKAPI
/*
* VOID
+ * NdisGetFirstBufferFromPacketSafe(
+ * IN PNDIS_PACKET _Packet,
+ * OUT PNDIS_BUFFER * _FirstBuffer,
+ * OUT PVOID * _FirstBufferVA,
+ * OUT PUINT _FirstBufferLength,
+ * OUT PUINT _TotalBufferLength),
+ * IN MM_PAGE_PRIORITY _Priority)
+ */
+#define NdisGetFirstBufferFromPacketSafe(_Packet, \
+ _FirstBuffer, \
+ _FirstBufferVA, \
+ _FirstBufferLength, \
+ _TotalBufferLength, \
+ _Priority) \
+{ \
+ PNDIS_BUFFER _Buffer; \
+ \
+ _Buffer = (_Packet)->Private.Head; \
+ *(_FirstBuffer) = _Buffer; \
+ if (_Buffer != NULL) \
+ { \
+ *(_FirstBufferVA) = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \
+ *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer); \
+ _Buffer = _Buffer->Next; \
+ *(_TotalBufferLength) = *(_FirstBufferLength); \
+ while (_Buffer != NULL) { \
+ *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer); \
+ _Buffer = _Buffer->Next; \
+ } \
+ } \
+ else \
+ { \
+ *(_FirstBufferVA) = 0; \
+ *(_FirstBufferLength) = 0; \
+ *(_TotalBufferLength) = 0; \
+ } \
+}
+
+/*
+ * VOID
* NdisQueryBuffer(
* IN PNDIS_BUFFER Buffer,
* OUT PVOID *VirtualAddress OPTIONAL,
* NdisReinitializePacket(
* IN OUT PNDIS_PACKET Packet);
*/
-#define NdisReinitializePacketCounts(Packet) \
+#define NdisReinitializePacket(Packet) \
{ \
(Packet)->Private.Head = (PNDIS_BUFFER)NULL; \
(Packet)->Private.ValidCounts = FALSE; \
/*IN*/ PUCHAR PacketBuffer,
/*IN*/ UINT PacketSize);
+#define NdisMIndicateReceivePacket(_handle, _packets, _number) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(_handle))->PacketIndicateHandler)(_handle, _packets, _number); \
+}
+
NDISAPI
VOID
DDKAPI
NdisPacketPoolUsage(
/*IN*/ NDIS_HANDLE PoolHandle);
+NTOSAPI
+VOID
+DDKAPI
+NdisSetPacketPoolProtocolId(
+ /*IN*/ NDIS_HANDLE PacketPoolHandle,
+ /*IN*/ UINT ProtocolId);
+
NDISAPI
NDIS_STATUS
DDKAPI
/* Routines for NDIS miniport drivers */
+NTOSAPI
+VOID
+DDKAPI
+NdisMInitializeTimer(
+ /*IN*/ /*OUT*/ PNDIS_MINIPORT_TIMER Timer,
+ /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
+ /*IN*/ PNDIS_TIMER_FUNCTION TimerFunction,
+ /*IN*/ PVOID FunctionContext);
+
+NTOSAPI
+VOID
+DDKAPI
+NdisMSetPeriodicTimer(
+ /*IN*/ PNDIS_MINIPORT_TIMER Timer,
+ /*IN*/ UINT MillisecondsPeriod);
+
+NTOSAPI
+VOID
+DDKAPI
+NdisMCancelTimer(
+ /*IN*/ PNDIS_MINIPORT_TIMER Timer,
+ /*OUT*/ PBOOLEAN TimerCancelled);
+
NDISAPI
VOID
DDKAPI