nm-setting-vpn.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
  2. /*
  3. * This library is free software; you can redistribute it and/or
  4. * modify it under the terms of the GNU Lesser General Public
  5. * License as published by the Free Software Foundation; either
  6. * version 2 of the License, or (at your option) any later version.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * Lesser General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Lesser General Public
  14. * License along with this library; if not, write to the
  15. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. * Boston, MA 02110-1301 USA.
  17. *
  18. * Copyright 2007 - 2013 Red Hat, Inc.
  19. * Copyright 2007 - 2008 Novell, Inc.
  20. */
  21. #ifndef NM_SETTING_VPN_H
  22. #define NM_SETTING_VPN_H
  23. #include "nm-setting.h"
  24. G_BEGIN_DECLS
  25. #define NM_TYPE_SETTING_VPN (nm_setting_vpn_get_type ())
  26. #define NM_SETTING_VPN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_VPN, NMSettingVPN))
  27. #define NM_SETTING_VPN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_VPN, NMSettingVPNClass))
  28. #define NM_IS_SETTING_VPN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_VPN))
  29. #define NM_IS_SETTING_VPN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_VPN))
  30. #define NM_SETTING_VPN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_VPN, NMSettingVPNClass))
  31. #define NM_SETTING_VPN_SETTING_NAME "vpn"
  32. /**
  33. * NMSettingVpnError:
  34. * @NM_SETTING_VPN_ERROR_UNKNOWN: unknown or unclassified error
  35. * @NM_SETTING_VPN_ERROR_INVALID_PROPERTY: the property was invalid
  36. * @NM_SETTING_VPN_ERROR_MISSING_PROPERTY: the property was missing and is
  37. * required
  38. */
  39. typedef enum {
  40. NM_SETTING_VPN_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
  41. NM_SETTING_VPN_ERROR_INVALID_PROPERTY, /*< nick=InvalidProperty >*/
  42. NM_SETTING_VPN_ERROR_MISSING_PROPERTY, /*< nick=MissingProperty >*/
  43. } NMSettingVpnError;
  44. #define NM_SETTING_VPN_ERROR nm_setting_vpn_error_quark ()
  45. GQuark nm_setting_vpn_error_quark (void);
  46. #define NM_SETTING_VPN_SERVICE_TYPE "service-type"
  47. #define NM_SETTING_VPN_USER_NAME "user-name"
  48. #define NM_SETTING_VPN_PERSISTENT "persistent"
  49. #define NM_SETTING_VPN_DATA "data"
  50. #define NM_SETTING_VPN_SECRETS "secrets"
  51. typedef struct {
  52. NMSetting parent;
  53. } NMSettingVPN;
  54. typedef struct {
  55. NMSettingClass parent;
  56. /* Padding for future expansion */
  57. void (*_reserved1) (void);
  58. void (*_reserved2) (void);
  59. void (*_reserved3) (void);
  60. void (*_reserved4) (void);
  61. } NMSettingVPNClass;
  62. /**
  63. * NMVPNIterFunc:
  64. * @key: the name of the data or secret item
  65. * @value: the value of the data or secret item
  66. * @user_data: User data passed to nm_setting_vpn_foreach_data_item() or
  67. * nm_setting_vpn_foreach_secret()
  68. **/
  69. typedef void (*NMVPNIterFunc) (const char *key, const char *value, gpointer user_data);
  70. GType nm_setting_vpn_get_type (void);
  71. NMSetting *nm_setting_vpn_new (void);
  72. const char *nm_setting_vpn_get_service_type (NMSettingVPN *setting);
  73. const char *nm_setting_vpn_get_user_name (NMSettingVPN *setting);
  74. gboolean nm_setting_vpn_get_persistent (NMSettingVPN *setting);
  75. guint32 nm_setting_vpn_get_num_data_items (NMSettingVPN *setting);
  76. void nm_setting_vpn_add_data_item (NMSettingVPN *setting,
  77. const char *key,
  78. const char *item);
  79. const char * nm_setting_vpn_get_data_item (NMSettingVPN *setting,
  80. const char *key);
  81. gboolean nm_setting_vpn_remove_data_item (NMSettingVPN *setting,
  82. const char *key);
  83. void nm_setting_vpn_foreach_data_item (NMSettingVPN *setting,
  84. NMVPNIterFunc func,
  85. gpointer user_data);
  86. guint32 nm_setting_vpn_get_num_secrets (NMSettingVPN *setting);
  87. void nm_setting_vpn_add_secret (NMSettingVPN *setting,
  88. const char *key,
  89. const char *secret);
  90. const char * nm_setting_vpn_get_secret (NMSettingVPN *setting,
  91. const char *key);
  92. gboolean nm_setting_vpn_remove_secret (NMSettingVPN *setting,
  93. const char *key);
  94. void nm_setting_vpn_foreach_secret (NMSettingVPN *setting,
  95. NMVPNIterFunc func,
  96. gpointer user_data);
  97. #ifdef NM_VPN_LIBNM_COMPAT
  98. #define NMSettingVpn NMSettingVPN
  99. #endif
  100. G_END_DECLS
  101. #endif /* NM_SETTING_VPN_H */