graphsolver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Positive = 0 // Normal/positive test (e.g., SameNode returns true if nodes match)
	Negative = 1 // Negated test (e.g., SameNode with Negative returns true if nodes DON'T match)
)

Negation constants for step functions Use these as the last element in the step definition array

View Source
const OneIfaceOneValue = 10

OneIfaceOneValue is the param type identifier for steps with 1 interface param and 1 literal value param. This is separate from the standard param count values (0-4) to distinguish mixed-parameter steps.

View Source
const OneIfaceTwoValues = 11

OneIfaceTwoValues is the param type identifier for steps with 1 interface param and 2 literal value params.

View Source
const WPCNICSubsystemID = "E810-XXV-4T"

WPCNICSubsystemID is the subsystem ID for Intel WPC NICs

Variables

View Source
var GlobalConfig = configObject{}

Functions

func ClockClassLessThan added in v0.0.21

func ClockClassLessThan(ptpIf *exports.PtpIf, value int) bool

ClockClassLessThan checks if any PTP Announce received on the interface has a clock class less than the given threshold value.

func ClockClassLessThanInDomain added in v0.0.21

func ClockClassLessThanInDomain(ptpIf *exports.PtpIf, clockClassThreshold, domain int) bool

ClockClassLessThanInDomain checks if any PTP Announce received on the interface has BOTH a domain number equal to the given domain AND a clock class less than the given threshold. Both conditions must be satisfied by the same announce message.

func ClockClassLessThanInDomainWrapper added in v0.0.21

func ClockClassLessThanInDomainWrapper(config exports.L2Info, ifIdx, clockClassThreshold, domain int) bool

ClockClassLessThanInDomainWrapper is the solver wrapper for ClockClassLessThanInDomain

func ClockClassLessThanWrapper added in v0.0.21

func ClockClassLessThanWrapper(config exports.L2Info, ifIdx, value int) bool

ClockClassLessThanWrapper is the solver wrapper for ClockClassLessThan

func GetAllGraphVertices

func GetAllGraphVertices(count int) (l []int)

func IsPTP

func IsPTP(config exports.L2Info, aInterface *exports.PtpIf) bool

check if an interface is receiving GM

func IsPTPWrapper

func IsPTPWrapper(config exports.L2Info, if1 int) bool

Checks that an if an interface receives ptp frames

func IsWPCNicWrapper

func IsWPCNicWrapper(config exports.L2Info, if1 int) bool

IsWpcNicWrapper is the wrapper for IsWpcNic

func IsWpcNic

func IsWpcNic(ifaceName1 *exports.PtpIf) bool

IsWpcNic determines if the NIC is intel WPC NIC

func NilWrapper

func NilWrapper() bool

wrapper for nil algo function

func PTPDomainEquals added in v0.0.21

func PTPDomainEquals(ptpIf *exports.PtpIf, value int) bool

PTPDomainEquals checks if any PTP Announce received on the interface has a domain number equal to the given value.

func PTPDomainEqualsWrapper added in v0.0.21

func PTPDomainEqualsWrapper(config exports.L2Info, ifIdx, value int) bool

PTPDomainEqualsWrapper is the solver wrapper for PTPDomainEquals

func PermutationsWithConstraints

func PermutationsWithConstraints(config exports.L2Info, algo [][][]int, l []int, s, e, n int, result bool, solutions *[][]int)

Recursive solver function. Creates a set of permutations and applies contraints at each step to reduce the solution graph and speed up execution

func PrintSolution

func PrintSolution(config exports.L2Info, p []int)

Print a single solution

func SameLan2

func SameLan2(config exports.L2Info, if1, if2 int, lans *[][]int) bool

Checks if 2 interfaces are connected to the same LAN

func SameLan2Wrapper

func SameLan2Wrapper(config exports.L2Info, if1, if2 int) bool

wrapper for SameLan2

func SameLan3

func SameLan3(config exports.L2Info, if1, if2, if3 int, lans *[][]int) bool

Checks if 3 interfaces are connected to the same LAN

func SameLan3Wrapper

func SameLan3Wrapper(config exports.L2Info, if1, if2, if3 int) bool

algo wrapper for SameLan3

func SameNic

func SameNic(ifaceName1, ifaceName2 *exports.PtpIf) bool

Determines if 2 interfaces (ports) belong to the same NIC

