diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9262aacdc898c23e265a6637003be52c8c4fb268 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# titan.ProtocolModules.RADIUS_ProtocolModule_Generator + +Main project page: + +https://projects.eclipse.org/projects/tools.titan + +The source code of the TTCN-3 compiler and executor: + +https://github.com/eclipse/titan.core diff --git a/demo/RADIUS_Demo_new.prj b/demo/RADIUS_Demo_new.prj new file mode 100644 index 0000000000000000000000000000000000000000..f50fac925caa9902c51d2fdb8bfec6e0b479cd19 --- /dev/null +++ b/demo/RADIUS_Demo_new.prj @@ -0,0 +1,60 @@ +<!DOCTYPE TITAN_GUI_project_file> +<Project TITAN_version="1.8.pl2" > + <General> + <Project_Name>RADIUS_Demo_new</Project_Name> + <Executable_Path>myTest</Executable_Path> + <Working_Dir>.</Working_Dir> + <Build_Host>alpha</Build_Host> + <Execution_Mode>Parallel</Execution_Mode> + <Code_Splitting_Mode>None</Code_Splitting_Mode> + <ScriptFile_AfterMake>gui_make_RPMG_new.sh</ScriptFile_AfterMake> + <Log_Format>yes</Log_Format> + <Update_Symlinks>yes</Update_Symlinks> + <Create_Absolute_Symlinks>no</Create_Absolute_Symlinks> + <Update_Makefile>yes</Update_Makefile> + <Localhost_Execute>yes</Localhost_Execute> + <Execute_Command>rsh %host "cd %project_working_dir ; "%executable" %localhost %mctr_port"</Execute_Command> + <Execute_Hosts>alfa, beta, gamma</Execute_Hosts> + <UnUsed_List></UnUsed_List> + </General> + <Modules> + <Module>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PortType.ttcn</Module> + <Module>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_Types.ttcn</Module> + <Module>RADIUS_Mapping_new.ttcn</Module> + <Module>Radius_Test_new.ttcn</Module> + </Modules> + <TestPorts> + <TestPort>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.cc</TestPort> + <TestPort>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.hh</TestPort> + </TestPorts> + <Other_Sources> + <Other_Source>../src/RADIUS_EncDec.cc</Other_Source> + </Other_Sources> + <Configs> + <Config>radius.cfg</Config> + </Configs> + <Test_Cases> + <Test_Case>Radius_Test_new.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_correct_auth</Test_Case> + <Test_Case>Radius_Test_new.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_incorrect_auth</Test_Case> + <Test_Case>Radius_Test_new.tc_RADIUS_client_sendAccessRequest</Test_Case> + <Test_Case>Radius_Test_new.tc_RADIUS_client_sendAccessRequest_receiveAccessAccept</Test_Case> + <Test_Case>Radius_Test_new.tc_RADIUS_client_sendAccessAccept</Test_Case> + <Test_Case>Radius_Test_new.tc_RADIUS_client_sendAccountingRequest_receiveAccountingResponse</Test_Case> + <Test_Case>Radius_Test_new.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept</Test_Case> + <Test_Case>Radius_Test_new.tc_RADIUS_server_receiveAccessRequest_sendAccessChallenge</Test_Case> + <Test_Case>Radius_Test_new.tc_RADIUS_server_receiveAccountingRequest_sendAccountingResponse</Test_Case> + </Test_Cases> + <Others> + <Other>gui_make_RPMG_new.sh</Other> + <Other>../src/ATTR.awk</Other> + <Other>../src/IPv6_IETF_RFC3162.rdf</Other> + <Other>../src/Base_IETF_RFC2865.rdf</Other> + <Other>../src/BaseTypes_IETF_RFC2865.rdf</Other> + <Other>../src/Extensions_IETF_RFC2869.rdf</Other> + <Other>../src/TunnelAuthentication_IETF_RFC2868.rdf</Other> + <Other>../src/Extensions_IETF_RFC2869.rdf</Other> + <Other>../src/GGSN_FS_46_15517_CSA113_35_4RevB.rdf</Other> + <Other>../src/Accounting_IETF_RFC2866_RFC2867.rdf</Other> + </Others> + <File_Group name="MainFileGroup" /> +</Project> diff --git a/demo/RADIUS_Demo_orig.prj b/demo/RADIUS_Demo_orig.prj new file mode 100644 index 0000000000000000000000000000000000000000..89b3aa232df1668d2b63690ec007de5cf13e8dc0 --- /dev/null +++ b/demo/RADIUS_Demo_orig.prj @@ -0,0 +1,60 @@ +<!DOCTYPE TITAN_GUI_project_file> +<Project TITAN_version="1.8.pl2" > + <General> + <Project_Name>RADIUS_Demo_orig</Project_Name> + <Executable_Path>myTest</Executable_Path> + <Working_Dir>.</Working_Dir> + <Build_Host>alpha</Build_Host> + <Execution_Mode>Parallel</Execution_Mode> + <Code_Splitting_Mode>None</Code_Splitting_Mode> + <ScriptFile_AfterMake>gui_make_RPMG_orig.sh</ScriptFile_AfterMake> + <Log_Format>yes</Log_Format> + <Update_Symlinks>yes</Update_Symlinks> + <Create_Absolute_Symlinks>no</Create_Absolute_Symlinks> + <Update_Makefile>yes</Update_Makefile> + <Localhost_Execute>yes</Localhost_Execute> + <Execute_Command>rsh %host "cd %project_working_dir ; "%executable" %localhost %mctr_port"</Execute_Command> + <Execute_Hosts>alfa, beta, gamma</Execute_Hosts> + <UnUsed_List></UnUsed_List> + </General> + <Modules> + <Module>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PortType.ttcn</Module> + <Module>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_Types.ttcn</Module> + <Module>RADIUS_Mapping_orig.ttcn</Module> + <Module>Radius_Test_orig.ttcn</Module> + </Modules> + <TestPorts> + <TestPort>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.cc</TestPort> + <TestPort>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.hh</TestPort> + </TestPorts> + <Other_Sources> + <Other_Source>../src/RADIUS_EncDec.cc</Other_Source> + </Other_Sources> + <Configs> + <Config>radius.cfg</Config> + </Configs> + <Test_Cases> + <Test_Case>Radius_Test_orig.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_correct_auth</Test_Case> + <Test_Case>Radius_Test_orig.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_incorrect_auth</Test_Case> + <Test_Case>Radius_Test_orig.tc_RADIUS_client_sendAccessRequest</Test_Case> + <Test_Case>Radius_Test_orig.tc_RADIUS_client_sendAccessRequest_receiveAccessAccept</Test_Case> + <Test_Case>Radius_Test_orig.tc_RADIUS_client_sendAccessAccept</Test_Case> + <Test_Case>Radius_Test_orig.tc_RADIUS_client_sendAccountingRequest_receiveAccountingResponse</Test_Case> + <Test_Case>Radius_Test_orig.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept</Test_Case> + <Test_Case>Radius_Test_orig.tc_RADIUS_server_receiveAccessRequest_sendAccessChallenge</Test_Case> + <Test_Case>Radius_Test_orig.tc_RADIUS_server_receiveAccountingRequest_sendAccountingResponse</Test_Case> + </Test_Cases> + <Others> + <Other>gui_make_RPMG_orig.sh</Other> + <Other>../src/ATTR.awk</Other> + <Other>../src/IPv6_IETF_RFC3162.rdf</Other> + <Other>../src/Base_IETF_RFC2865.rdf</Other> + <Other>../src/BaseTypes_IETF_RFC2865.rdf</Other> + <Other>../src/Extensions_IETF_RFC2869.rdf</Other> + <Other>../src/TunnelAuthentication_IETF_RFC2868.rdf</Other> + <Other>../src/Extensions_IETF_RFC2869.rdf</Other> + <Other>../src/GGSN_FS_46_15517_CSA113_35_4RevB.rdf</Other> + <Other>../src/Accounting_IETF_RFC2866_RFC2867.rdf</Other> + </Others> + <File_Group name="MainFileGroup" /> +</Project> diff --git a/demo/RADIUS_Mapping_new.ttcn b/demo/RADIUS_Mapping_new.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..ba6f1e2f3b1b467aab8e1dee32587a478f86329e --- /dev/null +++ b/demo/RADIUS_Mapping_new.ttcn @@ -0,0 +1,428 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ +// +// File: RADIUS_Mapping_new.ttcn +// Description: Example module providing UDP Mapping for RPMG +// Rev: R12A +// Prodnr: CNL 113 600 +// Remark: This file is not a part of the product. +// +// +// + + + +module RADIUS_Mapping_new +{ + import from RADIUS_Types all; + import from UDPasp_Types all; + import from UDPasp_PortType all; + + modulepar{ + charstring tsp_SharedSecret := "sharedSecret" + } + + +type record ASP_UDP_RADIUS { + PDU_RADIUS data, + AddressType addressf, + PortType portf +} + +type port UDPasp_RADIUS_PT message { + + inout ASP_UDP_RADIUS +} with {extension "internal"} + + +type component RADIUS_mapping_CT { + + var RADIUS_port_descriptor v_RADIUS_port_descriptor; + + port UDPasp_RADIUS_PT UDP_RADIUS_PCO; // upper port + port UDPasp_PT UDP_PCO; // lower port + +} + +template ASP_UDP t_ASP_UDP := ?; +template ASP_UDP_RADIUS t_ASP_UDP_RADIUS := ?; + + + type record of vsa_descriptor vsa_descriptor_list; + + type record vsa_descriptor { + integer vendor_id, + integer_list subattr_types + } + +//================================================================ +// Types from RADIUS test port, info needed for external functions +//================================================================ +type record RADIUS_port_descriptor { + boolean global_keying, // if this is set to true, 256 will be used instead of EAP Identifier + charstring secret, + integer mode, + octetstring req_auth[256], + octetstring req_acct[256], + boolean debugging +} + +type record of integer integer_list; + +type enumerated generic_attrib_value_union_selection { + unbound, + text_val, + string_val, + address_val, + integer_val, + time_val +} + +type enumerated RADIUS_Mode {client, server}; + +//================================================================ +//================================================================ +//================================================================ + + +// Sending in Server mode +// -- Access_Accept or +// -- Access_Reject or +// -- Access_Challenge or +// -- Accounting_Response +// == Disconnect_Request == NOT HANDLED +function f_handle_outgoing_server_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Accept) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else if (pl_ASP_UDP_RADIUS.data.code == Access_Reject) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else if (pl_ASP_UDP_RADIUS.data.code == Access_Challenge) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Response) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else {log("Warning : Will not send out Radius message with code ", pl_ASP_UDP_RADIUS.data.code, " in Server mode!") } +} + +// Sending in Client mode +// -- Access_Request or +// -- Accounting_Request +// == Access_Challenge == NOT HANDLED +// == Disconnect_Ack == NOT HANDLED +// == Disconnect_Nak == NOT HANDLED +function f_handle_outgoing_client_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Request) + { + // fill out authenticator with random number if template has 0s + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + var integer i; + for ( i := 0; i < 16; i := i+1) + { + pl_ASP_UDP_RADIUS.data.authenticator[i] := int2oct(float2int(int2float(256)*rnd()),1) + } + } + v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator; + + // Calulate hidden password + var integer j := 0; + while (j < sizeof(pl_ASP_UDP_RADIUS.data.attributes)) + { + if (pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_type==Base_User_Password) + { + var integer v_pw_len :=lengthof(pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password); + var integer v_padding_length := 16 - (v_pw_len mod 16); + var octetstring v_padded_password := + +pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password & int2oct(0,v_padding_length) + var octetstring v_hidden_password := f_calculate_password( + v_padded_password, + pl_ASP_UDP_RADIUS.data.authenticator, + false + ); + pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password := v_hidden_password; + j := sizeof(pl_ASP_UDP_RADIUS.data.attributes) // stop while loop + } + j := j + 1; + } + f_encode_send(pl_ASP_UDP_RADIUS); + } + + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Request) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + pl_ASP_UDP_RADIUS.data.authenticator := f_calc_MD5(f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data) & char2oct(tsp_SharedSecret)); + } + v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator; + f_encode_send(pl_ASP_UDP_RADIUS); + } + else {log("Warning : Will not send out Radius message with code ", pl_ASP_UDP_RADIUS.data.code, " in Client mode!") } +} + + + +// -- Access_Accept or +// -- Access_Reject or +// -- Access_Challenge or +// -- Accounting_Response +// == Disconnect_Request == NOT HANDLED +function f_handle_incoming_server_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS, octetstring pl_asp_udp_data) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Accept) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else if (pl_ASP_UDP_RADIUS.data.code == Access_Reject) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else if (pl_ASP_UDP_RADIUS.data.code == Access_Challenge) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Response) + { + + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else {log("Warning : Unexpected message with code ", pl_ASP_UDP_RADIUS.data.code, " received in Client mode") } +} + +// Access_Request or +// Accounting_Request +// == Access_Challenge == NOT HANDLED +// == Disconnect_Ack == NOT HANDLED +// == Disconnect_Nak == NOT HANDLED +function f_handle_incoming_client_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS,octetstring pl_asp_udp_data) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Request) + + { + + // Calulate password from hidden password + var integer j := 0; + while (j < sizeof(pl_ASP_UDP_RADIUS.data.attributes)) + { + if (pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_type==Base_User_Password) + { + var octetstring v_padded_password := f_calculate_password( + pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password, + pl_ASP_UDP_RADIUS.data.authenticator, + true + ); + + var integer v_padding_length := 0; + while (v_padded_password[lengthof(v_padded_password) - v_padding_length - 1] == '00'O) + { + v_padding_length := v_padding_length + 1; + } + + var octetstring v_password:= substr (v_padded_password,0,lengthof(v_padded_password) - v_padding_length); + + pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password := v_password; + j := sizeof(pl_ASP_UDP_RADIUS.data.attributes) // stop while loop + } + j := j + 1; + } + + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator // store value + + } + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Request) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator // store value + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & '00000000000000000000000000000000'O + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret) + ) + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + else {log("Warning : Unexpected message with code ", pl_ASP_UDP_RADIUS.data.code, " received in Server mode")} +} + + +// Encrypts Password field in Access Request using Request Authentication +// field and shared secret (modulepar) +function f_calculate_password( octetstring pl_password,octetstring pl_authenticatior, boolean pl_decrypt) runs on RADIUS_mapping_CT return octetstring{ + return f_crypt_password (pl_password,pl_authenticatior,''O,pl_decrypt,tsp_SharedSecret) // false = encode, true = decode +} + +function f_encode_send(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + var ASP_UDP v_asp_udp; + v_asp_udp.data := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + v_asp_udp.addressf := pl_ASP_UDP_RADIUS.addressf; + v_asp_udp.portf := pl_ASP_UDP_RADIUS.portf; + UDP_PCO.send(v_asp_udp); +} + + +//function f_store_RequestAuth_Field +//function f_store_last + +function f_RADIUS_EncDec_Start(RADIUS_Mode pl_RADIUS_Mode) runs on RADIUS_mapping_CT { + + var ASP_UDP_RADIUS v_asp_udp_radius; + var ASP_UDP v_asp_udp; + + while (true) { + alt { + ///////////////////////////////// + // incoming messages on upper port + ///////////////////////////////// + [] UDP_RADIUS_PCO.receive(t_ASP_UDP_RADIUS) -> value v_asp_udp_radius { + if (pl_RADIUS_Mode == server) { + f_handle_outgoing_server_message(v_asp_udp_radius) + } + else { // client mode + f_handle_outgoing_client_message(v_asp_udp_radius) + } + } + + ///////////////////////////////// + // incoming messages on lower port + ///////////////////////////////// + [] UDP_PCO.receive(t_ASP_UDP) -> value v_asp_udp { + + v_asp_udp_radius.data := f_RADIUS_Dec(v_asp_udp.data); + v_asp_udp_radius.addressf := v_asp_udp.addressf; + v_asp_udp_radius.portf := v_asp_udp.portf; + + if (pl_RADIUS_Mode == server) { + f_handle_incoming_client_message(v_asp_udp_radius,v_asp_udp.data) + } + else { // client mode + f_handle_incoming_server_message(v_asp_udp_radius,v_asp_udp.data) + } + } + } + } +} + + + +} // end of module diff --git a/demo/RADIUS_Mapping_orig.ttcn b/demo/RADIUS_Mapping_orig.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..b1197c7f008032feb8d7bd9a69de69b129e1b98f --- /dev/null +++ b/demo/RADIUS_Mapping_orig.ttcn @@ -0,0 +1,427 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ +// +// File: RADIUS_Mapping_orig.ttcn +// Description: Example module providing UDP Mapping for RPMG +// Rev: R12A +// Prodnr: CNL 113 600 +// Remark: This file is not a part of the product. +// +// +// + + +module RADIUS_Mapping_orig +{ + import from RADIUS_Types all; + import from UDPasp_Types all; + import from UDPasp_PortType all; + + modulepar{ + charstring tsp_SharedSecret := "sharedSecret" + } + + +type record ASP_UDP_RADIUS { + PDU_RADIUS data, + AddressType addressf, + PortType portf +} + +type port UDPasp_RADIUS_PT message { + + inout ASP_UDP_RADIUS +} with {extension "internal"} + + +type component RADIUS_mapping_CT { + + var RADIUS_port_descriptor v_RADIUS_port_descriptor; + + port UDPasp_RADIUS_PT UDP_RADIUS_PCO; // upper port + port UDPasp_PT UDP_PCO; // lower port + +} + +template ASP_UDP t_ASP_UDP := ?; +template ASP_UDP_RADIUS t_ASP_UDP_RADIUS := ?; + + + type record of vsa_descriptor vsa_descriptor_list; + + type record vsa_descriptor { + integer vendor_id, + integer_list subattr_types + } + +//================================================================ +// Types from RADIUS test port, info needed for external functions +//================================================================ +type record RADIUS_port_descriptor { + boolean global_keying, // if this is set to true, 256 will be used instead of EAP Identifier + charstring secret, + integer mode, + octetstring req_auth[256], + octetstring req_acct[256], + boolean debugging +} + +type record of integer integer_list; + +type enumerated generic_attrib_value_union_selection { + unbound, + text_val, + string_val, + address_val, + integer_val, + time_val +} + +type enumerated RADIUS_Mode {client, server}; + +//================================================================ +//================================================================ +//================================================================ + + +// Sending in Server mode +// -- Access_Accept or +// -- Access_Reject or +// -- Access_Challenge or +// -- Accounting_Response +// == Disconnect_Request == NOT HANDLED +function f_handle_outgoing_server_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Accept) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else if (pl_ASP_UDP_RADIUS.data.code == Access_Reject) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else if (pl_ASP_UDP_RADIUS.data.code == Access_Challenge) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Response) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else {log("Warning : Will not send out Radius message with code ", pl_ASP_UDP_RADIUS.data.code, " in Server mode!") } +} + +// Sending in Client mode +// -- Access_Request or +// -- Accounting_Request +// == Access_Challenge == NOT HANDLED +// == Disconnect_Ack == NOT HANDLED +// == Disconnect_Nak == NOT HANDLED +function f_handle_outgoing_client_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Request) + { + // fill out authenticator with random number if template has 0s + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + var integer i; + for ( i := 0; i < 16; i := i+1) + { + pl_ASP_UDP_RADIUS.data.authenticator[i] := int2oct(float2int(int2float(256)*rnd()),1) + } + } + v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator; + + // Calulate hidden password + var integer j := 0; + while (j < sizeof(pl_ASP_UDP_RADIUS.data.attributes)) + { + if (ischosen(pl_ASP_UDP_RADIUS.data.attributes[j].attrib_Base_User_Password)) + { + var integer v_pw_len :=lengthof(pl_ASP_UDP_RADIUS.data.attributes[j].attrib_Base_User_Password.base_user_password); + var integer v_padding_length := 16 - (v_pw_len mod 16); + var octetstring v_padded_password := + +pl_ASP_UDP_RADIUS.data.attributes[j].attrib_Base_User_Password.base_user_password & int2oct(0,v_padding_length) + var octetstring v_hidden_password := f_calculate_password( + v_padded_password, + pl_ASP_UDP_RADIUS.data.authenticator, + false + ); + pl_ASP_UDP_RADIUS.data.attributes[j].attrib_Base_User_Password.base_user_password := v_hidden_password; + j := sizeof(pl_ASP_UDP_RADIUS.data.attributes) // stop while loop + } + j := j + 1; + } + f_encode_send(pl_ASP_UDP_RADIUS); + } + + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Request) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + pl_ASP_UDP_RADIUS.data.authenticator := f_calc_MD5(f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data) & char2oct(tsp_SharedSecret)); + } + v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator; + f_encode_send(pl_ASP_UDP_RADIUS); + } + else {log("Warning : Will not send out Radius message with code ", pl_ASP_UDP_RADIUS.data.code, " in Client mode!") } +} + + + +// -- Access_Accept or +// -- Access_Reject or +// -- Access_Challenge or +// -- Accounting_Response +// == Disconnect_Request == NOT HANDLED +function f_handle_incoming_server_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS, octetstring pl_asp_udp_data) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Accept) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else if (pl_ASP_UDP_RADIUS.data.code == Access_Reject) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else if (pl_ASP_UDP_RADIUS.data.code == Access_Challenge) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Response) + { + + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else {log("Warning : Unexpected message with code ", pl_ASP_UDP_RADIUS.data.code, " received in Client mode") } +} + +// Access_Request or +// Accounting_Request +// == Access_Challenge == NOT HANDLED +// == Disconnect_Ack == NOT HANDLED +// == Disconnect_Nak == NOT HANDLED +function f_handle_incoming_client_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS,octetstring pl_asp_udp_data) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Request) + + { + + // Calulate password from hidden password + var integer j := 0; + while (j < sizeof(pl_ASP_UDP_RADIUS.data.attributes)) + { + if (ischosen(pl_ASP_UDP_RADIUS.data.attributes[j].attrib_Base_User_Password)) + { + var octetstring v_padded_password := f_calculate_password( + pl_ASP_UDP_RADIUS.data.attributes[j].attrib_Base_User_Password.base_user_password, + pl_ASP_UDP_RADIUS.data.authenticator, + true + ); + + var integer v_padding_length := 0; + while (v_padded_password[lengthof(v_padded_password) - v_padding_length - 1] == '00'O) + { + v_padding_length := v_padding_length + 1; + } + + var octetstring v_password:= substr (v_padded_password,0,lengthof(v_padded_password) - v_padding_length); + + pl_ASP_UDP_RADIUS.data.attributes[j].attrib_Base_User_Password.base_user_password := v_password; + j := sizeof(pl_ASP_UDP_RADIUS.data.attributes) // stop while loop + } + j := j + 1; + } + + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator // store value + + } + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Request) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator // store value + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & '00000000000000000000000000000000'O + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret) + ) + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + else {log("Warning : Unexpected message with code ", pl_ASP_UDP_RADIUS.data.code, " received in Server mode")} +} + + +// Encrypts Password field in Access Request using Request Authentication +// field and shared secret (modulepar) +function f_calculate_password( octetstring pl_password,octetstring pl_authenticatior, boolean pl_decrypt) runs on RADIUS_mapping_CT return octetstring{ + return f_crypt_password (pl_password,pl_authenticatior,''O,pl_decrypt,tsp_SharedSecret) // false = encode, true = decode +} + +function f_encode_send(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + var ASP_UDP v_asp_udp; + v_asp_udp.data := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + v_asp_udp.addressf := pl_ASP_UDP_RADIUS.addressf; + v_asp_udp.portf := pl_ASP_UDP_RADIUS.portf; + UDP_PCO.send(v_asp_udp); +} + + +//function f_store_RequestAuth_Field +//function f_store_last + +function f_RADIUS_EncDec_Start(RADIUS_Mode pl_RADIUS_Mode) runs on RADIUS_mapping_CT { + + var ASP_UDP_RADIUS v_asp_udp_radius; + var ASP_UDP v_asp_udp; + + while (true) { + alt { + ///////////////////////////////// + // incoming messages on upper port + ///////////////////////////////// + [] UDP_RADIUS_PCO.receive(t_ASP_UDP_RADIUS) -> value v_asp_udp_radius { + if (pl_RADIUS_Mode == server) { + f_handle_outgoing_server_message(v_asp_udp_radius) + } + else { // client mode + f_handle_outgoing_client_message(v_asp_udp_radius) + } + } + + ///////////////////////////////// + // incoming messages on lower port + ///////////////////////////////// + [] UDP_PCO.receive(t_ASP_UDP) -> value v_asp_udp { + + v_asp_udp_radius.data := f_RADIUS_Dec(v_asp_udp.data); + v_asp_udp_radius.addressf := v_asp_udp.addressf; + v_asp_udp_radius.portf := v_asp_udp.portf; + + if (pl_RADIUS_Mode == server) { + f_handle_incoming_client_message(v_asp_udp_radius,v_asp_udp.data) + } + else { // client mode + f_handle_incoming_server_message(v_asp_udp_radius,v_asp_udp.data) + } + } + } + } +} + + + +} // end of module diff --git a/demo/RADIUSandEAP.cfg b/demo/RADIUSandEAP.cfg new file mode 100644 index 0000000000000000000000000000000000000000..dbd977edc0218a4daa0f069514297edf30e09902 --- /dev/null +++ b/demo/RADIUSandEAP.cfg @@ -0,0 +1,21 @@ +[MODULE_PARAMETERS] +tsp_addressf := "159.107.193.33" +tsp_portf := 1100 +tsp_portf2 := 1101 +#tsp_skip_auth_encr := true + +[TESTPORT_PARAMETERS] +system.RADIUS_Port.localPort := "50000" +#system.RADIUS_Port.localPort := "10002" +system.RADIUS_ClientPort.localPort := "1101" +system.RADIUS_ServerPort.localPort := "1100" + + +[LOGGING] +FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING +ConsoleMask := TTCN_ERROR | TTCN_WARNING | TTCN_TESTCASE | TTCN_STATISTICS | TTCN_PORTEVENT +SourceInfoFormat := Yes + +[EXECUTE] +RadiusAndEAP_Demo.tc_RADIUS_EAP_AKA_full_authentication +RadiusAndEAP_Demo.tc_RADIUS_EAP_SIM_full_authentication diff --git a/demo/RADIUSandEAP_Demo.prj b/demo/RADIUSandEAP_Demo.prj new file mode 100644 index 0000000000000000000000000000000000000000..1f7f3c601f6eb09818c42b783e1cf6faea8b2ea8 --- /dev/null +++ b/demo/RADIUSandEAP_Demo.prj @@ -0,0 +1,59 @@ +<!DOCTYPE TITAN_GUI_project_file> +<Project TITAN_version="1.8.pl2" > + <General> + <Project_Name>RADIUSandEAP_Demo</Project_Name> + <Executable_Path>myTest</Executable_Path> + <Working_Dir>.</Working_Dir> + <Build_Host>alpha</Build_Host> + <Execution_Mode>Parallel</Execution_Mode> + <Code_Splitting_Mode>None</Code_Splitting_Mode> + <ScriptFile_AfterMake>gui_make_RPMGandEAP.sh</ScriptFile_AfterMake> + <Log_Format>yes</Log_Format> + <Update_Symlinks>yes</Update_Symlinks> + <Create_Absolute_Symlinks>no</Create_Absolute_Symlinks> + <Update_Makefile>yes</Update_Makefile> + <Localhost_Execute>yes</Localhost_Execute> + <Execute_Command>rsh %host "cd %project_working_dir ; "%executable" %localhost %mctr_port"</Execute_Command> + <Execute_Hosts>alfa, beta, gamma</Execute_Hosts> + <UnUsed_List></UnUsed_List> + </General> + <Modules> + <Module>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PortType.ttcn</Module> + <Module>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_Types.ttcn</Module> + <Module>RADIUSandEAP_Mapping.ttcn</Module> + <Module>RadiusAndEAP_Demo.ttcn</Module> + <Module>../../PPP_CNL113599/src/EAP_Types.ttcn</Module> + <Module>../../COMMON/src/General_Types.ttcn</Module> + </Modules> + <TestPorts> + <TestPort>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.cc</TestPort> + <TestPort>../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.hh</TestPort> + </TestPorts> + <Other_Sources> + <Other_Source>../../PPP_CNL113599/src/EAP_EncDec.cc</Other_Source> + <Other_Source>../src/RADIUS_EncDec.cc</Other_Source> + </Other_Sources> + <Configs> + <Config>RADIUSandEAP.cfg</Config> + </Configs> + <Test_Cases> + <Test_Case>RadiusAndEAP_Demo.control</Test_Case> + <Test_Case>RadiusAndEAP_Demo.tc_RADIUS_EAP_AKA_full_authentication</Test_Case> + <Test_Case>RadiusAndEAP_Demo.tc_RADIUS_EAP_SIM_full_authentication</Test_Case> + <Test_Case>RadiusAndEAP_Demo.tc_RADIUS_EAP_SIM_reauthentication</Test_Case> + </Test_Cases> + <Others> + <Other>gui_make_RPMGandEAP.sh</Other> + <Other>../src/ATTR.awk</Other> + <Other>../src/IPv6_IETF_RFC3162.rdf</Other> + <Other>../src/Base_IETF_RFC2865.rdf</Other> + <Other>../src/BaseTypes_IETF_RFC2865.rdf</Other> + <Other>../src/Extensions_IETF_RFC2869.rdf</Other> + <Other>../src/TunnelAuthentication_IETF_RFC2868.rdf</Other> + <Other>../src/Extensions_IETF_RFC2869.rdf</Other> + <Other>../src/GGSN_FS_46_15517_CSA113_35_4RevB.rdf</Other> + <Other>../src/Accounting_IETF_RFC2866_RFC2867.rdf</Other> + <Other>../src/DynamicAuthorizationExtensions_IETF_RFC5176.rdf</Other> + </Others> + <File_Group name="MainFileGroup" /> +</Project> diff --git a/demo/RADIUSandEAP_Mapping.ttcn b/demo/RADIUSandEAP_Mapping.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..80a11749e4dd96257f78dba5fab9a760fcbc6421 --- /dev/null +++ b/demo/RADIUSandEAP_Mapping.ttcn @@ -0,0 +1,492 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ +// +// File: RADIUSandEAP_Mapping.ttcn +// Description: Example module providing UDP Mapping for RPMG +// Rev: R12A +// Prodnr: CNL 113 600 +// Remark: This file is not a part of the product. +// +// +// + + + +module RADIUSandEAP_Mapping +{ + import from EAP_Types all; + import from RADIUS_Types all; + import from UDPasp_Types all; + import from UDPasp_PortType all; + + modulepar{ + charstring tsp_SharedSecret := "sharedSecret" + } + + +type record ASP_UDP_RADIUS { + PDU_RADIUS data, + AddressType addressf, + PortType portf +} + +type port UDPasp_RADIUS_PT message { + + inout ASP_UDP_RADIUS +} with {extension "internal"} + + +type component RADIUS_mapping_CT { + + var RADIUS_port_descriptor v_RADIUS_port_descriptor; + var EAP_port_descriptor v_EAP_port_descriptor; + + port UDPasp_RADIUS_PT UDP_RADIUS_PCO; // upper port + port UDPasp_PT UDP_PCO; // lower port + +} + +template ASP_UDP t_ASP_UDP := ?; +template ASP_UDP_RADIUS t_ASP_UDP_RADIUS := ?; + + + +//================================================================ +// Types from RADIUS test port, info needed for external functions +//================================================================ +type record RADIUS_port_descriptor { + charstring secret, + octetstring req_auth[256], + octetstring req_acct[256], + octetstring req_disc[256] +} + +type enumerated RADIUS_Mode {client, server}; + +//================================================================ +//================================================================ +//================================================================ + +// Sending in Server mode +// -- Access_Accept or +// -- Access_Reject or +// -- Access_Challenge or +// -- Accounting_Response +// -- Disconnect_Request +function f_handle_outgoing_server_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + // Calculate s-key + var integer j := 0; + while (j < sizeof(pl_ASP_UDP_RADIUS.data.attributes)) + { + if (pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_type==Base_Vendor_Specific) + { + if(pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.vendor_id==cdma2000) + { + var integer i:=0; + while (i<sizeof(pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.attrib_value.f_cdma2000_subattr_list)) + { + if(pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.attrib_value.f_cdma2000_subattr_list[i].f_cdma2000_type==s_key) + { + var octetstring v_s_key:=pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.attrib_value.f_cdma2000_subattr_list[i].string_val; + pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.attrib_value.f_cdma2000_subattr_list[i].string_val := f_crypt_s_key(v_s_key,v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier],tsp_SharedSecret,false); + } + i:=i+1; + } + } + }j:=j+1; + } + + + if ((pl_ASP_UDP_RADIUS.data.code == Access_Accept) or + (pl_ASP_UDP_RADIUS.data.code == Access_Reject) or + (pl_ASP_UDP_RADIUS.data.code == Access_Challenge)) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Response) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else if (pl_ASP_UDP_RADIUS.data.code == Disconnect_Request) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + if (isvalue(v_RADIUS_port_descriptor.req_disc[pl_ASP_UDP_RADIUS.data.identifier])) + { + var octetstring v_RADIUS_encoded := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + pl_ASP_UDP_RADIUS.data.authenticator := + f_calc_MD5( + substr(v_RADIUS_encoded,0,4) + & v_RADIUS_port_descriptor.req_disc[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(v_RADIUS_encoded,20,(lengthof(v_RADIUS_encoded)-20)) + & char2oct(tsp_SharedSecret)); + } + } + f_encode_send(pl_ASP_UDP_RADIUS) + } + else {log("Warning : Will not send out Radius message with code ", pl_ASP_UDP_RADIUS.data.code, " in Server mode!") } +} + +// Sending in Client mode +// -- Access_Request or +// -- Accounting_Request +// -- Access_Challenge +// -- Disconnect_Ack +// -- Disconnect_Nak +function f_handle_outgoing_client_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Request) + { + // fill out authenticator with random number if template has 0s + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + var integer i; + for ( i := 0; i < 16; i := i+1) + { + pl_ASP_UDP_RADIUS.data.authenticator[i] := int2oct(float2int(int2float(256)*rnd()),1) + } + } + v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator; + + // Calulate hidden password + var integer j := 0; + while (j < sizeof(pl_ASP_UDP_RADIUS.data.attributes)) + { + if (pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_type==Base_User_Password) + { + var integer v_pw_len :=lengthof(pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password); + var integer v_padding_length := 16 - (v_pw_len mod 16); + var octetstring v_padded_password :=pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password & int2oct(0,v_padding_length) + var octetstring v_hidden_password := f_calculate_password( + v_padded_password, + pl_ASP_UDP_RADIUS.data.authenticator, + false + ); + pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password := v_hidden_password; + j := sizeof(pl_ASP_UDP_RADIUS.data.attributes) // stop while loop + } + j := j + 1; + } + f_encode_send(pl_ASP_UDP_RADIUS); + } + + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Request) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + pl_ASP_UDP_RADIUS.data.authenticator := f_calc_MD5(f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data) & char2oct(tsp_SharedSecret)); + } + v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator; + f_encode_send(pl_ASP_UDP_RADIUS); + } + else if (pl_ASP_UDP_RADIUS.data.code == Access_Challenge) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + pl_ASP_UDP_RADIUS.data.authenticator :=v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier]; + pl_ASP_UDP_RADIUS.data.authenticator := f_calc_MD5(f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data) & char2oct(tsp_SharedSecret)); + } + // v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator; + f_encode_send(pl_ASP_UDP_RADIUS); + } + else if ((pl_ASP_UDP_RADIUS.data.code == Disconnect_ACK) or + (pl_ASP_UDP_RADIUS.data.code == Disconnect_NAK)) + { + if (pl_ASP_UDP_RADIUS.data.authenticator == '00000000000000000000000000000000'O) + { + pl_ASP_UDP_RADIUS.data.authenticator := f_calc_MD5(f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data) & char2oct(tsp_SharedSecret)); + } + v_RADIUS_port_descriptor.req_disc[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator; + f_encode_send(pl_ASP_UDP_RADIUS); + } + else {log("Warning : Will not send out Radius message with code ", pl_ASP_UDP_RADIUS.data.code, " in Client mode!") } +} + + + +// -- Access_Accept or +// -- Access_Reject or +// -- Access_Challenge or +// -- Accounting_Response +// -- Disconnect_Request +function f_handle_incoming_server_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS, octetstring pl_asp_udp_data) runs on RADIUS_mapping_CT { + // Calculate s-key + var integer j := 0; + while (j < sizeof(pl_ASP_UDP_RADIUS.data.attributes)) + { + if (pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_type==Base_Vendor_Specific) + { + if(pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.vendor_id==cdma2000) + { + var integer i:=0; + while (i<sizeof(pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.attrib_value.f_cdma2000_subattr_list)) + { + if(pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.attrib_value.f_cdma2000_subattr_list[i].f_cdma2000_type==s_key) + { + var octetstring v_s_key:=pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.attrib_value.f_cdma2000_subattr_list[i].string_val; + pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_vendor_specific.attrib_value.f_cdma2000_subattr_list[i].string_val := f_crypt_s_key(v_s_key,v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier],tsp_SharedSecret,true); + } + i:=i+1; + } + } + }j:=j+1; + } + + if ((pl_ASP_UDP_RADIUS.data.code == Access_Accept) or + (pl_ASP_UDP_RADIUS.data.code == Access_Reject) or + (pl_ASP_UDP_RADIUS.data.code == Access_Challenge)) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Response) + { + + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + else if (pl_ASP_UDP_RADIUS.data.code == Disconnect_Request) + { + + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_disc[pl_ASP_UDP_RADIUS.data.identifier] // stored value + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret)) + + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + + else {log("Warning : Unexpected message with code ", pl_ASP_UDP_RADIUS.data.code, " received in Client mode") } +} + +// Access_Request or +// Accounting_Request +// Access_Challenge +// Disconnect_Ack +// Disconnect_Nak +function f_handle_incoming_client_message(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS,octetstring pl_asp_udp_data) runs on RADIUS_mapping_CT { + + if (pl_ASP_UDP_RADIUS.data.code == Access_Request) + + { + + // Calulate password from hidden password + var integer j := 0; + while (j < sizeof(pl_ASP_UDP_RADIUS.data.attributes)) + { + if (pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_type==Base_User_Password) + { + var octetstring v_padded_password := f_calculate_password( + pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password, + pl_ASP_UDP_RADIUS.data.authenticator, + true + ); + + var integer v_padding_length := 0; + while (v_padded_password[lengthof(v_padded_password) - v_padding_length - 1] == '00'O) + { + v_padding_length := v_padding_length + 1; + } + + var octetstring v_password:= substr (v_padded_password,0,lengthof(v_padded_password) - v_padding_length); + + pl_ASP_UDP_RADIUS.data.attributes[j].genericAttrib.attrib_data.base_user_password := v_password; + j := sizeof(pl_ASP_UDP_RADIUS.data.attributes) // stop while loop + } + j := j + 1; + } + + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator // store value + + } + else if (pl_ASP_UDP_RADIUS.data.code == Accounting_Request) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + v_RADIUS_port_descriptor.req_acct[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator // store value + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & '00000000000000000000000000000000'O + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret) + ) + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + else if (pl_ASP_UDP_RADIUS.data.code == Access_Challenge) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + // v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator // store value + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & v_RADIUS_port_descriptor.req_auth[pl_ASP_UDP_RADIUS.data.identifier] + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret) + ) + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { + log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + else if ((pl_ASP_UDP_RADIUS.data.code == Disconnect_ACK) or + (pl_ASP_UDP_RADIUS.data.code == Disconnect_NAK)) + { + UDP_RADIUS_PCO.send(pl_ASP_UDP_RADIUS); + + v_RADIUS_port_descriptor.req_disc[pl_ASP_UDP_RADIUS.data.identifier] := pl_ASP_UDP_RADIUS.data.authenticator // store value + + var octetstring v_calc_auth := f_calc_MD5( + substr(pl_asp_udp_data,0,4) + & '00000000000000000000000000000000'O + & substr(pl_asp_udp_data,20, lengthof(pl_asp_udp_data)-20) + & char2oct(tsp_SharedSecret) + ) + if (v_calc_auth != pl_ASP_UDP_RADIUS.data.authenticator) + { log("Warning : Unexpected authentication value received in message with code ", pl_ASP_UDP_RADIUS.data.code) } + } + else {log("Warning : Unexpected message with code ", pl_ASP_UDP_RADIUS.data.code, " received in Server mode")} +} + + +// Encrypts Password field in Access Request using Request Authentication +// field and shared secret (modulepar) +function f_calculate_password( octetstring pl_password,octetstring pl_authenticatior, boolean pl_decrypt) runs on RADIUS_mapping_CT return octetstring{ + return f_crypt_password (pl_password,pl_authenticatior,''O,pl_decrypt,tsp_SharedSecret) // false = encode, true = decode +} + +function f_encode_send(in ASP_UDP_RADIUS pl_ASP_UDP_RADIUS) runs on RADIUS_mapping_CT { + var ASP_UDP v_asp_udp; + v_asp_udp.data := f_RADIUS_Enc(pl_ASP_UDP_RADIUS.data); + v_asp_udp.addressf := pl_ASP_UDP_RADIUS.addressf; + v_asp_udp.portf := pl_ASP_UDP_RADIUS.portf; + UDP_PCO.send(v_asp_udp); +} + + +function f_get_Ext_EAP_Message(inout PDU_RADIUS pl_asp_udp_radius_data,RADIUS_Mode pl_RADIUS_Mode,boolean pl_incoming_message) runs on RADIUS_mapping_CT +{ + for (var integer j := 0;j < sizeof(pl_asp_udp_radius_data.attributes);j:=j+1) + { + if (pl_asp_udp_radius_data.attributes[j].genericAttrib.attrib_type==Ext_EAP_Message) + { + var octetstring vl_ext_eap:=pl_asp_udp_radius_data.attributes[j].genericAttrib.attrib_data.ext_eap_message; + if (pl_RADIUS_Mode == server){v_EAP_port_descriptor.serverMode:=true;} + f_get_EAP_parameters(vl_ext_eap,v_EAP_port_descriptor,pl_incoming_message); + pl_asp_udp_radius_data.attributes[j].genericAttrib.attrib_data.ext_eap_message:=vl_ext_eap; + } + } +} + +function f_RADIUS_EncDec_Start(RADIUS_Mode pl_RADIUS_Mode, EAP_port_descriptor pl_EAP_port_descriptor) runs on RADIUS_mapping_CT { + + var ASP_UDP_RADIUS v_asp_udp_radius; + var ASP_UDP v_asp_udp; + v_EAP_port_descriptor:=pl_EAP_port_descriptor; + while (true) { + alt { + ///////////////////////////////// + // incoming messages on upper port + ///////////////////////////////// + [] UDP_RADIUS_PCO.receive(t_ASP_UDP_RADIUS) -> value v_asp_udp_radius { + if (pl_RADIUS_Mode == server) { + f_get_Ext_EAP_Message(v_asp_udp_radius.data,pl_RADIUS_Mode,false); + f_handle_outgoing_server_message(v_asp_udp_radius) + } + else { // client mode + f_get_Ext_EAP_Message(v_asp_udp_radius.data,pl_RADIUS_Mode,false); + f_handle_outgoing_client_message(v_asp_udp_radius) + } + } + + ///////////////////////////////// + // incoming messages on lower port + ///////////////////////////////// + [] UDP_PCO.receive(t_ASP_UDP) -> value v_asp_udp { + v_asp_udp_radius.data := f_RADIUS_Dec(v_asp_udp.data); + v_asp_udp_radius.addressf := v_asp_udp.addressf; + v_asp_udp_radius.portf := v_asp_udp.portf; + + if (pl_RADIUS_Mode == server) { + f_handle_incoming_client_message(v_asp_udp_radius,v_asp_udp.data) ; + f_get_Ext_EAP_Message(v_asp_udp_radius.data,pl_RADIUS_Mode,true); + } + else { // client mode + f_handle_incoming_server_message(v_asp_udp_radius,v_asp_udp.data); + f_get_Ext_EAP_Message(v_asp_udp_radius.data,pl_RADIUS_Mode,true); + } + + + } + } + } +} + + + +} // end of module diff --git a/demo/RadiusAndEAP_Demo.ttcn b/demo/RadiusAndEAP_Demo.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f198de875a05ed362634f369888742e79993b318 --- /dev/null +++ b/demo/RadiusAndEAP_Demo.ttcn @@ -0,0 +1,821 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ +// +// File: RadiusAndEAP_Demo.ttcn +// Rev: R12A +// Prodnr: CNL 113 600 +// Remark: This file is not a part of the product. +// +// +// + + +module RadiusAndEAP_Demo { + +import from RADIUSandEAP_Mapping all; +import from UDPasp_PortType all; +import from UDPasp_Types all; +import from RADIUS_Types all; +import from EAP_Types all; + +modulepar charstring tsp_addressf := "159.107.193.33"; +modulepar integer tsp_portf := 1100; +modulepar integer tsp_portf2 := 1101; + +modulepar octetstring tsp_s_key := '01234567ABCD'O; +modulepar octetstring tsp_salt := 'ABCD'O + + +type component RADIUS_MTC +{ + +} + +type component RADIUSComponent_CT +{ + port UDPasp_RADIUS_PT RADIUS_PORT ; +} + + +type component SystemComponent +{ + port UDPasp_PT RADIUS_Port; + port UDPasp_PT RADIUS_ClientPort; + port UDPasp_PT RADIUS_ServerPort; +} + + +template ASP_UDP_RADIUS t_ASP_UDP_RADIUS(template Code pl_Code,template PDU_EAP pl_PDU_EAP,template PortType pl_port):= + + { data := { code := pl_Code , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { genericAttrib:={ + attrib_type := Ext_EAP_Message, + attrib_length := 0, + attrib_data:={ext_eap_message := f_enc_PDU_EAP(valueof(pl_PDU_EAP))}}}}}, + addressf := tsp_addressf, + portf := pl_port }; + +template ASP_UDP_RADIUS tr_ASP_UDP_RADIUS(template Code pl_Code):= + + { data := { code := pl_Code , + identifier := 1, + message_length := ?, + authenticator := ?, + attributes := ?}, + addressf := tsp_addressf, + portf := ?}; + +template PDU_EAP t_PDU_EAP_success:={ + code := success_code, + identifier := 1, + packet_length := 0, + packet_data:= omit}; + +template PDU_EAP tr_PDU_EAP_success modifies t_PDU_EAP_success:={ + packet_length := ?}; + +template PDU_EAP t_PDU_EAP_id (template eap_packet_code_enum pl_code):={ + code := pl_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_identity, + eap_packet_type_data := { + f_eap_identity := '414243444546303132'O} + } }; + +template PDU_EAP tr_PDU_EAP_id (template eap_packet_code_enum pl_code) := { + code := pl_code, + identifier := 1, + packet_length := ?, + packet_data := { + eap_packet_type := eap_identity, + eap_packet_type_data := { + f_eap_identity := '414243444546303132'O} + } }; + +template PDU_EAP t_PDU_EAP_SIM_versionList:={ + code := request_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_sim, + eap_packet_type_data := { + f_eap_sim := { + subtype := eap_sim_start, + reserved := '0000'O, + attrib_list := { + { f_at_version_list := { + attrib := at_version_list, + attrib_length := 0, + actual_length:=0, + version_list := {'0001'O,'0002'O,'0003'O} } + }}}}} + } + +template PDU_EAP tr_PDU_EAP_SIM_versionList modifies t_PDU_EAP_SIM_versionList := { + packet_length:=?, + packet_data := { + eap_packet_type_data := { + f_eap_sim := { + attrib_list := { + { f_at_version_list := { + attrib_length := ?, + actual_length:=? + }} + }}}}}; + + +template PDU_EAP t_PDU_EAP_SIM_nonceMT_selectedVersion:={ //02010020120A000007050000ABCDEFABCDEFABCDEFABCDEFABCDEFAB10010001 + code := response_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_sim, + eap_packet_type_data := { + f_eap_sim := { + subtype := eap_sim_start, + reserved := '0000'O, + attrib_list := { + { f_at_nonce_mt := { + attrib := at_nonce_mt, + attrib_length := 0, + reserved:='0000'O, + attrib_value := 'ABCDEFABCDEFABCDEFABCDEFABCDEFAB'O }}, + { f_at_selected_version := { + attrib := at_selected_version, + attrib_length := 0, + attrib_data := '0001'O }} + + }}}} + } + +template PDU_EAP tr_PDU_EAP_SIM_nonceMT_selectedVersion modifies t_PDU_EAP_SIM_nonceMT_selectedVersion := { + packet_length:=?, + packet_data := { + eap_packet_type_data := { + f_eap_sim := { + attrib_list := { + { f_at_nonce_mt := { + attrib_length := ? + }}, + { f_at_selected_version := { + attrib_length := ? + }} + }}}}}; + +template PDU_EAP t_PDU_EAP_SIM_randIvCounterMac:={ + code := response_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_sim, + eap_packet_type_data := { + f_eap_sim := { + subtype := eap_sim_challenge, + reserved := '0000'O, + attrib_list := { + { f_at_rand := { + attrib := at_rand, + attrib_length := 0, + reserved := '0000'O, + attrib_value := { '01234567890123456789012345678901'O, '01234567890123456789012345678901'O, '01234567890123456789012345678901'O } + } }, + { f_at_iv := { + attrib := at_iv, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '00112233445566778899AABBCCDDEEFF'O + } }, + { f_at_encr_data := { + attrib := at_encr_data, + attrib_length := 0, + reserved := '0000'O, + attrib_value := { decrypted_attrib_value:= + {{ f_at_counter := { + attrib := at_counter, + attrib_length := 0, + attrib_data := '0001'O }}} + }} }, + { f_at_mac := { + attrib := at_mac, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '00000000000000000000000000000000'O}} + }}}}} + +template PDU_EAP tr_PDU_EAP_SIM_randIvCounterMac modifies t_PDU_EAP_SIM_randIvCounterMac := { + packet_length:=?, + packet_data := { + eap_packet_type_data := { + f_eap_sim := { + attrib_list := { + { f_at_rand := { + attrib_length := ? + } }, + { f_at_iv := { + attrib := at_iv, + attrib_length := ? + } }, + { f_at_encr_data := ?}, + { f_at_mac := { + attrib_length := ?, + attrib_value := ?}} + }}}}}; + +template PDU_EAP t_PDU_EAP_SIM_mac:={ + code := response_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_sim, + eap_packet_type_data := { + f_eap_sim := { + subtype := eap_sim_challenge, + reserved := '0000'O, + attrib_list := { + { f_at_mac := { + attrib := at_mac, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '00000000000000000000000000000000'O } + }}}}}}; + +template PDU_EAP tr_PDU_EAP_SIM_mac modifies t_PDU_EAP_SIM_mac := { + packet_length:=?, + packet_data := { + eap_packet_type_data := { + f_eap_sim := { + attrib_list := { + { f_at_mac := { + attrib_length := ?, + attrib_value := ? }}}}}} +}; + +template PDU_EAP t_PDU_EAP_SIM_reauth_ivEncrMac:={ + code := response_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_sim, + eap_packet_type_data := { + f_eap_sim := { + subtype := eap_sim_re_authentication, + reserved := '0000'O, + attrib_list := { + { f_at_iv := { + attrib := at_iv, + attrib_length := 5, + reserved := '0000'O, + attrib_value := '00112233445566778899AABBCCDDEEFF'O + } }, + { f_at_encr_data := { + attrib := at_encr_data, + attrib_length :=0, + reserved := '0000'O, + attrib_value := { decrypted_attrib_value:={ + { f_at_counter := { + attrib := at_counter, + attrib_length := 0, + attrib_data := '0001'O } }, + { f_at_nonce_s := { + attrib := at_nonce_s, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '0123456789abcdef0123456789abcdef'O } }, + { f_at_next_reauth_id := { + attrib := at_next_reauth_id, + attrib_length := 0, + actual_length := 0, + attrib_value := '1234567890'O } } + }} }}, + { f_at_mac := { + attrib := at_mac, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '00000000000000000000000000000000'O } + }}}}}}; + +template PDU_EAP tr_PDU_EAP_SIM_reauth_ivEncrMac modifies t_PDU_EAP_SIM_reauth_ivEncrMac := { + packet_length := ?, + packet_data := { + eap_packet_type_data := { + f_eap_sim := { + attrib_list := { + { f_at_iv := { + attrib_length := ? + } }, + { f_at_encr_data := { + attrib_length :=?, + reserved := '0000'O, + attrib_value := ? + }}, + { f_at_mac := { + attrib_length := ?, + attrib_value := ? } + }}}}}}; + +template PDU_EAP t_PDU_EAP_SIM_reauth_ivEncrMac2:={ + code := request_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_sim, + eap_packet_type_data := { + f_eap_sim := { + subtype := eap_sim_re_authentication, + reserved := '0000'O, + attrib_list := { + { f_at_iv := { + attrib := at_iv, + attrib_length := 5, + reserved := '0000'O, + attrib_value := 'ABCDEFABCDEFABCDEFABCDEFABCDEFAB'O + } }, + { f_at_encr_data := { + attrib := at_encr_data, + attrib_length :=0, + reserved := '0000'O, + attrib_value := { decrypted_attrib_value:={ + { f_at_counter := { + attrib := at_counter, + attrib_length := 0, + attrib_data := '0001'O } } + }} }}, + { f_at_mac := { + attrib := at_mac, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '00000000000000000000000000000000'O } + }}}}}}; + +template PDU_EAP tr_PDU_EAP_SIM_reauth_ivEncrMac2 modifies t_PDU_EAP_SIM_reauth_ivEncrMac2 := { + packet_length := ?, + packet_data := { + eap_packet_type_data := { + f_eap_sim := { + attrib_list := { + { f_at_iv := { + attrib_length := ? + } }, + { f_at_encr_data := { + attrib_length :=?, + reserved := '0000'O, + attrib_value := ? + }}, + { f_at_mac := { + attrib_length := ?, + attrib_value := ? } + }}}}}}; + +template PDU_EAP t_PDU_EAP_AKA_randAutnIvEncrMac:={ + code := request_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_aka, + eap_packet_type_data := { + f_eap_aka := { + subtype := eap_aka_challenge, + reserved := '0000'O, + attrib_list := { + { f_at_rand := { + attrib := at_rand, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '11223344556677889900AABBCCDDEEFF'O } + }, + { f_at_autn := { + attrib := at_autn, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '00000000000000000000000000000000'O } + }, + { f_at_iv := { + attrib := at_iv, + attrib_length := 5, + reserved := '0000'O, + attrib_value := '00112233445566778899AABBCCDDEEFF'O + } }, + { f_at_encr_data := { + attrib := at_encr_data, + attrib_length :=0, + reserved := '0000'O, + attrib_value := { decrypted_attrib_value:= + {{ f_at_counter := { + attrib := at_counter, + attrib_length := 0, + attrib_value := '0001'O } } + }} }}, + { f_at_mac := { + attrib := at_mac, + attrib_length :=0, + reserved := '0000'O, + attrib_value := '00000000000000000000000000000000'O } + } } } } } + } + +template PDU_EAP tr_PDU_EAP_AKA_randAutnIvEncrMac modifies t_PDU_EAP_AKA_randAutnIvEncrMac := { + packet_length:=?, + packet_data := { + eap_packet_type_data := { + f_eap_aka := { + attrib_list := { + { f_at_rand := { + attrib_length := ? + }}, + { f_at_autn := { + attrib_length := ? , + attrib_value := ? + }}, + { f_at_iv := { + attrib_length := ? + }}, + { f_at_encr_data := { + attrib_length := ? , + attrib_value := ? }}, + { f_at_mac := { + attrib_length := ? , + attrib_value := ? + }} + }} + }}}; + +template PDU_EAP t_PDU_EAP_AKA_mac:={ + code := response_code, + identifier := 1, + packet_length := 0, + packet_data := { + eap_packet_type := eap_aka, + eap_packet_type_data := { + f_eap_aka := { + subtype := eap_aka_challenge, + reserved := '0000'O, + attrib_list := { + { f_at_mac := { + attrib := at_mac, + attrib_length := 0, + reserved := '0000'O, + attrib_value := '00000000000000000000000000000000'O } + }}}}}}; + +template PDU_EAP tr_PDU_EAP_AKA_mac modifies t_PDU_EAP_AKA_mac := { + packet_length:=?, + packet_data := { + eap_packet_type_data := { + f_eap_aka := { + attrib_list := { + { f_at_mac := { + attrib_length := ?, + attrib_value := ? }}}}}} +}; + +function f_EAP_SIM_full_auth_server() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS,v_ASP_UDP_RADIUS1,v_ASP_UDP_RADIUS2; + timer t1 := 15.0; + t1.start; + alt { + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Request)) -> value v_ASP_UDP_RADIUS{ + var PDU_EAP vl_PDU_EAP:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS); + if (match(vl_PDU_EAP,tr_PDU_EAP_id(response_code))){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Challenge,t_PDU_EAP_SIM_versionList,tsp_portf2))); + alt{ + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Challenge)) -> value v_ASP_UDP_RADIUS1{ + var PDU_EAP vl_PDU_EAP2:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS1.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS1); + if (match(vl_PDU_EAP2,tr_PDU_EAP_SIM_nonceMT_selectedVersion)){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Challenge,t_PDU_EAP_SIM_randIvCounterMac,tsp_portf2))); + alt{ + []RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Challenge)) -> value v_ASP_UDP_RADIUS2{ + var PDU_EAP vl_PDU_EAP3:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS2.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS2); + if (match(vl_PDU_EAP3,tr_PDU_EAP_SIM_mac)){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Accept,t_PDU_EAP_success,tsp_portf2))); + setverdict (pass)} + else {setverdict (fail); repeat;}} + [] t1.timeout {setverdict (fail)} + }}} + [] t1.timeout {setverdict (fail)} + } + }} + [] t1.timeout {setverdict (fail)} + } +} + + +function f_EAP_SIM_full_auth_client() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1,v_ASP_UDP_RADIUS2; + + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Request,t_PDU_EAP_id(response_code),tsp_portf))); + timer t1 := 15.0; + t1.start; + alt { + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Challenge)) -> value v_ASP_UDP_RADIUS1{ + var PDU_EAP vl_PDU_EAP:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS1.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS1); + if (match(vl_PDU_EAP,tr_PDU_EAP_SIM_versionList)){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Challenge,t_PDU_EAP_SIM_nonceMT_selectedVersion,tsp_portf))); + alt{ + []RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Challenge)) -> value v_ASP_UDP_RADIUS2{ + var PDU_EAP vl_PDU_EAP2:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS2.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS2); + if (match(vl_PDU_EAP2,tr_PDU_EAP_SIM_randIvCounterMac)){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Challenge,t_PDU_EAP_SIM_mac,tsp_portf))); + alt{ + []RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Accept)) { + setverdict (pass)} + [] t1.timeout {setverdict (fail)} + }}} + [] t1.timeout {setverdict (fail)} + }}} + [] t1.timeout {setverdict (fail)} + } + +} + + +function f_EAP_SIM_reauth_server() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS,v_ASP_UDP_RADIUS1,v_ASP_UDP_RADIUS2; + timer t1 := 15.0; + t1.start; + alt { + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Request)) -> value v_ASP_UDP_RADIUS{ + var PDU_EAP vl_PDU_EAP:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS); + if (match(vl_PDU_EAP,tr_PDU_EAP_id(response_code))){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Challenge,t_PDU_EAP_SIM_reauth_ivEncrMac,tsp_portf2))); + alt{ + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Challenge)) -> value v_ASP_UDP_RADIUS1{ + var PDU_EAP vl_PDU_EAP2:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS1.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS1); + if (match(vl_PDU_EAP2,tr_PDU_EAP_SIM_reauth_ivEncrMac2)){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Accept,t_PDU_EAP_success,tsp_portf2))); + setverdict (pass)} + else {setverdict (fail); }} + [] t1.timeout {setverdict (fail)} + } + }} + [] t1.timeout {setverdict (fail)} + } +} + + +function f_EAP_SIM_reauth_client() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1,v_ASP_UDP_RADIUS2; + + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Request,t_PDU_EAP_id(response_code),tsp_portf))); + timer t1 := 15.0; + t1.start; + alt { + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Challenge)) -> value v_ASP_UDP_RADIUS1{ + var PDU_EAP vl_PDU_EAP:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS1.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS1); + if (match(vl_PDU_EAP,tr_PDU_EAP_SIM_reauth_ivEncrMac)){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Challenge,t_PDU_EAP_SIM_reauth_ivEncrMac2,tsp_portf))); + alt{ + []RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Accept)) { + setverdict (pass)} + [] t1.timeout {setverdict (fail)} + }}} + [] t1.timeout {setverdict (fail)} + } + +} + + +function f_EAP_AKA_full_auth_server() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1,v_ASP_UDP_RADIUS2; + timer t1 := 15.0; + t1.start; + alt { + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Request)) -> value v_ASP_UDP_RADIUS1{ + var PDU_EAP vl_PDU_EAP:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS1.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS1); + if (match(vl_PDU_EAP,tr_PDU_EAP_id(response_code))){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Challenge,t_PDU_EAP_AKA_randAutnIvEncrMac,tsp_portf2))); + alt{ + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Challenge)) -> value v_ASP_UDP_RADIUS2{ + var PDU_EAP vl_PDU_EAP2:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS2.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + if (match(vl_PDU_EAP2,tr_PDU_EAP_AKA_mac)){ + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Accept,t_PDU_EAP_success,tsp_portf2))); + setverdict (pass); + }} + [] t1.timeout {setverdict (fail)} + } + } + } + [] t1.timeout {setverdict (fail)} + } + +} + +function f_EAP_AKA_full_auth_client() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1; + + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Request,t_PDU_EAP_id(response_code),tsp_portf))); + timer t1 := 15.0; + t1.start; + alt { + [] RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Challenge)) -> value v_ASP_UDP_RADIUS1{ + var PDU_EAP vl_PDU_EAP:=f_dec_PDU_EAP(v_ASP_UDP_RADIUS1.data.attributes[0].genericAttrib.attrib_data.ext_eap_message); + log(v_ASP_UDP_RADIUS1); + if (match(vl_PDU_EAP,tr_PDU_EAP_AKA_randAutnIvEncrMac)) + { + RADIUS_PORT.send(valueof(t_ASP_UDP_RADIUS(Access_Challenge,t_PDU_EAP_AKA_mac,tsp_portf))); + alt{ + []RADIUS_PORT.receive(tr_ASP_UDP_RADIUS(Access_Accept)) { + setverdict (pass) + } + [] t1.timeout {setverdict (fail)} + }} + } + [] t1.timeout {setverdict (fail)} + } + +} + +///////////////////////// +testcase tc_RADIUS_EAP_AKA_full_authentication() runs on RADIUS_MTC system SystemComponent { + + var RADIUSComponent_CT client := RADIUSComponent_CT.create; + var RADIUSComponent_CT server := RADIUSComponent_CT.create; + + var RADIUS_mapping_CT mappingServer := RADIUS_mapping_CT.create; + var RADIUS_mapping_CT mappingClient := RADIUS_mapping_CT.create; + + connect(client: RADIUS_PORT , mappingClient:UDP_RADIUS_PCO); + map(mappingClient:UDP_PCO, system: RADIUS_ClientPort); + + connect(server: RADIUS_PORT , mappingServer:UDP_RADIUS_PCO); + map(mappingServer:UDP_PCO, system: RADIUS_ServerPort); + + var EAP_port_descriptor v_EAP_port_descriptor_Server,v_EAP_port_descriptor_Client; + f_initEAPPortDescriptor(v_EAP_port_descriptor_Server); +// f_set_K(1,tsp_AKA_K,v_EAP_port_descriptor_Server); + f_initEAPPortDescriptor(v_EAP_port_descriptor_Client); +// f_set_K(1,tsp_AKA_K,v_EAP_port_descriptor_Client); +// f_set_SQN(1,tsp_AKA_SQN,v_EAP_port_descriptor_Server); +// f_set_SQN_MS(1,tsp_AKA_SQN_MS,v_EAP_port_descriptor_Server); +// f_set_AMF(1,tsp_AKA_AMF,v_EAP_port_descriptor_Server); + + mappingServer.start(f_RADIUS_EncDec_Start(server,v_EAP_port_descriptor_Server)) + server.start(f_EAP_AKA_full_auth_server()); + mappingClient.start(f_RADIUS_EncDec_Start(client,v_EAP_port_descriptor_Client)) + client.start(f_EAP_AKA_full_auth_client()); + + timer t1 := 15.0; + t1.start; + + alt { + [] server.done { + alt { + [] client.done { + setverdict (pass); + } + [] t1.timeout { + setverdict (fail); + } + } + } + [] t1.timeout { + setverdict(fail); + } + } + unmap(mappingClient:UDP_PCO, system: RADIUS_ClientPort); + unmap(mappingServer:UDP_PCO, system: RADIUS_ServerPort); + +} + + + +///////////////////////// +testcase tc_RADIUS_EAP_SIM_full_authentication() runs on RADIUS_MTC system SystemComponent { + + var RADIUSComponent_CT client := RADIUSComponent_CT.create; + var RADIUSComponent_CT server := RADIUSComponent_CT.create; + + var RADIUS_mapping_CT mappingServer := RADIUS_mapping_CT.create; + var RADIUS_mapping_CT mappingClient := RADIUS_mapping_CT.create; + + var EAP_port_descriptor v_EAP_port_descriptor_Server,v_EAP_port_descriptor_Client; + f_initEAPPortDescriptor(v_EAP_port_descriptor_Server); + f_initEAPPortDescriptor(v_EAP_port_descriptor_Client); + f_set_Ki(1,tsp_SIM_Ki,v_EAP_port_descriptor_Server); + f_set_Ki(1,tsp_SIM_Ki,v_EAP_port_descriptor_Client); + + connect(client: RADIUS_PORT , mappingClient:UDP_RADIUS_PCO); + map(mappingClient:UDP_PCO, system: RADIUS_ClientPort); + + connect(server: RADIUS_PORT , mappingServer:UDP_RADIUS_PCO); + map(mappingServer:UDP_PCO, system: RADIUS_ServerPort); + + mappingServer.start(f_RADIUS_EncDec_Start(server,v_EAP_port_descriptor_Server)); + server.start(f_EAP_SIM_full_auth_server()); + mappingClient.start(f_RADIUS_EncDec_Start(client,v_EAP_port_descriptor_Client)); + client.start(f_EAP_SIM_full_auth_client()); + + timer t1 := 15.0; + t1.start; + + alt { + [] server.done { + alt { + [] client.done { + setverdict (pass); + } + [] t1.timeout { + setverdict (fail); + } + } + } + [] t1.timeout { + setverdict(fail); + } + } + unmap(mappingClient:UDP_PCO, system: RADIUS_ClientPort); + unmap(mappingServer:UDP_PCO, system: RADIUS_ServerPort); + +} + +///////////////////////// +testcase tc_RADIUS_EAP_SIM_reauthentication() runs on RADIUS_MTC system SystemComponent { + + var RADIUSComponent_CT client := RADIUSComponent_CT.create; + var RADIUSComponent_CT server := RADIUSComponent_CT.create; + + var RADIUS_mapping_CT mappingServer := RADIUS_mapping_CT.create; + var RADIUS_mapping_CT mappingClient := RADIUS_mapping_CT.create; + + var EAP_port_descriptor v_EAP_port_descriptor_Server,v_EAP_port_descriptor_Client; + f_initEAPPortDescriptor(v_EAP_port_descriptor_Server); + f_initEAPPortDescriptor(v_EAP_port_descriptor_Client); + f_set_Ki(1,tsp_SIM_Ki,v_EAP_port_descriptor_Server); + f_set_Ki(1,tsp_SIM_Ki,v_EAP_port_descriptor_Client); + + connect(client: RADIUS_PORT , mappingClient:UDP_RADIUS_PCO); + map(mappingClient:UDP_PCO, system: RADIUS_ClientPort); + + connect(server: RADIUS_PORT , mappingServer:UDP_RADIUS_PCO); + map(mappingServer:UDP_PCO, system: RADIUS_ServerPort); + + mappingServer.start(f_RADIUS_EncDec_Start(server,v_EAP_port_descriptor_Server)) + server.start(f_EAP_SIM_reauth_server()); + mappingClient.start(f_RADIUS_EncDec_Start(client,v_EAP_port_descriptor_Client)) + client.start(f_EAP_SIM_reauth_client()); + + timer t1 := 15.0; + t1.start; + + alt { + [] server.done { + alt { + [] client.done { + setverdict (pass); + } + [] t1.timeout { + setverdict (fail); + } + } + } + [] t1.timeout { + setverdict(fail); + } + } + unmap(mappingClient:UDP_PCO, system: RADIUS_ClientPort); + unmap(mappingServer:UDP_PCO, system: RADIUS_ServerPort); + +} + +control +{ + execute(tc_RADIUS_EAP_SIM_full_authentication()); + execute(tc_RADIUS_EAP_SIM_reauthentication()); + execute(tc_RADIUS_EAP_AKA_full_authentication()); +} + +} diff --git a/demo/Radius_Test_new.ttcn b/demo/Radius_Test_new.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..33c0cd8ccf32a1e2e8237c8b6e9ed6492141fe6b --- /dev/null +++ b/demo/Radius_Test_new.ttcn @@ -0,0 +1,606 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ +// +// File: Radius_Test_new.ttcn +// Rev: R12A +// Prodnr: CNL 113 600 +// Remark: This file is not a part of the product. +// +// +// + + +module Radius_Test_new { + +import from RADIUS_Mapping_new all; +import from UDPasp_PortType all; +import from UDPasp_Types all; +import from RADIUS_Types all; + +modulepar charstring tsp_addressf := "159.107.193.33"; +modulepar integer tsp_portf := 1100; + + +type component RADIUS_MTC +{ + +} + +type component RADIUSComponent_CT +{ + port UDPasp_RADIUS_PT RADIUS_PORT ; +} + + +type component SystemComponent +{ + port UDPasp_PT RADIUS_Port; +} + + + + +// receive Access Req, send Access Accept + testcase tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_correct_auth() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccessRequest_sendAccessAccept_with_correct_auth()) + + v_server.done + + v_mapping.kill + +} + + + +function f_receiveAccessRequest_sendAccessAccept_with_correct_auth() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Accept , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { } + }, + addressf := tsp_addressf, + portf := tsp_portf } + + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1 + timer t1 := 5.0; + t1.start; + alt { + [] RADIUS_PORT.receive (ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Access_Request) { + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + setverdict(pass)}} + [] t1.timeout {setverdict (fail)} + } + + +} + + +// receive Access Req, send Access Accept with incorrect Auth Resp + testcase tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_incorrect_auth() runs on RADIUSComponent_CT system SystemComponent + { + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccessRequest_sendAccessAccept_with_incorrect_auth()) + + v_server.done + + v_mapping.kill + +} + + +function f_receiveAccessRequest_sendAccessAccept_with_incorrect_auth() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Accept , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000001'O, + attributes := { } + }, + addressf := tsp_addressf, + portf := tsp_portf } + + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1 + timer t1 := 5.0; + t1.start; + alt { + [] RADIUS_PORT.receive (ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Access_Request) { + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + setverdict(pass)}} + [] t1.timeout {setverdict (fail)} + } + +} + + + testcase tc_RADIUS_client_sendAccessRequest() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_client := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_client: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(client)) + + v_client.start(f_sendAccessRequest()) + + v_client.done + + v_mapping.kill + + } + +function f_sendAccessRequest() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Request , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { } + }, + addressf := tsp_addressf, + portf := tsp_portf } + + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + timer t1 := 5.0; + t1.start; + alt { + [] RADIUS_PORT.receive {setverdict(pass)} + [] t1.timeout {setverdict (fail)} + } + + +} + +//////////////////////////////////////////////////////// +//send Access Req, receive Access Accept + testcase tc_RADIUS_client_sendAccessRequest_receiveAccessAccept() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_client := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_client: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(client)) + + v_client.start(f_sendAccessRequest_receiveAccessAccept()) + + v_client.done + + v_mapping.kill + + } + +function f_sendAccessRequest_receiveAccessAccept() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Request , + identifier := 1, + message_length := 56, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { genericAttrib:={ + attrib_type := Base_User_Name, + attrib_length := 6, + attrib_data := {base_user_name:=char2oct("nemo")} } }, + { genericAttrib:={ + attrib_type := Base_User_Password, + attrib_length := 18, + attrib_data := {base_user_password:=char2oct("nemo21") }}}, + { genericAttrib:={ + attrib_type := Base_NAS_IP_Address, + attrib_length := 6, + attrib_data := {base_nas_ip_address:='C0A80110'O } } }, + { genericAttrib:={ + attrib_type := Base_NAS_Port, + attrib_length := 6, + attrib_data := {base_nas_port:=3} }} + + } + }, + addressf := tsp_addressf, + portf := tsp_portf } + + template ASP_UDP_RADIUS v_ASP_UDP_RADIUS2:= + { data := { code := Access_Accept , + identifier := 1, + message_length := ?, + authenticator := ?, + attributes := ? + }, + addressf := ?, + portf := ? } + + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + timer t1 := 5.0; + t1.start; + alt { + [] RADIUS_PORT.receive(v_ASP_UDP_RADIUS2) {setverdict(pass)} + [] t1.timeout {setverdict (fail)} + } + +} + +//send Access Accept?! + testcase tc_RADIUS_client_sendAccessAccept() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_client := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_client: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(client)) + + v_client.start(f_sendAccessAccept()) + + v_client.done + + v_mapping.kill + + } + +function f_sendAccessAccept() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Accept , + identifier := 1, + message_length := 56, + authenticator := '00000000000000000000000000000000'O, + attributes := {} + }, + addressf := tsp_addressf, + portf := tsp_portf } + + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + +} + + +//send Accounting Req, receive Accounting Response + testcase tc_RADIUS_client_sendAccountingRequest_receiveAccountingResponse() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_client := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_client: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(client)) + + v_client.start(f_sendAccountingRequest_receiveAccountingResponse()) + + v_client.done + + v_mapping.kill + + } + +function f_sendAccountingRequest_receiveAccountingResponse() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Accounting_Request , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { genericAttrib:={ + attrib_type := Acc_Acct_Status_Type, + attrib_length := 0, + attrib_data:={acc_acct_status_type := Stop }}} , + { genericAttrib:={ + attrib_type := Acc_Acct_Input_Packets, + attrib_length := 0, + attrib_data:={acc_acct_input_packets := 5 }}} + }}, + addressf := tsp_addressf, + portf := tsp_portf } + +template ASP_UDP_RADIUS v_ASP_UDP_RADIUS2:= + { data := { code := Accounting_Response , + identifier := 1, + message_length := ?, + authenticator := ?, + attributes := ? + }, + addressf := ?, + portf := ? } + + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + timer t1 := 10.0; + t1.start; + alt { + [] RADIUS_PORT.receive(v_ASP_UDP_RADIUS2) {setverdict(pass)} + [] t1.timeout {setverdict (fail)} + } + + + +} + + +// receive Access Req, send Access Accept + testcase tc_RADIUS_server_receiveAccessRequest_sendAccessAccept() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccessRequest_sendAccessAccept()) + + v_server.done + + v_mapping.kill + +} + +function f_receiveAccessRequest_sendAccessAccept() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Accept , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { genericAttrib:={ + attrib_type := Base_Service_Type, + attrib_length := 6, + attrib_data:={base_service_type := Framed }} }, + { genericAttrib:={ + attrib_type := Base_Framed_Protocol, + attrib_length := 6, + attrib_data:={base_framed_protocol := PPP} }}, + { genericAttrib:={ + attrib_type := Base_Framed_IP_Address, + attrib_length := 6, + attrib_data:={base_framed_ip_address := 'FFFFFFFE'O } }}, + {genericAttrib:={ + attrib_type := Base_Framed_Routing, + attrib_length := 6, + attrib_data:={base_framed_routing := None } }}, + { genericAttrib:={ + attrib_type := Base_Framed_Compression, + attrib_length := 6, + attrib_data:={base_framed_compression := VJ_TCP_IP_header_compression }} }, + { genericAttrib:={ + attrib_type := Base_Framed_MTU, + attrib_length := 6, + attrib_data:={base_framed_mtu := 1500 } }} + }}, + addressf := tsp_addressf, + portf := tsp_portf } + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1 + + timer t1 := 10.0; + t1.start; + alt { + [] RADIUS_PORT.receive(ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Access_Request) { + v_ASP_UDP_RADIUS.data.identifier := v_ASP_UDP_RADIUS1.data.identifier; + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + setverdict(pass)} + else {setverdict(fail); repeat;}} + [] t1.timeout {setverdict (fail)} + } + + +} + + +// receive Access Req, send Access Challenge + testcase tc_RADIUS_server_receiveAccessRequest_sendAccessChallenge() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccessRequest_sendAccessChallenge()) + + v_server.done + + v_mapping.kill + +} + +function f_receiveAccessRequest_sendAccessChallenge() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Challenge , + identifier := 1, + message_length := 78, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { genericAttrib:={ + attrib_type := Base_Reply_Message, + attrib_length := 48, + attrib_data:={base_reply_message := "Challenge 32769430. Enter response at prompt." }}}, + {genericAttrib:={ + attrib_type := Base_State, + attrib_length := 10, + attrib_data:={base_state := '3332373639343330'O } }} + }}, + addressf := tsp_addressf, + portf := tsp_portf } + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1 + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS2 + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS3:= + { data := { code := Access_Reject , + identifier := 1, + message_length := 20, + authenticator := '00000000000000000000000000000000'O, + attributes := {}}, + addressf := tsp_addressf, + portf := tsp_portf } + timer t1 := 10.0; + t1.start; + alt { + [] RADIUS_PORT.receive(ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Access_Request){ + v_ASP_UDP_RADIUS.data.identifier := v_ASP_UDP_RADIUS1.data.identifier; + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + RADIUS_PORT.receive(ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS2 + if (v_ASP_UDP_RADIUS2.data.code==Access_Request){ + v_ASP_UDP_RADIUS3.data.identifier := v_ASP_UDP_RADIUS2.data.identifier; + RADIUS_PORT.send(v_ASP_UDP_RADIUS3); + setverdict(pass)} + else {setverdict (fail)}} + else {setverdict (fail)} + } + [] t1.timeout {setverdict (fail)} + } + + +} + + + + +// receive Accounting Req, send Accounting Response + testcase tc_RADIUS_server_receiveAccountingRequest_sendAccountingResponse() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccountingRequest_sendAccountingResponse()) + + v_server.done + + v_mapping.kill + +} + +function f_receiveAccountingRequest_sendAccountingResponse() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Accounting_Response , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { genericAttrib:={ + attrib_type := Base_Proxy_State, + attrib_length := 10, + attrib_data:={base_proxy_state := '3332373639343330'O }}} + }}, + addressf := tsp_addressf, + portf := tsp_portf } + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1; + timer t1 := 10.0; + t1.start; + alt { + [] RADIUS_PORT.receive(ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Accounting_Request){ + v_ASP_UDP_RADIUS.data.identifier := v_ASP_UDP_RADIUS1.data.identifier; + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + setverdict (pass)} + else {setverdict (fail); repeat;}} + [] t1.timeout {setverdict (fail)} + } + +} + + testcase tc_RADIUS_encdec() runs on RADIUSComponent_CT +{ + var PDU_RADIUS v_PDU_RADIUS:= + { code := Accounting_Response , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { genericAttrib:={ + attrib_type := Base_Vendor_Specific, + attrib_length := 0, + attrib_data:= + {base_vendor_specific :={ + vendor_id:=scap, + attrib_value:= {f_scap_subattr_list:={{ + scap_type:=suggested_secondary_rulespace, + scap_length:=0, + scap_val:={charstring_val:="Na"}}}} + }}}}, + { genericAttrib:={ + attrib_type := IPv6_Framed_IPv6_Prefix, + attrib_length := 0, + attrib_data:= + {ipv6_framed_ipv6_prefix :={ + reserved:='00'O, + prefix_length:=0, + prefixValue:= '00100000000000000011111111111110000000000000000100000000000001'B,//oct2bit('20003ffe00010001'O), + prefixPadding := '00'B + }}}} + + }}; + log(v_PDU_RADIUS); + var octetstring v_oct1:=f_RADIUS_Enc(v_PDU_RADIUS); + log(v_oct1); + v_PDU_RADIUS:=f_RADIUS_Dec(v_oct1); + log(v_PDU_RADIUS); + var octetstring v_oct2:=f_RADIUS_Enc(v_PDU_RADIUS); + if (v_oct1 == v_oct2){setverdict (pass)} + else {setverdict (fail)} + + +} + + +} diff --git a/demo/Radius_Test_orig.ttcn b/demo/Radius_Test_orig.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..2eae197f46153c024f67850b64543749da467c9b --- /dev/null +++ b/demo/Radius_Test_orig.ttcn @@ -0,0 +1,604 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ +// +// File: Radius_Test_orig.ttcn +// Rev: R12A +// Prodnr: CNL 113 600 +// Remark: This file is not a part of the product. +// +// +// + + +module Radius_Test_orig { + +import from RADIUS_Mapping_orig all; +import from UDPasp_PortType all; +import from UDPasp_Types all; +import from RADIUS_Types all; + +modulepar charstring tsp_addressf := "159.107.193.33"; +modulepar integer tsp_portf := 1100; + + +type component RADIUS_MTC +{ + +} + +type component RADIUSComponent_CT +{ + port UDPasp_RADIUS_PT RADIUS_PORT ; +} + + +type component SystemComponent +{ + port UDPasp_PT RADIUS_Port; +} + + + + +// receive Access Req, send Access Accept + testcase tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_correct_auth() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccessRequest_sendAccessAccept_with_correct_auth()) + + v_server.done + + v_mapping.kill + +} + + + +function f_receiveAccessRequest_sendAccessAccept_with_correct_auth() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Accept , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { } + }, + addressf := tsp_addressf, + portf := tsp_portf } + + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1 + timer t1 := 5.0; + t1.start; + alt { + [] RADIUS_PORT.receive (ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Access_Request) { + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + setverdict(pass)}} + [] t1.timeout {setverdict (fail)} + } + + +} + + +// receive Access Req, send Access Accept with incorrect Auth Resp + testcase tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_incorrect_auth() runs on RADIUSComponent_CT system SystemComponent + { + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccessRequest_sendAccessAccept_with_incorrect_auth()) + + v_server.done + + v_mapping.kill + +} + + +function f_receiveAccessRequest_sendAccessAccept_with_incorrect_auth() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Accept , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000001'O, + attributes := { } + }, + addressf := tsp_addressf, + portf := tsp_portf } + + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1 + timer t1 := 5.0; + t1.start; + alt { + [] RADIUS_PORT.receive (ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Access_Request) { + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + setverdict(pass)}} + [] t1.timeout {setverdict (fail)} + } + +} + + + testcase tc_RADIUS_client_sendAccessRequest() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_client := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_client: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(client)) + + v_client.start(f_sendAccessRequest()) + + v_client.done + + v_mapping.kill + + } + +function f_sendAccessRequest() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Request , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { } + }, + addressf := tsp_addressf, + portf := tsp_portf } + + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + timer t1 := 5.0; + t1.start; + alt { + [] RADIUS_PORT.receive {setverdict(pass)} + [] t1.timeout {setverdict (fail)} + } + + +} + +//////////////////////////////////////////////////////// +//send Access Req, receive Access Accept + testcase tc_RADIUS_client_sendAccessRequest_receiveAccessAccept() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_client := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_client: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(client)) + + v_client.start(f_sendAccessRequest_receiveAccessAccept()) + + v_client.done + + v_mapping.kill + + } + +function f_sendAccessRequest_receiveAccessAccept() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Request , + identifier := 1, + message_length := 56, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { attrib_Base_User_Name := { + attrib_type := Base_User_Name, + attrib_length := 6, + base_user_name := char2oct("nemo") } }, + { attrib_Base_User_Password := { + attrib_type := Base_User_Password, + attrib_length := 18, + base_user_password := char2oct("nemo21")} }, + { attrib_Base_NAS_IP_Address := { + attrib_type := Base_NAS_IP_Address, + attrib_length := 6, + base_nas_ip_address := 'C0A80110'O } }, + { attrib_Base_NAS_Port := { + attrib_type := Base_NAS_Port, + attrib_length := 6, + base_nas_port := 3 } } + + } + }, + addressf := tsp_addressf, + portf := tsp_portf } + + template ASP_UDP_RADIUS v_ASP_UDP_RADIUS2:= + { data := { code := Access_Accept , + identifier := 1, + message_length := ?, + authenticator := ?, + attributes := ? + }, + addressf := ?, + portf := ? } + + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + timer t1 := 5.0; + t1.start; + alt { + [] RADIUS_PORT.receive(v_ASP_UDP_RADIUS2) {setverdict(pass)} + [] t1.timeout {setverdict (fail)} + } + +} + +//send Access Accept?! + testcase tc_RADIUS_client_sendAccessAccept() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_client := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_client: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(client)) + + v_client.start(f_sendAccessAccept()) + + v_client.done + + v_mapping.kill + + } + +function f_sendAccessAccept() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Accept , + identifier := 1, + message_length := 56, + authenticator := '00000000000000000000000000000000'O, + attributes := {} + }, + addressf := tsp_addressf, + portf := tsp_portf } + + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + +} + + +//send Accounting Req, receive Accounting Response + testcase tc_RADIUS_client_sendAccountingRequest_receiveAccountingResponse() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_client := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_client: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(client)) + + v_client.start(f_sendAccountingRequest_receiveAccountingResponse()) + + v_client.done + + v_mapping.kill + + } + +function f_sendAccountingRequest_receiveAccountingResponse() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Accounting_Request , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { attrib_Acc_Acct_Status_Type := { + attrib_type := Acc_Acct_Status_Type, + attrib_length := 0, + acc_acct_status_type := Stop } }, + { attrib_Acc_Acct_Input_Packets := { + attrib_type := Acc_Acct_Input_Packets, + attrib_length := 0, + acc_acct_input_packets := 5 } } + }}, + addressf := tsp_addressf, + portf := tsp_portf } + +template ASP_UDP_RADIUS v_ASP_UDP_RADIUS2:= + { data := { code := Accounting_Response , + identifier := 1, + message_length := ?, + authenticator := ?, + attributes := ? + }, + addressf := ?, + portf := ? } + + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + timer t1 := 10.0; + t1.start; + alt { + [] RADIUS_PORT.receive(v_ASP_UDP_RADIUS2) {setverdict(pass)} + [] t1.timeout {setverdict (fail)} + } + + + +} + + +// receive Access Req, send Access Accept + testcase tc_RADIUS_server_receiveAccessRequest_sendAccessAccept() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccessRequest_sendAccessAccept()) + + v_server.done + + v_mapping.kill + +} + +function f_receiveAccessRequest_sendAccessAccept() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Accept , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { attrib_Base_Service_Type := { + attrib_type := Base_Service_Type, + attrib_length := 6, + base_service_type := Framed } }, + { attrib_Base_Framed_Protocol := { + attrib_type := Base_Framed_Protocol, + attrib_length := 6, + base_framed_protocol := PPP} }, + { attrib_Base_Framed_IP_Address := { + attrib_type := Base_Framed_IP_Address, + attrib_length := 6, + base_framed_ip_address := 'FFFFFFFE'O } }, + { attrib_Base_Framed_Routing := { + attrib_type := Base_Framed_Routing, + attrib_length := 6, + base_framed_routing := None } }, + { attrib_Base_Framed_Compression := { + attrib_type := Base_Framed_Compression, + attrib_length := 6, + base_framed_compression := VJ_TCP_IP_header_compression } }, + { attrib_Base_Framed_MTU := { + attrib_type := Base_Framed_MTU, + attrib_length := 6, + base_framed_mtu := 1500 } } + }}, + addressf := tsp_addressf, + portf := tsp_portf } + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1 + + timer t1 := 10.0; + t1.start; + alt { + [] RADIUS_PORT.receive(ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Access_Request) { + v_ASP_UDP_RADIUS.data.identifier := v_ASP_UDP_RADIUS1.data.identifier; + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + setverdict(pass)} + else {setverdict(fail); repeat;}} + [] t1.timeout {setverdict (fail)} + } + + +} + + +// receive Access Req, send Access Challenge + testcase tc_RADIUS_server_receiveAccessRequest_sendAccessChallenge() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccessRequest_sendAccessChallenge()) + + v_server.done + + v_mapping.kill + +} + +function f_receiveAccessRequest_sendAccessChallenge() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Access_Challenge , + identifier := 1, + message_length := 78, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { attrib_Base_Reply_Message := { + attrib_type := Base_Reply_Message, + attrib_length := 48, + base_reply_message := "Challenge 32769430. Enter response at prompt." } }, + { attrib_Base_State := { + attrib_type := Base_State, + attrib_length := 10, + base_state := '3332373639343330'O } } + }}, + addressf := tsp_addressf, + portf := tsp_portf } + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1 + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS2 + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS3:= + { data := { code := Access_Reject , + identifier := 1, + message_length := 20, + authenticator := '00000000000000000000000000000000'O, + attributes := {}}, + addressf := tsp_addressf, + portf := tsp_portf } + timer t1 := 10.0; + t1.start; + alt { + [] RADIUS_PORT.receive(ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Access_Request){ + v_ASP_UDP_RADIUS.data.identifier := v_ASP_UDP_RADIUS1.data.identifier; + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + RADIUS_PORT.receive(ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS2 + if (v_ASP_UDP_RADIUS2.data.code==Access_Request){ + v_ASP_UDP_RADIUS3.data.identifier := v_ASP_UDP_RADIUS2.data.identifier; + RADIUS_PORT.send(v_ASP_UDP_RADIUS3); + setverdict(pass)} + else {setverdict (fail)}} + else {setverdict (fail)} + } + [] t1.timeout {setverdict (fail)} + } + + +} + + + + +// receive Accounting Req, send Accounting Response + testcase tc_RADIUS_server_receiveAccountingRequest_sendAccountingResponse() runs on RADIUSComponent_CT system SystemComponent +{ + var RADIUSComponent_CT v_server := RADIUSComponent_CT.create; + var RADIUS_mapping_CT v_mapping := RADIUS_mapping_CT.create; + + connect(v_server: RADIUS_PORT , v_mapping:UDP_RADIUS_PCO); + map(v_mapping:UDP_PCO, system: RADIUS_Port) + + v_mapping.start(f_RADIUS_EncDec_Start(server)) + + v_server.start(f_receiveAccountingRequest_sendAccountingResponse()) + + v_server.done + + v_mapping.kill + +} + +function f_receiveAccountingRequest_sendAccountingResponse() runs on RADIUSComponent_CT +{ + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS:= + + { data := { code := Accounting_Response , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { attrib_Base_Proxy_State := { + attrib_type := Base_Proxy_State, + attrib_length := 10, + base_proxy_state := '3332373639343330'O }} + }}, + addressf := tsp_addressf, + portf := tsp_portf } + var ASP_UDP_RADIUS v_ASP_UDP_RADIUS1; + timer t1 := 10.0; + t1.start; + alt { + [] RADIUS_PORT.receive(ASP_UDP_RADIUS:?) -> value v_ASP_UDP_RADIUS1{ + if (v_ASP_UDP_RADIUS1.data.code==Accounting_Request){ + v_ASP_UDP_RADIUS.data.identifier := v_ASP_UDP_RADIUS1.data.identifier; + RADIUS_PORT.send(v_ASP_UDP_RADIUS); + setverdict (pass)} + else {setverdict (fail); repeat;}} + [] t1.timeout {setverdict (fail)} + } + +} + + testcase tc_RADIUS_encdec() runs on RADIUSComponent_CT +{ + var PDU_RADIUS v_PDU_RADIUS:= + { code := Accounting_Response , + identifier := 1, + message_length := 0, + authenticator := '00000000000000000000000000000000'O, + attributes := { + { attrib_Base_Vendor_Specific:={ + attrib_type := Base_Vendor_Specific, + attrib_length := 0, + base_vendor_specific :={ + vendor_id:=scap, + attrib_value:= {f_scap_subattr_list:={{ + scap_type:=suggested_secondary_rulespace, + scap_length:=0, + scap_val:={charstring_val:="Na"}}}} + }}}, + { attrib_IPv6_Framed_IPv6_Prefix:={ + attrib_type := IPv6_Framed_IPv6_Prefix, + attrib_length := 0, + ipv6_framed_ipv6_prefix :={ + reserved:='00'O, + prefix_length:=0, + prefixValue:= '00100000000000000011111111111110000000000000000100000000000001'B,//oct2bit('20003ffe00010001'O), + prefixPadding := '00'B + }}} + + }}; + log(v_PDU_RADIUS); + var octetstring v_oct1:=f_RADIUS_Enc(v_PDU_RADIUS); + log(v_oct1); + v_PDU_RADIUS:=f_RADIUS_Dec(v_oct1); + log(v_PDU_RADIUS); + var octetstring v_oct2:=f_RADIUS_Enc(v_PDU_RADIUS); + if (v_oct1 == v_oct2){setverdict (pass)} + else {setverdict (fail)} + + +} + + +} diff --git a/demo/gui_make_RPMG_new.sh b/demo/gui_make_RPMG_new.sh new file mode 100644 index 0000000000000000000000000000000000000000..df8cb34a7873e8bb1b0cbb3eac7af92944cbb7cc --- /dev/null +++ b/demo/gui_make_RPMG_new.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +sed -e ' +s/OPENSSL_DIR = $(TTCN3_DIR)/\OPENSSL_DIR = \/mnt\/TTCN\/Tools\/openssl-0.9.8e/g +s/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -I$(OPENSSL_DIR)\/include -I$(TTCN3_DIR)\/include/g + +' \ +-e 's/^TTCN3_MODULES =/TTCN3_MODULES = RADIUS_Types.ttcn/g +s/^GENERATED_SOURCES =/GENERATED_SOURCES = RADIUS_Types.cc/g +s/^GENERATED_HEADERS =/GENERATED_HEADERS = RADIUS_Types.hh/g +s/^OBJECTS =/OBJECTS = RADIUS_Types.o/g +/# Add your rules here if necessary./ { +a\ +# +a\ + +a\ +AWK=/usr/local/bin/gawk +a\ + +a\ +RADIUS_Types.ttcn: BaseTypes_IETF_RFC2865.rdf Base_IETF_RFC2865.rdf Accounting_IETF_RFC2866_RFC2867.rdf IPv6_IETF_RFC3162.rdf Extensions_IETF_RFC2869.rdf TunnelAuthentication_IETF_RFC2868.rdf ATTR.awk +a\ + $(AWK) -f ATTR.awk BaseTypes_IETF_RFC2865.rdf Base_IETF_RFC2865.rdf Accounting_IETF_RFC2866_RFC2867.rdf IPv6_IETF_RFC3162.rdf Extensions_IETF_RFC2869.rdf TunnelAuthentication_IETF_RFC2868.rdf > $@ +a\ + +a\ +# +a\ +# End of additional rules for RPMG +} +' \ +<$1 >$2 diff --git a/demo/gui_make_RPMG_orig.sh b/demo/gui_make_RPMG_orig.sh new file mode 100644 index 0000000000000000000000000000000000000000..092ccbc778025bc01991c0904f9cb2dd28c09960 --- /dev/null +++ b/demo/gui_make_RPMG_orig.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +sed -e ' +s/OPENSSL_DIR = $(TTCN3_DIR)/\OPENSSL_DIR = \/mnt\/TTCN\/Tools\/openssl-0.9.8e/g +s/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -I$(OPENSSL_DIR)\/include -I$(TTCN3_DIR)\/include/g + +' \ +-e 's/^TTCN3_MODULES =/TTCN3_MODULES = RADIUS_Types.ttcn/g +s/^GENERATED_SOURCES =/GENERATED_SOURCES = RADIUS_Types.cc/g +s/^GENERATED_HEADERS =/GENERATED_HEADERS = RADIUS_Types.hh/g +s/^OBJECTS =/OBJECTS = RADIUS_Types.o/g +/# Add your rules here if necessary./ { +a\ +# +a\ + +a\ +AWK=/usr/local/bin/gawk +a\ + +a\ +RADIUS_Types.ttcn: BaseTypes_IETF_RFC2865.rdf Base_IETF_RFC2865.rdf Accounting_IETF_RFC2866_RFC2867.rdf IPv6_IETF_RFC3162.rdf Extensions_IETF_RFC2869.rdf TunnelAuthentication_IETF_RFC2868.rdf ATTR.awk +a\ + $(AWK) -f ATTR.awk -v old_structured_code=1 BaseTypes_IETF_RFC2865.rdf Base_IETF_RFC2865.rdf Accounting_IETF_RFC2866_RFC2867.rdf IPv6_IETF_RFC3162.rdf Extensions_IETF_RFC2869.rdf TunnelAuthentication_IETF_RFC2868.rdf > $@ +a\ + +a\ +# +a\ +# End of additional rules for RPMG +} +' \ +<$1 >$2 diff --git a/demo/gui_make_RPMGandEAP.sh b/demo/gui_make_RPMGandEAP.sh new file mode 100644 index 0000000000000000000000000000000000000000..6db8381620ff402a5c1218dd3b649e97930b34b3 --- /dev/null +++ b/demo/gui_make_RPMGandEAP.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +sed -e ' +s/OPENSSL_DIR = $(TTCN3_DIR)/\OPENSSL_DIR = \/mnt\/TTCN\/Tools\/openssl-0.9.8e/g +s/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -I$(OPENSSL_DIR)\/include -I$(TTCN3_DIR)\/include/g + +' \ +-e 's/^TTCN3_MODULES =/TTCN3_MODULES = RADIUS_Types.ttcn/g +s/^GENERATED_SOURCES =/GENERATED_SOURCES = RADIUS_Types.cc/g +s/^GENERATED_HEADERS =/GENERATED_HEADERS = RADIUS_Types.hh/g +s/^OBJECTS =/OBJECTS = RADIUS_Types.o/g +/# Add your rules here if necessary./ { +a\ +# +a\ + +a\ +AWK=/usr/local/bin/gawk +a\ + +a\ +RADIUS_Types.ttcn: BaseTypes_IETF_RFC2865.rdf Base_IETF_RFC2865.rdf Accounting_IETF_RFC2866_RFC2867.rdf IPv6_IETF_RFC3162.rdf Extensions_IETF_RFC2869.rdf TunnelAuthentication_IETF_RFC2868.rdf DynamicAuthorizationExtensions_IETF_RFC5176.rdf ATTR.awk +a\ + $(AWK) -f ATTR.awk BaseTypes_IETF_RFC2865.rdf Base_IETF_RFC2865.rdf Accounting_IETF_RFC2866_RFC2867.rdf IPv6_IETF_RFC3162.rdf Extensions_IETF_RFC2869.rdf TunnelAuthentication_IETF_RFC2868.rdf DynamicAuthorizationExtensions_IETF_RFC5176.rdf > $@ +a\ + +a\ +# +a\ +# End of additional rules for RPMG +} +' \ +<$1 >$2 + diff --git a/demo/radius.cfg b/demo/radius.cfg new file mode 100644 index 0000000000000000000000000000000000000000..ba8c55d27e7644a21dd6311c2f8011e616b6f674 --- /dev/null +++ b/demo/radius.cfg @@ -0,0 +1,28 @@ +[MODULE_PARAMETERS] +tsp_addressf := "159.107.193.33" +tsp_portf := 1100 + + +[TESTPORT_PARAMETERS] +system.RADIUS_Port.localPort := "50000" +#system.RADIUS_Port.localPort := "10002" + + +[LOGGING] +/*LogFile := "UDPtest.log" */ +FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING +ConsoleMask := TTCN_ERROR | TTCN_WARNING | TTCN_TESTCASE | TTCN_STATISTICS | TTCN_PORTEVENT +LogSourceInfo := Yes + + +[EXECUTE] +#Radius_Test.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_correct_auth +#Radius_Test.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept_with_incorrect_auth +#Radius_Test.tc_RADIUS_client_sendAccessRequest + +#Radius_Test.tc_RADIUS_client_sendAccessRequest_receiveAccessAccept +#Radius_Test.tc_RADIUS_client_sendAccessAccept +#Radius_Test.tc_RADIUS_client_sendAccountingRequest_receiveAccountingResponse +Radius_Test.tc_RADIUS_server_receiveAccessRequest_sendAccessAccept +#Radius_Test.tc_RADIUS_server_receiveAccessRequest_sendAccessChallenge +#Radius_Test.tc_RADIUS_server_receiveAccountingRequest_sendAccountingResponse diff --git a/doc/RADIUS_ProtocolModule_Generator_CNL113600_1551.doc b/doc/RADIUS_ProtocolModule_Generator_CNL113600_1551.doc new file mode 100644 index 0000000000000000000000000000000000000000..a6984a5da04f6a9eda6b09770a81225f31f5c568 Binary files /dev/null and b/doc/RADIUS_ProtocolModule_Generator_CNL113600_1551.doc differ diff --git a/doc/RADIUS_ProtocolModule_Generator_CNL113600_PRI.doc b/doc/RADIUS_ProtocolModule_Generator_CNL113600_PRI.doc new file mode 100644 index 0000000000000000000000000000000000000000..a42e543928495b46652d2d21343c4860a539d652 Binary files /dev/null and b/doc/RADIUS_ProtocolModule_Generator_CNL113600_PRI.doc differ diff --git a/src/ATTR.awk b/src/ATTR.awk new file mode 100644 index 0000000000000000000000000000000000000000..97756c7068a087bce308f5baa200f9971bb07e81 --- /dev/null +++ b/src/ATTR.awk @@ -0,0 +1,388 @@ +#/****************************************************************************** +#* Copyright (c) 2008, 2015 Ericsson AB +#* All rights reserved. This program and the accompanying materials +#* are made available under the terms of the Eclipse Public License v1.0 +#* which accompanies this distribution, and is available at +#* http://www.eclipse.org/legal/epl-v10.html +#* +#* Contributors: +#* Timea Moder +#* Endre Kulcsar +#* Gabor Szalai +#* Janos Kovesdi +#* Kulcsár Endre +#* Zoltan Medve +#* Tamas Korosi +#******************************************************************************/ + +# # +# File: ATTR.awk # +# Description: RPMG AWK script for weaving RDF files # +# Rev: R12A +# Prodnr: CNL 113 600 # +############################################################################# + + + +BEGIN { + FS = "[ \t\n;]+" + HT = " " + + + # Number of attribute descriptors found in input RDF file + attrib_descriptors = 0 + packet_descriptors = 0 + # Number of attribute type definitions matching preceeding attribute descriptor + matching_attrib_types = 0 + matching_packet_types = 0 + # Identifier of generated TTCN-3 module + if(!module_id) module_id = "RADIUS_Types" + # Use APPLICATION-REVISION prefix in Attrib type identifiers when true + if(!use_application_revision) use_application_revision = 0 + # Replace all enumeration type Attribs with type Unsigned32 when true + if(!enum_2_UnsignedInt) enum_2_UnsignedInt = 0 + # Generate original structured TTCN-3 code when true + if(!old_structured_code) old_structured_code = 0 + + print "module " module_id " {" +} + +{ + # Remove excess WS from beginning and end of EACH record + sub(/^[ \t]+/, "") + sub(/[ \t]+$/, "") +} + +/\/\/ APPLICATION-NAME:/ { + # Will be used to prefix generated Attribute type definitions + application_id = $3 +} + +/\/\/ APPLICATION-REVISION:/ { + # Could be used as additional prefix for generated ATTR type definitions + application_revision = $3 + if(use_application_revision && application_revision) { + application_id = application_id "_" application_revision + } +} + +/\/\/ Packet-Type:/ { + # Packet descriptor line e.g.: + # // Packet: Official-Packet-Type (Official-Packet-Code) + # <-------- $3 ------> <------ $4 --------> + i = 1 + while ((packet_code[i] != $4) && (i <= packet_descriptors)) { + i++ + } + if (i > packet_descriptors) { + new_packet_type = $3 + new_packet_code = $4 + gsub(/-/, "_", new_packet_type) + + packet_descriptors++ + ++matching_packet_types + packet_code[packet_descriptors] = new_packet_code + packet_type[matching_packet_types] = new_packet_type} +} + + +/\/\/ Attrib:/ { + # Attrib descriptor line e.g.: + # // Attrib: Official-Attrib-Name (Official-Attrib-Code) + # <-------- $3 ------> <------ $4 --------> + + attrib_descriptors++ + new_attrib_name = $3 + new_attrib_code = $4 + gsub(/-/, "_", new_attrib_name) + attrib_desc[new_attrib_name]=new_attrib_name +} + +/\<type/ { + # TTCN-3 type definition e.g.: + # <type> <kind> <identifier> MUST be in same line! + if (($3 == new_attrib_name) && (new_attrib_code in ATTR)) + { + print "// WARNING: Duplicated Attrib definition removed by gawk script!" + if($2 == "enumerated") { f_ReadTotalEnum() } + ++deleted_attrib_types + next + } + else if($3 == new_attrib_name) { + $3 = application_id "_" new_attrib_name + ++matching_attrib_types + ATTR[new_attrib_code] = new_attrib_name + attrib_code[matching_attrib_types] = new_attrib_code + attrib_type[matching_attrib_types] = application_id "_" new_attrib_name + if($2 == "enumerated") { + f_ReadTotalEnum() + if(enum_2_UnsignedInt) { + print "// WARNING: Enumeration type Attrib replaced by UnsignedInteger!" + print "type UINT32 " application_id "_" new_attrib_name ";" + } + else{ + prettyprinted_enum = total_enum + gsub(/\,/, ",\n", prettyprinted_enum) + sub(/\{/, "{\n", prettyprinted_enum) + sub(/\}/, "\n}", prettyprinted_enum) + f_AddVariant_U32(prettyprinted_enum) + } + } else if ($2 ~ /^enum_[0-9]+$/) { + split($2, a, "_") + f_ReadTotalEnum() + if(enum_2_UnsignedInt) { + print "// WARNING: Enumeration type Attrib replaced by UnsignedInteger!" + print "type UINT" a[2] " " application_id "_" new_attrib_name ";" + } + else{ + prettyprinted_enum = total_enum + gsub(/\,/, ",\n", prettyprinted_enum) + sub(/\{/, "{\n", prettyprinted_enum) + sub(/\}/, "\n}", prettyprinted_enum) + gsub(/enum_[0-9]*/, "enumerated ", prettyprinted_enum) + f_AddVariant_U(prettyprinted_enum, a[2]) + } + } + } else if (($2 != "enumerated") && ($2 ~ /^enum_[0-9]+$/)) { + split($2, a, "_") + f_ReadTotalEnum() + if(enum_2_UnsignedInt) { + print "// WARNING: Enumeration type Attrib replaced by UnsignedInteger!" + print "type UINT" a[2] " " application_id "_" new_attrib_name ";" + } + else{ + prettyprinted_enum = total_enum + gsub(/\,/, ",\n", prettyprinted_enum) + sub(/\{/, "{\n", prettyprinted_enum) + sub(/\}/, "\n}", prettyprinted_enum) + gsub(/enum_[0-9]*/, "enumerated ", prettyprinted_enum) + f_AddVariant_U(prettyprinted_enum, a[2]) + } + } +} + +/\/\/ Vendor:/ { + # Vendor descriptor line e.g.: + # // Vendor: vendor_name (vendor_id) + # <-- $3 --> <-- $4 --> + + vendor_name = $3 + gsub(/-/, "_", vendor_name) + vendor_list[vendor_name]=$4 +} + +{print} + +END { + print "// STATISTICS: " attrib_descriptors " Attrib descriptors found" + print "// STATISTICS: " matching_attrib_types \ + " Attrib type definitions matching Attrib descriptors found" + print "// STATISTICS: " deleted_attrib_types " duplicate Attrib definitions deleted" + if(attrib_descriptors != matching_attrib_types + deleted_attrib_types) { + print "// ERROR: attrib_descriptors " attrib_descriptors \ + " != matching_attrib_types " matching_attrib_types + ss=1 + for(t in attrib_type){ + print ss " " attrib_type[t] + ss++ + } + + ss=1 + print "\n" + for(t in attrib_desc){ + print ss " " attrib_desc[t] + ss++ + } + + exit(1) + } + + + + print "\n" + + print "type record Attrib_UNKNOWN" + print "{" + print HT "UINT8 attrib_type," + print HT "UINT8 attrib_length," + print HT "octetstring attrib_value" + print "} with {" + print HT " variant (attrib_length) \"LENGTHTO(attrib_type, attrib_length, attrib_value)\"" + print HT "}" + print "\n" + + print "type record vendor_specific_type" + print "{" + print HT "vendor_id_enum vendor_id," + print HT "string_val_spec attrib_value" + print "} with {" + print HT " variant (attrib_value) \"CROSSTAG(" + for(vendor in vendor_list){ + printf (HT HT "f_%s_subattr_list, vendor_id=%s;\n",vendor, vendor) + } + print HT ")\"" + print "}" + print "\n" + + print "type enumerated vendor_id_enum" + print "{" + i=1 + for(vendor in vendor_list){ + if(i==1){ + printf (HT "%s %s",vendor, vendor_list[vendor]) + i++ + } else { + printf (",\n" HT "%s %s",vendor, vendor_list[vendor]) + } + } + print "\n" "} with {" + print HT "variant \"FIELDLENGTH(32)\"" + print HT "variant \"BYTEORDER(last)\"" + print "}" + print "\n" + + print "type union string_val_spec" + print "{" + i=1 + for(vendor in vendor_list){ + if(i==1){ + printf (HT "%s_subattr_list f_%s_subattr_list",vendor, vendor) + i++ + } else { + printf (",\n" HT "%s_subattr_list f_%s_subattr_list",vendor, vendor) + } + } + print "\n}" + + if(old_structured_code){ + for(i = 1; i <= matching_attrib_types; i++) { + printf("type record Attrib_%s\n", attrib_type[i]) + print "{" + print HT "Attrib attrib_type," + print HT "UINT8 attrib_length," + printf(HT "%s %s\n", attrib_type[i], tolower(attrib_type[i])) + print "} with {" + printf(HT " variant \"PRESENCE (attrib_type=%s)\"\n",attrib_type[i]) + printf(HT " variant (attrib_length) \"LENGTHTO(attrib_type, attrib_length, %s)\"\n", + tolower(attrib_type[i])) + print HT "}" + print "\n" + } + + print "type set of GenericAttrib Attribs;\n" + + print "type union GenericAttrib" + print "{" + for(i = 1; i <= matching_attrib_types; i++) { + printf(HT "Attrib_%s attrib_%s,\n", + attrib_type[i],attrib_type[i]) + } + print HT "Attrib_UNKNOWN attrib_UNKNOWN" + print "}\n" + } + else{ + print "\n" + print "type union Attrib_Data" + print "{" + for(i = 1; i <= matching_attrib_types; i++) { + printf(HT "%s %s,\n", attrib_type[i], tolower(attrib_type[i])) + } + print HT "octetstring attrib_UNKNOWN" + print "}\n" + + print "type set of GenAttrib Attribs;\n" + print "type union GenAttrib" + print "{" + print HT "GenericAttrib genericAttrib," + print HT "Attrib_UNKNOWN attrib_UNKNOWN" + print "}\n" + print "type record GenericAttrib" + print "{" + print HT "Attrib attrib_type," + print HT "UINT8 attrib_length," + print HT "Attrib_Data attrib_data" + print "} with {" + print HT " variant (attrib_length) \"LENGTHTO(attrib_type, attrib_length, attrib_data)\"" + print HT " variant (attrib_data) \"CROSSTAG(" + for(i = 1; i <= matching_attrib_types; i++) { + printf(HT HT "%s,attrib_type=%s;\n", tolower(attrib_type[i]),attrib_type[i]) + } + print HT HT "attrib_UNKNOWN, OTHERWISE" + print HT ")\"" + print "}" + print "\n" + } + + print "type enumerated Attrib" + print HT "{" + for(i = 1; i <= matching_attrib_types; i++) { + printf(HT "%s %s%s\n", + attrib_type[i], attrib_code[i], + (i < matching_attrib_types) ? "," : "") + } + print "} with {" + print HT "variant \"FIELDLENGTH(8)\"" + print HT "variant \"BYTEORDER(last)\"" + print HT "}\n" + + + print "type enumerated Code" + print HT "{" + for(i = 1; i <= packet_descriptors; i++) { + printf(HT "%s %s%s\n", + packet_type[i], packet_code[i], + (i < packet_descriptors) ? "," : "") + } + print "} with {" + print HT "variant \"FIELDLENGTH(8)\"" + print HT "variant \"BYTEORDER(last)\"" + print HT "}\n" + + + print "type record PDU_RADIUS" + print "{" + print HT "Code code," + print HT "UINT8 identifier," + print HT "UINT16 message_length," + print HT "OCTET16 authenticator," + print HT "Attribs attributes" + print "} with {" + print HT " variant (message_length) \"LENGTHTO(code, identifier, message_length, authenticator, attributes)\"" + print HT"}\n" + + + print "} with { encode \"RAW\" } // End module" + + +} + +function f_AddVariant_U32(prefix) +{ + print prefix, "with {" + print HT "variant \"FIELDLENGTH(32)\"" + print HT "variant \"BYTEORDER(last)\"" + print "}" +} + +function f_AddVariant_U(prefix,flength) +{ + print prefix, "with {" + printf(HT "variant \"FIELDLENGTH(%s)\"\n",flength) + print HT "variant \"BYTEORDER(last)\"" + print "}" +} + +function f_ReadTotalEnum() +{ + total_enum = $0 + while(total_enum !~ /\}/) { + getline + sub(/\/\/.*/, "") + total_enum = total_enum $0 + } + # Replace $0 contents with data following } + idx = index(total_enum, "}") + $0 = substr(total_enum, idx+1) + total_enum = substr(total_enum, 1, idx) +} + diff --git a/src/ATTR.sh b/src/ATTR.sh new file mode 100644 index 0000000000000000000000000000000000000000..0e245eee156d8fb3c6bed835247ac9f969895598 --- /dev/null +++ b/src/ATTR.sh @@ -0,0 +1,107 @@ +#!/bin/sh +#set -x +#/****************************************************************************** +#* Copyright (c) 2008, 2015 Ericsson AB +#* All rights reserved. This program and the accompanying materials +#* are made available under the terms of the Eclipse Public License v1.0 +#* which accompanies this distribution, and is available at +#* http://www.eclipse.org/legal/epl-v10.html +#* +#* Contributors: +#* Timea Moder +#* Endre Kulcsar +#* Gabor Szalai +#* Janos Kovesdi +#* Kulcsár Endre +#* Zoltan Medve +#* Tamas Korosi +#******************************************************************************/ + + +# ATTR.sh [OPTION] ... RDF-FILEs +# {-v <variable-name>=<value>} {RDF-files} + +ATTRSCRIPT="ATTR.awk" +TTCN3FILE="RADIUS_Types" + +if [ $# -lt 1 ]; then + echo "ERROR: Too few arguments" + echo "Usage: $0 [-vNAME=VALUE] ... RDF-FILEs" + echo "Where: -v sets variable NAME to VALUE" + echo "" + echo "Supported variables:" + echo " module_id ................ Name of generated TTCN-3 module" + echo " use_application_revision . Use revision prefix in ATTR identifier" + echo " enum_2_UnsignedInt ....... Replace enumeration ATTRs with UnsignedInteger" + echo " old_structured_code....... Generate original structured TTCN-3 code" + exit 1 +fi + + # check gawk version + FIRSTLINE=`gawk --version|head -1` + PRODUCT=`echo ${FIRSTLINE} | gawk '{ print $1 $2 }'` + VERSION=`echo ${FIRSTLINE} | gawk '{ print $3 }'` + if [ ${PRODUCT} != "GNUAwk" ]; then + echo "ERROR: GNU Awk required" + exit 1 + fi + RESULT=`echo ${VERSION} | gawk '{ print ($0 < "3.1.6") }'` + if [ ${RESULT} != 0 ]; then + echo "ERROR: GNU Awk version >3.1.6 required (${VERSION} found)" + exit 1 + fi + +# Process arguments + +AWKARGS=$@ +while [ $# -ge 1 ]; do + case $1 in + -v) + shift; + case $1 in + module_id=*) + TTCN3FILE=`echo $1 | sed 's/module_id=//'` + if [ -f "RADIUS_EncDec.cc" ]; then + cmd="s/#include \"RADIUS_Types.hh\"/#include \"${TTCN3FILE}.hh\"/ + s/namespace RADIUS__Types/namespace ${TTCN3FILE}/ + s/RADIUS_EncDec/${TTCN3FILE}_RADIUS_EncDec/g" + cat "RADIUS_EncDec.cc" \ + | sed "${cmd}" > ${TTCN3FILE}"_RADIUS_EncDec.cc" + else + echo "ERROR: Missing RADIUS_EncDec.cc file" + exit 1 + fi + ;; + use_application_revision=*) + ;; + enum_2_UnsignedInt=*) + ;; + old_structured_code=*) + ;; + *) echo "ERROR: Unknown variable $1!"; exit 1;; + esac + ;; + *) + # end of options + if [ $# -lt 1 ]; then + echo "ERROR: No input RDF file" + exit 1 + fi + # check gawk existence + which gawk > /dev/null 2> /dev/null + if [ ! $? ]; then + echo "ERROR: GNU awk can not be found" + exit 1 + fi + # check input awk script + if [ -f ${ATTRSCRIPT} ]; then + gawk -f ${ATTRSCRIPT} ${AWKARGS} > ${TTCN3FILE}".ttcn" + else + echo "ERROR: ATTR.awk not found" + exit 1 + fi + break + ;; + esac + shift +done diff --git a/src/Accounting_IETF_RFC2866_RFC2867.rdf b/src/Accounting_IETF_RFC2866_RFC2867.rdf new file mode 100644 index 0000000000000000000000000000000000000000..adf5f1a5a8b94c85a2635af4bf54eab21328c7d8 --- /dev/null +++ b/src/Accounting_IETF_RFC2866_RFC2867.rdf @@ -0,0 +1,129 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Accounting_IETF_RFC2866_RFC2867.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2866(RADIUS Accounting) +// RFC 2867(RADIUS Accounting Modifications for Tunnel Protocol Support) +// +// +// + + +// APPLICATION-NAME: Acc +// APPLICATION-REVISION: RFC2866RFC2867 + +// Packet-Type: Accounting_Request (4) + +// Packet-Type: Accounting_Response (5) + + +// RFC 2866 and RFC 2867 +// Attrib: Acct-Status-Type (40) +type enumerated Acct_Status_Type +{ + Start (1), + Stop (2), + Interim_Update (3), + Accounting_On (7), + Accounting_Off (8), + Tunnel_Start (9), + Tunnel_Stop (10), + Tunnel_Reject (11), + Tunnel_Link_Start (12), + Tunnel_Link_Stop (13), + Tunnel_Link_Reject (14) +} + +// RFC 2866 +// Attrib: Acct-Delay-Type (41) +type Attrib_Value Acct_Delay_Type; + +// RFC 2866 +// Attrib: Acct-Input-Octets (42) +type Attrib_Value Acct_Input_Octets; + +// RFC 2866 +// Attrib: Acct-Output-Octets (43) +type Attrib_Value Acct_Output_Octets; + +// RFC 2866 +// Attrib: Acct-Session-Id (44) +type Attrib_Text Acct_Session_Id; + +// RFC 2866 +// Attrib: Acct-Authentic (45) +type enumerated Acct_Authentic +{ + RADIUS (1), + Local (2), + Remote (3) +} + +// RFC 2866 +// Attrib: Acct-Session-Time (46) +type Attrib_Value Acct_Session_Time; + +// RFC 2866 +// Attrib: Acct-Input-Packets (47) +type Attrib_Value Acct_Input_Packets; + +// RFC 2866 +// Attrib: Acct-Output-Packets (48) +type Attrib_Value Acct_Output_Packets; + +// RFC 2866 +// Attrib: Acct-Terminate-Cause (49) +type enumerated Acct_Terminate_Cause +{ + User_Request (1), + Lost_Carrier (2), + Lost_Service (3), + Idle_Timeout (4), + Session_Timeout (5), + Admin_Reset (6), + Admin_Reboot (7), + Port_Error (8), + NAS_Error (9), + NAS_Request (10), + NAS_Reboot (11), + Port_Unneeded (12), + Port_Preempted (13), + Port_Suspended (14), + Service_Unavailable (15), + Callback (16), + User_Error (17), + Host_Request (18) +} + +// RFC 2866 +// Attrib: Acct-Multi-Session-Id (50) +type Attrib_String Acct_Multi_Session_Id; + +// RFC 2866 +// Attrib: Acct-Link-Count (51) +type Attrib_Value Acct_Link_Count; + +// RFC 2867 +// Attrib: Acct-Tunnel-Connection (68) +type Attrib_String Acct_Tunnel_Connection; + +// RFC 2867 +// Attrib: Acct-Tunnel-Packets-Lost (86) +type Attrib_Value Acct_Tunnel_Packets_Lost; diff --git a/src/BaseTypes_IETF_RFC2865.rdf b/src/BaseTypes_IETF_RFC2865.rdf new file mode 100644 index 0000000000000000000000000000000000000000..8886d7902def76c686fe878ff29dcc7a741cfdb7 --- /dev/null +++ b/src/BaseTypes_IETF_RFC2865.rdf @@ -0,0 +1,137 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: BaseTypes_IETF_RFC2865.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2865(RADIUS) +// +// +// + + +// +// External functions for encoding and decoding +// + +external function f_RADIUS_Enc(in PDU_RADIUS pdu) return octetstring; +external function f_RADIUS_Dec(in octetstring stream) return PDU_RADIUS; + +external function f_calc_MD5(in octetstring input) return octetstring; +external function f_crypt_password(in octetstring P,in octetstring req_auth,in octetstring salt,in boolean decrypt,in charstring secret) return octetstring; +external function f_crypt_s_key(in octetstring s_key,in octetstring req_auth,in charstring secret, in boolean decrypt)return octetstring; +external function f_crypt_tunnel_password(in octetstring tunnel_password,in octetstring req_auth,in octetstring salt,in charstring secret, in boolean decrypt)return octetstring; + +external function f_salt_value(inout vendor_specific_value pdu, in octetstring req_auth, in charstring secret, in boolean decrypt) return boolean; +external function f_convert_string_to_text(inout vendor_specific_value pdu) return boolean; +// +// Basic type definitions +// + +type integer UINT8 (0..255) with { +variant "FIELDLENGTH(8)" +variant "BYTEORDER(last)" +} + +type integer UINT16 (0..65535) with { +variant "FIELDLENGTH(16)" +variant "BYTEORDER(last)" +} + +type integer UINT24 (0..16777215) with { +variant "FIELDLENGTH(24)" +variant "BYTEORDER(last)" +} + +type integer UINT32 (0..4294967296) with { +variant "FIELDLENGTH(32)" +variant "BYTEORDER(last)" +} + +type integer UINT64 with { +variant "FIELDLENGTH(64)" +variant "BYTEORDER(last)" +} + +type integer INT32 with { +variant "FIELDLENGTH(32)" +variant "BYTEORDER(last)" +variant "COMP(2scompl)" +} + +type octetstring OCTET1 length(1) +type octetstring OCTET2 length(2) +type octetstring OCTET3 length(3) +type octetstring OCTET4 length(4) +type octetstring OCTET8 length(8) +type octetstring OCTET16 length(16) + +// +// Basic Attribute Data Formats +// + +type charstring Attrib_Text length(1..253) with { variant "PADDING(yes)"}; +type octetstring Attrib_String length(1..253); +type OCTET4 Attrib_Address; +type OCTET4 Attrib_Time; +type UINT32 Attrib_Value; + +// +// Basic vendor specific value types +// + +type union vendor_specific_value{ + octetstring string_val, + charstring text_val, + UINT32 integer_val, + UINT64 integer64_val, + unsalted_value_integer_t unsalted_integer, + unsalted_value_text_t unsalted_text, + unsalted_value_string_t unsalted_string, + tagged_value_integer_t tagged_integer, + tagged_value_text_t tagged_text, + tagged_value_string_t tagged_string +} + +type record unsalted_value_integer_t{ + octetstring salt length(2), + UINT32 unsalted_value +} +type record unsalted_value_text_t{ + octetstring salt length(2), + charstring unsalted_value +} +type record unsalted_value_string_t{ + octetstring salt length(2), + octetstring unsalted_value +} + +type record tagged_value_integer_t{ + octetstring tag length(1), + UINT32 untagged_value +} +type record tagged_value_string_t{ + octetstring tag length(1), + octetstring untagged_value +} +type record tagged_value_text_t{ + octetstring tag length(1), + charstring untagged_value +} + + diff --git a/src/Base_IETF_RFC2865.rdf b/src/Base_IETF_RFC2865.rdf new file mode 100644 index 0000000000000000000000000000000000000000..17f010f2b5b029e69d30b78408e21bdb137d24fd --- /dev/null +++ b/src/Base_IETF_RFC2865.rdf @@ -0,0 +1,305 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Base_IETF_RFC2865.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2865(RADIUS) +// +// +// + + +// APPLICATION-NAME: Base +// APPLICATION-REVISION: RFC2865 + + + +// Packet-Type: Access-Request (1) + +// Packet-Type: Access_Accept (2) + +// Packet-Type: Access_Reject (3) + +// Packet-Type: Accounting_Request (4) + +// Packet-Type: Accounting_Response (5) + +// Packet-Type: Access_Challenge (11) + +// Packet-Type: Status_Server (12) + +// Packet-Type: Status_Client (13) + +// Packet-Type: Reserved (255) + + + + +// RFC 2865 +// Attrib: User-Name (1) +type Attrib_String User_Name; + +// RFC 2865 +// Attrib: User-Password (2) +type Attrib_String User_Password; + +// RFC 2865 +// Attrib: CHAP-Password (3) +type record CHAP_Password +{ + UINT8 CHAP_Ident, + Attrib_String String length(16) +} + +// RFC 2865 +// Attrib: NAS-IP-Address (4) +type Attrib_Address NAS_IP_Address; + +// RFC 2865 +// Attrib: NAS-Port (5) +type Attrib_Value NAS_Port; + +// RFC 2865 +// Attrib: Service-Type (6) +type enumerated Service_Type +{ + Login (1), + Framed (2), + Callback_Login (3), + Callback_Framed (4), + Outbound (5), + Administrative (6), + NAS_Prompt (7), + Authenticate_Only (8), + Callback_NAS_Prompt (9), + Call_Check (10), + Callback_Administrative (11), + Authorize_Only (17) +} + + +// RFC 2865 +// Attrib: Framed-Protocol (7) +type enumerated Framed_Protocol +{ + PPP (1), + SLIP (2), + Appletalk_Remote_Access_Protocol (3), + Gandalf_proprietary_protocol (4), + Xylogics_proprietary (5), + Xpoint75_Syncronous (6), + GPRS_PDP_Context (7) +} + + +// RFC 2865 +// Attrib: Framed-IP-Address (8) +type Attrib_Address Framed_IP_Address; + +// RFC 2865 +// Attrib: Framed-IP-Netmask (9) +type Attrib_Address Framed_IP_Netmask; + +// RFC 2865 +// Attrib: Framed-Routing (10) +type enumerated Framed_Routing +{ + None (0), + Send_routing_pacets (1), + Listen_for_routing_pacets (2), + Send_and_Listen (3) +} + +// RFC 2865 +// Attrib: Filter-Id (11) +type Attrib_Text Filter_Id; + +// RFC 2865 +// Attrib: Framed-MTU (12) +type Attrib_Value Framed_MTU (64..65535); + +// RFC 2865 +// Attrib: Framed-Compression (13) +type enumerated Framed_Compression +{ + None (0), + VJ_TCP_IP_header_compression (1), + IPX_header_compression (2), + STAC_LZS_compression (3) +} + +// RFC 2865 +// Attrib: Login-IP-Host (14) +type Attrib_Address Login_IP_Host; + +// RFC 2865 +// Attrib: Login-Service (15) +type enumerated Login_Service +{ + Telnet (0), + Rlogin (1), + TCP_Clear (2), + Port_Master (3), + LAT (4), + X25_PAD (5), + X25_T3POS (6), + TCP_Clear_Quiet (7) +} + +// RFC 2865 +// Attrib: Login-TCP-Port (16) +type Attrib_Value Login_TCP_Port (0..65535); + +// RFC 2865 +// Attrib: Reply-Message (18) +type Attrib_Text Reply_Message; + +// RFC 2865 +// Attrib: Callback-Number (19) +type Attrib_String Callback_Number; + +// RFC 2865 +// Attrib: Callback-Id (20) +type Attrib_String Callback_Id; + +// RFC 2865 +// Attrib: Framed-Route (22) +type Attrib_Text Framed_Route; + +// RFC 2865 +// Attrib: Framed-IPX-Network (23) +type Attrib_Value Framed_IPX_Network; + +// RFC 2865 +// Attrib: State (24) +type Attrib_String State; + +// RFC 2865 +// Attrib: Class (25) +type Attrib_String Class; + + +// RFC 2865 +// Attrib: Session-Timeout (27) +type Attrib_Value Session_Timeout; + +// RFC 2865 +// Attrib: Idle-Timeout (28) +type Attrib_Value Idle_Timeout; + +// RFC 2865 +// Attrib: Termination-Action (29) +type enumerated Termination_Action +{ + Default (0), + RADIUS_Request (1) +} + +// RFC 2865 +// Attrib: Called-Station-Id (30) +type Attrib_String Called_Station_Id; + +// RFC 2865 +// Attrib: Calling-Station-Id (31) +type Attrib_String Calling_Station_Id; + +// RFC 2865 +// Attrib: NAS-Identifier (32) +type Attrib_String NAS_Identifier; + +// RFC 2865 +// Attrib: Proxy-State (33) +type Attrib_String Proxy_State; + +// RFC 2865 +// Attrib: Login-LAT-Service (34) +type Attrib_String Login_LAT_Service; + +// RFC 2865 +// Attrib: Login-LAT-Node (35) +type Attrib_String Login_LAT_Node; + +// RFC 2865 +// Attrib: Login-LAT-Group (36) +type Attrib_String Login_LAT_Group; + +// RFC 2865 +// Attrib: Framed-AppleTalk-Link (37) +type Attrib_Value Framed_AppleTalk_Link (0..65535); + +// RFC 2865 +// Attrib: Framed-AppleTalk-Network (38) +type Attrib_Value Framed_AppleTalk_Network (0..65535); + +// RFC 2865 +// Attrib: Framed-AppleTalk-Zone (39) +type Attrib_String Framed_AppleTalk_Zone; + +// RFC 2865 +// Attrib: CHAP-Challenge (60) +type Attrib_String CHAP_Challenge; + +// RFC 2865 +// Attrib: NAS-Port-Type (61) +type enumerated NAS_Port_Type +{ + Async (0), + Sync (1), + ISDN_Sync (2), + ISDN_Async_v120 (3), + ISDN_Async_v110 (4), + Virtual (5), + PIAFS (6), + HDLC_Clear_Channel (7), + X25 (8), + X75 (9), + G3_Fax (10), + SDSL_Symmetric_DSL (11), + ADSL_CAP_Asymmetric_DSL (12), + ADSL_DMT_Asymmetric_DSL (13), + ISDL_ISDN_Digital_Subscriber_Line (14), + Ethernet (15), + xDSL (16), + Cable (17), + Wireless_Other (18), + Wireless_IEEE_80211 (19) +} + + +// RFC 2865 +// Attrib: Port-Limit (62) +type Attrib_Value Port_Limit; + +// RFC 2865 +// Attrib: Login-LAT-Port (63) +type Attrib_String Login_LAT_Port; + + + +// RFC 2865 +// Attrib: Vendor-Specific (26) +type vendor_specific_type Vendor_Specific + + + + + + + + diff --git a/src/ChargeableUserIdentity_IETF_RFC4372.rdf b/src/ChargeableUserIdentity_IETF_RFC4372.rdf new file mode 100644 index 0000000000000000000000000000000000000000..508f6258d037cd3452538d5d09c47e5fba8970c3 --- /dev/null +++ b/src/ChargeableUserIdentity_IETF_RFC4372.rdf @@ -0,0 +1,32 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: ChargeableUserIdentity_IETF_RFC4372.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 4372(Chargeable User Identity) +// +// + + +// APPLICATION-NAME: CUI +// APPLICATION-REVISION: RFC4372 + +// RFC 4372 +// Attrib: CUI (89) +type Attrib_String CUI; diff --git a/src/Cisco.rdf b/src/Cisco.rdf new file mode 100644 index 0000000000000000000000000000000000000000..b5e14db9605e8546efa9c44ccdc4c82ab5fe95a5 --- /dev/null +++ b/src/Cisco.rdf @@ -0,0 +1,133 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Cisco.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: +// +// + +// Vendor: cisco (9) + +type record cisco_type +{ + cisco_type_enum f_cisco_type, + UINT8 attrib_length_spec, + vendor_specific_value string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_cisco_type, attrib_length_spec, string_val)" + variant (string_val) "CROSSTAG( + integer_val, {f_cisco_type=multilink_id, + f_cisco_type=num_in_multilink, + f_cisco_type=pre_input_octets, + f_cisco_type=pre_output_octets, + f_cisco_type=pre_input_packets, + f_cisco_type=pre_output_packets, + f_cisco_type=maximum_time, + f_cisco_type=disconnect_cause, + f_cisco_type=date_rate, + f_cisco_type=presession_time, + f_cisco_type=pw_limetime, + f_cisco_type=ip_direct, + f_cisco_type=ppp_vj_slot_comp, + f_cisco_type=ppp_async_map, + f_cisco_type=ip_pool_definition, + f_cisco_type=asing_ip_pool, + f_cisco_type=route_ip, + f_cisco_type=link_compression, + f_cisco_type=target_util, + f_cisco_type=maximum_channels, + f_cisco_type=data_filter, + f_cisco_type=call_filter, + f_cisco_type=idle_limit, + f_cisco_type=xmit_rate + }; + unsalted_string, f_cisco_type=li_configuration; + string_val, OTHERWISE + )" +} + +type set of cisco_type cisco_subattr_list; + +type enum_8 cisco_type_enum +{ + cisco_avpair (1),//cisco_access_control_list + cisco_nas_port (2), + h323_remote_address (23), + h323_conf_id (24), + h323_setup_time (25), + h323_call_orign (26), + h323_call_type (27), + h323_connect_time (28), + h323_disconnect_time (29), + h323_disconnect_cause (30), + h323_voice_quality (31), + h323_ivr_out (32), + h323_gw_id (33), + h323_call_treatment (34), + h323_incoming_conf_id (35), + li_configuration (36), + policy_up (37), + policy_down (38),//sub_policy_out + vpnpassword (66), + vpngroupinfo (67), + h323_ivr_in (100), + h323_credit_amount (101), + h323_credit_time (102), + h323_return_code (103), + h323_prompt_id (104), + h323_time_and_day (105), + h323_redirect_number (106), + h323_preferred_lang (107), + h323_redirect_ip_addr (108), + h323_billing_model (109), + h323_currency_type (110), + multilink_id (187), + num_in_multilink (188), + pre_input_octets (190), + pre_output_octets (191), + pre_input_packets (192), + pre_output_packets (193), + maximum_time (194), + disconnect_cause (195), + date_rate (197), + presession_time (198), + pw_limetime (208), + ip_direct (209), + ppp_vj_slot_comp (210), + ppp_async_map (212), + ip_pool_definition (217), + asing_ip_pool (218), + route_ip (228), + link_compression (233), + target_util (234), + maximum_channels (235), + data_filter (242), + call_filter (243), + idle_limit (244), + account_info (250),//cisco_info_service,cisco_account_info + service_info (251),//cisco_service_list,ssg_service_info + command_code (252),//cisco_n_service_info + control_info (253), //cisco_byte_count,ssg_control_info + xmit_rate (255) +} + + + + diff --git a/src/DynamicAuthorizationExtensions_IETF_RFC5176.rdf b/src/DynamicAuthorizationExtensions_IETF_RFC5176.rdf new file mode 100644 index 0000000000000000000000000000000000000000..8bc7010a6d4ad6cc42dd76389644513849d5a7b1 --- /dev/null +++ b/src/DynamicAuthorizationExtensions_IETF_RFC5176.rdf @@ -0,0 +1,66 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: DynamicAuthorizationExtensions_IETF_RFC5176.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 5176(RADIUS Authorization Extensions) +// Obsoletes: RFC 3576 +// +// + + +// APPLICATION-NAME: AuthExt +// APPLICATION-REVISION: RFC5176 + + +// Packet-Type: Disconnect-Request (40) + +// Packet-Type: Disconnect-ACK (41) + +// Packet-Type: Disconnect-NAK (42) + +// Packet-Type: CoA-Request (43) + +// Packet-Type: CoA-ACK (44) + +// Packet-Type: CoA-NAK (45) + + +// RFC 5176 +// Attrib: Error-Cause (101) +type enumerated Error_Cause +{ + Residual_Session_Context_Removed (201), + Invalid_EAP_Packet (202), + Unsupported_Attribute (401), + Missing_Attribute (402), + NAS_Identification_Mismatch (403), + Invalid_Request (404), + Unsupported_Service (405), + Unsupported_Extension (406), + Invalid_Attribute_Value (407), + Administratively_Prohibited (501), + Request_Not_Routable_Proxy (502), + Session_Context_Not_Found (503), + Session_Context_Not_Removable (504), + Other_Proxy_Processing_Error (505), + Resources_Unavailable (506), + Request_Initiated (507), + Multiple_Session_Selection_Unsupported (508) +} diff --git a/src/Extensions_IETF_RFC2869.rdf b/src/Extensions_IETF_RFC2869.rdf new file mode 100644 index 0000000000000000000000000000000000000000..355e7feb2dd01cd2aecd780b48f1df204c6bd14f --- /dev/null +++ b/src/Extensions_IETF_RFC2869.rdf @@ -0,0 +1,125 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Extensions_IETF_RFC2869.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2869(RADIUS Extensions) +// +// +// + + +// APPLICATION-NAME: Ext +// APPLICATION-REVISION: RFC2869 + +// RFC 2869 +// Attrib: Acct-Input-Gigawords (52) +type Attrib_Value Acct_Input_Gigawords; + +// RFC 2869 +// Attrib: Acct-Output-Gigawords (53) +type Attrib_Value Acct_Output_Gigawords; + +// RFC 2869 +// Attrib: Event-Timestamp (55) +type Attrib_Value Event_Timestamp; + +// RFC 2869 +// Attrib: ARAP-Password (70) +type record ARAP_Password +{ + Attrib_Value Value1, + Attrib_Value Value2, + Attrib_Value Value3, + Attrib_Value Value4 +} + +// RFC 2869 +// Attrib: ARAP-Features (71) +type record ARAP_Features +{ + UINT8 variable_password, + UINT8 password_length, + Attrib_Time creation_time, + Attrib_Value expiration_time, + Attrib_Time radius_time +} + +// RFC 2869 +// Attrib: ARAP-Zone-Access (72) +type enumerated ARAP_Zone_Access +{ + To_default_zone (1), + Use_zone_filter_inclusively (2), + Use_zone_filter_exclusively (3) +} + +// RFC 2869 +// Attrib: ARAP-Security (73) +type Attrib_Value ARAP_Security; + +// RFC 2869 +// Attrib: ARAP-Security-Data (74) +type Attrib_String ARAP_Security_Data; + +// RFC 2869 +// Attrib: Password-Retry (75) +type Attrib_Value Password_Retry; + +// RFC 2869 +// Attrib: Prompt (76) +type enumerated Prompt +{ + No_Echo (0), + Echo (1) +} + +// RFC 2869 +// Attrib: Connect-Info (77) +type Attrib_Text Connect_Info; + +// RFC 2869 +// Attrib: Configuration-Token (78) +type Attrib_String Configuration_Token; + +// RFC 2869 +// Attrib: EAP-Message (79) +type Attrib_String EAP_Message; + +// RFC 2869 +// Attrib: Message-Authenticator (80) +type Attrib_String Message_Authenticator; + +// RFC 2869 +// Attrib: ARAP-Challenge-Response (84) +type UINT64 ARAP_Challenge_Response; + +// RFC 2869 +// Attrib: Acct-Interim-Interval (85) +type Attrib_Value Acct_Interim_Interval; + +// RFC 2869 +// Attrib: NAS-Port-Id (87) +type Attrib_Text NAS_Port_Id; + +// RFC 2869 +// Attrib: Framed-Pool (88) +type Attrib_String Framed_Pool; + + diff --git a/src/GGSN_FS_46_15517_CSA113_35_4RevB.rdf b/src/GGSN_FS_46_15517_CSA113_35_4RevB.rdf new file mode 100644 index 0000000000000000000000000000000000000000..a7e6c85f679108402ee9fdb6b64970621760af24 --- /dev/null +++ b/src/GGSN_FS_46_15517_CSA113_35_4RevB.rdf @@ -0,0 +1,55 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: GGSN_FS_46_15517_CSA113_4RevB.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: GGSN Functional Specification: RADIUS +// 46/155 17-CSA 113 35/4 Uen Rev B +// +// + + +// APPLICATION-NAME: Ggsn +// APPLICATION-REVISION: VB + +// Attrib: Imsi (224) +type Attrib_Text Imsi; + +// Attrib: Charging-Id (225) +type Attrib_Value Charging_Id; + +// Attrib: Imsi-Mcc-Mnc (226) +type Attrib_Text Imsi_Mcc_Mnc; + +// Attrib: Sgsn-IP-Address (228) +type Attrib_Address Sgsn_IP_Address; + +// Attrib: Selection-Mode (229) +type Attrib_Text Selection_Mode; + +// Attrib: Ggsn-Gtp-IP-Address (230) +type Attrib_Address Ggsn_Gtp_IP_Address; + +// Attrib: Primary-Dns-Server (135) +type Attrib_Address Primary_Dns_Server; + +// Attrib: Secondary-Dns-Server (136) +type Attrib_Address Secondary_Dns_Server; + + diff --git a/src/IPv6_IETF_RFC3162.rdf b/src/IPv6_IETF_RFC3162.rdf new file mode 100644 index 0000000000000000000000000000000000000000..393b958e0aa3f85f0d71d2d7683600e9f85cd5dc --- /dev/null +++ b/src/IPv6_IETF_RFC3162.rdf @@ -0,0 +1,64 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: IPv6_IETF_RFC3162.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 3162(RADIUS and IPv6) +// +// +// + + +// APPLICATION-NAME: IPv6 +// APPLICATION-REVISION: RFC3162 + +// RFC 3162 +// Attrib: NAS-IPv6-Address (95) +type OCTET16 NAS_IPv6_Address; + +// RFC 3162 +// Attrib: Framed-Interface-Id (96) +type OCTET8 Framed_Interface_Id; + +// RFC 3162 +// Attrib: Framed-IPv6-Prefix (97) +type record Framed_IPv6_Prefix +{ + OCTET1 reserved, + UINT8 prefix_length, + bitstring prefixValue, + bitstring prefixPadding +} with { + variant (prefix_length) "LENGTHTO(prefixValue)"; + variant (prefix_length) "UNIT(bits)"; + variant (prefixValue) "BYTEORDER(last)"; + variant "FIELDORDER(msb)"; + } + +// RFC 3162 +// Attrib: Login-IPv6-Host (98) +type OCTET16 Login_IPv6_Host; + +// RFC 3162 +// Attrib: Framed-IPv6-Route (99) +type Attrib_Text Framed_IPv6_Route; + +// RFC 3162 +// Attrib: Framed-IPv6-Pool (100) +type Attrib_String Framed_IPv6_Pool; diff --git a/src/Juniper.rdf b/src/Juniper.rdf new file mode 100644 index 0000000000000000000000000000000000000000..e4e3e9c849c1e31d47c65e6f93b050b066ac77fb --- /dev/null +++ b/src/Juniper.rdf @@ -0,0 +1,185 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Juniper.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: +// +// + +// Vendor: juniper (4874) + +type record juniper_type +{ + juniper_type_enum f_juniper_type, + UINT8 attrib_length_spec, + vendor_specific_value string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_juniper_type, attrib_length_spec, string_val)" + variant (string_val) "CROSSTAG( + unsalted_string, {f_juniper_type=li_action, + f_juniper_type=med_port_number, + f_juniper_type=med_dev_handle, + f_juniper_type=med_ip_address + }; + integer_val, { f_juniper_type=ingress_statistics, + f_juniper_type=egress_statistics, + f_juniper_type=service_category, + f_juniper_type=pcr, + f_juniper_type=scr_or_cbr_bit_rate, + f_juniper_type=mbs, + f_juniper_type=allow_all_vr_access, + f_juniper_type=sa_validate, + f_juniper_type=lgmp_enable, + f_juniper_type=pppoe_max_sessions, + f_juniper_type=qos_profile_interface_type, + f_juniper_type=tunnel_nas_port_method, + f_juniper_type=tunnel_tos, + f_juniper_type=tunnel_max_sessions, + f_juniper_type=framed_ip_route_tag, + f_juniper_type=ppp_protocol, + f_juniper_type=tunnel_min_bps, + f_juniper_type=tunnel_max_bps, + f_juniper_type=tunnel_bearer_type, + f_juniper_type=input_gigapackets, + f_juniper_type=output_gigapackets, + f_juniper_type=df_bit, + f_juniper_type=mld_version, + f_juniper_type=igmp_version, + f_juniper_type=ip_mcast_adm_bw_limit, + f_juniper_type=ip6_mcast_adm_bw_limit, + f_juniper_type=igmp_query_interval, + f_juniper_type=igmp_max_resp_time, + f_juniper_type=igmp_immediate_leave, + f_juniper_type=mld_query_interval, + f_juniper_type=mld_max_resp_time, + f_juniper_type=mld_immediate_leave, + f_juniper_type=service_interim_acct_interval, + f_juniper_type=downstream_calculated_qos_rate, + f_juniper_type=upstream_calculated_qos_rate + }; + tagged_integer, {f_juniper_type=juniper_service_volume, + f_juniper_type=juniper_service_timeout, + f_juniper_type=juniper_service_stats + }; + tagged_text, f_juniper_type=juniper_service_activate; + + string_val, OTHERWISE + )" +} + +type set of juniper_type juniper_subattr_list; + +type enum_8 juniper_type_enum +{ + virtual_router (1), + local_address_pool (2), + local_interface (3), + primary_dns (4), + secondary_dns (5), + primary_wins (6), + secondary_wins (7), + tunnel_virtual_router (8), + tunnel_password (9), + ingress_policy_name (10), + egress_policy_name (11), + ingress_statistics (12), + egress_statistics (13), + service_category (14), + pcr (15), + scr_or_cbr_bit_rate (16), + mbs (17), + init_cli_access_level (18), + allow_all_vr_access (19), + alt_cli_access_level (20), + alt_cli_vrouter_name (21), + sa_validate (22), + lgmp_enable (23), + pppoe_description (24), + redirect_vr_name (25), + qos_profile_name (26), + pppoe_max_sessions (27), + pppoe_url (28), + qos_profile_interface_type (29), + tunnel_nas_port_method (30), + service_bundle (31), + tunnel_tos (32), + tunnel_max_sessions (33), + framed_ip_route_tag (34), + tunnel_dialout_number (35), + ppp_username (36), + ppp_password (37), + ppp_protocol (38), + tunnel_min_bps (39), + tunnel_max_bps (40), + tunnel_bearer_type (41), + input_gigapackets (42), + output_gigapackets (43), + tunnel_interface_id (44), + ipv6_virtual_router (45), + ipv6_local_interfaces (46), + ipv6_primary_dns (47), + ipv6_secondary_dns (48), + sdx_service_name (49), + sdx_session_volume_quota (50), + disconnect_cause (51), + radius_client_address (52), + service_description (53), + dhcp_options (55), + dhcp_mac_addr (56), + dhcp_gi_address (57), + li_action (58), + med_dev_handle (59), + med_ip_address (60), + med_port_number (61), + mlppp_bundle_name (62), + interface_desc (63), + tunnel_group (64), + juniper_service_activate (65), + juniper_service_deactivate (66), + juniper_service_volume (67), + juniper_service_timeout (68), + juniper_service_stats (69), + df_bit (70), + igmp_access_name (71), + igmp_access_src_name (72), + igmp_oif_map_name (73), + mld_access_name (74), + mld_access_src_name (75), + mld_oif_map_name (76), + mld_version (77), + igmp_version (78), + ip_mcast_adm_bw_limit (79), + ip6_mcast_adm_bw_limit (80), + qos_parameters (82), + service_session (83), + igmp_query_interval (95), + igmp_max_resp_time (96), + igmp_immediate_leave (97), + mld_query_interval (98), + mld_max_resp_time (99), + mld_immediate_leave (100), + service_interim_acct_interval (140), + downstream_calculated_qos_rate (141), + upstream_calculated_qos_rate (142) +} + + + + diff --git a/src/RADIUS_EncDec.cc b/src/RADIUS_EncDec.cc new file mode 100644 index 0000000000000000000000000000000000000000..009202ed1e25d75e828f99e3b701a977b6787584 --- /dev/null +++ b/src/RADIUS_EncDec.cc @@ -0,0 +1,299 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: RADIUS_EncDec.cc +// Description: Encoder/Decoder and external functions for RPMG +// Rev: R12A +// Prodnr: CNL 113 600 +// Reference: RFC 2865(RADIUS), 2866(RADIUS Accounting), +// +// +// + +#include "RADIUS_Types.hh" + +#include <openssl/md5.h> + +namespace RADIUS__Types{ + + +// calculates 16 bit MD5 message digest +OCTETSTRING f__calc__MD5(const OCTETSTRING& input) + { + unsigned char output[16]; + MD5(input,(size_t) input.lengthof(),output); //error check! + OCTETSTRING MD5_Value(16,output); + + return MD5_Value; + } + +// copied from Radius Test Port ( secret CHARSTRING -> OCTETSTRING +OCTETSTRING f__crypt__password (const OCTETSTRING& P, const OCTETSTRING& req__auth, const OCTETSTRING& salt,const BOOLEAN& decrypt, const CHARSTRING& secret) { + + const unsigned char* P_p = (const unsigned char*)P; + int P_num = P.lengthof() / 16; + + if (P.lengthof() % 16 != 0) + TTCN_warning("Length of P should be multiple of 16"); + + unsigned char b[16]; + + const OCTETSTRING& SRA = char2oct(secret) + req__auth + salt; + + TTCN_Logger::begin_event(TTCN_DEBUG); + TTCN_Logger::log_event("SRA: "); + SRA.log(); + TTCN_Logger::end_event(); + + MD5((const unsigned char*)SRA, SRA.lengthof(), b); + + unsigned char* C = new unsigned char [P_num * 16]; // output buffer + + for (int j = 0; j < 16; j++) { + C[j] = P_p[j] ^ b[j]; + } + + unsigned int S_len = secret.lengthof(); + + unsigned char* Sc = new unsigned char[S_len + 16]; + memcpy(Sc, (const unsigned char*)(const char*)secret, S_len); + + for (int i = 1; i < P_num; i++) { + if (decrypt) + memcpy(Sc + S_len, P_p + (i-1)*16, 16); + else + memcpy(Sc + S_len, C + (i-1)*16, 16); + + MD5(Sc, S_len + 16, b); + for (int j = 0; j < 16; j++) { + C[(i*16 + j)] = P_p[(i*16 +j)] ^ b[j]; + } + } + + OCTETSTRING result = OCTETSTRING(P_num*16, (const unsigned char*)C); + delete [] C; + delete [] Sc; + + TTCN_Logger::begin_event(TTCN_DEBUG); + TTCN_Logger::log_event("Result of hashing: "); + result.log(); + TTCN_Logger::end_event(); + + return result; + +} // crypt_password + +OCTETSTRING f__crypt__s__key(const OCTETSTRING& pl_s_key, const OCTETSTRING& pl_req_auth, const CHARSTRING& secret,const BOOLEAN& decrypt) +{ + if (decrypt) + { + const OCTETSTRING& salt = substr(pl_s_key, 0, 2); + const OCTETSTRING& decrypted = f__crypt__password(substr(pl_s_key, 2, pl_s_key.lengthof() - 2),pl_req_auth, salt, true, secret); + int key_len = *((const unsigned char*)decrypted); // first byte + if (key_len > decrypted.lengthof() - 1) { + TTCN_warning("Invalid key length in \'S\' key."); + key_len = decrypted.lengthof() - 1; + } + const OCTETSTRING& key_length_and_key = substr(decrypted, 0, key_len + 1); + OCTETSTRING result = salt + key_length_and_key; + return result; + } // decrypt_s_key + else + { + if (pl_s_key.lengthof() < 3) + TTCN_warning("string_val in \'S\' key must be at least 3 octets long."); + const OCTETSTRING& salt = OCTETSTRING(2, (const unsigned char*)pl_s_key); + const int key_len = *((const unsigned char*)pl_s_key + 2); + const OCTETSTRING& key = OCTETSTRING(pl_s_key.lengthof() - 3, (const unsigned char*)pl_s_key + 3); + int calc_key_len; + if (key_len == 0) + calc_key_len = key.lengthof(); + else { + if (key_len != key.lengthof()) + TTCN_warning("Invalid key length in \'S\' key."); + calc_key_len = key_len; + } + int padding_len = (16 - ((key.lengthof() + 1) % 16)) % 16; // +1 for the key length + const OCTETSTRING& P = int2oct(calc_key_len, 1) + key + OCTETSTRING(padding_len, (const unsigned char*)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); + OCTETSTRING result = salt + f__crypt__password(P, pl_req_auth, salt, false, secret); + return result; + } +} // crypt_s_key + +OCTETSTRING f__crypt__tunnel__password(const OCTETSTRING& pl_password, const OCTETSTRING& req_auth, const OCTETSTRING& salt, const CHARSTRING& secret,const BOOLEAN& decrypt) { + if (decrypt) + { + const OCTETSTRING& plain = f__crypt__password(pl_password, req_auth, salt, true, secret); + OCTETSTRING password; + password = OCTETSTRING(plain.lengthof(), (const unsigned char*)plain + 1); + return password; + } + else + { + int data_len=pl_password.lengthof(); + // the following line pads P to be multiple of 16 octets + const OCTETSTRING& P = int2oct(data_len, 1) + pl_password + OCTETSTRING( + (16-((pl_password.lengthof() + 1) % 16)) % 16, (const unsigned char*)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); + return f__crypt__password(P, req_auth, salt, false, secret); + } +} // encrypt_tunnel_password + + +OCTETSTRING f__RADIUS__Enc(const PDU__RADIUS& pdu) +{ + PDU__RADIUS* par=NULL; + + TTCN_Buffer buf; + TTCN_EncDec::error_type_t err; + buf.clear(); + TTCN_EncDec::clear_error(); + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + if(par) + par->encode(PDU__RADIUS_descr_, buf, TTCN_EncDec::CT_RAW); + else + pdu.encode(PDU__RADIUS_descr_, buf, TTCN_EncDec::CT_RAW); + err = TTCN_EncDec::get_last_error_type(); + if(err != TTCN_EncDec::ET_NONE) + TTCN_warning("Encoding error: %s\n", TTCN_EncDec::get_error_str()); + delete par; + return OCTETSTRING(buf.get_len(), buf.get_data()); +} + +PDU__RADIUS f__RADIUS__Dec(const OCTETSTRING& stream) +{ + PDU__RADIUS pdu; + TTCN_Buffer buf; + TTCN_EncDec::error_type_t err; + TTCN_EncDec::clear_error(); + buf.clear(); + buf.put_os(stream); + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + pdu.decode(PDU__RADIUS_descr_, buf, TTCN_EncDec::CT_RAW); + err = TTCN_EncDec::get_last_error_type(); + if(err != TTCN_EncDec::ET_NONE) + TTCN_warning("Decoding error: %s\n", TTCN_EncDec::get_error_str()); + return pdu; +} + +BOOLEAN f__salt__value(vendor__specific__value& pdu, const OCTETSTRING& req_auth, const CHARSTRING& secret, const BOOLEAN& decrypt){ + OCTETSTRING salt; + OCTETSTRING key; + switch(pdu.get_selection()){ + case vendor__specific__value::ALT_unsalted__integer: + { + salt = pdu.unsalted__integer().salt(); + key = int2oct(pdu.unsalted__integer().unsalted__value(),4); + break; + } + case vendor__specific__value::ALT_unsalted__text: + { + salt = pdu.unsalted__text().salt(); + key = char2oct(pdu.unsalted__text().unsalted__value()); + break; + } + case vendor__specific__value::ALT_unsalted__string: + { + salt = pdu.unsalted__string().salt(); + key = pdu.unsalted__string().unsalted__value(); + break; + } + case vendor__specific__value::ALT_string__val: + { + salt =OCTETSTRING(0, (const unsigned char*)"\0"); + key = pdu.string__val(); + break; + } + default: + return false; + } + OCTETSTRING string_val; + if(decrypt){ + string_val = f__crypt__password (key,req_auth , salt, decrypt, secret); + int key_len = *((const unsigned char*)string_val); // first byte + + if (key_len > string_val.lengthof() - 1) { + TTCN_warning("Invalid key length"); + key_len = string_val.lengthof() - 1; + } + string_val = substr(string_val, 1, key_len); + } else { + const int key_len = key.lengthof(); + int padding_len = (16 - ((key_len + 1) % 16)) % 16; // +1 for the key length + const OCTETSTRING& P = int2oct(key.lengthof(), 1) + key + OCTETSTRING(padding_len, (const unsigned char*)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); + string_val = f__crypt__password (P,req_auth , salt, decrypt, secret); + + } + + if(salt.lengthof()!=0){ + pdu.unsalted__string().salt()=salt; + pdu.unsalted__string().unsalted__value()=string_val; + } else { + pdu.string__val()=string_val; + } + return true; +} + +bool f_convert_string_to_text(const OCTETSTRING& in, CHARSTRING& out){ + const unsigned char * key_ptr = (const unsigned char *)in; + for (int i = 0; i<(in.lengthof());i++){ + if (key_ptr[i] & 0x80) { + return false; + } + } + out = oct2char(in); + return true; + +} + +BOOLEAN f__convert__string__to__text(vendor__specific__value& pdu){ + CHARSTRING chr; + switch(pdu.get_selection()){ + case vendor__specific__value::ALT_string__val: + { + if(f_convert_string_to_text( pdu.string__val(),chr)){ + pdu.text__val()=chr; + } else { return false; } + break; + } + case vendor__specific__value::ALT_unsalted__string: + { + if(f_convert_string_to_text( pdu.unsalted__string().unsalted__value(),chr)){ + OCTETSTRING salt=pdu.unsalted__string().salt(); + pdu.unsalted__text().unsalted__value()=chr; + pdu.unsalted__text().salt()=salt; + } else { return false; } + break; + } + case vendor__specific__value::ALT_tagged__string: + { + if(f_convert_string_to_text( pdu.tagged__string().untagged__value(),chr)){ + OCTETSTRING tag=pdu.tagged__string().tag(); + pdu.tagged__text().untagged__value()=chr; + pdu.tagged__text().tag()=tag; + } else { return false; } + break; + } + default: + return false; + } + return true; +} + + +} +TTCN_Module RADIUS_EncDec("RADIUS_EncDec", __DATE__, __TIME__); diff --git a/src/Scap.rdf b/src/Scap.rdf new file mode 100644 index 0000000000000000000000000000000000000000..55ede9fb894aef29181b747623f6b979e85abd9f --- /dev/null +++ b/src/Scap.rdf @@ -0,0 +1,161 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Scap.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: +// +// + +// Vendor: scap (10923) + + +type enum_8 scap_type_enum +{ + requested_service_unit (1), + used_service_unit (2), + granted_service_unit (3), + unit_type (4), + unit_value (5), + value_digits (6), + exponent (7), + currency_code (8), + subscription_id (9), + additional_subscription_id (10), + subscription_id_type (11), + subscription_id_data (12), + event_timestamp (13), + accounting_record_number (14), + result_code (15), + accounting_interim_interval (16), + origin_state_id (17), + suggested_primary_rulespace (30), + suggested_secondary_rulespace (31), + access_control_group_id (33), + authorization_code (34), + mobile_assisted_service_classification (35) +} + + +type enum_8 scap_unit_type_enum { + SERVICE_CREDIT_TIME (0), + SERVICE_CREDIT_VOLUME (1), + SERVICE_CREDIT_EVENT (2), + SERVICE_CREDIT_MONEY (3) +} + + +type enum_8 scap_subsription_id_type_enum { + END_USER_MSISDN (0), + END_USER_IMSI (1), + END_USER_SIP_URL (2), + END_USER_NAI (3), + END_USER_PRIVATE (4) +} + +type record scap_unit_type_t { + scap_type_enum scap_type, + UINT8 scap_length, + INT32 scap_val +} with { + variant (scap_length) "LENGTHTO(scap_type, scap_length, scap_val)" +} + +type set of scap_unit_type_t unit_value_list; + +type union unit_value_t +{ + octetstring string_val, + scap_unit_type_enum unit_type_val, + scap_subsription_id_type_enum subsription_id_type_val, + unit_value_list unit_type_list, + INT32 integer_val, + charstring unichar_val +} + + +type record service_unit_t { + scap_type_enum scap_type, + UINT8 scap_length, + unit_value_t scap_val +} with { + variant (scap_length) "LENGTHTO(scap_type, scap_length, scap_val)"; + variant (scap_val) "CROSSTAG( + unit_type_val, scap_type=unit_type; + unit_type_list, scap_type=unit_value; + integer_val, scap_type=value_digits; + integer_val, scap_type=exponent; + integer_val, scap_type=currency_code; + unit_type_list, scap_type=subscription_id; + integer_val, scap_type=additional_subscription_id; + subsription_id_type_val, scap_type=subscription_id_type; + unichar_val, scap_type=subscription_id_data; + integer_val, scap_type=event_timestamp; + integer_val, scap_type=accounting_record_number; + integer_val, scap_type=result_code; + integer_val, scap_type=accounting_interim_interval; + integer_val, scap_type=origin_state_id)" + } + + +type set of service_unit_t service_unit_list; + + +type union scap_value { + octetstring string_val, + scap_unit_type_enum unit_type_val, + unit_value_list unit_type_list, + service_unit_list f_service_unit_list, + scap_subsription_id_type_enum subscription_id_type_val, + INT32 integer_val, + charstring unichar_val, + charstring charstring_val +} + + +type record scap_subattr_t { + scap_type_enum scap_type, + UINT8 scap_length, + scap_value scap_val +} with { + variant (scap_length) "LENGTHTO(scap_type, scap_length, scap_val)"; + variant (scap_val) "CROSSTAG( + f_service_unit_list, scap_type=requested_service_unit; + f_service_unit_list, scap_type=used_service_unit; + f_service_unit_list, scap_type=granted_service_unit; + unit_type_val, scap_type=unit_type; + unit_type_list, scap_type=unit_value; + integer_val, scap_type=value_digits; + integer_val, scap_type=exponent; + integer_val, scap_type=currency_code; + f_service_unit_list, scap_type=subscription_id; + integer_val, scap_type=additional_subscription_id; + subscription_id_type_val, scap_type=subscription_id_type; + unichar_val, scap_type=subscription_id_data; + integer_val, scap_type=event_timestamp; + integer_val, scap_type=accounting_record_number; + integer_val, scap_type=result_code; + integer_val, scap_type=accounting_interim_interval; + integer_val, scap_type=origin_state_id; + charstring_val, scap_type=suggested_primary_rulespace; + charstring_val, scap_type=suggested_secondary_rulespace)" + } + +type set of scap_subattr_t scap_subattr_list; + diff --git a/src/Smartedge.rdf b/src/Smartedge.rdf new file mode 100644 index 0000000000000000000000000000000000000000..70b9489909f1213e9a32f401b24a3d127086d027 --- /dev/null +++ b/src/Smartedge.rdf @@ -0,0 +1,138 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Smartedge.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: +// +// + +// Vendor: smartedge (2352) + +type record smartedge_type +{ + smartedge_type_enum f_smartedge_type, + UINT8 attrib_length_spec, + vendor_specific_value string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_smartedge_type, attrib_length_spec, string_val)" + variant (string_val) "CROSSTAG( + integer_val, { f_smartedge_type=rb_medium_type, + f_smartedge_type=rb_nas_real_port, + f_smartedge_type=rb_platform_type, + f_smartedge_type=rb_service_error_cause, + f_smartedge_type=rb_mcast_maxgroups, + f_smartedge_type=rb_mcast_send, + f_smartedge_type=rb_mcast_receive, + f_smartedge_type=rb_acct_reason, + f_smartedge_type=rb_acct_mcast_in_packets, + f_smartedge_type=rb_acct_mcast_out_packets, + f_smartedge_type=rb_session_error_code, + f_smartedge_type=rb_acct_mcast_in_octets, + f_smartedge_type=rb_acct_mcast_out_octets, + f_smartedge_type=rb_dhcp_max_leases, + f_smartedge_type=rb_offload_indication, + f_smartedge_type=rb_vcpe_id + }; + integer64_val, { f_smartedge_type=rb_acct_input_octets_64, + f_smartedge_type=rb_acct_output_octets_64, + f_smartedge_type=rb_acct_input_packets_64, + f_smartedge_type=rb_acct_output_packets_64, + f_smartedge_type=rb_acct_mcast_in_octets_64, + f_smartedge_type=rb_acct_mcast_out_octets_64, + f_smartedge_type=rb_acct_mcast_in_packets_64, + f_smartedge_type=rb_acct_mcast_out_packets_64 + }; + tagged_integer, f_smartedge_type=rb_service_options; + tagged_text, { f_smartedge_type=rb_deactivate_service_name, + f_smartedge_type=rb_service_name, + f_smartedge_type=rb_service_parameter}; + + string_val, OTHERWISE + )" +} + +type set of smartedge_type smartedge_subattr_list; + +type enum_8 smartedge_type_enum +{ + rb_dhcp_max_leases (3), + rb_context_name (4), + rb_mcast_send (33), + rb_mcast_receive (34), + rb_mcast_maxgroups (35), + rb_medium_type (38), + rb_nas_real_port (62), + rb_pppoe_ip_route_add (71), + rb_qos_policing_profile_name (87), + rb_qos_metering_profile_name (88), + rb_qos_queuing_profile_name (89), + rb_igmp_service_profile_name (90), + rb_forward_policy (92), + rb_agent_remote_id (96), + rb_agent_circuit_id (97), + rb_platform_type (98), + rb_atm_profile_name (101), + rb_nat_profile_name (105), + rb_http_redirect_profile_name (107), + rb_os_version (112), + rb_session_traffic_limit (113), + + rb_acct_input_octets_64 (128), + rb_acct_output_octets_64 (129), + rb_acct_input_packets_64 (130), + rb_acct_output_packets_64 (131), + rb_assigned_ip_address (132), + rb_acct_mcast_in_octets_64 (133), + rb_acct_mcast_out_octets_64 (134), + rb_acct_mcast_in_packets_64 (135), + rb_acct_mcast_out_packets_64 (136), + + rb_session_error_code (142), + rb_session_msg (143), + + rb_acct_reason (144), + rb_mac_address (145), + rb_acct_mcast_in_octets (147), + rb_acct_mcast_out_octets (148), + rb_acct_mcast_in_packets (149), + rb_acct_mcast_out_packets (150), + + rb_qos_rate_inbound (156), + rb_qos_rate_outbound (157), + rb_http_redirect_url (165), + rb_service_name (190), + rb_service_options (191), + rb_service_parameter (192), + rb_service_error_cause (193), + rb_deactivate_service_name (194), + rb_dynamic_qos_param (196), + rb_reauth_service_name (204), + rb_ipv6_dns (207), + rb_ipv6_profile (209), + + rb_offload_indication (224), + rb_gtp_tunnel_data (225), + + rb_vcpe_id (232), + rb_vcpe_profile (233), + rb_vcpe_transport_policy (234), + rb_vcpe_device_policy (235), + rb_vcpe_mac_ip_pair (236) +} diff --git a/src/TunnelAuthentication_IETF_RFC2868.rdf b/src/TunnelAuthentication_IETF_RFC2868.rdf new file mode 100644 index 0000000000000000000000000000000000000000..748bdcfd43a3fc0a1cb196f9af06952147c61a8c --- /dev/null +++ b/src/TunnelAuthentication_IETF_RFC2868.rdf @@ -0,0 +1,166 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: TunnelAuthenticationIETF_RFC2868.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2868(RADIUS Attributes for Tunnel Protocol Support) +// +// +// + + +// APPLICATION-NAME: Auth +// APPLICATION-REVISION: RFC2868 + + +type enum_24 Tunnel_Type_Value +{ + PPTP (1), + L2F (2), + L2TP (3), + ATMP (4), + VTP (5), + AH (6), + IP_IP (7), + MIN_IP_IP (8), + ESP (9), + GRE (10), + DVS (11), + IP_IP_Tunneling (12) +} + +// RFC 2868 +// Attrib: Tunnel-Type (64) +type record Tunnel_Type +{ + OCTET1 Tag, + Tunnel_Type_Value Value +} + + +type enum_24 Tunnel_Medium_Type_Value +{ + IPv4 (1), + IPv6 (2), + NSAP (3), + HDLC (4), + BBN_1822 (5), + media_plus_Ethernet_802 (6), + Epoint163 (7), + Epoint164 (8), + Fpoint69 (9), + Xpoint121 (10), + IPX (11), + Appletalk (12), + Decnet_IV (13), + Banyan_Vines (14), + Epoint164_with_NSAP_subaddress (15) +} + + +// RFC 2868 +// Attrib: Tunnel-Medium-Type (65) +type record Tunnel_Medium_Type +{ + OCTET1 Tag, + Tunnel_Medium_Type_Value Value +} + + +// RFC 2868 +// Attrib: Tunnel-Client-Endpoint (66) +type record Tunnel_Client_Endpoint +{ + OCTET1 Tag, + Attrib_String String +} + +// RFC 2868 +// Attrib: Tunnel-Server-Endpoint (67) +type record Tunnel_Server_Endpoint +{ + OCTET1 Tag, + Attrib_String String +} + +type union Tunnel_Password_String{ + Tunnel_Password_String_Encrypted encrypted_passwd, + Tunnel_Password_String_Plaintext plain_text_passwd +} + +type octetstring Tunnel_Password_String_Encrypted + +type record Tunnel_Password_String_Plaintext +{ + UINT8 Data_Length, + Attrib_String Password, + octetstring Padding_Sub_Field +} with { + variant (Data_Length) "LENGTHTO(Password)" +} + +// RFC 2868 +// Attrib: Tunnel-Password (69) +type record Tunnel_Password +{ + OCTET1 Tag, + OCTET2 Salt, + Tunnel_Password_String String +} + +// RFC 2868 +// Attrib: Tunnel-Private-Group-ID (81) +type record Tunnel_Private_Group_ID +{ + OCTET1 Tag, + Attrib_String String +} + +// RFC 2868 +// Attrib: Tunnel-Assignment-ID (82) +type record Tunnel_Assignment_ID +{ + OCTET1 Tag, + Attrib_String String +} + +// RFC 2868 +// Attrib: Tunnel-Preference (83) +type record Tunnel_Preference +{ + OCTET1 Tag, + UINT24 Value +} + +// RFC 2868 +// Attrib: Tunnel-Client-Auth-ID (90) +type record Tunnel_Client_Auth_ID +{ + OCTET1 Tag, + Attrib_String String +} + +// RFC 2868 +// Attrib: Tunnel-Server-Auth-ID (91) +type record Tunnel_Server_Auth_ID +{ + OCTET1 Tag, + Attrib_String String +} + diff --git a/src/Vendor.rdf b/src/Vendor.rdf new file mode 100644 index 0000000000000000000000000000000000000000..925e80c8fa11d9f15cd1988ea3bd2b450d39ac9b --- /dev/null +++ b/src/Vendor.rdf @@ -0,0 +1,326 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Vendor.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: +// +// + +// Vendor: ericsson (193) + +type enum_8 ericsson_type_enum +{ + product_profile (1), + digest_response (14), + digest_attributes (15), + pmk (17), + layer_identity (34), + major_protocol_version (35), + minor_protocol_version (36), + ipt_timestamp (126), + master_session_id (200), + message_from_sn (202), + requested_url (203), + authorization_result_code (204), + cds_uid (205), + msisdn (206), + authentication_type (207), + timestamp_created (208), + timestamp_used (209), + access_type (210), + requested_service_id (211), + user_alias (212), + service_session_id (213) +} + +type record ericsson_type +{ + ericsson_type_enum f_ericsson_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_ericsson_type, attrib_length_spec, string_val)" + } + +type set of ericsson_type ericsson_subattr_list; + +// Vendor: acc (5) +type enum_8 acc_type_enum +{ + acc_error_message (1), + acc_ccp_option (2), + acc_customer_id (6), + acc_tunnel_secret (14), + acc_service_profile (17), + acc_request_type (18), + acc_dns_server_pri (23), + acc_dns_server_sec (24), + acc_nbns_server_pri (25), + acc_nbns_server_sec (26), + acc_dial_port_index (27), + acc_mn_ha_shared_secret (73), + acc_mip_spi (74) +} + +type record acc_type +{ + acc_type_enum f_acc_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_acc_type, attrib_length_spec, string_val)" + } + +type set of acc_type acc_subattr_list; + +// Vendor: microsoft (311) + +type enum_8 microsoft_type_enum +{ + microsoft_chap_mppe_keys (12), + microsoft_mppe_send_key (16), + microsoft_mppe_recv_key (17), + microsoft_primary_dns_server (28), + microsoft_secondary_dns_server (29), + microsoft_primary_nbns_server (30), + microsoft_secondary_nbns_server (31) +} + +type record microsoft_type +{ + microsoft_type_enum f_microsoft_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_microsoft_type, attrib_length_spec, string_val)" + } + +type set of microsoft_type microsoft_subattr_list; + +// Vendor: cdma2000 (5535) + +type enum_8 cdma2000_type_enum +{ + ike_pre_shared_secret_request (1), + security_level (2), + pre_shared_secret (3), + reverse_tunnel_specification (4), + differentiated_services_class (5), + container (6), + home_agent (7), + key_id (8), + pcf_ip_addr (9), + bs_msc_addr (10), + userid (11), + forward_mux (12), + reverse_mux (13), + forward_fundamental_rate (14), + reverse_fundamental_rate (15), + service_option (16), + forward_traffic_type (17), + reverse_traffic_type (18), + fundamental_frame_size (19), + forward_fundamental_rc (20), + reverse_fundamental_rc (21), + ip_technology (22), + compulsory_tunnel_indicator (23), + release_indicator (24), + bad_frame_count (25), + num_active (30), + sdb_input_octects (31), + sdb_output_octects (32), + numsdb_input (33), + numsdb_output (34), + ip_QoS (36), + air_QoS (39), + airlink_record_type (40), + rp_session_id (41), + airlink_secuence_number (42), + num_bytes_received_total (43), + + correlation_id (44), + mo_mt_indicator (45), + mobile_ip_sig_inbound_count (46), + mobile_ip_sig_outbound_count (47), + session_cont (48), + active_time (49), + dcch_frame_format (50), + ESN (52), + s_key (54), + s_request (55), + s_lifetime (56), + mn_ha_shared_secret_request (57), + mn_ha_shared_secret (58), + remote_ipv4_address (59), + hrpd_access_authentication (60), + + remote_ipv6_address (70), + remote_address_table_index (71), + remote_address_octet_count (72), + always_on (78), + last_user_activity_time (80), + + session_termination_capability (88), + prepaid_accounting_quota (90), + prepaid_accounting_capability (91), + mip_rrq_lifetime (92), + service_reference_id (94), + disconnect_reason (96), + cdma2000_error_cause (255) // WARNING: temporary type number, not yet standardized 2003-06-17 tmptso +} + +type record cdma2000_type +{ + cdma2000_type_enum f_cdma2000_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_cdma2000_type, attrib_length_spec,string_val)" + } + +type set of cdma2000_type cdma2000_subattr_list; + +// Vendor: threegpp (10415) + +type enum_8 threegpp_type_enum +{ + threegpp_imsi (1), + threegpp_charging_id (2), + threegpp_pdp_type (3), + threegpp_charging_gateway_address (4), + threegpp_gprs_negotiated_qos_profile (5), + threegpp_sgsn_ip_address (6), + threegpp_ggsn_ip_address (7), + threegpp_imsi_mcc_mnc (8), + threegpp_ggsn_mcc_mnc (9), + threegpp_nsapi (10), + threegpp_session_stop_indicator (11), + threegpp_selection_mode (12), + threegpp_charging_characteristics (13), + threegpp_cg_ipv6_address (14), + threegpp_sgsn_ipv6_address (15), + threegpp_ggsn_ipv6_address (16), + threegpp_ipv6_dns_servers (17), + threegpp_sgsn_mcc_mnc (18), + threegpp_teardown_indicator (19), + threegpp_imeisv (20), + threegpp_rat_type (21), + threegpp_user_location_info (22), + threegpp_ms_timezone (23), + threegpp_camel_charging_info (24), + threegpp_packet_filter (25), + threegpp_negotiated_dscp (26), + threegpp_allocate_ip_type (27), + threegpp_chargeable_user_identity (89) // FIXME no standard reference available ETIBSZA +} + + +type record threegpp_type +{ + threegpp_type_enum f_threegpp_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_threegpp_type, attrib_length_spec, string_val)" + } + +type set of threegpp_type threegpp_subattr_list; + +// Vendor: servicefactory (5556) + +type enum_8 servicefactory_type_enum +{ + servicefactory_product_profile_id (1), + servicefactory_access_point_id (7), + servicefactory_apn (14) // FIXME no standard reference available ETIBSZA +} + +type record servicefactory_type +{ + servicefactory_type_enum f_servicefactory_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_servicefactory_type, attrib_length_spec, string_val)" + } + +type set of servicefactory_type servicefactory_subattr_list; + +// Vendor: adslforum (3561) + +type enum_8 adslforum_type_enum +{ + adslforum_agent_circuit_id (1) +} + + +type record adslforum_type +{ + adslforum_type_enum f_adslforum_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_adslforum_type, attrib_length_spec, string_val)" + } + +type set of adslforum_type adslforum_subattr_list; + +// Vendor: wispr (14122) +type enum_8 wispr_type_enum +{ + wispr_location_id (1), + wispr_location_name(2) +} + + +type record wispr_type +{ + wispr_type_enum f_wispr_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_wispr_type, attrib_length_spec, string_val)" + } + +type set of wispr_type wispr_subattr_list; + + +// Vendor: chinatel (20942) + +type enum_8 chinatel_type_enum +{ + chinatel_served_mdn (100) +} + + +type record chinatel_type +{ + chinatel_type_enum f_chinatel_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_chinatel_type, attrib_length_spec, string_val)" + } + +type set of chinatel_type chinatel_subattr_list; + + + + diff --git a/src/Vendor_detailed_ericsson.rdf b/src/Vendor_detailed_ericsson.rdf new file mode 100644 index 0000000000000000000000000000000000000000..d7b033ff1b5028b8e28f6aa144b63bc21dc3a141 --- /dev/null +++ b/src/Vendor_detailed_ericsson.rdf @@ -0,0 +1,334 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: Vendor_detailed_ericcson.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: +// +// + +// Vendor: ericsson (193) + + +type enum_8 ericsson_type_enum +{ + product_profile (1), + digest_response (14), + digest_attributes (15), + pmk (17), + layer_identity (34), + major_protocol_version (35), + minor_protocol_version (36), + ipt_timestamp (126), + master_session_id (200), + message_from_sn (202), + requested_url (203), + authorization_result_code (204), + cds_uid (205), + msisdn (206), + authentication_type (207), + timestamp_created (208), + timestamp_used (209), + access_type (210), + requested_service_id (211), + user_alias (212), + service_session_id (213), + offload_indication (225), + gtp_tunnel_data (226), + gtpv1_tunnel_data (227) +} + +type record ericsson_type +{ + ericsson_type_enum f_ericsson_type, + UINT8 attrib_length_spec, + vendor_specific_value string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_ericsson_type, attrib_length_spec, string_val)" + variant (string_val) "CROSSTAG( + integer_val, f_ericsson_type=offload_indication; + string_val, OTHERWISE + )" + } + +type set of ericsson_type ericsson_subattr_list; + +// Vendor: acc (5) +type enum_8 acc_type_enum +{ + acc_error_message (1), + acc_ccp_option (2), + acc_customer_id (6), + acc_tunnel_secret (14), + acc_service_profile (17), + acc_request_type (18), + acc_dns_server_pri (23), + acc_dns_server_sec (24), + acc_nbns_server_pri (25), + acc_nbns_server_sec (26), + acc_dial_port_index (27), + acc_mn_ha_shared_secret (73), + acc_mip_spi (74) +} + +type record acc_type +{ + acc_type_enum f_acc_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_acc_type, attrib_length_spec, string_val)" + } + +type set of acc_type acc_subattr_list; + +// Vendor: microsoft (311) + +type enum_8 microsoft_type_enum +{ + microsoft_chap_mppe_keys (12), + microsoft_mppe_send_key (16), + microsoft_mppe_recv_key (17), + microsoft_primary_dns_server (28), + microsoft_secondary_dns_server (29), + microsoft_primary_nbns_server (30), + microsoft_secondary_nbns_server (31) +} + +type record microsoft_type +{ + microsoft_type_enum f_microsoft_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_microsoft_type, attrib_length_spec, string_val)" + } + +type set of microsoft_type microsoft_subattr_list; + +// Vendor: cdma2000 (5535) + +type enum_8 cdma2000_type_enum +{ + ike_pre_shared_secret_request (1), + security_level (2), + pre_shared_secret (3), + reverse_tunnel_specification (4), + differentiated_services_class (5), + container (6), + home_agent (7), + key_id (8), + pcf_ip_addr (9), + bs_msc_addr (10), + userid (11), + forward_mux (12), + reverse_mux (13), + forward_fundamental_rate (14), + reverse_fundamental_rate (15), + service_option (16), + forward_traffic_type (17), + reverse_traffic_type (18), + fundamental_frame_size (19), + forward_fundamental_rc (20), + reverse_fundamental_rc (21), + ip_technology (22), + compulsory_tunnel_indicator (23), + release_indicator (24), + bad_frame_count (25), + num_active (30), + sdb_input_octects (31), + sdb_output_octects (32), + numsdb_input (33), + numsdb_output (34), + ip_QoS (36), + air_QoS (39), + airlink_record_type (40), + rp_session_id (41), + airlink_secuence_number (42), + num_bytes_received_total (43), + + correlation_id (44), + mo_mt_indicator (45), + mobile_ip_sig_inbound_count (46), + mobile_ip_sig_outbound_count (47), + session_cont (48), + active_time (49), + dcch_frame_format (50), + ESN (52), + s_key (54), + s_request (55), + s_lifetime (56), + mn_ha_shared_secret_request (57), + mn_ha_shared_secret (58), + remote_ipv4_address (59), + hrpd_access_authentication (60), + + remote_ipv6_address (70), + remote_address_table_index (71), + remote_address_octet_count (72), + always_on (78), + last_user_activity_time (80), + + session_termination_capability (88), + prepaid_accounting_quota (90), + prepaid_accounting_capability (91), + mip_rrq_lifetime (92), + service_reference_id (94), + disconnect_reason (96), + cdma2000_error_cause (255) // WARNING: temporary type number, not yet standardized 2003-06-17 tmptso +} + +type record cdma2000_type +{ + cdma2000_type_enum f_cdma2000_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_cdma2000_type, attrib_length_spec,string_val)" + } + +type set of cdma2000_type cdma2000_subattr_list; + +// Vendor: threegpp (10415) + +type enum_8 threegpp_type_enum +{ + threegpp_imsi (1), + threegpp_charging_id (2), + threegpp_pdp_type (3), + threegpp_charging_gateway_address (4), + threegpp_gprs_negotiated_qos_profile (5), + threegpp_sgsn_ip_address (6), + threegpp_ggsn_ip_address (7), + threegpp_imsi_mcc_mnc (8), + threegpp_ggsn_mcc_mnc (9), + threegpp_nsapi (10), + threegpp_session_stop_indicator (11), + threegpp_selection_mode (12), + threegpp_charging_characteristics (13), + threegpp_cg_ipv6_address (14), + threegpp_sgsn_ipv6_address (15), + threegpp_ggsn_ipv6_address (16), + threegpp_ipv6_dns_servers (17), + threegpp_sgsn_mcc_mnc (18), + threegpp_teardown_indicator (19), + threegpp_imeisv (20), + threegpp_rat_type (21), + threegpp_user_location_info (22), + threegpp_ms_timezone (23), + threegpp_camel_charging_info (24), + threegpp_packet_filter (25), + threegpp_negotiated_dscp (26), + threegpp_allocate_ip_type (27), + threegpp_chargeable_user_identity (89) // FIXME no standard reference available ETIBSZA +} + + +type record threegpp_type +{ + threegpp_type_enum f_threegpp_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_threegpp_type, attrib_length_spec, string_val)" + } + +type set of threegpp_type threegpp_subattr_list; + +// Vendor: servicefactory (5556) + +type enum_8 servicefactory_type_enum +{ + servicefactory_product_profile_id (1), + servicefactory_access_point_id (7), + servicefactory_apn (14) // FIXME no standard reference available ETIBSZA +} + +type record servicefactory_type +{ + servicefactory_type_enum f_servicefactory_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_servicefactory_type, attrib_length_spec, string_val)" + } + +type set of servicefactory_type servicefactory_subattr_list; + +// Vendor: adslforum (3561) + +type enum_8 adslforum_type_enum +{ + adslforum_agent_circuit_id (1) +} + + +type record adslforum_type +{ + adslforum_type_enum f_adslforum_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_adslforum_type, attrib_length_spec, string_val)" + } + +type set of adslforum_type adslforum_subattr_list; + +// Vendor: wispr (14122) +type enum_8 wispr_type_enum +{ + wispr_location_id (1), + wispr_location_name(2) +} + + +type record wispr_type +{ + wispr_type_enum f_wispr_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_wispr_type, attrib_length_spec, string_val)" + } + +type set of wispr_type wispr_subattr_list; + + +// Vendor: chinatel (20942) + +type enum_8 chinatel_type_enum +{ + chinatel_served_mdn (100) +} + + +type record chinatel_type +{ + chinatel_type_enum f_chinatel_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_chinatel_type, attrib_length_spec, string_val)" + } + +type set of chinatel_type chinatel_subattr_list; + + + + diff --git a/src/obsolete/RadiusAccountingAttributes.rdf b/src/obsolete/RadiusAccountingAttributes.rdf new file mode 100644 index 0000000000000000000000000000000000000000..fdcb867cfd993a8233dd0888fd0f09676a7cd4a9 --- /dev/null +++ b/src/obsolete/RadiusAccountingAttributes.rdf @@ -0,0 +1,114 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: RadiusAccountingAttributes.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2866(RADIUS Accounting) +// +// +// + + +// APPLICATION-NAME: Acc + + +// Packet-Type: Accounting_Request (4) + +// Packet-Type: Accounting_Response (5) + + +// RFC 2866 +// Attrib: Acct-Status-Type (40) +type enumerated Acct_Status_Type +{ + Start (1), + Stop (2), + Interim_Update (3), + Accounting_On (7), + Accounting_Off (8) +} + +// RFC 2866 +// Attrib: Acct-Delay-Type (41) +type Attrib_Value Acct_Delay_Type; + +// RFC 2866 +// Attrib: Acct-Input-Octets (42) +type Attrib_Value Acct_Input_Octets; + +// RFC 2866 +// Attrib: Acct-Output-Octets (43) +type Attrib_Value Acct_Output_Octets; + +// RFC 2866 +// Attrib: Acct-Session-Id (44) +type Attrib_Text Acct_Session_Id; + +// RFC 2866 +// Attrib: Acct-Authentic (45) +type enumerated Acct_Authentic +{ + RADIUS (1), + Local (2), + Remote (3) +} + +// RFC 2866 +// Attrib: Acct-Session-Time (46) +type Attrib_Value Acct_Session_Time; + +// RFC 2866 +// Attrib: Acct-Input-Packets (47) +type Attrib_Value Acct_Input_Packets; + +// RFC 2866 +// Attrib: Acct-Output-Packets (48) +type Attrib_Value Acct_Output_Packets; + +// RFC 2866 +// Attrib: Acct-Terminate-Cause (49) +type enumerated Acct_Terminate_Cause +{ + User_Request (1), + Lost_Carrier (2), + Lost_Service (3), + Idle_Timeout (4), + Session_Timeout (5), + Admin_Reset (6), + Admin_Reboot (7), + Port_Error (8), + NAS_Error (9), + NAS_Request (10), + NAS_Reboot (11), + Port_Unneeded (12), + Port_Preempted (13), + Port_Suspended (14), + Service_Unavailable (15), + Callback (16), + User_Error (17), + Host_Request (18) +} + +// RFC 2866 +// Attrib: Acct-Multi-Session-Id (50) +type Attrib_String Acct_Multi_Session_Id; + +// RFC 2866 +// Attrib: Acct-Link-Count (51) +type Attrib_Value Acct_Link_Count; diff --git a/src/obsolete/RadiusAndIPv6.rdf b/src/obsolete/RadiusAndIPv6.rdf new file mode 100644 index 0000000000000000000000000000000000000000..e246e2f656cabc3d617d65a838f7ae4466e26da8 --- /dev/null +++ b/src/obsolete/RadiusAndIPv6.rdf @@ -0,0 +1,63 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: RadiusAndIPv6.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 3162(RADIUS and IPv6) +// +// +// + + +// APPLICATION-NAME: IPv6 + +// RFC 3162 +// Attrib: NAS-IPv6-Address (95) +type OCTET16 NAS_IPv6_Address; + +// RFC 3162 +// Attrib: Framed-Interface-Id (96) +type OCTET8 Framed_Interface_Id; + +// RFC 3162 +// Attrib: Framed-IPv6-Prefix (97) +type record Framed_IPv6_Prefix +{ + OCTET1 reserved, + UINT8 prefix_length, + bitstring prefixValue, + bitstring prefixPadding +} with { + variant (prefix_length) "LENGTHTO(prefixValue)"; + variant (prefix_length) "UNIT(bits)"; + variant (prefixValue) "BYTEORDER(last)"; + variant "FIELDORDER(msb)"; + } + +// RFC 3162 +// Attrib: Login-IPv6-Host (98) +type OCTET16 Login_IPv6_Host; + +// RFC 3162 +// Attrib: Framed-IPv6-Route (99) +type Attrib_Text Framed_IPv6_Route; + +// RFC 3162 +// Attrib: Framed-IPv6-Pool (100) +type Attrib_String Framed_IPv6_Pool; diff --git a/src/obsolete/RadiusAuthExtensions.rdf b/src/obsolete/RadiusAuthExtensions.rdf new file mode 100644 index 0000000000000000000000000000000000000000..dacbc1666a0d87dc9f75bb7eebcd6beca9ece2b2 --- /dev/null +++ b/src/obsolete/RadiusAuthExtensions.rdf @@ -0,0 +1,63 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: RadiusAuthExtensions.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 3576(RADIUS Authorization Extensions) +// +// +// + + +// APPLICATION-NAME: AuthExt + + +// Packet-Type: Disconnect-Request (40) + +// Packet-Type: Disconnect-ACK (41) + +// Packet-Type: Disconnect-NAK (42) + +// Packet-Type: CoA-Request (43) + +// Packet-Type: CoA-ACK (44) + +// Packet-Type: CoA-NAK (45) + + +// RFC 3576 +// Attrib: Error-Cause (101) +type enumerated Error_Cause +{ + Residual_Session_Context_Removed (201), + Invalid_EAP_Packet (202), + Unsupported_Attribute (401), + Missing_Attribute (402), + NAS_Identification_Mismatch (403), + Invalid_Request (404), + Unsupported_Service (405), + Unsupported_Extension (406), + Administratively_Prohibited (501), + Request_Not_Routable_Proxy (502), + Session_Context_Not_Found (503), + Session_Context_Not_Removable (504), + Other_Proxy_Processing_Error (505), + Resources_Unavailable (506), + Request_Initiated (507) +} diff --git a/src/obsolete/RadiusBaseAttributes.rdf b/src/obsolete/RadiusBaseAttributes.rdf new file mode 100644 index 0000000000000000000000000000000000000000..0de05623080be5184d20e45b0b95dc2e56f715b1 --- /dev/null +++ b/src/obsolete/RadiusBaseAttributes.rdf @@ -0,0 +1,772 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: RadiusBaseAttributes.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2865(RADIUS) +// +// +// + + +// APPLICATION-NAME: Base + + + +// Packet-Type: Access-Request (1) + +// Packet-Type: Access_Accept (2) + +// Packet-Type: Access_Reject (3) + +// Packet-Type: Accounting_Request (4) + +// Packet-Type: Accounting_Response (5) + +// Packet-Type: Access_Challenge (11) + +// Packet-Type: Status_Server (12) + +// Packet-Type: Status_Client (13) + +// Packet-Type: Reserved (255) + + + + +// RFC 2865 +// Attrib: User-Name (1) +type Attrib_String User_Name; + +// RFC 2865 +// Attrib: User-Password (2) +type Attrib_String User_Password; + +// RFC 2865 +// Attrib: CHAP-Password (3) +type record CHAP_Password +{ + UINT8 CHAP_Ident, + Attrib_String String length(16) +} + +// RFC 2865 +// Attrib: NAS-IP-Address (4) +type Attrib_Address NAS_IP_Address; + +// RFC 2865 +// Attrib: NAS-Port (5) +type Attrib_Value NAS_Port; + +// RFC 2865 +// Attrib: Service-Type (6) +type enumerated Service_Type +{ + Login (1), + Framed (2), + Callback_Login (3), + Callback_Framed (4), + Outbound (5), + Administrative (6), + NAS_Prompt (7), + Authenticate_Only (8), + Callback_NAS_Prompt (9), + Call_Check (10), + Callback_Administrative (11) +} + + +// RFC 2865 +// Attrib: Framed-Protocol (7) +type enumerated Framed_Protocol +{ + PPP (1), + SLIP (2), + Appletalk_Remote_Access_Protocol (3), + Gandalf_proprietary_protocol (4), + Xylogics_proprietary (5), + Xpoint75_Syncronous (6), + GPRS_PDP_Context (7) +} + + +// RFC 2865 +// Attrib: Framed-IP-Address (8) +type Attrib_Address Framed_IP_Address; + +// RFC 2865 +// Attrib: Framed-IP-Netmask (9) +type Attrib_Address Framed_IP_Netmask; + +// RFC 2865 +// Attrib: Framed-Routing (10) +type enumerated Framed_Routing +{ + None (0), + Send_routing_pacets (1), + Listen_for_routing_pacets (2), + Send_and_Listen (3) +} + +// RFC 2865 +// Attrib: Filter-Id (11) +type Attrib_Text Filter_Id; + +// RFC 2865 +// Attrib: Framed-MTU (12) +type Attrib_Value Framed_MTU (64..65535); + +// RFC 2865 +// Attrib: Framed-Compression (13) +type enumerated Framed_Compression +{ + None (0), + VJ_TCP_IP_header_compression (1), + IPX_header_compression (2), + STAC_LZS_compression (3) +} + +// RFC 2865 +// Attrib: Login-IP-Host (14) +type Attrib_Address Login_IP_Host; + +// RFC 2865 +// Attrib: Login-Service (15) +type enumerated Login_Service +{ + Telnet (0), + Rlogin (1), + TCP_Clear (2), + Port_Master (3), + LAT (4), + X25_PAD (5), + X25_T3POS (6), + TCP_Clear_Quiet (7) +} + +// RFC 2865 +// Attrib: Login-TCP-Port (16) +type Attrib_Value Login_TCP_Port (0..65535); + +// RFC 2865 +// Attrib: Reply-Message (18) +type Attrib_Text Reply_Message; + +// RFC 2865 +// Attrib: Callback-Number (19) +type Attrib_String Callback_Number; + +// RFC 2865 +// Attrib: Callback-Id (20) +type Attrib_String Callback_Id; + +// RFC 2865 +// Attrib: Framed-Route (22) +type Attrib_Text Framed_Route; + +// RFC 2865 +// Attrib: Framed-IPX-Network (23) +type Attrib_Value Framed_IPX_Network; + +// RFC 2865 +// Attrib: State (24) +type Attrib_String State; + +// RFC 2865 +// Attrib: Class (25) +type Attrib_String Class; + + +// RFC 2865 +// Attrib: Session-Timeout (27) +type Attrib_Value Session_Timeout; + +// RFC 2865 +// Attrib: Idle-Timeout (28) +type Attrib_Value Idle_Timeout; + +// RFC 2865 +// Attrib: Termination-Action (29) +type enumerated Termination_Action +{ + Default (0), + RADIUS_Request (1) +} + +// RFC 2865 +// Attrib: Called-Station-Id (30) +type Attrib_String Called_Station_Id; + +// RFC 2865 +// Attrib: Calling-Station-Id (31) +type Attrib_String Calling_Station_Id; + +// RFC 2865 +// Attrib: NAS-Identifier (32) +type Attrib_String NAS_Identifier; + +// RFC 2865 +// Attrib: Proxy-State (33) +type Attrib_String Proxy_State; + +// RFC 2865 +// Attrib: Login-LAT-Service (34) +type Attrib_String Login_LAT_Service; + +// RFC 2865 +// Attrib: Login-LAT-Node (35) +type Attrib_String Login_LAT_Node; + +// RFC 2865 +// Attrib: Login-LAT-Group (36) +type Attrib_String Login_LAT_Group; + +// RFC 2865 +// Attrib: Framed-AppleTalk-Link (37) +type Attrib_Value Framed_AppleTalk_Link (0..65535); + +// RFC 2865 +// Attrib: Framed-AppleTalk-Network (38) +type Attrib_Value Framed_AppleTalk_Network (0..65535); + +// RFC 2865 +// Attrib: Framed-AppleTalk-Zone (39) +type Attrib_String Framed_AppleTalk_Zone; + +// RFC 2865 +// Attrib: CHAP-Challenge (60) +type Attrib_String CHAP_Challenge; + +// RFC 2865 +// Attrib: NAS-Port-Type (61) +type enumerated NAS_Port_Type +{ + Async (0), + Sync (1), + ISDN_Sync (2), + ISDN_Async_v120 (3), + ISDN_Async_v110 (4), + Virtual (5), + PIAFS (6), + HDLC_Clear_Channel (7), + X25 (8), + X75 (9), + G3_Fax (10), + SDSL_Symmetric_DSL (11), + ADSL_CAP_Asymmetric_DSL (12), + ADSL_DMT_Asymmetric_DSL (13), + ISDL_ISDN_Digital_Subscriber_Line (14), + Ethernet (15), + xDSL (16), + Cable (17), + Wireless_Other (18), + Wireless_IEEE_80211 (19) +} + + +// RFC 2865 +// Attrib: Port-Limit (62) +type Attrib_Value Port_Limit; + +// RFC 2865 +// Attrib: Login-LAT-Port (63) +type Attrib_String Login_LAT_Port; + + + +// RFC 2865 +// Attrib: Vendor-Specific (26) +type record Vendor_Specific +{ + vendor_id_enum vendor_id, + string_val_spec attrib_value +} with { + variant (attrib_value) "CROSSTAG(f_scap_subattr_list, vendor_id=scap; + f_acc_subattr_list, vendor_id=acc; + f_cisco_subattr_list, vendor_id=cisco; + f_ericsson_subattr_list, vendor_id=ericsson; + f_microsoft_subattr_list, vendor_id=microsoft; + f_adslforum_subattr_list, vendor_id=adslforum; + f_cdma2000_subattr_list, vendor_id=cdma2000 ; + f_servicefactory_subattr_list, vendor_id=servicefactory; + f_threegpp_subattr_list, vendor_id=threegpp; + f_wispr_subattr_list, vendor_id=wispr)" + } + + +type enum_32 vendor_id_enum +{ + acc (5), + cisco (9), + ericsson (193), + microsoft (311), + adslforum (3561), + cdma2000 (5535), + servicefactory (5556), + threegpp (10415), + scap (10923), + wispr (14122) +} + + +type enum_8 acc_type_enum +{ + acc_error_message (1), + acc_ccp_option (2), + acc_customer_id (6), + acc_tunnel_secret (14), + acc_service_profile (17), + acc_request_type (18), + acc_dns_server_pri (23), + acc_dns_server_sec (24), + acc_nbns_server_pri (25), + acc_nbns_server_sec (26), + acc_dial_port_index (27), + acc_mn_ha_shared_secret (73), + acc_mip_spi (74) +} + + +type enum_8 cisco_type_enum +{ + cisco_access_control_list (1), + cisco_nas_port (2), + cisco_info_service (250), + cisco_service_list (251), + cisco_n_service_info (252), + cisco_byte_count (253) +} + + +type enum_8 ericsson_type_enum +{ + product_profile (1), + digest_response (14), + digest_attributes (15), + pmk (17), + layer_identity (34), + major_protocol_version (35), + minor_protocol_version (36), + ipt_timestamp (126), + master_session_id (200), + message_from_sn (202), + requested_url (203), + authorization_result_code (204), + cds_uid (205), + msisdn (206), + authentication_type (207), + timestamp_created (208), + timestamp_used (209), + access_type (210), + requested_service_id (211), + user_alias (212), + service_session_id (213) +} + + +type enum_8 cdma2000_type_enum +{ + ike_pre_shared_secret_request (1), + security_level (2), + pre_shared_secret (3), + reverse_tunnel_specification (4), + differentiated_services_class (5), + container (6), + home_agent (7), + key_id (8), + pcf_ip_addr (9), + bs_msc_addr (10), + userid (11), + forward_mux (12), + reverse_mux (13), + forward_fundamental_rate (14), + reverse_fundamental_rate (15), + service_option (16), + forward_traffic_type (17), + reverse_traffic_type (18), + fundamental_frame_size (19), + forward_fundamental_rc (20), + reverse_fundamental_rc (21), + ip_technology (22), + compulsory_tunnel_indicator (23), + release_indicator (24), + bad_frame_count (25), + num_active (30), + sdb_input_octects (31), + sdb_output_octects (32), + numsdb_input (33), + numsdb_output (34), + ip_QoS (36), + air_QoS (39), + airlink_record_type (40), + rp_session_id (41), + airlink_secuence_number (42), + num_bytes_received_total (43), + + correlation_id (44), + mo_mt_indicator (45), + mobile_ip_sig_inbound_count (46), + mobile_ip_sig_outbound_count (47), + session_cont (48), + active_time (49), + dcch_frame_format (50), + ESN (52), + s_key (54), + s_request (55), + s_lifetime (56), + mn_ha_shared_secret_request (57), + mn_ha_shared_secret (58), + remote_ipv4_address (59), + hrpd_access_authentication (60), + + remote_ipv6_address (70), + remote_address_table_index (71), + remote_address_octet_count (72), + always_on (78), + last_user_activity_time (80), + + session_termination_capability (88), + prepaid_accounting_quota (90), + prepaid_accounting_capability (91), + mip_rrq_lifetime (92), + service_reference_id (94), + disconnect_reason (96), + cdma2000_error_cause (255) // WARNING: temporary type number, not yet standardized 2003-06-17 tmptso +} + + +type enum_8 threegpp_type_enum +{ + threegpp_imsi (1), + threegpp_charging_id (2), + threegpp_pdp_type (3), + threegpp_charging_gateway_address (4), + threegpp_gprs_negotiated_qos_profile (5), + threegpp_sgsn_ip_address (6), + threegpp_ggsn_ip_address (7), + threegpp_imsi_mcc_mnc (8), + threegpp_ggsn_mcc_mnc (9), + threegpp_nsapi (10), + threegpp_session_stop_indicator (11), + threegpp_selection_mode (12), + threegpp_charging_characteristics (13), + threegpp_cg_ipv6_address (14), + threegpp_sgsn_ipv6_address (15), + threegpp_ggsn_ipv6_address (16), + threegpp_ipv6_dns_servers (17), + threegpp_sgsn_mcc_mnc (18), + threegpp_teardown_indicator (19), + threegpp_imeisv (20), + threegpp_rat_type (21), + threegpp_user_location_info (22), + threegpp_ms_timezone (23), + threegpp_camel_charging_info (24), + threegpp_packet_filter (25), + threegpp_negotiated_dscp (26), + threegpp_chargeable_user_identity (89) // FIXME no standard reference available ETIBSZA +} + + +type enum_8 servicefactory_type_enum +{ + servicefactory_product_profile_id (1), + servicefactory_access_point_id (7), + servicefactory_apn (14) // FIXME no standard reference available ETIBSZA +} + + +type enum_8 microsoft_type_enum +{ + microsoft_chap_mppe_keys (12), + microsoft_mppe_send_key (16), + microsoft_mppe_recv_key (17), + microsoft_primary_dns_server (28), + microsoft_secondary_dns_server (29), + microsoft_primary_nbns_server (30), + microsoft_secondary_nbns_server (31) +} + +type enum_8 adslforum_type_enum +{ + adslforum_agent_circuit_id (1) +} + + +type enum_8 wispr_type_enum +{ + wispr_location_id (1), + wispr_location_name(2) +} + +type enum_8 scap_type_enum +{ + requested_service_unit (1), + used_service_unit (2), + granted_service_unit (3), + unit_type (4), + unit_value (5), + value_digits (6), + exponent (7), + currency_code (8), + subscription_id (9), + additional_subscription_id (10), + subscription_id_type (11), + subscription_id_data (12), + event_timestamp (13), + accounting_record_number (14), + result_code (15), + accounting_interim_interval (16), + origin_state_id (17), + suggested_primary_rulespace (30), + suggested_secondary_rulespace (31) +} + + +type enum_8 scap_unit_type_enum { + SERVICE_CREDIT_TIME (0), + SERVICE_CREDIT_VOLUME (1), + SERVICE_CREDIT_EVENT (2), + SERVICE_CREDIT_MONEY (3) +} + + +type enum_8 scap_subsription_id_type_enum { + END_USER_MSISDN (0), + END_USER_IMSI (1), + END_USER_SIP_URL (2), + END_USER_NAI (3), + END_USER_PRIVATE (4) +} + +type record scap_unit_type_t { + scap_type_enum scap_type, + UINT8 scap_length, + INT32 scap_val +} with { + variant (scap_length) "LENGTHTO(scap_type, scap_length, scap_val)" +} + +type set of scap_unit_type_t unit_value_list; + +type union unit_value_t +{ + octetstring string_val, + scap_unit_type_enum unit_type_val, + scap_subsription_id_type_enum subsription_id_type_val, + unit_value_list unit_type_list, + INT32 integer_val, + charstring unichar_val +} + + +type record service_unit_t { + scap_type_enum scap_type, + UINT8 scap_length, + unit_value_t scap_val +} with { + variant (scap_length) "LENGTHTO(scap_type, scap_length, scap_val)"; + variant (scap_val) "CROSSTAG( + unit_type_val, scap_type=unit_type; + unit_type_list, scap_type=unit_value; + integer_val, scap_type=value_digits; + integer_val, scap_type=exponent; + integer_val, scap_type=currency_code; + unit_type_list, scap_type=subscription_id; + integer_val, scap_type=additional_subscription_id; + subsription_id_type_val, scap_type=subscription_id_type; + unichar_val, scap_type=subscription_id_data; + integer_val, scap_type=event_timestamp; + integer_val, scap_type=accounting_record_number; + integer_val, scap_type=result_code; + integer_val, scap_type=accounting_interim_interval; + integer_val, scap_type=origin_state_id)" + } + + +type set of service_unit_t service_unit_list; + + +type union scap_value { + octetstring string_val, + scap_unit_type_enum unit_type_val, + unit_value_list unit_type_list, + service_unit_list f_service_unit_list, + scap_subsription_id_type_enum subscription_id_type_val, + INT32 integer_val, + charstring unichar_val, + charstring charstring_val +} + + +type record scap_subattr_t { + scap_type_enum scap_type, + UINT8 scap_length, + scap_value scap_val +} with { + variant (scap_length) "LENGTHTO(scap_type, scap_length, scap_val)"; + variant (scap_val) "CROSSTAG( + f_service_unit_list, scap_type=requested_service_unit; + f_service_unit_list, scap_type=used_service_unit; + f_service_unit_list, scap_type=granted_service_unit; + unit_type_val, scap_type=unit_type; + unit_type_list, scap_type=unit_value; + integer_val, scap_type=value_digits; + integer_val, scap_type=exponent; + integer_val, scap_type=currency_code; + f_service_unit_list, scap_type=subscription_id; + integer_val, scap_type=additional_subscription_id; + subscription_id_type_val, scap_type=subscription_id_type; + unichar_val, scap_type=subscription_id_data; + integer_val, scap_type=event_timestamp; + integer_val, scap_type=accounting_record_number; + integer_val, scap_type=result_code; + integer_val, scap_type=accounting_interim_interval; + integer_val, scap_type=origin_state_id; + charstring_val, scap_type=suggested_primary_rulespace; + charstring_val, scap_type=suggested_secondary_rulespace)" + } + +type set of scap_subattr_t scap_subattr_list; + + + + + +type record acc_type +{ + acc_type_enum f_acc_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_acc_type, attrib_length_spec, string_val)" + } + +type set of acc_type acc_subattr_list; + +type record cisco_type +{ + cisco_type_enum f_cisco_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_cisco_type, attrib_length_spec, string_val)" + } + +type set of cisco_type cisco_subattr_list; + + +type record ericsson_type +{ + ericsson_type_enum f_ericsson_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_ericsson_type, attrib_length_spec, string_val)" + } + +type set of ericsson_type ericsson_subattr_list; + + +type record cdma2000_type +{ + cdma2000_type_enum f_cdma2000_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_cdma2000_type, attrib_length_spec,string_val)" + } + +type set of cdma2000_type cdma2000_subattr_list; + + +type record threegpp_type +{ + threegpp_type_enum f_threegpp_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_threegpp_type, attrib_length_spec, string_val)" + } + +type set of threegpp_type threegpp_subattr_list; + +type record microsoft_type +{ + microsoft_type_enum f_microsoft_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_microsoft_type, attrib_length_spec, string_val)" + } + +type set of microsoft_type microsoft_subattr_list; + +type record servicefactory_type +{ + servicefactory_type_enum f_servicefactory_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_servicefactory_type, attrib_length_spec, string_val)" + } + +type set of servicefactory_type servicefactory_subattr_list; + +type record adslforum_type +{ + adslforum_type_enum f_adslforum_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_adslforum_type, attrib_length_spec, string_val)" + } + +type set of adslforum_type adslforum_subattr_list; + + +type record wispr_type +{ + wispr_type_enum f_wispr_type, + UINT8 attrib_length_spec, + octetstring string_val +} with { + variant (attrib_length_spec) "LENGTHTO(f_wispr_type, attrib_length_spec, string_val)" + } + +type set of wispr_type wispr_subattr_list; + + + +type union string_val_spec +{ + acc_subattr_list f_acc_subattr_list, + cisco_subattr_list f_cisco_subattr_list, + ericsson_subattr_list f_ericsson_subattr_list, + cdma2000_subattr_list f_cdma2000_subattr_list, + threegpp_subattr_list f_threegpp_subattr_list, + microsoft_subattr_list f_microsoft_subattr_list, + servicefactory_subattr_list f_servicefactory_subattr_list, + adslforum_subattr_list f_adslforum_subattr_list, + wispr_subattr_list f_wispr_subattr_list, + scap_subattr_list f_scap_subattr_list, + octetstring f_string_val +} + + + diff --git a/src/obsolete/RadiusBaseTypes.rdf b/src/obsolete/RadiusBaseTypes.rdf new file mode 100644 index 0000000000000000000000000000000000000000..94a38729282447d7c45e46dab877a9cc633a30a4 --- /dev/null +++ b/src/obsolete/RadiusBaseTypes.rdf @@ -0,0 +1,92 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: RadiusBaseTypes.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2865(RADIUS) +// +// +// + + +// +// External functions for encoding and decoding +// + +external function f_RADIUS_Enc(in PDU_RADIUS pdu) return octetstring; +external function f_RADIUS_Dec(in octetstring stream) return PDU_RADIUS; +external function crypt_password(in octetstring P,in octetstring req_auth,in octetstring salt,in boolean decrypt,in charstring secret) return octetstring; +external function f_calc_MD5(in octetstring input) return octetstring; + + + +// +// Basic type definitions +// + +type integer UINT8 (0..255) with { +variant "FIELDLENGTH(8)" +variant "BYTEORDER(last)" +} + +type integer UINT16 (0..65535) with { +variant "FIELDLENGTH(16)" +variant "BYTEORDER(last)" +} + +type integer UINT24 (0..16777215) with { +variant "FIELDLENGTH(24)" +variant "BYTEORDER(last)" +} + +type integer UINT32 (0..4294967296) with { +variant "FIELDLENGTH(32)" +variant "BYTEORDER(last)" +} + +type integer UINT64 with { +variant "FIELDLENGTH(64)" +variant "BYTEORDER(last)" +} + +type integer INT32 with { +variant "FIELDLENGTH(32)" +variant "BYTEORDER(last)" +variant "COMP(2scompl)" +} + +type octetstring OCTET1 length(1) +type octetstring OCTET2 length(2) +type octetstring OCTET3 length(3) +type octetstring OCTET4 length(4) +type octetstring OCTET8 length(8) +type octetstring OCTET16 length(16) + +// +// Basic Attribute Data Formats +// + +type charstring Attrib_Text length(1..253) with { variant "PADDING(yes)"}; +type octetstring Attrib_String length(1..253); +type OCTET4 Attrib_Address; +type OCTET4 Attrib_Time; +type UINT32 Attrib_Value; + + + diff --git a/src/obsolete/RadiusExtensions.rdf b/src/obsolete/RadiusExtensions.rdf new file mode 100644 index 0000000000000000000000000000000000000000..ab4c0e1570192161f282d2e32b831c526aa63a6c --- /dev/null +++ b/src/obsolete/RadiusExtensions.rdf @@ -0,0 +1,124 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: RadiusExtensions.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2866(RADIUS Extensions) +// +// +// + + +// APPLICATION-NAME: Ext + +// RFC 2869 +// Attrib: Acct-Input-Gigawords (52) +type Attrib_Value Acct_Input_Gigawords; + +// RFC 2869 +// Attrib: Acct-Output-Gigawords (53) +type Attrib_Value Acct_Output_Gigawords; + +// RFC 2869 +// Attrib: Event-Timestamp (55) +type Attrib_Value Event_Timestamp; + +// RFC 2869 +// Attrib: ARAP-Password (70) +type record ARAP_Password +{ + Attrib_Value Value1, + Attrib_Value Value2, + Attrib_Value Value3, + Attrib_Value Value4 +} + +// RFC 2869 +// Attrib: ARAP-Features (71) +type record ARAP_Features +{ + UINT8 variable_password, + UINT8 password_length, + Attrib_Time creation_time, + Attrib_Value expiration_time, + Attrib_Time radius_time +} + +// RFC 2869 +// Attrib: ARAP-Zone-Access (72) +type enumerated ARAP_Zone_Access +{ + To_default_zone (1), + Use_zone_filter_inclusively (2), + Use_zone_filter_exclusively (3) +} + +// RFC 2869 +// Attrib: ARAP-Security (73) +type Attrib_Value ARAP_Security; + +// RFC 2869 +// Attrib: ARAP-Security-Data (74) +type Attrib_String ARAP_Security_Data; + +// RFC 2869 +// Attrib: Password-Retry (75) +type Attrib_Value Password_Retry; + +// RFC 2869 +// Attrib: Prompt (76) +type enumerated Prompt +{ + No_Echo (0), + Echo (1) +} + +// RFC 2869 +// Attrib: Connect-Info (77) +type Attrib_Text Connect_Info; + +// RFC 2869 +// Attrib: Configuration-Token (78) +type Attrib_String Configuration_Token; + +// RFC 2869 +// Attrib: EAP-Message (79) +type Attrib_String EAP_Message; + +// RFC 2869 +// Attrib: Message-Authenticator (80) +type Attrib_String Message_Authenticator; + +// RFC 2869 +// Attrib: ARAP-Challenge-Response (84) +type UINT64 ARAP_Challenge_Response; + +// RFC 2869 +// Attrib: Acct-Interim-Interval (85) +type Attrib_Value Acct_Interim_Interval; + +// RFC 2869 +// Attrib: NAS-Port-Id (87) +type Attrib_Text NAS_Port_Id; + +// RFC 2869 +// Attrib: Framed-Pool (88) +type Attrib_String Framed_Pool; + + diff --git a/src/obsolete/RadiusGGSN.rdf b/src/obsolete/RadiusGGSN.rdf new file mode 100644 index 0000000000000000000000000000000000000000..6b75e80454538dae9da8a8421e4cd1b50f6ac01e --- /dev/null +++ b/src/obsolete/RadiusGGSN.rdf @@ -0,0 +1,54 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: RadiusGGSN.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: GGSN Functional Specification: RADIUS +// 46/155 17-CSA 113 35/4 Uen Rev B +// +// + + +// APPLICATION-NAME: Ggsn + +// Attrib: Imsi (224) +type Attrib_Text Imsi; + +// Attrib: Charging-Id (225) +type Attrib_Value Charging_Id; + +// Attrib: Imsi-Mcc-Mnc (226) +type Attrib_Text Imsi_Mcc_Mnc; + +// Attrib: Sgsn-IP-Address (228) +type Attrib_Address Sgsn_IP_Address; + +// Attrib: Selection-Mode (229) +type Attrib_Text Selection_Mode; + +// Attrib: Ggsn-Gtp-IP-Address (230) +type Attrib_Address Ggsn_Gtp_IP_Address; + +// Attrib: Primary-Dns-Server (135) +type Attrib_Address Primary_Dns_Server; + +// Attrib: Secondary-Dns-Server (136) +type Attrib_Address Secondary_Dns_Server; + + diff --git a/src/obsolete/TunnelAuthenticationAttributes.rdf b/src/obsolete/TunnelAuthenticationAttributes.rdf new file mode 100644 index 0000000000000000000000000000000000000000..bd880c5a24c4482d77c0858ad5be7745e5ad5f51 --- /dev/null +++ b/src/obsolete/TunnelAuthenticationAttributes.rdf @@ -0,0 +1,159 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: TunnelAuthenticationAttributes.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: RFC 2868(RADIUS Attributes for Tunnel Protocol Support) +// +// +// + + +// APPLICATION-NAME: Auth + + +type enum_24 Tunnel_Type_Value +{ + PPTP (1), + L2F (2), + L2TP (3), + ATMP (4), + VTP (5), + AH (6), + IP_IP (7), + MIN_IP_IP (8), + ESP (9), + GRE (10), + DVS (11), + IP_IP_Tunneling (12) +} + +// RFC 2868 +// Attrib: Tunnel-Type (64) +type record Tunnel_Type +{ + OCTET1 Tag, + Tunnel_Type_Value Value +} + + +type enum_24 Tunnel_Medium_Type_Value +{ + IPv4 (1), + IPv6 (2), + NSAP (3), + HDLC (4), + BBN_1822 (5), + media_plus_Ethernet_802 (6), + Epoint163 (7), + Epoint164 (8), + Fpoint69 (9), + Xpoint121 (10), + IPX (11), + Appletalk (12), + Decnet_IV (13), + Banyan_Vines (14), + Epoint164_with_NSAP_subaddress (15) +} + + +// RFC 2868 +// Attrib: Tunnel-Medium-Type (65) +type record Tunnel_Medium_Type +{ + OCTET1 Tag, + Tunnel_Medium_Type_Value Value +} + + +// RFC 2868 +// Attrib: Tunnel-Client-Endpoint (66) +type record Tunnel_Client_Endpoint +{ + OCTET1 Tag, + Attrib_String String +} + +// RFC 2868 +// Attrib: Tunnel-Server-Endpoint (67) +type record Tunnel_Server_Endpoint +{ + OCTET1 Tag, + Attrib_String String +} + +type record Tunnel_Password_String +{ + UINT8 Data_Length, + Attrib_String Password, + octetstring Padding_Sub_Field +} with { + variant (Data_Length) "LENGTHTO(Password)" +} + +// RFC 2868 +// Attrib: Tunnel-Password (69) +type record Tunnel_Password +{ + OCTET1 Tag, + OCTET2 Salt, + Tunnel_Password_String String +} + +// RFC 2868 +// Attrib: Tunnel-Private-Group-ID (81) +type record Tunnel_Private_Group_ID +{ + OCTET1 Tag, + Attrib_String String +} + +// RFC 2868 +// Attrib: Tunnel-Assignment-ID (82) +type record Tunnel_Assignment_ID +{ + OCTET1 Tag, + Attrib_String String +} + + +// RFC 2868 +// Attrib: Tunnel-Preference (83) +type record Tunnel_Preference +{ + OCTET1 Tag, + Attrib_Value Value +} + +// RFC 2868 +// Attrib: Tunnel-Client-Auth-ID (90) +type record Tunnel_Client_Auth_ID +{ + OCTET1 Tag, + Attrib_String String +} + +// RFC 2868 +// Attrib: Tunnel-Server-Auth-ID (91) +type record Tunnel_Server_Auth_ID +{ + OCTET1 Tag, + Attrib_String String +} + diff --git a/src/skt.rdf b/src/skt.rdf new file mode 100644 index 0000000000000000000000000000000000000000..01970744c22458d1f22f9292e1f206b4411dc871 --- /dev/null +++ b/src/skt.rdf @@ -0,0 +1,60 @@ +/****************************************************************************** +* Copyright (c) 2008, 2015 Ericsson AB +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Timea Moder +* Endre Kulcsar +* Gabor Szalai +* Janos Kovesdi +* Kulcsár Endre +* Zoltan Medve +* Tamas Korosi +******************************************************************************/ + +// +// File: skt.rdf +// Rev: <RnXnn> +// Prodnr: CNL 113 600 +// Reference: +// +// + +// Vendor: skt (5806) + + +type enum_8 skt_type_enum +{ + service_key (1), + prepaid_expired (2), + preservation_indicator (17) +} + + + + + +type union skt_value { + octetstring string_val, + UINT32 integer_val, + UINT8 byte_val +} + + +type record skt_subattr_t { + skt_type_enum skt_type, + UINT8 skt_length, + skt_value skt_val +} with { + variant (skt_length) "LENGTHTO(skt_type, skt_length, skt_val)"; + variant (skt_val) "CROSSTAG( + string_val, skt_type=preservation_indicator; + byte_val, skt_type=prepaid_expired; + integer_val, skt_type=service_key)" + } + +type set of skt_subattr_t skt_subattr_list; +