GBP: add allowed ethertypes to contracts
[vpp.git] / extras / vom / vom / ra_config.hpp
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_CONFIG_H__
17 #define __VOM_RA_CONFIG_H__
18
19 #include <vapi/ip.api.vapi.hpp>
20
21 namespace VOM {
22 /**
23  * A representation of Router Advertisement configuration
24  */
25 class ra_config
26 {
27 public:
28   /**
29    * Construct a new object matching the desried state
30    */
31   ra_config(uint8_t suppress,
32             uint8_t send_unicast,
33             uint8_t default_router,
34             uint32_t max_interval);
35
36   /**
37    * Copy Constructor
38    */
39   ra_config(const ra_config& o) = default;
40
41   /**
42    * Destructor
43    */
44   ~ra_config() = default;
45
46   /**
47    * convert to string format for debug purposes
48    */
49   std::string to_string() const;
50
51   /**
52    * Comparison operator - only used for UT
53    */
54   bool operator==(const ra_config& ra_config) const;
55
56   /**
57    * convert the ra config to VPP API
58    */
59   void to_vpp(vapi_payload_sw_interface_ip6nd_ra_config& ra_config) const;
60
61 private:
62   /**
63    * Disables sending ICMPv6 router-advertisement messages.
64    */
65   uint8_t m_suppress;
66
67   /**
68    * Advertises in ICMPv6 router-advertisement messages to use
69    * stateful address auto-configuration to obtain address information.
70  */
71   uint8_t m_managed;
72
73   /**
74    * Indicates in ICMPv6 router-advertisement messages that
75    * hosts use stateful auto configuration to obtain nonaddress
76    * related information.
77    */
78   uint8_t m_other;
79
80   /**
81    * Indicates not to include the optional source link-layer
82    * address in the ICMPv6 router-advertisement messages.
83    */
84   uint8_t m_ll_option;
85
86   /**
87    * Use the source address of the router-solicitation message if
88    * availiable.
89    */
90   uint8_t m_send_unicast;
91
92   /**
93    * Cease sending ICMPv6 router-advertisement messages.
94    */
95   uint8_t m_cease;
96
97   /**
98    * .... ?
99    */
100   uint8_t m_default_router;
101
102   /**
103    * Configures the interval between sending ICMPv6 router-advertisement
104    * messages. The range for max-interval is from 4 to 200 seconds.
105    */
106   uint32_t m_max_interval;
107
108   /**
109    * min-interval can not be more than 75% of max-interval.
110    * If not set, min-interval will be set to 75% of max-interval.
111    * The range for min-interval is from 3 to 150 seconds.
112    */
113   uint32_t m_min_interval;
114
115   /**
116    * Advertises the lifetime of a default router in ICMPv6
117    * router-advertisement messages. The range is from 0 to 9000 seconds.
118    * '<lifetime>' must be greater than '<max-interval>'.
119    * The default value is 600 seconds
120    */
121   uint32_t m_lifetime;
122
123   /**
124    * Number of initial ICMPv6 router-advertisement messages sent.
125    * Range for count is 1 - 3 and default is 3.
126    */
127   uint32_t m_initial_count;
128
129   /**
130    * The interval between each initial messages.
131    * Range for interval is 1 to 16 seconds, and default is 16 seconds.
132    */
133   uint32_t m_initial_interval;
134 };
135 };
136
137 /*
138  * fd.io coding-style-patch-verification: ON
139  *
140  * Local Variables:
141  * eval: (c-set-style "mozilla")
142  * End:
143  */
144
145 #endif