Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

clientlib.h File Reference

client library functions More...

Go to the source code of this file.

Data Structures

struct  s_cl_thread
struct  s_message
struct  s_mod_api_ent

Typedefs

typedef void *(* t_mod_api )(void *)
typedef s_mod_api_ent t_mod_api_ent
typedef s_message t_message
typedef s_cl_thread t_cl_thread
typedef int(* t_filter_begin )(t_cf_hash *, t_configuration *, t_configuration *)
typedef int(* t_filter_connect )(t_cf_hash *, t_configuration *, t_configuration *, int)
typedef int(* t_filter_list )(t_cf_hash *, t_configuration *, t_configuration *, t_cl_thread *, int)
typedef int(* t_filter_list_posting )(t_cf_hash *, t_configuration *, t_configuration *, t_message *, unsigned long long, int)
typedef int(* t_filter_posting )(t_cf_hash *, t_configuration *, t_configuration *, t_cl_thread *, t_cf_template *)
typedef int(* t_filter_init_view )(t_cf_hash *, t_configuration *, t_configuration *, t_cf_template *, t_cf_template *)
typedef int(* t_new_post_filter )(t_cf_hash *, t_configuration *, t_configuration *, t_message *, int, int)

Functions

u_char * get_uconf_name (const u_char *uname)
int set_us_up_the_socket (void)
void str_error_message (const u_char *msg, FILE *out, int rd,...)
u_char * get_error_message (const u_char *msg, int rd, size_t *len,...)
u_char * get_time (t_configuration *cfg, const u_char *symbol, int *len, time_t *date)
u_char * get_link (u_int64_t tid, u_int64_t mid)
int has_answers (t_message *msg)
int handle_thread (t_cl_thread *thr, t_cf_hash *head, int mode)
int handle_thread_list_posting (t_message *p, t_cf_hash *head, u_int64_t tid, int mode)
t_messagedelete_subtree (t_message *msg)
void generate_tpl_name (u_char buff[], int len, t_name_value *v)
void * get_shm_ptr (void)
void * reget_shm_ptr ()
void cf_set_variable (t_cf_template *tpl, t_name_value *cs, u_char *vname, const u_char *val, size_t len, int html)
void cleanup_struct (t_cl_thread *thr)
int handle_posting_filters (t_cf_hash *head, t_cl_thread *thr, t_cf_template *tpl)
int cf_get_message_through_sock (int sock, rline_t *tsd, t_cl_thread *thr, const u_char *tplname, u_int64_t tid, u_int64_t mid, int del)
int cf_get_next_thread_through_sock (int sock, rline_t *tsd, t_cl_thread *thr, const u_char *tplname)
int cf_get_message_through_shm (void *shm_ptr, t_cl_thread *thr, const u_char *tplname, u_int64_t tid, u_int64_t mid, int del)
void * cf_get_next_thread_through_shm (void *shm_ptr, t_cl_thread *thr, const u_char *tplname)
int cf_register_mod_api_ent (const u_char *mod_name, const u_char *unique_identifier, t_mod_api func)
int cf_unregister_mod_api_ent (const u_char *unid)
t_mod_api cf_get_mod_api_ent (const u_char *unid)

Variables

t_cf_hashGlobalValues
t_cf_hashAPIEntries
u_char ErrorString []


Detailed Description

client library functions

Author:
Christian Kruse, <cjk@wwwtech.de>
This file contains some functions and datatypes used in client modus, e.g. delete_subtree() or generate_tpl_name() or something like that

Definition in file clientlib.h.


Typedef Documentation

typedef struct s_cl_thread t_cl_thread
 

This struct is used to store and handle whole threads

typedef int(* t_filter_begin)(t_cf_hash *,t_configuration *,t_configuration *)
 

This function prototype pointer is used for the authorization and the initialization plugins

