2 * Copyright (c) 2017 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 #ifndef SRC_VNET_SESSION_SESSION_LOOKUP_H_
17 #define SRC_VNET_SESSION_SESSION_LOOKUP_H_
19 #include <vnet/session/stream_session.h>
20 #include <vnet/session/transport.h>
22 typedef struct _session_lookup
24 /** Lookup tables for established sessions and listeners */
25 clib_bihash_16_8_t v4_session_hash;
26 clib_bihash_48_8_t v6_session_hash;
28 /** Lookup tables for half-open sessions */
29 clib_bihash_16_8_t v4_half_open_hash;
30 clib_bihash_48_8_t v6_half_open_hash;
33 stream_session_t *stream_session_lookup_listener4 (ip4_address_t * lcl,
34 u16 lcl_port, u8 proto);
35 stream_session_t *stream_session_lookup4 (ip4_address_t * lcl,
36 ip4_address_t * rmt, u16 lcl_port,
37 u16 rmt_port, u8 proto);
38 stream_session_t *stream_session_lookup_listener6 (ip6_address_t * lcl,
39 u16 lcl_port, u8 proto);
40 stream_session_t *stream_session_lookup6 (ip6_address_t * lcl,
41 ip6_address_t * rmt, u16 lcl_port,
42 u16 rmt_port, u8 proto);
43 transport_connection_t *stream_session_lookup_transport_wt4 (ip4_address_t *
52 transport_connection_t *stream_session_lookup_transport4 (ip4_address_t * lcl,
57 transport_connection_t *stream_session_lookup_transport_wt6 (ip6_address_t *
66 transport_connection_t *stream_session_lookup_transport6 (ip6_address_t * lcl,
72 stream_session_t *stream_session_lookup_listener (ip46_address_t * lcl,
73 u16 lcl_port, u8 proto);
74 u64 stream_session_half_open_lookup_handle (ip46_address_t * lcl,
77 u16 rmt_port, u8 proto);
78 transport_connection_t *stream_session_half_open_lookup (ip46_address_t * lcl,
83 void stream_session_table_add_for_tc (transport_connection_t * tc, u64 value);
84 int stream_session_table_del_for_tc (transport_connection_t * tc);
85 int stream_session_table_del (stream_session_t * s);
86 void stream_session_half_open_table_del (transport_connection_t * tc);
87 void stream_session_half_open_table_add (transport_connection_t * tc,
90 void session_lookup_init (void);
92 #endif /* SRC_VNET_SESSION_SESSION_LOOKUP_H_ */
95 * fd.io coding-style-patch-verification: ON
98 * eval: (c-set-style "gnu")