[59616] | 1 | /* $Id: VUSBSnifferInternal.h 99739 2023-05-11 01:01:08Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * Virtual USB Sniffer facility - Internal header.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2016-2023 Oracle and/or its affiliates.
|
---|
[59616] | 8 | *
|
---|
[96407] | 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
|
---|
[59616] | 26 | */
|
---|
| 27 |
|
---|
[76565] | 28 | #ifndef VBOX_INCLUDED_SRC_USB_VUSBSnifferInternal_h
|
---|
| 29 | #define VBOX_INCLUDED_SRC_USB_VUSBSnifferInternal_h
|
---|
[76520] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[59616] | 33 |
|
---|
| 34 | #include <VBox/cdefs.h>
|
---|
| 35 | #include <VBox/types.h>
|
---|
| 36 |
|
---|
| 37 | #include "VUSBSniffer.h"
|
---|
| 38 |
|
---|
| 39 | RT_C_DECLS_BEGIN
|
---|
| 40 |
|
---|
| 41 | /** Pointer to a stream operations structure. */
|
---|
| 42 | typedef struct VUSBSNIFFERSTRM *PVUSBSNIFFERSTRM;
|
---|
| 43 | /** Pointer to the internal format specific state. */
|
---|
| 44 | typedef struct VUSBSNIFFERFMTINT *PVUSBSNIFFERFMTINT;
|
---|
| 45 |
|
---|
| 46 | /**
|
---|
| 47 | * Stream operations structure.
|
---|
| 48 | */
|
---|
| 49 | typedef 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 | */
|
---|
| 67 | typedef 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. */
|
---|
| 106 | typedef VUSBSNIFFERFMT *PVUSBSNIFFERFMT;
|
---|
| 107 | /** Pointer to a const VUSB Sniffer format backend. */
|
---|
| 108 | typedef const VUSBSNIFFERFMT *PCVUSBSNIFFERFMT;
|
---|
| 109 |
|
---|
| 110 | /** PCAP-Ng format writer. */
|
---|
| 111 | extern const VUSBSNIFFERFMT g_VUsbSnifferFmtPcapNg;
|
---|
| 112 | /** VMware VMX log format writer. */
|
---|
| 113 | extern const VUSBSNIFFERFMT g_VUsbSnifferFmtVmx;
|
---|
[59633] | 114 | /** Linux UsbMon log format writer. */
|
---|
| 115 | extern const VUSBSNIFFERFMT g_VUsbSnifferFmtUsbMon;
|
---|
[59616] | 116 |
|
---|
| 117 | RT_C_DECLS_END
|
---|
[76565] | 118 | #endif /* !VBOX_INCLUDED_SRC_USB_VUSBSnifferInternal_h */
|
---|