c-router-emulator/router/test/link.h

63 lines
1.3 KiB
C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define RECV_SIZE 2048
typedef struct My_buf
{
unsigned char buf[RECV_SIZE];
int my_buf_date_len;
}ip_buf;
typedef struct Arp_mac_ip
{
char stc_mac[18];
char stc_ip[16];
}arp_mac_ip;
extern void title();
//*************************arp缓存表*****************************
typedef struct myarp
{
unsigned char mac[32] ;
unsigned char ip[32] ;
struct myarp* next;
}MY_ARP;
//arp缓存表尾插
extern MY_ARP *arp_pTailInsert(MY_ARP *head,char *mac,char *ip);
//arp中查找ip
extern int arp_searcharpLink(MY_ARP *head,char *ip);
//遍历arp缓存表
extern void arp_print_link(MY_ARP *head);
//释放arp链表
extern MY_ARP* arp_freeLink(MY_ARP *head);
//*************************arp缓存表*****************************
//*************************过滤链表******************************
typedef struct myrouter
{
unsigned char ip[32] ;
struct myrouter* next;
}MY_ROU;
//释放链表
extern MY_ROU* rou_freeLink(MY_ROU *head);
//尾插
extern MY_ROU *rou_pTailInsert(MY_ROU *head);
//遍历
extern void rou_print_link(MY_ROU *head);
//查找ip
extern int rou_searcharpLink(MY_ROU *head,char *ip);
//删除
extern MY_ROU *rou_pDeleteLink(MY_ROU *head);
//*************************过滤链表******************************