TI's CC3100 websocket camera demo with Arducam mini ov5642 and freertos. Should work with other M3's. Work in progress test demo.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

HTTP and WebSocket Response modules

HTTP and WebSocket Response modules

This module implements routines to allow content handler modules to build and send HTTP responses back to the client. More...

Functions

int HttpResponse_Headers (UINT16 uConnection, UINT16 uHttpStatus, UINT16 uFlags, UINT32 uContentLength, struct HttpBlob contentType, struct HttpBlob location)
 Respond with the specified HTTP status and headers.
void HttpResponse_GetPacketSendBuffer (struct HttpBlob *pPacketSendBuffer)
 Retrieves the pointer and size of the packet-send buffer This function should be called by content handlers that wish to use the already-allocated packet-send buffer in calls to HttpResponse_Content()
int HttpResponse_Content (UINT16 uConnection, struct HttpBlob content)
 Send response content to the client.
int HttpResponse_CannedRedirect (UINT16 uConnection, struct HttpBlob location, UINT16 bPermanent)
 Sends a canned response, with an HTTP redirect This function should be called *instead* of HttpResponse_Status(), HttpResponse_Headers() and HttpResponse_Content()
int HttpResponse_CannedError (UINT16 uConnection, UINT16 uHttpStatus)
 Sends a canned response, with an error message This function should be called *instead* of HttpResponse_Status(), HttpResponse_Headers() and HttpResponse_Content()

Detailed Description

This module implements routines to allow content handler modules to build and send HTTP responses back to the client.

There are two layers in this module:

  • The lower layer consists of HttpResponse_Headers() and HttpResponse_Content(). These routines allow the caller to specify all details of the response.
  • The higher layer consists of HttpResponse_Canned*(). These routines emit canned (pre-made) responses, such as redirects and errors, which are useful in many situations.

Function Documentation

int HttpResponse_CannedError ( UINT16  uConnection,
UINT16  uHttpStatus 
)

Sends a canned response, with an error message This function should be called *instead* of HttpResponse_Status(), HttpResponse_Headers() and HttpResponse_Content()

Parameters:
uConnectionThe connection number, as it appears in the HttpRequest structure
uHttpStatusThe HTTP error status. Must be one of HTTP_STATUS_ERROR_*

Definition at line 1541 of file HttpCore.cpp.

int HttpResponse_CannedRedirect ( UINT16  uConnection,
struct HttpBlob  location,
UINT16  bPermanent 
)

Sends a canned response, with an HTTP redirect This function should be called *instead* of HttpResponse_Status(), HttpResponse_Headers() and HttpResponse_Content()

Parameters:
uConnectionThe connection number, as it appears in the HttpRequest structure
pLocationThe redirect URL
bPermanentzero for temporary redirect, nonzero for permanent redirect

Definition at line 1530 of file HttpCore.cpp.

int HttpResponse_Content ( UINT16  uConnection,
struct HttpBlob  content 
)

Send response content to the client.

This function may be called more than once, until all the content is sent.

Parameters:
uConnectionThe connection number, as it appears in the HttpRequest structure
contentContent blob to send to the client.

Definition at line 1339 of file HttpCore.cpp.

void HttpResponse_GetPacketSendBuffer ( struct HttpBlob *  pPacketSendBuffer )

Retrieves the pointer and size of the packet-send buffer This function should be called by content handlers that wish to use the already-allocated packet-send buffer in calls to HttpResponse_Content()

Parameters:
[out]pPacketSendBufferReturns the pointer and size of the packet-send buffer

Definition at line 1333 of file HttpCore.cpp.

int HttpResponse_Headers ( UINT16  uConnection,
UINT16  uHttpStatus,
UINT16  uFlags,
UINT32  uContentLength,
struct HttpBlob  contentType,
struct HttpBlob  location 
)

Respond with the specified HTTP status and headers.

Parameters:
uConnectionThe connection number, as it appears in the HttpRequest structure
uHttpStatusThe HTTP status number to response with. Must be one of HTTP_STATUS_*
uFlagsFlags which are manifested in the response headers. See HTTP_RESPONSE_FLAG_*
uContentLengthThe total length of content which will be sent via HttpResponse_Content()
contentTypeThe content type string, or NULL to omit the content type
locationA string which will be used for the Location header, or NULL to omit the Location header

Definition at line 1251 of file HttpCore.cpp.