~vanvugt/+junk/remmina-ppa

« back to all changes in this revision

Viewing changes to src/remminassh.h

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2010-07-11 23:40:47 UTC
  • mfrom: (1.2.1 upstream) (8.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100711234047-id2bdu1gb59e34n4
* New upstream release.
* debian/control:
  - Bump Standards-Version to 3.9.0, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Remmina - The GTK+ Remote Desktop Client
3
 
 * Copyright (C) 2009 - Vic Lee 
 
3
 * Copyright (C) 2009-2010 Vic Lee 
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
6
6
 * it under the terms of the GNU General Public License as published by
27
27
#ifdef HAVE_LIBSSH
28
28
 
29
29
#include <libssh/libssh.h>
 
30
#include <libssh/callbacks.h>
30
31
#include <libssh/sftp.h>
31
32
#include <pthread.h>
32
33
#include "remminafile.h"
41
42
typedef struct _RemminaSSH
42
43
{
43
44
    ssh_session session;
 
45
    ssh_callbacks callback;
44
46
    gboolean authenticated;
45
47
 
46
48
    gchar *server;
47
 
    guint port;
 
49
    gint port;
48
50
    gchar *user;
49
51
    gint auth;
50
52
    gchar *password;
78
80
/* Error handling */
79
81
#define remmina_ssh_has_error(ssh) (((RemminaSSH*)ssh)->error!=NULL)
80
82
void remmina_ssh_set_error (RemminaSSH *ssh, const gchar *fmt);
81
 
#define remmina_ssh_set_application_error(ssh,msg) ((RemminaSSH*)ssh)->error = g_strdup (msg);
 
83
void remmina_ssh_set_application_error (RemminaSSH *ssh, const gchar *fmt, ...);
82
84
 
83
85
/* Converts a string to/from UTF-8, or simply duplicate it if no conversion */
84
86
gchar* remmina_ssh_convert (RemminaSSH *ssh, const gchar *from);
96
98
{
97
99
    REMMINA_SSH_TUNNEL_OPEN,
98
100
    REMMINA_SSH_TUNNEL_X11,
99
 
    REMMINA_SSH_TUNNEL_XPORT
 
101
    REMMINA_SSH_TUNNEL_XPORT,
 
102
    REMMINA_SSH_TUNNEL_REVERSE
100
103
};
101
104
 
102
105
struct _RemminaSSHTunnel
111
114
    gint num_channels;
112
115
    gint max_channels;
113
116
 
 
117
    ssh_channel x11_channel;
 
118
 
114
119
    pthread_t thread;
115
120
    gboolean running;
116
121
 
121
126
    gint server_sock;
122
127
    gchar *dest;
123
128
    gint port;
 
129
    gint localport;
124
130
 
125
131
    gint remotedisplay;
126
132
    gboolean bindlocalhost;
139
145
 * dest: The host:port of the remote destination
140
146
 * local_port: The listening local port for the tunnel
141
147
 */
142
 
gboolean remmina_ssh_tunnel_open (RemminaSSHTunnel *tunnel, const gchar *dest, gint local_port);
 
148
gboolean remmina_ssh_tunnel_open (RemminaSSHTunnel *tunnel, const gchar *host, gint port, gint local_port);
143
149
 
144
150
/* Accept the X11 tunnel. A new thread will be started and connect to local display.
145
151
 * cmd: The remote X11 application to be executed
149
155
/* start X Port Forwarding */
150
156
gboolean remmina_ssh_tunnel_xport (RemminaSSHTunnel *tunnel, gboolean bindlocalhost);
151
157
 
 
158
/* start reverse tunnel. A new thread will be started and waiting for incoming connection.
 
159
 * port: the port listening on the remote server side.
 
160
 * local_port: the port listening on the local side. When connection on the server side comes
 
161
 *             in, it will connect to the local port and create the tunnel. The caller should
 
162
 *             start listening on the local port before calling it or in connect_func callback.
 
163
 */
 
164
gboolean remmina_ssh_tunnel_reverse (RemminaSSHTunnel *tunnel, gint port, gint local_port);
 
165
 
152
166
/* Tells if the tunnel is terminated after start */
153
167
gboolean remmina_ssh_tunnel_terminated (RemminaSSHTunnel *tunnel);
154
168
 
176
190
/* Free the SFTP session */
177
191
void remmina_sftp_free (RemminaSFTP *sftp);
178
192
 
179
 
/*----------------------- SSH Terminal ------------------------*/
 
193
/*----------------------- SSH Shell ------------------------*/
 
194
typedef void (*RemminaSSHExitFunc) (gpointer data);
180
195
 
181
 
typedef struct _RemminaSSHTerminal
 
196
typedef struct _RemminaSSHShell
182
197
{
183
198
    RemminaSSH ssh;
184
199
 
185
200
    gint master;
186
201
    gint slave;
 
202
    gchar *exec;
187
203
    pthread_t thread;
188
 
    GtkWidget *window;
 
204
    ssh_channel channel;
189
205
    gboolean closed;
190
 
} RemminaSSHTerminal;
191
 
 
192
 
/* Create a new SSH Terminal session object from existing SSH session */
193
 
RemminaSSHTerminal* remmina_ssh_terminal_new_from_ssh (RemminaSSH *ssh);
194
 
 
195
 
/* open the SSH Terminal (init -> auth -> term) */
196
 
gboolean remmina_ssh_terminal_open (RemminaSSHTerminal *term);
 
206
    RemminaSSHExitFunc exit_callback;
 
207
    gpointer user_data;
 
208
} RemminaSSHShell;
 
209
 
 
210
/* Create a new SSH Shell session object from RemminaFile */
 
211
RemminaSSHShell* remmina_ssh_shell_new_from_file (RemminaFile *remminafile);
 
212
 
 
213
/* Create a new SSH Shell session object from existing SSH session */
 
214
RemminaSSHShell* remmina_ssh_shell_new_from_ssh (RemminaSSH *ssh);
 
215
 
 
216
/* open the SSH Shell, assuming the session already authenticated */
 
217
gboolean remmina_ssh_shell_open (RemminaSSHShell *shell, RemminaSSHExitFunc exit_callback, gpointer data);
 
218
 
 
219
/* Change the SSH Shell terminal size */
 
220
void remmina_ssh_shell_set_size (RemminaSSHShell *shell, gint columns, gint rows);
 
221
 
 
222
/* Free the SFTP session */
 
223
void remmina_ssh_shell_free (RemminaSSHShell *shell);
197
224
 
198
225
G_END_DECLS
199
226
 
202
229
#define RemminaSSH void
203
230
#define RemminaSSHTunnel void
204
231
#define RemminaSFTP void
205
 
#define RemminaTerminal void
 
232
#define RemminaSSHShell void
206
233
typedef void (*RemminaSSHTunnelCallback) (void);
207
234
 
208
235
#endif /* HAVE_LIBSSH */