void st_calc_begin(pst_calc calc, int pack /*= 0*/) { st_init(); if (calc){ calc->pack = 0; calc->offset = 0; calc->size = 0; calc->nosizearray = 0; if (pack > 0 && 1 == bitcount32(pack)) calc->pack = pack; else calc->pack = st_pack_default; } }
static int dump_table_xentry_extended(struct radix_node *rn, void *arg) { struct table_xentry * const n = (struct table_xentry *)rn; ipfw_xtable * const tbl = arg; ipfw_table_xentry *xent; #ifdef INET6 int i; uint32_t *v; #endif /* Out of memory, returning */ if (tbl->cnt == tbl->size) return (1); xent = &tbl->xent[tbl->cnt]; xent->len = sizeof(ipfw_table_xentry); xent->tbl = tbl->tbl; switch (tbl->type) { #ifdef INET6 case IPFW_TABLE_CIDR: /* Count IPv6 mask */ v = (uint32_t *)&n->m.mask6.sin6_addr; for (i = 0; i < sizeof(struct in6_addr) / 4; i++, v++) xent->masklen += bitcount32(*v); memcpy(&xent->k, &n->a.addr6.sin6_addr, sizeof(struct in6_addr)); break; #endif case IPFW_TABLE_INTERFACE: /* Assume exact mask */ xent->masklen = 8 * IF_NAMESIZE; memcpy(&xent->k, &n->a.iface.ifname, IF_NAMESIZE); break; default: /* unknown, skip entry */ return (0); } xent->value = n->value; tbl->cnt++; return (0); }