From adb8cda780ffe673b29b012643083818b85e7425 Mon Sep 17 00:00:00 2001 From: "hfst.co" <39383536+hfstco@users.noreply.github.com> Date: Mon, 17 Mar 2025 14:56:28 +0100 Subject: [PATCH] enables to parse hystart algo --- src/pico_sim.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/pico_sim.c b/src/pico_sim.c index d96349c..1ae6085 100644 --- a/src/pico_sim.c +++ b/src/pico_sim.c @@ -95,7 +95,9 @@ typedef enum { e_main_scenario_text, e_background_scenario_text, e_main_cc_algo, + e_main_hystart_algo, e_background_cc_algo, + e_background_hystart_algo, e_nb_connections, e_main_target_time, e_data_rate_in_gbps, @@ -121,7 +123,9 @@ spec_param_t params[] = { { e_main_scenario_text, "main_scenario_text", 18 }, { e_background_scenario_text, "background_scenario_text", 24 }, { e_main_cc_algo, "main_cc_algo", 12 }, + { e_main_hystart_algo, "main_hystart_algo", 17 }, { e_background_cc_algo, "background_cc_algo", 18 }, + { e_background_hystart_algo, "background_hystart_algo", 23 }, { e_nb_connections, "nb_connections", 14 }, { e_data_rate_in_gbps, "data_rate_in_gbps", 17 }, { e_latency, "latency" , 7}, @@ -182,6 +186,7 @@ int parse_u64(uint64_t* x, char const* val); int parse_int(int* x, char const* val); int parse_double(double* x, char const* val); int parse_cc_algo(picoquic_congestion_algorithm_t** x, char const* val); +int parse_hystart_algo(picoquic_hystart_alg_t* x, char const* val); int parse_cid(picoquic_connection_id_t* x, char const* val); int parse_text(char const** x, char const* val); int parse_file_name(char const** x, char const* val); @@ -222,9 +227,15 @@ int parse_param(picoquic_ns_spec_t* spec, spec_param_enum p_e, char const* line) case e_main_cc_algo: ret = parse_cc_algo(&spec->main_cc_algo, line); break; + case e_main_hystart_algo: + ret = parse_hystart_algo(&spec->main_hystart_algo, line); + break; case e_background_cc_algo: ret = parse_cc_algo(&spec->background_cc_algo, line); break; + case e_background_hystart_algo: + ret = parse_hystart_algo(&spec->background_hystart_algo, line); + break; case e_nb_connections: ret = parse_int(&spec->nb_connections, line); break; @@ -360,6 +371,24 @@ int parse_cc_algo(picoquic_congestion_algorithm_t** x, char const* val) return ret; } +int parse_hystart_algo(picoquic_hystart_alg_t* x, char const* val) +{ + int ret = 0; + if (strcmp(val, "hystart") == 0) { + *x = picoquic_hystart_alg_hystart_t; + } + else if (strcmp(val, "hystart++") == 0) { + *x = picoquic_hystart_alg_hystart_pp_t; + } + else if (strcmp(val, "disabled") == 0) { + *x = picoquic_hystart_alg_disabled_t; + } + else { + ret = -1; + } + return ret; +} + static int hexdigit(char v) { int y = -1;