GNU Radio 3.6.5 C++ API

packet_headerparser_b.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /* Copyright 2012 Free Software Foundation, Inc.
00003  * 
00004  * This file is part of GNU Radio
00005  * 
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  * 
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_H
00023 #define INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_H
00024 
00025 #include <digital/api.h>
00026 #include <gr_sync_block.h>
00027 #include <digital/packet_header_default.h>
00028 
00029 namespace gr {
00030   namespace digital {
00031 
00032     /*!
00033      * \brief Post header metadata as a PMT
00034      * \ingroup packet_operators_blk
00035      *
00036      * \details
00037      * In a sense, this is the inverse block to packet_headergenerator_bb.
00038      * The difference is, the parsed header is not output as a stream,
00039      * but as a PMT dictionary, which is published to message port with
00040      * the id "header_data".
00041      *
00042      * The dictionary consists of the tags created by the header formatter
00043      * object. You should be able to use the exact same formatter object
00044      * as used on the Tx side in the packet_headergenerator_bb.
00045      *
00046      * If only a header length is given, this block uses the default header
00047      * format.
00048      */
00049     class DIGITAL_API packet_headerparser_b : virtual public gr_sync_block
00050     {
00051      public:
00052       typedef boost::shared_ptr<packet_headerparser_b> sptr;
00053 
00054       /*!
00055        * \param header_formatter Header object. This should be the same as used for
00056        *                         packet_headergenerator_bb.
00057        */
00058       static sptr make(const gr::digital::packet_header_default::sptr &header_formatter);
00059 
00060       /*!
00061        * \param header_len Number of bytes per header
00062        * \param len_tag_key Length Tag Key
00063        */
00064       static sptr make(long header_len, const std::string &len_tag_key);
00065     };
00066 
00067   } // namespace digital
00068 } // namespace gr
00069 
00070 #endif /* INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_H */
00071