Esempio n. 1
0
func BenchmarkUnpackEthArp(bn *testing.B) {
	var eth_pkt eth.Packet
	var arp_pkt arp.Packet

	for n := 0; n < bn.N; n++ {
		layers.Unpack(test_eth_arp, &eth_pkt, &arp_pkt)
	}
}
Esempio n. 2
0
func BenchmarkUnpackEthUPv4TCP(bn *testing.B) {
	var eth_pkt eth.Packet
	var ip4_pkt ipv4.Packet
	var tcp_pkt tcp.Packet

	for n := 0; n < bn.N; n++ {
		layers.Unpack(test_eth_ipv4_tcp, &eth_pkt, &ip4_pkt, &tcp_pkt)
	}
}
Esempio n. 3
0
func BenchmarkUnpackEthUPv4UDP(bn *testing.B) {
	var eth_pkt eth.Packet
	var ip4_pkt ipv4.Packet
	var udp_pkt udp.Packet

	for n := 0; n < bn.N; n++ {
		layers.Unpack(test_eth_ipv4_udp, &eth_pkt, &ip4_pkt, &udp_pkt)
	}
}
Esempio n. 4
0
func TestUnpackEthUPv4TCP(t *testing.T) {
	var eth_pkt eth.Packet
	var ip4_pkt ipv4.Packet
	var tcp_pkt tcp.Packet

	_, err := layers.Unpack(test_eth_ipv4_tcp, &eth_pkt, &ip4_pkt, &tcp_pkt)
	if err != nil {
		t.Fatalf("Error unpacking: %s", err)
	}
}
Esempio n. 5
0
func TestUnpackEthUPv4UDPRaw(t *testing.T) {
	var eth_pkt eth.Packet
	var ip4_pkt ipv4.Packet
	var udp_pkt udp.Packet
	var raw_pkt raw.Packet

	_, err := layers.Unpack(test_eth_ipv4_udp_raw,
		&eth_pkt, &ip4_pkt, &udp_pkt, &raw_pkt)
	if err != nil {
		t.Fatalf("Error unpacking: %s", err)
	}
}
Esempio n. 6
0
func TestUnpackEthArp(t *testing.T) {
	_, err := layers.Unpack(test_eth_arp, &eth.Packet{}, &arp.Packet{})
	if err != nil {
		t.Fatalf("Error unpacking: %s", err)
	}
}