iface.h revision 218397
11541Srgrimes/*- 21541Srgrimes * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 31541Srgrimes * All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 141541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 151541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 161541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 171541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 181541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 191541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 201541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 211541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 221541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 231541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 241541Srgrimes * SUCH DAMAGE. 251541Srgrimes * 261541Srgrimes * $FreeBSD: head/usr.sbin/ppp/iface.h 218397 2011-02-07 11:18:18Z brian $ 271541Srgrimes */ 281541Srgrimes 291541Srgrimesstruct ifa_msghdr; 301541Srgrimes 311541Srgrimesstruct iface_addr { 321541Srgrimes unsigned system : 1; /* System alias ? */ 331541Srgrimes struct ncprange ifa; /* local address/mask */ 341541Srgrimes struct ncpaddr peer; /* peer address */ 351541Srgrimes}; 361541Srgrimes 3750477Speterstruct iface { 381541Srgrimes char *name; /* Interface name (malloc'd) */ 391541Srgrimes char *descr; /* Interface description (malloc'd) */ 402192Spaul int index; /* Interface index */ 412168Spaul int flags; /* Interface flags (IFF_*) */ 422168Spaul unsigned long mtu; /* struct tuninfo MTU */ 431541Srgrimes 4458982Sgj unsigned addrs; /* How many in_addr's */ 451541Srgrimes struct iface_addr *addr; /* Array of addresses (malloc'd) */ 461541Srgrimes}; 471541Srgrimes 481541Srgrimes#define IFACE_CLEAR_ALL 0 /* Nuke 'em all */ 491541Srgrimes#define IFACE_CLEAR_ALIASES 1 /* Leave the NCP address */ 501541Srgrimes 511541Srgrimes#define IFACE_ADD_LAST 0 /* Just another alias */ 521541Srgrimes#define IFACE_ADD_FIRST 1 /* The IPCP address */ 531541Srgrimes#define IFACE_FORCE_ADD 2 /* OR'd with IFACE_ADD_{FIRST,LAST} */ 541541Srgrimes 551541Srgrimes#define IFACE_SYSTEM 4 /* Set/clear SYSTEM entries */ 561541Srgrimes 571541Srgrimesextern struct iface *iface_Create(const char *name); 588876Srgrimesextern void iface_Clear(struct iface *, struct ncp *, int, int); 591541Srgrimesextern int iface_Name(struct iface *, const char *); 601541Srgrimesextern int iface_Descr(struct cmdargs const *); 6113765Smppextern int iface_Add(struct iface *, struct ncp *, const struct ncprange *, 621541Srgrimes const struct ncpaddr *, int); 631541Srgrimesextern int iface_Delete(struct iface *, struct ncp *, const struct ncpaddr *); 641541Srgrimesextern int iface_Show(struct cmdargs const *); 651541Srgrimesextern int iface_SetFlags(const char *, int); 661541Srgrimesextern int iface_ClearFlags(const char *, int); 671541Srgrimesextern void iface_Free(struct iface *); 681541Srgrimesextern void iface_Destroy(struct iface *); 691541Srgrimesextern void iface_ParseHdr(struct ifa_msghdr *, struct sockaddr *[RTAX_MAX]); 701541Srgrimes