FD.io VPP  v19.04.1-1-ge4a0f9f
Vector Packet Processing
ra_prefix.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __VOM_RA_PREFIX_H__
17 #define __VOM_RA_PREFIX_H__
18 
19 #include "vom/prefix.hpp"
20 
21 #include <vapi/ip.api.vapi.hpp>
22 
23 namespace VOM {
24 /**
25  * A representation of RA prefix configuration on given interface
26  */
27 class ra_prefix
28 {
29 public:
30  /**
31  * Construct a new object matching the desried state
32  */
33  ra_prefix(const route::prefix_t& pfx,
34  uint8_t use_default,
35  uint8_t no_advertise,
36  uint32_t val_lifetime,
37  uint32_t pref_lifetime);
38 
39  /**
40  * Copy Constructor
41  */
42  ra_prefix(const ra_prefix& o) = default;
43 
44  /**
45  * Destructor
46  */
47  ~ra_prefix() = default;
48 
49  /**
50  * convert to string format for debug purposes
51  */
52  std::string to_string() const;
53 
54  /**
55  * Return the prefix associated with this ra prefix
56  */
57  const route::prefix_t& prefix() const;
58 
59  /**
60  * Comparison operator - only used for UT
61  */
62  bool operator==(const ra_prefix& ra_prefix) const;
63 
64  /**
65  * Convert the ra prefix configuration to Vpp Api
66  */
67  void to_vpp(vapi_payload_sw_interface_ip6nd_ra_prefix& ra_prefix) const;
68 
69 private:
70  /**
71  * The prefix to be advertised.
72  */
73  route::prefix_t m_pfx;
74 
75  /**
76  * Revert to default settings.
77  */
78  uint8_t m_use_default;
79 
80  /**
81  * Do not send full router address in prefix advertisement.
82  * Default is to advertise.
83  */
84  uint8_t m_no_advertise;
85 
86  /**
87  * Prefix is off-link. Default is on-link.
88  */
89  uint8_t m_off_link;
90 
91  /**
92  * Do not use prefix for autoconfiguration.
93  * Default is autoconfig.
94  */
95  uint8_t m_no_autoconfig;
96 
97  /**
98  * Do not use prefix for onlink determination.
99  * Default is on-link (this flag is off).
100  */
101  uint8_t m_no_onlink;
102 
103  /**
104  * <valid-lifetime>' is the length of time in seconds during what
105  * the prefix is valid for the purpose of on-link determination.
106  *
107  * Range is 7203 to 2592000 seconds and default is 2592000 seconds.
108  * A value of all one bits (0xffffffff) represents infinity (no
109  * timeout).
110  */
111  uint32_t m_val_lifetime;
112 
113  /**
114  * '<pref-lifetime>' is the prefered-lifetime and is the length of
115  * time in seconds during what addresses generated from the prefix
116  * remain preferred.
117  *
118  * Range is 0 to 604800 seconds and default is 604800 seconds.
119  * A value of all one bits (0xffffffff) represents infinity (no
120  * timeout).
121  */
122  uint32_t m_pref_lifetime;
123 };
124 };
125 
126 /*
127  * fd.io coding-style-patch-verification: ON
128  *
129  * Local Variables:
130  * eval: (c-set-style "mozilla")
131  * End:
132  */
133 
134 #endif
void to_vpp(vapi_payload_sw_interface_ip6nd_ra_prefix &ra_prefix) const
Convert the ra prefix configuration to Vpp Api.
Definition: ra_prefix.cpp:39
bool operator==(const ra_prefix &ra_prefix) const
Comparison operator - only used for UT.
Definition: ra_prefix.cpp:53
A representation of RA prefix configuration on given interface.
Definition: ra_prefix.hpp:27
ra_prefix(const route::prefix_t &pfx, uint8_t use_default, uint8_t no_advertise, uint32_t val_lifetime, uint32_t pref_lifetime)
Construct a new object matching the desried state.
Definition: ra_prefix.cpp:22
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
std::string to_string() const
convert to string format for debug purposes
Definition: ra_prefix.cpp:62
const route::prefix_t & prefix() const
Return the prefix associated with this ra prefix.
Definition: ra_prefix.cpp:75
~ra_prefix()=default
Destructor.
A prefix defintion.
Definition: prefix.hpp:92