# libxaal_sec A minimal xAAL library in C, with security Conforms to xAAL specification v0.5 (i.e., v0.4 + encryption) Based on libjson-c (0.11.99), libuuid1 (2.25.2), libsodium (1.0.3) (e.g. use debian packages: uuid-dev libjson-c-dev libsodium-dev) The xAAL library is composed of xaal.h and libxaal.c It provides a minimal set of helpers for developping xAAL applications: - xAAL_join_bus(): Join the multicast (IPv4 or IPv6) xAAL bus - xAAL_pass2key(): Build a ciffering key from a passphrase - xAAL_add_wanted_target() / xAAL_del_wanted_target(): Manage the list of wanted targets - xAAL_read_bus(): Receive a message an parses header - xAAL_free_msg(): Free data allocated by xAAL_read_bus() in case of success - xAAL_write_bus() / xAAL_write_busv() / xAAL_write_busl(): Send a message on the bus (targets provided as a json array / as a vector / as a (va_)list) - xAAL_notify_alive() xAAL_reply_getDescription() xAAL_reply_getBusConfig() xAAL_reply_setBusConfig() Helpers to send classical replies - xAAL_targets_match(): Test if an address belongs to the list of targets of a message Note: the xAAL library uses the prefix 'xAAL_' as namesapce. Some applications are proposed as proof of concept: - dumper: Listen to the xAAL bus and (pretty) print messages to stdout Usefull for debugging purpose - dummyLamp: Behave like a basic lamp Accepts on/off queries; show results on stdout - lampCommander: A simple command-line HMI for lamps It listens to 'alive' messages from lamp devices and maintain an internal list of discovered ones. (It manages timeout.) The 'select' menu allows to select/deselect which of the discovered lamps one then wants to command. The 'on' menu sends a 'on' request to selected lamps. The 'off' menu sends a 'off' request to selected lamps. - thermoPC: Themperature of your CPU(s) on xAAL Dependencies: libsensors4-dev The intent of this piece of code is to do a 'composite' xAAL device. It exposes as much as 'thermometer.basic' devices as your libsensors reports temperature sensors for your CPU(s). Try: sensors|grep '^Core' Note that if you really need to monitor sensors of your PC, snmp is a better choice: http://www.net-snmp.org/wiki/index.php/Net-SNMP_and_lm-sensors_on_Ubuntu_10.04 - thermoWatch: Displays thermometers values It listens to 'alive' messages from thermometers devices and maintain an internal list of discovered ones. - tattler: An exotic sensor that monitors given Ethernet addresses on the home network and sends xAAL notification about their presence. It does the job by looking at the neighbors table (ARP), and sends UDP probes when nodes fall in a stale state, and after waiting a configured time. Note: this time is given in seconds, it can be 0 (immediately), or negative (no probes). The configuration file is in a json format. Dependencies: libmnl-dev - schemory: A simple schema repository It sends schema, retrieved on a directory or from an url. Dependencies: any libcurl4-*-dev (e.g., libcurl4-gnutls-dev flavor) - schemaDumper: A dummy app to test schema repository. Also, another practical example for sending a request to a set of targets. - cache: A simple cache service. Dependencies: libsqlite3-dev - automalua: Automata with Lua scripts. A short introduction of the API: .Variables provided to Lua scripts (readed from config file): xAAL_Lua_baseaddr: An uuid, possibly of the first declared device. xAAL_Lua_parent: The address of the composite device. xAAL_Lua_parameter: A string readed from the config file. .Functions provided to Lua scripts: xAAL_Lua_declare_device(): The Lua script must declare each device. The expected parameter is a table with following keys: addr(string) devType(string) vendorId(string) productId(string) version(string) url(string) info(string) unsupportedAttributes(table of string) unsupportedMethods(table of string) unsupportedNotifications(table of string) Note: If there is no addr, the baseaddr is used for the first registred device, and baseaddr++ for the following ones. It retruns the address of the declared device. xAAL_Lua_filter_broadcast_by_source(): First parameter is the address of the device that wants a filter. Second parameter is a table of source addresses. xAAL_Lua_filter_broadcast_by_devType(): First parameter is the address of the device that wants a filter. Second parameter is a table of source addresses. xAAL_Lua_set_alarm(): First parameter is the delay in seconds. Second parameter is the address of the device that wants an alarm. Third parameter is a string, a parameter bassed back at trigger .Function that must be declared in the Lua script, called by the middleware: xAAL_Lua_receive_callback(): First parameter is the address of the device that receives the message. Next parameters (strings) are the source, devType, msgType and action of the message Last parameter is a table representing the body of the message. xAAL_Lua_alarm_callback(): First parameter is the address of the device that set the alarm. Second parameter is the string provided while setting the alarm. TODO: use threads, use a restricted sandbox for lua scripts... Dependencies: liblua5.2-dev - azerty: A dummy set of switch buttons (i.e., your keyboard) Copyright - Christophe Lohr - Telecom Bretagne - 2015 - The library is provided according to the termes of the GNU Lesser General Public License v3.0 and following - The demo applications are provided according to the terms of the GNU General Public License v3.0 and following - Dual-licenses are accepted, contact us.