The libssh C++ wrapper

Overview

The C++ bindings for libssh are completely embedded in a single .hpp file, and this for two reasons: More…

// namespaces

namespace ssh;

// macros

#define LIBSSH_LEGACY_0_4

Detailed Documentation

The C++ bindings for libssh are completely embedded in a single .hpp file, and this for two reasons:

  • C++ is hard to keep binary compatible, C is easy. We try to keep libssh C version as much as possible binary compatible between releases, while this would be hard for C++. If you compile your program with these headers, you will only link to the C version of libssh which will be kept ABI compatible. No need to recompile your C++ program each time a new binary-compatible version of libssh is out

  • Most of the functions in this file are really short and are probably worth the “inline” linking mode, which the compiler can decide to do in some case. There would be nearly no performance penalty of using the wrapper rather than native calls.

Please visit the documentation of ssh::Session and ssh::Channel If you wish not to use C++ exceptions, please define SSH_NO_CPP_EXCEPTIONS:

#define SSH_NO_CPP_EXCEPTIONS
#include <libssh/libsshpp.hpp>

All functions will then return SSH_ERROR in case of error.

See also:

ssh::Session

ssh::Channel