Parameters:
hash The CGI object hash
dc The default configuration object
vc The fo_view configuration object
Returns:
FLT_OK, FLT_DECLINE or FLT_EXIT. FLT_EXIT terminates the program, FLT_OK terminates the plugin handling in this state.

Definition at line 90 of file clientlib.h.

typedef int(* t_filter_connect)(t_cf_hash *,t_configuration *,t_configuration *,int)
 

This function prototype pointer is used for the connection plugins

Parameters:
hash The CGI object hash
dc The default configuration object
vc The fo_view configuration object
sock The connection handle or, if defined CF_SHARED_MEM, the pointer to the shared memory segment
Returns:
FLT_OK, FLT_DECLINE or FLT_EXIT. FLT_EXIT terminates the program

Definition at line 100 of file clientlib.h.

typedef int(* t_filter_init_view)(t_cf_hash *,t_configuration *,t_configuration *,t_cf_template *,t_cf_template *)
 

This function prototype pointer is used for the VIEW_INIT_HANDLER plugins. It will be called before the thread list is generated.

Parameters:
hash The CGI object hash
dc The default configuration object
vc The fo_view configuration object
tpl_top The template object for the top of the page
tpl_end The template object for the end of the page
Returns:
FLT_OK, FLT_DECLINE or FLT_EXIT, it doesn't matter in this case

Definition at line 148 of file clientlib.h.

typedef int(* t_filter_list)(t_cf_hash *,t_configuration *,t_configuration *,t_cl_thread *,int)
 

This function prototype pointer is used for the VIEW_HANDLER plugins. It will be called once for each thread.

Parameters:
hash The CGI object hash
dc The default configuration object
vc The fo_view configuration object
sock The connection handle or, if defined CF_SHARED_MEM, the pointer to the shared memory segment
Returns:
FLT_OK, FLT_DECLINE or FLT_EXIT. FLT_EXIT means, do not print this thread

Definition at line 111 of file clientlib.h.

typedef int(* t_filter_list_posting)(t_cf_hash *,t_configuration *,t_configuration *,t_message *,unsigned long long,int)
 

This function prototype pointer is used for the VIEW_LIST_HANDLER plugins. It will be called once for each message.

Parameters:
hash The CGI object hash
dc The default configuration object
vc The fo_view configuration object
msg The message object
tid The thread id
sock The connection handle or, if defined CF_SHARED_MEM, the pointer to the shared memory segment
Returns:
FLT_OK, FLT_DECLINE or FLT_EXIT. FLT_EXIT means, do not print this message

Definition at line 124 of file clientlib.h.

typedef int(* t_filter_posting)(t_cf_hash *,t_configuration *,t_configuration *,t_cl_thread *,t_cf_template *)
 

This function prototype pointer is used for the POSTING_HANDLER plugins. It will be called when a user requests a message of a thread.

Parameters:
hash The CGI object hash
dc The default configuration object
vc The fo_view configuration object
thread The thread object
template The template object
Returns:
FLT_OK, FLT_DECLINE or FLT_EXIT. FLT_EXIT means, terminate the plugin handling

Definition at line 136 of file clientlib.h.

typedef struct s_message t_message
 

This struct is used to store and handle a posting

typedef void*(* t_mod_api)(void *)
 

module api function.

Parameters:
param Expects a void pointer
Returns:
Returns a void pointer

Definition at line 27 of file clientlib.h.

typedef struct s_mod_api_ent t_mod_api_ent
 

Struct for Module communication API entry

typedef int(* t_new_post_filter)(t_cf_hash *,t_configuration *,t_configuration *,t_message *,int,int)
 

This function prototype pointer is used for the NEW_POST_HANDLER plugins. It will be called before the posting will be send to the server

Parameters:
hash The CGI object hash
dc The default configuration
pc The fo_post configuration
msg The new message
sock The server socket or the shm segment pointer
mode 0 on new thread, 1 on new answer
Returns:
FLT_OK, FLT_DECLINE or FLT_EXIT. FLT_DECLINE and FLT_OK are functionless, FLT_EXIT means: do nothing else, just cleanup and exit

