FD.io VPP  v17.04.2-2-ga8f93f8
Vector Packet Processing
session.c File Reference

Session and session manager. More...

+ Include dependency graph for session.c:

Go to the source code of this file.

Functions

static void stream_session_table_add_for_tc (u8 sst, transport_connection_t *tc, u64 value)
 
void stream_session_table_add (session_manager_main_t *smm, stream_session_t *s, u64 value)
 
static void stream_session_half_open_table_add (u8 sst, transport_connection_t *tc, u64 value)
 
static int stream_session_table_del_for_tc (session_manager_main_t *smm, u8 sst, transport_connection_t *tc)
 
static int stream_session_table_del (session_manager_main_t *smm, stream_session_t *s)
 
static void stream_session_half_open_table_del (session_manager_main_t *smm, u8 sst, transport_connection_t *tc)
 
stream_session_tstream_session_lookup_listener4 (ip4_address_t *lcl, u16 lcl_port, u8 proto)
 
stream_session_tstream_session_lookup4 (ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u32 my_thread_index)
 Looks up a session based on the 5-tuple passed as argument. More...
 
stream_session_tstream_session_lookup_listener6 (ip6_address_t *lcl, u16 lcl_port, u8 proto)
 
stream_session_tstream_session_lookup6 (ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u32 my_thread_index)
 
stream_session_tstream_session_lookup_listener (ip46_address_t *lcl, u16 lcl_port, u8 proto)
 
