VirtualBox

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

Last change on this file since 42407 was 42064, checked in by vboxsync, 12 years ago

build fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Network Shaper.
3 */
4
5/*
6 * Copyright (C) 2011-2012 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_vmm_pdmnetshaper_h
27#define ___VBox_vmm_pdmnetshaper_h
28
29#include <VBox/types.h>
30#include <VBox/err.h>
31#include <VBox/vmm/pdmnetifs.h>
32#include <iprt/assert.h>
33#include <iprt/sg.h>
34
35
36#define PDM_NETSHAPER_MIN_BUCKET_SIZE 65536 /* bytes */
37#define PDM_NETSHAPER_MAX_LATENCY 100 /* milliseconds */
38
39RT_C_DECLS_BEGIN
40
41typedef struct PDMNSFILTER
42{
43 /** [R3] Pointer to the next group in the list. */
44 struct PDMNSFILTER *pNext;
45 /** [R3] Pointer to the bandwidth group. */
46 struct PDMNSBWGROUP *pBwGroupR3;
47 /** [R0] Pointer to the bandwidth group. */
48 R0PTRTYPE(struct PDMNSBWGROUP *) pBwGroupR0;
49 /** Becomes true when filter fails to obtain bandwidth. */
50 bool fChoked;
51 /** [R3] The driver this filter is aggregated into. */
52 PPDMINETWORKDOWN pIDrvNet;
53} PDMNSFILTER;
54
55/** @defgroup grp_pdm_net_shaper The PDM Network Shaper API
56 * @ingroup grp_pdm
57 * @{
58 */
59
60/** Pointer to a PDM filter handle. */
61typedef struct PDMNSFILTER *PPDMNSFILTER;
62/** Pointer to a network shaper. */
63typedef struct PDMNETSHAPER *PPDMNETSHAPER;
64
65
66/**
67 * Obtain bandwidth in a bandwidth group (R0 version).
68 *
69 * @returns VBox status code.
70 * @param pFilter Pointer to the filter that allocates bandwidth.
71 * @param cbTransfer Number of bytes to allocate.
72 */
73VMMR0DECL(bool) PDMR0NsAllocateBandwidth(PPDMNSFILTER pFilter, size_t cbTransfer);
74
75/**
76 * Obtain bandwidth in a bandwidth group.
77 *
78 * @returns VBox status code.
79 * @param pFilter Pointer to the filter that allocates bandwidth.
80 * @param cbTransfer Number of bytes to allocate.
81 */
82VMMR3DECL(bool) PDMR3NsAllocateBandwidth(PPDMNSFILTER pFilter, size_t cbTransfer);
83
84/**
85 * Attach network filter driver from bandwidth group.
86 *
87 * @returns VBox status code.
88 * @param pVM Handle of VM.
89 * @param pDrvIns The driver instance.
90 * @param pcszBwGroup Name of the bandwidth group to attach to.
91 * @param pFilter Pointer to the filter we attach.
92 */
93VMMR3DECL(int) PDMR3NsAttach(PVM pVM, PPDMDRVINS pDrvIns, const char *pcszBwGroup, PPDMNSFILTER pFilter);
94
95/**
96 * Detach network filter driver from bandwidth group.
97 *
98 * @returns VBox status code.
99 * @param pVM Handle of VM.
100 * @param pDrvIns The driver instance.
101 * @param pFilter Pointer to the filter we detach.
102 */
103VMMR3DECL(int) PDMR3NsDetach(PVM pVM, PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter);
104
105/**
106 * Adjusts the maximum rate for the bandwidth group.
107 *
108 * @returns VBox status code.
109 * @param pVM Handle of VM.
110 * @param pcszBwGroup Name of the bandwidth group to attach to.
111 * @param cbTransferPerSecMax Maximum number of bytes per second to be transmitted.
112 */
113VMMR3DECL(int) PDMR3NsBwGroupSetLimit(PVM pVM, const char *pcszBwGroup, uint64_t cbTransferPerSecMax);
114
115/** @} */
116
117RT_C_DECLS_END
118
119#endif
120
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