VirtualBox

source: vbox/trunk/src/VBox/Devices/USB/VUSBSniffer.h@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 23 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.4 KB
Line 
1/* $Id: VUSBSniffer.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * Virtual USB - Sniffer facility.
4 */
5
6/*
7 * Copyright (C) 2014-2023 Oracle and/or its affiliates.
8 *
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
26 */
27
28#ifndef VBOX_INCLUDED_SRC_USB_VUSBSniffer_h
29#define VBOX_INCLUDED_SRC_USB_VUSBSniffer_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <VBox/cdefs.h>
35#include <VBox/types.h>
36#include <VBox/vusb.h>
37
38RT_C_DECLS_BEGIN
39
40/** Opaque VUSB sniffer handle. */
41typedef struct VUSBSNIFFERINT *VUSBSNIFFER;
42/** Pointer to a VUSB sniffer handle. */
43typedef VUSBSNIFFER *PVUSBSNIFFER;
44
45/** NIL sniffer instance handle. */
46#define VUSBSNIFFER_NIL ((VUSBSNIFFER)0)
47
48/**
49 * VUSB Sniffer event types.
50 */
51typedef enum VUSBSNIFFEREVENT
52{
53 /** Invalid event. */
54 VUSBSNIFFEREVENT_INVALID = 0,
55 /** URB submit event. */
56 VUSBSNIFFEREVENT_SUBMIT,
57 /** URB complete event. */
58 VUSBSNIFFEREVENT_COMPLETE,
59 /** URB submit failed event. */
60 VUSBSNIFFEREVENT_ERROR_SUBMIT,
61 /** URB completed with error event. */
62 VUSBSNIFFEREVENT_ERROR_COMPLETE,
63 /** 32bit hack. */
64 VUSBSNIFFEREVENT_32BIT_HACK = 0x7fffffff
65} VUSBSNIFFEREVENT;
66
67/** VUSB Sniffer creation flags.
68 * @{ */
69/** Default flags. */
70#define VUSBSNIFFER_F_DEFAULT 0
71/** Don't overwrite any existing capture file. */
72#define VUSBSNIFFER_F_NO_REPLACE RT_BIT_32(0)
73/** @} */
74
75/**
76 * Create a new VUSB sniffer instance dumping to the given capture file.
77 *
78 * @returns VBox status code.
79 * @param phSniffer Where to store the handle to the sniffer instance on success.
80 * @param fFlags Flags, combination of VUSBSNIFFER_F_*
81 * @param pszCaptureFilename The filename to use for capturing the sniffed data.
82 * @param pszFmt The format of the dump, NULL to select one based on the filename
83 * extension.
84 * @param pszDesc Optional description for the dump.
85 */
86DECLHIDDEN(int) VUSBSnifferCreate(PVUSBSNIFFER phSniffer, uint32_t fFlags,
87 const char *pszCaptureFilename, const char *pszFmt,
88 const char *pszDesc);
89
90/**
91 * Destroys the given VUSB sniffer instance.
92 *
93 * @returns nothing.
94 * @param hSniffer The sniffer instance to destroy.
95 */
96DECLHIDDEN(void) VUSBSnifferDestroy(VUSBSNIFFER hSniffer);
97
98/**
99 * Records an VUSB event.
100 *
101 * @returns VBox status code.
102 * @param hSniffer The sniffer instance.
103 * @param pUrb The URB triggering the event.
104 * @param enmEvent The type of event to record.
105 */
106DECLHIDDEN(int) VUSBSnifferRecordEvent(VUSBSNIFFER hSniffer, PVUSBURB pUrb, VUSBSNIFFEREVENT enmEvent);
107
108
109RT_C_DECLS_END
110#endif /* !VBOX_INCLUDED_SRC_USB_VUSBSniffer_h */
111
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