vnet.h revision 194641
150974Swpaul/*-
250974Swpaul * Copyright (c) 2006-2008 University of Zagreb
350974Swpaul * Copyright (c) 2006-2008 FreeBSD Foundation
450974Swpaul *
550974Swpaul * This software was developed by the University of Zagreb and the
650974Swpaul * FreeBSD Foundation under sponsorship by the Stichting NLnet and the
750974Swpaul * FreeBSD Foundation.
850974Swpaul *
950974Swpaul * Redistribution and use in source and binary forms, with or without
1050974Swpaul * modification, are permitted provided that the following conditions
1150974Swpaul * are met:
1250974Swpaul * 1. Redistributions of source code must retain the above copyright
1350974Swpaul *    notice, this list of conditions and the following disclaimer.
1450974Swpaul * 2. Redistributions in binary form must reproduce the above copyright
1550974Swpaul *    notice, this list of conditions and the following disclaimer in the
1650974Swpaul *    documentation and/or other materials provided with the distribution.
1750974Swpaul *
1850974Swpaul * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1950974Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2050974Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2150974Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2250974Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2350974Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2450974Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2550974Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2650974Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2750974Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2850974Swpaul * SUCH DAMAGE.
2950974Swpaul *
3050974Swpaul * $FreeBSD: head/sys/net/vnet.h 194641 2009-06-22 17:56:07Z bz $
3150974Swpaul */
3250974Swpaul
33212159Syongari#ifndef _NET_VNET_H_
3453200Sphantom#define	_NET_VNET_H_
3562682Swpaul
3650974Swpaul#include <net/if_var.h>
3750974Swpaul
38163313Sobrienstruct vnet_net {
3950974Swpaul	int			_if_index;
40151046Strhodes	struct ifindex_entry *	_ifindex_table;
41151046Strhodes	struct ifnethead	_ifnet;
42148220Strhodes	struct ifgrouphead	_ifg_head;
43148145Strhodes
4456467Sasmodai	int			_if_indexlim;
4556467Sasmodai	struct knlist		_ifklist;
46148145Strhodes
47148145Strhodes	struct ifnet *		_loif;
48151046Strhodes	struct if_clone *	_lo_cloner;
49151046Strhodes	struct ifc_simple_data *_lo_cloner_data;
50148145Strhodes
51148145Strhodes	LIST_HEAD(, rawcb)	_rawcb_list;
52148145Strhodes
53148145Strhodes	LIST_HEAD(, if_clone)	_if_cloners;
5450974Swpaul	int			_if_cloners_count;
5550974Swpaul
5650974Swpaul	int			_ether_ipfw;
57122336Sbmah};
5850974Swpaul
59134779Sbrueffer/* Size guard. See sys/vimage.h. */
6050974SwpaulVIMAGE_CTASSERT(SIZEOF_vnet_net, sizeof(struct vnet_net));
61122335Sbmah
62163313Sobrien#ifndef VIMAGE
63134779Sbrueffer#ifndef VIMAGE_GLOBALS
64122335Sbmahextern struct vnet_net vnet_net_0;
65122336Sbmah#endif
6657676Ssheldonh#endif
6757676Ssheldonh
6857676Ssheldonh/*
6957676Ssheldonh * Symbol translation macros
7050974Swpaul */
7150974Swpaul#define	INIT_VNET_NET(vnet) \
7250974Swpaul	INIT_FROM_VNET(vnet, VNET_MOD_NET, struct vnet_net, vnet_net)
7350974Swpaul
7450974Swpaul#define	VNET_NET(sym)	VSYM(vnet_net, sym)
75122336Sbmah
7662672Swpaul#define	V_ether_ipfw		VNET_NET(ether_ipfw)
7762672Swpaul#define	V_if_index		VNET_NET(if_index)
7862672Swpaul#define	V_if_indexlim		VNET_NET(if_indexlim)
7962672Swpaul#define	V_if_cloners		VNET_NET(if_cloners)
8050974Swpaul#define	V_if_cloners_count	VNET_NET(if_cloners_count)
8150974Swpaul#define	V_ifg_head		VNET_NET(ifg_head)
8250974Swpaul#define	V_ifindex_table		VNET_NET(ifindex_table)
8362682Swpaul#define	V_ifklist		VNET_NET(ifklist)
8450974Swpaul#define	V_ifnet			VNET_NET(ifnet)
8550974Swpaul#define	V_lo_cloner		VNET_NET(lo_cloner)
8650974Swpaul#define	V_lo_cloner_data	VNET_NET(lo_cloner_data)
8762682Swpaul#define	V_loif			VNET_NET(loif)
8862682Swpaul#define	V_rawcb_list		VNET_NET(rawcb_list)
8950974Swpaul
9057676Ssheldonh#endif /* !_NET_VNET_H_ */
9157676Ssheldonh