Lines Matching refs:fo

407 static int ipfw_get_config(struct cmdline_opts *co, struct format_opts *fo,
409 static int ipfw_show_config(struct cmdline_opts *co, struct format_opts *fo,
1205 print_ip(struct buf_pr *bp, const struct format_opts *fo, in print_ip() argument
1221 t = table_search_ctlv(fo->tstate, in print_ip()
1232 t = table_search_ctlv(fo->tstate, in print_ip()
1467 print_instruction(struct buf_pr *bp, const struct format_opts *fo, in print_instruction() argument
1498 print_ip(bp, fo, insntod(cmd, ip)); in print_instruction()
1507 print_ip(bp, fo, insntod(cmd, ip)); in print_instruction()
1596 table_search_ctlv(fo->tstate, in print_instruction()
1605 s = table_search_ctlv(fo->tstate, cmd->arg1); in print_instruction()
1721 object_search_ctlv(fo->tstate, cmd->arg1, in print_instruction()
1731 object_search_ctlv(fo->tstate, cmd->arg1, in print_instruction()
1777 print_opcode(struct buf_pr *bp, struct format_opts *fo, in print_opcode() argument
1794 if (!print_instruction(bp, fo, state, cmd)) in print_opcode()
1830 print_action_instruction(struct buf_pr *bp, const struct format_opts *fo, in print_action_instruction() argument
1841 s = object_search_ctlv(fo->tstate, cmd->arg1, in print_action_instruction()
1938 s = object_search_ctlv(fo->tstate, cmd->arg1, in print_action_instruction()
1958 s = object_search_ctlv(fo->tstate, cmd->arg1, 0); in print_action_instruction()
1960 s = object_search_ctlv(fo->tstate, in print_action_instruction()
2010 print_action(struct buf_pr *bp, struct format_opts *fo, in print_action() argument
2021 if (!print_action_instruction(bp, fo, state, cmd)) in print_action()
2029 print_proto(struct buf_pr *bp, struct format_opts *fo, in print_proto() argument
2066 cmd = print_opcode(bp, fo, state, ip4 > ip6 ? O_IP4: O_IP6); in print_proto()
2068 cmd = print_opcode(bp, fo, state, ip4 > ip6 ? O_IP6: O_IP4); in print_proto()
2071 cmd = print_opcode(bp, fo, state, O_PROTO); in print_proto()
2093 print_address(struct buf_pr *bp, struct format_opts *fo, in print_address() argument
2114 print_instruction(bp, fo, state, cmd); in print_address()
2132 print_instruction(bp, fo, state, cmd); in print_address()
2163 show_static_rule(struct cmdline_opts *co, struct format_opts *fo, in show_static_rule() argument
2172 if ((fo->set_mask & (1 << rule->set)) == 0) { in show_static_rule()
2186 if (fo->pcwidth > 0 || fo->bcwidth > 0) { in show_static_rule()
2187 pr_u64(bp, &cntr->pcnt, fo->pcwidth); in show_static_rule()
2188 pr_u64(bp, &cntr->bcnt, fo->bcwidth); in show_static_rule()
2219 cmd = print_opcode(bp, fo, &state, O_PROB); in show_static_rule()
2222 cmd = print_action(bp, fo, &state, action_opcodes[i]); in show_static_rule()
2238 print_action(bp, fo, &state, modifier_opcodes[i]); in show_static_rule()
2250 print_proto(bp, fo, &state); in show_static_rule()
2256 print_address(bp, fo, &state, src_opcodes, nitems(src_opcodes), in show_static_rule()
2261 print_address(bp, fo, &state, dst_opcodes, nitems(dst_opcodes), in show_static_rule()
2266 while (print_opcode(bp, fo, &state, -1)) in show_static_rule()
2270 cmd = print_opcode(bp, fo, &state, O_NOP); in show_static_rule()
2278 show_dyn_state(struct cmdline_opts *co, struct format_opts *fo, in show_dyn_state() argument
2291 if (fo->pcwidth > 0 || fo->bcwidth > 0) { in show_dyn_state()
2293 pr_u64(bp, &d->pcnt, fo->pcwidth); in show_dyn_state()
2294 pr_u64(bp, &d->bcnt, fo->bcwidth); in show_dyn_state()
2328 bprintf(bp, " :%s", object_search_ctlv(fo->tstate, in show_dyn_state()
2402 struct format_opts fo; in ipfw_sets_handler() local
2405 memset(&fo, 0, sizeof(fo)); in ipfw_sets_handler()
2406 if (ipfw_get_config(&g_co, &fo, &cfg, &size) != 0) in ipfw_sets_handler()
2530 typedef void state_cb(struct cmdline_opts *co, struct format_opts *fo,
2534 prepare_format_dyn(struct cmdline_opts *co, struct format_opts *fo, in prepare_format_dyn() argument
2543 fo->dcnt++; in prepare_format_dyn()
2545 if (fo->show_counters == 0) in prepare_format_dyn()
2557 if (width > fo->pcwidth) in prepare_format_dyn()
2558 fo->pcwidth = width; in prepare_format_dyn()
2561 if (width > fo->bcwidth) in prepare_format_dyn()
2562 fo->bcwidth = width; in prepare_format_dyn()
2566 foreach_state(struct cmdline_opts *co, struct format_opts *fo, in foreach_state() argument
2597 fptr(co, fo, farg, tlv + 1); in foreach_state()
2607 prepare_format_opts(struct cmdline_opts *co, struct format_opts *fo, in prepare_format_opts() argument
2617 if (fo->show_counters != 0) { in prepare_format_opts()
2637 fo->bcwidth = bcwidth; in prepare_format_opts()
2638 fo->pcwidth = pcwidth; in prepare_format_opts()
2640 fo->dcnt = 0; in prepare_format_opts()
2642 foreach_state(co, fo, dynbase, dynsz, prepare_format_dyn, NULL); in prepare_format_opts()
2646 list_static_range(struct cmdline_opts *co, struct format_opts *fo, in list_static_range() argument
2657 if ((fo->show_counters | fo->show_time) != 0) { in list_static_range()
2664 if (r->rulenum > fo->last) in list_static_range()
2668 if (r->rulenum >= fo->first && r->rulenum <= fo->last) { in list_static_range()
2669 show_static_rule(co, fo, bp, r, cntr); in list_static_range()
2681 list_dyn_state(struct cmdline_opts *co, struct format_opts *fo, in list_dyn_state() argument
2693 if (rulenum > fo->last) in list_dyn_state()
2701 if (rulenum >= fo->first) { in list_dyn_state()
2702 show_dyn_state(co, fo, bp, d); in list_dyn_state()
2709 list_dyn_range(struct cmdline_opts *co, struct format_opts *fo, in list_dyn_range() argument
2713 sz = foreach_state(co, fo, base, sz, list_dyn_state, bp); in list_dyn_range()
2782 ipfw_show_config(struct cmdline_opts *co, struct format_opts *fo, in ipfw_show_config() argument
2807 fo->set_mask = cfg->set_mask; in ipfw_show_config()
2812 fo->tstate = ctlv; in ipfw_show_config()
2838 prepare_format_opts(co, fo, rbase, rcnt, dynbase, dynsz); in ipfw_show_config()
2843 fo->first = 0; in ipfw_show_config()
2844 fo->last = IPFW_DEFAULT_RULE; in ipfw_show_config()
2846 list_static_range(co, fo, &bp, rbase, rcnt); in ipfw_show_config()
2849 printf("## Dynamic rules (%d %zu):\n", fo->dcnt, in ipfw_show_config()
2851 list_dyn_range(co, fo, &bp, dynbase, dynsz); in ipfw_show_config()
2861 fo->last = fo->first = strtoul(*lav++, &endptr, 10); in ipfw_show_config()
2863 fo->last = strtoul(endptr + 1, &endptr, 10); in ipfw_show_config()
2873 if (list_static_range(co, fo, &bp, rbase, rcnt) == 0) { in ipfw_show_config()
2877 if (fo->first == fo->last) in ipfw_show_config()
2878 warnx("rule %u does not exist", fo->first); in ipfw_show_config()
2881 fo->first, fo->last); in ipfw_show_config()
2888 fo->last = fo->first = strtoul(*lav++, &endptr, 10); in ipfw_show_config()
2890 fo->last = strtoul(endptr+1, &endptr, 10); in ipfw_show_config()
2894 list_dyn_range(co, fo, &bp, dynbase, dynsz); in ipfw_show_config()
2913 ipfw_get_config(struct cmdline_opts *co, struct format_opts *fo, in ipfw_get_config() argument
2936 cfg->flags = fo->flags; in ipfw_get_config()
2937 cfg->start_rule = fo->first; in ipfw_get_config()
2938 cfg->end_rule = fo->last; in ipfw_get_config()