1139823Simp/*- 2130933Sbrooks * Copyright (c) 1982, 1986, 1989, 1993 3130933Sbrooks * The Regents of the University of California. All rights reserved. 4130933Sbrooks * 5130933Sbrooks * Redistribution and use in source and binary forms, with or without 6130933Sbrooks * modification, are permitted provided that the following conditions 7130933Sbrooks * are met: 8130933Sbrooks * 1. Redistributions of source code must retain the above copyright 9130933Sbrooks * notice, this list of conditions and the following disclaimer. 10130933Sbrooks * 2. Redistributions in binary form must reproduce the above copyright 11130933Sbrooks * notice, this list of conditions and the following disclaimer in the 12130933Sbrooks * documentation and/or other materials provided with the distribution. 13130933Sbrooks * 4. Neither the name of the University nor the names of its contributors 14130933Sbrooks * may be used to endorse or promote products derived from this software 15130933Sbrooks * without specific prior written permission. 16130933Sbrooks * 17130933Sbrooks * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18130933Sbrooks * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19130933Sbrooks * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20130933Sbrooks * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21130933Sbrooks * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22130933Sbrooks * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23130933Sbrooks * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24130933Sbrooks * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25130933Sbrooks * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26130933Sbrooks * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27130933Sbrooks * SUCH DAMAGE. 28130933Sbrooks * 29130933Sbrooks * From: @(#)if.h 8.1 (Berkeley) 6/10/93 30130933Sbrooks * $FreeBSD$ 31130933Sbrooks */ 32130933Sbrooks 33130933Sbrooks#ifndef _NET_IF_CLONE_H_ 34130933Sbrooks#define _NET_IF_CLONE_H_ 35130933Sbrooks 36130933Sbrooks#ifdef _KERNEL 37130933Sbrooks 38241610Sglebiusstruct if_clone; 39130933Sbrooks 40241610Sglebius/* Methods. */ 41241610Sglebiustypedef int ifc_match_t(struct if_clone *, const char *); 42241610Sglebiustypedef int ifc_create_t(struct if_clone *, char *, size_t, caddr_t); 43241610Sglebiustypedef int ifc_destroy_t(struct if_clone *, struct ifnet *); 44130933Sbrooks 45241610Sglebiustypedef int ifcs_create_t(struct if_clone *, int, caddr_t); 46241610Sglebiustypedef void ifcs_destroy_t(struct ifnet *); 47130933Sbrooks 48241610Sglebius/* Interface cloner (de)allocating functions. */ 49241610Sglebiusstruct if_clone * 50241610Sglebius if_clone_advanced(const char *, u_int, ifc_match_t, ifc_create_t, 51241610Sglebius ifc_destroy_t); 52241610Sglebiusstruct if_clone * 53241610Sglebius if_clone_simple(const char *, ifcs_create_t, ifcs_destroy_t, u_int); 54130933Sbrooksvoid if_clone_detach(struct if_clone *); 55130933Sbrooks 56241610Sglebius/* Unit (de)allocating fucntions. */ 57130933Sbrooksint ifc_name2unit(const char *name, int *unit); 58130933Sbrooksint ifc_alloc_unit(struct if_clone *, int *); 59130933Sbrooksvoid ifc_free_unit(struct if_clone *, int); 60130933Sbrooks 61241610Sglebius/* Interface clone event. */ 62130933Sbrookstypedef void (*if_clone_event_handler_t)(void *, struct if_clone *); 63130933SbrooksEVENTHANDLER_DECLARE(if_clone_event, if_clone_event_handler_t); 64130933Sbrooks 65241610Sglebius/* The below interfaces used only by net/if.c. */ 66241610Sglebiusvoid if_clone_init(void); 67241610Sglebiusvoid vnet_if_clone_init(void); 68241610Sglebiusint if_clone_create(char *, size_t, caddr_t); 69241610Sglebiusint if_clone_destroy(const char *); 70241610Sglebiusint if_clone_list(struct if_clonereq *); 71285824Shrsstruct if_clone *if_clone_findifc(struct ifnet *); 72285824Shrsvoid if_clone_addgroup(struct ifnet *, struct if_clone *); 73130933Sbrooks 74241610Sglebius/* The below interface used only by epair(4). */ 75241610Sglebiusint if_clone_destroyif(struct if_clone *, struct ifnet *); 76130933Sbrooks 77130933Sbrooks#endif /* _KERNEL */ 78130933Sbrooks#endif /* !_NET_IF_CLONE_H_ */ 79