device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-glib / nm-device-wimax.c
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301 USA.
17  *
18  * Copyright 2011 - 2012 Red Hat, Inc.
19  * Copyright 2009 Novell, Inc.
20  */
21
22 #include "nm-default.h"
23
24 #include <string.h>
25 #include <netinet/ether.h>
26
27 #include "nm-setting-connection.h"
28 #include "nm-setting-wimax.h"
29
30 #include "nm-device-wimax.h"
31 #include "nm-object-private.h"
32 #include "nm-object-cache.h"
33 #include "nm-dbus-glib-types.h"
34 #include "nm-types-private.h"
35 #include "nm-device-private.h"
36
37 G_DEFINE_TYPE (NMDeviceWimax, nm_device_wimax, NM_TYPE_DEVICE)
38
39 #define NM_DEVICE_WIMAX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_WIMAX, NMDeviceWimaxPrivate))
40
41 void _nm_device_wimax_set_wireless_enabled (NMDeviceWimax *wimax, gboolean enabled);
42
43 typedef struct {
44         DBusGProxy *proxy;
45
46         char *hw_address;
47         NMWimaxNsp *active_nsp;
48         GPtrArray *nsps;
49
50         guint center_freq;
51         gint rssi;
52         gint cinr;
53         gint tx_power;
54         char *bsid;
55 } NMDeviceWimaxPrivate;
56
57 enum {
58         PROP_0,
59         PROP_HW_ADDRESS,
60         PROP_ACTIVE_NSP,
61         PROP_CENTER_FREQ,
62         PROP_RSSI,
63         PROP_CINR,
64         PROP_TX_POWER,
65         PROP_BSID,
66         PROP_NSPS,
67
68         LAST_PROP
69 };
70
71 enum {
72         NSP_ADDED,
73         NSP_REMOVED,
74
75         LAST_SIGNAL
76 };
77 static guint signals[LAST_SIGNAL] = { 0 };
78
79 /**
80  * nm_device_wimax_error_quark:
81  *
82  * Registers an error quark for #NMDeviceWimax if necessary.
83  *
84  * Returns: the error quark used for #NMDeviceWimax errors.
85  *
86  * Deprecated: 1.2: WiMAX is no longer supported.
87  **/
88 GQuark
89 nm_device_wimax_error_quark (void)
90 {
91         static GQuark quark = 0;
92
93         if (G_UNLIKELY (quark == 0))
94                 quark = g_quark_from_static_string ("nm-device-wimax-error-quark");
95         return quark;
96 }
97
98 /**
99  * nm_device_wimax_new:
100  * @connection: the #DBusGConnection
101  * @path: the D-Bus object path of the WiMAX device
102  *
103  * Creates a new #NMDeviceWimax.
104  *
105  * Returns: (transfer full): a new WiMAX device
106  *
107  * Deprecated: 1.2: WiMAX is no longer supported.
108  **/
109 GObject *
110 nm_device_wimax_new (DBusGConnection *connection, const char *path)
111 {
112         GObject *device;
113
114         g_return_val_if_fail (connection != NULL, NULL);
115         g_return_val_if_fail (path != NULL, NULL);
116
117         device = g_object_new (NM_TYPE_DEVICE_WIMAX,
118                                NM_OBJECT_DBUS_CONNECTION, connection,
119                                NM_OBJECT_DBUS_PATH, path,
120                                NULL);
121         _nm_object_ensure_inited (NM_OBJECT (device));
122         return device;
123 }
124
125 /**
126  * nm_device_wimax_get_hw_address:
127  * @wimax: a #NMDeviceWimax
128  *
129  * Gets the hardware (MAC) address of the #NMDeviceWimax
130  *
131  * Returns: the hardware address. This is the internal string used by the
132  *          device, and must not be modified.
133  *
134  * Deprecated: 1.2: WiMAX is no longer supported.
135  **/
136 const char *
137 nm_device_wimax_get_hw_address (NMDeviceWimax *wimax)
138 {
139         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);
140
141         _nm_object_ensure_inited (NM_OBJECT (wimax));
142         return NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->hw_address;
143 }
144
145 /**
146  * nm_device_wimax_get_active_nsp:
147  * @wimax: a #NMDeviceWimax
148  *
149  * Gets the active #NMWimaxNsp.
150  *
151  * Returns: (transfer full): the access point or %NULL if none is active
152  *
153  * Deprecated: 1.2: WiMAX is no longer supported.
154  **/
155 NMWimaxNsp *
156 nm_device_wimax_get_active_nsp (NMDeviceWimax *wimax)
157 {
158         NMDeviceState state;
159
160         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);
161
162         state = nm_device_get_state (NM_DEVICE (wimax));
163         switch (state) {
164         case NM_DEVICE_STATE_PREPARE:
165         case NM_DEVICE_STATE_CONFIG:
166         case NM_DEVICE_STATE_NEED_AUTH:
167         case NM_DEVICE_STATE_IP_CONFIG:
168         case NM_DEVICE_STATE_IP_CHECK:
169         case NM_DEVICE_STATE_SECONDARIES:
170         case NM_DEVICE_STATE_ACTIVATED:
171         case NM_DEVICE_STATE_DEACTIVATING:
172                 break;
173         default:
174                 return NULL;
175                 break;
176         }
177
178         _nm_object_ensure_inited (NM_OBJECT (wimax));
179         return NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->active_nsp;
180 }
181
182 /**
183  * nm_device_wimax_get_nsps:
184  * @wimax: a #NMDeviceWimax
185  *
186  * Gets all the scanned NSPs of the #NMDeviceWimax.
187  *
188  * Returns: (element-type NMWimaxNsp): a #GPtrArray containing
189  *          all the scanned #NMWimaxNsps.
190  * The returned array is owned by the client and should not be modified.
191  *
192  * Deprecated: 1.2: WiMAX is no longer supported.
193  **/
194 const GPtrArray *
195 nm_device_wimax_get_nsps (NMDeviceWimax *wimax)
196 {
197         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);
198
199         _nm_object_ensure_inited (NM_OBJECT (wimax));
200         return handle_ptr_array_return (NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->nsps);
201 }
202
203 /**
204  * nm_device_wimax_get_nsp_by_path:
205  * @wimax: a #NMDeviceWimax
206  * @path: the object path of the NSP
207  *
208  * Gets a #NMWimaxNsp by path.
209  *
210  * Returns: (transfer none): the access point or %NULL if none is found.
211  *
212  * Deprecated: 1.2: WiMAX is no longer supported.
213  **/
214 NMWimaxNsp *
215 nm_device_wimax_get_nsp_by_path (NMDeviceWimax *wimax,
216                                  const char *path)
217 {
218         const GPtrArray *nsps;
219         int i;
220         NMWimaxNsp *nsp = NULL;
221
222         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);
223         g_return_val_if_fail (path != NULL, NULL);
224
225         nsps = nm_device_wimax_get_nsps (wimax);
226         if (!nsps)
227                 return NULL;
228
229         for (i = 0; i < nsps->len; i++) {
230                 NMWimaxNsp *candidate = g_ptr_array_index (nsps, i);
231                 if (!strcmp (nm_object_get_path (NM_OBJECT (candidate)), path)) {
232                         nsp = candidate;
233                         break;
234                 }
235         }
236
237         return nsp;
238 }
239
240 static void
241 clean_up_nsps (NMDeviceWimax *self, gboolean notify)
242 {
243         NMDeviceWimaxPrivate *priv;
244
245         g_return_if_fail (NM_IS_DEVICE_WIMAX (self));
246
247         priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
248
249         if (priv->active_nsp) {
250                 g_object_unref (priv->active_nsp);
251                 priv->active_nsp = NULL;
252         }
253
254         if (priv->nsps) {
255                 while (priv->nsps->len) {
256                         NMWimaxNsp *nsp = NM_WIMAX_NSP (g_ptr_array_index (priv->nsps, 0));
257
258                         if (notify)
259                                 g_signal_emit (self, signals[NSP_REMOVED], 0, nsp);
260                         g_ptr_array_remove (priv->nsps, nsp);
261                         g_object_unref (nsp);
262                 }
263                 g_ptr_array_free (priv->nsps, TRUE);
264                 priv->nsps = NULL;
265         }
266 }
267
268 /**
269  * nm_device_wimax_get_center_frequency:
270  * @self: a #NMDeviceWimax
271  *
272  * Gets the center frequency (in KHz) of the radio channel the device is using
273  * to communicate with the network when connected.  Has no meaning when the
274  * device is not connected.
275  *
276  * Returns: the center frequency in KHz, or 0
277  *
278  * Deprecated: 1.2: WiMAX is no longer supported.
279  **/
280 guint
281 nm_device_wimax_get_center_frequency (NMDeviceWimax *self)
282 {
283         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0);
284
285         _nm_object_ensure_inited (NM_OBJECT (self));
286         return NM_DEVICE_WIMAX_GET_PRIVATE (self)->center_freq;
287 }
288
289 /**
290  * nm_device_wimax_get_rssi:
291  * @self: a #NMDeviceWimax
292  *
293  * Gets the RSSI of the current radio link in dBm.  This value indicates how
294  * strong the raw received RF signal from the base station is, but does not
295  * indicate the overall quality of the radio link.  Has no meaning when the
296  * device is not connected.
297  *
298  * Returns: the RSSI in dBm, or 0
299  *
300  * Deprecated: 1.2: WiMAX is no longer supported.
301  **/
302 gint
303 nm_device_wimax_get_rssi (NMDeviceWimax *self)
304 {
305         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0);
306
307         _nm_object_ensure_inited (NM_OBJECT (self));
308         return NM_DEVICE_WIMAX_GET_PRIVATE (self)->rssi;
309 }
310
311 /**
312  * nm_device_wimax_get_cinr:
313  * @self: a #NMDeviceWimax
314  *
315  * Gets the CINR (Carrier to Interference + Noise Ratio) of the current radio
316  * link in dB.  CINR is a more accurate measure of radio link quality.  Has no
317  * meaning when the device is not connected.
318  *
319  * Returns: the CINR in dB, or 0
320  *
321  * Deprecated: 1.2: WiMAX is no longer supported.
322  **/
323 gint
324 nm_device_wimax_get_cinr (NMDeviceWimax *self)
325 {
326         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0);
327
328         _nm_object_ensure_inited (NM_OBJECT (self));
329         return NM_DEVICE_WIMAX_GET_PRIVATE (self)->cinr;
330 }
331
332 /**
333  * nm_device_wimax_get_tx_power:
334  * @self: a #NMDeviceWimax
335  *
336  * Average power of the last burst transmitted by the device, in units of
337  * 0.5 dBm.  i.e. a TxPower of -11 represents an actual device TX power of
338  * -5.5 dBm.  Has no meaning when the device is not connected.
339  *
340  * Returns: the TX power in dBm, or 0
341  *
342  * Deprecated: 1.2: WiMAX is no longer supported.
343  **/
344 gint
345 nm_device_wimax_get_tx_power (NMDeviceWimax *self)
346 {
347         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0);
348
349         _nm_object_ensure_inited (NM_OBJECT (self));
350         return NM_DEVICE_WIMAX_GET_PRIVATE (self)->tx_power;
351 }
352
353 /**
354  * nm_device_wimax_get_bsid:
355  * @self: a #NMDeviceWimax
356  *
357  * Gets the ID of the serving Base Station when the device is connected.
358  *
359  * Returns: the ID of the serving Base Station, or %NULL
360  *
361  * Deprecated: 1.2: WiMAX is no longer supported.
362  **/
363 const char *
364 nm_device_wimax_get_bsid (NMDeviceWimax *self)
365 {
366         g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), NULL);
367
368         _nm_object_ensure_inited (NM_OBJECT (self));
369         return NM_DEVICE_WIMAX_GET_PRIVATE (self)->bsid;
370 }
371
372 static gboolean
373 connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
374 {
375         NMSettingConnection *s_con;
376         NMSettingWimax *s_wimax;
377         const char *ctype;
378         const GByteArray *mac;
379         const char *hw_str;
380         struct ether_addr *hw_mac;
381
382         s_con = nm_connection_get_setting_connection (connection);
383         g_assert (s_con);
384
385         ctype = nm_setting_connection_get_connection_type (s_con);
386         if (strcmp (ctype, NM_SETTING_WIMAX_SETTING_NAME) != 0) {
387                 g_set_error (error, NM_DEVICE_WIMAX_ERROR, NM_DEVICE_WIMAX_ERROR_NOT_WIMAX_CONNECTION,
388                              "The connection was not a Wimax connection.");
389                 return FALSE;
390         }
391
392         s_wimax = nm_connection_get_setting_wimax (connection);
393         if (!s_wimax) {
394                 g_set_error (error, NM_DEVICE_WIMAX_ERROR, NM_DEVICE_WIMAX_ERROR_INVALID_WIMAX_CONNECTION,
395                              "The connection was not a valid Wimax connection.");
396                 return FALSE;
397         }
398
399         /* Check MAC address */
400         hw_str = nm_device_wimax_get_hw_address (NM_DEVICE_WIMAX (device));
401         if (hw_str) {
402                 hw_mac = ether_aton (hw_str);
403                 if (!hw_mac) {
404                         g_set_error (error, NM_DEVICE_WIMAX_ERROR, NM_DEVICE_WIMAX_ERROR_INVALID_DEVICE_MAC,
405                                      "Invalid device MAC address.");
406                         return FALSE;
407                 }
408                 mac = nm_setting_wimax_get_mac_address (s_wimax);
409                 if (mac && hw_mac && memcmp (mac->data, hw_mac->ether_addr_octet, ETH_ALEN)) {
410                         g_set_error (error, NM_DEVICE_WIMAX_ERROR, NM_DEVICE_WIMAX_ERROR_MAC_MISMATCH,
411                                      "The MACs of the device and the connection didn't match.");
412                         return FALSE;
413                 }
414         }
415
416         return NM_DEVICE_CLASS (nm_device_wimax_parent_class)->connection_compatible (device, connection, error);
417 }
418
419 static GType
420 get_setting_type (NMDevice *device)
421 {
422         return NM_TYPE_SETTING_WIMAX;
423 }
424
425 static const char *
426 get_hw_address (NMDevice *device)
427 {
428         return nm_device_wimax_get_hw_address (NM_DEVICE_WIMAX (device));
429 }
430
431 /**************************************************************/
432
433 static void
434 nm_device_wimax_init (NMDeviceWimax *device)
435 {
436         _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_WIMAX);
437 }
438
439 static void
440 get_property (GObject *object,
441               guint prop_id,
442               GValue *value,
443               GParamSpec *pspec)
444 {
445         NMDeviceWimax *self = NM_DEVICE_WIMAX (object);
446
447         _nm_object_ensure_inited (NM_OBJECT (object));
448
449         switch (prop_id) {
450         case PROP_HW_ADDRESS:
451                 g_value_set_string (value, nm_device_wimax_get_hw_address (self));
452                 break;
453         case PROP_ACTIVE_NSP:
454                 g_value_set_object (value, nm_device_wimax_get_active_nsp (self));
455                 break;
456         case PROP_CENTER_FREQ:
457                 g_value_set_uint (value, nm_device_wimax_get_center_frequency (self));
458                 break;
459         case PROP_RSSI:
460                 g_value_set_int (value, nm_device_wimax_get_rssi (self));
461                 break;
462         case PROP_CINR:
463                 g_value_set_int (value, nm_device_wimax_get_cinr (self));
464                 break;
465         case PROP_TX_POWER:
466                 g_value_set_int (value, nm_device_wimax_get_tx_power (self));
467                 break;
468         case PROP_BSID:
469                 g_value_set_string (value, nm_device_wimax_get_bsid (self));
470                 break;
471         case PROP_NSPS:
472                 g_value_set_boxed (value, nm_device_wimax_get_nsps (self));
473                 break;
474         default:
475                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
476                 break;
477         }
478 }
479
480 static void
481 clear_link_status (NMDeviceWimax *self)
482 {
483         NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
484
485         if (priv->center_freq) {
486                 priv->center_freq = 0;
487                 _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_CENTER_FREQUENCY);
488         }
489
490         if (priv->rssi) {
491                 priv->rssi = 0;
492                 _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_RSSI);
493         }
494
495         if (priv->cinr) {
496                 priv->cinr = 0;
497                 _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_CINR);
498         }
499
500         if (priv->tx_power) {
501                 priv->tx_power = 0;
502                 _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_TX_POWER);
503         }
504
505         if (priv->bsid) {
506                 g_free (priv->bsid);
507                 priv->bsid = NULL;
508                 _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_BSID);
509         }
510 }
511
512 static void
513 state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
514 {
515         NMDeviceWimax *self = NM_DEVICE_WIMAX (device);
516         NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
517         NMDeviceState state;
518
519         state = nm_device_get_state (device);
520         switch (state) {
521         case NM_DEVICE_STATE_UNKNOWN:
522         case NM_DEVICE_STATE_UNMANAGED:
523         case NM_DEVICE_STATE_UNAVAILABLE:
524         case NM_DEVICE_STATE_DISCONNECTED:
525         case NM_DEVICE_STATE_FAILED:
526                 if (priv->active_nsp) {
527                         g_object_unref (priv->active_nsp);
528                         priv->active_nsp = NULL;
529                 }
530                 _nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_WIMAX_ACTIVE_NSP);
531                 clear_link_status (self);
532                 break;
533         case NM_DEVICE_STATE_PREPARE:
534         case NM_DEVICE_STATE_CONFIG:
535         case NM_DEVICE_STATE_NEED_AUTH:
536         case NM_DEVICE_STATE_IP_CONFIG:
537                 clear_link_status (self);
538                 break;
539         default:
540                 break;
541         }
542 }
543
544 static void
545 register_properties (NMDeviceWimax *wimax)
546 {
547         NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (wimax);
548         const NMPropertiesInfo property_info[] = {
549                 { NM_DEVICE_WIMAX_HW_ADDRESS,       &priv->hw_address },
550                 { NM_DEVICE_WIMAX_ACTIVE_NSP,       &priv->active_nsp, NULL, NM_TYPE_WIMAX_NSP },
551                 { NM_DEVICE_WIMAX_CENTER_FREQUENCY, &priv->center_freq },
552                 { NM_DEVICE_WIMAX_RSSI,             &priv->rssi },
553                 { NM_DEVICE_WIMAX_CINR,             &priv->cinr },
554                 { NM_DEVICE_WIMAX_TX_POWER,         &priv->tx_power },
555                 { NM_DEVICE_WIMAX_BSID,             &priv->bsid },
556                 { NM_DEVICE_WIMAX_NSPS,             &priv->nsps,       NULL, NM_TYPE_WIMAX_NSP, "nsp" },
557                 { NULL },
558         };
559
560         _nm_object_register_properties (NM_OBJECT (wimax),
561                                         priv->proxy,
562                                         property_info);
563 }
564
565 static void
566 nsp_removed (NMDeviceWimax *self, NMWimaxNsp *nsp)
567 {
568         NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
569
570         if (nsp == priv->active_nsp) {
571                 g_object_unref (priv->active_nsp);
572                 priv->active_nsp = NULL;
573                 _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_ACTIVE_NSP);
574         }
575 }
576
577 static void
578 constructed (GObject *object)
579 {
580         NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (object);
581
582         G_OBJECT_CLASS (nm_device_wimax_parent_class)->constructed (object);
583
584         priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_WIMAX);
585         register_properties (NM_DEVICE_WIMAX (object));
586
587         g_signal_connect (object,
588                           "notify::" NM_DEVICE_STATE,
589                           G_CALLBACK (state_changed_cb),
590                           NULL);
591 }
592
593 static void
594 dispose (GObject *object)
595 {
596         NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (object);
597
598         if (priv->hw_address) {
599                 g_free (priv->hw_address);
600                 priv->hw_address = NULL;
601         }
602
603         if (priv->bsid) {
604                 g_free (priv->bsid);
605                 priv->bsid = NULL;
606         }
607
608         clean_up_nsps (NM_DEVICE_WIMAX (object), FALSE);
609         g_clear_object (&priv->proxy);
610
611         G_OBJECT_CLASS (nm_device_wimax_parent_class)->dispose (object);
612 }
613
614 static void
615 nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class)
616 {
617         GObjectClass *object_class = G_OBJECT_CLASS (wimax_class);
618         NMDeviceClass *device_class = NM_DEVICE_CLASS (wimax_class);
619
620         g_type_class_add_private (wimax_class, sizeof (NMDeviceWimaxPrivate));
621
622         /* virtual methods */
623         object_class->constructed = constructed;
624         object_class->get_property = get_property;
625         object_class->dispose = dispose;
626         device_class->connection_compatible = connection_compatible;
627         device_class->get_setting_type = get_setting_type;
628         device_class->get_hw_address = get_hw_address;
629         wimax_class->nsp_removed = nsp_removed;
630
631         /* properties */
632
633         /**
634          * NMDeviceWimax:hw-address:
635          *
636          * The hardware (MAC) address of the device.
637          *
638          * Deprecated: 1.2: WiMAX is no longer supported.
639          **/
640         g_object_class_install_property
641                 (object_class, PROP_HW_ADDRESS,
642                  g_param_spec_string (NM_DEVICE_WIMAX_HW_ADDRESS, "", "",
643                                       NULL,
644                                       G_PARAM_READABLE |
645                                       G_PARAM_STATIC_STRINGS));
646
647         /**
648          * NMDeviceWimax:active-nsp:
649          *
650          * The active #NMWimaxNsp of the device.
651          *
652          * Deprecated: 1.2: WiMAX is no longer supported.
653          **/
654         g_object_class_install_property
655                 (object_class, PROP_ACTIVE_NSP,
656                  g_param_spec_object (NM_DEVICE_WIMAX_ACTIVE_NSP, "", "",
657                                       NM_TYPE_WIMAX_NSP,
658                                       G_PARAM_READABLE |
659                                       G_PARAM_STATIC_STRINGS));
660
661         /**
662          * NMDeviceWimax:center-frequency:
663          *
664          * The center frequency (in KHz) of the radio channel the device is using to
665          * communicate with the network when connected.  Has no meaning when the
666          * device is not connected.
667          *
668          * Deprecated: 1.2: WiMAX is no longer supported.
669          **/
670         g_object_class_install_property
671                 (object_class, PROP_CENTER_FREQ,
672                  g_param_spec_uint (NM_DEVICE_WIMAX_CENTER_FREQUENCY, "", "",
673                                     0, G_MAXUINT, 0,
674                                     G_PARAM_READABLE |
675                                     G_PARAM_STATIC_STRINGS));
676
677         /**
678          * NMDeviceWimax:rssi:
679          *
680          * RSSI of the current radio link in dBm.  This value indicates how strong
681          * the raw received RF signal from the base station is, but does not
682          * indicate the overall quality of the radio link.  Has no meaning when the
683          * device is not connected.
684          *
685          * Deprecated: 1.2: WiMAX is no longer supported.
686          **/
687         g_object_class_install_property
688                 (object_class, PROP_RSSI,
689                  g_param_spec_int (NM_DEVICE_WIMAX_RSSI, "", "",
690                                    G_MININT, G_MAXINT, 0,
691                                    G_PARAM_READABLE |
692                                    G_PARAM_STATIC_STRINGS));
693
694         /**
695          * NMDeviceWimax:cinr:
696          *
697          * CINR (Carrier to Interference + Noise Ratio) of the current radio link
698          * in dB.  CINR is a more accurate measure of radio link quality.  Has no
699          * meaning when the device is not connected.
700          *
701          * Deprecated: 1.2: WiMAX is no longer supported.
702          **/
703         g_object_class_install_property
704                 (object_class, PROP_CINR,
705                  g_param_spec_int (NM_DEVICE_WIMAX_CINR, "", "",
706                                    G_MININT, G_MAXINT, 0,
707                                    G_PARAM_READABLE |
708                                    G_PARAM_STATIC_STRINGS));
709
710         /**
711          * NMDeviceWimax:tx-power:
712          *
713          * Average power of the last burst transmitted by the device, in units of
714          * 0.5 dBm.  i.e. a TxPower of -11 represents an actual device TX power of
715          * -5.5 dBm.  Has no meaning when the device is not connected.
716          *
717          * Deprecated: 1.2: WiMAX is no longer supported.
718          **/
719         g_object_class_install_property
720                 (object_class, PROP_TX_POWER,
721                  g_param_spec_int (NM_DEVICE_WIMAX_TX_POWER, "", "",
722                                    G_MININT, G_MAXINT, 0,
723                                    G_PARAM_READABLE |
724                                    G_PARAM_STATIC_STRINGS));
725
726         /**
727          * NMDeviceWimax:bsid:
728          *
729          * The ID of the serving base station as received from the network.  Has
730          * no meaning when the device is not connected.
731          *
732          * Deprecated: 1.2: WiMAX is no longer supported.
733          **/
734         g_object_class_install_property
735                 (object_class, PROP_BSID,
736                  g_param_spec_string (NM_DEVICE_WIMAX_BSID, "", "",
737                                       NULL,
738                                       G_PARAM_READABLE |
739                                       G_PARAM_STATIC_STRINGS));
740
741         /**
742          * NMDeviceWimax:nsps:
743          *
744          * List of all WiMAX Network Service Providers the device can see.
745          *
746          * Since: 0.9.10
747          * Deprecated: 1.2: WiMAX is no longer supported.
748          **/
749         g_object_class_install_property
750                 (object_class, PROP_NSPS,
751                  g_param_spec_boxed (NM_DEVICE_WIMAX_NSPS, "", "",
752                                      NM_TYPE_OBJECT_ARRAY,
753                                      G_PARAM_READABLE |
754                                      G_PARAM_STATIC_STRINGS));
755
756         /* signals */
757
758         /**
759          * NMDeviceWimax::nsp-added:
760          * @self: the wimax device that received the signal
761          * @nsp: the new NSP
762          *
763          * Notifies that a #NMWimaxNsp is added to the wimax device.
764          *
765          * Deprecated: 1.2: WiMAX is no longer supported.
766          **/
767         signals[NSP_ADDED] =
768                 g_signal_new ("nsp-added",
769                               G_OBJECT_CLASS_TYPE (object_class),
770                               G_SIGNAL_RUN_FIRST,
771                               G_STRUCT_OFFSET (NMDeviceWimaxClass, nsp_added),
772                               NULL, NULL,
773                               g_cclosure_marshal_VOID__OBJECT,
774                               G_TYPE_NONE, 1,
775                               G_TYPE_OBJECT);
776
777         /**
778          * NMDeviceWimax::nsp-removed:
779          * @self: the wimax device that received the signal
780          * @nsp: the removed NSP
781          *
782          * Notifies that a #NMWimaxNsp is removed from the wimax device.
783          *
784          * Deprecated: 1.2: WiMAX is no longer supported.
785          **/
786         signals[NSP_REMOVED] =
787                 g_signal_new ("nsp-removed",
788                               G_OBJECT_CLASS_TYPE (object_class),
789                               G_SIGNAL_RUN_FIRST,
790                               G_STRUCT_OFFSET (NMDeviceWimaxClass, nsp_removed),
791                               NULL, NULL,
792                               g_cclosure_marshal_VOID__OBJECT,
793                               G_TYPE_NONE, 1,
794                               G_TYPE_OBJECT);
795 }