VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/NetLib/IntNetIf.h@ 97078

Last change on this file since 97078 was 97078, checked in by vboxsync, 2 years ago

Networkservices: Further cleanup and consolidation, get rid of the almost useless IntNetIf helper class and add methods to the low level code offering the missing functionality there, bugref:10297

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
RevLine 
[87824]1/* $Id: IntNetIf.h 97078 2022-10-10 19:32:33Z vboxsync $ */
2/** @file
3 * IntNetIf - Convenience class implementing an IntNet connection.
4 */
5
6/*
[96407]7 * Copyright (C) 2009-2022 Oracle and/or its affiliates.
[87824]8 *
[96407]9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
[87824]26 */
27
28#ifndef VBOX_INCLUDED_SRC_NetLib_IntNetIf_h
29#define VBOX_INCLUDED_SRC_NetLib_IntNetIf_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <iprt/cdefs.h>
35
36#include <iprt/initterm.h>
37#include <iprt/cpp/ministring.h>
38
39#include <VBox/sup.h>
40#include <VBox/vmm/vmm.h>
41#include <VBox/intnet.h>
42
43
[97071]44
[87824]45/**
[97071]46 * Low-level internal network access helpers to hide away the different variants (R0 SUP or R3 XPC on macOS).
47 */
48/** Internal networking interface context handle. */
49typedef struct INTNETIFCTXINT *INTNETIFCTX;
50/** Pointer to an internal networking interface context handle. */
51typedef INTNETIFCTX *PINTNETIFCTX;
52
[97078]53/**
54 * User input callback function.
55 *
56 * @param pvUser The user specified argument.
57 * @param pvFrame The pointer to the frame data.
58 * @param cbFrame The length of the frame data.
59 */
60typedef DECLCALLBACKTYPE(void, FNINPUT,(void *pvUser, void *pvFrame, uint32_t cbFrame));
[97071]61
[97078]62/** Pointer to the user input callback function. */
63typedef FNINPUT *PFNINPUT;
[97071]64
65/**
[97078]66 * User GSO input callback function.
67 *
68 * @param pvUser The user specified argument.
69 * @param pcGso The pointer to the GSO context.
70 * @param cbFrame The length of the GSO data.
[87824]71 */
[97078]72typedef DECLCALLBACKTYPE(void, FNINPUTGSO,(void *pvUser, PCPDMNETWORKGSO pcGso, uint32_t cbFrame));
[87824]73
[97078]74/** Pointer to the user GSO input callback function. */
75typedef FNINPUTGSO *PFNINPUTGSO;
[87824]76
77
[97078]78/**
79 * An output frame in the send ring buffer.
80 *
81 * Obtained with IntNetR3IfCtxQueryOutputFrame(). Caller should copy frame
82 * contents to pvFrame and pass the frame structure to IntNetR3IfCtxOutputFrameCommit()
83 * to be sent to the network.
84 */
85typedef struct INTNETFRAME
86{
87 /** The intrnal network frame header. */
88 PINTNETHDR pHdr;
89 /** The actual frame data. */
90 void *pvFrame;
91} INTNETFRAME;
92typedef INTNETFRAME *PINTNETFRAME;
93typedef const INTNETFRAME *PCINTNETFRAME;
[87824]94
95
[97078]96DECLHIDDEN(int) IntNetR3IfCreate(PINTNETIFCTX phIfCtx, const char *pszNetwork);
97DECLHIDDEN(int) IntNetR3IfCreateEx(PINTNETIFCTX phIfCtx, const char *pszNetwork, INTNETTRUNKTYPE enmTrunkType,
98 const char *pszTrunk, uint32_t cbSend, uint32_t cbRecv, uint32_t fFlags);
99DECLHIDDEN(int) IntNetR3IfDestroy(INTNETIFCTX hIfCtx);
100DECLHIDDEN(int) IntNetR3IfQueryBufferPtr(INTNETIFCTX hIfCtx, PINTNETBUF *ppIfBuf);
101DECLHIDDEN(int) IntNetR3IfSetActive(INTNETIFCTX hIfCtx, bool fActive);
102DECLHIDDEN(int) IntNetR3IfSetPromiscuous(INTNETIFCTX hIfCtx, bool fPromiscuous);
103DECLHIDDEN(int) IntNetR3IfSend(INTNETIFCTX hIfCtx);
104DECLHIDDEN(int) IntNetR3IfWait(INTNETIFCTX hIfCtx, uint32_t cMillies);
105DECLHIDDEN(int) IntNetR3IfWaitAbort(INTNETIFCTX hIfCtx);
[87824]106
[97078]107DECLHIDDEN(int) IntNetR3IfPumpPkts(INTNETIFCTX hIfCtx, PFNINPUT pfnInput, void *pvUser,
108 PFNINPUTGSO pfnInputGso, void *pvUserGso);
109DECLHIDDEN(int) IntNetR3IfQueryOutputFrame(INTNETIFCTX hIfCtx, uint32_t cbFrame, PINTNETFRAME pFrame);
110DECLHIDDEN(int) IntNetR3IfOutputFrameCommit(INTNETIFCTX hIfCtx, PCINTNETFRAME pFrame);
[87824]111
112#endif /* !VBOX_INCLUDED_SRC_NetLib_IntNetIf_h */
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