Documentation
¶
Overview ¶
Package fsm provides protocol state machine extraction and visualization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
Name string `json:"name"`
Initial bool `json:"initial,omitempty"`
Final bool `json:"final,omitempty"`
}
State represents a protocol state.
type StateMachine ¶
type StateMachine struct {
Protocol string `json:"protocol"`
States []State `json:"states"`
Transitions []Transition `json:"transitions"`
}
StateMachine represents a protocol state machine.
func NewStateMachine ¶
func NewStateMachine(protocol string) *StateMachine
NewStateMachine creates a new state machine.
func (*StateMachine) AddState ¶
func (sm *StateMachine) AddState(name string, initial, final bool)
AddState adds a state.
func (*StateMachine) AddTransition ¶
func (sm *StateMachine) AddTransition(from, to, event string)
AddTransition adds a transition.
func (*StateMachine) Coverage ¶
func (sm *StateMachine) Coverage(observed []string) float64
Coverage calculates state coverage from observed transitions.
func (*StateMachine) ToDOT ¶
func (sm *StateMachine) ToDOT() string
ToDOT generates a Graphviz DOT diagram.
func (*StateMachine) ToMermaid ¶
func (sm *StateMachine) ToMermaid() string
ToMermaid generates a Mermaid state diagram.
Click to show internal directories.
Click to hide internal directories.