packet-hislip.c: various minor fixes

- Create/use an extended value-string;
- Clean up code relating to setting COL_PROTO & COL_INFO;
- Use consistent whitespace formatting.

Change-Id: I3087d959db09cd90c1a5dd53fe7af7baf999b76c
Reviewed-on: https://code.wireshark.org/review/3542
Reviewed-by: Bill Meier <wmeier@newsguy.com>
This commit is contained in:
Bill Meier 2014-08-10 17:34:52 -04:00
parent e7301a15ab
commit d161f21be1
1 changed files with 213 additions and 210 deletions

View File

@ -30,12 +30,12 @@
#include "config.h"
#include <glib.h>
#include <epan/wmem/wmem.h>
#include <epan/conversation.h>
#include <epan/packet.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/conversation.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#include <epan/wmem/wmem.h>
#include <epan/dissectors/packet-tcp.h>
#define PROTO_TAG_HiSLIP "HiSLIP"
#define FRAME_HEADER_LEN 16
@ -284,92 +284,93 @@ static const range_string nonfatalerrortype[] =
/*See http://ivifoundation.org/specifications/default.aspx
VPP-9: Instrument Vendor Abbreviations Table 3-1 */
/* Sorted by value */
static const value_string vendorID[] =
{
{ 0x4151, "Acqiris" },
{ 0x4143, "Applicos BV" },
{ 0x4156, "Advantest Corporation" },
{ 0x4144, "Ando Electric Company Limited" },
{ 0x4146, "Aeroflex Laboratories" },
{ 0x4147, "Agilent Technologies" },
{ 0x4149, "AIM GmbH" },
{ 0x414D, "AMP Incorporated" },
{ 0x414E, "Analogic, Corp." },
{ 0x4144, "Ando Electric Company Limited" },
{ 0x4155, "Anritsu Company" },
{ 0x414F, "AOIP Instrumentation" },
{ 0x4153, "ASCOR Incorporated" },
{ 0x4150, "Audio Precision, Inc" },
{ 0x4242, "B&B Technologies" },
{ 0x4151, "Acqiris" },
{ 0x4153, "ASCOR Incorporated" },
{ 0x4154, "Thurlby Thandar Instruments Limited" },
{ 0x4155, "Anritsu Company" },
{ 0x4155, "Serendipity Systems, Inc." },
{ 0x4156, "Advantest Corporation" },
{ 0x4241, "BAE Systems" },
{ 0x4242, "B&B Technologies" },
{ 0x424B, "Bruel & Kjaer" },
{ 0x4255, "Bustec Production Ltd." },
{ 0x4341, "CAL-AV Labs, Inc." },
{ 0x4349, "Cambridge Instruments" },
{ 0x4348, "C&H Technologies, Inc." },
{ 0x4343, "Compressor Controls Corporation" },
{ 0x4348, "C&H Technologies, Inc." },
{ 0x4349, "Cambridge Instruments" },
{ 0x4359, "CYTEC Corporation" },
{ 0x4450, "Directed Perceptions Inc." },
{ 0x4453, "DSP Technology Inc." },
{ 0x4749, "EIP Microwave, Inc." },
{ 0x4456, "IBEKO POWER AB" },
{ 0x464C, "Fluke Company Inc." },
{ 0x464F, "fos4X GmbH" },
{ 0x4752, "GenRad" },
{ 0x4754, "Giga-tronics, Inc." },
{ 0x4749, "EIP Microwave, Inc." },
{ 0x474b, "gnubi communications, Inc." },
{ 0x4750, "Hewlett-Packard Company" },
{ 0x554E, "Holding 'Informtest'" },
{ 0x4456, "IBEKO POWER AB" },
{ 0x4946, "IFR" },
{ 0x4945, "Instrumentation Engineering, Inc." },
{ 0x4752, "GenRad" },
{ 0x4754, "Giga-tronics, Inc." },
{ 0x4943, "Integrated Control Systems" },
{ 0x4945, "Instrumentation Engineering, Inc." },
{ 0x4946, "IFR" },
{ 0x4B45, "Keithley Instruments" },
{ 0x4B50, "Kepco, Inc." },
{ 0x4B54, "Keysight Technologies (Reserved)" },
{ 0x4B49, "Kikusui" },
{ 0x4B50, "Kepco, Inc." },
{ 0x4B53, "KineticSystems, Corp." },
{ 0x4B54, "Keysight Technologies (Reserved)" },
{ 0x4C43, "LeCroy" },
{ 0x4C50, "LitePoint Corporation" },
{ 0x4D50, "MAC Panel Company" },
{ 0x4D54, "ManTech Test Systems" },
{ 0x4D41, "North Atlantic Instruments" },
{ 0x4D48, "NH Research" },
{ 0x4D49, "Marconi Instruments" },
{ 0x4D50, "MAC Panel Company" },
{ 0x4D53, "Microscan" },
{ 0x4D54, "ManTech Test Systems" },
{ 0x4D57, "Pacific MindWorks, Inc." },
{ 0x4E49, "National Instruments Corp." },
{ 0x4E54, "NEUTRIK AG" },
{ 0x4D48, "NH Research" },
{ 0x4D41, "North Atlantic Instruments" },
{ 0x4D57, "Pacific MindWorks, Inc." },
{ 0x504D, "Phase Metrics" },
{ 0x5049, "Pickering Interfaces" },
{ 0x5043, "Picotest" },
{ 0x5049, "Pickering Interfaces" },
{ 0x504D, "Phase Metrics" },
{ 0x5054, "Power-Tek Inc." },
{ 0x5249, "Racal Instruments, Inc." },
{ 0x5241, "Radisys Corp." },
{ 0x5249, "Racal Instruments, Inc." },
{ 0x5253, "Rohde & Schwarz GmbH" },
{ 0x534C, "Schlumberger Technologies" },
{ 0x5343, "Scicom" },
{ 0x534C, "Schlumberger Technologies" },
{ 0x5352, "Scientific Research Corporation" },
{ 0x4155, "Serendipity Systems, Inc." },
{ 0x5352, "Sony/Tektronix Corporation" },
{ 0x5353, "Spectrum Signal Processing, Inc." },
{ 0x5441, "Talon Instruments" },
{ 0x544B, "Tektronix, Inc." },
{ 0x5445, "Teradyne" },
{ 0x5453, "Test & Measurement Systems Inc." },
{ 0x4154, "Thurlby Thandar Instruments Limited" },
{ 0x544B, "Tektronix, Inc." },
{ 0x544D, "Transmagnetics, Inc." },
{ 0x5453, "Test & Measurement Systems Inc." },
{ 0x5454, "TTI Testron, Inc." },
{ 0x554E, "Holding 'Informtest'" },
{ 0x5553, "Universal Switching Corporation" },
{ 0x5641, "VXIbus Associates, Inc." },
{ 0x5645, "Vencon Technologies Inc." },
{ 0x5650, "Virginia Panel, Corp." },
{ 0x5654, "VXI Technology, Inc." },
{ 0x5641, "VXIbus Associates, Inc." },
{ 0x5754, "Wavetek Corp." },
{ 0x5747, "Wandel & Goltermann" },
{ 0x5754, "Wavetek Corp." },
{ 0x594B, "Yokogawa Electric Corporation" },
{ 0x5A54, "Electric Corporation" },
{ 0, NULL }
};
static value_string_ext vendorID_ext = VALUE_STRING_EXT_INIT(vendorID);
static void
decode_messagepara(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, hislipinfo *data)
@ -708,6 +709,13 @@ dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,void
memset(&hislip_data, 0, sizeof(hislip_data));
/*Write "HiSLIP" in the protocol column*/
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_HiSLIP);
/* Clear out stuff in the info column */
col_clear(pinfo->cinfo, COL_INFO);
/*Get Message Type*/
hislip_data.messagetype = tvb_get_guint8(tvb, hislip_data.offset+2);
/*Get Control Type*/
@ -718,16 +726,8 @@ dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,void
hislip_data.payloadlength = tvb_get_ntoh64(tvb, hislip_data.offset+8);
/*Clear the protocol column*/
col_clear(pinfo->cinfo,COL_PROTOCOL);
/*Write "HiSLIP" in the protocol column*/
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_HiSLIP);
/* Clear out stuff in the info column */
col_clear(pinfo->cinfo,COL_INFO);
/* Write Messagetype in the info column */
col_append_fstr(pinfo->cinfo,COL_INFO,"%s" ,rval_to_str( hislip_data.messagetype, messagetypestring, "Unknown"));
col_add_fstr(pinfo->cinfo, COL_INFO, "%s", rval_to_str(hislip_data.messagetype, messagetypestring, "Unknown"));
if (tree)
@ -887,6 +887,9 @@ dissect_hislip_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
if (tvb_get_ntohs(tvb, 0) != 0x4853)
return FALSE;
/* XXX: Can it be assumed that all following packets for this connection will also be 'hislip' ?
* If so, conversation_set_dissector() should be called.
*/
dissect_hislip(tvb, pinfo, tree, data);
return TRUE;
@ -951,7 +954,7 @@ proto_register_hislip (void)
{ "Server version", "hislip.msgpara.servproto", FT_UINT16, BASE_HEX, NULL, 0x0,
"HiSLIP Server Protocol version", HFILL }},
{ &hf_hislip_msgpara_vendorID,
{ "VendorID", "hislip.msgpara.vendorID", FT_UINT16 , BASE_HEX, VALS(vendorID), 0x0,
{ "VendorID", "hislip.msgpara.vendorID", FT_UINT16, BASE_HEX|BASE_EXT_STRING, &vendorID_ext, 0x0,
"HiSLIP VendorID", HFILL }},
{ &hf_hislip_msgpara_clientproto,
{ "Client version", "hislip.msgpara.clientproto", FT_UINT16, BASE_HEX, NULL, 0x0,