table

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	RouteFlagChildInherit uint64 = 0x01
	RouteFlagCapture      uint64 = 0x02
)

Route flags.

View Source
const (
	RouteOriginApp       uint64 = 0
	RouteOriginStatic    uint64 = 255
	RouteOriginNLSR      uint64 = 128
	RouteOriginPrefixAnn uint64 = 129
	RouteOriginClient    uint64 = 65
	RouteOriginAutoreg   uint64 = 64
	RouteOriginAutoconf  uint64 = 66
)

Route origins.

Variables

View Source
var NetworkRegion *networkRegionTable

NetworkRegion contains producer region names for this forwarder..

View Source
var Rib = RibTable{
	// contains filtered or unexported fields
}

Rib is the Routing Information Base.

Functions

func AddReadvertiser

func AddReadvertiser(r RibReadvertise)

func At

func At(n enc.Name, index int) enc.Component

func Configure

func Configure()

Configure configures the forwarding system.

func CreateFIBTable

func CreateFIBTable(fibTableAlgorithm string)

func CsCapacity

func CsCapacity() int

CsCapacity returns the CS capacity

func SetCsCapacity

func SetCsCapacity(capacity int)

SetCsCapacity sets the CS capacity from management.

func SetExpirationTimerToNow

func SetExpirationTimerToNow(e PitEntry)

SetExpirationTimerToNow updates the expiration timer to the current time.

func UpdateExpirationTimer

func UpdateExpirationTimer(e PitEntry)

UpdateExpirationTimer updates the expiration timer to the latest expiration time of any in or out record in the entry.

Types

type CsEntry

type CsEntry interface {
	Index() uint64 // the hash of the entry, for fast lookup
	StaleTime() time.Time
	Copy() (*spec.Data, []byte, error)
}

CsEntry is an entry in a thread's CS.

type CsLRU

type CsLRU struct {
	// contains filtered or unexported fields
}

CsLRU is a least recently used (LRU) replacement policy for the Content Store.

func NewCsLRU

func NewCsLRU(cs PitCsTable) *CsLRU

NewCsLRU creates a new LRU replacement policy for the Content Store.

func (*CsLRU) AfterInsert

func (l *CsLRU) AfterInsert(index uint64, wire []byte, data *spec.Data)

AfterInsert is called after a new entry is inserted into the Content Store.

func (*CsLRU) AfterRefresh

func (l *CsLRU) AfterRefresh(index uint64, wire []byte, data *spec.Data)

AfterRefresh is called after a new data packet refreshes an existing entry in the Content Store.

func (*CsLRU) BeforeErase

func (l *CsLRU) BeforeErase(index uint64, wire []byte)

BeforeErase is called before an entry is erased from the Content Store through management.

func (*CsLRU) BeforeUse

func (l *CsLRU) BeforeUse(index uint64, wire []byte)

BeforeUse is called before an entry in the Content Store is used to satisfy a pending Interest.

func (*CsLRU) EvictEntries

func (l *CsLRU) EvictEntries()

EvictEntries is called to instruct the policy to evict enough entries to reduce the Content Store size below its size limit.

type CsReplacementPolicy

type CsReplacementPolicy interface {
	// AfterInsert is called after a new entry is inserted into the Content Store.
	AfterInsert(index uint64, wire []byte, data *spec.Data)

	// AfterRefresh is called after a new data packet refreshes an existing entry in the Content Store.
	AfterRefresh(index uint64, wire []byte, data *spec.Data)

	// BeforeErase is called before an entry is erased from the Content Store through management.
	BeforeErase(index uint64, wire []byte)

	// BeforeUse is called before an entry in the Content Store is used to satisfy a pending Interest.
	BeforeUse(index uint64, wire []byte)

	// EvictEntries is called to instruct the policy to evict enough entries to reduce
	// the Content Store size below its size limit.
	EvictEntries()
}

CsReplacementPolicy represents a cache replacement policy for the Content Store.

type DeadNonceList

type DeadNonceList struct {
	Ticker *time.Ticker
	// contains filtered or unexported fields
}

DeadNonceList represents the Dead Nonce List for a forwarding thread.

func NewDeadNonceList

func NewDeadNonceList() *DeadNonceList

NewDeadNonceList creates a new Dead Nonce List for a forwarding thread.

func (*DeadNonceList) Find

func (d *DeadNonceList) Find(name enc.Name, nonce uint32) bool

