Diameter XML Specification Syntax
This section describes the tags used in the XML file and includes a DTD file that supports the XML file.
Example - XML Specification file
CCR and CCA command specifications for the Diameter Credit-Control application (Nortel GGSN): ccr_cca.xml
XML
The XML file of the Diameter agent contains the following tags:
<diameter-protocol>
The XML file starts with a diameter-protocol declaration.
Example - diameter-protocol syntax
<diameter-protocol name='unknown'>
The name attribute is optional and specifies the diameter protocol name.
The diameter-protocol tag can contain the following tags:
<avp>
<command>
<avp>
The AVP tag defines an AVP.
Example - avp syntax
<avp id='55' name='Event-Timestamp' vendor='1234'>
Each AVP tag requires an ID and a name. The ID is the AVP code allocated by IANA for this AVP. The name identifies this AVP in grouped AVPs or commands. The vendor attribute is optional and sets the ID of the AVP vendor.
The AVP tag must contain the following tag.
<flag-rules>
The AVP tag must contain one of the following tags.
<simple-type>
<enumeration>
<layout>
The AVP tag may contain the following tag.
<may-encrypt>
<flag-rules>
The flag-rules tag is required for the AVP tag and defines the AVP flags with a number of flag-rule definition tags.
Example - flag-rules syntax
<flag-rules> <flag-rule name='mandatory' rule='must'/> <flag-rule name='protected' rule='must_not'/> </flag-rules>
<flag-rule>
The flag-rule tag defines the value for one of the valid AVP flags.
Example - flag-rule syntax
<flag-rule name='mandatory' rule='must'/>
The flag-rule tag has two required attributes. The name attribute is the flag name, either mandatory or protected. The rule attribute defines the flag value and can be must, may, should_not or must_not.
<may-encrypt>
The may-encrypt tag defines if this AVP is to be encrypted or not.
Example - may-encrypt syntax
<may-encrypt/>
<simple-type>
<simple-type> with its name attribute defines the AVP type as any of the following types:
Unsigned32
Unsigned64
Signed32
Signed64
Float32
Float64
DiameterIdentity
UTF8String
Address
OctetString
Time
DiameterURI
IPFilterRule
Example - simple-type syntax
<simple-type name='Time'/>
<enumeration>
The enumeration tag defines AVPs of type Enumerated and can have any number of <enumerator> sub-tags.
Example - enumeration syntax
<enumeration> <enumerator value='1' name='EVENT_RECORD'/> <enumerator value='2' name='START_RECORD'/> <enumerator value='3' name='INTERIM_RECORD'/> <enumerator value='4' name='STOP_RECORD'/> </enumeration>
<enumerator>
The enumerator tag defines an element in an Enumerated AVP type. It has two required attributes called name and value. For an example of the syntax see the section above, <enumeration>
.
<layout>
The layout tag defines AVPs of type Grouped. A grouped AVP consists of a sequence of AVPs. It is also possible to nest grouped AVPs, that is to include a grouped AVP within a grouped AVP
Example - layout syntax
<layout> <fixed> <avp-ref name='Session-Id' min='0'/> </fixed> <required> <avp-ref name='Origin-Host'/> <avp-ref name='Origin-Realm'/> <avp-ref name='Result-Code'/> </required> <optional> <avp-ref name='Origin-State-Id'/> <avp-ref name='Error-Reporting-Host'/> <avp-ref name='Error-Message'/> <avp-ref name='Proxy-Info' max='*'/> <any-avp/> </optional> </layout>
The layout tag can contain the following tags.
<fixed>
<required>
<optional>
<fixed>
The fixed tag defines the fixed AVPs included in a grouped AVP. For an example of the syntax see the layout syntax example in the section above, <layout>
.
The fixed tag can contain the following tag.
<avp-ref>
<required>
The required tag defines the required AVPs included in a grouped AVP. For an example of the syntax see the example, layout syntax in the section above, <layout>
.
The required tag can contain the following tags.
<avp-ref>
<any-avp>
<optional>
The optional tag defines the optional AVPs included in a grouped AVP. For an example of the syntax see the example, layout syntax in the section above,
<layout>
.
The optional tag can contain the following tags.
<avp-ref>
<any-avp>
<avp-ref>
The avp-ref tag contains a reference to an AVP that should be included in a grouped AVP. The tag has a required attribute called name
. It holds the name of the referenced AVP. The optional attributes min
 and max
 set the qualifiers for the AVP. For an example of the syntax, see the example, layout syntax, in the section above, <layout>
