1 | /** @file
|
---|
2 | * tstDevice: Plugin API.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2017 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 |
|
---|
17 | #ifndef ___tstDevicePlugin_h
|
---|
18 | #define ___tstDevicePlugin_h
|
---|
19 |
|
---|
20 | #include <VBox/types.h>
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Config item type.
|
---|
24 | */
|
---|
25 | typedef enum TSTDEVCFGITEMTYPE
|
---|
26 | {
|
---|
27 | /** Invalid type. */
|
---|
28 | TSTDEVCFGITEMTYPE_INVALID = 0,
|
---|
29 | /** String type. */
|
---|
30 | TSTDEVCFGITEMTYPE_STRING,
|
---|
31 | /** Integer value encoded in the string. */
|
---|
32 | TSTDEVCFGITEMTYPE_INTEGER,
|
---|
33 | /** Raw bytes. */
|
---|
34 | TSTDEVCFGITEMTYPE_BYTES,
|
---|
35 | /** 32bit hack. */
|
---|
36 | TSTDEVCFGITEMTYPE_32BIT_HACK = 0x7fffffff
|
---|
37 | } TSTDEVCFGITEMTYPE;
|
---|
38 | /** Pointer to a config item type. */
|
---|
39 | typedef TSTDEVCFGITEMTYPE *PTSTDEVCFGITEMTYPE;
|
---|
40 |
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Testcase config item.
|
---|
44 | */
|
---|
45 | typedef struct TSTDEVCFGITEM
|
---|
46 | {
|
---|
47 | /** The key of the item. */
|
---|
48 | const char *pszKey;
|
---|
49 | /** Type of the config item. */
|
---|
50 | TSTDEVCFGITEMTYPE enmType;
|
---|
51 | /** The value of the item (as a string/number of bytes to make static
|
---|
52 | * instantiation easier). */
|
---|
53 | const char *pszVal;
|
---|
54 | } TSTDEVCFGITEM;
|
---|
55 | /** Pointer to a testcase config item. */
|
---|
56 | typedef TSTDEVCFGITEM *PTSTDEVCFGITEM;
|
---|
57 | /** Pointer to a constant testcase config item. */
|
---|
58 | typedef const TSTDEVCFGITEM *PCTSTDEVCFGITEM;
|
---|
59 |
|
---|
60 |
|
---|
61 | /** Device under test handle. */
|
---|
62 | typedef struct TSTDEVDUTINT *TSTDEVDUT;
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Testcase registration structure.
|
---|
66 | */
|
---|
67 | typedef struct TSTDEVTESTCASEREG
|
---|
68 | {
|
---|
69 | /** Testcase name. */
|
---|
70 | char szName[16];
|
---|
71 | /** Testcase description. */
|
---|
72 | const char *pszDesc;
|
---|
73 | /** The device name the testcase handles. */
|
---|
74 | char szDevName[16];
|
---|
75 | /** Flags for this testcase. */
|
---|
76 | uint32_t fFlags;
|
---|
77 | /** CFGM configuration for the device to be instantiated. */
|
---|
78 | PCTSTDEVCFGITEM paDevCfg;
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Testcase entry point.
|
---|
82 | *
|
---|
83 | * @returns VBox status code.
|
---|
84 | * @param hDut Handle of the device under test.
|
---|
85 | */
|
---|
86 | DECLR3CALLBACKMEMBER(int, pfnTestEntry, (TSTDEVDUT hDut));
|
---|
87 | } TSTDEVTESTCASEREG;
|
---|
88 | /** Pointer to a testcase registration structure. */
|
---|
89 | typedef TSTDEVTESTCASEREG *PTSTDEVTESTCASEREG;
|
---|
90 | /** Pointer to a constant testcase registration structure. */
|
---|
91 | typedef const TSTDEVTESTCASEREG *PCTSTDEVTESTCASEREG;
|
---|
92 |
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Testcase register callbacks structure.
|
---|
96 | */
|
---|
97 | typedef struct TSTDEVPLUGINREGISTER
|
---|
98 | {
|
---|
99 | /**
|
---|
100 | * Registers a new testcase.
|
---|
101 | *
|
---|
102 | * @returns VBox status code.
|
---|
103 | * @param pvUser Opaque user data given in the plugin load callback.
|
---|
104 | * @param pTestcaseReg The testcase descriptor to register.
|
---|
105 | */
|
---|
106 | DECLR3CALLBACKMEMBER(int, pfnRegisterTestcase, (void *pvUser, PCTSTDEVTESTCASEREG pTestcaseReg));
|
---|
107 |
|
---|
108 | } TSTDEVPLUGINREGISTER;
|
---|
109 | /** Pointer to a backend register callbacks structure. */
|
---|
110 | typedef TSTDEVPLUGINREGISTER *PTSTDEVPLUGINREGISTER;
|
---|
111 |
|
---|
112 |
|
---|
113 | /**
|
---|
114 | * Initialization entry point called by the device test framework when
|
---|
115 | * a plugin is loaded.
|
---|
116 | *
|
---|
117 | * @returns VBox status code.
|
---|
118 | * @param pvUser Opaque user data passed in the register callbacks.
|
---|
119 | * @param pRegisterCallbacks Pointer to the register callbacks structure.
|
---|
120 | */
|
---|
121 | typedef DECLCALLBACK(int) FNTSTDEVPLUGINLOAD(void *pvUser, PTSTDEVPLUGINREGISTER pRegisterCallbacks);
|
---|
122 | typedef FNTSTDEVPLUGINLOAD *PFNTSTDEVPLUGINLOAD;
|
---|
123 | #define TSTDEV_PLUGIN_LOAD_NAME "TSTDevPluginLoad"
|
---|
124 |
|
---|
125 | #endif
|
---|