diff options
Diffstat (limited to 'src/include/gnunet_strings_lib.h')
-rw-r--r-- | src/include/gnunet_strings_lib.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index 2beaa9534..1772b03bf 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -284,39 +284,43 @@ int | |||
284 | GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, | 284 | GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, |
285 | const char **path_part); | 285 | const char **path_part); |
286 | 286 | ||
287 | |||
287 | /** | 288 | /** |
288 | * Check whether @filename is absolute or not, and if it's an URI | 289 | * Check whether filename is absolute or not, and if it's an URI |
289 | * | 290 | * |
290 | * @param filename filename to check | 291 | * @param filename filename to check |
291 | * @param can_be_uri GNUNET_YES to check for being URI, GNUNET_NO - to | 292 | * @param can_be_uri GNUNET_YES to check for being URI, GNUNET_NO - to |
292 | * assume it's not URI | 293 | * assume it's not URI |
293 | * @param r_is_uri a pointer to an int that is set to GNUNET_YES if @filename | 294 | * @param r_is_uri a pointer to an int that is set to GNUNET_YES if 'filename' |
294 | * is URI and to GNUNET_NO otherwise. Can be NULL. If @can_be_uri is | 295 | * is URI and to GNUNET_NO otherwise. Can be NULL. If 'can_be_uri' is |
295 | * not GNUNET_YES, *r_is_uri is set to GNUNET_NO. | 296 | * not GNUNET_YES, *r_is_uri is set to GNUNET_NO. |
296 | * @param r_uri a pointer to a char * that is set to a pointer to URI scheme. | 297 | * @param r_uri a pointer to a char * that is set to a pointer to URI scheme. |
297 | * The string is allocated by the function, and should be freed with | 298 | * The string is allocated by the function, and should be freed with |
298 | * GNUNET_free (). Can be NULL. | 299 | * GNUNET_free (). Can be NULL. |
299 | * @return GNUNET_YES if @filaneme is absolute, GNUNET_NO otherwise. | 300 | * @return GNUNET_YES if 'filaname' is absolute, GNUNET_NO otherwise. |
300 | */ | 301 | */ |
301 | int | 302 | int |
302 | GNUNET_STRINGS_path_is_absolute (const char *filename, int can_be_uri, | 303 | GNUNET_STRINGS_path_is_absolute (const char *filename, |
303 | int *r_is_uri, char **r_uri_scheme); | 304 | int can_be_uri, |
305 | int *r_is_uri, | ||
306 | char **r_uri_scheme); | ||
307 | |||
304 | 308 | ||
305 | /** | 309 | /** |
306 | * Perform @checks on @filename | 310 | * Perform checks on 'filename; |
307 | * | 311 | * |
308 | * @param filename file to check | 312 | * @param filename file to check |
309 | * @param checks checks to perform | 313 | * @param checks checks to perform |
310 | * @return GNUNET_YES if all @checks pass, GNUNET_NO if at least one of them | 314 | * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them |
311 | * fails, GNUNET_SYSERR when a check can't be performed | 315 | * fails, GNUNET_SYSERR when a check can't be performed |
312 | */ | 316 | */ |
313 | int | 317 | int |
314 | GNUNET_STRINGS_check_filename (const char *filename, | 318 | GNUNET_STRINGS_check_filename (const char *filename, |
315 | enum GNUNET_STRINGS_FilenameCheck checks); | 319 | enum GNUNET_STRINGS_FilenameCheck checks); |
316 | 320 | ||
317 | 321 | ||
318 | /** | 322 | /** |
319 | * Tries to convert @zt_addr string to an IPv6 address. | 323 | * Tries to convert 'zt_addr' string to an IPv6 address. |
320 | * | 324 | * |
321 | * @param zt_addr 0-terminated string. May be mangled by the function. | 325 | * @param zt_addr 0-terminated string. May be mangled by the function. |
322 | * @param addrlen length of zt_addr (not counting 0-terminator). | 326 | * @param addrlen length of zt_addr (not counting 0-terminator). |
@@ -326,11 +330,13 @@ GNUNET_STRINGS_check_filename (const char *filename, | |||
326 | * case the contents of r_buf are undefined. | 330 | * case the contents of r_buf are undefined. |
327 | */ | 331 | */ |
328 | int | 332 | int |
329 | GNUNET_STRINGS_to_address_ipv6 (char *zt_addr, uint16_t addrlen, | 333 | GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, |
330 | struct sockaddr_in6 *r_buf); | 334 | uint16_t addrlen, |
335 | struct sockaddr_in6 *r_buf); | ||
336 | |||
331 | 337 | ||
332 | /** | 338 | /** |
333 | * Tries to convert @zt_addr string to an IPv4 address. | 339 | * Tries to convert 'zt_addr' string to an IPv4 address. |
334 | * | 340 | * |
335 | * @param zt_addr 0-terminated string. May be mangled by the function. | 341 | * @param zt_addr 0-terminated string. May be mangled by the function. |
336 | * @param addrlen length of zt_addr (not counting 0-terminator). | 342 | * @param addrlen length of zt_addr (not counting 0-terminator). |
@@ -339,14 +345,16 @@ GNUNET_STRINGS_to_address_ipv6 (char *zt_addr, uint16_t addrlen, | |||
339 | * the contents of r_buf are undefined. | 345 | * the contents of r_buf are undefined. |
340 | */ | 346 | */ |
341 | int | 347 | int |
342 | GNUNET_STRINGS_to_address_ipv4 (char *zt_addr, uint16_t addrlen, | 348 | GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, |
343 | struct sockaddr_in *r_buf); | 349 | uint16_t addrlen, |
350 | struct sockaddr_in *r_buf); | ||
351 | |||
344 | 352 | ||
345 | /** | 353 | /** |
346 | * Tries to convert @addr string to an IP (v4 or v6) address. | 354 | * Tries to convert 'addr' string to an IP (v4 or v6) address. |
347 | * IPv6 address must have its address part enclosed in '()' parens | 355 | * IPv6 address must have its address part enclosed in '()' parens |
348 | * instead of '[]'. | 356 | * instead of '[]'. |
349 | * Will automatically decide whether to treat @addr as v4 or v6 address. | 357 | * Will automatically decide whether to treat 'addr' as v4 or v6 address. |
350 | * | 358 | * |
351 | * @param addr a string, may not be 0-terminated. | 359 | * @param addr a string, may not be 0-terminated. |
352 | * @param addrlen number of bytes in addr (if addr is 0-terminated, | 360 | * @param addrlen number of bytes in addr (if addr is 0-terminated, |
@@ -356,8 +364,10 @@ GNUNET_STRINGS_to_address_ipv4 (char *zt_addr, uint16_t addrlen, | |||
356 | * case the contents of r_buf are undefined. | 364 | * case the contents of r_buf are undefined. |
357 | */ | 365 | */ |
358 | int | 366 | int |
359 | GNUNET_STRINGS_to_address_ip (const char *addr, uint16_t addrlen, | 367 | GNUNET_STRINGS_to_address_ip (const char *addr, |
360 | struct sockaddr_storage *r_buf); | 368 | uint16_t addrlen, |
369 | struct sockaddr_storage *r_buf); | ||
370 | |||
361 | 371 | ||
362 | /* ifndef GNUNET_UTIL_STRING_H */ | 372 | /* ifndef GNUNET_UTIL_STRING_H */ |
363 | #endif | 373 | #endif |