VirtualBox

source: vbox/trunk/src/VBox/Devices/USB/VUSBSnifferInternal.h

Last change on this file was 106061, checked in by vboxsync, 3 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.6 KB
Line 
1/* $Id: VUSBSnifferInternal.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * Virtual USB Sniffer facility - Internal header.
4 */
5
6/*
7 * Copyright (C) 2016-2024 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_VUSBSnifferInternal_h
29#define VBOX_INCLUDED_SRC_USB_VUSBSnifferInternal_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <VBox/cdefs.h>
35#include <VBox/types.h>
36
37#include "VUSBSniffer.h"
38
39RT_C_DECLS_BEGIN
40
41/** Pointer to a stream operations structure. */
42typedef struct VUSBSNIFFERSTRM *PVUSBSNIFFERSTRM;
43/** Pointer to the internal format specific state. */
44typedef struct VUSBSNIFFERFMTINT *PVUSBSNIFFERFMTINT;
45
46/**
47 * Stream operations structure.
48 */
49typedef struct VUSBSNIFFERSTRM
50{
51 /**
52 * Write the given buffer to the underlying stream.
53 *
54 * @returns VBox status code.
55 * @param pStrm The pointer to the interface containing this method.
56 * @param pvBuf The buffer to write.
57 * @param cbBuf How many bytes to write.
58 */
59 DECLR3CALLBACKMEMBER(int, pfnWrite, (PVUSBSNIFFERSTRM pStrm, const void *pvBuf, size_t cbBuf));
60
61} VUSBSNIFFERSTRM;
62
63
64/**
65 * VUSB Sniffer format backend.
66 */
67typedef struct VUSBSNIFFERFMT
68{
69 /** Name of the format. */
70 char szName[16];
71 /** Description of the format. */
72 const char *pszDesc;
73 /** Supported file extensions - terminated with a NULL entry. */
74 const char **papszFileExts;
75 /** Size of the format specific state structure in bytes. */
76 size_t cbFmt;
77
78 /**
79 * Initializes the format.
80 *
81 * @returns VBox status code.
82 * @param pThis Pointer to the unitialized format specific state.
83 * @param pStrm The stream to use for writing.
84 */
85 DECLR3CALLBACKMEMBER(int, pfnInit, (PVUSBSNIFFERFMTINT pThis, PVUSBSNIFFERSTRM pStrm));
86
87 /**
88 * Destroys the format instance.
89 *
90 * @param pThis Pointer to the format specific state.
91 */
92 DECLR3CALLBACKMEMBER(void, pfnDestroy, (PVUSBSNIFFERFMTINT pThis));
93
94 /**
95 * Records the given VUSB event.
96 *
97 * @returns VBox status code.
98 * @param pThis Pointer to the format specific state.
99 * @param pUrb The URB triggering the event.
100 * @param enmEvent The type of event to record.
101 */
102 DECLR3CALLBACKMEMBER(int, pfnRecordEvent, (PVUSBSNIFFERFMTINT pThis, PVUSBURB pUrb, VUSBSNIFFEREVENT enmEvent));
103
104} VUSBSNIFFERFMT;
105/** Pointer to a VUSB Sniffer format backend. */
106typedef VUSBSNIFFERFMT *PVUSBSNIFFERFMT;
107/** Pointer to a const VUSB Sniffer format backend. */
108typedef const VUSBSNIFFERFMT *PCVUSBSNIFFERFMT;
109
110/** PCAP-Ng format writer. */
111extern const VUSBSNIFFERFMT g_VUsbSnifferFmtPcapNg;
112/** VMware VMX log format writer. */
113extern const VUSBSNIFFERFMT g_VUsbSnifferFmtVmx;
114/** Linux UsbMon log format writer. */
115extern const VUSBSNIFFERFMT g_VUsbSnifferFmtUsbMon;
116
117RT_C_DECLS_END
118#endif /* !VBOX_INCLUDED_SRC_USB_VUSBSnifferInternal_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