X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FCommunicationPolicy.hh;h=2f2911e39569a435ea889afd5462debb93660121;hb=1ad3873b372da6187b1fbc645bf276287d2efb54;hp=11c9af117584ddf0108dddae5d3b9a6302eab654;hpb=85ab07d100a382467a42e19d741d403a7a96c951;p=senf.git diff --git a/Socket/CommunicationPolicy.hh b/Socket/CommunicationPolicy.hh index 11c9af1..2f2911e 100644 --- a/Socket/CommunicationPolicy.hh +++ b/Socket/CommunicationPolicy.hh @@ -51,18 +51,27 @@ namespace senf { */ struct ConnectedCommunicationPolicy : public CommunicationPolicyBase { - static void listen(FileHandle handle, unsigned backlog); +# ifndef DOXYGEN + template + static void listen(ServerSocketHandle handle, unsigned backlog, + typename IfAddressingPolicyIsNot::type * = 0); +# else + template + static void listen(ServerSocketHandle 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 + \param[in] backlog size of backlog queue */ +# endif - \fixme listen probably makes no sense without accpept, - so listen() should debend on AddressingPolicy - too. */ +# ifndef DOXYGEN template static int accept(ServerSocketHandle handle, typename ServerSocketHandle::Address & address, typename IfAddressingPolicyIsNot::type * = 0); +# else + template + static int accept(ServerSocketHandle handle, + typename ServerSocketHandle::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 @@ -73,7 +82,20 @@ namespace senf { \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); }; @@ -82,7 +104,7 @@ namespace senf { 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. + effectively disables the ServerSocketHandle. */ struct UnconnectedCommunicationPolicy : public CommunicationPolicyBase {}; @@ -93,7 +115,7 @@ namespace senf { ///////////////////////////////hh.e//////////////////////////////////////// -//#include "CommunicationPolicy.cci" +#include "CommunicationPolicy.cci" //#include "CommunicationPolicy.ct" #include "CommunicationPolicy.cti" #endif @@ -105,4 +127,6 @@ namespace senf { // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: