sdk

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sdk provides the multi-language SDK export layer. It exposes core PSL functionality as C-compatible functions that can be called from Python, Rust, JavaScript, and C/C++.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocCString

func AllocCString(s string) *byte

AllocCString allocates a null-terminated C string from a Go string.

func CPSLDecode

func CPSLDecode(h Handle, proto string, data []byte) (string, error)

CPSLDecode decodes binary data and returns JSON result.

func CPSLEncode

func CPSLEncode(h Handle, proto string, fieldsJSON string) ([]byte, error)

CPSLEncode encodes JSON fields to binary.

func CPSLFree

func CPSLFree(h Handle)

CPSLFree releases a library handle.

func CPSLList

func CPSLList(h Handle) (string, error)

CPSLList returns protocol list as JSON.

func CPSLLoad

func CPSLLoad(h Handle, path string) error

CPSLLoad loads a PSL file.

func Decode

func Decode(h Handle, protoName string, data []byte) (string, error)

Decode decodes binary data using the named protocol and returns JSON.

func Encode

func Encode(h Handle, protoName string, fieldsJSON string) ([]byte, error)

Encode encodes JSON fields into binary using the named protocol.

func FreeCString

func FreeCString(p *byte)

FreeCString frees a C string allocated by AllocCString. In practice, Go's GC handles this, but we provide the API for symmetry.

func FreeLibrary

func FreeLibrary(h Handle)

FreeLibrary releases a library handle.

func GenerateCHeader

func GenerateCHeader() string

GenerateCHeader generates a C header file for the PSL shared library.

func GenerateCMakeExample

func GenerateCMakeExample() string

GenerateCMakeExample generates a CMake integration example.

func GeneratePythonBinding

func GeneratePythonBinding() string

GeneratePythonBinding generates a Python ctypes binding module.

func GenerateRustBinding

func GenerateRustBinding() string

GenerateRustBinding generates a Rust FFI binding module.

func GenerateScapyInterop

func GenerateScapyInterop() string

GenerateScapyInterop generates Python code for Scapy integration.

func GenerateTypeScriptBinding

func GenerateTypeScriptBinding() string

GenerateTypeScriptBinding generates a TypeScript/Node.js binding module.

func GetLibrary

func GetLibrary(h Handle) *protocol.Library

GetLibrary retrieves the library for a handle.

func GoString

func GoString(p *byte) string

CString helpers for FFI

func ListProtocols

func ListProtocols(h Handle) (string, error)

ListProtocols returns all protocol names as JSON array.

func LoadPSL

func LoadPSL(h Handle, filePath string) error

LoadPSL loads a PSL file into the library.

Types

type CResult

type CResult struct {
	Data  *byte
	Error *byte
	Len   int
}

CResult holds a result string and error for C callers.

type Handle

type Handle uintptr

Handle is an opaque pointer to a Library instance.

func CPSLNew

func CPSLNew() (Handle, *byte)

CPSLNew creates a new library and returns the handle.

func NewLibrary

func NewLibrary() (Handle, error)

NewLibrary creates a new PSL library instance and returns a handle.

type SDKError

type SDKError struct {
	// contains filtered or unexported fields
}

SDKError represents an SDK error.

func (*SDKError) Error

func (e *SDKError) Error() string

Jump to

Keyboard shortcuts

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