Easy Publish and Consume Library
As GNOME remembers the meaning of the 'N' in its name, more and more GNOME applications become network aware. GNOME provides excellent libraries for implementing network capabilities, nevertheless quite some effort is needed to glue them together to provide a smooth user experience.
When starting to add network support to Glom, we at Openismus decided it would be time to stop this frequent reinvention of the wheel, and put some of this glue code into an easy to use library. So the Easy Publish and Consume Library (libepc) was born.
The Easy Publish and Consume Library is intended to provide an easy method to
- publish data per HTTPS
- announce that information via DNS-SD,
- find that information
- and finally consume it
When using that library you shall not bother about boring details like properly using Avahi or setting up SSL/TLS certificates. All you should do to let your application publish information to the network, is writing the following three commands:
publisher = epc_publisher_new ("Easy Publisher Example", NULL, NULL); epc_publisher_add (publisher, "Hello", "World!", -1); epc_publisher_run_async ();
Once you have done this, your application runs a HTTPS server, announcing itself to the local network via DNS-SD and publishes the information
World! under the key
Retrieving values shouldn't be harder:
consumer = epc_consumer_new_for_name ("Easy Publisher Example"); value = epc_consumer_lookup (consumer, "Hello", &length, &error);
As those examples are working now, we Openismus guys would highly welcome some feedback - I even added e-mail notifications to my site to allow real discussion.
Well, maybe it should be noted, that libepc isn't meant to replace desktop configuration daemons like GConf or Ryan's dconf initiative. This library just is a simple method for publishing byte arrays and maybe UTF-8 strings to your network. No support for integers, booleans, no schemas. It's fully up to you, how to use the data published.
- Source code is available: git clone http://taschenorakel.de/git/libepc
- Alternatively you can get tarballs: libepc-0.2.tar.bz2 (Signature), git snapshots
- Maybe more important at this stage: The Reference Manual
- And code examples: list-resources.c, lookup-resource.c, simple-publisher.c, consumer-ui.c
This locations at taschenorakel.de are just temporary locations, if nobody disagrees I'd like to upload this library to the GNOME servers as soon as possible.