xref: /reactos/sdk/include/ddk/netioddk.h (revision c2c66aff)
1 /*
2  * netioddk.h
3  *
4  * This file is part of the ReactOS DDK package.
5  *
6  * Contributors:
7  *   Amine Khaldi (amine.khaldi@reactos.org)
8  *
9  * THIS SOFTWARE IS NOT COPYRIGHTED
10  *
11  * This source code is offered for use in the public domain. You may
12  * use, modify or distribute it freely.
13  *
14  * This code is distributed in the hope that it will be useful but
15  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16  * DISCLAIMED. This includes but is not limited to warranties of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18  *
19  */
20 
21 #ifndef _NETIODDK_
22 #define _NETIODDK_
23 
24 #pragma once
25 
26 #include <netiodef.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #if (NTDDI_VERSION >= NTDDI_VISTA)
33 
34 typedef CONST struct _NPI_CLIENT_CHARACTERISTICS * PNPI_CLIENT_CHARACTERISTICS;
35 typedef CONST struct _NPI_PROVIDER_CHARACTERISTICS * PNPI_PROVIDER_CHARACTERISTICS;
36 typedef CONST struct _NPI_REGISTRATION_INSTANCE * PNPI_REGISTRATION_INSTANCE;
37 
38 typedef struct _NPI_REGISTRATION_INSTANCE {
39   USHORT Version;
40   USHORT Size;
41   PNPIID NpiId;
42   PNPI_MODULEID ModuleId;
43   ULONG Number;
44   CONST VOID *NpiSpecificCharacteristics OPTIONAL;
45 } NPI_REGISTRATION_INSTANCE;
46 
47 typedef struct _NPI {
48   HANDLE Handle;
49   CONST VOID* Dispatch;
50 } NPI;
51 
52 typedef NTSTATUS
53 (NTAPI NPI_CLIENT_ATTACH_PROVIDER_FN)(
54   _In_ HANDLE NmrBindingHandle,
55   _In_ PVOID ClientContext,
56   _In_ PNPI_REGISTRATION_INSTANCE ProviderRegistrationInstance);
57 typedef NPI_CLIENT_ATTACH_PROVIDER_FN *PNPI_CLIENT_ATTACH_PROVIDER_FN;
58 
59 typedef NTSTATUS
60 (NTAPI NPI_CLIENT_DETACH_PROVIDER_FN  )(
61   _In_ PVOID ClientBindingContext);
62 typedef NPI_CLIENT_DETACH_PROVIDER_FN *PNPI_CLIENT_DETACH_PROVIDER_FN;
63 
64 typedef VOID
65 (NTAPI NPI_CLIENT_CLEANUP_BINDING_CONTEXT_FN)(
66   _In_ PVOID ClientBindingContext);
67 typedef NPI_CLIENT_CLEANUP_BINDING_CONTEXT_FN *PNPI_CLIENT_CLEANUP_BINDING_CONTEXT_FN;
68 
69 typedef struct _NPI_CLIENT_CHARACTERISTICS {
70   USHORT Version;
71   USHORT Length;
72   PNPI_CLIENT_ATTACH_PROVIDER_FN ClientAttachProvider;
73   PNPI_CLIENT_DETACH_PROVIDER_FN ClientDetachProvider;
74   PNPI_CLIENT_CLEANUP_BINDING_CONTEXT_FN ClientCleanupBindingContext;
75   NPI_REGISTRATION_INSTANCE ClientRegistrationInstance;
76 } NPI_CLIENT_CHARACTERISTICS;
77 
78 typedef NTSTATUS
79 (NTAPI NPI_PROVIDER_ATTACH_CLIENT_FN)(
80   _In_ HANDLE NmrBindingHandle,
81   _In_ PVOID ProviderContext,
82   _In_ PNPI_REGISTRATION_INSTANCE ClientRegistrationInstance,
83   _In_ PVOID ClientBindingContext,
84   _In_ CONST VOID *ClientDispatch,
85   _Out_ PVOID *ProviderBindingContext,
86   _Out_ CONST VOID* *ProviderDispatch);
87 typedef NPI_PROVIDER_ATTACH_CLIENT_FN *PNPI_PROVIDER_ATTACH_CLIENT_FN;
88 
89 typedef NTSTATUS
90 (NTAPI NPI_PROVIDER_DETACH_CLIENT_FN)(
91   _In_ PVOID ProviderBindingContext);
92 typedef NPI_PROVIDER_DETACH_CLIENT_FN *PNPI_PROVIDER_DETACH_CLIENT_FN;
93 
94 typedef VOID
95 (NTAPI NPI_PROVIDER_CLEANUP_BINDING_CONTEXT_FN)(
96   _In_ PVOID ProviderBindingContext);
97 typedef NPI_PROVIDER_CLEANUP_BINDING_CONTEXT_FN *PNPI_PROVIDER_CLEANUP_BINDING_CONTEXT_FN;
98 
99 typedef struct _NPI_PROVIDER_CHARACTERISTICS {
100   USHORT Version;
101   USHORT Length;
102   PNPI_PROVIDER_ATTACH_CLIENT_FN ProviderAttachClient;
103   PNPI_PROVIDER_DETACH_CLIENT_FN ProviderDetachClient;
104   PNPI_PROVIDER_CLEANUP_BINDING_CONTEXT_FN ProviderCleanupBindingContext;
105   NPI_REGISTRATION_INSTANCE ProviderRegistrationInstance;
106 } NPI_PROVIDER_CHARACTERISTICS;
107 
108 NTSTATUS
109 NmrRegisterClient(
110   _In_ PNPI_CLIENT_CHARACTERISTICS ClientCharacteristics,
111   _In_opt_ __drv_aliasesMem PVOID ClientContext,
112   _Out_ PHANDLE NmrClientHandle);
113 
114 NTSTATUS
115 NmrDeregisterClient(
116   _In_ HANDLE NmrClientHandle);
117 
118 NTSTATUS
119 NmrWaitForClientDeregisterComplete(
120   _In_ HANDLE NmrClientHandle);
121 
122 NTSTATUS
123 NmrClientAttachProvider(
124   _In_ HANDLE NmrBindingHandle,
125   _In_ __drv_aliasesMem PVOID ClientBindingContext,
126   _In_ CONST VOID *ClientDispatch,
127   _Out_ PVOID *ProviderBindingContext,
128   _Out_ CONST VOID* *ProviderDispatch);
129 
130 VOID
131 NmrClientDetachProviderComplete(
132   _In_ HANDLE NmrBindingHandle);
133 
134 NTSTATUS
135 NmrRegisterProvider(
136   _In_ PNPI_PROVIDER_CHARACTERISTICS ProviderCharacteristics,
137   _In_opt_ __drv_aliasesMem PVOID ProviderContext,
138   _Out_ PHANDLE NmrProviderHandle);
139 
140 NTSTATUS
141 NmrDeregisterProvider(
142   _In_ HANDLE NmrProviderHandle);
143 
144 NTSTATUS
145 NmrWaitForProviderDeregisterComplete(
146   _In_ HANDLE NmrProviderHandle);
147 
148 VOID
149 NmrProviderDetachClientComplete(
150   _In_ HANDLE NmrBindingHandle);
151 
152 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 #endif /* _NETIODDK_ */
159