http: support client connect

Type: feature

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: I0738c0aefb41ab6c0ff717cfccd1df75ddb481fa
This commit is contained in:
Filip Tehlar
2022-09-14 09:07:12 +00:00
committed by Florin Coras
parent ea6c878d5f
commit ee4172ef0a
6 changed files with 983 additions and 55 deletions

View File

@ -20,6 +20,7 @@ add_vpp_plugin(hs_apps
echo_server.c
hs_apps.c
http_cli.c
http_client_cli.c
http_tps.c
proxy.c
)

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2022 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const char *html_header_template = "<html><head><title>%v</title></head>"
"<link rel=\"icon\" href=\"data:,\">"
"<body><pre>";
const char *html_footer = "</pre></body></html>\r\n";
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@ typedef struct http_conn_id_
STATIC_ASSERT (sizeof (http_conn_id_t) <= TRANSPORT_CONN_ID_LEN,
"ctx id must be less than TRANSPORT_CONN_ID_LEN");
typedef enum http_state_
typedef enum http_conn_state_
{
HTTP_CONN_STATE_LISTEN,
HTTP_CONN_STATE_CONNECTING,
@ -59,13 +59,13 @@ typedef enum http_state_
HTTP_CONN_STATE_CLOSED
} http_conn_state_t;
typedef enum http_req_state_
typedef enum http_state_
{
HTTP_REQ_STATE_WAIT_METHOD,
HTTP_REQ_STATE_WAIT_APP,
HTTP_REQ_STATE_SEND_MORE_DATA,
HTTP_REQ_N_STATES,
} http_req_state_t;
HTTP_STATE_WAIT_METHOD,
HTTP_STATE_WAIT_APP,
HTTP_STATE_IO_MORE_DATA,
HTTP_N_STATES,
} http_state_t;
typedef enum http_req_method_
{
@ -143,6 +143,7 @@ typedef struct http_tc_
#define h_tc_session_handle c_http_conn_id.tc_session_handle
#define h_pa_wrk_index c_http_conn_id.parent_app_wrk_index
#define h_pa_session_handle c_http_conn_id.app_session_handle
#define h_pa_app_api_ctx c_http_conn_id.parent_app_api_ctx
#define h_hc_index connection.c_index
http_conn_state_t state;
@ -151,11 +152,14 @@ typedef struct http_tc_
/*
* Current request
*/
http_req_state_t req_state;
http_state_t http_state;
http_req_method_t method;
u8 *rx_buf;
u32 rx_buf_offset;
http_buffer_t tx_buf;
u8 is_client;
u32 to_recv;
u32 bytes_dequeued;
} http_conn_t;
typedef struct http_worker_

View File

@ -288,6 +288,8 @@ int vnet_app_del_cert_key_pair (u32 index);
/** Ask for app cb on pair deletion */
int vnet_app_add_cert_key_interest (u32 index, u32 app_index);
uword unformat_vnet_uri (unformat_input_t *input, va_list *args);
typedef struct app_session_transport_
{
ip46_address_t rmt_ip; /**< remote ip */