FD.io VPP  v18.01.2-1-g9b554f3
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 
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 u8 *
28 format_dslite_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, "DS-Lite: AFTR:%d", index));
34 }
35 
36 static void
38 {
39 }
40 
41 static void
43 {
44 }
45 
46 const static dpo_vft_t dslite_dpo_vft = {
48  .dv_unlock = dslite_dpo_unlock,
49  .dv_format = format_dslite_dpo,
50 };
51 
52 const static char *const dslite_ip4_nodes[] = {
53  "dslite-out2in",
54  NULL,
55 };
56 
57 const static char *const dslite_ip6_nodes[] = {
58  "dslite-in2out",
59  NULL,
60 };
61 
62 const static char *const *const dslite_nodes[DPO_PROTO_NUM] = {
65  [DPO_PROTO_MPLS] = NULL,
66 };
67 
68 void
70 {
72 }
73 
74 /*
75  * fd.io coding-style-patch-verification: ON
76  *
77  * Local Variables:
78  * eval: (c-set-style "gnu")
79  * End:
80  */
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:382
static const char *const dslite_ip6_nodes[]
Definition: dslite_dpo.c:57
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:79
A virtual function table regisitered for a DPO type.
Definition: dpo.h:377
#define NULL
Definition: clib.h:55
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
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
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:322
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:166
void dslite_dpo_module_init(void)
Definition: dslite_dpo.c:69
static void dslite_dpo_lock(dpo_id_t *dpo)
Definition: dslite_dpo.c:37
u8 * format_dslite_dpo(u8 *s, va_list *args)
Definition: dslite_dpo.c:28
static const char *const dslite_ip4_nodes[]
Definition: dslite_dpo.c:52
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:182
unsigned int u32
Definition: types.h:88
#define DPO_PROTO_NUM
Definition: dpo.h:70
static void dslite_dpo_unlock(dpo_id_t *dpo)
Definition: dslite_dpo.c:42
unsigned char u8
Definition: types.h:56
static const char *const *const dslite_nodes[DPO_PROTO_NUM]
Definition: dslite_dpo.c:62