Commit 935f77ae authored by seb's avatar seb
Browse files

added missing files

parent c14d7073
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc 		This module defines the structure mobile IPv6 header 
 *              based on an temporary MIpv6-24 RFC and using types from  
 *              the Common library. Also it provides some useful constant 
 *              definitions.
 *  
 */
 module LibIpv6_Rfc3775Mipv6_ExtHdrFunctions {
	
	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	//LibIpv6
	import from LibIpv6_CommonRfcs_TypesAndValues all ;
	import from LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues all;
	import from LibIpv6_Rfc3775Mipv6_ExtHdrTemplates all;
	import from LibIpv6_Interface all;
	import from LibIpv6_ExternalFunctions all;


	import from LibIpv6_CommonRfcs_Templates all;
	import from LibCommon_VerdictControl all;



	/*
	 * @desc 	This goes through the Mip header and calculates length, checksum
	 *			and other specific functions of the different messages
	 * @param 	p_msg ExtensionHeaderList to be treated	
	 * @return 	execution status 
	*/
	function f_setMipHeader(in Ipv6Address p_srcAddr,
							in Ipv6Address p_dstAddr,
							inout MipHeader p_mipHeader)
	runs on LibIpv6Node
	return FncRetCode {
		var MipHeader v_mipHeader := valueof(p_mipHeader);
		var Ipv6Address v_homeAddress := c_16ZeroBytes ;

		if (ischosen(p_mipHeader.mipMessage.homeTestInit)) {
			//calc homeNonceIndex TODO
			//calc homeInitCookie TODO
			//calc homeKeygenToken TODO	
		}
		else if (ischosen(p_mipHeader.mipMessage.homeTest)) {
			//calc homeNonceIndex TODO
			//calc homeInitCookie TODO
			//calc homeKeygenToken TODO	
		}
		//calc mipHeaderLen
		p_mipHeader.headerLen := fx_mipHeaderLength(p_mipHeader);
		//set mipChecksum to zero
		p_mipHeader.checksum := c_2ZeroBytes;  
		//calc mipChecksum
		p_mipHeader.checksum := fx_mipHeaderChecksum(	p_srcAddr,
														p_dstAddr,
														p_mipHeader);
		return e_success;
	}

} // end module LibIpv6_Rfc3775Mipv6_ExtHdrFunctions
+223 −0
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc 		This module defines the structure mobile IPv6 header 
 *              based on an temporary MIpv6-24 RFC and using types from  
 *              the Common library. Also it provides some useful constant 
 *              definitions.
 *  
 */
 module LibIpv6_Rfc3775Mipv6_ExtHdrTemplates {
	
	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	//LibIpv6
	import from LibIpv6_CommonRfcs_TypesAndValues all ;
	import from LibIpv6_CommonRfcs_Templates all ;
	import from LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues all;
	import from LibIpv6_Rfc2460Root_TypesAndValues all;
	import from LibIpv6_Rfc3775Mipv6_TypesAndValues all;

		group mobilityHdrMessageTemplates {
		
		
		template MipMessage m_bindingUpdate(	UInt16 p_seqNr,
												UInt1 p_aFlag,
												UInt1 p_hFlag,
												UInt1 p_lFlag,
												UInt1 p_kFlag,
												UInt16 p_lifeTime,
												template MipOptionList p_mipOptions) := {	
			bindingUpdate := {
				sequenceNumber := p_seqNr,
				aFlag := p_aFlag,
				hFlag := p_hFlag,
				lFlag := p_lFlag,
				kFlag := p_kFlag,
				reserved := c_uInt12Zero,
				lifeTime := p_lifeTime,		
				mipOptions := p_mipOptions
			}
		}

		template MipMessage mw_bindingUpdate(	UInt1 p_aFlag,
												UInt1 p_hFlag,
												UInt1 p_lFlag,
												UInt1 p_kFlag,
												template MipOptionList p_mipOptions) := {	
			bindingUpdate := {
				sequenceNumber := ?,
				aFlag := p_aFlag,
				hFlag := p_hFlag,
				lFlag := p_lFlag,
				kFlag := p_kFlag,
				reserved := c_uInt12Zero,
				lifeTime := ?,		
				mipOptions := p_mipOptions
			}
		}
		
		template MipMessage mw_bindingUpdate_lifeTime(	UInt1 p_aFlag,
												UInt1 p_hFlag,
												UInt1 p_lFlag,
												UInt1 p_kFlag,
												UInt16 p_lifetime,
												template MipOptionList p_mipOptions) := {	
			bindingUpdate := {
				sequenceNumber := ?,
				aFlag := p_aFlag,
				hFlag := p_hFlag,
				lFlag := p_lFlag,
				kFlag := p_kFlag,
				reserved := c_uInt12Zero,
				lifeTime := p_lifetime,		
				mipOptions := p_mipOptions
			}
				}

		template MipMessage m_bindingAck(UInt16 p_seqNr, UInt16 p_lifetime, template MipOptionList p_mipOptions) := {	
			bindingAck := {
				status := c_mipCodeBindingUpdateAccepted,
				kFlag := c_kFlag0,
				reserved := c_uInt7Zero,
				sequenceNumber := p_seqNr,
				lifeTime := p_lifetime,		
				mipOptions := p_mipOptions
			}
		}

		template MipMessage mw_bindingAck(UInt16 p_seqNr) := {	
			bindingAck := {
				status := c_mipCodeBindingUpdateAccepted,
				kFlag := ?,
				reserved := ?,
				sequenceNumber := p_seqNr,
				lifeTime := ?,		
				mipOptions := ?
			}
		}
		
		template MipMessage mw_bindingError := {	
			bindingError := {
				status := ?,
				reserved := ?,
				homeAddress := ?,		
				mipOptions := *
			}	
		}
		
		template MipMessage m_hot := {	
			homeTest := {
				homeNonceIndex := c_uInt16Zero,
				homeInitCookie := c_64ZeroBits,
				homeKeygenToken := c_64ZeroBits,
				mipOptions := omit
			}
		}

		template MipMessage mw_hot := {	
			homeTest := {
				homeNonceIndex := ?,
				homeInitCookie := ?,
				homeKeygenToken := ?,
				mipOptions := *
			}
		}

		template MipMessage m_hoti := {	
			homeTestInit := {
				reserved := c_uInt16Zero,
				homeInitCookie := c_64ZeroBits,
				mipOptions := omit
			}
		}


		template MipMessage mw_hoti := {	
			homeTestInit := {
				reserved := ?,
				homeInitCookie := ?,
				mipOptions := *
			}
		}


	}//end group mobilityHdrMessageTemplates


	group mobilityOptTemplates {

		/*
		 *	@param  p_dstOpt First element in the Destination option list
		*/
		template MipOptionList m_mipOptList_1Elem ( template MipOption p_mipOpt ) := {
			p_mipOpt
		}

		/*
		 *	@param  p_dstOpt First element in the Destination option list
		*/
		template MipOptionList m_mipOptList_2Elem ( template MipOption p_mipOpt1, template MipOption p_mipOpt2 ) := {
			p_mipOpt1, p_mipOpt2
		}

		template MipOption m_mipOpt_altCoa(template MipOptAltCoA p_mipOptAltCoA) := {
			mipOptAltCoA := p_mipOptAltCoA
		}

		template MipOption m_mipOpt_padN(template OptPadN p_optPadN) := {
			optPadN := p_optPadN
		}

		template MipOptAltCoA m_mipOptAltCoA(in template Ipv6Address p_addr) := {
			mipOptType :=3,
			mipOptLen := 16,
			alternateCoA := p_addr
		}

		template MipOptAltCoA mw_mipOptAltCoA := {
			mipOptType :=3,
			mipOptLen := 16,
			alternateCoA := ?
		}
		
	}//end group mobilityOptTemplates

		group mipHeaderTemplates {

	
			template ExtensionHeader m_extHdr_mipHeader ( 	UInt8 p_payloadProtocol,
															UInt8 p_mobilityHeaderType,
															template MipMessage p_mipMessage) := {
				mipHeader := {
					payloadProtocol := p_payloadProtocol,
					headerLen := c_uInt8Zero,
					mobilityHeaderType := p_mobilityHeaderType,  
					reserved := c_uInt8Zero,           
					checksum := c_2ZeroBytes,     
					mipMessage := p_mipMessage
				}
			}

			template ExtensionHeader mw_extHdr_mipHeader ( 	UInt8 p_payloadProtocol,
															UInt8 p_mobilityHeaderType,
															template MipMessage p_mipMessage) := {
				mipHeader := {
					payloadProtocol := p_payloadProtocol,
					headerLen := ?,
					mobilityHeaderType := p_mobilityHeaderType,  
					reserved := ?,           
					checksum := ?,     
					mipMessage := p_mipMessage
				}
			}



		}//end group mipHeaderTemplates




} // end module LibIpv6_Rfc3775Mipv6_ExtHdrTemplates
+309 −0
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc 		This module defines the structure mobile IPv6 header 
 *              based on an temporary MIpv6-24 RFC and using types from  
 *              the Common library. Also it provides some useful constant 
 *              definitions.
 *  
 */
 module LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues {
	
	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	//LibIpv6
	import from LibIpv6_CommonRfcs_TypesAndValues all ;

	group mipHeader {

	/*
	 * @desc Derived from RFC3775 clause 6.1.1. NoNextHeader 
	 *       should be used as default value for payloadProtocol.
	 *       The headerLen is to specified in unit of 8 Octets excluding
	 *       zero.
	*/
	type record MipHeader {
		UInt8		payloadProtocol,
		UInt8		headerLen,
		UInt8		mobilityHeaderType,  
		UInt8		reserved,           
		Oct2		checksum,     
		MipMessage	mipMessage
	}
	with {
		encode "isPDU=used for external function only!";
		encode (headerLen) "tag='hdrIntLen'";
		encode (mobilityHeaderType) "tag='mobilityHeaderType'";
	}

	

	group mipRfc3775Messages {
		
		type union MipMessage {
			BindingRefreshRequest 	bindingRefreshRequest,
			HomeTestInit 			homeTestInit,
			CareOfTestInit 			careOfTestInit,
			HomeTest 				homeTest,
			CareOfTest 				careOfTest,
			BindingUpdate 			bindingUpdate,
			BindingAck 				bindingAck,
			BindingError 			bindingError
		} 

		/*
		 * @desc Derived from  RFC3775 clause 6.1.2
		*/
		type record 	BindingRefreshRequest {
	        UInt16   		reserved,
        	MipOptionList 	mipOptions optional
		}
		with {
			encode "present=isEOF()== false && (valueOf(getTag('mobilityHeaderType'))==0);";
		}
		
		/*
		 * @desc Derived from  RFC3775 clause 6.1.3
		*/
		type record 	HomeTestInit{
			UInt16 		reserved,
			Bit64 		homeInitCookie,
			MipOptionList 		mipOptions optional
		}
		with {
			encode "present=isEOF()== false && (valueOf(getTag('mobilityHeaderType'))==1);";
		}
		
		/*
		 * @desc Derived from  RFC3775 clause 6.1.4
		*/
		type record 	CareOfTestInit {
			UInt16 		reserved,
			Bit64 		careOfInitCookie,
			MipOptionList 		mipOptions optional
		}
		with {
			encode "present=isEOF()== false && (valueOf(getTag('mobilityHeaderType'))==2);";
		}


		/*
		 * @desc Derived from  RFC3775 clause 6.1.5
		*/
		type record 	HomeTest {
			UInt16 		homeNonceIndex,
			Bit64 		homeInitCookie,
			Bit64 		homeKeygenToken,
			MipOptionList 		mipOptions optional
		}
		with {
			encode "present=isEOF()== false && (valueOf(getTag('mobilityHeaderType'))==3);";
		}

		/*
		 * @desc Derived from  RFC3775 clause 6.1.6
		*/
		type record 	CareOfTest {
			UInt16 		careOfNonceIndex,
			Bit64 		careOfInitCookie,
			Bit64 		careOfKeygenToken,
			MipOptionList 		mipOptions optional
		}
		with {
			encode "present=isEOF()== false && (valueOf(getTag('mobilityHeaderType'))==4);";
		}

		/* 
		 * @desc Derived from RFC3775 clause 6.1.7
		 *       Valid mipOptions are only the Binding Authorization Data  
		 *       (mandatory in Binding Updates sent to a correspondent 
    	 *		 node), Nonce indicates option, and Alternate Care-of 
		 *	     Address options 
		*/
		type record 	BindingUpdate {
			UInt16 		sequenceNumber,
			UInt1		aFlag, // = acknowledge
			UInt1		hFlag, // = homeRegistration
			UInt1		lFlag, // = linkLocalAddressCompatiability
			UInt1		kFlag, // = keyManagementMobilityCapability,
			UInt12		reserved,
			UInt16		lifeTime,		
			MipOptionList mipOptions optional
		}
		with {
			encode "present=isEOF()== false && (valueOf(getTag('mobilityHeaderType'))==5);";
		}

		/*
		 * @desc Derived from  RFC3775 clause 6.1.8
		*/
		type record 	BindingAck{
			UInt8		status,
			UInt1		kFlag,//keyManagementMobilityCapability,
			UInt7		reserved,
			UInt16 		sequenceNumber,
			UInt16		lifeTime,		
			MipOptionList 	mipOptions
		}
		with {
			encode "present=isEOF()== false && (valueOf(getTag('mobilityHeaderType'))==6);";
		}

		/*
		 * @desc Derived from  RFC3775 clause 6.1.9
		*/
		type record 	BindingError {
			UInt8		status,
			UInt8		reserved,
			Oct16		homeAddress,		
			MipOptionList 	mipOptions optional
		}
		with {
			encode "present=isEOF()== false && (valueOf(getTag('mobilityHeaderType'))==7);";
		}
		
	} // end mipRFC3775Messages

	group mipOptions {
		
		type set length(1 .. c_maxMipOptions) of MipOption MipOptionList;

		type union MipOption {
			OptPad1							optPad1,
			OptPadN							optPadN,
			MipOptBindingRefreshAdvice		mipOptBindingRefreshAdvice,
			MipOptAltCoA					mipOptAltCoA,
			MipOptNonceIndices				mipOptNonceIndices,
			MipBindingAuthorizationData		mipBindingAuthorizationData
		}
		
		/*
		 * @desc Derived from RFC 3775 Section 6.2.2
		*/
	//	type record MipOptPad1 {
	//		UInt8		pad (0)
	//	}

		/* 
		 * @desc Derived from RFC3775 Section 6.2.3 For N octets of  
		 *       padding, the Option Length field should contain the value 
		 *       N-2 and a padding of N-2 zero-valued octets.
		*/
	//	type record MipOptPadN {
	//		UInt8	mipOptType (1),
	//		UInt8	mipOptLen,
	//		octetstring	padding 
	//	}

		/*
		 * @desc Derived from RFC3775 Section 6.2.4
		*/
		type record MipOptBindingRefreshAdvice {
			UInt8	mipOptType (2),
			UInt8	mipOptLen (2),
			UInt16	refreshInterval
		}
		with {
			encode "present=bytes(0,1,2);";
		}
		
		/*
		 * @desc Derived from RFC3775 Section 6.2.5
		*/
		type record MipOptAltCoA {
			UInt8	mipOptType (3),
			UInt8	mipOptLen (16),
			Oct16	alternateCoA
		}
		with {
			encode "present=bytes(0,1,3);";
		}

		/*
		 * @desc Derived from RFC3775 Section 6.2.6
		*/
		type record MipOptNonceIndices {
			UInt8	mipOptType (4),
			UInt8	mipOptLen (4),
			UInt16	homeNonceIndex,
			UInt16	careOfNonceIndex
		}
		with {
			encode "present=bytes(0,1,4);";
		}

		/*
		 * @desc Derived from RFC3775 Section 6.2.7. Note that the
		 *       authenticator value depends on the used author procedure.
		*/
		type record MipBindingAuthorizationData {
			UInt8	mipOptType (5),
			UInt8	mipOptLen,
			octetstring	authenticator 
		}
		with {
			encode "present=bytes(0,1,5);";
			encode (mipOptLen) "tag='mipOptLen';";
			encode (authenticator) "length=valueOf(getTag('mipOptLen'));";
		}
		
	} // end mipOptions

	group mipConstants {
		
		const UInt8 c_maxMipOptions:=10;

		group mipMessageValues {
			
			const UInt16 c_100TimeUnits := 100 ;
			const UInt16 c_zeroTimeUnits := 0 ;
			
		}//end group MipMessageValues

		group mipHeaderValues {		
			const UInt8	c_bindingRefreshRequest := 0;
			const UInt8	c_homeTestInit := 1;
			const UInt8	c_careOfTestInit := 2;
			const UInt8	c_homeTest := 3;
			const UInt8	c_careOfTest := 4;
			const UInt8	c_bindingUpdate := 5;
			const UInt8	c_bindingAck := 6;	
			const UInt8	c_bindingError := 7;
			//todo add alias headertype
		}

		
		/*
		*  @desc This values should be used in BindingAcknowledgement 
		*        messages 
		*/
		group statusCodesValues { 
			const UInt8 c_mipCodeBindingUpdateAccepted := 0;
			const UInt8 c_mipCodeAcceptedButPrefixDiscoveryNecessary := 1;
			const UInt8 c_mipCodeReasonUnspecified := 128;
			const UInt8 c_mipCodeAdministrativelyProhibited := 129;
			const UInt8 c_mipCodeInsufficientResources := 130;
			const UInt8 c_mipCodeHomeRegistrationNotSupported := 131;
			const UInt8 c_mipCodeNotHomeSubnet := 132;
			const UInt8 c_mipCodeNotHomeAgentForThisMobileNode := 133;
			const UInt8 c_mipCodeDuplicateAddressDetectionFailed := 134;
			const UInt8 c_mipCodeSequenceNumberOutofWindow := 135;
			const UInt8 c_mipCodeExpiredHomeNonceIndex := 136;
			const UInt8 c_mipCodeExpiredCareofNonceIndex := 137;
			const UInt8 c_mipCodeExpiredNonces := 138;
			const UInt8 c_mipCodeRegistrationTypeChangeDisallowed := 139;
		}	//end group statusCodesValues
		
	}//end 	group mipConstants

	
	

	
	}//end group mipHeader
	



} // end module LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues
+317 −0

File added.

Preview size limit exceeded, changes collapsed.

+23 −0
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module specifies common IP Authentication Header messages interchanges (= operations)
 *              for an Ipv6 test component.
 *              Functions do not set a test component verdict but instead
 *              use the function return value instead to notify the function
 *              caller about the success of the operation.
 *
 */
module LibIpv6_Rfc4302Ah_ExtHdrFunctions {

	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	import from LibCommon_VerdictControl { type FncRetCode };
	import from LibCommon_Time all;
	//LibIpv6
	
	//AtsIpv6
	
	
} // end module LibIpv6_Rfc4302Ah_ExtHdrFunctions
Loading