nm-setting-ip-config.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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 - 2014 Red Hat, Inc.
  19. * Copyright 2007 - 2008 Novell, Inc.
  20. */
  21. #ifndef NM_SETTING_IP_CONFIG_H
  22. #define NM_SETTING_IP_CONFIG_H
  23. #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
  24. #error "Only <NetworkManager.h> can be included directly."
  25. #endif
  26. #include "nm-setting.h"
  27. #include "nm-utils.h"
  28. G_BEGIN_DECLS
  29. #define NM_IP_ADDRESS_ATTRIBUTE_LABEL "label"
  30. typedef struct NMIPAddress NMIPAddress;
  31. GType nm_ip_address_get_type (void);
  32. NMIPAddress *nm_ip_address_new (int family,
  33. const char *addr,
  34. guint prefix,
  35. GError **error);
  36. NMIPAddress *nm_ip_address_new_binary (int family,
  37. gconstpointer addr,
  38. guint prefix,
  39. GError **error);
  40. void nm_ip_address_ref (NMIPAddress *address);
  41. void nm_ip_address_unref (NMIPAddress *address);
  42. gboolean nm_ip_address_equal (NMIPAddress *address,
  43. NMIPAddress *other);
  44. NMIPAddress *nm_ip_address_dup (NMIPAddress *address);
  45. int nm_ip_address_get_family (NMIPAddress *address);
  46. const char *nm_ip_address_get_address (NMIPAddress *address);
  47. void nm_ip_address_set_address (NMIPAddress *address,
  48. const char *addr);
  49. void nm_ip_address_get_address_binary (NMIPAddress *address,
  50. gpointer addr);
  51. void nm_ip_address_set_address_binary (NMIPAddress *address,
  52. gconstpointer addr);
  53. guint nm_ip_address_get_prefix (NMIPAddress *address);
  54. void nm_ip_address_set_prefix (NMIPAddress *address,
  55. guint prefix);
  56. char **nm_ip_address_get_attribute_names (NMIPAddress *address);
  57. GVariant *nm_ip_address_get_attribute (NMIPAddress *address,
  58. const char *name);
  59. void nm_ip_address_set_attribute (NMIPAddress *address,
  60. const char *name,
  61. GVariant *value);
  62. typedef struct NMIPRoute NMIPRoute;
  63. GType nm_ip_route_get_type (void);
  64. NMIPRoute *nm_ip_route_new (int family,
  65. const char *dest,
  66. guint prefix,
  67. const char *next_hop,
  68. gint64 metric,
  69. GError **error);
  70. NMIPRoute *nm_ip_route_new_binary (int family,
  71. gconstpointer dest,
  72. guint prefix,
  73. gconstpointer next_hop,
  74. gint64 metric,
  75. GError **error);
  76. void nm_ip_route_ref (NMIPRoute *route);
  77. void nm_ip_route_unref (NMIPRoute *route);
  78. gboolean nm_ip_route_equal (NMIPRoute *route,
  79. NMIPRoute *other);
  80. enum {
  81. NM_IP_ROUTE_EQUAL_CMP_FLAGS_NONE = 0,
  82. NM_IP_ROUTE_EQUAL_CMP_FLAGS_WITH_ATTRS = (1LL << 0),
  83. };
  84. NM_AVAILABLE_IN_1_10
  85. gboolean nm_ip_route_equal_full (NMIPRoute *route,
  86. NMIPRoute *other,
  87. guint cmp_flags);
  88. NMIPRoute *nm_ip_route_dup (NMIPRoute *route);
  89. int nm_ip_route_get_family (NMIPRoute *route);
  90. const char *nm_ip_route_get_dest (NMIPRoute *route);
  91. void nm_ip_route_set_dest (NMIPRoute *route,
  92. const char *dest);
  93. void nm_ip_route_get_dest_binary (NMIPRoute *route,
  94. gpointer dest);
  95. void nm_ip_route_set_dest_binary (NMIPRoute *route,
  96. gconstpointer dest);
  97. guint nm_ip_route_get_prefix (NMIPRoute *route);
  98. void nm_ip_route_set_prefix (NMIPRoute *route,
  99. guint prefix);
  100. const char *nm_ip_route_get_next_hop (NMIPRoute *route);
  101. void nm_ip_route_set_next_hop (NMIPRoute *route,
  102. const char *next_hop);
  103. gboolean nm_ip_route_get_next_hop_binary (NMIPRoute *route,
  104. gpointer next_hop);
  105. void nm_ip_route_set_next_hop_binary (NMIPRoute *route,
  106. gconstpointer next_hop);
  107. gint64 nm_ip_route_get_metric (NMIPRoute *route);
  108. void nm_ip_route_set_metric (NMIPRoute *route,
  109. gint64 metric);
  110. char **nm_ip_route_get_attribute_names (NMIPRoute *route);
  111. GVariant *nm_ip_route_get_attribute (NMIPRoute *route,
  112. const char *name);
  113. void nm_ip_route_set_attribute (NMIPRoute *route,
  114. const char *name,
  115. GVariant *value);
  116. NM_AVAILABLE_IN_1_8
  117. const NMVariantAttributeSpec *const *nm_ip_route_get_variant_attribute_spec (void);
  118. NM_AVAILABLE_IN_1_8
  119. gboolean nm_ip_route_attribute_validate (const char *name,
  120. GVariant *value,
  121. int family,
  122. gboolean *known,
  123. GError **error);
  124. #define NM_IP_ROUTE_ATTRIBUTE_TABLE "table"
  125. #define NM_IP_ROUTE_ATTRIBUTE_SRC "src"
  126. #define NM_IP_ROUTE_ATTRIBUTE_FROM "from"
  127. #define NM_IP_ROUTE_ATTRIBUTE_TOS "tos"
  128. #define NM_IP_ROUTE_ATTRIBUTE_ONLINK "onlink"
  129. #define NM_IP_ROUTE_ATTRIBUTE_WINDOW "window"
  130. #define NM_IP_ROUTE_ATTRIBUTE_CWND "cwnd"
  131. #define NM_IP_ROUTE_ATTRIBUTE_INITCWND "initcwnd"
  132. #define NM_IP_ROUTE_ATTRIBUTE_INITRWND "initrwnd"
  133. #define NM_IP_ROUTE_ATTRIBUTE_MTU "mtu"
  134. #define NM_IP_ROUTE_ATTRIBUTE_LOCK_WINDOW "lock-window"
  135. #define NM_IP_ROUTE_ATTRIBUTE_LOCK_CWND "lock-cwnd"
  136. #define NM_IP_ROUTE_ATTRIBUTE_LOCK_INITCWND "lock-initcwnd"
  137. #define NM_IP_ROUTE_ATTRIBUTE_LOCK_INITRWND "lock-initrwnd"
  138. #define NM_IP_ROUTE_ATTRIBUTE_LOCK_MTU "lock-mtu"
  139. #define NM_TYPE_SETTING_IP_CONFIG (nm_setting_ip_config_get_type ())
  140. #define NM_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfig))
  141. #define NM_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_IPCONFIG, NMSettingIPConfigClass))
  142. #define NM_IS_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_IP_CONFIG))
  143. #define NM_IS_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_IP_CONFIG))
  144. #define NM_SETTING_IP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass))
  145. #define NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX 30000
  146. #define NM_SETTING_IP_CONFIG_METHOD "method"
  147. #define NM_SETTING_IP_CONFIG_DNS "dns"
  148. #define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search"
  149. #define NM_SETTING_IP_CONFIG_DNS_OPTIONS "dns-options"
  150. #define NM_SETTING_IP_CONFIG_DNS_PRIORITY "dns-priority"
  151. #define NM_SETTING_IP_CONFIG_ADDRESSES "addresses"
  152. #define NM_SETTING_IP_CONFIG_GATEWAY "gateway"
  153. #define NM_SETTING_IP_CONFIG_ROUTES "routes"
  154. #define NM_SETTING_IP_CONFIG_ROUTE_METRIC "route-metric"
  155. #define NM_SETTING_IP_CONFIG_ROUTE_TABLE "route-table"
  156. #define NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
  157. #define NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
  158. #define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
  159. #define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
  160. #define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default"
  161. #define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail"
  162. #define NM_SETTING_IP_CONFIG_DAD_TIMEOUT "dad-timeout"
  163. #define NM_SETTING_IP_CONFIG_DHCP_TIMEOUT "dhcp-timeout"
  164. #define NM_SETTING_DNS_OPTION_DEBUG "debug"
  165. #define NM_SETTING_DNS_OPTION_NDOTS "ndots"
  166. #define NM_SETTING_DNS_OPTION_TIMEOUT "timeout"
  167. #define NM_SETTING_DNS_OPTION_ATTEMPTS "attempts"
  168. #define NM_SETTING_DNS_OPTION_ROTATE "rotate"
  169. #define NM_SETTING_DNS_OPTION_NO_CHECK_NAMES "no-check-names"
  170. #define NM_SETTING_DNS_OPTION_INET6 "inet6"
  171. #define NM_SETTING_DNS_OPTION_IP6_BYTESTRING "ip6-bytestring"
  172. #define NM_SETTING_DNS_OPTION_IP6_DOTINT "ip6-dotint"
  173. #define NM_SETTING_DNS_OPTION_NO_IP6_DOTINT "no-ip6-dotint"
  174. #define NM_SETTING_DNS_OPTION_EDNS0 "edns0"
  175. #define NM_SETTING_DNS_OPTION_SINGLE_REQUEST "single-request"
  176. #define NM_SETTING_DNS_OPTION_SINGLE_REQUEST_REOPEN "single-request-reopen"
  177. #define NM_SETTING_DNS_OPTION_NO_TLD_QUERY "no-tld-query"
  178. #define NM_SETTING_DNS_OPTION_USE_VC "use-vc"
  179. /**
  180. * NMSettingIPConfig:
  181. */
  182. struct _NMSettingIPConfig {
  183. NMSetting parent;
  184. };
  185. typedef struct {
  186. NMSettingClass parent;
  187. /* Padding for future expansion */
  188. gpointer padding[8];
  189. } NMSettingIPConfigClass;
  190. GType nm_setting_ip_config_get_type (void);
  191. const char *nm_setting_ip_config_get_method (NMSettingIPConfig *setting);
  192. guint nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting);
  193. const char *nm_setting_ip_config_get_dns (NMSettingIPConfig *setting,
  194. int idx);
  195. gboolean nm_setting_ip_config_add_dns (NMSettingIPConfig *setting,
  196. const char *dns);
  197. void nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting,
  198. int idx);
  199. gboolean nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting,
  200. const char *dns);
  201. void nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting);
  202. guint nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting);
  203. const char *nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting,
  204. int idx);
  205. gboolean nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting,
  206. const char *dns_search);
  207. void nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting,
  208. int idx);
  209. gboolean nm_setting_ip_config_remove_dns_search_by_value (NMSettingIPConfig *setting,
  210. const char *dns_search);
  211. void nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting);
  212. guint nm_setting_ip_config_get_num_dns_options (NMSettingIPConfig *setting);
  213. gboolean nm_setting_ip_config_has_dns_options (NMSettingIPConfig *setting);
  214. const char *nm_setting_ip_config_get_dns_option (NMSettingIPConfig *setting,
  215. guint idx);
  216. int nm_setting_ip_config_next_valid_dns_option (NMSettingIPConfig *setting,
  217. guint idx);
  218. gboolean nm_setting_ip_config_add_dns_option (NMSettingIPConfig *setting,
  219. const char *dns_option);
  220. void nm_setting_ip_config_remove_dns_option (NMSettingIPConfig *setting,
  221. int idx);
  222. gboolean nm_setting_ip_config_remove_dns_option_by_value (NMSettingIPConfig *setting,
  223. const char *dns_option);
  224. void nm_setting_ip_config_clear_dns_options (NMSettingIPConfig *setting, gboolean is_set);
  225. NM_AVAILABLE_IN_1_4
  226. int nm_setting_ip_config_get_dns_priority (NMSettingIPConfig *setting);
  227. guint nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting);
  228. NMIPAddress *nm_setting_ip_config_get_address (NMSettingIPConfig *setting,
  229. int idx);
  230. gboolean nm_setting_ip_config_add_address (NMSettingIPConfig *setting,
  231. NMIPAddress *address);
  232. void nm_setting_ip_config_remove_address (NMSettingIPConfig *setting,
  233. int idx);
  234. gboolean nm_setting_ip_config_remove_address_by_value (NMSettingIPConfig *setting,
  235. NMIPAddress *address);
  236. void nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting);
  237. const char *nm_setting_ip_config_get_gateway (NMSettingIPConfig *setting);
  238. guint nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting);
  239. NMIPRoute *nm_setting_ip_config_get_route (NMSettingIPConfig *setting,
  240. int idx);
  241. gboolean nm_setting_ip_config_add_route (NMSettingIPConfig *setting,
  242. NMIPRoute *route);
  243. void nm_setting_ip_config_remove_route (NMSettingIPConfig *setting,
  244. int idx);
  245. gboolean nm_setting_ip_config_remove_route_by_value (NMSettingIPConfig *setting,
  246. NMIPRoute *route);
  247. void nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting);
  248. gint64 nm_setting_ip_config_get_route_metric (NMSettingIPConfig *setting);
  249. NM_AVAILABLE_IN_1_10
  250. guint32 nm_setting_ip_config_get_route_table (NMSettingIPConfig *setting);
  251. gboolean nm_setting_ip_config_get_ignore_auto_routes (NMSettingIPConfig *setting);
  252. gboolean nm_setting_ip_config_get_ignore_auto_dns (NMSettingIPConfig *setting);
  253. const char *nm_setting_ip_config_get_dhcp_hostname (NMSettingIPConfig *setting);
  254. gboolean nm_setting_ip_config_get_dhcp_send_hostname (NMSettingIPConfig *setting);
  255. gboolean nm_setting_ip_config_get_never_default (NMSettingIPConfig *setting);
  256. gboolean nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting);
  257. NM_AVAILABLE_IN_1_2
  258. int nm_setting_ip_config_get_dad_timeout (NMSettingIPConfig *setting);
  259. NM_AVAILABLE_IN_1_2
  260. int nm_setting_ip_config_get_dhcp_timeout (NMSettingIPConfig *setting);
  261. G_END_DECLS
  262. #endif /* NM_SETTING_IP_CONFIG_H */