changeset 24:ce4c3431392f

merge
author Zoltan K
date Sun, 21 Mar 2010 14:19:32 +0100
parents 812d6c5ac125 (current diff) 8619377761fd (diff)
children 27de48562b2c
files
diffstat 2 files changed, 44 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/include/handler/INetworkHandler.hpp	Sun Mar 21 14:19:23 2010 +0100
+++ b/src/include/handler/INetworkHandler.hpp	Sun Mar 21 14:19:32 2010 +0100
@@ -14,14 +14,53 @@
 
 namespace       handler
 {
-
+/**
+ * @brief this class represent an handler which redefine some basic function
+ * like accept(2), write(2), read(2)
+ *
+ * It allows protocol implementation like ssl
+ */
 class   INetworkHandler
 {
-public:
+    public:
+
+        /**
+         * @brief this structure represent functions pointers that can be overloaded
+         * if an handler does not want to overload one of this function it should set
+         * the pointer to NULL
+         *
+         */
+        struct sPtrFunc
+        {
+            /**
+             * sock_accept return a pointer on IEndpoint.
+             * if an error happend the pointer returned is null.
+             * the pointer HAS TO BE ALLOCATED, all memory managment is made by
+             * the server.
+             */
+            network::IEndPoint* (*sock_accept) (network::IEndPoint& server); /**< accept redefinition, called when we want accept a new connection */
 
-    virtual ~INetworkHandler(void){}
+            /**
+             * sock_read function returns the number of bytes read, -1 on error and 0 on EOF
+             */
+            int (*sock_read)(network::IEndPoint&, void* buffer, size_t len); /**< write redefinition, called when we want to write something on the socket */
+            /**
+             * sock_write function returns the number of bytes writen, -1 on error
+             */
+            int (*sock_write)(network::IEndPoint&, const void* buffer, size_t len);/**< read redefinition, called when we want to read something on the socket */
+        };
+
 
-    virtual int     operator()(network::IEndPoint & endpoint, std::ios & stream) = 0;
+
+        virtual ~INetworkHandler(void){}
+
+        /**
+         * @brief this method return the structure wich contains
+         * all function pointer redefined
+         * @return a copy of a structure
+         * @see sPtrFunc
+         */
+        virtual sPtrFunc getHandlers(void) = 0;
 
 };
 
--- a/src/include/http/IHeader.hpp	Sun Mar 21 14:19:23 2010 +0100
+++ b/src/include/http/IHeader.hpp	Sun Mar 21 14:19:32 2010 +0100
@@ -52,7 +52,7 @@
 
     /**
      * @brief operator overloading to facilitate header access.
-     * @see IHeader::value
+     * @see IHeader::setValue
      */
     virtual Value &             operator[](const Key & k) = 0;
 };