The previous checkin for packet-isup.c was accidentally checked in along

with some unrelated changes; it got rid of some calls to get IPv4/IPv6
addresses and add them to the protocol tree, replacing them with
proto_tree_add_item() calls, and fixed up the length of one protocol
tree item.

Note that we have (at least) three count 'em three different routines
for dissecting/displaying NSAPs (there might be more - I might have
missed some), and suggest that we might want to reduce that to one.

Update the URL for ICP values for IPv{4,6} addresses inside NSAPs.

Fix the offset in the call to add the IPv6 address part of an NSAP
containing such an address, and the length in the call adding the DSP
for an NSAP containing an IPv4 address.

Fix up indentation a bit.

svn path=/trunk/; revision=15766
This commit is contained in:
Guy Harris 2005-09-12 07:44:11 +00:00
parent fec9c0ec2b
commit 346e5e211c
3 changed files with 62 additions and 46 deletions

View File

@ -296,6 +296,11 @@ dissect_atm_number(tvbuff_t *tvb, int offset, int tl, int hf_e164,
}
}
/*
* XXX - shouldn't there be a centralized routine for dissecting NSAPs?
* See also "dissect_nsap()" in epan/dissectors/packet-isup.c and
* "print_nsap_net_buf()" and "print_nsap_net()" in epan/osi=utils.c.
*/
void
dissect_atm_nsap(tvbuff_t *tvb, int offset, int len, proto_tree *tree)
{

View File

@ -1939,14 +1939,20 @@ static const value_string x213_afi_value[] = {
};
/* Up-to-date information on the allocated ICP values can be found at: */
/*http://www.iana.org/assignments/osi-nsapanumbers. */
/* Up-to-date information on the allocated ICP values can be found in */
/*draft-gray-rfc1888bis-01 at */
/*http://www.ietf.org/internet-drafts/draft-gray-rfc1888bis-01.txt */
static const value_string iana_icp_values[] = {
{ 0x0, "IP Version 6 Address"},
{ 0x1, "IP Version 4 Address"},
{ 0, NULL }
};
/*
* XXX - shouldn't there be a centralized routine for dissecting NSAPs?
* See also "dissect_atm_nsap()" in epan/dissectors/packet-arp.c and
* "print_nsap_net_buf()" and "print_nsap_net()" in epan/osi_utils.c.
*/
void
dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter_tree)
{
@ -1968,12 +1974,13 @@ dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter
if ( icp == 0 ){ /* IPv6 addr */
proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2 , 17,
"DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
proto_tree_add_item(parameter_tree, hf_nsap_ipv6_addr, parameter_tvb, offset,
proto_tree_add_item(parameter_tree, hf_nsap_ipv6_addr, parameter_tvb, offset + 2,
16, FALSE);
}
else { /* IPv4 addr */
proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2 , 3,
/* XXX - this is really only for ICP 1 */
proto_tree_add_text(parameter_tree, parameter_tvb, offset + 2, 17,
"DSP = %s", tvb_bytes_to_str(parameter_tvb, offset + 2, 17));
proto_tree_add_item(parameter_tree, hf_nsap_ipv4_addr, parameter_tvb, offset + 2, 4, FALSE);
}
@ -1998,27 +2005,27 @@ dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter
}
cc = tvb_get_ntohs(parameter_tvb, cc_offset);
if (( address_digit_pair & 0xf0 ) != 0 )
cc = cc >> 4;
cc = cc >> 4;
switch ( cc & 0x0f00 ) {
case 0x0 : cc_length = 1;
break;
break;
case 0x0100 : cc_length = 1;
break;
break;
case 0x0200 :
switch ( cc & 0x00f0 ) {
switch ( cc & 0x00f0 ) {
case 0 :
case 7 : cc_length = 2;
break;
break;
default : cc_length = 3;
}
break;
break;
case 0x0300 :
switch ( cc & 0x00f0 ) {
switch ( cc & 0x00f0 ) {
case 0 :
case 1 :
case 2 :
@ -2026,56 +2033,56 @@ dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter
case 4 :
case 6 :
case 9 : cc_length = 2;
break;
break;
default : cc_length = 3;
break;
break;
}
break;
break;
case 0x0400 :
switch ( cc & 0x00f0 ) {
switch ( cc & 0x00f0 ) {
case 2 : cc_length = 3;
break;
break;
default : cc_length = 2;
break;
break;
}
break;
break;
case 0x0500 :
switch ( cc & 0x00f0 ) {
switch ( cc & 0x00f0 ) {
case 0 :
case 9 : cc_length = 3;
break;
break;
default : cc_length = 2;
break;
break;
}
break;
break;
case 0x0600 :
switch ( cc & 0x00f0 ) {
switch ( cc & 0x00f0 ) {
case 7 :
case 8 :
case 9 : cc_length = 3;
break;
break;
default : cc_length = 2;
break;
break;
}
break;
break;
case 0x0700 : cc_length = 1;
break;
break;
case 0x0800 :
switch ( cc & 0x00f0 ) {
switch ( cc & 0x00f0 ) {
case 1 :
case 2 :
case 4 :
case 6 : cc_length = 2;
break;
break;
default : cc_length = 3;
break;
break;
}
break;
break;
case 0x0900 :
switch ( cc & 0x00f0 ) {
@ -2086,41 +2093,40 @@ dissect_nsap(tvbuff_t *parameter_tvb,gint offset,gint len, proto_tree *parameter
case 4 :
case 5 :
case 8 : cc_length = 2;
break;
break;
default : cc_length = 3;
break;
break;
}
break;
break;
default: ;
}/* End switch cc */
switch ( cc_length ) {
case 0x1 : cc = cc >> 8;
length = 1;
break;
break;
case 0x2 : cc = cc >> 4;
length = 1;
break;
break;
default: length = 2;
break;
break;
}/* end switch cc_length */
proto_tree_add_text(parameter_tree,parameter_tvb, cc_offset, length,"Country Code: %x %s length %u",cc,
val_to_str(cc,E164_country_code_value,"unknown (%x)"),cc_length);
switch ( cc ) {
case 0x882 :
id_code = tvb_get_ntohs(parameter_tvb, cc_offset + 1);
id_code = (id_code & 0x0fff) >> 4;
proto_tree_add_text(parameter_tree,parameter_tvb, (cc_offset + 1), 2,"Identification Code: %x %s ",id_code,
val_to_str(id_code,E164_International_Networks_vals,"unknown (%x)"));
case 0x882 :
id_code = tvb_get_ntohs(parameter_tvb, cc_offset + 1);
id_code = (id_code & 0x0fff) >> 4;
proto_tree_add_text(parameter_tree,parameter_tvb, (cc_offset + 1), 2,"Identification Code: %x %s ",id_code,
val_to_str(id_code,E164_International_Networks_vals,"unknown (%x)"));
break;
default:;
}
default:;
}
proto_tree_add_text(parameter_tree,parameter_tvb, cc_offset, length,"DSP length %u(len %u -9 )",(len-9),len );
proto_tree_add_item(parameter_tree, hf_bicc_nsap_dsp, parameter_tvb, offset + 8, (len - 9),FALSE);
break;
break;
default:
proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, len, afi );
}/* end switch afi */

View File

@ -36,6 +36,11 @@
#include "osi-utils.h"
#include "emem.h"
/*
* XXX - shouldn't there be a centralized routine for dissecting NSAPs?
* See also "dissect_atm_nsap()" in epan/dissectors/packet-arp.c and
* "dissect_nsap()" in epan/dissectors/packet-isup.c.
*/
gchar *
print_nsap_net( const guint8 *ad, int length )
{