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)  

class.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 #ifndef CFENGINE_CLASS_H
25 #define CFENGINE_CLASS_H
26 
27 #include <cf3.defs.h>
28 #include <set.h>
29 
30 typedef struct
31 {
32  char *ns; /* NULL in case of default namespace */
33  char *name; /* class name */
34 
36  bool is_soft;
38 } Class;
39 
40 
41 typedef struct ClassTable_ ClassTable;
43 
45 void ClassTableDestroy(ClassTable *table);
46 
47 bool ClassTablePut(ClassTable *table, const char *ns, const char *name, bool is_soft, ContextScope scope, const char *tags);
48 Class *ClassTableGet(const ClassTable *table, const char *ns, const char *name);
49 Class *ClassTableMatch(const ClassTable *table, const char *regex);
50 bool ClassTableRemove(ClassTable *table, const char *ns, const char *name);
51 
52 bool ClassTableClear(ClassTable *table);
53 
54 ClassTableIterator *ClassTableIteratorNew(const ClassTable *table, const char *ns, bool is_hard, bool is_soft);
57 
58 typedef struct
59 {
60  char *ns;
61  char *name;
62 } ClassRef;
63 
64 ClassRef ClassRefParse(const char *expr);
65 char *ClassRefToString(const char *ns, const char *name);
67 void ClassRefQualify(ClassRef *ref, const char *ns);
68 void ClassRefDestroy(ClassRef ref);
69 
70 #endif
ContextScope
Definition: cf3.defs.h:945
void ClassTableDestroy(ClassTable *table)
Definition: class.c:127
Class * ClassTableGet(const ClassTable *table, const char *ns, const char *name)
Definition: class.c:162
void ClassRefQualify(ClassRef *ref, const char *ns)
Definition: class.c:339
ClassTableIterator * ClassTableIteratorNew(const ClassTable *table, const char *ns, bool is_hard, bool is_soft)
Definition: class.c:234
ClassTable * ClassTableNew(void)
Definition: class.c:118
char * ClassRefToString(const char *ns, const char *name)
Definition: class.c:319
void ClassRefDestroy(ClassRef ref)
Definition: class.c:345
ClassRef ClassRefParse(const char *expr)
Definition: class.c:295
bool ClassTableRemove(ClassTable *table, const char *ns, const char *name)
Definition: class.c:214
bool ClassRefIsQualified(ClassRef ref)
Definition: class.c:334
bool ClassTablePut(ClassTable *table, const char *ns, const char *name, bool is_soft, ContextScope scope, const char *tags)
Definition: class.c:136
Class * ClassTableMatch(const ClassTable *table, const char *regex)
Definition: class.c:175
void ClassTableIteratorDestroy(ClassTableIterator *iter)
Definition: class.c:286
bool ClassTableClear(ClassTable *table)
Definition: class.c:227
Class * ClassTableIteratorNext(ClassTableIterator *iter)
Definition: class.c:248
Definition: class.h:59
char * name
Definition: class.h:61
char * ns
Definition: class.h:60
MapIterator iter
Definition: class.c:62
Definition: class.h:31
char * ns
Definition: class.h:32
char * name
Definition: class.h:33
bool is_soft
Definition: class.h:36
StringSet * tags
Definition: class.h:37
ContextScope scope
Definition: class.h:35
Definition: set.h:138