2 * Copyright (c) 2021 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 option version = "0.1.1";
18 import "vnet/interface_types.api";
19 import "vnet/ip/ip_types.api";
27 PNAT_COPY_BYTE = 0x10,
28 PNAT_CLEAR_BYTE = 0x20,
32 enum pnat_attachment_point
36 PNAT_ATTACHMENT_POINT_MAX,
39 typedef pnat_match_tuple
41 vl_api_ip4_address_t src;
42 vl_api_ip4_address_t dst;
43 vl_api_ip_proto_t proto;
46 vl_api_pnat_mask_t mask;
49 typedef pnat_rewrite_tuple
51 vl_api_ip4_address_t src;
52 vl_api_ip4_address_t dst;
55 vl_api_pnat_mask_t mask; // needed?
61 autoendian define pnat_binding_add
65 vl_api_pnat_match_tuple_t match;
66 vl_api_pnat_rewrite_tuple_t rewrite;
70 autoendian define pnat_binding_add_reply
77 autoendian define pnat_binding_add_v2
81 vl_api_pnat_match_tuple_t match;
82 vl_api_pnat_rewrite_tuple_t rewrite;
86 autoendian define pnat_binding_add_v2_reply
93 autoendian autoreply define pnat_binding_del
100 autoendian autoreply define pnat_binding_attach
104 vl_api_interface_index_t sw_if_index;
105 vl_api_pnat_attachment_point_t attachment;
109 autoendian autoreply define pnat_binding_detach
113 vl_api_interface_index_t sw_if_index;
114 vl_api_pnat_attachment_point_t attachment;
119 rpc pnat_bindings_get returns pnat_bindings_get_reply
120 stream pnat_bindings_details;
121 rpc pnat_interfaces_get returns pnat_interfaces_get_reply
122 stream pnat_interfaces_details;
125 define pnat_bindings_get
132 define pnat_bindings_get_reply
139 define pnat_bindings_details
142 vl_api_pnat_match_tuple_t match;
143 vl_api_pnat_rewrite_tuple_t rewrite;
146 define pnat_interfaces_get
153 define pnat_interfaces_get_reply
160 define pnat_interfaces_details
163 vl_api_interface_index_t sw_if_index;
164 bool enabled[2]; /* PNAT_ATTACHMENT_POINT_MAX */
165 vl_api_pnat_mask_t lookup_mask[2]; /* PNAT_ATTACHMENT_POINT_MAX */
173 description "successfully rewritten";
180 description "rewrite failed";
186 description "packet too short for rewrite";
191 "/err/pnat-input" "pnat";
192 "/err/pnat-output" "pnat";