Definition at line 161 of file clientlib.h.


Function Documentation

int cf_get_message_through_shm void *  shm_ptr,
t_cl_thread thr,
const u_char *  tplname,
u_int64_t  tid,
u_int64_t  mid,
int  del
 

This function gets a message from the server

Parameters:
shm_ptr The pointer to the shared memory segment
thr The thread structure
tplname The template name
tid The thread id
mid The message id
del Boolean. If CF_KILL_DELETED, deleted messages will be killed. If CF_KEEP_DELETED, deleted messages will not be killed
Returns:
0 on success, -1 on failure

Definition at line 1002 of file clientlib.c.

int cf_get_message_through_sock int  sock,
rline_t tsd,
t_cl_thread thr,
const u_char *  tplname,
u_int64_t  tid,
u_int64_t  mid,
int  del
 

This function gets a message from the server

Parameters:
sock The socket
tsd The readline buffer
thr The thread structure
tplname The template name
tid The thread id
mid The message id
del Boolean. If CF_KILL_DELETED, deleted messages will be killed. If CF_KEEP_DELETED, deleted messages will not be killed
Returns:
0 on success, -1 on failure

Definition at line 947 of file clientlib.c.

t_mod_api cf_get_mod_api_ent const u_char *  unid  ) 
 

This function returns a pointer to an API hook function

Parameters:
unid The unique id of the API hook
Returns:
The pointer on success, NULL on failure

Definition at line 1158 of file clientlib.c.

void* cf_get_next_thread_through_shm void *  shm_ptr,
t_cl_thread thr,
const u_char *  tplname
 

This function reads the next thread from the shared memory segment

Parameters:
shm_ptr The pointer to the shared memory segment
thr The thread structure
tplname The path to the template
Returns:
NULL on failure, the modified pointer on success

Definition at line 809 of file clientlib.c.

int cf_get_next_thread_through_sock int  sock,
rline_t tsd,
t_cl_thread thr,
const u_char *  tplname
 

This function reads the next thread from a socket

Parameters:
sock The socket
tsd The readline buffer
thr The thread structure
tplname The template name

Definition at line 706 of file clientlib.c.

int cf_register_mod_api_ent const u_char *  mod_name,
const u_char *  unique_identifier,
t_mod_api  func
 

This function registeres a module API entry

Parameters:
mod_name The name of the module which registeres
unique_identifier A unique string to identify this API hook
func A pointer to the API function
Returns:
Returns 0 on success and -1 on failure (e.g. doubly entries)

Definition at line 1117 of file clientlib.c.

void cf_set_variable t_cf_template tpl,
t_name_value cs,
u_char *  vname,
const u_char *  val,
size_t  len,
int  html
 

This function sets a variable in a template. The value will be converted to the output charset

Parameters:
tpl The template object
cs The charset configuration entry
vname The variable name
val The template variable value
len The length of the value
html 1 if output should be html escaped, 0 if not

Definition at line 236 of file clientlib.c.

int cf_unregister_mod_api_ent const u_char *  unid  ) 
 

This function deletes a module API hook

Parameters:
unid The unique identifier of the API hook
Returns:
0 on success, -1 on failure (e.g. not found)

Definition at line 1144 of file clientlib.c.

void cleanup_struct t_cl_thread thr  ) 
 

This function frees the complete thread structure

Parameters:
thr The thread structure

Definition at line 492 of file clientlib.c.

t_message* delete_subtree t_message msg  ) 
 

This function deletes a posting subtree

Parameters:
msg The message structure
Returns:
Returns the next posting which has not been deleted

Definition at line 473 of file clientlib.c.

void generate_tpl_name u_char  buff[],
int  len,
t_name_value v
 

This function generates a template name

Parameters:
buff The buffer in which the name should be saved
len The maximal length of the buffer
v The configuration entry of the template

