CAEndpoint_t ep;
strncpy(ep.addr, srcIPAddress, MAX_ADDR_STR_SIZE_CA);
ep.port = srcPort;
- ep.flags = (CATransportFlags_t)CA_IPV4 | CA_IPV6;
+ ep.flags = (CATransportFlags_t)CA_IPV4;
ep.adapter = CA_ADAPTER_IP;
if (info->endpoint.flags & CA_SECURE)
const char *format;
- if (endpoint->flags & CA_IPV6)
+ if ((endpoint->flags & CA_IPV6) && !(endpoint->flags & CA_IPV4))
{
format = "coap://[%s]:%u%s";
}
}
else
{
- snprintf (presenceUri, MAX_URI_LENGTH, "coap://[%s]:%u%s", OC_MULTICAST_IP,
- OC_MULTICAST_PORT, OC_RSRVD_PRESENCE_URI);
+ CAEndpoint_t endpointMulticast;
+ endpointMulticast.flags = endpoint->flags;
+ OICStrcpy(endpointMulticast.addr, sizeof(endpointMulticast.addr), OC_MULTICAST_IP);
+ endpointMulticast.port = OC_MULTICAST_PORT;
+
+ uriLen = FormCanonicalPresenceUri(&endpointMulticast, OC_RSRVD_PRESENCE_URI, presenceUri);
+
+ if (uriLen < 0 || uriLen >= sizeof (presenceUri))
+ {
+ return OC_STACK_INVALID_URI;
+ }
+
cbNode = GetClientCB(NULL, 0, NULL, presenceUri);
if (cbNode)
{