aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-01-21 13:17:08 +0000
committerNathan S. Evans <evans@in.tum.de>2010-01-21 13:17:08 +0000
commitb14bc9fba69cf77acd84995881e744016eea702c (patch)
treed4c45d5fa6d44379baa0dee54944bf8b5ea7ce88 /src/include
parent63df761cf2e789a23ad25286c1029c9fbc180e9f (diff)
downloadgnunet-b14bc9fba69cf77acd84995881e744016eea702c.tar.gz
gnunet-b14bc9fba69cf77acd84995881e744016eea702c.zip
declaration fix, forgot to commit
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_network_lib.h102
1 files changed, 58 insertions, 44 deletions
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h
index 71c8d4346..1c90b6bfd 100644
--- a/src/include/gnunet_network_lib.h
+++ b/src/include/gnunet_network_lib.h
@@ -62,10 +62,13 @@ struct GNUNET_NETWORK_FDSet;
62 * @param address_len length of address 62 * @param address_len length of address
63 * @return client socket 63 * @return client socket
64 */ 64 */
65struct GNUNET_NETWORK_Handle * 65struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_accept (const struct
66GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc, 66 GNUNET_NETWORK_Handle
67 struct sockaddr *address, 67 *desc,
68 socklen_t *address_len); 68 struct sockaddr
69 *address,
70 socklen_t *
71 address_len);
69 72
70 73
71/** 74/**
@@ -77,7 +80,8 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
77 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 80 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
78 */ 81 */
79int GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, 82int GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
80 const struct sockaddr *address, socklen_t address_len); 83 const struct sockaddr *address,
84 socklen_t address_len);
81 85
82/** 86/**
83 * Close a socket. 87 * Close a socket.
@@ -96,8 +100,8 @@ int GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc);
96 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 100 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
97 */ 101 */
98int GNUNET_NETWORK_socket_connect (const struct GNUNET_NETWORK_Handle *desc, 102int GNUNET_NETWORK_socket_connect (const struct GNUNET_NETWORK_Handle *desc,
99 const struct sockaddr *address, 103 const struct sockaddr *address,
100 socklen_t address_len); 104 socklen_t address_len);
101 105
102 106
103/** 107/**
@@ -110,8 +114,9 @@ int GNUNET_NETWORK_socket_connect (const struct GNUNET_NETWORK_Handle *desc,
110 * @param optlen length of optval 114 * @param optlen length of optval
111 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 115 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
112 */ 116 */
113int GNUNET_NETWORK_socket_getsockopt(const struct GNUNET_NETWORK_Handle *desc, int level, int optname, 117int GNUNET_NETWORK_socket_getsockopt (const struct GNUNET_NETWORK_Handle
114 void *optval, socklen_t *optlen); 118 *desc, int level, int optname,
119 void *optval, socklen_t * optlen);
115 120
116 121
117/** 122/**
@@ -121,14 +126,16 @@ int GNUNET_NETWORK_socket_getsockopt(const struct GNUNET_NETWORK_Handle *desc, i
121 * @param backlog length of the listen queue 126 * @param backlog length of the listen queue
122 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 127 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
123 */ 128 */
124int GNUNET_NETWORK_socket_listen (const struct GNUNET_NETWORK_Handle *desc, int backlog); 129int GNUNET_NETWORK_socket_listen (const struct GNUNET_NETWORK_Handle *desc,
130 int backlog);
125 131
126/** 132/**
127 * How much data is available to be read on this descriptor? 133 * How much data is available to be read on this descriptor?
128 * @param desc socket 134 * @param desc socket
129 */ 135 */
130unsigned int 136ssize_t
131GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle * desc); 137GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle
138 *desc);
132 139
133/** 140/**
134 * Read data from a connected socket (always non-blocking). 141 * Read data from a connected socket (always non-blocking).
@@ -140,9 +147,10 @@ GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle * desc
140 * @param addrlen length of the addr 147 * @param addrlen length of the addr
141 */ 148 */
142ssize_t 149ssize_t
143GNUNET_NETWORK_socket_recvfrom (const struct GNUNET_NETWORK_Handle * desc, 150GNUNET_NETWORK_socket_recvfrom (const struct GNUNET_NETWORK_Handle *desc,
144 void *buffer, size_t length, 151 void *buffer, size_t length,
145 struct sockaddr *src_addr, socklen_t *addrlen); 152 struct sockaddr *src_addr,
153 socklen_t * addrlen);
146 154
147/** 155/**
148 * Read data from a connected socket (always non-blocking). 156 * Read data from a connected socket (always non-blocking).
@@ -152,8 +160,8 @@ GNUNET_NETWORK_socket_recvfrom (const struct GNUNET_NETWORK_Handle * desc,
152 * @param length length of buffer 160 * @param length length of buffer
153 * @return number of bytes read 161 * @return number of bytes read
154 */ 162 */
155ssize_t GNUNET_NETWORK_socket_recv (const struct GNUNET_NETWORK_Handle *desc, void *buffer, 163ssize_t GNUNET_NETWORK_socket_recv (const struct GNUNET_NETWORK_Handle *desc,
156 size_t length); 164 void *buffer, size_t length);
157 165
158/** 166/**
159 * Check if sockets meet certain conditions 167 * Check if sockets meet certain conditions
@@ -164,8 +172,9 @@ ssize_t GNUNET_NETWORK_socket_recv (const struct GNUNET_NETWORK_Handle *desc, vo
164 * @return number of selected sockets, GNUNET_SYSERR on error 172 * @return number of selected sockets, GNUNET_SYSERR on error
165 */ 173 */
166int GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, 174int GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
167 struct GNUNET_NETWORK_FDSet *wfds, struct GNUNET_NETWORK_FDSet *efds, 175 struct GNUNET_NETWORK_FDSet *wfds,
168 struct GNUNET_TIME_Relative timeout); 176 struct GNUNET_NETWORK_FDSet *efds,
177 struct GNUNET_TIME_Relative timeout);
169 178
170 179
171 180
@@ -178,7 +187,7 @@ int GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
178 * @return number of bytes sent, GNUNET_SYSERR on error 187 * @return number of bytes sent, GNUNET_SYSERR on error
179 */ 188 */
180ssize_t GNUNET_NETWORK_socket_send (const struct GNUNET_NETWORK_Handle *desc, 189ssize_t GNUNET_NETWORK_socket_send (const struct GNUNET_NETWORK_Handle *desc,
181 const void *buffer, size_t length); 190 const void *buffer, size_t length);
182 191
183/** 192/**
184 * Send data to a particular destination (always non-blocking). 193 * Send data to a particular destination (always non-blocking).
@@ -191,10 +200,11 @@ ssize_t GNUNET_NETWORK_socket_send (const struct GNUNET_NETWORK_Handle *desc,
191 * @param dest_len length of address 200 * @param dest_len length of address
192 * @return number of bytes sent, GNUNET_SYSERR on error 201 * @return number of bytes sent, GNUNET_SYSERR on error
193 */ 202 */
194ssize_t GNUNET_NETWORK_socket_sendto (const struct GNUNET_NETWORK_Handle *desc, 203ssize_t GNUNET_NETWORK_socket_sendto (const struct GNUNET_NETWORK_Handle
195 const void *message, size_t length, 204 *desc, const void *message,
196 const struct sockaddr *dest_addr, 205 size_t length,
197 socklen_t dest_len); 206 const struct sockaddr *dest_addr,
207 socklen_t dest_len);
198 208
199/** 209/**
200 * Set socket option 210 * Set socket option
@@ -205,8 +215,10 @@ ssize_t GNUNET_NETWORK_socket_sendto (const struct GNUNET_NETWORK_Handle *desc,
205 * @param option_len size of option_value 215 * @param option_len size of option_value
206 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 216 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
207 */ 217 */
208int GNUNET_NETWORK_socket_setsockopt(struct GNUNET_NETWORK_Handle *fd, int level, int option_name, 218int GNUNET_NETWORK_socket_setsockopt (struct GNUNET_NETWORK_Handle *fd,
209 const void *option_value, socklen_t option_len); 219 int level, int option_name,
220 const void *option_value,
221 socklen_t option_len);
210 222
211/** 223/**
212 * Shut down socket operations 224 * Shut down socket operations
@@ -214,7 +226,8 @@ int GNUNET_NETWORK_socket_setsockopt(struct GNUNET_NETWORK_Handle *fd, int level
214 * @param how type of shutdown 226 * @param how type of shutdown
215 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 227 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
216 */ 228 */
217int GNUNET_NETWORK_socket_shutdown (struct GNUNET_NETWORK_Handle *desc, int how); 229int GNUNET_NETWORK_socket_shutdown (struct GNUNET_NETWORK_Handle *desc,
230 int how);
218 231
219 232
220/** 233/**
@@ -227,22 +240,24 @@ int GNUNET_NETWORK_socket_shutdown (struct GNUNET_NETWORK_Handle *desc, int how)
227 * @param protocol network protocol 240 * @param protocol network protocol
228 * @return new socket, NULL on error 241 * @return new socket, NULL on error
229 */ 242 */
230struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_create (int domain, int type, int protocol); 243struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_create (int domain,
244 int type,
245 int protocol);
231 246
232/** 247/**
233 * Reset FD set (clears all file descriptors). 248 * Reset FD set (clears all file descriptors).
234 * 249 *
235 * @param fds fd set to clear 250 * @param fds fd set to clear
236 */ 251 */
237void GNUNET_NETWORK_fdset_zero(struct GNUNET_NETWORK_FDSet *fds); 252void GNUNET_NETWORK_fdset_zero (struct GNUNET_NETWORK_FDSet *fds);
238 253
239/** 254/**
240 * Add a socket to the FD set 255 * Add a socket to the FD set
241 * @param fds fd set 256 * @param fds fd set
242 * @param desc socket to add 257 * @param desc socket to add
243 */ 258 */
244void GNUNET_NETWORK_fdset_set(struct GNUNET_NETWORK_FDSet *fds, 259void GNUNET_NETWORK_fdset_set (struct GNUNET_NETWORK_FDSet *fds,
245 const struct GNUNET_NETWORK_Handle *desc); 260 const struct GNUNET_NETWORK_Handle *desc);
246 261
247 262
248/** 263/**
@@ -250,8 +265,8 @@ void GNUNET_NETWORK_fdset_set(struct GNUNET_NETWORK_FDSet *fds,
250 * @param fds fd set 265 * @param fds fd set
251 * @param desc socket 266 * @param desc socket
252 */ 267 */
253int GNUNET_NETWORK_fdset_isset(const struct GNUNET_NETWORK_FDSet *fds, 268int GNUNET_NETWORK_fdset_isset (const struct GNUNET_NETWORK_FDSet *fds,
254 const struct GNUNET_NETWORK_Handle *desc); 269 const struct GNUNET_NETWORK_Handle *desc);
255 270
256/** 271/**
257 * Add one fd set to another 272 * Add one fd set to another
@@ -259,30 +274,28 @@ int GNUNET_NETWORK_fdset_isset(const struct GNUNET_NETWORK_FDSet *fds,
259 * @param src the fd set to add from 274 * @param src the fd set to add from
260 */ 275 */
261void GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst, 276void GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst,
262 const struct GNUNET_NETWORK_FDSet *src); 277 const struct GNUNET_NETWORK_FDSet *src);
263 278
264/** 279/**
265 * Copy one fd set to another 280 * Copy one fd set to another
266 * @param to destination 281 * @param to destination
267 * @param from source 282 * @param from source
268 */ 283 */
269void GNUNET_NETWORK_fdset_copy(struct GNUNET_NETWORK_FDSet *to, 284void GNUNET_NETWORK_fdset_copy (struct GNUNET_NETWORK_FDSet *to,
270 const struct GNUNET_NETWORK_FDSet *from); 285 const struct GNUNET_NETWORK_FDSet *from);
271 286
272/* 287/*
273 * Return file descriptor for this network handle 288 * Return file descriptor for this network handle
274 */ 289 */
275int 290int GNUNET_NETWORK_get_fd (struct GNUNET_NETWORK_Handle *desc);
276GNUNET_NETWORK_get_fd (struct GNUNET_NETWORK_Handle *desc);
277/** 291/**
278 * Copy a native fd set 292 * Copy a native fd set
279 * @param to destination 293 * @param to destination
280 * @param from native source set 294 * @param from native source set
281 * @param nfds the biggest socket number in from + 1 295 * @param nfds the biggest socket number in from + 1
282 */ 296 */
283void GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to, 297void GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to,
284 const fd_set *from, 298 const fd_set * from, int nfds);
285 int nfds);
286 299
287/** 300/**
288 * Add a file handle to the fd set 301 * Add a file handle to the fd set
@@ -290,7 +303,7 @@ void GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to,
290 * @param h the file handle to add 303 * @param h the file handle to add
291 */ 304 */
292void GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds, 305void GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds,
293 const struct GNUNET_DISK_FileHandle *h); 306 const struct GNUNET_DISK_FileHandle *h);
294 307
295/** 308/**
296 * Check if a file handle is part of an fd set 309 * Check if a file handle is part of an fd set
@@ -299,7 +312,8 @@ void GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds,
299 * @return GNUNET_YES if the file handle is part of the set 312 * @return GNUNET_YES if the file handle is part of the set
300 */ 313 */
301int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds, 314int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds,
302 const struct GNUNET_DISK_FileHandle *h); 315 const struct GNUNET_DISK_FileHandle
316 *h);
303 317
304/** 318/**
305 * Checks if two fd sets overlap 319 * Checks if two fd sets overlap
@@ -307,8 +321,8 @@ int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds,
307 * @param fds2 second fd set 321 * @param fds2 second fd set
308 * @return GNUNET_YES if they do overlap, GNUNET_NO otherwise 322 * @return GNUNET_YES if they do overlap, GNUNET_NO otherwise
309 */ 323 */
310int GNUNET_NETWORK_fdset_overlap (const struct GNUNET_NETWORK_FDSet *fds1, 324int GNUNET_NETWORK_fdset_overlap (const struct GNUNET_NETWORK_FDSet *fds1,
311 const struct GNUNET_NETWORK_FDSet *fds2); 325 const struct GNUNET_NETWORK_FDSet *fds2);
312 326
313/** 327/**
314 * Creates an fd set 328 * Creates an fd set