23#ifndef _X_FILTER_DEFS_
24#define _X_FILTER_DEFS_
30#define ETH_LENGTH_OF_ADDRESS 6
32#define ETH_IS_BROADCAST(Address) \
33 ((((PUCHAR)(Address))[0] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[1] == ((UCHAR)0xff)) && \
34 (((PUCHAR)(Address))[2] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[3] == ((UCHAR)0xff)) && \
35 (((PUCHAR)(Address))[4] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[5] == ((UCHAR)0xff)))
37#define ETH_IS_MULTICAST(Address) \
38 (BOOLEAN)(((PUCHAR)(Address))[0] & ((UCHAR)0x01))
40#define ETH_COMPARE_NETWORK_ADDRESSES(_A, _B, _Result) \
42 if (*(ULONG UNALIGNED *)&(_A)[2] > *(ULONG UNALIGNED *)&(_B)[2]) \
46 else if (*(ULONG UNALIGNED *)&(_A)[2] < *(ULONG UNALIGNED *)&(_B)[2]) \
48 *(_Result) = (UINT)-1; \
50 else if (*(USHORT UNALIGNED *)(_A) > *(USHORT UNALIGNED *)(_B)) \
54 else if (*(USHORT UNALIGNED *)(_A) < *(USHORT UNALIGNED *)(_B)) \
56 *(_Result) = (UINT)-1; \
64#define ETH_COMPARE_NETWORK_ADDRESSES_EQ(_A,_B, _Result) \
66 if ((*(ULONG UNALIGNED *)&(_A)[2] == *(ULONG UNALIGNED *)&(_B)[2]) && \
67 (*(USHORT UNALIGNED *)(_A) == *(USHORT UNALIGNED *)(_B))) \
77#define ETH_COPY_NETWORK_ADDRESS(_D, _S) \
79 *((ULONG UNALIGNED *)(_D)) = *((ULONG UNALIGNED *)(_S)); \
80 *((USHORT UNALIGNED *)((UCHAR *)(_D) + 4)) = *((USHORT UNALIGNED *)((UCHAR *)(_S) + 4)); \
83#define FDDI_LENGTH_OF_LONG_ADDRESS 6
84#define FDDI_LENGTH_OF_SHORT_ADDRESS 2
86#define FDDI_IS_BROADCAST(Address, AddressLength, Result) \
87 *Result = ((*(PUCHAR)(Address) == (UCHAR)0xFF) && \
88 (*((PUCHAR)(Address) + 1) == (UCHAR)0xFF))
90#define FDDI_IS_MULTICAST(Address, AddressLength, Result) \
91 *Result = (BOOLEAN)(*(UCHAR *)(Address) & (UCHAR)0x01)
93#define FDDI_IS_SMT(FcByte, Result) \
95 *Result = ((FcByte & ((UCHAR)0xf0)) == 0x40); \
99#define FDDI_COMPARE_NETWORK_ADDRESSES(_A, _B, _Length, _Result) \
101 if (*(USHORT UNALIGNED *)(_A) > *(USHORT UNALIGNED *)(_B)) \
105 else if (*(USHORT UNALIGNED *)(_A) < *(USHORT UNALIGNED *)(_B)) \
107 *(_Result) = (UINT)-1; \
109 else if (_Length == 2) \
113 else if (*(ULONG UNALIGNED *)((PUCHAR)(_A) + 2) > *(ULONG UNALIGNED *)((PUCHAR)(_B) + 2)) \
117 else if (*(ULONG UNALIGNED *)((PUCHAR)(_A) + 2) < *(ULONG UNALIGNED *)((PUCHAR)(_B) + 2)) \
119 *(_Result) = (UINT)-1; \
127#define FDDI_COMPARE_NETWORK_ADDRESSES_EQ(_A, _B, _Length, _Result) \
129 if ((*(USHORT UNALIGNED *)(_A) == *(USHORT UNALIGNED *)(_B)) && \
130 (((_Length) == 2) || \
131 (*(ULONG UNALIGNED *)((PUCHAR)(_A) + 2) == *(ULONG UNALIGNED *)((PUCHAR)(_B) + 2)))) \
141#define FDDI_COPY_NETWORK_ADDRESS(D, S, AddressLength) \
145 UINT _C = (AddressLength); \
146 for ( ; _C > 0 ; _D++, _S++, _C--) \
152#define TR_LENGTH_OF_FUNCTIONAL 4
153#define TR_LENGTH_OF_ADDRESS 6
158#define TR_IS_NOT_DIRECTED(_Address, _Result) \
160 *(_Result) = (BOOLEAN)((_Address)[0] & 0x80); \
163#define TR_IS_FUNCTIONAL(_Address, _Result) \
165 *(_Result) = (BOOLEAN)(((_Address)[0] & 0x80) && !((_Address)[2] & 0x80)); \
168#define TR_IS_GROUP(_Address, _Result) \
170 *(_Result) = (BOOLEAN)((_Address)[0] & (_Address)[2] & 0x80); \
173#define TR_IS_SOURCE_ROUTING(_Address, _Result) \
175 *(_Result) = (BOOLEAN)((_Address)[0] & 0x80); \
178#define TR_IS_MAC_FRAME(_PacketHeader) ((((PUCHAR)_PacketHeader)[1] & 0xFC) == 0)
180#define TR_IS_BROADCAST(_Address, _Result) \
182 *(_Result) = (BOOLEAN)(((*(UNALIGNED USHORT *)&(_Address)[0] == 0xFFFF) || \
183 (*(UNALIGNED USHORT *)&(_Address)[0] == 0x00C0)) && \
184 (*(UNALIGNED ULONG *)&(_Address)[2] == 0xFFFFFFFF)); \
187#define TR_COMPARE_NETWORK_ADDRESSES(_A, _B, _Result) \
189 if (*(ULONG UNALIGNED *)&(_A)[2] > *(ULONG UNALIGNED *)&(_B)[2]) \
193 else if (*(ULONG UNALIGNED *)&(_A)[2] < *(ULONG UNALIGNED *)&(_B)[2]) \
195 *(_Result) = (UINT)-1; \
197 else if (*(USHORT UNALIGNED *)(_A) > *(USHORT UNALIGNED *)(_B)) \
201 else if (*(USHORT UNALIGNED *)(_A) < *(USHORT UNALIGNED *)(_B)) \
203 *(_Result) = (UINT)-1; \
211#define TR_COPY_NETWORK_ADDRESS(_D, _S) \
213 *((ULONG UNALIGNED *)(_D)) = *((ULONG UNALIGNED *)(_S)); \
214 *((USHORT UNALIGNED *)((UCHAR *)(_D)+4)) = *((USHORT UNALIGNED *)((UCHAR *)(_S) + 4)); \
217#define TR_COMPARE_NETWORK_ADDRESSES_EQ(_A, _B, _Result) \
219 if ((*(ULONG UNALIGNED *)&(_A)[2] == *(ULONG UNALIGNED *)&(_B)[2]) && \
220 (*(USHORT UNALIGNED *)&(_A)[0] == *(USHORT UNALIGNED *)&(_B)[0])) \
ULONG TR_FUNCTIONAL_ADDRESS