summaryrefslogtreecommitdiff
path: root/gr-digital/include/digital
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/include/digital')
-rw-r--r--gr-digital/include/digital/CMakeLists.txt40
-rw-r--r--gr-digital/include/digital/api.h33
-rw-r--r--gr-digital/include/digital/header_payload_demux.h91
-rw-r--r--gr-digital/include/digital/ofdm_frame_equalizer_vcvc.h63
-rw-r--r--gr-digital/include/digital/ofdm_serializer_vcc.h91
-rw-r--r--gr-digital/include/digital/packet_header_default.h114
-rw-r--r--gr-digital/include/digital/packet_header_ofdm.h84
-rw-r--r--gr-digital/include/digital/packet_headergenerator_bb.h73
-rw-r--r--gr-digital/include/digital/packet_headerparser_b.h71
9 files changed, 660 insertions, 0 deletions
diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt
new file mode 100644
index 0000000000..1042517294
--- /dev/null
+++ b/gr-digital/include/digital/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# generate helper scripts to expand templated files
+########################################################################
+include(GrPython)
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+ api.h
+ ofdm_frame_equalizer_vcvc.h
+ ofdm_serializer_vcc.h
+ packet_header_default.h
+ packet_header_ofdm.h
+ packet_headergenerator_bb.h
+ packet_headerparser_b.h
+ header_payload_demux.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/digital
+ COMPONENT "digital_devel"
+)
+
diff --git a/gr-digital/include/digital/api.h b/gr-digital/include/digital/api.h
new file mode 100644
index 0000000000..0912f7e0d4
--- /dev/null
+++ b/gr-digital/include/digital/api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_API_H
+#define INCLUDED_DIGITAL_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_digital_EXPORTS
+# define DIGITAL_API __GR_ATTR_EXPORT
+#else
+# define DIGITAL_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_DIGITAL_API_H */
diff --git a/gr-digital/include/digital/header_payload_demux.h b/gr-digital/include/digital/header_payload_demux.h
new file mode 100644
index 0000000000..1427062d77
--- /dev/null
+++ b/gr-digital/include/digital/header_payload_demux.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/* Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_HEADER_PAYLOAD_DEMUX_H
+#define INCLUDED_DIGITAL_HEADER_PAYLOAD_DEMUX_H
+
+#include <digital/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Header/Payload demuxer.
+ * \ingroup packet_operators_blk
+ *
+ * \details
+ * This block is designed to handle packets from a bursty transmission.
+ * Input 0 takes a continuous transmission of samples.
+ * If used, input 1 is a trigger signal. In this case, a 1 on input 1
+ * is a trigger. Otherwise, a tag with the key specified in \p trigger_tag_key
+ * is used as a trigger (its value is irrelevant).
+ *
+ * Until a trigger signal is detected, all samples are dropped onto the floor.
+ * Once a trigger is detected, a total of \p header_len items are copied to output 0.
+ * The block then stalls until it receives a message on the message port
+ * \p header_data. The message must be a PMT dictionary; all key/value pairs are
+ * copied as tags to the first item of the payload (which is assumed to be the
+ * first item after the header).
+ * The value corresponding to the key specified in \p length_tag_key is read
+ * and taken as the payload length. The payload, together with the header data
+ * as tags, is then copied to output 1.
+ *
+ * If specified, \p guard_interval items are discarded before every symbol.
+ * This is useful for demuxing bursts of OFDM signals.
+ *
+ * Any tags on the input stream are copied to the corresponding output *if* they're
+ * on an item that is propagated. Note that a tag on the header items is copied to the
+ * header stream; that means the header-parsing block must handle these tags if they
+ * should go on the payload.
+ * A special case are tags on items that make up the guard interval. These are copied
+ * to the first item of the following symbol.
+ */
+ class DIGITAL_API header_payload_demux : virtual public gr_block
+ {
+ public:
+ typedef boost::shared_ptr<header_payload_demux> sptr;
+
+ /*!
+ * \param header_len Number of symbols per header
+ * \param items_per_symbol Number of items per symbol
+ * \param guard_interval Number of items between two consecutive symbols
+ * \param length_tag_key Key of the frame length tag
+ * \param trigger_tag_key Key of the trigger tag
+ * \param output_symbols Output symbols (true) or items (false)?
+ * \param itemsize Item size (bytes per item)
+ */
+ static sptr make(
+ int header_len,
+ int items_per_symbol,
+ int guard_interval=0,
+ const std::string &length_tag_key="frame_len",
+ const std::string &trigger_tag_key="",
+ bool output_symbols=false,
+ size_t itemsize=sizeof(gr_complex)
+ );
+ };
+
+ } // namespace digital
+} // namespace gr
+
+#endif /* INCLUDED_DIGITAL_HEADER_PAYLOAD_DEMUX_H */
+
diff --git a/gr-digital/include/digital/ofdm_frame_equalizer_vcvc.h b/gr-digital/include/digital/ofdm_frame_equalizer_vcvc.h
new file mode 100644
index 0000000000..21a976071d
--- /dev/null
+++ b/gr-digital/include/digital/ofdm_frame_equalizer_vcvc.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/* Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_OFDM_FRAME_EQUALIZER_VCVC_H
+#define INCLUDED_OFDM_FRAME_EQUALIZER_VCVC_H
+
+#include <digital_ofdm_equalizer_base.h>
+#include <digital/api.h>
+#include <gr_tagged_stream_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief OFDM frame equalizer
+ * \ingroup ofdm_blk
+ *
+ * Performs equalization in one or two dimensions on a tagged OFDM frame.
+ * Input: a tagged series of OFDM symbols.
+ * Output: The same as the input, but equalized.
+ */
+ class DIGITAL_API ofdm_frame_equalizer_vcvc : virtual public gr_tagged_stream_block
+ {
+ public:
+ typedef boost::shared_ptr<ofdm_frame_equalizer_vcvc> sptr;
+
+ /*!
+ * \param equalizer The equalizer object that will do the actual work
+ * \param len_tag_key Length tag key
+ * \param propagate_channel_state If true, the channel state after the last symbol
+ * will be added to the first symbol as a tag
+ */
+ static sptr make(
+ digital_ofdm_equalizer_base_sptr equalizer,
+ const std::string &len_tag_key = "frame_len",
+ bool propagate_channel_state=false
+ );
+ };
+
+ } // namespace digital
+} // namespace gr
+
+#endif /* INCLUDED_OFDM_FRAME_EQUALIZER_VCVC_H */
+
diff --git a/gr-digital/include/digital/ofdm_serializer_vcc.h b/gr-digital/include/digital/ofdm_serializer_vcc.h
new file mode 100644
index 0000000000..3893d6674e
--- /dev/null
+++ b/gr-digital/include/digital/ofdm_serializer_vcc.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/* Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_H
+#define INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_H
+
+#include <digital/api.h>
+#include <gr_tagged_stream_block.h>
+#include <digital_ofdm_carrier_allocator_cvc.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Serializes complex modulations symbols from OFDM sub-carriers
+ * \ingroup ofdm_blk
+ *
+ * This is the inverse block to the carrier_allocator_cvc. It outputs the
+ * complex data symbols as a tagged stream, discarding the pilot symbols.
+ *
+ * If given, two different tags are parsed: The first key (\p len_tag_key)
+ * specifies the number of OFDM symbols in the frame at the input. The
+ * second key (\p packet_len_tag_key) specifies the number of complex symbols
+ * that are coded into this frame. If given, this second key is then used
+ * at the output, otherwise, \p len_tag_key is used.
+ * If both are given, the packet length specifies the maximum number of
+ * output items, and the frame length specifies the exact number of
+ * consumed input items.
+ *
+ * Input: Complex vectors of length \p fft_len
+ * Output: Complex scalars, in the same order as specified in occupied_carriers.
+ */
+ class DIGITAL_API ofdm_serializer_vcc : virtual public gr_tagged_stream_block
+ {
+ public:
+ typedef boost::shared_ptr<ofdm_serializer_vcc> sptr;
+
+ /*!
+ * \param fft_len FFT length
+ * \param occupied_carriers See ofdm_carrier_allocator_cvc.
+ * \param len_tag_key The key of the tag identifying the length of the input frame in OFDM symbols.
+ * \param packet_len_tag_key The key of the tag identifying the number of complex symbols in this packet.
+ * \param symbols_skipped If the first symbol is not allocated as in \p occupied_carriers[0], set this
+ * \param input_is_shifted If the input has the DC carrier on index 0 (i.e. it is not FFT shifted), set this to false
+ */
+ static sptr make(
+ int fft_len,
+ const std::vector<std::vector<int> > &occupied_carriers,
+ const std::string &len_tag_key="frame_len",
+ const std::string &packet_len_tag_key="",
+ int symbols_skipped=0,
+ bool input_is_shifted=true
+ );
+
+ /*!
+ * \param allocator The carrier allocator block of which this shall be the inverse
+ * \param packet_len_tag_key The key of the tag identifying the number of complex symbols in this packet.
+ * \param symbols_skipped If the first symbol is not allocated as in \p occupied_carriers[0], set this
+ * \param input_is_shifted If the input has the DC carrier on index 0 (i.e. it is not FFT shifted), set this to false
+ */
+ static sptr make(
+ const digital_ofdm_carrier_allocator_cvc_sptr &allocator,
+ const std::string &packet_len_tag_key="",
+ int symbols_skipped=0,
+ bool input_is_shifted=true
+ );
+ };
+
+ } // namespace digital
+} // namespace gr
+
+#endif /* INCLUDED_DIGITAL_OFDM_SERIALIZER_VCC_H */
+
diff --git a/gr-digital/include/digital/packet_header_default.h b/gr-digital/include/digital/packet_header_default.h
new file mode 100644
index 0000000000..64804e6d6a
--- /dev/null
+++ b/gr-digital/include/digital/packet_header_default.h
@@ -0,0 +1,114 @@
+/* -*- c++ -*- */
+/* Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_PACKET_HEADER_DEFAULT_H
+#define INCLUDED_DIGITAL_PACKET_HEADER_DEFAULT_H
+
+#include <gr_tags.h>
+#include <digital/api.h>
+#include <boost/enable_shared_from_this.hpp>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Default header formatter for digital packet transmission.
+ * \ingroup packet_operators_blk
+ *
+ * \details
+ * For bursty/packetized digital transmission, packets are usually prepended
+ * with a packet header, containing the number of bytes etc.
+ * This class is not a block, but a tool to create these packet header.
+ *
+ * This is a default packet header (see header_formatter()) for a description
+ * on the header format). To create other header, derive packet header creator
+ * classes from this function.
+ *
+ * gr::digital::packet_headergenerator_bb uses header generators derived from
+ * this class to create packet headers from data streams.
+ */
+ class DIGITAL_API packet_header_default : public boost::enable_shared_from_this<gr::digital::packet_header_default>
+ {
+ public:
+ typedef boost::shared_ptr<packet_header_default> sptr;
+
+ packet_header_default(
+ long header_len,
+ const std::string &len_tag_key="packet_len",
+ const std::string &num_tag_key="packet_num",
+ int bits_per_byte=1);
+ ~packet_header_default();
+
+ sptr base() { return shared_from_this(); };
+ sptr formatter() { return shared_from_this(); };
+
+ void set_header_num(unsigned header_num) { d_header_number = header_num; };
+ long header_len() { return d_header_len; };
+ pmt::pmt_t len_tag_key() { return d_len_tag_key; };
+
+ /*!
+ * \brief Encodes the header information in the given tags into bits and places them into \p out
+ *
+ * Uses the following header format:
+ * Bits 0-11: The packet length (what was stored in the tag with key \p len_tag_key)
+ * Bits 12-27: The header number (counts up everytime this function is called)
+ * Bit 28: Even parity bit
+ * All other bits: Are set to zero
+ *
+ * If the header length is smaller than 29, bits are simply left out. For this
+ * reason, they always start with the LSB.
+ */
+ bool header_formatter(
+ long packet_len,
+ unsigned char *out,
+ const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()
+ );
+
+ /*!
+ * \brief Inverse function to header_formatter().
+ *
+ * Reads the bit stream in and writes a corresponding tag into \p tags.
+ *
+ */
+ bool header_parser(
+ const unsigned char *header,
+ std::vector<gr_tag_t> &tags);
+
+ static sptr make(
+ long header_len,
+ const std::string &len_tag_key="packet_len",
+ const std::string &num_tag_key="packet_num",
+ int bits_per_byte=1);
+
+ protected:
+ long d_header_len;
+ pmt::pmt_t d_len_tag_key;
+ pmt::pmt_t d_num_tag_key;
+ int d_bits_per_byte;
+ unsigned d_header_number;
+ unsigned d_mask;
+ };
+
+ } // namespace digital
+} // namespace gr
+
+#endif /* INCLUDED_DIGITAL_PACKET_HEADER_DEFAULT_H */
+
diff --git a/gr-digital/include/digital/packet_header_ofdm.h b/gr-digital/include/digital/packet_header_ofdm.h
new file mode 100644
index 0000000000..9f70900b49
--- /dev/null
+++ b/gr-digital/include/digital/packet_header_ofdm.h
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/* Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H
+#define INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H
+
+#include <vector>
+#include <digital/api.h>
+#include <digital/packet_header_default.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Header utility for OFDM signals.
+ * \ingroup ofdm_blk
+ *
+ */
+ class DIGITAL_API packet_header_ofdm : public packet_header_default
+ {
+ public:
+ typedef boost::shared_ptr<packet_header_ofdm> sptr;
+
+ packet_header_ofdm(
+ const std::vector<std::vector<int> > &occupied_carriers,
+ int n_syms,
+ const std::string &len_tag_key="packet_len",
+ const std::string &frame_len_tag_key="frame_len",
+ const std::string &num_tag_key="packet_num",
+ int bits_per_sym=1);
+ ~packet_header_ofdm();
+
+ /*!
+ * \brief Inverse function to header_formatter().
+ *
+ * Does the same as packet_header_default::header_parser(), but
+ * adds another tag that stores the number of OFDM symbols in the
+ * packet.
+ * Note that there is usually no linear connection between the number
+ * of OFDM symbols and the packet length, because, a packet might
+ * finish mid-OFDM-symbol.
+ */
+ bool header_parser(
+ const unsigned char *header,
+ std::vector<gr_tag_t> &tags);
+
+ static sptr make(
+ const std::vector<std::vector<int> > &occupied_carriers,
+ int n_syms,
+ const std::string &len_tag_key="packet_len",
+ const std::string &frame_len_tag_key="frame_len",
+ const std::string &num_tag_key="packet_num",
+ int bits_per_sym=1);
+
+
+ protected:
+ pmt::pmt_t d_frame_len_tag_key;
+ const std::vector<std::vector<int> > d_occupied_carriers; //!< Which carriers/symbols carry data
+ int d_syms_per_set; //!< Helper variable: Total number of elements in d_occupied_carriers
+ };
+
+ } // namespace digital
+} // namespace gr
+
+#endif /* INCLUDED_DIGITAL_PACKET_HEADER_OFDM_H */
+
diff --git a/gr-digital/include/digital/packet_headergenerator_bb.h b/gr-digital/include/digital/packet_headergenerator_bb.h
new file mode 100644
index 0000000000..426f49dee5
--- /dev/null
+++ b/gr-digital/include/digital/packet_headergenerator_bb.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/* Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_PACKET_HEADERGENERATOR_BB_H
+#define INCLUDED_PACKET_HEADERGENERATOR_BB_H
+
+#include <digital/api.h>
+#include <gr_tagged_stream_block.h>
+#include <digital/packet_header_default.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Generates a header for a tagged, streamed packet.
+ * \ingroup packet_operators_blk
+ *
+ * \details
+ * Input: A tagged stream. This is consumed entirely, it is not appended
+ * to the output stream.
+ * Output: An tagged stream containing the header. The details on the header
+ * are set in a header formatter object (of type packet_header_default
+ * or a subclass thereof). If only a number of bits is specified, a
+ * default header is generated (see packet_header_default).
+ */
+ class DIGITAL_API packet_headergenerator_bb : virtual public gr_tagged_stream_block
+ {
+ public:
+ typedef boost::shared_ptr<packet_headergenerator_bb> sptr;
+
+ /* \param header_formatter A header formatter object.
+ * \param len_tag_key Length tag key. Note that for header generation,
+ * it is irrelevant which tag names are set in the
+ * formatter object, only this value is relevant!
+ */
+ static sptr make(
+ const packet_header_default::sptr &header_formatter,
+ const std::string &len_tag_key="packet_len"
+ );
+
+ /* \param header_len If this value is given, a packet_header_default
+ * object is used to generate the header. This is
+ * the number of bits per header.
+ * \param len_tag_key Length tag key.
+ */
+ static sptr make(
+ long header_len,
+ const std::string &len_tag_key = "packet_len");
+ };
+
+ } // namespace digital
+} // namespace gr
+
+#endif /* INCLUDED_PACKET_HEADERGENERATOR_BB_H */
+
diff --git a/gr-digital/include/digital/packet_headerparser_b.h b/gr-digital/include/digital/packet_headerparser_b.h
new file mode 100644
index 0000000000..cdf76f1209
--- /dev/null
+++ b/gr-digital/include/digital/packet_headerparser_b.h
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/* Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_H
+#define INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <digital/packet_header_default.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Post header metadata as a PMT
+ * \ingroup packet_operators_blk
+ *
+ * \details
+ * In a sense, this is the inverse block to packet_headergenerator_bb.
+ * The difference is, the parsed header is not output as a stream,
+ * but as a PMT dictionary, which is published to message port with
+ * the id "header_data".
+ *
+ * The dictionary consists of the tags created by the header formatter
+ * object. You should be able to use the exact same formatter object
+ * as used on the Tx side in the packet_headergenerator_bb.
+ *
+ * If only a header length is given, this block uses the default header
+ * format.
+ */
+ class DIGITAL_API packet_headerparser_b : virtual public gr_sync_block
+ {
+ public:
+ typedef boost::shared_ptr<packet_headerparser_b> sptr;
+
+ /*!
+ * \param header_formatter Header object. This should be the same as used for
+ * packet_headergenerator_bb.
+ */
+ static sptr make(const gr::digital::packet_header_default::sptr &header_formatter);
+
+ /*!
+ * \param header_len Number of bytes per header
+ * \param len_tag_key Length Tag Key
+ */
+ static sptr make(long header_len, const std::string &len_tag_key);
+ };
+
+ } // namespace digital
+} // namespace gr
+
+#endif /* INCLUDED_DIGITAL_PACKET_HEADERPARSER_B_H */
+