Added Python bindings for creating network contexts

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Add API functions to set/get a pointer from device/channel structs

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Local backend: Open attributes files with "r+" and not "w"

"w" means that we open the attribute file for write, just like "r+";
however, "w" will create the file if it doesn't exist yet, which
would be a bad idea here. While the sysfs filesystem will refuse to
create a file, another filesystem can already be used exporting the
SYSFS_PATH variable.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Added three high-level API functions dealing with triggers

The three new API functions are:
- iio_device_is_trigger, which returns true if the device is a
  trigger and false otherwise,
- iio_trigger_get_rate, to get the frequency of the trigger,
- iio_trigger_set_rate, to set the frequency of the trigger.

Those three functions are backend-independent.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Added API functions iio_device_set_trigger / iio_device_get_trigger

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Local backend: Handle read/write errors on attribute files

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Local backend: Added functions local_set_trigger / local_get_trigger

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
IIOD: Code factorization in ops.c

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
IIOD: Free dynamically allocated tokens on error

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
IIOD: Added SETTRIG / GETTRIG commands

Those commands can be used to set / get the trigger of a device.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Network backend: Factorize code

This also fixes an incorrect error message displayed
(in network_write_attr_helper).

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Network backend: Added network_set_trigger / network_get_trigger

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>