Packets: Fix VariantParser invalid parser access bug
[senf.git] / Socket / SocketProtocol.test.hh
index 047a6a9..497cff1 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
-// Copyright (C) 2006 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Copyright (C) 2006
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -20,8 +20,8 @@
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#ifndef HH_SocketProtocol_test_
-#define HH_SocketProtocol_test_ 1
+#ifndef HH_SENF_Socket_SocketProtocol_test_
+#define HH_SENF_Socket_SocketProtocol_test_ 1
 
 // Custom includes
 #include "SocketProtocol.hh"
 //#include "SocketProtocol.test.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
 
-namespace satcom {
-namespace lib {
+namespace senf {
 namespace test {
 
-    class SomeProtocol
-        : public ConcreteSocketProtocol<SomeSocketPolicy>
+    class SomeSocketProtocol
+        : public ConcreteSocketProtocol<SomeSocketPolicy,SomeSocketProtocol>
     {
     public:
-        ~SomeProtocol() {}
-        
-        void init_client() const {}
-        void init_server() const {}
+        ~SomeSocketProtocol() {}
 
-        std::auto_ptr<SocketProtocol> clone() const 
-            { return std::auto_ptr<SocketProtocol>(new SomeProtocol()); }
-        unsigned available() const 
+        void init_client() const { fd(0); }
+        void init_server() const { fd(0); }
+
+        unsigned available() const
             { return Policy::ReadPolicy::TEST_SIZE; }
-        bool eof() const 
+        bool eof() const
             { return false; }
+
+        virtual void close() const {
+            closeCount(1);
+        }
+
+        static unsigned closeCount(unsigned inc=0) {
+            static unsigned counter (0);
+            counter += inc;
+            return counter;
+        }
     };
 
-}}}
+}}
 
 ///////////////////////////////hh.e////////////////////////////////////////
 //#include "SocketProtocol.test.cci"
@@ -64,5 +71,10 @@ namespace test {
 \f
 // Local Variables:
 // mode: c++
-// c-file-style: "satcom"
+// fill-column: 100
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// comment-column: 40
 // End: