ospf

package
v0.0.0-...-69d5e98 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InterfacePointToPoint interfaceType = iota
	InterfaceBroadcast
	InterfaceNBMA
	InterfacePointToMultipoint
	InterfacePointToMultipointBroadcast
	InterfaceVirtualLink
)

Variables

View Source
var (
	AllSPFRouters = netip.MustParseAddr("224.0.0.5")
	AllDRouters   = netip.MustParseAddr("224.0.0.6")
)

Functions

func NewInstance

func NewInstance(serviceManager *services.ServiceManager, conf any) (services.Runner, error)

Types

type AddressRange

type AddressRange struct {
	Prefix    netip.Prefix
	Advertise bool
}

type Area

type Area struct {
	ID            common.AreaID
	AddressRanges []AddressRange

	// TODO: LSDB
	// TODO: ShortestPathTree
	TransitCapability         bool // calculated when ShortestPathTree is calculated
	ExternalRoutingCapability bool
}

type AuthType

type AuthType int

type DD

type DD struct {
	PacketHeader
}

type Hello

type Hello struct {
	PacketHeader
}

type Instance

type Instance struct {
	RouterID common.RouterID
	Areas    map[common.AreaID]*Area

	// TODO: this should be some sort of service tree. It's the same thing as service manager.
	Interfaces map[interfaceID]*Interface
	// contains filtered or unexported fields
}

func (*Instance) Run

func (i *Instance) Run(ctx context.Context) error

type Interface

type Interface struct {
	Type               interfaceType
	State              interfaceState
	Prefix             netip.Prefix // IP interface address and IP interface mask
	AreaID             common.AreaID
	HelloInterval      uint16
	RouterDeadInterval uint32
	InfTransDelay      int
	RouterPriority     uint8

	HelloTimer *time.Timer
	WaitTimer  *time.Timer

	Neighbors map[common.RouterID]Neighbor
	DR        Router
	BDR       Router

	Cost              uint16
	RxmtInterval      int
	AuType            AuthType
	AuthenticationKey uint64
	// contains filtered or unexported fields
}

func (*Interface) Run

func (i *Interface) Run(ctx context.Context) error

type LSA

type LSA interface {
	LSAMetadata
	SetAge(uint16)
	Bytes() []byte
	IsChecksumValid() bool
}

type LSAMetadata

type LSAMetadata interface {
	Age() uint16
	Options() uint8
	Type() lsType
	ID() netip.Addr
	AdvertisingRouter() common.RouterID
	SequenceNumber() int32
	Checksum() uint16
	Length() uint16

	Compare(LSAMetadata) int
	Key() lsdbKey
}

type LSAck

type LSAck struct {
	PacketHeader
}

type LSReq

type LSReq struct {
	PacketHeader
}

type LSUpd

type LSUpd struct {
	PacketHeader
}

type Neighbor

type Neighbor struct {

	// TODO: InactivityTimer - single shot timer
	Master                 bool
	DDSequenceNumber       uint32
	LastReceivedDD         *DD
	ID                     common.RouterID
	Priority               uint8
	Addr                   netip.Addr
	Options                uint8
	DesignatedRouter       common.RouterID
	BackupDesignatedRouter common.RouterID

	// TODO: make a type for these lists?
	RetransmissionList   []*lsaHeader
	DatabaseSummaryList  []*lsaHeader
	LinkStateRequestList []*lsaHeader
	// contains filtered or unexported fields
}

type Packet

type Packet interface {
}

type PacketHeader

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

type Router

type Router struct {
	ID   common.RouterID
	Addr netip.Addr
}

func (Router) IsValid

func (r Router) IsValid() bool

Jump to

Keyboard shortcuts

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