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

Function nptv6_get_stats

tools/ipfw/nptv6.c:306–324  ·  view source on GitHub ↗

* Get NPTv6 instance statistics. * Request: [ ipfw_obj_header ] * Reply: [ ipfw_obj_header ipfw_obj_ctlv [ uint64_t x N ] ] */

Source from the content-addressed store, hash-verified

304 * Reply: [ ipfw_obj_header ipfw_obj_ctlv [ uint64_t x N ] ]
305 */
306static int
307nptv6_get_stats(const char *name, uint8_t set, struct ipfw_nptv6_stats *stats)
308{
309 ipfw_obj_header *oh;
310 ipfw_obj_ctlv *oc;
311 size_t sz;
312
313 sz = sizeof(*oh) + sizeof(*oc) + sizeof(*stats);
314 oh = calloc(1, sz);
315 nptv6_fill_ntlv(&oh->ntlv, name, set);
316 if (do_get3(IP_FW_NPTV6_STATS, &oh->opheader, &sz) == 0) {
317 oc = (ipfw_obj_ctlv *)(oh + 1);
318 memcpy(stats, oc + 1, sizeof(*stats));
319 free(oh);
320 return (0);
321 }
322 free(oh);
323 return (-1);
324}
325
326static void
327nptv6_stats(const char *name, uint8_t set)

Callers 1

nptv6_statsFunction · 0.85

Calls 5

callocFunction · 0.85
nptv6_fill_ntlvFunction · 0.85
do_get3Function · 0.85
memcpyFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected