/* automatically generated by rust-bindgen 0.65.1 */

#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(clippy::missing_safety_doc)]

#[link(name = "ohfileshare")]
unsafe extern "C" {}

#[doc = " operation completed successfully."]
pub const FileManagement_ErrCode_ERR_OK: FileManagement_ErrCode = 0;
#[doc = " permission verification failed."]
pub const FileManagement_ErrCode_ERR_PERMISSION_ERROR: FileManagement_ErrCode = 201;
#[doc = " invalid input parameter."]
pub const FileManagement_ErrCode_ERR_INVALID_PARAMETER: FileManagement_ErrCode = 401;
#[doc = " device not supported."]
pub const FileManagement_ErrCode_ERR_DEVICE_NOT_SUPPORTED: FileManagement_ErrCode = 801;
#[doc = " operation not permitted."]
pub const FileManagement_ErrCode_ERR_EPERM: FileManagement_ErrCode = 13900001;
#[doc = " no such file or directory."]
pub const FileManagement_ErrCode_ERR_ENOENT: FileManagement_ErrCode = 13900002;
#[doc = " out of memory."]
pub const FileManagement_ErrCode_ERR_ENOMEM: FileManagement_ErrCode = 13900011;
#[doc = " unknown error."]
pub const FileManagement_ErrCode_ERR_UNKNOWN: FileManagement_ErrCode = 13900042;
#[doc = " @brief error codes of file management\n @since 12"]
pub type FileManagement_ErrCode = u32;
#[doc = " @brief Indicates that the policy is not allowed to be persisted."]
pub const FileShare_PolicyErrorCode_PERSISTENCE_FORBIDDEN: FileShare_PolicyErrorCode = 1;
#[doc = " @brief Indicates that the mode of this policy is invalid."]
pub const FileShare_PolicyErrorCode_INVALID_MODE: FileShare_PolicyErrorCode = 2;
#[doc = " @brief Indicates that the path of this policy is invalid."]
pub const FileShare_PolicyErrorCode_INVALID_PATH: FileShare_PolicyErrorCode = 3;
#[doc = " @brief Indicates that the policy is no persistent capability."]
pub const FileShare_PolicyErrorCode_PERMISSION_NOT_PERSISTED: FileShare_PolicyErrorCode = 4;
#[doc = " @brief Enumerates the error code of the permission policy for the URI operation.\n\n @since 12"]
pub type FileShare_PolicyErrorCode = u32;
#[doc = " @brief Define the FileShare_PolicyErrorResult structure type.\n\n Failed policy result on URI.\n\n @since 12"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FileShare_PolicyErrorResult {
    #[doc = " Indicates the failed uri of the policy information."]
    pub uri: *mut ::std::os::raw::c_char,
    #[doc = " Indicates the error code of the failure in the policy information."]
    pub code: FileShare_PolicyErrorCode,
    #[doc = " Indicates the reason of the failure in the policy information."]
    pub message: *mut ::std::os::raw::c_char,
}
#[doc = " @brief Define the FileShare_PolicyInfo structure type.\n\n Policy information to manager permissions on a URI.\n\n @since 12"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FileShare_PolicyInfo {
    #[doc = " Indicates the uri of the policy information."]
    pub uri: *mut ::std::os::raw::c_char,
    #[doc = " Indicates The length of the uri."]
    pub length: ::std::os::raw::c_uint,
    #[doc = " Indicates the mode of operation for the URI.\n example { FileShare_OperationMode.READ_MODE } or { FileShare_OperationMode.READ_MODE |\n FileShare_OperationMode.WRITE_MODE }."]
    pub operationMode: ::std::os::raw::c_uint,
}
extern "C" {
    #[doc = " @brief Set persistent permissions for the URI.\n\n @permission ohos.permission.FILE_ACCESS_PERSIST\n @param policies Input a pointer to an {@link FileShare_PolicyInfo} instance.\n @param policyNum Indicates the size of the policies array.\n @param result Output a pointer to an {@link FileShare_PolicyErrorResult} instance. Please use\n OH_FileShare_ReleasePolicyErrorResult() to clear Resource.\n @param resultNum Output the size of the result array.\n @return Returns the status code of the execution.\n         {@link ERR_INVALID_PARAMETER} 401 - Invalid input parameter.\n         {@link ERR_DEVICE_NOT_SUPPORTED} 801 - Device not supported.\n         {@link ERR_PERMISSION_ERROR} 201 - No permission to perform this operation.\n         {@link ERR_EPERM} 13900001 - operation not permitted.\n         {@link ERR_ENOMEM} 13900011 - Failed to apply for memory or failed to copy memory.\n         {@link ERR_OK} 0 - This operation was successfully executed.\n @since 12"]
    pub fn OH_FileShare_PersistPermission(
        policies: *const FileShare_PolicyInfo,
        policyNum: ::std::os::raw::c_uint,
        result: *mut *mut FileShare_PolicyErrorResult,
        resultNum: *mut ::std::os::raw::c_uint,
    ) -> FileManagement_ErrCode;
}
extern "C" {
    #[doc = " @brief Revoke persistent permissions for the URI.\n\n @permission ohos.permission.FILE_ACCESS_PERSIST\n @param policies Input a pointer to an {@link FileShare_PolicyInfo} instance.\n @param policyNum Indicates the size of the policies array.\n @param result Output a pointer to an {@link FileShare_PolicyErrorResult} instance. Please use\n OH_FileShare_ReleasePolicyErrorResult() to clear Resource.\n @param resultNum Output the size of the result array.\n @return Returns the status code of the execution.\n         {@link ERR_INVALID_PARAMETER} 401 - Invalid input parameter.\n         {@link ERR_DEVICE_NOT_SUPPORTED} 801 - Device not supported.\n         {@link ERR_PERMISSION_ERROR} 201 - No permission to perform this operation.\n         {@link ERR_EPERM} 13900001 - operation not permitted.\n         {@link ERR_ENOMEM} 13900011 - Failed to apply for memory or failed to copy memory.\n         {@link ERR_OK} 0 - This operation was successfully executed.\n @since 12"]
    pub fn OH_FileShare_RevokePermission(
        policies: *const FileShare_PolicyInfo,
        policyNum: ::std::os::raw::c_uint,
        result: *mut *mut FileShare_PolicyErrorResult,
        resultNum: *mut ::std::os::raw::c_uint,
    ) -> FileManagement_ErrCode;
}
extern "C" {
    #[doc = " @brief Enable the URI that have been permanently authorized.\n\n @permission ohos.permission.FILE_ACCESS_PERSIST\n @param policies Input a pointer to an {@link FileShare_PolicyInfo} instance.\n @param policyNum Indicates the size of the policies array.\n @param result Output a pointer to an {@link FileShare_PolicyErrorResult} instance. Please use\n OH_FileShare_ReleasePolicyErrorResult() to clear Resource.\n @param resultNum Output the size of the result array.\n @return Returns the status code of the execution.\n         {@link ERR_INVALID_PARAMETER} 401 - Invalid input parameter.\n         {@link ERR_DEVICE_NOT_SUPPORTED} 801 - Device not supported.\n         {@link ERR_PERMISSION_ERROR} 201 - No permission to perform this operation.\n         {@link ERR_EPERM} 13900001 - operation not permitted.\n         {@link ERR_ENOMEM} 13900011 - Failed to apply for memory or failed to copy memory.\n         {@link ERR_OK} 0 - This operation was successfully executed.\n @since 12"]
    pub fn OH_FileShare_ActivatePermission(
        policies: *const FileShare_PolicyInfo,
        policyNum: ::std::os::raw::c_uint,
        result: *mut *mut FileShare_PolicyErrorResult,
        resultNum: *mut ::std::os::raw::c_uint,
    ) -> FileManagement_ErrCode;
}
extern "C" {
    #[doc = " @brief Stop the authorized URI that has been enabled.\n\n @permission ohos.permission.FILE_ACCESS_PERSIST\n @param policies Input a pointer to an {@link FileShare_PolicyInfo} instance.\n @param policyNum Indicates the size of the policies array.\n @param result Output a pointer to an {@link FileShare_PolicyErrorResult} instance. Please use\n OH_FileShare_ReleasePolicyErrorResult() to clear Resource.\n @param resultNum Output the size of the result array.\n @return Returns the status code of the execution.\n         {@link ERR_INVALID_PARAMETER} 401 - Invalid input parameter.\n         {@link ERR_DEVICE_NOT_SUPPORTED} 801 - Device not supported.\n         {@link ERR_PERMISSION_ERROR} 201 - No permission to perform this operation.\n         {@link ERR_EPERM} 13900001 - operation not permitted.\n         {@link ERR_ENOMEM} 13900011 - Failed to apply for memory or failed to copy memory.\n         {@link ERR_OK} 0 - This operation was successfully executed.\n @since 12"]
    pub fn OH_FileShare_DeactivatePermission(
        policies: *const FileShare_PolicyInfo,
        policyNum: ::std::os::raw::c_uint,
        result: *mut *mut FileShare_PolicyErrorResult,
        resultNum: *mut ::std::os::raw::c_uint,
    ) -> FileManagement_ErrCode;
}
extern "C" {
    #[doc = " @brief Check persistent permissions for the URI.\n\n @permission ohos.permission.FILE_ACCESS_PERSIST\n @param policies Input a pointer to an {@link FileShare_PolicyInfo} instance.\n @param policyNum Indicates the size of the policies array.\n @param result Output a pointer to an bool instance. Please use free() to clear Resource.\n @param resultNum Output the size of the result array.\n @return Returns the status code of the execution.\n         {@link ERR_INVALID_PARAMETER} 401 - Invalid input parameter.\n         {@link ERR_DEVICE_NOT_SUPPORTED} 801 - Device not supported.\n         {@link ERR_PERMISSION_ERROR} 201 - No permission to perform this operation.\n         {@link ERR_EPERM} 13900001 - operation not permitted.\n         {@link ERR_ENOMEM} 13900011 - Failed to apply for memory or failed to copy memory.\n         {@link ERR_OK} 0 - This operation was successfully executed.\n @since 12"]
    pub fn OH_FileShare_CheckPersistentPermission(
        policies: *const FileShare_PolicyInfo,
        policyNum: ::std::os::raw::c_uint,
        result: *mut *mut bool,
        resultNum: *mut ::std::os::raw::c_uint,
    ) -> FileManagement_ErrCode;
}
extern "C" {
    #[doc = " @brief Free FileShare_PolicyErrorResult pointer points to address memory.\n\n @param errorResult Input a pointer to an {@link FileShare_PolicyErrorResult} instance.\n @param resultNum Indicates the size of the errorResult array.\n @since 12"]
    pub fn OH_FileShare_ReleasePolicyErrorResult(
        errorResult: *mut FileShare_PolicyErrorResult,
        resultNum: ::std::os::raw::c_uint,
    );
}
