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/Packet.hh"
29 #include "Packets/DataPacket.hh"
31 #include "Connector.hh"
33 //#include "SocketReader.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
39 /** \brief Read helper for module::ActiveSocketReader
41 This read helper will read a datagram from a datagram socket. This datagram will then be
42 interpreted as a packet of type \a Packet as defined in the packet library. \a Packet
43 defaults to \ref DataPacket, which will place the data uninterpreted into a packet data
46 template <class Packet=DataPacket>
50 typedef senf::ClientSocketHandle<
51 senf::MakeSocketPolicy< senf::ReadablePolicy,
52 senf::DatagramFramingPolicy > > Handle;
53 ///< Handle type supported by this reader
55 Packet::ptr operator()(Handle handle);
56 ///< Read packet from \a handle
57 /**< Read a datagram from \a handle and interpret is as
58 packet of type \c Packet.
59 \param[in] handle Handle to read data from
60 \returns Pointer to new packet instance or 0, if no
61 packet could be read */
70 /** \brief Input module reading data from an arbitrary FileHandle
72 This input module will read data from a FileHandle object and parse the data according to
75 The \a Reader must fulfill the following interface:
80 typedef unspecified_type Handle; // type of handle reqeusted
81 SomeReader(); // default constructible
82 Packet::ptr operator()(Handle handle); // extraction function
86 template <class Reader=PacketReader<> >
87 class ActiveSocketReader : public Module
90 typedef typename Reader::Handle Handle; ///< Handle type requested by the reader
92 connector::ActiveOutput output; ///< Output connector to which the data recevied is writtten
94 ActiveSocketReader(Handle handle); ///< Create new reader for the given handle
95 /**< Data will be read from \a handle and be parsed by \a
97 \param[in] handle Handle to read data from */
102 ///////////////////////////////hh.e////////////////////////////////////////
103 //#include "SocketReader.cci"
104 //#include "SocketReader.ct"
105 //#include "SocketReader.cti"
112 // c-file-style: "senf"
113 // indent-tabs-mode: nil
114 // ispell-local-dictionary: "american"