summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-mip6.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-10-23 11:47:57 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-10-23 11:47:57 +0000
commit4c792b7214c9b878811d59ac5290a66629de744d (patch)
treebf181f35e324da211a08f547c635f746125fe6ad /epan/dissectors/packet-mip6.c
parent26989e9d1116d7208f5d137eed343f2b356c32dd (diff)
downloadwireshark-4c792b7214c9b878811d59ac5290a66629de744d.tar.gz
- Use mip6_mh_types to build the INFO_COL string rather than a fixed string in the subroutines.
- Use proto_add_item for ipproto. - extend an enum and use definse for new messages. svn path=/trunk/; revision=45735
Diffstat (limited to 'epan/dissectors/packet-mip6.c')
-rw-r--r--epan/dissectors/packet-mip6.c52
1 files changed, 12 insertions, 40 deletions
diff --git a/epan/dissectors/packet-mip6.c b/epan/dissectors/packet-mip6.c
index 8e43fba89b..4bfd6f2419 100644
--- a/epan/dissectors/packet-mip6.c
+++ b/epan/dissectors/packet-mip6.c
@@ -59,7 +59,9 @@ typedef enum {
MIP6_HB = 13,
MIP6_HI = 14,
MIP6_HAck = 15,
- MIP6_BR = 16
+ MIP6_BR = 16,
+ MIP6_LRI = 17,
+ MIP6_LRA = 18
} mhTypes;
/* http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml */
@@ -81,8 +83,8 @@ static const value_string mip6_mh_types[] = {
{MIP6_HI, "Handover Initiate"}, /* [RFC5568] */
{MIP6_HAck, "Handover Acknowledge"}, /* [RFC5568] */
{MIP6_BR, "Binding Revocation"}, /* [RFC5846] */
- {17, "Localized Routing Initiation"}, /* [RFC6705] */
- {18, "Localized Routing Acknowledgment"}, /* [RFC6705] */
+ {MIP6_LRI, "Localized Routing Initiation"}, /* [RFC6705] */
+ {MIP6_LRA, "Localized Routing Acknowledgment"}, /* [RFC6705] */
{0, NULL}
};
@@ -900,8 +902,6 @@ dissect_mip6_brr(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
/*proto_tree *data_tree = NULL;*/
/*proto_item *ti;*/
- col_set_str(pinfo->cinfo, COL_INFO, "Binding Refresh Request");
-
if (mip6_tree) {
/*ti = */proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_BRR_LEN, "Binding Refresh Request");
@@ -917,8 +917,6 @@ dissect_mip6_hoti(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_tree *data_tree = NULL;
proto_item *ti;
- col_set_str(pinfo->cinfo, COL_INFO, "Home Test Init");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_HOTI_LEN, "Home Test Init");
@@ -937,8 +935,6 @@ dissect_mip6_coti(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_tree *data_tree = NULL;
proto_item *ti;
- col_set_str(pinfo->cinfo, COL_INFO, "Care-of Test Init");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_COTI_LEN, "Care-of Test Init");
@@ -957,8 +953,6 @@ dissect_mip6_hot(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_tree *data_tree = NULL;
proto_item *ti;
- col_set_str(pinfo->cinfo, COL_INFO, "Home Test");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_HOT_LEN, "Home Test");
@@ -981,8 +975,6 @@ dissect_mip6_cot(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_tree *data_tree = NULL;
proto_item *ti;
- col_set_str(pinfo->cinfo, COL_INFO, "Care-of Test");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_COT_LEN, "Care-of Test");
@@ -1007,8 +999,6 @@ dissect_mip6_bu(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_item *ti;
int lifetime;
- col_set_str(pinfo->cinfo, COL_INFO, "Binding Update");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_BU_LEN, "Binding Update");
@@ -1057,8 +1047,6 @@ dissect_mip6_ba(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_item *ti;
int lifetime;
- col_set_str(pinfo->cinfo, COL_INFO, "Binding Acknowledgement");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_BA_LEN, "Binding Acknowledgement");
@@ -1097,8 +1085,6 @@ dissect_mip6_be(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_tree *data_tree = NULL;
proto_item *ti;
- col_set_str(pinfo->cinfo, COL_INFO, "Binding Error");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_BE_LEN, "Binding Error");
@@ -1119,8 +1105,6 @@ dissect_mip6_hb(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_tree *data_tree = NULL;
proto_item *ti;
- col_set_str(pinfo->cinfo, COL_INFO, "Heartbeat");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_HB_LEN, "Heartbeat");
@@ -1145,8 +1129,6 @@ dissect_mip6_unknown(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
/*proto_tree *data_tree = NULL;*/
/*proto_item *ti;*/
- col_set_str(pinfo->cinfo, COL_INFO, "Unknown MH Type");
-
if (mip6_tree) {
/*ti = */proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_DATA_OFF + 1, "Unknown MH Type");
@@ -1163,8 +1145,6 @@ dissect_fmip6_fbu(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_item *ti;
int lifetime;
- col_set_str(pinfo->cinfo, COL_INFO, "Fast Binding Update");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_BU_LEN, "Fast Binding Update");
@@ -1200,8 +1180,6 @@ dissect_fmip6_fback(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
proto_item *ti;
int lifetime;
- col_set_str(pinfo->cinfo, COL_INFO, "Fast Binding Acknowledgement");
-
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
FMIP6_FBACK_LEN, "Fast Binding Acknowledgement");
@@ -1230,8 +1208,6 @@ dissect_fmip6_fna(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
/*proto_tree *data_tree = NULL;*/
/*proto_item *ti;*/
- col_set_str(pinfo->cinfo, COL_INFO, "Fast Neighbor Advertisement");
-
if (mip6_tree) {
/*ti = */proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
FMIP6_FNA_LEN, "Fast Neighbor Advertisement");
@@ -1257,7 +1233,7 @@ dissect_pmip6_bri(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
/* Branch between BR Indication and BR Acknowledge */
if ( br_type == INDICATION )
{
- col_set_str(pinfo->cinfo, COL_INFO, "Binding Revocation Indication");
+ col_append_str(pinfo->cinfo, COL_INFO, " Indication");
if (mip6_tree)
{
@@ -1288,8 +1264,8 @@ dissect_pmip6_bri(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
PMIP6_BRI_RES_OFF, PMIP6_BRI_RES_LEN, ENC_BIG_ENDIAN);
}
} else if ( br_type == ACKNOWLEDGE ) {
- if (check_col(pinfo->cinfo, COL_INFO))
- col_set_str(pinfo->cinfo, COL_INFO, "Binding Revocation Acknowledge");
+
+ col_append_str(pinfo->cinfo, COL_INFO, " Acknowledge");
if (mip6_tree)
{
@@ -2040,13 +2016,8 @@ dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
mip6_tree = proto_item_add_subtree(ti, ett_mip6);
/* Process header fields */
- proto_tree_add_uint_format(mip6_tree, hf_mip6_proto, tvb,
- MIP6_PROTO_OFF, 1,
- tvb_get_guint8(tvb, MIP6_PROTO_OFF),
- "Payload protocol: %s (0x%02x)",
- ipprotostr(
- tvb_get_guint8(tvb, MIP6_PROTO_OFF)),
- tvb_get_guint8(tvb, MIP6_PROTO_OFF));
+ proto_tree_add_item(mip6_tree, hf_mip6_proto, tvb,
+ MIP6_PROTO_OFF, 1, ENC_BIG_ENDIAN);
proto_tree_add_uint_format(mip6_tree, hf_mip6_hlen, tvb,
MIP6_HLEN_OFF, 1,
@@ -2067,6 +2038,7 @@ dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Process mobility header */
type = tvb_get_guint8(tvb, MIP6_TYPE_OFF);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(type, mip6_mh_types, "<unknown>"));
switch (type) {
case MIP6_BRR:
/* Binding Refresh Request */
@@ -2162,7 +2134,7 @@ proto_register_mip6(void)
static hf_register_info hf[] = {
{ &hf_mip6_proto, { "Payload protocol", "mip6.proto",
- FT_UINT8, BASE_DEC, NULL, 0,
+ FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0,
NULL, HFILL }},
{ &hf_mip6_hlen, { "Header length", "mip6.hlen",
FT_UINT8, BASE_DEC, NULL, 0,