FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Export all tables as ipfw_xtable_info structures to
 * storage provided by @sd.
 *
 * If supplied buffer is too small, fills in required size
 * and returns ENOMEM.
 * Returns 0 on success.
 */
Export all tables as ipfw_xtable_info structures to
storage provided by @sd.

If supplied buffer is too small, fills in required size
and returns ENOMEM.
Returns 0 on success.
Export all tables as ipfw_xtable_info structures to storage provided by @sd . If supplied buffer is too small fills in required size and returns ENOMEM . Returns 0 on success .
static int
export_tables(struct ip_fw_chain *ch, ipfw_obj_lheader *olh,
    struct sockopt_data *sd)
{
	uint32_t size;
	uint32_t count;
	struct dump_table_args dta;
	count = ipfw_objhash_count(CHAIN_TO_NI(ch));
	size = count * sizeof(ipfw_xtable_info) + sizeof(ipfw_obj_lheader);
	olh->count = count;
	olh->objsize = sizeof(ipfw_xtable_info);
	if (size > olh->size) {
		olh->size = size;
		return (ENOMEM);
	}
	olh->size = size;
	dta.ch = ch;
	dta.sd = sd;
	ipfw_objhash_foreach(CHAIN_TO_NI(ch), export_table_internal, &dta);
	return (0);
}
static int export_tables ( struct ip_fw_chain * ch , ipfw_obj_lheader * olh , struct sockopt_data * sd ) { uint32_t size ; uint32_t count ; struct dump_table_args dta ; count = ipfw_objhash_count ( CHAIN_TO_NI ( ch ) ) ; size = count * sizeof ( ipfw_xtable_info ) + sizeof ( ipfw_obj_lheader ) ; olh -> count = count ; olh -> objsize = sizeof ( ipfw_xtable_info ) ; if ( size > olh -> size ) { olh -> size = size ; return ( ENOMEM ) ; } olh -> size = size ; dta . ch = ch ; dta . sd = sd ; ipfw_objhash_foreach ( CHAIN_TO_NI ( ch ) , export_table_internal , & dta ) ; return ( 0 ) ; }
Export all tables as ipfw_xtable_info structures to
 storage provided by @sd.
Export all tables as ipfw_xtable_info structures to storage provided by @sd .
/* Fill in header regadless of buffer size */