Loading NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_Functions.ttcn +70 −9 Original line number Diff line number Diff line Loading @@ -12,16 +12,11 @@ import from LibCommon_DataStrings all; import from LibCommon_VerdictControl { type FncRetCode }; //LibIpv6 import from LibIpv6_Interface_TypesAndValues all ; import from LibIpv6_ExternalFunctions all; import from LibIpv6_Interface all ; import from LibIpv6_ModuleParameters all ; import from LibIpv6_CommonRfcs_TypesAndValues all; import from LibIpv6_CommonRfcs_Templates all; import from LibIpv6_Rfc2460Root_TypesAndValues { type all; const all }; //import from LibIpv6_Rfc2460Root_Templates all; group calcPrefixFns { Loading Loading @@ -158,7 +153,6 @@ * @desc This goes through the ExtensionHeaderList and * checks if a Routing Header type 2 is present. * @param p_extHdrList ExtensionHeaderList to be treated * @param p_homeAddr Home address * @return execution status */ function f_isPresentRoutingHeaderType2( in ExtensionHeaderList p_extHdrList, Loading @@ -181,6 +175,73 @@ return v_ret; }//end function f_isPresentRoutingHeaderType2 /* * @desc This goes through the ExtensionHeaderList and * checks if a Binding Authority Data option is present. * @param p_extHdrList ExtensionHeaderList to be treated * @return execution status */ function f_isPresentBindingAuthorityDataOption ( in ExtensionHeaderList p_extHdrList ) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_error; var UInt8 i,j; //select ext hdrs that need special calculation for ( i := 0; i < sizeof ( p_extHdrList ) and ( v_ret != e_success ); i := i + 1 ) { if ( ischosen ( p_extHdrList[i].mipHeader ) ) { if ( ischosen ( p_extHdrList[i].mipHeader.mipMessage.bindingAck ) ) { for ( j := 0; j < sizeof ( p_extHdrList[i].mipHeader.mipMessage.bindingAck.mipOptions ); j := j + 1 ) { if ( ischosen ( p_extHdrList[i].mipHeader.mipMessage.bindingAck.mipOptions[j].mipBindingAuthorizationData ) == true ) { v_ret := e_success; } } } } } if ( v_ret == e_error ) { log ( "**** f_isPresentBindingAuthorityDataOption: ERROR: Binding Authentication Data option is not present in Binding Ack **** " ); } return v_ret; }//end function f_isPresentBindingAuthorityDataOption /* * @desc This goes through the ExtensionHeaderList and * checks if a Binding Refresh Advice option is present. * @param p_extHdrList ExtensionHeaderList to be treated * @return execution status */ function f_isPresentBindingRefreshAdviceOption ( in ExtensionHeaderList p_extHdrList ) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_error; var UInt8 i,j; //select ext hdrs that need special calculation for ( i := 0; i < sizeof ( p_extHdrList ) and ( v_ret != e_success ); i := i + 1 ) { if ( ischosen ( p_extHdrList[i].mipHeader ) ) { if ( ischosen ( p_extHdrList[i].mipHeader.mipMessage.bindingAck ) ) { for ( j := 0; j < sizeof ( p_extHdrList[i].mipHeader.mipMessage.bindingAck.mipOptions ); j := j + 1 ) { if ( ischosen ( p_extHdrList[i].mipHeader.mipMessage.bindingAck.mipOptions[j].mipOptBindingRefreshAdvice ) == true ) { v_ret := e_success; } } } } } if ( v_ret == e_error ) { log ( "**** f_isPresentBindingRefreshAdviceOption: ERROR: Binding Authentication Data option is not present in Binding Ack **** " ); } return v_ret; }//end function f_isPresentBindingRefreshAdviceOption } // end module LibIpv6_CommonRfcs_Functions NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_TypesAndValues.ttcn +4 −133 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ module LibIpv6_CommonRfcs_TypesAndValues { import from LibCommon_TextStrings all; import from LibCommon_Time all ; group DefaultConstants { const UInt16 c_defId := 10; // for ICMP echo proc const UInt16 c_defSeqNo := 20; // for ICMP echo proc Loading Loading @@ -43,6 +42,7 @@ module LibIpv6_CommonRfcs_TypesAndValues { const UInt8 c_optLen0 := 0; const UInt8 c_optLen1 := 1; const UInt8 c_optLen2 := 2; const UInt8 c_optLen3 := 3; const UInt8 c_optLen4 := 4; const UInt8 c_optLen6 := 6; const UInt8 c_optLen16 := 16; Loading Loading @@ -235,6 +235,9 @@ module LibIpv6_CommonRfcs_TypesAndValues { group rfc3775Options { const octetstring c_preDefAIOption := '0101000000001000'O; const octetstring c_preDefHAIOption := '0801000000000040'O; /* * @desc Extra ICMP option introduced by RFC3775, clause 7.3 */ Loading Loading @@ -294,136 +297,4 @@ module LibIpv6_CommonRfcs_TypesAndValues { } // end ipv6Options group security { //Use c_cryptoDummyByte when no message needs to be specified in fx_cryptoFunction const Oct1 c_cryptoDummyByte := int2oct(0,1); type enumerated EncryptionAlgo { e_null(0), e_tripleDes_cbc(1), e_aes_cbc(2), e_aes_ctr(3), e_des_cbc(4) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated IntegrityAlgo { e_null(0), e_hmac_sha1_96(1), e_aes_xcbc_mac_96(2), e_hmac_md5_96(3), e_hmac_sha1_64(4), e_sha1_96(1) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated CombinedModeAlgo { e_null(0) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated IpSecProtocolMode { e_transportMode (0), e_tunnelMode (1) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated IpSecProtocol{ e_esp (0), e_ah (1) } type record MipSec { MnSimuParams mnSimuParams, HaSimuParams haSimuParams, CnSimuParams cnSimuParams } type CnSimuParams HaSimuParams; type record CnSimuParams { //Keygen Token UInt16 homeNonceIndex, octetstring homeNonce, Oct20 kcn, Bit64 homeKeygenToken, Bit64 careOfKeygenToken, Bit64 receivedHomeInitCookie, Oct20 kbm } type record MnSimuParams { //Keygen Token UInt16 receivedHomeNonceIndex, //octetstring homeNonce, //Oct20 kcn, Bit64 receivedHomeKeygenToken, Bit64 receivedCareOfKeygenToken, Bit64 homeInitCookie, Oct20 kbm } const UInt8 c_maxNrDa := 8; //Security Association type record Sa { UInt32 securityParametersIndex, UInt32 sequenceNumber, IntegrityAlgo ahIntegrityAlgo, octetstring ahIntegrityKey, EncryptionAlgo espEncryptionAlgo, octetstring espEncryptionKey, IntegrityAlgo espIntegrityAlgo, octetstring espIntegrityKey, CombinedModeAlgo espCombinedModeAlgo, octetstring espCombinedModeKey, IpSecProtocolMode ipSecProtocolMode } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } //Security Association Database type record length (1 .. c_maxNrDa) of Sa Sad; type record EncryptResult { octetstring iv optional, octetstring encryptedData optional, octetstring tfcPadding optional } type record IntegrityExtHdr { octetstring icv optional } /* * @desc PDU type to be used when building ESP payload for encryption */ //TODO as well possibe to delete this type and make Ipv6Packet.ipv6Hdr optional type record ModularIpv6Packet { Ipv6Header ipv6Hdr optional, ExtensionHeaderList extHdrList optional, Ipv6Payload ipv6Payload optional } with { encode "TODO"; } } // end security } // end LibIpv6_CommonRfcs_TypesAndValues NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_ExternalFunctions.ttcn +37 −34 Original line number Diff line number Diff line Loading @@ -12,14 +12,11 @@ //LibCommon import from LibCommon_BasicTypesAndValues all; import from LibCommon_DataStrings all; import from LibCommon_VerdictControl all; //LibIpv6 import from LibIpv6_CommonRfcs_TypesAndValues { type all }; import from LibIpv6_Interface all; import from LibIpv6_Rfc2460Root_TypesAndValues {type all}; import from LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues all; import from LibIpv6_Rfc4303Esp_ExtHdrTypesAndValues all; import from LibIpv6_Interface_TypesAndValues all; import from LibIpv6_Interface_TypesAndValues all; /* @desc This external function calculates the payload length * of a IPv6 packet Loading Loading @@ -88,50 +85,56 @@ // external function fx_encrypt( EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in octetstring p_message) // return octetstring; external function fx_encryptModularIpPacket( in IpSecProtocolMode p_ipSecProtocolMode, external function fx_encrypt( in IpSecProtocolMode p_ipSecProtocolMode, in EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in ModularIpv6Packet p_message, in PlaintextData p_plaintextData, out EncryptResult p_encryptResult) return FncRetCode; external function fx_decryptEspPayload( in UInt8 p_ivLength, in UInt8 p_icvLength, in IpSecProtocolMode p_ipSecProtocolMode, EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in octetstring p_message) return DecryptedEspHeaderData; external function fx_decrypt( in UInt8 p_ivLength, in UInt8 p_icvLength, in IpSecProtocolMode p_ipSecProtocolMode, in EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in octetstring p_encryptedMsg, out PlaintextData p_plaintextData) return FncRetCode; /* @desc Apply indicated Integrity algorithm to the message. /* @desc Apply indicated Integrity algorithm to the message. Message is an octetstring. * If e_sha1_96 is chosen, then the key input shall be ignored. * * @param p_crypto Cryptographic function used to compute MAC * @param p_integrityAlgo Cryptographic function used to compute MAC * @param p_key Key used to compute the MAC * @param p_message Octetstring message * @return Message HMAC */ // external function fx_integrity( IntegrityAlgo p_integrityAlgo, in octetstring p_key, in octetstring p_message) // return octetstring; external function fx_integrity( IntegrityAlgo p_integrityAlgo, in octetstring p_key, in octetstring p_message) return octetstring; /* @desc Apply indicated Integrity algorithm to the message. Message can only be an EspHeader. * If e_sha1_96 is chosen, then the key input shall be ignored. * * @param p_integrityAlgo Cryptographic function used to compute MAC * @param p_key Key used to compute the MAC * @param p_espHeader EspHeader * @param p_integrityResult Result of Integrity function * @return Message HMAC */ external function fx_integrityEspHdr( in IntegrityAlgo p_integrityAlgo, in octetstring p_key, in EspHeader p_espHeader, out IntegrityResult p_integrityResult) return FncRetCode; /* @desc This external function computes the Authenticator for * return routability procedure * The Ipv6Packet shall be used excluding the Authenticator field itself. * @param p_careOfAddr Care-of address * @param p_cnAddr Address of the correspondant * @param p_ipv6Packet Ipv6 Packet * @param p_kbm Binding management key * @return Authenticator /* @desc This external function runs the MipHeader through Codec and returns * the octetstring representing the MipHeader * * @param p_mipHeader MIp Header to be encoded to octetstring * @return octetstring */ external function fx_bindingAuthenticator(in Ipv6Address p_careOfAddr, in Ipv6Address p_cnAddr, in Ipv6Packet p_ipv6Packet, in Oct20 p_kbm, out octetstring p_result) return FncRetCode; external function fx_mipHdrToOct(MipHeader p_mipHeader) return octetstring; /* @desc This external function computes Integrity Check Value * @param p_ipv6Packet Ipv6 Packet Loading NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_Interface.ttcndeleted 100644 → 0 +0 −169 Original line number Diff line number Diff line /* * @author STF 276 * @version $Id$ * @desc This module defines the interface for any function * part of the IPv6 library. * Further on, this module defines a meta type over all IPv6 * packets supported by the IPv6 library as well as * templates for it. Also it includes the raw Ipv6 * message type which can be used for sending encoded * Ipv6 packets. * */ module LibIpv6_Interface { //LibCommon import from LibCommon_Time all ; import from LibCommon_DataStrings all; //LibIpv6 import from LibIpv6_Rfc2460Root_TypesAndValues {type all}; import from LibIpv6_Rfc2463Icmpv6_TypesAndValues {type all}; import from LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues {type all}; import from LibIpv6_Rfc2894RouterRenumbering_TypesAndValues {type all}; import from LibIpv6_Rfc3775Mipv6_TypesAndValues {type all}; import from LibIpv6_Rfc0768Udp_TypesAndValues all ; import from LibIpv6_CommonRfcs_TypesAndValues all; /* * @desc This type is used to define behavior within the IPv6 library * which can be executed on both, host as well as router, * components. It may also be used to specify behavior outside of * the IPv6 library. In order to call IPv6 library functions * defined based on this type the caller function must * be defined based on a type compatible component type. */ type component LibIpv6Node { port Ipv6Port ipPort; timer tc_ac:= PX_TAC; timer tc_noAc:= PX_TNOAC; timer tc_wait:= PX_TWAIT; //var Sad vc_sad; var MipSec vc_mipSec; var Sad vc_sad; } type port Ipv6Port message { inout //Imported from Rfc 2463 DestinationUnreachable, PacketTooBig, TimeExceeded, ParameterProblem, EchoRequest, EchoReply, //Imported from Rfc 2461 RouterAdvertisement, RouterSolicitation, NeighborSolicitation, NeighborAdvertisement, Redirect, //Imported from Rfc 2894 RouterRenumbering, //Imported from Rfc XXXX Mipv6 HomeAgentAddressDiscoveryRequest, HomeAgentAddressDiscoveryReply, MobilePrefixSolicitation, MobilePrefixAdvertisement, MipRouterAdvertisement, OtherIcmpv6, //hand encoded IPv6 packets RawIpv6Packet, //UDP UdpPacket, //MetaPdu Ipv6Packet //General IPv6 packet //GeneralIpv6 }//end type port Ipv6Port /* * @desc PDU type derived from RFC2463 clause 4.1 */ type record Ipv6Packet { Ipv6Header ipv6Hdr, ExtensionHeaderList extHdrList optional, Ipv6Payload ipv6Payload optional } with { encode "TODO"; } //Alias //Imported from Rfc 2463 type Ipv6Packet DestinationUnreachable; type Ipv6Packet PacketTooBig; type Ipv6Packet TimeExceeded; type Ipv6Packet ParameterProblem; type Ipv6Packet EchoRequest; type Ipv6Packet EchoReply; //Imported from Rfc 2461 type Ipv6Packet RouterAdvertisement; type Ipv6Packet RouterSolicitation; type Ipv6Packet NeighborSolicitation; type Ipv6Packet NeighborAdvertisement; type Ipv6Packet Redirect; //Imported from Rfc 2894 type Ipv6Packet RouterRenumbering; //Imported from Rfc XXXX Mipv6 type Ipv6Packet HomeAgentAddressDiscoveryRequest; type Ipv6Packet HomeAgentAddressDiscoveryReply; type Ipv6Packet MobilePrefixSolicitation; type Ipv6Packet MobilePrefixAdvertisement; type Ipv6Packet MipRouterAdvertisement; //Default value type Ipv6Packet OtherIcmpv6; //Udp type Ipv6Packet UdpPacket; //General IPv6 packet // type octetstring Ipv6Packet;//TODO check this /* * @desc This meta packet type contains any Ipv6 packets. * This type is used mainly for checksum calculation */ type union Ipv6Payload { //type union Ipv6Packet { //Imported from Rfc 2463 DestinationUnreachableMsg destinationUnreachableMsg, PacketTooBigMsg packetTooBigMsg, TimeExceededMsg timeExceededMsg, ParameterProblemMsg parameterProblemMsg, EchoRequestMsg echoRequestMsg, EchoReplyMsg echoReplyMsg, //Imported from Rfc 2461 RouterAdvertisementMsg routerAdvMsg, RouterSolicitationMsg routerSolMsg, NeighborSolicitationMsg nbrSolMsg, NeighborAdvertisementMsg nbrAdvMsg, RedirectMsg redirectMsg, //Imported from Rfc 2894 RouterRenumberingMsg routerRenumberingMsg, //Imported from Rfc XXXX Mipv6 HomeAgentAddressDiscoveryRequestMsg homeAgentAddrDiscRequestMsg, HomeAgentAddressDiscoveryReplyMsg homeAgentAddrDiscReplyMsg, MobilePrefixSolicitationMsg mobilePrefixSolMsg, MobilePrefixAdvertisementMsg mobilePrefixAdvMsg, MobileRouterAdvertisementMsg mobileRouterAdvMsg,//TODO check this //Default value OtherIcmpv6Msg otherIcmpv6Msg, //Udp UdpMsg udpMsg, //General IPv6 packet //GeneralIpv6 generalIpv6 octetstring octetstringMsg } with { //DTE TODO encode "isPDU=LibIpv6_Interface;" } template Ipv6Packet mw_ipPkt := ? ; /* * @desc This type is intended to be used to send "hand encoded" * IPv6 packets. It can also be used to create incorrect * IPv6 messages. */ type octetstring RawIpv6Packet; } // end module LibIpv6_Interface NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_Interface_Functions.ttcn 0 → 100644 +380 −0 File added.Preview size limit exceeded, changes collapsed. Show changes Loading
NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_Functions.ttcn +70 −9 Original line number Diff line number Diff line Loading @@ -12,16 +12,11 @@ import from LibCommon_DataStrings all; import from LibCommon_VerdictControl { type FncRetCode }; //LibIpv6 import from LibIpv6_Interface_TypesAndValues all ; import from LibIpv6_ExternalFunctions all; import from LibIpv6_Interface all ; import from LibIpv6_ModuleParameters all ; import from LibIpv6_CommonRfcs_TypesAndValues all; import from LibIpv6_CommonRfcs_Templates all; import from LibIpv6_Rfc2460Root_TypesAndValues { type all; const all }; //import from LibIpv6_Rfc2460Root_Templates all; group calcPrefixFns { Loading Loading @@ -158,7 +153,6 @@ * @desc This goes through the ExtensionHeaderList and * checks if a Routing Header type 2 is present. * @param p_extHdrList ExtensionHeaderList to be treated * @param p_homeAddr Home address * @return execution status */ function f_isPresentRoutingHeaderType2( in ExtensionHeaderList p_extHdrList, Loading @@ -181,6 +175,73 @@ return v_ret; }//end function f_isPresentRoutingHeaderType2 /* * @desc This goes through the ExtensionHeaderList and * checks if a Binding Authority Data option is present. * @param p_extHdrList ExtensionHeaderList to be treated * @return execution status */ function f_isPresentBindingAuthorityDataOption ( in ExtensionHeaderList p_extHdrList ) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_error; var UInt8 i,j; //select ext hdrs that need special calculation for ( i := 0; i < sizeof ( p_extHdrList ) and ( v_ret != e_success ); i := i + 1 ) { if ( ischosen ( p_extHdrList[i].mipHeader ) ) { if ( ischosen ( p_extHdrList[i].mipHeader.mipMessage.bindingAck ) ) { for ( j := 0; j < sizeof ( p_extHdrList[i].mipHeader.mipMessage.bindingAck.mipOptions ); j := j + 1 ) { if ( ischosen ( p_extHdrList[i].mipHeader.mipMessage.bindingAck.mipOptions[j].mipBindingAuthorizationData ) == true ) { v_ret := e_success; } } } } } if ( v_ret == e_error ) { log ( "**** f_isPresentBindingAuthorityDataOption: ERROR: Binding Authentication Data option is not present in Binding Ack **** " ); } return v_ret; }//end function f_isPresentBindingAuthorityDataOption /* * @desc This goes through the ExtensionHeaderList and * checks if a Binding Refresh Advice option is present. * @param p_extHdrList ExtensionHeaderList to be treated * @return execution status */ function f_isPresentBindingRefreshAdviceOption ( in ExtensionHeaderList p_extHdrList ) runs on LibIpv6Node return FncRetCode { var FncRetCode v_ret := e_error; var UInt8 i,j; //select ext hdrs that need special calculation for ( i := 0; i < sizeof ( p_extHdrList ) and ( v_ret != e_success ); i := i + 1 ) { if ( ischosen ( p_extHdrList[i].mipHeader ) ) { if ( ischosen ( p_extHdrList[i].mipHeader.mipMessage.bindingAck ) ) { for ( j := 0; j < sizeof ( p_extHdrList[i].mipHeader.mipMessage.bindingAck.mipOptions ); j := j + 1 ) { if ( ischosen ( p_extHdrList[i].mipHeader.mipMessage.bindingAck.mipOptions[j].mipOptBindingRefreshAdvice ) == true ) { v_ret := e_success; } } } } } if ( v_ret == e_error ) { log ( "**** f_isPresentBindingRefreshAdviceOption: ERROR: Binding Authentication Data option is not present in Binding Ack **** " ); } return v_ret; }//end function f_isPresentBindingRefreshAdviceOption } // end module LibIpv6_CommonRfcs_Functions
NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_TypesAndValues.ttcn +4 −133 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ module LibIpv6_CommonRfcs_TypesAndValues { import from LibCommon_TextStrings all; import from LibCommon_Time all ; group DefaultConstants { const UInt16 c_defId := 10; // for ICMP echo proc const UInt16 c_defSeqNo := 20; // for ICMP echo proc Loading Loading @@ -43,6 +42,7 @@ module LibIpv6_CommonRfcs_TypesAndValues { const UInt8 c_optLen0 := 0; const UInt8 c_optLen1 := 1; const UInt8 c_optLen2 := 2; const UInt8 c_optLen3 := 3; const UInt8 c_optLen4 := 4; const UInt8 c_optLen6 := 6; const UInt8 c_optLen16 := 16; Loading Loading @@ -235,6 +235,9 @@ module LibIpv6_CommonRfcs_TypesAndValues { group rfc3775Options { const octetstring c_preDefAIOption := '0101000000001000'O; const octetstring c_preDefHAIOption := '0801000000000040'O; /* * @desc Extra ICMP option introduced by RFC3775, clause 7.3 */ Loading Loading @@ -294,136 +297,4 @@ module LibIpv6_CommonRfcs_TypesAndValues { } // end ipv6Options group security { //Use c_cryptoDummyByte when no message needs to be specified in fx_cryptoFunction const Oct1 c_cryptoDummyByte := int2oct(0,1); type enumerated EncryptionAlgo { e_null(0), e_tripleDes_cbc(1), e_aes_cbc(2), e_aes_ctr(3), e_des_cbc(4) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated IntegrityAlgo { e_null(0), e_hmac_sha1_96(1), e_aes_xcbc_mac_96(2), e_hmac_md5_96(3), e_hmac_sha1_64(4), e_sha1_96(1) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated CombinedModeAlgo { e_null(0) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated IpSecProtocolMode { e_transportMode (0), e_tunnelMode (1) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated IpSecProtocol{ e_esp (0), e_ah (1) } type record MipSec { MnSimuParams mnSimuParams, HaSimuParams haSimuParams, CnSimuParams cnSimuParams } type CnSimuParams HaSimuParams; type record CnSimuParams { //Keygen Token UInt16 homeNonceIndex, octetstring homeNonce, Oct20 kcn, Bit64 homeKeygenToken, Bit64 careOfKeygenToken, Bit64 receivedHomeInitCookie, Oct20 kbm } type record MnSimuParams { //Keygen Token UInt16 receivedHomeNonceIndex, //octetstring homeNonce, //Oct20 kcn, Bit64 receivedHomeKeygenToken, Bit64 receivedCareOfKeygenToken, Bit64 homeInitCookie, Oct20 kbm } const UInt8 c_maxNrDa := 8; //Security Association type record Sa { UInt32 securityParametersIndex, UInt32 sequenceNumber, IntegrityAlgo ahIntegrityAlgo, octetstring ahIntegrityKey, EncryptionAlgo espEncryptionAlgo, octetstring espEncryptionKey, IntegrityAlgo espIntegrityAlgo, octetstring espIntegrityKey, CombinedModeAlgo espCombinedModeAlgo, octetstring espCombinedModeKey, IpSecProtocolMode ipSecProtocolMode } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } //Security Association Database type record length (1 .. c_maxNrDa) of Sa Sad; type record EncryptResult { octetstring iv optional, octetstring encryptedData optional, octetstring tfcPadding optional } type record IntegrityExtHdr { octetstring icv optional } /* * @desc PDU type to be used when building ESP payload for encryption */ //TODO as well possibe to delete this type and make Ipv6Packet.ipv6Hdr optional type record ModularIpv6Packet { Ipv6Header ipv6Hdr optional, ExtensionHeaderList extHdrList optional, Ipv6Payload ipv6Payload optional } with { encode "TODO"; } } // end security } // end LibIpv6_CommonRfcs_TypesAndValues
NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_ExternalFunctions.ttcn +37 −34 Original line number Diff line number Diff line Loading @@ -12,14 +12,11 @@ //LibCommon import from LibCommon_BasicTypesAndValues all; import from LibCommon_DataStrings all; import from LibCommon_VerdictControl all; //LibIpv6 import from LibIpv6_CommonRfcs_TypesAndValues { type all }; import from LibIpv6_Interface all; import from LibIpv6_Rfc2460Root_TypesAndValues {type all}; import from LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues all; import from LibIpv6_Rfc4303Esp_ExtHdrTypesAndValues all; import from LibIpv6_Interface_TypesAndValues all; import from LibIpv6_Interface_TypesAndValues all; /* @desc This external function calculates the payload length * of a IPv6 packet Loading Loading @@ -88,50 +85,56 @@ // external function fx_encrypt( EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in octetstring p_message) // return octetstring; external function fx_encryptModularIpPacket( in IpSecProtocolMode p_ipSecProtocolMode, external function fx_encrypt( in IpSecProtocolMode p_ipSecProtocolMode, in EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in ModularIpv6Packet p_message, in PlaintextData p_plaintextData, out EncryptResult p_encryptResult) return FncRetCode; external function fx_decryptEspPayload( in UInt8 p_ivLength, in UInt8 p_icvLength, in IpSecProtocolMode p_ipSecProtocolMode, EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in octetstring p_message) return DecryptedEspHeaderData; external function fx_decrypt( in UInt8 p_ivLength, in UInt8 p_icvLength, in IpSecProtocolMode p_ipSecProtocolMode, in EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in octetstring p_encryptedMsg, out PlaintextData p_plaintextData) return FncRetCode; /* @desc Apply indicated Integrity algorithm to the message. /* @desc Apply indicated Integrity algorithm to the message. Message is an octetstring. * If e_sha1_96 is chosen, then the key input shall be ignored. * * @param p_crypto Cryptographic function used to compute MAC * @param p_integrityAlgo Cryptographic function used to compute MAC * @param p_key Key used to compute the MAC * @param p_message Octetstring message * @return Message HMAC */ // external function fx_integrity( IntegrityAlgo p_integrityAlgo, in octetstring p_key, in octetstring p_message) // return octetstring; external function fx_integrity( IntegrityAlgo p_integrityAlgo, in octetstring p_key, in octetstring p_message) return octetstring; /* @desc Apply indicated Integrity algorithm to the message. Message can only be an EspHeader. * If e_sha1_96 is chosen, then the key input shall be ignored. * * @param p_integrityAlgo Cryptographic function used to compute MAC * @param p_key Key used to compute the MAC * @param p_espHeader EspHeader * @param p_integrityResult Result of Integrity function * @return Message HMAC */ external function fx_integrityEspHdr( in IntegrityAlgo p_integrityAlgo, in octetstring p_key, in EspHeader p_espHeader, out IntegrityResult p_integrityResult) return FncRetCode; /* @desc This external function computes the Authenticator for * return routability procedure * The Ipv6Packet shall be used excluding the Authenticator field itself. * @param p_careOfAddr Care-of address * @param p_cnAddr Address of the correspondant * @param p_ipv6Packet Ipv6 Packet * @param p_kbm Binding management key * @return Authenticator /* @desc This external function runs the MipHeader through Codec and returns * the octetstring representing the MipHeader * * @param p_mipHeader MIp Header to be encoded to octetstring * @return octetstring */ external function fx_bindingAuthenticator(in Ipv6Address p_careOfAddr, in Ipv6Address p_cnAddr, in Ipv6Packet p_ipv6Packet, in Oct20 p_kbm, out octetstring p_result) return FncRetCode; external function fx_mipHdrToOct(MipHeader p_mipHeader) return octetstring; /* @desc This external function computes Integrity Check Value * @param p_ipv6Packet Ipv6 Packet Loading
NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_Interface.ttcndeleted 100644 → 0 +0 −169 Original line number Diff line number Diff line /* * @author STF 276 * @version $Id$ * @desc This module defines the interface for any function * part of the IPv6 library. * Further on, this module defines a meta type over all IPv6 * packets supported by the IPv6 library as well as * templates for it. Also it includes the raw Ipv6 * message type which can be used for sending encoded * Ipv6 packets. * */ module LibIpv6_Interface { //LibCommon import from LibCommon_Time all ; import from LibCommon_DataStrings all; //LibIpv6 import from LibIpv6_Rfc2460Root_TypesAndValues {type all}; import from LibIpv6_Rfc2463Icmpv6_TypesAndValues {type all}; import from LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues {type all}; import from LibIpv6_Rfc2894RouterRenumbering_TypesAndValues {type all}; import from LibIpv6_Rfc3775Mipv6_TypesAndValues {type all}; import from LibIpv6_Rfc0768Udp_TypesAndValues all ; import from LibIpv6_CommonRfcs_TypesAndValues all; /* * @desc This type is used to define behavior within the IPv6 library * which can be executed on both, host as well as router, * components. It may also be used to specify behavior outside of * the IPv6 library. In order to call IPv6 library functions * defined based on this type the caller function must * be defined based on a type compatible component type. */ type component LibIpv6Node { port Ipv6Port ipPort; timer tc_ac:= PX_TAC; timer tc_noAc:= PX_TNOAC; timer tc_wait:= PX_TWAIT; //var Sad vc_sad; var MipSec vc_mipSec; var Sad vc_sad; } type port Ipv6Port message { inout //Imported from Rfc 2463 DestinationUnreachable, PacketTooBig, TimeExceeded, ParameterProblem, EchoRequest, EchoReply, //Imported from Rfc 2461 RouterAdvertisement, RouterSolicitation, NeighborSolicitation, NeighborAdvertisement, Redirect, //Imported from Rfc 2894 RouterRenumbering, //Imported from Rfc XXXX Mipv6 HomeAgentAddressDiscoveryRequest, HomeAgentAddressDiscoveryReply, MobilePrefixSolicitation, MobilePrefixAdvertisement, MipRouterAdvertisement, OtherIcmpv6, //hand encoded IPv6 packets RawIpv6Packet, //UDP UdpPacket, //MetaPdu Ipv6Packet //General IPv6 packet //GeneralIpv6 }//end type port Ipv6Port /* * @desc PDU type derived from RFC2463 clause 4.1 */ type record Ipv6Packet { Ipv6Header ipv6Hdr, ExtensionHeaderList extHdrList optional, Ipv6Payload ipv6Payload optional } with { encode "TODO"; } //Alias //Imported from Rfc 2463 type Ipv6Packet DestinationUnreachable; type Ipv6Packet PacketTooBig; type Ipv6Packet TimeExceeded; type Ipv6Packet ParameterProblem; type Ipv6Packet EchoRequest; type Ipv6Packet EchoReply; //Imported from Rfc 2461 type Ipv6Packet RouterAdvertisement; type Ipv6Packet RouterSolicitation; type Ipv6Packet NeighborSolicitation; type Ipv6Packet NeighborAdvertisement; type Ipv6Packet Redirect; //Imported from Rfc 2894 type Ipv6Packet RouterRenumbering; //Imported from Rfc XXXX Mipv6 type Ipv6Packet HomeAgentAddressDiscoveryRequest; type Ipv6Packet HomeAgentAddressDiscoveryReply; type Ipv6Packet MobilePrefixSolicitation; type Ipv6Packet MobilePrefixAdvertisement; type Ipv6Packet MipRouterAdvertisement; //Default value type Ipv6Packet OtherIcmpv6; //Udp type Ipv6Packet UdpPacket; //General IPv6 packet // type octetstring Ipv6Packet;//TODO check this /* * @desc This meta packet type contains any Ipv6 packets. * This type is used mainly for checksum calculation */ type union Ipv6Payload { //type union Ipv6Packet { //Imported from Rfc 2463 DestinationUnreachableMsg destinationUnreachableMsg, PacketTooBigMsg packetTooBigMsg, TimeExceededMsg timeExceededMsg, ParameterProblemMsg parameterProblemMsg, EchoRequestMsg echoRequestMsg, EchoReplyMsg echoReplyMsg, //Imported from Rfc 2461 RouterAdvertisementMsg routerAdvMsg, RouterSolicitationMsg routerSolMsg, NeighborSolicitationMsg nbrSolMsg, NeighborAdvertisementMsg nbrAdvMsg, RedirectMsg redirectMsg, //Imported from Rfc 2894 RouterRenumberingMsg routerRenumberingMsg, //Imported from Rfc XXXX Mipv6 HomeAgentAddressDiscoveryRequestMsg homeAgentAddrDiscRequestMsg, HomeAgentAddressDiscoveryReplyMsg homeAgentAddrDiscReplyMsg, MobilePrefixSolicitationMsg mobilePrefixSolMsg, MobilePrefixAdvertisementMsg mobilePrefixAdvMsg, MobileRouterAdvertisementMsg mobileRouterAdvMsg,//TODO check this //Default value OtherIcmpv6Msg otherIcmpv6Msg, //Udp UdpMsg udpMsg, //General IPv6 packet //GeneralIpv6 generalIpv6 octetstring octetstringMsg } with { //DTE TODO encode "isPDU=LibIpv6_Interface;" } template Ipv6Packet mw_ipPkt := ? ; /* * @desc This type is intended to be used to send "hand encoded" * IPv6 packets. It can also be used to create incorrect * IPv6 messages. */ type octetstring RawIpv6Packet; } // end module LibIpv6_Interface
NewTypeStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_Interface_Functions.ttcn 0 → 100644 +380 −0 File added.Preview size limit exceeded, changes collapsed. Show changes