Mercurial > hg > freeDiameter
comparison libfdcore/dict_base_proto.c @ 1439:acc7262af8fa
add rules for Experimental-Result
Add rules for Experimental-Result.
Reorder Experimental-Result-Code before Experimental-Result.
author | Luke Mewburn <luke@mewburn.net> |
---|---|
date | Tue, 25 Feb 2020 09:53:34 +1100 |
parents | 2a5620128a9a |
children | 566bb46cc73f |
comparison
equal
deleted
inserted
replaced
1438:7c60cb0ac8c8 | 1439:acc7262af8fa |
---|---|
1580 AVP_FLAG_MANDATORY, /* Fixed flag values */ | 1580 AVP_FLAG_MANDATORY, /* Fixed flag values */ |
1581 AVP_TYPE_GROUPED /* base type of data */ | 1581 AVP_TYPE_GROUPED /* base type of data */ |
1582 }; | 1582 }; |
1583 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | 1583 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); |
1584 } | 1584 } |
1585 | 1585 |
1586 /* Experimental-Result-Code */ | |
1587 { | |
1588 /* | |
1589 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 | |
1590 and contains a vendor-assigned value representing the result of | |
1591 processing the request. | |
1592 | |
1593 It is recommended that vendor-specific result codes follow the same | |
1594 conventions given for the Result-Code AVP regarding the different | |
1595 types of result codes and the handling of errors (for non 2xxx | |
1596 values). | |
1597 */ | |
1598 /* Although the RFC does not specify an "Enumerated" type here, we go forward and create one. | |
1599 * This is the reason for the "*" in the type name. Vendors will have to define their values. | |
1600 */ | |
1601 struct dict_object * type; | |
1602 struct dict_type_data tdata = { AVP_TYPE_UNSIGNED32, "Enumerated(Experimental-Result-Code)" , NULL, NULL, NULL }; | |
1603 struct dict_avp_data data = { | |
1604 298, /* Code */ | |
1605 0, /* Vendor */ | |
1606 "Experimental-Result-Code", /* Name */ | |
1607 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1608 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1609 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
1610 }; | |
1611 | |
1612 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
1613 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
1614 } | |
1615 | |
1586 /* Experimental-Result */ | 1616 /* Experimental-Result */ |
1587 { | 1617 { |
1588 /* | 1618 /* |
1589 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and | 1619 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and |
1590 indicates whether a particular vendor-specific request was completed | 1620 indicates whether a particular vendor-specific request was completed |
1592 following ABNF grammar: | 1622 following ABNF grammar: |
1593 | 1623 |
1594 AVP Format | 1624 AVP Format |
1595 | 1625 |
1596 Experimental-Result ::= < AVP Header: 297 > | 1626 Experimental-Result ::= < AVP Header: 297 > |
1597 { Vendor-Id } | 1627 { Vendor-Id } |
1598 { Experimental-Result-Code } | 1628 { Experimental-Result-Code } |
1599 | 1629 |
1600 The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies | 1630 The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies |
1601 the vendor responsible for the assignment of the result code which | 1631 the vendor responsible for the assignment of the result code which |
1602 follows. All Diameter answer messages defined in vendor-specific | 1632 follows. All Diameter answer messages defined in vendor-specific |
1603 applications MUST include either one Result-Code AVP or one | 1633 applications MUST include either one Result-Code AVP or one |
1604 Experimental-Result AVP. | 1634 Experimental-Result AVP. |
1605 */ | 1635 */ |
1606 struct dict_avp_data data = { | 1636 struct dict_object * avp = NULL; |
1607 297, /* Code */ | 1637 struct dict_avp_data data = { |
1608 0, /* Vendor */ | 1638 297, /* Code */ |
1609 "Experimental-Result", /* Name */ | 1639 0, /* Vendor */ |
1610 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | 1640 "Experimental-Result", /* Name */ |
1611 AVP_FLAG_MANDATORY, /* Fixed flag values */ | 1641 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ |
1612 AVP_TYPE_GROUPED /* base type of data */ | 1642 AVP_FLAG_MANDATORY, /* Fixed flag values */ |
1613 }; | 1643 AVP_TYPE_GROUPED /* base type of data */ |
1614 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | 1644 }; |
1615 } | 1645 struct local_rules_definition rules[] = { |
1616 | 1646 { "Vendor-Id", RULE_REQUIRED, -1, 1 }, |
1617 /* Experimental-Result-Code */ | 1647 { "Experimental-Result-Code", RULE_REQUIRED, -1, 1 }, |
1618 { | 1648 }; |
1619 /* | 1649 CHECK_dict_new( DICT_AVP, &data , NULL, &avp); |
1620 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 | 1650 PARSE_loc_rules( rules, avp ); |
1621 and contains a vendor-assigned value representing the result of | 1651 } |
1622 processing the request. | 1652 |
1623 | |
1624 It is recommended that vendor-specific result codes follow the same | |
1625 conventions given for the Result-Code AVP regarding the different | |
1626 types of result codes and the handling of errors (for non 2xxx | |
1627 values). | |
1628 */ | |
1629 /* Although the RFC does not specify an "Enumerated" type here, we go forward and create one. | |
1630 * This is the reason for the "*" in the type name. Vendors will have to define their values. | |
1631 */ | |
1632 struct dict_object * type; | |
1633 struct dict_type_data tdata = { AVP_TYPE_UNSIGNED32, "Enumerated(Experimental-Result-Code)" , NULL, NULL, NULL }; | |
1634 struct dict_avp_data data = { | |
1635 298, /* Code */ | |
1636 0, /* Vendor */ | |
1637 "Experimental-Result-Code", /* Name */ | |
1638 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1639 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1640 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
1641 }; | |
1642 | |
1643 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
1644 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
1645 } | |
1646 | |
1647 /* Auth-Request-Type */ | 1653 /* Auth-Request-Type */ |
1648 { | 1654 { |
1649 /* | 1655 /* |
1650 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is | 1656 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is |
1651 included in application-specific auth requests to inform the peers | 1657 included in application-specific auth requests to inform the peers |