Navigation


Changeset 1439:acc7262af8fa in freeDiameter


Ignore:
Timestamp:
Feb 25, 2020, 7:53:34 AM (4 years ago)
Author:
Luke Mewburn <luke@mewburn.net>
Branch:
default
Phase:
public
committer:
Luke Mewburn <luke@mewburn.net> 1582587465 -39600
Message:

add rules for Experimental-Result

Add rules for Experimental-Result.
Reorder Experimental-Result-Code before Experimental-Result.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/dict_base_proto.c

    r1318 r1439  
    15831583                        CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
    15841584                }
    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
    15861616                /* Experimental-Result */
    15871617                {
     
    15951625
    15961626                                 Experimental-Result ::= < AVP Header: 297 >
    1597                                                          { Vendor-Id }
    1598                                                          { Experimental-Result-Code }
     1627                                                        { Vendor-Id }
     1628                                                        { Experimental-Result-Code }
    15991629
    16001630                                The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies
     
    16041634                                Experimental-Result AVP.
    16051635                        */
    1606                         struct dict_avp_data data = {
    1607                                         297,                                    /* Code */
    1608                                         0,                                      /* Vendor */
    1609                                         "Experimental-Result",                  /* Name */
    1610                                         AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY,   /* Fixed flags */
    1611                                         AVP_FLAG_MANDATORY,                     /* Fixed flag values */
    1612                                         AVP_TYPE_GROUPED                        /* base type of data */
    1613                                         };
    1614                         CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
    1615                 }
    1616                
    1617                 /* Experimental-Result-Code */
    1618                 {
    1619                         /*
    1620                                 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32
    1621                                 and contains a vendor-assigned value representing the result of
    1622                                 processing the request.
    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                
     1636                        struct dict_object *    avp = NULL;
     1637                        struct dict_avp_data    data = {
     1638                                        297,                                    /* Code */
     1639                                        0,                                      /* Vendor */
     1640                                        "Experimental-Result",                  /* Name */
     1641                                        AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY,   /* Fixed flags */
     1642                                        AVP_FLAG_MANDATORY,                     /* Fixed flag values */
     1643                                        AVP_TYPE_GROUPED                        /* base type of data */
     1644                                        };
     1645                        struct local_rules_definition rules[] = {
     1646                                { "Vendor-Id",                  RULE_REQUIRED, -1, 1 },
     1647                                { "Experimental-Result-Code",   RULE_REQUIRED, -1, 1 },
     1648                                };
     1649                        CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
     1650                        PARSE_loc_rules( rules, avp );
     1651                }
     1652
    16471653                /* Auth-Request-Type */
    16481654                {
Note: See TracChangeset for help on using the changeset viewer.