//
// Copyright (C) 2002, 2003 Yokogawa Electric Corporation, 
// INTAP(Interoperability Technology Association for Information 
// Processing, Japan), IPA (Information-technology Promotion Agency, Japan).
// 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. However, using this software for the 
// purpose of testing or evaluating any products including merchantable 
// products may be permitted without any notification to the copyrighters.
// 
// 
// 
// 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: LLA_SAA.def,v 1.1 2003/06/10 06:47:36 miyata Exp $
//
//  This file has some basic definition and frames for DAD test about
//  any tentative address, and may be included from other *.def files.
//
// DADV6ADDR              : v6 Tentative address for DAD
// NUT_HasNoLLOCAL        : if defined NUT has no link-local address
// DADNA_SRC              : IPv6 src address of DAD NA
// dadns_from_NUT         : DAD NS coming from NUT on DAD
// chkconf_dadns_to_NUT   : DAD NS send to NUT to check if address is configured
// chkconf_dadna_from_NUT : DAD NA coming from NUT if addrss is configured
//
// 

#include "SAA.def"


//
// Ethernet Part
//

_HETHER_define(hether_nut2tentsolnode,
	       nutether(), _ETHER_SOLNODE_MCAST(nutv6()))
_HETHER_define(hether_tn2tentsolnode,
	       tnether(), _ETHER_SOLNODE_MCAST(nutv6()))
_HETHER_define(hether_tn2nutsolnode,
	       tnether(), _ETHER_SOLNODE_MCAST(nutv6()))

//
// IPv6 Part
//

//
// DADNS_from_NUT
//  Description: 
//    DAD NS coming from NUT on DAD
//  Spec:
//    valid DAD NS

FEM_ADDRCONF_dadns(DADNS_from_NUT, hether_nut2tentsolnode,
		   DestinationAddress=_IPV6_SOLNODE_MCAST(nutv6());
		   ,
		   TargetAddress=nutv6(); // Tentative Address
                   )


//
// DADNS_from_TN_SameTgt
//  Description: 
//    DAD NS send to NUT to check if address is configured
//  Spec:
//    valid DAD NS

FEM_ADDRCONF_dadns(DADNS_from_TN_SameTgt, hether_tn2tentsolnode,
		   DestinationAddress=_IPV6_SOLNODE_MCAST(nutv6());
		   ,
		   TargetAddress=nutv6(); // Tentative Address
                   )

//
// DADNS_from_TN_DiffTgt
//  Description: 
//    DAD NS send to NUT to check independency
//  Spec:
//    valid DAD NS

FEM_ADDRCONF_dadns(DADNS_from_TN_DiffTgt, hether_tn2tentsolnode,
		   DestinationAddress=_IPV6_SOLNODE_MCAST(tnv6());
		   ,
		   TargetAddress=tnv6(); // Tentative Address
                   )


//
// DADNA_from_NUT
//  Description: 
//    DAD NA coming from NUT if addrss is configured
//  Spec:
//    valid DAD NA
//    NUT is a host 

FEM_ADDRCONF_dadna(DADNA_from_NUT, _HETHER_nut2allnodes,
		   SourceAddress=nutv6();
		   ,
	           TargetAddress=nutv6();
	           option=_TLLOPT_nut;
		   )

//
// DADNA_from_NUT_woTLL
//  Description: 
//    DAD NA coming from NUT if addrss is configured
//  Spec:
//    valid DAD NA
//    NUT is a host 

FEM_ADDRCONF_dadna(DADNA_from_NUT_woTLL, _HETHER_nut2allnodes,
		   SourceAddress=nutv6();
		   ,
	           TargetAddress=nutv6();
		   )

//
// DADNA_from_TN_SameTgt
//  Description: 
//    DAD NA Transmitted by TN which has Target address same as NUT
//  Spec:
//    valid DAD NA
// 

FEM_ADDRCONF_dadna(DADNA_from_TN_SameTgt, _HETHER_tn2allnodes,
		   SourceAddress=nutv6();
		   ,
	           TargetAddress=nutv6();
	           option=_TLLOPT_tn;
		   )

//
// DADNA_from_TN_DiffTgt
//  Description: 
//    DAD NA Transmitted by TN which has Target address same as NUT
//  Spec:
//    valid DAD NA
//

FEM_ADDRCONF_dadna(DADNA_from_TN_DiffTgt, _HETHER_tn2allnodes,
		   SourceAddress=tnv6();
		   ,
	           TargetAddress=tnv6();
	           option=_TLLOPT_tn;
		   )


//
// SOLNS_from_TN_SameTgt
//  Description: 
//    Address resolution NS send to NUT to check if address is configured
//  Spec:
//    valid DAD NS

FEM_icmp6_ns (
        SOLNS_from_TN_SameTgt,
        hether_tn2nutsolnode,
                {
                _SRC(tnv6());
                _DST(_IPV6_SOLNODE_MCAST(nutv6()));
                HopLimit=255;
        },
                {
                TargetAddress=nutv6();
                option=_SLLOPT_tn;
        }
)


//
// na
// NUT's link local address
//           to  
// TN's link local  address
//
// Targetaddress TN's link local address
 
