GNU Radio 3.6.5.1 C++ API
digital_crc32_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 
23 #ifndef INCLUDED_DIGITAL_CRC32_BB_H
24 #define INCLUDED_DIGITAL_CRC32_BB_H
25 
26 #include <digital_api.h>
27 #include <gr_tagged_stream_block.h>
28 
29 class digital_crc32_bb;
30 
32 
33 DIGITAL_API digital_crc32_bb_sptr digital_make_crc32_bb (bool check=false, const std::string& lengthtagname="packet_len");
34 
35 /*!
36  * \brief Byte-stream CRC block
37  * \ingroup packet_operators_blk
38  *
39  * \details
40  * Input: stream of bytes, which form a packet. The first byte of the packet
41  * has a tag with key "length" and the value being the number of bytes in the
42  * packet.
43  *
44  * Output: The same bytes as incoming, but trailing a CRC32 of the packet.
45  * The tag is re-set to the new length.
46  */
48 {
49  private:
50  friend DIGITAL_API digital_crc32_bb_sptr digital_make_crc32_bb (bool check, const std::string& lengthtagname);
51 
52  bool d_check;
53 
54  digital_crc32_bb(bool check, const std::string& lengthtagname);
55 
56  public:
58 
59  int calculate_output_stream_length(const std::vector<int> &ninput_items);
60 
61  int work (int noutput_items,
62  gr_vector_int &ninput_items,
63  gr_vector_const_void_star &input_items,
64  gr_vector_void_star &output_items);
65 };
66 
67 #endif /* INCLUDED_DIGITAL_CRC32_BB_H */
68