//
// Copyright (C) 1999,2000 Yokogawa Electric Corporation and
//                         YDC Corporation.
// All rights reserved.
// 
// Redistribution and use of this software in source and binary
// forms, with or without modification, are permitted provided that
// the following conditions and disclaimer are agreed and accepted
// by the user:
// 
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
// 
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in
//    the documentation and/or other materials provided with
//    the distribution.
// 
// 3. Neither the names of the copyrighters, the name of the project
//    which is related to this software (hereinafter referred to as
//    "project") nor the names of the contributors may be used to
//    endorse or promote products derived from this software without
//    specific prior written permission.
// 
// 4. No merchantable use may be permitted without prior written
//    notification to the copyrighters.
// 
// 5. The copyrighters, the project and the contributors may prohibit
//    the use of this software at any time.
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHTERS, THE PROJECT AND
// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING
// BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.  IN NO EVENT SHALL THE
// COPYRIGHTERS, THE PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// $Id: acceptTooBigMesg.def,v 1.1.1.1 2000/10/31 22:39:41 sekiya Exp $

#include "PMTUaddress.def"
#include "PMTU.def"

Payload invoke_data {
         data=repeat(0xff,1452);
}

/***********************************************************

 Test set MTU 1300

***********************************************************/

//
// Too Big Mesg
//

Payload invoke_data_1350 {
         data=repeat(0xff,1302);
}

PMTU_echo_request_tn2nut_GLOBALADDR(EchoRequest_1300,invoke_data_1350)

PMTU_echo_reply_nut2tn_GLOBALADDR(EchoReply_1300,invoke_data_1350)

FEM_icmp6_packet_too_big(
	icmp6_TooBigMesg_1300,
	_HETHER_tn2nut,
        	{
		_SRC(tnv6());
                _DST(v6merge(   NUT_GLOBAL_UCAST_PRFX, 
                                GLOBAL_UCAST_PRFXLEN, 
                                nutv6())); 
	},
		{
		MTU=1300;
		payload=invoking_packet;
	}
)
 
Payload invoking_packet {
	data=substr(_PACKET_IPV6_NAME(EchoReply_1300),0,1232);
}


//
// Smaller Fragment Echo Request
//
Payload smaller_data_1300 {
         data=repeat(0xff,1251);
}

PMTU_echo_request_tn2nut_GLOBALADDR(smaller_frame_1300,smaller_data_1300)

PMTU_fragment_tn2nut_GLOBALADDR( 
         frag_smaller_1st_1300, 
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=2147483648;
         },
                { 
        data=substr(_PACKET_IPV6_NAME(smaller_frame_1300),40,800);
         } 
) 

PMTU_fragment_tn2nut_GLOBALADDR( 
         frag_smaller_2nd_1300, 
                {
                NextHeader=58;
                FragmentOffset=100;
                MFlag=0;
                Identification=2147483648;
        },
                { 
        data=substr(_PACKET_IPV6_NAME(smaller_frame_1300),840,459);
         } 
)

PMTU_echo_reply_nut2tn_GLOBALADDR(receive_smaller_reply_1300,smaller_data_1300)

//
// Even Fragment Echo Request
//
Payload even_data_1300 {
         data=repeat(0xff,1252);
}

PMTU_echo_request_tn2nut_GLOBALADDR(even_frame_1300,even_data_1300)

PMTU_fragment_tn2nut_GLOBALADDR(
         frag_even_1st_1300,
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=2147483649;
         },
                {
        data=substr(_PACKET_IPV6_NAME(even_frame_1300),40,800);
         } 
)

PMTU_fragment_tn2nut_GLOBALADDR(
         frag_even_2nd_1300,
                {
                NextHeader=58;
                FragmentOffset=100;
                MFlag=0;
                Identification=2147483649;
        },
                {
        data=substr(_PACKET_IPV6_NAME(even_frame_1300),840,460);
         }
)

PMTU_echo_reply_nut2tn_GLOBALADDR(receive_even_reply_1300,even_data_1300)

//
// Bigger Fragment Echo Request
//
Payload bigger_data_1300 {
         data=repeat(0xff,1253);
}

PMTU_echo_request_tn2nut_GLOBALADDR(bigger_frame_1300,bigger_data_1300)

