replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / include / NSCommon.h
1 //******************************************************************
2 //
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 /**
22  * @file
23  *
24  * This file provides APIs of Notification Service for common functions.
25  */
26
27 #ifndef _NS_COMMON_H_
28 #define _NS_COMMON_H_
29
30 #include <stdint.h>
31 #include <octypes.h>
32
33 #define NS_UUID_STRING_SIZE 37
34 //#define WITH_MQ
35 /**
36  * Result code of notification service
37  */
38 typedef enum eResult
39 {
40     NS_OK = 100,
41     NS_ERROR = 200,
42     NS_SUCCESS = 300,
43     NS_FAIL = 400,
44
45 } NSResult;
46
47 /**
48  * Provider state of notification consumer service
49  */
50 typedef enum
51 {
52     NS_ALLOW = 1,
53     NS_DENY = 2,
54     NS_TOPIC = 3,
55     NS_DISCOVERED = 11,
56     NS_STOPPED = 12
57 } NSProviderState;
58
59 /**
60  * Notification message status to synchronize
61  */
62 typedef enum
63 {
64     NS_SYNC_UNREAD = 0,
65     NS_SYNC_READ = 1,
66     NS_SYNC_DELETED = 2,
67
68 } NSSyncType;
69
70 /**
71  * Notification Message Type
72  * Alert mean is High / critical
73  * Notice mean is low / critical
74  * Event mean is High / Normal
75  * Information mean is Low / Normal
76  */
77 typedef enum
78 {
79     NS_MESSAGE_ALERT = 1,
80     NS_MESSAGE_NOTICE = 2,
81     NS_MESSAGE_EVENT = 3,
82     NS_MESSAGE_INFO = 4,
83     NS_MESSAGE_WARNING = 5,
84     NS_MESSAGE_READ = 11,
85     NS_MESSAGE_DELETED = 12
86
87 } NSMessageType;
88
89 /**
90  *  Notification topic state
91  */
92 typedef enum
93 {
94     NS_TOPIC_UNSUBSCRIBED = 0,
95     NS_TOPIC_SUBSCRIBED = 1,
96
97 } NSTopicState;
98
99 /**
100  * Topic linked list
101  */
102 typedef struct _nsTopic
103 {
104     char * topicName;
105     NSTopicState state;
106     struct _nsTopic * next;
107
108 } NSTopicLL;
109
110 /**
111  *  Consumer information
112  */
113 typedef struct
114 {
115     char consumerId[NS_UUID_STRING_SIZE];
116
117 } NSConsumer;
118
119 /**
120  *  Provider information
121  */
122 typedef struct
123 {
124     char providerId[NS_UUID_STRING_SIZE];
125
126 } NSProvider;
127
128 /**
129  *  Media Contents of Notification Message (Optional)
130  */
131 typedef struct
132 {
133     char * iconImage;
134
135 } NSMediaContents;
136
137 /**
138  *  Notification Message
139  */
140 typedef struct
141 {
142     //Mandatory
143     uint64_t messageId;
144     char providerId[NS_UUID_STRING_SIZE];
145
146     //optional
147     NSMessageType type;
148     char * dateTime;
149     uint64_t ttl;
150     char * title;
151     char * contentText;
152     char * sourceName;
153     NSMediaContents * mediaContents;
154     char * topic;
155     OCRepPayload * extraInfo;
156
157 } NSMessage;
158
159 /**
160  *  Synchronization information of the notification message
161  */
162 typedef struct
163 {
164     uint64_t messageId;
165     char providerId[NS_UUID_STRING_SIZE];
166     NSSyncType state;
167
168 } NSSyncInfo;
169
170 #endif /* _NS_COMMON_H_ */
171