aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2004-10-08 09:35:56 +0000
committerAnders Broman <anders.broman@ericsson.com>2004-10-08 09:35:56 +0000
commit249ebcbfc15a3907aa48d720a90155001242070f (patch)
tree33773f0d0e5603c30bd75a66844acb76232999bf /epan
parent2486f4fa9083b109e3b6e3879b525c12e81078ad (diff)
downloadwireshark-249ebcbfc15a3907aa48d720a90155001242070f.tar.gz
wireshark-249ebcbfc15a3907aa48d720a90155001242070f.tar.bz2
wireshark-249ebcbfc15a3907aa48d720a90155001242070f.zip
From: "Jacques, Olivier :
- Added new RFC 3588 header format support (vendor-Id is replaced by application-Id) and command code has its own separated name space. The Draft v16 behaviour is maintained (through Preferences menu). - Added 3GPP IMS Cx/Dx interface decoding (new imscxdx.xml) - Fixed some issues in dictionary.xml - Refreshed Diameter applications in embedded AVPs (that do not rely on XML dictionary) svn path=/trunk/; revision=12235
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-diameter-defs.h37
-rw-r--r--epan/dissectors/packet-diameter.c151
2 files changed, 160 insertions, 28 deletions
diff --git a/epan/dissectors/packet-diameter-defs.h b/epan/dissectors/packet-diameter-defs.h
index a8a540a3c9..37dd7035a8 100644
--- a/epan/dissectors/packet-diameter-defs.h
+++ b/epan/dissectors/packet-diameter-defs.h
@@ -15,6 +15,7 @@
* http://www.ietf.org/internet-drafts/draft-ietf-aaa-diameter-mobileip-16.txt
* http://www.ietf.org/internet-drafts/draft-ietf-aaa-diameter-sip-app-01.txt
* http://www.ietf.org/html.charters/aaa-charter.html
+ * http://www.iana.org/assignments/aaa-parameters
*/
#ifndef _PACKET_DIAMETER_DEFS_H
@@ -343,14 +344,17 @@ static const value_string diameter_mip_replay_type[] = {
{3, "Timestamp"},
{0, NULL}
};
-/* XXX TODO correct these values to IANA assigned ones */
+
static const value_string diameter_application_id_vals[] = {
+ {0, "Diameter Common Messages"},
{1, "Diameter NASREQ Application"},
{2, "Diameter Mobile IPv4 Application"},
- {4, "Diameter Credit-Control Application"},
-/* {x, "Diameter Session Initiation Protocol (SIP) Application"},
- */
- {2000, "Diameter EAP Application"},
+ {3, "Diameter Base Accounting"},
+ {16777216, "3GPP Cx"},
+ {16777217, "3GPP Sh"},
+ {16777218, "3GPP Rf/Ro"},
+ {4294967295, "Relay Application"},
+
{0, NULL}
};
@@ -512,6 +516,26 @@ static const value_string diameter_result_code_vals[] = {
{0, NULL}
};
+static const value_string diameter_exp_result_code_vals[] = {
+ {2001, "DIAMETER_FIRST_REGISTRATION"},
+ {2002, "DIAMETER_SUBSEQUENT_REGISTRATION"},
+ {2003, "DIAMETER_UNREGISTERED_SERVICE"},
+ {2004, "DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED"},
+ {2005, "DIAMETER_SERVER_SELECTION"},
+ {5001, "DIAMETER_ERROR_USER_UNKNOWN"},
+ {5002, "DIAMETER_ERROR_IDENTITIES_DONT_MATCH"},
+ {5003, "DIAMETER_ERROR_IDENTITY_NOT_REGISTERED"},
+ {5004, "DIAMETER_ERROR_ROAMING_NOT_ALLOWED"},
+ {5005, "DIAMETER_ERROR_ROAMING_IDENTITY_ALREADY_REGISTERED"},
+ {5006, "DIAMETER_ERROR_ROAMING_AUTH_SCHEME_NOT_SUPPORTED"},
+ {5007, "DIAMETER_ERROR_IN_ASSIGNMENT_TYPE"},
+ {5008, "DIAMETER_ERROR_TOO_MUCH_DATA"},
+ {5009, "DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA"},
+
+ {0, NULL}
+};
+
+
static struct old_avp_info old_diameter_avps[] = {
/* Radius Attributes */
@@ -664,6 +688,9 @@ static struct old_avp_info old_diameter_avps[] = {
{ 295, "Termination-Cause", DIAMETER_ENUMERATED, diameter_termination_cause_vals},
{ 266, "Vendor-Id", DIAMETER_ENUMERATED, sminmpec_values},
{ 260, "Vendor-Specific-Application-Id", DIAMETER_GROUPED, (value_string *)NULL},
+ { 297, "Experimental-Result", DIAMETER_GROUPED, (value_string *)NULL},
+ { 298, "Experimental-Result-Code", DIAMETER_ENUMERATED, diameter_exp_result_code_vals},
+
/* Diameter Mobile IP AVPs */
{ 318, "MIP-FA-to-HA-SPI", DIAMETER_UNSIGNED32, (value_string *)NULL},
{ 319, "MIP-FA-to-MN-SPI", DIAMETER_UNSIGNED32, (value_string *)NULL},
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index b6922fb673..3e33e243ca 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -33,6 +33,7 @@
* http://www.ietf.org/html.charters/aaa-charter.html
* http://www.iana.org/assignments/address-family-numbers
* http://www.iana.org/assignments/enterprise-numbers
+ * http://www.iana.org/assignments/aaa-parameters
*/
#ifdef HAVE_CONFIG_H
@@ -84,7 +85,7 @@ typedef enum {
DIAMETER_QOS_FILTER_RULE, /* OctetString */
DIAMETER_MIP_REG_REQ, /* OctetString */
DIAMETER_VENDOR_ID, /* Integer32 */
- DIAMETER_APPLICATION_ID,
+ DIAMETER_APPLICATION_ID, /* Integer32 */
DIAMETER_URI, /* OctetString */
DIAMETER_SESSION_ID /* OctetString */
@@ -184,6 +185,7 @@ static int hf_diameter_hopbyhopid =-1;
static int hf_diameter_endtoendid =-1;
static int hf_diameter_version = -1;
static int hf_diameter_vendor_id = -1;
+static int hf_diameter_application_id = -1;
static int hf_diameter_flags = -1;
static int hf_diameter_flags_request = -1;
static int hf_diameter_flags_proxyable = -1;
@@ -240,13 +242,21 @@ static gboolean suppress_console_output = TRUE;
#define DICT_FN "diameter/dictionary.xml"
static gchar *gbl_diameterDictionary;
-typedef struct _e_diameterhdr {
+typedef struct _e_diameterhdr_v16 {
guint32 versionLength;
guint32 flagsCmdCode;
guint32 vendorId;
guint32 hopByHopId;
guint32 endToEndId;
-} e_diameterhdr;
+} e_diameterhdr_v16;
+
+typedef struct _e_diameterhdr_rfc {
+ guint32 versionLength;
+ guint32 flagsCmdCode;
+ guint32 applicationId;
+ guint32 hopByHopId;
+ guint32 endToEndId;
+} e_diameterhdr_rfc;
typedef struct _e_avphdr {
guint32 avp_code;
@@ -285,7 +295,7 @@ typedef struct _e_avphdr {
#define AVP_FLAGS_RESERVED 0x1f /* 00011111 -- V M P X X X X X */
#define MIN_AVP_SIZE (sizeof(e_avphdr) - sizeof(guint32))
-#define MIN_DIAMETER_SIZE (sizeof(e_diameterhdr))
+#define MIN_DIAMETER_SIZE (sizeof(e_diameterhdr_rfc))
static Version_Type gbl_version = DIAMETER_RFC;
@@ -343,8 +353,7 @@ xmlParseFilePush( char *filename, int checkValid) {
* only called when the XML dictionary fails to load properly.
*/
static int
-addStaticAVP(int code, gchar *name, diameterDataType type,
- const value_string *values)
+addStaticAVP(int code, gchar *name, diameterDataType type, const value_string *values)
{
avpInfo *entry;
ValueName *vEntry=NULL;
@@ -778,6 +787,7 @@ initializeDictionaryDefaults(void)
addVendor(sminmpec_values[i].value,
sminmpec_values[i].strptr,
sminmpec_values[i].strptr);
+
}
/* Add static commands to list. */
for(i=0; diameter_command_code_vals[i].strptr; i++) {
@@ -850,6 +860,9 @@ diameter_command_to_str(guint32 commandCode, guint32 vendorId)
static gchar buffer[64];
gchar *vendorName=NULL;
+ switch(gbl_version) {
+ case DIAMETER_V16:
+ /* In draft-v16 version, command code is depending on vendorID */
if (vendorId)
vendorName = diameter_vendor_to_str(vendorId, FALSE);
@@ -878,24 +891,39 @@ diameter_command_to_str(guint32 commandCode, guint32 vendorId)
commandCode, vendorId);
snprintf(buffer, sizeof(buffer),
"Cmd-0x%08x", commandCode);
+ break;
+ case DIAMETER_RFC:
+ /* In RFC3588 version, command code is independant on vendorID */
+ for (probe=commandListHead; probe; probe=probe->next) {
+ if (commandCode == probe->code) {
+ /* We found it */
+ return probe->name;
+ }
+ }
+ if ( suppress_console_output == FALSE )
+ g_warning("Diameter: Unable to find name for command code 0x%08x!",
+ commandCode);
+ snprintf(buffer, sizeof(buffer),
+ "Cmd-0x%08x", commandCode);
+ break;
+ }
return buffer;
}/*diameter_command_to_str */
/* return application string, based on the id */
static gchar *
-diameter_app_to_str(guint32 vendorId) {
+diameter_app_to_str(guint32 appId) {
ApplicationId *probe;
static gchar buffer[64];
for (probe=ApplicationIdHead; probe; probe=probe->next) {
- if (vendorId == probe->id) {
+ if (appId == probe->id) {
return probe->name;
}
}
- snprintf(buffer, sizeof(buffer),
- "AppId 0x%08x", vendorId);
+ snprintf(buffer, sizeof(buffer), "Unknown");
return buffer;
} /*diameter_app_to_str */
@@ -1044,17 +1072,18 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *flags_tree;
tvbuff_t *avp_tvb;
proto_tree *diameter_tree;
- e_diameterhdr dh;
+ e_diameterhdr_v16 dh;
+ e_diameterhdr_rfc dh2;
int offset=0;
- size_t avplength;
+ size_t avplength=0;
proto_tree *avp_tree;
proto_item *avptf;
int BadPacket = FALSE;
- guint32 commandCode, pktLength;
- guint8 version, flags;
+ guint32 commandCode=0, pktLength=0;
+ guint8 version=0, flags=0;
gchar flagstr[64] = "<None>";
gchar *fstr[] = {"RSVD7", "RSVD6", "RSVD5", "RSVD4", "RSVD3", "Error", "Proxyable", "Request" };
- gchar commandString[64], vendorName[64];
+ gchar commandString[64], vendorName[64], applicationName[64];
gint i;
guint bpos;
static int initialized=FALSE;
@@ -1076,28 +1105,49 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO);
/* Copy our header */
+ switch(gbl_version) {
+ case DIAMETER_V16:
tvb_memcpy(tvb, (guint8*) &dh, offset, sizeof(dh));
-
/* Fix byte ordering in our static structure */
dh.versionLength = g_ntohl(dh.versionLength);
dh.flagsCmdCode = g_ntohl(dh.flagsCmdCode);
dh.vendorId = g_ntohl(dh.vendorId);
dh.hopByHopId = g_ntohl(dh.hopByHopId);
dh.endToEndId = g_ntohl(dh.endToEndId);
-
if (dh.vendorId) {
strcpy(vendorName,
diameter_vendor_to_str(dh.vendorId, TRUE));
} else {
strcpy(vendorName, "None");
}
-
-
/* Do the bit twiddling */
version = DIAM_GET_VERSION(dh);
pktLength = DIAM_GET_LENGTH(dh);
flags = DIAM_GET_FLAGS(dh);
commandCode = DIAM_GET_COMMAND(dh);
+ break;
+ case DIAMETER_RFC:
+ tvb_memcpy(tvb, (guint8*) &dh2, offset, sizeof(dh2));
+ /* Fix byte ordering in our static structure */
+ dh2.versionLength = g_ntohl(dh2.versionLength);
+ dh2.flagsCmdCode = g_ntohl(dh2.flagsCmdCode);
+ dh2.applicationId = g_ntohl(dh2.applicationId);
+ dh2.hopByHopId = g_ntohl(dh2.hopByHopId);
+ dh2.endToEndId = g_ntohl(dh2.endToEndId);
+ if (dh2.applicationId) {
+ strcpy(applicationName,
+ diameter_app_to_str(dh2.applicationId));
+ } else {
+ strcpy(applicationName, "None");
+ }
+ /* Do the bit twiddling */
+ version = DIAM_GET_VERSION(dh2);
+ pktLength = DIAM_GET_LENGTH(dh2);
+ flags = DIAM_GET_FLAGS(dh2);
+ commandCode = DIAM_GET_COMMAND(dh2);
+ break;
+ }
+
/* Set up our flags */
if (check_col(pinfo->cinfo, COL_INFO) || tree) {
@@ -1117,7 +1167,16 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* Set up our commandString */
+ switch(gbl_version) {
+ case DIAMETER_V16:
strcpy(commandString, diameter_command_to_str(commandCode, dh.vendorId));
+ break;
+ case DIAMETER_RFC:
+ /* FIXME: in RFC, is applicationID needed to decode the command code? */
+ strcpy(commandString, diameter_command_to_str(commandCode, dh2.applicationId));
+ break;
+ }
+
if (flags & DIAM_FLAGS_R)
strcat(commandString, "-Request");
else
@@ -1141,6 +1200,8 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if (check_col(pinfo->cinfo, COL_INFO)) {
+ switch(gbl_version) {
+ case DIAMETER_V16:
col_add_fstr(pinfo->cinfo, COL_INFO,
"%s%s%s%s%s vendor=%s (hop-id=%u) (end-id=%u) RPE=%d%d%d",
(BadPacket)?"***** Bad Packet!: ":"",
@@ -1154,6 +1215,23 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
(flags & DIAM_FLAGS_R)?1:0,
(flags & DIAM_FLAGS_P)?1:0,
(flags & DIAM_FLAGS_E)?1:0);
+ break;
+ case DIAMETER_RFC:
+ col_add_fstr(pinfo->cinfo, COL_INFO,
+ "%s%s%s%s%s app=%s (hop-id=%u) (end-id=%u) RPE=%d%d%d",
+ (BadPacket)?"***** Bad Packet!: ":"",
+ (flags & DIAM_FLAGS_P)?"Proxyable ":"",
+ (flags & DIAM_FLAGS_E)?" Error":"",
+ ((BadPacket ||
+ (flags & (DIAM_FLAGS_P|DIAM_FLAGS_E))) ?
+ ": " : ""),
+ commandString, applicationName,
+ dh2.hopByHopId, dh2.endToEndId,
+ (flags & DIAM_FLAGS_R)?1:0,
+ (flags & DIAM_FLAGS_P)?1:0,
+ (flags & DIAM_FLAGS_E)?1:0);
+ break;
+ }
}
@@ -1201,20 +1279,37 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, offset, 3, commandCode, "Command Code: %s", commandString);
offset += 3;
+ switch(gbl_version) {
+ case DIAMETER_V16:
/* Vendor Id */
proto_tree_add_uint_format(diameter_tree,hf_diameter_vendor_id,
tvb, offset, 4, dh.vendorId, "Vendor-Id: %s", vendorName);
offset += 4;
-
/* Hop-by-hop Identifier */
proto_tree_add_uint(diameter_tree, hf_diameter_hopbyhopid,
tvb, offset, 4, dh.hopByHopId);
offset += 4;
-
/* End-to-end Identifier */
proto_tree_add_uint(diameter_tree, hf_diameter_endtoendid,
tvb, offset, 4, dh.endToEndId);
offset += 4;
+ break;
+ case DIAMETER_RFC:
+ /* Application Id */
+ proto_tree_add_uint_format(diameter_tree,hf_diameter_application_id,
+ tvb, offset, 4, dh2.applicationId, "Application-Id: %s", applicationName);
+ offset += 4;
+ /* Hop-by-hop Identifier */
+ proto_tree_add_uint(diameter_tree, hf_diameter_hopbyhopid,
+ tvb, offset, 4, dh2.hopByHopId);
+ offset += 4;
+ /* End-to-end Identifier */
+ proto_tree_add_uint(diameter_tree, hf_diameter_endtoendid,
+ tvb, offset, 4, dh2.endToEndId);
+ offset += 4;
+ break;
+ }
+
/* If we have a bad packet, don't bother trying to parse the AVPs */
if (BadPacket) {
@@ -1225,7 +1320,14 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Make the next tvbuff */
/* Update the lengths */
- avplength= pktLength - sizeof(e_diameterhdr);
+ switch(gbl_version) {
+ case DIAMETER_V16:
+ avplength= pktLength - sizeof(e_diameterhdr_v16);
+ break;
+ case DIAMETER_RFC:
+ avplength= pktLength - sizeof(e_diameterhdr_rfc);
+ break;
+ }
avp_tvb = tvb_new_subset(tvb, offset, avplength, avplength);
avptf = proto_tree_add_text(diameter_tree,
@@ -1510,7 +1612,7 @@ static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree
if (flags & AVP_FLAGS_V) {
proto_tree_add_uint_format(avpi_tree, hf_diameter_avp_vendor_id,
- tvb, offset, 4, vendorId, vendorName);
+ tvb, offset, 4, vendorId, "Vendor-Id: %s", vendorName);
offset += 4;
}
@@ -1845,6 +1947,9 @@ proto_register_diameter(void)
{ &hf_diameter_vendor_id,
{ "VendorId", "diameter.vendorId", FT_UINT32, BASE_DEC, NULL,
0x0,"", HFILL }},
+ { &hf_diameter_application_id,
+ { "ApplicationId", "diameter.applicationId", FT_UINT32, BASE_DEC, NULL,
+ 0x0,"", HFILL }},
{ &hf_diameter_hopbyhopid,
{ "Hop-by-Hop Identifier", "diameter.hopbyhopid", FT_UINT32,
BASE_HEX, NULL, 0x0, "", HFILL }},