Create/use two extended value-strings;

Comment out an unused variable definition;
Do some whitespace changes & several other minor changes;
Add editor modelines.

svn path=/trunk/; revision=53578
This commit is contained in:
Bill Meier 2013-11-25 20:04:25 +00:00
parent 21c772c7ed
commit 1516e5f9d9
1 changed files with 122 additions and 105 deletions

View File

@ -560,8 +560,6 @@ static const value_string siii_mdt_idn_text[]=
{IDN(0,0,0,0,1024), "SERCOS III: Ring control - node control"}, {IDN(0,0,0,0,1024), "SERCOS III: Ring control - node control"},
{IDN(0,0,0,0,1025), "SERCOS III: Ring status - node status"}, {IDN(0,0,0,0,1025), "SERCOS III: Ring status - node status"},
{IDN(0,0,0,0,1026), "SERCOS III: Hardware identification"}, {IDN(0,0,0,0,1026), "SERCOS III: Hardware identification"},
{IDN(1,0,0,0,1027), "Requested MTU"},
{IDN(2,0,0,0,1027), "Effective MTU"},
{IDN(0,0,0,0,1028), "SERCOS III: Error counter MDT0 MST"}, {IDN(0,0,0,0,1028), "SERCOS III: Error counter MDT0 MST"},
{IDN(0,0,0,0,1029), "SERCOS III: Error counter MDT0-3"}, {IDN(0,0,0,0,1029), "SERCOS III: Error counter MDT0-3"},
{IDN(0,0,0,0,1030), "SERCOS III: Error counter AT0-3"}, {IDN(0,0,0,0,1030), "SERCOS III: Error counter AT0-3"},
@ -574,8 +572,11 @@ static const value_string siii_mdt_idn_text[]=
{IDN(0,0,0,0,1046), "IDN-list of SERCOS addresses in device"}, {IDN(0,0,0,0,1046), "IDN-list of SERCOS addresses in device"},
{IDN(0,0,0,0,1134), "SERCOS III: Device control"}, {IDN(0,0,0,0,1134), "SERCOS III: Device control"},
{IDN(0,0,0,0,1135), "SERCOS III: Device status"}, {IDN(0,0,0,0,1135), "SERCOS III: Device status"},
{IDN(1,0,0,0,1027), "Requested MTU"},
{IDN(2,0,0,0,1027), "Effective MTU"},
{0, NULL} {0, NULL}
}; };
static value_string_ext siii_mdt_idn_text_ext = VALUE_STRING_EXT_INIT(siii_mdt_idn_text);
static const value_string siii_mdt_svch_dbe_text[]= static const value_string siii_mdt_svch_dbe_text[]=
{ {
@ -743,6 +744,8 @@ static const value_string siii_mdt_hotplug_control_functioncode_text[]=
{0x83, "AT-RTD pointer"}, {0x83, "AT-RTD pointer"},
{0, NULL} {0, NULL}
}; };
static value_string_ext siii_mdt_hotplug_control_functioncode_text_ext =
VALUE_STRING_EXT_INIT(siii_mdt_hotplug_control_functioncode_text);
static const value_string siii_mdt_hotplug_control_svc_switch_text[]= static const value_string siii_mdt_hotplug_control_svc_switch_text[]=
{ {
@ -867,6 +870,7 @@ static void dissect_siii_mdt_cp0(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
{ {
proto_item *ti; proto_item *ti;
proto_tree *subtree; proto_tree *subtree;
ti = proto_tree_add_item(tree, hf_siii_mdt_version, tvb, 0, 4, ENC_LITTLE_ENDIAN); ti = proto_tree_add_item(tree, hf_siii_mdt_version, tvb, 0, 4, ENC_LITTLE_ENDIAN);
subtree = proto_item_add_subtree(ti, ett_siii_mdt_version); subtree = proto_item_add_subtree(ti, ett_siii_mdt_version);
@ -913,7 +917,7 @@ static void dissect_siii_mdt_cp1_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree
static void dissect_siii_mdt_cp3_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint telno) static void dissect_siii_mdt_cp3_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint telno)
{ {
guint devstart _U_ = telno * SERCOS_SLAVE_GROUP_SIZE; /* guint devstart _U_ = telno * SERCOS_SLAVE_GROUP_SIZE; */
if (0 == telno) /* dissect hotplug field in MDT0 only */ if (0 == telno) /* dissect hotplug field in MDT0 only */
dissect_siii_mdt_hp(tvb, pinfo, tree); dissect_siii_mdt_hp(tvb, pinfo, tree);
@ -1040,10 +1044,10 @@ static void dissect_siii_at_cp0(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
guint16 seqcnt; /* sequence counter */ guint16 seqcnt; /* sequence counter */
guint16 tfield; /* topology field for sercos addresses */ guint16 tfield; /* topology field for sercos addresses */
guint16 i; guint16 i;
char devices[]="Recognized Devices"; /* fixme: it would be nice to have this as subtree */
static char outbuf[200]; static char outbuf[200];
proto_tree_add_text(tree, tvb, 0, 1024, "%s", devices); /* fixme: it would be nice to have this as subtree */
proto_tree_add_text(tree, tvb, 0, 1024, "Recognized Devices");
/* check sequence count field */ /* check sequence count field */
seqcnt = tvb_get_letohs(tvb, 0); seqcnt = tvb_get_letohs(tvb, 0);
@ -1078,7 +1082,7 @@ static void dissect_siii_at_cp1_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree
guint idx; guint idx;
proto_item* ti; /* temporary item */ proto_item *ti;
proto_tree *subtree; proto_tree *subtree;
proto_tree *subtree_svc; proto_tree *subtree_svc;
proto_tree *subtree_devstat; proto_tree *subtree_devstat;
@ -1120,7 +1124,7 @@ static void dissect_siii_at_cp3_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree
void dissect_siii_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void dissect_siii_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
proto_item* ti; /* temporary item */ proto_item *ti;
proto_tree *subtree; proto_tree *subtree;
tvbuff_t *tvb_n; tvbuff_t *tvb_n;
@ -1340,7 +1344,7 @@ proto_register_sercosiii(void)
}, },
{ &hf_siii_mdt_svch_idn, { &hf_siii_mdt_svch_idn,
{"IDN", "siii.mdt.svch.idn", {"IDN", "siii.mdt.svch.idn",
FT_UINT32, BASE_HEX, VALS(siii_mdt_idn_text), 0, FT_UINT32, BASE_HEX | BASE_EXT_STRING, &siii_mdt_idn_text_ext, 0,
NULL, HFILL } NULL, HFILL }
}, },
{ &hf_siii_mdt_svch_dbe, { &hf_siii_mdt_svch_dbe,
@ -1486,7 +1490,7 @@ proto_register_sercosiii(void)
}, },
{ &hf_siii_mdt_hotplug_control_param, { &hf_siii_mdt_hotplug_control_param,
{"Parameter", "siii.mdt.hp.parameter", {"Parameter", "siii.mdt.hp.parameter",
FT_UINT16, BASE_DEC, VALS(siii_mdt_hotplug_control_functioncode_text), 0xFF, FT_UINT16, BASE_DEC | BASE_EXT_STRING, &siii_mdt_hotplug_control_functioncode_text_ext, 0xFF,
NULL, HFILL } NULL, HFILL }
}, },
{ &hf_siii_mdt_hotplug_control_svc_switch, { &hf_siii_mdt_hotplug_control_svc_switch,
@ -1575,3 +1579,16 @@ proto_reg_handoff_sercosiii(void)
siii_handle = create_dissector_handle(dissect_siii, proto_siii); siii_handle = create_dissector_handle(dissect_siii, proto_siii);
dissector_add_uint("ethertype", ETHERTYPE_SERCOS, siii_handle); dissector_add_uint("ethertype", ETHERTYPE_SERCOS, siii_handle);
} }
/*
* Editor modelines
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/