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
Go to the documentation of this file.
1 /*
2  Copyright 2019 Northern.tech AS
3 
4  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the
8  Free Software Foundation; version 3.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 
19  To the extent this program is licensed as part of the Enterprise
20  versions of CFEngine, the applicable Commercial Open Source License
21  (COSL) may apply to this file if you as a licensee so wish it. See
22  included file COSL.txt.
23 */
24 
25 #ifndef CFENGINE_CONVERSION_H
26 #define CFENGINE_CONVERSION_H
27 
28 #include <cf3.defs.h>
29 
30 // Type-String conversion
34 Interval IntervalFromString(const char *s);
36 UserState UserStateFromString(const char *s);
38 ContextScope ContextScopeFromString(const char *scope_str);
41 DataType DataTypeFromString(const char *name);
42 const char *DataTypeToString(DataType dtype);
46 NewPackageAction GetNewPackagePolicy(const char *s, const char **action_types);
47 AclMethod AclMethodFromString(const char *string);
48 AclType AclTypeFromString(const char *string);
49 AclDefault AclDefaultFromString(const char *string);
50 AclInherit AclInheritFromString(const char *string);
51 int SignalFromString(const char *s);
52 int SyslogPriorityFromString(const char *s);
53 ShellType ShellTypeFromString(const char *s);
54 
55 // Date/Time conversion
56 void TimeToDateStr(time_t t, char *outStr, int outStrSz);
57 int Month2Int(const char *string);
58 
59 // Evalaution conversion
60 bool BooleanFromString(const char *val);
61 long IntFromString(const char *s);
62 bool DoubleFromString(const char *s, double *value_out);
63 bool IntegerRangeFromString(const char *intrange, long *min_out, long *max_out);
64 bool IsRealNumber(const char *s);
65 
66 
67 // Misc.
68 char *Rlist2String(Rlist *list, char *sep); // TODO: Yet another Rlist serialization scheme.. Found 5 so far.
69 DataType ConstraintSyntaxGetDataType(const ConstraintSyntax *body_syntax, const char *lval);
70 const char *MapAddress(const char *addr);
71 const char *CommandArg0(const char *execstr);
72 size_t CommandArg0_bound(char *dst, const char *src, size_t dst_size);
73 void CommandPrefix(char *execstr, char *comm);
74 const char *DataTypeShortToType(char *short_type);
76 
77 bool CoarseLaterThan(const char *key, const char *from);
78 int FindTypeInArray(const char *const haystack[], const char *needle, int default_value, int null_value);
79 
80 void UidListDestroy(UidList *uids);
81 void GidListDestroy(GidList *gids);
82 UidList *Rlist2UidList(Rlist *uidnames, const Promise *pp);
83 GidList *Rlist2GidList(Rlist *gidnames, const Promise *pp);
84 #ifndef __MINGW32__
85 uid_t Str2Uid(const char *uidbuff, char *copy, const Promise *pp);
86 gid_t Str2Gid(const char *gidbuff, char *copy, const Promise *pp);
87 #endif /* !__MINGW32__ */
88 
89 #endif
MeasurePolicy
Definition: cf3.defs.h:1395
FileComparator
Definition: cf3.defs.h:696
PackageVersionComparator
Definition: cf3.defs.h:791
NewPackageAction
Definition: cf3.defs.h:784
Interval
Definition: cf3.defs.h:689
PackageAction
Definition: cf3.defs.h:772
DatabaseType
Definition: cf3.defs.h:974
AclMethod
Definition: cf3.defs.h:827
ShellType
Definition: cf3.defs.h:1105
PackageActionPolicy
Definition: cf3.defs.h:802
InsertMatchType
Definition: cf3.defs.h:877
AclDefault
Definition: cf3.defs.h:842
AclInherit
Definition: cf3.defs.h:851
DataType
Definition: cf3.defs.h:368
ContextScope
Definition: cf3.defs.h:945
PasswordFormat
Definition: cf3.defs.h:1441
EnvironmentState
Definition: cf3.defs.h:1477
AclType
Definition: cf3.defs.h:834
FileLinkType
Definition: cf3.defs.h:708
UserState
Definition: cf3.defs.h:1433
FileComparator FileComparatorFromString(const char *s)
Definition: conversion.c:289
AclInherit AclInheritFromString(const char *string)
Definition: conversion.c:679
GidList * Rlist2GidList(Rlist *gidnames, const Promise *pp)
Definition: conversion.c:1063
AclType AclTypeFromString(const char *string)
Definition: conversion.c:654
gid_t Str2Gid(const char *gidbuff, char *copy, const Promise *pp)
Definition: conversion.c:1175
PackageAction PackageActionFromString(const char *s)
Definition: conversion.c:170
const char * CommandArg0(const char *execstr)
Definition: conversion.c:882
int FindTypeInArray(const char *const haystack[], const char *needle, int default_value, int null_value)
Definition: conversion.c:51
DataType DataTypeFromString(const char *name)
Definition: conversion.c:318
bool DoubleFromString(const char *s, double *value_out)
Definition: conversion.c:521
uid_t Str2Uid(const char *uidbuff, char *copy, const Promise *pp)
Definition: conversion.c:1087
DatabaseType DatabaseTypeFromString(const char *s)
Definition: conversion.c:148
bool BooleanFromString(const char *val)
Definition: conversion.c:354
EnvironmentState EnvironmentStateFromString(const char *s)
Definition: conversion.c:77
size_t CommandArg0_bound(char *dst, const char *src, size_t dst_size)
Definition: conversion.c:848
UserState UserStateFromString(const char *s)
Definition: conversion.c:155
PasswordFormat PasswordFormatFromString(const char *s)
Definition: conversion.c:163
void GidListDestroy(GidList *gids)
Definition: conversion.c:1026
char * Rlist2String(Rlist *list, char *sep)
Definition: conversion.c:202
FileLinkType FileLinkTypeFromString(const char *s)
Definition: conversion.c:281
bool DataTypeIsIterable(DataType t)
Definition: conversion.c:757
PackageActionPolicy PackageActionPolicyFromString(const char *s)
Definition: conversion.c:192
long IntFromString(const char *s)
Definition: conversion.c:390
int Month2Int(const char *string)
Definition: conversion.c:802
AclDefault AclDefaultFromString(const char *string)
Definition: conversion.c:671
PackageVersionComparator PackageVersionComparatorFromString(const char *s)
Definition: conversion.c:184
int SignalFromString(const char *s)
Definition: conversion.c:221
bool CoarseLaterThan(const char *key, const char *from)
Definition: conversion.c:772
void TimeToDateStr(time_t t, char *outStr, int outStrSz)
Definition: conversion.c:825
ContextScope ContextScopeFromString(const char *scope_str)
Definition: conversion.c:275
int SyslogPriorityFromString(const char *s)
Definition: conversion.c:94
bool IsRealNumber(const char *s)
Definition: conversion.c:940
NewPackageAction GetNewPackagePolicy(const char *s, const char **action_types)
Definition: conversion.c:179
DataType ConstraintSyntaxGetDataType(const ConstraintSyntax *body_syntax, const char *lval)
Definition: conversion.c:337
void CommandPrefix(char *execstr, char *comm)
Definition: conversion.c:917
UidList * Rlist2UidList(Rlist *uidnames, const Promise *pp)
Definition: conversion.c:1002
const char * DataTypeToString(DataType dtype)
Definition: conversion.c:331
bool IntegerRangeFromString(const char *intrange, long *min_out, long *max_out)
Definition: conversion.c:607
ShellType ShellTypeFromString(const char *s)
Definition: conversion.c:103
InsertMatchType InsertMatchTypeFromString(const char *s)
Definition: conversion.c:85
Interval IntervalFromString(const char *s)
Definition: conversion.c:514
const char * DataTypeShortToType(char *short_type)
Definition: conversion.c:710
MeasurePolicy MeasurePolicyFromString(const char *s)
Definition: conversion.c:69
const char * MapAddress(const char *addr)
Definition: conversion.c:38
AclMethod AclMethodFromString(const char *string)
Definition: conversion.c:646
void UidListDestroy(UidList *uids)
Definition: conversion.c:963
Definition: rlist.h:35