📄 ether.c
字号:
#include "C:\wql\tcpipsocket\IP51_MAC.h"
#include "C:\wql\tcpipsocket\ether.h"
#include "C:\wql\tcpipsocket\IP51_sfr.h"
#include "C:\wql\tcpipsocket\arp.h"
#include "C:\wql\tcpipsocket\ip.h"
//#include "uart.h"
UINT8 xdata mrbuf[ETH_MTU];
void
Ether_Input()
{
UINT16 len;
struct ether_hdr * eth_hdr;
len = Rd_pkt_len();
len -= 18; //reduce rdma_hdr,and reduce MAC header,MAC CRC
Rd_pkt(&mrbuf[0]);
eth_hdr = (struct ether_hdr*)(&mrbuf[4]);
switch(eth_hdr->type)
{
case ETH_ARP:
ARP_Interpret((ARP_LAYER *)&mrbuf[18]);
break;
case ETH_IP :
IP_Interpret((IPLAYER *)&mrbuf[18], (UINT8 *)&mrbuf[18], len);
break;
default :
break;
}
}
void Ether_output(UINT8 * eth_addr,UINT16 len,UINT8 * tptr,UINT16 flag)
{
while(Wr_pkt(eth_addr,len,tptr,flag)!=0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -