FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Exports table @tc info into standard ipfw_xtable_info format.
 */
Exports table @tc info into standard ipfw_xtable_info format.
Exports table @tc info into standard ipfw_xtable_info format .
static void
export_table_info(struct ip_fw_chain *ch, struct table_config *tc,
    ipfw_xtable_info *i)
{
	struct table_info *ti;
	struct table_algo *ta;
	i->type = tc->no.subtype;
	i->tflags = tc->tflags;
	i->vmask = tc->vmask;
	i->set = tc->no.set;
	i->kidx = tc->no.kidx;
	i->refcnt = tc->no.refcnt;
	i->count = table_get_count(ch, tc);
	i->limit = tc->limit;
	i->flags |= (tc->locked != 0) ? IPFW_TGFLAGS_LOCKED : 0;
	i->size = i->count * sizeof(ipfw_obj_tentry);
	i->size += sizeof(ipfw_obj_header) + sizeof(ipfw_xtable_info);
	strlcpy(i->tablename, tc->tablename, sizeof(i->tablename));
	ti = KIDX_TO_TI(ch, tc->no.kidx);
	ta = tc->ta;
	if (ta->print_config != NULL) {
		ta->print_config(tc->astate, ti, i->algoname,
		    sizeof(i->algoname));
	} else
		strlcpy(i->algoname, ta->name, sizeof(i->algoname));
	if (ta->dump_tinfo != NULL) {
		ta->dump_tinfo(tc->astate, ti, &i->ta_info);
		i->ta_info.flags |= IPFW_TATFLAGS_DATA;
	}
}
static void export_table_info ( struct ip_fw_chain * ch , struct table_config * tc , ipfw_xtable_info * i ) { struct table_info * ti ; struct table_algo * ta ; i -> type = tc -> no . subtype ; i -> tflags = tc -> tflags ; i -> vmask = tc -> vmask ; i -> set = tc -> no . set ; i -> kidx = tc -> no . kidx ; i -> refcnt = tc -> no . refcnt ; i -> count = table_get_count ( ch , tc ) ; i -> limit = tc -> limit ; i -> flags |= ( tc -> locked != 0 ) ? IPFW_TGFLAGS_LOCKED : 0 ; i -> size = i -> count * sizeof ( ipfw_obj_tentry ) ; i -> size += sizeof ( ipfw_obj_header ) + sizeof ( ipfw_xtable_info ) ; strlcpy ( i -> tablename , tc -> tablename , sizeof ( i -> tablename ) ) ; ti = KIDX_TO_TI ( ch , tc -> no . kidx ) ; ta = tc -> ta ; if ( ta -> print_config != NULL ) { ta -> print_config ( tc -> astate , ti , i -> algoname , sizeof ( i -> algoname ) ) ; } else strlcpy ( i -> algoname , ta -> name , sizeof ( i -> algoname ) ) ; if ( ta -> dump_tinfo != NULL ) { ta -> dump_tinfo ( tc -> astate , ti , & i -> ta_info ) ; i -> ta_info . flags |= IPFW_TATFLAGS_DATA ; } }
Exports table @tc info into standard ipfw_xtable_info format.
Exports table @tc info into standard ipfw_xtable_info format .
/* Use algo function to print table config to string */ /* Dump algo-specific data, if possible */