Imported Upstream version 1.1.1
[platform/upstream/iotivity.git] / resource / csdk / security / include / securevirtualresourcetypes.h
index 786658e..7b16739 100644 (file)
@@ -162,6 +162,12 @@ static inline bool IsAccessGranted(SRMAccessResponse_t response)
     }
 }
 
+typedef struct OicSecRsrc OicSecRsrc_t;
+
+typedef struct OicSecValidity OicSecValidity_t;
+
+typedef struct OicSecAce OicSecAce_t;
+
 typedef struct OicSecAcl OicSecAcl_t;
 
 typedef struct OicSecAmacl OicSecAmacl_t;
@@ -261,6 +267,13 @@ typedef enum
     OIC_OXM_COUNT
 }OicSecOxm_t;
 
+typedef enum
+{
+    OIC_ENCODING_UNKNOW = 0,
+    OIC_ENCODING_RAW = 1,
+    OIC_ENCODING_BASE64 = 2
+}OicEncodingType_t;
+
 typedef struct OicSecKey OicSecKey_t;
 
 typedef struct OicSecPstat OicSecPstat_t;
@@ -308,6 +321,39 @@ struct OicSecKey
 {
     uint8_t                *data;
     size_t                  len;
+
+    // TODO: This field added as workaround. Will be replaced soon.
+    OicEncodingType_t encoding;
+
+};
+
+struct OicSecRsrc
+{
+    char *href; // 0:R:S:Y:String
+    char *rel; // 1:R:S:N:String
+    char** types; // 2:R:S:N:String Array
+    size_t typeLen; // the number of elts in types
+    char** interfaces; // 3:R:S:N:String Array
+    size_t interfaceLen; // the number of elts in interfaces
+    OicSecRsrc_t *next;
+};
+
+struct OicSecValidity
+{
+    char* period; // 0:R:S:Y:String
+    char** recurrences; // 1:R:M:Y:Array of String
+    size_t recurrenceLen; // the number of elts in recurrence
+    OicSecValidity_t *next;
+};
+
+struct OicSecAce
+{
+    // <Attribute ID>:<Read/Write>:<Multiple/Single>:<Mandatory?>:<Type>
+    OicUuid_t subjectuuid; // 0:R:S:Y:uuid
+    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
+    OicSecAce_t *next;
 };
 
 /**
@@ -317,17 +363,8 @@ struct OicSecKey
 struct OicSecAcl
 {
     // <Attribute ID>:<Read/Write>:<Multiple/Single>:<Mandatory?>:<Type>
-    OicUuid_t           subject;        // 0:R:S:Y:uuid TODO: this deviates
-                                        // from spec and needs to be updated
-                                        // in spec (where it's a String).
-    size_t              resourcesLen;   // the number of elts in Resources
-    char                **resources;    // 1:R:M:Y:String
-    uint16_t            permission;     // 2:R:S:Y:UINT16
-    size_t              prdRecrLen;     // the number of elts in Periods
-    char                **periods;       // 3:R:M*:N:String (<--M*; see Spec)
-    char                **recurrences;   // 5:R:M:N:String
-    OicUuid_t           rownerID;        // 8:R:S:Y:oic.uuid
-    OicSecAcl_t         *next;
+    OicUuid_t           rownerID;        // 0:R:S:Y:oic.uuid
+    OicSecAce_t         *aces; // 1:R:M:N:ACE
 };
 
 /**