aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/ethercat
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-11-14 15:12:06 -0500
committerAnders Broman <a.broman58@gmail.com>2014-11-17 07:40:20 +0000
commitbea106c79f9491ae9c4b06d0da6d7a2de8c30716 (patch)
tree56987ed9963b2833d84fe1721a56b17cf3b9ac84 /plugins/ethercat
parentf3f833ccecce0e8611b2f1990d0fcf81959fcb78 (diff)
Eliminate proto_tree_add_text
Also some other cleanup to simplify dissector logic. Change-Id: Ia84300b7eadafe292361014dd0e565ec250cae44 Reviewed-on: https://code.wireshark.org/review/5311 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'plugins/ethercat')
-rw-r--r--plugins/ethercat/packet-ecatmb.c308
1 files changed, 101 insertions, 207 deletions
diff --git a/plugins/ethercat/packet-ecatmb.c b/plugins/ethercat/packet-ecatmb.c
index 0053f9aaa1..24ed0e448f 100644
--- a/plugins/ethercat/packet-ecatmb.c
+++ b/plugins/ethercat/packet-ecatmb.c
@@ -65,6 +65,9 @@ static int ett_ecat_mailbox_header = -1;
static int hf_ecat_mailboxlength = -1;
static int hf_ecat_mailboxaddress = -1;
+static int hf_ecat_mailboxpriority = -1;
+static int hf_ecat_mailboxtype = -1;
+static int hf_ecat_mailboxcounter = -1;
static int hf_ecat_mailbox_eoe = -1;
static int hf_ecat_mailbox_eoe_fraghead = -1;
static int hf_ecat_mailbox_eoe_type = -1;
@@ -247,11 +250,51 @@ static const value_string SoeOpcode[] =
{ 0, NULL }
};
+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" },
+ { 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 }
+};
+
static const true_false_string tfs_complete =
{
"Complete", "Legacy"
};
+static const true_false_string tfs_ecat_yes_no =
+{
+ "Yes", "No"
+};
+
void init_mbx_header(PETHERCAT_MBOX_HEADER pMbox, tvbuff_t *tvb, gint offset)
{
pMbox->Length = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16);
@@ -299,111 +342,6 @@ static void init_sdo_info_header(PETHERCAT_SDO_INFO_HEADER pInfo, tvbuff_t *tvb,
pInfo->FragmentsLeft = (int)sizeof(guint16);
}
-
-static void MailboxTypeFormatter(PETHERCAT_MBOX_HEADER pMbx, char *szText, gint nMax)
-{
- guint32 i;
-
- for(i = 0; i<sizeof(EcMBoxType)/sizeof(value_string); i++ )
- {
- if( EcMBoxType[i].value == pMbx->aControlUnion.v.Type )
- {
- g_snprintf(szText, nMax, "Type : %s (0x%x)", EcMBoxType[i].strptr, pMbx->aControlUnion.v.Type);
- return;
- }
- }
- g_snprintf ( szText, nMax,"Type : %d", pMbx->aControlUnion.v.Type);
-}
-
-static void EoETypeFormatter(PETHERCAT_EOE_HEADER pEoE, char *szText, gint nMax)
-{
- switch (pEoE->anEoeHeaderInfoUnion.v.Type)
- {
- case EOE_TYPE_FRAME_FRAG:
- g_snprintf ( szText, nMax, "Type(%d) : Fragment", pEoE->anEoeHeaderInfoUnion.v.Type);
- break;
- case EOE_TYPE_TIMESTAMP_RES:
- g_snprintf ( szText, nMax, "Type(%d) : TimeStamp", pEoE->anEoeHeaderInfoUnion.v.Type);
- break;
- case EOE_TYPE_INIT_REQ:
- g_snprintf ( szText, nMax, "Type(%d) : Init Req", pEoE->anEoeHeaderInfoUnion.v.Type);
- break;
- case EOE_TYPE_INIT_RES:
- g_snprintf ( szText, nMax, "Type(%d) : Init Res", pEoE->anEoeHeaderInfoUnion.v.Type);
- break;
- case EOE_TYPE_MACFILTER_REQ:
- g_snprintf ( szText, nMax, "Type(%d) : MAC Req", pEoE->anEoeHeaderInfoUnion.v.Type);
- break;
- case EOE_TYPE_MACFILTER_RES:
- g_snprintf ( szText, nMax, "Type(%d) : MAC Res", pEoE->anEoeHeaderInfoUnion.v.Type);
- break;
- default:
- g_snprintf ( szText, nMax, "Type(%d) : Unknown", pEoE->anEoeHeaderInfoUnion.v.Type);
- break;
- }
-}
-
-static void EoEFragNoFormatter(PETHERCAT_EOE_HEADER pEoE, char *szText, gint nMax)
-{
- g_snprintf ( szText, nMax, "FragNo : %d", pEoE->anEoeHeaderDataUnion.v.Fragment);
-}
-
-static void EoEOffsetFormatter(PETHERCAT_EOE_HEADER pEoE, char *szText, gint nMax)
-{
- if ( pEoE->anEoeHeaderDataUnion.v.Fragment == 0 )
- g_snprintf ( szText, nMax, "BufferSize : %d", 32*pEoE->anEoeHeaderDataUnion.v.OffsetBuffer);
- else
- g_snprintf ( szText, nMax, "Offset : %d", 32*pEoE->anEoeHeaderDataUnion.v.OffsetBuffer);
-}
-
-static void EoEFrameFormatter(PETHERCAT_EOE_HEADER pEoE, char *szText, gint nMax)
-{
- g_snprintf ( szText, nMax, "FrameNo : %d", pEoE->anEoeHeaderDataUnion.v.FrameNo);
-}
-
-static void EoELastFormatter(PETHERCAT_EOE_HEADER pEoE, char *szText, gint nMax)
-{
- if ( pEoE->anEoeHeaderInfoUnion.v.LastFragment != 0 )
- g_snprintf ( szText, nMax, "Last Frag");
- else
- g_snprintf ( szText, nMax, "More Frags...");
-}
-
-static void CANopenNumberFormatter(PETHERCAT_COE_HEADER pCoE, char *szText, gint nMax)
-{
- g_snprintf( szText, nMax, "Number : %d", pCoE->v.Number);
-}
-
-static void CANopenTypeFormatter(PETHERCAT_COE_HEADER pCoE, char *szText, gint nMax)
-{
- switch ( pCoE->v.Type)
- {
- case ETHERCAT_COE_TYPE_EMERGENCY:
- g_snprintf ( szText, nMax, "Type : EMERGENCY(%d)", pCoE->v.Type);
- break;
- case ETHERCAT_COE_TYPE_SDOREQ:
- g_snprintf ( szText, nMax, "Type : SDO Req(%d)", pCoE->v.Type);
- break;
- case ETHERCAT_COE_TYPE_SDORES:
- g_snprintf ( szText, nMax, "Type : SDO Res(%d)", pCoE->v.Type);
- break;
- case ETHERCAT_COE_TYPE_TXPDO:
- g_snprintf ( szText, nMax, "Type : TxPDO(%d)", pCoE->v.Type);
- break;
- case ETHERCAT_COE_TYPE_RXPDO:
- g_snprintf ( szText, nMax, "Type : RxPDO(%d)", pCoE->v.Type);
- break;
- case ETHERCAT_COE_TYPE_TXPDO_RTR:
- g_snprintf ( szText, nMax, "Type : TxPDO_RTR(%d)", pCoE->v.Type);
- break;
- case ETHERCAT_COE_TYPE_RXPDO_RTR:
- g_snprintf ( szText, nMax, "Type : RxPDO_RTR(%d)", pCoE->v.Type);
- break;
- default:
- g_snprintf ( szText, nMax, "Type :%d", pCoE->v.Type);
- }
-}
-
static void CANopenSdoReqFormatter(PETHERCAT_SDO_HEADER pSdo, char *szText, gint nMax)
{
switch ( pSdo->anSdoHeaderUnion.Idq.Ccs )
@@ -428,45 +366,6 @@ static void CANopenSdoReqFormatter(PETHERCAT_SDO_HEADER pSdo, char *szText, gint
}
}
-static void CANopenSdoResFormatter(PETHERCAT_SDO_HEADER pSdo, char *szText, gint nMax)
-{
- g_snprintf ( szText, nMax, "SDO Res : Scs %d", pSdo->anSdoHeaderUnion.Ids.Scs);
-}
-
-static void CANopenSdoInfoFormatter(PETHERCAT_SDO_INFO_HEADER pHead, char *szText, gint nMax)
-{
- guint8 opCode = pHead->anSdoControlUnion.v.OpCode & 0x7F;
- const char* txt2 = "";
- if ( (pHead->anSdoControlUnion.v.OpCode & 0x80) != 0 )
- txt2 = " - More Follows";
- switch (opCode)
- {
- case ECAT_COE_INFO_OPCODE_LIST_Q:
- g_snprintf ( szText, nMax, "CoE SDO Info, OpCode: 'List Req' %s", txt2);
- break;
- case ECAT_COE_INFO_OPCODE_LIST_S:
- g_snprintf ( szText, nMax, "CoE SDO Info, OpCode: 'List Res' %s", txt2);
- break;
- case ECAT_COE_INFO_OPCODE_OBJ_Q:
- g_snprintf ( szText, nMax, "CoE SDO Info, OpCode: 'Obj Req' %s", txt2);
- break;
- case ECAT_COE_INFO_OPCODE_OBJ_S:
- g_snprintf ( szText, nMax, "CoE SDO Info, OpCode: 'Obj Res' %s", txt2);
- break;
- case ECAT_COE_INFO_OPCODE_ENTRY_Q:
- g_snprintf ( szText, nMax, "CoE SDO Info, OpCode: 'Entry Req' %s", txt2);
- break;
- case ECAT_COE_INFO_OPCODE_ENTRY_S:
- g_snprintf ( szText, nMax, "CoE SDO Info, OpCode: 'Entry Res' %s", txt2);
- break;
- case ECAT_COE_INFO_OPCODE_ERROR_S:
- g_snprintf ( szText, nMax, "CoE SDO Info, OpCode: 'Error Res' %s", txt2);
- break;
- default:
- g_snprintf ( szText, nMax, "CoE SDO Info, OpCode: %d %s", opCode, txt2);
- }
-}
-
static void FoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, guint foe_length)
{
ETHERCAT_FOE_HEADER foe;
@@ -594,8 +493,7 @@ static void dissect_ecat_coe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
if( tree )
{
- anItem = proto_tree_add_item(tree, hf_ecat_mailbox_coe, tvb, offset, coe_length, ENC_NA);
- proto_item_set_text(anItem,"CoE");
+ anItem = proto_tree_add_bytes_format(tree, hf_ecat_mailbox_coe, tvb, offset, coe_length, NULL, "CoE");
aparent = proto_item_get_parent(anItem);
proto_item_append_text(aparent,":CoE ");
}
@@ -610,13 +508,8 @@ static void dissect_ecat_coe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
{
ecat_coe_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_coe);
- CANopenNumberFormatter(&coe, szText, nMax);
- anItem = proto_tree_add_uint(ecat_coe_tree, hf_ecat_mailbox_coe_number, tvb, offset, ETHERCAT_COE_HEADER_LEN, coe.v.Number);
- proto_item_set_text(anItem, "%s", szText);
-
- CANopenTypeFormatter(&coe, szText, nMax);
- anItem = proto_tree_add_uint(ecat_coe_tree, hf_ecat_mailbox_coe_type, tvb, offset, ETHERCAT_COE_HEADER_LEN, coe.v.Type);
- proto_item_set_text(anItem, "%s", szText);
+ 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);
}
offset += ETHERCAT_COE_HEADER_LEN;
@@ -724,13 +617,11 @@ static void dissect_ecat_coe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
init_sdo_header(&sdo, tvb, offset);
- CANopenSdoResFormatter(&sdo, szText, nMax);
- col_append_str(pinfo->cinfo, COL_INFO, szText);
-
+ col_append_fstr(pinfo->cinfo, COL_INFO, "SDO Res: Scs %d", sdo.anSdoHeaderUnion.Ids.Scs);
if( tree )
{
- anItem = proto_tree_add_uint(ecat_coe_tree, hf_ecat_mailbox_coe_sdores, tvb, offset, 1, sdo.anSdoHeaderUnion.Ids.Scs);
- proto_item_set_text(anItem, "%s", szText);
+ 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);
ecat_sdo_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_sdo);
switch ( sdo.anSdoHeaderUnion.Ids.Scs )
@@ -802,8 +693,9 @@ static void dissect_ecat_coe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
memset(&info, 0x0, sizeof(info));
init_sdo_info_header(&info, tvb, offset);
- CANopenSdoInfoFormatter(&info, szText, nMax);
- col_append_str(pinfo->cinfo, COL_INFO, szText);
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str(info.anSdoControlUnion.v.OpCode & 0x7F, CANopenSdoInfo, "%d (Unknown)"));
+ if ( (info.anSdoControlUnion.v.OpCode & 0x80) != 0 )
+ col_append_str(pinfo->cinfo, COL_INFO, " - More Follows");
if( tree )
{
@@ -1011,16 +903,13 @@ static void dissect_ecat_eoe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
*ecat_eoe_macfilter_filter_tree;
tvbuff_t *next_tvb;
proto_item *anItem = NULL, *aparent = NULL;
- char szText[200];
- int nMax = sizeof(szText)-1;
int nCnt;
guint eoe_length = tvb_reported_length(tvb)-offset;
if( tree )
{
- anItem = proto_tree_add_item(tree, hf_ecat_mailbox_eoe, tvb, offset, eoe_length, ENC_NA);
- proto_item_set_text(anItem, "EoE Fragment");
+ anItem = proto_tree_add_bytes_format(tree, hf_ecat_mailbox_eoe, tvb, offset, eoe_length, NULL, "EoE Fragment");
aparent = proto_item_get_parent(anItem);
proto_item_append_text(aparent,":EoE ");
@@ -1031,51 +920,45 @@ static void dissect_ecat_eoe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
ETHERCAT_EOE_HEADER eoe;
init_eoe_header(&eoe, tvb, offset);
if ( eoe.anEoeHeaderInfoUnion.v.Type == EOE_TYPE_FRAME_FRAG )
- g_snprintf ( szText, nMax, "EoE-Frag %d", eoe.anEoeHeaderDataUnion.v.Fragment);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "EoE-Frag %d", eoe.anEoeHeaderDataUnion.v.Fragment);
else
- g_snprintf ( szText, nMax, "EoE");
- col_append_str(pinfo->cinfo, COL_INFO, szText);
+ col_append_str(pinfo->cinfo, COL_INFO, "EoE");
{ /* Do the following even 'if (tree == NULL)' since a call_dissector() is done */
ecat_eoe_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_eoe);
anItem = proto_tree_add_item(ecat_eoe_tree, hf_ecat_mailbox_eoe_fraghead, tvb, offset, 4, ENC_NA);
- proto_item_set_text(anItem, "Header");
ecat_fraghead_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_fraghead);
- anItem = proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_type, tvb, offset, 4, eoe.anEoeHeaderInfoUnion.v.Type);
- EoETypeFormatter(&eoe, szText, nMax);
- proto_item_set_text(anItem, "%s", szText);
+ proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_type, tvb, offset, 4, eoe.anEoeHeaderInfoUnion.v.Type);
switch ( eoe.anEoeHeaderInfoUnion.v.Type )
{
case EOE_TYPE_FRAME_FRAG:
- anItem = proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_fragno, tvb, offset, 4, eoe.anEoeHeaderDataUnion.v.Fragment);
- EoEFragNoFormatter(&eoe, szText, nMax);
- proto_item_set_text(anItem, "%s", szText);
+ proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_fragno, tvb, offset, 4, eoe.anEoeHeaderDataUnion.v.Fragment);
- anItem = proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_offset, tvb, offset, 4, 32*eoe.anEoeHeaderDataUnion.v.OffsetBuffer);
- EoEOffsetFormatter(&eoe, szText, nMax);
- proto_item_set_text(anItem, "%s", szText);
+ 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);
+ }
- anItem = proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_frame, tvb, offset, 4, eoe.anEoeHeaderDataUnion.v.FrameNo);
- EoEFrameFormatter(&eoe, szText, nMax);
- proto_item_set_text(anItem, "%s", szText);
+ proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_frame, tvb, offset, 4, eoe.anEoeHeaderDataUnion.v.FrameNo);
- anItem = proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_last, tvb, offset, 4, eoe.anEoeHeaderInfoUnion.v.LastFragment);
- EoELastFormatter(&eoe, szText, nMax);
- proto_item_set_text(anItem, "%s", szText);
+ proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_last, tvb, offset, 4, eoe.anEoeHeaderInfoUnion.v.LastFragment);
if ( eoe.anEoeHeaderInfoUnion.v.TimeStampRequested )
{
- anItem = proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_timestampreq, tvb, offset, 4, eoe.anEoeHeaderInfoUnion.v.TimeStampRequested);
- proto_item_set_text(anItem, "Time Stamp Requested");
+ proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_timestampreq, tvb, offset, 4, eoe.anEoeHeaderInfoUnion.v.TimeStampRequested);
}
if ( eoe.anEoeHeaderInfoUnion.v.TimeStampAppended )
{
- anItem = proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_timestampapp, tvb, offset, 4, eoe.anEoeHeaderInfoUnion.v.TimeStampAppended);
- proto_item_set_text(anItem, "Time Stamp Appended");
+ proto_tree_add_uint(ecat_fraghead_tree, hf_ecat_mailbox_eoe_timestampapp, tvb, offset, 4, eoe.anEoeHeaderInfoUnion.v.TimeStampAppended);
}
offset+=ETHERCAT_EOE_HEADER_LEN;
@@ -1201,8 +1084,7 @@ static void dissect_ecat_foe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
if( tree )
{
- anItem = proto_tree_add_item(tree, hf_ecat_mailbox_foe, tvb, offset, foe_length, ENC_NA);
- proto_item_set_text(anItem, ":Foe");
+ anItem = proto_tree_add_bytes_format(tree, hf_ecat_mailbox_foe, tvb, offset, foe_length, NULL, "Foe");
aparent = proto_item_get_parent(anItem);
proto_item_append_text(aparent,"FoE ");
@@ -1293,8 +1175,6 @@ static void dissect_ecat_mailbox(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
tvbuff_t *next_tvb;
proto_item *anItem;
gint offset = 0;
- char szText[200];
- int nMax = sizeof(szText)-1;
gint mailbox_length = tvb_reported_length(tvb);
@@ -1326,15 +1206,14 @@ static void dissect_ecat_mailbox(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
offset+=(int)sizeof(hdr.Address);
/* Add priority information to the mailbox header */
- proto_tree_add_text(ecat_mailbox_header_tree, tvb, offset, 1, "Priority: %d", tvb_get_guint8(tvb, offset) & 0x3);
+ proto_tree_add_item(ecat_mailbox_header_tree, hf_ecat_mailboxpriority, tvb, offset, 1, ENC_NA);
offset+=(int)sizeof(guint8);
/* Add type information to the mailbox header */
- MailboxTypeFormatter(&hdr, szText, nMax);
- proto_tree_add_text(ecat_mailbox_header_tree, tvb, offset, 1, "%s", szText);
+ proto_tree_add_uint(ecat_mailbox_header_tree, hf_ecat_mailboxtype, tvb, offset, 1, hdr.aControlUnion.v.Type);
/* Add counter information to the mailbox header */
- proto_tree_add_text(ecat_mailbox_header_tree, tvb, offset, 1, "Counter : %d",hdr.aControlUnion.v.Counter);
+ proto_tree_add_uint(ecat_mailbox_header_tree, hf_ecat_mailboxcounter, tvb, offset, 1, hdr.aControlUnion.v.Counter);
offset++;
}
else
@@ -1392,42 +1271,57 @@ void proto_register_ecat_mailbox(void)
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
+ { &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 }
+ },
{ &hf_ecat_mailbox_eoe,
{ "EoE Fragment", "ecat_mailbox.eoe",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_ecat_mailbox_eoe_fraghead,
- { "Eoe Frag Header", "ecat_mailbox.eoe.fraghead",
+ { "Header", "ecat_mailbox.eoe.fraghead",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_ecat_mailbox_eoe_type,
- { "EoE"/*"Type*/, "ecat_mailbox.eoe.type",
- FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+ { "Type", "ecat_mailbox.eoe.type",
+ FT_UINT32, BASE_DEC, VALS(EoEType), 0x0, NULL, HFILL }
},
{ &hf_ecat_mailbox_eoe_fragno,
- { "EoE"/*"FragNo*/, "ecat_mailbox.eoe.fragno",
+ { "FragNo", "ecat_mailbox.eoe.fragno",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_ecat_mailbox_eoe_offset,
- { "EoE"/*"Offset"*/, "ecat_mailbox.eoe.offset",
+ { "Offset", "ecat_mailbox.eoe.offset",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
},
{ &hf_ecat_mailbox_eoe_frame,
- { "EoE"/*"FrameNo"*/, "ecat_mailbox.eoe.frame",
+ { "FrameNo", "ecat_mailbox.eoe.frame",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_ecat_mailbox_eoe_last,
- { "Last Fragment"/*"Last Fragment"*/, "ecat_mailbox.eoe.last",
- FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+ { "Last Fragment", "ecat_mailbox.eoe.last",
+ FT_BOOLEAN, 32, TFS(&tfs_ecat_yes_no), 0x0, NULL, HFILL }
},
{ &hf_ecat_mailbox_eoe_timestampapp,
- { "Last Fragment"/*"Last Fragment"*/, "ecat_mailbox.eoe.timestampapp",
+ { "Time Stamp Appended", "ecat_mailbox.eoe.timestampapp",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_ecat_mailbox_eoe_timestampreq,
- { "Last Fragment"/*"Last Fragment"*/, "ecat_mailbox.eoe.timestampreq",
+ { "Time Stamp Requested", "ecat_mailbox.eoe.timestampreq",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_ecat_mailbox_eoe_fragment,
@@ -1613,7 +1507,7 @@ void proto_register_ecat_mailbox(void)
},
{ &hf_ecat_mailbox_coe_type,
{ "Type", "ecat_mailbox.coe.type",
- FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
+ FT_UINT16, BASE_DEC, VALS(CANopenType), 0x0, NULL, HFILL }
},
{ &hf_ecat_mailbox_coe_sdoreq,
{ "SDO Req", "ecat_mailbox.coe.sdoreq",
@@ -1800,7 +1694,7 @@ void proto_register_ecat_mailbox(void)
},
{ &hf_ecat_mailbox_coe_sdoinfoopcode,
{ "Info OpCode", "ecat_mailbox.coe.sdoinfoopcode",
- FT_UINT8, BASE_HEX, NULL, 0x0,
+ FT_UINT8, BASE_DEC, VALS(CANopenSdoInfo), 0x0,
NULL, HFILL },
},
{ &hf_ecat_mailbox_coe_sdoinfofrag,