table

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 10 Imported by: 1

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 Measurements *measurements

Measurements contains the global measurements table,

View Source
var NetworkRegion *networkRegionTable

NetworkRegion contains producer region names for this forwarder..

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

Rib is the Routing Information Base.

Functions

func At added in v1.3.0

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

func Configure

func Configure()

Configure configures the forwarding system.

func CreateFIBTable added in v1.2.0

func CreateFIBTable(fibTableAlgorithm string)

func CsCapacity added in v1.3.0

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
	EncData() *ndn.PendingPacket
}

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, data *ndn.PendingPacket)

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

func (*CsLRU) AfterRefresh

func (l *CsLRU) AfterRefresh(index uint64, data *ndn.PendingPacket)

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, data *ndn.PendingPacket)

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

func (*CsLRU) BeforeUse

func (l *CsLRU) BeforeUse(index uint64, data *ndn.PendingPacket)

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, data *ndn.PendingPacket)

	// AfterRefresh is called after a new data packet refreshes an existing entry in the Content Store.
	AfterRefresh(index uint64, data *ndn.PendingPacket)

	// BeforeErase is called before an entry is erased from the Content Store through management.
	BeforeErase(index uint64, data *ndn.PendingPacket)

	// BeforeUse is called before an entry in the Content Store is used to satisfy a pending Interest.
	BeforeUse(index uint64, data *ndn.PendingPacket)

	// 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 added in v1.2.0

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

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

func (*FibStrategyHashTable) ClearNextHopsEnc added in v1.3.0

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

ClearNextHops clears all nexthops for the specified prefix.

func (*FibStrategyHashTable) FindNextHopsEnc added in v1.3.0

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

func (*FibStrategyHashTable) FindStrategyEnc added in v1.3.0

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

func (*FibStrategyHashTable) GetAllFIBEntries added in v1.2.0

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

GetAllFIBEntries returns all nexthop entries in the FIB.

func (*FibStrategyHashTable) GetAllForwardingStrategies added in v1.2.0

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

GetAllForwardingStrategies returns all strategy choice entries in the Strategy Table.

func (*FibStrategyHashTable) InsertNextHopEnc added in v1.3.0

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 added in v1.3.0

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

func (*FibStrategyHashTable) SetStrategyEnc added in v1.3.0

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

func (*FibStrategyHashTable) UnSetStrategyEnc added in v1.3.0

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 added in v1.3.0

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

ClearNextHops clears all nexthops for the specified prefix.

func (*FibStrategyTree) FindNextHopsEnc added in v1.3.0

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

func (*FibStrategyTree) FindStrategyEnc added in v1.3.0

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 added in v1.3.0

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

func (*FibStrategyTree) RemoveNextHopEnc added in v1.3.0

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

func (*FibStrategyTree) SetStrategyEnc added in v1.3.0

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

SetStrategy sets the strategy for the specified prefix.

func (*FibStrategyTree) UnSetStrategyEnc added in v1.3.0

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

UnsetStrategy unsets the strategy for the specified prefix.

type OnPitExpiration added in v1.2.0

type OnPitExpiration func(PitEntry)

type PitCsTable

type PitCsTable interface {
	InsertInterest(pendingPacket *ndn.PendingPacket, hint enc.Name, inFace uint64) (PitEntry, bool)
	RemoveInterest(pitEntry PitEntry) bool
	FindInterestExactMatchEnc(pendingPacket *ndn.PendingPacket) PitEntry
	FindInterestPrefixMatchByDataEnc(pendingPacket *ndn.PendingPacket, token *uint32) []PitEntry
	PitSize() int

	InsertData(pendingPacket *ndn.PendingPacket)
	FindMatchingDataFromCS(pendingPacket *ndn.PendingPacket) 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 added in v1.3.0

func (p *PitCsTree) FindInterestExactMatchEnc(pendingPacket *ndn.PendingPacket) 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 added in v1.3.0

func (p *PitCsTree) FindInterestPrefixMatchByDataEnc(pendingPacket *ndn.PendingPacket, 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(pendingPacket *ndn.PendingPacket) 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(pendingPacket *ndn.PendingPacket)

InsertData inserts a Data packet into the Content Store.

func (*PitCsTree) InsertInterest

func (p *PitCsTree) InsertInterest(pendingPacket *ndn.PendingPacket, 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 added in v1.2.0

func (p *PitCsTree) Update()

func (*PitCsTree) UpdateTimer added in v1.2.0

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(pendingPacket *ndn.PendingPacket, face uint64, incomingPitToken []byte) (*PitInRecord, bool)
	InsertOutRecord(pendingPacket *ndn.PendingPacket, 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
	LatestEncInterest *ndn.PendingPacket
	LatestEncNonce    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
	LatestEncInterest *ndn.PendingPacket
	LatestEncNonce    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) CleanUpFace

func (r *RibEntry) CleanUpFace(faceId uint64)

CleanUpFace removes the specified face from all entries. Used for clean-up after a face is destroyed.

func (*RibEntry) GetRoutes

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

GetRoutes returns all routes in the RIB entry.

type RibTable

type RibTable struct {
	RibEntry
}

RibTable represents the Routing Information Base (RIB).

func (*RibTable) AddEncRoute added in v1.3.0

func (r *RibTable) AddEncRoute(
	name enc.Name, faceID uint64, origin uint64, cost uint64, flags uint64, expirationPeriod *time.Duration,
)

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

func (*RibTable) GetAllEntries

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

GetAllEntries returns all routes in the RIB.

func (*RibTable) RemoveRouteEnc added in v1.3.0

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.

Jump to

Keyboard shortcuts

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