uint8_t numOptions,
uint8_t observeFlag)
{
- if(!caHdrOpt || !ocHdrOpt)
+ if(!caHdrOpt)
{
return OC_STACK_INVALID_PARAM;
}
+ if (numOptions > 0 && !ocHdrOpt)
+ {
+ OC_LOG (INFO, TAG, "options are NULL though number is non zero");
+ return OC_STACK_INVALID_PARAM;
+ }
+
CAHeaderOption_t *tmpHdrOpt = NULL;
tmpHdrOpt = (CAHeaderOption_t *) OICCalloc ((numOptions+1), sizeof(CAHeaderOption_t));
if(!options || !numOptions)
{
- return OC_STACK_INVALID_PARAM;
+ OC_LOG (INFO, TAG, "No options present");
+ return OC_STACK_OK;
}
- *observationOption = OC_OBSERVE_NO_OPTION;
-
for(uint8_t i = 0; i < *numOptions; i++)
{
if(options[i].protocolID == CA_COAP_ID &&
// copy vendor specific header options
uint8_t tempNum = (requestInfo->info.numOptions);
+
+ // Assume no observation requested and it is a pure GET.
+ // If obs registration/de-registration requested it'll be fetched from the
+ // options in GetObserveHeaderOption()
+ serverRequest.observationOption = OC_OBSERVE_NO_OPTION;
+
GetObserveHeaderOption(&serverRequest.observationOption, requestInfo->info.options, &tempNum);
if (requestInfo->info.numOptions > MAX_HEADER_OPTIONS)
{