summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blossom2009-09-23 05:46:44 -0700
committerEric Blossom2009-09-23 05:46:44 -0700
commit6e71986985a157000cb41717cbce5b83e713e177 (patch)
treef36dec9421c4139fb28d1d465c167b8eeb27788b
parentec52b1c2e99cfa8a44943f47cad00b4c9862602b (diff)
downloadgnuradio-6e71986985a157000cb41717cbce5b83e713e177.tar.gz
gnuradio-6e71986985a157000cb41717cbce5b83e713e177.tar.bz2
gnuradio-6e71986985a157000cb41717cbce5b83e713e177.zip
Dump IF-Context packets in hex.
-rw-r--r--gr-vrt/src/vrt_source_32fc.cc59
1 files changed, 38 insertions, 21 deletions
diff --git a/gr-vrt/src/vrt_source_32fc.cc b/gr-vrt/src/vrt_source_32fc.cc
index beb5ef26d..e44902316 100644
--- a/gr-vrt/src/vrt_source_32fc.cc
+++ b/gr-vrt/src/vrt_source_32fc.cc
@@ -30,6 +30,9 @@
#include <gr_io_signature.h>
#include <missing_pkt_checker.h>
#include <iostream>
+#include <gruel/inet.h>
+#include <cstdio>
+
#define VERBOSE 1 // define to 0 or 1
@@ -67,29 +70,43 @@ rx_32fc_handler::operator()(const uint32_t *payload,
size_t n32_bit_words,
const vrt::expanded_header *hdr)
{
- int nmissing = d_checker.check(hdr);
- if (VERBOSE && nmissing != 0){
- std::cerr << "S" << nmissing;
+ if (hdr->if_data_p()){
+ int nmissing = d_checker.check(hdr);
+ if (VERBOSE && nmissing != 0){
+ std::cerr << "S" << nmissing;
+ }
+
+ // copy as many as will fit into the output buffer.
+
+ size_t n = std::min(n32_bit_words, (size_t)(d_noutput_items - *d_oo));
+ vrt::copy_net_16sc_to_host_32fc(n, payload, &d_out[*d_oo]);
+ *d_oo += n;
+
+ // if there are any left over, copy them into remainder and tell
+ // our caller we're had enough for now.
+
+ size_t r = n32_bit_words - n;
+ if (r > 0){
+ assert(d_remainder.size() == 0);
+ d_remainder.resize(r);
+ vrt::copy_net_16sc_to_host_32fc(r, &payload[n], &d_remainder[0]);
+ return false; // Stop calling us.
+ }
+
+ return true; // Keep calling us, we've got more room
}
-
- // copy as many as will fit into the output buffer.
-
- size_t n = std::min(n32_bit_words, (size_t)(d_noutput_items - *d_oo));
- vrt::copy_net_16sc_to_host_32fc(n, payload, &d_out[*d_oo]);
- *d_oo += n;
-
- // if there are any left over, copy them into remainder and tell
- // our caller we're had enough for now.
-
- size_t r = n32_bit_words - n;
- if (r > 0){
- assert(d_remainder.size() == 0);
- d_remainder.resize(r);
- vrt::copy_net_16sc_to_host_32fc(r, &payload[n], &d_remainder[0]);
- return false; // Stop calling us.
+ else if (hdr->if_context_p()){
+ // FIXME print the IF-Context packet
+ fprintf(stderr, "\nIF-Context:\n");
+ for (size_t i = 0; i < n32_bit_words; i++)
+ fprintf(stderr, "%04x: %08x\n", (unsigned int) i, ntohl(payload[i]));
+ return true;
+ }
+ else {
+ // It's most likely an Extension Data or Extension Context packet
+ // (that we don't know how to interpret...)
+ return true;
}
-
- return true; // Keep calling us, we've got more room
}