ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Windows/b2ether/nt5/b2ether.h
Revision: 1.1
Committed: 2012-04-22T03:13:32Z (12 years, 7 months ago) by asvitkine
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
Import nt5 version of the ethernet driver from 2001 sources.

File Contents

# Content
1 /*
2 * b2ether driver -- derived from DDK packet driver sample
3 *
4 * Basilisk II (C) 1997-1999 Christian Bauer
5 *
6 * Windows platform specific code copyright (C) Lauri Pesonen
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 #ifndef _B2ETHER_H_
24 #define _B2ETHER_H_
25
26 #undef ExAllocatePool
27 #define ExAllocatePool(a,b) ExAllocatePoolWithTag(a, b, 'te2B')
28
29 #if DBG
30 #define DebugPrint(_x_) \
31 DbgPrint("B2ETHER: ");\
32 DbgPrint _x_;
33 #else
34 #define DebugPrint(_x_)
35 #endif
36
37 #define NT_DEVICE_NAME L"\\Device\\B2ether"
38 #define DOS_DEVICE_NAME L"\\DosDevices\\B2ether"
39
40 typedef struct _GLOBAL {
41 PDRIVER_OBJECT DriverObject;
42 NDIS_HANDLE NdisProtocolHandle;
43 UNICODE_STRING RegistryPath;
44 LIST_ENTRY AdapterList;
45 KSPIN_LOCK GlobalLock;
46 PDEVICE_OBJECT ControlDeviceObject;
47 } GLOBAL, *PGLOBAL;
48
49 GLOBAL Globals;
50
51 typedef struct _INTERNAL_REQUEST {
52 PIRP Irp;
53 NDIS_REQUEST Request;
54 } INTERNAL_REQUEST, *PINTERNAL_REQUEST;
55
56 typedef struct _OPEN_INSTANCE {
57 PDEVICE_OBJECT DeviceObject;
58 ULONG IrpCount;
59 NDIS_STRING AdapterName;
60 NDIS_STRING SymbolicLink;
61 NDIS_HANDLE AdapterHandle;
62 NDIS_HANDLE PacketPool;
63 KSPIN_LOCK RcvQSpinLock;
64 LIST_ENTRY RcvList;
65 NDIS_MEDIUM Medium;
66 KSPIN_LOCK ResetQueueLock;
67 LIST_ENTRY ResetIrpList;
68 NDIS_STATUS Status;
69 NDIS_EVENT Event;
70 NDIS_EVENT CleanupEvent;
71 LIST_ENTRY AdapterListEntry;
72 BOOLEAN Bound;
73 CHAR Filler[3];
74 } OPEN_INSTANCE, *POPEN_INSTANCE;
75
76 typedef struct _PACKET_RESERVED {
77 LIST_ENTRY ListElement;
78 PIRP Irp;
79 PMDL pMdl;
80 } PACKET_RESERVED, *PPACKET_RESERVED;
81
82
83 #define ETHERNET_HEADER_LENGTH 14
84 #define RESERVED(_p) ((PPACKET_RESERVED)((_p)->ProtocolReserved))
85 #define TRANSMIT_PACKETS 16
86
87
88 NTSTATUS
89 DriverEntry(
90 IN PDRIVER_OBJECT DriverObject,
91 IN PUNICODE_STRING RegistryPath
92 );
93
94 NTSTATUS
95 PacketCancelReadIrps(
96 IN PDEVICE_OBJECT DeviceObject
97 );
98
99 NTSTATUS
100 PacketCleanup(
101 IN PDEVICE_OBJECT DeviceObject,
102 IN PIRP Irp
103 );
104
105 VOID
106 PacketBindAdapter(
107 OUT PNDIS_STATUS Status,
108 IN NDIS_HANDLE BindContext,
109 IN PNDIS_STRING DeviceName,
110 IN PVOID SystemSpecific1,
111 IN PVOID SystemSpecific2
112 );
113 VOID
114 PacketUnbindAdapter(
115 OUT PNDIS_STATUS Status,
116 IN NDIS_HANDLE ProtocolBindingContext,
117 IN NDIS_HANDLE UnbindContext
118 );
119
120
121 VOID
122 PacketOpenAdapterComplete(
123 IN NDIS_HANDLE ProtocolBindingContext,
124 IN NDIS_STATUS Status,
125 IN NDIS_STATUS OpenErrorStatus
126 );
127
128 VOID
129 PacketCloseAdapterComplete(
130 IN NDIS_HANDLE ProtocolBindingContext,
131 IN NDIS_STATUS Status
132 );
133
134
135 NDIS_STATUS
136 PacketReceiveIndicate(
137 IN NDIS_HANDLE ProtocolBindingContext,
138 IN NDIS_HANDLE MacReceiveContext,
139 IN PVOID HeaderBuffer,
140 IN UINT HeaderBufferSize,
141 IN PVOID LookAheadBuffer,
142 IN UINT LookaheadBufferSize,
143 IN UINT PacketSize
144 );
145
146 VOID
147 PacketReceiveComplete(
148 IN NDIS_HANDLE ProtocolBindingContext
149 );
150
151
152 VOID
153 PacketRequestComplete(
154 IN NDIS_HANDLE ProtocolBindingContext,
155 IN PNDIS_REQUEST pRequest,
156 IN NDIS_STATUS Status
157 );
158
159 VOID
160 PacketSendComplete(
161 IN NDIS_HANDLE ProtocolBindingContext,
162 IN PNDIS_PACKET pPacket,
163 IN NDIS_STATUS Status
164 );
165
166
167 VOID
168 PacketResetComplete(
169 IN NDIS_HANDLE ProtocolBindingContext,
170 IN NDIS_STATUS Status
171 );
172
173
174 VOID
175 PacketStatus(
176 IN NDIS_HANDLE ProtocolBindingContext,
177 IN NDIS_STATUS Status,
178 IN PVOID StatusBuffer,
179 IN UINT StatusBufferSize
180 );
181
182
183 VOID
184 PacketStatusComplete(
185 IN NDIS_HANDLE ProtocolBindingContext
186 );
187
188 VOID
189 PacketTransferDataComplete(
190 IN NDIS_HANDLE ProtocolBindingContext,
191 IN PNDIS_PACKET Packet,
192 IN NDIS_STATUS Status,
193 IN UINT BytesTransferred
194 );
195
196
197 NTSTATUS
198 PacketShutdown(
199 IN PDEVICE_OBJECT DeviceObject,
200 IN PIRP Irp
201 );
202
203 VOID
204 PacketUnload(
205 IN PDRIVER_OBJECT DriverObject
206 );
207
208
209
210 NTSTATUS
211 PacketOpen(
212 IN PDEVICE_OBJECT DeviceObject,
213 IN PIRP Irp
214 );
215
216 NTSTATUS
217 PacketClose(
218 IN PDEVICE_OBJECT DeviceObject,
219 IN PIRP Irp
220 );
221
222 NTSTATUS
223 PacketWrite(
224 IN PDEVICE_OBJECT DeviceObject,
225 IN PIRP Irp
226 );
227
228 NTSTATUS
229 PacketRead(
230 IN PDEVICE_OBJECT DeviceObject,
231 IN PIRP Irp
232 );
233
234 NTSTATUS
235 PacketIoControl(
236 IN PDEVICE_OBJECT DeviceObject,
237 IN PIRP Irp
238 );
239
240 VOID
241 PacketCancelRoutine (
242 IN PDEVICE_OBJECT DeviceObject,
243 IN PIRP Irp
244 );
245
246 INT
247 PacketReceivePacket(
248 IN NDIS_HANDLE ProtocolBindingContext,
249 IN PNDIS_PACKET Packet
250 );
251
252 NTSTATUS
253 PacketGetAdapterList(
254 IN PVOID Buffer,
255 IN ULONG Length,
256 IN OUT PULONG DataLength
257 );
258
259 NDIS_STATUS
260 PacketPNPHandler(
261 IN NDIS_HANDLE ProtocolBindingContext,
262 IN PNET_PNP_EVENT pNetPnPEvent
263 );
264
265
266 VOID
267 IoIncrement (
268 IN OUT POPEN_INSTANCE Open
269 );
270
271 VOID
272 IoDecrement (
273 IN OUT POPEN_INSTANCE Open
274 );
275
276 #endif //_B2ETHER_H_