forked from enlightenment/efl
153 lines
5.5 KiB
Plaintext
153 lines
5.5 KiB
Plaintext
enum Efl.Net.Session.State {
|
|
[[Provides the session connectivity state.
|
|
|
|
@since 1.19
|
|
]]
|
|
offline, [[No access point is connected]]
|
|
local, [[At least one access point was connected and the internet connectio wasn't verified]]
|
|
online, [[At least one access point was connected and the internet was verified]]
|
|
}
|
|
|
|
/* keep in sync with efl_net_control_technology.eo, comment what doesn't make sense */
|
|
enum Efl.Net.Session.Technology {
|
|
[[Bitwise-able technologies to allow for a network session.
|
|
|
|
@since 1.9
|
|
]]
|
|
unknown = 0, [[Type: unknown]]
|
|
/* system = (1 << 0), [[Type: system]]*/
|
|
ethernet = (1 << 1), [[Type: ethernet]]
|
|
wifi = (1 << 2), [[Type: WiFi]]
|
|
bluetooth = (1 << 3), [[Type: Bluetooth]]
|
|
cellular = (1 << 4), [[Type: cellular/mobile]]
|
|
/* gps = (1 << 5), [[Type: GPS]]*/
|
|
vpn = (1 << 6), [[Type: Virtual Private Network]]
|
|
gadget = (1 << 7), [[Type: USB gadget]]
|
|
/* p2p = (1 << 8), [[Type: Peer-2-Peer]]*/
|
|
all = (Efl.Net.Session.Technology.ethernet | Efl.Net.Session.Technology.wifi | Efl.Net.Session.Technology.bluetooth | Efl.Net.Session.Technology.cellular | Efl.Net.Session.Technology.vpn | Efl.Net.Session.Technology.gadget), [[All technology types]]
|
|
}
|
|
|
|
class Efl.Net.Session (Efl.Loop_User) {
|
|
[[Used by application to request network connectivity.
|
|
|
|
This API is targeted at applications that need access to the
|
|
network, specifying the allowed bearer technologies to connect
|
|
to the internet, as well as if just local networking is enough
|
|
or validated internet access is required.
|
|
|
|
Some platforms may not implement the backend for this class, in
|
|
such cases the system will report always @.state "online"
|
|
(@Efl.Net.Session.State.online) and other properties will be
|
|
NULL, such as @.name, @.interface, @.ipv4 and @.ipv6; as well as
|
|
@.technology is set to @Efl.Net.Session.Technology.unknown. Thus
|
|
if there is need to detect for an actual backend, check if the
|
|
state is online but those properties are NULL or technology is
|
|
unknown.
|
|
|
|
\@note the @.connect method is subject to backend policy. For
|
|
instance, ConnMan uses
|
|
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
|
|
|
|
@since 1.19
|
|
]]
|
|
events {
|
|
changed; [[Called when some properties were changed.]]
|
|
}
|
|
|
|
methods {
|
|
connect {
|
|
[[Asks the session to be connected.
|
|
|
|
This method doesn't need to be called if all an
|
|
application want is to monitor the connectivity state,
|
|
like a poller that will only try to access the
|
|
webservice when there is an existing connection without
|
|
triggering one.
|
|
|
|
This method is subject to backend policy. For instance,
|
|
ConnMan uses
|
|
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
|
|
]]
|
|
params {
|
|
online_required: bool; [[If $false, access points with local state are enough. If $true, the access point must be in online state, with a validated internet connection]]
|
|
technologies_allowed: Efl.Net.Session.Technology; [[Bitwise OR of technologies to allow]]
|
|
}
|
|
}
|
|
|
|
disconnect {
|
|
[[Indicates this session doesn't need a connection anymore.
|
|
|
|
This reverses the effect of @.connect, let the system
|
|
disconnect if nothing else needs a connection. One may
|
|
still use the session object to monitor the connectivity
|
|
state via properties and "changed" event.
|
|
]]
|
|
}
|
|
|
|
@property name {
|
|
[[The user-friendly access point name.]]
|
|
get { }
|
|
values {
|
|
name: string; [[Access point name]]
|
|
}
|
|
}
|
|
|
|
@property state {
|
|
[[If the session connectivity is offline, local or online.
|
|
|
|
\@note if there is no backend for this class, then state
|
|
will be always online, however @.technology will be
|
|
unknown, @.interface, @.name, @.ipv4 and @.ipv6 will be
|
|
NULL.
|
|
]]
|
|
get { }
|
|
values {
|
|
state: Efl.Net.Session.State; [[Network session state]]
|
|
}
|
|
}
|
|
|
|
@property technology {
|
|
[[The access point technology that backs this session]]
|
|
get { }
|
|
values {
|
|
technology: Efl.Net.Session.Technology; [[Network session technology]]
|
|
}
|
|
}
|
|
|
|
@property interface {
|
|
[[The interface allows the application to assign the socket to a given device using SO_BINDTODEVICE]]
|
|
get { }
|
|
values {
|
|
interface: string; [[Network interface to bind to]]
|
|
}
|
|
}
|
|
|
|
@property ipv4 {
|
|
[[IPv4 in use for this session.]]
|
|
get { }
|
|
values {
|
|
address: string; [[IPv4 address]]
|
|
netmask: string; [[IPv4 netmask]]
|
|
gateway: string; [[IPv4 gateway]]
|
|
}
|
|
}
|
|
|
|
@property ipv6 {
|
|
[[IPv6 in use for this session.]]
|
|
get { }
|
|
values {
|
|
address: string; [[IPv6 address]]
|
|
prefix_length: uint8; [[IPv6 prefix]]
|
|
netmask: string; [[IPv6 netmask]]
|
|
gateway: string; [[IPv6 gateway]]
|
|
}
|
|
}
|
|
}
|
|
|
|
implements {
|
|
Efl.Object.destructor;
|
|
Efl.Object.constructor;
|
|
Efl.Object.finalize;
|
|
}
|
|
}
|