summaryrefslogtreecommitdiff
path: root/src/devices/wifi/nm-wifi-ap.h
blob: bcbf7eea0ea6f4bb0d6e86c230531963de81d68b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager -- Network link manager
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Copyright (C) 2004 - 2011 Red Hat, Inc.
 * Copyright (C) 2006 - 2008 Novell, Inc.
 */

#ifndef __NETWORKMANAGER_ACCESS_POINT_H__
#define __NETWORKMANAGER_ACCESS_POINT_H__

#include <glib.h>
#include <glib-object.h>
#include "nm-dbus-interface.h"
#include "nm-connection.h"

#define NM_TYPE_AP            (nm_ap_get_type ())
#define NM_AP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_AP, NMAccessPoint))
#define NM_AP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_AP, NMAccessPointClass))
#define NM_IS_AP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_AP))
#define NM_IS_AP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_AP))
#define NM_AP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_AP, NMAccessPointClass))

#define NM_AP_FLAGS "flags"
#define NM_AP_WPA_FLAGS "wpa-flags"
#define NM_AP_RSN_FLAGS "rsn-flags"
#define NM_AP_SSID "ssid"
#define NM_AP_FREQUENCY "frequency"
#define NM_AP_HW_ADDRESS "hw-address"
#define NM_AP_MODE "mode"
#define NM_AP_MAX_BITRATE "max-bitrate"
#define NM_AP_STRENGTH "strength"

typedef struct {
	GObject parent;
} NMAccessPoint;

typedef struct {
	GObjectClass parent;

} NMAccessPointClass;

GType nm_ap_get_type (void);

NMAccessPoint * nm_ap_new_from_properties (const char *supplicant_path,
                                           GVariant *properties);
NMAccessPoint * nm_ap_new_fake_from_connection (NMConnection *connection);
void            nm_ap_export_to_dbus    (NMAccessPoint *ap);

void            nm_ap_update_from_properties (NMAccessPoint *ap,
                                              const char *supplicant_path,
                                              GVariant *properties);

const char *nm_ap_get_dbus_path (NMAccessPoint *ap);

const char *nm_ap_get_supplicant_path (NMAccessPoint *ap);
void        nm_ap_set_supplicant_path (NMAccessPoint *ap,
                                       const char *path);

guint32     nm_ap_get_id (NMAccessPoint *ap);

const GByteArray *nm_ap_get_ssid (const NMAccessPoint * ap);
void              nm_ap_set_ssid (NMAccessPoint * ap, const guint8 * ssid, gsize len);

NM80211ApFlags nm_ap_get_flags (NMAccessPoint *ap);
void           nm_ap_set_flags (NMAccessPoint *ap, NM80211ApFlags flags);

NM80211ApSecurityFlags nm_ap_get_wpa_flags (NMAccessPoint *ap);
void                   nm_ap_set_wpa_flags (NMAccessPoint *ap, NM80211ApSecurityFlags flags);

NM80211ApSecurityFlags nm_ap_get_rsn_flags (NMAccessPoint *ap);
void                   nm_ap_set_rsn_flags (NMAccessPoint *ap, NM80211ApSecurityFlags flags);

const char *nm_ap_get_address (const NMAccessPoint *ap);
void        nm_ap_set_address (NMAccessPoint *ap, const char *addr);

NM80211Mode nm_ap_get_mode (NMAccessPoint *ap);
void        nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode);

gboolean nm_ap_is_hotspot (NMAccessPoint *ap);

gint8 nm_ap_get_strength (NMAccessPoint *ap);
void  nm_ap_set_strength (NMAccessPoint *ap, gint8 strength);

guint32 nm_ap_get_freq (NMAccessPoint *ap);
void    nm_ap_set_freq (NMAccessPoint *ap, guint32 freq);

guint32 nm_ap_get_max_bitrate (NMAccessPoint *ap);
void    nm_ap_set_max_bitrate (NMAccessPoint *ap, guint32 bitrate);

gboolean nm_ap_get_fake (const NMAccessPoint *ap);
void     nm_ap_set_fake (NMAccessPoint *ap, gboolean fake);

gint32   nm_ap_get_last_seen (const NMAccessPoint *ap);
void     nm_ap_set_last_seen (NMAccessPoint *ap, gint32 last_seen);

gboolean nm_ap_check_compatible (NMAccessPoint *self,
                                 NMConnection *connection);

gboolean nm_ap_complete_connection (NMAccessPoint *self,
                                    NMConnection *connection,
                                    gboolean lock_bssid,
                                    GError **error);

NMAccessPoint *     nm_ap_match_in_hash (NMAccessPoint *find_ap, GHashTable *hash);

void                nm_ap_dump (NMAccessPoint *ap, const char *prefix);

#endif /* __NETWORKMANAGER_ACCESS_POINT_H__ */