3.2.3 Helper functions

Events are used to notify and involve the application in most packet exchanges that occur with the remote host. Events reported to the application can be generated by the transport layer, the running key-exchange module and the running service module. This involves the application in tasks like host key lookup, user credentials checking, requests handling and channels management. This allows a fine-grained control of the ssh2 features while letting the library handle the protocol and crypto stuff.

This design implies that there is a part of the job left to be done by the application. That's why the library comes with helper functions designed to handle events in a way that yield common behavior. For instance, this includes performing host key lookup in standard file locations and handling user authentication using the operating system calls. The code of the Remote command execution example and Simple loopback server example are short because helpers are used extensively. In contrast, more complex example applications use fewer helper functions.

Other helper functions that are not designed to handle events are also provided. They provide various features like SSH keys file operations and standard ssh2 channels and requests handling.

The application writer is free not to use the helper functions when they are not suitable. The library core and modules do not depend on helper functions so that the associated code can be excluded from the build when not used by the application.

Helper related declarations use the asshh_ prefix whereas other library declarations use the assh_ prefix.

Those header files provide declarations of helpers functions:

Valid XHTML 1.0 StrictGenerated by diaxen on Sun Oct 25 23:30:45 2020 using MkDoc