xref: /openbsd/regress/sys/net/rtable/util.h (revision f5097eed)
1 /*	$OpenBSD: util.h,v 1.5 2023/07/07 20:38:17 bluhm Exp $	*/
2 
3 /*
4  * Copyright (c) 2015 Martin Pieuchot
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 void	route_insert(unsigned int, sa_family_t, char *);
20 void	route_delete(unsigned int, sa_family_t, char *);
21 void	route_lookup(unsigned int, sa_family_t, char *);
22 
23 int	do_from_file(unsigned int, sa_family_t, char *,
24 	    void (*f)(unsigned int, sa_family_t, char *));
25 
26 int	rtentry_dump(struct rtentry *, void *, unsigned int);
27 int	rtentry_delete(struct rtentry *, void *, unsigned int);
28 void	rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *);
29 int	maskcmp(sa_family_t, struct sockaddr *, struct sockaddr *);
30 int	inet_net_ptosa(sa_family_t, const char *, struct sockaddr *,
31 	     struct sockaddr *);
32 char	*inet_net_satop(sa_family_t, struct sockaddr *, int, char *, size_t);
33 
34 #define satosin(sa)	((struct sockaddr_in *)(sa))
35 #define satosin6(sa)	((struct sockaddr_in6 *)(sa))
36