27 lines
751 B
C
27 lines
751 B
C
#ifndef CACHE_H
|
|
#define CACHE_H
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <errno.h>
|
|
|
|
#define MAXIPSET_ 256
|
|
#define MAXIPLEN 32
|
|
|
|
extern char cn_ip[MAXIPSET_][MAXIPLEN];
|
|
|
|
extern int add_cn_ip(char cn_ip[MAXIPSET_][MAXIPLEN], char *ip);
|
|
extern int is_ip_in_set(char cn_ip[MAXIPSET_][MAXIPLEN], const char *ip);
|
|
extern int cn_ip_len(char cn_ip[MAXIPSET_][MAXIPLEN]);
|
|
extern void clear_ip_set(char cn_ip[MAXIPSET_][MAXIPLEN]);
|
|
extern int is_ip_in_cache(const char *ip);
|
|
|
|
extern int append_string_to_file(const char *filepath, const char *str);
|
|
extern int read_file_to_array(const char *filepath, char cn_ip[MAXIPSET_][MAXIPLEN], int *line_count);
|
|
|
|
extern int file_exists_access(const char *filepath);
|
|
|
|
#endif
|