table

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fib

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

func NewFib

func NewFib(config *config.Config, nfdc *nfdc.NfdMgmtThread) *Fib

(AI GENERATED DESCRIPTION): Creates a new Fib instance with the supplied configuration and NFD control thread, initializing its internal maps for name‑to‑name, prefix‑to‑entries, and mark flags.

func (*Fib) MarkH

func (fib *Fib) MarkH(name uint64)

(AI GENERATED DESCRIPTION): Marks the specified name identifier as true in the Fib’s internal `mark` map.

func (*Fib) RemoveUnmarked

func (fib *Fib) RemoveUnmarked()

(AI GENERATED DESCRIPTION): Iterates over all next‑hops in the FIB and removes those whose mark flag is false by calling `UpdateH` with a nil value.

func (*Fib) Size added in v1.4.3

func (fib *Fib) Size() int

(AI GENERATED DESCRIPTION): Return the number of prefixes stored in the forwarding information base (FIB).

func (*Fib) UnmarkAll

func (fib *Fib) UnmarkAll()

(AI GENERATED DESCRIPTION): Clears all entries from the Fib’s mark map, effectively removing every marked hash.

func (*Fib) Update

func (fib *Fib) Update(name enc.Name, newEntries []FibEntry) bool

(AI GENERATED DESCRIPTION): Updates the FIB entry for the specified name with the provided entries, returning true if the update succeeded.

func (*Fib) UpdateH

func (fib *Fib) UpdateH(nameH uint64, name enc.Name, newEntries []FibEntry) bool

(AI GENERATED DESCRIPTION): Updates the FIB entry for a given prefix hash by merging new routing entries, adjusting costs, registering or unregistering NFD routes as needed, and removing the prefix entirely if no reachable routes remain.

type FibEntry

type FibEntry struct {
	// next hop face Id
	FaceId uint64
	// cost in this entry
	Cost uint64
	// contains filtered or unexported fields
}

type NeighborState

type NeighborState struct {

	// neighbor name
	Name enc.Name
	// advertisement boot time for neighbor
	AdvertBoot uint64
	// advertisement sequence number for neighbor
	AdvertSeq uint64
	// most recent advertisement
	Advert *tlv.Advertisement
	// contains filtered or unexported fields
}

func (*NeighborState) IsDead

func (ns *NeighborState) IsDead() bool

(AI GENERATED DESCRIPTION): Determines whether a neighbor is considered dead by comparing the time elapsed since its last seen timestamp to the router’s configured dead interval.

func (*NeighborState) RecvPing

func (ns *NeighborState) RecvPing(faceId uint64, active bool) (error, bool)

Call this when a ping is received from a face. This will automatically register the face route with the neighbor and update the last seen time for the neighbor. Return => true if the face ID has changed

type NeighborTable

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

func NewNeighborTable

func NewNeighborTable(config *config.Config, nfdc *nfdc.NfdMgmtThread) *NeighborTable

(AI GENERATED DESCRIPTION): Creates a new NeighborTable instance with the supplied configuration and NFD client, initializing an empty map to store neighbor states.

func (*NeighborTable) Add

func (nt *NeighborTable) Add(name enc.Name) *NeighborState

(AI GENERATED DESCRIPTION): Adds a new neighbor with the given name to the table, initializing its state (sequence, advert, face ID, and last seen time) and storing it in the neighbors map.

func (*NeighborTable) Get

func (nt *NeighborTable) Get(name enc.Name) *NeighborState

(AI GENERATED DESCRIPTION): Retrieves the NeighborState corresponding to the given name by hashing the name and looking up the resulting key.

func (*NeighborTable) GetAll

func (nt *NeighborTable) GetAll() []*NeighborState

(AI GENERATED DESCRIPTION): Returns a slice containing all neighbor states currently stored in the table.

func (*NeighborTable) GetH

func (nt *NeighborTable) GetH(nameHash uint64) *NeighborState

(AI GENERATED DESCRIPTION): Retrieves and returns the `NeighborState` stored in the `NeighborTable` for the specified `nameHash`.

func (*NeighborTable) Remove

func (nt *NeighborTable) Remove(name enc.Name)

(AI GENERATED DESCRIPTION): Removes the neighbor entry identified by the given name from the NeighborTable, performing any necessary cleanup on its state before deleting it from the internal map.

func (*NeighborTable) Size added in v1.4.3

func (nt *NeighborTable) Size() int

(AI GENERATED DESCRIPTION): Returns the number of neighbors currently stored in the NeighborTable.

func (*NeighborTable) String added in v1.4.3

func (nt *NeighborTable) String() string

(AI GENERATED DESCRIPTION): Returns the constant string `"dv-neighbors"`, serving as the identifier for a `NeighborTable` instance.

type PrefixEntry

type PrefixEntry struct {
	Name enc.Name
	Cost uint64

	// Only known for the local router
	NextHops []PrefixNextHop
}

