diff options
author | Eric Blossom | 2010-09-25 16:08:51 -0700 |
---|---|---|
committer | Eric Blossom | 2010-09-27 14:56:43 -0700 |
commit | 18f1ab2e746c93108add92098333b90c8a3423c5 (patch) | |
tree | 2dd2c99216d0886b78b656788a512657e9f243b9 | |
parent | bb2d127c085d1bf2910407334d67cb666284cf2b (diff) | |
download | gnuradio-18f1ab2e746c93108add92098333b90c8a3423c5.tar.gz gnuradio-18f1ab2e746c93108add92098333b90c8a3423c5.tar.bz2 gnuradio-18f1ab2e746c93108add92098333b90c8a3423c5.zip |
s/unparse/pack/; s/parse/unpack/
-rw-r--r-- | vrt/include/vrt/expanded_header.h | 34 | ||||
-rw-r--r-- | vrt/lib/Makefile.am | 8 | ||||
-rw-r--r-- | vrt/lib/expanded_header.cc | 31 | ||||
-rw-r--r-- | vrt/lib/expanded_header_pack_switch_body.h (renamed from vrt/lib/expanded_header_unparse_switch_body.h) | 0 | ||||
-rw-r--r-- | vrt/lib/expanded_header_unpack_switch_body.h (renamed from vrt/lib/expanded_header_parse_switch_body.h) | 0 | ||||
-rwxr-xr-x | vrt/lib/gen_pack_switch_body.py (renamed from vrt/lib/gen_unparse_switch_body.py) | 0 | ||||
-rwxr-xr-x | vrt/lib/gen_unpack_switch_body.py (renamed from vrt/lib/gen_parse_switch_body.py) | 0 | ||||
-rw-r--r-- | vrt/lib/rx.cc | 4 |
8 files changed, 41 insertions, 36 deletions
diff --git a/vrt/include/vrt/expanded_header.h b/vrt/include/vrt/expanded_header.h index b3333a72e..299faa01e 100644 --- a/vrt/include/vrt/expanded_header.h +++ b/vrt/include/vrt/expanded_header.h @@ -77,25 +77,29 @@ namespace vrt { /*! - * \brief unparse expanded header, fill-in the words of a vrt packet header and trailer - * This method is only intended to fill the buffers with header and trailer information. - * The actual handling of the separate header, payload, trailer buffers is up to the caller. + * \brief Given contents of expanded_header, fill in the words of + * the corresponding vrt packet header and trailer. + * + * This method only fills the buffers with header and trailer + * information. The actual handling of the separate header, + * payload, trailer buffers is up to the caller. */ - static void unparse(const expanded_header *hdr, // in - size_t n32_bit_words_payload, // in - uint32_t *header, // out - size_t *n32_bit_words_header, // out - uint32_t *trailer, // out - size_t *n32_bit_words_trailer);// out + static void pack(const expanded_header *hdr, // in + size_t n32_bit_words_payload, // in + uint32_t *header, // out + size_t *n32_bit_words_header, // out + uint32_t *trailer, // out + size_t *n32_bit_words_trailer);// out /*! - * \brief parse packet, fill-in expanded header, start of payload and len of payload + * \brief unpack vrt packet header into expanded_header, start of + * payload and len of payload */ - static bool parse(const uint32_t *packet, // in - size_t n32_bit_words_packet, // in - expanded_header *hdr, // out - const uint32_t **payload, // out - size_t *n32_bit_words_payload); // out + static bool unpack(const uint32_t *packet, // in + size_t n32_bit_words_packet, // in + expanded_header *hdr, // out + const uint32_t **payload, // out + size_t *n32_bit_words_payload); // out private: static unsigned char s_if_data[16]; diff --git a/vrt/lib/Makefile.am b/vrt/lib/Makefile.am index 4873c979d..cab0b0c96 100644 --- a/vrt/lib/Makefile.am +++ b/vrt/lib/Makefile.am @@ -43,10 +43,10 @@ libvrt_la_LDFLAGS = $(LTVERSIONFLAGS) # Private headers not needed for above the API development noinst_HEADERS = \ data_handler.h \ - expanded_header_parse_switch_body.h \ - expanded_header_unparse_switch_body.h \ + expanded_header_unpack_switch_body.h \ + expanded_header_pack_switch_body.h \ socket_rx_buffer.h EXTRA_DIST = \ - gen_parse_switch_body.py \ - gen_unparse_switch_body.py + gen_unpack_switch_body.py \ + gen_pack_switch_body.py diff --git a/vrt/lib/expanded_header.cc b/vrt/lib/expanded_header.cc index 8b22fb925..fc4bfc1c2 100644 --- a/vrt/lib/expanded_header.cc +++ b/vrt/lib/expanded_header.cc @@ -69,16 +69,17 @@ namespace vrt { return cw; } - void expanded_header::unparse(const expanded_header *h, // in - size_t n32_bit_words_payload, // in - uint32_t *header, // out - size_t *n32_bit_words_header, // out - uint32_t *trailer, // out - size_t *n32_bit_words_trailer){// out + void expanded_header::pack(const expanded_header *h, // in + size_t n32_bit_words_payload, // in + uint32_t *header, // out + size_t *n32_bit_words_header, // out + uint32_t *trailer, // out + size_t *n32_bit_words_trailer) // out + { int cw = compute_codeword(*h); //fills in the header (except word0), header length, trailer, trailer length switch (cw & 0x1f){ -#include "expanded_header_unparse_switch_body.h" +#include "expanded_header_pack_switch_body.h" } //fill in the header word 0 with the calculated length size_t n32_bit_words_packet = *n32_bit_words_header + n32_bit_words_payload + *n32_bit_words_trailer; @@ -86,11 +87,11 @@ namespace vrt { } bool - expanded_header::parse(const uint32_t *packet, // in - size_t n32_bit_words_packet, // in - expanded_header *h, // out - const uint32_t **payload, // out - size_t *n32_bit_words_payload) // out + expanded_header::unpack(const uint32_t *packet, // in + size_t n32_bit_words_packet, // in + expanded_header *h, // out + const uint32_t **payload, // out + size_t *n32_bit_words_payload) // out { size_t n32_bit_words_header = 0; size_t n32_bit_words_trailer = 0; @@ -100,7 +101,7 @@ namespace vrt { *payload = 0; *n32_bit_words_payload = 0; - // printf("parse: n32_bit_words_packet = %zd\n", n32_bit_words_packet); + // printf("unpack: n32_bit_words_packet = %zd\n", n32_bit_words_packet); if (len < 1){ // must have at least the header word h->header = 0; @@ -116,7 +117,7 @@ namespace vrt { int cw = compute_codeword(*h); switch (cw & 0x1f){ -#include "expanded_header_parse_switch_body.h" +#include "expanded_header_unpack_switch_body.h" } if (n32_bit_words_header + n32_bit_words_trailer > len) @@ -125,7 +126,7 @@ namespace vrt { *payload = p + n32_bit_words_header; *n32_bit_words_payload = len - (n32_bit_words_header + n32_bit_words_trailer); - // printf("parse: hdr = 0x%08x, cw = 0x%02x, n32_bit_words_header = %d, n32_bit_words_trailer = %d\n", + // printf("unpack: hdr = 0x%08x, cw = 0x%02x, n32_bit_words_header = %d, n32_bit_words_trailer = %d\n", // h->header, cw, n32_bit_words_header, n32_bit_words_trailer); return true; diff --git a/vrt/lib/expanded_header_unparse_switch_body.h b/vrt/lib/expanded_header_pack_switch_body.h index ca6e14989..ca6e14989 100644 --- a/vrt/lib/expanded_header_unparse_switch_body.h +++ b/vrt/lib/expanded_header_pack_switch_body.h diff --git a/vrt/lib/expanded_header_parse_switch_body.h b/vrt/lib/expanded_header_unpack_switch_body.h index 6bfaf3799..6bfaf3799 100644 --- a/vrt/lib/expanded_header_parse_switch_body.h +++ b/vrt/lib/expanded_header_unpack_switch_body.h diff --git a/vrt/lib/gen_unparse_switch_body.py b/vrt/lib/gen_pack_switch_body.py index 6c7cd01b3..6c7cd01b3 100755 --- a/vrt/lib/gen_unparse_switch_body.py +++ b/vrt/lib/gen_pack_switch_body.py diff --git a/vrt/lib/gen_parse_switch_body.py b/vrt/lib/gen_unpack_switch_body.py index d13e490b7..d13e490b7 100755 --- a/vrt/lib/gen_parse_switch_body.py +++ b/vrt/lib/gen_unpack_switch_body.py diff --git a/vrt/lib/rx.cc b/vrt/lib/rx.cc index 2d741e908..ca1be9fa4 100644 --- a/vrt/lib/rx.cc +++ b/vrt/lib/rx.cc @@ -97,8 +97,8 @@ namespace vrt { const uint32_t *payload; size_t n32_bit_words; expanded_header hdr; - if (!expanded_header::parse(word_base, word_len, - &hdr, &payload, &n32_bit_words)){ + if (!expanded_header::unpack(word_base, word_len, + &hdr, &payload, &n32_bit_words)){ if (1){ fprintf(stderr, "vrt_data_handler: malformed VRT packet!\n"); print_words(stderr, 0, word_base, word_len); |