Revert back cbor related patches.
[platform/upstream/iotivity.git] / resource / csdk / security / src / resourcemanager.c
index d40c4c9..339ea48 100644 (file)
@@ -18,7 +18,6 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#include <string.h>
 #include "resourcemanager.h"
 #include "securevirtualresourcetypes.h"
 #include "aclresource.h"
@@ -31,6 +30,7 @@
 #include "oic_string.h"
 #include "logger.h"
 #include "utlist.h"
+#include <string.h>
 
 //#ifdef DIRECT_PAIRING
 #include "pconfresource.h"
 #include "crlresource.h"
 #endif // __WITH_X509__
 
+/**
+ * This method is used by all secure resource modules to send responses to REST queries.
+ *
+ * @param ehRequest pointer to entity handler request data structure.
+ * @param ehRet result code from entity handler.
+ * @param rspPayload response payload in JSON.
+ *
+ * @retval  OC_STACK_OK for Success, otherwise some error value
+ */
 OCStackResult SendSRMResponse(const OCEntityHandlerRequest *ehRequest,
         OCEntityHandlerResult ehRet, const char *rspPayload)
 {
@@ -65,30 +74,11 @@ OCStackResult SendSRMResponse(const OCEntityHandlerRequest *ehRequest,
     return OC_STACK_ERROR;
 }
 
-OCStackResult SendSRMCBORResponse(const OCEntityHandlerRequest *ehRequest,
-        OCEntityHandlerResult ehRet, uint8_t *cborPayload)
-{
-    OIC_LOG(DEBUG, TAG, "SRM sending SRM response");
-    OCEntityHandlerResponse response = {.requestHandle = NULL};
-    OCStackResult ret = OC_STACK_ERROR;
-
-    if (ehRequest)
-    {
-        OCSecurityPayload ocPayload = {.base = {.type = PAYLOAD_TYPE_INVALID}};
-
-        response.requestHandle = ehRequest->requestHandle;
-        response.resourceHandle = ehRequest->resource;
-        response.ehResult = ehRet;
-        response.payload = (OCPayload *)(&ocPayload);
-        response.payload->type = PAYLOAD_TYPE_SECURITY;
-        ((OCSecurityPayload *)response.payload)->securityData1 = cborPayload;
-        response.persistentBufferFlag = 0;
-
-        ret = OCDoResponse(&response);
-    }
-    return ret;
-}
-
+/**
+ * Initialize all secure resources ( /oic/sec/cred, /oic/sec/acl, /oic/sec/pstat etc).
+ *
+ * @retval  OC_STACK_OK for Success, otherwise some error value
+ */
 OCStackResult InitSecureResources( )
 {
     OCStackResult ret;
@@ -144,6 +134,11 @@ OCStackResult InitSecureResources( )
     return ret;
 }
 
+/**
+ * Perform cleanup for secure resources ( /oic/sec/cred, /oic/sec/acl, /oic/sec/pstat etc).
+ *
+ * @retval  OC_STACK_OK for Success, otherwise some error value
+ */
 OCStackResult DestroySecureResources( )
 {
     DeInitACLResource();