FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
dslite_dpo.c
Go to the documentation of this file.
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 #include <vnet/ip/ip.h>
16 #include <nat/dslite/dslite_dpo.h>
17 
20 
21 void
22 dslite_dpo_create (dpo_proto_t dproto, u32 aftr_index, dpo_id_t * dpo)
23 {
24  dpo_set (dpo, dslite_dpo_type, dproto, aftr_index);
25 }
26 
27 void
28 dslite_ce_dpo_create (dpo_proto_t dproto, u32 b4_index, dpo_id_t * dpo)
29 {
30  dpo_set (dpo, dslite_ce_dpo_type, dproto, b4_index);
31 }
32 
33 u8 *
34 format_dslite_dpo (u8 * s, va_list * args)
35 {
36  index_t index = va_arg (*args, index_t);
37  CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
38 
39  return (format (s, "DS-Lite: AFTR:%d", index));
40 }
41 
42 u8 *
43 format_dslite_ce_dpo (u8 * s, va_list * args)
44 {
45  index_t index = va_arg (*args, index_t);
46  CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
47 
48  return (format (s, "DS-Lite: B4:%d", index));
49 }
50 
51 static void
53 {
54 }
55 
56 static void
58 {
59 }
60 
61 static void
63 {
64 }
65 
66 static void
68 {
69 }
70 
71 const static dpo_vft_t dslite_dpo_vft = {
73  .dv_unlock = dslite_dpo_unlock,
74  .dv_format = format_dslite_dpo,
75 };
76 
77 const static dpo_vft_t dslite_ce_dpo_vft = {
79  .dv_unlock = dslite_ce_dpo_unlock,
80  .dv_format = format_dslite_ce_dpo,
81 };
82 
83 const static char *const dslite_ip4_nodes[] = {
84  "dslite-out2in",
85  NULL,
86 };
87 
88 const static char *const dslite_ip6_nodes[] = {
89  "dslite-in2out",
90  NULL,
91 };
92 
93 const static char *const dslite_ce_ip4_nodes[] = {
94  "dslite-ce-encap",
95  NULL,
96 };
97 
98 const static char *const dslite_ce_ip6_nodes[] = {
99  "dslite-ce-decap",
100  NULL,
101 };
102 
103 const static char *const *const dslite_nodes[DPO_PROTO_NUM] = {
106  [DPO_PROTO_MPLS] = NULL,
107 };
108 
109 const static char *const *const dslite_ce_nodes[DPO_PROTO_NUM] = {
112  [DPO_PROTO_MPLS] = NULL,
113 };
114 
115 void
117 {
121 }
122 
123 /*
124  * fd.io coding-style-patch-verification: ON
125  *
126  * Local Variables:
127  * eval: (c-set-style "gnu")
128  * End:
129  */
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
dslite_ce_dpo_unlock
static void dslite_ce_dpo_unlock(dpo_id_t *dpo)
Definition: dslite_dpo.c:67
dslite_nodes
const static char *const *const dslite_nodes[DPO_PROTO_NUM]
Definition: dslite_dpo.c:103
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
dslite_ce_dpo_vft
const static dpo_vft_t dslite_ce_dpo_vft
Definition: dslite_dpo.c:77
dslite_ce_ip6_nodes
const static char *const dslite_ce_ip6_nodes[]
Definition: dslite_dpo.c:98
dslite_ce_ip4_nodes
const static char *const dslite_ce_ip4_nodes[]
Definition: dslite_dpo.c:93
dslite_ip4_nodes
const static char *const dslite_ip4_nodes[]
Definition: dslite_dpo.c:83
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
dslite_ip6_nodes
const static char *const dslite_ip6_nodes[]
Definition: dslite_dpo.c:88
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
dslite_dpo_type
dpo_type_t dslite_dpo_type
Definition: dslite_dpo.c:18
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()
dpo_vft_t_::dv_lock
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
dslite_dpo.h
format_dslite_ce_dpo
u8 * format_dslite_ce_dpo(u8 *s, va_list *args)
Definition: dslite_dpo.c:43
dslite_dpo_vft
const static dpo_vft_t dslite_dpo_vft
Definition: dslite_dpo.c:71
index
u32 index
Definition: flow_types.api:221
dslite_ce_nodes
const static char *const *const dslite_ce_nodes[DPO_PROTO_NUM]
Definition: dslite_dpo.c:109
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
dslite_ce_dpo_lock
static void dslite_ce_dpo_lock(dpo_id_t *dpo)
Definition: dslite_dpo.c:62
format_dslite_dpo
u8 * format_dslite_dpo(u8 *s, va_list *args)
Definition: dslite_dpo.c:34
dslite_dpo_create
void dslite_dpo_create(dpo_proto_t dproto, u32 aftr_index, dpo_id_t *dpo)
Definition: dslite_dpo.c:22
dslite_ce_dpo_type
dpo_type_t dslite_ce_dpo_type
Definition: dslite_dpo.c:19
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
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
dslite_dpo_module_init
void dslite_dpo_module_init(void)
Definition: dslite_dpo.c:116
dslite_dpo_lock
static void dslite_dpo_lock(dpo_id_t *dpo)
Definition: dslite_dpo.c:52
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
dslite_dpo_unlock
static void dslite_dpo_unlock(dpo_id_t *dpo)
Definition: dslite_dpo.c:57
DPO_PROTO_NUM
#define DPO_PROTO_NUM
Definition: dpo.h:72
dslite_ce_dpo_create
void dslite_ce_dpo_create(dpo_proto_t dproto, u32 b4_index, dpo_id_t *dpo)
Definition: dslite_dpo.c:28