//
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Yokogawa Electric Corporation,
// YDC Corporation, 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.
//
// $TAHI: v6eval/include/stdpacket.def,v 1.35 2004/09/08 09:56:39 akisada Exp $
//
// stdpacket.def   standard packet definition
//
//

#ifndef _STDPACKET_DEF_
#define _STDPACKET_DEF_

//======================================================================
// Standard name definition for header and packet
//     where _pNAME is a Frame_Ether name

// For IPv6
#define	_HDR_IPV6_NAME(_pNAME)		_HDR_IPV6_##_pNAME
#define	_PACKET_IPV6_NAME(_pNAME)	_PACKET_IPV6_##_pNAME
#define	_ICMPV6_NAME(_pNAME)		_ICMPV6_##_pNAME
#define	_UPP_NONEXT_NAME(_pNAME)	_UPP_NONEXT_##_pNAME

// For IPv4
#define	_HDR_IPV4_NAME(_pNAME)		_HDR_IPV4_##_pNAME
#define	_PACKET_IPV4_NAME(_pNAME)	_PACKET_IPV4_##_pNAME
#define	_ICMPV4_NAME(_pNAME)		_ICMPV4_##_pNAME
#define	_IGMP_NAME(_pNAME)		_IGMP_##_pNAME

// For ARP
#define	_HDR_ARP_NAME(_pNAME)		_HDR_ARP_##_pNAME
#define	_PACKET_ARP_NAME(_pNAME)	_PACKET_ARP_##_pNAME

// For TCP
#define _UPP_TCP_NAME(_pNAME)		_UPP_TCP_##_pNAME
#define _HDR_TCP_NAME(_pNAME)		_HDR_TCP_##_pNAME

// For UDP
#define _UPP_UDP_NAME(_pNAME)		_UPP_UDP_##_pNAME
#define _HDR_UDP_NAME(_pNAME)		_HDR_UDP_##_pNAME

// For RIPng
#define _UDP_RIPNG_NAME(_pNAME)		_UDP_RIPNG_##_pNAME

// For SIP
#define _UDP_SIP_NAME(_pNAME)		_UDP_SIP_##_pNAME

// For DNS
#define _UDP_DNS_NAME(_pNAME)		_UDP_DNS_##_pNAME

// For SNMP
#define _UDP_SNMP_NAME(_pNAME)		_UDP_SNMP_##_pNAME

// For DHCPv6
#define _UDP_DHCPV6_NAME(_pNAME)	_UDP_DHCPV6_##_pNAME

//======================================================================
// Standard Hdr_Ether

  // parameter description
  //-----------------------------------------------------------------------------
  //  name        type    description  : sample
  //-----------------------------------------------------------------------------
  // _pNAME      string  Hdr_Ether name to define : for example 'hether_xx2yy'
  // _pETHER_SRC ether   Ether address  : ether("00:00:12:34:56:78")
  // _pETHER_DST ether   Ether address  : ether("00:00:12:34:56:78")
  //-----------------------------------------------------------------------------

#define _HETHER_define(_pNAME, _pETHER_SRC, _pETHER_DST) \
Hdr_Ether _pNAME { \
	SourceAddress=_pETHER_SRC; \
	DestinationAddress=_pETHER_DST; \
}

//----------------------------------------------------------------------
//   Predefined Standard Hdr_Ether
_HETHER_define(_HETHER_tn2nut,         tnether(),  nutether())
_HETHER_define(_HETHER_nut2tn,         nutether(), tnether())
_HETHER_define(_HETHER_tn2tn,          tnether(),  tnether())
_HETHER_define(_HETHER_nut2nut,        nutether(), nutether())
_HETHER_define(_HETHER_src2dst,        ethersrc(), etherdst())
_HETHER_define(_HETHER_tn2tnsolnode,   tnether(),  _ETHER_SOLNODE_MCAST(tnv6()))
_HETHER_define(_HETHER_tn2nutsolnode,  tnether(),  _ETHER_SOLNODE_MCAST(nutv6()))
_HETHER_define(_HETHER_nut2tnsolnode,  nutether(), _ETHER_SOLNODE_MCAST(tnv6()))
_HETHER_define(_HETHER_nut2nutsolnode, nutether(), _ETHER_SOLNODE_MCAST(nutv6()))
_HETHER_define(_HETHER_src2dstsolnode, ethersrc(), _ETHER_SOLNODE_MCAST(v6dst()))
_HETHER_define(_HETHER_tn2allnodes,    tnether(),  v62ethermulti(v6(_ALLNODES_MCAST_ADDR)))
_HETHER_define(_HETHER_nut2allnodes,   nutether(), v62ethermulti(v6(_ALLNODES_MCAST_ADDR)))
_HETHER_define(_HETHER_src2allnodes,   ethersrc(), v62ethermulti(v6(_ALLNODES_MCAST_ADDR)))
_HETHER_define(_HETHER_tn2allrouters,  tnether(),  v62ethermulti(v6(_ALLROUTERS_MCAST_ADDR)))
_HETHER_define(_HETHER_nut2allrouters, nutether(), v62ethermulti(v6(_ALLROUTERS_MCAST_ADDR)))
_HETHER_define(_HETHER_src2allrouters, ethersrc(), v62ethermulti(v6(_ALLROUTERS_MCAST_ADDR)))
_HETHER_define(_HETHER_tn2allriprouters,  tnether(),  v62ethermulti(v6(_ALLRIPROUTERS_MCAST_ADDR)))
_HETHER_define(_HETHER_nut2allriprouters, nutether(), v62ethermulti(v6(_ALLRIPROUTERS_MCAST_ADDR)))
_HETHER_define(_HETHER_src2allriprouters, ethersrc(), v62ethermulti(v6(_ALLRIPROUTERS_MCAST_ADDR)))
_HETHER_define(_HETHER_tn2alldhcpagents,  tnether(),  v62ethermulti(v6(_ALLDHCPAGENTS_MCAST_ADDR)))
_HETHER_define(_HETHER_nut2alldhcpagents, nutether(), v62ethermulti(v6(_ALLDHCPAGENTS_MCAST_ADDR)))
_HETHER_define(_HETHER_src2alldhcpagents, ethersrc(), v62ethermulti(v6(_ALLDHCPAGENTS_MCAST_ADDR)))
_HETHER_define(_HETHER_tn2alldhcpservers,  tnether(),  v62ethermulti(v6(_ALLDHCPSERVERS_MCAST_ADDR)))
_HETHER_define(_HETHER_nut2alldhcpservers, nutether(), v62ethermulti(v6(_ALLDHCPSERVERS_MCAST_ADDR)))
_HETHER_define(_HETHER_src2alldhcpservers, ethersrc(), v62ethermulti(v6(_ALLDHCPSERVERS_MCAST_ADDR)))
_HETHER_define(_HETHER_tn2broadcast,   tnether(),  ether("ff:ff:ff:ff:ff:ff"))
_HETHER_define(_HETHER_nut2broadcast,  nutether(), ether("ff:ff:ff:ff:ff:ff"))
_HETHER_define(_HETHER_src2broadcast,  ethersrc(), ether("ff:ff:ff:ff:ff:ff"))



