-
Notifications
You must be signed in to change notification settings - Fork 188
/
Copy pathadd_modules.html
71 lines (49 loc) · 1.77 KB
/
add_modules.html
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Adding Modules to cfengine 3</title>
</head>
<body>
<h1>Adding Modules to cfengine 3</h1>
Cfengine 3 is designed to be highly modular and uniform in syntax.
To add a new functionality, you
Plan a model based on promises
What are the promises you want to make?
What promise types will you need?
file:
newtype:
What attributes (lvalues) will the promise body have?
What datatypes will the attributes have?
Then you start in src/mod_common.c
<pre>
/*********************************************************/
/* THIS IS WHERE TO ATTACH SYNTAX MODULES */
/*********************************************************/
/* Read in all parsable Bundle definitions */
struct SubTypeSyntax *CF_ALL_SUBTYPES[CF3_MODULES] =
{
CF_COMMON_SUBTYPES, /* Add modules after this */
CF_FILES_SUBTYPES, /* mod_files.c */
CF_EXEC_SUBTYPES, /* mod_exec.c */
CF_PROCESS_SUBTYPES,/* mod_process.c */
/* update CF3_MODULES in cf3.defs.h */
};
</pre>
Remember to increase the constant CF3_MODULES when you increase
the size of this.
Add a reference to the new module here. Take an existing module,
e.g. mod_exec.c and copy it to your new module.
Rename the parts consistently with the module name and edit this to
add the required promises with attributes. Don't forget the preprocessor
labels CF3_MOD_NEW
You will have to add the mod_new.c file to Makefile.am
Add a section to cf3.extern.h to declare the new variables, following
the pattern there.
<hr>
<address><a href="mailto:mark@atlas">Mark Burgess</a></address>
<!-- Created: Fri Jan 4 10:03:03 CET 2008 -->
<!-- hhmts start -->
Last modified: Fri Jan 4 15:55:46 CET 2008
<!-- hhmts end -->
</body>
</html>