Main Page | Class List | File List | Class Members | File Members

mycgisession.c File Reference

#include "mycgisession.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  CGISESSION_struct

Defines

#define SESSION_TIMEOUT   600
#define SESSION_TABLE   "cgi_session"
#define ERROR   1;
#define ENC_TYPE_NONE   0
#define ENC_TYPE_BASE64   1
#define MAX_TABLE_NAME   64

Functions

int cgisession_init_mysql_connection (char *host, char *username, char *password, char *database, unsigned int port)
int cgisession_have_mysql_connection (MYSQL *m)
int cgisession_load (char *key)
int cgisession_save ()
int cgisession_new ()
void cgisession_free ()
int cgisession_set_data (void *data, unsigned int size)
void * cgisession_get_data ()
char * cgisession_get_key ()
void cgisession_dump ()
int cgisession_option_encoding (int enc)
int cgisession_option_timeout (unsigned int secs)
int cgisession_option_table (char *table_name)
int cgisession_update (char *key)


Define Documentation

#define ENC_TYPE_BASE64   1
 

Definition at line 37 of file mycgisession.c.

Referenced by cgisession_option_encoding().

#define ENC_TYPE_NONE   0
 

Definition at line 36 of file mycgisession.c.

Referenced by cgisession_option_encoding().

#define ERROR   1;
 

Definition at line 34 of file mycgisession.c.

#define MAX_TABLE_NAME   64
 

Definition at line 39 of file mycgisession.c.

#define SESSION_TABLE   "cgi_session"
 

Definition at line 32 of file mycgisession.c.

#define SESSION_TIMEOUT   600
 

Definition at line 31 of file mycgisession.c.


Function Documentation

void cgisession_dump (   ) 
 

prints the cgisession structure to stdout

Definition at line 246 of file mycgisession.c.

References CGISESSION_struct::data, CGISESSION_struct::encoding, CGISESSION_struct::key, CGISESSION_struct::size, CGISESSION_struct::stored, and CGISESSION_struct::timeout.

void cgisession_free (   ) 
 

Frees up data allocated for the session..

Definition at line 206 of file mycgisession.c.

void* cgisession_get_data (   ) 
 

Get's the data for the cgi session..

Definition at line 230 of file mycgisession.c.

References CGISESSION_struct::data.

char* cgisession_get_key (   ) 
 

gets the key for the current cgisession

Definition at line 238 of file mycgisession.c.

References CGISESSION_struct::key.

int cgisession_have_mysql_connection (  MYSQL *  m  ) 
 

This overloaded function to use if you allready have a mysql connection you want to use

Definition at line 103 of file mycgisession.c.

int cgisession_init_mysql_connection (  char *  host,
char *  username,
char *  password,
char *  database,
unsigned int  port
) 
 

Creates the connection to the mysql database. Must be called before any other function in this library can be called.

Definition at line 77 of file mycgisession.c.

int cgisession_load (  char *  key  ) 
 

If session_key is NULL, this will initiate a new session otherwise it updates the old session indicated by session_key.

Calling this function will override values set by calls to the cgisession_option_* functions.

If no session exist with the given key, then this function returns NULL. Otherwise it return the newly generated session_key.

Definition at line 127 of file mycgisession.c.

References cgisession_update(), and CGISESSION_struct::stored.

int cgisession_new (   ) 
 

Creates a new cgisession. This will not be reflected in the database before cgisession_save() has been called. return 0 on success.

Definition at line 198 of file mycgisession.c.

References CGISESSION_struct::key.

int cgisession_option_encoding (  int  enc  ) 
 

Sets the encoding type

Definition at line 264 of file mycgisession.c.

References ENC_TYPE_BASE64, ENC_TYPE_NONE, and CGISESSION_struct::encoding.

int cgisession_option_table (  char *  table_name  ) 
 

Sets the name of the cgi session table

Definition at line 288 of file mycgisession.c.

int cgisession_option_timeout (  unsigned int  secs  ) 
 

Setting this to zero means that the session will never timeout

Definition at line 279 of file mycgisession.c.

References CGISESSION_struct::encoding.

int cgisession_save (   ) 
 

Saves the cgi session to the database

Definition at line 145 of file mycgisession.c.

References CGISESSION_struct::key, CGISESSION_struct::size, CGISESSION_struct::stored, and CGISESSION_struct::timeout.

int cgisession_set_data (  void *  data,
unsigned int  size
) 
 

Set's the data for the cgi session..

Definition at line 216 of file mycgisession.c.

References CGISESSION_struct::data, and CGISESSION_struct::size.

int cgisession_update (  char *  key  ) 
 

Rehashes session id

Definition at line 362 of file mycgisession.c.

References CGISESSION_struct::key.

Referenced by cgisession_load().


Generated on Tue Feb 15 13:35:47 2005 for MyCGISession by  doxygen 1.3.9.1