1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 #ifndef _RESOURCE_DIRECTORY_CLIENT_H_
22 #define _RESOURCE_DIRECTORY_CLIENT_H_
31 /** Callback function for returning RDDiscovery Result. */
32 typedef int (* OCRDBiasFactorCB)(char addr[MAX_ADDR_STR_SIZE], uint16_t port);
34 /** Context structure used sending it as part of the callback context. */
37 /** Stores the context value of the message sent. */
39 /** Pointing to the callback function that OCRDDiscover() received. */
40 OCRDBiasFactorCB cbFunc;
41 } OCRDClientContextCB;
44 * Discovers the resource directory.
45 * This function searches a RD server and obtain the bias factor.
47 * @param cbBiasFactor callback function invoked when bias factor is returned by
48 * the Resource Directory Server
50 * @return ::OC_STACK_OK upon success, ::OC_STACK_ERROR in case of error.
52 OCStackResult OCRDDiscover(OCRDBiasFactorCB cbBiasFactor);
55 * Publish resource on the RD.
57 * @param addr The IP address of the RD, it could be either retrieved via OCRDDiscover().
58 * @param port The port of the RD.
59 * @param num This denotes the number of registered resource handles being passed
60 * for the remaining arguments.
62 * @returns ::OC_STACK_OK when successful and OC_STACK_ERROR when query failed.
64 OCStackResult OCRDPublish(char *addr, uint16_t port, int num, ...);
70 #endif //_RESOURCE_DIRECTORY_CLIENT_H_