FD.io VPP  v17.07.01-10-g3be13f0
Vector Packet Processing
transport.c
Go to the documentation of this file.
1 /*
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 #include <vnet/session/transport.h>
17 
18 u32
20  u16 port)
21 {
23  int rv;
24 
25  kv.key[0] = ip->as_u64[0];
26  kv.key[1] = ip->as_u64[1];
27  kv.key[2] = port;
28 
29  rv = clib_bihash_search_inline_24_8 (ht, &kv);
30  if (rv == 0)
31  return kv.value;
32 
34 }
35 
36 void
38  transport_endpoint_t *te, u32 value)
39 {
41 
42  kv.key[0] = te->ip.as_u64[0];
43  kv.key[1] = te->ip.as_u64[1];
44  kv.key[2] = te->port;
45  kv.value = value;
46 
47  clib_bihash_add_del_24_8 (ht, &kv, 1);
48 }
49 
50 void
53 {
55 
56  kv.key[0] = te->ip.as_u64[0];
57  kv.key[1] = te->ip.as_u64[1];
58  kv.key[2] = te->port;
59 
60  clib_bihash_add_del_24_8 (ht, &kv, 0);
61 }
62 
63 
64 
void transport_endpoint_table_del(transport_endpoint_table_t *ht, transport_endpoint_t *te)
Definition: transport.c:51
#define TRANSPORT_ENDPOINT_INVALID_INDEX
Definition: transport.h:238
void transport_endpoint_table_add(transport_endpoint_table_t *ht, transport_endpoint_t *te, u32 value)
Definition: transport.c:37
clib_bihash_24_8_t transport_endpoint_table_t
Definition: transport.h:236
unsigned int u32
Definition: types.h:88
u32 transport_endpoint_lookup(transport_endpoint_table_t *ht, ip46_address_t *ip, u16 port)
Definition: transport.c:19
unsigned short u16
Definition: types.h:57
struct _transport_endpoint transport_endpoint_t