xref: /reactos/drivers/network/ndis/include/buffer.h (revision c424146e)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS NDIS library
4  * FILE:        include/buffer.h
5  * PURPOSE:     Buffer management routine definitions
6  */
7 
8 #pragma once
9 
10 #include "ndissys.h"
11 
12 
13 /* FIXME: Possibly move this to ntddk.h */
14 typedef struct _NETWORK_HEADER
15 {
16     MDL Mdl;                                /* Memory Descriptor List */
17     struct _NETWORK_HEADER *Next;           /* Link to next NDIS buffer in pool */
18     struct _NDIS_BUFFER_POOL *BufferPool;   /* Link to NDIS buffer pool */
19 } NETWORK_HEADER, *PNETWORK_HEADER;
20 
21 typedef struct _NDIS_BUFFER_POOL
22 {
23     KSPIN_LOCK SpinLock;
24     PNETWORK_HEADER FreeList;
25     NETWORK_HEADER Buffers[0];
26 } NDIS_BUFFER_POOL, *PNDIS_BUFFER_POOL;
27 
28 typedef struct _NDISI_PACKET_POOL {
29   NDIS_SPIN_LOCK  SpinLock;
30   struct _NDIS_PACKET *FreeList;
31   UINT  PacketLength;
32   UCHAR  Buffer[1];
33 } NDISI_PACKET_POOL, * PNDISI_PACKET_POOL;
34 
35 UINT CopyBufferToBufferChain(
36     PNDIS_BUFFER DstBuffer,
37     UINT DstOffset,
38     PUCHAR SrcData,
39     UINT Length);
40 
41 UINT CopyBufferChainToBuffer(
42     PUCHAR DstData,
43     PNDIS_BUFFER SrcBuffer,
44     UINT SrcOffset,
45     UINT Length);
46 
47 UINT CopyPacketToBuffer(
48     PUCHAR DstData,
49     PNDIS_PACKET SrcPacket,
50     UINT SrcOffset,
51     UINT Length);
52 
53 UINT CopyPacketToBufferChain(
54     PNDIS_BUFFER DstBuffer,
55     UINT DstOffset,
56     PNDIS_PACKET SrcPacket,
57     UINT SrcOffset,
58     UINT Length);
59 
60 /* EOF */
61