Improved OIC Virtual Resource definitions (IOT-603)
authorSachin Agrawal <sachin.agrawal@intel.com>
Fri, 10 Jul 2015 16:17:30 +0000 (09:17 -0700)
committerErich Keane <erich.keane@intel.com>
Tue, 14 Jul 2015 22:51:36 +0000 (22:51 +0000)
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: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1620
Reviewed-by: Erich Keane <erich.keane@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
31 files changed:
examples/OICMiddle/Client.cpp
examples/OICSensorBoard/client.cpp
resource/csdk/security/include/internal/srmresourcestrings.h
resource/csdk/security/src/aclresource.c
resource/csdk/security/src/srmresourcestrings.c
resource/csdk/stack/include/internal/ocresourcehandler.h
resource/csdk/stack/include/octypes.h
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
resource/csdk/stack/src/ocresource.c
resource/csdk/stack/src/ocstack.c
resource/csdk/stack/test/stacktests.cpp
resource/examples/fridgeclient.cpp
resource/examples/garageclient.cpp
resource/examples/groupclient.cpp
resource/examples/groupserver.cpp
resource/examples/presenceclient.cpp
resource/examples/roomclient.cpp
resource/examples/simpleclient.cpp
resource/examples/simpleclientHQ.cpp
resource/examples/simpleclientserver.cpp
resource/examples/threadingsample.cpp
resource/src/InProcClientWrapper.cpp
resource/unittests/OCPlatformTest.cpp
service/notification-manager/NotificationManager/src/hosting.c
service/protocol-plugin/sample-app/linux/mqtt/mqttclient.cpp
service/protocol-plugin/sample-app/tizen/PPMSampleApp/src/ppmsampleapp.cpp
service/soft-sensor-manager/SSMCore/src/SensorProcessor/ResourceFinder.cpp
service/things-manager/sampleapp/linux/groupaction/groupserver.cpp
service/things-manager/sampleapp/linux/groupsyncaction/group.cpp
service/things-manager/sdk/src/GroupManager.cpp
service/things-manager/sdk/src/GroupSynchronization.cpp

index 205212e..6acab49 100644 (file)
@@ -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)
index f6f402d..724735f 100644 (file)
@@ -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);
 }
index 794358e..7b9255c 100644 (file)
 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;
index 7921b0b..e34e0ed 100644 (file)
@@ -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,
index b9e1f3a..e8aee9e 100644 (file)
 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";
index 4b8efcd..d76208a 100644 (file)
 #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.
  */
 typedef enum
@@ -78,11 +93,6 @@ 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.
  */
index 58bb476..cd4c13b 100644 (file)
@@ -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
@@ -240,21 +245,6 @@ typedef enum
 } 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
  */
 typedef enum
index c5f84c7..6a59ee0 100644 (file)
@@ -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);
         }
index fc2b6b9..535b082 100644 (file)
@@ -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)
             {
index 9790d46..f051715 100644 (file)
@@ -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);
index 928ca8e..8ee757d 100644 (file)
@@ -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;
@@ -435,8 +435,8 @@ TEST(StackResource, CreateResourceSuccessWithResourcePolicyPropNone)
                                             "core.led",
                                             "core.rw",
                                             "/a/led",
-                                            0,   
-                                            NULL,   
+                                            0,
+                                            NULL,
                                             OC_RES_PROP_NONE));// the resource is non-discoverable &
                                                 // non-observable by the client.
     const char* url = OCGetResourceUri(handle);
index 0536300..f561f58 100644 (file)
@@ -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(
index 4400e3b..6cb9ab3 100644 (file)
@@ -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);
index 1055d12..99c6f16 100644 (file)
@@ -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 };
index 6f010aa..8e57517 100644 (file)
@@ -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);
index e94dcf8..ff39bfb 100644 (file)
@@ -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);
index 11abf73..5f8acbf 100644 (file)
@@ -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;
index 4d62ac2..b241116 100644 (file)
@@ -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);
index b82e636..44c3b23 100644 (file)
@@ -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);
index cacb106..44b3fb5 100644 (file)
@@ -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));
index d416859..b43d418 100644 (file)
@@ -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,
index f4b48fd..a022c61 100644 (file)
@@ -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())
         {
index e1cb339..489f149 100644 (file)
@@ -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));
index 1957346..059cf75 100644 (file)
@@ -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,
index bb6a079..03f7c13 100644 (file)
@@ -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)
index 47cb8ee..b3bcc2d 100644 (file)
@@ -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;
         }
index bf962b6..a11a6ae 100644 (file)
@@ -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;
index 1996e4d..8959a01 100644 (file)
@@ -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");
 
index c49d152..fd90e82 100755 (executable)
@@ -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(),
                             CT_DEFAULT,
index 2f30d6e..cac79df 100755 (executable)
@@ -223,7 +223,7 @@ OCStackResult GroupManager::findCandidateResources(
     {
         // std::cout << "resourceTypes : " << resourceTypes.at(i) << std::endl;
 
-        std::string query = OC_MULTICAST_DISCOVERY_URI;
+        std::string query = OC_RSRVD_WELL_KNOWN_URI;
         query.append("?rt=");
         query.append(resourceTypes.at(i));
 
index 740bf02..d8c3e9b 100644 (file)
@@ -73,7 +73,7 @@ namespace OIC
         for (unsigned int i = 0; i < collectionResourceTypes.size(); ++i)
         {
 
-            std::string query = OC_MULTICAST_DISCOVERY_URI;
+            std::string query = OC_RSRVD_WELL_KNOWN_URI;
             query.append("?rt=");
             query.append(collectionResourceTypes.at(i));
 
@@ -697,7 +697,7 @@ OCStackResult GroupSynchronization::leaveGroup(
 
                     if (methodType == "joinGroup")
                     {
-                        std::string resourceName = OC_MULTICAST_DISCOVERY_URI;
+                        std::string resourceName = OC_RSRVD_WELL_KNOWN_URI;
                         resourceName.append("?rt=");
                         resourceName.append(resourceType);
                         OC_LOG_V(DEBUG, TAG, "\t\t\tresourceName : %s", resourceName.c_str());