1libssh2_session_supported_algs(3)   libssh2  libssh2_session_supported_algs(3)
2
3
4

NAME

6       libssh2_session_supported_algs - get list of supported algorithms
7

SYNOPSIS

9       #include <libssh2.h>
10
11       int
12       libssh2_session_supported_algs(LIBSSH2_SESSION* session,
13                                      int method_type,
14                                      const char*** algs);
15

DESCRIPTION

17       session - An instance of initialized LIBSSH2_SESSION (the function will
18       use its pointer to the  memory  allocation  function).   method_type  -
19       Method  type.  See libssh2_session_method_pref(3).  algs - Address of a
20       pointer that will point to an array of returned algorithms
21
22       Get a list of supported  algorithms  for  the  given  method_type.  The
23       method_type  parameter  is  equivalent  to  method_type in libssh2_ses‐
24       sion_method_pref(3). If successful, the function will allocate the  ap‐
25       propriate amount of memory. When not needed anymore, it must be deallo‐
26       cated by calling libssh2_free(3). When this function  is  unsuccessful,
27       this must not be done.
28
29       In  order  to  get a list of all supported compression algorithms, lib‐
30       ssh2_session_flag(session, LIBSSH2_FLAG_COMPRESS, 1) must be called be‐
31       fore calling this function, otherwise only "none" will be returned.
32
33       If  successful, the function will allocate and fill the array with sup‐
34       ported algorithms (the same names as defined in RFC 4253).   The  array
35       is not NULL terminated.
36

EXAMPLE

38       #include "libssh2.h"
39
40       const char **algorithms;
41       int rc, i;
42       LIBSSH2_SESSION *session;
43
44       /* initialize session */
45       session = libssh2_session_init();
46       rc = libssh2_session_supported_algs(session,
47                                           LIBSSH2_METHOD_CRYPT_CS,
48                                           &algorithms);
49       if(rc > 0) {
50           /* the call succeeded, do sth. with the list of algorithms
51              (e.g. list them)... */
52           printf("Supported symmetric algorithms:\n");
53           for(i = 0; i < rc; i++)
54               printf("\t%s\n", algorithms[i]);
55
56           /* ... and free the allocated memory when not needed anymore */
57           libssh2_free(session, algorithms);
58       }
59       else {
60           /* call failed, error handling */
61       }
62

RETURN VALUE

64       On success, a number of returned algorithms (i.e a positive number will
65       be returned).  In case of a failure, an error code (a negative  number,
66       see below) is returned.  0 should never be returned.
67

ERRORS

69       LIBSSH2_ERROR_BAD_USE - Invalid address of algs.
70
71       LIBSSH2_ERROR_METHOD_NOT_SUPPORTED -  Unknown method type.
72
73       LIBSSH2_ERROR_INVAL - Internal error (normally should not occur).
74
75       LIBSSH2_ERROR_ALLOC - Allocation of memory failed.
76

AVAILABILITY

78       Added in 1.4.0
79

SEE ALSO

81       libssh2_session_methods(3),     libssh2_session_method_pref(3)     lib‐
82       ssh2_free(3)
83
84
85
86libssh2                           23 Oct 2011libssh2_session_supported_algs(3)
Impressum