aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ieee8021ah.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2014-10-04 11:28:35 -0400
committerBill Meier <wmeier@newsguy.com>2014-10-04 15:34:02 +0000
commitebfe8f6d289e3d2649dcfd5a3902ba038b0ee2bd (patch)
treed7cfeb5eb4592086744dbfaa71f1163932bc43a8 /epan/dissectors/packet-ieee8021ah.c
parent20795925ffb2f9687e960de8d6798e53482cb175 (diff)
Add editor modelines; Reformat as appropriate.
Change-Id: I8e9c58b75eea85877d22024201e5d8d0e9a3dbfd Reviewed-on: https://code.wireshark.org/review/4459 Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan/dissectors/packet-ieee8021ah.c')
-rw-r--r--epan/dissectors/packet-ieee8021ah.c454
1 files changed, 235 insertions, 219 deletions
diff --git a/epan/dissectors/packet-ieee8021ah.c b/epan/dissectors/packet-ieee8021ah.c
index 91fc430b68..69830aff28 100644
--- a/epan/dissectors/packet-ieee8021ah.c
+++ b/epan/dissectors/packet-ieee8021ah.c
@@ -40,7 +40,7 @@ void proto_reg_handoff_ieee8021ah(void);
static dissector_handle_t ethertype_handle;
void dissect_ieee8021ah_common(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, proto_tree *parent, int tree_index);
+ proto_tree *tree, proto_tree *parent, int tree_index);
/* GLOBALS ************************************************************/
@@ -59,13 +59,13 @@ static int hf_ieee8021ad_cvid = -1;
/* dot1ah C-tag fields */
static int hf_ieee8021ah_priority = -1;
-static int hf_ieee8021ah_drop = -1; /* drop eligibility */
-static int hf_ieee8021ah_nca = -1; /* no customer addresses (c_daddr & c_saddr are 0) */
-static int hf_ieee8021ah_res1 = -1; /* 2 bits reserved; ignored on receive */
-static int hf_ieee8021ah_res2 = -1; /* 2 bits reserved; delete frame if non-zero */
-static int hf_ieee8021ah_isid = -1; /* I-SID */
-static int hf_ieee8021ah_c_daddr = -1; /* encapsulated customer dest addr */
-static int hf_ieee8021ah_c_saddr = -1; /* encapsulated customer src addr */
+static int hf_ieee8021ah_drop = -1; /* drop eligibility */
+static int hf_ieee8021ah_nca = -1; /* no customer addresses (c_daddr & c_saddr are 0) */
+static int hf_ieee8021ah_res1 = -1; /* 2 bits reserved; ignored on receive */
+static int hf_ieee8021ah_res2 = -1; /* 2 bits reserved; delete frame if non-zero */
+static int hf_ieee8021ah_isid = -1; /* I-SID */
+static int hf_ieee8021ah_c_daddr = -1; /* encapsulated customer dest addr */
+static int hf_ieee8021ah_c_saddr = -1; /* encapsulated customer src addr */
static int hf_ieee8021ah_etype = -1;
/* static int hf_ieee8021ah_len = -1; */
@@ -83,21 +83,21 @@ capture_ieee8021ah(const guchar *pd, int offset, int len, packet_counts *ld)
guint16 encap_proto;
if (!BYTES_ARE_IN_FRAME(offset, len, IEEE8021AH_LEN + 1)) {
- ld->other++;
- return;
+ ld->other++;
+ return;
}
encap_proto = pntoh16( &pd[offset + IEEE8021AH_LEN - 2] );
if (encap_proto <= IEEE_802_3_MAX_LEN) {
- if ( pd[offset + IEEE8021AH_LEN] == 0xff
- && pd[offset + IEEE8021AH_LEN + 1] == 0xff ) {
- capture_ipx(ld);
- }
- else {
- capture_llc(pd, offset + IEEE8021AH_LEN,len,ld);
- }
+ if ( pd[offset + IEEE8021AH_LEN] == 0xff
+ && pd[offset + IEEE8021AH_LEN + 1] == 0xff ) {
+ capture_ipx(ld);
+ }
+ else {
+ capture_llc(pd, offset + IEEE8021AH_LEN,len,ld);
+ }
}
else {
- capture_ethertype(encap_proto, pd, offset + IEEE8021AH_LEN, len, ld);
+ capture_ethertype(encap_proto, pd, offset + IEEE8021AH_LEN, len, ld);
}
}
@@ -105,17 +105,18 @@ capture_ieee8021ah(const guchar *pd, int offset, int len, packet_counts *ld)
static
void
dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree)
+ proto_tree *tree)
{
- proto_tree *ptree = NULL;
- proto_tree *tagtree = NULL;
- guint32 tci, ctci;
- guint16 encap_proto;
+ proto_tree *ptree = NULL;
+ proto_tree *tagtree = NULL;
+ guint32 tci, ctci;
+ guint16 encap_proto;
+ int proto_tree_index;
+ ethertype_data_t ethertype_data;
+
+ tvbuff_t *volatile next_tvb = NULL;
proto_tree *volatile ieee8021ad_tree;
proto_tree *volatile ieee8021ad_tag_tree;
- int proto_tree_index;
- tvbuff_t *volatile next_tvb = NULL;
- ethertype_data_t ethertype_data;
/* set tree index */
proto_tree_index = proto_ieee8021ad;
@@ -126,16 +127,16 @@ dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo,
tci = tvb_get_ntohs( tvb, 0 );
- col_add_fstr(pinfo->cinfo, COL_INFO,
- "PRI: %d DROP: %d ID: %d",
- (tci >> 13), ((tci >> 12) & 1), (tci & 0xFFF));
+ col_add_fstr(pinfo->cinfo, COL_INFO,
+ "PRI: %d DROP: %d ID: %d",
+ (tci >> 13), ((tci >> 12) & 1), (tci & 0xFFF));
/* create the protocol tree */
ieee8021ad_tree = NULL;
if (tree) {
- ptree = proto_tree_add_item(tree, proto_tree_index, tvb, 0, IEEE8021AD_LEN, ENC_NA);
- ieee8021ad_tree = proto_item_add_subtree(ptree, ett_ieee8021ad);
+ ptree = proto_tree_add_item(tree, proto_tree_index, tvb, 0, IEEE8021AD_LEN, ENC_NA);
+ ieee8021ad_tree = proto_item_add_subtree(ptree, ett_ieee8021ad);
}
encap_proto = tvb_get_ntohs(tvb, IEEE8021AD_LEN - 2);
@@ -147,142 +148,143 @@ dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo,
/* If it's a 1ah frame, create subtree for B-Tag, rename overall
tree to 802.1ah, pass to 1ah dissector */
if (encap_proto == ETHERTYPE_IEEE_802_1AH) {
- if (tree) {
- tagtree = proto_tree_add_item(ptree, proto_tree_index, tvb, 0, 2, ENC_NA);
- ieee8021ad_tag_tree = proto_item_add_subtree(tagtree, ett_ieee8021ad);
+ if (tree) {
+ tagtree = proto_tree_add_item(ptree, proto_tree_index, tvb, 0, 2, ENC_NA);
+ ieee8021ad_tag_tree = proto_item_add_subtree(tagtree, ett_ieee8021ad);
- /* add fields */
- proto_tree_add_uint(ieee8021ad_tag_tree, hf_ieee8021ad_priority, tvb,
- 0, 1, tci);
- proto_tree_add_uint(ieee8021ad_tag_tree, hf_ieee8021ad_cfi, tvb, 0, 1, tci);
- proto_tree_add_uint(ieee8021ad_tag_tree, hf_ieee8021ad_id, tvb, 0, 2, tci);
+ /* add fields */
+ proto_tree_add_uint(ieee8021ad_tag_tree, hf_ieee8021ad_priority, tvb,
+ 0, 1, tci);
+ proto_tree_add_uint(ieee8021ad_tag_tree, hf_ieee8021ad_cfi, tvb, 0, 1, tci);
+ proto_tree_add_uint(ieee8021ad_tag_tree, hf_ieee8021ad_id, tvb, 0, 2, tci);
- /* set label of B-tag subtree */
- proto_item_set_text(ieee8021ad_tag_tree, "B-Tag, B-VID: %d", tci & 0x0FFF);
- }
+ /* set label of B-tag subtree */
+ proto_item_set_text(ieee8021ad_tag_tree, "B-Tag, B-VID: %d", tci & 0x0FFF);
+ }
- next_tvb = tvb_new_subset_remaining(tvb, IEEE8021AD_LEN);
+ next_tvb = tvb_new_subset_remaining(tvb, IEEE8021AD_LEN);
- if (ptree) {
- /* add bvid to label */
- proto_item_set_text(ptree, "IEEE 802.1ah, B-VID: %d", tci & 0x0FFF);
+ if (ptree) {
+ /* add bvid to label */
+ proto_item_set_text(ptree, "IEEE 802.1ah, B-VID: %d", tci & 0x0FFF);
- dissect_ieee8021ah_common(next_tvb, pinfo, ptree, tree, proto_tree_index);
- }
- else {
- dissect_ieee8021ah_common(next_tvb, pinfo, tree, NULL, proto_tree_index);
- }
+ dissect_ieee8021ah_common(next_tvb, pinfo, ptree, tree, proto_tree_index);
+ }
+ else {
+ dissect_ieee8021ah_common(next_tvb, pinfo, tree, NULL, proto_tree_index);
+ }
- return;
+ return;
} else if (encap_proto == ETHERTYPE_IEEE_802_1AD) {
- /* two VLAN tags (i.e. Q-in-Q) */
- ctci = tvb_get_ntohs(tvb, IEEE8021AD_LEN);
-
- if (tree) {
- /* add fields */
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_priority, tvb,
- 0, 1, tci);
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_cfi, tvb, 0, 1, tci);
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_svid, tvb, 0, 2, tci);
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_priority, tvb,
- IEEE8021AD_LEN, 1, ctci);
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_cfi, tvb,
- IEEE8021AD_LEN, 1, ctci);
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_cvid, tvb, IEEE8021AD_LEN,
- 2, ctci);
- }
-
- proto_item_set_text(ptree, "IEEE 802.1ad, S-VID: %d, C-VID: %d", tci & 0x0FFF,
- ctci & 0x0FFF);
-
- ethertype_data.etype = tvb_get_ntohs(tvb, IEEE8021AD_LEN * 2 - 2);
- ethertype_data.offset_after_ethertype = IEEE8021AD_LEN * 2;
-
- /* 802.1ad tags are always followed by an ethertype; call next
- dissector based on ethertype */
- call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, &ethertype_data);
+ /* two VLAN tags (i.e. Q-in-Q) */
+ ctci = tvb_get_ntohs(tvb, IEEE8021AD_LEN);
+
+ if (tree) {
+ /* add fields */
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_priority, tvb,
+ 0, 1, tci);
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_cfi, tvb, 0, 1, tci);
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_svid, tvb, 0, 2, tci);
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_priority, tvb,
+ IEEE8021AD_LEN, 1, ctci);
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_cfi, tvb,
+ IEEE8021AD_LEN, 1, ctci);
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_cvid, tvb, IEEE8021AD_LEN,
+ 2, ctci);
+ }
+
+ proto_item_set_text(ptree, "IEEE 802.1ad, S-VID: %d, C-VID: %d", tci & 0x0FFF,
+ ctci & 0x0FFF);
+
+ ethertype_data.etype = tvb_get_ntohs(tvb, IEEE8021AD_LEN * 2 - 2);
+ ethertype_data.offset_after_ethertype = IEEE8021AD_LEN * 2;
+
+ /* 802.1ad tags are always followed by an ethertype; call next
+ dissector based on ethertype */
+ call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, &ethertype_data);
} else {
- /* Something else (shouldn't really happen, but we'll support it anyways) */
- if (tree) {
- /* add fields */
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_priority, tvb,
- 0, 1, tci);
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_cfi, tvb, 0, 1, tci);
- proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_id, tvb, 0, 2, tci);
- }
-
- /* label should be 802.1ad not .1ah */
- proto_item_set_text(ptree, "IEEE 802.1ad, ID: %d", tci & 0x0FFF);
-
- ethertype_data.etype = encap_proto;
- ethertype_data.offset_after_ethertype = IEEE8021AD_LEN;
-
- /* 802.1ad tags are always followed by an ethertype; call next
- dissector based on ethertype */
- call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, &ethertype_data);
+ /* Something else (shouldn't really happen, but we'll support it anyways) */
+ if (tree) {
+ /* add fields */
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_priority, tvb,
+ 0, 1, tci);
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_cfi, tvb, 0, 1, tci);
+ proto_tree_add_uint(ieee8021ad_tree, hf_ieee8021ad_id, tvb, 0, 2, tci);
+ }
+
+ /* label should be 802.1ad not .1ah */
+ proto_item_set_text(ptree, "IEEE 802.1ad, ID: %d", tci & 0x0FFF);
+
+ ethertype_data.etype = encap_proto;
+ ethertype_data.offset_after_ethertype = IEEE8021AD_LEN;
+
+ /* 802.1ad tags are always followed by an ethertype; call next
+ dissector based on ethertype */
+ call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, &ethertype_data);
}
}
void
dissect_ieee8021ah_common(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, proto_tree *parent, int tree_index) {
- guint32 tci;
- guint16 encap_proto;
- proto_tree *ptree;
+ proto_tree *tree, proto_tree *parent, int tree_index) {
+ guint32 tci;
+ guint16 encap_proto;
+ proto_tree *ptree;
+ ethertype_data_t ethertype_data;
+
proto_tree *volatile ieee8021ah_tag_tree;
- ethertype_data_t ethertype_data;
/* for parsing out ethernet addrs */
const guint8 *src_addr, *dst_addr;
tci = tvb_get_ntohl( tvb, 0 );
- col_add_fstr(pinfo->cinfo, COL_INFO,
- "PRI: %d Drop: %d NCA: %d Res1: %d Res2: %d I-SID: %d",
- (tci >> 29), ((tci >> 28) & 1), ((tci >> 27) & 1),
- ((tci >> 26) & 1), ((tci >> 24) & 3), tci & IEEE8021AH_ISIDMASK);
+ col_add_fstr(pinfo->cinfo, COL_INFO,
+ "PRI: %d Drop: %d NCA: %d Res1: %d Res2: %d I-SID: %d",
+ (tci >> 29), ((tci >> 28) & 1), ((tci >> 27) & 1),
+ ((tci >> 26) & 1), ((tci >> 24) & 3), tci & IEEE8021AH_ISIDMASK);
/* create the protocol tree */
ptree = NULL;
ieee8021ah_tag_tree = NULL;
if (tree) {
- /* 802.1ah I-Tag */
- ptree = proto_tree_add_item(tree, tree_index, tvb, 0, 4, ENC_NA);
- ieee8021ah_tag_tree = proto_item_add_subtree(ptree, ett_ieee8021ah);
-
- /* add fields */
- proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_priority, tvb,
- 0, 1, tci);
- proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_drop, tvb, 0, 1, tci);
- proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_nca, tvb, 0, 1, tci);
- proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_res1, tvb, 0, 1, tci);
- proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_res2, tvb, 0, 1, tci);
- proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_isid, tvb, 1, 3, tci);
-
- proto_item_set_text(ieee8021ah_tag_tree, "I-Tag, I-SID: %d",
- tci & IEEE8021AH_ISIDMASK);
-
- /* ensure size of tag */
- tvb_ensure_bytes_exist(tvb, 4, 12);
-
- /* parse out IP addrs */
- dst_addr = tvb_get_ptr(tvb, 4, 6); /* safe to use this function? */
- src_addr = tvb_get_ptr(tvb, 10, 6);
-
- proto_tree_add_ether(tree, hf_ieee8021ah_c_daddr,
- tvb, 4, 6, dst_addr);
-
- proto_tree_add_ether(tree, hf_ieee8021ah_c_saddr,
- tvb, 10, 6, src_addr);
-
- /* add text to 802.1ad label */
- if (parent) {
- proto_item_append_text(tree, ", I-SID: %d, C-Src: %s (%s), C-Dst: %s (%s)",
- tci & IEEE8021AH_ISIDMASK, get_ether_name(src_addr),
- ether_to_str(src_addr), get_ether_name(dst_addr),
- ether_to_str(dst_addr));
- }
+ /* 802.1ah I-Tag */
+ ptree = proto_tree_add_item(tree, tree_index, tvb, 0, 4, ENC_NA);
+ ieee8021ah_tag_tree = proto_item_add_subtree(ptree, ett_ieee8021ah);
+
+ /* add fields */
+ proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_priority, tvb,
+ 0, 1, tci);
+ proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_drop, tvb, 0, 1, tci);
+ proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_nca, tvb, 0, 1, tci);
+ proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_res1, tvb, 0, 1, tci);
+ proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_res2, tvb, 0, 1, tci);
+ proto_tree_add_uint(ieee8021ah_tag_tree, hf_ieee8021ah_isid, tvb, 1, 3, tci);
+
+ proto_item_set_text(ieee8021ah_tag_tree, "I-Tag, I-SID: %d",
+ tci & IEEE8021AH_ISIDMASK);
+
+ /* ensure size of tag */
+ tvb_ensure_bytes_exist(tvb, 4, 12);
+
+ /* parse out IP addrs */
+ dst_addr = tvb_get_ptr(tvb, 4, 6); /* safe to use this function? */
+ src_addr = tvb_get_ptr(tvb, 10, 6);
+
+ proto_tree_add_ether(tree, hf_ieee8021ah_c_daddr,
+ tvb, 4, 6, dst_addr);
+
+ proto_tree_add_ether(tree, hf_ieee8021ah_c_saddr,
+ tvb, 10, 6, src_addr);
+
+ /* add text to 802.1ad label */
+ if (parent) {
+ proto_item_append_text(tree, ", I-SID: %d, C-Src: %s (%s), C-Dst: %s (%s)",
+ tci & IEEE8021AH_ISIDMASK, get_ether_name(src_addr),
+ ether_to_str(src_addr), get_ether_name(dst_addr),
+ ether_to_str(dst_addr));
+ }
}
encap_proto = tvb_get_ntohs(tvb, IEEE8021AH_LEN - 2);
@@ -310,12 +312,13 @@ dissect_ieee8021ah_common(tvbuff_t *tvb, packet_info *pinfo,
static
void
dissect_ieee8021ah(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree)
+ proto_tree *tree)
{
proto_tree *ptree;
- guint32 tci;
+ guint32 tci;
+ int proto_tree_index;
+
proto_tree *volatile ieee8021ah_tree;
- int proto_tree_index;
/* set tree index */
proto_tree_index = proto_ieee8021ah;
@@ -326,19 +329,19 @@ dissect_ieee8021ah(tvbuff_t *tvb, packet_info *pinfo,
tci = tvb_get_ntohl( tvb, 0 );
- col_add_fstr(pinfo->cinfo, COL_INFO,
- "PRI: %d Drop: %d NCA: %d Res1: %d Res2: %d I-SID: %d",
- (tci >> 29), ((tci >> 28) & 1), ((tci >> 27) & 1),
- ((tci >> 26) & 1), ((tci >> 24) & 3), (tci & 0x00FFFFFF));
+ col_add_fstr(pinfo->cinfo, COL_INFO,
+ "PRI: %d Drop: %d NCA: %d Res1: %d Res2: %d I-SID: %d",
+ (tci >> 29), ((tci >> 28) & 1), ((tci >> 27) & 1),
+ ((tci >> 26) & 1), ((tci >> 24) & 3), (tci & 0x00FFFFFF));
/* create the protocol tree */
ieee8021ah_tree = NULL;
if (tree) {
- ptree = proto_tree_add_item(tree, proto_tree_index, tvb, 0, IEEE8021AH_LEN, ENC_NA);
- ieee8021ah_tree = proto_item_add_subtree(ptree, ett_ieee8021ah);
+ ptree = proto_tree_add_item(tree, proto_tree_index, tvb, 0, IEEE8021AH_LEN, ENC_NA);
+ ieee8021ah_tree = proto_item_add_subtree(ptree, ett_ieee8021ah);
- dissect_ieee8021ah_common(tvb, pinfo, ieee8021ah_tree, tree, proto_tree_index);
+ dissect_ieee8021ah_common(tvb, pinfo, ieee8021ah_tree, tree, proto_tree_index);
}
}
@@ -348,64 +351,64 @@ void
proto_register_ieee8021ah(void)
{
static hf_register_info hf[] = {
- { &hf_ieee8021ah_priority, {
- "Priority", "ieee8021ah.priority", FT_UINT32, BASE_DEC,
- 0, 0xE0000000, NULL, HFILL }},
- { &hf_ieee8021ah_drop, {
- "DROP", "ieee8021ah.drop", FT_UINT32, BASE_DEC,
- 0, 0x10000000, NULL, HFILL }},
- { &hf_ieee8021ah_nca, {
- "NCA", "ieee8021ah.nca", FT_UINT32, BASE_DEC,
- 0, 0x08000000, "No Customer Addresses", HFILL }},
- { &hf_ieee8021ah_res1, {
- "RES1", "ieee8021ah.res1", FT_UINT32, BASE_DEC,
- 0, 0x04000000, "Reserved1", HFILL }},
- { &hf_ieee8021ah_res2, {
- "RES2", "ieee8021ah.res2", FT_UINT32, BASE_DEC,
- 0, 0x03000000, "Reserved2", HFILL }},
- { &hf_ieee8021ah_isid, {
- "I-SID", "ieee8021ah.isid", FT_UINT32, BASE_DEC,
- 0, 0x00FFFFFF, NULL, HFILL }},
- { &hf_ieee8021ah_c_daddr, {
- "C-Destination", "ieee8021ah.cdst", FT_ETHER, BASE_NONE,
- NULL, 0x0, "Customer Destination Address", HFILL }},
- { &hf_ieee8021ah_c_saddr, {
- "C-Source", "ieee8021ah.csrc", FT_ETHER, BASE_NONE,
- NULL, 0x0, "Customer Source Address", HFILL }},
- { &hf_ieee8021ah_etype, {
- "Type", "ieee8021ah.etype", FT_UINT16, BASE_HEX,
- VALS(etype_vals), 0x0, NULL, HFILL }},
+ { &hf_ieee8021ah_priority, {
+ "Priority", "ieee8021ah.priority", FT_UINT32, BASE_DEC,
+ 0, 0xE0000000, NULL, HFILL }},
+ { &hf_ieee8021ah_drop, {
+ "DROP", "ieee8021ah.drop", FT_UINT32, BASE_DEC,
+ 0, 0x10000000, NULL, HFILL }},
+ { &hf_ieee8021ah_nca, {
+ "NCA", "ieee8021ah.nca", FT_UINT32, BASE_DEC,
+ 0, 0x08000000, "No Customer Addresses", HFILL }},
+ { &hf_ieee8021ah_res1, {
+ "RES1", "ieee8021ah.res1", FT_UINT32, BASE_DEC,
+ 0, 0x04000000, "Reserved1", HFILL }},
+ { &hf_ieee8021ah_res2, {
+ "RES2", "ieee8021ah.res2", FT_UINT32, BASE_DEC,
+ 0, 0x03000000, "Reserved2", HFILL }},
+ { &hf_ieee8021ah_isid, {
+ "I-SID", "ieee8021ah.isid", FT_UINT32, BASE_DEC,
+ 0, 0x00FFFFFF, NULL, HFILL }},
+ { &hf_ieee8021ah_c_daddr, {
+ "C-Destination", "ieee8021ah.cdst", FT_ETHER, BASE_NONE,
+ NULL, 0x0, "Customer Destination Address", HFILL }},
+ { &hf_ieee8021ah_c_saddr, {
+ "C-Source", "ieee8021ah.csrc", FT_ETHER, BASE_NONE,
+ NULL, 0x0, "Customer Source Address", HFILL }},
+ { &hf_ieee8021ah_etype, {
+ "Type", "ieee8021ah.etype", FT_UINT16, BASE_HEX,
+ VALS(etype_vals), 0x0, NULL, HFILL }},
#if 0
- { &hf_ieee8021ah_len, {
- "Length", "ieee8021ah.len", FT_UINT16, BASE_DEC,
- NULL, 0x0, NULL, HFILL }},
+ { &hf_ieee8021ah_len, {
+ "Length", "ieee8021ah.len", FT_UINT16, BASE_DEC,
+ NULL, 0x0, NULL, HFILL }},
#endif
- { &hf_ieee8021ah_trailer, {
- "Trailer", "ieee8021ah.trailer", FT_BYTES, BASE_NONE,
- NULL, 0x0, "802.1ah Trailer", HFILL }}
+ { &hf_ieee8021ah_trailer, {
+ "Trailer", "ieee8021ah.trailer", FT_BYTES, BASE_NONE,
+ NULL, 0x0, "802.1ah Trailer", HFILL }}
};
static hf_register_info hf_1ad[] = {
- { &hf_ieee8021ad_priority, {
- "Priority", "ieee8021ad.priority", FT_UINT16, BASE_DEC,
- 0, 0xE000, NULL, HFILL }},
- { &hf_ieee8021ad_cfi, {
- "DEI", "ieee8021ad.dei", FT_UINT16, BASE_DEC,
- 0, 0x1000, "Drop Eligibility", HFILL }},
- { &hf_ieee8021ad_id, {
- "ID", "ieee8021ad.id", FT_UINT16, BASE_DEC,
- 0, 0x0FFF, "Vlan ID", HFILL }},
- { &hf_ieee8021ad_svid, {
- "ID", "ieee8021ad.svid", FT_UINT16, BASE_DEC,
- 0, 0x0FFF, "S-Vlan ID", HFILL }},
- { &hf_ieee8021ad_cvid, {
- "ID", "ieee8021ad.cvid", FT_UINT16, BASE_DEC,
- 0, 0x0FFF, "C-Vlan ID", HFILL }},
+ { &hf_ieee8021ad_priority, {
+ "Priority", "ieee8021ad.priority", FT_UINT16, BASE_DEC,
+ 0, 0xE000, NULL, HFILL }},
+ { &hf_ieee8021ad_cfi, {
+ "DEI", "ieee8021ad.dei", FT_UINT16, BASE_DEC,
+ 0, 0x1000, "Drop Eligibility", HFILL }},
+ { &hf_ieee8021ad_id, {
+ "ID", "ieee8021ad.id", FT_UINT16, BASE_DEC,
+ 0, 0x0FFF, "Vlan ID", HFILL }},
+ { &hf_ieee8021ad_svid, {
+ "ID", "ieee8021ad.svid", FT_UINT16, BASE_DEC,
+ 0, 0x0FFF, "S-Vlan ID", HFILL }},
+ { &hf_ieee8021ad_cvid, {
+ "ID", "ieee8021ad.cvid", FT_UINT16, BASE_DEC,
+ 0, 0x0FFF, "C-Vlan ID", HFILL }},
};
static gint *ett[] = {
- &ett_ieee8021ah,
- &ett_ieee8021ad
+ &ett_ieee8021ah,
+ &ett_ieee8021ad
};
@@ -414,11 +417,11 @@ proto_register_ieee8021ah(void)
/* registration */
/* dot1ah */
proto_ieee8021ah = proto_register_protocol("IEEE 802.1ah", "IEEE 802.1AH",
- "ieee8021ah");
+ "ieee8021ah");
proto_register_field_array(proto_ieee8021ah, hf, array_length(hf));
proto_ieee8021ad = proto_register_protocol("IEEE 802.1ad", "IEEE 802.1AD",
- "ieee8021ad");
+ "ieee8021ad");
proto_register_field_array(proto_ieee8021ad, hf_1ad, array_length(hf_1ad));
/* register subtree array for both */
@@ -426,36 +429,49 @@ proto_register_ieee8021ah(void)
/* add a user preference to set the 802.1ah ethertype */
ieee8021ah_module = prefs_register_protocol(proto_ieee8021ah,
- proto_reg_handoff_ieee8021ah);
+ proto_reg_handoff_ieee8021ah);
prefs_register_uint_preference(ieee8021ah_module, "8021ah_ethertype",
- "802.1ah Ethertype (in hex)",
- "(Hexadecimal) Ethertype used to indicate IEEE 802.1ah tag.",
- 16, &ieee8021ah_ethertype);
+ "802.1ah Ethertype (in hex)",
+ "(Hexadecimal) Ethertype used to indicate IEEE 802.1ah tag.",
+ 16, &ieee8021ah_ethertype);
}
void
proto_reg_handoff_ieee8021ah(void)
{
- static gboolean prefs_initialized = FALSE;
+ static gboolean prefs_initialized = FALSE;
static dissector_handle_t ieee8021ah_handle;
- static unsigned int old_ieee8021ah_ethertype;
+ static unsigned int old_ieee8021ah_ethertype;
if (!prefs_initialized){
- dissector_handle_t ieee8021ad_handle;
- ieee8021ah_handle = create_dissector_handle(dissect_ieee8021ah,
- proto_ieee8021ah);
- ieee8021ad_handle = create_dissector_handle(dissect_ieee8021ad,
- proto_ieee8021ad);
- dissector_add_uint("ethertype", ETHERTYPE_IEEE_802_1AD, ieee8021ad_handle);
- ethertype_handle = find_dissector("ethertype");
-
- prefs_initialized = TRUE;
+ dissector_handle_t ieee8021ad_handle;
+ ieee8021ah_handle = create_dissector_handle(dissect_ieee8021ah,
+ proto_ieee8021ah);
+ ieee8021ad_handle = create_dissector_handle(dissect_ieee8021ad,
+ proto_ieee8021ad);
+ dissector_add_uint("ethertype", ETHERTYPE_IEEE_802_1AD, ieee8021ad_handle);
+ ethertype_handle = find_dissector("ethertype");
+
+ prefs_initialized = TRUE;
}
else {
- dissector_delete_uint("ethertype", old_ieee8021ah_ethertype, ieee8021ah_handle);
+ dissector_delete_uint("ethertype", old_ieee8021ah_ethertype, ieee8021ah_handle);
}
old_ieee8021ah_ethertype = ieee8021ah_ethertype;
dissector_add_uint("ethertype", ieee8021ah_ethertype, ieee8021ah_handle);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */