From: g0dil Date: Fri, 25 Sep 2009 23:03:48 +0000 (+0000) Subject: Apply senf::fieldName() to all packet dump methods X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=82e794070d4f3ae8aacb1827b21a93b9d48ce57f;p=senf.git Apply senf::fieldName() to all packet dump methods git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1449 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/PPI/IOEvent.hh b/senf/PPI/IOEvent.hh index ac08128..32c699f 100644 --- a/senf/PPI/IOEvent.hh +++ b/senf/PPI/IOEvent.hh @@ -101,11 +101,11 @@ namespace ppi { /** \brief Unhandled error condition */ struct ErrorException : public senf::Exception - { ErrorException() : senf::Exception("senf::ppi::IOEvent::ErrorException"){} }; + { ErrorException() : senf::Exception("senf::ppi::IOEvent::ErrorException") {} }; /** \brief Unhandled hangup condition */ struct HangupException : public senf::Exception - { HangupException() : senf::Exception("senf::ppi::IOEvent::HangupException"){} }; + { HangupException() : senf::Exception("senf::ppi::IOEvent::HangupException") {} }; protected: diff --git a/senf/PPI/SocketSink.cc b/senf/PPI/SocketSink.cc index 8851fbf..9e39494 100644 --- a/senf/PPI/SocketSink.cc +++ b/senf/PPI/SocketSink.cc @@ -29,21 +29,27 @@ #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(); } @@ -102,27 +108,34 @@ 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){ + Packet const & packet) +{ sendtoandfrom( handle.fd(), reinterpret_cast (&*packet.data().begin()), diff --git a/senf/Packets/80211Bundle/RadiotapPacket.cc b/senf/Packets/80211Bundle/RadiotapPacket.cc index 16bcb00..b27bd13 100644 --- a/senf/Packets/80211Bundle/RadiotapPacket.cc +++ b/senf/Packets/80211Bundle/RadiotapPacket.cc @@ -35,36 +35,36 @@ prefix_ void senf::RadiotapPacketType::dump(packet p, std::ostream &os) { boost::io::ios_all_saver ias(os); os << "Radiotap:\n" - << " version : " << unsigned( p->version()) << "\n" - << " length : " << unsigned( p->length()) << "\n"; + << senf::fieldName("version") << unsigned( p->version()) << "\n" + << senf::fieldName("length") << unsigned( p->length()) << "\n"; if (p->has_tsft()) - os << " MAC timestamp : " << unsigned( p->tsft()) << "\n"; + os << senf::fieldName("MAC timestamp") << unsigned( p->tsft()) << "\n"; // TODO: flags if (p->has_rate()) - os << " rate : " << unsigned( p->rate()) << "\n"; + os << senf::fieldName("rate") << unsigned( p->rate()) << "\n"; // TODO: channelOptions if (p->has_fhss()) - os << " FHSS : " << unsigned( p->fhss()) << "\n"; + os << senf::fieldName("FHSS") << unsigned( p->fhss()) << "\n"; if (p->has_dbmAntennaSignal()) - os << " antenna signal (dBm) : " << signed( p->dbmAntennaSignal()) << "\n"; + os << senf::fieldName("antenna signal (dBm)") << signed( p->dbmAntennaSignal()) << "\n"; if (p->has_dbmAntennaNoise()) - os << " antenna noise (dBm) : " << signed( p->dbmAntennaNoise()) << "\n"; + os << senf::fieldName("antenna noise (dBm)") << signed( p->dbmAntennaNoise()) << "\n"; if (p->has_lockQuality()) - os << " lock quality : " << unsigned( p->lockQuality()) << "\n"; + os << senf::fieldName("lock quality") << unsigned( p->lockQuality()) << "\n"; if (p->has_txAttenuation()) - os << " tx attenuation : " << unsigned( p->txAttenuation()) << "\n"; + os << senf::fieldName("tx attenuation") << unsigned( p->txAttenuation()) << "\n"; if (p->has_dbTxAttenuation()) - os << " tx attenuation (dB) : " << unsigned( p->dbTxAttenuation()) << "\n"; + os << senf::fieldName("tx attenuation (dB)") << unsigned( p->dbTxAttenuation()) << "\n"; if (p->has_dbmTxAttenuation()) - os << " tx attenuation (dBm) : " << signed( p->dbmTxAttenuation()) << "\n"; + os << senf::fieldName("tx attenuation (dBm)") << signed( p->dbmTxAttenuation()) << "\n"; if (p->has_antenna()) - os << " antenna : " << unsigned( p->antenna()) << "\n"; + os << senf::fieldName("antenna") << unsigned( p->antenna()) << "\n"; if (p->has_dbAntennaSignal()) - os << " antenna signal (dB) : " << unsigned( p->dbAntennaSignal()) << "\n"; + os << senf::fieldName("antenna signal (dB)") << unsigned( p->dbAntennaSignal()) << "\n"; if (p->has_dbAntennaNoise()) - os << " antenna noise (dB) : " << unsigned( p->dbAntennaNoise()) << "\n"; + os << senf::fieldName("antenna noise (dB)") << unsigned( p->dbAntennaNoise()) << "\n"; if (p->has_headerFcs()) - os << " FCS : " << unsigned( p->fcs()) << "\n"; + os << senf::fieldName("FCS") << unsigned( p->fcs()) << "\n"; } prefix_ void senf::RadiotapPacketType::finalize(packet p) diff --git a/senf/Packets/80211Bundle/WLANPacket.cc b/senf/Packets/80211Bundle/WLANPacket.cc index 1eb13e9..ba4fafe 100644 --- a/senf/Packets/80211Bundle/WLANPacket.cc +++ b/senf/Packets/80211Bundle/WLANPacket.cc @@ -57,23 +57,23 @@ namespace { prefix_ void senf::WLANPacket_MgtFrameType::dump(packet p, std::ostream &os) { boost::io::ios_all_saver ias(os); - os << "802.11 MAC Mangement Frame:\n"; + os << "802.11 MAC Mangement Frame:\n"; dumpBase(p.parser(), os); - os << " destination : " << p->destinationAddress() << "\n" - << " source : " << p->sourceAddress() << "\n" - << " bss id : " << p->bssid() << "\n" - << " sequence number : " << p->sequenceNumber() << "\n" - << " fragment number : " << p->fragmentNumber() << "\n"; + os << senf::fieldName("destination") << p->destinationAddress() << "\n" + << senf::fieldName("source") << p->sourceAddress() << "\n" + << senf::fieldName("bss id") << p->bssid() << "\n" + << senf::fieldName("sequence number") << p->sequenceNumber() << "\n" + << senf::fieldName("fragment number") << p->fragmentNumber() << "\n"; } prefix_ void senf::WLANPacket_CtrlFrameType::dump(packet p, std::ostream &os) { boost::io::ios_all_saver ias(os); - os << "802.11 MAC Control Frame:\n"; + os << "802.11 MAC Control Frame:\n"; dumpBase(p.parser(), os); - os << " receiver : " << p->receiverAddress() << "\n"; + os << senf::fieldName("receiver") << p->receiverAddress() << "\n"; if (p->is_rts()) - os << " source : " << p->sourceAddress() << "\n"; + os << senf::fieldName("source") << p->sourceAddress() << "\n"; } prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::destinationAddress() @@ -113,22 +113,22 @@ prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::bssid() prefix_ void senf::WLANPacket_DataFrameType::dump(packet p, std::ostream &os) { boost::io::ios_all_saver ias(os); - os << "802.11 MAC Data Frame:\n"; + os << "802.11 MAC Data Frame:\n"; dumpBase(p.parser(), os); - os << " destination : " << p->destinationAddress(); + os << senf::fieldName("destination") << p->destinationAddress(); if (p->dsBits()==0 || p->dsBits()==2) os << " (receiver)"; - os << "\n" - << " source : " << p->sourceAddress(); + os << "\n" + << senf::fieldName("source") << p->sourceAddress(); if (p->dsBits()==0 || p->dsBits()==1) os << " (transmitter)"; - os << "\n" - << " bss id : " << p->bssid(); + os << "\n" + << senf::fieldName("bss id") << p->bssid(); if (p->dsBits()==1) os << " (receiver)"; else if (p->dsBits()!=0) os << " (transmitter)"; - os << "\n" - << " sequence number : " << p->sequenceNumber() << "\n" - << " fragment number : " << p->fragmentNumber() << "\n"; + os << "\n" + << senf::fieldName("sequence number") << p->sequenceNumber() << "\n" + << senf::fieldName("fragment number") << p->fragmentNumber() << "\n"; if (p->has_qosField()) - os << " QOS data : " << p->qosField() << "\n"; + os << senf::fieldName("QOS data") << p->qosField() << "\n"; } #undef prefix_ diff --git a/senf/Packets/80221Bundle/MIHPacket.cc b/senf/Packets/80221Bundle/MIHPacket.cc index cf7fb41..eb43bb6 100644 --- a/senf/Packets/80221Bundle/MIHPacket.cc +++ b/senf/Packets/80221Bundle/MIHPacket.cc @@ -105,29 +105,29 @@ prefix_ void senf::MIHPacketType::dump(packet p, std::ostream &os) { boost::io::ios_all_saver ias(os); os << "MIH Packet:\n" - << " protocol header:\n" - << " version : " << unsigned( p->version()) << "\n" - << " ack request : " << p->ackRequest() << "\n" - << " ack response : " << p->ackResponse() << "\n" - << " UIR : " << p->uir() << "\n" - << " more fragments : " << p->moreFragment() << "\n" - << " fragment number : " << p->fragmentNr() << "\n" - << " message ID (MID) : " << unsigned( p->messageId()) << "\n" - << " sid : " << unsigned( p->sid()) << "\n" - << " opcode : " << unsigned( p->opcode()) << "\n" - << " aid : " << unsigned( p->aid()) << "\n" - << " transaction id : " << unsigned( p->transactionId()) << "\n" - << " payload length : " << unsigned( p->payloadLength()) << "\n" - << " source MIHF_Id TLV :\n" - << " type : " << unsigned (p->src_mihfId().type()) << "\n" - << " length : " << unsigned (p->src_mihfId().length()) << "\n" - << " value :\n"; + << " protocol header:\n" + << senf::fieldName(" version") << unsigned( p->version()) << "\n" + << senf::fieldName(" ack request") << p->ackRequest() << "\n" + << senf::fieldName(" ack response") << p->ackResponse() << "\n" + << senf::fieldName(" UIR") << p->uir() << "\n" + << senf::fieldName(" more fragments") << p->moreFragment() << "\n" + << senf::fieldName(" fragment number") << p->fragmentNr() << "\n" + << senf::fieldName(" message ID (MID)") << unsigned( p->messageId()) << "\n" + << senf::fieldName(" sid") << unsigned( p->sid()) << "\n" + << senf::fieldName(" opcode") << unsigned( p->opcode()) << "\n" + << senf::fieldName(" aid") << unsigned( p->aid()) << "\n" + << senf::fieldName(" transaction id") << unsigned( p->transactionId()) << "\n" + << senf::fieldName(" payload length") << unsigned( p->payloadLength()) << "\n" + << " source MIHF_Id TLV:\n" + << senf::fieldName(" type") << unsigned (p->src_mihfId().type()) << "\n" + << senf::fieldName(" length") << unsigned (p->src_mihfId().length()) << "\n" + << " value:\n"; std::string src_mihfId (p->src_mihfId().asString()); hexdump(src_mihfId.begin(), src_mihfId.end(), os); - os << " destination MIHF_Id TLV:\n" - << " type : " << unsigned (p->dst_mihfId().type()) << "\n" - << " length : " << unsigned (p->dst_mihfId().length()) << "\n" - << " value :\n"; + os << " destination MIHF_Id TLV:\n" + << senf::fieldName(" type") << unsigned (p->dst_mihfId().type()) << "\n" + << senf::fieldName(" length") << unsigned (p->dst_mihfId().length()) << "\n" + << " value:\n"; std::string dst_mihfId (p->dst_mihfId().asString()); hexdump(dst_mihfId.begin(), dst_mihfId.end(), os); } diff --git a/senf/Packets/80221Bundle/TLVPacket.cc b/senf/Packets/80221Bundle/TLVPacket.cc index 56de029..b274676 100644 --- a/senf/Packets/80221Bundle/TLVPacket.cc +++ b/senf/Packets/80221Bundle/TLVPacket.cc @@ -146,7 +146,7 @@ prefix_ void senf::DynamicTLVLengthParser::finalize() if (b != 3) resize(3); return; } - if (v <= UInt24Parser::max_value + 128 ){ + if (v <= UInt24Parser::max_value + 128 ) { if (b != 4) resize(4); return; } @@ -210,9 +210,9 @@ prefix_ void senf::GenericTLVPacketType::dump(packet p, std::ostream & os) boost::io::ios_all_saver ias(os); os << "GenericTLVPacket:\n" << std::dec - << " type : " << unsigned( p->type()) << "\n" - << " length : " << unsigned( p->length()) << "\n" - << " value\n : "; + << senf::fieldName("type") << unsigned( p->type()) << "\n" + << senf::fieldName("length") << unsigned( p->length()) << "\n" + << " value:\n"; senf::hexdump( p->value().begin(), p->value().end(), os); } diff --git a/senf/Packets/DefaultBundle/EthernetPacket.cc b/senf/Packets/DefaultBundle/EthernetPacket.cc index 4e009d1..30e8e8d 100644 --- a/senf/Packets/DefaultBundle/EthernetPacket.cc +++ b/senf/Packets/DefaultBundle/EthernetPacket.cc @@ -51,10 +51,9 @@ prefix_ void senf::EthernetPacketType::dump(packet p, std::ostream & os) else os << "Ethernet 802.3 (bad ethertype >1500 and <1536)"; os << ": \n" - << " destination : " << p->destination() << "\n" - << " source : " << p->source() << "\n" - << " type/length : 0x" - << std::hex << std::setw(4) << std::setfill('0') << p->type_length() << "\n"; + << senf::fieldName("destination") << p->destination() << "\n" + << senf::fieldName("source") << p->source() << "\n" + << senf::fieldName("type/length") << senf::prettyNumber(p->type_length().value()) << "\n"; } prefix_ senf::PacketInterpreterBase::factory_t senf::EthernetPacketType::nextPacketType(packet p) @@ -80,12 +79,12 @@ prefix_ void senf::EthernetPacketType::finalize(packet p) prefix_ void senf::EthVLanPacketType::dump(packet p, std::ostream & os) { boost::io::ios_all_saver ias(os); - os << "Ethernet 802.1q (VLAN):\n" - << " priority : " << p->priority() << "\n" - << " cfi : " << p->cfi() << "\n" - << " vlan-ID : " << p->vlanId() << "\n" - << " ethertype : 0x" - << std::hex << std::setw(4) << std::setfill('0') << p->type() << "\n"; + os << "Ethernet 802.1q (VLAN):\n" + << senf::fieldName("priority") << p->priority() << "\n" + << senf::fieldName("cfi") << p->cfi() << "\n" + << senf::fieldName("vlan-ID") << p->vlanId() << "\n" + << senf::fieldName("ethertype") + << " 0x" << std::hex << std::setw(4) << std::setfill('0') << p->type() << "\n"; } prefix_ void senf::EthVLanPacketType::finalize(packet p) diff --git a/senf/Packets/DefaultBundle/ICMPv6Packet.cc b/senf/Packets/DefaultBundle/ICMPv6Packet.cc index 8023f3e..be0daf5 100644 --- a/senf/Packets/DefaultBundle/ICMPv6Packet.cc +++ b/senf/Packets/DefaultBundle/ICMPv6Packet.cc @@ -80,10 +80,10 @@ prefix_ void senf::ICMPv6PacketType::dump(packet p, std::ostream &os) { boost::io::ios_all_saver ias(os); os << "ICMPv6 protocol:\n" - << " type : " << unsigned(p->type()) <<"\n" - << " code : " << unsigned(p->code()) <<"\n" - << " checksum : 0x" - << std::hex << std::setw(4) << unsigned(p->checksum()) << "\n"; + << senf::fieldName("type") << unsigned(p->type()) <<"\n" + << senf::fieldName("code") << unsigned(p->code()) <<"\n" + << senf::fieldName("checksum") + << "0x" << std::hex << std::setw(4) << unsigned(p->checksum()) << "\n"; } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/senf/Packets/DefaultBundle/ICMPv6TypePacket.cc b/senf/Packets/DefaultBundle/ICMPv6TypePacket.cc index 282e8e8..e75612e 100644 --- a/senf/Packets/DefaultBundle/ICMPv6TypePacket.cc +++ b/senf/Packets/DefaultBundle/ICMPv6TypePacket.cc @@ -48,81 +48,83 @@ namespace { registerMLDv2ListenerReport (143); } -prefix_ void senf::ICMPv6EchoRequestType::dump(packet p, std::ostream & os){ +prefix_ void senf::ICMPv6EchoRequestType::dump(packet p, std::ostream & os) +{ os << "ICMPv6 Echo Request:\n" - <<" Identifier : " << unsigned(p->identifier() ) - <<"\n SequenceNumber : " << unsigned(p->seqNr() ) << "\n"; + << senf::fieldName("Identifier") << unsigned(p->identifier()) << "\n" + << senf::fieldName("SequenceNumber") << unsigned(p->seqNr() ) << "\n"; } -prefix_ void senf::ICMPv6EchoReplyType::dump(packet p, std::ostream & os){ +prefix_ void senf::ICMPv6EchoReplyType::dump(packet p, std::ostream & os) +{ os << "ICMPv6 Echo Reply:\n" - <<" Identifier : " << unsigned(p->identifier() ) - <<"\n SequenceNumber : " << unsigned(p->seqNr() ) << "\n"; + << senf::fieldName("Identifier") << unsigned(p->identifier()) << "\n" + << senf::fieldName("SequenceNumber") << unsigned(p->seqNr()) << "\n"; } -prefix_ void senf::ICMPv6ErrDestUnreachableType::dump(packet p, std::ostream & os){ +prefix_ void senf::ICMPv6ErrDestUnreachableType::dump(packet p, std::ostream & os) +{ os << "ICMPv6 Error Destination Unreachable (no further fields available here)\n"; } -prefix_ void senf::ICMPv6ErrTooBigType::dump(packet p, std::ostream & os){ +prefix_ void senf::ICMPv6ErrTooBigType::dump(packet p, std::ostream & os) +{ os << "ICMPv6 Error Packet Too Big:\n" - <<" MTU : " << unsigned(p->mtu() ) << "\n"; + << senf::fieldName("MTU") << unsigned(p->mtu() ) << "\n"; } -prefix_ void senf::ICMPv6ErrTimeExceededType::dump(packet p, std::ostream & os){ +prefix_ void senf::ICMPv6ErrTimeExceededType::dump(packet p, std::ostream & os) +{ os << "ICMPv6 Error Time Exceeded:\n" - <<" Unused(32Bit) : " << unsigned(p->unused() ) << "\n"; + << senf::fieldName("Unused(32Bit)") << unsigned(p->unused() ) << "\n"; } -prefix_ void senf::ICMPv6ErrParamProblemType::dump(packet p, std::ostream & os){ +prefix_ void senf::ICMPv6ErrParamProblemType::dump(packet p, std::ostream & os) +{ os << "ICMPv6 Error Parameter Problem:\n" - <<" Pointer : " << unsigned(p->pointer() ) << "\n"; + << senf::fieldName("Pointer") << unsigned(p->pointer() ) << "\n"; } -prefix_ void senf::MLDv2ListenerQueryType::dump(packet p, std::ostream & os){ +prefix_ void senf::MLDv2ListenerQueryType::dump(packet p, std::ostream & os) +{ os << "ICMPv6 Multicast Listener Query:\n" - <<" Max. ResponseCode : " << unsigned(p->maxResponseCode() ) - <<"\n Reserved(16Bit) : " << unsigned(p->reserved() ) - <<"\n Multicast Address : " << p->mcAddress() - <<"\n Reserver(4Bit) : " << unsigned(p->resv() ) - <<"\n Suppress Router-Side Processing: " << unsigned(p->sFlag() ) - <<"\n Querier's Robustness Variable: " << unsigned(p->qrv() ) - <<"\n Querier's Query Interval Code: " << unsigned(p->qqic() ) - <<"\n Source Addresses: " << "\n"; - senf::MLDv2ListenerQuery::Parser::srcAddresses_t::container c (p->srcAddresses() ); - senf::MLDv2ListenerQuery::Parser::srcAddresses_t::container::iterator i (c.begin() ); - for (unsigned int nr =1; i != c.end(); ++i, ++nr) - os << " " << nr << ".) " <<*i << "\n"; - os << "\n"; + << senf::fieldName("Max. ResponseCode") << unsigned(p->maxResponseCode()) << "\n" + << senf::fieldName("Reserved(16Bit)") << unsigned(p->reserved()) << "\n" + << senf::fieldName("Multicast Address") << p->mcAddress() << "\n" + << senf::fieldName("Reserver(4Bit)") << unsigned(p->resv()) << "\n" + << senf::fieldName("Suppress Router-Side Processing") << unsigned(p->sFlag()) << "\n" + << senf::fieldName("Querier's Robustness Variable") << unsigned(p->qrv()) << "\n" + << senf::fieldName("Querier's Query Interval Code") << unsigned(p->qqic()) << "\n" + << " Source Addresses:\n"; + senf::MLDv2ListenerQuery::Parser::srcAddresses_t::container c (p->srcAddresses()); + senf::MLDv2ListenerQuery::Parser::srcAddresses_t::container::iterator i (c.begin()); + for (unsigned int nr =1; i != c.end(); ++i, ++nr) + os << " " << nr << ".) " << *i << "\n"; + os << "\n"; } -prefix_ void senf::MLDv2ListenerReportType::dump(packet p, std::ostream & os){ +prefix_ void senf::MLDv2ListenerReportType::dump(packet p, std::ostream & os) +{ os << "ICMPv6 Multicast Listener Report Message:\n" - <<" Reserved : " << unsigned(p->reserved() ) - <<"\n Multicast Address Records:\n"; + << senf::fieldName("Reserved") << unsigned(p->reserved() ) + <<"\n Multicast Address Records:\n"; senf::MLDv2ListenerReport::Parser::mcastAddrRecords_t::container cAddrR (p->mcastAddrRecords() ); senf::MLDv2ListenerReport::Parser::mcastAddrRecords_t::container::iterator iAddrR (cAddrR.begin() ); - for (; iAddrR != cAddrR.end(); ++iAddrR){ - os << " Record Type : " << unsigned(iAddrR->recordType() ) - <<"\n Multicast Address : " << iAddrR->mcAddress() - <<"\n Source Addresses :\n"; - - senf::MLDv2AddressRecordParser::srcAddresses_t::container cSrcAddr (iAddrR->srcAddresses() ); - senf::MLDv2AddressRecordParser::srcAddresses_t::container::iterator iSrcAddr ( cSrcAddr.begin() ); + for (; iAddrR != cAddrR.end(); ++iAddrR) { + os << senf::fieldName(" Record Type") << unsigned(iAddrR->recordType()) << "\n" + << senf::fieldName(" Multicast Address") << iAddrR->mcAddress() << "\n" + << " Source Addresses\n:"; + senf::MLDv2AddressRecordParser::srcAddresses_t::container cSrcAddr (iAddrR->srcAddresses()); + senf::MLDv2AddressRecordParser::srcAddresses_t::container::iterator iSrcAddr (cSrcAddr.begin()); for (;iSrcAddr != cSrcAddr.end();++iSrcAddr) - os <<" " << *iSrcAddr << "\n"; - os << " Auxiliary Data :\n"; + os << " " << *iSrcAddr << "\n"; + os << " Auxiliary Data:\n"; senf::MLDv2AddressRecordParser::auxData_t::container cAuxD ( iAddrR->auxData() ); senf::MLDv2AddressRecordParser::auxData_t::container::iterator iAuxD (cAuxD.begin() ); for (;iAuxD != cAuxD.end(); ++iAuxD) - os <<" " << *iAuxD << "\n"; + os << " " << *iAuxD << "\n"; } } - - - - - -#undef prefix_ \ No newline at end of file +#undef prefix_ diff --git a/senf/Packets/DefaultBundle/ICMPv6TypePacket.hh b/senf/Packets/DefaultBundle/ICMPv6TypePacket.hh index 5e41f40..e1b1c02 100644 --- a/senf/Packets/DefaultBundle/ICMPv6TypePacket.hh +++ b/senf/Packets/DefaultBundle/ICMPv6TypePacket.hh @@ -224,7 +224,8 @@ namespace senf { SENF_PARSER_FIELD ( unused, UInt32Parser ); /* Code 0 - Hop limit exceeded in transit 1 - Fragment reassembly time exceeded */ - void setErrCode(int code){ + void setErrCode(int code) + { ICMPv6Packet icmpv6 (packet().rfind(senf::nothrow)); icmpv6->code() = code; } @@ -271,7 +272,8 @@ namespace senf { 1 - Unrecognized Next Header type encountered 2 - Unrecognized IPv6 option encountered */ - void setErrCode(int code){ + void setErrCode(int code) + { ICMPv6Packet icmpv6 (packet().rfind(senf::nothrow)); icmpv6->code() = code; } diff --git a/senf/Packets/DefaultBundle/IPv4Packet.cc b/senf/Packets/DefaultBundle/IPv4Packet.cc index 1cdab2e..5ef86f3 100644 --- a/senf/Packets/DefaultBundle/IPv4Packet.cc +++ b/senf/Packets/DefaultBundle/IPv4Packet.cc @@ -62,21 +62,21 @@ prefix_ boost::uint16_t senf::IPv4PacketParser::calcChecksum() prefix_ void senf::IPv4PacketType::dump(packet p, std::ostream & os) { boost::io::ios_all_saver ias(os); - os << "Internet protocol Version 4:\n" - << " version : " << p->version() << "\n" - << " ip header length : " << p->ihl() << "\n" - << " tos : " << unsigned(p->tos()) << "\n" - << " length : " << p->length() << "\n" - << " identifier : " << p->identifier() << "\n" - << " dont fragment : " << p->df() << "\n" - << " more fragments : " << p->mf() << "\n" - << " fragment : " << p->frag() << "\n" - << " ttl : " << unsigned(p->ttl()) << "\n" - << " protocol : " << unsigned(p->protocol()) << "\n" - << " checksum : 0x" - << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << std::dec << "\n" - << " source : " << p->source() << "\n" - << " destination : " << p->destination() << "\n"; + os << "Internet protocol Version 4:\n" + << senf::fieldName("version") << p->version() << "\n" + << senf::fieldName("ip header length") << p->ihl() << "\n" + << senf::fieldName("tos") << unsigned(p->tos()) << "\n" + << senf::fieldName("length") << p->length() << "\n" + << senf::fieldName("identifier") << p->identifier() << "\n" + << senf::fieldName("dont fragment") << p->df() << "\n" + << senf::fieldName("more fragments") << p->mf() << "\n" + << senf::fieldName("fragment") << p->frag() << "\n" + << senf::fieldName("ttl") << unsigned(p->ttl()) << "\n" + << senf::fieldName("protocol") << unsigned(p->protocol()) << "\n" + << senf::fieldName("checksum") + << "0x" << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << std::dec << "\n" + << senf::fieldName("source") << p->source() << "\n" + << senf::fieldName("destination") << p->destination() << "\n"; } prefix_ void senf::IPv4PacketType::finalize(packet p) diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.cc b/senf/Packets/DefaultBundle/IPv6Extensions.cc index 8a162b5..d033d44 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.cc +++ b/senf/Packets/DefaultBundle/IPv6Extensions.cc @@ -43,41 +43,43 @@ namespace { prefix_ void senf::IPv6FragmentPacketType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 fragment extension:\n" - << " next header : " << unsigned(p->nextHeader()) << "\n" - << " fragment offset : " << std::hex << unsigned(p->fragmentOffset()) << "\n" - << " more fragments : " << (p->moreFragments()?"yes":"no") << "\n" - << " id : " << std::hex << unsigned(p->id()) << "\n"; + << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n" + << senf::fieldName("fragment offset") + << "0x" << std::hex << unsigned(p->fragmentOffset()) << "\n" + << senf::fieldName("more fragments") << (p->moreFragments()?"yes":"no") << "\n" + << senf::fieldName("id") + << "0x" << std::hex << unsigned(p->id()) << "\n"; } prefix_ void senf::IPv6RoutingPacketType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 routing extension:\n" - << " next header : " << unsigned (p->nextHeader()) << "\n" - << " header length : " << unsigned (p->headerLength()) << "\n" - << " routing type : " << unsigned (p->routingType()) << "\n" - << " segments left : " << unsigned (p->segmentsLeft()) << "\n" - << " further Hop Addresses : \n"; + << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n" + << senf::fieldName("header length") << unsigned(p->headerLength()) << "\n" + << senf::fieldName("routing type") << unsigned(p->routingType()) << "\n" + << senf::fieldName("segments left") << unsigned(p->segmentsLeft()) << "\n" + << " further Hop Addresses:\n"; typedef IPv6RoutingPacket::Parser::hopAddresses_t::container addrContainer_t; addrContainer_t hopAddresses (p->hopAddresses()); if ( p->segmentsLeft() != 0 ) for (addrContainer_t::iterator i (hopAddresses.begin()); i != hopAddresses.end(); ++i) - os << *i << "\n"; + os << " " << *i << "\n"; } prefix_ void senf::IPv6HopByHopOptionsPacketType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 Hop-By-Hop extension:\n" - << " next header : " << unsigned (p->nextHeader()) << "\n" - << " header length : " << unsigned (p->headerLength()) << "\n"; - os << " OptionTypes:\n"; + << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n" + << senf::fieldName("header length") << unsigned(p->headerLength()) << "\n"; + os << " OptionTypes:\n"; typedef IPv6HopByHopOptionsPacket::Parser::options_t::container optContainer_t; optContainer_t options (p->options()); optContainer_t::iterator optIter(options.begin()); for(; optIter != options.end(); ++optIter) { - os << " AltAction : " << (unsigned) optIter->altAction() - << "\n ChangeFlag : " << (unsigned) optIter->changeFlag() - << "\n Option Type : " << (unsigned) optIter->optionType() - << "\n OptionLength : " << (unsigned) optIter->optionLength() <<"\n"; + os << senf::fieldName(" AltAction") << unsigned(optIter->altAction()) << "\n" + << senf::fieldName(" ChangeFlag") << unsigned(optIter->changeFlag()) << "\n" + << senf::fieldName(" Option Type") << unsigned(optIter->optionType()) << "\n" + << senf::fieldName(" OptionLength") << unsigned(optIter->optionLength()) <<"\n"; senf::hexdump(boost::begin(optIter->value()) , boost::end(optIter->value()), os ); } } @@ -85,8 +87,8 @@ prefix_ void senf::IPv6HopByHopOptionsPacketType::dump(packet p, std::ostream & prefix_ void senf::IPv6DestinationOptionsPacketType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 Destination Options extension:\n" - << " next header : " << unsigned (p->nextHeader()) << "\n" - << " header length : " << unsigned (p->headerLength()) << "\n"; + << senf::fieldName("next header") << unsigned (p->nextHeader()) << "\n" + << senf::fieldName("header length") << unsigned (p->headerLength()) << "\n"; } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/senf/Packets/DefaultBundle/IPv6Packet.cc b/senf/Packets/DefaultBundle/IPv6Packet.cc index 60f7929..2049b42 100644 --- a/senf/Packets/DefaultBundle/IPv6Packet.cc +++ b/senf/Packets/DefaultBundle/IPv6Packet.cc @@ -43,17 +43,17 @@ namespace { prefix_ void senf::IPv6PacketType::dump(packet p, std::ostream & os) { boost::io::ios_all_saver ias(os); - os << "Internet protocol Version 6:\n" - << " version : " << unsigned(p->version()) << "\n" - << " traffic class : 0x" - << std::hex << std::setw(2) << std::setfill('0') << unsigned(p->trafficClass()) << "\n" - << " flow label : 0x" - << std::hex << std::setw(5) << std::setfill('0') << unsigned(p->flowLabel()) << "\n" - << " payload length : " << std::dec << unsigned(p->length()) << "\n" - << " next header : " << unsigned(p->nextHeader()) << "\n" - << " hop limit : " << unsigned(p->hopLimit()) << "\n" - << " source : " << p->source() << "\n" - << " destination : " << p->destination() << "\n"; + os << "Internet protocol Version 6:\n" + << senf::fieldName("version") << unsigned(p->version()) << "\n" + << senf::fieldName("traffic class") + << "0x" << std::hex << std::setw(2) << std::setfill('0') << unsigned(p->trafficClass()) << "\n" + << senf::fieldName("flow label") + << "0x" << std::hex << std::setw(5) << std::setfill('0') << unsigned(p->flowLabel()) << "\n" + << senf::fieldName("payload length") << std::dec << unsigned(p->length()) << "\n" + << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n" + << senf::fieldName("hop limit") << unsigned(p->hopLimit()) << "\n" + << senf::fieldName("source") << p->source() << "\n" + << senf::fieldName("destination") << p->destination() << "\n"; } prefix_ void senf::IPv6PacketType::finalize(packet p) diff --git a/senf/Packets/DefaultBundle/LlcSnapPacket.cc b/senf/Packets/DefaultBundle/LlcSnapPacket.cc index ae14712..c3875ba 100644 --- a/senf/Packets/DefaultBundle/LlcSnapPacket.cc +++ b/senf/Packets/DefaultBundle/LlcSnapPacket.cc @@ -38,13 +38,13 @@ prefix_ void senf::LlcSnapPacketType::dump(packet p, std::ostream & os) boost::io::ios_all_saver ias(os); os << "LLC/SNAP:\n" << std::hex << std::setfill('0') - << " LLC\n" - << " dsap : 0x" << unsigned(p->dsap()) << "\n" - << " ssap : 0x" << unsigned(p->ssap()) << "\n" - << " control id : 0x" << unsigned(p->ctrl()) << "\n" - << " SNAP\n" - << " protocol id : 0x" << std::setw(6) << unsigned(p->protocolId()) << "\n" - << " type/length : 0x" << std::setw(4) << unsigned(p->type_length()) << "\n"; + << " LLC\n" + << senf::fieldName(" dsap") << "0x" << unsigned(p->dsap()) << "\n" + << senf::fieldName(" ssap") << "0x" << unsigned(p->ssap()) << "\n" + << senf::fieldName(" control id") << "0x" << unsigned(p->ctrl()) << "\n" + << " SNAP\n" + << senf::fieldName(" protocol id") << "0x" << std::setw(6) << unsigned(p->protocolId()) << "\n" + << senf::fieldName(" type/length") << "0x" << std::setw(4) << unsigned(p->type_length()) << "\n"; } prefix_ senf::PacketInterpreterBase::factory_t senf::LlcSnapPacketType::nextPacketType(packet p) diff --git a/senf/Packets/DefaultBundle/RTPPacket.cc b/senf/Packets/DefaultBundle/RTPPacket.cc index e69a298..b02e814 100644 --- a/senf/Packets/DefaultBundle/RTPPacket.cc +++ b/senf/Packets/DefaultBundle/RTPPacket.cc @@ -33,7 +33,8 @@ namespace { - std::string ptName(int pt){ + std::string ptName(int pt) + { struct pt_item { int pt; @@ -49,9 +50,9 @@ namespace {116,"32L16S"},{127,"HTML"},{-1,""} }; int n = 0; - while ( ptList[n].pt != -1) + while (ptList[n].pt != -1) { - if( ptList[n].pt == pt) + if (ptList[n].pt == pt) return ptList[n].name; ++n; } @@ -64,15 +65,15 @@ prefix_ void senf::RTPPacketType::dump(packet p, std::ostream &os) { boost::io::ios_all_saver ias(os); os << "Real Time Protocol:\n" - << " version : " << p->version() << "\n" - << " padding : " << p->padding() << "\n" - << " extension : " << p->extension() << "\n" - << " contributing source cnt : " << p->csrcCount() << "\n" - << " marker : " << p->marker() << "\n" - << " payload type : " << p->payloadType() << " "<< ptName(p->payloadType() ) <<"\n" - << " sequence number : " << p->seqNumber() << "\n" - << " timestamp : " << p->timeStamp() << "\n" - << " sync source id : " << p->synSourceId() << "\n"; + << senf::fieldName("version") << p->version() << "\n" + << senf::fieldName("padding") << p->padding() << "\n" + << senf::fieldName("extension") << p->extension() << "\n" + << senf::fieldName("contributing source cnt") << p->csrcCount() << "\n" + << senf::fieldName("marker") << p->marker() << "\n" + << senf::fieldName("payload type") << p->payloadType() << " "<< ptName(p->payloadType() ) <<"\n" + << senf::fieldName("sequence number") << p->seqNumber() << "\n" + << senf::fieldName("timestamp") << p->timeStamp() << "\n" + << senf::fieldName("sync source id") << p->synSourceId() << "\n"; } #undef prefix_ diff --git a/senf/Packets/DefaultBundle/TCPPacket.cc b/senf/Packets/DefaultBundle/TCPPacket.cc index 5af6c47..2fc62f1 100644 --- a/senf/Packets/DefaultBundle/TCPPacket.cc +++ b/senf/Packets/DefaultBundle/TCPPacket.cc @@ -113,21 +113,21 @@ prefix_ void senf::TCPPacketType::dump(packet p, std::ostream & os) { boost::io::ios_all_saver ias(os); os << "TCP:\n" - << " source port : " << p->source() << "\n" - << " destination port : " << p->destination() << "\n" - << " sequence number : " << p->sequencenumber() << "\n" - << " acknowledgment number : " << p->acknowledgmentnumber() << "\n" - << " data offset : " << p->dataoffset() << "\n" - << " urgent flag : " << p->urgf() << "\n" - << " ack flag : " << p->ackf() << "\n" - << " push flag : " << p->pshf() << "\n" - << " reset flag : " << p->rstf() << "\n" - << " syn flag : " << p->synf() << "\n" - << " fin flag : " << p->finf() << "\n" - << " window size : " << p->window() << "\n" - << " checksum : " - << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << "\n" - << " urgent pointer : " << p->urgentpointer() << "\n"; + << senf::fieldName("source port") << p->source() << "\n" + << senf::fieldName("destination port") << p->destination() << "\n" + << senf::fieldName("sequence number") << p->sequencenumber() << "\n" + << senf::fieldName("acknowledgment number") << p->acknowledgmentnumber() << "\n" + << senf::fieldName("data offset") << p->dataoffset() << "\n" + << senf::fieldName("urgent flag") << p->urgf() << "\n" + << senf::fieldName("ack flag") << p->ackf() << "\n" + << senf::fieldName("push flag") << p->pshf() << "\n" + << senf::fieldName("reset flag") << p->rstf() << "\n" + << senf::fieldName("syn flag") << p->synf() << "\n" + << senf::fieldName("fin flag") << p->finf() << "\n" + << senf::fieldName("window size") << p->window() << "\n" + << senf::fieldName("checksum") + << "0x" << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << "\n" + << senf::fieldName("urgent pointer") << p->urgentpointer() << "\n"; } prefix_ void senf::TCPPacketType::finalize(packet p) diff --git a/senf/Packets/DefaultBundle/UDPPacket.cc b/senf/Packets/DefaultBundle/UDPPacket.cc index 3c7980f..d1ff6c2 100644 --- a/senf/Packets/DefaultBundle/UDPPacket.cc +++ b/senf/Packets/DefaultBundle/UDPPacket.cc @@ -99,11 +99,11 @@ prefix_ void senf::UDPPacketType::dump(packet p, std::ostream & os) { boost::io::ios_all_saver ias(os); os << "UDP:\n" - << " source port : " << p->source() << "\n" - << " dest port : " << p->destination() << "\n" - << " length : " << p->length() << "\n" - << " checksum : " - << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << "\n"; + << senf::fieldName("source port") << p->source() << "\n" + << senf::fieldName("dest port") << p->destination() << "\n" + << senf::fieldName("length") << p->length() << "\n" + << senf::fieldName("checksum") + << "0x" << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << "\n"; } prefix_ void senf::UDPPacketType::finalize(packet p) diff --git a/senf/Packets/MPEGDVBBundle/DTCPPacket.cc b/senf/Packets/MPEGDVBBundle/DTCPPacket.cc index 1c9f08f..3f0ea63 100644 --- a/senf/Packets/MPEGDVBBundle/DTCPPacket.cc +++ b/senf/Packets/MPEGDVBBundle/DTCPPacket.cc @@ -40,15 +40,15 @@ prefix_ void senf::DTCPHelloPacketType::dump(packet p, std::ostream & os) "8", "9", "10", "11", "12", "13", "14", "15" }; boost::io::ios_all_saver ias(os); os << "DTCP HELLO Packet:" << std::endl - << " version : " << p->versionNumber() << std::endl - << " command : " << COMMANDS[p->command()] << std::endl - << " interval : " << unsigned(p->interval()) << std::endl - << " sequence number : " << p->sequenceNumber() << std::endl - << " receive capable feed : " << (p->receiveCapableFeed() ? "yes" : "no") << std::endl - << " ip version : " << p->ipVersion() << std::endl - << " tunnel protocol : " << unsigned(p->tunnelProtocol()) << std::endl - << " number of BDL ips : " << unsigned(p->fbipCount()) << std::endl - << " feed BDL ips : "; + << senf::fieldName("version") << p->versionNumber() << "\n" + << senf::fieldName("command") << COMMANDS[p->command()] << "\n" + << senf::fieldName("interval") << unsigned(p->interval()) << "\n" + << senf::fieldName("sequence number") << p->sequenceNumber() << "\n" + << senf::fieldName("receive capable feed") << (p->receiveCapableFeed() ? "yes" : "no") << "\n" + << senf::fieldName("ip version") << p->ipVersion() << "\n" + << senf::fieldName("tunnel protocol") << unsigned(p->tunnelProtocol()) << "\n" + << senf::fieldName("number of BDL ips") << unsigned(p->fbipCount()) << "\n" + << " feed BDL ips:\n"; switch (p->ipVersion()) { case 4 : { @@ -57,7 +57,7 @@ prefix_ void senf::DTCPHelloPacketType::dump(packet p, std::ostream & os) FBIPList::container::iterator i (fbips.begin()); FBIPList::container::iterator const i_end (fbips.end()); for (; i != i_end; ++i) - os << "\n " << *i; + os << " " << *i << "\n"; break; } case 6 : { @@ -66,14 +66,12 @@ prefix_ void senf::DTCPHelloPacketType::dump(packet p, std::ostream & os) FBIPList::container::iterator i (fbips.begin()); FBIPList::container::iterator const i_end (fbips.end()); for (; i != i_end; ++i) - os << "\n " << *i; + os << " " << *i << "\n"; break; } default: - os << "unknown ip version"; + os << " unknown ip version\n"; } - - os << std::endl; } #undef prefix_ diff --git a/senf/Packets/MPEGDVBBundle/DTCPPacket.test.cc b/senf/Packets/MPEGDVBBundle/DTCPPacket.test.cc index e13aad5..ac05aae 100644 --- a/senf/Packets/MPEGDVBBundle/DTCPPacket.test.cc +++ b/senf/Packets/MPEGDVBBundle/DTCPPacket.test.cc @@ -82,7 +82,7 @@ BOOST_AUTO_UNIT_TEST(dtcpPacket) " ip version : 4\n" " tunnel protocol : 23\n" " number of BDL ips : 2\n" - " feed BDL ips : \n" + " feed BDL ips:\n" " 101.102.103.104\n" " 201.202.203.204\n" ); diff --git a/senf/Packets/MPEGDVBBundle/GREPacket.cc b/senf/Packets/MPEGDVBBundle/GREPacket.cc index 971bc58..3e9ef7f 100644 --- a/senf/Packets/MPEGDVBBundle/GREPacket.cc +++ b/senf/Packets/MPEGDVBBundle/GREPacket.cc @@ -41,9 +41,8 @@ prefix_ void senf::GREPacketType::dump(packet p, std::ostream & os) { boost::io::ios_all_saver ias(os); os << "GRE Encapsulation:\n" - << " checksum_present : " << p->checksum_present() << "\n" - << " protocol_type : 0x" << std::hex << p->protocol_type() << "\n" - ; + << senf::fieldName("checksum_present") << p->checksum_present() << "\n" + << senf::fieldName("protocol_type") << "0x" << std::hex << p->protocol_type() << "\n"; } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/senf/Packets/MPEGDVBBundle/MPESection.cc b/senf/Packets/MPEGDVBBundle/MPESection.cc index 44b4cf6..e660894 100644 --- a/senf/Packets/MPEGDVBBundle/MPESection.cc +++ b/senf/Packets/MPEGDVBBundle/MPESection.cc @@ -52,27 +52,27 @@ prefix_ void senf::MPESectionType::dump(packet p, std::ostream & os) boost::io::ios_all_saver ias(os); os << "MPE Section:\n" << std::hex - << " table_id : 0x" << unsigned(p->table_id()) << "\n" - << " section syntax indicator: " << p->section_syntax_indicator() << "\n" - << " private indicator : " << p->private_indicator() << "\n" + << senf::fieldName("table_id") << "0x" << unsigned(p->table_id()) << "\n" + << senf::fieldName("section syntax indicator") << p->section_syntax_indicator() << "\n" + << senf::fieldName("private indicator") << p->private_indicator() << "\n" << std::dec - << " section length : " << p->section_length() << "\n" + << senf::fieldName("section length") << p->section_length() << "\n" << std::hex - << " MAC address 6 : 0x" << unsigned(p->mac_addr_6()) << "\n" - << " MAC address 5 : 0x" << unsigned(p->mac_addr_5()) << "\n" - << " payload scrambling ctrl : 0x" << p->payload_scrmbl_ctrl() << "\n" - << " address scrambling ctrl : 0x" << p-> addr_scrmbl_ctrl() << "\n" - << " LLC/SNAP flag : 0x" << p->llc_snap_flag() << "\n" - << " current next indicator : 0x" << p->curr_next_indicator() << "\n" - << " section number : 0x" << unsigned(p->section_num()) << "\n" - << " last section number : 0x" << unsigned(p->last_section_num()) << "\n" - << " real time parameters : \n" - << " delta_t : 0x" << unsigned(p->real_time_parameters().delta_t()) << "\n" - << " table boundary : 0x" << unsigned(p->real_time_parameters().table_boundary()) << "\n" - << " frame boundary : 0x" << unsigned(p->real_time_parameters().frame_boundary()) << "\n" - << " address : 0x" << unsigned(p->real_time_parameters().address()) << "\n" + << senf::fieldName("MAC address 6") << "0x" << unsigned(p->mac_addr_6()) << "\n" + << senf::fieldName("MAC address 5") << "0x" << unsigned(p->mac_addr_5()) << "\n" + << senf::fieldName("payload scrambling ctrl") << "0x" << p->payload_scrmbl_ctrl() << "\n" + << senf::fieldName("address scrambling ctrl") << "0x" << p-> addr_scrmbl_ctrl() << "\n" + << senf::fieldName("LLC/SNAP flag") << "0x" << p->llc_snap_flag() << "\n" + << senf::fieldName("current next indicator") << "0x" << p->curr_next_indicator() << "\n" + << senf::fieldName("section number") << "0x" << unsigned(p->section_num()) << "\n" + << senf::fieldName("last section number") << "0x" << unsigned(p->last_section_num()) << "\n" + << senf::fieldName("real time parameters") << "\n" + << senf::fieldName(" delta_t") << "0x" << unsigned(p->real_time_parameters().delta_t()) << "\n" + << senf::fieldName(" table boundary") << "0x" << unsigned(p->real_time_parameters().table_boundary()) << "\n" + << senf::fieldName(" frame boundary") << "0x" << unsigned(p->real_time_parameters().frame_boundary()) << "\n" + << senf::fieldName(" address") << "0x" << unsigned(p->real_time_parameters().address()) << "\n" << std::dec - << " crc : " << unsigned(p->crc()) << "\n"; + << senf::fieldName("crc") << unsigned(p->crc()) << "\n"; } prefix_ senf::PacketParserBase::size_type senf::MPESectionType::initSize() diff --git a/senf/Packets/MPEGDVBBundle/SNDUPacket.cc b/senf/Packets/MPEGDVBBundle/SNDUPacket.cc index a034f7b..c56d5a1 100644 --- a/senf/Packets/MPEGDVBBundle/SNDUPacket.cc +++ b/senf/Packets/MPEGDVBBundle/SNDUPacket.cc @@ -90,12 +90,12 @@ prefix_ void senf::SNDUPacketType::dump(packet p, std::ostream & os) { os << "SNDUPacket:\n" << std::dec - << " d_bit : " << p->d_bit() << "\n" - << " length : " << unsigned(p->length()) << "\n" + << senf::fieldName("d_bit") << p->d_bit() << "\n" + << senf::fieldName("length") << unsigned(p->length()) << "\n" << std::hex - << " type : 0x" << unsigned(p->type()) << "\n" + << senf::fieldName("type") << "0x" << unsigned(p->type()) << "\n" << std::dec - << " crc : " << unsigned(p->crc()) << "\n"; + << senf::fieldName("crc") << unsigned(p->crc()) << "\n"; } prefix_ senf::PacketParserBase::size_type senf::SNDUPacketType::initSize() diff --git a/senf/Packets/MPEGDVBBundle/TransportPacket.cc b/senf/Packets/MPEGDVBBundle/TransportPacket.cc index 514d95f..7ea59df 100644 --- a/senf/Packets/MPEGDVBBundle/TransportPacket.cc +++ b/senf/Packets/MPEGDVBBundle/TransportPacket.cc @@ -60,18 +60,18 @@ prefix_ void senf::TransportPacketType::dump(packet p, std::ostream & os) boost::io::ios_all_saver ias(os); os << "TransportPacket:\n" << std::hex - << " syncByte : 0x" << unsigned(p->sync_byte()) << "\n" - << " transport error ind. : 0x" << unsigned(p->transport_error_indicator()) << "\n" - << " payload unit start ind. : 0x" << unsigned(p->pusi()) << "\n" - << " transport priority : 0x" << unsigned(p->transport_priority()) << "\n" + << senf::fieldName("syncByte") << "0x" << unsigned(p->sync_byte()) << "\n" + << senf::fieldName("transport error ind.") << "0x" << unsigned(p->transport_error_indicator()) << "\n" + << senf::fieldName("payload unit start ind.") << "0x" << unsigned(p->pusi()) << "\n" + << senf::fieldName("transport priority") << "0x" << unsigned(p->transport_priority()) << "\n" << std::dec - << " pid : " << unsigned(p->pid()) << "\n" + << senf::fieldName("pid") << unsigned(p->pid()) << "\n" << std::hex - << " transport scrambling c. : 0x" << unsigned(p->transport_scrmbl_ctrl()) << "\n" - << " adaptation field ctrl : 0x" << unsigned(p->adaptation_field_ctrl()) << "\n" - << " continuity counter : 0x" << unsigned(p->continuity_counter()) << "\n"; + << senf::fieldName("transport scrambling c.") << "0x" << unsigned(p->transport_scrmbl_ctrl()) << "\n" + << senf::fieldName("adaptation field ctrl") << "0x" << unsigned(p->adaptation_field_ctrl()) << "\n" + << senf::fieldName("continuity counter") << "0x" << unsigned(p->continuity_counter()) << "\n"; if (p->pusi()) - os << " pointer field : 0x" << unsigned(p->pointer_field()) << "\n"; + os << senf::fieldName("pointer field") << "0x" << unsigned(p->pointer_field()) << "\n"; } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/senf/Packets/PacketData.hh b/senf/Packets/PacketData.hh index 9af6643..0860062 100644 --- a/senf/Packets/PacketData.hh +++ b/senf/Packets/PacketData.hh @@ -163,7 +163,7 @@ namespace senf { byte. If the packet has been implemented correctly, this signals a malformed packet. */ struct TruncatedPacketException : public senf::Exception - { TruncatedPacketException() : senf::Exception("truncated packet"){} }; + { TruncatedPacketException() : senf::Exception("truncated packet") {} }; } diff --git a/senf/Packets/PacketInterpreter.hh b/senf/Packets/PacketInterpreter.hh index 5747c94..e2591cf 100644 --- a/senf/Packets/PacketInterpreter.hh +++ b/senf/Packets/PacketInterpreter.hh @@ -379,7 +379,7 @@ namespace senf { chain member and other similar error conditions. */ struct InvalidPacketChainException : public senf::Exception - { InvalidPacketChainException() : senf::Exception("invalid packet chain"){} }; + { InvalidPacketChainException() : senf::Exception("invalid packet chain") {} }; } diff --git a/senf/Packets/PacketRegistry.hh b/senf/Packets/PacketRegistry.hh index 19c70d5..57d13a0 100644 --- a/senf/Packets/PacketRegistry.hh +++ b/senf/Packets/PacketRegistry.hh @@ -222,7 +222,7 @@ namespace senf { This exception is signaled whenever a throwing lookup operation fails. */ struct PacketTypeNotRegisteredException : public senf::Exception - { PacketTypeNotRegisteredException() : senf::Exception("packet type not registered"){} }; + { PacketTypeNotRegisteredException() : senf::Exception("packet type not registered") {} }; } diff --git a/senf/Socket/Protocols/DVB/DVBConfigParser.cc b/senf/Socket/Protocols/DVB/DVBConfigParser.cc index c0c6c14..1521c34 100644 --- a/senf/Socket/Protocols/DVB/DVBConfigParser.cc +++ b/senf/Socket/Protocols/DVB/DVBConfigParser.cc @@ -62,7 +62,9 @@ senf::DVBConfigParser::~DVBConfigParser() { configFile.close(); } -prefix_ void senf::DVBConfigParser::initConfigFile(string configFilePath_){ + +prefix_ void senf::DVBConfigParser::initConfigFile(string configFilePath_) +{ if (configFilePath_.size() == 0) { if ( !(::getenv ("HOME")) ) SENF_THROW_SYSTEM_EXCEPTION("$HOME not set! You need it to use default configfile."); @@ -84,7 +86,7 @@ prefix_ void senf::DVBConfigParser::initConfigFile(string configFilePath_){ } configFilePath = configFilePath_; configFile.open( configFilePath.c_str(), ios_base::in); - if(configFile.bad()) + if (configFile.bad()) SENF_LOG((senf::log::IMPORTANT) ("Could not open channels file"<< configFilePath << "." )); configFile.close(); } @@ -95,16 +97,16 @@ prefix_ string senf::DVBConfigParser::getConfigLine(string channel) transform(channel.begin(), channel.end(), channel.begin(), ::toupper); configFile.open( configFilePath.c_str(), ios_base::in); - if(configFile.bad()) + if (configFile.bad()) SENF_THROW_SYSTEM_EXCEPTION("Could not read channels file: ") << configFilePath << "."; - while (configFile.good()){ + while (configFile.good()) { getline( configFile, configLine ); SENF_LOG((senf::log::NOTICE) ("configLine: " << configLine )); transform(configLine.begin(), configLine.end(), configLine.begin(), ::toupper); pos = configLine.find(channel); - if(pos != string::npos && pos == 0){ // only first matching number should be interpreted as channel number + if (pos != string::npos && pos == 0) { // only first matching number should be interpreted as channel number configFile.close(); return configLine; // Line found! } @@ -114,7 +116,8 @@ prefix_ string senf::DVBConfigParser::getConfigLine(string channel) return channel; } -prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParam(string configLine){ +prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParam(string configLine) +{ struct dvb_frontend_parameters frontend; transform(configLine.begin(), configLine.end(), configLine.begin(), ::toupper); boost::char_separator sep(":"); @@ -135,8 +138,9 @@ prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParam(string c return frontend; } -prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParamDVB_T( const tokenizer & tokens){ - +prefix_ dvb_frontend_parameters +senf::DVBConfigParser::getFrontendParamDVB_T(const tokenizer & tokens) +{ struct dvb_frontend_parameters frontend; istringstream isst; int number; @@ -145,51 +149,53 @@ prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParamDVB_T( co ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); - /*if(words.size() < 10) + /*if (words.size() < 10) SENF_THROW_SYSTEM_EXCEPTION("Too few arguments! There must be at least 10, but there are only: ") << words.size();*/ isst.str(words[p_Frequency]); isst >> number; - if(isst.fail()) + if (isst.fail()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse frequency"); frontend.frequency = number; - if( params.inversion.find(words[p_Inversion]) == params.inversion.end()) + if (params.inversion.find(words[p_Inversion]) == params.inversion.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse inversion"); frontend.inversion = params.inversion.find(words[p_Inversion])->second; - if( params.bandwidth.find(words[p_Bandwidth]) == params.bandwidth.end()) + if (params.bandwidth.find(words[p_Bandwidth]) == params.bandwidth.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse bandwidth"); frontend.u.ofdm.bandwidth = params.bandwidth.find(words[p_Bandwidth])->second; - if( params.code_rate.find(words[p_hp_code_rate]) == params.code_rate.end()) + if (params.code_rate.find(words[p_hp_code_rate]) == params.code_rate.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse high priority stream code rate"); frontend.u.ofdm.code_rate_HP = params.code_rate.find(words[p_hp_code_rate])->second; - if( params.code_rate.find(words[p_lp_code_rate]) == params.code_rate.end()) + if (params.code_rate.find(words[p_lp_code_rate]) == params.code_rate.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse low priority stream code rate"); frontend.u.ofdm.code_rate_LP = params.code_rate.find(words[p_lp_code_rate])->second; - if( params.modulation.find(words[p_Mudualtion]) == params.modulation.end()) + if (params.modulation.find(words[p_Mudualtion]) == params.modulation.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse modulation"); frontend.u.ofdm.constellation = params.modulation.find(words[p_Mudualtion])->second; - if( params.transmit_mode.find(words[p_Transmission]) == params.transmit_mode.end()) + if (params.transmit_mode.find(words[p_Transmission]) == params.transmit_mode.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse transmission mode"); frontend.u.ofdm.transmission_mode = params.transmit_mode.find(words[p_Transmission])->second; - if( params.guard_interval.find(words[p_guard]) == params.guard_interval.end()) + if (params.guard_interval.find(words[p_guard]) == params.guard_interval.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse guard interval"); frontend.u.ofdm.guard_interval = params.guard_interval.find(words[p_guard])->second; - if( params.hierarchy.find(words[p_hierarchy]) == params.hierarchy.end()) + if (params.hierarchy.find(words[p_hierarchy]) == params.hierarchy.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse hierarchy"); frontend.u.ofdm.hierarchy_information = params.hierarchy.find(words[p_hierarchy])->second; return frontend; } -prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParamDVB_S( const tokenizer & tokens){ +prefix_ dvb_frontend_parameters +senf::DVBConfigParser::getFrontendParamDVB_S(const tokenizer & tokens) +{ struct dvb_frontend_parameters frontend; istringstream isst; int number; @@ -198,7 +204,7 @@ prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParamDVB_S( co ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); - if(words.size() < 5) + if (words.size() < 5) SENF_THROW_SYSTEM_EXCEPTION("Too few arguments! There must be at least 5, but there are only: ") << words.size(); isst.str(words[p_Frequency]); @@ -224,7 +230,9 @@ prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParamDVB_S( co return frontend; } -prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParamDVB_C( const tokenizer & tokens){ +prefix_ dvb_frontend_parameters +senf::DVBConfigParser::getFrontendParamDVB_C(const tokenizer & tokens) +{ struct dvb_frontend_parameters frontend; istringstream isst; int number; @@ -233,7 +241,7 @@ prefix_ dvb_frontend_parameters senf::DVBConfigParser::getFrontendParamDVB_C( co ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); - if(words.size() < 6) + if (words.size() < 6) SENF_THROW_SYSTEM_EXCEPTION("Too few arguments! There must be at least 6, but there are only: ") << words.size(); isst.str(words[p_Frequency]); diff --git a/senf/Socket/Protocols/DVB/DVBDemuxHandles.cc b/senf/Socket/Protocols/DVB/DVBDemuxHandles.cc index a7e92e9..e1a769f 100644 --- a/senf/Socket/Protocols/DVB/DVBDemuxHandles.cc +++ b/senf/Socket/Protocols/DVB/DVBDemuxHandles.cc @@ -46,7 +46,7 @@ prefix_ void senf::DVBDemuxSectionSocketProtocol::init_client(unsigned short ada { std::string devDemux = str( boost::format("/dev/dvb/adapter%d/demux%d") % adapter % device); int f = open(devDemux.c_str(), O_RDONLY | O_NONBLOCK); - if (f < 0){ + if (f < 0) { SENF_THROW_SYSTEM_EXCEPTION("Could not open demux device of DVB adapter ") << devDemux << "."; } fd(f); diff --git a/senf/Socket/Protocols/DVB/DVBDemuxHandles.hh b/senf/Socket/Protocols/DVB/DVBDemuxHandles.hh index fbf67d1..7de18e8 100644 --- a/senf/Socket/Protocols/DVB/DVBDemuxHandles.hh +++ b/senf/Socket/Protocols/DVB/DVBDemuxHandles.hh @@ -56,8 +56,8 @@ namespace senf { */ class DVBProtocolWrapper :public boost::enable_shared_from_this { public: - DVBProtocolWrapper(){} - virtual ~DVBProtocolWrapper(){} + DVBProtocolWrapper() {} + virtual ~DVBProtocolWrapper() {} }; /** \brief Baseclass for DVBSocketProtocols which want use Wrappers for console. */ @@ -73,7 +73,8 @@ public: { wrap_ = wrap; } - virtual void close(){ + virtual void close() + { wrap_.reset(); SocketProtocol::close(); diff --git a/senf/Socket/Protocols/DVB/DVBFrontendHandle.cc b/senf/Socket/Protocols/DVB/DVBFrontendHandle.cc index 5194f6c..7d6edf5 100644 --- a/senf/Socket/Protocols/DVB/DVBFrontendHandle.cc +++ b/senf/Socket/Protocols/DVB/DVBFrontendHandle.cc @@ -155,7 +155,7 @@ const prefix_ void senf::DVBFrontendSocketProtocol::setNonBlock(bool on) const { - if(on) + if (on) ::fcntl(fd(), F_SETFL, ::fcntl(fd(), F_GETFL) | O_NONBLOCK); else ::fcntl(fd(), F_SETFL, ::fcntl(fd(), F_GETFL) & ~O_NONBLOCK); @@ -167,7 +167,7 @@ prefix_ dvb_frontend_info senf::DVBFrontendSocketProtocol::getInfo() struct dvb_frontend_info info; ::memset(&info, 0, sizeof(struct dvb_frontend_info)); - if( ::ioctl(fd(), FE_GET_INFO, &info) ) { + if (::ioctl(fd(), FE_GET_INFO, &info)) { SENF_THROW_SYSTEM_EXCEPTION("") << "Could not read on fildescriptor."; } return info; @@ -178,7 +178,7 @@ prefix_ dvb_frontend_parameters senf::DVBFrontendSocketProtocol::getFrontendPara ::memset(&frontend_, 0, sizeof(struct dvb_frontend_parameters)); - if(::ioctl(fd(), FE_GET_FRONTEND, &frontend_)) { + if (::ioctl(fd(), FE_GET_FRONTEND, &frontend_)) { switch(errno) { case EBADF: SENF_THROW_SYSTEM_EXCEPTION("fd is not a valid open file descriptor."); @@ -201,7 +201,7 @@ prefix_ dvb_frontend_event senf::DVBFrontendSocketProtocol::getEvent() const{ ::memset(&ev, 0, sizeof(struct dvb_frontend_event)); - if(::ioctl(fd(), FE_GET_EVENT, &ev)) { + if (::ioctl(fd(), FE_GET_EVENT, &ev)) { switch(errno) { case EBADF: SENF_THROW_SYSTEM_EXCEPTION("Could not read from frontend device, read-only access to the device is sufficient."); diff --git a/senf/Socket/Protocols/DVB/DVBSocketController.cc b/senf/Socket/Protocols/DVB/DVBSocketController.cc index 9a6e48b..a24d566 100644 --- a/senf/Socket/Protocols/DVB/DVBSocketController.cc +++ b/senf/Socket/Protocols/DVB/DVBSocketController.cc @@ -53,32 +53,40 @@ senf::DVBSocketController::DVBSocketController(DVBFrontendHandle frontendHandle_ } prefix_ senf::DVBSocketController::~DVBSocketController() -{ -} +{} -prefix_ senf::DVBDemuxSectionHandle senf::DVBSocketController::createDVBDemuxSectionHandle( int adapternumber, int demuxnumber, bool addToConsole ){ +prefix_ senf::DVBDemuxSectionHandle +senf::DVBSocketController::createDVBDemuxSectionHandle(int adapternumber, int demuxnumber, + bool addToConsole) +{ DVBDemuxSectionHandle sectionHandle(adapternumber, demuxnumber); - if(addToConsole) + if (addToConsole) this->addToConsole(sectionHandle); return sectionHandle; } -prefix_ senf::DVBDemuxPESHandle senf::DVBSocketController::createDVBDemuxPESHandle( int adapternumber, int demuxnumber, bool addToConsole ){ +prefix_ senf::DVBDemuxPESHandle +senf::DVBSocketController::createDVBDemuxPESHandle(int adapternumber, int demuxnumber, + bool addToConsole) +{ DVBDemuxPESHandle pesHandle(adapternumber, demuxnumber); - if(addToConsole ) + if (addToConsole) this->addToConsole(pesHandle); return pesHandle; } -prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxSectionHandle sh){ +prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxSectionHandle sh) +{ boost::shared_ptr wrap(new DVBSectionProtocolWrapper(sh)); sh.protocol().addWrapper(wrap); dir.node().add("section" + senf::str(sectionNr), wrap->dir); sectionNr++; } -prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxPESHandle sh){ + +prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxPESHandle sh) +{ boost::shared_ptr wrap(new DVBPESProtocolWrapper(sh)); sh.protocol().addWrapper(wrap); dir.node().add("pes"+ senf::str(pesNr), wrap->dir); @@ -90,7 +98,8 @@ prefix_ void senf::DVBSocketController::tuneToCMD(const string & input, const st struct dvb_frontend_parameters frontend; // no valid configline, so it will be treaten like a channel name - if (input.find(":")==string::npos){ + if (input.find(":")==string::npos) + { if (mode.c_str()[0]=='a') tuneTo(input); else @@ -100,7 +109,7 @@ prefix_ void senf::DVBSocketController::tuneToCMD(const string & input, const st // add psydo name "foo" to complete configline syntax frontend = parser.getFrontendParam("foo:"+input); - if (mode.c_str()[0]=='a'){ + if (mode.c_str()[0]=='a') { switch (type) { case FE_QPSK: tuneDVB_S(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, frontend.u.qpsk.fec_inner); @@ -165,7 +174,7 @@ prefix_ void senf::DVBSocketController::tuneDVB_T(unsigned int frequency, fe_hierarchy_t hierarchy_information ) { - if(type != FE_OFDM) + if (type != FE_OFDM) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-T Card!"; event.enable(); @@ -184,7 +193,7 @@ prefix_ void senf::DVBSocketController::tuneDVB_T(unsigned int frequency, prefix_ void senf::DVBSocketController::tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate) { - if(type != FE_QPSK) + if (type != FE_QPSK) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-S Card!"; event.enable(); @@ -200,7 +209,7 @@ prefix_ void senf::DVBSocketController::tuneDVB_C(unsigned int frequency, fe_modulation_t modulation ) { - if(type != FE_QAM) + if (type != FE_QAM) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-C Card!"; event.enable(); @@ -244,7 +253,7 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_T_sync(unsigned in fe_hierarchy_t hierarchy_information ) { - if(type != FE_OFDM) + if (type != FE_OFDM) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-T Card!"; event.disable(); @@ -261,14 +270,18 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_T_sync(unsigned in guard_interval, hierarchy_information); - if(!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) + if (!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) SENF_THROW_SYSTEM_EXCEPTION("Could not tune to channel!"); return frontendHandle.protocol().getEvent(); } -prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_S_sync(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate){ - if(type != FE_QPSK) +prefix_ dvb_frontend_event +senf::DVBSocketController::tuneDVB_S_sync(unsigned int frequency, + fe_spectral_inversion_t inversion, + unsigned int symbole_rate, fe_code_rate_t code_rate) +{ + if (type != FE_QPSK) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-S Card!"; event.disable(); @@ -277,7 +290,7 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_S_sync(unsigned in frontendHandle.protocol().tuneDVB_S(frequency, inversion, symbole_rate, code_rate); - if(!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) + if (!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) SENF_THROW_SYSTEM_EXCEPTION("Could not tune to channel!"); return frontendHandle.protocol().getEvent(); } @@ -289,7 +302,7 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_C_sync(unsigned in fe_modulation_t modulation ) { - if(type != FE_QAM) + if (type != FE_QAM) SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-C Card!"; event.disable(); @@ -297,7 +310,7 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_C_sync(unsigned in frontendHandle.protocol().setNonBlock(false); frontendHandle.protocol().tuneDVB_C(frequency, inversion, symbol_rate, fec_inner, modulation); - if(!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) + if (!frontendHandle.waitOOBReadable(senf::ClockService::seconds(2))) SENF_THROW_SYSTEM_EXCEPTION("Could not tune to channel!"); return frontendHandle.protocol().getEvent(); @@ -350,10 +363,10 @@ prefix_ string senf::DVBSocketController::getTuneInfo(const string & conf) info << hex; - for(unsigned int i = 0; i < conf.size(); ++i){ - if(i>0) + for (unsigned int i = 0; i < conf.size(); ++i) { + if (i>0) info << " | "; - switch(cConf[i]){ + switch (cConf[i]) { case 'S' : info << "signal " << signal; break; @@ -406,7 +419,7 @@ prefix_ fe_type_t senf::DVBSocketController::getType() prefix_ void senf::DVBSocketController::readEvent(int event) { - if(cb) + if (cb) cb(frontendHandle.protocol().getEvent()); } diff --git a/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.cc b/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.cc index c332605..1fa7222 100644 --- a/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.cc +++ b/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.cc @@ -83,7 +83,7 @@ senf::ConnectedRawV6SocketProtocol::init_client(int const & protocol, INet6Socke const { init_client(protocol); - if(address.boolean_test()) { + if (address.boolean_test()) { //only connect if socket is not [::]:0, this results in an irreversible binding to the lo interface (linux 2.6.15) clientHandle().connect(address); } diff --git a/senf/Socket/Protocols/UN/UNDatagramSocketHandle.test.cc b/senf/Socket/Protocols/UN/UNDatagramSocketHandle.test.cc index 1db514b..c50c64c 100644 --- a/senf/Socket/Protocols/UN/UNDatagramSocketHandle.test.cc +++ b/senf/Socket/Protocols/UN/UNDatagramSocketHandle.test.cc @@ -62,7 +62,7 @@ BOOST_AUTO_UNIT_TEST(unDatagramSocketHandle) BOOST_CHECKPOINT( 7 ); inputSocket.close(); -// if( unlink(socketPath.c_str()) != 0) +// if (unlink(socketPath.c_str()) != 0) // perror( "unlink failed"); } diff --git a/senf/Utils/Console/ParsedCommand.test.cc b/senf/Utils/Console/ParsedCommand.test.cc index 31f8cee..0f23fc1 100644 --- a/senf/Utils/Console/ParsedCommand.test.cc +++ b/senf/Utils/Console/ParsedCommand.test.cc @@ -43,7 +43,7 @@ namespace { int cb1(int a, double b) { return int(a+b); } - double cb2(){ return 1.2; } + double cb2() { return 1.2; } void cb3(int i) { } std::string cb4(std::ostream & os) { os << "text\n"; return "value"; } void cb5(std::ostream & os, std::string const & v) { os << "Value: " << v << "\n"; } diff --git a/senf/Utils/Logger/Target.cc b/senf/Utils/Logger/Target.cc index e60080b..7989818 100644 --- a/senf/Utils/Logger/Target.cc +++ b/senf/Utils/Logger/Target.cc @@ -492,8 +492,8 @@ senf::log::detail::LogParameters::defaultParameters() prefix_ std::ostream & senf::log::operator<<(std::ostream & os, senf::log::Target::action_t const & action) { - if( action == Target::ACCEPT) os << "ACCEPT"; - else if( action == Target::REJECT) os << "REJECT"; + if (action == Target::ACCEPT) os << "ACCEPT"; + else if (action == Target::REJECT) os << "REJECT"; else os << "unknown action"; return os; } diff --git a/senf/Utils/Logger/Target.hh b/senf/Utils/Logger/Target.hh index 23f3ff2..6de29a6 100644 --- a/senf/Utils/Logger/Target.hh +++ b/senf/Utils/Logger/Target.hh @@ -340,12 +340,12 @@ namespace log { /** \brief Exception: Invalid stream */ struct InvalidStreamException : public senf::Exception { InvalidStreamException() - : senf::Exception("senf::log::Target::InvalidStreamException"){} }; + : senf::Exception("senf::log::Target::InvalidStreamException") {} }; /** \brief Exception: Invalid area */ struct InvalidAreaException : public senf::Exception { InvalidAreaException() - : senf::Exception("senf::log::Target::InvalidAreaException"){} }; + : senf::Exception("senf::log::Target::InvalidAreaException") {} }; iterator begin() const; ///< Iterator to beginning of routing table iterator end() const; ///< Iterator past the end of routing table diff --git a/senf/Utils/Statistics.cc b/senf/Utils/Statistics.cc index 9129c17..a9cb325 100644 --- a/senf/Utils/Statistics.cc +++ b/senf/Utils/Statistics.cc @@ -86,18 +86,18 @@ senf::StatisticsBase::output(unsigned n) char *format_eng( float f) { static char buf[16]; - if( f > 0){ + if (f > 0) { int n = 0; - while( f >= 1000.0f){ + while( f >= 1000.0f) { f /= 1000.f; n+=3; } sprintf( buf, " %3.2fe%+03d", f, n); } - else if( f < 0){ + else if (f < 0) { int n = 0; - while( f <= -1000.0f){ + while( f <= -1000.0f) { f *= 1000.f; n+=3; } diff --git a/senf/Utils/String.ct b/senf/Utils/String.ct index 3491a2e..01c4459 100644 --- a/senf/Utils/String.ct +++ b/senf/Utils/String.ct @@ -65,13 +65,13 @@ namespace detail { lexical_stream() { stream.unsetf(std::ios::skipws); - if(std::numeric_limits::is_specialized) + if (std::numeric_limits::is_specialized) stream.precision(std::numeric_limits::digits10 + 1); } template bool operator<<(const Source &input) { - if(std::numeric_limits::is_specialized) + if (std::numeric_limits::is_specialized) stream.precision(std::numeric_limits::digits10 + 1); return !(stream << input).fail(); } @@ -105,7 +105,7 @@ namespace detail { Target operator()(Source const & arg) const { Target result; - if(!((*interpreter_) << arg && (*interpreter_) >> result)) + if (!((*interpreter_) << arg && (*interpreter_) >> result)) boost::throw_exception(boost::bad_lexical_cast(typeid(Source), typeid(Target))); return result; } @@ -128,7 +128,7 @@ prefix_ Target senf::lexical_cast(Source const & arg) senf::detail::lexical_stream interpreter; Target result; - if(!(interpreter << arg && interpreter >> result)) + if (!(interpreter << arg && interpreter >> result)) boost::throw_exception(boost::bad_lexical_cast(typeid(Source), typeid(Target))); return result; }