1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-04-19 02:24:04 +03:00
libssh2/docs/libssh2_session_callback_set.3
Viktor Szakats c0f69548be
session: add libssh2_session_callback_set2()
Add new `libssh2_session_callback_set2()` API that deprecates
`libssh2_session_callback_set()`.

The new implementation offers the same functionality, but accepts and
returns a generic function pointer (of type `libssh2_cb_generic *`), as
opposed to the old function that used data pointers (`void *`). The new
solution thus avoids data to function (and vice versa) pointer
conversions, which has undefined behaviour in standard C.

About the name: It seems the `*2` suffix was used in the past for
replacement functions for deprecated ones. Let's stick with that.
`*_ex` was preferred for new functions that extend existing ones with
new features.

Closes #1285
2023-12-18 15:02:17 +00:00

32 lines
1005 B
Groff

.\" Copyright (C) The libssh2 project and its contributors.
.\" SPDX-License-Identifier: BSD-3-Clause
.TH libssh2_session_callback_set 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_session_callback_set - set a callback function
.SH SYNOPSIS
.nf
#include <libssh2.h>
void *
libssh2_session_callback_set(LIBSSH2_SESSION *session,
int cbtype, void *callback);
.fi
.SH DESCRIPTION
This function is \fBDEPRECATED\fP in 1.11.1. Use the
\fIlibssh2_session_callback_set2(3)\fP function instead!
This implementation is expecting and returning a data pointer for callback
functions.
For the details about the replacement function, see
.BR libssh2_session_callback_set2(3)
which is expecting and returning a function pointer.
.SH RETURN VALUE
Pointer to previous callback handler. Returns NULL if no prior callback
handler was set or the callback type was unknown.
.SH SEE ALSO
.BR libssh2_session_callback_set2(3)
.BR libssh2_session_init_ex(3)
.BR libssh2_agent_sign(3)