GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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(
55  const packet_header_default::sptr &header_formatter,
56  const std::string &len_tag_key="packet_len"
57  );
58 
59  /* \param header_len If this value is given, a packet_header_default
60  * object is used to generate the header. This is
61  * the number of bits per header.
62  * \param len_tag_key Length tag key.
63  */
64  static sptr make(
65  long header_len,
66  const std::string &len_tag_key = "packet_len");
67 
68  virtual void set_header_formatter(packet_header_default::sptr header_formatter)=0;
69  };
70 
71  } // namespace digital
72 } // namespace gr
73 
74 #endif /* INCLUDED_PACKET_HEADERGENERATOR_BB_H */
75 
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
Include this header to use the message passing features.
Definition: logger.h:131
boost::shared_ptr< packet_header_default > sptr
Definition: packet_header_default.h:53