From 5e72359e9a2f4008c408acbd3fe5d389e11a15b4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 25 May 2014 04:59:35 +0200 Subject: Completely document fastd.h --- src/socket.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/socket.c') diff --git a/src/socket.c b/src/socket.c index 340967c..49752fc 100644 --- a/src/socket.c +++ b/src/socket.c @@ -180,6 +180,7 @@ static bool set_bound_address(fastd_socket_t *sock) { return true; } +/** Tries to initialize sockets for all configured bind addresses */ bool fastd_socket_handle_binds(void) { size_t i; @@ -214,6 +215,7 @@ bool fastd_socket_handle_binds(void) { return true; } +/** Opens a single unbound socket for the given address family */ fastd_socket_t* fastd_socket_open(fastd_peer_t *peer, int af) { const fastd_bind_address_t any_address = { .addr.sa.sa_family = af }; @@ -237,6 +239,7 @@ fastd_socket_t* fastd_socket_open(fastd_peer_t *peer, int af) { return sock; } +/** Closes a socket */ void fastd_socket_close(fastd_socket_t *sock) { if (sock->fd >= 0) { if(close(sock->fd)) @@ -251,6 +254,7 @@ void fastd_socket_close(fastd_socket_t *sock) { } } +/** Handles an error that occured on a socket */ void fastd_socket_error(fastd_socket_t *sock) { if (sock->addr->bindtodev) pr_warn("socket bind %I on `%s' lost", &sock->addr->addr, sock->addr->bindtodev); -- cgit v1.2.3