libiio
network.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*
3  * libiio - Library for interfacing industrial I/O (IIO) devices
4  *
5  * Copyright (C) 2014-2020 Analog Devices, Inc.
6  * Author: Paul Cercueil
7  * Robin Getz
8  */
9 
10 #ifndef __IIO_NETWORK_H
11 #define __IIO_NETWORK_H
12 
13 #include <stdbool.h>
14 
15 struct iio_context_params;
16 struct iio_context_pdata;
17 struct addrinfo;
18 
20  int fd;
21 
22  bool cancelled;
23  void * events[2];
24  int cancel_fd[2];
25 
26  const struct iio_context_params *params;
27  struct iio_context_pdata *ctx_pdata;
28 };
29 
30 int setup_cancel(struct iiod_client_pdata *io_ctx);
31 void cleanup_cancel(struct iiod_client_pdata *io_ctx);
32 void do_cancel(struct iiod_client_pdata *io_ctx);
33 int wait_cancellable(struct iiod_client_pdata *io_ctx,
34  bool read, unsigned int timeout_ms);
35 
36 int create_socket(const struct addrinfo *addrinfo, unsigned int timeout);
37 int do_create_socket(const struct addrinfo *addrinfo);
38 int do_select(int fd, unsigned int timeout);
39 
40 int set_blocking_mode(int s, bool blocking);
41 
42 int network_get_error(void);
43 bool network_should_retry(int err);
44 bool network_is_interrupted(int err);
45 bool network_connect_in_progress(int err);
46 
47 #endif /* __IIO_NETWORK_H */
Definition: network.h:19
Definition: network.c:56
IIO context creation information.
Definition: iio.h:126