36
36
#include "cf3.defs.h"
37
37
#include "cf3.extern.h"
40
/*********************************************************/
41
/* FnCalls are rvalues in certain promise constraints */
42
/*********************************************************/
44
/* see cf3.defs.h enum fncalltype */
46
struct FnCallType CF_FNCALL_TYPES[] =
48
{"accessedbefore",cf_class,2,"True if arg1 was accessed before arg2 (atime)"},
49
{"accumulated",cf_int,6,"Convert an accumulated amount of time into a system representation"},
50
{"ago",cf_int,6,"Convert a time relative to now to an integer system representation"},
51
{"canonify",cf_str,1,"Convert an abitrary string into a legal class name"},
52
{"changedbefore",cf_class,2,"True if arg1 was changed before arg2 (ctime)"},
53
{"classify",cf_class,1,"True if the canonicalization of the argument is a currently defined class"},
54
{"classmatch",cf_class,1,"True if the regular expression matches any currently defined class"},
55
{"countclassesmatching",cf_int,1,"Count the number of defined classes matching regex arg1"},
56
{"countlinesmatching",cf_int,2,"Count the number of lines matching regex arg1 in file arg2"},
57
{"diskfree",cf_int,1,"Return the free space (in KB) available on the directory's current partition (0 if not found)"},
58
{"escape",cf_str,1,"Escape regular expression characters in a string"},
59
{"execresult",cf_str,2,"Execute named command and assign output to variable"},
60
{"fileexists",cf_class,1,"True if the named file can be accessed"},
61
{"filesexist",cf_class,1,"True if the named list of files can ALL be accessed"},
62
{"getfields",cf_int,4,"Get an array of fields in the lines matching regex arg1 in file arg2, split on regex arg3 as array name arg4"},
63
{"getindices",cf_slist,1,"Get a list of keys to the array whose id is the argument and assign to variable"},
64
{"getenv",cf_str,2,"Return the environment variable named arg1, truncated at arg2 characters"},
65
{"getgid",cf_int,1,"Return the integer group id of the named group on this host"},
66
{"getuid",cf_int,1,"Return the integer user id of the named user on this host"},
67
{"grep",cf_str,2,"Extract the sub-list if items matching the regular expression in arg1 of the list named in arg2"},
68
{"groupexists",cf_class,1,"True if group or numerical id exists on this host"},
69
{"hash",cf_str,2,"Return the hash of arg1, type arg2 and assign to a variable"},
70
{"hashmatch",cf_class,3,"Compute the hash of arg1, of type arg2 and test if it matches the value in arg 3"},
71
{"host2ip",cf_str,1,"Returns the primary name-service IP address for the named host"},
72
{"hostinnetgroup",cf_class,1,"True if the current host is in the named netgroup"},
73
{"hostrange",cf_class,2,"True if the current host lies in the range of enumerated hostnames specified"},
74
{"hostsseen",cf_str,3,"Extract the list of hosts last seen/not seen within the last arg1 minutes"},
75
{"iprange",cf_class,1,"True if the current host lies in the range of IP addresses specified"},
76
{"irange",cf_irange,2,"Define a range of integer values for cfengine internal use"},
77
{"isdir",cf_class,1,"True if the named object is a directory"},
78
{"isgreaterthan",cf_class,2,"True if arg1 is numerically greater than arg2, else compare strings like strcmp"},
79
{"islessthan",cf_class,2,"True if arg1 is numerically less than arg2, else compare strings like NOT strcmp"},
80
{"islink",cf_class,1,"True if the named object is a symbolic link"},
81
{"isnewerthan",cf_class,2,"True if arg1 is newer (modified later) than arg2 (mtime)"},
82
{"isplain",cf_class,1,"True if the named object is a plain/regular file"},
83
{"isvariable",cf_class,1,"True if the named variable is defined"},
84
{"join",cf_str,2,"Join the items of arg2 into a string, using the conjunction in arg1"},
85
{"lastnode",cf_str,2,"Extract the last of a separated string, e.g. filename from a path"},
86
{"ldaparray",cf_class,6,"Extract all values from an ldap record"},
87
{"ldaplist",cf_slist,6,"Extract all named values from multiple ldap records"},
88
{"ldapvalue",cf_str,6,"Extract the first matching named value from ldap"},
89
{"now",cf_int,0,"Convert the current time into system representation"},
90
{"on",cf_int,6,"Convert an exact date/time to an integer system representation"},
91
{"peers",cf_slist,3,"Get a list of peers (not including ourself) from the partition to which we belong"},
92
{"peerleader",cf_str,3,"Get the assigned peer-leader of the partition to which we belong"},
93
{"peerleaders",cf_slist,3,"Get a list of peer leaders from the named partitioning"},
94
{"randomint",cf_int,2,"Generate a random integer between the given limits"},
95
{"readfile",cf_str,2,"Read max number of bytes from named file and assign to variable"},
96
{"readintarray",cf_int,6,"Read an array of integers from a file and assign the dimension to a variable"},
97
{"readintlist",cf_ilist,5,"Read and assign a list variable from a file of separated ints"},
98
{"readrealarray",cf_int,6,"Read an array of real numbers from a file and assign the dimension to a variable"},
99
{"readreallist",cf_rlist,5,"Read and assign a list variable from a file of separated real numbers"},
100
{"readstringarray",cf_int,6,"Read an array of strings from a file and assign the dimension to a variable"},
101
{"readstringlist",cf_slist,5,"Read and assign a list variable from a file of separated strings"},
102
{"readtcp",cf_str,4,"Connect to tcp port, send string and assign result to variable"},
103
{"regarray",cf_class,2,"True if arg1 matches any item in the associative array with id=arg2"},
104
{"regcmp",cf_class,2,"True if arg1 is a regular expression matching that matches string arg2"},
105
{"regextract",cf_class,3,"True if the regular expression in arg 1 matches the string in arg2 and sets a non-empty array of backreferences named arg3"},
106
{"registryvalue",cf_str,2,"Returns a value for an MS-Win registry key,value pair"},
107
{"regline",cf_class,2,"True if the regular expression in arg1 matches a line in file arg2"},
108
{"reglist",cf_class,2,"True if the regular expression in arg2 matches any item in the list whose id is arg1"},
109
{"regldap",cf_class,7,"True if the regular expression in arg6 matches a value item in an ldap search"},
110
{"remotescalar",cf_str,3,"Read a scalar value from a remote cfengine server"},
111
{"remoteclassesmatching",cf_class,4,"Read persistent classes matching a regular expression from a remote cfengine server and add them into local context with prefix"},
112
{"returnszero",cf_class,2,"True if named shell command has exit status zero"},
113
{"rrange",cf_rrange,2,"Define a range of real numbers for cfengine internal use"},
114
{"selectservers",cf_int,6,"Select tcp servers which respond correctly to a query and return their number, set array of names"},
115
{"splayclass",cf_class,2,"True if the first argument's time-slot has arrived, according to a policy in arg2"},
116
{"splitstring",cf_slist,3,"Convert a string in arg1 into a list of max arg3 strings by splitting on a regular expression in arg2"},
117
{"strcmp",cf_class,2,"True if the two strings match exactly"},
118
{"translatepath",cf_str,1,"Translate path separators from Unix style to the host's native"},
119
{"usemodule",cf_class,2,"Execute cfengine module script and set class if successful"},
120
{"userexists",cf_class,1,"True if user name or numerical id exists on this host"},
121
{NULL,cf_notype,0,NULL}
124
/*********************************************************/
126
39
struct BodySyntax CF_TRANSACTION_BODY[] =
128
41
{"action_policy",cf_opts,"fix,warn,nop","Whether to repair or report about non-kept promises"},
226
139
{"dryrun",cf_opts,CF_BOOL,"All talk and no action mode"},
227
140
{"editbinaryfilesize",cf_int,CF_VALRANGE,"Integer limit on maximum binary file size to be edited"},
228
141
{"editfilesize",cf_int,CF_VALRANGE,"Integer limit on maximum text file size to be edited"},
229
{"environment",cf_slist,"[A-Za-z_]+=.*","List of environment variables to be inherited by children"},
142
{"environment",cf_slist,"[A-Za-z0-9_]+=.*","List of environment variables to be inherited by children"},
230
143
{"exclamation",cf_opts,CF_BOOL,"true/false print exclamation marks during security warnings"},
231
144
{"expireafter",cf_int,CF_VALRANGE,"Global default for time before on-going promise repairs are interrupted"},
232
145
{"files_single_copy",cf_slist,"","List of filenames to be watched for multiple-source conflicts"},
233
146
{"files_auto_define",cf_slist,"","List of filenames to define classes if copied"},
234
{"fullencryption",cf_opts,CF_BOOL,"Full encryption mode in server connections, includes directory listings"},
235
147
{"hostnamekeys",cf_opts,CF_BOOL,"true/false label ppkeys by hostname not IP address"},
236
148
{"ifelapsed",cf_int,CF_VALRANGE,"Global default for time that must elapse before promise will be rechecked"},
237
149
{"inform",cf_opts,CF_BOOL,"true/false set inform level default"},
238
{"lastseen",cf_opts,CF_BOOL,"true/false record last observed times for each client-server connections for intermittency modelling"},
239
150
{"intermittency",cf_opts,CF_BOOL,"true/false store detailed recordings of last observed time for all client-server connections for reliability assessment (false)"},
240
151
{"max_children",cf_int,CF_VALRANGE,"Maximum number of background tasks that should be allowed concurrently"},
241
152
{"maxconnections",cf_int,CF_VALRANGE,"Maximum number of outgoing connections to cf-serverd"},
318
229
struct BodySyntax CFK_CONTROLBODY[] =
231
{"build_directory",cf_str,".*","The directory in which to generate output files"},
232
{"generate_manual",cf_opts,CF_BOOL,"true/false generate texinfo manual page skeleton for this version"},
233
{"graph_directory",cf_str,CF_PATHRANGE,"Path to directory where rendered .png files will be created"},
234
{"graph_output",cf_opts,CF_BOOL,"true/false generate png visualization of topic map if possible (requires lib)"},
235
{"html_banner",cf_str,"","HTML code for a banner to be added to rendered in html after the header"},
236
{"html_footer",cf_str,"","HTML code for a page footer to be added to rendered in html before the end body tag"},
320
237
{"id_prefix",cf_str,".*","The LTM identifier prefix used to label topic maps (used for disambiguation in merging)"},
321
{"build_directory",cf_str,".*","The directory in which to generate output files"},
238
{"manual_source_directory",cf_str,CF_PATHRANGE,"Path to directory where raw text about manual topics is found (defaults to build_directory)"},
239
{"query_engine",cf_str,"","Name of a dynamic web-page used to accept and drive queries in a browser"},
240
{"query_output",cf_opts,"html,text","Menu option for generated output format"},
322
241
{"sql_type",cf_opts,"mysql,postgres","Menu option for supported database type"},
323
242
{"sql_database",cf_str,"","Name of database used for the topic map"},
324
243
{"sql_owner",cf_str,"","User id of sql database user"},
325
244
{"sql_passwd",cf_str,"","Embedded password for accessing sql database"},
326
245
{"sql_server",cf_str,"","Name or IP of database server (or localhost)"},
327
246
{"sql_connection_db",cf_str,"","The name of an existing database to connect to in order to create/manage other databases"},
328
{"query_output",cf_opts,"html,text","Menu option for generated output format"},
329
{"query_engine",cf_str,"","Name of a dynamic web-page used to accept and drive queries in a browser"},
330
247
{"style_sheet",cf_str,"","Name of a style-sheet to be used in rendering html output (added to headers)"},
331
{"html_banner",cf_str,"","HTML code for a banner to be added to rendered in html after the header"},
332
{"html_footer",cf_str,"","HTML code for a page footer to be added to rendered in html before the end body tag"},
333
{"graph_output",cf_opts,CF_BOOL,"true/false generate png visualization of topic map if possible (requires lib)"},
334
{"graph_directory",cf_str,CF_PATHRANGE,"Path to directory where rendered .png files will be created"},
335
{"generate_manual",cf_opts,CF_BOOL,"true/false generate texinfo manual page skeleton for this version"},
336
{"manual_source_directory",cf_str,CF_PATHRANGE,"Path to directory where raw text about manual topics is found (defaults to build_directory)"},
337
248
{"view_projections",cf_opts,CF_BOOL,"Perform view-projection analytics in graph generation"},
338
249
{NULL,cf_notype,NULL,NULL}
425
335
struct SubTypeSyntax *CF_ALL_SUBTYPES[CF3_MODULES] =
427
CF_COMMON_SUBTYPES, /* Add modules after this, mod_report.c is here */
428
CF_EXEC_SUBTYPES, /* mod_exec.c */
429
CF_DATABASES_SUBTYPES, /* mod_databases.c */
430
CF_FILES_SUBTYPES, /* mod_files.c */
431
CF_INTERFACES_SUBTYPES, /* mod_interfaces.c */
432
CF_METHOD_SUBTYPES, /* mod_methods.c */
433
CF_PACKAGES_SUBTYPES, /* mod_packages.c */
434
CF_PROCESS_SUBTYPES, /* mod_process.c */
435
CF_SERVICES_SUBTYPES, /* mod_services.c */
436
CF_STORAGE_SUBTYPES, /* mod_storage.c */
437
CF_REMACCESS_SUBTYPES, /* mod_access.c */
438
CF_KNOWLEDGE_SUBTYPES, /* mod_knowledge.c */
439
CF_MEASUREMENT_SUBTYPES,/* mod_measurement.c */
337
CF_COMMON_SUBTYPES, /* Add modules after this, mod_report.c is here */
338
CF_EXEC_SUBTYPES, /* mod_exec.c */
339
CF_DATABASES_SUBTYPES, /* mod_databases.c */
340
CF_ENVIRONMENT_SUBTYPES, /* mod_environ.c */
341
CF_FILES_SUBTYPES, /* mod_files.c */
342
CF_INTERFACES_SUBTYPES, /* mod_interfaces.c */
343
CF_METHOD_SUBTYPES, /* mod_methods.c */
344
CF_OUTPUTS_SUBTYPES, /* mod_outputs.c */
345
CF_PACKAGES_SUBTYPES, /* mod_packages.c */
346
CF_PROCESS_SUBTYPES, /* mod_process.c */
347
CF_SERVICES_SUBTYPES, /* mod_services.c */
348
CF_STORAGE_SUBTYPES, /* mod_storage.c */
349
CF_REMACCESS_SUBTYPES, /* mod_access.c */
350
CF_KNOWLEDGE_SUBTYPES, /* mod_knowledge.c */
351
CF_MEASUREMENT_SUBTYPES, /* mod_measurement.c */
441
353
/* update CF3_MODULES in cf3.defs.h */