2 * ausearch-nvpair.h - Header file for ausearch-nvpair.c
3 * Copyright (c) 2006-08 Red Hat Inc., Durham, North Carolina.
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
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.
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.
21 * Steve Grubb <sgrubb@redhat.com>
24 #ifndef AUNVPAIR_HEADER
25 #define AUNVPAIR_HEADER
28 #include <sys/types.h>
30 /* This is the node of the linked list. message & item are the only elements
31 * at this time. Any data elements that are per item goes here. */
32 typedef struct _nvnode{
33 char *name; // The name string
34 long val; // The value field
35 struct _nvnode* next; // Next nvpair node pointer
38 /* This is the linked list head. Only data elements that are 1 per
41 nvnode *head; // List head
42 nvnode *cur; // Pointer to current node
43 unsigned int cnt; // How many items in this list
46 void nvlist_create(nvlist *l);
47 static inline void nvlist_first(nvlist *l) { l->cur = l->head; }
48 nvnode *nvlist_next(nvlist *l);
49 static inline nvnode *nvlist_get_cur(nvlist *l) { return l->cur; }
50 void nvlist_append(nvlist *l, nvnode *node);
51 void nvlist_clear(nvlist* l);
53 /* Given a numeric index, find that record. */
54 int nvlist_find_val(nvlist *l, long val);