Commit Graph

742 Commits

Author SHA1 Message Date
Bruno Dilly adb95630ef eina: remove tests, examples and docs for eina_model
Summary:
Since eina_model was dropped some years ago.
Also a few other points where related stuff is just commented out.

Reviewers: iscaro, barbieri

Reviewed By: barbieri

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4442
2016-11-30 18:37:34 -02:00
Bruno Dilly 887be4d4e5 evas: add example for multiseat events
Also useful to make some tests / debugging.
2016-11-30 16:49:25 -02:00
Bruno Dilly 639e0eeaf5 examples/evas: sort gitignore 2016-11-30 16:49:25 -02:00
Gustavo Sverzut Barbieri d07e0c3072 examples/ecore: build ecore_con_url_ftp_example 2016-11-29 16:03:13 -02:00
Gustavo Sverzut Barbieri a4931f4fb0 ecore_con_url_headers_example: allow POST data. 2016-11-29 16:03:13 -02:00
Bruno Dilly e190173338 elementary: fix make examples
After commit
54abdad6e0 elementary-cxx: Fix filemvc wrong usage of Efl_Future
it's required to add libethumb_client.la to ELEMENTARY_LDFLAGS
2016-11-28 17:21:42 -02:00
Vitalii Vorobiov a5ce6200a2 example: update edje-edit-part-box to use not deprecated functions
since box/table item API is deprecated and replaced with new API, it is important
to use them in example as well

Fixes T4931
2016-11-28 17:00:24 +02:00
Felipe Magno de Almeida 54abdad6e0 elementary-cxx: Fix filemvc wrong usage of Efl_Future 2016-11-28 12:32:18 -02:00
Gustavo Sverzut Barbieri 167ff29ea0 efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.

Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.

As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 17:27:32 -02:00
Gustavo Sverzut Barbieri 46341b329d efl_io_buffered_stream: wraps an I/O object and make it easy to use.
Since all other efl.io objects are low-level, the recommended approach
is to use an efl.io.copier. However when dealing with in-memory,
bi-directional comms like talking to a socket, we always end with 2
queues, 2 copiers and the annoying setup that is being replicated in
ecore_ipc, efl_debug and so on.

This class is the base to make it simpler. Other classes such as
Efl.Net.Socket.Simple, Efl.Net.Dialer.Simple and Efl.Net.Server.Simple
will use it to provide simpler code to users.

I guess we can call EFL+EO Java now?
2016-11-25 17:27:32 -02:00
Gustavo Sverzut Barbieri 3bc7c502db ecore_ipc_server_example: test "write & del" using -m/--single-message
An use case is to send some message and delete the handle, all data
should be sent to client.
2016-11-23 12:57:10 -02:00
Gustavo Sverzut Barbieri f7f6847b5a ecore_ipc_client_example: test "write & del" using -m/--single-message
An use case is to send some message and delete the handle, all data
should be sent to server.
2016-11-23 12:57:10 -02:00
Gustavo Sverzut Barbieri 7b2faeadb1 ecore_ipc_server_example: delete clients when they disconnect.
if a client disconnect we must delete them explicitly.
2016-11-22 21:58:14 -02:00
Gustavo Sverzut Barbieri b52a0151b7 ecore_ipc_client_example: better lifecycle management.
If the server is gone, immediately delete it, this exercises deleting
the server from inside its event.

Then, if the server was already deleted, do not do it again.

Also remove the shadow variable, keep only the global scope.
2016-11-22 21:56:41 -02:00
Gustavo Sverzut Barbieri 06263c9eb3 add ecore_ipc_{client,server}_example.
Ecore_Ipc lacked examples so we can explore its API (and check if it
work :-P)
2016-11-22 19:50:11 -02:00
Cedric Bail a0d9354be1 elementary_cxx: fix examples to use the new API. 2016-11-21 16:03:27 -08:00
Gustavo Sverzut Barbieri 2e3aa2cf6c ecore_file_download_example: allow cancel.
If we ^C to cancel the main loop, then abort the download, this allows
using one more API in the example and provides more correct code.
2016-11-21 19:47:35 -02:00
Gustavo Sverzut Barbieri 0c8c7ffacf ecore_file_download_example: check the correct file size.
when downloading DST_MIME, check its size, not DST's.
2016-11-21 19:47:35 -02:00
Gustavo Sverzut Barbieri cc703b619d ecore_file_download_example: also unlink DST_MIME.
ecore_file_download() will refuse to download if file already exists,
then we must unlink DST_MIME as done with DST before we try to
download, otherwise it won't work on the second time.
2016-11-21 19:47:35 -02:00
Stefan Schmidt 60bb5621d1 examples/elementary: bring back datetime_example target
In commit 5929f0311d this was removed. While
the commits intend was to remove the cxx variant of this example only.

