Main Page | Data Structures | Directories | File List | Data Fields

src/httpd_thread.c

00001 /********************************************************************\
00002  * This program is free software; you can redistribute it and/or    *
00003  * modify it under the terms of the GNU General Public License as   *
00004  * published by the Free Software Foundation; either version 2 of   *
00005  * the License, or (at your option) any later version.              *
00006  *                                                                  *
00007  * This program is distributed in the hope that it will be useful,  *
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00010  * GNU General Public License for more details.                     *
00011  *                                                                  *
00012  * You should have received a copy of the GNU General Public License*
00013  * along with this program; if not, contact:                        *
00014  *                                                                  *
00015  * Free Software Foundation           Voice:  +1-617-542-5942       *
00016  * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
00017  * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
00018  *                                                                  *
00019 \********************************************************************/
00020 
00021 /* $Header: /cvsroot/wifidog/wifidog/src/httpd_thread.c,v 1.1 2004/11/17 23:54:25 alexcv Exp $ */
00022 
00028 #define _GNU_SOURCE
00029 
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032 #include <pthread.h>
00033 #include <string.h>
00034 #include <unistd.h>
00035 #include <syslog.h>
00036 #include <signal.h>
00037 #include <errno.h>
00038 
00039 #include "httpd.h"
00040 
00041 #include "../config.h"
00042 #include "common.h"
00043 #include "debug.h"
00044 #include "httpd_thread.h"
00045 
00049 void
00050 thread_httpd(void *args)
00051 {
00052         void    **params;
00053         httpd   *webserver;
00054         request *r;
00055         
00056         params = (void **)args;
00057         webserver = *params;
00058         r = *(params + 1);
00059         free(params); /* XXX We must release this ourselves. */
00060         
00061         if (httpdReadRequest(webserver, r) == 0) {
00062                 /*
00063                  * We read the request fine
00064                  */
00065                 debug(LOG_DEBUG, "Processing request from %s", r->clientAddr);
00066                 debug(LOG_DEBUG, "Calling httpdProcessRequest() for %s", r->clientAddr);
00067                 httpdProcessRequest(webserver, r);
00068                 debug(LOG_DEBUG, "Returned from httpdProcessRequest() for %s", r->clientAddr);
00069         }
00070         else {
00071                 debug(LOG_DEBUG, "No valid request received from %s", r->clientAddr);
00072         }
00073         debug(LOG_DEBUG, "Closing connection with %s", r->clientAddr);
00074         httpdEndRequest(r);
00075 }

Generated on Sun Apr 3 20:04:46 2005 for WifiDog by  doxygen 1.4.1