#![cfg(all(feature = "netdb", feature = "redex-disk", not(feature = "dataforts")))]
use std::ffi::{c_char, c_int};
use std::ptr;
use super::cortex::NET_ERR_FEATURE_NOT_BUILT;
pub struct MeshBlobAdapterHandle {
_private: (),
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_new(
_redex: *mut super::cortex::RedexHandle,
_adapter_id: *const c_char,
_persistent: c_int,
_overflow_json: *const c_char,
) -> *mut MeshBlobAdapterHandle {
ptr::null_mut()
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_free(_handle: *mut MeshBlobAdapterHandle) {}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_store(
_handle: *const MeshBlobAdapterHandle,
_blob_ref_bytes: *const u8,
_blob_ref_len: usize,
_data: *const u8,
_data_len: usize,
) -> c_int {
NET_ERR_FEATURE_NOT_BUILT
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_fetch(
_handle: *const MeshBlobAdapterHandle,
_blob_ref_bytes: *const u8,
_blob_ref_len: usize,
_out_data: *mut *mut u8,
_out_len: *mut usize,
) -> c_int {
NET_ERR_FEATURE_NOT_BUILT
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_exists(
_handle: *const MeshBlobAdapterHandle,
_blob_ref_bytes: *const u8,
_blob_ref_len: usize,
_out_exists: *mut c_int,
) -> c_int {
NET_ERR_FEATURE_NOT_BUILT
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_prometheus_text(
_handle: *const MeshBlobAdapterHandle,
) -> *mut c_char {
ptr::null_mut()
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_overflow_enabled(
_handle: *const MeshBlobAdapterHandle,
) -> c_int {
NET_ERR_FEATURE_NOT_BUILT
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_overflow_active(
_handle: *const MeshBlobAdapterHandle,
) -> c_int {
NET_ERR_FEATURE_NOT_BUILT
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_overflow_config(
_handle: *const MeshBlobAdapterHandle,
) -> *mut c_char {
ptr::null_mut()
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_set_overflow_enabled(
_handle: *const MeshBlobAdapterHandle,
_enabled: c_int,
) -> c_int {
NET_ERR_FEATURE_NOT_BUILT
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_mesh_blob_adapter_set_overflow_config(
_handle: *const MeshBlobAdapterHandle,
_config_json: *const c_char,
) -> c_int {
NET_ERR_FEATURE_NOT_BUILT
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_blob_free_buffer(_ptr: *mut u8, _len: usize) {}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn stubs_return_feature_not_built_when_dataforts_off() {
let null_handle = std::ptr::null::<MeshBlobAdapterHandle>();
assert_eq!(
net_mesh_blob_adapter_store(null_handle, std::ptr::null(), 0, std::ptr::null(), 0),
NET_ERR_FEATURE_NOT_BUILT
);
assert_eq!(
net_mesh_blob_adapter_fetch(
null_handle,
std::ptr::null(),
0,
std::ptr::null_mut(),
std::ptr::null_mut()
),
NET_ERR_FEATURE_NOT_BUILT
);
assert_eq!(
net_mesh_blob_adapter_exists(null_handle, std::ptr::null(), 0, std::ptr::null_mut()),
NET_ERR_FEATURE_NOT_BUILT
);
assert_eq!(
net_mesh_blob_adapter_overflow_enabled(null_handle),
NET_ERR_FEATURE_NOT_BUILT
);
assert_eq!(
net_mesh_blob_adapter_overflow_active(null_handle),
NET_ERR_FEATURE_NOT_BUILT
);
assert_eq!(
net_mesh_blob_adapter_set_overflow_enabled(null_handle, 1),
NET_ERR_FEATURE_NOT_BUILT
);
assert_eq!(
net_mesh_blob_adapter_set_overflow_config(null_handle, std::ptr::null()),
NET_ERR_FEATURE_NOT_BUILT
);
assert!(net_mesh_blob_adapter_new(
std::ptr::null_mut(),
std::ptr::null(),
0,
std::ptr::null()
)
.is_null());
assert!(net_mesh_blob_adapter_prometheus_text(null_handle).is_null());
assert!(net_mesh_blob_adapter_overflow_config(null_handle).is_null());
net_mesh_blob_adapter_free(std::ptr::null_mut());
}
}