diff options
author | Nils Durner <durner@gnunet.org> | 2010-06-21 17:26:41 +0000 |
---|---|---|
committer | Nils Durner <durner@gnunet.org> | 2010-06-21 17:26:41 +0000 |
commit | 46f634ba9d8a3e9dd892eca2668dc8394fc3985d (patch) | |
tree | 1e5d41f42e625deac1343506c4d50f8aa6a60231 /src/include/plibc.h | |
parent | 5d702d02c5f2cf86400c469f4eb162a0f63d6cd8 (diff) | |
download | gnunet-46f634ba9d8a3e9dd892eca2668dc8394fc3985d.tar.gz gnunet-46f634ba9d8a3e9dd892eca2668dc8394fc3985d.zip |
up
Diffstat (limited to 'src/include/plibc.h')
-rw-r--r-- | src/include/plibc.h | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/include/plibc.h b/src/include/plibc.h index 06db48c04..60d5778b2 100644 --- a/src/include/plibc.h +++ b/src/include/plibc.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of PlibC. | 2 | This file is part of PlibC. |
3 | (C) 2005, 2006, 2007, 2008, 2009 Nils Durner (and other contributing authors) | 3 | (C) 2005, 2006, 2007, 2008, 2009, 2010 Nils Durner (and other contributing authors) |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
@@ -22,7 +22,7 @@ | |||
22 | * @brief PlibC header | 22 | * @brief PlibC header |
23 | * @attention This file is usually not installed under Unix, | 23 | * @attention This file is usually not installed under Unix, |
24 | * so ship it with your application | 24 | * so ship it with your application |
25 | * @version $Revision: 45 $ | 25 | * @version $Revision: 58 $ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef _PLIBC_H_ | 28 | #ifndef _PLIBC_H_ |
@@ -51,7 +51,8 @@ extern "C" { | |||
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <windows.h> | 53 | #include <windows.h> |
54 | #include <Ws2tcpip.h> | 54 | #include <ws2tcpip.h> |
55 | #include <sys/types.h> | ||
55 | #include <time.h> | 56 | #include <time.h> |
56 | #include <stdio.h> | 57 | #include <stdio.h> |
57 | #include <sys/types.h> | 58 | #include <sys/types.h> |
@@ -70,12 +71,6 @@ extern "C" { | |||
70 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ | 71 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ |
71 | (double)((x).LowPart)) | 72 | (double)((x).LowPart)) |
72 | 73 | ||
73 | #define socklen_t int | ||
74 | #define ssize_t int | ||
75 | #define off_t int | ||
76 | #define int64_t long long | ||
77 | #define int32_t long | ||
78 | |||
79 | struct stat64 | 74 | struct stat64 |
80 | { | 75 | { |
81 | _dev_t st_dev; | 76 | _dev_t st_dev; |
@@ -91,10 +86,21 @@ struct stat64 | |||
91 | __time64_t st_ctime; | 86 | __time64_t st_ctime; |
92 | }; | 87 | }; |
93 | 88 | ||
89 | typedef unsigned int sa_family_t; | ||
90 | |||
91 | struct sockaddr_un { | ||
92 | short sun_family; /*AF_UNIX*/ | ||
93 | char sun_path[108]; /*path name */ | ||
94 | }; | ||
95 | |||
94 | #ifndef pid_t | 96 | #ifndef pid_t |
95 | #define pid_t int | 97 | #define pid_t int |
96 | #endif | 98 | #endif |
97 | 99 | ||
100 | #ifndef error_t | ||
101 | #define error_t int | ||
102 | #endif | ||
103 | |||
98 | #ifndef WEXITSTATUS | 104 | #ifndef WEXITSTATUS |
99 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) | 105 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
100 | #endif | 106 | #endif |
@@ -325,9 +331,9 @@ char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | |||
325 | long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, | 331 | long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, |
326 | char *pszBuffer, long *pdLength); | 332 | char *pszBuffer, long *pdLength); |
327 | 333 | ||
328 | BOOL __win_IsHandleMarkedAsBlocking(SOCKET hHandle); | 334 | BOOL __win_IsHandleMarkedAsBlocking(int hHandle); |
329 | void __win_SetHandleBlockingMode(SOCKET s, BOOL bBlocking); | 335 | void __win_SetHandleBlockingMode(int s, BOOL bBlocking); |
330 | void __win_DiscardHandleBlockingMode(SOCKET s); | 336 | void __win_DiscardHandleBlockingMode(int s); |
331 | int _win_isSocketValid(int s); | 337 | int _win_isSocketValid(int s); |
332 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | 338 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); |
333 | unsigned plibc_get_handle_count(); | 339 | unsigned plibc_get_handle_count(); |
@@ -396,7 +402,7 @@ int _win_munmap(void *start, size_t length); | |||
396 | int _win_lstat(const char *path, struct stat *buf); | 402 | int _win_lstat(const char *path, struct stat *buf); |
397 | int _win_lstat64(const char *path, struct stat64 *buf); | 403 | int _win_lstat64(const char *path, struct stat64 *buf); |
398 | int _win_readlink(const char *path, char *buf, size_t bufsize); | 404 | int _win_readlink(const char *path, char *buf, size_t bufsize); |
399 | int _win_accept(SOCKET s, struct sockaddr *addr, int *addrlen); | 405 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); |
400 | int _win_printf(const char *format,...); | 406 | int _win_printf(const char *format,...); |
401 | int _win_fprintf(FILE *f,const char *format,...); | 407 | int _win_fprintf(FILE *f,const char *format,...); |
402 | int _win_vprintf(const char *format, va_list ap); | 408 | int _win_vprintf(const char *format, va_list ap); |
@@ -412,27 +418,27 @@ int _win_vscanf(const char *format, va_list arg_ptr); | |||
412 | int _win_scanf(const char *format, ...); | 418 | int _win_scanf(const char *format, ...); |
413 | int _win_fscanf(FILE *stream, const char *format, ...); | 419 | int _win_fscanf(FILE *stream, const char *format, ...); |
414 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | 420 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); |
415 | int _win_bind(SOCKET s, const struct sockaddr *name, int namelen); | 421 | int _win_bind(int s, const struct sockaddr *name, int namelen); |
416 | int _win_connect(SOCKET s,const struct sockaddr *name, int namelen); | 422 | int _win_connect(int s,const struct sockaddr *name, int namelen); |
417 | int _win_getpeername(SOCKET s, struct sockaddr *name, | 423 | int _win_getpeername(int s, struct sockaddr *name, |
418 | int *namelen); | 424 | int *namelen); |
419 | int _win_getsockname(SOCKET s, struct sockaddr *name, | 425 | int _win_getsockname(int s, struct sockaddr *name, |
420 | int *namelen); | 426 | int *namelen); |
421 | int _win_getsockopt(SOCKET s, int level, int optname, char *optval, | 427 | int _win_getsockopt(int s, int level, int optname, char *optval, |
422 | int *optlen); | 428 | int *optlen); |
423 | int _win_listen(SOCKET s, int backlog); | 429 | int _win_listen(int s, int backlog); |
424 | int _win_recv(SOCKET s, char *buf, int len, int flags); | 430 | int _win_recv(int s, char *buf, int len, int flags); |
425 | int _win_recvfrom(SOCKET s, void *buf, int len, int flags, | 431 | int _win_recvfrom(int s, void *buf, int len, int flags, |
426 | struct sockaddr *from, int *fromlen); | 432 | struct sockaddr *from, int *fromlen); |
427 | int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, | 433 | int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, |
428 | const struct timeval *tv); | 434 | const struct timeval *tv); |
429 | int _win_send(SOCKET s, const char *buf, int len, int flags); | 435 | int _win_send(int s, const char *buf, int len, int flags); |
430 | int _win_sendto(SOCKET s, const char *buf, int len, int flags, | 436 | int _win_sendto(int s, const char *buf, int len, int flags, |
431 | const struct sockaddr *to, int tolen); | 437 | const struct sockaddr *to, int tolen); |
432 | int _win_setsockopt(SOCKET s, int level, int optname, const void *optval, | 438 | int _win_setsockopt(int s, int level, int optname, const void *optval, |
433 | int optlen); | 439 | int optlen); |
434 | int _win_shutdown(SOCKET s, int how); | 440 | int _win_shutdown(int s, int how); |
435 | SOCKET _win_socket(int af, int type, int protocol); | 441 | int _win_socket(int af, int type, int protocol); |
436 | struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); | 442 | struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); |
437 | struct hostent *_win_gethostbyname(const char *name); | 443 | struct hostent *_win_gethostbyname(const char *name); |
438 | struct hostent *gethostbyname2(const char *name, int af); | 444 | struct hostent *gethostbyname2(const char *name, int af); |
@@ -447,6 +453,7 @@ char *strndup (const char *s, size_t n); | |||
447 | size_t strnlen (const char *str, size_t maxlen); | 453 | size_t strnlen (const char *str, size_t maxlen); |
448 | #endif | 454 | #endif |
449 | char *stpcpy(char *dest, const char *src); | 455 | char *stpcpy(char *dest, const char *src); |
456 | char *strcasestr(const char *haystack_start, const char *needle_start); | ||
450 | 457 | ||
451 | #define strcasecmp(a, b) stricmp(a, b) | 458 | #define strcasecmp(a, b) stricmp(a, b) |
452 | #define strncasecmp(a, b, c) strnicmp(a, b, c) | 459 | #define strncasecmp(a, b, c) strnicmp(a, b, c) |