Skip to content
Snippets Groups Projects
static.go 597 B
Newer Older
  • Learn to ignore specific revisions
  • package route
    
    // StaticPath represents a static path of a route
    type StaticPath struct {
    	NextHop uint32
    }
    
    
    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
    }
    
    Oliver Herms's avatar
    Oliver Herms committed
    // Compare returns negative if s < t, 0 if paths are equal, positive if s > t
    func (s *StaticPath) Compare(t *StaticPath) int8 {
    	return 0
    }
    
    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
    }