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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 #include <vnet/ip/ip.h>
16 #include <nat/dslite/dslite_dpo.h>
18 dpo_type_t dslite_dpo_type;
19 dpo_type_t dslite_ce_dpo_type;
22 dslite_dpo_create (dpo_proto_t dproto, u32 aftr_index, dpo_id_t * dpo)
24 dpo_set (dpo, dslite_dpo_type, dproto, aftr_index);
28 dslite_ce_dpo_create (dpo_proto_t dproto, u32 b4_index, dpo_id_t * dpo)
30 dpo_set (dpo, dslite_ce_dpo_type, dproto, b4_index);
34 format_dslite_dpo (u8 * s, va_list * args)
36 index_t index = va_arg (*args, index_t);
37 CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
39 return (format (s, "DS-Lite: AFTR:%d", index));
43 format_dslite_ce_dpo (u8 * s, va_list * args)
45 index_t index = va_arg (*args, index_t);
46 CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
48 return (format (s, "DS-Lite: B4:%d", index));
52 dslite_dpo_lock (dpo_id_t * dpo)
57 dslite_dpo_unlock (dpo_id_t * dpo)
62 dslite_ce_dpo_lock (dpo_id_t * dpo)
67 dslite_ce_dpo_unlock (dpo_id_t * dpo)
71 const static dpo_vft_t dslite_dpo_vft = {
72 .dv_lock = dslite_dpo_lock,
73 .dv_unlock = dslite_dpo_unlock,
74 .dv_format = format_dslite_dpo,
77 const static dpo_vft_t dslite_ce_dpo_vft = {
78 .dv_lock = dslite_ce_dpo_lock,
79 .dv_unlock = dslite_ce_dpo_unlock,
80 .dv_format = format_dslite_ce_dpo,
83 const static char *const dslite_ip4_nodes[] = {
88 const static char *const dslite_ip6_nodes[] = {
93 const static char *const dslite_ce_ip4_nodes[] = {
98 const static char *const dslite_ce_ip6_nodes[] = {
103 const static char *const *const dslite_nodes[DPO_PROTO_NUM] = {
104 [DPO_PROTO_IP4] = dslite_ip4_nodes,
105 [DPO_PROTO_IP6] = dslite_ip6_nodes,
106 [DPO_PROTO_MPLS] = NULL,
109 const static char *const *const dslite_ce_nodes[DPO_PROTO_NUM] = {
110 [DPO_PROTO_IP4] = dslite_ce_ip4_nodes,
111 [DPO_PROTO_IP6] = dslite_ce_ip6_nodes,
112 [DPO_PROTO_MPLS] = NULL,
116 dslite_dpo_module_init (void)
118 dslite_dpo_type = dpo_register_new_type (&dslite_dpo_vft, dslite_nodes);
119 dslite_ce_dpo_type = dpo_register_new_type (&dslite_ce_dpo_vft,
124 * fd.io coding-style-patch-verification: ON
127 * eval: (c-set-style "gnu")