libssh 0.4.8
Functions

SSH Server

Functions

LIBSSH_API int channel_write_stderr (ssh_channel channel, const void *data, uint32_t len)
 Blocking write on channel for stderr.
LIBSSH_API int ssh_accept (ssh_session session)
 Exchange the banner and cryptographic keys.
LIBSSH_API int ssh_bind_accept (ssh_bind ssh_bind_o, ssh_session session)
 Accept an incoming ssh connection and initialize the session.
LIBSSH_API void ssh_bind_fd_toaccept (ssh_bind ssh_bind_o)
 Allow the file descriptor to accept new sessions.
LIBSSH_API void ssh_bind_free (ssh_bind ssh_bind_o)
 Free a ssh servers bind.
LIBSSH_API socket_t ssh_bind_get_fd (ssh_bind ssh_bind_o)
 Recover the file descriptor from the session.
LIBSSH_API int ssh_bind_listen (ssh_bind ssh_bind_o)
 Start listening to the socket.
LIBSSH_API ssh_bind ssh_bind_new (void)
 Creates a new SSH server bind.
LIBSSH_API int ssh_bind_options_set (ssh_bind sshbind, enum ssh_bind_options_e type, const void *value)
 Set the opitons for the current SSH server bind.
LIBSSH_API void ssh_bind_set_blocking (ssh_bind ssh_bind_o, int blocking)
 Set the session to blocking/nonblocking mode.
LIBSSH_API void ssh_bind_set_fd (ssh_bind ssh_bind_o, socket_t fd)
 Set the file descriptor for a session.
LIBSSH_API void ssh_set_message_callback (ssh_session session, int(*ssh_message_callback)(ssh_session session, ssh_message msg))
 defines the SSH_MESSAGE callback

Function Documentation

int channel_write_stderr ( ssh_channel  channel,
const void *  data,
uint32_t  len 
)

Blocking write on channel for stderr.

Parameters:
channelThe channel to write to.
dataA pointer to the data to write.
lenThe length of the buffer to write to.
Returns:
The number of bytes written, SSH_ERROR on error.
See also:
channel_read()
int ssh_accept ( ssh_session  session)

Exchange the banner and cryptographic keys.

Parameters:
sessionThe ssh session to accept a connection.
Returns:
0 on success, < 0 on error.
int ssh_bind_accept ( ssh_bind  ssh_bind_o,
ssh_session  session 
)

Accept an incoming ssh connection and initialize the session.

Parameters:
ssh_bind_oThe ssh server bind to accept a connection.
sessionA preallocated ssh session
See also:
ssh_new
Returns:
A newly allocated ssh session, NULL on error.

References privatekey_free().

void ssh_bind_fd_toaccept ( ssh_bind  ssh_bind_o)

Allow the file descriptor to accept new sessions.

Parameters:
ssh_bind_oThe ssh server bind to use.
void ssh_bind_free ( ssh_bind  ssh_bind_o)

Free a ssh servers bind.

Parameters:
ssh_bind_oThe ssh server bind to free.
socket_t ssh_bind_get_fd ( ssh_bind  ssh_bind_o)

Recover the file descriptor from the session.

Parameters:
ssh_bind_oThe ssh server bind to get the fd from.
Returns:
The file descriptor.
int ssh_bind_listen ( ssh_bind  ssh_bind_o)

Start listening to the socket.

Parameters:
ssh_bind_oThe ssh server bind to use.
Returns:
0 on success, < 0 on error.

References ssh_init().

ssh_bind ssh_bind_new ( void  )

Creates a new SSH server bind.

Returns:
A newly allocated ssh_bind session pointer.
LIBSSH_API int ssh_bind_options_set ( ssh_bind  sshbind,
enum ssh_bind_options_e  type,
const void *  value 
)

Set the opitons for the current SSH server bind.

Parameters:
sshbindThe ssh server bind to use.
typeThe option type to set.
valueThe option value to set.
Returns:
0 on success, < 0 on error.
void ssh_bind_set_blocking ( ssh_bind  ssh_bind_o,
int  blocking 
)

Set the session to blocking/nonblocking mode.

Parameters:
ssh_bind_oThe ssh server bind to use.
blockingZero for nonblocking mode.
void ssh_bind_set_fd ( ssh_bind  ssh_bind_o,
socket_t  fd 
)

Set the file descriptor for a session.

Parameters:
ssh_bind_oThe ssh server bind to set the fd.
fdThe file descriptssh_bind B
void ssh_set_message_callback ( ssh_session  session,
int(*)(ssh_session session, ssh_message msg)  ssh_message_callback 
)

defines the SSH_MESSAGE callback

Parameters:
sessionthe current ssh session
ssh_message_callbacka function pointer to a callback taking the current ssh session and received message as parameters. the function returns 0 if the message has been parsed and treated sucessfuly, 1 otherwise (libssh must take care of the response).