FD.io VPP  v17.07.01-10-g3be13f0
Vector Packet Processing
builtin_http_server.c File Reference
+ Include dependency graph for builtin_http_server.c:

Go to the source code of this file.

Data Structures

struct  http_server_main_t
 

Macros

#define vl_typedefs
 
#define vl_endianfun
 
#define vl_print(handle, ...)   vlib_cli_output (handle, __VA_ARGS__)
 
#define vl_printfun
 
#define foreach_tcp_http_server_api_msg   _(MEMCLNT_CREATE_REPLY, memclnt_create_reply) \
 

Enumerations

enum  http_process_event_t { EVENT_WAKEUP = 1 }
 

Functions

static void free_http_process (stream_session_t *s)
 
static void http_cli_output (uword arg, u8 *buffer, uword buffer_bytes)
 
void send_data (stream_session_t *s, u8 *data)
 
static void send_error (stream_session_t *s, char *str)
 
static uword http_cli_process (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
 
static void alloc_http_process (stream_session_t *s)
 
static int builtin_session_accept_callback (stream_session_t *s)
 
static void builtin_session_disconnect_callback (stream_session_t *s)
 
static void builtin_session_reset_callback (stream_session_t *s)
 
static int builtin_session_connected_callback (u32 app_index, u32 api_context, stream_session_t *s, u8 is_fail)
 
static int builtin_add_segment_callback (u32 client_index, const u8 *seg_name, u32 seg_size)
 
static int builtin_redirect_connect_callback (u32 client_index, void *mp)
 
static void alloc_http_process_callback (void *s_arg)
 
static int http_server_rx_callback (stream_session_t *s)
 
static int create_api_loopback (vlib_main_t *vm)
 
static int server_attach ()
 
static int server_listen ()
 
static int server_create (vlib_main_t *vm)
 
static void vl_api_memclnt_create_reply_t_handler (vl_api_memclnt_create_reply_t *mp)
 
static clib_error_ttcp_http_server_api_hookup (vlib_main_t *vm)
 
static clib_error_tserver_create_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tbuiltin_http_server_main_init (vlib_main_t *vm)
 

Variables

http_server_main_t http_server_main
 
static const char * http_response
 
static const char * http_error_template
 
static const char * html_header_template
 
static const char * html_footer = "</pre></body></html>\r\n"
 
static session_cb_vft_t builtin_session_cb_vft
 
static vlib_cli_command_t server_create_command
 (constructor) VLIB_CLI_COMMAND (server_create_command) More...
 

Macro Definition Documentation

#define foreach_tcp_http_server_api_msg   _(MEMCLNT_CREATE_REPLY, memclnt_create_reply) \

Definition at line 580 of file builtin_http_server.c.

#define vl_endianfun

Definition at line 30 of file builtin_http_server.c.

#define vl_print (   handle,
  ... 
)    vlib_cli_output (handle, __VA_ARGS__)

Definition at line 35 of file builtin_http_server.c.

#define vl_printfun

Definition at line 36 of file builtin_http_server.c.

#define vl_typedefs

Definition at line 25 of file builtin_http_server.c.

Enumeration Type Documentation

Enumerator
EVENT_WAKEUP 

Definition at line 40 of file builtin_http_server.c.

Function Documentation

static void alloc_http_process ( stream_session_t s)
static

Definition at line 288 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void alloc_http_process_callback ( void *  s_arg)
static

Definition at line 389 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int builtin_add_segment_callback ( u32  client_index,
const u8 seg_name,
u32  seg_size 
)
static

Definition at line 374 of file builtin_http_server.c.

static clib_error_t* builtin_http_server_main_init ( vlib_main_t vm)
static

Definition at line 637 of file builtin_http_server.c.

static int builtin_redirect_connect_callback ( u32  client_index,
void *  mp 
)
static

Definition at line 382 of file builtin_http_server.c.

static int builtin_session_accept_callback ( stream_session_t s)
static

Definition at line 334 of file builtin_http_server.c.

+ Here is the call graph for this function:

static int builtin_session_connected_callback ( u32  app_index,
u32  api_context,
stream_session_t s,
u8  is_fail 
)
static

