MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / NewICMPDecoder

Function NewICMPDecoder

packet/decoder.go:124–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122}
123
124func NewICMPDecoder() *ICMPDecoder {
125 ipDecoder := NewIPDecoder()
126
127 var (
128 icmpv4 layers.ICMPv4
129 icmpv6 layers.ICMPv6
130 )
131 ipDecoder.layers++
132 ipDecoder.v4parser.AddDecodingLayer(&icmpv4)
133 ipDecoder.v6parser.AddDecodingLayer(&icmpv6)
134
135 return &ICMPDecoder{
136 IPDecoder: ipDecoder,
137 icmpv4: &icmpv4,
138 icmpv6: &icmpv6,
139 }
140}
141
142func (pd *ICMPDecoder) Decode(packet RawPacket) (*ICMP, error) {
143 // Should decode to IP and optionally ICMP layer

Callers 14

NewPacketRouterFunction · 0.92
ServeMethod · 0.92
validateEchoFlowFunction · 0.92
assertTTLExceedFunction · 0.92
validateIPPacketFunction · 0.92
NewDatagramConnFunction · 0.92
assertTTLExceedPacketFunction · 0.85
TestChecksumFunction · 0.85
TestDecodeIPFunction · 0.85
TestDecodeICMPFunction · 0.85

Calls 1

NewIPDecoderFunction · 0.85

Tested by 11

validateEchoFlowFunction · 0.74
assertTTLExceedFunction · 0.74
validateIPPacketFunction · 0.74
assertTTLExceedPacketFunction · 0.68
TestChecksumFunction · 0.68
TestDecodeIPFunction · 0.68
TestDecodeICMPFunction · 0.68
TestDecodeBadPacketsFunction · 0.68
FuzzICMPDecoderFunction · 0.68