//======================================================================
// Standard Opt_ICMPv6_TLL and Opt_ICMPv6_SLL

  // parameter description
  //-----------------------------------------------------------------------------
  //  name        type    description  : sample
  //-----------------------------------------------------------------------------
  // _pNAME      string  Opt_ICMPv6_[TS]LL name to define : for example 'tllopt_xx'
  // _pLLA       ether   Ether address  : ether("00:00:12:34:56:78")
  //-----------------------------------------------------------------------------

#define _TLLOPT_define(_pNAME, _pLLA) \
Opt_ICMPv6_TLL  _pNAME { \
	LinkLayerAddress=_pLLA;	\
}

#define _SLLOPT_define(_pNAME, _pLLA) \
Opt_ICMPv6_SLL _pNAME { \
	LinkLayerAddress=_pLLA; \
}

//----------------------------------------------------------------------
//   Predefined Standard TLL Options
_TLLOPT_define(_TLLOPT_tn,  tnether())	
_TLLOPT_define(_TLLOPT_nut, nutether())
_TLLOPT_define(_TLLOPT_src, ethersrc())
_TLLOPT_define(_TLLOPT_dst, etherdst())
//----------------------------------------------------------------------
//   Standard SLL Options
_SLLOPT_define(_SLLOPT_tn,  tnether())
_SLLOPT_define(_SLLOPT_nut, nutether())
_SLLOPT_define(_SLLOPT_src, ethersrc())
_SLLOPT_define(_SLLOPT_dst, etherdst())



//=====================================================================
// Standard Hdr_IPv6 Frame_Ether definition

// FEM_hdr_ipv6_exth

  // parameter description
  //-----------------------------------------------------------------------------
  //  name        type    description  : sample
  //-----------------------------------------------------------------------------
  // _pNAME      string  Frame_Ether name to define : for example 'hoge'
  // _pETHER     string  predefined Hdr_Ether name  : _HETHER_tn2allnodes
  // _oHDR_IPV6    { }   Hdr_IPv6 to define         :
  //                         { _SRC(...);
  //                           _DST(...);
  //                           HopLimit=255; }
  // _oPACKET_IPV6 { }   Packet_IPv6 to define      :
  //                         { header=_HDR_IPV6_NAME(hoge); //mandatory,hoge==_pNAME
  //                           exthdr=userdefined_exthdr_name ;
  //                           upper= userdefined_upper_payload_name ; }
  //-----------------------------------------------------------------------------

//----------------------------------------------------------------------
#define FEM_hdr_ipv6_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6) \
Frame_Ether _pNAME { \
	header=_pETHER; \
	packet=_PACKET_IPV6_NAME(_pNAME); \
} \
Packet_IPv6 _PACKET_IPV6_NAME(_pNAME) \
	_oPACKET_IPV6 \
Hdr_IPv6 _HDR_IPV6_NAME(_pNAME) \
	_oHDR_IPV6


//=====================================================================
// Standard Hdr_IPv4 Frame_Ether definition

