eyBuildLib API Reference : eyBuildLib

ebsession

NAME

ebsession - session function

ROUTINES

makeSessID( ) - create session ID
ebSessGC( ) - garbage collection by probability
ebSessInit( ) - initilize the session
ebSessSetHandle( ) - change the default session handle
ebSessStart( ) - prepare session environment
ebSessDestroy( ) - remove current session completely
ebSessEnd( ) - stop this session
ebSessIDRenew( ) - renew current session ID
ebSessGetID( ) - get current session ID
ebSessRegister( ) - register new session variable or update exist variable
ebSessUnregister( ) - remove specified session variable
ebGetSessVariable( ) - get session variable by key
ebSessIsRegister( ) - check specified session variable exist or not

DESCRIPTION

session

INCLUDE

ebsession.h

SEE ALSO


eyBuildLib : Routines

makeSessID( )

NAME

makeSessID( ) - create session ID

SYNOPSIS

char * ebMakeSessID
    (
    char * pbuf,              /* where store to */
    int    len                /* max length */
    )

DESCRIPTION

this routine is to create session ID, the buffer length should longer 1 byte than len to hold \0.

RETURN

pinter to pbuf

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessGC( )

NAME

ebSessGC( ) - garbage collection by probability

SYNOPSIS

int ebSessGC (void)

DESCRIPTION

this routine is to garbage collection by probability

RETURN

OK/ERROR

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessInit( )

NAME

ebSessInit( ) - initilize the session

SYNOPSIS

int ebSessInit
    (
    char * savepath,          /* session struct */
    int    timeout,           /* cookie timeout */
    int    gcprob             /* default: 1000 */
    )

DESCRIPTION

this routine is to initilize the session

RETURN

OK/ERROR

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessSetHandle( )

NAME

ebSessSetHandle( ) - change the default session handle

SYNOPSIS

int ebSessSetHandle
    (
    SOPEN    open,            /* hooks */
    SCLOSE   close,           /* hooks */
    SREAD    read,            /* hooks */
    SWRITE   write,           /* hooks */
    SDISTORY distory,         /* hooks */
    SRENAME  rename,          /* hooks */
    SGC      gc               /* hooks */
    )

DESCRIPTION

this routine is to change the default session handle. by this routine you can customize private session (e.g. store into database)

RETURN

OK/ERROR

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessStart( )

NAME

ebSessStart( ) - prepare session environment

SYNOPSIS

int ebSessStart (void)

DESCRIPTION

this routine will load session from file system and prepare session environment. it will try to call ebSessInit( ) and set default setting if you don't call it before.

RETURN

OK/ERROR

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessDestroy( )

NAME

ebSessDestroy( ) - remove current session completely

SYNOPSIS

int ebSessDestroy (void)

DESCRIPTION

this routine will remove current session completely, it includes close session file, free session resource, remove session file and clean session cookies.

RETURN

OK/ERROR

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessEnd( )

NAME

ebSessEnd( ) - stop this session

SYNOPSIS

int ebSessEnd (void)

DESCRIPTION

this routine is to flush session data into file system and free the session resource.

RETURN

OK/ERROR

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessIDRenew( )

NAME

ebSessIDRenew( ) - renew current session ID

SYNOPSIS

int ebSessIDRenew (void)

DESCRIPTION

this routine is to renew current session ID

RETURN

pointer to the renew session ID, or ""

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessGetID( )

NAME

ebSessGetID( ) - get current session ID

SYNOPSIS

char * ebSessGetID (void)

DESCRIPTION

this routine is to get current session ID

RETURN

pointer to the current session ID, or ""

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessRegister( )

NAME

ebSessRegister( ) - register new session variable or update exist variable

SYNOPSIS

int ebSessRegister
    (
    const char * key,
    const char * value,
    size_t       size
    )

DESCRIPTION

this routine is to register new session variable or update exist variable. if size equal zero, it will look value as a string and count its length by strlen( ).

RETURN

OK/ERROR

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessUnregister( )

NAME

ebSessUnregister( ) - remove specified session variable

SYNOPSIS

int ebSessUnregister
    (
    const char * key
    )

DESCRIPTION

this routine is to remove specified session variable

RETURN

OK/ERROR

SEE ALSO

ebsession


eyBuildLib : Routines

ebGetSessVariable( )

NAME

ebGetSessVariable( ) - get session variable by key

SYNOPSIS

char * ebGetSessVariable
    (
    const char * key,         /* session key */
    char *       buff,        /* where store into */
    size_t       size         /* max size of buffer */
    )

DESCRIPTION

this routine is to get session variable by key. if buff is not NULL and size not equa zero, it will copy data to this buffer; otherwise, it will pointer to a global buffer (user must copy the return value as so as possiable).

RETURN

pointer to the result, or ""

SEE ALSO

ebsession


eyBuildLib : Routines

ebSessIsRegister( )

NAME

ebSessIsRegister( ) - check specified session variable exist or not

SYNOPSIS

BOOL ebSessIsRegister
    (
    const char * key
    )

DESCRIPTION

this routine is to check specified session variable exist or not

RETURN

TRUE/FALSE

SEE ALSO

ebsession