replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / stack / include / internal / ocstackinternal.h
index c093284..93b0427 100644 (file)
@@ -230,6 +230,14 @@ OCStackResult BindResourceInterfaceToResource(OCResource* resource,
 OCStackResult BindResourceTypeToResource(OCResource* resource,
                                             const char *resourceTypeName);
 
+/**
+ * Convert OCStackResult to CAResponseResult_t.
+ *
+ * @param ocCode OCStackResult code.
+ * @param method OCMethod method the return code replies to.
+ * @return ::CA_CONTENT on OK, some other value upon failure.
+ */
+CAResponseResult_t OCToCAStackResult(OCStackResult ocCode, OCMethod method);
 
 /**
  * Converts a CAResult_t type to a OCStackResult type.
@@ -269,20 +277,96 @@ CAMessageType_t qualityOfServiceToMessageType(OCQualityOfService qos);
 //TODO: should the following function be public?
 OCStackResult OCChangeResourceProperty(OCResourceProperty * inputProperty,
         OCResourceProperty resourceProperties, uint8_t enable);
-#endif
 
 const char *convertTriggerEnumToString(OCPresenceTrigger trigger);
 
 OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr);
-
-OCStackResult encodeAddressForRFC6874(char * outputAddress,
-                                      size_t outputSize,
-                                      const char * inputAddress);
+#endif // WITH_PRESENCE
 
 void CopyEndpointToDevAddr(const CAEndpoint_t *in, OCDevAddr *out);
 
 void CopyDevAddrToEndpoint(const OCDevAddr *in, CAEndpoint_t *out);
 
+/**
+ * Get the CoAP ticks after the specified number of milli-seconds.
+ *
+ * @param milliSeconds Milli-seconds.
+ * @return CoAP ticks
+ */
+uint32_t GetTicks(uint32_t milliSeconds);
+
+/**
+ * Extract interface and resource type from the query.
+ *
+ * @param query is the request received from the client
+ * @param filterOne will include result if the interface is included in the query.
+ * @param filterTwo will include result if the resource type is included in the query.
+ *
+ * @return ::OC_STACK_OK on success, some other value upon failure
+ */
+OCStackResult ExtractFiltersFromQuery(const char *query, char **filterOne, char **filterTwo);
+
+#if defined(RD_CLIENT) || defined(RD_SERVER)
+/**
+ * This function binds an resource unique ins value to the resource. This can be only called
+ * when stack is received response from resource-directory.
+ *
+ * @param requestUri URI of the resource.
+ * @param response Response from queries to remote servers.
+ *
+ * @return ::OC_STACK_OK on success, some other value upon failure.
+ */
+OCStackResult OCUpdateResourceInsWithResponse(const char *requestUri,
+                                              const OCClientResponse *response);
+#endif
+
+/**
+ * Get the CoAP ticks after the specified number of milli-seconds.
+ *
+ * @param milliSeconds Milli-seconds.
+ * @return CoAP ticks
+ */
+uint32_t GetTicks(uint32_t milliSeconds);
+
+/**
+ * Delete all of the dynamically allocated elements that were created for the resource attributes.
+ *
+ * @param resourceAttr Specified resource attribute.
+ */
+void OCDeleteResourceAttributes(OCAttribute *rsrcAttributes);
+
+/**
+ *  A request uri consists of the following components in order:
+ *                              example
+ *  optionally one of
+ *      CoAP over UDP prefix    "coap://"
+ *      CoAP over TCP prefix    "coap+tcp://"
+ *      CoAP over DTLS prefix   "coaps://"
+ *      CoAP over TLS prefix    "coaps+tcp://"
+ *  optionally one of
+ *      IPv6 address            "[1234::5678]"
+ *      IPv4 address            "192.168.1.1"
+ *  optional port               ":5683"
+ *  resource uri                "/oc/core..."
+ *
+ *  for PRESENCE requests, extract resource type.
+ *
+ *  @return ::OC_STACK_OK on success, some other value upon failure.
+ */
+OCStackResult ParseRequestUri(const char *fullUri,
+                              OCTransportAdapter adapter,
+                              OCTransportFlags flags,
+                              OCDevAddr **devAddr,
+                              char **resourceUri,
+                              char **resourceType);
+
+/**
+ * Fix up client response data.
+ *
+ * @param cr Response from queries to remote servers.
+ */
+void FixUpClientResponse(OCClientResponse *cr);
+
 #ifdef __cplusplus
 }
 #endif // __cplusplus