// FEM_hdr_ipv4_exth

  // parameter description
  //-----------------------------------------------------------------------------
  //  name        type    description  : sample
  //-----------------------------------------------------------------------------
  // _pNAME      string  Frame_Ether name to define : for example 'hoge'
  // _pETHER     string  predefined Hdr_Ether name  : _HETHER_tn2allnodes
  // _oHDR_IPV4    { }   Hdr_IPv4 to define         :
  //                         { _SRC(...);
  //                           _DST(...); }
  // _oPACKET_IPV4 { }   Packet_IPv4 to define      :
  //                         { header=_HDR_IPV4_NAME(hoge); //mandatory,hoge==_pNAME
  //                           exthdr=userdefined_exthdr_name ;
  //                           upper= userdefined_upper_payload_name ; }
  //-----------------------------------------------------------------------------

//----------------------------------------------------------------------
#define FEM_hdr_ipv4_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4) \
Frame_Ether _pNAME { \
	header=_pETHER; \
	packet=_PACKET_IPV4_NAME(_pNAME); \
} \
Packet_IPv4 _PACKET_IPV4_NAME(_pNAME) \
	_oPACKET_IPV4 \
Hdr_IPv4 _HDR_IPV4_NAME(_pNAME) \
	_oHDR_IPV4


//=====================================================================
// Standard Hdr_ARP Frame_Ether definition

// FEM_hdr_arp

  // parameter description
  //-----------------------------------------------------------------------------
  //  name        type    description  : sample
  //-----------------------------------------------------------------------------
  // _pNAME      string  Frame_Ether name to define : for example 'hoge'
  // _pETHER     string  predefined Hdr_Ether name  : _HETHER_tn2allnodes
  // _oHDR_ARP    { }   Hdr_ARP to define         :
  //                         { HardwareType=...;
  //                           ProtocolType=...; }
  //-----------------------------------------------------------------------------

//----------------------------------------------------------------------
#define FEM_hdr_arp(_pNAME,_pETHER,_oHDR_ARP) \
Frame_Ether _pNAME { \
	header=_pETHER; \
	packet=_PACKET_ARP_NAME(_pNAME); \
} \
Packet_ARP _PACKET_ARP_NAME(_pNAME) { \
	header=_HDR_ARP_NAME(_pNAME); \
} \
Hdr_ARP _HDR_ARP_NAME(_pNAME) \
	_oHDR_ARP


//----------------------------------------------------------------------
// Source/Destination Address definiton in _oHDR_IPV6
#define	_SRC(_pv6)      SourceAddress=_pv6
#define	_DST(_pv6)      DestinationAddress=_pv6

//----------------------------------------------------------------------
// Source/Destination Port definiton in _oHDR_TCP/_oHDR_UDP
#define _SPORT(_pport)	SourcePort=_pport
#define _DPORT(_pport)	DestinationPort=_pport

//======================================================================
// Standard ICMPv6 Frame_Ether definition

// _FEM_icmp6()      ... core icmp6 definition macro
// _FEM_icmp6_exth() ... core icmp6 definition macro with extention headers
// FEM_icmp6_*()     ... users standard definition macros
// FEM_icmp6_*_exth()... users standard definition macros with extention headers

  // parameter description
  //-----------------------------------------------------------------------------
  //  name        type    description  : sample
  //-----------------------------------------------------------------------------
  // _pType      string  ICMPv6_'Type'name          : EchoRequest, NA, PacketTooBig
  // _pNAME      string  Frame_Ether name to define : for example 'hoge'
  // _pETHER     string  predefined Hdr_Ether name  : _HETHER_tn2allnodes
  // _oHDR_IPV6    { }   Hdr_IPv6 to define         :
  //                         { _SRC(...);
  //                           _DST(...);
  //                           HopLimit=255; }
  // _oPACKET_IPV6 { }   Packet_IPv6 to define      :
  //                         { header=_HDR_IPV6_NAME(hoge);     //mandatory,hoge==_pNAME
  //                           exthdr=userdefined_exthdr_name ;
  //                           upper= _ICMPV6_NAME(hoge); } //mandatory,hoge==_pNAME
  // _oICMPV6_*    { }   ICMPv6_* to define         :
  //                         { TargetAddress=userdefined_address; // if _oICMPV6_NS
  //                           option=predefined_or_userdefined_option ; }
  //-----------------------------------------------------------------------------


//----------------------------------------------------------------------
// _FEM_icmp6  ... core icmp6 definition macro

#define _FEM_icmp6_exth(_pType,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6) \
FEM_hdr_ipv6_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6) \
ICMPv6_##_pType _ICMPV6_NAME(_pNAME) \
        _oICMPV6

#define _FEM_icmp6(_pType,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6) \
_FEM_icmp6_exth(_pType,_pNAME,_pETHER,_oHDR_IPV6, \
                { header=_HDR_IPV6_NAME(_pNAME); \
	          upper=_ICMPV6_NAME(_pNAME); }, \
                _oICMPV6)


//----------------------------------------------------------------------
// FEM_icmp6_echo_request

#define FEM_icmp6_echo_request(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_EchoRequest) \
_FEM_icmp6(EchoRequest,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_EchoRequest)

#define FEM_icmp6_echo_request_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_EchoRequest) \
_FEM_icmp6_exth(EchoRequest,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_EchoRequest)

//---------------------------------------------------------------------
// FEM_icmp6_echo_reply

#define FEM_icmp6_echo_reply(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_EchoReply) \
_FEM_icmp6(EchoReply,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_EchoReply)

#define FEM_icmp6_echo_reply_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_EchoReply) \
_FEM_icmp6_exth(EchoReply,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_EchoReply)

