xref: /haiku/src/add-ons/kernel/network/stack/routes.h (revision 93a78ecaa45114d68952d08c4778f073515102f2)
1 /*
2  * Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  */
8 #ifndef ROUTES_H
9 #define ROUTES_H
10 
11 
12 #include <net_datalink.h>
13 #include <net_stack.h>
14 
15 #include <util/DoublyLinkedList.h>
16 
17 
18 struct net_route_private : net_route, public DoublyLinkedListLinkImpl<net_route_private> {
19 	int32	ref_count;
20 
21 	net_route_private();
22 	~net_route_private();
23 };
24 
25 typedef DoublyLinkedList<net_route_private> RouteList;
26 typedef DoublyLinkedList<net_route_info,
27 	DoublyLinkedListCLink<net_route_info> > RouteInfoList;
28 
29 
30 uint32 route_table_size(struct net_domain_private *domain);
31 status_t list_routes(struct net_domain_private *domain, void *buffer,
32 				size_t size);
33 status_t control_routes(struct net_interface *interface,
34 				int32 option, void *argument, size_t length);
35 
36 status_t add_route(struct net_domain *domain,
37 				const struct net_route *route);
38 status_t remove_route(struct net_domain *domain,
39 				const struct net_route *route);
40 status_t get_route_information(struct net_domain *domain, void *buffer,
41 				size_t length);
42 void invalidate_routes(net_domain *, net_interface *);
43 struct net_route *get_route(struct net_domain *domain,
44 				const struct sockaddr *address);
45 status_t get_buffer_route(struct net_domain *domain,
46 	struct net_buffer *buffer, struct net_route **_route);
47 void put_route(struct net_domain *domain, struct net_route *route);
48 
49 status_t register_route_info(struct net_domain *domain,
50 				struct net_route_info *info);
51 status_t unregister_route_info(struct net_domain *domain,
52 				struct net_route_info *info);
53 status_t update_route_info(struct net_domain *domain,
54 				struct net_route_info *info);
55 
56 #endif	// ROUTES_H
57