FD.io VPP  v19.08-27-gf4dcae4
Vector Packet Processing
tcp_echo.c File Reference
+ Include dependency graph for tcp_echo.c:

Go to the source code of this file.

Data Structures

struct  echo_session_t
 
struct  echo_main_t
 

Macros

#define vl_typedefs   /* define message structures */
 
#define vl_endianfun   /* define message structures */
 
#define vl_print(handle, ...)
 
#define vl_printfun
 
#define TCP_ECHO_DBG   0
 
#define DBG(_fmt, _args...)
 
#define NITER   10000
 
#define TIMEOUT   600.0
 
#define foreach_tcp_echo_msg
 

Enumerations

enum  connection_state_t {
  STATE_START, STATE_ATTACHED, STATE_LISTEN, STATE_READY,
  STATE_DATA_DONE, STATE_DISCONNECTED, STATE_DETACHED, STATE_START,
  STATE_ATTACHED, STATE_LISTEN, STATE_READY, STATE_DISCONNECTING,
  STATE_FAILED, STATE_DETACHED, STATE_START, STATE_ATTACHED,
  STATE_BOUND, STATE_READY, STATE_FAILED, STATE_DISCONNECTING,
  STATE_DETACHED
}
 

Functions

static u8format_api_error (u8 *s, va_list *args)
 
static void init_error_string_table (echo_main_t *em)
 
static void handle_mq_event (session_event_t *e)
 
static int wait_for_state_change (echo_main_t *em, connection_state_t state)
 
void application_send_attach (echo_main_t *em)
 
static int application_attach (echo_main_t *em)
 
void application_detach (echo_main_t *em)
 
static int ssvm_segment_attach (char *name, ssvm_segment_type_t type, int fd)
 
static void vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t *mp)
 
static void vl_api_application_detach_reply_t_handler (vl_api_application_detach_reply_t *mp)
 
static void stop_signal (int signum)
 
static void stats_signal (int signum)
 
static clib_error_tsetup_signal_handlers (void)
 
void vlib_cli_output (struct vlib_main_t *vm, char *fmt,...)
 
int connect_to_vpp (char *name)
 
void disconnect_from_vpp (echo_main_t *em)
 
static void vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t *mp)
 
static void session_print_stats (echo_main_t *em, echo_session_t *session)
 
static void test_recv_bytes (echo_session_t *s, u8 *rx_buf, u32 n_read)
 
static void recv_data_chunk (echo_main_t *em, echo_session_t *s, u8 *rx_buf)
 
static void send_data_chunk (echo_main_t *em, echo_session_t *s)
 
static void * client_thread_fn (void *arg)
 
void client_send_connect (echo_main_t *em)
 
void client_send_disconnect (echo_main_t *em, echo_session_t *s)
 
int client_disconnect (echo_main_t *em, echo_session_t *s)
 
static void session_bound_handler (session_bound_msg_t *mp)
 
static void session_accepted_handler (session_accepted_msg_t *mp)
 
static void session_connected_handler (session_connected_msg_t *mp)
 
static void session_disconnected_handler (session_disconnected_msg_t *mp)
 
static void session_reset_handler (session_reset_msg_t *mp)
 
static void clients_run (echo_main_t *em)
 
static void vl_api_bind_uri_reply_t_handler (vl_api_bind_uri_reply_t *mp)
 
static void vl_api_unbind_uri_reply_t_handler (vl_api_unbind_uri_reply_t *mp)
 
u8format_ip4_address (u8 *s, va_list *args)
 
u8format_ip6_address (u8 *s, va_list *args)
 
u8format_ip46_address (u8 *s, va_list *args)
 
static void server_handle_rx (echo_main_t *em, session_event_t *e)
 
static void server_handle_mq (echo_main_t *em)
 
void server_send_listen (echo_main_t *em)
 
int server_listen (echo_main_t *em)
 
void server_send_unbind (echo_main_t *em)
 
int server_unbind (echo_main_t *em)
 
void server_run (echo_main_t *em)
 
