decodeBFD analyses a byte slice and attempts to decode it as a BFD control packet If it succeeds, it loads p with information about the packet and returns nil. If it fails, it returns an error (non nil). This function is employed in layertypes.go to register the BFD layer.
(data []byte, p gopacket.PacketBuilder)
| 304 | // |
| 305 | // This function is employed in layertypes.go to register the BFD layer. |
| 306 | func decodeBFD(data []byte, p gopacket.PacketBuilder) error { |
| 307 | |
| 308 | // Attempt to decode the byte slice. |
| 309 | d := &BFD{} |
| 310 | err := d.DecodeFromBytes(data, p) |
| 311 | if err != nil { |
| 312 | return err |
| 313 | } |
| 314 | |
| 315 | // If the decoding worked, add the layer to the packet and set it |
| 316 | // as the application layer too, if there isn't already one. |
| 317 | p.AddLayer(d) |
| 318 | p.SetApplicationLayer(d) |
| 319 | |
| 320 | return nil |
| 321 | } |
| 322 | |
| 323 | // DecodeFromBytes analyses a byte slice and attempts to decode it as a BFD |
| 324 | // control packet. |
nothing calls this directly
no test coverage detected
searching dependent graphs…