replace : iotivity -> iotivity-sec
[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 \r
39 } NSTask;\r
40 \r
41 typedef struct\r
42 {\r
43     NSTopicLL * head;\r
44     NSTopicLL * tail;\r
45     char consumerId[NS_UUID_STRING_SIZE];\r
46     NSTopicLL ** topics;\r
47 \r
48 } NSTopicList;\r
49 \r
50 typedef void * NSCacheData;\r
51 \r
52 typedef struct _NSCacheElement\r
53 {\r
54     NSCacheData * data;\r
55     struct _NSCacheElement * next;\r
56 \r
57 } NSCacheElement;\r
58 \r
59 typedef struct\r
60 {\r
61     NSCacheType cacheType;\r
62     NSCacheElement * head;\r
63     NSCacheElement * tail;\r
64 \r
65 } NSCacheList;\r
66 \r
67 typedef struct\r
68 {\r
69     char id[NS_UUID_STRING_SIZE];\r
70     int syncObId; // sync resource observer ID for local consumer\r
71     int messageObId; // message resource observer ID for local consumer\r
72     int remote_syncObId; //sync observer ID subscribed through remote server\r
73     int remote_messageObId; //message observer ID subscribed through remote server\r
74     bool isWhite; // access state -> True: allowed / False: blocked\r
75 \r
76 } NSCacheSubData;\r
77 \r
78 typedef struct\r
79 {\r
80     char * id;\r
81     int messageType; // noti = 1, read = 2, dismiss = 3\r
82     NSMessage * nsMessage;\r
83 \r
84 } NSCacheMsgData;\r
85 \r
86 typedef struct\r
87 {\r
88     char * topicName;\r
89     NSTopicState state;\r
90 \r
91 } NSCacheTopicData;\r
92 \r
93 typedef struct\r
94 {\r
95     char id[NS_UUID_STRING_SIZE];\r
96     char * topicName;\r
97 \r
98 } NSCacheTopicSubData;\r
99 \r
100 typedef struct\r
101 {\r
102     OCResourceHandle handle;\r
103     char providerId[NS_UUID_STRING_SIZE];\r
104     char * version;\r
105     bool policy;\r
106     char * message_uri;\r
107     char * sync_uri;\r
108 \r
109     //optional\r
110     char * topic_uri;\r
111 \r
112 } NSNotificationResource;\r
113 \r
114 typedef struct\r
115 {\r
116     OCResourceHandle handle;\r
117 \r
118     uint64_t messageId;\r
119     char providerId[NS_UUID_STRING_SIZE];\r
120 \r
121     //optional\r
122     NSMessageType type;\r
123     char * dateTime;\r
124     uint64_t ttl;\r
125     char * title;\r
126     char * contentText;\r
127     char * sourceName;\r
128     char * topicName;\r
129     NSMediaContents * mediaContents;\r
130 \r
131 } NSMessageResource;\r
132 \r
133 typedef struct\r
134 {\r
135     OCResourceHandle handle;\r
136     uint64_t messageId;\r
137     char providerId[NS_UUID_STRING_SIZE];\r
138     char * state;\r
139 \r
140 } NSSyncResource;\r
141 \r
142 typedef struct\r
143 {\r
144     OCResourceHandle handle;\r
145     char providerId[NS_UUID_STRING_SIZE];\r
146     char consumerId[NS_UUID_STRING_SIZE];\r
147     NSTopicList ** TopicList;\r
148 \r
149 } NSTopicResource;\r
150 \r
151 typedef struct\r
152 {\r
153     char providerId[NS_UUID_STRING_SIZE];\r
154     char * providerName;\r
155     char * userInfo;\r
156 \r
157 } NSProviderInfo;\r
158 \r
159 #ifdef WITH_MQ\r
160 typedef struct\r
161 {\r
162     char * serverAddr;\r
163     char * topicName;\r
164 \r
165 } NSMQTopicAddress;\r
166 \r
167 typedef struct\r
168 {\r
169     char * serverUri;\r
170     OCDevAddr * devAddr;\r
171 \r
172 } NSMQServerInfo;\r
173 #endif\r
174 \r
175 #endif /* _NS_STRUCTS_H_ */\r