fw

package
v0.0.0-...-d9b08a0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFwThreads = 32

MaxFwThreads Maximum number of forwarding threads

View Source
const StrategyPrefix = "/localhost/nfd/strategy"

StrategyPrefix is the prefix of all strategy names for YaNFD

Variables

View Source
var NumFwThreads int

NumFwThreads indicates the number of forwarding threads in the forwarder.

View Source
var StrategyVersions = make(map[string][]uint64)

StrategyVersions contains a list of strategies mapping to a list of their versions

View Source
var Threads map[int]*Thread

Threads contains all forwarding threads

Functions

func Configure

func Configure()

Configure configures the forwarding system.

func HashNameToAllPrefixFwThreads

func HashNameToAllPrefixFwThreads(name *ndn.Name) []int

HashNameToAllPrefixFwThreads hahes an NDN name to all forwarding threads for all prefixes of the name.

func HashNameToFwThread

func HashNameToFwThread(name *ndn.Name) int

HashNameToFwThread hashes an NDN name to a forwarding thread.

func InstantiateStrategies

func InstantiateStrategies(fwThread *Thread) map[string]Strategy

InstantiateStrategies instantiates all strategies for a forwarding thread.

Types

type BestRoute

type BestRoute struct {
	StrategyBase
}

BestRoute is a forwarding strategy that forwards Interests to the nexthop with the lowest cost.

func (*BestRoute) AfterContentStoreHit

func (s *BestRoute) AfterContentStoreHit(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)

AfterContentStoreHit ...

func (*BestRoute) AfterReceiveData

func (s *BestRoute) AfterReceiveData(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)

AfterReceiveData ...

func (*BestRoute) AfterReceiveInterest

func (s *BestRoute) AfterReceiveInterest(pitEntry *table.PitEntry, inFace uint64, interest *ndn.Interest, nexthops []*table.FibNextHopEntry)

AfterReceiveInterest ...

func (*BestRoute) BeforeSatisfyInterest

func (s *BestRoute) BeforeSatisfyInterest(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)

BeforeSatisfyInterest ...

func (*BestRoute) Instantiate

func (s *BestRoute) Instantiate(fwThread *Thread)

Instantiate creates a new instance of the BestRoute strategy.

type Multicast

type Multicast struct {
	StrategyBase
}

Multicast is a forwarding strategy that forwards Interests to all nexthop faces.

func (*Multicast) AfterContentStoreHit

func (s *Multicast) AfterContentStoreHit(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)

AfterContentStoreHit ...

func (*Multicast) AfterReceiveData

func (s *Multicast) AfterReceiveData(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)

AfterReceiveData ...

func (*Multicast) AfterReceiveInterest

func (s *Multicast) AfterReceiveInterest(pitEntry *table.PitEntry, inFace uint64, interest *ndn.Interest, nexthops []*table.FibNextHopEntry)

AfterReceiveInterest ...

func (*Multicast) BeforeSatisfyInterest

func (s *Multicast) BeforeSatisfyInterest(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)

BeforeSatisfyInterest ...

func (*Multicast) Instantiate

func (s *Multicast) Instantiate(fwThread *Thread)

Instantiate creates a new instance of the Multicast strategy.

type Strategy

type Strategy interface {
	Instantiate(fwThread *Thread)
	String() string
	GetName() *ndn.Name

	AfterContentStoreHit(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)
	AfterReceiveData(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)
	AfterReceiveInterest(pitEntry *table.PitEntry, inFace uint64, interest *ndn.Interest, nexthops []*table.FibNextHopEntry)
	BeforeSatisfyInterest(pitEntry *table.PitEntry, inFace uint64, data *ndn.Data)
}

Strategy represents a forwarding strategy.

type StrategyBase

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

StrategyBase provides common helper methods for YaNFD forwarding strategies.

func (*StrategyBase) GetName

func (s *StrategyBase) GetName() *ndn.Name

GetName returns the name of strategy, including version information.

func (*StrategyBase) NewStrategyBase

func (s *StrategyBase) NewStrategyBase(fwThread *Thread, strategyName *ndn.GenericNameComponent, version uint64, strategyLogName string)

NewStrategyBase is a helper that allows specific strategies to initialize the base.

func (*StrategyBase) SendData

func (s *StrategyBase) SendData(data *ndn.Data, pitEntry *table.PitEntry, nexthop uint64, inFace uint64)

SendData sends a Data packet on the specified face.

func (*StrategyBase) SendInterest

func (s *StrategyBase) SendInterest(interest *ndn.Interest, pitEntry *table.PitEntry, nexthop uint64, inFace uint64)

SendInterest sends an Interest on the specified face.

func (*StrategyBase) String

func (s *StrategyBase) String() string

type Thread

type Thread struct {
	HasQuit chan interface{}

	// Counters
	NInInterests          uint64
	NInData               uint64
	NOutInterests         uint64
	NOutData              uint64
	NSatisfiedInterests   uint64
	NUnsatisfiedInterests uint64
	// contains filtered or unexported fields
}

Thread Represents a forwarding thread

func NewThread

func NewThread(id int) *Thread

NewThread creates a new forwarding thread

func (*Thread) GetID

func (t *Thread) GetID() int

GetID returns the ID of the forwarding thread

func (*Thread) GetNumCsEntries

func (t *Thread) GetNumCsEntries() int

GetNumCsEntries returns the number of entries in this thread's ContentStore.

func (*Thread) GetNumPitEntries

func (t *Thread) GetNumPitEntries() int

GetNumPitEntries returns the number of entries in this thread's PIT.

func (*Thread) QueueData

func (t *Thread) QueueData(data *ndn.PendingPacket)

QueueData queues a Data packet for processing by this forwarding thread.

func (*Thread) QueueInterest

func (t *Thread) QueueInterest(interest *ndn.PendingPacket)

QueueInterest queues an Interest for processing by this forwarding thread.

func (*Thread) Run

func (t *Thread) Run()

Run forwarding thread

func (*Thread) String

func (t *Thread) String() string

func (*Thread) TellToQuit

func (t *Thread) TellToQuit()

TellToQuit tells the forwarding thread to quit

Jump to

Keyboard shortcuts

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