* generic list routine. We expect objects in a specific order, i.e. * PIPES AND SCHEDULERS: * link; scheduler; internal flowset if any; instances * we can tell a pipe from the number. * * FLOWSETS: * flowset; queues; * link i (int queue); scheduler i; si(i) { flowsets() : queues } */
| 552 | * link i (int queue); scheduler i; si(i) { flowsets() : queues } |
| 553 | */ |
| 554 | static void |
| 555 | list_pipes(struct dn_id *oid, struct dn_id *end) |
| 556 | { |
| 557 | char buf[160]; /* pending buffer */ |
| 558 | int toPrint = 1; /* print header */ |
| 559 | struct buf_pr bp; |
| 560 | |
| 561 | buf[0] = '\0'; |
| 562 | bp_alloc(&bp, 4096); |
| 563 | for (; oid != end; oid = O_NEXT(oid, oid->len)) { |
| 564 | if (oid->len < sizeof(*oid)) |
| 565 | errx(1, "invalid oid len %d\n", oid->len); |
| 566 | |
| 567 | switch (oid->type) { |
| 568 | default: |
| 569 | flush_buf(buf); |
| 570 | printf("unrecognized object %d size %d\n", oid->type, oid->len); |
| 571 | break; |
| 572 | case DN_TEXT: /* list of attached flowsets */ |
| 573 | { |
| 574 | int i, l; |
| 575 | struct { |
| 576 | struct dn_id id; |
| 577 | uint32_t p[0]; |
| 578 | } *d = (void *)oid; |
| 579 | l = (oid->len - sizeof(*oid))/sizeof(d->p[0]); |
| 580 | if (l == 0) |
| 581 | break; |
| 582 | printf(" Children flowsets: "); |
| 583 | for (i = 0; i < l; i++) |
| 584 | printf("%u ", d->p[i]); |
| 585 | printf("\n"); |
| 586 | break; |
| 587 | } |
| 588 | case DN_CMD_GET: |
| 589 | if (g_co.verbose) |
| 590 | printf("answer for cmd %d, len %d\n", oid->type, oid->id); |
| 591 | break; |
| 592 | case DN_SCH: { |
| 593 | struct dn_sch *s = (struct dn_sch *)oid; |
| 594 | flush_buf(buf); |
| 595 | printf(" sched %d type %s flags 0x%x %d buckets %d active\n", |
| 596 | s->sched_nr, |
| 597 | s->name, s->flags, s->buckets, s->oid.id); |
| 598 | #ifdef NEW_AQM |
| 599 | char parms[200]; |
| 600 | get_extra_parms(s->sched_nr, parms, DN_SCH_PARAMS); |
| 601 | printf("%s",parms); |
| 602 | #endif |
| 603 | if (s->flags & DN_HAVE_MASK) |
| 604 | print_mask(&s->sched_mask); |
| 605 | } |
| 606 | break; |
| 607 | |
| 608 | case DN_FLOW: |
| 609 | if (toPrint != 0) { |
| 610 | print_header(&((struct dn_flow *)oid)->fid); |
| 611 | toPrint = 0; |
no test coverage detected