1 /////////////////////////////////////////////////////////////////////////
2 // $Id: extplugin.h 14204 2021-03-27 17:23:31Z vruppert $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2002-2021  The Bochs Project
6 //
7 // extplugin.h
8 //
9 // This header file defines the types necessary to make a Bochs plugin,
10 // but without mentioning all the details of Bochs internals (bochs.h).
11 // It is included by the configuration interfaces and possibly other
12 // things which are intentionally isolated from other parts of the program.
13 //
14 // The original plugin_t struct comes from the plugin.h file from plex86.
15 // Plex86 is Copyright (C) 1999-2000  The plex86 developers team
16 //
17 /////////////////////////////////////////////////////////////////////////
18 
19 #ifndef __EXTPLUGIN_H
20 #define __EXTPLUGIN_H
21 
22 #if BX_PLUGINS && !defined(WIN32)
23 #if BX_HAVE_LTDL
24 #include <ltdl.h>
25 #else
26 #include "ltdl-bochs.h"
27 #endif
28 #endif
29 
30 #define PLUGTYPE_NULL      0x00
31 #define PLUGTYPE_CORE      0x01
32 #define PLUGTYPE_STANDARD  0x02
33 #define PLUGTYPE_OPTIONAL  0x04
34 #define PLUGTYPE_VGA       0x08
35 #define PLUGTYPE_USB       0x40
36 #define PLUGTYPE_CI        0x80
37 #define PLUGTYPE_GUI      0x100
38 #define PLUGTYPE_IMG      0x200
39 #define PLUGTYPE_NET      0x400
40 #define PLUGTYPE_SND      0x800
41 
42 #define PLUGFLAG_PCI 0x01
43 
44 #define PLUGIN_FINI  0
45 #define PLUGIN_INIT  1
46 #define PLUGIN_PROBE 2
47 #define PLUGIN_FLAGS 3
48 
49 typedef int (CDECL *plugin_entry_t)(struct _plugin_t *plugin, Bit16u type, Bit8u mode);
50 
51 typedef struct _plugin_t
52 {
53 #if BX_PLUGINS
54     char *name;
55 #if defined(WIN32)
56     HINSTANCE handle;
57 #else
58     lt_dlhandle handle;
59 #endif
60 #else
61     const char *name;
62 #endif
63     Bit16u type;
64     Bit8u flags;
65     plugin_entry_t plugin_entry;
66     bool initialized;
67     Bit16u loadtype;
68 
69 #if BX_PLUGINS
70     struct _plugin_t *next;
71 #endif
72 } plugin_t;
73 
74 #endif /* __EXTPLUGIN_H */
75