Don't include cacommon.h in sample apps
authorDan Mihai <Daniel.Mihai@microsoft.com>
Thu, 18 May 2017 15:38:33 +0000 (08:38 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Fri, 19 May 2017 06:02:42 +0000 (06:02 +0000)
cacommon.h is not a Public header.

This also fixes recent Windows build breaks:

ocserver.cpp
C:\Program Files (x86)\Windows Kits\8.1\include\shared\ws2def.h(100):
error C2220: warning treated as error - no 'object' file generated

C:\Program Files (x86)\Windows Kits\8.1\include\shared\ws2def.h(100):
warning C4005: 'AF_IPX': macro redefinition

C:\Program Files (x86)\Windows Kits\8.1\include\um\winsock.h(452):
note: see previous definition of 'AF_IPX'

C:\Program Files (x86)\Windows Kits\8.1\include\shared\ws2def.h(140):
warning C4005: 'AF_MAX': macro redefinition
...

Change-Id: I4c6ac41a5869c2dced1f38a8eed09c4ab42e2076
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20057
Reviewed-by: Ibrahim Esmat <iesmat@microsoft.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
resource/csdk/connectivity/api/cacommon.h
resource/csdk/connectivity/src/caprotocolmessage.c
resource/csdk/include/octypes.h
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp

index c40b7e1..6e256a1 100644 (file)
@@ -144,10 +144,7 @@ extern "C"
 /**
 * TODO: Move these COAP defines to CoAP lib once approved.
 */
-#define COAP_OPTION_ACCEPT_VERSION 2049
-#define COAP_OPTION_CONTENT_VERSION 2053
 #define COAP_MEDIATYPE_APPLICATION_VND_OCF_CBOR 10000 // application/vnd.ocf+cbor
-
 #define CA_OPTION_ACCEPT_VERSION 2049
 #define CA_OPTION_CONTENT_VERSION 2053
 
index 1bb3c0c..ffe21e7 100755 (executable)
@@ -552,9 +552,9 @@ CAResult_t CAParseHeadOption(uint32_t code, const CAInfo_t *info, coap_list_t **
                 OIC_LOG_V(DEBUG, TAG, "not Header Opt: %d", id);
                 break;
             case COAP_OPTION_ACCEPT:
-            case COAP_OPTION_ACCEPT_VERSION:
+            case CA_OPTION_ACCEPT_VERSION:
             case COAP_OPTION_CONTENT_FORMAT:
-            case COAP_OPTION_CONTENT_VERSION:
+            case CA_OPTION_CONTENT_VERSION:
                 // this is handled below via CAParsePayloadFormatHeadOption
                 break;
             default:
@@ -574,12 +574,12 @@ CAResult_t CAParseHeadOption(uint32_t code, const CAInfo_t *info, coap_list_t **
     // insert one extra header with the payload format if applicable.
     if (CA_FORMAT_UNDEFINED != info->payloadFormat)
     {
-        CAParsePayloadFormatHeadOption(COAP_OPTION_CONTENT_FORMAT, info->payloadFormat, COAP_OPTION_CONTENT_VERSION, info->payloadVersion, optlist);
+        CAParsePayloadFormatHeadOption(COAP_OPTION_CONTENT_FORMAT, info->payloadFormat, CA_OPTION_CONTENT_VERSION, info->payloadVersion, optlist);
     }
 
     if (CA_FORMAT_UNDEFINED != info->acceptFormat)
     {
-        CAParsePayloadFormatHeadOption(COAP_OPTION_ACCEPT, info->acceptFormat, COAP_OPTION_ACCEPT_VERSION, info->acceptVersion, optlist);
+        CAParsePayloadFormatHeadOption(COAP_OPTION_ACCEPT, info->acceptFormat, CA_OPTION_ACCEPT_VERSION, info->acceptVersion, optlist);
     }
 
     return CA_STATUS_OK;
@@ -622,8 +622,8 @@ CAResult_t CAParsePayloadFormatHeadOption(uint16_t formatOption, CAPayloadFormat
         return CA_STATUS_INVALID_PARAM;
     }
 
-    if ((COAP_OPTION_ACCEPT_VERSION == versionOption ||
-         COAP_OPTION_CONTENT_VERSION == versionOption) &&
+    if ((CA_OPTION_ACCEPT_VERSION == versionOption ||
+         CA_OPTION_CONTENT_VERSION == versionOption) &&
         CA_FORMAT_APPLICATION_VND_OCF_CBOR == format)
     {
         versionNode = CACreateNewOptionNode(versionOption,
@@ -725,7 +725,7 @@ CAResult_t CAGetOptionCount(coap_opt_iterator_t opt_iter, uint8_t *optionCount)
             && COAP_OPTION_BLOCK1 != opt_iter.type && COAP_OPTION_BLOCK2 != opt_iter.type
             && COAP_OPTION_SIZE1 != opt_iter.type && COAP_OPTION_SIZE2 != opt_iter.type
             && COAP_OPTION_CONTENT_FORMAT != opt_iter.type
-            && COAP_OPTION_CONTENT_VERSION != opt_iter.type
+            && CA_OPTION_CONTENT_VERSION != opt_iter.type
             && COAP_OPTION_URI_HOST != opt_iter.type && COAP_OPTION_URI_PORT != opt_iter.type
             && COAP_OPTION_ETAG != opt_iter.type && COAP_OPTION_MAXAGE != opt_iter.type
             && COAP_OPTION_PROXY_SCHEME != opt_iter.type)
@@ -936,7 +936,7 @@ CAResult_t CAGetInfoFromPDU(const coap_pdu_t *pdu, const CAEndpoint_t *endpoint,
                     OIC_LOG(DEBUG, TAG, "option has an unsupported format");
                 }
             }
-            else if (COAP_OPTION_CONTENT_VERSION == opt_iter.type)
+            else if (CA_OPTION_CONTENT_VERSION == opt_iter.type)
             {
                 if (2 == COAP_OPT_LENGTH(option))
                 {
@@ -966,7 +966,7 @@ CAResult_t CAGetInfoFromPDU(const coap_pdu_t *pdu, const CAEndpoint_t *endpoint,
                 {
                     isProxyRequest = true;
                 }
-                else if (COAP_OPTION_ACCEPT_VERSION == opt_iter.type)
+                else if (CA_OPTION_ACCEPT_VERSION == opt_iter.type)
                 {
                     if (2 == COAP_OPT_LENGTH(option))
                     {
index 1ef7352..2106098 100644 (file)
@@ -647,6 +647,12 @@ extern "C" {
 #define OC_RSRVD_CERTIFICATE              "certificate"
 
 /**
+ * TODO: Move these COAP defines to CoAP lib once approved.
+ */
+#define COAP_OPTION_ACCEPT_VERSION 2049
+#define COAP_OPTION_CONTENT_VERSION 2053
+
+/**
  * These enums (OCTransportAdapter and OCTransportFlags) must
  * be kept synchronized with OCConnectivityType (below) as well as
  * CATransportAdapter and CATransportFlags (in CACommon.h).
index fe49c79..8b1845d 100755 (executable)
@@ -45,7 +45,6 @@
 #include "ocpayload.h"
 #include "payload_logging.h"
 #include "common.h"
-#include "cacommon.h"
 
 #ifdef ROUTING_GATEWAY
 /**
index dee4405..95a9bdf 100644 (file)
@@ -43,7 +43,6 @@
 #include "ocserver.h"
 #include "common.h"
 #include "oic_string.h"
-#include "cacommon.h"
 
 #define VERIFY_SUCCESS(op)                          \
 {                                                   \