www.beck-ipc.com

@CHIP-RTOS C Library - Common Gateway Interface API


CGI_GetCookie

Returns the next available cookie.

int CGI_GetCookie ( char far **name,
                    char far **value,
                    char far **domain,
                    char far **path,
                    char far **port,
                    char far **version,
                    rpCgiPtr CgiRequest);

Parameters

name

Output Parameter:   A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the cookie-name.

value

Output Parameter:   A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the cookie-value.

domain

Output Parameter:   A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the cookie-domain. If you are not interest in the cookie-domain then you can pass a null pointer.

path

Output Parameter:   A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the cookie-path. If you are not interest in the cookie-path then you can pass a null pointer.

port

Output Parameter:   A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the cookie-port. If you are not interest in the cookie-port then you can pass a null pointer.

version

Output Parameter:   A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the cookie-version. If you are not interest in the cookie-version then you can pass a null pointer.

CgiRequest

Input Parameter:   The cgi request pointer which was passed to the cgi function.

Return Value

CGI_COOKIE_ERR_OK: success
CGI_COOKIE_ERR_NONE: there was no more cookie found

Comments

On the first call the function returns the first found cookie. On next calls the function returns the next found cookie, until no more cookie could be found.
Note that this function must be called within the context of a cgi function. The pointers returned by the function are valid only while the cgi function is active. On return from the cgi function the pointer will become invalid.

Example:

            

char *name;
char *value;
char *domain;
char *path;
char *port;
char *version;

while ( CGI_GetCookie( &name, &value, &domain, &path, &port, &version ) == CGI_COOKIE_ERR_OK)
{
    // do something with the found cookie
    printf( "Cookie found:\r\n"
            "Name   : %s\r\n",
            "Value  : %s\r\n",
            "Domain : %s\r\n",
            "Path   : %s\r\n",
            "Port   : %s\r\n",
            "Version: %s\r\n",
            name, value, domain, path, port, version );
}

See Also

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    n/an/an/aV1.15V1.00

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.10

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document