nm-ssh-service.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
  2. /* nm-ssh-service - ssh integration with NetworkManager
  3. *
  4. * Copyright (C) 2013 Dan Fruehauf <malkodan@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. */
  21. #ifndef NM_SSH_SERVICE_H
  22. #define NM_SSH_SERVICE_H
  23. #include <glib.h>
  24. #include <glib-object.h>
  25. #include <nm-vpn-plugin.h>
  26. #define NM_TYPE_SSH_PLUGIN (nm_ssh_plugin_get_type ())
  27. #define NM_SSH_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SSH_PLUGIN, NMSshPlugin))
  28. #define NM_SSH_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SSH_PLUGIN, NMSshPluginClass))
  29. #define NM_IS_SSH_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SSH_PLUGIN))
  30. #define NM_IS_SSH_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SSH_PLUGIN))
  31. #define NM_SSH_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SSH_PLUGIN, NMSshPluginClass))
  32. #define NM_DBUS_SERVICE_SSH "org.freedesktop.NetworkManager.ssh"
  33. #define NM_DBUS_INTERFACE_SSH "org.freedesktop.NetworkManager.ssh"
  34. #define NM_DBUS_PATH_SSH "/org/freedesktop/NetworkManager/ssh"
  35. #define YES "yes"
  36. #define NO "no"
  37. #define IS_YES(x) (!strncmp (x, YES, strlen(YES)))
  38. #define NM_SSH_KEY_REMOTE "remote"
  39. #define NM_SSH_KEY_REMOTE_IP "remote-ip"
  40. #define NM_SSH_KEY_LOCAL_IP "local-ip"
  41. #define NM_SSH_KEY_NETMASK "netmask"
  42. #define NM_SSH_KEY_PORT "port"
  43. #define NM_SSH_KEY_TUNNEL_MTU "tunnel-mtu"
  44. #define NM_SSH_KEY_EXTRA_OPTS "extra-opts"
  45. #define NM_SSH_KEY_REMOTE_DEV "remote-dev"
  46. #define NM_SSH_KEY_SSH_AUTH_SOCK "ssh-auth-sock"
  47. #define NM_SSH_KEY_TAP_DEV "tap-dev"
  48. #define NM_SSH_KEY_REMOTE_USERNAME "remote-username"
  49. #define NM_SSH_KEY_NO_DEFAULT_ROUTE "no-default-route"
  50. #define NM_SSH_KEY_IP_6 "ip-6"
  51. #define NM_SSH_KEY_REMOTE_IP_6 "remote-ip-6"
  52. #define NM_SSH_KEY_LOCAL_IP_6 "local-ip-6"
  53. #define NM_SSH_KEY_NETMASK_6 "netmask-6"
  54. #define NM_SSH_KEY_AUTH_TYPE "auth-type"
  55. #define NM_SSH_KEY_KEY_FILE "key-file"
  56. #define NM_SSH_KEY_PASSWORD "password"
  57. #define NM_SSH_DEFAULT_PORT 22
  58. #define NM_SSH_DEFAULT_MTU 1500
  59. #define NM_SSH_DEFAULT_REMOTE_DEV 100
  60. #define NM_SSH_DEFAULT_EXTRA_OPTS "-o ServerAliveInterval=10 -o TCPKeepAlive=yes"
  61. #define NM_SSH_DEFAULT_REMOTE_USERNAME "root"
  62. #define NM_SSH_AUTH_TYPE_SSH_AGENT "ssh-agent"
  63. #define NM_SSH_AUTH_TYPE_PASSWORD "password"
  64. #define NM_SSH_AUTH_TYPE_KEY "key"
  65. /* Backward compatibility with NetworkManager < 0.9.6 when no IPv6 is supported */
  66. #if !defined(NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY)
  67. # define NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY
  68. #endif
  69. #if !defined(NM_VPN_PLUGIN_CONFIG_TUNDEV)
  70. # define NM_VPN_PLUGIN_CONFIG_TUNDEV NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV
  71. #endif
  72. #if !defined(NM_VPN_PLUGIN_CONFIG_MTU)
  73. # define NM_VPN_PLUGIN_CONFIG_MTU NM_VPN_PLUGIN_IP4_CONFIG_MTU
  74. #endif
  75. /* End backward compatibility */
  76. typedef struct {
  77. NMVPNPlugin parent;
  78. } NMSshPlugin;
  79. typedef struct {
  80. NMVPNPluginClass parent;
  81. } NMSshPluginClass;
  82. GType nm_ssh_plugin_get_type (void);
  83. NMSshPlugin *nm_ssh_plugin_new (void);
  84. #endif /* NM_SSH_SERVICE_H */