1 | /* $Id: VUSBSnifferInternal.h 69498 2017-10-28 15:07:25Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Virtual USB Sniffer facility - Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2016 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___VUSBSnifferInternal_h
|
---|
19 | #define ___VUSBSnifferInternal_h
|
---|
20 |
|
---|
21 | #include <VBox/cdefs.h>
|
---|
22 | #include <VBox/types.h>
|
---|
23 |
|
---|
24 | #include "VUSBSniffer.h"
|
---|
25 |
|
---|
26 | RT_C_DECLS_BEGIN
|
---|
27 |
|
---|
28 | /** Pointer to a stream operations structure. */
|
---|
29 | typedef struct VUSBSNIFFERSTRM *PVUSBSNIFFERSTRM;
|
---|
30 | /** Pointer to the internal format specific state. */
|
---|
31 | typedef struct VUSBSNIFFERFMTINT *PVUSBSNIFFERFMTINT;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Stream operations structure.
|
---|
35 | */
|
---|
36 | typedef struct VUSBSNIFFERSTRM
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Write the given buffer to the underlying stream.
|
---|
40 | *
|
---|
41 | * @returns VBox status code.
|
---|
42 | * @param pStrm The pointer to the interface containing this method.
|
---|
43 | * @param pvBuf The buffer to write.
|
---|
44 | * @param cbBuf How many bytes to write.
|
---|
45 | */
|
---|
46 | DECLR3CALLBACKMEMBER(int, pfnWrite, (PVUSBSNIFFERSTRM pStrm, const void *pvBuf, size_t cbBuf));
|
---|
47 |
|
---|
48 | } VUSBSNIFFERSTRM;
|
---|
49 |
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * VUSB Sniffer format backend.
|
---|
53 | */
|
---|
54 | typedef struct VUSBSNIFFERFMT
|
---|
55 | {
|
---|
56 | /** Name of the format. */
|
---|
57 | char szName[16];
|
---|
58 | /** Description of the format. */
|
---|
59 | const char *pszDesc;
|
---|
60 | /** Supported file extensions - terminated with a NULL entry. */
|
---|
61 | const char **papszFileExts;
|
---|
62 | /** Size of the format specific state structure in bytes. */
|
---|
63 | size_t cbFmt;
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Initializes the format.
|
---|
67 | *
|
---|
68 | * @returns VBox status code.
|
---|
69 | * @param pThis Pointer to the unitialized format specific state.
|
---|
70 | * @param pStrm The stream to use for writing.
|
---|
71 | */
|
---|
72 | DECLR3CALLBACKMEMBER(int, pfnInit, (PVUSBSNIFFERFMTINT pThis, PVUSBSNIFFERSTRM pStrm));
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Destroys the format instance.
|
---|
76 | *
|
---|
77 | * @returns nothing.
|
---|
78 | * @param pThis Pointer to the format specific state.
|
---|
79 | */
|
---|
80 | DECLR3CALLBACKMEMBER(void, pfnDestroy, (PVUSBSNIFFERFMTINT pThis));
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Records the given VUSB event.
|
---|
84 | *
|
---|
85 | * @returns VBox status code.
|
---|
86 | * @param pThis Pointer to the format specific state.
|
---|
87 | * @param pUrb The URB triggering the event.
|
---|
88 | * @param enmEvent The type of event to record.
|
---|
89 | */
|
---|
90 | DECLR3CALLBACKMEMBER(int, pfnRecordEvent, (PVUSBSNIFFERFMTINT pThis, PVUSBURB pUrb, VUSBSNIFFEREVENT enmEvent));
|
---|
91 |
|
---|
92 | } VUSBSNIFFERFMT;
|
---|
93 | /** Pointer to a VUSB Sniffer format backend. */
|
---|
94 | typedef VUSBSNIFFERFMT *PVUSBSNIFFERFMT;
|
---|
95 | /** Pointer to a const VUSB Sniffer format backend. */
|
---|
96 | typedef const VUSBSNIFFERFMT *PCVUSBSNIFFERFMT;
|
---|
97 |
|
---|
98 | /** PCAP-Ng format writer. */
|
---|
99 | extern const VUSBSNIFFERFMT g_VUsbSnifferFmtPcapNg;
|
---|
100 | /** VMware VMX log format writer. */
|
---|
101 | extern const VUSBSNIFFERFMT g_VUsbSnifferFmtVmx;
|
---|
102 | /** Linux UsbMon log format writer. */
|
---|
103 | extern const VUSBSNIFFERFMT g_VUsbSnifferFmtUsbMon;
|
---|
104 |
|
---|
105 | RT_C_DECLS_END
|
---|
106 | #endif /** !___VUSBSnifferInternal_h */
|
---|