140561Sbrian/*- 240561Sbrian * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 340561Sbrian * All rights reserved. 440561Sbrian * 540561Sbrian * Redistribution and use in source and binary forms, with or without 640561Sbrian * modification, are permitted provided that the following conditions 740561Sbrian * are met: 840561Sbrian * 1. Redistributions of source code must retain the above copyright 940561Sbrian * notice, this list of conditions and the following disclaimer. 1040561Sbrian * 2. Redistributions in binary form must reproduce the above copyright 1140561Sbrian * notice, this list of conditions and the following disclaimer in the 1240561Sbrian * documentation and/or other materials provided with the distribution. 1340561Sbrian * 1440561Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1540561Sbrian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1640561Sbrian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1740561Sbrian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1840561Sbrian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1940561Sbrian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2040561Sbrian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2140561Sbrian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2240561Sbrian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2340561Sbrian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2440561Sbrian * SUCH DAMAGE. 2540561Sbrian * 2650479Speter * $FreeBSD: releng/11.0/usr.sbin/ppp/iface.h 218397 2011-02-07 11:18:18Z brian $ 2740561Sbrian */ 2840561Sbrian 2958032Sbrianstruct ifa_msghdr; 3058032Sbrian 3140561Sbrianstruct iface_addr { 3281634Sbrian unsigned system : 1; /* System alias ? */ 3381634Sbrian struct ncprange ifa; /* local address/mask */ 3481634Sbrian struct ncpaddr peer; /* peer address */ 3540561Sbrian}; 3640561Sbrian 3740561Sbrianstruct iface { 3840561Sbrian char *name; /* Interface name (malloc'd) */ 39218397Sbrian char *descr; /* Interface description (malloc'd) */ 4040561Sbrian int index; /* Interface index */ 4140561Sbrian int flags; /* Interface flags (IFF_*) */ 42134789Sbrian unsigned long mtu; /* struct tuninfo MTU */ 4340561Sbrian 44134789Sbrian unsigned addrs; /* How many in_addr's */ 4581634Sbrian struct iface_addr *addr; /* Array of addresses (malloc'd) */ 4640561Sbrian}; 4740561Sbrian 4840561Sbrian#define IFACE_CLEAR_ALL 0 /* Nuke 'em all */ 4981634Sbrian#define IFACE_CLEAR_ALIASES 1 /* Leave the NCP address */ 5040561Sbrian 5140561Sbrian#define IFACE_ADD_LAST 0 /* Just another alias */ 5240561Sbrian#define IFACE_ADD_FIRST 1 /* The IPCP address */ 5340561Sbrian#define IFACE_FORCE_ADD 2 /* OR'd with IFACE_ADD_{FIRST,LAST} */ 5440561Sbrian 5581634Sbrian#define IFACE_SYSTEM 4 /* Set/clear SYSTEM entries */ 5640561Sbrian 5740561Sbrianextern struct iface *iface_Create(const char *name); 5881634Sbrianextern void iface_Clear(struct iface *, struct ncp *, int, int); 59218397Sbrianextern int iface_Name(struct iface *, const char *); 60218397Sbrianextern int iface_Descr(struct cmdargs const *); 6181634Sbrianextern int iface_Add(struct iface *, struct ncp *, const struct ncprange *, 6281634Sbrian const struct ncpaddr *, int); 6381634Sbrianextern int iface_Delete(struct iface *, struct ncp *, const struct ncpaddr *); 6440561Sbrianextern int iface_Show(struct cmdargs const *); 6574916Sbrianextern int iface_SetFlags(const char *, int); 6674916Sbrianextern int iface_ClearFlags(const char *, int); 67218397Sbrianextern void iface_Free(struct iface *); 6840561Sbrianextern void iface_Destroy(struct iface *); 6958032Sbrianextern void iface_ParseHdr(struct ifa_msghdr *, struct sockaddr *[RTAX_MAX]); 70