cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

generic_agent.h File Reference
#include <cf3.defs.h>
#include <policy.h>
#include <set.h>
Include dependency graph for generic_agent.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GenericAgentConfig
 

Macros

#define GENERIC_AGENT_CHECKSUM_SIZE   ((2*CF_SHA1_LEN) + 1)
 
#define GENERIC_AGENT_CHECKSUM_METHOD   HASH_METHOD_SHA1
 

Typedefs

typedef void(* GenericAgentSetDefaultDigest__type) (int32_t __start_canary, int *__successful, HashMethod *digest, int *digest_len, int32_t __end_canary)
 
typedef void(* GenericAgentAddEditionClasses__type) (int32_t __start_canary, int *__successful, EvalContext *ctx, int32_t __end_canary)
 
typedef void(* GenericAgentWriteVersion__type) (int32_t __start_canary, int *__successful, Writer *w, int32_t __end_canary)
 

Enumerations

enum  generic_agent_config_common_policy_output_format {
  GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_NONE , GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_CF , GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_JSON , GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_CF_FULL ,
  GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_JSON_FULL
}
 

Functions

void GenericAgentSetDefaultDigest (HashMethod *digest, int *digest_len)
 
void GenericAgentSetDefaultDigest__stub (HashMethod *digest, int *digest_len)
 
const char * GenericAgentResolveInputPath (const GenericAgentConfig *config, const char *input_file)
 
void MarkAsPolicyServer (EvalContext *ctx)
 
void GenericAgentDiscoverContext (EvalContext *ctx, GenericAgentConfig *config, const char *program_name)
 
bool GenericAgentCheckPolicy (GenericAgentConfig *config, bool force_validation, bool write_validated_file)
 
void GenericAgentAddEditionClasses (EvalContext *ctx)
 
void GenericAgentAddEditionClasses__stub (EvalContext *ctx)
 
void GenericAgentInitialize (EvalContext *ctx, GenericAgentConfig *config)
 
void GenericAgentFinalize (EvalContext *ctx, GenericAgentConfig *config)
 
void GenericAgentWriteVersion (Writer *w)
 
void GenericAgentWriteVersion__stub (Writer *w)
 
bool GenericAgentArePromisesValid (const GenericAgentConfig *config)
 
time_t ReadTimestampFromPolicyValidatedFile (const GenericAgentConfig *config, const char *maybe_dirname)
 
bool GenericAgentIsPolicyReloadNeeded (const GenericAgentConfig *config)
 
void CloseLog (void)
 
SeqControlBodyConstraints (const Policy *policy, AgentType agent)
 
void SetFacility (const char *retval)
 
void CheckBundleParameters (char *scope, Rlist *args)
 
void WritePID (char *filename)
 
bool GenericAgentConfigParseArguments (GenericAgentConfig *config, int argc, char **argv)
 
bool GenericAgentConfigParseWarningOptions (GenericAgentConfig *config, const char *warning_options)
 
bool GenericAgentConfigParseColor (GenericAgentConfig *config, const char *mode)
 
PolicySelectAndLoadPolicy (GenericAgentConfig *config, EvalContext *ctx, bool validate_policy, bool write_validated_file)
 
GenericAgentConfigGenericAgentConfigNewDefault (AgentType agent_type, bool tty_interactive)
 
bool GetTTYInteractive (void)
 
void GenericAgentConfigDestroy (GenericAgentConfig *config)
 
void GenericAgentConfigApply (EvalContext *ctx, const GenericAgentConfig *config)
 
bool CheckAndGenerateFailsafe (const char *inputdir, const char *input_file)
 
void GenericAgentConfigSetInputFile (GenericAgentConfig *config, const char *inputdir, const char *input_file)
 
void GenericAgentConfigSetBundleSequence (GenericAgentConfig *config, const Rlist *bundlesequence)
 
bool GenericAgentTagReleaseDirectory (const GenericAgentConfig *config, const char *dirname, bool write_validated, bool write_release)
 Writes the policy validation file and release ID to a directory. More...
 
void GetReleaseIdFile (const char *base_path, char *filename, size_t max_size)
 Gets the release_id file name in the given base_path. More...
 
bool GenericAgentPostLoadInit (const EvalContext *ctx)
 
void SetupSignalsForAgent (void)
 
void LoadAugments (EvalContext *ctx, GenericAgentConfig *config)
 
void GenericAgentShowContextsFormatted (EvalContext *ctx, const char *regexp)
 
void GenericAgentShowVariablesFormatted (EvalContext *ctx, const char *regexp)
 

Macro Definition Documentation

◆ GENERIC_AGENT_CHECKSUM_METHOD

#define GENERIC_AGENT_CHECKSUM_METHOD   HASH_METHOD_SHA1

