This library is deprecated.

Dependents:   HTTPServerExample HTTPServerHelloWorld PoorMansScope Lab3 ... more

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Thu Aug 05 15:12:27 2010 +0000
Parent:
5:d45c35d26466
Commit message:

Changed in this revision

LPC1768/HTTPServer.ar Show annotated file Show diff for this revision Revisions of this file
LPC1768/dbg/dbg.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/services/http/server/HTTPRequestDispatcher.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/services/http/server/HTTPRequestHandler.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/services/http/server/HTTPServer.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/services/http/util/url.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/HTTPServer.ar Show annotated file Show diff for this revision Revisions of this file
LPC2368/dbg/dbg.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPRequestDispatcher.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPRequestHandler.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPServer.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/services/http/util/url.h Show annotated file Show diff for this revision Revisions of this file
diff -r d45c35d26466 -r d753966e4d97 LPC1768/HTTPServer.ar
Binary file LPC1768/HTTPServer.ar has changed
diff -r d45c35d26466 -r d753966e4d97 LPC1768/dbg/dbg.h
--- a/LPC1768/dbg/dbg.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC1768/dbg/dbg.h	Thu Aug 05 15:12:27 2010 +0000
@@ -21,6 +21,10 @@
 THE SOFTWARE.
 */
 
+/** \file
+Debugging helpers header file
+*/
+
 //#ifdef DBG_H
 //#define DBG_H
 
@@ -28,6 +32,11 @@
 #define __DEBUG
 #endif
 
+/*!
+  \def __DEBUG
+  To define to enable debugging in one file
+*/
+
 #ifdef __DEBUG
 
 #ifndef __DEBUGSTREAM
@@ -47,8 +56,15 @@
 #undef DBG
 #undef DBG_END
 #undef BREAK
+
+///Debug output (if enabled), same syntax as printf, with heading info
 #define DBG(...) do{ DebugStream::debug("[%s:%s@%d] ", __FILE__, __FUNCTION__, __LINE__); DebugStream::debug(__VA_ARGS__); } while(0);
+
+///Debug output (if enabled), same syntax as printf, no heading info
+#define DBGL(...) do{ DebugStream::debug(__VA_ARGS__); } while(0);
 #define DBG_END DebugStream::release
+
+///Break point usin serial debug interface (if debug enbaled)
 #define BREAK() DebugStream::breakPoint(__FILE__, __LINE__)
 #endif
 
diff -r d45c35d26466 -r d753966e4d97 LPC1768/services/http/server/HTTPRequestDispatcher.h
--- a/LPC1768/services/http/server/HTTPRequestDispatcher.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC1768/services/http/server/HTTPRequestDispatcher.h	Thu Aug 05 15:12:27 2010 +0000
@@ -28,6 +28,7 @@
 
 #include "api/TCPSocket.h"
 #include "HTTPServer.h"
+#include "core/netservice.h"
 
 #include "mbed.h"
 
diff -r d45c35d26466 -r d753966e4d97 LPC1768/services/http/server/HTTPRequestHandler.h
--- a/LPC1768/services/http/server/HTTPRequestHandler.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC1768/services/http/server/HTTPRequestHandler.h	Thu Aug 05 15:12:27 2010 +0000
@@ -21,6 +21,10 @@
 THE SOFTWARE.
 */
 
+/**
+HTTP Request Handler header file.
+*/
+
 #ifndef HTTP_REQUEST_HANDLER_H
 #define HTTP_REQUEST_HANDLER_H
 
@@ -28,6 +32,7 @@
 //#include "HTTPServer.h"
 
 #include "mbed.h"
+#include "core/netservice.h"
 
 #include <string>
 using std::string;
@@ -35,9 +40,11 @@
 #include <map>
 using std::map;
 
