diff options
author | Derek Kozel <derek.kozel@ettus.com> | 2016-08-24 12:22:20 -0700 |
---|---|---|
committer | Derek Kozel <derek.kozel@ettus.com> | 2016-08-24 12:46:36 -0700 |
commit | fe7fe8b6ceb21da3e3636b955f2248b511a6d146 (patch) | |
tree | 86167c125e426b62fcbc926ed0a15e5375debfde /tools/zpu-dissector | |
parent | 62f38b8f0607a70287bdfdbb0d71aff9cc0e723e (diff) | |
download | uhd-fe7fe8b6ceb21da3e3636b955f2248b511a6d146.tar.gz uhd-fe7fe8b6ceb21da3e3636b955f2248b511a6d146.tar.bz2 uhd-fe7fe8b6ceb21da3e3636b955f2248b511a6d146.zip |
Combined dissectors and added Wireshark 2 support
Diffstat (limited to 'tools/zpu-dissector')
-rw-r--r-- | tools/zpu-dissector/.gitignore | 2 | ||||
-rw-r--r-- | tools/zpu-dissector/CMakeLists.txt | 96 | ||||
l--------- | tools/zpu-dissector/cmake | 1 | ||||
l--------- | tools/zpu-dissector/make-dissector-reg.py | 1 | ||||
-rw-r--r-- | tools/zpu-dissector/moduleinfo.h | 9 | ||||
-rw-r--r-- | tools/zpu-dissector/packet-zpu.c | 237 | ||||
-rw-r--r-- | tools/zpu-dissector/plugin.rc.in | 34 | ||||
-rw-r--r-- | tools/zpu-dissector/zpu_addr_names.h | 38 |
8 files changed, 0 insertions, 418 deletions
diff --git a/tools/zpu-dissector/.gitignore b/tools/zpu-dissector/.gitignore deleted file mode 100644 index 0187b3dac..000000000 --- a/tools/zpu-dissector/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -build/ -*~ diff --git a/tools/zpu-dissector/CMakeLists.txt b/tools/zpu-dissector/CMakeLists.txt deleted file mode 100644 index af5554010..000000000 --- a/tools/zpu-dissector/CMakeLists.txt +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright 2010-2013 Ettus Research LLC -# -# 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. - - -######################################################################## -# Project setup -######################################################################## -cmake_minimum_required(VERSION 2.6) -project(zpu-dissector C) -set(zpu-dissector_VERSION_MAJOR 0) -set(zpu-dissector_VERSION_MINOR 0) -enable_testing() - -#select the release build type by default to get optimization flags -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") - message(STATUS "Build type not specified: defaulting to release.") -endif(NOT CMAKE_BUILD_TYPE) -set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") - -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) - -######################################################################## -# Compiler specific setup -######################################################################## -#if(CMAKE_COMPILER_IS_GNUC AND NOT WIN32) -# #http://gcc.gnu.org/wiki/Visibility -# add_definitions(-fvisibility=visible) -#endif() - -find_package(GLIB2) -if(NOT GLIB2_FOUND) - message(FATAL_ERROR "Glib not found") -endif() - -find_package(Wireshark) -if(NOT WIRESHARK_FOUND) - message(FATAL_ERROR "Wireshark dev package not found") -endif() - - -######################################################################## -# Setup the include and linker paths -######################################################################## -include_directories( - ${CMAKE_SOURCE_DIR} - ${GLIB2_INCLUDE_DIRS} - ${WIRESHARK_INCLUDE_DIRS} -) - -#link_directories( -# ${Boost_LIBRARY_DIRS} -#) -set(CMAKE_INSTALL_LIBDIR ~/.wireshark) - -# Set component parameters -set(ZPU_DISSECTOR_INCLUDE_DIRS ${CMAKE_SOURCE_DIR} CACHE INTERNAL "" FORCE) - -set(ZPU_PLUGIN_SRC ${CMAKE_SOURCE_DIR}/packet-zpu.c) - -set(PLUGIN_C_GENERATOR ${CMAKE_SOURCE_DIR}/make-dissector-reg.py) -set(PLUGIN_C plugin.c) - -add_custom_command( - OUTPUT ${PLUGIN_C} - DEPENDS ${ZPU_PLUGIN_SRC} - COMMAND ${PLUGIN_C_GENERATOR} ${CMAKE_SOURCE_DIR} plugin ${ZPU_PLUGIN_SRC} - COMMENT "Generating ${PLUGIN_C}" -) - -add_library(zpu-plugin MODULE - ${PLUGIN_C} - moduleinfo.h - ${ZPU_PLUGIN_SRC} -) -set_target_properties(zpu-plugin PROPERTIES PREFIX "") -set_target_properties(zpu-plugin PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}") -target_link_libraries(zpu-plugin wireshark) - -install(TARGETS zpu-plugin - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/plugins NAMELINK_SKIP -) diff --git a/tools/zpu-dissector/cmake b/tools/zpu-dissector/cmake deleted file mode 120000 index ec7b5e3b5..000000000 --- a/tools/zpu-dissector/cmake +++ /dev/null @@ -1 +0,0 @@ -../chdr-dissector/cmake
\ No newline at end of file diff --git a/tools/zpu-dissector/make-dissector-reg.py b/tools/zpu-dissector/make-dissector-reg.py deleted file mode 120000 index cad30999e..000000000 --- a/tools/zpu-dissector/make-dissector-reg.py +++ /dev/null @@ -1 +0,0 @@ -../chdr-dissector/make-dissector-reg.py
\ No newline at end of file diff --git a/tools/zpu-dissector/moduleinfo.h b/tools/zpu-dissector/moduleinfo.h deleted file mode 100644 index af1b41d34..000000000 --- a/tools/zpu-dissector/moduleinfo.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifdef PACKAGE -#undef PACKAGE -#endif -#define PACKAGE "zpu" -#ifdef VERSION -#undef VERSION -#endif -#define VERSION "0.0.0.1" - diff --git a/tools/zpu-dissector/packet-zpu.c b/tools/zpu-dissector/packet-zpu.c deleted file mode 100644 index b6192c275..000000000 --- a/tools/zpu-dissector/packet-zpu.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Dissector for ZPU packets (communication with X300 firmware) - * - * Copyright 2013-2014 Ettus Research LLC - * - * 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/>. - * - */ - -/* Format of ZPU packets is defined in x300_fw_commons.h, - * x300_fw_comms_t. - * - * Reminder: - * - * uint32_t flags; (ack, error, peek, poke) - * uint32_t sequence; - * uint32_t addr; - * uint32_t data; - */ - -#include "config.h" - -#include <glib.h> -#include <epan/packet.h> -#include <ctype.h> -#include <stdio.h> -#include <endian.h> - -#include "../../host/lib/usrp/x300/x300_fw_common.h" -#include "zpu_addr_names.h" - -#define LOG_HEADER "[ZPU] " - -#ifndef min -#define min(a,b) ((a<b)?a:b) -#endif // min - -const unsigned int FW_PORT = X300_FW_COMMS_UDP_PORT; - -static int proto_zpu = -1; -static int hf_zpu_flags = -1; -static int hf_zpu_flags_ack = -1; -static int hf_zpu_flags_error = -1; -static int hf_zpu_flags_poke = -1; -static int hf_zpu_flags_peek = -1; -static int hf_zpu_seq = -1; -static int hf_zpu_addr = -1; -static int hf_zpu_data = -1; -static int hf_zpu_shmem_addr = -1; -static int hf_zpu_shmem_addr_name = -1; - -/* Subtree handles: set by register_subtree_array */ -static gint ett_zpu = -1; -static gint ett_zpu_flags = -1; -//static gint ett_zpu_shmem = -1; - -/* Forward-declare the dissector functions */ -void proto_register_zpu(void); -void proto_reg_handoff_zpu(void); -static void dissect_zpu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - -/* The dissector itself */ -static void dissect_zpu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - proto_item *item; - proto_tree *zpu_tree; - proto_item *flags_item; - proto_tree *flags_tree; - gint len; - - gboolean is_network; - gint endianness; - - if (pinfo->match_uint == FW_PORT) { - is_network = TRUE; - endianness = ENC_BIG_ENDIAN; - } - else { - is_network = FALSE; - endianness = ENC_LITTLE_ENDIAN; - } - - len = tvb_reported_length(tvb); - - col_append_str(pinfo->cinfo, COL_PROTOCOL, "/ZPU"); - /*col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "ZPU", tvb_format_text_wsp(tvb, 0, len));*/ - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "ZPU"); - - if (tree) - { - item = proto_tree_add_item(tree, proto_zpu, tvb, 0, min(16, len), ENC_NA); - - // Dissect 'flags' - if (len >= 4) - { - zpu_tree = proto_item_add_subtree(item, ett_zpu); - - flags_item = proto_tree_add_item(zpu_tree, hf_zpu_flags, tvb, 0, 4, endianness); - flags_tree = proto_item_add_subtree(flags_item, ett_zpu_flags); - - proto_tree_add_item(flags_tree, hf_zpu_flags_ack, tvb, 0, 4, ENC_NA); - proto_tree_add_item(flags_tree, hf_zpu_flags_error, tvb, 0, 4, ENC_NA); - proto_tree_add_item(flags_tree, hf_zpu_flags_poke, tvb, 0, 4, ENC_NA); - proto_tree_add_item(flags_tree, hf_zpu_flags_peek, tvb, 0, 4, ENC_NA); - - // Dissect 'sequence number' - if (len >= 8) - { - proto_tree_add_item(zpu_tree, hf_zpu_seq, tvb, 4, 4, ENC_NA); - - // Dissect 'address' - if (len >= 12) - { - proto_tree_add_item(zpu_tree, hf_zpu_addr, tvb, 8, 4, ENC_NA); - - guint8 *bytes = tvb_get_string(tvb, 8, 4); - unsigned int addr = 0; - memcpy(&addr, bytes, 4); - /* TODO proper endianness handling */ - addr = (addr >> 24) | ((addr & 0x00FF0000) >> 8) | ((addr & 0x0000FF00) << 8) | ((addr & 0x000000FF) << 24); - /* TODO check the actual size of shmem instead of this constant */ - if (addr >= X300_FW_SHMEM_BASE && addr <= X300_FW_SHMEM_BASE + 0x2000) - { - proto_item *shmem_addr_item = NULL; - - // Convert the address to a register number (32-bit registers == 4-byte registers) - addr -= X300_FW_SHMEM_BASE; - addr /= 4; - - shmem_addr_item = proto_tree_add_uint(zpu_tree, hf_zpu_shmem_addr, tvb, 8, 4, addr); - proto_item_append_text(shmem_addr_item, ", Register name: %s", - val_to_str(addr, X300_SHMEM_NAMES, "Unknown (0x%04x)") - ); - - } - - // Dissect 'data' - if (len >= 16) - { - proto_tree_add_item(zpu_tree, hf_zpu_data, tvb, 12, 4, ENC_NA); - } - } - } - } - } -} - -void proto_register_zpu(void) -{ - static hf_register_info hf[] = { - { &hf_zpu_flags, - { "Flags", "zpu.flags", - FT_UINT32, BASE_HEX, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_zpu_flags_ack, - { "ACK", "zpu.flags.ack", - FT_BOOLEAN, BASE_NONE, - NULL, 0x1, - NULL, HFILL } - }, - { &hf_zpu_flags_error, - { "Error", "zpu.flags.error", - FT_BOOLEAN, BASE_NONE, - NULL, 0x2, - NULL, HFILL } - }, - { &hf_zpu_flags_poke, - { "Poke", "zpu.flags.poke", - FT_BOOLEAN, BASE_NONE, - NULL, 0x4, - NULL, HFILL } - }, - { &hf_zpu_flags_peek, - { "Peek", "zpu.flags.peek", - FT_BOOLEAN, BASE_NONE, - NULL, 0x8, - NULL, HFILL } - }, - { &hf_zpu_seq, - { "Sequence ID", "zpu.seq", - FT_UINT32, BASE_HEX, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_zpu_addr, - { "Address", "zpu.addr", - FT_UINT32, BASE_HEX, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_zpu_shmem_addr, - { "SHMEM section", "zpu.shmem", - FT_UINT32, BASE_DEC, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_zpu_data, - { "Data", "zpu.data", - FT_UINT32, BASE_HEX, - NULL, 0x0, - NULL, HFILL } - }, - }; - - static gint *ett[] = { - &ett_zpu, - &ett_zpu_flags, - //&ett_zpu_shmem - }; - - proto_zpu = proto_register_protocol("ZPU FW", "ZPU", "zpu"); - proto_register_field_array(proto_zpu, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - register_dissector("zpu", dissect_zpu, proto_zpu); -} - -/* Handler registration */ -void proto_reg_handoff_zpu(void) -{ - /* register dissector for UDP packets */ - static dissector_handle_t zpu_handle; - zpu_handle = create_dissector_handle(dissect_zpu, proto_zpu); - dissector_add_uint("udp.port", FW_PORT, zpu_handle); -} diff --git a/tools/zpu-dissector/plugin.rc.in b/tools/zpu-dissector/plugin.rc.in deleted file mode 100644 index f9d714704..000000000 --- a/tools/zpu-dissector/plugin.rc.in +++ /dev/null @@ -1,34 +0,0 @@ -#include "winver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION @RC_MODULE_VERSION@ - PRODUCTVERSION @RC_VERSION@ - FILEFLAGSMASK 0x0L -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0 -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Ettus Research LLC\0" - VALUE "FileDescription", "@PACKAGE@ dissector\0" - VALUE "FileVersion", "@MODULE_VERSION@\0" - VALUE "InternalName", "@PACKAGE@ @MODULE_VERSION@\0" - VALUE "LegalCopyright", "Copyright © 2013 Ettus Research LLC\0" - VALUE "OriginalFilename", "@PLUGIN_NAME@.dll\0" - VALUE "ProductName", "Wireshark\0" - VALUE "ProductVersion", "@VERSION@\0" - VALUE "Comments", "Build with @MSVC_VARIANT@\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/tools/zpu-dissector/zpu_addr_names.h b/tools/zpu-dissector/zpu_addr_names.h deleted file mode 100644 index ebbf423ed..000000000 --- a/tools/zpu-dissector/zpu_addr_names.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Dissector for ZPU packets (communication with X300 firmware) - * - * Copyright 2013-2014 Ettus Research LLC - * - * 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/>. - * - */ - -/* TODO: autogenerate this file */ - -/* Names of SHMEM registers: */ -static const value_string X300_SHMEM_NAMES[] = { - { 0, "X300_FW_SHMEM_COMPAT_NUM" }, - { 1, "X300_FW_SHMEM_GPSDO_STATUS" }, - { 2, "X300_FW_SHMEM_UART_RX_INDEX" }, - { 3, "X300_FW_SHMEM_UART_TX_INDEX" }, - { 5, "X300_FW_SHMEM_CLAIM_STATUS" }, - { 6, "X300_FW_SHMEM_CLAIM_TIME" }, - { 7, "X300_FW_SHMEM_CLAIM_SRC" }, - { 8, "X300_FW_SHMEM_UART_RX_ADDR" }, - { 9, "X300_FW_SHMEM_UART_TX_ADDR" }, - { 10, "X300_FW_SHMEM_UART_WORDS32" }, - { 11, "X300_FW_SHMEM_ROUTE_MAP_ADDR" }, - { 12, "X300_FW_SHMEM_ROUTE_MAP_LEN" } -}; - |