1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
19 * Copyright 2007 - 2014 Red Hat, Inc.
20 * Copyright 2007 - 2008 Novell, Inc.
23 #ifndef __NM_SETTING_CONNECTION_H__
24 #define __NM_SETTING_CONNECTION_H__
26 #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
27 #error "Only <NetworkManager.h> can be included directly."
30 #include "nm-setting.h"
34 #define NM_TYPE_SETTING_CONNECTION (nm_setting_connection_get_type ())
35 #define NM_SETTING_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_CONNECTION, NMSettingConnection))
36 #define NM_SETTING_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_CONNECTION, NMSettingConnectionClass))
37 #define NM_IS_SETTING_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_CONNECTION))
38 #define NM_IS_SETTING_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_CONNECTION))
39 #define NM_SETTING_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_CONNECTION, NMSettingConnectionClass))
41 #define NM_SETTING_CONNECTION_SETTING_NAME "connection"
43 #define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN -999
44 #define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MAX 999
45 #define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT 0
47 #define NM_SETTING_CONNECTION_ID "id"
48 #define NM_SETTING_CONNECTION_UUID "uuid"
49 #define NM_SETTING_CONNECTION_INTERFACE_NAME "interface-name"
50 #define NM_SETTING_CONNECTION_TYPE "type"
51 #define NM_SETTING_CONNECTION_AUTOCONNECT "autoconnect"
52 #define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY "autoconnect-priority"
53 #define NM_SETTING_CONNECTION_TIMESTAMP "timestamp"
54 #define NM_SETTING_CONNECTION_READ_ONLY "read-only"
55 #define NM_SETTING_CONNECTION_PERMISSIONS "permissions"
56 #define NM_SETTING_CONNECTION_ZONE "zone"
57 #define NM_SETTING_CONNECTION_MASTER "master"
58 #define NM_SETTING_CONNECTION_SLAVE_TYPE "slave-type"
59 #define NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES "autoconnect-slaves"
60 #define NM_SETTING_CONNECTION_SECONDARIES "secondaries"
61 #define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout"
62 #define NM_SETTING_CONNECTION_METERED "metered"
63 #define NM_SETTING_CONNECTION_LLDP "lldp"
65 /* Types for property values */
67 * NMSettingConnectionAutoconnectSlaves:
68 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT: default value
69 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO: slaves are not brought up when
71 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES: slaves are brought up when
74 * #NMSettingConnectionAutoconnectSlaves values indicate whether slave connections
75 * should be activated when master is activated.
78 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT = -1,
79 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO = 0,
80 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES = 1,
81 } NMSettingConnectionAutoconnectSlaves;
84 * NMSettingConnectionLldp:
85 * @NM_SETTING_CONNECTION_LLDP_DEFAULT: default value
86 * @NM_SETTING_CONNECTION_LLDP_DISABLE: disable LLDP
87 * @NM_SETTING_CONNECTION_LLDP_ENABLE_RX: enable reception of LLDP frames
89 * #NMSettingConnectionLldp values indicate whether LLDP should be enabled.
92 NM_SETTING_CONNECTION_LLDP_DEFAULT = -1,
93 NM_SETTING_CONNECTION_LLDP_DISABLE = 0,
94 NM_SETTING_CONNECTION_LLDP_ENABLE_RX = 1,
95 } NMSettingConnectionLldp;
98 * NMSettingConnection:
100 * The NMSettingConnection struct contains only private data.
101 * It should only be accessed through the functions described below.
103 struct _NMSettingConnection {
108 NMSettingClass parent;
112 } NMSettingConnectionClass;
114 GType nm_setting_connection_get_type (void);
116 NMSetting * nm_setting_connection_new (void);
117 const char *nm_setting_connection_get_id (NMSettingConnection *setting);
118 const char *nm_setting_connection_get_uuid (NMSettingConnection *setting);
119 const char *nm_setting_connection_get_interface_name (NMSettingConnection *setting);
120 const char *nm_setting_connection_get_connection_type (NMSettingConnection *setting);
121 gboolean nm_setting_connection_get_autoconnect (NMSettingConnection *setting);
122 gint nm_setting_connection_get_autoconnect_priority (NMSettingConnection *setting);
123 guint64 nm_setting_connection_get_timestamp (NMSettingConnection *setting);
124 gboolean nm_setting_connection_get_read_only (NMSettingConnection *setting);
126 guint32 nm_setting_connection_get_num_permissions (NMSettingConnection *setting);
127 gboolean nm_setting_connection_get_permission (NMSettingConnection *setting,
129 const char **out_ptype,
130 const char **out_pitem,
131 const char **out_detail);
132 const char *nm_setting_connection_get_zone (NMSettingConnection *setting);
133 gboolean nm_setting_connection_permissions_user_allowed (NMSettingConnection *setting, const char *uname);
134 gboolean nm_setting_connection_add_permission (NMSettingConnection *setting,
138 void nm_setting_connection_remove_permission (NMSettingConnection *setting,
140 gboolean nm_setting_connection_remove_permission_by_value (NMSettingConnection *setting,
145 const char *nm_setting_connection_get_master (NMSettingConnection *setting);
146 gboolean nm_setting_connection_is_slave_type (NMSettingConnection *setting,
148 const char *nm_setting_connection_get_slave_type (NMSettingConnection *setting);
150 NMSettingConnectionAutoconnectSlaves nm_setting_connection_get_autoconnect_slaves (NMSettingConnection *setting);
152 guint32 nm_setting_connection_get_num_secondaries (NMSettingConnection *setting);
153 const char *nm_setting_connection_get_secondary (NMSettingConnection *setting, guint32 idx);
154 gboolean nm_setting_connection_add_secondary (NMSettingConnection *setting, const char *sec_uuid);
155 void nm_setting_connection_remove_secondary (NMSettingConnection *setting, guint32 idx);
156 gboolean nm_setting_connection_remove_secondary_by_value (NMSettingConnection *setting, const char *sec_uuid);
158 guint32 nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting);
160 NMMetered nm_setting_connection_get_metered (NMSettingConnection *setting);
162 NMSettingConnectionLldp nm_setting_connection_get_lldp (NMSettingConnection *setting);
166 #endif /* __NM_SETTING_CONNECTION_H__ */