Find returns whether the specified name and nonce combination are present in the Dead Nonce List.

func (*DeadNonceList) Insert

func (d *DeadNonceList) Insert(name enc.Name, nonce uint32) bool

Insert inserts an entry in the Dead Nonce List with the specified name and nonce. Returns whether nonce already present.

func (*DeadNonceList) RemoveExpiredEntries

func (d *DeadNonceList) RemoveExpiredEntries()

RemoveExpiredEntry removes all expired entries from Dead Nonce List.

type FibNextHopEntry

type FibNextHopEntry struct {
	Nexthop uint64
	Cost    uint64
}

FibNextHopEntry represents a nexthop in a FIB entry.

type FibStrategy

type FibStrategy interface {
	FindNextHopsEnc(name enc.Name) []*FibNextHopEntry
	FindStrategyEnc(name enc.Name) enc.Name
	InsertNextHopEnc(name enc.Name, nextHop uint64, cost uint64)
	ClearNextHopsEnc(name enc.Name)
	RemoveNextHopEnc(name enc.Name, nextHop uint64)
	GetAllFIBEntries() []FibStrategyEntry
	SetStrategyEnc(name enc.Name, strategy enc.Name)
	UnSetStrategyEnc(name enc.Name)
	GetAllForwardingStrategies() []FibStrategyEntry
}

FibStrategy represents the functionality that a FIB-strategy table should implement.

var FibStrategyTable FibStrategy

FibStrategy is a table containing FIB and Strategy entries for given prefixes.

type FibStrategyEntry

type FibStrategyEntry interface {
	Name() enc.Name
	GetStrategy() enc.Name
	GetNextHops() []*FibNextHopEntry
}

FibStrategyEntry represents an entry in the FIB-Strategy table.

type FibStrategyHashTable

type FibStrategyHashTable struct {
	// contains filtered or unexported fields
}

FibStrategyHashTable represents a tree implementation of the FIB-Strategy table.

func (*FibStrategyHashTable) ClearNextHopsEnc

func (f *FibStrategyHashTable) ClearNextHopsEnc(name enc.Name)

ClearNextHops clears all nexthops for the specified prefix.

func (*FibStrategyHashTable) FindNextHopsEnc

func (f *FibStrategyHashTable) FindNextHopsEnc(name enc.Name) []*FibNextHopEntry

func (*FibStrategyHashTable) FindStrategyEnc

func (f *FibStrategyHashTable) FindStrategyEnc(name enc.Name) enc.Name

func (*FibStrategyHashTable) GetAllFIBEntries

func (f *FibStrategyHashTable) GetAllFIBEntries() []FibStrategyEntry

GetAllFIBEntries returns all nexthop entries in the FIB.

func (*FibStrategyHashTable) GetAllForwardingStrategies

func (f *FibStrategyHashTable) GetAllForwardingStrategies() []FibStrategyEntry

GetAllForwardingStrategies returns all strategy choice entries in the Strategy Table.

func (*FibStrategyHashTable) InsertNextHopEnc

func (f *FibStrategyHashTable) InsertNextHopEnc(name enc.Name, nexthop uint64, cost uint64)

InsertNextHop adds or updates a nexthop entry for the specified prefix.

func (*FibStrategyHashTable) RemoveNextHopEnc

func (f *FibStrategyHashTable) RemoveNextHopEnc(name enc.Name, nexthop uint64)

func (*FibStrategyHashTable) SetStrategyEnc

func (f *FibStrategyHashTable) SetStrategyEnc(name enc.Name, strategy enc.Name)

func (*FibStrategyHashTable) UnSetStrategyEnc

func (f *FibStrategyHashTable) UnSetStrategyEnc(name enc.Name)

UnsetStrategy unsets the strategy for the specified prefix.

type FibStrategyTree

type FibStrategyTree struct {
	// contains filtered or unexported fields
}

FibStrategy Tree represents a tree implementation of the FIB-Strategy table.

func (*FibStrategyTree) ClearNextHopsEnc

func (f *FibStrategyTree) ClearNextHopsEnc(name enc.Name)

ClearNextHops clears all nexthops for the specified prefix.

func (*FibStrategyTree) FindNextHopsEnc

func (f *FibStrategyTree) FindNextHopsEnc(name enc.Name) []*FibNextHopEntry

func (*FibStrategyTree) FindStrategyEnc

