LibIpv6_Rfc2463Icmpv6_TypesAndValues.ttcn 5.44 KB
Newer Older
alex's avatar
alex committed
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module defines the ICMPv6 message types and 
 *              their information elements using types from the 
 *              Common and Ipv6 library. Also it provides some useful  
 *              constant definitions.
 *              All types have been defined on the basis of RFC 2463
 *  @url        http://www.ietf.org/rfc/rfc2463.txt
 *  
 */
 module LibIpv6_Rfc2463Icmpv6_TypesAndValues {
	
	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	//LibIpv6
	import from LibIpv6_MultiRfcs_TypesAndValues all ;
	import from LibIpv6_Rfc2460Root_TypesAndValues all ;

	group IcmpCodes {
		const UInt8  c_icmpCode0 := 0 ;
		const UInt8  c_icmpCode1 := 1 ;
		const UInt8  c_icmpCode2 := 2 ;
		const UInt8  c_icmpCode3 := 3 ;
		const UInt8  c_icmpCode4 := 4 ;
		const UInt8  c_icmpCode5 := 5 ;
		const UInt8	 c_icmpCode255 := 255 ;
	}

	group rfc2463MessageIds {
		const UInt8	c_destinationUnreachable := 1;
		const UInt8	c_packetTooBig := 2;
		const UInt8 c_timeExceeded := 3;
		const UInt8 c_parameterProblem := 4;
		const UInt8 c_echoRequest := 128;
		const UInt8 c_echoReply := 129;
	} // end group rfc2463MessageIds

	group IcmpPointers {
		const UInt32  c_icmpPointer4 := 4;
		const UInt32  c_icmpPointer6 := 6;
		const UInt32  c_icmpPointer40 := 40;
		const UInt32  c_icmpPointer41 := 41;
		const UInt32  c_icmpPointer42 := 42;
		const UInt32  c_icmpPointer43 := 43;
peter's avatar
peter committed
		const UInt32  c_icmpPointer46 := 46;
alex's avatar
alex committed
	}
	
	group icmpRfc2463MessageTypes {	

		/*
		 * @desc PDU type derived from RFC2463 clause 3.1
alex's avatar
alex committed
		*/
		type record DestinationUnreachable {
			Ipv6Header			ipv6Hdr,
			ExtensionHeaderList extHdrList optional,
			UInt8 		icmpType(c_destinationUnreachable),
			UInt8 		icmpCode,
			Oct2		checksum,
			Oct4		unused,
			octetstring	data optional
		}
validator's avatar
""  
validator committed
		with {
			encode "isPDU=LibIpv6_Rfc2463Icmpv6_TypesAndValues;use=com.testingtech.ttcn.tci.codec.helper.*;present=SupportFunctions.checkHeaderAndType(dec, 58, 1)";
			encode (data) "length=getIntTag('IPv6Header_payloadLength')-8";
validator's avatar
""  
validator committed
		}
alex's avatar
alex committed
		
		
		/*
		 * @desc PDU type derived from RFC2463 clause 3.2
alex's avatar
alex committed
		*/
		type record PacketTooBig {
			Ipv6Header			ipv6Hdr,
			ExtensionHeaderList extHdrList optional,
			UInt8 		icmpType(c_packetTooBig),
			UInt8 		icmpCode,
			Oct2 		checksum,
			UInt32		mtu,
			octetstring	data optional
		}
validator's avatar
""  
validator committed
		with {
			encode "isPDU=LibIpv6_Rfc2463Icmpv6_TypesAndValues;use=com.testingtech.ttcn.tci.codec.helper.*;present=SupportFunctions.checkHeaderAndType(dec, 58, 2)";
			encode (data) "length=getIntTag('IPv6Header_payloadLength')-8";
validator's avatar
""  
validator committed
		}
alex's avatar
alex committed
		
		
		/*
		 * @desc PDU type derived from RFC2463 clause 3.3
alex's avatar
alex committed
		*/
		type record TimeExceeded {
			Ipv6Header			ipv6Hdr,
			ExtensionHeaderList extHdrList optional,
			UInt8 	icmpType(c_timeExceeded),
			UInt8 	icmpCode,
			Oct2 	checksum,
			UInt32	unused(0), //always zero
			octetstring	data optional
		}
validator's avatar
""  
validator committed
		with {
			encode "isPDU=LibIpv6_Rfc2463Icmpv6_TypesAndValues;use=com.testingtech.ttcn.tci.codec.helper.*;present=SupportFunctions.checkHeaderAndType(dec, 58, 3)";
			encode (data) "length=getIntTag('IPv6Header_payloadLength')-8";
validator's avatar
""  
validator committed
		}
		 * @desc PDU type derived from RFC2463 clause 3.4
alex's avatar
alex committed
		*/
		type record ParameterProblem {
			Ipv6Header			ipv6Hdr,
			ExtensionHeaderList extHdrList optional,
			UInt8 		icmpType(c_parameterProblem),
			UInt8 		icmpCode,
			Oct2 		checksum,
			UInt32		pointer,
			octetstring	data optional
		}
validator's avatar
""  
validator committed
		with {
			encode "isPDU=LibIpv6_Rfc2463Icmpv6_TypesAndValues;use=com.testingtech.ttcn.tci.codec.helper.*;present=SupportFunctions.checkHeaderAndType(dec, 58, 4)";
			encode (data) "length=getIntTag('IPv6Header_payloadLength')-8";
validator's avatar
""  
validator committed
		}
		 * @desc PDU type derived from RFC2463 clause 4.1
alex's avatar
alex committed
		*/
		type record EchoRequest {
			Ipv6Header			ipv6Hdr,
			ExtensionHeaderList extHdrList optional,
			UInt8 		icmpType(c_echoRequest),
			UInt8 		icmpCode,
			Oct2 		checksum,
			UInt16		identifier,
			UInt16 		sequenceNumber,
			octetstring	data optional
		}
validator's avatar
""  
validator committed
		with {
			encode "isPDU=LibIpv6_Rfc2463Icmpv6_TypesAndValues;use=com.testingtech.ttcn.tci.codec.helper.*;present=SupportFunctions.checkHeaderAndType(dec, 58, 128)";
			encode (data) "length=getIntTag('IPv6Header_payloadLength')-8";
validator's avatar
""  
validator committed
		}
		 * @desc PDU type derived from RFC2463 clause 4.2
alex's avatar
alex committed
		*/
		type record EchoReply {
			Ipv6Header			ipv6Hdr,
			ExtensionHeaderList extHdrList optional,
			UInt8 		icmpType(c_echoReply),
			UInt8 		icmpCode,
			Oct2 		checksum,
			UInt16		identifier,
			UInt16 		sequenceNumber,
			octetstring	data optional
		}
validator's avatar
""  
validator committed
		with {
			encode "isPDU=LibIpv6_Rfc2463Icmpv6_TypesAndValues;use=com.testingtech.ttcn.tci.codec.helper.*;present=SupportFunctions.checkHeaderAndType(dec, 58, 129)";
			encode (data) "length=getIntTag('IPv6Header_payloadLength')-8";
validator's avatar
""  
validator committed
		}
alex's avatar
alex committed
		
		/*
		 * @desc Generic Icmpv6 header
alex's avatar
alex committed
		*/
		type record OtherIcmpv6Hdr {
			Ipv6Header			ipv6Hdr,
			ExtensionHeaderList extHdrList optional,
			UInt8 		icmpType,
			UInt8 		icmpCode,
			Oct2 		checksum,
			octetstring	data optional
		}
validator's avatar
""  
validator committed
		with {
			encode "isPDU=LibIpv6_Rfc2463Icmpv6_TypesAndValues;use=com.testingtech.ttcn.tci.codec.helper.*;present=SupportFunctions.checkHeader(dec, 58)";
			encode (data) "length=getIntTag('IPv6Header_payloadLength')-4";
validator's avatar
""  
validator committed
		}
alex's avatar
alex committed
		

	} // end icmpRfc2463Packets
	
} // end module LibIpv6_Rfc2463Icmpv6_TypesAndValues