static void vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t *mp)
 
static void vl_api_application_tls_cert_add_reply_t_handler (vl_api_application_tls_cert_add_reply_t *mp)
 
static void vl_api_application_tls_key_add_reply_t_handler (vl_api_application_tls_key_add_reply_t *mp)
 
void tcp_echo_api_hookup (echo_main_t *em)
 
int main (int argc, char **argv)
 

Variables

echo_main_t echo_main
 

Macro Definition Documentation

#define DBG (   _fmt,
  _args... 
)
Value:
clib_warning (_fmt, _args)
#define TCP_ECHO_DBG
Definition: tcp_echo.c:41
#define clib_warning(format, args...)
Definition: error.h:59

Definition at line 42 of file tcp_echo.c.

#define foreach_tcp_echo_msg
Value:
_(BIND_URI_REPLY, bind_uri_reply) \
_(UNBIND_URI_REPLY, unbind_uri_reply) \
_(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \
_(APPLICATION_ATTACH_REPLY, application_attach_reply) \
_(APPLICATION_DETACH_REPLY, application_detach_reply) \
_(MAP_ANOTHER_SEGMENT, map_another_segment) \
_(APPLICATION_TLS_CERT_ADD_REPLY, application_tls_cert_add_reply) \
_(APPLICATION_TLS_KEY_ADD_REPLY, application_tls_key_add_reply) \

Definition at line 1265 of file tcp_echo.c.

#define NITER   10000

Definition at line 150 of file tcp_echo.c.

#define TCP_ECHO_DBG   0

Definition at line 41 of file tcp_echo.c.

#define TIMEOUT   600.0
#define vl_endianfun   /* define message structures */

Definition at line 31 of file tcp_echo.c.

#define vl_print (   handle,
  ... 
)

Definition at line 36 of file tcp_echo.c.

#define vl_printfun

Definition at line 37 of file tcp_echo.c.

#define vl_typedefs   /* define message structures */

Definition at line 25 of file tcp_echo.c.

Enumeration Type Documentation

Enumerator
STATE_START 
STATE_ATTACHED 
STATE_LISTEN 
STATE_READY 
STATE_DATA_DONE 
STATE_DISCONNECTED 
STATE_DETACHED 
STATE_START 
STATE_ATTACHED 
STATE_LISTEN 
STATE_READY 
STATE_DISCONNECTING 
STATE_FAILED 
STATE_DETACHED 
STATE_START 
STATE_ATTACHED 
STATE_BOUND 
STATE_READY 
STATE_FAILED 
STATE_DISCONNECTING 
STATE_DETACHED 

Definition at line 60 of file tcp_echo.c.

Function Documentation

static int application_attach ( echo_main_t em)
static

Definition at line 264 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void application_detach ( echo_main_t em)

Definition at line 276 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void application_send_attach ( echo_main_t em)

Definition at line 222 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int client_disconnect ( echo_main_t em,
echo_session_t s 
)

Definition at line 617 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void client_send_connect ( echo_main_t em)

Definition at line 591 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void client_send_disconnect ( echo_main_t em,
echo_session_t s 
)

Definition at line 605 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* client_thread_fn ( void *  arg)
static

Definition at line 561 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void clients_run ( echo_main_t em)
static

Definition at line 853 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int connect_to_vpp ( char *  name)

Definition at line 414 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void disconnect_from_vpp ( echo_main_t em)

Definition at line 448 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u8* format_api_error ( u8 s,
va_list *  args 
)
static

Definition at line 156 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_ip46_address ( u8 s,
va_list *  args 
)

Definition at line 1028 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_ip4_address ( u8 s,
va_list *  args 
)

Definition at line 970 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_ip6_address ( u8 s,
va_list *  args 
)

Definition at line 977 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void handle_mq_event ( session_event_t *  e)
static

Definition at line 828 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void init_error_string_table ( echo_main_t em)
static

Definition at line 172 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 1290 of file tcp_echo.c.

+ Here is the call graph for this function:

