Commit 4e7cf90d authored by Jaewook Jung's avatar Jaewook Jung Committed by Ashok Babu Channa
parent 352aa739
......@@ -107,6 +107,13 @@
* UINT16_MAX does not appear to be defined on Arduino so we define it here.
*/
# define UINT16_MAX 65535
/**
* Handle case that PRId64 is not defined in Arduino's inttypes.h
*/
# if !defined(PRId64)
# define PRId64 "lld"
# endif
#endif
/**
......
......@@ -123,7 +123,7 @@ void CAdeinitSslAdapter();
*
*/
CAResult_t CAencryptSsl(const CAEndpoint_t *endpoint, void *data, size_t dataLen);
CAResult_t CAencryptSsl(const CAEndpoint_t *endpoint, const void *data, size_t dataLen);
/**
* Performs TLS decryption of the data.
......
......@@ -1339,7 +1339,7 @@ static void SetupCipher(mbedtls_ssl_config * config, CATransportAdapter_t adapte
// Add all certificate ciphersuites
if (true == g_caSslContext->cipherFlag[1])
{
for (int i = 0; i < SSL_CIPHER_MAX - 1; i++)
for (unsigned int i = 0; i < SSL_CIPHER_MAX - 1; i++)
{
if (MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 != tlsCipher[i][0] &&
i != g_caSslContext->cipher)
......@@ -1758,7 +1758,7 @@ SslCacheMessage_t * NewCacheMessage(uint8_t * data, size_t dataLen)
/* Send data via TLS connection.
*/
CAResult_t CAencryptSsl(const CAEndpoint_t *endpoint,
void *data, size_t dataLen)
const void *data, size_t dataLen)
{
int ret = 0;
......@@ -2043,7 +2043,7 @@ CAResult_t CAdecryptSsl(const CASecureEndpoint_t *sep, uint8_t *data, size_t dat
OIC_LOG_V(DEBUG, NET_SSL_TAG, "Out %s", __func__);
return CA_STATUS_FAILED;
}
else if (ret > sizeof(peer->sep.publicKey))
else if ((size_t)ret > sizeof(peer->sep.publicKey))
{
assert(!"publicKey field of CASecureEndpoint_t is too small for the public key!");
OIC_LOG(ERROR, NET_SSL_TAG, "Public key of remote peer was too large");
......
......@@ -22,6 +22,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "oic_malloc.h"
#include "oic_string.h"
......@@ -448,7 +449,8 @@ OCStackResult OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host,
OCResource *handle = (OCResource *) resourceHandles[j];
int64_t ins = 0;
OCGetResourceIns(handle, &ins);
int lenBufferRequired = snprintf((queryParam + queryLength), (MAX_URI_LENGTH - queryLength), "&ins=%lld", ins);
int lenBufferRequired = snprintf((queryParam + queryLength),
(MAX_URI_LENGTH - queryLength), "&ins=%" PRId64, ins);
if (lenBufferRequired >= (MAX_URI_LENGTH - queryLength) || lenBufferRequired < 0)
{
return OC_STACK_INVALID_URI;
......
......@@ -1273,11 +1273,6 @@ OCStackResult BuildVirtualResourceResponse(const OCResource *resourcePtr,
}
}
bool isVirtual = false;
if (GetTypeOfVirtualURI(resourcePtr->uri) != OC_UNKNOWN_URI)
{
isVirtual = true;
}
#ifdef TCP_ADAPTER
uint16_t tcpPort = 0;
GetTCPPortInfo(devAddr, &tcpPort, (resourcePtr->resourceProperties & OC_SECURE));
......
......@@ -134,6 +134,7 @@ namespace OC
static const char FORBIDDEN_REQ[] = "Forbidden request";
static const char INTERNAL_SERVER_ERROR[] = "Internal server error";
static const char BAD_ENDPOINT[] = "Bad Endpoint";
static const char GATEWAY_TIMEOUT[] = "Gateway Timeout";
}
namespace Error
......
......@@ -134,7 +134,7 @@ uint16_t CAManager::getAssignedPortNumber(OCTransportAdapter adapter, OCTranspor
OCStackResult CAManager::setBTConfigure(const CAUtilConfig& config)
{
OIC_LOG(INFO, TAG, "setBTConfigure");
CAUtilConfig_t configs = {(CATransportBTFlags_t)config.bleFlag};
CAUtilConfig_t configs = {(CATransportBTFlags_t)config.bleFlag, CA_USER_PREF_CLOUD};
CAResult_t ret = CAUtilSetBTConfigure(configs);
return convertCAResultToOCResult(ret);
}
......
......@@ -121,6 +121,8 @@ std::string OC::OCException::reason(const OCStackResult sr)
return OC::Exception::INTERNAL_SERVER_ERROR;
case OC_STACK_BAD_ENDPOINT:
return OC::Exception::BAD_ENDPOINT;
case OC_STACK_GATEWAY_TIMEOUT:
return OC::Exception::GATEWAY_TIMEOUT;
}
return OC::Exception::UNKNOWN_ERROR;
......
......@@ -117,11 +117,7 @@ OCResource::OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
m_endpoints(endpoints),
m_observeHandle(nullptr)
{
m_devAddr = OCDevAddr{OC_DEFAULT_ADAPTER, OC_DEFAULT_FLAGS, 0, {0}, 0,
#if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
{0}
#endif
};
m_devAddr = OCDevAddr{OC_DEFAULT_ADAPTER, OC_DEFAULT_FLAGS, 0, {0}, 0, {0}, {0}};
m_isCollection = std::find(m_interfaces.begin(), m_interfaces.end(), LINK_INTERFACE)
!= m_interfaces.end();
......
......@@ -79,7 +79,8 @@ namespace OC
OC_STACK_NOT_ACCEPTABLE,
OC_STACK_FORBIDDEN_REQ,
OC_STACK_INTERNAL_SERVER_ERROR,
OC_STACK_BAD_ENDPOINT
OC_STACK_BAD_ENDPOINT,
OC_STACK_GATEWAY_TIMEOUT
};
std::string resultMessages[]=
......@@ -130,7 +131,8 @@ namespace OC
OC::Exception::NOT_ACCEPTABLE,
OC::Exception::FORBIDDEN_REQ,
OC::Exception::INTERNAL_SERVER_ERROR,
OC::Exception::BAD_ENDPOINT
OC::Exception::BAD_ENDPOINT,
OC::Exception::GATEWAY_TIMEOUT
};
TEST(OCExceptionTest, ReasonCodeMatches)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment