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)  

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

Go to the source code of this file.

Functions

MeasurePolicy MeasurePolicyFromString (const char *s)
 
EnvironmentState EnvironmentStateFromString (const char *s)
 
InsertMatchType InsertMatchTypeFromString (const char *s)
 
Interval IntervalFromString (const char *s)
 
DatabaseType DatabaseTypeFromString (const char *s)
 
UserState UserStateFromString (const char *s)
 
PasswordFormat PasswordFormatFromString (const char *s)
 
ContextScope ContextScopeFromString (const char *scope_str)
 
FileComparator FileComparatorFromString (const char *s)
 
FileLinkType FileLinkTypeFromString (const char *s)
 
DataType DataTypeFromString (const char *name)
 
const char * DataTypeToString (DataType dtype)
 
PackageActionPolicy PackageActionPolicyFromString (const char *s)
 
PackageVersionComparator PackageVersionComparatorFromString (const char *s)
 
PackageAction PackageActionFromString (const char *s)
 
NewPackageAction GetNewPackagePolicy (const char *s, const char **action_types)
 
AclMethod AclMethodFromString (const char *string)
 
AclType AclTypeFromString (const char *string)
 
AclDefault AclDefaultFromString (const char *string)
 
AclInherit AclInheritFromString (const char *string)
 
int SignalFromString (const char *s)
 
int SyslogPriorityFromString (const char *s)
 
ShellType ShellTypeFromString (const char *s)
 
void TimeToDateStr (time_t t, char *outStr, int outStrSz)
 
int Month2Int (const char *string)
 
bool BooleanFromString (const char *val)
 
long IntFromString (const char *s)
 
bool DoubleFromString (const char *s, double *value_out)
 
bool IntegerRangeFromString (const char *intrange, long *min_out, long *max_out)
 
bool IsRealNumber (const char *s)
 
char * Rlist2String (Rlist *list, char *sep)
 
DataType ConstraintSyntaxGetDataType (const ConstraintSyntax *body_syntax, const char *lval)
 
const char * MapAddress (const char *addr)
 
const char * CommandArg0 (const char *execstr)
 
size_t CommandArg0_bound (char *dst, const char *src, size_t dst_size)
 
void CommandPrefix (char *execstr, char *comm)
 
const char * DataTypeShortToType (char *short_type)
 
bool DataTypeIsIterable (DataType t)
 
bool CoarseLaterThan (const char *key, const char *from)
 
int FindTypeInArray (const char *const haystack[], const char *needle, int default_value, int null_value)
 
void UidListDestroy (UidList *uids)
 
void GidListDestroy (GidList *gids)
 
UidListRlist2UidList (Rlist *uidnames, const Promise *pp)
 
GidListRlist2GidList (Rlist *gidnames, const Promise *pp)
 
uid_t Str2Uid (const char *uidbuff, char *copy, const Promise *pp)
 
gid_t Str2Gid (const char *gidbuff, char *copy, const Promise *pp)
 

Function Documentation

◆ AclDefaultFromString()

AclDefault AclDefaultFromString ( const char *  string)

Definition at line 671 of file conversion.c.

References ACL_DEFAULT_NONE, FindTypeInArray(), and NULL.

Referenced by GetAclConstraints().

◆ AclInheritFromString()

AclInherit AclInheritFromString ( const char *  string)

Definition at line 679 of file conversion.c.

References ACL_INHERIT_FALSE, ACL_INHERIT_NOCHANGE, ACL_INHERIT_TRUE, CF_BOOL, and NULL.

Referenced by GetAclConstraints().

◆ AclMethodFromString()

AclMethod AclMethodFromString ( const char *  string)

Definition at line 646 of file conversion.c.

References ACL_METHOD_NONE, FindTypeInArray(), and NULL.

Referenced by GetAclConstraints().

◆ AclTypeFromString()

AclType AclTypeFromString ( const char *  string)

Definition at line 654 of file conversion.c.

References ACL_TYPE_NONE, FindTypeInArray(), and NULL.

Referenced by GetAclConstraints().

◆ BooleanFromString()

◆ CoarseLaterThan()

bool CoarseLaterThan ( const char *  key,
const char *  from 
)

Definition at line 772 of file conversion.c.

References CF_SMALLBUF, and Month2Int().

◆ CommandArg0()

◆ CommandArg0_bound()

size_t CommandArg0_bound ( char *  dst,
const char *  src,
size_t  dst_size 
)

Copy first argument of #src to #dst. Argument is delimited either by double quotes if first character is double quotes, or by space.

Note
Thread-safe version of CommandArg0().
Returns
The length of #dst, or (size_t) -1 in case of overflow.

Definition at line 848 of file conversion.c.

References strchrnul(), and strlcpy().

Referenced by DoExec2().

◆ CommandPrefix()

void CommandPrefix ( char *  execstr,
char *  comm 
)

Definition at line 917 of file conversion.c.

Referenced by RepairExec().

◆ ConstraintSyntaxGetDataType()

DataType ConstraintSyntaxGetDataType ( const ConstraintSyntax body_syntax,
const char *  lval 
)

Definition at line 337 of file conversion.c.

References CF_DATA_TYPE_NONE, ConstraintSyntax_::dtype, ConstraintSyntax_::lval, and NULL.

Referenced by ResolveControlBody().

◆ ContextScopeFromString()

ContextScope ContextScopeFromString ( const char *  scope_str)

◆ DatabaseTypeFromString()

DatabaseType DatabaseTypeFromString ( const char *  s)

Definition at line 148 of file conversion.c.

References DATABASE_TYPE_NONE, FindTypeInArray(), and NULL.

Referenced by GetDatabaseConstraints().

◆ DataTypeFromString()

DataType DataTypeFromString ( const char *  name)

◆ DataTypeIsIterable()

◆ DataTypeShortToType()

const char* DataTypeShortToType ( char *  short_type)

Definition at line 710 of file conversion.c.

◆ DataTypeToString()

◆ DoubleFromString()

◆ EnvironmentStateFromString()

EnvironmentState EnvironmentStateFromString ( const char *  s)

◆ FileComparatorFromString()

FileComparator FileComparatorFromString ( const char *  s)

Definition at line 289 of file conversion.c.

References FILE_COMPARATOR_NONE, FindTypeInArray(), and NULL.

Referenced by GetCopyConstraints().

◆ FileLinkTypeFromString()

FileLinkType FileLinkTypeFromString ( const char *  s)

Definition at line 281 of file conversion.c.

References FILE_LINK_TYPE_SYMLINK, FindTypeInArray(), and NULL.

Referenced by GetCopyConstraints(), and GetLinkConstraints().

◆ FindTypeInArray()

◆ GetNewPackagePolicy()

NewPackageAction GetNewPackagePolicy ( const char *  s,
const char **  action_types 
)

Definition at line 179 of file conversion.c.

References FindTypeInArray(), and NEW_PACKAGE_ACTION_NONE.

Referenced by GetNewPackageConstraints().

◆ GidListDestroy()

void GidListDestroy ( GidList gids)

Definition at line 1026 of file conversion.c.

References free(), GidList_::gidname, and GidList_::next.

Referenced by ClearFilesAttributes().

◆ InsertMatchTypeFromString()

InsertMatchType InsertMatchTypeFromString ( const char *  s)

Definition at line 85 of file conversion.c.

References FindTypeInArray(), INSERT_MATCH_TYPE_EXACT, and NULL.

Referenced by MatchPolicy(), and SanityCheckInsertions().

◆ IntegerRangeFromString()

bool IntegerRangeFromString ( const char *  intrange,
long *  min_out,
long *  max_out 
)

◆ IntervalFromString()

Interval IntervalFromString ( const char *  s)

Definition at line 514 of file conversion.c.

