Implementation of connectivity abstraction feature Release v0.61
[platform/upstream/iotivity.git] / resource / csdk / connectivity / api / cacommon.h
index a1dd635..4414129 100644 (file)
@@ -71,19 +71,40 @@ extern "C"
 #define CA_OPTION_OBSERVE 6
 
 /**
+ @brief Max length of ID
+ */
+#define DTLS_PSK_ID_LEN 16
+
+/**
+ @brief Max length of PSK
+ */
+#define DTLS_PSK_PSK_LEN 16
+
+/**
+ @brief version
+ */
+#define DtlsPskCredsBlobVer_1 1
+
+/**
+ @brief current version
+ */
+#define DtlsPskCredsBlobVer_CurrentVersion DtlsPskCredsBlobVer_1
+
+
+/**
  @brief Payload information from resource model
  */
-typedef charCAPayload_t;
+typedef char *CAPayload_t;
 
 /**
  @brief URI for the OIC base.CA considers relative URI as the URI.
  */
-typedef charCAURI_t;
+typedef char *CAURI_t;
 
 /**
  @brief Token information for mapping the request and responses by resource model
  */
-typedef charCAToken_t;
+typedef char *CAToken_t;
 
 /**
  @brief Boolean value used for specifying the success or failure
@@ -183,6 +204,8 @@ typedef struct
     CAAddress_t addressInfo;
     /** Connectivity of the endpoint**/
     CAConnectivityType_t connectivityType;
+    /** Secure connection**/
+    CABool_t isSecured;
 } CARemoteEndpoint_t;
 
 
@@ -206,6 +229,8 @@ typedef struct
     CAAddress_t addressInfo;
     /** Connectivity type that localconnectivity avaialble **/
     CAConnectivityType_t type;
+    /** Secure connection**/
+    CABool_t isSecured;
 } CALocalConnectivity_t;
 
 /**
@@ -228,7 +253,7 @@ typedef enum
     CA_DESTINATION_DISCONNECTED,
     CA_STATUS_FAILED,
     CA_NOT_SUPPORTED
-/* Result code - END HERE */
+    /* Result code - END HERE */
 } CAResult_t;
 
 /**
@@ -243,7 +268,7 @@ typedef enum
     CA_BAD_REQ = 400,
     CA_BAD_OPT = 402,
     CA_NOT_FOUND = 404
-/* Response status code - END HERE */
+                   /* Response status code - END HERE */
 } CAResponseResult_t;
 
 /**
@@ -281,10 +306,14 @@ typedef struct
 {
     /**Qos for the request **/
     CAMessageType_t type;
+    /** Message id.
+     * if message id is zero, it will generated by CA inside.
+     * otherwise, you can use it.**/
+    uint16_t messageId;
     /** Token for CA**/
     CAToken_t token;
     /** Header Options for the request **/
-    CAHeaderOption_t * options;
+    CAHeaderOption_t *options;
     /** Number of Header options**/
     uint8_t numOptions;
     /** payload of the request **/
@@ -317,6 +346,29 @@ typedef struct
     CAInfo_t info;
 } CAResponseInfo_t;
 
+/**
+ * Credentials for a device. Includes identity and the associated PSK.
+ */
+typedef struct
+{
+   unsigned char clientIdentity[DTLS_PSK_ID_LEN];
+   unsigned char rsClientPsk[DTLS_PSK_PSK_LEN];
+} CADtlsPskCreds_t;
+
+/**
+ * Binary blob containing device identity and the credentials for all devices
+ * trusted by this device.
+ */
+typedef struct
+{
+   uint16_t blobVer;                        /**< version of the blob */
+   uint16_t reserved;                       /**< reserved for future use */
+   unsigned char rsIdentity[DTLS_PSK_ID_LEN]; /**< identity of self */
+   uint32_t num;                            /**< number of credentials in this blob */
+   CADtlsPskCreds_t *creds;                 /**< list of credentials. Size of this
+                                                 array is determined by 'num' variable. */
+} CADtlsPskCredsBlob_t;
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif