Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / resource / csdk / routing / include / routingmanagerinterface.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 is an interface of routing manager and resource interospection layer.
24  */
25 #ifndef ROUTING_MANAGER_INTERFACE_H_
26 #define ROUTING_MANAGER_INTERFACE_H_
27
28 #include "routingmanager.h"
29
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif
34
35 /**
36  * Creates a Gateway resource and initializes the observer List.
37  * @return  ::OC_STACK_OK or Appropriate error code.
38  */
39 OCStackResult RMInitGatewayResource();
40
41 /**
42  * Send multicast discover request for the Gateway resource.
43  * @return  ::OC_STACK_OK or Appropriate error code.
44  */
45 OCStackResult RMDiscoverGatewayResource();
46
47 /**
48  * Send observe request for the gateway device hosting the Gateway resource.
49  * @param[in]   devAddr   Device address of the Gateway device hosting
50  *                        the gateway resource.
51  * @param[in]   payload   Payload to be sent with the request.
52  * @return  ::OC_STACK_OK or Appropriate error code.
53  */
54 OCStackResult RMSendObserveRequest(const OCDevAddr *devAddr, OCRepPayload *payload);
55
56 /**
57  * Send delete request to all the neighbor nodes.
58  * @param[in]   devAddr   Device address of the Gateway device hosting
59  *                        the gateway resource.
60  * @param[in]   payload   Payload to be sent with the request.
61  * @return  ::OC_STACK_OK or Appropriate error code.
62  */
63 OCStackResult RMSendDeleteRequest(const OCDevAddr *devAddr, OCRepPayload *payload);
64
65 /**
66  * Send a response for GET/OBSERVE request received for Gateway resource.
67  * @param[in]   request     Request Received.
68  * @param[in]   resource    Resource Handle.
69  * @param[in]   payload     Payload containing Gateway Entries.
70  * @return  ::OC_STACK_OK or Appropriate error code.
71  */
72 OCStackResult RMSendResponse(const OCServerRequest *request, const OCResource *resource,
73                              const OCRepPayload *payload);
74
75 /**
76  * Send notification for list of observers except a particular observer.
77  * @param[in]   obsId     Observer who shouldn't be sent notification.
78  * @param[in]   obsLen    Length of Observer ID list.
79  * @param[in]   payload   Payload containing Gateway Entries.
80  * @return  ::OC_STACK_OK or Appropriate error code.
81  */
82 OCStackResult RMSendNotificationForListofObservers(OCObservationId *obsId, uint8_t obsLen,
83                                                    const OCRepPayload *payload);
84
85 /**
86  * Adds an observer to the RI stack.
87  * @param[in]   request     Request handle.
88  * @param[out]  obsID       Observer ID generated for the requester.
89  * @return  ::OC_STACK_OK or Appropriate error code.
90  */
91 OCStackResult RMAddObserverToStack(const OCServerRequest *request, OCObservationId *obsID);
92
93 #ifdef __cplusplus
94 } /* extern "C" */
95 #endif
96
97 #endif /* ROUTING_MANAGER_INTERFACE_H_ */