2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief SocketReader public header */
24 #ifndef HH_SocketReader_
25 #define HH_SocketReader_ 1
28 #include "Packets/Packets.hh"
29 #include "Socket/ClientSocketHandle.hh"
30 #include "Socket/SocketPolicy.hh"
31 #include "Socket/ReadWritePolicy.hh"
32 #include "Socket/FramingPolicy.hh"
34 #include "Connectors.hh"
37 //#include "SocketReader.mpp"
38 ///////////////////////////////hh.p////////////////////////////////////////
43 /** \brief Read helper for module::ActiveSocketReader
45 This read helper will read a datagram from a datagram socket. This datagram will then be
46 interpreted as a packet of type \a Packet as defined in the packet library. \a Packet
47 defaults to \ref DataPacket, which will place the data uninterpreted into a packet data
50 template <class Packet=DataPacket>
54 typedef senf::ClientSocketHandle<
55 senf::MakeSocketPolicy< senf::ReadablePolicy,
56 senf::DatagramFramingPolicy >::policy > Handle;
57 ///< Handle type supported by this reader
59 Packet operator()(Handle handle);
60 ///< Read packet from \a handle
61 /**< Read a datagram from \a handle and interpret is as
62 packet of type \c Packet.
63 \param[in] handle Handle to read data from
64 \returns Pointer to new packet instance or 0, if no
65 packet could be read */
74 /** \brief Input module reading data from an arbitrary FileHandle
76 This input module will read data from a FileHandle object and parse the data according to
79 The \a Reader must fulfill the following interface:
84 typedef unspecified_type Handle; // type of handle requested
85 SomeReader(); // default constructible
86 Packet::ptr operator()(Handle handle); // extraction function
90 template <class Reader=PacketReader<> >
91 class ActiveSocketReader
95 typedef typename Reader::Handle Handle; ///< Handle type requested by the reader
97 connector::ActiveOutput output; ///< Output connector to which the data received is written
99 ActiveSocketReader(Handle handle); ///< Create new reader for the given handle
100 /**< Data will be read from \a handle and be parsed by \a
102 \param[in] handle Handle to read data from */
114 ///////////////////////////////hh.e////////////////////////////////////////
115 //#include "SocketReader.cci"
116 #include "SocketReader.ct"
117 //#include "SocketReader.cti"
124 // c-file-style: "senf"
125 // indent-tabs-mode: nil
126 // ispell-local-dictionary: "american"
127 // compile-command: "scons -u test"
128 // comment-column: 40