2022-05-06 16:49:46 +00:00
|
|
|
/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */
|
2017-09-22 21:00:03 +00:00
|
|
|
/*
|
|
|
|
* prog.h -- common setup and options for QUIC program
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PROG_H
|
|
|
|
#define PROG_H 1
|
|
|
|
|
2019-09-11 15:27:58 +00:00
|
|
|
#include "test_config.h"
|
|
|
|
|
2017-09-22 21:00:03 +00:00
|
|
|
struct event;
|
|
|
|
struct event_base;
|
|
|
|
struct lsquic_hash;
|
|
|
|
struct sport_head;
|
2019-09-11 15:27:58 +00:00
|
|
|
struct ssl_ctx_st;
|
2017-09-22 21:00:03 +00:00
|
|
|
|
|
|
|
struct prog
|
|
|
|
{
|
|
|
|
struct packout_buf_allocator prog_pba;
|
|
|
|
struct lsquic_engine_settings prog_settings;
|
|
|
|
struct lsquic_engine_api prog_api;
|
|
|
|
unsigned prog_engine_flags;
|
|
|
|
struct service_port prog_dummy_sport; /* Use for options */
|
|
|
|
unsigned prog_packout_max;
|
|
|
|
unsigned short prog_max_packet_size;
|
|
|
|
int prog_version_cleared;
|
2019-01-28 20:41:28 +00:00
|
|
|
unsigned long prog_read_count;
|
2019-09-11 15:27:58 +00:00
|
|
|
#if HAVE_SENDMMSG
|
|
|
|
int prog_use_sendmmsg;
|
|
|
|
#endif
|
|
|
|
#if HAVE_RECVMMSG
|
|
|
|
int prog_use_recvmmsg;
|
|
|
|
#endif
|
|
|
|
int prog_use_stock_pmi;
|
2017-09-22 21:00:03 +00:00
|
|
|
struct event_base *prog_eb;
|
|
|
|
struct event *prog_timer,
|
2018-05-21 19:02:33 +00:00
|
|
|
*prog_send,
|
2017-09-22 21:00:03 +00:00
|
|
|
*prog_usr1;
|
2019-09-11 15:27:58 +00:00
|
|
|
struct event *prog_usr2;
|
|
|
|
struct ssl_ctx_st *prog_ssl_ctx;
|
|
|
|
struct lsquic_hash *prog_certs;
|
|
|
|
struct event *prog_event_sni;
|
|
|
|
char *prog_susp_sni;
|
2017-09-22 21:00:03 +00:00
|
|
|
struct sport_head *prog_sports;
|
|
|
|
struct lsquic_engine *prog_engine;
|
|
|
|
const char *prog_hostname;
|
2018-05-16 19:48:43 +00:00
|
|
|
int prog_ipver; /* 0, 4, or 6 */
|
2019-09-11 15:27:58 +00:00
|
|
|
enum {
|
|
|
|
PROG_FLAG_COOLDOWN = 1 << 0,
|
|
|
|
#if LSQUIC_PREFERRED_ADDR
|
|
|
|
PROG_SEARCH_ADDRS = 1 << 1,
|
|
|
|
#endif
|
|
|
|
} prog_flags;
|
2017-09-22 21:00:03 +00:00
|
|
|
};
|
|
|
|
|
2020-06-03 04:13:30 +00:00
|
|
|
int
|
2017-09-22 21:00:03 +00:00
|
|
|
prog_init (struct prog *, unsigned lsquic_engine_flags, struct sport_head *,
|
|
|
|
const struct lsquic_stream_if *, void *stream_if_ctx);
|
|
|
|
|
2019-09-11 15:27:58 +00:00
|
|
|
#if HAVE_SENDMMSG
|
|
|
|
# define SENDMMSG_FLAG "g"
|
|
|
|
#else
|
|
|
|
# define SENDMMSG_FLAG ""
|
|
|
|
#endif
|
|
|
|
#if HAVE_RECVMMSG
|
|
|
|
# define RECVMMSG_FLAG "j"
|
|
|
|
#else
|
|
|
|
# define RECVMMSG_FLAG ""
|
|
|
|
#endif
|
|
|
|
|
2017-09-26 15:26:05 +00:00
|
|
|
#if LSQUIC_DONTFRAG_SUPPORTED
|
|
|
|
# define IP_DONTFRAG_FLAG "D"
|
|
|
|
#else
|
|
|
|
# define IP_DONTFRAG_FLAG ""
|
|
|
|
#endif
|
|
|
|
|
2019-09-11 15:27:58 +00:00
|
|
|
#define PROG_OPTS "i:km:c:y:L:l:o:H:s:S:Y:z:G:W" RECVMMSG_FLAG SENDMMSG_FLAG \
|
|
|
|
IP_DONTFRAG_FLAG
|
2017-09-22 21:00:03 +00:00
|
|
|
|
|
|
|
/* Returns:
|
|
|
|
* 0 Applied
|
|
|
|
* 1 Not applicable
|
|
|
|
* -1 Error
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
prog_set_opt (struct prog *, int opt, const char *arg);
|
|
|
|
|
|
|
|
struct event_base *
|
|
|
|
prog_eb (struct prog *);
|
|
|
|
|
|
|
|
int
|
|
|
|
prog_run (struct prog *);
|
|
|
|
|
|
|
|
void
|
|
|
|
prog_cleanup (struct prog *);
|
|
|
|
|
|
|
|
void
|
|
|
|
prog_stop (struct prog *);
|
|
|
|
|
|
|
|
int
|
|
|
|
prog_prep (struct prog *);
|
|
|
|
|
|
|
|
int
|
2019-02-04 13:59:11 +00:00
|
|
|
prog_connect (struct prog *, unsigned char *, size_t);
|
2017-09-22 21:00:03 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
prog_print_common_options (const struct prog *, FILE *);
|
|
|
|
|
|
|
|
int
|
|
|
|
prog_is_stopped (void);
|
|
|
|
|
2018-04-09 13:39:38 +00:00
|
|
|
void
|
|
|
|
prog_process_conns (struct prog *);
|
|
|
|
|
2018-05-21 19:02:33 +00:00
|
|
|
void
|
|
|
|
prog_sport_cant_send (struct prog *, int fd);
|
|
|
|
|
2017-09-22 21:00:03 +00:00
|
|
|
#endif
|