GNU Radio's SATELLITES Package
packet_csma_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2025 Daniel Estevez <daniel@destevez.net>.
4 *
5 * This file is part of gr-satellites
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 */
9
10#ifndef INCLUDED_SATELLITES_PACKET_CSMA_IMPL_H
11#define INCLUDED_SATELLITES_PACKET_CSMA_IMPL_H
12
14
15namespace gr {
16namespace satellites {
17
19{
20private:
21 const size_t d_itemsize;
22 const pmt::pmt_t d_len_tag_key;
23 const bool d_back_to_back_priority;
24 size_t d_remaining_items = 0;
25 bool d_carrier_sense = false;
26
27 void handle_carrier_sense(const pmt::pmt_t& pmt_msg)
28 {
29 d_carrier_sense = pmt::to_bool(pmt::cdr(pmt_msg));
30 }
31
32public:
33 packet_csma_impl(size_t itemsize,
34 bool back_to_back_priority,
35 const std::string& len_tag_key);
37
38 void forecast(int noutput_items, gr_vector_int& ninput_items_required) override;
39
40 int general_work(int noutput_items,
41 gr_vector_int& ninput_items,
42 gr_vector_const_void_star& input_items,
43 gr_vector_void_star& output_items) override;
44};
45
46} // namespace satellites
47} // namespace gr
48
49#endif /* INCLUDED_SATELLITES_PACKET_CSMA_IMPL_H */
Definition: packet_csma_impl.h:19
void forecast(int noutput_items, gr_vector_int &ninput_items_required) override
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override
packet_csma_impl(size_t itemsize, bool back_to_back_priority, const std::string &len_tag_key)
Passes packets to the output only when carrier sense is not triggering.
Definition: packet_csma.h:45
Definition: ax100_decode.h:17