GNU Radio 3.7.1 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 #ifndef INCLUDED_PACKET_HEADERGENERATOR_BB_H 00023 #define INCLUDED_PACKET_HEADERGENERATOR_BB_H 00024 00025 #include <gnuradio/digital/api.h> 00026 #include <gnuradio/tagged_stream_block.h> 00027 #include <gnuradio/digital/packet_header_default.h> 00028 00029 namespace gr { 00030 namespace digital { 00031 00032 /*! 00033 * \brief Generates a header for a tagged, streamed packet. 00034 * \ingroup packet_operators_blk 00035 * 00036 * \details 00037 * Input: A tagged stream. This is consumed entirely, it is not appended 00038 * to the output stream. 00039 * Output: An tagged stream containing the header. The details on the header 00040 * are set in a header formatter object (of type packet_header_default 00041 * or a subclass thereof). If only a number of bits is specified, a 00042 * default header is generated (see packet_header_default). 00043 */ 00044 class DIGITAL_API packet_headergenerator_bb : virtual public tagged_stream_block 00045 { 00046 public: 00047 typedef boost::shared_ptr<packet_headergenerator_bb> sptr; 00048 00049 /* \param header_formatter A header formatter object. 00050 * \param len_tag_key Length tag key. Note that for header generation, 00051 * it is irrelevant which tag names are set in the 00052 * formatter object, only this value is relevant! 00053 */ 00054 static sptr make( 00055 const packet_header_default::sptr &header_formatter, 00056 const std::string &len_tag_key="packet_len" 00057 ); 00058 00059 /* \param header_len If this value is given, a packet_header_default 00060 * object is used to generate the header. This is 00061 * the number of bits per header. 00062 * \param len_tag_key Length tag key. 00063 */ 00064 static sptr make( 00065 long header_len, 00066 const std::string &len_tag_key = "packet_len"); 00067 }; 00068 00069 } // namespace digital 00070 } // namespace gr 00071 00072 #endif /* INCLUDED_PACKET_HEADERGENERATOR_BB_H */ 00073