// $Id$
//
-// Copyright (C) 2007
-// Fraunhofer Institute for Open Communication Systems (FOKUS)
-// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
namespace senf {
namespace ppi {
- /** \brief Read helper for module::ActiveSocketSource
+ /** \brief Reader for module::ActiveSocketSource
This read helper will read a datagram from a datagram socket. This datagram will then be
interpreted as a packet of type \a Packet as defined in the packet library. \a Packet
into a packet data structure.
*/
template <class Packet=DataPacket>
- class PacketSource
+ class DgramReader
{
public:
typedef senf::ClientSocketHandle<
/** \brief Input module reading data from an arbitrary FileHandle
This input module will read data from a FileHandle object and parse the data according to
- the \a Source. The default reader is senf::ppi::PacketSource <> which reads the data into a
+ the \a Reader. The default reader is senf::ppi::DgramReader <> which reads the data into a
senf::DataPacket. To parse the data according to some other packet type, pass that packet
- type to senf::ppi::PacketSource:
+ type to senf::ppi::DgramReader:
\code
- senf::ppi::module::ActiveSocketSource< senf::ppi::PacketSource<senf::EthernetPacket> > reader;
+ senf::ppi::module::ActiveSocketSource< senf::ppi::DgramReader<senf::EthernetPacket> > source;
\endcode
- declares a \a reader module reading senf::EthrtnetPacket's.
+ declares a \a reader module reading senf::EthernetPacket's
- A \a Source must fulfill the following interface:
+ A \a Reader must fulfill the following interface:
\code
- class SomeSource
+ class SomeReader
{
public:
typedef unspecified_type Handle; // type of handle requested
- SomeSource(); // EITHER default constructible
- SomeSource(SomeSource const & other); // OR copy constructible
+ SomeReader(); // EITHER default constructible
+ SomeReader(SomeReader const & other); // OR copy constructible
Packet operator()(Handle handle); // extraction function
};
\endcode
- Whenever the FileHandle object is ready for reading, the \a Source's \c operator() is called
+ Whenever the FileHandle object is ready for reading, the \a Reader's \c operator() is called
to read a packet.
\ingroup io_modules
*/
- template <class Source=PacketSource<> >
+ template <class Reader=DgramReader<> >
class ActiveSocketSource
: public Module
{
SENF_PPI_MODULE(ActiveSocketSource);
public:
- typedef typename Source::Handle Handle; ///< Handle type requested by the reader
+ typedef typename Reader::Handle Handle; ///< Handle type requested by the reader
- connector::ActiveOutput output; ///< Output connector to which the data received is written
+ connector::ActiveOutput<> output; ///< Output connector to which the data received is written
ActiveSocketSource(Handle handle); ///< Create new reader for the given handle
/**< Data will be read from \a handle and be parsed by \a
- Source.
- \pre Requires \a Source to be default constructible
+ Reader.
+ \pre Requires \a Reader to be default constructible
\param[in] handle Handle to read data from */
- ActiveSocketSource(Handle handle, Source source);
+ ActiveSocketSource(Handle handle, Reader reader);
///< Create new reader for the given handle
/**< Data will be read from \a handle and be parsed by \a
- Source.
- \pre Requires \a Source to be copy constructible
+ Reader.
+ \pre Requires \a Reader to be copy constructible
\param[in] handle Handle to read data from */
- Source & source(); ///< Access source helper
-
+ Reader & reader(); ///< Access Reader helper
+
private:
void read();
Handle handle_;
IOEvent event_;
- Source reader_;
+ Reader reader_;
};
}}}