summaryrefslogtreecommitdiff
path: root/panels/network/wireless-security/wireless-security.h
blob: d4e44ea10f4d3d9473e81d32bf4e4707962b1ab7 (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 Applet -- allow user control over networking
 *
 * Dan Williams <dcbw@redhat.com>
 *
 * 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 2007 - 2014 Red Hat, Inc.
 */

#ifndef WIRELESS_SECURITY_H
#define WIRELESS_SECURITY_H

#include <gtk/gtk.h>

#define WIRELESS_TYPE_SECURITY (wireless_security_get_type ())

typedef struct _WirelessSecurity WirelessSecurity;
typedef struct _WirelessSecurityPrivate WirelessSecurityPrivate;

typedef void (*WSChangedFunc) (WirelessSecurity *sec, gpointer user_data);

typedef void (*WSAddToSizeGroupFunc)  (WirelessSecurity *sec, GtkSizeGroup *group);
typedef void (*WSFillConnectionFunc)  (WirelessSecurity *sec, NMConnection *connection);
typedef void (*WSDestroyFunc)         (WirelessSecurity *sec);
typedef gboolean (*WSValidateFunc)    (WirelessSecurity *sec, GError **error);
typedef GtkWidget* (*WSGetWidgetFunc) (WirelessSecurity *sec);

struct _WirelessSecurity {
	WirelessSecurityPrivate *priv;
};

#define WIRELESS_SECURITY(x) ((WirelessSecurity *) x)


GtkWidget *wireless_security_get_widget (WirelessSecurity *sec);

void wireless_security_set_changed_notify (WirelessSecurity *sec,
                                           WSChangedFunc func,
                                           gpointer user_data);

gboolean wireless_security_validate (WirelessSecurity *sec, GError **error);

void wireless_security_add_to_size_group (WirelessSecurity *sec,
                                          GtkSizeGroup *group);

void wireless_security_fill_connection (WirelessSecurity *sec,
                                        NMConnection *connection);

void wireless_security_set_adhoc_compatible (WirelessSecurity *sec,
                                             gboolean adhoc_compatible);

gboolean wireless_security_adhoc_compatible (WirelessSecurity *sec);

const gchar *wireless_security_get_username (WirelessSecurity *sec);

const gchar *wireless_security_get_password (WirelessSecurity *sec);

gboolean wireless_security_get_always_ask (WirelessSecurity *sec);

gboolean wireless_security_get_show_password (WirelessSecurity *sec);

void wireless_security_set_userpass (WirelessSecurity *sec,
                                     const char *user,
                                     const char *password,
                                     gboolean always_ask,
                                     gboolean show_password);

WirelessSecurity *wireless_security_ref (WirelessSecurity *sec);

void wireless_security_unref (WirelessSecurity *sec);

GType wireless_security_get_type (void);

/* Below for internal use only */

WirelessSecurity *wireless_security_init (gsize obj_size,
                                          WSGetWidgetFunc get_widget,
                                          WSValidateFunc validate,
                                          WSAddToSizeGroupFunc add_to_size_group,
                                          WSFillConnectionFunc fill_connection,
                                          WSDestroyFunc destroy);

void wireless_security_notify_changed (WirelessSecurity *sec);

void wireless_security_clear_ciphers (NMConnection *connection);

#define AUTH_NAME_COLUMN   0
#define AUTH_METHOD_COLUMN 1

void ws_802_1x_auth_combo_init (WirelessSecurity *sec,
                                GtkComboBox *combo,
                                NMConnection *connection,
                                gboolean is_editor,
                                gboolean secrets_only);

void ws_802_1x_auth_combo_changed (GtkComboBox *combo,
                                   GtkBox *vbox,
                                   GtkSizeGroup *size_group);

#include "eap-method.h"

EAPMethod *ws_802_1x_auth_combo_get_eap (GtkComboBox *combo);

void ws_802_1x_fill_connection (GtkComboBox *combo,
                                NMConnection *connection);

G_DEFINE_AUTOPTR_CLEANUP_FUNC (WirelessSecurity, wireless_security_unref)

#endif /* WIRELESS_SECURITY_H */