1 /* This file is part of GNU Pies
2    Copyright (C) 2009-2020 Sergey Poznyakoff
3 
4    GNU Pies is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3, or (at your option)
7    any later version.
8 
9    GNU Pies is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with GNU Pies.  If not, see <http://www.gnu.org/licenses/>. */
16 
17 /* acl.c */
18 typedef struct pies_acl *pies_acl_t;
19 
20 struct acl_input
21 {
22   struct sockaddr *addr;
23   socklen_t addrlen;
24   pies_identity_t identity;
25 };
26 
27 pies_acl_t pies_acl_create (const char *name, grecs_locus_t *locus);
28 void pies_acl_destroy (pies_acl_t *pacl);
29 void pies_acl_free (pies_acl_t acl);
30 void pies_acl_use (pies_acl_t acl);
31 int pies_acl_cmp (struct pies_acl *a, struct pies_acl *b);
32 int pies_acl_check (pies_acl_t acl, struct acl_input *input, int result);
33 int parse_acl_line (grecs_locus_t *locus, int allow, pies_acl_t acl,
34 		    grecs_value_t *value);
35 pies_acl_t pies_acl_lookup (const char *name);
36 pies_acl_t pies_acl_install (pies_acl_t acl);
37 
38 int assert_grecs_value_type (grecs_locus_t *locus,
39 			     const grecs_value_t *value, int type);
40 
41 extern struct grecs_keyword acl_keywords[];
42 extern int acl_section_parser (enum grecs_callback_command cmd,
43 			       grecs_node_t *node,
44 			       void *varptr, void *cb_data);
45 extern int defacl_section_parser (enum grecs_callback_command cmd,
46 				  grecs_node_t *node,
47 				  void *varptr, void *cb_data);
48