static u64 stream_session_half_open_lookup (session_manager_main_t *smm, ip46_address_t *lcl, ip46_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
 
transport_connection_tstream_session_lookup_transport4 (ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u32 my_thread_index)
 
transport_connection_tstream_session_lookup_transport6 (ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u32 my_thread_index)
 
void vpp_session_event_queue_allocate (session_manager_main_t *smm, u32 thread_index)
 Allocate vpp event queue (once) per worker thread. More...
 
void session_manager_get_segment_info (u32 index, u8 **name, u32 *size)
 
static int session_manager_add_segment_i (session_manager_main_t *smm, session_manager_t *sm, u32 segment_size, u8 *segment_name)
 
static int session_manager_add_segment (session_manager_main_t *smm, session_manager_t *sm)
 
int session_manager_add_first_segment (session_manager_main_t *smm, session_manager_t *sm, u32 segment_size, u8 **segment_name)
 
void session_manager_del (session_manager_main_t *smm, session_manager_t *sm)
 
int session_manager_allocate_session_fifos (session_manager_main_t *smm, session_manager_t *sm, svm_fifo_t **server_rx_fifo, svm_fifo_t **server_tx_fifo, u32 *fifo_segment_index, u8 *added_a_segment)
 
int stream_session_create_i (session_manager_main_t *smm, application_t *app, transport_connection_t *tc, stream_session_t **ret_s)
 
int stream_session_enqueue_data (transport_connection_t *tc, u8 *data, u16 len, u8 queue_event)
 
u8 stream_session_no_space (transport_connection_t *tc, u32 thread_index, u16 data_len)
 Check if we have space in rx fifo to push more bytes. More...
 
u32 stream_session_peek_bytes (transport_connection_t *tc, u8 *buffer, u32 offset, u32 max_bytes)
 
u32 stream_session_dequeue_drop (transport_connection_t *tc, u32 max_bytes)
 
static int stream_session_enqueue_notify (stream_session_t *s, u8 block)
 Notify session peer that new data has been enqueued. More...
 
int session_manager_flush_enqueue_events (u32 thread_index)
 Flushes queue of sessions that are to be notified of new data enqueued events. More...
 
int stream_session_start_listen (u32 server_index, ip46_address_t *ip, u16 port)
 
void stream_session_stop_listen (u32 server_index)
 
int connect_server_add_segment_cb (application_t *ss, char *segment_name, u32 segment_size)
 
void connects_session_manager_init (session_manager_main_t *smm, u8 session_type)
 
void stream_session_connect_notify (transport_connection_t *tc, u8 sst, u8 is_fail)
 
void stream_session_accept_notify (transport_connection_t *tc)
 
void stream_session_disconnect_notify (transport_connection_t *tc)
 Notification from transport that connection is being closed. More...
 
void stream_session_delete (stream_session_t *s)
 Cleans up session and associated app if needed. More...
 
void stream_session_delete_notify (transport_connection_t *tc)
 Notification from transport that connection is being deleted. More...
 
void stream_session_reset_notify (transport_connection_t *tc)
 Notify application that connection has been reset. More...
 
int stream_session_accept (transport_connection_t *tc, u32 listener_index, u8 sst, u8 notify)
 Accept a stream session. More...
 
int stream_session_open (u8 sst, ip46_address_t *addr, u16 port_host_byte_order, u32 app_index)
 
void stream_session_disconnect (stream_session_t *s)
 Disconnect session and propagate to transport. More...
 
void stream_session_cleanup (stream_session_t *s)
 Cleanup transport and session state. More...
 
void session_register_transport (u8 type, const transport_proto_vft_t *vft)
 
transport_proto_vft_tsession_get_transport_vft (u8 type)
 
static clib_error_tsession_manager_main_enable (vlib_main_t *vm)
 
clib_error_tvnet_session_enable_disable (vlib_main_t *vm, u8 is_en)
 
clib_error_tsession_manager_main_init (vlib_main_t *vm)
 

Variables

static transport_proto_vft_ttp_vfts
 Per-type vector of transport protocol virtual function tables. More...
 
session_manager_main_t session_manager_main
 

Detailed Description

Session and session manager.

Definition in file session.c.

Function Documentation

int connect_server_add_segment_cb ( application_t ss,
char *  segment_name,
u32  segment_size 
)

Definition at line 939 of file session.c.

void connects_session_manager_init ( session_manager_main_t smm,
u8  session_type 
)

Definition at line 948 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

transport_proto_vft_t* session_get_transport_vft ( u8  type)

Definition at line 1236 of file session.c.

+ Here is the caller graph for this function:

int session_manager_add_first_segment ( session_manager_main_t smm,
session_manager_t sm,
u32  segment_size,
u8 **  segment_name 
)

Definition at line 465 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int session_manager_add_segment ( session_manager_main_t smm,
session_manager_t sm 
)
static

Definition at line 446 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int session_manager_add_segment_i ( session_manager_main_t smm,
session_manager_t sm,
u32  segment_size,
u8 segment_name 
)
inlinestatic

Definition at line 419 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_manager_allocate_session_fifos ( session_manager_main_t smm,
session_manager_t sm,
svm_fifo_t **  server_rx_fifo,
svm_fifo_t **  server_tx_fifo,
u32 fifo_segment_index,
u8 added_a_segment 
)

Definition at line 551 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void session_manager_del ( session_manager_main_t smm,
session_manager_t sm 
)

Definition at line 477 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int session_manager_flush_enqueue_events ( u32  thread_index)

Flushes queue of sessions that are to be notified of new data enqueued events.

Parameters
thread_indexThread index for which the flush is to be performed.
Returns
0 on success or a positive number indicating the number of failures due to API queue being full.

Definition at line 846 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void session_manager_get_segment_info ( u32  index,
u8 **  name,
u32 size 
)

Definition at line 410 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* session_manager_main_enable ( vlib_main_t vm)
static

Definition at line 1244 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* session_manager_main_init ( vlib_main_t vm)

Definition at line 1329 of file session.c.

+ Here is the call graph for this function:

void session_register_transport ( u8  type,
const transport_proto_vft_t vft 
)

Definition at line 1222 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_session_accept ( transport_connection_t tc,
u32  listener_index,
u8  sst,
u8  notify 
)

Accept a stream session.

Optionally ping the server by callback.

Definition at line 1128 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_accept_notify ( transport_connection_t tc)

Definition at line 1008 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_cleanup ( stream_session_t s)

Cleanup transport and session state.

Notify transport of the cleanup, wait for a delete notify to actually remove the session state.

Definition at line 1206 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_connect_notify ( transport_connection_t tc,
u8  sst,
u8  is_fail 
)

Definition at line 967 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_session_create_i ( session_manager_main_t smm,
application_t app,
transport_connection_t tc,
stream_session_t **  ret_s 
)

Definition at line 630 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_delete ( stream_session_t s)

Cleans up session and associated app if needed.

Definition at line 1040 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_delete_notify ( transport_connection_t tc)

Notification from transport that connection is being deleted.

This should be called only on previously fully established sessions. For instance failed connects should call stream_session_connect_notify and indicate that the connect has failed.

Definition at line 1097 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 stream_session_dequeue_drop ( transport_connection_t tc,
u32  max_bytes 
)

Definition at line 779 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_disconnect ( stream_session_t s)

Disconnect session and propagate to transport.

This should eventually result in a delete notification that allows us to cleanup session state. Called for both active/passive disconnects.

Definition at line 1193 of file session.c.

+ Here is the caller graph for this function:

void stream_session_disconnect_notify ( transport_connection_t tc)

Notification from transport that connection is being closed.

A disconnect is sent to application but state is not removed. Once disconnect is acknowledged by application, session disconnect is called. Ultimately this leads to close being called on transport (passive close).

Definition at line 1026 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_session_enqueue_data ( transport_connection_t tc,
u8 data,
u16  len,
u8  queue_event 
)

Definition at line 721 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int stream_session_enqueue_notify ( stream_session_t s,
u8  block 
)
static

Notify session peer that new data has been enqueued.

Parameters
sStream session for which the event is to be generated.
blockFlag to indicate if call should block if event queue is full.
Returns
0 on succes or negative number if failed to send notification.

Definition at line 794 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u64 stream_session_half_open_lookup ( session_manager_main_t smm,
ip46_address_t *  lcl,
ip46_address_t *  rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto 
)
static

Definition at line 281 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void stream_session_half_open_table_add ( u8  sst,
transport_connection_t tc,
u64  value 
)
static

Definition at line 79 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void stream_session_half_open_table_del ( session_manager_main_t smm,
u8  sst,
transport_connection_t tc 
)
static

Definition at line 148 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

stream_session_t* stream_session_lookup4 ( ip4_address_t lcl,
ip4_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto,
u32  my_thread_index 
)

Looks up a session based on the 5-tuple passed as argument.

First it tries to find an established session, if this fails, it tries finding a listener session if this fails, it tries a lookup with a wildcarded local source (listener bound to all interfaces)

Definition at line 202 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

stream_session_t* stream_session_lookup6 ( ip6_address_t lcl,
ip6_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto,
u32  my_thread_index 
)

Definition at line 246 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

stream_session_t* stream_session_lookup_listener ( ip46_address_t *  lcl,
u16  lcl_port,
u8  proto 
)

Definition at line 264 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

stream_session_t* stream_session_lookup_listener4 ( ip4_address_t lcl,
u16  lcl_port,
u8  proto 
)

Definition at line 175 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

stream_session_t* stream_session_lookup_listener6 ( ip6_address_t lcl,
u16  lcl_port,
u8  proto 
)

Definition at line 221 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

transport_connection_t* stream_session_lookup_transport4 ( ip4_address_t lcl,
ip4_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto,
u32  my_thread_index 
)

Definition at line 316 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

transport_connection_t* stream_session_lookup_transport6 ( ip6_address_t lcl,
ip6_address_t rmt,
u16  lcl_port,
u16  rmt_port,
u8  proto,
u32  my_thread_index 
)

Definition at line 350 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8 stream_session_no_space ( transport_connection_t tc,
u32  thread_index,
u16  data_len 
)

Check if we have space in rx fifo to push more bytes.

Definition at line 756 of file session.c.

+ Here is the call graph for this function:

int stream_session_open ( u8  sst,
ip46_address_t *  addr,
u16  port_host_byte_order,
u32  app_index 
)

Definition at line 1157 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 stream_session_peek_bytes ( transport_connection_t tc,
u8 buffer,
u32  offset,
u32  max_bytes 
)

Definition at line 771 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_reset_notify ( transport_connection_t tc)

Notify application that connection has been reset.

Definition at line 1114 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_session_start_listen ( u32  server_index,
ip46_address_t *  ip,
u16  port 
)

Definition at line 886 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_stop_listen ( u32  server_index)

Definition at line 920 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stream_session_table_add ( session_manager_main_t smm,
stream_session_t s,
u64  value 
)

Definition at line 68 of file session.c.

+ Here is the call graph for this function:

static void stream_session_table_add_for_tc ( u8  sst,
transport_connection_t tc,
u64  value 
)
static

Definition at line 40 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int stream_session_table_del ( session_manager_main_t smm,
stream_session_t s 
)
static

Definition at line 138 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int stream_session_table_del_for_tc ( session_manager_main_t smm,
u8  sst,
transport_connection_t tc 
)
static

Definition at line 109 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vnet_session_enable_disable ( vlib_main_t vm,
u8  is_en 
)

Definition at line 1306 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vpp_session_event_queue_allocate ( session_manager_main_t smm,
u32  thread_index 
)

Allocate vpp event queue (once) per worker thread.

Definition at line 386 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

session_manager_main_t session_manager_main

Definition at line 33 of file session.c.

transport_proto_vft_t* tp_vfts
static

Per-type vector of transport protocol virtual function tables.

Definition at line 31 of file session.c.