2 * Network Configuration Module
4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef __NETCONFIG_UTIL_H__
21 #define __NETCONFIG_UTIL_H__
33 #define NETCONFIG_TIZEN_SYSTEM_ENV "/run/tizen-system-env"
35 #define MAX_SIZE_ERROR_BUFFER 256
37 #define ETHERNET_FEATURE "http://tizen.org/feature/network.ethernet"
38 #define TETHERING_FEATURE "http://tizen.org/feature/network.tethering"
39 #define WIFI_DIRECT_FEATURE "http://tizen.org/feature/network.wifi.direct"
40 #define WIFI_SOFTAP_FEATURE "http://tizen.org/feature/network.wifi.softap"
42 /** Macros to handle rtattributes */
44 #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
45 #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len))
46 #define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
47 #define NLMSG_TAIL(nmsg) \
48 ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
51 NETCONFIG_SUPPORTED_FEATURE_ETHERNET = 0,
52 NETCONFIG_SUPPORTED_FEATURE_TETHERING,
53 NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT,
54 NETCONFIG_SUPPORTED_FEATURE_WIFI_SOFTAP,
55 NETCONFIG_SUPPORTED_FEATURE_MAX,
56 } netconfig_supported_feature_e;
58 bool netconfig_check_feature_supported(netconfig_supported_feature_e feature);
60 gboolean netconfig_check_passphrase(const gchar *service, const char *passphrase);
61 GKeyFile *netconfig_keyfile_load(const char *pathname);
62 void netconfig_keyfile_save(GKeyFile *keyfile, const char *pathname);
64 void netconfig_start_timer_seconds(guint secs,
65 gboolean(*callback) (gpointer), void *user_data, guint *timer_id);
66 void netconfig_start_timer(guint msecs,
67 gboolean(*callback) (gpointer), void *user_data, guint *timer_id);
68 void netconfig_stop_timer(guint *timer_id);
70 void netconfig_wifi_enable_device_picker_test(void);
71 void netconfig_wifi_device_picker_service_start(void);
72 void netconfig_wifi_device_picker_service_stop(void);
74 gboolean netconfig_is_wifi_direct_on(void);
75 gboolean netconfig_is_wifi_tethering_on(void);
77 gboolean netconfig_interface_up(const char *ifname);
78 gboolean netconfig_interface_down(const char *ifname);
79 int __netconfig_get_interface_index(const char *interface_name);
81 int netconfig_execute_cmd(const char *cmd);
82 int netconfig_execute_file(const char *file_path, char *const args[], char *const env[]);
83 int netconfig_execute_file_no_wait(const char *file_path,
85 int netconfig_execute_clatd(const char *file_path, char *const args[]);
86 int netconfig_add_route_ipv6(gchar *interface, gchar *gateway);
87 int netconfig_del_route_ipv6(gchar *interface, gchar *gateway);
88 int netconfig_add_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gint address_family);
89 int netconfig_del_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gint address_family);
91 gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context);
92 gboolean handle_launch_mdns(Network *object, GDBusMethodInvocation *context,
95 gboolean netconfig_send_notification_to_net_popup(const char * noti, const char * data);
96 int netconfig_send_message_to_net_popup(const char *title,
97 const char *content, const char *type, const char *ssid);
98 int netconfig_send_restriction_to_net_popup(const char *title,
99 const char *type, const char *restriction);
100 void netconfig_set_system_event(int sys_evt, int evt_key, int evt_val);
101 void netconfig_set_vconf_int(const char * key, int value);
102 void netconfig_set_vconf_str(const char * key, const char * value);
103 int netconfig_vconf_get_int(const char * key, int *value);
104 int netconfig_vconf_get_bool(const char * key, int *value);
105 char* netconfig_get_env(const char *key);
106 void netconfig_set_mac_address_from_file(void);
107 void __netconfig_pop_wifi_connected_poppup(const char *ssid);
109 void netconfig_get_telephony_network_type(int *svctype, int *pstype);
110 gboolean __netconfig_wifi_get_sim_imsi(Wifi *wifi, GDBusMethodInvocation *context);
111 netconfig_error_e __netconfig_wifi_req_aka_auth(GArray *rand_data, GArray *autn_data,
112 GDBusMethodInvocation *context, struct wifi_authentication_data **data);
113 gboolean __netconfig_wifi_req_sim_auth(GArray *rand_data,
114 GDBusMethodInvocation *context, struct wifi_authentication_data **data);
115 gboolean netconfig_tapi_check_sim_state(void);
116 gboolean __netconfig_wifi_get_aka_authdata(Wifi *wifi,
117 GDBusMethodInvocation *context, struct wifi_authentication_data **data);
118 gboolean __netconfig_wifi_get_sim_authdata(Wifi *wifi,
119 GDBusMethodInvocation *context, struct wifi_authentication_data **data);
121 void netconfig_plugin_init();
122 void netconfig_plugin_deinit();
123 gboolean netconfig_get_headed_plugin_flag();
124 gboolean netconfig_get_telephony_plugin_flag();
131 TIZEN_PROFILE_UNKNOWN = 0,
132 TIZEN_PROFILE_MOBILE = 0x1,
133 TIZEN_PROFILE_WEARABLE = 0x2,
134 TIZEN_PROFILE_TV = 0x4,
135 TIZEN_PROFILE_IVI = 0x8,
136 TIZEN_PROFILE_COMMON = 0x10,
138 extern tizen_profile_t _get_tizen_profile();
140 #define TIZEN_TELEPHONY_ENABLE (_get_tizen_profile() == TIZEN_PROFILE_MOBILE)
141 #define TIZEN_WLAN_BOARD_SPRD (_get_tizen_profile() == TIZEN_PROFILE_MOBILE)
142 #define TIZEN_TV (_get_tizen_profile() == TIZEN_PROFILE_TV)
143 #define TIZEN_NTP_ENABLE 1 /* 1: enable, 0: disable */
145 #endif /* __NETCONFIG_UTIL_H__ */