Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HttpDynamic.h Source File

HttpDynamic.h

00001 //*****************************************************************************
00002 // Copyright (C) 2014 Texas Instruments Incorporated
00003 //
00004 // All rights reserved. Property of Texas Instruments Incorporated.
00005 // Restricted rights to use, duplicate or disclose this code are
00006 // granted through contract.
00007 // The program may not be used without the written permission of
00008 // Texas Instruments Incorporated or against the terms and conditions
00009 // stipulated in the agreement under which this program has been supplied,
00010 // and under no circumstances can it be used with non-TI connectivity device.
00011 //
00012 //*****************************************************************************
00013 
00014 #ifndef _HTTP_DYNAMIC_H_
00015 #define _HTTP_DYNAMIC_H_
00016 
00017 #include "HttpConfig.h"
00018 
00019 
00020 
00021 
00022 #ifdef HTTP_CORE_ENABLE_DYNAMIC
00023 
00024 /**
00025  * @defgroup HttpDynamic Dynamic request handler module
00026  * This module implements dynamic content processing for HTTP requests.
00027  * All requests are handled by C code functions, and the response contents is returned via HttpResopnse routines
00028  * Note this module is only compiled if HTTP_CORE_ENABLE_DYNAMIC is defined in HttpConfig.h
00029  *
00030  * @{
00031  */
00032 
00033 #include "HttpRequest.h"
00034 
00035 #define     MAX_RESOURCE        10
00036 
00037 #ifdef  __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 typedef struct
00042 {
00043     unsigned char rest_method;
00044     unsigned char *ResourceString;
00045     unsigned char* (*pCbfunc)(void*);
00046 }Resource;
00047 
00048 #define     POST    0
00049 #define     GET     1
00050 
00051 
00052 int SetResources(unsigned char method, char* pBuf, unsigned char* (*pCbRestFunc)(void *pArgs) );
00053 
00054 /**
00055  * Initialize HttpDynamic module state for a new request, and identify the request
00056  * This function must examine the specified resource string and determine whether it can commit to process this request
00057  * If this function returns nonzero, then the core will call HttpDynamic_ProcessRequest() with the rest of the request details.
00058  * @param uConnection The number of the connection. This value is guaranteed to satisfy: 0 <= uConnection < HTTP_CORE_MAX_CONNECTIONS
00059  * @param resource The resource part of the URL, as specified by the browser in the request, including any query string (and hash)
00060  *                 Note: The resource string exists ONLY during the call to this function. The string pointer should not be copied by this function.
00061  * @param method The HTTP method sent from the client for the resource
00062  * @return nonzero if request is to be handled by this module. zero if not.
00063  */
00064 int HttpDynamic_InitRequest(UINT16 uConnection, struct HttpBlob resource, UINT8 method);
00065 
00066 /**
00067  * Process a dynamic-content HTTP request
00068  * This function is only be called by the core, if HttpDynamic_InitRequest() returns nonzero.
00069  * This function processes the specified HTTP request, and send the response on the connection specified by request->uConnection.
00070  * This function must call the HttpResponse_*() functions in order to send data back to the browser.
00071  * Please refer to HttpResponse.h for more information.
00072  * @param request Pointer to all data available about the request
00073  */
00074 int HttpDynamic_ProcessRequest(struct HttpRequest* request);
00075 
00076 /// @}
00077 
00078 #ifdef  __cplusplus
00079 }
00080 #endif /* __cplusplus */
00081 
00082 #endif // HTTP_CORE_ENABLE_DYNAMIC
00083 
00084 #endif // _HTTP_DYNAMIC_H_
00085