增加中国IP缓存
This commit is contained in:
26
cache.h
Normal file
26
cache.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user