FD.io VPP  v21.01.1
Vector Packet Processing
lpm.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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 <vppinfra/types.h>
17 #include <vppinfra/bihash_24_8.h>
18 
19 enum lpm_type_e {
22 };
23 
24 typedef struct lpm_ {
25  void (*add) (struct lpm_ *lpm, void *addr_v, u8 pfxlen, u32 value);
26  void (*delete) (struct lpm_ *lpm, void *addr_v, u8 pfxlen);
27  u32 (*lookup) (struct lpm_ *lpm, void *addr_v, u8 pfxlen);
28 
29  /* IPv4 LPM */
30  uword *hash[33];
31 
32  /* IPv6 LPM */
33  BVT (clib_bihash) bihash;
36 } lpm_t;
37 
38 lpm_t *lpm_table_init (enum lpm_type_e lpm_type);
unsigned char u8
Definition: types.h:56
void(* add)(struct lpm_ *lpm, void *addr_v, u8 pfxlen, u32 value)
Definition: lpm.h:25
BVT(clib_bihash) bihash
unsigned int u32
Definition: types.h:88
u32(* lookup)(struct lpm_ *lpm, void *addr_v, u8 pfxlen)
Definition: lpm.h:27
lpm_type_e
Definition: lpm.h:19
Definition: lpm.h:24
u8 value
Definition: qos.api:54
struct lpm_ lpm_t
lpm_t * lpm_table_init(enum lpm_type_e lpm_type)
Definition: lpm.c:157
u64 uword
Definition: types.h:112
uword * hash[33]
Definition: lpm.h:30
u32 prefix_length_refcount[129]
Definition: lpm.h:35
uword * prefix_lengths_bitmap
Definition: lpm.h:34