Definition at line 223 of file clientlib.c.

u_char* get_error_message const u_char *  msg,
int  rd,
size_t *  len,
... 
 

This function returns an error message

Parameters:
msg The error string
rd The length of the error string
len A reference to a size_t-variable. This variable will be set to the length of the error message.
Returns:
NULL on error or a u_char pointer to the error message on success.
Attention:
You have to free() the returned u_char pointer!

Definition at line 389 of file clientlib.c.

u_char* get_link u_int64_t  tid,
u_int64_t  mid
 

This function generates a link to a thread

Parameters:
tid The thread id
mid The message id
Returns:
Returns NULL on failure or the link string on success

Definition at line 540 of file clientlib.c.

void* get_shm_ptr void   ) 
 

This function gets a pointer to the shared memory segment

Returns:
Returns NULL if segment does not exist, otherwise it returns the pointer

Definition at line 101 of file clientlib.c.

u_char* get_time t_configuration cfg,
const u_char *  symbol,
int *  len,
time_t *  date
 

This function creates a date string

Parameters:
cfg The configuration structure
symbol The configuration symbol. E.g. "DateFormatThreadView"
len In this variable the length of the string will be stored
date The date
Returns:
Returns NULL on failure or the string on success

Definition at line 678 of file clientlib.c.

u_char* get_uconf_name const u_char *  uname  ) 
 

This function tries to find the path to the user configuration file

Parameters:
uname The username
Returns:
NULL If the configuration file of the user could not be found, the full path if it could be found

Definition at line 145 of file clientlib.c.

int handle_posting_filters t_cf_hash head,
t_cl_thread thr,
t_cf_template tpl
 

This function runs POSTING_HANDLER plugins

Parameters:
head The CGI hash
thr The thread structure
tpl The template structure

Definition at line 651 of file clientlib.c.

int handle_thread t_cl_thread thr,
t_cf_hash head,
int  mode
 

This function runs VIEW_HANDLER plugins on a completely read thread.

Parameters:
thr Thread structure
head The CGI hash
mode 0 if in thread list, 1 if in thread view
Returns:
Returns the return value of the last plugin

Definition at line 632 of file clientlib.c.

int handle_thread_list_posting t_message p,
t_cf_hash head,
u_int64_t  tid,
int  mode
 

This function runs VIEW_LIST_HANDLER plugins

Parameters:
p The posting structure
head The CGI hash
tid The ID of the thread
mode 0 if in thread list, 1 if in thread view
Returns:
Returns the return value of the last plugin

Definition at line 606 of file clientlib.c.

int has_answers t_message msg  ) 
 

This function checks if a message has answers

Parameters:
msg The message structure
Returns:

Definition at line 563 of file clientlib.c.

void* reget_shm_ptr  ) 
 

This function re-gets the pointer to the shared memory segment

Returns:
Returns NULL if segment does not exist, otherwise it returns the pointer

Definition at line 75 of file clientlib.c.

int set_us_up_the_socket void   ) 
 

This function creates a socket handle an connects to the server

Returns:
-1 on error, the socket on success

Definition at line 186 of file clientlib.c.

void str_error_message const u_char *  msg,
FILE *  out,
int  rd,
... 
 

This function spits out an error message by a error string

Parameters:
msg The error string
out A file handle to write to. If NULL, stdout will be used
rd The length of the error string

Definition at line 278 of file clientlib.c.


Variable Documentation

t_cf_hash* APIEntries
 

In this hash the module API entries will be saved

Definition at line 172 of file clientlib.h.

u_char ErrorString[]
 

contains error string in failure case

Definition at line 177 of file clientlib.h.

t_cf_hash* GlobalValues
 

In this hash global values can be saved, e.g. the username of logged in users

Definition at line 167 of file clientlib.h.


Generated on Sun Apr 25 16:37:39 2004 for Classic Forum by doxygen 1.3.5