1 /* -*- c++ -*- */ 2 /* 3 * Copyright 2013 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_STREAM_PDU_BASE_H 24 #define INCLUDED_STREAM_PDU_BASE_H 25 26 #include <gnuradio/basic_block.h> 27 #include <gnuradio/thread/thread.h> 28 #include <pmt/pmt.h> 29 30 class basic_block; 31 32 namespace gr { 33 namespace blocks { 34 35 class stream_pdu_base 36 { 37 public: 38 stream_pdu_base(int MTU = 10000); 39 ~stream_pdu_base(); 40 41 protected: 42 int d_fd; 43 bool d_started; 44 bool d_finished; 45 std::vector<uint8_t> d_rxbuf; 46 gr::thread::thread d_thread; 47 48 pmt::pmt_t d_port; 49 basic_block* d_blk; 50 51 void run(); 52 void send(pmt::pmt_t msg); 53 bool wait_ready(); 54 void start_rxthread(basic_block* blk, pmt::pmt_t rxport); 55 void stop_rxthread(); 56 }; 57 58 } /* namespace blocks */ 59 } /* namespace gr */ 60 61 #endif /* INCLUDED_STREAM_PDU_BASE_H */ 62