genxproj - remote control
genxproj needs to remote control the applications it starts. Most often
the remote control operations are used to direct simple operations such
as "save the file", "reload the file", "import", "export". Since the
application is started by genxproj, it has extensive access to the
environment of the application, which allows it to remote control
applications that are not explicitly prepared for being remote controlled.
The following remote control methods have been tested:
- 1. binding stdio; genxproj sends commands to the application on stdin
and the application answers on stdout; the most trivial way on UNIX
(this is how pcb-rnd is remote controlled). This is the preferred method
for any application that has support for parsing commands on stdin.
- 2. if the application is linked with -rdynamic: .so injection using
LD_PRELOAD. The injected code reads a pipe for commands and makes
calls to the application's C functions; other than -rdynamic and
symbols not stripped, the application doesn't need to support remote control
- 3. .so injection without -rdynamic: same as 2., but calls can be made
only to shared library functions that the application depends on. For example
the widgets created by a gtk application can be listed and widgets can
be activated (e.g. buttons pressed). This is how gerbv is remote controlled.
This method is the ultimate fallback and works even if the application has
no symbol information (typical case on binary Linux distributions).
Methods that could potentially work but are currently not implemented or
tested:
- 4. other traditional UNIX IPC methods, such as message queues, shared
memory, local sockets; the application needs to be prepared.
- 5. through plugins of the application; if the application can be
extended using plugins, a plugin that offers one of the methods mentioned in
4. could be implemented. The advantage is that the application still doesn't
need explicit support for remote control and the plugin can be distributed
with the genxproj workflow.
- 6. genxproj has full access to the windows of the application thus
it could generate key presses and mouse events. It could be possible to
trigger hot key actions from genxproj as means of remote control. However
this wouldn't work well with applications that have stateful windows: if
a dialog box is open, the hotkey intended for the top window may be caught
by the dialog box haivng a different effect.
- 7. RPC, dbus: the heavyweight solution