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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 #ifndef _RESOURCE_DIRECTORY_TYPES_H_
21 #define _RESOURCE_DIRECTORY_TYPES_H_
23 #include "ocpayload.h"
29 /** Resource Directory URI used to Discover RD and Publish resources.*/
30 #define OC_RSRVD_RD_URI "/oic/rd"
32 /** To represent resource type with rd.*/
33 #define OC_RSRVD_RESOURCE_TYPE_RD "oic.wk.rd"
35 /** RD Discovery bias factor type. */
36 #define OC_RSRVD_RD_DISCOVERY_SEL "sel"
38 /** To represent resource type with Publish RD.*/
39 #define OC_RSRVD_RESOURCE_TYPE_RDPUBLISH "oic.wk.rdPub"
42 #define MAX_ADDR_STR_SIZE (40)
44 /** Callback function for returning RDDiscovery Result. */
45 typedef int (* OCRDBiasFactorCB)(char addr[MAX_ADDR_STR_SIZE], uint16_t port);
47 /** Context structure used sending it as part of the callback context. */
50 /** Stores the context value of the message sent. */
52 /** Pointing to the callback function that OCRDDiscover() received. */
53 OCRDBiasFactorCB cbFunc;
54 } OCRDClientContextCB;
57 * Structure holding discovery payload.
61 /** Value holding the bias factor of the RD. */
63 } OCRDDiscoveryPayload;
66 * Structure holding RD Links Payload. It is a sub-structure used in
69 typedef struct OCRDLinksPayload
71 /** Web Link Address of the resource. */
73 /** Resource type of the resource. */
75 /** Interace type of the resource. */
77 /** Holding address of the next resource. */
78 struct OCRDLinksPayload *next;
82 * Structure holding RD Publish payload.
87 OCDeviceInfo deviceName;
90 /** Time to keep holding resource.*/
92 /** List of resource information that will be stored at RD.*/
93 OCRDLinksPayload *links;
97 * Enum values of multiple RD type payload.
101 /** Value of the RD discovery payload. */
102 RD_PAYLOAD_TYPE_DISCOVERY,
103 /** Value of the RD publish payload. */
104 RD_PAYLOAD_TYPE_PUBLISH,
105 /** Value of the RD response in the payload. */
106 RD_PAYLOAD_TYPE_RESPONSE
110 * RD Payload that will be transmitted over the wire.
114 /** Used in ocpayload to check type of the packet. This matches other OC payload.*/
116 /** Used internally in RD to check the payload whether discovery or publish.*/
117 OCRDPayloadType payloadType;
118 /** Pointer to the discovery response payload.*/
119 OCRDDiscoveryPayload *rdDiscovery;
120 /** Pointer to the publish payload.*/
121 OCRDPublishPayload *rdPublish;
126 #endif // __cplusplus