search

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package search provides termshark's search widget including the various drop down menus to control the type of search to be issued.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HexSearchValidator

type HexSearchValidator struct {
	Valid    filter.IValidateCB
	Invalid  filter.IValidateCB
	KilledCB filter.IValidateCB
	EmptyCB  filter.IValidateCB
}

func (*HexSearchValidator) Kill

func (f *HexSearchValidator) Kill() (bool, error)

func (*HexSearchValidator) SetEmpty

func (f *HexSearchValidator) SetEmpty(cb filter.IValidateCB)

func (*HexSearchValidator) SetInvalid

func (f *HexSearchValidator) SetInvalid(cb filter.IValidateCB)

func (*HexSearchValidator) SetKilled

func (f *HexSearchValidator) SetKilled(cb filter.IValidateCB)

func (*HexSearchValidator) SetValid

func (f *HexSearchValidator) SetValid(cb filter.IValidateCB)

func (*HexSearchValidator) Validate

func (f *HexSearchValidator) Validate(filter string)

type IAlgorithm

type IAlgorithm interface {
	SearchPackets(term INeedle, cb ICallbacks, app gowid.IApp)
}

type ICallbacks

type ICallbacks interface {
	Reset(app gowid.IApp) // Intended to make things ready for next "Find" invocation
	StartingPosition() (interface{}, error)
	SearchPacketsFrom(from interface{}, start interface{}, term INeedle, app gowid.IApp)
	SearchPacketsResult(res Result, app gowid.IApp)
	RequestStop(app gowid.IApp)
	OnTick(app gowid.IApp)
	OnError(err error, app gowid.IApp)
}

ICallbacks is intended to be a callback issued when the Find invocation yields a result of some kind

type IErrorHandler

type IErrorHandler interface {
	OnError(err error, app gowid.IApp)
}

type INeedle

type INeedle interface {
	Search(data string) int
}

type IRequestStop

type IRequestStop interface {
	RequestStop(app gowid.IApp)
}

type IResult

type IResult interface {
	PacketNumber() int
}

type IntermediateResult

type IntermediateResult struct {
	Res      Result
	ResumeAt IResult
}

type RegexSearchValidator

type RegexSearchValidator struct {
	Valid    filter.IValidateCB
	Invalid  filter.IValidateCB
	KilledCB filter.IValidateCB
	EmptyCB  filter.IValidateCB
}

func (*RegexSearchValidator) Kill

func (f *RegexSearchValidator) Kill() (bool, error)

func (*RegexSearchValidator) SetEmpty

func (f *RegexSearchValidator) SetEmpty(cb filter.IValidateCB)

func (*RegexSearchValidator) SetInvalid

func (f *RegexSearchValidator) SetInvalid(cb filter.IValidateCB)

func (*RegexSearchValidator) SetKilled

func (f *RegexSearchValidator) SetKilled(cb filter.IValidateCB)

func (*RegexSearchValidator) SetValid

func (f *RegexSearchValidator) SetValid(cb filter.IValidateCB)

func (*RegexSearchValidator) Validate

func (f *RegexSearchValidator) Validate(filter string)

type Result

type Result struct {
	Interrupted  bool
	Success      bool
	ErrorForUser error
	Position     interface{}
}

type StringSearchValidator

type StringSearchValidator struct {
	Valid    filter.IValidateCB
	Invalid  filter.IValidateCB
	KilledCB filter.IValidateCB
	EmptyCB  filter.IValidateCB
}

func (*StringSearchValidator) Kill

func (f *StringSearchValidator) Kill() (bool, error)

func (*StringSearchValidator) SetEmpty

func (f *StringSearchValidator) SetEmpty(cb filter.IValidateCB)

func (*StringSearchValidator) SetInvalid

func (f *StringSearchValidator) SetInvalid(cb filter.IValidateCB)

func (*StringSearchValidator) SetKilled

func (f *StringSearchValidator) SetKilled(cb filter.IValidateCB)

func (*StringSearchValidator) SetValid

func (f *StringSearchValidator) SetValid(cb filter.IValidateCB)

func (*StringSearchValidator) Validate

func (f *StringSearchValidator) Validate(filter string)

type Widget

type Widget struct {
	gowid.IWidget
	*gowid.Callbacks
	// contains filtered or unexported fields
}

Widget represents a composite UI element for driving packet search operations. It comprises a menu allowing the type of data to be searched - PSML, PDML or raw bytes; a menu determining the search method - string, regex, hex or filter; the input field for the search, and a button to start the search. Note that the filter search is a special case - the search value is used as a display filter to select packets from the current source, rather than for searching within packet data.

func New

func New(alg IAlgorithm,
	searchPktList func() ICallbacks,
	searchPktStruct func() ICallbacks,
	searchPktDetails func() ICallbacks,
	searchByFilter func() ICallbacks,
	men menu.IOpener,
	comp fields.IPrefixCompleter,
	errHandler IErrorHandler) *Widget

func (*Widget) CaseSensitive

func (w *Widget) CaseSensitive() bool

func (*Widget) Clear

func (w *Widget) Clear(app gowid.IApp)

func (*Widget) Close

func (w *Widget) Close(app gowid.IApp) error

func (*Widget) Focus

func (w *Widget) Focus() int

func (*Widget) FocusIsOnFilter

func (w *Widget) FocusIsOnFilter() bool

func (*Widget) GetPreferedPosition

func (w *Widget) GetPreferedPosition() gwutil.IntOption

func (*Widget) Open

func (w *Widget) Open(app gowid.IApp)

func (*Widget) SetCaseSensitive

func (w *Widget) SetCaseSensitive(val bool)

func (*Widget) SetFocus

func (w *Widget) SetFocus(app gowid.IApp, i int)

func (*Widget) SetPreferedPosition

func (w *Widget) SetPreferedPosition(cols int, app gowid.IApp)

func (*Widget) SetValue

func (w *Widget) SetValue(val string, app gowid.IApp)

func (*Widget) SubWidgets

func (w *Widget) SubWidgets() []gowid.IWidget

func (*Widget) Value

func (w *Widget) Value() string

Jump to

Keyboard shortcuts

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