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

Function TestDecodingLayerParserFullTCPPacket

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

Source from the content-addressed store, hash-verified

1031}
1032
1033func TestDecodingLayerParserFullTCPPacket(t *testing.T) {
1034 dlp := gopacket.NewDecodingLayerParser(LayerTypeEthernet, &Ethernet{}, &IPv4{}, &TCP{}, &gopacket.Payload{})
1035 decoded := make([]gopacket.LayerType, 1)
1036 err := dlp.DecodeLayers(testSimpleTCPPacket, &decoded)
1037 if err != nil {
1038 t.Error("Error from dlp parser: ", err)
1039 }
1040 if len(decoded) != 4 {
1041 t.Error("Expected 4 layers parsed, instead got ", len(decoded))
1042 }
1043}
1044
1045func testDecodingLayerContainer(t *testing.T, dlc gopacket.DecodingLayerContainer) {
1046 dlc = dlc.Put(&Ethernet{})

Callers

nothing calls this directly

Calls 3

DecodeLayersMethod · 0.95
NewDecodingLayerParserFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…