MCPcopy
hub / github.com/google/gopacket / TestDecodeVLANPacket

Function TestDecodeVLANPacket

layers/decode_test.go:549–572  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

547}
548
549func TestDecodeVLANPacket(t *testing.T) {
550 p := gopacket.NewPacket(
551 []byte{
552 0x00, 0x10, 0xdb, 0xff, 0x10, 0x00, 0x00, 0x15, 0x2c, 0x9d, 0xcc, 0x00,
553 0x81, 0x00, 0x01, 0xf7, 0x08, 0x00, 0x45, 0x00, 0x00, 0x28, 0x29, 0x8d,
554 0x40, 0x00, 0x7d, 0x06, 0x83, 0xa0, 0xac, 0x1b, 0xca, 0x8e, 0x45, 0x16,
555 0x94, 0xe2, 0xd4, 0x0a, 0x00, 0x50, 0xdf, 0xab, 0x9c, 0xc6, 0xcd, 0x1e,
556 0xe5, 0xd1, 0x50, 0x10, 0x01, 0x00, 0x5a, 0x74, 0x00, 0x00, 0x00, 0x00,
557 0x00, 0x00, 0x00, 0x00,
558 }, LinkTypeEthernet, testDecodeOptions)
559 if err := p.ErrorLayer(); err != nil {
560 t.Error("Error while parsing vlan packet:", err)
561 }
562 if vlan := p.Layer(LayerTypeDot1Q); vlan == nil {
563 t.Error("Didn't detect vlan")
564 } else if _, ok := vlan.(*Dot1Q); !ok {
565 t.Error("LayerTypeDot1Q layer is not a Dot1Q object")
566 }
567 for i, l := range p.Layers() {
568 t.Logf("Layer %d: %#v", i, l)
569 }
570 want := []gopacket.LayerType{LayerTypeEthernet, LayerTypeDot1Q, LayerTypeIPv4, LayerTypeTCP}
571 checkLayers(p, want, t)
572}
573
574func TestDecodeSCTPPackets(t *testing.T) {
575 sctpPackets := [][]byte{

Callers

nothing calls this directly

Calls 6

ErrorLayerMethod · 0.95
LayerMethod · 0.95
LayersMethod · 0.95
NewPacketFunction · 0.92
checkLayersFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…