From 2ef6dbada15be2acb96bcf124e19830bc3efe4d8 Mon Sep 17 00:00:00 2001 From: "jihwan.seo" Date: Tue, 26 Jan 2016 08:24:54 +0900 Subject: [PATCH] replaced OC_LOG with OIC_LOG in security Change-Id: I38ba90586d9ea5fb978c2a1cc8a925dbf1e59f9c Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/4861 Tested-by: jenkins-iotivity Reviewed-by: Jon A. Cruz --- resource/csdk/security/include/srmutility.h | 4 +- .../provisioning/ck_manager/sample/Door_sample.cpp | 92 ++++---- .../ck_manager/sample/Light_sample.cpp | 32 +-- .../ck_manager/sample/provisioningclient.c | 46 ++-- .../csdk/security/provisioning/include/pmutility.h | 2 +- .../provisioning/sample/provisioningclient.c | 118 +++++----- .../provisioning/sample/sampleserver_justworks.cpp | 40 ++-- .../provisioning/sample/sampleserver_randompin.cpp | 48 ++-- .../provisioning/src/credentialgenerator.c | 36 +-- .../provisioning/src/ocprovisioningmanager.c | 80 +++---- .../provisioning/src/ownershiptransfermanager.c | 230 +++++++++---------- .../csdk/security/provisioning/src/oxmjustworks.c | 20 +- .../csdk/security/provisioning/src/oxmrandompin.c | 24 +- .../csdk/security/provisioning/src/pmutility.c | 102 ++++----- .../provisioning/src/provisioningdatabasemanager.c | 116 +++++----- .../provisioning/src/secureresourceprovider.c | 244 ++++++++++----------- resource/csdk/security/src/aclresource.c | 20 +- resource/csdk/security/src/amaclresource.c | 8 +- resource/csdk/security/src/amsmgr.c | 60 ++--- resource/csdk/security/src/credresource.c | 22 +- resource/csdk/security/src/crlresource.c | 18 +- resource/csdk/security/src/doxmresource.c | 36 +-- resource/csdk/security/src/oxmpincommon.c | 20 +- resource/csdk/security/src/pbkdf2.c | 6 +- resource/csdk/security/src/policyengine.c | 24 +- resource/csdk/security/src/psinterface.c | 10 +- resource/csdk/security/src/pstatresource.c | 16 +- resource/csdk/security/src/resourcemanager.c | 2 +- resource/csdk/security/src/secureresourcemanager.c | 44 ++-- resource/csdk/security/src/srmutility.c | 4 +- resource/csdk/security/src/svcresource.c | 10 +- .../csdk/security/unittest/credentialresource.cpp | 16 +- resource/csdk/security/unittest/doxmresource.cpp | 2 +- .../csdk/security/unittest/iotvticalendartest.cpp | 52 ++--- 34 files changed, 802 insertions(+), 802 deletions(-) diff --git a/resource/csdk/security/include/srmutility.h b/resource/csdk/security/include/srmutility.h index b14d469..d6861e3 100644 --- a/resource/csdk/security/include/srmutility.h +++ b/resource/csdk/security/include/srmutility.h @@ -65,7 +65,7 @@ struct OicParseQueryIter * */ #define VERIFY_SUCCESS(tag, op, logLevel) do{ if (!(op)) \ - {OC_LOG((logLevel), tag, #op " failed!!"); goto exit; } }while(0) + {OIC_LOG((logLevel), tag, #op " failed!!"); goto exit; } }while(0) /** * @def VERIFY_NON_NULL @@ -75,7 +75,7 @@ struct OicParseQueryIter * */ #define VERIFY_NON_NULL(tag, arg, logLevel) do{ if (NULL == (arg)) \ - { OC_LOG((logLevel), tag, #arg " is NULL"); goto exit; } }while(0) + { OIC_LOG((logLevel), tag, #arg " is NULL"); goto exit; } }while(0) /** * This method initializes the OicParseQueryIter_t struct diff --git a/resource/csdk/security/provisioning/ck_manager/sample/Door_sample.cpp b/resource/csdk/security/provisioning/ck_manager/sample/Door_sample.cpp index 2f2bdbd..ca1df02 100755 --- a/resource/csdk/security/provisioning/ck_manager/sample/Door_sample.cpp +++ b/resource/csdk/security/provisioning/ck_manager/sample/Door_sample.cpp @@ -98,7 +98,7 @@ int parseClientResponse(OCClientResponse * clientResponse) while (res) { coapServerResource.assign(res->uri); - OC_LOG_V(INFO, TAG, "Uri -- %s", coapServerResource.c_str()); + OIC_LOG_V(INFO, TAG, "Uri -- %s", coapServerResource.c_str()); if (res->secure) { @@ -106,7 +106,7 @@ int parseClientResponse(OCClientResponse * clientResponse) coapSecureResource = 1; } - OC_LOG_V(INFO, TAG, "Secure -- %s", coapSecureResource == 1 ? "YES" : "NO"); + OIC_LOG_V(INFO, TAG, "Secure -- %s", coapSecureResource == 1 ? "YES" : "NO"); // If we discovered a secure resource, exit from here if (coapSecureResource) @@ -125,7 +125,7 @@ OCRepPayload* getPayload(const char* uri, int64_t state, char* openDuration, boo OCRepPayload* payload = OCRepPayloadCreate(); if (!payload) { - OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); + OIC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); return nullptr; } @@ -142,7 +142,7 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) { if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, TAG, PCF("Incoming payload not a representation")); + OIC_LOG(ERROR, TAG, PCF("Incoming payload not a representation")); return nullptr; } @@ -171,7 +171,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, OCEntityHandlerRequest *entityHandlerRequest, void* /*callbackParam*/) { - OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); + OIC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); OCEntityHandlerResult ehResult = OC_EH_ERROR; OCEntityHandlerResponse response; @@ -179,7 +179,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, // Validate pointer if (!entityHandlerRequest) { - OC_LOG (ERROR, TAG, "Invalid request pointer"); + OIC_LOG (ERROR, TAG, "Invalid request pointer"); return OC_EH_ERROR; } @@ -187,7 +187,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); if (entityHandlerRequest) { @@ -195,13 +195,13 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, { case OC_REST_GET: { - OC_LOG (INFO, TAG, "Received OC_REST_GET from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_GET from client"); ehResult = ProcessGetRequest (entityHandlerRequest, &payload); } break; default: { - OC_LOG_V (INFO, TAG, "Received unsupported method %d from client", + OIC_LOG_V (INFO, TAG, "Received unsupported method %d from client", entityHandlerRequest->method); ehResult = OC_EH_ERROR; } @@ -224,7 +224,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, // Send the response if (OCDoResponse(&response) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Error sending response"); + OIC_LOG(ERROR, TAG, "Error sending response"); ehResult = OC_EH_ERROR; } } @@ -331,7 +331,7 @@ int createDoorResource (const char *uri, DoorResource *doorResource) { if (!uri) { - OC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); + OIC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); } @@ -347,7 +347,7 @@ int createDoorResource (const char *uri, DoorResource *doorResource) NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE); - OC_LOG_V(INFO, TAG, "Created Door resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, TAG, "Created Door resource with result: %s", getResult(res)); return 0; } @@ -355,17 +355,17 @@ OCStackApplicationResult putReqCB(void * ctx, OCDoHandle /*handle*/, OCClientRes { if (ctx == (void *)DEFAULT_CONTEXT_VALUE) { - OC_LOG(INFO, TAG, "Callback Context for PUT recvd successfully"); + OIC_LOG(INFO, TAG, "Callback Context for PUT recvd successfully"); } if (clientResponse) { - OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); - OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OIC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); + OIC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); + OIC_LOG_PAYLOAD(INFO, clientResponse->payload); if ((OCSecurityPayload*)clientResponse->payload) { - OC_LOG_V(INFO, TAG, "=============> Put Response", + OIC_LOG_V(INFO, TAG, "=============> Put Response", ((OCSecurityPayload*)clientResponse->payload)->securityData); } } @@ -374,16 +374,16 @@ OCStackApplicationResult putReqCB(void * ctx, OCDoHandle /*handle*/, OCClientRes OCStackApplicationResult getReqCB(void * /*ctx*/, OCDoHandle /*handle*/, OCClientResponse *clientResponse) { - OC_LOG(INFO, TAG, "Callback Context for GET query recvd successfully"); + OIC_LOG(INFO, TAG, "Callback Context for GET query recvd successfully"); if (clientResponse) { - OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); - OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OIC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); + OIC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); + OIC_LOG_PAYLOAD(INFO, clientResponse->payload); if ((OCSecurityPayload*)clientResponse->payload) { - OC_LOG(INFO, TAG, PCF("=============> Get Response")); + OIC_LOG(INFO, TAG, PCF("=============> Get Response")); } } return OC_STACK_DELETE_TRANSACTION; @@ -393,19 +393,19 @@ OCStackApplicationResult getReqCB(void * /*ctx*/, OCDoHandle /*handle*/, OCClien OCStackApplicationResult discoveryReqCB(void* /*ctx*/, OCDoHandle /*handle*/, OCClientResponse * clientResponse) { - OC_LOG(INFO, TAG, "Callback Context for DISCOVER query recvd successfully"); + OIC_LOG(INFO, TAG, "Callback Context for DISCOVER query recvd successfully"); if (clientResponse) { - OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_V(INFO, TAG, + OIC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); + OIC_LOG_V(INFO, TAG, "Device =============> Discovered @ %s:%d", clientResponse->devAddr.addr, clientResponse->devAddr.port); if (clientResponse->result == OC_STACK_OK) { - OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OIC_LOG_PAYLOAD(INFO, clientResponse->payload); ocConnType = clientResponse->connType; parseClientResponse(clientResponse); } @@ -422,9 +422,9 @@ void initAddress() static bool initFlag = false; if (!initFlag) { - OC_LOG(INFO, TAG, "Enter IP address (with optional port) of the Server hosting resource\n"); - OC_LOG(INFO, TAG, "IPv4: 192.168.0.15:45454\n"); - OC_LOG(INFO, TAG, "IPv6: [fe80::20c:29ff:fe1b:9c5]:45454\n"); + OIC_LOG(INFO, TAG, "Enter IP address (with optional port) of the Server hosting resource\n"); + OIC_LOG(INFO, TAG, "IPv4: 192.168.0.15:45454\n"); + OIC_LOG(INFO, TAG, "IPv6: [fe80::20c:29ff:fe1b:9c5]:45454\n"); std::cin >> address; } @@ -435,7 +435,7 @@ void initAddress() void SendGetRequest() { OCStackResult ret; - OC_LOG(INFO, TAG, "Send Get REQ to Light server"); + OIC_LOG(INFO, TAG, "Send Get REQ to Light server"); initAddress(); @@ -445,13 +445,13 @@ void SendGetRequest() cbData.cb = getReqCB; cbData.context = (void *)DEFAULT_CONTEXT_VALUE; cbData.cd = NULL; - OC_LOG_V(INFO, TAG, "Get payload from Door sample = /a/light "); + OIC_LOG_V(INFO, TAG, "Get payload from Door sample = /a/light "); snprintf(szQueryUri, sizeof(szQueryUri), "coaps://%s/a/light", const_cast (address.c_str())); // lightPortNu); ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, NULL, ocConnType, OC_LOW_QOS, &cbData, NULL, 0); if (ret != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); } } @@ -477,7 +477,7 @@ void *input_function(void * /*data*/) case 'd': if (isUpdated == false) { - OC_LOG(INFO, TAG, "isUpdated is false..."); + OIC_LOG(INFO, TAG, "isUpdated is false..."); OCDoResource(&handle, OC_REST_DISCOVER, szQueryUri, 0, 0, CT_DEFAULT, OC_LOW_QOS, &cbData, NULL, 0); } @@ -487,7 +487,7 @@ void *input_function(void * /*data*/) isUpdated = true; if (isUpdated == true) { - OC_LOG(INFO, TAG, "isUpdated is true..."); + OIC_LOG(INFO, TAG, "isUpdated is true..."); SendGetRequest(); } break; @@ -503,22 +503,22 @@ void *input_function(void * /*data*/) static void PrintUsage() { - OC_LOG(INFO, TAG, "*******************************************"); - OC_LOG(INFO, TAG, "Input D or d to discover Resources"); - OC_LOG(INFO, TAG, "Input G or g to initiate Get Request"); - OC_LOG(INFO, TAG, "Input Q or q to exit"); - OC_LOG(INFO, TAG, "*******************************************"); + OIC_LOG(INFO, TAG, "*******************************************"); + OIC_LOG(INFO, TAG, "Input D or d to discover Resources"); + OIC_LOG(INFO, TAG, "Input G or g to initiate Get Request"); + OIC_LOG(INFO, TAG, "Input Q or q to exit"); + OIC_LOG(INFO, TAG, "*******************************************"); } int main() { - OC_LOG(INFO, TAG, "OCServer is starting..."); + OIC_LOG(INFO, TAG, "OCServer is starting..."); SetPersistentHandler(&ps); //PrintUsage(); if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack init error"); + OIC_LOG(ERROR, TAG, "OCStack init error"); return 0; } @@ -536,14 +536,14 @@ int main() timeout.tv_nsec = 100000000L; // Break from loop with Ctrl-C - OC_LOG(INFO, TAG, "Entering ocserver main loop..."); + OIC_LOG(INFO, TAG, "Entering ocserver main loop..."); signal(SIGINT, handleSigInt); int thr_id; pthread_t p_thread; thr_id = pthread_create(&p_thread, NULL, input_function, (void *)NULL); if (thr_id < 0) { - OC_LOG(ERROR, TAG, "create thread error"); + OIC_LOG(ERROR, TAG, "create thread error"); return 0; } @@ -552,7 +552,7 @@ int main() if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); return 0; } @@ -562,11 +562,11 @@ int main() pthread_join(p_thread, NULL); - OC_LOG(INFO, TAG, "Exiting ocserver main loop..."); + OIC_LOG(INFO, TAG, "Exiting ocserver main loop..."); if (OCStop() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); } return 0; diff --git a/resource/csdk/security/provisioning/ck_manager/sample/Light_sample.cpp b/resource/csdk/security/provisioning/ck_manager/sample/Light_sample.cpp index 9a3f82e..bed8d16 100755 --- a/resource/csdk/security/provisioning/ck_manager/sample/Light_sample.cpp +++ b/resource/csdk/security/provisioning/ck_manager/sample/Light_sample.cpp @@ -61,7 +61,7 @@ OCRepPayload* getPayload(const char* uri, int64_t brightness) OCRepPayload* payload = OCRepPayloadCreate(); if(!payload) { - OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); + OIC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); return nullptr; } @@ -81,7 +81,7 @@ OCRepPayload* constructResponse(OCEntityHandlerRequest *ehRequest) if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, TAG, PCF("Incoming payload not a representation")); + OIC_LOG(ERROR, TAG, PCF("Incoming payload not a representation")); return nullptr; } @@ -109,7 +109,7 @@ OCEntityHandlerResult OCEntityHandlerCb (OCEntityHandlerFlag flag, OCEntityHandlerRequest *entityHandlerRequest, void* /*callbackParam*/) { - OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); + OIC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); OCEntityHandlerResult ehResult = OC_EH_ERROR; OCEntityHandlerResponse response; @@ -117,7 +117,7 @@ OCEntityHandlerResult OCEntityHandlerCb (OCEntityHandlerFlag flag, // Validate pointer if (!entityHandlerRequest) { - OC_LOG (ERROR, TAG, "Invalid request pointer"); + OIC_LOG (ERROR, TAG, "Invalid request pointer"); return OC_EH_ERROR; } @@ -125,20 +125,20 @@ OCEntityHandlerResult OCEntityHandlerCb (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); if (entityHandlerRequest) { switch(entityHandlerRequest->method) { case OC_REST_GET: { - OC_LOG (INFO, TAG, "Received OC_REST_GET from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_GET from client"); ehResult = ProcessGetRequest (entityHandlerRequest, &payload); } break; default: { - OC_LOG_V (INFO, TAG, "Received unsupported method %d from client", + OIC_LOG_V (INFO, TAG, "Received unsupported method %d from client", entityHandlerRequest->method); ehResult = OC_EH_ERROR; } @@ -161,7 +161,7 @@ OCEntityHandlerResult OCEntityHandlerCb (OCEntityHandlerFlag flag, // Send the response if (OCDoResponse(&response) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Error sending response"); + OIC_LOG(ERROR, TAG, "Error sending response"); ehResult = OC_EH_ERROR; } } @@ -270,7 +270,7 @@ int createLightResource (const char *uri, LightResource *lightResource) { if (!uri) { - OC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); + OIC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); } @@ -283,18 +283,18 @@ int createLightResource (const char *uri, LightResource *lightResource) NULL, OC_DISCOVERABLE|OC_OBSERVABLE | OC_SECURE); - OC_LOG_V(INFO, TAG, "Created Light resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, TAG, "Created Light resource with result: %s", getResult(res)); return 0; } int main() { - OC_LOG(DEBUG, TAG, "OCServer is starting..."); + OIC_LOG(DEBUG, TAG, "OCServer is starting..."); SetPersistentHandler(&ps); if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack init error"); + OIC_LOG(ERROR, TAG, "OCStack init error"); return 0; } @@ -310,24 +310,24 @@ int main() timeout.tv_nsec = 100000000L; // Break from loop with Ctrl-C - OC_LOG(INFO, TAG, "Entering ocserver main loop..."); + OIC_LOG(INFO, TAG, "Entering ocserver main loop..."); signal(SIGINT, handleSigInt); while (!gQuitFlag) { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); return 0; } nanosleep(&timeout, NULL); } - OC_LOG(INFO, TAG, "Exiting ocserver main loop..."); + OIC_LOG(INFO, TAG, "Exiting ocserver main loop..."); if (OCStop() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); } return 0; diff --git a/resource/csdk/security/provisioning/ck_manager/sample/provisioningclient.c b/resource/csdk/security/provisioning/ck_manager/sample/provisioningclient.c index 972a373..6fec1da 100644 --- a/resource/csdk/security/provisioning/ck_manager/sample/provisioningclient.c +++ b/resource/csdk/security/provisioning/ck_manager/sample/provisioningclient.c @@ -222,7 +222,7 @@ static int InputACL(OicSecAcl_t *acl) acl->resources = (char **)OICCalloc(acl->resourcesLen, sizeof(char *)); if (NULL == acl->resources) { - OC_LOG(ERROR, TAG, "Error while memory allocation"); + OIC_LOG(ERROR, TAG, "Error while memory allocation"); return -1; } for (size_t i = 0; i < acl->resourcesLen; i++) @@ -244,7 +244,7 @@ static int InputACL(OicSecAcl_t *acl) if (NULL == acl->resources[i]) { - OC_LOG(ERROR, TAG, "Error while memory allocation"); + OIC_LOG(ERROR, TAG, "Error while memory allocation"); return -1; } } @@ -277,7 +277,7 @@ static int InputACL(OicSecAcl_t *acl) acl->owners = (OicUuid_t *)OICCalloc(acl->ownersLen, sizeof(OicUuid_t)); if (NULL == acl->owners) { - OC_LOG(ERROR, TAG, "Error while memory allocation"); + OIC_LOG(ERROR, TAG, "Error while memory allocation"); return -1; } for (size_t i = 0; i < acl->ownersLen; i++) @@ -493,12 +493,12 @@ int main() if (OC_STACK_OK != OCInit(NULL, 0, OC_CLIENT_SERVER)) { - OC_LOG(ERROR, TAG, "OCStack init error"); + OIC_LOG(ERROR, TAG, "OCStack init error"); goto error; } if(OC_STACK_OK != OCInitPM(PRVN_DB_FILE_NAME)) { - OC_LOG(ERROR, TAG, "OC_PM init error"); + OIC_LOG(ERROR, TAG, "OC_PM init error"); goto error; } @@ -506,7 +506,7 @@ int main() res = OCDiscoverUnownedDevices(PREDEFINED_TIMEOUT, &pDeviceList); if(OC_STACK_OK != res) { - OC_LOG_V(ERROR, TAG, "Failed to PMDeviceDiscovery : %d", res); + OIC_LOG_V(ERROR, TAG, "Failed to PMDeviceDiscovery : %d", res); goto error; } @@ -538,11 +538,11 @@ int main() res = OCDoOwnershipTransfer((void*)myContext, pDeviceList, OwnershipTransferCB); if(OC_STACK_OK == res) { - OC_LOG(INFO, TAG, "Request for ownership transfer is sent successfully."); + OIC_LOG(INFO, TAG, "Request for ownership transfer is sent successfully."); } else { - OC_LOG_V(ERROR, TAG, "Failed to OCDoOwnershipTransfer : %d", res); + OIC_LOG_V(ERROR, TAG, "Failed to OCDoOwnershipTransfer : %d", res); } gOwnershipState = 0; @@ -550,7 +550,7 @@ int main() { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); goto error; } sleep(1); @@ -581,7 +581,7 @@ int main() } else { - OC_LOG(ERROR, TAG, "Error while Owned Device Discovery"); + OIC_LOG(ERROR, TAG, "Error while Owned Device Discovery"); } int Device1 = 0; @@ -597,13 +597,13 @@ int main() gAcl = (OicSecAcl_t *)OICCalloc(1,sizeof(OicSecAcl_t)); if (NULL == gAcl) { - OC_LOG(ERROR, TAG, "Error while memory allocation"); + OIC_LOG(ERROR, TAG, "Error while memory allocation"); goto error; } if (PKI_SUCCESS != InitCA()) { - OC_LOG(ERROR, TAG, "CA init error"); + OIC_LOG(ERROR, TAG, "CA init error"); goto error; } @@ -612,13 +612,13 @@ int main() res = OCProvisionCredentials(ctx, SIGNED_ASYMMETRIC_KEY, 0, pOwnedDevices[Device1], NULL, ProvisionCertCB); - if (OC_STACK_OK != res) OC_LOG_V(ERROR, TAG, "Failed to provision Device 1 : %d", res); + if (OC_STACK_OK != res) OIC_LOG_V(ERROR, TAG, "Failed to provision Device 1 : %d", res); gOwnershipState = 0; while ( gOwnershipState == 0 ) { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); goto error; } sleep(1); @@ -628,7 +628,7 @@ int main() NULL, ProvisionCertCB); if (OC_STACK_OK != res) { - OC_LOG_V(ERROR, TAG, "Failed to provision Device 2 : %d", res); + OIC_LOG_V(ERROR, TAG, "Failed to provision Device 2 : %d", res); } gOwnershipState = 0; @@ -636,7 +636,7 @@ int main() { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); goto error; } sleep(1); @@ -649,13 +649,13 @@ int main() } else { - OC_LOG(ERROR, TAG, "InputACL error"); + OIC_LOG(ERROR, TAG, "InputACL error"); goto error; } res = OCProvisionACL(ctx, pOwnedDevices[Device2], gAcl, &ProvisionAclCB); if (OC_STACK_OK != res) { - OC_LOG_V(ERROR, TAG, "Failed to ACL provision Device 2 : %d", res); + OIC_LOG_V(ERROR, TAG, "Failed to ACL provision Device 2 : %d", res); } gOwnershipState = 0; @@ -663,7 +663,7 @@ int main() { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); goto error; } sleep(1); @@ -671,21 +671,21 @@ int main() gCrl = (OicSecCrl_t *)OICMalloc(sizeof(OicSecCrl_t)); if (PKI_SUCCESS != InputCRL(gCrl)) { - OC_LOG(ERROR, TAG, "CA init error"); + OIC_LOG(ERROR, TAG, "CA init error"); goto error; } PRINT_BYTE_ARRAY("gCrl = \n", gCrl->CrlData); res = OCProvisionCRL(ctx, pOwnedDevices[Device2], gCrl, &ProvisionCrlCB); - if (OC_STACK_OK != res) OC_LOG_V(ERROR, TAG, "Failed to CRL provision Device 2 : %d", res); + if (OC_STACK_OK != res) OIC_LOG_V(ERROR, TAG, "Failed to CRL provision Device 2 : %d", res); gOwnershipState = 0; while (gOwnershipState == 0) { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); goto error; } sleep(1); @@ -693,7 +693,7 @@ int main() if (OCStop() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); goto error; } diff --git a/resource/csdk/security/provisioning/include/pmutility.h b/resource/csdk/security/provisioning/include/pmutility.h index 15a5f8e..c36b204 100644 --- a/resource/csdk/security/provisioning/include/pmutility.h +++ b/resource/csdk/security/provisioning/include/pmutility.h @@ -96,7 +96,7 @@ bool PMGenerateQuery(bool isSecure, /** * Function to print OCProvisionDev_t for debug purpose. * - * @param[in] pDev Pointer to OCProvisionDev_t. It's information will be printed by OC_LOG_XX + * @param[in] pDev Pointer to OCProvisionDev_t. It's information will be printed by OIC_LOG_XX * */ void PMPrintOCProvisionDev(const OCProvisionDev_t* pDev); diff --git a/resource/csdk/security/provisioning/sample/provisioningclient.c b/resource/csdk/security/provisioning/sample/provisioningclient.c index 75eb699..1c63d45 100644 --- a/resource/csdk/security/provisioning/sample/provisioningclient.c +++ b/resource/csdk/security/provisioning/sample/provisioningclient.c @@ -90,11 +90,11 @@ static void ownershipTransferCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, { if(!hasError) { - OC_LOG_V(INFO, TAG, "Ownership Transfer SUCCEEDED - ctx: %s", (char*) ctx); + OIC_LOG_V(INFO, TAG, "Ownership Transfer SUCCEEDED - ctx: %s", (char*) ctx); } else { - OC_LOG_V(ERROR, TAG, "Ownership Transfer FAILED - ctx: %s", (char*) ctx); + OIC_LOG_V(ERROR, TAG, "Ownership Transfer FAILED - ctx: %s", (char*) ctx); printResultList((const OCProvisionResult_t*) arr, nOfRes); } g_doneCB = true; @@ -104,11 +104,11 @@ static void provisionPairwiseCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, { if(!hasError) { - OC_LOG_V(INFO, TAG, "Provision Pairwise SUCCEEDED - ctx: %s", (char*) ctx); + OIC_LOG_V(INFO, TAG, "Provision Pairwise SUCCEEDED - ctx: %s", (char*) ctx); } else { - OC_LOG_V(ERROR, TAG, "Provision Pairwise FAILED - ctx: %s", (char*) ctx); + OIC_LOG_V(ERROR, TAG, "Provision Pairwise FAILED - ctx: %s", (char*) ctx); printResultList((const OCProvisionResult_t*) arr, nOfRes); } g_doneCB = true; @@ -118,11 +118,11 @@ static void provisionCredCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, boo { if(!hasError) { - OC_LOG_V(INFO, TAG, "Provision Credential SUCCEEDED - ctx: %s", (char*) ctx); + OIC_LOG_V(INFO, TAG, "Provision Credential SUCCEEDED - ctx: %s", (char*) ctx); } else { - OC_LOG_V(ERROR, TAG, "Provision Credential FAILED - ctx: %s", (char*) ctx); + OIC_LOG_V(ERROR, TAG, "Provision Credential FAILED - ctx: %s", (char*) ctx); printResultList((const OCProvisionResult_t*) arr, nOfRes); } g_doneCB = true; @@ -132,11 +132,11 @@ static void provisionAclCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool { if(!hasError) { - OC_LOG_V(INFO, TAG, "Provision ACL SUCCEEDED - ctx: %s", (char*) ctx); + OIC_LOG_V(INFO, TAG, "Provision ACL SUCCEEDED - ctx: %s", (char*) ctx); } else { - OC_LOG_V(ERROR, TAG, "Provision ACL FAILED - ctx: %s", (char*) ctx); + OIC_LOG_V(ERROR, TAG, "Provision ACL FAILED - ctx: %s", (char*) ctx); printResultList((const OCProvisionResult_t*) arr, nOfRes); } g_doneCB = true; @@ -146,11 +146,11 @@ static void unlinkDevicesCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, boo { if(!hasError) { - OC_LOG_V(INFO, TAG, "Unlink Devices SUCCEEDED - ctx: %s", (char*) ctx); + OIC_LOG_V(INFO, TAG, "Unlink Devices SUCCEEDED - ctx: %s", (char*) ctx); } else { - OC_LOG_V(ERROR, TAG, "Unlink Devices FAILED - ctx: %s", (char*) ctx); + OIC_LOG_V(ERROR, TAG, "Unlink Devices FAILED - ctx: %s", (char*) ctx); printResultList((const OCProvisionResult_t*) arr, nOfRes); } g_doneCB = true; @@ -160,11 +160,11 @@ static void removeDeviceCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool { if(!hasError) { - OC_LOG_V(INFO, TAG, "Remove Device SUCCEEDED - ctx: %s", (char*) ctx); + OIC_LOG_V(INFO, TAG, "Remove Device SUCCEEDED - ctx: %s", (char*) ctx); } else { - OC_LOG_V(ERROR, TAG, "Remove Device FAILED - ctx: %s", (char*) ctx); + OIC_LOG_V(ERROR, TAG, "Remove Device FAILED - ctx: %s", (char*) ctx); printResultList((const OCProvisionResult_t*) arr, nOfRes); } g_doneCB = true; @@ -174,7 +174,7 @@ static void inputPinCB(char* pin, size_t len) { if(!pin || OXM_RANDOM_PIN_SIZE>=len) { - OC_LOG(ERROR, TAG, "inputPinCB invalid parameters"); + OIC_LOG(ERROR, TAG, "inputPinCB invalid parameters"); return; } @@ -201,14 +201,14 @@ static int initProvisionClient(void) }; if(OC_STACK_OK != OCRegisterPersistentStorageHandler(&pstStr)) { - OC_LOG(ERROR, TAG, "OCRegisterPersistentStorageHandler error"); + OIC_LOG(ERROR, TAG, "OCRegisterPersistentStorageHandler error"); return -1; } // initialize OC stack and provisioning manager if(OC_STACK_OK != OCInit(NULL, 0, OC_CLIENT_SERVER)) { - OC_LOG(ERROR, TAG, "OCStack init error"); + OIC_LOG(ERROR, TAG, "OCStack init error"); return -1; } @@ -227,7 +227,7 @@ static int initProvisionClient(void) if(OC_STACK_OK != OCInitPM(PRVN_DB_FILE_NAME)) { - OC_LOG(ERROR, TAG, "OC_PM init error"); + OIC_LOG(ERROR, TAG, "OC_PM init error"); return -1; } @@ -241,7 +241,7 @@ static int initProvisionClient(void) }; if(OC_STACK_OK != OCSetOwnerTransferCallbackData(OIC_JUST_WORKS, &otmcb)) { - OC_LOG(ERROR, TAG, "OCSetOwnerTransferCallbackData error: OIC_JUST_WORKS"); + OIC_LOG(ERROR, TAG, "OCSetOwnerTransferCallbackData error: OIC_JUST_WORKS"); return -1; } otmcb.loadSecretCB = InputPinCodeCallback; @@ -250,7 +250,7 @@ static int initProvisionClient(void) otmcb.createOwnerTransferPayloadCB = CreatePinBasedOwnerTransferPayload; if(OC_STACK_OK != OCSetOwnerTransferCallbackData(OIC_RANDOM_DEVICE_PIN, &otmcb)) { - OC_LOG(ERROR, TAG, "OCSetOwnerTransferCallbackData error: OIC_RANDOM_DEVICE_PIN"); + OIC_LOG(ERROR, TAG, "OCSetOwnerTransferCallbackData error: OIC_RANDOM_DEVICE_PIN"); return -1; } SetInputPinCB(inputPinCB); @@ -276,7 +276,7 @@ static int discoverAllDevices(void) printf(" Discovering All Un/Owned Devices on Network..\n"); if(OC_STACK_OK != OCGetDevInfoFromNetwork(DISCOVERY_TIMEOUT, &g_own_list, &g_unown_list)) { - OC_LOG(ERROR, TAG, "OCGetDevInfoFromNetwork API error"); + OIC_LOG(ERROR, TAG, "OCGetDevInfoFromNetwork API error"); return -1; } @@ -303,7 +303,7 @@ static int discoverUnownedDevices(void) printf(" Discovering Only Unowned Devices on Network..\n"); if(OC_STACK_OK != OCDiscoverUnownedDevices(DISCOVERY_TIMEOUT, &g_unown_list)) { - OC_LOG(ERROR, TAG, "OCDiscoverUnownedDevices API error"); + OIC_LOG(ERROR, TAG, "OCDiscoverUnownedDevices API error"); return -1; } @@ -327,7 +327,7 @@ static int discoverOwnedDevices(void) printf(" Discovering Only Owned Devices on Network..\n"); if(OC_STACK_OK != OCDiscoverOwnedDevices(DISCOVERY_TIMEOUT, &g_own_list)) { - OC_LOG(ERROR, TAG, "OCDiscoverOwnedDevices API error"); + OIC_LOG(ERROR, TAG, "OCDiscoverOwnedDevices API error"); return -1; } @@ -356,12 +356,12 @@ static int registerDevices(void) OCStackResult rst = OCDoOwnershipTransfer((void*) g_ctx, g_unown_list, ownershipTransferCB); if(OC_STACK_OK != rst) { - OC_LOG_V(ERROR, TAG, "OCDoOwnershipTransfer API error: %d", rst); + OIC_LOG_V(ERROR, TAG, "OCDoOwnershipTransfer API error: %d", rst); return -1; } if(waitCallbackRet()) // input |g_doneCB| flag implicitly { - OC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); + OIC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); return -1; } @@ -386,7 +386,7 @@ static int provisionPairwise(void) int dev_num[2] = {0}; if(selectTwoDiffNum(&(dev_num[0]), &(dev_num[1]), g_own_cnt, "for Linking Devices")) { - OC_LOG(ERROR, TAG, "selectTwoDiffNum error return"); + OIC_LOG(ERROR, TAG, "selectTwoDiffNum error return"); return -1; // not need to 'goto' |ERROR| before allocating |acl| } @@ -397,7 +397,7 @@ static int provisionPairwise(void) acl[i] = createAcl(dev_num[i]); if(!acl[i]) { - OC_LOG(ERROR, TAG, "createAcl error return"); + OIC_LOG(ERROR, TAG, "createAcl error return"); goto PVPWS_ERROR; } } @@ -415,12 +415,12 @@ static int provisionPairwise(void) provisionPairwiseCB); if(OC_STACK_OK != rst) { - OC_LOG_V(ERROR, TAG, "OCProvisionPairwiseDevices API error: %d", rst); + OIC_LOG_V(ERROR, TAG, "OCProvisionPairwiseDevices API error: %d", rst); goto PVPWS_ERROR; } if(waitCallbackRet()) // input |g_doneCB| flag implicitly { - OC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); + OIC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); goto PVPWS_ERROR; } OCDeleteACLList(acl[0]); @@ -452,7 +452,7 @@ static int provisionCred(void) int dev_num[2] = {0}; if(selectTwoDiffNum(&(dev_num[0]), &(dev_num[1]), g_own_cnt, "for Linking CRED(s)")) { - OC_LOG(ERROR, TAG, "selectTwoDiffNum error return"); + OIC_LOG(ERROR, TAG, "selectTwoDiffNum error return"); return -1; } @@ -502,12 +502,12 @@ static int provisionCred(void) provisionCredCB); if(OC_STACK_OK != rst) { - OC_LOG_V(ERROR, TAG, "OCProvisionCredentials API error: %d", rst); + OIC_LOG_V(ERROR, TAG, "OCProvisionCredentials API error: %d", rst); return -1; } if(waitCallbackRet()) // input |g_doneCB| flag implicitly { - OC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); + OIC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); return -1; } @@ -551,7 +551,7 @@ static int provisionAcl(void) acl = createAcl(dev_num); if(!acl) { - OC_LOG(ERROR, TAG, "createAcl error return"); + OIC_LOG(ERROR, TAG, "createAcl error return"); goto PVACL_ERROR; } @@ -566,12 +566,12 @@ static int provisionAcl(void) acl, provisionAclCB); if(OC_STACK_OK != rst) { - OC_LOG_V(ERROR, TAG, "OCProvisionACL API error: %d", rst); + OIC_LOG_V(ERROR, TAG, "OCProvisionACL API error: %d", rst); goto PVACL_ERROR; } if(waitCallbackRet()) // input |g_doneCB| flag implicitly { - OC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); + OIC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); goto PVACL_ERROR; } OCDeleteACLList(acl); // after here |acl| points nothing @@ -623,7 +623,7 @@ static int checkLinkedStatus(void) &getDevInst((const OCProvisionDev_t*) g_own_list, dev_num)->doxm->deviceID, &dvid_lst, &dvid_cnt)) // allow empty list { - OC_LOG(ERROR, TAG, "OCGetLinkedStatus API error"); + OIC_LOG(ERROR, TAG, "OCGetLinkedStatus API error"); goto CKLST_ERROR; } @@ -636,7 +636,7 @@ static int checkLinkedStatus(void) } if(dvid_cnt != printUuidList((const OCUuidList_t*) dvid_lst)) { - OC_LOG(ERROR, TAG, "printUuidList error return"); + OIC_LOG(ERROR, TAG, "printUuidList error return"); goto CKLST_ERROR; } OCDeleteUuidList(dvid_lst); @@ -662,7 +662,7 @@ static int unlinkPairwise(void) int dev_num[2] = {0}; if(selectTwoDiffNum(&(dev_num[0]), &(dev_num[1]), g_own_cnt, "for Unlinking Devices")) { - OC_LOG(ERROR, TAG, "selectTwoDiffNum error return"); + OIC_LOG(ERROR, TAG, "selectTwoDiffNum error return"); return -1; } @@ -678,12 +678,12 @@ static int unlinkPairwise(void) unlinkDevicesCB); if(OC_STACK_OK != rst) { - OC_LOG_V(ERROR, TAG, "OCUnlinkDevices API error: %d", rst); + OIC_LOG_V(ERROR, TAG, "OCUnlinkDevices API error: %d", rst); return -1; } if(waitCallbackRet()) // input |g_doneCB| flag implicitly { - OC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); + OIC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); return -1; } @@ -732,12 +732,12 @@ static int removeDevice(void) getDevInst((const OCProvisionDev_t*) g_own_list, dev_num), removeDeviceCB); if(OC_STACK_OK != rst) { - OC_LOG_V(ERROR, TAG, "OCRemoveDevice API error: %d", rst); + OIC_LOG_V(ERROR, TAG, "OCRemoveDevice API error: %d", rst); return -1; } if(waitCallbackRet()) // input |g_doneCB| flag implicitly { - OC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); + OIC_LOG(ERROR, TAG, "OCProvisionCredentials callback error"); return -1; } @@ -752,7 +752,7 @@ static OicSecAcl_t* createAcl(const int dev_num) { if(0>=dev_num || g_own_cntresources = (char**) OICCalloc(num, sizeof(char*)); if(!acl->resources) { - OC_LOG(ERROR, TAG, "createAcl: OICCalloc error return"); + OIC_LOG(ERROR, TAG, "createAcl: OICCalloc error return"); goto CRACL_ERROR; } char rsrc_in[ACL_RESRC_MAX_LEN+1] = {0}; // '1' for null termination @@ -830,7 +830,7 @@ static OicSecAcl_t* createAcl(const int dev_num) char* rsrc = (char*) OICCalloc(len, sizeof(char)); if(!rsrc) { - OC_LOG(ERROR, TAG, "createAcl: OICCalloc error return"); + OIC_LOG(ERROR, TAG, "createAcl: OICCalloc error return"); goto CRACL_ERROR; } OICStrcpy(rsrc, len, rsrc_in); @@ -888,7 +888,7 @@ static OicSecAcl_t* createAcl(const int dev_num) acl->owners = (OicUuid_t*) OICCalloc(1, sizeof(OicUuid_t)); if(!acl->owners) { - OC_LOG(ERROR, TAG, "createAcl: OICCalloc error return"); + OIC_LOG(ERROR, TAG, "createAcl: OICCalloc error return"); goto CRACL_ERROR; } memcpy(acl->owners, @@ -1017,7 +1017,7 @@ static int waitCallbackRet(void) sleep(1); if(OC_STACK_OK != OCProcess()) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); return -1; } } @@ -1121,7 +1121,7 @@ int main() // initialize provisioning client if(initProvisionClient()) { - OC_LOG(ERROR, TAG, "ProvisionClient init error"); + OIC_LOG(ERROR, TAG, "ProvisionClient init error"); goto PMCLT_ERROR; } @@ -1144,61 +1144,61 @@ int main() case _10_DISCOV_ALL_DEVS_: if(discoverAllDevices()) { - OC_LOG(ERROR, TAG, "_10_DISCOV_ALL_DEVS_: error"); + OIC_LOG(ERROR, TAG, "_10_DISCOV_ALL_DEVS_: error"); } break; case _11_DISCOV_UNOWN_DEVS_: if(discoverUnownedDevices()) { - OC_LOG(ERROR, TAG, "_11_DISCOV_UNOWN_DEVS_: error"); + OIC_LOG(ERROR, TAG, "_11_DISCOV_UNOWN_DEVS_: error"); } break; case _12_DISCOV_OWN_DEVS_: if(discoverOwnedDevices()) { - OC_LOG(ERROR, TAG, "_12_DISCOV_OWN_DEVS_: error"); + OIC_LOG(ERROR, TAG, "_12_DISCOV_OWN_DEVS_: error"); } break; case _20_REGIST_DEVS_: if(registerDevices()) { - OC_LOG(ERROR, TAG, "_20_REGIST_DEVS_: error"); + OIC_LOG(ERROR, TAG, "_20_REGIST_DEVS_: error"); } break; case _30_PROVIS_PAIR_DEVS_: if(provisionPairwise()) { - OC_LOG(ERROR, TAG, "_30_PROVIS_PAIR_DEVS_: error"); + OIC_LOG(ERROR, TAG, "_30_PROVIS_PAIR_DEVS_: error"); } break; case _31_PROVIS_CRED_: if(provisionCred()) { - OC_LOG(ERROR, TAG, "_31_PROVIS_CRED_: error"); + OIC_LOG(ERROR, TAG, "_31_PROVIS_CRED_: error"); } break; case _32_PROVIS_ACL_: if(provisionAcl()) { - OC_LOG(ERROR, TAG, "_32_PROVIS_ACL_: error"); + OIC_LOG(ERROR, TAG, "_32_PROVIS_ACL_: error"); } break; case _33_CHECK_LINK_STATUS_: if(checkLinkedStatus()) { - OC_LOG(ERROR, TAG, "_33_CHECK_LINK_STATUS_: error"); + OIC_LOG(ERROR, TAG, "_33_CHECK_LINK_STATUS_: error"); } break; case _40_UNLINK_PAIR_DEVS_: if(unlinkPairwise()) { - OC_LOG(ERROR, TAG, "_40_UNLINK_PAIR_DEVS_: error"); + OIC_LOG(ERROR, TAG, "_40_UNLINK_PAIR_DEVS_: error"); } break; case _50_REMOVE_SELEC_DEV_: if(removeDevice()) { - OC_LOG(ERROR, TAG, "_50_REMOVE_SELEC_DEV_: error"); + OIC_LOG(ERROR, TAG, "_50_REMOVE_SELEC_DEV_: error"); } break; case _99_EXIT_PRVN_CLT_: @@ -1212,7 +1212,7 @@ int main() PMCLT_ERROR: if(OC_STACK_OK != OCStop()) { - OC_LOG(ERROR, TAG, "OCStack stop error"); + OIC_LOG(ERROR, TAG, "OCStack stop error"); } OCDeleteDiscoveredDevices(g_own_list); // after here |g_own_list| points nothing OCDeleteDiscoveredDevices(g_unown_list); // after here |g_unown_list| points nothing @@ -1230,4 +1230,4 @@ PMCLT_ERROR: #ifdef __cplusplus } -#endif //__cplusplus \ No newline at end of file +#endif //__cplusplus diff --git a/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp b/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp index c31a612..03e741e 100644 --- a/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp +++ b/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp @@ -132,7 +132,7 @@ OCRepPayload* getPayload(const char* uri, int64_t power, bool state) OCRepPayload* payload = OCRepPayloadCreate(); if(!payload) { - OC_LOG(ERROR, TAG, "Failed to allocate Payload"); + OIC_LOG(ERROR, TAG, "Failed to allocate Payload"); return NULL; } @@ -148,7 +148,7 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) { if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, TAG, "Incoming payload not a representation"); + OIC_LOG(ERROR, TAG, "Incoming payload not a representation"); return NULL; } @@ -258,7 +258,7 @@ OCEntityHandlerResult ProcessPostRequest (OCEntityHandlerRequest *ehRequest, if (0 == createLEDResource (newLedUri, &gLedInstance[gCurrLedInstance], false, 0)) { - OC_LOG (INFO, TAG, "Created new LED instance"); + OIC_LOG (INFO, TAG, "Created new LED instance"); gLedInstance[gCurrLedInstance].state = 0; gLedInstance[gCurrLedInstance].power = 0; gCurrLedInstance++; @@ -297,7 +297,7 @@ OCEntityHandlerResult ProcessPostRequest (OCEntityHandlerRequest *ehRequest, } else { - OC_LOG_V (INFO, TAG, "Payload was NULL"); + OIC_LOG_V (INFO, TAG, "Payload was NULL"); ehResult = OC_EH_ERROR; } @@ -309,7 +309,7 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, OCEntityHandlerRequest *entityHandlerRequest, void* callbackParam) { - OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); + OIC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); (void)callbackParam; OCEntityHandlerResult ehResult = OC_EH_ERROR; @@ -319,7 +319,7 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, // Validate pointer if (!entityHandlerRequest) { - OC_LOG (ERROR, TAG, "Invalid request pointer"); + OIC_LOG (ERROR, TAG, "Invalid request pointer"); return OC_EH_ERROR; } @@ -327,27 +327,27 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); if (entityHandlerRequest) { if (OC_REST_GET == entityHandlerRequest->method) { - OC_LOG (INFO, TAG, "Received OC_REST_GET from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_GET from client"); ehResult = ProcessGetRequest (entityHandlerRequest, &payload); } else if (OC_REST_PUT == entityHandlerRequest->method) { - OC_LOG (INFO, TAG, "Received OC_REST_PUT from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_PUT from client"); ehResult = ProcessPutRequest (entityHandlerRequest, &payload); } else if (OC_REST_POST == entityHandlerRequest->method) { - OC_LOG (INFO, TAG, "Received OC_REST_POST from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_POST from client"); ehResult = ProcessPostRequest (entityHandlerRequest, &response, &payload); } else { - OC_LOG_V (INFO, TAG, "Received unsupported method %d from client", + OIC_LOG_V (INFO, TAG, "Received unsupported method %d from client", entityHandlerRequest->method); ehResult = OC_EH_ERROR; } @@ -369,7 +369,7 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, // Send the response if (OCDoResponse(&response) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Error sending response"); + OIC_LOG(ERROR, TAG, "Error sending response"); ehResult = OC_EH_ERROR; } } @@ -399,7 +399,7 @@ int main() { struct timespec timeout; - OC_LOG(DEBUG, TAG, "OCServer is starting..."); + OIC_LOG(DEBUG, TAG, "OCServer is starting..."); // Initialize Persistent Storage for SVR database OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink}; @@ -408,7 +408,7 @@ int main() if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack init error"); + OIC_LOG(ERROR, TAG, "OCStack init error"); return 0; } @@ -421,23 +421,23 @@ int main() timeout.tv_nsec = 100000000L; // Break from loop with Ctrl-C - OC_LOG(INFO, TAG, "Entering ocserver main loop..."); + OIC_LOG(INFO, TAG, "Entering ocserver main loop..."); signal(SIGINT, handleSigInt); while (!gQuitFlag) { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); return 0; } nanosleep(&timeout, NULL); } - OC_LOG(INFO, TAG, "Exiting ocserver main loop..."); + OIC_LOG(INFO, TAG, "Exiting ocserver main loop..."); if (OCStop() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); } return 0; @@ -447,7 +447,7 @@ int createLEDResource (char *uri, LEDResource *ledResource, bool resourceState, { if (!uri) { - OC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); + OIC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); return -1; } @@ -460,7 +460,7 @@ int createLEDResource (char *uri, LEDResource *ledResource, bool resourceState, OCEntityHandlerCb, NULL, OC_DISCOVERABLE|OC_OBSERVABLE | OC_SECURE); - OC_LOG_V(INFO, TAG, "Created LED resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, TAG, "Created LED resource with result: %s", getResult(res)); return 0; } diff --git a/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp b/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp index f00f3dc..b60a34f 100644 --- a/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp +++ b/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp @@ -133,7 +133,7 @@ OCRepPayload* getPayload(const char* uri, int64_t power, bool state) OCRepPayload* payload = OCRepPayloadCreate(); if(!payload) { - OC_LOG(ERROR, TAG, "Failed to allocate Payload"); + OIC_LOG(ERROR, TAG, "Failed to allocate Payload"); return NULL; } @@ -149,7 +149,7 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) { if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, TAG, "Incoming payload not a representation"); + OIC_LOG(ERROR, TAG, "Incoming payload not a representation"); return NULL; } @@ -259,7 +259,7 @@ OCEntityHandlerResult ProcessPostRequest (OCEntityHandlerRequest *ehRequest, if (0 == createLEDResource (newLedUri, &gLedInstance[gCurrLedInstance], false, 0)) { - OC_LOG (INFO, TAG, "Created new LED instance"); + OIC_LOG (INFO, TAG, "Created new LED instance"); gLedInstance[gCurrLedInstance].state = 0; gLedInstance[gCurrLedInstance].power = 0; gCurrLedInstance++; @@ -298,7 +298,7 @@ OCEntityHandlerResult ProcessPostRequest (OCEntityHandlerRequest *ehRequest, } else { - OC_LOG_V (INFO, TAG, "Payload was NULL"); + OIC_LOG_V (INFO, TAG, "Payload was NULL"); ehResult = OC_EH_ERROR; } @@ -310,7 +310,7 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, OCEntityHandlerRequest *entityHandlerRequest, void* callbackParam) { - OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); + OIC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); (void)callbackParam; OCEntityHandlerResult ehResult = OC_EH_ERROR; @@ -320,7 +320,7 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, // Validate pointer if (!entityHandlerRequest) { - OC_LOG (ERROR, TAG, "Invalid request pointer"); + OIC_LOG (ERROR, TAG, "Invalid request pointer"); return OC_EH_ERROR; } @@ -328,27 +328,27 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); if (entityHandlerRequest) { if (OC_REST_GET == entityHandlerRequest->method) { - OC_LOG (INFO, TAG, "Received OC_REST_GET from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_GET from client"); ehResult = ProcessGetRequest (entityHandlerRequest, &payload); } else if (OC_REST_PUT == entityHandlerRequest->method) { - OC_LOG (INFO, TAG, "Received OC_REST_PUT from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_PUT from client"); ehResult = ProcessPutRequest (entityHandlerRequest, &payload); } else if (OC_REST_POST == entityHandlerRequest->method) { - OC_LOG (INFO, TAG, "Received OC_REST_POST from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_POST from client"); ehResult = ProcessPostRequest (entityHandlerRequest, &response, &payload); } else { - OC_LOG_V (INFO, TAG, "Received unsupported method %d from client", + OIC_LOG_V (INFO, TAG, "Received unsupported method %d from client", entityHandlerRequest->method); ehResult = OC_EH_ERROR; } @@ -370,7 +370,7 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, // Send the response if (OCDoResponse(&response) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Error sending response"); + OIC_LOG(ERROR, TAG, "Error sending response"); ehResult = OC_EH_ERROR; } } @@ -400,20 +400,20 @@ void GeneratePinCB(char* pin, size_t pinSize) { if(NULL == pin || pinSize <= 0) { - OC_LOG(INFO, TAG, "Invalid PIN"); + OIC_LOG(INFO, TAG, "Invalid PIN"); return; } - OC_LOG(INFO, TAG, "============================"); - OC_LOG_V(INFO, TAG, " PIN CODE : %s", pin); - OC_LOG(INFO, TAG, "============================"); + OIC_LOG(INFO, TAG, "============================"); + OIC_LOG_V(INFO, TAG, " PIN CODE : %s", pin); + OIC_LOG(INFO, TAG, "============================"); } int main() { struct timespec timeout; - OC_LOG(DEBUG, TAG, "OCServer is starting..."); + OIC_LOG(DEBUG, TAG, "OCServer is starting..."); // Initialize Persistent Storage for SVR database OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink}; @@ -421,7 +421,7 @@ int main() if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack init error"); + OIC_LOG(ERROR, TAG, "OCStack init error"); return 0; } @@ -440,23 +440,23 @@ int main() timeout.tv_nsec = 100000000L; // Break from loop with Ctrl-C - OC_LOG(INFO, TAG, "Entering ocserver main loop..."); + OIC_LOG(INFO, TAG, "Entering ocserver main loop..."); signal(SIGINT, handleSigInt); while (!gQuitFlag) { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); return 0; } nanosleep(&timeout, NULL); } - OC_LOG(INFO, TAG, "Exiting ocserver main loop..."); + OIC_LOG(INFO, TAG, "Exiting ocserver main loop..."); if (OCStop() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); } return 0; @@ -466,7 +466,7 @@ int createLEDResource (char *uri, LEDResource *ledResource, bool resourceState, { if (!uri) { - OC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); + OIC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); return -1; } @@ -479,7 +479,7 @@ int createLEDResource (char *uri, LEDResource *ledResource, bool resourceState, OCEntityHandlerCb, NULL, OC_DISCOVERABLE|OC_OBSERVABLE | OC_SECURE); - OC_LOG_V(INFO, TAG, "Created LED resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, TAG, "Created LED resource with result: %s", getResult(res)); return 0; } diff --git a/resource/csdk/security/provisioning/src/credentialgenerator.c b/resource/csdk/security/provisioning/src/credentialgenerator.c index 1dc263f..f592c93 100644 --- a/resource/csdk/security/provisioning/src/credentialgenerator.c +++ b/resource/csdk/security/provisioning/src/credentialgenerator.c @@ -43,7 +43,7 @@ * must define "OCStackResult res" for setting error code. * */ #define PM_VERIFY_SUCCESS(tag, op, errCode, logLevel) { if (!(op)) \ - {OC_LOG((logLevel), tag, #op " failed!!"); res = errCode; goto bail;} } + {OIC_LOG((logLevel), tag, #op " failed!!"); res = errCode; goto bail;} } /** * @def PM_VERIFY_NON_NULL * @brief Macro to verify argument is not equal to NULL. @@ -51,7 +51,7 @@ * @note Invoking function must define "bail:" label for goto functionality to work correctly. * */ #define PM_VERIFY_NON_NULL(tag, arg, errCode, logLevel) { if (NULL == (arg)) \ - { OC_LOG((logLevel), tag, #arg " is NULL"); res = errCode; goto bail;} } + { OIC_LOG((logLevel), tag, #arg " is NULL"); res = errCode; goto bail;} } OCStackResult PMGeneratePairWiseCredentials(OicSecCredType_t type, size_t keySize, const OicUuid_t *ptDeviceId, @@ -62,12 +62,12 @@ OCStackResult PMGeneratePairWiseCredentials(OicSecCredType_t type, size_t keySiz if (NULL == ptDeviceId || NULL == firstDeviceId || NULL != *firstCred || \ NULL == secondDeviceId || NULL != *secondCred) { - OC_LOG(INFO, TAG, "Invalid params"); + OIC_LOG(INFO, TAG, "Invalid params"); return OC_STACK_INVALID_PARAM; } if(!(keySize == OWNER_PSK_LENGTH_128 || keySize == OWNER_PSK_LENGTH_256)) { - OC_LOG(INFO, TAG, "Invalid key size"); + OIC_LOG(INFO, TAG, "Invalid key size"); return OC_STACK_INVALID_PARAM; } OCStackResult res = OC_STACK_ERROR; @@ -132,7 +132,7 @@ static char *CreateCertificatePublicJWK(const char *const *certificateChain, { if (NULL == certificateChain || chainLength == 0) { - OC_LOG(ERROR, TAG, "Error CreateCertificatePublicJWK: Invalid params"); + OIC_LOG(ERROR, TAG, "Error CreateCertificatePublicJWK: Invalid params"); return NULL; } @@ -145,7 +145,7 @@ static char *CreateCertificatePublicJWK(const char *const *certificateChain, } else { - OC_LOG(ERROR, TAG, "Error CreateCertificatePublicJWK: Invalid params"); + OIC_LOG(ERROR, TAG, "Error CreateCertificatePublicJWK: Invalid params"); return NULL; } @@ -175,7 +175,7 @@ static char *CreateCertificatePublicJWK(const char *const *certificateChain, } else { - OC_LOG(ERROR, TAG, "Error while memory allocation"); + OIC_LOG(ERROR, TAG, "Error while memory allocation"); } return certPubJWK; } @@ -190,7 +190,7 @@ static char *CreateCertificatePrivateJWK(const char *privateKey) { if (NULL == privateKey) { - OC_LOG(ERROR, TAG, "Error privateKey is NULL"); + OIC_LOG(ERROR, TAG, "Error privateKey is NULL"); return NULL; } const char firstPart[] = "{\"kty\":\"EC\",\"crv\":\"P-256\",\"d\":\""; @@ -204,7 +204,7 @@ static char *CreateCertificatePrivateJWK(const char *privateKey) } else { - OC_LOG(ERROR, TAG, "Error while memory allocation"); + OIC_LOG(ERROR, TAG, "Error while memory allocation"); } return certPrivJWK; } @@ -253,12 +253,12 @@ static OCStackResult GenerateCertificateAndKeys(const OicUuid_t * subject, char if (PKI_SUCCESS != GenerateKeyPair(&privKeyBA, &pubKeyBA)) { - OC_LOG(ERROR, TAG, "Error generating keys."); + OIC_LOG(ERROR, TAG, "Error generating keys."); return OC_STACK_ERROR; } if (PKI_SUCCESS != CKMIssueDeviceCertificate(subjName, NULL, NULL, pubKeyBA.data, cert)) { - OC_LOG(ERROR, TAG, "Error generating certificate."); + OIC_LOG(ERROR, TAG, "Error generating certificate."); return OC_STACK_ERROR; } @@ -267,13 +267,13 @@ static OCStackResult GenerateCertificateAndKeys(const OicUuid_t * subject, char if (B64_OK != b64Encode(privKeyBA.data, privKeyBA.len, privB64buf, B64ENCODE_OUT_SAFESIZE(PRIVATE_KEY_SIZE) + 1, &privB64len)) { - OC_LOG(ERROR, TAG, "Error while encoding key"); + OIC_LOG(ERROR, TAG, "Error while encoding key"); return OC_STACK_ERROR; } if (PKI_SUCCESS != GetCAChain(chainLength , cert + 1)) { - OC_LOG(ERROR, TAG, "Error getting CA certificate chain."); + OIC_LOG(ERROR, TAG, "Error getting CA certificate chain."); return OC_STACK_ERROR; } @@ -296,7 +296,7 @@ static OCStackResult GenerateCertificateAndKeys(const OicUuid_t * subject, char if (B64_OK != b64Encode(cert[i].data, cert[i].len, certB64buf, B64ENCODE_OUT_SAFESIZE(ISSUER_MAX_CERT_SIZE) + 1, &certB64len)) { - OC_LOG(ERROR, TAG, "Error while encoding certificate"); + OIC_LOG(ERROR, TAG, "Error while encoding certificate"); ret = OC_STACK_ERROR; goto memclean; } @@ -329,7 +329,7 @@ memclean: *chainLength = 0; if (OC_STACK_NO_MEMORY == ret) { - OC_LOG(ERROR, TAG, "Error while memory allocation"); + OIC_LOG(ERROR, TAG, "Error while memory allocation"); } return ret; } @@ -353,7 +353,7 @@ OCStackResult PMGenerateCertificateCredentials(const OicUuid_t *ptDeviceId, if (OC_STACK_OK != GenerateCertificateAndKeys(deviceId, &certificateChain, &certChainLen, &privKey)) { - OC_LOG(ERROR, TAG, "Error while generating credential data."); + OIC_LOG(ERROR, TAG, "Error while generating credential data."); return OC_STACK_ERROR; } @@ -369,7 +369,7 @@ OCStackResult PMGenerateCertificateCredentials(const OicUuid_t *ptDeviceId, { OICFree(publicJWK); OICFree(privateJWK); - OC_LOG(ERROR, TAG, "Error while converting keys to JWK format."); + OIC_LOG(ERROR, TAG, "Error while converting keys to JWK format."); return OC_STACK_ERROR; } @@ -379,7 +379,7 @@ OCStackResult PMGenerateCertificateCredentials(const OicUuid_t *ptDeviceId, OICFree(privateJWK); if (NULL == tempCred) { - OC_LOG(ERROR, TAG, "Error while generating credential."); + OIC_LOG(ERROR, TAG, "Error while generating credential."); return OC_STACK_ERROR; } *cred = tempCred; diff --git a/resource/csdk/security/provisioning/src/ocprovisioningmanager.c b/resource/csdk/security/provisioning/src/ocprovisioningmanager.c index 68ce38c..9886923 100644 --- a/resource/csdk/security/provisioning/src/ocprovisioningmanager.c +++ b/resource/csdk/security/provisioning/src/ocprovisioningmanager.c @@ -194,13 +194,13 @@ OCStackResult OCUnlinkDevices(void* ctx, const OCProvisionDev_t* pTargetDev2, OCProvisionResultCB resultCallback) { - OC_LOG(INFO, TAG, "IN OCUnlinkDevices"); + OIC_LOG(INFO, TAG, "IN OCUnlinkDevices"); OCUuidList_t* idList = NULL; size_t numOfDev = 0; if (!pTargetDev1 || !pTargetDev2 || !resultCallback) { - OC_LOG(ERROR, TAG, "OCUnlinkDevices : NULL parameters"); + OIC_LOG(ERROR, TAG, "OCUnlinkDevices : NULL parameters"); return OC_STACK_INVALID_PARAM; } @@ -208,12 +208,12 @@ OCStackResult OCUnlinkDevices(void* ctx, OCStackResult res = PDMGetLinkedDevices(&(pTargetDev1->doxm->deviceID), &idList, &numOfDev); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "OCUnlinkDevices : PDMgetOwnedDevices failed"); + OIC_LOG(ERROR, TAG, "OCUnlinkDevices : PDMgetOwnedDevices failed"); goto error; } if (1 > numOfDev) { - OC_LOG(DEBUG, TAG, "OCUnlinkDevices : Can not find linked devices"); + OIC_LOG(DEBUG, TAG, "OCUnlinkDevices : Can not find linked devices"); res = OC_STACK_INVALID_PARAM; // Input devices are not linked, No request is made goto error; } @@ -227,17 +227,17 @@ OCStackResult OCUnlinkDevices(void* ctx, res = SRPUnlinkDevices(ctx, pTargetDev1, pTargetDev2, resultCallback); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "OCUnlinkDevices : Failed to unlink devices."); + OIC_LOG(ERROR, TAG, "OCUnlinkDevices : Failed to unlink devices."); } goto error; } curDev = curDev->next; } - OC_LOG(DEBUG, TAG, "No matched pair found from provisioning database"); + OIC_LOG(DEBUG, TAG, "No matched pair found from provisioning database"); res = OC_STACK_INVALID_PARAM; // Input devices are not linked, No request is made error: - OC_LOG(INFO, TAG, "OUT OCUnlinkDevices"); + OIC_LOG(INFO, TAG, "OUT OCUnlinkDevices"); PDMDestoryOicUuidLinkList(idList); return res; @@ -258,11 +258,11 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis const OCProvisionDev_t* pTargetDev, OCProvisionResultCB resultCallback) { - OC_LOG(INFO, TAG, "IN OCRemoveDevice"); + OIC_LOG(INFO, TAG, "IN OCRemoveDevice"); OCStackResult res = OC_STACK_ERROR; if (!pTargetDev || !resultCallback || 0 == waitTimeForOwnedDeviceDiscovery) { - OC_LOG(INFO, TAG, "OCRemoveDevice : Invalied parameters"); + OIC_LOG(INFO, TAG, "OCRemoveDevice : Invalied parameters"); return OC_STACK_INVALID_PARAM; } @@ -273,11 +273,11 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis { if (OC_STACK_CONTINUE == resReq) { - OC_LOG(DEBUG, TAG, "OCRemoveDevice : Revoked device has no linked device except PT."); + OIC_LOG(DEBUG, TAG, "OCRemoveDevice : Revoked device has no linked device except PT."); } else { - OC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to invoke SRPRemoveDevice"); + OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to invoke SRPRemoveDevice"); res = resReq; goto error; } @@ -288,14 +288,14 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis cred = GetCredResourceData(&pTargetDev->doxm->deviceID); if (cred == NULL) { - OC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to get credential of remove device."); + OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to get credential of remove device."); goto error; } res = RemoveCredential(&cred->subject); if (res != OC_STACK_RESOURCE_DELETED) { - OC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to remove credential."); + OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to remove credential."); goto error; } @@ -306,7 +306,7 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis res = PDMSetDeviceStale(&pTargetDev->doxm->deviceID); if (res != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to set device status as stale"); + OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to set device status as stale"); goto error; } @@ -320,7 +320,7 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis CAResult_t caResult = CACloseDtlsSession(endpoint); if(CA_STATUS_OK != caResult) { - OC_LOG_V(WARNING, TAG, "OCRemoveDevice : Failed to close DTLS session : %d", caResult); + OIC_LOG_V(WARNING, TAG, "OCRemoveDevice : Failed to close DTLS session : %d", caResult); } /** @@ -337,7 +337,7 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis } error: - OC_LOG(INFO, TAG, "OUT OCRemoveDevice"); + OIC_LOG(INFO, TAG, "OUT OCRemoveDevice"); return res; } @@ -348,7 +348,7 @@ error: static void UpdateLinkResults(Linkdata_t *link, int device, OCStackResult stackresult) { - OC_LOG_V(INFO,TAG,"value of link->currentCountResults is %d",link->currentCountResults); + OIC_LOG_V(INFO,TAG,"value of link->currentCountResults is %d",link->currentCountResults); if (1 == device) { memcpy(link->resArr[(link->currentCountResults)].deviceId.id, link->pDev1->doxm->deviceID.id,UUID_LENGTH); @@ -370,7 +370,7 @@ static void AclProv2CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool has if (NULL == ctx) { - OC_LOG(ERROR,TAG,"Context is Null in ACLProv 2"); + OIC_LOG(ERROR,TAG,"Context is Null in ACLProv 2"); return; } (void)nOfRes; @@ -381,7 +381,7 @@ static void AclProv2CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool has if (hasError) { UpdateLinkResults(link, 2,arr[0].res); - OC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1"); + OIC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1"); ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults, link->resArr, true); @@ -406,7 +406,7 @@ static void AclProv1CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool has if (NULL == ctx) { - OC_LOG(ERROR,TAG,"Context is Null in ACLProv1"); + OIC_LOG(ERROR,TAG,"Context is Null in ACLProv1"); return; } (void)nOfRes; @@ -415,7 +415,7 @@ static void AclProv1CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool has if (hasError) { - OC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1"); + OIC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1"); UpdateLinkResults(link, 1, arr[0].res); ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults, link->resArr, @@ -456,17 +456,17 @@ static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bo { if (NULL == ctx) { - OC_LOG(ERROR,TAG,"Error occured while credential provisioning"); + OIC_LOG(ERROR,TAG,"Error occured while credential provisioning"); return; } Linkdata_t *link = (Linkdata_t*)ctx; OCProvisionResultCB resultCallback = link->resultCallback; - OC_LOG_V(INFO, TAG, "has error returned %d",hasError); + OIC_LOG_V(INFO, TAG, "has error returned %d",hasError); UpdateLinkResults(link, 1, arr[0].res); UpdateLinkResults(link, 2, arr[1].res); if (hasError) { - OC_LOG(ERROR,TAG,"Error occured while credential provisioning"); + OIC_LOG(ERROR,TAG,"Error occured while credential provisioning"); ((OCProvisionResultCB)(resultCallback))(link->ctx, nOfRes, link->resArr, true); @@ -480,7 +480,7 @@ static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bo OCStackResult res = SRPProvisionACL(ctx, link->pDev1, link->pDev1Acl, &AclProv1CB); if (OC_STACK_OK!=res) { - OC_LOG(ERROR, TAG, "Error while provisioning ACL for device 1"); + OIC_LOG(ERROR, TAG, "Error while provisioning ACL for device 1"); UpdateLinkResults(link, 1, res); ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults, link->resArr, @@ -491,11 +491,11 @@ static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bo } else if (NULL!=link->pDev2Acl) { - OC_LOG(ERROR, TAG, "ACL for device 1 is NULL"); + OIC_LOG(ERROR, TAG, "ACL for device 1 is NULL"); OCStackResult res = SRPProvisionACL(ctx, link->pDev2, link->pDev2Acl, &AclProv2CB); if (OC_STACK_OK!=res) { - OC_LOG(ERROR, TAG, "Error while provisioning ACL for device 2"); + OIC_LOG(ERROR, TAG, "Error while provisioning ACL for device 2"); UpdateLinkResults(link, 2, res); ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults, link->resArr, @@ -506,7 +506,7 @@ static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bo } else { - OC_LOG(INFO, TAG, "ACLs of both devices are NULL"); + OIC_LOG(INFO, TAG, "ACLs of both devices are NULL"); ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults, link->resArr, false); @@ -536,26 +536,26 @@ OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_ if (!pDev1 || !pDev2 || !resultCallback) { - OC_LOG(ERROR, TAG, "OCProvisionPairwiseDevices : Invalid parameters"); + OIC_LOG(ERROR, TAG, "OCProvisionPairwiseDevices : Invalid parameters"); return OC_STACK_INVALID_PARAM; } if (!(keySize == OWNER_PSK_LENGTH_128 || keySize == OWNER_PSK_LENGTH_256)) { - OC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Invalid key size"); + OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Invalid key size"); return OC_STACK_INVALID_PARAM; } - OC_LOG(DEBUG, TAG, "Checking link in DB"); + OIC_LOG(DEBUG, TAG, "Checking link in DB"); bool linkExists = true; OCStackResult res = PDMIsLinkExists(&pDev1->doxm->deviceID, &pDev2->doxm->deviceID, &linkExists); if(res != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Internal Error Occured"); + OIC_LOG(ERROR, TAG, "Internal Error Occured"); return res; } if (linkExists) { - OC_LOG(ERROR, TAG, "Link already exists"); + OIC_LOG(ERROR, TAG, "Link already exists"); return OC_STACK_INVALID_PARAM; } @@ -571,10 +571,10 @@ OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_ Linkdata_t *link = (Linkdata_t*) OICMalloc(sizeof(Linkdata_t)); if (!link) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } - OC_LOG_V(INFO,TAG, "Maximum no od results %d",noOfResults); + OIC_LOG_V(INFO,TAG, "Maximum no od results %d",noOfResults); link->pDev1 = pDev1; link->pDev1Acl = pDev1Acl; @@ -614,7 +614,7 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, OCStackResult res = OCDiscoverUnownedDevices(waittime/2, &unownedDevice); if (OC_STACK_OK != res) { - OC_LOG(ERROR,TAG, "Error in unowned discovery"); + OIC_LOG(ERROR,TAG, "Error in unowned discovery"); return res; } @@ -623,7 +623,7 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, res = OCDiscoverOwnedDevices(waittime/2, &ownedDevice); if (OC_STACK_OK != res) { - OC_LOG(ERROR,TAG, "Error in owned discovery"); + OIC_LOG(ERROR,TAG, "Error in owned discovery"); PMDeleteDeviceList(unownedDevice); return res; } @@ -634,7 +634,7 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, res = PDMGetOwnedDevices(&uuidList, &numOfDevices); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Error while getting info from DB"); + OIC_LOG(ERROR, TAG, "Error while getting info from DB"); PMDeleteDeviceList(unownedDevice); PMDeleteDeviceList(ownedDevice); return res; @@ -663,7 +663,7 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, OCProvisionDev_t *ptr = (OCProvisionDev_t *)OICCalloc(1, sizeof (OCProvisionDev_t)); if (NULL == ptr) { - OC_LOG(ERROR,TAG,"Fail to allocate memory"); + OIC_LOG(ERROR,TAG,"Fail to allocate memory"); PMDeleteDeviceList(unownedDevice); PMDeleteDeviceList(ownedDevice); OCDeleteUuidList(uuidList); @@ -673,7 +673,7 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, ptr->doxm = (OicSecDoxm_t*)OICCalloc(1, sizeof(OicSecDoxm_t)); if (NULL == ptr->doxm) { - OC_LOG(ERROR,TAG,"Fail to allocate memory"); + OIC_LOG(ERROR,TAG,"Fail to allocate memory"); PMDeleteDeviceList(unownedDevice); PMDeleteDeviceList(ownedDevice); OCDeleteUuidList(uuidList); diff --git a/resource/csdk/security/provisioning/src/ownershiptransfermanager.c b/resource/csdk/security/provisioning/src/ownershiptransfermanager.c index 7adeb46..66c9179 100644 --- a/resource/csdk/security/provisioning/src/ownershiptransfermanager.c +++ b/resource/csdk/security/provisioning/src/ownershiptransfermanager.c @@ -114,11 +114,11 @@ static OCStackResult SelectProvisioningMethod(const OicSecOxm_t *supportedMethod size_t numberOfMethods, OicSecOxm_t *selectedMethod) { - OC_LOG(DEBUG, TAG, "IN SelectProvisioningMethod"); + OIC_LOG(DEBUG, TAG, "IN SelectProvisioningMethod"); if(numberOfMethods == 0 || !supportedMethods) { - OC_LOG(WARNING, TAG, "Could not find a supported OxM."); + OIC_LOG(WARNING, TAG, "Could not find a supported OxM."); return OC_STACK_ERROR; } @@ -144,7 +144,7 @@ static OCStackResult SelectProvisioningMethod(const OicSecOxm_t *supportedMethod static void SelectOperationMode(const OCProvisionDev_t *selectedDeviceInfo, OicSecDpom_t *selectedMode) { - OC_LOG(DEBUG, TAG, "IN SelectOperationMode"); + OIC_LOG(DEBUG, TAG, "IN SelectOperationMode"); size_t i = 0; size_t j = 0; @@ -165,7 +165,7 @@ static void SelectOperationMode(const OCProvisionDev_t *selectedDeviceInfo, break; } } - OC_LOG(DEBUG, TAG, "OUT SelectOperationMode"); + OIC_LOG(DEBUG, TAG, "OUT SelectOperationMode"); } /** @@ -246,11 +246,11 @@ static bool IsComplete(OTMContext_t* otmCtx) */ static void SetResult(OTMContext_t* otmCtx, const OCStackResult res) { - OC_LOG_V(DEBUG, TAG, "IN SetResult : %d ", res); + OIC_LOG_V(DEBUG, TAG, "IN SetResult : %d ", res); if(!otmCtx) { - OC_LOG(WARNING, TAG, "OTMContext is NULL"); + OIC_LOG(WARNING, TAG, "OTMContext is NULL"); return; } @@ -284,12 +284,12 @@ static void SetResult(OTMContext_t* otmCtx, const OCStackResult res) if(OC_STACK_OK != StartOwnershipTransfer(otmCtx, otmCtx->selectedDeviceInfo->next)) { - OC_LOG(ERROR, TAG, "Failed to StartOwnershipTransfer"); + OIC_LOG(ERROR, TAG, "Failed to StartOwnershipTransfer"); } } } - OC_LOG(DEBUG, TAG, "OUT SetResult"); + OIC_LOG(DEBUG, TAG, "OUT SetResult"); } /** @@ -303,7 +303,7 @@ void DTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInfo_t *info) { if(g_otmCtx && endpoint && info) { - OC_LOG_V(INFO, TAG, "Received status from remote device(%s:%d) : %d", + OIC_LOG_V(INFO, TAG, "Received status from remote device(%s:%d) : %d", endpoint->addr, endpoint->port, info->result); //Make sure the address matches. @@ -323,7 +323,7 @@ void DTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInfo_t *info) res = PutOwnershipInformation(g_otmCtx); if(OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "OperationModeUpdate : Failed to send owner information"); + OIC_LOG(ERROR, TAG, "OperationModeUpdate : Failed to send owner information"); SetResult(g_otmCtx, res); } } @@ -338,7 +338,7 @@ void DTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInfo_t *info) res = RemoveCredential(&g_otmCtx->subIdForPinOxm); if(OC_STACK_RESOURCE_DELETED != res) { - OC_LOG_V(ERROR, TAG, "Failed to remove temporal PSK : %d", res); + OIC_LOG_V(ERROR, TAG, "Failed to remove temporal PSK : %d", res); SetResult(g_otmCtx, res); return; } @@ -349,7 +349,7 @@ void DTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInfo_t *info) if(OC_STACK_OK != res) { SetResult(g_otmCtx, res); - OC_LOG(ERROR, TAG, "Failed to Re-StartOwnershipTransfer"); + OIC_LOG(ERROR, TAG, "Failed to Re-StartOwnershipTransfer"); } } else @@ -374,7 +374,7 @@ void DTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInfo_t *info) */ static OCStackResult SaveOwnerPSK(OCProvisionDev_t *selectedDeviceInfo) { - OC_LOG(DEBUG, TAG, "IN SaveOwnerPSK"); + OIC_LOG(DEBUG, TAG, "IN SaveOwnerPSK"); OCStackResult res = OC_STACK_ERROR; @@ -387,7 +387,7 @@ static OCStackResult SaveOwnerPSK(OCProvisionDev_t *selectedDeviceInfo) OicUuid_t ptDeviceID = {.id={0}}; if (OC_STACK_OK != GetDoxmDeviceID(&ptDeviceID)) { - OC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); + OIC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); return res; } @@ -403,8 +403,8 @@ static OCStackResult SaveOwnerPSK(OCProvisionDev_t *selectedDeviceInfo) if (CA_STATUS_OK == pskRet) { - OC_LOG(INFO, TAG,"ownerPSK dump:\n"); - OC_LOG_BUFFER(INFO, TAG,ownerPSK, OWNER_PSK_LENGTH_128); + OIC_LOG(INFO, TAG,"ownerPSK dump:\n"); + OIC_LOG_BUFFER(INFO, TAG,ownerPSK, OWNER_PSK_LENGTH_128); //Generating new credential for provisioning tool size_t ownLen = 1; uint32_t outLen = 0; @@ -428,10 +428,10 @@ static OCStackResult SaveOwnerPSK(OCProvisionDev_t *selectedDeviceInfo) } else { - OC_LOG(ERROR, TAG, "CAGenerateOwnerPSK failed"); + OIC_LOG(ERROR, TAG, "CAGenerateOwnerPSK failed"); } - OC_LOG(DEBUG, TAG, "OUT SaveOwnerPSK"); + OIC_LOG(DEBUG, TAG, "OUT SaveOwnerPSK"); exit: return res; } @@ -448,7 +448,7 @@ exit: static OCStackApplicationResult OwnerTransferModeHandler(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OC_LOG(DEBUG, TAG, "IN OwnerTransferModeHandler"); + OIC_LOG(DEBUG, TAG, "IN OwnerTransferModeHandler"); VERIFY_NON_NULL(TAG, clientResponse, WARNING); VERIFY_NON_NULL(TAG, ctx, WARNING); @@ -457,23 +457,23 @@ static OCStackApplicationResult OwnerTransferModeHandler(void *ctx, OCDoHandle U (void)UNUSED; if(clientResponse->result == OC_STACK_OK) { - OC_LOG(INFO, TAG, "OwnerTransferModeHandler : response result = OC_STACK_OK"); + OIC_LOG(INFO, TAG, "OwnerTransferModeHandler : response result = OC_STACK_OK"); //Send request : GET /oic/sec/pstat OCStackResult res = GetProvisioningStatusResource(otmCtx); if(OC_STACK_OK != res) { - OC_LOG(WARNING, TAG, "Failed to get pstat information"); + OIC_LOG(WARNING, TAG, "Failed to get pstat information"); SetResult(otmCtx, res); } } else { - OC_LOG_V(WARNING, TAG, "OwnerTransferModeHandler : Client response is incorrect : %d", + OIC_LOG_V(WARNING, TAG, "OwnerTransferModeHandler : Client response is incorrect : %d", clientResponse->result); SetResult(otmCtx, clientResponse->result); } - OC_LOG(DEBUG, TAG, "OUT OwnerTransferModeHandler"); + OIC_LOG(DEBUG, TAG, "OUT OwnerTransferModeHandler"); exit: return OC_STACK_DELETE_TRANSACTION; @@ -491,7 +491,7 @@ exit: static OCStackApplicationResult ListMethodsHandler(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OC_LOG(DEBUG, TAG, "IN ListMethodsHandler"); + OIC_LOG(DEBUG, TAG, "IN ListMethodsHandler"); VERIFY_NON_NULL(TAG, clientResponse, WARNING); VERIFY_NON_NULL(TAG, ctx, WARNING); @@ -502,14 +502,14 @@ static OCStackApplicationResult ListMethodsHandler(void *ctx, OCDoHandle UNUSED, { if (NULL == clientResponse->payload) { - OC_LOG(INFO, TAG, "Skiping Null payload"); + OIC_LOG(INFO, TAG, "Skiping Null payload"); SetResult(otmCtx, OC_STACK_ERROR); return OC_STACK_DELETE_TRANSACTION; } if (PAYLOAD_TYPE_SECURITY != clientResponse->payload->type) { - OC_LOG(INFO, TAG, "Unknown payload type"); + OIC_LOG(INFO, TAG, "Unknown payload type"); SetResult(otmCtx, OC_STACK_ERROR); return OC_STACK_DELETE_TRANSACTION; } @@ -518,7 +518,7 @@ static OCStackApplicationResult ListMethodsHandler(void *ctx, OCDoHandle UNUSED, ((OCSecurityPayload*)clientResponse->payload)->securityData); if(NULL == pstat) { - OC_LOG(ERROR, TAG, "Error while converting json to pstat bin"); + OIC_LOG(ERROR, TAG, "Error while converting json to pstat bin"); SetResult(otmCtx, OC_STACK_ERROR); return OC_STACK_DELETE_TRANSACTION; } @@ -532,18 +532,18 @@ static OCStackApplicationResult ListMethodsHandler(void *ctx, OCDoHandle UNUSED, OCStackResult res = PutUpdateOperationMode(otmCtx, selectedOperationMode); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Error while updating operation mode."); + OIC_LOG(ERROR, TAG, "Error while updating operation mode."); SetResult(otmCtx, res); } } else { - OC_LOG_V(WARNING, TAG, "ListMethodsHandler : Client response is incorrect : %d", + OIC_LOG_V(WARNING, TAG, "ListMethodsHandler : Client response is incorrect : %d", clientResponse->result); SetResult(otmCtx, clientResponse->result); } - OC_LOG(DEBUG, TAG, "OUT ListMethodsHandler"); + OIC_LOG(DEBUG, TAG, "OUT ListMethodsHandler"); exit: return OC_STACK_DELETE_TRANSACTION; } @@ -563,7 +563,7 @@ static OCStackApplicationResult OwnershipInformationHandler(void *ctx, OCDoHandl VERIFY_NON_NULL(TAG, clientResponse, WARNING); VERIFY_NON_NULL(TAG, ctx, WARNING); - OC_LOG(DEBUG, TAG, "IN OwnershipInformationHandler"); + OIC_LOG(DEBUG, TAG, "IN OwnershipInformationHandler"); (void)UNUSED; OCStackResult res = OC_STACK_OK; OTMContext_t* otmCtx = (OTMContext_t*)ctx; @@ -577,7 +577,7 @@ static OCStackApplicationResult OwnershipInformationHandler(void *ctx, OCDoHandl res = RemoveCredential(&otmCtx->subIdForPinOxm); if(OC_STACK_RESOURCE_DELETED != res) { - OC_LOG_V(ERROR, TAG, "Failed to remove temporal PSK : %d", res); + OIC_LOG_V(ERROR, TAG, "Failed to remove temporal PSK : %d", res); return OC_STACK_DELETE_TRANSACTION; } } @@ -585,7 +585,7 @@ static OCStackApplicationResult OwnershipInformationHandler(void *ctx, OCDoHandl res = SaveOwnerPSK(otmCtx->selectedDeviceInfo); if(OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "OperationModeUpdate : Failed to owner PSK generation"); + OIC_LOG(ERROR, TAG, "OperationModeUpdate : Failed to owner PSK generation"); SetResult(otmCtx, res); return OC_STACK_DELETE_TRANSACTION; } @@ -595,7 +595,7 @@ static OCStackApplicationResult OwnershipInformationHandler(void *ctx, OCDoHandl CAResult_t caResult = CACloseDtlsSession(endpoint); if(CA_STATUS_OK != caResult) { - OC_LOG(ERROR, TAG, "Failed to close DTLS session"); + OIC_LOG(ERROR, TAG, "Failed to close DTLS session"); SetResult(otmCtx, caResult); return OC_STACK_DELETE_TRANSACTION; } @@ -607,13 +607,13 @@ static OCStackApplicationResult OwnershipInformationHandler(void *ctx, OCDoHandl caResult = CASelectCipherSuite(TLS_NULL_WITH_NULL_NULL); if(CA_STATUS_OK != caResult) { - OC_LOG(ERROR, TAG, "Failed to select TLS_NULL_WITH_NULL_NULL"); + OIC_LOG(ERROR, TAG, "Failed to select TLS_NULL_WITH_NULL_NULL"); SetResult(otmCtx, caResult); return OC_STACK_DELETE_TRANSACTION; } - OC_LOG(INFO, TAG, "Ownership transfer was successfully completed."); - OC_LOG(INFO, TAG, "Start defualt ACL & commit-hash provisioning."); + OIC_LOG(INFO, TAG, "Ownership transfer was successfully completed."); + OIC_LOG(INFO, TAG, "Start defualt ACL & commit-hash provisioning."); res = FinalizeProvisioning(otmCtx); if(OC_STACK_OK != res) @@ -625,11 +625,11 @@ static OCStackApplicationResult OwnershipInformationHandler(void *ctx, OCDoHandl else { res = clientResponse->result; - OC_LOG_V(ERROR, TAG, "OwnershipInformationHandler : Unexpected result %d", res); + OIC_LOG_V(ERROR, TAG, "OwnershipInformationHandler : Unexpected result %d", res); SetResult(otmCtx, res); } - OC_LOG(DEBUG, TAG, "OUT OwnershipInformationHandler"); + OIC_LOG(DEBUG, TAG, "OUT OwnershipInformationHandler"); exit: return OC_STACK_DELETE_TRANSACTION; @@ -647,7 +647,7 @@ exit: static OCStackApplicationResult OperationModeUpdateHandler(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OC_LOG(DEBUG, TAG, "IN OperationModeUpdateHandler"); + OIC_LOG(DEBUG, TAG, "IN OperationModeUpdateHandler"); VERIFY_NON_NULL(TAG, clientResponse, WARNING); VERIFY_NON_NULL(TAG, ctx, WARNING); @@ -665,7 +665,7 @@ static OCStackApplicationResult OperationModeUpdateHandler(void *ctx, OCDoHandle res = g_OTMDatas[selOxm].loadSecretCB(otmCtx); if(OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "OperationModeUpdate : Failed to load secret"); + OIC_LOG(ERROR, TAG, "OperationModeUpdate : Failed to load secret"); SetResult(otmCtx, res); return OC_STACK_DELETE_TRANSACTION; } @@ -680,7 +680,7 @@ static OCStackApplicationResult OperationModeUpdateHandler(void *ctx, OCDoHandle res = g_OTMDatas[selOxm].createSecureSessionCB(otmCtx); if(OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "OperationModeUpdate : Failed to create DTLS session"); + OIC_LOG(ERROR, TAG, "OperationModeUpdate : Failed to create DTLS session"); SetResult(otmCtx, res); return OC_STACK_DELETE_TRANSACTION; } @@ -688,11 +688,11 @@ static OCStackApplicationResult OperationModeUpdateHandler(void *ctx, OCDoHandle } else { - OC_LOG(ERROR, TAG, "Error while update operation mode"); + OIC_LOG(ERROR, TAG, "Error while update operation mode"); SetResult(otmCtx, clientResponse->result); } - OC_LOG(DEBUG, TAG, "OUT OperationModeUpdateHandler"); + OIC_LOG(DEBUG, TAG, "OUT OperationModeUpdateHandler"); exit: return OC_STACK_DELETE_TRANSACTION; @@ -701,11 +701,11 @@ exit: static OCStackResult PutOwnerTransferModeToResource(OTMContext_t* otmCtx) { - OC_LOG(DEBUG, TAG, "IN PutOwnerTransferModeToResource"); + OIC_LOG(DEBUG, TAG, "IN PutOwnerTransferModeToResource"); if(!otmCtx || !otmCtx->selectedDeviceInfo) { - OC_LOG(ERROR, TAG, "Invalid parameters"); + OIC_LOG(ERROR, TAG, "Invalid parameters"); return OC_STACK_INVALID_PARAM; } @@ -718,14 +718,14 @@ static OCStackResult PutOwnerTransferModeToResource(OTMContext_t* otmCtx) deviceInfo->connType, query, sizeof(query), OIC_RSRC_DOXM_URI)) { - OC_LOG(ERROR, TAG, "PutOwnerTransferModeToResource : Failed to generate query"); + OIC_LOG(ERROR, TAG, "PutOwnerTransferModeToResource : Failed to generate query"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if(!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } secPayload->base.type = PAYLOAD_TYPE_SECURITY; @@ -733,10 +733,10 @@ static OCStackResult PutOwnerTransferModeToResource(OTMContext_t* otmCtx) if (NULL == secPayload->securityData) { OICFree(secPayload); - OC_LOG(ERROR, TAG, "Error while converting bin to json"); + OIC_LOG(ERROR, TAG, "Error while converting bin to json"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Payload : %s", secPayload->securityData); + OIC_LOG_V(DEBUG, TAG, "Payload : %s", secPayload->securityData); OCCallbackData cbData; cbData.cb = &OwnerTransferModeHandler; @@ -747,21 +747,21 @@ static OCStackResult PutOwnerTransferModeToResource(OTMContext_t* otmCtx) deviceInfo->connType, OC_LOW_QOS, &cbData, NULL, 0); if (res != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); } - OC_LOG(DEBUG, TAG, "OUT PutOwnerTransferModeToResource"); + OIC_LOG(DEBUG, TAG, "OUT PutOwnerTransferModeToResource"); return res; } static OCStackResult GetProvisioningStatusResource(OTMContext_t* otmCtx) { - OC_LOG(DEBUG, TAG, "IN GetProvisioningStatusResource"); + OIC_LOG(DEBUG, TAG, "IN GetProvisioningStatusResource"); if(!otmCtx || !otmCtx->selectedDeviceInfo) { - OC_LOG(ERROR, TAG, "Invailed parameters"); + OIC_LOG(ERROR, TAG, "Invailed parameters"); return OC_STACK_INVALID_PARAM; } @@ -772,10 +772,10 @@ static OCStackResult GetProvisioningStatusResource(OTMContext_t* otmCtx) deviceInfo->connType, query, sizeof(query), OIC_RSRC_PSTAT_URI)) { - OC_LOG(ERROR, TAG, "GetProvisioningStatusResource : Failed to generate query"); + OIC_LOG(ERROR, TAG, "GetProvisioningStatusResource : Failed to generate query"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); OCCallbackData cbData; cbData.cb = &ListMethodsHandler; @@ -785,10 +785,10 @@ static OCStackResult GetProvisioningStatusResource(OTMContext_t* otmCtx) deviceInfo->connType, OC_LOW_QOS, &cbData, NULL, 0); if (res != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); } - OC_LOG(DEBUG, TAG, "OUT GetProvisioningStatusResource"); + OIC_LOG(DEBUG, TAG, "OUT GetProvisioningStatusResource"); return res; } @@ -796,11 +796,11 @@ static OCStackResult GetProvisioningStatusResource(OTMContext_t* otmCtx) static OCStackResult PutOwnershipInformation(OTMContext_t* otmCtx) { - OC_LOG(DEBUG, TAG, "IN PutOwnershipInformation"); + OIC_LOG(DEBUG, TAG, "IN PutOwnershipInformation"); if(!otmCtx || !otmCtx->selectedDeviceInfo) { - OC_LOG(ERROR, TAG, "Invailed parameters"); + OIC_LOG(ERROR, TAG, "Invailed parameters"); return OC_STACK_INVALID_PARAM; } @@ -811,17 +811,17 @@ static OCStackResult PutOwnershipInformation(OTMContext_t* otmCtx) deviceInfo->connType, query, sizeof(query), OIC_RSRC_DOXM_URI)) { - OC_LOG(ERROR, TAG, "PutOwnershipInformation : Failed to generate query"); + OIC_LOG(ERROR, TAG, "PutOwnershipInformation : Failed to generate query"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); //OwnershipInformationHandler OicSecOxm_t selOxm = deviceInfo->doxm->oxmSel; OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if(!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } secPayload->base.type = PAYLOAD_TYPE_SECURITY; @@ -829,7 +829,7 @@ static OCStackResult PutOwnershipInformation(OTMContext_t* otmCtx) if (NULL == secPayload->securityData) { OICFree(secPayload); - OC_LOG(ERROR, TAG, "Error while converting doxm bin to json"); + OIC_LOG(ERROR, TAG, "Error while converting doxm bin to json"); return OC_STACK_INVALID_PARAM; } @@ -842,10 +842,10 @@ static OCStackResult PutOwnershipInformation(OTMContext_t* otmCtx) deviceInfo->connType, OC_LOW_QOS, &cbData, NULL, 0); if (res != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); } - OC_LOG(DEBUG, TAG, "OUT PutOwnershipInformation"); + OIC_LOG(DEBUG, TAG, "OUT PutOwnershipInformation"); return res; } @@ -853,7 +853,7 @@ static OCStackResult PutOwnershipInformation(OTMContext_t* otmCtx) static OCStackResult PutUpdateOperationMode(OTMContext_t* otmCtx, OicSecDpom_t selectedOperationMode) { - OC_LOG(DEBUG, TAG, "IN PutUpdateOperationMode"); + OIC_LOG(DEBUG, TAG, "IN PutUpdateOperationMode"); if(!otmCtx || !otmCtx->selectedDeviceInfo) { @@ -867,17 +867,17 @@ static OCStackResult PutUpdateOperationMode(OTMContext_t* otmCtx, deviceInfo->connType, query, sizeof(query), OIC_RSRC_PSTAT_URI)) { - OC_LOG(ERROR, TAG, "PutUpdateOperationMode : Failed to generate query"); + OIC_LOG(ERROR, TAG, "PutUpdateOperationMode : Failed to generate query"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); deviceInfo->pstat->om = selectedOperationMode; OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if(!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } secPayload->base.type = PAYLOAD_TYPE_SECURITY; @@ -885,7 +885,7 @@ static OCStackResult PutUpdateOperationMode(OTMContext_t* otmCtx, if (NULL == secPayload->securityData) { OICFree(secPayload); - OC_LOG(ERROR, TAG, "Error while converting pstat bin to json"); + OIC_LOG(ERROR, TAG, "Error while converting pstat bin to json"); return OC_STACK_INVALID_PARAM; } @@ -897,17 +897,17 @@ static OCStackResult PutUpdateOperationMode(OTMContext_t* otmCtx, deviceInfo->connType, OC_LOW_QOS, &cbData, NULL, 0); if (res != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); } - OC_LOG(DEBUG, TAG, "OUT PutUpdateOperationMode"); + OIC_LOG(DEBUG, TAG, "OUT PutUpdateOperationMode"); return res; } static OCStackResult StartOwnershipTransfer(void* ctx, OCProvisionDev_t* selectedDevice) { - OC_LOG(INFO, TAG, "IN StartOwnershipTransfer"); + OIC_LOG(INFO, TAG, "IN StartOwnershipTransfer"); OTMContext_t* otmCtx = (OTMContext_t*)ctx; otmCtx->selectedDeviceInfo = selectedDevice; @@ -917,17 +917,17 @@ static OCStackResult StartOwnershipTransfer(void* ctx, OCProvisionDev_t* selecte &selectedDevice->doxm->oxmSel); if(OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Failed to select the provisioning method"); + OIC_LOG(ERROR, TAG, "Failed to select the provisioning method"); SetResult(otmCtx, res); return res; } - OC_LOG_V(DEBUG, TAG, "Selected provisoning method = %d", selectedDevice->doxm->oxmSel); + OIC_LOG_V(DEBUG, TAG, "Selected provisoning method = %d", selectedDevice->doxm->oxmSel); //Send Req: PUT /oic/sec/doxm [{..."OxmSel" :g_OTMDatas[Index of Selected OxM].OXMString,...}] res = PutOwnerTransferModeToResource(otmCtx); if(OC_STACK_OK != res) { - OC_LOG(WARNING, TAG, "Failed to select the provisioning method"); + OIC_LOG(WARNING, TAG, "Failed to select the provisioning method"); SetResult(otmCtx, res); return res; } @@ -935,10 +935,10 @@ static OCStackResult StartOwnershipTransfer(void* ctx, OCProvisionDev_t* selecte //Register DTLS event handler to catch the dtls event while handshake if(CA_STATUS_OK != CARegisterDTLSHandshakeCallback(DTLSHandshakeCB)) { - OC_LOG(WARNING, TAG, "StartOwnershipTransfer : Failed to register DTLS handshake callback."); + OIC_LOG(WARNING, TAG, "StartOwnershipTransfer : Failed to register DTLS handshake callback."); } - OC_LOG(INFO, TAG, "OUT StartOwnershipTransfer"); + OIC_LOG(INFO, TAG, "OUT StartOwnershipTransfer"); return res; @@ -946,16 +946,16 @@ static OCStackResult StartOwnershipTransfer(void* ctx, OCProvisionDev_t* selecte OCStackResult OTMSetOwnershipTransferCallbackData(OicSecOxm_t oxmType, OTMCallbackData_t* data) { - OC_LOG(DEBUG, TAG, "IN OTMSetOwnerTransferCallbackData"); + OIC_LOG(DEBUG, TAG, "IN OTMSetOwnerTransferCallbackData"); if(!data) { - OC_LOG(ERROR, TAG, "OTMSetOwnershipTransferCallbackData : Invalid parameters"); + OIC_LOG(ERROR, TAG, "OTMSetOwnershipTransferCallbackData : Invalid parameters"); return OC_STACK_INVALID_PARAM; } if(oxmType >= OIC_OXM_COUNT) { - OC_LOG(INFO, TAG, "Unknow ownership transfer method"); + OIC_LOG(INFO, TAG, "Unknow ownership transfer method"); return OC_STACK_INVALID_PARAM; } @@ -964,7 +964,7 @@ OCStackResult OTMSetOwnershipTransferCallbackData(OicSecOxm_t oxmType, OTMCallba g_OTMDatas[oxmType].createSelectOxmPayloadCB = data->createSelectOxmPayloadCB; g_OTMDatas[oxmType].createOwnerTransferPayloadCB = data->createOwnerTransferPayloadCB; - OC_LOG(DEBUG, TAG, "OUT OTMSetOwnerTransferCallbackData"); + OIC_LOG(DEBUG, TAG, "OUT OTMSetOwnerTransferCallbackData"); return OC_STACK_OK; } @@ -976,7 +976,7 @@ OCStackResult OTMDoOwnershipTransfer(void* ctx, OCProvisionDev_t *selectedDevicelist, OCProvisionResultCB resultCallback) { - OC_LOG(DEBUG, TAG, "IN OTMDoOwnershipTransfer"); + OIC_LOG(DEBUG, TAG, "IN OTMDoOwnershipTransfer"); if (NULL == selectedDevicelist || NULL == resultCallback ) { @@ -986,7 +986,7 @@ OCStackResult OTMDoOwnershipTransfer(void* ctx, OTMContext_t* otmCtx = (OTMContext_t*)OICCalloc(1,sizeof(OTMContext_t)); if(!otmCtx) { - OC_LOG(ERROR, TAG, "Failed to create OTM Context"); + OIC_LOG(ERROR, TAG, "Failed to create OTM Context"); return OC_STACK_NO_MEMORY; } otmCtx->ctxResultCallback = resultCallback; @@ -1006,7 +1006,7 @@ OCStackResult OTMDoOwnershipTransfer(void* ctx, (OCProvisionResult_t*)OICCalloc(otmCtx->ctxResultArraySize, sizeof(OCProvisionResult_t)); if(NULL == otmCtx->ctxResultArray) { - OC_LOG(ERROR, TAG, "OTMDoOwnershipTransfer : Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "OTMDoOwnershipTransfer : Failed to memory allocation"); OICFree(otmCtx); return OC_STACK_NO_MEMORY; } @@ -1025,7 +1025,7 @@ OCStackResult OTMDoOwnershipTransfer(void* ctx, } if (isDuplicate) { - OC_LOG(ERROR, TAG, "OTMDoOwnershipTransfer : Device ID is duplicated"); + OIC_LOG(ERROR, TAG, "OTMDoOwnershipTransfer : Device ID is duplicated"); res = OC_STACK_INVALID_PARAM; goto error; } @@ -1038,7 +1038,7 @@ OCStackResult OTMDoOwnershipTransfer(void* ctx, StartOwnershipTransfer(otmCtx, selectedDevicelist); - OC_LOG(DEBUG, TAG, "OUT OTMDoOwnershipTransfer"); + OIC_LOG(DEBUG, TAG, "OUT OTMDoOwnershipTransfer"); return OC_STACK_OK; error: @@ -1060,7 +1060,7 @@ error: static OCStackApplicationResult FinalizeProvisioningCB(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OC_LOG_V(INFO, TAG, "IN FinalizeProvisioningCB."); + OIC_LOG_V(INFO, TAG, "IN FinalizeProvisioningCB."); VERIFY_NON_NULL(TAG, clientResponse, ERROR); VERIFY_NON_NULL(TAG, ctx, ERROR); @@ -1073,13 +1073,13 @@ static OCStackApplicationResult FinalizeProvisioningCB(void *ctx, OCDoHandle UNU if (OC_STACK_OK == res) { - OC_LOG_V(INFO, TAG, "Add device's UUID in PDM_DB"); + OIC_LOG_V(INFO, TAG, "Add device's UUID in PDM_DB"); SetResult(otmCtx, OC_STACK_OK); return OC_STACK_DELETE_TRANSACTION; } else { - OC_LOG(ERROR, TAG, "Ownership transfer is complete but adding information to DB is failed."); + OIC_LOG(ERROR, TAG, "Ownership transfer is complete but adding information to DB is failed."); } } exit: @@ -1098,7 +1098,7 @@ exit: static OCStackApplicationResult ProvisionDefaultACLCB(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OC_LOG_V(INFO, TAG, "IN ProvisionDefaultACLCB."); + OIC_LOG_V(INFO, TAG, "IN ProvisionDefaultACLCB."); VERIFY_NON_NULL(TAG, clientResponse, ERROR); VERIFY_NON_NULL(TAG, ctx, ERROR); @@ -1108,7 +1108,7 @@ static OCStackApplicationResult ProvisionDefaultACLCB(void *ctx, OCDoHandle UNUS if (OC_STACK_RESOURCE_CREATED == clientResponse->result) { - OC_LOG_V(INFO, TAG, "Staring commit hash task."); + OIC_LOG_V(INFO, TAG, "Staring commit hash task."); // TODO hash currently have fixed value 0. uint16_t aclHash = 0; otmCtx->selectedDeviceInfo->pstat->commitHash = aclHash; @@ -1116,7 +1116,7 @@ static OCStackApplicationResult ProvisionDefaultACLCB(void *ctx, OCDoHandle UNUS OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if(!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } secPayload->base.type = PAYLOAD_TYPE_SECURITY; @@ -1127,7 +1127,7 @@ static OCStackApplicationResult ProvisionDefaultACLCB(void *ctx, OCDoHandle UNUS SetResult(otmCtx, OC_STACK_INVALID_JSON); return OC_STACK_DELETE_TRANSACTION; } - OC_LOG_V(INFO, TAG, "Created payload for commit hash: %s",secPayload->securityData); + OIC_LOG_V(INFO, TAG, "Created payload for commit hash: %s",secPayload->securityData); char query[MAX_URI_LENGTH + MAX_QUERY_LENGTH] = {0}; if(!PMGenerateQuery(true, @@ -1136,10 +1136,10 @@ static OCStackApplicationResult ProvisionDefaultACLCB(void *ctx, OCDoHandle UNUS otmCtx->selectedDeviceInfo->connType, query, sizeof(query), OIC_RSRC_PSTAT_URI)) { - OC_LOG(ERROR, TAG, "ProvisionDefaultACLCB : Failed to generate query"); + OIC_LOG(ERROR, TAG, "ProvisionDefaultACLCB : Failed to generate query"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); OCCallbackData cbData = {.context=NULL, .cb=NULL, .cd=NULL}; cbData.cb = &FinalizeProvisioningCB; @@ -1147,16 +1147,16 @@ static OCStackApplicationResult ProvisionDefaultACLCB(void *ctx, OCDoHandle UNUS cbData.cd = NULL; OCStackResult ret = OCDoResource(NULL, OC_REST_PUT, query, 0, (OCPayload*)secPayload, otmCtx->selectedDeviceInfo->connType, OC_HIGH_QOS, &cbData, NULL, 0); - OC_LOG_V(INFO, TAG, "OCDoResource returned: %d",ret); + OIC_LOG_V(INFO, TAG, "OCDoResource returned: %d",ret); if (ret != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); SetResult(otmCtx, ret); } } else { - OC_LOG_V(INFO, TAG, "Error occured in provisionDefaultACLCB :: %d\n", + OIC_LOG_V(INFO, TAG, "Error occured in provisionDefaultACLCB :: %d\n", clientResponse->result); SetResult(otmCtx, clientResponse->result); } @@ -1167,16 +1167,16 @@ exit: OCStackResult FinalizeProvisioning(OTMContext_t* otmCtx) { - OC_LOG(INFO, TAG, "IN FinalizeProvisioning"); + OIC_LOG(INFO, TAG, "IN FinalizeProvisioning"); if(!otmCtx) { - OC_LOG(ERROR, TAG, "OTMContext is NULL"); + OIC_LOG(ERROR, TAG, "OTMContext is NULL"); return OC_STACK_INVALID_PARAM; } if(!otmCtx->selectedDeviceInfo) { - OC_LOG(ERROR, TAG, "Can't find device information in OTMContext"); + OIC_LOG(ERROR, TAG, "Can't find device information in OTMContext"); OICFree(otmCtx); return OC_STACK_INVALID_PARAM; } @@ -1197,11 +1197,11 @@ OCStackResult FinalizeProvisioning(OTMContext_t* otmCtx) OicUuid_t provTooldeviceID = {.id={0}}; if (OC_STACK_OK != GetDoxmDeviceID(&provTooldeviceID)) { - OC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); + OIC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); SetResult(otmCtx, OC_STACK_ERROR); return OC_STACK_ERROR; } - OC_LOG(INFO, TAG, "Retieved deviceID"); + OIC_LOG(INFO, TAG, "Retieved deviceID"); memcpy(defaultAcl.subject.id, provTooldeviceID.id, sizeof(defaultAcl.subject.id)); char *wildCardResource = "*"; defaultAcl.resources = &wildCardResource; @@ -1209,17 +1209,17 @@ OCStackResult FinalizeProvisioning(OTMContext_t* otmCtx) defaultAcl.owners = (OicUuid_t *) OICCalloc(1, UUID_LENGTH); if(!defaultAcl.owners) { - OC_LOG(ERROR, TAG, "Failed to memory allocation for default ACL"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation for default ACL"); SetResult(otmCtx, OC_STACK_NO_MEMORY); return OC_STACK_NO_MEMORY; } memcpy(defaultAcl.owners->id, provTooldeviceID.id, UUID_LENGTH); - OC_LOG(INFO, TAG, "Provisioning default ACL"); + OIC_LOG(INFO, TAG, "Provisioning default ACL"); OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if(!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } secPayload->base.type = PAYLOAD_TYPE_SECURITY; @@ -1228,11 +1228,11 @@ OCStackResult FinalizeProvisioning(OTMContext_t* otmCtx) if(!secPayload->securityData) { OICFree(secPayload); - OC_LOG(INFO, TAG, "FinalizeProvisioning : Failed to BinToAclJSON"); + OIC_LOG(INFO, TAG, "FinalizeProvisioning : Failed to BinToAclJSON"); SetResult(otmCtx, OC_STACK_ERROR); return OC_STACK_ERROR; } - OC_LOG_V(INFO, TAG, "Provisioning default ACL : %s",secPayload->securityData); + OIC_LOG_V(INFO, TAG, "Provisioning default ACL : %s",secPayload->securityData); char query[MAX_URI_LENGTH + MAX_QUERY_LENGTH] = {0}; if(!PMGenerateQuery(true, @@ -1241,12 +1241,12 @@ OCStackResult FinalizeProvisioning(OTMContext_t* otmCtx) otmCtx->selectedDeviceInfo->connType, query, sizeof(query), OIC_RSRC_ACL_URI)) { - OC_LOG(ERROR, TAG, "FinalizeProvisioning : Failed to generate query"); + OIC_LOG(ERROR, TAG, "FinalizeProvisioning : Failed to generate query"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); - OC_LOG_V(INFO, TAG, "Request URI for Provisioning default ACL : %s", query); + OIC_LOG_V(INFO, TAG, "Request URI for Provisioning default ACL : %s", query); OCCallbackData cbData = {.context=NULL, .cb=NULL, .cd=NULL}; cbData.cb = &ProvisionDefaultACLCB; @@ -1261,7 +1261,7 @@ OCStackResult FinalizeProvisioning(OTMContext_t* otmCtx) return ret; } - OC_LOG(INFO, TAG, "OUT FinalizeProvisioning"); + OIC_LOG(INFO, TAG, "OUT FinalizeProvisioning"); return ret; diff --git a/resource/csdk/security/provisioning/src/oxmjustworks.c b/resource/csdk/security/provisioning/src/oxmjustworks.c index 7a0d561..07d0244 100644 --- a/resource/csdk/security/provisioning/src/oxmjustworks.c +++ b/resource/csdk/security/provisioning/src/oxmjustworks.c @@ -54,7 +54,7 @@ char* CreateJustWorksOwnerTransferPayload(OTMContext_t* otmCtx) if (OC_STACK_OK != GetDoxmDeviceID(&uuidPT)) { - OC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); + OIC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); return NULL; } memcpy(otmCtx->selectedDeviceInfo->doxm->owner.id, uuidPT.id , UUID_LENGTH); @@ -72,7 +72,7 @@ OCStackResult LoadSecretJustWorksCallback(OTMContext_t* UNUSED_PARAM) OCStackResult CreateSecureSessionJustWorksCallback(OTMContext_t* otmCtx) { - OC_LOG(INFO, TAG, "IN CreateSecureSessionJustWorksCallback"); + OIC_LOG(INFO, TAG, "IN CreateSecureSessionJustWorksCallback"); if(!otmCtx || !otmCtx->selectedDeviceInfo) { return OC_STACK_INVALID_PARAM; @@ -81,27 +81,27 @@ OCStackResult CreateSecureSessionJustWorksCallback(OTMContext_t* otmCtx) CAResult_t caresult = CAEnableAnonECDHCipherSuite(true); if (CA_STATUS_OK != caresult) { - OC_LOG_V(ERROR, TAG, "Unable to enable anon cipher suite"); + OIC_LOG_V(ERROR, TAG, "Unable to enable anon cipher suite"); return OC_STACK_ERROR; } - OC_LOG(INFO, TAG, "Anonymous cipher suite Enabled."); + OIC_LOG(INFO, TAG, "Anonymous cipher suite Enabled."); caresult = CASelectCipherSuite(TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256); if (CA_STATUS_OK != caresult) { - OC_LOG_V(ERROR, TAG, "Failed to select TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256"); + OIC_LOG_V(ERROR, TAG, "Failed to select TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256"); caresult = CAEnableAnonECDHCipherSuite(false); if (CA_STATUS_OK != caresult) { - OC_LOG_V(ERROR, TAG, "Unable to enable anon cipher suite"); + OIC_LOG_V(ERROR, TAG, "Unable to enable anon cipher suite"); } else { - OC_LOG(INFO, TAG, "Anonymous cipher suite Disabled."); + OIC_LOG(INFO, TAG, "Anonymous cipher suite Disabled."); } return OC_STACK_ERROR; } - OC_LOG(INFO, TAG, "TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256 cipher suite selected."); + OIC_LOG(INFO, TAG, "TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256 cipher suite selected."); OCProvisionDev_t* selDevInfo = otmCtx->selectedDeviceInfo; CAEndpoint_t *endpoint = (CAEndpoint_t *)OICCalloc(1, sizeof (CAEndpoint_t)); @@ -116,10 +116,10 @@ OCStackResult CreateSecureSessionJustWorksCallback(OTMContext_t* otmCtx) OICFree(endpoint); if (CA_STATUS_OK != caresult) { - OC_LOG_V(ERROR, TAG, "DTLS handshake failure."); + OIC_LOG_V(ERROR, TAG, "DTLS handshake failure."); return OC_STACK_ERROR; } - OC_LOG(INFO, TAG, "OUT CreateSecureSessionJustWorksCallback"); + OIC_LOG(INFO, TAG, "OUT CreateSecureSessionJustWorksCallback"); return OC_STACK_OK; } diff --git a/resource/csdk/security/provisioning/src/oxmrandompin.c b/resource/csdk/security/provisioning/src/oxmrandompin.c index 8e9ad1e..8af7ce7 100644 --- a/resource/csdk/security/provisioning/src/oxmrandompin.c +++ b/resource/csdk/security/provisioning/src/oxmrandompin.c @@ -50,7 +50,7 @@ char* CreatePinBasedSelectOxmPayload(OTMContext_t* otmCtx) OicUuid_t uuidPT = {.id={0}}; if (OC_STACK_OK != GetDoxmDeviceID(&uuidPT)) { - OC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); + OIC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); return NULL; } memcpy(otmCtx->selectedDeviceInfo->doxm->owner.id, uuidPT.id, UUID_LENGTH); @@ -69,7 +69,7 @@ char* CreatePinBasedOwnerTransferPayload(OTMContext_t* otmCtx) if (OC_STACK_OK != GetDoxmDeviceID(&uuidPT)) { - OC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); + OIC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); return NULL; } memcpy(otmCtx->selectedDeviceInfo->doxm->owner.id, uuidPT.id , UUID_LENGTH); @@ -90,14 +90,14 @@ OCStackResult InputPinCodeCallback(OTMContext_t* otmCtx) OCStackResult res = InputPin((char*)pinData, OXM_RANDOM_PIN_SIZE + 1); if(OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Failed to input PIN"); + OIC_LOG(ERROR, TAG, "Failed to input PIN"); return res; } OicUuid_t deviceUUID = {.id={0}}; if (OC_STACK_OK != GetDoxmDeviceID(&deviceUUID)) { - OC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); + OIC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); return OC_STACK_ERROR; } @@ -107,7 +107,7 @@ OCStackResult InputPinCodeCallback(OTMContext_t* otmCtx) 1, &deviceUUID, &otmCtx->subIdForPinOxm); if(res != OC_STACK_OK) { - OC_LOG_V(ERROR, TAG, "Failed to save the temporal PSK : %d", res); + OIC_LOG_V(ERROR, TAG, "Failed to save the temporal PSK : %d", res); } return res; @@ -115,7 +115,7 @@ OCStackResult InputPinCodeCallback(OTMContext_t* otmCtx) OCStackResult CreateSecureSessionRandomPinCallbak(OTMContext_t* otmCtx) { - OC_LOG(INFO, TAG, "IN CreateSecureSessionRandomPinCallbak"); + OIC_LOG(INFO, TAG, "IN CreateSecureSessionRandomPinCallbak"); if(!otmCtx || !otmCtx->selectedDeviceInfo) { @@ -125,18 +125,18 @@ OCStackResult CreateSecureSessionRandomPinCallbak(OTMContext_t* otmCtx) CAResult_t caresult = CAEnableAnonECDHCipherSuite(false); if (CA_STATUS_OK != caresult) { - OC_LOG_V(ERROR, TAG, "Unable to disable anon cipher suite"); + OIC_LOG_V(ERROR, TAG, "Unable to disable anon cipher suite"); return OC_STACK_ERROR; } - OC_LOG(INFO, TAG, "Anonymous cipher suite disabled."); + OIC_LOG(INFO, TAG, "Anonymous cipher suite disabled."); caresult = CASelectCipherSuite(TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256); if (CA_STATUS_OK != caresult) { - OC_LOG_V(ERROR, TAG, "Failed to select TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256"); + OIC_LOG_V(ERROR, TAG, "Failed to select TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256"); return OC_STACK_ERROR; } - OC_LOG(INFO, TAG, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256 cipher suite selected."); + OIC_LOG(INFO, TAG, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256 cipher suite selected."); OCProvisionDev_t* selDevInfo = otmCtx->selectedDeviceInfo; @@ -151,11 +151,11 @@ OCStackResult CreateSecureSessionRandomPinCallbak(OTMContext_t* otmCtx) OICFree(endpoint); if (CA_STATUS_OK != caresult) { - OC_LOG_V(ERROR, TAG, "DTLS handshake failure."); + OIC_LOG_V(ERROR, TAG, "DTLS handshake failure."); return OC_STACK_ERROR; } - OC_LOG(INFO, TAG, "OUT CreateSecureSessionRandomPinCallbak"); + OIC_LOG(INFO, TAG, "OUT CreateSecureSessionRandomPinCallbak"); return OC_STACK_OK; } diff --git a/resource/csdk/security/provisioning/src/pmutility.c b/resource/csdk/security/provisioning/src/pmutility.c index 60daa64..2e4158b 100755 --- a/resource/csdk/security/provisioning/src/pmutility.c +++ b/resource/csdk/security/provisioning/src/pmutility.c @@ -64,7 +64,7 @@ OCProvisionDev_t* GetDevice(OCProvisionDev_t **ppDevicesList, const char* addr, { if(NULL == addr || NULL == *ppDevicesList) { - OC_LOG_V(ERROR, TAG, "Invalid Input parameters in [%s]\n", __FUNCTION__); + OIC_LOG_V(ERROR, TAG, "Invalid Input parameters in [%s]\n", __FUNCTION__); return NULL; } @@ -107,7 +107,7 @@ OCStackResult AddDevice(OCProvisionDev_t **ppDevicesList, const char* addr, cons ptr = (OCProvisionDev_t *)OICCalloc(1, sizeof (OCProvisionDev_t)); if (NULL == ptr) { - OC_LOG(ERROR, TAG, "Error while allocating memory for linkedlist node !!"); + OIC_LOG(ERROR, TAG, "Error while allocating memory for linkedlist node !!"); return OC_STACK_NO_MEMORY; } @@ -143,7 +143,7 @@ OCStackResult UpdateSecurePortOfDevice(OCProvisionDev_t **ppDevicesList, const c if(!ptr) { - OC_LOG(ERROR, TAG, "Can not find device information in the discovery device list"); + OIC_LOG(ERROR, TAG, "Can not find device information in the discovery device list"); return OC_STACK_ERROR; } @@ -175,11 +175,11 @@ void PMDeleteDeviceList(OCProvisionDev_t *pDevicesList) OCProvisionDev_t* PMCloneOCProvisionDev(const OCProvisionDev_t* src) { - OC_LOG(DEBUG, TAG, "IN PMCloneOCProvisionDev"); + OIC_LOG(DEBUG, TAG, "IN PMCloneOCProvisionDev"); if (!src) { - OC_LOG(ERROR, TAG, "PMCloneOCProvisionDev : Invalid parameter"); + OIC_LOG(ERROR, TAG, "PMCloneOCProvisionDev : Invalid parameter"); return NULL; } @@ -215,12 +215,12 @@ OCProvisionDev_t* PMCloneOCProvisionDev(const OCProvisionDev_t* src) newDev->connType = src->connType; newDev->next = NULL; - OC_LOG(DEBUG, TAG, "OUT PMCloneOCProvisionDev"); + OIC_LOG(DEBUG, TAG, "OUT PMCloneOCProvisionDev"); return newDev; exit: - OC_LOG(ERROR, TAG, "PMCloneOCProvisionDev : Failed to allocate memory"); + OIC_LOG(ERROR, TAG, "PMCloneOCProvisionDev : Failed to allocate memory"); if (newDev) { OICFree(newDev->pstat); @@ -333,7 +333,7 @@ bool PMGenerateQuery(bool isSecure, { if(!address || !buffer || !uri) { - OC_LOG(ERROR, TAG, "PMGenerateQuery : Invalid parameters."); + OIC_LOG(ERROR, TAG, "PMGenerateQuery : Invalid parameters."); return false; } @@ -354,18 +354,18 @@ bool PMGenerateQuery(bool isSecure, prefix, address, port, uri); break; default: - OC_LOG(ERROR, TAG, "Unknown address format."); + OIC_LOG(ERROR, TAG, "Unknown address format."); return false; } // snprintf return value check if (snRet < 0) { - OC_LOG_V(ERROR, TAG, "PMGenerateQuery : Error (snprintf) %d\n", snRet); + OIC_LOG_V(ERROR, TAG, "PMGenerateQuery : Error (snprintf) %d\n", snRet); return false; } else if ((size_t)snRet >= bufferSize) { - OC_LOG_V(ERROR, TAG, "PMGenerateQuery : Truncated (snprintf) %d\n", snRet); + OIC_LOG_V(ERROR, TAG, "PMGenerateQuery : Truncated (snprintf) %d\n", snRet); return false; } @@ -373,11 +373,11 @@ bool PMGenerateQuery(bool isSecure, // TODO: We need to verify tinyDTLS in below cases case CT_ADAPTER_GATT_BTLE: case CT_ADAPTER_RFCOMM_BTEDR: - OC_LOG(ERROR, TAG, "Not supported connectivity adapter."); + OIC_LOG(ERROR, TAG, "Not supported connectivity adapter."); return false; break; default: - OC_LOG(ERROR, TAG, "Unknown connectivity adapter."); + OIC_LOG(ERROR, TAG, "Unknown connectivity adapter."); return false; } @@ -399,7 +399,7 @@ static OCStackApplicationResult SecurePortDiscoveryHandler(void *ctx, OCDoHandle { if (ctx == NULL) { - OC_LOG(ERROR, TAG, "Lost List of device information"); + OIC_LOG(ERROR, TAG, "Lost List of device information"); return OC_STACK_DELETE_TRANSACTION; } (void)UNUSED; @@ -407,13 +407,13 @@ static OCStackApplicationResult SecurePortDiscoveryHandler(void *ctx, OCDoHandle { if (NULL == clientResponse->payload) { - OC_LOG(INFO, TAG, "Skiping Null payload"); + OIC_LOG(INFO, TAG, "Skiping Null payload"); } else { if (PAYLOAD_TYPE_DISCOVERY != clientResponse->payload->type) { - OC_LOG(INFO, TAG, "Wrong payload type"); + OIC_LOG(INFO, TAG, "Wrong payload type"); return OC_STACK_DELETE_TRANSACTION; } @@ -426,7 +426,7 @@ static OCStackApplicationResult SecurePortDiscoveryHandler(void *ctx, OCDoHandle } else { - OC_LOG(INFO, TAG, "Can not find secure port information."); + OIC_LOG(INFO, TAG, "Can not find secure port information."); return OC_STACK_DELETE_TRANSACTION; } @@ -437,17 +437,17 @@ static OCStackApplicationResult SecurePortDiscoveryHandler(void *ctx, OCDoHandle clientResponse->devAddr.port, securePort); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Error while getting secure port."); + OIC_LOG(ERROR, TAG, "Error while getting secure port."); return OC_STACK_DELETE_TRANSACTION; } - OC_LOG(INFO, TAG, "Exiting SecurePortDiscoveryHandler."); + OIC_LOG(INFO, TAG, "Exiting SecurePortDiscoveryHandler."); } return OC_STACK_DELETE_TRANSACTION; } else { - OC_LOG(INFO, TAG, "Skiping Null response"); + OIC_LOG(INFO, TAG, "Skiping Null response"); } return OC_STACK_DELETE_TRANSACTION; } @@ -466,7 +466,7 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU { if (ctx == NULL) { - OC_LOG(ERROR, TAG, "Lost List of device information"); + OIC_LOG(ERROR, TAG, "Lost List of device information"); return OC_STACK_KEEP_TRANSACTION; } (void)UNUSED; @@ -474,31 +474,31 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU { if (NULL == clientResponse->payload) { - OC_LOG(INFO, TAG, "Skiping Null payload"); + OIC_LOG(INFO, TAG, "Skiping Null payload"); return OC_STACK_KEEP_TRANSACTION; } if (OC_STACK_OK != clientResponse->result) { - OC_LOG(INFO, TAG, "Error in response"); + OIC_LOG(INFO, TAG, "Error in response"); return OC_STACK_KEEP_TRANSACTION; } else { if (PAYLOAD_TYPE_SECURITY != clientResponse->payload->type) { - OC_LOG(INFO, TAG, "Unknown payload type"); + OIC_LOG(INFO, TAG, "Unknown payload type"); return OC_STACK_KEEP_TRANSACTION; } OicSecDoxm_t *ptrDoxm = JSONToDoxmBin( ((OCSecurityPayload*)clientResponse->payload)->securityData); if (NULL == ptrDoxm) { - OC_LOG(INFO, TAG, "Ignoring malformed JSON"); + OIC_LOG(INFO, TAG, "Ignoring malformed JSON"); return OC_STACK_KEEP_TRANSACTION; } else { - OC_LOG(DEBUG, TAG, "Successfully converted doxm json to bin."); + OIC_LOG(DEBUG, TAG, "Successfully converted doxm json to bin."); //If this is owend device discovery we have to filter out the responses. DiscoveryInfo* pDInfo = (DiscoveryInfo*)ctx; @@ -510,7 +510,7 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU OCStackResult res = GetDoxmDevOwnerId(&myId); if(OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Error while getting my device ID."); + OIC_LOG(ERROR, TAG, "Error while getting my device ID."); DeleteDoxmBinData(ptrDoxm); return OC_STACK_KEEP_TRANSACTION; } @@ -519,7 +519,7 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU if( (pDInfo->isOwnedDiscovery) && (0 != memcmp(&ptrDoxm->owner.id, &myId.id, sizeof(myId.id))) ) { - OC_LOG(DEBUG, TAG, "Discovered device is not owend by me"); + OIC_LOG(DEBUG, TAG, "Discovered device is not owend by me"); DeleteDoxmBinData(ptrDoxm); return OC_STACK_KEEP_TRANSACTION; } @@ -530,7 +530,7 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU clientResponse->connType, ptrDoxm); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Error while adding data to linkedlist."); + OIC_LOG(ERROR, TAG, "Error while adding data to linkedlist."); DeleteDoxmBinData(ptrDoxm); return OC_STACK_KEEP_TRANSACTION; } @@ -539,7 +539,7 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU OC_RSRVD_WELL_KNOWN_URI, OC_RSRVD_RESOURCE_TYPE, OIC_RSRC_TYPE_SEC_DOXM); if(wr_len <= 0 || (size_t)wr_len >= sizeof(rsrc_uri)) { - OC_LOG(ERROR, TAG, "rsrc_uri_string_print failed"); + OIC_LOG(ERROR, TAG, "rsrc_uri_string_print failed"); return OC_STACK_ERROR; } //Try to the unicast discovery to getting secure port @@ -549,10 +549,10 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU clientResponse->connType, query, sizeof(query), rsrc_uri)) { - OC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); + OIC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); return OC_STACK_KEEP_TRANSACTION; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); OCCallbackData cbData; cbData.cb = &SecurePortDiscoveryHandler; @@ -563,14 +563,14 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU // TODO: Should we use the default secure port in case of error? if(OC_STACK_OK != ret) { - OC_LOG(ERROR, TAG, "Failed to Secure Port Discovery"); + OIC_LOG(ERROR, TAG, "Failed to Secure Port Discovery"); return OC_STACK_KEEP_TRANSACTION; } else { - OC_LOG_V(INFO, TAG, "OCDoResource with [%s] Success", query); + OIC_LOG_V(INFO, TAG, "OCDoResource with [%s] Success", query); } - OC_LOG(INFO, TAG, "Exiting ProvisionDiscoveryHandler."); + OIC_LOG(INFO, TAG, "Exiting ProvisionDiscoveryHandler."); } return OC_STACK_KEEP_TRANSACTION; @@ -578,7 +578,7 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU } else { - OC_LOG(INFO, TAG, "Skiping Null response"); + OIC_LOG(INFO, TAG, "Skiping Null response"); return OC_STACK_KEEP_TRANSACTION; } @@ -596,11 +596,11 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU */ OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisionDev_t **ppDevicesList) { - OC_LOG(DEBUG, TAG, "IN PMDeviceDiscovery"); + OIC_LOG(DEBUG, TAG, "IN PMDeviceDiscovery"); if (NULL != *ppDevicesList) { - OC_LOG(ERROR, TAG, "List is not null can cause memory leak"); + OIC_LOG(ERROR, TAG, "List is not null can cause memory leak"); return OC_STACK_INVALID_PARAM; } @@ -610,7 +610,7 @@ OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisi DiscoveryInfo *pDInfo = OICCalloc(1, sizeof(DiscoveryInfo)); if(NULL == pDInfo) { - OC_LOG(ERROR, TAG, "PMDeviceDiscovery : Memory allocation failed."); + OIC_LOG(ERROR, TAG, "PMDeviceDiscovery : Memory allocation failed."); return OC_STACK_NO_MEMORY; } @@ -631,7 +631,7 @@ OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisi CT_DEFAULT, OC_LOW_QOS, &cbData, NULL, 0); if (res != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); OICFree(pDInfo); return res; } @@ -640,23 +640,23 @@ OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisi res = PMTimeout(waittime, true); if(OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Failed to wait response for secure discovery."); + OIC_LOG(ERROR, TAG, "Failed to wait response for secure discovery."); OICFree(pDInfo); OCStackResult resCancel = OCCancel(handle, OC_LOW_QOS, NULL, 0); if(OC_STACK_OK != resCancel) { - OC_LOG(ERROR, TAG, "Failed to remove registered callback"); + OIC_LOG(ERROR, TAG, "Failed to remove registered callback"); } return res; } res = OCCancel(handle,OC_LOW_QOS,NULL,0); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Failed to remove registered callback"); + OIC_LOG(ERROR, TAG, "Failed to remove registered callback"); OICFree(pDInfo); return res; } - OC_LOG(DEBUG, TAG, "OUT PMDeviceDiscovery"); + OIC_LOG(DEBUG, TAG, "OUT PMDeviceDiscovery"); OICFree(pDInfo); return res; } @@ -664,22 +664,22 @@ OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisi /** * Function to print OCProvisionDev_t for debug purpose. * - * @param[in] pDev Pointer to OCProvisionDev_t. It's information will be printed by OC_LOG_XX + * @param[in] pDev Pointer to OCProvisionDev_t. It's information will be printed by OIC_LOG_XX * */ void PMPrintOCProvisionDev(const OCProvisionDev_t* pDev) { if (pDev) { - OC_LOG(DEBUG, TAG, "+++++ OCProvisionDev_t Information +++++"); - OC_LOG_V(DEBUG, TAG, "IP %s", pDev->endpoint.addr); - OC_LOG_V(DEBUG, TAG, "PORT %d", pDev->endpoint.port); - OC_LOG_V(DEBUG, TAG, "S-PORT %d", pDev->securePort); - OC_LOG(DEBUG, TAG, "++++++++++++++++++++++++++++++++++++++++"); + OIC_LOG(DEBUG, TAG, "+++++ OCProvisionDev_t Information +++++"); + OIC_LOG_V(DEBUG, TAG, "IP %s", pDev->endpoint.addr); + OIC_LOG_V(DEBUG, TAG, "PORT %d", pDev->endpoint.port); + OIC_LOG_V(DEBUG, TAG, "S-PORT %d", pDev->securePort); + OIC_LOG(DEBUG, TAG, "++++++++++++++++++++++++++++++++++++++++"); } else { - OC_LOG(DEBUG, TAG, "+++++ OCProvisionDev_t is NULL +++++"); + OIC_LOG(DEBUG, TAG, "+++++ OCProvisionDev_t is NULL +++++"); } } diff --git a/resource/csdk/security/provisioning/src/provisioningdatabasemanager.c b/resource/csdk/security/provisioning/src/provisioningdatabasemanager.c index 7adf7eb..907a6a2 100644 --- a/resource/csdk/security/provisioning/src/provisioningdatabasemanager.c +++ b/resource/csdk/security/provisioning/src/provisioningdatabasemanager.c @@ -56,7 +56,7 @@ * eg: VERIFY_NON_NULL(TAG, ptrData, ERROR,OC_STACK_ERROR); */ #define PDM_VERIFY_SQLITE_OK(tag, arg, logLevel, retValue) do{ if (SQLITE_OK != (arg)) \ - { OC_LOG_V((logLevel), tag, "Error in " #arg ", Error Message: %s", \ + { OIC_LOG_V((logLevel), tag, "Error in " #arg ", Error Message: %s", \ sqlite3_errmsg(g_db)); return retValue; }}while(0) #define PDM_SQLITE_TRANSACTION_BEGIN "BEGIN TRANSACTION;" @@ -85,7 +85,7 @@ { int temp; temp = id1; id1 = id2; id2 = temp; }}while(0) #define CHECK_PDM_INIT(tag) do{if(true != gInit)\ - { OC_LOG(ERROR, (tag), "PDB is not initialized"); \ + { OIC_LOG(ERROR, (tag), "PDB is not initialized"); \ return OC_STACK_PDM_IS_NOT_INITIALIZED; }}while(0) static sqlite3 *g_db = NULL; @@ -104,11 +104,11 @@ static OCStackResult createDB(const char* path) result = sqlite3_exec(g_db, PDM_CREATE_T_DEVICE_LIST, NULL, NULL, NULL); PDM_VERIFY_SQLITE_OK(TAG, result, ERROR, OC_STACK_ERROR); - OC_LOG(INFO, TAG, "Created T_DEVICE_LIST"); + OIC_LOG(INFO, TAG, "Created T_DEVICE_LIST"); result = sqlite3_exec(g_db, PDM_CREATE_T_DEVICE_LINK, NULL, NULL, NULL); PDM_VERIFY_SQLITE_OK(TAG, result, ERROR, OC_STACK_ERROR); - OC_LOG(INFO, TAG, "Created T_DEVICE_LINK_STATE"); + OIC_LOG(INFO, TAG, "Created T_DEVICE_LINK_STATE"); gInit = true; return OC_STACK_OK; } @@ -155,7 +155,7 @@ void errLogCallback(void *pArg, int iErrCode, const char *zMsg) (void) pArg; (void) iErrCode; (void) zMsg; - OC_LOG_V(DEBUG,TAG, "(%d) %s", iErrCode, zMsg); + OIC_LOG_V(DEBUG,TAG, "(%d) %s", iErrCode, zMsg); } OCStackResult PDMInit(const char *path) @@ -164,7 +164,7 @@ OCStackResult PDMInit(const char *path) const char *dbPath = NULL; if (SQLITE_OK != sqlite3_config(SQLITE_CONFIG_LOG, errLogCallback, NULL)) { - OC_LOG(INFO, TAG, "Unable to enable debug log of sqlite"); + OIC_LOG(INFO, TAG, "Unable to enable debug log of sqlite"); } if (NULL == path || !*path) @@ -178,7 +178,7 @@ OCStackResult PDMInit(const char *path) rc = sqlite3_open_v2(dbPath, &g_db, SQLITE_OPEN_READWRITE, NULL); if (SQLITE_OK != rc) { - OC_LOG_V(INFO, TAG, "ERROR: Can't open database: %s", sqlite3_errmsg(g_db)); + OIC_LOG_V(INFO, TAG, "ERROR: Can't open database: %s", sqlite3_errmsg(g_db)); return createDB(dbPath); } gInit = true; @@ -212,11 +212,11 @@ OCStackResult PDMAddDevice(const OicUuid_t *UUID) if (SQLITE_CONSTRAINT == res) { //new OCStack result code - OC_LOG_V(ERROR, TAG, "Error Occured: %s",sqlite3_errmsg(g_db)); + OIC_LOG_V(ERROR, TAG, "Error Occured: %s",sqlite3_errmsg(g_db)); sqlite3_finalize(stmt); return OC_STACK_DUPLICATE_UUID; } - OC_LOG_V(ERROR, TAG, "Error Occured: %s",sqlite3_errmsg(g_db)); + OIC_LOG_V(ERROR, TAG, "Error Occured: %s",sqlite3_errmsg(g_db)); sqlite3_finalize(stmt); return OC_STACK_ERROR; } @@ -231,7 +231,7 @@ static OCStackResult isDeviceStale(const OicUuid_t *uuid, bool *result) { if (NULL == uuid || NULL == result) { - OC_LOG(ERROR, TAG, "UUID or result is NULL"); + OIC_LOG(ERROR, TAG, "UUID or result is NULL"); return OC_STACK_INVALID_PARAM; } @@ -248,10 +248,10 @@ static OCStackResult isDeviceStale(const OicUuid_t *uuid, bool *result) while(SQLITE_ROW == sqlite3_step(stmt)) { int tempStaleStateFromDb = sqlite3_column_int(stmt, PDM_FIRST_INDEX); - OC_LOG_V(DEBUG, TAG, "Stale state is %d", tempStaleStateFromDb); + OIC_LOG_V(DEBUG, TAG, "Stale state is %d", tempStaleStateFromDb); if (PDM_STALE_STATE == tempStaleStateFromDb) { - OC_LOG(INFO, TAG, "Device is stale"); + OIC_LOG(INFO, TAG, "Device is stale"); retValue = true; } } @@ -273,11 +273,11 @@ static OCStackResult getIdForUUID(const OicUuid_t *UUID , int *id) res = sqlite3_bind_blob(stmt, PDM_BIND_INDEX_FIRST, UUID, UUID_LENGTH, SQLITE_STATIC); PDM_VERIFY_SQLITE_OK(TAG, res, ERROR, OC_STACK_ERROR); - OC_LOG(DEBUG, TAG, "Binding Done"); + OIC_LOG(DEBUG, TAG, "Binding Done"); while (SQLITE_ROW == sqlite3_step(stmt)) { int tempId = sqlite3_column_int(stmt, PDM_FIRST_INDEX); - OC_LOG_V(DEBUG, TAG, "ID is %d", tempId); + OIC_LOG_V(DEBUG, TAG, "ID is %d", tempId); *id = tempId; sqlite3_finalize(stmt); return OC_STACK_OK; @@ -295,7 +295,7 @@ OCStackResult PDMIsDuplicateDevice(const OicUuid_t* UUID, bool *result) CHECK_PDM_INIT(TAG); if (NULL == UUID || NULL == result) { - OC_LOG(ERROR, TAG, "UUID or result is NULL"); + OIC_LOG(ERROR, TAG, "UUID or result is NULL"); return OC_STACK_INVALID_PARAM; } sqlite3_stmt *stmt = 0; @@ -306,11 +306,11 @@ OCStackResult PDMIsDuplicateDevice(const OicUuid_t* UUID, bool *result) res = sqlite3_bind_blob(stmt, PDM_BIND_INDEX_FIRST, UUID, UUID_LENGTH, SQLITE_STATIC); PDM_VERIFY_SQLITE_OK(TAG, res, ERROR, OC_STACK_ERROR); - OC_LOG(DEBUG, TAG, "Binding Done"); + OIC_LOG(DEBUG, TAG, "Binding Done"); bool retValue = false; while(SQLITE_ROW == sqlite3_step(stmt)) { - OC_LOG(INFO, TAG, "Duplicated UUID"); + OIC_LOG(INFO, TAG, "Duplicated UUID"); retValue = true; } @@ -341,7 +341,7 @@ static OCStackResult addlink(int id1, int id2) if (sqlite3_step(stmt) != SQLITE_DONE) { - OC_LOG_V(ERROR, TAG, "Error Occured: %s",sqlite3_errmsg(g_db)); + OIC_LOG_V(ERROR, TAG, "Error Occured: %s",sqlite3_errmsg(g_db)); sqlite3_finalize(stmt); return OC_STACK_ERROR; } @@ -354,43 +354,43 @@ OCStackResult PDMLinkDevices(const OicUuid_t *UUID1, const OicUuid_t *UUID2) CHECK_PDM_INIT(TAG); if (NULL == UUID1 || NULL == UUID2) { - OC_LOG(ERROR, TAG, "Invalid PARAM"); + OIC_LOG(ERROR, TAG, "Invalid PARAM"); return OC_STACK_INVALID_PARAM; } bool result = false; if (OC_STACK_OK != isDeviceStale(UUID1, &result)) { - OC_LOG(ERROR, TAG, "Internal error occured"); + OIC_LOG(ERROR, TAG, "Internal error occured"); return OC_STACK_ERROR; } if (result) { - OC_LOG(ERROR, TAG, "UUID1:Stale device"); + OIC_LOG(ERROR, TAG, "UUID1:Stale device"); return OC_STACK_INVALID_PARAM; } result = false; if (OC_STACK_OK != isDeviceStale(UUID2, &result)) { - OC_LOG(ERROR, TAG, "Internal error occured"); + OIC_LOG(ERROR, TAG, "Internal error occured"); return OC_STACK_ERROR; } if (result) { - OC_LOG(ERROR, TAG, "UUID2:Stale device"); + OIC_LOG(ERROR, TAG, "UUID2:Stale device"); return OC_STACK_INVALID_PARAM; } int id1 = 0; if (OC_STACK_OK != getIdForUUID(UUID1, &id1)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } int id2 = 0; if (OC_STACK_OK != getIdForUUID(UUID2, &id2)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } @@ -416,7 +416,7 @@ static OCStackResult removeLink(int id1, int id2) if (SQLITE_DONE != sqlite3_step(stmt)) { - OC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); + OIC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); sqlite3_finalize(stmt); return OC_STACK_ERROR; } @@ -429,21 +429,21 @@ OCStackResult PDMUnlinkDevices(const OicUuid_t *UUID1, const OicUuid_t *UUID2) CHECK_PDM_INIT(TAG); if (NULL == UUID1 || NULL == UUID2) { - OC_LOG(ERROR, TAG, "Invalid PARAM"); + OIC_LOG(ERROR, TAG, "Invalid PARAM"); return OC_STACK_INVALID_PARAM; } int id1 = 0; if (OC_STACK_OK != getIdForUUID(UUID1, &id1)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } int id2 = 0; if (OC_STACK_OK != getIdForUUID(UUID2, &id2)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } ASCENDING_ORDER(id1, id2); @@ -463,7 +463,7 @@ static OCStackResult removeFromDeviceList(int id) if (sqlite3_step(stmt) != SQLITE_DONE) { - OC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); + OIC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); sqlite3_finalize(stmt); return OC_STACK_ERROR; } @@ -481,14 +481,14 @@ OCStackResult PDMDeleteDevice(const OicUuid_t *UUID) int id = 0; if (OC_STACK_OK != getIdForUUID(UUID, &id)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } begin(); if(OC_STACK_OK != removeFromDeviceList(id)) { rollback(); - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_ERROR; } commit(); @@ -515,7 +515,7 @@ static OCStackResult updateLinkState(int id1, int id2, int state) if (SQLITE_DONE != sqlite3_step(stmt)) { - OC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); + OIC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); sqlite3_finalize(stmt); return OC_STACK_ERROR; } @@ -528,21 +528,21 @@ OCStackResult PDMSetLinkStale(const OicUuid_t* uuidOfDevice1, const OicUuid_t* u CHECK_PDM_INIT(TAG); if (NULL == uuidOfDevice1 || NULL == uuidOfDevice2) { - OC_LOG(ERROR, TAG, "Invalid PARAM"); + OIC_LOG(ERROR, TAG, "Invalid PARAM"); return OC_STACK_INVALID_PARAM; } int id1 = 0; if (OC_STACK_OK != getIdForUUID(uuidOfDevice1, &id1)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } int id2 = 0; if (OC_STACK_OK != getIdForUUID(uuidOfDevice2, &id2)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } ASCENDING_ORDER(id1, id2); @@ -555,7 +555,7 @@ OCStackResult PDMGetOwnedDevices(OCUuidList_t **uuidList, size_t *numOfDevices) CHECK_PDM_INIT(TAG); if (NULL != *uuidList) { - OC_LOG(ERROR, TAG, "Not null list will cause memory leak"); + OIC_LOG(ERROR, TAG, "Not null list will cause memory leak"); return OC_STACK_INVALID_PARAM; } sqlite3_stmt *stmt = 0; @@ -572,7 +572,7 @@ OCStackResult PDMGetOwnedDevices(OCUuidList_t **uuidList, size_t *numOfDevices) OCUuidList_t *temp = (OCUuidList_t *) OICCalloc(1,sizeof(OCUuidList_t)); if (NULL == temp) { - OC_LOG_V(ERROR, TAG, "Memory allocation problem"); + OIC_LOG_V(ERROR, TAG, "Memory allocation problem"); sqlite3_finalize(stmt); return OC_STACK_NO_MEMORY; } @@ -628,7 +628,7 @@ OCStackResult PDMGetLinkedDevices(const OicUuid_t *UUID, OCUuidList_t **UUIDLIST CHECK_PDM_INIT(TAG); if (NULL != *UUIDLIST) { - OC_LOG(ERROR, TAG, "Not null list will cause memory leak"); + OIC_LOG(ERROR, TAG, "Not null list will cause memory leak"); return OC_STACK_INVALID_PARAM; } if (NULL == UUID) @@ -639,18 +639,18 @@ OCStackResult PDMGetLinkedDevices(const OicUuid_t *UUID, OCUuidList_t **UUIDLIST OCStackResult ret = isDeviceStale(UUID, &result); if (OC_STACK_OK != ret) { - OC_LOG(ERROR, TAG, "Internal error occured"); + OIC_LOG(ERROR, TAG, "Internal error occured"); return OC_STACK_ERROR; } if (result) { - OC_LOG(ERROR, TAG, "Device is stale"); + OIC_LOG(ERROR, TAG, "Device is stale"); return OC_STACK_INVALID_PARAM; } int id = 0; if (OC_STACK_OK != getIdForUUID(UUID, &id)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } @@ -686,7 +686,7 @@ OCStackResult PDMGetLinkedDevices(const OicUuid_t *UUID, OCUuidList_t **UUIDLIST OCUuidList_t *tempNode = (OCUuidList_t *) OICCalloc(1,sizeof(OCUuidList_t)); if (NULL == tempNode) { - OC_LOG(ERROR, TAG, "No Memory"); + OIC_LOG(ERROR, TAG, "No Memory"); sqlite3_finalize(stmt); return OC_STACK_NO_MEMORY; } @@ -704,7 +704,7 @@ OCStackResult PDMGetToBeUnlinkedDevices(OCPairList_t **staleDevList, size_t *num CHECK_PDM_INIT(TAG); if (NULL != *staleDevList) { - OC_LOG(ERROR, TAG, "Not null list will cause memory leak"); + OIC_LOG(ERROR, TAG, "Not null list will cause memory leak"); return OC_STACK_INVALID_PARAM; } @@ -730,7 +730,7 @@ OCStackResult PDMGetToBeUnlinkedDevices(OCPairList_t **staleDevList, size_t *num OCPairList_t *tempNode = (OCPairList_t *) OICCalloc(1, sizeof(OCPairList_t)); if (NULL == tempNode) { - OC_LOG(ERROR, TAG, "No Memory"); + OIC_LOG(ERROR, TAG, "No Memory"); sqlite3_finalize(stmt); return OC_STACK_NO_MEMORY; } @@ -791,37 +791,37 @@ OCStackResult PDMIsLinkExists(const OicUuid_t* uuidOfDevice1, const OicUuid_t* u int id2 = 0; if (OC_STACK_OK != getIdForUUID(uuidOfDevice1, &id1)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } if (OC_STACK_OK != getIdForUUID(uuidOfDevice2, &id2)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } bool isStale = false; if (OC_STACK_OK != isDeviceStale(uuidOfDevice1, &isStale)) { - OC_LOG(ERROR, TAG, "uuidOfDevice1:Internal error occured"); + OIC_LOG(ERROR, TAG, "uuidOfDevice1:Internal error occured"); return OC_STACK_ERROR; } if (isStale) { - OC_LOG(ERROR, TAG, "uuidOfDevice1:Device is stale"); + OIC_LOG(ERROR, TAG, "uuidOfDevice1:Device is stale"); return OC_STACK_INVALID_PARAM; } isStale = false; if (OC_STACK_OK != isDeviceStale(uuidOfDevice2, &isStale)) { - OC_LOG(ERROR, TAG, "uuidOfDevice2:Internal error occured"); + OIC_LOG(ERROR, TAG, "uuidOfDevice2:Internal error occured"); return OC_STACK_ERROR; } if (isStale) { - OC_LOG(ERROR, TAG, "uuidOfDevice2:Device is stale"); + OIC_LOG(ERROR, TAG, "uuidOfDevice2:Device is stale"); return OC_STACK_INVALID_PARAM; } @@ -842,7 +842,7 @@ OCStackResult PDMIsLinkExists(const OicUuid_t* uuidOfDevice1, const OicUuid_t* u bool ret = false; while(SQLITE_ROW == sqlite3_step(stmt)) { - OC_LOG(INFO, TAG, "Link already exists between devices"); + OIC_LOG(INFO, TAG, "Link already exists between devices"); ret = true; } sqlite3_finalize(stmt); @@ -866,7 +866,7 @@ static OCStackResult updateDeviceState(const OicUuid_t *uuid, int state) if (SQLITE_DONE != sqlite3_step(stmt)) { - OC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); + OIC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); sqlite3_finalize(stmt); return OC_STACK_ERROR; } @@ -882,7 +882,7 @@ static OCStackResult updateLinkForStaleDevice(const OicUuid_t *devUuid) int id = 0; if (OC_STACK_OK != getIdForUUID(devUuid, &id)) { - OC_LOG(ERROR, TAG, "Requested value not found"); + OIC_LOG(ERROR, TAG, "Requested value not found"); return OC_STACK_INVALID_PARAM; } @@ -899,7 +899,7 @@ static OCStackResult updateLinkForStaleDevice(const OicUuid_t *devUuid) if (SQLITE_DONE != sqlite3_step(stmt)) { - OC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); + OIC_LOG_V(ERROR, TAG, "Error message: %s", sqlite3_errmsg(g_db)); sqlite3_finalize(stmt); return OC_STACK_ERROR; } @@ -912,7 +912,7 @@ OCStackResult PDMSetDeviceStale(const OicUuid_t* uuidOfDevice) CHECK_PDM_INIT(TAG); if (NULL == uuidOfDevice) { - OC_LOG(ERROR, TAG, "Invalid PARAM"); + OIC_LOG(ERROR, TAG, "Invalid PARAM"); return OC_STACK_INVALID_PARAM; } begin(); @@ -920,14 +920,14 @@ OCStackResult PDMSetDeviceStale(const OicUuid_t* uuidOfDevice) if (OC_STACK_OK != res) { rollback(); - OC_LOG(ERROR, TAG, "unable to update links"); + OIC_LOG(ERROR, TAG, "unable to update links"); return res; } res = updateDeviceState(uuidOfDevice, PDM_STALE_STATE); if (OC_STACK_OK != res) { rollback(); - OC_LOG(ERROR, TAG, "unable to update device state"); + OIC_LOG(ERROR, TAG, "unable to update device state"); return res; } commit(); diff --git a/resource/csdk/security/provisioning/src/secureresourceprovider.c b/resource/csdk/security/provisioning/src/secureresourceprovider.c index e7c12fb..fbf90c2 100644 --- a/resource/csdk/security/provisioning/src/secureresourceprovider.c +++ b/resource/csdk/security/provisioning/src/secureresourceprovider.c @@ -51,14 +51,14 @@ * eg: VERIFY_NON_NULL(TAG, ptrData, ERROR,OC_STACK_ERROR); */ #define VERIFY_NON_NULL(tag, arg, logLevel, retValue) { if (NULL == (arg)) \ - { OC_LOG((logLevel), tag, #arg " is NULL"); return retValue; } } + { OIC_LOG((logLevel), tag, #arg " is NULL"); return retValue; } } /** * Macro to verify success of operation. * eg: VERIFY_SUCCESS(TAG, OC_STACK_OK == foo(), ERROR, OC_STACK_ERROR); */ #define VERIFY_SUCCESS(tag, op, logLevel, retValue) { if (!(op)) \ - {OC_LOG((logLevel), tag, #op " failed!!"); return retValue;} } + {OIC_LOG((logLevel), tag, #op " failed!!"); return retValue;} } /** * Structure to carry credential data to callback. @@ -137,7 +137,7 @@ static void registerResultForCredProvisioning(CredentialData_t *credData, OCStackResult stackresult, int cause) { - OC_LOG_V(INFO,TAG,"value of credData->numOfResults is %d",credData->numOfResults); + OIC_LOG_V(INFO,TAG,"value of credData->numOfResults is %d",credData->numOfResults); if(1 == cause) { memcpy(credData->resArr[(credData->numOfResults)].deviceId.id, @@ -169,7 +169,7 @@ static OCStackApplicationResult provisionCredentialCB2(void *ctx, OCDoHandle UNU (void)UNUSED; OCProvisionResultCB resultCallback = credData->resultCallback; - OC_LOG(INFO, TAG, "provisionCredentialCB2 called"); + OIC_LOG(INFO, TAG, "provisionCredentialCB2 called"); if (clientResponse) { if(OC_STACK_RESOURCE_CREATED == clientResponse->result) @@ -179,10 +179,10 @@ static OCStackApplicationResult provisionCredentialCB2(void *ctx, OCDoHandle UNU &credData->deviceInfo2->doxm->deviceID); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Error occured on PDMLinkDevices"); + OIC_LOG(ERROR, TAG, "Error occured on PDMLinkDevices"); return OC_STACK_DELETE_TRANSACTION; } - OC_LOG(INFO, TAG, "Link created successfully"); + OIC_LOG(INFO, TAG, "Link created successfully"); ((OCProvisionResultCB)(resultCallback))(credData->ctx, credData->numOfResults, credData->resArr, @@ -193,7 +193,7 @@ static OCStackApplicationResult provisionCredentialCB2(void *ctx, OCDoHandle UNU } } - OC_LOG(INFO, TAG, "provisionCredentialCB2 received Null clientResponse"); + OIC_LOG(INFO, TAG, "provisionCredentialCB2 received Null clientResponse"); registerResultForCredProvisioning(credData, OC_STACK_ERROR, 2); ((OCProvisionResultCB)(resultCallback))(credData->ctx, credData->numOfResults, credData->resArr, @@ -255,7 +255,7 @@ static OCStackApplicationResult provisionCredentialCB1(void *ctx, OCDoHandle UNU } else { - OC_LOG(INFO, TAG, "provisionCredentialCB received Null clientResponse for first device"); + OIC_LOG(INFO, TAG, "provisionCredentialCB received Null clientResponse for first device"); registerResultForCredProvisioning(credData, OC_STACK_ERROR,1); ((OCProvisionResultCB)(resultCallback))(credData->ctx, credData->numOfResults, credData->resArr, @@ -285,7 +285,7 @@ static OCStackResult provisionCredentials(const OicSecCred_t *cred, OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if(!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } secPayload->base.type = PAYLOAD_TYPE_SECURITY; @@ -293,11 +293,11 @@ static OCStackResult provisionCredentials(const OicSecCred_t *cred, if(NULL == secPayload->securityData) { OICFree(secPayload); - OC_LOG(ERROR, TAG, "Failed to BinToCredJSON"); + OIC_LOG(ERROR, TAG, "Failed to BinToCredJSON"); return OC_STACK_NO_MEMORY; } - OC_LOG_V(INFO, TAG, "Credential for provisioning : %s",secPayload->securityData); + OIC_LOG_V(INFO, TAG, "Credential for provisioning : %s",secPayload->securityData); char query[MAX_URI_LENGTH + MAX_QUERY_LENGTH] = {0}; if(!PMGenerateQuery(true, deviceInfo->endpoint.addr, @@ -305,10 +305,10 @@ static OCStackResult provisionCredentials(const OicSecCred_t *cred, deviceInfo->connType, query, sizeof(query), OIC_RSRC_CRED_URI)) { - OC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); + OIC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); OCCallbackData cbData = {.context=NULL, .cb=NULL, .cd=NULL}; cbData.cb = responseHandler; @@ -319,10 +319,10 @@ static OCStackResult provisionCredentials(const OicSecCred_t *cred, OCMethod method = OC_REST_POST; OCStackResult ret = OCDoResource(&handle, method, query, 0, (OCPayload*)secPayload, deviceInfo->connType, OC_HIGH_QOS, &cbData, NULL, 0); - OC_LOG_V(INFO, TAG, "OCDoResource::Credential provisioning returned : %d",ret); + OIC_LOG_V(INFO, TAG, "OCDoResource::Credential provisioning returned : %d",ret); if (ret != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); return ret; } return OC_STACK_OK; @@ -363,7 +363,7 @@ static void registerResultForCertProvisioning(CertData_t *certData, OCStackResult stackresult) { - OC_LOG_V(INFO,TAG,"value of credData->numOfResults is %d",certData->numOfResults); + OIC_LOG_V(INFO,TAG,"value of credData->numOfResults is %d",certData->numOfResults); memcpy(certData->resArr[(certData->numOfResults)].deviceId.id, certData->deviceInfo->doxm->deviceID.id,UUID_LENGTH); certData->resArr[(certData->numOfResults)].res = stackresult; @@ -376,7 +376,7 @@ static void registerResultForCertProvisioning(CertData_t *certData, static void registerResultForCRLProvisioning(CRLData_t *crlData, OCStackResult stackresult) { - OC_LOG_V(INFO, TAG, "Inside registerResultForCRLProvisioning crlData->numOfResults is %d\n", + OIC_LOG_V(INFO, TAG, "Inside registerResultForCRLProvisioning crlData->numOfResults is %d\n", crlData->numOfResults); memcpy(crlData->resArr[(crlData->numOfResults)].deviceId.id, crlData->deviceInfo->doxm->deviceID.id, UUID_LENGTH); @@ -397,7 +397,7 @@ static void registerResultForCRLProvisioning(CRLData_t *crlData, static OCStackApplicationResult SRPProvisionCRLCB(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OC_LOG_V(INFO, TAG, "Inside SRPProvisionCRLCB."); + OIC_LOG_V(INFO, TAG, "Inside SRPProvisionCRLCB."); (void)UNUSED; VERIFY_NON_NULL(TAG, ctx, ERROR, OC_STACK_DELETE_TRANSACTION); CRLData_t *crlData = (CRLData_t*)ctx; @@ -420,7 +420,7 @@ static OCStackApplicationResult SRPProvisionCRLCB(void *ctx, OCDoHandle UNUSED, ((OCProvisionResultCB)(resultCallback))(crlData->ctx, crlData->numOfResults, crlData->resArr, true); - OC_LOG_V(ERROR, TAG, "SRPProvisionCRLCB received Null clientResponse"); + OIC_LOG_V(ERROR, TAG, "SRPProvisionCRLCB received Null clientResponse"); OICFree(crlData->resArr); OICFree(crlData); return OC_STACK_DELETE_TRANSACTION; @@ -436,7 +436,7 @@ OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceI OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if (!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } @@ -445,10 +445,10 @@ OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceI if (NULL == secPayload->securityData) { OICFree(secPayload); - OC_LOG(ERROR, TAG, "Failed to BinToCrlJSON"); + OIC_LOG(ERROR, TAG, "Failed to BinToCrlJSON"); return OC_STACK_NO_MEMORY; } - OC_LOG_V(INFO, TAG, "CRL : %s", secPayload->securityData); + OIC_LOG_V(INFO, TAG, "CRL : %s", secPayload->securityData); char query[MAX_URI_LENGTH + MAX_QUERY_LENGTH] = {0}; if(!PMGenerateQuery(true, @@ -457,12 +457,12 @@ OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceI selectedDeviceInfo->connType, query, sizeof(query), OIC_RSRC_CRL_URI)) { - OC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); + OIC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); OICFree(secPayload->securityData); OICFree(secPayload); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); OCCallbackData cbData = {.context=NULL, .cb=NULL, .cd=NULL}; cbData.cb = &SRPProvisionCRLCB; @@ -471,7 +471,7 @@ OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceI { OICFree(secPayload->securityData); OICFree(secPayload); - OC_LOG(ERROR, TAG, "Unable to allocate memory"); + OIC_LOG(ERROR, TAG, "Unable to allocate memory"); return OC_STACK_NO_MEMORY; } @@ -485,7 +485,7 @@ OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceI { OICFree(secPayload->securityData); OICFree(secPayload); - OC_LOG(ERROR, TAG, "Unable to allocate memory"); + OIC_LOG(ERROR, TAG, "Unable to allocate memory"); return OC_STACK_NO_MEMORY; } @@ -493,7 +493,7 @@ OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceI cbData.cd = NULL; OCMethod method = OC_REST_POST; OCDoHandle handle = NULL; - OC_LOG(DEBUG, TAG, "Sending CRL info to resource server"); + OIC_LOG(DEBUG, TAG, "Sending CRL info to resource server"); OCStackResult ret = OCDoResource(&handle, method, query, &selectedDeviceInfo->endpoint, (OCPayload*)secPayload, @@ -523,7 +523,7 @@ static OCStackResult provisionCertCred(const OicSecCred_t *cred, OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if(!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } secPayload->base.type = PAYLOAD_TYPE_SECURITY; @@ -532,11 +532,11 @@ static OCStackResult provisionCertCred(const OicSecCred_t *cred, if (NULL == secPayload->securityData) { OICFree(secPayload); - OC_LOG(ERROR, TAG, "Failed to BinToCredJSON"); + OIC_LOG(ERROR, TAG, "Failed to BinToCredJSON"); return OC_STACK_NO_MEMORY; } - OC_LOG_V(INFO, TAG, "Credential for provisioning : %s",secPayload->securityData); + OIC_LOG_V(INFO, TAG, "Credential for provisioning : %s",secPayload->securityData); char query[MAX_URI_LENGTH + MAX_QUERY_LENGTH] = {0}; if(!PMGenerateQuery(true, deviceInfo->endpoint.addr, @@ -544,12 +544,12 @@ static OCStackResult provisionCertCred(const OicSecCred_t *cred, deviceInfo->connType, query, sizeof(query), OIC_RSRC_CRED_URI)) { - OC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); + OIC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); OICFree(secPayload->securityData); OICFree(secPayload); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); OCCallbackData cbData = {.context=NULL, .cb=NULL, .cd=NULL}; cbData.cb = responseHandler; @@ -560,10 +560,10 @@ static OCStackResult provisionCertCred(const OicSecCred_t *cred, OCMethod method = OC_REST_POST; OCStackResult ret = OCDoResource(&handle, method, query, 0, (OCPayload*)secPayload, deviceInfo->connType, OC_HIGH_QOS, &cbData, NULL, 0); - OC_LOG_V(INFO, TAG, "OCDoResource::Certificate provisioning returned : %d",ret); + OIC_LOG_V(INFO, TAG, "OCDoResource::Certificate provisioning returned : %d",ret); if (ret != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack resource error"); + OIC_LOG(ERROR, TAG, "OCStack resource error"); } return ret; @@ -586,7 +586,7 @@ static OCStackApplicationResult provisionCertCB(void *ctx, OCDoHandle UNUSED, (void)UNUSED; OCProvisionResultCB resultCallback = certData->resultCallback; - OC_LOG(INFO, TAG, "provisionCertCred called"); + OIC_LOG(INFO, TAG, "provisionCertCred called"); if (clientResponse) { if(OC_STACK_RESOURCE_CREATED == clientResponse->result) @@ -601,7 +601,7 @@ static OCStackApplicationResult provisionCertCB(void *ctx, OCDoHandle UNUSED, } } - OC_LOG(INFO, TAG, "provisionCertCredCB received Null clientResponse"); + OIC_LOG(INFO, TAG, "provisionCertCredCB received Null clientResponse"); registerResultForCertProvisioning(certData, OC_STACK_ERROR); ((OCProvisionResultCB)(resultCallback))(certData->ctx, certData->numOfResults, certData->resArr, @@ -627,11 +627,11 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k if (SYMMETRIC_PAIR_WISE_KEY == type && !(OWNER_PSK_LENGTH_128 == keySize || OWNER_PSK_LENGTH_256 == keySize)) { - OC_LOG(INFO, TAG, "Invalid key size"); + OIC_LOG(INFO, TAG, "Invalid key size"); return OC_STACK_INVALID_PARAM; } - OC_LOG(INFO, TAG, "In SRPProvisionCredentials"); + OIC_LOG(INFO, TAG, "In SRPProvisionCredentials"); if (SYMMETRIC_PAIR_WISE_KEY == type) { @@ -640,12 +640,12 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k if (res != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Internal error occured"); + OIC_LOG(ERROR, TAG, "Internal error occured"); return res; } if (linkExisits) { - OC_LOG(ERROR, TAG, "Link already exists"); + OIC_LOG(ERROR, TAG, "Link already exists"); return OC_STACK_INVALID_PARAM; } } @@ -653,10 +653,10 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k OicUuid_t provTooldeviceID = {{0,}}; if (OC_STACK_OK != GetDoxmDeviceID(&provTooldeviceID)) { - OC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); + OIC_LOG(ERROR, TAG, "Error while retrieving provisioning tool's device ID"); return OC_STACK_ERROR; } - OC_LOG(INFO, TAG, "retrieved deviceid"); + OIC_LOG(INFO, TAG, "retrieved deviceid"); switch (type) { case SYMMETRIC_PAIR_WISE_KEY: @@ -670,14 +670,14 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k &firstDevice->doxm->deviceID, &secondDevice->doxm->deviceID, &firstCred, &secondCred); VERIFY_SUCCESS(TAG, (res==OC_STACK_OK), ERROR, OC_STACK_ERROR); - OC_LOG(INFO, TAG, "Credentials generated successfully"); + OIC_LOG(INFO, TAG, "Credentials generated successfully"); CredentialData_t *credData = (CredentialData_t *) OICCalloc(1, sizeof(CredentialData_t)); if (NULL == credData) { OICFree(firstCred); OICFree(secondCred); - OC_LOG(ERROR, TAG, "Memory allocation problem"); + OIC_LOG(ERROR, TAG, "Memory allocation problem"); return OC_STACK_NO_MEMORY; } credData->deviceInfo1 = firstDevice; @@ -697,7 +697,7 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k OICFree(firstCred); OICFree(secondCred); OICFree(credData); - OC_LOG(ERROR, TAG, "Memory allocation problem"); + OIC_LOG(ERROR, TAG, "Memory allocation problem"); return OC_STACK_NO_MEMORY; } res = provisionCredentials(firstCred, firstDevice, credData, &provisionCredentialCB1); @@ -708,7 +708,7 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k OICFree(credData->resArr); OICFree(credData); } - OC_LOG_V(INFO, TAG, "provisionCredentials returned: %d",res); + OIC_LOG_V(INFO, TAG, "provisionCredentials returned: %d",res); VERIFY_SUCCESS(TAG, (res==OC_STACK_OK), ERROR, OC_STACK_ERROR); return res; } @@ -720,12 +720,12 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k OCStackResult res = PMGenerateCertificateCredentials(&provTooldeviceID, &firstDevice->doxm->deviceID,&cred); VERIFY_SUCCESS(TAG, (res==OC_STACK_OK), ERROR, OC_STACK_ERROR); - OC_LOG(INFO, TAG, "Certificate credentials generated successfully"); + OIC_LOG(INFO, TAG, "Certificate credentials generated successfully"); CertData_t *certData = (CertData_t *) OICCalloc(1, sizeof(CertData_t)); if (NULL == certData) { OICFree(cred); - OC_LOG(ERROR, TAG, "Memory allocation problem"); + OIC_LOG(ERROR, TAG, "Memory allocation problem"); return OC_STACK_NO_MEMORY; } @@ -740,7 +740,7 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k { DeleteCredList(cred); OICFree(certData); - OC_LOG(ERROR, TAG, "Memory allocation problem"); + OIC_LOG(ERROR, TAG, "Memory allocation problem"); return OC_STACK_NO_MEMORY; } @@ -751,14 +751,14 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k OICFree(certData); } DeleteCredList(cred); - OC_LOG_V(INFO, TAG, "provisionCertCredentials returned: %d",res); + OIC_LOG_V(INFO, TAG, "provisionCertCredentials returned: %d",res); return res; } #endif default: { - OC_LOG(ERROR, TAG, "Invalid option."); + OIC_LOG(ERROR, TAG, "Invalid option."); return OC_STACK_INVALID_PARAM; } } @@ -771,7 +771,7 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k static void registerResultForACLProvisioning(ACLData_t *aclData, OCStackResult stackresult) { - OC_LOG_V(INFO, TAG, "Inside registerResultForACLProvisioning aclData->numOfResults is %d\n", + OIC_LOG_V(INFO, TAG, "Inside registerResultForACLProvisioning aclData->numOfResults is %d\n", aclData->numOfResults); memcpy(aclData->resArr[(aclData->numOfResults)].deviceId.id, aclData->deviceInfo->doxm->deviceID.id, UUID_LENGTH); @@ -791,7 +791,7 @@ static void registerResultForACLProvisioning(ACLData_t *aclData, static OCStackApplicationResult SRPProvisionACLCB(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OC_LOG_V(INFO, TAG, "Inside SRPProvisionACLCB."); + OIC_LOG_V(INFO, TAG, "Inside SRPProvisionACLCB."); (void)UNUSED; VERIFY_NON_NULL(TAG, ctx, ERROR, OC_STACK_DELETE_TRANSACTION); ACLData_t *aclData = (ACLData_t*)ctx; @@ -814,7 +814,7 @@ static OCStackApplicationResult SRPProvisionACLCB(void *ctx, OCDoHandle UNUSED, ((OCProvisionResultCB)(resultCallback))(aclData->ctx, aclData->numOfResults, aclData->resArr, true); - OC_LOG_V(ERROR, TAG, "SRPProvisionACLCB received Null clientResponse"); + OIC_LOG_V(ERROR, TAG, "SRPProvisionACLCB received Null clientResponse"); OICFree(aclData->resArr); OICFree(aclData); return OC_STACK_DELETE_TRANSACTION; @@ -830,7 +830,7 @@ OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceI OCSecurityPayload* secPayload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); if(!secPayload) { - OC_LOG(ERROR, TAG, "Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "Failed to memory allocation"); return OC_STACK_NO_MEMORY; } secPayload->base.type = PAYLOAD_TYPE_SECURITY; @@ -838,10 +838,10 @@ OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceI if(NULL == secPayload->securityData) { OICFree(secPayload); - OC_LOG(ERROR, TAG, "Failed to BinToAclJSON"); + OIC_LOG(ERROR, TAG, "Failed to BinToAclJSON"); return OC_STACK_NO_MEMORY; } - OC_LOG_V(INFO, TAG, "ACL : %s", secPayload->securityData); + OIC_LOG_V(INFO, TAG, "ACL : %s", secPayload->securityData); char query[MAX_URI_LENGTH + MAX_QUERY_LENGTH] = {0}; if(!PMGenerateQuery(true, @@ -850,10 +850,10 @@ OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceI selectedDeviceInfo->connType, query, sizeof(query), OIC_RSRC_ACL_URI)) { - OC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); + OIC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); return OC_STACK_ERROR; } - OC_LOG_V(DEBUG, TAG, "Query=%s", query); + OIC_LOG_V(DEBUG, TAG, "Query=%s", query); OCCallbackData cbData = {.context=NULL, .cb=NULL, .cd=NULL}; cbData.cb = &SRPProvisionACLCB; @@ -862,7 +862,7 @@ OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceI { OICFree(secPayload->securityData); OICFree(secPayload); - OC_LOG(ERROR, TAG, "Unable to allocate memory"); + OIC_LOG(ERROR, TAG, "Unable to allocate memory"); return OC_STACK_NO_MEMORY; } aclData->deviceInfo = selectedDeviceInfo; @@ -877,14 +877,14 @@ OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceI OICFree(aclData); OICFree(secPayload->securityData); OICFree(secPayload); - OC_LOG(ERROR, TAG, "Unable to allocate memory"); + OIC_LOG(ERROR, TAG, "Unable to allocate memory"); return OC_STACK_NO_MEMORY; } cbData.context = (void *)aclData; cbData.cd = NULL; OCMethod method = OC_REST_POST; OCDoHandle handle = NULL; - OC_LOG(DEBUG, TAG, "Sending ACL info to resource server"); + OIC_LOG(DEBUG, TAG, "Sending ACL info to resource server"); OCStackResult ret = OCDoResource(&handle, method, query, &selectedDeviceInfo->endpoint, (OCPayload*)secPayload, selectedDeviceInfo->connType, OC_HIGH_QOS, &cbData, NULL, 0); @@ -912,9 +912,9 @@ static void registerResultForUnlinkDevices(UnlinkData_t *unlinkData, OCStackResu { if (NULL != unlinkData) { - OC_LOG_V(INFO, TAG, "Inside registerResultForUnlinkDevices unlinkData->numOfResults is %d\n", + OIC_LOG_V(INFO, TAG, "Inside registerResultForUnlinkDevices unlinkData->numOfResults is %d\n", unlinkData->numOfResults); - OC_LOG_V(INFO, TAG, "Stack result :: %d", stackresult); + OIC_LOG_V(INFO, TAG, "Stack result :: %d", stackresult); OicUuid_t *pUuid = &unlinkData->unlinkRes[(unlinkData->numOfResults)].deviceId; @@ -929,7 +929,7 @@ static void registerResultForUnlinkDevices(UnlinkData_t *unlinkData, OCStackResu } unlinkData->unlinkRes[(unlinkData->numOfResults)].res = stackresult; ++(unlinkData->numOfResults); - OC_LOG (INFO, TAG, "Out registerResultForUnlinkDevices"); + OIC_LOG (INFO, TAG, "Out registerResultForUnlinkDevices"); } } @@ -938,7 +938,7 @@ static OCStackResult SendDeleteCredentialRequest(void* ctx, const OCProvisionDev_t* revokedDev, const OCProvisionDev_t* destDev) { - OC_LOG(DEBUG, TAG, "IN SendDeleteCredentialRequest"); + OIC_LOG(DEBUG, TAG, "IN SendDeleteCredentialRequest"); if (NULL == ctx || NULL == respHandler || NULL == revokedDev || NULL == destDev) { @@ -950,7 +950,7 @@ static OCStackResult SendDeleteCredentialRequest(void* ctx, if (B64_OK != b64Encode(revokedDev->doxm->deviceID.id, sizeof(revokedDev->doxm->deviceID.id), base64Buff, sizeof(base64Buff), &base64Len)) { - OC_LOG(ERROR, TAG, "SendDeleteCredentialRequest : Failed to base64 encoding"); + OIC_LOG(ERROR, TAG, "SendDeleteCredentialRequest : Failed to base64 encoding"); return OC_STACK_ERROR; } @@ -961,12 +961,12 @@ static OCStackResult SendDeleteCredentialRequest(void* ctx, destDev->securePort, OIC_RSRC_CRED_URI, OIC_JSON_SUBJECT_NAME, base64Buff); if (snRet < 0) { - OC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Error (snprintf) %d\n", snRet); + OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Error (snprintf) %d\n", snRet); return OC_STACK_ERROR; } else if ((size_t)snRet >= sizeof(reqBuf)) { - OC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Truncated (snprintf) %d\n", snRet); + OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Truncated (snprintf) %d\n", snRet); return OC_STACK_ERROR; } @@ -975,18 +975,18 @@ static OCStackResult SendDeleteCredentialRequest(void* ctx, cbData.context = ctx; cbData.cb = respHandler; cbData.cd = NULL; - OC_LOG_V(INFO, TAG, "URI: %s",reqBuf); + OIC_LOG_V(INFO, TAG, "URI: %s",reqBuf); - OC_LOG(DEBUG, TAG, "Sending remove credential request to resource server"); + OIC_LOG(DEBUG, TAG, "Sending remove credential request to resource server"); OCStackResult ret = OCDoResource(NULL, OC_REST_DELETE, reqBuf, &destDev->endpoint, NULL, CT_ADAPTER_IP, OC_HIGH_QOS, &cbData, NULL, 0); if (OC_STACK_OK != ret) { - OC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Error in OCDoResource %d", ret); + OIC_LOG_V(ERROR, TAG, "SendDeleteCredentialRequest : Error in OCDoResource %d", ret); } - OC_LOG(DEBUG, TAG, "OUT SendDeleteCredentialRequest"); + OIC_LOG(DEBUG, TAG, "OUT SendDeleteCredentialRequest"); return ret; } @@ -1004,22 +1004,22 @@ static OCStackApplicationResult SRPUnlinkDevice2CB(void *unlinkCtx, OCDoHandle h OCClientResponse *clientResponse) { (void) handle; - OC_LOG(DEBUG, TAG, "IN SRPUnlinkDevice2CB"); + OIC_LOG(DEBUG, TAG, "IN SRPUnlinkDevice2CB"); VERIFY_NON_NULL(TAG, unlinkCtx, ERROR, OC_STACK_DELETE_TRANSACTION); UnlinkData_t* unlinkData = (UnlinkData_t*)unlinkCtx; if (clientResponse) { - OC_LOG(DEBUG, TAG, "Valid client response for device 2"); + OIC_LOG(DEBUG, TAG, "Valid client response for device 2"); registerResultForUnlinkDevices(unlinkData, clientResponse->result, IDX_SECOND_DEVICE_RES); if (OC_STACK_RESOURCE_DELETED == clientResponse->result) { - OC_LOG(DEBUG, TAG, "Credential of device2 revoked"); + OIC_LOG(DEBUG, TAG, "Credential of device2 revoked"); } else { - OC_LOG(ERROR, TAG, "Unable to delete credential information from device 2"); + OIC_LOG(ERROR, TAG, "Unable to delete credential information from device 2"); unlinkData->resultCallback(unlinkData->ctx, unlinkData->numOfResults, unlinkData->unlinkRes, true); goto error; @@ -1031,7 +1031,7 @@ static OCStackApplicationResult SRPUnlinkDevice2CB(void *unlinkCtx, OCDoHandle h IDX_SECOND_DEVICE_RES); unlinkData->resultCallback(unlinkData->ctx, unlinkData->numOfResults, unlinkData->unlinkRes, true); - OC_LOG(ERROR, TAG, "SRPUnlinkDevice2CB received Null clientResponse"); + OIC_LOG(ERROR, TAG, "SRPUnlinkDevice2CB received Null clientResponse"); goto error; } @@ -1039,7 +1039,7 @@ static OCStackApplicationResult SRPUnlinkDevice2CB(void *unlinkCtx, OCDoHandle h if (OC_STACK_OK != PDMUnlinkDevices(&unlinkData->unlinkDev[0].doxm->deviceID, &unlinkData->unlinkDev[1].doxm->deviceID)) { - OC_LOG(FATAL, TAG, "All requests are successfully done but update provisioning DB FAILED."); + OIC_LOG(FATAL, TAG, "All requests are successfully done but update provisioning DB FAILED."); registerResultForUnlinkDevices(unlinkData, OC_STACK_INCONSISTENT_DB, IDX_DB_UPDATE_RES); unlinkData->resultCallback(unlinkData->ctx, unlinkData->numOfResults, unlinkData->unlinkRes, true); @@ -1050,7 +1050,7 @@ static OCStackApplicationResult SRPUnlinkDevice2CB(void *unlinkCtx, OCDoHandle h error: DeleteUnlinkData_t(unlinkData); - OC_LOG(DEBUG, TAG, "OUT SRPUnlinkDevice2CB"); + OIC_LOG(DEBUG, TAG, "OUT SRPUnlinkDevice2CB"); return OC_STACK_DELETE_TRANSACTION; } @@ -1067,28 +1067,28 @@ error: static OCStackApplicationResult SRPUnlinkDevice1CB(void *unlinkCtx, OCDoHandle handle, OCClientResponse *clientResponse) { - OC_LOG_V(INFO, TAG, "Inside SRPUnlinkDevice1CB "); + OIC_LOG_V(INFO, TAG, "Inside SRPUnlinkDevice1CB "); VERIFY_NON_NULL(TAG, unlinkCtx, ERROR, OC_STACK_DELETE_TRANSACTION); UnlinkData_t* unlinkData = (UnlinkData_t*)unlinkCtx; (void) handle; if (clientResponse) { - OC_LOG(DEBUG, TAG, "Valid client response for device 1"); + OIC_LOG(DEBUG, TAG, "Valid client response for device 1"); registerResultForUnlinkDevices(unlinkData, clientResponse->result, IDX_FIRST_DEVICE_RES); if (OC_STACK_RESOURCE_DELETED == clientResponse->result) { - OC_LOG(DEBUG, TAG, "Credential of device 1 is revoked"); + OIC_LOG(DEBUG, TAG, "Credential of device 1 is revoked"); // Second revocation request to second device. OCStackResult res = SendDeleteCredentialRequest((void*)unlinkData, &SRPUnlinkDevice2CB, &unlinkData->unlinkDev[0], &unlinkData->unlinkDev[1] /*Dest*/); - OC_LOG_V(DEBUG, TAG, "Credential revocation request device 2, result :: %d",res); + OIC_LOG_V(DEBUG, TAG, "Credential revocation request device 2, result :: %d",res); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "Error while sending revocation request for device 2"); + OIC_LOG(ERROR, TAG, "Error while sending revocation request for device 2"); registerResultForUnlinkDevices(unlinkData, OC_STACK_INVALID_REQUEST_HANDLE, IDX_SECOND_DEVICE_RES); unlinkData->resultCallback(unlinkData->ctx, @@ -1097,13 +1097,13 @@ static OCStackApplicationResult SRPUnlinkDevice1CB(void *unlinkCtx, OCDoHandle h } else { - OC_LOG(DEBUG, TAG, "Request for credential revocation successfully sent"); + OIC_LOG(DEBUG, TAG, "Request for credential revocation successfully sent"); return OC_STACK_DELETE_TRANSACTION; } } else { - OC_LOG(ERROR, TAG, "Unable to delete credential information from device 1"); + OIC_LOG(ERROR, TAG, "Unable to delete credential information from device 1"); unlinkData->resultCallback(unlinkData->ctx, unlinkData->numOfResults, unlinkData->unlinkRes, true); @@ -1112,17 +1112,17 @@ static OCStackApplicationResult SRPUnlinkDevice1CB(void *unlinkCtx, OCDoHandle h } else { - OC_LOG(DEBUG, TAG, "Invalid response from server"); + OIC_LOG(DEBUG, TAG, "Invalid response from server"); registerResultForUnlinkDevices(unlinkData, OC_STACK_INVALID_REQUEST_HANDLE, IDX_FIRST_DEVICE_RES ); unlinkData->resultCallback(unlinkData->ctx, unlinkData->numOfResults, unlinkData->unlinkRes, true); - OC_LOG(ERROR, TAG, "SRPUnlinkDevice1CB received Null clientResponse"); + OIC_LOG(ERROR, TAG, "SRPUnlinkDevice1CB received Null clientResponse"); } error: - OC_LOG_V(INFO, TAG, "Out SRPUnlinkDevice1CB"); + OIC_LOG_V(INFO, TAG, "Out SRPUnlinkDevice1CB"); DeleteUnlinkData_t(unlinkData); return OC_STACK_DELETE_TRANSACTION; } @@ -1143,14 +1143,14 @@ OCStackResult SRPUnlinkDevices(void* ctx, const OCProvisionDev_t* pTargetDev2, OCProvisionResultCB resultCallback) { - OC_LOG(INFO, TAG, "IN SRPUnlinkDevices"); + OIC_LOG(INFO, TAG, "IN SRPUnlinkDevices"); if (!pTargetDev1 || !pTargetDev2 || !resultCallback) { - OC_LOG(INFO, TAG, "SRPUnlinkDevices : NULL parameters"); + OIC_LOG(INFO, TAG, "SRPUnlinkDevices : NULL parameters"); return OC_STACK_INVALID_PARAM; } - OC_LOG(INFO, TAG, "Unlinking following devices: "); + OIC_LOG(INFO, TAG, "Unlinking following devices: "); PMPrintOCProvisionDev(pTargetDev1); PMPrintOCProvisionDev(pTargetDev2); @@ -1158,7 +1158,7 @@ OCStackResult SRPUnlinkDevices(void* ctx, OCStackResult res = PDMSetLinkStale(&pTargetDev1->doxm->deviceID, &pTargetDev2->doxm->deviceID); if (OC_STACK_OK != res) { - OC_LOG(FATAL, TAG, "unable to update DB. Try again."); + OIC_LOG(FATAL, TAG, "unable to update DB. Try again."); return res; } @@ -1170,7 +1170,7 @@ OCStackResult SRPUnlinkDevices(void* ctx, unlinkData->unlinkDev = (OCProvisionDev_t*)OICCalloc(2, sizeof(OCProvisionDev_t)); if (NULL == unlinkData->unlinkDev) { - OC_LOG(ERROR, TAG, "Memory allocation failed"); + OIC_LOG(ERROR, TAG, "Memory allocation failed"); res = OC_STACK_NO_MEMORY; goto error; } @@ -1178,7 +1178,7 @@ OCStackResult SRPUnlinkDevices(void* ctx, unlinkData->unlinkRes = (OCProvisionResult_t*)OICCalloc(3, sizeof(OCProvisionResult_t)); if (NULL == unlinkData->unlinkRes) { - OC_LOG(ERROR, TAG, "Memory allocation failed"); + OIC_LOG(ERROR, TAG, "Memory allocation failed"); res = OC_STACK_NO_MEMORY; goto error; } @@ -1193,14 +1193,14 @@ OCStackResult SRPUnlinkDevices(void* ctx, &unlinkData->unlinkDev[1], &unlinkData->unlinkDev[0]); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "SRPUnlinkDevices : SendDeleteCredentialRequest failed"); + OIC_LOG(ERROR, TAG, "SRPUnlinkDevices : SendDeleteCredentialRequest failed"); goto error; } return res; error: - OC_LOG(INFO, TAG, "OUT SRPUnlinkDevices"); + OIC_LOG(INFO, TAG, "OUT SRPUnlinkDevices"); DeleteUnlinkData_t(unlinkData); return res; } @@ -1219,7 +1219,7 @@ static void DeleteRemoveData_t(RemoveData_t* pRemoveData) static void registerResultForRemoveDevice(RemoveData_t *removeData, OicUuid_t *pLinkedDevId, OCStackResult stackresult, bool hasError) { - OC_LOG_V(INFO, TAG, "Inside registerResultForRemoveDevice removeData->numOfResults is %zu\n", + OIC_LOG_V(INFO, TAG, "Inside registerResultForRemoveDevice removeData->numOfResults is %zu\n", removeData->numOfResults + 1); if (pLinkedDevId) { @@ -1243,7 +1243,7 @@ static void registerResultForRemoveDevice(RemoveData_t *removeData, OicUuid_t *p // Remove device info from prvisioning database if (OC_STACK_OK != PDMDeleteDevice(&removeData->revokeTargetDev->doxm->deviceID)) { - OC_LOG(ERROR, TAG, "ResultForRemoveDevice : Failed to remove device in PDM."); + OIC_LOG(ERROR, TAG, "ResultForRemoveDevice : Failed to remove device in PDM."); removeData->hasError = true; } } @@ -1268,7 +1268,7 @@ static OCStackApplicationResult SRPRemoveDeviceCB(void *delDevCtx, OCDoHandle ha //Update the delete credential into delete device context //Save the deleted status in delDevCtx (void)handle; - OC_LOG_V(INFO, TAG, "Inside SRPRemoveDeviceCB."); + OIC_LOG_V(INFO, TAG, "Inside SRPRemoveDeviceCB."); VERIFY_NON_NULL(TAG, delDevCtx, ERROR, OC_STACK_DELETE_TRANSACTION); OCStackResult res = OC_STACK_ERROR; @@ -1286,7 +1286,7 @@ static OCStackApplicationResult SRPRemoveDeviceCB(void *delDevCtx, OCDoHandle ha res = PDMUnlinkDevices(&removeData->revokeTargetDev->doxm->deviceID, &revDevUuid); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "PDMSetLinkStale() FAIL: PDB is an obsolete one."); + OIC_LOG(ERROR, TAG, "PDMSetLinkStale() FAIL: PDB is an obsolete one."); registerResultForRemoveDevice(removeData, &revDevUuid, OC_STACK_INCONSISTENT_DB, true); @@ -1300,12 +1300,12 @@ static OCStackApplicationResult SRPRemoveDeviceCB(void *delDevCtx, OCDoHandle ha { registerResultForRemoveDevice(removeData, &revDevUuid, clientResponse->result, true); - OC_LOG(ERROR, TAG, "Unexpected result from DELETE credential request!"); + OIC_LOG(ERROR, TAG, "Unexpected result from DELETE credential request!"); } } else { - OC_LOG_V(WARNING, TAG, "Incorrect length of device UUID was sent from %s:%d", + OIC_LOG_V(WARNING, TAG, "Incorrect length of device UUID was sent from %s:%d", clientResponse->devAddr.addr, clientResponse->devAddr.port); if (OC_STACK_RESOURCE_DELETED == clientResponse->result) @@ -1315,7 +1315,7 @@ static OCStackApplicationResult SRPRemoveDeviceCB(void *delDevCtx, OCDoHandle ha * register result as OC_STACK_INCONSISTENT_DB with NULL UUID. */ - OC_LOG_V(ERROR, TAG, "But server's credential was deleted."); + OIC_LOG_V(ERROR, TAG, "But server's credential was deleted."); registerResultForRemoveDevice(removeData, NULL, OC_STACK_INCONSISTENT_DB, true); } else @@ -1327,12 +1327,12 @@ static OCStackApplicationResult SRPRemoveDeviceCB(void *delDevCtx, OCDoHandle ha else { registerResultForRemoveDevice(removeData, NULL, OC_STACK_ERROR, true); - OC_LOG(ERROR, TAG, "SRPRemoveDevices received Null clientResponse"); + OIC_LOG(ERROR, TAG, "SRPRemoveDevices received Null clientResponse"); } } else { - OC_LOG(WARNING, TAG, "SRPRemoveDevices received null context"); + OIC_LOG(WARNING, TAG, "SRPRemoveDevices received null context"); } return OC_STACK_DELETE_TRANSACTION; @@ -1359,7 +1359,7 @@ static OCStackResult GetListofDevToReqDeleteCred(const OCProvisionDev_t* pRevoke OCStackResult res = PDMSetLinkStale(&curUuid->dev, &pRevokeTargetDev->doxm->deviceID); if (OC_STACK_OK != res) { - OC_LOG(FATAL, TAG, "PDMSetLinkStale() FAIL: PDB is an obsolete one."); + OIC_LOG(FATAL, TAG, "PDMSetLinkStale() FAIL: PDB is an obsolete one."); return OC_STACK_INCONSISTENT_DB; } @@ -1374,7 +1374,7 @@ static OCStackResult GetListofDevToReqDeleteCred(const OCProvisionDev_t* pRevoke OCProvisionDev_t* targetDev = PMCloneOCProvisionDev(curDev); if (NULL == targetDev) { - OC_LOG(ERROR, TAG, "SRPRemoveDevice : Cloning OCProvisionDev_t Failed."); + OIC_LOG(ERROR, TAG, "SRPRemoveDevice : Cloning OCProvisionDev_t Failed."); return OC_STACK_NO_MEMORY; } @@ -1405,11 +1405,11 @@ static OCStackResult GetListofDevToReqDeleteCred(const OCProvisionDev_t* pRevoke OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, const OCProvisionDev_t* pTargetDev, OCProvisionResultCB resultCallback) { - OC_LOG(INFO, TAG, "IN SRPRemoveDevice"); + OIC_LOG(INFO, TAG, "IN SRPRemoveDevice"); if (!pTargetDev || !resultCallback || 0 == waitTimeForOwnedDeviceDiscovery) { - OC_LOG(INFO, TAG, "SRPRemoveDevice : NULL parameters"); + OIC_LOG(INFO, TAG, "SRPRemoveDevice : NULL parameters"); return OC_STACK_INVALID_PARAM; } @@ -1425,13 +1425,13 @@ OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDi res = PDMGetLinkedDevices(&pTargetDev->doxm->deviceID, &pLinkedUuidList, &numOfDevices); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "SRPRemoveDevice : Failed to get linked devices information"); + OIC_LOG(ERROR, TAG, "SRPRemoveDevice : Failed to get linked devices information"); return res; } // if there is no related device, we can skip further process. if (0 == numOfDevices) { - OC_LOG(DEBUG, TAG, "SRPRemoveDevice : No linked device found."); + OIC_LOG(DEBUG, TAG, "SRPRemoveDevice : No linked device found."); res = OC_STACK_CONTINUE; goto error; } @@ -1440,7 +1440,7 @@ OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDi res = PMDeviceDiscovery(waitTimeForOwnedDeviceDiscovery, true, &pOwnedDevList); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "SRPRemoveDevice : Failed to PMDeviceDiscovery"); + OIC_LOG(ERROR, TAG, "SRPRemoveDevice : Failed to PMDeviceDiscovery"); goto error; } @@ -1451,12 +1451,12 @@ OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDi &pLinkedDevList, &numOfLinkedDev); if (OC_STACK_OK != res) { - OC_LOG(ERROR, TAG, "SRPRemoveDevice : GetListofDevToReqDeleteCred() failed"); + OIC_LOG(ERROR, TAG, "SRPRemoveDevice : GetListofDevToReqDeleteCred() failed"); goto error; } if (0 == numOfLinkedDev) // This case means, there is linked device but it's not alive now. { // So we don't have to send request message. - OC_LOG(DEBUG, TAG, "SRPRemoveDevice : No alived & linked device found."); + OIC_LOG(DEBUG, TAG, "SRPRemoveDevice : No alived & linked device found."); res = OC_STACK_CONTINUE; goto error; } @@ -1465,7 +1465,7 @@ OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDi removeData = (RemoveData_t*)OICCalloc(1, sizeof(RemoveData_t)); if (!removeData) { - OC_LOG(ERROR, TAG, "SRPRemoveDevices : Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "SRPRemoveDevices : Failed to memory allocation"); res = OC_STACK_NO_MEMORY; goto error; } @@ -1473,7 +1473,7 @@ OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDi removeData->revokeTargetDev = PMCloneOCProvisionDev(pTargetDev); if (!removeData->revokeTargetDev) { - OC_LOG(ERROR, TAG, "SRPRemoveDevices : PMCloneOCProvisionDev Failed"); + OIC_LOG(ERROR, TAG, "SRPRemoveDevices : PMCloneOCProvisionDev Failed"); res = OC_STACK_NO_MEMORY; goto error; } @@ -1482,7 +1482,7 @@ OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDi (OCProvisionResult_t*)OICCalloc(numOfLinkedDev, sizeof(OCProvisionResult_t)); if (!removeData->removeRes) { - OC_LOG(ERROR, TAG, "SRPRemoveDevices : Failed to memory allocation"); + OIC_LOG(ERROR, TAG, "SRPRemoveDevices : Failed to memory allocation"); res = OC_STACK_NO_MEMORY; goto error; } @@ -1503,7 +1503,7 @@ OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDi removeData->revokeTargetDev, curDev); if (OC_STACK_OK != res) { - OC_LOG_V(ERROR, TAG, "SRPRemoveDevice : Fail to send the DELETE credential request to\ + OIC_LOG_V(ERROR, TAG, "SRPRemoveDevice : Fail to send the DELETE credential request to\ %s:%u", curDev->endpoint.addr, curDev->endpoint.port); } else @@ -1514,7 +1514,7 @@ OCStackResult SRPRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDi PDMDestoryOicUuidLinkList(pLinkedUuidList); //TODO: Modify API name to have unified convention. PMDeleteDeviceList(pOwnedDevList); - OC_LOG(INFO, TAG, "OUT SRPRemoveDevice"); + OIC_LOG(INFO, TAG, "OUT SRPRemoveDevice"); return totalRes; // Caller of this API should wait callback if totalRes == OC_STACK_OK. @@ -1528,6 +1528,6 @@ error: OICFree(removeData->removeRes); OICFree(removeData); } - OC_LOG(INFO, TAG, "OUT ERROR case SRPRemoveDevice"); + OIC_LOG(INFO, TAG, "OUT ERROR case SRPRemoveDevice"); return res; } diff --git a/resource/csdk/security/src/aclresource.c b/resource/csdk/security/src/aclresource.c index 6d20938..f6d137e 100644 --- a/resource/csdk/security/src/aclresource.c +++ b/resource/csdk/security/src/aclresource.c @@ -54,7 +54,7 @@ static void FreeACE(OicSecAcl_t *ace) size_t i; if(NULL == ace) { - OC_LOG (ERROR, TAG, "Invalid Parameter"); + OIC_LOG (ERROR, TAG, "Invalid Parameter"); return; } @@ -437,7 +437,7 @@ static bool UpdatePersistentStorage(const OicSecAcl_t *acl) static OCStackResult RemoveACE(const OicUuid_t * subject, const char * resource) { - OC_LOG(DEBUG, TAG, "IN RemoveACE"); + OIC_LOG(DEBUG, TAG, "IN RemoveACE"); OicSecAcl_t *acl = NULL; OicSecAcl_t *tempAcl = NULL; @@ -446,7 +446,7 @@ static OCStackResult RemoveACE(const OicUuid_t * subject, if(memcmp(subject->id, &WILDCARD_SUBJECT_ID, sizeof(subject->id)) == 0) { - OC_LOG_V (ERROR, TAG, "%s received invalid parameter", __func__ ); + OIC_LOG_V (ERROR, TAG, "%s received invalid parameter", __func__ ); return OC_STACK_INVALID_PARAM; } @@ -597,7 +597,7 @@ static OCEntityHandlerResult HandleACLGetRequest (const OCEntityHandlerRequest * // Process the REST querystring parameters if(ehRequest->query) { - OC_LOG (DEBUG, TAG, "HandleACLGetRequest processing query"); + OIC_LOG (DEBUG, TAG, "HandleACLGetRequest processing query"); OicUuid_t subject = {.id={0}}; char resource[MAX_URI_LENGTH] = {0}; @@ -659,7 +659,7 @@ exit: OICFree(jsonStr); - OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); + OIC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -684,13 +684,13 @@ static OCEntityHandlerResult HandleACLPostRequest (const OCEntityHandlerRequest // Send payload to request originator SendSRMResponse(ehRequest, ehRet, NULL); - OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); + OIC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } static OCEntityHandlerResult HandleACLDeleteRequest(const OCEntityHandlerRequest *ehRequest) { - OC_LOG (DEBUG, TAG, "Processing ACLDeleteRequest"); + OIC_LOG (DEBUG, TAG, "Processing ACLDeleteRequest"); OCEntityHandlerResult ehRet = OC_EH_ERROR; OicUuid_t subject = {.id={0}}; char resource[MAX_URI_LENGTH] = {0}; @@ -724,7 +724,7 @@ OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag, OCEntityHandlerRequest * ehRequest, void* callbackParameter) { - OC_LOG(DEBUG, TAG, "Received request ACLEntityHandler"); + OIC_LOG(DEBUG, TAG, "Received request ACLEntityHandler"); (void)callbackParameter; OCEntityHandlerResult ehRet = OC_EH_ERROR; @@ -736,7 +736,7 @@ OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { // TODO : Handle PUT method - OC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: @@ -777,7 +777,7 @@ OCStackResult CreateACLResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, "Unable to instantiate ACL resource"); + OIC_LOG (FATAL, TAG, "Unable to instantiate ACL resource"); DeInitACLResource(); } return ret; diff --git a/resource/csdk/security/src/amaclresource.c b/resource/csdk/security/src/amaclresource.c index 9d1d668..de7e990 100644 --- a/resource/csdk/security/src/amaclresource.c +++ b/resource/csdk/security/src/amaclresource.c @@ -259,7 +259,7 @@ static OCEntityHandlerResult HandleAmaclGetRequest (const OCEntityHandlerRequest OICFree(jsonStr); - OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); + OIC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -294,7 +294,7 @@ static OCEntityHandlerResult HandleAmaclPostRequest (const OCEntityHandlerReques // Send payload to request originator SendSRMResponse(ehRequest, ehRet, NULL); - OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); + OIC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -316,7 +316,7 @@ OCEntityHandlerResult AmaclEntityHandler (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: @@ -353,7 +353,7 @@ OCStackResult CreateAmaclResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, "Unable to instantiate Amacl resource"); + OIC_LOG (FATAL, TAG, "Unable to instantiate Amacl resource"); DeInitAmaclResource(); } return ret; diff --git a/resource/csdk/security/src/amsmgr.c b/resource/csdk/security/src/amsmgr.c index 5ec9fb4..f9396e6 100644 --- a/resource/csdk/security/src/amsmgr.c +++ b/resource/csdk/security/src/amsmgr.c @@ -54,7 +54,7 @@ static OCStackApplicationResult AmsMgrAclReqCallback(void *ctx, OCDoHandle handl OCStackResult DiscoverAmsService(PEContext_t *context) { - OC_LOG(INFO, TAG, "IN DiscoverAmsService"); + OIC_LOG(INFO, TAG, "IN DiscoverAmsService"); OCStackResult ret = OC_STACK_ERROR; const char DOXM_DEVICEID_QUERY_FMT[] = "%s?%s=%s"; @@ -80,12 +80,12 @@ OCStackResult DiscoverAmsService(PEContext_t *context) * Need logic to reset the PE state and send ACCESS_DENIED response, * when discovery response from AMS service is not received within certain time. */ - OC_LOG_V(INFO, TAG,"AMS Manager Sending Multicast Discovery with URI = %s", uri); + OIC_LOG_V(INFO, TAG,"AMS Manager Sending Multicast Discovery with URI = %s", uri); ret = OCDoResource(NULL, OC_REST_DISCOVER, uri, NULL, NULL, CT_DEFAULT, OC_LOW_QOS, &cbData, NULL, 0); exit: - OC_LOG(INFO, TAG, "Leaving DiscoverAmsService"); + OIC_LOG(INFO, TAG, "Leaving DiscoverAmsService"); return ret; } @@ -93,7 +93,7 @@ exit: static OCStackApplicationResult AmsMgrDiscoveryCallback(void *ctx, OCDoHandle handle, OCClientResponse * clientResponse) { - OC_LOG_V(INFO, TAG, "%s Begin", __func__ ); + OIC_LOG_V(INFO, TAG, "%s Begin", __func__ ); if (!ctx || !clientResponse || @@ -101,7 +101,7 @@ static OCStackApplicationResult AmsMgrDiscoveryCallback(void *ctx, OCDoHandle ha (PAYLOAD_TYPE_SECURITY != clientResponse->payload->type)|| (OC_STACK_OK != clientResponse->result)) { - OC_LOG_V(ERROR, TAG, "%s Invalid Response ", __func__); + OIC_LOG_V(ERROR, TAG, "%s Invalid Response ", __func__); return OC_STACK_KEEP_TRANSACTION; } @@ -109,12 +109,12 @@ static OCStackApplicationResult AmsMgrDiscoveryCallback(void *ctx, OCDoHandle ha PEContext_t *context = (PEContext_t *) ctx; if (context->state != AWAITING_AMS_RESPONSE) { - OC_LOG_V(ERROR, TAG, "%s Invalid PE State ", __func__); + OIC_LOG_V(ERROR, TAG, "%s Invalid PE State ", __func__); return OC_STACK_DELETE_TRANSACTION; } OicSecDoxm_t *doxm = NULL; - OC_LOG_V(INFO, TAG, "Doxm DeviceId Discovery response = %s\n", + OIC_LOG_V(INFO, TAG, "Doxm DeviceId Discovery response = %s\n", ((OCSecurityPayload*)clientResponse->payload)->securityData); doxm = JSONToDoxmBin(((OCSecurityPayload*)clientResponse->payload)->securityData); @@ -122,7 +122,7 @@ static OCStackApplicationResult AmsMgrDiscoveryCallback(void *ctx, OCDoHandle ha //so keep the transaction. if(NULL == doxm) { - OC_LOG_V(ERROR, TAG, "%s : Unable to convert JSON to Binary",__func__); + OIC_LOG_V(ERROR, TAG, "%s : Unable to convert JSON to Binary",__func__); return OC_STACK_KEEP_TRANSACTION; } @@ -136,7 +136,7 @@ static OCStackApplicationResult AmsMgrDiscoveryCallback(void *ctx, OCDoHandle ha if (memcmp(&context->amsMgrContext->amsDeviceId, &deviceId, sizeof(context->amsMgrContext->amsDeviceId)) == 0) { - OC_LOG(INFO, TAG, "AMS Manager Sending unicast discovery to get secured port info"); + OIC_LOG(INFO, TAG, "AMS Manager Sending unicast discovery to get secured port info"); //Sending Unicast discovery to get secure port information if(OC_STACK_OK == SendUnicastSecurePortDiscovery(context, &clientResponse->devAddr, clientResponse->connType)) @@ -154,7 +154,7 @@ static OCStackApplicationResult AmsMgrDiscoveryCallback(void *ctx, OCDoHandle ha OCStackResult SendUnicastSecurePortDiscovery(PEContext_t *context,OCDevAddr *devAddr, OCConnectivityType connType) { - OC_LOG(INFO, TAG, "IN SendUnicastSecurePortDiscovery"); + OIC_LOG(INFO, TAG, "IN SendUnicastSecurePortDiscovery"); const char RES_DOXM_QUERY_FMT[] = "%s?%s=%s"; OCCallbackData cbData = {.context=NULL}; @@ -165,7 +165,7 @@ OCStackResult SendUnicastSecurePortDiscovery(PEContext_t *context,OCDevAddr *dev cbData.cb = &SecurePortDiscoveryCallback; cbData.context = context; - OC_LOG_V(INFO, TAG, "AMS Manager Sending Unicast Discovery with URI = %s", uri); + OIC_LOG_V(INFO, TAG, "AMS Manager Sending Unicast Discovery with URI = %s", uri); return OCDoResource(NULL, OC_REST_DISCOVER, uri, devAddr, NULL, connType, OC_LOW_QOS, &cbData, NULL, 0); @@ -174,7 +174,7 @@ OCStackResult SendUnicastSecurePortDiscovery(PEContext_t *context,OCDevAddr *dev static OCStackApplicationResult SecurePortDiscoveryCallback(void *ctx, OCDoHandle handle, OCClientResponse * clientResponse) { - OC_LOG(INFO, TAG, "In SecurePortDiscoveryCallback"); + OIC_LOG(INFO, TAG, "In SecurePortDiscoveryCallback"); if (!ctx || !clientResponse || @@ -182,7 +182,7 @@ static OCStackApplicationResult SecurePortDiscoveryCallback(void *ctx, OCDoHandl (PAYLOAD_TYPE_DISCOVERY != clientResponse->payload->type)|| (OC_STACK_OK != clientResponse->result)) { - OC_LOG_V(ERROR, TAG, "%s Invalid Response ", __func__); + OIC_LOG_V(ERROR, TAG, "%s Invalid Response ", __func__); SRMSendResponse(ACCESS_DENIED_AMS_SERVICE_ERROR); return OC_STACK_DELETE_TRANSACTION; } @@ -192,7 +192,7 @@ static OCStackApplicationResult SecurePortDiscoveryCallback(void *ctx, OCDoHandl (void)handle; if (context->state != AWAITING_AMS_RESPONSE) { - OC_LOG_V(ERROR, TAG, "%s Invalid PE State ", __func__); + OIC_LOG_V(ERROR, TAG, "%s Invalid PE State ", __func__); context->retVal = ACCESS_DENIED_AMS_SERVICE_ERROR; SRMSendResponse(context->retVal); return OC_STACK_DELETE_TRANSACTION; @@ -207,7 +207,7 @@ static OCStackApplicationResult SecurePortDiscoveryCallback(void *ctx, OCDoHandl // resPayload->sid, sizeof(context->amsMgrContext->amsDeviceId.id)) != 0) { - OC_LOG_V(ERROR, TAG, "%s Invalid AMS device", __func__); + OIC_LOG_V(ERROR, TAG, "%s Invalid AMS device", __func__); context->retVal = ACCESS_DENIED_AMS_SERVICE_ERROR; SRMSendResponse(context->retVal); return OC_STACK_DELETE_TRANSACTION; @@ -221,7 +221,7 @@ static OCStackApplicationResult SecurePortDiscoveryCallback(void *ctx, OCDoHandl return OC_STACK_DELETE_TRANSACTION; } } - OC_LOG(INFO, TAG, "Can not find secure port information"); + OIC_LOG(INFO, TAG, "Can not find secure port information"); context->retVal = ACCESS_DENIED_AMS_SERVICE_ERROR; SRMSendResponse(context->retVal); @@ -260,12 +260,12 @@ OCStackResult SendAclReq(PEContext_t *context, OCDevAddr *devAddr, OCConnectivit destAddr.flags = (OCTransportFlags)(destAddr.flags | OC_FLAG_SECURE); destAddr.port = securedPort; - OC_LOG_V(INFO, TAG, "AMS Manager Sending Unicast ACL request with URI = %s", uri); + OIC_LOG_V(INFO, TAG, "AMS Manager Sending Unicast ACL request with URI = %s", uri); ret = OCDoResource(NULL, OC_REST_GET, uri, &destAddr, NULL, connType, OC_LOW_QOS, &cbData, NULL, 0); exit: - OC_LOG_V(INFO, TAG, "%s returns %d ", __func__, ret); + OIC_LOG_V(INFO, TAG, "%s returns %d ", __func__, ret); return ret; } @@ -273,7 +273,7 @@ exit: static OCStackApplicationResult AmsMgrAclReqCallback(void *ctx, OCDoHandle handle, OCClientResponse * clientResponse) { - OC_LOG_V(INFO, TAG, "%s Begin", __func__ ); + OIC_LOG_V(INFO, TAG, "%s Begin", __func__ ); (void)handle; PEContext_t *context = (PEContext_t *) ctx; @@ -285,14 +285,14 @@ static OCStackApplicationResult AmsMgrAclReqCallback(void *ctx, OCDoHandle handl (PAYLOAD_TYPE_SECURITY != clientResponse->payload->type) || (clientResponse->result != OC_STACK_OK)) { - OC_LOG_V(ERROR, TAG, "%s Invalid Response ", __func__); + OIC_LOG_V(ERROR, TAG, "%s Invalid Response ", __func__); SRMSendResponse(ACCESS_DENIED_AMS_SERVICE_ERROR); return OC_STACK_DELETE_TRANSACTION; } if (context->state != AWAITING_AMS_RESPONSE) { - OC_LOG_V(ERROR, TAG, "%s Invalid State ", __func__); + OIC_LOG_V(ERROR, TAG, "%s Invalid State ", __func__); context->retVal = ACCESS_DENIED_AMS_SERVICE_ERROR; SRMSendResponse(context->retVal); return OC_STACK_DELETE_TRANSACTION; @@ -309,11 +309,11 @@ static OCStackApplicationResult AmsMgrAclReqCallback(void *ctx, OCDoHandle handl InstallNewACL(((OCSecurityPayload*)clientResponse->payload)->securityData); VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR); - OC_LOG_V(INFO, TAG, "%s : Calling checkPermission", __func__); + OIC_LOG_V(INFO, TAG, "%s : Calling checkPermission", __func__); rsps = CheckPermission(context, &context->subject, context->resource, context->permission); VERIFY_SUCCESS(TAG, (true == IsAccessGranted(rsps)), ERROR); - OC_LOG_V(INFO, TAG, "%sAccess granted, Calling SRMCallCARequestHandler", __func__); + OIC_LOG_V(INFO, TAG, "%sAccess granted, Calling SRMCallCARequestHandler", __func__); context->retVal = ACCESS_GRANTED; SRMSendResponse(context->retVal); return OC_STACK_DELETE_TRANSACTION; @@ -358,7 +358,7 @@ void FreeCARequestInfo(CARequestInfo_t *requestInfo) { if(NULL == requestInfo) { - OC_LOG_V(ERROR, TAG, "%s: Can't free memory. Received NULL requestInfo", __func__); + OIC_LOG_V(ERROR, TAG, "%s: Can't free memory. Received NULL requestInfo", __func__); return; } OICFree(requestInfo->info.token); @@ -373,7 +373,7 @@ void FreeCARequestInfo(CARequestInfo_t *requestInfo) //context->amsMgrContext->amsDeviceId with amsID of the Amacl else leaves it empty. bool FoundAmaclForRequest(PEContext_t *context) { - OC_LOG_V(INFO, TAG, "%s:no ACL found. Searching for AMACL",__func__); + OIC_LOG_V(INFO, TAG, "%s:no ACL found. Searching for AMACL",__func__); bool ret = false; VERIFY_NON_NULL(TAG, context, ERROR); @@ -382,13 +382,13 @@ bool FoundAmaclForRequest(PEContext_t *context) //Call amacl resource function to get the AMS service deviceID for the resource if(OC_STACK_OK == AmaclGetAmsDeviceId(context->resource, &context->amsMgrContext->amsDeviceId)) { - OC_LOG_V(INFO, TAG, "%s:AMACL found for the requested resource %s", + OIC_LOG_V(INFO, TAG, "%s:AMACL found for the requested resource %s", __func__, context->resource); ret = true; } else { - OC_LOG_V(INFO, TAG, "%s:AMACL found for the requested resource %s", + OIC_LOG_V(INFO, TAG, "%s:AMACL found for the requested resource %s", __func__, context->resource); ret = false; } @@ -401,7 +401,7 @@ bool FoundAmaclForRequest(PEContext_t *context) void ProcessAMSRequest(PEContext_t *context) { OicUuid_t emptyUuid = {.id={}}; - OC_LOG_V(INFO, TAG, "Entering %s", __func__); + OIC_LOG_V(INFO, TAG, "Entering %s", __func__); if(NULL != context) { if((false == context->matchingAclFound) && (false == context->amsProcessing)) @@ -425,11 +425,11 @@ void ProcessAMSRequest(PEContext_t *context) } else { - OC_LOG_V(INFO, TAG, "Leaving %s(context is NULL)", __func__); + OIC_LOG_V(INFO, TAG, "Leaving %s(context is NULL)", __func__); } if(ACCESS_WAITING_FOR_AMS == context->retVal ) { - OC_LOG_V(INFO, TAG, "Leaving %s(WAITING_FOR_AMS)", __func__); + OIC_LOG_V(INFO, TAG, "Leaving %s(WAITING_FOR_AMS)", __func__); } } diff --git a/resource/csdk/security/src/credresource.c b/resource/csdk/security/src/credresource.c index 660164b..68f0eb0 100644 --- a/resource/csdk/security/src/credresource.c +++ b/resource/csdk/security/src/credresource.c @@ -56,7 +56,7 @@ static void FreeCred(OicSecCred_t *cred) { if(NULL == cred) { - OC_LOG (ERROR, TAG, "Invalid Parameter"); + OIC_LOG (ERROR, TAG, "Invalid Parameter"); return; } //Note: Need further clarification on roleID data type @@ -678,7 +678,7 @@ static OCEntityHandlerResult HandlePostRequest(const OCEntityHandlerRequest * eh static OCEntityHandlerResult HandleDeleteRequest(const OCEntityHandlerRequest *ehRequest) { - OC_LOG(DEBUG, TAG, "Processing CredDeleteRequest"); + OIC_LOG(DEBUG, TAG, "Processing CredDeleteRequest"); OCEntityHandlerResult ehRet = OC_EH_ERROR; @@ -735,7 +735,7 @@ OCEntityHandlerResult CredEntityHandler (OCEntityHandlerFlag flag, } if (flag & OC_REQUEST_FLAG) { - OC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG"); //TODO : Handle PUT/DEL methods switch(ehRequest->method) { @@ -778,7 +778,7 @@ OCStackResult CreateCredResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, "Unable to instantiate Cred resource"); + OIC_LOG (FATAL, TAG, "Unable to instantiate Cred resource"); DeInitCredResource(); } return ret; @@ -898,13 +898,13 @@ int32_t GetDtlsPskCredentials( CADtlsPskCredType_t type, // Retrieve Device ID from doxm resource if ( OC_STACK_OK != GetDoxmDeviceID(&deviceID) ) { - OC_LOG (ERROR, TAG, "Unable to retrieve doxm Device ID"); + OIC_LOG (ERROR, TAG, "Unable to retrieve doxm Device ID"); return ret; } if (result_length < sizeof(deviceID.id)) { - OC_LOG (ERROR, TAG, "Wrong value for result_length"); + OIC_LOG (ERROR, TAG, "Wrong value for result_length"); return ret; } memcpy(result, deviceID.id, sizeof(deviceID.id)); @@ -933,7 +933,7 @@ int32_t GetDtlsPskCredentials( CADtlsPskCredType_t type, { if(IOTVTICAL_VALID_ACCESS != IsRequestWithinValidTime(cred->period, NULL)) { - OC_LOG (INFO, TAG, "Credentials are expired."); + OIC_LOG (INFO, TAG, "Credentials are expired."); ret = -1; return ret; } @@ -946,7 +946,7 @@ int32_t GetDtlsPskCredentials( CADtlsPskCredType_t type, result_length, &outLen); if (B64_OK != b64Ret) { - OC_LOG (ERROR, TAG, "Base64 decoding failed."); + OIC_LOG (ERROR, TAG, "Base64 decoding failed."); ret = -1; return ret; } @@ -958,7 +958,7 @@ int32_t GetDtlsPskCredentials( CADtlsPskCredType_t type, default: { - OC_LOG (ERROR, TAG, "Wrong value passed for CADtlsPskCredType_t."); + OIC_LOG (ERROR, TAG, "Wrong value passed for CADtlsPskCredType_t."); ret = -1; } break; @@ -1007,7 +1007,7 @@ OCStackResult AddTmpPskWithPIN(const OicUuid_t* tmpSubject, OicSecCredType_t cre base64Buff, ownersLen, owners); if(NULL == cred) { - OC_LOG(ERROR, TAG, "GeneratePskWithPIN() : Failed to generate credential"); + OIC_LOG(ERROR, TAG, "GeneratePskWithPIN() : Failed to generate credential"); return OC_STACK_ERROR; } @@ -1016,7 +1016,7 @@ OCStackResult AddTmpPskWithPIN(const OicUuid_t* tmpSubject, OicSecCredType_t cre ret = AddCredential(cred); if( OC_STACK_OK != ret) { - OC_LOG(ERROR, TAG, "GeneratePskWithPIN() : Failed to add credential"); + OIC_LOG(ERROR, TAG, "GeneratePskWithPIN() : Failed to add credential"); } exit: diff --git a/resource/csdk/security/src/crlresource.c b/resource/csdk/security/src/crlresource.c index c226c9d..55dd52d 100644 --- a/resource/csdk/security/src/crlresource.c +++ b/resource/csdk/security/src/crlresource.c @@ -272,15 +272,15 @@ static OCEntityHandlerResult HandleCRLPostRequest(const OCEntityHandlerRequest * if (jsonCRL) { - OC_LOG(INFO, TAG, "UpdateSVRDB..."); - OC_LOG_V(INFO, TAG, "crl: \"%s\"", jsonCRL); + OIC_LOG(INFO, TAG, "UpdateSVRDB..."); + OIC_LOG_V(INFO, TAG, "crl: \"%s\"", jsonCRL); cJSON *jsonObj = cJSON_Parse(jsonCRL); OicSecCrl_t *crl = NULL; crl = JSONToCrlBin(jsonCRL); if (!crl) { - OC_LOG(ERROR, TAG, "Error JSONToCrlBin"); + OIC_LOG(ERROR, TAG, "Error JSONToCrlBin"); } gCrl->CrlId = crl->CrlId; @@ -299,7 +299,7 @@ static OCEntityHandlerResult HandleCRLPostRequest(const OCEntityHandlerRequest * if (OC_STACK_OK == UpdateSVRDatabase(OIC_JSON_CRL_NAME, jsonObj)) { - OC_LOG(INFO, TAG, "UpdateSVRDB == OK"); + OIC_LOG(INFO, TAG, "UpdateSVRDB == OK"); ehRet = OC_EH_RESOURCE_CREATED; } @@ -311,7 +311,7 @@ static OCEntityHandlerResult HandleCRLPostRequest(const OCEntityHandlerRequest * // Send payload to request originator SendSRMResponse(ehRequest, ehRet, NULL); - OC_LOG_V(INFO, TAG, "%s RetVal %d", __func__, ehRet); + OIC_LOG_V(INFO, TAG, "%s RetVal %d", __func__, ehRet); return ehRet; } @@ -332,16 +332,16 @@ OCEntityHandlerResult CRLEntityHandler(OCEntityHandlerFlag flag, return ehRet; } - OC_LOG(INFO, TAG, "Handle CRL resource"); + OIC_LOG(INFO, TAG, "Handle CRL resource"); if (flag & OC_REQUEST_FLAG) { // TODO : Handle PUT and DEL methods - OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: - OC_LOG (INFO, TAG, "Not implemented request method."); + OIC_LOG (INFO, TAG, "Not implemented request method."); //ehRet = HandleCRLGetRequest(ehRequest); break; @@ -374,7 +374,7 @@ OCStackResult CreateCRLResource() if (OC_STACK_OK != ret) { - OC_LOG(FATAL, TAG, "Unable to instantiate CRL resource"); + OIC_LOG(FATAL, TAG, "Unable to instantiate CRL resource"); DeInitCRLResource(); } return ret; diff --git a/resource/csdk/security/src/doxmresource.c b/resource/csdk/security/src/doxmresource.c index 6acb7e3..cd2cae0 100644 --- a/resource/csdk/security/src/doxmresource.c +++ b/resource/csdk/security/src/doxmresource.c @@ -367,7 +367,7 @@ static bool ValidateQuery(const char * query) // access rules. Eventually, the PE and PM code will // not send a request to the /doxm Entity Handler at all // if it should not respond. - OC_LOG (DEBUG, TAG, "In ValidateQuery"); + OIC_LOG (DEBUG, TAG, "In ValidateQuery"); if(NULL == gDoxm) { return false; @@ -428,12 +428,12 @@ static OCEntityHandlerResult HandleDoxmGetRequest (const OCEntityHandlerRequest char* jsonStr = NULL; OCEntityHandlerResult ehRet = OC_EH_OK; - OC_LOG (DEBUG, TAG, "Doxm EntityHandle processing GET request"); + OIC_LOG (DEBUG, TAG, "Doxm EntityHandle processing GET request"); //Checking if Get request is a query. if(ehRequest->query) { - OC_LOG (DEBUG, TAG, "HandleDoxmGetRequest processing query"); + OIC_LOG (DEBUG, TAG, "HandleDoxmGetRequest processing query"); if(!ValidateQuery(ehRequest->query)) { ehRet = OC_EH_ERROR; @@ -452,7 +452,7 @@ static OCEntityHandlerResult HandleDoxmGetRequest (const OCEntityHandlerRequest // Send response payload to request originator if(OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, jsonStr)) { - OC_LOG (ERROR, TAG, "SendSRMResponse failed in HandleDoxmGetRequest"); + OIC_LOG (ERROR, TAG, "SendSRMResponse failed in HandleDoxmGetRequest"); } OICFree(jsonStr); @@ -488,7 +488,7 @@ static OCEntityHandlerResult AddOwnerPSK(const CAEndpoint_t* endpoint, sizeof(base64Buff), &outLen); VERIFY_SUCCESS(TAG, b64Ret == B64_OK, ERROR); - OC_LOG (DEBUG, TAG, "Doxm EntityHandle generating Credential"); + OIC_LOG (DEBUG, TAG, "Doxm EntityHandle generating Credential"); cred = GenerateCredential(&ptDoxm->owner, SYMMETRIC_PAIR_WISE_KEY, NULL, base64Buff, ownLen, &ptDoxm->owner); VERIFY_NON_NULL(TAG, cred, ERROR); @@ -509,7 +509,7 @@ exit: static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest * ehRequest) { - OC_LOG (DEBUG, TAG, "Doxm EntityHandle processing PUT request"); + OIC_LOG (DEBUG, TAG, "Doxm EntityHandle processing PUT request"); OCEntityHandlerResult ehRet = OC_EH_ERROR; OicUuid_t emptyOwner = {.id = {0}}; @@ -531,7 +531,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest */ if ((false == gDoxm->owned) && (false == newDoxm->owned)) { - OC_LOG (INFO, TAG, "Doxm EntityHandle enabling AnonECDHCipherSuite"); + OIC_LOG (INFO, TAG, "Doxm EntityHandle enabling AnonECDHCipherSuite"); #ifdef __WITH_DTLS__ ehRet = (CAEnableAnonECDHCipherSuite(true) == CA_STATUS_OK) ? OC_EH_OK : OC_EH_ERROR; #endif //__WITH_DTLS__ @@ -556,7 +556,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest OCServerRequest *request = (OCServerRequest *)ehRequest->requestHandle; //Generating OwnerPSK - OC_LOG (INFO, TAG, "Doxm EntityHandle generating OwnerPSK"); + OIC_LOG (INFO, TAG, "Doxm EntityHandle generating OwnerPSK"); //Generate new credential for provisioning tool ehRet = AddOwnerPSK((CAEndpoint_t *)&request->devAddr, newDoxm, @@ -606,7 +606,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest { #ifdef __WITH_DTLS__ CAEnableAnonECDHCipherSuite(false); - OC_LOG(INFO, TAG, "ECDH_ANON CipherSuite is DISABLED"); + OIC_LOG(INFO, TAG, "ECDH_ANON CipherSuite is DISABLED"); CASelectCipherSuite(TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256); char ranPin[OXM_RANDOM_PIN_SIZE + 1] = {0,}; @@ -614,7 +614,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest { if(tmpCredGenFlag) { - OC_LOG(INFO, TAG, "Corrupted PSK is detected!!!"); + OIC_LOG(INFO, TAG, "Corrupted PSK is detected!!!"); VERIFY_SUCCESS(TAG, OC_STACK_RESOURCE_DELETED == RemoveCredential(&tmpCredId), ERROR); @@ -628,7 +628,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest } else { - OC_LOG(ERROR, TAG, "Failed to generate random PIN"); + OIC_LOG(ERROR, TAG, "Failed to generate random PIN"); ehRet = OC_EH_ERROR; } @@ -687,7 +687,7 @@ exit: //Send payload to request originator if(OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, NULL)) { - OC_LOG (ERROR, TAG, "SendSRMResponse failed in HandlePstatPostRequest"); + OIC_LOG (ERROR, TAG, "SendSRMResponse failed in HandlePstatPostRequest"); } DeleteDoxmBinData(newDoxm); @@ -712,7 +712,7 @@ OCEntityHandlerResult DoxmEntityHandler (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: @@ -750,7 +750,7 @@ OCStackResult CreateDoxmResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, "Unable to instantiate Doxm resource"); + OIC_LOG (FATAL, TAG, "Unable to instantiate Doxm resource"); DeInitDoxmResource(); } return ret; @@ -779,7 +779,7 @@ static OCStackResult CheckDeviceID() { if (OCGenerateUuid(gDoxm->deviceID.id) != RAND_UUID_OK) { - OC_LOG(FATAL, TAG, "Generate UUID for Server Instance failed!"); + OIC_LOG(FATAL, TAG, "Generate UUID for Server Instance failed!"); return ret; } ret = OC_STACK_OK; @@ -787,7 +787,7 @@ static OCStackResult CheckDeviceID() if (UpdatePersistentStorage(gDoxm)) { //TODO: After registering PSI handler in all samples, do ret = OC_STACK_OK here. - OC_LOG(FATAL, TAG, "UpdatePersistentStorage failed!"); + OIC_LOG(FATAL, TAG, "UpdatePersistentStorage failed!"); } } else @@ -803,7 +803,7 @@ static OCStackResult CheckDeviceID() */ static OicSecDoxm_t* GetDoxmDefault() { - OC_LOG (DEBUG, TAG, "GetDoxmToDefault"); + OIC_LOG (DEBUG, TAG, "GetDoxmToDefault"); return &gDefaultDoxm; } @@ -850,7 +850,7 @@ OCStackResult InitDoxmResource() } else { - OC_LOG (ERROR, TAG, "CheckDeviceID failed"); + OIC_LOG (ERROR, TAG, "CheckDeviceID failed"); } OICFree(jsonSVRDatabase); return ret; diff --git a/resource/csdk/security/src/oxmpincommon.c b/resource/csdk/security/src/oxmpincommon.c index 85612e9..1aa0ac0 100644 --- a/resource/csdk/security/src/oxmpincommon.c +++ b/resource/csdk/security/src/oxmpincommon.c @@ -31,7 +31,7 @@ void SetInputPinCB(InputPinCallback pinCB) { if(NULL == pinCB) { - OC_LOG(ERROR, TAG, "Failed to set callback for input pin."); + OIC_LOG(ERROR, TAG, "Failed to set callback for input pin."); return; } @@ -42,7 +42,7 @@ void SetGeneratePinCB(GeneratePinCallback pinCB) { if(NULL == pinCB) { - OC_LOG(ERROR, TAG, "Failed to set callback for generate pin."); + OIC_LOG(ERROR, TAG, "Failed to set callback for generate pin."); return; } @@ -53,12 +53,12 @@ OCStackResult GeneratePin(char* pinBuffer, size_t bufferSize) { if(!pinBuffer) { - OC_LOG(ERROR, TAG, "PIN buffer is NULL"); + OIC_LOG(ERROR, TAG, "PIN buffer is NULL"); return OC_STACK_INVALID_PARAM; } if(OXM_RANDOM_PIN_SIZE + 1 > bufferSize) { - OC_LOG(ERROR, TAG, "PIN buffer size is too small"); + OIC_LOG(ERROR, TAG, "PIN buffer size is too small"); return OC_STACK_INVALID_PARAM; } for(size_t i = 0; i < OXM_RANDOM_PIN_SIZE; i++) @@ -73,8 +73,8 @@ OCStackResult GeneratePin(char* pinBuffer, size_t bufferSize) } else { - OC_LOG(ERROR, TAG, "Invoke PIN callback failed!"); - OC_LOG(ERROR, TAG, "Callback for genrate PIN should be registered to use PIN based OxM."); + OIC_LOG(ERROR, TAG, "Invoke PIN callback failed!"); + OIC_LOG(ERROR, TAG, "Callback for genrate PIN should be registered to use PIN based OxM."); return OC_STACK_ERROR; } @@ -86,12 +86,12 @@ OCStackResult InputPin(char* pinBuffer, size_t bufferSize) { if(!pinBuffer) { - OC_LOG(ERROR, TAG, "PIN buffer is NULL"); + OIC_LOG(ERROR, TAG, "PIN buffer is NULL"); return OC_STACK_INVALID_PARAM; } if(OXM_RANDOM_PIN_SIZE + 1 > bufferSize) { - OC_LOG(ERROR, TAG, "PIN buffer size is too small"); + OIC_LOG(ERROR, TAG, "PIN buffer size is too small"); return OC_STACK_INVALID_PARAM; } @@ -101,8 +101,8 @@ OCStackResult InputPin(char* pinBuffer, size_t bufferSize) } else { - OC_LOG(ERROR, TAG, "Invoke PIN callback failed!"); - OC_LOG(ERROR, TAG, "Callback for input PIN should be registered to use PIN based OxM."); + OIC_LOG(ERROR, TAG, "Invoke PIN callback failed!"); + OIC_LOG(ERROR, TAG, "Callback for input PIN should be registered to use PIN based OxM."); return OC_STACK_ERROR; } diff --git a/resource/csdk/security/src/pbkdf2.c b/resource/csdk/security/src/pbkdf2.c index 1ddabed..ca614ec 100644 --- a/resource/csdk/security/src/pbkdf2.c +++ b/resource/csdk/security/src/pbkdf2.c @@ -86,7 +86,7 @@ int DeriveCryptoKeyFromPassword(const unsigned char *passwd, size_t pLen, ctx = dtls_hmac_new( (const unsigned char *)passwd, pLen); if (NULL == ctx) { - OC_LOG(ERROR, TAG, "DTLS HMAC Context is NULL"); + OIC_LOG(ERROR, TAG, "DTLS HMAC Context is NULL"); goto bail; } @@ -109,7 +109,7 @@ int DeriveCryptoKeyFromPassword(const unsigned char *passwd, size_t pLen, int len = dtls_hmac_finalize(ctx, buf); if (DTLS_HMAC_DIGEST_SIZE != len) { - OC_LOG(ERROR, TAG, "DTLS HMAC is failed"); + OIC_LOG(ERROR, TAG, "DTLS HMAC is failed"); res = -1; } memcpy(uBuf, buf, DTLS_HMAC_DIGEST_SIZE); @@ -121,7 +121,7 @@ int DeriveCryptoKeyFromPassword(const unsigned char *passwd, size_t pLen, int len = dtls_hmac_finalize(ctx, buf); if (DTLS_HMAC_DIGEST_SIZE != len) { - OC_LOG(ERROR, TAG, "DTLS HMAC is failed"); + OIC_LOG(ERROR, TAG, "DTLS HMAC is failed"); res = -1; } XOR_BUF(buf, uBuf, DTLS_HMAC_DIGEST_SIZE); diff --git a/resource/csdk/security/src/policyengine.c b/resource/csdk/security/src/policyengine.c index 36b03fa..088496a 100644 --- a/resource/csdk/security/src/policyengine.c +++ b/resource/csdk/security/src/policyengine.c @@ -242,11 +242,11 @@ static bool IsAccessWithinValidTime(const OicSecAcl_t *acl) if(IOTVTICAL_VALID_ACCESS == IsRequestWithinValidTime(acl->periods[i], acl->recurrences[i])) { - OC_LOG(INFO, TAG, "Access request is in allowed time period"); + OIC_LOG(INFO, TAG, "Access request is in allowed time period"); return true; } } - OC_LOG(ERROR, TAG, "Access request is in invalid time period"); + OIC_LOG(ERROR, TAG, "Access request is in invalid time period"); return false; #else @@ -292,7 +292,7 @@ static bool IsAccessWithinValidTime(const OicSecAcl_t *acl) */ void ProcessAccessRequest(PEContext_t *context) { - OC_LOG(DEBUG, TAG, "Entering ProcessAccessRequest()"); + OIC_LOG(DEBUG, TAG, "Entering ProcessAccessRequest()"); if(NULL != context) { const OicSecAcl_t *currentAcl = NULL; @@ -305,20 +305,20 @@ void ProcessAccessRequest(PEContext_t *context) // ACL for this request. do { - OC_LOG_V(DEBUG, TAG, "%s: getting ACL..." ,__func__); + OIC_LOG_V(DEBUG, TAG, "%s: getting ACL..." ,__func__); currentAcl = GetACLResourceData(&context->subject, &savePtr); if(NULL != currentAcl) { // Found the subject, so how about resource? - OC_LOG_V(DEBUG, TAG, "%s:found ACL matching subject" ,__func__); + OIC_LOG_V(DEBUG, TAG, "%s:found ACL matching subject" ,__func__); // Subject was found, so err changes to Rsrc not found for now. context->retVal = ACCESS_DENIED_RESOURCE_NOT_FOUND; - OC_LOG_V(DEBUG, TAG, "%s:Searching for resource..." ,__func__); + OIC_LOG_V(DEBUG, TAG, "%s:Searching for resource..." ,__func__); if(IsResourceInAcl(context->resource, currentAcl)) { - OC_LOG_V(INFO, TAG, "%s:found matching resource in ACL" ,__func__); + OIC_LOG_V(INFO, TAG, "%s:found matching resource in ACL" ,__func__); context->matchingAclFound = true; // Found the resource, so it's down to valid period & permission. @@ -335,23 +335,23 @@ void ProcessAccessRequest(PEContext_t *context) } else { - OC_LOG_V(INFO, TAG, "%s:no ACL found matching subject for resource %s",__func__, context->resource); + OIC_LOG_V(INFO, TAG, "%s:no ACL found matching subject for resource %s",__func__, context->resource); } } while((NULL != currentAcl) && (false == context->matchingAclFound)); if(IsAccessGranted(context->retVal)) { - OC_LOG_V(INFO, TAG, "%s:Leaving ProcessAccessRequest(ACCESS_GRANTED)", __func__); + OIC_LOG_V(INFO, TAG, "%s:Leaving ProcessAccessRequest(ACCESS_GRANTED)", __func__); } else { - OC_LOG_V(INFO, TAG, "%s:Leaving ProcessAccessRequest(ACCESS_DENIED)", __func__); + OIC_LOG_V(INFO, TAG, "%s:Leaving ProcessAccessRequest(ACCESS_DENIED)", __func__); } } else { - OC_LOG_V(ERROR, TAG, "%s:Leaving ProcessAccessRequest(context is NULL)", __func__); + OIC_LOG_V(ERROR, TAG, "%s:Leaving ProcessAccessRequest(context is NULL)", __func__); } } @@ -447,7 +447,7 @@ SRMAccessResponse_t CheckPermission( if(!context->amsProcessing) { - OC_LOG(INFO, TAG, "Resetting PE context and PE State to AWAITING_REQUEST"); + OIC_LOG(INFO, TAG, "Resetting PE context and PE State to AWAITING_REQUEST"); SetPolicyEngineState(context, AWAITING_REQUEST); } diff --git a/resource/csdk/security/src/psinterface.c b/resource/csdk/security/src/psinterface.c index 391c62f..7c7cf18 100644 --- a/resource/csdk/security/src/psinterface.c +++ b/resource/csdk/security/src/psinterface.c @@ -81,7 +81,7 @@ char * GetSVRDatabase() int size = GetSVRDatabaseSize(ps); if (0 == size) { - OC_LOG (ERROR, TAG, "FindSVRDatabaseSize failed"); + OIC_LOG (ERROR, TAG, "FindSVRDatabaseSize failed"); return NULL; } @@ -96,13 +96,13 @@ char * GetSVRDatabase() size_t bytesRead = ps->read(jsonStr, 1, size, fp); jsonStr[bytesRead] = '\0'; - OC_LOG_V(DEBUG, TAG, "Read %zu bytes from SVR database file", bytesRead); + OIC_LOG_V(DEBUG, TAG, "Read %zu bytes from SVR database file", bytesRead); ps->close(fp); fp = NULL; } else { - OC_LOG (ERROR, TAG, "Unable to open SVR database file!!"); + OIC_LOG (ERROR, TAG, "Unable to open SVR database file!!"); } } @@ -190,13 +190,13 @@ OCStackResult UpdateSVRDatabase(const char* rsrcName, cJSON* jsonObj) { ret = OC_STACK_OK; } - OC_LOG_V(DEBUG, TAG, "Written %zu bytes into SVR database file", bytesWritten); + OIC_LOG_V(DEBUG, TAG, "Written %zu bytes into SVR database file", bytesWritten); ps->close(fp); fp = NULL; } else { - OC_LOG (ERROR, TAG, "Unable to open SVR database file!! "); + OIC_LOG (ERROR, TAG, "Unable to open SVR database file!! "); } } diff --git a/resource/csdk/security/src/pstatresource.c b/resource/csdk/security/src/pstatresource.c index 979073c..f5c4746 100644 --- a/resource/csdk/security/src/pstatresource.c +++ b/resource/csdk/security/src/pstatresource.c @@ -183,7 +183,7 @@ exit: cJSON_Delete(jsonRoot); if (OC_STACK_OK != ret) { - OC_LOG (ERROR, TAG, "JSONToPstatBin failed"); + OIC_LOG (ERROR, TAG, "JSONToPstatBin failed"); DeletePstatBinData(pstat); pstat = NULL; } @@ -195,7 +195,7 @@ exit: */ static OCEntityHandlerResult HandlePstatGetRequest (const OCEntityHandlerRequest * ehRequest) { - OC_LOG (INFO, TAG, "HandlePstatGetRequest processing GET request"); + OIC_LOG (INFO, TAG, "HandlePstatGetRequest processing GET request"); // Convert ACL data into JSON for transmission char* jsonStr = BinToPstatJSON(gPstat); @@ -218,7 +218,7 @@ static OCEntityHandlerResult HandlePstatPutRequest(const OCEntityHandlerRequest { OCEntityHandlerResult ehRet = OC_EH_ERROR; cJSON *postJson = NULL; - OC_LOG (INFO, TAG, "HandlePstatPutRequest processing PUT request"); + OIC_LOG (INFO, TAG, "HandlePstatPutRequest processing PUT request"); if (ehRequest->resource) { @@ -240,11 +240,11 @@ static OCEntityHandlerResult HandlePstatPutRequest(const OCEntityHandlerRequest { gPstat->isOp = true; gPstat->cm = NORMAL; - OC_LOG (INFO, TAG, "CommitHash is valid and isOp is TRUE"); + OIC_LOG (INFO, TAG, "CommitHash is valid and isOp is TRUE"); } else { - OC_LOG (INFO, TAG, "CommitHash is not valid"); + OIC_LOG (INFO, TAG, "CommitHash is not valid"); } } cJSON *omJson = cJSON_GetObjectItem(jsonPstat, OIC_JSON_OM_NAME); @@ -279,7 +279,7 @@ static OCEntityHandlerResult HandlePstatPutRequest(const OCEntityHandlerRequest //Send payload to request originator if(OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, NULL)) { - OC_LOG (ERROR, TAG, "SendSRMResponse failed in HandlePstatPostRequest"); + OIC_LOG (ERROR, TAG, "SendSRMResponse failed in HandlePstatPostRequest"); } cJSON_Delete(postJson); return ehRet; @@ -297,7 +297,7 @@ OCEntityHandlerResult PstatEntityHandler(OCEntityHandlerFlag flag, // This method will handle REST request (GET/POST) for /oic/sec/pstat if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: @@ -332,7 +332,7 @@ OCStackResult CreatePstatResource() if (ret != OC_STACK_OK) { - OC_LOG (FATAL, TAG, "Unable to instantiate pstat resource"); + OIC_LOG (FATAL, TAG, "Unable to instantiate pstat resource"); DeInitPstatResource(); } return ret; diff --git a/resource/csdk/security/src/resourcemanager.c b/resource/csdk/security/src/resourcemanager.c index 19fb099..fe097e6 100644 --- a/resource/csdk/security/src/resourcemanager.c +++ b/resource/csdk/security/src/resourcemanager.c @@ -50,7 +50,7 @@ OCStackResult SendSRMResponse(const OCEntityHandlerRequest *ehRequest, OCEntityHandlerResult ehRet, const char *rspPayload) { - OC_LOG (DEBUG, TAG, "SRM sending SRM response"); + OIC_LOG (DEBUG, TAG, "SRM sending SRM response"); OCEntityHandlerResponse response = {.requestHandle = NULL}; if (ehRequest) { diff --git a/resource/csdk/security/src/secureresourcemanager.c b/resource/csdk/security/src/secureresourcemanager.c index a91bc53..555d900 100644 --- a/resource/csdk/security/src/secureresourcemanager.c +++ b/resource/csdk/security/src/secureresourcemanager.c @@ -73,7 +73,7 @@ static void SRMSendUnAuthorizedAccessresponse(PEContext_t *context) if(NULL == context || NULL == context->amsMgrContext->requestInfo) { - OC_LOG_V(ERROR, TAG, "%s : NULL Parameter(s)",__func__); + OIC_LOG_V(ERROR, TAG, "%s : NULL Parameter(s)",__func__); return; } @@ -84,26 +84,26 @@ static void SRMSendUnAuthorizedAccessresponse(PEContext_t *context) if (CA_STATUS_OK == CASendResponse(context->amsMgrContext->endpoint, &responseInfo)) { - OC_LOG(DEBUG, TAG, "Succeed in sending response to a unauthorized request!"); + OIC_LOG(DEBUG, TAG, "Succeed in sending response to a unauthorized request!"); } else { - OC_LOG(ERROR, TAG, "Failed in sending response to a unauthorized request!"); + OIC_LOG(ERROR, TAG, "Failed in sending response to a unauthorized request!"); } } void SRMSendResponse(SRMAccessResponse_t responseVal) { - OC_LOG(DEBUG, TAG, "Sending response to remote device"); + OIC_LOG(DEBUG, TAG, "Sending response to remote device"); if (IsAccessGranted(responseVal) && gRequestHandler) { - OC_LOG_V(INFO, TAG, "%s : Access granted. Passing Request to RI layer", __func__); + OIC_LOG_V(INFO, TAG, "%s : Access granted. Passing Request to RI layer", __func__); if (!g_policyEngineContext.amsMgrContext->endpoint || !g_policyEngineContext.amsMgrContext->requestInfo) { - OC_LOG_V(ERROR, TAG, "%s : Invalid arguments", __func__); + OIC_LOG_V(ERROR, TAG, "%s : Invalid arguments", __func__); SRMSendUnAuthorizedAccessresponse(&g_policyEngineContext); goto exit; } @@ -112,7 +112,7 @@ void SRMSendResponse(SRMAccessResponse_t responseVal) } else { - OC_LOG_V(INFO, TAG, "%s : ACCESS_DENIED.", __func__); + OIC_LOG_V(INFO, TAG, "%s : ACCESS_DENIED.", __func__); SRMSendUnAuthorizedAccessresponse(&g_policyEngineContext); } @@ -130,11 +130,11 @@ exit: */ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requestInfo) { - OC_LOG(DEBUG, TAG, "Received request from remote device"); + OIC_LOG(DEBUG, TAG, "Received request from remote device"); if (!endPoint || !requestInfo) { - OC_LOG(ERROR, TAG, "Invalid arguments"); + OIC_LOG(ERROR, TAG, "Invalid arguments"); return; } @@ -156,7 +156,7 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ } if (MAX_URI_LENGTH < position || 0 > position) { - OC_LOG(ERROR, TAG, "Incorrect URI length"); + OIC_LOG(ERROR, TAG, "Incorrect URI length"); return; } SRMAccessResponse_t response = ACCESS_DENIED; @@ -166,14 +166,14 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ //New request are only processed if the policy engine state is AWAITING_REQUEST. if(AWAITING_REQUEST == g_policyEngineContext.state) { - OC_LOG_V(DEBUG, TAG, "Processing request with uri, %s for method, %d", + OIC_LOG_V(DEBUG, TAG, "Processing request with uri, %s for method, %d", requestInfo->info.resourceUri, requestInfo->method); response = CheckPermission(&g_policyEngineContext, &subjectId, newUri, GetPermissionFromCAMethod_t(requestInfo->method)); } else { - OC_LOG_V(INFO, TAG, "PE state %d. Ignoring request with uri, %s for method, %d", + OIC_LOG_V(INFO, TAG, "PE state %d. Ignoring request with uri, %s for method, %d", g_policyEngineContext.state, requestInfo->info.resourceUri, requestInfo->method); } @@ -191,7 +191,7 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ if(ACCESS_WAITING_FOR_AMS == response) { - OC_LOG(INFO, TAG, "Sending slow response"); + OIC_LOG(INFO, TAG, "Sending slow response"); UpdateAmsMgrContext(&g_policyEngineContext, endPoint, requestInfo); responseInfo.result = CA_EMPTY; @@ -204,20 +204,20 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ * CA_UNAUTHORIZED_REQ or CA_FORBIDDEN_REQ depending * upon SRMAccessResponseReasonCode_t */ - OC_LOG(INFO, TAG, "Sending for regular response"); + OIC_LOG(INFO, TAG, "Sending for regular response"); responseInfo.result = CA_UNAUTHORIZED_REQ; } if (CA_STATUS_OK != CASendResponse(endPoint, &responseInfo)) { - OC_LOG(ERROR, TAG, "Failed in sending response to a unauthorized request!"); + OIC_LOG(ERROR, TAG, "Failed in sending response to a unauthorized request!"); } return; exit: responseInfo.result = CA_INTERNAL_SERVER_ERROR; if (CA_STATUS_OK != CASendResponse(endPoint, &responseInfo)) { - OC_LOG(ERROR, TAG, "Failed in sending response to a unauthorized request!"); + OIC_LOG(ERROR, TAG, "Failed in sending response to a unauthorized request!"); } } @@ -229,7 +229,7 @@ exit: */ void SRMResponseHandler(const CAEndpoint_t *endPoint, const CAResponseInfo_t *responseInfo) { - OC_LOG(DEBUG, TAG, "Received response from remote device"); + OIC_LOG(DEBUG, TAG, "Received response from remote device"); // isProvResponse flag is to check whether response is catered by provisioning APIs or not. // When token sent by CA response matches with token generated by provisioning request, @@ -257,7 +257,7 @@ void SRMResponseHandler(const CAEndpoint_t *endPoint, const CAResponseInfo_t *re */ void SRMErrorHandler(const CAEndpoint_t *endPoint, const CAErrorInfo_t *errorInfo) { - OC_LOG_V(INFO, TAG, "Received error from remote device with result, %d for request uri, %s", + OIC_LOG_V(INFO, TAG, "Received error from remote device with result, %d for request uri, %s", errorInfo->result, errorInfo->info.resourceUri); if (gErrorHandler) { @@ -279,10 +279,10 @@ OCStackResult SRMRegisterHandler(CARequestCallback reqHandler, CAResponseCallback respHandler, CAErrorCallback errHandler) { - OC_LOG(DEBUG, TAG, "SRMRegisterHandler !!"); + OIC_LOG(DEBUG, TAG, "SRMRegisterHandler !!"); if( !reqHandler || !respHandler || !errHandler) { - OC_LOG(ERROR, TAG, "Callback handlers are invalid"); + OIC_LOG(ERROR, TAG, "Callback handlers are invalid"); return OC_STACK_INVALID_PARAM; } gRequestHandler = reqHandler; @@ -307,10 +307,10 @@ OCStackResult SRMRegisterHandler(CARequestCallback reqHandler, */ OCStackResult SRMRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler) { - OC_LOG(DEBUG, TAG, "SRMRegisterPersistentStorageHandler !!"); + OIC_LOG(DEBUG, TAG, "SRMRegisterPersistentStorageHandler !!"); if(!persistentStorageHandler) { - OC_LOG(ERROR, TAG, "The persistent storage handler is invalid"); + OIC_LOG(ERROR, TAG, "The persistent storage handler is invalid"); return OC_STACK_INVALID_PARAM; } gPersistentStorageHandler = persistentStorageHandler; diff --git a/resource/csdk/security/src/srmutility.c b/resource/csdk/security/src/srmutility.c index af52938..1a745b8 100644 --- a/resource/csdk/security/src/srmutility.c +++ b/resource/csdk/security/src/srmutility.c @@ -37,7 +37,7 @@ */ void ParseQueryIterInit(unsigned char * query, OicParseQueryIter_t * parseIter) { - OC_LOG (INFO, TAG, "Initializing coap iterator"); + OIC_LOG (INFO, TAG, "Initializing coap iterator"); if((NULL == query) || (NULL == parseIter)) return; @@ -61,7 +61,7 @@ void ParseQueryIterInit(unsigned char * query, OicParseQueryIter_t * parseIter) */ OicParseQueryIter_t * GetNextQuery(OicParseQueryIter_t * parseIter) { - OC_LOG (INFO, TAG, "Getting Next Query"); + OIC_LOG (INFO, TAG, "Getting Next Query"); if(NULL == parseIter) return NULL; diff --git a/resource/csdk/security/src/svcresource.c b/resource/csdk/security/src/svcresource.c index 28a8c59..4456b38 100644 --- a/resource/csdk/security/src/svcresource.c +++ b/resource/csdk/security/src/svcresource.c @@ -239,7 +239,7 @@ static OCEntityHandlerResult HandleSVCGetRequest (const OCEntityHandlerRequest * OICFree(jsonStr); - OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); + OIC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -274,7 +274,7 @@ static OCEntityHandlerResult HandleSVCPostRequest (const OCEntityHandlerRequest // Send payload to request originator SendSRMResponse(ehRequest, ehRet, NULL); - OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); + OIC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -332,7 +332,7 @@ OCStackResult CreateSVCResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, "Unable to instantiate SVC resource"); + OIC_LOG (FATAL, TAG, "Unable to instantiate SVC resource"); DeInitSVCResource(); } return ret; @@ -343,7 +343,7 @@ OCStackResult InitSVCResource() { OCStackResult ret = OC_STACK_ERROR; - OC_LOG_V (DEBUG, TAG, "Begin %s ", __func__ ); + OIC_LOG_V (DEBUG, TAG, "Begin %s ", __func__ ); // Read SVC resource from PS char* jsonSVRDatabase = GetSVRDatabase(); @@ -363,7 +363,7 @@ OCStackResult InitSVCResource() DeInitSVCResource(); } - OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ret); + OIC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ret); return ret; } diff --git a/resource/csdk/security/unittest/credentialresource.cpp b/resource/csdk/security/unittest/credentialresource.cpp index 4c5b6b4..ee342ce 100644 --- a/resource/csdk/security/unittest/credentialresource.cpp +++ b/resource/csdk/security/unittest/credentialresource.cpp @@ -120,21 +120,21 @@ static void printCred(const OicSecCred_t * cred) const OicSecCred_t *credTmp1 = NULL; for(credTmp1 = cred; credTmp1; credTmp1 = credTmp1->next) { - OC_LOG_V(INFO, TAG, "\ncred->credId = %d", credTmp1->credId); - OC_LOG_V(INFO, TAG, "cred->subject.id = %s", credTmp1->subject.id); - OC_LOG_V(INFO, TAG, "cred->credType = %d", credTmp1->credType); + OIC_LOG_V(INFO, TAG, "\ncred->credId = %d", credTmp1->credId); + OIC_LOG_V(INFO, TAG, "cred->subject.id = %s", credTmp1->subject.id); + OIC_LOG_V(INFO, TAG, "cred->credType = %d", credTmp1->credType); if(credTmp1->privateData.data) { - OC_LOG_V(INFO, TAG, "cred->privateData.data = %s", credTmp1->privateData.data); + OIC_LOG_V(INFO, TAG, "cred->privateData.data = %s", credTmp1->privateData.data); } if(credTmp1->publicData.data) { - OC_LOG_V(INFO, TAG, "cred->publicData.data = %s", credTmp1->publicData.data); + OIC_LOG_V(INFO, TAG, "cred->publicData.data = %s", credTmp1->publicData.data); } - OC_LOG_V(INFO, TAG, "cred->ownersLen = %zu", credTmp1->ownersLen); + OIC_LOG_V(INFO, TAG, "cred->ownersLen = %zu", credTmp1->ownersLen); for(size_t i = 0; i < cred->ownersLen; i++) { - OC_LOG_V(INFO, TAG, "cred->owners[%zu].id = %s", i, credTmp1->owners[i].id); + OIC_LOG_V(INFO, TAG, "cred->owners[%zu].id = %s", i, credTmp1->owners[i].id); } } } @@ -246,7 +246,7 @@ TEST(BinToCredJSONTest, BinToCredJSONValidCred) json = BinToCredJSON(cred); - OC_LOG_V(INFO, TAG, "BinToCredJSON:%s\n", json); + OIC_LOG_V(INFO, TAG, "BinToCredJSON:%s\n", json); EXPECT_TRUE(json != NULL); DeleteCredList(cred); OICFree(json); diff --git a/resource/csdk/security/unittest/doxmresource.cpp b/resource/csdk/security/unittest/doxmresource.cpp index f2de1dd..1e15a37 100644 --- a/resource/csdk/security/unittest/doxmresource.cpp +++ b/resource/csdk/security/unittest/doxmresource.cpp @@ -165,7 +165,7 @@ TEST(BinToDoxmJSONTest, BinToDoxmJSONValidDoxm) OicSecDoxm_t * doxm = getBinDoxm(); char * json = BinToDoxmJSON(doxm); - OC_LOG_V(INFO, TAG, "BinToDoxmJSON:%s", json); + OIC_LOG_V(INFO, TAG, "BinToDoxmJSON:%s", json); EXPECT_TRUE(json != NULL); DeleteDoxmBinData(doxm); diff --git a/resource/csdk/security/unittest/iotvticalendartest.cpp b/resource/csdk/security/unittest/iotvticalendartest.cpp index 5fc0931..7a4c659 100755 --- a/resource/csdk/security/unittest/iotvticalendartest.cpp +++ b/resource/csdk/security/unittest/iotvticalendartest.cpp @@ -32,56 +32,56 @@ static void printPeriod(IotvtICalPeriod_t *period) return; } - OC_LOG_V(INFO, TAG, "period->startDateTime.tm_year = %d",period->startDateTime.tm_year); - OC_LOG_V(INFO, TAG, "period->startDateTime.tm_mon = %d",period->startDateTime.tm_mon); - OC_LOG_V(INFO, TAG, "period->startDateTime.tm_mday = %d",period->startDateTime.tm_mday); - OC_LOG_V(INFO, TAG, "period->startDateTime.tm_hour = %d",period->startDateTime.tm_hour); - OC_LOG_V(INFO, TAG, "period->startDateTime.tm_min = %d",period->startDateTime.tm_min); - OC_LOG_V(INFO, TAG, "period->startDateTime.tm_sec = %d",period->startDateTime.tm_sec); - - OC_LOG_V(INFO, TAG, "period->endDateTime.tm_year = %d",period->endDateTime.tm_year); - OC_LOG_V(INFO, TAG, "period->endDateTime.tm_mon = %d",period->endDateTime.tm_mon); - OC_LOG_V(INFO, TAG, "period->endDateTime.tm_mday = %d",period->endDateTime.tm_mday); - OC_LOG_V(INFO, TAG, "period->endDateTime.tm_hour = %d",period->endDateTime.tm_hour); - OC_LOG_V(INFO, TAG, "period->endDateTime.tm_min = %d",period->endDateTime.tm_min); - OC_LOG_V(INFO, TAG, "period->startDateTime.tm_sec = %d",period->endDateTime.tm_sec); + OIC_LOG_V(INFO, TAG, "period->startDateTime.tm_year = %d",period->startDateTime.tm_year); + OIC_LOG_V(INFO, TAG, "period->startDateTime.tm_mon = %d",period->startDateTime.tm_mon); + OIC_LOG_V(INFO, TAG, "period->startDateTime.tm_mday = %d",period->startDateTime.tm_mday); + OIC_LOG_V(INFO, TAG, "period->startDateTime.tm_hour = %d",period->startDateTime.tm_hour); + OIC_LOG_V(INFO, TAG, "period->startDateTime.tm_min = %d",period->startDateTime.tm_min); + OIC_LOG_V(INFO, TAG, "period->startDateTime.tm_sec = %d",period->startDateTime.tm_sec); + + OIC_LOG_V(INFO, TAG, "period->endDateTime.tm_year = %d",period->endDateTime.tm_year); + OIC_LOG_V(INFO, TAG, "period->endDateTime.tm_mon = %d",period->endDateTime.tm_mon); + OIC_LOG_V(INFO, TAG, "period->endDateTime.tm_mday = %d",period->endDateTime.tm_mday); + OIC_LOG_V(INFO, TAG, "period->endDateTime.tm_hour = %d",period->endDateTime.tm_hour); + OIC_LOG_V(INFO, TAG, "period->endDateTime.tm_min = %d",period->endDateTime.tm_min); + OIC_LOG_V(INFO, TAG, "period->startDateTime.tm_sec = %d",period->endDateTime.tm_sec); } static void printRecur(IotvtICalRecur_t *recur) { - OC_LOG_V(INFO, TAG, "recur->freq = %d", recur->freq); - OC_LOG_V(INFO, TAG, "recur->until.tm_year = %d", recur->until.tm_year); - OC_LOG_V(INFO, TAG, "recur->until.tm_mon = %d", recur->until.tm_mon); - OC_LOG_V(INFO, TAG, "recur->until.tm_mday = %d", recur->until.tm_mday); + OIC_LOG_V(INFO, TAG, "recur->freq = %d", recur->freq); + OIC_LOG_V(INFO, TAG, "recur->until.tm_year = %d", recur->until.tm_year); + OIC_LOG_V(INFO, TAG, "recur->until.tm_mon = %d", recur->until.tm_mon); + OIC_LOG_V(INFO, TAG, "recur->until.tm_mday = %d", recur->until.tm_mday); if(recur->byDay & SUNDAY) { - OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Sunday"); + OIC_LOG_V(INFO, TAG, "recur->byDay = %s", "Sunday"); } if(recur->byDay & MONDAY) { - OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Monday"); + OIC_LOG_V(INFO, TAG, "recur->byDay = %s", "Monday"); } if(recur->byDay & TUESDAY) { - OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Tuesday"); + OIC_LOG_V(INFO, TAG, "recur->byDay = %s", "Tuesday"); } if(recur->byDay & WEDNESDAY) { - OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Wednesday"); + OIC_LOG_V(INFO, TAG, "recur->byDay = %s", "Wednesday"); } if(recur->byDay & THURSDAY) { - OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Thursday"); + OIC_LOG_V(INFO, TAG, "recur->byDay = %s", "Thursday"); } if(recur->byDay & FRIDAY) { - OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Friday"); + OIC_LOG_V(INFO, TAG, "recur->byDay = %s", "Friday"); } if(recur->byDay & SATURDAY) { - OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Saturday"); + OIC_LOG_V(INFO, TAG, "recur->byDay = %s", "Saturday"); } } @@ -110,8 +110,8 @@ static void checkValidityOfRequest(char *recurStr, char *periodStr,int startTime tzset(); localtime_r(&rt, &t2); - OC_LOG_V(INFO, TAG, "t1 = %02d:%02d:%02d", t1.tm_hour, t1.tm_min, t1.tm_sec ); - OC_LOG_V(INFO, TAG, "t2 = %02d:%02d:%02d", t2.tm_hour, t2.tm_min, t2.tm_sec ); + OIC_LOG_V(INFO, TAG, "t1 = %02d:%02d:%02d", t1.tm_hour, t1.tm_min, t1.tm_sec ); + OIC_LOG_V(INFO, TAG, "t2 = %02d:%02d:%02d", t2.tm_hour, t2.tm_min, t2.tm_sec ); }while(t1.tm_hour != t2.tm_hour); if(byDay > 0) -- 2.7.4