Add a bunch of #defines for OSI NSAP AFI values, and use them.

Have the ISUP value_string for those AFI values show "decimal" and
"binary" indicators.

Update some references.

Change-Id: I07797455f5ffa5fa9cd4e0702a6f5db831054937
Reviewed-on: https://code.wireshark.org/review/20798
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2017-03-30 15:00:06 -07:00
parent 8bf0a57ce1
commit aa6dcf9cd3
4 changed files with 148 additions and 82 deletions

View File

@ -33,6 +33,7 @@
#include <epan/etypes.h>
#include <epan/arcnet_pids.h>
#include <epan/ax25_pids.h>
#include <epan/osi-utils.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#include <epan/proto_data.h>
@ -552,19 +553,19 @@ dissect_atm_number(tvbuff_t *tvb, packet_info* pinfo, int offset, int tl, int hf
}
static const value_string atm_nsap_afi_vals[] = {
{ 0x39, "DCC ATM format"},
{ 0xBD, "DCC ATM group format"},
{ 0x47, "ICD ATM format"},
{ 0xC5, "ICD ATM group format"},
{ 0x45, "E.164 ATM format"},
{ 0xC3, "E.164 ATM group format"},
{ 0, NULL}
{ NSAP_IDI_ISO_DCC_BIN, "DCC ATM format"},
{ NSAP_IDI_ISO_DCC_DEC_GROUP, "DCC ATM group format"},
{ NSAP_IDI_ISO_6523_ICD_BIN, "ICD ATM format"},
{ NSAP_IDI_ISO_6523_ICD_BIN_GROUP, "ICD ATM group format"},
{ NSAP_IDI_E_164_BIN, "E.164 ATM format"},
{ NSAP_IDI_E_164_BIN_GROUP, "E.164 ATM group format"},
{ 0, NULL}
};
/*
* 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()" in epan/osi=utils.c.
* "print_nsap_net()" in epan/osi-utils.c.
*/
void
dissect_atm_nsap(tvbuff_t *tvb, packet_info* pinfo, int offset, int len, proto_tree *tree)
@ -576,27 +577,27 @@ dissect_atm_nsap(tvbuff_t *tvb, packet_info* pinfo, int offset, int len, proto_t
ti = proto_tree_add_item(tree, hf_atmarp_src_atm_afi, tvb, offset, 1, ENC_BIG_ENDIAN);
switch (afi) {
case 0x39: /* DCC ATM format */
case 0xBD: /* DCC ATM group format */
proto_tree_add_item(tree, (afi == 0xBD) ? hf_atmarp_src_atm_data_country_code_group : hf_atmarp_src_atm_data_country_code,
case NSAP_IDI_ISO_DCC_BIN: /* DCC ATM format */
case NSAP_IDI_ISO_DCC_DEC_GROUP: /* DCC ATM group format */
proto_tree_add_item(tree, (afi == NSAP_IDI_ISO_DCC_DEC_GROUP) ? hf_atmarp_src_atm_data_country_code_group : hf_atmarp_src_atm_data_country_code,
tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_atmarp_src_atm_high_order_dsp, tvb, offset + 3, 10, ENC_NA);
proto_tree_add_item(tree, hf_atmarp_src_atm_end_system_identifier, tvb, offset + 13, 6, ENC_NA);
proto_tree_add_item(tree, hf_atmarp_src_atm_selector, tvb, offset + 19, 1, ENC_BIG_ENDIAN);
break;
case 0x47: /* ICD ATM format */
case 0xC5: /* ICD ATM group format */
proto_tree_add_item(tree, (afi == 0xC5) ? hf_atmarp_src_atm_international_code_designator_group : hf_atmarp_src_atm_international_code_designator,
case NSAP_IDI_ISO_6523_ICD_BIN: /* ICD ATM format */
case NSAP_IDI_ISO_6523_ICD_BIN_GROUP: /* ICD ATM group format */
proto_tree_add_item(tree, (afi == NSAP_IDI_ISO_6523_ICD_BIN_GROUP) ? hf_atmarp_src_atm_international_code_designator_group : hf_atmarp_src_atm_international_code_designator,
tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_atmarp_src_atm_high_order_dsp, tvb, offset + 3, 10, ENC_NA);
proto_tree_add_item(tree, hf_atmarp_src_atm_end_system_identifier, tvb, offset + 13, 6, ENC_NA);
proto_tree_add_item(tree, hf_atmarp_src_atm_selector, tvb, offset + 19, 1, ENC_BIG_ENDIAN);
break;
case 0x45: /* E.164 ATM format */
case 0xC3: /* E.164 ATM group format */
proto_tree_add_item(tree, (afi == 0xC3) ? hf_atmarp_src_atm_e_164_isdn_group : hf_atmarp_src_atm_e_164_isdn,
case NSAP_IDI_E_164_BIN: /* E.164 ATM format */
case NSAP_IDI_E_164_BIN_GROUP: /* E.164 ATM group format */
proto_tree_add_item(tree, (afi == NSAP_IDI_E_164_BIN_GROUP) ? hf_atmarp_src_atm_e_164_isdn_group : hf_atmarp_src_atm_e_164_isdn,
tvb, offset + 1, 8, ENC_NA);
proto_tree_add_item(tree, hf_atmarp_src_atm_high_order_dsp, tvb, offset + 9, 4, ENC_NA);
proto_tree_add_item(tree, hf_atmarp_src_atm_end_system_identifier, tvb, offset + 13, 6, ENC_NA);

View File

@ -53,6 +53,7 @@
#include <epan/asn1.h>
#include <epan/prefs.h>
#include <epan/sctpppids.h>
#include <epan/osi-utils.h>
#include <epan/reassemble.h>
#include <epan/to_str.h>
#include <epan/media_params.h>
@ -4072,73 +4073,73 @@ dissect_isup_access_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *par
/* dissect x.213 NSAP coded Address */
static const value_string x213_afi_value[] = {
{ 0x34, "IANA ICP"},
{ 0x35, "IANA ICP"},
{ 0x36, "X.121"},
{ 0x37, "X.121"},
{ 0x38, "ISO DCC"},
{ 0x39, "ISO DCC"},
{ 0x40, "F.69"},
{ 0x41, "F.69"},
{ 0x42, "E.163"},
{ 0x43, "E.163"},
{ 0x44, "E.164"},
{ 0x45, "E.164"},
{ 0x46, "ISO 6523-ICD"},
{ 0x47, "ISO 6523-ICD"},
{ 0x48, "Local"},
{ 0x49, "Local"},
{ 0x50, "Local ISO/IEC 646 character "},
{ 0x51, "Local (National character)"},
{ 0x52, "X.121"},
{ 0x53, "X.121"},
{ 0x54, "F.69"},
{ 0x55, "F.69"},
{ 0x56, "E.163"},
{ 0x57, "E.163"},
{ 0x58, "E.164"},
{ 0x59, "E.164"},
{ NSAP_IDI_IANA_ICP_DEC, "IANA ICP, decimal"},
{ NSAP_IDI_IANA_ICP_BIN, "IANA ICP, binary"},
{ NSAP_IDI_X_121_DEC, "X.121, decimal"},
{ NSAP_IDI_X_121_BIN, "X.121, binary"},
{ NSAP_IDI_ISO_DCC_DEC, "ISO DCC, decimal"},
{ NSAP_IDI_ISO_DCC_BIN, "ISO DCC, binary"},
{ NSAP_IDI_F_69_DEC, "F.69, decimal"},
{ NSAP_IDI_F_69_BIN, "F.69, binary"},
{ NSAP_IDI_E_163_DEC, "E.163, decimal"},
{ NSAP_IDI_E_163_BIN, "E.163, binary"},
{ NSAP_IDI_E_164_DEC, "E.164, decimal"},
{ NSAP_IDI_E_164_BIN, "E.164, binary"},
{ NSAP_IDI_ISO_6523_ICD_DEC, "ISO 6523-ICD, decimal"},
{ NSAP_IDI_ISO_6523_ICD_BIN, "ISO 6523-ICD, binary"},
{ NSAP_IDI_LOCAL_DEC, "Local, decimal"},
{ NSAP_IDI_LOCAL_BIN, "Local, binary"},
{ NSAP_IDI_LOCAL_ISO_646_CHAR, "Local, ISO/IEC 646 character"},
{ NSAP_IDI_LOCAL_NATIONAL_CHAR, "Local, National character"},
{ NSAP_IDI_X_121_DEC_2, "X.121, decimal"},
{ NSAP_IDI_X_121_BIN_2, "X.121, binary"},
{ NSAP_IDI_F_69_DEC_2, "F.69, decimal"},
{ NSAP_IDI_F_69_BIN_2, "F.69, binary"},
{ NSAP_IDI_E_163_DEC_2, "E.163, decimal"},
{ NSAP_IDI_E_163_BIN_2, "E.163, binary"},
{ NSAP_IDI_E_164_DEC_2, "E.164, decimal"},
{ NSAP_IDI_E_164_BIN_2, "E.164, binary"},
{ 0x76, "ITU-T IND"},
{ 0x77, "ITU-T IND"},
{ NSAP_IDI_ITU_T_IND_DEC, "ITU-T IND, decimal"},
{ NSAP_IDI_ITU_T_IND_BIN, "ITU-T IND, binary"},
{ 0xb8, "IANA ICP Group no"},
{ 0xb9, "IANA ICP Group no"},
{ 0xba, "X.121 Group no"},
{ 0xbb, "X.121 Group no"},
{ 0xbc, "ISO DCC Group no"},
{ 0xbd, "ISO DCC Group no"},
{ 0xbe, "F.69 Group no"},
{ 0xbf, "F.69 Group no"},
{ 0xc0, "E.163 Group no"},
{ 0xc1, "E.163 Group no"},
{ 0xc2, "E.164 Group no"},
{ 0xc3, "E.164 Group no"},
{ 0xc4, "ISO 6523-ICD Group no"},
{ 0xc5, "ISO 6523-ICD Group no"},
{ 0xc6, "Local Group no"},
{ 0xc7, "Local Group no"},
{ 0xc8, "Local ISO/IEC 646 character Group no"},
{ 0xc9, "Local (National character) Group no"},
{ 0xca, "X.121 Group no"},
{ 0xcb, "X.121 Group no"},
{ 0xcd, "F.69 Group no"},
{ 0xce, "F.69 Group no"},
{ 0xcf, "E.163 Group no"},
{ 0xd0, "E.164 Group no"},
{ 0xd1, "E.164 Group no"},
{ 0xde, "E.163 Group no"},
{ NSAP_IDI_IANA_ICP_DEC_GROUP, "IANA ICP Group no, decimal"},
{ NSAP_IDI_IANA_ICP_BIN_GROUP, "IANA ICP Group no, binary"},
{ NSAP_IDI_X_121_DEC_GROUP, "X.121 Group no, decimal"},
{ NSAP_IDI_X_121_BIN_GROUP, "X.121 Group no, binary"},
{ NSAP_IDI_ISO_DCC_DEC_GROUP, "ISO DCC Group no, decimal"},
{ NSAP_IDI_ISO_DCC_BIN_GROUP, "ISO DCC Group no, binary"},
{ NSAP_IDI_F_69_DEC_GROUP, "F.69 Group no, decimal"},
{ NSAP_IDI_F_69_BIN_GROUP, "F.69 Group no, binary"},
{ NSAP_IDI_E_163_DEC_GROUP, "E.163 Group no, decimal"},
{ NSAP_IDI_E_163_BIN_GROUP, "E.163 Group no, binary"},
{ NSAP_IDI_E_164_DEC_GROUP, "E.164 Group no, decimal"},
{ NSAP_IDI_E_164_BIN_GROUP, "E.164 Group no, binary"},
{ NSAP_IDI_ISO_6523_ICD_DEC_GROUP, "ISO 6523-ICD Group no, decimal"},
{ NSAP_IDI_ISO_6523_ICD_BIN_GROUP, "ISO 6523-ICD Group no, binary"},
{ NSAP_IDI_LOCAL_DEC_GROUP, "Local Group no, decimal"},
{ NSAP_IDI_LOCAL_BIN_GROUP, "Local Group no, binary"},
{ NSAP_IDI_LOCAL_ISO_646_CHAR_GROUP, "Local Group no, ISO/IEC 646 character"},
{ NSAP_IDI_LOCAL_NATIONAL_CHAR_GROUP, "Local Group no, national character"},
{ NSAP_IDI_X_121_DEC_2_GROUP, "X.121 Group no, decimal"},
{ NSAP_IDI_X_121_BIN_2_GROUP, "X.121 Group no, binary"},
{ NSAP_IDI_X_121_DEC_2_GROUP, "F.69 Group no, decimal"},
{ NSAP_IDI_X_121_BIN_2_GROUP, "F.69 Group no, binary"},
{ NSAP_IDI_E_163_DEC_2_GROUP, "E.163 Group no, decimal"},
{ NSAP_IDI_E_163_BIN_2_GROUP, "E.163 Group no, binary"},
{ NSAP_IDI_E_164_DEC_2_GROUP, "E.164 Group no, decimal"},
{ NSAP_IDI_E_164_BIN_2_GROUP, "E.163 Group no, binary"},
{ 0xe2, "ITU-T IND Group no"},
{ 0xe3, "ITU-T IND Group no"},
{ NSAP_IDI_ITU_T_IND_DEC_GROUP, "ITU-T IND Group no, decimal"},
{ NSAP_IDI_ITU_T_IND_BIN_GROUP, "ITU-T IND Group no, binary"},
{ 0, NULL }
};
value_string_ext x213_afi_value_ext = VALUE_STRING_EXT_INIT(x213_afi_value);
/* 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 */
/* RFC 4548 at */
/* https://tools.ietf.org/html/rfc4548 */
static const value_string iana_icp_values[] = {
{ 0x0, "IP Version 6 Address"},
{ 0x1, "IP Version 4 Address"},
@ -4159,7 +4160,7 @@ dissect_nsap(tvbuff_t *parameter_tvb, gint offset, gint len, proto_tree *paramet
afi = tvb_get_guint8(parameter_tvb, offset);
switch (afi) {
case 0x35: /* IANA ICP Binary fortmat*/
case NSAP_IDI_IANA_ICP_BIN: /* IANA ICP Binary fortmat*/
proto_tree_add_item(parameter_tree, hf_isup_idp, parameter_tvb, offset, 3, ENC_NA);
proto_tree_add_uint(parameter_tree, hf_afi, parameter_tvb, offset, 1, afi);
@ -4179,7 +4180,7 @@ dissect_nsap(tvbuff_t *parameter_tvb, gint offset, gint len, proto_tree *paramet
}
break;
case 0x45: /* E.164 ATM format */
case NSAP_IDI_E_164_BIN: /* E.164 ATM format */
case 0xC3: /* E.164 ATM group format */
proto_tree_add_item(parameter_tree, hf_isup_idp, parameter_tvb, offset, 9, ENC_NA);

View File

@ -167,8 +167,8 @@ print_area_buf(const guint8 *ad, int length, gchar *buf, int buf_len)
}
cur = buf;
if ( ( ( NSAP_IDI_ISODCC == *ad )
|| ( NSAP_IDI_GOSIP2 == *ad )
if ( ( ( NSAP_IDI_ISO_DCC_BIN == *ad )
|| ( NSAP_IDI_ISO_6523_ICD_BIN == *ad )
)
&&
( ( RFC1237_FULLAREA_LEN == length )
@ -177,7 +177,7 @@ print_area_buf(const guint8 *ad, int length, gchar *buf, int buf_len)
) { /* AFI is good and length is long enough */
/* there used to be a check for (length > RFC1237_FULLAREA_LEN + 1) here,
* in order to report an invalied length of AREA for DCC / GOSIP AFI,
* in order to report an invalied length of AREA for DCC / ISO 6523 AFI,
* but that can *never* be the case because the if() test above explicitly
* tests for (length == RFC1237_FULLAREA_LEN) or (length == RFC1237_FULLAREA_LEN + 1)
*/

View File

@ -42,8 +42,72 @@
#define RFC1237_RD_LEN 2
#define RFC1237_AREA_LEN 3
#define NSAP_IDI_ISODCC 0x39
#define NSAP_IDI_GOSIP2 0x47
/*
* NSAP AFI values.
*
* Individual values.
*/
#define NSAP_IDI_IANA_ICP_DEC 0x34 /* IANA ICP, decimal */
#define NSAP_IDI_IANA_ICP_BIN 0x35 /* IANA ICP, binary */
#define NSAP_IDI_X_121_DEC 0x36 /* X.121, decimal */
#define NSAP_IDI_X_121_BIN 0x37 /* X.121, binary */
#define NSAP_IDI_ISO_DCC_DEC 0x38 /* ISO DCC, decimal */
#define NSAP_IDI_ISO_DCC_BIN 0x39 /* ISO DCC, binary */
#define NSAP_IDI_F_69_DEC 0x40 /* F.69, decimal */
#define NSAP_IDI_F_69_BIN 0x41 /* F.69, binary */
#define NSAP_IDI_E_163_DEC 0x42 /* E.163, decimal */
#define NSAP_IDI_E_163_BIN 0x43 /* E.163, binary */
#define NSAP_IDI_E_164_DEC 0x44 /* E.163, decimal */
#define NSAP_IDI_E_164_BIN 0x45 /* E.163, binary */
#define NSAP_IDI_ISO_6523_ICD_DEC 0x46 /* ISO 6523-ICD, decimal */
#define NSAP_IDI_ISO_6523_ICD_BIN 0x47 /* ISO 6523-ICD, binary */
//#define NSAP_IDI_GOSIP2 0x47
#define NSAP_IDI_LOCAL_DEC 0x48 /* Local, decimal */
#define NSAP_IDI_LOCAL_BIN 0x49 /* Local, decimal */
#define NSAP_IDI_LOCAL_ISO_646_CHAR 0x50 /* Local, ISO/IEC 646 character */
#define NSAP_IDI_LOCAL_NATIONAL_CHAR 0x51 /* Local, national character */
#define NSAP_IDI_X_121_DEC_2 0x52 /* X.121, decimal */
#define NSAP_IDI_X_121_BIN_2 0x53 /* X.121, binary */
#define NSAP_IDI_F_69_DEC_2 0x54 /* F.69, decimal */
#define NSAP_IDI_F_69_BIN_2 0x55 /* F.69, binary */
#define NSAP_IDI_E_163_DEC_2 0x56 /* E.163, decimal */
#define NSAP_IDI_E_163_BIN_2 0x57 /* E.163, binary */
#define NSAP_IDI_E_164_DEC_2 0x58 /* E.163, decimal */
#define NSAP_IDI_E_164_BIN_2 0x59 /* E.163, binary */
#define NSAP_IDI_ITU_T_IND_DEC 0x76 /* ITU-T IND, decimal */
#define NSAP_IDI_ITU_T_IND_BIN 0x77 /* ITU-T IND, binary */
/*
* Group values.
*/
#define NSAP_IDI_IANA_ICP_DEC_GROUP 0xB8 /* IANA ICP, decimal */
#define NSAP_IDI_IANA_ICP_BIN_GROUP 0xB9 /* IANA ICP, binary */
#define NSAP_IDI_X_121_DEC_GROUP 0xBA /* X.121, decimal */
#define NSAP_IDI_X_121_BIN_GROUP 0xBB /* X.121, binary */
#define NSAP_IDI_ISO_DCC_DEC_GROUP 0xBC /* ISO DCC, decimal */
#define NSAP_IDI_ISO_DCC_BIN_GROUP 0xBD /* ISO DCC, binary */
#define NSAP_IDI_F_69_DEC_GROUP 0xBE /* F.69, decimal */
#define NSAP_IDI_F_69_BIN_GROUP 0xBF /* F.69, binary */
#define NSAP_IDI_E_163_DEC_GROUP 0xC0 /* E.163, decimal */
#define NSAP_IDI_E_163_BIN_GROUP 0xC1 /* E.163, binary */
#define NSAP_IDI_E_164_DEC_GROUP 0xC2 /* E.163, decimal */
#define NSAP_IDI_E_164_BIN_GROUP 0xC3 /* E.163, binary */
#define NSAP_IDI_ISO_6523_ICD_DEC_GROUP 0xC4 /* ISO 6523-ICD, decimal */
#define NSAP_IDI_ISO_6523_ICD_BIN_GROUP 0xC5 /* ISO 6523-ICD, binary */
#define NSAP_IDI_LOCAL_DEC_GROUP 0xC6 /* Local, decimal */
#define NSAP_IDI_LOCAL_BIN_GROUP 0xC7 /* Local, decimal */
#define NSAP_IDI_LOCAL_ISO_646_CHAR_GROUP 0xC8 /* Local, ISO/IEC 646 character */
#define NSAP_IDI_LOCAL_NATIONAL_CHAR_GROUP 0xC9 /* Local, national character */
#define NSAP_IDI_X_121_DEC_2_GROUP 0xCA /* X.121, decimal */
#define NSAP_IDI_X_121_BIN_2_GROUP 0xCB /* X.121, binary */
#define NSAP_IDI_F_69_DEC_2_GROUP 0xCC /* F.69, decimal */
#define NSAP_IDI_F_69_BIN_2_GROUP 0xCD /* F.69, binary */
#define NSAP_IDI_E_163_DEC_2_GROUP 0xCE /* E.163, decimal */
#define NSAP_IDI_E_163_BIN_2_GROUP 0xCF /* E.163, binary */
#define NSAP_IDI_E_164_DEC_2_GROUP 0xD0 /* E.163, decimal */
#define NSAP_IDI_E_164_BIN_2_GROUP 0xD1 /* E.163, binary */
#define NSAP_IDI_ITU_T_IND_DEC_GROUP 0xE2 /* ITU-T IND, decimal */
#define NSAP_IDI_ITU_T_IND_BIN_GROUP 0xE3 /* ITU-T IND, binary */
gchar* print_nsap_net ( tvbuff_t *, const gint, int );
gchar* print_area ( tvbuff_t *, const gint, int );