ohos-rdb-sys 0.1.0

Raw bindings to the OpenHarmony relational database (RDB) API
Documentation
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
impl Rdb_EncryptionAlgo {
    /// Indicates the database is encrypted using RDB_AES_256_GCM.
    pub const RDB_AES_256_GCM: Rdb_EncryptionAlgo = Rdb_EncryptionAlgo(0);
    /// Indicates the database is encrypted using RDB_AES_256_CBC.
    pub const RDB_AES_256_CBC: Rdb_EncryptionAlgo = Rdb_EncryptionAlgo(1);
    /// Indicates the database is not encrypted.
    ///
    /// Available since API-level: 22
    #[cfg(feature = "api-22")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
    pub const RDB_PLAIN_TEXT: Rdb_EncryptionAlgo = Rdb_EncryptionAlgo(2);
}
#[repr(transparent)]
/// Enumerates the database encryption algorithms.
///
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Rdb_EncryptionAlgo(pub ::core::ffi::c_uint);
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
impl Rdb_HmacAlgo {
    /// RDB_HMAC_SHA1 algorithm.
    pub const RDB_HMAC_SHA1: Rdb_HmacAlgo = Rdb_HmacAlgo(0);
    /// RDB_HMAC_SHA256 algorithm.
    pub const RDB_HMAC_SHA256: Rdb_HmacAlgo = Rdb_HmacAlgo(1);
    /// RDB_HMAC_SHA512 algorithm.
    pub const RDB_HMAC_SHA512: Rdb_HmacAlgo = Rdb_HmacAlgo(2);
}
#[repr(transparent)]
/// Enumerates the supported HMAC algorithm when opening a database.
///
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Rdb_HmacAlgo(pub ::core::ffi::c_uint);
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
impl Rdb_KdfAlgo {
    /// RDB_KDF_SHA1 algorithm.
    pub const RDB_KDF_SHA1: Rdb_KdfAlgo = Rdb_KdfAlgo(0);
    /// RDB_KDF_SHA256 algorithm.
    pub const RDB_KDF_SHA256: Rdb_KdfAlgo = Rdb_KdfAlgo(1);
    /// RDB_KDF_SHA512 algorithm.
    pub const RDB_KDF_SHA512: Rdb_KdfAlgo = Rdb_KdfAlgo(2);
}
#[repr(transparent)]
/// Enumerates the supported KDF algorithm when opening a database.
///
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Rdb_KdfAlgo(pub ::core::ffi::c_uint);
/// Specifies the cryptographic parameters used when opening an encrypted database.
///
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[repr(C)]
pub struct OH_Rdb_CryptoParam {
    _unused: [u8; 0],
}
extern "C" {
    /// Creates an OH_Rdb_CryptoParam instance object.
    ///
    ///
    /// # Returns
    ///
    /// * Returns a pointer to OH_Rdb_CryptoParam instance when the execution is successful.
    /// Otherwise, nullptr is returned. The memory must be released through the OH_Rdb_DestroyCryptoParam
    /// interface after the use is complete.
    /// [`OH_Rdb_DestroyCryptoParam.`]
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Rdb_CreateCryptoParam() -> *mut OH_Rdb_CryptoParam;
    /// Destroys an OH_Rdb_CryptoParam instance object.
    ///
    /// # Arguments
    ///
    /// * `param` - Represents a pointer to an instance of OH_Rdb_CryptoParam.
    ///
    /// # Returns
    ///
    /// * Returns the error code.
    /// Returns [`RDB_OK`] if the execution is successful.
    /// Returns [`RDB_E_INVALID_ARGS`] if invalid input parameter.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Rdb_DestroyCryptoParam(param: *mut OH_Rdb_CryptoParam) -> ::core::ffi::c_int;
    /// Sets key data to the OH_Rdb_CryptoParam object.
    ///
    /// # Arguments
    ///
    /// * `param` - Represents a pointer to an instance of OH_Rdb_CryptoParam.
    ///
    /// * `key` - Represents a pointer to array data.
    ///
    /// * `length` - Represents the size of key array.
    ///
    /// # Returns
    ///
    /// * Returns the error code.
    /// Returns [`RDB_OK`] if the execution is successful.
    /// Returns [`RDB_E_INVALID_ARGS`] if invalid input parameter.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Crypto_SetEncryptionKey(
        param: *mut OH_Rdb_CryptoParam,
        key: *const u8,
        length: i32,
    ) -> ::core::ffi::c_int;
    /// Sets the number of KDF iterations used when opening an encrypted database.
    ///
    /// # Arguments
    ///
    /// * `param` - Represents a pointer to an instance of OH_Rdb_CryptoParam.
    ///
    /// * `iteration` - Represents iterations times.
    ///
    /// # Returns
    ///
    /// * Returns the error code.
    /// Returns [`RDB_OK`] if the execution is successful.
    /// Returns [`RDB_E_INVALID_ARGS`] if invalid input parameter.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Crypto_SetIteration(
        param: *mut OH_Rdb_CryptoParam,
        iteration: i64,
    ) -> ::core::ffi::c_int;
    /// Sets the encryption algorithm when opening an encrypted database.
    ///
    /// # Arguments
    ///
    /// * `param` - Represents a pointer to an instance of OH_Rdb_CryptoParam.
    ///
    /// * `algo` - Represents the encryption algorithm.
    ///
    /// # Returns
    ///
    /// * Returns the error code.
    /// Returns [`RDB_OK`] if the execution is successful.
    /// Returns [`RDB_E_INVALID_ARGS`] if invalid input parameter.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Crypto_SetEncryptionAlgo(
        param: *mut OH_Rdb_CryptoParam,
        algo: i32,
    ) -> ::core::ffi::c_int;
    /// Sets the HMAC algorithm when opening an encrypted database.
    ///
    /// # Arguments
    ///
    /// * `param` - Represents a pointer to an instance of OH_Rdb_CryptoParam.
    ///
    /// * `algo` - Represents the HMAC algorithm.
    ///
    /// # Returns
    ///
    /// * Returns the error code.
    /// Returns [`RDB_OK`] if the execution is successful.
    /// Returns [`RDB_E_INVALID_ARGS`] if invalid input parameter.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Crypto_SetHmacAlgo(param: *mut OH_Rdb_CryptoParam, algo: i32) -> ::core::ffi::c_int;
    /// Sets the KDF algorithm when opening an encrypted database.
    ///
    /// # Arguments
    ///
    /// * `param` - Represents a pointer to an instance of OH_Rdb_CryptoParam.
    ///
    /// * `algo` - Represents the KDF algorithm.
    ///
    /// # Returns
    ///
    /// * Returns the error code.
    /// Returns [`RDB_OK`] if the execution is successful.
    /// Returns [`RDB_E_INVALID_ARGS`] if invalid input parameter.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Crypto_SetKdfAlgo(param: *mut OH_Rdb_CryptoParam, algo: i32) -> ::core::ffi::c_int;
    /// Sets the page size used when opening an encrypted database.
    ///
    /// # Arguments
    ///
    /// * `param` - Represents a pointer to an instance of OH_Rdb_CryptoParam.
    ///
    /// * `size` - Represents the page size.
    ///
    /// # Returns
    ///
    /// * Returns the error code.
    /// Returns [`RDB_OK`] if the execution is successful.
    /// Returns [`RDB_E_INVALID_ARGS`] if invalid input parameter.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Crypto_SetCryptoPageSize(
        param: *mut OH_Rdb_CryptoParam,
        size: i64,
    ) -> ::core::ffi::c_int;
}