iface.h revision 81634
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: head/usr.sbin/ppp/iface.h 81634 2001-08-14 16:05:52Z 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) */
3940561Sbrian  int index;			/* Interface index */
4040561Sbrian  int flags;			/* Interface flags (IFF_*) */
4178410Sbrian  int mtu;			/* struct tuninfo MTU */
4240561Sbrian
4381634Sbrian  int addrs;			/* How many in_addr's */
4481634Sbrian  struct iface_addr *addr;	/* Array of addresses (malloc'd) */
4540561Sbrian};
4640561Sbrian
4740561Sbrian#define IFACE_CLEAR_ALL		0	/* Nuke 'em all */
4881634Sbrian#define IFACE_CLEAR_ALIASES	1	/* Leave the NCP address */
4940561Sbrian
5040561Sbrian#define IFACE_ADD_LAST		0	/* Just another alias */
5140561Sbrian#define IFACE_ADD_FIRST		1	/* The IPCP address */
5240561Sbrian#define IFACE_FORCE_ADD		2	/* OR'd with IFACE_ADD_{FIRST,LAST} */
5340561Sbrian
5481634Sbrian#define IFACE_SYSTEM		4	/* Set/clear SYSTEM entries */
5540561Sbrian
5640561Sbrianextern struct iface *iface_Create(const char *name);
5781634Sbrianextern void iface_Clear(struct iface *, struct ncp *, int, int);
5881634Sbrianextern int iface_Add(struct iface *, struct ncp *, const struct ncprange *,
5981634Sbrian                     const struct ncpaddr *, int);
6081634Sbrianextern int iface_Delete(struct iface *, struct ncp *, const struct ncpaddr *);
6140561Sbrianextern int iface_Show(struct cmdargs const *);
6274916Sbrianextern int iface_SetFlags(const char *, int);
6374916Sbrianextern int iface_ClearFlags(const char *, int);
6440561Sbrianextern void iface_Destroy(struct iface *);
6558032Sbrianextern void iface_ParseHdr(struct ifa_msghdr *, struct sockaddr *[RTAX_MAX]);
66