summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-27 05:00:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-27 05:00:11 +0200
commit9b5e5f7883ef59201d17343680d109c1f9d5ae9b (patch)
tree901d2ce75a972248f493c32ac898e38f3d436c30 /src
parente90be1577d672068878118fc61fab75e3028b56f (diff)
downloadfastd-9b5e5f7883ef59201d17343680d109c1f9d5ae9b.tar
fastd-9b5e5f7883ef59201d17343680d109c1f9d5ae9b.zip
poll: document the poll API
Diffstat (limited to 'src')
-rw-r--r--src/poll.c6
-rw-r--r--src/poll.h8
2 files changed, 10 insertions, 4 deletions
diff --git a/src/poll.c b/src/poll.c
index e57d349..911fc2e 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -24,7 +24,7 @@
*/
/**
- \file poll.h
+ \file poll.c
Portable polling API implementations
*/
@@ -41,6 +41,7 @@
#endif
+/** Returns the time to the next handshake or -1 */
static inline int handshake_timeout(void) {
if (!ctx.handshake_queue.next)
return -1;
@@ -61,7 +62,6 @@ static inline int handshake_timeout(void) {
#include <sys/epoll.h>
-/** Initializes the poll interface */
void fastd_poll_init(void) {
ctx.epoll_fd = epoll_create1(0);
if (ctx.epoll_fd < 0)
@@ -75,13 +75,11 @@ void fastd_poll_init(void) {
exit_errno("epoll_ctl");
}
-/** Frees the poll interface */
void fastd_poll_free(void) {
if (close(ctx.epoll_fd))
pr_warn_errno("closing EPOLL: close");
}
-
void fastd_poll_set_fd_tuntap(void) {
struct epoll_event event = {
.events = EPOLLIN,
diff --git a/src/poll.h b/src/poll.h
index 08baa8a..ae9c8cd 100644
--- a/src/poll.h
+++ b/src/poll.h
@@ -36,14 +36,22 @@
#include "types.h"
+/** Initializes the poll interface */
void fastd_poll_init(void);
+/** Frees the poll interface */
void fastd_poll_free(void);
+/** Updates the file descriptor of the TUN/TAP interface from \e ctx.tunfd */
void fastd_poll_set_fd_tuntap(void);
+/** Updates the file descriptor of the socket \e ctx.socks[i] */
void fastd_poll_set_fd_sock(size_t i);
+/** Updates the file descriptor of the dynamic socket for the peer with index \e i in \e ctx.peers */
void fastd_poll_set_fd_peer(size_t i);
+/** Must be called when a peer is added at the end of the peer list */
void fastd_poll_add_peer(void);
+/** Must be called then the peer with the index \e i is deleted */
void fastd_poll_delete_peer(size_t i);
+/** Waits for the next input event */
void fastd_poll_handle(void);