Server


Data Structures

struct  w3Server
struct  w3ServerConnection

Functions

char * w3HTMLGenerateError (char *header, char *info, int pagecode)
w3ServerConnection * w3ServerAccept (w3Server *server)
boolean w3ServerInit (w3Server *server)
boolean w3ServerClose (w3Server *server)
boolean w3ServerDisconnect (w3ServerConnection *con)
char * w3ServerGetToken (char *str, int *idx)
char * w3ServerGetPath (char *str)
boolean w3ServerSendFile (char *path, w3ServerConnection *con)
boolean w3ServerSendError (int errorcode, w3ServerConnection *con)
boolean w3ServerServeClient (w3Server *server, w3ServerConnection *con)
boolean w3StartServer (int port)
void w3ServerMessage (const char *msg)

Function Documentation

char* w3HTMLGenerateError (  char *  header,
char *  info,
int  pagecode
) 
 

Generates an appropriate error page. The returned pointer points to a newly created string that should be free()d after use.

w3ServerConnection* w3ServerAccept (  w3Server *  server  ) 
 

Accepts a connection for server server.

boolean w3ServerClose (  w3Server *  server  ) 
 

Closes the server.

boolean w3ServerDisconnect (  w3ServerConnection *  con  ) 
 

Closes a connection to the server. con is deleted.

char* w3ServerGetPath (  char *  str  ) 
 

Parses a "GET ..." request and returns a newly allocated char* containing the full path to the requested file. Replace this by a more general request parser.

char* w3ServerGetToken (  char *  str,
int *  idx
) 
 

Gets the first token out of str and returns it in a newly allocated char*. idx is an index to the next character in the string str.

boolean w3ServerInit (  w3Server *  server  ) 
 

Initialization for the server.

void w3ServerMessage (  const char *  msg  ) 
 

Prints message msg to local console.

boolean w3ServerSendError (  int  errorcode,
w3ServerConnection *  con
) 
 

Takes the appropriate action to notify client at connection con of error errorcode. For errorcodes see file w3server.c (for now).

boolean w3ServerSendFile (  char *  path,
w3ServerConnection *  con
) 
 

Sends file pointed to by path to connection con. If the file is in the HTDOC_BIN_BASE directory, it is executed and the standard output stored in a temporary file and sent to the client. The temporary files are stored in HTDOC_BIN_TEMPLATE and should be removed from time to time, e.g. by a cron job (not done automatically).

boolean w3ServerServeClient (  w3Server *  server,
w3ServerConnection *  con
) 
 

After a connection has been established, serve the client. This function does not disconnect.

boolean w3StartServer (  int  port  ) 
 

Starts a server on port port.


Generated on Thu Jul 6 15:37:32 2006 for w3server by  doxygen 1.4.6