Module ffi

Module ffi 

Source
Expand description

FFI (Foreign Function Interface) bindings for C interoperability

This module provides a C-compatible API for IPFRS, allowing the library to be used from C, C++, and other languages that support C FFI.

§Safety

All functions are marked as unsafe extern "C" and handle panics to prevent undefined behavior. Proper null checks are performed on all pointer arguments.

§Memory Management

  • Opaque pointers are used to hide Rust types from C
  • Callers must free resources using the provided *_free functions
  • Strings passed from C must be valid UTF-8 null-terminated strings
  • Strings returned to C must be freed using ipfrs_string_free

Structs§

IpfrsBlock
Opaque handle to a block
IpfrsClient
Opaque handle to IPFRS client

Enums§

IpfrsErrorCode
FFI error codes

Functions§

ipfrs_add
Add data to IPFRS and return its CID
ipfrs_client_free
Free an IPFRS client
ipfrs_client_new
Initialize a new IPFRS client
ipfrs_data_free
Free data returned by ipfrs_get
ipfrs_get
Get data from IPFRS by CID
ipfrs_get_last_error
Get the last error message
ipfrs_has
Check if a block exists by CID
ipfrs_string_free
Free a string returned by IPFRS functions
ipfrs_version
Get library version string