Register a dissector table for Normal Vendor/Organization Specific Extension(NVSE) and use it for 3GPP2.

svn path=/trunk/; revision=48623
This commit is contained in:
Anders Broman 2013-03-28 16:55:06 +00:00
parent fc78e677a8
commit 8e1b0ac304
2 changed files with 140 additions and 16 deletions

View File

@ -33,6 +33,11 @@
#include <epan/packet.h>
#include <epan/sminmpec.h>
void proto_register_mip(void);
void proto_reg_handoff_mip(void);
static dissector_table_t mip_nvse_ext_dissector_table;
/* Initialize the protocol and registered fields */
static int proto_mip = -1;
static int hf_mip_type = -1;
@ -110,6 +115,13 @@ static int hf_mip_nvse_reserved = -1;
static int hf_mip_nvse_vendor_org_id = -1;
static int hf_mip_nvse_vendor_nvse_type = -1;
static int hf_mip_nvse_vendor_nvse_value = -1;
static int hf_mip_nvse_3gpp2_type = -1;
static int hf_mip_nvse_3gpp2_type17_entity = -1;
static int hf_mip_nvse_3gpp2_type17_subtype1 = -1;
static int hf_mip_nvse_3gpp2_type17_subtype2 = -1;
static int hf_mip_nvse_3gpp2_type17_length = -1;
static int hf_mip_nvse_3gpp2_type17_prim_dns = -1;
static int hf_mip_nvse_3gpp2_type17_sec_dns = -1;
/* Initialize the subtree pointers */
static gint ett_mip = -1;
@ -394,11 +406,70 @@ static const value_string mip_cvse_verizon_cvse_types[]= {
{0, NULL}
};
static const value_string mip_nvse_3gpp2_type_vals[]= {
{17, "DNS server IP address"},
{0, NULL}
};
static const value_string mip_nvse_3gpp2_type17_entity_vals[]= {
{0, "Unknown"},
{1, "HAAA"},
{2, "VAAA"},
{3, "HA"},
{0, NULL}
};
static dissector_handle_t ip_handle;
/* Code to dissect 3GPP2 extensions */
static int
dissect_mip_priv_ext_3gpp2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
int offset = 0;
guint16 type;
int length = tvb_reported_length(tvb);
type = tvb_get_ntohs(tvb,offset);
proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
switch(type){
case 17: /* DNS server IP address X.S0011-002-C v3.0*/
/* Entity-Type */
proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_entity, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Sub-Type1 */
proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_subtype1, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Length */
proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_length, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* DNS server IP address */
proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_prim_dns, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* Sub-Type2 */
proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_subtype2, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Length */
proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_length, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* DNS server IP address.*/
proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_sec_dns, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_text(tree, tvb, offset, -1, " Data not dissected yet");
break;
}
return length;
}
/* Code to dissect extensions */
static void
dissect_mip_extensions( tvbuff_t *tvb, int offset, proto_tree *tree)
dissect_mip_extensions( tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo)
{
proto_item *ti;
proto_tree *exts_tree=NULL;
@ -415,7 +486,6 @@ dissect_mip_extensions( tvbuff_t *tvb, int offset, proto_tree *tree)
gint hdrLen;
guint32 cvse_vendor_id;
guint16 cvse_vendor_type;
guint16 nvse_vendor_type;
int cvse_local_offset= 0;
int nvse_local_offset= 0;
@ -635,21 +705,30 @@ dissect_mip_extensions( tvbuff_t *tvb, int offset, proto_tree *tree)
case OLD_NVSE_EXT: /* RFC 3115 */
case NVSE_EXT: /* RFC 3115 */
proto_tree_add_item(ext_tree, hf_mip_nvse_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
{
guint32 nvse_vendor_org_id;
tvbuff_t *next_tvb;
/* Vendor/Org ID */
/*Vendor ID & nvse type & nvse value are included in ext_len, so do not increment offset for them here.*/
nvse_local_offset = offset + hdrLen;
proto_tree_add_item(ext_tree, hf_mip_nvse_vendor_org_id, tvb, nvse_local_offset, 4, ENC_BIG_ENDIAN);
nvse_local_offset+=4;
proto_tree_add_item(ext_tree, hf_mip_nvse_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
/*Vendor NVSE Type*/
nvse_vendor_type = tvb_get_ntohs(tvb, nvse_local_offset);
proto_tree_add_uint(ext_tree, hf_mip_nvse_vendor_nvse_type, tvb, nvse_local_offset, 2, nvse_vendor_type);
nvse_local_offset+=2;
/* Vendor/Org ID */
/*Vendor ID & nvse type & nvse value are included in ext_len, so do not increment offset for them here.*/
nvse_local_offset = offset + hdrLen;
nvse_vendor_org_id = tvb_get_ntohl(tvb, nvse_local_offset);
proto_tree_add_item(ext_tree, hf_mip_nvse_vendor_org_id, tvb, nvse_local_offset, 4, ENC_BIG_ENDIAN);
nvse_local_offset+=4;
/* Vendor-NVSE-Value */
proto_tree_add_item(ext_tree, hf_mip_nvse_vendor_nvse_value, tvb, nvse_local_offset, ext_len - 8, ENC_NA);
next_tvb = tvb_new_subset(tvb, nvse_local_offset, ext_len-6, ext_len-6);
if (!dissector_try_uint(mip_nvse_ext_dissector_table, nvse_vendor_org_id, next_tvb, pinfo, ext_tree)){
/*Vendor NVSE Type*/
proto_tree_add_item(ext_tree, hf_mip_nvse_vendor_nvse_type, tvb, nvse_local_offset, 2, ENC_BIG_ENDIAN);
nvse_local_offset+=2;
/* Vendor-NVSE-Value */
proto_tree_add_item(ext_tree, hf_mip_nvse_vendor_nvse_value, tvb, nvse_local_offset, ext_len - 8, ENC_NA);
}
}
break;
case MF_CHALLENGE_EXT: /* RFC 3012 */
@ -888,7 +967,7 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree) {
if (tvb_reported_length_remaining(tvb, offset) > 0)
dissect_mip_extensions(tvb, offset, mip_tree);
dissect_mip_extensions(tvb, offset, mip_tree, pinfo);
}
} /* dissect_mip */
@ -1276,7 +1355,42 @@ void proto_register_mip(void)
{ "Vendor Value", "mip.ext.nvse.vendor_value",
FT_BYTES, BASE_NONE, NULL, 0,
NULL, HFILL }
}
},
{ &hf_mip_nvse_3gpp2_type ,
{ "Type", "mip.ext.nvse.3gpp2.type",
FT_UINT16, BASE_DEC, VALS(mip_nvse_3gpp2_type_vals), 0,
NULL, HFILL }
},
{ &hf_mip_nvse_3gpp2_type17_entity,
{ "Entity-Type", "mip.ext.nvse.3gpp2.type17.entity",
FT_UINT8, BASE_DEC, VALS(mip_nvse_3gpp2_type17_entity_vals), 0,
NULL, HFILL }
},
{ &hf_mip_nvse_3gpp2_type17_subtype1,
{ "Sub-Type1", "mip.ext.nvse.3gpp2.type17.subtype1",
FT_UINT8, BASE_DEC, NULL, 0,
NULL, HFILL }
},
{ &hf_mip_nvse_3gpp2_type17_length,
{ "Length", "mip.ext.nvse.3gpp2.type17.length",
FT_UINT8, BASE_DEC, NULL, 0,
NULL, HFILL }
},
{ &hf_mip_nvse_3gpp2_type17_subtype2,
{ "Sub-Type2", "mip.ext.nvse.3gpp2.type17.subtype2",
FT_UINT8, BASE_DEC, NULL, 0,
NULL, HFILL }
},
{ &hf_mip_nvse_3gpp2_type17_prim_dns,
{ "Primary DNS", "mip.ext.nvse.3gpp2.type17.prim_dns",
FT_IPv4, BASE_NONE, NULL, 0,
NULL, HFILL }
},
{ &hf_mip_nvse_3gpp2_type17_sec_dns,
{ "Secondary DNS", "mip.ext.nvse.3gpp2.type17.sec_dns",
FT_IPv4, BASE_NONE, NULL, 0,
NULL, HFILL }
},
};
/* Setup protocol subtree array */
@ -1297,6 +1411,9 @@ void proto_register_mip(void)
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_mip, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
mip_nvse_ext_dissector_table = register_dissector_table("mip.nvse_ext", "Normal Vendor/Organization Specific Extension", FT_UINT32, BASE_DEC);
}
void
@ -1307,6 +1424,10 @@ proto_reg_handoff_mip(void)
mip_handle = find_dissector("mip");
ip_handle = find_dissector("ip");
dissector_add_uint("udp.port", UDP_PORT_MIP, mip_handle);
/* Register as dissector for 3GPP2 NVSE */
dissector_add_uint("mip.nvse_ext", VENDOR_THE3GPP2, new_create_dissector_handle(dissect_mip_priv_ext_3gpp2, proto_mip));
}

View File

@ -63,6 +63,7 @@
#define VENDOR_NETSCREEN 3224
#define VENDOR_NOMADIX 3309
#define VENDOR_T_MOBILE 3414 /* Former VoiceStream Wireless, Inc. */
#define VENDOR_ZTE 3902
#define VENDOR_SIEMENS 4329
#define VENDOR_CABLELABS 4491
#define VENDOR_UNISPHERE 4874
@ -73,6 +74,7 @@
#define VENDOR_DE_TE_MOBIL 6490
#define VENDOR_QUINTUM 6618
#define VENDOR_INTERLINK 6728
#define VENDOR_CNCTC 7951
#define VENDOR_COLUBRIS 8744
#define VENDOR_ERICSSON_PKT_CORE 10923
#define VENDOR_COLUMBIA_UNIVERSITY 11862
@ -82,6 +84,7 @@
#define VENDOR_PLIXER 13745
#define VENDOR_WIFI_ALLIANCE 14122
#define VENDOR_T_SYSTEMS_NOVA 16787
#define VENDOR_CN_TGRDC 20942
#define VENDOR_CACE 32622
/* Greater than 32,767 need to be tagged unsigned. */
#define VENDOR_NTOP 35632u