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)  

Go to the documentation of this file.
1 /*
2  Copyright 2019 AS
4  This file is part of CFEngine 3 - written and maintained by AS.
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.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  GNU General Public License for more details.
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
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 */
28 #include <cf3.defs.h>
29 #include <writer.h>
30 #include <file_lib.h>
32 struct Item_
33 {
34  char *name;
35  char *classes;
36  int counter;
37  time_t time;
39 };
41 typedef enum
42 {
53 void PrintItemList(const Item *list, Writer *w);
54 void PrependFullItem(Item **liststart, const char *itemstring, const char *classes, int counter, time_t t);
55 Item *ReturnItemIn(Item *list, const char *item);
56 Item *ReturnItemInClass(Item *list, const char *item, const char *classes);
57 Item *ReturnItemAtIndex(Item *list, int index);
58 Item *EndOfList(Item *start);
59 void PrependItemList(Item **liststart, const char *itemstring);
60 void InsertAfter(Item **filestart, Item *ptr, const char *string);
61 bool RawSaveItemList(const Item *liststart, const char *filename, NewLineMode new_line_mode);
62 Item *RawLoadItemList(const char *filename);
63 Item *SplitStringAsItemList(const char *string, char sep);
64 Item *SplitString(const char *string, char sep);
65 bool DeleteItemGeneral(Item **filestart, const char *string, ItemMatchType type);
66 bool DeleteItemLiteral(Item **filestart, const char *string);
67 bool DeleteItemStarting(Item **list, const char *string);
68 bool DeleteItemNotStarting(Item **list, const char *string);
69 bool DeleteItemMatching(Item **list, const char *string);
70 bool DeleteItemNotMatching(Item **list, const char *string);
71 bool DeleteItemContaining(Item **list, const char *string);
72 bool DeleteItemNotContaining(Item **list, const char *string);
73 int ListLen(const Item *list);
74 bool IsItemIn(const Item *list, const char *item);
75 bool ListsCompare(const Item *list1, const Item *list2);
76 bool ListSubsetOfList(const Item *list1, const Item *list2);
77 bool IsMatchItemIn(const Item *list, const char *item);
78 Item *ConcatLists(Item *list1, Item *list2);
79 void CopyList(Item **dest, const Item *source);
80 void IdempItemCount(Item **liststart, const char *itemstring, const char *classes);
81 Item *IdempPrependItem(Item **liststart, const char *itemstring, const char *classes);
82 Item *IdempPrependItemClass(Item **liststart, const char *itemstring, const char *classes);
83 Item *ReverseItemList(Item *list); /* Eats list, spits it out reversed. */
84 Item *PrependItem(Item **liststart, const char *itemstring, const char *classes);
85 /* Warning: AppendItem()'s cost is proportional to list length; it is
86  * usually cheaper to build a list using PrependItem, then reverse it;
87  * building it with AppendItem() is quadratic in length. */
88 void AppendItem(Item **liststart, const char *itemstring, const char *classes);
89 void DeleteItemList(Item *item);
90 void DeleteItem(Item **liststart, Item *item);
91 void IncrementItemListCounter(Item *ptr, const char *string);
92 void SetItemListCounter(Item *ptr, const char *string, int value);
93 char *ItemList2CSV(const Item *list);
94 size_t ItemList2CSV_bound(const Item *list, char *buf, size_t buf_size, char separator);
95 int ItemListSize(const Item *list);
96 bool IsInterfaceAddress(const Item *ip_addresses, const char *adr);
98 #endif
Definition: file_lib.h:35
size_t ItemList2CSV_bound(const Item *list, char *buf, size_t buf_size, char separator)
Definition: item_lib.c:680
bool ListSubsetOfList(const Item *list1, const Item *list2)
Definition: item_lib.c:288
Item * EndOfList(Item *start)
Definition: item_lib.c:309
bool DeleteItemNotContaining(Item **list, const char *string)
Definition: item_lib.c:1009
bool RawSaveItemList(const Item *liststart, const char *filename, NewLineMode new_line_mode)
Definition: item_lib.c:1016
int ListLen(const Item *list)
Definition: item_lib.c:450
bool DeleteItemGeneral(Item **filestart, const char *string, ItemMatchType type)
Definition: item_lib.c:871
Item * ReturnItemInClass(Item *list, const char *item, const char *classes)
Definition: item_lib.c:188
Definition: item_lib.h:42
Definition: item_lib.h:43
Definition: item_lib.h:46
Definition: item_lib.h:44
Definition: item_lib.h:45
Definition: item_lib.h:48
Definition: item_lib.h:50
Definition: item_lib.h:47
Definition: item_lib.h:49
bool DeleteItemStarting(Item **list, const char *string)
Definition: item_lib.c:967
bool DeleteItemNotStarting(Item **list, const char *string)
Definition: item_lib.c:974
void PrependItemList(Item **liststart, const char *itemstring)
Definition: item_lib.c:439
bool DeleteItemLiteral(Item **filestart, const char *string)
Definition: item_lib.c:981
char * ItemList2CSV(const Item *list)
Definition: item_lib.c:641
bool ListsCompare(const Item *list1, const Item *list2)
Definition: item_lib.c:262
bool DeleteItemNotMatching(Item **list, const char *string)
Definition: item_lib.c:995
void PrintItemList(const Item *list, Writer *w)
Definition: item_lib.c:117
bool IsInterfaceAddress(const Item *ip_addresses, const char *adr)
Definition: item_lib.c:1085
void AppendItem(Item **liststart, const char *itemstring, const char *classes)
Definition: item_lib.c:415
void IncrementItemListCounter(Item *ptr, const char *string)
Definition: item_lib.c:734
void IdempItemCount(Item **liststart, const char *itemstring, const char *classes)
Definition: item_lib.c:354
bool DeleteItemContaining(Item **list, const char *string)
Definition: item_lib.c:1002
Item * SplitString(const char *string, char sep)
Definition: item_lib.c:546
void SetItemListCounter(Item *ptr, const char *string, int value)
Definition: item_lib.c:757
Item * SplitStringAsItemList(const char *string, char sep)
Definition: item_lib.c:613
Item * ReturnItemAtIndex(Item *list, int index)
Definition: item_lib.c:213
void DeleteItemList(Item *item)
Definition: item_lib.c:808
int ItemListSize(const Item *list)
Definition: item_lib.c:143
bool IsMatchItemIn(const Item *list, const char *item)
Definition: item_lib.c:780
void CopyList(Item **dest, const Item *source)
Definition: item_lib.c:468
Item * ConcatLists(Item *list1, Item *list2)
Definition: item_lib.c:496
Item * RawLoadItemList(const char *filename)
Definition: item_lib.c:1055
Item * ReturnItemIn(Item *list, const char *item)
Definition: item_lib.c:164
void DeleteItem(Item **liststart, Item *item)
Definition: item_lib.c:823
bool DeleteItemMatching(Item **list, const char *string)
Definition: item_lib.c:988
Item * ReverseItemList(Item *list)
Definition: item_lib.c:97
void PrependFullItem(Item **liststart, const char *itemstring, const char *classes, int counter, time_t t)
Definition: item_lib.c:390
bool IsItemIn(const Item *list, const char *item)
Definition: item_lib.c:226
void InsertAfter(Item **filestart, Item *ptr, const char *string)
Definition: item_lib.c:514
Item * PrependItem(Item **liststart, const char *itemstring, const char *classes)
Definition: item_lib.c:372
Item * IdempPrependItem(Item **liststart, const char *itemstring, const char *classes)
Definition: item_lib.c:326
Item * IdempPrependItemClass(Item **liststart, const char *itemstring, const char *classes)
Definition: item_lib.c:340
Definition: item_lib.h:33
time_t time
Definition: item_lib.h:37
Item * next
Definition: item_lib.h:38
char * classes
Definition: item_lib.h:35
int counter
Definition: item_lib.h:36
char * name
Definition: item_lib.h:34
Definition: writer.c:45