Compounds | |||
![]() | ![]() | struct | w3Server |
![]() | ![]() | struct | w3ServerConnection |
Functions | |||
![]() | ![]() | 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) |
w3ServerConnection * w3ServerAccept (w3Server * server) |
Accepts a connection for server server.
boolean w3ServerInit (w3Server * server) |
Initialization for the server.
boolean w3ServerClose (w3Server * server) |
Closes the server.
boolean w3ServerDisconnect (w3ServerConnection * con) |
Closes a connection to the server. con is deleted.
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.
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.
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 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 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.
void w3ServerMessage (const char * msg) |
Prints message msg to local console.