只是一个简单的计网课设
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
eruhs/describer/arp.go

28 lines
867 B

package describer
import (
"eruhs/core/parser"
"fmt"
)
type ARPDescriber struct {
ARP *parser.ARP
}
func (a *ARPDescriber) GetHeader() []byte {
return a.ARP.Header
}
func (a *ARPDescriber) GetDetailDescribe() Describe {
return Describe{
1: {"硬件类型", fmt.Sprintf("%d", a.ARP.HardwareType)},
2: {"协议类型", fmt.Sprintf("%d", a.ARP.ProtoType)},
3: {"硬件地址长度", fmt.Sprintf("%d", a.ARP.HwAddressSize)},
4: {"协议地址长度", fmt.Sprintf("%d", a.ARP.ProtoAddrSize)},
5: {"操作码", fmt.Sprintf("%d", a.ARP.Opcode)},
6: {"源硬件地址", a.ARP.SrcHwAddress.String()},
7: {"源协议地址", a.ARP.SrcProtoAddress.String()},
8: {"目标硬件地址", a.ARP.DstHwAddress.String()},
9: {"目标协议地址", a.ARP.DstProtoAddress.String()},
}
}