Commit bfa83c91 authored by Sachin Agrawal's avatar Sachin Agrawal Committed by Erich Keane

Improved OIC Virtual Resource definitions (IOT-603)

There were multiple instances of same virtual resource strings
within C stack. This was a cause of 'many' recent un-intended bugs
in the Ioptivity stack. Updated octypes public interface to publish
'reserved' virtual resources and those can be used by applications.
Also updated associated sample applications.

Change-Id: I587727a63dace0086cc27b994bdf238ad203daa4
Signed-off-by: default avatarSachin Agrawal <sachin.agrawal@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1620Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
parent 99c5dcda
...@@ -39,7 +39,7 @@ void MiddleClient::findResources() ...@@ -39,7 +39,7 @@ void MiddleClient::findResources()
{ {
m_resourceMap.clear(); m_resourceMap.clear();
OC::OCPlatform::findResource("", OC_WELL_KNOWN_QUERY, CT_DEFAULT, m_findCB); OC::OCPlatform::findResource("", OC_RSRVD_WELL_KNOWN_URI, CT_DEFAULT, m_findCB);
} }
void MiddleClient::foundOCResource(shared_ptr<OCResource> resource) void MiddleClient::foundOCResource(shared_ptr<OCResource> resource)
......
...@@ -42,7 +42,7 @@ void IoTClient::initializePlatform() ...@@ -42,7 +42,7 @@ void IoTClient::initializePlatform()
void IoTClient::findResource() void IoTClient::findResource()
{ {
string coap_multicast_discovery = string(OC_MULTICAST_DISCOVERY_URI "?if=" EDISON_RESOURCE_INTERFACE); string coap_multicast_discovery = string(OC_RSRVD_WELL_KNOWN_URI "?if=" EDISON_RESOURCE_INTERFACE);
OCPlatform::findResource("", coap_multicast_discovery.c_str(), CT_DEFAULT, m_resourceDiscoveryCallback, OCPlatform::findResource("", coap_multicast_discovery.c_str(), CT_DEFAULT, m_resourceDiscoveryCallback,
OC::QualityOfService::LowQos); OC::QualityOfService::LowQos);
} }
......
...@@ -26,12 +26,6 @@ ...@@ -26,12 +26,6 @@
extern const char * SVR_DB_FILE_NAME; extern const char * SVR_DB_FILE_NAME;
extern const char * OIC_MI_DEF; extern const char * OIC_MI_DEF;
extern const char * OIC_RSRC_CORE_URI;
extern const char * OIC_RSRC_CORE_D_URI;
extern const char * OIC_RSRC_CORE_P_URI;
extern const char * OIC_RSRC_PRESENCE_URI;
extern const char * OIC_RSRC_TYPES_D_URI;
//ACL //ACL
extern const char * OIC_RSRC_TYPE_SEC_ACL; extern const char * OIC_RSRC_TYPE_SEC_ACL;
extern const char * OIC_RSRC_ACL_URI; extern const char * OIC_RSRC_ACL_URI;
......
...@@ -416,11 +416,13 @@ OCStackResult GetDefaultACL(OicSecAcl_t** defaultAcl) ...@@ -416,11 +416,13 @@ OCStackResult GetDefaultACL(OicSecAcl_t** defaultAcl)
*/ */
const char *rsrcs[] = { const char *rsrcs[] = {
OIC_RSRC_CORE_URI, OC_RSRVD_WELL_KNOWN_URI,
OIC_RSRC_CORE_D_URI, OC_RSRVD_DEVICE_URI,
OIC_RSRC_CORE_P_URI, OC_RSRVD_PLATFORM_URI,
OIC_RSRC_TYPES_D_URI, OC_RSRVD_RESOURCE_TYPES_URI,
OIC_RSRC_PRESENCE_URI, #ifdef WITH_PRESENCE
OC_RSRVD_PRESENCE_URI,
#endif //WITH_PRESENCE
OIC_RSRC_ACL_URI, OIC_RSRC_ACL_URI,
OIC_RSRC_DOXM_URI, OIC_RSRC_DOXM_URI,
OIC_RSRC_PSTAT_URI, OIC_RSRC_PSTAT_URI,
......
...@@ -24,12 +24,6 @@ ...@@ -24,12 +24,6 @@
const char * SVR_DB_FILE_NAME = "oic_svr_db.json"; const char * SVR_DB_FILE_NAME = "oic_svr_db.json";
const char * OIC_MI_DEF = "oic.mi.def"; const char * OIC_MI_DEF = "oic.mi.def";
const char * OIC_RSRC_CORE_URI = "/oic/res";
const char * OIC_RSRC_CORE_D_URI = "/oic/res/d";
const char * OIC_RSRC_CORE_P_URI = "/oic/p";
const char * OIC_RSRC_PRESENCE_URI = "/oic/ad";
const char * OIC_RSRC_TYPES_D_URI = "/oic/res/types/d";
//ACL //ACL
const char * OIC_RSRC_TYPE_SEC_ACL = "oic.sec.acl"; const char * OIC_RSRC_TYPE_SEC_ACL = "oic.sec.acl";
const char * OIC_RSRC_ACL_URI = "/oic/sec/acl"; const char * OIC_RSRC_ACL_URI = "/oic/sec/acl";
......
...@@ -44,6 +44,21 @@ ...@@ -44,6 +44,21 @@
#define OC_RESOURCE_OBSERVABLE 1 #define OC_RESOURCE_OBSERVABLE 1
#define OC_RESOURCE_SECURE 1 #define OC_RESOURCE_SECURE 1
/**
* OIC Virtual resources supported by every OIC device.
*/
typedef enum
{
OC_UNKNOWN_URI =0,
OC_WELL_KNOWN_URI, ///< "/oic/res"
OC_DEVICE_URI, ///< "/oic/d"
OC_PLATFORM_URI, ///< "/oic/p"
OC_RESOURCE_TYPES_URI, ///< "/oic/res/types/d"
#ifdef WITH_PRESENCE
OC_PRESENCE, ///< "/oic/ad"
#endif
} OCVirtualResources;
/** /**
* The type of query a request/response message is. * The type of query a request/response message is.
*/ */
...@@ -77,11 +92,6 @@ typedef enum ...@@ -77,11 +92,6 @@ typedef enum
OCEntityHandlerResult defaultResourceEHandler(OCEntityHandlerFlag flag, OCEntityHandlerResult defaultResourceEHandler(OCEntityHandlerFlag flag,
OCEntityHandlerRequest * request, void* callbackParam); OCEntityHandlerRequest * request, void* callbackParam);
/**
* Get string value associated with a virtual resource type.
*/
const char * GetVirtualResourceUri(OCVirtualResources resource);
/** /**
* Find and retrieve pointer to a resource associated with a specific resource * Find and retrieve pointer to a resource associated with a specific resource
* URI. * URI.
......
...@@ -35,16 +35,21 @@ extern "C" { ...@@ -35,16 +35,21 @@ extern "C" {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Defines // Defines
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define OC_WELL_KNOWN_QUERY "/oic/res"
#define OC_MULTICAST_DISCOVERY_URI "/oic/res"
/**
* OIC Virtual resources supported by every OIC device.
*/
#define OC_RSRVD_WELL_KNOWN_URI "/oic/res"
#define OC_RSRVD_DEVICE_URI "/oic/d"
#define OC_RSRVD_PLATFORM_URI "/oic/p"
#define OC_RSRVD_RESOURCE_TYPES_URI "/oic/res/types/d"
#ifdef WITH_PRESENCE #ifdef WITH_PRESENCE
#define OC_RSRVD_PRESENCE_URI "/oic/ad"
#define OC_DEFAULT_PRESENCE_TTL_SECONDS (60) #define OC_DEFAULT_PRESENCE_TTL_SECONDS (60)
/// OC_MAX_PRESENCE_TTL_SECONDS sets the maximum time to live (TTL) for presence. /// OC_MAX_PRESENCE_TTL_SECONDS sets the maximum time to live (TTL) for presence.
/// NOTE: Changing the setting to a longer duration may lead to unsupported and untested /// NOTE: Changing the setting to a longer duration may lead to unsupported and untested
/// operation. /// operation.
#define OC_MAX_PRESENCE_TTL_SECONDS (60 * 60 * 24) // 60 sec/min * 60 min/hr * 24 hr/day #define OC_MAX_PRESENCE_TTL_SECONDS (60 * 60 * 24) // 60 sec/min * 60 min/hr * 24 hr/day
#define OC_PRESENCE_URI "/oic/ad"
#endif #endif
///Separtor for multiple query string ///Separtor for multiple query string
...@@ -239,21 +244,6 @@ typedef enum ...@@ -239,21 +244,6 @@ typedef enum
CT_SCOPE_GLOBAL = 0xE, // IPv6 Global scope CT_SCOPE_GLOBAL = 0xE, // IPv6 Global scope
} OCConnectivityType; } OCConnectivityType;
/**
* OC Virtual resources supported by every OC device.
*/
typedef enum
{
OC_WELL_KNOWN_URI= 0, ///< "/oic/res"
OC_DEVICE_URI, ///< "/oic/d"
OC_PLATFORM_URI, ///< "/oic/p"
OC_RESOURCE_TYPES_URI, ///< "/oic/res/d/type"
#ifdef WITH_PRESENCE
OC_PRESENCE, ///< "/oic/ad"
#endif
OC_MAX_VIRTUAL_RESOURCES ///<s Max items in the list
} OCVirtualResources;
/** /**
* OCDoResource methods * OCDoResource methods
*/ */
......
...@@ -378,6 +378,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle, ...@@ -378,6 +378,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
clientResponse->devAddr.port); clientResponse->devAddr.port);
OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);
OC_CONNTYPE = clientResponse->connType;
parseClientResponse(clientResponse); parseClientResponse(clientResponse);
switch(TEST_CASE) switch(TEST_CASE)
...@@ -494,7 +495,7 @@ int InitPresence() ...@@ -494,7 +495,7 @@ int InitPresence()
OC_LOG_V(INFO, TAG, "\n\nExecuting %s", __func__); OC_LOG_V(INFO, TAG, "\n\nExecuting %s", __func__);
std::ostringstream query; std::ostringstream query;
std::ostringstream querySuffix; std::ostringstream querySuffix;
query << "coap://" << coapServerIP << ":" << coapServerPort << OC_PRESENCE_URI; query << "coap://" << coapServerIP << ":" << coapServerPort << OC_RSRVD_PRESENCE_URI;
if(TEST_CASE == TEST_OBS_PRESENCE) if(TEST_CASE == TEST_OBS_PRESENCE)
{ {
result = InvokeOCDoResource(query, OC_REST_PRESENCE, OC_LOW_QOS, result = InvokeOCDoResource(query, OC_REST_PRESENCE, OC_LOW_QOS,
...@@ -523,7 +524,7 @@ int InitPresence() ...@@ -523,7 +524,7 @@ int InitPresence()
{ {
std::ostringstream multicastPresenceQuery; std::ostringstream multicastPresenceQuery;
multicastPresenceQuery.str(""); multicastPresenceQuery.str("");
multicastPresenceQuery << "coap://" << OC_MULTICAST_PREFIX << OC_PRESENCE_URI; multicastPresenceQuery << "coap://" << OC_MULTICAST_PREFIX << OC_RSRVD_PRESENCE_URI;
result = InvokeOCDoResource(multicastPresenceQuery, OC_REST_PRESENCE, OC_LOW_QOS, result = InvokeOCDoResource(multicastPresenceQuery, OC_REST_PRESENCE, OC_LOW_QOS,
presenceCB, NULL, 0); presenceCB, NULL, 0);
} }
......
...@@ -52,17 +52,6 @@ extern OCResource *headResource; ...@@ -52,17 +52,6 @@ extern OCResource *headResource;
static OCPlatformInfo savedPlatformInfo = {}; static OCPlatformInfo savedPlatformInfo = {};
static OCDeviceInfo savedDeviceInfo = {}; static OCDeviceInfo savedDeviceInfo = {};
static const char * VIRTUAL_RSRCS[] =
{
"/oic/res",
"/oic/d",
"/oic/p",
"/oic/res/types/d",
#ifdef WITH_PRESENCE
"/oic/ad"
#endif
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Default resource entity handler function // Default resource entity handler function
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -163,27 +152,31 @@ static OCStackResult ExtractFiltersFromQuery(char *query, char **filterOne, char ...@@ -163,27 +152,31 @@ static OCStackResult ExtractFiltersFromQuery(char *query, char **filterOne, char
return OC_STACK_OK; return OC_STACK_OK;
} }
static OCVirtualResources GetTypeOfVirtualURI(char *uriInRequest) static OCVirtualResources GetTypeOfVirtualURI(const char *uriInRequest)
{ {
if (strcmp (uriInRequest, GetVirtualResourceUri(OC_WELL_KNOWN_URI)) == 0) if (strcmp(uriInRequest, OC_RSRVD_WELL_KNOWN_URI) == 0)
{ {
return OC_WELL_KNOWN_URI; return OC_WELL_KNOWN_URI;
} }
else if (strcmp (uriInRequest, GetVirtualResourceUri(OC_DEVICE_URI)) == 0) else if (strcmp(uriInRequest, OC_RSRVD_DEVICE_URI) == 0)
{ {
return OC_DEVICE_URI; return OC_DEVICE_URI;
} }
else if (strcmp (uriInRequest, GetVirtualResourceUri(OC_PLATFORM_URI)) == 0) else if (strcmp(uriInRequest, OC_RSRVD_PLATFORM_URI) == 0)
{ {
return OC_PLATFORM_URI; return OC_PLATFORM_URI;
} }
else if (strcmp(uriInRequest, OC_RSRVD_RESOURCE_TYPES_URI) == 0)
#ifdef WITH_PRESENCE {
else return OC_RESOURCE_TYPES_URI;
}
#ifdef WITH_PRESENCE
else if (strcmp(uriInRequest, OC_RSRVD_PRESENCE_URI) == 0)
{ {
return OC_PRESENCE; return OC_PRESENCE;
} }
#endif #endif //WITH_PRESENCE
return OC_UNKNOWN_URI;
} }
static OCStackResult getQueryParamsForFiltering (OCVirtualResources uri, char *query, static OCStackResult getQueryParamsForFiltering (OCVirtualResources uri, char *query,
...@@ -235,32 +228,7 @@ OCStackResult BuildVirtualResourceResponse(const OCResource *resourcePtr, ...@@ -235,32 +228,7 @@ OCStackResult BuildVirtualResourceResponse(const OCResource *resourcePtr,
OCDiscoveryPayloadAddResource(payload, resourcePtr, port); OCDiscoveryPayloadAddResource(payload, resourcePtr, port);
return OC_STACK_OK; return OC_STACK_OK;
} }
const char * GetVirtualResourceUri( OCVirtualResources resource)
{
if (resource < OC_MAX_VIRTUAL_RESOURCES)
{
return VIRTUAL_RSRCS[resource];
}
return NULL;
}
bool IsVirtualResource(const char* resourceUri)
{
if(!resourceUri)
{
return false;
}
for (int i = 0; i < OC_MAX_VIRTUAL_RESOURCES; i++)
{
if (strcmp(resourceUri, GetVirtualResourceUri((OCVirtualResources)i)) == 0)
{
return true;
}
}
return false;
}
uint8_t IsCollectionResource (OCResource *resource) uint8_t IsCollectionResource (OCResource *resource)
{ {
...@@ -314,7 +282,7 @@ OCStackResult DetermineResourceHandling (const OCServerRequest *request, ...@@ -314,7 +282,7 @@ OCStackResult DetermineResourceHandling (const OCServerRequest *request,
const OCDevAddr *devAddr = &request->devAddr; const OCDevAddr *devAddr = &request->devAddr;
// Check if virtual resource // Check if virtual resource
if (IsVirtualResource((const char*)request->resourceUrl)) if (GetTypeOfVirtualURI(request->resourceUrl) != OC_UNKNOWN_URI)
{ {
*handling = OC_RESOURCE_VIRTUAL; *handling = OC_RESOURCE_VIRTUAL;
*resource = headResource; *resource = headResource;
...@@ -560,7 +528,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource ...@@ -560,7 +528,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
} }
else if (virtualUriInRequest == OC_DEVICE_URI) else if (virtualUriInRequest == OC_DEVICE_URI)
{ {
payload = (OCPayload*)OCDevicePayloadCreate(GetVirtualResourceUri(OC_DEVICE_URI), payload = (OCPayload*)OCDevicePayloadCreate(OC_RSRVD_DEVICE_URI,
OCGetServerInstanceID(), savedDeviceInfo.deviceName, OCGetServerInstanceID(), savedDeviceInfo.deviceName,
OC_SPEC_VERSION, OC_DATA_MODEL_VERSION); OC_SPEC_VERSION, OC_DATA_MODEL_VERSION);
if (!payload) if (!payload)
...@@ -571,7 +539,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource ...@@ -571,7 +539,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
else if (virtualUriInRequest == OC_PLATFORM_URI) else if (virtualUriInRequest == OC_PLATFORM_URI)
{ {
OCPlatformPayload* payload = OCPlatformPayloadCreate( OCPlatformPayload* payload = OCPlatformPayloadCreate(
GetVirtualResourceUri(OC_PLATFORM_URI), OC_RSRVD_PLATFORM_URI,
&savedPlatformInfo); &savedPlatformInfo);
if (!payload) if (!payload)
{ {
......
...@@ -743,7 +743,7 @@ static int FormCanonicalPresenceUri(const CAEndpoint_t *endpoint, char *resource ...@@ -743,7 +743,7 @@ static int FormCanonicalPresenceUri(const CAEndpoint_t *endpoint, char *resource
} }
return snprintf(presenceUri, CA_MAX_URI_LENGTH, format, endpoint->addr, return snprintf(presenceUri, CA_MAX_URI_LENGTH, format, endpoint->addr,
endpoint->port, OC_PRESENCE_URI); endpoint->port, OC_RSRVD_PRESENCE_URI);
} }
...@@ -771,7 +771,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, ...@@ -771,7 +771,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint,
return OC_STACK_ERROR; return OC_STACK_ERROR;
} }
uriLen = FormCanonicalPresenceUri(endpoint, OC_PRESENCE_URI, presenceUri); uriLen = FormCanonicalPresenceUri(endpoint, OC_RSRVD_PRESENCE_URI, presenceUri);
if (uriLen < 0 || uriLen >= sizeof (presenceUri)) if (uriLen < 0 || uriLen >= sizeof (presenceUri))
{ {
return OC_STACK_INVALID_URI; return OC_STACK_INVALID_URI;
...@@ -785,7 +785,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, ...@@ -785,7 +785,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint,
else else
{ {
snprintf (presenceUri, MAX_URI_LENGTH, "coap://[%s]:%u%s", OC_MULTICAST_IP, snprintf (presenceUri, MAX_URI_LENGTH, "coap://[%s]:%u%s", OC_MULTICAST_IP,
OC_MULTICAST_PORT, OC_PRESENCE_URI); OC_MULTICAST_PORT, OC_RSRVD_PRESENCE_URI);
cbNode = GetClientCB(NULL, 0, NULL, presenceUri); cbNode = GetClientCB(NULL, 0, NULL, presenceUri);
if (cbNode) if (cbNode)
{ {
...@@ -951,7 +951,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res ...@@ -951,7 +951,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res
VERIFY_NON_NULL_NR(responseInfo->info.resourceUri, FATAL); VERIFY_NON_NULL_NR(responseInfo->info.resourceUri, FATAL);
OC_LOG(INFO, TAG, PCF("Enter HandleCAResponses")); OC_LOG(INFO, TAG, PCF("Enter HandleCAResponses"));
if(strcmp(responseInfo->info.resourceUri, OC_PRESENCE_URI) == 0) if(strcmp(responseInfo->info.resourceUri, OC_RSRVD_PRESENCE_URI) == 0)
{ {
HandlePresenceResponse(endPoint, responseInfo); HandlePresenceResponse(endPoint, responseInfo);
return; return;
...@@ -2325,7 +2325,7 @@ OCStackResult OCProcessPresence() ...@@ -2325,7 +2325,7 @@ OCStackResult OCProcessPresence()
requestData.type = CA_MSG_NONCONFIRM; requestData.type = CA_MSG_NONCONFIRM;
requestData.token = cbNode->token; requestData.token = cbNode->token;
requestData.tokenLength = cbNode->tokenLength; requestData.tokenLength = cbNode->tokenLength;
requestData.resourceUri = OC_PRESENCE_URI; requestData.resourceUri = OC_RSRVD_PRESENCE_URI;
requestInfo.method = CA_GET; requestInfo.method = CA_GET;
requestInfo.info = requestData; requestInfo.info = requestData;
...@@ -2401,7 +2401,7 @@ OCStackResult OCStartPresence(const uint32_t ttl) ...@@ -2401,7 +2401,7 @@ OCStackResult OCStartPresence(const uint32_t ttl)
return OC_STACK_ERROR; return OC_STACK_ERROR;
} }
AddObserver(OC_PRESENCE_URI, NULL, 0, caToken, tokenLength, AddObserver(OC_RSRVD_PRESENCE_URI, NULL, 0, caToken, tokenLength,
(OCResource *)presenceResource.handle, OC_LOW_QOS, &devAddr); (OCResource *)presenceResource.handle, OC_LOW_QOS, &devAddr);
CADestroyToken(caToken); CADestroyToken(caToken);
} }
...@@ -3306,7 +3306,7 @@ OCStackResult initResources() ...@@ -3306,7 +3306,7 @@ OCStackResult initResources()
result = OCCreateResource(&presenceResource.handle, result = OCCreateResource(&presenceResource.handle,
OC_RSRVD_RESOURCE_TYPE_PRESENCE, OC_RSRVD_RESOURCE_TYPE_PRESENCE,
"core.r", "core.r",
OC_PRESENCE_URI, OC_RSRVD_PRESENCE_URI,
NULL, NULL,
NULL, NULL,
OC_OBSERVABLE); OC_OBSERVABLE);
......
...@@ -271,7 +271,7 @@ TEST(StackDiscovery, DISABLED_DoResourceDeviceDiscovery) ...@@ -271,7 +271,7 @@ TEST(StackDiscovery, DISABLED_DoResourceDeviceDiscovery)
/* Start a discovery query*/ /* Start a discovery query*/
char szQueryUri[64] = { 0 }; char szQueryUri[64] = { 0 };
strcpy(szQueryUri, OC_WELL_KNOWN_QUERY); strcpy(szQueryUri, OC_RSRVD_WELL_KNOWN_URI);
cbData.cb = asyncDoResourcesCallback; cbData.cb = asyncDoResourcesCallback;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE; cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL; cbData.cd = NULL;
...@@ -313,7 +313,7 @@ TEST(StackResource, DISABLED_UpdateResourceNullURI) ...@@ -313,7 +313,7 @@ TEST(StackResource, DISABLED_UpdateResourceNullURI)
/* Start a discovery query*/ /* Start a discovery query*/
char szQueryUri[64] = { 0 }; char szQueryUri[64] = { 0 };
strcpy(szQueryUri, OC_WELL_KNOWN_QUERY); strcpy(szQueryUri, OC_RSRVD_WELL_KNOWN_URI);
cbData.cb = asyncDoResourcesCallback; cbData.cb = asyncDoResourcesCallback;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE; cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL; cbData.cd = NULL;
...@@ -435,8 +435,8 @@ TEST(StackResource, CreateResourceSuccessWithResourcePolicyPropNone) ...@@ -435,8 +435,8 @@ TEST(StackResource, CreateResourceSuccessWithResourcePolicyPropNone)
"core.led", "core.led",
"core.rw", "core.rw",
"/a/led", "/a/led",
0, 0,
NULL, NULL,
OC_RES_PROP_NONE));// the resource is non-discoverable & OC_RES_PROP_NONE));// the resource is non-discoverable &
// non-observable by the client. // non-observable by the client.
const char* url = OCGetResourceUri(handle); const char* url = OCGetResourceUri(handle);
......
...@@ -52,7 +52,7 @@ class ClientFridge ...@@ -52,7 +52,7 @@ class ClientFridge
m_callsMade(0),m_connectivityType(ct) m_callsMade(0),m_connectivityType(ct)
{ {
std::ostringstream requestURI; std::ostringstream requestURI;
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=intel.fridge"; requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=intel.fridge";
std::cout << "Fridge Client has started " <<std::endl; std::cout << "Fridge Client has started " <<std::endl;
FindCallback f (std::bind(&ClientFridge::foundDevice, this, PH::_1)); FindCallback f (std::bind(&ClientFridge::foundDevice, this, PH::_1));
OCStackResult result = OCPlatform::findResource( OCStackResult result = OCPlatform::findResource(
......
...@@ -355,7 +355,7 @@ int main(int argc, char* argv[]) { ...@@ -355,7 +355,7 @@ int main(int argc, char* argv[]) {
try try
{ {
// Find all resources // Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.garage"; requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.garage";
OCPlatform::findResource("", requestURI.str(), OCPlatform::findResource("", requestURI.str(),
connectivityType, &foundResource); connectivityType, &foundResource);
......
...@@ -171,7 +171,7 @@ bool isResourceReady() ...@@ -171,7 +171,7 @@ bool isResourceReady()
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
ostringstream requestURI; ostringstream requestURI;
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=a.collection"; requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=a.collection";
PlatformConfig config PlatformConfig config
{ OC::ServiceType::InProc, ModeType::Client, "0.0.0.0", 0, OC::QualityOfService::LowQos }; { OC::ServiceType::InProc, ModeType::Client, "0.0.0.0", 0, OC::QualityOfService::LowQos };
......
...@@ -152,7 +152,7 @@ int main(int argc, char* argv[]) ...@@ -152,7 +152,7 @@ int main(int argc, char* argv[])
cout << "registerResource is called." << endl; cout << "registerResource is called." << endl;
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.light"; requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
OCPlatform::findResource("", requestURI.str(), OCPlatform::findResource("", requestURI.str(),
connectivityType, &foundResource); connectivityType, &foundResource);
......
...@@ -340,7 +340,7 @@ int main(int argc, char* argv[]) { ...@@ -340,7 +340,7 @@ int main(int argc, char* argv[]) {
else else
{ {
// Find all resources // Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI; requestURI << OC_RSRVD_WELL_KNOWN_URI;
result = OCPlatform::findResource("", requestURI.str(), result = OCPlatform::findResource("", requestURI.str(),
CT_DEFAULT, &foundResource); CT_DEFAULT, &foundResource);
......
...@@ -288,7 +288,7 @@ int main(int argc, char* argv[]) { ...@@ -288,7 +288,7 @@ int main(int argc, char* argv[]) {
try try
{ {
// Find all resources // Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI; requestURI << OC_RSRVD_WELL_KNOWN_URI;
OCPlatform::findResource("", requestURI.str(), connectivityType, &foundResource); OCPlatform::findResource("", requestURI.str(), connectivityType, &foundResource);
std::cout<< "Finding Resource... " <<std::endl; std::cout<< "Finding Resource... " <<std::endl;
......
...@@ -454,7 +454,7 @@ int main(int argc, char* argv[]) { ...@@ -454,7 +454,7 @@ int main(int argc, char* argv[]) {
// makes it so that all boolean values are printed as 'true/false' in this stream // makes it so that all boolean values are printed as 'true/false' in this stream
std::cout.setf(std::ios::boolalpha); std::cout.setf(std::ios::