Imported Upstream version 2.4.3
[platform/upstream/audit.git] / src / auditctl-llist.h
1 /*
2 * auditctl-llist.h - Header file for ausearch-llist.c
3 * Copyright (c) 2005 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 CTLLIST_HEADER
25 #define CTLLIST_HEADER
26
27 #include "config.h"
28 #include <sys/types.h>
29 #include "libaudit.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   struct audit_rule_data *r; // The rule from the kernel
35   size_t size;          // Size of the rule struct
36   struct _lnode *next;  // Next node pointer
37 } lnode;
38
39 /* This is the linked list head. Only data elements that are 1 per
40  * event goes here. */
41 typedef struct {
42   lnode *head;          // List head
43   lnode *cur;           // Pointer to current node
44   unsigned int cnt;     // How many items in this list
45 } llist;
46
47 void list_create(llist *l);
48 void list_first(llist *l);
49 void list_last(llist *l);
50 lnode *list_next(llist *l);
51 static inline lnode *list_get_cur(llist *l) { return l->cur; }
52 void list_append(llist *l, struct audit_rule_data *r, size_t sz);
53 void list_clear(llist* l);
54
55 #endif
56