1a74702c6SGeorge Wang/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * prog.h -- common setup and options for QUIC program 450aadb33SDmitri Tikhonov */ 550aadb33SDmitri Tikhonov 650aadb33SDmitri Tikhonov#ifndef PROG_H 750aadb33SDmitri Tikhonov#define PROG_H 1 850aadb33SDmitri Tikhonov 95392f7a3SLiteSpeed Tech#include "test_config.h" 105392f7a3SLiteSpeed Tech 1150aadb33SDmitri Tikhonovstruct event; 1250aadb33SDmitri Tikhonovstruct event_base; 1350aadb33SDmitri Tikhonovstruct lsquic_hash; 1450aadb33SDmitri Tikhonovstruct sport_head; 155392f7a3SLiteSpeed Techstruct ssl_ctx_st; 1650aadb33SDmitri Tikhonov 1750aadb33SDmitri Tikhonovstruct prog 1850aadb33SDmitri Tikhonov{ 1950aadb33SDmitri Tikhonov struct packout_buf_allocator prog_pba; 2050aadb33SDmitri Tikhonov struct lsquic_engine_settings prog_settings; 2150aadb33SDmitri Tikhonov struct lsquic_engine_api prog_api; 2250aadb33SDmitri Tikhonov unsigned prog_engine_flags; 2350aadb33SDmitri Tikhonov struct service_port prog_dummy_sport; /* Use for options */ 2450aadb33SDmitri Tikhonov unsigned prog_packout_max; 2550aadb33SDmitri Tikhonov unsigned short prog_max_packet_size; 2650aadb33SDmitri Tikhonov int prog_version_cleared; 276aba801dSDmitri Tikhonov unsigned long prog_read_count; 285392f7a3SLiteSpeed Tech#if HAVE_SENDMMSG 295392f7a3SLiteSpeed Tech int prog_use_sendmmsg; 305392f7a3SLiteSpeed Tech#endif 315392f7a3SLiteSpeed Tech#if HAVE_RECVMMSG 325392f7a3SLiteSpeed Tech int prog_use_recvmmsg; 335392f7a3SLiteSpeed Tech#endif 345392f7a3SLiteSpeed Tech int prog_use_stock_pmi; 3550aadb33SDmitri Tikhonov struct event_base *prog_eb; 3650aadb33SDmitri Tikhonov struct event *prog_timer, 37c44946ecSDmitri Tikhonov *prog_send, 3850aadb33SDmitri Tikhonov *prog_usr1; 395392f7a3SLiteSpeed Tech struct event *prog_usr2; 405392f7a3SLiteSpeed Tech struct ssl_ctx_st *prog_ssl_ctx; 415392f7a3SLiteSpeed Tech struct lsquic_hash *prog_certs; 425392f7a3SLiteSpeed Tech struct event *prog_event_sni; 435392f7a3SLiteSpeed Tech char *prog_susp_sni; 4450aadb33SDmitri Tikhonov struct sport_head *prog_sports; 4550aadb33SDmitri Tikhonov struct lsquic_engine *prog_engine; 4650aadb33SDmitri Tikhonov const char *prog_hostname; 4707354a9aSDmitri Tikhonov int prog_ipver; /* 0, 4, or 6 */ 485392f7a3SLiteSpeed Tech enum { 495392f7a3SLiteSpeed Tech PROG_FLAG_COOLDOWN = 1 << 0, 505392f7a3SLiteSpeed Tech#if LSQUIC_PREFERRED_ADDR 515392f7a3SLiteSpeed Tech PROG_SEARCH_ADDRS = 1 << 1, 525392f7a3SLiteSpeed Tech#endif 535392f7a3SLiteSpeed Tech } prog_flags; 5450aadb33SDmitri Tikhonov}; 5550aadb33SDmitri Tikhonov 56fb3e20e0SDmitri Tikhonovint 5750aadb33SDmitri Tikhonovprog_init (struct prog *, unsigned lsquic_engine_flags, struct sport_head *, 5850aadb33SDmitri Tikhonov const struct lsquic_stream_if *, void *stream_if_ctx); 5950aadb33SDmitri Tikhonov 605392f7a3SLiteSpeed Tech#if HAVE_SENDMMSG 615392f7a3SLiteSpeed Tech# define SENDMMSG_FLAG "g" 625392f7a3SLiteSpeed Tech#else 635392f7a3SLiteSpeed Tech# define SENDMMSG_FLAG "" 645392f7a3SLiteSpeed Tech#endif 655392f7a3SLiteSpeed Tech#if HAVE_RECVMMSG 665392f7a3SLiteSpeed Tech# define RECVMMSG_FLAG "j" 675392f7a3SLiteSpeed Tech#else 685392f7a3SLiteSpeed Tech# define RECVMMSG_FLAG "" 695392f7a3SLiteSpeed Tech#endif 705392f7a3SLiteSpeed Tech 71e0197994SDmitri Tikhonov#if LSQUIC_DONTFRAG_SUPPORTED 72e0197994SDmitri Tikhonov# define IP_DONTFRAG_FLAG "D" 73e0197994SDmitri Tikhonov#else 74e0197994SDmitri Tikhonov# define IP_DONTFRAG_FLAG "" 75e0197994SDmitri Tikhonov#endif 76e0197994SDmitri Tikhonov 775392f7a3SLiteSpeed Tech#define PROG_OPTS "i:km:c:y:L:l:o:H:s:S:Y:z:G:W" RECVMMSG_FLAG SENDMMSG_FLAG \ 785392f7a3SLiteSpeed Tech IP_DONTFRAG_FLAG 7950aadb33SDmitri Tikhonov 8050aadb33SDmitri Tikhonov/* Returns: 8150aadb33SDmitri Tikhonov * 0 Applied 8250aadb33SDmitri Tikhonov * 1 Not applicable 8350aadb33SDmitri Tikhonov * -1 Error 8450aadb33SDmitri Tikhonov */ 8550aadb33SDmitri Tikhonovint 8650aadb33SDmitri Tikhonovprog_set_opt (struct prog *, int opt, const char *arg); 8750aadb33SDmitri Tikhonov 8850aadb33SDmitri Tikhonovstruct event_base * 8950aadb33SDmitri Tikhonovprog_eb (struct prog *); 9050aadb33SDmitri Tikhonov 9150aadb33SDmitri Tikhonovint 9250aadb33SDmitri Tikhonovprog_run (struct prog *); 9350aadb33SDmitri Tikhonov 9450aadb33SDmitri Tikhonovvoid 9550aadb33SDmitri Tikhonovprog_cleanup (struct prog *); 9650aadb33SDmitri Tikhonov 9750aadb33SDmitri Tikhonovvoid 9850aadb33SDmitri Tikhonovprog_stop (struct prog *); 9950aadb33SDmitri Tikhonov 10050aadb33SDmitri Tikhonovint 10150aadb33SDmitri Tikhonovprog_prep (struct prog *); 10250aadb33SDmitri Tikhonov 10350aadb33SDmitri Tikhonovint 1048ca33e0eSDmitri Tikhonovprog_connect (struct prog *, unsigned char *, size_t); 10550aadb33SDmitri Tikhonov 10650aadb33SDmitri Tikhonovvoid 10750aadb33SDmitri Tikhonovprog_print_common_options (const struct prog *, FILE *); 10850aadb33SDmitri Tikhonov 10950aadb33SDmitri Tikhonovint 11050aadb33SDmitri Tikhonovprog_is_stopped (void); 11150aadb33SDmitri Tikhonov 112e8bd737dSDmitri Tikhonovvoid 113e8bd737dSDmitri Tikhonovprog_process_conns (struct prog *); 114e8bd737dSDmitri Tikhonov 115c44946ecSDmitri Tikhonovvoid 116c44946ecSDmitri Tikhonovprog_sport_cant_send (struct prog *, int fd); 117c44946ecSDmitri Tikhonov 11850aadb33SDmitri Tikhonov#endif 119