VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmnetshaper.h

Last change on this file was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Network Shaper.
3 */
4
5/*
6 * Copyright (C) 2011-2024 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_vmm_pdmnetshaper_h
37#define VBOX_INCLUDED_vmm_pdmnetshaper_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <VBox/types.h>
43#include <VBox/vmm/pdmnetifs.h>
44#include <iprt/list.h>
45#include <iprt/sg.h>
46
47
48/** @defgroup grp_pdm_net_shaper The PDM Network Shaper API
49 * @ingroup grp_pdm
50 * @{
51 */
52
53
54#define PDM_NETSHAPER_MIN_BUCKET_SIZE UINT32_C(65536) /**< bytes */
55#define PDM_NETSHAPER_MAX_LATENCY UINT32_C(100) /**< milliseconds */
56
57RT_C_DECLS_BEGIN
58
59/**
60 * A network shaper filter entry.
61 *
62 * This is used by DrvNetShaper and any similar drivers.
63 */
64typedef struct PDMNSFILTER
65{
66 /** Entry in the group's filter list.
67 * Both members are NULL when not associated with a group. */
68 RTLISTNODER3 ListEntry;
69 /** The group index + 1.
70 * @note For safety reasons the value zero is invalid and this is 1-based
71 * (like pascal) rather than 0-based indexing.
72 * @note Volatile to prevent re-reading after validation. */
73 uint32_t volatile iGroup;
74 /** Set when the filter fails to obtain bandwidth.
75 * This will then cause pIDrvNetR3 to be called before long. */
76 bool fChoked;
77 /** Aligment padding. */
78 bool afPadding[3];
79 /** The driver this filter is aggregated into (ring-3). */
80 R3PTRTYPE(PPDMINETWORKDOWN) pIDrvNetR3;
81} PDMNSFILTER;
82
83VMM_INT_DECL(bool) PDMNetShaperAllocateBandwidth(PVMCC pVM, PPDMNSFILTER pFilter, size_t cbTransfer);
84VMMR3_INT_DECL(int) PDMR3NsAttach(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, PPDMNSFILTER pFilter);
85VMMR3_INT_DECL(int) PDMR3NsDetach(PVM pVM, PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter);
86VMMR3DECL(int) PDMR3NsBwGroupSetLimit(PUVM pUVM, const char *pszName, uint64_t cbPerSecMax);
87
88/** @} */
89
90RT_C_DECLS_END
91
92#endif /* !VBOX_INCLUDED_vmm_pdmnetshaper_h */
93
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