Copy rpoolmgr.h from trunk
[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 #include "miniport.h"
31 #include "protocol.h"
32
33 #include <debug.h>
34
35 /* Exported functions */
36 #ifdef _MSC_VER
37 #define EXPORT __declspec(dllexport)
38 #else
39 #define EXPORT STDCALL
40 #endif
41
42 #define NDIS_TAG 0x4e4d4953
43
44 #ifdef DBG
45
46 #define DEBUG_REFCHECK(Object) { \
47 if ((Object)->RefCount <= 0) { \
48 NDIS_DbgPrint(MIN_TRACE, ("Object at (0x%X) has invalid reference count (%d).\n", \
49 (Object), (Object)->RefCount)); \
50 } \
51 }
52
53 #else
54
55 #define DEBUG_REFCHECK(Object)
56
57 #endif
58
59
60 /*
61 * VOID ReferenceObject(
62 * PVOID Object)
63 */
64 #define ReferenceObject(Object) \
65 { \
66 DEBUG_REFCHECK(Object); \
67 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Referencing object at (0x%X). RefCount (%d).\n", \
68 (Object), (Object)->RefCount)); \
69 \
70 InterlockedIncrement((PLONG)&((Object)->RefCount)); \
71 }
72
73 /*
74 * VOID DereferenceObject(
75 * PVOID Object)
76 */
77 #define DereferenceObject(Object) \
78 { \
79 DEBUG_REFCHECK(Object); \
80 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Dereferencing object at (0x%X). RefCount (%d).\n", \
81 (Object), (Object)->RefCount)); \
82 \
83 if (InterlockedDecrement((PLONG)&((Object)->RefCount)) == 0) \
84 PoolFreeBuffer(Object); \
85 }
86
87
88 #define MIN(value1, value2) \
89 ((value1 < value2)? value1 : value2)
90
91 #define MAX(value1, value2) \
92 ((value1 > value2)? value1 : value2)
93
94 #endif /* __NDISSYS_H */
95
96 /* EOF */