Port of LwIP performed by Ralf in 2010. Not recommended for use with recent mbed libraries, but good demos of raw LwIP possible

Dependents:   LwIP_raw_API_serverExample tiny-dtls

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HTTPLog.h Source File

HTTPLog.h

00001 #ifndef HTTPLOG_H
00002 #define HTTPLOG_H
00003 
00004 #include "HTTPServer.h"
00005 
00006 class HTTPLog : public HTTPHandler {
00007   public:
00008     HTTPLog(const char *prefix) : HTTPHandler(prefix) {}
00009     HTTPLog(HTTPServer *server, const char *prefix) : HTTPHandler(prefix) { server->addHandler(this); }
00010 
00011   private:
00012     virtual HTTPHandle action(HTTPConnection *con) const {
00013       struct ip_addr ip = con->pcb()->remote_ip;
00014       printf("%hhu.%hhu.%hhu.%hhu %s %s", (ip.addr)&0xFF, (ip.addr>>8)&0xFF, (ip.addr>>16)&0xFF, (ip.addr>>24)&0xFF, (con->getType() == POST? "POST" : "GET"), con->getURL());
00015       return HTTP_AddFields;
00016     }
00017 };
00018 
00019 #endif