summaryrefslogtreecommitdiff
path: root/src/libs/cdp/cdpmod.h
blob: a1fdcae341e83807c1e79a709c2df235f63fc884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 * Nota bene: later versions of the GNU General Public License do not apply
 * to this program.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
/*
 * CDP module definitions
 * all CDP modules should #include this .h
 */

#ifndef LIBS_CDP_CDPMOD_H_
#define LIBS_CDP_CDPMOD_H_

#include "types.h"
#include "cdpapi.h"

#define CDP_INFO_SYM      cdpmodinfo
#define CDP_INFO_SYM_NAME "cdpmodinfo"

// this struct will be exported from the module
// under 'cdpmodinfo'
typedef struct
{
	// mandatory, version control
	uint32 size;             // size of this structure
	cdp_ApiVersion api_ver;  // version of cdp API used, set to CDPAPI_VERSION
	uint16 ver_major;        // module version, somewhat informational
	uint16 ver_minor;
	uint16 ver_patch;
	uint16 host_ver_major;   // minimum host version required, purely informational
	uint16 host_ver_minor;
	uint16 host_ver_patch;
	
	// reserved members: set all to 0 or use CDP_MODINFO_RESERVED1
	uint32 _32_reserved1;
	uint32 _32_reserved2;
	uint32 _32_reserved3;
	uint32 _32_reserved4;

	const char* context_name;
			// cannonical context name (in proper case)
			// this context will be used with all exposed objects
			// English preferred; try to keep it below 32 chars
	// informational, human-only; these fields have no real size
	// restriction other than to keep it reasonable
	const char* name;         // descriptive name
	const char* ver_string;   // descriptive version
	const char* author;       // go nuts
	const char* url;          // go nuts
	const char* comments;     // go nuts
	
	// reserved members, set all to 0 or use CDP_MODINFO_RESERVED2
	const char* _sz_reserved1;
	const char* _sz_reserved2;
	const char* _sz_reserved3;
	const char* _sz_reserved4;

	// mandatory, CDP entry points
	// TODO: decide whether more EPs are necessary and if not move
	// EPs above info-string members, abolishing _sz_reservedX
	bool (* module_init) (cdp_Module* module, cdp_Itf_Host* hostitf);
	void (* module_term) ();
	
} cdp_ModuleInfo;

#define CDP_MODINFO_RESERVED1  0,0,0,0
#define CDP_MODINFO_RESERVED2  0,0,0,0

// the following is defined via the last mandatory member
#define CDP_MODINFO_MIN_SIZE \
	( ((uint32) &((cdp_ModuleInfo*)0)->module_term) + \
	sizeof (((cdp_ModuleInfo*)0)->module_term) )

#if defined(WIN32)
#	define CDPEXPORT __declspec(dllexport)
#else
#	define CDPEXPORT
#endif

#endif  /* LIBS_CDP_CDPMOD_H_ */