# HG changeset patch # User Sebastien Decugis # Date 1244691611 -32400 # Node ID 9ea089572588aa7b1707dc84f53f532c03bae5c9 # Parent 3a8e91184d4dd22b2893dafc093bba0c99e66a6e Added Enum values for some special values of Login-IP-Host diff -r 3a8e91184d4d -r 9ea089572588 extensions/dict_nasreq/dict_nasreq.c --- a/extensions/dict_nasreq/dict_nasreq.c Wed Jun 10 15:33:26 2009 +0900 +++ b/extensions/dict_nasreq/dict_nasreq.c Thu Jun 11 12:40:11 2009 +0900 @@ -492,32 +492,32 @@ dict_object_t * type; dict_type_data_t tdata = { AVP_TYPE_OCTETSTRING, "Enumerated*(Originating-Line-Info)" , NULL, NULL}; dict_type_enum_data_t tvals[] = { - #define enum_os2_def( _val_, _str_ ) \ - { _str_, { .os = { .data = _val_, .len = 2 }}} - enum_os2_def( "00", "Plain Old Telephone Service (POTS)"), - enum_os2_def( "01", "Multiparty Line (more than 2)"), - enum_os2_def( "02", "ANI Failure"), - enum_os2_def( "06", "Station Level Rating"), - enum_os2_def( "07", "Special Operator Handling Required"), - enum_os2_def( "20", "Automatic Identified Outward Dialing (AIOD)"), - enum_os2_def( "23", "Coin or Non-Coin"), - enum_os2_def( "24", "Toll Free Service (Non-Pay Origination)"), - enum_os2_def( "25", "Toll Free Service (Pay Origination)"), - enum_os2_def( "27", "Toll Free Service (Coin Control Origination)"), - enum_os2_def( "29", "Prison/Inmate Service"), - enum_os2_def( "30", "Intercept (Blank)"), - enum_os2_def( "31", "Intercept (Trouble)"), - enum_os2_def( "32", "Intercept (Regular)"), - enum_os2_def( "34", "Telco Operator Handled Call"), - enum_os2_def( "52", "Outward Wide Area Telecommunications Service (OUTWATS)"), - enum_os2_def( "60", "Telecommunications Relay Service (TRS)(Unrestricted)"), - enum_os2_def( "61", "Cellular/Wireless PCS (Type 1)"), - enum_os2_def( "62", "Cellular/Wireless PCS (Type 2)"), - enum_os2_def( "63", "Cellular/Wireless PCS (Roaming)"), - enum_os2_def( "66", "TRS (Hotel)"), - enum_os2_def( "67", "TRS (Restricted)"), - enum_os2_def( "70", "Pay Station, No Coin Control"), - enum_os2_def( "93", "Access for Private Virtual Network Service") + #define enum_os_def( _len_, _val_, _str_ ) \ + { _str_, { .os = { .data = _val_, .len = _len_ }}} + enum_os_def( 2, "00", "Plain Old Telephone Service (POTS)"), + enum_os_def( 2, "01", "Multiparty Line (more than 2)"), + enum_os_def( 2, "02", "ANI Failure"), + enum_os_def( 2, "06", "Station Level Rating"), + enum_os_def( 2, "07", "Special Operator Handling Required"), + enum_os_def( 2, "20", "Automatic Identified Outward Dialing (AIOD)"), + enum_os_def( 2, "23", "Coin or Non-Coin"), + enum_os_def( 2, "24", "Toll Free Service (Non-Pay Origination)"), + enum_os_def( 2, "25", "Toll Free Service (Pay Origination)"), + enum_os_def( 2, "27", "Toll Free Service (Coin Control Origination)"), + enum_os_def( 2, "29", "Prison/Inmate Service"), + enum_os_def( 2, "30", "Intercept (Blank)"), + enum_os_def( 2, "31", "Intercept (Trouble)"), + enum_os_def( 2, "32", "Intercept (Regular)"), + enum_os_def( 2, "34", "Telco Operator Handled Call"), + enum_os_def( 2, "52", "Outward Wide Area Telecommunications Service (OUTWATS)"), + enum_os_def( 2, "60", "Telecommunications Relay Service (TRS)(Unrestricted)"), + enum_os_def( 2, "61", "Cellular/Wireless PCS (Type 1)"), + enum_os_def( 2, "62", "Cellular/Wireless PCS (Type 2)"), + enum_os_def( 2, "63", "Cellular/Wireless PCS (Roaming)"), + enum_os_def( 2, "66", "TRS (Hotel)"), + enum_os_def( 2, "67", "TRS (Restricted)"), + enum_os_def( 2, "70", "Pay Station, No Coin Control"), + enum_os_def( 2, "93", "Access for Private Virtual Network Service") }; dict_avp_data_t data = { 94, /* Code */ @@ -1679,6 +1679,14 @@ address. The value 0 indicates that the NAS SHOULD select a host to connect the user to. */ + dict_object_t * type; + uint32_t allzeros = 0; + uint32_t allones = (uint32_t) -1; + dict_type_data_t tdata = { AVP_TYPE_OCTETSTRING, "Enumerated(Login-IP-Host)" , NULL, NULL}; + dict_type_enum_data_t tvals[] = { + enum_os_def( 4, &allzeros, "(0) NAS selects the host"), + enum_os_def( 4, &allones , "(1) User selects the address") + }; dict_avp_data_t data = { 14, /* Code */ 0, /* Vendor */ @@ -1687,7 +1695,13 @@ AVP_FLAG_MANDATORY, /* Fixed flag values */ AVP_TYPE_OCTETSTRING /* base type of data */ }; - CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + int i; + /* Create the Enumerated type, enumerated values, and the AVP */ + CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); + for (i = 0; i < sizeof(tvals) / sizeof(tvals[0]); i++) { + CHECK_dict_new( DICT_TYPE_ENUM, &tvals[i], type, NULL); + } + CHECK_dict_new( DICT_AVP, &data , type, NULL); } /* Login-IPv6-Host */ @@ -1708,6 +1722,14 @@ NAS SHOULD select a host to connect the user to. */ + dict_object_t * type; + unsigned char allzeros[16]; + unsigned char allones[16]; + dict_type_data_t tdata = { AVP_TYPE_OCTETSTRING, "Enumerated(Login-IP-Host)" , NULL, NULL}; + dict_type_enum_data_t tvals[] = { + enum_os_def( 16, &allzeros, "(0) NAS selects the host"), + enum_os_def( 16, &allones , "(1) User selects the address") + }; dict_avp_data_t data = { 98, /* Code */ 0, /* Vendor */ @@ -1716,7 +1738,15 @@ AVP_FLAG_MANDATORY, /* Fixed flag values */ AVP_TYPE_OCTETSTRING /* base type of data */ }; - CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + int i; + memset(allzeros, 0, sizeof(allzeros)); + memset(allones, 0xff, sizeof(allones)); + /* Create the Enumerated type, enumerated values, and the AVP */ + CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); + for (i = 0; i < sizeof(tvals) / sizeof(tvals[0]); i++) { + CHECK_dict_new( DICT_TYPE_ENUM, &tvals[i], type, NULL); + } + CHECK_dict_new( DICT_AVP, &data , type, NULL); } /* Login-Service */