1 /* 2 * ProFTPD - FTP server daemon 3 * Copyright (c) 2003-2016 The ProFTPD Project team 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 * 19 * As a special exemption, the ProFTPD Project team and other respective 20 * copyright holders give permission to link this program with OpenSSL, and 21 * distribute the resulting executable, without including the source code for 22 * OpenSSL in the source distribution. 23 */ 24 25 /* Network ACL definitions */ 26 27 #ifndef PR_NETACL_H 28 #define PR_NETACL_H 29 30 typedef struct pr_netacl_t pr_netacl_t; 31 32 typedef enum { 33 PR_NETACL_TYPE_ALL, 34 PR_NETACL_TYPE_NONE, 35 PR_NETACL_TYPE_IPMASK, 36 PR_NETACL_TYPE_IPMATCH, 37 PR_NETACL_TYPE_DNSMATCH, 38 PR_NETACL_TYPE_IPGLOB, 39 PR_NETACL_TYPE_DNSGLOB 40 41 } pr_netacl_type_t; 42 43 /* Parses the given string into a network ACL ('netacl') object allocated 44 * from the given pool. NULL is returned if there is an error during 45 * the parsing; errno will be set appropriately. 46 */ 47 pr_netacl_t *pr_netacl_create(pool *, char *); 48 49 /* Returns a duplicate of the given netacl allocated from the pool. */ 50 pr_netacl_t *pr_netacl_dup(pool *, const pr_netacl_t *); 51 52 /* Returns 1 if the given netaddr explicitly matches the ACL, -1 if the 53 * netaddr explicitly does not match the ACL (e.g. "none"), and 0 if there is 54 * no match. 55 */ 56 int pr_netacl_match(const pr_netacl_t *, const pr_netaddr_t *); 57 58 /* Returns TRUE if the given netacl is negated, FALSE if it is not negated, 59 * and -1 if there was an error. If -1 is returned, errno will be set 60 * appropriately. 61 */ 62 int pr_netacl_get_negated(const pr_netacl_t *); 63 64 /* Returns the ACL type. */ 65 pr_netacl_type_t pr_netacl_get_type(const pr_netacl_t *); 66 67 /* Returns a string describing the given NetACL. */ 68 const char *pr_netacl_get_str(pool *p, const pr_netacl_t *acl); 69 const char *pr_netacl_get_str2(pool *p, const pr_netacl_t *acl, int flags); 70 #define PR_NETACL_FL_STR_NO_DESC 0x0001 71 72 #endif /* PR_NETACL_H */ 73