RD client features in base layer
[platform/upstream/iotivity.git] / resource / csdk / stack / include / rdpayload.h
index d75cd8e..2afa320 100644 (file)
 extern "C" {
 #endif // __cplusplus
 
+#define OIC_RD_PUBLISH_TTL 86400
+
+#define OIC_RD_DEFAULT_RESOURCE 2
+
+#define DEFAULT_MESSAGE_TYPE "application/json"
+
 /**
  * Converts RD payload from structure to CBOR format. It creates the outPayload
  * which is then transmitted over the wire.
@@ -65,6 +71,21 @@ OCStackResult OCRDCborToPayload(const CborValue *cborPayload, OCPayload **outPay
  */
 OCRDPayload *OCRDPayloadCreate();
 
+#ifdef RD_CLIENT
+/**
+ * Initializes RD Publish payload structure.
+ *
+ * @param resourceHandles The handle of registered resource.
+ * @param nHandles The number of registered resource handles.
+ * @param ttl Time to live of the published resource.
+ *
+ * @return Allocated memory for the OCRDPayload and NULL in case if
+ * failed to allocate memory.
+ */
+OCRDPayload *OCRDPublishPayloadCreate(OCResourceHandle resourceHandles[], uint8_t nHandles,
+                                      uint64_t ttl);
+#endif
+
 /**
  * Initializes RD Discovery payload structure and sets the bias factor.
  *
@@ -89,37 +110,33 @@ void OCRDPayloadDestroy(OCRDPayload *payload);
  * Copies tag paramter to creates OCTagsPayload.
  *
  * @param deviceName The device name as set during enrollment.
- * @param id The device UUID
- * @param baseURI baseURI pointing to the resource directory location.
- * @param bitmap The bitmap value include observe, discovery and secure bit set.
- * @param port The secure port in case above bitmap is set to secure.
- * @param ins Unique value per collection.
- * @param rts Defines allowed resource types.
- * @param drel Defines defaultr relationship.
+ * @param id The device UUID.
  * @param ttl Time to leave for the . Used only in resource directory.
  *
  * @retun Allocated memory for OCTagsPayload or else NULL in case of error.
  */
-OCTagsPayload* OCCopyTagsResources(const char *deviceName, const unsigned char *id,
-    const char *baseURI, uint8_t bitmap, uint16_t port, uint8_t ins, const char *rts, const char *drel, uint32_t ttl);
+OCTagsPayload* OCCopyTagsResources(const char *deviceName, const unsigned char *id, uint64_t ttl);
 
 /**
  * Copies link resource to create LinksPayload.
  *
  * @param href URI of the resource
+ * @param rel Relation
  * @param rt Array of String pointing to resource types.
  * @param itf Array of String pointing to interface
- * @param rel Relation
- * @param obs Whether to observe or not.
+ * @param p Whether to observe or not.
  * @param title Title
- * @param uri URI
+ * @param anchor URI
  * @param ins Unique value per link.
+ * @param ttl Time to live for this link.
  * @param mt Media Type
 
- * @retun Allocated memory for OCLinksPayload or else NULL in case of error.
+ * @retun Allocated memory for OCLinksResource or else NULL in case of error.
  */
-OCLinksPayload* OCCopyLinksResources(const char *href, OCStringLL *rt, OCStringLL *itf,
-    const char *rel, bool obs, const char *title, const char *uri, uint8_t ins, OCStringLL *mt);
+OCLinksPayload* OCCopyLinksResources(const char *href, const char *rel, OCStringLL *rt,
+                                     OCStringLL *itf, uint8_t p, const char *title,
+                                     const char *anchor, uint8_t ins, uint64_t ttl,
+                                     OCStringLL *mt);
 
 /**
  * Creates a resource collection object.
@@ -159,22 +176,6 @@ void OCFreeCollectionResource(OCResourceCollectionPayload *payload);
  */
 void OCDiscoveryCollectionPayloadDestroy(OCDiscoveryPayload* payload);
 
-/**
- * Prints tags payload.
- *
- * @param level LogLevel for the print.
- * @param tags Structure of the tags payload.
- */
-OC_EXPORT void OCTagsLog(const LogLevel level, const OCTagsPayload *tags);
-
-/**
- * Prints links payload.
- *
- * @param level LogLevel for the print.
- * @param tags Structure of the links payload.
- */
-OC_EXPORT void OCLinksLog(const LogLevel level, const OCLinksPayload *links);
-
 #ifdef __cplusplus
 }
 #endif // __cplusplus