libssh2_knownhost_get(3)

πŸ“¦
version 1.11.1 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– libssh2_knownhost_get β€” get a known host off the collection of known hosts πŸ’–

okay bestie, welcome to the libssh2_knownhost_get(3) page β€” this is the part of the libssh2 manual where we learn how to walk through your whole known-hosts collection one lil entry at a time. it's giving loop energy. let's get into it πŸ¦‹


✨ SYNOPSIS ✨

#include <libssh2.h>

int
libssh2_knownhost_get(LIBSSH2_KNOWNHOSTS *hosts,
                      struct libssh2_knownhost **store,
                      struct libssh2_knownhost *prev):

🌸 DESCRIPTION 🌸

so libssh2_knownhost_get(3) lets your application iterate over all known hosts in the collection. like, one at a time, no cap. it's the lil cursor that walks the whole list for you πŸšΆβ™€οΈβœ¨

  • store should point to a pointer that gets filled in to point to the known host data. so it's a pointer-to-a-pointer, yes, we know, it's a lot, but she's doing her job πŸ’…
  • prev is a pointer to a previous struct libssh2_knownhost as returned by a previous invoke of this function, or NULL to get the first entry in the internal collection. so: pass NULL first, then keep feeding back what you got, and you'll glide through the whole thing 🌈
fr fr, that prev value has to come from a previous invoke of this function β€” that's how she knows where she left off. iykyk.

πŸ‘‘ RETURN VALUE πŸ‘‘

  • Returns 0 if everything is fine and information about a host was stored in the store struct. slay. πŸŽ€
  • Returns 1 if it reached the end of hosts. that's your cue that the collection is done, bestie, not an error. πŸ’€
  • Returns negative values for error. yeah. negative = something went sideways. 😭

πŸ¦‹ AVAILABILITY πŸ¦‹

Added in libssh2 1.2. so she's been iconic since way back ⭐


🫢 SEE ALSO 🫢


libssh2 Β· 28 May 2009 β€” that's the source/version and the date, babes, signing off πŸ’– go iterate over your hosts, you main character, periodt ✨🌸