MCPcopy Create free account
hub / github.com/F-Stack/f-stack / object_search_ctlv

Function object_search_ctlv

tools/ipfw/ipfw2.c:5266–5282  ·  view source on GitHub ↗

* Finds object name in @ctlv by @idx and @type. * Uses the following facts: * 1) All TLVs are the same size * 2) Kernel implementation provides already sorted list. * * Returns table name or NULL. */

Source from the content-addressed store, hash-verified

5264 * Returns table name or NULL.
5265 */
5266static char *
5267object_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx, uint16_t type)
5268{
5269 ipfw_obj_ntlv *ntlv;
5270 struct object_kt key;
5271
5272 key.uidx = idx;
5273 key.type = type;
5274
5275 ntlv = bsearch(&key, (ctlv + 1), ctlv->count, ctlv->objsize,
5276 compare_object_kntlv);
5277
5278 if (ntlv != NULL)
5279 return (ntlv->name);
5280
5281 return (NULL);
5282}
5283
5284static char *
5285table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx)

Callers 4

print_instructionFunction · 0.85
print_action_instructionFunction · 0.85
show_dyn_stateFunction · 0.85
table_search_ctlvFunction · 0.85

Calls 1

bsearchFunction · 0.85

Tested by

no test coverage detected