/*
    Copyright 2000 (c) by Marc Wegmueller,
    Swiss Federal Institute of Technology,
    Computer Engineering and Networks Laboratory.
 
    TOPSY -- A Teachable Operating System.
             Implementation of a tiny and simple
             micro kernel for teaching purposes.
 
    For further information, please visit http://www.tik.ee.ethz.ch/~topsy
 
    This software is provided under the terms of the GNU General Public 
    Licence. A full copy of the GNU GPL is provided in the file COPYING 
    found in the development root of Topsy.
*/
/*
	
    File:                  $Source: /home/ruf/cvs_Topsy/cvs/Topsy/Net/Modules/ICMP6/NetICMP6Module.h,v $
    Affiliation:           ETH Zuerich, TIK
    Version:               $Revision: 2922 $
    Last Date of Change:   $Date: 2007-03-19 17:48:52 +0100 (Mon, 19 Mär 2007) $  by: $Author: baderma $
 
*/


#ifndef _NETICMP6_H
#define _NETICMP6_H

#include <NetHAL.h>


typedef struct NetICMP6Hdr_base
{
  u8	type;
  u8	code;
  u16	checksum;
  u16     bitfield0;
  u16     bitfield1;
}
NetICMP6Hdr;

typedef struct NetICMP6Hdr_targetaddr
{
  u16     targetaddr[8];
}
NetICMP6Hdr_ta;

typedef struct NetICMP6Hdr_option
{
  u8     optiontype;
  u8     optionlength;
  u8     linklayer[6];
}
NetICMP6Hdr_opt;


#define NETICMP6_TYPE_DEST_UNREACH          1
#define NETICMP6_TYPE_PACKET_TOO_BIG        2
#define NETICMP6_TYPE_TIME_EXCEEDED         3
#define NETICMP6_TYPE_PARAMETER_PROBLEM     4
#define NETICMP6_TYPE_ECHO_REQUEST          128
#define NETICMP6_TYPE_ECHO_REPLY	    129		// Echo Reply
#define NETICMP6_TYPE_RouterSolicitation    133
#define NETICMP6_TYPE_RouterAdvertisement   134
#define NETICMP6_TYPE_NeighborSolicitation  135
#define NETICMP6_TYPE_NeighborAdvertisement 136
#define NETICMP6_TYPE_Redirect              137


#define ICMPV6_DEST_UNREACH		1
#define ICMPV6_PKT_TOOBIG		2
#define ICMPV6_TIME_EXCEED		3
#define ICMPV6_PARAMPROB		4
#define ICMPV6_INFOMSG_MASK		0x80
#define ICMPV6_ECHO_REQUEST		128
#define ICMPV6_ECHO_REPLY		129
#define ICMPV6_MGM_QUERY		130
#define ICMPV6_MGM_REPORT       	131
#define ICMPV6_MGM_REDUCTION    	132


//#define NETICMP_TYPE_DEST_UNREACH	3	// Destination Unreachable
//#define NETICMP_TYPE_SOURCE_QUENCH	4	// Source Quench
//#define NETICMP_TYPE_REDIRECT		5	// Redirect (change route)
//#define NETICMP_TYPE_ECHO			8	// Echo Request
//#define NETICMP_TYPE_TIME_EXCEEDED	11	// Time Exceeded
//#define NETICMP_TYPE_PARAMETERPROB	12	// Parameter Problem
//#define NETICMP_TYPE_TIMESTAMP		13	// Timestamp Request
//#define NETICMP_TYPE_TIMESTAMPREPLY	14	// Timestamp Reply
//#define NETICMP_TYPE_INFO_REQUEST	15	// Information Request
//#define NETICMP_TYPE_INFO_REPLY		16	// Information Reply
//#define NETICMP_TYPE_ADDRESS		17	// Address Mask Request
//#define NETICMP_TYPE_ADDRESSREPLY	18	// Address Mask Reply


//#define default_IPv6_adress0 0xfe80
//#define default_IPv6_adress1 0
//#define default_IPv6_adress2 0
//#define default_IPv6_adress3 0
//#define default_IPv6_adress4 0x0605
//#define default_IPv6_adress5 0x04ff
//#define default_IPv6_adress6 0xfe03
//#define default_IPv6_adress7 0x0201

#define LINK_LOCAL_ADDRESS      0xfe80


#define NETICMP6_MulticastAddr0 0xff02
#define NETICMP6_MulticastAddr1 0
#define NETICMP6_MulticastAddr2 0
#define NETICMP6_MulticastAddr3 0
#define NETICMP6_MulticastAddr4 0
#define NETICMP6_MulticastAddr5 0x0001
#define NETICMP6_MulticastAddr6 0xff00
#define NETICMP6_MulticastAddr7 0x0004

#define NETETH_MulticastPrefix 0x3333

#define NETICMP6_DEFAULT_TYPE		NETICMP6_TYPE_ECHO_REQUEST
#define NETICMP6_DEFAULT_CODE		0
#define NETICMP6_SOURCE_LINK_LAYER_ADDRESS 1
#define NETICMP6_TARGET_LINK_LAYER_ADDRESS 2


// function prototypes for ICMP Down
void netICMP6ModuleDownInit (NetModule this);
int netICMP6ModuleDownConfig (NetModule this, Message *msg);
void netICMP6ModuleDownMain (LWPool lw, ThreadArg arg);
// function prototypes for ICMP Up
void netICMP6ModuleUpInit (NetModule this);
int netICMP6ModuleUpConfig (NetModule this, Message *msg);
void netICMP6ModuleUpMain (LWPool lw, ThreadArg arg);


#endif
