//
// $Copyright$
//
// $TAHI: ct/icmp/Err_Msg_Size_Time_Exc.def,v 1.3 2003/10/14 05:57:10 masaxmasa Exp $
//

#include "icmp.def"
#include "Fragment.def"

//----------------------------------------------------------------------
// Fragmented Echo Request
//----------------------------------------------------------------------

FEM_hdr_ipv6_exth( 
	echo_request_1st, 
	_HETHER_tn2nut,
	{
		_SRC(tnv6());
		_DST(nutv6());
	},
	{
		header = _HDR_IPV6_NAME(echo_request_1st);
		exthdr = frag_hdr_1st;
		upper = data;
	}
)

//----------------------------------------------------------------------
// Fragment header and data
//----------------------------------------------------------------------

Hdr_Fragment frag_hdr_1st {
	NextHeader = 58;
	FragmentOffset = 0;
	MFlag = 1;
	Identification = FRAG_ID_T;
}

Payload data { 
	data = substr(_PACKET_IPV6_NAME(echo_request), 40, 1232);
}

//----------------------------------------------------------------------
// Original packet
//----------------------------------------------------------------------

FEM_icmp6_echo_request(
	echo_request,
	_HETHER_tn2nut,
	{
		_SRC(tnv6());
		_DST(nutv6());
	},
	{
		payload = data_size_1452;
	}
)

//----------------------------------------------------------------------
// Time Exceeded and data
//----------------------------------------------------------------------

FEM_icmp6_time_exceeded(
	time_exceeded,
	_HETHER_nut2tn,
	{
		_SRC(nutv6());
		_DST(tnv6());
	},
	{
		Code = 1;       
//		payload = err;
		payload = any;
	}
)

FEM_icmp6_time_exceeded(
	time_exceeded_any,
	_HETHER_nut2tn,
	{
		_SRC(nutv6());
		_DST(tnv6());
	},
	{
		Code = 1;       
		payload = err;
	}
)

Payload err {
	data = left(_PACKET_IPV6_NAME(echo_request_1st), 1232);
}
