⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 Compex BIOS for SAMSUNG S3C4510B v1.20-lt
💻 C
字号:
#include "types.h"#include "bios.h"#include "bioscall.h"#include "skbuff.h"#include "eth.h"#include "arp.h"#include "ip.h"#include "udp.h"#include "console.h"#include "utils.h"unsigned long tftp_mode;unsigned long tftp_param;int tftp_break;int tftp_datalen;int net_handle(void){	struct sk_buff *skb;	struct ethhdr *eth_hdr;	skb = alloc_skb(ETH_FRAME_LEN);	if (eth_rcv(skb) != -1) {		eth_hdr = (struct ethhdr *)(skb->data);		skb_pull(skb, ETH_HLEN);		if (ntohs(eth_hdr->h_proto) == ETH_P_ARP)			arp_rcv_packet(skb);		else if(ntohs(eth_hdr->h_proto) == ETH_P_IP)		 	ip_rcv_packet(skb);	}	free_skb(skb);	return 0;}int _main(unsigned long mode, unsigned long param){	struct sys_eth_cfg eth;	unsigned char *s = (unsigned char *)(&(eth.ip_addr));	bios_eth_cfg(&eth);	printf("\r\nMini TFTP Server 1.0 (IP : %d.%d.%d.%d)\r\n", s[3], s[2], s[1], s[0]);	eth_init(eth.mac_addr);	arp_init();	ip_init(eth.ip_addr);	udp_init();	arp_add_entry(eth.mac_addr, eth.ip_addr);	tftp_mode = mode;	tftp_param = param;	tftp_break = 0;	tftp_datalen = 0;	while (!tftp_break) {		net_handle();		if (kbhit() && (getch() == KEY_ESC))			break;	}		eth_exit();	return tftp_datalen;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -