FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Exports basic table info as name TLV.
 * Used inside dump_static_rules() to provide info
 * about all tables referenced by current ruleset.
 *
 * Returns 0 on success.
 */
Exports basic table info as name TLV.
Used inside dump_static_rules() to provide info
about all tables referenced by current ruleset.

Returns 0 on success.
Exports basic table info as name TLV . Used inside dump_static_rules () to provide info about all tables referenced by current ruleset . Returns 0 on success .
int
ipfw_export_table_ntlv(struct ip_fw_chain *ch, uint16_t kidx,
    struct sockopt_data *sd)
{
	struct namedobj_instance *ni;
	struct named_object *no;
	ipfw_obj_ntlv *ntlv;
	ni = CHAIN_TO_NI(ch);
	no = ipfw_objhash_lookup_kidx(ni, kidx);
	KASSERT(no != NULL, ("invalid table kidx passed"));
	ntlv = (ipfw_obj_ntlv *)ipfw_get_sopt_space(sd, sizeof(*ntlv));
	if (ntlv == NULL)
		return (ENOMEM);
	ntlv->head.type = IPFW_TLV_TBL_NAME;
	ntlv->head.length = sizeof(*ntlv);
	ntlv->idx = no->kidx;
	strlcpy(ntlv->name, no->name, sizeof(ntlv->name));
	return (0);
}
int ipfw_export_table_ntlv ( struct ip_fw_chain * ch , uint16_t kidx , struct sockopt_data * sd ) { struct namedobj_instance * ni ; struct named_object * no ; ipfw_obj_ntlv * ntlv ; ni = CHAIN_TO_NI ( ch ) ; no = ipfw_objhash_lookup_kidx ( ni , kidx ) ; KASSERT ( no != NULL , ( " " ) ) ; ntlv = ( ipfw_obj_ntlv * ) ipfw_get_sopt_space ( sd , sizeof ( * ntlv ) ) ; if ( ntlv == NULL ) return ( ENOMEM ) ; ntlv -> head . type = IPFW_TLV_TBL_NAME ; ntlv -> head . length = sizeof ( * ntlv ) ; ntlv -> idx = no -> kidx ; strlcpy ( ntlv -> name , no -> name , sizeof ( ntlv -> name ) ) ; return ( 0 ) ; }
Exports basic table info as name TLV.
Exports basic table info as name TLV .