X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FSocketReader.hh;h=4d6795102a153151dc8c4f18783b48515866d919;hb=53a3d02e7fde841badf42555eba87ccef4566073;hp=2b1245b01909cf7d69e79d94ee2a17e85dc96231;hpb=dab85c1701097d7f139f0fa9206cc13320b25889;p=senf.git diff --git a/PPI/SocketReader.hh b/PPI/SocketReader.hh index 2b1245b..4d67951 100644 --- a/PPI/SocketReader.hh +++ b/PPI/SocketReader.hh @@ -25,10 +25,14 @@ #define HH_SocketReader_ 1 // Custom includes -#include "Packets/Packet.hh" -#include "Packets/DataPacket.hh" +#include "Packets/Packets.hh" +#include "Socket/ClientSocketHandle.hh" +#include "Socket/SocketPolicy.hh" +#include "Socket/ReadWritePolicy.hh" +#include "Socket/FramingPolicy.hh" #include "Module.hh" -#include "Connector.hh" +#include "Connectors.hh" +#include "IOEvent.hh" //#include "SocketReader.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -49,10 +53,10 @@ namespace ppi { public: typedef senf::ClientSocketHandle< senf::MakeSocketPolicy< senf::ReadablePolicy, - senf::DatagramFramingPolicy > > Handle; + senf::DatagramFramingPolicy >::policy > Handle; ///< Handle type supported by this reader - Packet::ptr operator()(Handle handle); + Packet operator()(Handle handle); ///< Read packet from \a handle /**< Read a datagram from \a handle and interpret is as packet of type \c Packet. @@ -77,15 +81,24 @@ namespace module { class SomeReader { public: - typedef unspecified_type Handle; // type of handle requested - SomeReader(); // default constructible - Packet::ptr operator()(Handle handle); // extraction function + typedef unspecified_type Handle; // type of handle requested + SomeReader(); // default constructible + Packet operator()(Handle handle); // extraction function }; \endcode + + Whenever the FileHandle object is ready for reading, the \a Reader's \c operator() is called + to read a packet. The default \a Reader is \c PacketReader<>, which will read packets from a + datagram SocketHandle into DataPacket's. You may + + \ingroup io_modules */ template > - class ActiveSocketReader : public Module + class ActiveSocketReader + : public Module { + SENF_PPI_MODULE(ActiveSocketReader); + public: typedef typename Reader::Handle Handle; ///< Handle type requested by the reader @@ -95,13 +108,20 @@ namespace module { /**< Data will be read from \a handle and be parsed by \a Reader. \param[in] handle Handle to read data from */ + + private: + void read(); + + Handle handle_; + IOEvent event_; + Reader reader_; }; }}} ///////////////////////////////hh.e//////////////////////////////////////// //#include "SocketReader.cci" -//#include "SocketReader.ct" +#include "SocketReader.ct" //#include "SocketReader.cti" #endif @@ -113,4 +133,5 @@ namespace module { // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" +// comment-column: 40 // End: