[Win32] Modify SConscripts to prepare for VS
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / linux / secure / common.cpp
index 8664f2e..6eb7521 100644 (file)
 // limitations under the License.
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include "common.h"
 
+#include "ocstack.h"
+#include "logger.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <ocstack.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#define TAG "sample-common"
 
 const char *getResult(OCStackResult result) {
     switch (result) {
@@ -58,9 +64,9 @@ const char *getResult(OCStackResult result) {
         return "OC_STACK_SLOW_RESOURCE";
     case OC_STACK_NO_OBSERVERS:
         return "OC_STACK_NO_OBSERVERS";
+    case OC_STACK_UNAUTHORIZED_REQ:
+        return "OC_STACK_UNAUTHORIZED_REQ";
     #ifdef WITH_PRESENCE
-    case OC_STACK_PRESENCE_DO_NOT_HANDLE:
-        return "OC_STACK_PRESENCE_DO_NOT_HANDLE";
     case OC_STACK_PRESENCE_STOPPED:
         return "OC_STACK_PRESENCE_STOPPED";
     #endif
@@ -70,3 +76,17 @@ const char *getResult(OCStackResult result) {
         return "UNKNOWN";
     }
 }
+
+void StripNewLineChar(char* str) {
+    int i = 0;
+    if (str)
+    {
+        while( str[i])
+        {
+            if (str[i] == '\n')
+                str[i] = '\0';
+            i++;
+        }
+    }
+}
+