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()
{
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)
......
......@@ -42,7 +42,7 @@ void IoTClient::initializePlatform()
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,
OC::QualityOfService::LowQos);
}
......
......@@ -26,12 +26,6 @@
extern const char * SVR_DB_FILE_NAME;
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
extern const char * OIC_RSRC_TYPE_SEC_ACL;
extern const char * OIC_RSRC_ACL_URI;
......
......@@ -416,11 +416,13 @@ OCStackResult GetDefaultACL(OicSecAcl_t** defaultAcl)
*/
const char *rsrcs[] = {
OIC_RSRC_CORE_URI,
OIC_RSRC_CORE_D_URI,
OIC_RSRC_CORE_P_URI,
OIC_RSRC_TYPES_D_URI,
OIC_RSRC_PRESENCE_URI,
OC_RSRVD_WELL_KNOWN_URI,
OC_RSRVD_DEVICE_URI,
OC_RSRVD_PLATFORM_URI,
OC_RSRVD_RESOURCE_TYPES_URI,
#ifdef WITH_PRESENCE
OC_RSRVD_PRESENCE_URI,
#endif //WITH_PRESENCE
OIC_RSRC_ACL_URI,
OIC_RSRC_DOXM_URI,
OIC_RSRC_PSTAT_URI,
......
......@@ -24,12 +24,6 @@
const char * SVR_DB_FILE_NAME = "oic_svr_db.json";
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
const char * OIC_RSRC_TYPE_SEC_ACL = "oic.sec.acl";
const char * OIC_RSRC_ACL_URI = "/oic/sec/acl";
......
......@@ -44,6 +44,21 @@
#define OC_RESOURCE_OBSERVABLE 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.
*/
......@@ -77,11 +92,6 @@ typedef enum
OCEntityHandlerResult defaultResourceEHandler(OCEntityHandlerFlag flag,
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
* URI.
......
......@@ -35,16 +35,21 @@ extern "C" {
//-----------------------------------------------------------------------------
// 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
#define OC_RSRVD_PRESENCE_URI "/oic/ad"
#define OC_DEFAULT_PRESENCE_TTL_SECONDS (60)
/// 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
/// operation.
#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
///Separtor for multiple query string
......@@ -239,21 +244,6 @@ typedef enum
CT_SCOPE_GLOBAL = 0xE, // IPv6 Global scope
} 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
*/
......
......@@ -378,6 +378,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
clientResponse->devAddr.port);
OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);
OC_CONNTYPE = clientResponse->connType;
parseClientResponse(clientResponse);
switch(TEST_CASE)
......@@ -494,7 +495,7 @@ int InitPresence()
OC_LOG_V(INFO, TAG, "\n\nExecuting %s", __func__);
std::ostringstream query;
std::ostringstream querySuffix;
query << "coap://" << coapServerIP << ":" << coapServerPort << OC_PRESENCE_URI;
query << "coap://" << coapServerIP << ":" << coapServerPort << OC_RSRVD_PRESENCE_URI;
if(TEST_CASE == TEST_OBS_PRESENCE)
{
result = InvokeOCDoResource(query, OC_REST_PRESENCE, OC_LOW_QOS,
......@@ -523,7 +524,7 @@ int InitPresence()
{
std::ostringstream multicastPresenceQuery;
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,
presenceCB, NULL, 0);
}
......
......@@ -52,17 +52,6 @@ extern OCResource *headResource;
static OCPlatformInfo savedPlatformInfo = {};
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
//-----------------------------------------------------------------------------
......@@ -163,27 +152,31 @@ static OCStackResult ExtractFiltersFromQuery(char *query, char **filterOne, char
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;
}
else if (strcmp (uriInRequest, GetVirtualResourceUri(OC_DEVICE_URI)) == 0)
else if (strcmp(uriInRequest, OC_RSRVD_DEVICE_URI) == 0)
{
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;
}
#ifdef WITH_PRESENCE
else
else if (strcmp(uriInRequest, OC_RSRVD_RESOURCE_TYPES_URI) == 0)
{
return OC_RESOURCE_TYPES_URI;
}
#ifdef WITH_PRESENCE
else if (strcmp(uriInRequest, OC_RSRVD_PRESENCE_URI) == 0)
{
return OC_PRESENCE;
}
#endif
#endif //WITH_PRESENCE
return OC_UNKNOWN_URI;
}
static OCStackResult getQueryParamsForFiltering (OCVirtualResources uri, char *query,
......@@ -235,32 +228,7 @@ OCStackResult BuildVirtualResourceResponse(const OCResource *resourcePtr,
OCDiscoveryPayloadAddResource(payload, resourcePtr, port);
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)
{
......@@ -314,7 +282,7 @@ OCStackResult DetermineResourceHandling (const OCServerRequest *request,
const OCDevAddr *devAddr = &request->devAddr;
// Check if virtual resource
if (IsVirtualResource((const char*)request->resourceUrl))
if (GetTypeOfVirtualURI(request->resourceUrl) != OC_UNKNOWN_URI)
{
*handling = OC_RESOURCE_VIRTUAL;
*resource = headResource;
......@@ -560,7 +528,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
}
else if (virtualUriInRequest == OC_DEVICE_URI)
{
payload = (OCPayload*)OCDevicePayloadCreate(GetVirtualResourceUri(OC_DEVICE_URI),
payload = (OCPayload*)OCDevicePayloadCreate(OC_RSRVD_DEVICE_URI,
OCGetServerInstanceID(), savedDeviceInfo.deviceName,
OC_SPEC_VERSION, OC_DATA_MODEL_VERSION);
if (!payload)
......@@ -571,7 +539,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
else if (virtualUriInRequest == OC_PLATFORM_URI)
{
OCPlatformPayload* payload = OCPlatformPayloadCreate(
GetVirtualResourceUri(OC_PLATFORM_URI),
OC_RSRVD_PLATFORM_URI,
&savedPlatformInfo);
if (!payload)
{
......
......@@ -743,7 +743,7 @@ static int FormCanonicalPresenceUri(const CAEndpoint_t *endpoint, char *resource
}
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,
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))
{
return OC_STACK_INVALID_URI;
......@@ -785,7 +785,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint,
else
{
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);
if (cbNode)
{
......@@ -951,7 +951,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res
VERIFY_NON_NULL_NR(responseInfo->info.resourceUri, FATAL);
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);
return;
......@@ -2325,7 +2325,7 @@ OCStackResult OCProcessPresence()
requestData.type = CA_MSG_NONCONFIRM;
requestData.token = cbNode->token;
requestData.tokenLength = cbNode->tokenLength;
requestData.resourceUri = OC_PRESENCE_URI;
requestData.resourceUri = OC_RSRVD_PRESENCE_URI;
requestInfo.method = CA_GET;
requestInfo.info = requestData;
......@@ -2401,7 +2401,7 @@ OCStackResult OCStartPresence(const uint32_t ttl)
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);
CADestroyToken(caToken);
}
......@@ -3306,7 +3306,7 @@ OCStackResult initResources()
result = OCCreateResource(&presenceResource.handle,
OC_RSRVD_RESOURCE_TYPE_PRESENCE,
"core.r",
OC_PRESENCE_URI,
OC_RSRVD_PRESENCE_URI,
NULL,
NULL,
OC_OBSERVABLE);
......
......@@ -271,7 +271,7 @@ TEST(StackDiscovery, DISABLED_DoResourceDeviceDiscovery)
/* Start a discovery query*/
char szQueryUri[64] = { 0 };
strcpy(szQueryUri, OC_WELL_KNOWN_QUERY);
strcpy(szQueryUri, OC_RSRVD_WELL_KNOWN_URI);
cbData.cb = asyncDoResourcesCallback;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
......@@ -313,7 +313,7 @@ TEST(StackResource, DISABLED_UpdateResourceNullURI)
/* Start a discovery query*/
char szQueryUri[64] = { 0 };
strcpy(szQueryUri, OC_WELL_KNOWN_QUERY);
strcpy(szQueryUri, OC_RSRVD_WELL_KNOWN_URI);
cbData.cb = asyncDoResourcesCallback;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
......
......@@ -52,7 +52,7 @@ class ClientFridge
m_callsMade(0),m_connectivityType(ct)
{
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;
FindCallback f (std::bind(&ClientFridge::foundDevice, this, PH::_1));
OCStackResult result = OCPlatform::findResource(
......
......@@ -355,7 +355,7 @@ int main(int argc, char* argv[]) {
try
{
// Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.garage";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.garage";
OCPlatform::findResource("", requestURI.str(),
connectivityType, &foundResource);
......
......@@ -171,7 +171,7 @@ bool isResourceReady()
int main(int argc, char* argv[])
{
ostringstream requestURI;
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=a.collection";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=a.collection";
PlatformConfig config
{ OC::ServiceType::InProc, ModeType::Client, "0.0.0.0", 0, OC::QualityOfService::LowQos };
......
......@@ -152,7 +152,7 @@ int main(int argc, char* argv[])
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(),
connectivityType, &foundResource);
......
......@@ -340,7 +340,7 @@ int main(int argc, char* argv[]) {
else
{
// Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI;
requestURI << OC_RSRVD_WELL_KNOWN_URI;
result = OCPlatform::findResource("", requestURI.str(),
CT_DEFAULT, &foundResource);
......
......@@ -288,7 +288,7 @@ int main(int argc, char* argv[]) {
try
{
// Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI;
requestURI << OC_RSRVD_WELL_KNOWN_URI;
OCPlatform::findResource("", requestURI.str(), connectivityType, &foundResource);
std::cout<< "Finding Resource... " <<std::endl;
......
......@@ -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
std::cout.setf(std::ios::boolalpha);
// Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI;// << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI;// << "?rt=core.light";
OCPlatform::findResource("", requestURI.str(),
CT_DEFAULT, &foundResource);
......
......@@ -460,7 +460,7 @@ int main(int argc, char* argv[]) {
try
{
// Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
OCPlatform::findResource("", requestURI.str(),
connectivityType, &foundResource, OC::QualityOfService::LowQos);
......
......@@ -154,7 +154,7 @@ public:
void start()
{
std::ostringstream requestURI;
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.foo";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.foo";
std::cout<<"Starting Client find:"<<std::endl;
FindCallback f (std::bind(&ClientWorker::foundResource, this, std::placeholders::_1));
......
......@@ -330,7 +330,7 @@ void server()
int main(int argc, char* argv[])
{
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.foo";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.foo";
PlatformConfig cfg {
OC::ServiceType::InProc,
......
......@@ -755,7 +755,7 @@ namespace OC
auto cLock = m_csdkLock.lock();
std::ostringstream os;
os << host << OC_PRESENCE_URI;;
os << host << OC_RSRVD_PRESENCE_URI;;
if(!resourceType.empty())
{
......
......@@ -466,7 +466,7 @@ namespace OCPlatformTest
TEST(FindResourceTest, DISABLED_FindResourceValid)
{
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK, OCPlatform::findResource("", requestURI.str(),
CT_DEFAULT, &foundResource));
}
......@@ -480,7 +480,7 @@ namespace OCPlatformTest
TEST(FindResourceTest, FindResourceNullResourceURI1)
{
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
EXPECT_ANY_THROW(OCPlatform::findResource(nullptr, requestURI.str(),
CT_DEFAULT, &foundResource));
}
......@@ -488,7 +488,7 @@ namespace OCPlatformTest
TEST(FindResourceTest, FindResourceNullHost)
{
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
EXPECT_ANY_THROW(OCPlatform::findResource(nullptr, requestURI.str(),
CT_DEFAULT, &foundResource));
}
......@@ -496,7 +496,7 @@ namespace OCPlatformTest
TEST(FindResourceTest, FindResourceNullresourceHandler)
{
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
EXPECT_THROW(OCPlatform::findResource("", requestURI.str(),
CT_DEFAULT, NULL), OC::OCException);
}
......@@ -504,7 +504,7 @@ namespace OCPlatformTest
TEST(FindResourceTest, DISABLED_FindResourceWithLowQoS)
{
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK,
OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResource,
OC::QualityOfService::LowQos));
......@@ -513,7 +513,7 @@ namespace OCPlatformTest
TEST(FindResourceTest, DISABLED_FindResourceWithMidQos)
{
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK,
OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResource,
OC::QualityOfService::MidQos));
......@@ -522,7 +522,7 @@ namespace OCPlatformTest
TEST(FindResourceTest, DISABLED_FindResourceWithHighQos)
{
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK,
OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResource,
OC::QualityOfService::HighQos));
......@@ -531,7 +531,7 @@ namespace OCPlatformTest
TEST(FindResourceTest, DISABLED_FindResourceWithNaQos)
{
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK,
OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResource,
OC::QualityOfService::NaQos));
......
......@@ -440,7 +440,7 @@ OCStackResult requestPresence(char *sourceResourceAddress)
cbData.cd = NULL;
char queryUri[OIC_STRING_MAX_VALUE] = { '\0' };
snprintf(queryUri, sizeof(queryUri), "coap://%s%s", sourceResourceAddress , OC_PRESENCE_URI);
snprintf(queryUri, sizeof(queryUri), "coap://%s%s", sourceResourceAddress , OC_RSRVD_PRESENCE_URI);
OC_LOG_V(DEBUG, HOSTING_TAG, "initializePresenceForCoordinating Query : %s", queryUri);
result = OCDoResource(&handle, OC_REST_PRESENCE, queryUri, 0, 0,
......
......@@ -394,7 +394,7 @@ int main(int argc, char *argv[])
// makes it so that all boolean values are printed as 'true/false' in this stream
std::cout.setf(std::ios::boolalpha);
// Find all resources
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.fan";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.fan";
OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResourceFan);
std::cout << "Finding Resource... " << std::endl;
while (true)
......
......@@ -556,7 +556,7 @@ send_msg_clicked_cb(void *data , Evas_Object *obj , void *event_info)
// Find fan resources
std::ostringstream requestURI;
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.fan";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.fan";
OCPlatform::findResource("", requestURI.str(), OC_ALL, &foundResourceFan);
std::cout << "Finding Resource... " << std::endl;
}
......
......@@ -122,7 +122,7 @@ SSMRESULT CResourceFinder::startResourceFinder()
OCStackResult ret = OC_STACK_ERROR;
std::ostringstream requestURI;
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=SSManager.Sensor";
requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=SSManager.Sensor";
std::ostringstream multicastPresenceURI;
multicastPresenceURI << "coap://" << OC_MULTICAST_PREFIX;
......
......@@ -479,7 +479,7 @@ int main()
if (n == 9)
{
std::string query = OC_MULTICAST_DISCOVERY_URI;
std::string query = OC_RSRVD_WELL_KNOWN_URI;
query.append("?rt=");
query.append(resourceTypeName);
......@@ -495,7 +495,7 @@ int main()
}
else if (n == 0)
{
std::string query = OC_MULTICAST_DISCOVERY_URI;
std::string query = OC_RSRVD_WELL_KNOWN_URI;
query.append("?rt=");
query.append("core.bookmark");
......
......@@ -119,7 +119,7 @@ int main(int argc, char* argv[])
else if (selectedMenu == 11)
{
ostringstream query;
query << OC_MULTICAST_DISCOVERY_URI << "?rt=core.musicplayer";
query << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.musicplayer";
cout << query.str() << endl;
result = OCPlatform::findResource("",
......@@ -139,7 +139,7 @@ int main(int argc, char* argv[])
else if (selectedMenu == 12)
{
ostringstream query;
query << OC_MULTICAST_DISCOVERY_URI << "?rt=core.speaker";
query << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.speaker";
result = OCPlatform::findResource("",
query.str(),