return "NOT_ACCEPTABLE";
case OC_STACK_UNAUTHORIZED_REQ:
return "UNAUTHORIZED_REQ";
+ case OC_STACK_TOO_MANY_REQUESTS:
+ return "TOO_MANY_REQUESTS";
/** Error code from PDM */
case OC_STACK_PDM_IS_NOT_INITIALIZED:
return "PDM_IS_NOT_INITIALIZED";
INVALID_DEVICE_INFO("INVALID_DEVICE_INFO", ""),
INVALID_JSON("INVALID_JSON", ""),
UNAUTHORIZED_REQ("UNAUTHORIZED_REQ", "Request is not authorized by Resource Server"),
+ TOO_MANY_REQUESTS("TOO_MANY_REQUESTS", "Request is not served by Server; Request again after retry timer (in seconds)"),
/** Error code from PDM */
PDM_IS_NOT_INITIALIZED("PDM_IS_NOT_INITIALIZED", ""),
DUPLICATE_UUID("DUPLICATE_UUID", ""),
+http://suprem.sec.samsung.net/jira/browse/CONPRO-1230
+
+commit_info_2018-02-14.txt
+
+commit_id: 6e8d34cb1d4d68f4ea7873102b73c37145a5ae11
+----------------------------------------------------------------------------------------------------------------------------------
http://suprem.sec.samsung.net/jira/browse/CONPRO-1224
commit_info_2018-02-07.txt
CA_NOT_ACCEPTABLE = 406, /**< Not Acceptable */
CA_REQUEST_ENTITY_INCOMPLETE = 408, /**< Request Entity Incomplete */
CA_REQUEST_ENTITY_TOO_LARGE = 413, /**< Request Entity Too Large */
+ CA_TOO_MANY_REQUESTS = 429, /**< Too Many Requests */
CA_INTERNAL_SERVER_ERROR = 500, /**< Internal Server Error */
CA_NOT_IMPLEMENTED = 501, /**< Not Implenented */
CA_BAD_GATEWAY = 502, /**< Bad Gateway */
case CA_NOT_ACCEPTABLE:
case CA_REQUEST_ENTITY_INCOMPLETE:
case CA_REQUEST_ENTITY_TOO_LARGE:
+ case CA_TOO_MANY_REQUESTS:
case CA_INTERNAL_SERVER_ERROR:
case CA_NOT_IMPLEMENTED:
case CA_BAD_GATEWAY:
#include "pkix_interface.h"
#include "hw_emul/hw_interface.h"
#include "mbedtls/x509_crt.h"
+#include "secureresourceprovider.h"
#ifdef __cplusplus
extern "C"
g_doneCB = true;
}
-static void resetDeviceCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool hasError)
+static void resetDeviceCB(void* ctx)
{
OC_UNUSED(ctx);
OIC_LOG_V(INFO, TAG, "Reset Device SUCCEEDED");
printf(" Resetting Selected Owned Device..\n");
OCStackResult rst = SRPResetDevice(dev, resetDeviceCB);
-
if (OC_STACK_OK != rst)
{
OIC_LOG_V(ERROR, TAG, "OCResetDevice API error: %d", rst);
OIC_LOG_V(DEBUG, TAG, "%s: TCP port from discovery = %d", __func__, resPayload->tcpPort);
#endif
DiscoveryInfo* pDInfo = (DiscoveryInfo*)ctx;
+
+ if(pDInfo->isSingleDiscovery && pDInfo->isFound)
+ {
+ OIC_LOG(INFO, TAG, "Device is already founded at Single mode.");
+ return OC_STACK_DELETE_TRANSACTION;
+ }
+
OCProvisionDev_t *ptr = GetDevice(&pDInfo->pCandidateList,
clientResponse->devAddr.addr,
clientResponse->devAddr.port);
{
OIC_LOG(ERROR, TAG, "OCStack resource error");
OICFree(pDInfo);
+ pDInfo = NULL;
return res;
}
{
OIC_LOG(ERROR, TAG, "Failed to wait response for secure discovery.");
OICFree(pDInfo);
+ pDInfo = NULL;
OCStackResult resCancel = OCCancel(handle, OC_HIGH_QOS, NULL, 0);
if(OC_STACK_OK != resCancel)
{
{
OIC_LOG(ERROR, TAG, "Failed to remove registered callback");
OICFree(pDInfo);
+ pDInfo = NULL;
return res;
}
OIC_LOG(DEBUG, TAG, "OUT PMDeviceDiscovery");
OICFree(pDInfo);
+ pDInfo = NULL;
return res;
}
// because we use 3 Cert, 6K is enough size for saving Certs.
if (6144 <= chainSize)
{
- OIC_LOG_V(ERROR, TAG, "chainSize(%d) is invalid", chainSize);
+ OIC_LOG_V(ERROR, TAG, "chainSize(%lu) is invalid", chainSize);
return OC_STACK_INVALID_PARAM;
}
OIC_LOG_BUFFER(DEBUG, TAG, cred->subject.id, sizeof(cred->subject.id));
if (cred->privateData.data)
{
- OIC_LOG_V(DEBUG, TAG, "GenerateCredential : privateData len: %d", cred->privateData.len);
+ OIC_LOG_V(DEBUG, TAG, "GenerateCredential : privateData len: %lu", cred->privateData.len);
OIC_LOG_BUFFER(DEBUG, TAG, cred->privateData.data, cred->privateData.len);
}
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
}
if (cred->publicData.data)
{
- OIC_LOG_V(DEBUG, TAG, "GenerateCredential : publicData len: %d", cred->publicData.len);
+ OIC_LOG_V(DEBUG, TAG, "GenerateCredential : publicData len: %lu", cred->publicData.len);
OIC_LOG_BUFFER(DEBUG, TAG, cred->publicData.data, cred->publicData.len);
}
if (cred->optionalData.data)
{
- OIC_LOG_V(DEBUG, TAG, "GenerateCredential : optionalData len: %d", cred->optionalData.len);
+ OIC_LOG_V(DEBUG, TAG, "GenerateCredential : optionalData len: %lu", cred->optionalData.len);
OIC_LOG_BUFFER(DEBUG, TAG, cred->optionalData.data, cred->optionalData.len);
OIC_LOG_V(DEBUG, TAG, "GenerateCredential : optionalData revstat: %d", cred->optionalData.revstat);
}
*derCrtBufLen = (size_t)crt_len + remained_len;
mbedtls_x509_crt_free(&crt_cpy);
- OIC_LOG_V(INFO, TAG, "Dev cert : %lu -> %lu", org_len, crt_len);
+ OIC_LOG_V(INFO, TAG, "Dev cert : %lu -> %i", org_len, crt_len);
OIC_LOG_V(INFO, TAG, "Remained chain : %lu", remained_len);
OIC_LOG_V(INFO, TAG, "Cert Length (After) : %lu", *crtBufLen);
}
exit:
mbedtls_x509_crt_free(&deviceCert);
OICFree(derCrtBufTmp);
- OIC_LOG_V(DEBUG, TAG, "Cert chain length = %d", *crtBufLen);
+ OIC_LOG_V(DEBUG, TAG, "Cert chain length = %lu", *crtBufLen);
OIC_LOG_V(DEBUG, TAG, "Out %s", __func__);
}
// check and fix invalid cert signature
CheckInvalidDERSignature(inf->crt.data, &inf->crt.len);
- OIC_LOG_V(INFO, TAG, "Cert chain length = %d", inf->crt.len);
+ OIC_LOG_V(INFO, TAG, "Cert chain length = %lu", inf->crt.len);
OIC_LOG_V(INFO, TAG, "Out %s", __func__);
return true;
}
/** ERROR code from server */
OC_STACK_FORBIDDEN_REQ, /** 403*/
+ OC_STACK_TOO_MANY_REQUESTS, /** 429*/
OC_STACK_INTERNAL_SERVER_ERROR, /** 500*/
OC_STACK_NOT_IMPLEMENTED, /** 501*/
OC_STACK_BAD_GATEWAY, /** 502*/
OC_EH_NOT_ACCEPTABLE = 406,
OC_EH_TOO_LARGE = 413,
OC_EH_UNSUPPORTED_MEDIA_TYPE = 415,
+ OC_EH_TOO_MANY_REQUESTS = 429,
OC_EH_INTERNAL_SERVER_ERROR = 500,
OC_EH_NOT_IMPLEMENTED = 501,
OC_EH_BAD_GATEWAY = 502,
case OC_EH_RESOURCE_NOT_FOUND:
result = OC_STACK_NO_RESOURCE;
break;
+ case OC_EH_TOO_MANY_REQUESTS:
+ result = OC_STACK_TOO_MANY_REQUESTS;
+ break;
case OC_EH_INTERNAL_SERVER_ERROR:
result = OC_STACK_INTERNAL_SERVER_ERROR;
break;
case OC_EH_NOT_ACCEPTABLE: // 4.06
caResult = CA_NOT_ACCEPTABLE;
break;
+ case OC_EH_TOO_MANY_REQUESTS: // 4.29
+ caResult = CA_TOO_MANY_REQUESTS;
+ break;
case OC_EH_INTERNAL_SERVER_ERROR: // 5.00
caResult = CA_INTERNAL_SERVER_ERROR;
break;
case CA_FORBIDDEN_REQ:
ret = OC_STACK_FORBIDDEN_REQ;
break;
+ case CA_TOO_MANY_REQUESTS:
+ ret = OC_STACK_TOO_MANY_REQUESTS;
+ break;
case CA_INTERNAL_SERVER_ERROR:
ret = OC_STACK_INTERNAL_SERVER_ERROR;
break;
case OC_STACK_FORBIDDEN_REQ:
ret = CA_FORBIDDEN_REQ;
break;
+ case OC_STACK_TOO_MANY_REQUESTS:
+ ret = CA_TOO_MANY_REQUESTS;
+ break;
case OC_STACK_INTERNAL_SERVER_ERROR:
ret = CA_INTERNAL_SERVER_ERROR;
break;
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 TOO_MANY_REQUESTS[] = "Too Many Requests";
static const char INTERNAL_SERVER_ERROR[] = "Internal server error";
static const char NOTIFY_ALL_OBSERVERS_FAILED[] = "notifyAllObservers failed";
static const char NOTIFY_LIST_OBSERVERS_FAILED[] = "notifyListOfObservers failed";
return OC::Exception::NOT_ACCEPTABLE;
case OC_STACK_FORBIDDEN_REQ:
return OC::Exception::FORBIDDEN_REQ;
+ case OC_STACK_TOO_MANY_REQUESTS:
+ return OC::Exception::TOO_MANY_REQUESTS;
case OC_STACK_INTERNAL_SERVER_ERROR:
return OC::Exception::INTERNAL_SERVER_ERROR;
case OC_STACK_METHOD_NOT_ALLOWED: