From: Alex Kelley Date: Fri, 20 Jan 2017 20:08:49 +0000 (-0800) Subject: [IOT-1769] Add OC_STACK_NOT_ACCEPTABLE status code X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b448c6614a02661f020b6c2eede7989d75bd512;p=contrib%2Fiotivity.git [IOT-1769] Add OC_STACK_NOT_ACCEPTABLE status code to fix build break. Change-Id: I8590a9e78df7e5f8ba5c4938dad8d3b7d277b0bc Signed-off-by: Alex Kelley Reviewed-on: https://gerrit.iotivity.org/gerrit/16635 Reviewed-by: Kevin Kane Reviewed-by: Srikrishna Gurugubelli Tested-by: jenkins-iotivity Reviewed-by: Phil Coval Reviewed-by: Dan Mihai --- diff --git a/java/jni/JniUtils.h b/java/jni/JniUtils.h index 13858d9..18a4fdb 100644 --- a/java/jni/JniUtils.h +++ b/java/jni/JniUtils.h @@ -207,6 +207,8 @@ public: case OC_STACK_INVALID_JSON: return "INVALID_JSON"; /** Request is not authorized by Resource Server. */ + case OC_STACK_NOT_ACCEPTABLE: + return "NOT_ACCEPTABLE"; case OC_STACK_UNAUTHORIZED_REQ: return "UNAUTHORIZED_REQ"; /** Error code from PDM */ diff --git a/resource/csdk/include/octypes.h b/resource/csdk/include/octypes.h index 3083503..5155fa5 100755 --- a/resource/csdk/include/octypes.h +++ b/resource/csdk/include/octypes.h @@ -1085,6 +1085,7 @@ typedef enum /** Request is denied by the user*/ OC_STACK_USER_DENIED_REQ, + OC_STACK_NOT_ACCEPTABLE, /** ERROR code from server */ OC_STACK_FORBIDDEN_REQ, /** 403*/ diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 36a7508..03698d6 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -695,6 +695,9 @@ OCStackResult CAResponseToOCStackResult(CAResponseResult_t caCode) case CA_REQUEST_ENTITY_TOO_LARGE: ret = OC_STACK_TOO_LARGE_REQ; break; + case CA_NOT_ACCEPTABLE: + ret = OC_STACK_NOT_ACCEPTABLE; + break; case CA_FORBIDDEN_REQ: ret = OC_STACK_FORBIDDEN_REQ; break; @@ -756,6 +759,9 @@ CAResponseResult_t OCToCAStackResult(OCStackResult ocCode, OCMethod method) case OC_STACK_COMM_ERROR: ret = CA_RETRANSMIT_TIMEOUT; break; + case OC_STACK_NOT_ACCEPTABLE: + ret = CA_NOT_ACCEPTABLE; + break; case OC_STACK_UNAUTHORIZED_REQ: ret = CA_UNAUTHORIZED_REQ; break; diff --git a/resource/include/StringConstants.h b/resource/include/StringConstants.h index 9dbd42c..ae7869c 100644 --- a/resource/include/StringConstants.h +++ b/resource/include/StringConstants.h @@ -127,6 +127,7 @@ namespace OC static const char AUTHENTICATION_FAILURE[] = "Authentication failure"; static const char NOT_ALLOWED_OXM[] = "Not allowed ownership transfer method"; static const char USER_DENIED_REQ[] = "Request denied by User"; + static const char NOT_ACCEPTABLE[] = "Request not acceptable"; static const char PUBLISH_RESOURCE_FAILED[] = "Publish Resource failure"; static const char FORBIDDEN_REQ[] = "Forbidden request"; static const char INTERNAL_SERVER_ERROR[] = "Internal server error"; diff --git a/resource/src/OCException.cpp b/resource/src/OCException.cpp index a21dbc8..d413fd9 100644 --- a/resource/src/OCException.cpp +++ b/resource/src/OCException.cpp @@ -113,6 +113,8 @@ std::string OC::OCException::reason(const OCStackResult sr) return OC::Exception::NOT_ALLOWED_OXM; case OC_STACK_USER_DENIED_REQ: return OC::Exception::USER_DENIED_REQ; + case OC_STACK_NOT_ACCEPTABLE: + return OC::Exception::NOT_ACCEPTABLE; case OC_STACK_FORBIDDEN_REQ: return OC::Exception::FORBIDDEN_REQ; case OC_STACK_INTERNAL_SERVER_ERROR: diff --git a/resource/unittests/OCExceptionTest.cpp b/resource/unittests/OCExceptionTest.cpp index a8c1b79..742adcc 100644 --- a/resource/unittests/OCExceptionTest.cpp +++ b/resource/unittests/OCExceptionTest.cpp @@ -76,6 +76,7 @@ namespace OC OC_STACK_AUTHENTICATION_FAILURE, OC_STACK_NOT_ALLOWED_OXM, OC_STACK_USER_DENIED_REQ, + OC_STACK_NOT_ACCEPTABLE, OC_STACK_FORBIDDEN_REQ, OC_STACK_INTERNAL_SERVER_ERROR }; @@ -125,6 +126,7 @@ namespace OC OC::Exception::AUTHENTICATION_FAILURE, OC::Exception::NOT_ALLOWED_OXM, OC::Exception::USER_DENIED_REQ, + OC::Exception::NOT_ACCEPTABLE, OC::Exception::FORBIDDEN_REQ, OC::Exception::INTERNAL_SERVER_ERROR };