iface.h revision 50479
1204792Srdivacky/*- 2204792Srdivacky * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 3204792Srdivacky * All rights reserved. 4204792Srdivacky * 5204792Srdivacky * Redistribution and use in source and binary forms, with or without 6204792Srdivacky * modification, are permitted provided that the following conditions 7204792Srdivacky * are met: 8204792Srdivacky * 1. Redistributions of source code must retain the above copyright 9204792Srdivacky * notice, this list of conditions and the following disclaimer. 10204792Srdivacky * 2. Redistributions in binary form must reproduce the above copyright 11204792Srdivacky * notice, this list of conditions and the following disclaimer in the 12204792Srdivacky * documentation and/or other materials provided with the distribution. 13204792Srdivacky * 14204792Srdivacky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15249423Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16249423Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17204792Srdivacky * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18249423Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19204792Srdivacky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20204792Srdivacky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21204792Srdivacky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22243830Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23234353Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24204792Srdivacky * SUCH DAMAGE. 25204792Srdivacky * 26204792Srdivacky * $FreeBSD: head/usr.sbin/ppp/iface.h 50479 1999-08-28 01:35:59Z peter $ 27204792Srdivacky */ 28204792Srdivacky 29204792Srdivackystruct iface_addr { 30204792Srdivacky struct in_addr ifa; /* local address */ 31243830Sdim struct in_addr mask; /* netmask */ 32239462Sdim int bits; /* netmask bits - -1 if not contiguous */ 33204792Srdivacky struct in_addr brd; /* peer address */ 34239462Sdim}; 35239462Sdim 36239462Sdimstruct iface { 37239462Sdim char *name; /* Interface name (malloc'd) */ 38243830Sdim int index; /* Interface index */ 39239462Sdim int flags; /* Interface flags (IFF_*) */ 40204792Srdivacky 41204792Srdivacky int in_addrs; /* How many in_addr's */ 42204792Srdivacky struct iface_addr *in_addr; /* Array of addresses (malloc'd) */ 43243830Sdim}; 44239462Sdim 45204792Srdivacky#define IFACE_CLEAR_ALL 0 /* Nuke 'em all */ 46210299Sed#define IFACE_CLEAR_ALIASES 1 /* Leave the IPCP address */ 47210299Sed 48243830Sdim#define IFACE_ADD_LAST 0 /* Just another alias */ 49210299Sed#define IFACE_ADD_FIRST 1 /* The IPCP address */ 50204792Srdivacky#define IFACE_FORCE_ADD 2 /* OR'd with IFACE_ADD_{FIRST,LAST} */ 51204792Srdivacky 52204792Srdivacky#define iface_Clear iface_inClear /* Same for now */ 53243830Sdim 54239462Sdimextern struct iface *iface_Create(const char *name); 55205218Srdivackyextern void iface_inClear(struct iface *, int); 56205218Srdivackyextern int iface_inAdd(struct iface *, struct in_addr, struct in_addr, 57205218Srdivacky struct in_addr, int); 58205218Srdivackyextern int iface_inDelete(struct iface *, struct in_addr); 59243830Sdimextern int iface_Show(struct cmdargs const *); 60239462Sdimextern int iface_SetFlags(struct iface *, int); 61204792Srdivackyextern int iface_ClearFlags(struct iface *, int); 62206083Srdivackyextern void iface_Destroy(struct iface *); 63206083Srdivacky