[NETAPI32]
[reactos.git] / reactos / dll / 3rdparty / libtirpc / tirpc / wintirpc.h
1 /* NFSv4.1 client for Windows
2 * Copyright © 2012 The Regents of the University of Michigan
3 *
4 * Olga Kornievskaia <aglo@umich.edu>
5 * Casey Bodley <cbodley@umich.edu>
6 *
7 * This library is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or (at
10 * your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * without any warranty; without even the implied warranty of merchantability
14 * or fitness for a particular purpose. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 */
21
22 #ifndef _TIRPC_WINTIRPC_H
23 #define _TIRPC_WINTIRPC_H
24
25 /*
26 * Eliminate warnings about possibly unsafe uses of snprintf and friends
27 * XXX Think about cleaning these up and removing this later XXX
28 */
29 #define _CRT_SECURE_NO_WARNINGS 1
30
31
32 #ifdef _DEBUG
33 /* use visual studio's debug heap */
34 # define _CRTDBG_MAP_ALLOC
35 # include <stdlib.h>
36 # include <crtdbg.h>
37 #else
38 # include <stdlib.h>
39 #endif
40
41 /* Common Windows includes */
42 #include <winsock2.h>
43 #include <ws2tcpip.h>
44 #include <windows.h>
45 #include <process.h>
46 #include <basetsd.h>
47
48 #define snprintf _snprintf
49 //#define vsnprintf _vsnprintf
50 #define strcasecmp _stricmp
51 //#define strdup _strdup
52 #define getpid _getpid
53
54 #define bcmp memcmp
55 #define bcopy(d,s,l) memcpy(d,s,l)
56 #define bzero(d,s) memset(d,0,s)
57 #define strtok_r strtok_s
58
59 #define poll WSAPoll
60 #define ioctl ioctlsocket
61
62 #define __BEGIN_DECLS
63 #define __END_DECLS
64 #define __THROW
65
66 /*
67 * Hash of Windows Socket Handle values
68 */
69 #define WINSOCK_HANDLE_HASH_SIZE 1024
70 #define WINSOCK_HANDLE_HASH(x) (((x) >> 2) % WINSOCK_HANDLE_HASH_SIZE)
71
72 /*
73 * Functions imported from BSD
74 */
75 struct timezone
76 {
77 int tz_minuteswest; /* minutes W of Greenwich */
78 int tz_dsttime; /* type of dst correction */
79 };
80
81 extern int gettimeofday(struct timeval *tv, struct timezone *tz);
82 extern int asprintf(char **str, const char *fmt, ...);
83
84 #define SOL_IPV6 IPPROTO_IPV6
85
86 #define MAXHOSTNAMELEN 256
87
88 struct sockaddr_un {
89 int sun_family;
90 char sun_path[MAX_PATH];
91 };
92 /* Evaluate to actual length of the sockaddr_un structure */
93 /* XXX Should this return size_t or unsigned int ?? */
94 #define SUN_LEN(ptr) ((unsigned int)(sizeof(int) + strlen ((ptr)->sun_path)))
95
96 /* Debugging function */
97 void wintirpc_debug(char *fmt, ...);
98
99 #endif /* !_TIRPC_WINTIRPC_H */