GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
crc_append.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2022 Daniel Estevez <daniel@destevez.net>
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_DIGITAL_CRC_APPEND_H
12 #define INCLUDED_DIGITAL_CRC_APPEND_H
13 
14 #include <gnuradio/block.h>
15 #include <gnuradio/digital/api.h>
16 
17 #include <stdint.h>
18 
19 namespace gr {
20 namespace digital {
21 
22 /*!
23  * \brief Calculates and appends a CRC to a PDU
24  * \ingroup packet_operators_blk
25  *
26  * \details
27  * The CRC append block receives a PDU, calculates the CRC of the PDU
28  * data, appends it to the PDU, and sends that as its output.
29  * It can support any CRC whose size is a multiple of 8 bits between
30  * 8 and 64 bits.
31  */
32 class DIGITAL_API crc_append : virtual public block
33 {
34 public:
35  typedef std::shared_ptr<crc_append> sptr;
36 
37  /*!
38  * \brief Build the CRC append block.
39  *
40  * \param num_bits CRC size in bits (must be a multiple of 8)
41  * \param poly CRC polynomial, in MSB-first notation
42  * \param initial_value Initial register value
43  * \param final_xor Final XOR value
44  * \param input_reflected true if the input is LSB-first, false if not
45  * \param result_reflected true if the output is LSB-first, false if not
46  * \param swap_endianness true if the CRC is stored as little-endian in the PDU,
47  false if not
48  * \param skip_header_bytes gives the number of header byte to skip in the CRC
49  calculation
50  */
51  static sptr make(unsigned num_bits,
52  uint64_t poly,
53  uint64_t initial_value,
54  uint64_t final_xor,
55  bool input_reflected,
56  bool result_reflected,
57  bool swap_endianness,
58  unsigned skip_header_bytes = 0);
59 };
60 
61 } // namespace digital
62 } // namespace gr
63 
64 #endif /* INCLUDED_DIGITAL_CRC_APPEND_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Calculates and appends a CRC to a PDU.
Definition: crc_append.h:33
static sptr make(unsigned num_bits, uint64_t poly, uint64_t initial_value, uint64_t final_xor, bool input_reflected, bool result_reflected, bool swap_endianness, unsigned skip_header_bytes=0)
Build the CRC append block.
std::shared_ptr< crc_append > sptr
Definition: crc_append.h:35
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29