Documentation
¶
Overview ¶
Package hyperscan provides Go bindings for 01org/hyperscan high-performance regular expression matching library.
Index ¶
- Constants
- func AllocScratch(db *Database, scratch []*Scratch) int32
- func CloneScratch(src *Scratch, dest []*Scratch) int32
- func CloseStream(id *Stream, scratch *Scratch, onEvent MatchEventHandler, ctxt unsafe.Pointer) int32
- func Compile(expression string, flags uint32, mode uint32, platform *PlatformInfo, ...) int32
- func CompileExtMulti(expressions []string, flags []uint32, ids []uint32, ext []*ExprExt, ...) int32
- func CompileMulti(expressions []string, flags []uint32, ids []uint32, elements uint32, ...) int32
- func CopyStream(toId []*Stream, fromId *Stream) int32
- func DatabaseInfo(database *Database, info [][]byte) int32
- func DatabaseSize(database *Database, databaseSize []uint) int32
- func DeserializeDatabase(bytes string, length uint, db []*Database) int32
- func DeserializeDatabaseAt(bytes string, length uint, db *Database) int32
- func ExpressionExtInfo(expression string, flags uint32, ext *ExprExt, info **ExprInfo, ...) int32
- func ExpressionInfo(expression string, flags uint32, info **ExprInfo, error **CompileError) int32
- func FreeCompileError(error *CompileError) int32
- func FreeDatabase(db *Database) int32
- func FreeScratch(scratch *Scratch) int32
- func OpenStream(db *Database, flags uint32, stream []*Stream) int32
- func PopulatePlatform(platform *PlatformInfo) int32
- func ResetAndCopyStream(toId *Stream, fromId *Stream, scratch *Scratch, onEvent MatchEventHandler, ...) int32
- func ResetStream(id *Stream, flags uint32, scratch *Scratch, onEvent MatchEventHandler, ...) int32
- func Scan(db *Database, data string, length uint32, flags uint32, scratch *Scratch, ...) int32
- func ScanStream(id *Stream, data string, length uint32, flags uint32, scratch *Scratch, ...) int32
- func ScanVector(db *Database, data []string, length []uint32, count uint32, flags uint32, ...) int32
- func ScratchSize(scratch *Scratch, scratchSize []uint) int32
- func SerializeDatabase(db *Database, bytes [][]byte, length []uint) int32
- func SerializedDatabaseInfo(bytes string, length uint, info [][]byte) int32
- func SerializedDatabaseSize(bytes string, length uint, deserializedSize []uint) int32
- func SetAllocator(allocFunc Alloc, freeFunc Free) int32
- func SetDatabaseAllocator(allocFunc Alloc, freeFunc Free) int32
- func SetMiscAllocator(allocFunc Alloc, freeFunc Free) int32
- func SetScratchAllocator(allocFunc Alloc, freeFunc Free) int32
- func SetStreamAllocator(allocFunc Alloc, freeFunc Free) int32
- func StreamSize(database *Database, streamSize []uint) int32
- func ValidPlatform() int32
- func Version() string
- type Alloc
- type CompileError
- type Database
- type Error
- type ExprExt
- type ExprInfo
- type Free
- type MatchEventHandler
- type PlatformInfo
- type RawString
- type Scratch
- type Stream
Constants ¶
const ( // ExtFlagMinOffset as defined in hs/hs_compile.h:273 ExtFlagMinOffset = uint64(1) // ExtFlagMaxOffset as defined in hs/hs_compile.h:276 ExtFlagMaxOffset = uint64(2) // ExtFlagMinLength as defined in hs/hs_compile.h:279 ExtFlagMinLength = uint64(4) // ExtFlagEditDistance as defined in hs/hs_compile.h:282 ExtFlagEditDistance = uint64(8) // FlagCaseless as defined in hs/hs_compile.h:688 FlagCaseless = 1 // FlagDotall as defined in hs/hs_compile.h:698 FlagDotall = 2 // FlagMultiline as defined in hs/hs_compile.h:709 FlagMultiline = 4 // FlagSinglematch as defined in hs/hs_compile.h:730 FlagSinglematch = 8 // FlagAllowempty as defined in hs/hs_compile.h:742 FlagAllowempty = 16 // FlagUtf8 as defined in hs/hs_compile.h:752 FlagUtf8 = 32 // FlagUcp as defined in hs/hs_compile.h:762 FlagUcp = 64 // FlagPrefilter as defined in hs/hs_compile.h:790 FlagPrefilter = 128 // FlagSomLeftmost as defined in hs/hs_compile.h:802 FlagSomLeftmost = 256 // CpuFeaturesAvx2 as defined in hs/hs_compile.h:818 CpuFeaturesAvx2 = (uint64(1) << 2) // CpuFeaturesAvx512 as defined in hs/hs_compile.h:826 CpuFeaturesAvx512 = (uint64(1) << 3) // TuneFamilyGeneric as defined in hs/hs_compile.h:842 TuneFamilyGeneric = 0 // TuneFamilySnb as defined in hs/hs_compile.h:850 TuneFamilySnb = 1 // TuneFamilyIvb as defined in hs/hs_compile.h:858 TuneFamilyIvb = 2 // TuneFamilyHsw as defined in hs/hs_compile.h:866 TuneFamilyHsw = 3 // TuneFamilySlm as defined in hs/hs_compile.h:874 TuneFamilySlm = 4 // TuneFamilyBdw as defined in hs/hs_compile.h:882 TuneFamilyBdw = 5 // TuneFamilySkl as defined in hs/hs_compile.h:890 TuneFamilySkl = 6 // TuneFamilySkx as defined in hs/hs_compile.h:898 TuneFamilySkx = 7 // TuneFamilyGlm as defined in hs/hs_compile.h:906 TuneFamilyGlm = 8 // ModeBlock as defined in hs/hs_compile.h:928 ModeBlock = 1 // ModeNostream as defined in hs/hs_compile.h:933 ModeNostream = 1 // ModeStream as defined in hs/hs_compile.h:938 ModeStream = 2 // ModeVectored as defined in hs/hs_compile.h:943 ModeVectored = 4 // ModeSomHorizonLarge as defined in hs/hs_compile.h:956 ModeSomHorizonLarge = (uint32(1) << 24) // ModeSomHorizonMedium as defined in hs/hs_compile.h:969 ModeSomHorizonMedium = (uint32(1) << 25) // ModeSomHorizonSmall as defined in hs/hs_compile.h:982 ModeSomHorizonSmall = (uint32(1) << 26) // Success as defined in hs/hs_common.h:478 Success = 0 // Invalid as defined in hs/hs_common.h:483 Invalid = (-1) // Nomem as defined in hs/hs_common.h:488 Nomem = (-2) // ScanTerminated as defined in hs/hs_common.h:497 ScanTerminated = (-3) // CompilerError as defined in hs/hs_common.h:503 CompilerError = (-4) // DbVersionError as defined in hs/hs_common.h:508 DbVersionError = (-5) // DbPlatformError as defined in hs/hs_common.h:513 DbPlatformError = (-6) // DbModeError as defined in hs/hs_common.h:520 DbModeError = (-7) // BadAlign as defined in hs/hs_common.h:525 BadAlign = (-8) // BadAlloc as defined in hs/hs_common.h:532 BadAlloc = (-9) // ScratchInUse as defined in hs/hs_common.h:551 ScratchInUse = (-10) // ArchError as defined in hs/hs_common.h:562 ArchError = (-11) // OffsetPastHorizon as defined in hs/hs_runtime.h:495 OffsetPastHorizon = (^uint64(0)) )
Variables ¶
This section is empty.
Functions ¶
func AllocScratch ¶
AllocScratch function as declared in hs/hs_runtime.h:435
func CloneScratch ¶
CloneScratch function as declared in hs/hs_runtime.h:456
func CloseStream ¶
func CloseStream(id *Stream, scratch *Scratch, onEvent MatchEventHandler, ctxt unsafe.Pointer) int32
CloseStream function as declared in hs/hs_runtime.h:226
func Compile ¶
func Compile(expression string, flags uint32, mode uint32, platform *PlatformInfo, db **Database, error **CompileError) int32
Compile function as declared in hs/hs_compile.h:346
func CompileExtMulti ¶
func CompileExtMulti(expressions []string, flags []uint32, ids []uint32, ext []*ExprExt, elements uint32, mode uint32, platform *PlatformInfo, db **Database, error **CompileError) int32
CompileExtMulti function as declared in hs/hs_compile.h:512
func CompileMulti ¶
func CompileMulti(expressions []string, flags []uint32, ids []uint32, elements uint32, mode uint32, platform []PlatformInfo, db **Database, error **CompileError) int32
CompileMulti function as declared in hs/hs_compile.h:425
func CopyStream ¶
CopyStream function as declared in hs/hs_runtime.h:285
func DatabaseInfo ¶
DatabaseInfo function as declared in hs/hs_common.h:249
func DatabaseSize ¶
DatabaseSize function as declared in hs/hs_common.h:203
func DeserializeDatabase ¶
DeserializeDatabase function as declared in hs/hs_common.h:137
func DeserializeDatabaseAt ¶
DeserializeDatabaseAt function as declared in hs/hs_common.h:169
func ExpressionExtInfo ¶
func ExpressionExtInfo(expression string, flags uint32, ext *ExprExt, info **ExprInfo, error **CompileError) int32
ExpressionExtInfo function as declared in hs/hs_compile.h:657
func ExpressionInfo ¶
func ExpressionInfo(expression string, flags uint32, info **ExprInfo, error **CompileError) int32
ExpressionInfo function as declared in hs/hs_compile.h:590
func FreeCompileError ¶
func FreeCompileError(error *CompileError) int32
FreeCompileError function as declared in hs/hs_compile.h:531
func FreeDatabase ¶
FreeDatabase function as declared in hs/hs_common.h:84
func FreeScratch ¶
FreeScratch function as declared in hs/hs_runtime.h:489
func OpenStream ¶
OpenStream function as declared in hs/hs_runtime.h:148
func PopulatePlatform ¶
func PopulatePlatform(platform *PlatformInfo) int32
PopulatePlatform function as declared in hs/hs_compile.h:673
func ResetAndCopyStream ¶
func ResetAndCopyStream(toId *Stream, fromId *Stream, scratch *Scratch, onEvent MatchEventHandler, context unsafe.Pointer) int32
ResetAndCopyStream function as declared in hs/hs_runtime.h:318
func ResetStream ¶
func ResetStream(id *Stream, flags uint32, scratch *Scratch, onEvent MatchEventHandler, context unsafe.Pointer) int32
ResetStream function as declared in hs/hs_runtime.h:267
func Scan ¶
func Scan(db *Database, data string, length uint32, flags uint32, scratch *Scratch, onEvent MatchEventHandler, context unsafe.Pointer) int32
Scan function as declared in hs/hs_runtime.h:359
func ScanStream ¶
func ScanStream(id *Stream, data string, length uint32, flags uint32, scratch *Scratch, onEvent MatchEventHandler, ctxt unsafe.Pointer) int32
ScanStream function as declared in hs/hs_runtime.h:188
func ScanVector ¶
func ScanVector(db *Database, data []string, length []uint32, count uint32, flags uint32, scratch *Scratch, onEvent MatchEventHandler, context unsafe.Pointer) int32
ScanVector function as declared in hs/hs_runtime.h:402
func ScratchSize ¶
ScratchSize function as declared in hs/hs_runtime.h:473
func SerializeDatabase ¶
SerializeDatabase function as declared in hs/hs_common.h:108
func SerializedDatabaseInfo ¶
SerializedDatabaseInfo function as declared in hs/hs_common.h:271
func SerializedDatabaseSize ¶
SerializedDatabaseSize function as declared in hs/hs_common.h:230
func SetAllocator ¶
SetAllocator function as declared in hs/hs_common.h:325
func SetDatabaseAllocator ¶
SetDatabaseAllocator function as declared in hs/hs_common.h:358
func SetMiscAllocator ¶
SetMiscAllocator function as declared in hs/hs_common.h:385
func SetScratchAllocator ¶
SetScratchAllocator function as declared in hs/hs_common.h:412
func SetStreamAllocator ¶
SetStreamAllocator function as declared in hs/hs_common.h:439
func StreamSize ¶
StreamSize function as declared in hs/hs_common.h:187
func ValidPlatform ¶
func ValidPlatform() int32
ValidPlatform function as declared in hs/hs_common.h:467
Types ¶
type Alloc ¶
Alloc type as declared in hs/hs_common.h:288
func NewAllocRef ¶
func (Alloc) PassRef ¶
func (x Alloc) PassRef() (ref *C.hs_alloc_t, allocs *cgoAllocMap)
func (Alloc) PassValue ¶
func (x Alloc) PassValue() (ref C.hs_alloc_t, allocs *cgoAllocMap)
type CompileError ¶
type CompileError struct {
Message []byte
Expression int32
// contains filtered or unexported fields
}
CompileError as declared in hs/hs_compile.h:124
func NewCompileErrorRef ¶
func NewCompileErrorRef(ref unsafe.Pointer) *CompileError
NewCompileErrorRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.
func (*CompileError) Deref ¶
func (x *CompileError) Deref()
Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.
func (*CompileError) Free ¶
func (x *CompileError) Free()
Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.
func (*CompileError) PassRef ¶
func (x *CompileError) PassRef() (*C.hs_compile_error_t, *cgoAllocMap)
PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.
func (CompileError) PassValue ¶
func (x CompileError) PassValue() (C.hs_compile_error_t, *cgoAllocMap)
PassValue does the same as PassRef except that it will try to dereference the returned pointer.
func (*CompileError) Ref ¶
func (x *CompileError) Ref() *C.hs_compile_error_t
Ref returns the underlying reference to C object or nil if struct is nil.
type Database ¶
type Database C.hs_database_t
Database as declared in hs/hs_common.h:64
func NewDatabase ¶
func NewDatabase() *Database
NewDatabase allocates a new C object of this type and converts the reference into a raw struct reference without wrapping.
func NewDatabaseRef ¶
NewDatabaseRef converts the C object reference into a raw struct reference without wrapping.
func (*Database) PassRef ¶
func (x *Database) PassRef() *C.hs_database_t
PassRef returns a reference to C object as it is or allocates a new C object of this type.
func (*Database) Ref ¶
func (x *Database) Ref() *C.hs_database_t
Ref returns a reference to C object as it is.
type ExprExt ¶
type ExprExt struct {
Flags uint64
MinOffset uint64
MaxOffset uint64
MinLength uint64
EditDistance uint32
// contains filtered or unexported fields
}
ExprExt as declared in hs/hs_compile.h:261
func NewExprExtRef ¶
NewExprExtRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.
func (*ExprExt) Deref ¶
func (x *ExprExt) Deref()
Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.
func (*ExprExt) Free ¶
func (x *ExprExt) Free()
Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.
func (*ExprExt) PassRef ¶
func (x *ExprExt) PassRef() (*C.hs_expr_ext_t, *cgoAllocMap)
PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.
func (ExprExt) PassValue ¶
func (x ExprExt) PassValue() (C.hs_expr_ext_t, *cgoAllocMap)
PassValue does the same as PassRef except that it will try to dereference the returned pointer.
func (*ExprExt) Ref ¶
func (x *ExprExt) Ref() *C.hs_expr_ext_t
Ref returns the underlying reference to C object or nil if struct is nil.
type ExprInfo ¶
type ExprInfo struct {
MinWidth uint32
MaxWidth uint32
UnorderedMatches byte
MatchesAtEod byte
MatchesOnlyAtEod byte
// contains filtered or unexported fields
}
ExprInfo as declared in hs/hs_compile.h:216
func NewExprInfoRef ¶
NewExprInfoRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.
func (*ExprInfo) Deref ¶
func (x *ExprInfo) Deref()
Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.
func (*ExprInfo) Free ¶
func (x *ExprInfo) Free()
Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.
func (*ExprInfo) PassRef ¶
func (x *ExprInfo) PassRef() (*C.hs_expr_info_t, *cgoAllocMap)
PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.
func (ExprInfo) PassValue ¶
func (x ExprInfo) PassValue() (C.hs_expr_info_t, *cgoAllocMap)
PassValue does the same as PassRef except that it will try to dereference the returned pointer.
func (*ExprInfo) Ref ¶
func (x *ExprInfo) Ref() *C.hs_expr_info_t
Ref returns the underlying reference to C object or nil if struct is nil.
type MatchEventHandler ¶
type MatchEventHandler func(id uint32, from uint64, to uint64, flags uint32, context unsafe.Pointer) int32
MatchEventHandler type as declared in hs/hs_runtime.h:125
func NewMatchEventHandlerRef ¶
func NewMatchEventHandlerRef(ref unsafe.Pointer) *MatchEventHandler
func (MatchEventHandler) PassRef ¶
func (x MatchEventHandler) PassRef() (ref *C.match_event_handler, allocs *cgoAllocMap)
func (MatchEventHandler) PassValue ¶
func (x MatchEventHandler) PassValue() (ref C.match_event_handler, allocs *cgoAllocMap)
type PlatformInfo ¶
type PlatformInfo struct {
Tune uint32
CpuFeatures uint64
Reserved1 uint64
Reserved2 uint64
// contains filtered or unexported fields
}
PlatformInfo as declared in hs/hs_compile.h:163
func NewPlatformInfoRef ¶
func NewPlatformInfoRef(ref unsafe.Pointer) *PlatformInfo
NewPlatformInfoRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.
func (*PlatformInfo) Deref ¶
func (x *PlatformInfo) Deref()
Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.
func (*PlatformInfo) Free ¶
func (x *PlatformInfo) Free()
Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.
func (*PlatformInfo) PassRef ¶
func (x *PlatformInfo) PassRef() (*C.hs_platform_info_t, *cgoAllocMap)
PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.
func (PlatformInfo) PassValue ¶
func (x PlatformInfo) PassValue() (C.hs_platform_info_t, *cgoAllocMap)
PassValue does the same as PassRef except that it will try to dereference the returned pointer.
func (*PlatformInfo) Ref ¶
func (x *PlatformInfo) Ref() *C.hs_platform_info_t
Ref returns the underlying reference to C object or nil if struct is nil.
type Scratch ¶
type Scratch C.hs_scratch_t
Scratch as declared in hs/hs_runtime.h:66
func NewScratch ¶
func NewScratch() *Scratch
NewScratch allocates a new C object of this type and converts the reference into a raw struct reference without wrapping.
func NewScratchRef ¶
NewScratchRef converts the C object reference into a raw struct reference without wrapping.
func (*Scratch) PassRef ¶
func (x *Scratch) PassRef() *C.hs_scratch_t
PassRef returns a reference to C object as it is or allocates a new C object of this type.
func (*Scratch) Ref ¶
func (x *Scratch) Ref() *C.hs_scratch_t
Ref returns a reference to C object as it is.
type Stream ¶
type Stream C.hs_stream_t
Stream as declared in hs/hs_runtime.h:59
func NewStream ¶
func NewStream() *Stream
NewStream allocates a new C object of this type and converts the reference into a raw struct reference without wrapping.
func NewStreamRef ¶
NewStreamRef converts the C object reference into a raw struct reference without wrapping.
func (*Stream) PassRef ¶
func (x *Stream) PassRef() *C.hs_stream_t
PassRef returns a reference to C object as it is or allocates a new C object of this type.
func (*Stream) Ref ¶
func (x *Stream) Ref() *C.hs_stream_t
Ref returns a reference to C object as it is.