GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
The Free & Open Software Radio Ecosystem
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
12 #define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
13 
14 #include <gnuradio/digital/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace digital {
19 
20 /*!
21  * \ingroup coding_blk
22  *
23  * \brief
24  * Scramble an input stream using an LFSR.
25  *
26  * \details
27  * This block scrambles up to 8 bits per byte of the input
28  * data stream, starting at the LSB.
29  *
30  * The scrambler works by XORing the incoming bit stream by the
31  * output of the LFSR. Optionally, after \p count bits have been
32  * processed, the shift register is reset to the \p seed value.
33  * This allows processing fixed length vectors of samples.
34  *
35  * Alternatively, the LFSR can be reset using a reset tag to
36  * scramble variable length vectors. However, it cannot be reset
37  * between bytes.
38  *
39  * For details on configuring the LFSR, see gr::digital::lfsr.
40  */
42 {
43 public:
44  // gr::digital::additive_scrambler_bb::sptr
45  typedef std::shared_ptr<additive_scrambler_bb> sptr;
46 
47  /*!
48  * \brief Create additive scrambler.
49  *
50  * \param mask Polynomial mask for LFSR
51  * \param seed Initial shift register contents
52  * \param len Shift register length
53  * \param count Number of bytes after which shift register is reset, 0=never
54  * \param bits_per_byte Number of bits per byte
55  * \param reset_tag_key When a tag with this key is detected, the shift register is
56  * reset (when this is set, count is ignored!)
57  */
58  static sptr make(int mask,
59  int seed,
60  int len,
61  int count = 0,
62  int bits_per_byte = 1,
63  const std::string& reset_tag_key = "");
64 
65  virtual int mask() const = 0;
66  virtual int seed() const = 0;
67  virtual int len() const = 0;
68  virtual int count() const = 0;
69  virtual int bits_per_byte() = 0;
70 };
71 
72 } /* namespace digital */
73 } /* namespace gr */
74 
75 #endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H */
Scramble an input stream using an LFSR.
Definition: additive_scrambler_bb.h:42
virtual int len() const =0
virtual int seed() const =0
virtual int count() const =0
std::shared_ptr< additive_scrambler_bb > sptr
Definition: additive_scrambler_bb.h:45
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
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29