Add support for handling multiple wifi interfaces
[platform/upstream/connman.git] / include / device.h
old mode 100644 (file)
new mode 100755 (executable)
index 8af7d28..67d7928
@@ -2,7 +2,7 @@
  *
  *  Connection Manager
  *
- *  Copyright (C) 2007-2009  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2007-2014  Intel Corporation. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -22,8 +22,8 @@
 #ifndef __CONNMAN_DEVICE_H
 #define __CONNMAN_DEVICE_H
 
-#include <connman/types.h>
 #include <connman/network.h>
+#include <connman/service.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -39,74 +39,119 @@ enum connman_device_type {
        CONNMAN_DEVICE_TYPE_UNKNOWN   = 0,
        CONNMAN_DEVICE_TYPE_ETHERNET  = 1,
        CONNMAN_DEVICE_TYPE_WIFI      = 2,
-       CONNMAN_DEVICE_TYPE_WIMAX     = 3,
-       CONNMAN_DEVICE_TYPE_BLUETOOTH = 4,
-       CONNMAN_DEVICE_TYPE_HSO       = 15,
-       CONNMAN_DEVICE_TYPE_NOZOMI    = 16,
-       CONNMAN_DEVICE_TYPE_HUAWEI    = 17,
-       CONNMAN_DEVICE_TYPE_NOVATEL   = 18,
+       CONNMAN_DEVICE_TYPE_BLUETOOTH = 3,
+       CONNMAN_DEVICE_TYPE_CELLULAR  = 4,
+       CONNMAN_DEVICE_TYPE_GPS       = 5,
+       CONNMAN_DEVICE_TYPE_GADGET    = 6,
        CONNMAN_DEVICE_TYPE_VENDOR    = 10000,
 };
 
