David Fletcher / Mbed 2 deprecated CC3000WebServer

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Flash-storage database management

Flash-storage database management

This module implements a database for static content, which is either stored on Flash or read-only memory of some kind. More...

Data Structures

struct  FlashDBContent
 A structure to hold all data about content which was found in a database lookup. More...

Functions

void FlashDB_Init ()
 Initialize the flash database module.
int FlashDB_FindContentType (uint16 index, struct HttpBlob *pResult)
 Find a content-type in the database.
int FlashDB_FindContent (struct HttpBlob pResource, struct FlashDBContent *pResult)
 Lookup content in the database, given a resource identifier.

Detailed Description

This module implements a database for static content, which is either stored on Flash or read-only memory of some kind.

The database is pre-compiled using external tools and is stored as a "flat file" in memory. The contents of the database are:

  • A list of content-type strings
  • A sorted-list of static content entities. Each entity has:
    • URL Resource of the content (sort and lookup key)
    • Content type number (index into the list of content-types)
    • Content binary data
    • Additional metadata flags (Compressed, Requires-authentication)

Function Documentation

int FlashDB_FindContent ( struct HttpBlob  pResource,
struct FlashDBContent pResult 
)

Lookup content in the database, given a resource identifier.

Parameters:
pResourceThe resource as given in the HTTP request
[out]pResultReturns the content and its metadata
Returns:
nonzero if successful. zero if such a resource was not found.

Definition at line 184 of file FlashDB.cpp.

int FlashDB_FindContentType ( uint16  index,
struct HttpBlob pResult 
)

Find a content-type in the database.

Parameters:
indexThe index of the content type in the database
[out]pResultReturns the string and its length
Returns:
nonzero if successful. zero if index out of range.

Definition at line 163 of file FlashDB.cpp.

void FlashDB_Init (  )

Initialize the flash database module.

Parameters:
pDatabasePointer to the beginning of the database in flash memory

Definition at line 152 of file FlashDB.cpp.