2023-09-20 17:02:08 +08:00
|
|
|
#ifndef __NET_TASK_THREAD_H__
|
|
|
|
#define __NET_TASK_THREAD_H__
|
|
|
|
|
|
|
|
#include "router.h"
|
|
|
|
|
2023-09-21 09:51:03 +08:00
|
|
|
#define MAX_BYTE 65535 // 最大字节数
|
|
|
|
|
|
|
|
char errbuf[PCAP_ERRBUF_SIZE]; // 错误信息缓冲区
|
|
|
|
pcap_t *device1; // 网卡设备1
|
|
|
|
pcap_t *device2; // 网卡设备2
|
|
|
|
|
|
|
|
libnet_t *libnet_context1; // libnet1 上下文
|
|
|
|
libnet_t *libnet_context2; // libnet2 上下文
|
|
|
|
|
|
|
|
// libpcap 相关函数
|
|
|
|
void open_device(pcap_t **device, char *dev_name); // 打开网卡设备
|
|
|
|
void process_packet(u_char *arg, const struct pcap_pkthdr *pkthdr, const u_char *packet); // 处理数据包
|
|
|
|
|
2023-09-20 17:02:08 +08:00
|
|
|
void *net_task(void *arg);
|
|
|
|
|
|
|
|
#endif
|