blob: cf1dc01356e72ca471eaa9b859db95a1ad12be91 [file] [log] [blame]
Florin Coras04e53442017-07-16 17:12:15 -07001/*
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:
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#ifndef SRC_VNET_SESSION_SESSION_LOOKUP_H_
17#define SRC_VNET_SESSION_SESSION_LOOKUP_H_
18
19#include <vnet/session/stream_session.h>
20#include <vnet/session/transport.h>
21
22typedef struct _session_lookup
23{
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;
27
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;
31} session_lookup_t;
32
33stream_session_t *stream_session_lookup_listener4 (ip4_address_t * lcl,
34 u16 lcl_port, u8 proto);
35stream_session_t *stream_session_lookup4 (ip4_address_t * lcl,
36 ip4_address_t * rmt, u16 lcl_port,
37 u16 rmt_port, u8 proto);
38stream_session_t *stream_session_lookup_listener6 (ip6_address_t * lcl,
39 u16 lcl_port, u8 proto);
40stream_session_t *stream_session_lookup6 (ip6_address_t * lcl,
41 ip6_address_t * rmt, u16 lcl_port,
42 u16 rmt_port, u8 proto);
43transport_connection_t *stream_session_lookup_transport_wt4 (ip4_address_t *
44 lcl,
45 ip4_address_t *
46 rmt,
47 u16 lcl_port,
48 u16 rmt_port,
49 u8 proto,
50 u32
51 thread_index);
52transport_connection_t *stream_session_lookup_transport4 (ip4_address_t * lcl,
53 ip4_address_t * rmt,
54 u16 lcl_port,
55 u16 rmt_port,
56 u8 proto);
57transport_connection_t *stream_session_lookup_transport_wt6 (ip6_address_t *
58 lcl,
59 ip6_address_t *
60 rmt,
61 u16 lcl_port,
62 u16 rmt_port,
63 u8 proto,
64 u32
65 thread_index);
66transport_connection_t *stream_session_lookup_transport6 (ip6_address_t * lcl,
67 ip6_address_t * rmt,
68 u16 lcl_port,
69 u16 rmt_port,
70 u8 proto);
71
72stream_session_t *stream_session_lookup_listener (ip46_address_t * lcl,
73 u16 lcl_port, u8 proto);
74u64 stream_session_half_open_lookup_handle (ip46_address_t * lcl,
75 ip46_address_t * rmt,
76 u16 lcl_port,
77 u16 rmt_port, u8 proto);
78transport_connection_t *stream_session_half_open_lookup (ip46_address_t * lcl,
79 ip46_address_t * rmt,
80 u16 lcl_port,
81 u16 rmt_port,
82 u8 proto);
83void stream_session_table_add_for_tc (transport_connection_t * tc, u64 value);
84int stream_session_table_del_for_tc (transport_connection_t * tc);
85int stream_session_table_del (stream_session_t * s);
Florin Coras68810622017-07-24 17:40:28 -070086void stream_session_half_open_table_del (transport_connection_t * tc);
87void stream_session_half_open_table_add (transport_connection_t * tc,
Florin Coras04e53442017-07-16 17:12:15 -070088 u64 value);
89
90void session_lookup_init (void);
91
92#endif /* SRC_VNET_SESSION_SESSION_LOOKUP_H_ */
93
94/*
95 * fd.io coding-style-patch-verification: ON
96 *
97 * Local Variables:
98 * eval: (c-set-style "gnu")
99 * End:
100 */