PMTU_fragment_tn2nut_GLOBALADDR(
         frag_bigger_1st_1300,
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=2147483640;
         },
                {
        data=substr(_PACKET_IPV6_NAME(bigger_frame_1300),40,800);
         } 
)

PMTU_fragment_tn2nut_GLOBALADDR(
         frag_bigger_2nd_1300,
                {
                NextHeader=58;
                FragmentOffset=100;
                MFlag=0;
                Identification=2147483640;
        },
                {
        data=substr(_PACKET_IPV6_NAME(bigger_frame_1300),840,461);
         }
)

PMTU_echo_reply_nut2tn_GLOBALADDR(receive_bigger_reply_1300,bigger_data_1300)

PMTU_fragment_nut2tn_GLOBALADDR(
         frag_bigger_reply_1st_1300,
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=any;
         },
                {
        data=substr(_PACKET_IPV6_NAME(receive_bigger_reply_1300),40,1248);
         } 
)

PMTU_fragment_nut2tn_GLOBALADDR(
         frag_bigger_reply_2nd_1300,
                 {
                 NextHeader=58;
                 FragmentOffset=156;
                 MFlag=0;
                 Identification=any;
         },
                {
        data=substr(_PACKET_IPV6_NAME(receive_bigger_reply_1300),1288,13);
         } 
)

/***********************************************************

 Test set MTU 1400 

***********************************************************/

//
// Too Big Mesg
//
PMTU_echo_request_tn2nut_GLOBALADDR(EchoRequest_1400,invoke_data)

PMTU_echo_reply_nut2tn_GLOBALADDR(EchoReply_1400,invoke_data)

FEM_icmp6_packet_too_big(
	icmp6_TooBigMesg_1400,
	_HETHER_tn2nut,
        	{
		_SRC(tnv6());
                _DST(v6merge(   NUT_GLOBAL_UCAST_PRFX, 
                                GLOBAL_UCAST_PRFXLEN, 
                                nutv6())); 
	},
		{
		MTU=1400;
		payload=invoking_packet;
	}
)

//
// Smaller Fragment Echo Request
//
Payload smaller_data_1400 {
         data=repeat(0xff,1351);
}

PMTU_echo_request_tn2nut_GLOBALADDR(smaller_frame_1400,smaller_data_1400)

PMTU_fragment_tn2nut_GLOBALADDR( 
         frag_smaller_1st_1400, 
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=2147483648;
         },
                { 
        data=substr(_PACKET_IPV6_NAME(smaller_frame_1400),40,800);
         } 
) 

PMTU_fragment_tn2nut_GLOBALADDR( 
         frag_smaller_2nd_1400, 
                {
                NextHeader=58;
                FragmentOffset=100;
                MFlag=0;
                Identification=2147483648;
        },
                { 
        data=substr(_PACKET_IPV6_NAME(smaller_frame_1400),840,559);
         } 
)

PMTU_echo_reply_nut2tn_GLOBALADDR(receive_smaller_reply_1400,smaller_data_1400)

//
// Even Fragment Echo Request
//
Payload even_data_1400 {
         data=repeat(0xff,1352);
}

PMTU_echo_request_tn2nut_GLOBALADDR(even_frame_1400,even_data_1400)

PMTU_fragment_tn2nut_GLOBALADDR(
         frag_even_1st_1400,
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=2147483649;
         },
                {
        data=substr(_PACKET_IPV6_NAME(even_frame_1400),40,800);
         } 
)

PMTU_fragment_tn2nut_GLOBALADDR(
         frag_even_2nd_1400,
                {
                NextHeader=58;
                FragmentOffset=100;
                MFlag=0;
                Identification=2147483649;
        },
                {
        data=substr(_PACKET_IPV6_NAME(even_frame_1400),840,560);
         }
)

PMTU_echo_reply_nut2tn_GLOBALADDR(receive_even_reply_1400,even_data_1400)

//
// Bigger Fragment Echo Request
//
Payload bigger_data_1400 {
         data=repeat(0xff,1353);
}

PMTU_echo_request_tn2nut_GLOBALADDR(bigger_frame_1400,bigger_data_1400)

PMTU_fragment_tn2nut_GLOBALADDR(
         frag_bigger_1st_1400,
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=2147483640;
         },
                {
        data=substr(_PACKET_IPV6_NAME(bigger_frame_1400),40,800);
         } 
)

