diff options
-rw-r--r-- | epan/dissectors/packet-fcels.c | 155 |
1 files changed, 85 insertions, 70 deletions
diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c index a28f3cbd66..951df91813 100644 --- a/epan/dissectors/packet-fcels.c +++ b/epan/dissectors/packet-fcels.c @@ -170,7 +170,7 @@ 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_prliloflags = -1; static int hf_fcels_tprloflags_opav = -1; static int hf_fcels_tprloflags_rpav = -1; static int hf_fcels_tprloflags_npv = -1; @@ -180,6 +180,9 @@ static int hf_fcels_speedflags_1gb = -1; static int hf_fcels_speedflags_2gb = -1; static int hf_fcels_speedflags_4gb = -1; static int hf_fcels_speedflags_10gb = -1; +static int hf_fcels_prliloflags_opav = -1; +static int hf_fcels_prliloflags_ipe = -1; +static int hf_fcels_prliloflags_eip = -1; static gint ett_fcels = -1; static gint ett_fcels_lsrjt = -1; @@ -216,7 +219,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 gint ett_fcels_prliloflags = -1; static gint ett_fcels_speedflags = -1; static const value_string fc_prli_fc4_val[] = { @@ -705,42 +708,86 @@ static const true_false_string tfs_fc_fcels_tprloflags_gprlo = { "Global PRLO", "NO global prlo" }; +static const true_false_string tfs_fc_fcels_prliloflags_opav = { + "Orig PA Valid", + "Orig pa is NOT valid" +}; +static const true_false_string tfs_fc_fcels_prliloflags_ipe = { + "Image Pair Estd", + "Image pair NOT estd" +}; +static const true_false_string tfs_fc_fcels_prliloflags_eip = { + "Est Image Pair & Exchg Svc Param", + "Exchange Svc Param Only" +}; static void -dissect_tprlo_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int flags) +dissect_prlilo_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int flags, guint8 opcode) { proto_item *item=NULL; proto_tree *tree=NULL; if(parent_tree){ - item=proto_tree_add_uint(parent_tree, hf_fcels_tprloflags, + item=proto_tree_add_uint(parent_tree, hf_fcels_prliloflags, tvb, offset, 1, flags); - tree=proto_item_add_subtree(item, ett_fcels_tprloflags); + tree=proto_item_add_subtree(item, ett_fcels_prliloflags); } - 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 )); + if (opcode == FC_ELS_TPRLO) { + 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_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_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 )); + } else { /* opcode != TPRLO */ + proto_tree_add_boolean(tree, hf_fcels_prliloflags_opav, tvb, offset, 1, flags); + if (flags&0x80){ + proto_item_append_text(item, " Orig PA Valid"); + } + flags&=(~( 0x80 )); - proto_tree_add_boolean(tree, hf_fcels_tprloflags_gprlo, tvb, offset, 1, flags); - if (flags&0x10){ - proto_item_append_text(item, " Global PRLO"); + 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 )); + + if (opcode == FC_ELS_PRLI) { + proto_tree_add_boolean(tree, hf_fcels_prliloflags_ipe, tvb, offset, 1, flags); + if (flags&0x20){ + proto_item_append_text(item, " Image Pair Estd"); + } else { + proto_item_append_text(item, " Image Pair NOT Estd"); + } + flags&=(~( 0x20 )); + } else { + proto_tree_add_boolean(tree, hf_fcels_prliloflags_eip, tvb, offset, 1, flags); + if (flags&0x20){ + proto_item_append_text(item, " Est Image Pair & Exchg Svc Param"); + } else { + proto_item_append_text(item, " Exchange Svc Param Only"); + } + flags&=(~( 0x20 )); + } } - flags&=(~( 0x10 )); } static const value_string initial_pa_vals[] = { @@ -1465,13 +1512,11 @@ static void dissect_fcels_prlilo_payload (tvbuff_t *tvb, packet_info *pinfo _U_, guint8 isreq, proto_item *ti, guint8 opcode) { - int offset = 0, - stroff = 0; + int offset = 0; guint8 type; proto_tree *prli_tree, *svcpg_tree; int num_svcpg, payload_len, i, flag; proto_item *subti; - gchar flagstr[FCELS_PRLILO_MAXSTRINGLEN]; /* We're assuming that we're invoked only if tree is not NULL i.e. * we don't do the usual "if (tree)" check here, the caller must. @@ -1504,46 +1549,7 @@ dissect_fcels_prlilo_payload (tvbuff_t *tvb, packet_info *pinfo _U_, tvb_get_guint8 (tvb, offset+1)); flag = tvb_get_guint8 (tvb, offset+2); - flagstr[0] = '\0'; - stroff = 0; - if (opcode != FC_ELS_TPRLO) { - if (flag & 0x80) { - strcpy (flagstr, "Orig PA Valid, "); - stroff += 15; - } - if (flag & 0x40) { - strcpy (&flagstr[stroff], "Resp PA Valid, "); - stroff += 15; - } - - if (opcode == FC_ELS_PRLI) { - if (!isreq) { - if (flag & 0x20) { - strcpy (&flagstr[stroff], "Image Pair Estd., "); - stroff += 18; - } - else { - strcpy (&flagstr[stroff], "Image Pair Not Estd., "); - stroff += 22; - } - } - else { - if (flag & 0x20) { - strcpy (&flagstr[stroff], "Est Image Pair & Exchg Svc Param, "); - stroff += 34; - } - else { - strcpy (&flagstr[stroff], "Exchange Svc Param Only, "); - stroff += 25; - } - } - } - proto_tree_add_text (svcpg_tree, tvb, offset+2, 1, - "Flags: %s", flagstr); - } - else { /* Assuming opcode is TPRLO */ - dissect_tprlo_flags (svcpg_tree, tvb, offset+2, flag); - } + dissect_prlilo_flags (svcpg_tree, tvb, offset+2, flag, opcode); if (!isreq && (opcode != FC_ELS_TPRLO)) { /* This is valid only for ACC */ @@ -2484,8 +2490,8 @@ 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, "", + { &hf_fcels_prliloflags, + {"PRLILO Flags", "fcels.prliloflags", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL}}, { &hf_fcels_tprloflags_opav, {"3rd Party Orig PA Valid", "fcels.tprloflags.opav", FT_BOOLEAN, 8, @@ -2514,6 +2520,15 @@ proto_register_fcels (void) { &hf_fcels_speedflags_10gb, {"10Gb Support", "fcels.speedflags.10gb", FT_BOOLEAN, 16, TFS(&tfs_fc_fcels_speedflags_10gb), 0x1000, "", HFILL}}, + { &hf_fcels_prliloflags_opav, + {"Orig PA Valid", "fcels.prliloflags.opav", FT_BOOLEAN, 8, + TFS(&tfs_fc_fcels_prliloflags_opav), 0x80, "", HFILL}}, + { &hf_fcels_prliloflags_ipe, + {"Image Pair Estd", "fcels.prliloflags.ipe", FT_BOOLEAN, 8, + TFS(&tfs_fc_fcels_prliloflags_ipe), 0x20, "", HFILL}}, + { &hf_fcels_prliloflags_eip, + {"Est Image Pair", "fcels.prliloflags.eip", FT_BOOLEAN, 8, + TFS(&tfs_fc_fcels_prliloflags_eip), 0x20, "", HFILL}}, }; static gint *ett[] = { @@ -2553,7 +2568,7 @@ proto_register_fcels (void) &ett_fcels_initctl, &ett_fcels_rcptctl, &ett_fcels_fcpflags, - &ett_fcels_tprloflags, + &ett_fcels_prliloflags, &ett_fcels_speedflags, }; |