Webserver+3d print
http_server.h File Reference
HTTP server (HyperText Transfer Protocol) More...
Go to the source code of this file.
Data Structures | |
struct | HttpStatusCodeDesc |
HTTP status code. More... | |
struct | HttpAuthorizationHeader |
Authorization header. More... | |
struct | HttpAuthenticateHeader |
Authenticate header. More... | |
struct | HttpRequest |
HTTP request. More... | |
struct | HttpResponse |
HTTP response. More... | |
struct | HttpServerSettings |
HTTP server settings. More... | |
struct | HttpNonceCacheEntry |
Nonce cache entry. More... | |
struct | _HttpServerContext |
HTTP server context. More... | |
struct | _HttpConnection |
HTTP connection. More... | |
Typedefs | |
typedef error_t(* | TlsInitCallback )(HttpConnection *connection, TlsContext *tlsContext) |
SSL/TLS initialization callback function. | |
typedef error_t(* | HttpRandCallback )(uint8_t *data, size_t length) |
Random data generation callback function. | |
typedef HttpAccessStatus(* | HttpAuthCallback )(HttpConnection *connection, const char_t *user, const char_t *uri) |
HTTP authentication callback function. | |
typedef error_t(* | HttpCgiCallback )(HttpConnection *connection, const char_t *param) |
CGI callback function. | |
typedef error_t(* | HttpRequestCallback )(HttpConnection *connection, const char_t *uri) |
HTTP request callback function. | |
typedef error_t(* | HttpUriNotFoundCallback )(HttpConnection *connection, const char_t *uri) |
URI not found callback function. | |
Enumerations | |
enum | HttpVersion |
HTTP version numbers. More... | |
enum | HttpAuthMode |
HTTP authentication schemes. More... | |
enum | HttpAccessStatus |
Access status. More... | |
enum | HttpFlags |
Flags used by I/O functions. More... | |
enum | HttpConnState |
HTTP connection states. More... | |
Functions | |
void | httpServerGetDefaultSettings (HttpServerSettings *settings) |
Initialize settings with default values. | |
error_t | httpServerInit (HttpServerContext *context, const HttpServerSettings *settings) |
HTTP server initialization. | |
error_t | httpServerStart (HttpServerContext *context) |
Start HTTP server. | |
void | httpListenerTask (void *param) |
HTTP server listener task. | |
void | httpConnectionTask (void *param) |
Task that services requests from an active connection. | |
error_t | httpWriteHeader (HttpConnection *connection) |
Send HTTP response header. | |
error_t | httpReadStream (HttpConnection *connection, void *data, size_t size, size_t *received, uint_t flags) |
Read data from client request. | |
error_t | httpWriteStream (HttpConnection *connection, const void *data, size_t length) |
Write data to the client. | |
error_t | httpCloseStream (HttpConnection *connection) |
Close output stream. | |
error_t | httpSendResponse (HttpConnection *connection, const char_t *uri) |
Send HTTP response. | |
error_t | httpSendErrorResponse (HttpConnection *connection, uint_t statusCode, const char_t *message) |
Send error response to the client. | |
error_t | httpSendRedirectResponse (HttpConnection *connection, uint_t statusCode, const char_t *uri) |
Send redirect response to the client. | |
bool_t | httpCheckPassword (HttpConnection *connection, const char_t *password, HttpAuthMode mode) |
Password verification. | |
bool_t | httpCheckWebSocketHandshake (HttpConnection *connection) |
Check whether the client's handshake is valid. | |
WebSocket * | httpUpgradeToWebSocket (HttpConnection *connection) |
Upgrade an existing HTTP connection to a WebSocket. | |
error_t | httpDecodePercentEncodedString (const char_t *input, char_t *output, size_t outputSize) |
Decode a percent-encoded string. |
Detailed Description
HTTP server (HyperText Transfer Protocol)
License
Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version:
- 1.7.6
Definition in file http_server.h.
Typedef Documentation
typedef HttpAccessStatus(* HttpAuthCallback)(HttpConnection *connection, const char_t *user, const char_t *uri) |
HTTP authentication callback function.
Definition at line 389 of file http_server.h.
typedef error_t(* HttpCgiCallback)(HttpConnection *connection, const char_t *param) |
CGI callback function.
Definition at line 397 of file http_server.h.
typedef error_t(* HttpRandCallback)(uint8_t *data, size_t length) |
Random data generation callback function.
Definition at line 382 of file http_server.h.
typedef error_t(* HttpRequestCallback)(HttpConnection *connection, const char_t *uri) |
HTTP request callback function.
Definition at line 405 of file http_server.h.
typedef error_t(* HttpUriNotFoundCallback)(HttpConnection *connection, const char_t *uri) |
URI not found callback function.
Definition at line 413 of file http_server.h.
typedef error_t(* TlsInitCallback)(HttpConnection *connection, TlsContext *tlsContext) |
SSL/TLS initialization callback function.
Definition at line 372 of file http_server.h.
Enumeration Type Documentation
enum HttpAccessStatus |
Access status.
Definition at line 319 of file http_server.h.
enum HttpAuthMode |
HTTP authentication schemes.
Definition at line 307 of file http_server.h.
enum HttpConnState |
HTTP connection states.
Definition at line 347 of file http_server.h.
enum HttpFlags |
Flags used by I/O functions.
Definition at line 332 of file http_server.h.
enum HttpVersion |
HTTP version numbers.
Definition at line 295 of file http_server.h.
Function Documentation
bool_t httpCheckPassword | ( | HttpConnection * | connection, |
const char_t * | password, | ||
HttpAuthMode | mode | ||
) |
Password verification.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] password NULL-terminated string containing the password to be checked [in] mode HTTP authentication scheme to be used. Acceptable values are HTTP_AUTH_MODE_BASIC or HTTP_AUTH_MODE_DIGEST
- Returns:
- TRUE if the password is valid, else FALSE
Definition at line 54 of file http_server_auth.c.
bool_t httpCheckWebSocketHandshake | ( | HttpConnection * | connection ) |
Check whether the client's handshake is valid.
- Parameters:
-
[in] connection Structure representing an HTTP connection
- Returns:
- TRUE if the WebSocket handshake is valid, else FALSE
Definition at line 1059 of file http_server.c.
error_t httpCloseStream | ( | HttpConnection * | connection ) |
Close output stream.
- Parameters:
-
[in] connection Structure representing an HTTP connection
- Returns:
- Error code
Definition at line 803 of file http_server.c.
void httpConnectionTask | ( | void * | param ) |
Task that services requests from an active connection.
- Parameters:
-
[in] param Structure representing an HTTP connection with a client
Definition at line 308 of file http_server.c.
error_t httpDecodePercentEncodedString | ( | const char_t * | input, |
char_t * | output, | ||
size_t | outputSize | ||
) |
Decode a percent-encoded string.
- Parameters:
-
[in] input NULL-terminated string to be decoded [out] output NULL-terminated string resulting from the decoding process [in] outputSize Size of the output buffer in bytes
- Returns:
- Error code
Definition at line 984 of file http_server_misc.c.
void httpListenerTask | ( | void * | param ) |
HTTP server listener task.
- Parameters:
-
[in] param Pointer to the HTTP server context
Definition at line 238 of file http_server.c.
error_t httpReadStream | ( | HttpConnection * | connection, |
void * | data, | ||
size_t | size, | ||
size_t * | received, | ||
uint_t | flags | ||
) |
Read data from client request.
- Parameters:
-
[in] connection Structure representing an HTTP connection [out] data Buffer where to store the incoming data [in] size Maximum number of bytes that can be received [out] received Number of bytes that have been received [in] flags Set of flags that influences the behavior of this function
- Returns:
- Error code
Definition at line 632 of file http_server.c.
error_t httpSendErrorResponse | ( | HttpConnection * | connection, |
uint_t | statusCode, | ||
const char_t * | message | ||
) |
Send error response to the client.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] statusCode HTTP status code [in] message User message
- Returns:
- Error code
Definition at line 948 of file http_server.c.
error_t httpSendRedirectResponse | ( | HttpConnection * | connection, |
uint_t | statusCode, | ||
const char_t * | uri | ||
) |
Send redirect response to the client.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] statusCode HTTP status code (301 for permanent redirects) [in] uri NULL-terminated string containing the redirect URI
- Returns:
- Error code
Definition at line 1004 of file http_server.c.
error_t httpSendResponse | ( | HttpConnection * | connection, |
const char_t * | uri | ||
) |
Send HTTP response.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] uri NULL-terminated string containing the file to be sent in response
- Returns:
- Error code
Definition at line 831 of file http_server.c.
void httpServerGetDefaultSettings | ( | HttpServerSettings * | settings ) |
Initialize settings with default values.
- Parameters:
-
[out] settings Structure that contains HTTP server settings
Definition at line 61 of file http_server.c.
error_t httpServerInit | ( | HttpServerContext * | context, |
const HttpServerSettings * | settings | ||
) |
HTTP server initialization.
- Parameters:
-
[in] context Pointer to the HTTP server context [in] settings HTTP server specific settings
- Returns:
- Error code
Definition at line 106 of file http_server.c.
error_t httpServerStart | ( | HttpServerContext * | context ) |
Start HTTP server.
- Parameters:
-
[in] context Pointer to the HTTP server context
- Returns:
- Error code
Definition at line 196 of file http_server.c.
WebSocket* httpUpgradeToWebSocket | ( | HttpConnection * | connection ) |
Upgrade an existing HTTP connection to a WebSocket.
- Parameters:
-
[in] connection Structure representing an HTTP connection
- Returns:
- Handle referencing the new WebSocket
Definition at line 1108 of file http_server.c.
error_t httpWriteHeader | ( | HttpConnection * | connection ) |
Send HTTP response header.
- Parameters:
-
[in] connection Structure representing an HTTP connection
- Returns:
- Error code
Definition at line 599 of file http_server.c.
error_t httpWriteStream | ( | HttpConnection * | connection, |
const void * | data, | ||
size_t | length | ||
) |
Write data to the client.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] data Buffer containing the data to be transmitted [in] length Number of bytes to be transmitted
- Returns:
- Error code
Definition at line 738 of file http_server.c.
Generated on Tue Jul 12 2022 17:10:20 by
