if (!queue || !*queue)
return 0;
+ debug("*** looking for transaction %u == %u\n", id, (*queue)->id);
/* replace queue head if PDU's time is less than head's time */
-
if (id == (*queue)->id) { /* found transaction */
*node = *queue;
*queue = (*queue)->next;
#define MAX_URI_QUERY_BUF_SIZE ((MAX_URI_LENGTH) >= (MAX_QUERY_LENGTH) ?\
(MAX_URI_LENGTH) : (MAX_QUERY_LENGTH))
+#define COAP_WK_IPAddr_0 (224)
+#define COAP_WK_IPAddr_1 (0)
+#define COAP_WK_IPAddr_2 (1)
+#define COAP_WK_IPAddr_3 (187)
+
// checks if optionID is within vendor specific range
OCStackResult isVendorSpecific(uint16_t optionID);
uint8_t OCToCoAPResponseCode(OCStackResult result);
//Convert OCQualityOfService to coap NON vs CON
-uint8_t OCToCoAPQoS(OCQualityOfService qos);
+uint8_t OCToCoAPQoS(OCQualityOfService qos, uint8_t * ipAddr);
// Convert CoAP code to OCStack code
OCStackResult CoAPToOCResponseCode(uint8_t coapCode);
// Private Variables
//=============================================================================
-static uint8_t coapWKIpAddr[] = { 224, 0, 1, 187 };
static coap_context_t *gCoAPCtx = NULL;
//=============================================================================
// To allow presence notification work we need to init socket gCoAPCtx->sockfd_wellknown
// for servers as well as clients
- OCBuildIPv4Address(coapWKIpAddr[0], coapWKIpAddr[1], coapWKIpAddr[2],
- coapWKIpAddr[3], COAP_DEFAULT_PORT, &mcastAddr);
+ OCBuildIPv4Address(COAP_WK_IPAddr_0, COAP_WK_IPAddr_1, COAP_WK_IPAddr_2,
+ COAP_WK_IPAddr_3, COAP_DEFAULT_PORT, &mcastAddr);
VERIFY_SUCCESS(
coap_join_wellknown_group(gCoAPCtx,
(coap_address_t* )&mcastAddr), 0);
OC_LOG_V(DEBUG, TAG, "secure uri %d", uri.secure);
}
- coapMsgType = OCToCoAPQoS(qos);
+ coapMsgType = OCToCoAPQoS(qos, ipAddr);
// Decide method type
switch (method) {
return ret;
}
-uint8_t OCToCoAPQoS(OCQualityOfService qos)
+uint8_t OCToCoAPQoS(OCQualityOfService qos, uint8_t * ipAddr)
{
+ if(ipAddr[0] == COAP_WK_IPAddr_0 && ipAddr[1] == COAP_WK_IPAddr_1 &&
+ ipAddr[2] == COAP_WK_IPAddr_2 && ipAddr[3] == COAP_WK_IPAddr_3)
+ {
+ return COAP_MESSAGE_NON;
+ }
switch (qos)
{
case OC_HIGH_QOS:
* @param requiredUri - URI of the resource to interact with
* @param referenceUri - URI of the reference resource
* @param request - JSON encoded request
- * @param qos - quality of service
+ * @param qos - quality of service. Note that if this API is called on a uri with
+ * the well-known multicast IP address, the qos will be forced to
+ * OC_LOW_QOS
+ * since it is impractical to send other QOS levels on such addresses.
* @param clientApplicationCB- asynchronous callback function that is invoked
* by the stack when discovery or resource interaction is complete
* @param options - The address of an array containing the vendor specific