cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

libssh2_session_supported_algs.3 (2722B)


      1.TH libssh2_session_supported_algs 3 "23 Oct 2011" "libssh2" "libssh2"
      2.SH NAME
      3libssh2_session_supported_algs - get list of supported algorithms
      4.SH SYNOPSIS
      5.nf
      6#include <libssh2.h>
      7
      8int
      9libssh2_session_supported_algs(LIBSSH2_SESSION* session,
     10                               int method_type,
     11                               const char*** algs);
     12.fi
     13.SH DESCRIPTION
     14\fIsession\fP - An instance of initialized LIBSSH2_SESSION (the function will
     15use its pointer to the memory allocation function).  \fImethod_type\fP -
     16Method type. See \fIlibssh2_session_method_pref(3)\fP.  \fIalgs\fP - Address
     17of a pointer that will point to an array of returned algorithms
     18
     19Get a list of supported algorithms for the given \fImethod_type\fP. The
     20method_type parameter is equivalent to method_type in
     21\fIlibssh2_session_method_pref(3)\fP. If successful, the function will
     22allocate the appropriate amount of memory. When not needed anymore, it must be
     23deallocated by calling \fIlibssh2_free(3)\fP. When this function is
     24unsuccessful, this must not be done.
     25
     26In order to get a list of all supported compression algorithms,
     27libssh2_session_flag(session, LIBSSH2_FLAG_COMPRESS, 1) must be called before
     28calling this function, otherwise only "none" will be returned.
     29
     30If successful, the function will allocate and fill the array with supported
     31algorithms (the same names as defined in RFC 4253).  The array is not NULL
     32terminated.
     33.SH EXAMPLE
     34.nf
     35#include "libssh2.h"
     36
     37const char **algorithms;
     38int rc, i;
     39LIBSSH2_SESSION *session;
     40
     41/* initialize session */
     42session = libssh2_session_init();
     43rc = libssh2_session_supported_algs(session,
     44                                    LIBSSH2_METHOD_CRYPT_CS,
     45                                    &algorithms);
     46if(rc > 0) {
     47    /* the call succeeded, do sth. with the list of algorithms
     48       (e.g. list them)... */
     49    printf("Supported symmetric algorithms:\\n");
     50    for(i = 0; i < rc; i++)
     51        printf("\\t%s\\n", algorithms[i]);
     52
     53    /* ... and free the allocated memory when not needed anymore */
     54    libssh2_free(session, algorithms);
     55}
     56else {
     57    /* call failed, error handling */
     58}
     59.fi
     60.SH RETURN VALUE
     61On success, a number of returned algorithms (i.e a positive number will be
     62returned).  In case of a failure, an error code (a negative number, see below)
     63is returned.  0 should never be returned.
     64.SH ERRORS
     65\fILIBSSH2_ERROR_BAD_USE\fP - Invalid address of algs.
     66
     67\fILIBSSH2_ERROR_METHOD_NOT_SUPPORTED\fP -  Unknown method type.
     68
     69\fILIBSSH2_ERROR_INVAL\fP - Internal error (normally should not occur).
     70
     71\fILIBSSH2_ERROR_ALLOC\fP - Allocation of memory failed.
     72.SH AVAILABILITY
     73Added in 1.4.0
     74.SH SEE ALSO
     75.BR libssh2_session_methods(3),
     76.BR libssh2_session_method_pref(3)
     77.BR libssh2_free(3)