Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/pico_sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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},
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down