iface.h revision 50479
174462Salfred/*- 214123Speter * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 314123Speter * All rights reserved. 414123Speter * 514123Speter * Redistribution and use in source and binary forms, with or without 614123Speter * modification, are permitted provided that the following conditions 714123Speter * are met: 814123Speter * 1. Redistributions of source code must retain the above copyright 914123Speter * notice, this list of conditions and the following disclaimer. 1014123Speter * 2. Redistributions in binary form must reproduce the above copyright 1114123Speter * notice, this list of conditions and the following disclaimer in the 1214123Speter * documentation and/or other materials provided with the distribution. 1314123Speter * 1414123Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1514123Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1614123Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1714123Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1814123Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1914123Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2014123Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2114123Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2214123Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2314123Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2414123Speter * SUCH DAMAGE. 2514123Speter * 2614123Speter * $FreeBSD: head/usr.sbin/ppp/iface.h 50479 1999-08-28 01:35:59Z peter $ 2714123Speter */ 2814123Speter 2914123Speterstruct iface_addr { 3014123Speter struct in_addr ifa; /* local address */ 3114123Speter struct in_addr mask; /* netmask */ 3214123Speter int bits; /* netmask bits - -1 if not contiguous */ 3314123Speter struct in_addr brd; /* peer address */ 34141580Sru}; 3514123Speter 36173281Smatteostruct iface { 3715096Smpp char *name; /* Interface name (malloc'd) */ 3814123Speter int index; /* Interface index */ 3914123Speter int flags; /* Interface flags (IFF_*) */ 4015096Smpp 4114123Speter int in_addrs; /* How many in_addr's */ 4214123Speter struct iface_addr *in_addr; /* Array of addresses (malloc'd) */ 4368965Sru}; 4474462Salfred 4574462Salfred#define IFACE_CLEAR_ALL 0 /* Nuke 'em all */ 46173281Smatteo#define IFACE_CLEAR_ALIASES 1 /* Leave the IPCP address */ 47168324Smatteo 4814123Speter#define IFACE_ADD_LAST 0 /* Just another alias */ 4974462Salfred#define IFACE_ADD_FIRST 1 /* The IPCP address */ 5074462Salfred#define IFACE_FORCE_ADD 2 /* OR'd with IFACE_ADD_{FIRST,LAST} */ 5199968Scharnier 5274462Salfred#define iface_Clear iface_inClear /* Same for now */ 5374462Salfred 5474462Salfredextern struct iface *iface_Create(const char *name); 5574462Salfredextern void iface_inClear(struct iface *, int); 5674462Salfredextern int iface_inAdd(struct iface *, struct in_addr, struct in_addr, 5714123Speter struct in_addr, int); 5874462Salfredextern int iface_inDelete(struct iface *, struct in_addr); 5974462Salfredextern int iface_Show(struct cmdargs const *); 6030376Scharnierextern int iface_SetFlags(struct iface *, int); 6114123Speterextern int iface_ClearFlags(struct iface *, int); 6274462Salfredextern void iface_Destroy(struct iface *); 6374462Salfred