GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
protocol_formatter_bb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2016 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 
12 #ifndef INCLUDED_DIGITAL_PROTOCOL_FORMATTER_BB_H
13 #define INCLUDED_DIGITAL_PROTOCOL_FORMATTER_BB_H
14 
15 #include <gnuradio/digital/api.h>
18 
19 namespace gr {
20 namespace digital {
21 
22 /*!
23  * \brief Uses a header format object to create a header from a
24  * tagged stream packet.
25  *
26  * \ingroup packet_operators_blk
27  *
28  * \details
29  * This block takes in tagged stream and creates a header,
30  * generally for MAC-level processing. Each received tagged stream
31  * is assumed to be its own frame, so any fragmentation would be
32  * done upstream in or before the flowgraph.
33  *
34  * The header that is created and transmitted from this block. The
35  * payload should then be sent as a parallel tagged stream to be
36  * muxed together later. The header is based entirely on the \p
37  * format object, which is an object derived from the
38  * header_format_base class. All of these packet header format
39  * objects operate the same: they take in the payload data as well
40  * as possible extra metadata info about the PDU; the format
41  * object then returns the output and metadata info. This block
42  * then transmits the header vector and attaches and metadata as
43  * tags at the start of the header.
44  *
45  * \sa protocol_formatter_async
46  */
48 {
49 public:
50  typedef std::shared_ptr<protocol_formatter_bb> sptr;
51 
52  /*!
53  * Make a packet header block using a given \p format.
54  *
55  * \param format The format object to use when creating the
56  * header for the packet. Derived from the
57  * header_format_base class.
58  * \param len_tag_key The tagged stream length key.
59  */
60  static sptr make(const header_format_base::sptr& format,
61  const std::string& len_tag_key = "packet_len");
62 
63  virtual void set_header_format(header_format_base::sptr& format) = 0;
64 };
65 
66 } // namespace digital
67 } // namespace gr
68 
69 #endif /* INCLUDED_DIGITAL_PROTOCOL_FORMATTER_BB_H */
std::shared_ptr< header_format_base > sptr
Definition: header_format_base.h:114
Uses a header format object to create a header from a tagged stream packet.
Definition: protocol_formatter_bb.h:48
virtual void set_header_format(header_format_base::sptr &format)=0
std::shared_ptr< protocol_formatter_bb > sptr
Definition: protocol_formatter_bb.h:50
static sptr make(const header_format_base::sptr &format, 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