References FindTypeInArray(), INTERVAL_NONE, and NULL.

Referenced by FnCallSplayClass().

◆ IntFromString()

◆ IsRealNumber()

bool IsRealNumber ( const char *  s)

Definition at line 940 of file conversion.c.

Referenced by FnCallIsLessGreaterThan().

◆ MapAddress()

const char* MapAddress ( const char *  addr)

Definition at line 38 of file conversion.c.

Referenced by AcceptAndHandle(), LastSaw(), and LastSaw1().

◆ MeasurePolicyFromString()

MeasurePolicy MeasurePolicyFromString ( const char *  s)

Definition at line 69 of file conversion.c.

References FindTypeInArray(), MEASURE_POLICY_AVERAGE, MEASURE_POLICY_NONE, and NULL.

Referenced by GetMeasurementConstraint().

◆ Month2Int()

int Month2Int ( const char *  string)

Definition at line 802 of file conversion.c.

References MONTH_TEXT, and NULL.

Referenced by CoarseLaterThan(), and TimeAbs2Int().

◆ PackageActionFromString()

PackageAction PackageActionFromString ( const char *  s)

Definition at line 170 of file conversion.c.

References FindTypeInArray(), NULL, and PACKAGE_ACTION_NONE.

Referenced by GetPackageConstraints().

◆ PackageActionPolicyFromString()

PackageActionPolicy PackageActionPolicyFromString ( const char *  s)

Definition at line 192 of file conversion.c.

References FindTypeInArray(), NULL, and PACKAGE_ACTION_POLICY_NONE.

Referenced by GetPackageConstraints().

◆ PackageVersionComparatorFromString()

PackageVersionComparator PackageVersionComparatorFromString ( const char *  s)

Definition at line 184 of file conversion.c.

References FindTypeInArray(), NULL, and PACKAGE_VERSION_COMPARATOR_NONE.

Referenced by GetPackageConstraints().

◆ PasswordFormatFromString()

PasswordFormat PasswordFormatFromString ( const char *  s)

Definition at line 163 of file conversion.c.

References FindTypeInArray(), NULL, and PASSWORD_FORMAT_NONE.

Referenced by GetUserConstraints().

◆ Rlist2GidList()

GidList* Rlist2GidList ( Rlist gidnames,
const Promise pp 
)

◆ Rlist2String()

char* Rlist2String ( Rlist list,
char *  sep 
)

◆ Rlist2UidList()

UidList* Rlist2UidList ( Rlist uidnames,
const Promise pp 
)

◆ ShellTypeFromString()

ShellType ShellTypeFromString ( const char *  s)

Definition at line 103 of file conversion.c.

References CF_BOOL, NULL, SHELL_TYPE_NONE, SHELL_TYPE_POWERSHELL, and SHELL_TYPE_USE.

Referenced by GetExecContainConstraints().

◆ SignalFromString()

◆ Str2Gid()

gid_t Str2Gid ( const char *  gidbuff,
char *  copy,
const Promise pp 
)

◆ Str2Uid()

◆ SyslogPriorityFromString()

int SyslogPriorityFromString ( const char *  s)

Definition at line 94 of file conversion.c.

References FindTypeInArray(), and NULL.

Referenced by GetTransactionConstraints().

◆ TimeToDateStr()

void TimeToDateStr ( time_t  t,
char *  outStr,
int  outStrSz 
)

Formats a time as "30 Sep 2010".

Definition at line 825 of file conversion.c.

References CF_SMALLBUF.

◆ UidListDestroy()

void UidListDestroy ( UidList uids)

Definition at line 963 of file conversion.c.

References free(), UidList_::next, and UidList_::uidname.

Referenced by ClearFilesAttributes().

◆ UserStateFromString()

UserState UserStateFromString ( const char *  s)

Definition at line 155 of file conversion.c.

References FindTypeInArray(), NULL, and USER_STATE_NONE.

Referenced by GetUserConstraints().