Definition at line 34 of file generic_agent.h.

◆ GENERIC_AGENT_CHECKSUM_SIZE

#define GENERIC_AGENT_CHECKSUM_SIZE   ((2*CF_SHA1_LEN) + 1)

Definition at line 33 of file generic_agent.h.

Typedef Documentation

◆ GenericAgentAddEditionClasses__type

typedef void(* GenericAgentAddEditionClasses__type) (int32_t __start_canary, int *__successful, EvalContext *ctx, int32_t __end_canary)

Definition at line 112 of file generic_agent.h.

◆ GenericAgentSetDefaultDigest__type

typedef void(* GenericAgentSetDefaultDigest__type) (int32_t __start_canary, int *__successful, HashMethod *digest, int *digest_len, int32_t __end_canary)

Definition at line 106 of file generic_agent.h.

◆ GenericAgentWriteVersion__type

typedef void(* GenericAgentWriteVersion__type) (int32_t __start_canary, int *__successful, Writer *w, int32_t __end_canary)

Definition at line 115 of file generic_agent.h.

Enumeration Type Documentation

◆ generic_agent_config_common_policy_output_format

Enumerator
GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_NONE 
GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_CF 
GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_JSON 
GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_CF_FULL 
GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_JSON_FULL 

Definition at line 36 of file generic_agent.h.

Function Documentation

◆ CheckAndGenerateFailsafe()

bool CheckAndGenerateFailsafe ( const char *  inputdir,
const char *  input_file 
)

◆ CheckBundleParameters()

void CheckBundleParameters ( char *  scope,
Rlist args 
)

◆ CloseLog()

void CloseLog ( void  )

Definition at line 997 of file generic_agent.c.

Referenced by ActAsDaemon(), SetFacility(), and StartServer().

◆ ControlBodyConstraints()

Seq* ControlBodyConstraints ( const Policy policy,
AgentType  agent 
)

◆ GenericAgentAddEditionClasses()

void GenericAgentAddEditionClasses ( EvalContext ctx)

Definition at line 1003 of file generic_agent.c.

References EvalContextClassPutHard().

Referenced by GenericAgentInitialize().

◆ GenericAgentAddEditionClasses__stub()

void GenericAgentAddEditionClasses__stub ( EvalContext ctx)

Definition at line 1003 of file generic_agent.c.

◆ GenericAgentArePromisesValid()

◆ GenericAgentCheckPolicy()

◆ GenericAgentConfigApply()

◆ GenericAgentConfigDestroy()

◆ GenericAgentConfigNewDefault()

GenericAgentConfig* GenericAgentConfigNewDefault ( AgentType  agent_type,
bool  tty_interactive 
)

Definition at line 1909 of file generic_agent.c.

References GenericAgentConfig::agent, GenericAgentConfig::agent_specific, GenericAgentConfig::agent_type, AGENT_TYPE_AGENT, AGENT_TYPE_COMMON, GenericAgentConfig::bootstrap_argument, GenericAgentConfig::bootstrap_host, GenericAgentConfig::bootstrap_ip, GenericAgentConfig::bootstrap_port, GenericAgentConfig::bootstrap_trigger_policy, GenericAgentConfig::bootstrap_trust_server, GenericAgentConfig::bundlesequence, CF_AGENTTYPES, CF_PROTOCOL_UNDEFINED, GenericAgentConfig::check_not_writable_by_others, GenericAgentConfig::check_runnable, GenericAgentConfig::color, GenericAgentConfig::common, GenericAgentConfig::eval_functions, GENERIC_AGENT_CONFIG_COMMON_POLICY_OUTPUT_FORMAT_NONE, getenv(), GenericAgentConfig::heap_negated, GenericAgentConfig::heap_soft, GenericAgentConfig::ignore_locks, GenericAgentConfig::ignore_missing_bundles, GenericAgentConfig::ignore_missing_inputs, GenericAgentConfig::input_dir, GenericAgentConfig::input_file, LoggingSetAgentType(), NULL, GenericAgentConfig::original_input_file, PARSER_WARNING_ALL, GenericAgentConfig::parser_warnings, GenericAgentConfig::parser_warnings_error, GenericAgentConfig::policy_output_format, GenericAgentConfig::protocol_version, GenericAgentConfig::report_class_log, GenericAgentConfig::show_classes, GenericAgentConfig::show_evaluated_classes, GenericAgentConfig::show_evaluated_variables, GenericAgentConfig::show_variables, GenericAgentConfig::tty_interactive, and xmalloc().

Referenced by CheckOpts().

◆ GenericAgentConfigParseArguments()

bool GenericAgentConfigParseArguments ( GenericAgentConfig config,
int  argc,
char **  argv 
)

Definition at line 1814 of file generic_agent.c.

