add deregister of observe and delete subscription list from observeid
[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 "NSCommon.h"\r
29 #include "NSConstants.h"\r
30 \r
31 typedef struct _nsTask\r
32 {\r
33     NSTaskType taskType;\r
34     void * taskData;\r
35     struct _nsTask * nextTask;\r
36 } NSTask;\r
37 \r
38 typedef void * NSCacheData;\r
39 \r
40 typedef struct _NSCacheElement\r
41 {\r
42     NSCacheData * data;\r
43     struct _NSCacheElement * next;\r
44 } NSCacheElement;\r
45 \r
46 typedef struct\r
47 {\r
48     NSCacheType cacheType;\r
49     NSCacheElement * head;\r
50     NSCacheElement * tail;\r
51 } NSCacheList;\r
52 \r
53 typedef struct\r
54 {\r
55     char id[37];\r
56     int syncObId; // sync resource observer ID for local consumer\r
57     int messageObId; // message resource observer ID for local consumer\r
58     int remote_syncObId; //sync observer ID subscribed through remote server\r
59     int remote_messageObId; //message observer ID subscribed through remote server\r
60     bool isWhite; // access state -> True: allowed / False: blocked\r
61 } NSCacheSubData;\r
62 \r
63 typedef struct\r
64 {\r
65     char * id;\r
66     int messageType; // noti = 1, read = 2, dismiss = 3\r
67     NSMessage * nsMessage;\r
68 } NSCacheMsgData;\r
69 \r
70 typedef struct\r
71 {\r
72     OCResourceHandle handle;\r
73     int accepter;\r
74     char * message_uri;\r
75     char * sync_uri;\r
76 } NSNotificationResource;\r
77 \r
78 typedef struct\r
79 {\r
80     OCResourceHandle handle;\r
81 \r
82     uint64_t messageId;\r
83     char providerId[37];\r
84 \r
85     //optional\r
86     NSMessageType type;\r
87     char * dateTime;\r
88     uint64_t ttl;\r
89     char * title;\r
90     char * contentText;\r
91     char * sourceName;\r
92     NSMediaContents * mediaContents;\r
93 } NSMessageResource;\r
94 \r
95 typedef struct\r
96 {\r
97     OCResourceHandle handle;\r
98     char * id;\r
99     char * state;\r
100 } NSSyncResource;\r
101 \r
102 typedef struct\r
103 {\r
104     char providerId[37];\r
105     char * providerName;\r
106 } NSProviderInfo;\r
107 \r
108 #endif /* _NS_STRUCTS_H_ */\r