2007-10-14 15:44:05 +00:00
/* packet-ecatmb.c
2008-03-05 20:42:58 +00:00
* Routines for EtherCAT packet disassembly
2007-10-14 15:44:05 +00:00
*
* Copyright ( c ) 2007 by Beckhoff Automation GmbH
*
* Wireshark - Network traffic analyzer
* By Gerald Combs < gerald @ wireshark . org >
* Copyright 1998 Gerald Combs
2007-10-16 14:54:51 +00:00
*
2018-02-09 08:52:20 +00:00
* SPDX - License - Identifier : GPL - 2.0 - or - later
2007-10-14 15:44:05 +00:00
*/
/* Include files */
# include "config.h"
# include <string.h>
# include <epan/packet.h>
2016-01-29 08:13:13 +00:00
# include <epan/expert.h>
2007-10-14 15:44:05 +00:00
# include "packet-ecatmb.h"
# define BIT2BYTE(x) ((x+7) / 8)
# define ENDOF(p) ((p)+1) /* pointer to end of *p */
2013-12-20 06:30:13 +00:00
void proto_register_ecat_mailbox ( void ) ;
void proto_reg_handoff_ecat_mailbox ( void ) ;
2007-10-14 15:44:05 +00:00
static dissector_handle_t eth_handle ;
static dissector_handle_t ams_handle ;
2016-12-17 01:06:11 +00:00
static dissector_handle_t ecat_mailbox_handle ;
2007-10-14 15:44:05 +00:00
/* Define the EtherCAT mailbox proto */
int proto_ecat_mailbox = - 1 ;
static int ett_ecat_mailbox = - 1 ;
static int ett_ecat_mailbox_eoe = - 1 ;
static int ett_ecat_mailbox_eoe_init = - 1 ;
static int ett_ecat_mailbox_eoe_macfilter = - 1 ;
static int ett_ecat_mailbox_eoe_macfilter_filter = - 1 ;
static int ett_ecat_mailbox_eoe_macfilter_filtermask = - 1 ;
static int ett_ecat_mailbox_coe = - 1 ;
static int ett_ecat_mailbox_sdo = - 1 ;
static int ett_ecat_mailbox_coe_sdoccs = - 1 ;
static int ett_ecat_mailbox_coe_sdoscs = - 1 ;
2007-10-16 14:54:51 +00:00
static int ett_ecat_mailbox_foe = - 1 ;
2007-10-14 15:44:05 +00:00
static int ett_ecat_mailbox_foe_efw = - 1 ;
static int ett_ecat_mailbox_soeflag = - 1 ;
static int ett_ecat_mailbox_soe = - 1 ;
static int ett_ecat_mailbox_fraghead = - 1 ;
2008-03-05 20:42:58 +00:00
static int ett_ecat_mailbox_header = - 1 ;
2007-10-14 15:44:05 +00:00
static int hf_ecat_mailboxlength = - 1 ;
static int hf_ecat_mailboxaddress = - 1 ;
2014-11-14 20:12:06 +00:00
static int hf_ecat_mailboxpriority = - 1 ;
static int hf_ecat_mailboxtype = - 1 ;
static int hf_ecat_mailboxcounter = - 1 ;
2007-10-14 15:44:05 +00:00
static int hf_ecat_mailbox_eoe = - 1 ;
static int hf_ecat_mailbox_eoe_fraghead = - 1 ;
static int hf_ecat_mailbox_eoe_type = - 1 ;
static int hf_ecat_mailbox_eoe_fragno = - 1 ;
static int hf_ecat_mailbox_eoe_offset = - 1 ;
static int hf_ecat_mailbox_eoe_frame = - 1 ;
static int hf_ecat_mailbox_eoe_last = - 1 ;
static int hf_ecat_mailbox_eoe_timestampreq = - 1 ;
static int hf_ecat_mailbox_eoe_timestampapp = - 1 ;
static int hf_ecat_mailbox_eoe_fragment = - 1 ;
static int hf_ecat_mailbox_eoe_init = - 1 ;
static int hf_ecat_mailbox_eoe_init_contains_macaddr = - 1 ;
static int hf_ecat_mailbox_eoe_init_contains_ipaddr = - 1 ;
static int hf_ecat_mailbox_eoe_init_contains_subnetmask = - 1 ;
static int hf_ecat_mailbox_eoe_init_contains_defaultgateway = - 1 ;
static int hf_ecat_mailbox_eoe_init_contains_dnsserver = - 1 ;
static int hf_ecat_mailbox_eoe_init_contains_dnsname = - 1 ;
static int hf_ecat_mailbox_eoe_init_append_timestamp = - 1 ;
static int hf_ecat_mailbox_eoe_init_macaddr = - 1 ;
static int hf_ecat_mailbox_eoe_init_ipaddr = - 1 ;
static int hf_ecat_mailbox_eoe_init_subnetmask = - 1 ;
static int hf_ecat_mailbox_eoe_init_defaultgateway = - 1 ;
static int hf_ecat_mailbox_eoe_init_dnsserver = - 1 ;
static int hf_ecat_mailbox_eoe_init_dnsname = - 1 ;
2007-10-16 14:54:51 +00:00
static int hf_ecat_mailbox_eoe_macfilter = - 1 ;
static int hf_ecat_mailbox_eoe_macfilter_macfiltercount = - 1 ;
static int hf_ecat_mailbox_eoe_macfilter_maskcount = - 1 ;
static int hf_ecat_mailbox_eoe_macfilter_nobroadcasts = - 1 ;
2007-10-14 15:44:05 +00:00
static int hf_ecat_mailbox_eoe_macfilter_filter ;
static int hf_ecat_mailbox_eoe_macfilter_filters [ 16 ] = { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } ;
2007-10-16 14:54:51 +00:00
static int hf_ecat_mailbox_eoe_macfilter_filtermask = - 1 ;
static int hf_ecat_mailbox_eoe_macfilter_filtermasks [ 4 ] = { - 1 , - 1 , - 1 , - 1 } ;
2007-10-14 15:44:05 +00:00
static int hf_ecat_mailbox_eoe_timestamp = - 1 ;
static int hf_ecat_mailbox_coe = - 1 ;
static int hf_ecat_mailbox_coe_number = - 1 ;
static int hf_ecat_mailbox_coe_type = - 1 ;
static int hf_ecat_mailbox_coe_sdoreq = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsid = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsid_sizeind = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsid_expedited = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsid_size0 = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsid_size1 = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsid_complete = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsds = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsds_lastseg = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsds_size = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsds_toggle = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsus = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsus_toggle = - 1 ;
static int hf_ecat_mailbox_coe_sdoccsiu = - 1 ;
2013-02-10 20:52:21 +00:00
/* static int hf_ecat_mailbox_coe_sdoccsiu_complete = -1; */
2007-10-14 15:44:05 +00:00
static int hf_ecat_mailbox_coe_sdoidx = - 1 ;
2019-05-28 06:13:55 +00:00
static int hf_ecat_mailbox_coe_sdoabortcode = - 1 ;
2007-10-14 15:44:05 +00:00
static int hf_ecat_mailbox_coe_sdosub = - 1 ;
static int hf_ecat_mailbox_coe_sdodata = - 1 ;
static int hf_ecat_mailbox_coe_sdodata1 = - 1 ;
static int hf_ecat_mailbox_coe_sdodata2 = - 1 ;
static int hf_ecat_mailbox_coe_sdoldata = - 1 ;
static int hf_ecat_mailbox_coe_sdolength = - 1 ;
2013-02-10 20:52:21 +00:00
/* static int hf_ecat_mailbox_coe_sdoerror = -1; */
2007-10-14 15:44:05 +00:00
static int hf_ecat_mailbox_coe_sdores = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsds = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsds_toggle = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsiu = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsiu_sizeind = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsiu_expedited = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsiu_size0 = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsiu_size1 = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsiu_complete = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsus = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsus_lastseg = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsus_bytes = - 1 ;
static int hf_ecat_mailbox_coe_sdoscsus_toggle = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfoopcode = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfofrag = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfolisttype = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfolist = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfoindex = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfosubindex = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfovalueinfo = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfoerrorcode = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfodatatype = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfomaxsub = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfoobjcode = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfoname = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfobitlen = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfoobjaccess = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfounittype = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfodefaultvalue = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfominvalue = - 1 ;
static int hf_ecat_mailbox_coe_sdoinfomaxvalue = - 1 ;
static int hf_ecat_mailboxdata = - 1 ;
static int hf_ecat_mailbox_foe = - 1 ;
static int hf_ecat_mailbox_foe_opmode = - 1 ;
static int hf_ecat_mailbox_foe_filelength = - 1 ;
static int hf_ecat_mailbox_foe_filename = - 1 ;
static int hf_ecat_mailbox_foe_packetno = - 1 ;
static int hf_ecat_mailbox_foe_errcode = - 1 ;
static int hf_ecat_mailbox_foe_errtext = - 1 ;
static int hf_ecat_mailbox_foe_busydone = - 1 ;
static int hf_ecat_mailbox_foe_busyentire = - 1 ;
static int hf_ecat_mailbox_foe_data = - 1 ;
static int hf_ecat_mailbox_foe_efw = - 1 ;
static int hf_ecat_mailbox_foe_efw_cmd = - 1 ;
static int hf_ecat_mailbox_foe_efw_size = - 1 ;
static int hf_ecat_mailbox_foe_efw_addresslw = - 1 ;
static int hf_ecat_mailbox_foe_efw_addresshw = - 1 ;
static int hf_ecat_mailbox_foe_efw_data = - 1 ;
static int hf_ecat_mailbox_soe = - 1 ;
static int hf_ecat_mailbox_soe_header = - 1 ;
static int hf_ecat_mailbox_soe_header_opcode = - 1 ;
static int hf_ecat_mailbox_soe_header_incomplete = - 1 ;
static int hf_ecat_mailbox_soe_header_error = - 1 ;
static int hf_ecat_mailbox_soe_header_driveno = - 1 ;
static int hf_ecat_mailbox_soe_header_datastate = - 1 ;
static int hf_ecat_mailbox_soe_header_name = - 1 ;
static int hf_ecat_mailbox_soe_header_attribute = - 1 ;
static int hf_ecat_mailbox_soe_header_unit = - 1 ;
static int hf_ecat_mailbox_soe_header_min = - 1 ;
static int hf_ecat_mailbox_soe_header_max = - 1 ;
static int hf_ecat_mailbox_soe_header_value = - 1 ;
static int hf_ecat_mailbox_soe_header_reserved = - 1 ;
static int hf_ecat_mailbox_soe_idn = - 1 ;
static int hf_ecat_mailbox_soe_data = - 1 ;
static int hf_ecat_mailbox_soe_frag = - 1 ;
static int hf_ecat_mailbox_soe_error = - 1 ;
2016-01-29 08:13:13 +00:00
static expert_field ei_ecat_mailbox_error = EI_INIT ;
static expert_field ei_ecat_mailbox_coe_error = EI_INIT ;
static expert_field ei_ecat_mailbox_eoe_error = EI_INIT ;
static expert_field ei_ecat_mailbox_soe_error = EI_INIT ;
static expert_field ei_ecat_mailbox_foe_error = EI_INIT ;
2007-10-14 15:44:05 +00:00
static const value_string EcMBoxType [ ] =
{
{ 0 , " Invalid " , } ,
2008-03-05 20:42:58 +00:00
{ 1 , " AoE (Vendor specific; Beckhoff ADS over EtherCAT) " , } ,
{ 2 , " EoE (Ethernet over EtherCAT) " , } ,
{ 3 , " CoE (CANopen over EtherCAT) " , } ,
{ 4 , " FoE (File access over EtherCAT) " , } ,
{ 5 , " SoE (Servo profile over EtherCAT) " , } ,
{ 15 , " VoE (Vendor specific over EtherCAT) " } ,
2007-10-14 15:44:05 +00:00
{ 0x80 + 1 , " AoE - Err " , } ,
{ 0x80 + 2 , " EoE - Err " , } ,
{ 0x80 + 3 , " CoE - Err " , } ,
{ 0x80 + 4 , " FoE - Err " , } ,
{ 0x80 + 5 , " SoE - Err " , } ,
{ 0 , NULL }
} ;
static const value_string FoEOpMode [ ] =
{
{ 1 , " RRQ " , } ,
{ 2 , " WRQ " , } ,
{ 3 , " DATA " , } ,
{ 4 , " ACK " , } ,
{ 5 , " ERROR " , } ,
{ 6 , " BUSY " , } ,
{ 0 , NULL }
} ;
static const value_string FoEEfwCmd [ ] =
{
{ 1 , " Memory Transfer " , } ,
{ 2 , " Write Code " , } ,
{ 3 , " Check device id " , } ,
{ 4 , " Checksum " , } ,
{ 5 , " Write code checksum " , } ,
{ 6 , " Set device id " , } ,
{ 8 , " Set code id " , } ,
{ 9 , " NOP " , } ,
{ 10 , " Checksum checksum " , } ,
{ 11 , " boot checksum " , } ,
{ 0 , NULL }
} ;
static const value_string SoeOpcode [ ] =
{
{ 0 , " unused " } ,
{ 1 , " readReq " } ,
{ 2 , " readRes " } ,
{ 3 , " writeReq " } ,
{ 4 , " writeRes " } ,
{ 5 , " notification " } ,
{ 6 , " emergency " } ,
{ 0 , NULL }
} ;
2014-11-14 20:12:06 +00:00
static const value_string EoEType [ ] =
{
{ EOE_TYPE_FRAME_FRAG , " Fragment " } ,
{ EOE_TYPE_TIMESTAMP_RES , " TimeStamp " } ,
{ EOE_TYPE_INIT_REQ , " Init Req " } ,
{ EOE_TYPE_INIT_RES , " Init Res " } ,
{ EOE_TYPE_MACFILTER_REQ , " MAC Req " } ,
{ EOE_TYPE_MACFILTER_RES , " MAC Res " } ,
{ 0 , NULL }
} ;
static const value_string CANopenType [ ] =
{
{ ETHERCAT_COE_TYPE_EMERGENCY , " EMERGENCY " } ,
{ ETHERCAT_COE_TYPE_SDOREQ , " SDO Req " } ,
{ ETHERCAT_COE_TYPE_SDORES , " SDO Res " } ,
{ ETHERCAT_COE_TYPE_TXPDO , " TxPDO " } ,
{ ETHERCAT_COE_TYPE_RXPDO , " RxPDO " } ,
{ ETHERCAT_COE_TYPE_TXPDO_RTR , " TxPDO_RTR " } ,
{ ETHERCAT_COE_TYPE_RXPDO_RTR , " RxPDO_RTR " } ,
2022-07-23 14:16:27 +00:00
{ ETHERCAT_COE_TYPE_SDOINFO , " SDO Information " } ,
2014-11-14 20:12:06 +00:00
{ 0 , NULL }
} ;
static const value_string CANopenSdoInfo [ ] =
{
{ ECAT_COE_INFO_OPCODE_LIST_Q , " List Req " } ,
{ ECAT_COE_INFO_OPCODE_LIST_S , " List Res " } ,
{ ECAT_COE_INFO_OPCODE_OBJ_Q , " Obj Req " } ,
{ ECAT_COE_INFO_OPCODE_OBJ_S , " Obj Res " } ,
{ ECAT_COE_INFO_OPCODE_ENTRY_Q , " Entry Req " } ,
{ ECAT_COE_INFO_OPCODE_ENTRY_S , " Entry Res " } ,
{ ECAT_COE_INFO_OPCODE_ERROR_S , " Error Res " } ,
{ 0 , NULL }
} ;
2007-10-16 14:54:51 +00:00
static const true_false_string tfs_complete =
2007-10-14 15:44:05 +00:00
{
" Complete " , " Legacy "
} ;
void init_mbx_header ( PETHERCAT_MBOX_HEADER pMbox , tvbuff_t * tvb , gint offset )
{
2016-01-29 08:13:13 +00:00
pMbox - > Length = tvb_get_letohs ( tvb , offset ) ; offset + = 2 ;
pMbox - > Address = tvb_get_letohs ( tvb , offset ) ; offset + = 2 ;
2007-10-14 15:44:05 +00:00
pMbox - > aControlUnion . Control = tvb_get_letohs ( tvb , offset ) ;
}
2013-12-20 06:30:13 +00:00
static void init_eoe_header ( PETHERCAT_EOE_HEADER pEoE , tvbuff_t * tvb , gint offset )
2007-10-14 15:44:05 +00:00
{
2016-01-29 08:13:13 +00:00
pEoE - > anEoeHeaderInfoUnion . Info = tvb_get_letohs ( tvb , offset ) ; offset + = 2 ;
2007-10-14 15:44:05 +00:00
pEoE - > anEoeHeaderDataUnion . Result = tvb_get_letohs ( tvb , offset ) ;
}
2013-12-20 06:30:13 +00:00
static void init_foe_header ( PETHERCAT_FOE_HEADER pFoE , tvbuff_t * tvb , gint offset )
2007-10-14 15:44:05 +00:00
{
2007-10-16 14:54:51 +00:00
pFoE - > OpMode = tvb_get_guint8 ( tvb , offset + + ) ;
pFoE - > Reserved1 = tvb_get_guint8 ( tvb , offset + + ) ;
2007-10-14 15:44:05 +00:00
pFoE - > aFoeHeaderDataUnion . FileLength = tvb_get_letohl ( tvb , offset ) ;
}
2013-12-20 06:30:13 +00:00
static void init_soe_header ( PETHERCAT_SOE_HEADER pSoE , tvbuff_t * tvb , gint offset )
2007-10-14 15:44:05 +00:00
{
2008-01-10 22:19:53 +00:00
pSoE - > anSoeHeaderControlUnion . v2 . Control = tvb_get_guint8 ( tvb , offset + + ) ;
pSoE - > anSoeHeaderControlUnion . v2 . Element = tvb_get_guint8 ( tvb , offset + + ) ;
2007-10-14 15:44:05 +00:00
pSoE - > anSoeHeaderDataUnion . FragmentsLeft = tvb_get_letohs ( tvb , offset ) ;
}
2013-12-20 06:30:13 +00:00
static void init_coe_header ( PETHERCAT_COE_HEADER pCoE , tvbuff_t * tvb , gint offset )
2007-10-14 15:44:05 +00:00
{
pCoE - > header = tvb_get_letohs ( tvb , offset ) ;
}
2013-12-20 06:30:13 +00:00
static void init_sdo_header ( PETHERCAT_SDO_HEADER pSdo , tvbuff_t * tvb , gint offset )
2007-10-14 15:44:05 +00:00
{
pSdo - > anSdoHeaderUnion . CS = tvb_get_guint8 ( tvb , offset + + ) ;
2016-01-29 08:13:13 +00:00
pSdo - > Index = tvb_get_letohs ( tvb , offset ) ; offset + = 2 ;
2007-10-14 15:44:05 +00:00
pSdo - > SubIndex = tvb_get_guint8 ( tvb , offset + + ) ;
pSdo - > Data = tvb_get_letohl ( tvb , offset ) ;
}
2013-12-20 06:30:13 +00:00
static void init_sdo_info_header ( PETHERCAT_SDO_INFO_HEADER pInfo , tvbuff_t * tvb , gint offset )
2007-10-14 15:44:05 +00:00
{
pInfo - > anSdoControlUnion . Control = tvb_get_guint8 ( tvb , offset + + ) ;
2012-01-13 16:37:04 +00:00
pInfo - > Reserved = tvb_get_guint8 ( tvb , offset ) ;
2016-01-29 08:13:13 +00:00
pInfo - > FragmentsLeft = 2 ;
2007-10-14 15:44:05 +00:00
}
2008-03-05 20:42:58 +00:00
static void CANopenSdoReqFormatter ( PETHERCAT_SDO_HEADER pSdo , char * szText , gint nMax )
2007-10-14 15:44:05 +00:00
{
switch ( pSdo - > anSdoHeaderUnion . Idq . Ccs )
2007-10-16 14:54:51 +00:00
{
2007-10-14 15:44:05 +00:00
case SDO_CCS_INITIATE_DOWNLOAD :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SDO Req : 'Initiate Download' (%d) Idx=0x%x Sub=%d " , pSdo - > anSdoHeaderUnion . Idq . Ccs , pSdo - > Index , pSdo - > SubIndex ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_CCS_INITIATE_UPLOAD :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SDO Req : 'Initiate Upload' (%d) Idx=0x%x Sub=%d " , pSdo - > anSdoHeaderUnion . Idq . Ccs , pSdo - > Index , pSdo - > SubIndex ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_CCS_DOWNLOAD_SEGMENT :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SDO Req : 'Download Segment' (%d) " , pSdo - > anSdoHeaderUnion . Idq . Ccs ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_CCS_UPLOAD_SEGMENT :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SDO Req : 'Upload Segment' (%d) " , pSdo - > anSdoHeaderUnion . Idq . Ccs ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_CCS_ABORT_TRANSFER :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SDO Req : 'Abort Transfer' (%d) " , pSdo - > anSdoHeaderUnion . Idq . Ccs ) ;
2007-10-14 15:44:05 +00:00
break ;
default :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SDO Req : Ccs %d " , pSdo - > anSdoHeaderUnion . Idq . Ccs ) ;
2007-10-14 15:44:05 +00:00
}
}
2023-02-13 20:11:46 +00:00
static void FoeFormatter ( tvbuff_t * tvb , wmem_allocator_t * scope , gint offset , char * szText , gint nMax , guint foe_length )
2007-10-14 15:44:05 +00:00
{
ETHERCAT_FOE_HEADER foe ;
2023-01-17 02:33:13 +00:00
char * tmp = NULL ;
2007-10-14 15:44:05 +00:00
init_foe_header ( & foe , tvb , offset ) ;
switch ( foe . OpMode )
{
case ECAT_FOE_OPMODE_RRQ :
case ECAT_FOE_OPMODE_WRQ :
case ECAT_FOE_OPMODE_ERR :
2023-01-17 02:33:13 +00:00
if ( foe_length > ETHERCAT_FOE_HEADER_LEN ) {
2023-02-13 20:11:46 +00:00
tmp = tvb_get_string_enc ( scope , tvb , offset + ETHERCAT_FOE_HEADER_LEN , MIN ( foe_length - ETHERCAT_FOE_HEADER_LEN , 49 ) , ENC_ASCII ) ;
2023-01-17 02:33:13 +00:00
}
2007-10-14 15:44:05 +00:00
break ;
}
switch ( foe . OpMode )
{
case ECAT_FOE_OPMODE_RRQ :
2023-01-17 02:33:13 +00:00
snprintf ( szText , nMax , " FoE RRQ (%d) : '%s' " , foe . aFoeHeaderDataUnion . FileLength , tmp ? tmp : " " ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_FOE_OPMODE_WRQ :
2023-01-17 02:33:13 +00:00
snprintf ( szText , nMax , " FoE WRQ (%d) : '%s' " , foe . aFoeHeaderDataUnion . FileLength , tmp ? tmp : " " ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_FOE_OPMODE_DATA :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " FoE DATA (%d) : %d Bytes " , foe . aFoeHeaderDataUnion . v . PacketNo , foe_length - ETHERCAT_FOE_HEADER_LEN ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_FOE_OPMODE_ACK :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " FoE ACK (%d) " , foe . aFoeHeaderDataUnion . v . PacketNo ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_FOE_OPMODE_ERR :
2023-01-17 02:33:13 +00:00
snprintf ( szText , nMax , " FoE ERR (%d) : '%s' " , foe . aFoeHeaderDataUnion . ErrorCode , tmp ? tmp : " " ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_FOE_OPMODE_BUSY :
2008-01-10 22:19:53 +00:00
if ( foe . aFoeHeaderDataUnion . v2 . Entire > 0 )
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " FoE BUSY (%d%%) " , ( ( guint32 ) foe . aFoeHeaderDataUnion . v2 . Done * 100 ) / foe . aFoeHeaderDataUnion . v2 . Entire ) ;
2007-10-14 15:44:05 +00:00
else
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " FoE BUSY (%d/%d) " , foe . aFoeHeaderDataUnion . v2 . Done , foe . aFoeHeaderDataUnion . v2 . Entire ) ;
2007-10-14 15:44:05 +00:00
break ;
2015-02-05 03:30:20 +00:00
default :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " FoE Unknown " ) ;
2007-10-14 15:44:05 +00:00
}
}
static void SoEIdToString ( char * txt , guint16 id , int nMax )
{
if ( id & 0x8000 )
2021-12-17 20:05:19 +00:00
snprintf ( txt , nMax , " P-%d-%04d " , ( id > > 12 ) & 0x0007 , id & 0x0FFF ) ;
2007-10-14 15:44:05 +00:00
else
2021-12-17 20:05:19 +00:00
snprintf ( txt , nMax , " S-%d-%04d " , id > > 12 , id & 0x0FFF ) ;
2007-10-14 15:44:05 +00:00
}
2008-03-05 20:42:58 +00:00
static void SoeFormatter ( tvbuff_t * tvb , gint offset , char * szText , gint nMax , guint soe_length )
2007-10-14 15:44:05 +00:00
{
ETHERCAT_SOE_HEADER soe ;
char tmp [ 50 ] ;
char elm [ 50 ] ;
memset ( tmp , 0 , sizeof ( tmp ) ) ;
init_soe_header ( & soe , tvb , offset ) ;
offset + = ETHERCAT_SOE_HEADER_LEN ;
2008-01-10 22:19:53 +00:00
if ( ! soe . anSoeHeaderControlUnion . v . Error )
2007-10-14 15:44:05 +00:00
{
2008-01-10 22:19:53 +00:00
if ( ! soe . anSoeHeaderControlUnion . v . InComplete )
2007-10-14 15:44:05 +00:00
{
SoEIdToString ( tmp , soe . anSoeHeaderDataUnion . IDN , sizeof ( tmp ) - 1 ) ;
2008-05-08 18:24:08 +00:00
elm [ 0 ] = ' \0 ' ;
2008-01-10 22:19:53 +00:00
if ( soe . anSoeHeaderControlUnion . v . DataState )
2021-04-30 10:18:25 +00:00
( void ) g_strlcat ( elm , " D " , 50 ) ;
2008-01-10 22:19:53 +00:00
if ( soe . anSoeHeaderControlUnion . v . Name )
2021-04-30 10:18:25 +00:00
( void ) g_strlcat ( elm , " N " , 50 ) ;
2008-01-10 22:19:53 +00:00
if ( soe . anSoeHeaderControlUnion . v . Attribute )
2021-04-30 10:18:25 +00:00
( void ) g_strlcat ( elm , " A " , 50 ) ;
2008-01-10 22:19:53 +00:00
if ( soe . anSoeHeaderControlUnion . v . Unit )
2021-04-30 10:18:25 +00:00
( void ) g_strlcat ( elm , " U " , 50 ) ;
2008-01-10 22:19:53 +00:00
if ( soe . anSoeHeaderControlUnion . v . Min )
2021-04-30 10:18:25 +00:00
( void ) g_strlcat ( elm , " I " , 50 ) ;
2008-01-10 22:19:53 +00:00
if ( soe . anSoeHeaderControlUnion . v . Max )
2021-04-30 10:18:25 +00:00
( void ) g_strlcat ( elm , " X " , 50 ) ;
2008-01-10 22:19:53 +00:00
if ( soe . anSoeHeaderControlUnion . v . Value )
2021-04-30 10:18:25 +00:00
( void ) g_strlcat ( elm , " V " , 50 ) ;
2008-01-10 22:19:53 +00:00
switch ( soe . anSoeHeaderControlUnion . v . OpCode )
2007-10-14 15:44:05 +00:00
{
case ECAT_SOE_OPCODE_RRQ :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: RRQ (%s, '%s') " , tmp , elm ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_SOE_OPCODE_RRS :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: RRS (%s, '%s') : %u Bytes " , tmp , elm , ( guint ) ( soe_length - ETHERCAT_SOE_HEADER_LEN ) ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_SOE_OPCODE_WRS :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: WRS (%s, '%s') " , tmp , elm ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_SOE_OPCODE_WRQ :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: WRQ (%s, '%s') : %u Bytes " , tmp , elm , ( guint ) ( soe_length - ETHERCAT_SOE_HEADER_LEN ) ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_SOE_OPCODE_NFC :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: NFC (%s, '%s') : %u Bytes " , tmp , elm , ( guint ) ( soe_length - ETHERCAT_SOE_HEADER_LEN ) ) ;
2007-10-14 15:44:05 +00:00
break ;
case 6 :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: EMGCY " ) ;
2014-10-06 02:14:57 +00:00
break ;
2007-10-14 15:44:05 +00:00
default :
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: " ) ;
2007-10-14 15:44:05 +00:00
}
}
else
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: FragmentsLeft %d " , soe . anSoeHeaderDataUnion . FragmentsLeft ) ;
2007-10-14 15:44:05 +00:00
}
else
2021-12-17 20:05:19 +00:00
snprintf ( szText , nMax , " SoE: Error %04x " , tvb_get_letohs ( tvb , offset ) ) ;
2007-10-14 15:44:05 +00:00
}
2008-03-05 20:42:58 +00:00
/* ethercat mailbox */
2007-10-14 15:44:05 +00:00
static void dissect_ecat_coe ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * tree )
{
proto_tree * ecat_coe_tree = NULL , * ecat_sdo_tree , * ecat_coe_sdoccs_tree , * ecat_coe_sdoscs_tree ;
2008-03-05 20:42:58 +00:00
proto_item * anItem = NULL , * aparent = NULL ;
2007-10-14 15:44:05 +00:00
char szText [ 200 ] ;
int nMax = sizeof ( szText ) - 1 ;
2007-10-16 14:54:51 +00:00
guint coe_length = tvb_reported_length ( tvb ) - offset ;
2007-10-14 15:44:05 +00:00
guint16 len ;
if ( tree )
{
2014-11-14 20:12:06 +00:00
anItem = proto_tree_add_bytes_format ( tree , hf_ecat_mailbox_coe , tvb , offset , coe_length , NULL , " CoE " ) ;
2008-03-05 20:42:58 +00:00
aparent = proto_item_get_parent ( anItem ) ;
2007-10-14 15:44:05 +00:00
proto_item_append_text ( aparent , " :CoE " ) ;
}
2009-09-24 20:21:23 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " CoE " ) ;
2007-10-14 15:44:05 +00:00
if ( coe_length > = ETHERCAT_COE_HEADER_LEN )
{
ETHERCAT_COE_HEADER coe ;
init_coe_header ( & coe , tvb , offset ) ;
if ( tree )
{
2008-03-05 20:42:58 +00:00
ecat_coe_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_coe ) ;
2007-10-14 15:44:05 +00:00
2014-11-14 20:12:06 +00:00
proto_tree_add_uint ( ecat_coe_tree , hf_ecat_mailbox_coe_number , tvb , offset , ETHERCAT_COE_HEADER_LEN , coe . v . Number ) ;
proto_tree_add_uint ( ecat_coe_tree , hf_ecat_mailbox_coe_type , tvb , offset , ETHERCAT_COE_HEADER_LEN , coe . v . Type ) ;
2007-10-14 15:44:05 +00:00
}
offset + = ETHERCAT_COE_HEADER_LEN ;
2008-01-10 22:19:53 +00:00
switch ( coe . v . Type )
2007-10-14 15:44:05 +00:00
{
case ETHERCAT_COE_TYPE_SDOREQ :
{
ETHERCAT_SDO_HEADER sdo ;
if ( coe_length < ETHERCAT_COE_HEADER_LEN + ETHERCAT_SDO_HEADER_LEN )
{
2009-09-24 20:21:23 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " Sdo Req - invalid length " ) ;
2016-01-29 08:13:13 +00:00
expert_add_info_format ( pinfo , ecat_coe_tree , & ei_ecat_mailbox_coe_error , " Sdo Req - invalid length " ) ;
2007-10-14 15:44:05 +00:00
break ;
}
init_sdo_header ( & sdo , tvb , offset ) ;
2008-03-05 20:42:58 +00:00
CANopenSdoReqFormatter ( & sdo , szText , nMax ) ;
2010-04-05 20:04:52 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , szText ) ;
2007-10-14 15:44:05 +00:00
2007-10-16 14:54:51 +00:00
if ( tree )
2007-10-14 15:44:05 +00:00
{
2008-10-31 17:27:51 +00:00
proto_item_append_text ( aparent , " %s " , szText ) ;
2007-10-14 15:44:05 +00:00
2008-03-05 20:42:58 +00:00
anItem = proto_tree_add_uint ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoreq , tvb , offset , 1 , sdo . anSdoHeaderUnion . Idq . Ccs ) ;
2008-10-31 17:27:51 +00:00
proto_item_set_text ( anItem , " %s " , szText ) ;
2008-03-05 20:42:58 +00:00
ecat_sdo_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_sdo ) ;
2007-10-14 15:44:05 +00:00
switch ( sdo . anSdoHeaderUnion . Idq . Ccs )
{
case SDO_CCS_INITIATE_DOWNLOAD :
2011-10-06 14:46:34 +00:00
anItem = proto_tree_add_item ( ecat_sdo_tree , hf_ecat_mailbox_coe_sdoccsid , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
ecat_coe_sdoccs_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_coe_sdoccs ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsid_sizeind , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsid_expedited , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsid_size0 , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsid_size1 , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsid_complete , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoidx , tvb , offset + 1 , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdosub , tvb , offset + 3 , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
if ( sdo . anSdoHeaderUnion . Idq . SizeInd & & ! sdo . anSdoHeaderUnion . Idq . Expedited )
{
len = coe_length - ETHERCAT_COE_HEADER_LEN - ETHERCAT_SDO_HEADER_LEN ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdolength , tvb , offset + 4 , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = ETHERCAT_SDO_HEADER_LEN ;
if ( len > 0 )
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoldata , tvb , offset , len , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
else
{
if ( sdo . anSdoHeaderUnion . Idq . Size = = 3 )
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdodata1 , tvb , offset + 4 , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
else if ( sdo . anSdoHeaderUnion . Idq . Size = = 2 )
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdodata2 , tvb , offset + 4 , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
else
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdodata , tvb , offset + 4 , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
}
break ;
case SDO_CCS_INITIATE_UPLOAD :
2011-10-06 14:46:34 +00:00
anItem = proto_tree_add_item ( ecat_sdo_tree , hf_ecat_mailbox_coe_sdoccsiu , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
ecat_coe_sdoccs_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_coe_sdoccs ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsid_complete , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoidx , tvb , offset + 1 , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdosub , tvb , offset + 3 , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_CCS_DOWNLOAD_SEGMENT :
2011-10-06 14:46:34 +00:00
anItem = proto_tree_add_item ( ecat_sdo_tree , hf_ecat_mailbox_coe_sdoccsds , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
ecat_coe_sdoccs_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_coe_sdoccs ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsds_lastseg , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsds_size , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsds_toggle , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 1 ;
if ( coe_length - offset > 0 )
{
2011-10-05 01:00:06 +00:00
anItem = proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoldata , tvb , offset , coe_length - offset , ENC_NA ) ;
2008-03-05 20:42:58 +00:00
proto_item_append_text ( anItem , " (len = %d) " , coe_length - offset ) ;
2007-10-14 15:44:05 +00:00
}
break ;
case SDO_CCS_UPLOAD_SEGMENT :
2011-10-06 14:46:34 +00:00
anItem = proto_tree_add_item ( ecat_sdo_tree , hf_ecat_mailbox_coe_sdoccsus , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
ecat_coe_sdoccs_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_coe_sdoccs ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoccs_tree , hf_ecat_mailbox_coe_sdoccsus_toggle , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_CCS_ABORT_TRANSFER :
2019-05-28 06:13:55 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoabortcode , tvb , offset + 4 , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
}
}
}
break ;
case ETHERCAT_COE_TYPE_SDORES :
{
ETHERCAT_SDO_HEADER sdo ;
if ( coe_length < ETHERCAT_COE_HEADER_LEN + ETHERCAT_SDO_HEADER_LEN )
{
2009-09-24 20:21:23 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " Sdo Res - invalid length " ) ;
2016-01-29 08:13:13 +00:00
expert_add_info_format ( pinfo , ecat_coe_tree , & ei_ecat_mailbox_coe_error , " Sdo Res - invalid length " ) ;
2007-10-14 15:44:05 +00:00
break ;
}
init_sdo_header ( & sdo , tvb , offset ) ;
2014-11-14 20:12:06 +00:00
col_append_fstr ( pinfo - > cinfo , COL_INFO , " SDO Res: Scs %d " , sdo . anSdoHeaderUnion . Ids . Scs ) ;
2007-10-14 15:44:05 +00:00
if ( tree )
{
2014-11-14 20:12:06 +00:00
proto_tree_add_uint_format_value ( ecat_coe_tree , hf_ecat_mailbox_coe_sdores , tvb , offset , 1 , sdo . anSdoHeaderUnion . Ids . Scs ,
" Scs %d " , sdo . anSdoHeaderUnion . Ids . Scs ) ;
2008-03-05 20:42:58 +00:00
ecat_sdo_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_sdo ) ;
2007-10-14 15:44:05 +00:00
switch ( sdo . anSdoHeaderUnion . Ids . Scs )
{
case SDO_SCS_INITIATE_DOWNLOAD :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoidx , tvb , offset + 1 , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdosub , tvb , offset + 3 , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_SCS_INITIATE_UPLOAD :
2011-10-06 14:46:34 +00:00
anItem = proto_tree_add_item ( ecat_sdo_tree , hf_ecat_mailbox_coe_sdoscsiu , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
ecat_coe_sdoscs_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_coe_sdoscs ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsiu_sizeind , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsiu_expedited , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsiu_size0 , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsiu_size1 , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsiu_complete , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoidx , tvb , offset + 1 , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdosub , tvb , offset + 3 , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
if ( sdo . anSdoHeaderUnion . Ius . SizeInd & & ! sdo . anSdoHeaderUnion . Ius . Expedited )
{
len = coe_length - ETHERCAT_COE_HEADER_LEN - ETHERCAT_SDO_HEADER_LEN ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdolength , tvb , offset + 4 , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = ETHERCAT_SDO_HEADER_LEN ;
if ( len > 0 )
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoldata , tvb , offset , len , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
else if ( sdo . anSdoHeaderUnion . Ius . SizeInd & & sdo . anSdoHeaderUnion . Ius . Expedited & & sdo . anSdoHeaderUnion . Ius . Size = = 3 )
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdodata1 , tvb , offset + 4 , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
else if ( sdo . anSdoHeaderUnion . Ius . SizeInd & & sdo . anSdoHeaderUnion . Ius . Expedited & & sdo . anSdoHeaderUnion . Ius . Size = = 2 )
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdodata2 , tvb , offset + 4 , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
else
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdodata , tvb , offset + 4 , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_SCS_DOWNLOAD_SEGMENT :
2011-10-06 14:46:34 +00:00
anItem = proto_tree_add_item ( ecat_sdo_tree , hf_ecat_mailbox_coe_sdoscsds , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
ecat_coe_sdoscs_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_coe_sdoscs ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsds_toggle , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
case SDO_SCS_UPLOAD_SEGMENT :
2011-10-06 14:46:34 +00:00
anItem = proto_tree_add_item ( ecat_sdo_tree , hf_ecat_mailbox_coe_sdoscsus , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
ecat_coe_sdoscs_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_coe_sdoscs ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsus_lastseg , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsus_bytes , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_coe_sdoscs_tree , hf_ecat_mailbox_coe_sdoscsus_toggle , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 1 ;
if ( coe_length - offset > 0 )
{
2011-10-05 01:00:06 +00:00
anItem = proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoldata , tvb , offset , coe_length - offset , ENC_NA ) ;
2008-03-05 20:42:58 +00:00
proto_item_append_text ( anItem , " (len = %d) " , coe_length - offset ) ;
2007-10-14 15:44:05 +00:00
}
break ;
}
}
}
break ;
case ETHERCAT_COE_TYPE_SDOINFO :
{
ETHERCAT_SDO_INFO_HEADER info ;
if ( coe_length < ETHERCAT_COE_HEADER_LEN + ETHERCAT_SDO_INFO_LISTREQ_LEN )
{
2009-09-24 20:21:23 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " Sdo Info - invalid length " ) ;
2016-01-29 08:13:13 +00:00
expert_add_info_format ( pinfo , ecat_coe_tree , & ei_ecat_mailbox_coe_error , " Sdo Info - invalid length " ) ;
2007-10-14 15:44:05 +00:00
break ;
}
2013-12-20 08:57:17 +00:00
memset ( & info , 0x0 , sizeof ( info ) ) ;
2007-10-14 15:44:05 +00:00
init_sdo_info_header ( & info , tvb , offset ) ;
2014-11-14 20:12:06 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , val_to_str ( info . anSdoControlUnion . v . OpCode & 0x7F , CANopenSdoInfo , " %d (Unknown) " ) ) ;
2016-08-10 07:53:46 +00:00
if ( info . anSdoControlUnion . v . InComplete )
2014-11-14 20:12:06 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " - More Follows " ) ;
2007-10-14 15:44:05 +00:00
if ( tree )
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoopcode , tvb , offset + + , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + + ; /*Reserved*/
2007-10-16 14:54:51 +00:00
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfofrag , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2008-01-10 22:19:53 +00:00
switch ( info . anSdoControlUnion . v . OpCode )
2007-10-14 15:44:05 +00:00
{
case ECAT_COE_INFO_OPCODE_LIST_Q :
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfolisttype , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
}
break ;
case ECAT_COE_INFO_OPCODE_LIST_S :
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfolisttype , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfolist , tvb , offset , coe_length - offset , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
break ;
case ECAT_COE_INFO_OPCODE_OBJ_Q :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoindex , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_COE_INFO_OPCODE_OBJ_S :
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoindex , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfodatatype , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfomaxsub , tvb , offset + + , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoobjcode , tvb , offset + + , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
2011-10-15 19:58:31 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoname , tvb , offset , coe_length - offset , ENC_ASCII | ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
break ;
case ECAT_COE_INFO_OPCODE_ENTRY_Q :
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoindex , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfosubindex , tvb , offset + + , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfovalueinfo , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
}
break ;
case ECAT_COE_INFO_OPCODE_ENTRY_S :
{
guint16 objlen ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoindex , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfosubindex , tvb , offset + + , 1 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfovalueinfo , tvb , offset + + , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfodatatype , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfobitlen , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoobjaccess , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
if ( ( info . anSdoInfoUnion . Entry . ValueInfo & 0x08 ) ! = 0 )
2007-10-16 14:54:51 +00:00
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfounittype , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
}
if ( ( info . anSdoInfoUnion . Entry . ValueInfo & 0x10 ) ! = 0 )
{
objlen = BIT2BYTE ( info . anSdoInfoUnion . Entry . Res . BitLen ) ;
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfodefaultvalue , tvb , offset , objlen , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
offset + = objlen ;
}
if ( ( info . anSdoInfoUnion . Entry . ValueInfo & 0x20 ) ! = 0 )
{
objlen = BIT2BYTE ( info . anSdoInfoUnion . Entry . Res . BitLen ) ;
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfominvalue , tvb , offset , objlen , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
offset + = objlen ;
}
if ( ( info . anSdoInfoUnion . Entry . ValueInfo & 0x40 ) ! = 0 )
{
objlen = BIT2BYTE ( info . anSdoInfoUnion . Entry . Res . BitLen ) ;
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfomaxvalue , tvb , offset , objlen , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
offset + = objlen ;
}
2011-10-15 19:58:31 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoname , tvb , offset , coe_length - offset , ENC_ASCII | ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
break ;
case ECAT_COE_INFO_OPCODE_ERROR_S :
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_coe_tree , hf_ecat_mailbox_coe_sdoinfoerrorcode , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
}
break ;
}
}
}
break ;
}
}
else
{
2009-09-24 20:21:23 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " - invalid length " ) ;
2016-01-29 08:13:13 +00:00
expert_add_info ( pinfo , tree , & ei_ecat_mailbox_coe_error ) ;
2007-10-14 15:44:05 +00:00
}
}
static void dissect_ecat_soe ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * tree )
{
proto_tree * ecat_soeflag_tree , * ecat_soe_tree ;
2008-03-05 20:42:58 +00:00
proto_item * anItem = NULL , * aparent = NULL ;
2007-10-14 15:44:05 +00:00
char szText [ 200 ] ;
int nMax = sizeof ( szText ) - 1 ;
2007-10-16 14:54:51 +00:00
guint soe_length = tvb_reported_length ( tvb ) - offset ;
2007-10-14 15:44:05 +00:00
if ( tree )
{
2011-10-05 01:00:06 +00:00
anItem = proto_tree_add_item ( tree , hf_ecat_mailbox_soe , tvb , offset , soe_length , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
2008-03-05 20:42:58 +00:00
aparent = proto_item_get_parent ( anItem ) ;
2007-10-14 15:44:05 +00:00
proto_item_append_text ( aparent , " :SoE " ) ;
}
if ( soe_length > = ETHERCAT_SOE_HEADER_LEN )
{
2008-03-05 20:42:58 +00:00
SoeFormatter ( tvb , offset , szText , nMax , soe_length ) ;
2010-04-05 20:04:52 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , szText ) ;
2007-10-14 15:44:05 +00:00
if ( tree )
{
ETHERCAT_SOE_HEADER soe ;
init_soe_header ( & soe , tvb , offset ) ;
2008-10-31 17:27:51 +00:00
proto_item_append_text ( aparent , " %s " , szText ) ;
proto_item_set_text ( anItem , " %s " , szText ) ;
2008-03-05 20:42:58 +00:00
ecat_soe_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_soe ) ;
2011-10-06 14:46:34 +00:00
anItem = proto_tree_add_item ( ecat_soe_tree , hf_ecat_mailbox_soe_header , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2008-03-05 20:42:58 +00:00
ecat_soeflag_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_soeflag ) ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_opcode , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_incomplete , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_error , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_driveno , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_datastate , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_name , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_attribute , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_unit , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_min , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_max , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_value , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_soeflag_tree , hf_ecat_mailbox_soe_header_reserved , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2008-01-10 22:19:53 +00:00
if ( ! soe . anSoeHeaderControlUnion . v . Error )
2007-10-14 15:44:05 +00:00
{
2008-01-10 22:19:53 +00:00
if ( ! soe . anSoeHeaderControlUnion . v . InComplete )
2007-10-16 14:54:51 +00:00
{
2008-01-10 22:19:53 +00:00
switch ( soe . anSoeHeaderControlUnion . v . OpCode )
2007-10-14 15:44:05 +00:00
{
case ECAT_SOE_OPCODE_RRQ :
case ECAT_SOE_OPCODE_WRS :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_soe_tree , hf_ecat_mailbox_soe_idn , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_SOE_OPCODE_RRS :
case ECAT_SOE_OPCODE_WRQ :
case ECAT_SOE_OPCODE_NFC :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_soe_tree , hf_ecat_mailbox_soe_idn , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( tree , hf_ecat_mailbox_soe_data , tvb , offset , soe_length - offset , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
break ;
}
}
else
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_soe_tree , hf_ecat_mailbox_soe_frag , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( tree , hf_ecat_mailbox_soe_data , tvb , offset , soe_length - offset , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
}
else
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_soe_tree , hf_ecat_mailbox_soe_idn , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( tree , hf_ecat_mailbox_soe_error , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
}
}
}
else
{
2009-09-24 20:21:23 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " SoE - invalid length " ) ;
2016-01-29 08:13:13 +00:00
expert_add_info ( pinfo , tree , & ei_ecat_mailbox_soe_error ) ;
2007-10-14 15:44:05 +00:00
}
}
2007-10-16 14:54:51 +00:00
static void dissect_ecat_eoe ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * tree )
2007-10-14 15:44:05 +00:00
{
proto_tree * ecat_eoe_tree = 0 , * ecat_fraghead_tree , * ecat_eoe_init_tree , * ecat_eoe_macfilter_tree ,
2011-02-17 18:45:45 +00:00
* ecat_eoe_macfilter_filter_tree ;
2007-10-14 15:44:05 +00:00
tvbuff_t * next_tvb ;
2008-03-05 20:42:58 +00:00
proto_item * anItem = NULL , * aparent = NULL ;
2007-10-14 15:44:05 +00:00
int nCnt ;
2007-10-16 14:54:51 +00:00
guint eoe_length = tvb_reported_length ( tvb ) - offset ;
2007-10-14 15:44:05 +00:00
if ( tree )
{
2014-11-14 20:12:06 +00:00
anItem = proto_tree_add_bytes_format ( tree , hf_ecat_mailbox_eoe , tvb , offset , eoe_length , NULL , " EoE Fragment " ) ;
2007-10-14 15:44:05 +00:00
2008-03-05 20:42:58 +00:00
aparent = proto_item_get_parent ( anItem ) ;
2007-10-14 15:44:05 +00:00
proto_item_append_text ( aparent , " :EoE " ) ;
}
if ( eoe_length > = ETHERCAT_EOE_HEADER_LEN )
2007-10-16 14:54:51 +00:00
{
ETHERCAT_EOE_HEADER eoe ;
2007-10-14 15:44:05 +00:00
init_eoe_header ( & eoe , tvb , offset ) ;
2010-04-05 20:04:52 +00:00
if ( eoe . anEoeHeaderInfoUnion . v . Type = = EOE_TYPE_FRAME_FRAG )
2014-11-14 20:12:06 +00:00
col_append_fstr ( pinfo - > cinfo , COL_INFO , " EoE-Frag %d " , eoe . anEoeHeaderDataUnion . v . Fragment ) ;
2010-04-05 20:04:52 +00:00
else
2014-11-14 20:12:06 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " EoE " ) ;
2007-10-14 15:44:05 +00:00
2011-03-24 17:37:07 +00:00
{ /* Do the following even 'if (tree == NULL)' since a call_dissector() is done */
2008-03-05 20:42:58 +00:00
ecat_eoe_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_eoe ) ;
2007-10-14 15:44:05 +00:00
2011-10-05 01:00:06 +00:00
anItem = proto_tree_add_item ( ecat_eoe_tree , hf_ecat_mailbox_eoe_fraghead , tvb , offset , 4 , ENC_NA ) ;
2008-03-05 20:42:58 +00:00
ecat_fraghead_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_fraghead ) ;
2007-10-14 15:44:05 +00:00
2014-11-14 20:12:06 +00:00
proto_tree_add_uint ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_type , tvb , offset , 4 , eoe . anEoeHeaderInfoUnion . v . Type ) ;
2007-10-16 14:54:51 +00:00
2008-01-10 22:19:53 +00:00
switch ( eoe . anEoeHeaderInfoUnion . v . Type )
2007-10-14 15:44:05 +00:00
{
case EOE_TYPE_FRAME_FRAG :
2014-11-14 20:12:06 +00:00
proto_tree_add_uint ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_fragno , tvb , offset , 4 , eoe . anEoeHeaderDataUnion . v . Fragment ) ;
2007-10-14 15:44:05 +00:00
2014-11-14 20:12:06 +00:00
if ( eoe . anEoeHeaderDataUnion . v . Fragment = = 0 )
{
proto_tree_add_uint_format ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_offset , tvb , offset , 4 , 32 * eoe . anEoeHeaderDataUnion . v . OffsetBuffer ,
" BufferSize: %d " , 32 * eoe . anEoeHeaderDataUnion . v . OffsetBuffer ) ;
}
else
{
proto_tree_add_uint ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_offset , tvb , offset , 4 , 32 * eoe . anEoeHeaderDataUnion . v . OffsetBuffer ) ;
}
2007-10-14 15:44:05 +00:00
2014-11-14 20:12:06 +00:00
proto_tree_add_uint ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_frame , tvb , offset , 4 , eoe . anEoeHeaderDataUnion . v . FrameNo ) ;
2007-10-14 15:44:05 +00:00
2014-11-14 20:12:06 +00:00
proto_tree_add_uint ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_last , tvb , offset , 4 , eoe . anEoeHeaderInfoUnion . v . LastFragment ) ;
2007-10-14 15:44:05 +00:00
2008-01-10 22:19:53 +00:00
if ( eoe . anEoeHeaderInfoUnion . v . TimeStampRequested )
2007-10-14 15:44:05 +00:00
{
2014-11-14 20:12:06 +00:00
proto_tree_add_uint ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_timestampreq , tvb , offset , 4 , eoe . anEoeHeaderInfoUnion . v . TimeStampRequested ) ;
2007-10-14 15:44:05 +00:00
}
2008-01-10 22:19:53 +00:00
if ( eoe . anEoeHeaderInfoUnion . v . TimeStampAppended )
2007-10-14 15:44:05 +00:00
{
2014-11-14 20:12:06 +00:00
proto_tree_add_uint ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_timestampapp , tvb , offset , 4 , eoe . anEoeHeaderInfoUnion . v . TimeStampAppended ) ;
2007-10-14 15:44:05 +00:00
}
offset + = ETHERCAT_EOE_HEADER_LEN ;
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_eoe_tree , hf_ecat_mailbox_eoe_fragment , tvb , offset , eoe_length - offset , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
2008-01-10 22:19:53 +00:00
if ( eoe . anEoeHeaderDataUnion . v . Fragment = = 0 )
2007-10-14 15:44:05 +00:00
{
2014-06-06 14:35:50 +00:00
next_tvb = tvb_new_subset_length ( tvb , offset , eoe_length - offset ) ;
2007-10-14 15:44:05 +00:00
call_dissector ( eth_handle , next_tvb , pinfo , ecat_eoe_tree ) ;
}
2008-01-10 22:19:53 +00:00
if ( eoe . anEoeHeaderInfoUnion . v . TimeStampAppended )
2007-10-14 15:44:05 +00:00
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_eoe_tree , hf_ecat_mailbox_eoe_timestamp , tvb , eoe_length - ETHERCAT_EOE_TIMESTAMP_LEN , ETHERCAT_EOE_TIMESTAMP_LEN , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
}
break ;
case EOE_TYPE_TIMESTAMP_RES :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_eoe_tree , hf_ecat_mailbox_eoe_timestamp , tvb , offset + ETHERCAT_EOE_HEADER_LEN , ETHERCAT_EOE_TIMESTAMP_LEN , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
2007-10-16 14:54:51 +00:00
case EOE_TYPE_INIT_REQ :
2007-10-14 15:44:05 +00:00
offset + = ETHERCAT_EOE_HEADER_LEN ;
2011-10-05 01:00:06 +00:00
anItem = proto_tree_add_item ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_init , tvb , offset , MIN ( eoe_length - offset , ETHERCAT_EOE_INIT_LEN ) , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
if ( eoe_length - offset > = ETHERCAT_EOE_INIT_LEN )
{
2008-03-05 20:42:58 +00:00
ecat_eoe_init_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_eoe_init ) ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_contains_macaddr , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_contains_ipaddr , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_contains_subnetmask , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_contains_defaultgateway , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_contains_dnsserver , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_contains_dnsname , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_append_timestamp , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 4 ;
2011-10-20 14:30:27 +00:00
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_macaddr , tvb , offset , ETHERNET_ADDRESS_LEN , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
offset + = ETHERNET_ADDRESS_LEN ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_ipaddr , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 4 ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_subnetmask , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 4 ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_defaultgateway , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 4 ;
2011-10-10 00:53:55 +00:00
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_dnsserver , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 4 ;
2011-10-15 19:58:31 +00:00
proto_tree_add_item ( ecat_eoe_init_tree , hf_ecat_mailbox_eoe_init_dnsname , tvb , offset , 32 , ENC_ASCII | ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
else
2016-01-29 08:13:13 +00:00
{
2008-03-05 20:42:58 +00:00
proto_item_append_text ( anItem , " - Invalid length! " ) ;
2016-01-29 08:13:13 +00:00
expert_add_info ( pinfo , anItem , & ei_ecat_mailbox_eoe_error ) ;
}
2007-10-14 15:44:05 +00:00
break ;
case EOE_TYPE_MACFILTER_REQ :
{
EoeMacFilterOptionsUnion options ;
offset + = ETHERCAT_EOE_HEADER_LEN ;
2011-10-05 01:00:06 +00:00
anItem = proto_tree_add_item ( ecat_fraghead_tree , hf_ecat_mailbox_eoe_macfilter , tvb , offset , MIN ( eoe_length - offset , ETHERCAT_EOE_MACFILTER_LEN ) , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
if ( eoe_length - offset > = ETHERCAT_EOE_MACFILTER_LEN )
{
2011-04-22 14:48:10 +00:00
proto_tree * ecat_eoe_macfilter_filtermask_tree ;
2008-03-05 20:42:58 +00:00
ecat_eoe_macfilter_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_eoe_macfilter ) ;
2012-06-07 20:16:28 +00:00
/* XXX: Is the field containing EoeMacFilterOptionsUnion 4 bytes or 2 bytes ? */
/* sizeof EoeMacFilterOptionsUnion = 2 bytes but the code below */
/* originally used a field width of 4 bytes. */
/* Given the size of the union, the code below was changed to */
/* use a field width of 2 bytes. */
/* The hf[] entries were also changed to match the union struct */
proto_tree_add_item ( ecat_eoe_macfilter_tree , hf_ecat_mailbox_eoe_macfilter_macfiltercount , tvb , offset , /*4*/ 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_eoe_macfilter_tree , hf_ecat_mailbox_eoe_macfilter_maskcount , tvb , offset , /*4*/ 2 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( ecat_eoe_macfilter_tree , hf_ecat_mailbox_eoe_macfilter_nobroadcasts , tvb , offset , /*4*/ 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
options . Options = tvb_get_letohs ( tvb , offset ) ;
2012-06-07 20:16:28 +00:00
offset + = /*4*/ 2 ;
2007-10-14 15:44:05 +00:00
2011-10-05 01:00:06 +00:00
anItem = proto_tree_add_item ( ecat_eoe_macfilter_tree , hf_ecat_mailbox_eoe_macfilter_filter , tvb , offset , 16 * ETHERNET_ADDRESS_LEN , ENC_NA ) ;
2008-03-05 20:42:58 +00:00
ecat_eoe_macfilter_filter_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_eoe_macfilter_filter ) ;
2008-01-10 22:19:53 +00:00
for ( nCnt = 0 ; nCnt < options . v . MacFilterCount ; nCnt + + )
2012-05-11 18:54:32 +00:00
proto_tree_add_item ( ecat_eoe_macfilter_filter_tree , hf_ecat_mailbox_eoe_macfilter_filters [ nCnt ] , tvb , offset + nCnt * ETHERNET_ADDRESS_LEN , ETHERNET_ADDRESS_LEN , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
offset + = 16 * ETHERNET_ADDRESS_LEN ;
2016-01-29 08:13:13 +00:00
anItem = proto_tree_add_item ( ecat_eoe_macfilter_tree , hf_ecat_mailbox_eoe_macfilter_filtermask , tvb , offset , 4 * 4 , ENC_NA ) ;
2011-04-22 14:48:10 +00:00
ecat_eoe_macfilter_filtermask_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_eoe_macfilter_filtermask ) ;
2008-01-10 22:19:53 +00:00
for ( nCnt = 0 ; nCnt < options . v . MacFilterMaskCount ; nCnt + + )
2016-01-29 08:13:13 +00:00
proto_tree_add_item ( ecat_eoe_macfilter_filtermask_tree , hf_ecat_mailbox_eoe_macfilter_filtermasks [ nCnt ] , tvb , offset + nCnt * 4 , 4 , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
else
2016-01-29 08:13:13 +00:00
{
2008-03-05 20:42:58 +00:00
proto_item_append_text ( anItem , " - Invalid length! " ) ;
2016-01-29 08:13:13 +00:00
expert_add_info ( pinfo , anItem , & ei_ecat_mailbox_eoe_error ) ;
}
2007-10-14 15:44:05 +00:00
}
break ;
case EOE_TYPE_INIT_RES :
case EOE_TYPE_MACFILTER_RES :
break ;
}
}
2010-04-05 20:04:52 +00:00
col_prepend_fstr ( pinfo - > cinfo , COL_INFO , " EoE( " ) ;
2007-10-14 15:44:05 +00:00
2010-04-05 20:04:52 +00:00
col_prepend_fstr ( pinfo - > cinfo , COL_PROTOCOL , " EoE- " ) ;
2007-10-14 15:44:05 +00:00
}
else
{
2016-01-29 08:13:13 +00:00
expert_add_info ( pinfo , tree , & ei_ecat_mailbox_eoe_error ) ;
2009-09-24 20:21:23 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " EoE - invalid length! " ) ;
2007-10-14 15:44:05 +00:00
}
}
2007-10-16 14:54:51 +00:00
static void dissect_ecat_foe ( tvbuff_t * tvb , gint offset , packet_info * pinfo , proto_tree * tree )
2007-10-14 15:44:05 +00:00
{
proto_tree * ecat_foe_tree , * ecat_foe_efw_tree ;
2008-03-05 20:42:58 +00:00
proto_item * anItem = NULL , * aparent = NULL ;
2007-10-14 15:44:05 +00:00
char szText [ 200 ] ;
int nMax = sizeof ( szText ) - 1 ;
guint foe_length = tvb_reported_length ( tvb ) - offset ;
if ( tree )
{
2014-11-14 20:12:06 +00:00
anItem = proto_tree_add_bytes_format ( tree , hf_ecat_mailbox_foe , tvb , offset , foe_length , NULL , " Foe " ) ;
2007-10-14 15:44:05 +00:00
2008-03-05 20:42:58 +00:00
aparent = proto_item_get_parent ( anItem ) ;
2018-04-22 11:35:18 +00:00
proto_item_append_text ( aparent , " : FoE " ) ;
2007-10-14 15:44:05 +00:00
}
if ( foe_length > = ETHERCAT_FOE_HEADER_LEN )
{
2023-02-13 20:11:46 +00:00
FoeFormatter ( tvb , pinfo - > pool , offset , szText , nMax , foe_length ) ;
2010-04-05 20:04:52 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , szText ) ;
2007-10-14 15:44:05 +00:00
if ( tree )
{
2007-10-16 14:54:51 +00:00
ETHERCAT_FOE_HEADER foe ;
2007-10-14 15:44:05 +00:00
init_foe_header ( & foe , tvb , offset ) ;
2008-03-05 20:42:58 +00:00
ecat_foe_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_foe ) ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_opmode , tvb , offset + + , 1 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + + ; /*Reserved1;*/
switch ( foe . OpMode )
{
case ECAT_FOE_OPMODE_RRQ :
case ECAT_FOE_OPMODE_WRQ :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_filelength , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 4 ;
2011-10-15 19:58:31 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_filename , tvb , offset , foe_length - offset , ENC_ASCII | ENC_NA ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_FOE_OPMODE_DATA :
{
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_packetno , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 4 ; /*+2 for Reserved2*/
if ( foe_length - offset > = sizeof ( TEFWUPDATE_HEADER ) )
2007-10-16 14:54:51 +00:00
{
2011-10-05 01:00:06 +00:00
anItem = proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_efw , tvb , offset , foe_length - offset , ENC_NA ) ;
2008-03-05 20:42:58 +00:00
ecat_foe_efw_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox_foe_efw ) ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_efw_tree , hf_ecat_mailbox_foe_efw_cmd , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_efw_tree , hf_ecat_mailbox_foe_efw_size , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_efw_tree , hf_ecat_mailbox_foe_efw_addresslw , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_efw_tree , hf_ecat_mailbox_foe_efw_addresshw , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_foe_efw_tree , hf_ecat_mailbox_foe_efw_data , tvb , offset , foe_length - offset , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
2018-04-22 11:35:18 +00:00
else
{
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_data , tvb , offset , foe_length - offset , ENC_NA ) ;
}
2007-10-14 15:44:05 +00:00
}
break ;
case ECAT_FOE_OPMODE_ACK :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_packetno , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_FOE_OPMODE_ERR :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_errcode , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 4 ;
2011-10-15 19:58:31 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_errtext , tvb , offset , foe_length - offset , ENC_ASCII | ENC_NA ) ;
2007-10-14 15:44:05 +00:00
break ;
case ECAT_FOE_OPMODE_BUSY :
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_busydone , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
offset + = 2 ;
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( ecat_foe_tree , hf_ecat_mailbox_foe_busyentire , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2007-10-14 15:44:05 +00:00
break ;
}
}
}
else
{
2009-09-24 20:21:23 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " FoE - invalid length " ) ;
2016-01-29 08:13:13 +00:00
expert_add_info ( pinfo , tree , & ei_ecat_mailbox_foe_error ) ;
2007-10-14 15:44:05 +00:00
}
}
2015-11-14 20:11:44 +00:00
static int dissect_ecat_mailbox ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ )
2007-10-14 15:44:05 +00:00
{
2008-03-05 20:42:58 +00:00
proto_tree * ecat_mailbox_tree = NULL ;
proto_tree * ecat_mailbox_header_tree = NULL ;
2007-10-14 15:44:05 +00:00
tvbuff_t * next_tvb ;
2008-03-05 20:42:58 +00:00
proto_item * anItem ;
2007-10-14 15:44:05 +00:00
gint offset = 0 ;
2009-04-16 03:38:23 +00:00
gint mailbox_length = tvb_reported_length ( tvb ) ;
2007-10-14 15:44:05 +00:00
if ( mailbox_length > = ETHERCAT_MBOX_HEADER_LEN )
{
ETHERCAT_MBOX_HEADER hdr ;
init_mbx_header ( & hdr , tvb , offset ) ;
2016-01-29 08:13:13 +00:00
col_append_str ( pinfo - > cinfo , COL_INFO , " Mbx( " ) ;
2007-10-14 15:44:05 +00:00
2016-01-29 08:13:13 +00:00
/* Create the mailbox sub tree */
anItem = proto_tree_add_item ( tree , proto_ecat_mailbox , tvb , 0 , ETHERCAT_MBOX_HEADER_LEN + hdr . Length , ENC_NA ) ;
ecat_mailbox_tree = proto_item_add_subtree ( anItem , ett_ecat_mailbox ) ;
2008-03-05 20:42:58 +00:00
2016-01-29 08:13:13 +00:00
/* Create a mailbox header subtree */
ecat_mailbox_header_tree = proto_tree_add_subtree ( ecat_mailbox_tree , tvb , offset , ETHERCAT_MBOX_HEADER_LEN , ett_ecat_mailbox_header , NULL , " Header " ) ;
2007-10-14 15:44:05 +00:00
2016-01-29 08:13:13 +00:00
/* Add length information to the mailbox header */
proto_tree_add_item ( ecat_mailbox_header_tree , hf_ecat_mailboxlength , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
offset + = 2 ;
2007-10-14 15:44:05 +00:00
2016-01-29 08:13:13 +00:00
/* Add address information to the mailbox header */
proto_tree_add_item ( ecat_mailbox_header_tree , hf_ecat_mailboxaddress , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
offset + = 2 ;
2008-03-05 20:42:58 +00:00
2016-01-29 08:13:13 +00:00
/* Add priority information to the mailbox header */
proto_tree_add_item ( ecat_mailbox_header_tree , hf_ecat_mailboxpriority , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
offset + = 1 ;
2007-10-14 15:44:05 +00:00
2016-01-29 08:13:13 +00:00
/* Add type information to the mailbox header */
proto_tree_add_uint ( ecat_mailbox_header_tree , hf_ecat_mailboxtype , tvb , offset , 1 , hdr . aControlUnion . v . Type ) ;
2007-10-14 15:44:05 +00:00
2016-01-29 08:13:13 +00:00
/* Add counter information to the mailbox header */
proto_tree_add_uint ( ecat_mailbox_header_tree , hf_ecat_mailboxcounter , tvb , offset , 1 , hdr . aControlUnion . v . Counter ) ;
offset + + ;
2007-10-14 15:44:05 +00:00
2016-01-29 08:13:13 +00:00
if ( mailbox_length > = ETHERCAT_MBOX_HEADER_LEN + hdr . Length )
{
2014-06-06 14:35:50 +00:00
next_tvb = tvb_new_subset_length ( tvb , offset , hdr . Length ) ;
2008-01-10 22:19:53 +00:00
switch ( hdr . aControlUnion . v . Type )
2007-10-14 15:44:05 +00:00
{
case ETHERCAT_MBOX_TYPE_ADS :
call_dissector ( ams_handle , next_tvb , pinfo , ecat_mailbox_tree ) ;
break ;
case ETHERCAT_MBOX_TYPE_EOE :
dissect_ecat_eoe ( next_tvb , 0 , pinfo , ecat_mailbox_tree ) ;
break ;
case ETHERCAT_MBOX_TYPE_COE :
dissect_ecat_coe ( next_tvb , 0 , pinfo , ecat_mailbox_tree ) ;
break ;
case ETHERCAT_MBOX_TYPE_FOE :
dissect_ecat_foe ( next_tvb , 0 , pinfo , ecat_mailbox_tree ) ;
break ;
case ETHERCAT_MBOX_TYPE_SOE :
dissect_ecat_soe ( next_tvb , 0 , pinfo , ecat_mailbox_tree ) ;
break ;
default :
2011-10-05 01:00:06 +00:00
proto_tree_add_item ( ecat_mailbox_tree , hf_ecat_mailboxdata , tvb , offset , hdr . Length , ENC_NA ) ;
2007-10-14 15:44:05 +00:00
}
}
2016-01-29 08:13:13 +00:00
else
{
anItem = proto_tree_add_item ( ecat_mailbox_tree , hf_ecat_mailboxdata , tvb , offset , mailbox_length - ETHERCAT_MBOX_HEADER_LEN , ENC_NA ) ;
expert_add_info_format ( pinfo , anItem , & ei_ecat_mailbox_error , " Incorrect Mailbox data length(Expected:%d Actual:%d) " , hdr . Length , mailbox_length - ETHERCAT_MBOX_HEADER_LEN ) ;
}
col_append_str ( pinfo - > cinfo , COL_INFO , " ) " ) ;
2007-10-14 15:44:05 +00:00
}
2016-01-29 08:13:13 +00:00
return tvb_captured_length ( tvb ) ;
2007-10-14 15:44:05 +00:00
}
void proto_register_ecat_mailbox ( void )
{
2008-03-05 22:28:51 +00:00
static const true_false_string flags_set_truth =
2007-10-14 15:44:05 +00:00
{
" Set " ,
" Not set "
} ;
static hf_register_info hf [ ] =
{
2007-10-16 14:54:51 +00:00
{ & hf_ecat_mailboxlength ,
2009-06-18 23:22:10 +00:00
{ " Length " , " ecat_mailbox.length " ,
2007-10-14 15:44:05 +00:00
FT_UINT16 , BASE_DEC , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2007-10-16 14:54:51 +00:00
{ & hf_ecat_mailboxaddress ,
2009-06-18 23:22:10 +00:00
{ " Address " , " ecat_mailbox.address " ,
2007-10-14 15:44:05 +00:00
FT_UINT16 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2014-11-14 20:12:06 +00:00
{ & hf_ecat_mailboxpriority ,
{ " Priority " , " ecat_mailbox.priority " ,
FT_UINT8 , BASE_DEC , NULL , 0x03 ,
NULL , HFILL }
} ,
{ & hf_ecat_mailboxtype ,
{ " Type " , " ecat_mailbox.type " ,
FT_UINT8 , BASE_DEC , VALS ( EcMBoxType ) , 0x0 ,
NULL , HFILL }
} ,
{ & hf_ecat_mailboxcounter ,
{ " Counter " , " ecat_mailbox.counter " ,
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
NULL , HFILL }
} ,
2007-10-16 14:54:51 +00:00
{ & hf_ecat_mailbox_eoe ,
2007-10-14 15:44:05 +00:00
{ " EoE Fragment " , " ecat_mailbox.eoe " ,
FT_BYTES , BASE_NONE , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_fraghead ,
2014-11-14 20:12:06 +00:00
{ " Header " , " ecat_mailbox.eoe.fraghead " ,
2007-10-14 15:44:05 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_type ,
2014-11-14 20:12:06 +00:00
{ " Type " , " ecat_mailbox.eoe.type " ,
FT_UINT32 , BASE_DEC , VALS ( EoEType ) , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_fragno ,
2014-11-14 20:12:06 +00:00
{ " FragNo " , " ecat_mailbox.eoe.fragno " ,
2009-06-18 23:22:10 +00:00
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_offset ,
2014-11-14 20:12:06 +00:00
{ " Offset " , " ecat_mailbox.eoe.offset " ,
2009-06-18 23:22:10 +00:00
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_frame ,
2014-11-14 20:12:06 +00:00
{ " FrameNo " , " ecat_mailbox.eoe.frame " ,
2009-06-18 23:22:10 +00:00
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_last ,
2014-11-14 20:12:06 +00:00
{ " Last Fragment " , " ecat_mailbox.eoe.last " ,
2016-01-29 08:13:13 +00:00
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_timestampapp ,
2014-11-14 20:12:06 +00:00
{ " Time Stamp Appended " , " ecat_mailbox.eoe.timestampapp " ,
2009-06-18 23:22:10 +00:00
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_timestampreq ,
2014-11-14 20:12:06 +00:00
{ " Time Stamp Requested " , " ecat_mailbox.eoe.timestampreq " ,
2009-06-18 23:22:10 +00:00
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_fragment ,
{ " EoE Frag Data " , " ecat_mailbox.eoe.fragment " ,
2009-06-18 23:22:10 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init ,
{ " Init " , " ecat_mailbox.eoe.init " ,
2009-06-18 23:22:10 +00:00
FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_contains_macaddr ,
{ " MacAddr " , " ecat_mailbox.eoe.init.contains_macaddr " ,
2009-06-18 23:22:10 +00:00
FT_BOOLEAN , 32 , TFS ( & flags_set_truth ) , 0x00000001 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_contains_ipaddr ,
{ " IpAddr " , " ecat_mailbox.eoe.init.contains_ipaddr " ,
2009-06-18 23:22:10 +00:00
FT_BOOLEAN , 32 , TFS ( & flags_set_truth ) , 0x00000002 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_contains_subnetmask ,
{ " SubnetMask " , " ecat_mailbox.eoe.init.contains_subnetmask " ,
2009-06-18 23:22:10 +00:00
FT_BOOLEAN , 32 , TFS ( & flags_set_truth ) , 0x00000004 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_contains_defaultgateway ,
{ " DefaultGateway " , " ecat_mailbox.eoe.init.contains_defaultgateway " ,
2009-06-18 23:22:10 +00:00
FT_BOOLEAN , 32 , TFS ( & flags_set_truth ) , 0x00000008 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_contains_dnsserver ,
{ " DnsServer " , " ecat_mailbox.eoe.init.contains_dnsserver " ,
2009-06-18 23:22:10 +00:00
FT_BOOLEAN , 32 , TFS ( & flags_set_truth ) , 0x00000010 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_contains_dnsname ,
{ " DnsName " , " ecat_mailbox.eoe.init.contains_dnsname " ,
2009-06-18 23:22:10 +00:00
FT_BOOLEAN , 32 , TFS ( & flags_set_truth ) , 0x00000020 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_append_timestamp ,
{ " AppendTimeStamp " , " ecat_mailbox.eoe.init.append_timestamp " ,
2009-06-18 23:22:10 +00:00
FT_BOOLEAN , 32 , TFS ( & flags_set_truth ) , 0x00010000 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_macaddr ,
{ " Mac Addr " , " ecat_mailbox.eoe.init.macaddr " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_ipaddr ,
{ " Ip Addr " , " ecat_mailbox.eoe.init.ipaddr " ,
2009-06-18 23:22:10 +00:00
FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_subnetmask ,
{ " Subnet Mask " , " ecat_mailbox.eoe.init.subnetmask " ,
2009-06-18 23:22:10 +00:00
FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_defaultgateway ,
{ " Default Gateway " , " ecat_mailbox.eoe.init.defaultgateway " ,
2009-06-18 23:22:10 +00:00
FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_dnsserver ,
{ " Dns Server " , " ecat_mailbox.eoe.init.dnsserver " ,
2009-06-18 23:22:10 +00:00
FT_IPv4 , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_init_dnsname ,
{ " Dns Name " , " ecat_mailbox.eoe.init.dnsname " ,
2009-06-18 23:22:10 +00:00
FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter ,
{ " Mac Filter " , " ecat_mailbox.eoe.macfilter " ,
2009-06-18 23:22:10 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2012-06-07 20:16:28 +00:00
/* XXX: The following 3 fields may not be specified correctly */
/* See related comment above */
2007-10-14 15:44:05 +00:00
{ & hf_ecat_mailbox_eoe_macfilter_macfiltercount ,
{ " Mac Filter Count " , " ecat_mailbox.eoe.macfilter.macfiltercount " ,
2012-06-07 20:16:28 +00:00
FT_UINT16 , BASE_DEC , NULL , 0xF000 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_maskcount ,
{ " Mac Filter Mask Count " , " ecat_mailbox.eoe.macfilter.maskcount " ,
2012-06-07 20:16:28 +00:00
FT_UINT16 , BASE_DEC , NULL , 0x0C00 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_nobroadcasts ,
{ " No Broadcasts " , " ecat_mailbox.eoe.macfilter.nobroadcasts " ,
2012-06-07 20:16:28 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x0100 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2012-06-07 20:16:28 +00:00
/* ... */
2007-10-14 15:44:05 +00:00
{ & hf_ecat_mailbox_eoe_macfilter_filter ,
{ " Filter " , " ecat_mailbox.eoe.macfilter.filter " ,
2009-06-18 23:22:10 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 0 ] ,
{ " Filter 0 " , " ecat_mailbox.eoe.macfilter.filter0 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 1 ] ,
{ " Filter 1 " , " ecat_mailbox.eoe.macfilter.filter1 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 2 ] ,
{ " Filter 2 " , " ecat_mailbox.eoe.macfilter.filter2 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 3 ] ,
{ " Filter 3 " , " ecat_mailbox.eoe.macfilter.filter3 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 4 ] ,
{ " Filter 4 " , " ecat_mailbox.eoe.macfilter.filter4 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 5 ] ,
{ " Filter 5 " , " ecat_mailbox.eoe.macfilter.filter5 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 6 ] ,
{ " Filter 6 " , " ecat_mailbox.eoe.macfilter.filter6 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 7 ] ,
{ " Filter 7 " , " ecat_mailbox.eoe.macfilter.filter7 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 8 ] ,
{ " Filter 8 " , " ecat_mailbox.eoe.macfilter.filter8 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 9 ] ,
{ " Filter 9 " , " ecat_mailbox.eoe.macfilter.filter9 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 10 ] ,
{ " Filter 10 " , " ecat_mailbox.eoe.macfilter.filter10 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 11 ] ,
{ " Filter 11 " , " ecat_mailbox.eoe.macfilter.filter11 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 12 ] ,
{ " Filter 12 " , " ecat_mailbox.eoe.macfilter.filter12 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 13 ] ,
{ " Filter 13 " , " ecat_mailbox.eoe.macfilter.filter13 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 14 ] ,
{ " Filter 14 " , " ecat_mailbox.eoe.macfilter.filter14 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filters [ 15 ] ,
{ " Filter 15 " , " ecat_mailbox.eoe.macfilter.filter15 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filtermask ,
{ " Filter Mask " , " ecat_mailbox.eoe.macfilter.filtermask " ,
2009-06-18 23:22:10 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filtermasks [ 0 ] ,
{ " Mask 0 " , " ecat_mailbox.eoe.macfilter.filtermask0 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filtermasks [ 1 ] ,
{ " Mask 1 " , " ecat_mailbox.eoe.macfilter.filtermask1 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filtermasks [ 2 ] ,
{ " Mask 2 " , " ecat_mailbox.eoe.macfilter.filtermask2 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_macfilter_filtermasks [ 3 ] ,
{ " Mask 3 " , " ecat_mailbox.eoe.macfilter.filtermask3 " ,
2009-06-18 23:22:10 +00:00
FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_eoe_timestamp ,
{ " Time Stamp " , " ecat_mailbox.eoe.timestamp " ,
2009-06-18 23:22:10 +00:00
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe ,
{ " CoE " , " ecat_mailbox.coe " ,
2009-06-18 23:22:10 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_number ,
{ " Number " , " ecat_mailbox.coe.number " ,
2009-06-18 23:22:10 +00:00
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_type ,
2009-06-18 23:22:10 +00:00
{ " Type " , " ecat_mailbox.coe.type " ,
2014-11-14 20:12:06 +00:00
FT_UINT16 , BASE_DEC , VALS ( CANopenType ) , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoreq ,
{ " SDO Req " , " ecat_mailbox.coe.sdoreq " ,
2009-06-18 23:22:10 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsid ,
{ " Initiate Download " , " ecat_mailbox.coe.sdoccsid " ,
2009-06-18 23:22:10 +00:00
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsid_sizeind ,
{ " Size Ind. " , " ecat_mailbox.coe.sdoccsid.sizeind " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x01 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsid_expedited ,
{ " Expedited " , " ecat_mailbox.coe.sdoccsid.expedited " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x02 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsid_size0 ,
{ " Bytes " , " ecat_mailbox.coe.sdoccsid.size0 " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x04 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsid_size1 ,
{ " Bytes " , " ecat_mailbox.coe.sdoccsid.size1 " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x08 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsid_complete ,
{ " Access " , " ecat_mailbox.coe.sdoccsid.complete " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & tfs_complete ) , 0x10 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2007-10-16 14:54:51 +00:00
{ & hf_ecat_mailbox_coe_sdoccsds ,
2007-10-14 15:44:05 +00:00
{ " Download Segment " , " ecat_mailbox.coe.sdoccsds " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsds_lastseg ,
{ " Last Segment " , " ecat_mailbox.coe.sdoccsds.lastseg " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x01 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsds_size ,
{ " Size " , " ecat_mailbox.coe.sdoccsds.size " ,
2021-09-21 10:04:31 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0E ,
2009-08-15 11:21:36 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsds_toggle ,
{ " Toggle Bit " , " ecat_mailbox.coe.sdoccsds.toggle " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x10 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2007-10-16 14:54:51 +00:00
{ & hf_ecat_mailbox_coe_sdoccsiu ,
2007-10-14 15:44:05 +00:00
{ " Init Upload " , " ecat_mailbox.coe.sdoccsiu " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2013-02-10 20:52:21 +00:00
#if 0
2007-10-14 15:44:05 +00:00
{ & hf_ecat_mailbox_coe_sdoccsiu_complete ,
2021-09-21 10:04:31 +00:00
{ " Toggle Bit " , " ecat_mailbox.coe.sdoccsiu.complete " ,
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x10 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2013-02-10 20:52:21 +00:00
# endif
2007-10-16 14:54:51 +00:00
{ & hf_ecat_mailbox_coe_sdoccsus ,
2007-10-14 15:44:05 +00:00
{ " Upload Segment " , " ecat_mailbox.coe.sdoccsus " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoccsus_toggle ,
{ " Toggle Bit " , " ecat_mailbox.coe.sdoccsus_toggle " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x10 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoidx ,
2009-06-18 23:22:10 +00:00
{ " Index " , " ecat_mailbox.coe.sdoidx " ,
2007-10-14 15:44:05 +00:00
FT_UINT16 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2019-05-28 06:13:55 +00:00
{ & hf_ecat_mailbox_coe_sdoabortcode ,
{ " Abort code " , " ecat_mailbox.coe.abortcode " ,
FT_UINT32 , BASE_HEX , NULL , 0x0 ,
NULL , HFILL }
} ,
2007-10-14 15:44:05 +00:00
{ & hf_ecat_mailbox_coe_sdosub ,
{ " SubIndex " , " ecat_mailbox.coe.sdosub " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdodata ,
2009-06-18 23:22:10 +00:00
{ " Data " , " ecat_mailbox.coe.sdodata " ,
2007-10-14 15:44:05 +00:00
FT_UINT32 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdodata1 ,
2009-06-18 23:22:10 +00:00
{ " Data " , " ecat_mailbox.coe.sdodata " ,
2007-10-14 15:44:05 +00:00
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdodata2 ,
2009-06-18 23:22:10 +00:00
{ " Data " , " ecat_mailbox.coe.sdodata " ,
2007-10-14 15:44:05 +00:00
FT_UINT16 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoldata ,
2009-06-18 23:22:10 +00:00
{ " Data " , " ecat_mailbox.coe.dsoldata " ,
2007-10-14 15:44:05 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdolength ,
2009-06-18 23:22:10 +00:00
{ " Length " , " ecat_mailbox.coe.sdolength " ,
2007-10-14 15:44:05 +00:00
FT_UINT32 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2013-02-10 20:52:21 +00:00
#if 0
2007-10-14 15:44:05 +00:00
{ & hf_ecat_mailbox_coe_sdoerror ,
2009-06-18 23:22:10 +00:00
{ " SDO Error " , " ecat_mailbox.coe.sdoerror " ,
2007-10-14 15:44:05 +00:00
FT_UINT32 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
2013-02-10 20:52:21 +00:00
# endif
2007-10-14 15:44:05 +00:00
{ & hf_ecat_mailbox_coe_sdores ,
2009-06-18 23:22:10 +00:00
{ " SDO Res " , " ecat_mailbox.coe.sdores " ,
2007-10-14 15:44:05 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsiu ,
{ " Initiate Upload Response " , " ecat_mailbox.coe.sdoscsiu " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsiu_sizeind ,
{ " Size Ind. " , " ecat_mailbox.coe.sdoscsiu_sizeind " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x01 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsiu_expedited ,
{ " Expedited " , " ecat_mailbox.coe.sdoscsiu_expedited " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x02 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsiu_size0 ,
{ " Bytes " , " ecat_mailbox.coe.sdoscsiu_size0 " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x04 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsiu_size1 ,
{ " Bytes " , " ecat_mailbox.coe.sdoscsiu_size1 " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x08 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsiu_complete ,
{ " Access " , " ecat_mailbox.coe.sdoscsiu_complete " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & tfs_complete ) , 0x10 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsds ,
{ " Download Segment Response " , " ecat_mailbox.coe.sdoscsds " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsds_toggle ,
{ " Toggle Bit " , " ecat_mailbox.coe.sdoscsds_toggle " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x10 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsus ,
{ " Upload Segment " , " ecat_mailbox.coe.sdoscsus " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsus_lastseg ,
{ " Last Segment " , " ecat_mailbox.coe.sdoscsus_lastseg " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x01 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsus_bytes ,
{ " Bytes " , " ecat_mailbox.coe.sdoscsus_bytes " ,
2021-09-21 10:04:31 +00:00
FT_UINT8 , BASE_DEC , NULL , 0x0E ,
2009-08-15 11:21:36 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoscsus_toggle ,
{ " Toggle Bit " , " ecat_mailbox.coe.sdoscsus_toggle " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 8 , TFS ( & flags_set_truth ) , 0x10 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfoopcode ,
2009-06-18 23:22:10 +00:00
{ " Info OpCode " , " ecat_mailbox.coe.sdoinfoopcode " ,
2014-11-14 20:12:06 +00:00
FT_UINT8 , BASE_DEC , VALS ( CANopenSdoInfo ) , 0x0 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfofrag ,
2009-06-18 23:22:10 +00:00
{ " Info Frag Left " , " ecat_mailbox.coe.sdoinfofrag " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfolisttype ,
2009-06-18 23:22:10 +00:00
{ " Info List Type " , " ecat_mailbox.coe.sdoinfolisttype " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfolist ,
2009-06-18 23:22:10 +00:00
{ " Info List " , " ecat_mailbox.coe.sdoinfolist " ,
FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfoindex ,
2009-06-18 23:22:10 +00:00
{ " Info Obj Index " , " ecat_mailbox.coe.sdoinfoindex " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfosubindex ,
2009-06-18 23:22:10 +00:00
{ " Info Obj SubIdx " , " ecat_mailbox.coe.sdoinfosubindex " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfovalueinfo ,
2015-10-29 12:53:26 +00:00
{ " Info Obj ValueInfo " , " ecat_mailbox.coe.sdoinfovalueinfo " ,
2009-06-18 23:22:10 +00:00
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfoerrorcode ,
2009-06-18 23:22:10 +00:00
{ " Info Error Code " , " ecat_mailbox.coe.sdoinfoerrorcode " ,
FT_UINT32 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfodatatype ,
2009-06-18 23:22:10 +00:00
{ " Info Data Type " , " ecat_mailbox.coe.sdoinfodatatype " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfomaxsub ,
2009-06-18 23:22:10 +00:00
{ " Info Max SubIdx " , " ecat_mailbox.coe.sdoinfomaxsub " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfoobjcode ,
2009-06-18 23:22:10 +00:00
{ " Info Obj Code " , " ecat_mailbox.coe.sdoinfoobjcode " ,
FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfoname ,
2009-06-18 23:22:10 +00:00
{ " Info Name " , " ecat_mailbox.coe.sdoinfoname " ,
FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfobitlen ,
2009-06-18 23:22:10 +00:00
{ " Info Bit Len " , " ecat_mailbox.coe.sdoinfobitlen " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfoobjaccess ,
2009-06-18 23:22:10 +00:00
{ " Info Obj Access " , " ecat_mailbox.coe.sdoinfoobjaccess " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfounittype ,
2009-06-18 23:22:10 +00:00
{ " Info Data Type " , " ecat_mailbox.coe.sdoinfounittype " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfodefaultvalue ,
{ " Info Default Val " , " ecat_mailbox.coe.sdoinfodefaultvalue " ,
2009-06-18 23:22:10 +00:00
FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfominvalue ,
2009-06-18 23:22:10 +00:00
{ " Info Min Val " , " ecat_mailbox.coe.sdoinfominvalue " ,
FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_coe_sdoinfomaxvalue ,
2009-06-18 23:22:10 +00:00
{ " Info Max Val " , " ecat_mailbox.coe.sdoinfomaxvalue " ,
FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL } ,
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailboxdata ,
{ " MB Data " , " ecat_mailbox.data " ,
2009-06-18 23:22:10 +00:00
FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe ,
{ " Foe " , " ecat_mailbox.foe " ,
2009-06-18 23:22:10 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_opmode ,
2009-06-18 23:22:10 +00:00
{ " Foe OpMode " , " ecat_mailbox.foe_opmode " ,
2007-10-14 15:44:05 +00:00
FT_UINT8 , BASE_HEX , VALS ( FoEOpMode ) , 0x0 , " Op modes " , HFILL }
} ,
{ & hf_ecat_mailbox_foe_filelength ,
2022-02-04 11:21:51 +00:00
{ " Foe FileLength " , " ecat_mailbox.foe_filelength " ,
2009-06-18 23:22:10 +00:00
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_filename ,
2009-06-18 23:22:10 +00:00
{ " Foe FileName " , " ecat_mailbox.foe_filename " ,
FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_packetno ,
2009-06-18 23:22:10 +00:00
{ " Foe PacketNo " , " ecat_mailbox.foe_packetno " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_errcode ,
2009-06-18 23:22:10 +00:00
{ " Foe ErrorCode " , " ecat_mailbox.foe_errcode " ,
FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_errtext ,
{ " Foe ErrorString " , " ecat_mailbox.foe_errtext " ,
2009-06-18 23:22:10 +00:00
FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_busydone ,
2009-06-18 23:22:10 +00:00
{ " Foe BusyDone " , " ecat_mailbox.foe_busydone " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_busyentire ,
2009-06-18 23:22:10 +00:00
{ " Foe BusyEntire " , " ecat_mailbox.foe_busyentire " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_data ,
2009-06-18 23:22:10 +00:00
{ " Foe Data " , " ecat_mailbox.foe_busydata " ,
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_efw ,
{ " Firmware " , " ecat_mailbox.foe.efw " ,
2009-06-18 23:22:10 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_efw_cmd ,
2009-06-18 23:22:10 +00:00
{ " Cmd " , " ecat_mailbox.foe.efw.cmd " ,
FT_UINT16 , BASE_HEX , VALS ( FoEEfwCmd ) , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_efw_size ,
2009-06-18 23:22:10 +00:00
{ " Size " , " ecat_mailbox.foe.efw.size " ,
FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_efw_addresslw ,
{ " AddressLW " , " ecat_mailbox.foe.efw.addresslw " ,
2009-06-18 23:22:10 +00:00
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_efw_addresshw ,
{ " AddressHW " , " ecat_mailbox.foe.efw.addresshw " ,
2009-06-18 23:22:10 +00:00
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_foe_efw_data ,
2009-06-18 23:22:10 +00:00
{ " Data " , " ecat_mailbox.foe.efw.data " ,
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe ,
{ " Soe " , " ecat_mailbox.soe " ,
2009-06-18 23:22:10 +00:00
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header ,
2009-06-18 23:22:10 +00:00
{ " Soe Header " , " ecat_mailbox.soe_header " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_opcode ,
{ " SoE OpCode " , " ecat_mailbox.soe_opcode " ,
2021-07-11 12:19:10 +00:00
FT_UINT16 , BASE_DEC , VALS ( SoeOpcode ) , 0x0007 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_incomplete ,
{ " More Follows... " , " ecat_mailbox.soe_header_incomplete " ,
2021-07-11 12:19:10 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x0008 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_error ,
{ " Error " , " ecat_mailbox.soe_header_error " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x0010 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_driveno ,
{ " Drive No " , " ecat_mailbox.soe_header_driveno " ,
2021-07-11 12:19:10 +00:00
FT_UINT16 , BASE_DEC , NULL , 0x00e0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_datastate ,
{ " Datastate " , " ecat_mailbox.soe_header_datastate " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x0100 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_name ,
{ " Name " , " ecat_mailbox.soe_header_name " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x0200 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_attribute ,
{ " Attribute " , " ecat_mailbox.soe_header_attribute " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x0400 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_unit ,
{ " Unit " , " ecat_mailbox.soe_header_unit " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x0800 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_min ,
{ " Min " , " ecat_mailbox.soe_header_min " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x1000 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_max ,
{ " Max " , " ecat_mailbox.soe_header_max " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x2000 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_value ,
{ " Value " , " ecat_mailbox.soe_header_value " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x4000 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_header_reserved ,
{ " Reserved " , " ecat_mailbox.soe_header_reserved " ,
2021-09-21 10:04:31 +00:00
FT_BOOLEAN , 16 , TFS ( & flags_set_truth ) , 0x8000 ,
2009-06-18 23:22:10 +00:00
NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_idn ,
2009-06-18 23:22:10 +00:00
{ " SoE IDN " , " ecat_mailbox.soe_idn " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_data ,
2009-06-18 23:22:10 +00:00
{ " SoE Data " , " ecat_mailbox.soe_data " ,
FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_frag ,
2009-06-18 23:22:10 +00:00
{ " SoE FragLeft " , " ecat_mailbox.soe_frag " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
} ,
{ & hf_ecat_mailbox_soe_error ,
2009-06-18 23:22:10 +00:00
{ " SoE Error " , " ecat_mailbox.soe_error " ,
FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
2007-10-14 15:44:05 +00:00
}
} ;
static gint * ett [ ] =
{
& ett_ecat_mailbox ,
& ett_ecat_mailbox_eoe ,
& ett_ecat_mailbox_eoe_init ,
& ett_ecat_mailbox_eoe_macfilter ,
& ett_ecat_mailbox_eoe_macfilter_filter ,
& ett_ecat_mailbox_eoe_macfilter_filtermask ,
& ett_ecat_mailbox_coe ,
& ett_ecat_mailbox_sdo ,
& ett_ecat_mailbox_coe_sdoccs ,
& ett_ecat_mailbox_coe_sdoscs ,
& ett_ecat_mailbox_foe ,
& ett_ecat_mailbox_foe_efw ,
& ett_ecat_mailbox_soeflag ,
2007-10-16 14:54:51 +00:00
& ett_ecat_mailbox_soe ,
2008-03-05 20:42:58 +00:00
& ett_ecat_mailbox_fraghead ,
& ett_ecat_mailbox_header
2007-10-14 15:44:05 +00:00
} ;
2016-01-29 08:13:13 +00:00
static ei_register_info ei [ ] =
{
{ & ei_ecat_mailbox_error , { " ecat_mailbox.invalid " , PI_MALFORMED , PI_ERROR , " Malformed mailbox data " , EXPFILL } } ,
{ & ei_ecat_mailbox_coe_error , { " ecat_mailbox.coe.invalid " , PI_MALFORMED , PI_ERROR , " Malformed CoE data " , EXPFILL } } ,
{ & ei_ecat_mailbox_foe_error , { " ecat_mailbox.foe.invalid " , PI_MALFORMED , PI_ERROR , " Malformed FoE data " , EXPFILL } } ,
{ & ei_ecat_mailbox_soe_error , { " ecat_mailbox.soe.invalid " , PI_MALFORMED , PI_ERROR , " Malformed SoE data " , EXPFILL } } ,
{ & ei_ecat_mailbox_eoe_error , { " ecat_mailbox.eoe.invalid " , PI_MALFORMED , PI_ERROR , " Malformed EoE data " , EXPFILL } } ,
} ;
expert_module_t * expert_module ;
2007-10-14 15:44:05 +00:00
proto_ecat_mailbox = proto_register_protocol ( " EtherCAT Mailbox Protocol " ,
2008-03-05 20:42:58 +00:00
" ECAT_MAILBOX " , " ecat_mailbox " ) ;
2016-01-29 08:13:13 +00:00
expert_module = expert_register_protocol ( proto_ecat_mailbox ) ;
expert_register_field_array ( expert_module , ei , array_length ( ei ) ) ;
2008-03-05 20:42:58 +00:00
proto_register_field_array ( proto_ecat_mailbox , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
2007-10-14 15:44:05 +00:00
2016-12-17 01:06:11 +00:00
ecat_mailbox_handle = register_dissector ( " ecat_mailbox " , dissect_ecat_mailbox , proto_ecat_mailbox ) ;
2007-10-14 15:44:05 +00:00
}
void proto_reg_handoff_ecat_mailbox ( void )
{
/* Register this dissector as a sub dissector to E88A4 based on ether type. */
2010-12-20 05:35:29 +00:00
dissector_add_uint ( " ecatf.type " , 5 , ecat_mailbox_handle ) ;
2007-10-14 15:44:05 +00:00
2016-03-16 13:02:52 +00:00
eth_handle = find_dissector_add_dependency ( " eth_withoutfcs " , proto_ecat_mailbox ) ;
ams_handle = find_dissector_add_dependency ( " ams " , proto_ecat_mailbox ) ;
2007-10-14 15:44:05 +00:00
}
2014-10-06 01:34:19 +00:00
/*
2019-07-26 18:43:17 +00:00
* Editor modelines - https : //www.wireshark.org/tools/modelines.html
2014-10-06 01:34:19 +00:00
*
* Local Variables :
* c - basic - offset : 3
* tab - width : 8
* indent - tabs - mode : nil
* End :
*
* ex : set shiftwidth = 3 tabstop = 8 expandtab :
* : indentSize = 3 : tabSize = 8 : noTabs = true :
*/