FD.io VPP  v17.04-9-g99c0734
Vector Packet Processing
session.h File Reference
+ Include dependency graph for session.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HALF_OPEN_LOOKUP_INVALID_VALUE   ((u64)~0)
 
#define INVALID_INDEX   ((u32)~0)
 
#define MAX_HDRS_LEN   100 /* Max number of bytes for headers */
 
#define foreach_session_input_error
 
#define foreach_session_type
 

Typedefs

typedef struct _stream_session_t stream_session_t
 
typedef struct _session_manager session_manager_t
 
typedef struct _session_manager_main session_manager_main_t
 
typedef int( session_fifo_rx_fn) (vlib_main_t *vm, vlib_node_runtime_t *node, session_manager_main_t *smm, session_fifo_event_t *e0, stream_session_t *s0, u32 thread_index, int *n_tx_pkts)
 

Enumerations

enum  fifo_event_type_t { FIFO_EVENT_SERVER_RX, FIFO_EVENT_SERVER_TX, FIFO_EVENT_TIMEOUT, FIFO_EVENT_SERVER_EXIT }
 
enum  session_error_t { SESSION_N_ERROR }
 
enum  session_queue_next_t {
  SESSION_QUEUE_NEXT_DROP, SESSION_QUEUE_NEXT_TCP_IP4_OUTPUT, SESSION_QUEUE_NEXT_IP4_LOOKUP, SESSION_QUEUE_NEXT_TCP_IP6_OUTPUT,
  SESSION_QUEUE_NEXT_IP6_LOOKUP, SESSION_QUEUE_N_NEXT
}
 
enum  session_type_t { SESSION_N_TYPES }
 
enum  stream_session_state_t {
  SESSION_STATE_LISTENING, SESSION_STATE_CONNECTING, SESSION_STATE_READY, SESSION_STATE_CLOSED,
  SESSION_STATE_N_STATES
}
 

Functions

typedef CLIB_PACKED (struct{svm_fifo_t *fifo;u8 event_type;u16 event_id;u32 enqueue_length;}) session_fifo_event_t
 
static session_manager_main_tvnet_get_session_manager_main ()
 
static session_manager_tsession_manager_get (u32 index)
 
static unix_shared_memory_queue_tsession_manager_get_vpp_event_queue (u32 thread_index)
 
static session_manager_tconnects_session_manager_get (session_manager_main_t *smm, session_type_t session_type)
 
void session_manager_get_segment_info (u32 index, u8 **name, u32 *size)
 
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 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)
 
void connects_session_manager_init (session_manager_main_t *smm, u8 session_type)
 
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 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, u32 thread_index)
 
transport_connection_tstream_session_lookup_transport4 (ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u32 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 thread_index)
 
stream_session_tstream_session_lookup_listener (ip46_address_t *lcl, u16 lcl_port, u8 proto)
 
static stream_session_tstream_session_get_tsi (u64 ti_and_si, u32 thread_index)
 
static stream_session_tstream_session_get (u64 si, u32 thread_index)
 
static stream_session_tstream_session_get_if_valid (u64 si, u32 thread_index)
 
static stream_session_tstream_session_listener_get (u8 sst, u64 si)
 
static u32 stream_session_get_index (stream_session_t *s)
 
static u32 stream_session_max_enqueue (transport_connection_t *tc)
 
static u32 stream_session_fifo_size (transport_connection_t *tc)
 
int stream_session_enqueue_data (transport_connection_t *tc, u8 *data, u16 len, u8 queue_event)
 
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)
 
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_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 api_client_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...
 
int stream_session_start_listen (u32 server_index, ip46_address_t *ip, u16 port)
 
void stream_session_stop_listen (u32 server_index)
 
u8format_stream_session (u8 *s, va_list *args)
 Format stream session as per the following format. More...
 
void session_register_transport (u8 type, const transport_proto_vft_t *vft)
 
transport_proto_vft_tsession_get_transport_vft (u8 type)
 
clib_error_tvnet_session_enable_disable (vlib_main_t *vm, u8 is_en)
 

Variables

session_fifo_rx_fn session_tx_fifo_peek_and_snd
 
session_fifo_rx_fn session_tx_fifo_dequeue_and_snd
 
session_manager_main_t session_manager_main
 
vlib_node_registration_t session_queue_node
 (constructor) VLIB_REGISTER_NODE (session_queue_node) More...
 

Macro Definition Documentation

#define foreach_session_input_error
Value:
_(NO_SESSION, "No session drops") \
_(NO_LISTENER, "No listener for dst port drops") \
_(ENQUEUED, "Packets pushed into rx fifo") \
_(NOT_READY, "Session not ready packets") \
_(FIFO_FULL, "Packets dropped for lack of rx fifo space") \
_(EVENT_FIFO_FULL, "Events not sent for lack of event fifo space") \
_(API_QUEUE_FULL, "Sessions not created for lack of API queue space") \
_(NEW_SEG_NO_SPACE, "Created segment, couldn't allocate a fifo pair") \
_(NO_SPACE, "Couldn't allocate a fifo pair")

