00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #ifndef HH_SENF_Socket_CommunicationPolicy_
00028 #define HH_SENF_Socket_CommunicationPolicy_ 1
00029
00030
00031 #include "SocketPolicy.hh"
00032 #include "AddressingPolicy.hh"
00033 #include "FileHandle.hh"
00034
00035
00036
00037
00038 struct sockaddr;
00039
00040 namespace senf {
00041
00043
00044
00045 template <class SPolicy> class ServerSocketHandle;
00046
00052 struct ConnectedCommunicationPolicy : public CommunicationPolicyBase
00053 {
00054 # ifndef DOXYGEN
00055 template <class SPolicy>
00056 static void listen(ServerSocketHandle<SPolicy> const & handle, unsigned backlog,
00057 typename IfAddressingPolicyIsNot<SPolicy,NoAddressingPolicy>::type * = 0);
00058 # else
00059 template <class SPolicy>
00060 static void listen(ServerSocketHandle<SPolicy> const & handle, unsigned backlog);
00062
00064 # endif
00065
00066 # ifndef DOXYGEN
00067 template <class SPolicy>
00068 static int accept(ServerSocketHandle<SPolicy> const & handle,
00069 typename ServerSocketHandle<SPolicy>::Address & address,
00070 typename IfAddressingPolicyIsNot<SPolicy,NoAddressingPolicy>::type * = 0);
00071 # else
00072 template <class SPolicy>
00073 static int accept(ServerSocketHandle<SPolicy> const & handle,
00074 typename ServerSocketHandle<SPolicy>::Address & address);
00076
00085 # endif
00086
00087 static int accept(FileHandle const & handle);
00089
00097 private:
00098 static void do_listen(FileHandle const & handle, unsigned backlog);
00099 static int do_accept(FileHandle const & handle, struct sockaddr * addr, unsigned len);
00100 };
00101
00109 struct UnconnectedCommunicationPolicy : public CommunicationPolicyBase
00110 {};
00111
00112
00113
00114 }
00115
00116
00117
00118 #include "CommunicationPolicy.cci"
00119
00120 #include "CommunicationPolicy.cti"
00121 #endif
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132