diff --git a/HowTos/NewPacket/Mainpage.dox b/HowTos/NewPacket/Mainpage.dox index 436a4286bfe05d98b217bc8d9c0c50a7d3f0a271..674453542fff05224e0c4bd67f923917061d286c 100644 --- a/HowTos/NewPacket/Mainpage.dox +++ b/HowTos/NewPacket/Mainpage.dox @@ -623,29 +623,20 @@ SENF_PARSER_BITFIELD_RO ( checksumPresent, 1, bool ); SENF_PARSER_PRIVATE_BITFIELD ( reserved0_5bits_, 5, unsigned ); SENF_PARSER_SKIP_BITS ( 7 ); - SENF_PARSER_PRIVATE_BITFIELD ( version_, 3, unsigned ); + SENF_PARSER_BITFIELD_RO ( version, 3, unsigned ); \endcode - We have added an additional private bitfield \a reserved0_5bits_() and we made the \a version_() - field private since we do not want the user to change the value (0 is the only valid value, any - other value is not supported by this parser anyways). In this special case, a read-only field - would do. But more generally, if there are fields which must have a fixed value, they must be - defined as private fields so they can be initialized by the parser to their correct value (see - next section on how). An additional public read-only accessor allows users of the parser to read - out the value (but not change it). + We have added an additional private bitfield \a reserved0_5bits_() and we made the \a version() + field read-only. - We will now add two additional simple members to the parser + We will now add a simple additional member to the parser: \code - typedef version__t version_t; - version_t::value_type version() const { return version_(); } - bool valid() const { return version() == 0 && reserved0_5bits_() == 0; } \endcode - I think, both are quite straight forward: \a version() will allow the user to read out the value - of the version field. However, since it does \e not return a parser but a numeric value, the - access is read-only. The \a valid() member will just check the restrictions as defined in the RFC. + I think, this is quite straight forward: \a valid() will just check the restrictions as defined + in the RFC. Now to the packet type. We want to refrain from parsing the payload if the packet is invalid. This is important: If the packet is not valid, we have no idea, whether the payload is @@ -708,8 +699,9 @@ SENF_PARSER_INIT() { version_() << 1u; } \endcode - to \c GREPacketParser. Here we see, why we have defined \a version_() as a private and not a - read-only field. + to \c GREPacketParser. For every read-only defined field, the macros automatically define a \e + private read-write accessor which may be used internally. This read-write accessor is used here + to initialize the value. \section howto_newpacket_final The ultimate GRE packet implementation completed @@ -740,7 +732,7 @@ SENF_PARSER_BITFIELD_RO ( checksumPresent, 1, bool ); SENF_PARSER_PRIVATE_BITFIELD ( reserved0_5bits_, 5, unsigned ); SENF_PARSER_SKIP_BITS ( 7 ); - SENF_PARSER_PRIVATE_BITFIELD ( version_, 3, unsigned ); + SENF_PARSER_BITFIELD_RO ( version, 3, unsigned ); SENF_PARSER_FIELD ( protocolType, senf::UInt16Parser ); diff --git a/Packets/PacketImpl.test.cc b/Packets/PacketImpl.test.cc index c2a812b61f4dc88a3db79d2542520e8de101669e..fe31d95260238d3509750b09d75e734ad51d658a 100644 --- a/Packets/PacketImpl.test.cc +++ b/Packets/PacketImpl.test.cc @@ -50,7 +50,7 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) BOOST_CHECK_EQUAL(p->refcount(), 0); p->add_ref(); BOOST_CHECK_EQUAL(p->refcount(), 1); -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin<senf::detail::PacketImpl>::allocCounter(), 1u); #endif @@ -69,7 +69,7 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) p,p->begin(),p->end(), senf::PacketInterpreterBase::Append)); // Hmm ... this check works as long as sizeof(PacketInterpreterBase> != // sizeof(PacketImpl) ... !! -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin< senf::PacketInterpreter<VoidPacket> >::allocCounter(), 1u); #endif @@ -84,7 +84,7 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) p->truncateInterpreters(pi.get()); BOOST_CHECK_EQUAL(p->refcount(),1); } -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin<senf::PacketInterpreterBase>::allocCounter(), 0u); #endif @@ -95,7 +95,7 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) // Therefore we can safely delete the object. BOOST_CHECK_EQUAL(p->refcount(), 1); p->release(); -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin<senf::detail::PacketImpl>::allocCounter(), 0u); #endif @@ -201,7 +201,7 @@ BOOST_AUTO_UNIT_TEST(packetImpl_interpreters) BOOST_CHECK_EQUAL(p->refcount(), 1); p->release(); -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin<senf::detail::PacketImpl>::allocCounter(), 0u); #endif diff --git a/Packets/PacketRegistry.ct b/Packets/PacketRegistry.ct index f274efaca9f1355ddc61ec02fd5f117e7321c18a..ab0de44ea45a80d859b34f0485efc207d3db5dc3 100644 --- a/Packets/PacketRegistry.ct +++ b/Packets/PacketRegistry.ct @@ -68,7 +68,7 @@ template <class KeyType> template <class PacketType> prefix_ void senf::detail::PacketRegistryImpl<KeyType>::registerPacket(key_t key) { -#ifdef SENF_NO_DEBUG +#ifndef SENF_DEBUG registry_.insert(std::make_pair(key, Entry_ptr(new detail::PkReg_EntryImpl<PacketType>()))); reverseRegistry_.insert(std::make_pair(senf::typeIdValue<PacketType>(), key)); #else diff --git a/Packets/ParseHelpers.hh b/Packets/ParseHelpers.hh index 31fa8b5e4a6c494d077d917d228153e060471535..f79e956801de9636fd6b16fbc2f18cbd407f1451 100644 --- a/Packets/ParseHelpers.hh +++ b/Packets/ParseHelpers.hh @@ -180,7 +180,7 @@ \par "" \ref SENF_PARSER_FIELD(), \ref SENF_PARSER_FIELD_RO(), \ref SENF_PARSER_PRIVATE_FIELD(), - \ref SENF_PARSER_PRIVATE_FIELD_RO(), SENF_PARSER_CUSTOM_FIELD() + \ref SENF_PARSER_CUSTOM_FIELD() There are quite a few commands available to define fields. All these macros do the same thing: they define a field accessor plus some auxiliary symbols. The accessor will use the parser type @@ -206,8 +206,7 @@ The field defining macros come in groups which members only differ in their properties: <dl><dt><em>Standard fields:</em><dt><dd>\ref SENF_PARSER_FIELD(), \ref SENF_PARSER_FIELD_RO(), - \ref SENF_PARSER_PRIVATE_FIELD(), \ref SENF_PARSER_PRIVATE_FIELD_RO() define standard - fields.</dd> + \ref SENF_PARSER_PRIVATE_FIELD() define standard fields.</dd> <dt><em>Arbitrary custom field:</em><dt><dd>\ref SENF_PARSER_CUSTOM_FIELD()</dd></dl> @@ -221,7 +220,7 @@ \par "" \ref SENF_PARSER_BITFIELD(), \ref SENF_PARSER_BITFIELD_RO(), \ref - SENF_PARSER_PRIVATE_BITFIELD(), \ref SENF_PARSER_PRIVATE_BITFIELD_RO() \n + SENF_PARSER_PRIVATE_BITFIELD()\n Bit-fields play a special role. They are quite frequent in packet definitions but don't fit into the byte offset based parsing infrastructure defined so far. Since defining the correctly @@ -402,9 +401,8 @@ <dl><dt><em>return_type</em> <em>name</em><tt>()</tt> <tt>const</tt></dt><dd>The accessor member will return the parsed value when called. For normal fields, <em>return_type</em> equals <em>type</em>, the type of the sub parser. This allows to change the value via the returned - sub-parser. If the field is marked read-only (\ref SENF_PARSER_FIELD_RO() or \ref - SENF_PARSER_PRIVATE_FIELD_RO()), the return type will be - <em>type</em>::<tt>value_type</tt>.</dd> + sub-parser. If the field is marked read-only (\ref SENF_PARSER_FIELD_RO()), the return type + will be <em>type</em>::<tt>value_type</tt>.</dd> <dt><tt>typedef</tt> <em>type</em> <em>name</em><tt>_t</tt></dt><dd>This typedef symbol is an alias for the fields type.</dd> @@ -420,8 +418,7 @@ \param[in] name field name \param[in] type parser type - \see \ref SENF_PARSER_FIELD_RO(), \ref SENF_PARSER_PRIVATE_FIELD(), \ref - SENF_PARSER_PRIVATE_FIELD_RO() + \see \ref SENF_PARSER_FIELD_RO(), \ref SENF_PARSER_PRIVATE_FIELD() \hideinitializer */ #define SENF_PARSER_FIELD(name, type) @@ -431,6 +428,10 @@ Define read-only parser field. Read-only fields may only be defined for \a type's which are value parsers: The parser \a type must have a \c value_type typedef member and a \c value() member, which returns the current value of the field. + + Defining such a field really defines \e two accessors: A read/write \e private field and a + read-only \e public accessor. The name of the private read/write field is given by adding a + trailing '_' to \a name. The read-only public accessor is called \a name. \see SENF_PARSER_FIELD() \hideinitializer @@ -447,18 +448,6 @@ */ #define SENF_PARSER_PRIVATE_FIELD(name, type) -/** \brief Define parser field (private + read-only) - - Define a read-only parser field which is marked as \c private and may only be accessed from the - parser class itself. Read-only fields may only be defined for \a type's which are value parsers: - The parser \a type must have a \c value_type typedef member and a \c value() member, which - returns the current value of the field. - - \see SENF_PARSER_FIELD() - \hideinitializer - */ -#define SENF_PARSER_PRIVATE_FIELD_RO(name, type) - /** \brief Define custom field accessor This macro is used to define a field using a custom access method: @@ -516,18 +505,16 @@ \param[in] bits number of bits \param[in] type bit field type, one of \c signed, \c unsigned or \c bool - \see \ref SENF_PARSER_BITFIELD_RO(), \ref SENF_PARSER_PRIVATE_BITFIELD(), \ref - SENF_PARSER_PRIVATE_BITFIELD_RO() - + \see \ref SENF_PARSER_BITFIELD_RO(), \ref SENF_PARSER_PRIVATE_BITFIELD() \hideinitializer */ #define SENF_PARSER_BITFIELD(name, bits, type) /** \brief Define bit-field (read-only) - Define read-only bit field. + Define read-only bit field. This is for bit-fields what \ref SENF_PARSER_FIELD_RO is for ordinary fields. - \see \ref SENF_PARSER_BITFIELD() + \see \ref SENF_PARSER_BITFIELD() \n \ref SENF_PARSER_FIELD_RO() \hideinitializer */ #define SENF_PARSER_BITFIELD_RO(name, bits, type) @@ -542,16 +529,6 @@ */ #define SENF_PARSER_PRIVATE_BITFIELD(name, bits, type) -/** \brief Define bit-field (private + read-only) - - Define a read-only bit field which is marked as \c private and may only be accessed from the - parser class itself. - - \see \ref SENF_PARSER_BITFIELD() - \hideinitializer - */ -#define SENF_PARSER_PRIVATE_BITFIELD_RO(name, bits, type) - ///@} ///\name Current offset @@ -685,30 +662,28 @@ #else -#define SENF_PARSER_INHERIT BOOST_PP_CAT(SENF_PARSER_INHERIT_, SENF_PARSER_TYPE) +#define SENF_PARSER_INHERIT BOOST_PP_CAT( SENF_PARSER_INHERIT_, SENF_PARSER_TYPE ) -#define SENF_PARSER_FIELD BOOST_PP_CAT(SENF_PARSER_FIELD_, SENF_PARSER_TYPE) -#define SENF_PARSER_FIELD_RO BOOST_PP_CAT(SENF_PARSER_FIELD_RO_, SENF_PARSER_TYPE) -#define SENF_PARSER_BITFIELD BOOST_PP_CAT(SENF_PARSER_BITFIELD_, SENF_PARSER_TYPE) -#define SENF_PARSER_BITFIELD_RO BOOST_PP_CAT(SENF_PARSER_BITFIELD_RO_, SENF_PARSER_TYPE) -#define SENF_PARSER_CUSTOM_FIELD BOOST_PP_CAT(SENF_PARSER_CUSTOM_FIELD_, SENF_PARSER_TYPE) +#define SENF_PARSER_FIELD BOOST_PP_CAT( SENF_PARSER_FIELD_, SENF_PARSER_TYPE ) +#define SENF_PARSER_FIELD_RO BOOST_PP_CAT( SENF_PARSER_FIELD_RO_, SENF_PARSER_TYPE ) +#define SENF_PARSER_BITFIELD BOOST_PP_CAT( SENF_PARSER_BITFIELD_, SENF_PARSER_TYPE ) +#define SENF_PARSER_BITFIELD_RO BOOST_PP_CAT( SENF_PARSER_BITFIELD_RO_, SENF_PARSER_TYPE ) +#define SENF_PARSER_CUSTOM_FIELD BOOST_PP_CAT( SENF_PARSER_CUSTOM_FIELD_, SENF_PARSER_TYPE ) -#define SENF_PARSER_PRIVATE_FIELD BOOST_PP_CAT(SENF_PARSER_P_FIELD_, SENF_PARSER_TYPE) -#define SENF_PARSER_PRIVATE_FIELD_RO BOOST_PP_CAT(SENF_PARSER_P_FIELD_RO_, SENF_PARSER_TYPE) -#define SENF_PARSER_PRIVATE_BITFIELD BOOST_PP_CAT(SENF_PARSER_P_BITFIELD_, SENF_PARSER_TYPE) -#define SENF_PARSER_PRIVATE_BITFIELD_RO BOOST_PP_CAT(SENF_PARSER_P_BITFIELD_RO_, SENF_PARSER_TYPE) +#define SENF_PARSER_PRIVATE_FIELD BOOST_PP_CAT( SENF_PARSER_P_FIELD_, SENF_PARSER_TYPE ) +#define SENF_PARSER_PRIVATE_BITFIELD BOOST_PP_CAT( SENF_PARSER_P_BITFIELD_, SENF_PARSER_TYPE ) -#define SENF_PARSER_SKIP BOOST_PP_CAT(SENF_PARSER_SKIP_, SENF_PARSER_TYPE) -#define SENF_PARSER_SKIP_BITS BOOST_PP_CAT(SENF_PARSER_SKIP_BITS_, SENF_PARSER_TYPE) -#define SENF_PARSER_GOTO BOOST_PP_CAT(SENF_PARSER_GOTO_, SENF_PARSER_TYPE) -#define SENF_PARSER_GOTO_OFFSET BOOST_PP_CAT(SENF_PARSER_GOTO_OFFSET_, SENF_PARSER_TYPE) -#define SENF_PARSER_LABEL BOOST_PP_CAT(SENF_PARSER_LABEL_, SENF_PARSER_TYPE) +#define SENF_PARSER_SKIP BOOST_PP_CAT( SENF_PARSER_SKIP_, SENF_PARSER_TYPE ) +#define SENF_PARSER_SKIP_BITS BOOST_PP_CAT( SENF_PARSER_SKIP_BITS_, SENF_PARSER_TYPE ) +#define SENF_PARSER_GOTO BOOST_PP_CAT( SENF_PARSER_GOTO_, SENF_PARSER_TYPE ) +#define SENF_PARSER_GOTO_OFFSET BOOST_PP_CAT( SENF_PARSER_GOTO_OFFSET_, SENF_PARSER_TYPE ) +#define SENF_PARSER_LABEL BOOST_PP_CAT( SENF_PARSER_LABEL_, SENF_PARSER_TYPE ) -#define SENF_PARSER_OFFSET BOOST_PP_CAT(SENF_PARSER_OFFSET_, SENF_PARSER_TYPE) -#define SENF_PARSER_FIXED_OFFSET BOOST_PP_CAT(SENF_PARSER_FIXED_OFFSET_,SENF_PARSER_TYPE) -#define SENF_PARSER_CURRENT_FIXED_OFFSET BOOST_PP_CAT(SENF_PARSER_CURRENT_FIXED_OFFSET_, SENF_PARSER_TYPE) +#define SENF_PARSER_OFFSET BOOST_PP_CAT( SENF_PARSER_OFFSET_, SENF_PARSER_TYPE ) +#define SENF_PARSER_FIXED_OFFSET BOOST_PP_CAT( SENF_PARSER_FIXED_OFFSET_, SENF_PARSER_TYPE ) +#define SENF_PARSER_CURRENT_FIXED_OFFSET BOOST_PP_CAT( SENF_PARSER_CURRENT_FIXED_OFFSET_, SENF_PARSER_TYPE ) -#define SENF_PARSER_FINALIZE BOOST_PP_CAT(SENF_PARSER_FINALIZE_, SENF_PARSER_TYPE) +#define SENF_PARSER_FINALIZE BOOST_PP_CAT( SENF_PARSER_FINALIZE_, SENF_PARSER_TYPE ) #endif diff --git a/Packets/ParseHelpers.ih b/Packets/ParseHelpers.ih index c3afdeef55ba0328b7b5e5ccaea84d6043c22133..7e672824ca64f7cf2ac44ee04ccbaf4f5dfa8d72 100644 --- a/Packets/ParseHelpers.ih +++ b/Packets/ParseHelpers.ih @@ -90,9 +90,7 @@ # define SENF_PARSER_FIELD_RO_fix(name, type) SENF_PARSER_FIELD_I(name, type, fix, ro, public) # # define SENF_PARSER_P_FIELD_var(name, type) SENF_PARSER_FIELD_I(name, type, var, rw, private) -# define SENF_PARSER_P_FIELD_RO_var(name, type) SENF_PARSER_FIELD_I(name, type, var, ro, private) # define SENF_PARSER_P_FIELD_fix(name, type) SENF_PARSER_FIELD_I(name, type, fix, rw, private) -# define SENF_PARSER_P_FIELD_RO_fix(name, type) SENF_PARSER_FIELD_I(name, type, fix, ro, private) # # define SENF_PARSER_FIELD_I(name, type, ofstype, rwtype, access) \ access: \ @@ -121,7 +119,7 @@ # //////////////////////////////////////// # // SENF_PARSER_I_FIELD_INIT_* # -# define SENF_PARSER_I_FIELD_INIT_rw(name, type, access) \ +# define SENF_PARSER_I_FIELD_INIT_rw(name, type, access) \ private: \ void init_chain(senf::mpl::rv<BOOST_PP_CAT(name,_index)>*) const { \ init_chain(static_cast<senf::mpl::rv<BOOST_PP_CAT(name,_index)-1>*>(0)); \ @@ -129,7 +127,7 @@ } \ access: # -# define SENF_PARSER_I_FIELD_INIT_ro(name, type, access) \ +# define SENF_PARSER_I_FIELD_INIT_ro(name, type, access) \ private: \ void init_chain(senf::mpl::rv<BOOST_PP_CAT(name,_index)>*) const { \ init_chain(static_cast<senf::mpl::rv<BOOST_PP_CAT(name,_index)-1>*>(0)); \ @@ -187,16 +185,21 @@ } # # define SENF_PARSER_I_FIELD_VAL_ro(name, type, access) \ + private: \ + BOOST_PP_CAT(name, _t) BOOST_PP_CAT(name, _)() const { \ + return parse<type>( SENF_PARSER_OFFSET(name) ); \ + } \ + access: \ BOOST_PP_CAT(name, _t)::value_type name() const { \ - return parse<type>( SENF_PARSER_OFFSET(name) ).value(); \ + return BOOST_PP_CAT(name,_)(); \ } # # /////////////////////////////////////////////////////////////////////////// # // SENF_PARSER_CUSTOM_FIELD_* # -# define SENF_PARSER_CUSTOM_FIELD_var(name, type, size, isize) \ +# define SENF_PARSER_CUSTOM_FIELD_var(name, type, size, isize) \ SENF_PARSER_CUSTOM_FIELD_I(name, type, size, isize, var) -# define SENF_PARSER_CUSTOM_FIELD_fix(name, type, size) \ +# define SENF_PARSER_CUSTOM_FIELD_fix(name, type, size) \ SENF_PARSER_CUSTOM_FIELD_I(name, type, size, size, fix) # # define SENF_PARSER_CUSTOM_FIELD_I(name, type, size, isize, ofstype) \ @@ -222,12 +225,8 @@ # # define SENF_PARSER_P_BITFIELD_var(name, bits, type) \ SENF_PARSER_BITFIELD_I(name, bits, type, var, rw, private) -# define SENF_PARSER_P_BITFIELD_RO_var(name, bits, type) \ - SENF_PARSER_BITFIELD_I(name, bits, type, var, ro, private) # define SENF_PARSER_P_BITFIELD_fix(name, bits, type) \ SENF_PARSER_BITFIELD_I(name, bits, type, fix, rw, private) -# define SENF_PARSER_P_BITFIELD_RO_fix(name, bits, type) \ - SENF_PARSER_BITFIELD_I(name, bits, type, fix, ro, private) # # //////////////////////////////////////// # // SENF_PARSER_BITFIELD_I diff --git a/SConstruct b/SConstruct index 0e71c6deaa03a462561a96568d62d85c03dda1e5..8dffb8c9d3e1cb2501c4ab4f440f5025f7d941e1 100644 --- a/SConstruct +++ b/SConstruct @@ -130,6 +130,7 @@ def configFilesOpts(target, source, env, for_signature): env.Append( CPPPATH = [ '#/include' ], LIBS = [ 'iberty', '$BOOSTREGEXLIB' ], + TEST_EXTRA_LIBS = [ '$BOOSTFSLIB' ], DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ], DOXY_HTML_XSL = '#/doclib/html-munge.xsl', ENV = { 'TODAY' : str(datetime.date.today()), diff --git a/Socket/Protocols/INet/INet6Address.hh b/Socket/Protocols/INet/INet6Address.hh index 68aaeae1b6c1ceaf030e14678e09ed2d1ffdc936..9e34707761c329c9dfd26dfcc0253cef752ddd37 100644 --- a/Socket/Protocols/INet/INet6Address.hh +++ b/Socket/Protocols/INet/INet6Address.hh @@ -71,7 +71,7 @@ namespace senf { <table class="senf"> <tr><th>Prefix</th> <th>Description</th> <th>Definition</th> <th>Note</th></tr> <tr><td><tt>::/96</tt></td> <td>IPv4 compatible IPv6 address</td> <td>RFC4291</td> <td>deprecated</td></tr> - <tr><td><tt>::ffff:0:0/96</tt></td> <td>IPv6 mapped IPv4 address</td> <td>RFC4291</td> <td></td></tr> + <tr><td><tt>\::ffff:0:0/96</tt></td> <td>IPv6 mapped IPv4 address</td> <td>RFC4291</td> <td></td></tr> <tr><td><tt>2000::/3</tt></td> <td>Global unicast addresses</td> <td>RFC3587</td> <td>only noted, not defined</td></tr> <tr><td><tt>2001:db8::/32</tt></td> <td>Documentation-only prefix</td> <td>RFC3849</td> <td></td></tr> <tr><td><tt>2002::/16</tt></td> <td>6to4 addressing</td> <td>RFC3056</td> <td></td></tr> diff --git a/Socket/Protocols/INet/INetAddressing.cc b/Socket/Protocols/INet/INetAddressing.cc index dd5d6e13603ce7c69a8fca67f4da6c21ea9a428e..b0cb9624bea76ed8895b641ed833e4b7f5615eef 100644 --- a/Socket/Protocols/INet/INetAddressing.cc +++ b/Socket/Protocols/INet/INetAddressing.cc @@ -130,7 +130,7 @@ prefix_ std::string senf::INet6SocketAddress::iface() if (sockaddr_.sin6_scope_id == 0) return ""; char buffer[IFNAMSIZ]; -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG SENF_ASSERT( if_indextoname(sockaddr_.sin6_scope_id,buffer) ); #else if_indextoname(sockaddr_.sin6_scope_id,buffer); diff --git a/Socket/Protocols/INet/MulticastSocketProtocol.hh b/Socket/Protocols/INet/MulticastSocketProtocol.hh index 2d93ae7021ce8b48711c1b1841ccc9fab10f0298..e8249ce003fc1b41481de2992b176c82ce944653 100644 --- a/Socket/Protocols/INet/MulticastSocketProtocol.hh +++ b/Socket/Protocols/INet/MulticastSocketProtocol.hh @@ -73,7 +73,7 @@ namespace senf { /** \brief Multicast protocol facet for INet4 addressable multicast enabled sockets */ class INet4MulticastSocketProtocol - : public virtual SocketProtocol + : public MulticastSocketProtocol { public: void mcAddMembership(INet4Address const & mcAddr) const; @@ -130,7 +130,7 @@ namespace senf { /** \brief Multicast protocol facet for INet6 addressable multicast enabled sockets */ class INet6MulticastSocketProtocol - : public virtual SocketProtocol + : public MulticastSocketProtocol { public: void mcAddMembership(INet6Address const & mcAddr) const; diff --git a/Socket/Protocols/INet/RawINetSocketHandle.hh b/Socket/Protocols/INet/RawINetSocketHandle.hh index ed2ae74e545fbc16335da964c6b076116430b6a4..363b38ea2b1c47d0465e145745286f557982e9d2 100644 --- a/Socket/Protocols/INet/RawINetSocketHandle.hh +++ b/Socket/Protocols/INet/RawINetSocketHandle.hh @@ -79,7 +79,6 @@ namespace senf { public BSDSocketProtocol, public AddressableBSDSocketProtocol, public DatagramSocketProtocol, - public MulticastSocketProtocol, public INet4MulticastSocketProtocol { public: @@ -147,7 +146,6 @@ namespace senf { public BSDSocketProtocol, public AddressableBSDSocketProtocol, public DatagramSocketProtocol, - public MulticastSocketProtocol, public INet6MulticastSocketProtocol { public: diff --git a/Socket/Protocols/INet/UDPSocketHandle.hh b/Socket/Protocols/INet/UDPSocketHandle.hh index a90163e443fc336f9bda1f7cfbea0b29603b1d21..378511e71ae76a91c70af9e27c92703c232739ba 100644 --- a/Socket/Protocols/INet/UDPSocketHandle.hh +++ b/Socket/Protocols/INet/UDPSocketHandle.hh @@ -80,7 +80,6 @@ namespace senf { class UDPv4SocketProtocol : public ConcreteSocketProtocol<UDPv4Socket_Policy, UDPv4SocketProtocol>, public UDPSocketProtocol, - public MulticastSocketProtocol, public INet4MulticastSocketProtocol, public BSDSocketProtocol, public DatagramSocketProtocol, @@ -140,7 +139,6 @@ namespace senf { class UDPv6SocketProtocol : public ConcreteSocketProtocol<UDPv6Socket_Policy, UDPv6SocketProtocol>, public UDPSocketProtocol, - public MulticastSocketProtocol, public INet6MulticastSocketProtocol, public BSDSocketProtocol, public DatagramSocketProtocol, diff --git a/Socket/SocketPolicy.hh b/Socket/SocketPolicy.hh index 209c374b1a4b7b08de1dea5277755ffaae735567..06d1359b2f32b7df3f77428ece2f471564ce60b3 100644 --- a/Socket/SocketPolicy.hh +++ b/Socket/SocketPolicy.hh @@ -61,7 +61,7 @@ <dt><em>readPolicy</em></dt><dd>configures the readability of the socket</dd> - <dt><em>writePolicy</em></dt><dd>configures the writability of the socket</dd> + <dt><em>writePolicy</em></dt><dd>configures the writability of the socket</dd></dl> The template senf::SocketPolicy combines these policy axis to form a concrete socket policy. In a concrete policy, each of these policy axis is assigned a value, the policy value. This value diff --git a/Utils/Daemon/Daemon.cc b/Utils/Daemon/Daemon.cc index 73fbf5d4f79f5bf38c9a0da594898a4f7fc32617..849f4c6e2abdb1f6350eed1a08610403123d7284 100644 --- a/Utils/Daemon/Daemon.cc +++ b/Utils/Daemon/Daemon.cc @@ -186,7 +186,7 @@ prefix_ int senf::Daemon::start(int argc, char const ** argv) return e.code; } -#ifdef SENF_NO_DEBUG +#ifndef SENF_DEBUG catch (std::exception & e) { std::cerr << "\n*** Fatal exception: " << e.what() << std::endl; diff --git a/Utils/pool_alloc_mixin.cti b/Utils/pool_alloc_mixin.cti index 9b739e9c6108f973888e99e10818298a7310f7dc..e2a80abdd28e45c7d6615b8c067b6509c325fa9f 100644 --- a/Utils/pool_alloc_mixin.cti +++ b/Utils/pool_alloc_mixin.cti @@ -37,7 +37,7 @@ prefix_ void * senf::pool_alloc_mixin<Self>::operator new(size_t size) // When deriving from Self you may not change the class's size without // inheriting from pool_alloc_mixin again. See pool_alloc_mixin documentation. SENF_ASSERT( size <= sizeof(Self) ); -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG allocCounter(1); #endif return boost::singleton_pool< pool_alloc_mixin_tag, sizeof(Self) >::malloc(); @@ -46,13 +46,13 @@ prefix_ void * senf::pool_alloc_mixin<Self>::operator new(size_t size) template <class Self> prefix_ void senf::pool_alloc_mixin<Self>::operator delete(void * p, size_t size) { -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG allocCounter(-1); #endif boost::singleton_pool< pool_alloc_mixin_tag, sizeof(Self) >::free(p); } -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG template <class Self> prefix_ unsigned long senf::pool_alloc_mixin<Self>::allocCounter() diff --git a/Utils/pool_alloc_mixin.hh b/Utils/pool_alloc_mixin.hh index 642e476fc0f5837b0e6193dadd0a2edceeec85e1..5fab5f6c5f374ab6c1b2eb3d4d4a47ba67e86e90 100644 --- a/Utils/pool_alloc_mixin.hh +++ b/Utils/pool_alloc_mixin.hh @@ -84,7 +84,7 @@ namespace senf { static void operator delete (void *p, size_t size); ///< Operator delete utilizing pool allocation -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG static unsigned long allocCounter(); private: static unsigned long allocCounter(long delta); diff --git a/Utils/pool_alloc_mixin.test.cc b/Utils/pool_alloc_mixin.test.cc index 5d130ed53a873a3713c5d80222bcd70efbc8d152..60957cf56b1c00f3fe967d836218dd24781b6cff 100644 --- a/Utils/pool_alloc_mixin.test.cc +++ b/Utils/pool_alloc_mixin.test.cc @@ -43,7 +43,7 @@ namespace { BOOST_AUTO_UNIT_TEST(poolAllocMixin) { -#ifndef SENF_NO_DEBUG +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( Test::allocCounter(), 0u ); { diff --git a/Utils/senfassert.hh b/Utils/senfassert.hh index 7f488c836db737a7c656b0b1b6ca9ebbc63d3042..245bca9705dfad6714e3ad89aa1fbf582a230cf2 100644 --- a/Utils/senfassert.hh +++ b/Utils/senfassert.hh @@ -32,7 +32,7 @@ //#include "senfassert.mpp" ///////////////////////////////hh.p//////////////////////////////////////// -#ifdef SENF_NO_DEBUG +#ifndef SENF_DEBUG # define SENF_ASSERT(x) diff --git a/config.hh b/config.hh index 42fb59572fa640f4a6fe07fbdb1910a4c791f61f..29060306b9e4cc97798d0d59eafc79fdaf1d0102 100644 --- a/config.hh +++ b/config.hh @@ -70,7 +70,7 @@ # endif # # ifndef SENF_SENFLOG_LIMIT -# ifdef SENF_NO_DEBUG +# ifndef SENF_DEBUG # define SENF_SENFLOG_LIMIT senf::log::IMPORTANT # else # define SENF_SENFLOG_LIMIT senf::log::VERBOSE diff --git a/debian/control b/debian/control index c3b214e37fa7ba8b0d37767d4d10f39ce722f05f..2cef2a425337de6775718da94200b8e5f81eee9a 100644 --- a/debian/control +++ b/debian/control @@ -1,9 +1,9 @@ Source: libsenf Priority: extra Maintainer: Stefan Bund <senf-dev@lists.berlios.de> -Build-Depends: debhelper (>= 5), scons, binutils-dev, libboost-dev, +Build-Depends: debhelper (>= 5), scons (>= 0.97), binutils-dev, libboost-dev, libboost-test-dev, libboost-date-time-dev, libboost-regex-dev, - libboost-filesystem-dev, doxygen, dia, tidy, xsltproc, + libboost-filesystem-dev, doxygen (>= 1.5.5), dia, tidy, xsltproc, graphviz, perl-base, linklint, netpbm Standards-Version: 3.7.2 Section: libs diff --git a/senfscons/BoostUnitTests.py b/senfscons/BoostUnitTests.py index 18442e3d4e9bbc4b11fddf0181e67c93723799fc..f2516f338833f91a5ef7312975d992e531947784 100644 --- a/senfscons/BoostUnitTests.py +++ b/senfscons/BoostUnitTests.py @@ -34,8 +34,9 @@ def BoostUnitTests(env, target, objects, test_sources=None, LIBS = [], OBJECTS = else: test_sources = [] testEnv = env.Copy(**kw) - testEnv.Prepend(_LIBFLAGS = ' -Wl,-Bstatic -l$BOOSTTESTLIB -l$BOOSTFSLIB -Wl,-Bdynamic ') + testEnv.Prepend(_LIBFLAGS = ' -Wl,-Bstatic -l$BOOSTTESTLIB -Wl,-Bdynamic ') testEnv.Prepend(LIBS = LIBS) + testEnv.Append(LIBS = env['TEST_EXTRA_LIBS']) all_objects = [] if not objects: objects = [] diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py index 125984afa0d424a12a0c278586aba9dd33e724e2..5df494767696f1c3c60d79c727cda7f33b4a474c 100644 --- a/senfscons/SENFSCons.py +++ b/senfscons/SENFSCons.py @@ -246,12 +246,12 @@ def MakeEnvironment(): LIBPATH = [ '$LOCALLIBDIR' ]) if env['final']: - env.Append(CXXFLAGS = [ '-O3' ], - CPPDEFINES = [ 'SENF_NO_DEBUG' ]) + env.Append(CXXFLAGS = [ '-O3' ]) else: + # The boost-regex library is not compiled with _GLIBCXX_DEBUG so this fails: + # CPPDEFINES = [ '_GLIBCXX_DEBUG' ], env.Append(CXXFLAGS = [ '-O0', '-g', '-fno-inline' ], - # The boost-regex library is not compiled with _GLIBCXX_DEBUG so this fails. - # CPPDEFINES = [ '_GLIBCXX_DEBUG' ], + CPPDEFINES = [ 'SENF_DEBUG' ], LINKFLAGS = [ '-g' ]) env.Append(CPPDEFINES = [ '$EXTRA_DEFINES' ],