aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-17 07:40:35 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-17 07:40:35 +0000
commit59b43b4b7398858b220c55b1b38101428f8a2c0b (patch)
treeb823a3c787c452ba70124cfb219e9c1bf759c171 /src/include
parenta0677cf8ba5ccf83f2a01fa831415717b6b4c244 (diff)
downloadgnunet-gtk-59b43b4b7398858b220c55b1b38101428f8a2c0b.tar.gz
gnunet-gtk-59b43b4b7398858b220c55b1b38101428f8a2c0b.zip
importing 0.9.x gnunet-gtk branch
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am9
-rw-r--r--src/include/gettext.h71
-rw-r--r--src/include/gnunetgtk_common.h201
-rw-r--r--src/include/platform.h188
-rw-r--r--src/include/plibc.h555
5 files changed, 0 insertions, 1024 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
deleted file mode 100644
index 7de20133..00000000
--- a/src/include/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
1gnunetincludedir = $(includedir)/GNUnet
2
3gnunetinclude_HEADERS = \
4 gnunetgtk_common.h
5
6EXTRA_DIST = \
7 gettext.h \
8 plibc.h \
9 platform.h
diff --git a/src/include/gettext.h b/src/include/gettext.h
deleted file mode 100644
index c89197cf..00000000
--- a/src/include/gettext.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/* Convenience header for conditional use of GNU <libintl.h>.
2 Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published
6 by the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public
15 License along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 USA. */
18
19#ifndef _LIBGETTEXT_H
20#define _LIBGETTEXT_H 1
21
22/* NLS can be disabled through the configure --disable-nls option. */
23#if ENABLE_NLS
24
25/* Get declarations of GNU message catalog functions. */
26# include <libintl.h>
27
28#else
29
30/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
31 chokes if dcgettext is defined as a macro. So include it now, to make
32 later inclusions of <locale.h> a NOP. We don't include <libintl.h>
33 as well because people using "gettext.h" will not include <libintl.h>,
34 and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
35 is GNUNET_OK. */
36#if defined(__sun)
37# include <locale.h>
38#endif
39
40/* Disabled NLS.
41 The casts to 'const char *' serve the purpose of producing warnings
42 for invalid uses of the value returned from these functions.
43 On pre-ANSI systems without 'const', the config.h file is supposed to
44 contain "#define const". */
45# define gettext(Msgid) ((const char *) (Msgid))
46# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
47# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
48# define ngettext(Msgid1, Msgid2, N) \
49 ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
50# define dngettext(Domainname, Msgid1, Msgid2, N) \
51 ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
52# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
53 ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
54/* slight modification here to avoid warnings: generate GNUNET_NO code,
55 not even the cast... */
56# define textdomain(Domainname)
57# define bindtextdomain(Domainname, Dirname)
58# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
59
60#endif
61
62/* A pseudo function call that serves as a marker for the automated
63 extraction of messages, but does not call gettext(). The run-time
64 translation is done at a different place in the code.
65 The argument, String, should be a literal string. Concatenated strings
66 and other string expressions won't work.
67 The macro's expansion is not parenthesized, so that it is suitable as
68 initializer for static 'char[]' or 'const char[]' variables. */
69#define gettext_noop(String) String
70
71#endif /* _LIBGETTEXT_H */
diff --git a/src/include/gnunetgtk_common.h b/src/include/gnunetgtk_common.h
deleted file mode 100644
index 099e1e41..00000000
--- a/src/include/gnunetgtk_common.h
+++ /dev/null
@@ -1,201 +0,0 @@
1/*
2 This file is part of GNUnet
3 (C) 2005, 2006, 2007 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file src/include/gnunetgtk_common.h
23 * @author Igor Wronsky
24 * @author Christian Grothoff
25 */
26
27#ifndef GNUNET_GTK_COMMON_H
28#define GNUNET_GTK_COMMON_H
29
30#include <gtk/gtk.h>
31#include <gtk/gtktext.h>
32#include <glade/glade.h>
33
34#define GNUNET_GTK_DEBUG_GTK 0
35
36#if GNUNET_GTK_DEBUG_GTK
37#define GNUNET_GTK_DEBUG_BEGIN() fprintf(stderr, "BEGIN of %s\n", __FUNCTION__)
38#define GNUNET_GTK_DEBUG_MARK() fprintf(stderr, "AT %s:%d\n", __FILE__, __LINE__)
39#define GNUNET_GTK_DEBUG_END() fprintf(stderr, "END of %s\n", __FUNCTION__)
40#else
41#define GNUNET_GTK_DEBUG_BEGIN()
42#define GNUNET_GTK_DEBUG_MARK()
43#define GNUNET_GTK_DEBUG_END()
44#endif
45
46
47void GNUNET_GTK_initialize_common_library (const char * ccfn,
48 struct GNUNET_GC_Configuration
49 *cfg, void *callback);
50
51void GNUNET_GTK_shutdown_plugins (void);
52
53void GNUNET_GTK_shutdown_common_library (void);
54
55const char *GNUNET_GTK_get_client_config_filename (void);
56
57/**
58 * Get the name of the main glade file for gnunet-gtk.
59 */
60const char *GNUNET_GTK_get_glade_filename (void);
61
62/**
63 * Get the GladeXML for the main window of gnunet-gtk.
64 */
65GladeXML *GNUNET_GTK_get_main_glade_XML (void);
66
67/**
68 * Get the GtkIconFactory for gnunet-gtk
69 */
70GtkIconFactory *GNUNET_GTK_get_iconFactory (void);
71
72/**
73 * Get the GtkStatusIcon for the tray icon (if GTK >= 2.10)
74 */
75#if GTK_CHECK_VERSION(2,10,0)
76GtkStatusIcon *GNUNET_GTK_get_trayIcon (void);
77#endif
78
79/**
80 * Appends a message to the info window
81 * @param doPopup if GNUNET_YES, the info window will
82 * be opened
83 */
84void GNUNET_GTK_show_info_message (const char *format, ...);
85
86/**
87 * Appends a log entry to the info window
88 * and update the statusbar to show this
89 * message (until the next call).
90 *
91 * @param txt the log entry
92 */
93void GNUNET_GTK_add_log_entry (const char *txt, ...);
94
95struct GNUNET_GE_Context *GNUNET_GTK_create_gtk_logger (GNUNET_GE_KIND mask);
96
97void GNUNET_GTK_shutdown_logger ();
98
99#define GNUNET_GTK_NOTIFY_LEVEL_LOW 0
100#define GNUNET_GTK_NOTIFY_LEVEL_NORMAL 1
101#define GNUNET_GTK_NOTIFY_LEVEL_CRITICAL 2
102
103typedef enum
104{
105 GNUNET_GTK_STATUS_NODAEMON,
106 GNUNET_GTK_STATUS_DAEMONUP,
107 GNUNET_GTK_STATUS_DISCONNECTED,
108 GNUNET_GTK_STATUS_CONNECTED,
109 GNUNET_GTK_STATUS_UNKNOWN
110} GNUNET_GTK_STATUS;
111
112/*
113 * Update the status bar indicator and the status icon
114 * about daemon and connexions status.
115 *
116 * @param status current status of gnunetd
117 * @param peers number of connected peers (with GNUNET_GTK_STATUS_CONNECTED)
118 */
119void
120GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS status,
121 unsigned long long peers);
122
123/**
124 * Sends a message to libnotify
125 */
126void GNUNET_GTK_notify (int type, const char *message, ...);
127
128/**
129 * Call a callback function from the mainloop/main thread ("SaveCall").
130 * Since GTK doesn't work with multi-threaded applications
131 * all GTK operations have to be done in the main thread
132 */
133void *GNUNET_GTK_save_call (GNUNET_ThreadMainFunction func, void *arg);
134
135/**
136 * Run the given "cb" function and save calls
137 * in parallel (used within the event loop to
138 * keep save calls going while something else
139 * happens).
140 */
141void *GNUNET_GTK_run_with_save_calls (GNUNET_ThreadMainFunction cb,
142 void *arg);
143
144/**
145 * Bind handlers defined by the various
146 * plugins to the signals defined by the
147 * Glade XML.
148 */
149void GNUNET_GTK_connect_glade_with_plugins (GladeXML * xml);
150
151/**
152 * Validate that a string is a Utf-8 string.
153 * If validation fails, msg is freed and a valid
154 * Utf-8 string is returned.
155 */
156char *GNUNET_GTK_validate_utf8 (char *msg);
157
158/**
159 * Gtk callback to save the main window state (tray icon use)
160 */
161void GNUNET_GTK_save_main_window_state (GtkWidget * main_window,
162 GdkEventWindowState * event,
163 gpointer user_data);
164
165/**
166 * Get the last main window state when restoring (tray icon use)
167 */
168GdkWindowState GNUNET_GTK_get_main_window_state (void);
169
170void GNUNET_GTK_main_quit (void);
171
172/**
173 * Identical to "gtk_tree_selection_selected_foreach",
174 * except that modifications of the underlying model
175 * during the iteration are tolerated.
176 */
177void GNUNET_GTK_tree_selection_selected_foreach (GtkTreeSelection * selection,
178 GtkTreeSelectionForeachFunc
179 func, gpointer data);
180
181/**
182 * Identical to "gtk_tree_model_foreach",
183 * except that modifications of the underlying model
184 * during the iteration are tolerated.
185 */
186void GNUNET_GTK_tree_model_foreach (GtkTreeModel * model,
187 GtkTreeSelectionForeachFunc func,
188 gpointer data);
189
190
191struct GNUNET_CronManager *GNUNET_GTK_get_cron_manager (void);
192
193
194GtkWidget *GNUNET_GTK_extract_main_widget_from_window (GladeXML * xml,
195 const char
196 *windowName);
197
198
199
200
201#endif
diff --git a/src/include/platform.h b/src/include/platform.h
deleted file mode 100644
index cb833e48..00000000
--- a/src/include/platform.h
+++ /dev/null
@@ -1,188 +0,0 @@
1/*
2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file include/platform.h
23 * @brief plaform specifics
24 *
25 * @author Nils Durner
26 */
27
28#ifndef PLATFORM_H
29#define PLATFORM_H
30
31#ifndef HAVE_USED_CONFIG_H
32#define HAVE_USED_CONFIG_H
33#include "config.h"
34#endif
35
36#include "gettext.h"
37
38#define _(a) dgettext("gnunet-gtk",a)
39
40#define UNREF(a) /*LOG(LOG_DEBUG, "unref %s:%u\n", __FILE__, __LINE__);*/ g_object_unref(a)
41
42#include "plibc.h"
43
44/**
45 * For strptime (glibc2 needs this).
46 */
47#ifndef _XOPEN_SOURCE
48#define _XOPEN_SOURCE
49#endif
50
51
52/* configuration options */
53
54#define VERBOSE_STATS 0
55
56#ifdef CYGWIN
57#include <sys/reent.h>
58#define _REENT_ONLY
59#endif
60
61#include <pthread.h>
62#ifdef CYGWIN
63#undef _REENT_ONLY
64#endif
65
66#ifdef _MSC_VER
67#include <Winsock2.h>
68#else
69#ifndef MINGW
70#include <netdb.h>
71#include <sys/socket.h>
72#include <netinet/in.h>
73#include <arpa/inet.h>
74#include <netinet/tcp.h>
75#include <netinet/in.h>
76#include <pwd.h>
77#include <sys/ioctl.h>
78#endif
79#endif
80
81#include <string.h>
82#include <stdio.h>
83#include <stdlib.h>
84#include <stdarg.h>
85#ifndef _MSC_VER
86#include <ltdl.h> /* KLB_FIX */
87#endif
88#include <errno.h>
89#include <signal.h>
90#ifndef _MSC_VER
91#include <unistd.h> /* KLB_FIX */
92#endif
93#include <sys/stat.h>
94#include <sys/types.h>
95#ifndef _MSC_VER
96#include <dirent.h> /* KLB_FIX */
97#endif
98#include <fcntl.h>
99#include <math.h>
100
101#if TIME_WITH_SYS_TIME
102#include <sys/time.h>
103#include <time.h>
104#else
105#if HAVE_SYS_TIME_H
106#include <sys/time.h>
107#else
108#include <time.h>
109#endif
110#endif
111
112/* if we have both openssl & libgcrypt, stick
113 to openssl for now (who has the obscure
114 libgcrypt CVS version that works for us!?...) */
115#if USE_OPENSSL
116#if USE_GCRYPT
117#undef USE_GCRYPT
118#define USE_GCRYPT 0
119#endif
120#endif
121
122#ifdef SOMEBSD
123#include <net/if.h>
124#endif
125#ifdef GNUNET_freeBSD
126#include <semaphore.h>
127#endif
128#ifdef OSX
129#include <semaphore.h>
130#endif
131#ifdef LINUX
132#include <net/if.h>
133#endif
134#ifdef SOLARIS
135#include <sys/sockio.h>
136#include <sys/loadavg.h>
137#include <semaphore.h>
138#endif
139#ifdef CYGWIN
140#include <windows.h>
141#include <cygwin/if.h>
142#endif
143#include <errno.h>
144
145#include <limits.h>
146
147#if HAVE_CTYPE_H
148#include <ctype.h>
149#endif
150
151#include <locale.h>
152#include "gettext.h"
153
154
155#ifdef CYGWIN
156#define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */
157#define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */
158#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
159#endif
160
161#ifndef MINGW
162#include <sys/mman.h>
163#endif
164
165#ifdef OSX
166#define socklen_t unsigned int
167#endif
168
169#if ENABLE_NLS
170#include "langinfo.h"
171#endif
172
173#ifndef O_LARGEFILE
174#define O_LARGEFILE 0
175#endif
176
177#include <GNUnet/gnunet_util.h>
178
179/* for GTK 2 */
180#define GTK_ENABLE_BROKEN
181
182#include <gtk/gtk.h>
183#include <gtk/gtktext.h>
184#include <glade/glade.h>
185
186
187
188#endif
diff --git a/src/include/plibc.h b/src/include/plibc.h
deleted file mode 100644
index 2618b994..00000000
--- a/src/include/plibc.h
+++ /dev/null
@@ -1,555 +0,0 @@
1/*
2 This file is part of PlibC.
3 (C) 2005 Nils Durner (and other contributing authors)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20/**
21 * @file include/plibc.h
22 * @brief PlibC header
23 * @attention This file is usually not installed under Unix,
24 * so ship it with your application
25 * @version $Revision: 1.30 $
26 */
27
28#ifndef _PLIBC_H_
29#define _PLIBC_H_
30
31#ifndef SIGALRM
32#define SIGALRM 14
33#endif
34
35#ifdef __cplusplus
36extern "C"
37{
38#endif
39
40#ifdef WINDOWS
41
42#if ENABLE_NLS
43#include "langinfo.h"
44#endif
45
46#include <windows.h>
47#include <Ws2tcpip.h>
48#include <time.h>
49#include <stdio.h>
50#include <sys/types.h>
51#include <sys/stat.h>
52#include <dirent.h>
53#include <errno.h>
54
55#define __BYTE_ORDER BYTE_ORDER
56#define __BIG_ENDIAN BIG_ENDIAN
57
58/* Conflicts with our definitions */
59#define __G_WIN32_H__
60
61/* Convert LARGNUNET_GE_INTEGER to double */
62#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
63 (double)((x).LowPart))
64
65#define socklen_t int
66#define ssize_t int
67#ifndef HAVE_FTRUNCATE
68#define ftruncate chsize
69#endif
70#define off_t int
71#define int64_t long long
72#define int32_t long
73
74#ifndef pid_t
75#define pid_t int
76#endif
77
78#ifndef WEXITSTATUS
79#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
80#endif
81
82/* Thanks to the Cygwin project */
83#define ENOCSI 43 /* No CSI structure available */
84#define EL2HLT 44 /* Level 2 halted */
85#ifndef EDEADLK
86#define EDEADLK 45 /* Deadlock condition */
87#endif
88#ifndef ENOLCK
89#define ENOLCK 46 /* No record locks available */
90#endif
91#define EBADE 50 /* Invalid exchange */
92#define EBADR 51 /* Invalid request descriptor */
93#define EXFULL 52 /* Exchange full */
94#define ENOANO 53 /* No anode */
95#define EBADRQC 54 /* Invalid request code */
96#define EBADSLT 55 /* Invalid slot */
97#ifndef EDEADLOCK
98#define EDEADLOCK EDEADLK /* File locking deadlock error */
99#endif
100#define EBFONT 57 /* Bad font file fmt */
101#define ENOSTR 60 /* Device not a stream */
102#define ENODATA 61 /* No data (for no delay io) */
103#define ETIME 62 /* Timer expired */
104#define ENOSR 63 /* Out of streams resources */
105#define ENONET 64 /* Machine is not on the network */
106#define ENOPKG 65 /* Package not installed */
107#define EREMOTE 66 /* The object is remote */
108#define ENOLINK 67 /* The link has been severed */
109#define EADV 68 /* Advertise error */
110#define ESRMNT 69 /* Srmount error */
111#define ECOMM 70 /* Communication error on send */
112#define EPROTO 71 /* Protocol error */
113#define EMULTIHOP 74 /* Multihop attempted */
114#define ELBIN 75 /* Inode is remote (not really error) */
115#define EDOTDOT 76 /* Cross mount point (not really error) */
116#define EBADMSG 77 /* Trying to read unreadable message */
117#define ENOTUNIQ 80 /* Given log. name not unique */
118#define EBADFD 81 /* f.d. invalid for this operation */
119#define EREMCHG 82 /* Remote address changed */
120#define ELIBACC 83 /* Can't access a needed shared lib */
121#define ELIBBAD 84 /* Accessing a corrupted shared lib */
122#define ELIBSCN 85 /* .lib section in a.out corrupted */
123#define ELIBMAX 86 /* Attempting to link in too many libs */
124#define ELIBEXEC 87 /* Attempting to exec a shared library */
125#ifndef ENOSYS
126#define ENOSYS 88 /* Function not implemented */
127#endif
128#define ENMFILE 89 /* No more files */
129#ifndef ENOTEMPTY
130#define ENOTEMPTY 90 /* Directory not empty */
131#endif
132#ifndef ENAMETOOLONG
133#define ENAMETOOLONG 91 /* File or path name too long */
134#endif
135#define ELOOP 92 /* Too many symbolic links */
136#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
137#define EPFNOSUPPORT 96 /* Protocol family not supported */
138#define ECONNRESET 104 /* Connection reset by peer */
139#define ENOBUFS 105 /* No buffer space available */
140#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
141#define EPROTOTYPE 107 /* Protocol wrong type for socket */
142#define ENOTSOCK 108 /* Socket operation on non-socket */
143#define ENOPROTOOPT 109 /* Protocol not available */
144#define ESHUTDOWN 110 /* Can't send after socket shutdown */
145#define ECONNREFUSED 111 /* Connection refused */
146#define EADDRINUSE 112 /* Address already in use */
147#define ECONNABORTED 113 /* Connection aborted */
148#define ENETUNREACH 114 /* Network is unreachable */
149#define ENETDOWN 115 /* Network interface is not configured */
150#ifndef ETIMEDOUT
151#define ETIMEDOUT 116 /* Connection timed out */
152#endif
153#define EHOSTDOWN 117 /* Host is down */
154#define EHOSTUNREACH 118 /* Host is unreachable */
155#define EINPROGRESS 119 /* Connection already in progress */
156#define EALREADY 120 /* Socket already connected */
157#define EDESTADDRREQ 121 /* Destination address required */
158#define EMSGSIZE 122 /* Message too long */
159#define EPROTONOSUPPORT 123 /* Unknown protocol */
160#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
161#define EADDRNOTAVAIL 125 /* Address not available */
162#define ENETRESET 126 /* Connection aborted by network */
163#define EISCONN 127 /* Socket is already connected */
164#define ENOTCONN 128 /* Socket is not connected */
165#define ETOOMANYREFS 129 /* Too many references: cannot splice */
166#define EPROCLIM 130 /* Too many processes */
167#define EUSERS 131 /* Too many users */
168#define EDQUOT 132 /* Disk quota exceeded */
169#define ESTALE 133 /* Unknown error */
170#ifndef ENOTSUP
171#define ENOTSUP 134 /* Not supported */
172#endif
173#define ENOMEDIUM 135 /* No medium (in tape drive) */
174#define ENOSHARE 136 /* No such host or network path */
175#define ECASECLASH 137 /* Filename exists with different case */
176#define EWOULDBLOCK EAGAIN /* Operation would block */
177#define EOVERFLOW 139 /* Value too large for defined data type */
178
179#undef HOST_NOT_FOUND
180#define HOST_NOT_FOUND 1
181#undef TRY_AGAIN
182#define TRY_AGAIN 2
183#undef NO_RECOVERY
184#define NO_RECOVERY 3
185#undef NO_ADDRESS
186#define NO_ADDRESS 4
187
188#define PROT_READ 0x1
189#define PROT_WRITE 0x2
190#define MAP_SHARED 0x1
191#define MAP_PRIVATE 0x2 /* unsupported */
192#define MAP_FIXED 0x10
193#define MAP_FAILED ((void *)-1)
194
195 struct statfs
196 {
197 long f_type; /* type of filesystem (see below) */
198 long f_bsize; /* optimal transfer block size */
199 long f_blocks; /* total data blocks in file system */
200 long f_bfree; /* free blocks in fs */
201 long f_bavail; /* free blocks avail to non-superuser */
202 long f_files; /* total file nodes in file system */
203 long f_ffree; /* free file nodes in fs */
204 long f_fsid; /* file system id */
205 long f_namelen; /* maximum length of filenames */
206 long f_spare[6]; /* spare for later */
207 };
208
209/* Taken from the Wine project <http://www.winehq.org>
210 /wine/include/winternl.h */
211 enum SYSTEM_INFORMATION_CLASS
212 {
213 SystemBasicInformation = 0,
214 Unknown1,
215 SystemPerformanceInformation = 2,
216 SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
217 Unknown4,
218 SystemProcessInformation = 5,
219 Unknown6,
220 Unknown7,
221 SystemProcessorPerformanceInformation = 8,
222 Unknown9,
223 Unknown10,
224 SystemDriverInformation,
225 Unknown12,
226 Unknown13,
227 Unknown14,
228 Unknown15,
229 SystemHandleList,
230 Unknown17,
231 Unknown18,
232 Unknown19,
233 Unknown20,
234 SystemCacheInformation,
235 Unknown22,
236 SystemInterruptInformation = 23,
237 SystemExceptionInformation = 33,
238 SystemRegistryQuotaInformation = 37,
239 SystemLookasideInformation = 45
240 };
241
242 typedef struct
243 {
244 LARGNUNET_GE_INTEGER IdleTime;
245 LARGNUNET_GE_INTEGER KernelTime;
246 LARGNUNET_GE_INTEGER UserTime;
247 LARGNUNET_GE_INTEGER Reserved1[2];
248 ULONG Reserved2;
249 } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
250
251#define sleep(secs) (Sleep(secs * 1000))
252
253/*********************** statfs *****************************/
254/* fake block size */
255#define FAKED_BLOCK_SIZE 512
256
257/* linux-compatible values for fs type */
258#define MSDOS_SUPER_MAGIC 0x4d44
259#define NTFS_SUPER_MAGIC 0x5346544E
260
261/*********************** End of statfs ***********************/
262
263#define SHUT_RDWR SD_BOTH
264
265/* Operations for flock() */
266#define LOCK_SH 1 /* shared lock */
267#define LOCK_EX 2 /* exclusive lock */
268#define LOCK_NB 4 /* or'd with one of the above to prevent
269 blocking */
270#define LOCK_UN 8 /* remove lock */
271
272/* Not supported under MinGW */
273#define S_IRGRP 0
274#define S_IWGRP 0
275#define S_IROTH 0
276#define S_IXGRP 0
277#define S_IWOTH 0
278#define S_IXOTH 0
279#define S_ISUID 0
280#define S_ISGID 0
281#define S_ISVTX 0
282#define S_IRWXG 0
283#define S_IRWXO 0
284
285#define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__)
286
287/**
288 * @brief index() - same as strchr()
289 */
290#define index(s, c) strchr(s, c)
291
292 BOOL _plibc_CreateShortcut (const char *pszSrc, const char *pszDest);
293 BOOL _plibc_DereferenceShortcut (char *pszShortcut);
294 char *plibc_ChooseDir (char *pszTitle, unsigned long ulFlags);
295 char *plibc_ChooseFile (char *pszTitle, unsigned long ulFlags);
296 long QueryRegistry (HKEY hMainKey, char *pszKey, char *pszSubKey,
297 char *pszBuffer, long *pdLength);
298
299 BOOL __win_IsHandleMarkedAsBlocking (SOCKET hHandle);
300 void __win_SetHandleBlockingMode (SOCKET s, BOOL bBlocking);
301 void __win_DiscardHandleBlockingMode (SOCKET s);
302 int _win_isSocketValid (int s);
303 int plibc_conv_to_win_path (const char *pszUnix, char *pszWindows);
304
305 typedef void (*TPanicProc) (int, char *);
306 void plibc_set_panic_proc (TPanicProc proc);
307
308 int flock (int fd, int operation);
309 int fsync (int fildes);
310 int inet_pton (int af, const char *src, void *dst);
311 int inet_pton4 (const char *src, u_char * dst, int pton);
312#if USE_IPV6
313 int inet_pton6 (const char *src, u_char * dst);
314#endif
315 int truncate (const char *fname, int distance);
316 int statfs (const char *path, struct statfs *buf);
317 const char *hstrerror (int err);
318 void gettimeofday (struct timeval *tp, void *tzp);
319 int mkstemp (char *tmplate);
320 char *strptime (const char *buf, const char *format, struct tm *tm);
321 char *ctime (const time_t * clock);
322 char *ctime_r (const time_t * clock, char *buf);
323 int plibc_init (char *pszOrg, char *pszApp);
324 void plibc_shutdown ();
325 int plibc_conv_to_win_path_ex (const char *pszUnix, char *pszWindows,
326 int derefLinks);
327 void _SetErrnoFromWinError (long lWinError, char *pszCaller, int iLine);
328 void SetErrnoFromWinsockError (long lWinError);
329 void SetHErrnoFromWinError (long lWinError);
330 void SetErrnoFromHRESULT (HRESULT hRes);
331 FILE *_win_fopen (const char *filename, const char *mode);
332 DIR *_win_opendir (const char *dirname);
333 int _win_open (const char *filename, int oflag, ...);
334#ifdef ENABLE_NLS
335 char *_win_bindtextdomain (const char *domainname, const char *dirname);
336#endif
337 int _win_chdir (const char *path);
338 int _win_close (int fd);
339 int _win_creat (const char *path, mode_t mode);
340 int _win_fstat (int handle, struct stat *buffer);
341 int _win_pipe (int *phandles);
342 int _win_rmdir (const char *path);
343 int _win_access (const char *path, int mode);
344 int _win_chmod (const char *filename, int pmode);
345 char *realpath (const char *file_name, char *resolved_name);
346 long _win_random (void);
347 int _win_remove (const char *path);
348 int _win_rename (const char *oldname, const char *newname);
349 int _win_stat (const char *path, struct stat *buffer);
350 int _win_unlink (const char *filename);
351 int _win_write (int fildes, const void *buf, size_t nbyte);
352 int _win_read (int fildes, void *buf, size_t nbyte);
353 size_t _win_fwrite (const void *buffer, size_t size, size_t count,
354 FILE * stream);
355 size_t _win_fread (void *buffer, size_t size, size_t count, FILE * stream);
356 int _win_symlink (const char *path1, const char *path2);
357 void *_win_mmap (void *start, size_t len, int access, int flags, int fd,
358 unsigned long long offset);
359 int _win_munmap (void *start, size_t length);
360 int _win_lstat (const char *path, struct stat *buf);
361 int _win_readlink (const char *path, char *buf, size_t bufsize);
362 int _win_accept (SOCKET s, struct sockaddr *addr, int *addrlen);
363 int _win_printf (const char *format, ...);
364 int _win_fprintf (FILE * f, const char *format, ...);
365 int _win_vprintf (const char *format, va_list ap);
366 int _win_vfprintf (FILE * stream, const char *format, va_list arg_ptr);
367 int _win_vsprintf (char *dest, const char *format, va_list arg_ptr);
368 int _win_vsnprintf (char *str, size_t size, const char *format,
369 va_list arg_ptr);
370 int _win_snprintf (char *str, size_t size, const char *format, ...);
371 int _win_sprintf (char *dest, const char *format, ...);
372 int _win_vsscanf (const char *str, const char *format, va_list arg_ptr);
373 int _win_sscanf (const char *str, const char *format, ...);
374 int _win_vfscanf (FILE * stream, const char *format, va_list arg_ptr);
375 int _win_vscanf (const char *format, va_list arg_ptr);
376 int _win_scanf (const char *format, ...);
377 int _win_fscanf (FILE * stream, const char *format, ...);
378 pid_t _win_waitpid (pid_t pid, int *stat_loc, int options);
379 int _win_bind (SOCKET s, const struct sockaddr *name, int namelen);
380 int _win_connect (SOCKET s, const struct sockaddr *name, int namelen);
381 int _win_getpeername (SOCKET s, struct sockaddr *name, int *namelen);
382 int _win_getsockname (SOCKET s, struct sockaddr *name, int *namelen);
383 int _win_getsockopt (SOCKET s, int level, int optname, char *optval,
384 int *optlen);
385 int _win_listen (SOCKET s, int backlog);
386 int _win_recv (SOCKET s, char *buf, int len, int flags);
387 int _win_recvfrom (SOCKET s, void *buf, int len, int flags,
388 struct sockaddr *from, int *fromlen);
389 int _win_select (int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds,
390 const struct timeval *tv);
391 int _win_send (SOCKET s, const char *buf, int len, int flags);
392 int _win_sendto (SOCKET s, const char *buf, int len, int flags,
393 const struct sockaddr *to, int tolen);
394 int _win_setsockopt (SOCKET s, int level, int optname, const void *optval,
395 int optlen);
396 int _win_shutdown (SOCKET s, int how);
397 SOCKET _win_socket (int af, int type, int protocol);
398 struct hostent *_win_gethostbyaddr (const char *addr, int len, int type);
399 struct hostent *_win_gethostbyname (const char *name);
400 char *_win_strerror (int errnum);
401 int IsWinNT ();
402
403#if !HAVE_STRNDUP
404 char *strndup (const char *s, size_t n);
405#endif
406#if !HAVE_STRNLEN
407 size_t strnlen (const char *str, size_t maxlen);
408#endif
409
410#endif /* WINDOWS */
411
412#ifndef WINDOWS
413#define DIR_SEPARATOR '/'
414#define DIR_SEPARATOR_STR "/"
415#define NEWLINE "\n"
416
417#ifdef ENABLE_NLS
418#define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n)
419#endif
420#define CREAT(p, m) creat(p, m)
421#undef FOPEN
422#define FOPEN(f, m) fopen(f, m)
423#define OPENDIR(d) opendir(d)
424#define OPEN(f) open(f)
425#define CHDIR(d) chdir(d)
426#define CLOSE(f) close(f)
427#define RMDIR(f) rmdir(f)
428#define ACCESS(p, m) access(p, m)
429#define CHMOD(f, p) chmod(f, p)
430#define FSTAT(h, b) fstat(h, b)
431#define PIPE(h) pipe(h)
432#define REMOVE(p) remove(p)
433#define RENAME(o, n) rename(o, n)
434#define STAT(p, b) stat(p, b)
435#define UNLINK(f) unlink(f)
436#define WRITE(f, b, n) write(f, b, n)
437#define READ(f, b, n) read(f, b, n)
438#define GN_FREAD(b, s, c, f) fread(b, s, c, f)
439#define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
440#define SYMLINK(a, b) symlink(a, b)
441#define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
442#define MUNMAP(s, l) munmap(s, l)
443#define STRERROR(i) strerror(i)
444#define RANDOM() random()
445#define READLINK(p, b, s) readlink(p, b, s)
446#define LSTAT(p, b) lstat(p, b)
447#define PRINTF printf
448#define FPRINTF fprintf
449#define VPRINTF(f, a) vprintf(f, a)
450#define VFPRINTF(s, f, a) vfprintf(s, f, a)
451#define VSPRINTF(d, f, a) vsprintf(d, f, a)
452#define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a)
453#define _REAL_SNPRINTF snprintf
454#define SPRINTF sprintf
455#define VSSCANF(s, f, a) vsscanf(s, f, a)
456#define SSCANF sscanf
457#define VFSCANF(s, f, a) vfscanf(s, f, a)
458#define VSCANF(f, a) vscanf(f, a)
459#define SCANF scanf
460#define FSCANF fscanf
461#define WAITPID(p, s, o) waitpid(p, s, o)
462#define ACCEPT(s, a, l) accept(s, a, l)
463#define BIND(s, n, l) bind(s, n, l)
464#define CONNECT(s, n, l) connect(s, n, l)
465#define GETPEERNAME(s, n, l) getpeername(s, n, l)
466#define GETSOCKNAME(s, n, l) getsockname(s, n, l)
467#define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p)
468#define LISTEN(s, b) listen(s, b)
469#define RECV(s, b, l, f) recv(s, b, l, f)
470#define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o)
471#define SELECT(n, r, w, e, t) select(n, r, w, e, t)
472#define SEND(s, b, l, f) send(s, b, l, f)
473#define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n)
474#define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n)
475#define SHUTDOWN(s, h) shutdown(s, h)
476#define SOCKET(a, t, p) socket(a, t, p)
477#define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t)
478#define GETHOSTBYNAME(n) gethostbyname(n)
479#else
480#define DIR_SEPARATOR '\\'
481#define DIR_SEPARATOR_STR "\\"
482#define NEWLINE "\r\n"
483
484#ifdef ENABLE_NLS
485#define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n)
486#endif
487#define CREAT(p, m) _win_creat(p, m)
488#define FOPEN(f, m) _win_fopen(f, m)
489#define OPENDIR(d) _win_opendir(d)
490#define OPEN(f) _win_open(f)
491#define CHDIR(d) _win_chdir(d)
492#define CLOSE(f) _win_close(f)
493#define FSTAT(h, b) _win_fstat(h, b)
494#define RMDIR(f) _win_rmdir(f)
495#define ACCESS(p, m) _win_access(p, m)
496#define CHMOD(f, p) _win_chmod(f, p)
497#define PIPE(h) _win_pipe(h)
498#define RANDOM() _win_random()
499#define REMOVE(p) _win_remove(p)
500#define RENAME(o, n) _win_rename(o, n)
501#define STAT(p, b) _win_stat(p, b)
502#define UNLINK(f) _win_unlink(f)
503#define WRITE(f, b, n) _win_write(f, b, n)
504#define READ(f, b, n) _win_read(f, b, n)
505#define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f)
506#define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
507#define SYMLINK(a, b) _win_symlink(a, b)
508#define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
509#define MUNMAP(s, l) _win_munmap(s, l)
510#define STRERROR(i) _win_strerror(i)
511#define READLINK(p, b, s) _win_readlink(p, b, s)
512#define LSTAT(p, b) _win_lstat(p, b)
513#define PRINTF(f, ...) _win_printf(f , __VA_ARGS__)
514#define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__)
515#define VPRINTF(f, a) _win_vprintf(f, a)
516#define VFPRINTF(s, f, a) _win_vfprintf(s, f, a)
517#define VSPRINTF(d, f, a) _win_vsprintf(d, f, a)
518#define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a)
519#define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__)
520#define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__)
521#define VSSCANF(s, f, a) _win_vsscanf(s, f, a)
522#define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__)
523#define VFSCANF(s, f, a) _win_vfscanf(s, f, a)
524#define VSCANF(f, a) _win_vscanf(f, a)
525#define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
526#define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
527#define WAITPID(p, s, o) _win_waitpid(p, s, o)
528#define ACCEPT(s, a, l) _win_accept(s, a, l)
529#define BIND(s, n, l) _win_bind(s, n, l)
530#define CONNECT(s, n, l) _win_connect(s, n, l)
531#define GETPEERNAME(s, n, l) _win_getpeername(s, n, l)
532#define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l)
533#define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p)
534#define LISTEN(s, b) _win_listen(s, b)
535#define RECV(s, b, l, f) _win_recv(s, b, l, f)
536#define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o)
537#define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t)
538#define SEND(s, b, l, f) _win_send(s, b, l, f)
539#define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n)
540#define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
541#define SHUTDOWN(s, h) _win_shutdown(s, h)
542#define SOCKET(a, t, p) _win_socket(a, t, p)
543#define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t)
544#define GETHOSTBYNAME(n) _win_gethostbyname(n)
545#endif
546
547
548#ifdef __cplusplus
549}
550#endif
551
552
553#endif //_PLIBC_H_
554
555/* end of plibc.h */