bindings

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WafMaxStringLength   = 4096
	WafMaxContainerDepth = 20
	WafMaxContainerSize  = 256
	WafRunTimeout        = 5000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type WafConfig

type WafConfig struct {
	Limits     WafConfigLimits
	Obfuscator WafConfigObfuscator
	FreeFn     uintptr
}

type WafConfigLimits

type WafConfigLimits struct {
	MaxContainerSize  uint32
	MaxContainerDepth uint32
	MaxStringLength   uint32
}

type WafConfigObfuscator

type WafConfigObfuscator struct {
	KeyRegex   uintptr // char *
	ValueRegex uintptr // char *
}

type WafContext

type WafContext uintptr

wafContext is a forward declaration in ddwaf.h header We basically don't need to modify it, only to give it to the waf

type WafDl

type WafDl struct{}

func NewWafDl

func NewWafDl() (dl *WafDl, err error)

func (*WafDl) WafContextDestroy

func (waf *WafDl) WafContextDestroy(context WafContext)

func (*WafDl) WafContextInit

func (waf *WafDl) WafContextInit(handle WafHandle) WafContext

func (*WafDl) WafDestroy

func (waf *WafDl) WafDestroy(handle WafHandle)

func (*WafDl) WafGetVersion

func (waf *WafDl) WafGetVersion() string

func (*WafDl) WafInit

func (waf *WafDl) WafInit(obj *WafObject, config *WafConfig, info *WafObject) WafHandle

func (*WafDl) WafKnownAddresses

func (waf *WafDl) WafKnownAddresses(handle WafHandle) []string

func (*WafDl) WafObjectFree

func (waf *WafDl) WafObjectFree(obj *WafObject)

func (*WafDl) WafResultFree

func (waf *WafDl) WafResultFree(result *WafResult)

func (*WafDl) WafRun

func (waf *WafDl) WafRun(context WafContext, persistentData, ephemeralData *WafObject, result *WafResult, timeout uint64) WafReturnCode

func (*WafDl) WafUpdate

func (waf *WafDl) WafUpdate(handle WafHandle, ruleset *WafObject, info *WafObject) WafHandle

type WafHandle

type WafHandle uintptr

wafHandle is a forward declaration in ddwaf.h header We basically don't need to modify it, only to give it to the waf

type WafObject

type WafObject struct {
	ParameterName       uintptr
	ParameterNameLength uint64
	Value               uintptr
	NbEntries           uint64
	Type                WafObjectType
	// contains filtered or unexported fields
}

func (*WafObject) IsArray

func (w *WafObject) IsArray() bool

isArray determines whether this WAF Object is an array or not.

func (*WafObject) IsInvalid

func (w *WafObject) IsInvalid() bool

isInvalid determines whether this WAF Object has the invalid type (which is the 0-value).

func (*WafObject) IsMap

func (w *WafObject) IsMap() bool

isMap determines whether this WAF Object is a map or not.

func (*WafObject) IsNil

func (w *WafObject) IsNil() bool

isNil determines whether this WAF Object is nil or not.

func (*WafObject) IsUnusable

func (wo *WafObject) IsUnusable() bool

IsUnusable returns true if the wafObject has no impact on the WAF execution But we still need this kind of objects to forward map keys in case the value of the map is invalid

type WafObjectType

type WafObjectType uint32

wafObjectType is an enum in C which has the size of DWORD. But DWORD is 4 bytes in amd64 and arm64 so uint32 it is.

const (
	WafIntType WafObjectType = 1 << iota
	WafUintType
	WafStringType
	WafArrayType
	WafMapType
	WafBoolType
	WafFloatType
	WafNilType
)
const WafInvalidType WafObjectType = 0

type WafResult

type WafResult struct {
	Timeout      byte
	Events       WafObject
	Actions      WafObject
	Derivatives  WafObject
	TotalRuntime uint64
}

type WafReturnCode

type WafReturnCode int32
const (
	WafErrInternal WafReturnCode = iota - 3
	WafErrInvalidObject
	WafErrInvalidArgument
	WafOK
	WafMatch
)

Jump to

Keyboard shortcuts

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