libssh 0.4.8

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 typedef struct ssh_bind_struct* ssh_bind;
00053 
00059 LIBSSH_API ssh_bind ssh_bind_new(void);
00060 
00072 LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind,
00073     enum ssh_bind_options_e type, const void *value);
00074 
00082 LIBSSH_API int ssh_bind_listen(ssh_bind ssh_bind_o);
00083 
00091 LIBSSH_API void ssh_bind_set_blocking(ssh_bind ssh_bind_o, int blocking);
00092 
00100 LIBSSH_API socket_t ssh_bind_get_fd(ssh_bind ssh_bind_o);
00101 
00109 LIBSSH_API void ssh_bind_set_fd(ssh_bind ssh_bind_o, socket_t fd);
00110 
00116 LIBSSH_API void ssh_bind_fd_toaccept(ssh_bind ssh_bind_o);
00117 
00126 LIBSSH_API int ssh_bind_accept(ssh_bind ssh_bind_o, ssh_session session);
00127 
00133 LIBSSH_API void ssh_bind_free(ssh_bind ssh_bind_o);
00134 
00142 LIBSSH_API int ssh_accept(ssh_session session);
00143 
00144 LIBSSH_API int channel_write_stderr(ssh_channel channel, const void *data, uint32_t len);
00145 
00146 /* messages.c */
00147 LIBSSH_API int ssh_message_reply_default(ssh_message msg);
00148 
00149 LIBSSH_API char *ssh_message_auth_user(ssh_message msg);
00150 LIBSSH_API char *ssh_message_auth_password(ssh_message msg);
00151 LIBSSH_API ssh_public_key ssh_message_auth_publickey(ssh_message msg);
00152 LIBSSH_API int ssh_message_auth_reply_success(ssh_message msg,int partial);
00153 LIBSSH_API int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pubkey);
00154 LIBSSH_API int ssh_message_auth_set_methods(ssh_message msg, int methods);
00155 
00156 LIBSSH_API int ssh_message_service_reply_success(ssh_message msg);
00157 LIBSSH_API char *ssh_message_service_service(ssh_message msg);
00158 
00159 LIBSSH_API void ssh_set_message_callback(ssh_session session,
00160     int(*ssh_message_callback)(ssh_session session, ssh_message msg));
00161 
00162 LIBSSH_API char *ssh_message_channel_request_open_originator(ssh_message msg);
00163 LIBSSH_API int ssh_message_channel_request_open_originator_port(ssh_message msg);
00164 LIBSSH_API char *ssh_message_channel_request_open_destination(ssh_message msg);
00165 LIBSSH_API int ssh_message_channel_request_open_destination_port(ssh_message msg);
00166 
00167 LIBSSH_API ssh_channel ssh_message_channel_request_channel(ssh_message msg);
00168 
00169 LIBSSH_API char *ssh_message_channel_request_pty_term(ssh_message msg);
00170 LIBSSH_API int ssh_message_channel_request_pty_width(ssh_message msg);
00171 LIBSSH_API int ssh_message_channel_request_pty_height(ssh_message msg);
00172 LIBSSH_API int ssh_message_channel_request_pty_pxwidth(ssh_message msg);
00173 LIBSSH_API int ssh_message_channel_request_pty_pxheight(ssh_message msg);
00174 
00175 LIBSSH_API char *ssh_message_channel_request_env_name(ssh_message msg);
00176 LIBSSH_API char *ssh_message_channel_request_env_value(ssh_message msg);
00177 
00178 LIBSSH_API char *ssh_message_channel_request_command(ssh_message msg);
00179 
00180 LIBSSH_API char *ssh_message_channel_request_subsystem(ssh_message msg);
00181 
00182 #ifdef __cplusplus
00183 }
00184 #endif /* __cplusplus */
00185 
00186 #endif /* SERVER_H */
00187 
00191 /* vim: set ts=2 sw=2 et cindent: */