2 * Copyright (c) 2016 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.
16 #include <vnet/ip/ip.h>
17 #include <vnet/map/map_dpo.h>
20 * The register MAP DPO type
22 dpo_type_t map_dpo_type;
23 dpo_type_t map_t_dpo_type;
26 map_dpo_create (dpo_proto_t dproto,
37 map_t_dpo_create (dpo_proto_t dproto,
49 format_map_dpo (u8 *s, va_list *args)
51 index_t index = va_arg (*args, index_t);
52 CLIB_UNUSED(u32 indent) = va_arg (*args, u32);
54 return (format(s, "map: domain:%d", index));
58 format_map_t_dpo (u8 *s, va_list *args)
60 index_t index = va_arg (*args, index_t);
61 CLIB_UNUSED(u32 indent) = va_arg (*args, u32);
63 return (format(s, "map-t: domain:%d", index));
68 map_dpo_lock (dpo_id_t *dpo)
73 map_dpo_unlock (dpo_id_t *dpo)
77 const static dpo_vft_t md_vft = {
78 .dv_lock = map_dpo_lock,
79 .dv_unlock = map_dpo_unlock,
80 .dv_format = format_map_dpo,
83 const static char* const map_ip4_nodes[] =
88 const static char* const map_ip6_nodes[] =
94 const static char* const * const map_nodes[DPO_PROTO_NUM] =
96 [DPO_PROTO_IP4] = map_ip4_nodes,
97 [DPO_PROTO_IP6] = map_ip6_nodes,
98 [DPO_PROTO_MPLS] = NULL,
101 const static dpo_vft_t md_t_vft = {
102 .dv_lock = map_dpo_lock,
103 .dv_unlock = map_dpo_unlock,
104 .dv_format = format_map_t_dpo,
107 const static char* const map_t_ip4_nodes[] =
112 const static char* const map_t_ip6_nodes[] =
118 const static char* const * const map_t_nodes[DPO_PROTO_NUM] =
120 [DPO_PROTO_IP4] = map_t_ip4_nodes,
121 [DPO_PROTO_IP6] = map_t_ip6_nodes,
122 [DPO_PROTO_MPLS] = NULL,
126 map_dpo_module_init (void)
128 map_dpo_type = dpo_register_new_type(&md_vft, map_nodes);
129 map_t_dpo_type = dpo_register_new_type(&md_t_vft, map_t_nodes);