Commit dbc77ae5 authored by mullers's avatar mullers
Browse files

fx_calcIpv4Hcs added

parent 35d04a1b
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -66,16 +66,17 @@
	return Oct2;
	return Oct2;


	/* @desc   Calculates the checksum over the IPv4 payload
	/* @desc   Calculates the checksum over the IPv4 payload
	 * @param  p_srcAddress Source Address
	 * @param  p_dstAddress Destination Address
	 * @param  p_payload Checksum is calculated over this
	 * @param  p_payload Checksum is calculated over this
	 * @param  p_nextHeader Needed for the checksum calculation
	 * @return checksum value
	 * @return checksum value
	*/
	*/
	external function fx_calcIpv4PayloadChecksum(in template Ipv4Address p_srcAddress,	
	external function fx_calcIpv4PayloadChecksum(in template Ipv4Payload p_payload) 
												 in template Ipv4Address p_dstAddress, 
	return Oct2;
												 in template Ipv4Payload p_payload,

												 in UInt8 p_nextHeader) 
	/* @desc   Calculates the header checksum (HCS) over the IPv4 header
	 * @param  p_ipv4Header Checksum is calculated over this
	 * @return checksum value
	*/
	external function fx_calcIpv4Hcs(in template Ipv4Header p_ipv4Header) 
	return Oct2;
	return Oct2;
	
	
	/* @desc 	This external function runs the Ipv6Packet through Codec and returns 
	/* @desc 	This external function runs the Ipv6Packet through Codec and returns 
+6 −4
Original line number Original line Diff line number Diff line
@@ -1219,10 +1219,12 @@ group rfc791Fns {


		// Compute payload checksum (Icmpv6, UDP, ...)
		// Compute payload checksum (Icmpv6, UDP, ...)
		v_ipPkt.ipv4Payload.ipv4EchoRequestMsg.checksum := fx_calcIpv4PayloadChecksum (
		v_ipPkt.ipv4Payload.ipv4EchoRequestMsg.checksum := fx_calcIpv4PayloadChecksum (
			v_ipPkt.ipv4Hdr.sourceAddress,
			v_ipPkt.ipv4Payload
			v_ipPkt.ipv4Hdr.destinationAddress,
		);
			v_ipPkt.ipv4Payload,

			c_icmpHdr //TODO verify if 58 is valid in IPv4
		// Compute header checksum (HCS)
		v_ipPkt.ipv4Hdr.hcs := fx_calcIpv4Hcs (
			v_ipPkt.ipv4Hdr
		);
		);
		
		
		//send
		//send
+1 −1
Original line number Original line Diff line number Diff line
@@ -1186,7 +1186,7 @@ group ipv4Definitions {
		const UInt4		c_ipv4Version := 4;
		const UInt4		c_ipv4Version := 4;


		/*
		/*
		 * @desc Derived from RFC 2460 Section 3
		 * @desc Derived from RFC 791
		 * @url http://www.ietf.org/rfc/rfc2460.txt
		 * @url http://www.ietf.org/rfc/rfc2460.txt
		*/
		*/
		type record Ipv4Header 	{
		type record Ipv4Header 	{
+6 −4
Original line number Original line Diff line number Diff line
@@ -56,10 +56,12 @@


		// Compute payload checksum (Icmpv6, UDP, ...)
		// Compute payload checksum (Icmpv6, UDP, ...)
		v_ipPkt.ipv4Payload.ipv4EchoRequestMsg.checksum := fx_calcIpv4PayloadChecksum (
		v_ipPkt.ipv4Payload.ipv4EchoRequestMsg.checksum := fx_calcIpv4PayloadChecksum (
			v_ipPkt.ipv4Hdr.sourceAddress,
			v_ipPkt.ipv4Payload
			v_ipPkt.ipv4Hdr.destinationAddress,
		);
			v_ipPkt.ipv4Payload,

			c_icmpHdr //TODO verify if 58 is valid in IPv4
		// Compute header checksum (HCS)
		v_ipPkt.ipv4Hdr.hcs := fx_calcIpv4Hcs (
			v_ipPkt.ipv4Hdr
		);
		);
		
		
		//send
		//send