References GenericAgentConfigSetInputFile(), MINUSF, and NULL.

Referenced by CheckOpts().

◆ GenericAgentConfigParseColor()

bool GenericAgentConfigParseColor ( GenericAgentConfig config,
const char *  mode 
)

◆ GenericAgentConfigParseWarningOptions()

◆ GenericAgentConfigSetBundleSequence()

void GenericAgentConfigSetBundleSequence ( GenericAgentConfig config,
const Rlist bundlesequence 
)

Definition at line 2101 of file generic_agent.c.

References GenericAgentConfig::bundlesequence, RlistCopy(), and RlistDestroy().

Referenced by CheckOpts(), and ScheduleRun().

◆ GenericAgentConfigSetInputFile()

◆ GenericAgentDiscoverContext()

void GenericAgentDiscoverContext ( EvalContext ctx,
GenericAgentConfig config,
const char *  program_name 
)

◆ GenericAgentFinalize()

void GenericAgentFinalize ( EvalContext ctx,
GenericAgentConfig config 
)

◆ GenericAgentInitialize()

◆ GenericAgentIsPolicyReloadNeeded()

bool GenericAgentIsPolicyReloadNeeded ( const GenericAgentConfig config)

@NOTE Updates the config->agent_specific.daemon.last_validated_at timestamp used by serverd, execd etc daemons when checking for new policies.

Definition at line 1472 of file generic_agent.c.

References GenericAgentTagReleaseDirectory(), GetErrorStr(), GetInputDir(), GetWorkDir(), GenericAgentConfig::input_file, IsNewerFileTree(), Log(), LOG_LEVEL_INFO, LOG_LEVEL_VERBOSE, MapName(), MAX_FILENAME, NULL, and ReadTimestampFromPolicyValidatedFile().

Referenced by IsPolicyPrecheckNeeded().

◆ GenericAgentPostLoadInit()

bool GenericAgentPostLoadInit ( const EvalContext ctx)

◆ GenericAgentResolveInputPath()

const char* GenericAgentResolveInputPath ( const GenericAgentConfig config,
const char *  input_file 
)

◆ GenericAgentSetDefaultDigest()

void GenericAgentSetDefaultDigest ( HashMethod digest,
int *  digest_len 
)

Definition at line 139 of file generic_agent.c.

References CF_MD5_LEN, and HASH_METHOD_MD5.

Referenced by GenericAgentDiscoverContext(), and main().

◆ GenericAgentSetDefaultDigest__stub()

void GenericAgentSetDefaultDigest__stub ( HashMethod digest,
int *  digest_len 
)

Definition at line 139 of file generic_agent.c.

◆ GenericAgentShowContextsFormatted()

◆ GenericAgentShowVariablesFormatted()

◆ GenericAgentTagReleaseDirectory()

bool GenericAgentTagReleaseDirectory ( const GenericAgentConfig config,
const char *  dirname,
bool  write_validated,
bool  write_release 
)

◆ GenericAgentWriteVersion()

void GenericAgentWriteVersion ( Writer w)

Definition at line 1755 of file generic_agent.c.

References NameVersion(), and WriterWriteF().

Referenced by CheckOpts().

◆ GenericAgentWriteVersion__stub()

void GenericAgentWriteVersion__stub ( Writer w)

Definition at line 1755 of file generic_agent.c.

◆ GetReleaseIdFile()

void GetReleaseIdFile ( const char *  base_path,
char *  filename,
size_t  max_size 
)

Gets the release_id file name in the given base_path.

Definition at line 1388 of file generic_agent.c.

References MapName().

Referenced by GenericAgentTagReleaseDirectory(), LoadPolicy(), ReadReleaseIdFileFromInputs(), ReadReleaseIdFileFromMasterfiles(), and SelectAndLoadPolicy().

◆ GetTTYInteractive()

bool GetTTYInteractive ( void  )

Definition at line 1904 of file generic_agent.c.

Referenced by CheckOpts().

◆ LoadAugments()

◆ MarkAsPolicyServer()

void MarkAsPolicyServer ( EvalContext ctx)

Definition at line 145 of file generic_agent.c.

References EvalContextClassPutHard(), Log(), and LOG_LEVEL_VERBOSE.

Referenced by GenericAgentDiscoverContext().

◆ ReadTimestampFromPolicyValidatedFile()

time_t ReadTimestampFromPolicyValidatedFile ( const GenericAgentConfig config,
const char *  maybe_dirname 
)

◆ SelectAndLoadPolicy()

◆ SetFacility()

void SetFacility ( const char *  retval)

◆ SetupSignalsForAgent()

void SetupSignalsForAgent ( void  )

Definition at line 2117 of file generic_agent.c.

References HandleSignalsForAgent().

Referenced by main().

◆ WritePID()