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

Function nat64clat_get_stats

tools/ipfw/nat64clat.c:372–391  ·  view source on GitHub ↗

* Get nat64clat 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

370 * Reply: [ ipfw_obj_header ipfw_obj_ctlv [ uint64_t x N ] ]
371 */
372static int
373nat64clat_get_stats(const char *name, uint8_t set,
374 struct ipfw_nat64clat_stats *stats)
375{
376 ipfw_obj_header *oh;
377 ipfw_obj_ctlv *oc;
378 size_t sz;
379
380 sz = sizeof(*oh) + sizeof(*oc) + sizeof(*stats);
381 oh = calloc(1, sz);
382 nat64clat_fill_ntlv(&oh->ntlv, name, set);
383 if (do_get3(IP_FW_NAT64CLAT_STATS, &oh->opheader, &sz) == 0) {
384 oc = (ipfw_obj_ctlv *)(oh + 1);
385 memcpy(stats, oc + 1, sizeof(*stats));
386 free(oh);
387 return (0);
388 }
389 free(oh);
390 return (-1);
391}
392
393static void
394nat64clat_stats(const char *name, uint8_t set)

Callers 1

nat64clat_statsFunction · 0.85

Calls 5

callocFunction · 0.85
nat64clat_fill_ntlvFunction · 0.85
do_get3Function · 0.85
memcpyFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected