fib: fib api updates
[vpp.git] / extras / vom / vom / api_types.hpp
1 /*
2  * Copyright (c) 2018 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 #include <boost/asio/ip/address.hpp>
17 #include <vom/neighbour.hpp>
18 #include <vom/prefix.hpp>
19 #include <vom/types.hpp>
20
21 #include <vapi/ip.api.vapi.hpp>
22
23 namespace VOM {
24
25 struct invalid_decode
26 {
27   invalid_decode(const std::string reason);
28   const std::string reason;
29 };
30
31 typedef boost::asio::ip::address ip_address_t;
32
33 vapi_enum_ip_neighbor_flags to_api(const neighbour::flags_t& f);
34 const neighbour::flags_t from_api(vapi_enum_ip_neighbor_flags f);
35
36 void to_api(const ip_address_t& a, vapi_type_address& v);
37 void to_api(const boost::asio::ip::address_v4& a, vapi_type_ip4_address& v);
38 void to_api(const boost::asio::ip::address_v6& a, vapi_type_ip6_address& v);
39 void to_api(const boost::asio::ip::address& a,
40             vapi_union_address_union& u,
41             vapi_enum_address_family& af);
42 void to_api(const boost::asio::ip::address& a, vapi_union_address_union& u);
43
44 boost::asio::ip::address_v4 from_api(const vapi_type_ip4_address& v);
45 boost::asio::ip::address_v6 from_api(const vapi_type_ip6_address& v);
46 ip_address_t from_api(const vapi_type_address& v);
47 ip_address_t from_api(const vapi_union_address_union& u,
48                       vapi_enum_address_family af);
49 ip_address_t from_api(const vapi_union_address_union& u,
50                       vapi_enum_fib_path_nh_proto proto);
51
52 void to_api(const mac_address_t& a, vapi_type_mac_address& m);
53
54 mac_address_t from_api(const vapi_type_mac_address& v);
55
56 route::prefix_t from_api(const vapi_type_prefix&);
57 route::mprefix_t from_api(const vapi_type_mprefix&);
58
59 vapi_type_prefix to_api(const route::prefix_t&);
60 vapi_type_mprefix to_api(const route::mprefix_t&);
61
62 vapi_enum_fib_path_nh_proto to_api(const nh_proto_t&);
63 const nh_proto_t& from_api(vapi_enum_fib_path_nh_proto);
64
65 }; // VOM
66
67 /*
68  * fd.io coding-style-patch-verification: ON
69  *
70  * Local Variables:
71  * eval: (c-set-style "mozilla")
72  * End:
73  */