diff options
Diffstat (limited to 'plugins/epan/ethercat/packet-ams.c')
-rw-r--r-- | plugins/epan/ethercat/packet-ams.c | 392 |
1 files changed, 196 insertions, 196 deletions
diff --git a/plugins/epan/ethercat/packet-ams.c b/plugins/epan/ethercat/packet-ams.c index b6246eb5..21ae65c7 100644 --- a/plugins/epan/ethercat/packet-ams.c +++ b/plugins/epan/ethercat/packet-ams.c @@ -24,98 +24,98 @@ void proto_reg_handoff_ams(void); #define AMS_TCP_PORT 48898 /* Not IANA registered */ /* Define the ams proto */ -int proto_ams = -1; +int proto_ams; static dissector_handle_t amstcp_handle; /* Define the tree for ams */ -static int ett_ams = -1; -static int ett_ams_stateflags = -1; -static int ett_ams_adsreadrequest = -1; -static int ett_ams_adsreadresponse = -1; -static int ett_ams_adswriterequest = -1; -static int ett_ams_adswriteresponse = -1; -static int ett_ams_adsreadwriterequest = -1; -static int ett_ams_adsreadwriteresponse = -1; -static int ett_ams_adsreadstaterequest = -1; -static int ett_ams_adsreadstateresponse = -1; -static int ett_ams_adswritectrlrequest = -1; -static int ett_ams_adswritectrlresponse = -1; -static int ett_ams_adsreaddinforequest = -1; -static int ett_ams_adsreaddinforesponse = -1; -static int ett_ams_adsadddnrequest = -1; -static int ett_ams_adsadddnresponse = -1; -static int ett_ams_adsdeldnrequest = -1; -static int ett_ams_adsdeldnresponse = -1; -static int ett_ams_adsdnrequest = -1; - -static int hf_ams_sendernetid = -1; -static int hf_ams_senderport = -1; -static int hf_ams_targetnetid = -1; -static int hf_ams_targetport = -1; -static int hf_ams_cmdid = -1; -static int hf_ams_stateflags = -1; -static int hf_ams_stateresponse = -1; -static int hf_ams_statenoreturn = -1; -static int hf_ams_stateadscmd = -1; -static int hf_ams_statesyscmd = -1; -static int hf_ams_statehighprio = -1; -static int hf_ams_statetimestampadded = -1; -static int hf_ams_stateudp = -1; -static int hf_ams_stateinitcmd = -1; -static int hf_ams_statebroadcast = -1; -static int hf_ams_cbdata = -1; -static int hf_ams_errorcode = -1; -static int hf_ams_invokeid = -1; -static int hf_ams_data = -1; +static int ett_ams; +static int ett_ams_stateflags; +static int ett_ams_adsreadrequest; +static int ett_ams_adsreadresponse; +static int ett_ams_adswriterequest; +static int ett_ams_adswriteresponse; +static int ett_ams_adsreadwriterequest; +static int ett_ams_adsreadwriteresponse; +static int ett_ams_adsreadstaterequest; +static int ett_ams_adsreadstateresponse; +static int ett_ams_adswritectrlrequest; +static int ett_ams_adswritectrlresponse; +static int ett_ams_adsreaddinforequest; +static int ett_ams_adsreaddinforesponse; +static int ett_ams_adsadddnrequest; +static int ett_ams_adsadddnresponse; +static int ett_ams_adsdeldnrequest; +static int ett_ams_adsdeldnresponse; +static int ett_ams_adsdnrequest; + +static int hf_ams_sendernetid; +static int hf_ams_senderport; +static int hf_ams_targetnetid; +static int hf_ams_targetport; +static int hf_ams_cmdid; +static int hf_ams_stateflags; +static int hf_ams_stateresponse; +static int hf_ams_statenoreturn; +static int hf_ams_stateadscmd; +static int hf_ams_statesyscmd; +static int hf_ams_statehighprio; +static int hf_ams_statetimestampadded; +static int hf_ams_stateudp; +static int hf_ams_stateinitcmd; +static int hf_ams_statebroadcast; +static int hf_ams_cbdata; +static int hf_ams_errorcode; +static int hf_ams_invokeid; +static int hf_ams_data; /*ads Commands */ -static int hf_ams_adsindexgroup = -1; -static int hf_ams_adsindexoffset = -1; -static int hf_ams_adscblength = -1; -static int hf_ams_adsreadrequest = -1; -static int hf_ams_adsreadresponse = -1; -static int hf_ams_adsinvokeid = -1; -static int hf_ams_adsresult = -1; -static int hf_ams_adsdata = -1; -static int hf_ams_adswriterequest = -1; -static int hf_ams_adswriteresponse = -1; -static int hf_ams_adsreadwriterequest = -1; -static int hf_ams_adsreadwriteresponse = -1; -static int hf_ams_adscbreadlength = -1; -static int hf_ams_adscbwritelength = -1; -static int hf_ams_adsstate = -1; -static int hf_ams_adsdevicestate = -1; -static int hf_ams_adsnotificationhandle = -1; -static int hf_ams_adsreadstaterequest = -1; -static int hf_ams_adsreadstateresponse = -1; -static int hf_ams_adswritectrlrequest = -1; -static int hf_ams_adswritectrlresponse = -1; -static int hf_ams_adsreaddinforequest = -1; -static int hf_ams_adsreaddinforesponse = -1; -static int hf_ams_adsadddnrequest = -1; -static int hf_ams_adsadddnresponse = -1; -static int hf_ams_adsdeldnrequest = -1; -static int hf_ams_adsdeldnresponse = -1; -static int hf_ams_adsdnrequest = -1; -/* static int hf_ams_adsdnresponse = -1; */ -/* static int hf_ams_adsnoteattrib = -1; */ -/* static int hf_ams_adsnoteblocks = -1; */ -/* static int hf_ams_adsversion = -1; */ -static int hf_ams_adsdevicename = -1; -static int hf_ams_adsversionversion = -1; -static int hf_ams_adsversionrevision = -1; -static int hf_ams_adsversionbuild = -1; -static int hf_ams_adsnoteblocksstamps = -1; -/* static int hf_ams_adsnoteblocksstamp = -1; */ -/* static int hf_ams_adstimestamp = -1; */ -/* static int hf_ams_adssamplecnt = -1; */ -/* static int hf_ams_adsnoteblockssample = -1; */ -static int hf_ams_adstransmode = -1; -static int hf_ams_adsmaxdelay = -1; -static int hf_ams_adscycletime = -1; -/* static int hf_ams_adscmpmax = -1; */ -/* static int hf_ams_adscmpmin = -1; */ +static int hf_ams_adsindexgroup; +static int hf_ams_adsindexoffset; +static int hf_ams_adscblength; +static int hf_ams_adsreadrequest; +static int hf_ams_adsreadresponse; +static int hf_ams_adsinvokeid; +static int hf_ams_adsresult; +static int hf_ams_adsdata; +static int hf_ams_adswriterequest; +static int hf_ams_adswriteresponse; +static int hf_ams_adsreadwriterequest; +static int hf_ams_adsreadwriteresponse; +static int hf_ams_adscbreadlength; +static int hf_ams_adscbwritelength; +static int hf_ams_adsstate; +static int hf_ams_adsdevicestate; +static int hf_ams_adsnotificationhandle; +static int hf_ams_adsreadstaterequest; +static int hf_ams_adsreadstateresponse; +static int hf_ams_adswritectrlrequest; +static int hf_ams_adswritectrlresponse; +static int hf_ams_adsreaddinforequest; +static int hf_ams_adsreaddinforesponse; +static int hf_ams_adsadddnrequest; +static int hf_ams_adsadddnresponse; +static int hf_ams_adsdeldnrequest; +static int hf_ams_adsdeldnresponse; +static int hf_ams_adsdnrequest; +/* static int hf_ams_adsdnresponse; */ +/* static int hf_ams_adsnoteattrib; */ +/* static int hf_ams_adsnoteblocks; */ +/* static int hf_ams_adsversion; */ +static int hf_ams_adsdevicename; +static int hf_ams_adsversionversion; +static int hf_ams_adsversionrevision; +static int hf_ams_adsversionbuild; +static int hf_ams_adsnoteblocksstamps; +/* static int hf_ams_adsnoteblocksstamp; */ +/* static int hf_ams_adstimestamp; */ +/* static int hf_ams_adssamplecnt; */ +/* static int hf_ams_adsnoteblockssample; */ +static int hf_ams_adstransmode; +static int hf_ams_adsmaxdelay; +static int hf_ams_adscycletime; +/* static int hf_ams_adscmpmax; */ +/* static int hf_ams_adscmpmin; */ static dissector_handle_t ams_handle; @@ -372,28 +372,28 @@ static const value_string AMS_CommandId_vals[] = }; -static void NetIdFormater(tvbuff_t *tvb, guint offset, char *szText, gint nMax) +static void NetIdFormater(tvbuff_t *tvb, unsigned offset, char *szText, int nMax) { - snprintf ( szText, nMax, "%d.%d.%d.%d.%d.%d", tvb_get_guint8(tvb, offset), - tvb_get_guint8(tvb, offset+1), - tvb_get_guint8(tvb, offset+2), - tvb_get_guint8(tvb, offset+3), - tvb_get_guint8(tvb, offset+4), - tvb_get_guint8(tvb, offset+5) + snprintf ( szText, nMax, "%d.%d.%d.%d.%d.%d", tvb_get_uint8(tvb, offset), + tvb_get_uint8(tvb, offset+1), + tvb_get_uint8(tvb, offset+2), + tvb_get_uint8(tvb, offset+3), + tvb_get_uint8(tvb, offset+4), + tvb_get_uint8(tvb, offset+5) ); } /*ams*/ -static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset) +static int dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) { proto_item *ti, *anItem; proto_tree *ams_tree = NULL, *ams_adstree, *ams_statetree; - guint ams_length = tvb_reported_length(tvb); - guint16 stateflags = 0; - guint16 cmdId = 0; - guint32 cbdata = 0; + unsigned ams_length = tvb_reported_length(tvb); + uint16_t stateflags = 0; + uint16_t cmdId = 0; + uint32_t cbdata = 0; char szText[200]; int nMax = sizeof(szText)-1; @@ -414,43 +414,43 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_string(ams_tree, hf_ams_targetnetid, tvb, offset, AmsNetId_Len, szText); offset += AmsNetId_Len; - proto_tree_add_item(ams_tree, hf_ams_targetport, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - offset += (int)sizeof(guint16); + proto_tree_add_item(ams_tree, hf_ams_targetport, tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + offset += (int)sizeof(uint16_t); NetIdFormater(tvb, offset, szText, nMax); proto_tree_add_string(ams_tree, hf_ams_sendernetid, tvb, offset, AmsNetId_Len, szText); offset += AmsNetId_Len; - proto_tree_add_item(ams_tree, hf_ams_senderport, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - offset += (int)sizeof(guint16); + proto_tree_add_item(ams_tree, hf_ams_senderport, tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + offset += (int)sizeof(uint16_t); - proto_tree_add_item(ams_tree, hf_ams_cmdid, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_tree, hf_ams_cmdid, tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); cmdId = tvb_get_letohs(tvb, offset); - offset+=(int)sizeof(guint16); + offset+=(int)sizeof(uint16_t); - anItem = proto_tree_add_item(ams_tree, hf_ams_stateflags, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + anItem = proto_tree_add_item(ams_tree, hf_ams_stateflags, tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); ams_statetree = proto_item_add_subtree(anItem, ett_ams_stateflags); - proto_tree_add_item(ams_statetree, hf_ams_stateresponse,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statenoreturn,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateadscmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statesyscmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statehighprio,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statetimestampadded,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateudp,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateinitcmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statebroadcast,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateresponse,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statenoreturn,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateadscmd,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statesyscmd,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statehighprio,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statetimestampadded,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateudp,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateinitcmd,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statebroadcast,tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); stateflags = tvb_get_letohs(tvb, offset); - offset+=(int)sizeof(guint16); + offset+=(int)sizeof(uint16_t); - proto_tree_add_item(ams_tree, hf_ams_cbdata, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_tree, hf_ams_cbdata, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); cbdata = tvb_get_letohl(tvb,offset); - offset+=(int)sizeof(guint32); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_tree, hf_ams_errorcode, tvb, offset, (int)sizeof(guint32),ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_tree, hf_ams_errorcode, tvb, offset, (int)sizeof(uint32_t),ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_tree, hf_ams_invokeid, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_tree, hf_ams_invokeid, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); } else { @@ -475,14 +475,14 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsReadReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); } } } @@ -494,17 +494,17 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adswriterequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsWriteReq_Len - (int)sizeof(guint16) ) + if( ams_length-offset >= TAdsWriteReq_Len - (int)sizeof(uint16_t) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswriterequest); proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + offset+=(int)sizeof(uint32_t); proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + offset+=(int)sizeof(uint32_t); proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + offset+=(int)sizeof(uint32_t); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -518,20 +518,20 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadwriterequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadWriteReq_Len - (int)sizeof(guint16)) + if( ams_length-offset >= TAdsReadWriteReq_Len - (int)sizeof(uint16_t)) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadwriterequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adscbreadlength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscbreadlength, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adscbwritelength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscbwritelength, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -548,7 +548,7 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsReadStateReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadstaterequest); - proto_tree_add_item(ams_adstree, hf_ams_adsinvokeid, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsinvokeid, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); } } } @@ -560,17 +560,17 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adswritectrlrequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsWriteControlReq_Len - (int)sizeof(guint16) ) + if( ams_length-offset >= TAdsWriteControlReq_Len - (int)sizeof(uint16_t) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswritectrlrequest); proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, 2, ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint16); + offset+=(int)sizeof(uint16_t); proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, 2, ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint16); + offset+=(int)sizeof(uint16_t); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -587,7 +587,7 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsReadDeviceInfoReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreaddinforequest); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); } } } @@ -602,23 +602,23 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsAddDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsadddnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adstransmode, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adstransmode, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adsmaxdelay, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsmaxdelay, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adscycletime, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscycletime, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); } } } @@ -633,7 +633,7 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsDelDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdeldnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); } } } @@ -644,20 +644,20 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( tree ) { - /*guint32 cbLength; - guint32 nStamps;*/ + /*uint32_t cbLength; + uint32_t nStamps;*/ anItem = proto_tree_add_item(ams_tree, hf_ams_adsdnrequest, tvb, offset, ams_length-offset, ENC_NA); if( ams_length-offset >= TAdsDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); /*cbLength = tvb_get_letohs(tvb, offset);*/ - offset+=(int)sizeof(guint32); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adsnoteblocksstamps, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnoteblocksstamps, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); /*nStamps = tvb_get_letohs(tvb, offset);*/ - offset+=(int)sizeof(guint32); + offset+=(int)sizeof(uint32_t); /*ToDo: dissect noteblocks*/ } @@ -678,14 +678,14 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadresponse, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadRes_Len - (int)sizeof(guint16) ) + if( ams_length-offset >= TAdsReadRes_Len - (int)sizeof(uint16_t) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -702,7 +702,7 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsWriteRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswriteresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); } } } @@ -714,14 +714,14 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadwriteresponse, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadWriteRes_Len - (int)sizeof(guint16) ) + if( ams_length-offset >= TAdsReadWriteRes_Len - (int)sizeof(uint16_t) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadwriteresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -738,13 +738,13 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsReadStateRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadstateresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint16); + proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint16_t); - proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); } } } @@ -759,7 +759,7 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsWriteControlRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswritectrlresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); } } } @@ -774,13 +774,13 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsReadDeviceInfoRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreaddinforesponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adsversionversion, tvb, offset++, (int)sizeof(guint8), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_adstree, hf_ams_adsversionrevision, tvb, offset++, (int)sizeof(guint8), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_adstree, hf_ams_adsversionbuild, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint16); + proto_tree_add_item(ams_adstree, hf_ams_adsversionversion, tvb, offset++, (int)sizeof(uint8_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsversionrevision, tvb, offset++, (int)sizeof(uint8_t), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsversionbuild, tvb, offset, (int)sizeof(uint16_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint16_t); proto_tree_add_item(ams_adstree, hf_ams_adsdevicename, tvb, offset, ams_length-offset, ENC_ASCII|ENC_NA); } @@ -797,10 +797,10 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsAddDeviceNotificationRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsadddnresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=(int)sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(uint32_t); - proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); } } } @@ -815,7 +815,7 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( ams_length-offset >= TAdsDelDeviceNotificationRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdeldnresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(uint32_t), ENC_LITTLE_ENDIAN); } } } @@ -836,12 +836,12 @@ static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /*ams*/ -static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +static int dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { return dissect_ams_pdu(tvb, pinfo, tree, 0); } -static gint dissect_amstcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +static int dissect_amstcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { if( TcpAdsParserHDR_Len > tvb_reported_length(tvb)) return 0; @@ -1192,7 +1192,7 @@ void proto_register_ams(void) #endif }; - static gint *ett[] = + static int *ett[] = { &ett_ams, &ett_ams_stateflags, |