c-router-emulator/router/router.h

34 lines
1.1 KiB
C
Raw Permalink 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 <libnet.h>
#include <regex.h> // 正则表达式用于ip地址检查
// 定义全局变量
// int sockfd; // 原始套接字
int ret; // 调用数据库的返回值
char *errmsg; // 错误信息
void menu_choice();
void show(void); // 后端控制菜单
void net_init(); // 网络初始化
void printResult(MYSQL_ROW row, char (*columns)[30], int cols); // 显示查询结果的回调函数
int is_ip_valid(const char *ip); // 检查ip地址是否合法
#endif