X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FCommunicationPolicy.hh;h=1f8bb032754b75444008c5fc64999ec21941ec3f;hb=3b44557da0af28f1e0e3b8c0e0fb03de6b0d18c7;hp=4d8cdce77588407939f36112eae0e1e27b1e3d78;hpb=ac6a813d9d99f7add4e13aff7a4bcd314d5604a6;p=senf.git diff --git a/Socket/CommunicationPolicy.hh b/Socket/CommunicationPolicy.hh index 4d8cdce..1f8bb03 100644 --- a/Socket/CommunicationPolicy.hh +++ b/Socket/CommunicationPolicy.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -20,6 +20,10 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +/** \file + \brief CommunicationPolicy public header + */ + #ifndef HH_CommunicationPolicy_ #define HH_CommunicationPolicy_ 1 @@ -35,23 +39,55 @@ struct sockaddr; namespace senf { - + /// \addtogroup policy_impl_group + /// @{ + template 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. + */ struct ConnectedCommunicationPolicy : public CommunicationPolicyBase { - static void listen(FileHandle handle, unsigned backlog); template - static int accept(ServerSocketHandle handle, + static void listen(ServerSocketHandle handle, unsigned backlog, + typename IfAddressingPolicyIsNot::type * = 0); + ///< Enable establishing new connections on the socket + /**< \param[in] handle socket handle to enable reception on + \param[in] backlog size of backlog queue */ + template + static int accept(ServerSocketHandle handle, typename ServerSocketHandle::Address & address, typename IfAddressingPolicyIsNot::type * = 0); + ///< 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 */ 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 + effectively disables the ServerSocketHandle. + */ struct UnconnectedCommunicationPolicy : public CommunicationPolicyBase {}; + /// @} + } @@ -64,5 +100,10 @@ namespace senf { // Local Variables: // mode: c++ +// fill-column: 100 // c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: