MCPcopy
hub / github.com/osrg/gobgp / newBfdConfigFromAPIStruct

Function newBfdConfigFromAPIStruct

pkg/server/grpc_server.go:984–1002  ·  view source on GitHub ↗
(a *api.BfdPeerConfig)

Source from the content-addressed store, hash-verified

982}
983
984func newBfdConfigFromAPIStruct(a *api.BfdPeerConfig) (oc.BfdConfig, error) {
985 if a == nil {
986 return oc.BfdConfig{}, nil
987 }
988 if a.Port > uint32(^uint16(0)) {
989 return oc.BfdConfig{}, fmt.Errorf("invalid BFD port: %d", a.Port)
990 }
991 if a.DetectionMultiplier > uint32(^uint8(0)) {
992 return oc.BfdConfig{}, fmt.Errorf("invalid BFD detection multiplier: %d", a.DetectionMultiplier)
993 }
994
995 return oc.BfdConfig{
996 Enabled: a.Enabled,
997 Port: uint16(a.Port),
998 DesiredMinimumTxInterval: a.DesiredMinimumTxInterval,
999 RequiredMinimumReceive: a.RequiredMinimumReceive,
1000 DetectionMultiplier: uint8(a.DetectionMultiplier),
1001 }, nil
1002}
1003
1004func newNeighborFromAPIStruct(a *api.Peer) (*oc.Neighbor, error) {
1005 pconf := &oc.Neighbor{}

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…