aboutsummaryrefslogtreecommitdiff
path: root/src/include/plibc.h
diff options
context:
space:
mode:
authorNils Durner <durner@gnunet.org>2010-06-21 17:26:41 +0000
committerNils Durner <durner@gnunet.org>2010-06-21 17:26:41 +0000
commit46f634ba9d8a3e9dd892eca2668dc8394fc3985d (patch)
tree1e5d41f42e625deac1343506c4d50f8aa6a60231 /src/include/plibc.h
parent5d702d02c5f2cf86400c469f4eb162a0f63d6cd8 (diff)
downloadgnunet-46f634ba9d8a3e9dd892eca2668dc8394fc3985d.tar.gz
gnunet-46f634ba9d8a3e9dd892eca2668dc8394fc3985d.zip
up
Diffstat (limited to 'src/include/plibc.h')
-rw-r--r--src/include/plibc.h59
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
79struct stat64 74struct 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
89typedef unsigned int sa_family_t;
90
91struct 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);
325long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, 331long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey,
326 char *pszBuffer, long *pdLength); 332 char *pszBuffer, long *pdLength);
327 333
328BOOL __win_IsHandleMarkedAsBlocking(SOCKET hHandle); 334BOOL __win_IsHandleMarkedAsBlocking(int hHandle);
329void __win_SetHandleBlockingMode(SOCKET s, BOOL bBlocking); 335void __win_SetHandleBlockingMode(int s, BOOL bBlocking);
330void __win_DiscardHandleBlockingMode(SOCKET s); 336void __win_DiscardHandleBlockingMode(int s);
331int _win_isSocketValid(int s); 337int _win_isSocketValid(int s);
332int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); 338int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
333unsigned plibc_get_handle_count(); 339unsigned plibc_get_handle_count();
@@ -396,7 +402,7 @@ int _win_munmap(void *start, size_t length);
396int _win_lstat(const char *path, struct stat *buf); 402int _win_lstat(const char *path, struct stat *buf);
397int _win_lstat64(const char *path, struct stat64 *buf); 403int _win_lstat64(const char *path, struct stat64 *buf);
398int _win_readlink(const char *path, char *buf, size_t bufsize); 404int _win_readlink(const char *path, char *buf, size_t bufsize);
399int _win_accept(SOCKET s, struct sockaddr *addr, int *addrlen); 405int _win_accept(int s, struct sockaddr *addr, int *addrlen);
400int _win_printf(const char *format,...); 406int _win_printf(const char *format,...);
401int _win_fprintf(FILE *f,const char *format,...); 407int _win_fprintf(FILE *f,const char *format,...);
402int _win_vprintf(const char *format, va_list ap); 408int _win_vprintf(const char *format, va_list ap);
@@ -412,27 +418,27 @@ int _win_vscanf(const char *format, va_list arg_ptr);
412int _win_scanf(const char *format, ...); 418int _win_scanf(const char *format, ...);
413int _win_fscanf(FILE *stream, const char *format, ...); 419int _win_fscanf(FILE *stream, const char *format, ...);
414pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); 420pid_t _win_waitpid(pid_t pid, int *stat_loc, int options);
415int _win_bind(SOCKET s, const struct sockaddr *name, int namelen); 421int _win_bind(int s, const struct sockaddr *name, int namelen);
416int _win_connect(SOCKET s,const struct sockaddr *name, int namelen); 422int _win_connect(int s,const struct sockaddr *name, int namelen);
417int _win_getpeername(SOCKET s, struct sockaddr *name, 423int _win_getpeername(int s, struct sockaddr *name,
418 int *namelen); 424 int *namelen);
419int _win_getsockname(SOCKET s, struct sockaddr *name, 425int _win_getsockname(int s, struct sockaddr *name,
420 int *namelen); 426 int *namelen);
421int _win_getsockopt(SOCKET s, int level, int optname, char *optval, 427int _win_getsockopt(int s, int level, int optname, char *optval,
422 int *optlen); 428 int *optlen);
423int _win_listen(SOCKET s, int backlog); 429int _win_listen(int s, int backlog);
424int _win_recv(SOCKET s, char *buf, int len, int flags); 430int _win_recv(int s, char *buf, int len, int flags);
425int _win_recvfrom(SOCKET s, void *buf, int len, int flags, 431int _win_recvfrom(int s, void *buf, int len, int flags,
426 struct sockaddr *from, int *fromlen); 432 struct sockaddr *from, int *fromlen);
427int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, 433int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds,
428 const struct timeval *tv); 434 const struct timeval *tv);
429int _win_send(SOCKET s, const char *buf, int len, int flags); 435int _win_send(int s, const char *buf, int len, int flags);
430int _win_sendto(SOCKET s, const char *buf, int len, int flags, 436int _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);
432int _win_setsockopt(SOCKET s, int level, int optname, const void *optval, 438int _win_setsockopt(int s, int level, int optname, const void *optval,
433 int optlen); 439 int optlen);
434int _win_shutdown(SOCKET s, int how); 440int _win_shutdown(int s, int how);
435SOCKET _win_socket(int af, int type, int protocol); 441int _win_socket(int af, int type, int protocol);
436struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); 442struct hostent *_win_gethostbyaddr(const char *addr, int len, int type);
437struct hostent *_win_gethostbyname(const char *name); 443struct hostent *_win_gethostbyname(const char *name);
438struct hostent *gethostbyname2(const char *name, int af); 444struct hostent *gethostbyname2(const char *name, int af);
@@ -447,6 +453,7 @@ char *strndup (const char *s, size_t n);
447size_t strnlen (const char *str, size_t maxlen); 453size_t strnlen (const char *str, size_t maxlen);
448#endif 454#endif
449char *stpcpy(char *dest, const char *src); 455char *stpcpy(char *dest, const char *src);
456char *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)