server: Avoid a mach port leak on Apple Silicon.
[wine.git] / include / netiodef.h
blob658dd235db007a490496921eefe5123a2299301e
1 /*
2 * Copyright 2021 Huw Davies
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_NETIODEF_H
20 #define __WINE_NETIODEF_H
22 typedef enum _NPI_MODULEID_TYPE
24 MIT_GUID = 1,
25 MIT_IF_LUID
26 } NPI_MODULEID_TYPE;
28 typedef struct _NPI_MODULEID
30 USHORT Length;
31 NPI_MODULEID_TYPE Type;
32 union
34 GUID Guid;
35 LUID IfLuid;
37 } NPI_MODULEID;
39 typedef const NPI_MODULEID *PNPI_MODULEID;
41 static inline BOOLEAN NmrIsEqualNpiModuleId( const NPI_MODULEID *mod1, const NPI_MODULEID *mod2 )
43 if (mod1->Type == mod2->Type)
45 if (mod1->Type == MIT_GUID)
47 #ifdef __cplusplus
48 return IsEqualGUID( mod1->Guid, mod2->Guid );
49 #else
50 return IsEqualGUID( &mod1->Guid, &mod2->Guid );
51 #endif
53 else if (mod1->Type == MIT_IF_LUID)
54 return mod1->IfLuid.HighPart == mod2->IfLuid.HighPart &&
55 mod1->IfLuid.LowPart == mod2->IfLuid.LowPart;
57 return FALSE;
60 #ifdef __WINE_INIT_NPI_MODULEID
61 #ifdef __cplusplus
62 #define DEFINE_NPI_GUID_MODULEID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
63 EXTERN_C const NPI_MODULEID name DECLSPEC_HIDDEN; \
64 EXTERN_C const NPI_MODULEID name = \
65 { sizeof(NPI_MODULEID), MIT_GUID, { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } } }
66 #else
67 #define DEFINE_NPI_GUID_MODULEID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
68 const NPI_MODULEID name DECLSPEC_HIDDEN; \
69 const NPI_MODULEID name = \
70 { sizeof(NPI_MODULEID), MIT_GUID, { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } } }
71 #endif
72 #else /* __WINE_INIT_MODULEID */
73 #define DEFINE_NPI_GUID_MODULEID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
74 EXTERN_C const NPI_MODULEID name DECLSPEC_HIDDEN
75 #endif /* __WINE_INIT_MODULEID */
77 #define DEFINE_NPI_MS_MODULEID(name, n) DEFINE_NPI_GUID_MODULEID(name, 0xeb004a00 + (n), 0x9b1a, 0x11d4, \
78 0x91, 0x23, 0x00, 0x50, 0x04, 0x77, 0x59, 0xbc)
80 DEFINE_NPI_MS_MODULEID( NPI_MS_IPV4_MODULEID, 0x00 );
81 DEFINE_NPI_MS_MODULEID( NPI_MS_IPV6_MODULEID, 0x01 );
82 DEFINE_NPI_MS_MODULEID( NPI_MS_UDP_MODULEID, 0x02 );
83 DEFINE_NPI_MS_MODULEID( NPI_MS_TCP_MODULEID, 0x03 );
84 DEFINE_NPI_MS_MODULEID( NPI_MS_NDIS_MODULEID, 0x11 );
86 #undef DEFINE_NPI_MS_MODULEID
87 #undef DEFINE_NPI_GUID_MODULEID
89 #endif /* __WINE_NETIODEF_H */