#include "TUTKGlobalAPIs.h"
Data Structures | |
struct | st_RDT_Status |
Functions | |
RDTAPI_API_DEPRECATED int32_t | RDT_GetRDTApiVer () |
Get the version of RDT module. | |
const char * | RDT_GetRDTApiVersionString (void) |
Get the version of RDT module. | |
void | RDT_Set_Max_Channel_Number (uint32_t nMaxChannelNum) |
Set the max number of RDT channels. | |
int32_t | RDT_Initialize () |
Initialize RDT module. | |
int32_t | RDT_DeInitialize () |
Deinitialize RDT module. | |
RDTAPI_API_DEPRECATED int32_t | RDT_Create (int32_t nIOTCSessionID, int32_t nTimeout, uint8_t nIOTCChannelID) |
Create a RDT channel. | |
int32_t | RDT_Create_Exit (int32_t nIOTCSessionID, uint8_t nIOTCChannelID) |
Exit the process of a specific RDT channel create. | |
int32_t | RDT_Destroy (int32_t nRDTChannelID) |
Destroy a RDT channel. | |
int32_t | RDT_Abort (int32_t nRDTChannelID) |
Abort a RDT channel. | |
int32_t | RDT_Set_Max_SendBuffer_Size (int32_t nRDTChannelID, int32_t nMaxSendBufferSize) |
Set max send queue buffer size. | |
int32_t | RDT_Flush (int32_t nRDTChannelID) |
Flush data in an RDT channel. | |
int32_t | RDT_Write (int32_t nRDTChannelID, const char *cabBuf, int32_t nBufSize) |
Write data through a RDT channel. | |
int32_t | RDT_Read (int32_t nRDTChannelID, char *abBuf, int32_t nBufSize, int32_t nTimeout) |
Read data through a RDT channel. | |
int32_t | RDT_Status_Check (int32_t nRDTChannelID, struct st_RDT_Status *psRDT_Status) |
Get status of a RDT channel. | |
void | RDT_Set_Log_Path (const char *path, int32_t nMaxSize) |
Set path of log file. | |
int32_t | RDT_Set_Log_Attr (LogAttr logAttr) |
Set Attribute of log file. | |
int32_t | RDT_Set_Max_Pending_ACK_Number (int32_t nRDTChannelID, uint32_t nMaxNumber) |
Set the max number of pending ACKs of the RDT channel. | |
int32_t | RDT_Set_MaxPacketDataSize (uint32_t nMaxSize) |
Set the max packet data size of a single RDT packet. | |
This file describes all the APIs of the RDT module in IOTC platform.
#define MAX_DEFAULT_RDT_CHANNEL_NUMBER 128 |
#define RDT_ER_ALREADY_INITIALIZED -10001 |
RDT module is already initialized. It is not necessary to re-initialize.
#define RDT_ER_CHANNEL_OCCUPIED -10012 |
The specific IOTC session and channel ID is used now so can't use the same resource. You can choose other IOTC channel for RDT use or wait RDT_Abort() to release resource automatically.
#define RDT_ER_CREATE_DTLS_FAIL -10021 |
RDT fails to create safe channel
#define RDT_ER_DEINITIALIZING -10019 |
RDT module is currently deinitializing. It is not necessary to re-deinitialize.
#define RDT_ER_EXCEED_MAX_CHANNEL -10002 |
The number of RDT channels has reached maximum. Please use RDT_Set_Max_Channel_Number() to set up the max number of RDT channels. By default, the maximum channel number is MAX_DEFAULT_RDT_CHANNEL_NUMBER.
#define RDT_ER_FAIL_CREATE_MUTEX -10005 |
RDT module fails to create Mutexs when doing initialization. Please check if OS has sufficient Mutexs for RDT module.
#define RDT_ER_FAIL_CREATE_THREAD -10004 |
RDT module fails to create threads. Please check if OS has ability to create threads for RDT module.
#define RDT_ER_FAIL_INITIALIZE_DTLS -10020 |
RDT fails to initialize DTLS module.
#define RDT_ER_INVALID_ARG -10014 |
The arguments passed to a function is invalid.
#define RDT_ER_INVALID_RDT_ID -10008 |
The specified RDT channel ID is valid
#define RDT_ER_LOCAL_ABORT -10011 |
The local site called RDT_Abort() so the RDT channel is already not available.
#define RDT_ER_LOCAL_EXIT -10015 |
The local site called RDT_Create_Exit() so the RDT channel exit creating.
#define RDT_ER_LOCAL_NOT_SUPPORT_DTLS -10024 |
Remote RDT need connect with DTLS
#define RDT_ER_MEM_INSUFF -10003 |
Insufficient memory for allocation
#define RDT_ER_NO_PERMISSION -10013 |
This is a lite UID and it does not support RDT module.
#define RDT_ER_NoERROR 0 |
The function is performed successfully.
#define RDT_ER_NOT_INITIALIZED -10000 |
RDT module is not initialized yet. Please use RDT_Initialize() for initialization.
#define RDT_ER_OPERATION_IS_INVALID -10022 |
The API operation is invalid
#define RDT_ER_RCV_DATA_END -10009 |
The remote site has finished sending data, then destroy the RDT channel. The local site will get this error code by RDT_Read() when there is no more data from this RDT channel.
#define RDT_ER_RDT_DESTROYED -10006 |
RDT channel has been destroyed. Probably caused by local or remote site calls RDT_Destroy(), or remote site has closed IOTC session.
#define RDT_ER_REMOTE_ABORT -10010 |
The remote site want to abort the RDT channel immediately and don't care data transmission. The local site will get this error code by RDT_Read(), RDT_Write(), RDT_Destroy() for handling this RDT channel to close.
#define RDT_ER_REMOTE_EXIT -10016 |
The remote site called RDT_Create_Exit() so the RDT channel exit creating.
#define RDT_ER_REMOTE_NOT_SUPPORT_DTLS -10023 |
Remote RDT not support DTLS
#define RDT_ER_SEND_BUFFER_FULL -10017 |
The RDT write buffer is full. Try again after min 1ms this Error code only return when RDT_Set_Max_SendBuff_Size is be set.
#define RDT_ER_TIMEOUT -10007 |
The specified timeout has expired during the execution of some RDT module service. For most cases, it is caused by slow response of remote site or network connection issues
#define RDT_ER_UNCLOSED_CONNECTION_DETECTED -10018 |
All RDT connection should call RDT_Abort or RDT_Destroy before doing RDT_Deinitialize
#define RDTAPI_API __declspec(dllimport) |
#define RDTAPI_API_DEPRECATED |
int32_t RDT_Abort | ( | int32_t | nRDTChannelID | ) |
Abort a RDT channel.
This function will abort the RDT channel connection specified by a channel ID
nRDTChannelID | [in] The channel ID of the RDT channel to abort |
RDTAPI_API_DEPRECATED int32_t RDT_Create | ( | int32_t | nIOTCSessionID, |
int32_t | nTimeout, | ||
uint8_t | nIOTCChannelID | ||
) |
Create a RDT channel.
This function will create a RDT channel based on specified IOTC channel
nIOTCSessionID | [in] The session ID of the IOTC session to create RDT channel |
nTimeout | [in] The timeout for this function in unit of million-second. Specify it as 0 will make this function block forever until a RDT channel is successfully created or error happens |
nIOTCChannelID | [in] The channel ID of the IOTC channel to create RDT channel |
int32_t RDT_Create_Exit | ( | int32_t | nIOTCSessionID, |
uint8_t | nIOTCChannelID | ||
) |
Exit the process of a specific RDT channel create.
This function will create a RDT channel based on specified IOTC channel
nIOTCSessionID | [in] The session ID argument passed to call RDT_Create() |
nIOTCChannelID | [in] The channel ID argument passed to call RDT_Create() |
int32_t RDT_DeInitialize | ( | ) |
Deinitialize RDT module.
This function will deinitialize RDT module.
int32_t RDT_Destroy | ( | int32_t | nRDTChannelID | ) |
Destroy a RDT channel.
This function will destroy the RDT channel specified by a channel ID
nRDTChannelID | [in] The channel ID of the RDT channel to destroy |
int32_t RDT_Flush | ( | int32_t | nRDTChannelID | ) |
Flush data in an RDT channel.
Called by a RDT server or a RDT client to flush data in the buffer, otherwise RDT may wait until data can fill out the whole packet
nRDTChannelID | [in] The channel ID of the RDT channel to write data |
RDTAPI_API_DEPRECATED int32_t RDT_GetRDTApiVer | ( | ) |
Get the version of RDT module.
This function returns the version of RDT module
const char* RDT_GetRDTApiVersionString | ( | void | ) |
Get the version of RDT module.
This function returns the version of RDT module
int32_t RDT_Initialize | ( | ) |
Initialize RDT module.
This function is used by RDT servers or RDT clients to initialize RDT module and shall be called before any RDT module related function is invoked, except RDT_Set_Max_Channel_Number().
int32_t RDT_Read | ( | int32_t | nRDTChannelID, |
char * | abBuf, | ||
int32_t | nBufSize, | ||
int32_t | nTimeout | ||
) |
Read data through a RDT channel.
Called by a RDT server or a RDT client to read data through a specified RDT channel from the other.
nRDTChannelID | [in] The channel ID of the RDT channel to read data |
abBuf | [out] The array of byte buffer to receive read result |
nBufSize | [in] The maximum length of the byte buffer |
nTimeout | [in] The timeout for this function in unit of million-second |
int32_t RDT_Set_Log_Attr | ( | LogAttr | logAttr | ) |
Set Attribute of log file.
logAttr | [in] See LogAttr |
void RDT_Set_Log_Path | ( | const char * | path, |
int32_t | nMaxSize | ||
) |
Set path of log file.
Set the absolute path of log file
path | [in] The path of log file, NULL = disable Log |
nMaxSize | [in] The maximum size of log file in Bytes, 0 = unlimit |
void RDT_Set_Max_Channel_Number | ( | uint32_t | nMaxChannelNum | ) |
Set the max number of RDT channels.
This function set the max number of allowable RDT channels. The max number of RDT channels limits the max number of RDT channels that a RDT server can establish with multiple RDT clients from RDT server's point of view, while it limits the max number of RDT channels that a RDT client can establish with multiple RDT servers from RDT client's point of view. A RDT server or a RDT client could use this function to reduce the number of RDT channels in order to save some memory usage.
nMaxChannelNum | [in] The max number of RDT channels |
int32_t RDT_Set_Max_Pending_ACK_Number | ( | int32_t | nRDTChannelID, |
uint32_t | nMaxNumber | ||
) |
Set the max number of pending ACKs of the RDT channel.
This function is related to the frequency of sending RDT ACK, set 0 to nMaxNumber if you want to force RDT to send ACK immediately, it might consume more CPU resource and network bandwidth, but it might improve the performance of RDT data transmission; 0 is the default value of nMaxNumber, we suggest not to use the number bigger than 80
nRDTChannelID | [in] The channel ID of the RDT channel to get status |
nMaxNumber | [in] The max pending number of RDT ACK of the RDT channel |
int32_t RDT_Set_Max_SendBuffer_Size | ( | int32_t | nRDTChannelID, |
int32_t | nMaxSendBufferSize | ||
) |
Set max send queue buffer size.
Limit the send queue buffer size, when the buffer is full RDT_Write will return RDT_ER_SEND_BUFFER_FULL
nRDTChannelID | [in] The channel ID of the RDT channel |
nMaxSendBufferSize | [in] The maximum size of send queue buffer |
int32_t RDT_Set_MaxPacketDataSize | ( | uint32_t | nMaxSize | ) |
Set the max packet data size of a single RDT packet.
This function can set the max packet data size of a RDT packet. By default, the max data size of RDT is 1280. For some situation, the MTU size might be smaller than default value. User can adjust the max RDT packet data size by this function.
nMaxSize | [in] The max packet size of a single RDT packet. |
int32_t RDT_Status_Check | ( | int32_t | nRDTChannelID, |
struct st_RDT_Status * | psRDT_Status | ||
) |
Get status of a RDT channel.
A RDT server or a RDT client may use this function to get the status of a specified RDT channel
nRDTChannelID | [in] The channel ID of the RDT channel to get status |
psRDT_Status | [out] The status of specified RDT channel |
int32_t RDT_Write | ( | int32_t | nRDTChannelID, |
const char * | cabBuf, | ||
int32_t | nBufSize | ||
) |
Write data through a RDT channel.
Called by a RDT server or a RDT client to write data through a specified RDT channel to the other. RDT_Write might not send small size data directly, if you need to write small size data directly you can call RDT_Flush after RDT_Write
nRDTChannelID | [in] The channel ID of the RDT channel to write data |
cabBuf | [in] The array of byte buffer containing the data to write |
nBufSize | [in] The length of the byte buffer |