Integrated OCSecurityConfig data structure with CA DTLS implementation.
Also updated RI layer to use security data structure variables from CA.
Change-Id: Ia708c8a61f3a8e56442c7acfa927cf2512024452
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
#define CA_OPTION_LOCATION_QUERY 20
#define CA_OPTION_OBSERVE 6
-/**
- @brief Max length of ID
- */
-#define DTLS_PSK_ID_LEN 16
-
-/**
- @brief Max length of PSK
- */
-#define DTLS_PSK_PSK_LEN 16
-
-/**
- @brief version
- */
-#define DtlsPskCredsBlobVer_1 1
-
-/**
- @brief current version
- */
-#define DtlsPskCredsBlobVer_CurrentVersion DtlsPskCredsBlobVer_1
-
-
/**
@brief Payload information from resource model
*/
CAInfo_t info;
} CAResponseInfo_t;
-/**
- * Credentials for a device. Includes identity and the associated PSK.
- */
-typedef struct
-{
- unsigned char clientIdentity[DTLS_PSK_ID_LEN];
- unsigned char rsClientPsk[DTLS_PSK_PSK_LEN];
-} CADtlsPskCreds_t;
-
-/**
- * Binary blob containing device identity and the credentials for all devices
- * trusted by this device.
- */
-typedef struct
-{
- uint16_t blobVer; /**< version of the blob */
- uint16_t reserved; /**< reserved for future use */
- unsigned char rsIdentity[DTLS_PSK_ID_LEN]; /**< identity of self */
- uint32_t num; /**< number of credentials in this blob */
- CADtlsPskCreds_t *creds; /**< list of credentials. Size of this
- array is determined by 'num' variable. */
-} CADtlsPskCredsBlob_t;
-
#ifdef __cplusplus
} /* extern "C" */
#endif
-I$(libcoap_build_dir)
ifeq ($(DTLS),1)
- IFLAGS += -I$(libtiny_lib_dir)
+ IFLAGS += -I$(libtiny_lib_dir) \
+ -I$(PROJECT_SEC_PATH)
endif
DFLAGS = -D__LINUX__ -DWITH_POSIX $(BUILD_FLAG)
PROJECT_COMMON_PATH = $(PROJECT_ROOT_PATH)/common
PROJECT_OUT_PATH = $(PROJECT_ROOT_PATH)/build/out
PROJECT_LIB_PATH = $(PROJECT_ROOT_PATH)/lib
+PROJECT_SEC_PATH = $(PROJECT_ROOT_PATH)/../stack/include
##
## macro
#include "uarraylist.h"
#include "umutex.h"
#include "caadapterutils.h"
+#include "ocsecurityconfig.h"
#define MAX_SUPPORTED_ADAPTERS 2
-///TODO: once proper .h provided for this function, it will be removed
-extern void CAGetDtlsPskCredentials(CADtlsPskCredsBlob_t **credInfo);
+/**
+ * @brief The implementation will be provided by OIC RI layer.
+ */
+extern void OCGetDtlsPskCredentials(OCDtlsPskCredsBlob **credInfo);
typedef void (*CAPacketReceivedCallback)(const char *ipAddress, const uint32_t port,
const void *data, const uint32_t dataLength, const CABool_t isSecured);
PROJECT_INC_PATH = $(PROJECT_ROOT_PATH)/inc
PROJECT_SRC_PATH = $(PROJECT_ROOT_PATH)/src
PROJECT_COMMON_PATH = $(PROJECT_ROOT_PATH)/common
+PROJECT_SEC_PATH = $(PROJECT_ROOT_PATH)/../stack/include
PROJECT_OUT_PATH = $(PROJECT_ROOT_PATH)/build/out
COMPONENT_OUT_PATH = ./out
COMPONENT_OBJ_PATH = ./.objs
LFLAGS = -ldl -lpthread
-IFLAGS = -I$(PROJECT_API_PATH) \
+IFLAGS = -I$(PROJECT_API_PATH) -I$(PROJECT_SEC_PATH)
DFLAGS = -DLINUX -DTB_LOG
#include <unistd.h>
#include "cacommon.h"
#include "cainterface.h"
+#include "ocsecurityconfig.h"
#define MAX_BUF_LEN 1024
void handle_request_response();
void find_fixed_resource();
void get_network_info();
+void send_secure_request();
void request_handler(const CARemoteEndpoint_t *object, const CARequestInfo_t *requestInfo);
void response_handler(const CARemoteEndpoint_t *object, const CAResponseInfo_t *responseInfo);
static const char *gNormalInfoData = "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
"\"if\":[\"oc.mi.def\"],\"obs\":1}}]}";
-static CADtlsPskCredsBlob_t *pskCredsBlob = NULL;
+static OCDtlsPskCredsBlob *pskCredsBlob = NULL;
void clearDtlsCredentialInfo()
{
printf("clearDtlsCredentialInfo IN\n");
if (pskCredsBlob)
{
- // Initialize sensitive data to zeroes before freeing.
- memset(pskCredsBlob->creds, 0, sizeof(CADtlsPskCreds_t) * (pskCredsBlob->num));
+ // Zero out sensitive data before freeing.
+ if (pskCredsBlob->num)
+ {
+ memset(pskCredsBlob->creds, 0,
+ sizeof(OCDtlsPskCredsBlob) + (sizeof(OCDtlsPskCreds)*(pskCredsBlob->num - 1)));
+ }
free(pskCredsBlob->creds);
-
- memset(pskCredsBlob, 0, sizeof(CADtlsPskCredsBlob_t));
- free(pskCredsBlob);
pskCredsBlob = NULL;
}
printf("clearDtlsCredentialInfo OUT\n");
}
// Internal API. Invoked by OC stack to retrieve credentials from this module
-void CAGetDtlsPskCredentials(CADtlsPskCredsBlob_t **credInfo)
+void OCGetDtlsPskCredentials(OCDtlsPskCredsBlob **credInfo)
{
- printf("CAGetDtlsPskCredentials IN\n");
+ printf("OCGetDtlsPskCredentials IN\n");
*credInfo = pskCredsBlob;
- printf("CAGetDtlsPskCredentials OUT\n");
+ printf("OCGetDtlsPskCredentials OUT\n");
}
int32_t SetCredentials()
{
+ int32_t ret = 0;
printf("SetCredentials IN\n");
- pskCredsBlob = (CADtlsPskCredsBlob_t *)malloc(sizeof(CADtlsPskCredsBlob_t));
+ pskCredsBlob = (OCDtlsPskCredsBlob *)malloc(sizeof(OCDtlsPskCredsBlob));
- memset(pskCredsBlob, 0x0, sizeof(CADtlsPskCredsBlob_t));
- memcpy(pskCredsBlob->rsIdentity, IDENTITY, DTLS_PSK_ID_LEN);
+ if (pskCredsBlob)
+ {
+ memset(pskCredsBlob, 0x0, sizeof(OCDtlsPskCredsBlob));
+ pskCredsBlob->num = DtlsPskCredsBlobVer_CurrentVersion;
+ memcpy(pskCredsBlob->identity, IDENTITY, DTLS_PSK_ID_LEN);
- pskCredsBlob->num = 1;
+ pskCredsBlob->num = 1;
- pskCredsBlob->creds = (CADtlsPskCreds_t *)malloc(sizeof(CADtlsPskCreds_t) * (pskCredsBlob->num));
+ memcpy(pskCredsBlob->creds[0].id, IDENTITY, DTLS_PSK_ID_LEN);
+ memcpy(pskCredsBlob->creds[0].psk, RS_CLIENT_PSK, DTLS_PSK_PSK_LEN);
- memcpy(pskCredsBlob->creds[0].clientIdentity, IDENTITY, DTLS_PSK_ID_LEN);
- memcpy(pskCredsBlob->creds[0].rsClientPsk, RS_CLIENT_PSK, DTLS_PSK_PSK_LEN);
+ ret = 1;
+ }
printf("SetCredentials OUT\n");
- return 1;
+ return ret;
}
int main()
}
}
break;
+
+ case 'w':
+ case 'W':
+ gReceived = 0;
+ start_discovery_server();
+ send_secure_request();
+ while (gReceived == 0)
+ {
+ sleep(1);
+ handle_request_response();
+ }
+
+ break;
+
case 'z':
case 'Z':
start_listening_server();
requestData.token = token;
if ('1' == secureRequest[0])
{
- int length = strlen(gSecureInfoData) + strlen(resourceURI) + 1;
+ int length = strlen(resourceURI) + 1;
requestData.payload = (CAPayload_t) malloc(length);
sprintf(requestData.payload, gSecureInfoData, resourceURI, gLocalSecurePort);
}
printf("=============================================\n");
}
+void send_secure_request()
+{
+ char uri[MAX_BUF_LEN];
+ char ipv4addr[CA_IPADDR_SIZE];
+
+ printf("Enter IPv4 address of the source hosting secure resource (Ex: 11.12.13.14)\n");
+
+ fgets(ipv4addr, CA_IPADDR_SIZE, stdin);
+ snprintf(uri, MAX_BUF_LEN, "coaps://%s:5684/a/light", ipv4addr);
+
+ printf("\n=============================================\n");
+ // create remote endpoint
+ CARemoteEndpoint_t *endpoint = NULL;
+ if (CA_STATUS_OK != CACreateRemoteEndpoint(uri, CA_ETHERNET, &endpoint))
+ {
+ printf("Failed to create remote endpoint!\n");
+ goto exit;
+ }
+
+ // create token
+ CAToken_t token = NULL;
+ if (CA_STATUS_OK != CAGenerateToken(&token))
+ {
+ printf("Failed to generate token !\n");
+ goto exit;
+ }
+
+ // create request data
+ CAMessageType_t msgType = CA_MSG_NONCONFIRM;
+ CAInfo_t requestData;
+ memset(&requestData, 0, sizeof(CAInfo_t));
+ requestData.token = token;
+ requestData.type = msgType;
+
+ CARequestInfo_t requestInfo;
+ memset(&requestInfo, 0, sizeof(CARequestInfo_t));
+ requestInfo.method = CA_GET;
+ requestInfo.info = requestData;
+
+ // send request
+ CASendRequest(endpoint, &requestInfo);
+
+exit:
+ // cleanup
+ CADestroyToken(token);
+ CADestroyRemoteEndpoint(endpoint);
+ printf("=============================================\n");
+}
+
+
void send_request_all()
{
char buf[MAX_BUF_LEN];
printf("\th : handle request response\n");
printf("\ty : run static client\n");
printf("\tz : run static server\n");
+ printf("\tw : send secure request\n");
printf("\tq : quit\n");
printf("=============================================\n");
printf("select : ");
OIC_LOG(DEBUG, NET_DTLS_TAG, "IN");
int32_t ret = -1;
+ OCDtlsPskCredsBlob *credInfo = NULL;
- CADtlsPskCredsBlob_t *credInfo = NULL;
- CAGetDtlsPskCredentials(&credInfo);
+ //Retrieve the credentials blob from security module
+ OCGetDtlsPskCredentials(&credInfo);
- VERIFY_NON_NULL_RET(credInfo, NET_DTLS_TAG, "CAGetDtlsPskCredentials credInfo is NULL", 0);
+ VERIFY_NON_NULL_RET(credInfo, NET_DTLS_TAG, "OCGetDtlsPskCredentials credInfo is NULL", ret);
if ((type == DTLS_PSK_HINT) || (type == DTLS_PSK_IDENTITY))
{
if (DTLS_PSK_ID_LEN <= resultLen)
{
- memcpy(result, credInfo->rsIdentity, DTLS_PSK_ID_LEN);
+ memcpy(result, credInfo->identity, DTLS_PSK_ID_LEN);
ret = DTLS_PSK_ID_LEN;
}
}
if ((type == DTLS_PSK_KEY) && (desc) && (descLen == DTLS_PSK_PSK_LEN))
{
+ //Check if we have the credentials for the device with which we
+ //are trying to perform a handshake
int index = 0;
- for (index = 0; index < credInfo->num; index++)
+ for (; index < credInfo->num; index++)
{
- if (memcmp(desc, credInfo->creds[index].clientIdentity, DTLS_PSK_ID_LEN) == 0)
+ if (memcmp(desc, credInfo->creds[index].id, DTLS_PSK_ID_LEN) == 0)
{
- memcpy(result, credInfo->creds[index].rsClientPsk, DTLS_PSK_PSK_LEN);
+ memcpy(result, credInfo->creds[index].psk, DTLS_PSK_PSK_LEN);
ret = DTLS_PSK_PSK_LEN;
}
}
PLATFORM_TYPE=linux
# override with `make PLATFORM=arduinomega ARDUINOWIFI=1` to enable Arduino WiFi shield
ARDUINOWIFI := 0
+CA_INT_DTLS := 0
ifeq ($(ROOT_DIR), )
ROOT_DIR = ..
VPATH += $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src:$(RANDOM_DIR)/src:$(OCMALLOC_DIR)/src\
:$(OC_LOG_DIR)/c
+ifeq ($(CA_INT_DTLS),0)
ifeq ($(PLATFORM),linux)
ifneq ($(wildcard $(TINYDTLS_DIR)/libtinydtls.a),)
$(info "Building libcoap with DTLS support")
CC_FLAGS.release += -DWITH_DTLS
endif
endif
+endif
OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
# override with `make PLATFORM=arduinomega ARDUINOWIFI=1` to enable Arduino WiFi shield
ARDUINOWIFI := 0
+CA_INT_DTLS := 0
ifeq ($(ROOT_DIR), )
ROOT_DIR = ./
make_lcoap:
@echo "Building $@"
- $(MAKE) -C $(LCOAP_DIR) "BUILD=$(BUILD)" "PLATFORM=$(PLATFORM)" "ARDUINOWIFI=$(ARDUINOWIFI)"
+ $(MAKE) -C $(LCOAP_DIR) "BUILD=$(BUILD)" "PLATFORM=$(PLATFORM)" "ARDUINOWIFI=$(ARDUINOWIFI)" "CA_INT_DTLS=$(CA_INT_DTLS)"
objdirs:
mkdir -p $(PLATFORM)
# Repackage all the objects at this location into a single archive. This is OCStack, OCCoap, and LibCoap (LibCoap contains OCRandom, OCLogger, and OCSocket.).
$(AR) -r $(OUT_DIR)/$@ $(OBJ_DIR)/*.o
- ifeq ($(PLATFORM),linux)
- ifneq ($(wildcard $(TINYDTLS_DIR)/libtinydtls.a),)
+ ifeq ($(CA_INT_DTLS),0)
+ ifeq ($(PLATFORM),linux)
+ ifneq ($(wildcard $(TINYDTLS_DIR)/libtinydtls.a),)
$(info "Building liboctbstack with DTLS support")
mkdir -p $(OBJ_DIR)/tinydtls
@cd $(OBJ_DIR)/tinydtls && $(AR) -x ../$(PLATFORM_SPECIFIC_BACKOUT)$(TINYDTLS_DIR)/libtinydtls.a
$(AR) -q $(OUT_DIR)/$@ $(OBJ_DIR)/tinydtls/*.o
+ endif
endif
endif
OCStackResult
ProcessRequest(ResourceHandling resHandling, OCResource *resource, OCServerRequest *request);
+#ifdef CA_INT
+OCStackResult
+BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
+ char *filterValue, char * out, uint16_t *remaining,
+ CAConnectivityType_t connType );
+#else
OCStackResult
BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
char *filterValue, char * out, uint16_t *remaining);
+#endif
OCStackResult EntityHandlerCodeToOCStackCode(OCEntityHandlerResult ehResult);
CC := g++
OUT_DIR := $(BUILD)
OBJ_DIR := $(OUT_DIR)/obj
+CA_INT_DTLS := 0
ifeq ($(ROOT_DIR), )
ROOT_DIR = ../../../..
OCTBSTACK_DIR = $(ROOT_DIR)/stack
EXTLIBS_DIR = $(ROOT_DIR)/../../extlibs
CJSON_DIR = $(EXTLIBS_DIR)/cjson
-
CJSON_SRC = $(CJSON_DIR)
+CONNECTIVITY_DIR= $(ROOT_DIR)/connectivity
+
OCLOGGER_INC = $(OCLOGGER_DIR)/include
OC_LOG_INC = $(OC_LOG_DIR)/include
INC_DIRS += -I$(CJSON_INC)
CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections -fno-exceptions \
- -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG
+ -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) \
+ -L$(CONNECTIVITY_DIR)/build/out -DTB_LOG
CC_FLAGS.release := -Os -Wall -fdata-sections -Wl,--gc-sections -Wl,-s -fno-exceptions \
- -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG
+ -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) \
+ -L$(CONNECTIVITY_DIR)/build/out -DTB_LOG
LDLIBS += -loctbstack -lpthread
CPPFLAGS += $(CC_FLAGS.$(BUILD)) $(LDLIBS)
+ifeq ($(CA_INT_DTLS),1)
+ CPPFLAGS += -lconnectivity_abstraction -DCA_INT_DTLS
+endif
CJSON_SOURCES := $(CJSON_SRC)/cJSON.c
#define TAG "occlientbasicops"
static int UNICAST_DISCOVERY = 0;
static int TEST_CASE = 0;
+
+#ifdef CA_INT_DTLS
+static int IPV4_ADDR_SIZE = 16;
+#else
static const char * TEST_APP_UNICAST_DISCOVERY_QUERY = "coap://0.0.0.0:5683/oc/core";
+#endif
static std::string putPayload = "{\"state\":\"off\",\"power\":10}";
static std::string coapServerIP;
static std::string coapServerPort;
OC_LOG_V(INFO, TAG, "\n\nExecuting %s", __func__);
std::ostringstream query;
query << (coapSecureResource ? "coaps://" : "coap://") << coapServerIP
- << ":" << coapServerPort << coapServerResource;
+ << ":" << coapServerPort
+#ifdef CA_INT_DTLS
+ << "/"
+#endif
+ << coapServerResource;
return (InvokeOCDoResource(query, OC_REST_PUT, OC_LOW_QOS, putReqCB, NULL, 0));
}
OC_LOG_V(INFO, TAG, "\n\nExecuting %s", __func__);
std::ostringstream query;
query << (coapSecureResource ? "coaps://" : "coap://") << coapServerIP
- << ":" << coapServerPort << coapServerResource;
+ << ":" << coapServerPort
+#ifdef CA_INT_DTLS
+ << "/"
+#endif
+ << coapServerResource;
return (InvokeOCDoResource(query, OC_REST_GET, (qos == OC_HIGH_QOS)?
OC_HIGH_QOS:OC_LOW_QOS, getReqCB, NULL, 0));
OCCallbackData cbData;
OCDoHandle handle;
/* Start a discovery query*/
- char szQueryUri[64] = { 0 };
+ char szQueryUri[MAX_URI_LENGTH] = { 0 };
+
if (UNICAST_DISCOVERY)
{
+#ifdef CA_INT_DTLS
+ char ipv4addr[IPV4_ADDR_SIZE];
+
+ printf("Enter IPv4 address of the Server hosting secure resource (Ex: 11.12.13.14)\n");
+ fgets(ipv4addr, IPV4_ADDR_SIZE, stdin);
+ snprintf(szQueryUri, sizeof(szQueryUri), "coap://%s:5683/oc/core", ipv4addr);
+#else
strcpy(szQueryUri, TEST_APP_UNICAST_DISCOVERY_QUERY);
+#endif
}
else
{
#define SAMPLE_MAX_NUM_POST_INSTANCE 2
static LEDResource gLedInstance[SAMPLE_MAX_NUM_POST_INSTANCE];
+#ifdef CA_INT_DTLS
+char *gResourceUri= (char *)"a/led";
+#else
char *gResourceUri= (char *)"/a/led";
+#endif
static uint16_t OC_WELL_KNOWN_PORT = 5683;
OCResource* temp = collResource->rsrcResources[i];
if (temp)
{
- ret = BuildVirtualResourceResponse(temp, filterOn, filterValue, (char*)ptr, &remaining);
+#ifdef CA_INT
+ //TODO : Update needed here to get correct connectivity type
+ //from ServerRequest data structure
+ ret = BuildVirtualResourceResponse(temp, filterOn, filterValue,
+ (char*)ptr, &remaining, CA_WIFI );
+#else
+ ret = BuildVirtualResourceResponse(temp, filterOn, filterValue,
+ (char*)ptr, &remaining);
+#endif
if (ret != OC_STACK_OK)
{
break;
#include "debug.h"
#include "cJSON.h"
+#ifdef CA_INT
+ #include "cacommon.h"
+ #include "cainterface.h"
+#endif
+
+
/// Module Name
#define TAG PCF("ocresource")
#define VERIFY_SUCCESS(op, successCode) { if (op != successCode) \
return OC_EH_OK; // Making sure that the Default EH and the Vendor EH have matching signatures
}
+#ifdef CA_INT
+/* This method will return the port at which the secure resource is hosted */
+static OCStackResult GetSecurePortInfo(CAConnectivityType_t connType, uint32_t *port)
+{
+ CALocalConnectivity_t* info = NULL;
+ uint32_t size = 0;
+ OCStackResult ret = OC_STACK_ERROR;
+
+ CAResult_t caResult = CAGetNetworkInformation(&info, &size);
+ if ((caResult == CA_STATUS_OK) && info && size)
+ {
+ while (size--)
+ {
+ if (info[size].isSecured == CA_TRUE && info[size].type == connType)
+ {
+ if (info[size].type == CA_ETHERNET ||
+ info[size].type == CA_WIFI)
+ {
+ *port = info[size].addressInfo.IP.port;
+ ret = OC_STACK_OK;
+ break;
+ }
+ }
+ }
+ }
+
+ free(info);
+ return ret;
+}
+#endif
+
static OCStackResult ValidateUrlQuery (unsigned char *url, unsigned char *query,
uint8_t *filterOn, char **filterValue)
{
return OC_STACK_OK;
}
-OCStackResult BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
- char *filterValue, char * out, uint16_t *remaining)
+
+#ifdef CA_INT
+OCStackResult
+BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
+ char *filterValue, char * out, uint16_t *remaining,
+ CAConnectivityType_t connType )
+#else
+OCStackResult
+BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
+ char *filterValue, char * out, uint16_t *remaining)
+#endif
{
OCResourceType *resourceTypePtr;
OCResourceInterface *interfacePtr;
}
// Set secure flag for secure resources
if (resourcePtr->resourceProperties & OC_SECURE) {
- uint16_t port;
cJSON_AddNumberToObject (propObj, OC_RSRVD_SECURE, OC_RESOURCE_SECURE);
//Set the IP port also as secure resources are hosted on a different port
+#ifdef CA_INT
+ uint32_t port;
+ if (GetSecurePortInfo (connType, &port) == OC_STACK_OK) {
+#else
+ uint16_t port;
if (OCGetResourceEndPointInfo (resourcePtr, &port) == OC_STACK_OK) {
+#endif
cJSON_AddNumberToObject (propObj, OC_RSRVD_HOSTING_PORT, port);
}
}
remaining--;
}
firstLoopDone = 1;
+#ifdef CA_INT
+ result = BuildVirtualResourceResponse(resource, filterOn, filterValue,
+ (char*)ptr, &remaining, request->connectivityType );
+#else
result = BuildVirtualResourceResponse(resource, filterOn, filterValue,
(char*)ptr, &remaining);
+#endif
if (result != OC_STACK_OK)
{
responseEndpoint.resourceUri = serverRequest->resourceUrl;
responseEndpoint.addressInfo = serverRequest->addressInfo;
responseEndpoint.connectivityType = serverRequest->connectivityType;
+ responseEndpoint.isSecured = serverRequest->secured;
// Copy the info
switch (ehResponse->ehResult)
// CA does not need the following 3 fields
serverRequest.coapID = 0;
serverRequest.delayedResNeeded = 0;
- serverRequest.secured = 0;
+ serverRequest.secured = endPoint->isSecured;
// copy the address
serverRequest.addressInfo = endPoint->addressInfo;