FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
pnat.api
Go to the documentation of this file.
1 /*
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:
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 option version = "0.1.1";
17 
18 import "vnet/interface_types.api";
19 import "vnet/ip/ip_types.api";
20 
22 {
23  PNAT_SA = 0x1,
24  PNAT_DA = 0x2,
25  PNAT_SPORT = 0x4,
26  PNAT_DPORT = 0x8,
29 };
30 
32 {
36 };
37 
38 typedef pnat_match_tuple
39 {
40  vl_api_ip4_address_t src;
41  vl_api_ip4_address_t dst;
42  vl_api_ip_proto_t proto;
45  vl_api_pnat_mask_t mask;
46 };
47 
48 typedef pnat_rewrite_tuple
49 {
50  vl_api_ip4_address_t src;
51  vl_api_ip4_address_t dst;
52  u16 sport;
53  u16 dport;
54  vl_api_pnat_mask_t mask; // needed?
58 };
59 
60 autoendian define pnat_binding_add
61 {
64  vl_api_pnat_match_tuple_t match;
65  vl_api_pnat_rewrite_tuple_t rewrite;
66 };
67 
68 autoendian define pnat_binding_add_reply
69 {
73 };
74 
75 autoendian autoreply define pnat_binding_del
76 {
80 };
81 
82 autoendian autoreply define pnat_binding_attach
83 {
86  vl_api_interface_index_t sw_if_index;
87  vl_api_pnat_attachment_point_t attachment;
89 };
90 
91 autoendian autoreply define pnat_binding_detach
92 {
95  vl_api_interface_index_t sw_if_index;
96  vl_api_pnat_attachment_point_t attachment;
98 };
99 
101  rpc pnat_bindings_get returns pnat_bindings_get_reply
102  stream pnat_bindings_details;
103  rpc pnat_interfaces_get returns pnat_interfaces_get_reply
105 };
106 
107 define pnat_bindings_get
108 {
112 };
113 
114 define pnat_bindings_get_reply
115 {
119 };
120 
121 define pnat_bindings_details
122 {
124  vl_api_pnat_match_tuple_t match;
125  vl_api_pnat_rewrite_tuple_t rewrite;
126 };
127 
128 define pnat_interfaces_get
129 {
133 };
134 
135 define pnat_interfaces_get_reply
136 {
140 };
141 
143 {
145  vl_api_interface_index_t sw_if_index;
146  bool enabled[2]; /* PNAT_ATTACHMENT_POINT_MAX */
147  vl_api_pnat_mask_t lookup_mask[2]; /* PNAT_ATTACHMENT_POINT_MAX */
148 };
149 
150 counters pnat {
151  none {
152  severity info;
153  type counter64;
154  units "packets";
155  description "successfully rewritten";
156  };
157 
159  severity error;
161  units "packets";
162  description "rewrite failed";
163  };
165  severity info;
166  type counter64;
167  units "packets";
168  description "packet too short for rewrite";
169  };
170 };
171 
173  "/err/pnat-input" "pnat";
174  "/err/pnat-output" "pnat";
175 };
vl_api_pnat_bindings_details_t::context
u32 context
Definition: pnat.api:123
vl_api_pnat_interfaces_get_t::cursor
u32 cursor
Definition: pnat.api:132
PNAT_COPY_BYTE
@ PNAT_COPY_BYTE
Definition: pnat.api:27
pnat_binding_attach
int pnat_binding_attach(u32 sw_if_index, pnat_attachment_point_t attachment, u32 binding_index)
Definition: pnat.c:329
pnat_rewrite_tuple
typedef pnat_rewrite_tuple
Definition: pnat.api:49
pnat_binding_del
int pnat_binding_del(u32 index)
Definition: pnat.c:392
vl_api_pnat_binding_detach_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: pnat.api:95
vl_api_pnat_bindings_get_t::client_index
u32 client_index
Definition: pnat.api:109
to_offset
u8 to_offset
Definition: pnat.api:56
vl_api_pnat_binding_add_reply_t::retval
i32 retval
Definition: pnat.api:71
vl_api_pnat_bindings_details_t
Definition: pnat.api:121
vl_api_pnat_interfaces_get_reply_t
Definition: pnat.api:135
clear_offset
u8 clear_offset
Definition: pnat.api:57
vl_api_pnat_bindings_get_t
Definition: pnat.api:107
u16
unsigned short u16
Definition: types.h:57
vl_api_pnat_bindings_get_reply_t
Definition: pnat.api:114
from_offset
u8 from_offset
Definition: pnat.api:55
vl_api_pnat_binding_add_reply_t
Definition: pnat.api:68
vl_api_pnat_binding_add_t::rewrite
vl_api_pnat_rewrite_tuple_t rewrite
Definition: pnat.api:65
tooshort
tooshort
Definition: pnat.api:164
vl_api_pnat_binding_detach_t::binding_index
u32 binding_index
Definition: pnat.api:97
pnat_mask
pnat_mask
Definition: pnat.api:21
error
Definition: cJSON.c:88
i32
signed int i32
Definition: types.h:77
PNAT_DA
@ PNAT_DA
Definition: pnat.api:24
sport
u16 sport
Definition: pnat.api:43
vl_api_pnat_binding_add_t::match
vl_api_pnat_match_tuple_t match
Definition: pnat.api:64
vl_api_pnat_binding_add_reply_t::binding_index
u32 binding_index
Definition: pnat.api:72
vl_api_pnat_interfaces_get_t
Definition: pnat.api:128
pnat_binding_detach
int pnat_binding_detach(u32 sw_if_index, pnat_attachment_point_t attachment, u32 binding_index)
Definition: pnat.c:364
paths
paths
Definition: pnat.api:172
vl_api_pnat_binding_add_t::client_index
u32 client_index
Definition: pnat.api:62
PNAT_SA
@ PNAT_SA
Definition: pnat.api:23
proto
vl_api_ip_proto_t proto
Definition: pnat.api:42
vl_api_pnat_binding_attach_t::client_index
u32 client_index
Definition: pnat.api:84
vl_api_pnat_binding_detach_t::client_index
u32 client_index
Definition: pnat.api:93
vl_api_pnat_binding_add_t
Definition: pnat.api:60
vl_api_pnat_binding_attach_t::binding_index
u32 binding_index
Definition: pnat.api:88
vl_api_pnat_binding_del_t
Definition: pnat.api:75
vl_api_pnat_interfaces_get_reply_t::retval
i32 retval
Definition: pnat.api:138
vl_api_pnat_bindings_details_t::match
vl_api_pnat_match_tuple_t match
Definition: pnat.api:124
vl_api_pnat_bindings_details_t::rewrite
vl_api_pnat_rewrite_tuple_t rewrite
Definition: pnat.api:125
vl_api_pnat_interfaces_details_t
Definition: pnat.api:142
mask
vl_api_pnat_mask_t mask
Definition: pnat.api:45
vl_api_pnat_binding_attach_t
Definition: pnat.api:82
counter64
type counter64
Definition: pnat.api:160
vl_api_pnat_interfaces_get_reply_t::context
u32 context
Definition: pnat.api:137
src
vl_api_address_t src
Definition: gre.api:54
vl_api_pnat_binding_add_reply_t::context
u32 context
Definition: pnat.api:70
pnat_attachment_point
pnat_attachment_point
Definition: pnat.api:31
vl_api_pnat_binding_del_t::client_index
u32 client_index
Definition: pnat.api:77
vl_api_pnat_binding_del_t::binding_index
u32 binding_index
Definition: pnat.api:79
vl_api_pnat_interfaces_details_t::enabled
bool enabled[2]
Definition: pnat.api:146
vl_api_pnat_interfaces_details_t::lookup_mask
vl_api_pnat_mask_t lookup_mask[2]
Definition: pnat.api:147
pnat_interfaces_details
rpc pnat_interfaces_get returns pnat_interfaces_get_reply stream pnat_interfaces_details
Definition: pnat.api:104
vl_api_pnat_interfaces_get_t::context
u32 context
Definition: pnat.api:131
vl_api_pnat_binding_attach_t::attachment
vl_api_pnat_attachment_point_t attachment
Definition: pnat.api:87
vl_api_pnat_binding_attach_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: pnat.api:86
vl_api_pnat_bindings_get_reply_t::retval
i32 retval
Definition: pnat.api:117
vl_api_pnat_binding_attach_t::context
u32 context
Definition: pnat.api:85
PNAT_DPORT
@ PNAT_DPORT
Definition: pnat.api:26
vl_api_pnat_binding_detach_t::attachment
vl_api_pnat_attachment_point_t attachment
Definition: pnat.api:96
vl_api_pnat_interfaces_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: pnat.api:145
dport
u16 dport
Definition: pnat.api:44
u32
unsigned int u32
Definition: types.h:88
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
pnat_match_tuple
typedef pnat_match_tuple
Definition: pnat.api:39
PNAT_CLEAR_BYTE
@ PNAT_CLEAR_BYTE
Definition: pnat.api:28
pnat
counters pnat
Definition: pnat.api:150
vl_api_pnat_interfaces_details_t::context
u32 context
Definition: pnat.api:144
PNAT_SPORT
@ PNAT_SPORT
Definition: pnat.api:25
vl_api_pnat_binding_detach_t
Definition: pnat.api:91
u8
unsigned char u8
Definition: types.h:56
service
service
Definition: pnat.api:100
vl_api_pnat_binding_add_t::context
u32 context
Definition: pnat.api:63
PNAT_ATTACHMENT_POINT_MAX
@ PNAT_ATTACHMENT_POINT_MAX
Definition: pnat.api:35
vl_api_pnat_interfaces_get_reply_t::cursor
u32 cursor
Definition: pnat.api:139
vl_api_pnat_interfaces_get_t::client_index
u32 client_index
Definition: pnat.api:130
PNAT_IP4_OUTPUT
@ PNAT_IP4_OUTPUT
Definition: pnat.api:34
vl_api_pnat_bindings_get_t::context
u32 context
Definition: pnat.api:110
vl_api_pnat_binding_del_t::context
u32 context
Definition: pnat.api:78
PNAT_IP4_INPUT
@ PNAT_IP4_INPUT
Definition: pnat.api:33
vl_api_pnat_binding_detach_t::context
u32 context
Definition: pnat.api:94
rewrite
rewrite
Definition: pnat.api:158
vl_api_pnat_bindings_get_reply_t::cursor
u32 cursor
Definition: pnat.api:118
vl_api_pnat_bindings_get_reply_t::context
u32 context
Definition: pnat.api:116
pnat_binding_add
int pnat_binding_add(pnat_match_tuple_t *match, pnat_rewrite_tuple_t *rewrite, u32 *index)
Definition: pnat.c:271
version
option version
Definition: pnat.api:16
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vl_api_pnat_bindings_get_t::cursor
u32 cursor
Definition: pnat.api:111