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)
| 251 | // SerializationBuffer, implementing gopacket.SerializableLayer. |
| 252 | // See the docs for gopacket.SerializableLayer for more info. |
| 253 | func (i *ICMPv6RouterAdvertisement) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error { |
| 254 | if err := i.Options.SerializeTo(b, opts); err != nil { |
| 255 | return err |
| 256 | } |
| 257 | |
| 258 | buf, err := b.PrependBytes(12) |
| 259 | if err != nil { |
| 260 | return err |
| 261 | } |
| 262 | |
| 263 | buf[0] = byte(i.HopLimit) |
| 264 | buf[1] = byte(i.Flags) |
| 265 | binary.BigEndian.PutUint16(buf[2:], i.RouterLifetime) |
| 266 | binary.BigEndian.PutUint32(buf[4:], i.ReachableTime) |
| 267 | binary.BigEndian.PutUint32(buf[8:], i.RetransTimer) |
| 268 | return nil |
| 269 | } |
| 270 | |
| 271 | // CanDecode returns the set of layer types that this DecodingLayer can decode. |
| 272 | func (i *ICMPv6RouterAdvertisement) CanDecode() gopacket.LayerClass { |
nothing calls this directly
no test coverage detected