diameter message = diameter header + AVPs
Diameter Header
Bit offset | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | version | message length | ||||||||||||||||||||||||||||||
32 | R | P | E | T | command code | |||||||||||||||||||||||||||
64 | application ID | |||||||||||||||||||||||||||||||
96 | hop-by-hop ID | |||||||||||||||||||||||||||||||
128 | end-to-end ID | |||||||||||||||||||||||||||||||
160 ... | AVPs . |
Bit offset | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | AVP code | |||||||||||||||||||||||||||||||
32 | V | M | P | AVP length | ||||||||||||||||||||||||||||
64 | vendor ID (optional) | |||||||||||||||||||||||||||||||
96 ... | data ... |
Grouped AVP =
is really constructed by multiple AVPs,
But when coding or decode the group ones, it usually use diameter message header length (=20bytes) added to Grouped AVP temprarily, then we can easily decode/encode the same as processing the diameter message structure.
As avp searching from where.
This function is searching from diameter message(header+data).
So :
1. Single avp:
Search single avp from diameter message structure.
2. Group avp:
Search group AVPs data from diameter message structure
Then, search certain avp from group avps which is the same structure with diameter message.
So all search use the same common function as below.
Dia_search_avp_r(Diaheader_t * dia_msg_ptr,int avp_code_index,diacode_t * avp_code,int *avp_len, char far*avp_data);
dia_msg_ptr contains dia header & data.