libssh2_session_method_pref(3)
π libssh2_session_method_pref β the libssh2 manual, but make it make sense π
okay bestie, welcome to the libssh2 manual page for libssh2_session_method_pref(3) β yes that's the whole name, yes it's a mouthful, we're gonna get through it together π«Ά
β¨ NAME β¨
libssh2_session_method_pref β set preferred key exchange method π
β¨ SYNOPSIS β¨
#include <libssh2.h>
int
libssh2_session_method_pref(LIBSSH2_SESSION *session,
int method_type, const char *prefs);
β¨ DESCRIPTION β¨
okay so here's the vibe. You're telling libssh2 which methods you want, in what order, before it goes and talks to the remote host. It's giving "I have preferences and I'm not sorry" π
The arguments, one by one:
sessionβ the Session instance, as returned bylibssh2_session_init_ex(3). Your main character object fr fr πΈmethod_typeβ one of the Method Type constants. Pick your fighter.prefsβ a comma-delimited list of the preferred methods you wanna use, with the most preferred listed first and the least preferred listed last. Lowkey a ranking. Highkey a ranking.
heads up: if a method is listed that libssh2 doesn't support, it just gets ignored β no error, no drama, nothing. It will not be sent to the remote host during protocol negotiation. So don't be out here thinking you sent something you didn't π
So what does this actually do? It sets the preferred methods to be negotiated. β¨
And this is the part that matters: these preferences must be set prior to calling libssh2_session_handshake(3), because that's when they get used β during the protocol initiation phase. Set them after and, bestie, you're just too late. π°οΈπ
β¨ RETURN VALUE β¨
0on success π- negative on failure
It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. And yes, LIBSSH2_ERROR_EAGAIN is a negative number, but no, it's not really a failure per se. It's just vibing. Don't panic. π
β¨ ERRORS β¨
LIBSSH2_ERROR_INVALβ the requested method type was invalid. wrong button, bestie π₯LIBSSH2_ERROR_ALLOCβ an internal memory allocation call failed. it's not you, it's the malloc πLIBSSH2_ERROR_METHOD_NOT_SUPPORTEDβ the requested method is not supported. she said no π
β¨ SEE ALSO β¨
and that's the whole page, you ate it π periodt π
cute little sign-off: this was libssh2 0.15, dated 1 Jun 2007, and yeah the date is older than most of us but she's still iconic β¨π¦
π¦ where this page comes from
- alpine 3.22: libssh2-doc 1.11.1-r3 Β· BSD-3-Clause
- alpine 3.23: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- alpine 3.24: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- arch rolling: libssh2 1.11.1-7 Β· BSD-3-Clause
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u1 Β· BSD3
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u2 Β· BSD3
- epel 10: libssh2-docs 1.11.1-9.el10_3 Β· BSD-3-Clause
- epel 9: libssh2-docs 1.11.1-9.el9 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-4.fc43 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-9.fc43 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-5.fc44 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- ubuntu questing: libssh2-1-dev 1.11.1-1build1
- ubuntu questing: libssh2-1-dev 1.11.1-1ubuntu0.25.10.2
- ubuntu resolute: libssh2-1-dev 1.11.1-1build2 Β· BSD3
- ubuntu resolute: libssh2-1-dev 1.11.1-1ubuntu0.26.04.4 Β· BSD3
- ubuntu stonking: libssh2-1-dev 1.11.1-6 Β· BSD3
- π the page's license: BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms