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

Method SerializeTo

layers/icmp6msg.go:367–381  ·  view source on GitHub ↗

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions)

Source from the content-addressed store, hash-verified

365// SerializationBuffer, implementing gopacket.SerializableLayer.
366// See the docs for gopacket.SerializableLayer for more info.
367func (i *ICMPv6NeighborAdvertisement) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
368 if err := i.Options.SerializeTo(b, opts); err != nil {
369 return err
370 }
371
372 buf, err := b.PrependBytes(20)
373 if err != nil {
374 return err
375 }
376
377 buf[0] = byte(i.Flags)
378 copy(buf[1:], lotsOfZeros[:3])
379 copy(buf[4:], i.TargetAddress)
380 return nil
381}
382
383// CanDecode returns the set of layer types that this DecodingLayer can decode.
384func (i *ICMPv6NeighborAdvertisement) CanDecode() gopacket.LayerClass {

Callers

nothing calls this directly

Calls 2

SerializeToMethod · 0.65
PrependBytesMethod · 0.65

Tested by

no test coverage detected