1 /* 2 * This file is part of the openHiTLS project. 3 * 4 * openHiTLS is licensed under the Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * 8 * http://license.coscl.org.cn/MulanPSL2 9 * 10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13 * See the Mulan PSL v2 for more details. 14 */ 15 16 #ifndef SAL_FILEIMPL_H 17 #define SAL_FILEIMPL_H 18 19 #include "hitls_build.h" 20 #ifdef HITLS_BSL_SAL_FILE 21 22 #include <stdint.h> 23 #include "bsl_sal.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif // __cplusplus 28 29 typedef struct { 30 BslSalFileOpen pfFileOpen; 31 BslSalFileClose pfFileClose; 32 BslSalFileRead pfFileRead; 33 BslSalFileWrite pfFileWrite; 34 BslSalFileLength pfFileLength; 35 } BSL_SAL_FileCallback; 36 37 int32_t SAL_FileCallback_Ctrl(BSL_SAL_CB_FUNC_TYPE type, void *funcCb); 38 39 #ifdef HITLS_BSL_SAL_LINUX 40 int32_t SAL_FileOpen(bsl_sal_file_handle *stream, const char *path, const char *mode); 41 int32_t SAL_FileRead(bsl_sal_file_handle stream, void *buffer, size_t size, size_t num, size_t *len); 42 int32_t SAL_FileWrite(bsl_sal_file_handle stream, const void *buffer, size_t size, size_t num); 43 void SAL_FileClose(bsl_sal_file_handle stream); 44 int32_t SAL_FileLength(const char *path, size_t *len); 45 #endif 46 47 #ifdef __cplusplus 48 } 49 #endif // __cplusplus 50 51 #endif // HITLS_BSL_SAL_FILE 52 #endif // SAL_FILEIMPL_H 53