Skip to content
Snippets Groups Projects
Commit 9bfcd99b authored by tho's avatar tho
Browse files

Packets/DefaultBundle/ICMP: sorted includes

Utils/Exception: message() does not include backtrace informations
fixed some documentation
parent e3c92e90
No related branches found
No related tags found
No related merge requests found
...@@ -60,8 +60,7 @@ prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Reader ...@@ -60,8 +60,7 @@ prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Reader
} }
template <class Reader> template <class Reader>
prefix_ senf::ppi::module::ActiveSocketSource<Reader>:: prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Handle handle)
ActiveSocketSource(Handle handle)
: handle_(handle), event_(handle_, IOEvent::Read) : handle_(handle), event_(handle_, IOEvent::Read)
{ {
registerEvent( event_, &ActiveSocketSource::read ); registerEvent( event_, &ActiveSocketSource::read );
......
...@@ -20,14 +20,19 @@ ...@@ -20,14 +20,19 @@
// Free Software Foundation, Inc., // Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Custom includes /** \file
#include "../../Packets/Packets.hh" \brief ICMPv6Packet non-inline non-template implementation */
#include "ICMPv6Packet.hh" #include "ICMPv6Packet.hh"
//#include "ICMPv6Packet.ih"
// Custom includes
#include <boost/io/ios_state.hpp> #include <boost/io/ios_state.hpp>
#include "../../Packets/DefaultBundle/IPv6Packet.hh" #include "../../Packets/DefaultBundle/IPv6Packet.hh"
#include "../../Utils/IpChecksum.hh" #include "../../Utils/IpChecksum.hh"
#define prefix_ #define prefix_
///////////////////////////////cc.p////////////////////////////////////////
namespace { namespace {
senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::ICMPv6Packet> senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::ICMPv6Packet>
...@@ -74,6 +79,7 @@ prefix_ void senf::ICMPv6PacketType::dump(packet p, std::ostream &os) ...@@ -74,6 +79,7 @@ prefix_ void senf::ICMPv6PacketType::dump(packet p, std::ostream &os)
<< "Checksum : " << p->checksum() << "\n"; << "Checksum : " << p->checksum() << "\n";
} }
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_ #undef prefix_
......
...@@ -20,16 +20,19 @@ ...@@ -20,16 +20,19 @@
// Free Software Foundation, Inc., // Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
\brief ICMPv6Packet public header */
#ifndef HH_SENF_Packets_DefaultBundle_ICMPv6Packet_ #ifndef HH_SENF_Packets_DefaultBundle_ICMPv6Packet_
#define HH_SENF_Packets_DefaultBundle_ICMPv6Packet_ 1 #define HH_SENF_Packets_DefaultBundle_ICMPv6Packet_ 1
// Custom includes // Custom includes
#include "../../Packets/Packets.hh" #include "../../Packets/Packets.hh"
#include "../../Packets/DefaultBundle/IPv6Packet.hh"
//#include "ICMPv6Packet.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf namespace senf
{ {
struct ICMPv6PacketParser : public PacketParserBase struct ICMPv6PacketParser : public PacketParserBase
{ {
# include SENF_FIXED_PARSER() # include SENF_FIXED_PARSER()
...@@ -76,7 +79,7 @@ namespace senf ...@@ -76,7 +79,7 @@ namespace senf
static void dump(packet p, std::ostream & os); static void dump(packet p, std::ostream & os);
static IpTypes::key_t nextPacketKey(packet p) { static key_t nextPacketKey(packet p) {
return p->type(); return p->type();
} }
...@@ -89,6 +92,12 @@ namespace senf ...@@ -89,6 +92,12 @@ namespace senf
typedef ConcretePacket<ICMPv6PacketType> ICMPv6Packet; typedef ConcretePacket<ICMPv6PacketType> ICMPv6Packet;
} }
///////////////////////////////hh.e////////////////////////////////////////
#endif
#ifndef SENF_PACKETS_DECL_ONLY
//#include "IPv4Packet.cci"
//#include "IPv4Packet.ct"
//#include "IPv4Packet.cti"
#endif #endif
...@@ -101,3 +110,4 @@ namespace senf ...@@ -101,3 +110,4 @@ namespace senf
// compile-command: "scons -u test" // compile-command: "scons -u test"
// comment-column: 40 // comment-column: 40
// End: // End:
...@@ -20,17 +20,16 @@ ...@@ -20,17 +20,16 @@
// Free Software Foundation, Inc., // Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Definition of non-inline non-template functions
/** \file /** \file
\brief ICMPv6Packet unit tests */ \brief ICMPv6Packet unit tests */
// Custom includes // Custom includes
#include "ICMPv6Packet.hh"
#include "ICMPv6TypePacket.hh"
#include "../../Utils/auto_unit_test.hh" #include "../../Utils/auto_unit_test.hh"
#include <boost/test/test_tools.hpp> #include <boost/test/test_tools.hpp>
#include "ICMPv6Packet.hh"
#include "ICMPv6TypePacket.hh"
BOOST_AUTO_UNIT_TEST(ICMPv6Packet_packet) BOOST_AUTO_UNIT_TEST(ICMPv6Packet_packet)
{ {
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
#define HH_SENF_Packets_DefaultBundle_ICMPv6TypePacket_ 1 #define HH_SENF_Packets_DefaultBundle_ICMPv6TypePacket_ 1
// Custom includes // Custom includes
#include "../../Packets/Packets.hh" #include "../Packets.hh"
#include "IPv6Packet.hh"
#include "ICMPv6Packet.hh" #include "ICMPv6Packet.hh"
namespace senf { namespace senf {
......
...@@ -67,7 +67,7 @@ namespace console { ...@@ -67,7 +67,7 @@ namespace console {
///\name Structors and default members ///\name Structors and default members
///@{ ///@{
ConfigBundle(); ConfigBundle(); ///< root node is set to console::root()
ConfigBundle(DirectoryNode & root); ///< Set custom root node ConfigBundle(DirectoryNode & root); ///< Set custom root node
///@} ///@}
...@@ -77,18 +77,18 @@ namespace console { ...@@ -77,18 +77,18 @@ namespace console {
Source & add(boost::intrusive_ptr<Source> source); Source & add(boost::intrusive_ptr<Source> source);
///< Add configuration source ///< Add configuration source
void parse(); ///< Parse config file void parse(); ///< Parse config bundle
/**< All nodes already parsed are skipped */ /**< All nodes already parsed are skipped */
void parse(DirectoryNode & restrict); ///< Parse config file under \a restrict void parse(DirectoryNode & restrict); ///< Parse config bundle under \a restrict
/**< Only nodes which are children of \a restrict are /**< Only nodes which are children of \a restrict are
parsed. */ parsed. */
bool complete() const; ///< \c true, if all nodes have been parsed bool complete() const; ///< \c true, if all nodes have been parsed
bool parsed(GenericNode & node) const; ///< \c true. if \a node has been parsed bool parsed(GenericNode & node) const; ///< \c true. if \a node has been parsed
void reset(); ///< Reset node parse info state void reset(); ///< Reset node parse info state
/**< After a call to reset(), all information about already /**< After a call to reset(), all information about already
parsed nodes is cleared. Calling parse() will parse the parsed nodes is cleared. Calling parse() will parse the
complete config file again. */ complete config bundle again. */
protected: protected:
......
...@@ -278,7 +278,7 @@ namespace console { ...@@ -278,7 +278,7 @@ namespace console {
bool active() const; ///< \c true, if node is attached to the root() node bool active() const; ///< \c true, if node is attached to the root() node
void help(std::ostream & output) const; /// Write help info to \a output void help(std::ostream & output) const; ///< Write help info to \a output
ptr thisptr(); ///< Get smart pointer to node ptr thisptr(); ///< Get smart pointer to node
cptr thisptr() const; ///< Get smart pointer to node (const) cptr thisptr() const; ///< Get smart pointer to node (const)
......
...@@ -48,7 +48,7 @@ prefix_ void senf::ExceptionMixin::addBacktrace() ...@@ -48,7 +48,7 @@ prefix_ void senf::ExceptionMixin::addBacktrace()
ss << "\nException at\n"; ss << "\nException at\n";
formatBacktrace(ss, entries, nEntries); formatBacktrace(ss, entries, nEntries);
ss << "-- \n" << message_; ss << "-- \n" << message_;
message_ = ss.str(); what_ = ss.str();
} }
#endif #endif
...@@ -62,7 +62,7 @@ prefix_ senf::Exception::~Exception() ...@@ -62,7 +62,7 @@ prefix_ senf::Exception::~Exception()
prefix_ char const * senf::Exception::what() prefix_ char const * senf::Exception::what()
const throw() const throw()
{ {
return message().c_str(); return what_.c_str();
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
// senf::ExceptionMixin // senf::ExceptionMixin
prefix_ senf::ExceptionMixin::ExceptionMixin(std::string const & description) prefix_ senf::ExceptionMixin::ExceptionMixin(std::string const & description)
: message_(description) : what_(description),
message_(description)
{ {
#ifdef SENF_DEBUG #ifdef SENF_DEBUG
addBacktrace(); addBacktrace();
...@@ -47,6 +48,7 @@ prefix_ std::string const & senf::ExceptionMixin::message() ...@@ -47,6 +48,7 @@ prefix_ std::string const & senf::ExceptionMixin::message()
prefix_ void senf::ExceptionMixin::append(std::string text) prefix_ void senf::ExceptionMixin::append(std::string text)
{ {
message_ += text; message_ += text;
what_ += text;
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
......
...@@ -56,7 +56,7 @@ template <class BaseException> ...@@ -56,7 +56,7 @@ template <class BaseException>
prefix_ char const * senf::WrapException<BaseException>::what() prefix_ char const * senf::WrapException<BaseException>::what()
const throw() const throw()
{ {
return message().c_str(); return what_.c_str();
} }
/////////////////////////////cti.e/////////////////////////////////////// /////////////////////////////cti.e///////////////////////////////////////
......
...@@ -140,9 +140,9 @@ namespace senf { ...@@ -140,9 +140,9 @@ namespace senf {
class ExceptionMixin class ExceptionMixin
{ {
public: public:
std::string const & message() const; std::string const & message() const; ///< get exception description
void append(std::string text); ///< Extend exception description void append(std::string text); ///< Extend exception description
/**< Adds \a text to the description text. */ /**< Adds \a text to the description text. */
protected: protected:
...@@ -152,7 +152,7 @@ namespace senf { ...@@ -152,7 +152,7 @@ namespace senf {
string. This should probably be a string constant string. This should probably be a string constant
describing the exception for most derived describing the exception for most derived
exceptions. */ exceptions. */
std::string what_;
private: private:
#ifdef SENF_DEBUG #ifdef SENF_DEBUG
void addBacktrace(); void addBacktrace();
...@@ -177,6 +177,9 @@ namespace senf { ...@@ -177,6 +177,9 @@ namespace senf {
virtual ~Exception() throw(); virtual ~Exception() throw();
virtual char const * what() const throw(); virtual char const * what() const throw();
///< get exception description and backtrace if available
/**< get description of the exception (message()) and backtrace
information if SENF is compiled with \c SENF_DEBUG */
protected: protected:
explicit Exception(std::string const & description = ""); explicit Exception(std::string const & description = "");
...@@ -299,7 +302,6 @@ namespace senf { ...@@ -299,7 +302,6 @@ namespace senf {
void init(std::string const & descr, int code _SENF_EXC_DEBUG_ARGS_ND); void init(std::string const & descr, int code _SENF_EXC_DEBUG_ARGS_ND);
int code_; int code_;
std::string what_;
}; };
# ifdef SENF_DEBUG # ifdef SENF_DEBUG
......
...@@ -43,9 +43,9 @@ namespace log { ...@@ -43,9 +43,9 @@ namespace log {
/** \brief Log target writing UDP syslog packets /** \brief Log target writing UDP syslog packets
The SyslogUDPTarget will send all log messages directly via UDP to a target host. This host The SyslogUDPTarget will send all %log messages directly via UDP to a target host. This
should have a syslog daemon or relay running. The protocol is defined in <a host should have a syslog daemon or relay running. The protocol is defined in <a
href="ttp://tools.ietf.org/html/rfc3164">RFC-3164</a>. href="http://tools.ietf.org/html/rfc3164">RFC-3164</a>.
This log target has some important benefits: This log target has some important benefits:
...@@ -66,7 +66,7 @@ namespace log { ...@@ -66,7 +66,7 @@ namespace log {
the default facility is <tt>LOG_USER</tt> the default facility is <tt>LOG_USER</tt>
The SENF log levels are mapped to syslog levels in the following way: The SENF %log levels are mapped to syslog levels in the following way:
<table class="senf fixedcolumn"> <table class="senf fixedcolumn">
<tr><td>senf::log::VERBOSE</td> <td>\c LOG_DEBUG</td></tr> <tr><td>senf::log::VERBOSE</td> <td>\c LOG_DEBUG</td></tr>
...@@ -78,8 +78,8 @@ namespace log { ...@@ -78,8 +78,8 @@ namespace log {
</table> </table>
\note Since the UDP syslog packets are limited to 1024 characters and there must be some \note Since the UDP syslog packets are limited to 1024 characters and there must be some
space left so a relay may optionally add a timestamp and hostname section, the log space left so a relay may optionally add a timestamp and hostname section, the %log
messages are split after 896 characters. Additionally the log messages are split at each messages are split after 896 characters. Additionally the %log messages are split at each
newline char since non-printable characters are not allowed. newline char since non-printable characters are not allowed.
\implementation The RFC only \e recommends the exact message format. This allows us to \implementation The RFC only \e recommends the exact message format. This allows us to
...@@ -119,7 +119,7 @@ namespace log { ...@@ -119,7 +119,7 @@ namespace log {
/**< When syslog format is disabled, messages are not /**< When syslog format is disabled, messages are not
formated as valid syslog messages but sent using plain formated as valid syslog messages but sent using plain
UDP. */ UDP. */
void syslog(bool enabled=true); /// Set syslog format void syslog(bool enabled=true); ///< Set syslog format
private: private:
void init(); void init();
......
...@@ -78,12 +78,12 @@ namespace log { ...@@ -78,12 +78,12 @@ namespace log {
stream stream
\li (optional) \e area. If the area is specified, only messages directed at that area are \li (optional) \e area. If the area is specified, only messages directed at that area are
matched, otherwise any area will be allowed matched, otherwise any area will be allowed
\li (optional) \e level. If the log level is specified, messages will be accepted if their \li (optional) \e level. If the %log level is specified, messages will be accepted if their
level is at least that value. If the value is not specified, the limit will be taken level is at least that value. If the value is not specified, the limit will be taken
from the stream's default value. from the stream's default value.
Each parameter (stream, area and level) has two representations: A static (compile time Each parameter (stream, area and level) has two representations: A static (compile time
constant) representation, which is the representation also used in the log statements, and a constant) representation, which is the representation also used in the %log statements, and a
dynamic representation, which may be used for manipulating the routing table. dynamic representation, which may be used for manipulating the routing table.
The static representation is used, when passing routing parameters via template arguments: The static representation is used, when passing routing parameters via template arguments:
......
...@@ -66,7 +66,7 @@ namespace term { ...@@ -66,7 +66,7 @@ namespace term {
virtual ~AbstractTerminal() {} virtual ~AbstractTerminal() {}
virtual void setCallbacks(Callbacks & cb) = 0; /// Register terminal callbacks virtual void setCallbacks(Callbacks & cb) = 0; ///< Register terminal callbacks
virtual std::string terminalType() = 0; ///< Get the terminal type virtual std::string terminalType() = 0; ///< Get the terminal type
virtual unsigned width() = 0; ///< Get current terminal window width virtual unsigned width() = 0; ///< Get current terminal window width
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment