MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
Macros | Typedefs | Functions
mh5cookies.c File Reference

Functions relating to HTTP Cookie Store. More...

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "mh5cookies.h"
#include "mh5memory.h"
#include "mh5base.h"
#include "mh5date.h"
#include "techtype.h"

Macros

#define MAX_COOKIES   32
 
#define MAX_STORE_SIZE   8192
 
#define MINUTE   60
 
#define HOUR   1200
 
#define SECONDS_IN_DAY   (24 * HOUR)
 

Typedefs

typedef struct cookiestore_s cookiestore_t
 

Functions

void MHEG5CookieParse (void *data, U32BIT data_len, char *url)
 Parse a Set-cookie header and add the new cookie to the store. If the header is not a set-cookie, or is not parseable it will be ignored. More...
 
U8BIT * MHEG5CookieGenerateHeader (U8BIT *url)
 Generate a "Cookie" header for the required http request, containing all valid cookies. More...
 
MHEG5Bool MHEG5CookieAdd (MHEG5cookie_t *cookie)
 Directly add a cookie to the store. More...
 
void MHEG5CookieAckHeader (U8BIT *header)
 This function should be called once the header string returned by MHEG5CookieGenerateHeader has been used and is no longer needed. More...
 
MHEG5Bool MHEG5CookieRetrieve (MHEG5cookie_t *cookie)
 Retrieve a specific cookie from the store, referenced by the identity string. More...
 
void MHEG5CookieClearStore (void)
 Delete all cookies from the temporary store. More...
 

Detailed Description

Functions relating to HTTP Cookie Store.

Date
22/02/2010
Author
Omri Barel

Function Documentation

void MHEG5CookieAckHeader ( U8BIT *  header)

This function should be called once the header string returned by MHEG5CookieGenerateHeader has been used and is no longer needed.

Parameters
headerpointer to the string to be released
Returns
nothing
MHEG5Bool MHEG5CookieAdd ( MHEG5cookie_t cookie)

Directly add a cookie to the store.

Parameters
cookiepointer to a structure containing all the required information to generate the cookie
Returns
MHEG5TRUE on success, MHEG5FALSE otherwise
void MHEG5CookieClearStore ( void  )

Delete all cookies from the temporary store.

Returns
nothing
U8BIT* MHEG5CookieGenerateHeader ( U8BIT *  url)

Generate a "Cookie" header for the required http request, containing all valid cookies.

Parameters
urlNULL terminated string containing the the url of the http request
Returns
Pointer to a NULL terminated string containing the Cookie header to be included in the http request. NULL if no cookies exist for the url.
void MHEG5CookieParse ( void *  data,
U32BIT  data_len,
char *  url 
)

Parse a Set-cookie header and add the new cookie to the store. If the header is not a set-cookie, or is not parseable it will be ignored.

Parameters
dataString containing the header to be parsed
data_lenLength of the header, in bytes
Returns
Nothing
MHEG5Bool MHEG5CookieRetrieve ( MHEG5cookie_t cookie)

Retrieve a specific cookie from the store, referenced by the identity string.

Parameters
cookiePointer to allocated cookie data structure, with its identity string set.
Returns
MHEG5TRUE if successful MHEG5FALSE otherwise