gr-baz Package
baz_additive_scrambler_bb.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2008,2010,2012 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_BAZ_ADDITIVE_SCRAMBLER_BB_H
24#define INCLUDED_BAZ_ADDITIVE_SCRAMBLER_BB_H
25
26#include <gnuradio/sync_block.h>
27
28namespace gr {
29namespace baz {
30
31 /*!
32 * \ingroup coding_blk
33 *
34 * \brief
35 * Scramble an input stream using an LFSR.
36 *
37 * \details
38 * This block scrambles up to 8 bits per byte of the input
39 * data stream, starting at the LSB.
40 *
41 * The scrambler works by XORing the incoming bit stream by the
42 * output of the LFSR. Optionally, after \p count bits have been
43 * processed, the shift register is reset to the \p seed value.
44 * This allows processing fixed length vectors of samples.
45 *
46 * Alternatively, the LFSR can be reset using a reset tag to
47 * scramble variable length vectors. However, it cannot be reset
48 * between bytes.
49 *
50 * For details on configuring the LFSR, see gr::digital::lfsr.
51 */
52 class BAZ_API additive_scrambler_bb : virtual public gr::sync_block
53 {
54 public:
55 // gr::digital::additive_scrambler_bb::sptr
56 typedef boost::shared_ptr<additive_scrambler_bb> sptr;
57
58 /*!
59 * \brief Create additive scrambler.
60 *
61 * \param mask Polynomial mask for LFSR
62 * \param seed Initial shift register contents
63 * \param len Shift register length
64 * \param count Number of bytes after which shift register is reset, 0=never
65 * \param bits_per_byte Number of bits per byte
66 * \param reset_tag_key When a tag with this key is detected, the shift register is reset (when this is set, count is ignored!)
67 */
68 static sptr make(int mask, int seed, int len, int count=0, int bits_per_byte=1, const std::string &reset_tag_key="");
69
70 virtual int mask() const = 0;
71 virtual int seed() const = 0;
72 virtual int len() const = 0;
73 virtual int count() const = 0;
74 virtual int bits_per_byte() = 0;
75 };
76
77} /* namespace baz */
78} /* namespace gr */
79
80#endif /* INCLUDED_BAZ_ADDITIVE_SCRAMBLER_BB_H */
#define BAZ_API
Definition api.h:19
Scramble an input stream using an LFSR.
Definition baz_additive_scrambler_bb.h:53
static sptr make(int mask, int seed, int len, int count=0, int bits_per_byte=1, const std::string &reset_tag_key="")
Create additive scrambler.
virtual int mask() const =0
virtual int len() const =0
virtual int seed() const =0
boost::shared_ptr< additive_scrambler_bb > sptr
Definition baz_additive_scrambler_bb.h:56
virtual int count() const =0
Definition baz_additive_scrambler_bb.h:28