Diameter Attribute-Value-Structure (AVP) are the data units inside the diameter messages which contains all the information. There has to be atleast one AVP in every diameter messages. A Diameter message can contain multiple sets of different AVPs. For basic information related to Diameter protocol read article (Diameter Protocol Basics). Structure of an AVP is shown in below image:
Description of various fields of Diameter AVP Structure:
1) AVP Code – This field length is of 4 byte and its value is used to uniquely identify the Diameter attribute by combining with “Vendor-Id”. AVP Code from 1-255 are reserved for RADIUS backward compatibility and vendor-ID is optional for AVPs. AVP Code 256 and above are used for Diameter protocol which are assigned by IANA.
2) AVP Flags – This field length is of 1 byte and its value determines the handling of this Attribute. Flag values are assigned per bit-wise which are as follows:
Flags Bits Position:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
V | M | P | R | R | R | R | R |
a) The “V” (Vendor Specific) Bit – This field is set if optional “Vendor-Id” Field is present in AVP else “Vendor-Id” field is missing in the AVP.
b) The “M” (Mandatory) Bit – This field indicates whether handling of this AVP is mandatory or not. If this flag is set then every diameter agent(Client,Server,Proxy,Translation) must process this AVP and if this AVP is not recognized by the agent then the message must be rejected. However, Diameter Relay and Redirect Agent must not reject the message for this reason. If this bit is clear, then processing of this AVP is optional.
c) The “P” (Protected) Bit – This bit is used to indicate that AVP data is encrypted if this bit is set, to enhance security.
d) The “R” (Reserved) Bit – These bits are reserved for future purpose and should be set to Zero (0)
3) AVP Length – This field length is of 3 byte and it indicates the length of AVP including Header Bytes and Data bytes.
4) Vendor-Id – This is an optional field of 4 byte length and its value contains the IANA assigned Private Enterprise Codes value which will be set by any vendor to use there own AVP.This value is only valid in vendor’s privately managed application Space.
5) Data – This field is of variable length and is of Zero or more octets which contains related information. AVP with Zero octet length is used for notification only.
Grouped AVP
Grouped Avp is a collection of AVP’s. Its structure is same as of normal AVP as described above but the data field contains the child AVPs details. Packet capture snapshot of Grouped AVP and Normal AVP is shown in the image.