//---------------------------------------------------------------------
// FEM_icmp6_packet_too_big

#define FEM_icmp6_packet_too_big(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_PacketTooBig) \
_FEM_icmp6(PacketTooBig,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_PacketTooBig)

#define FEM_icmp6_packet_too_big_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_PacketTooBig) \
_FEM_icmp6_exth(PacketTooBig,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_PacketTooBig)

//---------------------------------------------------------------------
// FEM_icmp6_destination_unreachable

#define FEM_icmp6_destination_unreachable(_pNAME,_pETHER,_oHDR_IPV6, _oICMPV6_DestinationUnreachable) \
_FEM_icmp6(DestinationUnreachable,_pNAME,_pETHER,_oHDR_IPV6, _oICMPV6_DestinationUnreachable)

#define FEM_icmp6_destination_unreachable_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_DestinationUnreachable) \
_FEM_icmp6_exth(DestinationUnreachable,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_DestinationUnreachable)

//---------------------------------------------------------------------
// FEM_icmp6_parameter_problem

#define FEM_icmp6_parameter_problem(_pNAME,_pETHER,_oHDR_IPV6, _oICMPV6_ParameterProblem) \
_FEM_icmp6(ParameterProblem,_pNAME,_pETHER,_oHDR_IPV6, _oICMPV6_ParameterProblem)

#define FEM_icmp6_parameter_problem_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_ParameterProblem) \
_FEM_icmp6_exth(ParameterProblem,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_ParameterProblem)

//---------------------------------------------------------------------
// FEM_icmp6_time_exceeded

#define FEM_icmp6_time_exceeded(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_TimeExceeded) \
_FEM_icmp6(TimeExceeded,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_TimeExceeded)

#define FEM_icmp6_time_exceeded_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_TimeExceeded) \
_FEM_icmp6_exth(TimeExceeded,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_TimeExceeded)

//---------------------------------------------------------------------
// FEM_icmp6_ns
#define FEM_icmp6_ns(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_NS) \
_FEM_icmp6(NS,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_NS)

#define FEM_icmp6_ns_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_NS) \
_FEM_icmp6_exth(NS,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_NS)

//---------------------------------------------------------------------
// FEM_icmp6_na
#define FEM_icmp6_na(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_NA) \
_FEM_icmp6(NA,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_NA)

#define FEM_icmp6_na_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_NA) \
_FEM_icmp6_exth(NA,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_NA)

//---------------------------------------------------------------------
// FEM_icmp6_rs
#define FEM_icmp6_rs(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_RS) \
_FEM_icmp6(RS,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_RS)

#define FEM_icmp6_rs_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_RS) \
_FEM_icmp6_exth(RS,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_RS)

//---------------------------------------------------------------------
// FEM_icmp6_ra
#define FEM_icmp6_ra(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_RA) \
_FEM_icmp6(RA,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_RA)

#define FEM_icmp6_ra_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_RA) \
_FEM_icmp6_exth(RA,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_RA)
  
//---------------------------------------------------------------------
// FEM_icmp6_redirect
#define FEM_icmp6_redirect(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_Redirect) \
_FEM_icmp6(Redirect,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_Redirect)

#define FEM_icmp6_redirect_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_Redirect) \
_FEM_icmp6_exth(Redirect,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6, _oICMPV6_Redirect)

//---------------------------------------------------------------------
// FEM_icmp6_mldquery
#define FEM_icmp6_mldquery(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_MLDQUERY) \
_FEM_icmp6(MLDQuery,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_MLDQUERY)

#define FEM_icmp6_mldquery_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_MLDQUERY) \
_FEM_icmp6_exth(MLDQuery,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_MLDQUERY)

//---------------------------------------------------------------------
// FEM_icmp6_mldreport
#define FEM_icmp6_mldreport(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_MLDREPORT) \
_FEM_icmp6(MLDReport,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_MLDREPORT)

#define FEM_icmp6_mldreport_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_MLDREPORT) \
_FEM_icmp6_exth(MLDReport,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_MLDREPORT)

//---------------------------------------------------------------------
// FEM_icmp6_mlddone
#define FEM_icmp6_mlddone(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_MLDDONE) \
_FEM_icmp6(MLDDone,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_MLDDONE)

#define FEM_icmp6_mlddone_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_MLDDONE) \
_FEM_icmp6_exth(MLDDone,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_MLDDONE)

//---------------------------------------------------------------------
// FEM_icmp6_mldv2report
#define FEM_icmp6_mldv2report(_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_MLDV2REPORT) \
_FEM_icmp6(MLDv2Report,_pNAME,_pETHER,_oHDR_IPV6,_oICMPV6_MLDV2REPORT)

#define FEM_icmp6_mldv2report_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_MLDV2REPORT) \
_FEM_icmp6_exth(MLDv2Report,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPV6_MLDV2REPORT)

//---------------------------------------------------------------------
// FEM_icmp6_haadrequest
#define FEM_icmp6_haadrequest(_pNAME,_pETHER,_oHDR_IPV6,_oICMPv6_HAADREQ) \
_FEM_icmp6(HAADRequest,_pNAME,_pETHER,_oHDR_IPV6,_oICMPv6_HAADREQ)

#define FEM_icmp6_haadrequest_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPv6_HAADREQ) \
_FEM_icmp6_exth(HAADRequest,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPv6_HAADREQ)

