From 6a5134ae7be1c432be09e96ba5e7c3ca4b2e3eba Mon Sep 17 00:00:00 2001 From: Jongmin Choi Date: Fri, 6 Jan 2017 15:43:35 +0900 Subject: [PATCH] Logs added for confirmation callbacks Logs added for confirmation callbacks Patch #1: initial upload Patch #2: Additional logs added Patch #3: Rebased [Philippe Coval] Conflicts: resource/csdk/security/provisioning/src/ownershiptransfermanager.c Change-Id: I0b42eeaccb21c9b11d1c8effecd8797ee80c2929 Signed-off-by: Jongmin Choi Reviewed-on: https://gerrit.iotivity.org/gerrit/16189 Tested-by: jenkins-iotivity Reviewed-by: Randeep Singh Signed-off-by: Philippe Coval Reviewed-on: https://gerrit.iotivity.org/gerrit/17213 --- resource/csdk/security/src/oxmverifycommon.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) mode change 100644 => 100755 resource/csdk/security/src/oxmverifycommon.c diff --git a/resource/csdk/security/src/oxmverifycommon.c b/resource/csdk/security/src/oxmverifycommon.c old mode 100644 new mode 100755 index 169fb65..6660f17 --- a/resource/csdk/security/src/oxmverifycommon.c +++ b/resource/csdk/security/src/oxmverifycommon.c @@ -35,6 +35,7 @@ static UserConfirmContext_t gUserConfirmContext = { .callback = NULL, .context = void SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB) { + OIC_LOG(DEBUG, TAG, "IN SetDisplayNumCB"); if (NULL == displayNumCB) { OIC_LOG(ERROR, TAG, "Failed to set callback for displaying mutualVerifNum"); @@ -42,18 +43,22 @@ void SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB) } gDisplayNumContext.callback = displayNumCB; gDisplayNumContext.context = ptr; + OIC_LOG(DEBUG, TAG, "OUT SetDisplayNumCB"); } void* UnsetDisplayNumCB() { + OIC_LOG(DEBUG, TAG, "IN UnsetDisplayNumCB"); void *prevctx = gDisplayNumContext.context; gDisplayNumContext.callback = NULL; gDisplayNumContext.context= NULL; + OIC_LOG(DEBUG, TAG, "OUT UnsetDisplayNumCB"); return prevctx; } void SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB) { + OIC_LOG(DEBUG, TAG, "IN SetUserConfirmCB"); if (NULL == userConfirmCB) { OIC_LOG(ERROR, TAG, "Failed to set callback to confirm mutualVerifNum"); @@ -61,24 +66,32 @@ void SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB) } gUserConfirmContext.callback = userConfirmCB; gUserConfirmContext.context = ptr; + OIC_LOG(DEBUG, TAG, "OUT SetUserConfirmCB"); } void* UnsetUserConfirmCB() { + OIC_LOG(DEBUG, TAG, "IN UnsetUserConfirmCB"); void *prevctx = gUserConfirmContext.context; gUserConfirmContext.callback = NULL; gUserConfirmContext.context = NULL; + OIC_LOG(DEBUG, TAG, "OUT UnsetUserConfirmCB"); return prevctx; } void SetVerifyOption(VerifyOptionBitmask_t verifyOption) { + OIC_LOG(DEBUG, TAG, "IN SetVerifyOption"); gVerifyOption = verifyOption; + OIC_LOG_V(DEBUG, TAG, "VerifyOption set to %d", (int) gVerifyOption); + OIC_LOG(DEBUG, TAG, "OUT SetVerifyOption"); } OCStackResult VerifyOwnershipTransfer(uint8_t mutualVerifNum [MUTUAL_VERIF_NUM_LEN], VerifyOptionBitmask_t verifyOption) { + OIC_LOG(DEBUG, TAG, "IN VerifyOwnershipTransfer"); + OIC_LOG_V(DEBUG, TAG, "gVerifyOption: %d", (int) gVerifyOption); verifyOption = (VerifyOptionBitmask_t)(verifyOption & gVerifyOption); if (verifyOption & DISPLAY_NUM) { @@ -87,6 +100,7 @@ OCStackResult VerifyOwnershipTransfer(uint8_t mutualVerifNum [MUTUAL_VERIF_NUM_L OIC_LOG(ERROR, TAG, "Callback for displaying verification PIN not registered"); return OC_STACK_ERROR; } + OIC_LOG(DEBUG, TAG, "calling displayNumCallback"); if (OC_STACK_OK != gDisplayNumContext.callback(gDisplayNumContext.context, mutualVerifNum)) { OIC_LOG(ERROR, TAG, "Failed to display verification PIN"); @@ -100,11 +114,13 @@ OCStackResult VerifyOwnershipTransfer(uint8_t mutualVerifNum [MUTUAL_VERIF_NUM_L OIC_LOG(ERROR, TAG, "Callback to get user confirmation not registered"); return OC_STACK_ERROR; } + OIC_LOG(DEBUG, TAG, "calling userConfirmCallback"); if (OC_STACK_OK != gUserConfirmContext.callback(gUserConfirmContext.context)) { OIC_LOG(ERROR, TAG, "Failed to get user confirmation"); return OC_STACK_USER_DENIED_REQ; } } + OIC_LOG(DEBUG, TAG, "OUT VerifyOwnershipTransfer"); return OC_STACK_OK; } -- 2.7.4