summaryrefslogtreecommitdiffstats
path: root/src/socket.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-25 04:59:35 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-25 04:59:35 +0200
commit5e72359e9a2f4008c408acbd3fe5d389e11a15b4 (patch)
tree5f1aede16a3b1e6985d4b7a309c6999416a638a3 /src/socket.c
parentf34e51a1c3b98df2b7c8c7d7eb415a33f42f2d75 (diff)
downloadfastd-5e72359e9a2f4008c408acbd3fe5d389e11a15b4.tar
fastd-5e72359e9a2f4008c408acbd3fe5d389e11a15b4.zip
Completely document fastd.h
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c4
1 files changed, 4 insertions, 0 deletions
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);