MCPcopy Create free account
hub / github.com/F-Stack/f-stack / init

Function init

freebsd/netpfil/ipfw/test/main.c:433–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431#endif
432
433static int
434init(struct cfg_s *c)
435{
436 int i;
437 int ac = c->ac;
438 char * const *av = c->av;
439
440 c->si_len = sizeof(struct dn_sch_inst);
441 c->q_len = sizeof(struct dn_queue);
442 moduledata_t *mod = NULL;
443 struct dn_alg *p = NULL;
444
445 c->th_min = -1; /* 1 packet per flow */
446 c->th_max = -20;/* 20 packets per flow */
447 c->lmin = c->lmax = 1280; /* packet len */
448 c->flows = 1;
449 c->flowsets = 1;
450 c->name = "null";
451 ac--; av++;
452 while (ac > 1) {
453 if (!strcmp(*av, "-n")) {
454 c->loops = getnum(av[1], NULL, av[0]);
455 } else if (!strcmp(*av, "-d")) {
456 debug = atoi(av[1]);
457 } else if (!strcmp(*av, "-alg")) {
458 if (!strcmp(av[1], "rr"))
459 mod = _g_dn_rr;
460 else if (!strcmp(av[1], "wf2qp"))
461 mod = _g_dn_wf2qp;
462 else if (!strcmp(av[1], "fifo"))
463 mod = _g_dn_fifo;
464 else if (!strcmp(av[1], "qfq"))
465 mod = _g_dn_qfq;
466#ifdef WITH_QFQP
467 else if (!strcmp(av[1], "qfq+") ||
468 !strcmp(av[1], "qfqp") )
469 mod = _g_dn_qfqp;
470#endif
471#ifdef WITH_KPS
472 else if (!strcmp(av[1], "kps"))
473 mod = _g_dn_kps;
474#endif
475 else
476 mod = NULL;
477 c->name = mod ? mod->name : "NULL";
478 DX(3, "using scheduler %s", c->name);
479 } else if (!strcmp(*av, "-len")) {
480 c->lmin = getnum(av[1], NULL, av[0]);
481 c->lmax = c->lmin;
482 DX(3, "setting max to %d", c->th_max);
483#ifdef USE_BURST
484 } else if (!strcmp(*av, "-burst")) {
485 c->maxburst = getnum(av[1], NULL, av[0]);
486 DX(3, "setting max to %d", c->th_max);
487#endif /* USE_BURST */
488 } else if (!strcmp(*av, "-qmax")) {
489 c->th_max = getnum(av[1], NULL, av[0]);
490 DX(3, "setting max to %d", c->th_max);

Callers 4

mainFunction · 0.70

Calls 6

strcmpFunction · 0.85
parse_flowsetsFunction · 0.85
callocFunction · 0.85
INIT_LIST_HEADFunction · 0.85
getnumFunction · 0.70
list_add_tailFunction · 0.70

Tested by

no test coverage detected