| 236 | } |
| 237 | |
| 238 | void |
| 239 | parse_callbacks(int argc, const char *argv[], int &preaccept_count, int &client_hello_count, int &client_hello_count_immediate, |
| 240 | int &sni_count, int &cert_count, int &cert_count_immediate, int &preaccept_count_delay, int &close_count, |
| 241 | int &out_start_count, int &out_start_delay_count, int &out_close_count) |
| 242 | { |
| 243 | int i = 0; |
| 244 | const char *ptr; |
| 245 | for (i = 0; i < argc; i++) { |
| 246 | if (argv[i][0] == '-') { |
| 247 | switch (argv[i][1]) { |
| 248 | case 'p': |
| 249 | ptr = index(argv[i], '='); |
| 250 | if (ptr) { |
| 251 | preaccept_count = atoi(ptr + 1); |
| 252 | } |
| 253 | break; |
| 254 | case 's': |
| 255 | ptr = index(argv[i], '='); |
| 256 | if (ptr) { |
| 257 | sni_count = atoi(ptr + 1); |
| 258 | } |
| 259 | break; |
| 260 | case 'c': |
| 261 | ptr = index(argv[i], '='); |
| 262 | if (ptr) { |
| 263 | if (strncmp(argv[i] + 1, "close", strlen("close")) == 0) { |
| 264 | close_count = atoi(ptr + 1); |
| 265 | } else if (strncmp(argv[i] + 1, "client_hello_imm", strlen("client_hello_imm")) == 0) { |
| 266 | client_hello_count_immediate = atoi(ptr + 1); |
| 267 | } else if (strncmp(argv[i] + 1, "client_hello", strlen("client_hello")) == 0) { |
| 268 | client_hello_count = atoi(ptr + 1); |
| 269 | } else { |
| 270 | cert_count = atoi(ptr + 1); |
| 271 | } |
| 272 | } |
| 273 | break; |
| 274 | case 'd': |
| 275 | ptr = index(argv[i], '='); |
| 276 | if (ptr) { |
| 277 | preaccept_count_delay = atoi(ptr + 1); |
| 278 | } |
| 279 | break; |
| 280 | case 'i': |
| 281 | ptr = index(argv[i], '='); |
| 282 | if (ptr) { |
| 283 | cert_count_immediate = atoi(ptr + 1); |
| 284 | } |
| 285 | break; |
| 286 | case 'o': |
| 287 | ptr = index(argv[i], '='); |
| 288 | if (ptr) { |
| 289 | if (strncmp(argv[i] + 1, "out_start_delay", strlen("out_start_delay")) == 0) { |
| 290 | out_start_delay_count = atoi(ptr + 1); |
| 291 | } else if (strncmp(argv[i] + 1, "out_start", strlen("out_start")) == 0) { |
| 292 | out_start_count = atoi(ptr + 1); |
| 293 | } else if (strncmp(argv[i] + 1, "out_close", strlen("out_close")) == 0) { |
| 294 | out_close_count = atoi(ptr + 1); |
| 295 | } |