Embedded TCP/IP stack: fnet_http.h Source File

FNET

fnet_http.h
1 /**************************************************************************
2 *
3 * Copyright 2011-2017 by Andrey Butok. FNET Community.
4 * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License"); you may
9 * not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 ***************************************************************************
21 *
22 * FNET HTTP Server API.
23 *
24 ***************************************************************************/
25 
26 #ifndef _FNET_HTTP_H_
27 
28 #define _FNET_HTTP_H_
29 
30 #if FNET_CFG_HTTP || defined(__DOXYGEN__)
31 
67 /**************************************************************************/
71 #if FNET_CFG_HTTP_VERSION_MAJOR /*HTTP/1.x*/
72  #define FNET_HTTP_VERSION_MAJOR (1u)
73 #else /*HTTP/0.9*/
74  #define FNET_HTTP_VERSION_MAJOR (0u)
75 #endif
76 
77 /**************************************************************************/
81 #if FNET_CFG_HTTP_VERSION_MAJOR /* HTTP/1.x*/
82  #define FNET_HTTP_VERSION_MINOR (0u)
83 #else /*HTTP/0.9*/
84  #define FNET_HTTP_VERSION_MINOR (9u)
85 #endif
86 
87 
88 #if FNET_CFG_HTTP_VERSION_MAJOR /* HTTP/1.x*/ || defined(__DOXYGEN__)
89 
90 /********************************************************************/
98 typedef enum
99 {
162 #endif
163 
164 #if (FNET_CFG_HTTP_TLS && FNET_CFG_TLS) || defined(__DOXYGEN__)
165 /**************************************************************************/
169 {
170  const fnet_uint8_t *certificate_buffer;
172  const fnet_uint8_t *private_key_buffer;
174 };
175 #endif
176 
177 /**************************************************************************/
181 {
185  struct fnet_sockaddr address;
189 #if FNET_CFG_HTTP_SSI || defined(__DOXYGEN__)
190  const struct fnet_http_ssi *ssi_table;
191 #endif
192 #if FNET_CFG_HTTP_CGI || defined(__DOXYGEN__)
193  const struct fnet_http_cgi *cgi_table;
194 #endif
195 #if (FNET_CFG_HTTP_AUTHENTICATION_BASIC && FNET_CFG_HTTP_VERSION_MAJOR) || defined(__DOXYGEN__)
196  const struct fnet_http_auth *auth_table;
197 #endif
198 #if (FNET_CFG_HTTP_POST && FNET_CFG_HTTP_VERSION_MAJOR) || defined(__DOXYGEN__)
199  const struct fnet_http_post *post_table;
200 #endif
201 #if (FNET_CFG_HTTP_TLS && FNET_CFG_TLS) || defined(__DOXYGEN__)
203 #endif
204 };
205 
206 /**************************************************************************/
210 typedef fnet_int32_t fnet_http_desc_t;
211 
212 /**************************************************************************/
216 typedef fnet_int32_t fnet_http_session_t;
217 
218 #include "fnet_http_ssi.h"
219 #include "fnet_http_cgi.h"
220 #include "fnet_http_auth.h"
221 #include "fnet_http_post.h"
222 
223 #if defined(__cplusplus)
224 extern "C" {
225 #endif
226 
227 /***************************************************************************/
248 
249 /***************************************************************************/
266 
267 /***************************************************************************/
283 
284 /***************************************************************************/
308 void fnet_http_query_unencode(fnet_uint8_t *dest, fnet_uint8_t *src);
309 
310 #if FNET_CFG_HTTP_VERSION_MAJOR /* HTTP/1.x*/ || defined(__DOXYGEN__)
311 
312 /**************************************************************************/
323 
324 /**************************************************************************/
335 
336 /**************************************************************************/
347 
348 #endif
349 
350 #if defined(__cplusplus)
351 }
352 #endif
353 
356 #endif /* FNET_CFG_HTTP */
357 
358 #endif
fnet_char_t * root_path
Server root-directory path (null-terminated string).
Definition: fnet_http.h:182
Bad Gateway. The server, while acting as a gateway or proxy, received an invalid response from the u...
Definition: fnet_http.h:153
const fnet_uint8_t * private_key_buffer
Buffer holding the private key in PEM or DER format.
Definition: fnet_http.h:172
Internal Server Error. The server encountered an unexpected condition which prevented it from fulfil...
Definition: fnet_http.h:147
const struct fnet_http_post * post_table
Pointer to the optional POST callback function table.
Definition: fnet_http.h:199
Forbidden. The server understood the request, but is refusing to fulfill it.
Definition: fnet_http.h:141
CGI callback function table.
HTTP over TLS (HTTPS) input parameters for fnet_http_init().
Definition: fnet_http.h:168
Moved Temporarily. The requested resource resides temporarily under a different URL. It's not supported by the FNET HTTP Server.
Definition: fnet_http.h:123
fnet_size_t certificate_buffer_size
Size of the certificate buffer (including the terminating null byte for PEM data).
Definition: fnet_http.h:171
Not Modified. If the client has performed a conditional GET request and access is allowed...
Definition: fnet_http.h:127
No Content. The server has fulfilled the request but there is no new information to send back...
Definition: fnet_http.h:112
fnet_http_desc_t fnet_http_init(struct fnet_http_params *params)
Initializes the HTTP Server service.
void fnet_http_set_response_content_length(fnet_http_session_t session, fnet_size_t content_length)
Sets content length in HTTP response header.
SSI callback function table.
NONE. Status code is not defined.
Definition: fnet_http.h:100
void fnet_http_set_response_status_code(fnet_http_session_t session, fnet_http_status_code_t status_code)
Sets status code in HTTP response status-line.
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:56
Not Found. The server has not found anything matching the Request-URI.
Definition: fnet_http.h:144
void fnet_http_release(fnet_http_desc_t desc)
Releases the HTTP Server service.
POST-method callback function table.
Input parameters for fnet_http_init().
Definition: fnet_http.h:180
fnet_int32_t fnet_http_session_t
HTTP session handle.
Definition: fnet_http.h:216
const fnet_uint8_t * certificate_buffer
Buffer holding the certificate data in PEM or DER format.
Definition: fnet_http.h:170
const struct fnet_http_cgi * cgi_table
Pointer to the optional CGI callback function table.
Definition: fnet_http.h:193
void fnet_http_set_response_no_header(fnet_http_session_t session)
Disables sending of HTTP response status-code and header.
Moved Permanently. The requested resource has been assigned a new permanent URL and any future refer...
Definition: fnet_http.h:116
Created. The request has been fulfilled and resulted in a new resource being created.
Definition: fnet_http.h:104
fnet_bool_t
Boolean type.
Definition: fnet_stdlib.h:81
const struct fnet_http_auth * auth_table
Pointer to the optional HTTP Access Authentification table.
Definition: fnet_http.h:196
fnet_bool_t fnet_http_is_enabled(fnet_http_desc_t desc)
Detects if the HTTP Server service is enabled or disabled.
const struct fnet_http_ssi * ssi_table
Pointer to the optional SSI callback function table.
Definition: fnet_http.h:190
Service Unavailable. The server is currently unable to handle the request due to a temporary overloa...
Definition: fnet_http.h:157
fnet_int32_t fnet_http_desc_t
HTTP server descriptor.
Definition: fnet_http.h:210
OK. The request has succeeded.
Definition: fnet_http.h:102
Bad Request. The request could not be understood by the server due to malformed syntax.
Definition: fnet_http.h:136
char fnet_char_t
Type representing the charecter.
Definition: fnet_stdlib.h:76
Not Implemented. The server does not support the functionality required to fulfill the request...
Definition: fnet_http.h:150
fnet_char_t * index_path
Index file path (null-terminated string). It's relative to the root_path.
Definition: fnet_http.h:183
HTTP Authentication table.
struct fnet_http_tls_params * tls_params
Pointer to the optional HTTP over TLS (HTTPS) parameters.
Definition: fnet_http.h:202
void fnet_http_query_unencode(fnet_uint8_t *dest, fnet_uint8_t *src)
Converts escaped string to an original format.
Socket address structure.
Definition: fnet_socket.h:270
fnet_http_status_code_t
HTTP/1.0 Status-Code definitions according to RFC1945.
Definition: fnet_http.h:98
fnet_size_t private_key_buffer_size
Size of the private key buffer (including the terminating null byte for PEM data).
Definition: fnet_http.h:173
Unauthorized. The request requires user authentication.
Definition: fnet_http.h:139
Accepted. The request has been accepted for processing, but the processing has not been completed...
Definition: fnet_http.h:108

© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net