Bring this back so examples are building again.
2016-11-15 17:45:32 +01:00
Felipe Magno de Almeida 5929f0311d elementary-cxx: Removed example from datetime 2016-11-11 18:07:24 -02:00
Bruno Dilly ed48b8d93e efl: add getter for input device's seat
Since this code will be required in many use cases
of the multiseat feature, including examples.

Reviewers: iscaro, barbieri, cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4385
2016-11-09 11:02:38 -02:00
Gustavo Sverzut Barbieri 98fe627ca4 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-11-08 22:40:34 -02:00
Guilherme Iscaro 8687a23820 Ecore Evas VNC: add client disconnected callback.
Summary:
Ecore Evas VNC: Properly unregister the region push hook callback.

This callback must be unregistered when the VNC server is deleted.

Reviewers: bdilly, barbieri, cedric

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4384

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-11-07 14:44:40 -08:00
Cedric BAIL 5038f2551a elementary: update example to use Efl_Future. 2016-11-07 11:10:49 -08:00
Guilherme Iscaro fc2a3052b4 VNC Example: Add support to Ecore_Evas FB engine. 2016-11-04 18:29:42 -02:00
Bruno Dilly 96995032ea examples/edje: add example of entry - editable text
Not trivial to be done imo, so it deserves an example.
2016-11-04 18:01:57 -02:00
Bruno Dilly 24f4d14004 examples/edje: Fix build instructions and titles
Fix a few c&p errors
2016-11-04 18:01:57 -02:00
Bruno Dilly f8a0515b71 examples/edje: sort makefile lists 2016-11-04 18:01:57 -02:00
Gustavo Sverzut Barbieri 218403dc19 examples/eldbus/dbusmodel.c improve situation, far from correct.
it was using old API, updated, but still doesn't work as expected,
lots of warnings from children being left alive, all proxies are
reporting no properties...

when model dies, all children proxies should die as well, otherwise we
get on console:

```
CRI:eldbus lib/eldbus/eldbus_core.c:215 eldbus_shutdown() Alive TYPE_SYSTEM connection
ERR:eldbus lib/eldbus/eldbus_core.c:175 print_live_connection() conn=0x8219230 alive object=0x8276d50 net.connman of bus=net.connman
...
```

Also, all proxies are reporting no properties "(no properties yet)",
likely they are missing to fetch such... even if "--wait" to let it
run, no asynchronous properties are delivered, at least not triggering
EFL_MODEL_EVENT_PROPERTIES_CHANGED.
2016-11-04 13:19:57 -02:00
Bruno Dilly fcf9f55150 examples/edje: cosmetic fixes in a couple examples
Fix usage messages, remove unused defines
2016-11-03 18:47:32 -02:00
Gustavo Sverzut Barbieri c2630c829f efl_net_server support systemd socket activation.
It includes extensive verifications to avoid mistakes and usage of
incorrect sockets.
2016-11-01 16:37:04 -02:00
Bruno Dilly 3bc2793588 examples/ecore: add example / test for wayland multiseat 2016-11-01 16:06:19 -02:00
Gustavo Sverzut Barbieri 15a0ca0fb9 examples/ecore: command to generate OpenSSL PEM files.
it's cumbersome to remember these commands and without them it's hard
to test the SSL server examples, so add a make rule for that.
2016-11-01 11:52:21 -02:00
Gustavo Sverzut Barbieri 83457a52e2 efl_net_server_example: oops, do not assume all servers are Efl.Net.Server.Fd
SSL server is not an Fd, it contains one internally, but that's
hidden. So call proper methods.
2016-11-01 10:46:38 -02:00
Gustavo Sverzut Barbieri a5ebf67a83 efl_net_{server,dialer}_ssl: TCP + SSL easy to use.
in the previous commit we're manually upgrading an existing TCP socket
to SSL. It is desired since some protocols need to negotiate, like
STARTTLS and the likes

Now we offer 2 classes that does autostart SSL once the socket is
ready.
2016-11-01 01:31:56 -02:00
Gustavo Sverzut Barbieri f4198f022a efl_net_socket_ssl: initial SSL wrapper.
This is the first step towards SSL connections on top of sockets, with
an example on how to upgrade a dialer and a server client using TCP.
2016-10-31 19:39:33 -02:00
Stefan Schmidt c3d1cb9116 examples: ecore: add ecore_evas_vnc example binary to .gitignore 2016-10-27 18:22:42 +02:00
Gustavo Sverzut Barbieri 84ec16cfa8 efl_io_copier_example: add AF_UNIX support. 2016-10-26 19:16:29 -02:00
Gustavo Sverzut Barbieri 651ff13616 addded efl_net_{socket,dialer,server}_unix
This introduces AF_UNIX server and dialer, these are not available on
Windows as in that platform we'll create a custom class for native
'local' communication.

