add native setting capability
authorChristian Grothoff <christian@grothoff.org>
Thu, 3 Jun 2010 20:47:53 +0000 (20:47 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 3 Jun 2010 20:47:53 +0000 (20:47 +0000)
src/include/gnunet_network_lib.h
src/util/network.c

index 37c8cf319d1cc6df9349a1ca18fa0723a51ba429..1666abc9037da9264ac61aa1cdb2331461aa0892 100644 (file)
@@ -285,10 +285,14 @@ void GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst,
 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 (struct GNUNET_NETWORK_Handle *desc);
+
 /**
  * Copy a native fd set
  * @param to destination
@@ -298,6 +302,16 @@ int GNUNET_NETWORK_get_fd (struct GNUNET_NETWORK_Handle *desc);
 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);
+
 /**
  * Add a file handle to the fd set
  * @param fds fd set
index c4fb73049e19718a7b9bdc8974da58dbd2597b48..0b41680343486cc1553be18ea2a2f6807437a568 100644 (file)
@@ -723,6 +723,21 @@ GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to,
   to->nsds = 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)
+{
+  FD_SET (nfd, &to->sds);
+  to->nsds = GNUNET_MAX (nfd + 1, to->nsds);
+}
+
+
 /**
  * Add a file handle to the fd set
  * @param fds fd set