Logs added for confirmation callbacks
authorJongmin Choi <jminl.choi@samsung.com>
Fri, 6 Jan 2017 06:43:35 +0000 (15:43 +0900)
committerRandeep Singh <randeep.s@samsung.com>
Wed, 15 Feb 2017 11:46:07 +0000 (11:46 +0000)
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 <jminl.choi@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16189
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17213

resource/csdk/security/src/oxmverifycommon.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 169fb65..6660f17
@@ -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;
 }