.
<any-avp>
The any-avp tag defines that a grouped AVP in the group list can have any number of AVPs of any kind.
<command>
The command tag defines a command.
Example - command syntax
<command id='257'>
The required attribute id is the command code allocated by IANA for this command. The optional attribute application sets the command application ID.
The command tag requires one of the following tags.
<answer>
<request>
<answer>
This tag defines an answer command. The attribute name is required.
Example - answer syntax
<answer name='Error-Answer-Message'>
The answer tag can contain the following tags.
<header-bits>
<layout>
<header-bits>
This tag defines the header bits of a command.
Example - header-bits syntax
<header-bits> <header-bit name='request' value='0'/> <header-bit name='proxiable' value='1'/> <header-bit name='error' value='1'/> </header-bits>
The header-bits tag can contain the following tags.
<header-bit>
<header-bit>
This tag defines a command header bit. For an example of the syntax, see the example, header-bits syntax, in the section above, <header-bits>
.
The header-bit tag has two required attributes. name
 is the header bit name and can be request
, proxiable
 or error
. The value
 is the bit value (0 or 1). Any other value will cause the XML aborter to abort with an error message.
DTD
diameter.dtd supports the XML file in the section above, XML.
<?xml version='1.0' encoding='ascii'?> <!ELEMENT diameter-protocol (avp|command)*> <!ATTLIST diameter-protocol name CDATA #REQUIRED> <!ELEMENT avp (flag-rules,enumeration?,layout?)> <!ATTLIST avp id CDATA #REQUIRED> <!ATTLIST avp name CDATA #REQUIRED> <!ATTLIST avp datatype CDATA #IMPLIED> <!ATTLIST avp vendor CDATA #IMPLIED> <!ELEMENT flag-rules (flag-rule*)> <!ELEMENT flag-rule EMPTY> <!ATTLIST flag-rule name CDATA #REQUIRED> <!ATTLIST flag-rule rule CDATA #REQUIRED> <!ELEMENT enumeration (enumerator*)> <!ELEMENT enumerator EMPTY> <!ATTLIST enumerator value CDATA #REQUIRED> <!ATTLIST enumerator name CDATA #REQUIRED> <!ELEMENT layout (fixed?,required?,optional?)> <!ELEMENT fixed (avp-ref*)> <!ELEMENT required (avp-ref*,any-avp?)> <!ELEMENT optional (avp-ref*,any-avp?)> <!ELEMENT avp-ref EMPTY> <!ATTLIST avp-ref name CDATA #REQUIRED> <!ATTLIST avp-ref min CDATA #IMPLIED> <!ATTLIST avp-ref max CDATA #IMPLIED> <!ELEMENT any-avp EMPTY> <!ELEMENT command (request?, answer?)> <!ATTLIST command id CDATA #REQUIRED> <!ATTLIST command application CDATA #IMPLIED> <!ENTITY % command-children "(header-bits, layout)"> <!ELEMENT request %command-children;> <!ATTLIST request name CDATA #REQUIRED> <!ELEMENT answer %command-children;> <!ATTLIST answer name CDATA #REQUIRED> <!ELEMENT header-bits (header-bit*)> <!ELEMENT header-bit EMPTY> <!ATTLIST header-bit value CDATA #REQUIRED>