NEWSOCKET(AF_INET6, u6s)
NEWSOCKET(AF_INET6, m6)
NEWSOCKET(AF_INET6, m6s)
+ OIC_LOG_V(INFO, TAG, "IPv6 unicast port: %u", caglobals.ip.u6.port);
}
if (caglobals.ip.ipv4enabled)
{
NEWSOCKET(AF_INET, u4s)
NEWSOCKET(AF_INET, m4)
NEWSOCKET(AF_INET, m4s)
+ OIC_LOG_V(INFO, TAG, "IPv4 unicast port: %u", caglobals.ip.u4.port);
}
OIC_LOG_V(DEBUG, TAG,
}
else
{
+ if (!endpoint->port) // unicast discovery
+ {
+ endpoint->port = isSecure ? CA_SECURE_COAP : CA_COAP;
+ }
+
int fd;
- if (endpoint->flags & CA_IPV6)
+ if (caglobals.ip.ipv6enabled && (endpoint->flags & CA_IPV6))
{
fd = isSecure ? caglobals.ip.u6s.fd : caglobals.ip.u6.fd;
#ifndef __WITH_DTLS__
#endif
sendData(fd, endpoint, data, datalen, "unicast", "ipv6");
}
- if (endpoint->flags & CA_IPV4)
+ if (caglobals.ip.ipv4enabled && (endpoint->flags & CA_IPV4))
{
fd = isSecure ? caglobals.ip.u4s.fd : caglobals.ip.u4.fd;
#ifndef __WITH_DTLS__
{
return OC_STACK_INVALID_URI;
}
- // use standard multicast port
+ // collect port, if any
if (colon && colon < slash)
{
for (colon++; colon < slash; colon++)
break;
case OC_REST_DISCOVER:
qos = OC_LOW_QOS;
- if (!destination && !devAddr)
+ if (destination || devAddr)
+ {
+ requestInfo.isMulticast = false;
+ }
+ else
{
destination = &tmpDevAddr;
+ requestInfo.isMulticast = true;
}
// CA_DISCOVER will become GET and isMulticast
requestInfo.method = CA_GET;
- requestInfo.isMulticast = true;
break;
#ifdef WITH_PRESENCE
case OC_REST_PRESENCE:
}
OCStackResult InProcClientWrapper::ListenForResource(
- const std::string& serviceUrl, // unused
+ const std::string& serviceUrl,
const std::string& resourceType,
OCConnectivityType connectivityType,
FindCallback& callback, QualityOfService QoS)
}
OCStackResult result;
+ ostringstream resourceUri;
+ resourceUri << serviceUrl << resourceType;
ClientCallbackContext::ListenContext* context =
new ClientCallbackContext::ListenContext(callback, shared_from_this());
{
std::lock_guard<std::recursive_mutex> lock(*cLock);
result = OCDoResource(nullptr, OC_REST_DISCOVER,
- resourceType.c_str(),
+ resourceUri.str().c_str(),
nullptr, nullptr, connectivityType,
static_cast<OCQualityOfService>(QoS),
&cbdata,
}
OCStackResult InProcClientWrapper::ListenForDevice(
- const std::string& serviceUrl, // unused
+ const std::string& serviceUrl,
const std::string& deviceURI,
OCConnectivityType connectivityType,
FindDeviceCallback& callback,
return OC_STACK_INVALID_PARAM;
}
OCStackResult result;
+ ostringstream deviceUri;
+ deviceUri << serviceUrl << deviceURI;
ClientCallbackContext::DeviceListenContext* context =
new ClientCallbackContext::DeviceListenContext(callback, shared_from_this());
{
std::lock_guard<std::recursive_mutex> lock(*cLock);
result = OCDoResource(nullptr, OC_REST_DISCOVER,
- deviceURI.c_str(),
+ deviceUri.str().c_str(),
nullptr, nullptr, connectivityType,
static_cast<OCQualityOfService>(QoS),
&cbdata,