FD.io VPP
v21.01.1
Vector Packet Processing
inlines.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 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
* @brief The NAT44 inline functions
17
*/
18
19
#ifndef included_nat44_inlines_h__
20
#define included_nat44_inlines_h__
21
22
#include <
vnet/fib/ip4_fib.h
>
23
#include <
nat/nat.h
>
24
25
static_always_inline
u8
26
nat44_maximum_sessions_exceeded
(
snat_main_t
* sm,
u32
thread_index)
27
{
28
if
(
pool_elts
(sm->
per_thread_data
[thread_index].
sessions
) >=
29
sm->
max_translations_per_thread
)
30
return
1;
31
return
0;
32
}
33
34
static_always_inline
u8
35
nat44_ed_maximum_sessions_exceeded
(
snat_main_t
* sm,
36
u32
fib_index,
u32
thread_index)
37
{
38
u32
translations;
39
translations =
pool_elts
(sm->
per_thread_data
[thread_index].
sessions
);
40
if
(
vec_len
(sm->
max_translations_per_fib
) <= fib_index)
41
fib_index = 0;
42
return
translations >= sm->
max_translations_per_fib
[fib_index];
43
}
44
45
#endif
/* included_nat44_inlines_h__ */
46
47
/*
48
* fd.io coding-style-patch-verification: ON
49
*
50
* Local Variables:
51
* eval: (c-set-style "gnu")
52
* End:
53
*/
snat_main_s::max_translations_per_fib
u32 * max_translations_per_fib
Definition:
nat.h:643
ip4_fib.h
snat_main_s::max_translations_per_thread
u32 max_translations_per_thread
Definition:
nat.h:642
u8
unsigned char u8
Definition:
types.h:56
static_always_inline
#define static_always_inline
Definition:
clib.h:109
u32
unsigned int u32
Definition:
types.h:88
snat_main_s
Definition:
nat.h:514
nat44_maximum_sessions_exceeded
static_always_inline u8 nat44_maximum_sessions_exceeded(snat_main_t *sm, u32 thread_index)
The NAT44 inline functions.
Definition:
inlines.h:26
nat.h
nat44_ed_maximum_sessions_exceeded
static_always_inline u8 nat44_ed_maximum_sessions_exceeded(snat_main_t *sm, u32 fib_index, u32 thread_index)
Definition:
inlines.h:35
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition:
vec_bootstrap.h:142
snat_main_s::per_thread_data
snat_main_per_thread_data_t * per_thread_data
Definition:
nat.h:529
snat_main_per_thread_data_t::sessions
snat_session_t * sessions
Definition:
nat.h:453
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition:
pool.h:127
src
plugins
nat
nat44
inlines.h
Generated on Wed Jul 14 2021 16:04:26 for FD.io VPP by
1.8.13