xref: /netbsd/sbin/route/rtutil.h (revision 5c1ef4f7)
1 /*	$NetBSD: rtutil.h,v 1.4 2019/06/30 11:38:16 sevan Exp $	*/
2 
3 /*-
4  * Copyright (c) 2013 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Christos Zoulas.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of The NetBSD Foundation nor the names of its
19  *    contributors may be used to endorse or promote products derived
20  *    from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #define RT_AFLAG	__BIT(0)	/* show address field */
36 #define RT_TFLAG	__BIT(1)	/* show tag field */
37 #define RT_VFLAG	__BIT(2)	/* show verbose statistics */
38 #define RT_NFLAG	__BIT(3)	/* numeric output */
39 #define RT_LFLAG	__BIT(4)	/* don't show LLINFO entries */
40 
41 void p_rttables(int, int, int, int);
42 void p_rthdr(int, int);
43 void p_family(int);
44 void p_sockaddr(const struct sockaddr *, const struct sockaddr *, int, int, int);
45 void p_flags(int);
46 struct rt_metrics;
47 void p_rtrmx(const struct rt_metrics *);
48 void p_addr(const struct sockaddr *sa, const struct sockaddr *mask, int, int);
49 void p_gwaddr(const struct sockaddr *sa, int, int);
50 
51 char *routename(const struct sockaddr *sa, int);
52 char *routename4(in_addr_t, int);
53 #ifdef INET6
54 char *routename6(const struct sockaddr_in6 *, int);
55 char *netname6(const struct sockaddr_in6 *, const struct sockaddr_in6 *, int);
56 #endif
57 char *netname(const struct sockaddr *, const struct sockaddr *, int);
58 char *netname4(const struct sockaddr_in *, const struct sockaddr_in *, int);
59 
60 char *mpls_ntoa(const struct sockaddr *);
61 char *any_ntoa(const struct sockaddr *);
62