arp.h

来自「SimpleGraphicOperatingSystem 32位图形化操作系统 」· C头文件 代码 · 共 48 行

H
48
字号
#ifndef ARP_H_INCLUDED
#define ARP_H_INCLUDED

#include <Type.h>


#include <Ip.h>

//! Ethernet hardware addresses.
#define ARPHRD_ETHER 		1

//! ARP request operation.
#define ARP_OP_REQUEST		1
//! ARP reply operation.
#define ARP_OP_REPLY		2
//! RARP request operation.
#define RARP_OP_REQUEST		3
//! RARP reply operation.
#define RARP_OP_REPLY		4

// The ARP packet structure.
typedef struct _ArpPacket
{
	//! Format of hardware address.
	t_16 ethAddressType;
	//! Format of protocol address.
	t_16 protocolAddressType;    //0x0800 IP
	//! Length of hardware address.
	t_8  ethAddressLength;
	//! Length of protocol address.
	t_8  protocolAddressLength;
	//! ARP operation code (command).
	t_16 opertaionCode;
	//! Hardware source address.
	t_8  sourceEthAddress[6];
	//! IP source address.
	t_32 sourceProtocolAddress;
	//! Hardware destination address.
	t_8  destEthAddress[6];
	//! IP destination address.
	t_32  destProtocolAddress;
} __attribute__ ((packed)) ArpPacket, *PArpPacket;

int SendArpPacket(t_32 ip_to, const t_8 *eth_to, t_16 arp_op);


#endif // ARP_H_INCLUDED

⌨️ 快捷键说明

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