2 * Copyright 2015, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _NETWORK_ROUTE_H
6 #define _NETWORK_ROUTE_H
10 #include <ObjectList.h>
18 status_t
SetTo(const BNetworkRoute
& other
);
19 status_t
SetTo(const route_entry
& routeEntry
);
21 void Adopt(BNetworkRoute
& other
);
23 const route_entry
& RouteEntry() const;
25 const sockaddr
* Destination() const;
26 status_t
SetDestination(const sockaddr
& destination
);
27 void UnsetDestination();
29 const sockaddr
* Mask() const;
30 status_t
SetMask(const sockaddr
& mask
);
33 const sockaddr
* Gateway() const;
34 status_t
SetGateway(const sockaddr
& gateway
);
37 const sockaddr
* Source() const;
38 status_t
SetSource(const sockaddr
& source
);
42 void SetFlags(uint32 flags
);
45 void SetMTU(uint32 mtu
);
47 int AddressFamily() const;
49 static status_t
GetDefaultRoute(int family
,
50 const char* interfaceName
,
51 BNetworkRoute
& route
);
52 static status_t
GetDefaultGateway(int family
,
53 const char* interfaceName
,
56 static status_t
GetRoutes(int family
,
57 BObjectList
<BNetworkRoute
>& routes
);
58 static status_t
GetRoutes(int family
, const char* interfaceName
,
59 BObjectList
<BNetworkRoute
>& routes
);
60 static status_t
GetRoutes(int family
, const char* interfaceName
,
62 BObjectList
<BNetworkRoute
>& routes
);
65 BNetworkRoute(const BNetworkRoute
& other
);
66 // unimplemented to disallow copying
68 status_t
_AllocateAndSetAddress(const sockaddr
& from
,
70 void _FreeAndUnsetAddress(sockaddr
*& address
);
72 route_entry fRouteEntry
;
75 #endif // _NETWORK_ROUTE_H