aboutsummaryrefslogtreecommitdiff
path: root/src/util/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/network.c')
-rw-r--r--src/util/network.c61
1 files changed, 4 insertions, 57 deletions
diff --git a/src/util/network.c b/src/util/network.c
index 014701e02..688c37665 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -75,13 +75,7 @@ struct GNUNET_NETWORK_Handle
75}; 75};
76 76
77 77
78/** 78enum GNUNET_GenericReturnValue
79 * Test if the given protocol family is supported by this system.
80 *
81 * @param pf protocol family to test (PF_INET, PF_INET6, PF_UNIX)
82 * @return #GNUNET_OK if the PF is supported
83 */
84int
85GNUNET_NETWORK_test_pf (int pf) 79GNUNET_NETWORK_test_pf (int pf)
86{ 80{
87 static int cache_v4 = -1; 81 static int cache_v4 = -1;
@@ -145,15 +139,6 @@ GNUNET_NETWORK_test_pf (int pf)
145} 139}
146 140
147 141
148/**
149 * Given a unixpath that is too long (larger than UNIX_PATH_MAX),
150 * shorten it to an acceptable length while keeping it unique
151 * and making sure it remains a valid filename (if possible).
152 *
153 * @param unixpath long path, will be freed (or same pointer returned
154 * with moved 0-termination).
155 * @return shortened unixpath, NULL on error
156 */
157char * 142char *
158GNUNET_NETWORK_shorten_unixpath (char *unixpath) 143GNUNET_NETWORK_shorten_unixpath (char *unixpath)
159{ 144{
@@ -189,15 +174,6 @@ GNUNET_NETWORK_shorten_unixpath (char *unixpath)
189} 174}
190 175
191 176
192/**
193 * If services crash, they can leave a unix domain socket file on the
194 * disk. This needs to be manually removed, because otherwise both
195 * bind() and connect() for the respective address will fail. In this
196 * function, we test if such a left-over file exists, and if so,
197 * remove it (unless there is a listening service at the address).
198 *
199 * @param un unix domain socket address to check
200 */
201void 177void
202GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un) 178GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un)
203{ 179{
@@ -244,14 +220,7 @@ GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un)
244#endif 220#endif
245 221
246 222
247/** 223enum GNUNET_GenericReturnValue
248 * Set if a socket should use blocking or non-blocking IO.
249 *
250 * @param fd socket
251 * @param doBlock blocking mode
252 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
253 */
254int
255GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd, 224GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd,
256 int doBlock) 225 int doBlock)
257{ 226{
@@ -418,14 +387,6 @@ initialize_network_handle (struct GNUNET_NETWORK_Handle *h,
418} 387}
419 388
420 389
421/**
422 * accept a new connection on a socket
423 *
424 * @param desc bound socket
425 * @param address address of the connecting peer, may be NULL
426 * @param address_len length of @a address
427 * @return client socket
428 */
429struct GNUNET_NETWORK_Handle * 390struct GNUNET_NETWORK_Handle *
430GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, 391GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
431 struct sockaddr *address, 392 struct sockaddr *address,
@@ -473,15 +434,7 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
473} 434}
474 435
475 436
476/** 437enum GNUNET_GenericReturnValue
477 * Bind a socket to a particular address.
478 *
479 * @param desc socket to bind
480 * @param address address to be bound
481 * @param address_len length of @a address
482 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
483 */
484int
485GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, 438GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
486 const struct sockaddr *address, 439 const struct sockaddr *address,
487 socklen_t address_len) 440 socklen_t address_len)
@@ -550,13 +503,7 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
550} 503}
551 504
552 505
553/** 506enum GNUNET_GenericReturnValue
554 * Close a socket
555 *
556 * @param desc socket
557 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
558 */
559int
560GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc) 507GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc)
561{ 508{
562 int ret; 509 int ret;