|
libssh
0.7.2
|
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 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00028 #ifndef SERVER_H 00029 #define SERVER_H 00030 00031 #include "libssh/libssh.h" 00032 #define SERVERBANNER CLIENTBANNER 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00038 enum ssh_bind_options_e { 00039 SSH_BIND_OPTIONS_BINDADDR, 00040 SSH_BIND_OPTIONS_BINDPORT, 00041 SSH_BIND_OPTIONS_BINDPORT_STR, 00042 SSH_BIND_OPTIONS_HOSTKEY, 00043 SSH_BIND_OPTIONS_DSAKEY, 00044 SSH_BIND_OPTIONS_RSAKEY, 00045 SSH_BIND_OPTIONS_BANNER, 00046 SSH_BIND_OPTIONS_LOG_VERBOSITY, 00047 SSH_BIND_OPTIONS_LOG_VERBOSITY_STR, 00048 SSH_BIND_OPTIONS_ECDSAKEY 00049 }; 00050 00051 typedef struct ssh_bind_struct* ssh_bind; 00052 00053 /* Callback functions */ 00054 00061 typedef void (*ssh_bind_incoming_connection_callback) (ssh_bind sshbind, 00062 void *userdata); 00063 00069 struct ssh_bind_callbacks_struct { 00071 size_t size; 00073 ssh_bind_incoming_connection_callback incoming_connection; 00074 }; 00075 typedef struct ssh_bind_callbacks_struct *ssh_bind_callbacks; 00076 00082 LIBSSH_API ssh_bind ssh_bind_new(void); 00083 00084 LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind, 00085 enum ssh_bind_options_e type, const void *value); 00086 00094 LIBSSH_API int ssh_bind_listen(ssh_bind ssh_bind_o); 00095 00116 LIBSSH_API int ssh_bind_set_callbacks(ssh_bind sshbind, ssh_bind_callbacks callbacks, 00117 void *userdata); 00118 00126 LIBSSH_API void ssh_bind_set_blocking(ssh_bind ssh_bind_o, int blocking); 00127 00135 LIBSSH_API socket_t ssh_bind_get_fd(ssh_bind ssh_bind_o); 00136 00144 LIBSSH_API void ssh_bind_set_fd(ssh_bind ssh_bind_o, socket_t fd); 00145 00151 LIBSSH_API void ssh_bind_fd_toaccept(ssh_bind ssh_bind_o); 00152 00161 LIBSSH_API int ssh_bind_accept(ssh_bind ssh_bind_o, ssh_session session); 00162 00175 LIBSSH_API int ssh_bind_accept_fd(ssh_bind ssh_bind_o, ssh_session session, 00176 socket_t fd); 00177 00178 LIBSSH_API ssh_gssapi_creds ssh_gssapi_get_creds(ssh_session session); 00179 00187 LIBSSH_API int ssh_handle_key_exchange(ssh_session session); 00188 00194 LIBSSH_API void ssh_bind_free(ssh_bind ssh_bind_o); 00195 00196 LIBSSH_API void ssh_set_auth_methods(ssh_session session, int auth_methods); 00197 00198 /********************************************************** 00199 * SERVER MESSAGING 00200 **********************************************************/ 00201 00214 LIBSSH_API int ssh_message_reply_default(ssh_message msg); 00215 00226 LIBSSH_API const char *ssh_message_auth_user(ssh_message msg); 00227 00238 LIBSSH_API const char *ssh_message_auth_password(ssh_message msg); 00239 00254 LIBSSH_API ssh_key ssh_message_auth_pubkey(ssh_message msg); 00255 00256 LIBSSH_API int ssh_message_auth_kbdint_is_response(ssh_message msg); 00257 LIBSSH_API enum ssh_publickey_state_e ssh_message_auth_publickey_state(ssh_message msg); 00258 LIBSSH_API int ssh_message_auth_reply_success(ssh_message msg,int partial); 00259 LIBSSH_API int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pubkey); 00260 LIBSSH_API int ssh_message_auth_reply_pk_ok_simple(ssh_message msg); 00261 00262 LIBSSH_API int ssh_message_auth_set_methods(ssh_message msg, int methods); 00263 00264 LIBSSH_API int ssh_message_auth_interactive_request(ssh_message msg, 00265 const char *name, const char *instruction, 00266 unsigned int num_prompts, const char **prompts, char *echo); 00267 00268 LIBSSH_API int ssh_message_service_reply_success(ssh_message msg); 00269 LIBSSH_API const char *ssh_message_service_service(ssh_message msg); 00270 00271 LIBSSH_API int ssh_message_global_request_reply_success(ssh_message msg, 00272 uint16_t bound_port); 00273 00274 LIBSSH_API void ssh_set_message_callback(ssh_session session, 00275 int(*ssh_bind_message_callback)(ssh_session session, ssh_message msg, void *data), 00276 void *data); 00277 LIBSSH_API int ssh_execute_message_callbacks(ssh_session session); 00278 00279 LIBSSH_API const char *ssh_message_channel_request_open_originator(ssh_message msg); 00280 LIBSSH_API int ssh_message_channel_request_open_originator_port(ssh_message msg); 00281 LIBSSH_API const char *ssh_message_channel_request_open_destination(ssh_message msg); 00282 LIBSSH_API int ssh_message_channel_request_open_destination_port(ssh_message msg); 00283 00284 LIBSSH_API ssh_channel ssh_message_channel_request_channel(ssh_message msg); 00285 00286 LIBSSH_API const char *ssh_message_channel_request_pty_term(ssh_message msg); 00287 LIBSSH_API int ssh_message_channel_request_pty_width(ssh_message msg); 00288 LIBSSH_API int ssh_message_channel_request_pty_height(ssh_message msg); 00289 LIBSSH_API int ssh_message_channel_request_pty_pxwidth(ssh_message msg); 00290 LIBSSH_API int ssh_message_channel_request_pty_pxheight(ssh_message msg); 00291 00292 LIBSSH_API const char *ssh_message_channel_request_env_name(ssh_message msg); 00293 LIBSSH_API const char *ssh_message_channel_request_env_value(ssh_message msg); 00294 00295 LIBSSH_API const char *ssh_message_channel_request_command(ssh_message msg); 00296 00297 LIBSSH_API const char *ssh_message_channel_request_subsystem(ssh_message msg); 00298 00299 LIBSSH_API int ssh_message_channel_request_x11_single_connection(ssh_message msg); 00300 LIBSSH_API const char *ssh_message_channel_request_x11_auth_protocol(ssh_message msg); 00301 LIBSSH_API const char *ssh_message_channel_request_x11_auth_cookie(ssh_message msg); 00302 LIBSSH_API int ssh_message_channel_request_x11_screen_number(ssh_message msg); 00303 00304 LIBSSH_API const char *ssh_message_global_request_address(ssh_message msg); 00305 LIBSSH_API int ssh_message_global_request_port(ssh_message msg); 00306 00307 LIBSSH_API int ssh_channel_open_reverse_forward(ssh_channel channel, const char *remotehost, 00308 int remoteport, const char *sourcehost, int localport); 00309 LIBSSH_API int ssh_channel_open_x11(ssh_channel channel, 00310 const char *orig_addr, int orig_port); 00311 00312 LIBSSH_API int ssh_channel_request_send_exit_status(ssh_channel channel, 00313 int exit_status); 00314 LIBSSH_API int ssh_channel_request_send_exit_signal(ssh_channel channel, 00315 const char *signum, 00316 int core, 00317 const char *errmsg, 00318 const char *lang); 00319 LIBSSH_API int ssh_channel_write_stderr(ssh_channel channel, 00320 const void *data, 00321 uint32_t len); 00322 00323 LIBSSH_API int ssh_send_keepalive(ssh_session session); 00324 00325 /* deprecated functions */ 00326 SSH_DEPRECATED LIBSSH_API int ssh_accept(ssh_session session); 00327 SSH_DEPRECATED LIBSSH_API int channel_write_stderr(ssh_channel channel, 00328 const void *data, uint32_t len); 00329 00330 #ifdef __cplusplus 00331 } 00332 #endif /* __cplusplus */ 00333 00334 #endif /* SERVER_H */ 00335
1.7.5.1