4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 \todo ReadWritePolicy.test.cc
28 #ifndef HH_ReadWritePolicy_
29 #define HH_ReadWritePolicy_ 1
32 #include "SocketPolicy.hh"
33 #include "ClientSocketHandle.hh"
34 #include "CommunicationPolicy.hh"
36 //#include "ReadWritePolicy.mpp"
37 ///////////////////////////////hh.p////////////////////////////////////////
45 struct ReadablePolicy : public ReadPolicyBase
47 static unsigned read(FileHandle handle, char * buffer, unsigned size);
48 template <class Policy>
49 static unsigned readfrom(ClientSocketHandle<Policy> handle, char * buffer, unsigned size,
50 typename Policy::AddressingPolicy::Address & address,
51 typename IfCommunicationPolicyIs<Policy,UnconnectedCommunicationPolicy>::type * = 0);
54 static unsigned do_readfrom(FileHandle handle, char * buffer, unsigned size,
55 struct ::sockaddr * addr, socklen_t len);
58 struct NotReadablePolicy : public ReadPolicyBase
61 struct WriteablePolicy : public WritePolicyBase
63 template <class Policy>
64 static unsigned write(ClientSocketHandle<Policy> handle, char const * buffer, unsigned size,
65 typename IfCommunicationPolicyIs<Policy,ConnectedCommunicationPolicy>::type * = 0);
66 template <class Policy>
67 static unsigned writeto(ClientSocketHandle<Policy> handle,
68 typename boost::call_traits<typename Policy::AddressingPolicy::Address>::param_type addr,
69 char const * buffer, unsigned size,
70 typename IfCommunicationPolicyIs<Policy,UnconnectedCommunicationPolicy>::type * = 0);
73 static unsigned do_write(FileHandle handle, char const * buffer, unsigned size);
74 static unsigned do_writeto(FileHandle handle, char const * buffer, unsigned size,
75 struct sockaddr * addr, socklen_t len);
78 struct NotWriteablePolicy : public WritePolicyBase
84 ///////////////////////////////hh.e////////////////////////////////////////
85 //#include "ReadWritePolicy.cci"
86 //#include "ReadWritePolicy.ct"
87 #include "ReadWritePolicy.cti"
93 // c-file-style: "senf"