summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-09-10 16:59:32 +0000
committerng0 <ng0@n0.is>2019-09-10 16:59:32 +0000
commit04b6df21cd281e8cd540139f8d9ae85defc1961c (patch)
tree6357199445df8d5c0c631bc8f10aef838b1f9f1e /src/include
parent483b0139a218a5f8a8311bda3eb23bcd88f57688 (diff)
downloadgnunet-04b6df21cd281e8cd540139f8d9ae85defc1961c.tar.gz
gnunet-04b6df21cd281e8cd540139f8d9ae85defc1961c.zip
remove CYGWIN codeblocks, drop vendored Windows openvpn, drop win32 specific files.
configures and builds okay. testsuite wasn't checked, will be checked. diff including the plibc removal is now around 14370 lines of code less.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am8
-rw-r--r--src/include/gnunet_common.h30
-rw-r--r--src/include/tap-windows.h81
-rw-r--r--src/include/winproc.h235
4 files changed, 2 insertions, 352 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 775257768..d5c097341 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -3,10 +3,6 @@ SUBDIRS = .
3 3
4gnunetincludedir = $(includedir)/gnunet 4gnunetincludedir = $(includedir)/gnunet
5 5
6if MINGW
7 WINPROC = winproc.h
8endif
9
10EXTRA_DIST = \ 6EXTRA_DIST = \
11 gauger.h \ 7 gauger.h \
12 block_fs.h \ 8 block_fs.h \
@@ -15,7 +11,7 @@ EXTRA_DIST = \
15 11
16if TALER_ONLY 12if TALER_ONLY
17gnunetinclude_HEADERS = \ 13gnunetinclude_HEADERS = \
18 platform.h plibc.h $(WINPROC) gettext.h \ 14 platform.h gettext.h \
19 gnunet_common.h \ 15 gnunet_common.h \
20 gnunet_container_lib.h \ 16 gnunet_container_lib.h \
21 gnunet_crypto_lib.h \ 17 gnunet_crypto_lib.h \
@@ -25,7 +21,7 @@ gnunetinclude_HEADERS = \
25else 21else
26 22
27gnunetinclude_HEADERS = \ 23gnunetinclude_HEADERS = \
28 platform.h $(WINPROC) gettext.h \ 24 platform.h gettext.h \
29 compat.h \ 25 compat.h \
30 gnunet_applications.h \ 26 gnunet_applications.h \
31 gnunet_arm_service.h \ 27 gnunet_arm_service.h \
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index afaf3a4de..555a98eb5 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -42,9 +42,6 @@
42#if HAVE_NETINET_IN_H 42#if HAVE_NETINET_IN_H
43#include <netinet/in.h> 43#include <netinet/in.h>
44#endif 44#endif
45#ifdef MINGW
46#include "winproc.h"
47#endif
48#ifdef HAVE_STDINT_H 45#ifdef HAVE_STDINT_H
49#include <stdint.h> 46#include <stdint.h>
50#endif 47#endif
@@ -189,11 +186,7 @@ extern "C" {
189/** 186/**
190 * gcc-ism to get gcc bitfield layout when compiling with -mms-bitfields 187 * gcc-ism to get gcc bitfield layout when compiling with -mms-bitfields
191 */ 188 */
192#if MINGW
193#define GNUNET_GCC_STRUCT_LAYOUT __attribute__ ((gcc_struct))
194#else
195#define GNUNET_GCC_STRUCT_LAYOUT 189#define GNUNET_GCC_STRUCT_LAYOUT
196#endif
197 190
198/** 191/**
199 * gcc-ism to force alignment; we use this to align char-arrays 192 * gcc-ism to force alignment; we use this to align char-arrays
@@ -216,28 +209,6 @@ extern "C" {
216 */ 209 */
217#define GNUNET_NORETURN __attribute__ ((noreturn)) 210#define GNUNET_NORETURN __attribute__ ((noreturn))
218 211
219#if MINGW
220#if __GNUC__ > 3
221/**
222 * gcc 4.x-ism to pack structures even on W32 (to be used before structs);
223 * Using this would cause structs to be unaligned on the stack on Sparc,
224 * so we *only* use this on W32 (see #670578 from Debian); fortunately,
225 * W32 doesn't run on sparc anyway.
226 */
227#define GNUNET_NETWORK_STRUCT_BEGIN _Pragma("pack(push)") _Pragma ("pack(1)")
228
229/**
230 * gcc 4.x-ism to pack structures even on W32 (to be used after structs)
231 * Using this would cause structs to be unaligned on the stack on Sparc,
232 * so we *only* use this on W32 (see #670578 from Debian); fortunately,
233 * W32 doesn't run on sparc anyway.
234 */
235#define GNUNET_NETWORK_STRUCT_END _Pragma("pack(pop)")
236
237#else
238#error gcc 4.x or higher required on W32 systems
239#endif
240#else
241/** 212/**
242 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32 213 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32
243 */ 214 */
@@ -247,7 +218,6 @@ extern "C" {
247 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32; 218 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;
248 */ 219 */
249#define GNUNET_NETWORK_STRUCT_END 220#define GNUNET_NETWORK_STRUCT_END
250#endif
251 221
252/* ************************ super-general types *********************** */ 222/* ************************ super-general types *********************** */
253 223
diff --git a/src/include/tap-windows.h b/src/include/tap-windows.h
deleted file mode 100644
index 37f4129c0..000000000
--- a/src/include/tap-windows.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * TAP-Windows -- A kernel driver to provide virtual tap
3 * device functionality on Windows.
4 *
5 * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
6 *
7 * This source code is Copyright Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
8 * and is released under the GPL version 2 (see below).
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program (see the file COPYING included with this
21 * distribution); if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24/**
25 * @file
26 * TAP32 virtual network driver defines
27 *
28 * @attention This file is part of openvpn and for kept
29 * as a separate file to allow easier upgrading.
30 */
31#ifndef __TAP_WIN_H
32#define __TAP_WIN_H
33
34/*
35 * =============
36 * TAP IOCTLs
37 * =============
38 */
39
40#define TAP_WIN_CONTROL_CODE(request, method) \
41 CTL_CODE(FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
42
43/* Present in 8.1 */
44
45#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE(1, METHOD_BUFFERED)
46#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE(2, METHOD_BUFFERED)
47#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE(3, METHOD_BUFFERED)
48#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE(4, METHOD_BUFFERED)
49#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE(5, METHOD_BUFFERED)
50#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE(6, METHOD_BUFFERED)
51#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE(7, METHOD_BUFFERED)
52#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE(8, METHOD_BUFFERED)
53#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE(9, METHOD_BUFFERED)
54
55/* Added in 8.2 */
56
57/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
58#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE(10, METHOD_BUFFERED)
59
60/*
61 * =================
62 * Registry keys
63 * =================
64 */
65
66#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
67
68#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
69
70/*
71 * ======================
72 * Filesystem prefixes
73 * ======================
74 */
75
76#define USERMODEDEVICEDIR "\\\\.\\Global\\"
77#define SYSDEVICEDIR "\\Device\\"
78#define USERDEVICEDIR "\\DosDevices\\Global\\"
79#define TAP_WIN_SUFFIX ".tap"
80
81#endif
diff --git a/src/include/winproc.h b/src/include/winproc.h
deleted file mode 100644
index 139f07e61..000000000
--- a/src/include/winproc.h
+++ /dev/null
@@ -1,235 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2003, 2004, 2005 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @author Nils Durner
23 *
24 * @file
25 * Definitions for MS Windows
26 */
27
28#ifndef _WINPROC_H
29#define _WINPROC_H
30
31#include <io.h>
32#include <stdio.h>
33#include <sys/types.h>
34#include <sys/stat.h>
35#include <sys/timeb.h>
36#include <time.h>
37#include <dirent.h>
38#ifndef FD_SETSIZE
39#define FD_SETSIZE 1024
40#endif
41#include <winsock2.h>
42#include <ws2tcpip.h>
43#include <windows.h>
44#include <winerror.h>
45#include <iphlpapi.h>
46#include <shlobj.h>
47#include <objbase.h>
48#include <sys/param.h> /* #define BYTE_ORDER */
49#include <ntsecapi.h>
50#include <lm.h>
51#include <aclapi.h>
52
53
54#ifdef __cplusplus
55extern "C"
56{
57#endif
58
59#ifndef MAX_NAME_LENGTH
60#define MAX_NAME_LENGTH 25
61#endif
62
63typedef DWORD WINAPI (*TNtQuerySystemInformation) (int, PVOID, ULONG, PULONG);
64typedef DWORD WINAPI (*TGetIfEntry) (PMIB_IFROW pIfRow);
65typedef DWORD WINAPI (*TGetIpAddrTable) (PMIB_IPADDRTABLE pIpAddrTable,
66 PULONG pdwSize, BOOL bOrder);
67typedef DWORD WINAPI (*TGetIfTable) (PMIB_IFTABLE pIfTable, PULONG pdwSize,
68 BOOL bOrder);
69typedef DWORD WINAPI (*TGetBestInterfaceEx) (struct sockaddr *, PDWORD);
70/* TODO: Explicitly import -A variants (i.e. TCreateHardLinkA) or -W
71 * variants (TCreateHardLinkW), etc.
72 */
73typedef DWORD WINAPI (*TCreateHardLink) (LPCTSTR lpFileName,
74 LPCTSTR lpExistingFileName,
75 LPSECURITY_ATTRIBUTES
76 lpSecurityAttributes);
77typedef SC_HANDLE WINAPI (*TOpenSCManager) (LPCTSTR lpMachineName,
78 LPCTSTR lpDatabaseName,
79 DWORD dwDesiredAccess);
80typedef SC_HANDLE WINAPI (*TCreateService) (SC_HANDLE hSCManager,
81 LPCTSTR lpServiceName,
82 LPCTSTR lpDisplayName,
83 DWORD dwDesiredAccess,
84 DWORD dwServiceType,
85 DWORD dwStartType,
86 DWORD dwErrorControl,
87 LPCTSTR lpBinaryPathName,
88 LPCTSTR lpLoadOrderGroup,
89 LPDWORD lpdwTagId,
90 LPCTSTR lpDependencies,
91 LPCTSTR lpServiceStartName,
92 LPCTSTR lpPassword);
93typedef BOOL WINAPI (*TCloseServiceHandle) (SC_HANDLE hSCObject);
94typedef BOOL WINAPI (*TDeleteService) (SC_HANDLE hService);
95typedef SERVICE_STATUS_HANDLE WINAPI (*TRegisterServiceCtrlHandler) (LPCTSTR
96 lpServiceName,
97 LPHANDLER_FUNCTION
98 lpHandlerProc);
99typedef BOOL WINAPI (*TSetServiceStatus) (SERVICE_STATUS_HANDLE
100 hServiceStatus,
101 LPSERVICE_STATUS lpServiceStatus);
102typedef BOOL WINAPI (*TStartServiceCtrlDispatcher) (const
103 LPSERVICE_TABLE_ENTRY
104 lpServiceTable);
105typedef BOOL WINAPI (*TControlService) (SC_HANDLE hService, DWORD dwControl,
106 LPSERVICE_STATUS lpServiceStatus);
107typedef SC_HANDLE WINAPI (*TOpenService) (SC_HANDLE hSCManager,
108 LPCTSTR lpServiceName,
109 DWORD dwDesiredAccess);
110typedef DWORD WINAPI (*TGetAdaptersInfo) (PIP_ADAPTER_INFO pAdapterInfo,
111 PULONG pOutBufLen);
112typedef NET_API_STATUS WINAPI (*TNetUserAdd) (LPCWSTR, DWORD, PBYTE, PDWORD);
113typedef NET_API_STATUS WINAPI (*TNetUserSetInfo) (LPCWSTR servername,
114 LPCWSTR username,
115 DWORD level, LPBYTE buf,
116 LPDWORD param_err);
117typedef NTSTATUS NTAPI (*TLsaOpenPolicy) (PLSA_UNICODE_STRING,
118 PLSA_OBJECT_ATTRIBUTES, ACCESS_MASK,
119 PLSA_HANDLE);
120typedef NTSTATUS NTAPI (*TLsaAddAccountRights) (LSA_HANDLE, PSID,
121 PLSA_UNICODE_STRING, ULONG);
122typedef NTSTATUS NTAPI (*TLsaRemoveAccountRights) (LSA_HANDLE, PSID, BOOLEAN,
123 PLSA_UNICODE_STRING,
124 ULONG);
125typedef NTSTATUS NTAPI (*TLsaClose) (LSA_HANDLE);
126typedef BOOL WINAPI (*TLookupAccountName) (LPCTSTR lpSystemName,
127 LPCTSTR lpAccountName, PSID Sid,
128 LPDWORD cbSid,
129 LPTSTR ReferencedDomainName,
130 LPDWORD cchReferencedDomainName,
131 PSID_NAME_USE peUse);
132
133typedef BOOL WINAPI (*TGetFileSecurity) (LPCTSTR lpFileName,
134 SECURITY_INFORMATION
135 RequestedInformation,
136 PSECURITY_DESCRIPTOR
137 pSecurityDescriptor, DWORD nLength,
138 LPDWORD lpnLengthNeeded);
139typedef BOOL WINAPI (*TInitializeSecurityDescriptor) (PSECURITY_DESCRIPTOR
140 pSecurityDescriptor,
141 DWORD dwRevision);
142typedef BOOL WINAPI (*TGetSecurityDescriptorDacl) (PSECURITY_DESCRIPTOR
143 pSecurityDescriptor,
144 LPBOOL lpbDaclPresent,
145 PACL * pDacl,
146 LPBOOL lpbDaclDefaulted);
147typedef BOOL WINAPI (*TGetAclInformation) (PACL pAcl, LPVOID pAclInformation,
148 DWORD nAclInformationLength,
149 ACL_INFORMATION_CLASS
150 dwAclInformationClass);
151typedef BOOL WINAPI (*TInitializeAcl) (PACL pAcl, DWORD nAclLength,
152 DWORD dwAclRevision);
153typedef BOOL WINAPI (*TGetAce) (PACL pAcl, DWORD dwAceIndex, LPVOID * pAce);
154typedef BOOL WINAPI (*TEqualSid) (PSID pSid1, PSID pSid2);
155typedef BOOL WINAPI (*TAddAce) (PACL pAcl, DWORD dwAceRevision,
156 DWORD dwStartingAceIndex, LPVOID pAceList,
157 DWORD nAceListLength);
158typedef BOOL WINAPI (*TAddAccessAllowedAce) (PACL pAcl, DWORD dwAceRevision,
159 DWORD AccessMask, PSID pSid);
160typedef BOOL WINAPI (*TSetNamedSecurityInfo) (LPTSTR pObjectName,
161 SE_OBJECT_TYPE ObjectType,
162 SECURITY_INFORMATION
163 SecurityInfo, PSID psidOwner,
164 PSID psidGroup, PACL pDacl,
165 PACL pSacl);
166
167extern TGetBestInterfaceEx GNGetBestInterfaceEx;
168extern TNtQuerySystemInformation GNNtQuerySystemInformation;
169extern TGetIfEntry GNGetIfEntry;
170extern TGetIpAddrTable GNGetIpAddrTable;
171extern TGetIfTable GNGetIfTable;
172extern TCreateHardLink GNCreateHardLink;
173extern TOpenSCManager GNOpenSCManager;
174extern TCreateService GNCreateService;
175extern TCloseServiceHandle GNCloseServiceHandle;
176extern TDeleteService GNDeleteService;
177extern TRegisterServiceCtrlHandler GNRegisterServiceCtrlHandler;
178extern TSetServiceStatus GNSetServiceStatus;
179extern TStartServiceCtrlDispatcher GNStartServiceCtrlDispatcher;
180extern TControlService GNControlService;
181extern TOpenService GNOpenService;
182extern TGetAdaptersInfo GNGetAdaptersInfo;
183extern TNetUserAdd GNNetUserAdd;
184extern TNetUserSetInfo GNNetUserSetInfo;
185extern TLsaOpenPolicy GNLsaOpenPolicy;
186extern TLsaAddAccountRights GNLsaAddAccountRights;
187extern TLsaRemoveAccountRights GNLsaRemoveAccountRights;
188extern TLsaClose GNLsaClose;
189extern TLookupAccountName GNLookupAccountName;
190extern TGetFileSecurity GNGetFileSecurity;
191extern TInitializeSecurityDescriptor GNInitializeSecurityDescriptor;
192extern TGetSecurityDescriptorDacl GNGetSecurityDescriptorDacl;
193extern TGetAclInformation GNGetAclInformation;
194extern TInitializeAcl GNInitializeAcl;
195extern TGetAce GNGetAce;
196extern TEqualSid GNEqualSid;
197extern TAddAce GNAddAce;
198extern TAddAccessAllowedAce GNAddAccessAllowedAce;
199extern TSetNamedSecurityInfo GNSetNamedSecurityInfo;
200
201
202BOOL CreateShortcut(const char *pszSrc, const char *pszDest);
203BOOL DereferenceShortcut(char *pszShortcut);
204long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey,
205 char *pszBuffer, long *pdLength);
206int ListNICs(void (*callback)(void *, const char *, int), void *cls);
207BOOL AddPathAccessRights(char *lpszFileName, char *lpszAccountName,
208 DWORD dwAccessMask);
209char *winErrorStr(const char *prefix, int dwErr);
210void EnumNICs(PMIB_IFTABLE * pIfTable, PMIB_IPADDRTABLE * pAddrTable);
211
212#define ENUMNICS3_MASK_OK 0x01
213#define ENUMNICS3_BCAST_OK 0x02
214
215struct EnumNICs3_results {
216 unsigned char flags;
217 int is_default;
218 char pretty_name[1001];
219 size_t addr_size;
220 SOCKADDR_STORAGE address;
221 SOCKADDR_STORAGE mask;
222 SOCKADDR_STORAGE broadcast;
223};
224
225int EnumNICs3(struct EnumNICs3_results **, int *EnumNICs3_results_count);
226void EnumNICs3_free(struct EnumNICs3_results *);
227int GNInitWinEnv();
228void GNShutdownWinEnv();
229
230BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode, DWORD dwTimeout);
231#ifdef __cplusplus
232}
233#endif
234
235#endif