//---------------------------------------------------------------------
// FEM_icmp6_haadreply
#define FEM_icmp6_haadreply(_pNAME,_pETHER,_oHDR_IPV6,_oICMPv6_HAADREP) \
_FEM_icmp6(HAADReply,_pNAME,_pETHER,_oHDR_IPV6,_oICMPv6_HAADREP)

#define FEM_icmp6_haadreply_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPv6_HAADREP) \
_FEM_icmp6_exth(HAADReply,_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oICMPv6_HAADREP)

//---------------------------------------------------------------------
// FEM_icmp6_mip6prefixsol
#define FEM_icmp6_mip6prefixsol(_pNAME, _pETHER, _oHDR_IPV6, _oICMPv6_PREFIXSOL) \
_FEM_icmp6(MobilePrefixSol, _pNAME, _pETHER, _oHDR_IPV6, _oICMPv6_PREFIXSOL)

#define FEM_icmp6_mip6prefixsol_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oICMPv6_PREFIXSOL) \
_FEM_icmp6_exth(MobilePrefixSol, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oICMPv6_PREFIXSOL)

//---------------------------------------------------------------------
// FEM_icmp6_mip6prefixadv
#define FEM_icmp6_mip6prefixadv(_pNAME, _pETHER, _oHDR_IPV6, _oICMPv6_PREFIXADV) \
_FEM_icmp6(MobilePrefixAdvertise, _pNAME, _pETHER, _oHDR_IPV6, _oICMPv6_PREFIXADV)

#define FEM_icmp6_mip6prefixadv_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oICMPv6_PREFIXADV) \
_FEM_icmp6_exth(MobilePrefixAdvertise, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oICMPv6_PREFIXADV)

//======================================================================
// FEM_upp_no_next_header ... No Next Header

#define FEM_upp_no_next_header_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6,_oUpp_NoNext) \
FEM_hdr_ipv6_exth(_pNAME,_pETHER,_oHDR_IPV6,_oPACKET_IPV6) \
Upp_NoNext _UPP_NONEXT_NAME(_pNAME) \
	_oUpp_NoNext

#define FEM_upp_no_next_header(_pNAME,_pETHER,_oHDR_IPV6,_oUpp_NoNext) \
FEM_upp_no_next_header_exth(_pNAME,_pETHER,_oHDR_IPV6, \
	{ header=_HDR_IPV6_NAME(_pNAME); \
	  upper=_UPP_NONEXT_NAME(_pNAME); }, \
	_oUpp_NoNext)

//======================================================================
// Standard ICMPv4 Frame_Ether definition

// _FEM_icmp4()      ... core icmp4 definition macro
// _FEM_icmp4_exth() ... core icmp4 definition macro with extention headers
// FEM_icmp4_*()     ... users standard definition macros
// FEM_icmp4_*_exth()... users standard definition macros with extention headers

  // parameter description
  //-----------------------------------------------------------------------------
  //  name        type    description  : sample
  //-----------------------------------------------------------------------------
  // _pType      string  ICMPv4_'Type'name          : EchoRequest, PacketTooBig
  // _pNAME      string  Frame_Ether name to define : for example 'hoge'
  // _pETHER     string  predefined Hdr_Ether name  : _HETHER_tn2allnodes
  // _oHDR_IPV4    { }   Hdr_IPv4 to define         :
  //                         { _SRC(...);
  //                           _DST(...); }
  // _oPACKET_IPV4 { }   Packet_IPv4 to define      :
  //                         { header=_HDR_IPV4_NAME(hoge);     //mandatory,hoge==_pNAME
  //                           exthdr=userdefined_exthdr_name ;
  //                           upper= _ICMPV4_NAME(hoge); } //mandatory,hoge==_pNAME
  // _oICMPV4_*    { }   ICMPv4_* to define         :
  //                         { TargetAddress=userdefined_address; // if _oICMPV4_ANY
  //                           option=predefined_or_userdefined_option ; }
  //-----------------------------------------------------------------------------


//----------------------------------------------------------------------
// _FEM_icmp4  ... core icmp4 definition macro

#define _FEM_icmp4_exth(_pType,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oICMPV4) \
FEM_hdr_ipv4_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4) \
ICMPv4_##_pType _ICMPV4_NAME(_pNAME) \
        _oICMPV4

#define _FEM_icmp4(_pType,_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4) \
_FEM_icmp4_exth(_pType,_pNAME,_pETHER,_oHDR_IPV4, \
                { header=_HDR_IPV4_NAME(_pNAME); \
	          upper=_ICMPV4_NAME(_pNAME); }, \
                _oICMPV4)


//----------------------------------------------------------------------
// FEM_icmp4_echo_request

#define FEM_icmp4_echo_request(_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4_EchoRequest) \
_FEM_icmp4(EchoRequest,_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4_EchoRequest)

#define FEM_icmp4_echo_request_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4, _oICMPV4_EchoRequest) \
_FEM_icmp4_exth(EchoRequest,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4, _oICMPV4_EchoRequest)

//---------------------------------------------------------------------
// FEM_icmp4_echo_reply

#define FEM_icmp4_echo_reply(_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4_EchoReply) \
_FEM_icmp4(EchoReply,_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4_EchoReply)

