1 /* 2 * Copyright 2006-2010, 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 class InterfaceAddress; 19 20 21 struct net_route_private 22 : net_route, DoublyLinkedListLinkImpl<net_route_private> { 23 int32 ref_count; 24 25 net_route_private(); 26 ~net_route_private(); 27 }; 28 29 typedef DoublyLinkedList<net_route_private> RouteList; 30 typedef DoublyLinkedList<net_route_info, 31 DoublyLinkedListCLink<net_route_info> > RouteInfoList; 32 33 34 uint32 route_table_size(struct net_domain_private* domain); 35 status_t list_routes(struct net_domain_private* domain, void* buffer, 36 size_t size); 37 status_t control_routes(struct net_interface* interface, net_domain* domain, 38 int32 option, void* argument, size_t length); 39 40 status_t add_route(struct net_domain* domain, 41 const struct net_route* route); 42 status_t remove_route(struct net_domain* domain, 43 const struct net_route* route); 44 status_t get_route_information(struct net_domain* domain, void* buffer, 45 size_t length); 46 void invalidate_routes(net_domain* domain, net_interface* interface); 47 void invalidate_routes(InterfaceAddress* address); 48 struct net_route* get_route(struct net_domain* domain, 49 const struct sockaddr* address); 50 status_t get_device_route(struct net_domain* domain, uint32 index, 51 struct net_route** _route); 52 status_t get_buffer_route(struct net_domain* domain, 53 struct net_buffer* buffer, struct net_route** _route); 54 void put_route(struct net_domain* domain, struct net_route* route); 55 56 status_t register_route_info(struct net_domain* domain, 57 struct net_route_info* info); 58 status_t unregister_route_info(struct net_domain* domain, 59 struct net_route_info* info); 60 status_t update_route_info(struct net_domain* domain, 61 struct net_route_info* info); 62 63 #endif // ROUTES_H 64