Undo revert "Generate iotivity_config.h at build time"
[platform/upstream/iotivity.git] / resource / csdk / connectivity / api / cacommon.h
index d9c2c47..cedc763 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef CA_COMMON_H_
 #define CA_COMMON_H_
 
+#include "iotivity_config.h"
+
 #ifndef WITH_ARDUINO
 #ifdef TCP_ADAPTER
 #define HAVE_SYS_POLL_H
@@ -51,7 +53,7 @@ extern "C"
 #endif
 
 /**
- * IP address Length
+ * IP address Length.
  */
 #define CA_IPADDR_SIZE 16
 
@@ -61,22 +63,22 @@ extern "C"
 #define CA_RAJABBERID_SIZE 256
 
 /**
- * Mac address length for BT port
+ * Mac address length for BT port.
  */
 #define CA_MACADDR_SIZE 18
 
 /**
- * Max header options data length
+ * Max header options data length.
  */
 #define CA_MAX_HEADER_OPTION_DATA_LENGTH 20
 
 /**
-* Max token length
+* Max token length.
 */
 #define CA_MAX_TOKEN_LEN (8)
 
 /**
- * Max URI length
+ * Max URI length.
  */
 #ifdef ARDUINO
 #define CA_MAX_URI_LENGTH 128  /* maximum size of URI for embedded platforms*/
@@ -85,7 +87,7 @@ extern "C"
 #endif
 
 /**
- * Max PDU length supported
+ * Max PDU length supported.
  */
 #ifdef ARDUINO
 #define COAP_MAX_PDU_SIZE           320  /* maximum size of a CoAP PDU for embedded platforms*/
@@ -98,12 +100,12 @@ extern "C"
 #endif
 
 /**
- *Maximum length of the remoteEndpoint identity
+ *Maximum length of the remoteEndpoint identity.
  */
 #define CA_MAX_ENDPOINT_IDENTITY_LEN   (32)
 
 /**
- * option types - the highest option number 63
+ * option types - the highest option number 63.
  */
 #define CA_OPTION_IF_MATCH 1
 #define CA_OPTION_ETAG 4
@@ -119,7 +121,7 @@ extern "C"
 #define CA_OPTION_LOCATION_QUERY 20
 
 /**
- * Payload information from resource model
+ * Payload information from resource model.
  */
 typedef uint8_t *CAPayload_t;
 
@@ -129,12 +131,12 @@ typedef uint8_t *CAPayload_t;
 typedef char *CAURI_t;
 
 /**
- * Token information for mapping the request and responses by resource model
+ * Token information for mapping the request and responses by resource model.
  */
 typedef char *CAToken_t;
 
 /*
- * Socket types and error definitions
+ * Socket types and error definitions.
  */
 #ifdef HAVE_WINSOCK2_H
 # define OC_SOCKET_ERROR      SOCKET_ERROR
@@ -208,7 +210,6 @@ typedef enum
 #define CA_SCOPE_MASK 0xf     // mask scope bits above
 
 /**
- * @enum CANetworkStatus_t
  * Information about the network status.
  */
 typedef enum
@@ -218,7 +219,7 @@ typedef enum
 } CANetworkStatus_t;
 
 /*
- * remoteEndpoint identity
+ * remoteEndpoint identity.
  */
 typedef struct
 {
@@ -227,8 +228,7 @@ typedef struct
 } CARemoteId_t;
 
 /**
- * @enum CAMessageType_t
- * Message Type for Base source code
+ * Message Type for Base source code.
  */
 typedef enum
 {
@@ -240,8 +240,7 @@ typedef enum
 } CAMessageType_t;
 
 /**
- * @enum CAMethod_t
- * Allowed method to be used by resource model
+ * Allowed method to be used by resource model.
  */
 typedef enum
 {
@@ -252,7 +251,7 @@ typedef enum
 } CAMethod_t;
 
 /**
- * block size
+ * block size.
  * it depends on defined size in libCoAP.
  */
 typedef enum
