FD.io VPP  v21.06-3-gbb25fbf28
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);
bihash_24_8.h
types.h
lpm_type_e
lpm_type_e
Definition: lpm.h:19
LPM_TYPE_KEY128
@ LPM_TYPE_KEY128
Definition: lpm.h:21
lpm_t
struct lpm_ lpm_t
lpm_::BVT
BVT(clib_bihash) bihash
uword
u64 uword
Definition: types.h:112
lpm_::lookup
u32(* lookup)(struct lpm_ *lpm, void *addr_v, u8 pfxlen)
Definition: lpm.h:27
lpm_table_init
lpm_t * lpm_table_init(enum lpm_type_e lpm_type)
Definition: lpm.c:157
lpm_::hash
uword * hash[33]
Definition: lpm.h:30
lpm_::prefix_lengths_bitmap
uword * prefix_lengths_bitmap
Definition: lpm.h:34
u32
unsigned int u32
Definition: types.h:88
value
u8 value
Definition: qos.api:54
lpm_::add
void(* add)(struct lpm_ *lpm, void *addr_v, u8 pfxlen, u32 value)
Definition: lpm.h:25
LPM_TYPE_KEY32
@ LPM_TYPE_KEY32
Definition: lpm.h:20
u8
unsigned char u8
Definition: types.h:56
lpm_::prefix_length_refcount
u32 prefix_length_refcount[129]
Definition: lpm.h:35
lpm_
Definition: lpm.h:24