FEM_icmp6_na (
        NA_from_NUT,
        _HETHER_nut2tn,
                {
                _SRC(nutv6());
                _DST(tnv6());
                HopLimit=255;
        },
                {
                RFlag=RFLAG;
                SFlag=1;
                OFlag=1;
                TargetAddress=nutv6();
                option=_TLLOPT_nut;
        }
)

//
// na
// NUT's link local address
//           to  
// TN's link local  address
//
// Targetaddress TN's link local address
 
FEM_icmp6_na (
        NA_from_NUT_woTLL,
        _HETHER_nut2tn,
                {
                _SRC(nutv6());
                _DST(tnv6());
                HopLimit=255;
        },
                {
                RFlag=RFLAG;
                SFlag=1;
                OFlag=1;
                TargetAddress=nutv6();
        }
)

//
// DADNS_from_TN_SameTgt w/ HopLimit=254
//  Description: 
//    DAD NS send to NUT to check if address is configured
//  Spec:
//    invalid DAD NS

FEM_icmp6_ns (
        NS_from_TN_SrcDstUni,
        _HETHER_tn2nut,
                {
                _SRC(tnv6());
                _DST(nutv6());
                HopLimit=255;
        },
                {
                TargetAddress=nutv6();
        }
)

//
// DADNS_from_TN_SameTgt w/ HopLimit=254
//  Description: 
//    DAD NS send to NUT to check if address is configured
//  Spec:
//    invalid DAD NS

FEM_icmp6_ns (
        DADNS_from_TN_HL254,
        hether_tn2tentsolnode,
                {
                _SRC(v6(_UNSPEC_ADDR));
                _DST(_IPV6_SOLNODE_MCAST(nutv6()));
                HopLimit=254;
        },
                {
                TargetAddress=nutv6();
        }
)

//
// DADNS_from_TN_DstAll
//  Description: 
//    DAD NS send to NUT to check if address is configured
//  Spec:
//    invalid DAD NS

FEM_ADDRCONF_dadns(DADNS_from_TN_DstAll, _HETHER_tn2allnodes,
		   DestinationAddress=v6(_ALLNODES_MCAST_ADDR);
		   ,
		   TargetAddress=nutv6(); // Tentative Address
                   )


//
// DADNS_from_TN_DstTent
//  Description: 
//    DAD NS send to NUT to check if address is configured
//  Spec:
//    invalid DAD NS

FEM_ADDRCONF_dadns(DADNS_from_TN_DstTent, _HETHER_tn2nut,
		   DestinationAddress=nutv6();
		   ,
		   TargetAddress=nutv6(); // Tentative Address
                   )


//
// DAD NA w/ HopLimit=254
// TN's link local  address
//           to  
// allnode multicast address
//
// Targetaddress TN's link local address
 
FEM_icmp6_na (
        DADNA_from_TN_HL254,
        _HETHER_tn2allnodes,
                {
                _SRC(tnv6());
                _DST(v6(_ALLNODES_MCAST_ADDR));
                HopLimit=254;
        },
                {
                RFlag=0;
                SFlag=0;
                OFlag=1;
                TargetAddress=nutv6();
                option=_TLLOPT_tn;
        }
)

//
// DAD NA w/ Sflag==1
// TN's link local  address
//           to  
// allnode multicast address
//
// Targetaddress TN's link local address
 
FEM_icmp6_na (
        DADNA_from_TN_SF1,
        _HETHER_tn2allnodes,
                {
                _SRC(tnv6());
                _DST(v6(_ALLNODES_MCAST_ADDR));
                HopLimit=255;
        },
                {
                RFlag=0;
                SFlag=1;
                OFlag=1;
                TargetAddress=nutv6();
                option=_TLLOPT_tn;
        }
)

//
// DAD NS w/ SLL
// unspecified  address
//           to  
// NUT's solicited multicast address
//
// Targetaddress TN's link local address

FEM_icmp6_ns (
        DADNS_from_TN_wSLL,
        hether_tn2tentsolnode,
                {
                _SRC(v6(_UNSPEC_ADDR));
                _DST(_IPV6_SOLNODE_MCAST(nutv6()));
                HopLimit=255;
        },
                {
                TargetAddress=nutv6();
                option=_SLLOPT_tn;   //invalid
        }
)

//
// DAD NA w/ SLL
// TN's link local  address
//           to  
// allnode multicast address
//
// Targetaddress TN's link local address
 
FEM_icmp6_na (
        DADNA_from_TN_wSLL,
        _HETHER_tn2allnodes,
                {
                _SRC(tnv6());
                _DST(v6(_ALLNODES_MCAST_ADDR));
                HopLimit=255;
        },
                {
                RFlag=0;
                SFlag=0;
                OFlag=1;
                TargetAddress=nutv6();
                option=_TLLOPT_tn;
                option=_SLLOPT_tn;
        }
)

//
// DAD NA w/o TLL
// TN's link local  address
//           to  
// allnode multicast address
//
// Targetaddress TN's link local address
 
FEM_icmp6_na (
        DADNA_from_TN_woTLL,
        _HETHER_tn2allnodes,
                {
                _SRC(tnv6());
                _DST(v6(_ALLNODES_MCAST_ADDR));
                HopLimit=255;
        },
                {
                RFlag=0;
                SFlag=0;
                OFlag=1;
                TargetAddress=nutv6();
        }
)
//end