Definition at line 366 of file builtin_http_server.c.

static void builtin_session_disconnect_callback ( stream_session_t s)
static

Definition at line 346 of file builtin_http_server.c.

+ Here is the call graph for this function:

static void builtin_session_reset_callback ( stream_session_t s)
static

Definition at line 357 of file builtin_http_server.c.

+ Here is the call graph for this function:

static int create_api_loopback ( vlib_main_t vm)
static

Definition at line 452 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void free_http_process ( stream_session_t s)
static

Definition at line 71 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void http_cli_output ( uword  arg,
u8 buffer,
uword  buffer_bytes 
)
static

Definition at line 120 of file builtin_http_server.c.

+ Here is the caller graph for this function:

static uword http_cli_process ( vlib_main_t vm,
vlib_node_runtime_t rt,
vlib_frame_t f 
)
static

Definition at line 202 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int http_server_rx_callback ( stream_session_t s)
static

Definition at line 396 of file builtin_http_server.c.

+ Here is the call graph for this function:

void send_data ( stream_session_t s,
u8 data 
)

Definition at line 136 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_error ( stream_session_t s,
char *  str 
)
static

Definition at line 192 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int server_attach ( )
static

Definition at line 499 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int server_create ( vlib_main_t vm)
static

Definition at line 541 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* server_create_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 609 of file builtin_http_server.c.

+ Here is the call graph for this function:

static int server_listen ( )
static

Definition at line 530 of file builtin_http_server.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* tcp_http_server_api_hookup ( vlib_main_t vm)
static

Definition at line 584 of file builtin_http_server.c.

+ Here is the caller graph for this function:

static void vl_api_memclnt_create_reply_t_handler ( vl_api_memclnt_create_reply_t mp)
static

Definition at line 571 of file builtin_http_server.c.

+ Here is the call graph for this function:

Variable Documentation

session_cb_vft_t builtin_session_cb_vft
static
Initial value:
= {
.session_accept_callback = builtin_session_accept_callback,
.session_disconnect_callback = builtin_session_disconnect_callback,
.session_connected_callback = builtin_session_connected_callback,
.add_segment_callback = builtin_add_segment_callback,
.redirect_connect_callback = builtin_redirect_connect_callback,
.builtin_server_rx_callback = http_server_rx_callback,
.session_reset_callback = builtin_session_reset_callback
}
static int http_server_rx_callback(stream_session_t *s)
static int builtin_add_segment_callback(u32 client_index, const u8 *seg_name, u32 seg_size)
static int builtin_session_connected_callback(u32 app_index, u32 api_context, stream_session_t *s, u8 is_fail)
static int builtin_session_accept_callback(stream_session_t *s)
static int builtin_redirect_connect_callback(u32 client_index, void *mp)
static void builtin_session_disconnect_callback(stream_session_t *s)
static void builtin_session_reset_callback(stream_session_t *s)

Definition at line 440 of file builtin_http_server.c.

const char* html_footer = "</pre></body></html>\r\n"
static

Definition at line 117 of file builtin_http_server.c.

const char* html_header_template
static
Initial value:
= "<html><head><title>%v</title>"
"</head><link rel=\"icon\" href=\"data:,\"><body><pre>"

Definition at line 114 of file builtin_http_server.c.

const char* http_error_template
static
Initial value:
= "HTTP/1.1 %s\r\n"
"Content-Type: text/html\r\n"
"Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
"Connection: close\r\n" "Pragma: no-cache\r\n" "Content-Length: 0\r\n\r\n"

Definition at line 107 of file builtin_http_server.c.

const char* http_response
static
Initial value:
= "HTTP/1.1 200 OK\r\n"
"Content-Type: text/html\r\n"
"Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
"Connection: close\r\n"
"Pragma: no-cache\r\n" "Content-Length: %d\r\n\r\n%s"

Definition at line 100 of file builtin_http_server.c.

http_server_main_t http_server_main

Definition at line 68 of file builtin_http_server.c.

vlib_cli_command_t server_create_command
static
Initial value:
=
{
.path = "test http server",
.short_help = "test http server",
}
static clib_error_t * server_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (server_create_command)

Definition at line 628 of file builtin_http_server.c.