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_INC_H 17060ff233Sopenharmony_ci#define FILLP_INC_H 18060ff233Sopenharmony_ci#include "fillptypes.h" 19060ff233Sopenharmony_ci#include "fillpcallbacks.h" 20060ff233Sopenharmony_ci 21060ff233Sopenharmony_ci#ifdef __cplusplus 22060ff233Sopenharmony_ciextern "C" { 23060ff233Sopenharmony_ci#endif 24060ff233Sopenharmony_ci 25060ff233Sopenharmony_ci#pragma pack(push, 8) 26060ff233Sopenharmony_ci 27060ff233Sopenharmony_ci/** 28060ff233Sopenharmony_ci * @ingroup FillPTraceInterfaces 29060ff233Sopenharmony_ci * @brief This callback function is used to call the application trace function. 30060ff233Sopenharmony_ci * 31060ff233Sopenharmony_ci * @param[in] traceObjType Indicates a trace object of type FillpTraceTypeEnum. 32060ff233Sopenharmony_ci * @param[in] traceHandle Indicates the handle passed by application. 33060ff233Sopenharmony_ci * @param[in] msgLength Indicates the length of the message. 34060ff233Sopenharmony_ci * @param[in] traceObj Indicates the socket identifier for which the trace is currently provided. 35060ff233Sopenharmony_ci * @param[in] traceDescript Indicates the structure FillpTraceDescriptSt. 36060ff233Sopenharmony_ci * @param[in] traceMsg Indicates the actual trace message. For commands from user, only the arguments are part 37060ff233Sopenharmony_ci * of the indication. For network messages, the FillP header along with the IP header (port and IP) are given as part 38060ff233Sopenharmony_ci * of indication. 39060ff233Sopenharmony_ci * @return void. 40060ff233Sopenharmony_ci * @par Related Topics 41060ff233Sopenharmony_ci * stTraceInfo 42060ff233Sopenharmony_ci * FtRegTraceCallbackFn 43060ff233Sopenharmony_ci */ 44060ff233Sopenharmony_citypedef void (*FillpTraceSend)(IN FILLP_UINT32 traceObjType, IN void *traceHandle, 45060ff233Sopenharmony_ci IN FILLP_UINT32 msgLength, IN FILLP_UINT32 traceObj, IN FILLP_UINT8 *traceDescript, 46060ff233Sopenharmony_ci IN FILLP_CHAR *traceMsg, ...); 47060ff233Sopenharmony_ci 48060ff233Sopenharmony_ci/** 49060ff233Sopenharmony_ci * This structure provides the trace information. 50060ff233Sopenharmony_ci */ 51060ff233Sopenharmony_cistruct TraceInfo { 52060ff233Sopenharmony_ci FillpTraceSend fillpTraceSend; /* Specifies a pointer to the FillpTraceSend function. */ 53060ff233Sopenharmony_ci FILLP_BOOL cmdTraceFlag; 54060ff233Sopenharmony_ci FILLP_UINT8 padd[3]; 55060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 56060ff233Sopenharmony_ci FILLP_UINT8 padd1[4]; 57060ff233Sopenharmony_ci#endif 58060ff233Sopenharmony_ci}; 59060ff233Sopenharmony_ci 60060ff233Sopenharmony_ciextern struct TraceInfo g_traceInfo; 61060ff233Sopenharmony_ci 62060ff233Sopenharmony_ci 63060ff233Sopenharmony_ci/** 64060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 65060ff233Sopenharmony_ci * @brief Sends a message on a socket. This function is the same as the send function of the TCP socket. 66060ff233Sopenharmony_ci * If the socket is set as NON-Block, and if the non-block error happens, the the API returns -1 and the 67060ff233Sopenharmony_ci * error number is set as ERR_EAGAIN. You can retrieve the last error number of the socket by calling the 68060ff233Sopenharmony_ci * FtGetErrno() API. 69060ff233Sopenharmony_ci * 70060ff233Sopenharmony_ci * @param[in] fd Indicates the socket created by FtSocket. 71060ff233Sopenharmony_ci * @param[in] data Indicates a data pointer. 72060ff233Sopenharmony_ci * @param[in] size Indicates the size of the message. 73060ff233Sopenharmony_ci * @param[in] flag Indicates the status. 74060ff233Sopenharmony_ci * @return On success, returns 0 75060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 76060ff233Sopenharmony_ci */ 77060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtSend(FILLP_INT fd, FILLP_CONST void *data, size_t size, FILLP_INT flag); 78060ff233Sopenharmony_ci 79060ff233Sopenharmony_ci/** 80060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 81060ff233Sopenharmony_ci * @brief Sends a video frame on a socket. This function is same with FtSend except the argument 'frame' 82060ff233Sopenharmony_ci * If the socket is set as NON-Block, and if the non-block error happens, the the API returns -1 and the 83060ff233Sopenharmony_ci * error number is set as ERR_EAGAIN. You can retrieve the last error number of the socket by calling the 84060ff233Sopenharmony_ci * FtGetErrno() API. 85060ff233Sopenharmony_ci * 86060ff233Sopenharmony_ci * @param[in] fd Indicates the socket created by FtSocket. 87060ff233Sopenharmony_ci * @param[in] data Indicates a data pointer. 88060ff233Sopenharmony_ci * @param[in] size Indicates the size of the message. 89060ff233Sopenharmony_ci * @param[in] flag Indicates the status. 90060ff233Sopenharmony_ci * @param[in] frame Indicates frame information (including the frame type I or P, etc.) of the video frame. 91060ff233Sopenharmony_ci * @return On success, returns 0 92060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 93060ff233Sopenharmony_ci */ 94060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtSendFrame(FILLP_INT fd, FILLP_CONST void *data, size_t size, FILLP_INT flag, 95060ff233Sopenharmony_ci FILLP_CONST struct FrameInfo *frame); 96060ff233Sopenharmony_ci 97060ff233Sopenharmony_ci/** 98060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 99060ff233Sopenharmony_ci * @brief This interface is used to bind to a socket created by the FtSocket() API. The usage is the same as 100060ff233Sopenharmony_ci * the bind function of the TCP socket. 101060ff233Sopenharmony_ci * 102060ff233Sopenharmony_ci * @param[in] fd Specifies a descriptor identifying an unbound socket created by the FtSocket. 103060ff233Sopenharmony_ci * @param[in] name Specifies a pointer to a SockAddr structure of the local address to assign to the bound socket. 104060ff233Sopenharmony_ci * @param[in] nameLen Specifies the length, in bytes, of the value pointed to by the name parameter. 105060ff233Sopenharmony_ci * @return On success, returns 0 106060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 107060ff233Sopenharmony_ci * @note 108060ff233Sopenharmony_ci * If the FtBind API returns failure, the user must call the FtClose API for same socket index and recreate the socket 109060ff233Sopenharmony_ci * using the FtSocket() API. 110060ff233Sopenharmony_ci * @par Limitations 111060ff233Sopenharmony_ci * The FtBind API does not support bind to INADDR_ANY address. 112060ff233Sopenharmony_ci */ 113060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtBind(FILLP_INT fd, FILLP_CONST struct sockaddr *name, FILLP_UINT32 nameLen); 114060ff233Sopenharmony_ci 115060ff233Sopenharmony_ci 116060ff233Sopenharmony_ci/** 117060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 118060ff233Sopenharmony_ci * @brief Creates an endpoint for communication and returns a descriptor. The usage is the same as 119060ff233Sopenharmony_ci * the socket function of the TCP socket. 120060ff233Sopenharmony_ci * 121060ff233Sopenharmony_ci * @param[in] domain Indicates the domain to communicate. 122060ff233Sopenharmony_ci * @param[in] type Indicates the type of connection. 123060ff233Sopenharmony_ci * @param[in] protocol Indicates the type of protocol used. 124060ff233Sopenharmony_ci * @return On success, returns 0 125060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 126060ff233Sopenharmony_ci */ 127060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtSocket(IN FILLP_INT domain, IN FILLP_INT type, IN FILLP_INT protocol); 128060ff233Sopenharmony_ci 129060ff233Sopenharmony_ci 130060ff233Sopenharmony_ci/** 131060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 132060ff233Sopenharmony_ci * @brief Initiates a connection on a socket. This is same as the TCP connect function. 133060ff233Sopenharmony_ci * If the socket is a non-block and there is a non-block error on the socket during FtConnect function, 134060ff233Sopenharmony_ci * the API returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno API. 135060ff233Sopenharmony_ci * 136060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by the FtSocket API. This is of protocol family and this must be 137060ff233Sopenharmony_ci * passed as PF_INET/AF_INET/AF_INET6 /PF_INET6. 138060ff233Sopenharmony_ci * @param[in] name Indicates the socket type, which must be of type SOCK_STREAM. 139060ff233Sopenharmony_ci * @param[in] nameLen This must be passed as IPPROTO_FILLP. 140060ff233Sopenharmony_ci * @return On success, returns 0 141060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 142060ff233Sopenharmony_ci */ 143060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtConnect(FILLP_INT fd, FILLP_CONST FILLP_SOCKADDR *name, socklen_t nameLen); 144060ff233Sopenharmony_ci 145060ff233Sopenharmony_ci 146060ff233Sopenharmony_ci/** 147060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 148060ff233Sopenharmony_ci * @brief This is an interface for the user to receive messages from a socket. This is same as the TCP receive 149060ff233Sopenharmony_ci * function. If the socket is a non-block and there is non-block error on the socket during FtConnect(), then the 150060ff233Sopenharmony_ci * API will return -1. You can retrieve the last error number of the socket by calling the FtGetErrno API. 151060ff233Sopenharmony_ci * 152060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by FtSocket(). 153060ff233Sopenharmony_ci * @param[in] mem Indicates a pointer to the buffer where the message is stored. 154060ff233Sopenharmony_ci * @param[in] len Indicates the length, in bytes, of the buffer pointed by the buffer argument. 155060ff233Sopenharmony_ci * @param[in] flag Indicates the flag. 156060ff233Sopenharmony_ci * @return On success, returns 0 157060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 158060ff233Sopenharmony_ci 159060ff233Sopenharmony_ci * @note 160060ff233Sopenharmony_ci * If the product uses FILLP EPOLL (FILLP EPOLL is edge triggered), then the FtRecv function must be called to 161060ff233Sopenharmony_ci * receive the complete data upon reception of SPUNGE_EPOLLIN. 162060ff233Sopenharmony_ci * In case of edge triggered epoll event notification method, the FtRecv API will behave same as 163060ff233Sopenharmony_ci * the tcp recv() function. 164060ff233Sopenharmony_ci */ 165060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtRecv(FILLP_INT fd, void *mem, size_t len, FILLP_INT flag); 166060ff233Sopenharmony_ci 167060ff233Sopenharmony_ci#if defined(FILLP_LINUX) && defined(FILLP_MMSG_SUPPORT) 168060ff233Sopenharmony_ci/** 169060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 170060ff233Sopenharmony_ci * @brief This is an interface for the user to send a message on a socket. 171060ff233Sopenharmony_ci * If the socket is set as NON-Block and if the non-block error happens then the API returns -1. 172060ff233Sopenharmony_ci * The Last error number of the socket can be retrieved by calling the API FtGetErrno. 173060ff233Sopenharmony_ci * 174060ff233Sopenharmony_ci * @param[in] fd A socket created by FtSocket. 175060ff233Sopenharmony_ci * @param[in] iov A pointer which points to an array of iovec structures. 176060ff233Sopenharmony_ci * @param[in] iovCount buffer count of data described by iov. 177060ff233Sopenharmony_ci * @return On success, returns 0 178060ff233Sopenharmony_ci */ 179060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtWritev(FILLP_INT fd, const struct iovec *iov, FILLP_INT iovCount); 180060ff233Sopenharmony_ci 181060ff233Sopenharmony_ci/** 182060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 183060ff233Sopenharmony_ci * @brief This is an interface for the user to recv a message on a socket. 184060ff233Sopenharmony_ci * If the socket is set as NON-Block and if the non-block error happens then the API returns -1. 185060ff233Sopenharmony_ci * The Last error number of the socket can be retrieved by calling the API FtGetErrno. 186060ff233Sopenharmony_ci * 187060ff233Sopenharmony_ci * @param[in] fd A socket created by FtSocket. 188060ff233Sopenharmony_ci * @param[in] iov A pointer which points to an array of iovec structures. 189060ff233Sopenharmony_ci * @param[in] iovCount buffers of data described by iov. 190060ff233Sopenharmony_ci * @return On success, returns 0 191060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 192060ff233Sopenharmony_ci */ 193060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtReadv(FILLP_INT fd, const struct iovec *iov, FILLP_INT iovCount); 194060ff233Sopenharmony_ci 195060ff233Sopenharmony_ci#endif 196060ff233Sopenharmony_ci 197060ff233Sopenharmony_ci/** 198060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 199060ff233Sopenharmony_ci * @brief Closes the socket connection and releases all associated resources. This API is same as 200060ff233Sopenharmony_ci * the close function of TCP socket. 201060ff233Sopenharmony_ci * 202060ff233Sopenharmony_ci * @param[in] fd This indicates a socket created by the FtSocket function. 203060ff233Sopenharmony_ci * @return On success, returns 0 204060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 205060ff233Sopenharmony_ci * @note Once FtClose is called for a socket, the application must not invoke any API to perform any operation 206060ff233Sopenharmony_ci * on the closed socket. 207060ff233Sopenharmony_ci * FillP recv_buff has data, say 2 KB. 208060ff233Sopenharmony_ci * Adapter calls the FtRecv() API with the buffer length as 1 KB. The application checks the input buffer length 209060ff233Sopenharmony_ci * and the return length of the FtRecv API. If both lengths are identical, the application must call the FtRecv 210060ff233Sopenharmony_ci * API again. During that time, FillP copies the remaining 1 KB to the adapter. 211060ff233Sopenharmony_ci * When there is no data in the FillP buffer, but the application calls the FtRecv() API, the API will 212060ff233Sopenharmony_ci * return EAGAIN. 213060ff233Sopenharmony_ci */ 214060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtClose(FILLP_INT fd); 215060ff233Sopenharmony_ci 216060ff233Sopenharmony_ci 217060ff233Sopenharmony_ci/** 218060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 219060ff233Sopenharmony_ci * @brief Indicates graceful closure of socket. 220060ff233Sopenharmony_ci * Initiates a graceful closure of the socket connection from initiating side (uni-directional). 221060ff233Sopenharmony_ci * 222060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by FtSocket function. 223060ff233Sopenharmony_ci * @param[in] how If how is SHUT_RD, further receptions will be disallowed. If how is SHUT_WR, 224060ff233Sopenharmony_ci * further transmissions will be disallowed. If how is SHUT_RDWR, further receptions and 225060ff233Sopenharmony_ci * @return On success, returns 0 226060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 227060ff233Sopenharmony_ci * @note The socket resources will not be cleared just by calling the FtShutDown() API. To clear the 228060ff233Sopenharmony_ci * socket resources, call the FtClose API. 229060ff233Sopenharmony_ci * If the product uses fillp_epoll, after calling FtShutDown the product has to wait till it receives 230060ff233Sopenharmony_ci * the SPUNGE_EPOLLERR event in FtEpollWait call, and then call the FtClose() API. 231060ff233Sopenharmony_ci * If the product does not use fillp_epoll (for example, product which use blocking socket), 232060ff233Sopenharmony_ci * then after calling FtShutDown, product can call FtClose(), say after 3 seconds. 233060ff233Sopenharmony_ci */ 234060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtShutDown(FILLP_INT fd, FILLP_INT how); 235060ff233Sopenharmony_ci 236060ff233Sopenharmony_ci 237060ff233Sopenharmony_ci/** 238060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 239060ff233Sopenharmony_ci * @brief fd a connection on a socket. This is same as the accept function of the TCP socket. 240060ff233Sopenharmony_ci * @param[in] fd Indicates a socket which is created by the FtSocket function. 241060ff233Sopenharmony_ci * @param[in] addr Indicates a pointer to a SockAddr structure that contains the address of the peer socket. 242060ff233Sopenharmony_ci * @param[in] addrLen Indicates the length of the SockAddr structure. 243060ff233Sopenharmony_ci * @return On success, returns 0 244060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 245060ff233Sopenharmony_ci * @note - The addr and addrLen pointers are optional in the FtAccept API. If the user passes a valid pointer in 246060ff233Sopenharmony_ci * this API, the stack fills the peer address in this pointer after accepting the connection stack. If user is passing 247060ff233Sopenharmony_ci * FILLP_NULL_PTR for these 2 pointers, the stack can accept peer connection but will not provide peer address. 248060ff233Sopenharmony_ci * The addr and addrLen pointers should be address structures of IPv4 and IPv6 as per socket created in FtSocket(). 249060ff233Sopenharmony_ci * Else, the FtAccept() API may fail. 250060ff233Sopenharmony_ci */ 251060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtAccept(FILLP_INT fd, struct sockaddr *addr, socklen_t *addrLen); 252060ff233Sopenharmony_ci 253060ff233Sopenharmony_ci 254060ff233Sopenharmony_ci/** 255060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 256060ff233Sopenharmony_ci * @brief Listens for connections on a socket. This function is the as same as the listen function of the TCP socket. 257060ff233Sopenharmony_ci * 258060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by the FtSocket API. 259060ff233Sopenharmony_ci * @param[in] backLog Defines the maximum length to which the queue of pending connections for fd can grow. 260060ff233Sopenharmony_ci * @return On success, returns 0 261060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 262060ff233Sopenharmony_ci * @note The backLog value provided in the FtListen() API must be between 0 and MAX CONNECTION configured during 263060ff233Sopenharmony_ci * init. Else, stack will take default value, MAX CONNECTION number as the backLog. 264060ff233Sopenharmony_ci */ 265060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtListen(FILLP_INT fd, FILLP_INT backLog); 266060ff233Sopenharmony_ci 267060ff233Sopenharmony_ci 268060ff233Sopenharmony_ci/** 269060ff233Sopenharmony_ci * @ingroup FillPEpollInterfaces 270060ff233Sopenharmony_ci * @brief This API is used to open an epoll file descriptor. 271060ff233Sopenharmony_ci * 272060ff233Sopenharmony_ci * @return On success, returns 0 273060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 274060ff233Sopenharmony_ci * The following table provides information about the errors set by this API. 275060ff233Sopenharmony_ci * <table> 276060ff233Sopenharmony_ci 277060ff233Sopenharmony_ci <tr><th>Errors <th>Error Message String 278060ff233Sopenharmony_ci <tr><td>FILLP_EINVAL <td>Invalid argument epNum passed. 279060ff233Sopenharmony_ci <tr><td>FILLP_ENOMEM <td>There was insufficient memory to create epoll object. 280060ff233Sopenharmony_ci <tr><td>FILLP_EFAULT <td>Error occurred due to semaphore or atomic operation. 281060ff233Sopenharmony_ci 282060ff233Sopenharmony_ci </table> 283060ff233Sopenharmony_ci */ 284060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtEpollCreate(void); 285060ff233Sopenharmony_ci 286060ff233Sopenharmony_ci/** 287060ff233Sopenharmony_ci * @ingroup FillPEpollInterfaces 288060ff233Sopenharmony_ci * @brief This API is used to open an epoll file descriptor. 289060ff233Sopenharmony_ci * 290060ff233Sopenharmony_ci * @return On success, returns 0 291060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 292060ff233Sopenharmony_ci * 293060ff233Sopenharmony_ci */ 294060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtEpollCreateLinux(FILLP_INT epNum); 295060ff233Sopenharmony_ci 296060ff233Sopenharmony_ci 297060ff233Sopenharmony_ci/** 298060ff233Sopenharmony_ci * @ingroup FillPEpollInterfaces 299060ff233Sopenharmony_ci * @brief This API indicates the control interface for epoll file descriptor. 300060ff233Sopenharmony_ci * 301060ff233Sopenharmony_ci * @param[in] epFd Indicates a file descriptor on which the operation is performed. 302060ff233Sopenharmony_ci * @param[in] op Indicates an operation which needs to be performed. 303060ff233Sopenharmony_ci * @param[in] fd Indicates a file descriptor. 304060ff233Sopenharmony_ci * @param[in] event Indicates an object linked to the file descriptor. 305060ff233Sopenharmony_ci * @return On success, returns 0 306060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 307060ff233Sopenharmony_ci * The following table provides information about the errors set by this API. 308060ff233Sopenharmony_ci */ 309060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtEpollCtl(FILLP_INT epFd, FILLP_INT op, FILLP_INT fd, 310060ff233Sopenharmony_ci FILLP_CONST struct SpungeEpollEvent *event); 311060ff233Sopenharmony_ci 312060ff233Sopenharmony_ci 313060ff233Sopenharmony_ci/** 314060ff233Sopenharmony_ci * @ingroup FillPEpollInterfaces 315060ff233Sopenharmony_ci * @brief This function indicates wait for an I/O event on an epoll file descriptor. 316060ff233Sopenharmony_ci * 317060ff233Sopenharmony_ci * @param[in] epFd Indicates an epoll file descriptor. 318060ff233Sopenharmony_ci * @param[in] events Indicates the memory area pointed to the events, containing the events that will be 319060ff233Sopenharmony_ci * available for the caller. 320060ff233Sopenharmony_ci * @param[in] maxEvents Indicates the maximum number of events. 321060ff233Sopenharmony_ci * @param[in] timeout Indicates the maximum timeout value, in milliseconds. 322060ff233Sopenharmony_ci * @return On success, returns 0 323060ff233Sopenharmony_ci * On failure, returns -1. You can retrieve the last error number of the socket by calling the FtGetErrno() API. 324060ff233Sopenharmony_ci * @note 325060ff233Sopenharmony_ci * If timeout value is -1, the FillP/VTP stack will wait in blocking mode, till it does not get any event 326060ff233Sopenharmony_ci * for the epoll list. 327060ff233Sopenharmony_ci * If timeout value is 0, the FillP stack will wait in nonblocking mode. It will check for only current events 328060ff233Sopenharmony_ci * available to inform. 329060ff233Sopenharmony_ci * If timeout value is some other positive number, the stack will wait for the time indicated by the timeout 330060ff233Sopenharmony_ci * parameter. 331060ff233Sopenharmony_ci * Do not pass negative numbers other than -1 to this API. 332060ff233Sopenharmony_ci */ 333060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtEpollWait(FILLP_INT epFd, struct SpungeEpollEvent *events, 334060ff233Sopenharmony_ci FILLP_INT maxEvents, FILLP_INT timeout); 335060ff233Sopenharmony_ci 336060ff233Sopenharmony_ci 337060ff233Sopenharmony_ci/** 338060ff233Sopenharmony_ci * @ingroup FillP_Control_Interfaces 339060ff233Sopenharmony_ci * @brief This function is used to manipulate the file descriptor. 340060ff233Sopenharmony_ci * 341060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by the FtSocket API. 342060ff233Sopenharmony_ci * @param[in] cmd Indicates the command to perform on the socket s. 343060ff233Sopenharmony_ci * @param[in] val Indicates the flag value used to set the blocking and non blocking socket. 344060ff233Sopenharmony_ci * @return 345060ff233Sopenharmony_ci * Upon success, returns the value which depends on command(cmd), or returns error codes on failure. 346060ff233Sopenharmony_ci * @note 347060ff233Sopenharmony_ci * This API must be used only in the Linux platform. 348060ff233Sopenharmony_ci */ 349060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtFcntl(FILLP_INT fd, FILLP_INT cmd, FILLP_INT val); 350060ff233Sopenharmony_ci 351060ff233Sopenharmony_ci 352060ff233Sopenharmony_ci/** 353060ff233Sopenharmony_ci * @ingroup FillP_Control_Interfaces 354060ff233Sopenharmony_ci * @brief This function controls the I/O mode of a socket. 355060ff233Sopenharmony_ci * 356060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by the FtSocket API. 357060ff233Sopenharmony_ci * @param[in] cmd Indicates the command to perform on the socket s. 358060ff233Sopenharmony_ci * @param[in] val Indicates the flag value used to set the blocking and non blocking socket. 359060ff233Sopenharmony_ci * @return 360060ff233Sopenharmony_ci * On success: FILLP_OK. 361060ff233Sopenharmony_ci * On failure: error code on failure. 362060ff233Sopenharmony_ci * @note 363060ff233Sopenharmony_ci * This API must be used only in the Linux platform. 364060ff233Sopenharmony_ci */ 365060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtIoctl(FILLP_INT fd, FILLP_ULONG cmd, FILLP_CONST FILLP_INT *val); 366060ff233Sopenharmony_ci 367060ff233Sopenharmony_ci 368060ff233Sopenharmony_ci/** 369060ff233Sopenharmony_ci * @ingroup FillP_Control_Interfaces 370060ff233Sopenharmony_ci * @brief This function controls the I/O mode of a socket. 371060ff233Sopenharmony_ci * 372060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by the FtSocket API. 373060ff233Sopenharmony_ci * @param[in] cmd Indicates the command to perform on the socket s. 374060ff233Sopenharmony_ci * @param[in] val Indicates the flag value used to set the blocking and non blocking socket. 375060ff233Sopenharmony_ci * @return 376060ff233Sopenharmony_ci * On success: FILLP_OK. 377060ff233Sopenharmony_ci * On failure: error code on failure. 378060ff233Sopenharmony_ci * @note 379060ff233Sopenharmony_ci * This API must be used only in Windows Platform. 380060ff233Sopenharmony_ci */ 381060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtIoctlSocket(FILLP_INT fd, FILLP_SLONG cmd, FILLP_CONST FILLP_INT *val); 382060ff233Sopenharmony_ci 383060ff233Sopenharmony_ci#define FILLP_CONFIG_ALL_SOCKET ((FILLP_UINT16)FILLP_MAX_UNSHORT_VAL) 384060ff233Sopenharmony_ci 385060ff233Sopenharmony_ci/** 386060ff233Sopenharmony_ci * TRCE/ INTERFACE DEFINITION This structure represents the trace direction. 387060ff233Sopenharmony_ci */ 388060ff233Sopenharmony_citypedef struct FillpTraceDescriptStruct { 389060ff233Sopenharmony_ci FILLP_UINT8 traceDirection; /* This is of type TYPE FillpTraceDirectEn. */ 390060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 391060ff233Sopenharmony_ci FILLP_UINT8 res[7]; 392060ff233Sopenharmony_ci#else 393060ff233Sopenharmony_ci FILLP_UINT8 res[3]; 394060ff233Sopenharmony_ci#endif 395060ff233Sopenharmony_ci} FillpTraceDescriptSt; 396060ff233Sopenharmony_ci 397060ff233Sopenharmony_ci#define FILLP_TRACE_DESC_INIT(dir) \ 398060ff233Sopenharmony_ci { \ 399060ff233Sopenharmony_ci (dir), \ 400060ff233Sopenharmony_ci {0}, \ 401060ff233Sopenharmony_ci } 402060ff233Sopenharmony_ci 403060ff233Sopenharmony_ci/** 404060ff233Sopenharmony_ci * TRCE/ INTERFACE DEFINITION This enum represents the trace direction. 405060ff233Sopenharmony_ci */ 406060ff233Sopenharmony_citypedef enum FillpTraceDirectEnum { 407060ff233Sopenharmony_ci FILLP_TRACE_DIRECT_RECV = 0, /* Indicates FillP trace receive. */ 408060ff233Sopenharmony_ci FILLP_TRACE_DIRECT_SEND, /* Indicates FillP trace send. */ 409060ff233Sopenharmony_ci FILLP_TRACE_DIRECT_NONE, /* Indicates FillP trace none. */ 410060ff233Sopenharmony_ci FILLP_TRACE_DIRECT_END /* Indicates FillP trace end. */ 411060ff233Sopenharmony_ci} FillpTraceDirectEn; 412060ff233Sopenharmony_ci 413060ff233Sopenharmony_ci 414060ff233Sopenharmony_ci/** 415060ff233Sopenharmony_ci * TRCE/ INTERFACE DEFINITION This enum represents type of FillP trace. 416060ff233Sopenharmony_ci */ 417060ff233Sopenharmony_citypedef enum FillpTraceTypeEnum { 418060ff233Sopenharmony_ci FILLP_TRACE_DIRECT_DISABLE = 0, /* Indicates that FillP/VTP trace is disabled. */ 419060ff233Sopenharmony_ci FILLP_TRACE_DIRECT_USER, /* Indicates that FillP will trace all the user commands (socket API). */ 420060ff233Sopenharmony_ci FILLP_TRACE_DIRECT_NETWORK, /* Indicates whether FillP packets are sent or received. */ 421060ff233Sopenharmony_ci FILLP_TRACE_DIRECT_USER_NETWORK_ENABLE, /* Enables FillP to send or receive packets. */ 422060ff233Sopenharmony_ci FILLP_TRACE_END /* Indicates the FillP/VTP trace type enum end. */ 423060ff233Sopenharmony_ci} FillpTraceTypeEn; 424060ff233Sopenharmony_ci 425060ff233Sopenharmony_ci 426060ff233Sopenharmony_ci/** 427060ff233Sopenharmony_ci * @ingroup FillPTraceInterfaces 428060ff233Sopenharmony_ci * @brief This function is called by the FillP adapter to start the trace of user APIs and 429060ff233Sopenharmony_ci * network messages for a particular socket. 430060ff233Sopenharmony_ci * 431060ff233Sopenharmony_ci * @param[in] traceObjType Indicates a trace object defined in FILLP_TRACE_OBJ_TYPE_ENUM and indicates 432060ff233Sopenharmony_ci * the type of trace which must be done. 433060ff233Sopenharmony_ci * @param[in] traceObj A user must pass the FtSocket identification to set the trace for that particular 434060ff233Sopenharmony_ci * socket (0xFFFFFFFF - means for all the sockets). 435060ff233Sopenharmony_ci * @param[in] traceHandle Provides a trace handle which is transparently passed to the user while giving trace. 436060ff233Sopenharmony_ci * 0xFFFFFFFF is an invalid handle. 437060ff233Sopenharmony_ci * @return 438060ff233Sopenharmony_ci * On success: FILLP_OK. 439060ff233Sopenharmony_ci * On failure: error code on failure. The error reason is returned by the error value. 440060ff233Sopenharmony_ci */ 441060ff233Sopenharmony_ciextern FILLP_INT32 DLL_API FtStartTrace(IN FILLP_UINT8 traceObjType, IN FILLP_INT traceObj, 442060ff233Sopenharmony_ci IN FILLP_CONST void *traceHandle); 443060ff233Sopenharmony_ci 444060ff233Sopenharmony_ci 445060ff233Sopenharmony_ci/** 446060ff233Sopenharmony_ci * @ingroup FillPTraceInterfaces 447060ff233Sopenharmony_ci * @brief This function is called by the FillP adapter to stop the trace for a particular socket. 448060ff233Sopenharmony_ci * 449060ff233Sopenharmony_ci * @param[in] traceObjType Indicates a trace object as defined in FILLP_TRACE_OBJ_TYPE_ENUM and tells 450060ff233Sopenharmony_ci * what kind of trace should be done. 451060ff233Sopenharmony_ci * @param[in] traceObj This is for a particular socket or for all the associations (0xFFFFFFFF). 452060ff233Sopenharmony_ci * @return 453060ff233Sopenharmony_ci * On success : FILLP_OK 454060ff233Sopenharmony_ci * On failure : Error codes. The error reason is returned by the error value. 455060ff233Sopenharmony_ci */ 456060ff233Sopenharmony_ciextern FILLP_INT32 DLL_API FtStopTrace(IN FILLP_UINT8 traceObjType, IN FILLP_INT traceObj); 457060ff233Sopenharmony_ci 458060ff233Sopenharmony_ci 459060ff233Sopenharmony_ci/** 460060ff233Sopenharmony_ci * @ingroup FillPTraceInterfaces 461060ff233Sopenharmony_ci * @brief Registers the callback function for FillP message trace and FillP command trace. 462060ff233Sopenharmony_ci * 463060ff233Sopenharmony_ci * @param[in] traceFuncCallback Indicates a trace callback. 464060ff233Sopenharmony_ci * @return 465060ff233Sopenharmony_ci * On success :FILLP_OK 466060ff233Sopenharmony_ci * On failure :Error codes 467060ff233Sopenharmony_ci */ 468060ff233Sopenharmony_ciextern FILLP_INT32 DLL_API FtRegTraceCallbackFn(IN FILLP_CONST FillpTraceSend traceFuncCallback); 469060ff233Sopenharmony_ci 470060ff233Sopenharmony_ci 471060ff233Sopenharmony_ci/** 472060ff233Sopenharmony_ci * Indicates the enumeration for the debug commands. 473060ff233Sopenharmony_ci */ 474060ff233Sopenharmony_citypedef enum FillpDebugCmdEnum { 475060ff233Sopenharmony_ci /* Provides the output information about all other debug commands that you can use. */ 476060ff233Sopenharmony_ci FILLP_DBGCMD_HELP, 477060ff233Sopenharmony_ci /* Sets the level of debug information which stack provides in the callback. Refer FillpDebugLevel for 478060ff233Sopenharmony_ci * different levels. If level is set as FILLP_DBG_LVL_ERROR only error info is provided to user, if level is set as 479060ff233Sopenharmony_ci * FILLP_DBG_LVL_WARNING both warning and error info are provided to the user. */ 480060ff233Sopenharmony_ci FILLP_DBGCMD_SET_PRINT_LEVEL, 481060ff233Sopenharmony_ci /* Shows the current dynamically configured configuration parameters at application level. */ 482060ff233Sopenharmony_ci FILLP_DBGCMD_SHOW_PRINT_LEVEL, 483060ff233Sopenharmony_ci /* Shows all the information about the FillP socket/connection. */ 484060ff233Sopenharmony_ci FILLP_DBGCMD_SHOW_SOCKET_INFO, 485060ff233Sopenharmony_ci /* Shows all the INIT configuration of the stack. */ 486060ff233Sopenharmony_ci FILLP_DBGCMD_SHOW_INIT_RESOURCE, 487060ff233Sopenharmony_ci /* Shows all the global configuration parameters of the stack. */ 488060ff233Sopenharmony_ci FILLP_DBGCMD_SHOW_GLOBAL_CONFIG_RESOURCE, 489060ff233Sopenharmony_ci /* Shows all the socket level configuration parameters of the stack. */ 490060ff233Sopenharmony_ci FILLP_DBGCMD_SHOW_SOCKET_CONFIG_RESOURCE, 491060ff233Sopenharmony_ci FILLP_DBGCMD_BUTT 492060ff233Sopenharmony_ci} FillpDebugCmdEn; 493060ff233Sopenharmony_ci 494060ff233Sopenharmony_ci 495060ff233Sopenharmony_ci/** 496060ff233Sopenharmony_ci * @ingroup FillP_Debug 497060ff233Sopenharmony_ci * @brief FillP uses this function to control the debug command options. You can call this API and set the debug level. 498060ff233Sopenharmony_ci * 499060ff233Sopenharmony_ci * @param[in] command Indicates the debug command type of any value from @ref FillpDebugCmdEn 500060ff233Sopenharmony_ci * @param[in] content Indicates debug control parameter. 501060ff233Sopenharmony_ci * @return 502060ff233Sopenharmony_ci * void. No errors are set. 503060ff233Sopenharmony_ci */ 504060ff233Sopenharmony_ciextern void DLL_API FillpDebugControl(IN FILLP_UINT8 command, IN FILLP_CONST void *content); 505060ff233Sopenharmony_ci 506060ff233Sopenharmony_ci 507060ff233Sopenharmony_ci/** 508060ff233Sopenharmony_ci * @ingroup fillp_stack_api 509060ff233Sopenharmony_ci * @brief This function is called by the FillP adapter to register the adapter's callback function for 510060ff233Sopenharmony_ci * LM functionality. If A function pointer is passed as NULL, then it is omitted for copying. So, the user/adapter 511060ff233Sopenharmony_ci * can call this function to register the function pointers separately. 512060ff233Sopenharmony_ci * 513060ff233Sopenharmony_ci * @param[in] lmFuncCallback Indicates the pointer to LM callback function struct. 514060ff233Sopenharmony_ci * @return 515060ff233Sopenharmony_ci * Success: ERR_OK 516060ff233Sopenharmony_ci * Failure: error code 517060ff233Sopenharmony_ci */ 518060ff233Sopenharmony_ciextern FILLP_INT32 DLL_API FillpRegLMCallbackFn(IN FILLP_CONST FillpLmCallbackFunc *lmFuncCallback); 519060ff233Sopenharmony_ci 520060ff233Sopenharmony_ci 521060ff233Sopenharmony_ci/** 522060ff233Sopenharmony_ci * @ingroup fillp_stack_api 523060ff233Sopenharmony_ci * @brief This function is called by the FillP adapter to get the address with which the requested socket is bound. 524060ff233Sopenharmony_ci * 525060ff233Sopenharmony_ci * @param[in] fd Indicates the socket created. 526060ff233Sopenharmony_ci * @param[out] name Indicates the socket address that needs to be connected. 527060ff233Sopenharmony_ci * @param[in] nameLen Indicates the length of the address. 528060ff233Sopenharmony_ci * @return 529060ff233Sopenharmony_ci * On success : ERR_OK 530060ff233Sopenharmony_ci * On failure : error code 531060ff233Sopenharmony_ci */ 532060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtGetSockName(FILLP_INT fd, FILLP_SOCKADDR *name, socklen_t *nameLen); 533060ff233Sopenharmony_ci 534060ff233Sopenharmony_ci/** 535060ff233Sopenharmony_ci * @ingroup fillp_stack_api 536060ff233Sopenharmony_ci * @brief This function is called by the Fillp adapter to get the peer address to which the 537060ff233Sopenharmony_ci * requested socket is connected. 538060ff233Sopenharmony_ci * 539060ff233Sopenharmony_ci * @param[in] fd Indicates the socket created. 540060ff233Sopenharmony_ci * @param[out] name Indicates the socket address that needs to be connected. 541060ff233Sopenharmony_ci * @param[in,out] nameLen Indicates the length of the address. 542060ff233Sopenharmony_ci * @return 543060ff233Sopenharmony_ci * On success : ERR_OK 544060ff233Sopenharmony_ci * On failure : error code 545060ff233Sopenharmony_ci */ 546060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtGetPeerName(FILLP_INT fd, FILLP_SOCKADDR *name, socklen_t *nameLen); 547060ff233Sopenharmony_ci 548060ff233Sopenharmony_ci/** 549060ff233Sopenharmony_ci * @ingroup fillp_stack_api 550060ff233Sopenharmony_ci * @brief This function is called by the Fillp Adapter to get system socket options. \n 551060ff233Sopenharmony_ci * Note: All parameters are passed uninterpreted to the system interface. 552060ff233Sopenharmony_ci * This function always returns failure for RAW socket. 553060ff233Sopenharmony_ci * 554060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by FtSocket. 555060ff233Sopenharmony_ci * @param[in] level Indicates the level at which the option resides and the name of the option must 556060ff233Sopenharmony_ci * be specified, when manipulating socket options. 557060ff233Sopenharmony_ci * @param[in] optName Indicates the Optname options which are passed uninterpreted to system interface. 558060ff233Sopenharmony_ci * @param[out] optValue Indicates the option value obtained by invoking the FtGetSockOpt API. 559060ff233Sopenharmony_ci * @param[out] optLen Indicates the option length obtained by invoking the FtGetSockOpt API. 560060ff233Sopenharmony_ci * @return 561060ff233Sopenharmony_ci * On success : ERR_OK 562060ff233Sopenharmony_ci * On failure : error code 563060ff233Sopenharmony_ci */ 564060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtGetSockOpt(FILLP_INT fd, FILLP_INT level, FILLP_INT optName, 565060ff233Sopenharmony_ci void *optValue, FILLP_INT *optLen); 566060ff233Sopenharmony_ci 567060ff233Sopenharmony_ci/** 568060ff233Sopenharmony_ci * @ingroup fillp_stack_api 569060ff233Sopenharmony_ci * @brief This function is called by the Fillp Adapter to set system socket options. \n 570060ff233Sopenharmony_ci * Note: All parameters are passed uninterpreted to the system interface. This function always returns failure 571060ff233Sopenharmony_ci * for RAW socket. 572060ff233Sopenharmony_ci * 573060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by FtSocket. 574060ff233Sopenharmony_ci * @param[in] level Indicates the level at which the option resides and the name of the option must 575060ff233Sopenharmony_ci * be specified, when manipulating socket options. 576060ff233Sopenharmony_ci * @param[in] optName Indicates the Optname options which are passed uninterpreted to system interface. 577060ff233Sopenharmony_ci * @param[in] optValue Indicates the option value obtained by invoking the FtGetSockOpt API. 578060ff233Sopenharmony_ci * @param[in] optLen Indicates the option length obtained by invoking the FtGetSockOpt API. 579060ff233Sopenharmony_ci * @return 580060ff233Sopenharmony_ci * On success : ERR_OK 581060ff233Sopenharmony_ci * On failure : error code 582060ff233Sopenharmony_ci */ 583060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtSetSockOpt(FILLP_INT fd, FILLP_INT level, FILLP_INT optName, 584060ff233Sopenharmony_ci FILLP_CONST void *optValue, socklen_t optLen); 585060ff233Sopenharmony_ci 586060ff233Sopenharmony_ci 587060ff233Sopenharmony_ci/* Indicates configuration of the enumerator members. */ 588060ff233Sopenharmony_ci#define FT_CONFIG_BASE_ENUM 1 589060ff233Sopenharmony_ci 590060ff233Sopenharmony_ci/** 591060ff233Sopenharmony_ci * STATIC/Pure Init Configurations 592060ff233Sopenharmony_ci * 593060ff233Sopenharmony_ci * 1) Maximum Socket Number 594060ff233Sopenharmony_ci * 595060ff233Sopenharmony_ci * DYNAMIC/POST Init Configurations 596060ff233Sopenharmony_ci * 597060ff233Sopenharmony_ci * 1) TX Burst 598060ff233Sopenharmony_ci * 2) RX Burst 599060ff233Sopenharmony_ci * 3) Send Cache 600060ff233Sopenharmony_ci * 4) Recv Cache 601060ff233Sopenharmony_ci * 5) Connection Timeout 602060ff233Sopenharmony_ci * 6) Keep Alive Time 603060ff233Sopenharmony_ci * 7) Full CPU 604060ff233Sopenharmony_ci * 8) Default Rate 605060ff233Sopenharmony_ci * 9) Packet Size 606060ff233Sopenharmony_ci * 10) NACK Repeat Times 607060ff233Sopenharmony_ci * 11) Packet Loss Allowed 608060ff233Sopenharmony_ci * 12) Pack Interval 609060ff233Sopenharmony_ci * 13) Self Adaption 610060ff233Sopenharmony_ci * 14) USE Redundancy 611060ff233Sopenharmony_ci * 15) Default rtt value 612060ff233Sopenharmony_ci * 15) Calculate rtt Dynamically 613060ff233Sopenharmony_ci * 614060ff233Sopenharmony_ci * List Of Stack Level Configurations 615060ff233Sopenharmony_ci * 616060ff233Sopenharmony_ci * 1) Stack Maximum Socket Number 617060ff233Sopenharmony_ci * 2) Stack Maximum Connection Number 618060ff233Sopenharmony_ci * 3) Socket TX Burst 619060ff233Sopenharmony_ci * 4) Socket RX Burst 620060ff233Sopenharmony_ci * 5) Stack Send Cache 621060ff233Sopenharmony_ci * 6) Stack Recv Cache 622060ff233Sopenharmony_ci * 7) Socket Full CPU 623060ff233Sopenharmony_ci * 8) Stack Default Rate 624060ff233Sopenharmony_ci * 9) Stack Packet Size 625060ff233Sopenharmony_ci * 10) Stack NACK Repeat Times 626060ff233Sopenharmony_ci * 11) Stack Packet Loss Allowed 627060ff233Sopenharmony_ci * 12) Stack PACK Interval 628060ff233Sopenharmony_ci * 13) Socket Self Adaption 629060ff233Sopenharmony_ci * 14) Socket USE Redundancy 630060ff233Sopenharmony_ci * 15) Default rtt value 631060ff233Sopenharmony_ci * 16) STACK calculate rtt Dynamically 632060ff233Sopenharmony_ci * 633060ff233Sopenharmony_ci * List Of Socket Level Configurations 634060ff233Sopenharmony_ci * 635060ff233Sopenharmony_ci * 1) Socket Send Cache 636060ff233Sopenharmony_ci * 2) Socket Recv Cache 637060ff233Sopenharmony_ci * 3) Socket OS Send Compensate 638060ff233Sopenharmony_ci * 4) Socket NACK Repeat Times 639060ff233Sopenharmony_ci * 5) Socket Packet Loss Allowed 640060ff233Sopenharmony_ci * 641060ff233Sopenharmony_ci * List of Timer Configuration (stack level and Dynamic) 642060ff233Sopenharmony_ci * 1) Connect timer 643060ff233Sopenharmony_ci * 2) disconnect timer 644060ff233Sopenharmony_ci * 3) keep alive timer 645060ff233Sopenharmony_ci * 4) pack timer 646060ff233Sopenharmony_ci * 5) close pending 647060ff233Sopenharmony_ci */ 648060ff233Sopenharmony_citypedef enum FillpFecRedundancyLevelStrcut { 649060ff233Sopenharmony_ci FILLP_FEC_REDUNDANCY_LEVEL_INVLAID = 0, 650060ff233Sopenharmony_ci FILLP_FEC_REDUNDANCY_LEVEL_LOW, 651060ff233Sopenharmony_ci FILLP_FEC_REDUNDANCY_LEVEL_MID, 652060ff233Sopenharmony_ci FILLP_FEC_REDUNDANCY_LEVEL_HIGH, 653060ff233Sopenharmony_ci FILLP_FEC_REDUNDANCY_LEVEL_REAL, 654060ff233Sopenharmony_ci FILLP_FEC_REDUNDANCY_LEVEL_AUTO, 655060ff233Sopenharmony_ci FILLP_FEC_REDUNDANCY_LEVEL_BUTT 656060ff233Sopenharmony_ci} FillpFecRedundancyLevel; 657060ff233Sopenharmony_ci 658060ff233Sopenharmony_ci/** 659060ff233Sopenharmony_ci * Provides the enum for FillP app list configuration. 660060ff233Sopenharmony_ci */ 661060ff233Sopenharmony_ci/* Enum Declarations */ 662060ff233Sopenharmony_citypedef enum FillpConfigAppListEnum { 663060ff233Sopenharmony_ci FT_CONF_INIT_APP = FT_CONFIG_BASE_ENUM, 664060ff233Sopenharmony_ci FT_CONF_INIT_STACK, 665060ff233Sopenharmony_ci 666060ff233Sopenharmony_ci FT_CONF_TX_BURST, /* Indicates the TX burst for UDP. */ 667060ff233Sopenharmony_ci FT_CONF_MAX_SERVER_ALLOW_SEND_CACHE, /* Indicates the maximum server allowed send cache. */ 668060ff233Sopenharmony_ci FT_CONF_MAX_SERVER_ALLOW_RECV_CACHE, /* Indicates the maximum server allowed receive cache. */ 669060ff233Sopenharmony_ci FT_CONF_SEND_CACHE, /* Indicates the FillP send cache. */ 670060ff233Sopenharmony_ci FT_CONF_RECV_CACHE, /* Indicates the FillP receive cache. */ 671060ff233Sopenharmony_ci FT_CONF_SEND_BUFFER_SIZE, /* Indicates the size of the send buffer. */ 672060ff233Sopenharmony_ci FT_CONF_RECV_BUFFER_SIZE, /* Indicates the size of the receive buffer. */ 673060ff233Sopenharmony_ci FT_CONF_OPPOSITE_SET_RATE, /* Indicates the FillP stack set rate. */ 674060ff233Sopenharmony_ci FT_CONF_PACKET_SIZE, /* Indicates the FillP stack packet size. */ 675060ff233Sopenharmony_ci FT_CONF_SLOW_START, /* Indicates the slow start. */ 676060ff233Sopenharmony_ci FT_CONF_MAX_RATE, /* Indicates the FillP stack maximum rate. */ 677060ff233Sopenharmony_ci FT_CONF_MAX_RECV_RATE, /* Indicates the maximum packet receive rate. */ 678060ff233Sopenharmony_ci FT_CONF_ENABLE_NACK_DELAY, /* Indicates the FillP NACK delay feature. */ 679060ff233Sopenharmony_ci FT_CONF_NACK_DELAY_TIMEOUT, /* Indicates the FillP NACK delay timeout. */ 680060ff233Sopenharmony_ci FT_CONF_ENLARGE_PACK_INTERVAL, /* Indicates about the enlarging pack duration when there is no much data send */ 681060ff233Sopenharmony_ci FT_CONF_TIMER_CONNECT, /* Indicates about the connection timeout duration */ 682060ff233Sopenharmony_ci FT_CONF_TIMER_CONNECTION_RETRY, /* Indicates about the connection retry duration */ 683060ff233Sopenharmony_ci FT_CONF_TIMER_DISCONNECT_RETRY_TIMEOUT, /* Indicates about the connection disconnect fin duration */ 684060ff233Sopenharmony_ci FT_CONF_TIMER_KEEP_ALIVE, /* Indicates about the keep alive time duration */ 685060ff233Sopenharmony_ci FT_CONF_FEC_REDUNDANCY_LEVEL, /* Indicates about the data loss packet retry redundancy level */ 686060ff233Sopenharmony_ci FT_CONF_RECV_JITTER, /* Indicates about the jitter */ 687060ff233Sopenharmony_ci FT_CONF_APP_FC_RECV_RATE, /* Indicates about the periodRecvRate */ 688060ff233Sopenharmony_ci FT_CONF_APP_FC_RECV_PKT_LOSS, /* Indicates about the periodRecvPktLoss */ 689060ff233Sopenharmony_ci FT_CONF_CONST_RATE, /* Indicates about the constant send rate */ 690060ff233Sopenharmony_ci FT_CONF_APP_FC_RECV_RATE_BPS, /* Indicates about the periodRecvRateBps */ 691060ff233Sopenharmony_ci FT_CONF_APP_FC_STATISTICS, /* Indicates about the FILLP_APP_FC_STASTICS */ 692060ff233Sopenharmony_ci FT_CONF_APP_FC_STASTICS_INTERVAL, /* Indicates about the app flow statics intterval */ 693060ff233Sopenharmony_ci FT_CONF_APP_DIFFER_TRANSMIT, /* indicates the app flow using differentiated transmission, 694060ff233Sopenharmony_ci * which means no flow control for I frame and BDP for P frame */ 695060ff233Sopenharmony_ci FT_CONF_APP_PACK_INTERVAL, /* Indicate the FillP default pack interval */ 696060ff233Sopenharmony_ci 697060ff233Sopenharmony_ci FT_CONF_APP_CONFIG_BOUNDARY = 0x7f, 698060ff233Sopenharmony_ci 699060ff233Sopenharmony_ci FT_CONF_MAX_SOCK_NUM, /* Indicates about max socket number */ 700060ff233Sopenharmony_ci FT_CONF_MAX_CONNECTION_NUM, /* Indicates about max connection number */ 701060ff233Sopenharmony_ci FT_CONF_RECV_CACHE_PKT_NUM_BUFF_SIZE, /* Indicates about reac cache packet number buffer size */ 702060ff233Sopenharmony_ci FT_CONF_RX_BURST, /* Indicates about receiver burst count */ 703060ff233Sopenharmony_ci FT_CONF_FULL_CPU, /* Indicates about occupying the full core CPU */ 704060ff233Sopenharmony_ci FT_CONF_OUT_OF_ORDER_CATCHE_FEATURE, /* Indicates about enabling the out of order packet buffer feature */ 705060ff233Sopenharmony_ci FT_CONF_CPU_CORE_USE, /* Indicates about the CPU core to be used */ 706060ff233Sopenharmony_ci FT_CONF_OPPOSITE_SET_PERCENTAGE, /* Indicates about the opposite set rate percentage */ 707060ff233Sopenharmony_ci FT_CONF_MAX_RATE_PERCENTAGE, /* Indicates about the maximum set rate percentage */ 708060ff233Sopenharmony_ci FT_CONF_NACK_REPEAT_TIMES, /* Indicates about the nack control packet repeat count */ 709060ff233Sopenharmony_ci FT_CONF_PACKET_LOSS_ALLOWED, /* Indicates about the allowed packet loss */ 710060ff233Sopenharmony_ci FT_CONF_USE_FEC, /* Indicates about the flow control enable */ 711060ff233Sopenharmony_ci FT_CONF_SUPPORT_FAIRNESS, /* Indicates about the support for fairness */ 712060ff233Sopenharmony_ci FT_CONF_INITIAL_RATE, /* Indicates about the initial rate */ 713060ff233Sopenharmony_ci FT_CONF_CORE_MAX_RATE, /* Indicates about the overall rate on the sending channel */ 714060ff233Sopenharmony_ci FT_CONF_CORE_MAX_RECV_RATE, /* Indicates about the overall rate on the receiving channel */ 715060ff233Sopenharmony_ci FT_CONF_TIMER_RECV_CACHE_PKT_NUMBUFF, /* Indicates about the receive packet cache buffer number */ 716060ff233Sopenharmony_ci FT_CONF_ALG, /* Indicates about the flow control algorithm to be selected */ 717060ff233Sopenharmony_ci FT_CONF_INIT_STACK_EXT, /* Indicates about the configs which needs to be set for achieveing 3.2Gbps */ 718060ff233Sopenharmony_ci FT_CONF_BFULL_CPU_USE_THRESHOLD_RATE, /* Indicates about the full cpu rate(Kbps) */ 719060ff233Sopenharmony_ci FT_CONF_STACK_CORE_LIMIT_RATE, /* Indicates about the overall rate limit on the sending channel */ 720060ff233Sopenharmony_ci FT_CONF_STACK_CORE_SEND_CACHE, /* Indicates the FillP stack send cache. */ 721060ff233Sopenharmony_ci FT_CONF_STACK_CORE_RECV_CACHE, /* Indicates the FillP stack receive cache. */ 722060ff233Sopenharmony_ci FT_CONF_MAX_ASSIST_MSG_ITEM_NUM, /* Indicates the max assist msg item number. */ 723060ff233Sopenharmony_ci ENUM_FILLP_CONFIG_LIST_BUTT = 0xFF /* Indicates the maximum value for the enumeration. */ 724060ff233Sopenharmony_ci} FtConfigItemList; 725060ff233Sopenharmony_ci 726060ff233Sopenharmony_citypedef struct FillpAppFcStasticsStruct { 727060ff233Sopenharmony_ci /* Indicates the period trans delay, uint:ms */ 728060ff233Sopenharmony_ci FILLP_UINT32 periodRtt; 729060ff233Sopenharmony_ci /* Indicates the period pkt loss rate on recv side, precision xx% lost rate is 1%, then 1 will returned */ 730060ff233Sopenharmony_ci FILLP_UINT32 periodRecvPktLoss; 731060ff233Sopenharmony_ci /* Indicates the period recv rate, uint:kbps */ 732060ff233Sopenharmony_ci FILLP_UINT32 periodRecvRate; 733060ff233Sopenharmony_ci /* Indicates the period pkt loss rate on recv side, precision xx.xx%, lost rate is 1.10%, then 110 will returned */ 734060ff233Sopenharmony_ci FILLP_UINT32 periodRecvPktLossHighPrecision; 735060ff233Sopenharmony_ci /* Indicates the period pkt loss rate on send side, precision xx.xx%, lost rate is 1.10%, then 110 will returned */ 736060ff233Sopenharmony_ci FILLP_UINT32 periodSendPktLossHighPrecision; 737060ff233Sopenharmony_ci /* Indicates the period recv rate, uint:bps */ 738060ff233Sopenharmony_ci FILLP_ULLONG periodRecvRateBps; 739060ff233Sopenharmony_ci /* Indicates the period send rate, uint:bps */ 740060ff233Sopenharmony_ci FILLP_ULLONG periodSendRateBps; 741060ff233Sopenharmony_ci /* Indicates the period send rate, uint:ms */ 742060ff233Sopenharmony_ci FILLP_LLONG jitter; 743060ff233Sopenharmony_ci} FillpAppFcStasticsSt; 744060ff233Sopenharmony_ci 745060ff233Sopenharmony_ci/** 746060ff233Sopenharmony_ci * Here provide one common lib to eBackup for both 200Mbps and 3.2Gbps requirement. 747060ff233Sopenharmony_ci * Application can use this lib for both the requirements by following below method: 748060ff233Sopenharmony_ci * 1) For eBackup (200Mbps) case, no change in Application code 749060ff233Sopenharmony_ci * 2) For eBackup_perf (3.2Gbps) case, in Application code, before FtInit(), need to set below 750060ff233Sopenharmony_ci * configuration using FtConfigSet with name as FT_CONF_INIT_STACK_EXT 751060ff233Sopenharmony_ci * 752060ff233Sopenharmony_ci * enableDefault10GConfigsForEbackupPdt: Enable: Non Zero value; Disable: FILLP_FALSE 753060ff233Sopenharmony_ci * pktLossThresHoldMax: 754060ff233Sopenharmony_ci * timingWheelAccuracy; 755060ff233Sopenharmony_ci * maximalAckNumLimit : 2000 756060ff233Sopenharmony_ci * sendOneAckNum : 100 757060ff233Sopenharmony_ci * cpuPauseTime : 0 758060ff233Sopenharmony_ci * retransmitCmpTime : 0 759060ff233Sopenharmony_ci * minRate : 350 760060ff233Sopenharmony_ci * minPackInterval : 20000 761060ff233Sopenharmony_ci * unsendBoxLoopCheckBurst : 1024 762060ff233Sopenharmony_ci * instUnsendBoxSize: 819200 763060ff233Sopenharmony_ci * nackRetryLen:600 764060ff233Sopenharmony_ci * para :Reserved for future extension purpose 765060ff233Sopenharmony_ci */ 766060ff233Sopenharmony_citypedef struct FillpGlobalPreinitExtConfigsStruct { 767060ff233Sopenharmony_ci FILLP_UINT8 enableDefault10GConfigsForEbackupPdt; /* Enable: Non Zero value; Disable: FILLP_FALSE */ 768060ff233Sopenharmony_ci FILLP_UINT8 pktLossThresHoldMax; 769060ff233Sopenharmony_ci FILLP_UINT16 timingWheelAccuracy; 770060ff233Sopenharmony_ci FILLP_UINT32 maximalAckNumLimit; 771060ff233Sopenharmony_ci FILLP_UINT32 sendOneAckNum; 772060ff233Sopenharmony_ci FILLP_UINT16 cpuPauseTime; 773060ff233Sopenharmony_ci FILLP_UINT8 retransmitCmpTime; 774060ff233Sopenharmony_ci FILLP_UINT8 reserve; 775060ff233Sopenharmony_ci FILLP_UINT16 minRate; 776060ff233Sopenharmony_ci FILLP_UINT16 minPackInterval; 777060ff233Sopenharmony_ci FILLP_UINT16 unsendBoxLoopCheckBurst; 778060ff233Sopenharmony_ci FILLP_UINT16 reserv; 779060ff233Sopenharmony_ci FILLP_UINT32 instUnsendBoxSize; 780060ff233Sopenharmony_ci FILLP_UINT16 nackRetryLen; 781060ff233Sopenharmony_ci FILLP_UINT16 reserved; 782060ff233Sopenharmony_ci void *para; /* For future extension purpose */ 783060ff233Sopenharmony_ci} FillpGlobalPreinitExtConfigsSt; 784060ff233Sopenharmony_ci 785060ff233Sopenharmony_ci 786060ff233Sopenharmony_ci/** 787060ff233Sopenharmony_ci * Represents the UDP resource data structure. 788060ff233Sopenharmony_ci */ 789060ff233Sopenharmony_ci/* Structure Declarations */ 790060ff233Sopenharmony_citypedef struct FillpUdpResourceStruct { 791060ff233Sopenharmony_ci /* Indicates the number of packets received at each send cycle. This value must be tuned properly for getting 792060ff233Sopenharmony_ci * high end performance. The default value is 128. Range: 1 -- 0xFFFF */ 793060ff233Sopenharmony_ci FILLP_UINT16 rxBurst; 794060ff233Sopenharmony_ci FILLP_UINT8 padd[2]; 795060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 796060ff233Sopenharmony_ci FILLP_UINT32 reserve; 797060ff233Sopenharmony_ci#endif 798060ff233Sopenharmony_ci} FillpUdpResourceSt; 799060ff233Sopenharmony_ci 800060ff233Sopenharmony_ci/** 801060ff233Sopenharmony_ci * Provides the values for the FillpCommonStruct data structure. 802060ff233Sopenharmony_ci */ 803060ff233Sopenharmony_citypedef struct FillpCommonStruct { 804060ff233Sopenharmony_ci /* Indicates the receive cache packet number buffer size. The default value is 100. 805060ff233Sopenharmony_ci * Valid values are 1 to 10000. */ 806060ff233Sopenharmony_ci FILLP_UINT32 recvCachePktNumBufferSize; 807060ff233Sopenharmony_ci /* Indicates the socket numbers supported for the FillP Server. For 32 value, the server creates the same number 808060ff233Sopenharmony_ci * of ring queues. The default value is 64. Valid values are 1 to 64. */ 809060ff233Sopenharmony_ci FILLP_UINT16 maxSockNum; 810060ff233Sopenharmony_ci /* Indicates the maximum connection numbers supported by each socket. This value cannot be greater than 811060ff233Sopenharmony_ci * "maxSockNum" otherwise set as equal to "maxSockNum". The default value is 32. Valid values are 1 to 32. */ 812060ff233Sopenharmony_ci FILLP_UINT16 maxConnectionNum; 813060ff233Sopenharmony_ci /* Indicates the CPU option. If set to TRUE, the FillP main thread will not sleep. Instead of just sending, 814060ff233Sopenharmony_ci * receiving data, and doing other processing, this will lead to better transfer rate control. It can have impact 815060ff233Sopenharmony_ci * on CPU rate. If set to FALSE, the FillP main thread will sleep for certain interval based on the packet transfer 816060ff233Sopenharmony_ci * rate. In this case, the CPU utilization is less but can have adverse impact on packet rate. You must select the 817060ff233Sopenharmony_ci * option based on this trade-off and configure this flag properly. Example: If we set the rate to 100 Mbps, 818060ff233Sopenharmony_ci * we should send one packet per 100 us, and do sleep for 100 us. But, while sleep is done more time may be passed 819060ff233Sopenharmony_ci * (more than 10 us). So when FillP awakes next, FillP has to send more packets at one time. 820060ff233Sopenharmony_ci * The default value is FALSE. */ 821060ff233Sopenharmony_ci FILLP_BOOL fullCpu; 822060ff233Sopenharmony_ci /* Indicates whether to support out of order cache feature. The default value is TRUE. */ 823060ff233Sopenharmony_ci FILLP_BOOL outOfOrderCacheFeature; 824060ff233Sopenharmony_ci /* Indicates the end of the enum. */ 825060ff233Sopenharmony_ci FILLP_UINT8 padd[2]; /* add 2 bytes for byte alignment */ 826060ff233Sopenharmony_ci FILLP_UINT32 maxAssistMsgItemNum; 827060ff233Sopenharmony_ci} FillpCommonSt; 828060ff233Sopenharmony_ci 829060ff233Sopenharmony_ci 830060ff233Sopenharmony_ci/** 831060ff233Sopenharmony_ci * Provides the values for flow control. 832060ff233Sopenharmony_ci */ 833060ff233Sopenharmony_citypedef struct FillpFlowControlStruct { 834060ff233Sopenharmony_ci /* Indicates the maximum sending rate of the network. The default value is 950 Mbps. Range: non-zero to any */ 835060ff233Sopenharmony_ci FILLP_UINT32 maxRate; 836060ff233Sopenharmony_ci /* Indicates the maximum receiving rate of the network. The default value is 950 Mbps. Range: non-zero to any */ 837060ff233Sopenharmony_ci FILLP_UINT32 maxRecvRate; 838060ff233Sopenharmony_ci /* Indicates the rate with which FillP needs to start the data during the slow start. The default value is 2 Mbps. 839060ff233Sopenharmony_ci * Range: non-zero to maxRate - 1 */ 840060ff233Sopenharmony_ci FILLP_UINT32 initialRate; 841060ff233Sopenharmony_ci /* Indicates the opposite set percentage. */ 842060ff233Sopenharmony_ci FILLP_UINT16 oppositeSetPercentage; 843060ff233Sopenharmony_ci /* Indicates the maximum rate percentage. */ 844060ff233Sopenharmony_ci FILLP_UINT16 maxRatePercentage; 845060ff233Sopenharmony_ci /* Indicates the number of NACK packets to send from the system to avoid congestion and NACK Failure rate. If it 846060ff233Sopenharmony_ci * set as 10, then NACK packets will be sent 10 times to remote end. The default value is 10. Range: 1 to 0xFF */ 847060ff233Sopenharmony_ci FILLP_UINT16 nackRepeatTimes; 848060ff233Sopenharmony_ci /* Indicates the maximum allowed packet loss in the system. For High "pktLossAllow" value, the sending rate 849060ff233Sopenharmony_ci * should be decreased. This value should be minimum in order to get a 2 Mbps sending rate. 850060ff233Sopenharmony_ci * The default value is 10. */ 851060ff233Sopenharmony_ci FILLP_UINT16 pktLossAllow; 852060ff233Sopenharmony_ci /* Enables or disables the redundant data retransmit feature. For data packet which is retransmitted multiple 853060ff233Sopenharmony_ci * times due to multiple send failures, FillP can send redundant data packet at same time to further avoid the 854060ff233Sopenharmony_ci * further packet loss. The default value is FALSE. */ 855060ff233Sopenharmony_ci FILLP_BOOL fecEnable; 856060ff233Sopenharmony_ci /* Algorithm choice */ 857060ff233Sopenharmony_ci FILLP_UINT8 fcAlg; 858060ff233Sopenharmony_ci /* Indicates whether fair sharing of bandwidth among the connections is required. If enabled, fairness would be 859060ff233Sopenharmony_ci * provided. The default value is NO FAIRNESS. Range = { FillpStackFairnessTypeEn } */ 860060ff233Sopenharmony_ci FILLP_UINT8 supportFairness; 861060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 862060ff233Sopenharmony_ci FILLP_UINT32 reserve; 863060ff233Sopenharmony_ci#endif 864060ff233Sopenharmony_ci} FillpFlowControlSt; 865060ff233Sopenharmony_ci 866060ff233Sopenharmony_ci 867060ff233Sopenharmony_ci/** 868060ff233Sopenharmony_ci * Provides the data structure for the FillP timer. 869060ff233Sopenharmony_ci */ 870060ff233Sopenharmony_citypedef struct FillpTimerStruct { 871060ff233Sopenharmony_ci /* Indicates the receive packet time out. The default value is 20. Valid values are 10 to 300. */ 872060ff233Sopenharmony_ci FILLP_UINT16 recvCachePktNumBufferTimeout; 873060ff233Sopenharmony_ci FILLP_UINT8 padd[2]; 874060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 875060ff233Sopenharmony_ci FILLP_UINT32 reserve; 876060ff233Sopenharmony_ci#endif 877060ff233Sopenharmony_ci} FillpTimer; 878060ff233Sopenharmony_ci 879060ff233Sopenharmony_ci 880060ff233Sopenharmony_ci/** 881060ff233Sopenharmony_ci * Provides the global configurations. 882060ff233Sopenharmony_ci */ 883060ff233Sopenharmony_citypedef struct FillpGlobalConfigsStruct { 884060ff233Sopenharmony_ci FillpUdpResourceSt udp; /* Indicates the UDP resource list. */ 885060ff233Sopenharmony_ci FillpCommonSt common; /* Indicates the common resource list. */ 886060ff233Sopenharmony_ci FillpFlowControlSt flowControl; /* Indicates the flow control resource list. */ 887060ff233Sopenharmony_ci FillpTimer timers; /* Indicates the set timers. */ 888060ff233Sopenharmony_ci} FillpGlobalConfigsSt; 889060ff233Sopenharmony_ci 890060ff233Sopenharmony_ci/** 891060ff233Sopenharmony_ci * Provides UDP resource values. 892060ff233Sopenharmony_ci */ 893060ff233Sopenharmony_citypedef struct FillpAppUdpResourceStruct { 894060ff233Sopenharmony_ci /* Indicates the number of packets sent at each send cycle. The TX burst value must be tuned properly for getting 895060ff233Sopenharmony_ci * high end performance. \n Minimum Value: greater than 0 \n Maximum Value: 0x7fff \n Default Value: \n 896060ff233Sopenharmony_ci * 4096 (Miracast PDT) */ 897060ff233Sopenharmony_ci FILLP_UINT16 txBurst; 898060ff233Sopenharmony_ci /* This padding is not required, but since this structure is member of another structure, padding to 4 bytes. */ 899060ff233Sopenharmony_ci FILLP_UINT8 padd[2]; 900060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 901060ff233Sopenharmony_ci FILLP_UINT32 reserve; 902060ff233Sopenharmony_ci#endif 903060ff233Sopenharmony_ci} FillpAppUdpResourceSt; 904060ff233Sopenharmony_ci 905060ff233Sopenharmony_ci 906060ff233Sopenharmony_ci/** 907060ff233Sopenharmony_ci * Provides the values for the FillpAppCommonStruct data structure. 908060ff233Sopenharmony_ci */ 909060ff233Sopenharmony_citypedef struct FillpAppCommonStruct { 910060ff233Sopenharmony_ci /* Indicates the maximum cache allowed by the server to send. Minimum Value: greater than 0 Maximum Value: 911060ff233Sopenharmony_ci * No upper limit Default Value: 1638400 */ 912060ff233Sopenharmony_ci FILLP_UINT32 maxServerAllowSendCache; 913060ff233Sopenharmony_ci /* Indicates the maximum cache allowed by the server to receive. Minimum Value: greater than 0 914060ff233Sopenharmony_ci * Maximum Value: No upper limit Default Value: 1638400 */ 915060ff233Sopenharmony_ci FILLP_UINT32 maxServerAllowRecvCache; 916060ff233Sopenharmony_ci /* Indicates the cache pool size reserved to send data for each connection. Minimum Value: greater than 0 917060ff233Sopenharmony_ci * Maximum Value: Less than or equal to 0x15D860 Default Value: 8192 (Miracast PDT) */ 918060ff233Sopenharmony_ci FILLP_UINT32 sendCache; 919060ff233Sopenharmony_ci /* Indicates the cache pool size reserved for received data for each connection. Minimum Value: greater than 0 920060ff233Sopenharmony_ci * Maximum Value: Less than or equal to 0x15D860 Default Value: 8192 (Miracast PDT) */ 921060ff233Sopenharmony_ci FILLP_UINT32 recvCache; 922060ff233Sopenharmony_ci /* Indicates the size of the send buffer. Minimum Value: greater than or equal to 1500 Maximum Value: 923060ff233Sopenharmony_ci * No maximum value Default Value: (16 * 1024 * 1024) */ 924060ff233Sopenharmony_ci FILLP_UINT32 udpSendBufSize; 925060ff233Sopenharmony_ci /* Indicates the size of the receive buffer. Minimum Value: greater than or equal to 1500 Maximum Value: 926060ff233Sopenharmony_ci * No maximum value Default Value: (16 * 1024 * 1024) */ 927060ff233Sopenharmony_ci FILLP_UINT32 recvBufSize; 928060ff233Sopenharmony_ci /* Indicates the retry count for the keep alive signal. Values: FILLP_TRUE or FILLP_FALSE Default Value: 929060ff233Sopenharmony_ci * FILLP_FALSE (Miracast PDT) */ 930060ff233Sopenharmony_ci FILLP_BOOL enableNackDelay; 931060ff233Sopenharmony_ci /* Indicates the the increase the pack interval when there is no data transmission. Values: Any value. Greater 932060ff233Sopenharmony_ci * than 0 means that the feature is enabled Default Value: FILLP_TRUE (Miracast PDT) */ 933060ff233Sopenharmony_ci FILLP_BOOL enlargePackIntervalFlag; 934060ff233Sopenharmony_ci FILLP_UINT16 paddShort; 935060ff233Sopenharmony_ci FILLP_UINT32 paddUint32; 936060ff233Sopenharmony_ci /* Indicates the duration for delaying nack packet. Minimum Value: greater than or equal to (10000 << 3) 937060ff233Sopenharmony_ci * Maximum Value: Less than or equal to 0x7fffffff 20000 Default Value: 20000 */ 938060ff233Sopenharmony_ci FILLP_LLONG nackDelayTimeout; 939060ff233Sopenharmony_ci} FillpAppCommonSt; 940060ff233Sopenharmony_ci 941060ff233Sopenharmony_ci 942060ff233Sopenharmony_ci/** 943060ff233Sopenharmony_ci * Provides the values for flow control. 944060ff233Sopenharmony_ci */ 945060ff233Sopenharmony_citypedef struct FillpAppFlowControlStruct { 946060ff233Sopenharmony_ci /* Indicates the maximum send rate, in Mbps, the connection in this stack can reach. If set on a particular 947060ff233Sopenharmony_ci * socket ID, then it is applicable for that socket ID, otherwise it will be set as default value for all the 948060ff233Sopenharmony_ci * sockets which will be created later. Minimum Value: greater than 0 Maximum Value: Less than 949060ff233Sopenharmony_ci * (10 * 1000 * 1000) Default Value: (20 * 1000) (Miracast PDT) */ 950060ff233Sopenharmony_ci FILLP_UINT32 maxRate; 951060ff233Sopenharmony_ci /* Maximum rate to be used for receiving the traffic If set on a particular socket ID, then it is applicable for 952060ff233Sopenharmony_ci * that socket ID, otherwise it will be set as default value for all the sockets which will be created later 953060ff233Sopenharmony_ci * Minimum Value: greater than 0 Maximum Value: Less than (10 * 1000 * 1000) Default Value: 954060ff233Sopenharmony_ci * (20 * 1000) (Miracast PDT) */ 955060ff233Sopenharmony_ci FILLP_UINT32 maxRecvRate; 956060ff233Sopenharmony_ci /* Indicates the opposite set rate. Minimum Value: less than (10 * 1000 * 1000) Maximum Value: Less than 957060ff233Sopenharmony_ci * maxRate Default Value: 0 */ 958060ff233Sopenharmony_ci FILLP_UINT32 oppositeSetRate; 959060ff233Sopenharmony_ci /* Indicates the maximum size of packet supported for send and receive on FillP socket. If you change this value 960060ff233Sopenharmony_ci * sendPktNum and send interval value are also changed. Minimum Value: 0 Maximum Value: Less than or equal 961060ff233Sopenharmony_ci * to (FILLP_FRAME_MTU - FILLP_HLEN) Default Value: 1300 */ 962060ff233Sopenharmony_ci FILLP_UINT16 pktSize; 963060ff233Sopenharmony_ci /* Indicates the slow start. Values: FILLP_TRUE and FILLP_FALSE Default Value: FILLP_FALSE (Miracast PDT) */ 964060ff233Sopenharmony_ci FILLP_BOOL slowStart; 965060ff233Sopenharmony_ci /* Enables constant rate. Values: FILLP_TRUE and FILLP_FALSE Default Value: FILLP_FALSE */ 966060ff233Sopenharmony_ci FILLP_BOOL constRateEnbale; 967060ff233Sopenharmony_ci /* enable differentiated transmission */ 968060ff233Sopenharmony_ci FILLP_BOOL differTransmit; 969060ff233Sopenharmony_ci} FillpAppFlowControlSt; 970060ff233Sopenharmony_ci 971060ff233Sopenharmony_ci 972060ff233Sopenharmony_ci/** 973060ff233Sopenharmony_ci * Provides the app timer values. 974060ff233Sopenharmony_ci */ 975060ff233Sopenharmony_citypedef struct FillpAppTimerStruct { 976060ff233Sopenharmony_ci /* Indicates the keep alive time, after which the connection will be disconnected if no messages are exchanged. 977060ff233Sopenharmony_ci * Minimum Value: Greater than or equal to 100 ms Maximum Value: Less than or equal to (3600 * 1000) ms 978060ff233Sopenharmony_ci * Default Value: (10*1000) */ 979060ff233Sopenharmony_ci FILLP_UINT32 keepAliveTime; 980060ff233Sopenharmony_ci /* Indicates the disconnect retry timeout. Minimum Value: Greater than 0 Maximum Value: Less than or 981060ff233Sopenharmony_ci * equal to (10 * 1000) ms Default Value: 200 */ 982060ff233Sopenharmony_ci FILLP_UINT32 disconnectRetrytimeout; 983060ff233Sopenharmony_ci /* Indicates the maximum time for any connection to remain in connecting state. The connection is set to IDLE 984060ff233Sopenharmony_ci * state after this timer expires. Minimum Value: Greater than 0 Maximum Value: Less than or equal to 985060ff233Sopenharmony_ci * (300 * 1000) ms \n Default Value: (10 * 1000) */ 986060ff233Sopenharmony_ci FILLP_UINT32 connectTimeout; 987060ff233Sopenharmony_ci FILLP_UINT16 reserve; /* reserve */ 988060ff233Sopenharmony_ci /* Indicates the connection retry timeout. Minimum Value: Greater than 0 Maximum Value: Less than or 989060ff233Sopenharmony_ci * equal to (10 * 1000) ms Default Value: 200 */ 990060ff233Sopenharmony_ci FILLP_UINT16 connRetrytimeout; 991060ff233Sopenharmony_ci FILLP_UINT16 reserveExt; 992060ff233Sopenharmony_ci FILLP_UINT8 padd[2]; 993060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 994060ff233Sopenharmony_ci FILLP_UINT32 reserved; 995060ff233Sopenharmony_ci#endif 996060ff233Sopenharmony_ci} FillpAppTimerSt; 997060ff233Sopenharmony_ci 998060ff233Sopenharmony_ci/** 999060ff233Sopenharmony_ci * Provides the global configurations. 1000060ff233Sopenharmony_ci */ 1001060ff233Sopenharmony_citypedef struct FillpAppGlobalConfigStruct { 1002060ff233Sopenharmony_ci FillpAppUdpResourceSt udp; /* Indicates the UDP resource list. */ 1003060ff233Sopenharmony_ci FillpAppCommonSt common; /* Indicates the common resource list. */ 1004060ff233Sopenharmony_ci FillpAppFlowControlSt flowControl; /* Indicates the flow control resource list. */ 1005060ff233Sopenharmony_ci FillpAppTimerSt timers; /* Indicates the timer list. */ 1006060ff233Sopenharmony_ci} FillpAppGlobalConfigsSt; 1007060ff233Sopenharmony_ci 1008060ff233Sopenharmony_ci/** 1009060ff233Sopenharmony_ci * Provides the FillP stack fairness type. 1010060ff233Sopenharmony_ci */ 1011060ff233Sopenharmony_citypedef enum FillpStackFairnessTypeEnum { 1012060ff233Sopenharmony_ci FILLP_FAIRNESS_TYPE_NONE = 0, /* Indicates the fairness type none. */ 1013060ff233Sopenharmony_ci FILLP_FAIRNESS_TYPE_EQUAL_WEIGHT = 1, /* Indicates the equal weight fairness type. */ 1014060ff233Sopenharmony_ci FILLP_FAIRNESS_TYPE_CONN_SET_VAL = 2, /* Indicates the setting value. */ 1015060ff233Sopenharmony_ci FILLP_FAIRNESS_TYPE_END, /* Indicates FillP fairness end. */ 1016060ff233Sopenharmony_ci FILLP_FAIRNESS_TYPE_BUTT = 0xFF /* Indicates the FillP fairness type. */ 1017060ff233Sopenharmony_ci} FillpStackFairnessTypeEn; 1018060ff233Sopenharmony_ci 1019060ff233Sopenharmony_ci/** 1020060ff233Sopenharmony_ci * @ingroup fillp_stack_api 1021060ff233Sopenharmony_ci * @brief Registers the system interface functions to be used by the FillP stack. The function pointers of all 1022060ff233Sopenharmony_ci * system functions defined by this API are passed FillpSysLibCallbackFuncSt to FILLP stack to be registered 1023060ff233Sopenharmony_ci * and used during the run time of the stack. Users must pass "FillpCryptoRandFunc cryptoRand" which is to register 1024060ff233Sopenharmony_ci * cryptographically strong random number generator function. Others callback pointers are optional, if users pass 1025060ff233Sopenharmony_ci * them as NULL, then default functions will be registered by FillP/VTP. This function should be called before 1026060ff233Sopenharmony_ci * initializing the stack. 1027060ff233Sopenharmony_ci * 1028060ff233Sopenharmony_ci * @param[in] libSysFunc Pointer to system interface callback function structure FillpSysLibCallbackFuncSt. 1029060ff233Sopenharmony_ci * @param[in] para This is a reserve parameter for future extension. User can pass it as FILLP_NULL_PTR. 1030060ff233Sopenharmony_ci * @return 1031060ff233Sopenharmony_ci * FILLP_SUCCESS : Upon successful 1032060ff233Sopenharmony_ci * ERR_NULLPTR : Upon failure 1033060ff233Sopenharmony_ci */ 1034060ff233Sopenharmony_ciextern FILLP_INT32 DLL_API FillpApiRegLibSysFunc(IN FILLP_CONST FillpSysLibCallbackFuncSt *libSysFunc, 1035060ff233Sopenharmony_ci IN FILLP_CONST void *para); 1036060ff233Sopenharmony_ci 1037060ff233Sopenharmony_ci/** 1038060ff233Sopenharmony_ci * @ingroup fillp_stack_api 1039060ff233Sopenharmony_ci * @brief Registers the APP functions to be used by the FillP stack. The function pointers of all APP functions 1040060ff233Sopenharmony_ci * defined by this API are passed FillpAppCallbackFunc to FILLP stack to be registered and used during 1041060ff233Sopenharmony_ci * the run time of the stack. This api can only invoked after FillpApiRegLibSysFunc. 1042060ff233Sopenharmony_ci * fillpSockCloseCbkFunc callback pointers are optional and default value is NULL. 1043060ff233Sopenharmony_ci * 1044060ff233Sopenharmony_ci * @param[in] appCbkFunc Pointer to APP callback function structure FillpAppCallbackFunc. 1045060ff233Sopenharmony_ci * @return 1046060ff233Sopenharmony_ci * 0 : Upon successful 1047060ff233Sopenharmony_ci * -1 : Upon failure 1048060ff233Sopenharmony_ci * The following table provides information about the errors set by this API. 1049060ff233Sopenharmony_ci */ 1050060ff233Sopenharmony_ciextern FILLP_INT32 DLL_API FillpApiRegAppCallbackFunc(IN FILLP_CONST FillpAppCallbackFunc *appCbkFunc); 1051060ff233Sopenharmony_ci 1052060ff233Sopenharmony_ci/** 1053060ff233Sopenharmony_ci * @ingroup fillp_stack_api 1054060ff233Sopenharmony_ci * @brief This API is used to initialize the VTP/FillP stack. 1055060ff233Sopenharmony_ci * @note Two threads cannot call FtInit() simultaneously. Also FtInit() cannot be called multiple time once it is 1056060ff233Sopenharmony_ci * successful. It is suggested that products use this API only once by a single thread to initialize VTP/FIllP stack. 1057060ff233Sopenharmony_ci * 1058060ff233Sopenharmony_ci * @return The error reason is returned by the return value. 1059060ff233Sopenharmony_ci */ 1060060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtInit(void); 1061060ff233Sopenharmony_ci 1062060ff233Sopenharmony_ci/** 1063060ff233Sopenharmony_ci * @ingroup fillp_stack_api 1064060ff233Sopenharmony_ci * @brief This API is used to deinitialize the FillP stack. 1065060ff233Sopenharmony_ci * @note 1066060ff233Sopenharmony_ci * - User must close all the sockets created by FtSocket() / FtEpollCreate() before calling the FtDestroy() API. 1067060ff233Sopenharmony_ci * Otherwise the FtDestroy() API will block. There is another API FtDestroyNonblock() which does not block, 1068060ff233Sopenharmony_ci * so user can choose to use this API. 1069060ff233Sopenharmony_ci * - Two threads cannot call FtDestroy() simultaneously. Also FtDestroy() cannot be called multiple time after it is 1070060ff233Sopenharmony_ci * successful. It is suggested that products use this API only once by a single thread. 1071060ff233Sopenharmony_ci * 1072060ff233Sopenharmony_ci * @return This API does not set any error. 1073060ff233Sopenharmony_ci */ 1074060ff233Sopenharmony_ciextern void DLL_API FtDestroy(void); 1075060ff233Sopenharmony_ci 1076060ff233Sopenharmony_ci/** 1077060ff233Sopenharmony_ci * @ingroup fillp_stack_api 1078060ff233Sopenharmony_ci * @brief This API is use to deinit the fillp stack but not block. 1079060ff233Sopenharmony_ci * 1080060ff233Sopenharmony_ci * @return This API does not set any error. 1081060ff233Sopenharmony_ci */ 1082060ff233Sopenharmony_ciextern void DLL_API FtDestroyNonblock(void); 1083060ff233Sopenharmony_ci 1084060ff233Sopenharmony_ci/** 1085060ff233Sopenharmony_ci * Provides the statistics types. 1086060ff233Sopenharmony_ci */ 1087060ff233Sopenharmony_citypedef enum FillpStatsTypeEnum { 1088060ff233Sopenharmony_ci FILLP_STATS_DIRECT_PACK = 0, /* Indicates the packet statistics. */ 1089060ff233Sopenharmony_ci FILLP_STATS_DIRECT_KEEP_ALIVE, /* Indicates the packet keep alive statistics. */ 1090060ff233Sopenharmony_ci FILLP_STATS_DIRECT_DEBUG, /* Indicates the direct debug statistics. */ 1091060ff233Sopenharmony_ci FILLP_STATS_DIRECT_TRAFFIC, /* Indicates the traffic statistics. */ 1092060ff233Sopenharmony_ci FILLP_STATS_DIRECT_ALL /* Indicates the statistics for all packets. */ 1093060ff233Sopenharmony_ci} FillpStatsTypeEn; 1094060ff233Sopenharmony_ci 1095060ff233Sopenharmony_ci/** 1096060ff233Sopenharmony_ci * Provides the FillP packet statistics. 1097060ff233Sopenharmony_ci */ 1098060ff233Sopenharmony_cistruct FillpPackStastics { 1099060ff233Sopenharmony_ci FILLP_LLONG packTimePassed; /* Indicates the packet time passed. */ 1100060ff233Sopenharmony_ci FILLP_LLONG packSendTime; /* Indicates the packet send time. */ 1101060ff233Sopenharmony_ci FILLP_LLONG packRttDetectTime; /* Indicates the packet rtt detect time. */ 1102060ff233Sopenharmony_ci FILLP_ULLONG periodRecvBits; /* Indicates the packet receive bits. */ 1103060ff233Sopenharmony_ci FILLP_UINT32 packInterval; /* Indicates the packet time interval. */ 1104060ff233Sopenharmony_ci FILLP_UINT32 lastPackRecvRate; /* Indicates the packet receive rate. */ 1105060ff233Sopenharmony_ci FILLP_UINT32 periodRecvRate; /* Indicates the packet receive rate. */ 1106060ff233Sopenharmony_ci FILLP_UINT32 maxRecvRate; /* Indicates the maximum packet receive rate. */ 1107060ff233Sopenharmony_ci FILLP_UINT32 packLostSeq; /* Indicates the packet lost sequence. */ 1108060ff233Sopenharmony_ci FILLP_UINT32 packPktNum; /* Indicates the packet number. */ 1109060ff233Sopenharmony_ci 1110060ff233Sopenharmony_ci FILLP_UINT32 periodRecvedOnes; /* Indicates the received packets. */ 1111060ff233Sopenharmony_ci FILLP_UINT32 periodDroped; /* Indicates the dropped packets. */ 1112060ff233Sopenharmony_ci 1113060ff233Sopenharmony_ci FILLP_UINT32 periodSendRate; /* Indicates the packet send rate. */ 1114060ff233Sopenharmony_ci FILLP_UINT32 periodAckByPackRate; /* Indicates the ack by packet rate. */ 1115060ff233Sopenharmony_ci 1116060ff233Sopenharmony_ci FILLP_UINT32 packIntervalBackup; /* Records the packInterval as a backup. */ 1117060ff233Sopenharmony_ci FILLP_UINT16 periodRecvPktLoss; /* Indicates the packet receive loss. */ 1118060ff233Sopenharmony_ci FILLP_BOOL peerRtt; /* Indicates the peer value. */ 1119060ff233Sopenharmony_ci FILLP_UINT8 padd[5]; 1120060ff233Sopenharmony_ci}; 1121060ff233Sopenharmony_ci 1122060ff233Sopenharmony_ci/* Provides the FillP NACK statistics. */ 1123060ff233Sopenharmony_cistruct FillpNackStastics { 1124060ff233Sopenharmony_ci FILLP_LLONG nackDelayTimeout; /* Indicates the NACK delay timeout. */ 1125060ff233Sopenharmony_ci FILLP_UINT32 nackInterval; /* Indicates the NACK interval. */ 1126060ff233Sopenharmony_ci FILLP_UINT16 nackHistorySendQueueNum; /* Indicates the NACK history send queue number. */ 1127060ff233Sopenharmony_ci FILLP_UINT16 currentHistoryNackNum; /* Indicates the Ncurrent history NACK number. */ 1128060ff233Sopenharmony_ci FILLP_LLONG nackSendTime; /* Indicates the NACK send time. */ 1129060ff233Sopenharmony_ci FILLP_UINT32 historyNackQueueLen; /* Indicates the history NACK queue length. */ 1130060ff233Sopenharmony_ci FILLP_UINT8 fnsPadd[4]; 1131060ff233Sopenharmony_ci}; 1132060ff233Sopenharmony_ci 1133060ff233Sopenharmony_ci/** 1134060ff233Sopenharmony_ci * Provides the keep alive statistics. 1135060ff233Sopenharmony_ci */ 1136060ff233Sopenharmony_cistruct FillpKeepAliveStastics { 1137060ff233Sopenharmony_ci FILLP_LLONG lastRecvTime; /* Indicates the last receive time. */ 1138060ff233Sopenharmony_ci FILLP_LLONG lastDataRecvTime; /* Indicates the last data receive time. */ 1139060ff233Sopenharmony_ci FILLP_LLONG lastSendTime; /* Indicates the last send time. */ 1140060ff233Sopenharmony_ci}; 1141060ff233Sopenharmony_ci 1142060ff233Sopenharmony_ci/** 1143060ff233Sopenharmony_ci * Provides the debug pcb statistics. 1144060ff233Sopenharmony_ci */ 1145060ff233Sopenharmony_cistruct FillpStatatisticsDebugPcb { 1146060ff233Sopenharmony_ci FILLP_LLONG packRecvedTimeInterval; /* Indicates the packet received time interval. */ 1147060ff233Sopenharmony_ci FILLP_LLONG curPackDeltaUs; 1148060ff233Sopenharmony_ci FILLP_INT multiRetry; /* Indicates multiple retries. */ 1149060ff233Sopenharmony_ci FILLP_INT retryOne; /* Indicates one time retry. */ 1150060ff233Sopenharmony_ci FILLP_INT retryThreeTimes; /* Indicates three times retry. */ 1151060ff233Sopenharmony_ci FILLP_INT retryFourthTimes; /* Indicates four times retry. */ 1152060ff233Sopenharmony_ci FILLP_INT retryMore; /* Indicates more retry. */ 1153060ff233Sopenharmony_ci FILLP_INT maxRetry; /* Indicates the maximum retry. */ 1154060ff233Sopenharmony_ci FILLP_UINT32 connReqSend; /* Indicates the connection request send. */ 1155060ff233Sopenharmony_ci FILLP_UINT32 connReqFailed; /* Indicates the connection request failed. */ 1156060ff233Sopenharmony_ci FILLP_UINT32 connReqAckSend; /* Indicates the connection request ACK send. */ 1157060ff233Sopenharmony_ci FILLP_UINT32 connReqAckFailed; /* Indicates the connection request ACK failed. */ 1158060ff233Sopenharmony_ci FILLP_UINT32 connConfirmSend; /* Indicates the connection confirm request send. */ 1159060ff233Sopenharmony_ci FILLP_UINT32 connConfirmFailed; /* Indicates the connection confirm request failed. */ 1160060ff233Sopenharmony_ci FILLP_UINT32 connConfirmAckSend; /* Indicates the connection confirm request ACK send. */ 1161060ff233Sopenharmony_ci FILLP_UINT32 connConfirmAckFailed; /* Indicates the connection confirm request ACK failed. */ 1162060ff233Sopenharmony_ci FILLP_UINT32 disconnReqSend; /* Indicates the disconnection request send. */ 1163060ff233Sopenharmony_ci FILLP_UINT32 disconnReqFailed; /* Indicates the disconnection request failed. */ 1164060ff233Sopenharmony_ci FILLP_UINT32 disconnRspSend; /* Indicates the disconnection response send. */ 1165060ff233Sopenharmony_ci FILLP_UINT32 disconnRspFailed; /* Indicates the disconnection response failed. */ 1166060ff233Sopenharmony_ci FILLP_UINT32 keepAliveProbeReqSend; /* Indicates the keep alive probe request send. */ 1167060ff233Sopenharmony_ci FILLP_UINT32 keepAliveProbeReqFailed; /* Indicates the keep alive probe request failed. */ 1168060ff233Sopenharmony_ci FILLP_UINT32 keepAliveProbeRspSend; /* Indicates the keep alive probe response send. */ 1169060ff233Sopenharmony_ci FILLP_UINT32 keepAliveProbeRspFailed; /* Indicates the keep alive probe response failed. */ 1170060ff233Sopenharmony_ci FILLP_UINT32 nackSend; /* Indicates the NACK send. */ 1171060ff233Sopenharmony_ci FILLP_UINT32 nackFailed; /* Indicates the NACK failed. */ 1172060ff233Sopenharmony_ci FILLP_UINT32 nackRcv; /* Indicates the NACK received. */ 1173060ff233Sopenharmony_ci FILLP_UINT32 packSend; /* Indicates the packet send. */ 1174060ff233Sopenharmony_ci FILLP_UINT32 packFailed; /* Indicates the packet failed. */ 1175060ff233Sopenharmony_ci FILLP_UINT32 packRcv; /* Indicates the packet received. */ 1176060ff233Sopenharmony_ci FILLP_UINT32 nackPktNum; /* Indicates the NACK packet number. */ 1177060ff233Sopenharmony_ci FILLP_UINT32 packIntervalPktNum; /* Indicates the packet number of the packet interval. */ 1178060ff233Sopenharmony_ci FILLP_UINT32 packIntervalSendBytes; /* Indicates the send bytes of the packet interval. */ 1179060ff233Sopenharmony_ci FILLP_UINT32 packIntervalSendPkt; /* Indicates the send packets of the packet interval. */ 1180060ff233Sopenharmony_ci FILLP_UINT8 onePktMaxSendCount; /* Indicates the maximum send count for one packet. */ 1181060ff233Sopenharmony_ci FILLP_UINT8 fsdpPadd[3]; 1182060ff233Sopenharmony_ci}; 1183060ff233Sopenharmony_ci 1184060ff233Sopenharmony_ci/** 1185060ff233Sopenharmony_ci * Provides the traffic statistics. 1186060ff233Sopenharmony_ci */ 1187060ff233Sopenharmony_cistruct FillpStatisticsTraffic { 1188060ff233Sopenharmony_ci FILLP_UINT32 totalRecved; /* Indicates the total packet received. */ 1189060ff233Sopenharmony_ci FILLP_UINT32 totalRecvedBytes; /* Indicates the total received bytes. */ 1190060ff233Sopenharmony_ci FILLP_UINT32 totalDroped; /* Indicates the total packets dropped. */ 1191060ff233Sopenharmony_ci FILLP_UINT32 totalRetryed; /* Indicates the total packets retried. */ 1192060ff233Sopenharmony_ci FILLP_UINT32 totalSendFailed; /* Indicates the total packet send failed. */ 1193060ff233Sopenharmony_ci FILLP_UINT32 totalSend; /* Indicates the total packets sent. */ 1194060ff233Sopenharmony_ci FILLP_UINT32 totalSendBytes; /* Indicates the total sent bytes. */ 1195060ff233Sopenharmony_ci FILLP_UINT32 totalOutOfOrder; /* Indicates the total packets out of order. */ 1196060ff233Sopenharmony_ci FILLP_UINT32 totalRecvLost; /* Indicates the total packet receive lost. */ 1197060ff233Sopenharmony_ci FILLP_UINT32 packSendBytes; /* Indicates the total sent bytes. */ 1198060ff233Sopenharmony_ci FILLP_UINT32 packExpSendBytes; /* Indicates the total sent bytes. */ 1199060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 1200060ff233Sopenharmony_ci FILLP_UINT8 padd1[4]; 1201060ff233Sopenharmony_ci#endif 1202060ff233Sopenharmony_ci}; 1203060ff233Sopenharmony_ci 1204060ff233Sopenharmony_ci#define FILLP_NACK_HISTORY_NUM 10 1205060ff233Sopenharmony_ci#define FILLP_NACK_HISTORY_ARR_NUM 2 1206060ff233Sopenharmony_cistruct FillpNackHistory { 1207060ff233Sopenharmony_ci FILLP_UINT32 lostPktGap; 1208060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 1209060ff233Sopenharmony_ci FILLP_UINT8 padd[4]; 1210060ff233Sopenharmony_ci#endif 1211060ff233Sopenharmony_ci FILLP_LLONG timestamp; 1212060ff233Sopenharmony_ci}; 1213060ff233Sopenharmony_ci 1214060ff233Sopenharmony_cistruct FillpNackHistoryStastics { 1215060ff233Sopenharmony_ci struct FillpNackHistory nackHistoryArr[FILLP_NACK_HISTORY_NUM]; 1216060ff233Sopenharmony_ci FILLP_UINT32 nackHistoryNum; 1217060ff233Sopenharmony_ci FILLP_UINT16 pktLoss; 1218060ff233Sopenharmony_ci#ifdef FILLP_64BIT_ALIGN 1219060ff233Sopenharmony_ci FILLP_UINT8 padd64[2]; 1220060ff233Sopenharmony_ci#endif 1221060ff233Sopenharmony_ci FILLP_UINT32 historyMinLostPktGap[FILLP_NACK_HISTORY_ARR_NUM]; /* 0: by time, 1: by all the member */ 1222060ff233Sopenharmony_ci FILLP_UINT32 historyAvgLostPktGap[FILLP_NACK_HISTORY_ARR_NUM]; 1223060ff233Sopenharmony_ci FILLP_UINT32 historyMaxLostPktGap[FILLP_NACK_HISTORY_ARR_NUM]; 1224060ff233Sopenharmony_ci}; 1225060ff233Sopenharmony_ci 1226060ff233Sopenharmony_cistruct FillAppFcStastics { 1227060ff233Sopenharmony_ci FILLP_LLONG periodTimePassed; 1228060ff233Sopenharmony_ci FILLP_LLONG periodRecvBits; 1229060ff233Sopenharmony_ci FILLP_UINT32 pktNum; 1230060ff233Sopenharmony_ci FILLP_UINT32 periodRecvPkts; 1231060ff233Sopenharmony_ci FILLP_UINT32 periodRecvPktLoss; 1232060ff233Sopenharmony_ci FILLP_UINT32 periodRecvRate; /* kbps */ 1233060ff233Sopenharmony_ci FILLP_ULLONG periodRecvRateBps; /* bps */ 1234060ff233Sopenharmony_ci FILLP_UINT32 periodRtt; /* ms */ 1235060ff233Sopenharmony_ci FILLP_UINT32 periodRecvPktLossHighPrecision; /* for example when lost rate is 1.10%, then 110 will returned */ 1236060ff233Sopenharmony_ci FILLP_UINT32 periodSendLostPkts; 1237060ff233Sopenharmony_ci FILLP_UINT32 periodSendPkts; 1238060ff233Sopenharmony_ci FILLP_UINT32 periodSendPktLossHighPrecision; /* for example when lost rate is 1.10%, then 110 will returned */ 1239060ff233Sopenharmony_ci FILLP_ULLONG periodSendBits; 1240060ff233Sopenharmony_ci FILLP_ULLONG periodSendRateBps; /* bps */ 1241060ff233Sopenharmony_ci}; 1242060ff233Sopenharmony_ci 1243060ff233Sopenharmony_ci/** 1244060ff233Sopenharmony_ci * Provides the pcb statistics. 1245060ff233Sopenharmony_ci */ 1246060ff233Sopenharmony_cistruct FillpStatisticsPcb { 1247060ff233Sopenharmony_ci struct FillpPackStastics pack; /* Indicates the packet statistics. */ 1248060ff233Sopenharmony_ci struct FillpKeepAliveStastics keepAlive; /* Indicates the keep alive statistics. */ 1249060ff233Sopenharmony_ci struct FillpStatatisticsDebugPcb debugPcb; /* Indicates the debug pcb statistics. */ 1250060ff233Sopenharmony_ci struct FillpStatisticsTraffic traffic; /* Indicates the traffic statistics. */ 1251060ff233Sopenharmony_ci struct FillpNackStastics nack; /* Indicates the NACK statistics. */ 1252060ff233Sopenharmony_ci struct FillpNackHistoryStastics nackHistory; /* Indicates the NACK history. */ 1253060ff233Sopenharmony_ci struct FillAppFcStastics appFcStastics; /* Indicates the app fc statistics. */ 1254060ff233Sopenharmony_ci}; 1255060ff233Sopenharmony_ci 1256060ff233Sopenharmony_ci/** 1257060ff233Sopenharmony_ci * @ingroup fillp_stastics_api 1258060ff233Sopenharmony_ci * @brief This function is called by the fillp Adapter to get the statistics information for a each type. 1259060ff233Sopenharmony_ci * 1260060ff233Sopenharmony_ci * @param[in] fd Indicates the socket index for which stats need to be provided. 1261060ff233Sopenharmony_ci * @param[out] outStats Indicates fillp_statistics_pc, to which statistics are copied. 1262060ff233Sopenharmony_ci * @return Success: ERR_OK 1263060ff233Sopenharmony_ci * Fail: Error code 1264060ff233Sopenharmony_ci * The following table provides information about the errors set by this API. 1265060ff233Sopenharmony_ci */ 1266060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtFillpStatsGet(IN FILLP_INT fd, OUT struct FillpStatisticsPcb *outStats); 1267060ff233Sopenharmony_ci 1268060ff233Sopenharmony_ci 1269060ff233Sopenharmony_ci/** 1270060ff233Sopenharmony_ci * @ingroup fillp_stastics_api 1271060ff233Sopenharmony_ci * @brief This function is called by the FillP adapter to to show the statistics information. 1272060ff233Sopenharmony_ci * 1273060ff233Sopenharmony_ci * @param[in] fillpStatsType Indicates the statistics type. 1274060ff233Sopenharmony_ci * @param[in] fd Indicates the socket index. 1275060ff233Sopenharmony_ci * @return On Success : ERR_OK 1276060ff233Sopenharmony_ci * On Failure : Error code 1277060ff233Sopenharmony_ci * The following table provides information about the errors set by this API. 1278060ff233Sopenharmony_ci */ 1279060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtFillpStatShow(IN FILLP_UINT32 fillpStatsType, IN FILLP_INT fd); 1280060ff233Sopenharmony_ci 1281060ff233Sopenharmony_ci 1282060ff233Sopenharmony_ci/** 1283060ff233Sopenharmony_ci * @ingroup FillPSocketInterfaces 1284060ff233Sopenharmony_ci * @brief 1285060ff233Sopenharmony_ci * This function gives the error values. If any FillP API fails, then there will be errno set by FillP/VTP. 1286060ff233Sopenharmony_ci * User can retrieve the errno by calling FtGetErrno() 1287060ff233Sopenharmony_ci * 1288060ff233Sopenharmony_ci * @param None 1289060ff233Sopenharmony_ci * @par Error Numbers 1290060ff233Sopenharmony_ci * The following table provides information about the errno set by FillP/VTP. 1291060ff233Sopenharmony_ci 1292060ff233Sopenharmony_ci * @return This API does not set any errors. 1293060ff233Sopenharmony_ci */ 1294060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtGetErrno(void); 1295060ff233Sopenharmony_ci 1296060ff233Sopenharmony_ci/** 1297060ff233Sopenharmony_ci * @ingroup FillP/VTP Stack Interfaces 1298060ff233Sopenharmony_ci * @brief 1299060ff233Sopenharmony_ci * Returns rtt in microseconds which was calculated while setting up the connection 1300060ff233Sopenharmony_ci * for the sockFd socket. 1301060ff233Sopenharmony_ci * 1302060ff233Sopenharmony_ci * @param[in] fd Indicates the socket index. 1303060ff233Sopenharmony_ci * @return 1304060ff233Sopenharmony_ci * On Success : calculated rtt value as a unsigned long long value 1305060ff233Sopenharmony_ci * On Failure : FILLP_NULL 1306060ff233Sopenharmony_ci * The following table provides information about the errors set by this API. 1307060ff233Sopenharmony_ci */ 1308060ff233Sopenharmony_ciextern FILLP_ULLONG DLL_API FtGetRtt(FILLP_INT fd); 1309060ff233Sopenharmony_ci 1310060ff233Sopenharmony_ci 1311060ff233Sopenharmony_ci/** 1312060ff233Sopenharmony_ci * @ingroup fillp_stack_api 1313060ff233Sopenharmony_ci * @brief 1314060ff233Sopenharmony_ci * This function is called to get the current stack time in FillP/VTP. 1315060ff233Sopenharmony_ci * 1316060ff233Sopenharmony_ci * @param[in] instInx Indicates the instance index to check. 1317060ff233Sopenharmony_ci * @return 1318060ff233Sopenharmony_ci * FILLP_ULLONG - Last time updated of stack. This API does not set any errors. 1319060ff233Sopenharmony_ci */ 1320060ff233Sopenharmony_ciextern FILLP_ULLONG DLL_API FtGetStackTime(FILLP_INT instInx); 1321060ff233Sopenharmony_ci 1322060ff233Sopenharmony_citypedef char *FILLP_CHAR_PTR; 1323060ff233Sopenharmony_ci/** 1324060ff233Sopenharmony_ci * @ingroup fillp_stack_api 1325060ff233Sopenharmony_ci * @brief Gets the FillP version string. 1326060ff233Sopenharmony_ci * 1327060ff233Sopenharmony_ci * @return FILLP_CHAR* - Version string. User must not free this pointer. This API does not set any errors. 1328060ff233Sopenharmony_ci */ 1329060ff233Sopenharmony_ciextern FILLP_CHAR_PTR DLL_API FtGetVersion(void); 1330060ff233Sopenharmony_ci/** 1331060ff233Sopenharmony_ci * @ingroup fillpconfig 1332060ff233Sopenharmony_ci * @brief Gets individual FillP stack configuration items. 1333060ff233Sopenharmony_ci * 1334060ff233Sopenharmony_ci * @param[in] name Specifies the name of the configuration item to configure (FILLP_CONFIG_LIST enum). 1335060ff233Sopenharmony_ci * @param[out] value Contains the value for the configuration item. 1336060ff233Sopenharmony_ci * @param[in] param Contains the value for the configuration item, which requires additional information to config. 1337060ff233Sopenharmony_ci * @par The following table provides configuration information: 1338060ff233Sopenharmony_ci * @return 1339060ff233Sopenharmony_ci * ERR_OK on success 1340060ff233Sopenharmony_ci * Error codes on failure. 1341060ff233Sopenharmony_ci * Error reason is returned by the return value. 1342060ff233Sopenharmony_ci */ 1343060ff233Sopenharmony_ciextern FILLP_INT32 DLL_API FtConfigGet(IN FILLP_UINT32 name, IO void *value, IN FILLP_CONST void *param); 1344060ff233Sopenharmony_ci/** 1345060ff233Sopenharmony_ci * @ingroup fillpconfig 1346060ff233Sopenharmony_ci * @brief Sets individual FillP stack configuration items. 1347060ff233Sopenharmony_ci * 1348060ff233Sopenharmony_ci * @param[in] name Indicates the name of the configuration item to configure. 1349060ff233Sopenharmony_ci * @param[in] value Contains the value for the configuration item. 1350060ff233Sopenharmony_ci * @param[in] param Contains the value for the configuration item, which requires additional information to configure. 1351060ff233Sopenharmony_ci * @par The following table provides configuration information: 1352060ff233Sopenharmony_ci * @return 1353060ff233Sopenharmony_ci * ERR_OK on success 1354060ff233Sopenharmony_ci * Error codes on failure. 1355060ff233Sopenharmony_ci * Error reason is returned by the return value. 1356060ff233Sopenharmony_ci */ 1357060ff233Sopenharmony_ciextern FILLP_INT32 DLL_API FtConfigSet(IN FILLP_UINT32 name, IN FILLP_CONST void *value, 1358060ff233Sopenharmony_ci IN FILLP_CONST void *param); 1359060ff233Sopenharmony_ci 1360060ff233Sopenharmony_ci 1361060ff233Sopenharmony_cistruct FillpCurrentSendCacheInf { 1362060ff233Sopenharmony_ci FILLP_UINT32 currentSendCacheSize; /* Indicates the total allocated size of send cache. */ 1363060ff233Sopenharmony_ci FILLP_UINT32 currentDataSizeInCache; /* Indicates the size of the pending data to be sent. */ 1364060ff233Sopenharmony_ci}; 1365060ff233Sopenharmony_ci 1366060ff233Sopenharmony_ci/** 1367060ff233Sopenharmony_ci * @ingroup fillpevt 1368060ff233Sopenharmony_ci * @brief Register the event callback function on the socket. 1369060ff233Sopenharmony_ci * 1370060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by the FtSocket API. 1371060ff233Sopenharmony_ci * @param[in] evtCbkFunc Pointer to event callback function FillpEvtCbkFunc. 1372060ff233Sopenharmony_ci * @return 1373060ff233Sopenharmony_ci * On Success : returns 0 1374060ff233Sopenharmony_ci * On Failure : returns -1 1375060ff233Sopenharmony_ci */ 1376060ff233Sopenharmony_ciFILLP_INT DLL_API FtApiRegEventCallbackFunc(IN FILLP_INT fd, IN FillpEvtCbkFunc evtCbkFunc); 1377060ff233Sopenharmony_ci 1378060ff233Sopenharmony_ci/** 1379060ff233Sopenharmony_ci * @ingroup fillpevt 1380060ff233Sopenharmony_ci * @brief unregister the event callback function on the socket. 1381060ff233Sopenharmony_ci * 1382060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by the FtSocket API. 1383060ff233Sopenharmony_ci * @param[in] evtCbkFunc Pointer to event callback function FillpEvtCbkFunc. 1384060ff233Sopenharmony_ci * @return 1385060ff233Sopenharmony_ci * On Success : returns 0 1386060ff233Sopenharmony_ci * On Failure : returns -1 1387060ff233Sopenharmony_ci */ 1388060ff233Sopenharmony_ciFILLP_INT DLL_API FtApiUnregEventCallbackFunc(IN FILLP_INT fd, IN FillpEvtCbkFunc evtCbkFunc); 1389060ff233Sopenharmony_ci 1390060ff233Sopenharmony_ci/** 1391060ff233Sopenharmony_ci * @ingroup fillpevt 1392060ff233Sopenharmony_ci * @brief Get the event info on the socket. 1393060ff233Sopenharmony_ci * 1394060ff233Sopenharmony_ci * @param[in] fd Indicates a socket created by the FtSocket API. 1395060ff233Sopenharmony_ci * @param[in/out] info Pointer to event callback information FtEventCbkInfo. 1396060ff233Sopenharmony_ci * @return 1397060ff233Sopenharmony_ci * On Success : returns 0 1398060ff233Sopenharmony_ci * On Failure : returns -1 1399060ff233Sopenharmony_ci */ 1400060ff233Sopenharmony_ciFILLP_INT DLL_API FtApiEventInfoGet(IN FILLP_INT fd, IO FtEventCbkInfo *info); 1401060ff233Sopenharmony_ci 1402060ff233Sopenharmony_ci/** 1403060ff233Sopenharmony_ci * @ingroup fillpevt 1404060ff233Sopenharmony_ci * @brief register dfx event callback function 1405060ff233Sopenharmony_ci * 1406060ff233Sopenharmony_ci * @param[in] softObj any useful message to evtCb 1407060ff233Sopenharmony_ci * @param[in] func event callback function 1408060ff233Sopenharmony_ci * @return 1409060ff233Sopenharmony_ci * On Success : returns 0 1410060ff233Sopenharmony_ci * On Failure : returns -1 1411060ff233Sopenharmony_ci */ 1412060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtSetDfxEventCb(void *softObj, FillpDfxEventCb evtCb); 1413060ff233Sopenharmony_ci 1414060ff233Sopenharmony_ci/** 1415060ff233Sopenharmony_ci * @ingroup fillpevt 1416060ff233Sopenharmony_ci * @brief deal with HiDumper cmd 1417060ff233Sopenharmony_ci * 1418060ff233Sopenharmony_ci * @param[in] argc arg number 1419060ff233Sopenharmony_ci * @param[in] argv arg value 1420060ff233Sopenharmony_ci * @param[in] softObj any useful message to dump 1421060ff233Sopenharmony_ci * @param[in] dump function to printf data 1422060ff233Sopenharmony_ci * @return 1423060ff233Sopenharmony_ci * On Success : returns 0 1424060ff233Sopenharmony_ci * On Failure : returns -1 1425060ff233Sopenharmony_ci */ 1426060ff233Sopenharmony_ciextern FILLP_INT DLL_API FtDfxHiDumper(FILLP_UINT32 argc, const FILLP_CHAR **argv, 1427060ff233Sopenharmony_ci void *softObj, FillpDfxDumpFunc dump); 1428060ff233Sopenharmony_ci 1429060ff233Sopenharmony_ci#pragma pack(pop) 1430060ff233Sopenharmony_ci 1431060ff233Sopenharmony_ci#ifdef __cplusplus 1432060ff233Sopenharmony_ci} 1433060ff233Sopenharmony_ci#endif 1434060ff233Sopenharmony_ci 1435060ff233Sopenharmony_ci#endif /* _FILLP_API_INC_H_ */ 1436060ff233Sopenharmony_ci 1437