Qt 4.8
Macros | Functions
wlan-utils.h File Reference
#include <glib.h>
#include <dbus/dbus.h>
#include <wlancond.h>
#include <icd/network_api_defines.h>

Go to the source code of this file.

Macros

#define CAP_LOCALMASK   0x0FFFE008
 
#define CAP_SHIFT_ALGORITHM   20
 
#define CAP_SHIFT_ALWAYS_ONLINE   26
 
#define CAP_SHIFT_METHOD   1
 
#define CAP_SHIFT_MODE   0
 
#define CAP_SHIFT_WPA2   1
 
#define CAP_SHIFT_WPS   3
 
#define NWATTR_ALGORITHM_MASK   0x00000F00
 
#define NWATTR_METHOD_MASK   0x00000078
 
#define NWATTR_MODE_MASK   0x00000007
 
#define NWATTR_WPA2_MASK   0x00000080
 
#define NWATTR_WPS_MASK   0x0000F000
 

Functions

static guint cap2nwattr (dbus_uint32_t cap, guint *nwattrs)
 
static dbus_uint32_t nwattr2cap (guint nwattrs, dbus_uint32_t *cap)
 

Macro Definition Documentation

◆ CAP_LOCALMASK

#define CAP_LOCALMASK   0x0FFFE008

Definition at line 60 of file wlan-utils.h.

Referenced by nwattr2cap().

◆ CAP_SHIFT_ALGORITHM

#define CAP_SHIFT_ALGORITHM   20

Definition at line 64 of file wlan-utils.h.

Referenced by cap2nwattr(), and nwattr2cap().

◆ CAP_SHIFT_ALWAYS_ONLINE

#define CAP_SHIFT_ALWAYS_ONLINE   26

Definition at line 68 of file wlan-utils.h.

Referenced by nwattr2cap().

◆ CAP_SHIFT_METHOD

#define CAP_SHIFT_METHOD   1

Definition at line 66 of file wlan-utils.h.

Referenced by cap2nwattr(), and nwattr2cap().

◆ CAP_SHIFT_MODE

#define CAP_SHIFT_MODE   0

Definition at line 67 of file wlan-utils.h.

◆ CAP_SHIFT_WPA2

#define CAP_SHIFT_WPA2   1

Definition at line 65 of file wlan-utils.h.

Referenced by cap2nwattr(), and nwattr2cap().

◆ CAP_SHIFT_WPS

#define CAP_SHIFT_WPS   3

Definition at line 63 of file wlan-utils.h.

Referenced by cap2nwattr(), and nwattr2cap().

◆ NWATTR_ALGORITHM_MASK

#define NWATTR_ALGORITHM_MASK   0x00000F00

Definition at line 55 of file wlan-utils.h.

Referenced by nwattr2cap().

◆ NWATTR_METHOD_MASK

#define NWATTR_METHOD_MASK   0x00000078

Definition at line 57 of file wlan-utils.h.

Referenced by nwattr2cap().

◆ NWATTR_MODE_MASK

#define NWATTR_MODE_MASK   0x00000007

Definition at line 58 of file wlan-utils.h.

Referenced by nwattr2cap().

◆ NWATTR_WPA2_MASK

#define NWATTR_WPA2_MASK   0x00000080

Definition at line 56 of file wlan-utils.h.

Referenced by nwattr2cap().

◆ NWATTR_WPS_MASK

#define NWATTR_WPS_MASK   0x0000F000

Originally taken from: libicd-network-wlan-dev.h

Definition at line 54 of file wlan-utils.h.

Referenced by nwattr2cap().

Function Documentation

◆ cap2nwattr()

static guint cap2nwattr ( dbus_uint32_t  cap,
guint *  nwattrs 
)
inlinestatic

Definition at line 91 of file wlan-utils.h.

Referenced by getNetworkAttrs().

92 {
93  guint oldval = *nwattrs;
94 
95  *nwattrs &= ~ICD_NW_ATTR_LOCALMASK; /* clear old capabilities */
96  *nwattrs |=
97 #ifdef WLANCOND_WPS_MASK
98  ((cap & WLANCOND_WPS_MASK) << CAP_SHIFT_WPS) |
99 #endif
100  ((cap & (WLANCOND_ENCRYPT_ALG_MASK |
101  WLANCOND_ENCRYPT_GROUP_ALG_MASK)) >> CAP_SHIFT_ALGORITHM)|
102  ((cap & WLANCOND_ENCRYPT_WPA2_MASK) >> CAP_SHIFT_WPA2) |
103  ((cap & WLANCOND_ENCRYPT_METHOD_MASK) >> CAP_SHIFT_METHOD) |
104  (cap & WLANCOND_MODE_MASK);
105 
106  return oldval;
107 }
#define CAP_SHIFT_ALGORITHM
Definition: wlan-utils.h:64
#define CAP_SHIFT_WPA2
Definition: wlan-utils.h:65
#define CAP_SHIFT_WPS
Definition: wlan-utils.h:63
#define CAP_SHIFT_METHOD
Definition: wlan-utils.h:66

◆ nwattr2cap()

static dbus_uint32_t nwattr2cap ( guint  nwattrs,
dbus_uint32_t *  cap 
)
inlinestatic

Definition at line 72 of file wlan-utils.h.

Referenced by network_attrs_to_security().

73 {
74  guint oldval = *cap;
75 
76  *cap &= CAP_LOCALMASK; /* clear old capabilities */
77  *cap |=
78  ((nwattrs & ICD_NW_ATTR_ALWAYS_ONLINE) >> CAP_SHIFT_ALWAYS_ONLINE) |
79  ((nwattrs & NWATTR_WPS_MASK) >> CAP_SHIFT_WPS) |
81  ((nwattrs & NWATTR_WPA2_MASK) << CAP_SHIFT_WPA2) |
82  ((nwattrs & NWATTR_METHOD_MASK) << CAP_SHIFT_METHOD) |
83  (nwattrs & NWATTR_MODE_MASK);
84 
85  return oldval;
86 }
#define CAP_SHIFT_ALGORITHM
Definition: wlan-utils.h:64
#define CAP_SHIFT_WPA2
Definition: wlan-utils.h:65
#define NWATTR_WPA2_MASK
Definition: wlan-utils.h:56
#define CAP_LOCALMASK
Definition: wlan-utils.h:60
#define NWATTR_METHOD_MASK
Definition: wlan-utils.h:57
#define NWATTR_WPS_MASK
Definition: wlan-utils.h:54
#define CAP_SHIFT_WPS
Definition: wlan-utils.h:63
#define NWATTR_ALGORITHM_MASK
Definition: wlan-utils.h:55
#define NWATTR_MODE_MASK
Definition: wlan-utils.h:58
#define CAP_SHIFT_METHOD
Definition: wlan-utils.h:66
#define CAP_SHIFT_ALWAYS_ONLINE
Definition: wlan-utils.h:68