DecodeFromBytes decodes the given bytes into this layer.
(data []byte, df gopacket.DecodeFeedback)
| 297 | |
| 298 | // DecodeFromBytes decodes the given bytes into this layer. |
| 299 | func (i *ICMPv6NeighborSolicitation) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error { |
| 300 | if len(data) < 20 { |
| 301 | df.SetTruncated() |
| 302 | return errors.New("ICMP layer less then 20 bytes for ICMPv6 neighbor solicitation") |
| 303 | } |
| 304 | |
| 305 | i.TargetAddress = net.IP(data[4:20]) |
| 306 | i.BaseLayer = BaseLayer{data, nil} // assume no payload |
| 307 | |
| 308 | // truncate old options |
| 309 | i.Options = i.Options[:0] |
| 310 | |
| 311 | return i.Options.DecodeFromBytes(data[20:], df) |
| 312 | } |
| 313 | |
| 314 | // SerializeTo writes the serialized form of this layer into the |
| 315 | // SerializationBuffer, implementing gopacket.SerializableLayer. |
nothing calls this directly
no test coverage detected