aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fcels.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-10-08 09:11:23 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-10-08 09:11:23 +0000
commitef5b9193cd351a584d7c6c2530b509761ee87c6a (patch)
treed67fc48e4863fe2e048b1e8cadc079de573f6bd2 /epan/dissectors/packet-fcels.c
parentf0b1d734c52f44eb6b4f347501b64b079215ce66 (diff)
one more bitfield properly dissected and some less strcpy()s
svn path=/trunk/; revision=16159
Diffstat (limited to 'epan/dissectors/packet-fcels.c')
-rw-r--r--epan/dissectors/packet-fcels.c97
1 files changed, 79 insertions, 18 deletions
diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c
index c9742a33a5..c740053897 100644
--- a/epan/dissectors/packet-fcels.c
+++ b/epan/dissectors/packet-fcels.c
@@ -170,6 +170,11 @@ static int hf_fcels_fcpflags_initiator = -1;
static int hf_fcels_fcpflags_target = -1;
static int hf_fcels_fcpflags_rdxr = -1;
static int hf_fcels_fcpflags_wrxr = -1;
+static int hf_fcels_tprloflags = -1;
+static int hf_fcels_tprloflags_opav = -1;
+static int hf_fcels_tprloflags_rpav = -1;
+static int hf_fcels_tprloflags_npv = -1;
+static int hf_fcels_tprloflags_gprlo = -1;
static gint ett_fcels = -1;
static gint ett_fcels_lsrjt = -1;
@@ -206,6 +211,7 @@ static gint ett_fcels_clsflags = -1;
static gint ett_fcels_initctl = -1;
static gint ett_fcels_rcptctl = -1;
static gint ett_fcels_fcpflags = -1;
+static gint ett_fcels_tprloflags = -1;
static const value_string fc_prli_fc4_val[] = {
{FC_TYPE_SCSI , "FCP"},
@@ -620,6 +626,60 @@ dissect_fcp_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint32 f
flags&=(~( 0x0001 ));
}
+static const true_false_string tfs_fc_fcels_tprloflags_opav = {
+ "3rd Party Orig PA Valid",
+ "3rd party orig pa is NOT valid"
+};
+static const true_false_string tfs_fc_fcels_tprloflags_rpav = {
+ "Resp PA Valid",
+ "Resp pa is NOT valid"
+};
+static const true_false_string tfs_fc_fcels_tprloflags_npv = {
+ "3rd Party N_Port Valid",
+ "3rd party n_port is NOT valid"
+};
+static const true_false_string tfs_fc_fcels_tprloflags_gprlo = {
+ "Global PRLO",
+ "NO global prlo"
+};
+
+static void
+dissect_tprlo_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int flags)
+{
+ proto_item *item=NULL;
+ proto_tree *tree=NULL;
+
+ if(parent_tree){
+ item=proto_tree_add_uint(parent_tree, hf_fcels_tprloflags,
+ tvb, offset, 1, flags);
+ tree=proto_item_add_subtree(item, ett_fcels_tprloflags);
+ }
+
+ proto_tree_add_boolean(tree, hf_fcels_tprloflags_opav, tvb, offset, 1, flags);
+ if (flags&0x80){
+ proto_item_append_text(item, " 3rd Party Orig PA Valid");
+ }
+ flags&=(~( 0x80 ));
+
+ proto_tree_add_boolean(tree, hf_fcels_tprloflags_rpav, tvb, offset, 1, flags);
+ if (flags&0x40){
+ proto_item_append_text(item, " Resp PA Valid");
+ }
+ flags&=(~( 0x40 ));
+
+ proto_tree_add_boolean(tree, hf_fcels_tprloflags_npv, tvb, offset, 1, flags);
+ if (flags&0x20){
+ proto_item_append_text(item, " 3rd Party N_Port Valid");
+ }
+ flags&=(~( 0x20 ));
+
+ proto_tree_add_boolean(tree, hf_fcels_tprloflags_gprlo, tvb, offset, 1, flags);
+ if (flags&0x10){
+ proto_item_append_text(item, " Global PRLO");
+ }
+ flags&=(~( 0x10 ));
+}
+
static const value_string initial_pa_vals[] = {
{ 0, "Initial P_A Not Supported" },
{ 1, "Initial P_A Supported" },
@@ -1415,28 +1475,13 @@ dissect_fcels_prlilo_payload (tvbuff_t *tvb, packet_info *pinfo _U_,
}
}
}
+ proto_tree_add_text (svcpg_tree, tvb, offset+2, 1,
+ "Flags: %s", flagstr);
}
else { /* Assuming opcode is TPRLO */
- if (flag & 0x80) {
- strcpy (flagstr, "3rd Party Orig PA Valid, ");
- stroff += 25;
- }
- if (flag & 0x40) {
- strcpy (&flagstr[stroff], "Resp PA Valid, ");
- stroff += 15;
- }
- if (flag & 0x20) {
- strcpy (&flagstr[stroff], "3rd Party N_Port Valid, ");
- stroff += 24;
- }
- if (flag & 0x10) {
- strcpy (&flagstr[stroff], "Global PRLO, ");
- stroff += 13;
- }
+ dissect_tprlo_flags (svcpg_tree, tvb, offset+2, flag);
}
- proto_tree_add_text (svcpg_tree, tvb, offset+2, 1,
- "Flags: %s", flagstr);
if (!isreq && (opcode != FC_ELS_TPRLO)) {
/* This is valid only for ACC */
proto_tree_add_text (svcpg_tree, tvb, offset+2, 1,
@@ -2398,6 +2443,21 @@ proto_register_fcels (void)
{ &hf_fcels_fcpflags_wrxr,
{"Wr Xfer_Rdy Dis", "fcels.fcpflags.wrxr", FT_BOOLEAN, 32,
TFS(&tfs_fc_fcels_fcpflags_wrxr), 0x0001, "", HFILL}},
+ { &hf_fcels_tprloflags,
+ {"TPRLO Flags", "fcels.tprloflags", FT_UINT8, BASE_HEX, NULL, 0x0, "",
+ HFILL}},
+ { &hf_fcels_tprloflags_opav,
+ {"3rd Party Orig PA Valid", "fcels.tprloflags.opav", FT_BOOLEAN, 8,
+ TFS(&tfs_fc_fcels_tprloflags_opav), 0x80, "", HFILL}},
+ { &hf_fcels_tprloflags_rpav,
+ {"Resp PA Valid", "fcels.tprloflags.rpav", FT_BOOLEAN, 8,
+ TFS(&tfs_fc_fcels_tprloflags_rpav), 0x40, "", HFILL}},
+ { &hf_fcels_tprloflags_npv,
+ {"3rd Party N_Port Valid", "fcels.tprloflags.npv", FT_BOOLEAN, 8,
+ TFS(&tfs_fc_fcels_tprloflags_npv), 0x20, "", HFILL}},
+ { &hf_fcels_tprloflags_gprlo,
+ {"Global PRLO", "fcels.tprloflags.gprlo", FT_BOOLEAN, 8,
+ TFS(&tfs_fc_fcels_tprloflags_gprlo), 0x10, "", HFILL}},
};
static gint *ett[] = {
@@ -2437,6 +2497,7 @@ proto_register_fcels (void)
&ett_fcels_initctl,
&ett_fcels_rcptctl,
&ett_fcels_fcpflags,
+ &ett_fcels_tprloflags,
};
/* Register the protocol name and description */