libssh  0.10.6
The SSH library
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
The SSH threading functions
Collaboration diagram for The SSH threading functions:

Data Structures

struct  ssh_threads_callbacks_struct
 

Typedefs

typedef int(* ssh_thread_callback) (void **lock)
 
typedef unsigned long(* ssh_thread_id_callback) (void)
 

Functions

LIBSSH_API int ssh_threads_set_callbacks (struct ssh_threads_callbacks_struct *cb)
 Set the thread callbacks structure.
 
LIBSSH_API struct ssh_threads_callbacks_structssh_threads_get_default (void)
 Returns a pointer to the appropriate callbacks structure for the environment, to be used with ssh_threads_set_callbacks.
 
LIBSSH_API struct ssh_threads_callbacks_structssh_threads_get_pthread (void)
 Returns a pointer on the pthread threads callbacks, to be used with ssh_threads_set_callbacks.
 
LIBSSH_API struct ssh_threads_callbacks_structssh_threads_get_noop (void)
 Get the noop threads callbacks structure.
 
LIBSSH_API int ssh_set_log_callback (ssh_logging_callback cb)
 Set the logging callback function.
 
LIBSSH_API ssh_logging_callback ssh_get_log_callback (void)
 Get the pointer to the logging callback function.
 
int ssh_threads_init (void)
 
void ssh_threads_finalize (void)
 
const char * ssh_threads_get_type (void)
 

Detailed Description

Threading with libssh

Function Documentation

◆ ssh_get_log_callback()

LIBSSH_API ssh_logging_callback ssh_get_log_callback ( void )

Get the pointer to the logging callback function.

Returns
The pointer the the callback or NULL if none set.

◆ ssh_set_log_callback()

LIBSSH_API int ssh_set_log_callback ( ssh_logging_callback cb)

Set the logging callback function.

Parameters
[in]cbThe callback to set.
Returns
0 on success, < 0 on error.

◆ ssh_threads_get_default()

LIBSSH_API struct ssh_threads_callbacks_struct * ssh_threads_get_default ( void )

Returns a pointer to the appropriate callbacks structure for the environment, to be used with ssh_threads_set_callbacks.

Returns
A pointer to a ssh_threads_callbacks_struct to be used with ssh_threads_set_callbacks.
See also
ssh_threads_set_callbacks

◆ ssh_threads_get_noop()

LIBSSH_API struct ssh_threads_callbacks_struct * ssh_threads_get_noop ( void )

Get the noop threads callbacks structure.

This can be used with ssh_threads_set_callbacks. These callbacks do nothing and are being used by default.

Returns
Always returns a valid pointer to the noop callbacks structure.
See also
ssh_threads_set_callbacks

◆ ssh_threads_get_pthread()

LIBSSH_API struct ssh_threads_callbacks_struct * ssh_threads_get_pthread ( void )

Returns a pointer on the pthread threads callbacks, to be used with ssh_threads_set_callbacks.

See also
ssh_threads_set_callbacks

◆ ssh_threads_set_callbacks()

int ssh_threads_set_callbacks ( struct ssh_threads_callbacks_struct * cb)

Set the thread callbacks structure.

This is necessary if your program is using libssh in a multithreaded fashion. This function must be called first, outside of any threading context (in your main() function for instance), before you call ssh_init().

Parameters
[in]cbA pointer to a ssh_threads_callbacks_struct structure, which contains the different callbacks to be set.
Returns
Always returns SSH_OK.
See also
ssh_threads_callbacks_struct
SSH_THREADS_PTHREAD
Bug
libgcrypt 1.6 and bigger backend does not support custom callback. Using anything else than pthreads here will fail.