iface.h revision 259065
1139826Simp/*- 254263Sshin * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 354263Sshin * All rights reserved. 454263Sshin * 554263Sshin * Redistribution and use in source and binary forms, with or without 654263Sshin * modification, are permitted provided that the following conditions 754263Sshin * are met: 854263Sshin * 1. Redistributions of source code must retain the above copyright 954263Sshin * notice, this list of conditions and the following disclaimer. 1054263Sshin * 2. Redistributions in binary form must reproduce the above copyright 1154263Sshin * notice, this list of conditions and the following disclaimer in the 1254263Sshin * documentation and/or other materials provided with the distribution. 1354263Sshin * 1454263Sshin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1554263Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1654263Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1754263Sshin * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1854263Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1954263Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2054263Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2154263Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2254263Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2354263Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2454263Sshin * SUCH DAMAGE. 2554263Sshin * 2654263Sshin * $FreeBSD: releng/10.0/usr.sbin/ppp/iface.h 218397 2011-02-07 11:18:18Z brian $ 2754263Sshin */ 28174510Sobrien 29174510Sobrienstruct ifa_msghdr; 30174510Sobrien 3154263Sshinstruct iface_addr { 3254263Sshin unsigned system : 1; /* System alias ? */ 3354263Sshin struct ncprange ifa; /* local address/mask */ 3462587Sitojun struct ncpaddr peer; /* peer address */ 3554263Sshin}; 3662587Sitojun 3754263Sshinstruct iface { 38105293Sume char *name; /* Interface name (malloc'd) */ 39241916Sdelphij char *descr; /* Interface description (malloc'd) */ 40241916Sdelphij int index; /* Interface index */ 41241916Sdelphij int flags; /* Interface flags (IFF_*) */ 42241916Sdelphij unsigned long mtu; /* struct tuninfo MTU */ 43241916Sdelphij 4454263Sshin unsigned addrs; /* How many in_addr's */ 45120913Sume struct iface_addr *addr; /* Array of addresses (malloc'd) */ 46}; 47 48#define IFACE_CLEAR_ALL 0 /* Nuke 'em all */ 49#define IFACE_CLEAR_ALIASES 1 /* Leave the NCP address */ 50 51#define IFACE_ADD_LAST 0 /* Just another alias */ 52#define IFACE_ADD_FIRST 1 /* The IPCP address */ 53#define IFACE_FORCE_ADD 2 /* OR'd with IFACE_ADD_{FIRST,LAST} */ 54 55#define IFACE_SYSTEM 4 /* Set/clear SYSTEM entries */ 56 57extern struct iface *iface_Create(const char *name); 58extern void iface_Clear(struct iface *, struct ncp *, int, int); 59extern int iface_Name(struct iface *, const char *); 60extern int iface_Descr(struct cmdargs const *); 61extern int iface_Add(struct iface *, struct ncp *, const struct ncprange *, 62 const struct ncpaddr *, int); 63extern int iface_Delete(struct iface *, struct ncp *, const struct ncpaddr *); 64extern int iface_Show(struct cmdargs const *); 65extern int iface_SetFlags(const char *, int); 66extern int iface_ClearFlags(const char *, int); 67extern void iface_Free(struct iface *); 68extern void iface_Destroy(struct iface *); 69extern void iface_ParseHdr(struct ifa_msghdr *, struct sockaddr *[RTAX_MAX]); 70