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.
23 #ifndef HH_ReadWritePolicy_
24 #define HH_ReadWritePolicy_ 1
27 #include "SocketPolicy.hh"
28 #include "ClientSocketHandle.hh"
29 #include "CommunicationPolicy.hh"
31 //#include "ReadWritePolicy.mpp"
32 ///////////////////////////////hh.p////////////////////////////////////////
34 // TODO: ReadWritePolicy.test.cc ...
41 struct ReadablePolicy : public ReadPolicyBase
43 static unsigned read(FileHandle handle, char * buffer, unsigned size);
44 template <class Policy>
45 static unsigned readfrom(ClientSocketHandle<Policy> handle, char * buffer, unsigned size,
46 typename Policy::AddressingPolicy::Address & address,
47 typename IfCommunicationPolicyIs<Policy,UnconnectedCommunicationPolicy>::type * = 0);
50 static unsigned do_readfrom(FileHandle handle, char * buffer, unsigned size,
51 struct ::sockaddr * addr, socklen_t len);
54 struct NotReadablePolicy : public ReadPolicyBase
57 struct WriteablePolicy : public WritePolicyBase
59 template <class Policy>
60 static unsigned write(ClientSocketHandle<Policy> handle, char const * buffer, unsigned size,
61 typename IfCommunicationPolicyIs<Policy,ConnectedCommunicationPolicy>::type * = 0);
62 template <class Policy>
63 static unsigned writeto(ClientSocketHandle<Policy> handle,
64 typename boost::call_traits<typename Policy::AddressingPolicy::Address>::param_type addr,
65 char const * buffer, unsigned size,
66 typename IfCommunicationPolicyIs<Policy,UnconnectedCommunicationPolicy>::type * = 0);
69 static unsigned do_write(FileHandle handle, char const * buffer, unsigned size);
70 static unsigned do_writeto(FileHandle handle, char const * buffer, unsigned size,
71 struct sockaddr * addr, socklen_t len);
74 struct NotWriteablePolicy : public WritePolicyBase
80 ///////////////////////////////hh.e////////////////////////////////////////
81 //#include "ReadWritePolicy.cci"
82 //#include "ReadWritePolicy.ct"
83 #include "ReadWritePolicy.cti"
89 // c-file-style: "satcom"