1    	/* nmcli - command-line tool to control NetworkManager
2    	 *
3    	 * This program is free software; you can redistribute it and/or modify
4    	 * it under the terms of the GNU General Public License as published by
5    	 * the Free Software Foundation; either version 2 of the License, or
6    	 * (at your option) any later version.
7    	 *
8    	 * This program 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
11   	 * GNU General Public License for more details.
12   	 *
13   	 * You should have received a copy of the GNU General Public License along
14   	 * with this program; if not, write to the Free Software Foundation, Inc.,
15   	 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16   	 *
17   	 * (C) Copyright 2010 - 2013 Red Hat, Inc.
18   	 */
19   	
20   	#include "config.h"
21   	
22   	#include <net/if_arp.h>
23   	#include <stdio.h>
24   	
25   	#include <glib.h>
26   	#include <glib/gi18n.h>
27   	#include <libnm-util/nm-utils.h>
28   	
29   	#include "utils.h"
30   	#include "common.h"
31   	#include "settings.h"
32   	
33   	/* Forward declarations */
34   	static char *wep_key_type_to_string (NMWepKeyType type);
35   	
36   	/* Helper macro to define fields */
37   	#define SETTING_FIELD(setting, width) { setting, N_(setting), width, NULL, FALSE, FALSE, 0 }
38   	
39   	/* Available fields for NM_SETTING_CONNECTION_SETTING_NAME */
40   	static NmcOutputField nmc_fields_setting_connection[] = {
41   		SETTING_FIELD ("name",  15),                                     /* 0 */
42   		SETTING_FIELD (NM_SETTING_CONNECTION_ID, 25),                    /* 1 */
43   		SETTING_FIELD (NM_SETTING_CONNECTION_UUID, 38),                  /* 2 */
44   		SETTING_FIELD (NM_SETTING_CONNECTION_INTERFACE_NAME, 20),        /* 3 */
45   		SETTING_FIELD (NM_SETTING_CONNECTION_TYPE, 17),                  /* 4 */
46   		SETTING_FIELD (NM_SETTING_CONNECTION_AUTOCONNECT, 13),           /* 5 */
47   		SETTING_FIELD (NM_SETTING_CONNECTION_TIMESTAMP, 10),             /* 6 */
48   		SETTING_FIELD (NM_SETTING_CONNECTION_READ_ONLY, 10),             /* 7 */
49   		SETTING_FIELD (NM_SETTING_CONNECTION_PERMISSIONS, 30),           /* 8 */
50   		SETTING_FIELD (NM_SETTING_CONNECTION_ZONE, 10),                  /* 9 */
51   		SETTING_FIELD (NM_SETTING_CONNECTION_MASTER, 20),                /* 10 */
52   		SETTING_FIELD (NM_SETTING_CONNECTION_SLAVE_TYPE, 20),            /* 11 */
53   		SETTING_FIELD (NM_SETTING_CONNECTION_SECONDARIES, 40),           /* 12 */
54   		SETTING_FIELD (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, 30),  /* 13 */
55   		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
56   	};
57   	#define NMC_FIELDS_SETTING_CONNECTION_ALL     "name"","\
58   	                                              NM_SETTING_CONNECTION_ID","\
59   	                                              NM_SETTING_CONNECTION_UUID","\
60   	                                              NM_SETTING_CONNECTION_INTERFACE_NAME","\
61   	                                              NM_SETTING_CONNECTION_TYPE","\
62   	                                              NM_SETTING_CONNECTION_AUTOCONNECT","\
63   	                                              NM_SETTING_CONNECTION_TIMESTAMP","\
64   	                                              NM_SETTING_CONNECTION_READ_ONLY","\
65   	                                              NM_SETTING_CONNECTION_PERMISSIONS","\
66   	                                              NM_SETTING_CONNECTION_ZONE","\
67   	                                              NM_SETTING_CONNECTION_MASTER","\
68   	                                              NM_SETTING_CONNECTION_SLAVE_TYPE","\
69   	                                              NM_SETTING_CONNECTION_SECONDARIES","\
70   	                                              NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT
71   	#define NMC_FIELDS_SETTING_CONNECTION_COMMON  NMC_FIELDS_SETTING_CONNECTION_ALL
72   	
73   	/* Available fields for NM_SETTING_WIRED_SETTING_NAME */
74   	static NmcOutputField nmc_fields_setting_wired[] = {
75   		SETTING_FIELD ("name",  17),                                  /* 0 */
76   		SETTING_FIELD (NM_SETTING_WIRED_PORT, 8),                     /* 1 */
77   		SETTING_FIELD (NM_SETTING_WIRED_SPEED, 10),                   /* 2 */
78   		SETTING_FIELD (NM_SETTING_WIRED_DUPLEX, 10),                  /* 3 */
79   		SETTING_FIELD (NM_SETTING_WIRED_AUTO_NEGOTIATE, 15),          /* 4 */
80   		SETTING_FIELD (NM_SETTING_WIRED_MAC_ADDRESS, 19),             /* 5 */
81   		SETTING_FIELD (NM_SETTING_WIRED_CLONED_MAC_ADDRESS, 19),      /* 6 */
82   		SETTING_FIELD (NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST, 39),   /* 7 */
83   		SETTING_FIELD (NM_SETTING_WIRED_MTU, 6),                      /* 8 */
84   		SETTING_FIELD (NM_SETTING_WIRED_S390_SUBCHANNELS, 20),        /* 9 */
85   		SETTING_FIELD (NM_SETTING_WIRED_S390_NETTYPE, 15),            /* 10 */
86   		SETTING_FIELD (NM_SETTING_WIRED_S390_OPTIONS, 20),            /* 11 */
87   		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
88   	};
89   	#define NMC_FIELDS_SETTING_WIRED_ALL     "name"","\
90   	                                         NM_SETTING_WIRED_PORT","\
91   	                                         NM_SETTING_WIRED_SPEED","\
92   	                                         NM_SETTING_WIRED_DUPLEX","\
93   	                                         NM_SETTING_WIRED_AUTO_NEGOTIATE","\
94   	                                         NM_SETTING_WIRED_MAC_ADDRESS","\
95   	                                         NM_SETTING_WIRED_CLONED_MAC_ADDRESS","\
96   	                                         NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST","\
97   	                                         NM_SETTING_WIRED_MTU","\
98   	                                         NM_SETTING_WIRED_S390_SUBCHANNELS","\
99   	                                         NM_SETTING_WIRED_S390_NETTYPE","\
100  	                                         NM_SETTING_WIRED_S390_OPTIONS
101  	#define NMC_FIELDS_SETTING_WIRED_COMMON  NMC_FIELDS_SETTING_WIRED_ALL
102  	
103  	/* Available fields for NM_SETTING_802_1X_SETTING_NAME */
104  	static NmcOutputField nmc_fields_setting_8021X[] = {
105  		SETTING_FIELD ("name", 10),                                              /* 0 */
106  		SETTING_FIELD (NM_SETTING_802_1X_EAP, 10),                               /* 1 */
107  		SETTING_FIELD (NM_SETTING_802_1X_IDENTITY, 15),                          /* 2 */
108  		SETTING_FIELD (NM_SETTING_802_1X_ANONYMOUS_IDENTITY, 15),                /* 3 */
109  		SETTING_FIELD (NM_SETTING_802_1X_PAC_FILE, 15),                          /* 4 */
110  		SETTING_FIELD (NM_SETTING_802_1X_CA_CERT, 10),                           /* 5 */
111  		SETTING_FIELD (NM_SETTING_802_1X_CA_PATH, 10),                           /* 6 */
112  		SETTING_FIELD (NM_SETTING_802_1X_SUBJECT_MATCH, 10),                     /* 7 */
113  		SETTING_FIELD (NM_SETTING_802_1X_ALTSUBJECT_MATCHES, 10),                /* 8 */
114  		SETTING_FIELD (NM_SETTING_802_1X_CLIENT_CERT, 10),                       /* 9 */
115  		SETTING_FIELD (NM_SETTING_802_1X_PHASE1_PEAPVER, 10),                    /* 10 */
116  		SETTING_FIELD (NM_SETTING_802_1X_PHASE1_PEAPLABEL, 10),                  /* 11 */
117  		SETTING_FIELD (NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING, 10),          /* 12 */
118  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_AUTH, 10),                       /* 13 */
119  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_AUTHEAP, 10),                    /* 14 */
120  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_CA_CERT, 20),                    /* 15 */
121  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_CA_PATH, 20),                    /* 16 */
122  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH, 10),              /* 17 */
123  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES, 10),         /* 18 */
124  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_CLIENT_CERT, 20),                /* 19 */
125  		SETTING_FIELD (NM_SETTING_802_1X_PASSWORD, 10),                          /* 20 */
126  		SETTING_FIELD (NM_SETTING_802_1X_PASSWORD_FLAGS, 20),                    /* 21 */
127  		SETTING_FIELD (NM_SETTING_802_1X_PASSWORD_RAW, 20),                      /* 22 */
128  		SETTING_FIELD (NM_SETTING_802_1X_PASSWORD_RAW_FLAGS, 20),                /* 23 */
129  		SETTING_FIELD (NM_SETTING_802_1X_PRIVATE_KEY, 15),                       /* 24 */
130  		SETTING_FIELD (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD, 20),              /* 25 */
131  		SETTING_FIELD (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS, 20),        /* 26 */
132  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, 20),                /* 27 */
133  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD, 20),       /* 28 */
134  		SETTING_FIELD (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS, 20), /* 29 */
135  		SETTING_FIELD (NM_SETTING_802_1X_PIN, 8),                                /* 30 */
136  		SETTING_FIELD (NM_SETTING_802_1X_PIN_FLAGS, 20),                         /* 31 */
137  		SETTING_FIELD (NM_SETTING_802_1X_SYSTEM_CA_CERTS, 17),                   /* 32 */
138  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
139  	};
140  	#define NMC_FIELDS_SETTING_802_1X_ALL     "name"","\
141  	                                          NM_SETTING_802_1X_EAP","\
142  	                                          NM_SETTING_802_1X_IDENTITY","\
143  	                                          NM_SETTING_802_1X_ANONYMOUS_IDENTITY","\
144  	                                          NM_SETTING_802_1X_PAC_FILE","\
145  	                                          NM_SETTING_802_1X_CA_CERT","\
146  	                                          NM_SETTING_802_1X_CA_PATH","\
147  	                                          NM_SETTING_802_1X_SUBJECT_MATCH","\
148  	                                          NM_SETTING_802_1X_ALTSUBJECT_MATCHES","\
149  	                                          NM_SETTING_802_1X_CLIENT_CERT","\
150  	                                          NM_SETTING_802_1X_PHASE1_PEAPVER","\
151  	                                          NM_SETTING_802_1X_PHASE1_PEAPLABEL","\
152  	                                          NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING","\
153  	                                          NM_SETTING_802_1X_PHASE2_AUTH","\
154  	                                          NM_SETTING_802_1X_PHASE2_AUTHEAP","\
155  	                                          NM_SETTING_802_1X_PHASE2_CA_CERT","\
156  	                                          NM_SETTING_802_1X_PHASE2_CA_PATH","\
157  	                                          NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH","\
158  	                                          NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES","\
159  	                                          NM_SETTING_802_1X_PHASE2_CLIENT_CERT","\
160  	                                          NM_SETTING_802_1X_PASSWORD","\
161  	                                          NM_SETTING_802_1X_PASSWORD_FLAGS","\
162  	                                          NM_SETTING_802_1X_PASSWORD_RAW","\
163  	                                          NM_SETTING_802_1X_PASSWORD_RAW_FLAGS","\
164  	                                          NM_SETTING_802_1X_PRIVATE_KEY","\
165  	                                          NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD","\
166  	                                          NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS","\
167  	                                          NM_SETTING_802_1X_PHASE2_PRIVATE_KEY","\
168  	                                          NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD","\
169  	                                          NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS","\
170  	                                          NM_SETTING_802_1X_PIN","\
171  	                                          NM_SETTING_802_1X_PIN_FLAGS","\
172  	                                          NM_SETTING_802_1X_SYSTEM_CA_CERTS
173  	#define NMC_FIELDS_SETTING_802_1X_COMMON  NMC_FIELDS_SETTING_802_1X_ALL
174  	
175  	/* Available fields for NM_SETTING_WIRELESS_SETTING_NAME */
176  	static NmcOutputField nmc_fields_setting_wireless[] = {
177  		SETTING_FIELD ("name", 17),                                        /* 0 */
178  		SETTING_FIELD (NM_SETTING_WIRELESS_SSID, 34),                      /* 1 */
179  		SETTING_FIELD (NM_SETTING_WIRELESS_MODE, 15),                      /* 2 */
180  		SETTING_FIELD (NM_SETTING_WIRELESS_BAND, 10),                      /* 3 */
181  		SETTING_FIELD (NM_SETTING_WIRELESS_CHANNEL, 10),                   /* 4 */
182  		SETTING_FIELD (NM_SETTING_WIRELESS_BSSID, 19),                     /* 5 */
183  		SETTING_FIELD (NM_SETTING_WIRELESS_RATE, 10),                      /* 6 */
184  		SETTING_FIELD (NM_SETTING_WIRELESS_TX_POWER, 10),                  /* 7 */
185  		SETTING_FIELD (NM_SETTING_WIRELESS_MAC_ADDRESS, 19),               /* 8 */
186  		SETTING_FIELD (NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS, 19),        /* 9 */
187  		SETTING_FIELD (NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST, 39),     /* 10 */
188  		SETTING_FIELD (NM_SETTING_WIRELESS_MTU, 6),                        /* 11 */
189  		SETTING_FIELD (NM_SETTING_WIRELESS_SEEN_BSSIDS, 35),               /* 12 */
190  		SETTING_FIELD (NM_SETTING_WIRELESS_HIDDEN, 10),                    /* 13 */
191  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
192  	};
193  	#define NMC_FIELDS_SETTING_WIRELESS_ALL     "name"","\
194  	                                            NM_SETTING_WIRELESS_SSID","\
195  	                                            NM_SETTING_WIRELESS_MODE","\
196  	                                            NM_SETTING_WIRELESS_BAND","\
197  	                                            NM_SETTING_WIRELESS_CHANNEL","\
198  	                                            NM_SETTING_WIRELESS_BSSID","\
199  	                                            NM_SETTING_WIRELESS_RATE","\
200  	                                            NM_SETTING_WIRELESS_TX_POWER","\
201  	                                            NM_SETTING_WIRELESS_MAC_ADDRESS","\
202  	                                            NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS","\
203  	                                            NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST","\
204  	                                            NM_SETTING_WIRELESS_MTU","\
205  	                                            NM_SETTING_WIRELESS_SEEN_BSSIDS","\
206  	                                            NM_SETTING_WIRELESS_HIDDEN
207  	#define NMC_FIELDS_SETTING_WIRELESS_COMMON  NMC_FIELDS_SETTING_WIRELESS_ALL
208  	
209  	/* Available fields for NM_SETTING_WIRELESS_SECURITY_SETTING_NAME */
210  	static NmcOutputField nmc_fields_setting_wireless_security[] = {
211  		SETTING_FIELD ("name", 25),                                           /* 0 */
212  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, 10),            /* 1 */
213  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, 15),       /* 2 */
214  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, 10),            /* 3 */
215  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_PROTO, 10),               /* 4 */
216  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_PAIRWISE, 10),            /* 5 */
217  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_GROUP, 10),               /* 6 */
218  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, 15),       /* 7 */
219  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, 10),            /* 8 */
220  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_WEP_KEY1, 10),            /* 9 */
221  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_WEP_KEY2, 10),            /* 10 */
222  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_WEP_KEY3, 10),            /* 11 */
223  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, 20),       /* 12 */
224  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, 15),        /* 13 */
225  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_PSK, 6),                  /* 14 */
226  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS, 20),           /* 15 */
227  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, 15),       /* 16 */
228  		SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS, 20), /* 17 */
229  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
230  	};
231  	#define NMC_FIELDS_SETTING_WIRELESS_SECURITY_ALL     "name"","\
232  	                                                     NM_SETTING_WIRELESS_SECURITY_KEY_MGMT","\
233  	                                                     NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX","\
234  	                                                     NM_SETTING_WIRELESS_SECURITY_AUTH_ALG","\
235  	                                                     NM_SETTING_WIRELESS_SECURITY_PROTO","\
236  	                                                     NM_SETTING_WIRELESS_SECURITY_PAIRWISE","\
237  	                                                     NM_SETTING_WIRELESS_SECURITY_GROUP","\
238  	                                                     NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME","\
239  	                                                     NM_SETTING_WIRELESS_SECURITY_WEP_KEY0","\
240  	                                                     NM_SETTING_WIRELESS_SECURITY_WEP_KEY1","\
241  	                                                     NM_SETTING_WIRELESS_SECURITY_WEP_KEY2","\
242  	                                                     NM_SETTING_WIRELESS_SECURITY_WEP_KEY3","\
243  	                                                     NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS","\
244  	                                                     NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE","\
245  	                                                     NM_SETTING_WIRELESS_SECURITY_PSK","\
246  	                                                     NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS","\
247  	                                                     NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD","\
248  	                                                     NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS
249  	#define NMC_FIELDS_SETTING_WIRELESS_SECURITY_COMMON  NMC_FIELDS_SETTING_WIRELESS_SECURITY_ALL
250  	
251  	/* Available fields for NM_SETTING_IP4_CONFIG_SETTING_NAME */
252  	static NmcOutputField nmc_fields_setting_ip4_config[] = {
253  		SETTING_FIELD ("name", 8),                                         /* 0 */
254  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_METHOD, 10),                  /* 1 */
255  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS, 20),                     /* 2 */
256  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS_SEARCH, 15),              /* 3 */
257  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_ADDRESSES, 20),               /* 4 */
258  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_ROUTES, 20),                  /* 5 */
259  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, 19),      /* 6 */
260  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, 16),         /* 7 */
261  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, 15),          /* 8 */
262  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, 19),      /* 9 */
263  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, 14),           /* 10 */
264  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, 15),           /* 11 */
265  		SETTING_FIELD (NM_SETTING_IP4_CONFIG_MAY_FAIL, 12),                /* 12 */
266  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
267  	};
268  	#define NMC_FIELDS_SETTING_IP4_CONFIG_ALL     "name"","\
269  	                                              NM_SETTING_IP4_CONFIG_METHOD","\
270  	                                              NM_SETTING_IP4_CONFIG_DNS","\
271  	                                              NM_SETTING_IP4_CONFIG_DNS_SEARCH","\
272  	                                              NM_SETTING_IP4_CONFIG_ADDRESSES","\
273  	                                              NM_SETTING_IP4_CONFIG_ROUTES","\
274  	                                              NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES","\
275  	                                              NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS","\
276  	                                              NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID","\
277  	                                              NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME","\
278  	                                              NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME","\
279  	                                              NM_SETTING_IP4_CONFIG_NEVER_DEFAULT","\
280  	                                              NM_SETTING_IP4_CONFIG_MAY_FAIL
281  	#define NMC_FIELDS_SETTING_IP4_CONFIG_COMMON  NMC_FIELDS_SETTING_IP4_CONFIG_ALL
282  	
283  	/* Available fields for NM_SETTING_IP6_CONFIG_SETTING_NAME */
284  	static NmcOutputField nmc_fields_setting_ip6_config[] = {
285  		SETTING_FIELD ("name", 8),                                         /* 0 */
286  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_METHOD, 10),                  /* 1 */
287  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS, 20),                     /* 2 */
288  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS_SEARCH, 15),              /* 3 */
289  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_ADDRESSES, 20),               /* 4 */
290  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_ROUTES, 20),                  /* 5 */
291  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, 19),      /* 6 */
292  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, 16),         /* 7 */
293  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, 15),           /* 8 */
294  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_MAY_FAIL, 12),                /* 9 */
295  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, 15),             /* 10 */
296  		SETTING_FIELD (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, 14),           /* 11 */
297  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
298  	};
299  	#define NMC_FIELDS_SETTING_IP6_CONFIG_ALL     "name"","\
300  	                                              NM_SETTING_IP6_CONFIG_METHOD","\
301  	                                              NM_SETTING_IP6_CONFIG_DNS","\
302  	                                              NM_SETTING_IP6_CONFIG_DNS_SEARCH","\
303  	                                              NM_SETTING_IP6_CONFIG_ADDRESSES","\
304  	                                              NM_SETTING_IP6_CONFIG_ROUTES","\
305  	                                              NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES","\
306  	                                              NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS","\
307  	                                              NM_SETTING_IP6_CONFIG_NEVER_DEFAULT","\
308  	                                              NM_SETTING_IP6_CONFIG_MAY_FAIL","\
309  	                                              NM_SETTING_IP6_CONFIG_IP6_PRIVACY","\
310  	                                              NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME
311  	#define NMC_FIELDS_SETTING_IP6_CONFIG_COMMON  NMC_FIELDS_SETTING_IP4_CONFIG_ALL
312  	
313  	/* Available fields for NM_SETTING_SERIAL_SETTING_NAME */
314  	static NmcOutputField nmc_fields_setting_serial[] = {
315  		SETTING_FIELD ("name", 10),                                        /* 0 */
316  		SETTING_FIELD (NM_SETTING_SERIAL_BAUD, 10),                        /* 1 */
317  		SETTING_FIELD (NM_SETTING_SERIAL_BITS, 10),                        /* 2 */
318  		SETTING_FIELD (NM_SETTING_SERIAL_PARITY, 10),                      /* 3 */
319  		SETTING_FIELD (NM_SETTING_SERIAL_STOPBITS, 10),                    /* 4 */
320  		SETTING_FIELD (NM_SETTING_SERIAL_SEND_DELAY, 12),                  /* 5 */
321  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
322  	};
323  	#define NMC_FIELDS_SETTING_SERIAL_ALL     "name"","\
324  	                                          NM_SETTING_SERIAL_BAUD","\
325  	                                          NM_SETTING_SERIAL_BITS","\
326  	                                          NM_SETTING_SERIAL_PARITY","\
327  	                                          NM_SETTING_SERIAL_STOPBITS","\
328  	                                          NM_SETTING_SERIAL_SEND_DELAY
329  	#define NMC_FIELDS_SETTING_SERIAL_COMMON  NMC_FIELDS_SETTING_SERIAL_ALL
330  	
331  	/* Available fields for NM_SETTING_PPP_SETTING_NAME */
332  	static NmcOutputField nmc_fields_setting_ppp[] = {
333  		SETTING_FIELD ("name", 10),                                        /* 0 */
334  		SETTING_FIELD (NM_SETTING_PPP_NOAUTH, 10),                         /* 1 */
335  		SETTING_FIELD (NM_SETTING_PPP_REFUSE_EAP, 10),                     /* 2 */
336  		SETTING_FIELD (NM_SETTING_PPP_REFUSE_PAP, 10),                     /* 3 */
337  		SETTING_FIELD (NM_SETTING_PPP_REFUSE_CHAP, 10),                    /* 4 */
338  		SETTING_FIELD (NM_SETTING_PPP_REFUSE_MSCHAP, 10),                  /* 5 */
339  		SETTING_FIELD (NM_SETTING_PPP_REFUSE_MSCHAPV2, 10),                /* 6 */
340  		SETTING_FIELD (NM_SETTING_PPP_NOBSDCOMP, 10),                      /* 7 */
341  		SETTING_FIELD (NM_SETTING_PPP_NODEFLATE, 10),                      /* 8 */
342  		SETTING_FIELD (NM_SETTING_PPP_NO_VJ_COMP, 10),                     /* 9 */
343  		SETTING_FIELD (NM_SETTING_PPP_REQUIRE_MPPE, 10),                   /* 10 */
344  		SETTING_FIELD (NM_SETTING_PPP_REQUIRE_MPPE_128, 10),               /* 11 */
345  		SETTING_FIELD (NM_SETTING_PPP_MPPE_STATEFUL, 10),                  /* 12 */
346  		SETTING_FIELD (NM_SETTING_PPP_CRTSCTS, 10),                        /* 13 */
347  		SETTING_FIELD (NM_SETTING_PPP_BAUD, 10),                           /* 14 */
348  		SETTING_FIELD (NM_SETTING_PPP_MRU, 10),                            /* 15 */
349  		SETTING_FIELD (NM_SETTING_PPP_MTU, 10),                            /* 16 */
350  		SETTING_FIELD (NM_SETTING_PPP_LCP_ECHO_FAILURE, 17),               /* 17 */
351  		SETTING_FIELD (NM_SETTING_PPP_LCP_ECHO_INTERVAL, 18),              /* 18 */
352  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
353  	};
354  	#define NMC_FIELDS_SETTING_PPP_ALL     "name"","\
355  	                                       NM_SETTING_PPP_NOAUTH","\
356  	                                       NM_SETTING_PPP_REFUSE_EAP","\
357  	                                       NM_SETTING_PPP_REFUSE_PAP","\
358  	                                       NM_SETTING_PPP_REFUSE_CHAP","\
359  	                                       NM_SETTING_PPP_REFUSE_MSCHAP","\
360  	                                       NM_SETTING_PPP_REFUSE_MSCHAPV2","\
361  	                                       NM_SETTING_PPP_NOBSDCOMP","\
362  	                                       NM_SETTING_PPP_NODEFLATE","\
363  	                                       NM_SETTING_PPP_NO_VJ_COMP","\
364  	                                       NM_SETTING_PPP_REQUIRE_MPPE","\
365  	                                       NM_SETTING_PPP_REQUIRE_MPPE_128","\
366  	                                       NM_SETTING_PPP_MPPE_STATEFUL","\
367  	                                       NM_SETTING_PPP_CRTSCTS","\
368  	                                       NM_SETTING_PPP_BAUD","\
369  	                                       NM_SETTING_PPP_MRU","\
370  	                                       NM_SETTING_PPP_MTU","\
371  	                                       NM_SETTING_PPP_LCP_ECHO_FAILURE","\
372  	                                       NM_SETTING_PPP_LCP_ECHO_INTERVAL
373  	#define NMC_FIELDS_SETTING_PPP_COMMON  NMC_FIELDS_SETTING_PPP_ALL
374  	
375  	/* Available fields for NM_SETTING_PPPOE_SETTING_NAME */
376  	static NmcOutputField nmc_fields_setting_pppoe[] = {
377  		SETTING_FIELD ("name", 10),                                        /* 0 */
378  		SETTING_FIELD (NM_SETTING_PPPOE_SERVICE, 12),                      /* 1 */
379  		SETTING_FIELD (NM_SETTING_PPPOE_USERNAME, 15),                     /* 2 */
380  		SETTING_FIELD (NM_SETTING_PPPOE_PASSWORD, 15),                     /* 3 */
381  		SETTING_FIELD (NM_SETTING_PPPOE_PASSWORD_FLAGS, 20),               /* 4 */
382  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
383  	};
384  	#define NMC_FIELDS_SETTING_PPPOE_ALL     "name"","\
385  	                                         NM_SETTING_PPPOE_SERVICE","\
386  	                                         NM_SETTING_PPPOE_USERNAME","\
387  	                                         NM_SETTING_PPPOE_PASSWORD","\
388  	                                         NM_SETTING_PPPOE_PASSWORD_FLAGS
389  	#define NMC_FIELDS_SETTING_PPPOE_COMMON  NMC_FIELDS_SETTING_PPPOE_ALL
390  	
391  	/* Available fields for NM_SETTING_ADSL_SETTING_NAME */
392  	static NmcOutputField nmc_fields_setting_adsl[] = {
393  		SETTING_FIELD ("name", 10),                                /* 0 */
394  		SETTING_FIELD (NM_SETTING_ADSL_USERNAME, 15),              /* 1 */
395  		SETTING_FIELD (NM_SETTING_ADSL_PASSWORD, 15),              /* 2 */
396  		SETTING_FIELD (NM_SETTING_ADSL_PASSWORD_FLAGS, 20),        /* 3 */
397  		SETTING_FIELD (NM_SETTING_ADSL_PROTOCOL, 10),              /* 4 */
398  		SETTING_FIELD (NM_SETTING_ADSL_ENCAPSULATION, 10),         /* 5 */
399  		SETTING_FIELD (NM_SETTING_ADSL_VPI, 10),                   /* 6 */
400  		SETTING_FIELD (NM_SETTING_ADSL_VCI, 10),                   /* 7 */
401  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
402  	};
403  	#define NMC_FIELDS_SETTING_ADSL_ALL     "name"","\
404  	                                        NM_SETTING_ADSL_USERNAME","\
405  	                                        NM_SETTING_ADSL_PASSWORD","\
406  	                                        NM_SETTING_ADSL_PASSWORD_FLAGS","\
407  	                                        NM_SETTING_ADSL_PROTOCOL","\
408  	                                        NM_SETTING_ADSL_ENCAPSULATION","\
409  	                                        NM_SETTING_ADSL_VPI","\
410  	                                        NM_SETTING_ADSL_VCI
411  	#define NMC_FIELDS_SETTING_ADSL_COMMON  NMC_FIELDS_SETTING_ADSL_ALL
412  	
413  	/* Available fields for NM_SETTING_GSM_SETTING_NAME */
414  	static NmcOutputField nmc_fields_setting_gsm[] = {
415  		SETTING_FIELD ("name", 10),                                        /* 0 */
416  		SETTING_FIELD (NM_SETTING_GSM_NUMBER, 10),                         /* 1 */
417  		SETTING_FIELD (NM_SETTING_GSM_USERNAME, 15),                       /* 2 */
418  		SETTING_FIELD (NM_SETTING_GSM_PASSWORD, 15),                       /* 3 */
419  		SETTING_FIELD (NM_SETTING_GSM_PASSWORD_FLAGS, 20),                 /* 4 */
420  		SETTING_FIELD (NM_SETTING_GSM_APN, 25),                            /* 5 */
421  		SETTING_FIELD (NM_SETTING_GSM_NETWORK_ID, 12),                     /* 6 */
422  		SETTING_FIELD (NM_SETTING_GSM_NETWORK_TYPE, 15),                   /* 7 */
423  		SETTING_FIELD (NM_SETTING_GSM_ALLOWED_BANDS, 15),                  /* 8 */
424  		SETTING_FIELD (NM_SETTING_GSM_PIN, 10),                            /* 9 */
425  		SETTING_FIELD (NM_SETTING_GSM_PIN_FLAGS, 20),                      /* 10 */
426  		SETTING_FIELD (NM_SETTING_GSM_HOME_ONLY, 10),                      /* 11 */
427  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
428  	};
429  	#define NMC_FIELDS_SETTING_GSM_ALL     "name"","\
430  	                                       NM_SETTING_GSM_NUMBER","\
431  	                                       NM_SETTING_GSM_USERNAME","\
432  	                                       NM_SETTING_GSM_PASSWORD","\
433  	                                       NM_SETTING_GSM_PASSWORD_FLAGS","\
434  	                                       NM_SETTING_GSM_APN","\
435  	                                       NM_SETTING_GSM_NETWORK_ID","\
436  	                                       NM_SETTING_GSM_NETWORK_TYPE","\
437  	                                       NM_SETTING_GSM_ALLOWED_BANDS","\
438  	                                       NM_SETTING_GSM_PIN","\
439  	                                       NM_SETTING_GSM_PIN_FLAGS","\
440  	                                       NM_SETTING_GSM_HOME_ONLY
441  	#define NMC_FIELDS_SETTING_GSM_COMMON  NMC_FIELDS_SETTING_GSM_ALL
442  	
443  	/* Available fields for NM_SETTING_CDMA_SETTING_NAME */
444  	static NmcOutputField nmc_fields_setting_cdma[] = {
445  		SETTING_FIELD ("name", 10),                                        /* 0 */
446  		SETTING_FIELD (NM_SETTING_CDMA_NUMBER, 15),                        /* 1 */
447  		SETTING_FIELD (NM_SETTING_CDMA_USERNAME, 15),                      /* 2 */
448  		SETTING_FIELD (NM_SETTING_CDMA_PASSWORD, 15),                      /* 3 */
449  		SETTING_FIELD (NM_SETTING_CDMA_PASSWORD_FLAGS, 20),                /* 4 */
450  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
451  	};
452  	#define NMC_FIELDS_SETTING_CDMA_ALL     "name"","\
453  	                                        NM_SETTING_CDMA_NUMBER","\
454  	                                        NM_SETTING_CDMA_USERNAME","\
455  	                                        NM_SETTING_CDMA_PASSWORD","\
456  	                                        NM_SETTING_CDMA_PASSWORD_FLAGS
457  	#define NMC_FIELDS_SETTING_CDMA_COMMON  NMC_FIELDS_SETTING_CDMA_ALL
458  	
459  	/* Available fields for NM_SETTING_BLUETOOTH_SETTING_NAME */
460  	static NmcOutputField nmc_fields_setting_bluetooth[] = {
461  		SETTING_FIELD ("name", 11),                                        /* 0 */
462  		SETTING_FIELD (NM_SETTING_BLUETOOTH_BDADDR, 19),                   /* 1 */
463  		SETTING_FIELD (NM_SETTING_BLUETOOTH_TYPE, 10),                     /* 2 */
464  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
465  	};
466  	#define NMC_FIELDS_SETTING_BLUETOOTH_ALL     "name"","\
467  	                                             NM_SETTING_BLUETOOTH_BDADDR","\
468  	                                             NM_SETTING_BLUETOOTH_TYPE
469  	#define NMC_FIELDS_SETTING_BLUETOOTH_COMMON  NMC_FIELDS_SETTING_BLUETOOTH_ALL
470  	
471  	/* Available fields for NM_SETTING_OLPC_MESH_SETTING_NAME */
472  	static NmcOutputField nmc_fields_setting_olpc_mesh[] = {
473  		SETTING_FIELD ("name", 18),                                        /* 0 */
474  		SETTING_FIELD (NM_SETTING_OLPC_MESH_SSID, 34),                     /* 1 */
475  		SETTING_FIELD (NM_SETTING_OLPC_MESH_CHANNEL, 12),                  /* 2 */
476  		SETTING_FIELD (NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS, 17),     /* 3 */
477  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
478  	};
479  	#define NMC_FIELDS_SETTING_OLPC_MESH_ALL     "name"","\
480  	                                             NM_SETTING_OLPC_MESH_SSID","\
481  	                                             NM_SETTING_OLPC_MESH_CHANNEL","\
482  	                                             NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS
483  	#define NMC_FIELDS_SETTING_OLPC_MESH_COMMON  NMC_FIELDS_SETTING_OLPC_MESH_ALL
484  	
485  	/* Available fields for NM_SETTING_VPN_SETTING_NAME */
486  	static NmcOutputField nmc_fields_setting_vpn[] = {
487  		SETTING_FIELD ("name", 6),                                         /* 0 */
488  		SETTING_FIELD (NM_SETTING_VPN_SERVICE_TYPE, 40),                   /* 1 */
489  		SETTING_FIELD (NM_SETTING_VPN_USER_NAME, 12),                      /* 2 */
490  		SETTING_FIELD (NM_SETTING_VPN_DATA, 30),                           /* 3 */
491  		SETTING_FIELD (NM_SETTING_VPN_SECRETS, 15),                        /* 4 */
492  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
493  	};
494  	#define NMC_FIELDS_SETTING_VPN_ALL     "name"","\
495  	                                       NM_SETTING_VPN_SERVICE_TYPE","\
496  	                                       NM_SETTING_VPN_USER_NAME","\
497  	                                       NM_SETTING_VPN_DATA","\
498  	                                       NM_SETTING_VPN_SECRETS
499  	#define NMC_FIELDS_SETTING_VPN_COMMON  NMC_FIELDS_SETTING_VPN_ALL
500  	
501  	/* Available fields for NM_SETTING_WIMAX_SETTING_NAME */
502  	static NmcOutputField nmc_fields_setting_wimax[] = {
503  		SETTING_FIELD ("name", 6),                                         /* 0 */
504  		SETTING_FIELD (NM_SETTING_WIMAX_MAC_ADDRESS, 19),                  /* 1 */
505  		SETTING_FIELD (NM_SETTING_WIMAX_NETWORK_NAME, 40),                 /* 2 */
506  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
507  	};
508  	#define NMC_FIELDS_SETTING_WIMAX_ALL     "name"","\
509  	                                         NM_SETTING_WIMAX_MAC_ADDRESS","\
510  	                                         NM_SETTING_WIMAX_NETWORK_NAME
511  	#define NMC_FIELDS_SETTING_WIMAX_COMMON  NMC_FIELDS_SETTING_WIMAX_ALL
512  	
513  	/* Available fields for NM_SETTING_INFINIBAND_SETTING_NAME */
514  	static NmcOutputField nmc_fields_setting_infiniband[] = {
515  		SETTING_FIELD ("name",  12),                                       /* 0 */
516  		SETTING_FIELD (NM_SETTING_INFINIBAND_MAC_ADDRESS, 61),             /* 1 */
517  		SETTING_FIELD (NM_SETTING_INFINIBAND_MTU, 6),                      /* 2 */
518  		SETTING_FIELD (NM_SETTING_INFINIBAND_TRANSPORT_MODE, 12),          /* 3 */
519  		SETTING_FIELD (NM_SETTING_INFINIBAND_P_KEY, 6),                    /* 4 */
520  		SETTING_FIELD (NM_SETTING_INFINIBAND_PARENT, 16),                  /* 5 */
521  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
522  	};
523  	#define NMC_FIELDS_SETTING_INFINIBAND_ALL     "name"","\
524  	                                              NM_SETTING_INFINIBAND_MAC_ADDRESS","\
525  	                                              NM_SETTING_INFINIBAND_MTU"," \
526  	                                              NM_SETTING_INFINIBAND_TRANSPORT_MODE"," \
527  	                                              NM_SETTING_INFINIBAND_P_KEY"," \
528  	                                              NM_SETTING_INFINIBAND_PARENT
529  	#define NMC_FIELDS_SETTING_INFINIBAND_COMMON  NMC_FIELDS_SETTING_INFINIBAND_ALL \
530  	
531  	/* Available fields for NM_SETTING_BOND_SETTING_NAME */
532  	static NmcOutputField nmc_fields_setting_bond[] = {
533  		SETTING_FIELD ("name",  8),                                        /* 0 */
534  		SETTING_FIELD (NM_SETTING_BOND_INTERFACE_NAME, 15),                /* 1 */
535  		SETTING_FIELD (NM_SETTING_BOND_OPTIONS, 30),                       /* 2 */
536  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
537  	};
538  	#define NMC_FIELDS_SETTING_BOND_ALL     "name"","\
539  	                                        NM_SETTING_BOND_INTERFACE_NAME","\
540  	                                        NM_SETTING_BOND_OPTIONS
541  	#define NMC_FIELDS_SETTING_BOND_COMMON  NMC_FIELDS_SETTING_BOND_ALL
542  	
543  	/* Available fields for NM_SETTING_VLAN_SETTING_NAME */
544  	static NmcOutputField nmc_fields_setting_vlan[] = {
545  		SETTING_FIELD ("name",  6),                                        /* 0 */
546  		SETTING_FIELD (NM_SETTING_VLAN_INTERFACE_NAME, 15),                /* 1 */
547  		SETTING_FIELD (NM_SETTING_VLAN_PARENT, 8),                         /* 2 */
548  		SETTING_FIELD (NM_SETTING_VLAN_ID, 6),                             /* 3 */
549  		SETTING_FIELD (NM_SETTING_VLAN_FLAGS, 45),                         /* 4 */
550  		SETTING_FIELD (NM_SETTING_VLAN_INGRESS_PRIORITY_MAP, 22),          /* 5 */
551  		SETTING_FIELD (NM_SETTING_VLAN_EGRESS_PRIORITY_MAP, 22),           /* 6 */
552  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
553  	};
554  	#define NMC_FIELDS_SETTING_VLAN_ALL     "name"","\
555  	                                        NM_SETTING_VLAN_INTERFACE_NAME","\
556  	                                        NM_SETTING_VLAN_PARENT","\
557  	                                        NM_SETTING_VLAN_ID","\
558  	                                        NM_SETTING_VLAN_FLAGS","\
559  	                                        NM_SETTING_VLAN_INGRESS_PRIORITY_MAP","\
560  	                                        NM_SETTING_VLAN_EGRESS_PRIORITY_MAP
561  	#define NMC_FIELDS_SETTING_VLAN_COMMON  NMC_FIELDS_SETTING_VLAN_ALL
562  	
563  	/* Available fields for NM_SETTING_BRIDGE_SETTING_NAME */
564  	static NmcOutputField nmc_fields_setting_bridge[] = {
565  		SETTING_FIELD ("name",  8),                                        /* 0 */
566  		SETTING_FIELD (NM_SETTING_BRIDGE_INTERFACE_NAME, 15),              /* 1 */
567  		SETTING_FIELD (NM_SETTING_BRIDGE_STP, 5),                          /* 2 */
568  		SETTING_FIELD (NM_SETTING_BRIDGE_PRIORITY, 6),                     /* 3 */
569  		SETTING_FIELD (NM_SETTING_BRIDGE_FORWARD_DELAY, 6),                /* 4 */
570  		SETTING_FIELD (NM_SETTING_BRIDGE_HELLO_TIME, 6),                   /* 5 */
571  		SETTING_FIELD (NM_SETTING_BRIDGE_MAX_AGE, 6),                      /* 6 */
572  		SETTING_FIELD (NM_SETTING_BRIDGE_AGEING_TIME, 6),                  /* 7 */
573  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
574  	};
575  	#define NMC_FIELDS_SETTING_BRIDGE_ALL    "name"","\
576  	                                         NM_SETTING_BRIDGE_INTERFACE_NAME","\
577  	                                         NM_SETTING_BRIDGE_STP","\
578  	                                         NM_SETTING_BRIDGE_PRIORITY","\
579  	                                         NM_SETTING_BRIDGE_FORWARD_DELAY","\
580  	                                         NM_SETTING_BRIDGE_HELLO_TIME","\
581  	                                         NM_SETTING_BRIDGE_MAX_AGE","\
582  	                                         NM_SETTING_BRIDGE_AGEING_TIME
583  	#define NMC_FIELDS_SETTING_BRIDGE_COMMON NMC_FIELDS_SETTING_BRIDGE_ALL
584  	
585  	/* Available fields for NM_SETTING_BRIDGE_PORT_SETTING_NAME */
586  	static NmcOutputField nmc_fields_setting_bridge_port[] = {
587  		SETTING_FIELD ("name",  8),                                        /* 0 */
588  		SETTING_FIELD (NM_SETTING_BRIDGE_PORT_PRIORITY, 10),               /* 1 */
589  		SETTING_FIELD (NM_SETTING_BRIDGE_PORT_PATH_COST, 12),              /* 2 */
590  		SETTING_FIELD (NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, 15),           /* 3 */
591  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
592  	};
593  	#define NMC_FIELDS_SETTING_BRIDGE_PORT_ALL    "name"","\
594  	                                              NM_SETTING_BRIDGE_PORT_PRIORITY","\
595  	                                              NM_SETTING_BRIDGE_PORT_PATH_COST","\
596  	                                              NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE
597  	#define NMC_FIELDS_SETTING_BRIDGE_PORT_COMMON NMC_FIELDS_SETTING_BRIDGE_PORT_ALL
598  	
599  	/* Available fields for NM_SETTING_TEAM_SETTING_NAME */
600  	static NmcOutputField nmc_fields_setting_team[] = {
601  		SETTING_FIELD ("name",  8),                                        /* 0 */
602  		SETTING_FIELD (NM_SETTING_TEAM_INTERFACE_NAME, 15),                /* 1 */
603  		SETTING_FIELD (NM_SETTING_TEAM_CONFIG, 30),                        /* 2 */
604  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
605  	};
606  	#define NMC_FIELDS_SETTING_TEAM_ALL     "name"","\
607  	                                        NM_SETTING_TEAM_INTERFACE_NAME","\
608  	                                        NM_SETTING_TEAM_CONFIG
609  	#define NMC_FIELDS_SETTING_TEAM_COMMON  NMC_FIELDS_SETTING_TEAM_ALL
610  	
611  	/* Available fields for NM_SETTING_TEAM_PORT_SETTING_NAME */
612  	static NmcOutputField nmc_fields_setting_team_port[] = {
613  		SETTING_FIELD ("name",  8),                                        /* 0 */
614  		SETTING_FIELD (NM_SETTING_TEAM_PORT_CONFIG, 30),                   /* 1 */
615  		{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
616  	};
617  	#define NMC_FIELDS_SETTING_TEAM_PORT_ALL     "name"","\
618  	                                             NM_SETTING_TEAM_PORT_CONFIG
619  	#define NMC_FIELDS_SETTING_TEAM_PORT_COMMON  NMC_FIELDS_SETTING_TEAM_PORT_ALL
620  	
621  	
622  	/*----------------------------------------------------------------------------*/
623  	
624  	static char *
625  	wep_key_type_to_string (NMWepKeyType type)
626  	{
627  		switch (type) {
628  		case NM_WEP_KEY_TYPE_KEY:
629  			return g_strdup_printf (_("%d (hex-ascii-key)"), type);
630  		case NM_WEP_KEY_TYPE_PASSPHRASE:
631  			return g_strdup_printf (_("%d (104/128-bit passphrase)"), type);
632  		case NM_WEP_KEY_TYPE_UNKNOWN:
633  		default:
634  			return g_strdup_printf (_("%d (unknown)"), type);
635  		}
636  	}
637  	
638  	static char *
639  	byte_array_to_string (const GByteArray *array)
640  	{
641  		GString *cert = NULL;
642  		int i;
643  	
644  		if (array && array->len > 0)
645  			cert = g_string_new (NULL);
646  	
647  		for (i = 0; array && i < array->len; i++) {
648  			g_string_append_printf (cert, "%02X", array->data[i]);
649  		}
650  	
651  		return cert ? g_string_free (cert, FALSE) : NULL;
652  	}
653  	
654  	static char *
655  	allowed_bands_to_string (guint32 bands)
656  	{
657  		GString *band_str;
658  	
659  		if (bands == NM_SETTING_GSM_BAND_UNKNOWN)
660  			return g_strdup (_("0 (unknown)"));
661  	
662  		band_str = g_string_new (NULL);
663  		g_string_printf (band_str, "%d (", bands);
664  	
665  		if (bands & NM_SETTING_GSM_BAND_ANY)
666  			g_string_append (band_str, _("any, "));
667  		if (bands & NM_SETTING_GSM_BAND_EGSM)
668  			g_string_append (band_str, _("900 MHz, "));
669  		if (bands & NM_SETTING_GSM_BAND_DCS)
670  			g_string_append (band_str, _("1800 MHz, "));
671  		if (bands & NM_SETTING_GSM_BAND_PCS)
672  			g_string_append (band_str, _("1900 MHz, "));
673  		if (bands & NM_SETTING_GSM_BAND_G850)
674  			g_string_append (band_str, _("850 MHz, "));
675  		if (bands & NM_SETTING_GSM_BAND_U2100)
676  			g_string_append (band_str, _("WCDMA 3GPP UMTS 2100 MHz, "));
677  		if (bands & NM_SETTING_GSM_BAND_U1800)
678  			g_string_append (band_str, _("WCDMA 3GPP UMTS 1800 MHz, "));
679  		if (bands & NM_SETTING_GSM_BAND_U17IV)
680  			g_string_append (band_str, _("WCDMA 3GPP UMTS 1700/2100 MHz, "));
681  		if (bands & NM_SETTING_GSM_BAND_U800)
682  			g_string_append (band_str, _("WCDMA 3GPP UMTS 800 MHz, "));
683  		if (bands & NM_SETTING_GSM_BAND_U850)
684  			g_string_append (band_str, _("WCDMA 3GPP UMTS 850 MHz, "));
685  		if (bands & NM_SETTING_GSM_BAND_U900)
686  			g_string_append (band_str, _("WCDMA 3GPP UMTS 900 MHz, "));
687  		if (bands & NM_SETTING_GSM_BAND_U17IX)
688  			g_string_append (band_str, _("WCDMA 3GPP UMTS 1700 MHz, "));
689  		if (bands & NM_SETTING_GSM_BAND_U1900)
690  			g_string_append (band_str, _("WCDMA 3GPP UMTS 1900 MHz, "));
691  		if (bands & NM_SETTING_GSM_BAND_U2600)
692  			g_string_append (band_str, _("WCDMA 3GPP UMTS 2600 MHz, "));
693  	
694  		if (band_str->str[band_str->len-1] == '(')
695  			g_string_append (band_str, _("unknown"));
696  		else
697  			g_string_truncate (band_str, band_str->len-2);  /* chop off trailing ', ' */
698  	
699  		g_string_append_c (band_str, ')');
700  	
701  		return g_string_free (band_str, FALSE);
702  	}
703  	
704  	static char *
705  	vlan_flags_to_string (guint32 flags)
706  	{
707  		GString *flag_str;
708  	
709  		if (flags == 0)
710  			return g_strdup (_("0 (NONE)"));
711  	
712  		flag_str = g_string_new (NULL);
713  		g_string_printf (flag_str, "%d (", flags);
714  	
715  		if (flags & NM_VLAN_FLAG_REORDER_HEADERS)
716  			g_string_append (flag_str, _("REORDER_HEADERS, "));
717  		if (flags & NM_VLAN_FLAG_GVRP)
718  			g_string_append (flag_str, _("GVRP, "));
719  		if (flags & NM_VLAN_FLAG_LOOSE_BINDING)
720  			g_string_append (flag_str, _("LOOSE_BINDING, "));
721  	
722  		if (flag_str->str[flag_str->len-1] == '(')
723  			g_string_append (flag_str, _("unknown"));
724  		else
725  			g_string_truncate (flag_str, flag_str->len-2);  /* chop off trailing ', ' */
726  	
727  		g_string_append_c (flag_str, ')');
728  	
729  		return g_string_free (flag_str, FALSE);
730  	}
731  	
732  	static char *
733  	vlan_priorities_to_string (NMSettingVlan *s_vlan, NMVlanPriorityMap map)
734  	{
735  		GString *priorities;
736  		int i;
737  	
738  		priorities = g_string_new (NULL);
739  		for (i = 0; i < nm_setting_vlan_get_num_priorities (s_vlan, map); i++) {
740  			guint32 from, to;
741  	
742  			if (nm_setting_vlan_get_priority (s_vlan, map, i, &from, &to))
743  				g_string_append_printf (priorities, "%d:%d,", from, to);
744  		}
745  		if (priorities->len)
746  			g_string_truncate (priorities, priorities->len-1);  /* chop off trailing ',' */
747  	
748  		return g_string_free (priorities, FALSE);
749  	}
750  	
751  	static char *
752  	ip6_privacy_to_string (NMSettingIP6ConfigPrivacy ip6_privacy)
753  	{
754  		switch (ip6_privacy) {
755  		case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED:
756  			return g_strdup_printf (_("%d (disabled)"), ip6_privacy);
757  		case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR:
758  			return g_strdup_printf (_("%d (enabled, prefer public IP)"), ip6_privacy);
759  		case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR:
760  			return g_strdup_printf (_("%d (enabled, prefer temporary IP)"), ip6_privacy);
761  		default:
762  			return g_strdup_printf (_("%d (unknown)"), ip6_privacy);
763  		}
764  	}
765  	
766  	static char *
767  	secret_flags_to_string (guint32 flags)
768  	{
769  		GString *flag_str;
770  	
771  		if (flags == 0)
772  			return g_strdup (_("0 (none)"));
773  	
774  		flag_str = g_string_new (NULL);
775  		g_string_printf (flag_str, "%d (", flags);
776  	
777  		if (flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED)
778  			g_string_append (flag_str, _("agent-owned, "));
779  		if (flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)
780  			g_string_append (flag_str, _("not saved, "));
781  		if (flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
782  			g_string_append (flag_str, _("not required, "));
783  	
784  		if (flag_str->str[flag_str->len-1] == '(')
785  			g_string_append (flag_str, _("unknown"));
786  		else
787  			g_string_truncate (flag_str, flag_str->len-2);  /* chop off trailing ', ' */
788  	
789  		g_string_append_c (flag_str, ')');
790  	
791  		return g_string_free (flag_str, FALSE);
792  	}
793  	
794  	static void
795  	vpn_data_item (const char *key, const char *value, gpointer user_data)
796  	{
797  		GString *ret_str = (GString *) user_data;
798  	
799  		if (ret_str->len != 0)
800  			g_string_append (ret_str, ", ");
801  	
802  		g_string_append_printf (ret_str, "%s = %s", key, value);
803  	}
804  	
805  	
806  	/* === property get functions === */
807  	#define DEFINE_GETTER(func_name, property_name) \
808  		static char * \
809  		func_name (NMSetting *setting) \
810  		{ \
811  			GValue val = G_VALUE_INIT; \
812  			g_value_init (&val, G_TYPE_STRING); \
813  			g_object_get_property (G_OBJECT (setting), property_name, &val); \
814  			/* Getters return allocated values, and returning the string \
815  			 * the GValue copied from the object without unsetting the \
816  			 * GValue fulfills that requirement. */ \
817  			return (char *) g_value_get_string (&val); \
818  		}
819  	
820  	#define DEFINE_SECRET_FLAGS_GETTER(func_name, property_name) \
821  		static char * \
822  		func_name (NMSetting *setting) \
823  		{ \
824  			GValue val = G_VALUE_INIT; \
825  			g_value_init (&val, G_TYPE_UINT); \
826  			g_object_get_property (G_OBJECT (setting), property_name, &val); \
827  			return secret_flags_to_string (g_value_get_uint (&val)); \
828  		}
829  	
830  	#define DEFINE_HWADDR_GETTER(func_name, property_name) \
831  		static char * \
832  		func_name (NMSetting *setting) \
833  		{ \
834  			GValue val = G_VALUE_INIT; \
835  			GArray *array; \
836  			char *hwaddr = NULL; \
837  			g_value_init (&val, DBUS_TYPE_G_UCHAR_ARRAY); \
838  			g_object_get_property (G_OBJECT (setting), property_name, &val); \
839  			array = g_value_get_boxed (&val); \
840  			if (array) \
841  				hwaddr = nm_utils_hwaddr_ntoa (array->data, nm_utils_hwaddr_type (array->len)); \
842  			g_value_unset (&val); \
843  			return hwaddr; \
844  		}
845  	
846  	/* --- NM_SETTING_802_1X_SETTING_NAME property get functions --- */
847  	DEFINE_GETTER (nmc_property_802_1X_get_eap, NM_SETTING_802_1X_EAP)
848  	DEFINE_GETTER (nmc_property_802_1X_get_identity, NM_SETTING_802_1X_IDENTITY)
849  	DEFINE_GETTER (nmc_property_802_1X_get_anonymous_identity, NM_SETTING_802_1X_ANONYMOUS_IDENTITY)
850  	DEFINE_GETTER (nmc_property_802_1X_get_pac_file, NM_SETTING_802_1X_PAC_FILE)
851  	DEFINE_GETTER (nmc_property_802_1X_get_ca_path, NM_SETTING_802_1X_CA_PATH)
852  	DEFINE_GETTER (nmc_property_802_1X_get_subject_match, NM_SETTING_802_1X_SUBJECT_MATCH)
853  	DEFINE_GETTER (nmc_property_802_1X_get_altsubject_matches, NM_SETTING_802_1X_ALTSUBJECT_MATCHES)
854  	DEFINE_GETTER (nmc_property_802_1X_get_phase1_peapver, NM_SETTING_802_1X_PHASE1_PEAPVER)
855  	DEFINE_GETTER (nmc_property_802_1X_get_phase1_peaplabel, NM_SETTING_802_1X_PHASE1_PEAPLABEL)
856  	DEFINE_GETTER (nmc_property_802_1X_get_phase1_fast_provisioning, NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING)
857  	DEFINE_GETTER (nmc_property_802_1X_get_phase2_auth, NM_SETTING_802_1X_PHASE2_AUTH)
858  	DEFINE_GETTER (nmc_property_802_1X_get_phase2_autheap, NM_SETTING_802_1X_PHASE2_AUTHEAP)
859  	DEFINE_GETTER (nmc_property_802_1X_get_phase2_ca_path, NM_SETTING_802_1X_PHASE2_CA_PATH)
860  	DEFINE_GETTER (nmc_property_802_1X_get_phase2_subject_match, NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH)
861  	DEFINE_GETTER (nmc_property_802_1X_get_phase2_altsubject_matches, NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES)
862  	DEFINE_GETTER (nmc_property_802_1X_get_password, NM_SETTING_802_1X_PASSWORD)
863  	DEFINE_SECRET_FLAGS_GETTER (nmc_property_802_1X_get_password_flags, NM_SETTING_802_1X_PASSWORD_FLAGS)
864  	DEFINE_SECRET_FLAGS_GETTER (nmc_property_802_1X_get_password_raw_flags, NM_SETTING_802_1X_PASSWORD_RAW_FLAGS)
865  	DEFINE_GETTER (nmc_property_802_1X_get_private_key_password, NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD)
866  	DEFINE_SECRET_FLAGS_GETTER (nmc_property_802_1X_get_private_key_password_flags, NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS)
867  	DEFINE_GETTER (nmc_property_802_1X_get_phase2_private_key_password, NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD)
868  	DEFINE_SECRET_FLAGS_GETTER (nmc_property_802_1X_get_phase2_private_key_password_flags, NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS)
869  	DEFINE_GETTER (nmc_property_802_1X_get_pin, NM_SETTING_802_1X_PIN)
870  	DEFINE_SECRET_FLAGS_GETTER (nmc_property_802_1X_get_pin_flags, NM_SETTING_802_1X_PIN_FLAGS)
871  	DEFINE_GETTER (nmc_property_802_1X_get_system_ca_certs, NM_SETTING_802_1X_SYSTEM_CA_CERTS)
872  	
873  	static char *
874  	nmc_property_802_1X_get_ca_cert (NMSetting *setting)
875  	{
876  		NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
877  		NMSetting8021xCKScheme scheme;
878  		char *ca_cert_str = NULL;
879  	
880  		scheme = nm_setting_802_1x_get_ca_cert_scheme (s_8021X);
881  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB)
882  			ca_cert_str = byte_array_to_string (nm_setting_802_1x_get_ca_cert_blob (s_8021X));
883  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH)
884  			ca_cert_str = g_strdup (nm_setting_802_1x_get_ca_cert_path (s_8021X));
885  	
886  		return ca_cert_str;
887  	}
888  	
889  	static char *
890  	nmc_property_802_1X_get_client_cert (NMSetting *setting)
891  	{
892  		NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
893  		NMSetting8021xCKScheme scheme;
894  		char *client_cert_str = NULL;
895  	
896  		scheme = nm_setting_802_1x_get_client_cert_scheme (s_8021X);
897  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB)
898  			client_cert_str = byte_array_to_string (nm_setting_802_1x_get_client_cert_blob (s_8021X));
899  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH)
900  			client_cert_str = g_strdup (nm_setting_802_1x_get_client_cert_path (s_8021X));
901  	
902  		return client_cert_str;
903  	}
904  	
905  	static char *
906  	nmc_property_802_1X_get_phase2_ca_cert (NMSetting *setting)
907  	{
908  		NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
909  		NMSetting8021xCKScheme scheme;
910  		char *phase2_ca_cert_str = NULL;
911  	
912  		scheme = nm_setting_802_1x_get_phase2_ca_cert_scheme (s_8021X);
913  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB)
914  			phase2_ca_cert_str = byte_array_to_string (nm_setting_802_1x_get_phase2_ca_cert_blob (s_8021X));
915  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH)
916  			phase2_ca_cert_str = g_strdup (nm_setting_802_1x_get_phase2_ca_cert_path (s_8021X));
917  	
918  		return phase2_ca_cert_str;
919  	}
920  	
921  	static char *
922  	nmc_property_802_1X_get_phase2_client_cert (NMSetting *setting)
923  	{
924  		NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
925  		NMSetting8021xCKScheme scheme;
926  		char *phase2_client_cert_str = NULL;
927  	
928  		scheme = nm_setting_802_1x_get_phase2_client_cert_scheme (s_8021X);
929  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB)
930  			phase2_client_cert_str = byte_array_to_string (nm_setting_802_1x_get_phase2_client_cert_blob (s_8021X));
931  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH)
932  			phase2_client_cert_str = g_strdup (nm_setting_802_1x_get_phase2_client_cert_path (s_8021X));
933  	
934  		return phase2_client_cert_str;
935  	}
936  	
937  	static char *
938  	nmc_property_802_1X_get_password_raw (NMSetting *setting)
939  	{
940  		NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
941  		return byte_array_to_string (nm_setting_802_1x_get_password_raw (s_8021X));
942  	}
943  	
944  	static char *
945  	nmc_property_802_1X_get_private_key (NMSetting *setting)
946  	{
947  		NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
948  		NMSetting8021xCKScheme scheme;
949  		char *private_key_str = NULL;
950  	
951  		scheme = nm_setting_802_1x_get_private_key_scheme (s_8021X);
952  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB)
953  			private_key_str = byte_array_to_string (nm_setting_802_1x_get_private_key_blob (s_8021X));
954  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH)
955  			private_key_str = g_strdup (nm_setting_802_1x_get_private_key_path (s_8021X));
956  	
957  		return private_key_str;
958  	}
959  	
960  	static char *
961  	nmc_property_802_1X_get_phase2_private_key (NMSetting *setting)
962  	{
963  		NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
964  		NMSetting8021xCKScheme scheme;
965  		char *phase2_private_key_str = NULL;
966  	
967  		scheme = nm_setting_802_1x_get_phase2_private_key_scheme (s_8021X);
968  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB)
969  			phase2_private_key_str = byte_array_to_string (nm_setting_802_1x_get_phase2_private_key_blob (s_8021X));
970  		if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH)
971  			phase2_private_key_str = g_strdup (nm_setting_802_1x_get_phase2_private_key_path (s_8021X));
972  	
973  		return phase2_private_key_str;
974  	}
975  	
976  	/* --- NM_SETTING_ADSL_SETTING_NAME property get functions --- */
977  	DEFINE_GETTER (nmc_property_adsl_get_username, NM_SETTING_ADSL_USERNAME)
978  	DEFINE_GETTER (nmc_property_adsl_get_password, NM_SETTING_ADSL_PASSWORD)
979  	DEFINE_SECRET_FLAGS_GETTER (nmc_property_adsl_get_password_flags, NM_SETTING_ADSL_PASSWORD_FLAGS)
980  	DEFINE_GETTER (nmc_property_adsl_get_protocol, NM_SETTING_ADSL_PROTOCOL)
981  	DEFINE_GETTER (nmc_property_adsl_get_encapsulation, NM_SETTING_ADSL_ENCAPSULATION)
982  	DEFINE_GETTER (nmc_property_adsl_get_vpi, NM_SETTING_ADSL_VPI)
983  	DEFINE_GETTER (nmc_property_adsl_get_vci, NM_SETTING_ADSL_VCI)
984  	
985  	/* --- NM_SETTING_BLUETOOTH_SETTING_NAME property get functions --- */
986  	DEFINE_HWADDR_GETTER (nmc_property_bluetooth_get_bdaddr, NM_SETTING_BLUETOOTH_BDADDR)
987  	DEFINE_GETTER (nmc_property_bluetooth_get_type, NM_SETTING_BLUETOOTH_TYPE)
988  	
989  	/* --- NM_SETTING_BOND_SETTING_NAME property get functions --- */
990  	DEFINE_GETTER (nmc_property_bond_get_interface_name, NM_SETTING_BOND_INTERFACE_NAME)
991  	
992  	static char *
993  	nmc_property_bond_get_options (NMSetting *setting)
994  	{
995  		NMSettingBond *s_bond = NM_SETTING_BOND (setting);
996  		GString *bond_options_s;
997  		int i;
998  	
999  		bond_options_s = g_string_new (NULL);
1000 		for (i = 0; i < nm_setting_bond_get_num_options (s_bond); i++) {
1001 			const char *key, *value;
1002 	
1003 			nm_setting_bond_get_option (s_bond, i, &key, &value);
1004 			g_string_append_printf (bond_options_s, "%s=%s,", key, value);
1005 		}
1006 		g_string_truncate (bond_options_s, bond_options_s->len-1);  /* chop off trailing ',' */
1007 	
1008 		return g_string_free (bond_options_s, FALSE);
1009 	}
1010 	
1011 	/* --- NM_SETTING_BRIDGE_SETTING_NAME property get functions --- */
1012 	DEFINE_GETTER (nmc_property_bridge_get_interface_name, NM_SETTING_BRIDGE_INTERFACE_NAME)
1013 	DEFINE_GETTER (nmc_property_bridge_get_stp, NM_SETTING_BRIDGE_STP)
1014 	DEFINE_GETTER (nmc_property_bridge_get_priority, NM_SETTING_BRIDGE_PRIORITY)
1015 	DEFINE_GETTER (nmc_property_bridge_get_forward_delay, NM_SETTING_BRIDGE_FORWARD_DELAY)
1016 	DEFINE_GETTER (nmc_property_bridge_get_hello_time, NM_SETTING_BRIDGE_HELLO_TIME)
1017 	DEFINE_GETTER (nmc_property_bridge_get_max_age, NM_SETTING_BRIDGE_MAX_AGE)
1018 	DEFINE_GETTER (nmc_property_bridge_get_ageing_time, NM_SETTING_BRIDGE_AGEING_TIME)
1019 	
1020 	/* --- NM_SETTING_BRIDGE_PORT_SETTING_NAME property get functions --- */
1021 	DEFINE_GETTER (nmc_property_bridge_port_get_priority, NM_SETTING_BRIDGE_PORT_PRIORITY)
1022 	DEFINE_GETTER (nmc_property_bridge_port_get_path_cost, NM_SETTING_BRIDGE_PORT_PATH_COST)
1023 	DEFINE_GETTER (nmc_property_bridge_port_get_hairpin_mode, NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE)
1024 	
1025 	/* --- NM_SETTING_TEAM_SETTING_NAME property get functions --- */
1026 	DEFINE_GETTER (nmc_property_team_get_interface_name, NM_SETTING_TEAM_INTERFACE_NAME)
1027 	DEFINE_GETTER (nmc_property_team_get_config, NM_SETTING_TEAM_CONFIG)
1028 	
1029 	/* --- NM_SETTING_TEAM_PORT_SETTING_NAME property get functions --- */
1030 	DEFINE_GETTER (nmc_property_team_port_get_config, NM_SETTING_TEAM_PORT_CONFIG)
1031 	
1032 	/* --- NM_SETTING_CDMA_SETTING_NAME property get functions --- */
1033 	DEFINE_GETTER (nmc_property_cdma_get_number, NM_SETTING_CDMA_NUMBER)
1034 	DEFINE_GETTER (nmc_property_cdma_get_username, NM_SETTING_CDMA_USERNAME)
1035 	DEFINE_GETTER (nmc_property_cdma_get_password, NM_SETTING_CDMA_PASSWORD)
1036 	
1037 	DEFINE_SECRET_FLAGS_GETTER (nmc_property_cdma_get_password_flags, NM_SETTING_CDMA_PASSWORD_FLAGS)
1038 	
1039 	/* --- NM_SETTING_CONNECTION_SETTING_NAME property get functions --- */
1040 	DEFINE_GETTER (nmc_property_connection_get_id, NM_SETTING_CONNECTION_ID)
1041 	DEFINE_GETTER (nmc_property_connection_get_uuid, NM_SETTING_CONNECTION_UUID)
1042 	DEFINE_GETTER (nmc_property_connection_get_interface_name, NM_SETTING_CONNECTION_INTERFACE_NAME)
1043 	DEFINE_GETTER (nmc_property_connection_get_type, NM_SETTING_CONNECTION_TYPE)
1044 	DEFINE_GETTER (nmc_property_connection_get_autoconnect, NM_SETTING_CONNECTION_AUTOCONNECT)
1045 	DEFINE_GETTER (nmc_property_connection_get_timestamp, NM_SETTING_CONNECTION_TIMESTAMP)
1046 	DEFINE_GETTER (nmc_property_connection_get_read_only, NM_SETTING_CONNECTION_READ_ONLY)
1047 	
1048 	static char *
1049 	nmc_property_connection_get_permissions (NMSetting *setting)
1050 	{
1051 		NMSettingConnection *s_con = NM_SETTING_CONNECTION (setting);
1052 		GString *perm = NULL;
1053 		const char *perm_item;
1054 		const char *perm_type;
1055 		int i;
1056 	
1057 		perm = g_string_new (NULL);
(1) Event cond_true: Condition "i < nm_setting_connection_get_num_permissions(s_con)", taking true branch
1058 		for (i = 0; i < nm_setting_connection_get_num_permissions (s_con); i++) {
(2) Event check_return: Calling function "nm_setting_connection_get_permission(NMSettingConnection *, guint32, char const **, char const **, char const **)" without checking return value (as is done elsewhere 7 out of 8 times).
(11) Event unchecked_value: No check of the return value of "nm_setting_connection_get_permission(s_con, i, &perm_type, &perm_item, NULL)".
Also see events: [example_assign][example_checked][example_checked][example_assign][example_checked][example_assign][example_checked][example_checked]
1059 			nm_setting_connection_get_permission (s_con, i, &perm_type, &perm_item, NULL);
1060 			g_string_append_printf (perm, "%s:%s,", perm_type, perm_item);
1061 		}
1062 		if (perm->len > 0)
1063 			g_string_truncate (perm, perm->len-1); /* remove trailing , */
1064 	
1065 		return g_string_free (perm, FALSE);
1066 	}
1067 	
1068 	DEFINE_GETTER (nmc_property_connection_get_zone, NM_SETTING_CONNECTION_ZONE)
1069 	DEFINE_GETTER (nmc_property_connection_get_master, NM_SETTING_CONNECTION_MASTER)
1070 	DEFINE_GETTER (nmc_property_connection_get_slave_type, NM_SETTING_CONNECTION_SLAVE_TYPE)
1071 	DEFINE_GETTER (nmc_property_connection_get_secondaries, NM_SETTING_CONNECTION_SECONDARIES)
1072 	DEFINE_GETTER (nmc_property_connection_get_gateway_ping_timeout, NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT)
1073 	
1074 	/* --- NM_SETTING_GSM_SETTING_NAME property get functions --- */
1075 	DEFINE_GETTER (nmc_property_gsm_get_number, NM_SETTING_GSM_NUMBER)
1076 	DEFINE_GETTER (nmc_property_gsm_get_username, NM_SETTING_GSM_USERNAME)
1077 	DEFINE_GETTER (nmc_property_gsm_get_password, NM_SETTING_GSM_PASSWORD)
1078 	DEFINE_SECRET_FLAGS_GETTER (nmc_property_gsm_get_password_flags, NM_SETTING_GSM_PASSWORD_FLAGS)
1079 	DEFINE_GETTER (nmc_property_gsm_get_apn, NM_SETTING_GSM_APN)
1080 	DEFINE_GETTER (nmc_property_gsm_get_network_id, NM_SETTING_GSM_NETWORK_ID)
1081 	DEFINE_GETTER (nmc_property_gsm_get_network_type, NM_SETTING_GSM_NETWORK_TYPE)
1082 	
1083 	static char *
1084 	nmc_property_gsm_get_allowed_bands (NMSetting *setting)
1085 	{
1086 		NMSettingGsm *s_gsm = NM_SETTING_GSM (setting);
1087 	G_GNUC_BEGIN_IGNORE_DEPRECATIONS
1088 		return allowed_bands_to_string (nm_setting_gsm_get_allowed_bands (s_gsm));
1089 	G_GNUC_END_IGNORE_DEPRECATIONS
1090 	}
1091 	
1092 	DEFINE_GETTER (nmc_property_gsm_get_pin, NM_SETTING_GSM_PIN)
1093 	DEFINE_SECRET_FLAGS_GETTER (nmc_property_gsm_get_pin_flags, NM_SETTING_GSM_PIN_FLAGS)
1094 	DEFINE_GETTER (nmc_property_gsm_get_home_only, NM_SETTING_GSM_HOME_ONLY)
1095 	
1096 	/* --- NM_SETTING_INFINIBAND_SETTING_NAME property get functions --- */
1097 	DEFINE_HWADDR_GETTER (nmc_property_ib_get_mac_address, NM_SETTING_INFINIBAND_MAC_ADDRESS)
1098 	DEFINE_GETTER (nmc_property_ib_get_transport_mode, NM_SETTING_INFINIBAND_TRANSPORT_MODE)
1099 	
1100 	static char *
1101 	nmc_property_ib_get_mtu (NMSetting *setting)
1102 	{
1103 		NMSettingInfiniband *s_infiniband = NM_SETTING_INFINIBAND (setting);
1104 		int mtu;
1105 	
1106 		mtu = nm_setting_infiniband_get_mtu (s_infiniband);
1107 		if (mtu == 0)
1108 			return g_strdup (_("auto"));
1109 		else
1110 			return g_strdup_printf ("%d", mtu);
1111 	}
1112 	
1113 	static char *
1114 	nmc_property_ib_get_p_key (NMSetting *setting)
1115 	{
1116 		NMSettingInfiniband *s_infiniband = NM_SETTING_INFINIBAND (setting);
1117 		int p_key;
1118 	
1119 		p_key = nm_setting_infiniband_get_p_key (s_infiniband);
1120 		if (p_key == -1)
1121 			return g_strdup (_("default"));
1122 		else
1123 			return g_strdup_printf ("0x%04x", p_key);
1124 	}
1125 	
1126 	DEFINE_GETTER (nmc_property_ib_get_parent, NM_SETTING_INFINIBAND_PARENT)
1127 	
1128 	/* --- NM_SETTING_IP4_CONFIG_SETTING_NAME property get functions --- */
1129 	DEFINE_GETTER (nmc_property_ipv4_get_method, NM_SETTING_IP4_CONFIG_METHOD)
1130 	DEFINE_GETTER (nmc_property_ipv4_get_dns, NM_SETTING_IP4_CONFIG_DNS)
1131 	DEFINE_GETTER (nmc_property_ipv4_get_dns_search, NM_SETTING_IP4_CONFIG_DNS_SEARCH)
1132 	DEFINE_GETTER (nmc_property_ipv4_get_addresses, NM_SETTING_IP4_CONFIG_ADDRESSES)
1133 	DEFINE_GETTER (nmc_property_ipv4_get_routes, NM_SETTING_IP4_CONFIG_ROUTES)
1134 	DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_routes, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES)
1135 	DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_dns, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS)
1136 	DEFINE_GETTER (nmc_property_ipv4_get_dhcp_client_id, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID)
1137 	DEFINE_GETTER (nmc_property_ipv4_get_dhcp_send_hostname, NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME)
1138 	DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME)
1139 	DEFINE_GETTER (nmc_property_ipv4_get_never_default, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT)
1140 	DEFINE_GETTER (nmc_property_ipv4_get_may_fail, NM_SETTING_IP4_CONFIG_MAY_FAIL)
1141 	
1142 	/* --- NM_SETTING_IP6_CONFIG_SETTING_NAME property get functions --- */
1143 	DEFINE_GETTER (nmc_property_ipv6_get_method, NM_SETTING_IP6_CONFIG_METHOD)
1144 	DEFINE_GETTER (nmc_property_ipv6_get_dns, NM_SETTING_IP6_CONFIG_DNS)
1145 	DEFINE_GETTER (nmc_property_ipv6_get_dns_search, NM_SETTING_IP6_CONFIG_DNS_SEARCH)
1146 	DEFINE_GETTER (nmc_property_ipv6_get_addresses, NM_SETTING_IP6_CONFIG_ADDRESSES)
1147 	DEFINE_GETTER (nmc_property_ipv6_get_routes, NM_SETTING_IP6_CONFIG_ROUTES)
1148 	DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_routes, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES)
1149 	DEFINE_GETTER (nmc_property_ipv6_get_ignore_auto_dns, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS)
1150 	DEFINE_GETTER (nmc_property_ipv6_get_never_default, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT)
1151 	DEFINE_GETTER (nmc_property_ipv6_get_may_fail, NM_SETTING_IP6_CONFIG_MAY_FAIL)
1152 	DEFINE_GETTER (nmc_property_ipv6_get_dhcp_hostname, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME)
1153 	
1154 	static char *
1155 	nmc_property_ipv6_get_ip6_privacy (NMSetting *setting)
1156 	{
1157 		NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
1158 		return ip6_privacy_to_string (nm_setting_ip6_config_get_ip6_privacy (s_ip6));
1159 	}
1160 	
1161 	/* --- NM_SETTING_OLPC_MESH_SETTING_NAME property get functions --- */
1162 	DEFINE_GETTER (nmc_property_olpc_get_channel, NM_SETTING_OLPC_MESH_CHANNEL)
1163 	DEFINE_HWADDR_GETTER (nmc_property_olpc_get_anycast_address, NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS)
1164 	
1165 	static char *
1166 	nmc_property_olpc_get_ssid (NMSetting *setting)
1167 	{
1168 		NMSettingOlpcMesh *s_olpc_mesh = NM_SETTING_OLPC_MESH (setting);
1169 		const GByteArray *ssid;
1170 		char *ssid_str = NULL;
1171 	
1172 		ssid = nm_setting_olpc_mesh_get_ssid (s_olpc_mesh);
1173 		if (ssid)
1174 			ssid_str = nm_utils_ssid_to_utf8 (ssid);
1175 	
1176 		return ssid_str;
1177 	}
1178 	
1179 	/* --- NM_SETTING_PPP_SETTING_NAME property get functions --- */
1180 	DEFINE_GETTER (nmc_property_ppp_get_noauth, NM_SETTING_PPP_NOAUTH)
1181 	DEFINE_GETTER (nmc_property_ppp_get_refuse_eap, NM_SETTING_PPP_REFUSE_EAP)
1182 	DEFINE_GETTER (nmc_property_ppp_get_refuse_pap, NM_SETTING_PPP_REFUSE_PAP)
1183 	DEFINE_GETTER (nmc_property_ppp_get_refuse_chap, NM_SETTING_PPP_REFUSE_CHAP)
1184 	DEFINE_GETTER (nmc_property_ppp_get_refuse_mschap, NM_SETTING_PPP_REFUSE_MSCHAP)
1185 	DEFINE_GETTER (nmc_property_ppp_get_refuse_mschapv2, NM_SETTING_PPP_REFUSE_MSCHAPV2)
1186 	DEFINE_GETTER (nmc_property_ppp_get_nobsdcomp, NM_SETTING_PPP_NOBSDCOMP)
1187 	DEFINE_GETTER (nmc_property_ppp_get_nodeflate, NM_SETTING_PPP_NODEFLATE)
1188 	DEFINE_GETTER (nmc_property_ppp_get_no_vj_comp, NM_SETTING_PPP_NO_VJ_COMP)
1189 	DEFINE_GETTER (nmc_property_ppp_get_require_mppe, NM_SETTING_PPP_REQUIRE_MPPE)
1190 	DEFINE_GETTER (nmc_property_ppp_get_require_mppe_128, NM_SETTING_PPP_REQUIRE_MPPE_128)
1191 	DEFINE_GETTER (nmc_property_ppp_get_mppe_stateful, NM_SETTING_PPP_MPPE_STATEFUL)
1192 	DEFINE_GETTER (nmc_property_ppp_get_crtscts, NM_SETTING_PPP_CRTSCTS)
1193 	DEFINE_GETTER (nmc_property_ppp_get_baud, NM_SETTING_PPP_BAUD)
1194 	DEFINE_GETTER (nmc_property_ppp_get_mru, NM_SETTING_PPP_MRU)
1195 	DEFINE_GETTER (nmc_property_ppp_get_mtu, NM_SETTING_PPP_MTU)
1196 	DEFINE_GETTER (nmc_property_ppp_get_lcp_echo_failure, NM_SETTING_PPP_LCP_ECHO_FAILURE)
1197 	DEFINE_GETTER (nmc_property_ppp_get_lcp_echo_interval, NM_SETTING_PPP_LCP_ECHO_INTERVAL)
1198 	
1199 	/* --- NM_SETTING_PPPOE_SETTING_NAME property get functions --- */
1200 	DEFINE_GETTER (nmc_property_pppoe_get_service, NM_SETTING_PPPOE_SERVICE)
1201 	DEFINE_GETTER (nmc_property_pppoe_get_username, NM_SETTING_PPPOE_USERNAME)
1202 	DEFINE_GETTER (nmc_property_pppoe_get_password, NM_SETTING_PPPOE_PASSWORD)
1203 	DEFINE_SECRET_FLAGS_GETTER (nmc_property_pppoe_get_password_flags, NM_SETTING_PPPOE_PASSWORD_FLAGS)
1204 	
1205 	/* --- NM_SETTING_SERIAL_SETTING_NAME property get functions --- */
1206 	DEFINE_GETTER (nmc_property_serial_get_baud, NM_SETTING_SERIAL_BAUD)
1207 	DEFINE_GETTER (nmc_property_serial_get_bits, NM_SETTING_SERIAL_BITS)
1208 	DEFINE_GETTER (nmc_property_serial_get_parity, NM_SETTING_SERIAL_PARITY)
1209 	DEFINE_GETTER (nmc_property_serial_get_stopbits, NM_SETTING_SERIAL_STOPBITS)
1210 	DEFINE_GETTER (nmc_property_serial_get_send_delay, NM_SETTING_SERIAL_SEND_DELAY)
1211 	
1212 	/* --- NM_SETTING_VLAN_SETTING_NAME property get functions --- */
1213 	DEFINE_GETTER (nmc_property_vlan_get_interface_name, NM_SETTING_VLAN_INTERFACE_NAME)
1214 	DEFINE_GETTER (nmc_property_vlan_get_parent, NM_SETTING_VLAN_PARENT)
1215 	DEFINE_GETTER (nmc_property_vlan_get_id, NM_SETTING_VLAN_ID)
1216 	
1217 	
1218 	static char *
1219 	nmc_property_vlan_get_flags (NMSetting *setting)
1220 	{
1221 		NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
1222 		return vlan_flags_to_string (nm_setting_vlan_get_flags (s_vlan));
1223 	}
1224 	
1225 	static char *
1226 	nmc_property_vlan_get_ingress_priority_map (NMSetting *setting)
1227 	{
1228 		NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
1229 		return vlan_priorities_to_string (s_vlan, NM_VLAN_INGRESS_MAP);
1230 	}
1231 	
1232 	static char *
1233 	nmc_property_vlan_get_egress_priority_map (NMSetting *setting)
1234 	{
1235 		NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
1236 		return vlan_priorities_to_string (s_vlan, NM_VLAN_EGRESS_MAP);
1237 	}
1238 	
1239 	/* --- NM_SETTING_VPN_SETTING_NAME property get functions --- */
1240 	DEFINE_GETTER (nmc_property_vpn_get_service_type, NM_SETTING_VPN_SERVICE_TYPE)
1241 	DEFINE_GETTER (nmc_property_vpn_get_user_name, NM_SETTING_VPN_USER_NAME)
1242 	
1243 	static char *
1244 	nmc_property_vpn_get_data (NMSetting *setting)
1245 	{
1246 		NMSettingVPN *s_vpn = NM_SETTING_VPN (setting);
1247 		GString *data_item_str;
1248 	
1249 		data_item_str = g_string_new (NULL);
1250 		nm_setting_vpn_foreach_data_item (s_vpn, &vpn_data_item, data_item_str);
1251 	
1252 		return g_string_free (data_item_str, FALSE);
1253 	}
1254 	
1255 	static char *
1256 	nmc_property_vpn_get_secrets (NMSetting *setting)
1257 	{
1258 		NMSettingVPN *s_vpn = NM_SETTING_VPN (setting);
1259 		GString *secret_str;
1260 	
1261 		secret_str = g_string_new (NULL);
1262 		nm_setting_vpn_foreach_secret (s_vpn, &vpn_data_item, secret_str);
1263 	
1264 		return g_string_free (secret_str, FALSE);
1265 	}
1266 	
1267 	/* --- NM_SETTING_WIMAX_SETTING_NAME property get functions --- */
1268 	DEFINE_GETTER (nmc_property_wimax_get_network_name, NM_SETTING_WIMAX_NETWORK_NAME)
1269 	DEFINE_HWADDR_GETTER (nmc_property_wimax_get_mac_address, NM_SETTING_WIMAX_MAC_ADDRESS)
1270 	
1271 	/* --- NM_SETTING_WIRED_SETTING_NAME property get functions --- */
1272 	DEFINE_GETTER (nmc_property_wired_get_port, NM_SETTING_WIRED_PORT)
1273 	DEFINE_GETTER (nmc_property_wired_get_speed, NM_SETTING_WIRED_SPEED)
1274 	DEFINE_GETTER (nmc_property_wired_get_duplex, NM_SETTING_WIRED_DUPLEX)
1275 	DEFINE_GETTER (nmc_property_wired_get_auto_negotiate, NM_SETTING_WIRED_AUTO_NEGOTIATE)
1276 	DEFINE_HWADDR_GETTER (nmc_property_wired_get_mac_address, NM_SETTING_WIRED_MAC_ADDRESS)
1277 	DEFINE_HWADDR_GETTER (nmc_property_wired_get_cloned_mac_address, NM_SETTING_WIRED_CLONED_MAC_ADDRESS)
1278 	DEFINE_GETTER (nmc_property_wired_get_mac_address_blacklist, NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST)
1279 	DEFINE_GETTER (nmc_property_wired_get_s390_subchannels, NM_SETTING_WIRED_S390_SUBCHANNELS)
1280 	DEFINE_GETTER (nmc_property_wired_get_s390_nettype, NM_SETTING_WIRED_S390_NETTYPE)
1281 	DEFINE_GETTER (nmc_property_wired_get_s390_options, NM_SETTING_WIRED_S390_OPTIONS)
1282 	
1283 	static char *
1284 	nmc_property_wired_get_mtu (NMSetting *setting)
1285 	{
1286 		NMSettingWired *s_wired = NM_SETTING_WIRED (setting);
1287 		int mtu;
1288 	
1289 		mtu = nm_setting_wired_get_mtu (s_wired);
1290 		if (mtu == 0)
1291 			return g_strdup (_("auto"));
1292 		else
1293 			return g_strdup_printf ("%d", mtu);
1294 	}
1295 	
1296 	/* --- NM_SETTING_WIRELESS_SETTING_NAME property get functions --- */
1297 	DEFINE_GETTER (nmc_property_wireless_get_mode, NM_SETTING_WIRELESS_MODE)
1298 	DEFINE_GETTER (nmc_property_wireless_get_band, NM_SETTING_WIRELESS_BAND)
1299 	DEFINE_GETTER (nmc_property_wireless_get_channel, NM_SETTING_WIRELESS_CHANNEL)
1300 	DEFINE_HWADDR_GETTER (nmc_property_wireless_get_bssid, NM_SETTING_WIRELESS_BSSID)
1301 	DEFINE_GETTER (nmc_property_wireless_get_rate, NM_SETTING_WIRELESS_RATE)
1302 	DEFINE_GETTER (nmc_property_wireless_get_tx_power, NM_SETTING_WIRELESS_TX_POWER)
1303 	DEFINE_HWADDR_GETTER (nmc_property_wireless_get_mac_address, NM_SETTING_WIRELESS_MAC_ADDRESS)
1304 	DEFINE_HWADDR_GETTER (nmc_property_wireless_get_cloned_mac_address, NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS)
1305 	DEFINE_GETTER (nmc_property_wireless_get_mac_address_blacklist, NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST)
1306 	DEFINE_GETTER (nmc_property_wireless_get_seen_bssids, NM_SETTING_WIRELESS_SEEN_BSSIDS)
1307 	DEFINE_GETTER (nmc_property_wireless_get_hidden, NM_SETTING_WIRELESS_HIDDEN)
1308 	
1309 	static char *
1310 	nmc_property_wireless_get_ssid (NMSetting *setting)
1311 	{
1312 		NMSettingWireless *s_wireless = NM_SETTING_WIRELESS (setting);
1313 		const GByteArray *ssid;
1314 		char *ssid_str = NULL;
1315 	
1316 		ssid = nm_setting_wireless_get_ssid (s_wireless);
1317 		if (ssid)
1318 			ssid_str = nm_utils_ssid_to_utf8 (ssid);
1319 	
1320 		return ssid_str;
1321 	}
1322 	
1323 	static char *
1324 	nmc_property_wireless_get_mtu (NMSetting *setting)
1325 	{
1326 		NMSettingWireless *s_wireless = NM_SETTING_WIRELESS (setting);
1327 		int mtu;
1328 	
1329 		mtu = nm_setting_wireless_get_mtu (s_wireless);
1330 		if (mtu == 0)
1331 			return g_strdup (_("auto"));
1332 		else
1333 			return g_strdup_printf ("%d", mtu);
1334 	}
1335 	
1336 	/* --- NM_SETTING_WIRELESS_SECURITY_SETTING_NAME property get functions --- */
1337 	DEFINE_GETTER (nmc_property_wifi_sec_get_key_mgmt, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT)
1338 	DEFINE_GETTER (nmc_property_wifi_sec_get_wep_tx_keyidx, NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX)
1339 	DEFINE_GETTER (nmc_property_wifi_sec_get_auth_alg, NM_SETTING_WIRELESS_SECURITY_AUTH_ALG)
1340 	DEFINE_GETTER (nmc_property_wifi_sec_get_proto, NM_SETTING_WIRELESS_SECURITY_PROTO)
1341 	DEFINE_GETTER (nmc_property_wifi_sec_get_pairwise, NM_SETTING_WIRELESS_SECURITY_PAIRWISE)
1342 	DEFINE_GETTER (nmc_property_wifi_sec_get_group, NM_SETTING_WIRELESS_SECURITY_GROUP)
1343 	DEFINE_GETTER (nmc_property_wifi_sec_get_leap_username, NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME)
1344 	DEFINE_SECRET_FLAGS_GETTER (nmc_property_wifi_sec_get_wep_key_flags, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS)
1345 	DEFINE_GETTER (nmc_property_wifi_sec_get_psk, NM_SETTING_WIRELESS_SECURITY_PSK)
1346 	DEFINE_SECRET_FLAGS_GETTER (nmc_property_wifi_sec_get_psk_flags, NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS)
1347 	DEFINE_GETTER (nmc_property_wifi_sec_get_leap_password, NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD)
1348 	DEFINE_SECRET_FLAGS_GETTER (nmc_property_wifi_sec_get_leap_password_flags, NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS)
1349 	
1350 	static char *
1351 	nmc_property_wifi_sec_get_wep_key0 (NMSetting *setting)
1352 	{
1353 		NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting);
1354 		return g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, 0));
1355 	}
1356 	
1357 	static char *
1358 	nmc_property_wifi_sec_get_wep_key1 (NMSetting *setting)
1359 	{
1360 		NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting);
1361 		return g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, 1));
1362 	}
1363 	
1364 	static char *
1365 	nmc_property_wifi_sec_get_wep_key2 (NMSetting *setting)
1366 	{
1367 		NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting);
1368 		return g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, 2));
1369 	}
1370 	
1371 	static char *
1372 	nmc_property_wifi_sec_get_wep_key3 (NMSetting *setting)
1373 	{
1374 		NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting);
1375 		return g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, 3));
1376 	}
1377 	
1378 	static char *
1379 	nmc_property_wifi_sec_get_wep_key_type (NMSetting *setting)
1380 	{
1381 		NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting);
1382 		return wep_key_type_to_string (nm_setting_wireless_security_get_wep_key_type (s_wireless_sec));
1383 	}
1384 	
1385 	/*----------------------------------------------------------------------------*/
1386 	
1387 	static void
1388 	nmc_value_transform_bool_string (const GValue *src_value,
1389 	                                 GValue       *dest_value)
1390 	{
1391 		dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_int ? "yes" : "no");
1392 	}
1393 	
1394 	static void
1395 	nmc_value_transform_char_string (const GValue *src_value,
1396 	                                 GValue       *dest_value)
1397 	{
1398 		dest_value->data[0].v_pointer = g_strdup_printf ("%c", src_value->data[0].v_uint);
1399 	}
1400 	
1401 	static void __attribute__((constructor))
1402 	register_nmcli_value_transforms (void)
1403 	{
1404 		g_value_register_transform_func (G_TYPE_BOOLEAN, G_TYPE_STRING, nmc_value_transform_bool_string);
1405 		g_value_register_transform_func (G_TYPE_CHAR, G_TYPE_STRING, nmc_value_transform_char_string);
1406 	}
1407 	
1408 	/*----------------------------------------------------------------------------*/
1409 	
1410 	/* Main hash table storing function pointer for manipulating properties */
1411 	static GHashTable *nmc_properties = NULL;
1412 	typedef	char *       (*NmcPropertyGetFunc)      (NMSetting *);
1413 	typedef	gboolean     (*NmcPropertySetFunc)      (NMSetting *, const char *, const char *, GError **);
1414 	typedef	gboolean     (*NmcPropertyRemoveFunc)   (NMSetting *, const char *, const char *, guint32, GError **);
1415 	typedef	const char * (*NmcPropertyDescribeFunc) (NMSetting *, const char *);
1416 	typedef	const char * (*NmcPropertyValuesFunc)   (NMSetting *, const char *);
1417 	typedef	      char * (*NmcPropertyOut2InFunc)   (const char *);
1418 	
1419 	typedef struct {
1420 		NmcPropertyGetFunc get_func;           /* func getting property values */
1421 		NmcPropertySetFunc set_func;           /* func adding/setting property values */
1422 		NmcPropertyRemoveFunc remove_func;     /* func removing items from container options */
1423 		NmcPropertyDescribeFunc describe_func; /* func returning property description */
1424 		NmcPropertyValuesFunc values_func;     /* func returning allowed property values */
1425 		NmcPropertyOut2InFunc out2in_func;     /* func converting property values from output to input format */
1426 	} NmcPropertyFuncs;
1427 	
1428 	NMSetting *
1429 	nmc_setting_new_for_name (const char *name)
1430 	{
1431 		GType stype;
1432 		NMSetting *setting = NULL;
1433 	
1434 		if (name) {
1435 			stype = nm_connection_lookup_setting_type (name);
1436 			if (stype != G_TYPE_INVALID) {
1437 				setting = g_object_new (stype, NULL);
1438 				g_warn_if_fail (NM_IS_SETTING (setting));
1439 			}
1440 		}
1441 		return setting;
1442 	}
1443 	
1444 	static gboolean
1445 	get_answer (const char *prop, const char *value)
1446 	{
1447 		char *tmp_str;
1448 		char *question;
1449 		gboolean answer = FALSE;
1450 	
1451 		if (value)
1452 			question = g_strdup_printf (_("Do you also want to set '%s' to '%s'? [yes]: "), prop, value);
1453 		else
1454 			question = g_strdup_printf (_("Do you also want to clear '%s'? [yes]: "), prop);
1455 		tmp_str = nmc_get_user_input (question);
1456 		if (!tmp_str || matches (tmp_str, "yes") == 0)
1457 			answer = TRUE;
1458 		g_free (tmp_str);
1459 		g_free (question);
1460 		return answer;
1461 	}
1462 	
1463 	static void ipv4_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data);
1464 	static void ipv6_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data);
1465 	
1466 	static void
1467 	ipv4_addresses_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
1468 	{
1469 		static gboolean answered = FALSE;
1470 		static gboolean answer = FALSE;
1471 	
1472 		g_signal_handlers_block_by_func (object, G_CALLBACK (ipv4_method_changed_cb), NULL);
1473 	
1474 		/* If we have some IP addresses set method to 'manual'.
1475 		 * Else if the method was 'manual', change it back to 'auto'.
1476 		 */
1477 		if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) {
1478 			if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
1479 				if (!answered) {
1480 					answered = TRUE;
1481 					answer = get_answer ("ipv4.method", "manual");
1482 				}
1483 				if (answer)
1484 					g_object_set (object, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL);
1485 			}
1486 		} else {
1487 			answered = FALSE;
1488 			if (!g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
1489 				g_object_set (object, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
1490 		}
1491 	
1492 		g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv4_method_changed_cb), NULL);
1493 	}
1494 	
1495 	static void
1496 	ipv4_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
1497 	{
1498 		static GValue value = G_VALUE_INIT;
1499 		static gboolean answered = FALSE;
1500 		static gboolean answer = FALSE;
1501 	
1502 		g_signal_handlers_block_by_func (object, G_CALLBACK (ipv4_addresses_changed_cb), NULL);
1503 	
1504 		/* If method != manual, remove addresses (save them for restoring them later when method becomes 'manual' */
1505 		if (g_strcmp0 (nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (object)), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
1506 			if (nm_setting_ip4_config_get_num_addresses (NM_SETTING_IP4_CONFIG (object))) {
1507 				if (!answered) {
1508 					answered = TRUE;
1509 					answer = get_answer ("ipv4.addresses", NULL);
1510 				}
1511 				if (answer) {
1512 					if (G_IS_VALUE (&value))
1513 						g_value_unset (&value);
1514 					nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value);
1515 					g_object_set (object, NM_SETTING_IP4_CONFIG_ADDRESSES, NULL, NULL);
1516 				}
1517 			}
1518 		} else {
1519 			answered = FALSE;
1520 			if (G_IS_VALUE (&value)) {
1521 				nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP4_CONFIG_ADDRESSES, &value);
1522 				g_value_unset (&value);
1523 			}
1524 		}
1525 	
1526 		g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv4_addresses_changed_cb), NULL);
1527 	}
1528 	
1529 	static void
1530 	ipv6_addresses_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
1531 	{
1532 		static gboolean answered = FALSE;
1533 		static gboolean answer = FALSE;
1534 	
1535 		g_signal_handlers_block_by_func (object, G_CALLBACK (ipv6_method_changed_cb), NULL);
1536 	
1537 		/* If we have some IP addresses set method to 'manual'.
1538 		 * Else if the method was 'manual', change it back to 'auto'.
1539 		 */
1540 		if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) {
1541 			if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
1542 				if (!answered) {
1543 					answered = TRUE;
1544 					answer = get_answer ("ipv6.method", "manual");
1545 				}
1546 				if (answer)
1547 					g_object_set (object, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NULL);
1548 			}
1549 		} else {
1550 			answered = FALSE;
1551 			if (!g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
1552 				g_object_set (object, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL);
1553 		}
1554 	
1555 		g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv6_method_changed_cb), NULL);
1556 	}
1557 	
1558 	static void
1559 	ipv6_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
1560 	{
1561 		static GValue value = G_VALUE_INIT;
1562 		static gboolean answered = FALSE;
1563 		static gboolean answer = FALSE;
1564 	
1565 		g_signal_handlers_block_by_func (object, G_CALLBACK (ipv6_addresses_changed_cb), NULL);
1566 	
1567 		/* If method != manual, remove addresses (save them for restoring them later when method becomes 'manual' */
1568 		if (g_strcmp0 (nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (object)), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
1569 			if (nm_setting_ip6_config_get_num_addresses (NM_SETTING_IP6_CONFIG (object))) {
1570 				if (!answered) {
1571 					answered = TRUE;
1572 					answer = get_answer ("ipv6.addresses", NULL);
1573 				}
1574 				if (answer) {
1575 					if (G_IS_VALUE (&value))
1576 						g_value_unset (&value);
1577 					nmc_property_get_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value);
1578 					g_object_set (object, NM_SETTING_IP6_CONFIG_ADDRESSES, NULL, NULL);
1579 				}
1580 			}
1581 		} else {
1582 			answered = FALSE;
1583 			if (G_IS_VALUE (&value)) {
1584 				nmc_property_set_gvalue (NM_SETTING (object), NM_SETTING_IP6_CONFIG_ADDRESSES, &value);
1585 				g_value_unset (&value);
1586 			}
1587 		}
1588 	
1589 		g_signal_handlers_unblock_by_func (object, G_CALLBACK (ipv6_addresses_changed_cb), NULL);
1590 	}
1591 	
1592 	void
1593 	nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting)
1594 	{
1595 		g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
1596 	
1597 		g_signal_connect (setting, "notify::" NM_SETTING_IP4_CONFIG_ADDRESSES,
1598 		                  G_CALLBACK (ipv4_addresses_changed_cb), NULL);
1599 		g_signal_connect (setting, "notify::" NM_SETTING_IP4_CONFIG_METHOD,
1600 		                  G_CALLBACK (ipv4_method_changed_cb), NULL);
1601 	}
1602 	
1603 	void
1604 	nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting)
1605 	{
1606 		g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
1607 	
1608 		g_signal_connect (setting, "notify::" NM_SETTING_IP6_CONFIG_ADDRESSES,
1609 		                  G_CALLBACK (ipv6_addresses_changed_cb), NULL);
1610 		g_signal_connect (setting, "notify::" NM_SETTING_IP6_CONFIG_METHOD,
1611 		                  G_CALLBACK (ipv6_method_changed_cb), NULL);
1612 	}
1613 	
1614 	/*
1615 	 * Customize some properties of the setting so that the setting has sensible
1616 	 * values.
1617 	 */
1618 	void
1619 	nmc_setting_custom_init (NMSetting *setting)
1620 	{
1621 		g_return_if_fail (NM_IS_SETTING (setting));
1622 	
1623 		if (NM_IS_SETTING_IP4_CONFIG (setting)) {
1624 			g_object_set (NM_SETTING_IP4_CONFIG (setting),
1625 			              NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
1626 			              NULL);
1627 			nmc_setting_ip4_connect_handlers (NM_SETTING_IP4_CONFIG (setting));
1628 		} else if (NM_IS_SETTING_IP6_CONFIG (setting)) {
1629 			g_object_set (NM_SETTING_IP6_CONFIG (setting),
1630 			              NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
1631 			              NULL);
1632 			nmc_setting_ip6_connect_handlers (NM_SETTING_IP6_CONFIG (setting));
1633 		}
1634 	}
1635 	
1636 	/* === SetFunc, RemoveFunc, DescribeFunc, ValuesFunc functions === */
1637 	static gboolean
1638 	verify_string_list (char **strv,
1639 	                    const char *prop,
1640 	                    gboolean (*validate_func) (const char *),
1641 	                    GError **error)
1642 	{
1643 		char **iter;
1644 	
1645 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1646 	
1647 		for (iter = strv; iter && *iter; iter++) {
1648 			if (**iter == '\0')
1649 				continue;
1650 			if (validate_func) {
1651 				if (!validate_func (*iter)) {
1652 					g_set_error (error, 1, 0, _("'%s' is not valid"),
1653 					             *iter);
1654 					return FALSE;
1655 				}
1656 			}
1657 		}
1658 		return TRUE;
1659 	}
1660 	
1661 	/* Validate 'val' number against to int property spec */
1662 	static gboolean
1663 	validate_int (NMSetting *setting, const char* prop, gint val, GError **error)
1664 	{
1665 		GParamSpec *pspec;
1666 		GValue value = G_VALUE_INIT;
1667 		gboolean success = TRUE;
1668 	
1669 		g_value_init (&value, G_TYPE_INT);
1670 		g_value_set_int (&value, val);
1671 		pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop);
1672 		g_assert (G_IS_PARAM_SPEC (pspec));
1673 		if (g_param_value_validate (pspec, &value)) {
1674 			GParamSpecInt *pspec_int = (GParamSpecInt *) pspec;
1675 			g_set_error (error, 1, 0, _("'%d' is not valid; use <%d-%d>"),
1676 			             val, pspec_int->minimum, pspec_int->maximum);
1677 			success = FALSE;
1678 		}
1679 		g_value_unset (&value);
1680 		return success;
1681 	}
1682 	
1683 	/* Validate 'val' number against to uint property spec */
1684 	static gboolean
1685 	validate_uint (NMSetting *setting, const char* prop, guint val, GError **error)
1686 	{
1687 		GParamSpec *pspec;
1688 		GValue value = G_VALUE_INIT;
1689 		gboolean success = TRUE;
1690 	
1691 		g_value_init (&value, G_TYPE_UINT);
1692 		g_value_set_uint (&value, val);
1693 		pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop);
1694 		g_assert (G_IS_PARAM_SPEC (pspec));
1695 		if (g_param_value_validate (pspec, &value)) {
1696 			GParamSpecUInt *pspec_uint = (GParamSpecUInt *) pspec;
1697 			g_set_error (error, 1, 0, _("'%u' is not valid; use <%d-%d>"),
1698 			             val, pspec_uint->minimum, pspec_uint->maximum);
1699 			success = FALSE;
1700 		}
1701 		g_value_unset (&value);
1702 		return success;
1703 	}
1704 	
1705 	static gboolean
1706 	check_and_set_string (NMSetting *setting,
1707 	                      const char *prop,
1708 	                      const char *val,
1709 	                      const char **valid_strv,
1710 	                      GError **error)
1711 	{
1712 		const char *checked_val;
1713 	
1714 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1715 	
1716 		checked_val = nmc_string_is_valid (val, valid_strv, error);
1717 		if (!checked_val)
1718 			return FALSE;
1719 	
1720 		g_object_set (setting, prop, checked_val, NULL);
1721 		return TRUE;
1722 	}
1723 	
1724 	#define DEFINE_SETTER_STR_LIST_MULTI(def_func, s_macro, set_func) \
1725 		static gboolean \
1726 		def_func (NMSetting *setting, \
1727 		          const char *prop, \
1728 		          const char *val, \
1729 		          const char **valid_strv, \
1730 		          GError **error) \
1731 		{ \
1732 			char **strv = NULL, **iter; \
1733 			const char *item; \
1734 			g_return_val_if_fail (error == NULL || *error == NULL, FALSE); \
1735 			strv = nmc_strsplit_set (val, " \t,", 0); \
1736 			for (iter = strv; iter && *iter; iter++) { \
1737 				if (!(item = nmc_string_is_valid (g_strstrip (*iter), valid_strv, error))) { \
1738 					g_strfreev (strv); \
1739 					return FALSE; \
1740 				} \
1741 				set_func (s_macro (setting), item); \
1742 			} \
1743 			g_strfreev (strv); \
1744 			return TRUE; \
1745 		}
1746 	
1747 	#define DEFINE_SETTER_OPTIONS(def_func, s_macro, s_type, add_func, valid_func1, valid_func2) \
1748 		static gboolean \
1749 		def_func (NMSetting *setting, const char *prop, const char *val, GError **error) \
1750 		{ \
1751 			char **strv = NULL, **iter; \
1752 			const char **(*valid_func1_p) (s_type *) = valid_func1; \
1753 			const char * (*valid_func2_p) (const char *, const char *, GError **) = valid_func2; \
1754 			const char *opt_name, *opt_val; \
1755 			\
1756 			g_return_val_if_fail (error == NULL || *error == NULL, FALSE); \
1757 			\
1758 			strv = nmc_strsplit_set (val, ",", 0); \
1759 			for (iter = strv; iter && *iter; iter++) { \
1760 				char *left = g_strstrip (*iter); \
1761 				char *right = strchr (left, '='); \
1762 				if (!right) { \
1763 					g_set_error (error, 1, 0, _("'%s' is not valid; use <option>=<value>"), *iter); \
1764 					g_strfreev (strv); \
1765 					return FALSE; \
1766 				} \
1767 				*right++ = '\0'; \
1768 				\
1769 				if (valid_func1_p) { \
1770 					const char **valid_options = valid_func1_p (s_macro (setting)); \
1771 					if (!(opt_name = nmc_string_is_valid (g_strstrip (left), valid_options, error))) { \
1772 						g_strfreev (strv); \
1773 						return FALSE; \
1774 					} \
1775 				} else \
1776 					opt_name = g_strstrip (left);\
1777 				\
1778 				opt_val = g_strstrip (right); \
1779 				if (valid_func2_p) { \
1780 					if (!(opt_val = valid_func2_p ((const char *) left, (const char *) opt_val, error))) { \
1781 						g_strfreev (strv); \
1782 						return FALSE; \
1783 					}\
1784 				}\
1785 				add_func (s_macro (setting), opt_name, opt_val); \
1786 			} \
1787 			g_strfreev (strv); \
1788 			return TRUE; \
1789 		}
1790 	
1791 	#define DEFINE_REMOVER_INDEX(def_func, s_macro, num_func, rem_func) \
1792 		static gboolean \
1793 		def_func (NMSetting *setting, const char *prop, const char *option, guint32 idx, GError **error) \
1794 		{ \
1795 			guint32 num; \
1796 			if (option) { \
1797 				g_set_error (error, 1, 0, _("index '%s' is not valid"), option); \
1798 				return FALSE; \
1799 			} \
1800 			num = num_func (s_macro (setting)); \
1801 			if (num == 0) { \
1802 				g_set_error_literal (error, 1, 0, _("no item to remove")); \
1803 				return FALSE; \
1804 			} \
1805 			if (idx >= num) { \
1806 				g_set_error (error, 1, 0, _("index '%d' is not in range <0-%d>"), idx, num - 1); \
1807 				return FALSE; \
1808 			} \
1809 			rem_func (s_macro (setting), idx); \
1810 			return TRUE; \
1811 		}
1812 	
1813 	#define DEFINE_REMOVER_OPTION(def_func, s_macro, rem_func) \
1814 		static gboolean \
1815 		def_func (NMSetting *setting, const char *prop, const char *option, guint32 idx, GError **error) \
1816 		{ \
1817 			gboolean success = FALSE; \
1818 			if (option && *option) { \
1819 				success = rem_func (s_macro (setting), option); \
1820 				if (!success) \
1821 					g_set_error (error, 1, 0, _("invalid option '%s'"), option); \
1822 			} else \
1823 				g_set_error_literal (error, 1, 0, _("missing option")); \
1824 			return success; \
1825 		}
1826 	
1827 	#define DEFINE_ALLOWED_VAL_FUNC(def_func, valid_values) \
1828 		static const char * \
1829 		def_func (NMSetting *setting, const char *prop) \
1830 		{ \
1831 			static char *values = NULL; \
1832 			if (G_UNLIKELY (values == NULL)) \
1833 				values = g_strjoinv (", ", (char **) valid_values); \
1834 			return values; \
1835 		}
1836 	
1837 	/* --- generic property setter functions --- */
1838 	static gboolean
1839 	nmc_property_set_string (NMSetting *setting, const char *prop, const char *val, GError **error)
1840 	{
1841 		g_object_set (setting, prop, val, NULL);
1842 		return TRUE;
1843 	}
1844 	
1845 	static gboolean
1846 	nmc_property_set_int (NMSetting *setting, const char *prop, const char *val, GError **error)
1847 	{
1848 		long val_int;
1849 	
1850 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1851 	
1852 		if (!nmc_string_to_int (val, TRUE, G_MININT, G_MAXINT, &val_int)) {
1853 			g_set_error (error, 1, 0, _("'%s' is not a valid number (or out of range)"), val);
1854 			return FALSE;
1855 		}
1856 	
1857 		/* Validate the number according to the property spec */
1858 		if (!validate_int (setting, prop, (gint) val_int, error))
1859 			return FALSE;
1860 	
1861 		g_object_set (setting, prop, val_int, NULL);
1862 		return TRUE;
1863 	}
1864 	
1865 	static gboolean
1866 	nmc_property_set_uint (NMSetting *setting, const char *prop, const char *val, GError **error)
1867 	{
1868 		unsigned long val_int;
1869 	
1870 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1871 	
1872 		if (!nmc_string_to_uint (val, TRUE, 0, G_MAXUINT, &val_int)) {
1873 			g_set_error (error, 1, 0, _("'%s' is not a valid number (or out of range)"), val);
1874 			return FALSE;
1875 		}
1876 	
1877 		/* Validate the number according to the property spec */
1878 		if (!validate_uint (setting, prop, (guint) val_int, error))
1879 			return FALSE;
1880 	
1881 		g_object_set (setting, prop, val_int, NULL);
1882 		return TRUE;
1883 	}
1884 	
1885 	static gboolean
1886 	nmc_property_set_bool (NMSetting *setting, const char *prop, const char *val, GError **error)
1887 	{
1888 		gboolean val_bool;
1889 	
1890 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1891 	
1892 		if (!nmc_string_to_bool (val, &val_bool, error))
1893 			return FALSE;
1894 	
1895 		g_object_set (setting, prop, val_bool, NULL);
1896 		return TRUE;
1897 	}
1898 	
1899 	static gboolean
1900 	nmc_property_set_ssid (NMSetting *setting, const char *prop, const char *val, GError **error)
1901 	{
1902 		GByteArray *ssid_arr;
1903 	
1904 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1905 	
1906 		if (strlen (val) > 32) {
1907 			g_set_error (error, 1, 0, _("'%s' is not valid"), val);
1908 			return FALSE;
1909 		}
1910 	
1911 		ssid_arr = g_byte_array_sized_new (strlen (val));
1912 		g_byte_array_append (ssid_arr, (const guint8 *) val, strlen (val));
1913 		g_object_set (setting, prop, ssid_arr, NULL);
1914 	
1915 		return TRUE;
1916 	}
1917 	
1918 	static gboolean
1919 	nmc_property_set_mac (NMSetting *setting, const char *prop, const char *val, GError **error)
1920 	{
1921 		GByteArray *array;
1922 	
1923 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1924 	
1925 		array = nm_utils_hwaddr_atoba (val, ARPHRD_ETHER);
1926 		if (!array) {
1927 			g_set_error (error, 1, 0, _("'%s' is not a valid Ethernet MAC"), val);
1928 			return FALSE;
1929 		}
1930 	
1931 		g_object_set (setting, prop, array, NULL);
1932 		g_byte_array_free (array, TRUE);
1933 		return TRUE;
1934 	}
1935 	
1936 	static gboolean
1937 	nmc_property_set_mtu (NMSetting *setting, const char *prop, const char *val, GError **error)
1938 	{
1939 		const char *mtu = val;
1940 	
1941 		if (strcmp (mtu, "auto") == 0)
1942 			mtu = "0";
1943 	
1944 		return nmc_property_set_uint (setting, prop, mtu, error);
1945 	}
1946 	
1947 	static gboolean
1948 	nmc_property_set_ifname (NMSetting *setting, const char *prop, const char *val, GError **error)
1949 	{
1950 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1951 	
1952 		if (!nm_utils_iface_valid_name (val)) {
1953 			g_set_error (error, 1, 0, _("'%s' is not a valid interface name"), val);
1954 			return FALSE;
1955 		}
1956 		g_object_set (setting, prop, val, NULL);
1957 		return TRUE;
1958 	}
1959 	
1960 	static gboolean
1961 	nmc_property_set_flags (NMSetting *setting, const char *prop, const char *val, GError **error)
1962 	{
1963 		char **strv = NULL, **iter;
1964 		unsigned long flags = 0, val_int;
1965 	
1966 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
1967 	
1968 		strv = nmc_strsplit_set (val, " \t,", 0);
1969 		for (iter = strv; iter && *iter; iter++) {
1970 			if (!nmc_string_to_uint (*iter, TRUE, 0, G_MAXUINT32, &val_int)) {
1971 				g_set_error (error, 1, 0, _("'%s' is not a number"), *iter);
1972 				g_strfreev (strv);
1973 				return FALSE;
1974 			}
1975 			flags += val_int;
1976 		}
1977 		g_strfreev (strv);
1978 	
1979 		/* Validate the number according to the property spec */
1980 		if (!validate_uint (setting, prop, (guint) flags, error))
1981 			return FALSE;
1982 	
1983 		g_object_set (setting, prop, (guint) flags, NULL);
1984 		return TRUE;
1985 	}
1986 	
1987 	static gboolean
1988 	nmc_util_is_domain (const char *domain)
1989 	{
1990 		//FIXME: implement
1991 		return TRUE;
1992 	}
1993 	
1994 	static gboolean
1995 	nmc_property_set_byte_array (NMSetting *setting, const char *prop, const char *val, GError **error)
1996 	{
1997 		char **strv = NULL, **iter;
1998 		char *val_strip;
1999 		const char *delimiters = " \t,";
2000 		long int val_int;
2001 		char *bin;
2002 		GByteArray *array = NULL;
2003 		gboolean success = TRUE;
2004 	
2005 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2006 	
2007 		val_strip = g_strstrip (g_strdup (val));
2008 	
2009 		/* First try hex string in the format of AAbbCCDd */
2010 		bin = nm_utils_hexstr2bin (val_strip, strlen (val_strip));
2011 		if (bin) {
2012 			array = g_byte_array_sized_new (strlen (val_strip)/2);
2013 			g_byte_array_append (array, (const guint8 *) bin, strlen (val_strip)/2);
2014 			g_free (bin);
2015 			goto done;
2016 		}
2017 	
2018 		/* Otherwise, consider the following format: AA b 0xCc D */
2019 		strv = nmc_strsplit_set (val_strip, delimiters, 0);
2020 		array = g_byte_array_sized_new (g_strv_length (strv));
2021 		for (iter = strv; iter && *iter; iter++) {
2022 			if (!nmc_string_to_int_base (g_strstrip (*iter), 16, TRUE, 0, 255, &val_int)) {
2023 				g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter);
2024 				success = FALSE;
2025 				goto done;
2026 			}
2027 			g_byte_array_append (array, (const guint8 *) &val_int, 1);
2028 		}
2029 	
2030 	done:
2031 		if (success)
2032 			g_object_set (setting, prop, array, NULL);
2033 	
2034 		g_strfreev (strv);
2035 		if (array)
2036 			g_byte_array_free (array, TRUE);
2037 		return success;
2038 	}
2039 	
2040 	#define DEFINE_SETTER_MAC_BLACKLIST(def_func, s_macro, add_func) \
2041 		static gboolean \
2042 		def_func (NMSetting *setting, const char *prop, const char *val, GError **error) \
2043 		{ \
2044 			guint8 buf[32]; \
2045 			char **list = NULL, **iter; \
2046 			GSList *macaddr_blacklist = NULL; \
2047 			\
2048 			g_return_val_if_fail (error == NULL || *error == NULL, FALSE); \
2049 			\
2050 			list = nmc_strsplit_set (val, " \t,", 0); \
2051 			for (iter = list; iter && *iter; iter++) { \
2052 				if (!nm_utils_hwaddr_aton (*iter, ARPHRD_ETHER, buf)) { \
2053 					g_set_error (error, 1, 0, _("'%s' is not a valid MAC"), *iter); \
2054 					g_strfreev (list); \
2055 					g_slist_free (macaddr_blacklist); \
2056 					return FALSE; \
2057 				} \
2058 			} \
2059 			\
2060 			for (iter = list; iter && *iter; iter++) \
2061 				add_func (s_macro (setting), *iter); \
2062 			\
2063 			g_strfreev (list); \
2064 			return TRUE; \
2065 		}
2066 	
2067 	static char *
2068 	nmc_property_out2in_cut_paren (const char *out_format)
2069 	{
2070 		const char *p;
2071 		size_t n;
2072 	
2073 		p = strstr (out_format, " (");
2074 		n = p ? p - out_format : strlen (out_format);
2075 		return g_strndup (out_format, n);
2076 	}
2077 	
2078 	/* --- NM_SETTING_CONNECTION_SETTING_NAME property setter functions --- */
2079 	#if 0
2080 	/*
2081 	 * Setting/removing UUID has been forbidden.
2082 	 * Should it be enabled later, this function can be used.
2083 	 */
2084 	static gboolean
2085 	nmc_property_con_set_uuid (NMSetting *setting, const char *prop, const char *val, GError **error)
2086 	{
2087 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2088 	
2089 		if (!nm_utils_is_uuid (val)) {
2090 			g_set_error (error, 1, 0, _("'%s' is not a valid UUID"), val);
2091 			return FALSE;
2092 		}
2093 		g_object_set (setting, prop, val, NULL);
2094 		return TRUE;
2095 	}
2096 	#endif
2097 	
2098 	/* 'permissions' */
2099 	/* define from libnm-util/nm-setting-connection.c */
2100 	#define PERM_USER_PREFIX  "user:"
2101 	
2102 	static gboolean
2103 	permissions_valid (const char *perm)
2104 	{
2105 		if (!perm || perm[0] == '\0')
2106 			return FALSE;
2107 	
2108 		if (strncmp (perm, PERM_USER_PREFIX, strlen (PERM_USER_PREFIX)) == 0) {
2109 			if (   strlen (perm) <= strlen (PERM_USER_PREFIX)
2110 			    || strchr (perm + strlen (PERM_USER_PREFIX), ':'))
2111 				return  FALSE;
2112 		} else {
2113 			if (strchr (perm, ':'))
2114 				return  FALSE;
2115 		}
2116 	
2117 		return TRUE;
2118 	}
2119 	
2120 	static gboolean
2121 	nmc_property_connection_set_permissions (NMSetting *setting, const char *prop, const char *val, GError **error)
2122 	{
2123 		char **strv = NULL;
2124 		guint i = 0;
2125 	
2126 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2127 	
2128 		strv = nmc_strsplit_set (val, " \t,", 0);
2129 		if (!verify_string_list (strv, prop, permissions_valid, error)) {
2130 			g_strfreev (strv);
2131 			return FALSE;
2132 		}
2133 	
2134 		for (i = 0; strv && strv[i]; i++) {
2135 			const char *user;
2136 	
2137 			if (strncmp (strv[i], PERM_USER_PREFIX, strlen (PERM_USER_PREFIX)) == 0)
2138 				user = strv[i]+strlen (PERM_USER_PREFIX);
2139 			else
2140 				user = strv[i];
2141 	
2142 			nm_setting_connection_add_permission (NM_SETTING_CONNECTION (setting), "user", user, NULL);
2143 		}
2144 	
2145 		return TRUE;
2146 	}
2147 	DEFINE_REMOVER_INDEX (nmc_property_connection_remove_idx_permissions,
2148 	                      NM_SETTING_CONNECTION,
2149 	                      nm_setting_connection_get_num_permissions,
2150 	                      nm_setting_connection_remove_permission)
2151 	
2152 	static const char *
2153 	nmc_property_connection_describe_permissions (NMSetting *setting, const char *prop)
2154 	{
2155 		return _("Enter a list of user permissions. This is a list of user names formatted as:\n"
2156 		         "  [user:]<user name 1>, [user:]<user name 2>,... \n"
2157 		         "The items can be separated by commas or spaces.\n\n"
2158 		         "Example: alice bob charlie\n");
2159 	}
2160 	
2161 	/* 'master' */
2162 	static gboolean
2163 	nmc_property_con_set_master (NMSetting *setting, const char *prop, const char *val, GError **error)
2164 	{
2165 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2166 	
2167 		if (   !nm_utils_iface_valid_name (val)
2168 		    && !nm_utils_is_uuid (val)) {
2169 			g_set_error (error, 1, 0,
2170 			             _("'%s' is not valid master; use ifname or connection UUID"),
2171 			             val);
2172 			return FALSE;
2173 		}
2174 		g_object_set (setting, prop, val, NULL);
2175 		return TRUE;
2176 	}
2177 	
2178 	/* 'slave-type' */
2179 	static const char *con_valid_slave_types[] = {
2180 		NM_SETTING_BOND_SETTING_NAME,
2181 		NM_SETTING_BRIDGE_SETTING_NAME,
2182 		NM_SETTING_VLAN_SETTING_NAME,
2183 		NULL
2184 	};
2185 	
2186 	static gboolean
2187 	nmc_property_con_set_slave_type (NMSetting *setting, const char *prop, const char *val, GError **error)
2188 	{
2189 		return check_and_set_string (setting, prop, val, con_valid_slave_types, error);
2190 	}
2191 	
2192 	
2193 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_con_allowed_slave_type, con_valid_slave_types)
2194 	
2195 	/* 'secondaries' */
2196 	static gboolean
2197 	nmc_property_connection_set_secondaries (NMSetting *setting, const char *prop, const char *val, GError **error)
2198 	{
2199 		char **strv = NULL;
2200 		guint i = 0;
2201 	
2202 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2203 	
2204 		strv = nmc_strsplit_set (val, " \t,", 0);
2205 		if (!verify_string_list (strv, prop, nm_utils_is_uuid, error)) {
2206 			g_strfreev (strv);
2207 			return FALSE;
2208 		}
2209 	
2210 		while (strv && strv[i])
2211 			nm_setting_connection_add_secondary (NM_SETTING_CONNECTION (setting), strv[i++]);
2212 		g_strfreev (strv);
2213 	
2214 		return TRUE;
2215 	}
2216 	DEFINE_REMOVER_INDEX (nmc_property_connection_remove_idx_secondaries,
2217 	                      NM_SETTING_CONNECTION,
2218 	                      nm_setting_connection_get_num_secondaries,
2219 	                      nm_setting_connection_remove_secondary)
2220 	
2221 	
2222 	/* --- NM_SETTING_802_1X_SETTING_NAME property setter functions --- */
2223 	#define DEFINE_SETTER_STR_LIST(def_func, set_func) \
2224 		static gboolean \
2225 		def_func (NMSetting *setting, const char *prop, const char *val, GError **error) \
2226 		{ \
2227 			char **strv = NULL; \
2228 			guint i = 0; \
2229 			\
2230 			g_return_val_if_fail (error == NULL || *error == NULL, FALSE); \
2231 			\
2232 			strv = nmc_strsplit_set (val, " \t,", 0); \
2233 			while (strv && strv[i]) \
2234 				set_func (NM_SETTING_802_1X (setting), strv[i++]); \
2235 			g_strfreev (strv); \
2236 			return TRUE; \
2237 		}
2238 	
2239 	#define DEFINE_SETTER_CERT(def_func, set_func) \
2240 		static gboolean \
2241 		def_func (NMSetting *setting, const char *prop, const char *val, GError **error) \
2242 		{ \
2243 			const char *SCHEME_PATH = "file://"; \
2244 			char *val_strip = g_strstrip (g_strdup (val)); \
2245 			char *p = val_strip; \
2246 			gboolean success; \
2247 			\
2248 			if (strncmp (val_strip, SCHEME_PATH, strlen (SCHEME_PATH)) == 0) \
2249 				p += strlen (SCHEME_PATH); \
2250 			\
2251 			success = set_func (NM_SETTING_802_1X (setting), \
2252 			                    p, \
2253 			                    NM_SETTING_802_1X_CK_SCHEME_PATH, \
2254 			                    NULL, \
2255 			                    error); \
2256 			g_free (val_strip); \
2257 			return success; \
2258 		}
2259 	
2260 	#define DEFINE_SETTER_PRIV_KEY(def_func, pwd_func, set_func) \
2261 		static gboolean \
2262 		def_func (NMSetting *setting, const char *prop, const char *val, GError **error) \
2263 		{ \
2264 			char **strv = NULL; \
2265 			const char *SCHEME_PATH = "file://"; \
2266 			char *val_strip = g_strstrip (g_strdup (val)); \
2267 			char *p = val_strip; \
2268 			const char *path, *password; \
2269 			gboolean success; \
2270 			\
2271 			if (strncmp (val_strip, SCHEME_PATH, strlen (SCHEME_PATH)) == 0) \
2272 				p += strlen (SCHEME_PATH); \
2273 			\
2274 			strv = nmc_strsplit_set (p, " \t,", 2); \
2275 			path = strv[0]; \
2276 			if (g_strv_length (strv) == 2) \
2277 				password = strv[1]; \
2278 			else \
2279 				password = pwd_func (NM_SETTING_802_1X (setting)); \
2280 			if (password) { \
2281 				char *tmp_pwd = g_strdup (password); \
2282 				success = set_func (NM_SETTING_802_1X (setting), \
2283 				                    path, \
2284 				                    tmp_pwd, \
2285 				                    NM_SETTING_802_1X_CK_SCHEME_PATH, \
2286 				                    NULL, \
2287 				                    error); \
2288 				g_free (tmp_pwd); \
2289 			} else { \
2290 				success = FALSE; \
2291 				g_set_error_literal  (error, 1, 0, _("private key password not provided")); \
2292 			} \
2293 			g_free (val_strip); \
2294 			g_strfreev (strv); \
2295 			return success; \
2296 		}
2297 	
2298 	/* 'eap' */
2299 	DEFINE_SETTER_STR_LIST_MULTI (check_and_add_802_1X_eap,
2300 	                              NM_SETTING_802_1X,
2301 	                              nm_setting_802_1x_add_eap_method)
2302 	static gboolean
2303 	nmc_property_802_1X_set_eap (NMSetting *setting, const char *prop, const char *val, GError **error)
2304 	{
2305 		const char *valid_eap[] = { "leap", "md5", "tls", "peap", "ttls", "sim", "fast", "pwd", NULL };
2306 		return check_and_add_802_1X_eap (setting, prop, val, valid_eap, error);
2307 	}
2308 	DEFINE_REMOVER_INDEX (nmc_property_802_1X_remove_idx_eap,
2309 	                      NM_SETTING_802_1X,
2310 	                      nm_setting_802_1x_get_num_eap_methods,
2311 	                      nm_setting_802_1x_remove_eap_method)
2312 	/* 'ca-cert' */
2313 	DEFINE_SETTER_CERT (nmc_property_802_1X_set_ca_cert, nm_setting_802_1x_set_ca_cert)
2314 	
2315 	/* 'altsubject-matches' */
2316 	DEFINE_SETTER_STR_LIST (nmc_property_802_1X_set_altsubject_matches, nm_setting_802_1x_add_altsubject_match)
2317 	DEFINE_REMOVER_INDEX (nmc_property_802_1X_remove_idx_altsubject_matches,
2318 	                      NM_SETTING_802_1X,
2319 	                      nm_setting_802_1x_get_num_altsubject_matches,
2320 	                      nm_setting_802_1x_remove_altsubject_match)
2321 	
2322 	/* 'client-cert' */
2323 	DEFINE_SETTER_CERT (nmc_property_802_1X_set_client_cert, nm_setting_802_1x_set_client_cert)
2324 	
2325 	/* 'phase2-ca-cert' */
2326 	DEFINE_SETTER_CERT (nmc_property_802_1X_set_phase2_ca_cert, nm_setting_802_1x_set_phase2_ca_cert)
2327 	
2328 	/* 'phase2-altsubject-matches' */
2329 	DEFINE_SETTER_STR_LIST (nmc_property_802_1X_set_phase2_altsubject_matches, nm_setting_802_1x_add_phase2_altsubject_match)
2330 	DEFINE_REMOVER_INDEX (nmc_property_802_1X_remove_idx_phase2_altsubject_matches,
2331 	                      NM_SETTING_802_1X,
2332 	                      nm_setting_802_1x_get_num_phase2_altsubject_matches,
2333 	                      nm_setting_802_1x_remove_phase2_altsubject_match)
2334 	
2335 	/* 'phase2-client-cert' */
2336 	DEFINE_SETTER_CERT (nmc_property_802_1X_set_phase2_client_cert, nm_setting_802_1x_set_phase2_client_cert)
2337 	
2338 	/* 'private-key' */
2339 	DEFINE_SETTER_PRIV_KEY (nmc_property_802_1X_set_private_key,
2340 	                        nm_setting_802_1x_get_private_key_password,
2341 	                        nm_setting_802_1x_set_private_key)
2342 	
2343 	/* 'phase2-private-key' */
2344 	DEFINE_SETTER_PRIV_KEY (nmc_property_802_1X_set_phase2_private_key,
2345 	                        nm_setting_802_1x_get_phase2_private_key_password,
2346 	                        nm_setting_802_1x_set_phase2_private_key)
2347 	
2348 	static const char *
2349 	nmc_property_802_1X_describe_private_key (NMSetting *setting, const char *prop)
2350 	{
2351 		return _("Enter path to a private key and the key password (if not set yet):\n"
2352 		         "  <file path> [<password>]\n"
2353 		         "Example: /home/cimrman/jara-priv-key Dardanely\n");
2354 	}
2355 	
2356 	/* 'phase1-peapver' */
2357 	static const char *_802_1X_valid_phase1_peapvers[] = { "0", "1", NULL };
2358 	
2359 	static gboolean
2360 	nmc_property_802_1X_set_phase1_peapver (NMSetting *setting, const char *prop, const char *val, GError **error)
2361 	{
2362 		return check_and_set_string (setting, prop, val, _802_1X_valid_phase1_peapvers, error);
2363 	}
2364 	
2365 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_802_1X_allowed_phase1_peapver, _802_1X_valid_phase1_peapvers)
2366 	
2367 	/* 'phase1-peaplabel' */
2368 	static const char *_802_1X_valid_phase1_peaplabels[] = { "0", "1", NULL };
2369 	
2370 	static gboolean
2371 	nmc_property_802_1X_set_phase1_peaplabel (NMSetting *setting, const char *prop, const char *val, GError **error)
2372 	{
2373 		return check_and_set_string (setting, prop, val, _802_1X_valid_phase1_peaplabels, error);
2374 	}
2375 	
2376 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_802_1X_allowed_phase1_peaplabel, _802_1X_valid_phase1_peaplabels)
2377 	
2378 	/* 'phase1-fast-provisioning' */
2379 	static const char *_802_1X_valid_phase1_fast_provisionings[] = { "0", "1", "2", "3", NULL };
2380 	
2381 	static gboolean
2382 	nmc_property_802_1X_set_phase1_fast_provisioning (NMSetting *setting, const char *prop, const char *val, GError **error)
2383 	{
2384 		return check_and_set_string (setting, prop, val, _802_1X_valid_phase1_fast_provisionings, error);
2385 	}
2386 	
2387 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_802_1X_allowed_phase1_fast_provisioning, _802_1X_valid_phase1_fast_provisionings)
2388 	
2389 	/* 'phase2-auth' */
2390 	static const char *_802_1X_valid_phase2_auths[] =
2391 		{ "pap", "chap", "mschap", "mschapv2", "gtc", "otp", "md5", "tls", NULL };
2392 	
2393 	static gboolean
2394 	nmc_property_802_1X_set_phase2_auth (NMSetting *setting, const char *prop, const char *val, GError **error)
2395 	{
2396 		return check_and_set_string (setting, prop, val, _802_1X_valid_phase2_auths, error);
2397 	}
2398 	
2399 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_802_1X_allowed_phase2_auth, _802_1X_valid_phase2_auths)
2400 	
2401 	/* 'phase2-autheap' */
2402 	static const char *_802_1X_valid_phase2_autheaps[] = { "md5", "mschapv2", "otp", "gtc", "tls", NULL };
2403 	static gboolean
2404 	nmc_property_802_1X_set_phase2_autheap (NMSetting *setting, const char *prop, const char *val, GError **error)
2405 	{
2406 		return check_and_set_string (setting, prop, val, _802_1X_valid_phase2_autheaps, error);
2407 	}
2408 	
2409 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_802_1X_allowed_phase2_autheap, _802_1X_valid_phase2_autheaps)
2410 	
2411 	/* 'password-raw' */
2412 	static gboolean
2413 	nmc_property_802_1X_set_password_raw (NMSetting *setting, const char *prop, const char *val, GError **error)
2414 	{
2415 		return nmc_property_set_byte_array (setting, prop, val, error);
2416 	}
2417 	
2418 	static const char *
2419 	nmc_property_802_1X_describe_password_raw (NMSetting *setting, const char *prop)
2420 	{
2421 		return _("Enter bytes as a list of hexadecimal values.\n"
2422 		         "Two formats are accepted:\n"
2423 		         "(a) a string of hexadecimal digits, where each two digits represent one byte\n"
2424 		         "(b) space-separated list of bytes written as hexadecimal digits "
2425 		         "(with optional 0x/0X prefix, and optional leading 0).\n\n"
2426 		         "Examples: ab0455a6ea3a74C2\n"
2427 		         "          ab 4 55 0xa6 ea 3a 74 C2\n");
2428 	}
2429 	
2430 	/* --- NM_SETTING_ADSL_SETTING_NAME property setter functions --- */
2431 	/* 'protocol' */
2432 	static const char *adsl_valid_protocols[] = {
2433 		NM_SETTING_ADSL_PROTOCOL_PPPOA,
2434 		NM_SETTING_ADSL_PROTOCOL_PPPOE,
2435 		NM_SETTING_ADSL_PROTOCOL_IPOATM,
2436 		NULL
2437 	};
2438 	
2439 	static gboolean
2440 	nmc_property_adsl_set_protocol (NMSetting *setting, const char *prop, const char *val, GError **error)
2441 	{
2442 		return check_and_set_string (setting, prop, val, adsl_valid_protocols, error);
2443 	}
2444 	
2445 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_adsl_allowed_protocol, adsl_valid_protocols)
2446 	
2447 	/* 'encapsulation' */
2448 	static const char *adsl_valid_encapsulations[] = {
2449 		NM_SETTING_ADSL_ENCAPSULATION_VCMUX,
2450 		NM_SETTING_ADSL_ENCAPSULATION_LLC,
2451 		NULL
2452 	};
2453 	
2454 	static gboolean
2455 	nmc_property_adsl_set_encapsulation (NMSetting *setting, const char *prop, const char *val, GError **error)
2456 	{
2457 		return check_and_set_string (setting, prop, val, adsl_valid_encapsulations, error);
2458 	}
2459 	
2460 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_adsl_allowed_encapsulation, adsl_valid_encapsulations)
2461 	
2462 	/* --- NM_SETTING_BLUETOOTH_SETTING_NAME property setter functions --- */
2463 	/* 'type' */
2464 	static gboolean
2465 	nmc_property_bluetooth_set_type (NMSetting *setting, const char *prop, const char *val, GError **error)
2466 	{
2467 		const char *types[] = {
2468 		    NM_SETTING_BLUETOOTH_TYPE_DUN,
2469 		    NM_SETTING_BLUETOOTH_TYPE_PANU,
2470 		    NULL };
2471 	
2472 		return check_and_set_string (setting, prop, val, types, error);
2473 	}
2474 	
2475 	/* --- NM_SETTING_BOND_SETTING_NAME property setter functions --- */
2476 	/* 'options' */
2477 	/*  example: miimon=100,mode=balance-rr, updelay=5 */
2478 	static gboolean
2479 	_validate_and_remove_bond_option (NMSettingBond *setting, const char *option)
2480 	{
2481 		const char *opt;
2482 		const char **valid_options;
2483 	
2484 		valid_options = nm_setting_bond_get_valid_options (setting);
2485 		opt = nmc_string_is_valid (option, valid_options, NULL);
2486 	
2487 		if (opt)
2488 			return nm_setting_bond_remove_option (setting, opt);
2489 		else
2490 			return FALSE;
2491 	}
2492 	
2493 	/* Validate bonding 'options' values */
2494 	static const char *
2495 	_validate_bond_option_value (const char *option, const char *value, GError **error)
2496 	{
2497 		if (!g_strcmp0 (option, NM_SETTING_BOND_OPTION_MODE))
2498 			return nmc_bond_validate_mode (value, error);
2499 	
2500 		return value;
2501 	}
2502 	
2503 	DEFINE_SETTER_OPTIONS (nmc_property_bond_set_options,
2504 	                       NM_SETTING_BOND,
2505 	                       NMSettingBond,
2506 	                       nm_setting_bond_add_option,
2507 	                       nm_setting_bond_get_valid_options,
2508 	                       _validate_bond_option_value)
2509 	DEFINE_REMOVER_OPTION (nmc_property_bond_remove_option_options,
2510 	                       NM_SETTING_BOND,
2511 	                       _validate_and_remove_bond_option)
2512 	
2513 	static const char *
2514 	nmc_property_bond_describe_options (NMSetting *setting, const char *prop)
2515 	{
2516 		static char *desc = NULL;
2517 		const char **valid_options;
2518 		char *options_str;
2519 	
2520 		if (G_UNLIKELY (desc == NULL)) {
2521 			valid_options = nm_setting_bond_get_valid_options (NM_SETTING_BOND (setting));
2522 			options_str = g_strjoinv (", ", (char **) valid_options);
2523 	
2524 			desc = g_strdup_printf (_("Enter a list of bonding options formatted as:\n"
2525 			                          "  option = <value>, option = <value>,... \n"
2526 			                          "Valid options are: %s\n"
2527 			                          "'mode' can be provided as a name or a number:\n"
2528 			                          "balance-rr    = 0\n"
2529 			                          "active-backup = 1\n"
2530 			                          "balance-xor   = 2\n"
2531 			                          "broadcast     = 3\n"
2532 			                          "802.3ad       = 4\n"
2533 			                          "balance-tlb   = 5\n"
2534 			                          "balance-alb   = 6\n\n"
2535 			                          "Example: mode=2,miimon=120\n"), options_str);
2536 			g_free (options_str);
2537 		}
2538 		return desc;
2539 	}
2540 	
2541 	static const char *
2542 	nmc_property_bond_allowed_options (NMSetting *setting, const char *prop)
2543 	{
2544 		const char **valid_options;
2545 		static char *allowed_vals = NULL;
2546 	
2547 		if (G_UNLIKELY (allowed_vals == NULL)) {
2548 			valid_options = nm_setting_bond_get_valid_options (NM_SETTING_BOND (setting));
2549 			allowed_vals = g_strjoinv (", ", (char **) valid_options);
2550 		}
2551 		return allowed_vals;
2552 	}
2553 	
2554 	/* --- NM_SETTING_INFINIBAND_SETTING_NAME property setter functions --- */
2555 	/* 'mac-addresss' */
2556 	static gboolean
2557 	nmc_property_ib_set_mac (NMSetting *setting, const char *prop, const char *val, GError **error)
2558 	{
2559 		GByteArray *array;
2560 	
2561 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2562 	
2563 		array = nm_utils_hwaddr_atoba (val, ARPHRD_INFINIBAND);
2564 		if (!array) {
2565 			g_set_error (error, 1, 0, _("'%s' is not a valid InfiniBand MAC"), val);
2566 			return FALSE;
2567 		}
2568 	
2569 		g_object_set (setting, prop, array, NULL);
2570 		g_byte_array_free (array, TRUE);
2571 		return TRUE;
2572 	}
2573 	
2574 	/* 'transport-mode' */
2575 	static const char *ib_valid_transport_modes[] = { "datagram", "connected", NULL };
2576 	
2577 	static gboolean
2578 	nmc_property_ib_set_transport_mode (NMSetting *setting, const char *prop, const char *val, GError **error)
2579 	{
2580 		return check_and_set_string (setting, prop, val, ib_valid_transport_modes, error);
2581 	}
2582 	
2583 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_ib_allowed_transport_mode, ib_valid_transport_modes)
2584 	
2585 	/* 'p-key' */
2586 	static gboolean
2587 	nmc_property_ib_set_p_key (NMSetting *setting, const char *prop, const char *val, GError **error)
2588 	{
2589 		gboolean p_key_valid = FALSE;
2590 		long p_key_int;
2591 	
2592 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2593 	
2594 		if (!strncasecmp (val, "0x", 2))
2595 			p_key_valid = nmc_string_to_int_base (val + 2, 16, TRUE, 0, G_MAXUINT16, &p_key_int);
2596 		else
2597 			p_key_valid = nmc_string_to_int (val, TRUE, -1, G_MAXUINT16, &p_key_int);
2598 	
2599 		if (!p_key_valid) {
2600 			if (strcmp (val, "default") == 0)
2601 				p_key_int = -1;
2602 			else {
2603 				g_set_error (error, 1, 0, _("'%s' is not a valid IBoIP P_Key"), val);
2604 				return FALSE;
2605 			}
2606 		}
2607 		g_object_set (setting, prop, (gint) p_key_int, NULL);
2608 		return TRUE;
2609 	}
2610 	
2611 	/* --- NM_SETTING_IP4_CONFIG_SETTING_NAME property setter functions --- */
2612 	/* 'method' */
2613 	static const char *ipv4_valid_methods[] = {
2614 		NM_SETTING_IP4_CONFIG_METHOD_AUTO,
2615 		NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
2616 		NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
2617 		NM_SETTING_IP4_CONFIG_METHOD_SHARED,
2618 		NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
2619 		NULL
2620 	};
2621 	
2622 	static gboolean
2623 	nmc_property_ipv4_set_method (NMSetting *setting, const char *prop, const char *val, GError **error)
2624 	{
2625 		/* Silently accept "static" and convert to "manual" */
2626 		if (val && strlen (val) > 1 && matches (val, "static") == 0)
2627 			val = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
2628 	
2629 		return check_and_set_string (setting, prop, val, ipv4_valid_methods, error);
2630 	}
2631 	
2632 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_ipv4_allowed_method, ipv4_valid_methods)
2633 	
2634 	/* 'dns' */
2635 	static gboolean
2636 	nmc_property_ipv4_set_dns (NMSetting *setting, const char *prop, const char *val, GError **error)
2637 	{
2638 		char **strv = NULL, **iter;
2639 		guint32 ip4_addr;
2640 	
2641 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2642 	
2643 		strv = nmc_strsplit_set (val, " \t,", 0);
2644 		for (iter = strv; iter && *iter; iter++) {
2645 			if (inet_pton (AF_INET, g_strstrip (*iter), &ip4_addr) < 1) {
2646 				g_set_error (error, 1, 0, _("invalid IPv4 address '%s'"), *iter);
2647 				g_strfreev (strv);
2648 				return FALSE;
2649 			}
2650 			nm_setting_ip4_config_add_dns (NM_SETTING_IP4_CONFIG (setting), ip4_addr);
2651 		}
2652 		g_strfreev (strv);
2653 		return TRUE;
2654 	}
2655 	DEFINE_REMOVER_INDEX (nmc_property_ipv4_remove_idx_dns,
2656 	                      NM_SETTING_IP4_CONFIG,
2657 	                      nm_setting_ip4_config_get_num_dns,
2658 	                      nm_setting_ip4_config_remove_dns)
2659 	
2660 	static const char *
2661 	nmc_property_ipv4_describe_dns (NMSetting *setting, const char *prop)
2662 	{
2663 		return _("Enter a list of IPv4 addresses of DNS servers.\n\n"
2664 		         "Example: 8.8.8.8, 8.8.4.4\n");
2665 	}
2666 	
2667 	/* 'dns-search' */
2668 	static gboolean
2669 	nmc_property_ipv4_set_dns_search (NMSetting *setting, const char *prop, const char *val, GError **error)
2670 	{
2671 		char **strv = NULL;
2672 		guint i = 0;
2673 	
2674 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2675 	
2676 		strv = nmc_strsplit_set (val, " \t,", 0);
2677 		if (!verify_string_list (strv, prop, nmc_util_is_domain, error)) {
2678 			g_strfreev (strv);
2679 			return FALSE;
2680 		}
2681 	
2682 		while (strv && strv[i])
2683 			nm_setting_ip4_config_add_dns_search (NM_SETTING_IP4_CONFIG (setting), strv[i++]);
2684 		g_strfreev (strv);
2685 	
2686 		return TRUE;
2687 	}
2688 	DEFINE_REMOVER_INDEX (nmc_property_ipv4_remove_idx_dns_search,
2689 	                      NM_SETTING_IP4_CONFIG,
2690 	                      nm_setting_ip4_config_get_num_dns_searches,
2691 	                      nm_setting_ip4_config_remove_dns_search)
2692 	
2693 	/* 'addresses' */
2694 	static gboolean
2695 	nmc_property_ipv4_set_addresses (NMSetting *setting, const char *prop, const char *val, GError **error)
2696 	{
2697 		char **strv = NULL, **iter;
2698 		char **addrv;
2699 		NMIP4Address *ip4addr = NULL;
2700 	
2701 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2702 	
2703 		strv = nmc_strsplit_set (val, ",", 0);
2704 		for (iter = strv; iter && *iter; iter++) {
2705 			char *address = g_strstrip (*iter);
2706 			addrv = nmc_strsplit_set (address, " \t", 0);
2707 	
2708 			if (g_strv_length (addrv) > 2) {
2709 				g_set_error (error, 1, 0, _("'%s' is not valid (use ip[/prefix] [gateway])"),
2710 				             address);
2711 				g_strfreev (addrv);
2712 				g_strfreev (strv);
2713 				return FALSE;
2714 			}
2715 			ip4addr = nmc_parse_and_build_ip4_address (addrv[0], addrv[1], error);
2716 			if (!ip4addr) {
2717 				g_strfreev (addrv);
2718 				g_strfreev (strv);
2719 				return FALSE;
2720 			}
2721 			nm_setting_ip4_config_add_address (NM_SETTING_IP4_CONFIG (setting), ip4addr);
2722 			g_strfreev (addrv);
2723 		}
2724 		g_strfreev (strv);
2725 		return TRUE;
2726 	}
2727 	DEFINE_REMOVER_INDEX (nmc_property_ipv4_remove_idx_addresses,
2728 	                      NM_SETTING_IP4_CONFIG,
2729 	                      nm_setting_ip4_config_get_num_addresses,
2730 	                      nm_setting_ip4_config_remove_address)
2731 	
2732 	static const char *
2733 	nmc_property_ipv4_describe_addresses (NMSetting *setting, const char *prop)
2734 	{
2735 		return _("Enter a list of IPv4 addresses formatted as:\n"
2736 		         "  ip[/prefix] [gateway], ip[/prefix] [gateway],...\n"
2737 		         "Missing prefix is regarded as prefix of 32.\n\n"
2738 		         "Example: 192.168.1.5/24 192.168.1.1, 10.0.0.11/24\n");
2739 	}
2740 	
2741 	/*
2742 	 * from: { ip = 1.2.3.4/24, gw = 1.2.3.254 }; { ip = 2.2.2.2/16, gw = 5.5.5.5 }
2743 	 * to:   1.2.3.4/24 1.2.3.254, 2.2.2.2/16 5.5.5.5
2744 	 * from: { ip = 11::22/64, gw = 22::33 }; { ip = ab::cd/64, gw = ab::1 }
2745 	 * to:   11::22/64 22:33, ab::cd/64 ab::1
2746 	*/
2747 	static char *
2748 	nmc_property_out2in_addresses (const char *out_format)
2749 	{
2750 	        GRegex *regex;
2751 		GString *str;
2752 	        char **strv;
2753 		int i;
2754 	
2755 		str = g_string_sized_new (128);
2756 		regex = g_regex_new ("\\{ ip = ([^/]+)/([^,]+), gw = ([^ ]+) \\}", 0, 0, NULL);
2757 	
2758 		strv = g_regex_split (regex, out_format, 0);
2759 		for (i = 1; strv && strv[i] && strv[i+1] && strv[i+2]; i=i+4) {
2760 			g_string_append (str, strv[i]); /* IP */
2761 			g_string_append_c (str, '/');
2762 			g_string_append (str, strv[i+1]); /* prefix */
2763 			g_string_append_c (str, ' ');
2764 			g_string_append (str, strv[i+2]); /* gateway */
2765 			g_string_append (str, ", ");
2766 		}
2767 		if (str->len > 0)
2768 			g_string_truncate (str, str->len - 2);
2769 	
2770 		g_strfreev (strv);
2771 		g_regex_unref (regex);
2772 	
2773 		return g_string_free (str, FALSE);
2774 	}
2775 	
2776 	/* 'routes' */
2777 	static gboolean
2778 	nmc_property_ipv4_set_routes (NMSetting *setting, const char *prop, const char *val, GError **error)
2779 	{
2780 		char **strv = NULL, **iter;
2781 		char **routev;
2782 		NMIP4Route *ip4route = NULL;
2783 	
2784 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2785 	
2786 		strv = nmc_strsplit_set (val, ",", 0);
2787 		for (iter = strv; iter && *iter; iter++) {
2788 			char *route = g_strstrip (*iter);
2789 			routev = nmc_strsplit_set (route, " \t", 0);
2790 	
2791 			if (g_strv_length (routev) < 2 || g_strv_length (routev) > 3) {
2792 				g_set_error (error, 1, 0, _("'%s' is not valid (use ip/[prefix] next-hop [metric])"),
2793 				             route);
2794 				g_strfreev (routev);
2795 				g_strfreev (strv);
2796 				return FALSE;
2797 			}
2798 			ip4route = nmc_parse_and_build_ip4_route (routev[0], routev[1], routev[2], error);
2799 			if (!ip4route) {
2800 				g_strfreev (routev);
2801 				g_strfreev (strv);
2802 				return FALSE;
2803 			}
2804 			nm_setting_ip4_config_add_route (NM_SETTING_IP4_CONFIG (setting), ip4route);
2805 			g_strfreev (routev);
2806 		}
2807 		g_strfreev (strv);
2808 		return TRUE;
2809 	}
2810 	DEFINE_REMOVER_INDEX (nmc_property_ipv4_remove_idx_routes,
2811 	                      NM_SETTING_IP4_CONFIG,
2812 	                      nm_setting_ip4_config_get_num_routes,
2813 	                      nm_setting_ip4_config_remove_route)
2814 	
2815 	static const char *
2816 	nmc_property_ipv4_describe_routes (NMSetting *setting, const char *prop)
2817 	{
2818 		return _("Enter a list of IPv4 routes formatted as:\n"
2819 		         "  ip/[prefix] next-hop [metric],... \n"
2820 		         "Missing prefix is regarded as a prefix of 32.\n"
2821 		         "Missing metric is regarded as a metric of 0.\n\n"
2822 		         "Example: 192.168.2.0/24 192.168.2.1 3, 10.1.0.0/16 10.0.0.254\n");
2823 	}
2824 	
2825 	static char *
2826 	nmc_property_out2in_routes (const char *out_format)
2827 	{
2828 	        GRegex *regex;
2829 		GString *str;
2830 	        char **strv;
2831 		int i;
2832 	
2833 		str = g_string_sized_new (128);
2834 		regex = g_regex_new ("\\{ dst = ([^/]+)/([^,]+), nh = ([^,]+), mt = ([^ ]+) \\}", 0, 0, NULL);
2835 	
2836 		strv = g_regex_split (regex, out_format, 0);
2837 		for (i = 1; strv && strv[i] && strv[i+1] && strv[i+2] && strv[i+3]; i=i+5) {
2838 			g_string_append (str, strv[i]); /* IP */
2839 			g_string_append_c (str, '/');
2840 			g_string_append (str, strv[i+1]); /* prefix */
2841 			g_string_append_c (str, ' ');
2842 			g_string_append (str, strv[i+2]); /* next hop */
2843 			g_string_append_c (str, ' ');
2844 			g_string_append (str, strv[i+3]); /* metric */
2845 			g_string_append (str, ", ");
2846 		}
2847 		if (str->len > 0)
2848 			g_string_truncate (str, str->len - 2);
2849 	
2850 		g_strfreev (strv);
2851 		g_regex_unref (regex);
2852 	
2853 		return g_string_free (str, FALSE);
2854 	}
2855 	
2856 	/* --- NM_SETTING_IP6_CONFIG_SETTING_NAME property setter functions --- */
2857 	/* 'method' */
2858 	static const char *ipv6_valid_methods[] = {
2859 		NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
2860 		NM_SETTING_IP6_CONFIG_METHOD_AUTO,
2861 		NM_SETTING_IP6_CONFIG_METHOD_DHCP,
2862 		NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
2863 		NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
2864 		NM_SETTING_IP6_CONFIG_METHOD_SHARED,
2865 		NULL
2866 	};
2867 	
2868 	static gboolean
2869 	nmc_property_ipv6_set_method (NMSetting *setting, const char *prop, const char *val, GError **error)
2870 	{
2871 		/* Silently accept "static" and convert to "manual" */
2872 		if (val && strlen (val) > 1 && matches (val, "static") == 0)
2873 			val = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
2874 	
2875 		return check_and_set_string (setting, prop, val, ipv6_valid_methods, error);
2876 	}
2877 	
2878 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_ipv6_allowed_method, ipv6_valid_methods)
2879 	
2880 	/* 'dns' */
2881 	static gboolean
2882 	nmc_property_ipv6_set_dns (NMSetting *setting, const char *prop, const char *val, GError **error)
2883 	{
2884 		char **strv = NULL, **iter;
2885 		struct in6_addr ip6_addr;
2886 	
2887 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2888 	
2889 		strv = nmc_strsplit_set (val, " \t,", 0);
2890 		for (iter = strv; iter && *iter; iter++) {
2891 			if (inet_pton (AF_INET6, g_strstrip (*iter), &ip6_addr) < 1) {
2892 				g_set_error (error, 1, 0, _("invalid IPv6 address '%s'"), *iter);
2893 				g_strfreev (strv);
2894 				return FALSE;
2895 			}
2896 			nm_setting_ip6_config_add_dns (NM_SETTING_IP6_CONFIG (setting), &ip6_addr);
2897 		}
2898 		g_strfreev (strv);
2899 		return TRUE;
2900 	}
2901 	DEFINE_REMOVER_INDEX (nmc_property_ipv6_remove_idx_dns,
2902 	                      NM_SETTING_IP6_CONFIG,
2903 	                      nm_setting_ip6_config_get_num_dns,
2904 	                      nm_setting_ip6_config_remove_dns)
2905 	
2906 	static const char *
2907 	nmc_property_ipv6_describe_dns (NMSetting *setting, const char *prop)
2908 	{
2909 		return _("Enter a list of IPv6 addresses of DNS servers.  If the IPv6 "
2910 		         "configuration method is 'auto' these DNS servers are appended "
2911 		         "to those (if any) returned by automatic configuration.  DNS "
2912 		         "servers cannot be used with the 'shared' or 'link-local' IPv6 "
2913 		         "configuration methods, as there is no upstream network. In "
2914 		         "all other IPv6 configuration methods, these DNS "
2915 		         "servers are used as the only DNS servers for this connection.\n\n"
2916 		         "Example: 2607:f0d0:1002:51::4, 2607:f0d0:1002:51::1\n");
2917 	}
2918 	
2919 	/* 'dns-search' */
2920 	static gboolean
2921 	nmc_property_ipv6_set_dns_search (NMSetting *setting, const char *prop, const char *val, GError **error)
2922 	{
2923 		char **strv = NULL;
2924 		guint i = 0;
2925 	
2926 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2927 	
2928 		strv = nmc_strsplit_set (val, " \t,", 0);
2929 		if (!verify_string_list (strv, prop, nmc_util_is_domain, error)) {
2930 			g_strfreev (strv);
2931 			return FALSE;
2932 		}
2933 	
2934 		while (strv && strv[i])
2935 			nm_setting_ip6_config_add_dns_search (NM_SETTING_IP6_CONFIG (setting), strv[i++]);
2936 		g_strfreev (strv);
2937 	
2938 		return TRUE;
2939 	}
2940 	DEFINE_REMOVER_INDEX (nmc_property_ipv6_remove_idx_dns_search,
2941 	                      NM_SETTING_IP6_CONFIG,
2942 	                      nm_setting_ip6_config_get_num_dns_searches,
2943 	                      nm_setting_ip6_config_remove_dns_search)
2944 	
2945 	/* 'addresses' */
2946 	static gboolean
2947 	nmc_property_ipv6_set_addresses (NMSetting *setting, const char *prop, const char *val, GError **error)
2948 	{
2949 		char **strv = NULL, **iter;
2950 		char **addrv;
2951 		NMIP6Address *ip6addr = NULL;
2952 	
2953 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
2954 	
2955 		strv = nmc_strsplit_set (val, ",", 0);
2956 		for (iter = strv; iter && *iter; iter++) {
2957 			char *address = g_strstrip (*iter);
2958 			addrv = nmc_strsplit_set (address, " \t", 0);
2959 	
2960 			if (g_strv_length (addrv) > 2) {
2961 				g_set_error (error, 1, 0, _("'%s' is not valid (use ip[/prefix] [gateway])"),
2962 				             address);
2963 				g_strfreev (addrv);
2964 				g_strfreev (strv);
2965 				return FALSE;
2966 			}
2967 			ip6addr = nmc_parse_and_build_ip6_address (addrv[0], addrv[1], error);
2968 			if (!ip6addr) {
2969 				g_strfreev (addrv);
2970 				g_strfreev (strv);
2971 				return FALSE;
2972 			}
2973 			nm_setting_ip6_config_add_address (NM_SETTING_IP6_CONFIG (setting), ip6addr);
2974 			g_strfreev (addrv);
2975 		}
2976 		g_strfreev (strv);
2977 		return TRUE;
2978 	}
2979 	DEFINE_REMOVER_INDEX (nmc_property_ipv6_remove_idx_addresses,
2980 	                      NM_SETTING_IP6_CONFIG,
2981 	                      nm_setting_ip6_config_get_num_addresses,
2982 	                      nm_setting_ip6_config_remove_address)
2983 	
2984 	static const char *
2985 	nmc_property_ipv6_describe_addresses (NMSetting *setting, const char *prop)
2986 	{
2987 		return _("Enter a list of IPv6 addresses formatted as:\n"
2988 		         "  ip[/prefix] [gateway], ip[/prefix] [gateway],...\n"
2989 		         "Missing prefix is regarded as prefix of 128.\n\n"
2990 		         "Example: 2607:f0d0:1002:51::4/64 2607:f0d0:1002:51::1, 1050:0:0:0:5:600:300c:326b\n");
2991 	}
2992 	
2993 	/* 'routes' */
2994 	static gboolean
2995 	nmc_property_ipv6_set_routes (NMSetting *setting, const char *prop, const char *val, GError **error)
2996 	{
2997 		char **strv = NULL, **iter;
2998 		char **routev;
2999 		NMIP6Route *ip6route = NULL;
3000 	
3001 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
3002 	
3003 		strv = nmc_strsplit_set (val, ",", 0);
3004 		for (iter = strv; iter && *iter; iter++) {
3005 			char *route = g_strstrip (*iter);
3006 			routev = nmc_strsplit_set (route, " \t", 0);
3007 	
3008 			if (g_strv_length (routev) < 2 || g_strv_length (routev) > 3) {
3009 				g_set_error (error, 1, 0, _("'%s' is not valid (use <dest IP>/prefix <next-hop IP> [metric])"),
3010 				             route);
3011 				g_strfreev (routev);
3012 				g_strfreev (strv);
3013 				return FALSE;
3014 			}
3015 			ip6route = nmc_parse_and_build_ip6_route (routev[0], routev[1], routev[2], error);
3016 			if (!ip6route) {
3017 				g_strfreev (routev);
3018 				g_strfreev (strv);
3019 				return FALSE;
3020 			}
3021 			nm_setting_ip6_config_add_route (NM_SETTING_IP6_CONFIG (setting), ip6route);
3022 			g_strfreev (routev);
3023 		}
3024 		g_strfreev (strv);
3025 		return TRUE;
3026 	}
3027 	DEFINE_REMOVER_INDEX (nmc_property_ipv6_remove_idx_routes,
3028 	                      NM_SETTING_IP6_CONFIG,
3029 	                      nm_setting_ip6_config_get_num_routes,
3030 	                      nm_setting_ip6_config_remove_route)
3031 	
3032 	static const char *
3033 	nmc_property_ipv6_describe_routes (NMSetting *setting, const char *prop)
3034 	{
3035 		return _("Enter a list of IPv6 routes formatted as:\n"
3036 		         "  ip/[prefix] next-hop [metric],... \n"
3037 		         "Missing prefix is regarded as a prefix of 128.\n"
3038 		         "Missing metric is regarded as a metric of 0.\n\n"
3039 		         "Example: 2001:db8:beef:2::/64 2001:db8:beef::2, 2001:db8:beef:3::/64 2001:db8:beef::3 2\n");
3040 	}
3041 	
3042 	static gboolean
3043 	nmc_property_ipv6_set_ip6_privacy (NMSetting *setting, const char *prop, const char *val, GError **error)
3044 	{
3045 		unsigned long val_int;
3046 	
3047 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
3048 	
3049 		if (!nmc_string_to_uint (val, FALSE, 0, 0, &val_int)) {
3050 			g_set_error (error, 1, 0, _("'%s' is not a number"), val);
3051 			return FALSE;
3052 		}
3053 	
3054 		if (   val_int != NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED
3055 		    && val_int != NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR
3056 		    && val_int != NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR) {
3057 			g_set_error (error, 1, 0, _("'%s' is not valid; use 0, 1, or 2"), val);
3058 			return FALSE;
3059 		}
3060 	
3061 		g_object_set (setting, prop, val_int, NULL);
3062 		return TRUE;
3063 	}
3064 	
3065 	/* --- NM_SETTING_OLPC_MESH_SETTING_NAME property setter functions --- */
3066 	static gboolean
3067 	nmc_property_olpc_set_channel (NMSetting *setting, const char *prop, const char *val, GError **error)
3068 	{
3069 		unsigned long chan_int;
3070 	
3071 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
3072 	
3073 		if (!nmc_string_to_uint (val, TRUE, 1, 13, &chan_int)) {
3074 			g_set_error (error, 1, 0, _("'%s' is not a valid channel; use <1-13>"), val);
3075 			return FALSE;
3076 		}
3077 		g_object_set (setting, prop, chan_int, NULL);
3078 		return TRUE;
3079 	}
3080 	
3081 	
3082 	/* --- NM_SETTING_SERIAL_SETTING_NAME property setter functions --- */
3083 	static gboolean
3084 	nmc_property_serial_set_parity (NMSetting *setting, const char *prop, const char *val, GError **error)
3085 	{
3086 		char parity;
3087 	
3088 		if (val[0] == 'E' || val[0] == 'e')
3089 			parity = 'E';
3090 		else if (val[0] == 'O' || val[0] == 'o')
3091 			parity = 'o';
3092 		else if (val[0] == 'N' || val[0] == 'n')
3093 			parity = 'n';
3094 		else {
3095 			g_set_error (error, 1, 0, _("'%s' is not valid; use [e, o, n]"), val);
3096 			return FALSE;
3097 		}
3098 	
3099 		g_object_set (setting, prop, parity, NULL);
3100 		return TRUE;
3101 	}
3102 	
3103 	/* --- NM_SETTING_VLAN_SETTING_NAME property setter functions --- */
3104 	static gboolean
3105 	nmc_property_vlan_set_prio_map (NMSetting *setting,
3106 	                                const char *prop,
3107 	                                const char *val,
3108 	                                NMVlanPriorityMap map_type,
3109 	                                GError **error)
3110 	{
3111 		char **prio_map, **p;
3112 	
3113 		prio_map = nmc_vlan_parse_priority_maps (val, map_type, error);
3114 		if (!prio_map)
3115 			return FALSE;
3116 	
3117 		for (p = prio_map; p && *p; p++)
3118 			nm_setting_vlan_add_priority_str (NM_SETTING_VLAN (setting), map_type, *p);
3119 	
3120 		g_strfreev (prio_map);
3121 		return TRUE;
3122 	}
3123 	
3124 	static gboolean
3125 	nmc_property_vlan_remove_prio_map (NMSetting *setting,
3126 	                                   const char *prop,
3127 	                                   guint32 idx,
3128 	                                   NMVlanPriorityMap map_type,
3129 	                                   GError **error)
3130 	{
3131 		guint32 num;
3132 	
3133 		num = nm_setting_vlan_get_num_priorities (NM_SETTING_VLAN (setting), map_type);
3134 		if (num == 0) {
3135 			g_set_error_literal (error, 1, 0, _("no priority to remove"));
3136 			return FALSE;
3137 		}
3138 		if (idx >= num) {
3139 			g_set_error (error, 1, 0, _("index '%d' is not in the range of <0-%d>"),
3140 			             idx, num - 1);
3141 			return FALSE;
3142 		}
3143 	
3144 		nm_setting_vlan_remove_priority (NM_SETTING_VLAN (setting), map_type, idx);
3145 		return TRUE;
3146 	}
3147 	
3148 	static gboolean
3149 	nmc_property_vlan_set_ingress_priority_map (NMSetting *setting, const char *prop, const char *val, GError **error)
3150 	{
3151 		return nmc_property_vlan_set_prio_map (setting, prop, val, NM_VLAN_INGRESS_MAP, error);
3152 	}
3153 	
3154 	static gboolean
3155 	nmc_property_vlan_set_egress_priority_map (NMSetting *setting, const char *prop, const char *val, GError **error)
3156 	{
3157 		return nmc_property_vlan_set_prio_map (setting, prop, val, NM_VLAN_EGRESS_MAP, error);
3158 	}
3159 	
3160 	static gboolean
3161 	nmc_property_vlan_remove_idx_ingress_priority_map (NMSetting *setting,
3162 	                                                   const char *prop,
3163 	                                                   const char *option,
3164 	                                                   guint32 idx,
3165 	                                                   GError **error)
3166 	{
3167 		return nmc_property_vlan_remove_prio_map (setting, prop, idx, NM_VLAN_INGRESS_MAP, error);
3168 	}
3169 	
3170 	static gboolean
3171 	nmc_property_vlan_remove_idx_egress_priority_map (NMSetting *setting,
3172 	                                                  const char *prop,
3173 	                                                  const char *option,
3174 	                                                  guint32 idx,
3175 	                                                  GError **error)
3176 	{
3177 		return nmc_property_vlan_remove_prio_map (setting, prop, idx, NM_VLAN_EGRESS_MAP, error);
3178 	}
3179 	
3180 	/* --- NM_SETTING_VPN_SETTING_NAME property setter functions --- */
3181 	/* 'data' */
3182 	DEFINE_SETTER_OPTIONS (nmc_property_vpn_set_data,
3183 	                       NM_SETTING_VPN,
3184 	                       NMSettingVPN,
3185 	                       nm_setting_vpn_add_data_item,
3186 	                       NULL,
3187 	                       NULL)
3188 	DEFINE_REMOVER_OPTION (nmc_property_vpn_remove_option_data,
3189 	                       NM_SETTING_VPN,
3190 	                       nm_setting_vpn_remove_data_item)
3191 	
3192 	/* 'secrets' */
3193 	DEFINE_SETTER_OPTIONS (nmc_property_vpn_set_secrets,
3194 	                       NM_SETTING_VPN,
3195 	                       NMSettingVPN,
3196 	                       nm_setting_vpn_add_secret,
3197 	                       NULL,
3198 	                       NULL)
3199 	DEFINE_REMOVER_OPTION (nmc_property_vpn_remove_option_secret,
3200 	                       NM_SETTING_VPN,
3201 	                       nm_setting_vpn_remove_secret)
3202 	
3203 	/* --- NM_SETTING_WIMAX_SETTING_NAME property setter functions --- */
3204 	/* No specific functions */
3205 	
3206 	/* --- NM_SETTING_WIRED_SETTING_NAME property setter functions --- */
3207 	#if 0
3208 	/*
3209 	 * Do not allow setting 'port' and 'duplex' for now. They are not implemented in
3210 	 * NM core, nor in ifcfg-rh plugin. Enable this when it gets done.
3211 	 */
3212 	/* 'port' */
3213 	static const char *wired_valid_ports[] = { "tp", "aui", "bnc", "mii", NULL };
3214 	
3215 	static gboolean
3216 	nmc_property_wired_set_port (NMSetting *setting, const char *prop, const char *val, GError **error)
3217 	{
3218 		return check_and_set_string (setting, prop, val, wired_valid_ports, error);
3219 	}
3220 	
3221 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wired_allowed_port, wired_valid_ports)
3222 	
3223 	/* 'duplex' */
3224 	static const char *wired_valid_duplexes[] = { "half", "full", NULL };
3225 	
3226 	static gboolean
3227 	nmc_property_wired_set_duplex (NMSetting *setting, const char *prop, const char *val, GError **error)
3228 	{
3229 		return check_and_set_string (setting, prop, val, wired_valid_duplexes, error);
3230 	}
3231 	
3232 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wired_allowed_duplex, wired_valid_duplexes)
3233 	#endif
3234 	
3235 	/* 'mac-address-blacklist' */
3236 	DEFINE_SETTER_MAC_BLACKLIST (nmc_property_wired_set_mac_address_blacklist,
3237 	                             NM_SETTING_WIRED,
3238 	                             nm_setting_wired_add_mac_blacklist_item)
3239 	DEFINE_REMOVER_INDEX (nmc_property_wired_remove_idx_mac_address_blacklist,
3240 	                      NM_SETTING_WIRED,
3241 	                      nm_setting_wired_get_num_mac_blacklist_items,
3242 	                      nm_setting_wired_remove_mac_blacklist_item)
3243 	
3244 	/* 's390-subchannels' */
3245 	static gboolean
3246 	nmc_property_wired_set_s390_subchannels (NMSetting *setting, const char *prop, const char *val, GError **error)
3247 	{
3248 		char **strv = NULL, **iter;
3249 		GPtrArray *s390_subchannels;
3250 	
3251 		//FIXME: both libnm-util and ifcfg-rh also allow two strings (3rd is optional)
3252 		strv = nmc_strsplit_set (val, " ,\t", 0);
3253 		if (g_strv_length (strv) != 3) {
3254 			g_set_error (error, 1, 0, _("'%s' is not valid; 3 strings should be provided"),
3255 			             val);
3256 			g_strfreev (strv);
3257 			return FALSE;
3258 		}
3259 	
3260 		s390_subchannels = g_ptr_array_sized_new (3);
3261 		for (iter = strv; iter && *iter; iter++)
3262 			g_ptr_array_add (s390_subchannels, *iter);
3263 	
3264 		g_object_set (setting, prop, s390_subchannels, NULL);
3265 		g_strfreev (strv);
3266 		g_ptr_array_free (s390_subchannels, TRUE);
3267 		return TRUE;
3268 	}
3269 	
3270 	static const char *
3271 	nmc_property_wired_describe_s390_subchannels (NMSetting *setting, const char *prop)
3272 	{
3273 		return _("Enter a list of three channels (comma or space separated).\n\n"
3274 		         "Example: 0.0.0e20 0.0.0e21 0.0.0e22\n");
3275 	}
3276 	
3277 	/* 's390-nettype' */
3278 	static const char *wired_valid_s390_nettypes[] = { "qeth", "lcs", "ctc", NULL };
3279 	
3280 	static gboolean
3281 	nmc_property_wired_set_s390_nettype (NMSetting *setting, const char *prop, const char *val, GError **error)
3282 	{
3283 		return check_and_set_string (setting, prop, val, wired_valid_s390_nettypes, error);
3284 	}
3285 	
3286 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wired_allowed_s390_nettype, wired_valid_s390_nettypes)
3287 	
3288 	/* 's390-options' */
3289 	DEFINE_SETTER_OPTIONS (nmc_property_wired_set_s390_options,
3290 	                       NM_SETTING_WIRED,
3291 	                       NMSettingWired,
3292 	                       nm_setting_wired_add_s390_option,
3293 	                       nm_setting_wired_get_valid_s390_options,
3294 	                       NULL)
3295 	DEFINE_REMOVER_OPTION (nmc_property_wired_remove_option_s390_options,
3296 	                       NM_SETTING_WIRED,
3297 	                       nm_setting_wired_remove_s390_option)
3298 	
3299 	static const char *
3300 	nmc_property_wired_allowed_s390_options (NMSetting *setting, const char *prop)
3301 	{
3302 		const char **valid_options;
3303 		static char *allowed_vals = NULL;
3304 	
3305 		if (G_UNLIKELY (allowed_vals == NULL)) {
3306 			valid_options = nm_setting_wired_get_valid_s390_options (NM_SETTING_WIRED (setting));
3307 			allowed_vals = g_strjoinv (", ", (char **) valid_options);
3308 		}
3309 		return allowed_vals;
3310 	}
3311 	
3312 	static const char *
3313 	nmc_property_wired_describe_s390_options (NMSetting *setting, const char *prop)
3314 	{
3315 		static char *desc = NULL;
3316 		const char **valid_options;
3317 		char *options_str;
3318 	
3319 		if (G_UNLIKELY (desc == NULL)) {
3320 			valid_options = nm_setting_wired_get_valid_s390_options (NM_SETTING_WIRED (setting));
3321 			options_str = g_strjoinv (", ", (char **) valid_options);
3322 	
3323 			desc = g_strdup_printf (_("Enter a list of S/390 options formatted as:\n"
3324 			                          "  option = <value>, option = <value>,... \n"
3325 			                          "Valid options are: %s\n"),
3326 			                        options_str);
3327 			g_free (options_str);
3328 		}
3329 		return desc;
3330 	}
3331 	
3332 	/* --- NM_SETTING_WIRELESS_SETTING_NAME property setter functions --- */
3333 	/* 'mode' */
3334 	static const char *wifi_valid_modes[] = {
3335 		NM_SETTING_WIRELESS_MODE_INFRA,
3336 		NM_SETTING_WIRELESS_MODE_ADHOC,
3337 		NM_SETTING_WIRELESS_MODE_AP,
3338 		NULL
3339 	};
3340 	
3341 	static gboolean
3342 	nmc_property_wifi_set_mode (NMSetting *setting, const char *prop, const char *val, GError **error)
3343 	{
3344 		return check_and_set_string (setting, prop, val, wifi_valid_modes, error);
3345 	}
3346 	
3347 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wifi_allowed_mode, wifi_valid_modes)
3348 	
3349 	/* 'band' */
3350 	static const char *wifi_valid_bands[] = { "a", "bg", NULL };
3351 	
3352 	static gboolean
3353 	nmc_property_wifi_set_band (NMSetting *setting, const char *prop, const char *val, GError **error)
3354 	{
3355 		return check_and_set_string (setting, prop, val, wifi_valid_bands, error);
3356 	}
3357 	
3358 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wifi_allowed_band, wifi_valid_bands)
3359 	
3360 	/* 'channel' */
3361 	static gboolean
3362 	nmc_property_wifi_set_channel (NMSetting *setting, const char *prop, const char *val, GError **error)
3363 	{
3364 		unsigned long chan_int;
3365 	
3366 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
3367 	
3368 		if (!nmc_string_to_uint (val, FALSE, 0, 0, &chan_int)) {
3369 			g_set_error (error, 1, 0, _("'%s' is not a valid channel"), val);
3370 			return FALSE;
3371 		}
3372 	
3373 		if (   !nm_utils_wifi_is_channel_valid (chan_int, "a")
3374 		    && !nm_utils_wifi_is_channel_valid (chan_int, "bg")) {
3375 			g_set_error (error, 1, 0, _("'%ld' is not a valid channel"), chan_int);
3376 			return FALSE;
3377 		}
3378 	
3379 		g_object_set (setting, prop, chan_int, NULL);
3380 		return TRUE;
3381 	}
3382 	
3383 	/* 'mac-address-blacklist' */
3384 	DEFINE_SETTER_MAC_BLACKLIST (nmc_property_wireless_set_mac_address_blacklist,
3385 	                             NM_SETTING_WIRELESS,
3386 	                             nm_setting_wireless_add_mac_blacklist_item)
3387 	DEFINE_REMOVER_INDEX (nmc_property_wireless_remove_idx_mac_address_blacklist,
3388 	                      NM_SETTING_WIRELESS,
3389 	                      nm_setting_wireless_get_num_mac_blacklist_items,
3390 	                      nm_setting_wireless_remove_mac_blacklist_item)
3391 	
3392 	/* --- NM_SETTING_WIRELESS_SECURITY_SETTING_NAME property setter functions --- */
3393 	/* 'key-mgmt' */
3394 	static const char *wifi_sec_valid_key_mgmts[] = { "none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap", NULL };
3395 	
3396 	static gboolean
3397 	nmc_property_wifi_sec_set_key_mgmt (NMSetting *setting, const char *prop, const char *val, GError **error)
3398 	{
3399 		return check_and_set_string (setting, prop, val, wifi_sec_valid_key_mgmts, error);
3400 	}
3401 	
3402 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wifi_sec_allowed_key_mgmt, wifi_sec_valid_key_mgmts)
3403 	
3404 	/* 'auth-alg' */
3405 	static const char *wifi_sec_valid_auth_algs[] = { "open", "shared", "leap", NULL };
3406 	
3407 	static gboolean
3408 	nmc_property_wifi_sec_set_auth_alg (NMSetting *setting, const char *prop, const char *val, GError **error)
3409 	{
3410 		return check_and_set_string (setting, prop, val, wifi_sec_valid_auth_algs, error);
3411 	}
3412 	
3413 	DEFINE_SETTER_STR_LIST_MULTI (check_and_add_wifi_sec_proto,
3414 	                              NM_SETTING_WIRELESS_SECURITY,
3415 	                              nm_setting_wireless_security_add_proto)
3416 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wifi_sec_allowed_auth_alg, wifi_sec_valid_auth_algs)
3417 	
3418 	/* 'proto' */
3419 	static const char *wifi_sec_valid_protos[] = { "wpa", "rsn", NULL };
3420 	
3421 	static gboolean
3422 	nmc_property_wifi_sec_set_proto (NMSetting *setting, const char *prop, const char *val, GError **error)
3423 	{
3424 		return check_and_add_wifi_sec_proto (setting, prop, val, wifi_sec_valid_protos, error);
3425 	}
3426 	DEFINE_REMOVER_INDEX (nmc_property_wifi_sec_remove_idx_proto,
3427 	                      NM_SETTING_WIRELESS_SECURITY,
3428 	                      nm_setting_wireless_security_get_num_protos,
3429 	                      nm_setting_wireless_security_remove_proto)
3430 	
3431 	DEFINE_SETTER_STR_LIST_MULTI (check_and_add_wifi_sec_pairwise,
3432 	                              NM_SETTING_WIRELESS_SECURITY,
3433 	                              nm_setting_wireless_security_add_pairwise)
3434 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wifi_sec_allowed_proto, wifi_sec_valid_protos)
3435 	
3436 	/* 'pairwise' */
3437 	static const char *wifi_sec_valid_pairwises[] = { "tkip", "ccmp", NULL };
3438 	
3439 	static gboolean
3440 	nmc_property_wifi_sec_set_pairwise (NMSetting *setting, const char *prop, const char *val, GError **error)
3441 	{
3442 		return check_and_add_wifi_sec_pairwise (setting, prop, val, wifi_sec_valid_pairwises, error);
3443 	}
3444 	DEFINE_REMOVER_INDEX (nmc_property_wifi_sec_remove_idx_pairwise,
3445 	                      NM_SETTING_WIRELESS_SECURITY,
3446 	                      nm_setting_wireless_security_get_num_pairwise,
3447 	                      nm_setting_wireless_security_remove_pairwise)
3448 	
3449 	DEFINE_SETTER_STR_LIST_MULTI (check_and_add_wifi_sec_group,
3450 	                              NM_SETTING_WIRELESS_SECURITY,
3451 	                              nm_setting_wireless_security_add_group)
3452 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wifi_sec_allowed_pairwise, wifi_sec_valid_pairwises)
3453 	
3454 	/* 'group' */
3455 	static const char *wifi_sec_valid_groups[] = { "wep40", "wep104", "tkip", "ccmp", NULL };
3456 	
3457 	static gboolean
3458 	nmc_property_wifi_sec_set_group (NMSetting *setting, const char *prop, const char *val, GError **error)
3459 	{
3460 		return check_and_add_wifi_sec_group (setting, prop, val, wifi_sec_valid_groups, error);
3461 	}
3462 	DEFINE_REMOVER_INDEX (nmc_property_wifi_sec_remove_idx_group,
3463 	                      NM_SETTING_WIRELESS_SECURITY,
3464 	                      nm_setting_wireless_security_get_num_groups,
3465 	                      nm_setting_wireless_security_remove_group)
3466 	DEFINE_ALLOWED_VAL_FUNC (nmc_property_wifi_sec_allowed_group, wifi_sec_valid_groups)
3467 	
3468 	/* 'wep-key' */
3469 	static gboolean
3470 	nmc_property_wifi_set_wep_key (NMSetting *setting, const char *prop, const char *val, GError **error)
3471 	{
3472 		NMWepKeyType type;
3473 	
3474 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
3475 	
3476 		if (nm_utils_wep_key_valid (val, NM_WEP_KEY_TYPE_KEY)) {
3477 			type = NM_WEP_KEY_TYPE_KEY;
3478 			fprintf (stdout, _("WEP key is guessed to be of '%s'\n"), wep_key_type_to_string (type));
3479 		} else if (nm_utils_wep_key_valid (val, NM_WEP_KEY_TYPE_PASSPHRASE)) {
3480 			type = NM_WEP_KEY_TYPE_PASSPHRASE;
3481 			fprintf (stdout, _("WEP key is guessed to be of '%s'\n"), wep_key_type_to_string (type));
3482 		} else {
3483 			g_set_error (error, 1, 0, _("'%s' is not valid"), val);
3484 			return FALSE;
3485 		}
3486 	
3487 		g_object_set (setting, prop, val, NULL);
3488 		g_object_set (setting, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, type, NULL);
3489 		return TRUE;
3490 	}
3491 	
3492 	/* 'wep-key-type' */
3493 	static gboolean
3494 	nmc_property_wifi_set_wep_key_type (NMSetting *setting, const char *prop, const char *val, GError **error)
3495 	{
3496 		unsigned long  type_int;
3497 		const char *valid_wep_types[] = { "unknown", "key", "passphrase", NULL };
3498 		const char *type_str = NULL;
3499 		NMWepKeyType type = NM_WEP_KEY_TYPE_UNKNOWN;
3500 	
3501 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
3502 	
3503 		if (!nmc_string_to_uint (val, TRUE, 0, 2, &type_int)) {
3504 			if (!(type_str = nmc_string_is_valid (val, valid_wep_types, NULL))) {
3505 				g_set_error (error, 1, 0, _("'%s' not among [0 (unknown), 1 (key), 2 (passphrase)]"), val);
3506 				return FALSE;
3507 			}
3508 			if (type_str == valid_wep_types[1])
3509 				type = NM_WEP_KEY_TYPE_KEY;
3510 			else if (type_str == valid_wep_types[2])
3511 				type = NM_WEP_KEY_TYPE_PASSPHRASE;
3512 		} else
3513 			type = (NMWepKeyType) type_int;
3514 	
3515 		g_object_set (setting, prop, type, NULL);
3516 		return TRUE;
3517 	}
3518 	
3519 	static const char *
3520 	nmc_property_wifi_describe_wep_key_type (NMSetting *setting, const char *prop)
3521 	{
3522 		static char *desc = NULL;
3523 	
3524 		if (G_UNLIKELY (desc == NULL)) {
3525 			desc = g_strdup_printf (_("Enter the type of WEP keys. The accepted values are: "
3526 			                          "0 or unknown, 1 or key, and 2 or passphrase.\n"));
3527 		}
3528 		return desc;
3529 	}
3530 	
3531 	/* 'psk' */
3532 	static gboolean
3533 	nmc_property_wifi_set_psk (NMSetting *setting, const char *prop, const char *val, GError **error)
3534 	{
3535 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
3536 	
3537 		if (!nm_utils_wpa_psk_valid (val)) {
3538 			g_set_error (error, 1, 0, _("'%s' is not a valid PSK"), val);
3539 			return FALSE;
3540 		}
3541 		g_object_set (setting, prop, val, NULL);
3542 		return TRUE;
3543 	}
3544 	
3545 	/*----------------------------------------------------------------------------*/
3546 	
3547 	static void
3548 	nmc_add_prop_funcs (char *key,
3549 	                    NmcPropertyGetFunc get_func,
3550 	                    NmcPropertySetFunc set_func,
3551 	                    NmcPropertyRemoveFunc remove_func,
3552 	                    NmcPropertyDescribeFunc describe_func,
3553 	                    NmcPropertyValuesFunc values_func,
3554 	                    NmcPropertyOut2InFunc out2in_func)
3555 	{
3556 		NmcPropertyFuncs *item = g_malloc0 (sizeof (NmcPropertyFuncs));
3557 		item->get_func = get_func;
3558 		item->set_func = set_func;
3559 		item->remove_func = remove_func;
3560 		item->describe_func = describe_func;
3561 		item->values_func = values_func;
3562 		item->out2in_func = out2in_func;
3563 	
3564 		g_hash_table_insert (nmc_properties, key, item);
3565 	}
3566 	
3567 	/* concatenate setting name and property name */
3568 	#define GLUE(A,B) (g_strconcat ((NM_SETTING_##A##_SETTING_NAME),(NM_SETTING_##A##_##B), NULL))
3569 	void
3570 	nmc_properties_init (void)
3571 	{
3572 		if (G_LIKELY (nmc_properties))
3573 			return;
3574 	
3575 		/* create properties hash table */
3576 		nmc_properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
3577 	
3578 		/* Add editable properties for NM_SETTING_802_1X_SETTING_NAME */
3579 		nmc_add_prop_funcs (GLUE (802_1X, EAP),
3580 		                    nmc_property_802_1X_get_eap,
3581 		                    nmc_property_802_1X_set_eap,
3582 		                    nmc_property_802_1X_remove_idx_eap,
3583 		                    NULL,
3584 		                    NULL,
3585 		                    NULL);
3586 		nmc_add_prop_funcs (GLUE (802_1X, IDENTITY),
3587 		                    nmc_property_802_1X_get_identity,
3588 		                    nmc_property_set_string,
3589 		                    NULL,
3590 		                    NULL,
3591 		                    NULL,
3592 		                    NULL);
3593 		nmc_add_prop_funcs (GLUE (802_1X, ANONYMOUS_IDENTITY),
3594 		                    nmc_property_802_1X_get_anonymous_identity,
3595 		                    nmc_property_set_string,
3596 		                    NULL,
3597 		                    NULL,
3598 		                    NULL,
3599 		                    NULL);
3600 		nmc_add_prop_funcs (GLUE (802_1X, PAC_FILE),
3601 		                    nmc_property_802_1X_get_pac_file,
3602 		                    nmc_property_set_string,
3603 		                    NULL,
3604 		                    NULL,
3605 		                    NULL,
3606 		                    NULL);
3607 		nmc_add_prop_funcs (GLUE (802_1X, CA_CERT),
3608 		                    nmc_property_802_1X_get_ca_cert,
3609 		                    nmc_property_802_1X_set_ca_cert,
3610 		                    NULL,
3611 		                    NULL,
3612 		                    NULL,
3613 		                    NULL);
3614 		nmc_add_prop_funcs (GLUE (802_1X, CA_PATH),
3615 		                    nmc_property_802_1X_get_ca_path,
3616 	                            nmc_property_set_string,
3617 		                    NULL,
3618 		                    NULL,
3619 		                    NULL,
3620 		                    NULL);
3621 		nmc_add_prop_funcs (GLUE (802_1X, SUBJECT_MATCH),
3622 		                    nmc_property_802_1X_get_subject_match,
3623 		                    nmc_property_set_string,
3624 		                    NULL,
3625 		                    NULL,
3626 		                    NULL,
3627 		                    NULL);
3628 		nmc_add_prop_funcs (GLUE (802_1X, ALTSUBJECT_MATCHES),
3629 		                    nmc_property_802_1X_get_altsubject_matches,
3630 		                    nmc_property_802_1X_set_altsubject_matches,
3631 		                    nmc_property_802_1X_remove_idx_altsubject_matches,
3632 		                    NULL,
3633 		                    NULL,
3634 		                    NULL);
3635 		nmc_add_prop_funcs (GLUE (802_1X, CLIENT_CERT),
3636 		                    nmc_property_802_1X_get_client_cert,
3637 		                    nmc_property_802_1X_set_client_cert,
3638 		                    NULL,
3639 		                    NULL,
3640 		                    NULL,
3641 		                    NULL);
3642 		nmc_add_prop_funcs (GLUE (802_1X, PHASE1_PEAPVER),
3643 		                    nmc_property_802_1X_get_phase1_peapver,
3644 		                    nmc_property_802_1X_set_phase1_peapver,
3645 		                    NULL,
3646 		                    NULL,
3647 		                    nmc_property_802_1X_allowed_phase1_peapver,
3648 		                    NULL);
3649 		nmc_add_prop_funcs (GLUE (802_1X, PHASE1_PEAPLABEL),
3650 		                    nmc_property_802_1X_get_phase1_peaplabel,
3651 		                    nmc_property_802_1X_set_phase1_peaplabel,
3652 		                    NULL,
3653 		                    NULL,
3654 		                    nmc_property_802_1X_allowed_phase1_peaplabel,
3655 		                    NULL);
3656 		nmc_add_prop_funcs (GLUE (802_1X, PHASE1_FAST_PROVISIONING),
3657 		                    nmc_property_802_1X_get_phase1_fast_provisioning,
3658 		                    nmc_property_802_1X_set_phase1_fast_provisioning,
3659 		                    NULL,
3660 		                    NULL,
3661 		                    nmc_property_802_1X_allowed_phase1_fast_provisioning,
3662 		                    NULL);
3663 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_AUTH),
3664 		                    nmc_property_802_1X_get_phase2_auth,
3665 		                    nmc_property_802_1X_set_phase2_auth,
3666 		                    NULL,
3667 		                    NULL,
3668 		                    nmc_property_802_1X_allowed_phase2_auth,
3669 		                    NULL);
3670 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_AUTHEAP),
3671 		                    nmc_property_802_1X_get_phase2_autheap,
3672 		                    nmc_property_802_1X_set_phase2_autheap,
3673 		                    NULL,
3674 		                    NULL,
3675 		                    nmc_property_802_1X_allowed_phase2_autheap,
3676 		                    NULL);
3677 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_CA_CERT),
3678 		                    nmc_property_802_1X_get_phase2_ca_cert,
3679 		                    nmc_property_802_1X_set_phase2_ca_cert,
3680 		                    NULL,
3681 		                    NULL,
3682 		                    NULL,
3683 		                    NULL);
3684 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_CA_PATH),
3685 		                    nmc_property_802_1X_get_phase2_ca_path,
3686 		                    nmc_property_set_string,
3687 		                    NULL,
3688 		                    NULL,
3689 		                    NULL,
3690 		                    NULL);
3691 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_SUBJECT_MATCH),
3692 		                    nmc_property_802_1X_get_phase2_subject_match,
3693 		                    nmc_property_set_string,
3694 		                    NULL,
3695 		                    NULL,
3696 		                    NULL,
3697 		                    NULL);
3698 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_ALTSUBJECT_MATCHES),
3699 		                    nmc_property_802_1X_get_phase2_altsubject_matches,
3700 		                    nmc_property_802_1X_set_phase2_altsubject_matches,
3701 		                    nmc_property_802_1X_remove_idx_phase2_altsubject_matches,
3702 		                    NULL,
3703 		                    NULL,
3704 		                    NULL);
3705 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_CLIENT_CERT),
3706 		                    nmc_property_802_1X_get_phase2_client_cert,
3707 		                    nmc_property_802_1X_set_phase2_client_cert,
3708 		                    NULL,
3709 		                    NULL,
3710 		                    NULL,
3711 		                    NULL);
3712 		nmc_add_prop_funcs (GLUE (802_1X, PASSWORD),
3713 		                    nmc_property_802_1X_get_password,
3714 		                    nmc_property_set_string,
3715 		                    NULL,
3716 		                    NULL,
3717 		                    NULL,
3718 		                    NULL);
3719 		nmc_add_prop_funcs (GLUE (802_1X, PASSWORD_FLAGS),
3720 		                    nmc_property_802_1X_get_password_flags,
3721 		                    nmc_property_set_flags,
3722 		                    NULL,
3723 		                    NULL,
3724 		                    NULL,
3725 		                    nmc_property_out2in_cut_paren);
3726 		nmc_add_prop_funcs (GLUE (802_1X, PASSWORD_RAW),
3727 		                    nmc_property_802_1X_get_password_raw,
3728 		                    nmc_property_802_1X_set_password_raw,
3729 		                    NULL,
3730 		                    nmc_property_802_1X_describe_password_raw,
3731 		                    NULL,
3732 		                    NULL);
3733 		nmc_add_prop_funcs (GLUE (802_1X, PASSWORD_RAW_FLAGS),
3734 		                    nmc_property_802_1X_get_password_raw_flags,
3735 		                    nmc_property_set_flags,
3736 		                    NULL,
3737 		                    NULL,
3738 		                    NULL,
3739 		                    nmc_property_out2in_cut_paren);
3740 		nmc_add_prop_funcs (GLUE (802_1X, PRIVATE_KEY),
3741 		                    nmc_property_802_1X_get_private_key,
3742 		                    nmc_property_802_1X_set_private_key,
3743 		                    NULL,
3744 		                    nmc_property_802_1X_describe_private_key,
3745 		                    NULL,
3746 		                    NULL);
3747 		nmc_add_prop_funcs (GLUE (802_1X, PRIVATE_KEY_PASSWORD),
3748 		                    nmc_property_802_1X_get_private_key_password,
3749 		                    nmc_property_set_string,
3750 		                    NULL,
3751 		                    NULL,
3752 		                    NULL,
3753 		                    NULL);
3754 		nmc_add_prop_funcs (GLUE (802_1X, PRIVATE_KEY_PASSWORD_FLAGS),
3755 		                    nmc_property_802_1X_get_private_key_password_flags,
3756 		                    nmc_property_set_flags,
3757 		                    NULL,
3758 		                    NULL,
3759 		                    NULL,
3760 		                    nmc_property_out2in_cut_paren);
3761 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_PRIVATE_KEY),
3762 		                    nmc_property_802_1X_get_phase2_private_key,
3763 		                    nmc_property_802_1X_set_phase2_private_key,
3764 		                    NULL,
3765 		                    nmc_property_802_1X_describe_private_key,
3766 		                    NULL,
3767 		                    NULL);
3768 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_PRIVATE_KEY_PASSWORD),
3769 		                    nmc_property_802_1X_get_phase2_private_key_password,
3770 		                    nmc_property_set_string,
3771 		                    NULL,
3772 		                    NULL,
3773 		                    NULL,
3774 		                    NULL);
3775 		nmc_add_prop_funcs (GLUE (802_1X, PHASE2_PRIVATE_KEY_PASSWORD_FLAGS),
3776 		                    nmc_property_802_1X_get_phase2_private_key_password_flags,
3777 		                    nmc_property_set_flags,
3778 		                    NULL,
3779 		                    NULL,
3780 		                    NULL,
3781 		                    nmc_property_out2in_cut_paren);
3782 		nmc_add_prop_funcs (GLUE (802_1X, PIN),
3783 		                    nmc_property_802_1X_get_pin,
3784 		                    nmc_property_set_string,
3785 		                    NULL,
3786 		                    NULL,
3787 		                    NULL,
3788 		                    NULL);
3789 		nmc_add_prop_funcs (GLUE (802_1X, PIN_FLAGS),
3790 		                    nmc_property_802_1X_get_pin_flags,
3791 		                    nmc_property_set_flags,
3792 		                    NULL,
3793 		                    NULL,
3794 		                    NULL,
3795 		                    nmc_property_out2in_cut_paren);
3796 		nmc_add_prop_funcs (GLUE (802_1X, SYSTEM_CA_CERTS),
3797 		                    nmc_property_802_1X_get_system_ca_certs,
3798 		                    nmc_property_set_bool,
3799 		                    NULL,
3800 		                    NULL,
3801 		                    NULL,
3802 		                    NULL);
3803 	
3804 		/* Add editable properties for NM_SETTING_ADSL_SETTING_NAME */
3805 		nmc_add_prop_funcs (GLUE (ADSL, USERNAME),
3806 		                    nmc_property_adsl_get_username,
3807 		                    nmc_property_set_string,
3808 		                    NULL,
3809 		                    NULL,
3810 		                    NULL,
3811 		                    NULL);
3812 		nmc_add_prop_funcs (GLUE (ADSL, PASSWORD),
3813 		                    nmc_property_adsl_get_password,
3814 		                    nmc_property_set_string,
3815 		                    NULL,
3816 		                    NULL,
3817 		                    NULL,
3818 		                    NULL);
3819 		nmc_add_prop_funcs (GLUE (ADSL, PASSWORD_FLAGS),
3820 		                    nmc_property_adsl_get_password_flags,
3821 		                    nmc_property_set_flags,
3822 		                    NULL,
3823 		                    NULL,
3824 		                    NULL,
3825 		                    nmc_property_out2in_cut_paren);
3826 		nmc_add_prop_funcs (GLUE (ADSL, PROTOCOL),
3827 		                    nmc_property_adsl_get_protocol,
3828 		                    nmc_property_adsl_set_protocol,
3829 		                    NULL,
3830 		                    NULL,
3831 		                    nmc_property_adsl_allowed_protocol,
3832 		                    NULL);
3833 		nmc_add_prop_funcs (GLUE (ADSL, ENCAPSULATION),
3834 		                    nmc_property_adsl_get_encapsulation,
3835 		                    nmc_property_adsl_set_encapsulation,
3836 		                    NULL,
3837 		                    NULL,
3838 		                    nmc_property_adsl_allowed_encapsulation,
3839 		                    NULL);
3840 		nmc_add_prop_funcs (GLUE (ADSL, VPI),
3841 		                    nmc_property_adsl_get_vpi,
3842 		                    nmc_property_set_uint,
3843 		                    NULL,
3844 		                    NULL,
3845 		                    NULL,
3846 		                    NULL);
3847 		nmc_add_prop_funcs (GLUE (ADSL, VCI),
3848 		                    nmc_property_adsl_get_vci,
3849 		                    nmc_property_set_uint,
3850 		                    NULL,
3851 		                    NULL,
3852 		                    NULL,
3853 		                    NULL);
3854 	
3855 		/* Add editable properties for NM_SETTING_BLUETOOTH_SETTING_NAME */
3856 		nmc_add_prop_funcs (GLUE (BLUETOOTH, BDADDR),
3857 		                    nmc_property_bluetooth_get_bdaddr,
3858 		                    nmc_property_set_mac,
3859 		                    NULL,
3860 		                    NULL,
3861 		                    NULL,
3862 		                    NULL);
3863 		nmc_add_prop_funcs (GLUE (BLUETOOTH, TYPE),
3864 		                    nmc_property_bluetooth_get_type,
3865 		                    nmc_property_bluetooth_set_type,
3866 		                    NULL,
3867 		                    NULL,
3868 		                    NULL,
3869 		                    NULL);
3870 	
3871 		/* Add editable properties for NM_SETTING_BOND_SETTING_NAME */
3872 		nmc_add_prop_funcs (GLUE (BOND, INTERFACE_NAME),
3873 		                    nmc_property_bond_get_interface_name,
3874 		                    nmc_property_set_ifname,
3875 		                    NULL,
3876 		                    NULL,
3877 		                    NULL,
3878 		                    NULL);
3879 		nmc_add_prop_funcs (GLUE (BOND, OPTIONS),
3880 		                    nmc_property_bond_get_options,
3881 		                    nmc_property_bond_set_options,
3882 		                    nmc_property_bond_remove_option_options,
3883 		                    nmc_property_bond_describe_options,
3884 		                    nmc_property_bond_allowed_options,
3885 		                    NULL);
3886 	
3887 		/* Add editable properties for NM_SETTING_BRIDGE_SETTING_NAME */
3888 		nmc_add_prop_funcs (GLUE (BRIDGE, INTERFACE_NAME),
3889 		                    nmc_property_bridge_get_interface_name,
3890 		                    nmc_property_set_ifname,
3891 		                    NULL,
3892 		                    NULL,
3893 		                    NULL,
3894 		                    NULL);
3895 		nmc_add_prop_funcs (GLUE (BRIDGE, STP),
3896 		                    nmc_property_bridge_get_stp,
3897 		                    nmc_property_set_bool,
3898 		                    NULL,
3899 		                    NULL,
3900 		                    NULL,
3901 		                    NULL);
3902 		nmc_add_prop_funcs (GLUE (BRIDGE, PRIORITY),
3903 		                    nmc_property_bridge_get_priority,
3904 		                    nmc_property_set_uint,
3905 		                    NULL,
3906 		                    NULL,
3907 		                    NULL,
3908 		                    NULL);
3909 		nmc_add_prop_funcs (GLUE (BRIDGE, FORWARD_DELAY),
3910 		                    nmc_property_bridge_get_forward_delay,
3911 		                    nmc_property_set_uint,
3912 		                    NULL,
3913 		                    NULL,
3914 		                    NULL,
3915 		                    NULL);
3916 		nmc_add_prop_funcs (GLUE (BRIDGE, HELLO_TIME),
3917 		                    nmc_property_bridge_get_hello_time,
3918 		                    nmc_property_set_uint,
3919 		                    NULL,
3920 		                    NULL,
3921 		                    NULL,
3922 		                    NULL);
3923 		nmc_add_prop_funcs (GLUE (BRIDGE, MAX_AGE),
3924 		                    nmc_property_bridge_get_max_age,
3925 		                    nmc_property_set_uint,
3926 		                    NULL,
3927 		                    NULL,
3928 		                    NULL,
3929 		                    NULL);
3930 		nmc_add_prop_funcs (GLUE (BRIDGE, AGEING_TIME),
3931 		                    nmc_property_bridge_get_ageing_time,
3932 		                    nmc_property_set_uint,
3933 		                    NULL,
3934 		                    NULL,
3935 		                    NULL,
3936 		                    NULL);
3937 	
3938 		/* Add editable properties for NM_SETTING_BRIDGE_PORT_SETTING_NAME */
3939 		nmc_add_prop_funcs (GLUE (BRIDGE_PORT, PRIORITY),
3940 		                    nmc_property_bridge_port_get_priority,
3941 		                    nmc_property_set_uint,
3942 		                    NULL,
3943 		                    NULL,
3944 		                    NULL,
3945 		                    NULL);
3946 		nmc_add_prop_funcs (GLUE (BRIDGE_PORT, PATH_COST),
3947 		                    nmc_property_bridge_port_get_path_cost,
3948 		                    nmc_property_set_uint,
3949 		                    NULL,
3950 		                    NULL,
3951 		                    NULL,
3952 		                    NULL);
3953 		nmc_add_prop_funcs (GLUE (BRIDGE_PORT, HAIRPIN_MODE),
3954 		                    nmc_property_bridge_port_get_hairpin_mode,
3955 		                    nmc_property_set_bool,
3956 		                    NULL,
3957 		                    NULL,
3958 		                    NULL,
3959 		                    NULL);
3960 	
3961 		/* Add editable properties for NM_SETTING_CDMA_SETTING_NAME */
3962 		nmc_add_prop_funcs (GLUE (CDMA, NUMBER),
3963 		                    nmc_property_cdma_get_number,
3964 		                    nmc_property_set_string,
3965 		                    NULL,
3966 		                    NULL,
3967 		                    NULL,
3968 		                    NULL);
3969 		nmc_add_prop_funcs (GLUE (CDMA, USERNAME),
3970 		                    nmc_property_cdma_get_username,
3971 		                    nmc_property_set_string,
3972 		                    NULL,
3973 		                    NULL,
3974 		                    NULL,
3975 		                    NULL);
3976 		nmc_add_prop_funcs (GLUE (CDMA, PASSWORD),
3977 		                    nmc_property_cdma_get_password,
3978 		                    nmc_property_set_string,
3979 		                    NULL,
3980 		                    NULL,
3981 		                    NULL,
3982 		                    NULL);
3983 		nmc_add_prop_funcs (GLUE (CDMA, PASSWORD_FLAGS),
3984 		                    nmc_property_cdma_get_password_flags,
3985 		                    nmc_property_set_flags,
3986 		                    NULL,
3987 		                    NULL,
3988 		                    NULL,
3989 		                    nmc_property_out2in_cut_paren);
3990 	
3991 		/* Add editable properties for NM_SETTING_CONNECTION_SETTING_NAME */
3992 		nmc_add_prop_funcs (GLUE (CONNECTION, ID),
3993 		                    nmc_property_connection_get_id,
3994 		                    nmc_property_set_string,
3995 		                    NULL,
3996 		                    NULL,
3997 		                    NULL,
3998 		                    NULL);
3999 		nmc_add_prop_funcs (GLUE (CONNECTION, UUID),
4000 		                    nmc_property_connection_get_uuid,
4001 		                    NULL, /* forbid setting/removing UUID */
4002 		                    NULL,
4003 		                    NULL,
4004 		                    NULL,
4005 		                    NULL);
4006 		nmc_add_prop_funcs (GLUE (CONNECTION, INTERFACE_NAME),
4007 		                    nmc_property_connection_get_interface_name,
4008 		                    nmc_property_set_ifname,
4009 		                    NULL,
4010 		                    NULL,
4011 		                    NULL,
4012 		                    NULL);
4013 		nmc_add_prop_funcs (GLUE (CONNECTION, TYPE),
4014 		                    nmc_property_connection_get_type,
4015 		                    NULL, /* read-only */
4016 		                    NULL,
4017 		                    NULL,
4018 		                    NULL,
4019 		                    NULL);
4020 		nmc_add_prop_funcs (GLUE (CONNECTION, AUTOCONNECT),
4021 		                    nmc_property_connection_get_autoconnect,
4022 		                    nmc_property_set_bool,
4023 		                    NULL,
4024 		                    NULL,
4025 		                    NULL,
4026 		                    NULL);
4027 		nmc_add_prop_funcs (GLUE (CONNECTION, TIMESTAMP),
4028 		                    nmc_property_connection_get_timestamp,
4029 		                    NULL, /* read-only */
4030 		                    NULL,
4031 		                    NULL,
4032 		                    NULL,
4033 		                    NULL);
4034 		nmc_add_prop_funcs (GLUE (CONNECTION, READ_ONLY),
4035 		                    nmc_property_connection_get_read_only,
4036 		                    NULL, /* 'read-only' is read-only :-) */
4037 		                    NULL,
4038 		                    NULL,
4039 		                    NULL,
4040 		                    NULL);
4041 		nmc_add_prop_funcs (GLUE (CONNECTION, PERMISSIONS),
4042 		                    nmc_property_connection_get_permissions,
4043 		                    nmc_property_connection_set_permissions,
4044 		                    nmc_property_connection_remove_idx_permissions,
4045 		                    nmc_property_connection_describe_permissions,
4046 		                    NULL,
4047 		                    NULL);
4048 		nmc_add_prop_funcs (GLUE (CONNECTION, ZONE),
4049 		                    nmc_property_connection_get_zone,
4050 		                    nmc_property_set_string,
4051 		                    NULL,
4052 		                    NULL,
4053 		                    NULL,
4054 		                    NULL);
4055 		nmc_add_prop_funcs (GLUE (CONNECTION, MASTER),
4056 		                    nmc_property_connection_get_master,
4057 		                    nmc_property_con_set_master,
4058 		                    NULL,
4059 		                    NULL,
4060 		                    NULL,
4061 		                    NULL);
4062 		nmc_add_prop_funcs (GLUE (CONNECTION, SLAVE_TYPE),
4063 		                    nmc_property_connection_get_slave_type,
4064 		                    nmc_property_con_set_slave_type,
4065 		                    NULL,
4066 		                    NULL,
4067 		                    nmc_property_con_allowed_slave_type,
4068 		                    NULL);
4069 		nmc_add_prop_funcs (GLUE (CONNECTION, SECONDARIES),
4070 		                    nmc_property_connection_get_secondaries,
4071 		                    nmc_property_connection_set_secondaries,
4072 		                    nmc_property_connection_remove_idx_secondaries,
4073 		                    NULL,
4074 		                    NULL,
4075 		                    NULL);
4076 		nmc_add_prop_funcs (GLUE (CONNECTION, GATEWAY_PING_TIMEOUT),
4077 		                    nmc_property_connection_get_gateway_ping_timeout,
4078 		                    nmc_property_set_uint,
4079 		                    NULL,
4080 		                    NULL,
4081 		                    NULL,
4082 		                    NULL);
4083 	
4084 		/* Add editable properties for NM_SETTING_GSM_SETTING_NAME */
4085 		nmc_add_prop_funcs (GLUE (GSM, NUMBER),
4086 		                    nmc_property_gsm_get_number,
4087 		                    nmc_property_set_string,
4088 		                    NULL,
4089 		                    NULL,
4090 		                    NULL,
4091 		                    NULL);
4092 		nmc_add_prop_funcs (GLUE (GSM, USERNAME),
4093 		                    nmc_property_gsm_get_username,
4094 		                    nmc_property_set_string,
4095 		                    NULL,
4096 		                    NULL,
4097 		                    NULL,
4098 		                    NULL);
4099 		nmc_add_prop_funcs (GLUE (GSM, PASSWORD),
4100 		                    nmc_property_gsm_get_password,
4101 		                    nmc_property_set_string,
4102 		                    NULL,
4103 		                    NULL,
4104 		                    NULL,
4105 		                    NULL);
4106 		nmc_add_prop_funcs (GLUE (GSM, PASSWORD_FLAGS),
4107 		                    nmc_property_gsm_get_password_flags,
4108 		                    nmc_property_set_flags,
4109 		                    NULL,
4110 		                    NULL,
4111 		                    NULL,
4112 		                    nmc_property_out2in_cut_paren);
4113 		nmc_add_prop_funcs (GLUE (GSM, APN),
4114 		                    nmc_property_gsm_get_apn,
4115 		                    nmc_property_set_string,
4116 		                    NULL,
4117 		                    NULL,
4118 		                    NULL,
4119 		                    NULL);
4120 		nmc_add_prop_funcs (GLUE (GSM, NETWORK_ID),
4121 		                    nmc_property_gsm_get_network_id,
4122 		                    nmc_property_set_string,
4123 		                    NULL,
4124 		                    NULL,
4125 		                    NULL,
4126 		                    NULL);
4127 		nmc_add_prop_funcs (GLUE (GSM, NETWORK_TYPE),
4128 		                    nmc_property_gsm_get_network_type,
4129 		                    nmc_property_set_int,
4130 		                    NULL,
4131 		                    NULL,
4132 		                    NULL,
4133 		                    NULL);
4134 		nmc_add_prop_funcs (GLUE (GSM, ALLOWED_BANDS),
4135 		                    nmc_property_gsm_get_allowed_bands,
4136 		                    nmc_property_set_uint,
4137 		                    NULL,
4138 		                    NULL,
4139 		                    NULL,
4140 		                    nmc_property_out2in_cut_paren);
4141 		nmc_add_prop_funcs (GLUE (GSM, PIN),
4142 		                    nmc_property_gsm_get_pin,
4143 		                    nmc_property_set_string,
4144 		                    NULL,
4145 		                    NULL,
4146 		                    NULL,
4147 		                    NULL);
4148 		nmc_add_prop_funcs (GLUE (GSM, PIN_FLAGS),
4149 		                    nmc_property_gsm_get_pin_flags,
4150 		                    nmc_property_set_flags,
4151 		                    NULL,
4152 		                    NULL,
4153 		                    NULL,
4154 		                    nmc_property_out2in_cut_paren);
4155 		nmc_add_prop_funcs (GLUE (GSM, HOME_ONLY),
4156 		                    nmc_property_gsm_get_home_only,
4157 		                    nmc_property_set_bool,
4158 		                    NULL,
4159 		                    NULL,
4160 		                    NULL,
4161 		                    NULL);
4162 	
4163 		/* Add editable properties for NM_SETTING_INFINIBAND_SETTING_NAME */
4164 		nmc_add_prop_funcs (GLUE (INFINIBAND, MAC_ADDRESS),
4165 		                    nmc_property_ib_get_mac_address,
4166 		                    nmc_property_ib_set_mac,
4167 		                    NULL,
4168 		                    NULL,
4169 		                    NULL,
4170 		                    NULL);
4171 		nmc_add_prop_funcs (GLUE (INFINIBAND, MTU),
4172 		                    nmc_property_ib_get_mtu,
4173 		                    nmc_property_set_mtu,
4174 		                    NULL,
4175 		                    NULL,
4176 		                    NULL,
4177 		                    NULL);
4178 		nmc_add_prop_funcs (GLUE (INFINIBAND, TRANSPORT_MODE),
4179 		                    nmc_property_ib_get_transport_mode,
4180 		                    nmc_property_ib_set_transport_mode,
4181 		                    NULL,
4182 		                    NULL,
4183 		                    nmc_property_ib_allowed_transport_mode,
4184 		                    NULL);
4185 		nmc_add_prop_funcs (GLUE (INFINIBAND, P_KEY),
4186 		                    nmc_property_ib_get_p_key,
4187 		                    nmc_property_ib_set_p_key,
4188 		                    NULL,
4189 		                    NULL,
4190 		                    NULL,
4191 		                    NULL);
4192 		nmc_add_prop_funcs (GLUE (INFINIBAND, PARENT),
4193 		                    nmc_property_ib_get_parent,
4194 		                    nmc_property_set_ifname,
4195 		                    NULL,
4196 		                    NULL,
4197 		                    NULL,
4198 		                    NULL);
4199 	
4200 		/* Add editable properties for NM_SETTING_IP4_CONFIG_SETTING_NAME */
4201 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, METHOD),
4202 		                    nmc_property_ipv4_get_method,
4203 		                    nmc_property_ipv4_set_method,
4204 		                    NULL,
4205 		                    NULL,
4206 		                    nmc_property_ipv4_allowed_method,
4207 		                    NULL);
4208 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS),
4209 		                    nmc_property_ipv4_get_dns,
4210 		                    nmc_property_ipv4_set_dns,
4211 		                    nmc_property_ipv4_remove_idx_dns,
4212 		                    nmc_property_ipv4_describe_dns,
4213 		                    NULL,
4214 		                    NULL);
4215 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS_SEARCH),
4216 		                    nmc_property_ipv4_get_dns_search,
4217 		                    nmc_property_ipv4_set_dns_search,
4218 		                    nmc_property_ipv4_remove_idx_dns_search,
4219 		                    NULL,
4220 		                    NULL,
4221 		                    NULL);
4222 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, ADDRESSES),
4223 		                    nmc_property_ipv4_get_addresses,
4224 		                    nmc_property_ipv4_set_addresses,
4225 		                    nmc_property_ipv4_remove_idx_addresses,
4226 		                    nmc_property_ipv4_describe_addresses,
4227 		                    NULL,
4228 		                    nmc_property_out2in_addresses);
4229 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, ROUTES),
4230 		                    nmc_property_ipv4_get_routes,
4231 		                    nmc_property_ipv4_set_routes,
4232 		                    nmc_property_ipv4_remove_idx_routes,
4233 		                    nmc_property_ipv4_describe_routes,
4234 		                    NULL,
4235 		                    nmc_property_out2in_routes);
4236 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_ROUTES),
4237 		                    nmc_property_ipv4_get_ignore_auto_routes,
4238 		                    nmc_property_set_bool,
4239 		                    NULL,
4240 		                    NULL,
4241 		                    NULL,
4242 		                    NULL);
4243 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_DNS),
4244 		                    nmc_property_ipv4_get_ignore_auto_dns,
4245 		                    nmc_property_set_bool,
4246 		                    NULL,
4247 		                    NULL,
4248 		                    NULL,
4249 		                    NULL);
4250 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_CLIENT_ID),
4251 		                    nmc_property_ipv4_get_dhcp_client_id,
4252 		                    nmc_property_set_string,
4253 		                    NULL,
4254 		                    NULL,
4255 		                    NULL,
4256 		                    NULL);
4257 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_SEND_HOSTNAME),
4258 		                    nmc_property_ipv4_get_dhcp_send_hostname,
4259 		                    nmc_property_set_bool,
4260 		                    NULL,
4261 		                    NULL,
4262 		                    NULL,
4263 		                    NULL);
4264 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_HOSTNAME),
4265 		                    nmc_property_ipv4_get_dhcp_hostname,
4266 		                    nmc_property_set_string,
4267 		                    NULL,
4268 		                    NULL,
4269 		                    NULL,
4270 		                    NULL);
4271 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, NEVER_DEFAULT),
4272 		                    nmc_property_ipv4_get_never_default,
4273 		                    nmc_property_set_bool,
4274 		                    NULL,
4275 		                    NULL,
4276 		                    NULL,
4277 		                    NULL);
4278 		nmc_add_prop_funcs (GLUE (IP4_CONFIG, MAY_FAIL),
4279 		                    nmc_property_ipv4_get_may_fail,
4280 		                    nmc_property_set_bool,
4281 		                    NULL,
4282 		                    NULL,
4283 		                    NULL,
4284 		                    NULL);
4285 	
4286 		/* Add editable properties for NM_SETTING_IP6_CONFIG_SETTING_NAME */
4287 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, METHOD),
4288 		                    nmc_property_ipv6_get_method,
4289 		                    nmc_property_ipv6_set_method,
4290 		                    NULL,
4291 		                    NULL,
4292 		                    nmc_property_ipv6_allowed_method,
4293 		                    NULL);
4294 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS),
4295 		                    nmc_property_ipv6_get_dns,
4296 		                    nmc_property_ipv6_set_dns,
4297 		                    nmc_property_ipv6_remove_idx_dns,
4298 		                    nmc_property_ipv6_describe_dns,
4299 		                    NULL,
4300 		                    NULL);
4301 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS_SEARCH),
4302 		                    nmc_property_ipv6_get_dns_search,
4303 		                    nmc_property_ipv6_set_dns_search,
4304 		                    nmc_property_ipv6_remove_idx_dns_search,
4305 		                    NULL,
4306 		                    NULL,
4307 		                    NULL);
4308 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, ADDRESSES),
4309 		                    nmc_property_ipv6_get_addresses,
4310 		                    nmc_property_ipv6_set_addresses,
4311 		                    nmc_property_ipv6_remove_idx_addresses,
4312 		                    nmc_property_ipv6_describe_addresses,
4313 		                    NULL,
4314 		                    nmc_property_out2in_addresses);
4315 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, ROUTES),
4316 		                    nmc_property_ipv6_get_routes,
4317 		                    nmc_property_ipv6_set_routes,
4318 		                    nmc_property_ipv6_remove_idx_routes,
4319 		                    nmc_property_ipv6_describe_routes,
4320 		                    NULL,
4321 		                    nmc_property_out2in_routes);
4322 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_ROUTES),
4323 		                    nmc_property_ipv6_get_ignore_auto_routes,
4324 		                    nmc_property_set_bool,
4325 		                    NULL,
4326 		                    NULL,
4327 		                    NULL,
4328 		                    NULL);
4329 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_DNS),
4330 		                    nmc_property_ipv6_get_ignore_auto_dns,
4331 		                    nmc_property_set_bool,
4332 		                    NULL,
4333 		                    NULL,
4334 		                    NULL,
4335 		                    NULL);
4336 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, NEVER_DEFAULT),
4337 		                    nmc_property_ipv6_get_never_default,
4338 		                    nmc_property_set_bool,
4339 		                    NULL,
4340 		                    NULL,
4341 		                    NULL,
4342 		                    NULL);
4343 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, MAY_FAIL),
4344 		                    nmc_property_ipv6_get_may_fail,
4345 		                    nmc_property_set_bool,
4346 		                    NULL,
4347 		                    NULL,
4348 		                    NULL,
4349 		                    NULL);
4350 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, IP6_PRIVACY),
4351 		                    nmc_property_ipv6_get_ip6_privacy,
4352 		                    nmc_property_ipv6_set_ip6_privacy,
4353 		                    NULL,
4354 		                    NULL,
4355 		                    NULL,
4356 		                    nmc_property_out2in_cut_paren);
4357 		nmc_add_prop_funcs (GLUE (IP6_CONFIG, DHCP_HOSTNAME),
4358 		                    nmc_property_ipv6_get_dhcp_hostname,
4359 		                    nmc_property_set_string,
4360 		                    NULL,
4361 		                    NULL,
4362 		                    NULL,
4363 		                    NULL);
4364 	
4365 		/* Add editable properties for NM_SETTING_OLPC_MESH_SETTING_NAME */
4366 		nmc_add_prop_funcs (GLUE (OLPC_MESH, SSID),
4367 		                    nmc_property_olpc_get_ssid,
4368 		                    nmc_property_set_ssid,
4369 		                    NULL,
4370 		                    NULL,
4371 		                    NULL,
4372 		                    NULL);
4373 		nmc_add_prop_funcs (GLUE (OLPC_MESH, CHANNEL),
4374 		                    nmc_property_olpc_get_channel,
4375 		                    nmc_property_olpc_set_channel,
4376 		                    NULL,
4377 		                    NULL,
4378 		                    NULL,
4379 		                    NULL);
4380 		nmc_add_prop_funcs (GLUE (OLPC_MESH, DHCP_ANYCAST_ADDRESS),
4381 		                    nmc_property_olpc_get_anycast_address,
4382 		                    nmc_property_set_mac,
4383 		                    NULL,
4384 		                    NULL,
4385 		                    NULL,
4386 		                    NULL);
4387 	
4388 		/* Add editable properties for NM_SETTING_PPP_SETTING_NAME */
4389 		nmc_add_prop_funcs (GLUE (PPP, NOAUTH),
4390 		                    nmc_property_ppp_get_noauth,
4391 		                    nmc_property_set_bool,
4392 		                    NULL,
4393 		                    NULL,
4394 		                    NULL,
4395 		                    NULL);
4396 		nmc_add_prop_funcs (GLUE (PPP, REFUSE_EAP),
4397 		                    nmc_property_ppp_get_refuse_eap,
4398 		                    nmc_property_set_bool,
4399 		                    NULL,
4400 		                    NULL,
4401 		                    NULL,
4402 		                    NULL);
4403 		nmc_add_prop_funcs (GLUE (PPP, REFUSE_PAP),
4404 		                    nmc_property_ppp_get_refuse_pap,
4405 		                    nmc_property_set_bool,
4406 		                    NULL,
4407 		                    NULL,
4408 		                    NULL,
4409 		                    NULL);
4410 		nmc_add_prop_funcs (GLUE (PPP, REFUSE_CHAP),
4411 		                    nmc_property_ppp_get_refuse_chap,
4412 		                    nmc_property_set_bool,
4413 		                    NULL,
4414 		                    NULL,
4415 		                    NULL,
4416 		                    NULL);
4417 		nmc_add_prop_funcs (GLUE (PPP, REFUSE_MSCHAP),
4418 		                    nmc_property_ppp_get_refuse_mschap,
4419 		                    nmc_property_set_bool,
4420 		                    NULL,
4421 		                    NULL,
4422 		                    NULL,
4423 		                    NULL);
4424 		nmc_add_prop_funcs (GLUE (PPP, REFUSE_MSCHAPV2),
4425 		                    nmc_property_ppp_get_refuse_mschapv2,
4426 		                    nmc_property_set_bool,
4427 		                    NULL,
4428 		                    NULL,
4429 		                    NULL,
4430 		                    NULL);
4431 		nmc_add_prop_funcs (GLUE (PPP, NOBSDCOMP),
4432 		                    nmc_property_ppp_get_nobsdcomp,
4433 		                    nmc_property_set_bool,
4434 		                    NULL,
4435 		                    NULL,
4436 		                    NULL,
4437 		                    NULL);
4438 		nmc_add_prop_funcs (GLUE (PPP, NODEFLATE),
4439 		                    nmc_property_ppp_get_nodeflate,
4440 		                    nmc_property_set_bool,
4441 		                    NULL,
4442 		                    NULL,
4443 		                    NULL,
4444 		                    NULL);
4445 		nmc_add_prop_funcs (GLUE (PPP, NO_VJ_COMP),
4446 		                    nmc_property_ppp_get_no_vj_comp,
4447 		                    nmc_property_set_bool,
4448 		                    NULL,
4449 		                    NULL,
4450 		                    NULL,
4451 		                    NULL);
4452 		nmc_add_prop_funcs (GLUE (PPP, REQUIRE_MPPE),
4453 		                    nmc_property_ppp_get_require_mppe,
4454 		                    nmc_property_set_bool,
4455 		                    NULL,
4456 		                    NULL,
4457 		                    NULL,
4458 		                    NULL);
4459 		nmc_add_prop_funcs (GLUE (PPP, REQUIRE_MPPE_128),
4460 		                    nmc_property_ppp_get_require_mppe_128,
4461 		                    nmc_property_set_bool,
4462 		                    NULL,
4463 		                    NULL,
4464 		                    NULL,
4465 		                    NULL);
4466 		nmc_add_prop_funcs (GLUE (PPP, MPPE_STATEFUL),
4467 		                    nmc_property_ppp_get_mppe_stateful,
4468 		                    nmc_property_set_bool,
4469 		                    NULL,
4470 		                    NULL,
4471 		                    NULL,
4472 		                    NULL);
4473 		nmc_add_prop_funcs (GLUE (PPP, CRTSCTS),
4474 		                    nmc_property_ppp_get_crtscts,
4475 		                    nmc_property_set_bool,
4476 		                    NULL,
4477 		                    NULL,
4478 		                    NULL,
4479 		                    NULL);
4480 		nmc_add_prop_funcs (GLUE (PPP, BAUD),
4481 		                    nmc_property_ppp_get_baud,
4482 		                    nmc_property_set_uint,
4483 		                    NULL,
4484 		                    NULL,
4485 		                    NULL,
4486 		                    NULL);
4487 		nmc_add_prop_funcs (GLUE (PPP, MRU),
4488 		                    nmc_property_ppp_get_mru,
4489 		                    nmc_property_set_uint,
4490 		                    NULL,
4491 		                    NULL,
4492 		                    NULL,
4493 		                    NULL);
4494 		nmc_add_prop_funcs (GLUE (PPP, MTU),
4495 		                    nmc_property_ppp_get_mtu,
4496 		                    nmc_property_set_mtu,
4497 		                    NULL,
4498 		                    NULL,
4499 		                    NULL,
4500 		                    NULL);
4501 		nmc_add_prop_funcs (GLUE (PPP, LCP_ECHO_FAILURE),
4502 		                    nmc_property_ppp_get_lcp_echo_failure,
4503 		                    nmc_property_set_uint,
4504 		                    NULL,
4505 		                    NULL,
4506 		                    NULL,
4507 		                    NULL);
4508 		nmc_add_prop_funcs (GLUE (PPP, LCP_ECHO_INTERVAL),
4509 		                    nmc_property_ppp_get_lcp_echo_interval,
4510 		                    nmc_property_set_uint,
4511 		                    NULL,
4512 		                    NULL,
4513 		                    NULL,
4514 		                    NULL);
4515 	
4516 		/* Add editable properties for NM_SETTING_PPPOE_SETTING_NAME */
4517 		nmc_add_prop_funcs (GLUE (PPPOE, SERVICE),
4518 		                    nmc_property_pppoe_get_service,
4519 		                    nmc_property_set_string,
4520 		                    NULL,
4521 		                    NULL,
4522 		                    NULL,
4523 		                    NULL);
4524 		nmc_add_prop_funcs (GLUE (PPPOE, USERNAME),
4525 		                    nmc_property_pppoe_get_username,
4526 		                    nmc_property_set_string,
4527 		                    NULL,
4528 		                    NULL,
4529 		                    NULL,
4530 		                    NULL);
4531 		nmc_add_prop_funcs (GLUE (PPPOE, PASSWORD),
4532 		                    nmc_property_pppoe_get_password,
4533 		                    nmc_property_set_string,
4534 		                    NULL,
4535 		                    NULL,
4536 		                    NULL,
4537 		                    NULL);
4538 		nmc_add_prop_funcs (GLUE (PPPOE, PASSWORD_FLAGS),
4539 		                    nmc_property_pppoe_get_password_flags,
4540 		                    nmc_property_set_flags,
4541 		                    NULL,
4542 		                    NULL,
4543 		                    NULL,
4544 		                    nmc_property_out2in_cut_paren);
4545 	
4546 		/* Add editable properties for NM_SETTING_SERIAL_SETTING_NAME */
4547 		nmc_add_prop_funcs (GLUE (SERIAL, BAUD),
4548 		                    nmc_property_serial_get_baud,
4549 		                    nmc_property_set_uint,
4550 		                    NULL,
4551 		                    NULL,
4552 		                    NULL,
4553 		                    NULL);
4554 		nmc_add_prop_funcs (GLUE (SERIAL, BITS),
4555 		                    nmc_property_serial_get_bits,
4556 		                    nmc_property_set_uint,
4557 		                    NULL,
4558 		                    NULL,
4559 		                    NULL,
4560 		                    NULL);
4561 		nmc_add_prop_funcs (GLUE (SERIAL, PARITY),
4562 		                    nmc_property_serial_get_parity,
4563 		                    nmc_property_serial_set_parity,
4564 		                    NULL,
4565 		                    NULL,
4566 		                    NULL,
4567 		                    NULL);
4568 		nmc_add_prop_funcs (GLUE (SERIAL, STOPBITS),
4569 		                    nmc_property_serial_get_stopbits,
4570 		                    nmc_property_set_uint,
4571 		                    NULL,
4572 		                    NULL,
4573 		                    NULL,
4574 		                    NULL);
4575 		nmc_add_prop_funcs (GLUE (SERIAL, SEND_DELAY),
4576 		                    nmc_property_serial_get_send_delay,
4577 		                    nmc_property_set_uint,
4578 		                    NULL,
4579 		                    NULL,
4580 		                    NULL,
4581 		                    NULL);
4582 	
4583 		/* Add editable properties for NM_SETTING_TEAM_SETTING_NAME */
4584 		nmc_add_prop_funcs (GLUE (TEAM, INTERFACE_NAME),
4585 		                    nmc_property_team_get_interface_name,
4586 		                    nmc_property_set_ifname,
4587 		                    NULL,
4588 		                    NULL,
4589 		                    NULL,
4590 		                    NULL);
4591 		nmc_add_prop_funcs (GLUE (TEAM, CONFIG),
4592 		                    nmc_property_team_get_config,
4593 		                    nmc_property_set_string,
4594 		                    NULL,
4595 		                    NULL,
4596 		                    NULL,
4597 		                    NULL);
4598 	
4599 		/* Add editable properties for NM_SETTING_TEAM_PORT_SETTING_NAME */
4600 		nmc_add_prop_funcs (GLUE (TEAM_PORT, CONFIG),
4601 		                    nmc_property_team_port_get_config,
4602 		                    nmc_property_set_string,
4603 		                    NULL,
4604 		                    NULL,
4605 		                    NULL,
4606 		                    NULL);
4607 	
4608 		/* Add editable properties for NM_SETTING_VLAN_SETTING_NAME */
4609 		nmc_add_prop_funcs (GLUE (VLAN, INTERFACE_NAME),
4610 		                    nmc_property_vlan_get_interface_name,
4611 		                    nmc_property_set_ifname,
4612 		                    NULL,
4613 		                    NULL,
4614 		                    NULL,
4615 		                    NULL);
4616 		nmc_add_prop_funcs (GLUE (VLAN, PARENT),
4617 		                    nmc_property_vlan_get_parent,
4618 		                    nmc_property_set_string,
4619 		                    NULL,
4620 		                    NULL,
4621 		                    NULL,
4622 		                    NULL);
4623 		nmc_add_prop_funcs (GLUE (VLAN, ID),
4624 		                    nmc_property_vlan_get_id,
4625 		                    nmc_property_set_uint,
4626 		                    NULL,
4627 		                    NULL,
4628 		                    NULL,
4629 		                    NULL);
4630 		nmc_add_prop_funcs (GLUE (VLAN, FLAGS),
4631 		                    nmc_property_vlan_get_flags,
4632 		                    nmc_property_set_uint,
4633 		                    NULL,
4634 		                    NULL,
4635 		                    NULL,
4636 		                    NULL);
4637 		nmc_add_prop_funcs (GLUE (VLAN, INGRESS_PRIORITY_MAP),
4638 		                    nmc_property_vlan_get_ingress_priority_map,
4639 		                    nmc_property_vlan_set_ingress_priority_map,
4640 		                    nmc_property_vlan_remove_idx_ingress_priority_map,
4641 		                    NULL,
4642 		                    NULL,
4643 		                    NULL);
4644 		nmc_add_prop_funcs (GLUE (VLAN, EGRESS_PRIORITY_MAP),
4645 		                    nmc_property_vlan_get_egress_priority_map,
4646 		                    nmc_property_vlan_set_egress_priority_map,
4647 		                    nmc_property_vlan_remove_idx_egress_priority_map,
4648 		                    NULL,
4649 		                    NULL,
4650 		                    NULL);
4651 	
4652 		/* Add editable properties for NM_SETTING_VPN_SETTING_NAME */
4653 		nmc_add_prop_funcs (GLUE (VPN, SERVICE_TYPE),
4654 		                    nmc_property_vpn_get_service_type,
4655 		                    nmc_property_set_string,
4656 		                    NULL,
4657 		                    NULL,
4658 		                    NULL,
4659 		                    NULL);
4660 		nmc_add_prop_funcs (GLUE (VPN, USER_NAME),
4661 		                    nmc_property_vpn_get_user_name,
4662 		                    nmc_property_set_string,
4663 		                    NULL,
4664 		                    NULL,
4665 		                    NULL,
4666 		                    NULL);
4667 		nmc_add_prop_funcs (GLUE (VPN, DATA),
4668 		                    nmc_property_vpn_get_data,
4669 		                    nmc_property_vpn_set_data,
4670 		                    nmc_property_vpn_remove_option_data,
4671 		                    NULL,
4672 		                    NULL,
4673 		                    NULL);
4674 		nmc_add_prop_funcs (GLUE (VPN, SECRETS),
4675 		                    nmc_property_vpn_get_secrets,
4676 		                    nmc_property_vpn_set_secrets,
4677 		                    nmc_property_vpn_remove_option_secret,
4678 		                    NULL,
4679 		                    NULL,
4680 		                    NULL);
4681 	
4682 		/* Add editable properties for NM_SETTING_WIMAX_SETTING_NAME */
4683 		nmc_add_prop_funcs (GLUE (WIMAX, NETWORK_NAME),
4684 		                    nmc_property_wimax_get_network_name,
4685 		                    nmc_property_set_string,
4686 		                    NULL,
4687 		                    NULL,
4688 		                    NULL,
4689 		                    NULL);
4690 		nmc_add_prop_funcs (GLUE (WIMAX, MAC_ADDRESS),
4691 		                    nmc_property_wimax_get_mac_address,
4692 		                    nmc_property_set_mac,
4693 		                    NULL,
4694 		                    NULL,
4695 		                    NULL,
4696 		                    NULL);
4697 	
4698 		/* Add editable properties for NM_SETTING_WIRED_SETTING_NAME */
4699 		nmc_add_prop_funcs (GLUE (WIRED, PORT),
4700 		                    nmc_property_wired_get_port,
4701 		                    NULL, /*nmc_property_wired_set_port,*/
4702 		                    NULL,
4703 		                    NULL,
4704 		                    NULL, /*nmc_property_wired_allowed_port,*/
4705 		                    NULL);
4706 		nmc_add_prop_funcs (GLUE (WIRED, SPEED),
4707 		                    nmc_property_wired_get_speed,
4708 		                    NULL,
4709 		                    NULL,
4710 		                    NULL,
4711 		                    NULL,
4712 		                    NULL);
4713 		nmc_add_prop_funcs (GLUE (WIRED, DUPLEX),
4714 		                    nmc_property_wired_get_duplex,
4715 		                    NULL, /*nmc_property_wired_set_duplex,*/
4716 		                    NULL,
4717 		                    NULL,
4718 		                    NULL,
4719 		                    NULL); /*nmc_property_wired_allowed_duplex);*/
4720 		nmc_add_prop_funcs (GLUE (WIRED, AUTO_NEGOTIATE),
4721 		                    nmc_property_wired_get_auto_negotiate,
4722 		                    NULL,
4723 		                    NULL,
4724 		                    NULL,
4725 		                    NULL,
4726 		                    NULL);
4727 		nmc_add_prop_funcs (GLUE (WIRED, MAC_ADDRESS),
4728 		                    nmc_property_wired_get_mac_address,
4729 		                    nmc_property_set_mac,
4730 		                    NULL,
4731 		                    NULL,
4732 		                    NULL,
4733 		                    NULL);
4734 		nmc_add_prop_funcs (GLUE (WIRED, CLONED_MAC_ADDRESS),
4735 		                    nmc_property_wired_get_cloned_mac_address,
4736 		                    nmc_property_set_mac,
4737 		                    NULL,
4738 		                    NULL,
4739 		                    NULL,
4740 		                    NULL);
4741 		nmc_add_prop_funcs (GLUE (WIRED, MAC_ADDRESS_BLACKLIST),
4742 		                    nmc_property_wired_get_mac_address_blacklist,
4743 		                    nmc_property_wired_set_mac_address_blacklist,
4744 		                    nmc_property_wired_remove_idx_mac_address_blacklist,
4745 		                    NULL,
4746 		                    NULL,
4747 		                    NULL);
4748 		nmc_add_prop_funcs (GLUE (WIRED, MTU),
4749 		                    nmc_property_wired_get_mtu,
4750 		                    nmc_property_set_mtu,
4751 		                    NULL,
4752 		                    NULL,
4753 		                    NULL,
4754 		                    NULL);
4755 		nmc_add_prop_funcs (GLUE (WIRED, S390_SUBCHANNELS),
4756 		                    nmc_property_wired_get_s390_subchannels,
4757 		                    nmc_property_wired_set_s390_subchannels,
4758 		                    NULL,
4759 		                    nmc_property_wired_describe_s390_subchannels,
4760 		                    NULL,
4761 		                    NULL);
4762 		nmc_add_prop_funcs (GLUE (WIRED, S390_NETTYPE),
4763 		                    nmc_property_wired_get_s390_nettype,
4764 		                    nmc_property_wired_set_s390_nettype,
4765 		                    NULL,
4766 		                    NULL,
4767 		                    nmc_property_wired_allowed_s390_nettype,
4768 		                    NULL);
4769 		nmc_add_prop_funcs (GLUE (WIRED, S390_OPTIONS),
4770 		                    nmc_property_wired_get_s390_options,
4771 		                    nmc_property_wired_set_s390_options,
4772 		                    nmc_property_wired_remove_option_s390_options,
4773 		                    nmc_property_wired_describe_s390_options,
4774 		                    nmc_property_wired_allowed_s390_options,
4775 		                    NULL);
4776 	
4777 		/* Add editable properties for NM_SETTING_WIRELESS_SETTING_NAME */
4778 		nmc_add_prop_funcs (GLUE (WIRELESS, SSID),
4779 		                    nmc_property_wireless_get_ssid,
4780 		                    nmc_property_set_ssid,
4781 		                    NULL,
4782 		                    NULL,
4783 		                    NULL,
4784 		                    NULL);
4785 		nmc_add_prop_funcs (GLUE (WIRELESS, MODE),
4786 		                    nmc_property_wireless_get_mode,
4787 		                    nmc_property_wifi_set_mode,
4788 		                    NULL,
4789 		                    NULL,
4790 		                    nmc_property_wifi_allowed_mode,
4791 		                    NULL);
4792 		nmc_add_prop_funcs (GLUE (WIRELESS, BAND),
4793 		                    nmc_property_wireless_get_band,
4794 		                    nmc_property_wifi_set_band,
4795 		                    NULL,
4796 		                    NULL,
4797 		                    nmc_property_wifi_allowed_band,
4798 		                    NULL);
4799 		nmc_add_prop_funcs (GLUE (WIRELESS, CHANNEL),
4800 		                    nmc_property_wireless_get_channel,
4801 		                    nmc_property_wifi_set_channel,
4802 		                    NULL,
4803 		                    NULL,
4804 		                    NULL,
4805 		                    NULL);
4806 		nmc_add_prop_funcs (GLUE (WIRELESS, BSSID),
4807 		                    nmc_property_wireless_get_bssid,
4808 		                    nmc_property_set_mac,
4809 		                    NULL,
4810 		                    NULL,
4811 		                    NULL,
4812 		                    NULL);
4813 		/*
4814 		 * Do not allow setting 'rate' and 'tx-power'. They are not implemented in
4815 		 * NM core, nor in ifcfg-rh plugin (thus not preserved over re-reading).
4816 		 */
4817 		nmc_add_prop_funcs (GLUE (WIRELESS, RATE),
4818 		                    nmc_property_wireless_get_rate,
4819 		                    NULL, /* editing rate disabled */
4820 		                    NULL,
4821 		                    NULL,
4822 		                    NULL,
4823 		                    NULL);
4824 		nmc_add_prop_funcs (GLUE (WIRELESS, TX_POWER),
4825 		                    nmc_property_wireless_get_tx_power,
4826 		                    NULL, /* editing tx-power disabled */
4827 		                    NULL,
4828 		                    NULL,
4829 		                    NULL,
4830 		                    NULL);
4831 		nmc_add_prop_funcs (GLUE (WIRELESS, MAC_ADDRESS),
4832 		                    nmc_property_wireless_get_mac_address,
4833 		                    nmc_property_set_mac,
4834 		                    NULL,
4835 		                    NULL,
4836 		                    NULL,
4837 		                    NULL);
4838 		nmc_add_prop_funcs (GLUE (WIRELESS, CLONED_MAC_ADDRESS),
4839 		                    nmc_property_wireless_get_cloned_mac_address,
4840 		                    nmc_property_set_mac,
4841 		                    NULL,
4842 		                    NULL,
4843 		                    NULL,
4844 		                    NULL);
4845 		nmc_add_prop_funcs (GLUE (WIRELESS, MAC_ADDRESS_BLACKLIST),
4846 		                    nmc_property_wireless_get_mac_address_blacklist,
4847 		                    nmc_property_wireless_set_mac_address_blacklist,
4848 		                    nmc_property_wireless_remove_idx_mac_address_blacklist,
4849 		                    NULL,
4850 		                    NULL,
4851 		                    NULL);
4852 		nmc_add_prop_funcs (GLUE (WIRELESS, SEEN_BSSIDS),
4853 		                    nmc_property_wireless_get_seen_bssids,
4854 		                    NULL, /* read-only */
4855 		                    NULL,
4856 		                    NULL,
4857 		                    NULL,
4858 		                    NULL);
4859 		nmc_add_prop_funcs (GLUE (WIRELESS, MTU),
4860 		                    nmc_property_wireless_get_mtu,
4861 		                    nmc_property_set_mtu,
4862 		                    NULL,
4863 		                    NULL,
4864 		                    NULL,
4865 		                    NULL);
4866 		nmc_add_prop_funcs (GLUE (WIRELESS, HIDDEN),
4867 		                    nmc_property_wireless_get_hidden,
4868 		                    nmc_property_set_bool,
4869 		                    NULL,
4870 		                    NULL,
4871 		                    NULL,
4872 		                    NULL);
4873 	
4874 		/* Add editable properties for NM_SETTING_WIRELESS_SECURITY_SETTING_NAME */
4875 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, KEY_MGMT),
4876 		                    nmc_property_wifi_sec_get_key_mgmt,
4877 		                    nmc_property_wifi_sec_set_key_mgmt,
4878 		                    NULL,
4879 		                    NULL,
4880 		                    nmc_property_wifi_sec_allowed_key_mgmt,
4881 		                    NULL);
4882 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_TX_KEYIDX),
4883 		                    nmc_property_wifi_sec_get_wep_tx_keyidx,
4884 		                    nmc_property_set_uint,
4885 		                    NULL,
4886 		                    NULL,
4887 		                    NULL,
4888 		                    NULL);
4889 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, AUTH_ALG),
4890 		                    nmc_property_wifi_sec_get_auth_alg,
4891 		                    nmc_property_wifi_sec_set_auth_alg,
4892 		                    NULL,
4893 		                    NULL,
4894 		                    nmc_property_wifi_sec_allowed_auth_alg,
4895 		                    NULL);
4896 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, PROTO),
4897 		                    nmc_property_wifi_sec_get_proto,
4898 		                    nmc_property_wifi_sec_set_proto,
4899 		                    nmc_property_wifi_sec_remove_idx_proto,
4900 		                    NULL,
4901 		                    nmc_property_wifi_sec_allowed_proto,
4902 		                    NULL);
4903 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, PAIRWISE),
4904 		                    nmc_property_wifi_sec_get_pairwise,
4905 		                    nmc_property_wifi_sec_set_pairwise,
4906 		                    nmc_property_wifi_sec_remove_idx_pairwise,
4907 		                    NULL,
4908 		                    nmc_property_wifi_sec_allowed_pairwise,
4909 		                    NULL);
4910 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, GROUP),
4911 		                    nmc_property_wifi_sec_get_group,
4912 		                    nmc_property_wifi_sec_set_group,
4913 		                    nmc_property_wifi_sec_remove_idx_group,
4914 		                    NULL,
4915 		                    nmc_property_wifi_sec_allowed_group,
4916 		                    NULL);
4917 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, LEAP_USERNAME),
4918 		                    nmc_property_wifi_sec_get_leap_username,
4919 		                    nmc_property_set_string,
4920 		                    NULL,
4921 		                    NULL,
4922 		                    NULL,
4923 		                    NULL);
4924 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY0),
4925 		                    nmc_property_wifi_sec_get_wep_key0,
4926 		                    nmc_property_wifi_set_wep_key,
4927 		                    NULL,
4928 		                    NULL,
4929 		                    NULL,
4930 		                    NULL);
4931 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY1),
4932 		                    nmc_property_wifi_sec_get_wep_key1,
4933 		                    nmc_property_wifi_set_wep_key,
4934 		                    NULL,
4935 		                    NULL,
4936 		                    NULL,
4937 		                    NULL);
4938 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY2),
4939 		                    nmc_property_wifi_sec_get_wep_key2,
4940 		                    nmc_property_wifi_set_wep_key,
4941 		                    NULL,
4942 		                    NULL,
4943 		                    NULL,
4944 		                    NULL);
4945 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY3),
4946 		                    nmc_property_wifi_sec_get_wep_key3,
4947 		                    nmc_property_wifi_set_wep_key,
4948 		                    NULL,
4949 		                    NULL,
4950 		                    NULL,
4951 		                    NULL);
4952 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY_FLAGS),
4953 		                    nmc_property_wifi_sec_get_wep_key_flags,
4954 		                    nmc_property_set_flags,
4955 		                    NULL,
4956 		                    NULL,
4957 		                    NULL,
4958 		                    nmc_property_out2in_cut_paren);
4959 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY_TYPE),
4960 		                    nmc_property_wifi_sec_get_wep_key_type,
4961 		                    nmc_property_wifi_set_wep_key_type,
4962 		                    NULL,
4963 		                    nmc_property_wifi_describe_wep_key_type,
4964 		                    NULL,
4965 		                    NULL);
4966 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, PSK),
4967 		                    nmc_property_wifi_sec_get_psk,
4968 		                    nmc_property_wifi_set_psk,
4969 		                    NULL,
4970 		                    NULL,
4971 		                    NULL,
4972 		                    NULL);
4973 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, PSK_FLAGS),
4974 		                    nmc_property_wifi_sec_get_psk_flags,
4975 		                    nmc_property_set_flags,
4976 		                    NULL,
4977 		                    NULL,
4978 		                    NULL,
4979 		                    nmc_property_out2in_cut_paren);
4980 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, LEAP_PASSWORD),
4981 		                    nmc_property_wifi_sec_get_leap_password,
4982 		                    nmc_property_set_string,
4983 		                    NULL,
4984 		                    NULL,
4985 		                    NULL,
4986 		                    NULL);
4987 		nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, LEAP_PASSWORD_FLAGS),
4988 		                    nmc_property_wifi_sec_get_leap_password_flags,
4989 		                    nmc_property_set_flags,
4990 		                    NULL,
4991 		                    NULL,
4992 		                    NULL,
4993 		                    nmc_property_out2in_cut_paren);
4994 	}
4995 	
4996 	void
4997 	nmc_properties_cleanup ()
4998 	{
4999 		if (nmc_properties)
5000 			g_hash_table_destroy (nmc_properties);
5001 	}
5002 	
5003 	static const NmcPropertyFuncs *
5004 	nmc_properties_find (const char *s_name, const char *p_name)
5005 	{
5006 		NmcPropertyFuncs *item = NULL;
5007 		char *key;
5008 	
5009 		/* FIXME: maybe it's better to init it globally */
5010 		nmc_properties_init ();
5011 	
5012 		key = g_strdup_printf ("%s%s", s_name, p_name);
5013 		item = (NmcPropertyFuncs *) g_hash_table_lookup (nmc_properties, key);
5014 		g_free (key);
5015 	
5016 		return item;
5017 	}
5018 	
5019 	static char *
5020 	get_property_val (NMSetting *setting, const char *prop, gboolean convert, GError **error)
5021 	{
5022 		const NmcPropertyFuncs *item;
5023 	
5024 		g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
5025 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
5026 	
5027 		item = nmc_properties_find (nm_setting_get_name (setting), prop);
5028 		if (item && item->get_func) {
5029 			char *prop_val = item->get_func (setting);
5030 			if (convert && item->out2in_func) {
5031 				char *converted = item->out2in_func (prop_val);
5032 				g_free (prop_val);
5033 				return converted;
5034 			} else
5035 				return prop_val;
5036 		}
5037 	
5038 		g_set_error_literal (error, 1, 0, _("don't know how to get the property value"));
5039 		return NULL;
5040 	}
5041 	
5042 	/*
5043 	 * Generic function for getting property value.
5044 	 *
5045 	 * Gets property value as a string by calling specialized functions.
5046 	 *
5047 	 * Returns: current property value. The caller must free the returned string.
5048 	 */
5049 	char *
5050 	nmc_setting_get_property (NMSetting *setting, const char *prop, GError **error)
5051 	{
5052 		return get_property_val (setting, prop, FALSE, error);
5053 	}
5054 	
5055 	/*
5056 	 * The same as nmc_setting_get_property(), but in addition converts
5057 	 * usual output format into a simpler one, used as input in the editor.
5058 	 */
5059 	char *
5060 	nmc_setting_get_property_out2in (NMSetting *setting, const char *prop, GError **error)
5061 	{
5062 		return get_property_val (setting, prop, TRUE, error);
5063 	}
5064 	
5065 	/*
5066 	 * Generic function for setting property value.
5067 	 *
5068 	 * Sets property=val in setting by calling specialized functions.
5069 	 * If val is NULL then default property value is set.
5070 	 *
5071 	 * Returns: TRUE on success; FALSE on failure and sets error
5072 	 */
5073 	gboolean
5074 	nmc_setting_set_property (NMSetting *setting, const char *prop, const char *val, GError **error)
5075 	{
5076 		const NmcPropertyFuncs *item;
5077 	
5078 		g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
5079 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
5080 	
5081 		item = nmc_properties_find (nm_setting_get_name (setting), prop);
5082 		if (item && item->set_func) {
5083 			if (!val) {
5084 				/* No value argument sets default value */
5085 				nmc_property_set_default_value (setting, prop);
5086 				return TRUE;
5087 			}
5088 			return item->set_func (setting, prop, val, error);
5089 		}
5090 	
5091 		g_set_error_literal (error, 1, 0, _("the property can't be changed"));
5092 		return FALSE;
5093 	}
5094 	
5095 	void
5096 	nmc_property_set_default_value (NMSetting *setting, const char *prop)
5097 	{
5098 		GValue value = G_VALUE_INIT;
5099 		GParamSpec *param_spec;
5100 	
5101 		param_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop);
5102 		if (param_spec) {
5103 			g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (param_spec));
5104 			g_param_value_set_default (param_spec, &value);
5105 			g_object_set_property (G_OBJECT (setting), prop, &value);
5106 		}
5107 	}
5108 	
5109 	/*
5110 	 * Generic function for reseting (single value) properties.
5111 	 *
5112 	 * The function resets the property value to the default one. It respects
5113 	 * nmcli restrictions for changing properties. So if 'set_func' is NULL,
5114 	 * reseting the value is denied.
5115 	 *
5116 	 * Returns: TRUE on success; FALSE on failure and sets error
5117 	 */
5118 	gboolean
5119 	nmc_setting_reset_property (NMSetting *setting, const char *prop, GError **error)
5120 	{
5121 		const NmcPropertyFuncs *item;
5122 	
5123 		g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
5124 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
5125 	
5126 		item = nmc_properties_find (nm_setting_get_name (setting), prop);
5127 		if (item && item->set_func) {
5128 			nmc_property_set_default_value (setting, prop);
5129 			return TRUE;
5130 		}
5131 		g_set_error_literal (error, 1, 0, _("the property can't be changed"));
5132 		return FALSE;
5133 	}
5134 	
5135 	/*
5136 	 * Generic function for removing items for collection-type properties.
5137 	 *
5138 	 * If 'option' is not NULL, it tries to remove it, otherwise 'idx' is used.
5139 	 * For single-value properties (not having specialized remove function) this
5140 	 * function does nothing and just returns TRUE.
5141 	 *
5142 	 * Returns: TRUE on success; FALSE on failure and sets error
5143 	 */
5144 	gboolean
5145 	nmc_setting_remove_property_option (NMSetting *setting,
5146 	                                    const char *prop,
5147 	                                    const char *option,
5148 	                                    guint32 idx,
5149 	                                    GError **error)
5150 	{
5151 		const NmcPropertyFuncs *item;
5152 	
5153 		g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
5154 		g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
5155 	
5156 		item = nmc_properties_find (nm_setting_get_name (setting), prop);
5157 		if (item && item->remove_func)
5158 			return item->remove_func (setting, prop, option, idx, error);
5159 	
5160 		return TRUE;
5161 	}
5162 	
5163 	/*
5164 	 * Get valid property names for a setting.
5165 	 *
5166 	 * Returns: string array with the properties or NULL on failure.
5167 	 *          The returned value should be freed with g_strfreev()
5168 	 */
5169 	char **
5170 	nmc_setting_get_valid_properties (NMSetting *setting)
5171 	{
5172 		char **valid_props = NULL;
5173 		GParamSpec **props, **iter;
5174 		guint num;
5175 		int i;
5176 	
5177 		/* Iterate through properties */
5178 		i = 0;
5179 		props = g_object_class_list_properties (G_OBJECT_GET_CLASS (G_OBJECT (setting)), &num);
5180 		valid_props = g_malloc0 (sizeof (char*) * (num + 1));
5181 		for (iter = props; iter && *iter; iter++) {
5182 			const char *key_name = g_param_spec_get_name (*iter);
5183 	
5184 			/* Add all properties except for "name" that is non-editable */
5185 			if (g_strcmp0 (key_name, "name") != 0)
5186 				valid_props[i++] = g_strdup (key_name);
5187 		}
5188 		valid_props[i] = NULL;
5189 	
5190 		return valid_props;
5191 	}
5192 	
5193 	/*
5194 	 * Return allowed values for 'prop' as a string.
5195 	 */
5196 	const char *
5197 	nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop)
5198 	{
5199 	
5200 		const NmcPropertyFuncs *item;
5201 	
5202 		g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
5203 	
5204 		item = nmc_properties_find (nm_setting_get_name (setting), prop);
5205 		if (item && item->values_func)
5206 			return item->values_func (setting, prop);
5207 	
5208 		return NULL;
5209 	}
5210 	
5211 	/*
5212 	 * Create a description string for a property.
5213 	 *
5214 	 * It returns a description got from properties blurb, concatenated with
5215 	 * nmcli specific description (if it exists).
5216 	 *
5217 	 * Returns: property description or NULL on failure. The caller must free the string.
5218 	 */
5219 	char *
5220 	nmc_setting_get_property_desc (NMSetting *setting, const char *prop)
5221 	{
5222 		GParamSpec *spec;
5223 		const NmcPropertyFuncs *item;
5224 		const char *setting_desc = "";
5225 		const char *setting_desc_title = "";
5226 		const char *nmcli_desc = NULL;
5227 		const char *nmcli_desc_title = "";
5228 		const char *nmcli_nl = "";
5229 	
5230 		g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
5231 	
5232 		spec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop);
5233 		if (spec) {
5234 			setting_desc = g_param_spec_get_blurb (spec);
5235 			setting_desc_title = _("[NM property description]");
5236 		}
5237 	
5238 		item = nmc_properties_find (nm_setting_get_name (setting), prop);
5239 		if (item && item->describe_func) {
5240 			nmcli_desc = item->describe_func (setting, prop);
5241 			nmcli_desc_title = _("[nmcli specific description]");
5242 			nmcli_nl = "\n";
5243 		}
5244 	
5245 		return g_strdup_printf ("%s\n%s\n%s%s%s%s",
5246 		                        setting_desc_title, setting_desc,
5247 		                        nmcli_nl, nmcli_desc_title, nmcli_nl,
5248 		                        nmcli_desc ? nmcli_desc : "");
5249 	}
5250 	
5251 	/*
5252 	 * Gets setting:prop property value and returns it in 'value'.
5253 	 * Caller is responsible for freeing the GValue resources using g_value_unset()
5254 	 */
5255 	gboolean
5256 	nmc_property_get_gvalue (NMSetting *setting, const char *prop, GValue *value)
5257 	{
5258 		GParamSpec *param_spec;
5259 	
5260 		param_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop);
5261 		if (param_spec) {
5262 			memset (value, 0, sizeof (GValue));
5263 			g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (param_spec));
5264 			g_object_get_property (G_OBJECT (setting), prop, value);
5265 			return TRUE;
5266 		}
5267 		return FALSE;
5268 	}
5269 	
5270 	/*
5271 	 * Sets setting:prop property value from 'value'.
5272 	 */
5273 	gboolean
5274 	nmc_property_set_gvalue (NMSetting *setting, const char *prop, GValue *value)
5275 	{
5276 		GParamSpec *param_spec;
5277 	
5278 		param_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop);
5279 		if (param_spec && G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (param_spec)) {
5280 			g_object_set_property (G_OBJECT (setting), prop, value);
5281 			return TRUE;
5282 		}
5283 		return FALSE;
5284 	}
5285 	
5286 	/*----------------------------------------------------------------------------*/
5287 	
5288 	static gboolean
5289 	setting_connection_details (NMSetting *setting, NmCli *nmc)
5290 	{
5291 		NMSettingConnection *s_con = NM_SETTING_CONNECTION (setting);
5292 		NmcOutputField *tmpl, *arr;
5293 		size_t tmpl_len;
5294 	
5295 		g_return_val_if_fail (NM_IS_SETTING_CONNECTION (s_con), FALSE);
5296 	
5297 		tmpl = nmc_fields_setting_connection;
5298 		tmpl_len = sizeof (nmc_fields_setting_connection);
5299 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_CONNECTION_ALL, tmpl, NULL);
5300 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5301 		g_ptr_array_add (nmc->output_data, arr);
5302 	
5303 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5304 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5305 		set_val_str (arr, 1, nmc_property_connection_get_id (setting));
5306 		set_val_str (arr, 2, nmc_property_connection_get_uuid (setting));
5307 		set_val_str (arr, 3, nmc_property_connection_get_interface_name (setting));
5308 		set_val_str (arr, 4, nmc_property_connection_get_type (setting));
5309 		set_val_str (arr, 5, nmc_property_connection_get_autoconnect (setting));
5310 		set_val_str (arr, 6, nmc_property_connection_get_timestamp (setting));
5311 		set_val_str (arr, 7, nmc_property_connection_get_read_only (setting));
5312 		set_val_str (arr, 8, nmc_property_connection_get_permissions (setting));
5313 		set_val_str (arr, 9, nmc_property_connection_get_zone (setting));
5314 		set_val_str (arr, 10, nmc_property_connection_get_master (setting));
5315 		set_val_str (arr, 11, nmc_property_connection_get_slave_type (setting));
5316 		set_val_str (arr, 12, nmc_property_connection_get_secondaries (setting));
5317 		set_val_str (arr, 13, nmc_property_connection_get_gateway_ping_timeout (setting));
5318 		g_ptr_array_add (nmc->output_data, arr);
5319 	
5320 		print_data (nmc);  /* Print all data */
5321 	
5322 		return TRUE;
5323 	}
5324 	
5325 	static gboolean
5326 	setting_wired_details (NMSetting *setting, NmCli *nmc)
5327 	{
5328 		NMSettingWired *s_wired = NM_SETTING_WIRED (setting);
5329 		NmcOutputField *tmpl, *arr;
5330 		size_t tmpl_len;
5331 	
5332 		g_return_val_if_fail (NM_IS_SETTING_WIRED (s_wired), FALSE);
5333 	
5334 		tmpl = nmc_fields_setting_wired;
5335 		tmpl_len = sizeof (nmc_fields_setting_wired);
5336 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRED_ALL, tmpl, NULL);
5337 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5338 		g_ptr_array_add (nmc->output_data, arr);
5339 	
5340 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5341 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5342 		set_val_str (arr, 1, nmc_property_wired_get_port (setting));
5343 		set_val_str (arr, 2, nmc_property_wired_get_speed (setting));
5344 		set_val_str (arr, 3, nmc_property_wired_get_duplex (setting));
5345 		set_val_str (arr, 4, nmc_property_wired_get_auto_negotiate (setting));
5346 		set_val_str (arr, 5, nmc_property_wired_get_mac_address (setting));
5347 		set_val_str (arr, 6, nmc_property_wired_get_cloned_mac_address (setting));
5348 		set_val_str (arr, 7, nmc_property_wired_get_mac_address_blacklist (setting));
5349 		set_val_str (arr, 8, nmc_property_wired_get_mtu (setting));
5350 		set_val_str (arr, 9, nmc_property_wired_get_s390_subchannels (setting));
5351 		set_val_str (arr, 10, nmc_property_wired_get_s390_nettype (setting));
5352 		set_val_str (arr, 11, nmc_property_wired_get_s390_options (setting));
5353 		g_ptr_array_add (nmc->output_data, arr);
5354 	
5355 		print_data (nmc);  /* Print all data */
5356 	
5357 		return TRUE;
5358 	}
5359 	
5360 	static gboolean
5361 	setting_802_1X_details (NMSetting *setting, NmCli *nmc)
5362 	{
5363 		NMSetting8021x *s_8021x = NM_SETTING_802_1X (setting);
5364 		NmcOutputField *tmpl, *arr;
5365 		size_t tmpl_len;
5366 	
5367 		g_return_val_if_fail (NM_IS_SETTING_802_1X (s_8021x), FALSE);
5368 	
5369 		tmpl = nmc_fields_setting_8021X;
5370 		tmpl_len = sizeof (nmc_fields_setting_8021X);
5371 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_802_1X_ALL, tmpl, NULL);
5372 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5373 		g_ptr_array_add (nmc->output_data, arr);
5374 	
5375 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5376 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5377 		set_val_str (arr, 1, nmc_property_802_1X_get_eap (setting));
5378 		set_val_str (arr, 2, nmc_property_802_1X_get_identity (setting));
5379 		set_val_str (arr, 3, nmc_property_802_1X_get_anonymous_identity (setting));
5380 		set_val_str (arr, 4, nmc_property_802_1X_get_pac_file (setting));
5381 		set_val_str (arr, 5, nmc_property_802_1X_get_ca_cert (setting));
5382 		set_val_str (arr, 6, nmc_property_802_1X_get_ca_path (setting));
5383 		set_val_str (arr, 7, nmc_property_802_1X_get_subject_match (setting));
5384 		set_val_str (arr, 8, nmc_property_802_1X_get_altsubject_matches (setting));
5385 		set_val_str (arr, 9, nmc_property_802_1X_get_client_cert (setting));
5386 		set_val_str (arr, 10, nmc_property_802_1X_get_phase1_peapver (setting));
5387 		set_val_str (arr, 11, nmc_property_802_1X_get_phase1_peaplabel (setting));
5388 		set_val_str (arr, 12, nmc_property_802_1X_get_phase1_fast_provisioning (setting));
5389 		set_val_str (arr, 13, nmc_property_802_1X_get_phase2_auth (setting));
5390 		set_val_str (arr, 14, nmc_property_802_1X_get_phase2_autheap (setting));
5391 		set_val_str (arr, 15, nmc_property_802_1X_get_phase2_ca_cert (setting));
5392 		set_val_str (arr, 16, nmc_property_802_1X_get_phase2_ca_path (setting));
5393 		set_val_str (arr, 17, nmc_property_802_1X_get_phase2_subject_match (setting));
5394 		set_val_str (arr, 18, nmc_property_802_1X_get_phase2_altsubject_matches (setting));
5395 		set_val_str (arr, 19, nmc_property_802_1X_get_phase2_client_cert (setting));
5396 		set_val_str (arr, 20, nmc_property_802_1X_get_password (setting));
5397 		set_val_str (arr, 21, nmc_property_802_1X_get_password_flags (setting));
5398 		set_val_str (arr, 22, nmc_property_802_1X_get_password_raw (setting));
5399 		set_val_str (arr, 23, nmc_property_802_1X_get_password_raw_flags (setting));
5400 		set_val_str (arr, 24, nmc_property_802_1X_get_private_key (setting));
5401 		set_val_str (arr, 25, nmc_property_802_1X_get_private_key_password (setting));
5402 		set_val_str (arr, 26, nmc_property_802_1X_get_private_key_password_flags (setting));
5403 		set_val_str (arr, 27, nmc_property_802_1X_get_phase2_private_key (setting));
5404 		set_val_str (arr, 28, nmc_property_802_1X_get_phase2_private_key_password (setting));
5405 		set_val_str (arr, 29, nmc_property_802_1X_get_phase2_private_key_password_flags (setting));
5406 		set_val_str (arr, 30, nmc_property_802_1X_get_pin (setting));
5407 		set_val_str (arr, 31, nmc_property_802_1X_get_pin_flags (setting));
5408 		set_val_str (arr, 32, nmc_property_802_1X_get_system_ca_certs (setting));
5409 		g_ptr_array_add (nmc->output_data, arr);
5410 	
5411 		print_data (nmc);  /* Print all data */
5412 	
5413 		return TRUE;
5414 	}
5415 	
5416 	static gboolean
5417 	setting_wireless_details (NMSetting *setting, NmCli *nmc)
5418 	{
5419 		NMSettingWireless *s_wireless = NM_SETTING_WIRELESS (setting);
5420 		NmcOutputField *tmpl, *arr;
5421 		size_t tmpl_len;
5422 	
5423 		g_return_val_if_fail (NM_IS_SETTING_WIRELESS (s_wireless), FALSE);
5424 	
5425 		tmpl = nmc_fields_setting_wireless;
5426 		tmpl_len = sizeof (nmc_fields_setting_wireless);
5427 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRELESS_ALL, tmpl, NULL);
5428 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5429 		g_ptr_array_add (nmc->output_data, arr);
5430 	
5431 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5432 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5433 		set_val_str (arr, 1, nmc_property_wireless_get_ssid (setting));
5434 		set_val_str (arr, 2, nmc_property_wireless_get_mode (setting));
5435 		set_val_str (arr, 3, nmc_property_wireless_get_band (setting));
5436 		set_val_str (arr, 4, nmc_property_wireless_get_channel (setting));
5437 		set_val_str (arr, 5, nmc_property_wireless_get_bssid (setting));
5438 		set_val_str (arr, 6, nmc_property_wireless_get_rate (setting));
5439 		set_val_str (arr, 7, nmc_property_wireless_get_tx_power (setting));
5440 		set_val_str (arr, 8, nmc_property_wireless_get_mac_address (setting));
5441 		set_val_str (arr, 9, nmc_property_wireless_get_cloned_mac_address (setting));
5442 		set_val_str (arr, 10, nmc_property_wireless_get_mac_address_blacklist (setting));
5443 		set_val_str (arr, 11, nmc_property_wireless_get_mtu (setting));
5444 		set_val_str (arr, 12, nmc_property_wireless_get_seen_bssids (setting));
5445 		set_val_str (arr, 13, nmc_property_wireless_get_hidden (setting));
5446 		g_ptr_array_add (nmc->output_data, arr);
5447 	
5448 		print_data (nmc);  /* Print all data */
5449 	
5450 		return TRUE;
5451 	}
5452 	
5453 	static gboolean
5454 	setting_wireless_security_details (NMSetting *setting, NmCli *nmc)
5455 	{
5456 		NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting);
5457 		NmcOutputField *tmpl, *arr;
5458 		size_t tmpl_len;
5459 	
5460 		g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (s_wireless_sec), FALSE);
5461 	
5462 		tmpl = nmc_fields_setting_wireless_security;
5463 		tmpl_len = sizeof (nmc_fields_setting_wireless_security);
5464 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRELESS_SECURITY_ALL, tmpl, NULL);
5465 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5466 		g_ptr_array_add (nmc->output_data, arr);
5467 	
5468 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5469 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5470 		set_val_str (arr, 1, nmc_property_wifi_sec_get_key_mgmt (setting));
5471 		set_val_str (arr, 2, nmc_property_wifi_sec_get_wep_tx_keyidx (setting));
5472 		set_val_str (arr, 3, nmc_property_wifi_sec_get_auth_alg (setting));
5473 		set_val_str (arr, 4, nmc_property_wifi_sec_get_proto (setting));
5474 		set_val_str (arr, 5, nmc_property_wifi_sec_get_pairwise (setting));
5475 		set_val_str (arr, 6, nmc_property_wifi_sec_get_group (setting));
5476 		set_val_str (arr, 7, nmc_property_wifi_sec_get_leap_username (setting));
5477 		set_val_str (arr, 8, nmc_property_wifi_sec_get_wep_key0 (setting));
5478 		set_val_str (arr, 9, nmc_property_wifi_sec_get_wep_key1 (setting));
5479 		set_val_str (arr, 10, nmc_property_wifi_sec_get_wep_key2 (setting));
5480 		set_val_str (arr, 11, nmc_property_wifi_sec_get_wep_key3 (setting));
5481 		set_val_str (arr, 12, nmc_property_wifi_sec_get_wep_key_flags (setting));
5482 		set_val_str (arr, 13, nmc_property_wifi_sec_get_wep_key_type (setting));
5483 		set_val_str (arr, 14, nmc_property_wifi_sec_get_psk (setting));
5484 		set_val_str (arr, 15, nmc_property_wifi_sec_get_psk_flags (setting));
5485 		set_val_str (arr, 16, nmc_property_wifi_sec_get_leap_password (setting));
5486 		set_val_str (arr, 17, nmc_property_wifi_sec_get_leap_password_flags (setting));
5487 		g_ptr_array_add (nmc->output_data, arr);
5488 	
5489 		print_data (nmc);  /* Print all data */
5490 	
5491 		return TRUE;
5492 	}
5493 	
5494 	static gboolean
5495 	setting_ip4_config_details (NMSetting *setting, NmCli *nmc)
5496 	{
5497 		NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting);
5498 		NmcOutputField *tmpl, *arr;
5499 		size_t tmpl_len;
5500 	
5501 		g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (s_ip4), FALSE);
5502 	
5503 		tmpl = nmc_fields_setting_ip4_config;
5504 		tmpl_len = sizeof (nmc_fields_setting_ip4_config);
5505 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_IP4_CONFIG_ALL, tmpl, NULL);
5506 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5507 		g_ptr_array_add (nmc->output_data, arr);
5508 	
5509 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5510 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5511 		set_val_str (arr, 1, nmc_property_ipv4_get_method (setting));
5512 		set_val_str (arr, 2, nmc_property_ipv4_get_dns (setting));
5513 		set_val_str (arr, 3, nmc_property_ipv4_get_dns_search (setting));
5514 		set_val_str (arr, 4, nmc_property_ipv4_get_addresses (setting));
5515 		set_val_str (arr, 5, nmc_property_ipv4_get_routes (setting));
5516 		set_val_str (arr, 6, nmc_property_ipv4_get_ignore_auto_routes (setting));
5517 		set_val_str (arr, 7, nmc_property_ipv4_get_ignore_auto_dns (setting));
5518 		set_val_str (arr, 8, nmc_property_ipv4_get_dhcp_client_id (setting));
5519 		set_val_str (arr, 9, nmc_property_ipv4_get_dhcp_send_hostname (setting));
5520 		set_val_str (arr, 10, nmc_property_ipv4_get_dhcp_hostname (setting));
5521 		set_val_str (arr, 11, nmc_property_ipv4_get_never_default (setting));
5522 		set_val_str (arr, 12, nmc_property_ipv4_get_may_fail (setting));
5523 		g_ptr_array_add (nmc->output_data, arr);
5524 	
5525 		print_data (nmc);  /* Print all data */
5526 	
5527 		return TRUE;
5528 	}
5529 	
5530 	static gboolean
5531 	setting_ip6_config_details (NMSetting *setting, NmCli *nmc)
5532 	{
5533 		NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
5534 		NmcOutputField *tmpl, *arr;
5535 		size_t tmpl_len;
5536 	
5537 		g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (s_ip6), FALSE);
5538 	
5539 		tmpl = nmc_fields_setting_ip6_config;
5540 		tmpl_len = sizeof (nmc_fields_setting_ip6_config);
5541 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_IP6_CONFIG_ALL, tmpl, NULL);
5542 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5543 		g_ptr_array_add (nmc->output_data, arr);
5544 	
5545 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5546 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5547 		set_val_str (arr, 1, nmc_property_ipv6_get_method (setting));
5548 		set_val_str (arr, 2, nmc_property_ipv6_get_dns (setting));
5549 		set_val_str (arr, 3, nmc_property_ipv6_get_dns_search (setting));
5550 		set_val_str (arr, 4, nmc_property_ipv6_get_addresses (setting));
5551 		set_val_str (arr, 5, nmc_property_ipv6_get_routes (setting));
5552 		set_val_str (arr, 6, nmc_property_ipv6_get_ignore_auto_routes (setting));
5553 		set_val_str (arr, 7, nmc_property_ipv6_get_ignore_auto_dns (setting));
5554 		set_val_str (arr, 8, nmc_property_ipv6_get_never_default (setting));
5555 		set_val_str (arr, 9, nmc_property_ipv6_get_may_fail (setting));
5556 		set_val_str (arr, 10, nmc_property_ipv6_get_ip6_privacy (setting));
5557 		set_val_str (arr, 11, nmc_property_ipv6_get_dhcp_hostname (setting));
5558 		g_ptr_array_add (nmc->output_data, arr);
5559 	
5560 		print_data (nmc);  /* Print all data */
5561 	
5562 		return TRUE;
5563 	}
5564 	
5565 	static gboolean
5566 	setting_serial_details (NMSetting *setting, NmCli *nmc)
5567 	{
5568 		NMSettingSerial *s_serial = NM_SETTING_SERIAL (setting);
5569 		NmcOutputField *tmpl, *arr;
5570 		size_t tmpl_len;
5571 	
5572 		g_return_val_if_fail (NM_IS_SETTING_SERIAL (s_serial), FALSE);
5573 	
5574 		tmpl = nmc_fields_setting_serial;
5575 		tmpl_len = sizeof (nmc_fields_setting_serial);
5576 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_SERIAL_ALL, tmpl, NULL);
5577 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5578 		g_ptr_array_add (nmc->output_data, arr);
5579 	
5580 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5581 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5582 		set_val_str (arr, 1, nmc_property_serial_get_baud (setting));
5583 		set_val_str (arr, 2, nmc_property_serial_get_bits (setting));
5584 		set_val_str (arr, 3, nmc_property_serial_get_parity (setting));
5585 		set_val_str (arr, 4, nmc_property_serial_get_stopbits (setting));
5586 		set_val_str (arr, 5, nmc_property_serial_get_send_delay (setting));
5587 		g_ptr_array_add (nmc->output_data, arr);
5588 	
5589 		print_data (nmc);  /* Print all data */
5590 	
5591 		return TRUE;
5592 	}
5593 	
5594 	static gboolean
5595 	setting_ppp_details (NMSetting *setting, NmCli *nmc)
5596 	{
5597 		NMSettingPPP *s_ppp = NM_SETTING_PPP (setting);
5598 		NmcOutputField *tmpl, *arr;
5599 		size_t tmpl_len;
5600 	
5601 		g_return_val_if_fail (NM_IS_SETTING_PPP (s_ppp), FALSE);
5602 	
5603 		tmpl = nmc_fields_setting_ppp;
5604 		tmpl_len = sizeof (nmc_fields_setting_ppp);
5605 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_PPP_ALL, tmpl, NULL);
5606 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5607 		g_ptr_array_add (nmc->output_data, arr);
5608 	
5609 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5610 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5611 		set_val_str (arr, 1, nmc_property_ppp_get_noauth (setting));
5612 		set_val_str (arr, 2, nmc_property_ppp_get_refuse_eap (setting));
5613 		set_val_str (arr, 3, nmc_property_ppp_get_refuse_pap (setting));
5614 		set_val_str (arr, 4, nmc_property_ppp_get_refuse_chap (setting));
5615 		set_val_str (arr, 5, nmc_property_ppp_get_refuse_mschap (setting));
5616 		set_val_str (arr, 6, nmc_property_ppp_get_refuse_mschapv2 (setting));
5617 		set_val_str (arr, 7, nmc_property_ppp_get_nobsdcomp (setting));
5618 		set_val_str (arr, 8, nmc_property_ppp_get_nodeflate (setting));
5619 		set_val_str (arr, 9, nmc_property_ppp_get_no_vj_comp (setting));
5620 		set_val_str (arr, 10, nmc_property_ppp_get_require_mppe (setting));
5621 		set_val_str (arr, 11, nmc_property_ppp_get_require_mppe_128 (setting));
5622 		set_val_str (arr, 12, nmc_property_ppp_get_mppe_stateful (setting));
5623 		set_val_str (arr, 13, nmc_property_ppp_get_crtscts (setting));
5624 		set_val_str (arr, 14, nmc_property_ppp_get_baud (setting));
5625 		set_val_str (arr, 15, nmc_property_ppp_get_mru (setting));
5626 		set_val_str (arr, 16, nmc_property_ppp_get_mtu (setting));
5627 		set_val_str (arr, 17, nmc_property_ppp_get_lcp_echo_failure (setting));
5628 		set_val_str (arr, 18, nmc_property_ppp_get_lcp_echo_interval (setting));
5629 		g_ptr_array_add (nmc->output_data, arr);
5630 	
5631 		print_data (nmc);  /* Print all data */
5632 	
5633 		return TRUE;
5634 	}
5635 	
5636 	static gboolean
5637 	setting_pppoe_details (NMSetting *setting, NmCli *nmc)
5638 	{
5639 		NMSettingPPPOE *s_pppoe = NM_SETTING_PPPOE (setting);
5640 		NmcOutputField *tmpl, *arr;
5641 		size_t tmpl_len;
5642 	
5643 		g_return_val_if_fail (NM_IS_SETTING_PPPOE (s_pppoe), FALSE);
5644 	
5645 		tmpl = nmc_fields_setting_pppoe;
5646 		tmpl_len = sizeof (nmc_fields_setting_pppoe);
5647 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_PPPOE_ALL, tmpl, NULL);
5648 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5649 		g_ptr_array_add (nmc->output_data, arr);
5650 	
5651 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5652 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5653 		set_val_str (arr, 1, nmc_property_pppoe_get_service (setting));
5654 		set_val_str (arr, 2, nmc_property_pppoe_get_username (setting));
5655 		set_val_str (arr, 3, nmc_property_pppoe_get_password (setting));
5656 		set_val_str (arr, 4, nmc_property_pppoe_get_password_flags (setting));
5657 		g_ptr_array_add (nmc->output_data, arr);
5658 	
5659 		print_data (nmc);  /* Print all data */
5660 	
5661 		return TRUE;
5662 	}
5663 	
5664 	static gboolean
5665 	setting_gsm_details (NMSetting *setting, NmCli *nmc)
5666 	{
5667 		NMSettingGsm *s_gsm = NM_SETTING_GSM (setting);
5668 		NmcOutputField *tmpl, *arr;
5669 		size_t tmpl_len;
5670 	
5671 		g_return_val_if_fail (NM_IS_SETTING_GSM (s_gsm), FALSE);
5672 	
5673 		tmpl = nmc_fields_setting_gsm;
5674 		tmpl_len = sizeof (nmc_fields_setting_gsm);
5675 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_GSM_ALL, tmpl, NULL);
5676 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5677 		g_ptr_array_add (nmc->output_data, arr);
5678 	
5679 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5680 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5681 		set_val_str (arr, 1, nmc_property_gsm_get_number (setting));
5682 		set_val_str (arr, 2, nmc_property_gsm_get_username (setting));
5683 		set_val_str (arr, 3, nmc_property_gsm_get_password (setting));
5684 		set_val_str (arr, 4, nmc_property_gsm_get_password_flags (setting));
5685 		set_val_str (arr, 5, nmc_property_gsm_get_apn (setting));
5686 		set_val_str (arr, 6, nmc_property_gsm_get_network_id (setting));
5687 		set_val_str (arr, 7, nmc_property_gsm_get_network_type (setting));
5688 		set_val_str (arr, 8, nmc_property_gsm_get_allowed_bands (setting));
5689 		set_val_str (arr, 9, nmc_property_gsm_get_pin (setting));
5690 		set_val_str (arr, 10, nmc_property_gsm_get_pin_flags (setting));
5691 		set_val_str (arr, 11, nmc_property_gsm_get_home_only (setting));
5692 		g_ptr_array_add (nmc->output_data, arr);
5693 	
5694 		print_data (nmc);  /* Print all data */
5695 	
5696 		return TRUE;
5697 	}
5698 	
5699 	static gboolean
5700 	setting_cdma_details (NMSetting *setting, NmCli *nmc)
5701 	{
5702 		NMSettingCdma *s_cdma = NM_SETTING_CDMA (setting);
5703 		NmcOutputField *tmpl, *arr;
5704 		size_t tmpl_len;
5705 	
5706 		g_return_val_if_fail (NM_IS_SETTING_CDMA (s_cdma), FALSE);
5707 	
5708 		tmpl = nmc_fields_setting_cdma;
5709 		tmpl_len = sizeof (nmc_fields_setting_cdma);
5710 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_CDMA_ALL, tmpl, NULL);
5711 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5712 		g_ptr_array_add (nmc->output_data, arr);
5713 	
5714 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5715 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5716 		set_val_str (arr, 1, nmc_property_cdma_get_number (setting));
5717 		set_val_str (arr, 2, nmc_property_cdma_get_username (setting));
5718 		set_val_str (arr, 3, nmc_property_cdma_get_password (setting));
5719 		set_val_str (arr, 4, nmc_property_cdma_get_password_flags (setting));
5720 		g_ptr_array_add (nmc->output_data, arr);
5721 	
5722 		print_data (nmc);  /* Print all data */
5723 	
5724 		return TRUE;
5725 	}
5726 	
5727 	static gboolean
5728 	setting_bluetooth_details (NMSetting *setting, NmCli *nmc)
5729 	{
5730 		NMSettingBluetooth *s_bluetooth = NM_SETTING_BLUETOOTH (setting);
5731 		NmcOutputField *tmpl, *arr;
5732 		size_t tmpl_len;
5733 	
5734 		g_return_val_if_fail (NM_IS_SETTING_BLUETOOTH (s_bluetooth), FALSE);
5735 	
5736 		tmpl = nmc_fields_setting_bluetooth;
5737 		tmpl_len = sizeof (nmc_fields_setting_bluetooth);
5738 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BLUETOOTH_ALL, tmpl, NULL);
5739 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5740 		g_ptr_array_add (nmc->output_data, arr);
5741 	
5742 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5743 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5744 		set_val_str (arr, 1, nmc_property_bluetooth_get_bdaddr (setting));
5745 		set_val_str (arr, 2, nmc_property_bluetooth_get_type (setting));
5746 		g_ptr_array_add (nmc->output_data, arr);
5747 	
5748 		print_data (nmc);  /* Print all data */
5749 	
5750 		return TRUE;
5751 	}
5752 	
5753 	static gboolean
5754 	setting_olpc_mesh_details (NMSetting *setting, NmCli *nmc)
5755 	{
5756 		NMSettingOlpcMesh *s_olpc_mesh = NM_SETTING_OLPC_MESH (setting);
5757 		NmcOutputField *tmpl, *arr;
5758 		size_t tmpl_len;
5759 	
5760 		g_return_val_if_fail (NM_IS_SETTING_OLPC_MESH (s_olpc_mesh), FALSE);
5761 	
5762 		tmpl = nmc_fields_setting_olpc_mesh;
5763 		tmpl_len = sizeof (nmc_fields_setting_olpc_mesh);
5764 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_OLPC_MESH_ALL, tmpl, NULL);
5765 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5766 		g_ptr_array_add (nmc->output_data, arr);
5767 	
5768 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5769 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5770 		set_val_str (arr, 1, nmc_property_olpc_get_ssid (setting));
5771 		set_val_str (arr, 2, nmc_property_olpc_get_channel (setting));
5772 		set_val_str (arr, 3, nmc_property_olpc_get_anycast_address (setting));
5773 		g_ptr_array_add (nmc->output_data, arr);
5774 	
5775 		print_data (nmc);  /* Print all data */
5776 	
5777 		return TRUE;
5778 	}
5779 	
5780 	static gboolean
5781 	setting_vpn_details (NMSetting *setting, NmCli *nmc)
5782 	{
5783 		NMSettingVPN *s_vpn = NM_SETTING_VPN (setting);
5784 		NmcOutputField *tmpl, *arr;
5785 		size_t tmpl_len;
5786 	
5787 		g_return_val_if_fail (NM_IS_SETTING_VPN (s_vpn), FALSE);
5788 	
5789 		tmpl = nmc_fields_setting_vpn;
5790 		tmpl_len = sizeof (nmc_fields_setting_vpn);
5791 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_VPN_ALL, tmpl, NULL);
5792 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5793 		g_ptr_array_add (nmc->output_data, arr);
5794 	
5795 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5796 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5797 		set_val_str (arr, 1, nmc_property_vpn_get_service_type (setting));
5798 		set_val_str (arr, 2, nmc_property_vpn_get_user_name (setting));
5799 		set_val_str (arr, 3, nmc_property_vpn_get_data (setting));
5800 		set_val_str (arr, 4, nmc_property_vpn_get_secrets (setting));
5801 		g_ptr_array_add (nmc->output_data, arr);
5802 	
5803 		print_data (nmc);  /* Print all data */
5804 	
5805 		return TRUE;
5806 	}
5807 	
5808 	static gboolean
5809 	setting_wimax_details (NMSetting *setting, NmCli *nmc)
5810 	{
5811 		NMSettingWimax *s_wimax = NM_SETTING_WIMAX (setting);
5812 		NmcOutputField *tmpl, *arr;
5813 		size_t tmpl_len;
5814 	
5815 		g_return_val_if_fail (NM_IS_SETTING_WIMAX (s_wimax), FALSE);
5816 	
5817 		tmpl = nmc_fields_setting_wimax;
5818 		tmpl_len = sizeof (nmc_fields_setting_wimax);
5819 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIMAX_ALL, tmpl, NULL);
5820 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5821 		g_ptr_array_add (nmc->output_data, arr);
5822 	
5823 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5824 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5825 		set_val_str (arr, 1, nmc_property_wimax_get_mac_address (setting));
5826 		set_val_str (arr, 2, nmc_property_wimax_get_network_name (setting));
5827 		g_ptr_array_add (nmc->output_data, arr);
5828 	
5829 		print_data (nmc);  /* Print all data */
5830 	
5831 		return TRUE;
5832 	}
5833 	
5834 	static gboolean
5835 	setting_infiniband_details (NMSetting *setting, NmCli *nmc)
5836 	{
5837 		NMSettingInfiniband *s_infiniband = NM_SETTING_INFINIBAND (setting);
5838 		NmcOutputField *tmpl, *arr;
5839 		size_t tmpl_len;
5840 	
5841 		g_return_val_if_fail (NM_IS_SETTING_INFINIBAND (s_infiniband), FALSE);
5842 	
5843 		tmpl = nmc_fields_setting_infiniband;
5844 		tmpl_len = sizeof (nmc_fields_setting_infiniband);
5845 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_INFINIBAND_ALL, tmpl, NULL);
5846 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5847 		g_ptr_array_add (nmc->output_data, arr);
5848 	
5849 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5850 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5851 		set_val_str (arr, 1, nmc_property_ib_get_mac_address (setting));
5852 		set_val_str (arr, 2, nmc_property_ib_get_mtu (setting));
5853 		set_val_str (arr, 3, nmc_property_ib_get_transport_mode (setting));
5854 		set_val_str (arr, 4, nmc_property_ib_get_p_key (setting));
5855 		set_val_str (arr, 5, nmc_property_ib_get_parent (setting));
5856 		g_ptr_array_add (nmc->output_data, arr);
5857 	
5858 		print_data (nmc);  /* Print all data */
5859 	
5860 		return TRUE;
5861 	}
5862 	
5863 	static gboolean
5864 	setting_bond_details (NMSetting *setting, NmCli *nmc)
5865 	{
5866 		NMSettingBond *s_bond = NM_SETTING_BOND (setting);
5867 		NmcOutputField *tmpl, *arr;
5868 		size_t tmpl_len;
5869 	
5870 		g_return_val_if_fail (NM_IS_SETTING_BOND (s_bond), FALSE);
5871 	
5872 		tmpl = nmc_fields_setting_bond;
5873 		tmpl_len = sizeof (nmc_fields_setting_bond);
5874 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BOND_ALL, tmpl, NULL);
5875 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5876 		g_ptr_array_add (nmc->output_data, arr);
5877 	
5878 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5879 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5880 		set_val_str (arr, 1, nmc_property_bond_get_interface_name (setting));
5881 		set_val_str (arr, 2, nmc_property_bond_get_options (setting));
5882 		g_ptr_array_add (nmc->output_data, arr);
5883 	
5884 		print_data (nmc);  /* Print all data */
5885 	
5886 		return TRUE;
5887 	}
5888 	
5889 	static gboolean
5890 	setting_vlan_details (NMSetting *setting, NmCli *nmc)
5891 	{
5892 		NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
5893 		NmcOutputField *tmpl, *arr;
5894 		size_t tmpl_len;
5895 	
5896 		g_return_val_if_fail (NM_IS_SETTING_VLAN (s_vlan), FALSE);
5897 	
5898 		tmpl = nmc_fields_setting_vlan;
5899 		tmpl_len = sizeof (nmc_fields_setting_vlan);
5900 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_VLAN_ALL, tmpl, NULL);
5901 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5902 		g_ptr_array_add (nmc->output_data, arr);
5903 	
5904 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5905 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5906 		set_val_str (arr, 1, nmc_property_vlan_get_interface_name (setting));
5907 		set_val_str (arr, 2, nmc_property_vlan_get_parent (setting));
5908 		set_val_str (arr, 3, nmc_property_vlan_get_id (setting));
5909 		set_val_str (arr, 4, nmc_property_vlan_get_flags (setting));
5910 		set_val_str (arr, 5, nmc_property_vlan_get_ingress_priority_map (setting));
5911 		set_val_str (arr, 6, nmc_property_vlan_get_egress_priority_map (setting));
5912 		g_ptr_array_add (nmc->output_data, arr);
5913 	
5914 		print_data (nmc);  /* Print all data */
5915 	
5916 		return TRUE;
5917 	}
5918 	
5919 	static gboolean
5920 	setting_adsl_details (NMSetting *setting, NmCli *nmc)
5921 	{
5922 		NMSettingAdsl *s_adsl = NM_SETTING_ADSL (setting);
5923 		NmcOutputField *tmpl, *arr;
5924 		size_t tmpl_len;
5925 	
5926 		g_return_val_if_fail (NM_IS_SETTING_ADSL (s_adsl), FALSE);
5927 	
5928 		tmpl = nmc_fields_setting_adsl;
5929 		tmpl_len = sizeof (nmc_fields_setting_adsl);
5930 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_ADSL_ALL, tmpl, NULL);
5931 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5932 		g_ptr_array_add (nmc->output_data, arr);
5933 	
5934 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5935 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5936 		set_val_str (arr, 1, nmc_property_adsl_get_username (setting));
5937 		set_val_str (arr, 2, nmc_property_adsl_get_password (setting));
5938 		set_val_str (arr, 3, nmc_property_adsl_get_password_flags (setting));
5939 		set_val_str (arr, 4, nmc_property_adsl_get_protocol (setting));
5940 		set_val_str (arr, 5, nmc_property_adsl_get_encapsulation (setting));
5941 		set_val_str (arr, 6, nmc_property_adsl_get_vpi (setting));
5942 		set_val_str (arr, 7, nmc_property_adsl_get_vci (setting));
5943 		g_ptr_array_add (nmc->output_data, arr);
5944 	
5945 		print_data (nmc);  /* Print all data */
5946 	
5947 		return TRUE;
5948 	}
5949 	
5950 	static gboolean
5951 	setting_bridge_details (NMSetting *setting, NmCli *nmc)
5952 	{
5953 		NMSettingBridge *s_bridge = NM_SETTING_BRIDGE (setting);
5954 		NmcOutputField *tmpl, *arr;
5955 		size_t tmpl_len;
5956 	
5957 		g_return_val_if_fail (NM_IS_SETTING_BRIDGE (s_bridge), FALSE);
5958 	
5959 		tmpl = nmc_fields_setting_bridge;
5960 		tmpl_len = sizeof (nmc_fields_setting_bridge);
5961 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BRIDGE_ALL, tmpl, NULL);
5962 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5963 		g_ptr_array_add (nmc->output_data, arr);
5964 	
5965 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5966 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5967 		set_val_str (arr, 1, nmc_property_bridge_get_interface_name (setting));
5968 		set_val_str (arr, 2, nmc_property_bridge_get_stp (setting));
5969 		set_val_str (arr, 3, nmc_property_bridge_get_priority (setting));
5970 		set_val_str (arr, 4, nmc_property_bridge_get_forward_delay (setting));
5971 		set_val_str (arr, 5, nmc_property_bridge_get_hello_time (setting));
5972 		set_val_str (arr, 6, nmc_property_bridge_get_max_age (setting));
5973 		set_val_str (arr, 7, nmc_property_bridge_get_ageing_time (setting));
5974 		g_ptr_array_add (nmc->output_data, arr);
5975 	
5976 		print_data (nmc);  /* Print all data */
5977 	
5978 		return TRUE;
5979 	}
5980 	
5981 	static gboolean
5982 	setting_bridge_port_details (NMSetting *setting, NmCli *nmc)
5983 	{
5984 		NMSettingBridgePort *s_bridge_port = NM_SETTING_BRIDGE_PORT (setting);
5985 		NmcOutputField *tmpl, *arr;
5986 		size_t tmpl_len;
5987 	
5988 		g_return_val_if_fail (NM_IS_SETTING_BRIDGE_PORT (s_bridge_port), FALSE);
5989 	
5990 		tmpl = nmc_fields_setting_bridge_port;
5991 		tmpl_len = sizeof (nmc_fields_setting_bridge_port);
5992 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BRIDGE_PORT_ALL, tmpl, NULL);
5993 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
5994 		g_ptr_array_add (nmc->output_data, arr);
5995 	
5996 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
5997 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
5998 		set_val_str (arr, 1, nmc_property_bridge_port_get_priority (setting));
5999 		set_val_str (arr, 2, nmc_property_bridge_port_get_path_cost (setting));
6000 		set_val_str (arr, 3, nmc_property_bridge_port_get_hairpin_mode (setting));
6001 		g_ptr_array_add (nmc->output_data, arr);
6002 	
6003 		print_data (nmc);  /* Print all data */
6004 	
6005 		return TRUE;
6006 	}
6007 	
6008 	static gboolean
6009 	setting_team_details (NMSetting *setting, NmCli *nmc)
6010 	{
6011 		NMSettingTeam *s_team = NM_SETTING_TEAM (setting);
6012 		NmcOutputField *tmpl, *arr;
6013 		size_t tmpl_len;
6014 	
6015 		g_return_val_if_fail (NM_IS_SETTING_TEAM (s_team), FALSE);
6016 	
6017 		tmpl = nmc_fields_setting_team;
6018 		tmpl_len = sizeof (nmc_fields_setting_team);
6019 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_TEAM_ALL, tmpl, NULL);
6020 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
6021 		g_ptr_array_add (nmc->output_data, arr);
6022 	
6023 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
6024 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
6025 		set_val_str (arr, 1, nmc_property_team_get_interface_name (setting));
6026 		set_val_str (arr, 2, nmc_property_team_get_config (setting));
6027 		g_ptr_array_add (nmc->output_data, arr);
6028 	
6029 		print_data (nmc);  /* Print all data */
6030 	
6031 		return TRUE;
6032 	}
6033 	
6034 	static gboolean
6035 	setting_team_port_details (NMSetting *setting, NmCli *nmc)
6036 	{
6037 		NMSettingTeamPort *s_team_port = NM_SETTING_TEAM_PORT (setting);
6038 		NmcOutputField *tmpl, *arr;
6039 		size_t tmpl_len;
6040 	
6041 		g_return_val_if_fail (NM_IS_SETTING_TEAM_PORT (s_team_port), FALSE);
6042 	
6043 		tmpl = nmc_fields_setting_team_port;
6044 		tmpl_len = sizeof (nmc_fields_setting_team_port);
6045 		nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_TEAM_PORT_ALL, tmpl, NULL);
6046 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
6047 		g_ptr_array_add (nmc->output_data, arr);
6048 	
6049 		arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
6050 		set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
6051 		set_val_str (arr, 1, nmc_property_team_port_get_config (setting));
6052 		g_ptr_array_add (nmc->output_data, arr);
6053 	
6054 		print_data (nmc);  /* Print all data */
6055 	
6056 		return TRUE;
6057 	}
6058 	
6059 	typedef struct {
6060 		const char *sname;
6061 		gboolean (*func) (NMSetting *setting, NmCli *nmc);
6062 	} SettingDetails;
6063 	
6064 	static const SettingDetails detail_printers[] = {
6065 		{ NM_SETTING_CONNECTION_SETTING_NAME,        setting_connection_details },
6066 		{ NM_SETTING_WIRED_SETTING_NAME,             setting_wired_details },
6067 		{ NM_SETTING_802_1X_SETTING_NAME,            setting_802_1X_details },
6068 		{ NM_SETTING_WIRELESS_SETTING_NAME,          setting_wireless_details },
6069 		{ NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, setting_wireless_security_details },
6070 		{ NM_SETTING_IP4_CONFIG_SETTING_NAME,        setting_ip4_config_details },
6071 		{ NM_SETTING_IP6_CONFIG_SETTING_NAME,        setting_ip6_config_details },
6072 		{ NM_SETTING_SERIAL_SETTING_NAME,            setting_serial_details },
6073 		{ NM_SETTING_PPP_SETTING_NAME,               setting_ppp_details },
6074 		{ NM_SETTING_PPPOE_SETTING_NAME,             setting_pppoe_details },
6075 		{ NM_SETTING_GSM_SETTING_NAME,               setting_gsm_details },
6076 		{ NM_SETTING_CDMA_SETTING_NAME,              setting_cdma_details },
6077 		{ NM_SETTING_BLUETOOTH_SETTING_NAME,         setting_bluetooth_details },
6078 		{ NM_SETTING_OLPC_MESH_SETTING_NAME,         setting_olpc_mesh_details },
6079 		{ NM_SETTING_VPN_SETTING_NAME,               setting_vpn_details },
6080 		{ NM_SETTING_WIMAX_SETTING_NAME,             setting_wimax_details },
6081 		{ NM_SETTING_INFINIBAND_SETTING_NAME,        setting_infiniband_details },
6082 		{ NM_SETTING_BOND_SETTING_NAME,              setting_bond_details },
6083 		{ NM_SETTING_VLAN_SETTING_NAME,              setting_vlan_details },
6084 		{ NM_SETTING_ADSL_SETTING_NAME,              setting_adsl_details },
6085 		{ NM_SETTING_BRIDGE_SETTING_NAME,            setting_bridge_details },
6086 		{ NM_SETTING_BRIDGE_PORT_SETTING_NAME,       setting_bridge_port_details },
6087 		{ NM_SETTING_TEAM_SETTING_NAME,              setting_team_details },
6088 		{ NM_SETTING_TEAM_PORT_SETTING_NAME,         setting_team_port_details },
6089 		{ NULL },
6090 	};
6091 	
6092 	gboolean
6093 	setting_details (NMSetting *setting, NmCli *nmc)
6094 	{
6095 		const SettingDetails *iter = &detail_printers[0];
6096 	
6097 		g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
6098 	
6099 		while (iter->sname) {
6100 			if (nm_connection_lookup_setting_type (iter->sname) == G_OBJECT_TYPE (setting))
6101 				return iter->func (setting, nmc);
6102 			iter++;
6103 		}
6104 	
6105 		g_assert_not_reached ();
6106 		return FALSE;
6107 	}
6108 	
6109