Remmina - The GTK+ Remote Desktop Client  v1.4.33
Remmina is a remote desktop client written in GTK+, aiming to be useful for system administrators and travellers, who need to work with lots of remote computers in front of either large monitors or tiny netbooks. Remmina supports multiple network protocols in an integrated and consistent user interface. Currently RDP, VNC, NX, XDMCP and SSH are supported.
python_wrapper_protocol_widget.c
Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2014-2023 Antenore Gatta, Giovanni Panozzo
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  * In addition, as a special exception, the copyright holders give
21  * permission to link the code of portions of this program with the
22  * OpenSSL library under certain conditions as described in each
23  * individual source file, and distribute linked combinations
24  * including the two.
25  * You must obey the GNU General Public License in all respects
26  * for all of the code used other than OpenSSL. * If you modify
27  * file(s) with this exception, you may extend this exception to your
28  * version of the file(s), but you are not obligated to do so. * If you
29  * do not wish to do so, delete this exception statement from your
30  * version. * If you delete this exception statement from all source
31  * files in the program, then also delete it here.
32  */
33 
85 // I N L U C E S
88 
89 #include "python_wrapper_common.h"
90 #include "remmina/plugin.h"
91 #include "remmina/types.h"
95 
96 // -- Python Type -> RemminaWidget
97 
99 // D E C L A R A T I O N S
101 
102 static PyObject* protocol_widget_get_viewport(PyRemminaProtocolWidget* self, PyObject* args);
103 static PyObject* protocol_widget_get_width(PyRemminaProtocolWidget* self, PyObject* args);
104 static PyObject* protocol_widget_set_width(PyRemminaProtocolWidget* self, PyObject* var_width);
105 static PyObject* protocol_widget_get_height(PyRemminaProtocolWidget* self, PyObject* args);
106 static PyObject* protocol_widget_set_height(PyRemminaProtocolWidget* self, PyObject* var_height);
107 static PyObject* protocol_widget_get_current_scale_mode(PyRemminaProtocolWidget* self, PyObject* args);
108 static PyObject* protocol_widget_get_expand(PyRemminaProtocolWidget* self, PyObject* args);
109 static PyObject* protocol_widget_set_expand(PyRemminaProtocolWidget* self, PyObject* var_expand);
110 static PyObject* protocol_widget_has_error(PyRemminaProtocolWidget* self, PyObject* args);
111 static PyObject* protocol_widget_set_error(PyRemminaProtocolWidget* self, PyObject* var_msg);
112 static PyObject* protocol_widget_is_closed(PyRemminaProtocolWidget* self, PyObject* args);
113 static PyObject* protocol_widget_get_file(PyRemminaProtocolWidget* self, PyObject* args);
114 static PyObject* protocol_widget_emit_signal(PyRemminaProtocolWidget* self, PyObject* var_signal);
115 static PyObject* protocol_widget_register_hostkey(PyRemminaProtocolWidget* self, PyObject* var_widget);
116 static PyObject* protocol_widget_start_direct_tunnel(PyRemminaProtocolWidget* self, PyObject* args);
117 static PyObject* protocol_widget_start_reverse_tunnel(PyRemminaProtocolWidget* self, PyObject* var_local_port);
118 static PyObject* protocol_widget_start_xport_tunnel(PyRemminaProtocolWidget* self, PyObject* args);
119 static PyObject* protocol_widget_set_display(PyRemminaProtocolWidget* self, PyObject* var_display);
120 static PyObject* protocol_widget_signal_connection_closed(PyRemminaProtocolWidget* self, PyObject* args);
121 static PyObject* protocol_widget_signal_connection_opened(PyRemminaProtocolWidget* self, PyObject* args);
122 static PyObject* protocol_widget_update_align(PyRemminaProtocolWidget* self, PyObject* args);
123 static PyObject* protocol_widget_unlock_dynres(PyRemminaProtocolWidget* self, PyObject* args);
124 static PyObject* protocol_widget_desktop_resize(PyRemminaProtocolWidget* self, PyObject* args);
125 static PyObject* protocol_widget_panel_new_certificate(PyRemminaProtocolWidget* self, PyObject* args);
126 static PyObject* protocol_widget_panel_changed_certificate(PyRemminaProtocolWidget* self, PyObject* args);
127 static PyObject* protocol_widget_get_username(PyRemminaProtocolWidget* self, PyObject* args);
128 static PyObject* protocol_widget_get_password(PyRemminaProtocolWidget* self, PyObject* args);
129 static PyObject* protocol_widget_get_domain(PyRemminaProtocolWidget* self, PyObject* args);
130 static PyObject* protocol_widget_get_savepassword(PyRemminaProtocolWidget* self, PyObject* args);
131 static PyObject* protocol_widget_panel_authx509(PyRemminaProtocolWidget* self, PyObject* args);
132 static PyObject* protocol_widget_get_cacert(PyRemminaProtocolWidget* self, PyObject* args);
133 static PyObject* protocol_widget_get_cacrl(PyRemminaProtocolWidget* self, PyObject* args);
134 static PyObject* protocol_widget_get_clientcert(PyRemminaProtocolWidget* self, PyObject* args);
135 static PyObject* protocol_widget_get_clientkey(PyRemminaProtocolWidget* self, PyObject* args);
136 static PyObject* protocol_widget_save_cred(PyRemminaProtocolWidget* self, PyObject* args);
137 static PyObject* protocol_widget_panel_show_listen(PyRemminaProtocolWidget* self, PyObject* args);
138 static PyObject* protocol_widget_panel_show_retry(PyRemminaProtocolWidget* self, PyObject* args);
139 static PyObject* protocol_widget_panel_show(PyRemminaProtocolWidget* self, PyObject* args);
140 static PyObject* protocol_widget_panel_hide(PyRemminaProtocolWidget* self, PyObject* args);
141 static PyObject* protocol_widget_ssh_exec(PyRemminaProtocolWidget* self, PyObject* args);
142 static PyObject* protocol_widget_chat_open(PyRemminaProtocolWidget* self, PyObject* var_name);
143 static PyObject* protocol_widget_chat_close(PyRemminaProtocolWidget* self, PyObject* args);
144 static PyObject* protocol_widget_chat_receive(PyRemminaProtocolWidget* self, PyObject* args);
145 static PyObject* protocol_widget_send_keys_signals(PyRemminaProtocolWidget* self, PyObject* args);
146 
147 static struct PyMethodDef python_protocol_widget_type_methods[] =
148  {{ "get_viewport", (PyCFunction)protocol_widget_get_viewport, METH_NOARGS, "" },
149  { "get_width", (PyCFunction)protocol_widget_get_width, METH_NOARGS, "" },
150  { "set_width", (PyCFunction)protocol_widget_set_width, METH_VARARGS, "" },
151  { "get_height", (PyCFunction)protocol_widget_get_height, METH_VARARGS, "" },
152  { "set_height", (PyCFunction)protocol_widget_set_height, METH_VARARGS, "" },
153  { "get_current_scale_mode", (PyCFunction)protocol_widget_get_current_scale_mode, METH_VARARGS, "" },
154  { "get_expand", (PyCFunction)protocol_widget_get_expand, METH_VARARGS, "" },
155  { "set_expand", (PyCFunction)protocol_widget_set_expand, METH_VARARGS, "" },
156  { "has_error", (PyCFunction)protocol_widget_has_error, METH_VARARGS, "" },
157  { "set_error", (PyCFunction)protocol_widget_set_error, METH_VARARGS, "" },
158  { "is_closed", (PyCFunction)protocol_widget_is_closed, METH_VARARGS, "" },
159  { "get_file", (PyCFunction)protocol_widget_get_file, METH_NOARGS, "" },
160  { "emit_signal", (PyCFunction)protocol_widget_emit_signal, METH_VARARGS, "" },
161  { "register_hostkey", (PyCFunction)protocol_widget_register_hostkey, METH_VARARGS, "" },
162  { "start_direct_tunnel", (PyCFunction)protocol_widget_start_direct_tunnel, METH_VARARGS | METH_KEYWORDS, "" },
163  { "start_reverse_tunnel", (PyCFunction)protocol_widget_start_reverse_tunnel, METH_VARARGS, "" },
164  { "start_xport_tunnel", (PyCFunction)protocol_widget_start_xport_tunnel, METH_VARARGS, "" },
165  { "set_display", (PyCFunction)protocol_widget_set_display, METH_VARARGS, "" },
166  { "signal_connection_closed", (PyCFunction)protocol_widget_signal_connection_closed, METH_VARARGS, "" },
167  { "signal_connection_opened", (PyCFunction)protocol_widget_signal_connection_opened, METH_VARARGS, "" },
168  { "update_align", (PyCFunction)protocol_widget_update_align, METH_VARARGS, "" },
169  { "unlock_dynres", (PyCFunction)protocol_widget_unlock_dynres, METH_VARARGS, "" },
170  { "desktop_resize", (PyCFunction)protocol_widget_desktop_resize, METH_VARARGS, "" },
171  { "panel_new_certificate", (PyCFunction)protocol_widget_panel_new_certificate, METH_VARARGS | METH_KEYWORDS, "" },
172  { "panel_changed_certificate", (PyCFunction)protocol_widget_panel_changed_certificate,
173  METH_VARARGS | METH_KEYWORDS, "" },
174  { "get_username", (PyCFunction)protocol_widget_get_username, METH_VARARGS, "" },
175  { "get_password", (PyCFunction)protocol_widget_get_password, METH_VARARGS, "" },
176  { "get_domain", (PyCFunction)protocol_widget_get_domain, METH_VARARGS, "" },
177  { "get_savepassword", (PyCFunction)protocol_widget_get_savepassword, METH_VARARGS, "" },
178  { "panel_authx509", (PyCFunction)protocol_widget_panel_authx509, METH_VARARGS, "" },
179  { "get_cacert", (PyCFunction)protocol_widget_get_cacert, METH_VARARGS, "" },
180  { "get_cacrl", (PyCFunction)protocol_widget_get_cacrl, METH_VARARGS, "" },
181  { "get_clientcert", (PyCFunction)protocol_widget_get_clientcert, METH_VARARGS, "" },
182  { "get_clientkey", (PyCFunction)protocol_widget_get_clientkey, METH_VARARGS, "" },
183  { "save_cred", (PyCFunction)protocol_widget_save_cred, METH_VARARGS, "" },
184  { "panel_show_listen", (PyCFunction)protocol_widget_panel_show_listen, METH_VARARGS, "" },
185  { "panel_show_retry", (PyCFunction)protocol_widget_panel_show_retry, METH_VARARGS, "" },
186  { "panel_show", (PyCFunction)protocol_widget_panel_show, METH_VARARGS, "" },
187  { "panel_hide", (PyCFunction)protocol_widget_panel_hide, METH_VARARGS, "" },
188  { "ssh_exec", (PyCFunction)protocol_widget_ssh_exec, METH_VARARGS | METH_KEYWORDS, "" },
189  { "chat_open", (PyCFunction)protocol_widget_chat_open, METH_VARARGS, "" },
190  { "chat_close", (PyCFunction)protocol_widget_chat_close, METH_VARARGS, "" },
191  { "chat_receive", (PyCFunction)protocol_widget_chat_receive, METH_VARARGS, "" },
192  { "send_keys_signals", (PyCFunction)protocol_widget_send_keys_signals, METH_VARARGS | METH_KEYWORDS, "" },
193  { NULL }};
194 
196 // A P I
198 
199 static PyObject* python_protocol_feature_new(PyTypeObject* type, PyObject* kws, PyObject* args)
200 {
201  TRACE_CALL(__func__);
203  self = (PyRemminaProtocolWidget*)type->tp_alloc(type, 0);
204  if (!self)
205  {
206  return NULL;
207  }
208 
209  return (PyObject*)self;
210 }
211 
212 static int python_protocol_feature_init(PyObject* self, PyObject* args, PyObject* kwds)
213 {
214  return 0;
215 }
216 
217 static PyTypeObject python_protocol_widget_type = {
218  PyVarObject_HEAD_INIT(NULL, 0)
219  .tp_name = "remmina.RemminaProtocolWidget",
220  .tp_doc = "RemminaProtocolWidget",
221  .tp_basicsize = sizeof(PyRemminaProtocolWidget),
222  .tp_itemsize = 0,
223  .tp_flags = Py_TPFLAGS_DEFAULT,
224  .tp_new = python_protocol_feature_new,
225  .tp_init = python_protocol_feature_init,
227 };
228 
230 {
231  TRACE_CALL(__func__);
232 
234  assert(result);
235 
236  PyErr_Print();
237  Py_INCREF(result);
238  result->gp = NULL;
239  return result;
240 }
241 
243 {
244  init_pygobject();
245 }
246 
248 {
249  TRACE_CALL(__func__);
250  if (PyType_Ready(&python_protocol_widget_type) < 0)
251  {
252  g_printerr("Error initializing remmina.RemminaWidget!\n");
253  PyErr_Print();
254  }
255 }
256 
257 static PyObject* protocol_widget_get_viewport(PyRemminaProtocolWidget* self, PyObject* args)
258 {
259  TRACE_CALL(__func__);
260  SELF_CHECK();
261  return (PyObject*)new_pywidget(G_OBJECT(python_wrapper_get_service()->protocol_widget_gtkviewport(self->gp)));
262 }
263 
264 static PyObject* protocol_widget_get_width(PyRemminaProtocolWidget* self, PyObject* args)
265 {
266  TRACE_CALL(__func__);
267  SELF_CHECK();
268 
269  return Py_BuildValue("i", python_wrapper_get_service()->protocol_widget_get_width(self->gp));
270 }
271 
272 static PyObject* protocol_widget_set_width(PyRemminaProtocolWidget* self, PyObject* var_width)
273 {
274  TRACE_CALL(__func__);
275  SELF_CHECK();
276 
277  if (!var_width)
278  {
279  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
280  return NULL;
281  }
282 
283  if (PyLong_Check(var_width))
284  {
285  g_printerr("[%s:%d@%s]: Argument is not of type Long!\n", __FILE__, __LINE__, __func__);
286  return NULL;
287  }
288 
289  gint width = (gint)PyLong_AsLong(var_width);
291 
292  return Py_None;
293 }
294 
295 static PyObject* protocol_widget_get_height(PyRemminaProtocolWidget* self, PyObject* args)
296 {
297  TRACE_CALL(__func__);
298  SELF_CHECK();
299 
300  return Py_BuildValue("i", python_wrapper_get_service()->protocol_widget_get_height(self->gp));
301 }
302 
303 static PyObject* protocol_widget_set_height(PyRemminaProtocolWidget* self, PyObject* var_height)
304 {
305  TRACE_CALL(__func__);
306  SELF_CHECK();
307 
308  if (!var_height)
309  {
310  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
311  return NULL;
312  }
313 
314  if (PyLong_Check(var_height))
315  {
316  g_printerr("[%s:%d@%s]: Argument is not of type Long!\n", __FILE__, __LINE__, __func__);
317  return NULL;
318  }
319 
320  gint height = (gint)PyLong_AsLong(var_height);
322 
323  return Py_None;
324 }
325 
327 {
328  TRACE_CALL(__func__);
329  SELF_CHECK();
330 
331  return Py_BuildValue("i", python_wrapper_get_service()->protocol_widget_get_current_scale_mode(self->gp));
332 }
333 
334 static PyObject* protocol_widget_get_expand(PyRemminaProtocolWidget* self, PyObject* args)
335 {
336  TRACE_CALL(__func__);
337  SELF_CHECK();
338 
339  return Py_BuildValue("p", python_wrapper_get_service()->protocol_widget_get_expand(self->gp));
340 }
341 
342 static PyObject* protocol_widget_set_expand(PyRemminaProtocolWidget* self, PyObject* var_expand)
343 {
344  TRACE_CALL(__func__);
345  SELF_CHECK();
346 
347  if (!var_expand)
348  {
349  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
350  return NULL;
351  }
352 
353  if (PyBool_Check(var_expand))
354  {
355  g_printerr("[%s:%d@%s]: Argument is not of type Boolean!\n", __FILE__, __LINE__, __func__);
356  return NULL;
357  }
358 
359  python_wrapper_get_service()->protocol_widget_set_expand(self->gp, PyObject_IsTrue(var_expand));
360 
361  return Py_None;
362 }
363 
364 static PyObject* protocol_widget_has_error(PyRemminaProtocolWidget* self, PyObject* args)
365 {
366  TRACE_CALL(__func__);
367  SELF_CHECK();
368 
369  return Py_BuildValue("p", python_wrapper_get_service()->protocol_widget_has_error(self->gp));
370 }
371 
372 static PyObject* protocol_widget_set_error(PyRemminaProtocolWidget* self, PyObject* var_msg)
373 {
374  TRACE_CALL(__func__);
375  SELF_CHECK();
376 
377  if (!var_msg)
378  {
379  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
380  return NULL;
381  }
382 
383  if (PyUnicode_Check(var_msg))
384  {
385  g_printerr("[%s:%d@%s]: Argument is not of type String!\n", __FILE__, __LINE__, __func__);
386  return NULL;
387  }
388 
389  const gchar* msg = PyUnicode_AsUTF8(var_msg);
391 
392  return Py_None;
393 }
394 
395 static PyObject* protocol_widget_is_closed(PyRemminaProtocolWidget* self, PyObject* args)
396 {
397  TRACE_CALL(__func__);
398  SELF_CHECK();
399 
400  return Py_BuildValue("p", python_wrapper_get_service()->protocol_widget_is_closed(self->gp));
401 }
402 
403 static PyObject* protocol_widget_get_file(PyRemminaProtocolWidget* self, PyObject* args)
404 {
405  TRACE_CALL(__func__);
406  SELF_CHECK();
407 
409  return (PyObject*)python_wrapper_remmina_file_to_python(file);
410 }
411 
412 static PyObject* protocol_widget_emit_signal(PyRemminaProtocolWidget* self, PyObject* var_signal)
413 {
414  TRACE_CALL(__func__);
415  SELF_CHECK();
416 
417  if (!var_signal)
418  {
419  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
420  return NULL;
421  }
422 
423  if (PyUnicode_Check(var_signal))
424  {
425  g_printerr("[%s:%d@%s]: Argument is not of type String!\n", __FILE__, __LINE__, __func__);
426  return NULL;
427  }
428 
429  python_wrapper_get_service()->protocol_widget_set_error(self->gp, PyUnicode_AsUTF8(var_signal));
430 
431  return Py_None;
432 }
433 
434 static PyObject* protocol_widget_register_hostkey(PyRemminaProtocolWidget* self, PyObject* var_widget)
435 {
436  TRACE_CALL(__func__);
437  SELF_CHECK();
438 
439  if (!var_widget)
440  {
441  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
442  return NULL;
443  }
444 
446 
447  return Py_None;
448 }
449 
450 static PyObject* protocol_widget_start_direct_tunnel(PyRemminaProtocolWidget* self, PyObject* args)
451 {
452  TRACE_CALL(__func__);
453  SELF_CHECK();
454 
455  gint default_port;
456  gboolean port_plus;
457 
458  if (!args)
459  {
460  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
461  }
462 
463  if (PyArg_ParseTuple(args, "ii", &default_port, &port_plus))
464  {
465  return Py_BuildValue("s", python_wrapper_get_service()->protocol_widget_start_direct_tunnel(self->gp, default_port, port_plus));
466  }
467  else
468  {
469  PyErr_Print();
470  return NULL;
471  }
472  return Py_None;
473 }
474 
475 static PyObject* protocol_widget_start_reverse_tunnel(PyRemminaProtocolWidget* self, PyObject* var_local_port)
476 {
477  TRACE_CALL(__func__);
478  SELF_CHECK();
479 
480  if (!PyLong_Check(var_local_port))
481  {
482  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
483  return NULL;
484  }
485 
486  if (!PyLong_Check(var_local_port))
487  {
488  g_printerr("[%s:%d@%s]: Argument is not of type Long!\n", __FILE__, __LINE__, __func__);
489  return NULL;
490  }
491 
492  return Py_BuildValue("p", python_wrapper_get_service()->protocol_widget_start_reverse_tunnel(self->gp, (gint)PyLong_AsLong(var_local_port)));
493 }
494 
495 static gboolean xport_tunnel_init(RemminaProtocolWidget* gp, gint remotedisplay, const gchar* server, gint port)
496 {
497  TRACE_CALL(__func__);
499  PyObject* result = PyObject_CallMethod(plugin->instance, "xport_tunnel_init", "Oisi", gp, remotedisplay, server, port);
500  return PyObject_IsTrue(result);
501 }
502 
503 static PyObject* protocol_widget_start_xport_tunnel(PyRemminaProtocolWidget* self, PyObject* args)
504 {
505  TRACE_CALL(__func__);
506  SELF_CHECK();
507 
509 }
510 
511 static PyObject* protocol_widget_set_display(PyRemminaProtocolWidget* self, PyObject* var_display)
512 {
513  TRACE_CALL(__func__);
514  SELF_CHECK();
515 
516  if (!var_display)
517  {
518  g_printerr("[%s:%d@%s]: Argument is null!\n", __FILE__, __LINE__, __func__);
519  return NULL;
520  }
521 
522  if (!PyLong_Check(var_display))
523  {
524  g_printerr("[%s:%d@%s]: Argument is not of type Long!\n", __FILE__, __LINE__, __func__);
525  return NULL;
526  }
527 
528  python_wrapper_get_service()->protocol_widget_set_display(self->gp, (gint)PyLong_AsLong(var_display));
529 
530  return Py_None;
531 }
532 
534 {
535  TRACE_CALL(__func__);
536  SELF_CHECK();
537 
539  return Py_None;
540 }
541 
543 {
544  TRACE_CALL(__func__);
545  SELF_CHECK();
546 
548  return Py_None;
549 }
550 
551 static PyObject* protocol_widget_update_align(PyRemminaProtocolWidget* self, PyObject* args)
552 {
553  TRACE_CALL(__func__);
554  SELF_CHECK();
555 
557  return Py_None;
558 }
559 
560 static PyObject* protocol_widget_unlock_dynres(PyRemminaProtocolWidget* self, PyObject* args)
561 {
562  TRACE_CALL(__func__);
563  SELF_CHECK();
564 
566  return Py_None;
567 }
568 
569 static PyObject* protocol_widget_desktop_resize(PyRemminaProtocolWidget* self, PyObject* args)
570 {
571  TRACE_CALL(__func__);
572  SELF_CHECK();
573 
575  return Py_None;
576 }
577 
578 static PyObject* protocol_widget_panel_new_certificate(PyRemminaProtocolWidget* self, PyObject* args)
579 {
580  TRACE_CALL(__func__);
581  SELF_CHECK();
582  gchar* subject, * issuer, * fingerprint;
583 
584  if (PyArg_ParseTuple(args, "sss", &subject, &issuer, &fingerprint))
585  {
586  python_wrapper_get_service()->protocol_widget_panel_new_certificate(self->gp, subject, issuer, fingerprint);
587  }
588  else
589  {
590  PyErr_Print();
591  return NULL;
592  }
593  return Py_None;
594 }
595 
597 {
598  TRACE_CALL(__func__);
599  SELF_CHECK();
600  gchar* subject, * issuer, * new_fingerprint, * old_fingerprint;
601 
602  if (PyArg_ParseTuple(args, "sss", &subject, &issuer, &new_fingerprint, &old_fingerprint))
603  {
604  python_wrapper_get_service()->protocol_widget_panel_changed_certificate(self->gp, subject, issuer, new_fingerprint, old_fingerprint);
605  }
606  else
607  {
608  PyErr_Print();
609  return NULL;
610  }
611  return Py_None;
612 }
613 
614 static PyObject* protocol_widget_get_username(PyRemminaProtocolWidget* self, PyObject* args)
615 {
616  TRACE_CALL(__func__);
617  SELF_CHECK();
618 
619  return Py_BuildValue("s", python_wrapper_get_service()->protocol_widget_get_username(self->gp));
620 }
621 
622 static PyObject* protocol_widget_get_password(PyRemminaProtocolWidget* self, PyObject* args)
623 {
624  TRACE_CALL(__func__);
625  SELF_CHECK();
626 
627  return Py_BuildValue("s", python_wrapper_get_service()->protocol_widget_get_password(self->gp));
628 }
629 
630 static PyObject* protocol_widget_get_domain(PyRemminaProtocolWidget* self, PyObject* args)
631 {
632  TRACE_CALL(__func__);
633  SELF_CHECK();
634 
635  return Py_BuildValue("s", python_wrapper_get_service()->protocol_widget_get_domain(self->gp));
636 }
637 
638 static PyObject* protocol_widget_get_savepassword(PyRemminaProtocolWidget* self, PyObject* args)
639 {
640  TRACE_CALL(__func__);
641  SELF_CHECK();
642 
643  return Py_BuildValue("p", python_wrapper_get_service()->protocol_widget_get_savepassword(self->gp));
644 }
645 
646 static PyObject* protocol_widget_panel_authx509(PyRemminaProtocolWidget* self, PyObject* args)
647 {
648  TRACE_CALL(__func__);
649  SELF_CHECK();
650 
651  return Py_BuildValue("i", python_wrapper_get_service()->protocol_widget_panel_authx509(self->gp));
652 }
653 
654 static PyObject* protocol_widget_get_cacert(PyRemminaProtocolWidget* self, PyObject* args)
655 {
656  TRACE_CALL(__func__);
657  SELF_CHECK();
658 
659  return Py_BuildValue("s", python_wrapper_get_service()->protocol_widget_get_cacert(self->gp));
660 }
661 
662 static PyObject* protocol_widget_get_cacrl(PyRemminaProtocolWidget* self, PyObject* args)
663 {
664  TRACE_CALL(__func__);
665  SELF_CHECK();
666 
667  return Py_BuildValue("s", python_wrapper_get_service()->protocol_widget_get_cacrl(self->gp));
668 }
669 
670 static PyObject* protocol_widget_get_clientcert(PyRemminaProtocolWidget* self, PyObject* args)
671 {
672  TRACE_CALL(__func__);
673  SELF_CHECK();
674 
675  return Py_BuildValue("s", python_wrapper_get_service()->protocol_widget_get_clientcert(self->gp));
676 }
677 
678 static PyObject* protocol_widget_get_clientkey(PyRemminaProtocolWidget* self, PyObject* args)
679 {
680  TRACE_CALL(__func__);
681  SELF_CHECK();
682 
683  return Py_BuildValue("s", python_wrapper_get_service()->protocol_widget_get_clientkey(self->gp));
684 }
685 
686 static PyObject* protocol_widget_save_cred(PyRemminaProtocolWidget* self, PyObject* args)
687 {
688  TRACE_CALL(__func__);
689  SELF_CHECK();
690 
692  return Py_None;
693 }
694 
695 static PyObject* protocol_widget_panel_show_listen(PyRemminaProtocolWidget* self, PyObject* args)
696 {
697  TRACE_CALL(__func__);
698  SELF_CHECK();
699  gint port = 0;
700 
701  if (PyArg_ParseTuple(args, "i", &port))
702  {
704  }
705  else
706  {
707  PyErr_Print();
708  return NULL;
709  }
710  return Py_None;
711 }
712 
713 static PyObject* protocol_widget_panel_show_retry(PyRemminaProtocolWidget* self, PyObject* args)
714 {
715  TRACE_CALL(__func__);
716  SELF_CHECK();
717 
719  return Py_None;
720 }
721 
722 static PyObject* protocol_widget_panel_show(PyRemminaProtocolWidget* self, PyObject* args)
723 {
724  TRACE_CALL(__func__);
725  SELF_CHECK();
726 
728  return Py_None;
729 }
730 
731 static PyObject* protocol_widget_panel_hide(PyRemminaProtocolWidget* self, PyObject* args)
732 {
733  TRACE_CALL(__func__);
734  SELF_CHECK();
735 
737  return Py_None;
738 }
739 
740 static PyObject* protocol_widget_ssh_exec(PyRemminaProtocolWidget* self, PyObject* args)
741 {
742  TRACE_CALL(__func__);
743  SELF_CHECK();
744  gboolean wait;
745  gchar* cmd;
746 
747  if (PyArg_ParseTuple(args, "ps", &wait, &cmd))
748  {
750  }
751  else
752  {
753  PyErr_Print();
754  return NULL;
755  }
756  return Py_None;
757 }
758 
759 static void _on_send_callback_wrapper(RemminaProtocolWidget* gp, const gchar* text)
760 {
762  PyObject_CallMethod(plugin->instance, "on_send", "Os", gp, text);
763 }
764 
766 {
768  PyObject_CallMethod(plugin->instance, "on_destroy", "O", gp);
769 }
770 
771 static PyObject* protocol_widget_chat_open(PyRemminaProtocolWidget* self, PyObject* var_name)
772 {
773  TRACE_CALL(__func__);
774  SELF_CHECK();
775 
776  if (!PyUnicode_Check(var_name))
777  {
778  g_printerr("[%s:%d@%s]: Argument is not of type String!\n", __FILE__, __LINE__, __func__);
779  }
780 
782  PyUnicode_AsUTF8(var_name),
785 
786  return Py_None;
787 }
788 
789 static PyObject* protocol_widget_chat_close(PyRemminaProtocolWidget* self, PyObject* args)
790 {
791  TRACE_CALL(__func__);
792  SELF_CHECK();
793 
795  return Py_None;
796 }
797 
798 static PyObject* protocol_widget_chat_receive(PyRemminaProtocolWidget* self, PyObject* args)
799 {
800  TRACE_CALL(__func__);
801  SELF_CHECK();
802  gchar* text;
803 
804  if (PyArg_ParseTuple(args, "s", &text))
805  {
807  }
808  else
809  {
810  PyErr_Print();
811  return NULL;
812  }
813 
814  return Py_None;
815 }
816 
817 static PyObject* protocol_widget_send_keys_signals(PyRemminaProtocolWidget* self, PyObject* args)
818 {
819  TRACE_CALL(__func__);
820  SELF_CHECK();
821  guint* keyvals;
822  int length;
823  GdkEventType event_type;
824  PyObject* widget;
825 
826  if (PyArg_ParseTuple(args, "Osii", &widget, &keyvals, &length, &event_type) && widget && keyvals)
827  {
828  if (event_type < GDK_NOTHING || event_type >= GDK_EVENT_LAST)
829  {
830  g_printerr("[%s:%d@%s]: %d is not a known value for GdkEventType!\n", __FILE__, __LINE__, __func__, event_type);
831  return NULL;
832  }
833  else
834  {
835  python_wrapper_get_service()->protocol_widget_send_keys_signals((GtkWidget*)widget, keyvals, length, event_type);
836  }
837  }
838  else
839  {
840  PyErr_Print();
841  return NULL;
842  }
843 
844  return Py_None;
845 }
static PyObject * protocol_widget_panel_show_retry(PyRemminaProtocolWidget *self, PyObject *args)
gint(* protocol_widget_panel_changed_certificate)(RemminaProtocolWidget *gp, const gchar *subject, const gchar *issuer, const gchar *new_fingerprint, const gchar *old_fingerprint)
Definition: plugin.h:288
static PyObject * protocol_widget_start_reverse_tunnel(PyRemminaProtocolWidget *self, PyObject *var_local_port)
void(* protocol_widget_register_hostkey)(RemminaProtocolWidget *gp, GtkWidget *widget)
Definition: plugin.h:269
static PyObject * protocol_widget_get_viewport(PyRemminaProtocolWidget *self, PyObject *args)
PyPlugin * python_wrapper_get_plugin_by_protocol_widget(RemminaProtocolWidget *gp)
Tries to find the Python plugin matching to the given instance of RemminaPlugin.
static PyObject * protocol_widget_chat_receive(PyRemminaProtocolWidget *self, PyObject *args)
static int python_protocol_feature_init(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject * protocol_widget_has_error(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_get_savepassword(PyRemminaProtocolWidget *self, PyObject *args)
void(* protocol_widget_update_align)(RemminaProtocolWidget *gp)
Definition: plugin.h:284
static PyObject * protocol_widget_set_height(PyRemminaProtocolWidget *self, PyObject *var_height)
static PyObject * protocol_widget_get_domain(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_register_hostkey(PyRemminaProtocolWidget *self, PyObject *var_widget)
void(* protocol_widget_chat_open)(RemminaProtocolWidget *gp, const gchar *name, void(*on_send)(RemminaProtocolWidget *gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget *gp))
Definition: plugin.h:275
gint(* protocol_widget_panel_new_certificate)(RemminaProtocolWidget *gp, const gchar *subject, const gchar *issuer, const gchar *fingerprint)
Definition: plugin.h:287
void(* protocol_widget_panel_show_retry)(RemminaProtocolWidget *gp)
Definition: plugin.h:279
static PyObject * protocol_widget_get_clientcert(PyRemminaProtocolWidget *self, PyObject *args)
Maps an instance of a Python plugin to a Remmina one.
typedefG_BEGIN_DECLS struct _RemminaFile RemminaFile
Definition: types.h:44
void(* protocol_widget_signal_connection_closed)(RemminaProtocolWidget *gp)
Definition: plugin.h:282
PyRemminaProtocolWidget * python_wrapper_protocol_widget_create(void)
Creates a new instance of PyRemminaProtocolWidget and initializes its fields.
static PyObject * protocol_widget_ssh_exec(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_panel_new_certificate(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_get_current_scale_mode(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_unlock_dynres(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_panel_show_listen(PyRemminaProtocolWidget *self, PyObject *args)
PyObject_HEAD RemminaProtocolWidget * gp
void init_pygobject()
Initializes the pygobject library.
Contains the implementation of the widget handling used from the protocol plugin. ...
static PyObject * protocol_widget_update_align(PyRemminaProtocolWidget *self, PyObject *args)
static void _on_destroy_callback_wrapper(RemminaProtocolWidget *gp)
GtkWidget * get_pywidget(PyObject *obj)
Extracts a GtkWidget from a PyObject instance.
void(* protocol_widget_set_height)(RemminaProtocolWidget *gp, gint height)
Definition: plugin.h:258
void(* protocol_widget_desktop_resize)(RemminaProtocolWidget *gp)
Definition: plugin.h:286
void(* protocol_widget_signal_connection_opened)(RemminaProtocolWidget *gp)
Definition: plugin.h:283
void(* protocol_widget_panel_show_listen)(RemminaProtocolWidget *gp, gint port)
Definition: plugin.h:299
static struct PyMethodDef python_protocol_widget_type_methods[]
GtkWidget * new_pywidget(GObject *obj)
Creates a new GtkWidget.
void(* protocol_widget_panel_hide)(RemminaProtocolWidget *gp)
Definition: plugin.h:274
void(* protocol_widget_set_display)(RemminaProtocolWidget *gp, gint display)
Definition: plugin.h:281
static PyObject * protocol_widget_send_keys_signals(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_chat_close(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_start_xport_tunnel(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_set_width(PyRemminaProtocolWidget *self, PyObject *var_width)
static PyObject * protocol_widget_get_clientkey(PyRemminaProtocolWidget *self, PyObject *args)
Contains functions and constants that are commonly used throughout the Python plugin implementation...
static PyObject * protocol_widget_set_display(PyRemminaProtocolWidget *self, PyObject *var_display)
static PyObject * protocol_widget_get_file(PyRemminaProtocolWidget *self, PyObject *args)
PyRemminaFile * python_wrapper_remmina_file_to_python(RemminaFile *file)
Converts the instance of RemminaFile to a Python object that can be passed to the Python engine...
static PyObject * protocol_widget_set_expand(PyRemminaProtocolWidget *self, PyObject *var_expand)
static PyObject * protocol_widget_chat_open(PyRemminaProtocolWidget *self, PyObject *var_name)
void(* protocol_widget_unlock_dynres)(RemminaProtocolWidget *gp)
Definition: plugin.h:285
static PyTypeObject python_protocol_widget_type
static PyObject * protocol_widget_desktop_resize(PyRemminaProtocolWidget *self, PyObject *args)
gboolean(* protocol_widget_ssh_exec)(RemminaProtocolWidget *gp, gboolean wait, const gchar *fmt,...)
Definition: plugin.h:277
RemminaFile *(* protocol_widget_get_file)(RemminaProtocolWidget *gp)
Definition: plugin.h:266
void(* protocol_widget_set_error)(RemminaProtocolWidget *gp, const gchar *fmt,...)
Definition: plugin.h:262
static PyObject * protocol_widget_get_width(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_emit_signal(PyRemminaProtocolWidget *self, PyObject *var_signal)
static PyObject * protocol_widget_get_cacrl(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_signal_connection_closed(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_get_username(PyRemminaProtocolWidget *self, PyObject *args)
RemminaPluginService * python_wrapper_get_service(void)
Gets the pointer to the plugin service of Remmina.
void python_wrapper_protocol_widget_init(void)
Initializes the widget backend of the protocol plugin implementation.
static PyObject * python_protocol_feature_new(PyTypeObject *type, PyObject *kws, PyObject *args)
static PyObject * protocol_widget_start_direct_tunnel(PyRemminaProtocolWidget *self, PyObject *args)
void(* protocol_widget_set_expand)(RemminaProtocolWidget *gp, gboolean expand)
Definition: plugin.h:261
static PyObject * protocol_widget_get_expand(PyRemminaProtocolWidget *self, PyObject *args)
Contains the specialisation of RemminaPluginFile plugins in Python.
void(* protocol_widget_panel_show)(RemminaProtocolWidget *gp)
Definition: plugin.h:278
void(* protocol_widget_save_cred)(RemminaProtocolWidget *gp)
Definition: plugin.h:298
static PyObject * protocol_widget_set_error(PyRemminaProtocolWidget *self, PyObject *var_msg)
static PyObject * protocol_widget_panel_authx509(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_is_closed(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_signal_connection_opened(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_save_cred(PyRemminaProtocolWidget *self, PyObject *args)
The Python abstraction of the protocol widget struct.
void python_wrapper_protocol_widget_type_ready(void)
Initializes Python types used for protocol widgets.
static PyObject * protocol_widget_panel_hide(PyRemminaProtocolWidget *self, PyObject *args)
static void _on_send_callback_wrapper(RemminaProtocolWidget *gp, const gchar *text)
static PyObject * protocol_widget_get_height(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_panel_show(PyRemminaProtocolWidget *self, PyObject *args)
void(* protocol_widget_send_keys_signals)(GtkWidget *widget, const guint *keyvals, int keyvals_length, GdkEventType action)
Definition: plugin.h:272
void(* protocol_widget_chat_receive)(RemminaProtocolWidget *gp, const gchar *text)
Definition: plugin.h:273
static PyObject * protocol_widget_get_cacert(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_panel_changed_certificate(PyRemminaProtocolWidget *self, PyObject *args)
static PyObject * protocol_widget_get_password(PyRemminaProtocolWidget *self, PyObject *args)
static gboolean xport_tunnel_init(RemminaProtocolWidget *gp, gint remotedisplay, const gchar *server, gint port)
PyObject * instance