From: g0dil Date: Tue, 11 Dec 2007 13:39:56 +0000 (+0000) Subject: Packets: Remove direct Socket dependency X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=62e54b2c69f960f98c6800db90ef15c3e77bcee0;p=senf.git Packets: Remove direct Socket dependency Packets: BUGFIX: Fix init_bytes caculation on dynamic parser bitfields git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@553 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Packets/Doxyfile b/Packets/Doxyfile index 231429e..363a67a 100644 --- a/Packets/Doxyfile +++ b/Packets/Doxyfile @@ -6,5 +6,4 @@ INPUT = . EXAMPLE_PATH = . DefaultBundle TAGFILES = \ - "$(TOPDIR)/Socket/doc/Socket.tag" \ "$(TOPDIR)/Utils/doc/Utils.tag" diff --git a/Packets/MPEGDVBBundle/GREPacket.test.cc b/Packets/MPEGDVBBundle/GREPacket.test.cc index d7dfbf3..52d38ef 100644 --- a/Packets/MPEGDVBBundle/GREPacket.test.cc +++ b/Packets/MPEGDVBBundle/GREPacket.test.cc @@ -22,11 +22,11 @@ // Unit tests -//#include "TransportPacket.test.hh" -//#include "TransportPacket.test.ih" +//#include "GREPacket.test.hh" +//#include "GREPacket.test.ih" // Custom includes -#include "TransportPacket.hh" +#include "GREPacket.hh" #include "../../Utils/auto_unit_test.hh" #include @@ -38,45 +38,10 @@ using namespace senf; BOOST_AUTO_UNIT_TEST(GREPacket_packet) { - // TransportStream-Packet containing a ULE encoded IPv6 ping packet, - // captured with dvbsnoop - unsigned char data[] = { - 0x47, 0x41, 0x0f, 0x1e, 0x00, 0x80, 0x4c, 0x86, - 0xdd, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, - 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x48, 0x7c, 0x7e, 0xff, 0xfe, 0x23, 0x68, - 0xaf, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x04 ,0x02, 0x8c, 0x02, 0x8c, 0x00, 0x20, 0x58, - 0xe1, 0x11, 0x05, 0x12, 0x67, 0x06, 0x2f, 0x01, - 0x00, 0x20, 0x01, 0x06, 0x38, 0x04, 0x09, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, - 0x00, 0x1d, 0xc4, 0xe8, 0xc1, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff - }; - - senf::TransportPacket p (senf::TransportPacket::create(data)); + senf::GREPacket p (senf::GREPacket::create()); - BOOST_CHECK_EQUAL( p->sync_byte(), TRANSPORT_PACKET_SYNC_BYTE ); - BOOST_CHECK( ! p->transport_error_indicator() ); - BOOST_CHECK( p->pusi() ); - BOOST_CHECK( ! p->transport_priority() ); - BOOST_CHECK_EQUAL( p->pid(), 0x010fu ); - BOOST_CHECK_EQUAL( p->transport_scrmbl_ctrl(), 0x0u ); - BOOST_CHECK_EQUAL( p->adaptation_field_ctrl(), 0x1u ); - BOOST_CHECK_EQUAL( p->continuity_counter(), 0x0eu ); + BOOST_CHECK_EQUAL( senf::Parse_GREPacket::init_bytes+0u, 4u ); + //BOOST_CHECK_EQUAL( p->bytes(), 4u ); } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/Packets/ParseHelpers.ih b/Packets/ParseHelpers.ih index 38595ed..56bda6a 100644 --- a/Packets/ParseHelpers.ih +++ b/Packets/ParseHelpers.ih @@ -142,7 +142,8 @@ # define SENF_PARSER_I_FIELD_OFS_var(name, type, access) \ size_type BOOST_PP_CAT(name,_offset)() const { \ return field_offset_(static_cast*>(0)); \ - } + } \ + static size_type const BOOST_PP_CAT(name, _init_bytes) = SENF_MPL_SLOT_GET(init_bytes); # # define SENF_PARSER_I_FIELD_OFS_fix(name, type, access) \ static size_type const BOOST_PP_CAT(name, _offset) = SENF_MPL_SLOT_GET(offset); @@ -161,7 +162,6 @@ size_type BOOST_PP_CAT(name, _next_offset)() const { \ return BOOST_PP_CAT(name,_offset)() + size; \ } \ - static size_type const BOOST_PP_CAT(name, _init_bytes) = SENF_MPL_SLOT_GET(init_bytes); \ static size_type const BOOST_PP_CAT(name, _next_init_bytes) = \ BOOST_PP_CAT(name, _init_bytes) + isize; \ private: \ @@ -211,22 +211,22 @@ # // SENF_PARSER_BITFIELD_* # // SENF_PARSER_P_BITFIELD_* # -# define SENF_PARSER_BITFIELD_var(name, bits, type) \ +# define SENF_PARSER_BITFIELD_var(name, bits, type) \ SENF_PARSER_BITFIELD_I(name, bits, type, var, rw, public) -# define SENF_PARSER_BITFIELD_RO_var(name, bits, type) \ +# define SENF_PARSER_BITFIELD_RO_var(name, bits, type) \ SENF_PARSER_BITFIELD_I(name, bits, type, var, ro, public) -# define SENF_PARSER_BITFIELD_fix(name, bits, type) \ +# define SENF_PARSER_BITFIELD_fix(name, bits, type) \ SENF_PARSER_BITFIELD_I(name, bits, type, fix, rw, public) -# define SENF_PARSER_BITFIELD_RO_fix(name, bits, type) \ +# define SENF_PARSER_BITFIELD_RO_fix(name, bits, type) \ SENF_PARSER_BITFIELD_I(name, bits, type, fix, ro, public) # -# define SENF_PARSER_P_BITFIELD_var(name, bits, type) \ +# 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) \ +# 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) \ +# 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) \ +# define SENF_PARSER_P_BITFIELD_RO_fix(name, bits, type) \ SENF_PARSER_BITFIELD_I(name, bits, type, fix, ro, private) # # //////////////////////////////////////// @@ -268,7 +268,9 @@ size_type BOOST_PP_CAT(name,_offset)() const { \ return field_offset_(static_cast*>(0)) \ - SENF_MPL_SLOT_GET(bitfield_size); \ - } + } \ + static size_type const BOOST_PP_CAT(name, _init_bytes) = SENF_MPL_SLOT_GET(init_bytes) \ + - SENF_MPL_SLOT_GET(bitfield_size); # # define SENF_PARSER_I_BITFIELD_OFS_fix(name, type, access) \ static size_type const BOOST_PP_CAT(name, _offset) = SENF_MPL_SLOT_GET(offset) \ @@ -334,16 +336,16 @@ SENF_PARSER_I_BITFIELD_RESET() \ SENF_PARSER_I_FIELD_INTRO(name, void, private) \ SENF_PARSER_I_FIELD_INIT_ro(name, void, private) \ - BOOST_PP_CAT( SENF_PARSER_I_GOTO_SET_OFS_, ofstype ) (name, offset, initsize) \ + BOOST_PP_CAT( SENF_PARSER_I_GOTO_SET_OFS_, ofstype ) (name, offset, initsize) \ public: # -# define SENF_PARSER_I_GOTO_SET_OFS_var(name, offs, initsize) \ +# define SENF_PARSER_I_GOTO_SET_OFS_var(name, offs, initsize) \ size_type field_offset_(senf::mpl::rv*) const { \ return offs; \ } \ SENF_MPL_SLOT_SET(init_bytes, initsize); # -# define SENF_PARSER_I_GOTO_SET_OFS_fix(name, offs, initsize) \ +# define SENF_PARSER_I_GOTO_SET_OFS_fix(name, offs, initsize) \ SENF_MPL_SLOT_SET(offset, offs); # # /////////////////////////////////////////////////////////////////////////// @@ -399,7 +401,7 @@ } \ name(data_iterator i, state_type s) : parser_base_type(i,s) {} \ private: \ - template void init(T) const { defaultInit(); } \ + template void init(T) const { defaultInit(); } \ public: \ void init() const { init(0); } # diff --git a/Packets/SConscript b/Packets/SConscript index 9be4d50..4500875 100644 --- a/Packets/SConscript +++ b/Packets/SConscript @@ -12,7 +12,7 @@ SENFSCons.StandardTargets(env) SENFSCons.Lib(env, library = 'Packets', sources = SENFSCons.GlobSources(), - LIBS = [ 'Socket', 'Utils' ]) + LIBS = [ 'Utils' ]) SENFSCons.Doxygen(env, extra_sources = [ env.Dia2Png("structure.dia") ])