SharkSSL™ Embedded SSL/TLS Stack
Minnow Server ZIP File System Plugin

Detailed Description

The ZipFileSystem is an optional plugin that requires the Barracuda Web Server ZipFileIterator plugin.

The optional ZipFileSystem plugin for the Minnow Server lets you store the web presentation logic compressed in the device. Compressed web applications are typically only one-third of the original size. The compressed web pages are not uncompressed on the device. The web pages are extracted from within the ZIP file and sent "as is" to the browser. All modern browsers uncompress "compressed" data received from the servers.

The optional ZipFileSystem plugin is available at an additional cost.

The ZipFileSystem is a small plugin that includes the classes ZipContainer, CentralDirIterator, and ZipFileInfo. The complete ZipFileSystem does not come delivered with SharkSSL.

Modules

 ZIP File System IO
 Minnow Server ZIP file system IO plugin.
 

Data Structures

struct  ZipFileSystem
 The ZipFileSystem handle. More...
 

Functions

MSFetchPage msInitZipFileSystem (ZipFileSystem *zfs, ZipReader *zipReader)
 Initializes the ZIP File System and returns a WsFetchPage callback function. More...
 

Function Documentation

◆ msInitZipFileSystem()

MSFetchPage msInitZipFileSystem ( ZipFileSystem zfs,
ZipReader zipReader 
)

Initializes the ZIP File System and returns a WsFetchPage callback function.

Parameters
zfsthe ZipFileSystem to initialize
zipReadera device driver (interface object) between the Zip File System and the ZIP file. The example below extern declares a function that returns a ZipReader object. This function is typically created automatically by our bin2c tool which converts a ZIP file into a C array. The bin2c tool also generates a ZipReader object automatically. You can also create your own ZipReader driver object if you, for example, want to keep the ZIP file separate from your firmware.

Example code:

extern ZipReader* getZipReader(void);
.
.
wph.fetchPage = msInitZipFileSystem(&zfs, getZipReader());
wph.fetchPageHndl=&zfs;
MSFetchPage msInitZipFileSystem(ZipFileSystem *zfs, ZipReader *zipReader)
Initializes the ZIP File System and returns a WsFetchPage callback function.
The WssProtocolHandshake structure keeps state information for the web server function MS_ebServer.
Definition: MSLib.h:141
MSFetchPage fetchPage
In param: set the page fetch callback function if you plan on storing the web application in the devi...
Definition: MSLib.h:175
void * fetchPageHndl
In param: The MSFetchPage handle, if any.
Definition: MSLib.h:178
The ZipFileSystem handle.
Definition: ZipFileSystem.h:74
Abstract interface class for reading a ZipFile.
Definition: ZipFileIterator.h:72

The following example shows a code snippet from a ZIP file converted to C data by running the bin2c tool as follows:
bin2c -z getZipReader www.zip www.c

static const U8 zipfileData[] = { ZIP FILE CONTENT HERE };
//ZIP device driver function
int readFromZipFile(CspReader* o,void* data,U32 offset,U32 size,int blockStart)
{
memcpy(data, zipfileData+offset, size); // Copy ZIP content at offset pos
return 0; // OK
}
// Init and return a ZIP device driver
ZipReader* getZipReader(void)
{
static ZipReader zipReader;
ZipReader_constructor(&zipReader,readFromZipFile,sizeof(zipfileData));
CspReader_setIsValid(&zipReader);
return &zipReader;
}