mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
docs: document the IP4Config setting
This commit is contained in:
parent
bf1d93153c
commit
05336474d7
|
@ -31,6 +31,22 @@
|
|||
#include "nm-utils.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
|
||||
/**
|
||||
* SECTION:nm-setting-ip4-config
|
||||
* @short_description: Describes IPv4 addressing, routing, and name service properties
|
||||
* @include: nm-setting-ip4-config.h
|
||||
*
|
||||
* The #NMSettingIP4Config object is a #NMSetting subclass that describes
|
||||
* properties related to IPv4 addressing, routing, and Domain Name Service
|
||||
**/
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_error_quark:
|
||||
*
|
||||
* Registers an error quark for #NMSettingIP4Config if necessary.
|
||||
*
|
||||
* Returns: the error quark used for #NMSettingIP4Config errors.
|
||||
**/
|
||||
GQuark
|
||||
nm_setting_ip4_config_error_quark (void)
|
||||
{
|
||||
|
@ -108,12 +124,25 @@ enum {
|
|||
LAST_PROP
|
||||
};
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_new:
|
||||
*
|
||||
* Creates a new #NMSettingIP4Config object with default values.
|
||||
*
|
||||
* Returns: the new empty #NMSettingIP4Config object
|
||||
**/
|
||||
NMSetting *
|
||||
nm_setting_ip4_config_new (void)
|
||||
{
|
||||
return (NMSetting *) g_object_new (NM_TYPE_SETTING_IP4_CONFIG, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_method:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns: the #NMSettingIP4Config:method property of the setting
|
||||
**/
|
||||
const char *
|
||||
nm_setting_ip4_config_get_method (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -122,6 +151,12 @@ nm_setting_ip4_config_get_method (NMSettingIP4Config *setting)
|
|||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->method;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_num_dns:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns: the number of configured DNS servers
|
||||
**/
|
||||
guint32
|
||||
nm_setting_ip4_config_get_num_dns (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -130,6 +165,14 @@ nm_setting_ip4_config_get_num_dns (NMSettingIP4Config *setting)
|
|||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns->len;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_dns:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @i: index number of the DNS server to return
|
||||
*
|
||||
* Returns: the IPv4 address (network byte order) of the DNS server at index
|
||||
* @i
|
||||
**/
|
||||
guint32
|
||||
nm_setting_ip4_config_get_dns (NMSettingIP4Config *setting, guint32 i)
|
||||
{
|
||||
|
@ -143,6 +186,16 @@ nm_setting_ip4_config_get_dns (NMSettingIP4Config *setting, guint32 i)
|
|||
return g_array_index (priv->dns, guint32, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_add_dns:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @dns: the IPv4 address (network byte order) of the DNS server to add
|
||||
*
|
||||
* Adds a new DNS server to the setting.
|
||||
*
|
||||
* Returns: %TRUE if the DNS server was added; %FALSE if the server was already
|
||||
* known
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, guint32 dns)
|
||||
{
|
||||
|
@ -161,6 +214,13 @@ nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, guint32 dns)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_remove_dns:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @i: index number of the DNS server to remove
|
||||
*
|
||||
* Removes the DNS server at index @i.
|
||||
**/
|
||||
void
|
||||
nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i)
|
||||
{
|
||||
|
@ -174,6 +234,12 @@ nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i)
|
|||
g_array_remove_index (priv->dns, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_clear_dns:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Removes all configured DNS servers.
|
||||
**/
|
||||
void
|
||||
nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -185,6 +251,12 @@ nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting)
|
|||
g_array_remove_range (priv->dns, 0, priv->dns->len);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_num_dns_searches:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns: the number of configured DNS search domains
|
||||
**/
|
||||
guint32
|
||||
nm_setting_ip4_config_get_num_dns_searches (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -193,6 +265,13 @@ nm_setting_ip4_config_get_num_dns_searches (NMSettingIP4Config *setting)
|
|||
return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_dns_search:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @i: index number of the DNS search domain to return
|
||||
*
|
||||
* Returns: the DNS search domain at index @i
|
||||
**/
|
||||
const char *
|
||||
nm_setting_ip4_config_get_dns_search (NMSettingIP4Config *setting, guint32 i)
|
||||
{
|
||||
|
@ -206,6 +285,16 @@ nm_setting_ip4_config_get_dns_search (NMSettingIP4Config *setting, guint32 i)
|
|||
return (const char *) g_slist_nth_data (priv->dns_search, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_add_dns_search:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @dns_search: the search domain to add
|
||||
*
|
||||
* Adds a new DNS search domain to the setting.
|
||||
*
|
||||
* Returns: %TRUE if the DNS search domain was added; %FALSE if the search
|
||||
* domain was already known
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting,
|
||||
const char *dns_search)
|
||||
|
@ -227,6 +316,13 @@ nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_remove_dns_search:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @i: index number of the DNS search domain
|
||||
*
|
||||
* Removes the DNS search domain at index @i.
|
||||
**/
|
||||
void
|
||||
nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i)
|
||||
{
|
||||
|
@ -243,6 +339,12 @@ nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i)
|
|||
priv->dns_search = g_slist_delete_link (priv->dns_search, elt);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_clear_dns_searches:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Removes all configured DNS search domains.
|
||||
**/
|
||||
void
|
||||
nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -252,6 +354,12 @@ nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting)
|
|||
NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_num_addresses:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns: the number of configured addresses
|
||||
**/
|
||||
guint32
|
||||
nm_setting_ip4_config_get_num_addresses (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -260,6 +368,13 @@ nm_setting_ip4_config_get_num_addresses (NMSettingIP4Config *setting)
|
|||
return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->addresses);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_address:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @i: index number of the address to return
|
||||
*
|
||||
* Returns: the address at index @i
|
||||
**/
|
||||
NMIP4Address *
|
||||
nm_setting_ip4_config_get_address (NMSettingIP4Config *setting, guint32 i)
|
||||
{
|
||||
|
@ -273,6 +388,17 @@ nm_setting_ip4_config_get_address (NMSettingIP4Config *setting, guint32 i)
|
|||
return (NMIP4Address *) g_slist_nth_data (priv->addresses, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_add_address:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @address: the new address to add
|
||||
*
|
||||
* Adds a new IPv4 address and associated information to the setting. The
|
||||
* given address is duplicated internally and is not changed by this function.
|
||||
*
|
||||
* Returns: %TRUE if the address was added; %FALSE if the address was already
|
||||
* known.
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_add_address (NMSettingIP4Config *setting,
|
||||
NMIP4Address *address)
|
||||
|
@ -297,6 +423,13 @@ nm_setting_ip4_config_add_address (NMSettingIP4Config *setting,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_remove_address:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @i: index number of the address to remove
|
||||
*
|
||||
* Removes the address at index @i.
|
||||
**/
|
||||
void
|
||||
nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i)
|
||||
{
|
||||
|
@ -313,6 +446,12 @@ nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i)
|
|||
priv->addresses = g_slist_delete_link (priv->addresses, elt);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_clear_addresses:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Removes all configured addresses.
|
||||
**/
|
||||
void
|
||||
nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -324,6 +463,12 @@ nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting)
|
|||
priv->addresses = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_num_routes:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns: the number of configured routes
|
||||
**/
|
||||
guint32
|
||||
nm_setting_ip4_config_get_num_routes (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -332,6 +477,13 @@ nm_setting_ip4_config_get_num_routes (NMSettingIP4Config *setting)
|
|||
return g_slist_length (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->routes);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_route:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @i: index number of the route to return
|
||||
*
|
||||
* Returns: the route at index @i
|
||||
**/
|
||||
NMIP4Route *
|
||||
nm_setting_ip4_config_get_route (NMSettingIP4Config *setting, guint32 i)
|
||||
{
|
||||
|
@ -345,6 +497,16 @@ nm_setting_ip4_config_get_route (NMSettingIP4Config *setting, guint32 i)
|
|||
return (NMIP4Route *) g_slist_nth_data (priv->routes, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_add_route:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @route: the route to add
|
||||
*
|
||||
* Adds a new IPv4 route and associated information to the setting. The
|
||||
* given route is duplicated internally and is not changed by this function.
|
||||
*
|
||||
* Returns: %TRUE if the route was added; %FALSE if the route was already known.
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_add_route (NMSettingIP4Config *setting,
|
||||
NMIP4Route *route)
|
||||
|
@ -369,6 +531,13 @@ nm_setting_ip4_config_add_route (NMSettingIP4Config *setting,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_remove_route:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
* @i: index number of the route
|
||||
*
|
||||
* Removes the route at index @i.
|
||||
**/
|
||||
void
|
||||
nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i)
|
||||
{
|
||||
|
@ -385,6 +554,12 @@ nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i)
|
|||
priv->routes = g_slist_delete_link (priv->routes, elt);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_clear_routes:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Removes all configured routes.
|
||||
**/
|
||||
void
|
||||
nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -396,6 +571,16 @@ nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting)
|
|||
priv->routes = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_ignore_auto_routes:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns the value contained in the #NMSettingIP4Config:ignore-auto-routes
|
||||
* property.
|
||||
*
|
||||
* Returns: %TRUE if automatically configured (ie via DHCP) routes should be
|
||||
* ignored.
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_get_ignore_auto_routes (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -404,6 +589,16 @@ nm_setting_ip4_config_get_ignore_auto_routes (NMSettingIP4Config *setting)
|
|||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->ignore_auto_routes;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_ignore_auto_dns:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns the value contained in the #NMSettingIP4Config:ignore-auto-dns
|
||||
* property.
|
||||
*
|
||||
* Returns: %TRUE if automatically configured (ie via DHCP) DNS information
|
||||
* should be ignored.
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -412,6 +607,16 @@ nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting)
|
|||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->ignore_auto_dns;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_dhcp_client_id:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns the value contained in the #NMSettingIP4Config:dhcp-client-id
|
||||
* property.
|
||||
*
|
||||
* Returns: the configured Client ID to send to the DHCP server when requesting
|
||||
* addresses via DHCP.
|
||||
**/
|
||||
const char *
|
||||
nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -420,6 +625,17 @@ nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting)
|
|||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_client_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_dhcp_send_hostname:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns the value contained in the #NMSettingIP4Config:dhcp-send-hostname
|
||||
* property.
|
||||
*
|
||||
* Returns: %TRUE if NetworkManager should send the machine hostname to the
|
||||
* DHCP server when requesting addresses to allow the server to automatically
|
||||
* update DNS information for this machine.
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -428,6 +644,15 @@ nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting)
|
|||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_send_hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_dhcp_hostname:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns the value contained in the #NMSettingIP4Config:dhcp-hostname
|
||||
* property.
|
||||
*
|
||||
* Returns: the configured hostname to send to the DHCP server
|
||||
**/
|
||||
const char *
|
||||
nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -436,6 +661,16 @@ nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting)
|
|||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_never_default:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns the value contained in the #NMSettingIP4Config:never-default
|
||||
* property.
|
||||
*
|
||||
* Returns: %TRUE if this connection should never be the default connection
|
||||
* for IPv4 addressing
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_get_never_default (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -444,6 +679,16 @@ nm_setting_ip4_config_get_never_default (NMSettingIP4Config *setting)
|
|||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->never_default;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip4_config_get_may_fail:
|
||||
* @setting: the #NMSettingIP4Config
|
||||
*
|
||||
* Returns the value contained in the #NMSettingIP4Config:may-fail
|
||||
* property.
|
||||
*
|
||||
* Returns: %TRUE if this connection doesn't require IPv4 addressing to complete
|
||||
* for the connection to succeed.
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ip4_config_get_may_fail (NMSettingIP4Config *setting)
|
||||
{
|
||||
|
@ -1023,6 +1268,13 @@ struct NMIP4Address {
|
|||
guint32 gateway; /* network byte order */
|
||||
};
|
||||
|
||||
/**
|
||||
* nm_ip4_address_new:
|
||||
*
|
||||
* Creates and returns a new #NMIP4Address object.
|
||||
*
|
||||
* Returns: (transfer full): the new empty #NMIP4Address object
|
||||
**/
|
||||
NMIP4Address *
|
||||
nm_ip4_address_new (void)
|
||||
{
|
||||
|
@ -1033,6 +1285,14 @@ nm_ip4_address_new (void)
|
|||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_dup:
|
||||
* @source: the #NMIP4Address object to copy
|
||||
*
|
||||
* Copies a given #NMIP4Address object and returns the copy.
|
||||
*
|
||||
* Returns: (transfer full): the copy of the given #NMIP4Address copy
|
||||
**/
|
||||
NMIP4Address *
|
||||
nm_ip4_address_dup (NMIP4Address *source)
|
||||
{
|
||||
|
@ -1049,6 +1309,12 @@ nm_ip4_address_dup (NMIP4Address *source)
|
|||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_ref:
|
||||
* @address: the #NMIP4Address
|
||||
*
|
||||
* Increases the reference count of the object.
|
||||
**/
|
||||
void
|
||||
nm_ip4_address_ref (NMIP4Address *address)
|
||||
{
|
||||
|
@ -1058,6 +1324,13 @@ nm_ip4_address_ref (NMIP4Address *address)
|
|||
address->refcount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_unref:
|
||||
* @address: the #NMIP4Address
|
||||
*
|
||||
* Decreases the reference count of the object. If the reference count
|
||||
* reaches zero, the object will be destroyed.
|
||||
**/
|
||||
void
|
||||
nm_ip4_address_unref (NMIP4Address *address)
|
||||
{
|
||||
|
@ -1071,6 +1344,15 @@ nm_ip4_address_unref (NMIP4Address *address)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_compare:
|
||||
* @address: the #NMIP4Address
|
||||
* @other: the #NMIP4Address to compare @address to.
|
||||
*
|
||||
* Determines if two #NMIP4Address objects contain the same values.
|
||||
*
|
||||
* Returns: %TRUE if the objects contain the same values, %FALSE if they do not.
|
||||
**/
|
||||
gboolean
|
||||
nm_ip4_address_compare (NMIP4Address *address, NMIP4Address *other)
|
||||
{
|
||||
|
@ -1087,6 +1369,14 @@ nm_ip4_address_compare (NMIP4Address *address, NMIP4Address *other)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_get_address:
|
||||
* @address: the #NMIP4Address
|
||||
*
|
||||
* Gets the IPv4 address property of this address object.
|
||||
*
|
||||
* Returns: the IPv4 address in network byte order
|
||||
**/
|
||||
guint32
|
||||
nm_ip4_address_get_address (NMIP4Address *address)
|
||||
{
|
||||
|
@ -1096,6 +1386,13 @@ nm_ip4_address_get_address (NMIP4Address *address)
|
|||
return address->address;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_set_address:
|
||||
* @address: the #NMIP4Address
|
||||
* @addr: the IPv4 address in network byte order
|
||||
*
|
||||
* Sets the IPv4 address property of this object.
|
||||
**/
|
||||
void
|
||||
nm_ip4_address_set_address (NMIP4Address *address, guint32 addr)
|
||||
{
|
||||
|
@ -1105,6 +1402,15 @@ nm_ip4_address_set_address (NMIP4Address *address, guint32 addr)
|
|||
address->address = addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_get_prefix:
|
||||
* @address: the #NMIP4Address
|
||||
*
|
||||
* Gets the IPv4 address prefix (ie "24" or "30" etc) property of this address
|
||||
* object.
|
||||
*
|
||||
* Returns: the IPv4 address prefix
|
||||
**/
|
||||
guint32
|
||||
nm_ip4_address_get_prefix (NMIP4Address *address)
|
||||
{
|
||||
|
@ -1114,15 +1420,31 @@ nm_ip4_address_get_prefix (NMIP4Address *address)
|
|||
return address->prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_set_prefix:
|
||||
* @address: the #NMIP4Address
|
||||
* @prefix: the address prefix, a number between 0 and 32 inclusive
|
||||
*
|
||||
* Sets the IPv4 address prefix.
|
||||
**/
|
||||
void
|
||||
nm_ip4_address_set_prefix (NMIP4Address *address, guint32 prefix)
|
||||
{
|
||||
g_return_if_fail (address != NULL);
|
||||
g_return_if_fail (address->refcount > 0);
|
||||
g_return_if_fail (prefix <= 32);
|
||||
|
||||
address->prefix = prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_get_gateway:
|
||||
* @address: the #NMIP4Address
|
||||
*
|
||||
* Gets the IPv4 default gateway property of this address object.
|
||||
*
|
||||
* Returns: the IPv4 gateway address in network byte order
|
||||
**/
|
||||
guint32
|
||||
nm_ip4_address_get_gateway (NMIP4Address *address)
|
||||
{
|
||||
|
@ -1132,6 +1454,13 @@ nm_ip4_address_get_gateway (NMIP4Address *address)
|
|||
return address->gateway;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_address_set_gateway:
|
||||
* @address: the #NMIP4Address
|
||||
* @gateway: the IPv4 default gateway in network byte order
|
||||
*
|
||||
* Sets the IPv4 default gateway property of this address object.
|
||||
**/
|
||||
void
|
||||
nm_ip4_address_set_gateway (NMIP4Address *address, guint32 gateway)
|
||||
{
|
||||
|
@ -1151,6 +1480,13 @@ struct NMIP4Route {
|
|||
guint32 metric; /* lower metric == more preferred */
|
||||
};
|
||||
|
||||
/**
|
||||
* nm_ip4_route_new:
|
||||
*
|
||||
* Creates and returns a new #NMIP4Route object.
|
||||
*
|
||||
* Returns: (transfer full): the new empty #NMIP4Route object
|
||||
**/
|
||||
NMIP4Route *
|
||||
nm_ip4_route_new (void)
|
||||
{
|
||||
|
@ -1161,6 +1497,14 @@ nm_ip4_route_new (void)
|
|||
return route;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_dup:
|
||||
* @source: the #NMIP4Route object to copy
|
||||
*
|
||||
* Copies a given #NMIP4Route object and returns the copy.
|
||||
*
|
||||
* Returns: (transfer full): the copy of the given #NMIP4Route copy
|
||||
**/
|
||||
NMIP4Route *
|
||||
nm_ip4_route_dup (NMIP4Route *source)
|
||||
{
|
||||
|
@ -1178,6 +1522,12 @@ nm_ip4_route_dup (NMIP4Route *source)
|
|||
return route;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_ref:
|
||||
* @route: the #NMIP4Route
|
||||
*
|
||||
* Increases the reference count of the object.
|
||||
**/
|
||||
void
|
||||
nm_ip4_route_ref (NMIP4Route *route)
|
||||
{
|
||||
|
@ -1187,6 +1537,13 @@ nm_ip4_route_ref (NMIP4Route *route)
|
|||
route->refcount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_unref:
|
||||
* @route: the #NMIP4Route
|
||||
*
|
||||
* Decreases the reference count of the object. If the reference count
|
||||
* reaches zero, the object will be destroyed.
|
||||
**/
|
||||
void
|
||||
nm_ip4_route_unref (NMIP4Route *route)
|
||||
{
|
||||
|
@ -1200,6 +1557,15 @@ nm_ip4_route_unref (NMIP4Route *route)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_compare:
|
||||
* @route: the #NMIP4Route
|
||||
* @other: the #NMIP4Route to compare @route to.
|
||||
*
|
||||
* Determines if two #NMIP4Route objects contain the same values.
|
||||
*
|
||||
* Returns: %TRUE if the objects contain the same values, %FALSE if they do not.
|
||||
**/
|
||||
gboolean
|
||||
nm_ip4_route_compare (NMIP4Route *route, NMIP4Route *other)
|
||||
{
|
||||
|
@ -1217,6 +1583,14 @@ nm_ip4_route_compare (NMIP4Route *route, NMIP4Route *other)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_get_dest:
|
||||
* @route: the #NMIP4Route
|
||||
*
|
||||
* Gets the IPv4 destination address property of this route object.
|
||||
*
|
||||
* Returns: the IPv4 address in network byte order
|
||||
**/
|
||||
guint32
|
||||
nm_ip4_route_get_dest (NMIP4Route *route)
|
||||
{
|
||||
|
@ -1226,6 +1600,13 @@ nm_ip4_route_get_dest (NMIP4Route *route)
|
|||
return route->dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_set_dest:
|
||||
* @route: the #NMIP4Route
|
||||
* @dest: the destination address in network byte order
|
||||
*
|
||||
* Sets the IPv4 destination address property of this route object.
|
||||
**/
|
||||
void
|
||||
nm_ip4_route_set_dest (NMIP4Route *route, guint32 dest)
|
||||
{
|
||||
|
@ -1235,6 +1616,14 @@ nm_ip4_route_set_dest (NMIP4Route *route, guint32 dest)
|
|||
route->dest = dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_get_prefix:
|
||||
* @route: the #NMIP4Route
|
||||
*
|
||||
* Gets the IPv4 prefix (ie "24" or "30" etc) of this route.
|
||||
*
|
||||
* Returns: the IPv4 prefix
|
||||
**/
|
||||
guint32
|
||||
nm_ip4_route_get_prefix (NMIP4Route *route)
|
||||
{
|
||||
|
@ -1244,6 +1633,13 @@ nm_ip4_route_get_prefix (NMIP4Route *route)
|
|||
return route->prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_set_prefix:
|
||||
* @route: the #NMIP4Route
|
||||
* @prefix: the prefix, a number between 0 and 32 inclusive
|
||||
*
|
||||
* Sets the IPv4 prefix of this route.
|
||||
**/
|
||||
void
|
||||
nm_ip4_route_set_prefix (NMIP4Route *route, guint32 prefix)
|
||||
{
|
||||
|
@ -1253,6 +1649,14 @@ nm_ip4_route_set_prefix (NMIP4Route *route, guint32 prefix)
|
|||
route->prefix = prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_get_next_hop:
|
||||
* @route: the #NMIP4Route
|
||||
*
|
||||
* Gets the IPv4 address of the next hop of this route.
|
||||
*
|
||||
* Returns: the IPv4 address in network byte order
|
||||
**/
|
||||
guint32
|
||||
nm_ip4_route_get_next_hop (NMIP4Route *route)
|
||||
{
|
||||
|
@ -1262,6 +1666,13 @@ nm_ip4_route_get_next_hop (NMIP4Route *route)
|
|||
return route->next_hop;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_set_next_hop:
|
||||
* @route: the #NMIP4Route
|
||||
* @next_hop: the IPv4 address of the next hop in network byte order
|
||||
*
|
||||
* Sets the IPv4 address of the next hop of this route.
|
||||
**/
|
||||
void
|
||||
nm_ip4_route_set_next_hop (NMIP4Route *route, guint32 next_hop)
|
||||
{
|
||||
|
@ -1271,6 +1682,15 @@ nm_ip4_route_set_next_hop (NMIP4Route *route, guint32 next_hop)
|
|||
route->next_hop = next_hop;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_get_metric:
|
||||
* @route: the #NMIP4Route
|
||||
*
|
||||
* Gets the route metric property of this route object; lower values indicate
|
||||
* "better" or more preferred routes.
|
||||
*
|
||||
* Returns: the route metric
|
||||
**/
|
||||
guint32
|
||||
nm_ip4_route_get_metric (NMIP4Route *route)
|
||||
{
|
||||
|
@ -1280,6 +1700,14 @@ nm_ip4_route_get_metric (NMIP4Route *route)
|
|||
return route->metric;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_ip4_route_set_metric:
|
||||
* @route: the #NMIP4Route
|
||||
* @metric: the route metric
|
||||
*
|
||||
* Sets the route metric property of this route object; lower values indicate
|
||||
* "better" or more preferred routes.
|
||||
**/
|
||||
void
|
||||
nm_ip4_route_set_metric (NMIP4Route *route, guint32 metric)
|
||||
{
|
||||
|
|
|
@ -39,8 +39,16 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_IP4_CONFIG_SETTING_NAME "ipv4"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/**
|
||||
* NMSettingIP4ConfigError:
|
||||
* @NM_SETTING_IP4_CONFIG_ERROR_UNKNOWN: unknown or unclassified error
|
||||
* @NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY: the property was invalid
|
||||
* @NM_SETTING_IP4_CONFIG_ERROR_MISSING_PROPERTY: the property was missing and is
|
||||
* required
|
||||
* @NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD: the property's value is
|
||||
* not valid with the given IP4 method
|
||||
*/
|
||||
typedef enum {
|
||||
NM_SETTING_IP4_CONFIG_ERROR_UNKNOWN = 0,
|
||||
NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
|
||||
NM_SETTING_IP4_CONFIG_ERROR_MISSING_PROPERTY,
|
||||
|
@ -66,10 +74,48 @@ GQuark nm_setting_ip4_config_error_quark (void);
|
|||
#define NM_SETTING_IP4_CONFIG_NEVER_DEFAULT "never-default"
|
||||
#define NM_SETTING_IP4_CONFIG_MAY_FAIL "may-fail"
|
||||
|
||||
/**
|
||||
* NM_SETTING_IP4_CONFIG_METHOD_AUTO:
|
||||
*
|
||||
* IPv4 configuration should be automatically determined via a method appropriate
|
||||
* for the hardware interface, ie DHCP or PPP or some other device-specific
|
||||
* manner.
|
||||
*/
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD_AUTO "auto"
|
||||
|
||||
/**
|
||||
* NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL:
|
||||
*
|
||||
* IPv4 configuration should be automatically configured for link-local-only
|
||||
* operation.
|
||||
*/
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL "link-local"
|
||||
|
||||
/**
|
||||
* NM_SETTING_IP4_CONFIG_METHOD_MANUAL:
|
||||
*
|
||||
* All necessary IPv4 configuration (addresses, prefix, DNS, etc) is specified
|
||||
* in the setting's properties.
|
||||
*/
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD_MANUAL "manual"
|
||||
|
||||
/**
|
||||
* NM_SETTING_IP4_CONFIG_METHOD_SHARED:
|
||||
*
|
||||
* This connection specifies configuration that allows other computers to
|
||||
* connect through it to the default network (usually the Internet). The
|
||||
* connection's interface will be assigned a private address, and a DHCP server,
|
||||
* caching DNS server, and Network Address Translation (NAT) functionality will
|
||||
* be started on this connection's interface to allow other devices to connect
|
||||
* through that interface to the default network.
|
||||
*/
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD_SHARED "shared"
|
||||
|
||||
/**
|
||||
* NM_SETTING_IP4_CONFIG_METHOD_DISABLED:
|
||||
*
|
||||
* This connection does not use or require IPv4 address and it should be disabled.
|
||||
*/
|
||||
#define NM_SETTING_IP4_CONFIG_METHOD_DISABLED "disabled"
|
||||
|
||||
typedef struct NMIP4Address NMIP4Address;
|
||||
|
@ -100,7 +146,7 @@ typedef struct NMIP4Route NMIP4Route;
|
|||
GType nm_ip4_route_get_type (void);
|
||||
|
||||
NMIP4Route * nm_ip4_route_new (void);
|
||||
NMIP4Route * nm_ip4_route_dup (NMIP4Route *route);
|
||||
NMIP4Route * nm_ip4_route_dup (NMIP4Route *source);
|
||||
void nm_ip4_route_ref (NMIP4Route *route);
|
||||
void nm_ip4_route_unref (NMIP4Route *route);
|
||||
/* Return TRUE if routes are identical */
|
||||
|
|
Loading…
Reference in a new issue