gr::digital::header_format_default
gr::digital::header_format_base
gr::digital::header_format_counter
gnuradio/digital/header_format_default.h
std::shared_ptr< header_format_default > std::shared_ptr<header_format_default> gr::digital::header_format_default::sptr sptr gr::digital::header_format_default::sptr
uint64_t uint64_t gr::digital::header_format_default::d_access_code d_access_code gr::digital::header_format_default::d_access_code

register to hold the access code

size_t size_t gr::digital::header_format_default::d_access_code_len d_access_code_len gr::digital::header_format_default::d_access_code_len

length in bits of the access code

uint16_t uint16_t gr::digital::header_format_default::d_bps d_bps gr::digital::header_format_default::d_bps

bits/sec of payload modulation

unsigned long long unsigned long long gr::digital::header_format_default::d_data_reg d_data_reg gr::digital::header_format_default::d_data_reg

used to look for access_code

unsigned long long unsigned long long gr::digital::header_format_default::d_mask d_mask gr::digital::header_format_default::d_mask

masks access_code bits (top N bits are set where N is the number of bits in the access code)

unsigned int unsigned int gr::digital::header_format_default::d_threshold d_threshold gr::digital::header_format_default::d_threshold

how many bits may be wrong in sync vector

int int gr::digital::header_format_default::d_pkt_len d_pkt_len gr::digital::header_format_default::d_pkt_len

Length of the packet to put into the output buffer.

int int gr::digital::header_format_default::d_pkt_count d_pkt_count gr::digital::header_format_default::d_pkt_count

Number of bytes bits already received.

int int gr::digital::header_format_default::d_nbits d_nbits gr::digital::header_format_default::d_nbits

num bits processed since reset

gr::digital::header_format_default::header_format_default
(const std::string &access_code, int threshold, int bps)
header_format_default
gr::digital::header_format_default::header_format_default
const std::string & access_code
int threshold
int bps
gr::digital::header_format_default::~header_format_default
() override
~header_format_default
gr::digital::header_format_default::~header_format_default
bool bool gr::digital::header_format_default::format (int nbytes_in, const unsigned char *input, pmt::pmt_t &output, pmt::pmt_t &info) override format gr::digital::header_format_default::format format int nbytes_in const unsigned char * input pmt::pmt_t & output pmt::pmt_t & info

Creates a header from the access code and packet length and creates an output header as a PMT vector in the form:

| access code | pkt len | pkt len |

nbytes_in

The length (in bytes) of the `input` payload

input

An array of unsigned chars of the packet payload

output

A pmt::u8vector with the new header prepended onto the input data.

info

A pmt::dict containing meta data and info about the PDU (generally from the metadata portion of the input PDU). Data can be extracted from this for the header formatting or inserted.

bool bool gr::digital::header_format_default::parse (int nbits_in, const unsigned char *input, std::vector< pmt::pmt_t > &info, int &nbits_processed) override parse gr::digital::header_format_default::parse parse int nbits_in const unsigned char * input std::vector< pmt::pmt_t > & info int & nbits_processed

Parses a header of the form:

| access code | pkt len | pkt len | payload |

This is implemented as a state machine that starts off searching for the access code. Once found, the access code is used to find the start of the packet and the following header. This default header encodes the length of the payload a 16 bit integer twice. The state machine finds the header and checks that both payload length values are the same. It then goes into its final state that reads in the payload (based on the payload length) and produces a payload as a PMT u8 vector of packed bytes.

nbits_in

The number of bits in the input array.

input

The input as hard decision bits.

info

A vector of pmt::dicts to hold any meta data or info about the PDU. When parsing the header, the formatter can add info from the header into this dict. Each packet has a single PMT dictionary of info, so the vector length is the number of packets received extracted during one call to this parser function.

nbits_processed

Number of input bits actually processed; If all goes well, this is nbits_in. A premature return after a bad header could be less than this.

size_t size_t gr::digital::header_format_default::header_nbits () const override header_nbits gr::digital::header_format_default::header_nbits header_nbits

Returns the length of the formatted header in bits.

bool bool gr::digital::header_format_default::set_access_code (const std::string &access_code) set_access_code gr::digital::header_format_default::set_access_code const std::string & access_code

Updates the access code. Must be a string of 1's and 0's and <= 64 bits.

unsigned long long unsigned long long gr::digital::header_format_default::access_code () const access_code gr::digital::header_format_default::access_code

Returns the formatted access code as a 64-bit register.

void void gr::digital::header_format_default::set_threshold (unsigned int thresh=0) set_threshold gr::digital::header_format_default::set_threshold unsigned int thresh 0

Sets the threshold for number of access code bits can be in error before detection. Defaults to 0.

