Renamed all references to ‘/oc/core’ to ‘/oic/res’ and '/oc to /oic'
authorMoumita Ray <moumita.ray@intel.com>
Mon, 11 May 2015 17:39:12 +0000 (10:39 -0700)
committerErich Keane <erich.keane@intel.com>
Tue, 26 May 2015 17:30:00 +0000 (17:30 +0000)
This change set is based on OIC core framework standard specification draft A.
Modified reserved namespace to ‘/oc/core’ to ‘/oic/res’ and '/oc to /oic' for
discovery, including core framework, unit tests and samples.

Change-Id: I9721a2a70fd1e3245088b8a2f6366853db849b21
Signed-off-by: Moumita Ray <moumita.ray@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/953
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
17 files changed:
android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java
resource/csdk/connectivity/test/caprotocolmessagetest.cpp
resource/csdk/stack/include/internal/ocresourcehandler.h
resource/csdk/stack/include/ocstackconfig.h
resource/csdk/stack/include/octypes.h
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp
resource/csdk/stack/src/ocresource.c
resource/csdk/stack/src/ocstack.c
resource/include/OCPlatform.h
resource/include/OCPlatform_impl.h
resource/include/StringConstants.h
resource/unittests/OCPlatformTest.cpp

index f55269b..ec9711f 100644 (file)
@@ -46,29 +46,29 @@ public final class OcPlatform {
     /**\r
      * Default interface\r
      */\r
-    public static final String DEFAULT_INTERFACE = "oc.mi.def";\r
+    public static final String DEFAULT_INTERFACE = "oic.mi.def";\r
 \r
     /**\r
      * Used in discovering (GET) links to other resources of a collection\r
      */\r
-    public static final String LINK_INTERFACE = "oc.mi.ll";\r
+    public static final String LINK_INTERFACE = "oic.mi.ll";\r
 \r
     /**\r
      * Used in GET, PUT, POST, DELETE methods on links to other resources of a collection\r
      */\r
-    public static final String BATCH_INTERFACE = "oc.mi.b";\r
+    public static final String BATCH_INTERFACE = "oic.mi.b";\r
 \r
     /**\r
      * Used in GET, PUT, POST methods on links to other remote resources of a group\r
      */\r
-    public static final String GROUP_INTERFACE = "oc.mi.grp";\r
+    public static final String GROUP_INTERFACE = "oic.mi.grp";\r
 \r
-    public static final String WELL_KNOWN_QUERY = "224.0.1.187:5683/oc/core";\r
+    public static final String WELL_KNOWN_QUERY = "224.0.1.187:5683/oic/res";\r
     public static final String MULTICAST_PREFIX = "224.0.1.187:5683";\r
     public static final String MULTICAST_IP = "224.0.1.187";\r
     public static final int MULTICAST_PORT = 5683;\r
     public static final int DEFAULT_PRESENCE_TTL = 60;\r
-    public static final String PRESENCE_URI = "/oc/presence";\r
+    public static final String PRESENCE_URI = "/oic/ad";\r
 \r
     private static volatile boolean sIsPlatformInitialized = false;\r
 \r
index 12d6701..3a734b0 100644 (file)
@@ -79,11 +79,11 @@ void verifyParsedOptions(CoAPOptionCase const *cases,
 
 TEST(CAProtocolMessage, CAParseURIBase)
 {
-    char sampleURI[] = "coap://[::]/oc/core?rt=core.sensor&if=core.mi.ll";
+    char sampleURI[] = "coap://[::]/oic/res?rt=core.sensor&if=core.mi.ll";
 
     CoAPOptionCase cases[] = {
-        {COAP_OPTION_URI_PATH, 2, "oc"},
-        {COAP_OPTION_URI_PATH, 4, "core"},
+        {COAP_OPTION_URI_PATH, 3, "oic"},
+        {COAP_OPTION_URI_PATH, 3, "res"},
         {COAP_OPTION_URI_QUERY, 14, "rt=core.sensor"},
         {COAP_OPTION_URI_QUERY, 13, "if=core.mi.ll"},
     };
@@ -132,12 +132,12 @@ TEST(CAProtocolMessage, CAParseURIManyPath)
 // Try for multiple URI parameters that still total less than 128
 TEST(CAProtocolMessage, CAParseURIManyParams)
 {
-    char sampleURI[] = "coap://[::]/oc/core/"
+    char sampleURI[] = "coap://[::]/oic/res/"
         "?rt=core.sensor&a=0&b=1&c=2&d=3&e=4&f=5&g=6&h=7&i=8&j=9";
 
     CoAPOptionCase cases[] = {
-        {COAP_OPTION_URI_PATH, 2, "oc"},
-        {COAP_OPTION_URI_PATH, 4, "core"},
+        {COAP_OPTION_URI_PATH, 3, "oic"},
+        {COAP_OPTION_URI_PATH, 3, "res"},
         {COAP_OPTION_URI_QUERY, 14, "rt=core.sensor"},
         {COAP_OPTION_URI_QUERY, 3, "a=0"},
         {COAP_OPTION_URI_QUERY, 3, "b=1"},
@@ -163,16 +163,16 @@ TEST(CAProtocolMessage, CAParseURIManyParams)
 // Test that an initial long path component won't hide latter ones.
 TEST(CAProtocolMessage, CAParseURILongPath)
 {
-    char sampleURI[] = "coap://[::]/oc"
+    char sampleURI[] = "coap://[::]/oic"
         "123456789012345678901234567890123456789012345678901234567890"
         "12345678901234567890123456789012345678901234567890"
-        "/core?rt=core.sensor&if=core.mi.ll";
+        "/res?rt=core.sensor&if=core.mi.ll";
 
     CoAPOptionCase cases[] = {
-        {COAP_OPTION_URI_PATH, 112, "oc"
+        {COAP_OPTION_URI_PATH, 113, "oic"
         "123456789012345678901234567890123456789012345678901234567890"
         "12345678901234567890123456789012345678901234567890"},
-        {COAP_OPTION_URI_PATH, 4, "core"},
+        {COAP_OPTION_URI_PATH, 3, "res"},
         {COAP_OPTION_URI_QUERY, 14, "rt=core.sensor"},
         {COAP_OPTION_URI_QUERY, 13, "if=core.mi.ll"},
     };
index a946686..c0744c1 100644 (file)
@@ -30,7 +30,7 @@
  * These details are exposed in ocstackconfig.h file in the form of documentation.
  * Remember to update the documentation there if these are changed.
  */
-#define OC_JSON_PREFIX                     "{\"oc\":["
+#define OC_JSON_PREFIX                     "{\"oic\":["
 #define OC_JSON_PREFIX_LEN                 (sizeof(OC_JSON_PREFIX) - 1)
 #define OC_JSON_SUFFIX                     "]}"
 #define OC_JSON_SUFFIX_LEN                 (sizeof(OC_JSON_SUFFIX) - 1)
index 0213def..eb7e565 100644 (file)
  * Maximum length of the response supported by Server for any REST request.
  * The actual repsonse length is 256 for Arduino and 1024 for other platforms.
  * Note that the stack will add a prefix and suffix to the payload.
- * Prefix : {"oc":[
+ * Prefix : {"oic":[
  * Suffix : ]}
- * They have a combined size of 9 bytes.
+ * They have a combined size of 10 bytes.
  */
 #ifdef WITH_ARDUINO
-#define MAX_RESPONSE_LENGTH (247)
+#define MAX_RESPONSE_LENGTH (246)
 #else
-#define MAX_RESPONSE_LENGTH (1015)
+#define MAX_RESPONSE_LENGTH (1014)
 #endif
 
 /**
index c597771..77e9b01 100644 (file)
@@ -35,9 +35,9 @@ extern "C" {
 //Don't want to expose to application layer that lower level stack is using CoAP.
 
 /// Authority + URI string to prefix well known queries
-#define OC_WELL_KNOWN_QUERY                  "224.0.1.187:5683/oc/core"
-#define OC_MULTICAST_DISCOVERY_URI           "/oc/core"
-#define OC_EXPLICIT_DEVICE_DISCOVERY_URI     "224.0.1.187:5683/oc/core/d?rt=core.led"
+#define OC_WELL_KNOWN_QUERY                  "224.0.1.187:5683/oic/res"
+#define OC_MULTICAST_DISCOVERY_URI           "/oic/res"
+#define OC_EXPLICIT_DEVICE_DISCOVERY_URI     "224.0.1.187:5683/oic/res/d?rt=core.led"
 /// Multicast address and port string to prefix multicast queries
 #define OC_MULTICAST_PREFIX                  "224.0.1.187:5683"
 /// IP Multicast address to use for multicast requests
@@ -70,7 +70,8 @@ extern "C" {
 #define OC_RSRVD_INTERFACE_DEFAULT      "oic.if.baseline"
 #define OC_RSRVD_INTERFACE_LL           "oic.if.ll"
 #define OC_RSRVD_INTERFACE_BATCH        "oic.if.b"
-#define OC_RSRVD_INTERFACE_GROUP        "oc.mi.grp"
+#define OC_RSRVD_INTERFACE_GROUP        "oic.mi.grp"
+#define OC_RSRVD_MFG_DATE               "mndt"
 #define OC_RSRVD_FW_VERSION             "mnfv"
 #define OC_RSRVD_HOST_NAME              "hn"
 #define OC_RSRVD_VERSION                "icv"
@@ -111,10 +112,10 @@ typedef struct OCDevAddr
  */
 typedef enum
 {
-    OC_WELL_KNOWN_URI= 0,       ///< "/oc/core"
-    OC_DEVICE_URI,              ///< "/oc/core/d"
+    OC_WELL_KNOWN_URI= 0,       ///< "/oic/res"
+    OC_DEVICE_URI,              ///< "/oic/res/d"
     OC_PLATFORM_URI,            ///< "/oic/p"
-    OC_RESOURCE_TYPES_URI,      ///< "/oc/core/d/type"
+    OC_RESOURCE_TYPES_URI,      ///< "/oic/res/d/type"
     #ifdef WITH_PRESENCE
     OC_PRESENCE,                ///< "/oic/ad"
     #endif
index fae9406..9bfaae7 100644 (file)
 
 static int UNICAST_DISCOVERY = 0;
 static int TEST_CASE = 0;
-static const char * UNICAST_DISCOVERY_QUERY = "coap://%s:6298/oc/core";
-static const char * UNICAST_DEVICE_DISCOVERY_QUERY = "coap://%s:6298/oc/core/d";
+
+static const char * UNICAST_DISCOVERY_QUERY = "coap://%s:6298/oic/res";
+static const char * UNICAST_DEVICE_DISCOVERY_QUERY = "coap://%s:6298/oic/res/d";
 static const char * UNICAST_PLATFORM_DISCOVERY_QUERY = "coap://%s:6298/oic/p";
-static const char * MULTICAST_DEVICE_DISCOVERY_QUERY = "/oc/core/d";
+static const char * MULTICAST_DEVICE_DISCOVERY_QUERY = "/oic/res/d";
 static const char * MULTICAST_PLATFORM_DISCOVERY_QUERY = "/oic/p";
-static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
+static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oic/res";
 //The following variable determines the interface protocol (IPv4, IPv6, etc)
 //to be used for sending unicast messages. Default set to IPv4.
 static OCConnectivityType OC_CONNTYPE = OC_IPV4;
-static std::string putPayload = "{\"oc\":[{\"rep\":{\"power\":15,\"state\":true}}]}";
+
+static std::string putPayload = "{\"oic\":[{\"rep\":{\"power\":15,\"state\":true}}]}";
 static std::string coapServerIP = "255.255.255.255";
 static std::string coapServerPort = "5683";
 static std::string coapServerResource = "/a/light";
index 30f79d9..828f76e 100644 (file)
@@ -38,13 +38,13 @@ static int IPV4_ADDR_SIZE = 16;
 static int UNICAST_DISCOVERY = 0;
 static int TEST_CASE = 0;
 
-static const char UNICAST_DISCOVERY_QUERY[] = "coap://%s:6298/oc/core";
+static const char UNICAST_DISCOVERY_QUERY[] = "coap://%s:6298/oic/res";
 static std::string putPayload = "{\"state\":\"off\",\"power\":10}";
 
 //The following variable determines the interface protocol (IPv4, IPv6, etc)
 //to be used for sending unicast messages. Default set to IPv4.
 static OCConnectivityType OC_CONNTYPE = OC_IPV4;
-static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
+static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oic/res";
 
 int gQuitFlag = 0;
 
@@ -442,7 +442,7 @@ int parseJSON(const char * resJSONPayload, char ** sid_c,
         return OC_STACK_INVALID_JSON;
     }
 
-    oc = cJSON_GetObjectItem(root,"oc");
+    oc = cJSON_GetObjectItem(root,"oic");
     if (!oc)
     {
         OC_LOG(ERROR, TAG, "Invalid JSON : Missing oc object");
index f609aea..a8875d4 100644 (file)
@@ -79,7 +79,7 @@ static std::string putPayload = "{\"state\":\"off\",\"power\":\"0\"}";
 //The following variable determines the interface protocol (IPv4, IPv6, etc)
 //to be used for sending unicast messages. Default set to IPv4.
 static OCConnectivityType OC_CONNTYPE = OC_IPV4;
-static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
+static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oic/res";
 
 // The handle for the observe registration
 OCDoHandle gObserveDoHandle;
index 5fc29c6..9b6ce98 100644 (file)
@@ -31,7 +31,7 @@
 
 static int UNICAST_DISCOVERY = 0;
 static int TEST_CASE = 0;
-static const char * UNICAST_DISCOVERY_QUERY = "coap://%s:6298/oc/core";
+static const char * UNICAST_DISCOVERY_QUERY = "coap://%s:6298/oic/res";
 static std::string putPayload = "{\"state\":\"off\",\"power\":10}";
 static std::string coapServerIP = "255.255.255.255";
 static std::string coapServerPort = "5683";
@@ -40,7 +40,8 @@ static std::string coapServerResource = "/a/led";
 //The following variable determines the interface protocol (IPv4, IPv6, etc)
 //to be used for sending unicast messages. Default set to IPv4.
 static OCConnectivityType OC_CONNTYPE = OC_IPV4;
-static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
+static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oic/res";
+
 static int IPV4_ADDR_SIZE = 16;
 void StripNewLineChar(char* str);
 
index d263b09..177914b 100644 (file)
@@ -123,7 +123,7 @@ char* constructJsonResponse (OCEntityHandlerRequest *ehRequest)
         }
 
         // Get root of JSON payload, then the 1st resource.
-        cJSON* carrier = cJSON_GetObjectItem(putJson, "oc");
+        cJSON* carrier = cJSON_GetObjectItem(putJson, "oic");
         carrier = cJSON_GetArrayItem(carrier, 0);
         carrier = cJSON_GetObjectItem(carrier, "rep");
 
@@ -1113,4 +1113,4 @@ int main(int argc, char* argv[])
     }
 
     return 0;
-}
\ No newline at end of file
+}
index 5f8d7b6..5088121 100644 (file)
@@ -36,10 +36,10 @@ static int UNICAST_DISCOVERY = 0;
 static int TEST_CASE = 0;
 
 static int IPV4_ADDR_SIZE = 16;
-static char UNICAST_DISCOVERY_QUERY[] = "coap://%s:6298/oc/core";
-static char MULTICAST_DISCOVERY_QUERY[] = "/oc/core";
+static char UNICAST_DISCOVERY_QUERY[] = "coap://%s:6298/oic/res";
+static char MULTICAST_DISCOVERY_QUERY[] = "/oic/res";
 
-static std::string putPayload = "{\"state\":\"off\",\"power\":10}";
+static std::string putPayload = "{\"oic\":[{\"rep\":{\"state\":\"off\",\"power\":10}}]}";
 static std::string coapServerIP;
 static std::string coapServerPort;
 static std::string coapServerResource;
@@ -402,7 +402,7 @@ int parseClientResponse(OCClientResponse * clientResponse)
         return -1;
     }
 
-    oc = cJSON_GetObjectItem(root,"oc");
+    oc = cJSON_GetObjectItem(root,"oic");
     if (!oc)
     {
         return -1;
index a5fa040..db9f34c 100644 (file)
@@ -51,10 +51,10 @@ static OCPlatformInfo savedPlatformInfo = {};
 static cJSON *savedDeviceInfo = NULL;
 static const char * VIRTUAL_RSRCS[] =
 {
-       "/oc/core",
-       "/oc/core/d",
        "/oic/p",
-       "/oc/core/types/d",
+       "/oic/res",
+       "/oic/res/d",
+       "/oic/res/types/d",
        #ifdef WITH_PRESENCE
        "/oic/ad"
        #endif
index 2ccd77a..8ef78b6 100644 (file)
@@ -789,7 +789,7 @@ void parsePresencePayload(char* payload, uint32_t* seqNum, uint32_t* maxAge, cha
 {
     char * tok = NULL;
     char * savePtr = NULL;
-    // The format of the payload is {"oc":[%u:%u:%s]}
+    // The format of the payload is {"oic":[%u:%u:%s]}
     // %u : sequence number,
     // %u : max age
     // %s : Resource Type (Optional)
index 53209b9..c56f51e 100644 (file)
@@ -130,7 +130,7 @@ namespace OC
         *
         * @param host - Host IP Address. If null or empty, Multicast is performed.
         * @param deviceURI - Uri containing address to the virtual device in C Stack
-                                ("/oc/core/d")
+                                ("/oic/res/d")
         * @param connectivityType - @ref OCConnectivityType type of connectivity indicating the
         *                           interface. Example: OC_WIFI, OC_ETHERNET, OC_ALL
         * @param deviceInfoHandler - device discovery callback
@@ -182,7 +182,7 @@ namespace OC
         * Above relative URI will be prepended (by core) with a host IP + namespace "oc"
         * Therefore, fully qualified URI format would be //HostIP-Address/namespace/relativeURI"
         * Example, a relative URI: 'a/light' will result in a fully qualified URI:
-        *   //192.168.1.1/oc/a/light"
+        *   //192.168.1.1/oic/a/light"
         * First parameter can take a relative URI and core will take care of preparing the fully
         * qualified URI OR
         * first parameter can take fully qualified URI and core will take that as is for further
index 83c17bc..bc85e30 100644 (file)
@@ -98,7 +98,7 @@ namespace OC
          *
          * @param host - Host IP Address. If null or empty, Multicast is performed.
          * @param resourceURI - Uri containing address to the virtual device in C Stack
-         *                       ("/oc/core/d")
+         *                       ("/oic/res/d")
          *
          * @param QualityOfService the quality of communication
          *
@@ -143,7 +143,7 @@ namespace OC
         * Above relative URI will be prepended (by core) with a host IP + namespace "oc"
         * Therefore, fully qualified URI format would be //HostIP-Address/namespace/relativeURI"
         * Example, a relative URI: 'a/light' will result in a fully qualified URI:
-        *   //192.168.1.1/oc/a/light"
+        *   //192.168.1.1/oic/a/light"
         * First parameter can take a relative URI and core will take care of preparing the fully
         * qualified URI OR
         * first parameter can take fully qualified URI and core will take that as is for further
index 4bb245b..593b7de 100644 (file)
@@ -121,7 +121,7 @@ namespace OC
 
     namespace Key
     {
-        static const std::string OCKEY                      = "oc";
+        static const std::string OCKEY                      = "oic";
         static const std::string URIKEY                     = "href";
         static const std::string OBSERVABLEKEY              = "obs";
         static const std::string RESOURCETYPESKEY           = "rt";
index 2264e37..83f5868 100644 (file)
@@ -550,7 +550,7 @@ namespace OCPlatformTest
     //GetDeviceInfo Test
     TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithValidParameters)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/res/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
@@ -569,7 +569,7 @@ namespace OCPlatformTest
 
     TEST(GetDeviceInfoTest, GetDeviceInfoWithNullDeviceInfoHandler)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/res/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
@@ -581,7 +581,7 @@ namespace OCPlatformTest
 
     TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithLowQos)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/res/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
@@ -593,7 +593,7 @@ namespace OCPlatformTest
 
     TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithMidQos)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/res/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
@@ -605,7 +605,7 @@ namespace OCPlatformTest
 
     TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithHighQos)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/res/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
@@ -617,7 +617,7 @@ namespace OCPlatformTest
 
     TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithNaQos)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/res/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;