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

Function decodeBFD

layers/bfd.go:306–321  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

304//
305// This function is employed in layertypes.go to register the BFD layer.
306func 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.

Callers

nothing calls this directly

Calls 3

DecodeFromBytesMethod · 0.95
AddLayerMethod · 0.65
SetApplicationLayerMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…