c-router-emulator/router/router.h

37 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __ROUTER_H__
#define __ROUTER_H__
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/ether.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h> //recvfrom
#include <netinet/ether.h> //ETH_P_ALL
#include <arpa/inet.h> //inet_ntop
#include <net/if.h> //ifreq
#include <sys/ioctl.h> //ioctl
#include <netpacket/packet.h> //sockaddr_ll
#include <pthread.h>
#include <stdlib.h>
#include <mysql/mysql.h> // mysql
#include <netinet/ip.h> // ip
#include <pcap/pcap.h>
#include <regex.h> // 正则表达式用于ip地址检查
// 定义全局变量
int sockfd; // 原始套接字
int ret; // 调用数据库的返回值
char *errmsg; // 错误信息
char **dbResult;
int nrow;
int ncolumn;
void show(void); // 后端控制菜单
void net_init(); // 网络初始化
void *net_task(void *arg); // 网络任务
int is_blocked_ip(unsigned char *ip); // 黑名单探测
int printResult(MYSQL_ROW row, char (*columns)[30], int cols);
int is_ip_valid(const char *ip); // 检查ip地址是否合法
#endif