Lines Matching refs:opt

162 } opt;
181 opt.server_addr = DFL_SERVER_ADDR;
182 opt.server_port = DFL_SERVER_PORT;
183 opt.listen_addr = DFL_LISTEN_ADDR;
184 opt.listen_port = DFL_LISTEN_PORT;
185 opt.pack = DFL_PACK;
188 opt.delay_cli_cnt = 0;
189 opt.delay_srv_cnt = 0;
190 memset(opt.delay_cli, 0, sizeof(opt.delay_cli));
191 memset(opt.delay_srv, 0, sizeof(opt.delay_srv));
201 opt.server_addr = q;
203 opt.server_port = q;
205 opt.listen_addr = q;
207 opt.listen_port = q;
209 opt.duplicate = atoi(q);
210 if (opt.duplicate < 0 || opt.duplicate > 20) {
214 opt.delay = atoi(q);
215 if (opt.delay < 0 || opt.delay > 20 || opt.delay == 1) {
219 opt.delay_ccs = atoi(q);
220 if (opt.delay_ccs < 0 || opt.delay_ccs > 1) {
231 delay_cnt = &opt.delay_cli_cnt;
232 delay_list = opt.delay_cli;
234 delay_cnt = &opt.delay_srv_cnt;
235 delay_list = opt.delay_srv;
254 opt.drop = atoi(q);
255 if (opt.drop < 0 || opt.drop > 20 || opt.drop == 1) {
260 opt.pack = (unsigned) atoi(q);
266 opt.mtu = atoi(q);
267 if (opt.mtu < 0 || opt.mtu > MAX_MSG_SIZE) {
271 opt.bad_ad = atoi(q);
272 if (opt.bad_ad < 0 || opt.bad_ad > 1) {
278 opt.bad_cid = (unsigned) atoi(q);
282 opt.protect_hvr = atoi(q);
283 if (opt.protect_hvr < 0 || opt.protect_hvr > 1) {
287 opt.protect_len = atoi(q);
288 if (opt.protect_len < 0) {
292 opt.inject_clihlo = atoi(q);
293 if (opt.inject_clihlo < 0 || opt.inject_clihlo > 1) {
297 opt.seed = atoi(q);
298 if (opt.seed == 0) {
407 if (cur_time - buf->packet_lifetime >= opt.pack) {
411 return opt.pack - (cur_time - buf->packet_lifetime);
455 if (opt.pack > 0) {
536 if (opt.inject_clihlo != 0 &&
544 if (opt.bad_cid != 0 &&
546 (rand() % opt.bad_cid) == 0) {
561 if (opt.bad_ad &&
586 if (opt.duplicate != 0 &&
588 rand() % opt.duplicate == 0) {
598 if (opt.inject_clihlo != 0 &&
693 delay_list = opt.delay_cli;
694 delay_list_len = opt.delay_cli_cnt;
696 delay_list = opt.delay_srv;
697 delay_list_len = opt.delay_srv_cnt;
720 if ((opt.mtu != 0 &&
721 cur.len > (unsigned) opt.mtu) ||
722 (opt.drop != 0 &&
725 !(opt.protect_hvr &&
727 cur.len != (size_t) opt.protect_len &&
729 rand() % opt.drop == 0)) {
731 } else if ((opt.delay_ccs == 1 &&
733 (opt.delay != 0 &&
736 !(opt.protect_hvr &&
738 cur.len != (size_t) opt.protect_len &&
740 rand() % opt.delay == 0)) {
790 if (opt.seed == 0) {
792 opt.seed = (unsigned int) mbedtls_time(NULL);
794 opt.seed = 1;
796 mbedtls_printf(" . Pseudo-random seed: %u\n", opt.seed);
799 srand(opt.seed);
805 opt.server_addr, opt.server_port);
808 if ((ret = mbedtls_net_connect(&server_fd, opt.server_addr, opt.server_port,
820 opt.listen_addr, opt.listen_port);
823 if ((ret = mbedtls_net_bind(&listen_fd, opt.listen_addr, opt.listen_port,
864 if (opt.pack > 0) {
879 if (opt.pack > 0) {
955 mbedtls_free(opt.delay_cli[delay_idx]);
956 mbedtls_free(opt.delay_srv[delay_idx]);