include/libssh/server.h

00001 /* Public include file for server support */
00002 /*
00003  * This file is part of the SSH Library
00004  *
00005  * Copyright (c) 2003-2008 by Aris Adamantiadis
00006  *
00007  * The SSH Library is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU Lesser General Public License as published by
00009  * the Free Software Foundation; either version 2.1 of the License, or (at your
00010  * option) any later version.
00011  *
00012  * The SSH Library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00014  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00015  * License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with the SSH Library; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00020  * MA 02111-1307, USA.
00021  */
00022 
00029 #ifndef SERVER_H
00030 #define SERVER_H
00031 
00032 #include "libssh/libssh.h"
00033 #define SERVERBANNER CLIENTBANNER
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 enum ssh_bind_options_e {
00040   SSH_BIND_OPTIONS_BINDADDR,
00041   SSH_BIND_OPTIONS_BINDPORT,
00042   SSH_BIND_OPTIONS_BINDPORT_STR,
00043   SSH_BIND_OPTIONS_HOSTKEY,
00044   SSH_BIND_OPTIONS_DSAKEY,
00045   SSH_BIND_OPTIONS_RSAKEY,
00046   SSH_BIND_OPTIONS_BANNER,
00047   SSH_BIND_OPTIONS_LOG_VERBOSITY,
00048   SSH_BIND_OPTIONS_LOG_VERBOSITY_STR
00049 };
00050 
00051 typedef struct ssh_bind_struct* ssh_bind;
00052 
00053 /* Callback functions */
00054 
00062 typedef void (*ssh_bind_incoming_connection_callback) (ssh_bind sshbind,
00063     void *userdata);
00064 
00070 struct ssh_bind_callbacks_struct {
00072   size_t size;
00074   ssh_bind_incoming_connection_callback incoming_connection;
00075 };
00076 typedef struct ssh_bind_callbacks_struct *ssh_bind_callbacks;
00077 
00083 LIBSSH_API ssh_bind ssh_bind_new(void);
00084 
00148 LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind,
00149     enum ssh_bind_options_e type, const void *value);
00150 
00158 LIBSSH_API int ssh_bind_listen(ssh_bind ssh_bind_o);
00159 
00180 LIBSSH_API int ssh_bind_set_callbacks(ssh_bind sshbind, ssh_bind_callbacks callbacks,
00181     void *userdata);
00182 
00190 LIBSSH_API void ssh_bind_set_blocking(ssh_bind ssh_bind_o, int blocking);
00191 
00199 LIBSSH_API socket_t ssh_bind_get_fd(ssh_bind ssh_bind_o);
00200 
00208 LIBSSH_API void ssh_bind_set_fd(ssh_bind ssh_bind_o, socket_t fd);
00209 
00215 LIBSSH_API void ssh_bind_fd_toaccept(ssh_bind ssh_bind_o);
00216 
00225 LIBSSH_API int ssh_bind_accept(ssh_bind ssh_bind_o, ssh_session session);
00226 
00234 LIBSSH_API int ssh_handle_key_exchange(ssh_session session);
00235 
00241 LIBSSH_API void ssh_bind_free(ssh_bind ssh_bind_o);
00242 
00243 /* messages.c */
00244 LIBSSH_API int ssh_message_reply_default(ssh_message msg);
00245 
00246 LIBSSH_API char *ssh_message_auth_user(ssh_message msg);
00247 LIBSSH_API char *ssh_message_auth_password(ssh_message msg);
00248 LIBSSH_API ssh_public_key ssh_message_auth_publickey(ssh_message msg);
00249 LIBSSH_API enum ssh_publickey_state_e ssh_message_auth_publickey_state(ssh_message msg);
00250 LIBSSH_API int ssh_message_auth_reply_success(ssh_message msg,int partial);
00251 LIBSSH_API int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pubkey);
00252 LIBSSH_API int ssh_message_auth_reply_pk_ok_simple(ssh_message msg);
00253 
00254 LIBSSH_API int ssh_message_auth_set_methods(ssh_message msg, int methods);
00255 
00256 LIBSSH_API int ssh_message_service_reply_success(ssh_message msg);
00257 LIBSSH_API char *ssh_message_service_service(ssh_message msg);
00258 
00259 LIBSSH_API int ssh_message_global_request_reply_success(ssh_message msg,
00260                                                         uint16_t bound_port);
00261 
00262 LIBSSH_API void ssh_set_message_callback(ssh_session session,
00263     int(*ssh_bind_message_callback)(ssh_session session, ssh_message msg, void *data),
00264     void *data);
00265 LIBSSH_API int ssh_execute_message_callbacks(ssh_session session);
00266 
00267 LIBSSH_API char *ssh_message_channel_request_open_originator(ssh_message msg);
00268 LIBSSH_API int ssh_message_channel_request_open_originator_port(ssh_message msg);
00269 LIBSSH_API char *ssh_message_channel_request_open_destination(ssh_message msg);
00270 LIBSSH_API int ssh_message_channel_request_open_destination_port(ssh_message msg);
00271 
00272 LIBSSH_API ssh_channel ssh_message_channel_request_channel(ssh_message msg);
00273 
00274 LIBSSH_API char *ssh_message_channel_request_pty_term(ssh_message msg);
00275 LIBSSH_API int ssh_message_channel_request_pty_width(ssh_message msg);
00276 LIBSSH_API int ssh_message_channel_request_pty_height(ssh_message msg);
00277 LIBSSH_API int ssh_message_channel_request_pty_pxwidth(ssh_message msg);
00278 LIBSSH_API int ssh_message_channel_request_pty_pxheight(ssh_message msg);
00279 
00280 LIBSSH_API char *ssh_message_channel_request_env_name(ssh_message msg);
00281 LIBSSH_API char *ssh_message_channel_request_env_value(ssh_message msg);
00282 
00283 LIBSSH_API char *ssh_message_channel_request_command(ssh_message msg);
00284 
00285 LIBSSH_API char *ssh_message_channel_request_subsystem(ssh_message msg);
00286 
00287 LIBSSH_API char *ssh_message_global_request_address(ssh_message msg);
00288 LIBSSH_API int ssh_message_global_request_port(ssh_message msg);
00289 
00290 LIBSSH_API int ssh_channel_open_reverse_forward(ssh_channel channel, const char *remotehost,
00291     int remoteport, const char *sourcehost, int localport);
00292 
00293 LIBSSH_API int ssh_channel_request_send_exit_status(ssh_channel channel,
00294                                                 int exit_status);
00295 LIBSSH_API int ssh_channel_request_send_exit_signal(ssh_channel channel,
00296                                                 const char *signum,
00297                                                 int core,
00298                                                 const char *errmsg,
00299                                                 const char *lang);
00300 LIBSSH_API int ssh_channel_write_stderr(ssh_channel channel,
00301                                                 const void *data,
00302                                                 uint32_t len);
00303 
00304 /* deprecated functions */
00305 SSH_DEPRECATED LIBSSH_API int ssh_accept(ssh_session session);
00306 SSH_DEPRECATED LIBSSH_API int channel_write_stderr(ssh_channel channel,
00307         const void *data, uint32_t len);
00308 
00309 #ifdef __cplusplus
00310 }
00311 #endif /* __cplusplus */
00312 
00313 #endif /* SERVER_H */
00314 

Generated on 26 Jul 2013 for libssh by  doxygen 1.4.7