diff options
author | Brent Cook <busterb@gmail.com> | 2014-11-19 07:43:07 -0600 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2014-12-03 17:07:17 -0600 |
commit | cccdd689e39b51af02b156229e5236a2a69dcdcb (patch) | |
tree | 79a77dcdc785a109aaaeb4a2a47507933525e47b /include | |
parent | 1bbde19a7c0db8d25fb496dea3e05e3dbc0bbeaf (diff) | |
download | portable-cccdd689e39b51af02b156229e5236a2a69dcdcb.tar.gz portable-cccdd689e39b51af02b156229e5236a2a69dcdcb.tar.bz2 portable-cccdd689e39b51af02b156229e5236a2a69dcdcb.zip |
add minimal winsock->BSD networking header shims
also add license header to existing shims
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 15 | ||||
-rw-r--r-- | include/arpa/inet.h | 10 | ||||
-rw-r--r-- | include/err.h | 5 | ||||
-rw-r--r-- | include/machine/endian.h | 5 | ||||
-rw-r--r-- | include/netdb.h | 10 | ||||
-rw-r--r-- | include/netinet/in.h | 10 | ||||
-rw-r--r-- | include/netinet/tcp.h | 10 | ||||
-rw-r--r-- | include/poll.h | 11 | ||||
-rw-r--r-- | include/stdio.h | 5 | ||||
-rw-r--r-- | include/stdlib.h | 5 | ||||
-rw-r--r-- | include/string.h | 5 | ||||
-rw-r--r-- | include/sys/ioctl.h | 11 | ||||
-rw-r--r-- | include/sys/mman.h | 5 | ||||
-rw-r--r-- | include/sys/select.h | 10 | ||||
-rw-r--r-- | include/sys/socket.h | 10 | ||||
-rw-r--r-- | include/sys/times.h | 10 | ||||
-rw-r--r-- | include/sys/types.h | 5 | ||||
-rw-r--r-- | include/syslog.h | 38 | ||||
-rw-r--r-- | include/unistd.h | 5 | ||||
-rw-r--r-- | include/win32netcompat.h | 22 |
20 files changed, 205 insertions, 2 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 4811145..543713e 100644 --- a/include/Makefile.am +++ b/include/Makefile.am | |||
@@ -1,11 +1,26 @@ | |||
1 | SUBDIRS = openssl | 1 | SUBDIRS = openssl |
2 | 2 | ||
3 | noinst_HEADERS = err.h | 3 | noinst_HEADERS = err.h |
4 | noinst_HEADERS += netdb.h | ||
5 | noinst_HEADERS += poll.h | ||
4 | noinst_HEADERS += pqueue.h | 6 | noinst_HEADERS += pqueue.h |
5 | noinst_HEADERS += stdio.h | 7 | noinst_HEADERS += stdio.h |
6 | noinst_HEADERS += stdlib.h | 8 | noinst_HEADERS += stdlib.h |
7 | noinst_HEADERS += string.h | 9 | noinst_HEADERS += string.h |
10 | noinst_HEADERS += syslog.h | ||
8 | noinst_HEADERS += unistd.h | 11 | noinst_HEADERS += unistd.h |
12 | noinst_HEADERS += win32netcompat.h | ||
13 | |||
14 | noinst_HEADERS += arpa/inet.h | ||
15 | |||
9 | noinst_HEADERS += machine/endian.h | 16 | noinst_HEADERS += machine/endian.h |
17 | |||
18 | noinst_HEADERS += netinet/in.h | ||
19 | noinst_HEADERS += netinet/tcp.h | ||
20 | |||
21 | noinst_HEADERS += sys/ioctl.h | ||
10 | noinst_HEADERS += sys/mman.h | 22 | noinst_HEADERS += sys/mman.h |
23 | noinst_HEADERS += sys/select.h | ||
24 | noinst_HEADERS += sys/socket.h | ||
25 | noinst_HEADERS += sys/times.h | ||
11 | noinst_HEADERS += sys/types.h | 26 | noinst_HEADERS += sys/types.h |
diff --git a/include/arpa/inet.h b/include/arpa/inet.h new file mode 100644 index 0000000..5d43e4f --- /dev/null +++ b/include/arpa/inet.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * arpa/inet.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <arpa/inet.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #endif | ||
diff --git a/include/err.h b/include/err.h index 8f555e8..ec90327 100644 --- a/include/err.h +++ b/include/err.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * err.h compatibility shim | ||
4 | */ | ||
5 | |||
1 | #ifdef HAVE_ERR_H | 6 | #ifdef HAVE_ERR_H |
2 | 7 | ||
3 | #include_next <err.h> | 8 | #include_next <err.h> |
diff --git a/include/machine/endian.h b/include/machine/endian.h index e3120db..5ec39af 100644 --- a/include/machine/endian.h +++ b/include/machine/endian.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * machine/endian.h compatibility shim | ||
4 | */ | ||
5 | |||
1 | #ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_ | 6 | #ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_ |
2 | #define LIBCRYPTOCOMPAT_BYTE_ORDER_H_ | 7 | #define LIBCRYPTOCOMPAT_BYTE_ORDER_H_ |
3 | 8 | ||
diff --git a/include/netdb.h b/include/netdb.h new file mode 100644 index 0000000..d36b91d --- /dev/null +++ b/include/netdb.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * netdb.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <netdb.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #endif | ||
diff --git a/include/netinet/in.h b/include/netinet/in.h new file mode 100644 index 0000000..20e57b8 --- /dev/null +++ b/include/netinet/in.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * netinet/in.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <netinet/in.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #endif | ||
diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h new file mode 100644 index 0000000..c98cf74 --- /dev/null +++ b/include/netinet/tcp.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * netinet/tcp.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <netinet/tcp.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #endif | ||
diff --git a/include/poll.h b/include/poll.h index 37f32cd..c02a560 100644 --- a/include/poll.h +++ b/include/poll.h | |||
@@ -1,7 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * poll(2) emulation for Windows | ||
3 | * Public domain | 2 | * Public domain |
4 | * from Dongsheng Song <dongsheng.song@gmail.com> | 3 | * |
4 | * poll(2) emulation for Windows | ||
5 | * | ||
6 | * This emulates just-enough poll functionality on Windows to work in the | ||
7 | * context of the openssl(1) program. This is not a replacement for | ||
8 | * POSIX.1-2001 poll(2). | ||
9 | * | ||
10 | * Dongsheng Song <dongsheng.song@gmail.com> | ||
11 | * Brent Cook <bcook@openbsd.org> | ||
5 | */ | 12 | */ |
6 | 13 | ||
7 | #ifndef LIBCRYPTOCOMPAT_POLL_H | 14 | #ifndef LIBCRYPTOCOMPAT_POLL_H |
diff --git a/include/stdio.h b/include/stdio.h index 4a40f6a..989b7fc 100644 --- a/include/stdio.h +++ b/include/stdio.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * stdio.h compatibility shim | ||
4 | */ | ||
5 | |||
1 | #include_next <stdio.h> | 6 | #include_next <stdio.h> |
2 | 7 | ||
3 | #ifndef LIBCRYPTOCOMPAT_STDIO_H | 8 | #ifndef LIBCRYPTOCOMPAT_STDIO_H |
diff --git a/include/stdlib.h b/include/stdlib.h index 1a1cb6c..e77f0b4 100644 --- a/include/stdlib.h +++ b/include/stdlib.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * stdlib.h compatibility shim | ||
3 | * Public domain | ||
4 | */ | ||
5 | |||
1 | #include_next <stdlib.h> | 6 | #include_next <stdlib.h> |
2 | 7 | ||
3 | #ifndef LIBCRYPTOCOMPAT_STDLIB_H | 8 | #ifndef LIBCRYPTOCOMPAT_STDLIB_H |
diff --git a/include/string.h b/include/string.h index 47ada28..a3263e7 100644 --- a/include/string.h +++ b/include/string.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * string.h compatibility shim | ||
4 | */ | ||
5 | |||
1 | #include_next <string.h> | 6 | #include_next <string.h> |
2 | 7 | ||
3 | #ifndef LIBCRYPTOCOMPAT_STRING_H | 8 | #ifndef LIBCRYPTOCOMPAT_STRING_H |
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h new file mode 100644 index 0000000..a255506 --- /dev/null +++ b/include/sys/ioctl.h | |||
@@ -0,0 +1,11 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * sys/ioctl.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <sys/ioctl.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #define ioctl(fd, type, arg) ioctlsocket(fd, type, arg) | ||
11 | #endif | ||
diff --git a/include/sys/mman.h b/include/sys/mman.h index cb1fa21..d9eb6a9 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * sys/mman.h compatibility shim | ||
4 | */ | ||
5 | |||
1 | #include_next <sys/mman.h> | 6 | #include_next <sys/mman.h> |
2 | 7 | ||
3 | #ifndef LIBCRYPTOCOMPAT_MMAN_H | 8 | #ifndef LIBCRYPTOCOMPAT_MMAN_H |
diff --git a/include/sys/select.h b/include/sys/select.h new file mode 100644 index 0000000..5ca0ea1 --- /dev/null +++ b/include/sys/select.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * sys/select.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <sys/select.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #endif | ||
diff --git a/include/sys/socket.h b/include/sys/socket.h new file mode 100644 index 0000000..17e84f1 --- /dev/null +++ b/include/sys/socket.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * sys/socket.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <sys/socket.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #endif | ||
diff --git a/include/sys/times.h b/include/sys/times.h new file mode 100644 index 0000000..5b9841b --- /dev/null +++ b/include/sys/times.h | |||
@@ -0,0 +1,10 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * sys/times.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <sys/times.h> | ||
8 | #else | ||
9 | #include <win32netcompat.h> | ||
10 | #endif | ||
diff --git a/include/sys/types.h b/include/sys/types.h index 34c3e03..bceedc2 100644 --- a/include/sys/types.h +++ b/include/sys/types.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * sys/types.h compatibility shim | ||
4 | */ | ||
5 | |||
1 | #include_next <sys/types.h> | 6 | #include_next <sys/types.h> |
2 | 7 | ||
3 | #ifndef LIBCRYPTOCOMPAT_SYS_TYPES_H | 8 | #ifndef LIBCRYPTOCOMPAT_SYS_TYPES_H |
diff --git a/include/syslog.h b/include/syslog.h new file mode 100644 index 0000000..f61e33b --- /dev/null +++ b/include/syslog.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * syslog.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef LIBCRYPTOCOMPAT_SYSLOG_H | ||
7 | #define LIBCRYPTOCOMPAT_SYSLOG_H | ||
8 | |||
9 | #ifndef _WIN32 | ||
10 | #include_next <syslog.h> | ||
11 | #else | ||
12 | |||
13 | /* priorities */ | ||
14 | #define LOG_EMERG 0 | ||
15 | #define LOG_ALERT 1 | ||
16 | #define LOG_CRIT 2 | ||
17 | #define LOG_ERR 3 | ||
18 | #define LOG_WARNING 4 | ||
19 | #define LOG_NOTICE 5 | ||
20 | #define LOG_INFO 6 | ||
21 | #define LOG_DEBUG 7 | ||
22 | |||
23 | /* facility codes */ | ||
24 | #define LOG_KERN (0<<3) | ||
25 | #define LOG_USER (1<<3) | ||
26 | #define LOG_DAEMON (3<<3) | ||
27 | |||
28 | /* flags for openlog */ | ||
29 | #define LOG_PID 0x01 | ||
30 | #define LOG_CONS 0x02 | ||
31 | |||
32 | extern void openlog(const char *ident, int option, int facility); | ||
33 | extern void syslog(int priority, const char *fmt, ...) | ||
34 | __attribute__ ((__format__ (__printf__, 2, 3))); | ||
35 | extern void closelog (void); | ||
36 | #endif | ||
37 | |||
38 | #endif /* LIBCRYPTOCOMPAT_SYSLOG_H */ | ||
diff --git a/include/unistd.h b/include/unistd.h index 38caeb1..3aecd68 100644 --- a/include/unistd.h +++ b/include/unistd.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * unistd.h compatibility shim | ||
4 | */ | ||
5 | |||
1 | #include_next <unistd.h> | 6 | #include_next <unistd.h> |
2 | 7 | ||
3 | #ifndef LIBCRYPTOCOMPAT_UNISTD_H | 8 | #ifndef LIBCRYPTOCOMPAT_UNISTD_H |
diff --git a/include/win32netcompat.h b/include/win32netcompat.h new file mode 100644 index 0000000..3c716b0 --- /dev/null +++ b/include/win32netcompat.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef LIBCRYPTOCOMPAT_WIN32NETCOMPAT_H | ||
2 | #define LIBCRYPTOCOMPAT_WIN32NETCOMPAT_H | ||
3 | |||
4 | #ifdef _WIN32 | ||
5 | |||
6 | #include <ws2tcpip.h> | ||
7 | |||
8 | #ifndef SHUT_RDWR | ||
9 | #define SHUT_RDWR SD_BOTH | ||
10 | #endif | ||
11 | |||
12 | #ifndef SHUT_RD | ||
13 | #define SHUT_RD SD_RECEIVE | ||
14 | #endif | ||
15 | |||
16 | #ifndef SHUT_WR | ||
17 | #define SHUT_WR SD_SEND | ||
18 | #endif | ||
19 | |||
20 | #endif | ||
21 | |||
22 | #endif | ||