3 * $Id: acl.h,v 1.1 1999/07/01 08:56:23 mdw Exp $
5 * Access control list handling
7 * (c) 1999 Mark Wooding
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the `fw' port forwarder.
14 * `fw' is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * `fw' is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with `fw'; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /*----- Revision history --------------------------------------------------*
32 * Revision 1.1 1999/07/01 08:56:23 mdw
44 /*----- Header files ------------------------------------------------------*/
48 #include <sys/socket.h>
49 #include <netinet/in.h>
51 /*----- Data structures ---------------------------------------------------*/
53 /* --- An access control entry --- */
55 typedef struct acl_entry
{
56 struct acl_entry
*next
; /* Next entry in the list */
57 unsigned act
; /* What to do with matching hosts */
58 struct in_addr addr
, mask
; /* Address and netmask */
61 #define ACL_DENY 0 /* Deny access to matching hosts */
62 #define ACL_ALLOW 1 /* Allow access to matching hosts */
63 #define ACL_PERM 1u /* Bit mask for permission bit */
65 /*----- Functions provided ------------------------------------------------*/
67 /* --- @acl_check@ --- *
69 * Arguments: @acl_entry *a@ = pointer to ACL to check against
70 * @struct in_addr addr@ = address to check
72 * Returns: Nonzero if allowed.
74 * Use: Checks an address against an ACL.
77 extern int acl_check(acl_entry */
*a*/
, struct in_addr
/*addr*/);
79 /* --- @acl_dump@ --- *
81 * Arguments: @acl_entry *a@ = pointer to ACL to dump
82 * @FILE *fp@ = pointer to stream to dump on
86 * Use: Dumps an access control list to an output stream.
89 extern void acl_dump(acl_entry */
*a*/
, FILE */
*fp*/
);
91 /* --- @acl_add@ --- *
93 * Arguments: @acl_entry ***a@ = address of pointer to list tail
94 * @unsigned act@ = what to do with matching addresses
95 * @struct in_addr addr, mask@ = address and mask to match
99 * Use: Adds an entry to the end of an access control list.
102 extern void acl_add(acl_entry
***/
*a*/
, unsigned /*act*/,
103 struct in_addr
/*addr*/, struct in_addr
/*mask*/);
105 /*----- That's all, folks -------------------------------------------------*/