Skip to content
Snippets Groups Projects
static.go 771 B
Newer Older
import bnet "github.com/bio-routing/bio-rd/net"

// StaticPath represents a static path of a route
type StaticPath struct {
	NextHop bnet.IP
Oliver Herms's avatar
Oliver Herms committed
func (r *Route) staticPathSelection() {
	if len(r.paths) == 0 {
Oliver Herms's avatar
Oliver Herms committed
		return
Oliver Herms's avatar
Oliver Herms committed
	r.ecmpPaths = uint(len(r.paths))
	return
}
// Select returns negative if s < t, 0 if paths are equal, positive if s > t
func (s *StaticPath) Select(t *StaticPath) int8 {
Oliver Herms's avatar
Oliver Herms committed
	return 0
}
// Equal returns true if s and t are euqal
func (s *StaticPath) Equal(t *StaticPath) bool {
	return s.NextHop == t.NextHop
}

Oliver Herms's avatar
Oliver Herms committed
// ECMP determines if path s and t are equal in terms of ECMP
func (s *StaticPath) ECMP(t *StaticPath) bool {
	return true

func (s *StaticPath) Copy() *StaticPath {
	if s == nil {
		return nil
	}

	cp := *s
	return &cp
}