Log invalid request in HandleCARequests
authorSakthivel Samidurai <sakthivel.samidurai@intel.com>
Fri, 23 Jan 2015 19:07:18 +0000 (16:07 -0300)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Mon, 26 Jan 2015 23:16:00 +0000 (23:16 +0000)
Log a message when the number of header-options is incorrect and
the client recives any request in the HandleCARequests method.

Change-Id: I03e6522b4c306eebd89f581d47ed656d34923219
Signed-off-by: Sakthivel Samidurai <sakthivel.samidurai@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/239
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sashi Penta <sashi.kumar.penta@intel.com>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
resource/csdk/stack/src/ocstack.c

index 9f66cf8..8a71307 100644 (file)
@@ -618,7 +618,6 @@ void HandleCARequests(const CARemoteEndpoint_t* endPoint, const CARequestInfo_t*
 {
     OC_LOG(INFO, TAG, PCF("Enter HandleCARequests"));
 
-#if 1
     if(myStackMode == OC_CLIENT)
     {
         //TODO: should the client be responding to requests?
@@ -725,10 +724,12 @@ void HandleCARequests(const CARemoteEndpoint_t* endPoint, const CARequestInfo_t*
     // copy vendor specific header options
     // TODO-CA: CA is including non-vendor header options as well, like observe.
     // Need to filter those out
-    GetObserveHeaderOption(&serverRequest.observationOption, requestInfo->info.options, &(requestInfo->info.numOptions));
+    GetObserveHeaderOption(&serverRequest.observationOption,
+            requestInfo->info.options, &(requestInfo->info.numOptions));
     if (requestInfo->info.numOptions > MAX_HEADER_OPTIONS)
     {
-        // TODO-CA: Need to send an error indicating the num of options is incorrect
+        OC_LOG(ERROR, TAG,
+                PCF("The request info numOptions is greater than MAX_HEADER_OPTIONS"));
         return;
     }
     serverRequest.numRcvdVendorSpecificHeaderOptions = requestInfo->info.numOptions;
@@ -740,9 +741,8 @@ void HandleCARequests(const CARemoteEndpoint_t* endPoint, const CARequestInfo_t*
 
     if(HandleStackRequests (&serverRequest) != OC_STACK_OK)
     {
-        OC_LOG(INFO, TAG, PCF("HandleStackRequests failed"));
+        OC_LOG(ERROR, TAG, PCF("HandleStackRequests failed"));
     }
-#endif
 
     OC_LOG(INFO, TAG, PCF("Exit HandleCARequests"));
 }