Commit b6f46e32 authored by Kishen Maloor's avatar Kishen Maloor

Merge branch 'origin/master' into fargo

Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parents c3e52ee3 e47f40d0
Pipeline #281 passed with stage
in 51 seconds
......@@ -76,8 +76,9 @@ oc_blockwise_free_buffer(oc_list_t list, struct oc_memb *pool,
return;
}
if (oc_string_len(buffer->uri_query))
if (oc_string_len(buffer->uri_query) > 0) {
oc_free_string(&buffer->uri_query);
}
oc_free_string(&buffer->href);
oc_list_remove(list, buffer);
#ifdef OC_DYNAMIC_ALLOCATION
......
......@@ -682,7 +682,7 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
request_obj.origin = endpoint;
/* Initialize OCF interface selector. */
oc_interface_mask_t iface_mask = 0;
oc_interface_mask_t iface_query = 0, iface_mask = 0;
/* Obtain request uri from the CoAP packet. */
const char *uri_path;
......@@ -701,7 +701,7 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
int if_len =
oc_ri_get_query_value(uri_query, (int)uri_query_len, "if", &iface);
if (if_len != -1) {
iface_mask |= oc_ri_get_interface_mask(iface, (size_t)if_len);
iface_query |= oc_ri_get_interface_mask(iface, (size_t)if_len);
}
}
......@@ -792,6 +792,7 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
if (cur_resource) {
/* If there was no interface selection, pick the "default interface". */
iface_mask = iface_query;
if (iface_mask == 0)
iface_mask = cur_resource->default_interface;
......@@ -949,10 +950,10 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
if (observe == 0) {
#ifdef OC_BLOCK_WISE
if (coap_observe_handler(request, response, cur_resource, block2_size,
endpoint, iface_mask) >= 0) {
endpoint, iface_query) >= 0) {
#else /* OC_BLOCK_WISE */
if (coap_observe_handler(request, response, cur_resource, endpoint,
iface_mask) >= 0) {
iface_query) >= 0) {
#endif /* !OC_BLOCK_WISE */
/* If the resource is marked as periodic observable it means
* it must be polled internally for updates (which would lead to
......@@ -983,7 +984,7 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
}
#endif /* OC_SECURITY */
if (set_observe_option) {
if (iface_mask == OC_IF_B) {
if (iface_query == OC_IF_B) {
links = (oc_link_t *)oc_list_head(collection->links);
while (links) {
if (links->resource &&
......@@ -1011,10 +1012,10 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
else if (observe == 1) {
#ifdef OC_BLOCK_WISE
if (coap_observe_handler(request, response, cur_resource, block2_size,
endpoint, iface_mask) > 0) {
endpoint, iface_query) > 0) {
#else /* OC_BLOCK_WISE */
if (coap_observe_handler(request, response, cur_resource, endpoint,
iface_mask) > 0) {
iface_query) > 0) {
#endif /* !OC_BLOCK_WISE */
if (cur_resource->properties & OC_PERIODIC) {
remove_periodic_observe_callback(cur_resource);
......
{
"schemes":[
"http"
],
"swagger":"2.0",
"consumes":[
"application/json"
],
"paths":{
"/platform?if=oic.if.ll":{
"get":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/slinks"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface-all40"
}
],
"description":""
}
},
"/temp":{
"post":{
"responses":{
"403":{
"schema":{
"$ref":"#/definitions/Temperature"
},
"description":""
},
"200":{
"schema":{
"$ref":"#/definitions/Temperature"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface"
},
{
"schema":{
"$ref":"#/definitions/Temperature"
},
"in":"body",
"required":true,
"name":"body"
}
],
"description":""
},
"get":{
"responses":{
"403":{
"schema":{
"$ref":"#/definitions/Temperature"
},
"description":""
},
"200":{
"schema":{
"$ref":"#/definitions/Temperature"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface"
},
{
"$ref":"#/parameters/unit"
}
],
"description":""
}
},
"/switch":{
"post":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/BinarySwitch"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface10"
},
{
"schema":{
"$ref":"#/definitions/BinarySwitch"
},
"in":"body",
"required":true,
"name":"body"
}
],
"description":""
},
"get":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/BinarySwitch"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface10"
}
],
"description":""
}
},
"/platform?if=oic.if.b":{
"post":{
"responses":{
"403":{
"schema":{
"$ref":"#/definitions/sbatch-retrieve"
},
"description":""
},
"200":{
"schema":{
"$ref":"#/definitions/sbatch-retrieve"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface-update"
},
{
"schema":{
"$ref":"#/definitions/sbatch-update"
},
"in":"body",
"required":true,
"name":"body"
}
],
"description":""
},
"get":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/sbatch-retrieve"
},
"description":""
},
"404":{
"schema":{
"$ref":"#/definitions/sbatch-retrieve"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface-all40"
}
],
"description":""
}
},
"/oic/p":{
"get":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/Platform"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface30"
}
],
"description":""
}
},
"/oic/mnt":{
"post":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/mnt"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface-rw"
},
{
"schema":{
"$ref":"#/definitions/mnt-update"
},
"in":"body",
"required":true,
"name":"body"
}
],
"description":""
},
"get":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/mnt"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface-all"
}
],
"description":""
}
},
"/platform?if=oic.if.baseline":{
"post":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/sbaseline"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface-update"
},
{
"schema":{
"$ref":"#/definitions/sbaseline-update"
},
"in":"body",
"required":true,
"name":"body"
}
],
"description":""
},
"get":{
"responses":{
"200":{
"schema":{
"$ref":"#/definitions/sbaseline"
},
"description":""
}
},
"parameters":[
{
"$ref":"#/parameters/interface-all40"
}
],
"description":""
}
}
},
"definitions":{
"sbatch-update":{
"minItems":1,
"items":{
"required":[
"href",
"rep"
],
"properties":{
"href":{
"format":"uri",
"type":"string",
"maxLength":256,
"description":""
},
"rep":{
"type":"object",
"anyOf":[
{
"$ref":"#/definitions/BinarySwitch"
}
]
}
},
"type":"object",
"additionalProperties":true,
"description":""
},
"type":"array",
"title":"Collection Batch Update Format"
},
"BinarySwitch":{
"properties":{
"rt":{
"minItems":1,
"items":{
"enum":[
"oic.r.switch.binary"
],
"type":"string",
"maxLength":64
},
"description":"",
"uniqueItems":true,
"readOnly":true,
"default":[
"oic.r.switch.binary"
],
"type":"array"
},
"if":{
"minItems":2,
"items":{
"enum":[
"oic.if.a",
"oic.if.baseline"
],
"type":"string"
},
"description":"",
"uniqueItems":true,
"readOnly":true,
"type":"array"
},
"value":{
"type":"boolean",
"description":""
},
"tag-pos-desc":{
"description":"Descriptive relative position of the Resource",
"type":"string",
"enum":[
"unknown",
"top",
"bottom",
"left",
"right",
"centre",
"topleft",
"bottomleft",
"centreleft",
"centreright",
"bottomright",
"topright",
"topcentre",
"bottomcentre"
],
"readOnly":true
},
"tag-func-desc":{
"readOnly":true,
"type":"string",
"description":""
},
"tag-pos-rel":{
"type":"array",
"readOnly":true,
"description":"Relative position; against a known [0,0,0] point.",
"minItems":3,
"maxItems":3,
"items":{
"type":"number",
"minimum":-1,
"maximum":1
}
}
},
"required":[
"value"
],
"type":"object"
},
"sbaseline-update":{
"additionalProperties":true
},
"sbaseline":{
"properties":{
"rt":{
"minItems":1,
"items":{
"enum":[
"oic.wk.col"
],
"type":"string",
"maxLength":64
},
"description":"",
"uniqueItems":true,
"readOnly":true,
"default":[
"oic.wk.col"
],
"type":"array"
},
"rts-m":{
"minItems":1,
"items":{
"type":"string",
"maxLength":64
},
"description":"",
"uniqueItems":true,
"readOnly":true,
"type":"array"
},
"links":{
"items":{
"properties":{
"tag-pos-desc":{
"description":"Descriptive relative position of the Resource",
"type":"string",
"enum":[
"unknown",
"top",
"bottom",
"left",
"right",
"centre",
"topleft",
"bottomleft",
"centreleft",
"centreright",
"bottomright",
"topright",
"topcentre",
"bottomcentre"
],
"readOnly":true
},
"anchor":{
"format":"uri",
"type":"string",
"maxLength":256,
"description":""
},
"p":{
"properties":{
"bm":{
"type":"integer",
"description":""
}
},
"type":"object",
"required":[
"bm"
],
"description":""
},
"tag-pos-rel":{
"minItems":3,
"items":{
"minimum":-1,
"maximum":1,
"type":"number"
},
"description":"",
"readOnly":true,
"maxItems":3,
"type":"array"
},
"title":{
"type":"string",
"maxLength":64,
"description":""
},
"tag-func-desc":{
"readOnly":true,
"type":"string",
"description":""
},
"if":{
"minItems":1,
"items":{
"enum":[
"oic.if.baseline",
"oic.if.ll",
"oic.if.b",
"oic.if.rw",
"oic.if.r",
"oic.if.a",
"oic.if.s"
],
"type":"string",
"maxLength":64
},
"description":"",
"uniqueItems":true,
"readOnly":true,
"type":"array"
},
"rel":{
"minItems":1,
"items":{
"type":"string",
"maxLength":64
},
"type":"array",
"default":[
"hosts"
],
"description":""
},
"type":{
"minItems":1,
"items":{
"type":"string",
"maxLength":64
},
"type":"array",
"default":"application/vnd.ocf+cbor",
"description":""
},
"rt":{
"minItems":1,
"items":{
"type":"string",
"maxLength":64
},
"description":"",
"uniqueItems":true,
"readOnly":true,
"type":"array"
},
"href":{
"format":"uri",
"type":"string",
"maxLength":256,
"description":""
},
"eps":{
"items":{
"properties":{
"ep":{
"format":"uri",
"type":"string",
"description":""
},
"pri":{
"minimum":1,
"type":"integer",
"description":""
}
},
"type":"object"
},
"type":"array",
"description":""
},