4f856c2c5864f82d6b9cd6a36dc2f5a0cb8a4687
[platform/upstream/iotivity.git] / resource / include / StringConstants.h
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Mobile Communications GmbH 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 OC_STRING_CONSTANTS_H_
22 #define OC_STRING_CONSTANTS_H_
23
24 #include <string>
25
26 namespace OC
27 {
28
29 #if defined(_WIN32)
30 /** @todo: Remove temporary hacks to solve error C2059: syntax error: 'constant'*/
31 #ifdef NO_ERROR
32 #undef NO_ERROR
33 #endif
34 #ifdef DELETE
35 #undef DELETE
36 #endif
37 #endif
38
39     namespace InitException
40     {
41         static const char NO_ERROR[]                   = "No Error";
42         static const char INVALID_URI[]                = "Invalid URI";
43         static const char INVALID_PORT[]               = "Invalid Port";
44         static const char INVALID_IP[]                 = "Invalid IP";
45         static const char INVALID_CB[]                 = "Invalid Callback";
46         static const char INVALID_METHOD[]             = "Invalid Method";
47         static const char GENERAL_FAULT[]              = "General Fault";
48         static const char UNKNOWN_ERROR[]              = "Unknown Error";
49
50         static const char STACK_INIT_ERROR[]           = "Error Initializing Stack";
51         static const char NOT_CONFIGURED_AS_SERVER[]   =
52                           "Cannot static construct a Server when configured as a client";
53         static const char INVALID_PARAM[]              = "Invalid Param";
54         static const char MISSING_URI[]                = "Missing URI;";
55         static const char MISSING_TYPE[]               = "Missing Resource Type;";
56         static const char MISSING_INTERFACE[]          = "Missing Interface;";
57         static const char MISSING_CLIENT_WRAPPER[]     = "Missing ClientWrapper;";
58     }
59
60     namespace Exception // Not To Be Confused With 'InitException'
61     {
62         static const char SVCTYPE_OUTOFPROC[]          = "ServiceType::OutOfProc";
63         static const char BIND_TYPE_FAILED[]           = "Bind Type to resource failed";
64         static const char BIND_INTERFACE_FAILED[]      = "Bind Interface to resource failed";
65         static const char START_PRESENCE_FAILED[]      = "startPresence failed";
66         static const char END_PRESENCE_FAILED[]        = "stopPresence failed";
67         static const char INVALID_ARRAY[]              = "Array type should have at least []";
68         static const char STR_NULL_RESPONSE[]          = "Response is NULL";
69         static const char STR_PAYLOAD_OVERFLOW[]       = "Payload overflow";
70         static const char NIL_GUARD_NULL[]             = "nullptr at nil_guard()";
71         static const char GENERAL_JSON_PARSE_FAILED[]  = "JSON Parser Error";
72         static const char RESOURCE_UNREG_FAILED[]      = "Unregistering resource failed";
73         static const char OPTION_ID_RANGE_INVALID[]    =
74                             "Error: OptionID valid only If-Match(1), If-None-Match(5),"
75                             "Location-Path(8), Location-Query(20),"
76                             "and from 2048 to 3000 inclusive.";
77         static const char NO_ERROR[]                   = "No Error";
78         static const char RESOURCE_CREATED[]           = "Resource Created";
79         static const char RESOURCE_CHANGED[]           = "Resource Changed";
80         static const char RESOURCE_DELETED[]           = "Resource Deleted";
81         static const char INVALID_URI[]                = "Invalid URI";
82         static const char INVALID_IP[]                 = "Invalid IP";
83         static const char INVALID_PORT[]               = "Invalid Port";
84         static const char INVALID_CB[]                 = "Invalid Callback";
85         static const char INVALID_METHOD[]             = "Invalid Method";
86         static const char INVALID_QUERY[]              = "Invalid Query";
87         static const char INVALID_PARAM[]              = "Invalid Param";
88         static const char INVALID_OBESERVE[]           = "Invalid Observe Param";
89         static const char NO_MEMORY[]                  = "No Memory";
90         static const char COMM_ERROR[]                 = "Communication Error";
91         static const char TIMEOUT[]                    = "Timeout";
92         static const char ADAPTER_NOT_ENABLED[]        = "Adapter Not Enabled";
93         static const char NOT_IMPL[]                   = "Not Implemented";
94         static const char NOT_FOUND[]                  = "Resource Not Found";
95         static const char RESOURCE_ERROR[]             = "Resource Error";
96         static const char SLOW_RESOURCE[]              = "Slow Resource";
97         static const char DUPLICATE_REQUEST[]          = "Duplicate Request";
98         static const char NO_OBSERVERS[]               = "No Observers";
99         static const char OBSV_NO_FOUND[]              = "Stack observer not found";
100         static const char OBSV_NOT_ADDED[]             = "Stack observer not added";
101         static const char OBSV_NOT_REMOVED[]           = "Stack observer not removed";
102         static const char STACK_RESOURCE_DELETED[]     = "The specified resource has been deleted";
103         static const char PRESENCE_STOPPED[]           = "Stack presence stopped";
104         static const char PRESENCE_TIMEOUT[]           = "Stack presence timed out";
105         static const char PRESENCE_NOT_HANDLED[]       = "Stack presence should not be handled";
106         static const char INVALID_OPTION[]             = "Invalid option";
107         static const char GENERAL_FAULT[]              = "General Fault";
108         static const char MALFORMED_STACK_RESPONSE[]   = "Response from OC_STACK is malformed";
109         static const char VIRTUAL_DO_NOT_HANDLE[]      = "Virtual Do Not Handle";
110         static const char PERSISTENT_BUFFER_REQUIRED[] = "Persistent response buffer required";
111         static const char STACK_CONTINUE[]             = "Stack continue";
112         static const char INVALID_REQUEST_HANDLE[]     = "Invalid request handle";
113         static const char UNKNOWN_ERROR[]              = "Unknown Error";
114         static const char INVALID_REPRESENTATION[]     = "Invalid Payload JSON";
115         static const char INVALID_JSON_TYPE[]          = "Unrecognized JSON Type ";
116         static const char INVALID_JSON_NUMERIC[]       = "Unrecognized JSON Numeric ";
117         static const char INVALID_JSON_ARRAY_DEPTH[]   = "Max JSON Array Depth exceeded";
118         static const char INVALID_JSON_TYPE_TAG[]      = "Invalid JSON Type Tag";
119         static const char INVALID_ATTRIBUTE[]          = "Invalid Attribute: ";
120         static const char INVALID_DEVICE_INFO[]        = "Invalid Device Information";
121         static const char UNAUTHORIZED_REQUEST[]       = "Unauthorized Request";
122         static const char TOO_LARGE_REQ[]              = "Request Too Large";
123         static const char PDM_DB_NOT_INITIALIZED[]     = "Provisioning DB is not initialized";
124         static const char DUPLICATE_UUID[]             = "Duplicate UUID in DB";
125         static const char INCONSISTENT_DB[]            = "Data in provisioning DB is inconsistent";
126         static const char AUTHENTICATION_FAILURE[]     = "Authentication failure";
127         static const char NOT_ALLOWED_OXM[]            = "Not allowed ownership transfer method";
128         static const char PUBLISH_RESOURCE_FAILED[]    = "Publish Resource failure";
129         static const char FORBIDDEN_REQ[]              = "Forbidden request";
130         static const char INTERNAL_SERVER_ERROR[]      = "Internal server error";
131     }
132
133     namespace Error
134     {
135         static const char INVALID_IP[]                 = "Invalid IP";
136     }
137
138     namespace PlatformCommands
139     {
140         static const std::string GET                        = "GET";
141         static const std::string PUT                        = "PUT";
142         static const std::string POST                       = "POST";
143         static const std::string DELETE                     = "DELETE";
144     }
145
146     namespace Key
147     {
148         static const std::string OCKEY                      = "oic";
149         static const std::string URIKEY                     = "href";
150         static const std::string POLICYKEY                  = "p";
151         static const std::string BMKEY                      = "bm";
152         static const std::string RESOURCETYPESKEY           = "rt";
153         static const std::string INTERFACESKEY              = "if";
154         static const std::string PROPERTYKEY                = "prop";
155         static const std::string REPKEY                     = "rep";
156         static const std::string SECUREKEY                  = "sec";
157         static const std::string PORTKEY                    = "port";
158         static const std::string DEVICEIDKEY                = "di";
159         static const std::string LINKS                      = "links";
160
161     }
162
163 }
164
165 #endif // OC_STRING_CONSTANTS_H_
166