Imported Upstream version 2.4.3
[platform/upstream/audit.git] / audisp / audispd-llist.h
1 /*
2 * audispd-llist.h - Header file for ausearch-conf_llist.c
3 * Copyright (c) 2007,2013 Red Hat Inc., Durham, North Carolina.
4 * All Rights Reserved.
5 *
6 * This software may be freely redistributed and/or modified under the
7 * terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * Authors:
21 *   Steve Grubb <sgrubb@redhat.com>
22 */
23
24 #ifndef AUDISP_LIST_HEADER
25 #define AUDISP_LIST_HEADER
26
27 #include "config.h"
28 #include <sys/types.h>
29 #include "audispd-pconfig.h"
30
31 /* This is the node of the linked list. message & item are the only elements
32  * at this time. Any data elements that are per item goes here. */
33 typedef struct _lnode{
34   plugin_conf_t *p;     // The rule from the kernel
35   struct _lnode *next;  // Next node pointer
36 } lnode;
37
38 /* This is the linked list head. Only data elements that are 1 per
39  * event goes here. */
40 typedef struct {
41   lnode *head;          // List head
42   lnode *cur;           // Pointer to current node
43   unsigned int cnt;     // How many items in this list
44 } conf_llist;
45
46 void plist_create(conf_llist *l);
47 static inline void plist_first(conf_llist *l) { l->cur = l->head; }
48 static inline unsigned int plist_count(conf_llist *l) { return l->cnt; }
49 unsigned int plist_count_active(const conf_llist *l);
50 void plist_last(conf_llist *l);
51 lnode *plist_next(conf_llist *l);
52 static inline lnode *plist_get_cur(conf_llist *l) { return l->cur; }
53 void plist_append(conf_llist *l, plugin_conf_t *p);
54 void plist_clear(conf_llist* l);
55 void plist_mark_all_unchecked(conf_llist* l);
56 lnode *plist_find_unchecked(conf_llist* l);
57 lnode *plist_find_name(conf_llist* l, const char *name);
58
59 #endif
60