@@ -267,7 +266,7 @@ typedef enum
 } CABlockSize_t;
 
 /**
- * Endpoint information for connectivities
+ * Endpoint information for connectivities.
  * Must be identical to OCDevAddr.
  */
 typedef struct
@@ -284,17 +283,18 @@ typedef struct
 } CAEndpoint_t;
 
 /**
- * Endpoint information for secure messages
+ * Endpoint information for secure messages.
  */
 typedef struct
 {
     CAEndpoint_t endpoint;      /**< endpoint */
-    CARemoteId_t identity;      /**< endpoint identity */
+    // TODO change name to deviceId
+    CARemoteId_t identity;      /**< endpoint device uuid */
+    CARemoteId_t userId;        /**< endpoint user uuid */
 } CASecureEndpoint_t;
 
 /**
- * @enum CAResult_t
- * Enums for CA return values
+ * Enums for CA return values.
  */
 typedef enum
 {
@@ -319,8 +319,7 @@ typedef enum
 } CAResult_t;
 
 /**
- * @enum CAResponseResult_t
- * Enums for CA Response values
+ * Enums for CA Response values.
  */
 typedef enum
 {
@@ -347,8 +346,20 @@ typedef enum
 } CAResponseResult_t;
 
 /**
- * @enum CATransportProtocolID_t
- * Transport Protocol IDs for additional options
+ * Data type whether the data is Request Message or Response Message.
+ * if there is some failure before send data on network.
+ * Type will be set as error type for error callback.
+ */
+typedef enum
+{
+    CA_REQUEST_DATA = 1,
+    CA_RESPONSE_DATA,
+    CA_ERROR_DATA,
+    CA_RESPONSE_FOR_RES
+} CADataType_t;
+
+/**
+ * Transport Protocol IDs for additional options.
  */
 typedef enum
 {
@@ -357,7 +368,6 @@ typedef enum
 } CATransportProtocolID_t;
 
 /**
- * @enum CAAdapterState_t
  * Adapter State to indicate the network changed notifications.
  */
 typedef enum
@@ -384,7 +394,7 @@ typedef enum
 } CAPayloadFormat_t;
 
 /**
- * Header options structure to be filled
+ * Header options structure to be filled.
  *
  * This structure is used to hold header information.
  */
@@ -398,9 +408,9 @@ typedef struct
 } CAHeaderOption_t;
 
 /**
- * Base Information received
+ * Base Information received.
  *
- * This structure is used to hold request & response base information
+ * This structure is used to hold request & response base information.
  */
 typedef struct
 {
@@ -422,12 +432,13 @@ typedef struct
     CAPayloadFormat_t acceptFormat;     /**< accept format for the response payload */
     CAURI_t resourceUri;        /**< Resource URI information **/
     CARemoteId_t identity;      /**< endpoint identity */
+    CADataType_t dataType;      /**< data type */
 } CAInfo_t;
 
 /**
- * Request Information to be sent
+ * Request Information to be sent.
  *
- * This structure is used to hold request information
+ * This structure is used to hold request information.
  */
 typedef struct
 {
@@ -437,9 +448,9 @@ typedef struct
 } CARequestInfo_t;
 
 /**
- * Response information received
+ * Response information received.
  *
- * This structure is used to hold response information
+ * This structure is used to hold response information.
  */
 typedef struct
 {
@@ -450,9 +461,9 @@ typedef struct
 
 /**
  * Error information from CA
- *        contains error code and message information
+ *        contains error code and message information.
  *
- * This structure holds error information
+ * This structure holds error information.
  */
 typedef struct
 {
@@ -462,7 +473,7 @@ typedef struct
 } CAErrorInfo_t;
 
 /**
- * Hold global variables for CA layer (also used by RI layer)
+ * Hold global variables for CA layer. (also used by RI layer)
  */
 typedef struct
 {
@@ -487,7 +498,7 @@ typedef struct
 } CAHistory_t;
 
 /**
- * Hold interface index for keeping track of comings and goings
+ * Hold interface index for keeping track of comings and goings.
  */
 typedef struct
 {