/*-
 * Copyright (c) 2001-2003 Andrey Simonenko
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 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.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR 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: kip6fw.h,v 1.1 2005/12/03 10:53:18 simon Exp $
 */

#ifndef KIP6FW_H
#define KIP6FW_H

#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
#include <netinet6/ip6_fw.h>

#define IP6FW_NUMBER_MIN	1
#define IP6FW_NUMBER_MAX	65535

#define IP6FW_BCNT(x)		(x.fw_bcnt)
#define IP6FWP_BCNT(p)		(p->fw_bcnt)
#define IP6FWP_NUMBER(p)	(p->fw_number)
#define IP6FWP_NEXT_RULE(p)	(++p)

struct kip6fw_rule {
	TAILQ_ENTRY(kip6fw_rule) link;	/* For linking active kip6fw_rules. */
	u_short		number;		/* Rule's number.		*/
	u_int		subnumber;	/* Rule's subnumber.		*/
	u_int		ref_count;	/* Reference counter.		*/
	const struct ip6_fw *ip6_fw;	/* Pointer to ip6_fw read from kernel. */
};

TAILQ_HEAD(kip6fw_rules_list, kip6fw_rule);

extern struct kip6fw_rules_list kip6fw_rules_active;

extern int	debug_ip6fw;
extern uint64_t	kip6fw_bcnt_max;

extern int	kip6fw_init(void);
extern int	kip6fw_deinit(void);
extern int	kip6fw_get_stat(void);

#endif /* KIP6FW_H */


syntax highlighted by Code2HTML, v. 0.9.1