HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_HTTPDefines.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  *
8  * Common. Commong HTTP defines (NET_HTTPDefines.h)
9  */
10 
11 #ifndef __NET_HTTPDefines_H__
12 #define __NET_HTTPDefines_H__
13 
14 // Useful defines
15 #define HTTP_MAX_HEADER_SIZE 8000 //8kb
16 #define NET_IS_LOOPBACK_ADDRESS(_arr_) \
17  (_arr_[0] == 127 && _arr_[1] == 0 && (_arr_[2] == 0 || _arr_[2] == 1) && \
18  _arr_[3] == 1)
19 
20 //
21 // HTTP Functions
22 //
23 #define NET_COMMAND_FUNC_NAME "cmd_function"
24 
25 //
26 // HTTP Methods
27 //
28 #define HTTP_METHOD_POST "POST"
29 #define HTTP_METHOD_GET "GET"
30 #define HTTP_METHOD_OPTIONS "OPTIONS"
31 #define HTTP_METHOD_PUT "PUT"
32 
33 //
34 // Mime Defines
35 //
36 #define HTTP_MIME_JSON "application/json"
37 #define HTTP_MIME_XML "text/xml"
38 #define HTTP_MIME_TEXT "text/plain"
39 #define HTTP_MIME_HTML "text/html"
40 #define HTTP_MIME_JS "text/javascript"
41 #define HTTP_MIME_CSS "text/css"
42 #define HTTP_MIME_URL "application/x-www-form-urlencoded"
43 #define HTTP_MIME_MULTIPART "multipart/form-data"
44 #define HTTP_MIME_BINARY "application/octet-stream"
45 #define HTTP_MIME_MP4 "video/mp4"
46 #define HTTP_MIME_MP3 "video/mp3"
47 #define HTTP_MIME_OGG "video/ogg"
48 #define HTTP_MIME_WEBM "video/webm"
49 
50 //
51 // Useful headers
52 //
53 #define HTTP_ACCEPT_JSON_HEADER "application/json, */*"
54 
55 //
56 // HTTP Routes
57 //
58 #define NET_HTTP_API_ROUTE "/api/"
59 
60 //
61 // Mime Ext Defines
62 //
63 #define HTTP_MIME_JSON_EXT ".json"
64 #define HTTP_MIME_XML_EXT ".xml"
65 #define HTTP_MIME_TEXT_EXT ".txt"
66 #define HTTP_MIME_HTML_EXT ".html"
67 #define HTTP_MIME_JS_EXT ".js"
68 #define HTTP_MIME_CSS_EXT ".css"
69 #define HTTP_MIME_MP4_EXT ".mp4"
70 #define HTTP_MIME_MP3_EXT ".mp3"
71 #define HTTP_MIME_OGGM_EXT ".ogm"
72 #define HTTP_MIME_OGGV_EXT ".ogv"
73 #define HTTP_MIME_OGG_EXT ".ogg"
74 #define HTTP_MIME_WEBM_EXT ".webm"
75 
76 //
77 // HTTP Request Defines
78 //
79 #define HTTP_CONTENT_LENGTH "Content-Length"
80 #define HTTP_CONTENT_TYPE "Content-Type"
81 #define HTTP_REQ_COOKIE "Cookie"
82 #define HTTP_ORIGIN "Origin"
83 #define HTTP_ACR_METHOD "Access-Control-Request-Method"
84 #define HTTP_ACR_METHODS "Access-Control-Request-Methods"
85 #define HTTP_ACR_HEADERS "Access-Control-Request-Headers"
86 #define HTTP_AUTHORIZATION "Authorization"
87 #define HTTP_ACCEPT "Accept"
88 #define HTTP_USER_AGENT "User-Agent"
89 #define HTTP_X_FORWARDED_FOR "X-Forwarded-For"
90 #define HTTP_HOST "Host"
91 #define HTTP_EXPECT "Expect"
92 #define HTTP_ACCEPT_ENCODING "Accept-Encoding"
93 #define HTTP_CONNECTION "Connection"
94 #define HTTP_UPGRADE "Upgrade"
95 #define HTTP_WEBSOCKET "websocket"
96 #define HTTP_TRANSFER_ENCODING "Transfer-Encoding"
97 #define HTTP_CONTENT_DISP "Content-Disposition"
98 #define HTTP_RANGE "Range"
99 // Web socket specific
100 #define HTTP_WEBSOCKET_KEY "Sec-WebSocket-Key"
101 #define HTTP_WEBSOCKET_PROTOCOL "Sec-WebSocket-Protocol"
102 #define HTTP_WEBSOCKET_VERSION "Sec-WebSocket-Version"
103 #define HTTP_WEBSOCKET_Extensions "Sec-WebSocket-Extensions"
104 
105 //
106 // HTTP Response Defines
107 //
108 #define HTTP_SET_COOKIE "Set-Cookie"
109 #define HTTP_ACAO "Access-Control-Allow-Origin"
110 #define HTTP_ACAO_METHODS "Access-Control-Allow-Methods"
111 #define HTTP_ACAO_HEADERS "Access-Control-Allow-Headers"
112 #define HTTP_SERVER "Server"
113 #define HTTP_ALLOW "Allow"
114 #define HTTP_DATE "Date"
115 #define HTTP_LAST_MODIFIED "Last-Modified"
116 #define HTTP_KEEP_ALIVE "Keep-Alive"
117 #define HTTP_CONNECTION "Connection"
118 #define HTTP_CONTENT_ENCODING "Content-Encoding"
119 #define HTTP_ETAG "ETag"
120 #define HTTP_CONTENT_RANGE "Content-Range"
121 #define HTTP_ACCEPT_RANGES "Accept-Ranges"
122 #define HTTP_AGE "Age"
123 #define HTTP_CACHE_CONTROL "Cache-Control"
124 #define HTTP_EXPIRES "Expires"
125 #define HTTP_STRICT_TS "Strict-Transport-Security"
126 #define HTTP_VARY "Vary"
127 #define HTTP_WWW_AUTHENTICATE "WWW-Authenticate"
128 #define HTTP_LOCATION "Location"
129 // Web socket specific
130 #define HTTP_WEBSOCKET_ACCEPT "Sec-WebSocket-Accept"
131 
132 //
133 // HTTP Response Code Messages
134 //
135 #define HTTP_100_CODE "Continue"
136 #define HTTP_101_CODE "Switching Protocols"
137 
138 #define HTTP_200_CODE "Ok"
139 #define HTTP_201_CODE "Created"
140 #define HTTP_202_CODE "Accepted"
141 #define HTTP_203_CODE "Non-Authoritative Information"
142 #define HTTP_204_CODE "No Content"
143 #define HTTP_205_CODE "Reset Content"
144 #define HTTP_206_CODE "Partial Content"
145 
146 #define HTTP_300_CODE "Multiple Choices"
147 #define HTTP_301_CODE "Moved Permanently"
148 #define HTTP_302_CODE "Found"
149 #define HTTP_303_CODE "See Other"
150 #define HTTP_304_CODE "Not Modified"
151 #define HTTP_307_CODE "Temporary Redirect"
152 #define HTTP_308_CODE "Permanent Redirect"
153 
154 #define HTTP_400_CODE "Bad Request"
155 #define HTTP_401_CODE "Unauthorized"
156 #define HTTP_402_CODE "Payment Required"
157 #define HTTP_403_CODE "Forbidden"
158 #define HTTP_404_CODE "Not Found"
159 #define HTTP_405_CODE "Method Not Allowed"
160 #define HTTP_406_CODE "Not Acceptable"
161 #define HTTP_407_CODE "Proxy Authentication"
162 #define HTTP_408_CODE "Request Timeout"
163 #define HTTP_409_CODE "Conflict"
164 #define HTTP_410_CODE "Gone"
165 #define HTTP_411_CODE "Length Required"
166 #define HTTP_412_CODE "Precondition Failed"
167 #define HTTP_413_CODE "Request Entity Too Large"
168 #define HTTP_414_CODE "Request-URI Too Long"
169 #define HTTP_415_CODE "Unsupported Media Type"
170 #define HTTP_416_CODE "Requested Range Not Satisfiable"
171 #define HTTP_417_CODE "Expectation Failed"
172 #define HTTP_422_CODE "Unprocessable Entity"
173 #define HTTP_425_CODE "Too Early"
174 #define HTTP_426_CODE "Upgrade Required"
175 #define HTTP_428_CODE "Precondition Required"
176 #define HTTP_429_CODE "Too Many Requests"
177 #define HTTP_431_CODE "Request Header Fields Too Large"
178 #define HTTP_451_CODE "Unavailable For Legal Reasons"
179 
180 #define HTTP_500_CODE "Internal Server Error"
181 #define HTTP_501_CODE "Not Implemented"
182 #define HTTP_502_CODE "Bad Gateway"
183 #define HTTP_503_CODE "Service Unavailable"
184 #define HTTP_504_CODE "Gateway Timeout"
185 #define HTTP_505_CODE "HTTP Version Not Supported"
186 #define HTTP_511_CODE "Network Authentication Required"
187 
188 //
189 // HTTP Stock Replies
190 //
191 #define HTTP_200_CODE_MSG "Request Successful."
192 
193 #define HTTP_400_CODE_MSG "Server was unable to understand the clients request."
194 #define HTTP_401_CODE_MSG "Client is not authorized to execute the request."
195 #define HTTP_403_CODE_MSG "You are forbidden to execute the request."
196 #define HTTP_404_CODE_MSG "Unable to process the requested resouce."
197 #define HTTP_408_CODE_MSG "Request has timed out."
198 #define HTTP_413_CODE_MSG "Payload was to large to be able to process."
199 #define HTTP_415_CODE_MSG "Provided media type is not currently supported."
200 
201 #define HTTP_500_CODE_MSG "Something has gone wrong internally in the server."
202 #define HTTP_501_CODE_MSG "Request has not been implemented."
203 #define HTTP_505_CODE_MSG "HTTP Version is not currently supported."
204 
205 //
206 // API command and parameter names
207 //
208 #define NET_API_INFO_CMD "cmd_api_info"
209 
210 #define NET_API_VERSION_NAME "api_version"
211 #define NET_INC_FUNC_NAME "inc_func"
212 #define NET_FUNCS_NAME "functions"
213 #define NET_CLIENT_VERSION_NAME "client_version"
214 
215 #endif // __NET_HTTPDefines_H__