use upstream packet header generator again
This commit is contained in:
@@ -1,20 +0,0 @@
|
|||||||
<block>
|
|
||||||
<name>Packet Header Generator</name>
|
|
||||||
<key>ieee802_11_packet_headergenerator</key>
|
|
||||||
<category>IEEE802.11</category>
|
|
||||||
<import>import ieee802_11</import>
|
|
||||||
<make>ieee802_11.packet_headergenerator($header_formatter)</make>
|
|
||||||
<param>
|
|
||||||
<name>Formatter Object</name>
|
|
||||||
<key>header_formatter</key>
|
|
||||||
<type>raw</type>
|
|
||||||
</param>
|
|
||||||
<sink>
|
|
||||||
<name>in</name>
|
|
||||||
<type>byte</type>
|
|
||||||
</sink>
|
|
||||||
<source>
|
|
||||||
<name>out</name>
|
|
||||||
<type>byte</type>
|
|
||||||
</source>
|
|
||||||
</block>
|
|
||||||
@@ -81,7 +81,6 @@ list(APPEND include_sources
|
|||||||
ofdm_preamble.h
|
ofdm_preamble.h
|
||||||
ofdm_sync_long.h
|
ofdm_sync_long.h
|
||||||
ofdm_sync_short.h
|
ofdm_sync_short.h
|
||||||
packet_headergenerator.h
|
|
||||||
wifi_signal_field.h
|
wifi_signal_field.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
/* -*- c++ -*- */
|
|
||||||
/* Copyright 2012 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* This file is part of GNU Radio
|
|
||||||
*
|
|
||||||
* GNU Radio is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* GNU Radio is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GNU Radio; see the file COPYING. If not, write to
|
|
||||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef INCLUDED_IEEE802_11_PACKET_HEADERGENERATOR_H
|
|
||||||
#define INCLUDED_IEEE802_11_PACKET_HEADERGENERATOR_H
|
|
||||||
|
|
||||||
#include <ieee802-11/api.h>
|
|
||||||
#include <gnuradio/tagged_stream_block.h>
|
|
||||||
#include <gnuradio/digital/packet_header_default.h>
|
|
||||||
|
|
||||||
namespace gr {
|
|
||||||
namespace ieee802_11 {
|
|
||||||
|
|
||||||
class IEEE802_11_API packet_headergenerator : virtual public tagged_stream_block
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef boost::shared_ptr<packet_headergenerator> sptr;
|
|
||||||
|
|
||||||
/* \param header_formatter A header formatter object.
|
|
||||||
* \param len_tag_key Length tag key. Note that for header generation,
|
|
||||||
* it is irrelevant which tag names are set in the
|
|
||||||
* formatter object, only this value is relevant!
|
|
||||||
*/
|
|
||||||
static sptr make(
|
|
||||||
const digital::packet_header_default::sptr &header_formatter,
|
|
||||||
const std::string &len_tag_key="packet_len"
|
|
||||||
);
|
|
||||||
|
|
||||||
/* \param header_len If this value is given, a packet_header_default
|
|
||||||
* object is used to generate the header. This is
|
|
||||||
* the number of bits per header.
|
|
||||||
* \param len_tag_key Length tag key.
|
|
||||||
*/
|
|
||||||
static sptr make(
|
|
||||||
long header_len,
|
|
||||||
const std::string &len_tag_key = "packet_len");
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ieee802_11
|
|
||||||
} // namespace gr
|
|
||||||
|
|
||||||
#endif /* INCLUDED_IEEE802_11_PACKET_HEADERGENERATOR_H */
|
|
||||||
|
|
||||||
@@ -113,7 +113,6 @@ list(APPEND gr_ieee802_11_sources
|
|||||||
ofdm_preamble.cc
|
ofdm_preamble.cc
|
||||||
ofdm_sync_long.cc
|
ofdm_sync_long.cc
|
||||||
ofdm_sync_short.cc
|
ofdm_sync_short.cc
|
||||||
packet_headergenerator_impl.cc
|
|
||||||
utils.cc
|
utils.cc
|
||||||
wifi_signal_field_impl.cc
|
wifi_signal_field_impl.cc
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <boost/format.hpp>
|
|
||||||
#include <gnuradio/io_signature.h>
|
|
||||||
#include "packet_headergenerator_impl.h"
|
|
||||||
|
|
||||||
using namespace gr::ieee802_11;
|
|
||||||
|
|
||||||
packet_headergenerator::sptr packet_headergenerator::make(
|
|
||||||
const digital::packet_header_default::sptr &header_formatter,
|
|
||||||
const std::string &len_tag_key) {
|
|
||||||
return gnuradio::get_initial_sptr (new packet_headergenerator_impl(header_formatter, len_tag_key));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
packet_headergenerator::sptr packet_headergenerator::make(
|
|
||||||
long header_len,
|
|
||||||
const std::string &len_tag_key) {
|
|
||||||
const digital::packet_header_default::sptr header_formatter(
|
|
||||||
new digital::packet_header_default(header_len, len_tag_key));
|
|
||||||
return gnuradio::get_initial_sptr (new packet_headergenerator_impl(header_formatter, len_tag_key));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
packet_headergenerator_impl::packet_headergenerator_impl(
|
|
||||||
const gr::digital::packet_header_default::sptr &header_formatter,
|
|
||||||
const std::string &len_tag_key
|
|
||||||
)
|
|
||||||
: tagged_stream_block("packet_headergenerator_impl",
|
|
||||||
io_signature::make(1, 1, sizeof (char)),
|
|
||||||
io_signature::make(1, 1, sizeof (char)),
|
|
||||||
len_tag_key),
|
|
||||||
d_formatter(header_formatter)
|
|
||||||
{
|
|
||||||
set_output_multiple(d_formatter->header_len());
|
|
||||||
// This is the worst case rate, because we don't know the true value, of course
|
|
||||||
set_relative_rate(d_formatter->header_len());
|
|
||||||
set_tag_propagation_policy(TPP_DONT);
|
|
||||||
}
|
|
||||||
|
|
||||||
packet_headergenerator_impl::~packet_headergenerator_impl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
packet_headergenerator_impl::work (int noutput_items,
|
|
||||||
gr_vector_int &ninput_items,
|
|
||||||
gr_vector_const_void_star &input_items,
|
|
||||||
gr_vector_void_star &output_items)
|
|
||||||
{
|
|
||||||
unsigned char *out = (unsigned char *) output_items[0];
|
|
||||||
std::vector<tag_t> all_tags;
|
|
||||||
get_tags_in_range(all_tags, 0, nitems_read(0), nitems_read(0) + ninput_items[0]);
|
|
||||||
if (!d_formatter->header_formatter(ninput_items[0], out, all_tags)) {
|
|
||||||
GR_LOG_FATAL(d_logger, boost::format("header_formatter() returned false (this shouldn't happen). Offending header started at %1%") % nitems_read(0));
|
|
||||||
throw std::runtime_error("header formatter returned false.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return d_formatter->header_len();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef INCLUDED_IEEE802_11_PACKET_HEADERGENERATOR_IMPL_H
|
|
||||||
#define INCLUDED_IEEE802_11_PACKET_HEADERGENERATOR_IMPL_H
|
|
||||||
|
|
||||||
#include <ieee802-11/packet_headergenerator.h>
|
|
||||||
|
|
||||||
namespace gr {
|
|
||||||
namespace ieee802_11 {
|
|
||||||
|
|
||||||
class packet_headergenerator_impl : public packet_headergenerator
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
gr::digital::packet_header_default::sptr d_formatter;
|
|
||||||
|
|
||||||
public:
|
|
||||||
packet_headergenerator_impl(
|
|
||||||
const digital::packet_header_default::sptr &header_formatter,
|
|
||||||
const std::string &len_tag_key
|
|
||||||
);
|
|
||||||
~packet_headergenerator_impl();
|
|
||||||
|
|
||||||
void remove_length_tags(const std::vector<std::vector<tag_t> > &tags) {};
|
|
||||||
int calculate_output_stream_length(const gr_vector_int &ninput_items) { return d_formatter->header_len(); };
|
|
||||||
|
|
||||||
int work(int noutput_items,
|
|
||||||
gr_vector_int &ninput_items,
|
|
||||||
gr_vector_const_void_star &input_items,
|
|
||||||
gr_vector_void_star &output_items);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ieee802_11
|
|
||||||
} // namespace gr
|
|
||||||
|
|
||||||
#endif /* INCLUDED_IEEE802_11_PACKET_HEADERGENERATOR_IMPL_H */
|
|
||||||
|
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
#define DIGITAL_API
|
#define DIGITAL_API
|
||||||
|
|
||||||
%include "gnuradio.i"
|
%include "gnuradio.i"
|
||||||
//%include "digital_swig.i"
|
|
||||||
|
|
||||||
%include "ieee802_11_swig_doc.i"
|
%include "ieee802_11_swig_doc.i"
|
||||||
|
|
||||||
@@ -39,7 +38,6 @@
|
|||||||
#include "ieee802-11/ofdm_preamble.h"
|
#include "ieee802-11/ofdm_preamble.h"
|
||||||
#include "ieee802-11/ofdm_sync_long.h"
|
#include "ieee802-11/ofdm_sync_long.h"
|
||||||
#include "ieee802-11/ofdm_sync_short.h"
|
#include "ieee802-11/ofdm_sync_short.h"
|
||||||
#include "ieee802-11/packet_headergenerator.h"
|
|
||||||
#include "ieee802-11/wifi_signal_field.h"
|
#include "ieee802-11/wifi_signal_field.h"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@@ -59,7 +57,6 @@
|
|||||||
%include "ieee802-11/ofdm_preamble.h"
|
%include "ieee802-11/ofdm_preamble.h"
|
||||||
%include "ieee802-11/ofdm_sync_long.h"
|
%include "ieee802-11/ofdm_sync_long.h"
|
||||||
%include "ieee802-11/ofdm_sync_short.h"
|
%include "ieee802-11/ofdm_sync_short.h"
|
||||||
%include "ieee802-11/packet_headergenerator.h"
|
|
||||||
%include "ieee802-11/wifi_signal_field.h"
|
%include "ieee802-11/wifi_signal_field.h"
|
||||||
|
|
||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, chunks_to_symbols);
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, chunks_to_symbols);
|
||||||
@@ -76,7 +73,6 @@ GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_parse_mac);
|
|||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_preamble);
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_preamble);
|
||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_long);
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_long);
|
||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_short);
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_short);
|
||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, packet_headergenerator);
|
|
||||||
|
|
||||||
%template(wifi_signal_field_sptr) boost::shared_ptr<gr::ieee802_11::wifi_signal_field>;
|
%template(wifi_signal_field_sptr) boost::shared_ptr<gr::ieee802_11::wifi_signal_field>;
|
||||||
%pythoncode %{
|
%pythoncode %{
|
||||||
|
|||||||
Reference in New Issue
Block a user