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

serverlib.h File Reference

Server library functions and datatypes. More...

Go to the source code of this file.

Functions

int cf_set_us_up_the_socket (struct sockaddr_un *addr)
void * cf_worker (void *arg)
void cf_handle_request (int sockfd)
void cf_send_thread_list (int sockfd, int del)
void * cf_generate_cache (void *arg)
void cf_generate_list (t_string *str, int del)
void cf_send_posting (int sock, u_int64_t tid, u_int64_t mid, int invisible)
t_threadcf_get_thread (u_int64_t tid)
t_postingcf_get_posting (t_thread *t, u_int64_t mid)
void cf_generate_shared_memory ()
int cf_read_posting (t_posting *p, int sock, rline_t *tsd)
void cf_log (int mode, const u_char *file, int line, const u_char *format,...)
int cf_push_client (int connfd, t_worker handler)
int cf_push_server (int sockfd, struct sockaddr *addr, int size, t_worker handler)
int cf_register_protocol_handler (u_char *handler_hook, t_server_protocol_handler handler)
void cf_register_thread (t_thread *t)
void cf_unregister_thread (t_thread *t)


Detailed Description

Server library functions and datatypes.

Author:
Christian Kruse, <cjk@wwwtech.de>
This file contains the functions used by the server program and the server plugins, so it contains the server library.

Definition in file serverlib.h.


Function Documentation

void* cf_generate_cache void *  arg  ) 
 

This function generates the cache for the thread list

Parameters:
arg Dummy argument
Returns:
Returns always NULL

Definition at line 1265 of file serverlib.c.

void cf_generate_list t_string str,
int  del
 

This function generates a stringified thread list for caching

Parameters:
str A t_string reference. Destination for the stringified list
del If true, deleted threads will be inserted, too. If false, they won't.

Definition at line 1312 of file serverlib.c.

void cf_generate_shared_memory  ) 
 

This function generates the refreshed shared memory segment

Definition at line 1085 of file serverlib.c.

t_posting* cf_get_posting t_thread t,
u_int64_t  mid
 

This function returns a posting from a thread

Parameters:
t Thread structure
mid The message id
Returns:
The posting if it could be found, otherwise NULL

Definition at line 1015 of file serverlib.c.

t_thread* cf_get_thread u_int64_t  tid  ) 
 

This function gets a thread from the thread list

Parameters:
tid The thread list
Returns:
If the thread could be found, the thread, otherwise NULL.

Definition at line 1036 of file serverlib.c.

void cf_handle_request int  sockfd  ) 
 

Handler function to handle client sockets. This function calls the specified worker function

Parameters:
sockfd The socket file descriptor of the connection

Definition at line 567 of file serverlib.c.

void cf_log int  mode,
const u_char *  file,
int  line,
const u_char *  format,
... 
 

This function makes a log entry into the log file

Parameters:
mode The mode to log (LOG_ERR, LOG_DBG or LOG_STD)
file The file name (will be shortened to the last piece of the file name, e.g. /home/ck.c to ck.c)
format The format string
line The line number

Definition at line 285 of file serverlib.c.

int cf_push_client int  connfd,
t_worker  handler
 

This function adds a client to the client queque.

Parameters:
connfd The connection file descriptor
handler The handler function
Returns:
-1 on failure, 0 on success

Definition at line 196 of file serverlib.c.

int cf_push_server int  sockfd,
struct sockaddr *  addr,
int  size,
t_worker  handler
 

This function adds a server socket to the server sockets array

Parameters:
sockfd The socket file descriptor
addr The address structure
size The size of the structure
handler Pointer to the handler function
Returns:
Returns 0 on success, -1 on failure

Definition at line 144 of file serverlib.c.

int cf_read_posting t_posting p,
int  sock,
rline_t tsd
 

This function reads a posting in CFTP from the socket into the referenced posting structure.

Parameters:
p The referenced posting structure
sock The client socket
tsd The caching structure
Returns:
0 on success, -1 on failure

Definition at line 816 of file serverlib.c.

int cf_register_protocol_handler u_char *  handler_hook,
t_server_protocol_handler  handler
 

This function registeres a CFTP handler

Parameters:
handler_hook The token which identifies the handler
handler The handler function
Returns:
0 on success, -1 on failure

Definition at line 79 of file serverlib.c.

void cf_register_thread t_thread t  ) 
 

This function registeres a thread in the global threads hash

Parameters:
t The thread structure

Definition at line 101 of file serverlib.c.

void cf_send_posting int  sock,
u_int64_t  tid,
u_int64_t  mid,
int  invisible
 

This function sends a posting to the client

Parameters:
sock The socket file descriptor
tid The thread id
mid The message id
invisible If true, invisible messages will be sent, to. If false, the won't.

Definition at line 903 of file serverlib.c.

void cf_send_thread_list int  sockfd,
int  del
 

This function sends a "live" thread list

Parameters:
sockfd The socket file descriptor
del True-false-switch. If false value, deleted threads are not submitted. If true value, deleted threads will be submitted

Definition at line 1400 of file serverlib.c.

int cf_set_us_up_the_socket struct sockaddr_un *  addr  ) 
 

Function to create socket and bind it to the specified port

Parameters:
addr A unix domain socket structure
Returns:
The socket on success or -1 on failure

Definition at line 376 of file serverlib.c.

void cf_unregister_thread t_thread t  ) 
 

This function unregisteres a thread int he global threads hash

Parameters:
t The thread structure

Definition at line 118 of file serverlib.c.

void* cf_worker void *  arg  ) 
 

Worker function for the CFTP

Parameters:
arg The socket as an integer variable castet to (void *)
Returns:
Returns NULL

Definition at line 426 of file serverlib.c.


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