connectivity: provide server unavailable error 39/21139/6
authorjihwan.seo <jihwan.seo@samsung.com>
Tue, 11 Apr 2017 05:34:41 +0000 (14:34 +0900)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Wed, 19 Jul 2017 18:00:18 +0000 (18:00 +0000)
provide server unavailable error(503) value in ocstack

Change-Id: Ica4956debfd8112f93beab4edd23a569ea5a3ad0
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18679
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
(cherry picked from commit 1dcb85b9796760b7e18dfd62ca85614d4d784e40)
Reviewed-on: https://gerrit.iotivity.org/gerrit/21139

resource/csdk/connectivity/api/cacommon.h
resource/csdk/connectivity/common/src/caremotehandler.c
resource/csdk/include/octypes.h
resource/csdk/stack/src/ocserverrequest.c
resource/csdk/stack/src/ocstack.c

index d62d2a8..a52326f 100644 (file)
@@ -397,6 +397,7 @@ typedef enum
     CA_REQUEST_ENTITY_TOO_LARGE = 413,      /**< Request Entity Too Large */
     CA_INTERNAL_SERVER_ERROR = 500,         /**< Internal Server Error */
     CA_BAD_GATEWAY = 502,
+    CA_SERVICE_UNAVAILABLE = 503,           /**< Server Unavailable */
     CA_RETRANSMIT_TIMEOUT = 504,            /**< Retransmit timeout */
     CA_PROXY_NOT_SUPPORTED = 505            /**< Proxy not enabled to service a request */
     /* Response status code - END HERE */
index 8ef9d52..5ff2b31 100644 (file)
@@ -119,6 +119,8 @@ CAResponseInfo_t *CACloneResponseInfo(const CAResponseInfo_t *rep)
         case CA_REQUEST_ENTITY_INCOMPLETE:
         case CA_REQUEST_ENTITY_TOO_LARGE:
         case CA_INTERNAL_SERVER_ERROR:
+        case CA_BAD_GATEWAY:
+        case CA_SERVICE_UNAVAILABLE:
         case CA_RETRANSMIT_TIMEOUT:
             break;
         default:
index a0733d4..36e4539 100644 (file)
@@ -1133,6 +1133,7 @@ typedef enum
     OC_STACK_FORBIDDEN_REQ,          /** 403*/
     OC_STACK_INTERNAL_SERVER_ERROR,  /** 500*/
     OC_STACK_GATEWAY_TIMEOUT,        /** 504*/
+    OC_STACK_SERVICE_UNAVAILABLE,    /** 503*/
 
     /** ERROR in stack.*/
     OC_STACK_ERROR = 255
index 38d65ae..cc28bdd 100644 (file)
@@ -491,6 +491,9 @@ CAResponseResult_t ConvertEHResultToCAResult (OCEntityHandlerResult result, OCMe
         case OC_EH_INTERNAL_SERVER_ERROR: // 5.00
             caResult = CA_INTERNAL_SERVER_ERROR;
             break;
+        case OC_EH_SERVICE_UNAVAILABLE: // 5.03
+            caResult = CA_SERVICE_UNAVAILABLE;
+            break;
         case OC_EH_RETRANSMIT_TIMEOUT: // 5.04
             caResult = CA_RETRANSMIT_TIMEOUT;
             break;
index 4e081df..2fabe85 100644 (file)
@@ -864,6 +864,9 @@ OCStackResult CAResponseToOCStackResult(CAResponseResult_t caCode)
         case CA_INTERNAL_SERVER_ERROR:
             ret = OC_STACK_INTERNAL_SERVER_ERROR;
             break;
+        case CA_SERVICE_UNAVAILABLE:
+            ret = OC_STACK_SERVICE_UNAVAILABLE;
+            break;
         default:
             break;
     }
@@ -936,6 +939,10 @@ CAResponseResult_t OCToCAStackResult(OCStackResult ocCode, OCMethod method)
             break;
         case OC_STACK_BAD_ENDPOINT:
             ret = CA_BAD_REQ;
+            break;
+        case OC_STACK_SERVICE_UNAVAILABLE:
+            ret = CA_SERVICE_UNAVAILABLE;
+            break;
         default:
             break;
     }