34 static int ip_comp (
const void *arg1,
const void *arg2);
36 static int ipstr2int (
char *str,
char **endp,
char next_char);
52 if (acl_file[0] ==
'\0')
66 fp = fopen (acl_file,
"r");
72 while (fgets (read_buf,
sizeof (read_buf), fp) !=
NULL)
86 acl = (
T_IP *) malloc (
sizeof (
T_IP));
90 acl = (
T_IP *) realloc (acl,
sizeof (
T_IP) * num_acl);
98 acl[num_acl - 1] = ip_addr;
119 for (i = 0; i < v3_acl->
num_acl; i++)
130 if (memcmp (ip_addr, v3_acl->
acl[i].
ip, len) == 0)
142 const T_IP *ip1 = (
const T_IP *) arg1;
143 const T_IP *ip2 = (
const T_IP *) arg2;
156 memset (ip_addr, 0,
sizeof (
T_IP));
158 for (i = 0; i < 4; i++)
178 ip_addr->
ip[
i] = (
unsigned char) val;
195 if (*(str + 1) !=
'\0')
204 if ((result != 0) || (**endp != next_char))
209 if (val < 0 || val > 255)
#define UW_ER_NO_MORE_MEMORY
#define UW_SET_ERROR_CODE(code, os_errno)
static int ipstr2int(char *str, char **endp, char next_char)
static int ip_comp(const void *arg1, const void *arg2)
int str_to_int32(int *ret_p, char **end_p, const char *str_p, int base)
unsigned char ip[IPV4_LENGTH_MAX]
int uw_acl_check(unsigned char *ip_addr)
int uw_acl_make(char *acl_file)
static int convert_ip(char *str, T_IP *ip_addr)