path: root/src/ (follow)
AgeCommit message (Collapse)Author
2017-10-27ecore_con: add an Efl_Net.hCedric Bail
2017-09-29ecore_con: add an intermediate Efl.Net.Server.IpCedric BAIL
2017-03-29implement efl_net_{socket,dialer,server}_windowsGustavo Sverzut Barbieri
This is the local socket for windows, analogous to AF_UNIX. `Efl_Net_Socket_Windows` is the base class doing `ReadFile()` and `WriteFile()` using overlapped I/O, as well as the close procedure (`FlushFileBuffers()`, `DisconnectNamedPipe()` and `CloseHandle()`). These are done on top of an existing HANDLE that is set by `Efl_Net_Dialer_Windows` (from `CreateFile()`) or `Efl_Net_Server_Windows` (from `CreateNamedPipe()`). The overlapped I/O will return immediately, either with operation completed or `ERROR_IO_PENDING`, which means the kernel will execute that asynchronously and will later `SetEvent(overlapped.hEvent)` which is an event we wait on our main loop. That `overlapped` handle must exist during the call lifetime, thus cannot be bound to `pd`, as we may call `CancelIo()` but there is no guarantee the memory won't be touched, in that case we keep the overlapped around, but without an associated object. Windows provides no notification "can read without blocking" or non-blocking calls that returns partial data. The way to go is to use these overlapped I/O, with an initial `ReadFile()` to an internal buffer, once that operation finishes, we callback the user to says there is something to read (`efl_io_reader_can_read_set()`) and wait until `efl_io_reader_read()` is called to consume the available data, then `ReadFile()` is called again to read more data to the same internal buffer. Likewise, there is no "can write without blocking" or non-blocking calls that sends only partial data. The way to go is to get user bytes in `efl_io_writer_write()` and copy them in an internal buffer, then call `WriteFile()` on that and inform the user nothing else can be written until that operation completes (`efl_io_writer_can_write_set()`). This is cumbersome since we say we "sent" stuff when we actually didn't, it's still in our internal buffer (`pd->send.bytes`), but nonetheless the kernel and the other peer may be adding even more buffers, in this case we need to do a best effort to get it delivery. A particular case is troublesome: `write() -> close()`, this may result in `WriteFile()` pending, in this case we wait using `GetOverlappedResult()`, *this is nasty and may block*, but it's the only way I see to cope with such common use case. Other operations, like ongoing `ReadFile()` or `ConnectNamedPipe()` will be canceled using `CancelIo()`. Q: Why no I/O Completion Port (IOCP) was used? Why no CreateThreadpoolIo()? These perform much better! A: These will call back from secondary threads, but in EFL we must report back to the user in order to process incoming data or get more data to send. That is, we serialize everything to the main thread, making it impossible to use the benefits of IOCP and similar such as CreateThreadpoolIo(). Since we'd need to wakeup the main thread anyways, using `OVERLAPPED.hEvent` with `ecore_main_win32_handler_add()` does the job as we expect. Thanks to Vincent Torri (vtorri) for his help getting this code done with an example on how to do the NamedPipe handling on Windows.
2017-02-10net_proxy_helper: fix typo in dependenciesRomain Naour
Fixes: error: cannot find the library 'lib/eina/' or unhandled argument 'lib/eina/' Signed-off-by: Romain Naour <>
2017-01-09ecore_con - move libproxy to a slave binary with stdin/out msgingCarsten Haitzler (Rasterman)
so here's the ugly problem. libproxy. yes. we've discussed memory usage (e.g. it may have to execute javascript and pull in lots of deps etc.) but we dlopene'd on the fly. ok... but this didn't solve another issue i hit: libproxy was causing enlightenment to abort(). some internal bit of libproxy was raising a c++ exception. this wasn't caught. this causes an abort(). takes down your entire desktop. FANTASTIC. this is bad. i wouldnt' expect a library we depend on to be THIS anti-social but libproxy seemingly is. it SHOULd catch its error sand just propagate back to us so we can handle gracefully. there reall is no way around this - isolate libproxy. it's even worse that libproxy can load arbitrary modules that come from anywhere sho who knows what issues this can cause. isolation is the best solution i can think of. so this makes an elf+net_proxy_helper we spawn the first time we need a proxy lookup. we re-use that binary again and again until it exits (it should exit after 10 seconds of being idle with no requests coming in/pending). it'll respawn again later if needed. this involves now the efl net threads having to marshall back to mainloop to do the spawn and to write to the proxy process (reading is done by async exe data events and the data is passed down a thread queue to the waitng efl net thread). if the exe dies with pending requests unanswered then it's respawned again and the req's are re-sent to it... just in case. it has a limit on how often it'll respawn quickly. this seems to work in my limited testing. this ALSO now isolates memory usage of libproxy to another slave process AND this process will die taking its memory with it once it's been idle for long enough. that;s also another good solution to keeping libproxy impact at bay.
2016-12-12efl_net: add Efl.Net.Ip_AddressGustavo Sverzut Barbieri
This is a string parser, serializer and asynchronous resolver. It's purpose is to convert to and from the strings we use in our dialers and servers, such as "" or "[::1]:1234", properties allow to check the family, port, address bytes (slice) and even get a struct sockaddr pointer to use with bind()/connect() in outside code. It will also offer some utilities present in netinet/in.h in an easy to use way, after all IN6_IS_ADDR_LOOPBACK() works one way, while there is no IN_LOOPBACK and comparing with INADDR_LOOPBACK will lead to errors since it's in network order. Last but not least, it will do asynchronous resolve of host and port names using an internal thread and getaddrinfo(). The results are delivered using a Future with an array of objects.
2016-12-12efl_net: move error COULDNT_RESOLVE_HOST to broader scope.Gustavo Sverzut Barbieri
This error is shared by Dialer and Server, will also be used by IP resolution.
2016-12-10ecore_con: Ecore_Con_Server now on top of Efl_Net!Gustavo Sverzut Barbieri
This is a major work and unfortunately couldn't be split into smaller pieces as old code was highly coupled. Ecore_Con_Server is now a wrapper around Efl_Net_Dialer_Simple (ecore_con_server_connect()) and Efl_Net_Server_Simple (ecore_con_server_add()), doing all that the original version did with some fixes so ecore_con_ssl_server_upgrade() and ecore_con_ssl_client_upgrade() are more usable -- see the examples and -t/--type=tcp+ssl. I tried to be bug-compatible, with code annotations where things doesn't make sense. This was based on ecore_con_suite tests and some manual experimenting with the examples, these can be helpful if you find regressions (report/assign to me).
2016-11-29ecore_con_url: now on top of efl_net_dialer_http.Gustavo Sverzut Barbieri
Rewrite Ecore_Con_Url as a non-Eo (since it's just legacy) that is built on top of Efl_Net_Dialer_Http. Since there are some legacy behavior we do not want to expose in the new classes, hack around and manipulate the curl_easy_setopt() directly in those cases. This includes the cookies: there is no reason why we should expose independent files for read (COOKIEFILE) and write (COOKIEJAR), real world applications can manipulate the files directly, like copying from a template to a RDWR before using, etc.
2016-11-25efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.Gustavo Sverzut Barbieri
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-18efl_net_{control,session}: allow "none" backend.Gustavo Sverzut Barbieri
Since connman is specific to linux, on other platforms just compile a dummy "none" backend that will always report online and no other details. This will be used in Windows, MacOS and other platforms that still lack a proper backend. The compile-time infrastructure also allows for networkmanager to be added with ease, simply copy "efl_net*-none.c" or "efl_net*-connman.c" to be a starting point and then add its specifics, adapting and
2016-11-08efl_net_session and efl_net_control for ConnManGustavo Sverzut Barbieri
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, 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 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-01efl_net_{server,dialer}_ssl: TCP + SSL easy to use.Gustavo Sverzut Barbieri
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-10-31efl_net_socket_ssl: initial SSL wrapper.Gustavo Sverzut Barbieri
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-26addded efl_net_{socket,dialer,server}_unixGustavo Sverzut Barbieri
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-21efl_net_server_udp: initial UDP server.Gustavo Sverzut Barbieri
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-18efl_net_dialer_udp: "connect" to an UDP server to send and receive data.Gustavo Sverzut Barbieri
Like existing ecore_con code, this does not use SOCKSv5 UDP proxy. It's kinda cumbersome to add since requires a keep alive TCP connection to the server, a second UDP channel and framing around the original UDP frame. Added UDP_CORK (if present) to match TCP_UDP present in TCP sockets, this allows one to execute multiple write() calls that will result in a single datagram, generated when CORK becomes FALSE again. The efl_io_copier_example.c now accepts this as output. There is no input UDP as there is no way to notify the server of a connection (since such thing doesn't exit), usually servers react after a datagram is received, replying to the source.
2016-09-02efl_net_dialer_websocket: EFL now does WebSocket!Gustavo Sverzut Barbieri
The Efl.Net.Dialer.Websocket is just like other Efl.Net.Dialers: you can dial, you can close, monitor connected/address resolved and so on. And you can use WebSocket primitives and events such as text_send(), binary_send(), ping() and close_request() (since WebSockets use a close process where you should state a close reason). See efl_net_dialer_websocket_example.c Even if WebSocket is a message-based protocol (like "packets" from UDP), you can use efl_net_dialer_websocket_streaming_mode_set() to tell it to handle text or binary messages as a stream. Then all the Efl.Io.Reader and Efl.Io.Writer APIs work as expected, see efl_io_copier_example.c updates.
2016-08-22WIP: Introduce Efl.Net.Dialer.HttpGustavo Sverzut Barbieri
This class implements the Efl.Net.Dialer interface using libcurl to perform HTTP requests. That means it's an Efl.Net.Dialer, Efl.Net.Socket, Efl.Io.Reader, Efl.Io.Writer and Efl.Io.Closer, thus being usable with Efl.Io.Copier as demonstrated in the efl_io_copier_example.c socket, server and dialer for TCP.Gustavo Sverzut Barbieri
Efl.Net.Server defines how to accept new connections, doing the bind(), listen() and accept() for protocols such as TCP. Efl.Net.Dialer defines to to reach a server. Both are based on Efl.Net.Socket as communication interface that is based on Efl.Io.Reader, Efl.Io.Writer and Efl.Io.Closer, thus being usable with code such as Efl.Io.Copier. The Server will emit an event "client,add" with the established Socket, which is a child and can be closed by both the server or the user. The Dialer extends the Socket and allows for creating one given an address, that will be resolved and connected. TCP is the initial implementation so we an validate the interfaces. UDP, Unix-Local and SSL will come later as derivate classes. The examples are documented and should cover the basic principles: - efl_io_copier_example can accept "tcp://IP:PORT" and will work as a "netcat", can send data from socket, file or stdin to a socket, file, stdout or stderr. - efl_net_server_example listens for connections and can either reply "Hello World!" and take some data or work as an echo-server, looping back all received data to the user. More complex interactions that require a "chat" between client and server will be covered with new classes later, such as a queue that empties itself once data is read.
2016-06-21build: clean generated js and lua files manually to avoid problems with ↵Stefan Schmidt
CLEANFILES We hit another argument too long error with CLEANFILES. Moving the generated files for js and lua into separated variables and cleaning them manually fixes the issue.
2016-06-10build: split EXTRA_DIST files in src/ off from DISTFILES and handle separatelyStefan Schmidt
This is again to avoid the "Argument list too long" error we are hitting more and more now. Given we just merged elementary, emotion generic players, evas generic loaders and elm_code it is not surprising we are hitting it again. This time the number of files being hold in DISTFILES has just grown to big so a make dist was no longer possible. If one looks at what the DISTFILES variable from automake holds you can image it grows a lot with all the source files plus generated files we have in tree now. DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) To cut off a big chunk but still keep all the other automagic in place for SOURCE files I went and renamed the EXTRA_DIST in src/ to EXTRA_DIST2 and handle the files in a dist-hook now. Another thing to note here is that this also only happens as we have the one big Makefile with includes. If we go back to per directory Makefiles this problem should vanish as well. In any case we need a solution for 1.18 now and this is what I have to offer. If you have a cleaner solution in mind feel welcome to test it out and if everything we need keeps working (make, make examples, make check, make benchmark, make dist and make distcheck) go ahead.
2016-05-24ecore-con - simplify down to a single libc resolverCarsten Haitzler (Rasterman)
Summary: this removes the cares/ares based resolver and the compiled-in dns.c resolver, modified the getaddrinfo based resolver to use threads not forking (almost halving its size) and now makes that the only resolver we have. getaddrinfo handles ipv6 and ipv4 (according to docs). this simplifies code paths, drops code size of the efl tree by about 11k lines of code, makes it easier to test and more robust to future changes with ip resolving as it now just relies on libc. we won't have coverity complaints on dns.c imported code anymore to fix and don't have tokeep up with bugfixes/security from the upstream imported code. this means we use a single resolver on all platforms (windows, mac, linux) as opposed to before where cares was used for windows, and dns.c on linux/mac. oh and the forking original was broken since our move to eo too. so it couldnt even compile if enabled, letalone work. so fix bug with missing /etc/resolv.conf that dns.c couldn't cope with, fix testability, fix maintainability and reduce efl codebase size. this fixes T3668 @fix @improve Subscribers: cedric, seoz, jpeg Maniphest Tasks: T3668 Differential Revision:
2016-05-11Efl network: Remove the no longer needed .Base hack.Tom Hacohen
2016-03-31build: keep our CLEANFILES tidy to avoid argument list too long during cleanStefan Schmidt
We have been putting the generated eo files and BUILT_SOURCES into CLEANFILES several times. So far this have not been a real problem but with the elm merge and more and more eo files showing up this did explode recently. During make distcheck a lot of files kept being around and make complained about them. It took some digging to find the arguments list to long error. If you want details on this great limitation have a look here: In our case we have been lucky enough that we just appened many files over and over again. Not doing that solves the issue for now. My testing showed no problems but if I missed something let me know. Fixes T3386
2016-02-18ecore_con: changing from Ecore.Con.Base to Efl.Network.Base.Srivardhan Hebbar
Summary: Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric Subscribers: jpeg Differential Revision: Signed-off-by: Cedric BAIL <>
2016-02-12ecore_con: change Ecore.Con.Client to Efl.Network.Client.Srivardhan Hebbar
Summary: Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric Subscribers: jpeg Differential Revision: Signed-off-by: Cedric BAIL <>
2016-02-05ecore_con: changing Ecore.Con.Server to Efl.Network.Server.Srivardhan Hebbar
Summary: Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric Subscribers: jpeg Differential Revision: Signed-off-by: Cedric BAIL <>
2016-01-04ecore_con: from ecore_con_connector to efl_network_connector.Srivardhan Hebbar
Summary: Changed ecore_con_connector.eo to efl_network_connector.eo as part of migrating to efl_network. Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric, jpeg Differential Revision: Signed-off-by: Cedric BAIL <>
2015-12-23efl-js: JavaScript Eolian bindingFelipe Magno de Almeida
To configure efl sources with bindings to use in nodejs add ––with-js=nodejs in configure flags to generate node files $ configure --with-js=nodejs and compile normally with: $ make $ make install To use, you have to require efl: efl = require('efl') The bindings is divided in two parts: generated and manually written. The generation uses the Eolian library for parsing Eo files and generate C++ code that is compiled against V8 interpreter library to create a efl.node file that can be required in a node.js instance. @feature
2015-11-12ecore_con: fix another case where files have been moved and sitcheck benn brokenStefan Schmidt
This time the move of dns to static_libs in 4f24deac448c648d0b514acefd8bbb8721c9fe04 broke distcheck as the header file was never shipped with the tarball. I would really appreciate if author and reviewer would pay more attention.
2015-11-10ecore_con: Moving dns.c and dns.h to static_libs.Srivardhan Hebbar
Summary: Took the license file from The dns.c and dns.h are taken from here. Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric Differential Revision:
2015-11-09ecore_con: add http_parser static lib.Srivardhan Hebbar
Summary: This lib would be used in efl_network_websocket. Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric Reviewed By: cedric Differential Revision: Signed-off-by: Cedric BAIL <>
2015-09-03ecore-con-url- split out the curl dleopener and resolver and headersCarsten Haitzler (Rasterman)
this splits out out "manual" dlopen (eina_module_load) of curl into its own .c file and special header out of ecore_con_url.c to tidy up that code a bit and isolate our curl magic loading/handling
2015-06-23Ecore_Con: Fix make distcheckJean-Philippe Andre
2015-06-22ecore_con: eoifying ecore_con_eet.Srivardhan Hebbar
Summary: This is still work in progress. I've added new file for temporary purpose. Idea is to first eoify everything then change its namespace properly. Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric Subscribers: cedric Differential Revision: Signed-off-by: Cedric BAIL <>
2015-05-23autotools: ecore_con_legacy.c is not compiled directly, but must be in dist ↵Daniel Kolesa
2015-05-18ecore_con: changed Ecore_Con_Url to Efl_Network_Url.Srivardhan Hebbar
Summary: This is just the beginning. I tried for one class to check. Tell me if this is fine, I'll change in other classes also. The goal is to simplify and make our API clearer to understand to new comers. Reviewers: cedric Subscribers: cedric Differential Revision: Signed-off-by: Cedric BAIL <>
2015-05-07Revert "autotools: enable make check per individual modules."Stefan Schmidt
This reverts commit 35119e7bfdc7c13c2041293f3d0b2ebe1fb7c313. Reverted to bring make check back in a working state. Also the way we want to handle a more modular testing needs discussion.
2015-05-07autotools: enable make check per individual modules.kabeer khan
Currently make check runs tests of whole EFL.Enabled running of tests of individual modules by make check-<modulename> Signed-off-by: kabeer khan <> Signed-off-by: Cedric BAIL <>
2015-04-15ecore_con: add test cases for ecore_con_eet.Srivardhan Hebbar
Summary: Added test case for ecore_con_eet. Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric Subscribers: cedric Differential Revision: Signed-off-by: Cedric BAIL <>
2015-04-07ecore_con: Make sure the server.key and pem are distributed in the tarballStefan Schmidt
Pull them out of the if EFL_ENABLE_TESTS test as we need them to be put into the tarball in all cases.
2015-04-06ecore_con: Split ecore_con test suite from ecore.Srivardhan Hebbar
Summary: Have created ecore_con test suite. Signed-off-by: Srivardhan Hebbar <> Reviewers: cedric, Sergeant_Whitespace, stefan_schmidt Subscribers: stefan_schmidt, Sergeant_Whitespace, cedric Maniphest Tasks: T2235 Differential Revision:
2014-10-06elua/autotools: generate .eo.lua files out of all eo files at build timeDaniel Kolesa
Also change the generator a bit so that it doesn't rely on lib name information and fix the runtime to properly source lua files within tree.
2014-10-02Build system: Clean up the generation of sources from eolian.Tom Hacohen
This cleans up a lot of the build system. This makes everything consistent, clean, less redundant and also fixes the issue of make clean not cleaning up generated files.
2014-09-01Ecore con: Add Connector class (the connecting variant of server).Tom Hacohen
This change also consists of cleaning up the server class and adding a constructor and a finalizer to it.
2014-09-01Ecore con url: Migrate to eo.Tom Hacohen
2014-08-30revert all recent ecore-con related eo changes. completely broken.Mike Blumenkrantz
please test things before committing. reverts all changes since and including f6156c9a6234237757b61960c690e8d55779e764
2014-08-28Ecore con: Add Connector class (the connecting variant of server).Tom Hacohen
This change also consists of cleaning up the server class and adding a constructor and a finalizer to it.
2014-08-28Ecore con url: Migrate to eo.Tom Hacohen