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

Method DecodeFromBytes

layers/icmp6msg.go:184–195  ·  view source on GitHub ↗

DecodeFromBytes decodes the given bytes into this layer.

(data []byte, df gopacket.DecodeFeedback)

Source from the content-addressed store, hash-verified

182
183// DecodeFromBytes decodes the given bytes into this layer.
184func (i *ICMPv6RouterSolicitation) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
185 // first 4 bytes are reserved followed by options
186 if len(data) < 4 {
187 df.SetTruncated()
188 return errors.New("ICMP layer less then 4 bytes for ICMPv6 router solicitation")
189 }
190
191 // truncate old options
192 i.Options = i.Options[:0]
193
194 return i.Options.DecodeFromBytes(data[4:], df)
195}
196
197// SerializeTo writes the serialized form of this layer into the
198// SerializationBuffer, implementing gopacket.SerializableLayer.

Callers

nothing calls this directly

Calls 3

SetTruncatedMethod · 0.65
NewMethod · 0.65
DecodeFromBytesMethod · 0.65

Tested by

no test coverage detected