wifidog认证之自带HTTP 服务器lighttpd分析

wifidog的源码里除了会编译出wifidog 的主程序,还会有一个库libhttpd.so,这个库是wifidog自带的http server,就是在wifidog 的http 监听线程中会用到这个库,而且在wifidog的几个回调函数中也会用到:

 if ((webserver = httpdCreate(config->gw_address, config->gw_port)) == NULL) {
                debug(LOG_ERR, "Could not create web server: %s", strerror(errno));
                exit(1);
        }

        debug(LOG_DEBUG, "Assigning callbacks to web server");
        httpdAddCContent(webserver, "/", "wifidog", 0, NULL, http_callback_wifidog);
        httpdAddCContent(webserver, "/wifidog", "", 0, NULL, http_callback_wifidog);
        httpdAddCContent(webserver, "/wifidog", "about", 0, NULL, http_callback_about);
        httpdAddCContent(webserver, "/wifidog", "status", 0, NULL, http_callback_status);
        httpdAddCContent(webserver, "/wifidog", "auth", 0, NULL, http_callback_auth);
        /*get free client by this way*/
        httpdAddCContent(webserver, "/wifidog", "getfree", 0, NULL, http_get_free);

        httpdAddC404Content(webserver, http_callback_404);

以及:

r = httpdGetConnection(webserver, NULL);
接受客户端http 请求

result = pthread_create(&tid, NULL, (void *)thread_httpd, (void *)params);
把创建的httpd 结构传给http 线程

这里用的是 1.3 版本的库。

本文章由 http://www.wifidog.pro/2015/04/09/wifidog-lighttpd.html 整理编辑,转载请注明出处

标签: wifidog认证, wifidog源码, wifidog