type PrefixNextHop added in v1.5.2

type PrefixNextHop struct {
	Face uint64
	Cost uint64
}

type PrefixTable

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

func NewPrefixTable

func NewPrefixTable(config *config.Config, publish func(enc.Wire)) *PrefixTable

(AI GENERATED DESCRIPTION): Creates and returns a new PrefixTable, initializing its configuration, publish callback, router registry, and setting the local router based on the provided configuration.

func (*PrefixTable) Announce

func (pt *PrefixTable) Announce(name enc.Name, face uint64, cost uint64)

(AI GENERATED DESCRIPTION): Registers or updates a local prefix announcement in the PrefixTable by adding/modifying a next‑hop entry, recomputes the entry’s cost, and publishes the entry if its cost changed.

func (*PrefixTable) Apply

func (pt *PrefixTable) Apply(wire enc.Wire) (dirty bool)

Applies ops from a list. Returns if dirty.

func (*PrefixTable) GetRouter

func (pt *PrefixTable) GetRouter(name enc.Name) *PrefixTableRouter

(AI GENERATED DESCRIPTION): Retrieves the PrefixTableRouter for a given name, creating a new router with an empty Prefixes map if one does not already exist.

func (*PrefixTable) Reset added in v1.4.3

func (pt *PrefixTable) Reset()

(AI GENERATED DESCRIPTION): Resets the PrefixTable by clearing all stored prefixes and broadcasting a reset operation to the network.

func (*PrefixTable) Snap added in v1.5.0

func (pt *PrefixTable) Snap() enc.Wire

(AI GENERATED DESCRIPTION): Creates a wire‑encoded TLV PrefixOpList that resets the prefix table and lists all current prefixes (name, cost) for the local router.

func (*PrefixTable) String added in v1.4.3

func (pt *PrefixTable) String() string

(AI GENERATED DESCRIPTION): Returns the literal string `"dv-prefix"` as the string representation of a PrefixTable instance.

func (*PrefixTable) Withdraw

func (pt *PrefixTable) Withdraw(name enc.Name, face uint64)

(AI GENERATED DESCRIPTION): Removes a next‑hop for the specified name and face from the local prefix table and republishes the entry if its cost changes.

type PrefixTableRouter

type PrefixTableRouter struct {
	Prefixes map[string]*PrefixEntry
}

type Rib

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

Routing Information Base (RIB)

func NewRib

func NewRib(config *config.Config) *Rib

(AI GENERATED DESCRIPTION): Creates a new Rib instance initialized with the supplied configuration and empty entry and neighbor maps.

func (*Rib) Advert

func (r *Rib) Advert() *tlv.Advertisement

Get all advertisement entries in the RIB.

func (*Rib) DirtyResetNextHop

func (r *Rib) DirtyResetNextHop(nextHop enc.Name)

Resets all entries for a given next hop to infinity without refreshing any entry. This is specifically intended for the RIB update algorithm to avoid unnecessary changes.

func (*Rib) Entries

func (r *Rib) Entries() iter.Seq2[uint64, *RibEntry]

Get all destinations reachable in the RIB.

func (*Rib) GetFibEntries

func (rib *Rib) GetFibEntries(nt *NeighborTable, router uint64) (entries []FibEntry)

Get the FIB entry for a name prefix. router should be hash of the router name.

func (*Rib) Has

func (r *Rib) Has(destName enc.Name) bool

Check if a destination is reachable in the RIB.

func (*Rib) Print

func (r *Rib) Print()

Print the RIB to the console (for debugging).

func (*Rib) Prune

func (r *Rib) Prune() bool

Whenever the RIB is changed, this must be called manually to remove unreachable destinations. Returns true if the Advertisement might change.

func (*Rib) RemoveNextHop

func (r *Rib) RemoveNextHop(nextHop enc.Name) bool

Remove all entries with a given next hop. Returns true if the Advertisement might change.

func (*Rib) Set

func (r *Rib) Set(destName enc.Name, nextHop enc.Name, cost uint64) bool

Set a destination in the RIB. Returns true if the Advertisement might change.

func (*Rib) Size added in v1.4.3

func (r *Rib) Size() int

Size gets the number of entries in the RIB.

func (*Rib) String added in v1.4.3

func (r *Rib) String() string

Log identifier for the RIB.

type RibEntry

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

func (*RibEntry) Name

func (e *RibEntry) Name() enc.Name

(AI GENERATED DESCRIPTION): Returns the name stored in this RIB entry.

func (*RibEntry) Set

func (e *RibEntry) Set(nextHop uint64, cost uint64) bool

(AI GENERATED DESCRIPTION): Updates a RIB entry’s cost for a given next hop, refreshing the entry only if the cost changes, and returns whether a refresh was performed.

Jump to

Keyboard shortcuts

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