41 void *(*pfMalloc)(uint32_t size);
274#define BSL_SAL_FREE(value_) \
276 if ((value_) != NULL) { \
277 BSL_SAL_Free((void *)(value_)); \
282#define BSL_SAL_ONCE_INIT 0
768int32_t
BSL_SAL_SetSockopt(int32_t sockId, int32_t level, int32_t name,
const void *val, uint32_t len);
864int32_t
BSL_SAL_Select(int32_t nfds,
void *readfds,
void *writefds,
void *exceptfds,
void *timeout);
void * BSL_SAL_SockAddr
Definition bsl_sal.h:723
void * bsl_sal_file_handle
Definition bsl_sal.h:472
int32_t(* pfThreadUnlock)(BSL_SAL_ThreadLockHandle lock)
Unlock
Definition bsl_sal.h:149
int32_t BSL_SAL_FileRead(bsl_sal_file_handle stream, void *buffer, size_t size, size_t num, size_t *len)
Read the file.
int32_t BSL_SAL_ThreadWriteLock(BSL_SAL_ThreadLockHandle lock)
Lock the write operation.
int32_t BSL_SAL_ThreadCreate(BSL_SAL_ThreadId *thread, void *(*startFunc)(void *), void *arg)
Create a thread.
void BSL_SAL_SysTimeFuncReg(BslTimeFunc func)
Interface for registering the function for obtaining the system time You can use this API to register...
uint32_t BSL_SAL_DateTimeCompareByUs(const BSL_TIME *dateA, const BSL_TIME *dateB)
Compare two dates, accurate to microseconds.
int32_t BSL_SAL_ThreadUnlock(BSL_SAL_ThreadLockHandle lock)
Unlock
int32_t BSL_SAL_SockGetLastSocketError(void)
Obtain the last error corresponding to the socket.
int32_t BSL_SAL_SockBind(int32_t sockId, BSL_SAL_SockAddr addr, size_t len)
Binding a socket
int32_t(* pfThreadReadLock)(BSL_SAL_ThreadLockHandle lock)
Lock the read operation.
Definition bsl_sal.h:123
void * BSL_SAL_CondVar
Definition bsl_sal.h:80
int32_t BSL_SAL_FileLength(const char *path, size_t *len)
Obtain the file length.
int32_t BSL_SAL_SockListen(int32_t sockId, int32_t backlog)
Listening socket
int32_t BSL_SAL_CondSignal(BSL_SAL_CondVar condVar)
The waiting time ends or the signal is obtained.
uint64_t(* pfThreadGetId)(void)
Obtain the thread ID.
Definition bsl_sal.h:159
int32_t BSL_SAL_ThreadRunOnce(uint32_t *onceControl, BSL_SAL_ThreadInitRoutine initFunc)
Execute only once.
int32_t BSL_SAL_ThreadLockNew(BSL_SAL_ThreadLockHandle *lock)
Create a thread lock.
void BSL_SAL_CleanseData(void *ptr, uint32_t size)
Set sensitive information to zero.
int32_t BSL_SAL_DeleteCondVar(BSL_SAL_CondVar condVar)
Delete a condition variable.
int32_t(* pfThreadLockNew)(BSL_SAL_ThreadLockHandle *lock)
Create a thread lock.
Definition bsl_sal.h:100
BslUnixTime(* BslTimeFunc)(void)
Prototype of the callback function for obtaining the time
Definition bsl_sal.h:582
int64_t BslUnixTime
Unix Time structure definition.
Definition bsl_sal.h:574
void BSL_SAL_ThreadLockFree(BSL_SAL_ThreadLockHandle lock)
Release the thread lock.
void BSL_SAL_FileClose(bsl_sal_file_handle stream)
Close the file.
int32_t BSL_SAL_Select(int32_t nfds, void *readfds, void *writefds, void *exceptfds, void *timeout)
Check the socket descriptor.
void * BSL_SAL_Malloc(uint32_t size)
Allocate memory space.
uint32_t BSL_SAL_SysTimeGet(BSL_TIME *sysTime)
Obtain the system time.
int32_t BSL_SAL_SetSockopt(int32_t sockId, int32_t level, int32_t name, const void *val, uint32_t len)
Set the socket
int32_t BSL_SAL_FileOpen(bsl_sal_file_handle *stream, const char *path, const char *mode)
Open a file.
int32_t BSL_SAL_StrcaseCmp(const char *str1, const char *str2)
String comparison
long BSL_SAL_Tick(void)
Obtain the number of ticks that the system has experienced since startup.
void * BSL_SAL_Calloc(uint32_t num, uint32_t size)
Allocate and clear the memory space.
int32_t BSL_SAL_CreateCondVar(BSL_SAL_CondVar *condVar)
Create a condition variable.
int32_t BSL_SAL_SockConnect(int32_t sockId, BSL_SAL_SockAddr addr, size_t len)
Initiate a connection.
int32_t BSL_SAL_RegThreadCallback(BSL_SAL_ThreadCallback *cb)
Interface for registering thread-related callback functions.
uint32_t BSL_SAL_UtcTimeToDateConvert(int64_t utcTime, BSL_TIME *sysTime)
Convert the date in the BslUnixTime format to the BslSysTime format.
void * BSL_SAL_Realloc(void *addr, uint32_t newSize, uint32_t oldSize)
Memory expansion
void BSL_SAL_Free(void *value)
Release the specified memory.
struct MemCallback BSL_SAL_MemCallback
int32_t BSL_SAL_SockSend(int32_t sockId, const void *msg, size_t len, int32_t flags)
Send a message.
void * BSL_SAL_Memchr(const char *str, int32_t character, size_t count)
Search for the corresponding character position in a string.
void BSL_SAL_Sleep(uint32_t time)
Sleep the current thread
int32_t BSL_SAL_Ioctlsocket(int32_t sockId, long cmd, unsigned long *arg)
Device control interface function
int32_t BSL_SAL_Atoi(const char *str)
Convert string to number
uint32_t BSL_SAL_DateTimeCompare(const BSL_TIME *dateA, const BSL_TIME *dateB, int64_t *diffSec)
Compare Two Dates
int32_t BSL_SAL_ThreadReadLock(BSL_SAL_ThreadLockHandle lock)
Lock the read operation.
void BSL_SAL_ThreadClose(BSL_SAL_ThreadId thread)
Close the thread.
void(* BSL_SAL_ThreadInitRoutine)(void)
run once: Use the initialization callback.
Definition bsl_sal.h:370
struct ThreadCallback BSL_SAL_ThreadCallback
int32_t BSL_SAL_SockRecv(int32_t sockfd, void *buff, size_t len, int32_t flags)
Receive the message.
int32_t BSL_SAL_SockClose(int32_t sockId)
Close the socket
uint32_t BSL_SAL_DateToUtcTimeConvert(const BSL_TIME *dateTime, int64_t *utcTime)
Convert the date in the BslSysTime format to the UTC time format.
void * BSL_SAL_ThreadLockHandle
Definition bsl_sal.h:59
uint32_t BSL_SAL_Strnlen(const char *string, uint32_t count)
Obtain the length of a given string.
int32_t BSL_SAL_CondTimedwaitMs(BSL_SAL_Mutex condMutex, BSL_SAL_CondVar condVar, int32_t timeout)
The waiting time ends or the signal is obtained.
int32_t BSL_SAL_RegMemCallback(BSL_SAL_MemCallback *cb)
Interface for registering memory-related callback functions
void * BSL_SAL_Mutex
Definition bsl_sal.h:73
int32_t(* pfThreadWriteLock)(BSL_SAL_ThreadLockHandle lock)
Lock the write operation.
Definition bsl_sal.h:136
uint64_t BSL_SAL_ThreadGetId(void)
Obtain the thread ID.
void(* pfFree)(void *addr)
Reclaim a memory block allocated by pfMalloc.
Definition bsl_sal.h:51
int32_t BSL_SAL_FileWrite(bsl_sal_file_handle stream, const void *buffer, size_t size, size_t num)
Write a file
void BSL_SAL_ClearFree(void *ptr, uint32_t size)
Clear sensitive information and release memory.
int32_t BSL_SAL_Socket(int32_t af, int32_t type, int32_t protocol)
Socket creation interface
long BSL_SAL_TicksPerSec(void)
Obtain the number of system ticks per second.
void * BSL_SAL_Dump(const void *src, uint32_t size)
Duplicate the memory space.
void(* pfThreadLockFree)(BSL_SAL_ThreadLockHandle lock)
Release the thread lock.
Definition bsl_sal.h:110
void * BSL_SAL_ThreadId
Definition bsl_sal.h:66
BslUnixTime BSL_SAL_CurrentSysTimeGet(void)
Obtain the Unix time.
uint32_t microSec
Definition bsl_sal.h:567
uint8_t month
Definition bsl_sal.h:558
uint8_t utcSign
Definition bsl_sal.h:564
uint8_t utcMinute
Definition bsl_sal.h:566
uint16_t year
Definition bsl_sal.h:557
uint8_t day
Definition bsl_sal.h:559
uint8_t utcHour
Definition bsl_sal.h:565
uint8_t second
Definition bsl_sal.h:563
uint8_t minute
Definition bsl_sal.h:561
uint16_t millSec
Definition bsl_sal.h:562
uint8_t hour
Definition bsl_sal.h:560
Basic time data structure definition.
Definition bsl_sal.h:556