#define FEM_icmp4_echo_reply_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4, _oICMPV4_EchoReply) \
_FEM_icmp4_exth(EchoReply,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4, _oICMPV4_EchoReply)

//---------------------------------------------------------------------
// FEM_icmp4_destination_unreachable

#define FEM_icmp4_destination_unreachable(_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4_DestinationUnreachable) \
_FEM_icmp4(DestinationUnreachable,_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4_DestinationUnreachable)

#define FEM_icmp4_destination_unreachable_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4, _oICMPV4_DestinationUnreachable) \
_FEM_icmp4_exth(DestinationUnreachable,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4, _oICMPV4_DestinationUnreachable)

//---------------------------------------------------------------------
// FEM_icmp4_time_exceeded

#define FEM_icmp4_time_exceeded(_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4_TimeExceeded) \
_FEM_icmp4(TimeExceeded,_pNAME,_pETHER,_oHDR_IPV4,_oICMPV4_TimeExceeded)

#define FEM_icmp4_time_exceeded_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4, _oICMPV4_TimeExceeded) \
_FEM_icmp4_exth(TimeExceeded,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4, _oICMPV4_TimeExceeded)

//---------------------------------------------------------------------
//end

//----------------------------------------------------------------------
// _FEM_igmp  ... core igmp4 definition macro

#define _FEM_igmp_exth(_pType,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP) \
FEM_hdr_ipv4_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4) \
IGMP_##_pType _IGMP_NAME(_pNAME) \
        _oIGMP
        
#define _FEM_igmp(_pType,_pNAME,_pETHER,_oHDR_IPV4,_oIGMP) \
_FEM_igmp_exth(_pType,_pNAME,_pETHER,_oHDR_IPV4, \
                { header=_HDR_IPV4_NAME(_pNAME); \
	          upper=_IGMP_NAME(_pNAME); }, \
                _oIGMP)
//---------------------------------------------------------------------
// FEM_igmp_igmpquery
#define FEM_igmp_igmpquery(_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPQUERY) \
_FEM_igmp(IGMPQuery,_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPQUERY)

#define FEM_igmp_igmpquery_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPQUERY) \
_FEM_igmp_exth(IGMPQuery,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPQUERY)
//---------------------------------------------------------------------
// FEM_igmp_igmpv3report
#define FEM_igmp_igmpv3report(_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPV3REPORT) \
_FEM_igmp(IGMPv3Report,_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPV3REPORT)

#define FEM_igmp_igmpv3report_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPV3REPORT) \
_FEM_igmp_exth(IGMPv3Report,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPV3REPORT)
//---------------------------------------------------------------------
// FEM_igmp_igmpv2report
#define FEM_igmp_igmpv2report(_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPV2REPORT) \
_FEM_igmp(IGMPv2Report,_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPV2REPORT)

#define FEM_igmp_igmpv2report_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPV2REPORT) \
_FEM_igmp_exth(IGMPv2Report,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPV2REPORT)
//---------------------------------------------------------------------
// FEM_igmp_igmpv1report
#define FEM_igmp_igmpv1report(_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPV1REPORT) \
_FEM_igmp(IGMPv1Report,_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPV1REPORT)

#define FEM_igmp_igmpv1report_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPV1REPORT) \
_FEM_igmp_exth(IGMPv1Report,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPV1REPORT)
//---------------------------------------------------------------------
// FEM_igmp_igmpv2leavegroup
#define FEM_igmp_igmpv2leavegroup(_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPV2LEAVEGROUP) \
_FEM_igmp(IGMPv2LeaveGroup,_pNAME,_pETHER,_oHDR_IPV4,_oIGMP_IGMPV2LEAVEGROUP)

#define FEM_igmp_igmpv2leavegroup_exth(_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPV2LEAVEGROUP) \
_FEM_igmp_exth(IGMPv2LeaveGroup,_pNAME,_pETHER,_oHDR_IPV4,_oPACKET_IPV4,_oIGMP_IGMPV2LEAVEGROUP)
//---------------------------------------------------------------------
//end

//---------------------------------------------------------------------
#define FEM_tcp4_exth(_pNAME, _pETHER, _oHDR_IPV4, _oPACKET_IPV4, _oHDR_TCP, _oUPP_TCP) \
FEM_hdr_ipv4_exth(_pNAME, _pETHER, _oHDR_IPV4, _oPACKET_IPV4) \
Upp_TCP _UPP_TCP_NAME(_pNAME) _oUPP_TCP \
Hdr_TCP _HDR_TCP_NAME(_pNAME) _oHDR_TCP

//---------------------------------------------------------------------
#define FEM_tcp4(_pNAME, _pETHER, _oPACKET_IPV4, _oHDR_TCP, _oUPP_TCP) \
FEM_tcp4_exth(_pNAME, _pETHER, _oPACKET_IPV4, \
{header=_HDR_IPV4_NAME(_pNAME);upper=_UPP_TCP_NAME(_pNAME);}, \
_oHDR_TCP, _oUPP_TCP)

//---------------------------------------------------------------------
#define FEM_udp4_exth(_pNAME, _pETHER, _oHDR_IPV4, _oPACKET_IPV4, _oHDR_UDP, _oUPP_UDP) \
FEM_hdr_ipv4_exth(_pNAME, _pETHER, _oHDR_IPV4, _oPACKET_IPV4) \
Upp_UDP _UPP_UDP_NAME(_pNAME) _oUPP_UDP \
Hdr_UDP _HDR_UDP_NAME(_pNAME) _oHDR_UDP

