replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / security / include / securevirtualresourcetypes.h
index 0f2ac78..f6de36c 100644 (file)
@@ -219,7 +219,7 @@ typedef enum OicSecDpm
     SECURITY_MANAGEMENT_SERVICES    = (0x1 << 3),
     PROVISION_CREDENTIALS           = (0x1 << 4),
     PROVISION_ACLS                  = (0x1 << 5),
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
     TAKE_SUB_OWNER                  = (0x1 << 6),
 #endif
     // << 7 THROUGH 15 RESERVED
@@ -235,13 +235,6 @@ typedef enum OicSecDpom
     SINGLE_SERVICE_CLIENT_DRIVEN      = (0x1 << 2),
 } OicSecDpom_t;
 
-typedef enum OicSecSvcType
-{
-    SERVICE_UNKNOWN                 = 0x0,
-    ACCESS_MGMT_SERVICE             = 0x1,  //urn:oic.sec.ams
-} OicSecSvcType_t;
-
-
 //TODO: Need more clarification on deviceIDFormat field type.
 #if 0
 typedef enum
@@ -261,7 +254,6 @@ typedef enum
     OIC_R_PCONF_TYPE,
     OIC_R_PSTAT_TYPE,
     OIC_R_SACL_TYPE,
-    OIC_R_SVC_TYPE,
     OIC_SEC_SVR_TYPE_COUNT, //define the value to number of SVR
     NOT_A_SVR_RESOURCE = 99
 }OicSecSvrType_t;
@@ -273,9 +265,11 @@ typedef enum
     OIC_MANUFACTURER_CERTIFICATE            = 0x2,
     OIC_DECENTRALIZED_PUBLIC_KEY            = 0x3,
     OIC_OXM_COUNT,
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
     OIC_PRECONFIG_PIN                       = 0xFF00,
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
+    OIC_MV_JUST_WORKS                       = 0xFF01,
+    OIC_CON_MFG_CERT                        = 0xFF02,
 }OicSecOxm_t;
 
 typedef enum
@@ -287,14 +281,14 @@ typedef enum
     OIC_ENCODING_DER = 4
 }OicEncodingType_t;
 
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
 typedef enum
 {
     MOT_STATUS_READY = 0,
     MOT_STATUS_IN_PROGRESS = 1,
     MOT_STATUS_DONE = 2,
 }MotStatus_t;
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
 
 /*
  * oic.sec.mom type definition
@@ -313,22 +307,22 @@ typedef enum
 
 typedef struct OicSecKey OicSecKey_t;
 
+typedef struct OicSecOpt OicSecOpt_t;
+
 typedef struct OicSecPstat OicSecPstat_t;
 
 typedef struct OicSecRole OicSecRole_t;
 
 typedef struct OicSecSacl OicSecSacl_t;
 
-typedef struct OicSecSvc OicSecSvc_t;
-
 typedef char *OicUrn_t; //TODO is URN type defined elsewhere?
 
 typedef struct OicUuid OicUuid_t; //TODO is UUID type defined elsewhere?
 
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
 typedef struct OicSecSubOwner OicSecSubOwner_t;
 typedef struct OicSecMom OicSecMom_t;
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
 
 
 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
@@ -369,6 +363,15 @@ struct OicSecKey
 
 };
 
+struct OicSecOpt
+{
+    uint8_t                *data;
+    size_t                  len;
+
+    OicEncodingType_t encoding;
+    bool                revstat;
+};
+
 struct OicSecRsrc
 {
     char *href; // 0:R:S:Y:String
@@ -395,7 +398,7 @@ struct OicSecAce
     OicSecRsrc_t *resources;            // 1:R:M:Y:Resource
     uint16_t permission;                // 2:R:S:Y:UINT16
     OicSecValidity_t *validities;       // 3:R:M:N:Time-interval
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
     OicUuid_t* eownerID;                //4:R:S:N:oic.uuid
 #endif
     OicSecAce_t *next;
@@ -442,20 +445,20 @@ struct OicSecCred
     //OicSecRole_t        *roleIds;       // 2:R:M:N:oic.sec.role
     OicSecCredType_t    credType;       // 3:R:S:Y:oic.sec.credtype
 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
-    OicSecCert_t        publicData;     // own cerificate chain
+    OicSecKey_t         publicData;     // own cerificate chain
     char            *credUsage;            // 4:R:S:N:String
-    OicSecKey_t        optionalData;   // CA's cerificate chain
+    OicSecOpt_t        optionalData;   // CA's cerificate chain
 #endif /* __WITH_DTLS__  or __WITH_TLS__*/
     OicSecKey_t         privateData;    // 6:R:S:N:oic.sec.key
     char                *period;        // 7:R:S:N:String
     OicUuid_t           rownerID;       // 8:R:S:Y:oic.uuid
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
     OicUuid_t           *eownerID;      //9:R:S:N:oic.uuid
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
     OicSecCred_t        *next;
 };
 
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
 struct OicSecSubOwner {
     OicUuid_t uuid;
     MotStatus_t status;
@@ -465,7 +468,7 @@ struct OicSecSubOwner {
 struct OicSecMom{
     OicSecMomType_t mode;
 };
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
 
 /**
  * /oic/sec/doxm (Device Owner Transfer Methods) data type
@@ -486,10 +489,10 @@ struct OicSecDoxm
     OicUuid_t           deviceID;       // 6:R:S:Y:oic.uuid
     bool                dpc;            // 7:R:S:Y:Boolean
     OicUuid_t           owner;          // 8:R:S:Y:oic.uuid
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
     OicSecSubOwner_t* subOwners;        //9:R/W:M:N:oic.uuid
     OicSecMom_t *mom;                   //10:R/W:S:N:oic.sec.mom
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
     OicUuid_t           rownerID;       // 11:R:S:Y:oic.uuid
 };
 
@@ -534,20 +537,6 @@ struct OicSecSacl
 #endif
 };
 
-/**
- * /oic/sec/svc (Service requiring a secure connection) data type.
- * Derived from OIC Security Spec; see Spec for details.
- */
-struct OicSecSvc
-{
-    // <Attribute ID>:<Read/Write>:<Multiple/Single>:<Mandatory?>:<Type>
-    OicUuid_t               svcdid;                 //0:R:S:Y:oic.uuid
-    OicSecSvcType_t         svct;                   //1:R:M:Y:OIC Service Type
-    size_t                  ownersLen;              //2:the number of elts in Owners
-    OicUuid_t               *owners;                //3:R:M:Y:oic.uuid
-    OicSecSvc_t             *next;
-};
-
 #if defined(__WITH_DTLS__) ||  defined(__WITH_TLS__)
 struct OicSecCrl
 {
@@ -634,7 +623,7 @@ struct OicSecDpairing
     OicUuid_t           rownerID;          // 2:R:S:Y:oic.uuid
 };
 
-#define MAX_VERSION_LEN 16 // Security Version length. i.e., 00.00.000 + reserved space
+#define OIC_SEC_MAX_VER_LEN 16 // Security Version length. i.e., 00.00.000 + reserved space
 
 /**
  * @brief   security version data type
@@ -647,7 +636,7 @@ typedef struct OicSecVer OicSecVer_t;
 struct OicSecVer
 {
     // <Attribute ID>:<Read/Write>:<Multiple/Single>:<Mandatory?>:<Type>
-    char              secv[MAX_VERSION_LEN];          // 0:R:S:Y:String
+    char              secv[OIC_SEC_MAX_VER_LEN];          // 0:R:S:Y:String
     OicUuid_t       deviceID;     // 1:R:S:Y:oic.uuid
 };