FD.io VPP  v18.10-34-gcce845e
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 
16 #include <vnet/ip/ip.h>
17 #include <nat/dslite_dpo.h>
18 
21 
22 void
23 dslite_dpo_create (dpo_proto_t dproto, u32 aftr_index, dpo_id_t * dpo)
24 {
25  dpo_set (dpo, dslite_dpo_type, dproto, aftr_index);
26 }
27 
28 void
29 dslite_ce_dpo_create (dpo_proto_t dproto, u32 b4_index, dpo_id_t * dpo)
30 {
31  dpo_set (dpo, dslite_ce_dpo_type, dproto, b4_index);
32 }
33 
34 u8 *
35 format_dslite_dpo (u8 * s, va_list * args)
36 {
37  index_t index = va_arg (*args, index_t);
38  CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
39 
40  return (format (s, "DS-Lite: AFTR:%d", index));
41 }
42 
43 u8 *
44 format_dslite_ce_dpo (u8 * s, va_list * args)
45 {
46  index_t index = va_arg (*args, index_t);
47  CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
48 
49  return (format (s, "DS-Lite: B4:%d", index));
50 }
51 
52 static void
54 {
55 }
56 
57 static void
59 {
60 }
61 
62 static void
64 {
65 }
66 
67 static void
69 {
70 }
71 
72 const static dpo_vft_t dslite_dpo_vft = {
74  .dv_unlock = dslite_dpo_unlock,
75  .dv_format = format_dslite_dpo,
76 };
77 
78 const static dpo_vft_t dslite_ce_dpo_vft = {
80  .dv_unlock = dslite_ce_dpo_unlock,
81  .dv_format = format_dslite_ce_dpo,
82 };
83 
84 const static char *const dslite_ip4_nodes[] = {
85  "dslite-out2in",
86  NULL,
87 };
88 
89 const static char *const dslite_ip6_nodes[] = {
90  "dslite-in2out",
91  NULL,
92 };
93 
94 const static char *const dslite_ce_ip4_nodes[] = {
95  "dslite-ce-encap",
96  NULL,
97 };
98 
99 const static char *const dslite_ce_ip6_nodes[] = {
100  "dslite-ce-decap",
101  NULL,
102 };
103 
104 const static char *const *const dslite_nodes[DPO_PROTO_NUM] = {
107  [DPO_PROTO_MPLS] = NULL,
108 };
109 
110 const static char *const *const dslite_ce_nodes[DPO_PROTO_NUM] = {
113  [DPO_PROTO_MPLS] = NULL,
114 };
115 
116 void
118 {
120  dslite_ce_dpo_type = dpo_register_new_type (&dslite_ce_dpo_vft,
122 }
123 
124 /*
125  * fd.io coding-style-patch-verification: ON
126  *
127  * Local Variables:
128  * eval: (c-set-style "gnu")
129  * End:
130  */
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:404
static const char *const dslite_ip6_nodes[]
Definition: dslite_dpo.c:89
static const char *const *const dslite_ce_nodes[DPO_PROTO_NUM]
Definition: dslite_dpo.c:110
void dslite_dpo_create(dpo_proto_t dproto, u32 aftr_index, dpo_id_t *dpo)
Definition: dslite_dpo.c:23
#define CLIB_UNUSED(x)
Definition: clib.h:81
A virtual function table regisitered for a DPO type.
Definition: dpo.h:399
#define NULL
Definition: clib.h:57
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:419
unsigned char u8
Definition: types.h:56
static const char *const dslite_ce_ip4_nodes[]
Definition: dslite_dpo.c:94
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:341
static void dslite_ce_dpo_lock(dpo_id_t *dpo)
Definition: dslite_dpo.c:63
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:168
dpo_type_t dslite_ce_dpo_type
Definition: dslite_dpo.c:20
static const char *const dslite_ce_ip6_nodes[]
Definition: dslite_dpo.c:99
void dslite_dpo_module_init(void)
Definition: dslite_dpo.c:117
static void dslite_dpo_lock(dpo_id_t *dpo)
Definition: dslite_dpo.c:53
u8 * format_dslite_dpo(u8 *s, va_list *args)
Definition: dslite_dpo.c:35
static const char *const dslite_ip4_nodes[]
Definition: dslite_dpo.c:84
dpo_type_t dslite_dpo_type
Definition: dslite_dpo.c:19
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:185
u8 * format_dslite_ce_dpo(u8 *s, va_list *args)
Definition: dslite_dpo.c:44
static void dslite_ce_dpo_unlock(dpo_id_t *dpo)
Definition: dslite_dpo.c:68
#define DPO_PROTO_NUM
Definition: dpo.h:70
static void dslite_dpo_unlock(dpo_id_t *dpo)
Definition: dslite_dpo.c:58
static const char *const *const dslite_nodes[DPO_PROTO_NUM]
Definition: dslite_dpo.c:104
void dslite_ce_dpo_create(dpo_proto_t dproto, u32 b4_index, dpo_id_t *dpo)
Definition: dslite_dpo.c:29