From 2b798e486a00e4d433423ff8cea6e71eccd42af4 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Fri, 13 May 2016 20:41:26 -0700 Subject: [PATCH] Problem: name conflicts from windows.h, draft API declared in pch. --- Makefile.am | 3 +- builds/msvc/vs2013/libzmq/libzmq.vcxproj | 1 + .../msvc/vs2013/libzmq/libzmq.vcxproj.filters | 3 + src/address.cpp | 1 - src/atomic_counter.hpp | 1 - src/atomic_ptr.hpp | 2 - src/clock.cpp | 1 - src/condition_variable.hpp | 1 - src/ctx.cpp | 5 +- src/curve_client.cpp | 5 - src/curve_client.hpp | 2 - src/curve_server.cpp | 5 - src/curve_server.hpp | 2 - src/dish.cpp | 7 -- src/err.hpp | 7 +- src/fd.hpp | 6 - src/gssapi_client.cpp | 5 - src/gssapi_mechanism_base.cpp | 5 - src/gssapi_mechanism_base.hpp | 2 - src/gssapi_server.cpp | 5 - src/io_thread.cpp | 2 +- src/ip.cpp | 5 +- src/ipc_address.hpp | 2 - src/ipc_connecter.cpp | 1 - src/ipc_connecter.hpp | 2 - src/ipc_listener.hpp | 2 - src/mailbox.hpp | 1 - src/mailbox_safe.hpp | 1 - src/msg.cpp | 1 - src/mtrie.cpp | 7 +- src/mutex.hpp | 1 - src/null_mechanism.cpp | 4 - src/options.hpp | 1 - src/pgm_receiver.cpp | 5 - src/pgm_receiver.hpp | 6 - src/pgm_sender.cpp | 5 - src/pgm_sender.hpp | 6 - src/pgm_socket.cpp | 5 - src/pgm_socket.hpp | 3 - src/plain_client.cpp | 4 - src/plain_server.cpp | 4 - src/poller.hpp | 2 - src/precompiled.hpp | 98 ++------------- src/proxy.cpp | 3 +- src/random.cpp | 5 +- src/raw_decoder.cpp | 5 - src/raw_encoder.hpp | 6 - src/select.cpp | 3 - src/select.hpp | 3 - src/signaler.cpp | 5 +- src/socket_base.cpp | 3 - src/socks.cpp | 1 - src/socks_connecter.cpp | 5 +- src/socks_connecter.hpp | 1 - src/stdint.hpp | 2 - src/stream_engine.cpp | 1 - src/stream_engine.hpp | 1 - src/tcp.cpp | 5 +- src/tcp_address.hpp | 6 +- src/tcp_connecter.cpp | 5 +- src/tcp_connecter.hpp | 1 - src/tcp_listener.cpp | 5 +- src/tcp_listener.hpp | 1 - src/thread.cpp | 1 - src/thread.hpp | 6 +- src/trie.cpp | 13 +- src/tweetnacl.c | 4 + src/tweetnacl.h | 2 - src/udp_address.cpp | 5 +- src/udp_address.hpp | 6 +- src/udp_engine.cpp | 5 +- src/v1_decoder.cpp | 5 - src/v2_decoder.cpp | 7 -- src/ypipe.hpp | 1 - src/zmq.cpp | 9 +- src/zmq_draft.h | 112 ++++++++++++++++++ src/zmq_utils.cpp | 9 +- 77 files changed, 163 insertions(+), 326 deletions(-) create mode 100644 src/zmq_draft.h diff --git a/Makefile.am b/Makefile.am index 1a6a01cd..d48a2455 100644 --- a/Makefile.am +++ b/Makefile.am @@ -234,7 +234,8 @@ src_libzmq_la_SOURCES = \ src/decoder_allocators.cpp \ src/decoder_allocators.hpp \ src/socket_poller.cpp \ - src/socket_poller.hpp + src/socket_poller.hpp \ + src/zmq_draft.hpp if USE_TWEETNACL src_libzmq_la_SOURCES += \ diff --git a/builds/msvc/vs2013/libzmq/libzmq.vcxproj b/builds/msvc/vs2013/libzmq/libzmq.vcxproj index 35cb557a..5346239c 100644 --- a/builds/msvc/vs2013/libzmq/libzmq.vcxproj +++ b/builds/msvc/vs2013/libzmq/libzmq.vcxproj @@ -67,6 +67,7 @@ + diff --git a/builds/msvc/vs2013/libzmq/libzmq.vcxproj.filters b/builds/msvc/vs2013/libzmq/libzmq.vcxproj.filters index 9b93a830..6b4a9d30 100644 --- a/builds/msvc/vs2013/libzmq/libzmq.vcxproj.filters +++ b/builds/msvc/vs2013/libzmq/libzmq.vcxproj.filters @@ -567,6 +567,9 @@ src\include + + src\include + diff --git a/src/address.cpp b/src/address.cpp index f180a352..6e3d9954 100644 --- a/src/address.cpp +++ b/src/address.cpp @@ -29,7 +29,6 @@ #include "precompiled.hpp" #include "macros.hpp" -#include "platform.hpp" #include "address.hpp" #include "ctx.hpp" #include "err.hpp" diff --git a/src/atomic_counter.hpp b/src/atomic_counter.hpp index 3a6f0f2a..6d61f1a5 100644 --- a/src/atomic_counter.hpp +++ b/src/atomic_counter.hpp @@ -31,7 +31,6 @@ #define __ZMQ_ATOMIC_COUNTER_HPP_INCLUDED__ #include "stdint.hpp" -#include "platform.hpp" #if defined ZMQ_FORCE_MUTEXES #define ZMQ_ATOMIC_COUNTER_MUTEX diff --git a/src/atomic_ptr.hpp b/src/atomic_ptr.hpp index 9a617b11..16a703b2 100644 --- a/src/atomic_ptr.hpp +++ b/src/atomic_ptr.hpp @@ -30,8 +30,6 @@ #ifndef __ZMQ_ATOMIC_PTR_HPP_INCLUDED__ #define __ZMQ_ATOMIC_PTR_HPP_INCLUDED__ -#include "platform.hpp" - #if defined ZMQ_FORCE_MUTEXES #define ZMQ_ATOMIC_PTR_MUTEX #elif defined ZMQ_HAVE_ATOMIC_INTRINSICS diff --git a/src/clock.cpp b/src/clock.cpp index 342bd01f..689bda59 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -29,7 +29,6 @@ #include "precompiled.hpp" #include "clock.hpp" -#include "platform.hpp" #include "likely.hpp" #include "config.hpp" #include "err.hpp" diff --git a/src/condition_variable.hpp b/src/condition_variable.hpp index bf46c570..a37d6bd8 100644 --- a/src/condition_variable.hpp +++ b/src/condition_variable.hpp @@ -30,7 +30,6 @@ #ifndef __ZMQ_CONDITON_VARIABLE_HPP_INCLUDED__ #define __ZMQ_CONDITON_VARIABLE_HPP_INCLUDED__ -#include "platform.hpp" #include "clock.hpp" #include "err.hpp" #include "mutex.hpp" diff --git a/src/ctx.cpp b/src/ctx.cpp index d493c8ec..b1d010a8 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -29,10 +29,7 @@ #include "precompiled.hpp" #include "macros.hpp" -#include "platform.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#ifndef ZMQ_HAVE_WINDOWS #include #endif diff --git a/src/curve_client.cpp b/src/curve_client.cpp index f20d2217..5a7beaf3 100644 --- a/src/curve_client.cpp +++ b/src/curve_client.cpp @@ -29,14 +29,9 @@ #include "precompiled.hpp" #include "macros.hpp" -#include "platform.hpp" #ifdef ZMQ_HAVE_CURVE -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include "msg.hpp" #include "session_base.hpp" #include "err.hpp" diff --git a/src/curve_client.hpp b/src/curve_client.hpp index bc5c7670..57ea3356 100644 --- a/src/curve_client.hpp +++ b/src/curve_client.hpp @@ -32,8 +32,6 @@ #ifdef ZMQ_HAVE_CURVE -#include "platform.hpp" - #if defined (ZMQ_USE_TWEETNACL) # include "tweetnacl.h" #elif defined (ZMQ_USE_LIBSODIUM) diff --git a/src/curve_server.cpp b/src/curve_server.cpp index c7315729..b5678b4e 100644 --- a/src/curve_server.cpp +++ b/src/curve_server.cpp @@ -29,14 +29,9 @@ #include "precompiled.hpp" #include "macros.hpp" -#include "platform.hpp" #ifdef ZMQ_HAVE_CURVE -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include "msg.hpp" #include "session_base.hpp" #include "err.hpp" diff --git a/src/curve_server.hpp b/src/curve_server.hpp index 8e2734aa..89fb3ea3 100644 --- a/src/curve_server.hpp +++ b/src/curve_server.hpp @@ -32,8 +32,6 @@ #ifdef ZMQ_HAVE_CURVE -#include "platform.hpp" - #if defined (ZMQ_USE_TWEETNACL) # include "tweetnacl.h" #elif defined (ZMQ_USE_LIBSODIUM) diff --git a/src/dish.cpp b/src/dish.cpp index 01eac715..c1ae5077 100644 --- a/src/dish.cpp +++ b/src/dish.cpp @@ -30,13 +30,6 @@ #include "precompiled.hpp" #include -#include "platform.hpp" - -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - -#include "../include/zmq.h" #include "macros.hpp" #include "dish.hpp" #include "err.hpp" diff --git a/src/err.hpp b/src/err.hpp index 0565f7f6..738eb1ac 100644 --- a/src/err.hpp +++ b/src/err.hpp @@ -40,18 +40,13 @@ #include #include -#include "platform.hpp" - -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#ifndef ZMQ_HAVE_WINDOWS #include #endif #include "likely.hpp" // 0MQ-specific error codes are defined in zmq.h -#include "../include/zmq.h" // EPROTO is not used by OpenBSD and maybe other platforms. #ifndef EPROTO diff --git a/src/fd.hpp b/src/fd.hpp index 08787551..207b072e 100644 --- a/src/fd.hpp +++ b/src/fd.hpp @@ -30,12 +30,6 @@ #ifndef __ZMQ_FD_HPP_INCLUDED__ #define __ZMQ_FD_HPP_INCLUDED__ -#include "platform.hpp" - -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - namespace zmq { #ifdef ZMQ_HAVE_WINDOWS diff --git a/src/gssapi_client.cpp b/src/gssapi_client.cpp index 720f668c..9eb598ab 100644 --- a/src/gssapi_client.cpp +++ b/src/gssapi_client.cpp @@ -28,14 +28,9 @@ */ #include "precompiled.hpp" -#include "platform.hpp" #ifdef HAVE_LIBGSSAPI_KRB5 -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include #include diff --git a/src/gssapi_mechanism_base.cpp b/src/gssapi_mechanism_base.cpp index 55b02afd..3a404c4c 100644 --- a/src/gssapi_mechanism_base.cpp +++ b/src/gssapi_mechanism_base.cpp @@ -28,14 +28,9 @@ */ #include "precompiled.hpp" -#include "platform.hpp" #ifdef HAVE_LIBGSSAPI_KRB5 -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include #include diff --git a/src/gssapi_mechanism_base.hpp b/src/gssapi_mechanism_base.hpp index cfdd5e02..688faa7d 100644 --- a/src/gssapi_mechanism_base.hpp +++ b/src/gssapi_mechanism_base.hpp @@ -30,8 +30,6 @@ #ifndef __ZMQ_GSSAPI_MECHANISM_BASE_HPP_INCLUDED__ #define __ZMQ_GSSAPI_MECHANISM_BASE_HPP_INCLUDED__ -#include "platform.hpp" - #ifdef HAVE_LIBGSSAPI_KRB5 #if HAVE_GSSAPI_GSSAPI_GENERIC_H diff --git a/src/gssapi_server.cpp b/src/gssapi_server.cpp index 4a8a25e5..5f84afdf 100644 --- a/src/gssapi_server.cpp +++ b/src/gssapi_server.cpp @@ -28,14 +28,9 @@ */ #include "precompiled.hpp" -#include "platform.hpp" #ifdef HAVE_LIBGSSAPI_KRB5 -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include #include diff --git a/src/io_thread.cpp b/src/io_thread.cpp index cbc84dce..65e1f6a3 100644 --- a/src/io_thread.cpp +++ b/src/io_thread.cpp @@ -28,11 +28,11 @@ */ #include "precompiled.hpp" + #include #include "macros.hpp" #include "io_thread.hpp" -#include "platform.hpp" #include "err.hpp" #include "ctx.hpp" diff --git a/src/ip.cpp b/src/ip.cpp index 981da83c..1d0bbdbc 100644 --- a/src/ip.cpp +++ b/src/ip.cpp @@ -30,11 +30,8 @@ #include "precompiled.hpp" #include "ip.hpp" #include "err.hpp" -#include "platform.hpp" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #include #include diff --git a/src/ipc_address.hpp b/src/ipc_address.hpp index d0c4c25d..a77b0d58 100644 --- a/src/ipc_address.hpp +++ b/src/ipc_address.hpp @@ -32,8 +32,6 @@ #include -#include "platform.hpp" - #if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS #include diff --git a/src/ipc_connecter.cpp b/src/ipc_connecter.cpp index bb3c2dd9..48793e8c 100644 --- a/src/ipc_connecter.cpp +++ b/src/ipc_connecter.cpp @@ -37,7 +37,6 @@ #include "stream_engine.hpp" #include "io_thread.hpp" -#include "platform.hpp" #include "random.hpp" #include "err.hpp" #include "ip.hpp" diff --git a/src/ipc_connecter.hpp b/src/ipc_connecter.hpp index 96e2a790..6149d626 100644 --- a/src/ipc_connecter.hpp +++ b/src/ipc_connecter.hpp @@ -30,8 +30,6 @@ #ifndef __IPC_CONNECTER_HPP_INCLUDED__ #define __IPC_CONNECTER_HPP_INCLUDED__ -#include "platform.hpp" - #if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS #include "fd.hpp" diff --git a/src/ipc_listener.hpp b/src/ipc_listener.hpp index 8de8f0f4..29d808e0 100644 --- a/src/ipc_listener.hpp +++ b/src/ipc_listener.hpp @@ -30,8 +30,6 @@ #ifndef __ZMQ_IPC_LISTENER_HPP_INCLUDED__ #define __ZMQ_IPC_LISTENER_HPP_INCLUDED__ -#include "platform.hpp" - #if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS #include diff --git a/src/mailbox.hpp b/src/mailbox.hpp index 7f968689..e3fcbb31 100644 --- a/src/mailbox.hpp +++ b/src/mailbox.hpp @@ -32,7 +32,6 @@ #include -#include "platform.hpp" #include "signaler.hpp" #include "fd.hpp" #include "config.hpp" diff --git a/src/mailbox_safe.hpp b/src/mailbox_safe.hpp index 5fc05730..0e1382f2 100644 --- a/src/mailbox_safe.hpp +++ b/src/mailbox_safe.hpp @@ -33,7 +33,6 @@ #include #include -#include "platform.hpp" #include "signaler.hpp" #include "fd.hpp" #include "config.hpp" diff --git a/src/msg.cpp b/src/msg.cpp index 40b4293e..0aec12c3 100644 --- a/src/msg.cpp +++ b/src/msg.cpp @@ -30,7 +30,6 @@ #include "precompiled.hpp" #include "macros.hpp" #include "msg.hpp" -#include "../include/zmq.h" #include #include diff --git a/src/mtrie.cpp b/src/mtrie.cpp index 12e4d850..b9adeefb 100644 --- a/src/mtrie.cpp +++ b/src/mtrie.cpp @@ -33,14 +33,9 @@ #include #include -#include "macros.hpp" -#include "platform.hpp" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include "err.hpp" #include "pipe.hpp" +#include "macros.hpp" #include "mtrie.hpp" zmq::mtrie_t::mtrie_t () : diff --git a/src/mutex.hpp b/src/mutex.hpp index c2108080..82b23632 100644 --- a/src/mutex.hpp +++ b/src/mutex.hpp @@ -30,7 +30,6 @@ #ifndef __ZMQ_MUTEX_HPP_INCLUDED__ #define __ZMQ_MUTEX_HPP_INCLUDED__ -#include "platform.hpp" #include "err.hpp" // Mutex class encapsulates OS mutex in a platform-independent way. diff --git a/src/null_mechanism.cpp b/src/null_mechanism.cpp index 5a63b293..9eaed6c6 100644 --- a/src/null_mechanism.cpp +++ b/src/null_mechanism.cpp @@ -28,10 +28,6 @@ */ #include "precompiled.hpp" -#include "platform.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif #include #include diff --git a/src/options.hpp b/src/options.hpp index 118b281e..e8efed61 100644 --- a/src/options.hpp +++ b/src/options.hpp @@ -37,7 +37,6 @@ #include "stddef.h" #include "stdint.hpp" #include "tcp_address.hpp" -#include "../include/zmq.h" #if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED #include diff --git a/src/pgm_receiver.cpp b/src/pgm_receiver.cpp index add18475..1c9cb22b 100644 --- a/src/pgm_receiver.cpp +++ b/src/pgm_receiver.cpp @@ -29,16 +29,11 @@ #include "precompiled.hpp" #include "macros.hpp" -#include "platform.hpp" #if defined ZMQ_HAVE_OPENPGM #include -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include "pgm_receiver.hpp" #include "session_base.hpp" #include "v1_decoder.hpp" diff --git a/src/pgm_receiver.hpp b/src/pgm_receiver.hpp index a603bf07..52251b15 100644 --- a/src/pgm_receiver.hpp +++ b/src/pgm_receiver.hpp @@ -30,14 +30,8 @@ #ifndef __ZMQ_PGM_RECEIVER_HPP_INCLUDED__ #define __ZMQ_PGM_RECEIVER_HPP_INCLUDED__ -#include "platform.hpp" - #if defined ZMQ_HAVE_OPENPGM -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include #include diff --git a/src/pgm_sender.cpp b/src/pgm_sender.cpp index 16aa3b25..5ee426f5 100644 --- a/src/pgm_sender.cpp +++ b/src/pgm_sender.cpp @@ -28,14 +28,9 @@ */ #include "precompiled.hpp" -#include "platform.hpp" #if defined ZMQ_HAVE_OPENPGM -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include #include "io_thread.hpp" diff --git a/src/pgm_sender.hpp b/src/pgm_sender.hpp index 1c56d6a4..de1c72e2 100644 --- a/src/pgm_sender.hpp +++ b/src/pgm_sender.hpp @@ -30,14 +30,8 @@ #ifndef __ZMQ_PGM_SENDER_HPP_INCLUDED__ #define __ZMQ_PGM_SENDER_HPP_INCLUDED__ -#include "platform.hpp" - #if defined ZMQ_HAVE_OPENPGM -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include "stdint.hpp" #include "io_object.hpp" #include "i_engine.hpp" diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp index d3a8adff..b064c14c 100644 --- a/src/pgm_socket.cpp +++ b/src/pgm_socket.cpp @@ -28,14 +28,9 @@ */ #include "precompiled.hpp" -#include "platform.hpp" #ifdef ZMQ_HAVE_OPENPGM -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #ifdef ZMQ_HAVE_LINUX #include #endif diff --git a/src/pgm_socket.hpp b/src/pgm_socket.hpp index 3f871859..494a96ae 100644 --- a/src/pgm_socket.hpp +++ b/src/pgm_socket.hpp @@ -30,12 +30,9 @@ #ifndef __PGM_SOCKET_HPP_INCLUDED__ #define __PGM_SOCKET_HPP_INCLUDED__ -#include "platform.hpp" - #if defined ZMQ_HAVE_OPENPGM #ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" #define __PGM_WININT_H__ #endif diff --git a/src/plain_client.cpp b/src/plain_client.cpp index 84a564a6..f1bfba7b 100644 --- a/src/plain_client.cpp +++ b/src/plain_client.cpp @@ -29,10 +29,6 @@ #include "precompiled.hpp" #include "macros.hpp" -#include "platform.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif #include diff --git a/src/plain_server.cpp b/src/plain_server.cpp index 4d659aa4..a7ca2d1d 100644 --- a/src/plain_server.cpp +++ b/src/plain_server.cpp @@ -28,10 +28,6 @@ */ #include "precompiled.hpp" -#include "platform.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif #include diff --git a/src/poller.hpp b/src/poller.hpp index f1838c98..84dd5200 100644 --- a/src/poller.hpp +++ b/src/poller.hpp @@ -30,8 +30,6 @@ #ifndef __ZMQ_POLLER_HPP_INCLUDED__ #define __ZMQ_POLLER_HPP_INCLUDED__ -#include "platform.hpp" - #if defined ZMQ_USE_KQUEUE + defined ZMQ_USE_EPOLL \ + defined ZMQ_USE_DEVPOLL + defined ZMQ_USE_POLL \ + defined ZMQ_USE_SELECT > 1 diff --git a/src/precompiled.hpp b/src/precompiled.hpp index e1b81a07..975bee19 100644 --- a/src/precompiled.hpp +++ b/src/precompiled.hpp @@ -30,9 +30,21 @@ #ifndef __ZMQ_PRECOMPILED_HPP_INCLUDED__ #define __ZMQ_PRECOMPILED_HPP_INCLUDED__ -#ifdef _MSC_VER +#include "platform.hpp" +// This must be included before any windows headers are compiled. +#if defined ZMQ_HAVE_WINDOWS #include "windows.hpp" +#endif + +// 0MQ definitions and exported functions +#include "../include/zmq.h" + +// 0MQ DRAFT definitions and exported functions +#include "zmq_draft.h" + +// TODO: expand pch implementation to non-windows builds. +#ifdef _MSC_VER // standard C headers #include @@ -104,88 +116,4 @@ #endif // _MSC_VER - -// 0MQ definitions and exported functions -#include "platform.hpp" -#include "../include/zmq.h" - -/******************************************************************************/ -/* These functions are DRAFT and disabled in stable releases, and subject to */ -/* change at ANY time until declared stable. */ -/******************************************************************************/ - -#ifndef ZMQ_BUILD_DRAFT_API - -/* DRAFT Socket types. */ -#define ZMQ_SERVER 12 -#define ZMQ_CLIENT 13 -#define ZMQ_RADIO 14 -#define ZMQ_DISH 15 -#define ZMQ_GATHER 16 -#define ZMQ_SCATTER 17 - -/* DRAFT Socket methods. */ -int zmq_join (void *s, const char *group); -int zmq_leave (void *s, const char *group); - -/* DRAFT Msg methods. */ -int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); -uint32_t zmq_msg_routing_id(zmq_msg_t *msg); -int zmq_msg_set_group(zmq_msg_t *msg, const char *group); -const char *zmq_msg_group(zmq_msg_t *msg); - -/******************************************************************************/ -/* Poller polling on sockets,fd and thread-safe sockets */ -/******************************************************************************/ - -#define ZMQ_HAVE_POLLER - -typedef struct zmq_poller_event_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - void *user_data; - short events; -} zmq_poller_event_t; - -void *zmq_poller_new (void); -int zmq_poller_destroy (void **poller_p); -int zmq_poller_add (void *poller, void *socket, void *user_data, short events); -int zmq_poller_modify (void *poller, void *socket, short events); -int zmq_poller_remove (void *poller, void *socket); -int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); - -#if defined _WIN32 -int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); -int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); -int zmq_poller_remove_fd (void *poller, SOCKET fd); -#else -int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -int zmq_poller_modify_fd (void *poller, int fd, short events); -int zmq_poller_remove_fd (void *poller, int fd); -#endif - -/******************************************************************************/ -/* Scheduling timers */ -/******************************************************************************/ - -#define ZMQ_HAVE_TIMERS - -typedef void (zmq_timer_fn)(int timer_id, void *arg); - -void *zmq_timers_new (void); -int zmq_timers_destroy (void **timers_p); -int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); -int zmq_timers_cancel (void *timers, int timer_id); -int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); -int zmq_timers_reset (void *timers, int timer_id); -long zmq_timers_timeout (void *timers); -int zmq_timers_execute (void *timers); - -#endif // ZMQ_BUILD_DRAFT_API - #endif //ifndef __ZMQ_PRECOMPILED_HPP_INCLUDED__ diff --git a/src/proxy.cpp b/src/proxy.cpp index 14567c30..df970c73 100644 --- a/src/proxy.cpp +++ b/src/proxy.cpp @@ -46,8 +46,9 @@ #include "socket_base.hpp" #include "err.hpp" +// TODO: determine if this is an issue, since zmq.h is being loaded from pch. // zmq.h must be included *after* poll.h for AIX to build properly -#include "../include/zmq.h" +//#include "../include/zmq.h" int capture( class zmq::socket_base_t *capture_, diff --git a/src/random.cpp b/src/random.cpp index 550a8c99..0180fd34 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -30,10 +30,7 @@ #include "precompiled.hpp" #include -#include "platform.hpp" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #endif diff --git a/src/raw_decoder.cpp b/src/raw_decoder.cpp index 6d93594d..b9a8d5c3 100644 --- a/src/raw_decoder.cpp +++ b/src/raw_decoder.cpp @@ -31,11 +31,6 @@ #include #include -#include "platform.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include "raw_decoder.hpp" #include "err.hpp" diff --git a/src/raw_encoder.hpp b/src/raw_encoder.hpp index 761b28aa..f55e131c 100644 --- a/src/raw_encoder.hpp +++ b/src/raw_encoder.hpp @@ -30,12 +30,6 @@ #ifndef __ZMQ_RAW_ENCODER_HPP_INCLUDED__ #define __ZMQ_RAW_ENCODER_HPP_INCLUDED__ -#if defined(_MSC_VER) -#ifndef NOMINMAX -#define NOMINMAX -#endif -#endif - #include #include #include diff --git a/src/select.cpp b/src/select.cpp index a234a6f1..fc35e2cf 100644 --- a/src/select.cpp +++ b/src/select.cpp @@ -31,10 +31,7 @@ #include "select.hpp" #if defined ZMQ_USE_SELECT -#include "platform.hpp" - #if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" #elif defined ZMQ_HAVE_HPUX #include #include diff --git a/src/select.hpp b/src/select.hpp index a49c6dc7..3d91a490 100644 --- a/src/select.hpp +++ b/src/select.hpp @@ -34,14 +34,11 @@ #include "poller.hpp" #if defined ZMQ_USE_SELECT -#include "platform.hpp" - #include #include #include #if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" #elif defined ZMQ_HAVE_OPENVMS #include #include diff --git a/src/signaler.cpp b/src/signaler.cpp index a1578db3..6c7f9e92 100644 --- a/src/signaler.cpp +++ b/src/signaler.cpp @@ -38,7 +38,6 @@ #include #elif defined ZMQ_POLL_BASED_ON_SELECT #if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" #elif defined ZMQ_HAVE_HPUX #include #include @@ -63,9 +62,7 @@ #include #endif -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #include #include diff --git a/src/socket_base.cpp b/src/socket_base.cpp index d3eeb4cb..73a40364 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -33,10 +33,8 @@ #include #include "macros.hpp" -#include "platform.hpp" #if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" #if defined _MSC_VER #if defined _WIN32_WCE #include @@ -60,7 +58,6 @@ #include "pipe.hpp" #include "err.hpp" #include "ctx.hpp" -#include "platform.hpp" #include "likely.hpp" #include "msg.hpp" #include "address.hpp" diff --git a/src/socks.cpp b/src/socks.cpp index 97b8535e..6a7cb2e7 100644 --- a/src/socks.cpp +++ b/src/socks.cpp @@ -31,7 +31,6 @@ #include #include "err.hpp" -#include "platform.hpp" #include "socks.hpp" #include "tcp.hpp" diff --git a/src/socks_connecter.cpp b/src/socks_connecter.cpp index 3db33218..f8ac57ca 100644 --- a/src/socks_connecter.cpp +++ b/src/socks_connecter.cpp @@ -34,7 +34,6 @@ #include "macros.hpp" #include "socks_connecter.hpp" #include "stream_engine.hpp" -#include "platform.hpp" #include "random.hpp" #include "err.hpp" #include "ip.hpp" @@ -44,9 +43,7 @@ #include "session_base.hpp" #include "socks.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#ifndef ZMQ_HAVE_WINDOWS #include #include #include diff --git a/src/socks_connecter.hpp b/src/socks_connecter.hpp index 8e139dda..e34a0254 100644 --- a/src/socks_connecter.hpp +++ b/src/socks_connecter.hpp @@ -34,7 +34,6 @@ #include "io_object.hpp" #include "own.hpp" #include "stdint.hpp" -#include "../include/zmq.h" #include "socks.hpp" namespace zmq diff --git a/src/stdint.hpp b/src/stdint.hpp index 3820b55a..2f9a47af 100644 --- a/src/stdint.hpp +++ b/src/stdint.hpp @@ -30,8 +30,6 @@ #ifndef __ZMQ_STDINT_HPP_INCLUDED__ #define __ZMQ_STDINT_HPP_INCLUDED__ -#include "platform.hpp" - #if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS #include diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index 5c074084..fa7b0322 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -29,7 +29,6 @@ #include "precompiled.hpp" #include "macros.hpp" -#include "platform.hpp" #include #include diff --git a/src/stream_engine.hpp b/src/stream_engine.hpp index cffb94d0..0fab265e 100644 --- a/src/stream_engine.hpp +++ b/src/stream_engine.hpp @@ -39,7 +39,6 @@ #include "i_decoder.hpp" #include "options.hpp" #include "socket_base.hpp" -#include "../include/zmq.h" #include "metadata.hpp" namespace zmq diff --git a/src/tcp.cpp b/src/tcp.cpp index 821b6175..15ccb1ff 100644 --- a/src/tcp.cpp +++ b/src/tcp.cpp @@ -32,11 +32,8 @@ #include "ip.hpp" #include "tcp.hpp" #include "err.hpp" -#include "platform.hpp" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #include #include diff --git a/src/tcp_address.hpp b/src/tcp_address.hpp index e99ddd9c..d9310add 100644 --- a/src/tcp_address.hpp +++ b/src/tcp_address.hpp @@ -30,11 +30,7 @@ #ifndef __ZMQ_TCP_ADDRESS_HPP_INCLUDED__ #define __ZMQ_TCP_ADDRESS_HPP_INCLUDED__ -#include "platform.hpp" - -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #include #endif diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp index 9ee3522b..95a778db 100644 --- a/src/tcp_connecter.cpp +++ b/src/tcp_connecter.cpp @@ -35,7 +35,6 @@ #include "tcp_connecter.hpp" #include "stream_engine.hpp" #include "io_thread.hpp" -#include "platform.hpp" #include "random.hpp" #include "err.hpp" #include "ip.hpp" @@ -44,9 +43,7 @@ #include "tcp_address.hpp" #include "session_base.hpp" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #include #include diff --git a/src/tcp_connecter.hpp b/src/tcp_connecter.hpp index 31630064..c4fe7d7c 100644 --- a/src/tcp_connecter.hpp +++ b/src/tcp_connecter.hpp @@ -34,7 +34,6 @@ #include "own.hpp" #include "stdint.hpp" #include "io_object.hpp" -#include "../include/zmq.h" namespace zmq { diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp index da45e817..f6629517 100644 --- a/src/tcp_listener.cpp +++ b/src/tcp_listener.cpp @@ -33,7 +33,6 @@ #include #include -#include "platform.hpp" #include "tcp_listener.hpp" #include "stream_engine.hpp" #include "io_thread.hpp" @@ -44,9 +43,7 @@ #include "tcp.hpp" #include "socket_base.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#ifndef ZMQ_HAVE_WINDOWS #include #include #include diff --git a/src/tcp_listener.hpp b/src/tcp_listener.hpp index 7896b14f..2b3ccff7 100644 --- a/src/tcp_listener.hpp +++ b/src/tcp_listener.hpp @@ -35,7 +35,6 @@ #include "stdint.hpp" #include "io_object.hpp" #include "tcp_address.hpp" -#include "../include/zmq.h" namespace zmq { diff --git a/src/thread.cpp b/src/thread.cpp index 58b0581a..2c044a49 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -31,7 +31,6 @@ #include "macros.hpp" #include "thread.hpp" #include "err.hpp" -#include "platform.hpp" #ifdef ZMQ_HAVE_WINDOWS diff --git a/src/thread.hpp b/src/thread.hpp index 1966589a..5ea0b6cb 100644 --- a/src/thread.hpp +++ b/src/thread.hpp @@ -30,11 +30,7 @@ #ifndef __ZMQ_THREAD_HPP_INCLUDED__ #define __ZMQ_THREAD_HPP_INCLUDED__ -#include "platform.hpp" - -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#ifndef ZMQ_HAVE_WINDOWS #include #endif diff --git a/src/trie.cpp b/src/trie.cpp index 87ed7b5e..4e646731 100644 --- a/src/trie.cpp +++ b/src/trie.cpp @@ -28,20 +28,15 @@ */ #include "precompiled.hpp" +#include "macros.hpp" +#include "err.hpp" +#include "trie.hpp" + #include #include #include -#include "macros.hpp" -#include "platform.hpp" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - -#include "err.hpp" -#include "trie.hpp" - zmq::trie_t::trie_t () : refcnt (0), min (0), diff --git a/src/tweetnacl.c b/src/tweetnacl.c index 1df51b08..666a864f 100644 --- a/src/tweetnacl.c +++ b/src/tweetnacl.c @@ -27,7 +27,11 @@ along with this program. If not, see . */ +/* + The precompiled header is not used for c files so this is required here. +*/ #include "platform.hpp" + #if defined (ZMQ_USE_TWEETNACL) /* diff --git a/src/tweetnacl.h b/src/tweetnacl.h index 4a292e01..a49264ba 100644 --- a/src/tweetnacl.h +++ b/src/tweetnacl.h @@ -30,8 +30,6 @@ #ifndef TWEETNACL_H #define TWEETNACL_H -#include "platform.hpp" - #if defined (ZMQ_USE_TWEETNACL) #define crypto_box_SECRETKEYBYTES 32 diff --git a/src/udp_address.cpp b/src/udp_address.cpp index 494c6752..ced27882 100644 --- a/src/udp_address.cpp +++ b/src/udp_address.cpp @@ -33,14 +33,11 @@ #include "macros.hpp" #include "udp_address.hpp" -#include "platform.hpp" #include "stdint.hpp" #include "err.hpp" #include "ip.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#ifndef ZMQ_HAVE_WINDOWS #include #include #include diff --git a/src/udp_address.hpp b/src/udp_address.hpp index 7dcc7065..5b243878 100644 --- a/src/udp_address.hpp +++ b/src/udp_address.hpp @@ -30,11 +30,7 @@ #ifndef __ZMQ_UDP_ADDRESS_HPP_INCLUDED__ #define __ZMQ_UDP_ADDRESS_HPP_INCLUDED__ -#include "platform.hpp" - -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #include #endif diff --git a/src/udp_engine.cpp b/src/udp_engine.cpp index f4d8cf34..169f6a84 100644 --- a/src/udp_engine.cpp +++ b/src/udp_engine.cpp @@ -28,11 +28,8 @@ along with this program. If not, see . */ #include "precompiled.hpp" -#include "platform.hpp" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #include #include diff --git a/src/v1_decoder.cpp b/src/v1_decoder.cpp index 4c4b964a..7744d6ea 100644 --- a/src/v1_decoder.cpp +++ b/src/v1_decoder.cpp @@ -32,11 +32,6 @@ #include #include -#include "platform.hpp" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include "decoder.hpp" #include "v1_decoder.hpp" #include "likely.hpp" diff --git a/src/v2_decoder.cpp b/src/v2_decoder.cpp index bd7e7cc0..0754541f 100644 --- a/src/v2_decoder.cpp +++ b/src/v2_decoder.cpp @@ -32,19 +32,12 @@ #include #include -#include "platform.hpp" -#ifdef ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#endif - #include "v2_protocol.hpp" #include "v2_decoder.hpp" #include "likely.hpp" #include "wire.hpp" #include "err.hpp" - - zmq::v2_decoder_t::v2_decoder_t (size_t bufsize_, int64_t maxmsgsize_) : shared_message_memory_allocator( bufsize_), decoder_base_t (this), diff --git a/src/ypipe.hpp b/src/ypipe.hpp index c6a28f40..53218516 100644 --- a/src/ypipe.hpp +++ b/src/ypipe.hpp @@ -32,7 +32,6 @@ #include "atomic_ptr.hpp" #include "yqueue.hpp" -#include "platform.hpp" #include "ypipe_base.hpp" namespace zmq diff --git a/src/zmq.cpp b/src/zmq.cpp index 1168202b..4d383c58 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -40,16 +40,14 @@ #include #endif +// TODO: determine if this is an issue, since zmq.h is being loaded from pch. // zmq.h must be included *after* poll.h for AIX to build properly -#include "../include/zmq.h" +//#include "../include/zmq.h" -#if defined ZMQ_HAVE_WINDOWS -#include "windows.hpp" -#else +#if !defined ZMQ_HAVE_WINDOWS #include #endif - // XSI vector I/O #if defined ZMQ_HAVE_UIO #include @@ -60,7 +58,6 @@ struct iovec { }; #endif - #include #include #include diff --git a/src/zmq_draft.h b/src/zmq_draft.h new file mode 100644 index 00000000..87a43b93 --- /dev/null +++ b/src/zmq_draft.h @@ -0,0 +1,112 @@ +/* + Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file + + This file is part of libzmq, the ZeroMQ core engine in C++. + + libzmq is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + As a special exception, the Contributors give you permission to link + this library with independent modules to produce an executable, + regardless of the license terms of these independent modules, and to + copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the + terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. + If you modify this library, you must extend this exception to your + version of the library. + + libzmq is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef __ZMQ_DRAFT_H_INCLUDED__ +#define __ZMQ_DRAFT_H_INCLUDED__ + +/******************************************************************************/ +/* These functions are DRAFT and disabled in stable releases, and subject to */ +/* change at ANY time until declared stable. */ +/******************************************************************************/ + +#ifndef ZMQ_BUILD_DRAFT_API + +/* DRAFT Socket types. */ +#define ZMQ_SERVER 12 +#define ZMQ_CLIENT 13 +#define ZMQ_RADIO 14 +#define ZMQ_DISH 15 +#define ZMQ_GATHER 16 +#define ZMQ_SCATTER 17 + +/* DRAFT Socket methods. */ +int zmq_join (void *s, const char *group); +int zmq_leave (void *s, const char *group); + +/* DRAFT Msg methods. */ +int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); +uint32_t zmq_msg_routing_id(zmq_msg_t *msg); +int zmq_msg_set_group(zmq_msg_t *msg, const char *group); +const char *zmq_msg_group(zmq_msg_t *msg); + +/******************************************************************************/ +/* Poller polling on sockets,fd and thread-safe sockets */ +/******************************************************************************/ + +#define ZMQ_HAVE_POLLER + +typedef struct zmq_poller_event_t +{ + void *socket; +#if defined _WIN32 + SOCKET fd; +#else + int fd; +#endif + void *user_data; + short events; +} zmq_poller_event_t; + +void *zmq_poller_new (void); +int zmq_poller_destroy (void **poller_p); +int zmq_poller_add (void *poller, void *socket, void *user_data, short events); +int zmq_poller_modify (void *poller, void *socket, short events); +int zmq_poller_remove (void *poller, void *socket); +int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); + +#if defined _WIN32 +int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); +int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); +int zmq_poller_remove_fd (void *poller, SOCKET fd); +#else +int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); +int zmq_poller_modify_fd (void *poller, int fd, short events); +int zmq_poller_remove_fd (void *poller, int fd); +#endif + +/******************************************************************************/ +/* Scheduling timers */ +/******************************************************************************/ + +#define ZMQ_HAVE_TIMERS + +typedef void (zmq_timer_fn)(int timer_id, void *arg); + +void *zmq_timers_new (void); +int zmq_timers_destroy (void **timers_p); +int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); +int zmq_timers_cancel (void *timers, int timer_id); +int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); +int zmq_timers_reset (void *timers, int timer_id); +long zmq_timers_timeout (void *timers); +int zmq_timers_execute (void *timers); + +#endif // ZMQ_BUILD_DRAFT_API + +#endif //ifndef __ZMQ_DRAFT_H_INCLUDED__ diff --git a/src/zmq_utils.cpp b/src/zmq_utils.cpp index d4c51280..12fda15c 100644 --- a/src/zmq_utils.cpp +++ b/src/zmq_utils.cpp @@ -29,7 +29,6 @@ #include "precompiled.hpp" #include "macros.hpp" -#include "platform.hpp" #include "clock.hpp" #include "err.hpp" @@ -39,15 +38,13 @@ #include #if !defined ZMQ_HAVE_WINDOWS -# include -#else -# include "windows.hpp" +#include #endif #if defined (ZMQ_USE_TWEETNACL) -# include "tweetnacl.h" +#include "tweetnacl.h" #elif defined (ZMQ_USE_LIBSODIUM) -# include "sodium.h" +#include "sodium.h" #endif void zmq_sleep (int seconds_)