X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPPI%2FSocketSink.cc;h=7e5e17340470c809f13cb6bee64bb5f81c7b4301;hb=c505c034e5fdc932c02aa3dc3847a5551011d87e;hp=8851fbf394ee7da30d9ac3583f4befb106f9e8d0;hpb=26610f603ebdd465307b9621f532c1fe19fd5571;p=senf.git diff --git a/senf/PPI/SocketSink.cc b/senf/PPI/SocketSink.cc index 8851fbf..7e5e173 100644 --- a/senf/PPI/SocketSink.cc +++ b/senf/PPI/SocketSink.cc @@ -29,35 +29,41 @@ #define prefix_ -prefix_ senf::ppi::IPv4SourceForcingDgramWriter::IPv4SourceForcingDgramWriter(){ +prefix_ senf::ppi::IPv4SourceForcingDgramWriter::IPv4SourceForcingDgramWriter() +{ source_ = senf::INet4Address::from_string("0.0.0.0"); destination_ = senf::INet4Address::from_string("0.0.0.0"); protocolId_ = 0; } -prefix_ senf::ppi::IPv4SourceForcingDgramWriter::IPv4SourceForcingDgramWriter(senf::INet4Address sourceAddr, senf::INet4SocketAddress destAddr){ +prefix_ senf::ppi::IPv4SourceForcingDgramWriter:: +IPv4SourceForcingDgramWriter(senf::INet4Address sourceAddr, senf::INet4SocketAddress destAddr) +{ source(sourceAddr); destination(destAddr); } -prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::source(senf::INet4Address & source){ +prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::source(senf::INet4Address & source) +{ source_ = source; } -prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::destination(senf::INet4SocketAddress & dest){ + +prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::destination(senf::INet4SocketAddress & dest) +{ destination_ = dest.address(); protocolId_ = dest.port(); } -prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::operator()(Handle handle, +prefix_ bool senf::ppi::IPv4SourceForcingDgramWriter::operator()(Handle & handle, Packet const & packet) { - sendtoandfrom( + return sendtoandfrom( handle.fd(), reinterpret_cast (&*packet.data().begin()), packet.size(), reinterpret_cast (&destination_), protocolId_, - reinterpret_cast (&source_)); + reinterpret_cast (&source_)) > 0; } prefix_ int senf::ppi::IPv4SourceForcingDgramWriter::sendtoandfrom( @@ -102,34 +108,41 @@ prefix_ int senf::ppi::IPv4SourceForcingDgramWriter::sendtoandfrom( return sendmsg(sock, &h, 0); } -prefix_ senf::ppi::IPv6SourceForcingDgramWriter::IPv6SourceForcingDgramWriter(){ +prefix_ senf::ppi::IPv6SourceForcingDgramWriter::IPv6SourceForcingDgramWriter() +{ source_ = senf::INet6Address::from_string("0::0"); destination_ = senf::INet6Address::from_string("0::0"); protocolId_ = 0; } -prefix_ senf::ppi::IPv6SourceForcingDgramWriter::IPv6SourceForcingDgramWriter(senf::INet6Address sourceAddr, senf::INet6SocketAddress destAddr){ +prefix_ senf::ppi::IPv6SourceForcingDgramWriter:: +IPv6SourceForcingDgramWriter(senf::INet6Address sourceAddr, senf::INet6SocketAddress destAddr) +{ source(sourceAddr); destination(destAddr); } -prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::source(senf::INet6Address & source){ +prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::source(senf::INet6Address & source) +{ source_ = source; } -prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::destination(senf::INet6SocketAddress & dest){ + +prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::destination(senf::INet6SocketAddress & dest) +{ destination_ = dest.address(); protocolId_ = dest.port(); } -prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::operator()(Handle handle, - Packet const & packet){ - sendtoandfrom( +prefix_ bool senf::ppi::IPv6SourceForcingDgramWriter::operator()(Handle & handle, + Packet const & packet) +{ + return sendtoandfrom( handle.fd(), reinterpret_cast (&*packet.data().begin()), packet.size(), reinterpret_cast (&destination_), protocolId_, - reinterpret_cast (&source_)); + reinterpret_cast (&source_)) > 0; } prefix_ int senf::ppi::IPv6SourceForcingDgramWriter::sendtoandfrom(