1060ff233Sopenharmony_ci/* 2060ff233Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3060ff233Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4060ff233Sopenharmony_ci * you may not use this file except in compliance with the License. 5060ff233Sopenharmony_ci * You may obtain a copy of the License at 6060ff233Sopenharmony_ci * 7060ff233Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8060ff233Sopenharmony_ci * 9060ff233Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10060ff233Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11060ff233Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12060ff233Sopenharmony_ci * See the License for the specific language governing permissions and 13060ff233Sopenharmony_ci * limitations under the License. 14060ff233Sopenharmony_ci */ 15060ff233Sopenharmony_ci 16060ff233Sopenharmony_ci#ifndef FILLP_CALLBACKS_H 17060ff233Sopenharmony_ci#define FILLP_CALLBACKS_H 18060ff233Sopenharmony_ci 19060ff233Sopenharmony_ci#include "fillptypes.h" 20060ff233Sopenharmony_ci#ifdef __cplusplus 21060ff233Sopenharmony_ciextern "C" { 22060ff233Sopenharmony_ci#endif 23060ff233Sopenharmony_ci 24060ff233Sopenharmony_ci/** 25060ff233Sopenharmony_ci * @ingroup Callbacks 26060ff233Sopenharmony_ci * @brief 27060ff233Sopenharmony_ci * This callback is for calloc system function to allocate the requested memory. 28060ff233Sopenharmony_ci * 29060ff233Sopenharmony_ci * @param[in] items Indicates the number of elements to be allocated. 30060ff233Sopenharmony_ci * @param[in] size size of elements. 31060ff233Sopenharmony_ci * @return 32060ff233Sopenharmony_ci * This function returns a pointer to the allocated memory or return NULL in case of failure of the request. 33060ff233Sopenharmony_ci */ 34060ff233Sopenharmony_citypedef void *(*FillpMemCallocFunc)(IN FILLP_UINT32 items, IN FILLP_UINT32 size); 35060ff233Sopenharmony_ci 36060ff233Sopenharmony_ci/** 37060ff233Sopenharmony_ci * @ingroup Callbacks 38060ff233Sopenharmony_ci * @brief 39060ff233Sopenharmony_ci * This callback is for malloc system function to allocate the requested memory. 40060ff233Sopenharmony_ci * 41060ff233Sopenharmony_ci * @param[in] size Indicates the memory size to be allocated. 42060ff233Sopenharmony_ci * @return 43060ff233Sopenharmony_ci * This function returns a pointer to the allocated memory or returns NULL if the request fails. 44060ff233Sopenharmony_ci */ 45060ff233Sopenharmony_citypedef void *(*FillpMemAllocFunc)(IN FILLP_UINT32 size); 46060ff233Sopenharmony_ci 47060ff233Sopenharmony_ci/** 48060ff233Sopenharmony_ci * @ingroup Callbacks 49060ff233Sopenharmony_ci * @brief 50060ff233Sopenharmony_ci * This callback is for free system function to free the memory block. 51060ff233Sopenharmony_ci * 52060ff233Sopenharmony_ci * @param[in] addr Indicates the address of the memory to be freed. 53060ff233Sopenharmony_ci * @return 54060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 55060ff233Sopenharmony_ci * On failure : other error codes. 56060ff233Sopenharmony_ci */ 57060ff233Sopenharmony_citypedef void (*FillpMemFreeFunc)(IN void *addr); 58060ff233Sopenharmony_ci 59060ff233Sopenharmony_ci/** 60060ff233Sopenharmony_ci * @ingroup Callbacks 61060ff233Sopenharmony_ci * @brief 62060ff233Sopenharmony_ci * This is a callback for memset_s system function to fill the specified memory block with the specified characters. 63060ff233Sopenharmony_ci * 64060ff233Sopenharmony_ci * @param[in] dest Pointer to destination memory buffer. 65060ff233Sopenharmony_ci * @param[in] destMax Length of destination memory buffer. 66060ff233Sopenharmony_ci * @param[in] character Character to be set. 67060ff233Sopenharmony_ci * @param[in] count Number of bytes to set. 68060ff233Sopenharmony_ci * @return 69060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 70060ff233Sopenharmony_ci * On failure : other error codes. 71060ff233Sopenharmony_ci */ 72060ff233Sopenharmony_citypedef FILLP_INT (*FillpMemSetFunc)(void *dest, size_t destMax, int c, size_t count); 73060ff233Sopenharmony_ci 74060ff233Sopenharmony_ci/** 75060ff233Sopenharmony_ci * @ingroup Callbacks 76060ff233Sopenharmony_ci * @brief 77060ff233Sopenharmony_ci * This callback is for memcpy_s system function to copy memory. 78060ff233Sopenharmony_ci * 79060ff233Sopenharmony_ci * @param[out] dest Indicates a pointer to the destination memory buffer. 80060ff233Sopenharmony_ci * @param[in] destMax Indicates the size of the destination memory buffer. 81060ff233Sopenharmony_ci * @param[in] src Indicates a pointer to the source memory buffer. 82060ff233Sopenharmony_ci * @param[in] count Indicates the number of bytes to copy. 83060ff233Sopenharmony_ci * @return 84060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 85060ff233Sopenharmony_ci * On failure : other error codes. 86060ff233Sopenharmony_ci */ 87060ff233Sopenharmony_citypedef FILLP_INT (*FillpMemCopyFunc)(void *dest, size_t destMax, const void *src, size_t count); 88060ff233Sopenharmony_ci 89060ff233Sopenharmony_ci/** 90060ff233Sopenharmony_ci * @ingroup Callbacks 91060ff233Sopenharmony_ci * @brief 92060ff233Sopenharmony_ci * This callback is for string concatenations system function to concatenate strings. 93060ff233Sopenharmony_ci * 94060ff233Sopenharmony_ci * @param[out] dest Indicates a pointer to the destination memory buffer. 95060ff233Sopenharmony_ci * @param[in] destMax Indicates the length of the destination memory buffer. 96060ff233Sopenharmony_ci * @param[in] src Indicates a pointer to the source memory buffer. 97060ff233Sopenharmony_ci * @param[in] count Indicates the number of bytes to be copy. 98060ff233Sopenharmony_ci * @return 99060ff233Sopenharmony_ci * On success : 0 100060ff233Sopenharmony_ci * On failure : other error codes. 101060ff233Sopenharmony_ci */ 102060ff233Sopenharmony_citypedef FILLP_INT (*FillpStrncatFunc)(char *strDest, size_t destMax, const char *strSrc, size_t count); 103060ff233Sopenharmony_ci 104060ff233Sopenharmony_ci/** 105060ff233Sopenharmony_ci * @ingroup Callbacks 106060ff233Sopenharmony_ci * @brief 107060ff233Sopenharmony_ci * Callback for string copy system function. 108060ff233Sopenharmony_ci * 109060ff233Sopenharmony_ci * @param[out] dest Indicates a pointer to the destination memory buffer. 110060ff233Sopenharmony_ci * @param[in] destMax Indicates the length of the destination memory buffer. 111060ff233Sopenharmony_ci * @param[in] src Indicates a pointer to the source memory buffer. 112060ff233Sopenharmony_ci * @param[in] count Indicates the number of bytes to be copied. 113060ff233Sopenharmony_ci * @return 114060ff233Sopenharmony_ci * On success : 0 115060ff233Sopenharmony_ci * On truncation : STRUNCATE 116060ff233Sopenharmony_ci * On failure : other error codes. 117060ff233Sopenharmony_ci */ 118060ff233Sopenharmony_citypedef FILLP_INT (*FillpStrncpyFunc)(char *strDest, size_t destMax, const char *strSrc, size_t count); 119060ff233Sopenharmony_ci 120060ff233Sopenharmony_ci/** 121060ff233Sopenharmony_ci * @ingroup Callbacks 122060ff233Sopenharmony_ci * @brief 123060ff233Sopenharmony_ci * This is a callback for strlen system function to get the length of a string. 124060ff233Sopenharmony_ci * 125060ff233Sopenharmony_ci * @param[in] str Pointer to string. 126060ff233Sopenharmony_ci * @return 127060ff233Sopenharmony_ci * This returns length of the string. 128060ff233Sopenharmony_ci */ 129060ff233Sopenharmony_citypedef FILLP_UINT32 (*FillpStrLenFunc)(IN FILLP_CHAR *str); 130060ff233Sopenharmony_ci 131060ff233Sopenharmony_ci/** 132060ff233Sopenharmony_ci * @ingroup Callbacks 133060ff233Sopenharmony_ci * @brief 134060ff233Sopenharmony_ci * This is a callback for select system function to allow a program to check multiple file descriptors. 135060ff233Sopenharmony_ci * 136060ff233Sopenharmony_ci * @param[in] maxFd Indicates the fd value to be selected. 137060ff233Sopenharmony_ci * @param[in] readFds Indicates the fd for read. 138060ff233Sopenharmony_ci * @param[in] writeFds Indicates the fd for write. 139060ff233Sopenharmony_ci * @param[out] exceptFds Indicates the fd for errors. 140060ff233Sopenharmony_ci * @param[in] timeVal Indicates the max time for select to wait. 141060ff233Sopenharmony_ci * @return 142060ff233Sopenharmony_ci * On success : Total number of socket handles that are ready. 143060ff233Sopenharmony_ci * On failure : other error codes. 144060ff233Sopenharmony_ci */ 145060ff233Sopenharmony_citypedef FILLP_INT (*FillpSelectFunc)(IN FILLP_INT maxFd, IN void *readFds, 146060ff233Sopenharmony_ci IN void *writeFds, IO void *exceptFds, IN void *timeVal); 147060ff233Sopenharmony_ci 148060ff233Sopenharmony_ci/** 149060ff233Sopenharmony_ci * @ingroup Callbacks 150060ff233Sopenharmony_ci * @brief 151060ff233Sopenharmony_ci * This callback is for the ioctl socket to control the I/O mode of a socket. 152060ff233Sopenharmony_ci * 153060ff233Sopenharmony_ci * @param[in] fd Indicates the connection fd. 154060ff233Sopenharmony_ci * @param[in] cmd Indicates the command to perform on socket. 155060ff233Sopenharmony_ci * @param[in] args Indicates arguments for socket. 156060ff233Sopenharmony_ci * @return 157060ff233Sopenharmony_ci * On success : 0 158060ff233Sopenharmony_ci * On failure : other error codes. 159060ff233Sopenharmony_ci */ 160060ff233Sopenharmony_citypedef FILLP_INT (*FillpIoctlFunc)(IN FILLP_INT fd, IN FILLP_INT cmd, IN FILLP_ULONG *args); 161060ff233Sopenharmony_ci 162060ff233Sopenharmony_ci/** 163060ff233Sopenharmony_ci * @ingroup Callbacks 164060ff233Sopenharmony_ci * @brief 165060ff233Sopenharmony_ci * This callback is for the fcntl system function to manipulate file descriptor. 166060ff233Sopenharmony_ci * 167060ff233Sopenharmony_ci * @param[in] fd Indicates a connection file descriptor. 168060ff233Sopenharmony_ci * @param[in] cmd Indicates the command to perform on socket. 169060ff233Sopenharmony_ci * @param[in] val Indicates the arguments for socket. 170060ff233Sopenharmony_ci * @return 171060ff233Sopenharmony_ci * On success : value based on command 172060ff233Sopenharmony_ci * On failure : other error codes. 173060ff233Sopenharmony_ci */ 174060ff233Sopenharmony_citypedef FILLP_INT (*FillpFcntlFunc)(IN FILLP_INT fd, IN FILLP_INT cmd, IN FILLP_INT val); 175060ff233Sopenharmony_ci 176060ff233Sopenharmony_ci/** 177060ff233Sopenharmony_ci * @ingroup Callbacks 178060ff233Sopenharmony_ci * @brief 179060ff233Sopenharmony_ci * This callback is to set the socket option. 180060ff233Sopenharmony_ci * 181060ff233Sopenharmony_ci * @param[in] fd Indicates the socket file descriptor. 182060ff233Sopenharmony_ci * @param[in] level Indicates the socket level. 183060ff233Sopenharmony_ci * @param[in] optName Indicates the socket option name. 184060ff233Sopenharmony_ci * @param[in] optVal Indicates the socket option value. 185060ff233Sopenharmony_ci * @param[in] optLen Indicates the socket option length. 186060ff233Sopenharmony_ci * @return 187060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 188060ff233Sopenharmony_ci * On failure : other error codes. 189060ff233Sopenharmony_ci */ 190060ff233Sopenharmony_citypedef FILLP_INT (*FillpSetSockOptFunc)(IN FILLP_INT fd, IN FILLP_INT level, 191060ff233Sopenharmony_ci IN FILLP_INT optName, IN FILLP_CONST void *optVal, IN FILLP_INT optLen); 192060ff233Sopenharmony_ci 193060ff233Sopenharmony_ci/** 194060ff233Sopenharmony_ci * @ingroup Callbacks 195060ff233Sopenharmony_ci * @brief 196060ff233Sopenharmony_ci * This callback is to get the socket options. 197060ff233Sopenharmony_ci * 198060ff233Sopenharmony_ci * @param[in] fd Indicates the socket file descriptor. 199060ff233Sopenharmony_ci * @param[in] level Indicates the socket level. 200060ff233Sopenharmony_ci * @param[in] optName Indicates the socket option name. 201060ff233Sopenharmony_ci * @param[out] optVal Indicates the socket option value. 202060ff233Sopenharmony_ci * @param[out] optLen Indicates the socket option length. 203060ff233Sopenharmony_ci * @return 204060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 205060ff233Sopenharmony_ci * On failure : other error codes. 206060ff233Sopenharmony_ci */ 207060ff233Sopenharmony_citypedef FILLP_INT (*FillpGetSockOptFunc)(IN FILLP_INT fd, IN FILLP_INT level, 208060ff233Sopenharmony_ci IN FILLP_INT optName, IO void *optVal, IO FILLP_INT *optLen); 209060ff233Sopenharmony_ci 210060ff233Sopenharmony_ci/** 211060ff233Sopenharmony_ci * @ingroup Callbacks 212060ff233Sopenharmony_ci * @brief 213060ff233Sopenharmony_ci * This callback is for the rand system function to generate random number. 214060ff233Sopenharmony_ci * 215060ff233Sopenharmony_ci * @return 216060ff233Sopenharmony_ci * On success : integer value between 0 and RAND_MAX 217060ff233Sopenharmony_ci * On failure : other error codes. 218060ff233Sopenharmony_ci */ 219060ff233Sopenharmony_citypedef FILLP_UINT32 (*FillpRandFunc)(IN void); 220060ff233Sopenharmony_ci 221060ff233Sopenharmony_ci/** 222060ff233Sopenharmony_ci * @ingroup Callbacks 223060ff233Sopenharmony_ci * @brief 224060ff233Sopenharmony_ci * This callback is for generating the cryptographic quality random number. 225060ff233Sopenharmony_ci * 226060ff233Sopenharmony_ci * @return 227060ff233Sopenharmony_ci * On success : integer value between 0 and RAND_MAX 228060ff233Sopenharmony_ci * On failure : other error codes. 229060ff233Sopenharmony_ci */ 230060ff233Sopenharmony_citypedef FILLP_UINT32 (*FillpCryptoRandFunc)(IN void); 231060ff233Sopenharmony_ci 232060ff233Sopenharmony_ci/** 233060ff233Sopenharmony_ci * @ingroup Callbacks 234060ff233Sopenharmony_ci * @brief 235060ff233Sopenharmony_ci * This callback is for memchr system function to search the first occurrence of the character 236060ff233Sopenharmony_ci * in the first n bytes of the string. 237060ff233Sopenharmony_ci * 238060ff233Sopenharmony_ci * @param[in] fd Indicates the pointer to the block of memory where the search is performed. 239060ff233Sopenharmony_ci * @param[in] c Indicates the value to be passed as an int, but the function performs a 240060ff233Sopenharmony_ci * byte by per byte search using the unsigned char conversion of this value. 241060ff233Sopenharmony_ci * @param[in] n Indicates the number of bytes to be analyzed. 242060ff233Sopenharmony_ci * @return 243060ff233Sopenharmony_ci * This returns a pointer to the matching byte or FILLP_NULL_PTR if the character does not 244060ff233Sopenharmony_ci * occur in the given memory area. 245060ff233Sopenharmony_ci */ 246060ff233Sopenharmony_citypedef void *(*FillpMemChrFunc)(IN FILLP_CONST void *fd, IN FILLP_INT c, IN FILLP_SIZE_T n); 247060ff233Sopenharmony_ci 248060ff233Sopenharmony_ci/** 249060ff233Sopenharmony_ci * @ingroup Callbacks 250060ff233Sopenharmony_ci * @brief 251060ff233Sopenharmony_ci * This callback is to create the thread. 252060ff233Sopenharmony_ci * 253060ff233Sopenharmony_ci * @param[in] param Indicates a pointer to the ThreadParam struct. 254060ff233Sopenharmony_ci * @param[out] threadId O|Indicates the thread ID. 255060ff233Sopenharmony_ci * @return 256060ff233Sopenharmony_ci * On success : 0 257060ff233Sopenharmony_ci * On failure : other error codes. 258060ff233Sopenharmony_ci */ 259060ff233Sopenharmony_citypedef FILLP_INT (*FillpCreateThreadFunc)(IN void *param, IO void *threadId); 260060ff233Sopenharmony_ci 261060ff233Sopenharmony_ci/** 262060ff233Sopenharmony_ci * @ingroup Callbacks 263060ff233Sopenharmony_ci * @brief 264060ff233Sopenharmony_ci * This is a callback for the system architecture initialization function. 265060ff233Sopenharmony_ci * 266060ff233Sopenharmony_ci * @return 267060ff233Sopenharmony_ci * On success : ERR_OK 268060ff233Sopenharmony_ci * On failure : ERR_FAILURE. 269060ff233Sopenharmony_ci */ 270060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArcInitFunc)(IN void); 271060ff233Sopenharmony_ci 272060ff233Sopenharmony_ci/** 273060ff233Sopenharmony_ci * @ingroup Callbacks 274060ff233Sopenharmony_ci * @brief 275060ff233Sopenharmony_ci * This callback is to get the system current time in long format. 276060ff233Sopenharmony_ci * 277060ff233Sopenharmony_ci * @return 278060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 279060ff233Sopenharmony_ci * On failure : error. 280060ff233Sopenharmony_ci */ 281060ff233Sopenharmony_citypedef FILLP_LLONG (*FillpSysArcGetCurTimeFunc)(IN void); 282060ff233Sopenharmony_ci 283060ff233Sopenharmony_ci/** 284060ff233Sopenharmony_ci * @ingroup Callbacks 285060ff233Sopenharmony_ci * @brief 286060ff233Sopenharmony_ci * This callback is to increment(increases by 1) the value of the specified variable as an atomic operation. 287060ff233Sopenharmony_ci * 288060ff233Sopenharmony_ci * @param[in,out] var Indicates the variable to increment. 289060ff233Sopenharmony_ci * @param[in] val Indicates the value of the variable. 290060ff233Sopenharmony_ci * @return 291060ff233Sopenharmony_ci * Returns the resulting incremented value. 292060ff233Sopenharmony_ci */ 293060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArchAtomicIncFunc)(IO SysArchAtomic *var, FILLP_INT val); 294060ff233Sopenharmony_ci 295060ff233Sopenharmony_ci/** 296060ff233Sopenharmony_ci * @ingroup Callbacks 297060ff233Sopenharmony_ci * @brief 298060ff233Sopenharmony_ci * This callback is to increment(increases by 1) the value of the specified variable and 299060ff233Sopenharmony_ci * test whether the resulting incremented value is 0 as an atomic operation. 300060ff233Sopenharmony_ci * 301060ff233Sopenharmony_ci * @param[in,out] var Indicates the variable to increment. 302060ff233Sopenharmony_ci * @return 303060ff233Sopenharmony_ci * Returns the checking result whether the resulting incremented value is 0 or not. 304060ff233Sopenharmony_ci */ 305060ff233Sopenharmony_citypedef FILLP_BOOL (*FillpSysArchAtomicIncAndTestFunc)(IO SysArchAtomic *var); 306060ff233Sopenharmony_ci 307060ff233Sopenharmony_ci/** 308060ff233Sopenharmony_ci * @ingroup Callbacks 309060ff233Sopenharmony_ci * @brief 310060ff233Sopenharmony_ci * This callback is to decrement(decreases by 1) the value of the specified variable as an atomic operation. 311060ff233Sopenharmony_ci * 312060ff233Sopenharmony_ci * @param[in,out] var Indicates the variable to decrement. 313060ff233Sopenharmony_ci * @param[in] val Indicates the value of the variable. 314060ff233Sopenharmony_ci * @return 315060ff233Sopenharmony_ci * It returns the resulting decremented value. 316060ff233Sopenharmony_ci */ 317060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArchAtomicDecFunc)(IO SysArchAtomic *var, FILLP_INT val); 318060ff233Sopenharmony_ci 319060ff233Sopenharmony_ci/** 320060ff233Sopenharmony_ci * @ingroup Callbacks 321060ff233Sopenharmony_ci * @brief 322060ff233Sopenharmony_ci * This callback is to decrement(decreases by 1) the value of the specified variable and 323060ff233Sopenharmony_ci * test whether the resulting decremented value is 0 as an atomic operation. 324060ff233Sopenharmony_ci * 325060ff233Sopenharmony_ci * @param[in,out] var Indicates the variable to increment. 326060ff233Sopenharmony_ci * @return 327060ff233Sopenharmony_ci * Returns the checking result whether the resulting decremented value is 0 or not. 328060ff233Sopenharmony_ci */ 329060ff233Sopenharmony_citypedef FILLP_BOOL (*FillpSysArchAtomicDecAndTestFunc)(IO SysArchAtomic *var); 330060ff233Sopenharmony_ci 331060ff233Sopenharmony_ci/** 332060ff233Sopenharmony_ci * @ingroup Callbacks 333060ff233Sopenharmony_ci * @brief 334060ff233Sopenharmony_ci * This callback is to read the value of the specified variable as an atomic operation. 335060ff233Sopenharmony_ci * 336060ff233Sopenharmony_ci * @param[out] var Variable to read. 337060ff233Sopenharmony_ci * @return 338060ff233Sopenharmony_ci * This return the read atomic variable. 339060ff233Sopenharmony_ci */ 340060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArchAtomicReadFunc)(IO SysArchAtomic *var); 341060ff233Sopenharmony_ci 342060ff233Sopenharmony_ci/** 343060ff233Sopenharmony_ci * @ingroup Callbacks 344060ff233Sopenharmony_ci * @brief 345060ff233Sopenharmony_ci * This callback is to set the value of the specified variable as an atomic operation. 346060ff233Sopenharmony_ci * 347060ff233Sopenharmony_ci * @param[in] var A pointer to the value to be exchanged. 348060ff233Sopenharmony_ci * @param[in] newValue The value to be exchanged with the value pointed to by var. 349060ff233Sopenharmony_ci * @return 350060ff233Sopenharmony_ci * It return the initial value of var parameter. 351060ff233Sopenharmony_ci */ 352060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArchAtomicSetFunc)(IN SysArchAtomic *var, IN FILLP_INT newValue); 353060ff233Sopenharmony_ci 354060ff233Sopenharmony_ci/** 355060ff233Sopenharmony_ci * @ingroup Callbacks 356060ff233Sopenharmony_ci * @brief 357060ff233Sopenharmony_ci * This callback is to perform an atomic compare-and-exchange operation on the specified values. 358060ff233Sopenharmony_ci * 359060ff233Sopenharmony_ci * @param[out] sem Indicates a pointer to the destination value. 360060ff233Sopenharmony_ci * @param[in] oldValue Indicates the exchange value. 361060ff233Sopenharmony_ci * @param[in] newValue Indicates the value to compare to sem. 362060ff233Sopenharmony_ci * @return 363060ff233Sopenharmony_ci * This returns the initial value of sem parameter. 364060ff233Sopenharmony_ci */ 365060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArchCompAndSwapFunc)(IO volatile FILLP_ULONG *sem, 366060ff233Sopenharmony_ci IN volatile FILLP_ULONG oldValue, IN volatile FILLP_ULONG newValue); 367060ff233Sopenharmony_ci 368060ff233Sopenharmony_ci/** 369060ff233Sopenharmony_ci * @ingroup Callbacks 370060ff233Sopenharmony_ci * @brief 371060ff233Sopenharmony_ci * This callback is for sleep system function. 372060ff233Sopenharmony_ci * 373060ff233Sopenharmony_ci * @param[in] time The time interval(in milliseconds)for which execution is to be suspended. 374060ff233Sopenharmony_ci * @return 375060ff233Sopenharmony_ci * void 376060ff233Sopenharmony_ci */ 377060ff233Sopenharmony_citypedef void (*FillpSysSleepMsFunc)(IN FILLP_UINT time); /* In Millseconds */ 378060ff233Sopenharmony_ci 379060ff233Sopenharmony_ci/** 380060ff233Sopenharmony_ci * @ingroup Callbacks 381060ff233Sopenharmony_ci * @brief 382060ff233Sopenharmony_ci * This callback for the usleep system function to suspend execution for microsecond intervals. 383060ff233Sopenharmony_ci * 384060ff233Sopenharmony_ci * @param[in] time The time interval for which execution is to be suspended, in microseconds. 385060ff233Sopenharmony_ci * @return 386060ff233Sopenharmony_ci * It returns 0 on success or -1 on error. 387060ff233Sopenharmony_ci */ 388060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysUSleepFunc)(IN FILLP_UINT time); /* us */ 389060ff233Sopenharmony_ci 390060ff233Sopenharmony_ci/** 391060ff233Sopenharmony_ci * @ingroup Callbacks 392060ff233Sopenharmony_ci * @brief 393060ff233Sopenharmony_ci * This callback is for _mm_pause function to PAUSE instruction for tight loops (avoid busy waiting). 394060ff233Sopenharmony_ci * 395060ff233Sopenharmony_ci * @return 396060ff233Sopenharmony_ci * void 397060ff233Sopenharmony_ci */ 398060ff233Sopenharmony_citypedef void (*FillpRtePauseFunc)(void); 399060ff233Sopenharmony_ci 400060ff233Sopenharmony_ci/** 401060ff233Sopenharmony_ci * @ingroup Callbacks 402060ff233Sopenharmony_ci * @brief 403060ff233Sopenharmony_ci * This callback is for init_sem system function to initialize the semaphore. 404060ff233Sopenharmony_ci * 405060ff233Sopenharmony_ci * @param[in] sem Indicates a pointer to semaphore. 406060ff233Sopenharmony_ci * @param[in] value Indicates the value of the initialized semaphore. 407060ff233Sopenharmony_ci * @return 408060ff233Sopenharmony_ci * Initialize the semaphore in sem on successful or error on failure. 409060ff233Sopenharmony_ci */ 410060ff233Sopenharmony_citypedef FILLP_INT (*FillpSemFunc)(IO SYS_ARCH_SEM *sem, IN FILLP_ULONG value); 411060ff233Sopenharmony_ci 412060ff233Sopenharmony_ci/** 413060ff233Sopenharmony_ci * @ingroup Callbacks 414060ff233Sopenharmony_ci * @brief 415060ff233Sopenharmony_ci * This callback is to lock the semaphore referenced by sem only if the semaphore is currently not locked. 416060ff233Sopenharmony_ci * 417060ff233Sopenharmony_ci * @param[out] sem Indicates a pointer to a semaphore to be locked. 418060ff233Sopenharmony_ci * @return 419060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 420060ff233Sopenharmony_ci * On failure : error. 421060ff233Sopenharmony_ci */ 422060ff233Sopenharmony_citypedef FILLP_INT (*FillpSemTryWaitFunc)(IN SYS_ARCH_SEM *sem); 423060ff233Sopenharmony_ci 424060ff233Sopenharmony_ci/** 425060ff233Sopenharmony_ci * @ingroup Callbacks 426060ff233Sopenharmony_ci * @brief 427060ff233Sopenharmony_ci * This callback is to lock the semaphore referenced by sem by performing a semaphore lock operation on that semaphore. 428060ff233Sopenharmony_ci * 429060ff233Sopenharmony_ci * @param[in] sem Indicates a pointer to a semaphore to be locked. 430060ff233Sopenharmony_ci * @return 431060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 432060ff233Sopenharmony_ci * On failure : error. 433060ff233Sopenharmony_ci * 434060ff233Sopenharmony_ci */ 435060ff233Sopenharmony_citypedef FILLP_INT (*FillpSemWaitFunc)(IN SYS_ARCH_SEM *sem); 436060ff233Sopenharmony_ci 437060ff233Sopenharmony_ci/** 438060ff233Sopenharmony_ci * @ingroup Callbacks 439060ff233Sopenharmony_ci * @brief 440060ff233Sopenharmony_ci * This callback unlocks the semaphore referenced by the sem parameter by performing a semaphore 441060ff233Sopenharmony_ci * unlock operation on that semaphore. 442060ff233Sopenharmony_ci * 443060ff233Sopenharmony_ci * @param[in] sem Indicates a pointer to the semaphore to be unlocked. 444060ff233Sopenharmony_ci * @return 445060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 446060ff233Sopenharmony_ci * On failure : error. 447060ff233Sopenharmony_ci */ 448060ff233Sopenharmony_citypedef FILLP_INT (*FillpSemPostFunc)(IN SYS_ARCH_SEM *sem); 449060ff233Sopenharmony_ci 450060ff233Sopenharmony_ci/** 451060ff233Sopenharmony_ci * @ingroup Callbacks 452060ff233Sopenharmony_ci * @brief 453060ff233Sopenharmony_ci * This callback is to destroy the unnamed semaphore indicated by sem. 454060ff233Sopenharmony_ci * 455060ff233Sopenharmony_ci * @param[in] sem Indicates a pointer to the semaphore to be destroyed. 456060ff233Sopenharmony_ci * @return 457060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 458060ff233Sopenharmony_ci * On failure : error. 459060ff233Sopenharmony_ci */ 460060ff233Sopenharmony_citypedef FILLP_INT (*FillpSemDestroyFunc)(IN SYS_ARCH_SEM *sem); 461060ff233Sopenharmony_ci 462060ff233Sopenharmony_ci/** 463060ff233Sopenharmony_ci * @ingroup Callbacks 464060ff233Sopenharmony_ci * @brief 465060ff233Sopenharmony_ci * This is a callback for SYS_ARCH_SEM_CLOSE. 466060ff233Sopenharmony_ci * 467060ff233Sopenharmony_ci * @param[in] sem Indicates a pointer to SYS_ARCH_RW_SEM. 468060ff233Sopenharmony_ci * 469060ff233Sopenharmony_ci * @return 470060ff233Sopenharmony_ci * On success : zero 471060ff233Sopenharmony_ci * On failure : error. 472060ff233Sopenharmony_ci * 473060ff233Sopenharmony_ci */ 474060ff233Sopenharmony_citypedef FILLP_INT (*FillpRWSemInitFunc)(IO SYS_ARCH_RW_SEM *sem); 475060ff233Sopenharmony_ci 476060ff233Sopenharmony_ci/** 477060ff233Sopenharmony_ci * @ingroup Callbacks 478060ff233Sopenharmony_ci * @brief 479060ff233Sopenharmony_ci * This callback is to lock the read semaphore referenced by sem only if the semaphore is currently not locked. 480060ff233Sopenharmony_ci * 481060ff233Sopenharmony_ci * @param[in] *sem Indicates a pointer to semaphore to be locked. 482060ff233Sopenharmony_ci * 483060ff233Sopenharmony_ci * @return 484060ff233Sopenharmony_ci * On success : zero 485060ff233Sopenharmony_ci * On failure : error. 486060ff233Sopenharmony_ci */ 487060ff233Sopenharmony_citypedef FILLP_INT (*FillpRWSemTryRDWaitFunc)(IN SYS_ARCH_RW_SEM *sem); 488060ff233Sopenharmony_ci 489060ff233Sopenharmony_ci/** 490060ff233Sopenharmony_ci * @ingroup Callbacks 491060ff233Sopenharmony_ci * @brief 492060ff233Sopenharmony_ci * This callback is used to lock the write semaphore referenced by sem only if the semaphore is currently not locked. 493060ff233Sopenharmony_ci * 494060ff233Sopenharmony_ci * @param[in] *sem Indicates a pointer to the semaphore to be locked. 495060ff233Sopenharmony_ci * @return 496060ff233Sopenharmony_ci * On success : zero 497060ff233Sopenharmony_ci * On failure : error. 498060ff233Sopenharmony_ci */ 499060ff233Sopenharmony_citypedef FILLP_INT (*FillpRWSemTryWRWaitFunc)(IN SYS_ARCH_RW_SEM *sem); 500060ff233Sopenharmony_ci 501060ff233Sopenharmony_ci/** 502060ff233Sopenharmony_ci * @ingroup Callbacks 503060ff233Sopenharmony_ci * @brief 504060ff233Sopenharmony_ci * This callback for sem_wait system function. 505060ff233Sopenharmony_ci * 506060ff233Sopenharmony_ci * @param[in] *sem Indicates a pointer to SYS_ARCH_RW_SEM. 507060ff233Sopenharmony_ci * @return 508060ff233Sopenharmony_ci * On success : zero 509060ff233Sopenharmony_ci * On failure : error. 510060ff233Sopenharmony_ci */ 511060ff233Sopenharmony_citypedef FILLP_INT (*FillpRWSemWRWaitFunc)(IN SYS_ARCH_RW_SEM *sem); 512060ff233Sopenharmony_ci 513060ff233Sopenharmony_ci/** 514060ff233Sopenharmony_ci * @ingroup Callbacks 515060ff233Sopenharmony_ci * @brief 516060ff233Sopenharmony_ci * Callback for sem_post system function. 517060ff233Sopenharmony_ci * 518060ff233Sopenharmony_ci * @param[in] *sem Indicates a pointer to SYS_ARCH_RW_SEM. 519060ff233Sopenharmony_ci * @return 520060ff233Sopenharmony_ci * On success : zero 521060ff233Sopenharmony_ci * On failure : error. 522060ff233Sopenharmony_ci */ 523060ff233Sopenharmony_citypedef FILLP_INT (*FillpRWSemRDPostFunc)(IN SYS_ARCH_RW_SEM *sem); 524060ff233Sopenharmony_ci 525060ff233Sopenharmony_ci/** 526060ff233Sopenharmony_ci * @ingroup Callbacks 527060ff233Sopenharmony_ci * @brief 528060ff233Sopenharmony_ci * Callback for sem_post system function. 529060ff233Sopenharmony_ci * 530060ff233Sopenharmony_ci * @param[in] *sem Indicates a pointer to SYS_ARCH_RW_SEM. 531060ff233Sopenharmony_ci * @return 532060ff233Sopenharmony_ci * On success : zero 533060ff233Sopenharmony_ci * On failure : error. 534060ff233Sopenharmony_ci */ 535060ff233Sopenharmony_citypedef FILLP_INT (*FillpRWSemWRPostFunc)(IN SYS_ARCH_RW_SEM *sem); 536060ff233Sopenharmony_ci 537060ff233Sopenharmony_ci/** 538060ff233Sopenharmony_ci * @ingroup Callbacks 539060ff233Sopenharmony_ci * @brief 540060ff233Sopenharmony_ci * Callback for sem_destroy system function. 541060ff233Sopenharmony_ci * 542060ff233Sopenharmony_ci * @param[in] *sem Indicates a pointer to SYS_ARCH_RW_SEM. 543060ff233Sopenharmony_ci * @return 544060ff233Sopenharmony_ci * On success : zero 545060ff233Sopenharmony_ci * On failure : error. 546060ff233Sopenharmony_ci */ 547060ff233Sopenharmony_citypedef FILLP_INT (*FillpRWSemDestroyFunc)(IN SYS_ARCH_RW_SEM *sem); 548060ff233Sopenharmony_ci 549060ff233Sopenharmony_ci/** 550060ff233Sopenharmony_ci * @ingroup Callbacks 551060ff233Sopenharmony_ci * @brief 552060ff233Sopenharmony_ci * This is a callback for creating a socket. 553060ff233Sopenharmony_ci * 554060ff233Sopenharmony_ci * @param[in] domain Indicates the address family. 555060ff233Sopenharmony_ci * @param[in] type Indicates the new socket. 556060ff233Sopenharmony_ci * @param[in] protocol Indicates the protocol to be used. 557060ff233Sopenharmony_ci * @return 558060ff233Sopenharmony_ci * On success : zero 559060ff233Sopenharmony_ci * On failure : error. 560060ff233Sopenharmony_ci */ 561060ff233Sopenharmony_citypedef FILLP_INT32 (*FillpCreateSocketFunc)(IN FILLP_INT32 domain, IN FILLP_INT32 type, IN FILLP_INT32 protocol); 562060ff233Sopenharmony_ci 563060ff233Sopenharmony_ci/** 564060ff233Sopenharmony_ci * @ingroup Callbacks 565060ff233Sopenharmony_ci * @brief 566060ff233Sopenharmony_ci * This callback associates(bind) a local address with a socket. 567060ff233Sopenharmony_ci * 568060ff233Sopenharmony_ci * @param[in] fd Specifies the file descriptor of the socket to be bound. 569060ff233Sopenharmony_ci * @param[in] myAddr Points to a SockAddr structure containing the address to be bound to the socket. 570060ff233Sopenharmony_ci * @param[in] addrLen Specifies the length of the SockAddr structure pointed to by the pvMyaddr argument. 571060ff233Sopenharmony_ci * @return 572060ff233Sopenharmony_ci * On success : zero 573060ff233Sopenharmony_ci * On failure : error. 574060ff233Sopenharmony_ci */ 575060ff233Sopenharmony_citypedef FILLP_INT32 (*FillpBindSocketFunc)(IN FILLP_INT32 fd, IN FILLP_CONST void *myAddr, IN FILLP_INT32 addrLen); 576060ff233Sopenharmony_ci 577060ff233Sopenharmony_ci/** 578060ff233Sopenharmony_ci * @ingroup Callbacks 579060ff233Sopenharmony_ci * @brief 580060ff233Sopenharmony_ci * This callback is to close an existing socket. 581060ff233Sopenharmony_ci * 582060ff233Sopenharmony_ci * @param[in] ifd Indicates the descriptor identifying the socket to close. 583060ff233Sopenharmony_ci * @return 584060ff233Sopenharmony_ci * On success : zero 585060ff233Sopenharmony_ci * On failure : error. 586060ff233Sopenharmony_ci */ 587060ff233Sopenharmony_citypedef FILLP_INT32 (*FillpCloseSocketFunc)(IN FILLP_INT32 fd); 588060ff233Sopenharmony_ci 589060ff233Sopenharmony_ci/** 590060ff233Sopenharmony_ci * @ingroup Callbacks 591060ff233Sopenharmony_ci * @brief 592060ff233Sopenharmony_ci * This callback is used to send system function to send messages on socket. 593060ff233Sopenharmony_ci * 594060ff233Sopenharmony_ci * @param[in] fd Specifies the socket file descriptor. 595060ff233Sopenharmony_ci * @param[in] buf Points to a buffer containing the message to be sent. 596060ff233Sopenharmony_ci * @param[in] len Specifies the buffer length. 597060ff233Sopenharmony_ci * @param[in] flags Specifies the type of message transmission. 598060ff233Sopenharmony_ci * @param[in] to Points to a SockAddr structure containing the destination address. 599060ff233Sopenharmony_ci * @param[in] toLen Specifies the length of the SockAddr structure. 600060ff233Sopenharmony_ci * @return 601060ff233Sopenharmony_ci * On success : Number of bytes sent 602060ff233Sopenharmony_ci * On failure : error. 603060ff233Sopenharmony_ci */ 604060ff233Sopenharmony_citypedef FILLP_INT (*FillpSendtoFunc)(IN FILLP_INT fd, IN FILLP_CONST void *buf, 605060ff233Sopenharmony_ci IN FILLP_SIZE_T len, IN FILLP_INT flags, IN FILLP_CONST void *to, IN FILLP_SIZE_T toLen); 606060ff233Sopenharmony_ci 607060ff233Sopenharmony_ci/** 608060ff233Sopenharmony_ci * @ingroup Callbacks 609060ff233Sopenharmony_ci * @brief 610060ff233Sopenharmony_ci * This is a callback for the send system function to send a message on a socket. 611060ff233Sopenharmony_ci * 612060ff233Sopenharmony_ci * @param[in] fd Specifies the socket file descriptor. 613060ff233Sopenharmony_ci * @param[in] buffer Points to the buffer containing the message to send. 614060ff233Sopenharmony_ci * @param[in] bytes Specifies the length of the message in bytes. 615060ff233Sopenharmony_ci * @param[in] flags Specifies the type of message transmission. 616060ff233Sopenharmony_ci * @return 617060ff233Sopenharmony_ci * On success : Number of bytes sent 618060ff233Sopenharmony_ci * On failure : error. 619060ff233Sopenharmony_ci */ 620060ff233Sopenharmony_citypedef FILLP_INT (*FillpSendFunc)(IN FILLP_INT fd, IN FILLP_CONST void *buffer, 621060ff233Sopenharmony_ci IN FILLP_INT bytes, IN FILLP_INT flags); 622060ff233Sopenharmony_ci 623060ff233Sopenharmony_ci/** 624060ff233Sopenharmony_ci * @ingroup Callbacks 625060ff233Sopenharmony_ci * @brief 626060ff233Sopenharmony_ci * This is a callback for for sending multiple messages on a socket in a single 627060ff233Sopenharmony_ci * system call. Equivalent to sendmmsg() in kernel. 628060ff233Sopenharmony_ci * 629060ff233Sopenharmony_ci * @param[in] fd Specifies the socket file descriptor. 630060ff233Sopenharmony_ci * @param[in] buffer Points to the buffer containing the message to send. 631060ff233Sopenharmony_ci * @param[in] size Specifies the number of elements sent out. 632060ff233Sopenharmony_ci * @param[in] flags Indicates the flags. 633060ff233Sopenharmony_ci * @return 634060ff233Sopenharmony_ci * On success : Number of data elements sent 635060ff233Sopenharmony_ci * On failure : error. 636060ff233Sopenharmony_ci */ 637060ff233Sopenharmony_citypedef FILLP_INT (*FillpSendFuncmmsg)(IN FILLP_INT fd, IN FILLP_CONST void *buffer, 638060ff233Sopenharmony_ci IN FILLP_UINT32 size, IN FILLP_UINT32 flags); 639060ff233Sopenharmony_ci 640060ff233Sopenharmony_ci/** 641060ff233Sopenharmony_ci * @ingroup Callbacks 642060ff233Sopenharmony_ci * @brief 643060ff233Sopenharmony_ci * This is a callback for the receiving multiple messages on a socket in a 644060ff233Sopenharmony_ci * single system call. equivalent to recvmmsg( ) in kernel. 645060ff233Sopenharmony_ci * 646060ff233Sopenharmony_ci * @param[in] fd Specifies the socket file descriptor. 647060ff233Sopenharmony_ci * @param[in] buffer Points to the buffer containing the message to receive. 648060ff233Sopenharmony_ci * @param[in] size Specifies the number of elements which can be received. 649060ff233Sopenharmony_ci * @param[in] flags Indicates the flags. 650060ff233Sopenharmony_ci * @param[in] timeout Indicates the timeout value. 651060ff233Sopenharmony_ci * @return 652060ff233Sopenharmony_ci * On success : Number of data elements received. 653060ff233Sopenharmony_ci * On failure : error. 654060ff233Sopenharmony_ci */ 655060ff233Sopenharmony_citypedef FILLP_INT (*FillpRecvmmsgFunc)(IN FILLP_INT fd, IN FILLP_CONST void *buffer, 656060ff233Sopenharmony_ci IN FILLP_UINT32 size, IN FILLP_UINT32 flags, IN void *timeout); 657060ff233Sopenharmony_ci 658060ff233Sopenharmony_ci/** 659060ff233Sopenharmony_ci * @ingroup Callbacks 660060ff233Sopenharmony_ci * @brief 661060ff233Sopenharmony_ci * This is a callback for the getsockname system function to get the socket name. 662060ff233Sopenharmony_ci * 663060ff233Sopenharmony_ci * @param[in] fd Indicates the socket file descriptor. 664060ff233Sopenharmony_ci * @param[in] myAddr Indicates the address which the socket is bound to. 665060ff233Sopenharmony_ci * @param[out] addrLen Indicates the address length. 666060ff233Sopenharmony_ci * @return 667060ff233Sopenharmony_ci * On success : Number of bytes sent 668060ff233Sopenharmony_ci * On failure : error. 669060ff233Sopenharmony_ci */ 670060ff233Sopenharmony_citypedef FILLP_INT32 (*FillpGetSockNameFunc)(IN FILLP_INT32 fd, IN void *myAddr, IO void *addrLen); 671060ff233Sopenharmony_ci 672060ff233Sopenharmony_ci/** 673060ff233Sopenharmony_ci * @ingroup Callbacks 674060ff233Sopenharmony_ci * @brief 675060ff233Sopenharmony_ci * This is a callback to connect system function to initiate a connection on a socket. 676060ff233Sopenharmony_ci * 677060ff233Sopenharmony_ci * @param[in] fd Indicates the socket file descriptor. 678060ff233Sopenharmony_ci * @param[in] myAddr Indicates the address which the socket is bound to. 679060ff233Sopenharmony_ci * @param[out] addrLen Indicates the address length. 680060ff233Sopenharmony_ci * @return 681060ff233Sopenharmony_ci * On success : Number of bytes sent 682060ff233Sopenharmony_ci * On failure : error. 683060ff233Sopenharmony_ci */ 684060ff233Sopenharmony_citypedef FILLP_INT32 (*FillpConnectFunc)(IN FILLP_INT32 fd, IN FILLP_CONST void *myAddr, 685060ff233Sopenharmony_ci IN FILLP_INT32 addrLen); 686060ff233Sopenharmony_ci 687060ff233Sopenharmony_citypedef void *FT_FD_SET; 688060ff233Sopenharmony_ci 689060ff233Sopenharmony_ci/** 690060ff233Sopenharmony_ci * @ingroup Callbacks 691060ff233Sopenharmony_ci * @brief 692060ff233Sopenharmony_ci * This callback is to clear the file descriptor set. 693060ff233Sopenharmony_ci * 694060ff233Sopenharmony_ci * @param[in] fd socket fd. 695060ff233Sopenharmony_ci * @param[in] socketDescriptorSet socket descriptor set 696060ff233Sopenharmony_ci * @return 697060ff233Sopenharmony_ci */ 698060ff233Sopenharmony_citypedef void (*FillpFdClrFunc)(IN FILLP_UINT fd, IN FT_FD_SET socketDescriptorSet); 699060ff233Sopenharmony_ci 700060ff233Sopenharmony_ci/** 701060ff233Sopenharmony_ci * @ingroup Callbacks 702060ff233Sopenharmony_ci * @brief 703060ff233Sopenharmony_ci * This callback is set the socket in the file descriptor set. 704060ff233Sopenharmony_ci * 705060ff233Sopenharmony_ci * @param[in] fd Indicates the socket file descriptor. 706060ff233Sopenharmony_ci * @param[in] socketDescriptorSet Indicates the socket descriptor set. 707060ff233Sopenharmony_ci * @return 708060ff233Sopenharmony_ci */ 709060ff233Sopenharmony_citypedef void (*FillpFdSetFunc)(IN FILLP_UINT fd, IN FT_FD_SET socketDescriptorSet); 710060ff233Sopenharmony_ci 711060ff233Sopenharmony_ci/** 712060ff233Sopenharmony_ci * @ingroup Callbacks 713060ff233Sopenharmony_ci * @brief 714060ff233Sopenharmony_ci * This callback is check if this socket ID is already set in the file descriptor set. 715060ff233Sopenharmony_ci * 716060ff233Sopenharmony_ci * @param[in] fd Indicates the socket file descriptor. 717060ff233Sopenharmony_ci * @param[in] socketDescriptorSet Indicates the socket descriptor set. 718060ff233Sopenharmony_ci * @return 719060ff233Sopenharmony_ci */ 720060ff233Sopenharmony_citypedef FILLP_INT (*FillpFdIsSetFunc)(IN FILLP_INT fd, IN FT_FD_SET socketDescriptorSet); 721060ff233Sopenharmony_ci 722060ff233Sopenharmony_ci/** 723060ff233Sopenharmony_ci * @ingroup Callbacks 724060ff233Sopenharmony_ci * @brief 725060ff233Sopenharmony_ci * This callback is to create a file descriptor set. 726060ff233Sopenharmony_ci * 727060ff233Sopenharmony_ci * @return 728060ff233Sopenharmony_ci * FT_FD_SET File Descriptor set 729060ff233Sopenharmony_ci * 730060ff233Sopenharmony_ci */ 731060ff233Sopenharmony_citypedef FT_FD_SET (*FillpCreateFdSetFunc)(void); 732060ff233Sopenharmony_ci 733060ff233Sopenharmony_ci/** 734060ff233Sopenharmony_ci * @ingroup Callbacks 735060ff233Sopenharmony_ci * @brief 736060ff233Sopenharmony_ci * This callback is to free the file descriptor set which was created using the 737060ff233Sopenharmony_ci * callback function FillpCreateFdSetFunc. 738060ff233Sopenharmony_ci * 739060ff233Sopenharmony_ci * @return 740060ff233Sopenharmony_ci */ 741060ff233Sopenharmony_citypedef void (*FillpDestroyFdSetFunc)(IN FT_FD_SET destroySocketFdSet); 742060ff233Sopenharmony_ci 743060ff233Sopenharmony_ci/** 744060ff233Sopenharmony_ci * @ingroup Callbacks 745060ff233Sopenharmony_ci * @brief 746060ff233Sopenharmony_ci * This callback is to copy from one file descriptor set to another 747060ff233Sopenharmony_ci * 748060ff233Sopenharmony_ci * @param[out] dstFdSet Indicates the destination file descriptor set to which it is copied. 749060ff233Sopenharmony_ci * @param[in] srcFdSet Indicates the source file descriptor set from which it is being copied. 750060ff233Sopenharmony_ci * @return 751060ff233Sopenharmony_ci */ 752060ff233Sopenharmony_citypedef FILLP_INT32 (*FillpCopyFdSetFunc)(IO FT_FD_SET dstFdSet, IN FT_FD_SET srcFdSet); 753060ff233Sopenharmony_ci 754060ff233Sopenharmony_ci/** 755060ff233Sopenharmony_ci * @ingroup Callbacks 756060ff233Sopenharmony_ci * @brief 757060ff233Sopenharmony_ci * This callback to receive from system callback to receive a message from a socket. 758060ff233Sopenharmony_ci * 759060ff233Sopenharmony_ci * @param[in] fd Specifies the socket file descriptor. 760060ff233Sopenharmony_ci * @param[out] *buf Points to the buffer where the message should be stored. 761060ff233Sopenharmony_ci * @param[in] len Specifies the length in bytes of the buffer pointed to by the buff argument. 762060ff233Sopenharmony_ci * @param[in] flags Specifies the type of message reception. 763060ff233Sopenharmony_ci * @param[out] *from Points to a SockAddr structure in which the sending address is to be stored. 764060ff233Sopenharmony_ci * @param[in] *fromLen Specifies the length of the SockAddr structure pointed to by the from argument. 765060ff233Sopenharmony_ci * @return 766060ff233Sopenharmony_ci * On success : Length of the message in bytes. 767060ff233Sopenharmony_ci * On failure : error. 768060ff233Sopenharmony_ci */ 769060ff233Sopenharmony_citypedef FILLP_INT (*FillpRecvfromFunc)(IN FILLP_INT fd, OUT void *buf, 770060ff233Sopenharmony_ci IN FILLP_SIZE_T len, IN FILLP_INT flags, OUT void *from, IO FILLP_SIZE_T *fromLen); 771060ff233Sopenharmony_ci 772060ff233Sopenharmony_ci/** 773060ff233Sopenharmony_ci * @ingroup Callbacks 774060ff233Sopenharmony_ci * @brief 775060ff233Sopenharmony_ci * This callback is to send a message to a socket. 776060ff233Sopenharmony_ci * 777060ff233Sopenharmony_ci * @param[in] fd Indicates a socket ID. 778060ff233Sopenharmony_ci * @param[in] *msg Specifies the message which needs to be sent. 779060ff233Sopenharmony_ci * @param[in] flags Specifies the type of message. 780060ff233Sopenharmony_ci * @return 781060ff233Sopenharmony_ci * On success : Sends the message. 782060ff233Sopenharmony_ci * On failure : error code. 783060ff233Sopenharmony_ci */ 784060ff233Sopenharmony_citypedef FILLP_INT (*FillpSendFuncmsg)(IN FILLP_INT fd, 785060ff233Sopenharmony_ci IN FILLP_CONST void *msg, IN FILLP_INT flags); 786060ff233Sopenharmony_ci 787060ff233Sopenharmony_ci/** 788060ff233Sopenharmony_ci * @ingroup Callbacks 789060ff233Sopenharmony_ci * @brief 790060ff233Sopenharmony_ci * This callback is to receive a message from a socket. 791060ff233Sopenharmony_ci * 792060ff233Sopenharmony_ci * @param[in] fd Indicates a socket file descriptor. 793060ff233Sopenharmony_ci * @param[in] *msg Indicates a message received. 794060ff233Sopenharmony_ci * @param[in] flags Specifies the type of message. 795060ff233Sopenharmony_ci * @return 796060ff233Sopenharmony_ci * On success : Receives the message. 797060ff233Sopenharmony_ci * On failure : error code. 798060ff233Sopenharmony_ci */ 799060ff233Sopenharmony_citypedef FILLP_INT (*FillpRecvmsgFunc)(IN FILLP_INT fd, IN void *msg, IN FILLP_INT flags); 800060ff233Sopenharmony_ci 801060ff233Sopenharmony_ci/** 802060ff233Sopenharmony_ci * @ingroup Callbacks 803060ff233Sopenharmony_ci * @brief 804060ff233Sopenharmony_ci * This callback is for sys_arch_sem_close. 805060ff233Sopenharmony_ci * 806060ff233Sopenharmony_ci * @param[in] sem Indicates the shared memory. 807060ff233Sopenharmony_ci * @return 808060ff233Sopenharmony_ci * On success : FILLP_SUCCESS 809060ff233Sopenharmony_ci * On failure : FILLP_FAILURE 810060ff233Sopenharmony_ci */ 811060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArchSemCloseFunc)(SYS_ARCH_SEM *sem); 812060ff233Sopenharmony_ci 813060ff233Sopenharmony_ci/** 814060ff233Sopenharmony_ci * @ingroup Callbacks 815060ff233Sopenharmony_ci * @brief 816060ff233Sopenharmony_ci * This callback is to lock the semaphore referenced by the sem parameter as in the semaphore wait function. 817060ff233Sopenharmony_ci * However, if the semaphore cannot be locked without waiting for another process or *thread to unlock the semaphore 818060ff233Sopenharmony_ci * by performing a semaphore post function, this wait shall be terminated when the specified timeout expires. 819060ff233Sopenharmony_ci * 820060ff233Sopenharmony_ci * @param[in] sem Pointer to named semaphore structure. 821060ff233Sopenharmony_ci * @param[in] timeout Indicates the time to wait. 822060ff233Sopenharmony_ci * @return 823060ff233Sopenharmony_ci * On success : Zero 824060ff233Sopenharmony_ci * On failure : FILLP_FAILURE 825060ff233Sopenharmony_ci * @note Application must provide functionality which does not have impact with system time change. 826060ff233Sopenharmony_ci */ 827060ff233Sopenharmony_ci /* callback for SYS_ARCH_SEM_WAIT_TIMEOUT */ 828060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArchSemWaitTimeoutFunc)(SYS_ARCH_SEM *sem, FILLP_SLONG timeout); 829060ff233Sopenharmony_ci 830060ff233Sopenharmony_ci/** 831060ff233Sopenharmony_ci * @ingroup Callbacks 832060ff233Sopenharmony_ci * @brief 833060ff233Sopenharmony_ci * This callback is for sched_yield system function to yield the processor. 834060ff233Sopenharmony_ci * 835060ff233Sopenharmony_ci * @return 836060ff233Sopenharmony_ci * Zero on success OR Error code on failure. 837060ff233Sopenharmony_ci */ 838060ff233Sopenharmony_ci /* callback for SYS_ARCH_SCHED_YIELD */ 839060ff233Sopenharmony_citypedef FILLP_INT (*FillpSysArchSchedYieldFunc)(void); 840060ff233Sopenharmony_ci 841060ff233Sopenharmony_ci/* lower layer call back function structure */ 842060ff233Sopenharmony_citypedef struct FillpSysLibSockCallbackFuncStruct { 843060ff233Sopenharmony_ci /* Function pointer variable to register the create socket callback function. */ 844060ff233Sopenharmony_ci FillpCreateSocketFunc socketCallbackFunc; 845060ff233Sopenharmony_ci /* Function pointer variable to register bind socket callback function. */ 846060ff233Sopenharmony_ci FillpBindSocketFunc bindCallbackFunc; 847060ff233Sopenharmony_ci /* Function pointer variable to register close socket callback function. */ 848060ff233Sopenharmony_ci FillpCloseSocketFunc closeSocketCallbackFunc; 849060ff233Sopenharmony_ci /* Indicates a variable to register select callback function. */ 850060ff233Sopenharmony_ci FillpSelectFunc select; 851060ff233Sopenharmony_ci /* Indicates a variable to register ioctl callback function. */ 852060ff233Sopenharmony_ci FillpIoctlFunc ioctl; 853060ff233Sopenharmony_ci /* Indicates a variable to register fcntl callback function. */ 854060ff233Sopenharmony_ci FillpFcntlFunc fcntl; 855060ff233Sopenharmony_ci /* Indicates a variable to register fcntl callback function. */ 856060ff233Sopenharmony_ci FillpSetSockOptFunc setSockOpt; 857060ff233Sopenharmony_ci /* Indicates a variable to register fcntl callback function. */ 858060ff233Sopenharmony_ci FillpGetSockOptFunc getSockOpt; 859060ff233Sopenharmony_ci /* Indicates a pointer to a variable to register set socket option. */ 860060ff233Sopenharmony_ci FillpRecvfromFunc recvFromCallbackFunc; 861060ff233Sopenharmony_ci /* Indicates a pointer to a variable to register get socket option. */ 862060ff233Sopenharmony_ci FillpSendtoFunc sendtoCallbackFunc; 863060ff233Sopenharmony_ci /* Indicates a function pointer variable to register Sendto callback function. */ 864060ff233Sopenharmony_ci FillpSendFunc sendCallbackFunc; 865060ff233Sopenharmony_ci /* Indicates a function pointer variable to register get socket name callback function. */ 866060ff233Sopenharmony_ci FillpGetSockNameFunc getSockNameCallbackFunc; 867060ff233Sopenharmony_ci /* Indicates a function pointer variable to register the connect callback function. */ 868060ff233Sopenharmony_ci FillpConnectFunc connectCallbackFunc; 869060ff233Sopenharmony_ci /* Indicates a function pointer variable to register callback function to call the required FD_CLR macro. */ 870060ff233Sopenharmony_ci FillpFdClrFunc fillpFuncFdClr; 871060ff233Sopenharmony_ci /* Indicates a function pointer variable to register callback function to call the required FD_SET macro. */ 872060ff233Sopenharmony_ci FillpFdSetFunc fillpFuncFdSet; 873060ff233Sopenharmony_ci /* Indicates a function pointer variable to register callback function to call the required FD_ISSET macro. */ 874060ff233Sopenharmony_ci FillpFdIsSetFunc fillpFuncFdIsSet; 875060ff233Sopenharmony_ci /* Indicates a function pointer variable to register callback function to call fd_set. */ 876060ff233Sopenharmony_ci FillpCreateFdSetFunc fillpFuncCreateFdSet; 877060ff233Sopenharmony_ci /* Indicates a function pointer variable to register callback function to 878060ff233Sopenharmony_ci * destroy fd_set which was created by FillpCreateFdSetFunc. */ 879060ff233Sopenharmony_ci FillpDestroyFdSetFunc fillpFuncDestroyFdSet; 880060ff233Sopenharmony_ci /* Indicates a function pointer variable to register callback function to copy fd_set. */ 881060ff233Sopenharmony_ci FillpCopyFdSetFunc fillpFuncCopyFdSet; 882060ff233Sopenharmony_ci} FillpSysLibSockCallbackFuncSt; 883060ff233Sopenharmony_ci 884060ff233Sopenharmony_ci/** 885060ff233Sopenharmony_ci * Provides variables to semaphore callback functions. 886060ff233Sopenharmony_ci */ 887060ff233Sopenharmony_citypedef struct FillpSysLibSemCallbackFuncStruct { 888060ff233Sopenharmony_ci /* Function pointer variable to register semaphore close callback function. */ 889060ff233Sopenharmony_ci FillpSysArchSemCloseFunc sysArchSemClose; 890060ff233Sopenharmony_ci /* Function pointer variable to semaphore Init callback function. */ 891060ff233Sopenharmony_ci FillpSemFunc sysArchSemInit; 892060ff233Sopenharmony_ci /* Function pointer variable to semaphore try wait callback function. */ 893060ff233Sopenharmony_ci FillpSemTryWaitFunc sysArchSemTryWait; 894060ff233Sopenharmony_ci /* Function pointer variable to semaphore wait callback function. */ 895060ff233Sopenharmony_ci FillpSemWaitFunc sysArchSemWait; 896060ff233Sopenharmony_ci /* Function pointer variable to semaphore post callback function. */ 897060ff233Sopenharmony_ci FillpSemPostFunc sysArchSemPost; 898060ff233Sopenharmony_ci /* Function pointer variable to register semaphore destroy callback function. */ 899060ff233Sopenharmony_ci FillpSemDestroyFunc sysArchSemDestroy; 900060ff233Sopenharmony_ci /* Function pointer variable to FillpRWSemInitFunc. */ 901060ff233Sopenharmony_ci FillpRWSemInitFunc sysArchRWSemInit; 902060ff233Sopenharmony_ci /* Function pointer variable to FillpRWSemTryRDWaitFunc. */ 903060ff233Sopenharmony_ci FillpRWSemTryRDWaitFunc sysArchRWSemTryRDWait; 904060ff233Sopenharmony_ci /* Function pointer variable to FillpRWSemTryWRWaitFunc. */ 905060ff233Sopenharmony_ci FillpRWSemTryWRWaitFunc sysArchRWSemTryWRWait; 906060ff233Sopenharmony_ci /* Function pointer variable to FillpRWSemRDPostFunc. */ 907060ff233Sopenharmony_ci FillpRWSemRDPostFunc sysArchRWSemRDPost; 908060ff233Sopenharmony_ci /* Function pointer variable to FillpRWSemWRPostFunc. */ 909060ff233Sopenharmony_ci FillpRWSemWRPostFunc sysArchRWSemWRPost; 910060ff233Sopenharmony_ci /* Function pointer variable to FillpRWSemDestroyFunc. */ 911060ff233Sopenharmony_ci FillpRWSemDestroyFunc sysArchRWSemDestroy; 912060ff233Sopenharmony_ci /* Function pointer variable to semaphore wait timeout callback function. */ 913060ff233Sopenharmony_ci FillpSysArchSemWaitTimeoutFunc sysArchSemWaitTimeout; 914060ff233Sopenharmony_ci /* Function pointer variable to register system shared yield callback function. */ 915060ff233Sopenharmony_ci FillpSysArchSchedYieldFunc sysArchSchedYield; 916060ff233Sopenharmony_ci} FillpSysLibSemCallbackFuncSt; 917060ff233Sopenharmony_ci 918060ff233Sopenharmony_ci 919060ff233Sopenharmony_ci/** 920060ff233Sopenharmony_ci* Structure of basic callback functions. 921060ff233Sopenharmony_ci*/ 922060ff233Sopenharmony_citypedef struct FillpSysLibBasicCallbackFuncStruct { 923060ff233Sopenharmony_ci FillpMemCallocFunc memCalloc; /* Memory calloc callback function. */ 924060ff233Sopenharmony_ci FillpMemAllocFunc memAlloc; /* Memory allocation callback function. */ 925060ff233Sopenharmony_ci FillpMemFreeFunc memFree; /* Memory free callback function. */ 926060ff233Sopenharmony_ci FillpStrLenFunc fillpStrLen; /* String length callback function. */ 927060ff233Sopenharmony_ci FillpRandFunc fillpRand; /* String SprintfS callback function. */ 928060ff233Sopenharmony_ci FillpCreateThreadFunc fillpCreateThread; /* String SprintfS callback function. */ 929060ff233Sopenharmony_ci FillpSysArcInitFunc sysArcInit; /* SYS_ARCH_INIT callback function. */ 930060ff233Sopenharmony_ci FillpSysArcGetCurTimeFunc sysArcGetCurTimeLongLong; /* sys_arch_get_cur_time_longlong callback function. */ 931060ff233Sopenharmony_ci FillpSysArchAtomicIncFunc sysArchAtomicInc; /* SYS_ARCH_ATOMIC_INC callback function. */ 932060ff233Sopenharmony_ci FillpSysArchAtomicIncAndTestFunc sysArchAtomicIncAndTest; /* SYS_ARCH_ATOMIC_INC_AND_TEST callback function. */ 933060ff233Sopenharmony_ci FillpSysArchAtomicDecFunc sysArchAtomicDec; /* SysArchAtomic_DEC callback function. */ 934060ff233Sopenharmony_ci FillpSysArchAtomicDecAndTestFunc sysArchAtomicDecAndTest; /* SYS_ARCH_ATOMIC_DEC_AND_TEST callback function. */ 935060ff233Sopenharmony_ci FillpSysArchAtomicReadFunc sysArchAtomicRead; /* SYS_ARCH_ATOMIC_READ callback function. */ 936060ff233Sopenharmony_ci FillpSysArchAtomicSetFunc sysArchAtomicSet; /* SYS_ARCH_ATOMIC_SET callback function. */ 937060ff233Sopenharmony_ci FillpSysArchCompAndSwapFunc sysArchCompAndSwap; /* SYS_ARCH_SEM_WAIT_TIMEOUT callback function. */ 938060ff233Sopenharmony_ci FillpSysSleepMsFunc sysSleepMs; /* FILLP_SLEEP_MS callback function. */ 939060ff233Sopenharmony_ci FillpSysUSleepFunc sysUsleep; /* sleep in seconds callback function. */ 940060ff233Sopenharmony_ci FillpRtePauseFunc rtePause; /* rte_pause callback function. */ 941060ff233Sopenharmony_ci FillpCryptoRandFunc cryptoRand; /* Cryptographic quality random number callback function. */ 942060ff233Sopenharmony_ci FillpMemChrFunc memChr; /* MemChr callback function. */ 943060ff233Sopenharmony_ci} FillpSysLibBasicCallbackFuncSt; 944060ff233Sopenharmony_ci 945060ff233Sopenharmony_ci/** 946060ff233Sopenharmony_ci* Provides callbacks for FillP SysLib. 947060ff233Sopenharmony_ci*/ 948060ff233Sopenharmony_citypedef struct FillpSysLibCallbackFuncStruct { 949060ff233Sopenharmony_ci FillpSysLibBasicCallbackFuncSt sysLibBasicFunc; /* Indicates a callback to SystLibBasicFunc. */ 950060ff233Sopenharmony_ci FillpSysLibSemCallbackFuncSt sysLibSemFunc; /* Indicates a callback to SysLibSemFunc. */ 951060ff233Sopenharmony_ci FillpSysLibSockCallbackFuncSt sysLibSockFunc; /* Indicates a callback to SysLibSockFunc. */ 952060ff233Sopenharmony_ci} FillpSysLibCallbackFuncSt; 953060ff233Sopenharmony_ci 954060ff233Sopenharmony_ci#ifdef __cplusplus 955060ff233Sopenharmony_ci} 956060ff233Sopenharmony_ci#endif 957060ff233Sopenharmony_ci 958060ff233Sopenharmony_ci#endif 959