func SameNicWrapper

func SameNicWrapper(config exports.L2Info, if1, if2 int) bool

wrapper for SameNic

func SameNode

func SameNode(if1, if2 *exports.PtpIf) bool

Checks if 2 interfaces are on the same node

func SameNodeWrapper

func SameNodeWrapper(config exports.L2Info, if1, if2 int) bool

algo Wrapper for SameNode

func Step0

func Step0(fn AlgoFunction0, negate int) []int

Step0 creates a step with 0 parameters negate: use Positive for normal test, Negative for inverted test

func Step1

func Step1(fn AlgoFunction1, param1, negate int) []int

Step1 creates a step with 1 parameter negate: use Positive for normal test, Negative for inverted test

func Step1V added in v0.0.21

func Step1V(fn AlgoFunction1V, ifParam, valueParam, negate int) []int

Step1V creates a step with 1 interface parameter and 1 literal value parameter. ifParam is an index into the problem variables (resolved to an interface index via permutations). valueParam is a literal value passed directly to the function (e.g., domain number or clock class threshold). negate: use Positive for normal test, Negative for inverted test

func Step1V2 added in v0.0.21

func Step1V2(fn AlgoFunction1V2, ifParam, valueParam1, valueParam2, negate int) []int

Step1V2 creates a step with 1 interface parameter and 2 literal value parameters. ifParam is an index into the problem variables (resolved to an interface index via permutations). valueParam1 and valueParam2 are literal values passed directly to the function. negate: use Positive for normal test, Negative for inverted test

func Step2

func Step2(fn AlgoFunction2, param1, param2, negate int) []int

Step2 creates a step with 2 parameters negate: use Positive for normal test, Negative for inverted test

func Step3

func Step3(fn AlgoFunction3, param1, param2, param3, negate int) []int

Step3 creates a step with 3 parameters negate: use Positive for normal test, Negative for inverted test

Types

type AlgoFunction0

type AlgoFunction0 int

list of Algorithm functions with zero params

const (
	// same node
	StepNil AlgoFunction0 = iota
)

See applyStep

type AlgoFunction1

type AlgoFunction1 int

list of Algorithm function with 1 params

const (
	// same node
	StepIsPTP AlgoFunction1 = iota
	StepIsWPCNic
)

See applyStep

type AlgoFunction1V added in v0.0.21

type AlgoFunction1V int

list of Algorithm function with 1 interface param and 1 literal value param

const (
	StepClockClassLessThan AlgoFunction1V = iota
	StepPTPDomainEquals
)

See applyStep

type AlgoFunction1V2 added in v0.0.21

type AlgoFunction1V2 int

list of Algorithm function with 1 interface param and 2 literal value params

const (
	StepClockClassLessThanInDomain AlgoFunction1V2 = iota
)

See applyStep

type AlgoFunction2

type AlgoFunction2 int

list of Algorithm function with 2 params

const (
	StepSameLan2 AlgoFunction2 = iota
	StepSameNic
	StepSameNode
)

See applyStep

type AlgoFunction3

type AlgoFunction3 int

list of Algorithm function with 3 params

const (
	StepSameLan3 AlgoFunction3 = iota
)

See applyStep

type Algorithm

type Algorithm struct {
	// number of interfaces to solve
	IfCount int
	// Function to run algo
	TestSolution ConfigFunc
}

type ConfigFunc

type ConfigFunc func(exports.L2Info, []int) bool

type ConfigFunc0

type ConfigFunc0 func() bool

Signature for algorithm functions with 0 params

type ConfigFunc1

type ConfigFunc1 func(exports.L2Info, int) bool

Signature for algorithm functions with 1 params

type ConfigFunc1V added in v0.0.21

type ConfigFunc1V func(exports.L2Info, int, int) bool

Signature for algorithm functions with 1 interface param and 1 literal value param

type ConfigFunc1V2 added in v0.0.21

type ConfigFunc1V2 func(exports.L2Info, int, int, int) bool

Signature for algorithm functions with 1 interface param and 2 literal value params

type ConfigFunc2

type ConfigFunc2 func(exports.L2Info, int, int) bool

Signature for algorithm functions with 2 params

type ConfigFunc3

type ConfigFunc3 func(exports.L2Info, int, int, int) bool

Signature for algorithm functions with 3 params

Jump to

Keyboard shortcuts

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