add minimal winsock->BSD networking header shims

also add license header to existing shims
This commit is contained in:
Brent Cook 2014-11-19 07:43:07 -06:00 committed by Brent Cook
parent 1bbde19a7c
commit cccdd689e3
20 changed files with 205 additions and 2 deletions

View File

@ -1,11 +1,26 @@
SUBDIRS = openssl
noinst_HEADERS = err.h
noinst_HEADERS += netdb.h
noinst_HEADERS += poll.h
noinst_HEADERS += pqueue.h
noinst_HEADERS += stdio.h
noinst_HEADERS += stdlib.h
noinst_HEADERS += string.h
noinst_HEADERS += syslog.h
noinst_HEADERS += unistd.h
noinst_HEADERS += win32netcompat.h
noinst_HEADERS += arpa/inet.h
noinst_HEADERS += machine/endian.h
noinst_HEADERS += netinet/in.h
noinst_HEADERS += netinet/tcp.h
noinst_HEADERS += sys/ioctl.h
noinst_HEADERS += sys/mman.h
noinst_HEADERS += sys/select.h
noinst_HEADERS += sys/socket.h
noinst_HEADERS += sys/times.h
noinst_HEADERS += sys/types.h

10
include/arpa/inet.h Normal file
View File

@ -0,0 +1,10 @@
/*
* Public domain
* arpa/inet.h compatibility shim
*/
#ifndef _WIN32
#include_next <arpa/inet.h>
#else
#include <win32netcompat.h>
#endif

View File

@ -1,3 +1,8 @@
/*
* Public domain
* err.h compatibility shim
*/
#ifdef HAVE_ERR_H
#include_next <err.h>

View File

@ -1,3 +1,8 @@
/*
* Public domain
* machine/endian.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
#define LIBCRYPTOCOMPAT_BYTE_ORDER_H_

10
include/netdb.h Normal file
View File

@ -0,0 +1,10 @@
/*
* Public domain
* netdb.h compatibility shim
*/
#ifndef _WIN32
#include_next <netdb.h>
#else
#include <win32netcompat.h>
#endif

10
include/netinet/in.h Normal file
View File

@ -0,0 +1,10 @@
/*
* Public domain
* netinet/in.h compatibility shim
*/
#ifndef _WIN32
#include_next <netinet/in.h>
#else
#include <win32netcompat.h>
#endif

10
include/netinet/tcp.h Normal file
View File

@ -0,0 +1,10 @@
/*
* Public domain
* netinet/tcp.h compatibility shim
*/
#ifndef _WIN32
#include_next <netinet/tcp.h>
#else
#include <win32netcompat.h>
#endif

View File

@ -1,7 +1,14 @@
/*
* poll(2) emulation for Windows
* Public domain
* from Dongsheng Song <dongsheng.song@gmail.com>
*
* poll(2) emulation for Windows
*
* This emulates just-enough poll functionality on Windows to work in the
* context of the openssl(1) program. This is not a replacement for
* POSIX.1-2001 poll(2).
*
* Dongsheng Song <dongsheng.song@gmail.com>
* Brent Cook <bcook@openbsd.org>
*/
#ifndef LIBCRYPTOCOMPAT_POLL_H

View File

@ -1,3 +1,8 @@
/*
* Public domain
* stdio.h compatibility shim
*/
#include_next <stdio.h>
#ifndef LIBCRYPTOCOMPAT_STDIO_H

View File

@ -1,3 +1,8 @@
/*
* stdlib.h compatibility shim
* Public domain
*/
#include_next <stdlib.h>
#ifndef LIBCRYPTOCOMPAT_STDLIB_H

View File

@ -1,3 +1,8 @@
/*
* Public domain
* string.h compatibility shim
*/
#include_next <string.h>
#ifndef LIBCRYPTOCOMPAT_STRING_H

11
include/sys/ioctl.h Normal file
View File

@ -0,0 +1,11 @@
/*
* Public domain
* sys/ioctl.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/ioctl.h>
#else
#include <win32netcompat.h>
#define ioctl(fd, type, arg) ioctlsocket(fd, type, arg)
#endif

View File

@ -1,3 +1,8 @@
/*
* Public domain
* sys/mman.h compatibility shim
*/
#include_next <sys/mman.h>
#ifndef LIBCRYPTOCOMPAT_MMAN_H

10
include/sys/select.h Normal file
View File

@ -0,0 +1,10 @@
/*
* Public domain
* sys/select.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/select.h>
#else
#include <win32netcompat.h>
#endif

10
include/sys/socket.h Normal file
View File

@ -0,0 +1,10 @@
/*
* Public domain
* sys/socket.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/socket.h>
#else
#include <win32netcompat.h>
#endif

10
include/sys/times.h Normal file
View File

@ -0,0 +1,10 @@
/*
* Public domain
* sys/times.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/times.h>
#else
#include <win32netcompat.h>
#endif

View File

@ -1,3 +1,8 @@
/*
* Public domain
* sys/types.h compatibility shim
*/
#include_next <sys/types.h>
#ifndef LIBCRYPTOCOMPAT_SYS_TYPES_H

38
include/syslog.h Normal file
View File

@ -0,0 +1,38 @@
/*
* Public domain
* syslog.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_SYSLOG_H
#define LIBCRYPTOCOMPAT_SYSLOG_H
#ifndef _WIN32
#include_next <syslog.h>
#else
/* priorities */
#define LOG_EMERG 0
#define LOG_ALERT 1
#define LOG_CRIT 2
#define LOG_ERR 3
#define LOG_WARNING 4
#define LOG_NOTICE 5
#define LOG_INFO 6
#define LOG_DEBUG 7
/* facility codes */
#define LOG_KERN (0<<3)
#define LOG_USER (1<<3)
#define LOG_DAEMON (3<<3)
/* flags for openlog */
#define LOG_PID 0x01
#define LOG_CONS 0x02
extern void openlog(const char *ident, int option, int facility);
extern void syslog(int priority, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern void closelog (void);
#endif
#endif /* LIBCRYPTOCOMPAT_SYSLOG_H */

View File

@ -1,3 +1,8 @@
/*
* Public domain
* unistd.h compatibility shim
*/
#include_next <unistd.h>
#ifndef LIBCRYPTOCOMPAT_UNISTD_H

22
include/win32netcompat.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef LIBCRYPTOCOMPAT_WIN32NETCOMPAT_H
#define LIBCRYPTOCOMPAT_WIN32NETCOMPAT_H
#ifdef _WIN32
#include <ws2tcpip.h>
#ifndef SHUT_RDWR
#define SHUT_RDWR SD_BOTH
#endif
#ifndef SHUT_RD
#define SHUT_RD SD_RECEIVE
#endif
#ifndef SHUT_WR
#define SHUT_WR SD_SEND
#endif
#endif
#endif