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