//---------------------------------------------------------------------
#define FEM_udp4(_pNAME, _pETHER, _oPACKET_IPV4, _oHDR_UDP, _oUPP_UDP) \
FEM_udp4_exth(_pNAME, _pETHER, _oPACKET_IPV4, \
{header=_HDR_IPV4_NAME(_pNAME);upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oUPP_UDP)

//---------------------------------------------------------------------
#define FEM_udp4_dns_exth(_pNAME, _pETHER, _oHDR_IPV4, _oPACKET_IPV4, _oHDR_UDP, _oUDP_DNS) \
FEM_udp4_exth(_pNAME, _pETHER, _oHDR_IPV4, _oPACKET_IPV4, _oHDR_UDP, \
{header=_HDR_UDP_NAME(_pNAME); payload=_UDP_DNS_NAME(_pNAME);}) \
Udp_DNS _UDP_DNS_NAME(_pNAME) _oUDP_DNS

//---------------------------------------------------------------------
#define FEM_udp4_dns(_pNAME, _pETHER, _oHDR_IPV4, _oHDR_UDP, _oUDP_DNS) \
FEM_udp4_dns_exth(_pNAME, _pETHER, _oHDR_IPV4, \
{header=_HDR_IPV4_NAME(_pNAME); upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oUDP_DNS)

//---------------------------------------------------------------------
#define FEM_udp4_sip_exth(_pNAME, _pETHER, _oHDR_IPV4, _oPACKET_IPV4, _oHDR_UDP, _oUDP_SIP) \
FEM_udp4_exth(_pNAME, _pETHER, _oHDR_IPV4, _oPACKET_IPV4, _oHDR_UDP, \
{header=_HDR_UDP_NAME(_pNAME); payload=_UDP_SIP_NAME(_pNAME);}) \
Udp_SIP _UDP_SIP_NAME(_pNAME) _oUDP_SIP

//---------------------------------------------------------------------
#define FEM_udp4_sip(_pNAME, _pETHER, _oHDR_IPV4, _oHDR_UDP, _oUDP_SIP) \
FEM_udp4_sip_exth(_pNAME, _pETHER, _oHDR_IPV4, \
{header=_HDR_IPV4_NAME(_pNAME); upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oUDP_SIP)

//---------------------------------------------------------------------
#define FEM_tcp6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_TCP, _oUPP_TCP) \
FEM_hdr_ipv6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6) \
Upp_TCP _UPP_TCP_NAME(_pNAME) _oUPP_TCP \
Hdr_TCP _HDR_TCP_NAME(_pNAME) _oHDR_TCP

//---------------------------------------------------------------------
#define FEM_tcp6(_pNAME, _pETHER, _oPACKET_IPV6, _oHDR_TCP, _oUPP_TCP) \
FEM_tcp6_exth(_pNAME, _pETHER, _oPACKET_IPV6, \
{header=_HDR_IPV6_NAME(_pNAME);upper=_UPP_TCP_NAME(_pNAME);}, \
_oHDR_TCP, _oUPP_TCP)

//---------------------------------------------------------------------
#define FEM_udp6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oUPP_UDP) \
FEM_hdr_ipv6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6) \
Upp_UDP _UPP_UDP_NAME(_pNAME) _oUPP_UDP \
Hdr_UDP _HDR_UDP_NAME(_pNAME) _oHDR_UDP

//---------------------------------------------------------------------
#define FEM_udp6(_pNAME, _pETHER, _oPACKET_IPV6, _oHDR_UDP, _oUPP_UDP) \
FEM_udp6_exth(_pNAME, _pETHER, _oPACKET_IPV6, \
{header=_HDR_IPV6_NAME(_pNAME);upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oUPP_UDP)

//---------------------------------------------------------------------
#define FEM_ripng_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oUDP_RIPNG) \
FEM_udp6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, \
{header=_HDR_UDP_NAME(_pNAME); payload=_UDP_RIPNG_NAME(_pNAME);}) \
Udp_RIPng _UDP_RIPNG_NAME(_pNAME) _oUDP_RIPNG

//---------------------------------------------------------------------
#define FEM_ripng(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oUDP_RIPNG) \
FEM_ripng_exth(_pNAME, _pETHER, _oHDR_IPV6, \
{header=_HDR_IPV6_NAME(_pNAME); upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oUDP_RIPNG)

//---------------------------------------------------------------------
#define FEM_udp6_sip_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oUDP_SIP) \
FEM_udp6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, \
{header=_HDR_UDP_NAME(_pNAME); payload=_UDP_SIP_NAME(_pNAME);}) \
Udp_SIP _UDP_SIP_NAME(_pNAME) _oUDP_SIP

//---------------------------------------------------------------------
#define FEM_udp6_sip(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oUDP_SIP) \
FEM_udp6_sip_exth(_pNAME, _pETHER, _oHDR_IPV6, \
{header=_HDR_IPV6_NAME(_pNAME); upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oUDP_SIP)

//---------------------------------------------------------------------
#define FEM_udp6_dns_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oUDP_DNS) \
FEM_udp6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, \
{header=_HDR_UDP_NAME(_pNAME); payload=_UDP_DNS_NAME(_pNAME);}) \
Udp_DNS _UDP_DNS_NAME(_pNAME) _oUDP_DNS

//---------------------------------------------------------------------
#define FEM_udp6_dns(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oUDP_DNS) \
FEM_udp6_dns_exth(_pNAME, _pETHER, _oHDR_IPV6, \
{header=_HDR_IPV6_NAME(_pNAME); upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oUDP_DNS)

//---------------------------------------------------------------------
#define FEM_udp6_snmp_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oUDP_SNMP) \
FEM_udp6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, \
{header=_HDR_UDP_NAME(_pNAME); payload=_UDP_SNMP_NAME(_pNAME);}) \
Udp_SNMP _UDP_SNMP_NAME(_pNAME) _oUDP_SNMP

//---------------------------------------------------------------------
#define FEM_udp6_snmp(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oUDP_SNMP) \
FEM_udp6_snmp_exth(_pNAME, _pETHER, _oHDR_IPV6, \
{header=_HDR_IPV6_NAME(_pNAME); upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oUDP_SNMP)

//---------------------------------------------------------------------
#define _FEM_dhcp6_exth(_pType, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6) \
FEM_udp6_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, \
{header=_HDR_UDP_NAME(_pNAME); payload=_UDP_DHCPV6_NAME(_pNAME);}) \
Udp_DHCPv6_##_pType _UDP_DHCPV6_NAME(_pNAME) _oDHCPV6

//---------------------------------------------------------------------
#define _FEM_dhcp6(_pType, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6) \
_FEM_dhcp6_exth(_pType, _pNAME, _pETHER, _oHDR_IPV6, \
{header=_HDR_IPV6_NAME(_pNAME); upper=_UPP_UDP_NAME(_pNAME);}, \
_oHDR_UDP, _oDHCPV6)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_any_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_ANY) \
_FEM_dhcp6_exth(ANY, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_ANY)