unsigned int unsigned int gr::digital::header_format_default::threshold () const threshold gr::digital::header_format_default::threshold

Returns threshold value for access code detection.

sptr static sptr gr::digital::header_format_default::make (const std::string &access_code, int threshold, int bps=1) make gr::digital::header_format_default::make const std::string & access_code int threshold int bps 1

Factory to create an async packet header formatter; returns an sptr to the object.

access_code

An access code that is used to find and synchronize the start of a packet. Used in the parser and in other blocks like a corr_est block that helps trigger the receiver. Can be up to 64-bits long.

threshold

How many bits can be wrong in the access code and still count as correct.

bps

The number of bits/second used in the payload's modulator.

void void gr::digital::header_format_default::enter_have_sync () override enter_have_sync gr::digital::header_format_default::enter_have_sync enter_have_sync

Access code found, start getting the header.

void void gr::digital::header_format_default::enter_have_header (int payload_len) override enter_have_header gr::digital::header_format_default::enter_have_header enter_have_header int payload_len

Header found, setup for pulling in the hard decision bits.

bool bool gr::digital::header_format_default::header_ok () override header_ok gr::digital::header_format_default::header_ok header_ok

Verify that the header is valid.

int int gr::digital::header_format_default::header_payload () override header_payload gr::digital::header_format_default::header_payload header_payload

Get info from the header; return payload length and package rest of data in d_info dictionary.

Default header formatter for PDU formatting.

Used to handle the default packet header.

See the parent class header_format_base for details of how these classes operate.

The default header created in this base class consists of an access code and the packet length. The length is encoded as a 16-bit value repeated twice:

| access code | hdr | payload |

Where the access code is <= 64 bits and hdr is:

| 0 -- 15 | 16 -- 31 | | pkt len | pkt len |

The access code and header are formatted for network byte order.

This header generator does not calculate or append a CRC to the packet. Use the CRC32 Async block for that before adding the header. The header's length will then measure the payload plus the CRC length (4 bytes for a CRC32).

The default header parser produces a PMT dictionary that contains the following keys. All formatter blocks MUST produce these two values in any dictionary.

- "payload symbols": the number of symbols in the payload. The payload decoder will have to know how this relates to the number of bits received. This block knows nothing about the payload modulation or the number of bits/symbol. Use the gr::digital::header_format_counter for that purpose.

header_format_counter

header_format_crc

header_format_ofdm

gr::digital::header_format_base
gr::digital::header_format_counter
gr::digital::header_format_default
std::enable_shared_from_this< gr::digital::header_format_base >
gr::digital::header_buffer
gr::digital::header_format_base
d_hdr_reg
d_info
d_debug_logger
d_logger
gr::digital::header_format_default
std::enable_shared_from_this< gr::digital::header_format_base >
std::shared_ptr< logger >
std::shared_ptr< pmt_base >
- gr::digital::header_format_default
  access_code
- gr::digital::header_format_default
  base
- gr::digital::header_format_default
  d_access_code
- gr::digital::header_format_default
  d_access_code_len
- gr::digital::header_format_default
  d_bps
- gr::digital::header_format_default
  d_data_reg
- gr::digital::header_format_default
  d_debug_logger
- gr::digital::header_format_default
  d_hdr_reg
- gr::digital::header_format_default
  d_info
- gr::digital::header_format_default
  d_logger
- gr::digital::header_format_default
  d_mask
- gr::digital::header_format_default
  d_nbits
- gr::digital::header_format_default
  d_pkt_count
- gr::digital::header_format_default
  d_pkt_len
- gr::digital::header_format_default
  d_state
- gr::digital::header_format_default
  d_threshold
- gr::digital::header_format_default
  enter_have_header
- gr::digital::header_format_default
  enter_have_sync
- gr::digital::header_format_default
  enter_search
- gr::digital::header_format_default
  format
- gr::digital::header_format_default
  formatter
- gr::digital::header_format_default
  header_format_base
- gr::digital::header_format_default
  header_format_default
- gr::digital::header_format_default
  header_nbits
- gr::digital::header_format_default
  header_nbytes
- gr::digital::header_format_default
  header_ok
- gr::digital::header_format_default
  header_payload
- gr::digital::header_format_default
  make
- gr::digital::header_format_default
  parse
- gr::digital::header_format_default
  set_access_code
- gr::digital::header_format_default
  set_threshold
- gr::digital::header_format_default
  sptr
- gr::digital::header_format_default
  STATE_HAVE_SYNC
- gr::digital::header_format_default
  STATE_SYNC_SEARCH
- gr::digital::header_format_default
  state_t
- gr::digital::header_format_default
  threshold
- gr::digital::header_format_default
  ~header_format_base
- gr::digital::header_format_default
  ~header_format_default