hs-test: fixed timed out tests passing in the CI
[vpp.git] / src / plugins / nat / lib / inlines.h
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 Common NAT inline functions
17  */
18 #ifndef included_nat_inlines_h__
19 #define included_nat_inlines_h__
20
21 #include <vnet/ip/icmp46_packet.h>
22
23 static_always_inline u64
24 icmp_type_is_error_message (u8 icmp_type)
25 {
26   int bmp = 0;
27   bmp |= 1 << ICMP4_destination_unreachable;
28   bmp |= 1 << ICMP4_time_exceeded;
29   bmp |= 1 << ICMP4_parameter_problem;
30   bmp |= 1 << ICMP4_source_quench;
31   bmp |= 1 << ICMP4_redirect;
32   bmp |= 1 << ICMP4_alternate_host_address;
33
34   return (1ULL << icmp_type) & bmp;
35 }
36
37 #endif /* included_nat_inlines_h__ */
38 /*
39  * fd.io coding-style-patch-verification: ON
40  *
41  * Local Variables:
42  * eval: (c-set-style "gnu")
43  * End:
44  */