libssh 0.4.8
|
00001 /* 00002 * This file is part of the SSH Library 00003 * 00004 * Copyright (c) 2009 by Aris Adamantiadis 00005 * 00006 * The SSH Library is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at your 00009 * option) any later version. 00010 * 00011 * The SSH Library is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00014 * License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with the SSH Library; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00019 * MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef SESSION_H_ 00023 #define SESSION_H_ 00024 #include "libssh/priv.h" 00025 #include "libssh/packet.h" 00026 #include "libssh/pcap.h" 00027 00028 typedef struct ssh_kbdint_struct* ssh_kbdint; 00029 00030 struct ssh_session_struct { 00031 struct error_struct error; 00032 struct socket *socket; 00033 char *serverbanner; 00034 char *clientbanner; 00035 int protoversion; 00036 int server; 00037 int client; 00038 int openssh; 00039 uint32_t send_seq; 00040 uint32_t recv_seq; 00041 /* status flags */ 00042 int closed; 00043 int closed_by_except; 00044 00045 int connected; 00046 /* !=0 when the user got a session handle */ 00047 int alive; 00048 /* two previous are deprecated */ 00049 int auth_service_asked; 00050 00051 /* socket status */ 00052 int blocking; // functions should block 00053 00054 ssh_string banner; /* that's the issue banner from 00055 the server */ 00056 char *remotebanner; /* that's the SSH- banner from 00057 remote host. */ 00058 char *discon_msg; /* disconnect message from 00059 the remote host */ 00060 ssh_buffer in_buffer; 00061 PACKET in_packet; 00062 ssh_buffer out_buffer; 00063 00064 /* the states are used by the nonblocking stuff to remember */ 00065 /* where it was before being interrupted */ 00066 int packet_state; 00067 int dh_handshake_state; 00068 ssh_string dh_server_signature; //information used by dh_handshake. 00069 00070 KEX server_kex; 00071 KEX client_kex; 00072 ssh_buffer in_hashbuf; 00073 ssh_buffer out_hashbuf; 00074 struct ssh_crypto_struct *current_crypto; 00075 struct ssh_crypto_struct *next_crypto; /* next_crypto is going to be used after a SSH2_MSG_NEWKEYS */ 00076 00077 ssh_channel channels; /* linked list of channels */ 00078 int maxchannel; 00079 int exec_channel_opened; /* version 1 only. more 00080 info in channels1.c */ 00081 ssh_agent agent; /* ssh agent */ 00082 00083 /* keyb interactive data */ 00084 struct ssh_kbdint_struct *kbdint; 00085 int version; /* 1 or 2 */ 00086 /* server host keys */ 00087 ssh_private_key rsa_key; 00088 ssh_private_key dsa_key; 00089 /* auths accepted by server */ 00090 int auth_methods; 00091 int hostkeys; /* contains type of host key wanted by client, in server impl */ 00092 struct ssh_list *ssh_message_list; /* list of delayed SSH messages */ 00093 int (*ssh_message_callback)( struct ssh_session_struct *session, ssh_message msg); 00094 int log_verbosity; /*cached copy of the option structure */ 00095 int log_indent; /* indentation level in enter_function logs */ 00096 00097 ssh_callbacks callbacks; /* Callbacks to user functions */ 00098 00099 /* options */ 00100 #ifdef WITH_PCAP 00101 ssh_pcap_context pcap_ctx; /* pcap debugging context */ 00102 #endif 00103 char *username; 00104 char *host; 00105 char *bindaddr; /* bind the client to an ip addr */ 00106 char *xbanner; /* TODO: looks like it is not needed */ 00107 struct ssh_list *identity; 00108 char *sshdir; 00109 char *knownhosts; 00110 char *wanted_methods[10]; 00111 unsigned long timeout; /* seconds */ 00112 unsigned long timeout_usec; 00113 unsigned int port; 00114 socket_t fd; 00115 int ssh2; 00116 int ssh1; 00117 char *ProxyCommand; 00118 }; 00119 00120 int ssh_handle_packets(ssh_session session); 00121 void ssh_global_request_handle(ssh_session session); 00122 #endif /* SESSION_H_ */