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/HttpDynamic.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_DYNAMIC_H_ |
dflet | 0:400d8e75a8d0 | 15 | #define _HTTP_DYNAMIC_H_ |
dflet | 0:400d8e75a8d0 | 16 | |
dflet | 0:400d8e75a8d0 | 17 | #include "HttpConfig.h" |
dflet | 0:400d8e75a8d0 | 18 | |
dflet | 0:400d8e75a8d0 | 19 | |
dflet | 0:400d8e75a8d0 | 20 | |
dflet | 0:400d8e75a8d0 | 21 | |
dflet | 0:400d8e75a8d0 | 22 | #ifdef HTTP_CORE_ENABLE_DYNAMIC |
dflet | 0:400d8e75a8d0 | 23 | |
dflet | 0:400d8e75a8d0 | 24 | /** |
dflet | 0:400d8e75a8d0 | 25 | * @defgroup HttpDynamic Dynamic request handler module |
dflet | 0:400d8e75a8d0 | 26 | * This module implements dynamic content processing for HTTP requests. |
dflet | 0:400d8e75a8d0 | 27 | * All requests are handled by C code functions, and the response contents is returned via HttpResopnse routines |
dflet | 0:400d8e75a8d0 | 28 | * Note this module is only compiled if HTTP_CORE_ENABLE_DYNAMIC is defined in HttpConfig.h |
dflet | 0:400d8e75a8d0 | 29 | * |
dflet | 0:400d8e75a8d0 | 30 | * @{ |
dflet | 0:400d8e75a8d0 | 31 | */ |
dflet | 0:400d8e75a8d0 | 32 | |
dflet | 0:400d8e75a8d0 | 33 | #include "HttpRequest.h" |
dflet | 0:400d8e75a8d0 | 34 | |
dflet | 0:400d8e75a8d0 | 35 | #define MAX_RESOURCE 10 |
dflet | 0:400d8e75a8d0 | 36 | |
dflet | 0:400d8e75a8d0 | 37 | #ifdef __cplusplus |
dflet | 0:400d8e75a8d0 | 38 | extern "C" { |
dflet | 0:400d8e75a8d0 | 39 | #endif |
dflet | 0:400d8e75a8d0 | 40 | |
dflet | 0:400d8e75a8d0 | 41 | typedef struct |
dflet | 0:400d8e75a8d0 | 42 | { |
dflet | 0:400d8e75a8d0 | 43 | unsigned char rest_method; |
dflet | 0:400d8e75a8d0 | 44 | unsigned char *ResourceString; |
dflet | 0:400d8e75a8d0 | 45 | unsigned char* (*pCbfunc)(void*); |
dflet | 0:400d8e75a8d0 | 46 | }Resource; |
dflet | 0:400d8e75a8d0 | 47 | |
dflet | 0:400d8e75a8d0 | 48 | #define POST 0 |
dflet | 0:400d8e75a8d0 | 49 | #define GET 1 |
dflet | 0:400d8e75a8d0 | 50 | |
dflet | 0:400d8e75a8d0 | 51 | |
dflet | 0:400d8e75a8d0 | 52 | int SetResources(unsigned char method, char* pBuf, unsigned char* (*pCbRestFunc)(void *pArgs) ); |
dflet | 0:400d8e75a8d0 | 53 | |
dflet | 0:400d8e75a8d0 | 54 | /** |
dflet | 0:400d8e75a8d0 | 55 | * Initialize HttpDynamic module state for a new request, and identify the request |
dflet | 0:400d8e75a8d0 | 56 | * This function must examine the specified resource string and determine whether it can commit to process this request |
dflet | 0:400d8e75a8d0 | 57 | * If this function returns nonzero, then the core will call HttpDynamic_ProcessRequest() with the rest of the request details. |
dflet | 0:400d8e75a8d0 | 58 | * @param uConnection The number of the connection. This value is guaranteed to satisfy: 0 <= uConnection < HTTP_CORE_MAX_CONNECTIONS |
dflet | 0:400d8e75a8d0 | 59 | * @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 | 60 | * 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 | 61 | * @param method The HTTP method sent from the client for the resource |
dflet | 0:400d8e75a8d0 | 62 | * @return nonzero if request is to be handled by this module. zero if not. |
dflet | 0:400d8e75a8d0 | 63 | */ |
dflet | 0:400d8e75a8d0 | 64 | int HttpDynamic_InitRequest(UINT16 uConnection, struct HttpBlob resource, UINT8 method); |
dflet | 0:400d8e75a8d0 | 65 | |
dflet | 0:400d8e75a8d0 | 66 | /** |
dflet | 0:400d8e75a8d0 | 67 | * Process a dynamic-content HTTP request |
dflet | 0:400d8e75a8d0 | 68 | * This function is only be called by the core, if HttpDynamic_InitRequest() returns nonzero. |
dflet | 0:400d8e75a8d0 | 69 | * This function processes the specified HTTP request, and send the response on the connection specified by request->uConnection. |
dflet | 0:400d8e75a8d0 | 70 | * This function must call the HttpResponse_*() functions in order to send data back to the browser. |
dflet | 0:400d8e75a8d0 | 71 | * Please refer to HttpResponse.h for more information. |
dflet | 0:400d8e75a8d0 | 72 | * @param request Pointer to all data available about the request |
dflet | 0:400d8e75a8d0 | 73 | */ |
dflet | 0:400d8e75a8d0 | 74 | int HttpDynamic_ProcessRequest(struct HttpRequest* request); |
dflet | 0:400d8e75a8d0 | 75 | |
dflet | 0:400d8e75a8d0 | 76 | /// @} |
dflet | 0:400d8e75a8d0 | 77 | |
dflet | 0:400d8e75a8d0 | 78 | #ifdef __cplusplus |
dflet | 0:400d8e75a8d0 | 79 | } |
dflet | 0:400d8e75a8d0 | 80 | #endif /* __cplusplus */ |
dflet | 0:400d8e75a8d0 | 81 | |
dflet | 0:400d8e75a8d0 | 82 | #endif // HTTP_CORE_ENABLE_DYNAMIC |
dflet | 0:400d8e75a8d0 | 83 | |
dflet | 0:400d8e75a8d0 | 84 | #endif // _HTTP_DYNAMIC_H_ |
dflet | 0:400d8e75a8d0 | 85 |