www.pudn.com > TcpIpOn8051.rar > arpMAIN.C


/*------------------------------------------------------------------------------ 
main.C 
 
Copyright 1995-1999 Keil Software, Inc. 
------------------------------------------------------------------------------*/ 
#include "public.h" 
#include "ether.h" 
#include "arpmain.h" 
#include  
 
void main() 
{ 
//get_current(); 
ip xdata deip; 
//BYTE test=0x88; 
//BYTE addr=0x10; 
//BYTE test1[8]={0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18}; 
//BYTE rev1[8]; 
//WORD rev; 
//BYTE len=0x08; 
/* 
extern void write_nodeid(); 
extern void read_nodeid(); 
extern void write_ip(); 
extern void read_ip(); 
extern void write_mask(); 
extern void read_mask(); 
extern void write_gate(); 
extern void read_gate(); 
extern void write_port(); 
extern void read_port(); 
extern void write_agent(); 
extern void read_agent(); 
extern void write_agentport(); 
extern void read_agentport(); 
*/ 
/* 
mypara.myip.dwordip=0x55663344; 
mypara.mymask.dwordip=0x55448899; 
mypara.mygate.dwordip=0x33442367; 
mypara.port=0x1254; 
mypara.myagent.dwordip=0x55263987; 
mypara.myagentport=0x6598; 
*/ 
/* 
mypara.myip.dwordip=0xca7613ad; 
mypara.mymask.dwordip=0xffffff00; 
mypara.mygate.dwordip=0xca7613fe; 
mypara.port=0x80; 
mypara.myagent.dwordip=0xca760122; 
mypara.myagentport=0x8800; 
deip.dwordip=0xca7613ae; 
*/ 
initcpu(); 
 
/* 
write_nodeid(); 
write_ip(); 
write_mask(); 
write_gate(); 
write_port(); 
write_agent(); 
write_agentport(); 
read_agentport(); 
read_nodeid(); 
read_ip(); 
read_mask(); 
read_gate(); 
read_port(); 
read_agent(); */ 
arp_request(&deip); 
 
//rev=0x0000; 
while(1) 
	{ 
        arp_request(&deip); 
        delay_ms(10); 
        deal_packet(); 
	} 
}