5d144a839a8b22c54f6b25d305846f8de7fe3adb
[framework/connectivity/mobileap-agent.git] / include / mobileap.h
1 /*
2  * mobileap-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef __MOBILEAP_INTERNAL_H__
19 #define __MOBILEAP_INTERNAL_H__
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /* Client / Agent common */
26 #define DBUS_STRUCT_UINT_STRING (dbus_g_type_get_struct ("GValueArray", \
27                         G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID))
28
29 #define DBUS_STRUCT_STATIONS (dbus_g_type_get_struct ("GValueArray", \
30                         G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, \
31                         G_TYPE_STRING, G_TYPE_INVALID))
32
33 #define DBUS_STRUCT_STATION (dbus_g_type_get_struct ("GValueArray", \
34                         G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, \
35                         G_TYPE_INVALID))
36
37 #define DBUS_STRUCT_INTERFACE (dbus_g_type_get_struct ("GValueArray", \
38                         G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, \
39                         G_TYPE_STRING, G_TYPE_INVALID))
40
41
42 #define TETHERING_SERVICE_OBJECT_PATH   "/Tethering"
43 #define TETHERING_SERVICE_NAME          "org.tizen.tethering"
44 #define TETHERING_SERVICE_INTERFACE     "org.tizen.tethering"
45
46 #define SIGNAL_NAME_NET_CLOSED          "net_closed"
47 #define SIGNAL_NAME_STA_CONNECT         "sta_connected"
48 #define SIGNAL_NAME_STA_DISCONNECT      "sta_disconnected"
49 #define SIGNAL_NAME_WIFI_TETHER_ON      "wifi_on"
50 #define SIGNAL_NAME_WIFI_TETHER_OFF     "wifi_off"
51 #define SIGNAL_NAME_USB_TETHER_ON       "usb_on"
52 #define SIGNAL_NAME_USB_TETHER_OFF      "usb_off"
53 #define SIGNAL_NAME_BT_TETHER_ON        "bluetooth_on"
54 #define SIGNAL_NAME_BT_TETHER_OFF       "bluetooth_off"
55 #define SIGNAL_NAME_NO_DATA_TIMEOUT     "no_data_timeout"
56 #define SIGNAL_NAME_LOW_BATTERY_MODE    "low_batt_mode"
57 #define SIGNAL_NAME_FLIGHT_MODE         "flight_mode"
58 #define SIGNAL_NAME_DHCP_STATUS         "dhcp_status"
59 #define SIGNAL_NAME_SECURITY_TYPE_CHANGED       "security_type_changed"
60 #define SIGNAL_NAME_SSID_VISIBILITY_CHANGED     "ssid_visibility_changed"
61 #define SIGNAL_NAME_PASSPHRASE_CHANGED          "passphrase_changed"
62
63 #define SIGNAL_MSG_NOT_AVAIL_INTERFACE  "Interface is not available"
64 #define SIGNAL_MSG_TIMEOUT              "There is no connection for a while"
65 #define SIGNAL_MSG_SSID_VISIBLE         "ssid_visible"
66 #define SIGNAL_MSG_SSID_HIDE            "ssid_hide"
67
68 #define DNSMASQ_LEASES_FILE             "/var/lib/misc/dnsmasq.leases"
69 #define IP_USB_SUBNET                   "192.168.129"
70
71 typedef enum {
72         E_SIGNAL_NET_CLOSED,
73         E_SIGNAL_STA_CONNECT,
74         E_SIGNAL_STA_DISCONNECT,
75         E_SIGNAL_WIFI_TETHER_ON,
76         E_SIGNAL_WIFI_TETHER_OFF,
77         E_SIGNAL_USB_TETHER_ON,
78         E_SIGNAL_USB_TETHER_OFF,
79         E_SIGNAL_BT_TETHER_ON,
80         E_SIGNAL_BT_TETHER_OFF,
81         E_SIGNAL_NO_DATA_TIMEOUT,
82         E_SIGNAL_LOW_BATTERY_MODE,
83         E_SIGNAL_FLIGHT_MODE,
84         E_SIGNAL_SECURITY_TYPE_CHANGED,
85         E_SIGNAL_SSID_VISIBILITY_CHANGED,
86         E_SIGNAL_PASSPHRASE_CHANGED,
87         E_SIGNAL_MAX
88 } mobile_ap_sig_e;
89
90 /**
91 * WiFi tethering configuration
92 */
93 #define MOBILE_AP_WIFI_CHANNEL          7       /**< Channel number */
94 #define MOBILE_AP_WIFI_BSSID_LEN        6       /**< BSSID Length */
95 #define MOBILE_AP_WIFI_SSID_MAX_LEN     31      /**< Maximum length of ssid */
96 #define MOBILE_AP_WIFI_KEY_MIN_LEN      8       /**< Minimum length of wifi key */
97 #define MOBILE_AP_WIFI_KEY_MAX_LEN      63      /**< Maximum length of wifi key */
98
99 /**
100 * Common configuration
101 */
102 #define MOBILE_AP_MAX_WIFI_STA          8
103 #define MOBILE_AP_MAX_BT_STA            7
104 #define MOBILE_AP_MAX_USB_STA           1
105 #define MOBILE_AP_MAX_CONNECTED_STA     16      /**< Maximum connected station. 8(Wi-Fi) + 7(BT) + 1(USB) */
106
107 #define MOBILE_AP_STR_INFO_LEN          20      /**< length of the ip or mac address*/
108 #define MOBILE_AP_STR_HOSTNAME_LEN      32      /**< length of the hostname */
109 #define MOBILE_AP_NAME_UNKNOWN          "UNKNOWN"
110
111 /**
112 * Mobile AP error code
113 */
114 typedef enum {
115         MOBILE_AP_ERROR_NONE,                   /**< No error */
116         MOBILE_AP_ERROR_RESOURCE,               /**< Socket creation error, file open error */
117         MOBILE_AP_ERROR_INTERNAL,               /**< Driver related error */
118         MOBILE_AP_ERROR_INVALID_PARAM,          /**< Invalid parameter */
119         MOBILE_AP_ERROR_ALREADY_ENABLED,        /**< Mobile AP is already ON */
120         MOBILE_AP_ERROR_NOT_ENABLED,            /**< Mobile AP is not ON, so cannot be disabled */
121         MOBILE_AP_ERROR_NET_OPEN,               /**< PDP network open error */
122         MOBILE_AP_ERROR_NET_CLOSE,              /**< PDP network close error */
123         MOBILE_AP_ERROR_DHCP,                   /**< DHCP error */
124         MOBILE_AP_ERROR_IN_PROGRESS,            /**< Request is in progress */
125         MOBILE_AP_ERROR_NOT_PERMITTED,          /**< Operation is not permitted */
126
127         MOBILE_AP_ERROR_MAX
128 } mobile_ap_error_code_e;
129
130 /**
131 * Event type on callback
132 */
133 typedef enum {
134         MOBILE_AP_ENABLE_CFM,                   /* mobile_ap_enable() */
135         MOBILE_AP_DISABLE_CFM,                  /* mobile_ap_disable() */
136
137         MOBILE_AP_ENABLE_WIFI_TETHERING_CFM,    /* mobile_ap_enable_wifi_tethering() */
138         MOBILE_AP_DISABLE_WIFI_TETHERING_CFM,   /* mobile_ap_disable_wifi_tethering() */
139         MOBILE_AP_CHANGE_WIFI_CONFIG_CFM,       /* mobile_ap_change_wifi_config() */
140
141         MOBILE_AP_ENABLE_USB_TETHERING_CFM,     /* mobile_ap_enable_usb_tethering() */
142         MOBILE_AP_DISABLE_USB_TETHERING_CFM,    /* mobile_ap_disable_usb_tethering() */
143
144         MOBILE_AP_ENABLE_BT_TETHERING_CFM,      /* mobile_ap_enable_bt_tethering() */
145         MOBILE_AP_DISABLE_BT_TETHERING_CFM,     /* mobile_ap_disable_bt_tethering() */
146
147         MOBILE_AP_GET_STATION_INFO_CFM,         /* mobile_ap_get_station_info() */
148         MOBILE_AP_GET_DATA_PACKET_USAGE_CFM,    /* mobile_ap_get_data_packet_usage() */
149
150         MOBILE_AP_DISABLED_IND,                 /* Turning off tethering service indication */
151
152         MOBILE_AP_ENABLED_WIFI_TETHERING_IND,   /* Turning on WiFi tethering indication */
153         MOBILE_AP_DISABLED_WIFI_TETHERING_IND,  /* Turning off WiFi tethering indication */
154
155         MOBILE_AP_ENABLED_USB_TETHERING_IND,    /* Turning on USB tethering indication */
156         MOBILE_AP_DISABLED_USB_TETHERING_IND,   /* Turning off USB tethering indication */
157
158         MOBILE_AP_ENABLED_BT_TETHERING_IND,     /* Turning on BT tethering indication */
159         MOBILE_AP_DISABLED_BT_TETHERING_IND,    /* Turning off BT tethering indication */
160
161         MOBILE_AP_STATION_CONNECT_IND,          /* Station connection indication */
162         MOBILE_AP_STATION_DISCONNECT_IND,       /* Station disconnection indication */
163         MOBILE_AP_USB_STATION_CONNECT_IND,
164
165         MOBILE_AP_MAX_EVENT,
166 } mobile_ap_event_e;
167
168 typedef enum {
169         MOBILE_AP_TYPE_WIFI,
170         MOBILE_AP_TYPE_USB,
171         MOBILE_AP_TYPE_BT,
172         MOBILE_AP_TYPE_MAX,
173 } mobile_ap_type_e;
174
175 typedef struct {
176         unsigned long long pdp_tx_bytes;        /**< packet data transmitted */
177         unsigned long long pdp_rx_bytes;        /**< packet data received */
178 } mobile_ap_data_packet_usage_t;
179
180 typedef struct {
181         mobile_ap_type_e interface;                     /**< interface type */
182         char ip[MOBILE_AP_STR_INFO_LEN];                /**< assigned IP address */
183         char mac[MOBILE_AP_STR_INFO_LEN];               /**< MAC Address */
184         char hostname[MOBILE_AP_STR_HOSTNAME_LEN];      /**< alphanumeric name */
185 } mobile_ap_station_info_t;
186
187 typedef struct {
188         mobile_ap_type_e interface;                     /**< interface type */
189         char interface_name[MOBILE_AP_STR_INFO_LEN];            /**< interface alphanumeric name */
190         char ip_address[MOBILE_AP_STR_INFO_LEN];                /**< assigned ip addresss to interface */
191         char gateway_address[MOBILE_AP_STR_INFO_LEN];   /**< gateway address of interface */
192         char subnet_mask[MOBILE_AP_STR_INFO_LEN];       /**< subnet mask of interface */
193 } mobile_ap_interface_info_t;
194
195 typedef struct {
196         unsigned short number;                  /**< Number of connected device */
197         mobile_ap_station_info_t sta_info[MOBILE_AP_MAX_CONNECTED_STA];
198 } mobile_ap_device_info_t;
199
200 #ifdef __cplusplus
201 }
202 #endif
203
204 #endif  /* __MOBILEAP_INTERNAL_H__ */