+///HTTP Server's generic request handler
 class HTTPRequestHandler : public NetService
 {
 public:
+  ///Instantiated by the HTTP Server
   HTTPRequestHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
   virtual ~HTTPRequestHandler();
 
diff -r d45c35d26466 -r d753966e4d97 LPC1768/services/http/server/HTTPServer.h
--- a/LPC1768/services/http/server/HTTPServer.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC1768/services/http/server/HTTPServer.h	Thu Aug 05 15:12:27 2010 +0000
@@ -21,13 +21,17 @@
 THE SOFTWARE.
 */
 
+/** \file
+HTTP Server header file
+*/
+
 #ifndef HTTP_SERVER_H
 #define HTTP_SERVER_H
 
 class HTTPRequestHandler;
 class HTTPRequestDispatcher;
 
-#include "if/net/net.h"
+#include "core/net.h"
 #include "HTTPRequestHandler.h"
 #include "HTTPRequestDispatcher.h"
 
@@ -37,9 +41,17 @@
 #include <map>
 using std::map;
 
+///A simple HTTP server implementation
+/**
+The HTTPServer is composed of:
+- The actual server (HTTPServer)
+- A request dispatcher, instanciated on each request (HTTPRequestDispatcher)
+- Request handlers instanciated by the dispatcher(deriving from HTTPRequestHandler) 
+*/
 class HTTPServer
 {
 public:
+  ///Instantiates the HTTP Server
   HTTPServer();
   ~HTTPServer();
   
@@ -57,10 +69,21 @@
     }
   };
 
+  ///Adds a handler
+  /**
+  Appends a handler to the handlers list
+  @param T : class which will be instanciated to serve these requests
+  @param path : requests starting with this path will be served using this handler
+  */
   template<typename T>
   void addHandler(const char* path) //Template decl in header
   { m_lpHandlers[path] = &T::inst; }
   
+  ///Starts listening
+  /**
+  Binds server to a specific port and starts listening
+  @param port : port on which to listen for incoming connections
+  */
   void bind(int port = 80);
   
 private:
diff -r d45c35d26466 -r d753966e4d97 LPC1768/services/http/util/url.h
--- a/LPC1768/services/http/util/url.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC1768/services/http/util/url.h	Thu Aug 05 15:12:27 2010 +0000
@@ -24,7 +24,7 @@
 #ifndef URL_H
 #define URL_H
 
-#include "if/net/ipaddr.h"
+#include "core/ipaddr.h"
 
 #include <string>
 using std::string;
diff -r d45c35d26466 -r d753966e4d97 LPC2368/HTTPServer.ar
Binary file LPC2368/HTTPServer.ar has changed
diff -r d45c35d26466 -r d753966e4d97 LPC2368/dbg/dbg.h
--- a/LPC2368/dbg/dbg.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC2368/dbg/dbg.h	Thu Aug 05 15:12:27 2010 +0000
@@ -21,6 +21,10 @@
 THE SOFTWARE.
 */
 
+/** \file
+Debugging helpers header file
+*/
+
 //#ifdef DBG_H
 //#define DBG_H
 
@@ -28,6 +32,11 @@
 #define __DEBUG
 #endif
 
+/*!
+  \def __DEBUG
+  To define to enable debugging in one file
+*/
+
 #ifdef __DEBUG
 
 #ifndef __DEBUGSTREAM
@@ -47,8 +56,15 @@
 #undef DBG
 #undef DBG_END
 #undef BREAK
+
+///Debug output (if enabled), same syntax as printf, with heading info
 #define DBG(...) do{ DebugStream::debug("[%s:%s@%d] ", __FILE__, __FUNCTION__, __LINE__); DebugStream::debug(__VA_ARGS__); } while(0);
+
+///Debug output (if enabled), same syntax as printf, no heading info
+#define DBGL(...) do{ DebugStream::debug(__VA_ARGS__); } while(0);
 #define DBG_END DebugStream::release
+
+///Break point usin serial debug interface (if debug enbaled)
 #define BREAK() DebugStream::breakPoint(__FILE__, __LINE__)
 #endif
 