func (f *FibStrategyTree) FindStrategyEnc(name enc.Name) enc.Name

FindStrategy returns the longest-prefix matching strategy choice entry for the specified name.

func (*FibStrategyTree) GetAllFIBEntries

func (f *FibStrategyTree) GetAllFIBEntries() []FibStrategyEntry

GetAllFIBEntries returns all nexthop entries in the FIB.

func (*FibStrategyTree) GetAllForwardingStrategies

func (f *FibStrategyTree) GetAllForwardingStrategies() []FibStrategyEntry

GetAllForwardingStrategies returns all strategy choice entries in the Strategy Table.

func (*FibStrategyTree) InsertNextHopEnc

func (f *FibStrategyTree) InsertNextHopEnc(name enc.Name, nexthop uint64, cost uint64)

func (*FibStrategyTree) RemoveNextHopEnc

func (f *FibStrategyTree) RemoveNextHopEnc(name enc.Name, nexthop uint64)

func (*FibStrategyTree) SetStrategyEnc

func (f *FibStrategyTree) SetStrategyEnc(name enc.Name, strategy enc.Name)

SetStrategy sets the strategy for the specified prefix.

func (*FibStrategyTree) UnSetStrategyEnc

func (f *FibStrategyTree) UnSetStrategyEnc(name enc.Name)

UnsetStrategy unsets the strategy for the specified prefix.

type OnPitExpiration

type OnPitExpiration func(PitEntry)

type PitCsTable

type PitCsTable interface {
	InsertInterest(interest *spec.Interest, hint enc.Name, inFace uint64) (PitEntry, bool)
	RemoveInterest(pitEntry PitEntry) bool
	FindInterestExactMatchEnc(interest *spec.Interest) PitEntry
	FindInterestPrefixMatchByDataEnc(data *spec.Data, token *uint32) []PitEntry
	PitSize() int

	InsertData(data *spec.Data, wire []byte)
	FindMatchingDataFromCS(interest *spec.Interest) CsEntry
	CsSize() int
	IsCsAdmitting() bool
	IsCsServing() bool

	// UpdateTimer returns the channel used to signal regular Update() calls in the forwarding thread.
	// <- UpdateTimer() and Update() must be called in pairs.
	UpdateTimer() <-chan struct{}
	// Update() does whatever the PIT table needs to do regularly.
	// It may schedule the next UpdateTimer().
	Update()
	// contains filtered or unexported methods
}

PitCsTable dictates what functionality a Pit-Cs table should implement Warning: All functions must be called in the same forwarding goroutine as the creation of the table.

type PitCsTree

type PitCsTree struct {
	// contains filtered or unexported fields
}

PitCsTree represents a PIT-CS implementation that uses a name tree

func NewPitCS

func NewPitCS(onExpiration OnPitExpiration) *PitCsTree

NewPitCS creates a new combined PIT-CS for a forwarding thread.

func (*PitCsTree) CsSize

func (p *PitCsTree) CsSize() int

CsSize returns the number of entries in the CS.

func (*PitCsTree) FindInterestExactMatchEnc

func (p *PitCsTree) FindInterestExactMatchEnc(interest *spec.Interest) PitEntry

FindInterestPrefixMatchByData returns all interests that could be satisfied by the given data. Example: If we have interests /a and /a/b, a prefix search for data with name /a/b will return PitEntries for both /a and /a/b

func (*PitCsTree) FindInterestPrefixMatchByDataEnc

func (p *PitCsTree) FindInterestPrefixMatchByDataEnc(data *spec.Data, token *uint32) []PitEntry

FindInterestPrefixMatchByData returns all interests that could be satisfied by the given data. Example: If we have interests /a and /a/b, a prefix search for data with name /a/b will return PitEntries for both /a and /a/b

func (*PitCsTree) FindMatchingDataFromCS

func (p *PitCsTree) FindMatchingDataFromCS(interest *spec.Interest) CsEntry

FindMatchingDataFromCS finds the best matching entry in the CS (if any). If MustBeFresh is set to true in the Interest, only non-stale CS entries will be returned.

func (*PitCsTree) InsertData

func (p *PitCsTree) InsertData(data *spec.Data, wire []byte)

InsertData inserts a Data packet into the Content Store.

func (*PitCsTree) InsertInterest

func (p *PitCsTree) InsertInterest(interest *spec.Interest, hint enc.Name, inFace uint64) (PitEntry, bool)

