remmina_protocol_widget.h 7.07 KB
Newer Older
1 2
/*
 * Remmina - The GTK+ Remote Desktop Client
llyzs's avatar
llyzs committed
3
 * Copyright (C) 2009-2011 Vic Lee
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, 
 * Boston, MA 02111-1307, USA.
 */
 

#ifndef __REMMINAPROTOCOLWIDGET_H__
#define __REMMINAPROTOCOLWIDGET_H__

25 26 27
#include "remmina_init_dialog.h"
#include "remmina_file.h"
#include "remmina_ssh.h"
28 29 30

G_BEGIN_DECLS

31 32 33
#define REMMINA_PROTOCOL_FEATURE_TOOL_SSH  -1
#define REMMINA_PROTOCOL_FEATURE_TOOL_SFTP -2

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#define REMMINA_TYPE_PROTOCOL_WIDGET                  (remmina_protocol_widget_get_type ())
#define REMMINA_PROTOCOL_WIDGET(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), REMMINA_TYPE_PROTOCOL_WIDGET, RemminaProtocolWidget))
#define REMMINA_PROTOCOL_WIDGET_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), REMMINA_TYPE_PROTOCOL_WIDGET, RemminaProtocolWidgetClass))
#define REMMINA_IS_PROTOCOL_WIDGET(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), REMMINA_TYPE_PROTOCOL_WIDGET))
#define REMMINA_IS_PROTOCOL_WIDGET_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), REMMINA_TYPE_PROTOCOL_WIDGET))
#define REMMINA_PROTOCOL_WIDGET_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), REMMINA_TYPE_PROTOCOL_WIDGET, RemminaProtocolWidgetClass))

typedef struct _RemminaProtocolWidgetPriv RemminaProtocolWidgetPriv;

struct _RemminaProtocolWidget
{
    GtkEventBox event_box;

    RemminaProtocolWidgetPriv *priv;
};

struct _RemminaProtocolWidgetClass
{
    GtkEventBoxClass parent_class;

    void (* connect) (RemminaProtocolWidget *gp);
    void (* disconnect) (RemminaProtocolWidget *gp);
    void (* desktop_resize) (RemminaProtocolWidget *gp);
57
    void (* update_align) (RemminaProtocolWidget *gp);
58 59 60 61 62 63
};

GType remmina_protocol_widget_get_type (void) G_GNUC_CONST;

GtkWidget* remmina_protocol_widget_new (void);

64 65
GtkWidget* remmina_protocol_widget_get_init_dialog (RemminaProtocolWidget *gp);