static void recv_data_chunk ( echo_main_t em,
echo_session_t s,
u8 rx_buf 
)
static

Definition at line 506 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_data_chunk ( echo_main_t em,
echo_session_t s 
)
static

Definition at line 536 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void server_handle_mq ( echo_main_t em)
static

Definition at line 1108 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void server_handle_rx ( echo_main_t em,
session_event_t *  e 
)
static

Definition at line 1053 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int server_listen ( echo_main_t em)

Definition at line 1152 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void server_run ( echo_main_t em)

Definition at line 1190 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void server_send_listen ( echo_main_t em)

Definition at line 1138 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void server_send_unbind ( echo_main_t em)

Definition at line 1164 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int server_unbind ( echo_main_t em)

Definition at line 1178 of file tcp_echo.c.

+ Here is the call graph for this function:

static void session_accepted_handler ( session_accepted_msg_t mp)
static

Definition at line 644 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void session_bound_handler ( session_bound_msg_t mp)
static

Definition at line 626 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void session_connected_handler ( session_connected_msg_t mp)
static

Definition at line 705 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void session_disconnected_handler ( session_disconnected_msg_t mp)
static

Definition at line 763 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void session_print_stats ( echo_main_t em,
echo_session_t session 
)
static

Definition at line 479 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void session_reset_handler ( session_reset_msg_t mp)
static

Definition at line 795 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* setup_signal_handlers ( void  )
static

Definition at line 398 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int ssvm_segment_attach ( char *  name,
ssvm_segment_type_t  type,
int  fd 
)
static

Definition at line 291 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void stats_signal ( int  signum)
static

Definition at line 390 of file tcp_echo.c.

+ Here is the caller graph for this function:

static void stop_signal ( int  signum)
static

Definition at line 382 of file tcp_echo.c.

+ Here is the caller graph for this function:

void tcp_echo_api_hookup ( echo_main_t em)

Definition at line 1276 of file tcp_echo.c.

+ Here is the caller graph for this function:

static void test_recv_bytes ( echo_session_t s,
u8 rx_buf,
u32  n_read 
)
static

Definition at line 491 of file tcp_echo.c.

+ Here is the caller graph for this function:

static void vl_api_application_attach_reply_t_handler ( vl_api_application_attach_reply_t mp)
static

Definition at line 315 of file tcp_echo.c.

+ Here is the call graph for this function:

static void vl_api_application_detach_reply_t_handler ( vl_api_application_detach_reply_t *  mp)
static

Definition at line 373 of file tcp_echo.c.

static void vl_api_application_tls_cert_add_reply_t_handler ( vl_api_application_tls_cert_add_reply_t *  mp)
static

Definition at line 1251 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_application_tls_key_add_reply_t_handler ( vl_api_application_tls_key_add_reply_t *  mp)
static

Definition at line 1259 of file tcp_echo.c.

+ Here is the caller graph for this function:

static void vl_api_bind_uri_reply_t_handler ( vl_api_bind_uri_reply_t *  mp)
static

Definition at line 943 of file tcp_echo.c.

+ Here is the call graph for this function:

static void vl_api_disconnect_session_reply_t_handler ( vl_api_disconnect_session_reply_t mp)
static

Definition at line 1223 of file tcp_echo.c.

+ Here is the call graph for this function:

static void vl_api_map_another_segment_t_handler ( vl_api_map_another_segment_t mp)
static

Definition at line 457 of file tcp_echo.c.

+ Here is the call graph for this function:

static void vl_api_unbind_uri_reply_t_handler ( vl_api_unbind_uri_reply_t *  mp)
static

Definition at line 959 of file tcp_echo.c.

void vlib_cli_output ( struct vlib_main_t vm,
char *  fmt,
  ... 
)

Definition at line 408 of file tcp_echo.c.

static int wait_for_state_change ( echo_main_t em,
connection_state_t  state 
)
static

Definition at line 186 of file tcp_echo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

echo_main_t echo_main

Definition at line 147 of file tcp_echo.c.