-enum connman_device_mode {
-       CONNMAN_DEVICE_MODE_UNKNOWN          = 0,
-       CONNMAN_DEVICE_MODE_NETWORK_SINGLE   = 1,
-       CONNMAN_DEVICE_MODE_NETWORK_MULTIPLE = 2,
-       CONNMAN_DEVICE_MODE_TRANSPORT_IP     = 3,
-};
-
-enum connman_device_policy {
-       CONNMAN_DEVICE_POLICY_UNKNOWN = 0,
-       CONNMAN_DEVICE_POLICY_IGNORE  = 1,
-       CONNMAN_DEVICE_POLICY_OFF     = 2,
-       CONNMAN_DEVICE_POLICY_AUTO    = 3,
-       CONNMAN_DEVICE_POLICY_MANUAL  = 4,
+#define CONNMAN_DEVICE_PRIORITY_LOW      -100
+#define CONNMAN_DEVICE_PRIORITY_DEFAULT     0
+#define CONNMAN_DEVICE_PRIORITY_HIGH      100
+
+struct connman_device_scan_params {
+       enum connman_service_type type;
+       const char *ssid;
+       unsigned int ssid_len;
+       const char *identity;
+       const char* passphrase;
+       const char *security;
+       bool force_full_scan;
+       void *user_data;
 };
 
 struct connman_device;
 
-extern struct connman_device *connman_device_create(const char *node,
+struct connman_device *connman_device_create(const char *node,
                                                enum connman_device_type type);
-extern struct connman_device *connman_device_ref(struct connman_device *device);
-extern void connman_device_unref(struct connman_device *device);
-
-extern const char *connman_device_get_path(struct connman_device *device);
-extern void connman_device_set_index(struct connman_device *device,
-                                                               int index);
-extern int connman_device_get_index(struct connman_device *device);
-extern void connman_device_set_interface(struct connman_device *device,
-                                                       const char *interface);
-extern const char *connman_device_get_interface(struct connman_device *device);
-
-extern void connman_device_set_policy(struct connman_device *device,
-                                       enum connman_device_policy policy);
-extern void connman_device_set_mode(struct connman_device *device,
-                                               enum connman_device_mode mode);
-
-extern int connman_device_set_powered(struct connman_device *device,
-                                               connman_bool_t powered);
-extern int connman_device_set_carrier(struct connman_device *device,
-                                               connman_bool_t carrier);
-extern int connman_device_set_scanning(struct connman_device *device,
-                                               connman_bool_t scanning);
-
-extern int connman_device_set_string(struct connman_device *device,
+
+#define connman_device_ref(device) \
+       connman_device_ref_debug(device, __FILE__, __LINE__, __func__)
+
+#define connman_device_unref(device) \
+       connman_device_unref_debug(device, __FILE__, __LINE__, __func__)
+
+struct connman_device *
+connman_device_ref_debug(struct connman_device *device,
+                       const char *file, int line, const char *caller);
+void connman_device_unref_debug(struct connman_device *device,
+                       const char *file, int line, const char *caller);
+
+enum connman_device_type connman_device_get_type(struct connman_device *device);
+void connman_device_set_index(struct connman_device *device, int index);
+int connman_device_get_index(struct connman_device *device);
+void connman_device_set_interface(struct connman_device *device,
+                                               const char *interface);
+
+void connman_device_set_ident(struct connman_device *device,
+                                               const char *ident);
+const char *connman_device_get_ident(struct connman_device *device);
+
+int connman_device_set_powered(struct connman_device *device,
+                                               bool powered);
+bool connman_device_get_powered(struct connman_device *device);
+int connman_device_set_scanning(struct connman_device *device,
+                               enum connman_service_type type, bool scanning);
+bool connman_device_get_scanning(struct connman_device *device,
+                               enum connman_service_type type);
+void connman_device_reset_scanning(struct connman_device *device);
+
+int connman_device_set_string(struct connman_device *device,
                                        const char *key, const char *value);
-extern const char *connman_device_get_string(struct connman_device *device,
+const char *connman_device_get_string(struct connman_device *device,
                                                        const char *key);
 
-extern int connman_device_add_network(struct connman_device *device,
+int connman_device_add_network(struct connman_device *device,
                                        struct connman_network *network);
-extern struct connman_network *connman_device_get_network(struct connman_device *device,
+struct connman_network *connman_device_get_network(struct connman_device *device,
                                                        const char *identifier);
-extern int connman_device_remove_network(struct connman_device *device,
-                                                       const char *identifier);
-
-extern int connman_device_register(struct connman_device *device);
-extern void connman_device_unregister(struct connman_device *device);
+#if defined TIZEN_EXT
+struct connman_network *connman_device_get_default_network(
+                                                       struct connman_device *device);
+void connman_device_set_pending_reply(struct connman_device *device,
+                                                       DBusMessage *msg);
+void connman_device_send_connected_signal(struct connman_device *device,
+                                                       bool connected);
+void connman_device_set_max_scan_ssids(struct connman_device *device,
+                                                       int max_scan_ssids);
+int connman_device_get_max_scan_ssids(struct connman_device *device);
+void connman_device_set_wifi_5ghz_supported(struct connman_device *device,
+                                                       bool is_5_0_ghz_supported);
+bool connman_device_get_wifi_5ghz_supported(struct connman_device *device);
+#endif
+int connman_device_remove_network(struct connman_device *device,
+                                       struct connman_network *network);
 
-extern void *connman_device_get_data(struct connman_device *device);
-extern void connman_device_set_data(struct connman_device *device, void *data);
+int connman_device_register(struct connman_device *device);
+void connman_device_unregister(struct connman_device *device);
+
+void *connman_device_get_data(struct connman_device *device);
+void connman_device_set_data(struct connman_device *device, void *data);
+
+int connman_device_set_regdom(struct connman_device *device,
+                                               const char *alpha2);
+void connman_device_regdom_notify(struct connman_device *device,
+                                       int result, const char *alpha2);
+struct connman_device *connman_device_create_from_index(int index);
+struct connman_device *connman_device_find_by_index(int index);
+int connman_device_reconnect_service(struct connman_device *device);
+
+#if defined TIZEN_EXT
+bool connman_device_set_last_user_selection_time(struct connman_device *device,
+                                               time_t time);
+time_t connman_device_get_last_user_selection_time(struct connman_device *device);
+bool connman_device_set_last_user_selection_ident(struct connman_device *device,
+                                               const char *ident);
+const char *connman_device_get_last_user_selection_ident(struct connman_device *device);
+bool connman_device_set_last_connected_ident(struct connman_device *device,
+                                               const char *ident);
+const char *connman_device_get_last_connected_ident(struct connman_device *device);
+void connman_device_save_last_user_selection(struct connman_device *device);
+void connman_device_load_last_user_selection(struct connman_device *device);
+void connman_device_save_last_connected(struct connman_device *device);
+void connman_device_load_last_connected(struct connman_device *device);
+#endif
 
 struct connman_device_driver {
        const char *name;
@@ -116,11 +161,28 @@ struct connman_device_driver {
        void (*remove) (struct connman_device *device);
        int (*enable) (struct connman_device *device);
        int (*disable) (struct connman_device *device);
-       int (*scan) (struct connman_device *device);
+       int (*scan)(struct connman_device *device,
+                       struct connman_device_scan_params *params);
+       void (*stop_scan) (enum connman_service_type type,
+                       struct connman_device *device);
+       int (*set_regdom) (struct connman_device *device,
+                                               const char *alpha2);
+#if defined TIZEN_EXT
+       int (*specific_scan) (enum connman_service_type type,
+                       struct connman_device *device, int scan_type,
+                       GSList *specific_scan_list, void *user_data);
+#endif
+#if defined TIZEN_EXT_WIFI_MESH
+       int (*abort_scan) (enum connman_service_type type,
+                                               struct connman_device *device);
+       int (*mesh_specific_scan) (enum connman_service_type type,
+                       struct connman_device *device, const char *ssid, unsigned int freq,
+                       void *user_data);
+#endif
 };
 
-extern int connman_device_driver_register(struct connman_device_driver *driver);
-extern void connman_device_driver_unregister(struct connman_device_driver *driver);
+int connman_device_driver_register(struct connman_device_driver *driver);
+void connman_device_driver_unregister(struct connman_device_driver *driver);
 
 #ifdef __cplusplus
 }