eyBuildLib API Reference : eyBuildLib
ebrespond - process http request
getEbiofp( ) - get current I/O buffer file description
print( ) - write a formatted string and buffered by CSP page
bwrite( ) - write binary data block
header( ) - send HTTP header in CSP script
setcookie( ) - send cookie with HTTP header
redirect( ) - send redirect instruction with HTTP header
forward( ) - internal redirect in CGI virtual directory
set( ) - add a query variable into this session
ebHeader( ) - output HTTP header
ebSetVar( ) - add a query variable into this session
ebSetCookie( ) - send cookie with HTTP header
ebRedirect( ) - redirect to an URL
ebForward( ) - internal redirect in CGI virtual directory
ebUrlEncode( ) - encode the unsafe characters into %XX in URL
ebUrlDecode( ) - decode the URL and store in a global buffer
ebHtmlPrint( ) - convert plain text into html format text
ebHtmlnPrint( ) - convert plain text into html format text limit data length
ebXmlPrint( ) - convert plain text into html format text
ebXmlnPrint( ) - convert plain text into html format text limit data length
ebHtmlEncode( ) - convert plain text into html format text
ebHtmlDecode( ) - convert html format text into plain text
process http request
ebmultiform.h
ebrequest.h
getEbiofp( ) - get current I/O buffer file description
void * getEbiofp (void)
This routine is to get current I/O buffer file description
pointer to current I/O buffer file description
print( ) - write a formatted string and buffered by CSP page
int print ( const char * fmt, ... )
This routine writes a formatted string to a specified file descriptor, if the csppage is buffered, this routine will not flush until buffer full or force call flush.
Its function and syntax are otherwise identical to printf( ).
The number of characters output, or ERROR if there is an error during output.
bwrite( ) - write binary data block
int bwrite ( void * data, /* what to write */ size_t size /* data size */ )
This routine is to writes a write binary data block, it will force flush current CSP buffer before write data.
block data will not be buffered by CSP page.
The number data output, or ERROR during output.
header( ) - send HTTP header in CSP script
int header ( const char * fmt, /* format string to write */ ... /* optional arguments to format string */ )
This routine send HTTP header in CSP script. Header must be sent before any output flushed from your script (this is a protocol restriction).
Dobule "\r\n" or "\n" means the HTTP header output complete, after that you can not output any HTTP header any more. If you don't output \r\n at the end of the line, this function will add it for you automatically. Exmale:
header("Status: %s", "200 OK"); header("Content-Type: %s\r\n\r\n", content_type);
OK, or ERROR while send HTTP header error
ebrespond, print( ), setcookie( )
setcookie( ) - send cookie with HTTP header
int setcookie ( const char * name, const char * value, ... /* time_t expire, char * path, char * */ /* domain, int secure */ )
This routine send cookie with HTTP header. Like other headers, cookies must be sent before any output flushed from your script (this is a protocol restriction, make sure CSP page buffer not flushed is OK).
The parameter expire, path, domain, secure is not need. You should make sure the last parameter is set to NULL, eg:
setcookie("name1", "value1", NULL); setcookie("name2", "value2", time(NULL)+3600, NULL); setcookie("name3", "value3", time(NULL)+7200, "/cgi-bin/", NULL);
OK, or ERROR while send cookie error
ebrespond, header( ), print( )
redirect( ) - send redirect instruction with HTTP header
int redirect ( const char * p_url, ... )
This routine send redirect instruction with HTTP header Like other headers, redirect instruction must be sent before any output flushed from your script (this is a protocol restriction).
redirect("http://www.eybuild.com"); redirect("/cgi-bin/mm.cgi");
OK, or ERROR while send redirect instruction error
ebrespond, header( ), setcookie( ), print( )
forward( ) - internal redirect in CGI virtual directory
int forward ( const char * pname, BOOL blcsp )
this routine same with ebForward( )
OK/ERROR
set( ) - add a query variable into this session
int set ( const char * name, const char * value )
this routine same with ebSetVar( )
OK/ERROR
ebHeader( ) - output HTTP header
int ebHeader ( void * ebfp, const char * fmt, /* format string to write */ ... /* optional arguments to format string */ )
this routine is to output HTTP header. if data has been flushed before, it will not output this header and will return ERROR.
OK/ERROR
ebSetVar( ) - add a query variable into this session
int ebSetVar ( const char * name, /* variable name */ const char * value /* variable value */ )
this routine is to add query variable into this session, you can get its value by getParameter( ).
OK/ERROR
ebrespond, getParameter( ), getParameterNext( ), isSetQuery( )
ebSetCookie( ) - send cookie with HTTP header
int ebSetCookie ( void * ebfp, const char * name, const char * value, ... /* time_t expire, char * path, char * */ /* domain, int secure */ )
SEE setcookie
OK/ERROR
ebRedirect( ) - redirect to an URL
int ebRedirect ( void * ebfp, const char * p_url, ... )
this routine is to redirect to an url. if data has been flushed before, it will not redirect to the url and return will ERROR.
OK/ERROR
ebForward( ) - internal redirect in CGI virtual directory
int ebForward ( const char * pname, /* internal page name */ BOOL blcsp /* redirect to CSP type */ )
This routine will do internal redirect in CGI virtual directory.
forward("/login/login.csp", TRUE); /* redirect to a CSP page */ forward("/html/view.htm", FALSE); /* redirect to a ROM file */
OK/ERROR
ebrespond, redirect, header( ), setcookie( ), print( )
ebUrlEncode( ) - encode the unsafe characters into %XX in URL
char * ebUrlEncode ( char * to, /* dest buffer */ const char * from, /* src url */ int maxlen /* buffer max length */ )
this routine is to encode the unsafe characters into %XX in URL
RFC 2396
if "to" is NULL, it will be stored into global temporary buffer.
pointer to dest buffer
ebUrlDecode( ) - decode the URL and store in a global buffer
char * ebUrlDecode ( char * to, /* src url */ const char * from /* src url */ )
this routine is to decode the URL and store in a global buffer. The value will be covered when next time call ebUrlEncode( ) or ebUrlDecode( ).
if "to" is NULL, it will be stored into global temporary buffer.
pointer to dest buffer
ebHtmlPrint( ) - convert plain text into html format text
int ebHtmlPrint ( const char * data /* data to write */ )
this routine just convert the ", <, >, & into html codes.
this routine will not convert \x20 to space;
the length has been output, or < 0 if error
ebHtmlnPrint( ) - convert plain text into html format text limit data length
int ebHtmlnPrint ( const char * data, /* data to write */ int dlen /* length of data */ )
this routine just convert the ", <, >, & into html codes. Paramter dlen is to limit the source data length.
this routine will not convert \x20 to space;
the length has been output, or < 0 if error
ebXmlPrint( ) - convert plain text into html format text
int ebXmlPrint ( const char * data /* data to write */ )
this routine will convert the ', ", <, >, & into xml codes.
XML required convert ' into "'"
the length has been output, or < 0 if error
ebXmlnPrint( ) - convert plain text into html format text limit data length
int ebXmlnPrint ( const char * data, /* data to write */ int dlen /* length of data */ )
this routine will convert the ', ", <, >, & into xml codes. Paramter dlen is to limit the source data length.
XML required convert ' into "'"
the length has been output, or < 0 if error
ebHtmlEncode( ) - convert plain text into html format text
char * ebHtmlEncode ( char * to, /* dest buffer */ const char * from, /* src url */ int maxlen /* buffer max length */ )
this routine convert the \x20, ", <, >, &, ... into html codes.
if "to" is NULL, it will be stored into global temporary buffer.
pointer to dest buffer.
ebHtmlDecode( ) - convert html format text into plain text
char * ebHtmlDecode ( char * to, /* src url */ const char * from /* src url */ )
this routine convert the html codes , ", <, >, & into \x20, ", <, >, &
if "to" is NULL, it will be stored into global temporary buffer.
pointer to dest buffer.