liboping(3)

πŸ“¦
version 1.10.0 Β· 8 versions
, in alpine 3.24, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– liboping β€” the manual page, but make it make sense πŸ’–

okay bestie, gather round, because we're talking about liboping(3) β€” the C library that lets you yeet ICMP ECHO_REQUEST packets at a whole squad of hosts and time how long the replies take to come back. it's ping, but as a library. you're gonna slay. ✨


🌈 DESCRIPTION

so here's the vibe: this is the overview of liboping, a C library that sends ICMP ECHO_REQUEST packets to remote hosts and measures how long it takes for the replies to show up. this method is often just called "ping", and it's the classic way to measure network latency and/or whether a host is even reachable. fr fr, it's the og vibe check for a server.

the goals of this library are to give you all that functionality in a platform and protocol independent way. the interface is simple, object oriented, and (hopefully) ANSI-C compliant. we love a portable queen. πŸ‘‘


🫢 GENERAL USAGE

there are two main types that applications use. both are "opaque types", meaning they're structures that are not completely defined in the header file β€” so you cannot access the structures' members. you don't need to. don't do it. πŸ™ˆ these structures are subject to change without notice.

  • pingobj_t β€” a ping-object. you can set specific options for this object, add and remove hosts to/from it, and send ICMP packets to all associated hosts. this is often called a "handle". it's giving main character energy.
  • pingobj_iter_t β€” an iterator over the hosts associated with a pingobj_t object. you use this iterator to query more info about a host β€” like the hostname, the measured latency, or the current ICMP sequence. iconic.

upon startup you usually create one or more pingobj_t objects and add hosts to it using the ping_host_add method (see below, bestie, it's all connected πŸ’…). you periodically send "echo requests" using the ping_send method, then iterate over all hosts using ping_iterator_get and ping_iterator_next. for each host you call ping_iterator_get_info to read the current latency and do something with it. that's the whole loop, and it ate. πŸ”₯

if an error occurs you can use ping_get_error to get information on what failed. so when it's not working, you actually know why. not me being emotional support for your segfault. 😭


πŸ”— LINKING WITH LIBOPING

depending on your platform you don't need any extra libraries (e.g. GNU/Linux) β€” or you need libsocket (by using -lsocket) if the socket function is not in the C-library. the latter is the case for the Solaris operating system. so like, Solaris girlies, link accordingly. periodt.


⭐ SYMBOL NAMES

all "official" function or method names are prefixed with ping_. don't use any other functions or methods. although no such functions should exist. so like... there's nothing else to use anyway. mystery solved. πŸ¦‹


πŸ’œ THREAD SAFETY

liboping has been designed to be as thread safe as possible. however, this has not been tested and may need some additional work. so use at your own risk, and please report back any problems or success messages. thank you :) 🫢

bestie. i cannot stress this enough. not tested. tread carefully and text me how it goes. πŸ’€

πŸ‘€ SEE ALSO


πŸŽ€ LICENSE

liboping is licensed under the LGPL 2.1 or later.


πŸ‘‘ AUTHOR

liboping is written by Florian "octo" Forster <ff at octo.it>. its homepage can be found at <http://noping.cc/>. go give it a look, bestie, show some love. 🌸

Copyright (c) 2006-2017 by Florian "octo" Forster.


and that's the whole thing, no cap. this was liboping version 1.10.0, dated 2017-05-11 β€” a true classic, an icon, a legend, and honestly the moment. go ping something. πŸ’–βœ¨