RD updates
[platform/upstream/iotivity.git] / resource / csdk / resource-directory / include / rd_database.h
1 //******************************************************************
2 //
3 // Copyright 2016 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 #ifndef OC_RESOURCE_DIRECTORY_DATABASE_H_
22 #define OC_RESOURCE_DIRECTORY_DATABASE_H_
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif // __cplusplus
27
28 #ifdef RD_SERVER
29
30 /**
31  * Opens the RD publish database.
32  *
33  * @param path to the database file.
34  *
35  * @return ::OC_STACK_OK in case of success or else other value.
36  */
37 OCStackResult OCRDDatabaseInit(const char *path);
38
39 /**
40  * Stores in database the published resource.
41  *
42  * @param payload is the the published resource payload.
43  * @param address provide information about endpoint connectivity details.
44  *
45  * @return ::OC_STACK_OK in case of success or else other value.
46  */
47 OCStackResult OCRDDatabaseStoreResources(const OCRepPayload *payload, const OCDevAddr *address);
48
49 /**
50  * Search the RD database for queries.
51  *
52  * @param interfaceType is the interface type that is queried.
53  * @param resourceType is the resource type that is queried.
54  * @param discPayload is NULL if no resource found or else OCDiscoveryPayload with the details
55  * about the resource.
56  *
57  * @return ::OC_STACK_OK in case of success or else other value.
58  */
59 OCStackResult OCRDDatabaseCheckResources(const char *interfaceType, const char *resourceType,
60     OCDiscoveryPayload *discPayload);
61
62 /**
63  * Updates the RD resource
64  *
65  * @param deviceId of the device for which resources will be update.
66  *
67  * @return ::OC_STACK_OK in case of success or else other value.
68  */
69 OCStackResult OCRDDatabaseUpdateDevice(const char *deviceId);
70
71 /**
72  * Delete the RD resource
73  *
74  * @param deviceId of the device for which resources will be deleted.
75  *
76  * @return ::OC_STACK_OK in case of success or else other value.
77  */
78 OCStackResult OCRDDatabaseDeleteDevice(const char *deviceId);
79
80 /**
81  * Close the RD publish database.
82  *
83  * @return ::OC_STACK_OK in case of success or else other value.
84  */
85 OCStackResult OCRDDatabaseClose();
86
87 #endif
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif