GNU Radio 3.6.5 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* Copyright 2012 Free Software Foundation, Inc. 00003 * 00004 * This file is part of GNU Radio 00005 * 00006 * GNU Radio is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 3, or (at your option) 00009 * any later version. 00010 * 00011 * GNU Radio is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with GNU Radio; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 00023 #ifndef INCLUDED_DIGITAL_CRC32_BB_H 00024 #define INCLUDED_DIGITAL_CRC32_BB_H 00025 00026 #include <digital_api.h> 00027 #include <gr_tagged_stream_block.h> 00028 00029 class digital_crc32_bb; 00030 00031 typedef boost::shared_ptr<digital_crc32_bb> digital_crc32_bb_sptr; 00032 00033 DIGITAL_API digital_crc32_bb_sptr digital_make_crc32_bb (bool check=false, const std::string& lengthtagname="packet_len"); 00034 00035 /*! 00036 * \brief Byte-stream CRC block 00037 * \ingroup packet_operators_blk 00038 * 00039 * \details 00040 * Input: stream of bytes, which form a packet. The first byte of the packet 00041 * has a tag with key "length" and the value being the number of bytes in the 00042 * packet. 00043 * 00044 * Output: The same bytes as incoming, but trailing a CRC32 of the packet. 00045 * The tag is re-set to the new length. 00046 */ 00047 class DIGITAL_API digital_crc32_bb : public gr_tagged_stream_block 00048 { 00049 private: 00050 friend DIGITAL_API digital_crc32_bb_sptr digital_make_crc32_bb (bool check, const std::string& lengthtagname); 00051 00052 bool d_check; 00053 00054 digital_crc32_bb(bool check, const std::string& lengthtagname); 00055 00056 public: 00057 ~digital_crc32_bb(); 00058 00059 int calculate_output_stream_length(const std::vector<int> &ninput_items); 00060 00061 int work (int noutput_items, 00062 gr_vector_int &ninput_items, 00063 gr_vector_const_void_star &input_items, 00064 gr_vector_void_star &output_items); 00065 }; 00066 00067 #endif /* INCLUDED_DIGITAL_CRC32_BB_H */ 00068