#define FEM_dhcp6_any(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_ANY) \
_FEM_dhcp6(ANY, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_ANY)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_solicit_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Solicit) \
_FEM_dhcp6_exth(Solicit, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Solicit)

#define FEM_dhcp6_solicit(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Solicit) \
_FEM_dhcp6(Solicit, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Solicit)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_advertise_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Advertise) \
_FEM_dhcp6_exth(Advertise, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Advertise)

#define FEM_dhcp6_advertise(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Advertise) \
_FEM_dhcp6(Advertise, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Advertise)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_request_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Request) \
_FEM_dhcp6_exth(Request, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Request)

#define FEM_dhcp6_request(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Request) \
_FEM_dhcp6(Request, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Request)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_confirm_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Confirm) \
_FEM_dhcp6_exth(Confirm, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Confirm)

#define FEM_dhcp6_confirm(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Confirm) \
_FEM_dhcp6(Confirm, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Confirm)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_renew_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Renew) \
_FEM_dhcp6_exth(Renew, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Renew)

#define FEM_dhcp6_renew(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Renew) \
_FEM_dhcp6(Renew, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Renew)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_rebind_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Rebind) \
_FEM_dhcp6_exth(Rebind, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Rebind)

#define FEM_dhcp6_rebind(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Rebind) \
_FEM_dhcp6(Rebind, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Rebind)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_reply_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Reply) \
_FEM_dhcp6_exth(Reply, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Reply)

#define FEM_dhcp6_reply(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Reply) \
_FEM_dhcp6(Reply, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Reply)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_release_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Release) \
_FEM_dhcp6_exth(Release, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Release)

#define FEM_dhcp6_release(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Release) \
_FEM_dhcp6(Release, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Release)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_decline_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Decline) \
_FEM_dhcp6_exth(Decline, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Decline)

#define FEM_dhcp6_decline(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Decline) \
_FEM_dhcp6(Decline, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Decline)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_reconfigure_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Reconfigure) \
_FEM_dhcp6_exth(Reconfigure, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_Reconfigure)

#define FEM_dhcp6_reconfigure(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Reconfigure) \
_FEM_dhcp6(Reconfigure, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_Reconfigure)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_information_request_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_InformationRequest) \
_FEM_dhcp6_exth(InformationRequest, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_InformationRequest)

#define FEM_dhcp6_information_request(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_InformationRequest) \
_FEM_dhcp6(InformationRequest, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_InformationRequest)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_relay_forward_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_RelayForward) \
_FEM_dhcp6_exth(RelayForward, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_RelayForward)

#define FEM_dhcp6_relay_forward(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_RelayForward) \
_FEM_dhcp6(RelayForward, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_RelayForward)

////////////////////////////////////////////////////////////////
#define FEM_dhcp6_relay_reply_exth(_pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_RelayReply) \
_FEM_dhcp6_exth(RelayReply, _pNAME, _pETHER, _oHDR_IPV6, _oPACKET_IPV6, _oHDR_UDP, _oDHCPV6_RelayReply)

#define FEM_dhcp6_relay_reply(_pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_RelayReply) \
_FEM_dhcp6(RelayReply, _pNAME, _pETHER, _oHDR_IPV6, _oHDR_UDP, _oDHCPV6_RelayReply)

#endif /*_STDPACKET_DEF_*/
