X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FSocketReader.hh;h=4d6795102a153151dc8c4f18783b48515866d919;hb=21bad90912447cd2d390112cf2d2a7d383ad8058;hp=4d0c626072cdeb4c438ae44bd0785570e191d60d;hpb=145f6a7d0f3a6aaa77b3625351c952d24cb0b8a1;p=senf.git diff --git a/PPI/SocketReader.hh b/PPI/SocketReader.hh index 4d0c626..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