acl: typedef access_list to acl_list_t
this allows to switch the underlying implementation easily.
This commit is contained in:
		
							parent
							
								
									efa5892011
								
							
						
					
					
						commit
						ebc7f15ec7
					
				@ -111,7 +111,7 @@ fill_netmask_array (char *bitmask_string, int v6,
 | 
			
		||||
/**
 | 
			
		||||
 * If the access list has not been set up, create it.
 | 
			
		||||
 */
 | 
			
		||||
static int init_access_list(vector_t *access_list)
 | 
			
		||||
static int init_access_list(acl_list_t *access_list)
 | 
			
		||||
{
 | 
			
		||||
        if (!*access_list) {
 | 
			
		||||
                *access_list = vector_create ();
 | 
			
		||||
@ -135,7 +135,7 @@ static int init_access_list(vector_t *access_list)
 | 
			
		||||
 *     0 otherwise.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
insert_acl (char *location, acl_access_t access_type, vector_t *access_list)
 | 
			
		||||
insert_acl (char *location, acl_access_t access_type, acl_list_t *access_list)
 | 
			
		||||
{
 | 
			
		||||
        struct acl_s acl;
 | 
			
		||||
        int ret;
 | 
			
		||||
@ -332,7 +332,7 @@ static int check_numeric_acl (const struct acl_s *acl, uint8_t addr[IPV6_LEN])
 | 
			
		||||
 *     1 if allowed
 | 
			
		||||
 *     0 if denied
 | 
			
		||||
 */
 | 
			
		||||
int check_acl (const char *ip, union sockaddr_union *addr, vector_t access_list)
 | 
			
		||||
int check_acl (const char *ip, union sockaddr_union *addr, acl_list_t access_list)
 | 
			
		||||
{
 | 
			
		||||
        struct acl_s *acl;
 | 
			
		||||
        int perm = 0, is_numeric_addr;
 | 
			
		||||
@ -388,7 +388,7 @@ int check_acl (const char *ip, union sockaddr_union *addr, vector_t access_list)
 | 
			
		||||
        return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void flush_access_list (vector_t access_list)
 | 
			
		||||
void flush_access_list (acl_list_t access_list)
 | 
			
		||||
{
 | 
			
		||||
        struct acl_s *acl;
 | 
			
		||||
        size_t i;
 | 
			
		||||
 | 
			
		||||
@ -25,11 +25,12 @@
 | 
			
		||||
#include "sock.h"
 | 
			
		||||
 | 
			
		||||
typedef enum { ACL_ALLOW, ACL_DENY } acl_access_t;
 | 
			
		||||
typedef vector_t acl_list_t;
 | 
			
		||||
 | 
			
		||||
extern int insert_acl (char *location, acl_access_t access_type,
 | 
			
		||||
                       vector_t *access_list);
 | 
			
		||||
                       acl_list_t *access_list);
 | 
			
		||||
extern int check_acl (const char *ip_address, union sockaddr_union *addr,
 | 
			
		||||
                      vector_t access_list);
 | 
			
		||||
extern void flush_access_list (vector_t access_list);
 | 
			
		||||
                      acl_list_t access_list);
 | 
			
		||||
extern void flush_access_list (acl_list_t access_list);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,7 @@
 | 
			
		||||
 | 
			
		||||
#include "hashmap.h"
 | 
			
		||||
#include "vector.h"
 | 
			
		||||
#include "acl.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Stores a HTTP header created using the AddHeader directive.
 | 
			
		||||
@ -93,7 +94,7 @@ struct config_s {
 | 
			
		||||
         */
 | 
			
		||||
        char *statpage;
 | 
			
		||||
 | 
			
		||||
        vector_t access_list;
 | 
			
		||||
        acl_list_t access_list;
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Store the list of port allowed by CONNECT.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user