added cacheadapter interface and memorycache of notification.
[platform/upstream/iotivity.git] / service / notification / src / common / NSConstants.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 #ifndef _NS_CONSTANTS_H_
22 #define _NS_CONSTANTS_H_
23
24 #define __NS_FILE__ ( strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__ )
25
26 #ifdef TB_LOG
27 #include "logger.h"
28 #define NS_LOG_V(level, format, ...) (OIC_LOG_V((level), __NS_FILE__, (format), __VA_ARGS__))
29 #define NS_LOG(level, msg) (OIC_LOG((level), __NS_FILE__, (msg)))
30 #else
31 #include "logger.h"
32 #define NS_CONVERT_LEVEL(level) ( \
33         ((level) == 0) ? "DEBUG" : \
34         ((level) == 1) ? "INFO" : \
35         ((level) == 2) ? "WARNING" : \
36         ((level) == 3) ? "ERROR" : "FATAL")
37 #define NS_LOG_V(level, format, ...) { \
38         printf("%s: %s ", NS_CONVERT_LEVEL(level), __NS_FILE__); \
39         printf((format), __VA_ARGS__); \
40         printf("\n"); }
41 #define NS_LOG(level, msg) { \
42         printf("%s: %s ", NS_CONVERT_LEVEL(level), __NS_FILE__); \
43         printf((msg)); \
44         printf("\n"); }
45 #endif
46
47 #define NS_TAG "IOT_NOTI"
48
49 // SCHEDULE //
50 #define THREAD_COUNT 4
51
52 // NOTIOBJ // 
53 #define NOTIOBJ_TITLE_KEY "title"
54 #define NOTIOBJ_ID_KEY "id"
55 #define NOTOOBJ_CONTENT_KEY "contentText"
56
57 #define DISCOVERY_TAG "NS_PROVIDER_DISCOVERY"
58 #define SUBSCRIPTION_TAG "NS_PROVIDER_SUBSCRIPTION"
59 #define INTERFACE_TAG "NS_PROVIDER_INTERFACE"
60 #define NOTIFICATION_TAG "NS_PROVIDER_NOTIFICATION"
61 #define SCHEDULER_TAG "NS_PROVIDER_SCHEDULER"
62 #define LISTENER_TAG "NS_PROVIDER_LISTENER"
63 #define RESOURCE_TAG "NS_PROVIDER_RESOURCE"
64
65 typedef enum eConnectionState
66 {
67     DISCONNECTED = 0,
68     CONNECTED = 1,
69
70 } NSConnectionState;
71
72 typedef enum eSchedulerType
73 {
74     RESPONSE_SCHEDULER = 0,
75     DISCOVERY_SCHEDULER = 1,
76     SUBSCRIPTION_SCHEDULER = 2,
77     NOTIFICATION_SCHEDULER = 3,
78 } NSSchedulerType;
79
80
81 typedef enum eTaskType
82 {
83     TASK_REGISTER_RESOURCE = 1000,
84
85     TASK_START_PRESENCE = 2000,
86     TASK_STOP_PRESENCE = 2001,
87
88     TASK_RECV_SUBSCRIPTION = 3000,
89     TASK_RECV_UNSUBSCRIPTION = 3001,
90     TASK_SEND_POLICY = 3002,
91     TASK_SEND_ALLOW = 3003,
92     TASK_SEND_DENY = 3004,
93     TASK_SYNC_SUBSCRIPTION = 3005,
94
95     TASK_SEND_NOTIFICATION = 4000,
96     TASK_SEND_PENDING_NOTI = 4001,
97
98     TASK_RECV_READ = 5000,
99     TASK_RECV_DISMISS = 5001,
100     TASK_SEND_READ = 5002,
101     TASK_SEND_DISMISS = 5003,
102
103     TASK_CONSUMER_REQ_DISCOVER = 8001,
104     TASK_CONSUMER_REQ_SUBSCRIBE = 8002,
105     TASK_CONSUMER_REQ_SUBSCRIBE_CANCEL = 8003,
106     TASK_CONSUMER_RECV_NOTIFICATION = 8101,
107
108     TASK_EVENT_CONNECTED = 9000,
109     TASK_EVENT_DISCONNECTED = 9001,
110
111     TASK_CB_SUBSCRIPTION = 10000,
112     TASK_CB_SYNC = 10001,
113
114 } NSTaskType;
115
116 typedef enum eCache
117 {
118     NS_CONSUMER_BLACKLIST = 0,
119     NS_CONSUMER_WHITELIST = 1,
120
121 } NSCache;
122
123 typedef enum eCacheType
124 {
125     NS_PROVIDER_CACHE_SUBSCRIBER = 1000,
126     NS_PROVIDER_CACHE_MESSAGE = 1001,
127 } NSCacheType;
128
129 typedef enum eResourceType
130 {
131     NS_RESOURCE_MESSAGE = 1000,
132     NS_RESOURCE_SYNC = 1001,
133 } NSResourceType;
134
135 #endif /* _NS_CONSTANTS_H_ */