Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
C Server Pages

Detailed Description

C Server Pages make it possible to insert C or C++ code into HTML template files by using special tags.

The technology is similar to other server-side technologies such as JSP, PHP, ASP, etc.

See the CSP user manual for more information on CSP.

See also
Barracuda Introduction

Classes

struct  FileCspReader
 Example code that shows you how to write a CspReader driver object. More...
 

Typedefs

typedef int(* CspReader_Read) (struct CspReader *o, void *data, U32 offset, U32 size, int blockStart)
 Prototype for the CspReader callback function. More...
 
typedef void(* CspInit) (struct HttpDir *cspRoot, struct CspReader *reader)
 Function prototype for the "initialize function" generated by CspLink. More...
 
typedef FileCspReader FileCspReader
 Example code that shows you how to write a CspReader driver object. More...
 

Typedef Documentation

◆ CspInit

typedef void(* CspInit) (struct HttpDir *cspRoot, struct CspReader *reader)

Function prototype for the "initialize function" generated by CspLink.

CspLink groups together CSP pages and generates a CspInit function. You must call the method at system startup.

Parameters
cspRootthe position in the virtual files system where you want the CSP to be installed.
readerthe interface between the CSP data file and the generated CSP engine.

◆ CspReader_Read

typedef int(* CspReader_Read) (struct CspReader *o, void *data, U32 offset, U32 size, int blockStart)

Prototype for the CspReader callback function.

Parameters
oRequired initialized reader; upcast to the implementation object.
dataRequired writable buffer with room for size bytes. Copy the requested binary data here; no NUL termination is implied.
offsetAbsolute byte offset into the CSP data file (or ZIP archive when this interface is used by ZipReader).
sizeExact number of bytes to read. The caller supplies an in-range offset/size pair for the backing data.
blockStartTRUE if this is the beginning of a block. All blocks are protected by a magic number. The httpDiskRead function can use this for an integrity check. For CSP blocks the marker precedes offset by four bytes; ZIP readers ignore this argument.
Returns
Zero only when all requested bytes were copied; a negative implementation error on failure, including a short read. No partial count is returned. All storage is borrowed for this synchronous call.

◆ FileCspReader

Example code that shows you how to write a CspReader driver object.

The Web-Server uses the CspReader driver object when requesting data from the "dat" file generated by CspLink.

This example code uses the file system for reading the "dat" file. The constructor opens the "dat" file and method "diskRead" uses the Posix function fseek for setting the file pointer to the requested offset position and function fread for reading the actual data.