Turned on -Werror
[reactos.git] / reactos / drivers / net / ndis / include / ndissys.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
4 * FILE: ndissys.h
5 * PURPOSE: NDIS library definitions
6 * NOTES: Spin lock acquire order:
7 * - Miniport list lock
8 * - Adapter list lock
9 */
10 #ifndef __NDISSYS_H
11 #define __NDISSYS_H
12
13 #define NDIS50 1 /* Use NDIS 5.0 structures by default */
14
15 #ifdef _MSC_VER
16 #include <basetsd.h>
17 #include <ntddk.h>
18 #include <windef.h>
19 #include <ndis.h>
20 #else /* _MSC_VER */
21 #include <ddk/ntddk.h>
22 #include <ddk/ndis.h>
23 #include <ddk/xfilter.h>
24 #include <ddk/afilter.h>
25 typedef struct _ATM_ADDRESS *PATM_ADDRESS;
26 /* FIXME: Get rid of this dependance. */
27 #include <ddk/ntapi.h>
28 #endif /* _MSC_VER */
29
30 struct _ADAPTER_BINDING;
31
32 typedef struct _INTERNAL_NDIS_MINIPORT_WORK_ITEM {
33 SINGLE_LIST_ENTRY Link;
34 struct _ADAPTER_BINDING *AdapterBinding;
35 NDIS_MINIPORT_WORK_ITEM RealWorkItem;
36 } INTERNAL_NDIS_MINIPORT_WORK_ITEM, *PINTERNAL_NDIS_MINIPORT_WORK_ITEM;
37
38 #include "miniport.h"
39 #include "protocol.h"
40
41 #include <debug.h>
42
43 /* Exported functions */
44 #ifdef _MSC_VER
45 #define EXPORT __declspec(dllexport)
46 #else
47 #define EXPORT STDCALL
48 #endif
49
50 #define NDIS_TAG 0x4e4d4953
51
52 #ifdef DBG
53
54 #define DEBUG_REFCHECK(Object) { \
55 if ((Object)->RefCount <= 0) { \
56 NDIS_DbgPrint(MIN_TRACE, ("Object at (0x%X) has invalid reference count (%d).\n", \
57 (Object), (Object)->RefCount)); \
58 } \
59 }
60
61 #else
62
63 #define DEBUG_REFCHECK(Object)
64
65 #endif
66
67
68 /*
69 * VOID ReferenceObject(
70 * PVOID Object)
71 */
72 #define ReferenceObject(Object) \
73 { \
74 DEBUG_REFCHECK(Object); \
75 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Referencing object at (0x%X). RefCount (%d).\n", \
76 (Object), (Object)->RefCount)); \
77 \
78 InterlockedIncrement((PLONG)&((Object)->RefCount)); \
79 }
80
81 /*
82 * VOID DereferenceObject(
83 * PVOID Object)
84 */
85 #define DereferenceObject(Object) \
86 { \
87 DEBUG_REFCHECK(Object); \
88 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Dereferencing object at (0x%X). RefCount (%d).\n", \
89 (Object), (Object)->RefCount)); \
90 \
91 if (InterlockedDecrement((PLONG)&((Object)->RefCount)) == 0) \
92 PoolFreeBuffer(Object); \
93 }
94
95
96 #define MIN(value1, value2) \
97 ((value1 < value2)? value1 : value2)
98
99 #define MAX(value1, value2) \
100 ((value1 > value2)? value1 : value2)
101
102 #endif /* __NDISSYS_H */
103
104 /* EOF */