Add structs for topic cache.
[platform/upstream/iotivity.git] / service / notification / src / common / NSStructs.h
index adc7467..6ab9729 100644 (file)
 #include <stdlib.h>\r
 #include <stdio.h>\r
 #include <stdbool.h>\r
+#include <octypes.h>\r
 #include "NSCommon.h"\r
 #include "NSConstants.h"\r
+#include "ocstack.h"\r
 \r
 typedef struct _nsTask\r
 {\r
     NSTaskType taskType;\r
-    void* taskData;\r
-    struct _nsTask* nextTask;\r
+    void * taskData;\r
+    struct _nsTask * nextTask;\r
 } NSTask;\r
 \r
 typedef void * NSCacheData;\r
@@ -52,25 +54,45 @@ typedef struct
 \r
 typedef struct\r
 {\r
-    char * id; // ip\r
-    int syncObId;\r
-    int messageObId;\r
-    bool isWhite;\r
+    char id[37];\r
+    int syncObId; // sync resource observer ID for local consumer\r
+    int messageObId; // message resource observer ID for local consumer\r
+    int remote_syncObId; //sync observer ID subscribed through remote server\r
+    int remote_messageObId; //message observer ID subscribed through remote server\r
+    bool isWhite; // access state -> True: allowed / False: blocked\r
 } NSCacheSubData;\r
 \r
 typedef struct\r
 {\r
-    char * id; // ip ? ? ?\r
+    char * id;\r
     int messageType; // noti = 1, read = 2, dismiss = 3\r
     NSMessage * nsMessage;\r
 } NSCacheMsgData;\r
 \r
 typedef struct\r
 {\r
+    char * topicName;\r
+    NSTopicState state;\r
+\r
+} NSCacheTopicData;\r
+\r
+typedef struct\r
+{\r
+    char id[37];\r
+    char * topicName;\r
+    NSTopicState state;\r
+\r
+} NSCacheTopicSubData;\r
+\r
+typedef struct\r
+{\r
     OCResourceHandle handle;\r
     int accepter;\r
-    char* message_uri;\r
-    char* sync_uri;\r
+    char * message_uri;\r
+    char * sync_uri;\r
+\r
+    //optional\r
+    char * topic_uri;\r
 } NSNotificationResource;\r
 \r
 typedef struct\r
@@ -93,14 +115,22 @@ typedef struct
 typedef struct\r
 {\r
     OCResourceHandle handle;\r
-    char* id;\r
-    char* state;\r
+    char * id;\r
+    char * state;\r
 } NSSyncResource;\r
 \r
 typedef struct\r
 {\r
-  char providerId[37];\r
-  char * providerName;\r
+    OCResourceHandle handle;\r
+    char consumerId[37];\r
+    NSTopicList ** TopicList;\r
+} NSTopicResource;\r
+\r
+typedef struct\r
+{\r
+    char providerId[37];\r
+    char * providerName;\r
+    char * userInfo;\r
 } NSProviderInfo;\r
 \r
 #endif /* _NS_STRUCTS_H_ */\r