eyBuildLib API Reference : eyBuildLib

ebrespond

NAME

ebrespond - process http request

ROUTINES

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

DESCRIPTION

process http request

INCLUDE

ebmultiform.h

SEE ALSO

ebrequest.h


eyBuildLib : Routines

getEbiofp( )

NAME

getEbiofp( ) - get current I/O buffer file description

SYNOPSIS

void * getEbiofp (void)

DESCRIPTION

This routine is to get current I/O buffer file description

RETURNS

pointer to current I/O buffer file description

SEE ALSO

ebrespond


eyBuildLib : Routines

print( )

NAME

print( ) - write a formatted string and buffered by CSP page

SYNOPSIS

int print
    (
    const char * fmt,
                 ...
    )

DESCRIPTION

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( ).

RETURNS

The number of characters output, or ERROR if there is an error during output.

SEE ALSO

ebrespond, ebprintf( )


eyBuildLib : Routines

bwrite( )

NAME

bwrite( ) - write binary data block

SYNOPSIS

int bwrite
    (
    void * data,              /* what to write */
    size_t size               /* data size */
    )

DESCRIPTION

This routine is to writes a write binary data block, it will force flush current CSP buffer before write data.

NOTE

block data will not be buffered by CSP page.

RETURNS

The number data output, or ERROR during output.

SEE ALSO

ebrespond, ebprintf( )


eyBuildLib : Routines

header( )

NAME

header( ) - send HTTP header in CSP script

SYNOPSIS

int header
    (
    const char * fmt,         /* format string to write */
                 ...          /* optional arguments to format string */
    )

DESCRIPTION

This routine send HTTP header in CSP script. Header must be sent before any output flushed from your script (this is a protocol restriction).

NOTE

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);

RETURNS

OK, or ERROR while send HTTP header error

SEE ALSO

ebrespond, print( ), setcookie( )


eyBuildLib : Routines

setcookie( )

NAME

setcookie( ) - send cookie with HTTP header

SYNOPSIS

int setcookie
    (
    const char * name,
    const char * value,
                 ...          /* time_t expire, char * path, char * */
                              /* domain, int secure */ 
    )

DESCRIPTION

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);

RETURNS

OK, or ERROR while send cookie error

SEE ALSO

ebrespond, header( ), print( )


eyBuildLib : Routines

redirect( )

NAME

redirect( ) - send redirect instruction with HTTP header

SYNOPSIS

int redirect
    (
    const char * p_url,
                 ...
    )

DESCRIPTION

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");

RETURNS

OK, or ERROR while send redirect instruction error

SEE ALSO

ebrespond, header( ), setcookie( ), print( )


eyBuildLib : Routines

forward( )

NAME

forward( ) - internal redirect in CGI virtual directory

SYNOPSIS

int forward
    (
    const char * pname,
    BOOL         blcsp
    )

DESCRIPTION

this routine same with ebForward( )

RETURNS

OK/ERROR

SEE ALSO

ebrespond


eyBuildLib : Routines

set( )

NAME

set( ) - add a query variable into this session

SYNOPSIS

int set
    (
    const char * name,
    const char * value
    )

DESCRIPTION

this routine same with ebSetVar( )

RETURNS

OK/ERROR

SEE ALSO

ebrespond


eyBuildLib : Routines

ebHeader( )

NAME

ebHeader( ) - output HTTP header

SYNOPSIS

int ebHeader
    (
    void *       ebfp,
    const char * fmt,         /* format string to write */
                 ...          /* optional arguments to format string */
    )

DESCRIPTION

this routine is to output HTTP header. if data has been flushed before, it will not output this header and will return ERROR.

RETURNS

OK/ERROR

SEE ALSO

ebrespond


eyBuildLib : Routines

ebSetVar( )

NAME

ebSetVar( ) - add a query variable into this session

SYNOPSIS

int ebSetVar
    (
    const char * name,        /* variable name */
    const char * value        /* variable value */
    )

DESCRIPTION

this routine is to add query variable into this session, you can get its value by getParameter( ).

RETURNS

OK/ERROR

SEE ALSO

ebrespond, getParameter( ), getParameterNext( ), isSetQuery( )


eyBuildLib : Routines

ebSetCookie( )

NAME

ebSetCookie( ) - send cookie with HTTP header

SYNOPSIS

int ebSetCookie
    (
    void *       ebfp,
    const char * name,
    const char * value,
                 ...          /* time_t expire, char * path, char * */
                              /* domain, int secure */ 
    )

DESCRIPTION

SEE setcookie

RETURNS

OK/ERROR

SEE ALSO

ebrespond


eyBuildLib : Routines

ebRedirect( )

NAME

ebRedirect( ) - redirect to an URL

