//
// $Copyright$
//
// $Name:  $
//
// $Id: RTU_A_DM_Inner_IPv6H.def,v 1.1.1.1 2000/10/31 22:38:51 sekiya Exp $
//

#include "./RTU_A_common.def"
//======================================================================
//
// AH/ESP definition
//


//======================================================================
//
// Real packet definition with IPsec AH
//

FEM_icmp6_echo_request(
	echo_request_on_net0_real1,
	hether_router2nut,
	{
		_SRC(v6(IPSEC_HOST1_NET4_ADDR));
		_DST(v6(IPSEC_HOST1_NET1_ADDR));
		HopLimit = 65; // Inner hoplimit will be modified to
	//	HopLimit = 64; // this value.
	},
	{
		payload = IPSEC_ECHO_DATA;
	}
)


FEM_hdr_ipv6_exth(
	ahtun_from_sg1_net2_real1 ,
	hether_router2nut,
	{
		_SRC(v6(IPSEC_SG1_NET2_ADDR));
		_DST(v6(IPSEC_NUT_NET0_ADDR));

	},
	{
		header = _HDR_IPV6_NAME(ahtun_from_sg1_net2_real1);
		exthdr = ah_from_sg_sn2;
		upper = _PACKET_IPV6_NAME(echo_request_on_net0_real1);
                                           // Inner IPv6 header hoplimit will be modified
	}
)


//======================================================================
//
// Modified packet definition with IPsec AH
//

// Common use Ether Header
Hdr_Ether hether_router2nut_0x86dd {
	SourceAddress=ether(IPSEC_ROUTER_NET0_MAC_ADDR);
	DestinationAddress=nutether();
	Type=0x86dd; // need to specify IPv6
}


// Inner IPv6 hoplimit is modified
Frame_Ether ahtun_from_sg1_net2_dm_inner_ipv6h_hlim_echo_request_from_host1_net4_to_host1_net1_on_net0 {
	header=hether_router2nut_0x86dd;
	packet=echo_request_from_host1_ah_modpkt1;
}

Payload echo_request_from_host1_ah_modpkt1 {
	data=substr(ahtun_from_sg1_net2_real1, 14, 64); // Tunnel Outer packet
	data=substr(ahtun_from_sg1_net2_real1, 78, 7);  // Tunnel Inner packet
	data=64; // modify HopLimit 65->64
	data=right(ahtun_from_sg1_net2_real1, 86);      // Tunnel Inner packet

}


//end





