新版本采用libipset库操作ipset集合,采用libpcap、libcap抓包获取源IP
This commit is contained in:
17
libipset.h
Normal file
17
libipset.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef LIBIPSET_H
|
||||
#define LIBIPSET_H
|
||||
|
||||
#include "common.h"
|
||||
#include <libipset/ipset.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <arpa/inet.h> // 包含 inet_pton 函数
|
||||
|
||||
#define BUFFER 1024
|
||||
#define MAX_CMD_LENGTH 256 // 或者根据需要调整
|
||||
|
||||
extern int create_ipset( char *set_name);
|
||||
extern int add_ip_to_ipset(char *set_name, char *ip);
|
||||
extern int get_ip_count_in_ipset(char *set_name);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user