ping_iterator_get_context(3)
π ping_iterator_get_context(3) β the liboping page where you stash ur lil per-host secrets π
okay bestie so this is a liboping page, manual section 3, and it's about two lil functions that are basically a locker for your own stuff. like, liboping has all these host objects floating around and it's like "here, keep ur personal data in here, i won't look, i prommy" π«Ά
πΈ NAME πΈ
ping_iterator_get_context, ping_iterator_set_context β store host-dependent data
it's giving "put ur stuff somewhere safe and get it back later", no cap π
β¨ SYNOPSIS β¨
#include <oping.h>
void *ping_iterator_get_context (pingobj_iter_t *iter);
void ping_iterator_set_context (pingobj_iter_t *iter, void *context);
π¦ DESCRIPTION π¦
so ping_iterator_set_context is the one where you're like "hey liboping, hold this for me" β it lets you store host-specific data inside the liboping structures themselves. and then ping_iterator_get_context is the "okay give it back" function. you hand over a pointer, you get the pointer back. that's the whole vibe π
and here's the iconic part: the data itself is never touched by liboping. not once. not ever. it just holds the pointer and minds its own business. main character energy fr fr β¨
β οΈ okay but listen β this is the part where you gotta pay attention, bestie. if you callping_host_remove(peepping_host_add(3)) orping_destroy(peepping_construct(3)) and the context is notNULL, liboping will just assume you know what you're doing and simply ignore the fact this might be a memory leak. it will not warn you. it will not clean up. it will not save you. it's your pointer, your problem π so likeβ¦ handle ur own cleanup, okay? don't be out here leaking.
the iter argument is an iterator object as returned by ping_iterator_get(3) and ping_iterator_next. yk, the lil cursor that walks through ur hosts one at a time πΆβοΈ
the context argument of ping_iterator_set_context is a pointer to literally anything β anything at all β and it may be NULL. NULL is valid. NULL is fine. NULL is a mood π
π RETURN VALUE π
ping_iterator_get_context returns the same pointer you previously passed to ping_iterator_set_context β same one, untouched, exactly as you left it π«Ά
or NULL if ping_iterator_set_context has never been called before. that's the "you never gave me anything so i got nothing for you" case. fair honestly π
π SEE ALSO π
go read those too, bestie, they're the whole friend group πΈ
π AUTHOR π
liboping is written by Florian "octo" Forster <ff at octo.it>. its homepage can be found at <http://noping.cc/> β iconic, legendary, we stan π§
Copyright (c) 2006-2017 by Florian "octo" Forster. yes that's a whole eleven years of copyright, respect the grind π₯
okay that's the page, bestie!! this is liboping 1.10.0, dated 2017-05-11, and honestly? storing pointers in iterators and pretending the leak isn't there is so real of it. go forth and ping_iterator_set_context responsibly, mwah πβ¨π
π¦ where this page comes from
- alpine 3.24: liboping-doc 1.10.0-r2 Β· LGPL-2.0-or-later
- epel 10: liboping-devel 1.10.0-33.el10_0 Β· GPL-2.0-only
- epel 9: liboping-devel 1.10.0-19.el9 Β· GPLv2
- fedora 43: liboping-devel 1.10.0-35.fc43 Β· GPL-2.0-only
- fedora 43: liboping-devel 1.10.0-35.fc43 Β· GPL-2.0-only
- fedora 44: liboping-devel 1.10.0-36.fc44 Β· GPL-2.0-only
- fedora 44: liboping-devel 1.10.0-36.fc44 Β· GPL-2.0-only
- nixos 26.05: liboping 1.10.0
- nixpkgs unstable: liboping 1.10.0
- opensuse-leap 16.0: liboping-devel 1.10.0-bp160.1.14 Β· LGPL-2.1-only
- opensuse-leap 16.0: liboping-devel 1.10.0-bp160.1.14 Β· LGPL-2.1-only
- opensuse-leap 16.0: liboping-devel 1.10.0-bp160.1.14 Β· LGPL-2.1-only
- opensuse-leap 16.0: liboping-devel 1.10.0-bp160.1.14 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms