GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
packet_headergenerator_bb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /* Copyright 2012 Free Software Foundation, Inc.
3  *
4  * This file is part of GNU Radio
5  *
6  * GNU Radio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * GNU Radio is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GNU Radio; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef INCLUDED_PACKET_HEADERGENERATOR_BB_H
23 #define INCLUDED_PACKET_HEADERGENERATOR_BB_H
24 
25 #include <gnuradio/digital/api.h>
28 
29 namespace gr {
30 namespace digital {
31 
32 /*!
33  * \brief Generates a header for a tagged, streamed packet.
34  * \ingroup packet_operators_blk
35  *
36  * \details
37  * Input: A tagged stream. This is consumed entirely, it is not appended
38  * to the output stream.
39  * Output: An tagged stream containing the header. The details on the header
40  * are set in a header formatter object (of type packet_header_default
41  * or a subclass thereof). If only a number of bits is specified, a
42  * default header is generated (see packet_header_default).
43  */
45 {
46 public:
47  typedef boost::shared_ptr<packet_headergenerator_bb> sptr;
48 
49  /* \param header_formatter A header formatter object.
50  * \param len_tag_key Length tag key. Note that for header generation,
51  * it is irrelevant which tag names are set in the
52  * formatter object, only this value is relevant!
53  */
54  static sptr make(const packet_header_default::sptr& header_formatter,
55  const std::string& len_tag_key = "packet_len");
56 
57  /* \param header_len If this value is given, a packet_header_default
58  * object is used to generate the header. This is
59  * the number of bits per header.
60  * \param len_tag_key Length tag key.
61  */
62  static sptr make(long header_len, const std::string& len_tag_key = "packet_len");
63 
64  virtual void set_header_formatter(packet_header_default::sptr header_formatter) = 0;
65 };
66 
67 } // namespace digital
68 } // namespace gr
69 
70 #endif /* INCLUDED_PACKET_HEADERGENERATOR_BB_H */
Block that operates on PDUs in form of tagged streamsOverride work to provide the signal processing i...
Definition: tagged_stream_block.h:37
Generates a header for a tagged, streamed packet.
Definition: packet_headergenerator_bb.h:44
boost::shared_ptr< packet_headergenerator_bb > sptr
Definition: packet_headergenerator_bb.h:47
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
boost::shared_ptr< packet_header_default > sptr
Definition: packet_header_default.h:53