X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FSocketSink.hh;h=74580cc807feb1541db394484d0d07d6027525ef;hb=c45c112ae88196ea8da9c5a9efb0e167196744d2;hp=83a1d5f196ae914759baefa806cc78222c002207;hpb=fc1ad795c55b8f64bce4926e4ef9194c773342c8;p=senf.git
diff --git a/PPI/SocketSink.hh b/PPI/SocketSink.hh
index 83a1d5f..74580cc 100644
--- a/PPI/SocketSink.hh
+++ b/PPI/SocketSink.hh
@@ -65,6 +65,36 @@ namespace ppi {
\param[in] packet Packet to write */
};
+ /** \brief Writer sending data with ClientSocketHandle::writeto()
+
+ This writer will send out data using ClientSocketHandle::writeto(). The target address can
+ be specified in the writer constructor and can be adjusted at any time.
+
+ If no target address is set, incoming data will be silently dropped.
+ */
+ template
+ class TargetDgramWriter
+ {
+ public:
+ typedef HandleType Handle;
+
+ TargetDgramWriter(); ///< Create TargetDgramWriter with unset target address
+ TargetDgramWriter(typename Handle::Address const & target);
+ ///< Create TargetDgramWriter sending to \a target
+
+ typename Handle::Address target() const; ///< Get current target address
+ void target(typename Handle::Address const & target); ///< Set target address
+
+ void operator()(Handle handle, Packet const & packet); ///< Write \a packet to \a handle
+ /**< Write the complete \a packet as a datagram to \a
+ handle.
+ \param[in] handle Handle to write data to
+ \param[in] packet Packet to write */
+
+ private:
+ typename Handle::Address target_;
+ };
+
class IPv4SourceForcingDgramWriter : ConnectedDgramWriter
{
public: