Loading...
Searching...
No Matches
The libssh API

## Topics

| The libssh callbacks
| The SSH authentication functions
| The SSH buffer functions
| The SSH channel functions
| The SSH error functions
| The SSH logging functions
| The SSH message functions
| The SSH helper functions
| The SSH Public Key Infrastructure
| The SSH poll functions
| The SSH scp functions
| The SSH session functions
| The SSH socket functions.
| The SSH string functions
| String manipulations used in libssh.
| The SSH threading functions

## Functions

int | ssh_init (void)
| Initialize global cryptographic data structures.
void | libssh_destructor (void)
| Finalize and clean up all libssh and cryptographic data structures.
int | ssh_finalize (void)
| Finalize and clean up all libssh and cryptographic data structures.
bool | is_ssh_initialized (void)

## Detailed Description

The libssh library is implementing the SSH protocols and some of its extensions. This group of functions is mostly used to implement an SSH client. Some functions are needed to implement an SSH server too.

## Function Documentation

## libssh_destructor()

void libssh_destructor | ( | void |  | ) |

Finalize and clean up all libssh and cryptographic data structures.

This function is automatically called when the library is unloaded.

## ssh_finalize()

int ssh_finalize | ( | void |  | ) |

Finalize and clean up all libssh and cryptographic data structures.

Since version 0.8.0, when libssh is dynamically linked, it is not necessary to call this function, since it is automatically called when the library is unloaded.

If libssh is statically linked, it is necessary to explicitly call ssh_init() before calling any other provided API, and it is necessary to explicitly call ssh_finalize() to free the allocated resources before exiting.

If ssh_init() is called explicitly, then ssh_finalize() must be called explicitly.

When called, decrements the counter _ssh_initialized. If the counter reaches zero, then the libssh and cryptographic data structures are cleaned up.

Returns
  0 on success, -1 if an error occurred.

See also
  ssh_init()

## ssh_init()

int ssh_init | ( | void |  | ) |

Initialize global cryptographic data structures.

Since version 0.8.0, when libssh is dynamically linked, it is not necessary to call this function on systems that fully support threading (that is, systems with pthreads available).

If libssh is statically linked, it is necessary to explicitly call ssh_init() before calling any other provided API, and it is necessary to explicitly call ssh_finalize() to free the allocated resources before exiting.

If the library is already initialized, increments the _ssh_initialized counter and return the error code cached in _ssh_init_ret.

Returns
  SSH_OK on success, SSH_ERROR if an error occurred.

See also
  ssh_finalize()