Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / adapter_util / cafragmentation.c
  *
  ******************************************************************/
 
-#include "camsgparser.h"
-
 #include <string.h>
 #include <math.h>
 
 #include "cacommon.h"
 #include "caadapterutils.h"
+#include "cafragmentation.h"
 
 /**
- * @var CA_MSG_PARSER_TAG
- * @brief debugging tag for parser module
+ * @var CA_FRAGMENTATION_TAG
+ * @brief debugging tag for fragmentation module
  */
-#define CA_MSG_PARSER_TAG "CA_MSG_PARSER"
+#define CA_FRAGMENTATION_TAG "CA_FRAGMENTATION"
 
 CAResult_t CAGenerateHeader(char *header, uint32_t length)
 {
-    OIC_LOG(DEBUG, CA_MSG_PARSER_TAG, "IN");
+    OIC_LOG(DEBUG, CA_FRAGMENTATION_TAG, "IN");
 
-    VERIFY_NON_NULL(header, CA_MSG_PARSER_TAG, "header is NULL");
+    VERIFY_NON_NULL(header, CA_FRAGMENTATION_TAG, "header is NULL");
     memset(header, 0x0, sizeof(char) * CA_HEADER_LENGTH);
 
     if(length > MAX_DATA_LENGTH_SUPPORTED)
     {
-        OIC_LOG(DEBUG, CA_MSG_PARSER_TAG, "Given length is more than 4095.It will be truncated");
+        OIC_LOG(DEBUG, CA_FRAGMENTATION_TAG,
+                "Given length is more than 4095.It will be truncated");
     }
     //if length is more than 4095 then it will be truncated.
     header[1] = length & 0xFF;
@@ -49,20 +49,20 @@ CAResult_t CAGenerateHeader(char *header, uint32_t length)
     header[0] = length & 0x0F;
     header[0] = header[0] | 0x40; // Adding version 0100.(Not used. Future use)
 
-    OIC_LOG(DEBUG, CA_MSG_PARSER_TAG, "OUT");
+    OIC_LOG(DEBUG, CA_FRAGMENTATION_TAG, "OUT");
+
     return CA_STATUS_OK;
 }
 
 uint32_t CAParseHeader(const char *header)
 {
-    OIC_LOG(DEBUG, CA_MSG_PARSER_TAG, "IN");
+    OIC_LOG(DEBUG, CA_FRAGMENTATION_TAG, "IN");
 
-    VERIFY_NON_NULL(header, CA_MSG_PARSER_TAG, "header is NULL");
+    VERIFY_NON_NULL_RET(header, CA_FRAGMENTATION_TAG, "header is NULL", 0);
 
     uint32_t dataLen = ((header[0] & 0x0F) << 8) | (header[1] & 0xFF);
 
-    OIC_LOG(DEBUG, CA_MSG_PARSER_TAG, "OUT");
+    OIC_LOG(DEBUG, CA_FRAGMENTATION_TAG, "OUT");
     return dataLen;
 }
 
-