Merge branch 'tizen' into tizen_5.5
[platform/upstream/iotivity.git] / resource / csdk / routing / include / routingtablemanager_endpoint.h
1 /* ****************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  ******************************************************************/
20
21 /**
22  * @file
23  * This file contains the APIs for routing table manager endpoint.
24  */
25 #ifndef ROUTING_TABLE_MANAGER_ENDPOINT_H_
26 #define ROUTING_TABLE_MANAGER_ENDPOINT_H_
27
28 #ifndef SINGLE_THREAD
29 #include <unistd.h>
30 #include <time.h>
31 #include <sys/time.h>
32 #endif
33
34 #if defined(__ANDROID__)
35 #include <linux/time.h>
36 #endif
37 #include "ulinklist.h"
38 #include "uarraylist.h"
39 #include "octypes.h"
40
41
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46
47 /**
48  * Initialize the Routing Table Manager.
49  * @param[in/out] endpointTable     Endpoint Routing Table.
50  * @return  ::OC_STACK_OK or Appropriate error code.
51  */
52 OCStackResult RTMEndpointInitialize(u_linklist_t **endpointTable);
53
54 /**
55  * Terminates the Routing Table Manager..
56  * @param[in/out] endpointTable     Endpoint Routing Table.
57  * @return  ::OC_STACK_OK or Appropriate error code.
58  */
59 OCStackResult RTMEndpointTerminate(u_linklist_t **endpointTable);
60
61 /**
62  * Frees the endpoint table memory with nodes containing structute RTMEndpointEntry_t.
63  * @param[in/out] endpointTable     Endpoint Routing Table.
64  * @return  ::OC_STACK_OK or Appropriate error code.
65  */
66 OCStackResult RTMFreeEndpointRouteTable(u_linklist_t **endpointTable);
67
68 /**
69  * Adds the endpoint entry to the routing table.
70  * @param[in/out]   endpointId          Endpoint Id.
71  * @param[in]       destAddr            Destination Address.
72  * @param[in/out]   endpointTable       Endpoint Routing Table.
73  * @return  ::OC_STACK_OK or Appropriate error code.
74  */
75 OCStackResult RTMAddEndpointEntry(uint16_t *endpointId, const CAEndpoint_t *destAddr,
76                                   u_linklist_t **endpointTable);
77
78 /**
79  * Removes the endpoint entry from the routing table.
80  * @param[in]       endpointId        Endpoint id of node need to be removed.
81  * @param[in/out]   endpointTable     Endpoint Routing Table.
82  * @return  ::OC_STACK_OK or Appropriate error code.
83  */
84 OCStackResult RTMRemoveEndpointEntry(uint16_t endpointId, u_linklist_t **endpointTable);
85
86 /**
87  * Removes the endpoint nodes.
88  * @param[in/out]   endpointTable           Endpoint Routing Table.
89  * @return  ::OC_STACK_OK or Appropriate error code.
90  */
91 OCStackResult RTMRemoveEndpoints(u_linklist_t **endpointTable);
92
93 /**
94  * Gets endpoint entry
95  * @param[in]       endpointId        Endpoint id of node need to be removed.
96  * @param[in]       endpointTable     Endpoint Routing Table.
97  * @return  Endpoint Destination inteface address.
98  */
99 CAEndpoint_t *RTMGetEndpointEntry(uint16_t endpointId, const u_linklist_t *endpointTable);
100
101 /**
102  * Prints the routing table
103  * @param[in]    endpointTable          Endpoint Routing Table.
104  */
105 void RTMEndpointPrintTable(const u_linklist_t *endpointTable);
106
107 #ifdef __cplusplus
108 } /* extern "C" */
109 #endif
110
111 #endif /* ROUTING_TABLE_MANAGER_ENDPOINT_H_ */