efl/src/lib/ecore_con/efl_net-connman.h

123 lines
2.9 KiB
C
Raw Normal View History

efl_net_session and efl_net_control for ConnMan These are objects to allow control of networking devices (efl_net_control) as well as an application to request for connectivity (efl_net_session). They are loosely based on ConnMan.org, which we already use in Enlightenment Window Manager via DBus access with Eldbus. However they do not map 1:1 as the goal was to expose a viable subset of controls but in a simple and general way, thus nome strings were converted to enums, some arrays of strings were converted to bitwise flags, some names were made more general, such as "service" was turned into "access point" so it doesn't generate confusion with other "network services" (ie: http server), or "favorite" that was renamed to "remembered". Some behavior are slightly different (yet able to be implemented on top), such as "Service.MoveBefore" and "MoveAfter" were converted to a numeric "priority", calculated from service's list index, changing the priority will reoder the list and thus generate the MoveBefore and MoveAfter DBus commands. ConnMan was chosen not only because we already use it, but because its DBus API is sane and simple, with the server doing almost all that we need. This is visible in the efl_net_session, which is completely done in the server and do not require any extra work on our side -- aside from talking DBus and converting to Eo, which is a major work :-D NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as Properties and ObjectManager, thus we cannot use eldbus_model_object. There are two examples added: - efl_net_session_example: monitors the connection available for an application and try to connect. You need a connman compiled with session_policy_local and a configuration file explained in https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt to get a connection if nothing is connected. Otherwise it will just monitor the connectivity state. - efl_net_control_example: monitors, plays the agent and configure the network details. It can enable/disable technologies, connect to access points (services) and configure them. It's quite extensive as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
#ifndef _EFL_NET_CONNMAN_H_
#define _EFL_NET_CONNMAN_H_ 1
#include "Ecore.h"
#include "ecore_con_private.h"
#include "Eldbus.h"
#define DEFAULT_TIMEOUT 10000.0
/**
* @file efl_net-connman.h
*
* Common infrastructure to create Efl_Net_Control and Efl_Net_Session
* based on ConnMan connection manager.
*
* @note Each connection manager that needs shared infra should create
* their own file!
*
* @internal
*/
/**
* Should be called from inside Efl.Object.constructor before using
* any of connman functions.
*
* @return #EINA_FALSE on errors, all other functions will be useless
* in this case. #EINA_TRUE on success.
*
* @internal
*/
Eina_Bool efl_net_connman_init(void);
/**
* Should be called from inside Efl.Object.destructor after done using
* all of connman functions.
*
* @internal
*/
void efl_net_connman_shutdown(void);
/**
* Returns the DBus connection shared by all objects.
*
* @internal
*/
Eldbus_Connection *efl_net_connman_connection_get(void);
/**
* Returns a singleton for ConnMan's Manager object and interface
* (proxy).
*
* @note call efl_net_connman_init() before using. There is no need to
* eldbus_proxy_ref() it, but if done should have a matching
* eldbus_proxy_unref(). After done, remember to
* efl_net_connman_shutdown().
*
* @internal
*/
Eldbus_Proxy *efl_net_connman_manager_get(void);
/**
* Given a Efl.Net.Control find a technology instance given its name.
*
* @internal
*/
Efl_Net_Control_Technology *efl_net_connman_control_find_technology_by_type(Efl_Net_Control *ctl, const char *tech_type);
/**
* Ask Efl.Net.Control to reload access point list.
*
* @internal
*/
void efl_net_connman_control_access_points_reload(Efl_Net_Control *ctl);
/**
* Creates a new Efl.Net.Control.Technology child of an
* Efl.Net.Control with path and properties
*
* @internal
*/
Efl_Net_Control_Technology *efl_net_connman_technology_new(Efl_Net_Control *parent, const char *path, Eldbus_Message_Iter *properties);
/**
* Get the path of the given technology.
*
* @internal
*/
const char *efl_net_connman_technology_path_get(Efl_Net_Control_Technology *tech);
/**
* Convert connman's type string to enum value.
*
* @internal
*/
Efl_Net_Control_Technology_Type efl_net_connman_technology_type_from_str(const char *tech_type);
/**
* Creates a new Efl.Net.Control.Access_Point child of an
* Efl.Net.Control with path and properties
*
* @internal
*/
Efl_Net_Control_Access_Point *efl_net_connman_access_point_new(Efl_Net_Control *parent, const char *path, Eldbus_Message_Iter *properties, unsigned int priority);
/**
* Get the path of the given access_point.
*
* @internal
*/
const char *efl_net_connman_access_point_path_get(Efl_Net_Control_Access_Point *ap);
/**
* Updates Efl.Net.Control.Access_Point properties
*
* @internal
*/
void efl_net_connman_access_point_update(Efl_Net_Control *ap, Eldbus_Message_Iter *properties, unsigned int priority);
#endif /* _EFL_NET_CONNMAN_H_ */