GNU Radio Manual and C++ API Reference  3.10.9.1
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  * SPDX-License-Identifier: GPL-3.0-or-later
7  *
8  */
9 
10 #ifndef INCLUDED_PACKET_HEADERGENERATOR_BB_H
11 #define INCLUDED_PACKET_HEADERGENERATOR_BB_H
12 
13 #include <gnuradio/digital/api.h>
16 
17 namespace gr {
18 namespace digital {
19 
20 /*!
21  * \brief Generates a header for a tagged, streamed packet.
22  * \ingroup packet_operators_blk
23  *
24  * \details
25  * Input: A tagged stream. This is consumed entirely, it is not appended
26  * to the output stream.
27  * Output: An tagged stream containing the header. The details on the header
28  * are set in a header formatter object (of type packet_header_default
29  * or a subclass thereof). If only a number of bits is specified, a
30  * default header is generated (see packet_header_default).
31  */
33 {
34 public:
35  typedef std::shared_ptr<packet_headergenerator_bb> sptr;
36 
37  /* \param header_formatter A header formatter object.
38  * \param len_tag_key Length tag key. Note that for header generation,
39  * it is irrelevant which tag names are set in the
40  * formatter object, only this value is relevant!
41  */
42  static sptr make(const packet_header_default::sptr& header_formatter,
43  const std::string& len_tag_key = "packet_len");
44 
45  /* \param header_len If this value is given, a packet_header_default
46  * object is used to generate the header. This is
47  * the number of bits per header.
48  * \param len_tag_key Length tag key.
49  */
50  static sptr make(long header_len, const std::string& len_tag_key = "packet_len");
51 
52  virtual void set_header_formatter(packet_header_default::sptr header_formatter) = 0;
53 };
54 
55 } // namespace digital
56 } // namespace gr
57 
58 #endif /* INCLUDED_PACKET_HEADERGENERATOR_BB_H */
std::shared_ptr< packet_header_default > sptr
Definition: packet_header_default.h:40
Generates a header for a tagged, streamed packet.
Definition: packet_headergenerator_bb.h:33
virtual void set_header_formatter(packet_header_default::sptr header_formatter)=0
std::shared_ptr< packet_headergenerator_bb > sptr
Definition: packet_headergenerator_bb.h:35
static sptr make(long header_len, const std::string &len_tag_key="packet_len")
static sptr make(const packet_header_default::sptr &header_formatter, const std::string &len_tag_key="packet_len")
Block that operates on PDUs in form of tagged streams.
Definition: tagged_stream_block.h:26
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29