178189Sbrian/*-
2330449Seadler * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3330449Seadler *
478189Sbrian * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
578189Sbrian *          based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
678189Sbrian *                           Internet Initiative Japan, Inc (IIJ)
778189Sbrian * All rights reserved.
813389Sphk *
978189Sbrian * Redistribution and use in source and binary forms, with or without
1078189Sbrian * modification, are permitted provided that the following conditions
1178189Sbrian * are met:
1278189Sbrian * 1. Redistributions of source code must retain the above copyright
1378189Sbrian *    notice, this list of conditions and the following disclaimer.
1478189Sbrian * 2. Redistributions in binary form must reproduce the above copyright
1578189Sbrian *    notice, this list of conditions and the following disclaimer in the
1678189Sbrian *    documentation and/or other materials provided with the distribution.
1713389Sphk *
1878189Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1978189Sbrian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2078189Sbrian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2178189Sbrian * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2278189Sbrian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2378189Sbrian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2478189Sbrian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2578189Sbrian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2678189Sbrian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2778189Sbrian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2878189Sbrian * SUCH DAMAGE.
2913389Sphk *
3050479Speter * $FreeBSD: stable/11/usr.sbin/ppp/route.h 330449 2018-03-05 07:26:05Z eadler $
3113389Sphk */
3213389Sphk
3336285Sbrianstruct bundle;
3436285Sbrianstruct cmdargs;
3558032Sbrianstruct rt_msghdr;
3658032Sbrianstruct sockaddr;
3736285Sbrian
3881634Sbrian#define ROUTE_STATIC		0x0000
3981634Sbrian#define ROUTE_DSTMYADDR		0x0001
4081634Sbrian#define ROUTE_DSTMYADDR6	0x0002
4181634Sbrian#define ROUTE_DSTHISADDR	0x0004
4281634Sbrian#define ROUTE_DSTHISADDR6	0x0008
4381634Sbrian#define ROUTE_DSTDNS0		0x0010
4481634Sbrian#define ROUTE_DSTDNS1		0x0020
4581634Sbrian#define ROUTE_DSTANY		0x0040
4681634Sbrian#define ROUTE_GWHISADDR		0x0080	/* May be ORd with DST_* */
4781634Sbrian#define ROUTE_GWHISADDR6	0x0100	/* May be ORd with DST_* */
4836285Sbrian
4936285Sbrianstruct sticky_route {
5036285Sbrian  int type;				/* ROUTE_* value (not _STATIC) */
5136285Sbrian  struct sticky_route *next;		/* next in list */
5236285Sbrian
5381634Sbrian  struct ncprange dst;
5481634Sbrian  struct ncpaddr gw;
5536285Sbrian};
5636285Sbrian
5730715Sbrianextern int GetIfIndex(char *);
5836285Sbrianextern int route_Show(struct cmdargs const *);
5936285Sbrianextern void route_IfDelete(struct bundle *, int);
6075212Sbrianextern void route_UpdateMTU(struct bundle *);
6132616Sbrianextern const char *Index2Nam(int);
6236285Sbrianextern void route_Change(struct bundle *, struct sticky_route *,
6381634Sbrian                         const struct ncpaddr *, const struct ncpaddr *);
6481634Sbrianextern void route_Add(struct sticky_route **, int, const struct ncprange *,
6581634Sbrian                      const struct ncpaddr *);
6681634Sbrianextern void route_Delete(struct sticky_route **, int, const struct ncprange *);
6736285Sbrianextern void route_DeleteAll(struct sticky_route **);
6836285Sbrianextern void route_Clean(struct bundle *, struct sticky_route *);
6943313Sbrianextern void route_ShowSticky(struct prompt *, struct sticky_route *,
7043313Sbrian                             const char *, int);
7158032Sbrianextern void route_ParseHdr(struct rt_msghdr *, struct sockaddr *[RTAX_MAX]);
7281634Sbrianextern int rt_Set(struct bundle *, int, const struct ncprange *,
7381634Sbrian                  const struct ncpaddr *, int, int);
7481739Sbrianextern void rt_Update(struct bundle *, const struct sockaddr *,
75191316Sbz                      const struct sockaddr *, const struct sockaddr *,
7681739Sbrian                      const struct sockaddr *, const struct sockaddr *);
77