Line data Source code
1 : // Copyright (c) 2012-2021 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/libaddr
4 : //
5 : // Permission is hereby granted, free of charge, to any person obtaining a
6 : // copy of this software and associated documentation files (the
7 : // "Software"), to deal in the Software without restriction, including
8 : // without limitation the rights to use, copy, modify, merge, publish,
9 : // distribute, sublicense, and/or sell copies of the Software, and to
10 : // permit persons to whom the Software is furnished to do so, subject to
11 : // the following conditions:
12 : //
13 : // The above copyright notice and this permission notice shall be included
14 : // in all copies or substantial portions of the Software.
15 : //
16 : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 : // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 : // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 : // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 : // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 : // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 : // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 : #pragma once
24 :
25 : /** \file
26 : * \brief The various route class.
27 : *
28 : * This header includes the route class used to handle routes as found
29 : * in the routing tables of the kernel.
30 : */
31 :
32 : // addr lib
33 : //
34 : #include "libaddr/addr.h"
35 :
36 :
37 :
38 : namespace addr
39 : {
40 :
41 :
42 :
43 168 : class route
44 : {
45 : public:
46 : typedef std::shared_ptr<route> pointer_t;
47 : typedef std::vector<pointer_t> vector_t;
48 :
49 : static vector_t get_ipv4_routes();
50 :
51 : std::string const & get_interface_name() const;
52 : addr const & get_destination_address() const;
53 : addr const & get_gateway_address() const;
54 : int get_flags() const;
55 : std::string flags_to_string() const;
56 : int get_reference_count() const;
57 : int get_use() const;
58 : int get_metric() const;
59 : int get_mtu() const;
60 : int get_window() const;
61 : int get_irtt() const;
62 :
63 : private:
64 : std::string f_interface_name = std::string();
65 : addr f_destination_address = addr(); // Destination + Mask
66 : addr f_gateway_address = addr();
67 : int f_flags = 0;
68 : int f_reference_count = 0;
69 : int f_use = 0;
70 : int f_metric = 0;
71 : int f_mtu = 0;
72 : int f_window = 0;
73 : int f_irtt = 0;
74 : };
75 :
76 :
77 : route::pointer_t find_default_route(route::vector_t const & routes);
78 :
79 :
80 : }
81 : // namespace addr
82 : // vim: ts=4 sw=4 et
|