InsertInterest inserts an entry in the PIT upon receipt of an Interest. Returns tuple of PIT entry and whether the Nonce is a duplicate.

func (*PitCsTree) IsCsAdmitting

func (p *PitCsTree) IsCsAdmitting() bool

IsCsAdmitting returns whether the CS is admitting content.

func (*PitCsTree) IsCsServing

func (p *PitCsTree) IsCsServing() bool

IsCsServing returns whether the CS is serving content.

func (*PitCsTree) PitSize

func (p *PitCsTree) PitSize() int

PitSize returns the number of entries in the PIT.

func (*PitCsTree) RemoveInterest

func (p *PitCsTree) RemoveInterest(pitEntry PitEntry) bool

RemoveInterest removes the specified PIT entry, returning true if the entry was removed and false if was not (because it does not exist).

func (*PitCsTree) Update

func (p *PitCsTree) Update()

func (*PitCsTree) UpdateTimer

func (p *PitCsTree) UpdateTimer() <-chan struct{}

type PitEntry

type PitEntry interface {
	PitCs() PitCsTable
	EncName() enc.Name
	CanBePrefix() bool
	MustBeFresh() bool
	ForwardingHintNew() enc.Name
	// Interests must match in terms of Forwarding Hint to be aggregated in PIT.
	InRecords() map[uint64]*PitInRecord   // Key is face ID
	OutRecords() map[uint64]*PitOutRecord // Key is face ID
	ExpirationTime() time.Time
	SetExpirationTime(t time.Time)
	Satisfied() bool
	SetSatisfied(isSatisfied bool)

	Token() uint32

	InsertInRecord(interest *spec.Interest, face uint64, incomingPitToken []byte) (*PitInRecord, bool, uint32)
	InsertOutRecord(interest *spec.Interest, face uint64) *PitOutRecord

	GetOutRecords() []*PitOutRecord
	ClearOutRecords()
	ClearInRecords()
}

PitEntry dictates what entries in a PIT-CS table should implement

type PitInRecord

type PitInRecord struct {
	Face            uint64
	LatestTimestamp time.Time
	LatestInterest  enc.Name
	LatestNonce     uint32
	ExpirationTime  time.Time
	PitToken        []byte
}

PitInRecord records an incoming Interest on a given face.

type PitOutRecord

type PitOutRecord struct {
	Face            uint64
	LatestTimestamp time.Time
	LatestInterest  enc.Name
	LatestNonce     uint32
	ExpirationTime  time.Time
}

PitOutRecord records an outgoing Interest on a given face.

type RibEntry

type RibEntry struct {
	Name enc.Name
	// contains filtered or unexported fields
}

RibEntry represents an entry in the RIB table.

func (*RibEntry) GetRoutes

func (r *RibEntry) GetRoutes() []*Route

GetRoutes returns all routes in the RIB entry.

func (*RibEntry) HasCaptureRoute

func (r *RibEntry) HasCaptureRoute() bool

type RibReadvertise

type RibReadvertise interface {
	// Advertise a route in the RIB
	Announce(name enc.Name, route *Route)
	// Remove a route from the RIB
	Withdraw(name enc.Name, route *Route)
}

type RibTable

type RibTable struct {
	// contains filtered or unexported fields
}

RibTable represents the Routing Information Base (RIB).

func (*RibTable) AddEncRoute

func (r *RibTable) AddEncRoute(name enc.Name, route *Route)

AddRoute adds or updates a RIB entry for the specified prefix.

func (*RibTable) CleanUpFace added in v1.4.2

func (r *RibTable) CleanUpFace(faceId uint64)

func (*RibTable) GetAllEntries

func (r *RibTable) GetAllEntries() []*RibEntry

GetAllEntries returns all routes in the RIB.

func (*RibTable) RemoveRouteEnc

func (r *RibTable) RemoveRouteEnc(name enc.Name, faceID uint64, origin uint64)

RemoveRoute removes the specified route from the specified prefix.

type Route

type Route struct {
	FaceID           uint64
	Origin           uint64
	Cost             uint64
	Flags            uint64
	ExpirationPeriod *time.Duration
}

Route represents a route in a RIB entry.

func (*Route) HasCaptureFlag

func (r *Route) HasCaptureFlag() bool

func (*Route) HasChildInheritFlag

func (r *Route) HasChildInheritFlag() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL