Merge "Add dbus method for getting wifi passphrase" into tizen
[platform/core/connectivity/net-config.git] / include / wifi-config.h
1 /*
2  * Network Configuration Module
3  *
4  * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __NETCONFIG_WIFI_CONFIG_H__
21 #define __NETCONFIG_WIFI_CONFIG_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include "wifi.h"
28
29 // Configuration Field key
30 #define WIFI_CONFIG_NAME                                "Name"
31 #define WIFI_CONFIG_SSID                                "SSID"
32 #define WIFI_CONFIG_PASSPHRASE          "Passphrase"
33 #define WIFI_CONFIG_SECURITY_TYPE               "Security"
34 #define WIFI_CONFIG_FAVORITE                    "Favorite"
35 #define WIFI_CONFIG_AUTOCONNECT         "AutoConnect"
36 #define WIFI_CONFIG_MODIFIED            "Modified"
37 #define WIFI_CONFIG_HIDDEN                              "Hidden"
38 #define WIFI_CONFIG_FREQUENCY                   "Frequency"
39 #define WIFI_CONFIG_CREATED                             "Created"
40 #define WIFI_CONFIG_IPV4_METHOD                 "IPv4.method"
41 #define WIFI_CONFIG_IPV6_METHOD                 "IPv6.method"
42 #define WIFI_CONFIG_IPV4_DNS_METHOD                     "Nameservers.IPv4method"
43 #define WIFI_CONFIG_IPV6_DNS_METHOD                     "Nameservers.IPv6method"
44 #define WIFI_CONFIG_IPV4_ADDRESS                        "IPv4.local_address"
45 #define WIFI_CONFIG_IPV4_SUBNET_MASK                    "IPv4.netmask_prefixlen"
46 #define WIFI_CONFIG_IPV6_PREFIX_LEN                     "IPv6.netmask_prefixlen"
47 #define WIFI_CONFIG_IPV4_GATEWAY_ADDRESS                "IPv4.gateway"
48 #define WIFI_CONFIG_DNS_ADDRESS                 "Nameservers"
49 #define WIFI_CONFIG_FAILURE                     "Failure"
50 #define WIFI_CONFIG_PROXYADDRESS                "ProxyAddress"
51 #define WIFI_CONFIG_PROXY_METHOD                "Proxy.Method"
52 #define WIFI_CONFIG_PROXY_SERVER                "Proxy.Servers"
53 #define WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY                      "AnonymousIdentity"
54 #define WIFI_CONFIG_EAP_CACERT                  "CACertFile"
55 #define WIFI_CONFIG_EAP_CLIENTCERT                      "ClientCertFile"
56 #define WIFI_CONFIG_EAP_PRIVATEKEY              "PrivateKeyFile"
57 #define WIFI_CONFIG_EAP_PRIVATEKEY_PASSWORD     "PrivateKeyPassword"
58 #define WIFI_CONFIG_EAP_IDENTITY                "Identity"
59 #define WIFI_CONFIG_EAP_TYPE            "EapType"
60 #define WIFI_CONFIG_EAP_AUTH_TYPE       "EapAuthType"
61 #define WIFI_CONFIG_EAP_SUBJECT_MATCH   "SubjectMatch"
62
63 #define WIFI_MAC_PATH_LENGTH    64
64 #define WIFI_MAC_ADDR_LENGTH    17
65 #define WIFI_MAC_ADDR_PATH              "/sys/class/net/%s/address"
66
67 /**
68  * This enumeration is used in frame id value in vsie method calls
69  */
70 typedef enum {
71         NETCONFIG_VSIE_FRAME_ASSOC_REQ = 13,
72         NETCONFIG_VSIE_FRAME_PROBE_REQ = 14,
73         NETCONFIG_VSIE_FRAME_REASSOC = 15,
74         NETCONFIG_VSIE_FRAME_AUTH_REQ = 16,
75         NETCONFIG_VSIE_FRAME_ACTION = 17,
76         NETCONFIG_VSIE_FRAME_MAX
77 } netconfig_vsie_frames_e;
78
79 gboolean wifi_config_get_config_id(const gchar *service_profile, gchar **config_id);
80 gboolean wifi_config_remove_configuration(const gchar *interface_name,
81                 const gchar *config_id);
82 gboolean wifi_config_save_configuration(const gchar *interface_name,
83                 const gchar *config_id, GKeyFile *keyfile);
84 gboolean wifi_config_get_group_name(const gchar *prefix,
85                 const gchar *interface_name, const gchar *config_id, gchar **group_name);
86 int __netconfig_hex_str_to_bin(const char *hex, unsigned char *buf, size_t len);
87 int __netconfig_hex_to_byte(const char *hex);
88 int __netconfig_hex_char_to_num(char c);
89
90 gboolean handle_get_config_ids(Wifi *wifi, GDBusMethodInvocation *context,
91                         const gchar *ifname);
92 gboolean handle_load_configuration(Wifi *wifi, GDBusMethodInvocation *context,
93                         const gchar *ifname, const gchar *config_id);
94 gboolean handle_save_configuration(Wifi *wifi, GDBusMethodInvocation *context,
95                         const gchar *ifname, const gchar *config_id, GVariant *configuration);
96 gboolean handle_load_eap_configuration(Wifi *wifi, GDBusMethodInvocation *context,
97                         const gchar *ifname, const gchar *config_id);
98 gboolean handle_save_eap_configuration(Wifi *wifi, GDBusMethodInvocation *context,
99                         const gchar *ifname, const gchar *config_id, GVariant *configuration);
100 gboolean handle_remove_configuration(Wifi *wifi, GDBusMethodInvocation *context,
101                         const gchar *ifname, const gchar *config_id);
102 gboolean handle_reset_wifi_config(Wifi *wifi, GDBusMethodInvocation *context);
103 gboolean handle_set_config_field(Wifi *wifi, GDBusMethodInvocation *context,
104                         const gchar *ifname, const gchar *config_id, const gchar *key, const gchar *value);
105 gboolean handle_get_config_passphrase(Wifi *wifi, GDBusMethodInvocation *context,
106                         const gchar *ifname, const gchar *config_id);
107
108 gboolean handle_add_vsie(Wifi *wifi, GDBusMethodInvocation *context,
109                         const gchar *ifname, int frame_id, const gchar *vsie);
110 gboolean handle_get_vsie(Wifi *wifi, GDBusMethodInvocation *context,
111                         const gchar *ifname, int frame_id);
112 gboolean handle_remove_vsie(Wifi *wifi, GDBusMethodInvocation *context,
113                         const gchar *ifname, int frame_id, const gchar *vsie);
114
115 #ifdef __cplusplus
116 }
117 #endif
118
119 #endif /* __NETCONFIG_WIFI_CONFIG_H */