diff -r d45c35d26466 -r d753966e4d97 LPC2368/services/http/server/HTTPRequestDispatcher.h
--- a/LPC2368/services/http/server/HTTPRequestDispatcher.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC2368/services/http/server/HTTPRequestDispatcher.h	Thu Aug 05 15:12:27 2010 +0000
@@ -28,6 +28,7 @@
 
 #include "api/TCPSocket.h"
 #include "HTTPServer.h"
+#include "core/netservice.h"
 
 #include "mbed.h"
 
diff -r d45c35d26466 -r d753966e4d97 LPC2368/services/http/server/HTTPRequestHandler.h
--- a/LPC2368/services/http/server/HTTPRequestHandler.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC2368/services/http/server/HTTPRequestHandler.h	Thu Aug 05 15:12:27 2010 +0000
@@ -21,6 +21,10 @@
 THE SOFTWARE.
 */
 
+/**
+HTTP Request Handler header file.
+*/
+
 #ifndef HTTP_REQUEST_HANDLER_H
 #define HTTP_REQUEST_HANDLER_H
 
@@ -28,6 +32,7 @@
 //#include "HTTPServer.h"
 
 #include "mbed.h"
+#include "core/netservice.h"
 
 #include <string>
 using std::string;
@@ -35,9 +40,11 @@
 #include <map>
 using std::map;
 
+///HTTP Server's generic request handler
 class HTTPRequestHandler : public NetService
 {
 public:
+  ///Instantiated by the HTTP Server
   HTTPRequestHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
   virtual ~HTTPRequestHandler();
 
diff -r d45c35d26466 -r d753966e4d97 LPC2368/services/http/server/HTTPServer.h
--- a/LPC2368/services/http/server/HTTPServer.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC2368/services/http/server/HTTPServer.h	Thu Aug 05 15:12:27 2010 +0000
@@ -21,13 +21,17 @@
 THE SOFTWARE.
 */
 
+/** \file
+HTTP Server header file
+*/
+
 #ifndef HTTP_SERVER_H
 #define HTTP_SERVER_H
 
 class HTTPRequestHandler;
 class HTTPRequestDispatcher;
 
-#include "if/net/net.h"
+#include "core/net.h"
 #include "HTTPRequestHandler.h"
 #include "HTTPRequestDispatcher.h"
 
@@ -37,9 +41,17 @@
 #include <map>
 using std::map;
 
+///A simple HTTP server implementation
+/**
+The HTTPServer is composed of:
+- The actual server (HTTPServer)
+- A request dispatcher, instanciated on each request (HTTPRequestDispatcher)
+- Request handlers instanciated by the dispatcher(deriving from HTTPRequestHandler) 
+*/
 class HTTPServer
 {
 public:
+  ///Instantiates the HTTP Server
   HTTPServer();
   ~HTTPServer();
   
@@ -57,10 +69,21 @@
     }
   };
 
+  ///Adds a handler
+  /**
+  Appends a handler to the handlers list
+  @param T : class which will be instanciated to serve these requests
+  @param path : requests starting with this path will be served using this handler
+  */
   template<typename T>
   void addHandler(const char* path) //Template decl in header
   { m_lpHandlers[path] = &T::inst; }
   
+  ///Starts listening
+  /**
+  Binds server to a specific port and starts listening
+  @param port : port on which to listen for incoming connections
+  */
   void bind(int port = 80);
   
 private:
diff -r d45c35d26466 -r d753966e4d97 LPC2368/services/http/util/url.h
--- a/LPC2368/services/http/util/url.h	Fri Jul 09 14:45:18 2010 +0000
+++ b/LPC2368/services/http/util/url.h	Thu Aug 05 15:12:27 2010 +0000
@@ -24,7 +24,7 @@
 #ifndef URL_H
 #define URL_H
 
-#include "if/net/ipaddr.h"
+#include "core/ipaddr.h"
 
 #include <string>
 using std::string;