1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 * @file caretransmission.h
24 #ifndef __CA_RETRANSMISSION_H_
25 #define __CA_RETRANSMISSION_H_
29 #include "uthreadpool.h"
31 #include "uarraylist.h"
34 /** CA_ETHERNET, CA_WIFI **/
35 #define DEFAULT_RETRANSMISSION_TYPE ((1<<0)|(1<<1))
37 /** default retransmission trying count is 4. **/
38 #define DEFAULT_RETRANSMISSION_COUNT 4
40 /** check period is 1 sec. **/
41 #define RETRANSMISSION_CHECK_PERIOD 1000000
43 /** retransmission data send method type**/
44 typedef CAResult_t (*CADataSendMethod_t)(const CARemoteEndpoint_t *endpoint, void *data,
49 /** retransmission support connectivity type **/
50 CAConnectivityType_t supportType;
51 /** retransmission trying count **/
54 } CARetransmissionConfig_t;
58 /** Thread pool of the thread started **/
59 u_thread_pool_t threadPool;
60 /** mutex for synchrnoization **/
62 /** conditional mutex for synchrnoization **/
64 /** send method for retransmission data **/
65 CADataSendMethod_t dataSendMethod;
66 /** retransmission configure data **/
67 CARetransmissionConfig_t config;
68 /** Variable to inform the thread to stop **/
70 /** array list on which the thread is operating. **/
71 u_arraylist_t* dataList;
79 CAResult_t CARetransmissionInitialize(CARetransmission_t* context, u_thread_pool_t handle,
80 CADataSendMethod_t retransmissionSendMethod, CARetransmissionConfig_t* config);
82 CAResult_t CARetransmissionStart(CARetransmission_t* context);
84 CAResult_t CARetransmissionSentData(CARetransmission_t* context, const CARemoteEndpoint_t* endpoint,
85 const void* pdu, uint32_t size);
87 CAResult_t CARetransmissionReceivedData(CARetransmission_t* context,
88 const CARemoteEndpoint_t* endpoint, const void* pdu, uint32_t size);
90 CAResult_t CARetransmissionStop(CARetransmission_t* context);
92 CAResult_t CARetransmissionDestroy(CARetransmission_t* context);
98 #endif // __CA_RETRANSMISSION_H_