Imported Upstream version 2.4.3
[platform/upstream/audit.git] / src / ausearch-lol.h
1 /*
2 * ausearch-lol.h - linked list of linked lists library header
3 * Copyright (c) 2008 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 AUSEARCH_LOL_HEADER
25 #define AUSEARCH_LOL_HEADER
26
27 #include "config.h"
28 #include "ausearch-llist.h"
29
30 typedef enum { L_EMPTY, L_BUILDING, L_COMPLETE } lol_t;
31  
32 /* This is the node of the linked list. message & item are the only elements
33  * at this time. Any data elements that are per item goes here. */
34 typedef struct _lolnode{
35   llist *l;                     // The linked list
36   int status;                   // 0 = empty, 1 in use, 2 complete
37 } lolnode;
38
39 /* This is the linked list head. Only data elements that are 1 per
40  * event goes here. */
41 typedef struct {
42   lolnode *array;
43   int maxi;             // Largest index used
44   int limit;            // Number of nodes in the array
45 } lol;
46
47 void lol_create(lol *lo);
48 void lol_clear(lol *lo);
49 int lol_add_record(lol *lo, char *buff);
50 void terminate_all_events(lol *lo);
51 llist* get_ready_event(lol *lo);
52
53 #endif
54