aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_network_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-09-25 22:10:51 +0000
committerChristian Grothoff <christian@grothoff.org>2009-09-25 22:10:51 +0000
commitf1b9c5c115139b02cac1cae4f053792e1e5b1ccb (patch)
treecd9047d73ba498d05f67c7e06ae4bd5ed89511e7 /src/include/gnunet_network_lib.h
parentc2d3d24cd9b4f552d7ca8ad6283f9819c1cfefc7 (diff)
downloadgnunet-f1b9c5c115139b02cac1cae4f053792e1e5b1ccb.tar.gz
gnunet-f1b9c5c115139b02cac1cae4f053792e1e5b1ccb.zip
improving style and docs
Diffstat (limited to 'src/include/gnunet_network_lib.h')
-rw-r--r--src/include/gnunet_network_lib.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h
index 97fcf2618..492713c46 100644
--- a/src/include/gnunet_network_lib.h
+++ b/src/include/gnunet_network_lib.h
@@ -65,7 +65,9 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
65 socklen_t *address_len); 65 socklen_t *address_len);
66 66
67/** 67/**
68 * Make a non-inheritable to child processes 68 * Make a non-inheritable to child processes (sets the
69 * close-on-exec flag).
70 *
69 * @param socket 71 * @param socket
70 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 72 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
71 * @warning Not implemented on Windows 73 * @warning Not implemented on Windows
@@ -123,10 +125,12 @@ int GNUNET_NETWORK_socket_listen (const struct GNUNET_NETWORK_Handle *desc, int
123 125
124/** 126/**
125 * Read data from a connected socket 127 * Read data from a connected socket
128 *
126 * @param desc socket 129 * @param desc socket
127 * @param buffer buffer 130 * @param buffer buffer
128 * @param length length of buffer 131 * @param length length of buffer
129 * @param flags type of message reception 132 * @param flags type of message reception
133 * @return number of bytes read
130 */ 134 */
131ssize_t GNUNET_NETWORK_socket_recv (const struct GNUNET_NETWORK_Handle *desc, void *buffer, 135ssize_t GNUNET_NETWORK_socket_recv (const struct GNUNET_NETWORK_Handle *desc, void *buffer,
132 size_t length, int flags); 136 size_t length, int flags);
@@ -149,7 +153,8 @@ int GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
149 * @param doBlock blocking mode 153 * @param doBlock blocking mode
150 * @return GNUNET_OK on success, GNUNET_SYSERR on error 154 * @return GNUNET_OK on success, GNUNET_SYSERR on error
151 */ 155 */
152int GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd, int doBlock); 156int GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd,
157 int doBlock);
153 158
154/** 159/**
155 * Send data 160 * Send data
@@ -207,8 +212,9 @@ int GNUNET_NETWORK_socket_shutdown (struct GNUNET_NETWORK_Handle *desc, int how)
207struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_socket (int domain, int type, int protocol); 212struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_socket (int domain, int type, int protocol);
208 213
209/** 214/**
210 * Reset FD set 215 * Reset FD set (clears all file descriptors).
211 * @param fds fd set 216 *
217 * @param fds fd set to clear
212 */ 218 */
213void GNUNET_NETWORK_fdset_zero(struct GNUNET_NETWORK_FDSet *fds); 219void GNUNET_NETWORK_fdset_zero(struct GNUNET_NETWORK_FDSet *fds);
214 220
@@ -218,7 +224,8 @@ void GNUNET_NETWORK_fdset_zero(struct GNUNET_NETWORK_FDSet *fds);
218 * @param desc socket to add 224 * @param desc socket to add
219 */ 225 */
220void GNUNET_NETWORK_fdset_set(struct GNUNET_NETWORK_FDSet *fds, 226void GNUNET_NETWORK_fdset_set(struct GNUNET_NETWORK_FDSet *fds,
221 const struct GNUNET_NETWORK_Handle *desc); 227 const struct GNUNET_NETWORK_Handle *desc);
228
222 229
223/** 230/**
224 * Check whether a socket is part of the fd set 231 * Check whether a socket is part of the fd set
@@ -226,7 +233,7 @@ void GNUNET_NETWORK_fdset_set(struct GNUNET_NETWORK_FDSet *fds,
226 * @param desc socket 233 * @param desc socket
227 */ 234 */
228int GNUNET_NETWORK_fdset_isset(const struct GNUNET_NETWORK_FDSet *fds, 235int GNUNET_NETWORK_fdset_isset(const struct GNUNET_NETWORK_FDSet *fds,
229 const struct GNUNET_NETWORK_Handle *desc); 236 const struct GNUNET_NETWORK_Handle *desc);
230 237
231/** 238/**
232 * Add one fd set to another 239 * Add one fd set to another
@@ -234,7 +241,7 @@ int GNUNET_NETWORK_fdset_isset(const struct GNUNET_NETWORK_FDSet *fds,
234 * @param src the fd set to add from 241 * @param src the fd set to add from
235 */ 242 */
236void GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst, 243void GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst,
237 const struct GNUNET_NETWORK_FDSet *src); 244 const struct GNUNET_NETWORK_FDSet *src);
238 245
239/** 246/**
240 * Copy one fd set to another 247 * Copy one fd set to another
@@ -242,7 +249,7 @@ void GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst,
242 * @param from source 249 * @param from source
243 */ 250 */
244void GNUNET_NETWORK_fdset_copy(struct GNUNET_NETWORK_FDSet *to, 251void GNUNET_NETWORK_fdset_copy(struct GNUNET_NETWORK_FDSet *to,
245 const struct GNUNET_NETWORK_FDSet *from); 252 const struct GNUNET_NETWORK_FDSet *from);
246 253
247/** 254/**
248 * Copy a native fd set 255 * Copy a native fd set
@@ -250,8 +257,9 @@ void GNUNET_NETWORK_fdset_copy(struct GNUNET_NETWORK_FDSet *to,
250 * @param from native source set 257 * @param from native source set
251 * @param the biggest socket number in from + 1 258 * @param the biggest socket number in from + 1
252 */ 259 */
253void GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to, const fd_set *from, 260void GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to,
254 int nfds); 261 const fd_set *from,
262 int nfds);
255 263
256/** 264/**
257 * Add a file handle to the fd set 265 * Add a file handle to the fd set
@@ -259,7 +267,7 @@ void GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to, const fd
259 * @param h the file handle to add 267 * @param h the file handle to add
260 */ 268 */
261void GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds, 269void GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds,
262 const struct GNUNET_DISK_FileHandle *h); 270 const struct GNUNET_DISK_FileHandle *h);
263 271
264/** 272/**
265 * Check if a file handle is part of an fd set 273 * Check if a file handle is part of an fd set
@@ -268,7 +276,7 @@ void GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds,
268 * @return GNUNET_YES if the file handle is part of the set 276 * @return GNUNET_YES if the file handle is part of the set
269 */ 277 */
270int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds, 278int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds,
271 const struct GNUNET_DISK_FileHandle *h); 279 const struct GNUNET_DISK_FileHandle *h);
272 280
273/** 281/**
274 * Checks if two fd sets overlap 282 * Checks if two fd sets overlap
@@ -276,7 +284,8 @@ int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds,
276 * @param fds2 second fd set 284 * @param fds2 second fd set
277 * @return GNUNET_YES if they do overlap, GNUNET_NO otherwise 285 * @return GNUNET_YES if they do overlap, GNUNET_NO otherwise
278 */ 286 */
279int GNUNET_NETWORK_fdset_overlap (const struct GNUNET_NETWORK_FDSet *fds1, const struct GNUNET_NETWORK_FDSet *fds2); 287int GNUNET_NETWORK_fdset_overlap (const struct GNUNET_NETWORK_FDSet *fds1,
288 const struct GNUNET_NETWORK_FDSet *fds2);
280 289
281/** 290/**
282 * Creates an fd set 291 * Creates an fd set