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 . | |||||||||||||||||||||||||||||||
AVP
| 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.
本文介绍了Diameter协议消息的组成结构,包括消息头和属性-值对(AVPs)。详细解释了消息头各字段的作用及AVPs如何组织和解析,为理解Diameter协议的工作原理提供了基础。
636

被折叠的 条评论
为什么被折叠?



