1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Network Shaper.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2011-2020 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_INCLUDED_vmm_pdmnetshaper_h
|
---|
27 | #define VBOX_INCLUDED_vmm_pdmnetshaper_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/types.h>
|
---|
33 | #include <VBox/vmm/pdmnetifs.h>
|
---|
34 | #include <iprt/sg.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | /** @defgroup grp_pdm_net_shaper The PDM Network Shaper API
|
---|
38 | * @ingroup grp_pdm
|
---|
39 | * @{
|
---|
40 | */
|
---|
41 |
|
---|
42 |
|
---|
43 | #define PDM_NETSHAPER_MIN_BUCKET_SIZE UINT32_C(65536) /**< bytes */
|
---|
44 | #define PDM_NETSHAPER_MAX_LATENCY UINT32_C(100) /**< milliseconds */
|
---|
45 |
|
---|
46 | RT_C_DECLS_BEGIN
|
---|
47 |
|
---|
48 | typedef struct PDMNSFILTER
|
---|
49 | {
|
---|
50 | /** Pointer to the next group in the list (ring-3). */
|
---|
51 | R3PTRTYPE(struct PDMNSFILTER *) pNextR3;
|
---|
52 | /** Pointer to the bandwidth group (ring-3). */
|
---|
53 | R3PTRTYPE(struct PDMNSBWGROUP *) pBwGroupR3;
|
---|
54 | /** Pointer to the bandwidth group (ring-0). */
|
---|
55 | R0PTRTYPE(struct PDMNSBWGROUP *) pBwGroupR0;
|
---|
56 | /** Set when the filter fails to obtain bandwidth. */
|
---|
57 | bool fChoked;
|
---|
58 | /** Aligment padding. */
|
---|
59 | bool afPadding[HC_ARCH_BITS == 32 ? 3 : 7];
|
---|
60 | /** The driver this filter is aggregated into (ring-3). */
|
---|
61 | R3PTRTYPE(PPDMINETWORKDOWN) pIDrvNetR3;
|
---|
62 | } PDMNSFILTER;
|
---|
63 |
|
---|
64 | VMMDECL(bool) PDMNsAllocateBandwidth(PPDMNSFILTER pFilter, size_t cbTransfer);
|
---|
65 | VMMR3_INT_DECL(int) PDMR3NsAttach(PUVM pUVM, PPDMDRVINS pDrvIns, const char *pcszBwGroup, PPDMNSFILTER pFilter);
|
---|
66 | VMMR3_INT_DECL(int) PDMR3NsDetach(PUVM pUVM, PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter);
|
---|
67 | VMMR3DECL(int) PDMR3NsBwGroupSetLimit(PUVM pUVM, const char *pszBwGroup, uint64_t cbPerSecMax);
|
---|
68 |
|
---|
69 | /** @} */
|
---|
70 |
|
---|
71 | RT_C_DECLS_END
|
---|
72 |
|
---|
73 | #endif /* !VBOX_INCLUDED_vmm_pdmnetshaper_h */
|
---|
74 |
|
---|