6da4371b062228104dc78fd7a744d8e09e712589
[platform/upstream/iotivity.git] / service / notification / src / common / NSStructs.h
1 //******************************************************************\r
2 //\r
3 // Copyright 2016 Samsung Electronics All Rights Reserved.\r
4 //\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
6 //\r
7 // Licensed under the Apache License, Version 2.0 (the "License");\r
8 // you may not use this file except in compliance with the License.\r
9 // You may obtain a copy of the License at\r
10 //\r
11 //      http://www.apache.org/licenses/LICENSE-2.0\r
12 //\r
13 // Unless required by applicable law or agreed to in writing, software\r
14 // distributed under the License is distributed on an "AS IS" BASIS,\r
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 // See the License for the specific language governing permissions and\r
17 // limitations under the License.\r
18 //\r
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
20 \r
21 #ifndef _NS_STRUCTS_H_\r
22 #define _NS_STRUCTS_H_\r
23 \r
24 #include <string.h>\r
25 #include <stdlib.h>\r
26 #include <stdio.h>\r
27 #include <stdbool.h>\r
28 #include <octypes.h>\r
29 #include "NSCommon.h"\r
30 #include "NSConstants.h"\r
31 #include "ocstack.h"\r
32 \r
33 typedef struct _nsTask\r
34 {\r
35     NSTaskType taskType;\r
36     void * taskData;\r
37     struct _nsTask * nextTask;\r
38 } NSTask;\r
39 \r
40 typedef struct\r
41 {\r
42     NSTopicLL * head;\r
43     NSTopicLL * tail;\r
44     char consumerId[NS_UUID_STRING_SIZE];\r
45     NSTopicLL ** topics;\r
46 \r
47 } NSTopicList;\r
48 \r
49 typedef void * NSCacheData;\r
50 \r
51 typedef struct _NSCacheElement\r
52 {\r
53     NSCacheData * data;\r
54     struct _NSCacheElement * next;\r
55 } NSCacheElement;\r
56 \r
57 typedef struct\r
58 {\r
59     NSCacheType cacheType;\r
60     NSCacheElement * head;\r
61     NSCacheElement * tail;\r
62 } NSCacheList;\r
63 \r
64 typedef struct\r
65 {\r
66     char id[NS_UUID_STRING_SIZE];\r
67     int syncObId; // sync resource observer ID for local consumer\r
68     int messageObId; // message resource observer ID for local consumer\r
69     int remote_syncObId; //sync observer ID subscribed through remote server\r
70     int remote_messageObId; //message observer ID subscribed through remote server\r
71     bool isWhite; // access state -> True: allowed / False: blocked\r
72 } NSCacheSubData;\r
73 \r
74 typedef struct\r
75 {\r
76     char * id;\r
77     int messageType; // noti = 1, read = 2, dismiss = 3\r
78     NSMessage * nsMessage;\r
79 } NSCacheMsgData;\r
80 \r
81 typedef struct\r
82 {\r
83     char * topicName;\r
84     NSTopicState state;\r
85 \r
86 } NSCacheTopicData;\r
87 \r
88 typedef struct\r
89 {\r
90     char id[NS_UUID_STRING_SIZE];\r
91     char * topicName;\r
92 \r
93 } NSCacheTopicSubData;\r
94 \r
95 typedef struct\r
96 {\r
97     OCResourceHandle handle;\r
98     char providerId[NS_UUID_STRING_SIZE];\r
99     char * version;\r
100     bool policy;\r
101     char * message_uri;\r
102     char * sync_uri;\r
103 \r
104     //optional\r
105     char * topic_uri;\r
106 } NSNotificationResource;\r
107 \r
108 typedef struct\r
109 {\r
110     OCResourceHandle handle;\r
111 \r
112     uint64_t messageId;\r
113     char providerId[NS_UUID_STRING_SIZE];\r
114 \r
115     //optional\r
116     NSMessageType type;\r
117     char * dateTime;\r
118     uint64_t ttl;\r
119     char * title;\r
120     char * contentText;\r
121     char * sourceName;\r
122     char * topicName;\r
123     NSMediaContents * mediaContents;\r
124 } NSMessageResource;\r
125 \r
126 typedef struct\r
127 {\r
128     OCResourceHandle handle;\r
129     uint64_t messageId;\r
130     char providerId[NS_UUID_STRING_SIZE];\r
131     char * state;\r
132 } NSSyncResource;\r
133 \r
134 typedef struct\r
135 {\r
136     OCResourceHandle handle;\r
137     char providerId[NS_UUID_STRING_SIZE];\r
138     char consumerId[NS_UUID_STRING_SIZE];\r
139     NSTopicList ** TopicList;\r
140 } NSTopicResource;\r
141 \r
142 typedef struct\r
143 {\r
144     char providerId[NS_UUID_STRING_SIZE];\r
145     char * providerName;\r
146     char * userInfo;\r
147 } NSProviderInfo;\r
148 \r
149 #endif /* _NS_STRUCTS_H_ */\r