diff options
author | Zhang zhengguang <zhengguang.zhang@intel.com> | 2014-07-17 10:37:39 +0800 |
---|---|---|
committer | Zhang zhengguang <zhengguang.zhang@intel.com> | 2014-07-17 10:37:39 +0800 |
commit | 1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7 (patch) | |
tree | 6e991827d28537f7f40f20786c2354fd04a9fdad /include | |
parent | fbe905ab58ecc31fe64c410c5f580cadc30e7f04 (diff) | |
download | connman-upstream/1.24.tar.gz connman-upstream/1.24.tar.bz2 connman-upstream/1.24.zip |
Imported Upstream version 1.24upstream/1.24
Diffstat (limited to 'include')
-rw-r--r-- | include/agent.h | 15 | ||||
-rw-r--r-- | include/dbus.h | 1 | ||||
-rw-r--r-- | include/device.h | 23 | ||||
-rw-r--r-- | include/inet.h | 12 | ||||
-rw-r--r-- | include/ipaddress.h | 2 | ||||
-rw-r--r-- | include/log.h | 10 | ||||
-rw-r--r-- | include/network.h | 24 | ||||
-rw-r--r-- | include/notifier.h | 6 | ||||
-rw-r--r-- | include/peer.h (renamed from include/types.h) | 24 | ||||
-rw-r--r-- | include/provider.h | 9 | ||||
-rw-r--r-- | include/provision.h | 6 | ||||
-rw-r--r-- | include/service.h | 17 | ||||
-rw-r--r-- | include/session.h | 30 | ||||
-rw-r--r-- | include/setting.h | 4 | ||||
-rw-r--r-- | include/technology.h | 10 |
15 files changed, 104 insertions, 89 deletions
diff --git a/include/agent.h b/include/agent.h index a0841942..05462df8 100644 --- a/include/agent.h +++ b/include/agent.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2012-2013 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,6 +22,8 @@ #ifndef __CONNMAN_AGENT_H #define __CONNMAN_AGENT_H +#include <stdbool.h> + #ifdef __cplusplus extern "C" { #endif @@ -48,11 +50,12 @@ int connman_agent_driver_register(struct connman_agent_driver *driver); void connman_agent_driver_unregister(struct connman_agent_driver *driver); typedef void (* report_error_cb_t) (void *user_context, - gboolean retry, void *user_data); + bool retry, void *user_data); int connman_agent_report_error(void *user_context, const char *path, const char *error, - report_error_cb_t callback, void *user_data); + report_error_cb_t callback, + const char *dbus_sender, void *user_data); int connman_agent_register(const char *sender, const char *path); int connman_agent_unregister(const char *sender, const char *path); @@ -62,9 +65,11 @@ typedef void (*agent_queue_cb)(DBusMessage *reply, void *user_data); int connman_agent_queue_message(void *user_context, DBusMessage *msg, int timeout, - agent_queue_cb callback, void *user_data); + agent_queue_cb callback, void *user_data, + void *agent_data); -void connman_agent_get_info(const char **sender, const char **path); +void *connman_agent_get_info(const char *dbus_sender, const char **sender, + const char **path); #ifdef __cplusplus } diff --git a/include/dbus.h b/include/dbus.h index 85e8ede0..253a23b2 100644 --- a/include/dbus.h +++ b/include/dbus.h @@ -46,6 +46,7 @@ extern "C" { #define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology" #define CONNMAN_SESSION_INTERFACE CONNMAN_SERVICE ".Session" #define CONNMAN_NOTIFICATION_INTERFACE CONNMAN_SERVICE ".Notification" +#define CONNMAN_PEER_INTERFACE CONNMAN_SERVICE ".Peer" #define CONNMAN_PRIVILEGE_MODIFY 1 #define CONNMAN_PRIVILEGE_SECRET 2 diff --git a/include/device.h b/include/device.h index 33825756..57b925c4 100644 --- a/include/device.h +++ b/include/device.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2012 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" { @@ -78,16 +78,16 @@ void connman_device_set_ident(struct connman_device *device, const char *connman_device_get_ident(struct connman_device *device); int connman_device_set_powered(struct connman_device *device, - connman_bool_t powered); -connman_bool_t connman_device_get_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, - connman_bool_t scanning); -connman_bool_t connman_device_get_scanning(struct connman_device *device); + enum connman_service_type type, bool scanning); +bool connman_device_get_scanning(struct connman_device *device); void connman_device_reset_scanning(struct connman_device *device); int connman_device_set_disconnected(struct connman_device *device, - connman_bool_t disconnected); -connman_bool_t connman_device_get_disconnected(struct connman_device *device); + bool disconnected); +bool connman_device_get_disconnected(struct connman_device *device); int connman_device_set_string(struct connman_device *device, const char *key, const char *value); @@ -100,7 +100,6 @@ struct connman_network *connman_device_get_network(struct connman_device *device const char *identifier); int connman_device_remove_network(struct connman_device *device, struct connman_network *network); -void connman_device_remove_all_networks(struct connman_device *device); int connman_device_register(struct connman_device *device); void connman_device_unregister(struct connman_device *device); @@ -114,7 +113,6 @@ 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_disconnect_service(struct connman_device *device); int connman_device_reconnect_service(struct connman_device *device); struct connman_device_driver { @@ -125,10 +123,11 @@ 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)(enum connman_service_type type, + struct connman_device *device, const char *ssid, unsigned int ssid_len, const char *identity, const char* passphrase, - void *user_data); + const char *security, void *user_data); int (*set_regdom) (struct connman_device *device, const char *alpha2); }; diff --git a/include/inet.h b/include/inet.h index 8f7a35cb..a836a5bf 100644 --- a/include/inet.h +++ b/include/inet.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2012 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2013 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 @@ -41,7 +41,7 @@ short int connman_inet_ifflags(int index); int connman_inet_ifup(int index); int connman_inet_ifdown(int index); -connman_bool_t connman_inet_is_cfg80211(int index); +bool connman_inet_is_cfg80211(int index); int connman_inet_set_address(int index, struct connman_ipaddress *ipaddress); int connman_inet_clear_address(int index, struct connman_ipaddress *ipaddress); @@ -50,11 +50,10 @@ int connman_inet_del_host_route(int index, const char *host); int connman_inet_add_network_route(int index, const char *host, const char *gateway, const char *netmask); int connman_inet_del_network_route(int index, const char *host); -int connman_inet_set_gateway_address(int index, const char *gateway); int connman_inet_clear_gateway_address(int index, const char *gateway); int connman_inet_set_gateway_interface(int index); int connman_inet_clear_gateway_interface(int index); -connman_bool_t connman_inet_compare_subnet(int index, const char *host); +bool connman_inet_compare_subnet(int index, const char *host); int connman_inet_set_ipv6_address(int index, struct connman_ipaddress *ipaddress); int connman_inet_clear_ipv6_address(int index, @@ -66,7 +65,6 @@ int connman_inet_add_ipv6_host_route(int index, const char *host, int connman_inet_del_ipv6_network_route(int index, const char *host, unsigned char prefix_len); int connman_inet_del_ipv6_host_route(int index, const char *host); -int connman_inet_set_ipv6_gateway_address(int index, const char *gateway); int connman_inet_clear_ipv6_gateway_address(int index, const char *gateway); int connman_inet_set_ipv6_gateway_interface(int index); int connman_inet_clear_ipv6_gateway_interface(int index); @@ -80,8 +78,8 @@ int connman_inet_create_tunnel(char **iface); int connman_inet_get_dest_addr(int index, char **dest); int connman_inet_ipv6_get_dest_addr(int index, char **dest); int connman_inet_check_ipaddress(const char *host); -connman_bool_t connman_inet_check_hostname(const char *ptr, size_t len); -connman_bool_t connman_inet_is_ipv6_supported(); +bool connman_inet_check_hostname(const char *ptr, size_t len); +bool connman_inet_is_ipv6_supported(); #ifdef __cplusplus } diff --git a/include/ipaddress.h b/include/ipaddress.h index cc6848e2..4ced3184 100644 --- a/include/ipaddress.h +++ b/include/ipaddress.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2012 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2013 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 diff --git a/include/log.h b/include/log.h index 2a7de100..8b00e9dc 100644 --- a/include/log.h +++ b/include/log.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2012 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2013 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 @@ -41,6 +41,14 @@ void connman_error(const char *format, ...) void connman_debug(const char *format, ...) __attribute__((format(printf, 1, 2))); +#define connman_warn_once(fmt, arg...) do { \ + static bool printed; \ + if (!printed) { \ + connman_warn(fmt, ## arg); \ + printed = true; \ + } \ +} while (0) + struct connman_debug_desc { const char *name; const char *file; diff --git a/include/network.h b/include/network.h index 65504935..fcb6905e 100644 --- a/include/network.h +++ b/include/network.h @@ -1,9 +1,8 @@ - /* * * Connection Manager * - * Copyright (C) 2007-2012 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2013 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 @@ -23,9 +22,9 @@ #ifndef __CONNMAN_NETWORK_H #define __CONNMAN_NETWORK_H +#include <stdbool.h> #include <stdint.h> -#include <connman/types.h> #include <connman/device.h> #include <connman/ipconfig.h> @@ -46,6 +45,7 @@ enum connman_network_type { CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8, CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9, CONNMAN_NETWORK_TYPE_CELLULAR = 10, + CONNMAN_NETWORK_TYPE_GADGET = 11, CONNMAN_NETWORK_TYPE_VENDOR = 10000, }; @@ -88,20 +88,20 @@ void connman_network_set_group(struct connman_network *network, const char *group); const char *connman_network_get_group(struct connman_network *network); -connman_bool_t connman_network_get_connecting(struct connman_network *network); +bool connman_network_get_connecting(struct connman_network *network); int connman_network_set_available(struct connman_network *network, - connman_bool_t available); -connman_bool_t connman_network_get_available(struct connman_network *network); + bool available); +bool connman_network_get_available(struct connman_network *network); int connman_network_set_associating(struct connman_network *network, - connman_bool_t associating); + bool associating); void connman_network_set_error(struct connman_network *network, enum connman_network_error error); void connman_network_clear_error(struct connman_network *network); int connman_network_set_connected(struct connman_network *network, - connman_bool_t connected); -connman_bool_t connman_network_get_connected(struct connman_network *network); + bool connected); +bool connman_network_get_connected(struct connman_network *network); -connman_bool_t connman_network_get_associating(struct connman_network *network); +bool connman_network_get_associating(struct connman_network *network); void connman_network_clear_hidden(void *user_data); int connman_network_connect_hidden(struct connman_network *network, @@ -134,8 +134,8 @@ int connman_network_set_string(struct connman_network *network, const char *connman_network_get_string(struct connman_network *network, const char *key); int connman_network_set_bool(struct connman_network *network, - const char *key, connman_bool_t value); -connman_bool_t connman_network_get_bool(struct connman_network *network, + const char *key, bool value); +bool connman_network_get_bool(struct connman_network *network, const char *key); int connman_network_set_blob(struct connman_network *network, const char *key, const void *data, unsigned int size); diff --git a/include/notifier.h b/include/notifier.h index 44127170..50b5fb4c 100644 --- a/include/notifier.h +++ b/include/notifier.h @@ -47,14 +47,14 @@ struct connman_notifier { const char *name); void (*service_remove) (struct connman_service *service); void (*service_enabled) (enum connman_service_type type, - connman_bool_t enabled); - void (*offline_mode) (connman_bool_t enabled); + bool enabled); + void (*offline_mode) (bool enabled); void (*proxy_changed) (struct connman_service *service); void (*service_state_changed) (struct connman_service *service, enum connman_service_state state); void (*ipconfig_changed) (struct connman_service *service, struct connman_ipconfig *ipconfig); - void (*idle_state) (connman_bool_t idle); + void (*idle_state) (bool idle); }; int connman_notifier_register(struct connman_notifier *notifier); diff --git a/include/types.h b/include/peer.h index 022563cf..807c9456 100644 --- a/include/types.h +++ b/include/peer.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2012 Intel Corporation. All rights reserved. + * Copyright (C) 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 @@ -19,25 +19,27 @@ * */ -#ifndef __CONNMAN_TYPES_H -#define __CONNMAN_TYPES_H +#ifndef __CONNMAN_PEER_H +#define __CONNMAN_PEER_H #ifdef __cplusplus extern "C" { #endif -#ifndef FALSE -#define FALSE (0) -#endif +struct connman_peer; -#ifndef TRUE -#define TRUE (!FALSE) -#endif +struct connman_peer *connman_peer_create(const char *identifier); +void connman_peer_destroy(struct connman_peer *peer); + +void connman_peer_set_name(struct connman_peer *peer, const char *name); + +int connman_peer_register(struct connman_peer *peer); +void connman_peer_unregister(struct connman_peer *peer); -typedef int connman_bool_t; +struct connman_peer *connman_peer_get(const char *identifier); #ifdef __cplusplus } #endif -#endif /* __CONNMAN_TYPES_H */ +#endif /* __CONNMAN_PEER_H */ diff --git a/include/provider.h b/include/provider.h index 1f33552d..d1a8983b 100644 --- a/include/provider.h +++ b/include/provider.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2012 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2013 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,9 @@ #ifndef __CONNMAN_PROVIDER_H #define __CONNMAN_PROVIDER_H +#include <stdbool.h> + #include <glib.h> -#include <connman/types.h> #ifdef __cplusplus extern "C" { @@ -103,7 +104,7 @@ int connman_provider_set_pac(struct connman_provider *provider, const char *pac); int connman_provider_create_service(struct connman_provider *provider); int connman_provider_set_immutable(struct connman_provider *provider, - connman_bool_t immutable); + bool immutable); struct connman_provider *connman_provider_get(const char *identifier); void connman_provider_put(struct connman_provider *provider); int connman_provider_set_domain(struct connman_provider *provider, @@ -133,7 +134,7 @@ struct connman_provider_driver { int (*create) (DBusMessage *msg, connection_ready_cb callback); int (*set_routes) (struct connman_provider *provider, enum connman_provider_route_type type); - connman_bool_t (*check_routes) (struct connman_provider *provider); + bool (*check_routes) (struct connman_provider *provider); }; int connman_provider_driver_register(struct connman_provider_driver *driver); diff --git a/include/provision.h b/include/provision.h index b5f736e8..3eb80a86 100644 --- a/include/provision.h +++ b/include/provision.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2012-2013 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,7 +22,7 @@ #ifndef __CONNMAN_PROVISION_H #define __CONNMAN_PROVISION_H -#include <connman/types.h> +#include <stdbool.h> #ifdef __cplusplus extern "C" { @@ -39,7 +39,7 @@ struct connman_config_entry { char *name; void *ssid; unsigned int ssid_len; - connman_bool_t hidden; + bool hidden; }; int connman_config_provision_mutable_service(GKeyFile *keyfile); diff --git a/include/service.h b/include/service.h index 5e646a08..31dfce7e 100644 --- a/include/service.h +++ b/include/service.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2012 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,7 +22,7 @@ #ifndef __CONNMAN_SERVICE_H #define __CONNMAN_SERVICE_H -#include <connman/types.h> +#include <stdbool.h> #ifdef __cplusplus extern "C" { @@ -44,7 +44,10 @@ enum connman_service_type { CONNMAN_SERVICE_TYPE_GPS = 6, CONNMAN_SERVICE_TYPE_VPN = 7, CONNMAN_SERVICE_TYPE_GADGET = 8, + CONNMAN_SERVICE_TYPE_P2P = 9, }; +#define MAX_CONNMAN_SERVICE_TYPES 10 + enum connman_service_security { CONNMAN_SERVICE_SECURITY_UNKNOWN = 0, @@ -85,6 +88,13 @@ enum connman_service_proxy_method { CONNMAN_SERVICE_PROXY_METHOD_AUTO = 3, }; +enum connman_service_connect_reason { + CONNMAN_SERVICE_CONNECT_REASON_NONE = 0, + CONNMAN_SERVICE_CONNECT_REASON_AUTO = 1, + CONNMAN_SERVICE_CONNECT_REASON_USER = 2, + CONNMAN_SERVICE_CONNECT_REASON_SESSION = 3, +}; + struct connman_service; struct connman_network; @@ -115,7 +125,8 @@ char **connman_service_get_proxy_servers(struct connman_service *service); char **connman_service_get_proxy_excludes(struct connman_service *service); const char *connman_service_get_proxy_url(struct connman_service *service); const char *connman_service_get_proxy_autoconfig(struct connman_service *service); -connman_bool_t connman_service_get_favorite(struct connman_service *service); +bool connman_service_get_favorite(struct connman_service *service); +bool connman_service_get_autoconnect(struct connman_service *service); struct connman_service *connman_service_lookup_from_network(struct connman_network *network); diff --git a/include/session.h b/include/session.h index 61cc2644..3f666649 100644 --- a/include/session.h +++ b/include/session.h @@ -23,7 +23,6 @@ #define __CONNMAN_SESSION_H #include <connman/service.h> -#include <connman/types.h> #ifdef __cplusplus extern "C" { @@ -56,32 +55,15 @@ enum connman_session_id_type { CONNMAN_SESSION_ID_TYPE_LSM = 3, }; -struct cb_data { - void *cb; - void *user_data; - void *data; -}; - -static inline struct cb_data *cb_data_new(void *cb, void *user_data) -{ - struct cb_data *ret; - - ret = g_new0(struct cb_data, 1); - ret->cb = cb; - ret->user_data = user_data; - - return ret; -} - struct connman_session; struct connman_session_config { enum connman_session_id_type id_type; char *id; - connman_bool_t priority; + bool priority; enum connman_session_roaming_policy roaming_policy; enum connman_session_type type; - connman_bool_t ecall; + bool ecall; GSList *allowed_bearers; }; @@ -92,10 +74,15 @@ typedef int (* connman_session_config_func_t) (struct connman_session *session, struct connman_session_policy { const char *name; int priority; + bool (*autoconnect)(enum connman_service_connect_reason reason); int (*create)(struct connman_session *session, connman_session_config_func_t cb, void *user_data); void (*destroy)(struct connman_session *session); + void (*session_changed)(struct connman_session *session, bool active, + GSList *bearers); + bool (*allowed)(struct connman_session *session, + struct connman_service *service); }; int connman_session_policy_register(struct connman_session_policy *config); @@ -113,6 +100,9 @@ int connman_session_parse_bearers(const char *token, GSList **list); const char *connman_session_get_owner(struct connman_session *session); +int connman_session_connect(struct connman_service *service); +int connman_session_disconnect(struct connman_service *service); + #ifdef __cplusplus } #endif diff --git a/include/setting.h b/include/setting.h index e867a78c..a8820217 100644 --- a/include/setting.h +++ b/include/setting.h @@ -22,13 +22,13 @@ #ifndef __CONNMAN_SETTING_H #define __CONNMAN_SETTING_H -#include <connman/types.h> +#include <stdbool.h> #ifdef __cplusplus extern "C" { #endif -connman_bool_t connman_setting_get_bool(const char *key); +bool connman_setting_get_bool(const char *key); char **connman_setting_get_string_list(const char *key); unsigned int *connman_setting_get_uint_list(const char *key); diff --git a/include/technology.h b/include/technology.h index 9fe994cd..d7fcdde2 100644 --- a/include/technology.h +++ b/include/technology.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2012 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2013 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 @@ -37,14 +37,14 @@ extern "C" { struct connman_technology; void connman_technology_tethering_notify(struct connman_technology *technology, - connman_bool_t enabled); + bool enabled); int connman_technology_set_regdom(const char *alpha2); void connman_technology_regdom_notify(struct connman_technology *technology, const char *alpha2); -connman_bool_t connman_technology_get_wifi_tethering(const char **ssid, +bool connman_technology_get_wifi_tethering(const char **ssid, const char **psk); -connman_bool_t connman_technology_is_tethering_allowed(enum connman_service_type type); +bool connman_technology_is_tethering_allowed(enum connman_service_type type); struct connman_technology_driver { const char *name; @@ -59,7 +59,7 @@ struct connman_technology_driver { int index); int (*set_tethering) (struct connman_technology *technology, const char *identifier, const char *passphrase, - const char *bridge, connman_bool_t enabled); + const char *bridge, bool enabled); int (*set_regdom) (struct connman_technology *technology, const char *alpha2); }; |