Definition at line 38 of file session.h.

#define foreach_session_type
Value:
_(IP4_TCP, ip4_tcp) \
_(IP4_UDP, ip4_udp) \
_(IP6_TCP, ip6_tcp) \
_(IP6_UDP, ip6_udp)

Definition at line 68 of file session.h.

#define HALF_OPEN_LOOKUP_INVALID_VALUE   ((u64)~0)

Definition at line 24 of file session.h.

#define INVALID_INDEX   ((u32)~0)

Definition at line 25 of file session.h.

#define MAX_HDRS_LEN   100 /* Max number of bytes for headers */

Definition at line 28 of file session.h.

Typedef Documentation

typedef int( session_fifo_rx_fn) (vlib_main_t *vm, vlib_node_runtime_t *node, session_manager_main_t *smm, session_fifo_event_t *e0, stream_session_t *s0, u32 thread_index, int *n_tx_pkts)

Definition at line 160 of file session.h.

typedef struct _session_manager_main session_manager_main_t

Definition at line 157 of file session.h.

typedef struct _session_manager session_manager_t
typedef struct _stream_session_t stream_session_t

Enumeration Type Documentation

Enumerator
FIFO_EVENT_SERVER_RX 
FIFO_EVENT_SERVER_TX 
FIFO_EVENT_TIMEOUT 
FIFO_EVENT_SERVER_EXIT 

Definition at line 30 of file session.h.

Enumerator
SESSION_N_ERROR 

Definition at line 49 of file session.h.

Enumerator
SESSION_QUEUE_NEXT_DROP 
SESSION_QUEUE_NEXT_TCP_IP4_OUTPUT 
SESSION_QUEUE_NEXT_IP4_LOOKUP 
SESSION_QUEUE_NEXT_TCP_IP6_OUTPUT 
SESSION_QUEUE_NEXT_IP6_LOOKUP 
SESSION_QUEUE_N_NEXT 

Definition at line 58 of file session.h.

Enumerator
SESSION_N_TYPES 

Definition at line 74 of file session.h.

Enumerator
SESSION_STATE_LISTENING 
SESSION_STATE_CONNECTING 
SESSION_STATE_READY 
SESSION_STATE_CLOSED 
SESSION_STATE_N_STATES 

Definition at line 85 of file session.h.

Function Documentation

typedef CLIB_PACKED ( struct{svm_fifo_t *fifo;u8 event_type;u16 event_id;u32 enqueue_length;}  )
static session_manager_t* connects_session_manager_get ( session_manager_main_t smm,
session_type_t  session_type 
)
inlinestatic

Definition at line 248 of file session.h.

+ Here is the call graph for this function:

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:

u8* format_stream_session ( u8 s,
va_list *  args 
)

Format stream session as per the following format.

verbose: "Connection", "Rx fifo", "Tx fifo", "Session Index" non-verbose: "Connection"

Definition at line 27 of file session_cli.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:

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:

static session_manager_t* session_manager_get ( u32  index)
inlinestatic

Definition at line 236 of file session.h.

+ 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 unix_shared_memory_queue_t* session_manager_get_vpp_event_queue ( u32  thread_index)
inlinestatic

Definition at line 242 of file session.h.

+ Here is the caller 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:

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 u32 stream_session_fifo_size ( transport_connection_t tc)
inlinestatic

Definition at line 343 of file session.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static stream_session_t* stream_session_get ( u64  si,
u32  thread_index 
)
inlinestatic

Definition at line 303 of file session.h.

+ Here is the caller graph for this function:

static stream_session_t* stream_session_get_if_valid ( u64  si,
u32  thread_index 
)
inlinestatic

Definition at line 309 of file session.h.

+ Here is the caller graph for this function:

static u32 stream_session_get_index ( stream_session_t s)
inlinestatic

Definition at line 327 of file session.h.

+ Here is the caller graph for this function:

static stream_session_t* stream_session_get_tsi ( u64  ti_and_si,
u32  thread_index 
)
inlinestatic

Definition at line 295 of file session.h.

+ Here is the caller graph for this function:

static stream_session_t* stream_session_listener_get ( u8  sst,
u64  si 
)
inlinestatic

Definition at line 321 of file session.h.

+ 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  ,
u32  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  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  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:

static u32 stream_session_max_enqueue ( transport_connection_t tc)
inlinestatic

Definition at line 336 of file session.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int stream_session_open ( u8  sst,
ip46_address_t *  addr,
u16  port_host_byte_order,
u32  api_client_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:

static session_manager_main_t* vnet_get_session_manager_main ( )
inlinestatic

Definition at line 230 of file session.h.

+ 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:

Variable Documentation

session_manager_main_t session_manager_main

Definition at line 33 of file session.c.

vlib_node_registration_t session_queue_node

(constructor) VLIB_REGISTER_NODE (session_queue_node)

Definition at line 32 of file node.c.

session_fifo_rx_fn session_tx_fifo_dequeue_and_snd
session_fifo_rx_fn session_tx_fifo_peek_and_snd