From 47f31f3f91712ec3a4bea9abe6fcd6e23a3e3c92 Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Sat, 21 Feb 2009 22:22:16 +0000 Subject: Incorporate plugin dissector into build in collection. svn path=/trunk/; revision=27495 --- AUTHORS | 6 +- Makefile.am | 1 - configure.in | 1 - epan/dissectors/Makefile.common | 1 + epan/dissectors/packet-sbus.c | 1661 +++++++++++++++++++++++++++++++++++++++ packaging/nsis/Makefile.nmake | 1 - packaging/nsis/wireshark.nsi | 1 - plugins/Makefile.am | 1 - plugins/Makefile.nmake | 4 - plugins/sbus/AUTHORS | 3 - plugins/sbus/COPYING | 340 -------- plugins/sbus/ChangeLog | 5 - plugins/sbus/Makefile.am | 126 --- plugins/sbus/Makefile.common | 31 - plugins/sbus/Makefile.nmake | 106 --- plugins/sbus/moduleinfo.h | 17 - plugins/sbus/moduleinfo.nmake | 28 - plugins/sbus/packet-sbus.c | 1661 --------------------------------------- plugins/sbus/plugin.rc.in | 34 - 19 files changed, 1667 insertions(+), 2361 deletions(-) create mode 100644 epan/dissectors/packet-sbus.c delete mode 100644 plugins/sbus/AUTHORS delete mode 100644 plugins/sbus/COPYING delete mode 100644 plugins/sbus/ChangeLog delete mode 100644 plugins/sbus/Makefile.am delete mode 100644 plugins/sbus/Makefile.common delete mode 100644 plugins/sbus/Makefile.nmake delete mode 100644 plugins/sbus/moduleinfo.h delete mode 100644 plugins/sbus/moduleinfo.nmake delete mode 100644 plugins/sbus/packet-sbus.c delete mode 100644 plugins/sbus/plugin.rc.in diff --git a/AUTHORS b/AUTHORS index 420283b7a4..ad5fb03aa1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ - + Original Author -------- ------ @@ -2809,6 +2809,10 @@ Matthias Wenzel { DECT dissector } +Christian Durrer { + sbus dissector +} + and by: Pavel Roskin diff --git a/Makefile.am b/Makefile.am index 04e278fa4e..656cd9b1f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -263,7 +263,6 @@ plugin_ldadd = $(_CUSTOM_plugin_ldadd_) \ -dlopen plugins/rlm/rlm.la \ -dlopen plugins/rtnet/rtnet.la \ -dlopen plugins/rudp/rudp.la \ - -dlopen plugins/sbus/sbus.la \ -dlopen plugins/sercosiii/sercosiii.la \ -dlopen plugins/stats_tree/stats_tree.la \ -dlopen plugins/unistim/unistim.la \ diff --git a/configure.in b/configure.in index 215802a38b..a328e6201c 100644 --- a/configure.in +++ b/configure.in @@ -1691,7 +1691,6 @@ AC_OUTPUT( plugins/rlm/Makefile plugins/rtnet/Makefile plugins/rudp/Makefile - plugins/sbus/Makefile plugins/sercosiii/Makefile plugins/stats_tree/Makefile plugins/unistim/Makefile diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index a0be3a8725..c725aab6f9 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -142,6 +142,7 @@ ASN1_DISSECTOR_SRC = \ packet-rtse.c \ packet-s4406.c \ packet-sabp.c \ + packet-sbus.c \ packet-smrse.c \ packet-spnego.c \ packet-ulp.c \ diff --git a/epan/dissectors/packet-sbus.c b/epan/dissectors/packet-sbus.c new file mode 100644 index 0000000000..2cd607f37d --- /dev/null +++ b/epan/dissectors/packet-sbus.c @@ -0,0 +1,1661 @@ +/* packet-sbus.c + * Routines for Ether-S-Bus dissection + * Copyright 2006, Christian Durrer + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * 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 2 + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +/* Number of entries in the memeory chunk array (for conversation)*/ +#define SBUS_MEMCHUNKSIZE 20 +/* Attribut values*/ +#define SBUS_REQUEST 0x00 +#define SBUS_RESPONSE 0x01 +#define SBUS_ACKNAK 0x02 + +/*SBus command codes*/ +#define SBUS_RD_COUNTER 0x00 +#define SBUS_RD_DISPLAY_REGISTER 0x01 +#define SBUS_RD_FLAG 0x02 +#define SBUS_RD_INPUT 0x03 +#define SBUS_RD_RTC 0x04 +#define SBUS_RD_OUTPUT 0x05 +#define SBUS_RD_REGISTER 0x06 +#define SBUS_RD_TIMER 0x07 +#define SBUS_WR_COUNTER 0x0A +#define SBUS_WR_FLAG 0x0B +#define SBUS_WR_RTC 0x0C +#define SBUS_WR_OUTPUT 0x0D +#define SBUS_WR_REGISTER 0x0E +#define SBUS_WR_TIMER 0x0F +#define SBUS_RDWR_MULTI_MEDIAS 0x13 +#define SBUS_RD_PCD_STATUS_CPU0 0x14 +#define SBUS_RD_PCD_STATUS_CPU1 0x15 +#define SBUS_RD_PCD_STATUS_CPU2 0x16 +#define SBUS_RD_PCD_STATUS_CPU3 0x17 +#define SBUS_RD_PCD_STATUS_CPU4 0x18 +#define SBUS_RD_PCD_STATUS_CPU5 0x19 +#define SBUS_RD_PCD_STATUS_CPU6 0x1A +#define SBUS_RD_PCD_STATUS_OWN 0x1B +#define SBUS_RD_SBUS_STN_NBR 0x1D +#define SBUS_RD_USER_MEMORY 0x1E +#define SBUS_RD_PROGRAM_LINE 0x1F +#define SBUS_RD_PROGRAM_VERSION 0x20 +#define SBUS_RD_TEXT 0x21 +#define SBUS_RD_ACTIVE_TRANSITION 0x22 +#define SBUS_WR_USER_MEMORY 0x23 +#define SBUS_WR_PROGRAM_LINE 0x24 +#define SBUS_WR_TEXT 0x25 +#define SBUS_RUN_PROCEDURE_CPU0 0x28 +#define SBUS_RUN_PROCEDURE_CPU1 0x29 +#define SBUS_RUN_PROCEDURE_CPU2 0x2A +#define SBUS_RUN_PROCEDURE_CPU3 0x2B +#define SBUS_RUN_PROCEDURE_CPU4 0x2C +#define SBUS_RUN_PROCEDURE_CPU5 0x2D +#define SBUS_RUN_PROCEDURE_CPU6 0x2E +#define SBUS_RUN_PROCEDURE_OWN 0x2F +#define SBUS_RUN_PROCEDURE_ALL 0x30 +#define SBUS_RESTART_COLD_CPU1 0x32 +#define SBUS_RESTART_COLD_CPU2 0x33 +#define SBUS_RESTART_COLD_CPU3 0x34 +#define SBUS_RESTART_COLD_CPU4 0x35 +#define SBUS_RESTART_COLD_CPU5 0x36 +#define SBUS_RESTART_COLD_CPU6 0x37 +#define SBUS_RESTART_COLD_OWN 0x38 +#define SBUS_RESTART_COLD_ALL 0x39 +#define SBUS_STOP_PROCEDURE_CPU0 0x3C +#define SBUS_STOP_PROCEDURE_CPU1 0x3D +#define SBUS_STOP_PROCEDURE_CPU2 0x3E +#define SBUS_STOP_PROCEDURE_CPU3 0x3F +#define SBUS_STOP_PROCEDURE_CPU4 0x40 +#define SBUS_STOP_PROCEDURE_CPU5 0x41 +#define SBUS_STOP_PROCEDURE_CPU6 0x42 +#define SBUS_STOP_PROCEDURE_OWN 0x43 +#define SBUS_STOP_PROCEDURE_ALL 0x44 +#define SBUS_RD_STATUSFLAG_ACCU 0x46 +#define SBUS_RD_BYTE 0x47 +#define SBUS_RD_HALT_FAILURE_REG 0x48 +#define SBUS_RD_INDEX_REGISTER 0x49 +#define SBUS_RD_INSTRUCTION_POINTER 0x4A +#define SBUS_FIND_HISTORY 0x4B +#define SBUS_WR_STATUSFLAG_ACCU 0x50 +#define SBUS_WR_BYTE 0x51 +#define SBUS_WR_INDEX_REGISTER 0x52 +#define SBUS_WR_INSTRUCTION_POINTER 0x53 +#define SBUS_CLEAR_ALL 0x5A +#define SBUS_CLEAR_FLAGS 0x5B +#define SBUS_CLEAR_OUTPUTS 0x5C +#define SBUS_CLEAR_REGISTERS 0x5D +#define SBUS_CLEAR_TIMERS 0x5E +#define SBUS_RESTART_WARM_CPU1 0x64 +#define SBUS_RESTART_WARM_CPU2 0x65 +#define SBUS_RESTART_WARM_CPU3 0x66 +#define SBUS_RESTART_WARM_CPU4 0x67 +#define SBUS_RESTART_WARM_CPU5 0x68 +#define SBUS_RESTART_WARM_CPU6 0x69 +#define SBUS_RESTART_WARM_OWN 0x6A +#define SBUS_RESTART_WARM_ALL 0x6B +#define SBUS_CHANGE_BLOCK 0x6E +#define SBUS_CLEAR_HISTORY_FAILURE 0x6F +#define SBUS_DELETE_PROGRAM_LINE 0x70 +#define SBUS_GO_CONDITIONAL 0x71 +#define SBUS_INSERT_PROGRAM_LINE 0x72 +#define SBUS_LOCAL_CYCLE 0x73 +#define SBUS_ALL_CYCLES 0x74 +#define SBUS_MAKE_TEXT 0x75 +#define SBUS_EXECUTE_SINGLE_INSTR 0x76 +#define SBUS_SINGLE_STEP 0x77 +#define SBUS_XOB_17_INTERRUPT 0x82 +#define SBUS_XOB_18_INTERRUPT 0x83 +#define SBUS_XOB_19_INTERRUPT 0x84 +#define SBUS_RD_HANGUP_TIMEOUT 0x91 +#define SBUS_RD_DATA_BLOCK 0x96 +#define SBUS_WR_DATA_BLOCK 0x97 +#define SBUS_MAKE_DATA_BLOCK 0x98 +#define SBUS_CLEAR_DATA_BLOCK 0x99 +#define SBUS_CLEAR_TEXT 0x9A +#define SBUS_RD_BLOCK_ADDRESSES 0x9B +#define SBUS_RD_BLOCK_SIZES 0x9C +#define SBUS_RD_CURRENT_BLOCK 0x9D +#define SBUS_RD_CALL_STACK 0x9E +#define SBUS_RD_DBX 0x9F +#define SBUS_RD_USER_EEPROM_REGISTER 0xA1 +#define SBUS_WR_USER_EEPROM_REGISTER 0xA3 +#define SBUS_ERASE_FLASH 0xA5 +#define SBUS_RESTART_COLD_FLAG 0xA6 +#define SBUS_WR_SYSTEM_BUFFER 0xA7 +#define SBUS_RD_SYSTEM_BUFFER 0xA8 +#define SBUS_RD_WR_PCD_BLOCK 0xA9 +#define SBUS_GET_DIAGNOSTIC 0xAA +#define SBUS_RD_SYSTEM_INFORMATION 0xAB +#define SBUS_CHANGE_BLOCKS_ON_RUN 0xAC +#define SBUS_FLASHCARD_TELEGRAM 0xAD +#define SBUS_DOWNLOAD_FIRMWARE 0xAE +#define SBUS_WEB_SERVER_SERIAL_COMM 0xAF + +/* Bitfield in the arithmetic flags and accu*/ +#define F_ACCU (1<<0) /* Accumulator of PCD */ +#define F_ERROR (1<<1) /* Error flag of PCD */ +#define F_NEGATIVE (1<<2) /* Negative arithmetic status flag*/ +#define F_ZERO (1<<3) /* Zero arithmetic status flag */ + +/* Bitfield in the system information*/ +/*#define F_EMPTY (1<<0) always 0 */ +#define F_MEMSIZE (1<<1) /* Memory size information*/ +#define F_TRACE (1<<2) /* Trace buffer feature */ +#define F_INFO_B1 (1<<3) /* EEPROM information of slot B1*/ +#define F_INFO_B2 (1<<4) /* EEPROM information of slot B2*/ +#define F_PGU_BAUD (1<<5) /* PGU baudrate can be switched*/ + +/* Initialize the protocol and registered fields */ +static int proto_sbus = -1; +static int hf_sbus_length = -1; +static int hf_sbus_version = -1; +static int hf_sbus_protocol = -1; +static int hf_sbus_sequence = -1; +static int hf_sbus_attribut = -1; +static int hf_sbus_dest = -1; +static int hf_sbus_address = -1; +static int hf_sbus_command = -1; +static int hf_sbus_command_extension = -1; +static int hf_sbus_rcount = -1; +static int hf_sbus_wcount = -1; +static int hf_sbus_wcount_calculated = -1; +static int hf_sbus_fio_count = -1; +static int hf_sbus_addr_rtc = -1; +static int hf_sbus_addr_iof = -1; +static int hf_sbus_addr_eeprom = -1; +static int hf_sbus_addr_prog = -1; +static int hf_sbus_addr_68k = -1; +static int hf_sbus_block_type = -1; +static int hf_sbus_block_nr = -1; +static int hf_sbus_nbr_elements = -1; +static int hf_sbus_display_register = -1; +static int hf_sbus_data_rtc = -1; +static int hf_sbus_data_byte = -1; +static int hf_sbus_data_byte_hex = -1; +static int hf_sbus_data_iof = -1; +static int hf_sbus_cpu_type = -1; +static int hf_sbus_fw_version = -1; +static int hf_sbus_sysinfo_nr = -1; +static int hf_sbus_sysinfo0_1 = -1; +static int hf_sbus_sysinfo0_2 = -1; +static int hf_sbus_sysinfo0_3 = -1; +static int hf_sbus_sysinfo0_4 = -1; +static int hf_sbus_sysinfo0_5 = -1; +static int hf_sbus_sysinfo_length = -1; +static int hf_sbus_f_module_type = -1; +static int hf_sbus_harware_version = -1; +static int hf_sbus_hardware_modification = -1; +static int hf_sbus_various = -1; +static int hf_sbus_acknackcode = -1; +static int hf_sbus_cpu_status = -1; +static int hf_sbus_week_day = -1; +static int hf_sbus_date = -1; +static int hf_sbus_time = -1; +static int hf_sbus_crc = -1; +static int hf_sbus_crc_bad = -1; +static int hf_sbus_flags_accu = -1; +static int hf_sbus_flags_error = -1; +static int hf_sbus_flags_negative = -1; +static int hf_sbus_flags_zero = -1; +/* Web server telegram */ +static int hf_sbus_web_size = -1; +static int hf_sbus_web_aid = -1; +static int hf_sbus_web_seq = -1; + +/* Initialize the subtree pointers */ +static gint ett_sbus = -1; +static gint ett_sbus_ether = -1; +static gint ett_sbus_data = -1; + +/* True/False strings*/ +static const true_false_string tfs_sbus_flags= { + "Is high", + "Is low" +}; + +static const true_false_string tfs_sbus_present= { + "Is present", + "Is not present" +}; + +/* value to string definitions*/ +/* telegram types*/ +static const value_string sbus_att_vals[] = { + {0, "Request"}, + {1, "Response"}, + {2, "ACK/NAK"}, + {0, NULL} +}; +/* Block types*/ +static const value_string sbus_block_types[] = { + {0x00, "COB"}, + {0x01, "XOB"}, + {0x02, "PB"}, + {0x03, "FB"}, + {0x04, "ST"}, + {0x05, "TR"}, + {0x04, "TEXT"}, + {0x05, "DB"}, + {0x08, "SB"}, + {0, NULL} +}; +/* ACK NAK values*/ +static const value_string sbus_CPU_status[] = { + {0x43, "C"}, + {0x44, "D"}, + {0x48, "Halt"}, + {0x52, "Run"}, + {0x53, "Stop"}, + {0x58, "X, Exceptional Intermediate Status (MODEMS+)"}, + {0, NULL} +}; +/* CPU status*/ +static const value_string sbus_ack_nak_vals[] = { + {0, "ACK (Acknowledged)"}, + {1, "NAK, no reason specified"}, + {2, "NAK, because of password"}, + {3, "NAK, PGU port is in reduced protocol"}, + {4, "NAK, PGU port is already used"}, + {0, NULL} +}; +/* S-Bus commands*/ +static const value_string sbus_command_vals[] = { + {0x00, "Read counter(s)"}, + {0x01, "Read display register"}, + {0x02, "Read flag(s)"}, + {0x03, "Read input(s)"}, + {0x04, "Read real time clock"}, + {0x05, "Read output(s)"}, + {0x06, "Read register(s)"}, + {0x07, "Read timer(s)"}, + {0x0A, "Write counter(s)"}, + {0x0B, "Write flag(s)"}, + {0x0C, "Write real time clock"}, + {0x0D, "Write output(s)"}, + {0x0E, "Write register(s)"}, + {0x0F, "Write timer(s)"}, + {0x14, "Read PCD status, CPU 0"}, + {0x15, "Read PCD status, CPU 1"}, + {0x16, "Read PCD status, CPU 2"}, + {0x17, "Read PCD status, CPU 3"}, + {0x18, "Read PCD status, CPU 4"}, + {0x19, "Read PCD status, CPU 5"}, + {0x1A, "Read PCD status, CPU 6"}, + {0x1B, "Read PCD status (own)"}, + {0x1D, "Read S-Bus station number"}, + {0x1E, "Read user memory*"}, + {0x1F, "Read program line*"}, + {0x20, "Read firmware version"}, + {0x21, "Read text*"}, + {0x22, "Read active transition*"}, + {0x23, "Write user memeory*"}, + {0x24, "Write program line*"}, + {0x25, "Write text*"}, + {0x28, "Run procedure*, CPU 0"}, + {0x29, "Run procedure*, CPU 1"}, + {0x2A, "Run procedure*, CPU 2"}, + {0x2B, "Run procedure*, CPU 3"}, + {0x2C, "Run procedure*, CPU 4"}, + {0x2D, "Run procedure*, CPU 5"}, + {0x2E, "Run procedure*, CPU 6"}, + {0x2F, "Run procedure* (own CPU)"}, + {0x30, "Run procedure* (All CPUs)"}, + {0x32, "Restart cold CPU 1*"}, + {0x33, "Restart cold CPU 2*"}, + {0x34, "Restart cold CPU 3*"}, + {0x35, "Restart cold CPU 4*"}, + {0x36, "Restart cold CPU 5*"}, + {0x37, "Restart cold CPU 6*"}, + {0x38, "Restart cold own CPU*"}, + {0x39, "Restart cold all CPUs*"}, + {0x3C, "Stop procedure*, CPU 0"}, + {0x3D, "Stop procedure*, CPU 1"}, + {0x3E, "Stop procedure*, CPU 2"}, + {0x3F, "Stop procedure*, CPU 3"}, + {0x40, "Stop procedure*, CPU 4"}, + {0x41, "Stop procedure*, CPU 5"}, + {0x42, "Stop procedure*, CPU 6"}, + {0x43, "Stop procedure*, (own CPU)"}, + {0x44, "Stop procedure*, (All CPUs)"}, + {0x46, "Read arithmetic status and ACCU*"}, + {0x47, "Read byte"}, + {0x48, "Read halt failure register*"}, + {0x49, "Read index register*"}, + {0x4A, "Read instruction pointer*"}, + {0x4B, "Find history*"}, + {0x50, "Write arithmetic staus and ACCU*"}, + {0x51, "Write byte*"}, + {0x52, "Write index register"}, + {0x53, "Write instruction pointer*"}, + {0x5A, "Clear all (F, O, R, T)*"}, + {0x5B, "Clear flags*"}, + {0x5C, "Clear outputs*"}, + {0x5D, "Clear registers*"}, + {0x5E, "Clear timers*"}, + {0x64, "Restart warm CPU 1*"}, + {0x65, "Restart warm CPU 2*"}, + {0x66, "Restart warm CPU 3*"}, + {0x67, "Restart warm CPU 4*"}, + {0x68, "Restart warm CPU 5*"}, + {0x69, "Restart warm CPU 6*"}, + {0x6A, "Restart warm (own CPU)*"}, + {0x6B, "Restart warm (All CPUs)*"}, + {0x6E, "Change block*"}, + {0x6F, "Clear history failure*"}, + {0x70, "Delete program line*"}, + {0x71, "Go conditional*"}, + {0x72, "Insert program line*"}, + {0x73, "Local cycles*"}, + {0x74, "All cycles*"}, + {0x75, "Make text*"}, + {0x76, "Execute single instruction*"}, + {0x77, "Single step*"}, + {0x82, "XOB 17 interrupt"}, + {0x83, "XOB 18 interrupt"}, + {0x84, "XOB 19 interrupt"}, + {0x91, "Read hangup timeout"}, + {0x96, "Read data block"}, + {0x97, "Write data block"}, + {0x98, "Make data block*"}, + {0x99, "Clear data block*"}, + {0x9A, "Clear text*"}, + {0x9B, "Read block address"}, + {0x9C, "Read block sizes"}, + {0x9D, "Read current block*"}, + {0x9E, "Read call stack*"}, + {0x9F, "Read DBX"}, + {0xA1, "Read user EEPROM register"}, + {0xA3, "Write user EEPROM register"}, + {0xA5, "Erase flash*"}, + {0xA6, "Restart cold flag*"}, + {0xA7, "Write system buffer"}, + {0xA8, "Read system buffer"}, + {0xAA, "Get diagnostic*"}, + {0xAB, "Read system information*"}, + {0xAC, "Changes blocks on run*"}, + {0xAD, "Flashcard telegram*"}, + {0xAE, "Download FW*"}, + {0xAF, "Web server serial communication*"}, + {0, NULL} +}; + +static const value_string webserver_aid_vals[] = { + {0x01, "Partial request"}, + {0x02, "Request end"}, + {0x07, "Get Data"}, + {0x10, "Transfer OK"}, + {0x11, "Partial answer"}, + {0x12, "Last part of answer"}, + {0x13, "Server not ready"}, + {0, NULL} +}; + +static const guint crc_table[] = { + 0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef, + 0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,0x72f7,0x62d6,0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de, + 0x2462,0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485,0xa56a,0xb54b,0x8528,0x9509,0xe5ee,0xf5cf,0xc5ac,0xd58d, + 0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,0x5695,0x46b4,0xb75b,0xa77a,0x9719,0x8738,0xf7df,0xe7fe,0xd79d,0xc7bc, + 0x48c4,0x58e5,0x6886,0x78a7,0x0840,0x1861,0x2802,0x3823,0xc9cc,0xd9ed,0xe98e,0xf9af,0x8948,0x9969,0xa90a,0xb92b, + 0x5af5,0x4ad4,0x7ab7,0x6a96,0x1a71,0x0a50,0x3a33,0x2a12,0xdbfd,0xcbdc,0xfbbf,0xeb9e,0x9b79,0x8b58,0xbb3b,0xab1a, + 0x6ca6,0x7c87,0x4ce4,0x5cc5,0x2c22,0x3c03,0x0c60,0x1c41,0xedae,0xfd8f,0xcdec,0xddcd,0xad2a,0xbd0b,0x8d68,0x9d49, + 0x7e97,0x6eb6,0x5ed5,0x4ef4,0x3e13,0x2e32,0x1e51,0x0e70,0xff9f,0xefbe,0xdfdd,0xcffc,0xbf1b,0xaf3a,0x9f59,0x8f78, + 0x9188,0x81a9,0xb1ca,0xa1eb,0xd10c,0xc12d,0xf14e,0xe16f,0x1080,0x00a1,0x30c2,0x20e3,0x5004,0x4025,0x7046,0x6067, + 0x83b9,0x9398,0xa3fb,0xb3da,0xc33d,0xd31c,0xe37f,0xf35e,0x02b1,0x1290,0x22f3,0x32d2,0x4235,0x5214,0x6277,0x7256, + 0xb5ea,0xa5cb,0x95a8,0x8589,0xf56e,0xe54f,0xd52c,0xc50d,0x34e2,0x24c3,0x14a0,0x0481,0x7466,0x6447,0x5424,0x4405, + 0xa7db,0xb7fa,0x8799,0x97b8,0xe75f,0xf77e,0xc71d,0xd73c,0x26d3,0x36f2,0x0691,0x16b0,0x6657,0x7676,0x4615,0x5634, + 0xd94c,0xc96d,0xf90e,0xe92f,0x99c8,0x89e9,0xb98a,0xa9ab,0x5844,0x4865,0x7806,0x6827,0x18c0,0x08e1,0x3882,0x28a3, + 0xcb7d,0xdb5c,0xeb3f,0xfb1e,0x8bf9,0x9bd8,0xabbb,0xbb9a,0x4a75,0x5a54,0x6a37,0x7a16,0x0af1,0x1ad0,0x2ab3,0x3a92, + 0xfd2e,0xed0f,0xdd6c,0xcd4d,0xbdaa,0xad8b,0x9de8,0x8dc9,0x7c26,0x6c07,0x5c64,0x4c45,0x3ca2,0x2c83,0x1ce0,0x0cc1, + 0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8,0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0 +}; + +/* Conversion values passing structure*/ +typedef struct { + guint32 conversation; /*Conversation ID*/ + guint16 sequence; /*Sequence number of request telegram*/ +} sbus_request_key; + +typedef struct { + guint8 cmd_code; /*command code from request*/ + guint8 count; /*rcount value*/ + guint8 sysinfo; /*system information number (or command in other telegrams)*/ +} sbus_request_val; + +/* The GMemChunk base structure (for conversations)*/ +static GHashTable *sbus_request_hash = NULL; +static GMemChunk *sbus_request_keys = NULL; +static GMemChunk *sbus_request_vals = NULL; + +static guint crc_calc (guint crc, guint val) +{ + int index; + guint ncrc; + + index = (((crc >> 8) ^ val) & 0xff); + ncrc = crc_table[index] ^ ((crc << 8) & 0xffff); + + return ncrc; +} + +/* Hash functions*/ +static gint sbus_equal(gconstpointer v, gconstpointer w) +{ + sbus_request_key *v1 = (sbus_request_key *)v; + sbus_request_key *v2 = (sbus_request_key *)w; + + if (v1->conversation == v2->conversation && + v1->sequence == v2->sequence) { + return 1; + } + return 0; +} + +static guint sbus_hash(gconstpointer v) +{ + sbus_request_key *key = (sbus_request_key *)v; + guint val; + val = key->conversation + key->sequence; + return val; +} + +/*Protocol initialisation*/ +static void sbus_init_protocol(void){ + if (sbus_request_hash){ + g_hash_table_destroy(sbus_request_hash); + } + if (sbus_request_keys){ + g_mem_chunk_destroy(sbus_request_keys); + } + if (sbus_request_vals){ + g_mem_chunk_destroy(sbus_request_vals); + } + sbus_request_hash = g_hash_table_new(sbus_hash, sbus_equal); + sbus_request_keys = g_mem_chunk_new("sbus_request_keys", + sizeof(sbus_request_key), + SBUS_MEMCHUNKSIZE * sizeof(sbus_request_key), + G_ALLOC_AND_FREE); + sbus_request_vals = g_mem_chunk_new("sbus_request_vals", + sizeof(sbus_request_val), + SBUS_MEMCHUNKSIZE * sizeof(sbus_request_val), + G_ALLOC_AND_FREE); +} + +/* check whether the packet looks like SBUS or not */ +static gboolean +is_sbus_pdu(tvbuff_t *tvb) +{ + guint32 length; + + /* we need at least 8 bytes to determine whether this is sbus or + not + */ + if(tvb_length(tvb)<8){ + return FALSE; + } + + /* the length must be >= 8 bytes to accomodate the header, + it also must be <65536 to fit inside a udp packet + */ + length=tvb_get_ntohl(tvb, 0); + if ( (length<8) || (length>65535) ) { + return FALSE; + } + if (tvb_reported_length(tvb) != length) { + return FALSE; + } + + /* XXX */ + /* We should also test version and protocol but that requires + someone to look at the specification for SBUS + */ + + return TRUE; +} + +/*Dissect the telegram*/ +static int +dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + +/* Set up structures needed to add the protocol subtree and manage it */ + proto_item *ti, *et, *dt, *hi; + proto_tree *sbus_tree, *ethsbus_tree, *sbusdata_tree; + + gint i; /*for CRC calculation*/ + gint j; /*for CRC calculation*/ + gint offset; + gint sbus_eth_len; + guint sbus_crc_calc; + guint8 sbus_version; + guint8 sbus_attribut; + guint8 sbus_media_cnt; + guint8 sbus_fio_cnt; + guint8 sbus_cmd_code; + guint8 sbus_web_size; + guint8 sbus_web_aid; + guint8 sbus_web_seq; + guint8 sbus_sysinfo_number; + guint32 sbus_binarymasked; + guint32 sbus_binaries; + guint16 sbus_ack_code; + guint32 sbus_show_bin; + guint32 sbus_helper; + guint32 sbus_helper1; + guint32 sbus_helper2; + char *tmp_string; + +/* Set up conversations*/ + conversation_t *conversation = NULL; + sbus_request_key request_key, *new_request_key; + sbus_request_val *request_val = NULL; + + /* does this look like an sbus pdu? */ + if(!is_sbus_pdu(tvb)){ + return 0; + } + + conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, + pinfo->ptype, pinfo->srcport, pinfo->destport, 0); + + if (!conversation) { + /* create new conversation*/ + conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, + pinfo->ptype, pinfo->srcport, pinfo->destport, 0); + } + + request_key.conversation = conversation->index; + request_key.sequence = tvb_get_ntohs(tvb,6); + + request_val = (sbus_request_val *) g_hash_table_lookup(sbus_request_hash, + &request_key); + /* Only allocate a new hash element when it's a request*/ + sbus_attribut = tvb_get_guint8(tvb,8); + + if ( !request_val && sbus_attribut == 0 ) {/* request telegram */ + new_request_key = g_mem_chunk_alloc(sbus_request_keys); + *new_request_key = request_key; + + request_val = g_mem_chunk_alloc(sbus_request_vals); + request_val->cmd_code=tvb_get_guint8(tvb,10); + + if (((request_val->cmd_code) == SBUS_RD_USER_EEPROM_REGISTER) || + ((request_val->cmd_code) == SBUS_WR_USER_EEPROM_REGISTER)) { + request_val->count=((tvb_get_guint8(tvb,12))+1); + } else { + request_val->count=((tvb_get_guint8(tvb,11))+1); + } + + /*Enter system info*/ + if ((request_val->cmd_code) == SBUS_RD_SYSTEM_INFORMATION) { + request_val->sysinfo=(tvb_get_guint8(tvb,12)); + } else { + request_val->sysinfo=0x0; + } + + g_hash_table_insert(sbus_request_hash, new_request_key, request_val); + } +/* End of attaching data to hash table*/ + +/* Make entries in Protocol column and Info column on summary display */ + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "S-Bus"); + + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + offset = 0; + + if (check_col(pinfo->cinfo, COL_INFO)) { + switch (sbus_attribut){ + case SBUS_REQUEST: + sbus_cmd_code = tvb_get_guint8(tvb,10); + + /* Special treatment of web server request + * as is is very helpful to see more information in the packetlist */ + if (sbus_cmd_code == SBUS_WEB_SERVER_SERIAL_COMM) { + sbus_web_aid = tvb_get_guint8(tvb,12); + sbus_web_seq = tvb_get_guint8(tvb,13); + + col_add_fstr(pinfo->cinfo, COL_INFO, + "Web Server Request: %s (Seq No: %d)", + val_to_str(sbus_web_aid, + webserver_aid_vals, "Unknown Request!"), + sbus_web_seq); + } else { + /* All other requests */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "Request: %s", val_to_str(sbus_cmd_code, + sbus_command_vals, "Unknown Command!")); + } + break; + + case SBUS_RESPONSE: + /* Special treatment of web server request + * as is is very helpful to see more information in the packetlist */ + if (request_val && ((request_val->cmd_code) == SBUS_WEB_SERVER_SERIAL_COMM)) { + sbus_web_size = tvb_get_guint8(tvb,9); + sbus_web_aid = tvb_get_guint8(tvb,10); + col_add_fstr(pinfo->cinfo, COL_INFO, + "Response: %s", + val_to_str(sbus_web_aid, + webserver_aid_vals, "Unknown Request!")); + if (sbus_web_size > 1) { + sbus_web_seq = tvb_get_guint8(tvb,11); + col_append_fstr(pinfo->cinfo, COL_INFO, + " (Seq No: %d)", + sbus_web_seq); + } + } else { + col_set_str(pinfo->cinfo, COL_INFO, "Response"); + } + break; + + case SBUS_ACKNAK: + sbus_ack_code = tvb_get_ntohs(tvb,9); + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s", val_to_str(sbus_ack_code, + sbus_ack_nak_vals, + "Unknown NAK response code!")); + break; + + default: + col_set_str(pinfo->cinfo, COL_INFO, "Unknown attribute"); + break; + } + + } +/* create display subtree for the protocol */ + if (tree) { + + ti = proto_tree_add_item(tree, proto_sbus, tvb, offset, -1, FALSE); + sbus_tree = proto_item_add_subtree(ti, ett_sbus); + +/*Add subtree for Ether-S-Bus header*/ + et = proto_tree_add_text(sbus_tree, tvb, offset, 8, "Ether-S-Bus header"); + ethsbus_tree = proto_item_add_subtree(et, ett_sbus_ether); + +/* add an item to the subtree*/ + sbus_eth_len = tvb_get_ntohl(tvb,offset); + proto_tree_add_item(ethsbus_tree, + hf_sbus_length, tvb, offset, 4, FALSE); + offset += 4; + + sbus_version = tvb_get_guint8(tvb,offset); + proto_tree_add_item(ethsbus_tree, + hf_sbus_version, tvb, offset, 1, FALSE); + offset += 1; + + proto_tree_add_item(ethsbus_tree, + hf_sbus_protocol, tvb, offset, 1, FALSE); + offset += 1; + + proto_tree_add_item(ethsbus_tree, + hf_sbus_sequence, tvb, offset, 2, FALSE); + offset += 2; + +/* Continue adding stuff to the main tree*/ + sbus_attribut = tvb_get_guint8(tvb,offset); + proto_tree_add_item(sbus_tree, + hf_sbus_attribut, tvb, offset, 1, FALSE); + offset += 1; + + if (sbus_attribut == SBUS_REQUEST) { + proto_tree_add_item(sbus_tree, + hf_sbus_dest, tvb, offset, 1, FALSE); + offset += 1; + sbus_cmd_code = tvb_get_guint8(tvb,offset); + proto_tree_add_item(sbus_tree, + hf_sbus_command, tvb, offset, 1, FALSE); + offset += 1; + + switch (sbus_cmd_code) { + /*Read Counter, Register or Timer*/ + case SBUS_RD_COUNTER: + case SBUS_RD_REGISTER: + case SBUS_RD_TIMER: + sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; + proto_tree_add_uint(sbus_tree, + hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_rtc, tvb, offset, 2, FALSE); + offset += 2; + break; + + /*Read Flag, Input or Output*/ + case SBUS_RD_FLAG: + case SBUS_RD_INPUT: + case SBUS_RD_OUTPUT: + sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; + proto_tree_add_uint(sbus_tree, + hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_iof, tvb, offset, 2, FALSE); + offset += 2; + break; + + /*Write Register Timer Counter*/ + case SBUS_WR_COUNTER: + case SBUS_WR_REGISTER: + case SBUS_WR_TIMER: + sbus_media_cnt = (tvb_get_guint8(tvb,offset)); + sbus_media_cnt = ((sbus_media_cnt - 1)/4); + proto_tree_add_uint(sbus_tree, + hf_sbus_wcount_calculated, tvb, offset, + 1, sbus_media_cnt); + proto_tree_add_item(sbus_tree, + hf_sbus_wcount, tvb, offset, 1, FALSE); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_rtc, tvb, offset, 2, FALSE); + offset += 2; + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + ((sbus_media_cnt) * 4),"Data"); + + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=((sbus_media_cnt)); i>0; i--) { + proto_tree_add_item(sbusdata_tree, + hf_sbus_data_rtc, tvb, offset, + 4, FALSE); + offset += 4; + } + break; + + /* Write flags and outputs*/ + case SBUS_WR_FLAG: + case SBUS_WR_OUTPUT: + sbus_media_cnt = (tvb_get_guint8(tvb,offset)); + sbus_media_cnt = (sbus_media_cnt - 2); + proto_tree_add_uint(sbus_tree, + hf_sbus_wcount_calculated, tvb, offset, + 1, sbus_media_cnt); + proto_tree_add_item(sbus_tree, + hf_sbus_wcount, tvb, offset, 1, FALSE); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_iof, tvb, offset, 2, FALSE); + offset += 2; + sbus_fio_cnt = (tvb_get_guint8(tvb,offset)); + sbus_fio_cnt = ((sbus_fio_cnt + 1)); + proto_tree_add_uint(sbus_tree, + hf_sbus_fio_count, tvb, offset, 1, sbus_fio_cnt); + offset += 1; + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + sbus_media_cnt,"Data"); + + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=sbus_media_cnt; i>0; i--) { + sbus_helper = 1; + sbus_show_bin = 0; + sbus_binarymasked = 0x01; + sbus_binaries = tvb_get_guint8(tvb, offset); + for (j=0; j<8; j++) { + if ((sbus_binarymasked & sbus_binaries) != 0) { + sbus_show_bin = (sbus_show_bin + sbus_helper); + } + sbus_binarymasked = sbus_binarymasked<<1; + sbus_helper = 10 * sbus_helper; + } + + proto_tree_add_uint_format(sbusdata_tree, + hf_sbus_data_iof, tvb, offset, 1, sbus_show_bin, + "Binary data: %08u", sbus_show_bin); + offset += 1; + } + break; + + /* Request: Write Real time clock*/ + case SBUS_WR_RTC: + sbus_helper = tvb_get_guint8(tvb, (offset +5)); /*hours*/ + sbus_helper1 = tvb_get_guint8(tvb, (offset +6)); /*minutes*/ + sbus_helper2 = tvb_get_guint8(tvb, (offset +7)); /*seconds*/ + proto_tree_add_text(sbus_tree, tvb, (offset +5), 3, + "Time (HH:MM:SS): %02x:%02x:%02x", sbus_helper, sbus_helper1, sbus_helper2); + sbus_helper = tvb_get_guint8(tvb, (offset +2)); /*year*/ + sbus_helper1 = tvb_get_guint8(tvb, (offset +3)); /*month*/ + sbus_helper2 = tvb_get_guint8(tvb, (offset +4)); /*day*/ + proto_tree_add_text(sbus_tree, tvb, (offset +2), 3, + "Date (YY/MM/DD): %02x/%02x/%02x", sbus_helper, sbus_helper1, sbus_helper2); + sbus_helper = tvb_get_guint8(tvb, (offset)); /*year-week*/ + sbus_helper1 = tvb_get_guint8(tvb, (offset +1)); /*week-day*/ + proto_tree_add_text(sbus_tree, tvb, offset, 2, + "Calendar week: %x, Week day: %x", sbus_helper, sbus_helper1); + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + 8, "Clock data"); + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + + proto_tree_add_item(sbusdata_tree, + hf_sbus_week_day, tvb, offset, 2, FALSE); + offset += 2; + proto_tree_add_item(sbusdata_tree, + hf_sbus_date, tvb, offset, 3, FALSE); + offset += 3; + proto_tree_add_item(sbusdata_tree, + hf_sbus_time, tvb, offset, 3, FALSE); + offset += 3; + break; + + /* Read user memory or program line*/ + case SBUS_RD_USER_MEMORY: + case SBUS_RD_PROGRAM_LINE: + sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; + proto_tree_add_uint(sbus_tree, + hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_prog, tvb, offset, 3, FALSE); + offset += 3; + break; + + /*Write user memory*/ + case SBUS_WR_USER_MEMORY: + sbus_media_cnt = (tvb_get_guint8(tvb,offset)); + sbus_media_cnt = ((sbus_media_cnt - 2)/4); + proto_tree_add_uint(sbus_tree, + hf_sbus_wcount_calculated, tvb, offset, + 1, sbus_media_cnt); + proto_tree_add_item(sbus_tree, + hf_sbus_wcount, tvb, offset, 1, FALSE); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_68k, tvb, offset, 3, FALSE); + offset += 3; + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + ((sbus_media_cnt) * 4),"Program lines"); + + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=((sbus_media_cnt)); i>0; i--) { + proto_tree_add_item(sbusdata_tree, + hf_sbus_data_rtc, tvb, offset, + 4, FALSE); + offset += 4; + + } + break; + + /* Read byte*/ + case SBUS_RD_BYTE: + sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; + proto_tree_add_uint(sbus_tree, + hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_68k, tvb, offset, 3, FALSE); + offset += 3; + break; + + /* Write byte */ + case SBUS_WR_BYTE: + sbus_media_cnt = (tvb_get_guint8(tvb,offset)); + sbus_media_cnt = (sbus_media_cnt - 2); + proto_tree_add_uint(sbus_tree, + hf_sbus_wcount_calculated, tvb, offset, + 1, sbus_media_cnt); + proto_tree_add_item(sbus_tree, + hf_sbus_wcount, tvb, offset, 1, FALSE); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_68k, tvb, offset, 3, FALSE); + offset += 3; + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + ((sbus_media_cnt) * 4),"Data (bytes)"); + + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=sbus_media_cnt; i>0; i--) { + proto_tree_add_item(sbusdata_tree, + hf_sbus_data_byte, tvb, offset, + 1, FALSE); + offset += 1; + } + break; + + /*Read EEPROM register*/ + case SBUS_RD_USER_EEPROM_REGISTER: + proto_tree_add_item(sbus_tree, + hf_sbus_command_extension, tvb, offset, 1, FALSE); + offset += 1; + sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; + proto_tree_add_uint(sbus_tree, + hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_addr_eeprom, tvb, offset, 2, FALSE); + offset += 2; + break; + + /*Request for reading system info*/ + /*Syinfo 05 is not implemented as no serial baud is possible*/ + case SBUS_RD_SYSTEM_INFORMATION: + sbus_sysinfo_number = (tvb_get_guint8(tvb,13)); + proto_tree_add_item(sbus_tree, + hf_sbus_sysinfo_nr, tvb, offset, 1, FALSE); + offset += 1; + sbus_sysinfo_number = (tvb_get_guint8(tvb,14)); + proto_tree_add_item(sbus_tree, + hf_sbus_sysinfo_nr, tvb, offset, 1, FALSE); + offset += 1; + break; + + /* WebServer Request */ + case SBUS_WEB_SERVER_SERIAL_COMM: + sbus_web_size = tvb_get_guint8(tvb,offset); + proto_tree_add_item(sbus_tree, + hf_sbus_web_size, tvb, offset, + 1, sbus_web_size); + offset += 1; + + sbus_web_aid = tvb_get_guint8(tvb,offset); + proto_tree_add_item(sbus_tree, + hf_sbus_web_aid, tvb, offset, + 1, sbus_web_aid); + offset += 1; + + sbus_web_seq = tvb_get_guint8(tvb,offset); + proto_tree_add_item(sbus_tree, + hf_sbus_web_seq, tvb, offset, + 1, sbus_web_seq); + offset += 1; + + if (sbus_web_size > 1) { + dt = proto_tree_add_text(sbus_tree, tvb, offset, + (sbus_web_size - 1),"Data (bytes)"); + + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=sbus_web_size -1 ; i>0; i--) { + proto_tree_add_item(sbusdata_tree, + hf_sbus_data_byte, tvb, offset, + 1, FALSE); + offset += 1; + } + } + break; + +/*Inform that command was not dissected and add remaining length*/ + default: + if (sbus_eth_len > 13) { /*13 bytes is the minimal length of a request telegram...*/ + sbus_helper = sbus_eth_len - (offset + 2); + proto_tree_add_text(sbus_tree, tvb, offset, sbus_helper, + "This telegram isn't implemented in the dissector."); + offset = offset + sbus_helper; + } + } + } + +/* Response dissection*/ + if (sbus_attribut == SBUS_RESPONSE && request_val) { + switch (request_val->cmd_code) { + /* Response: 32 bit values*/ + case SBUS_RD_COUNTER: + case SBUS_RD_REGISTER: + case SBUS_RD_TIMER: + case SBUS_RD_USER_MEMORY: + case SBUS_RD_PROGRAM_LINE: + case SBUS_RD_USER_EEPROM_REGISTER: + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + ((request_val->count) * 4),"Data"); + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=(request_val->count); i>0; i--) { + proto_tree_add_item(sbusdata_tree, + hf_sbus_data_rtc, tvb, offset, + 4, FALSE); + offset += 4; + } + break; + + /* Response: PCD Display register*/ + case SBUS_RD_DISPLAY_REGISTER: + proto_tree_add_item(sbus_tree, + hf_sbus_display_register, tvb, offset, 4, FALSE); + offset += 4; + break; + + /* Add binary data I, O, F*/ + case SBUS_RD_FLAG: + case SBUS_RD_INPUT: + case SBUS_RD_OUTPUT: + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + (((request_val->count) + 7) / 8), "Data"); + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + + for (i=(((request_val->count) + 7) / 8); i>0; i--) { + sbus_helper = 1; + sbus_show_bin = 0; + sbus_binarymasked = 0x01; + sbus_binaries = tvb_get_guint8(tvb, offset); + for (j=0; j<8; j++){ + if ((sbus_binarymasked & sbus_binaries) != 0) { + sbus_show_bin = (sbus_show_bin + sbus_helper); + } + sbus_binarymasked = sbus_binarymasked<<1; + sbus_helper = 10 * sbus_helper; + } + + proto_tree_add_uint_format(sbusdata_tree, + hf_sbus_data_iof, tvb, offset, 1, sbus_show_bin, + "Binary data: %08u", sbus_show_bin); + offset += 1; + } + break; + + /* Response: Real time clock value*/ + case SBUS_RD_RTC: + sbus_helper = tvb_get_guint8(tvb, (offset +5)); /*hours*/ + sbus_helper1 = tvb_get_guint8(tvb, (offset +6)); /*minutes*/ + sbus_helper2 = tvb_get_guint8(tvb, (offset +7)); /*seconds*/ + proto_tree_add_text(sbus_tree, tvb, (offset +5), 3, + "Time (HH:MM:SS): %02x:%02x:%02x", sbus_helper, sbus_helper1, sbus_helper2); + sbus_helper = tvb_get_guint8(tvb, (offset +2)); /*year*/ + sbus_helper1 = tvb_get_guint8(tvb, (offset +3)); /*month*/ + sbus_helper2 = tvb_get_guint8(tvb, (offset +4)); /*day*/ + proto_tree_add_text(sbus_tree, tvb, (offset +2), 3, + "Date (YY/MM/DD): %02x/%02x/%02x", sbus_helper, sbus_helper1, sbus_helper2); + sbus_helper = tvb_get_guint8(tvb, (offset)); /*year-week*/ + sbus_helper1 = tvb_get_guint8(tvb, (offset +1)); /*week-day*/ + proto_tree_add_text(sbus_tree, tvb, offset, 2, + "Calendar week: %x, Week day: %x", sbus_helper, sbus_helper1); + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + 8, "Clock data"); + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + + proto_tree_add_item(sbusdata_tree, + hf_sbus_week_day, tvb, offset, 2, FALSE); + offset += 2; + proto_tree_add_item(sbusdata_tree, + hf_sbus_date, tvb, offset, 3, FALSE); + offset += 3; + proto_tree_add_item(sbusdata_tree, + hf_sbus_time, tvb, offset, 3, FALSE); + offset += 3; + break; + + /* Response: CPU status, the command codes 14..1B are concerned*/ + case SBUS_RD_PCD_STATUS_CPU0: + case SBUS_RD_PCD_STATUS_CPU1: + case SBUS_RD_PCD_STATUS_CPU2: + case SBUS_RD_PCD_STATUS_CPU3: + case SBUS_RD_PCD_STATUS_CPU4: + case SBUS_RD_PCD_STATUS_CPU5: + case SBUS_RD_PCD_STATUS_CPU6: + case SBUS_RD_PCD_STATUS_OWN: + proto_tree_add_item(sbus_tree, + hf_sbus_cpu_status, tvb, offset, 1, FALSE); + offset += 1; + break; + + /* Response: Station address*/ + case SBUS_RD_SBUS_STN_NBR: + proto_tree_add_item(sbus_tree, + hf_sbus_address, tvb, offset, 1, FALSE); + offset += 1; + break; + + /* Response: Firmware version */ + case SBUS_RD_PROGRAM_VERSION: + /*PCD type*/ + tmp_string = tvb_get_string(tvb, offset, 5); + proto_tree_add_string(sbus_tree, + hf_sbus_cpu_type, tvb, offset, 5, tmp_string); + offset += 5; + g_free(tmp_string); + /*FW version*/ + tmp_string = tvb_get_string(tvb , offset, 3); + proto_tree_add_string(sbus_tree, + hf_sbus_fw_version, tvb, offset, 3, tmp_string); + offset += 4; + g_free(tmp_string); + break; + + /* Response for Status Flags*/ + case SBUS_RD_STATUSFLAG_ACCU: + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + 1,"ACCU and arithmetic status"); + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + + proto_tree_add_item(sbusdata_tree, hf_sbus_flags_accu, + tvb, offset, 1, FALSE); + proto_tree_add_item(sbusdata_tree, hf_sbus_flags_error, + tvb, offset, 1, FALSE); + proto_tree_add_item(sbusdata_tree, hf_sbus_flags_negative, + tvb, offset, 1, FALSE); + proto_tree_add_item(sbusdata_tree, hf_sbus_flags_zero, + tvb, offset, 1, FALSE); + offset +=1; + break; + + /* Response for Read byte */ + case SBUS_RD_BYTE: + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + (request_val->count),"Data (bytes)"); + + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=(request_val->count); i>0; i--) { + proto_tree_add_item(sbusdata_tree, + hf_sbus_data_byte, tvb, offset, + 1, FALSE); + offset += 1; + } + break; + + /* Response for Read Index register */ + case SBUS_RD_INDEX_REGISTER: + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + 2,"Data (hex bytes)"); + + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=0; i<2; i++) { /*2 bytes*/ + proto_tree_add_item(sbusdata_tree, + hf_sbus_data_byte_hex, tvb, offset, + 1, FALSE); + offset += 1; + } + break; + + /* Response: Instruction pointer*/ + case SBUS_RD_INSTRUCTION_POINTER: + proto_tree_add_item(sbus_tree, + hf_sbus_addr_prog, tvb, offset, 3, FALSE); + offset += 3; + break; + + /*Response for Find History*/ + case SBUS_FIND_HISTORY: + proto_tree_add_item(sbus_tree, + hf_sbus_addr_68k, tvb, offset, 3, FALSE); + offset += 3; + proto_tree_add_item(sbus_tree, + hf_sbus_nbr_elements, tvb, offset, 2, FALSE); + offset += 2; + break; + + /* Response: Read current block*/ + case SBUS_RD_CURRENT_BLOCK: + proto_tree_add_item(sbus_tree, + hf_sbus_block_type, tvb, offset, 1, FALSE); + offset += 1; + proto_tree_add_item(sbus_tree, + hf_sbus_block_nr, tvb, offset, 2, FALSE); + offset += 2; + break; + + /* Response: Read system infomation (without interpretation of module info)*/ + case SBUS_RD_SYSTEM_INFORMATION: + if (((request_val->sysinfo) == 0x00)){ /*sysinfo 0*/ + offset += 1; /* this byte is always 0x01*/ + /*Add subtree for Data*/ + dt = proto_tree_add_text(sbus_tree, tvb, offset, + 1,"System info"); + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + + proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_1, + tvb, offset, 1, FALSE); + proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_2, + tvb, offset, 1, FALSE); + proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_3, + tvb, offset, 1, FALSE); + proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_4, + tvb, offset, 1, FALSE); + proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_5, + tvb, offset, 1, FALSE); + offset += 1; + } + break; + + /* Response: Webserver request */ + case SBUS_WEB_SERVER_SERIAL_COMM: + sbus_web_size = tvb_get_guint8(tvb,offset); + proto_tree_add_item(sbus_tree, + hf_sbus_web_size, tvb, offset, + 1, sbus_web_size); + offset += 1; + + sbus_web_aid = tvb_get_guint8(tvb,offset); + proto_tree_add_item(sbus_tree, + hf_sbus_web_aid, tvb, offset, + 1, sbus_web_aid); + offset += 1; + + if (sbus_web_size > 1) { + sbus_web_seq = tvb_get_guint8(tvb,offset); + proto_tree_add_item(sbus_tree, + hf_sbus_web_seq, tvb, offset, + 1, sbus_web_seq); + offset += 1; + + dt = proto_tree_add_text(sbus_tree, tvb, offset, + (sbus_web_size - 2),"Data (bytes)"); + + sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); + for (i=sbus_web_size - 2; i>0; i--) { + proto_tree_add_item(sbusdata_tree, + hf_sbus_data_byte, tvb, offset, + 1, FALSE); + offset += 1; + } + } + break; + + /*Inform that response was not dissected and add remaining length*/ + default: + sbus_helper = sbus_eth_len - (offset + 2); + proto_tree_add_text(sbus_tree, tvb, offset, sbus_helper, + "This telegram isn't implemented in the dissector."); + offset = offset + sbus_helper; + break; + } + } + + if (sbus_attribut == SBUS_ACKNAK) { + proto_tree_add_item(sbus_tree, + hf_sbus_acknackcode, tvb, offset, 2, FALSE); + offset += 2; + } + + /* Calclulate CRC */ + sbus_crc_calc = 0; + for (i = 0; i < sbus_eth_len - 2; i++) + sbus_crc_calc = crc_calc (sbus_crc_calc, tvb_get_guint8(tvb, i)); + /*Show CRC and add hidden item for wrong CRC*/ + sbus_helper = tvb_get_ntohs(tvb, offset); + if (sbus_helper == sbus_crc_calc) { + proto_tree_add_uint_format(sbus_tree, + hf_sbus_crc, tvb, offset, 2, sbus_helper, + "Checksum: 0x%04x (correct)", sbus_helper); + } else { + proto_tree_add_uint_format(sbus_tree, + hf_sbus_crc, tvb, offset, 2, sbus_helper, + "Checksum: 0x%04x (NOT correct)", sbus_helper); + hi = proto_tree_add_boolean(sbus_tree, + hf_sbus_crc_bad, tvb, offset + 2, 2, TRUE); + PROTO_ITEM_SET_HIDDEN(hi); + } + offset += 2; /*now at the end of the telegram*/ + } + return tvb_length(tvb); +/*End of dissect_sbus*/ +} + +/* Register the protocol with Wireshark */ + +void +proto_register_sbus(void) +{ + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + { &hf_sbus_length, + { "Length (bytes)", "sbus.len", + FT_UINT32, BASE_DEC, NULL, 0, + "SAIA Ether-S-Bus telegram length", HFILL } + }, + { &hf_sbus_version, + { "Version", "sbus.vers", + FT_UINT8, BASE_DEC, NULL, 0, + "SAIA Ether-S-Bus version", HFILL } + }, + { &hf_sbus_protocol, + { "Protocol type", "sbus.proto", + FT_UINT8, BASE_DEC, NULL, 0, + "SAIA Ether-S-Bus protocol type", HFILL } + }, + { &hf_sbus_sequence, + { "Sequence", "sbus.seq", + FT_UINT16, BASE_DEC, NULL, 0, + "SAIA Ether-S-Bus sequence number", HFILL } + }, + + { &hf_sbus_attribut, + { "Telegram attribute", "sbus.att", + FT_UINT8, BASE_HEX, VALS(sbus_att_vals), 0, + "SAIA Ether-S-Bus telegram attribute, indicating type of telegram", HFILL } + }, + + { &hf_sbus_dest, + { "Destination", "sbus.destination", + FT_UINT8, BASE_DEC, NULL, 0, + "SAIA S-Bus destination address", HFILL } + }, + + { &hf_sbus_address, + { "S-Bus address", "sbus.address", + FT_UINT8, BASE_DEC, NULL, 0, + "SAIA S-Bus station address", HFILL } + }, + + { &hf_sbus_command, + { "Command", "sbus.cmd", + FT_UINT8, BASE_HEX, VALS(sbus_command_vals), 0, + "SAIA S-Bus command", HFILL } + }, + + { &hf_sbus_command_extension, + { "Command extension", "sbus.cmd_extn", + FT_UINT8, BASE_HEX, NULL, 0, + "SAIA S-Bus command extension", HFILL } + }, + + { &hf_sbus_rcount, + { "R-count", "sbus.rcount", + FT_UINT8, BASE_DEC, NULL, 0, + "Number of elements expected in response", HFILL } + }, + + { &hf_sbus_wcount, + { "W-count (raw)", "sbus.wcount", + FT_UINT8, BASE_DEC, NULL, 0, + "Number of bytes to be written", HFILL } + }, + + { &hf_sbus_wcount_calculated, + { "W-count (32 bit values)", "sbus.wcount_calc", + FT_UINT8, BASE_DEC, NULL, 0, + "Number of elements to be written", HFILL } + }, + + { &hf_sbus_fio_count, + { "FIO Count (amount of bits)", "sbus.fio_count", + FT_UINT8, BASE_DEC, NULL, 0, + "Number of binary elements to be written", HFILL } + }, + + { &hf_sbus_addr_rtc, + { "Base address RTC", "sbus.addr_RTC", + FT_UINT16, BASE_DEC, NULL, 0, + "Base address of 32 bit elements to read", HFILL } + }, + + { &hf_sbus_addr_iof, + { "Base address IOF", "sbus.addr_IOF", + FT_UINT16, BASE_DEC, NULL, 0, + "Base address of binary elements to read", HFILL } + }, + + { &hf_sbus_addr_eeprom, + { "Base address of EEPROM register", "sbus.addr_EEPROM", + FT_UINT16, BASE_DEC, NULL, 0, + "Base address of 32 bit EEPROM register to read or write", HFILL } + }, + + { &hf_sbus_addr_prog, + { "Base address of user memory or program lines", "sbus.addr_prog", + FT_UINT24, BASE_DEC, NULL, 0, + "Base address of the user memory or program lines (read or write)", HFILL } + }, + + { &hf_sbus_addr_68k, + { "Base address of bytes", "sbus.addr_prog", + FT_UINT24, BASE_HEX, NULL, 0, + "Base address of bytes to read or write (68k address)", HFILL } + }, + + { &hf_sbus_block_type, + { "Block type", "sbus.block_type", + FT_UINT8, BASE_HEX, VALS(sbus_block_types), 0, + "Program block type read", HFILL } + }, + + { &hf_sbus_block_nr, + { "Block/Element nr", "sbus.block_nr", + FT_UINT16, BASE_DEC, NULL, 0, + "Program block / DatatBlock number", HFILL } + }, + + { &hf_sbus_nbr_elements, + { "Number of elements", "sbus.nbr_elements", + FT_UINT16, BASE_DEC, NULL, 0, + "Number of elements or characters", HFILL } + }, + + { &hf_sbus_display_register, + { "PCD Display register", "sbus.data_display_register", + FT_UINT32, BASE_DEC, NULL, 0, + "The PCD display register (32 bit value)", HFILL } + }, + + { &hf_sbus_data_rtc, + { "S-Bus 32-bit data", "sbus.data_rtc", + FT_UINT32, BASE_DEC, NULL, 0, + "One regiser/timer of counter (32 bit value)", HFILL } + }, + + { &hf_sbus_data_byte, + { "Data bytes", "sbus.data_byte", + FT_UINT8, BASE_DEC, NULL, 0, + "One byte from PCD", HFILL } + }, + + { &hf_sbus_data_byte_hex, + { "Data bytes (hex)", "sbus.data_byte_hex", + FT_UINT8, BASE_HEX, NULL, 0, + "One byte from PCD (hexadecimal)", HFILL } + }, + + { &hf_sbus_data_iof, + { "S-Bus binary data", "sbus.data_iof", + FT_UINT32, BASE_DEC, NULL, 0, + "8 binaries", HFILL } + }, + + { &hf_sbus_cpu_type, + { "PCD type", "sbus.pcd_type", + FT_STRING, BASE_NONE, NULL, 0, + "PCD type (short form)", HFILL } + }, + + { &hf_sbus_fw_version, + { "Firmware version", "sbus.fw_version", + FT_STRING, BASE_NONE, NULL, 0, + "Firmware version of the PCD or module", HFILL } + }, + + { &hf_sbus_sysinfo_nr, + { "System information number", "sbus.sysinfo", + FT_UINT8, BASE_HEX, NULL, 0, + "System information number (extension to command code)", HFILL } + }, + + { &hf_sbus_sysinfo0_1, + { "Mem size info", "sbus.sysinfo0.mem", + FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_MEMSIZE, + "Availability of memory size information", HFILL } + }, + { &hf_sbus_sysinfo0_2, + { "Trace buffer", "sbus.sysinfo0.trace", + FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_TRACE, + "Availability of trace buffer feature", HFILL } + }, + { &hf_sbus_sysinfo0_3, + { "Slot B1", "sbus.sysinfo0.b1", + FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_INFO_B1, + "Presence of EEPROM information on slot B1", HFILL } + }, + { &hf_sbus_sysinfo0_4, + { "Slot B2", "sbus.sysinfo0.b2", + FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_INFO_B2, + "Presence of EEPROM information on slot B2", HFILL } + }, + { &hf_sbus_sysinfo0_5, + { "PGU baud", "sbus.sysinfo0.pgubaud", + FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_PGU_BAUD, + "Availability of PGU baud switch feature", HFILL } + }, + + { &hf_sbus_sysinfo_length, + { "System information length", "sbus.sysinfo_length", + FT_UINT8, BASE_HEX, NULL, 0, + "System information length in response", HFILL } + }, + + { &hf_sbus_f_module_type, + { "F-module type", "sbus.fmodule_type", + FT_STRING, BASE_NONE, NULL, 0, + "Module type mounted on B1/2 slot", HFILL } + }, + + { &hf_sbus_harware_version, + { "Hardware version", "sbus.hw_version", + FT_STRING, BASE_NONE, NULL, 0, + "Hardware version of the PCD or the module", HFILL } + }, + + { &hf_sbus_hardware_modification, + { "Hardware modification", "sbus.hw_modification", + FT_UINT8, BASE_DEC, NULL, 0, + "Hardware modification of the PCD or module", HFILL } + }, + + { &hf_sbus_various, + { "Varous data", "sbus.various", + FT_NONE, BASE_NONE, NULL, 0, + "Various data contained in telegrams but nobody will search for it", HFILL } + }, + + { &hf_sbus_acknackcode, + { "ACK/NAK code", "sbus.nakcode", + FT_UINT16, BASE_HEX, VALS(sbus_ack_nak_vals), 0, + "SAIA S-Bus ACK/NAK response", HFILL } + }, + + { &hf_sbus_cpu_status, + { "CPU status", "sbus.CPU_status", + FT_UINT8, BASE_HEX, VALS(sbus_CPU_status), 0, + "SAIA PCD CPU status", HFILL } + }, + + { &hf_sbus_week_day, + { "RTC calendar week and week day", "sbus.rtc.week_day", + FT_UINT16, BASE_HEX, NULL, 0, + "Calendar week and week day number of the real time clock", HFILL } + }, + + { &hf_sbus_date, + { "RTC date (YYMMDD)", "sbus.rtc.date", + FT_UINT24, BASE_HEX, NULL, 0, + "Year, month and day of the real time clock", HFILL } + }, + + { &hf_sbus_time, + { "RTC time (HHMMSS)", "sbus.rtc.time", + FT_UINT24, BASE_HEX, NULL, 0, + "Time of the real time clock", HFILL } + }, + + { &hf_sbus_web_size, + { "Web server packet size", "sbus.web.size", + FT_UINT8, BASE_HEX, NULL, 0, + "Web server packet size", HFILL } + }, + + { &hf_sbus_web_aid, + { "AID", "sbus.web.aid", + FT_UINT8, BASE_HEX, NULL, 0, + "Web server command/status code (AID)", HFILL } + }, + + { &hf_sbus_web_seq, + { "Sequence", "sbus.web.seq", + FT_UINT8, BASE_HEX, NULL, 0, + "Web server sequence nr (PACK_N)", HFILL } + }, + + { &hf_sbus_crc, + { "Checksum", "sbus.crc", + FT_UINT16, BASE_HEX, NULL, 0, + "CRC 16", HFILL } + }, + + { &hf_sbus_crc_bad, + { "Bad Checksum", "sbus.crc_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0, + "A bad checksum in the telegram", HFILL }}, + + { &hf_sbus_flags_accu, + { "ACCU", "sbus.flags.accu", + FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_ACCU, + "PCD Accumulator", HFILL } + }, + + { &hf_sbus_flags_error, + { "Error flag", "sbus.flags.error", + FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_ERROR, + "PCD error flag", HFILL } + }, + + { &hf_sbus_flags_negative, + { "N-flag", "sbus.flags.nflag", + FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_NEGATIVE, + "Negative status flag", HFILL } + }, + + { &hf_sbus_flags_zero, + { "Z-flag", "sbus.flags.zflag", + FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_ZERO, + "Zero status flag", HFILL } + } + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_sbus, + &ett_sbus_ether, + &ett_sbus_data + }; + +/* Register the protocol name and description */ + proto_sbus = proto_register_protocol("SAIA S-Bus", "SBUS", "sbus"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_sbus, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + register_init_routine(&sbus_init_protocol); +} + +void +proto_reg_handoff_sbus(void) +{ + dissector_handle_t sbus_handle; + + sbus_handle = new_create_dissector_handle(dissect_sbus, proto_sbus); + dissector_add("udp.port", 5050, sbus_handle); +} + diff --git a/packaging/nsis/Makefile.nmake b/packaging/nsis/Makefile.nmake index 7d19744ff3..28bf8402d2 100644 --- a/packaging/nsis/Makefile.nmake +++ b/packaging/nsis/Makefile.nmake @@ -65,7 +65,6 @@ PLUGINS= \ ../../plugins/rlm/rlm.dll \ ../../plugins/rtnet/rtnet.dll \ ../../plugins/rudp/rudp.dll \ - ../../plugins/sbus/sbus.dll \ ../../plugins/sercosiii/sercosiii.dll \ ../../plugins/stats_tree/stats_tree.dll \ ../../plugins/unistim/unistim.dll \ diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi index 44c77228ed..88bfe3db6b 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -804,7 +804,6 @@ File "..\..\plugins\profinet\profinet.dll" File "..\..\plugins\rlm\rlm.dll" File "..\..\plugins\rtnet\rtnet.dll" File "..\..\plugins\rudp\rudp.dll" -File "..\..\plugins\sbus\sbus.dll" File "..\..\plugins\sercosiii\sercosiii.dll" File "..\..\plugins\unistim\unistim.dll" File "..\..\plugins\wimax\wimax.dll" diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 34228dcdc0..87415809cc 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -44,7 +44,6 @@ SUBDIRS = $(_CUSTOM_SUBDIRS_) \ rlm \ rtnet \ rudp \ - sbus \ sercosiii \ stats_tree \ unistim \ diff --git a/plugins/Makefile.nmake b/plugins/Makefile.nmake index 8ee17d2d61..501db9a4ee 100644 --- a/plugins/Makefile.nmake +++ b/plugins/Makefile.nmake @@ -93,9 +93,6 @@ process-plugins: cd rudp $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake $(PLUGIN_TARGET) cd .. - cd sbus - $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake $(PLUGIN_TARGET) - cd .. cd sercosiii $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake $(PLUGIN_TARGET) cd .. @@ -142,7 +139,6 @@ install-plugins: xcopy plugins\rlm\*.dll $(INSTALL_DIR)\plugins\$(VERSION) /d xcopy plugins\rtnet\*.dll $(INSTALL_DIR)\plugins\$(VERSION) /d xcopy plugins\rudp\*.dll $(INSTALL_DIR)\plugins\$(VERSION) /d - xcopy plugins\sbus\*.dll $(INSTALL_DIR)\plugins\$(VERSION) /d xcopy plugins\sercosiii\*.dll $(INSTALL_DIR)\plugins\$(VERSION) /d xcopy plugins\stats_tree\*.dll $(INSTALL_DIR)\plugins\$(VERSION) /d xcopy plugins\unistim\*.dll $(INSTALL_DIR)\plugins\$(VERSION) /d diff --git a/plugins/sbus/AUTHORS b/plugins/sbus/AUTHORS deleted file mode 100644 index 32295f1dad..0000000000 --- a/plugins/sbus/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -Author : -Christian Durrer - diff --git a/plugins/sbus/COPYING b/plugins/sbus/COPYING deleted file mode 100644 index f77eb37f32..0000000000 --- a/plugins/sbus/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 2 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, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/plugins/sbus/ChangeLog b/plugins/sbus/ChangeLog deleted file mode 100644 index 0f1bf67621..0000000000 --- a/plugins/sbus/ChangeLog +++ /dev/null @@ -1,5 +0,0 @@ -$Id$ - -Version 0.0.4: -* First release in Wireshark - diff --git a/plugins/sbus/Makefile.am b/plugins/sbus/Makefile.am deleted file mode 100644 index e69c9cd86d..0000000000 --- a/plugins/sbus/Makefile.am +++ /dev/null @@ -1,126 +0,0 @@ -# Makefile.am -# Automake file for sbus plugin -# -# $Id$ -# -# Wireshark - Network traffic analyzer / Ether-S-Bus dissection -# Copyright 2006, Christian Durrer -# -# 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 2 -# 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -INCLUDES = -I$(top_srcdir) -I$(includedir) - -include Makefile.common - -if HAVE_WARNINGS_AS_ERRORS -AM_CFLAGS = -Werror -endif - -plugindir = @plugindir@ - -plugin_LTLIBRARIES = sbus.la -sbus_la_SOURCES = \ - plugin.c \ - moduleinfo.h \ - $(DISSECTOR_SRC) \ - $(DISSECTOR_INCLUDES) -sbus_la_LDFLAGS = -module -avoid-version -sbus_la_LIBADD = @PLUGIN_LIBS@ - -# Libs must be cleared, or else libtool won't create a shared module. -# If your module needs to be linked against any particular libraries, -# add them here. -LIBS = - -# -# Build plugin.c, which contains the plugin version[] string, a -# function plugin_register() that calls the register routines for all -# protocols, and a function plugin_reg_handoff() that calls the handoff -# registration routines for all protocols. -# -# We do this by scanning sources. If that turns out to be too slow, -# maybe we could just require every .o file to have an register routine -# of a given name (packet-aarp.o -> proto_register_aarp, etc.). -# -# Formatting conventions: The name of the proto_register_* routines an -# proto_reg_handoff_* routines must start in column zero, or must be -# preceded only by "void " starting in column zero, and must not be -# inside #if. -# -# DISSECTOR_SRC is assumed to have all the files that need to be scanned. -# -# For some unknown reason, having a big "for" loop in the Makefile -# to scan all the files doesn't work with some "make"s; they seem to -# pass only the first few names in the list to the shell, for some -# reason. -# -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. -# -# The first argument is the directory in which the source files live. -# The second argument is "plugin", to indicate that we should build -# a plugin.c file for a plugin. -# All subsequent arguments are the files to scan. -# -plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ - $(top_srcdir)/tools/make-dissector-reg.py - @if test -n "$(PYTHON)"; then \ - echo Making plugin.c with python ; \ - $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ - plugin $(DISSECTOR_SRC) ; \ - else \ - echo Making plugin.c with shell script ; \ - $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ - $(plugin_src) plugin $(DISSECTOR_SRC) ; \ - fi - -# -# Currently plugin.c can be included in the distribution because -# we always build all protocol dissectors. We used to have to check -# whether or not to build the snmp dissector. If we again need to -# variably build something, making plugin.c non-portable, uncomment -# the dist-hook line below. -# -# Oh, yuk. We don't want to include "plugin.c" in the distribution, as -# its contents depend on the configuration, and therefore we want it -# to be built when the first "make" is done; however, Automake insists -# on putting *all* source into the distribution. -# -# We work around this by having a "dist-hook" rule that deletes -# "plugin.c", so that "dist" won't pick it up. -# -#dist-hook: -# @rm -f $(distdir)/plugin.c - -CLEANFILES = \ - sbus \ - *~ - -MAINTAINERCLEANFILES = \ - Makefile.in \ - plugin.c - -EXTRA_DIST = \ - Makefile.common \ - Makefile.nmake \ - moduleinfo.nmake \ - plugin.rc.in - -checkapi: - $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput $(DISSECTOR_SRC) diff --git a/plugins/sbus/Makefile.common b/plugins/sbus/Makefile.common deleted file mode 100644 index d7b8418867..0000000000 --- a/plugins/sbus/Makefile.common +++ /dev/null @@ -1,31 +0,0 @@ -# Makefile.common for sbus plugin -# Contains the stuff from Makefile.am and Makefile.nmake that is -# a) common to both files and -# b) portable between both files -# -# $Id$ -# -# Wireshark - Network traffic analyzer -# By Gerald Combs -# Copyright 1998 Gerald Combs -# -# 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 2 -# 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# the name of the plugin -PLUGIN_NAME = sbus - -# the dissector sources (without any helpers) -DISSECTOR_SRC = \ - packet-sbus.c diff --git a/plugins/sbus/Makefile.nmake b/plugins/sbus/Makefile.nmake deleted file mode 100644 index acc863edc3..0000000000 --- a/plugins/sbus/Makefile.nmake +++ /dev/null @@ -1,106 +0,0 @@ -# Makefile.nmake -# nmake file for Wireshark plugin -# -# $Id$ -# - -include ..\..\config.nmake -include moduleinfo.nmake - -include Makefile.common - -CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \ - /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) - -.c.obj:: - $(CC) $(CFLAGS) -Fd.\ -c $< - -LDFLAGS = $(PLUGIN_LDFLAGS) - -!IFDEF ENABLE_LIBWIRESHARK -LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib -CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) - -DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) - -DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj) - -OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj - -RESOURCE=$(PLUGIN_NAME).res - -all: $(PLUGIN_NAME).dll - -$(PLUGIN_NAME).rc : moduleinfo.nmake - sed -e s/@PLUGIN_NAME@/$(PLUGIN_NAME)/ \ - -e s/@RC_MODULE_VERSION@/$(RC_MODULE_VERSION)/ \ - -e s/@RC_VERSION@/$(RC_VERSION)/ \ - -e s/@MODULE_VERSION@/$(MODULE_VERSION)/ \ - -e s/@PACKAGE@/$(PACKAGE)/ \ - -e s/@VERSION@/$(VERSION)/ \ - -e s/@MSVC_VARIANT@/$(MSVC_VARIANT)/ \ - < plugin.rc.in > $@ - -$(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE) - link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ - $(GLIB_LIBS) $(RESOURCE) -!IF $(MSC_VER_REQUIRED) >= 1400 - mt.exe -nologo -manifest "$(PLUGIN_NAME).dll.manifest" -outputresource:$(PLUGIN_NAME).dll;2 -!ENDIF - -# -# Build plugin.c, which contains the plugin version[] string, a -# function plugin_register() that calls the register routines for all -# protocols, and a function plugin_reg_handoff() that calls the handoff -# registration routines for all protocols. -# -# We do this by scanning sources. If that turns out to be too slow, -# maybe we could just require every .o file to have an register routine -# of a given name (packet-aarp.o -> proto_register_aarp, etc.). -# -# Formatting conventions: The name of the proto_register_* routines an -# proto_reg_handoff_* routines must start in column zero, or must be -# preceded only by "void " starting in column zero, and must not be -# inside #if. -# -# DISSECTOR_SRC is assumed to have all the files that need to be scanned. -# -# For some unknown reason, having a big "for" loop in the Makefile -# to scan all the files doesn't work with some "make"s; they seem to -# pass only the first few names in the list to the shell, for some -# reason. -# -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. -# -# The first argument is the directory in which the source files live. -# The second argument is "plugin", to indicate that we should build -# a plugin.c file for a plugin. -# All subsequent arguments are the files to scan. -# -!IFDEF PYTHON -plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py - @echo Making plugin.c (using python) - @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC) -!ELSE -plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg - @echo Making plugin.c (using sh) - @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) -!ENDIF - -!ENDIF - -clean: - rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ - $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ - $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc - -distclean: clean - -maintainer-clean: distclean - -checkapi: - $(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput $(DISSECTOR_SRC) diff --git a/plugins/sbus/moduleinfo.h b/plugins/sbus/moduleinfo.h deleted file mode 100644 index 2582ede818..0000000000 --- a/plugins/sbus/moduleinfo.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Included *after* config.h, in order to re-define these macros */ - -#ifdef PACKAGE -#undef PACKAGE -#endif - -/* Name of package */ -#define PACKAGE "sbus" - - -#ifdef VERSION -#undef VERSION -#endif - -/* Version number of package */ -#define VERSION "0.0.4" - diff --git a/plugins/sbus/moduleinfo.nmake b/plugins/sbus/moduleinfo.nmake deleted file mode 100644 index ad3d11bfee..0000000000 --- a/plugins/sbus/moduleinfo.nmake +++ /dev/null @@ -1,28 +0,0 @@ -# -# $Id$ -# - -# The name -PACKAGE=sbus - -# The version -MODULE_VERSION_MAJOR=0 -MODULE_VERSION_MINOR=0 -MODULE_VERSION_MICRO=4 -MODULE_VERSION_EXTRA=0 - -# -# The RC_VERSION should be comma-separated, not dot-separated, -# as per Graham Bloice's message in -# -# http://www.ethereal.com/lists/ethereal-dev/200303/msg00283.html -# -# "The RC_VERSION variable in config.nmake should be comma separated. -# This allows the resources to be built correctly and the version -# number to be correctly displayed in the explorer properties dialog -# for the executables, and XP's tooltip, rather than 0.0.0.0." -# - -MODULE_VERSION=$(MODULE_VERSION_MAJOR).$(MODULE_VERSION_MINOR).$(MODULE_VERSION_MICRO).$(MODULE_VERSION_EXTRA) -RC_MODULE_VERSION=$(MODULE_VERSION_MAJOR),$(MODULE_VERSION_MINOR),$(MODULE_VERSION_MICRO),$(MODULE_VERSION_EXTRA) - diff --git a/plugins/sbus/packet-sbus.c b/plugins/sbus/packet-sbus.c deleted file mode 100644 index 2cd607f37d..0000000000 --- a/plugins/sbus/packet-sbus.c +++ /dev/null @@ -1,1661 +0,0 @@ -/* packet-sbus.c - * Routines for Ether-S-Bus dissection - * Copyright 2006, Christian Durrer - * - * $Id$ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * 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 2 - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include - -/* Number of entries in the memeory chunk array (for conversation)*/ -#define SBUS_MEMCHUNKSIZE 20 -/* Attribut values*/ -#define SBUS_REQUEST 0x00 -#define SBUS_RESPONSE 0x01 -#define SBUS_ACKNAK 0x02 - -/*SBus command codes*/ -#define SBUS_RD_COUNTER 0x00 -#define SBUS_RD_DISPLAY_REGISTER 0x01 -#define SBUS_RD_FLAG 0x02 -#define SBUS_RD_INPUT 0x03 -#define SBUS_RD_RTC 0x04 -#define SBUS_RD_OUTPUT 0x05 -#define SBUS_RD_REGISTER 0x06 -#define SBUS_RD_TIMER 0x07 -#define SBUS_WR_COUNTER 0x0A -#define SBUS_WR_FLAG 0x0B -#define SBUS_WR_RTC 0x0C -#define SBUS_WR_OUTPUT 0x0D -#define SBUS_WR_REGISTER 0x0E -#define SBUS_WR_TIMER 0x0F -#define SBUS_RDWR_MULTI_MEDIAS 0x13 -#define SBUS_RD_PCD_STATUS_CPU0 0x14 -#define SBUS_RD_PCD_STATUS_CPU1 0x15 -#define SBUS_RD_PCD_STATUS_CPU2 0x16 -#define SBUS_RD_PCD_STATUS_CPU3 0x17 -#define SBUS_RD_PCD_STATUS_CPU4 0x18 -#define SBUS_RD_PCD_STATUS_CPU5 0x19 -#define SBUS_RD_PCD_STATUS_CPU6 0x1A -#define SBUS_RD_PCD_STATUS_OWN 0x1B -#define SBUS_RD_SBUS_STN_NBR 0x1D -#define SBUS_RD_USER_MEMORY 0x1E -#define SBUS_RD_PROGRAM_LINE 0x1F -#define SBUS_RD_PROGRAM_VERSION 0x20 -#define SBUS_RD_TEXT 0x21 -#define SBUS_RD_ACTIVE_TRANSITION 0x22 -#define SBUS_WR_USER_MEMORY 0x23 -#define SBUS_WR_PROGRAM_LINE 0x24 -#define SBUS_WR_TEXT 0x25 -#define SBUS_RUN_PROCEDURE_CPU0 0x28 -#define SBUS_RUN_PROCEDURE_CPU1 0x29 -#define SBUS_RUN_PROCEDURE_CPU2 0x2A -#define SBUS_RUN_PROCEDURE_CPU3 0x2B -#define SBUS_RUN_PROCEDURE_CPU4 0x2C -#define SBUS_RUN_PROCEDURE_CPU5 0x2D -#define SBUS_RUN_PROCEDURE_CPU6 0x2E -#define SBUS_RUN_PROCEDURE_OWN 0x2F -#define SBUS_RUN_PROCEDURE_ALL 0x30 -#define SBUS_RESTART_COLD_CPU1 0x32 -#define SBUS_RESTART_COLD_CPU2 0x33 -#define SBUS_RESTART_COLD_CPU3 0x34 -#define SBUS_RESTART_COLD_CPU4 0x35 -#define SBUS_RESTART_COLD_CPU5 0x36 -#define SBUS_RESTART_COLD_CPU6 0x37 -#define SBUS_RESTART_COLD_OWN 0x38 -#define SBUS_RESTART_COLD_ALL 0x39 -#define SBUS_STOP_PROCEDURE_CPU0 0x3C -#define SBUS_STOP_PROCEDURE_CPU1 0x3D -#define SBUS_STOP_PROCEDURE_CPU2 0x3E -#define SBUS_STOP_PROCEDURE_CPU3 0x3F -#define SBUS_STOP_PROCEDURE_CPU4 0x40 -#define SBUS_STOP_PROCEDURE_CPU5 0x41 -#define SBUS_STOP_PROCEDURE_CPU6 0x42 -#define SBUS_STOP_PROCEDURE_OWN 0x43 -#define SBUS_STOP_PROCEDURE_ALL 0x44 -#define SBUS_RD_STATUSFLAG_ACCU 0x46 -#define SBUS_RD_BYTE 0x47 -#define SBUS_RD_HALT_FAILURE_REG 0x48 -#define SBUS_RD_INDEX_REGISTER 0x49 -#define SBUS_RD_INSTRUCTION_POINTER 0x4A -#define SBUS_FIND_HISTORY 0x4B -#define SBUS_WR_STATUSFLAG_ACCU 0x50 -#define SBUS_WR_BYTE 0x51 -#define SBUS_WR_INDEX_REGISTER 0x52 -#define SBUS_WR_INSTRUCTION_POINTER 0x53 -#define SBUS_CLEAR_ALL 0x5A -#define SBUS_CLEAR_FLAGS 0x5B -#define SBUS_CLEAR_OUTPUTS 0x5C -#define SBUS_CLEAR_REGISTERS 0x5D -#define SBUS_CLEAR_TIMERS 0x5E -#define SBUS_RESTART_WARM_CPU1 0x64 -#define SBUS_RESTART_WARM_CPU2 0x65 -#define SBUS_RESTART_WARM_CPU3 0x66 -#define SBUS_RESTART_WARM_CPU4 0x67 -#define SBUS_RESTART_WARM_CPU5 0x68 -#define SBUS_RESTART_WARM_CPU6 0x69 -#define SBUS_RESTART_WARM_OWN 0x6A -#define SBUS_RESTART_WARM_ALL 0x6B -#define SBUS_CHANGE_BLOCK 0x6E -#define SBUS_CLEAR_HISTORY_FAILURE 0x6F -#define SBUS_DELETE_PROGRAM_LINE 0x70 -#define SBUS_GO_CONDITIONAL 0x71 -#define SBUS_INSERT_PROGRAM_LINE 0x72 -#define SBUS_LOCAL_CYCLE 0x73 -#define SBUS_ALL_CYCLES 0x74 -#define SBUS_MAKE_TEXT 0x75 -#define SBUS_EXECUTE_SINGLE_INSTR 0x76 -#define SBUS_SINGLE_STEP 0x77 -#define SBUS_XOB_17_INTERRUPT 0x82 -#define SBUS_XOB_18_INTERRUPT 0x83 -#define SBUS_XOB_19_INTERRUPT 0x84 -#define SBUS_RD_HANGUP_TIMEOUT 0x91 -#define SBUS_RD_DATA_BLOCK 0x96 -#define SBUS_WR_DATA_BLOCK 0x97 -#define SBUS_MAKE_DATA_BLOCK 0x98 -#define SBUS_CLEAR_DATA_BLOCK 0x99 -#define SBUS_CLEAR_TEXT 0x9A -#define SBUS_RD_BLOCK_ADDRESSES 0x9B -#define SBUS_RD_BLOCK_SIZES 0x9C -#define SBUS_RD_CURRENT_BLOCK 0x9D -#define SBUS_RD_CALL_STACK 0x9E -#define SBUS_RD_DBX 0x9F -#define SBUS_RD_USER_EEPROM_REGISTER 0xA1 -#define SBUS_WR_USER_EEPROM_REGISTER 0xA3 -#define SBUS_ERASE_FLASH 0xA5 -#define SBUS_RESTART_COLD_FLAG 0xA6 -#define SBUS_WR_SYSTEM_BUFFER 0xA7 -#define SBUS_RD_SYSTEM_BUFFER 0xA8 -#define SBUS_RD_WR_PCD_BLOCK 0xA9 -#define SBUS_GET_DIAGNOSTIC 0xAA -#define SBUS_RD_SYSTEM_INFORMATION 0xAB -#define SBUS_CHANGE_BLOCKS_ON_RUN 0xAC -#define SBUS_FLASHCARD_TELEGRAM 0xAD -#define SBUS_DOWNLOAD_FIRMWARE 0xAE -#define SBUS_WEB_SERVER_SERIAL_COMM 0xAF - -/* Bitfield in the arithmetic flags and accu*/ -#define F_ACCU (1<<0) /* Accumulator of PCD */ -#define F_ERROR (1<<1) /* Error flag of PCD */ -#define F_NEGATIVE (1<<2) /* Negative arithmetic status flag*/ -#define F_ZERO (1<<3) /* Zero arithmetic status flag */ - -/* Bitfield in the system information*/ -/*#define F_EMPTY (1<<0) always 0 */ -#define F_MEMSIZE (1<<1) /* Memory size information*/ -#define F_TRACE (1<<2) /* Trace buffer feature */ -#define F_INFO_B1 (1<<3) /* EEPROM information of slot B1*/ -#define F_INFO_B2 (1<<4) /* EEPROM information of slot B2*/ -#define F_PGU_BAUD (1<<5) /* PGU baudrate can be switched*/ - -/* Initialize the protocol and registered fields */ -static int proto_sbus = -1; -static int hf_sbus_length = -1; -static int hf_sbus_version = -1; -static int hf_sbus_protocol = -1; -static int hf_sbus_sequence = -1; -static int hf_sbus_attribut = -1; -static int hf_sbus_dest = -1; -static int hf_sbus_address = -1; -static int hf_sbus_command = -1; -static int hf_sbus_command_extension = -1; -static int hf_sbus_rcount = -1; -static int hf_sbus_wcount = -1; -static int hf_sbus_wcount_calculated = -1; -static int hf_sbus_fio_count = -1; -static int hf_sbus_addr_rtc = -1; -static int hf_sbus_addr_iof = -1; -static int hf_sbus_addr_eeprom = -1; -static int hf_sbus_addr_prog = -1; -static int hf_sbus_addr_68k = -1; -static int hf_sbus_block_type = -1; -static int hf_sbus_block_nr = -1; -static int hf_sbus_nbr_elements = -1; -static int hf_sbus_display_register = -1; -static int hf_sbus_data_rtc = -1; -static int hf_sbus_data_byte = -1; -static int hf_sbus_data_byte_hex = -1; -static int hf_sbus_data_iof = -1; -static int hf_sbus_cpu_type = -1; -static int hf_sbus_fw_version = -1; -static int hf_sbus_sysinfo_nr = -1; -static int hf_sbus_sysinfo0_1 = -1; -static int hf_sbus_sysinfo0_2 = -1; -static int hf_sbus_sysinfo0_3 = -1; -static int hf_sbus_sysinfo0_4 = -1; -static int hf_sbus_sysinfo0_5 = -1; -static int hf_sbus_sysinfo_length = -1; -static int hf_sbus_f_module_type = -1; -static int hf_sbus_harware_version = -1; -static int hf_sbus_hardware_modification = -1; -static int hf_sbus_various = -1; -static int hf_sbus_acknackcode = -1; -static int hf_sbus_cpu_status = -1; -static int hf_sbus_week_day = -1; -static int hf_sbus_date = -1; -static int hf_sbus_time = -1; -static int hf_sbus_crc = -1; -static int hf_sbus_crc_bad = -1; -static int hf_sbus_flags_accu = -1; -static int hf_sbus_flags_error = -1; -static int hf_sbus_flags_negative = -1; -static int hf_sbus_flags_zero = -1; -/* Web server telegram */ -static int hf_sbus_web_size = -1; -static int hf_sbus_web_aid = -1; -static int hf_sbus_web_seq = -1; - -/* Initialize the subtree pointers */ -static gint ett_sbus = -1; -static gint ett_sbus_ether = -1; -static gint ett_sbus_data = -1; - -/* True/False strings*/ -static const true_false_string tfs_sbus_flags= { - "Is high", - "Is low" -}; - -static const true_false_string tfs_sbus_present= { - "Is present", - "Is not present" -}; - -/* value to string definitions*/ -/* telegram types*/ -static const value_string sbus_att_vals[] = { - {0, "Request"}, - {1, "Response"}, - {2, "ACK/NAK"}, - {0, NULL} -}; -/* Block types*/ -static const value_string sbus_block_types[] = { - {0x00, "COB"}, - {0x01, "XOB"}, - {0x02, "PB"}, - {0x03, "FB"}, - {0x04, "ST"}, - {0x05, "TR"}, - {0x04, "TEXT"}, - {0x05, "DB"}, - {0x08, "SB"}, - {0, NULL} -}; -/* ACK NAK values*/ -static const value_string sbus_CPU_status[] = { - {0x43, "C"}, - {0x44, "D"}, - {0x48, "Halt"}, - {0x52, "Run"}, - {0x53, "Stop"}, - {0x58, "X, Exceptional Intermediate Status (MODEMS+)"}, - {0, NULL} -}; -/* CPU status*/ -static const value_string sbus_ack_nak_vals[] = { - {0, "ACK (Acknowledged)"}, - {1, "NAK, no reason specified"}, - {2, "NAK, because of password"}, - {3, "NAK, PGU port is in reduced protocol"}, - {4, "NAK, PGU port is already used"}, - {0, NULL} -}; -/* S-Bus commands*/ -static const value_string sbus_command_vals[] = { - {0x00, "Read counter(s)"}, - {0x01, "Read display register"}, - {0x02, "Read flag(s)"}, - {0x03, "Read input(s)"}, - {0x04, "Read real time clock"}, - {0x05, "Read output(s)"}, - {0x06, "Read register(s)"}, - {0x07, "Read timer(s)"}, - {0x0A, "Write counter(s)"}, - {0x0B, "Write flag(s)"}, - {0x0C, "Write real time clock"}, - {0x0D, "Write output(s)"}, - {0x0E, "Write register(s)"}, - {0x0F, "Write timer(s)"}, - {0x14, "Read PCD status, CPU 0"}, - {0x15, "Read PCD status, CPU 1"}, - {0x16, "Read PCD status, CPU 2"}, - {0x17, "Read PCD status, CPU 3"}, - {0x18, "Read PCD status, CPU 4"}, - {0x19, "Read PCD status, CPU 5"}, - {0x1A, "Read PCD status, CPU 6"}, - {0x1B, "Read PCD status (own)"}, - {0x1D, "Read S-Bus station number"}, - {0x1E, "Read user memory*"}, - {0x1F, "Read program line*"}, - {0x20, "Read firmware version"}, - {0x21, "Read text*"}, - {0x22, "Read active transition*"}, - {0x23, "Write user memeory*"}, - {0x24, "Write program line*"}, - {0x25, "Write text*"}, - {0x28, "Run procedure*, CPU 0"}, - {0x29, "Run procedure*, CPU 1"}, - {0x2A, "Run procedure*, CPU 2"}, - {0x2B, "Run procedure*, CPU 3"}, - {0x2C, "Run procedure*, CPU 4"}, - {0x2D, "Run procedure*, CPU 5"}, - {0x2E, "Run procedure*, CPU 6"}, - {0x2F, "Run procedure* (own CPU)"}, - {0x30, "Run procedure* (All CPUs)"}, - {0x32, "Restart cold CPU 1*"}, - {0x33, "Restart cold CPU 2*"}, - {0x34, "Restart cold CPU 3*"}, - {0x35, "Restart cold CPU 4*"}, - {0x36, "Restart cold CPU 5*"}, - {0x37, "Restart cold CPU 6*"}, - {0x38, "Restart cold own CPU*"}, - {0x39, "Restart cold all CPUs*"}, - {0x3C, "Stop procedure*, CPU 0"}, - {0x3D, "Stop procedure*, CPU 1"}, - {0x3E, "Stop procedure*, CPU 2"}, - {0x3F, "Stop procedure*, CPU 3"}, - {0x40, "Stop procedure*, CPU 4"}, - {0x41, "Stop procedure*, CPU 5"}, - {0x42, "Stop procedure*, CPU 6"}, - {0x43, "Stop procedure*, (own CPU)"}, - {0x44, "Stop procedure*, (All CPUs)"}, - {0x46, "Read arithmetic status and ACCU*"}, - {0x47, "Read byte"}, - {0x48, "Read halt failure register*"}, - {0x49, "Read index register*"}, - {0x4A, "Read instruction pointer*"}, - {0x4B, "Find history*"}, - {0x50, "Write arithmetic staus and ACCU*"}, - {0x51, "Write byte*"}, - {0x52, "Write index register"}, - {0x53, "Write instruction pointer*"}, - {0x5A, "Clear all (F, O, R, T)*"}, - {0x5B, "Clear flags*"}, - {0x5C, "Clear outputs*"}, - {0x5D, "Clear registers*"}, - {0x5E, "Clear timers*"}, - {0x64, "Restart warm CPU 1*"}, - {0x65, "Restart warm CPU 2*"}, - {0x66, "Restart warm CPU 3*"}, - {0x67, "Restart warm CPU 4*"}, - {0x68, "Restart warm CPU 5*"}, - {0x69, "Restart warm CPU 6*"}, - {0x6A, "Restart warm (own CPU)*"}, - {0x6B, "Restart warm (All CPUs)*"}, - {0x6E, "Change block*"}, - {0x6F, "Clear history failure*"}, - {0x70, "Delete program line*"}, - {0x71, "Go conditional*"}, - {0x72, "Insert program line*"}, - {0x73, "Local cycles*"}, - {0x74, "All cycles*"}, - {0x75, "Make text*"}, - {0x76, "Execute single instruction*"}, - {0x77, "Single step*"}, - {0x82, "XOB 17 interrupt"}, - {0x83, "XOB 18 interrupt"}, - {0x84, "XOB 19 interrupt"}, - {0x91, "Read hangup timeout"}, - {0x96, "Read data block"}, - {0x97, "Write data block"}, - {0x98, "Make data block*"}, - {0x99, "Clear data block*"}, - {0x9A, "Clear text*"}, - {0x9B, "Read block address"}, - {0x9C, "Read block sizes"}, - {0x9D, "Read current block*"}, - {0x9E, "Read call stack*"}, - {0x9F, "Read DBX"}, - {0xA1, "Read user EEPROM register"}, - {0xA3, "Write user EEPROM register"}, - {0xA5, "Erase flash*"}, - {0xA6, "Restart cold flag*"}, - {0xA7, "Write system buffer"}, - {0xA8, "Read system buffer"}, - {0xAA, "Get diagnostic*"}, - {0xAB, "Read system information*"}, - {0xAC, "Changes blocks on run*"}, - {0xAD, "Flashcard telegram*"}, - {0xAE, "Download FW*"}, - {0xAF, "Web server serial communication*"}, - {0, NULL} -}; - -static const value_string webserver_aid_vals[] = { - {0x01, "Partial request"}, - {0x02, "Request end"}, - {0x07, "Get Data"}, - {0x10, "Transfer OK"}, - {0x11, "Partial answer"}, - {0x12, "Last part of answer"}, - {0x13, "Server not ready"}, - {0, NULL} -}; - -static const guint crc_table[] = { - 0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef, - 0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,0x72f7,0x62d6,0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de, - 0x2462,0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485,0xa56a,0xb54b,0x8528,0x9509,0xe5ee,0xf5cf,0xc5ac,0xd58d, - 0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,0x5695,0x46b4,0xb75b,0xa77a,0x9719,0x8738,0xf7df,0xe7fe,0xd79d,0xc7bc, - 0x48c4,0x58e5,0x6886,0x78a7,0x0840,0x1861,0x2802,0x3823,0xc9cc,0xd9ed,0xe98e,0xf9af,0x8948,0x9969,0xa90a,0xb92b, - 0x5af5,0x4ad4,0x7ab7,0x6a96,0x1a71,0x0a50,0x3a33,0x2a12,0xdbfd,0xcbdc,0xfbbf,0xeb9e,0x9b79,0x8b58,0xbb3b,0xab1a, - 0x6ca6,0x7c87,0x4ce4,0x5cc5,0x2c22,0x3c03,0x0c60,0x1c41,0xedae,0xfd8f,0xcdec,0xddcd,0xad2a,0xbd0b,0x8d68,0x9d49, - 0x7e97,0x6eb6,0x5ed5,0x4ef4,0x3e13,0x2e32,0x1e51,0x0e70,0xff9f,0xefbe,0xdfdd,0xcffc,0xbf1b,0xaf3a,0x9f59,0x8f78, - 0x9188,0x81a9,0xb1ca,0xa1eb,0xd10c,0xc12d,0xf14e,0xe16f,0x1080,0x00a1,0x30c2,0x20e3,0x5004,0x4025,0x7046,0x6067, - 0x83b9,0x9398,0xa3fb,0xb3da,0xc33d,0xd31c,0xe37f,0xf35e,0x02b1,0x1290,0x22f3,0x32d2,0x4235,0x5214,0x6277,0x7256, - 0xb5ea,0xa5cb,0x95a8,0x8589,0xf56e,0xe54f,0xd52c,0xc50d,0x34e2,0x24c3,0x14a0,0x0481,0x7466,0x6447,0x5424,0x4405, - 0xa7db,0xb7fa,0x8799,0x97b8,0xe75f,0xf77e,0xc71d,0xd73c,0x26d3,0x36f2,0x0691,0x16b0,0x6657,0x7676,0x4615,0x5634, - 0xd94c,0xc96d,0xf90e,0xe92f,0x99c8,0x89e9,0xb98a,0xa9ab,0x5844,0x4865,0x7806,0x6827,0x18c0,0x08e1,0x3882,0x28a3, - 0xcb7d,0xdb5c,0xeb3f,0xfb1e,0x8bf9,0x9bd8,0xabbb,0xbb9a,0x4a75,0x5a54,0x6a37,0x7a16,0x0af1,0x1ad0,0x2ab3,0x3a92, - 0xfd2e,0xed0f,0xdd6c,0xcd4d,0xbdaa,0xad8b,0x9de8,0x8dc9,0x7c26,0x6c07,0x5c64,0x4c45,0x3ca2,0x2c83,0x1ce0,0x0cc1, - 0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8,0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0 -}; - -/* Conversion values passing structure*/ -typedef struct { - guint32 conversation; /*Conversation ID*/ - guint16 sequence; /*Sequence number of request telegram*/ -} sbus_request_key; - -typedef struct { - guint8 cmd_code; /*command code from request*/ - guint8 count; /*rcount value*/ - guint8 sysinfo; /*system information number (or command in other telegrams)*/ -} sbus_request_val; - -/* The GMemChunk base structure (for conversations)*/ -static GHashTable *sbus_request_hash = NULL; -static GMemChunk *sbus_request_keys = NULL; -static GMemChunk *sbus_request_vals = NULL; - -static guint crc_calc (guint crc, guint val) -{ - int index; - guint ncrc; - - index = (((crc >> 8) ^ val) & 0xff); - ncrc = crc_table[index] ^ ((crc << 8) & 0xffff); - - return ncrc; -} - -/* Hash functions*/ -static gint sbus_equal(gconstpointer v, gconstpointer w) -{ - sbus_request_key *v1 = (sbus_request_key *)v; - sbus_request_key *v2 = (sbus_request_key *)w; - - if (v1->conversation == v2->conversation && - v1->sequence == v2->sequence) { - return 1; - } - return 0; -} - -static guint sbus_hash(gconstpointer v) -{ - sbus_request_key *key = (sbus_request_key *)v; - guint val; - val = key->conversation + key->sequence; - return val; -} - -/*Protocol initialisation*/ -static void sbus_init_protocol(void){ - if (sbus_request_hash){ - g_hash_table_destroy(sbus_request_hash); - } - if (sbus_request_keys){ - g_mem_chunk_destroy(sbus_request_keys); - } - if (sbus_request_vals){ - g_mem_chunk_destroy(sbus_request_vals); - } - sbus_request_hash = g_hash_table_new(sbus_hash, sbus_equal); - sbus_request_keys = g_mem_chunk_new("sbus_request_keys", - sizeof(sbus_request_key), - SBUS_MEMCHUNKSIZE * sizeof(sbus_request_key), - G_ALLOC_AND_FREE); - sbus_request_vals = g_mem_chunk_new("sbus_request_vals", - sizeof(sbus_request_val), - SBUS_MEMCHUNKSIZE * sizeof(sbus_request_val), - G_ALLOC_AND_FREE); -} - -/* check whether the packet looks like SBUS or not */ -static gboolean -is_sbus_pdu(tvbuff_t *tvb) -{ - guint32 length; - - /* we need at least 8 bytes to determine whether this is sbus or - not - */ - if(tvb_length(tvb)<8){ - return FALSE; - } - - /* the length must be >= 8 bytes to accomodate the header, - it also must be <65536 to fit inside a udp packet - */ - length=tvb_get_ntohl(tvb, 0); - if ( (length<8) || (length>65535) ) { - return FALSE; - } - if (tvb_reported_length(tvb) != length) { - return FALSE; - } - - /* XXX */ - /* We should also test version and protocol but that requires - someone to look at the specification for SBUS - */ - - return TRUE; -} - -/*Dissect the telegram*/ -static int -dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - -/* Set up structures needed to add the protocol subtree and manage it */ - proto_item *ti, *et, *dt, *hi; - proto_tree *sbus_tree, *ethsbus_tree, *sbusdata_tree; - - gint i; /*for CRC calculation*/ - gint j; /*for CRC calculation*/ - gint offset; - gint sbus_eth_len; - guint sbus_crc_calc; - guint8 sbus_version; - guint8 sbus_attribut; - guint8 sbus_media_cnt; - guint8 sbus_fio_cnt; - guint8 sbus_cmd_code; - guint8 sbus_web_size; - guint8 sbus_web_aid; - guint8 sbus_web_seq; - guint8 sbus_sysinfo_number; - guint32 sbus_binarymasked; - guint32 sbus_binaries; - guint16 sbus_ack_code; - guint32 sbus_show_bin; - guint32 sbus_helper; - guint32 sbus_helper1; - guint32 sbus_helper2; - char *tmp_string; - -/* Set up conversations*/ - conversation_t *conversation = NULL; - sbus_request_key request_key, *new_request_key; - sbus_request_val *request_val = NULL; - - /* does this look like an sbus pdu? */ - if(!is_sbus_pdu(tvb)){ - return 0; - } - - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - - if (!conversation) { - /* create new conversation*/ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - } - - request_key.conversation = conversation->index; - request_key.sequence = tvb_get_ntohs(tvb,6); - - request_val = (sbus_request_val *) g_hash_table_lookup(sbus_request_hash, - &request_key); - /* Only allocate a new hash element when it's a request*/ - sbus_attribut = tvb_get_guint8(tvb,8); - - if ( !request_val && sbus_attribut == 0 ) {/* request telegram */ - new_request_key = g_mem_chunk_alloc(sbus_request_keys); - *new_request_key = request_key; - - request_val = g_mem_chunk_alloc(sbus_request_vals); - request_val->cmd_code=tvb_get_guint8(tvb,10); - - if (((request_val->cmd_code) == SBUS_RD_USER_EEPROM_REGISTER) || - ((request_val->cmd_code) == SBUS_WR_USER_EEPROM_REGISTER)) { - request_val->count=((tvb_get_guint8(tvb,12))+1); - } else { - request_val->count=((tvb_get_guint8(tvb,11))+1); - } - - /*Enter system info*/ - if ((request_val->cmd_code) == SBUS_RD_SYSTEM_INFORMATION) { - request_val->sysinfo=(tvb_get_guint8(tvb,12)); - } else { - request_val->sysinfo=0x0; - } - - g_hash_table_insert(sbus_request_hash, new_request_key, request_val); - } -/* End of attaching data to hash table*/ - -/* Make entries in Protocol column and Info column on summary display */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, "S-Bus"); - - if (check_col(pinfo->cinfo, COL_INFO)) - col_clear(pinfo->cinfo, COL_INFO); - offset = 0; - - if (check_col(pinfo->cinfo, COL_INFO)) { - switch (sbus_attribut){ - case SBUS_REQUEST: - sbus_cmd_code = tvb_get_guint8(tvb,10); - - /* Special treatment of web server request - * as is is very helpful to see more information in the packetlist */ - if (sbus_cmd_code == SBUS_WEB_SERVER_SERIAL_COMM) { - sbus_web_aid = tvb_get_guint8(tvb,12); - sbus_web_seq = tvb_get_guint8(tvb,13); - - col_add_fstr(pinfo->cinfo, COL_INFO, - "Web Server Request: %s (Seq No: %d)", - val_to_str(sbus_web_aid, - webserver_aid_vals, "Unknown Request!"), - sbus_web_seq); - } else { - /* All other requests */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "Request: %s", val_to_str(sbus_cmd_code, - sbus_command_vals, "Unknown Command!")); - } - break; - - case SBUS_RESPONSE: - /* Special treatment of web server request - * as is is very helpful to see more information in the packetlist */ - if (request_val && ((request_val->cmd_code) == SBUS_WEB_SERVER_SERIAL_COMM)) { - sbus_web_size = tvb_get_guint8(tvb,9); - sbus_web_aid = tvb_get_guint8(tvb,10); - col_add_fstr(pinfo->cinfo, COL_INFO, - "Response: %s", - val_to_str(sbus_web_aid, - webserver_aid_vals, "Unknown Request!")); - if (sbus_web_size > 1) { - sbus_web_seq = tvb_get_guint8(tvb,11); - col_append_fstr(pinfo->cinfo, COL_INFO, - " (Seq No: %d)", - sbus_web_seq); - } - } else { - col_set_str(pinfo->cinfo, COL_INFO, "Response"); - } - break; - - case SBUS_ACKNAK: - sbus_ack_code = tvb_get_ntohs(tvb,9); - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s", val_to_str(sbus_ack_code, - sbus_ack_nak_vals, - "Unknown NAK response code!")); - break; - - default: - col_set_str(pinfo->cinfo, COL_INFO, "Unknown attribute"); - break; - } - - } -/* create display subtree for the protocol */ - if (tree) { - - ti = proto_tree_add_item(tree, proto_sbus, tvb, offset, -1, FALSE); - sbus_tree = proto_item_add_subtree(ti, ett_sbus); - -/*Add subtree for Ether-S-Bus header*/ - et = proto_tree_add_text(sbus_tree, tvb, offset, 8, "Ether-S-Bus header"); - ethsbus_tree = proto_item_add_subtree(et, ett_sbus_ether); - -/* add an item to the subtree*/ - sbus_eth_len = tvb_get_ntohl(tvb,offset); - proto_tree_add_item(ethsbus_tree, - hf_sbus_length, tvb, offset, 4, FALSE); - offset += 4; - - sbus_version = tvb_get_guint8(tvb,offset); - proto_tree_add_item(ethsbus_tree, - hf_sbus_version, tvb, offset, 1, FALSE); - offset += 1; - - proto_tree_add_item(ethsbus_tree, - hf_sbus_protocol, tvb, offset, 1, FALSE); - offset += 1; - - proto_tree_add_item(ethsbus_tree, - hf_sbus_sequence, tvb, offset, 2, FALSE); - offset += 2; - -/* Continue adding stuff to the main tree*/ - sbus_attribut = tvb_get_guint8(tvb,offset); - proto_tree_add_item(sbus_tree, - hf_sbus_attribut, tvb, offset, 1, FALSE); - offset += 1; - - if (sbus_attribut == SBUS_REQUEST) { - proto_tree_add_item(sbus_tree, - hf_sbus_dest, tvb, offset, 1, FALSE); - offset += 1; - sbus_cmd_code = tvb_get_guint8(tvb,offset); - proto_tree_add_item(sbus_tree, - hf_sbus_command, tvb, offset, 1, FALSE); - offset += 1; - - switch (sbus_cmd_code) { - /*Read Counter, Register or Timer*/ - case SBUS_RD_COUNTER: - case SBUS_RD_REGISTER: - case SBUS_RD_TIMER: - sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; - proto_tree_add_uint(sbus_tree, - hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_rtc, tvb, offset, 2, FALSE); - offset += 2; - break; - - /*Read Flag, Input or Output*/ - case SBUS_RD_FLAG: - case SBUS_RD_INPUT: - case SBUS_RD_OUTPUT: - sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; - proto_tree_add_uint(sbus_tree, - hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_iof, tvb, offset, 2, FALSE); - offset += 2; - break; - - /*Write Register Timer Counter*/ - case SBUS_WR_COUNTER: - case SBUS_WR_REGISTER: - case SBUS_WR_TIMER: - sbus_media_cnt = (tvb_get_guint8(tvb,offset)); - sbus_media_cnt = ((sbus_media_cnt - 1)/4); - proto_tree_add_uint(sbus_tree, - hf_sbus_wcount_calculated, tvb, offset, - 1, sbus_media_cnt); - proto_tree_add_item(sbus_tree, - hf_sbus_wcount, tvb, offset, 1, FALSE); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_rtc, tvb, offset, 2, FALSE); - offset += 2; - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - ((sbus_media_cnt) * 4),"Data"); - - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=((sbus_media_cnt)); i>0; i--) { - proto_tree_add_item(sbusdata_tree, - hf_sbus_data_rtc, tvb, offset, - 4, FALSE); - offset += 4; - } - break; - - /* Write flags and outputs*/ - case SBUS_WR_FLAG: - case SBUS_WR_OUTPUT: - sbus_media_cnt = (tvb_get_guint8(tvb,offset)); - sbus_media_cnt = (sbus_media_cnt - 2); - proto_tree_add_uint(sbus_tree, - hf_sbus_wcount_calculated, tvb, offset, - 1, sbus_media_cnt); - proto_tree_add_item(sbus_tree, - hf_sbus_wcount, tvb, offset, 1, FALSE); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_iof, tvb, offset, 2, FALSE); - offset += 2; - sbus_fio_cnt = (tvb_get_guint8(tvb,offset)); - sbus_fio_cnt = ((sbus_fio_cnt + 1)); - proto_tree_add_uint(sbus_tree, - hf_sbus_fio_count, tvb, offset, 1, sbus_fio_cnt); - offset += 1; - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - sbus_media_cnt,"Data"); - - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=sbus_media_cnt; i>0; i--) { - sbus_helper = 1; - sbus_show_bin = 0; - sbus_binarymasked = 0x01; - sbus_binaries = tvb_get_guint8(tvb, offset); - for (j=0; j<8; j++) { - if ((sbus_binarymasked & sbus_binaries) != 0) { - sbus_show_bin = (sbus_show_bin + sbus_helper); - } - sbus_binarymasked = sbus_binarymasked<<1; - sbus_helper = 10 * sbus_helper; - } - - proto_tree_add_uint_format(sbusdata_tree, - hf_sbus_data_iof, tvb, offset, 1, sbus_show_bin, - "Binary data: %08u", sbus_show_bin); - offset += 1; - } - break; - - /* Request: Write Real time clock*/ - case SBUS_WR_RTC: - sbus_helper = tvb_get_guint8(tvb, (offset +5)); /*hours*/ - sbus_helper1 = tvb_get_guint8(tvb, (offset +6)); /*minutes*/ - sbus_helper2 = tvb_get_guint8(tvb, (offset +7)); /*seconds*/ - proto_tree_add_text(sbus_tree, tvb, (offset +5), 3, - "Time (HH:MM:SS): %02x:%02x:%02x", sbus_helper, sbus_helper1, sbus_helper2); - sbus_helper = tvb_get_guint8(tvb, (offset +2)); /*year*/ - sbus_helper1 = tvb_get_guint8(tvb, (offset +3)); /*month*/ - sbus_helper2 = tvb_get_guint8(tvb, (offset +4)); /*day*/ - proto_tree_add_text(sbus_tree, tvb, (offset +2), 3, - "Date (YY/MM/DD): %02x/%02x/%02x", sbus_helper, sbus_helper1, sbus_helper2); - sbus_helper = tvb_get_guint8(tvb, (offset)); /*year-week*/ - sbus_helper1 = tvb_get_guint8(tvb, (offset +1)); /*week-day*/ - proto_tree_add_text(sbus_tree, tvb, offset, 2, - "Calendar week: %x, Week day: %x", sbus_helper, sbus_helper1); - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - 8, "Clock data"); - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - - proto_tree_add_item(sbusdata_tree, - hf_sbus_week_day, tvb, offset, 2, FALSE); - offset += 2; - proto_tree_add_item(sbusdata_tree, - hf_sbus_date, tvb, offset, 3, FALSE); - offset += 3; - proto_tree_add_item(sbusdata_tree, - hf_sbus_time, tvb, offset, 3, FALSE); - offset += 3; - break; - - /* Read user memory or program line*/ - case SBUS_RD_USER_MEMORY: - case SBUS_RD_PROGRAM_LINE: - sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; - proto_tree_add_uint(sbus_tree, - hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_prog, tvb, offset, 3, FALSE); - offset += 3; - break; - - /*Write user memory*/ - case SBUS_WR_USER_MEMORY: - sbus_media_cnt = (tvb_get_guint8(tvb,offset)); - sbus_media_cnt = ((sbus_media_cnt - 2)/4); - proto_tree_add_uint(sbus_tree, - hf_sbus_wcount_calculated, tvb, offset, - 1, sbus_media_cnt); - proto_tree_add_item(sbus_tree, - hf_sbus_wcount, tvb, offset, 1, FALSE); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_68k, tvb, offset, 3, FALSE); - offset += 3; - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - ((sbus_media_cnt) * 4),"Program lines"); - - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=((sbus_media_cnt)); i>0; i--) { - proto_tree_add_item(sbusdata_tree, - hf_sbus_data_rtc, tvb, offset, - 4, FALSE); - offset += 4; - - } - break; - - /* Read byte*/ - case SBUS_RD_BYTE: - sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; - proto_tree_add_uint(sbus_tree, - hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_68k, tvb, offset, 3, FALSE); - offset += 3; - break; - - /* Write byte */ - case SBUS_WR_BYTE: - sbus_media_cnt = (tvb_get_guint8(tvb,offset)); - sbus_media_cnt = (sbus_media_cnt - 2); - proto_tree_add_uint(sbus_tree, - hf_sbus_wcount_calculated, tvb, offset, - 1, sbus_media_cnt); - proto_tree_add_item(sbus_tree, - hf_sbus_wcount, tvb, offset, 1, FALSE); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_68k, tvb, offset, 3, FALSE); - offset += 3; - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - ((sbus_media_cnt) * 4),"Data (bytes)"); - - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=sbus_media_cnt; i>0; i--) { - proto_tree_add_item(sbusdata_tree, - hf_sbus_data_byte, tvb, offset, - 1, FALSE); - offset += 1; - } - break; - - /*Read EEPROM register*/ - case SBUS_RD_USER_EEPROM_REGISTER: - proto_tree_add_item(sbus_tree, - hf_sbus_command_extension, tvb, offset, 1, FALSE); - offset += 1; - sbus_media_cnt = (tvb_get_guint8(tvb,offset))+1; - proto_tree_add_uint(sbus_tree, - hf_sbus_rcount, tvb, offset, 1, sbus_media_cnt); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_addr_eeprom, tvb, offset, 2, FALSE); - offset += 2; - break; - - /*Request for reading system info*/ - /*Syinfo 05 is not implemented as no serial baud is possible*/ - case SBUS_RD_SYSTEM_INFORMATION: - sbus_sysinfo_number = (tvb_get_guint8(tvb,13)); - proto_tree_add_item(sbus_tree, - hf_sbus_sysinfo_nr, tvb, offset, 1, FALSE); - offset += 1; - sbus_sysinfo_number = (tvb_get_guint8(tvb,14)); - proto_tree_add_item(sbus_tree, - hf_sbus_sysinfo_nr, tvb, offset, 1, FALSE); - offset += 1; - break; - - /* WebServer Request */ - case SBUS_WEB_SERVER_SERIAL_COMM: - sbus_web_size = tvb_get_guint8(tvb,offset); - proto_tree_add_item(sbus_tree, - hf_sbus_web_size, tvb, offset, - 1, sbus_web_size); - offset += 1; - - sbus_web_aid = tvb_get_guint8(tvb,offset); - proto_tree_add_item(sbus_tree, - hf_sbus_web_aid, tvb, offset, - 1, sbus_web_aid); - offset += 1; - - sbus_web_seq = tvb_get_guint8(tvb,offset); - proto_tree_add_item(sbus_tree, - hf_sbus_web_seq, tvb, offset, - 1, sbus_web_seq); - offset += 1; - - if (sbus_web_size > 1) { - dt = proto_tree_add_text(sbus_tree, tvb, offset, - (sbus_web_size - 1),"Data (bytes)"); - - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=sbus_web_size -1 ; i>0; i--) { - proto_tree_add_item(sbusdata_tree, - hf_sbus_data_byte, tvb, offset, - 1, FALSE); - offset += 1; - } - } - break; - -/*Inform that command was not dissected and add remaining length*/ - default: - if (sbus_eth_len > 13) { /*13 bytes is the minimal length of a request telegram...*/ - sbus_helper = sbus_eth_len - (offset + 2); - proto_tree_add_text(sbus_tree, tvb, offset, sbus_helper, - "This telegram isn't implemented in the dissector."); - offset = offset + sbus_helper; - } - } - } - -/* Response dissection*/ - if (sbus_attribut == SBUS_RESPONSE && request_val) { - switch (request_val->cmd_code) { - /* Response: 32 bit values*/ - case SBUS_RD_COUNTER: - case SBUS_RD_REGISTER: - case SBUS_RD_TIMER: - case SBUS_RD_USER_MEMORY: - case SBUS_RD_PROGRAM_LINE: - case SBUS_RD_USER_EEPROM_REGISTER: - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - ((request_val->count) * 4),"Data"); - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=(request_val->count); i>0; i--) { - proto_tree_add_item(sbusdata_tree, - hf_sbus_data_rtc, tvb, offset, - 4, FALSE); - offset += 4; - } - break; - - /* Response: PCD Display register*/ - case SBUS_RD_DISPLAY_REGISTER: - proto_tree_add_item(sbus_tree, - hf_sbus_display_register, tvb, offset, 4, FALSE); - offset += 4; - break; - - /* Add binary data I, O, F*/ - case SBUS_RD_FLAG: - case SBUS_RD_INPUT: - case SBUS_RD_OUTPUT: - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - (((request_val->count) + 7) / 8), "Data"); - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - - for (i=(((request_val->count) + 7) / 8); i>0; i--) { - sbus_helper = 1; - sbus_show_bin = 0; - sbus_binarymasked = 0x01; - sbus_binaries = tvb_get_guint8(tvb, offset); - for (j=0; j<8; j++){ - if ((sbus_binarymasked & sbus_binaries) != 0) { - sbus_show_bin = (sbus_show_bin + sbus_helper); - } - sbus_binarymasked = sbus_binarymasked<<1; - sbus_helper = 10 * sbus_helper; - } - - proto_tree_add_uint_format(sbusdata_tree, - hf_sbus_data_iof, tvb, offset, 1, sbus_show_bin, - "Binary data: %08u", sbus_show_bin); - offset += 1; - } - break; - - /* Response: Real time clock value*/ - case SBUS_RD_RTC: - sbus_helper = tvb_get_guint8(tvb, (offset +5)); /*hours*/ - sbus_helper1 = tvb_get_guint8(tvb, (offset +6)); /*minutes*/ - sbus_helper2 = tvb_get_guint8(tvb, (offset +7)); /*seconds*/ - proto_tree_add_text(sbus_tree, tvb, (offset +5), 3, - "Time (HH:MM:SS): %02x:%02x:%02x", sbus_helper, sbus_helper1, sbus_helper2); - sbus_helper = tvb_get_guint8(tvb, (offset +2)); /*year*/ - sbus_helper1 = tvb_get_guint8(tvb, (offset +3)); /*month*/ - sbus_helper2 = tvb_get_guint8(tvb, (offset +4)); /*day*/ - proto_tree_add_text(sbus_tree, tvb, (offset +2), 3, - "Date (YY/MM/DD): %02x/%02x/%02x", sbus_helper, sbus_helper1, sbus_helper2); - sbus_helper = tvb_get_guint8(tvb, (offset)); /*year-week*/ - sbus_helper1 = tvb_get_guint8(tvb, (offset +1)); /*week-day*/ - proto_tree_add_text(sbus_tree, tvb, offset, 2, - "Calendar week: %x, Week day: %x", sbus_helper, sbus_helper1); - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - 8, "Clock data"); - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - - proto_tree_add_item(sbusdata_tree, - hf_sbus_week_day, tvb, offset, 2, FALSE); - offset += 2; - proto_tree_add_item(sbusdata_tree, - hf_sbus_date, tvb, offset, 3, FALSE); - offset += 3; - proto_tree_add_item(sbusdata_tree, - hf_sbus_time, tvb, offset, 3, FALSE); - offset += 3; - break; - - /* Response: CPU status, the command codes 14..1B are concerned*/ - case SBUS_RD_PCD_STATUS_CPU0: - case SBUS_RD_PCD_STATUS_CPU1: - case SBUS_RD_PCD_STATUS_CPU2: - case SBUS_RD_PCD_STATUS_CPU3: - case SBUS_RD_PCD_STATUS_CPU4: - case SBUS_RD_PCD_STATUS_CPU5: - case SBUS_RD_PCD_STATUS_CPU6: - case SBUS_RD_PCD_STATUS_OWN: - proto_tree_add_item(sbus_tree, - hf_sbus_cpu_status, tvb, offset, 1, FALSE); - offset += 1; - break; - - /* Response: Station address*/ - case SBUS_RD_SBUS_STN_NBR: - proto_tree_add_item(sbus_tree, - hf_sbus_address, tvb, offset, 1, FALSE); - offset += 1; - break; - - /* Response: Firmware version */ - case SBUS_RD_PROGRAM_VERSION: - /*PCD type*/ - tmp_string = tvb_get_string(tvb, offset, 5); - proto_tree_add_string(sbus_tree, - hf_sbus_cpu_type, tvb, offset, 5, tmp_string); - offset += 5; - g_free(tmp_string); - /*FW version*/ - tmp_string = tvb_get_string(tvb , offset, 3); - proto_tree_add_string(sbus_tree, - hf_sbus_fw_version, tvb, offset, 3, tmp_string); - offset += 4; - g_free(tmp_string); - break; - - /* Response for Status Flags*/ - case SBUS_RD_STATUSFLAG_ACCU: - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - 1,"ACCU and arithmetic status"); - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - - proto_tree_add_item(sbusdata_tree, hf_sbus_flags_accu, - tvb, offset, 1, FALSE); - proto_tree_add_item(sbusdata_tree, hf_sbus_flags_error, - tvb, offset, 1, FALSE); - proto_tree_add_item(sbusdata_tree, hf_sbus_flags_negative, - tvb, offset, 1, FALSE); - proto_tree_add_item(sbusdata_tree, hf_sbus_flags_zero, - tvb, offset, 1, FALSE); - offset +=1; - break; - - /* Response for Read byte */ - case SBUS_RD_BYTE: - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - (request_val->count),"Data (bytes)"); - - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=(request_val->count); i>0; i--) { - proto_tree_add_item(sbusdata_tree, - hf_sbus_data_byte, tvb, offset, - 1, FALSE); - offset += 1; - } - break; - - /* Response for Read Index register */ - case SBUS_RD_INDEX_REGISTER: - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - 2,"Data (hex bytes)"); - - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=0; i<2; i++) { /*2 bytes*/ - proto_tree_add_item(sbusdata_tree, - hf_sbus_data_byte_hex, tvb, offset, - 1, FALSE); - offset += 1; - } - break; - - /* Response: Instruction pointer*/ - case SBUS_RD_INSTRUCTION_POINTER: - proto_tree_add_item(sbus_tree, - hf_sbus_addr_prog, tvb, offset, 3, FALSE); - offset += 3; - break; - - /*Response for Find History*/ - case SBUS_FIND_HISTORY: - proto_tree_add_item(sbus_tree, - hf_sbus_addr_68k, tvb, offset, 3, FALSE); - offset += 3; - proto_tree_add_item(sbus_tree, - hf_sbus_nbr_elements, tvb, offset, 2, FALSE); - offset += 2; - break; - - /* Response: Read current block*/ - case SBUS_RD_CURRENT_BLOCK: - proto_tree_add_item(sbus_tree, - hf_sbus_block_type, tvb, offset, 1, FALSE); - offset += 1; - proto_tree_add_item(sbus_tree, - hf_sbus_block_nr, tvb, offset, 2, FALSE); - offset += 2; - break; - - /* Response: Read system infomation (without interpretation of module info)*/ - case SBUS_RD_SYSTEM_INFORMATION: - if (((request_val->sysinfo) == 0x00)){ /*sysinfo 0*/ - offset += 1; /* this byte is always 0x01*/ - /*Add subtree for Data*/ - dt = proto_tree_add_text(sbus_tree, tvb, offset, - 1,"System info"); - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - - proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_1, - tvb, offset, 1, FALSE); - proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_2, - tvb, offset, 1, FALSE); - proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_3, - tvb, offset, 1, FALSE); - proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_4, - tvb, offset, 1, FALSE); - proto_tree_add_item(sbusdata_tree, hf_sbus_sysinfo0_5, - tvb, offset, 1, FALSE); - offset += 1; - } - break; - - /* Response: Webserver request */ - case SBUS_WEB_SERVER_SERIAL_COMM: - sbus_web_size = tvb_get_guint8(tvb,offset); - proto_tree_add_item(sbus_tree, - hf_sbus_web_size, tvb, offset, - 1, sbus_web_size); - offset += 1; - - sbus_web_aid = tvb_get_guint8(tvb,offset); - proto_tree_add_item(sbus_tree, - hf_sbus_web_aid, tvb, offset, - 1, sbus_web_aid); - offset += 1; - - if (sbus_web_size > 1) { - sbus_web_seq = tvb_get_guint8(tvb,offset); - proto_tree_add_item(sbus_tree, - hf_sbus_web_seq, tvb, offset, - 1, sbus_web_seq); - offset += 1; - - dt = proto_tree_add_text(sbus_tree, tvb, offset, - (sbus_web_size - 2),"Data (bytes)"); - - sbusdata_tree = proto_item_add_subtree(dt, ett_sbus_data); - for (i=sbus_web_size - 2; i>0; i--) { - proto_tree_add_item(sbusdata_tree, - hf_sbus_data_byte, tvb, offset, - 1, FALSE); - offset += 1; - } - } - break; - - /*Inform that response was not dissected and add remaining length*/ - default: - sbus_helper = sbus_eth_len - (offset + 2); - proto_tree_add_text(sbus_tree, tvb, offset, sbus_helper, - "This telegram isn't implemented in the dissector."); - offset = offset + sbus_helper; - break; - } - } - - if (sbus_attribut == SBUS_ACKNAK) { - proto_tree_add_item(sbus_tree, - hf_sbus_acknackcode, tvb, offset, 2, FALSE); - offset += 2; - } - - /* Calclulate CRC */ - sbus_crc_calc = 0; - for (i = 0; i < sbus_eth_len - 2; i++) - sbus_crc_calc = crc_calc (sbus_crc_calc, tvb_get_guint8(tvb, i)); - /*Show CRC and add hidden item for wrong CRC*/ - sbus_helper = tvb_get_ntohs(tvb, offset); - if (sbus_helper == sbus_crc_calc) { - proto_tree_add_uint_format(sbus_tree, - hf_sbus_crc, tvb, offset, 2, sbus_helper, - "Checksum: 0x%04x (correct)", sbus_helper); - } else { - proto_tree_add_uint_format(sbus_tree, - hf_sbus_crc, tvb, offset, 2, sbus_helper, - "Checksum: 0x%04x (NOT correct)", sbus_helper); - hi = proto_tree_add_boolean(sbus_tree, - hf_sbus_crc_bad, tvb, offset + 2, 2, TRUE); - PROTO_ITEM_SET_HIDDEN(hi); - } - offset += 2; /*now at the end of the telegram*/ - } - return tvb_length(tvb); -/*End of dissect_sbus*/ -} - -/* Register the protocol with Wireshark */ - -void -proto_register_sbus(void) -{ - -/* Setup list of header fields See Section 1.6.1 for details*/ - static hf_register_info hf[] = { - { &hf_sbus_length, - { "Length (bytes)", "sbus.len", - FT_UINT32, BASE_DEC, NULL, 0, - "SAIA Ether-S-Bus telegram length", HFILL } - }, - { &hf_sbus_version, - { "Version", "sbus.vers", - FT_UINT8, BASE_DEC, NULL, 0, - "SAIA Ether-S-Bus version", HFILL } - }, - { &hf_sbus_protocol, - { "Protocol type", "sbus.proto", - FT_UINT8, BASE_DEC, NULL, 0, - "SAIA Ether-S-Bus protocol type", HFILL } - }, - { &hf_sbus_sequence, - { "Sequence", "sbus.seq", - FT_UINT16, BASE_DEC, NULL, 0, - "SAIA Ether-S-Bus sequence number", HFILL } - }, - - { &hf_sbus_attribut, - { "Telegram attribute", "sbus.att", - FT_UINT8, BASE_HEX, VALS(sbus_att_vals), 0, - "SAIA Ether-S-Bus telegram attribute, indicating type of telegram", HFILL } - }, - - { &hf_sbus_dest, - { "Destination", "sbus.destination", - FT_UINT8, BASE_DEC, NULL, 0, - "SAIA S-Bus destination address", HFILL } - }, - - { &hf_sbus_address, - { "S-Bus address", "sbus.address", - FT_UINT8, BASE_DEC, NULL, 0, - "SAIA S-Bus station address", HFILL } - }, - - { &hf_sbus_command, - { "Command", "sbus.cmd", - FT_UINT8, BASE_HEX, VALS(sbus_command_vals), 0, - "SAIA S-Bus command", HFILL } - }, - - { &hf_sbus_command_extension, - { "Command extension", "sbus.cmd_extn", - FT_UINT8, BASE_HEX, NULL, 0, - "SAIA S-Bus command extension", HFILL } - }, - - { &hf_sbus_rcount, - { "R-count", "sbus.rcount", - FT_UINT8, BASE_DEC, NULL, 0, - "Number of elements expected in response", HFILL } - }, - - { &hf_sbus_wcount, - { "W-count (raw)", "sbus.wcount", - FT_UINT8, BASE_DEC, NULL, 0, - "Number of bytes to be written", HFILL } - }, - - { &hf_sbus_wcount_calculated, - { "W-count (32 bit values)", "sbus.wcount_calc", - FT_UINT8, BASE_DEC, NULL, 0, - "Number of elements to be written", HFILL } - }, - - { &hf_sbus_fio_count, - { "FIO Count (amount of bits)", "sbus.fio_count", - FT_UINT8, BASE_DEC, NULL, 0, - "Number of binary elements to be written", HFILL } - }, - - { &hf_sbus_addr_rtc, - { "Base address RTC", "sbus.addr_RTC", - FT_UINT16, BASE_DEC, NULL, 0, - "Base address of 32 bit elements to read", HFILL } - }, - - { &hf_sbus_addr_iof, - { "Base address IOF", "sbus.addr_IOF", - FT_UINT16, BASE_DEC, NULL, 0, - "Base address of binary elements to read", HFILL } - }, - - { &hf_sbus_addr_eeprom, - { "Base address of EEPROM register", "sbus.addr_EEPROM", - FT_UINT16, BASE_DEC, NULL, 0, - "Base address of 32 bit EEPROM register to read or write", HFILL } - }, - - { &hf_sbus_addr_prog, - { "Base address of user memory or program lines", "sbus.addr_prog", - FT_UINT24, BASE_DEC, NULL, 0, - "Base address of the user memory or program lines (read or write)", HFILL } - }, - - { &hf_sbus_addr_68k, - { "Base address of bytes", "sbus.addr_prog", - FT_UINT24, BASE_HEX, NULL, 0, - "Base address of bytes to read or write (68k address)", HFILL } - }, - - { &hf_sbus_block_type, - { "Block type", "sbus.block_type", - FT_UINT8, BASE_HEX, VALS(sbus_block_types), 0, - "Program block type read", HFILL } - }, - - { &hf_sbus_block_nr, - { "Block/Element nr", "sbus.block_nr", - FT_UINT16, BASE_DEC, NULL, 0, - "Program block / DatatBlock number", HFILL } - }, - - { &hf_sbus_nbr_elements, - { "Number of elements", "sbus.nbr_elements", - FT_UINT16, BASE_DEC, NULL, 0, - "Number of elements or characters", HFILL } - }, - - { &hf_sbus_display_register, - { "PCD Display register", "sbus.data_display_register", - FT_UINT32, BASE_DEC, NULL, 0, - "The PCD display register (32 bit value)", HFILL } - }, - - { &hf_sbus_data_rtc, - { "S-Bus 32-bit data", "sbus.data_rtc", - FT_UINT32, BASE_DEC, NULL, 0, - "One regiser/timer of counter (32 bit value)", HFILL } - }, - - { &hf_sbus_data_byte, - { "Data bytes", "sbus.data_byte", - FT_UINT8, BASE_DEC, NULL, 0, - "One byte from PCD", HFILL } - }, - - { &hf_sbus_data_byte_hex, - { "Data bytes (hex)", "sbus.data_byte_hex", - FT_UINT8, BASE_HEX, NULL, 0, - "One byte from PCD (hexadecimal)", HFILL } - }, - - { &hf_sbus_data_iof, - { "S-Bus binary data", "sbus.data_iof", - FT_UINT32, BASE_DEC, NULL, 0, - "8 binaries", HFILL } - }, - - { &hf_sbus_cpu_type, - { "PCD type", "sbus.pcd_type", - FT_STRING, BASE_NONE, NULL, 0, - "PCD type (short form)", HFILL } - }, - - { &hf_sbus_fw_version, - { "Firmware version", "sbus.fw_version", - FT_STRING, BASE_NONE, NULL, 0, - "Firmware version of the PCD or module", HFILL } - }, - - { &hf_sbus_sysinfo_nr, - { "System information number", "sbus.sysinfo", - FT_UINT8, BASE_HEX, NULL, 0, - "System information number (extension to command code)", HFILL } - }, - - { &hf_sbus_sysinfo0_1, - { "Mem size info", "sbus.sysinfo0.mem", - FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_MEMSIZE, - "Availability of memory size information", HFILL } - }, - { &hf_sbus_sysinfo0_2, - { "Trace buffer", "sbus.sysinfo0.trace", - FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_TRACE, - "Availability of trace buffer feature", HFILL } - }, - { &hf_sbus_sysinfo0_3, - { "Slot B1", "sbus.sysinfo0.b1", - FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_INFO_B1, - "Presence of EEPROM information on slot B1", HFILL } - }, - { &hf_sbus_sysinfo0_4, - { "Slot B2", "sbus.sysinfo0.b2", - FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_INFO_B2, - "Presence of EEPROM information on slot B2", HFILL } - }, - { &hf_sbus_sysinfo0_5, - { "PGU baud", "sbus.sysinfo0.pgubaud", - FT_BOOLEAN, 8, TFS(&tfs_sbus_present), F_PGU_BAUD, - "Availability of PGU baud switch feature", HFILL } - }, - - { &hf_sbus_sysinfo_length, - { "System information length", "sbus.sysinfo_length", - FT_UINT8, BASE_HEX, NULL, 0, - "System information length in response", HFILL } - }, - - { &hf_sbus_f_module_type, - { "F-module type", "sbus.fmodule_type", - FT_STRING, BASE_NONE, NULL, 0, - "Module type mounted on B1/2 slot", HFILL } - }, - - { &hf_sbus_harware_version, - { "Hardware version", "sbus.hw_version", - FT_STRING, BASE_NONE, NULL, 0, - "Hardware version of the PCD or the module", HFILL } - }, - - { &hf_sbus_hardware_modification, - { "Hardware modification", "sbus.hw_modification", - FT_UINT8, BASE_DEC, NULL, 0, - "Hardware modification of the PCD or module", HFILL } - }, - - { &hf_sbus_various, - { "Varous data", "sbus.various", - FT_NONE, BASE_NONE, NULL, 0, - "Various data contained in telegrams but nobody will search for it", HFILL } - }, - - { &hf_sbus_acknackcode, - { "ACK/NAK code", "sbus.nakcode", - FT_UINT16, BASE_HEX, VALS(sbus_ack_nak_vals), 0, - "SAIA S-Bus ACK/NAK response", HFILL } - }, - - { &hf_sbus_cpu_status, - { "CPU status", "sbus.CPU_status", - FT_UINT8, BASE_HEX, VALS(sbus_CPU_status), 0, - "SAIA PCD CPU status", HFILL } - }, - - { &hf_sbus_week_day, - { "RTC calendar week and week day", "sbus.rtc.week_day", - FT_UINT16, BASE_HEX, NULL, 0, - "Calendar week and week day number of the real time clock", HFILL } - }, - - { &hf_sbus_date, - { "RTC date (YYMMDD)", "sbus.rtc.date", - FT_UINT24, BASE_HEX, NULL, 0, - "Year, month and day of the real time clock", HFILL } - }, - - { &hf_sbus_time, - { "RTC time (HHMMSS)", "sbus.rtc.time", - FT_UINT24, BASE_HEX, NULL, 0, - "Time of the real time clock", HFILL } - }, - - { &hf_sbus_web_size, - { "Web server packet size", "sbus.web.size", - FT_UINT8, BASE_HEX, NULL, 0, - "Web server packet size", HFILL } - }, - - { &hf_sbus_web_aid, - { "AID", "sbus.web.aid", - FT_UINT8, BASE_HEX, NULL, 0, - "Web server command/status code (AID)", HFILL } - }, - - { &hf_sbus_web_seq, - { "Sequence", "sbus.web.seq", - FT_UINT8, BASE_HEX, NULL, 0, - "Web server sequence nr (PACK_N)", HFILL } - }, - - { &hf_sbus_crc, - { "Checksum", "sbus.crc", - FT_UINT16, BASE_HEX, NULL, 0, - "CRC 16", HFILL } - }, - - { &hf_sbus_crc_bad, - { "Bad Checksum", "sbus.crc_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "A bad checksum in the telegram", HFILL }}, - - { &hf_sbus_flags_accu, - { "ACCU", "sbus.flags.accu", - FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_ACCU, - "PCD Accumulator", HFILL } - }, - - { &hf_sbus_flags_error, - { "Error flag", "sbus.flags.error", - FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_ERROR, - "PCD error flag", HFILL } - }, - - { &hf_sbus_flags_negative, - { "N-flag", "sbus.flags.nflag", - FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_NEGATIVE, - "Negative status flag", HFILL } - }, - - { &hf_sbus_flags_zero, - { "Z-flag", "sbus.flags.zflag", - FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_ZERO, - "Zero status flag", HFILL } - } - }; - -/* Setup protocol subtree array */ - static gint *ett[] = { - &ett_sbus, - &ett_sbus_ether, - &ett_sbus_data - }; - -/* Register the protocol name and description */ - proto_sbus = proto_register_protocol("SAIA S-Bus", "SBUS", "sbus"); - -/* Required function calls to register the header fields and subtrees used */ - proto_register_field_array(proto_sbus, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - register_init_routine(&sbus_init_protocol); -} - -void -proto_reg_handoff_sbus(void) -{ - dissector_handle_t sbus_handle; - - sbus_handle = new_create_dissector_handle(dissect_sbus, proto_sbus); - dissector_add("udp.port", 5050, sbus_handle); -} - diff --git a/plugins/sbus/plugin.rc.in b/plugins/sbus/plugin.rc.in deleted file mode 100644 index 568dc07b49..0000000000 --- a/plugins/sbus/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", "The Wireshark developer community, http://www.wireshark.org/\0" - VALUE "FileDescription", "@PACKAGE@ dissector\0" - VALUE "FileVersion", "@MODULE_VERSION@\0" - VALUE "InternalName", "@PACKAGE@ @MODULE_VERSION@\0" - VALUE "LegalCopyright", "Copyright © 1998 Gerald Combs , Gilbert Ramirez and others\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 -- cgit v1.2.3