In the future we can add a wrapper class Efl.Net.Local that will use
the class for each platform, but won't expose its details.

For instance, if we ever expose 'credentials' (which I didn't because
they are not portable), then it doesn't make sense to try to match
that on Windows. The 'Efl.Net.Local' would just stick to the basics:
Reader, Writer and Closer APIs.
2016-10-26 19:01:03 -02:00
Gustavo Sverzut Barbieri 06608f632e efl_io_copier_example: allow udp as input/source.
now that we have a 'bind', let's use the given address as bind and
dial to `0.0.0.0` or `::`. This allows the dialer to receive data at
the given address and make the example useful.
2016-10-26 12:46:09 -02:00
Gustavo Sverzut Barbieri 6e6d43878b efl_net_dialer_udp_example: add missing print of groups. 2016-10-26 12:24:48 -02:00
Jean-Philippe Andre 34e6c834ce examples: Remove now broken cxx elm examples
Bubble, thumb and separator cxx examples rely on APIs we don't
want to expose in EO, so not available in C++ either. Those
are legacy only.
2016-10-26 13:42:54 +09:00
Lauro Moura 4f52588b3c efl_js: Update JS examples
Changing imports, functions, etc.

Also export "cast" function for all eolian_js generated classes.
2016-10-25 12:23:34 -02:00
Gustavo Sverzut Barbieri cd53f9bad2 efl_net_*_udp: make UDP usable, including multicast.
This was a huge work, but now UDP is usable as seen in the examples.

Instead of relying on 'connect()', just do 'sendto()' and 'recvfrom()'
as they are universal. Multicast address can only be connected in
IPv4, IPv6 wasn't working and I'm not sure the IPv4 is portable to
other platforms.

Dialer will auto-join multicast groups is the dialed address is
one. Multicast properties such as time to live (hops) and loopback can
be configured. When joining multicast groups, the local
address/interface can be configured by 'IP@IFACE' format, with
'@IFACE' being optional.

Dialers will now auto-bind, so it can receive data as dialers are
expected to be bi-directional. One can manually specify the binding
address if there is such need.

Since datagrams must be read in their full size, otherwise the
remaining bits are dropped, expose next_datagram_size_query() in both
Efl.Net.Socket.Udp and Efl.Net.Server.Udp.Client.

To finalize UDP for real we need to introduce an 'Efl_Net_Ip_Address'
structure to serve as both IPv4 and IPv6 and expose 'sendto()' and
'recvfrom()'. These will come later as this commit is already too big.
2016-10-25 10:11:48 -02:00
Gustavo Sverzut Barbieri 285f5c09e7 efl_* examples: improve usability of boolean options.
Instead of using 'bool', which requires a parameter to be useful, make
them toggle of the default value.

Adapt names to make more sense in that context.
2016-10-22 11:55:45 -02:00
Gustavo Sverzut Barbieri 26866ca2a8 efl_net_*_udp: expose SO_DONTROUTE.
It's common to have protocols that are restricted to local network
only, thus allow exposing SO_DONTROUTE to avoid mistakes.
2016-10-22 11:46:19 -02:00
Gustavo Sverzut Barbieri 5e54c3aa57 efl_io_copier: add inactivity_timeout.
This is handful to error the copier with ETIMEDOUT if there are no
reads or writes in the given amount of time.

Since copiers are usable to download data or handle network clients,
it's easy to set a timeout and disconnect, let's say UDP clients that
are gone.
2016-10-22 10:52:22 -02:00
Gustavo Sverzut Barbieri 7493368e54 efl_net_server_udp: initial UDP server.
This is the initial UDP server that works similarly to the TCP one,
however under the hood it's widely different since the socket is
reused for all "clients", thus needs a new Efl.Net.Server.Udp.Client
(Efl.Net.Socket) as Efl.Net.Socket.Udp exposes the fd and options such
as 'cork', which would interfere in other clients.

The main socket will read the packets and find an existing client to
feed it. If no client exists, then it will create one if not overr
limit. Since there is no kernel-queuing as done by listen()/accept(),
the 'no reject' case will just accept the client anyway.

Next commits will improve UDP server handling with some advanced
features:

 - join multicast groups
 - bind to a specific interface (SO_BINDTODEVICE)
 - block packets going out of local network (SO_DONTROUTE)
 - specify priorities (SO_PRIORITY)
2016-10-21 13:33:27 -02:00
Gustavo Sverzut Barbieri 3cb15c17e0 efl_net_dialer_udp_example: be more 'correct' using events to read/write.
instead of blindly reading and writing, which can lead to hangs due no
server, let's use can_read and can_write to do the operations, this
won't let us believe we can read when we can't.

it's also the recommended approach, so let's show that in the examples
so users don't copy&paste incorrect stuff :-)
2016-10-21 13:33:27 -02:00