VirtualBox

source: vbox/trunk/include/VBox/intnet.h@ 32190

Last change on this file since 32190 was 30587, checked in by vboxsync, 14 years ago

IntNet: Profile sends.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 43.2 KB
Line 
1/** @file
2 * INTNET - Internal Networking. (DEV,++)
3 */
4
5/*
6 * Copyright (C) 2006-2010 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_intnet_h
27#define ___VBox_intnet_h
28
29#include <VBox/types.h>
30#include <VBox/stam.h>
31#include <VBox/sup.h>
32#include <iprt/assert.h>
33#include <iprt/asm.h>
34
35RT_C_DECLS_BEGIN
36
37
38/**
39 * Generic two-sided ring buffer.
40 *
41 * The deal is that there is exactly one writer and one reader.
42 * When offRead equals offWrite the buffer is empty. In the other
43 * extreme the writer will not use the last free byte in the buffer.
44 */
45typedef struct INTNETRINGBUF
46{
47 /** The offset from this structure to the start of the buffer. */
48 uint32_t offStart;
49 /** The offset from this structure to the end of the buffer. (exclusive). */
50 uint32_t offEnd;
51 /** The current read offset. */
52 uint32_t volatile offReadX;
53 /** Alignment. */
54 uint32_t u32Align0;
55
56 /** The committed write offset. */
57 uint32_t volatile offWriteCom;
58 /** Writer internal current write offset.
59 * This is ahead of offWriteCom when buffer space is handed to a third party for
60 * data gathering. offWriteCom will be assigned this value by the writer then
61 * the frame is ready. */
62 uint32_t volatile offWriteInt;
63 /** The number of bytes written (not counting overflows). */
64 STAMCOUNTER cbStatWritten;
65 /** The number of frames written (not counting overflows). */
66 STAMCOUNTER cStatFrames;
67 /** The number of overflows. */
68 STAMCOUNTER cOverflows;
69} INTNETRINGBUF;
70AssertCompileSize(INTNETRINGBUF, 48);
71/** Pointer to a ring buffer. */
72typedef INTNETRINGBUF *PINTNETRINGBUF;
73
74/** The alignment of a ring buffer. */
75#define INTNETRINGBUF_ALIGNMENT sizeof(INTNETHDR)
76
77/**
78 * Asserts the sanity of the specified INTNETRINGBUF structure.
79 */
80#define INTNETRINGBUF_ASSERT_SANITY(pRingBuf) \
81 do \
82 { \
83 AssertPtr(pRingBuf); \
84 { \
85 uint32_t const offWriteCom = (pRingBuf)->offWriteCom; \
86 uint32_t const offRead = (pRingBuf)->offReadX; \
87 uint32_t const offWriteInt = (pRingBuf)->offWriteInt; \
88 \
89 AssertMsg(offWriteCom == RT_ALIGN_32(offWriteCom, INTNETHDR_ALIGNMENT), ("%#x\n", offWriteCom)); \
90 AssertMsg(offWriteCom >= (pRingBuf)->offStart, ("%#x %#x\n", offWriteCom, (pRingBuf)->offStart)); \
91 AssertMsg(offWriteCom < (pRingBuf)->offEnd, ("%#x %#x\n", offWriteCom, (pRingBuf)->offEnd)); \
92 \
93 AssertMsg(offRead == RT_ALIGN_32(offRead, INTNETHDR_ALIGNMENT), ("%#x\n", offRead)); \
94 AssertMsg(offRead >= (pRingBuf)->offStart, ("%#x %#x\n", offRead, (pRingBuf)->offStart)); \
95 AssertMsg(offRead < (pRingBuf)->offEnd, ("%#x %#x\n", offRead, (pRingBuf)->offEnd)); \
96 \
97 AssertMsg(offWriteInt == RT_ALIGN_32(offWriteInt, INTNETHDR_ALIGNMENT), ("%#x\n", offWriteInt)); \
98 AssertMsg(offWriteInt >= (pRingBuf)->offStart, ("%#x %#x\n", offWriteInt, (pRingBuf)->offStart)); \
99 AssertMsg(offWriteInt < (pRingBuf)->offEnd, ("%#x %#x\n", offWriteInt, (pRingBuf)->offEnd)); \
100 AssertMsg( offRead <= offWriteCom \
101 ? offWriteCom <= offWriteInt || offWriteInt < offRead \
102 : offWriteCom <= offWriteInt, \
103 ("W=%#x W'=%#x R=%#x\n", offWriteCom, offWriteInt, offRead)); \
104 } \
105 } while (0)
106
107
108
109/**
110 * A interface buffer.
111 */
112typedef struct INTNETBUF
113{
114 /** Magic number (INTNETBUF_MAGIC). */
115 uint32_t u32Magic;
116 /** The size of the entire buffer. */
117 uint32_t cbBuf;
118 /** The size of the send area. */
119 uint32_t cbSend;
120 /** The size of the receive area. */
121 uint32_t cbRecv;
122 /** The receive buffer. */
123 INTNETRINGBUF Recv;
124 /** The send buffer. */
125 INTNETRINGBUF Send;
126 /** Number of times yields help solve an overflow. */
127 STAMCOUNTER cStatYieldsOk;
128 /** Number of times yields didn't help solve an overflow. */
129 STAMCOUNTER cStatYieldsNok;
130 /** Number of lost packets due to overflows. */
131 STAMCOUNTER cStatLost;
132 /** Number of bad frames (both rings). */
133 STAMCOUNTER cStatBadFrames;
134 /** Reserved for future use. */
135 STAMCOUNTER aStatReserved[2];
136 /** Reserved for future send profiling. */
137 STAMPROFILE StatSend1;
138 /** Reserved for future send profiling. */
139 STAMPROFILE StatSend2;
140 /** Reserved for future receive profiling. */
141 STAMPROFILE StatRecv1;
142 /** Reserved for future receive profiling. */
143 STAMPROFILE StatRecv2;
144 /** Reserved for future profiling. */
145 STAMPROFILE StatReserved;
146} INTNETBUF;
147AssertCompileSize(INTNETBUF, 320);
148AssertCompileMemberOffset(INTNETBUF, Recv, 16);
149AssertCompileMemberOffset(INTNETBUF, Send, 64);
150
151/** Pointer to an interface buffer. */
152typedef INTNETBUF *PINTNETBUF;
153/** Pointer to a const interface buffer. */
154typedef INTNETBUF const *PCINTNETBUF;
155
156/** Magic number for INTNETBUF::u32Magic (Sir William Gerald Golding). */
157#define INTNETBUF_MAGIC UINT32_C(0x19110919)
158
159/**
160 * Asserts the sanity of the specified INTNETBUF structure.
161 */
162#define INTNETBUF_ASSERT_SANITY(pBuf) \
163 do \
164 { \
165 AssertPtr(pBuf); \
166 Assert((pBuf)->u32Magic == INTNETBUF_MAGIC); \
167 { \
168 uint32_t const offRecvStart = (pBuf)->Recv.offStart + RT_OFFSETOF(INTNETBUF, Recv); \
169 uint32_t const offRecvEnd = (pBuf)->Recv.offStart + RT_OFFSETOF(INTNETBUF, Recv); \
170 uint32_t const offSendStart = (pBuf)->Send.offStart + RT_OFFSETOF(INTNETBUF, Send); \
171 uint32_t const offSendEnd = (pBuf)->Send.offStart + RT_OFFSETOF(INTNETBUF, Send); \
172 \
173 Assert(offRecvEnd > offRecvStart); \
174 Assert(offRecvEnd - offRecvStart == (pBuf)->cbRecv); \
175 Assert(offRecvStart == sizeof(INTNETBUF)); \
176 \
177 Assert(offSendEnd > offSendStart); \
178 Assert(offSendEnd - offSendStart == (pBuf)->cbSend); \
179 Assert(pffSendEnd <= (pBuf)->cbBuf); \
180 \
181 Assert(offSendStart == offRecvEnd); \
182 } \
183 } while (0)
184
185
186/** Internal networking interface handle. */
187typedef uint32_t INTNETIFHANDLE;
188/** Pointer to an internal networking interface handle. */
189typedef INTNETIFHANDLE *PINTNETIFHANDLE;
190
191/** Or mask to obscure the handle index. */
192#define INTNET_HANDLE_MAGIC 0x88880000
193/** Mask to extract the handle index. */
194#define INTNET_HANDLE_INDEX_MASK 0xffff
195/** The maximum number of handles (exclusive) */
196#define INTNET_HANDLE_MAX 0xffff
197/** Invalid handle. */
198#define INTNET_HANDLE_INVALID (0)
199
200
201/**
202 * The frame header.
203 *
204 * The header is intentionally 8 bytes long. It will always
205 * start at an 8 byte aligned address. Assuming that the buffer
206 * size is a multiple of 8 bytes, that means that we can guarantee
207 * that the entire header is contiguous in both virtual and physical
208 * memory.
209 */
210typedef struct INTNETHDR
211{
212 /** Header type. This is currently serving as a magic, it
213 * can be extended later to encode special command frames and stuff. */
214 uint16_t u16Type;
215 /** The size of the frame. */
216 uint16_t cbFrame;
217 /** The offset from the start of this header to where the actual frame starts.
218 * This is used to keep the frame it self continguous in virtual memory and
219 * thereby both simplify access as well as the descriptor. */
220 int32_t offFrame;
221} INTNETHDR;
222AssertCompileSize(INTNETHDR, 8);
223AssertCompileSizeAlignment(INTNETBUF, sizeof(INTNETHDR));
224/** Pointer to a frame header.*/
225typedef INTNETHDR *PINTNETHDR;
226/** Pointer to a const frame header.*/
227typedef INTNETHDR const *PCINTNETHDR;
228
229/** The alignment of a frame header. */
230#define INTNETHDR_ALIGNMENT sizeof(INTNETHDR)
231AssertCompile(sizeof(INTNETHDR) == INTNETHDR_ALIGNMENT);
232AssertCompile(INTNETHDR_ALIGNMENT <= INTNETRINGBUF_ALIGNMENT);
233
234/** @name Frame types (INTNETHDR::u16Type).
235 * @{ */
236/** Normal frames. */
237#define INTNETHDR_TYPE_FRAME 0x2442
238/** Padding frames. */
239#define INTNETHDR_TYPE_PADDING 0x3553
240/** Generic segment offload frames.
241 * The frame starts with a PDMNETWORKGSO structure which is followed by the
242 * header template and data. */
243#define INTNETHDR_TYPE_GSO 0x4664
244AssertCompileSize(PDMNETWORKGSO, 8);
245/** @} */
246
247/**
248 * Asserts the sanity of the specified INTNETHDR.
249 */
250#define INTNETHDR_ASSERT_SANITY(pHdr, pRingBuf) \
251 do \
252 { \
253 AssertPtr(pHdr); \
254 Assert(RT_ALIGN_PT(pHdr, INTNETHDR_ALIGNMENT, INTNETHDR *) == pHdr); \
255 Assert( (pHdr)->u16Type == INTNETHDR_TYPE_FRAME \
256 || (pHdr)->u16Type == INTNETHDR_TYPE_GSO \
257 || (pHdr)->u16Type == INTNETHDR_TYPE_PADDING); \
258 { \
259 uintptr_t const offHdr = (uintptr_t)pHdr - (uintptr_t)pRingBuf; \
260 uintptr_t const offFrame = offHdr + (pHdr)->offFrame; \
261 \
262 Assert(offHdr >= (pRingBuf)->offStart); \
263 Assert(offHdr < (pRingBuf)->offEnd); \
264 \
265 /* could do more thorough work here... later, perhaps. */ \
266 Assert(offFrame >= (pRingBuf)->offStart); \
267 Assert(offFrame < (pRingBuf)->offEnd); \
268 } \
269 } while (0)
270
271
272/**
273 * Scatter / Gather segment (internal networking).
274 */
275typedef struct INTNETSEG
276{
277 /** The physical address. NIL_RTHCPHYS is not set. */
278 RTHCPHYS Phys;
279 /** Pointer to the segment data. */
280 void *pv;
281 /** The segment size. */
282 uint32_t cb;
283} INTNETSEG;
284/** Pointer to a internal networking frame segment. */
285typedef INTNETSEG *PINTNETSEG;
286/** Pointer to a internal networking frame segment. */
287typedef INTNETSEG const *PCINTNETSEG;
288
289
290/**
291 * Scatter / Gather list (internal networking).
292 *
293 * This is used when communicating with the trunk port.
294 */
295typedef struct INTNETSG
296{
297 /** Owner data, don't touch! */
298 void *pvOwnerData;
299 /** User data. */
300 void *pvUserData;
301 /** User data 2 in case anyone needs it. */
302 void *pvUserData2;
303 /** GSO context information, set the type to invalid if not relevant. */
304 PDMNETWORKGSO GsoCtx;
305 /** The total length of the scatter gather list. */
306 uint32_t cbTotal;
307 /** The number of users (references).
308 * This is used by the SGRelease code to decide when it can be freed. */
309 uint16_t volatile cUsers;
310 /** Flags, see INTNETSG_FLAGS_* */
311 uint16_t volatile fFlags;
312#if ARCH_BITS == 64
313 /** Alignment padding. */
314 uint16_t uPadding;
315#endif
316 /** The number of segments allocated. */
317 uint16_t cSegsAlloc;
318 /** The number of segments actually used. */
319 uint16_t cSegsUsed;
320 /** Variable sized list of segments. */
321 INTNETSEG aSegs[1];
322} INTNETSG;
323AssertCompileSizeAlignment(INTNETSG, 8);
324/** Pointer to a scatter / gather list. */
325typedef INTNETSG *PINTNETSG;
326/** Pointer to a const scatter / gather list. */
327typedef INTNETSG const *PCINTNETSG;
328
329/** @name INTNETSG::fFlags definitions.
330 * @{ */
331/** Set if the SG is free. */
332#define INTNETSG_FLAGS_FREE RT_BIT_32(1)
333/** Set if the SG is a temporary one that will become invalid upon return.
334 * Try to finish using it before returning, and if that's not possible copy
335 * to other buffers.
336 * When not set, the callee should always free the SG.
337 * Attempts to free it made by the callee will be quietly ignored. */
338#define INTNETSG_FLAGS_TEMP RT_BIT_32(2)
339/** ARP packet, IPv4 + MAC.
340 * @internal */
341#define INTNETSG_FLAGS_ARP_IPV4 RT_BIT_32(3)
342/** Copied to the temporary buffer.
343 * @internal */
344#define INTNETSG_FLAGS_PKT_CP_IN_TMP RT_BIT_32(4)
345/** @} */
346
347
348/** @name Direction (frame source or destination)
349 * @{ */
350/** To/From the wire. */
351#define INTNETTRUNKDIR_WIRE RT_BIT_32(0)
352/** To/From the host. */
353#define INTNETTRUNKDIR_HOST RT_BIT_32(1)
354/** Mask of valid bits. */
355#define INTNETTRUNKDIR_VALID_MASK UINT32_C(3)
356/** @} */
357
358/**
359 * Switch decisions returned by INTNETTRUNKSWPORT::pfnPreRecv.
360 */
361typedef enum INTNETSWDECISION
362{
363 /** The usual invalid zero value. */
364 INTNETSWDECISION_INVALID = 0,
365 /** Everywhere. */
366 INTNETSWDECISION_BROADCAST,
367 /** Only to the internal network. */
368 INTNETSWDECISION_INTNET,
369 /** Only for the trunk (host/wire). */
370 INTNETSWDECISION_TRUNK,
371 /** Used internally to indicate that the packet cannot be handled in the
372 * current context. */
373 INTNETSWDECISION_BAD_CONTEXT,
374 /** Used internally to indicate that the packet should be dropped. */
375 INTNETSWDECISION_DROP,
376 /** The usual 32-bit type expansion. */
377 INTNETSWDECISION_32BIT_HACK = 0x7fffffff
378} INTNETSWDECISION;
379
380
381/** Pointer to the switch side of a trunk port. */
382typedef struct INTNETTRUNKSWPORT *PINTNETTRUNKSWPORT;
383/**
384 * This is the port on the internal network 'switch', i.e.
385 * what the driver is connected to.
386 *
387 * This is only used for the in-kernel trunk connections.
388 */
389typedef struct INTNETTRUNKSWPORT
390{
391 /** Structure version number. (INTNETTRUNKSWPORT_VERSION) */
392 uint32_t u32Version;
393
394 /**
395 * Examine the packet and figure out where it is going.
396 *
397 * This method is for making packet switching decisions in contexts where
398 * pfnRecv cannot be called or is no longer applicable. This method can be
399 * called from any context.
400 *
401 * @returns INTNETSWDECISION_BROADCAST, INTNETSWDECISION_INTNET or
402 * INTNETSWDECISION_TRUNK. The source is excluded from broadcast &
403 * trunk, of course.
404 *
405 * @param pSwitchPort Pointer to this structure.
406 * @param pvHdrs Pointer to the packet headers.
407 * @param cbHdrs Size of the packet headers. This must be at least 6
408 * bytes (the destination MAC address), but should if
409 * possible also include any VLAN tag and network
410 * layer header (wireless mac address sharing).
411 * @param fSrc Where this frame comes from. Only one bit should be
412 * set!
413 *
414 * @remarks Will only grab the switch table spinlock (interrupt safe). May
415 * signal an event semaphore iff we're racing network cleanup. The
416 * caller must be busy when calling.
417 */
418 DECLR0CALLBACKMEMBER(INTNETSWDECISION, pfnPreRecv,(PINTNETTRUNKSWPORT pSwitchPort,
419 void const *pvHdrs, size_t cbHdrs, uint32_t fSrc));
420
421 /**
422 * Incoming frame.
423 *
424 * The frame may be modified when the trunk port on the switch is set to share
425 * the mac address of the host when hitting the wire. Currently frames
426 * containing ARP packets are subject to this, later other protocols like
427 * NDP/ICMPv6 may need editing as well when operating in this mode. The edited
428 * packet should be forwarded to the host/wire when @c false is returned.
429 *
430 * @returns true if we've handled it and it should be dropped.
431 * false if it should hit the wire/host.
432 *
433 * @param pSwitchPort Pointer to this structure.
434 * @param pvIf Pointer to the interface which received this frame
435 * if available. Can be NULL.
436 * @param pSG The (scatter /) gather structure for the frame. This
437 * will only be use during the call, so a temporary one can
438 * be used. The Phys member will not be used.
439 * @param fSrc Where this frame comes from. Exactly one bit shall be
440 * set!
441 *
442 * @remarks Will only grab the switch table spinlock (interrupt safe). Will
443 * signal event semaphores. The caller must be busy when calling.
444 *
445 * @remarks NAT and TAP will use this interface.
446 *
447 * @todo Do any of the host require notification before frame modifications?
448 * If so, we'll add a callback to INTNETTRUNKIFPORT for this
449 * (pfnSGModifying) and a SG flag.
450 */
451 DECLR0CALLBACKMEMBER(bool, pfnRecv,(PINTNETTRUNKSWPORT pSwitchPort, void *pvIf, PINTNETSG pSG, uint32_t fSrc));
452
453 /**
454 * Retain a SG.
455 *
456 * @param pSwitchPort Pointer to this structure.
457 * @param pSG Pointer to the (scatter /) gather structure.
458 *
459 * @remarks Will not grab any locks. The caller must be busy when calling.
460 */
461 DECLR0CALLBACKMEMBER(void, pfnSGRetain,(PINTNETTRUNKSWPORT pSwitchPort, PINTNETSG pSG));
462
463 /**
464 * Release a SG.
465 *
466 * This is called by the pfnXmit code when done with a SG. This may safe
467 * be done in an asynchronous manner.
468 *
469 * @param pSwitchPort Pointer to this structure.
470 * @param pSG Pointer to the (scatter /) gather structure.
471 *
472 * @remarks May signal an event semaphore later on, currently code won't though.
473 * The caller is busy when making this call.
474 */
475 DECLR0CALLBACKMEMBER(void, pfnSGRelease,(PINTNETTRUNKSWPORT pSwitchPort, PINTNETSG pSG));
476
477 /**
478 * Selects whether outgoing SGs should have their physical address set.
479 *
480 * By enabling physical addresses in the scatter / gather segments it should
481 * be possible to save some unnecessary address translation and memory locking
482 * in the network stack. (Internal networking knows the physical address for
483 * all the INTNETBUF data and that it's locked memory.) There is a negative
484 * side effects though, frames that crosses page boundraries will require
485 * multiple scather / gather segments.
486 *
487 * @returns The old setting.
488 *
489 * @param pSwitchPort Pointer to this structure.
490 * @param fEnable Whether to enable or disable it.
491 *
492 * @remarks Will not grab any locks. The caller must be busy when calling.
493 */
494 DECLR0CALLBACKMEMBER(bool, pfnSetSGPhys,(PINTNETTRUNKSWPORT pSwitchPort, bool fEnable));
495
496 /**
497 * Reports the MAC address of the trunk.
498 *
499 * This is supposed to be called when creating, connection or reconnecting the
500 * trunk and when the MAC address is changed by the system admin.
501 *
502 * @param pSwitchPort Pointer to this structure.
503 * @param pMacAddr The MAC address.
504 *
505 * @remarks May take a spinlock or two. The caller must be busy when calling.
506 */
507 DECLR0CALLBACKMEMBER(void, pfnReportMacAddress,(PINTNETTRUNKSWPORT pSwitchPort, PCRTMAC pMacAddr));
508
509 /**
510 * Reports the promicuousness of the interface.
511 *
512 * This is supposed to be called when creating, connection or reconnecting the
513 * trunk and when the mode is changed by the system admin.
514 *
515 * @param pSwitchPort Pointer to this structure.
516 * @param fPromiscuous True if the host operates the interface in
517 * promiscuous mode, false if not.
518 *
519 * @remarks May take a spinlock or two. The caller must be busy when calling.
520 */
521 DECLR0CALLBACKMEMBER(void, pfnReportPromiscuousMode,(PINTNETTRUNKSWPORT pSwitchPort, bool fPromiscuous));
522
523 /**
524 * Reports the GSO capabilities of the host, wire or both.
525 *
526 * This is supposed to be used only when creating, connecting or reconnecting
527 * the trunk. It is assumed that the GSO capabilities are kind of static the
528 * rest of the time.
529 *
530 * @param pSwitchPort Pointer to this structure.
531 * @param fGsoCapabilities The GSO capability bit mask. The bits
532 * corresponds to the GSO type with the same value.
533 * @param fDst The destination mask (INTNETTRUNKDIR_XXX).
534 *
535 * @remarks Does not take any locks. The caller must be busy when calling.
536 */
537 DECLR0CALLBACKMEMBER(void, pfnReportGsoCapabilities,(PINTNETTRUNKSWPORT pSwitchPort, uint32_t fGsoCapabilities, uint32_t fDst));
538
539 /**
540 * Reports the no-preemption-xmit capabilities of the host and wire.
541 *
542 * This is supposed to be used only when creating, connecting or reconnecting
543 * the trunk. It is assumed that the GSO capabilities are kind of static the
544 * rest of the time.
545 *
546 * @param pSwitchPort Pointer to this structure.
547 * @param fNoPreemptDsts The destinations (INTNETTRUNKDIR_XXX) which it
548 * is safe to transmit to with preemption disabled.
549 * @param fDst The destination mask (INTNETTRUNKDIR_XXX).
550 *
551 * @remarks Does not take any locks. The caller must be busy when calling.
552 */
553 DECLR0CALLBACKMEMBER(void, pfnReportNoPreemptDsts,(PINTNETTRUNKSWPORT pSwitchPort, uint32_t fNoPreemptDsts));
554
555 /** Structure version number. (INTNETTRUNKSWPORT_VERSION) */
556 uint32_t u32VersionEnd;
557} INTNETTRUNKSWPORT;
558
559/** Version number for the INTNETTRUNKIFPORT::u32Version and INTNETTRUNKIFPORT::u32VersionEnd fields. */
560#define INTNETTRUNKSWPORT_VERSION UINT32_C(0xA2CDf001)
561
562
563/**
564 * The trunk interface state used set by INTNETTRUNKIFPORT::pfnSetState.
565 */
566typedef enum INTNETTRUNKIFSTATE
567{
568 /** The invalid zero entry. */
569 INTNETTRUNKIFSTATE_INVALID = 0,
570 /** The trunk is inactive. No calls to INTNETTRUNKSWPORT::pfnRecv or
571 * INTNETTRUNKSWPORT::pfnPreRecv. Calling other methods is OK. */
572 INTNETTRUNKIFSTATE_INACTIVE,
573 /** The trunk is active, no restrictions on methods or anything. */
574 INTNETTRUNKIFSTATE_ACTIVE,
575 /** The trunk is about to be disconnected from the internal network. No
576 * calls to any INTNETRUNKSWPORT methods. */
577 INTNETTRUNKIFSTATE_DISCONNECTING,
578 /** The end of the valid states. */
579 INTNETTRUNKIFSTATE_END,
580 /** The usual 32-bit type blow up hack. */
581 INTNETTRUNKIFSTATE_32BIT_HACK = 0x7fffffff
582} INTNETTRUNKIFSTATE;
583
584/** Pointer to the interface side of a trunk port. */
585typedef struct INTNETTRUNKIFPORT *PINTNETTRUNKIFPORT;
586/**
587 * This is the port on the trunk interface, i.e. the driver side which the
588 * internal network is connected to.
589 *
590 * This is only used for the in-kernel trunk connections.
591 */
592typedef struct INTNETTRUNKIFPORT
593{
594 /** Structure version number. (INTNETTRUNKIFPORT_VERSION) */
595 uint32_t u32Version;
596
597 /**
598 * Retain the object.
599 *
600 * It will normally be called while owning the internal network semaphore.
601 *
602 * @param pIfPort Pointer to this structure.
603 *
604 * @remarks May own the big mutex, no spinlocks.
605 */
606 DECLR0CALLBACKMEMBER(void, pfnRetain,(PINTNETTRUNKIFPORT pIfPort));
607
608 /**
609 * Releases the object.
610 *
611 * This must be called for every pfnRetain call.
612 *
613 *
614 * @param pIfPort Pointer to this structure.
615 *
616 * @remarks May own the big mutex, no spinlocks.
617 */
618 DECLR0CALLBACKMEMBER(void, pfnRelease,(PINTNETTRUNKIFPORT pIfPort));
619
620 /**
621 * Disconnect from the switch and release the object.
622 *
623 * The is the counter action of the
624 * INTNETTRUNKNETFLTFACTORY::pfnCreateAndConnect method.
625 *
626 * @param pIfPort Pointer to this structure.
627 *
628 * @remarks Owns the big mutex.
629 */
630 DECLR0CALLBACKMEMBER(void, pfnDisconnectAndRelease,(PINTNETTRUNKIFPORT pIfPort));
631
632 /**
633 * Changes the state of the trunk interface.
634 *
635 * The interface is created in the inactive state (INTNETTRUNKIFSTATE_INACTIVE).
636 * When the first connect VM or service is activated, the internal network
637 * activates the trunk (INTNETTRUNKIFSTATE_ACTIVE). The state may then be set
638 * back and forth between INACTIVE and ACTIVE as VMs are paused, added and
639 * removed.
640 *
641 * Eventually though, the network is destroyed as a result of there being no
642 * more VMs left in it and the state is changed to disconnecting
643 * (INTNETTRUNKIFSTATE_DISCONNECTING) and pfnWaitForIdle is called to make sure
644 * there are no active calls in either direction when pfnDisconnectAndRelease is
645 * called.
646 *
647 * A typical operation to performed by this method is to enable/disable promiscuous
648 * mode on the host network interface when entering/leaving the active state.
649 *
650 * @returns The previous state.
651 *
652 * @param pIfPort Pointer to this structure.
653 * @param enmState The new state.
654 *
655 * @remarks Owns the big mutex. No racing pfnSetState, pfnWaitForIdle,
656 * pfnDisconnectAndRelease or INTNETTRUNKFACTORY::pfnCreateAndConnect
657 * calls.
658 */
659 DECLR0CALLBACKMEMBER(INTNETTRUNKIFSTATE, pfnSetState,(PINTNETTRUNKIFPORT pIfPort, INTNETTRUNKIFSTATE enmState));
660
661 /**
662 * Notifies when the MAC address of an interface is set or changes.
663 *
664 * @param pIfPort Pointer to this structure.
665 * @param pvIfData Pointer to the trunk's interface data (see
666 * pfnConnectInterface).
667 * @param pMac Pointer to the MAC address of the connecting VM NIC.
668 *
669 * @remarks Only busy references to the trunk and the interface.
670 */
671 DECLR0CALLBACKMEMBER(void, pfnNotifyMacAddress,(PINTNETTRUNKIFPORT pIfPort, void *pvIfData, PCRTMAC pMac));
672
673 /**
674 * Called when an interface is connected to the network.
675 *
676 * @returns IPRT status code.
677 * @param pIfPort Pointer to this structure.
678 * @param pvIf Opaque pointer to the interface being connected.
679 * For use INTNETTRUNKSWPORT::pfnRecv.
680 * @param ppvIfData Pointer to a pointer variable that the trunk
681 * implementation can use to associate data with the
682 * interface. This pointer will be passed to the
683 * pfnXmit, pfnNotifyMacAddress and
684 * pfnDisconnectInterface methods.
685 *
686 * @remarks Owns the big mutex. No racing pfnDisconnectAndRelease.
687 */
688 DECLR0CALLBACKMEMBER(int, pfnConnectInterface,(PINTNETTRUNKIFPORT pIfPort, void *pvIf, void **ppvIfData));
689
690 /**
691 * Called when an interface is disconnected from the network.
692 *
693 * @param pIfPort Pointer to this structure.
694 * @param pvIfData Pointer to the trunk's interface data (see
695 * pfnConnectInterface).
696 *
697 * @remarks Owns the big mutex. No racing pfnDisconnectAndRelease.
698 */
699 DECLR0CALLBACKMEMBER(void, pfnDisconnectInterface,(PINTNETTRUNKIFPORT pIfPort, void *pvIfData));
700
701 /**
702 * Waits for the interface to become idle.
703 *
704 * This method must be called before disconnecting and releasing the object in
705 * order to prevent racing incoming/outgoing frames and device
706 * enabling/disabling.
707 *
708 * @returns IPRT status code (see RTSemEventWait).
709 * @param pIfPort Pointer to this structure.
710 * @param cMillies The number of milliseconds to wait. 0 means
711 * no waiting at all. Use RT_INDEFINITE_WAIT for
712 * an indefinite wait.
713 *
714 * @remarks Owns the big mutex. No racing pfnDisconnectAndRelease.
715 */
716 DECLR0CALLBACKMEMBER(int, pfnWaitForIdle,(PINTNETTRUNKIFPORT pIfPort, uint32_t cMillies));
717
718 /**
719 * Transmit a frame.
720 *
721 * @return VBox status code. Error generally means we'll drop the frame.
722 * @param pIfPort Pointer to this structure.
723 * @param pvIfData Pointer to the trunk's interface data (see
724 * pfnConnectInterface).
725 * @param pSG Pointer to the (scatter /) gather structure for the frame.
726 * This may or may not be a temporary buffer. If it's temporary
727 * the transmit operation(s) then it's required to make a copy
728 * of the frame unless it can be transmitted synchronously.
729 * @param fDst The destination mask. At least one bit will be set.
730 *
731 * @remarks No locks. May be called concurrently on several threads.
732 */
733 DECLR0CALLBACKMEMBER(int, pfnXmit,(PINTNETTRUNKIFPORT pIfPort, void *pvIfData, PINTNETSG pSG, uint32_t fDst));
734
735 /** Structure version number. (INTNETTRUNKIFPORT_VERSION) */
736 uint32_t u32VersionEnd;
737} INTNETTRUNKIFPORT;
738
739/** Version number for the INTNETTRUNKIFPORT::u32Version and INTNETTRUNKIFPORT::u32VersionEnd fields. */
740#define INTNETTRUNKIFPORT_VERSION UINT32_C(0xA2CDe001)
741
742
743/**
744 * The component factory interface for create a network
745 * interface filter (like VBoxNetFlt).
746 */
747typedef struct INTNETTRUNKFACTORY
748{
749 /**
750 * Release this factory.
751 *
752 * SUPR0ComponentQueryFactory (SUPDRVFACTORY::pfnQueryFactoryInterface to be precise)
753 * will retain a reference to the factory and the caller has to call this method to
754 * release it once the pfnCreateAndConnect call(s) has been done.
755 *
756 * @param pIfFactory Pointer to this structure.
757 */
758 DECLR0CALLBACKMEMBER(void, pfnRelease,(struct INTNETTRUNKFACTORY *pIfFactory));
759
760 /**
761 * Create an instance for the specfied host interface and connects it
762 * to the internal network trunk port.
763 *
764 * The initial interface active state is false (suspended).
765 *
766 *
767 * @returns VBox status code.
768 * @retval VINF_SUCCESS and *ppIfPort set on success.
769 * @retval VERR_INTNET_FLT_IF_NOT_FOUND if the interface was not found.
770 * @retval VERR_INTNET_FLT_IF_BUSY if the interface is already connected.
771 * @retval VERR_INTNET_FLT_IF_FAILED if it failed for some other reason.
772 *
773 * @param pIfFactory Pointer to this structure.
774 * @param pszName The interface name (OS specific).
775 * @param pSwitchPort Pointer to the port interface on the switch that
776 * this interface is being connected to.
777 * @param fFlags Creation flags, see below.
778 * @param ppIfPort Where to store the pointer to the interface port
779 * on success.
780 *
781 * @remarks Called while owning the network and the out-bound trunk semaphores.
782 */
783 DECLR0CALLBACKMEMBER(int, pfnCreateAndConnect,(struct INTNETTRUNKFACTORY *pIfFactory, const char *pszName,
784 PINTNETTRUNKSWPORT pSwitchPort, uint32_t fFlags,
785 PINTNETTRUNKIFPORT *ppIfPort));
786} INTNETTRUNKFACTORY;
787/** Pointer to the trunk factory. */
788typedef INTNETTRUNKFACTORY *PINTNETTRUNKFACTORY;
789
790/** The UUID for the (current) trunk factory. (case sensitive) */
791#define INTNETTRUNKFACTORY_UUID_STR "de504d93-1d1e-4781-8b73-6ea39a0e36a2"
792
793/** @name INTNETTRUNKFACTORY::pfnCreateAndConnect flags.
794 * @{ */
795/** Don't put the filtered interface in promiscuous mode.
796 * This is used for wireless interface since these can misbehave if
797 * we try to put them in promiscuous mode. (Wireless interfaces are
798 * normally bridged on level 3 instead of level 2.) */
799#define INTNETTRUNKFACTORY_FLAG_NO_PROMISC RT_BIT_32(0)
800/** @} */
801
802
803/**
804 * The trunk connection type.
805 *
806 * Used by IntNetR0Open and assoicated interfaces.
807 */
808typedef enum INTNETTRUNKTYPE
809{
810 /** Invalid trunk type. */
811 kIntNetTrunkType_Invalid = 0,
812 /** No trunk connection. */
813 kIntNetTrunkType_None,
814 /** We don't care which kind of trunk connection if the network exists,
815 * if it doesn't exist create it without a connection. */
816 kIntNetTrunkType_WhateverNone,
817 /** VirtualBox host network interface filter driver.
818 * The trunk name is the name of the host network interface. */
819 kIntNetTrunkType_NetFlt,
820 /** VirtualBox adapter host driver. */
821 kIntNetTrunkType_NetAdp,
822 /** Nat service (ring-0). */
823 kIntNetTrunkType_SrvNat,
824 /** The end of valid types. */
825 kIntNetTrunkType_End,
826 /** The usual 32-bit hack. */
827 kIntNetTrunkType_32bitHack = 0x7fffffff
828} INTNETTRUNKTYPE;
829
830/** @name IntNetR0Open flags.
831 * @{ */
832/** Share the MAC address with the host when sending something to the wire via the trunk.
833 * This is typically used when the trunk is a NetFlt for a wireless interface. */
834#define INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE RT_BIT_32(0)
835/** Whether new participants should be subjected to access check or not. */
836#define INTNET_OPEN_FLAGS_PUBLIC RT_BIT_32(1)
837/** Ignore any requests for promiscuous mode. */
838#define INTNET_OPEN_FLAGS_IGNORE_PROMISC RT_BIT_32(2)
839/** Ignore any requests for promiscuous mode, quietly applied/ignored on open. */
840#define INTNET_OPEN_FLAGS_QUIETLY_IGNORE_PROMISC RT_BIT_32(3)
841/** Ignore any requests for promiscuous mode on the trunk wire connection. */
842#define INTNET_OPEN_FLAGS_IGNORE_PROMISC_TRUNK_WIRE RT_BIT_32(4)
843/** Ignore any requests for promiscuous mode on the trunk wire connection, quietly applied/ignored on open. */
844#define INTNET_OPEN_FLAGS_QUIETLY_IGNORE_PROMISC_TRUNK_WIRE RT_BIT_32(5)
845/** Ignore any requests for promiscuous mode on the trunk host connection. */
846#define INTNET_OPEN_FLAGS_IGNORE_PROMISC_TRUNK_HOST RT_BIT_32(6)
847/** Ignore any requests for promiscuous mode on the trunk host connection, quietly applied/ignored on open. */
848#define INTNET_OPEN_FLAGS_QUIETLY_IGNORE_PROMISC_TRUNK_HOST RT_BIT_32(7)
849/** The mask of flags which causes flag incompatibilities. */
850#define INTNET_OPEN_FLAGS_COMPATIBILITY_XOR_MASK (RT_BIT_32(0) | RT_BIT_32(1) | RT_BIT_32(2) | RT_BIT_32(4) | RT_BIT_32(6))
851/** The mask of flags is always ORed in, even on open. (the quiet stuff) */
852#define INTNET_OPEN_FLAGS_SECURITY_OR_MASK (RT_BIT_32(3) | RT_BIT_32(5) | RT_BIT_32(7))
853/** The mask of valid flags. */
854#define INTNET_OPEN_FLAGS_MASK UINT32_C(0x000000ff)
855/** @} */
856
857/** The maximum length of a network name. */
858#define INTNET_MAX_NETWORK_NAME 128
859
860/** The maximum length of a trunk name. */
861#define INTNET_MAX_TRUNK_NAME 64
862
863
864/**
865 * Request buffer for IntNetR0OpenReq / VMMR0_DO_INTNET_OPEN.
866 * @see IntNetR0Open.
867 */
868typedef struct INTNETOPENREQ
869{
870 /** The request header. */
871 SUPVMMR0REQHDR Hdr;
872 /** Alternative to passing the taking the session from the VM handle.
873 * Either use this member or use the VM handle, don't do both. */
874 PSUPDRVSESSION pSession;
875 /** The network name. (input) */
876 char szNetwork[INTNET_MAX_NETWORK_NAME];
877 /** What to connect to the trunk port. (input)
878 * This is specific to the trunk type below. */
879 char szTrunk[INTNET_MAX_TRUNK_NAME];
880 /** The type of trunk link (NAT, Filter, TAP, etc). (input) */
881 INTNETTRUNKTYPE enmTrunkType;
882 /** Flags, see INTNET_OPEN_FLAGS_*. (input) */
883 uint32_t fFlags;
884 /** The size of the send buffer. (input) */
885 uint32_t cbSend;
886 /** The size of the receive buffer. (input) */
887 uint32_t cbRecv;
888 /** The handle to the network interface. (output) */
889 INTNETIFHANDLE hIf;
890} INTNETOPENREQ;
891/** Pointer to an IntNetR0OpenReq / VMMR0_DO_INTNET_OPEN request buffer. */
892typedef INTNETOPENREQ *PINTNETOPENREQ;
893
894INTNETR0DECL(int) IntNetR0OpenReq(PSUPDRVSESSION pSession, PINTNETOPENREQ pReq);
895
896
897/**
898 * Request buffer for IntNetR0IfCloseReq / VMMR0_DO_INTNET_IF_CLOSE.
899 * @see IntNetR0IfClose.
900 */
901typedef struct INTNETIFCLOSEREQ
902{
903 /** The request header. */
904 SUPVMMR0REQHDR Hdr;
905 /** Alternative to passing the taking the session from the VM handle.
906 * Either use this member or use the VM handle, don't do both. */
907 PSUPDRVSESSION pSession;
908 /** The handle to the network interface. */
909 INTNETIFHANDLE hIf;
910} INTNETIFCLOSEREQ;
911/** Pointer to an IntNetR0IfCloseReq / VMMR0_DO_INTNET_IF_CLOSE request
912 * buffer. */
913typedef INTNETIFCLOSEREQ *PINTNETIFCLOSEREQ;
914
915INTNETR0DECL(int) IntNetR0IfCloseReq(PSUPDRVSESSION pSession, PINTNETIFCLOSEREQ pReq);
916
917
918/**
919 * Request buffer for IntNetR0IfGetRing3BufferReq /
920 * VMMR0_DO_INTNET_IF_GET_BUFFER_PTRS.
921 * @see IntNetR0IfGetRing3Buffer.
922 */
923typedef struct INTNETIFGETBUFFERPTRSREQ
924{
925 /** The request header. */
926 SUPVMMR0REQHDR Hdr;
927 /** Alternative to passing the taking the session from the VM handle.
928 * Either use this member or use the VM handle, don't do both. */
929 PSUPDRVSESSION pSession;
930 /** Handle to the interface. */
931 INTNETIFHANDLE hIf;
932 /** The pointer to the ring-3 buffer. (output) */
933 R3PTRTYPE(PINTNETBUF) pRing3Buf;
934 /** The pointer to the ring-0 buffer. (output) */
935 R0PTRTYPE(PINTNETBUF) pRing0Buf;
936} INTNETIFGETBUFFERPTRSREQ;
937/** Pointer to an IntNetR0IfGetRing3BufferReq /
938 * VMMR0_DO_INTNET_IF_GET_BUFFER_PTRS request buffer. */
939typedef INTNETIFGETBUFFERPTRSREQ *PINTNETIFGETBUFFERPTRSREQ;
940
941INTNETR0DECL(int) IntNetR0IfGetBufferPtrsReq(PSUPDRVSESSION pSession, PINTNETIFGETBUFFERPTRSREQ pReq);
942
943
944/**
945 * Request buffer for IntNetR0IfSetPromiscuousModeReq /
946 * VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE.
947 * @see IntNetR0IfSetPromiscuousMode.
948 */
949typedef struct INTNETIFSETPROMISCUOUSMODEREQ
950{
951 /** The request header. */
952 SUPVMMR0REQHDR Hdr;
953 /** Alternative to passing the taking the session from the VM handle.
954 * Either use this member or use the VM handle, don't do both. */
955 PSUPDRVSESSION pSession;
956 /** Handle to the interface. */
957 INTNETIFHANDLE hIf;
958 /** The new promiscuous mode. */
959 bool fPromiscuous;
960} INTNETIFSETPROMISCUOUSMODEREQ;
961/** Pointer to an IntNetR0IfSetPromiscuousModeReq /
962 * VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE request buffer. */
963typedef INTNETIFSETPROMISCUOUSMODEREQ *PINTNETIFSETPROMISCUOUSMODEREQ;
964
965INTNETR0DECL(int) IntNetR0IfSetPromiscuousModeReq(PSUPDRVSESSION pSession, PINTNETIFSETPROMISCUOUSMODEREQ pReq);
966
967
968/**
969 * Request buffer for IntNetR0IfSetMacAddressReq /
970 * VMMR0_DO_INTNET_IF_SET_MAC_ADDRESS.
971 * @see IntNetR0IfSetMacAddress.
972 */
973typedef struct INTNETIFSETMACADDRESSREQ
974{
975 /** The request header. */
976 SUPVMMR0REQHDR Hdr;
977 /** Alternative to passing the taking the session from the VM handle.
978 * Either use this member or use the VM handle, don't do both. */
979 PSUPDRVSESSION pSession;
980 /** Handle to the interface. */
981 INTNETIFHANDLE hIf;
982 /** The new MAC address. */
983 RTMAC Mac;
984} INTNETIFSETMACADDRESSREQ;
985/** Pointer to an IntNetR0IfSetMacAddressReq /
986 * VMMR0_DO_INTNET_IF_SET_MAC_ADDRESS request buffer. */
987typedef INTNETIFSETMACADDRESSREQ *PINTNETIFSETMACADDRESSREQ;
988
989INTNETR0DECL(int) IntNetR0IfSetMacAddressReq(PSUPDRVSESSION pSession, PINTNETIFSETMACADDRESSREQ pReq);
990
991
992/**
993 * Request buffer for IntNetR0IfSetActiveReq / VMMR0_DO_INTNET_IF_SET_ACTIVE.
994 * @see IntNetR0IfSetActive.
995 */
996typedef struct INTNETIFSETACTIVEREQ
997{
998 /** The request header. */
999 SUPVMMR0REQHDR Hdr;
1000 /** Alternative to passing the taking the session from the VM handle.
1001 * Either use this member or use the VM handle, don't do both. */
1002 PSUPDRVSESSION pSession;
1003 /** Handle to the interface. */
1004 INTNETIFHANDLE hIf;
1005 /** The new state. */
1006 bool fActive;
1007} INTNETIFSETACTIVEREQ;
1008/** Pointer to an IntNetR0IfSetActiveReq / VMMR0_DO_INTNET_IF_SET_ACTIVE
1009 * request buffer. */
1010typedef INTNETIFSETACTIVEREQ *PINTNETIFSETACTIVEREQ;
1011
1012INTNETR0DECL(int) IntNetR0IfSetActiveReq(PSUPDRVSESSION pSession, PINTNETIFSETACTIVEREQ pReq);
1013
1014
1015/**
1016 * Request buffer for IntNetR0IfSendReq / VMMR0_DO_INTNET_IF_SEND.
1017 * @see IntNetR0IfSend.
1018 */
1019typedef struct INTNETIFSENDREQ
1020{
1021 /** The request header. */
1022 SUPVMMR0REQHDR Hdr;
1023 /** Alternative to passing the taking the session from the VM handle.
1024 * Either use this member or use the VM handle, don't do both. */
1025 PSUPDRVSESSION pSession;
1026 /** Handle to the interface. */
1027 INTNETIFHANDLE hIf;
1028} INTNETIFSENDREQ;
1029/** Pointer to an IntNetR0IfSend() argument package. */
1030typedef INTNETIFSENDREQ *PINTNETIFSENDREQ;
1031
1032INTNETR0DECL(int) IntNetR0IfSendReq(PSUPDRVSESSION pSession, PINTNETIFSENDREQ pReq);
1033
1034
1035/**
1036 * Request buffer for IntNetR0IfWaitReq / VMMR0_DO_INTNET_IF_WAIT.
1037 * @see IntNetR0IfWait.
1038 */
1039typedef struct INTNETIFWAITREQ
1040{
1041 /** The request header. */
1042 SUPVMMR0REQHDR Hdr;
1043 /** Alternative to passing the taking the session from the VM handle.
1044 * Either use this member or use the VM handle, don't do both. */
1045 PSUPDRVSESSION pSession;
1046 /** Handle to the interface. */
1047 INTNETIFHANDLE hIf;
1048 /** The number of milliseconds to wait. */
1049 uint32_t cMillies;
1050} INTNETIFWAITREQ;
1051/** Pointer to an IntNetR0IfWaitReq / VMMR0_DO_INTNET_IF_WAIT request buffer. */
1052typedef INTNETIFWAITREQ *PINTNETIFWAITREQ;
1053
1054INTNETR0DECL(int) IntNetR0IfWaitReq(PSUPDRVSESSION pSession, PINTNETIFWAITREQ pReq);
1055
1056
1057/**
1058 * Request buffer for IntNetR0IfAbortWaitReq / VMMR0_DO_INTNET_IF_ABORT_WAIT.
1059 * @see IntNetR0IfAbortWait.
1060 */
1061typedef struct INTNETIFABORTWAITREQ
1062{
1063 /** The request header. */
1064 SUPVMMR0REQHDR Hdr;
1065 /** Alternative to passing the taking the session from the VM handle.
1066 * Either use this member or use the VM handle, don't do both. */
1067 PSUPDRVSESSION pSession;
1068 /** Handle to the interface. */
1069 INTNETIFHANDLE hIf;
1070 /** Set this to fend off all future IntNetR0Wait calls. */
1071 bool fNoMoreWaits;
1072} INTNETIFABORTWAITREQ;
1073/** Pointer to an IntNetR0IfAbortWaitReq / VMMR0_DO_INTNET_IF_ABORT_WAIT
1074 * request buffer. */
1075typedef INTNETIFABORTWAITREQ *PINTNETIFABORTWAITREQ;
1076
1077INTNETR0DECL(int) IntNetR0IfAbortWaitReq(PSUPDRVSESSION pSession, PINTNETIFABORTWAITREQ pReq);
1078
1079
1080#if defined(IN_RING0) || defined(IN_INTNET_TESTCASE)
1081/** @name
1082 * @{
1083 */
1084
1085INTNETR0DECL(int) IntNetR0Init(void);
1086INTNETR0DECL(void) IntNetR0Term(void);
1087INTNETR0DECL(int) IntNetR0Open(PSUPDRVSESSION pSession, const char *pszNetwork,
1088 INTNETTRUNKTYPE enmTrunkType, const char *pszTrunk, uint32_t fFlags,
1089 uint32_t cbSend, uint32_t cbRecv, PINTNETIFHANDLE phIf);
1090INTNETR0DECL(uint32_t) IntNetR0GetNetworkCount(void);
1091
1092INTNETR0DECL(int) IntNetR0IfClose(INTNETIFHANDLE hIf, PSUPDRVSESSION pSession);
1093INTNETR0DECL(int) IntNetR0IfGetBufferPtrs(INTNETIFHANDLE hIf, PSUPDRVSESSION pSession,
1094 R3PTRTYPE(PINTNETBUF) *ppRing3Buf, R0PTRTYPE(PINTNETBUF) *ppRing0Buf);
1095INTNETR0DECL(int) IntNetR0IfSetPromiscuousMode(INTNETIFHANDLE hIf, PSUPDRVSESSION pSession, bool fPromiscuous);
1096INTNETR0DECL(int) IntNetR0IfSetMacAddress(INTNETIFHANDLE hIf, PSUPDRVSESSION pSession, PCRTMAC pMac);
1097INTNETR0DECL(int) IntNetR0IfSetActive(INTNETIFHANDLE hIf, PSUPDRVSESSION pSession, bool fActive);
1098INTNETR0DECL(int) IntNetR0IfSend(INTNETIFHANDLE hIf, PSUPDRVSESSION pSession);
1099INTNETR0DECL(int) IntNetR0IfWait(INTNETIFHANDLE hIf, PSUPDRVSESSION pSession, uint32_t cMillies);
1100INTNETR0DECL(int) IntNetR0IfAbortWait(INTNETIFHANDLE hIf, PSUPDRVSESSION pSession);
1101
1102/** @} */
1103#endif /* IN_RING0 */
1104
1105RT_C_DECLS_END
1106
1107#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette