FD.io VPP  v20.05.1-6-gf53edbc3b
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 {
119  dslite_ce_dpo_type = dpo_register_new_type (&dslite_ce_dpo_vft,
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_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:406
static const char *const dslite_ip6_nodes[]
Definition: dslite_dpo.c:88
static const char *const *const dslite_ce_nodes[DPO_PROTO_NUM]
Definition: dslite_dpo.c:109
void dslite_dpo_create(dpo_proto_t dproto, u32 aftr_index, dpo_id_t *dpo)
Definition: dslite_dpo.c:22
#define CLIB_UNUSED(x)
Definition: clib.h:86
A virtual function table regisitered for a DPO type.
Definition: dpo.h:401
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:41
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
unsigned char u8
Definition: types.h:56
static const char *const dslite_ce_ip4_nodes[]
Definition: dslite_dpo.c:93
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
unsigned int u32
Definition: types.h:88
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
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:342
static void dslite_ce_dpo_lock(dpo_id_t *dpo)
Definition: dslite_dpo.c:62
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:170
dpo_type_t dslite_ce_dpo_type
Definition: dslite_dpo.c:19
static const char *const dslite_ce_ip6_nodes[]
Definition: dslite_dpo.c:98
void dslite_dpo_module_init(void)
Definition: dslite_dpo.c:116
static void dslite_dpo_lock(dpo_id_t *dpo)
Definition: dslite_dpo.c:52
u8 * format_dslite_dpo(u8 *s, va_list *args)
Definition: dslite_dpo.c:34
static const char *const dslite_ip4_nodes[]
Definition: dslite_dpo.c:83
dpo_type_t dslite_dpo_type
Definition: dslite_dpo.c:18
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:186
u8 * format_dslite_ce_dpo(u8 *s, va_list *args)
Definition: dslite_dpo.c:43
static void dslite_ce_dpo_unlock(dpo_id_t *dpo)
Definition: dslite_dpo.c:67
#define DPO_PROTO_NUM
Definition: dpo.h:70
static void dslite_dpo_unlock(dpo_id_t *dpo)
Definition: dslite_dpo.c:57
static const char *const *const dslite_nodes[DPO_PROTO_NUM]
Definition: dslite_dpo.c:103
void dslite_ce_dpo_create(dpo_proto_t dproto, u32 b4_index, dpo_id_t *dpo)
Definition: dslite_dpo.c:28