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,44 +30,44 @@
#include "config.h" #include "config.h"
#include <glib.h> #include <glib.h>
#include <epan/wmem/wmem.h>
#include <epan/conversation.h>
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/dissectors/packet-tcp.h> #include <epan/conversation.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/expert.h> #include <epan/expert.h>
#include <epan/wmem/wmem.h>
#include <epan/dissectors/packet-tcp.h>
#define PROTO_TAG_HiSLIP "HiSLIP" #define PROTO_TAG_HiSLIP "HiSLIP"
#define FRAME_HEADER_LEN 16 #define FRAME_HEADER_LEN 16
#define MAX_DATA_SHOW_SIZE 60 #define MAX_DATA_SHOW_SIZE 60
/*Messagetypes*/ /*Messagetypes*/
#define HISLIP_INITIALIZE 0 #define HISLIP_INITIALIZE 0
#define HISLIP_INITIALIZERESPONSE 1 #define HISLIP_INITIALIZERESPONSE 1
#define HISLIP_FATALERROR 2 #define HISLIP_FATALERROR 2
#define HISLIP_ERROR 3 #define HISLIP_ERROR 3
#define HISLIP_ASYNCLOCK 4 #define HISLIP_ASYNCLOCK 4
#define HISLIP_ASYNCLOCK_RESPONSE 5 #define HISLIP_ASYNCLOCK_RESPONSE 5
#define HISLIP_DATA 6 #define HISLIP_DATA 6
#define HISLIP_DATAEND 7 #define HISLIP_DATAEND 7
#define HISLIP_DEVICECLEARCOMPLETE 8 #define HISLIP_DEVICECLEARCOMPLETE 8
#define HISLIP_DEVICECLEARACKNOWLEDGE 9 #define HISLIP_DEVICECLEARACKNOWLEDGE 9
#define HISLIP_ASYNCREMOTELOCALCONTROL 10 #define HISLIP_ASYNCREMOTELOCALCONTROL 10
#define HISLIP_ASYNCREMOTELOCALRESPONSE 11 #define HISLIP_ASYNCREMOTELOCALRESPONSE 11
#define HISLIP_TRIGGER 12 #define HISLIP_TRIGGER 12
#define HISLIP_INTERRUPTED 13 #define HISLIP_INTERRUPTED 13
#define HISLIP_ASYNCINTERRUPTED 14 #define HISLIP_ASYNCINTERRUPTED 14
#define HISLIP_ASYNCMAXIMUMMESSAGESIZE 15 #define HISLIP_ASYNCMAXIMUMMESSAGESIZE 15
#define HISLIP_ASYNCMAXIMUMMESSAGESIZERESPONSE 16 #define HISLIP_ASYNCMAXIMUMMESSAGESIZERESPONSE 16
#define HISLIP_ASYNCINITIALIZE 17 #define HISLIP_ASYNCINITIALIZE 17
#define HISLIP_ASYNCINITIALIZERESPONSE 18 #define HISLIP_ASYNCINITIALIZERESPONSE 18
#define HISLIP_ASYNCDEVICECLEAR 19 #define HISLIP_ASYNCDEVICECLEAR 19
#define HISLIP_ASYNCSERVICEREQUEST 20 #define HISLIP_ASYNCSERVICEREQUEST 20
#define HISLIP_ASYNCSTATUSQUERY 21 #define HISLIP_ASYNCSTATUSQUERY 21
#define HISLIP_ASYNCSTATUSRESPONSE 22 #define HISLIP_ASYNCSTATUSRESPONSE 22
#define HISLIP_ASYNCDEVICECLEARACKNOWLEDGE 23 #define HISLIP_ASYNCDEVICECLEARACKNOWLEDGE 23
#define HISLIP_ASYNCLOCKINFO 24 #define HISLIP_ASYNCLOCKINFO 24
#define HISLIP_ASYNCLOCKINFORESPONSE 25 #define HISLIP_ASYNCLOCKINFORESPONSE 25
@ -104,7 +104,7 @@ typedef struct _hislipinfo
} hislipinfo; } hislipinfo;
void proto_register_hislip (void); void proto_register_hislip(void);
void proto_reg_handoff_hislip(void); void proto_reg_handoff_hislip(void);
static gint global_hislip_port = 4880; static gint global_hislip_port = 4880;
@ -284,118 +284,119 @@ static const range_string nonfatalerrortype[] =
/*See http://ivifoundation.org/specifications/default.aspx /*See http://ivifoundation.org/specifications/default.aspx
VPP-9: Instrument Vendor Abbreviations Table 3-1 */ VPP-9: Instrument Vendor Abbreviations Table 3-1 */
/* Sorted by value */
static const value_string vendorID[] = static const value_string vendorID[] =
{ {
{ 0x4151, "Acqiris" },
{ 0x4143, "Applicos BV" }, { 0x4143, "Applicos BV" },
{ 0x4156, "Advantest Corporation" }, { 0x4144, "Ando Electric Company Limited" },
{ 0x4146, "Aeroflex Laboratories" }, { 0x4146, "Aeroflex Laboratories" },
{ 0x4147, "Agilent Technologies" }, { 0x4147, "Agilent Technologies" },
{ 0x4149, "AIM GmbH" }, { 0x4149, "AIM GmbH" },
{ 0x414D, "AMP Incorporated" }, { 0x414D, "AMP Incorporated" },
{ 0x414E, "Analogic, Corp." }, { 0x414E, "Analogic, Corp." },
{ 0x4144, "Ando Electric Company Limited" },
{ 0x4155, "Anritsu Company" },
{ 0x414F, "AOIP Instrumentation" }, { 0x414F, "AOIP Instrumentation" },
{ 0x4153, "ASCOR Incorporated" },
{ 0x4150, "Audio Precision, Inc" }, { 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" }, { 0x4241, "BAE Systems" },
{ 0x4242, "B&B Technologies" },
{ 0x424B, "Bruel & Kjaer" }, { 0x424B, "Bruel & Kjaer" },
{ 0x4255, "Bustec Production Ltd." }, { 0x4255, "Bustec Production Ltd." },
{ 0x4341, "CAL-AV Labs, Inc." }, { 0x4341, "CAL-AV Labs, Inc." },
{ 0x4349, "Cambridge Instruments" },
{ 0x4348, "C&H Technologies, Inc." },
{ 0x4343, "Compressor Controls Corporation" }, { 0x4343, "Compressor Controls Corporation" },
{ 0x4348, "C&H Technologies, Inc." },
{ 0x4349, "Cambridge Instruments" },
{ 0x4359, "CYTEC Corporation" }, { 0x4359, "CYTEC Corporation" },
{ 0x4450, "Directed Perceptions Inc." }, { 0x4450, "Directed Perceptions Inc." },
{ 0x4453, "DSP Technology Inc." }, { 0x4453, "DSP Technology Inc." },
{ 0x4749, "EIP Microwave, Inc." }, { 0x4456, "IBEKO POWER AB" },
{ 0x464C, "Fluke Company Inc." }, { 0x464C, "Fluke Company Inc." },
{ 0x464F, "fos4X GmbH" }, { 0x464F, "fos4X GmbH" },
{ 0x4752, "GenRad" }, { 0x4749, "EIP Microwave, Inc." },
{ 0x4754, "Giga-tronics, Inc." },
{ 0x474b, "gnubi communications, Inc." }, { 0x474b, "gnubi communications, Inc." },
{ 0x4750, "Hewlett-Packard Company" }, { 0x4750, "Hewlett-Packard Company" },
{ 0x554E, "Holding 'Informtest'" }, { 0x4752, "GenRad" },
{ 0x4456, "IBEKO POWER AB" }, { 0x4754, "Giga-tronics, Inc." },
{ 0x4946, "IFR" },
{ 0x4945, "Instrumentation Engineering, Inc." },
{ 0x4943, "Integrated Control Systems" }, { 0x4943, "Integrated Control Systems" },
{ 0x4945, "Instrumentation Engineering, Inc." },
{ 0x4946, "IFR" },
{ 0x4B45, "Keithley Instruments" }, { 0x4B45, "Keithley Instruments" },
{ 0x4B50, "Kepco, Inc." },
{ 0x4B54, "Keysight Technologies (Reserved)" },
{ 0x4B49, "Kikusui" }, { 0x4B49, "Kikusui" },
{ 0x4B50, "Kepco, Inc." },
{ 0x4B53, "KineticSystems, Corp." }, { 0x4B53, "KineticSystems, Corp." },
{ 0x4B54, "Keysight Technologies (Reserved)" },
{ 0x4C43, "LeCroy" }, { 0x4C43, "LeCroy" },
{ 0x4C50, "LitePoint Corporation" }, { 0x4C50, "LitePoint Corporation" },
{ 0x4D50, "MAC Panel Company" }, { 0x4D41, "North Atlantic Instruments" },
{ 0x4D54, "ManTech Test Systems" }, { 0x4D48, "NH Research" },
{ 0x4D49, "Marconi Instruments" }, { 0x4D49, "Marconi Instruments" },
{ 0x4D50, "MAC Panel Company" },
{ 0x4D53, "Microscan" }, { 0x4D53, "Microscan" },
{ 0x4D54, "ManTech Test Systems" },
{ 0x4D57, "Pacific MindWorks, Inc." },
{ 0x4E49, "National Instruments Corp." }, { 0x4E49, "National Instruments Corp." },
{ 0x4E54, "NEUTRIK AG" }, { 0x4E54, "NEUTRIK AG" },
{ 0x4D48, "NH Research" },
{ 0x4D41, "North Atlantic Instruments" },
{ 0x4D57, "Pacific MindWorks, Inc." },
{ 0x504D, "Phase Metrics" },
{ 0x5049, "Pickering Interfaces" },
{ 0x5043, "Picotest" }, { 0x5043, "Picotest" },
{ 0x5049, "Pickering Interfaces" },
{ 0x504D, "Phase Metrics" },
{ 0x5054, "Power-Tek Inc." }, { 0x5054, "Power-Tek Inc." },
{ 0x5249, "Racal Instruments, Inc." },
{ 0x5241, "Radisys Corp." }, { 0x5241, "Radisys Corp." },
{ 0x5249, "Racal Instruments, Inc." },
{ 0x5253, "Rohde & Schwarz GmbH" }, { 0x5253, "Rohde & Schwarz GmbH" },
{ 0x534C, "Schlumberger Technologies" },
{ 0x5343, "Scicom" }, { 0x5343, "Scicom" },
{ 0x534C, "Schlumberger Technologies" },
{ 0x5352, "Scientific Research Corporation" }, { 0x5352, "Scientific Research Corporation" },
{ 0x4155, "Serendipity Systems, Inc." },
{ 0x5352, "Sony/Tektronix Corporation" }, { 0x5352, "Sony/Tektronix Corporation" },
{ 0x5353, "Spectrum Signal Processing, Inc." }, { 0x5353, "Spectrum Signal Processing, Inc." },
{ 0x5441, "Talon Instruments" }, { 0x5441, "Talon Instruments" },
{ 0x544B, "Tektronix, Inc." },
{ 0x5445, "Teradyne" }, { 0x5445, "Teradyne" },
{ 0x5453, "Test & Measurement Systems Inc." }, { 0x544B, "Tektronix, Inc." },
{ 0x4154, "Thurlby Thandar Instruments Limited" },
{ 0x544D, "Transmagnetics, Inc." }, { 0x544D, "Transmagnetics, Inc." },
{ 0x5453, "Test & Measurement Systems Inc." },
{ 0x5454, "TTI Testron, Inc." }, { 0x5454, "TTI Testron, Inc." },
{ 0x554E, "Holding 'Informtest'" },
{ 0x5553, "Universal Switching Corporation" }, { 0x5553, "Universal Switching Corporation" },
{ 0x5641, "VXIbus Associates, Inc." },
{ 0x5645, "Vencon Technologies Inc." }, { 0x5645, "Vencon Technologies Inc." },
{ 0x5650, "Virginia Panel, Corp." }, { 0x5650, "Virginia Panel, Corp." },
{ 0x5654, "VXI Technology, Inc." }, { 0x5654, "VXI Technology, Inc." },
{ 0x5641, "VXIbus Associates, Inc." },
{ 0x5754, "Wavetek Corp." },
{ 0x5747, "Wandel & Goltermann" }, { 0x5747, "Wandel & Goltermann" },
{ 0x5754, "Wavetek Corp." },
{ 0x594B, "Yokogawa Electric Corporation" }, { 0x594B, "Yokogawa Electric Corporation" },
{ 0x5A54, "Electric Corporation" }, { 0x5A54, "Electric Corporation" },
{ 0, NULL } { 0, NULL }
}; };
static value_string_ext vendorID_ext = VALUE_STRING_EXT_INIT(vendorID);
static void static void
decode_messagepara(tvbuff_t *tvb ,packet_info *pinfo _U_ , proto_tree *tree , hislipinfo *data) decode_messagepara(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, hislipinfo *data)
{ {
proto_item * item = NULL; proto_item * item = NULL;
proto_tree *msgpara_tree; proto_tree *msgpara_tree;
item = proto_tree_add_item(tree,hf_hislip_messageparameter, tvb, data->offset, 4, ENC_NA); item = proto_tree_add_item(tree, hf_hislip_messageparameter, tvb, data->offset, 4, ENC_NA);
msgpara_tree = proto_item_add_subtree(item,ett_hislip_msgpara); msgpara_tree = proto_item_add_subtree(item, ett_hislip_msgpara);
switch(data->messagetype) switch (data->messagetype)
{ {
case HISLIP_INITIALIZE: case HISLIP_INITIALIZE:
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_clientproto, tvb, data->offset,2,ENC_BIG_ENDIAN ); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_clientproto, tvb, data->offset, 2, ENC_BIG_ENDIAN );
data->offset += 2; data->offset += 2;
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_vendorID, tvb, data->offset,2,ENC_BIG_ENDIAN ); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_vendorID, tvb, data->offset, 2, ENC_BIG_ENDIAN );
data->offset += 2; data->offset += 2;
break; break;
case HISLIP_INITIALIZERESPONSE: case HISLIP_INITIALIZERESPONSE:
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_serverproto, tvb, data->offset,2,ENC_BIG_ENDIAN ); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_serverproto, tvb, data->offset, 2, ENC_BIG_ENDIAN );
data->offset += 2; data->offset += 2;
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_sessionid, tvb, data->offset,2,ENC_BIG_ENDIAN ); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_sessionid, tvb, data->offset, 2, ENC_BIG_ENDIAN );
data->offset += 2; data->offset += 2;
break; break;
@ -403,13 +404,13 @@ decode_messagepara(tvbuff_t *tvb ,packet_info *pinfo _U_ , proto_tree *tree , hi
case HISLIP_ASYNCLOCK: case HISLIP_ASYNCLOCK:
/*Request or Release?*/ /*Request or Release?*/
if(data->controlcode) if (data->controlcode)
{ /*Request*/ { /*Request*/
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_timeout, tvb, data->offset,4,ENC_BIG_ENDIAN); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_timeout, tvb, data->offset, 4, ENC_BIG_ENDIAN);
} }
else else
{ /*Release*/ { /*Release*/
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_messageid, tvb, data->offset,4,ENC_BIG_ENDIAN); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_messageid, tvb, data->offset, 4, ENC_BIG_ENDIAN);
} }
data->offset += 4; data->offset += 4;
break; break;
@ -417,7 +418,7 @@ decode_messagepara(tvbuff_t *tvb ,packet_info *pinfo _U_ , proto_tree *tree , hi
case HISLIP_ASYNCLOCKINFORESPONSE: case HISLIP_ASYNCLOCKINFORESPONSE:
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_clients, tvb, data->offset,4,ENC_BIG_ENDIAN ); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_clients, tvb, data->offset, 4, ENC_BIG_ENDIAN );
data->offset += 4; data->offset += 4;
break; break;
@ -425,7 +426,7 @@ decode_messagepara(tvbuff_t *tvb ,packet_info *pinfo _U_ , proto_tree *tree , hi
case HISLIP_ASYNCINITIALIZE: case HISLIP_ASYNCINITIALIZE:
data->offset += 2; data->offset += 2;
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_sessionid, tvb, data->offset,2,ENC_BIG_ENDIAN); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_sessionid, tvb, data->offset, 2, ENC_BIG_ENDIAN);
data->offset += 2; data->offset += 2;
break; break;
@ -433,7 +434,7 @@ decode_messagepara(tvbuff_t *tvb ,packet_info *pinfo _U_ , proto_tree *tree , hi
case HISLIP_ASYNCINITIALIZERESPONSE: case HISLIP_ASYNCINITIALIZERESPONSE:
data->offset += 2; data->offset += 2;
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_vendorID, tvb, data->offset,2,ENC_BIG_ENDIAN ); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_vendorID, tvb, data->offset, 2, ENC_BIG_ENDIAN );
data->offset += 2; data->offset += 2;
break; break;
@ -446,17 +447,17 @@ decode_messagepara(tvbuff_t *tvb ,packet_info *pinfo _U_ , proto_tree *tree , hi
case HISLIP_ASYNCSTATUSQUERY: case HISLIP_ASYNCSTATUSQUERY:
case HISLIP_ASYNCREMOTELOCALCONTROL: case HISLIP_ASYNCREMOTELOCALCONTROL:
proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_messageid, tvb, data->offset,4,ENC_BIG_ENDIAN ); proto_tree_add_item(msgpara_tree, hf_hislip_msgpara_messageid, tvb, data->offset, 4, ENC_BIG_ENDIAN );
proto_item_append_text(data->hislip_item,", MessageId: 0x%0x",data->messageparameter); proto_item_append_text(data->hislip_item, ", MessageId: 0x%0x", data->messageparameter);
data->offset += 4; data->offset += 4;
break; break;
default: default:
if(data->messageparameter != 0) if (data->messageparameter != 0)
{ {
proto_tree_add_expert(msgpara_tree,pinfo,&ei_msg_not_null,tvb,data->offset,4); proto_tree_add_expert(msgpara_tree, pinfo, &ei_msg_not_null, tvb, data->offset, 4);
} }
data->offset += 4; data->offset += 4;
} }
@ -465,106 +466,106 @@ decode_messagepara(tvbuff_t *tvb ,packet_info *pinfo _U_ , proto_tree *tree , hi
static void static void
decode_controlcode(tvbuff_t *tvb , packet_info *pinfo , proto_tree *tree , hislipinfo *data ,guint8 oldcontrolvalue) decode_controlcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, hislipinfo *data, guint8 oldcontrolvalue)
{ {
proto_item * item = NULL; proto_item * item = NULL;
switch ( data->messagetype ) switch (data->messagetype )
{ {
case HISLIP_DATA: case HISLIP_DATA:
case HISLIP_DATAEND: case HISLIP_DATAEND:
case HISLIP_TRIGGER: case HISLIP_TRIGGER:
case HISLIP_ASYNCSTATUSQUERY: case HISLIP_ASYNCSTATUSQUERY:
proto_tree_add_item(tree, hf_hislip_controlcode_rmt, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_controlcode_rmt, tvb, data->offset, 1, ENC_BIG_ENDIAN );
break; break;
case HISLIP_INITIALIZERESPONSE: case HISLIP_INITIALIZERESPONSE:
proto_tree_add_item(tree, hf_hislip_controlcode_overlap, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_controlcode_overlap, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO," [%s]", val_to_str( data->controlcode, overlap, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", val_to_str(data->controlcode, overlap, "Unknown"));
proto_item_append_text( data->hislip_item, ", %s",val_to_str( data->controlcode, overlap, "Unknown")); proto_item_append_text(data->hislip_item, ", %s", val_to_str(data->controlcode, overlap, "Unknown"));
break; break;
case HISLIP_ASYNCLOCK: case HISLIP_ASYNCLOCK:
item = proto_tree_add_item(tree, hf_hislip_controlcode_asynclock_code, tvb, data->offset,1,ENC_BIG_ENDIAN ); item = proto_tree_add_item(tree, hf_hislip_controlcode_asynclock_code, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, " [%s", val_to_str( data->controlcode, asynclock_code, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s", val_to_str(data->controlcode, asynclock_code, "Unknown"));
proto_item_append_text( data->hislip_item, ", %s", val_to_str( data->controlcode, asynclock_code, "Unknown")); proto_item_append_text(data->hislip_item, ", %s", val_to_str(data->controlcode, asynclock_code, "Unknown"));
/*if release add ] and leave*/ /*if release add ] and leave*/
if(data->controlcode != 1) if (data->controlcode != 1)
{ {
col_append_fstr( pinfo->cinfo, COL_INFO, "]"); col_append_fstr(pinfo->cinfo, COL_INFO, "]");
break; break;
} }
/*shared (Datalength != 0)or exclusive*/ /*shared (Datalength != 0)or exclusive*/
if(data->payloadlength == 0) if (data->payloadlength == 0)
{ {
proto_item_append_text( item, "[Exclusive]"); proto_item_append_text(item, "[Exclusive]");
col_append_fstr( pinfo->cinfo, COL_INFO," Exclusive]"); col_append_fstr(pinfo->cinfo, COL_INFO, " Exclusive]");
proto_item_append_text( data->hislip_item, " (Exclusive)"); proto_item_append_text(data->hislip_item, " (Exclusive)");
} }
else else
{ {
proto_item_append_text( item, "[Shared]"); proto_item_append_text(item, "[Shared]");
col_append_fstr( pinfo->cinfo, COL_INFO," Shared]"); col_append_fstr(pinfo->cinfo, COL_INFO, " Shared]");
proto_item_append_text( data->hislip_item, " (Shared)"); proto_item_append_text(data->hislip_item, " (Shared)");
} }
break; break;
case HISLIP_FATALERROR: case HISLIP_FATALERROR:
proto_tree_add_item(tree, hf_hislip_fatalerrcode, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_fatalerrcode, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, " [%s]", rval_to_str( data->controlcode, fatalerrortype, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", rval_to_str(data->controlcode, fatalerrortype, "Unknown"));
proto_item_append_text( data->hislip_item, ", %s", rval_to_str( data->controlcode, fatalerrortype, "Unknown")); proto_item_append_text(data->hislip_item, ", %s", rval_to_str(data->controlcode, fatalerrortype, "Unknown"));
break; break;
case HISLIP_ERROR: case HISLIP_ERROR:
proto_tree_add_item(tree, hf_hislip_nonfatalerrorcode, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_nonfatalerrorcode, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, " [%s]", rval_to_str( data->controlcode, nonfatalerrortype, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", rval_to_str(data->controlcode, nonfatalerrortype, "Unknown"));
proto_item_append_text( data->hislip_item, ", %s", rval_to_str( data->controlcode, nonfatalerrortype, "Unknown")); proto_item_append_text(data->hislip_item, ", %s", rval_to_str(data->controlcode, nonfatalerrortype, "Unknown"));
break; break;
case HISLIP_ASYNCLOCK_RESPONSE: case HISLIP_ASYNCLOCK_RESPONSE:
/*Response of Request or Release*/ /*Response of Request or Release*/
if(oldcontrolvalue == 1) if (oldcontrolvalue == 1)
{ /*Requestresponse*/ { /*Requestresponse*/
proto_tree_add_item(tree, hf_hislip_controlcode_asynclockresponse_code_request, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_controlcode_asynclockresponse_code_request, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, " [%s]", val_to_str( data->controlcode, asynclockresponse_code_request, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", val_to_str(data->controlcode, asynclockresponse_code_request, "Unknown"));
proto_item_append_text( data->hislip_item, ", %s", val_to_str( data->controlcode, asynclockresponse_code_request, "Unknown")); proto_item_append_text(data->hislip_item, ", %s", val_to_str(data->controlcode, asynclockresponse_code_request, "Unknown"));
} }
else else
{ /*Releaseresponse*/ { /*Releaseresponse*/
proto_tree_add_item(tree, hf_hislip_controlcode_asynclockresponse_code_release, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_controlcode_asynclockresponse_code_release, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, " [%s]", val_to_str( data->controlcode, asynclockresponse_code_release, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", val_to_str(data->controlcode, asynclockresponse_code_release, "Unknown"));
proto_item_append_text( data->hislip_item, ", %s", val_to_str( data->controlcode, asynclockresponse_code_release, "Unknown")); proto_item_append_text(data->hislip_item, ", %s", val_to_str(data->controlcode, asynclockresponse_code_release, "Unknown"));
} }
break; break;
case HISLIP_ASYNCLOCKINFORESPONSE: case HISLIP_ASYNCLOCKINFORESPONSE:
proto_tree_add_item(tree, hf_hislip_controlcode_asynclockinforesponse_code, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_controlcode_asynclockinforesponse_code, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, " [%s]", val_to_str( data->controlcode, asynclockinforesponse_code, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", val_to_str(data->controlcode, asynclockinforesponse_code, "Unknown"));
proto_item_append_text( data->hislip_item, ", %s", val_to_str( data->controlcode, asynclockinforesponse_code, "Unknown")); proto_item_append_text(data->hislip_item, ", %s", val_to_str(data->controlcode, asynclockinforesponse_code, "Unknown"));
break; break;
case HISLIP_ASYNCREMOTELOCALCONTROL: case HISLIP_ASYNCREMOTELOCALCONTROL:
item = proto_tree_add_item(tree, hf_hislip_controlcode_asyncremotelocalcontrol_code, tvb, data->offset,1,ENC_BIG_ENDIAN ); item = proto_tree_add_item(tree, hf_hislip_controlcode_asyncremotelocalcontrol_code, tvb, data->offset, 1, ENC_BIG_ENDIAN );
proto_item_append_text( item, " %s",val_to_str( data->controlcode, remotetype , "Unknown")); proto_item_append_text(item, " %s", val_to_str(data->controlcode, remotetype, "Unknown"));
col_append_fstr( pinfo->cinfo, COL_INFO, " [%s]", val_to_str( data->controlcode, asyncremotelocalcontrol_code, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", val_to_str(data->controlcode, asyncremotelocalcontrol_code, "Unknown"));
proto_item_append_text( data->hislip_item, ", %s", val_to_str( data->controlcode, asyncremotelocalcontrol_code, "Unknown")); proto_item_append_text(data->hislip_item, ", %s", val_to_str(data->controlcode, asyncremotelocalcontrol_code, "Unknown"));
break; break;
@ -572,21 +573,21 @@ decode_controlcode(tvbuff_t *tvb , packet_info *pinfo , proto_tree *tree , hisli
case HISLIP_ASYNCSTATUSRESPONSE: case HISLIP_ASYNCSTATUSRESPONSE:
case HISLIP_ASYNCSERVICEREQUEST: case HISLIP_ASYNCSERVICEREQUEST:
proto_tree_add_item(tree, hf_hislip_controlcode_stb, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_controlcode_stb, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, " STB (0x%x)", data->controlcode); col_append_fstr(pinfo->cinfo, COL_INFO, " STB (0x%x)", data->controlcode);
proto_item_append_text( data->hislip_item, ", STB (0x%x)", data->controlcode); proto_item_append_text(data->hislip_item, ", STB (0x%x)", data->controlcode);
break; break;
case HISLIP_ASYNCDEVICECLEARACKNOWLEDGE: case HISLIP_ASYNCDEVICECLEARACKNOWLEDGE:
case HISLIP_DEVICECLEARCOMPLETE: case HISLIP_DEVICECLEARCOMPLETE:
case HISLIP_DEVICECLEARACKNOWLEDGE: case HISLIP_DEVICECLEARACKNOWLEDGE:
proto_tree_add_item(tree, hf_hislip_controlcode_feature_negotiation, tvb, data->offset,1,ENC_BIG_ENDIAN ); proto_tree_add_item(tree, hf_hislip_controlcode_feature_negotiation, tvb, data->offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, " [%s]", val_to_str( data->controlcode&0x01, feature_negotiation, "Unknown")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", val_to_str(data->controlcode&0x01, feature_negotiation, "Unknown"));
break; break;
default: default:
proto_tree_add_item( tree, hf_hislip_controlcode, tvb, data->offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_hislip_controlcode, tvb, data->offset, 1, ENC_BIG_ENDIAN);
} }
@ -596,16 +597,16 @@ decode_controlcode(tvbuff_t *tvb , packet_info *pinfo , proto_tree *tree , hisli
static void static void
decode_data(tvbuff_t *tvb , packet_info *pinfo , proto_tree *tree , hislipinfo *data) decode_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, hislipinfo *data)
{ {
proto_item * item = NULL; proto_item * item = NULL;
/*check for data in packet*/ /*check for data in packet*/
if( data->payloadlength !=0) if (data->payloadlength != 0)
{ {
guint64 datalength; guint64 datalength;
gdouble max_message_size; gdouble max_message_size;
switch(data->messagetype) switch (data->messagetype)
{ {
case HISLIP_DATA: case HISLIP_DATA:
case HISLIP_DATAEND: case HISLIP_DATAEND:
@ -613,23 +614,23 @@ decode_data(tvbuff_t *tvb , packet_info *pinfo , proto_tree *tree , hislipinfo *
datalength = MAX_DATA_SHOW_SIZE; datalength = MAX_DATA_SHOW_SIZE;
if(data->payloadlength <=datalength) if (data->payloadlength <= datalength)
datalength =data->payloadlength; datalength = data->payloadlength;
col_append_fstr( pinfo->cinfo, COL_INFO," %s",tvb_format_text(tvb, data->offset,(guint32) datalength)); col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_format_text(tvb, data->offset, (guint32)datalength));
proto_tree_add_item( tree, hf_hislip_data, tvb, data->offset, -1, ENC_UTF_8 |ENC_NA); proto_tree_add_item(tree, hf_hislip_data, tvb, data->offset, -1, ENC_UTF_8 |ENC_NA);
break; break;
case HISLIP_ASYNCMAXIMUMMESSAGESIZE: case HISLIP_ASYNCMAXIMUMMESSAGESIZE:
case HISLIP_ASYNCMAXIMUMMESSAGESIZERESPONSE: case HISLIP_ASYNCMAXIMUMMESSAGESIZERESPONSE:
max_message_size = (gdouble) tvb_get_ntoh64(tvb,data->offset); max_message_size = (gdouble)tvb_get_ntoh64(tvb, data->offset);
max_message_size = max_message_size/1048576.0; max_message_size = max_message_size/1048576.0;
item = proto_tree_add_item( tree, hf_hislip_maxmessagesize, tvb , data->offset, 8, ENC_BIG_ENDIAN); item = proto_tree_add_item(tree, hf_hislip_maxmessagesize, tvb, data->offset, 8, ENC_BIG_ENDIAN);
proto_item_append_text(item," bytes (%.2f Mbytes)",max_message_size); proto_item_append_text(item, " bytes (%.2f Mbytes)", max_message_size);
col_append_fstr( pinfo->cinfo, COL_INFO, " Max Message Size: %.2f Mbytes", max_message_size); col_append_fstr(pinfo->cinfo, COL_INFO, " Max Message Size: %.2f Mbytes", max_message_size);
break; break;
@ -640,23 +641,23 @@ decode_data(tvbuff_t *tvb , packet_info *pinfo , proto_tree *tree , hislipinfo *
} }
} }
data->offset += (guint32) data->payloadlength; data->offset += (guint32)data->payloadlength;
} }
/*Search for Retransmission*/ /*Search for Retransmission*/
static guint32 static guint32
search_for_retransmission( wmem_tree_t *pdus, hislipinfo *data, guint32 fnum ) search_for_retransmission(wmem_tree_t *pdus, hislipinfo *data, guint32 fnum )
{ {
hislip_transaction_t *hislip_trans; hislip_transaction_t *hislip_trans;
hislip_trans = (hislip_transaction_t *) wmem_tree_lookup32_le(pdus, fnum-1); hislip_trans = (hislip_transaction_t *)wmem_tree_lookup32_le(pdus, fnum-1);
if(hislip_trans) if (hislip_trans)
{ {
if(hislip_trans->messagetype == data->messagetype && hislip_trans->rep_frame == 0) if (hislip_trans->messagetype == data->messagetype && hislip_trans->rep_frame == 0)
return hislip_trans->req_frame; return hislip_trans->req_frame;
} }
@ -667,13 +668,13 @@ search_for_retransmission( wmem_tree_t *pdus, hislipinfo *data, guint32 fnum )
static guint8 static guint8
is_connection_syn_or_asyn(guint8 messagetype) is_connection_syn_or_asyn(guint8 messagetype)
{ {
if(messagetype >= HISLIP_ASYNCINTERRUPTED) if (messagetype >= HISLIP_ASYNCINTERRUPTED)
{ {
return HISLIP_ASYNCINITIALIZE; return HISLIP_ASYNCINITIALIZE;
} }
else else
{ {
switch(messagetype) switch (messagetype)
{ {
case HISLIP_ASYNCLOCK: case HISLIP_ASYNCLOCK:
case HISLIP_ASYNCLOCK_RESPONSE: case HISLIP_ASYNCLOCK_RESPONSE:
@ -691,7 +692,7 @@ is_connection_syn_or_asyn(guint8 messagetype)
static gint static gint
dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,void *data _U_) dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ {
conversation_t *conversation; conversation_t *conversation;
hislip_conv_info_t *hislip_info; hislip_conv_info_t *hislip_info;
@ -702,67 +703,66 @@ dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,void
guint8 oldcontrolvalue = 0; guint8 oldcontrolvalue = 0;
guint32 frame_number; guint32 frame_number;
hislip_tree = NULL; hislip_tree = NULL;
conversation = NULL; conversation = NULL;
hislip_info = NULL; hislip_info = NULL;
memset(&hislip_data,0,sizeof(hislip_data)); memset(&hislip_data, 0, sizeof(hislip_data));
/*Get Message Type*/
hislip_data.messagetype = tvb_get_guint8( tvb, hislip_data.offset+2);
/*Get Control Type*/
hislip_data.controlcode = tvb_get_guint8( tvb, hislip_data.offset+3);
/*Get Message Parameter*/
hislip_data.messageparameter = tvb_get_ntohl( tvb, hislip_data.offset+4);
/*Get Payload Length*/
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*/ /*Write "HiSLIP" in the protocol column*/
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_HiSLIP); col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_HiSLIP);
/* Clear out stuff in the info column */ /* Clear out stuff in the info column */
col_clear(pinfo->cinfo,COL_INFO); 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"));
/*Get Message Type*/
hislip_data.messagetype = tvb_get_guint8(tvb, hislip_data.offset+2);
/*Get Control Type*/
hislip_data.controlcode = tvb_get_guint8(tvb, hislip_data.offset+3);
/*Get Message Parameter*/
hislip_data.messageparameter = tvb_get_ntohl(tvb, hislip_data.offset+4);
/*Get Payload Length*/
hislip_data.payloadlength = tvb_get_ntoh64(tvb, hislip_data.offset+8);
/* Write Messagetype in the info column */
col_add_fstr(pinfo->cinfo, COL_INFO, "%s", rval_to_str(hislip_data.messagetype, messagetypestring, "Unknown"));
if (tree) if (tree)
{ {
hislip_data.hislip_item = proto_tree_add_item( tree, proto_hislip, tvb, 0, -1, ENC_NA); hislip_data.hislip_item = proto_tree_add_item(tree, proto_hislip, tvb, 0, -1, ENC_NA);
hislip_tree = proto_item_add_subtree( hislip_data.hislip_item, ett_hislip); hislip_tree = proto_item_add_subtree(hislip_data.hislip_item, ett_hislip);
} }
if(tvb_get_ntohs( tvb, 0)!=0x4853) if (tvb_get_ntohs(tvb, 0) != 0x4853)
{ {
expert_add_info(pinfo, hislip_data.hislip_item ,&ei_wrong_prologue); expert_add_info(pinfo, hislip_data.hislip_item, &ei_wrong_prologue);
} }
conversation = find_or_create_conversation(pinfo); conversation = find_or_create_conversation(pinfo);
/*Do we already have a state structure for this conv*/ /*Do we already have a state structure for this conv*/
hislip_info = (hislip_conv_info_t *) conversation_get_proto_data( conversation, proto_hislip); hislip_info = (hislip_conv_info_t *)conversation_get_proto_data(conversation, proto_hislip);
if (!hislip_info) if (!hislip_info)
{ {
hislip_info = (hislip_conv_info_t *) wmem_alloc(wmem_file_scope(),(sizeof(hislip_conv_info_t))); hislip_info = (hislip_conv_info_t *)wmem_alloc(wmem_file_scope(), (sizeof(hislip_conv_info_t)));
hislip_info->connectiontype = is_connection_syn_or_asyn(hislip_data.messagetype); hislip_info->connectiontype = is_connection_syn_or_asyn(hislip_data.messagetype);
hislip_info->pdus = wmem_tree_new(wmem_file_scope()); hislip_info->pdus = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data( conversation, proto_hislip, (void *) hislip_info); conversation_add_proto_data(conversation, proto_hislip, (void *)hislip_info);
} }
/*synchronous or asynchronous channel*/ /*synchronous or asynchronous channel*/
if(hislip_info->connectiontype == HISLIP_INITIALIZE) if(hislip_info->connectiontype == HISLIP_INITIALIZE)
{ {
proto_item_append_text(hislip_data.hislip_item," (Synchron)"); proto_item_append_text(hislip_data.hislip_item, " (Synchron)");
it = proto_tree_add_item( hislip_tree, hf_hislip_syn, tvb, 0, 0, ENC_NA); it = proto_tree_add_item(hislip_tree, hf_hislip_syn, tvb, 0, 0, ENC_NA);
} }
else else
{ {
proto_item_append_text(hislip_data.hislip_item," (Asynchron)"); proto_item_append_text(hislip_data.hislip_item," (Asynchron)");
it = proto_tree_add_item( hislip_tree, hf_hislip_asyn, tvb, 0, 0, ENC_NA); it = proto_tree_add_item(hislip_tree, hf_hislip_asyn, tvb, 0, 0, ENC_NA);
} }
PROTO_ITEM_SET_GENERATED(it); PROTO_ITEM_SET_GENERATED(it);
@ -776,24 +776,24 @@ dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,void
case HISLIP_ASYNCLOCKINFO: case HISLIP_ASYNCLOCKINFO:
/*Request*/ /*Request*/
hislip_trans = (hislip_transaction_t *)wmem_tree_lookup32( hislip_info->pdus, pinfo->fd->num); hislip_trans = (hislip_transaction_t *)wmem_tree_lookup32(hislip_info->pdus, pinfo->fd->num);
if(!hislip_trans) if(!hislip_trans)
{ {
DISSECTOR_ASSERT_HINT(!pinfo->fd->flags.visited, "Missing 'Request' Info"); DISSECTOR_ASSERT_HINT(!pinfo->fd->flags.visited, "Missing 'Request' Info");
/* This is a new request */ /* This is a new request */
hislip_trans = (hislip_transaction_t *)wmem_alloc(wmem_file_scope(),sizeof( hislip_transaction_t)); hislip_trans = (hislip_transaction_t *)wmem_alloc(wmem_file_scope(), sizeof(hislip_transaction_t));
hislip_trans->req_frame = pinfo->fd->num; hislip_trans->req_frame = pinfo->fd->num;
hislip_trans->rep_frame = 0; hislip_trans->rep_frame = 0;
hislip_trans->messagetype=hislip_data.messagetype; hislip_trans->messagetype = hislip_data.messagetype;
hislip_trans->controltype=hislip_data.controlcode; hislip_trans->controltype = hislip_data.controlcode;
wmem_tree_insert32(hislip_info->pdus, pinfo->fd->num , (void *)hislip_trans); wmem_tree_insert32(hislip_info->pdus, pinfo->fd->num , (void *)hislip_trans);
} }
if(hislip_trans->rep_frame != 0) if(hislip_trans->rep_frame != 0)
{ {
it = proto_tree_add_uint( hislip_tree, hf_hislip_response, tvb, 0, 0, hislip_trans->rep_frame); it = proto_tree_add_uint(hislip_tree, hf_hislip_response, tvb, 0, 0, hislip_trans->rep_frame);
PROTO_ITEM_SET_GENERATED(it); PROTO_ITEM_SET_GENERATED(it);
} }
@ -835,18 +835,18 @@ dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,void
/*Preload "HS"*/ /*Preload "HS"*/
hislip_data.offset += 2; hislip_data.offset += 2;
proto_tree_add_item(hislip_tree,hf_hislip_messagetype, tvb, hislip_data.offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(hislip_tree, hf_hislip_messagetype, tvb, hislip_data.offset, 1, ENC_BIG_ENDIAN);
proto_item_append_text( hislip_data.hislip_item, ", %s", rval_to_str( hislip_data.messagetype, messagetypestring, "Unknown")); proto_item_append_text(hislip_data.hislip_item, ", %s", rval_to_str(hislip_data.messagetype, messagetypestring, "Unknown"));
hislip_data.offset += 1; hislip_data.offset += 1;
decode_controlcode( tvb , pinfo , hislip_tree , &hislip_data, oldcontrolvalue ); decode_controlcode(tvb, pinfo, hislip_tree, &hislip_data, oldcontrolvalue );
decode_messagepara( tvb , pinfo , hislip_tree , &hislip_data); decode_messagepara(tvb, pinfo, hislip_tree, &hislip_data);
proto_tree_add_item(hislip_tree,hf_hislip_payloadlength, tvb, hislip_data.offset, 8, ENC_BIG_ENDIAN); proto_tree_add_item(hislip_tree, hf_hislip_payloadlength, tvb, hislip_data.offset, 8, ENC_BIG_ENDIAN);
hislip_data.offset += 8; hislip_data.offset += 8;
decode_data( tvb , pinfo , hislip_tree , &hislip_data ); decode_data(tvb, pinfo, hislip_tree, &hislip_data );
return tvb_captured_length(tvb); return tvb_captured_length(tvb);
@ -858,15 +858,15 @@ get_hislip_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset)
guint64 length; guint64 length;
/* Data length */ /* Data length */
length = tvb_get_ntoh64( tvb, offset+8); length = tvb_get_ntoh64(tvb, offset+8);
/* Header length */ /* Header length */
length +=FRAME_HEADER_LEN; length += FRAME_HEADER_LEN;
return (guint32)length; return (guint32)length;
} }
static gint static gint
dissect_hislip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,void *data _U_) dissect_hislip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ {
/*Reassembling TCP fragments*/ /*Reassembling TCP fragments*/
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FRAME_HEADER_LEN, tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FRAME_HEADER_LEN,
@ -884,10 +884,13 @@ dissect_hislip_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
return FALSE; return FALSE;
/*first two byte == "HS"*/ /*first two byte == "HS"*/
if (tvb_get_ntohs( tvb, 0)!=0x4853) if (tvb_get_ntohs(tvb, 0) != 0x4853)
return FALSE; return FALSE;
dissect_hislip( tvb, pinfo, tree,data); /* 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; return TRUE;
} }
@ -895,7 +898,7 @@ dissect_hislip_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
/*Register HiSLIP with Wireshark*/ /*Register HiSLIP with Wireshark*/
void void
proto_register_hislip (void) proto_register_hislip(void)
{ {
expert_module_t* expert_hislip; expert_module_t* expert_hislip;
@ -903,7 +906,7 @@ proto_register_hislip (void)
static hf_register_info hf[] = { static hf_register_info hf[] = {
{ &hf_hislip_messagetype, { &hf_hislip_messagetype,
{ "Message Type", "hislip.messagetype", FT_UINT8 , BASE_HEX|BASE_RANGE_STRING, RVALS(messagetypestring), 0x0, { "Message Type", "hislip.messagetype", FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(messagetypestring), 0x0,
"HiSLIP Message Type", HFILL }}, "HiSLIP Message Type", HFILL }},
{ &hf_hislip_controlcode, { &hf_hislip_controlcode,
{ "Control Code", "hislip.controltype", FT_UINT8, BASE_DEC, NULL, 0x0, { "Control Code", "hislip.controltype", FT_UINT8, BASE_DEC, NULL, 0x0,
@ -936,40 +939,40 @@ proto_register_hislip (void)
{ "STB", "hislip.controltype.stb", FT_UINT8, BASE_HEX, NULL, 0x0, { "STB", "hislip.controltype.stb", FT_UINT8, BASE_HEX, NULL, 0x0,
"HiSLIP Status Byte", HFILL }}, "HiSLIP Status Byte", HFILL }},
{ &hf_hislip_payloadlength, { &hf_hislip_payloadlength,
{ "Payload Length", "hislip.payloadlength", FT_UINT64 , BASE_DEC, NULL, 0x0, { "Payload Length", "hislip.payloadlength", FT_UINT64, BASE_DEC, NULL, 0x0,
"HiSLIP Payload Length", HFILL }}, "HiSLIP Payload Length", HFILL }},
{ &hf_hislip_messageparameter, { &hf_hislip_messageparameter,
{ "Message Parameter", "hislip.msgpara", FT_NONE , BASE_NONE, NULL, 0x0, { "Message Parameter", "hislip.msgpara", FT_NONE, BASE_NONE, NULL, 0x0,
"HiSLIP Message Parameter", HFILL }}, "HiSLIP Message Parameter", HFILL }},
{ &hf_hislip_msgpara_messageid, { &hf_hislip_msgpara_messageid,
{ "MessageID", "hislip.msgpara.messageid", FT_UINT32 , BASE_HEX, NULL, 0x0, { "MessageID", "hislip.msgpara.messageid", FT_UINT32, BASE_HEX, NULL, 0x0,
"HiSLIP MessageID", HFILL }}, "HiSLIP MessageID", HFILL }},
{ &hf_hislip_msgpara_sessionid, { &hf_hislip_msgpara_sessionid,
{ "SessionID", "hislip.msgpara.sessionid", FT_UINT16 , BASE_HEX, NULL, 0x0, { "SessionID", "hislip.msgpara.sessionid", FT_UINT16, BASE_HEX, NULL, 0x0,
"HiSLIP SessionID", HFILL }}, "HiSLIP SessionID", HFILL }},
{ &hf_hislip_msgpara_serverproto, { &hf_hislip_msgpara_serverproto,
{ "Server version", "hislip.msgpara.servproto", FT_UINT16 , BASE_HEX, NULL, 0x0, { "Server version", "hislip.msgpara.servproto", FT_UINT16, BASE_HEX, NULL, 0x0,
"HiSLIP Server Protocol version", HFILL }}, "HiSLIP Server Protocol version", HFILL }},
{ &hf_hislip_msgpara_vendorID, { &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 }}, "HiSLIP VendorID", HFILL }},
{ &hf_hislip_msgpara_clientproto, { &hf_hislip_msgpara_clientproto,
{ "Client version", "hislip.msgpara.clientproto", FT_UINT16 , BASE_HEX, NULL, 0x0, { "Client version", "hislip.msgpara.clientproto", FT_UINT16, BASE_HEX, NULL, 0x0,
"HiSLIP Client protocol version", HFILL }}, "HiSLIP Client protocol version", HFILL }},
{ &hf_hislip_msgpara_clients, { &hf_hislip_msgpara_clients,
{ "HiSLIP clients holding locks", "hislip.msgpara.clients", FT_UINT32 , BASE_DEC, NULL, 0x0, { "HiSLIP clients holding locks", "hislip.msgpara.clients", FT_UINT32, BASE_DEC, NULL, 0x0,
"HiSLIP clients holding locks on the server", HFILL }}, "HiSLIP clients holding locks on the server", HFILL }},
{ &hf_hislip_msgpara_timeout, { &hf_hislip_msgpara_timeout,
{ "Timeout[ms]", "hislip.msgpara.timeout", FT_UINT32 , BASE_DEC, NULL, 0x0, { "Timeout[ms]", "hislip.msgpara.timeout", FT_UINT32, BASE_DEC, NULL, 0x0,
"Time out from a AsyncLock message", HFILL }}, "Time out from a AsyncLock message", HFILL }},
{ &hf_hislip_data, { &hf_hislip_data,
{ "Data", "hislip.data", FT_STRING , BASE_NONE, NULL, 0x0, { "Data", "hislip.data", FT_STRING, BASE_NONE, NULL, 0x0,
"HiSLIP Payload", HFILL }}, "HiSLIP Payload", HFILL }},
{ &hf_hislip_request, { &hf_hislip_request,
{ "Request", "hislip.response",FT_FRAMENUM, BASE_NONE, NULL, 0x0, { "Request", "hislip.response", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
"This is a response to the HiSLIP request in this frame", HFILL }}, "This is a response to the HiSLIP request in this frame", HFILL }},
{ &hf_hislip_response, { &hf_hislip_response,
{ "Response", "hislip.request",FT_FRAMENUM, BASE_NONE, NULL, 0x0, { "Response", "hislip.request", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
"A Request in this frame", HFILL }}, "A Request in this frame", HFILL }},
{ &hf_hislip_syn, { &hf_hislip_syn,
{ "Synchronous Channel", "hislip.syn", FT_NONE, BASE_NONE, NULL, 0x0, { "Synchronous Channel", "hislip.syn", FT_NONE, BASE_NONE, NULL, 0x0,
@ -999,17 +1002,17 @@ proto_register_hislip (void)
static ei_register_info ei[] = { static ei_register_info ei[] = {
{ &ei_wrong_prologue, { "hislip.wrongprologue", PI_UNDECODED, PI_WARN , "Frame hasn't 'HS' as Prologue", EXPFILL }}, { &ei_wrong_prologue, { "hislip.wrongprologue", PI_UNDECODED, PI_WARN, "Frame hasn't 'HS' as Prologue", EXPFILL }},
{ &ei_msg_not_null, { "hislip.msgnotnull", PI_PROTOCOL, PI_WARN , "Message Parameter isn't 0", EXPFILL }} { &ei_msg_not_null, { "hislip.msgnotnull", PI_PROTOCOL, PI_WARN, "Message Parameter isn't 0", EXPFILL }}
}; };
proto_hislip = proto_register_protocol( "High-Speed LAN Instrument Protocol", "HiSLIP", "hislip"); proto_hislip = proto_register_protocol("High-Speed LAN Instrument Protocol", "HiSLIP", "hislip");
expert_hislip = expert_register_protocol(proto_hislip); expert_hislip = expert_register_protocol(proto_hislip);
expert_register_field_array(expert_hislip, ei, array_length(ei)); expert_register_field_array(expert_hislip, ei, array_length(ei));
proto_register_field_array ( proto_hislip, hf, array_length(hf)); proto_register_field_array(proto_hislip, hf, array_length(hf));
proto_register_subtree_array( ett, array_length(ett)); proto_register_subtree_array(ett, array_length(ett));
hislip_module = prefs_register_protocol(proto_hislip, proto_reg_handoff_hislip); hislip_module = prefs_register_protocol(proto_hislip, proto_reg_handoff_hislip);
@ -1030,7 +1033,7 @@ proto_reg_handoff_hislip(void)
if (!initialized) if (!initialized)
{ {
hislip_handle = new_create_dissector_handle( dissect_hislip, proto_hislip); hislip_handle = new_create_dissector_handle(dissect_hislip, proto_hislip);
initialized = TRUE; initialized = TRUE;
} }
else else
@ -1042,7 +1045,7 @@ proto_reg_handoff_hislip(void)
dissector_add_uint("tcp.port", currentPort, hislip_handle); dissector_add_uint("tcp.port", currentPort, hislip_handle);
heur_dissector_add( "tcp", dissect_hislip_heur, proto_hislip); heur_dissector_add("tcp", dissect_hislip_heur, proto_hislip);
} }
/* /*