TI's CC3100 websocket camera demo with Arducam mini ov5642 and freertos. Should work with other M3's. Work in progress test demo.
http/server/HttpStatic.h@1:e448e81c416f, 2015-09-11 (annotated)
- Committer:
- dflet
- Date:
- Fri Sep 11 15:38:33 2015 +0000
- Revision:
- 1:e448e81c416f
- Parent:
- 0:400d8e75a8d0
Removed some debud.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dflet | 0:400d8e75a8d0 | 1 | //***************************************************************************** |
dflet | 0:400d8e75a8d0 | 2 | // Copyright (C) 2014 Texas Instruments Incorporated |
dflet | 0:400d8e75a8d0 | 3 | // |
dflet | 0:400d8e75a8d0 | 4 | // All rights reserved. Property of Texas Instruments Incorporated. |
dflet | 0:400d8e75a8d0 | 5 | // Restricted rights to use, duplicate or disclose this code are |
dflet | 0:400d8e75a8d0 | 6 | // granted through contract. |
dflet | 0:400d8e75a8d0 | 7 | // The program may not be used without the written permission of |
dflet | 0:400d8e75a8d0 | 8 | // Texas Instruments Incorporated or against the terms and conditions |
dflet | 0:400d8e75a8d0 | 9 | // stipulated in the agreement under which this program has been supplied, |
dflet | 0:400d8e75a8d0 | 10 | // and under no circumstances can it be used with non-TI connectivity device. |
dflet | 0:400d8e75a8d0 | 11 | // |
dflet | 0:400d8e75a8d0 | 12 | //***************************************************************************** |
dflet | 0:400d8e75a8d0 | 13 | |
dflet | 0:400d8e75a8d0 | 14 | #ifndef _HTTP_STATIC_H_ |
dflet | 0:400d8e75a8d0 | 15 | #define _HTTP_STATIC_H_ |
dflet | 0:400d8e75a8d0 | 16 | |
dflet | 0:400d8e75a8d0 | 17 | #include "HttpConfig.h" |
dflet | 0:400d8e75a8d0 | 18 | |
dflet | 0:400d8e75a8d0 | 19 | #ifdef HTTP_CORE_ENABLE_STATIC |
dflet | 0:400d8e75a8d0 | 20 | |
dflet | 0:400d8e75a8d0 | 21 | /** |
dflet | 0:400d8e75a8d0 | 22 | * @defgroup HttpStatic Static request handler module |
dflet | 0:400d8e75a8d0 | 23 | * This module implements static content processing for HTTP requests. |
dflet | 0:400d8e75a8d0 | 24 | * All requests are handled by looking up the URL's resource in the flash database, and returning the content in the response. |
dflet | 0:400d8e75a8d0 | 25 | * Note this module is only compiled if HTTP_CORE_ENABLE_STATIC is defined in HttpConfig.h |
dflet | 0:400d8e75a8d0 | 26 | * |
dflet | 0:400d8e75a8d0 | 27 | * @{ |
dflet | 0:400d8e75a8d0 | 28 | */ |
dflet | 0:400d8e75a8d0 | 29 | |
dflet | 0:400d8e75a8d0 | 30 | #include "HttpRequest.h" |
dflet | 0:400d8e75a8d0 | 31 | |
dflet | 0:400d8e75a8d0 | 32 | #ifdef __cplusplus |
dflet | 0:400d8e75a8d0 | 33 | extern "C" { |
dflet | 0:400d8e75a8d0 | 34 | #endif |
dflet | 0:400d8e75a8d0 | 35 | |
dflet | 0:400d8e75a8d0 | 36 | /** |
dflet | 0:400d8e75a8d0 | 37 | * Initialize HttpStatic module state for a new request, and identify the request |
dflet | 0:400d8e75a8d0 | 38 | * This function examines the specified resource string, and looks it up in the Flash Database. |
dflet | 0:400d8e75a8d0 | 39 | * If found, it commits to process this request by returning nonzero. Otherwise it returns zero. |
dflet | 0:400d8e75a8d0 | 40 | * @param uConnection The number of the connection. This value is guaranteed to satisfy: 0 <= uConnection < HTTP_CORE_MAX_CONNECTIONS |
dflet | 0:400d8e75a8d0 | 41 | * @param resource The resource part of the URL, as specified by the browser in the request, including any query string (and hash). |
dflet | 0:400d8e75a8d0 | 42 | * Note: The resource string exists ONLY during the call to this function. The string pointer should not be copied by this function. |
dflet | 0:400d8e75a8d0 | 43 | * @return nonzero if request is to be handled by this module. zero if not. |
dflet | 0:400d8e75a8d0 | 44 | */ |
dflet | 0:400d8e75a8d0 | 45 | int HttpStatic_InitRequest(UINT16 uConnection, struct HttpBlob resource); |
dflet | 0:400d8e75a8d0 | 46 | |
dflet | 0:400d8e75a8d0 | 47 | /** |
dflet | 0:400d8e75a8d0 | 48 | * Process a static-content HTTP request |
dflet | 0:400d8e75a8d0 | 49 | * This function is called after a request was already initialized, and a Flash content entry was identified during a call to HttpStatic_InitRequest() |
dflet | 0:400d8e75a8d0 | 50 | * This function calls HttpResponse_*() to send the content data to the browser. |
dflet | 0:400d8e75a8d0 | 51 | * @param request Pointer to all data available about the request |
dflet | 0:400d8e75a8d0 | 52 | * @return nonzero if request was handled. zero if not. |
dflet | 0:400d8e75a8d0 | 53 | */ |
dflet | 0:400d8e75a8d0 | 54 | int HttpStatic_ProcessRequest(struct HttpRequest* request); |
dflet | 0:400d8e75a8d0 | 55 | |
dflet | 0:400d8e75a8d0 | 56 | /// @} |
dflet | 0:400d8e75a8d0 | 57 | |
dflet | 0:400d8e75a8d0 | 58 | #ifdef __cplusplus |
dflet | 0:400d8e75a8d0 | 59 | } |
dflet | 0:400d8e75a8d0 | 60 | #endif /* __cplusplus */ |
dflet | 0:400d8e75a8d0 | 61 | |
dflet | 0:400d8e75a8d0 | 62 | #endif // HTTP_CORE_ENABLE_STATIC |
dflet | 0:400d8e75a8d0 | 63 | |
dflet | 0:400d8e75a8d0 | 64 | #endif // _HTTP_STATIC_H_ |
dflet | 0:400d8e75a8d0 | 65 |