SYNOPSIS

int ebRedirect
    (
    void *       ebfp,
    const char * p_url,
                 ...
    )

DESCRIPTION

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.

RETURNS

OK/ERROR

SEE ALSO

ebrespond


eyBuildLib : Routines

ebForward( )

NAME

ebForward( ) - internal redirect in CGI virtual directory

SYNOPSIS

int ebForward
    (
    const char * pname,       /* internal page name */
    BOOL         blcsp        /* redirect to CSP type */
    )

DESCRIPTION

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 */

RETURNS

OK/ERROR

SEE ALSO

ebrespond, redirect, header( ), setcookie( ), print( )


eyBuildLib : Routines

ebUrlEncode( )

NAME

ebUrlEncode( ) - encode the unsafe characters into %XX in URL

SYNOPSIS

char * ebUrlEncode
    (
    char *       to,          /* dest buffer */
    const char * from,        /* src url */
    int          maxlen       /* buffer max length */
    )

DESCRIPTION

this routine is to encode the unsafe characters into %XX in URL

HREF

RFC 2396

NOTE

if "to" is NULL, it will be stored into global temporary buffer.

RETURNS

pointer to dest buffer

SEE ALSO

ebrespond


eyBuildLib : Routines

ebUrlDecode( )

NAME

ebUrlDecode( ) - decode the URL and store in a global buffer

SYNOPSIS

char * ebUrlDecode
    (
    char *       to,          /* src url */
    const char * from         /* src url */
    )

DESCRIPTION

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( ).

NOTE

if "to" is NULL, it will be stored into global temporary buffer.

RETURNS

pointer to dest buffer

SEE ALSO

ebrespond


eyBuildLib : Routines

ebHtmlPrint( )

NAME

ebHtmlPrint( ) - convert plain text into html format text

SYNOPSIS

int ebHtmlPrint
    (
    const char * data         /* data to write */
    )

DESCRIPTION

this routine just convert the ", <, >, & into html codes.

NOTE

this routine will not convert \x20 to space;

RETURNS

the length has been output, or < 0 if error

SEE ALSO

ebrespond


eyBuildLib : Routines

ebHtmlnPrint( )

NAME

ebHtmlnPrint( ) - convert plain text into html format text limit data length

SYNOPSIS

int ebHtmlnPrint
    (
    const char * data,        /* data to write */
    int          dlen         /* length of data */
    )

DESCRIPTION

this routine just convert the ", <, >, & into html codes. Paramter dlen is to limit the source data length.

NOTE

this routine will not convert \x20 to space;

RETURNS

the length has been output, or < 0 if error

SEE ALSO

ebrespond


eyBuildLib : Routines

ebXmlPrint( )

NAME

ebXmlPrint( ) - convert plain text into html format text

SYNOPSIS

int ebXmlPrint
    (
    const char * data         /* data to write */
    )

DESCRIPTION

this routine will convert the ', ", <, >, & into xml codes.

NOTE

XML required convert ' into "'"

RETURNS

the length has been output, or < 0 if error

SEE ALSO

ebrespond


eyBuildLib : Routines

ebXmlnPrint( )

NAME

ebXmlnPrint( ) - convert plain text into html format text limit data length

SYNOPSIS

int ebXmlnPrint
    (
    const char * data,        /* data to write */
    int          dlen         /* length of data */
    )

DESCRIPTION

this routine will convert the ', ", <, >, & into xml codes. Paramter dlen is to limit the source data length.

NOTE

XML required convert ' into "'"

RETURNS

the length has been output, or < 0 if error

SEE ALSO

ebrespond


eyBuildLib : Routines

ebHtmlEncode( )

NAME

ebHtmlEncode( ) - convert plain text into html format text

SYNOPSIS

char * ebHtmlEncode
    (
    char *       to,          /* dest buffer */
    const char * from,        /* src url */
    int          maxlen       /* buffer max length */
    )

DESCRIPTION

this routine convert the \x20, ", <, >, &, ... into html codes.

NOTE

if "to" is NULL, it will be stored into global temporary buffer.

RETURNS

pointer to dest buffer.

SEE ALSO

ebrespond


eyBuildLib : Routines

ebHtmlDecode( )

NAME

ebHtmlDecode( ) - convert html format text into plain text

SYNOPSIS

char * ebHtmlDecode
    (
    char *       to,          /* src url */
    const char * from         /* src url */
    )

DESCRIPTION

this routine convert the html codes &nbsp;, &quot;, &lt;, &gt;, &amp; into \x20, ", <, >, &

NOTE

if "to" is NULL, it will be stored into global temporary buffer.

RETURNS

pointer to dest buffer.

SEE ALSO

ebrespond