Commit 8cdb4664 authored by mullers's avatar mullers
Browse files

upload of outstanding Esp TCs, all done now

parent 9912300d
Loading
Loading
Loading
Loading
+151 −1
Original line number Diff line number Diff line
@@ -442,6 +442,156 @@ group IcmpAndEspFns {

	} // end f_echoProcWithEsp

	/*
	 * @desc  	EchoProcedure With Esp Hdr, reply to Echo Request
	 * @param	p_paramsTn Address Information of the TN
	 * @param	p_paramsIut Address Information of the IUT
	 * @param	p_paramsTunnelStart Address Information of the Tunnel Start
	 * @param	p_paramsTunnelEnd Address Information of the Tunnel End
	 */
	function f_replyToEchoReq_transportMode (
		template Ipv6NodeParams p_paramsTn,
		template Ipv6NodeParams p_paramsIut,
		UInt32 p_seqNr)
	runs on Ipv6Node
	return FncRetCode {
		var FncRetCode v_ret := e_error;

		if (vc_sad[0].ipSecProtocolMode != e_transportMode) {
			log("**** f_replyToEchoReq_transportMode; Error SA does not indicate transport Mode, but transport Mode is required****");
			return e_error;
		}

		tc_ac.start;
		alt {
			[]	ipPort.receive ( 	
					m_echoRequest_esp (
						c_espHdr,
						p_paramsIut.gla,
						p_paramsTn.gla,
						m_extHdrList_1Elem (
							mw_extHdr_espHeader(
								vc_sad[0].spi,
								p_seqNr,
								m_espIpDatagram(
									omit,
									m_ipv6Payload_echoRequestMsg(
										mw_echoRequestMsg(
											c_defId,
											c_defSeqNo))),
								c_icmpHdr))
						)) {
					tc_ac.stop;	
					v_ret := e_success;
			}
			[]	tc_ac.timeout{
				v_ret := e_timeout;
			}		
		} // end alt
		if (v_ret != e_success) {return v_ret;}

		v_ret := f_sendEchoRequestWithEsp (
			m_echoRequest_esp (
				c_espHdr,
				p_paramsTn.gla,
				p_paramsIut.gla,
				m_extHdrList_1Elem (
					m_extHdr_espHeader(
						vc_sad[0].spi,
						p_seqNr + 1,
						m_espIpDatagram(
							omit,
							m_ipv6Payload_echoRequestMsg(
								m_echoRequestMsg(
									c_defId,
									c_defSeqNo))),
						c_icmpHdr))
			 ) );

		return v_ret;

	} // end f_replyToEchoReq_transportMode

		/*
	 * @desc  	EchoProcedure With Esp Hdr, reply to EchoReq tunnelMode
	 * @param	p_paramsTn Address Information of the TN
	 * @param	p_paramsIut Address Information of the IUT
	 * @param	p_paramsTunnelStart Address Information of the Tunnel Start
	 * @param	p_paramsTunnelEnd Address Information of the Tunnel End
	 */
	function f_replyToEchoReq_tunnelMode (
		template Ipv6NodeParams p_paramsTn,
		template Ipv6NodeParams p_paramsIut,
		template Ipv6NodeParams p_paramsTunnelStart,//tunnel starts not at IUT, but at TN
		template Ipv6NodeParams p_paramsTunnelEnd,
		UInt32 p_seqNr)
	runs on Ipv6Node
	return FncRetCode {
		var FncRetCode v_ret := e_error;

		if (vc_sad[0].ipSecProtocolMode != e_tunnelMode) {
			log("**** f_replyToEchoReq_tunnelMode; Error SA does not indicate tunnel Mode, but tunnel Mode is required****");
			return e_error;
		}
			
		tc_ac.start;
		alt {
			[]	ipPort.receive ( 	
					m_echoRequest_esp (
						c_espHdr,
						p_paramsTunnelEnd.gla,
						p_paramsTunnelStart.gla,
						mw_extHdrList_1Elem_superSet (
							mw_extHdr_espHeader(
								vc_sad[0].spi,
								p_seqNr,
								m_espIpDatagram(
									m_extHdrList_1Elem(
										mw_extHdr_tunneledHeader (
											c_icmpHdr,
											p_paramsIut.gla,
											p_paramsTn.gla )),
									m_ipv6Payload_echoRequestMsg(
										mw_echoRequestMsg(
											c_defId,
											c_defSeqNo))),
								c_tunneledIpHdr))
						)) {
					tc_ac.stop;	
					v_ret := e_success;
			}
			[]	tc_ac.timeout{
				v_ret := e_timeout;
			}		
		} // end alt
		if (v_ret != e_success) {return v_ret;}

		v_ret := f_sendEchoRequestWithEsp (
			m_echoRequest_esp (
				c_espHdr,
				p_paramsTunnelStart.gla,
				p_paramsTunnelEnd.gla,
				m_extHdrList_1Elem (
					m_extHdr_espHeader(
						vc_sad[0].spi,
						p_seqNr + 1,
						m_espIpDatagram(
							m_extHdrList_1Elem(
								m_extHdr_tunneledHeader (
									c_icmpHdr,
									p_paramsTn.gla,
									p_paramsIut.gla )),
							m_ipv6Payload_echoRequestMsg(
								m_echoRequestMsg(
									c_defId,
									c_defSeqNo))),
						c_tunneledIpHdr))
			 ) );

		return v_ret;

	} // end f_replyToEchoReq_tunnelMode
		
}//end IcmpAndEspFns