FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
nat44_ei_dpo.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 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 <vnet/ip/ip.h>
18 
20 
21 void
22 nat_dpo_create (dpo_proto_t dproto, u32 aftr_index, dpo_id_t *dpo)
23 {
24  dpo_set (dpo, nat_dpo_type, dproto, aftr_index);
25 }
26 
27 u8 *
28 format_nat_dpo (u8 *s, va_list *args)
29 {
30  index_t index = va_arg (*args, index_t);
31  CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
32 
33  return (format (s, "NAT44 out2in: AFTR:%d", index));
34 }
35 
36 static void
38 {
39 }
40 
41 static void
43 {
44 }
45 
46 const static dpo_vft_t nat_dpo_vft = {
48  .dv_unlock = nat_dpo_unlock,
49  .dv_format = format_nat_dpo,
50 };
51 
52 const static char *const nat_ip4_nodes[] = {
53  "nat44-ei-out2in",
54  NULL,
55 };
56 
57 const static char *const nat_ip6_nodes[] = {
58  NULL,
59 };
60 
61 const static char *const *const nat_nodes[DPO_PROTO_NUM] = {
64  [DPO_PROTO_MPLS] = NULL,
65 };
66 
67 void
69 {
71 }
72 
73 /*
74  * fd.io coding-style-patch-verification: ON
75  *
76  * Local Variables:
77  * eval: (c-set-style "gnu")
78  * End:
79  */
dpo_register_new_type
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
Definition: dpo.c:349
nat_nodes
const static char *const *const nat_nodes[DPO_PROTO_NUM]
Definition: nat44_ei_dpo.c:61
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
nat_dpo_create
void nat_dpo_create(dpo_proto_t dproto, u32 aftr_index, dpo_id_t *dpo)
Definition: nat44_ei_dpo.c:22
nat44_ei_dpo.h
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
nat_dpo_lock
static void nat_dpo_lock(dpo_id_t *dpo)
Definition: nat44_ei_dpo.c:37
dpo_type_t
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type()
nat_dpo_module_init
void nat_dpo_module_init(void)
Definition: nat44_ei_dpo.c:68
dpo_vft_t_::dv_lock
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
index
u32 index
Definition: flow_types.api:221
format
description fragment has unexpected format
Definition: map.api:433
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
DPO_PROTO_MPLS
@ DPO_PROTO_MPLS
Definition: dpo.h:66
ip.h
u32
unsigned int u32
Definition: types.h:88
nat_dpo_vft
const static dpo_vft_t nat_dpo_vft
Definition: nat44_ei_dpo.c:46
dpo_vft_t_
A virtual function table regisitered for a DPO type.
Definition: dpo.h:423
u8
unsigned char u8
Definition: types.h:56
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
nat_dpo_unlock
static void nat_dpo_unlock(dpo_id_t *dpo)
Definition: nat44_ei_dpo.c:42
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
dpo_set
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:188
nat_ip4_nodes
const static char *const nat_ip4_nodes[]
Definition: nat44_ei_dpo.c:52
format_nat_dpo
u8 * format_nat_dpo(u8 *s, va_list *args)
Definition: nat44_ei_dpo.c:28
DPO_PROTO_NUM
#define DPO_PROTO_NUM
Definition: dpo.h:72
nat_dpo_type
dpo_type_t nat_dpo_type
Definition: nat44_ei_dpo.c:19
nat_ip6_nodes
const static char *const nat_ip6_nodes[]
Definition: nat44_ei_dpo.c:57