+/**
+ * Shut down socket operations
+ *
+ * @param desc socket
+ * @param how type of shutdown
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
+ */
+int
+GNUNET_NETWORK_socket_shutdown (struct GNUNET_NETWORK_Handle *desc,
+ int how);
+
+
+/**
+ * Disable the "CORK" feature for communication with the given socket,
+ * forcing the OS to immediately flush the buffer on transmission
+ * instead of potentially buffering multiple messages. Essentially
+ * reduces the OS send buffers to zero.
+ *
+ * @param desc socket
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
+ */
+int
+GNUNET_NETWORK_socket_disable_corking (struct GNUNET_NETWORK_Handle *desc);
+
+
+/**
+ * Create a new socket. Configure it for non-blocking IO and
+ * mark it as non-inheritable to child processes (set the
+ * close-on-exec flag).
+ *
+ * @param domain domain of the socket
+ * @param type socket type
+ * @param protocol network protocol
+ * @return new socket, NULL on error
+ */
+struct GNUNET_NETWORK_Handle *
+GNUNET_NETWORK_socket_create (int domain,
+ int type,
+ int protocol);
+
+
+/**
+ * Reset FD set (clears all file descriptors).
+ *
+ * @param fds fd set to clear
+ */
+void
+GNUNET_NETWORK_fdset_zero (struct GNUNET_NETWORK_FDSet *fds);
+
+
+/**
+ * Add a socket to the FD set
+ *
+ * @param fds fd set
+ * @param desc socket to add
+ */
+void
+GNUNET_NETWORK_fdset_set (struct GNUNET_NETWORK_FDSet *fds,
+ const struct GNUNET_NETWORK_Handle *desc);
+
+
+#if WINDOWS
+/**
+ * Add a W32 file handle to the fd set
+ *
+ * @param fds fd set
+ * @param h the file handle to add
+ */
+void
+GNUNET_NETWORK_fdset_handle_set_native_w32_handle (struct GNUNET_NETWORK_FDSet *fds,
+ HANDLE h);
+#endif
+
+
+/**
+ * Check whether a socket is part of the fd set
+ *
+ * @param fds fd set
+ * @param desc socket
+ * @return #GNUNET_YES if the socket is in the set
+ */
+int
+GNUNET_NETWORK_fdset_isset (const struct GNUNET_NETWORK_FDSet *fds,
+ const struct GNUNET_NETWORK_Handle *desc);
+
+
+/**
+ * Add one fd set to another (computes the union).
+ *
+ * @param dst the fd set to add to
+ * @param src the fd set to add from
+ */
+void
+GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst,
+ const struct GNUNET_NETWORK_FDSet *src);
+
+
+/**
+ * Copy one fd set to another
+ *
+ * @param to destination
+ * @param from source
+ */
+void
+GNUNET_NETWORK_fdset_copy (struct GNUNET_NETWORK_FDSet *to,
+ const struct GNUNET_NETWORK_FDSet *from);
+
+
+/**
+ * Return file descriptor for this network handle
+ *
+ * @param desc wrapper to process
+ * @return POSIX file descriptor
+ */
+int
+GNUNET_NETWORK_get_fd (const struct GNUNET_NETWORK_Handle *desc);
+
+
+/**
+ * Return the sockaddr for this network handle
+ *
+ * @param desc wrapper to process
+ * @return POSIX file descriptor
+ */
+struct sockaddr*
+GNUNET_NETWORK_get_addr (const struct GNUNET_NETWORK_Handle *desc);
+
+
+/**
+ * Return sockaddr length for this network handle
+ *
+ * @param desc wrapper to process
+ * @return socklen_t for sockaddr
+ */
+socklen_t
+GNUNET_NETWORK_get_addrlen (const struct GNUNET_NETWORK_Handle *desc);
+
+
+/**
+ * Copy a native fd set into the GNUnet representation.
+ *
+ * @param to destination
+ * @param from native source set
+ * @param nfds the biggest socket number in from + 1
+ */
+void
+GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to,
+ const fd_set *from,
+ int nfds);
+
+
+/**
+ * Set a native fd in a set
+ *
+ * @param to destination
+ * @param nfd native FD to set
+ */
+void
+GNUNET_NETWORK_fdset_set_native (struct GNUNET_NETWORK_FDSet *to,
+ int nfd);
+
+
+/**
+ * Test native fd in a set
+ *
+ * @param to set to test, NULL for empty set
+ * @param nfd native FD to test, -1 for none
+ * @return #GNUNET_YES if to contains nfd
+ */
+int
+GNUNET_NETWORK_fdset_test_native (const struct GNUNET_NETWORK_FDSet *to,
+ int nfd);
+
+
+/**
+ * Add a file handle to the fd set
+ *
+ * @param fds fd set
+ * @param h the file handle to add
+ */
+void
+GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds,
+ const struct GNUNET_DISK_FileHandle *h);
+
+
+/**
+ * Add a file handle to the fd set
+ * On W32: ensure that the handle is first in the array.
+ *
+ * @param fds fd set
+ * @param h the file handle to add
+ */
+void
+GNUNET_NETWORK_fdset_handle_set_first (struct GNUNET_NETWORK_FDSet *fds,
+ const struct GNUNET_DISK_FileHandle *h);
+
+
+/**
+ * Check if a file handle is part of an fd set
+ *
+ * @param fds fd set
+ * @param h file handle
+ * @return #GNUNET_YES if the file handle is part of the set
+ */
+int
+GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds,
+ const struct GNUNET_DISK_FileHandle *h);
+
+
+/**
+ * Checks if two fd sets overlap
+ *
+ * @param fds1 first fd set
+ * @param fds2 second fd set
+ * @return #GNUNET_YES if they do overlap, #GNUNET_NO otherwise
+ */
+int
+GNUNET_NETWORK_fdset_overlap (const struct GNUNET_NETWORK_FDSet *fds1,
+ const struct GNUNET_NETWORK_FDSet *fds2);
+
+
+/**
+ * Creates an fd set
+ *
+ * @return a new fd set
+ */
+struct GNUNET_NETWORK_FDSet *
+GNUNET_NETWORK_fdset_create (void);
+
+
+/**
+ * Releases the associated memory of an fd set
+ *
+ * @param fds fd set
+ */
+void
+GNUNET_NETWORK_fdset_destroy (struct GNUNET_NETWORK_FDSet *fds);
+
+
+/**
+ * Test if the given @a port is available.
+ *
+ * @param ipproto transport protocol to test (i.e. IPPROTO_TCP)
+ * @param port port number to test
+ * @return #GNUNET_OK if the port is available, #GNUNET_NO if not
+ */
+int
+GNUNET_NETWORK_test_port_free (int ipproto,
+ uint16_t port);