PMTU_fragment_tn2nut_GLOBALADDR(
         frag_bigger_2nd_1400,
                {
                NextHeader=58;
                FragmentOffset=100;
                MFlag=0;
                Identification=2147483640;
        },
                {
        data=substr(_PACKET_IPV6_NAME(bigger_frame_1400),840,561);
         }
)

PMTU_echo_reply_nut2tn_GLOBALADDR(receive_bigger_reply_1400,bigger_data_1400)

PMTU_fragment_nut2tn_GLOBALADDR(
         frag_bigger_reply_1st_1400,
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=any;
         },
                {
        data=substr(_PACKET_IPV6_NAME(receive_bigger_reply_1400),40,1352);
         } 
)

PMTU_fragment_nut2tn_GLOBALADDR(
         frag_bigger_reply_2nd_1400,
                 {
                 NextHeader=58;
                 FragmentOffset=169;
                 MFlag=0;
                 Identification=any;
         },
                {
        data=substr(_PACKET_IPV6_NAME(receive_bigger_reply_1400),1392,9);
         } 
)


/***********************************************************

  check NUT ignore invalid MTU 

***********************************************************/

// Packet Too Big Message (MTU==1450)


PMTU_echo_request_tn2nut_GLOBALADDR(EchoRequest_1450,invoke_data)

FEM_icmp6_packet_too_big(
        icmp6_TooBigMesg_1450,
        _HETHER_tn2nut,
                {
                _SRC(tnv6());
                _DST(v6merge(   NUT_GLOBAL_UCAST_PRFX, 
                                GLOBAL_UCAST_PRFXLEN, 
                                nutv6())); 
        },
                {
                MTU=1450;
                payload=invoking_packet;
        }
)
 

// Packet Too Big Message (MTU==1200)

Payload invoke_data_1200 {
	data=repeat(0xfe,1252);
}

PMTU_echo_request_tn2nut_GLOBALADDR(EchoRequest_1200,invoke_data_1200)

PMTU_echo_reply_nut2tn_GLOBALADDR(EchoReply_1200,invoke_data_1200)

FEM_icmp6_packet_too_big(
        icmp6_TooBigMesg_1200,
        _HETHER_tn2nut,
                {
                _SRC(tnv6());
                _DST(v6merge(   NUT_GLOBAL_UCAST_PRFX, 
                                GLOBAL_UCAST_PRFXLEN, 
                                nutv6())); 
        },
                {
                MTU=1200;
                payload=invoking_packet_1200;
        }
)
 
Payload invoking_packet_1200 {
        data=substr(_PACKET_IPV6_NAME(EchoReply_1200),0,1232);
}
//
// Fragment Echo Request (packet size : 1280)
//
Payload frag_data_1280 {
         data=repeat(0xff,1232);
}

PMTU_echo_request_tn2nut_GLOBALADDR(frag_frame_1280,frag_data_1280)

PMTU_fragment_tn2nut_GLOBALADDR( 
         frag_1280_1st, 
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=2000483648;
         },
                { 
        data=substr(_PACKET_IPV6_NAME(frag_frame_1280),40,800);
         } 
) 

PMTU_fragment_tn2nut_GLOBALADDR( 
         frag_1280_2nd, 
                {
                NextHeader=58;
                FragmentOffset=100;
                MFlag=0;
                Identification=2000483648;
        },
                { 
        data=substr(_PACKET_IPV6_NAME(frag_frame_1280),840,440);
         } 
)

PMTU_echo_reply_nut2tn_GLOBALADDR(reply_1280,frag_data_1280)

PMTU_fragment_nut2tn_GLOBALADDR(
         frag_1280_reply_1st,
                 {
                 NextHeader=58;
                 FragmentOffset=0;
                 MFlag=1;
                 Identification=any;
         },
                {
        data=substr(_PACKET_IPV6_NAME(reply_1280),40,1152);
         } 
)

PMTU_fragment_nut2tn_GLOBALADDR(
         frag_1280_reply_2nd,
                 {
                 NextHeader=58;
                 FragmentOffset=144;
                 MFlag=0;
                 Identification=any;
         },
                {
        data=substr(_PACKET_IPV6_NAME(reply_1280),1192,88);
         } 
)

