48 u32 transport_proto = va_arg (*args,
u32);
49 switch (transport_proto)
70 u32 transport_proto = va_arg (*args,
u32);
71 switch (transport_proto)
92 u32 *proto = va_arg (*args,
u32 *);
120 ip46_address_t * ip,
u16 port)
125 kv.
key[0] = ip->as_u64[0];
126 kv.
key[1] = ip->as_u64[1];
127 kv.
key[2] = (
u64) port << 8 | (
u64) proto;
129 rv = clib_bihash_search_inline_24_8 (ht, &kv);
142 kv.
key[0] = te->ip.as_u64[0];
143 kv.
key[1] = te->ip.as_u64[1];
144 kv.
key[2] = (
u64) te->port << 8 | (
u64) proto;
147 clib_bihash_add_del_24_8 (ht, &kv, 1);
156 kv.
key[0] = te->ip.as_u64[0];
157 kv.
key[1] = te->ip.as_u64[1];
158 kv.
key[2] = (
u64) te->port << 8 | (
u64) proto;
160 clib_bihash_add_del_24_8 (ht, &kv, 0);
180 tp_vfts[transport_proto] = *vft;
195 return &
tp_vfts[transport_proto];
201 return tp_vfts[tp].service_type;
216 #define PORT_MASK ((1 << 16)- 1) 242 clib_net_to_host_u16 (port));
260 u16 min = 1024, max = 65535;
269 for (tries = 0; tries < limit; tries++)
302 ip46_address_t * lcl_addr,
u16 * lcl_port)
316 prefix.
fp_len = rmt->is_ip4 ? 32 : 128;
328 sw_if_index = rmt->sw_if_index;
335 &rmt->ip, (rmt->is_ip4 == 0) + 1);
339 memset (lcl_addr, 0,
sizeof (*lcl_addr));
352 lcl_addr->ip4.as_u32 = ip4->
as_u32;
385 if (vft->update_time)
386 (vft->update_time) (time_now, thread_index);
397 (vft->enable) (vm, is_en);
408 if (smm->local_endpoints_table_buckets == 0)
409 smm->local_endpoints_table_buckets = 250000;
410 if (smm->local_endpoints_table_memory == 0)
411 smm->local_endpoints_table_memory = 512 << 20;
417 smm->local_endpoints_table_buckets,
418 smm->local_endpoints_table_memory);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
fib_protocol_t fp_proto
protocol type
u32 transport_endpoint_lookup(transport_endpoint_table_t *ht, u8 proto, ip46_address_t *ip, u16 port)
u8 * format_transport_proto_short(u8 *s, va_list *args)
vnet_main_t * vnet_get_main(void)
void transport_endpoint_table_add(transport_endpoint_table_t *ht, u8 proto, transport_endpoint_t *te, u32 value)
static transport_endpoint_table_t local_endpoints_table
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
struct _transport_proto_vft transport_proto_vft_t
static u64 clib_cpu_time_now(void)
transport_tx_fn_type_t transport_protocol_tx_fn_type(transport_proto_t tp)
void * ip_interface_get_first_ip(u32 sw_if_index, u8 is_ip4)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void transport_endpoint_del(u32 tepi)
enum transport_service_type_ transport_service_type_t
format_function_t format_vnet_sw_if_index_name
void transport_update_time(f64 time_now, u8 thread_index)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
memset(h->entries, 0, sizeof(h->entries[0])*entries)
Aggregrate type for a prefix.
u16 fp_len
The mask length.
static clib_spinlock_t local_endpoints_lock
enum transport_dequeue_type_ transport_tx_fn_type_t
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
static void clib_spinlock_init(clib_spinlock_t *p)
transport_proto_vft_t * transport_protocol_get_vft(transport_proto_t transport_proto)
Get transport virtual function table.
static session_manager_main_t * vnet_get_session_manager_main()
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void transport_endpoint_table_del(transport_endpoint_table_t *ht, u8 proto, transport_endpoint_t *te)
transport_service_type_t transport_protocol_service_type(transport_proto_t tp)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
static transport_endpoint_t * local_endpoints
transport_proto_vft_t * tp_vfts
Per-type vector of transport protocol virtual function tables.
struct _session_manager_main session_manager_main_t
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
void transport_init(void)
static_always_inline uword vlib_get_thread_index(void)
clib_bihash_24_8_t transport_endpoint_table_t
#define ENDPOINT_INVALID_INDEX
#define clib_warning(format, args...)
#define clib_memcpy(a, b, c)
u32 fib_node_index_t
A typedef of a node index.
void transport_enable_disable(vlib_main_t *vm, u8 is_en)
void transport_endpoint_cleanup(u8 proto, ip46_address_t *lcl_ip, u16 port)
void transport_register_protocol(transport_proto_t transport_proto, const transport_proto_vft_t *vft, fib_protocol_t fib_proto, u32 output_node)
Register transport virtual function table.
#define pool_put_index(p, i)
Free pool element with given index.
uword unformat_transport_proto(unformat_input_t *input, va_list *args)
static transport_endpoint_t * transport_endpoint_new(void)
static u32 port_allocator_seed
#define FIB_NODE_INDEX_INVALID
enum _transport_proto transport_proto_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
struct _transport_endpoint transport_endpoint_t
static u32 random_u32(u32 *seed)
32-bit random number generator
static vlib_thread_main_t * vlib_get_thread_main()
#define vec_foreach(var, vec)
Vector iterator.
int transport_alloc_local_endpoint(u8 proto, transport_endpoint_t *rmt, ip46_address_t *lcl_addr, u16 *lcl_port)
int transport_alloc_local_port(u8 proto, ip46_address_t *ip)
Allocate local port and add if successful add entry to local endpoint table to mark the pair as used...
void session_register_transport(transport_proto_t transport_proto, const transport_proto_vft_t *vft, u8 is_ip4, u32 output_node)
Initialize session layer for given transport proto and ip version.
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
u8 transport_protocol_is_cl(transport_proto_t tp)
u8 * format_transport_proto(u8 *s, va_list *args)