1 /* $Id: list.h,v 1.8 2009/02/09 04:12:07 manu Exp $ */
2 
3 /*
4  * Copyright (c) 2006 Emmanuel Dreyfus
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *        This product includes software developed by Emmanuel Dreyfus
18  *
19  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
20  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _LIST_H_
33 #define _LIST_H_
34 
35 LIST_HEAD(all_list, all_list_entry);
36 
37 extern struct all_list_entry *glist;
38 
39 struct list_entry {
40 	struct acl_clause_rec *l_acr;
41 	acl_data_t l_data;
42 	TAILQ_ENTRY(list_entry) l_list;
43 };
44 
45 struct all_list_entry {
46 	struct acl_clause_rec *al_acr;
47 	char al_name[QSTRLEN + 1];
48 	LIST_ENTRY(all_list_entry) al_list;
49 	TAILQ_HEAD(,list_entry) al_head;
50 };
51 
52 void all_list_init(void);
53 void all_list_clear(void);
54 
55 struct all_list_entry *all_list_get(acl_clause_t, char *);
56 void all_list_put(struct all_list_entry *);
57 void list_add(struct all_list_entry *, acl_clause_t, void *);
58 void list_add_netblock(struct all_list_entry *,
59     struct sockaddr *, socklen_t, int);
60 void all_list_settype(struct all_list_entry *, acl_clause_t);
61 void all_list_setname(struct all_list_entry *, char *);
62 void glist_init(void);
63 struct all_list_entry *all_list_byname(char *);
64 
65 #endif /* _LIST_H_ */
66