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