66 67 68 69 70 71
gint remmina_protocol_widget_get_width (RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_width (RemminaProtocolWidget *gp, gint width);
gint remmina_protocol_widget_get_height (RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_height (RemminaProtocolWidget *gp, gint height);
gboolean remmina_protocol_widget_get_scale (RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_scale (RemminaProtocolWidget *gp, gboolean scale);
72 73
gboolean remmina_protocol_widget_get_expand (RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_expand (RemminaProtocolWidget *gp, gboolean expand);
74 75 76 77 78 79 80 81 82
gboolean remmina_protocol_widget_has_error (RemminaProtocolWidget *gp);
gchar* remmina_protocol_widget_get_error_message (RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_error (RemminaProtocolWidget *gp, const gchar *fmt, ...);
gboolean remmina_protocol_widget_is_closed (RemminaProtocolWidget *gp);
RemminaFile* remmina_protocol_widget_get_file (RemminaProtocolWidget *gp);

void remmina_protocol_widget_open_connection (RemminaProtocolWidget *gp, RemminaFile *remminafile);
gboolean remmina_protocol_widget_close_connection (RemminaProtocolWidget *gp);
void remmina_protocol_widget_grab_focus (RemminaProtocolWidget *gp);
83 84 85 86 87 88
const RemminaProtocolFeature* remmina_protocol_widget_get_features (RemminaProtocolWidget *gp);
const gchar* remmina_protocol_widget_get_domain (RemminaProtocolWidget *gp);
gboolean remmina_protocol_widget_query_feature_by_type (RemminaProtocolWidget *gp, RemminaProtocolFeatureType type);
gboolean remmina_protocol_widget_query_feature_by_ref (RemminaProtocolWidget *gp, const RemminaProtocolFeature *feature);
void remmina_protocol_widget_call_feature_by_type (RemminaProtocolWidget *gp, RemminaProtocolFeatureType type, gint id);
void remmina_protocol_widget_call_feature_by_ref (RemminaProtocolWidget *gp, const RemminaProtocolFeature *feature);
89 90
/* Provide thread-safe way to emit signals */
void remmina_protocol_widget_emit_signal (RemminaProtocolWidget *gp, const gchar *signal);
91 92
void remmina_protocol_widget_register_hostkey (RemminaProtocolWidget *gp, GtkWidget *widget);

93
typedef gboolean (*RemminaHostkeyFunc) (RemminaProtocolWidget *gp, guint keyval, gboolean release, gpointer data);
94
void remmina_protocol_widget_set_hostkey_func (RemminaProtocolWidget *gp, RemminaHostkeyFunc func, gpointer data);
95

96
gboolean remmina_protocol_widget_ssh_exec (RemminaProtocolWidget *gp, gboolean wait, const gchar *fmt, ...);
97 98 99 100 101

/* Start a SSH tunnel if it's enabled. Returns a newly allocated string indicating:
 * 1. The actual destination (host:port) if SSH tunnel is disable
 * 2. The tunnel local destination (127.0.0.1:port) if SSH tunnel is enabled
 */
102
gchar* remmina_protocol_widget_start_direct_tunnel (RemminaProtocolWidget *gp, gint default_port, gboolean port_plus);
103

104
gboolean remmina_protocol_widget_start_reverse_tunnel (RemminaProtocolWidget *gp, gint local_port);
105 106
gboolean remmina_protocol_widget_start_xport_tunnel (RemminaProtocolWidget *gp, RemminaXPortTunnelInitFunc init_func);
void remmina_protocol_widget_set_display (RemminaProtocolWidget *gp, gint display);
107

108
gint remmina_protocol_widget_init_authpwd (RemminaProtocolWidget *gp, RemminaAuthpwdType authpwd_type);
llyzs's avatar
llyzs committed
109
gint remmina_protocol_widget_init_authuserpwd (RemminaProtocolWidget *gp, gboolean want_domain);
110 111
gchar* remmina_protocol_widget_init_get_username (RemminaProtocolWidget *gp);
gchar* remmina_protocol_widget_init_get_password (RemminaProtocolWidget *gp);
llyzs's avatar
llyzs committed
112
gchar* remmina_protocol_widget_init_get_domain (RemminaProtocolWidget *gp);
113 114 115 116 117 118 119 120
gint remmina_protocol_widget_init_authx509 (RemminaProtocolWidget *gp);
gchar* remmina_protocol_widget_init_get_cacert (RemminaProtocolWidget *gp);
gchar* remmina_protocol_widget_init_get_cacrl (RemminaProtocolWidget *gp);
gchar* remmina_protocol_widget_init_get_clientcert (RemminaProtocolWidget *gp);
gchar* remmina_protocol_widget_init_get_clientkey (RemminaProtocolWidget *gp);
void remmina_protocol_widget_init_save_cred (RemminaProtocolWidget *gp);
void remmina_protocol_widget_init_show_listen (RemminaProtocolWidget *gp, gint port);
void remmina_protocol_widget_init_show_retry (RemminaProtocolWidget *gp);
121 122
void remmina_protocol_widget_init_show (RemminaProtocolWidget *gp);
void remmina_protocol_widget_init_hide (RemminaProtocolWidget *gp);
123 124 125 126 127 128 129 130 131 132 133

void remmina_protocol_widget_chat_open (RemminaProtocolWidget *gp, const gchar *name,
    void(*on_send)(RemminaProtocolWidget *gp, const gchar *text),
    void(*on_destroy)(RemminaProtocolWidget *gp));
void remmina_protocol_widget_chat_close (RemminaProtocolWidget *gp);
void remmina_protocol_widget_chat_receive (RemminaProtocolWidget *gp, const gchar *text);

G_END_DECLS

#endif  /* __REMMINAPROTOCOLWIDGET_H__  */