/* vim: set filetype=c:
 *
 **************************************************************************
 *
 * Boot-ROM-Code to load an operating system across a TCP/IP network.
 *
 * Module:  igmp.h86
 * Purpose: Definitions for implementing the group management protocol
 * Entries: none
 *
 **************************************************************************
 *
 * Copyright (C) 2003-2007 Gero Kuhlmann <gero@gkminix.han.de>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: igmp.h86,v 1.5 2007/01/06 18:30:47 gkminix Exp $
 */

#ifndef KERNEL_NET_IGMP_H86
#define KERNEL_NET_IGMP_H86


/*
 **************************************************************************
 *
 * We need some includes before we can include this file
 */
#include <common.h86>



/*
 **************************************************************************
 *
 * Definition of IGMP header
 */
struct igmphdr {
	__u8     igmp_type;
	__u8     igmp_max_time;
	__u16    igmp_checksum;
	t_ipaddr igmp_group;
};



/*
 **************************************************************************
 * 
 * IGMP packet types
 */
#define IGMP_QUERY	0x11		/* membership query packet	*/
#define IGMP_V1_REPORT	0x12		/* V1 membership report		*/
#define IGMP_V2_REPORT	0x16		/* V2 membership report		*/
#define IGMP_LEAVE	0x17		/* leave membership group	*/



/*
 **************************************************************************
 * 
 * Some default values
 */
#define IGMP_DEF_TIME	100		/* max. timeout is 10 seconds	*/
#define IGMP_IP_TTL	1		/* TTL for IGMP packets		*/
#define IGMP_OPTION	0x94040000	/* option for IP header		*/



/*
 **************************************************************************
 * 
 * External routines
 */

/* Receive an IGMP packet */
extern void igmp_recv(__u8 *buf, size_t ipsize);

/* Check if the IGMP timer has expired */
extern void igmp_check(void);

/* Join a multicast group */
extern void igmp_join(t_ipaddr mcast);

/* Leave a multicast group */
extern void igmp_leave(void);


#endif

