NEW FILE HEADER / COPYRIGHT FORMAT
[senf.git] / Socket / CommunicationPolicy.hh
index 097a8bf..588d735 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
@@ -41,47 +41,70 @@ namespace senf {
 
     /// \addtogroup policy_impl_group
     /// @{
-    
+
     template <class Policy> class ServerSocketHandle;
 
     /** \brief CommunicationPolicy for connected sockets
 
-       The ConnectedCommunicationPolicy provides support for standard BSD socket API based
-       connected communication. It provides the server side listen() and accept() members.
+        The ConnectedCommunicationPolicy provides support for standard BSD socket API based
+        connected communication. It provides the server side listen() and accept() members.
      */
     struct ConnectedCommunicationPolicy : public CommunicationPolicyBase
     {
-        static void listen(FileHandle handle, unsigned backlog);
+#       ifndef DOXYGEN
+        template <class Policy>
+        static void listen(ServerSocketHandle<Policy> handle, unsigned backlog,
+                           typename IfAddressingPolicyIsNot<Policy,NoAddressingPolicy>::type * = 0);
+#       else
+        template <class Policy>
+        static void listen(ServerSocketHandle<Policy> handle, unsigned backlog);
                                         ///< Enable establishing new connections on the socket
-                                        /** \param[in] handle socket handle to enable reception on
-                                           \param[in] backlog size of backlog queue
-                                           
-                                           \fixme listen probably makes no sense without accpept,
-                                               so listen() should debend on AddressingPolicy too. */
+                                        /**< \param[in] handle socket handle to enable reception on
+                                             \param[in] backlog size of backlog queue */
+#       endif
+
+#       ifndef DOXYGEN
         template <class Policy>
-        static int accept(ServerSocketHandle<Policy> handle, 
+        static int accept(ServerSocketHandle<Policy> handle,
                           typename ServerSocketHandle<Policy>::Address & address,
                           typename IfAddressingPolicyIsNot<Policy,NoAddressingPolicy>::type * = 0);
+#       else
+        template <class Policy>
+        static int accept(ServerSocketHandle<Policy> handle,
+                          typename ServerSocketHandle<Policy>::Address & address);
                                         ///< accept a new connection on the socket.
                                         /**< The accept() member will return a new client file
-                                            descriptor. This file descriptor will be used by the
-                                            ServerSocketHandle implementation to build a new
-                                            ClientSocketHandle for the new connection.
-                                            
-                                            \param[in] handle socket handle to accept connection on
-                                            \param[out] address address of newly connected remote
-                                                peer
-                                            \returns file descriptor of new client socket */
+                                             descriptor. This file descriptor will be used by the
+                                             ServerSocketHandle implementation to build a new
+                                             ClientSocketHandle for the new connection.
+
+                                             \param[in] handle socket handle to accept connection on
+                                             \param[out] address address of newly connected remote
+                                                 peer
+                                             \returns file descriptor of new client socket */
+#       endif
+
+        static int accept(FileHandle handle);
+                                        ///< accept a new connection on the socket.
+                                        /**< The accept() member will return a new client file
+                                             descriptor. This file descriptor will be used by the
+                                             ServerSocketHandle implementation to build a new
+                                             ClientSocketHandle for the new connection.
+
+                                             \param[in] handle socket handle to accept connection on
+                                             \returns file descriptor of new client socket */
+
     private:
+        static void do_listen(FileHandle handle, unsigned backlog);
         static int do_accept(FileHandle handle, struct sockaddr * addr, unsigned len);
     };
 
     /** \brief CommunicationPolicy for unconnected sockets
 
-       This is different from UndefinedCommunicationPolicy (which is the same as
-       CommunicationPolicyBase). This policy class defines the communication policy -- it
-       explicitly states, that the socket does not support connected communication. This
-       effektively disables ther ServerSocketHandle.
+        This is different from UndefinedCommunicationPolicy (which is the same as
+        CommunicationPolicyBase). This policy class defines the communication policy -- it
+        explicitly states, that the socket does not support connected communication. This
+        effectively disables the ServerSocketHandle.
      */
     struct UnconnectedCommunicationPolicy : public CommunicationPolicyBase
     {};
@@ -92,7 +115,7 @@ namespace senf {
 
 
 ///////////////////////////////hh.e////////////////////////////////////////
-//#include "CommunicationPolicy.cci"
+#include "CommunicationPolicy.cci"
 //#include "CommunicationPolicy.ct"
 #include "CommunicationPolicy.cti"
 #endif
@@ -100,6 +123,10 @@ namespace senf {
 \f
 // Local Variables:
 // mode: c++
-// c-file-style: "senf"
 // fill-column: 100
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// comment-column: 40
 // End: