Documentation
¶
Index ¶
- func CheckStateExists(cpModule *C.struct_cp_module, proto layers.IPProtocol, srcPort uint16, ...) bool
- func FreeStaleMapV4Layers(object *C.struct_fwstate_map_v4_object)
- func GetCurrentTime() uint64
- func GetLayerCount(cpModule *C.struct_cp_module) (uint32, uint32)
- func GetStateDeadline(cpModule *C.struct_cp_module, proto layers.IPProtocol, srcPort uint16, ...) uint64
- func InsertMapV4Layer(object *C.struct_fwstate_map_v4_object, indexSize uint32, ...) int
- func InsertNewLayer(cpModule *C.struct_cp_module)
- func NewHarnessAgent(memCtx testutils.MemoryContext) *C.struct_agent
- func NewMapV4Object(agent *C.struct_agent, name string) *C.struct_fwstate_map_v4_object
- func SetSyncSuppressTimeout(cpModule *C.struct_cp_module, ns uint64)
- func SetSyncTCPTimeouts(cpModule *C.struct_cp_module, tcp, tcpFin uint64)
- func TrimStaleLayers(cpModule *C.struct_cp_module, now uint64) error
- func UnlinkStaleMapV4Layers(object *C.struct_fwstate_map_v4_object, now uint64) int
- type CursorResult
- type MemCounters
- type StateValueSnapshot
- type SyncFrameOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckStateExists ¶
func CheckStateExists( cpModule *C.struct_cp_module, proto layers.IPProtocol, srcPort uint16, dstPort uint16, srcAddr string, dstAddr string, ) bool
CheckStateExists checks if a state exists in the linked fwtable
func FreeStaleMapV4Layers ¶
func FreeStaleMapV4Layers(object *C.struct_fwstate_map_v4_object)
FreeStaleMapV4Layers releases the layers parked by UnlinkStaleMapV4Layers.
func GetCurrentTime ¶
func GetCurrentTime() uint64
GetCurrentTime returns current time in nanoseconds
func GetLayerCount ¶
func GetLayerCount(cpModule *C.struct_cp_module) (uint32, uint32)
GetLayerCount returns the number of layers in both IPv4 and IPv6 tables
func GetStateDeadline ¶
func GetStateDeadline( cpModule *C.struct_cp_module, proto layers.IPProtocol, srcPort uint16, dstPort uint16, srcAddr string, dstAddr string, ) uint64
GetStateDeadline returns the deadline of a state entry
func InsertMapV4Layer ¶
func InsertMapV4Layer( object *C.struct_fwstate_map_v4_object, indexSize uint32, extraBucketCount uint32, workerCount uint16, ) int
InsertMapV4Layer appends one layer to the object's table chain and reports the C return code.
func InsertNewLayer ¶
func InsertNewLayer(cpModule *C.struct_cp_module)
InsertNewLayer appends a new layer to both linked map objects via the C harness helper.
func NewHarnessAgent ¶
func NewHarnessAgent(memCtx testutils.MemoryContext) *C.struct_agent
NewHarnessAgent allocates a stand-alone harness agent in the given memory context, without any module config or linked map objects.
func NewMapV4Object ¶
func NewMapV4Object(agent *C.struct_agent, name string) *C.struct_fwstate_map_v4_object
NewMapV4Object creates an IPv4 map object with its first table layer already installed, leaving it unregistered (dangling).
func SetSyncSuppressTimeout ¶
func SetSyncSuppressTimeout(cpModule *C.struct_cp_module, ns uint64)
SetSyncSuppressTimeout sets the sync suppression window (nanoseconds) on a module config produced by fwstateModuleConfig. Zero disables suppression.
func SetSyncTCPTimeouts ¶
func SetSyncTCPTimeouts(cpModule *C.struct_cp_module, tcp, tcpFin uint64)
SetSyncTCPTimeouts overrides the TCP established (tcp) and teardown (tcp_fin) timeouts so a test can distinguish an established refresh from a shorter-TTL state transition.
func TrimStaleLayers ¶
func TrimStaleLayers(cpModule *C.struct_cp_module, now uint64) error
TrimStaleLayers trims stale layers from both linked map objects.
func UnlinkStaleMapV4Layers ¶
func UnlinkStaleMapV4Layers(object *C.struct_fwstate_map_v4_object, now uint64) int
UnlinkStaleMapV4Layers parks expired tail layers in the stale chain and reports the C return code.
Types ¶
type CursorResult ¶
type CursorResult struct {
Idx uint32
Proto uint16
SrcPort uint16
DstPort uint16
SrcAddr uint32
DstAddr uint32
Flags uint8
External bool
CreatedAt uint64
UpdatedAt uint64
PktForward uint64
PktBackward uint64
}
CursorResult holds data from a single cursor entry, copied into Go memory.
type MemCounters ¶
MemCounters is a snapshot of one memory context's accounting counters, for tests that assert where allocations and frees were charged.
func AgentMemCounters ¶
func AgentMemCounters(agent *C.struct_agent) MemCounters
AgentMemCounters snapshots the stand-in agent's context counters.
func ObjectMemCounters ¶
func ObjectMemCounters(object *C.struct_fwstate_map_v4_object) MemCounters
ObjectMemCounters snapshots a map object's own context counters.
type StateValueSnapshot ¶
type StateValueSnapshot struct {
Found bool
External bool
FlagsRaw uint8
CreatedAt uint64
UpdatedAt uint64
PacketsForward uint64
PacketsBackward uint64
Deadline uint64
}
StateValueSnapshot is a Go-side snapshot of a fw_state_value entry.
func GetStateValue ¶
func GetStateValue( cpModule *C.struct_cp_module, proto layers.IPProtocol, srcPort uint16, dstPort uint16, srcAddr string, dstAddr string, ) StateValueSnapshot
GetStateValue reads the raw fw_state_value for a given 5-tuple via a fwtable lookup across all layers. Returns Found=false if the state does not exist.
type SyncFrameOption ¶
type SyncFrameOption func(*C.struct_fw_state_sync_frame)
SyncFrameOption is a functional option for createSyncFrame
func WithFrameFib ¶
func WithFrameFib(fib uint8) SyncFrameOption
WithFrameFib sets fib (direction marker: 0 = forward, 1 = backward)
func WithFrameFlags ¶
func WithFrameFlags(flags uint8) SyncFrameOption
WithFrameFlags sets raw flags byte in the sync frame. `flags` is a union exposed to cgo as [1]byte, so we write through it directly.