From 03cfbde5fbb49ba3589fe37972e8cab5f107dd4a Mon Sep 17 00:00:00 2001 From: SpencerA Date: Sun, 7 Jan 2018 11:04:21 -0800 Subject: [PATCH 1/2] remove headers in this branch --- cran-comments.md | 18 +- inst/include/zmq.h | 643 ------------------------ inst/include/zmq.hpp | 991 ------------------------------------- inst/include/zmq_addon.hpp | 591 ---------------------- inst/include/zmq_utils.h | 48 -- 5 files changed, 7 insertions(+), 2284 deletions(-) delete mode 100644 inst/include/zmq.h delete mode 100644 inst/include/zmq.hpp delete mode 100644 inst/include/zmq_addon.hpp delete mode 100644 inst/include/zmq_utils.h diff --git a/cran-comments.md b/cran-comments.md index 4e3d597..b1ad5ee 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,14 +1,8 @@ -## JuniperKernel 1.2.0.0 Submission -In this version we have: - * Added a NEWS.md - * Removed - * Added an additional set of tests (included with the package in inst/runits) - * Updated the COPYRIGHTS file and DESCRIPTION file to credit the xeus, xtl, and json - dependency authors. - * Removed the static zeromq sources 'inst/pbdZMQ-0.2-6.zip' and 'inst/zeromq-4.2.2.tar.gz' - * Created a dependency on the 'pbdZMQ' package for ZeroMQ headers and dynamic libraries. - * No longer compiling with flag -fPIC. - * Made the configure script more portable +## JuniperKernel 1.2.1.0 Submission + +This submission patches version 1.2.0.0 with: + * includes missing headers from Unix environments + * removes the dependency on subprocess so that builds succeed on Solaris ## Test environments * local OS X install, R 3.4.3 @@ -16,6 +10,8 @@ In this version we have: * ubuntu 14.04.5 LTS (on travis-ci), R 3.4.3 * Windows Server 2012 R2 x64 (build 9600) (on Appveyor), R 3.4.3 * win-builder (release, devel, oldrelease) +* Oracle Solaris 10, x86, 32 bit, R-patched +* Debian Linux, R-devel, GCC ## R CMD check results There were no ERRORs or WARNINGs. diff --git a/inst/include/zmq.h b/inst/include/zmq.h deleted file mode 100644 index 21a78eb..0000000 --- a/inst/include/zmq.h +++ /dev/null @@ -1,643 +0,0 @@ -/* - 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 . - - ************************************************************************* - NOTE to contributors. This file comprises the principal public contract - for ZeroMQ API users. Any change to this file supplied in a stable - release SHOULD not break existing applications. - In practice this means that the value of constants must not change, and - that old values may not be reused for new constants. - ************************************************************************* -*/ - -#ifndef __ZMQ_H_INCLUDED__ -#define __ZMQ_H_INCLUDED__ - -/* Version macros for compile-time API version detection */ -#define ZMQ_VERSION_MAJOR 4 -#define ZMQ_VERSION_MINOR 2 -#define ZMQ_VERSION_PATCH 2 - -#define ZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define ZMQ_VERSION \ - ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined _WIN32_WCE -#include -#endif -#include -#include -#if defined _WIN32 -// Set target version to Windows Server 2008, Windows Vista or higher. -// Windows XP (0x0501) is supported but without client & server socket types. -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - -#ifdef __MINGW32__ -// Require Windows XP or higher with MinGW for getaddrinfo(). -#if(_WIN32_WINNT >= 0x0600) -#else -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif -#endif -#include -#endif - -/* Handle DSO symbol visibility */ -#if defined _WIN32 -# if defined ZMQ_STATIC -# define ZMQ_EXPORT -# elif defined DLL_EXPORT -# define ZMQ_EXPORT __declspec(dllexport) -# else -# define ZMQ_EXPORT __declspec(dllimport) -# endif -#else -# if defined __SUNPRO_C || defined __SUNPRO_CC -# define ZMQ_EXPORT __global -# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define ZMQ_EXPORT __attribute__ ((visibility("default"))) -# else -# define ZMQ_EXPORT -# endif -#endif - -/* Define integer types needed for event interface */ -#define ZMQ_DEFINED_STDINT 1 -#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS -# include -#elif defined _MSC_VER && _MSC_VER < 1600 -# ifndef int32_t - typedef __int32 int32_t; -# endif -# ifndef uint16_t - typedef unsigned __int16 uint16_t; -# endif -# ifndef uint8_t - typedef unsigned __int8 uint8_t; -# endif -#else -# include -#endif - -// 32-bit AIX's pollfd struct members are called reqevents and rtnevents so it -// defines compatibility macros for them. Need to include that header first to -// stop build failures since zmq_pollset_t defines them as events and revents. -#ifdef ZMQ_HAVE_AIX - #include -#endif - - -/******************************************************************************/ -/* 0MQ errors. */ -/******************************************************************************/ - -/* A number random enough not to collide with different errno ranges on */ -/* different OSes. The assumption is that error_t is at least 32-bit type. */ -#define ZMQ_HAUSNUMERO 156384712 - -/* On Windows platform some of the standard POSIX errnos are not defined. */ -#ifndef ENOTSUP -#define ENOTSUP (ZMQ_HAUSNUMERO + 1) -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) -#endif -#ifndef ENOBUFS -#define ENOBUFS (ZMQ_HAUSNUMERO + 3) -#endif -#ifndef ENETDOWN -#define ENETDOWN (ZMQ_HAUSNUMERO + 4) -#endif -#ifndef EADDRINUSE -#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) -#endif -#ifndef EINPROGRESS -#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) -#endif -#ifndef ENOTSOCK -#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) -#endif -#ifndef EMSGSIZE -#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) -#endif -#ifndef ENETUNREACH -#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) -#endif -#ifndef ECONNABORTED -#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) -#endif -#ifndef ECONNRESET -#define ECONNRESET (ZMQ_HAUSNUMERO + 14) -#endif -#ifndef ENOTCONN -#define ENOTCONN (ZMQ_HAUSNUMERO + 15) -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) -#endif -#ifndef ENETRESET -#define ENETRESET (ZMQ_HAUSNUMERO + 18) -#endif - -/* Native 0MQ error codes. */ -#define EFSM (ZMQ_HAUSNUMERO + 51) -#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) -#define ETERM (ZMQ_HAUSNUMERO + 53) -#define EMTHREAD (ZMQ_HAUSNUMERO + 54) - -/* This function retrieves the errno as it is known to 0MQ library. The goal */ -/* of this function is to make the code 100% portable, including where 0MQ */ -/* compiled with certain CRT library (on Windows) is linked to an */ -/* application that uses different CRT library. */ -ZMQ_EXPORT int zmq_errno (void); - -/* Resolves system errors and 0MQ errors to human-readable string. */ -ZMQ_EXPORT const char *zmq_strerror (int errnum); - -/* Run-time API version detection */ -ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); - -/******************************************************************************/ -/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ -/******************************************************************************/ - -/* Context options */ -#define ZMQ_IO_THREADS 1 -#define ZMQ_MAX_SOCKETS 2 -#define ZMQ_SOCKET_LIMIT 3 -#define ZMQ_THREAD_PRIORITY 3 -#define ZMQ_THREAD_SCHED_POLICY 4 -#define ZMQ_MAX_MSGSZ 5 - -/* Default for new contexts */ -#define ZMQ_IO_THREADS_DFLT 1 -#define ZMQ_MAX_SOCKETS_DFLT 1023 -#define ZMQ_THREAD_PRIORITY_DFLT -1 -#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 - -ZMQ_EXPORT void *zmq_ctx_new (void); -ZMQ_EXPORT int zmq_ctx_term (void *context); -ZMQ_EXPORT int zmq_ctx_shutdown (void *context); -ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); -ZMQ_EXPORT int zmq_ctx_get (void *context, int option); - -/* Old (legacy) API */ -ZMQ_EXPORT void *zmq_init (int io_threads); -ZMQ_EXPORT int zmq_term (void *context); -ZMQ_EXPORT int zmq_ctx_destroy (void *context); - - -/******************************************************************************/ -/* 0MQ message definition. */ -/******************************************************************************/ - -/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer - * alignment and raise sigbus on violations. Make sure applications allocate - * zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue. - */ -typedef struct zmq_msg_t { -#if defined (__GNUC__) || defined ( __INTEL_COMPILER) || \ - (defined (__SUNPRO_C) && __SUNPRO_C >= 0x590) || \ - (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x590) - unsigned char _ [64] __attribute__ ((aligned (sizeof (void *)))); -#elif defined (_MSC_VER) && (defined (_M_X64) || defined (_M_ARM64)) - __declspec (align (8)) unsigned char _ [64]; -#elif defined (_MSC_VER) && (defined (_M_IX86) || defined (_M_ARM_ARMV7VE)) - __declspec (align (4)) unsigned char _ [64]; -#else - unsigned char _ [64]; -#endif -} zmq_msg_t; - -typedef void (zmq_free_fn) (void *data, void *hint); - -ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); -ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, - size_t size, zmq_free_fn *ffn, void *hint); -ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); -ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); -ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); -ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); - -/******************************************************************************/ -/* 0MQ socket definition. */ -/******************************************************************************/ - -/* Socket types. */ -#define ZMQ_PAIR 0 -#define ZMQ_PUB 1 -#define ZMQ_SUB 2 -#define ZMQ_REQ 3 -#define ZMQ_REP 4 -#define ZMQ_DEALER 5 -#define ZMQ_ROUTER 6 -#define ZMQ_PULL 7 -#define ZMQ_PUSH 8 -#define ZMQ_XPUB 9 -#define ZMQ_XSUB 10 -#define ZMQ_STREAM 11 - -/* Deprecated aliases */ -#define ZMQ_XREQ ZMQ_DEALER -#define ZMQ_XREP ZMQ_ROUTER - -/* Socket options. */ -#define ZMQ_AFFINITY 4 -#define ZMQ_IDENTITY 5 -#define ZMQ_SUBSCRIBE 6 -#define ZMQ_UNSUBSCRIBE 7 -#define ZMQ_RATE 8 -#define ZMQ_RECOVERY_IVL 9 -#define ZMQ_SNDBUF 11 -#define ZMQ_RCVBUF 12 -#define ZMQ_RCVMORE 13 -#define ZMQ_FD 14 -#define ZMQ_EVENTS 15 -#define ZMQ_TYPE 16 -#define ZMQ_LINGER 17 -#define ZMQ_RECONNECT_IVL 18 -#define ZMQ_BACKLOG 19 -#define ZMQ_RECONNECT_IVL_MAX 21 -#define ZMQ_MAXMSGSIZE 22 -#define ZMQ_SNDHWM 23 -#define ZMQ_RCVHWM 24 -#define ZMQ_MULTICAST_HOPS 25 -#define ZMQ_RCVTIMEO 27 -#define ZMQ_SNDTIMEO 28 -#define ZMQ_LAST_ENDPOINT 32 -#define ZMQ_ROUTER_MANDATORY 33 -#define ZMQ_TCP_KEEPALIVE 34 -#define ZMQ_TCP_KEEPALIVE_CNT 35 -#define ZMQ_TCP_KEEPALIVE_IDLE 36 -#define ZMQ_TCP_KEEPALIVE_INTVL 37 -#define ZMQ_IMMEDIATE 39 -#define ZMQ_XPUB_VERBOSE 40 -#define ZMQ_ROUTER_RAW 41 -#define ZMQ_IPV6 42 -#define ZMQ_MECHANISM 43 -#define ZMQ_PLAIN_SERVER 44 -#define ZMQ_PLAIN_USERNAME 45 -#define ZMQ_PLAIN_PASSWORD 46 -#define ZMQ_CURVE_SERVER 47 -#define ZMQ_CURVE_PUBLICKEY 48 -#define ZMQ_CURVE_SECRETKEY 49 -#define ZMQ_CURVE_SERVERKEY 50 -#define ZMQ_PROBE_ROUTER 51 -#define ZMQ_REQ_CORRELATE 52 -#define ZMQ_REQ_RELAXED 53 -#define ZMQ_CONFLATE 54 -#define ZMQ_ZAP_DOMAIN 55 -#define ZMQ_ROUTER_HANDOVER 56 -#define ZMQ_TOS 57 -#define ZMQ_CONNECT_RID 61 -#define ZMQ_GSSAPI_SERVER 62 -#define ZMQ_GSSAPI_PRINCIPAL 63 -#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 -#define ZMQ_GSSAPI_PLAINTEXT 65 -#define ZMQ_HANDSHAKE_IVL 66 -#define ZMQ_SOCKS_PROXY 68 -#define ZMQ_XPUB_NODROP 69 -#define ZMQ_BLOCKY 70 -#define ZMQ_XPUB_MANUAL 71 -#define ZMQ_XPUB_WELCOME_MSG 72 -#define ZMQ_STREAM_NOTIFY 73 -#define ZMQ_INVERT_MATCHING 74 -#define ZMQ_HEARTBEAT_IVL 75 -#define ZMQ_HEARTBEAT_TTL 76 -#define ZMQ_HEARTBEAT_TIMEOUT 77 -#define ZMQ_XPUB_VERBOSER 78 -#define ZMQ_CONNECT_TIMEOUT 79 -#define ZMQ_TCP_MAXRT 80 -#define ZMQ_THREAD_SAFE 81 -#define ZMQ_MULTICAST_MAXTPDU 84 -#define ZMQ_VMCI_BUFFER_SIZE 85 -#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 -#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 -#define ZMQ_VMCI_CONNECT_TIMEOUT 88 -#define ZMQ_USE_FD 89 - -/* Message options */ -#define ZMQ_MORE 1 -#define ZMQ_SHARED 3 - -/* Send/recv options. */ -#define ZMQ_DONTWAIT 1 -#define ZMQ_SNDMORE 2 - -/* Security mechanisms */ -#define ZMQ_NULL 0 -#define ZMQ_PLAIN 1 -#define ZMQ_CURVE 2 -#define ZMQ_GSSAPI 3 - -/* RADIO-DISH protocol */ -#define ZMQ_GROUP_MAX_LENGTH 15 - -/* Deprecated options and aliases */ -#define ZMQ_TCP_ACCEPT_FILTER 38 -#define ZMQ_IPC_FILTER_PID 58 -#define ZMQ_IPC_FILTER_UID 59 -#define ZMQ_IPC_FILTER_GID 60 -#define ZMQ_IPV4ONLY 31 -#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE -#define ZMQ_NOBLOCK ZMQ_DONTWAIT -#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY -#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY - -/* Deprecated Message options */ -#define ZMQ_SRCFD 2 - -/******************************************************************************/ -/* 0MQ socket events and monitoring */ -/******************************************************************************/ - -/* Socket transport events (TCP, IPC and TIPC only) */ - -#define ZMQ_EVENT_CONNECTED 0x0001 -#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 -#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 -#define ZMQ_EVENT_LISTENING 0x0008 -#define ZMQ_EVENT_BIND_FAILED 0x0010 -#define ZMQ_EVENT_ACCEPTED 0x0020 -#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 -#define ZMQ_EVENT_CLOSED 0x0080 -#define ZMQ_EVENT_CLOSE_FAILED 0x0100 -#define ZMQ_EVENT_DISCONNECTED 0x0200 -#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 -#define ZMQ_EVENT_ALL 0xFFFF - -ZMQ_EXPORT void *zmq_socket (void *, int type); -ZMQ_EXPORT int zmq_close (void *s); -ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, - size_t optvallen); -ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, - size_t *optvallen); -ZMQ_EXPORT int zmq_bind (void *s, const char *addr); -ZMQ_EXPORT int zmq_connect (void *s, const char *addr); -ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); -ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); -ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); - - -/******************************************************************************/ -/* I/O multiplexing. */ -/******************************************************************************/ - -#define ZMQ_POLLIN 1 -#define ZMQ_POLLOUT 2 -#define ZMQ_POLLERR 4 -#define ZMQ_POLLPRI 8 - -typedef struct zmq_pollitem_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - short events; - short revents; -} zmq_pollitem_t; - -#define ZMQ_POLLITEMS_DFLT 16 - -ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); - -/******************************************************************************/ -/* Message proxying */ -/******************************************************************************/ - -ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); -ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); - -/******************************************************************************/ -/* Probe library capabilities */ -/******************************************************************************/ - -#define ZMQ_HAS_CAPABILITIES 1 -ZMQ_EXPORT int zmq_has (const char *capability); - -/* Deprecated aliases */ -#define ZMQ_STREAMER 1 -#define ZMQ_FORWARDER 2 -#define ZMQ_QUEUE 3 - -/* Deprecated methods */ -ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); -ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); -ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); -struct iovec; -ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); -ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); - -/******************************************************************************/ -/* Encryption functions */ -/******************************************************************************/ - -/* Encode data with Z85 encoding. Returns encoded data */ -ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); - -/* Decode data with Z85 encoding. Returns decoded data */ -ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); - -/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); - -/* Derive the z85-encoded public key from the z85-encoded secret key. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); - -/******************************************************************************/ -/* Atomic utility methods */ -/******************************************************************************/ - -ZMQ_EXPORT void *zmq_atomic_counter_new (void); -ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); -ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); -ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); - - -/******************************************************************************/ -/* These functions are not documented by man pages -- use at your own risk. */ -/* If you need these to be part of the formal ZMQ API, then (a) write a man */ -/* page, and (b) write a test case in tests. */ -/******************************************************************************/ - -/* Helper functions are used by perf tests so that they don't have to care */ -/* about minutiae of time-related functions on different OS platforms. */ - -/* Starts the stopwatch. Returns the handle to the watch. */ -ZMQ_EXPORT void *zmq_stopwatch_start (void); - -/* Stops the stopwatch. Returns the number of microseconds elapsed since */ -/* the stopwatch was started. */ -ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); - -/* Sleeps for specified number of seconds. */ -ZMQ_EXPORT void zmq_sleep (int seconds_); - -typedef void (zmq_thread_fn) (void*); - -/* Start a thread. Returns a handle to the thread. */ -ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); - -/* Wait for thread to complete then free up resources. */ -ZMQ_EXPORT void zmq_threadclose (void* thread); - - -/******************************************************************************/ -/* These functions are DRAFT and disabled in stable releases, and subject to */ -/* change at ANY time until declared stable. */ -/******************************************************************************/ - -#ifdef 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 -#define ZMQ_DGRAM 18 - -/* DRAFT 0MQ socket events and monitoring */ -#define ZMQ_EVENT_HANDSHAKE_FAILED 0x0800 -#define ZMQ_EVENT_HANDSHAKE_SUCCEED 0x1000 - -/* DRAFT Context options */ -#define ZMQ_MSG_T_SIZE 6 - -/* DRAFT Socket methods. */ -ZMQ_EXPORT int zmq_join (void *s, const char *group); -ZMQ_EXPORT int zmq_leave (void *s, const char *group); - -/* DRAFT Msg methods. */ -ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); -ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); -ZMQ_EXPORT 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; - -ZMQ_EXPORT void *zmq_poller_new (void); -ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); -ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); -ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); -ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); -ZMQ_EXPORT int zmq_poller_wait_all (void *poller, zmq_poller_event_t *events, int n_events, long timeout); - -#if defined _WIN32 -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); -#else -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); -ZMQ_EXPORT 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); - -ZMQ_EXPORT void *zmq_timers_new (void); -ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); -ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); -ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); -ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); -ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); -ZMQ_EXPORT long zmq_timers_timeout (void *timers); -ZMQ_EXPORT int zmq_timers_execute (void *timers); - -#endif // ZMQ_BUILD_DRAFT_API - - -#undef ZMQ_EXPORT - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/inst/include/zmq.hpp b/inst/include/zmq.hpp deleted file mode 100644 index 12b9581..0000000 --- a/inst/include/zmq.hpp +++ /dev/null @@ -1,991 +0,0 @@ -/* - Copyright (c) 2016-2017 ZeroMQ community - Copyright (c) 2009-2011 250bpm s.r.o. - Copyright (c) 2011 Botond Ballo - Copyright (c) 2007-2009 iMatix Corporation - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. -*/ - -#ifndef __ZMQ_HPP_INCLUDED__ -#define __ZMQ_HPP_INCLUDED__ - -#if (__cplusplus >= 201103L) - #define ZMQ_CPP11 - #define ZMQ_NOTHROW noexcept - #define ZMQ_EXPLICIT explicit -#elif (defined(_MSC_VER) && (_MSC_VER >= 1900)) - #define ZMQ_CPP11 - #define ZMQ_NOTHROW noexcept - #define ZMQ_EXPLICIT explicit -#else - #define ZMQ_CPP03 - #define ZMQ_NOTHROW - #define ZMQ_EXPLICIT -#endif - -#include - -#include -#include -#include -#include -#include -#include -#include - -#ifdef ZMQ_CPP11 -#include -#include -#include -#endif - -// Detect whether the compiler supports C++11 rvalue references. -#if (defined(__GNUC__) && (__GNUC__ > 4 || \ - (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && \ - defined(__GXX_EXPERIMENTAL_CXX0X__)) - #define ZMQ_HAS_RVALUE_REFS - #define ZMQ_DELETED_FUNCTION = delete -#elif defined(__clang__) - #if __has_feature(cxx_rvalue_references) - #define ZMQ_HAS_RVALUE_REFS - #endif - - #if __has_feature(cxx_deleted_functions) - #define ZMQ_DELETED_FUNCTION = delete - #else - #define ZMQ_DELETED_FUNCTION - #endif -#elif defined(_MSC_VER) && (_MSC_VER >= 1900) - #define ZMQ_HAS_RVALUE_REFS - #define ZMQ_DELETED_FUNCTION = delete -#elif defined(_MSC_VER) && (_MSC_VER >= 1600) - #define ZMQ_HAS_RVALUE_REFS - #define ZMQ_DELETED_FUNCTION -#else - #define ZMQ_DELETED_FUNCTION -#endif - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 3, 0) -#define ZMQ_NEW_MONITOR_EVENT_LAYOUT -#endif - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) -#define ZMQ_HAS_PROXY_STEERABLE -/* Socket event data */ -typedef struct { - uint16_t event; // id of the event as bitfield - int32_t value ; // value is either error code, fd or reconnect interval -} zmq_event_t; -#endif - -// Avoid using deprecated message receive function when possible -#if ZMQ_VERSION < ZMQ_MAKE_VERSION(3, 2, 0) -# define zmq_msg_recv(msg, socket, flags) zmq_recvmsg(socket, msg, flags) -#endif - - -// In order to prevent unused variable warnings when building in non-debug -// mode use this macro to make assertions. -#ifndef NDEBUG -# define ZMQ_ASSERT(expression) assert(expression) -#else -# define ZMQ_ASSERT(expression) (void)(expression) -#endif - -namespace zmq -{ - - typedef zmq_free_fn free_fn; - typedef zmq_pollitem_t pollitem_t; - - class error_t : public std::exception - { - public: - - error_t () : errnum (zmq_errno ()) {} -#ifdef ZMQ_CPP11 - virtual const char *what () const noexcept - { - return zmq_strerror (errnum); - } -#else - virtual const char *what() const throw () - { - return zmq_strerror(errnum); - } -#endif - int num () const - { - return errnum; - } - - private: - - int errnum; - }; - - inline int poll (zmq_pollitem_t const* items_, size_t nitems_, long timeout_ = -1) - { - int rc = zmq_poll (const_cast(items_), static_cast(nitems_), timeout_); - if (rc < 0) - throw error_t (); - return rc; - } - - #ifdef ZMQ_CPP11 - inline int poll(zmq_pollitem_t const* items, size_t nitems, std::chrono::milliseconds timeout) - { - return poll(items, nitems, static_cast(timeout.count())); - } - - inline int poll(std::vector const& items, std::chrono::milliseconds timeout) - { - return poll(items.data(), items.size(), static_cast(timeout.count())); - } - - inline int poll(std::vector const& items, long timeout_ = -1) - { - return poll(items.data(), items.size(), timeout_); - } - #endif - - - - inline void proxy (void *frontend, void *backend, void *capture) - { - int rc = zmq_proxy (frontend, backend, capture); - if (rc != 0) - throw error_t (); - } - -#ifdef ZMQ_HAS_PROXY_STEERABLE - inline void proxy_steerable (void *frontend, void *backend, void *capture, void *control) - { - int rc = zmq_proxy_steerable (frontend, backend, capture, control); - if (rc != 0) - throw error_t (); - } -#endif - - inline void version (int *major_, int *minor_, int *patch_) - { - zmq_version (major_, minor_, patch_); - } - - #ifdef ZMQ_CPP11 - inline std::tuple version() - { - std::tuple v; - zmq_version(&std::get<0>(v), &std::get<1>(v), &std::get<2>(v) ); - return v; - } - #endif - - class message_t - { - friend class socket_t; - - public: - - inline message_t () - { - int rc = zmq_msg_init (&msg); - if (rc != 0) - throw error_t (); - } - - inline explicit message_t (size_t size_) - { - int rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - } - - template message_t(I first, I last): - msg() - { - typedef typename std::iterator_traits::difference_type size_type; - typedef typename std::iterator_traits::value_type value_t; - - size_type const size_ = std::distance(first, last)*sizeof(value_t); - int const rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - value_t* dest = data(); - while (first != last) - { - *dest = *first; - ++dest; ++first; - } - } - - inline message_t (const void *data_, size_t size_) - { - int rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - memcpy(data(), data_, size_); - } - - inline message_t (void *data_, size_t size_, free_fn *ffn_, - void *hint_ = NULL) - { - int rc = zmq_msg_init_data (&msg, data_, size_, ffn_, hint_); - if (rc != 0) - throw error_t (); - } - -#ifdef ZMQ_HAS_RVALUE_REFS - inline message_t (message_t &&rhs): msg (rhs.msg) - { - int rc = zmq_msg_init (&rhs.msg); - if (rc != 0) - throw error_t (); - } - - inline message_t &operator = (message_t &&rhs) ZMQ_NOTHROW - { - std::swap (msg, rhs.msg); - return *this; - } -#endif - - inline ~message_t () ZMQ_NOTHROW - { - int rc = zmq_msg_close (&msg); - ZMQ_ASSERT (rc == 0); - } - - inline void rebuild () - { - int rc = zmq_msg_close (&msg); - if (rc != 0) - throw error_t (); - rc = zmq_msg_init (&msg); - if (rc != 0) - throw error_t (); - } - - inline void rebuild (size_t size_) - { - int rc = zmq_msg_close (&msg); - if (rc != 0) - throw error_t (); - rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - } - - inline void rebuild (const void *data_, size_t size_) - { - int rc = zmq_msg_close (&msg); - if (rc != 0) - throw error_t (); - rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - memcpy(data(), data_, size_); - } - - inline void rebuild (void *data_, size_t size_, free_fn *ffn_, - void *hint_ = NULL) - { - int rc = zmq_msg_close (&msg); - if (rc != 0) - throw error_t (); - rc = zmq_msg_init_data (&msg, data_, size_, ffn_, hint_); - if (rc != 0) - throw error_t (); - } - - inline void move (message_t const *msg_) - { - int rc = zmq_msg_move (&msg, const_cast(&(msg_->msg))); - if (rc != 0) - throw error_t (); - } - - inline void copy (message_t const *msg_) - { - int rc = zmq_msg_copy (&msg, const_cast(&(msg_->msg))); - if (rc != 0) - throw error_t (); - } - - inline bool more () const ZMQ_NOTHROW - { - int rc = zmq_msg_more (const_cast(&msg) ); - return rc != 0; - } - - inline void *data () ZMQ_NOTHROW - { - return zmq_msg_data (&msg); - } - - inline const void* data () const ZMQ_NOTHROW - { - return zmq_msg_data (const_cast(&msg)); - } - - inline size_t size () const ZMQ_NOTHROW - { - return zmq_msg_size (const_cast(&msg)); - } - - template T* data() ZMQ_NOTHROW - { - return static_cast( data() ); - } - - template T const* data() const ZMQ_NOTHROW - { - return static_cast( data() ); - } - - inline bool equal(const message_t* other) const ZMQ_NOTHROW - { - if (size() != other->size()) - return false; - std::string a(data(), size()); - std::string b(other->data(), other->size()); - return a == b; - } - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) - inline const char* gets(const char *property_) - { - const char* value = zmq_msg_gets (&msg, property_); - if (value == NULL) - throw error_t (); - return value; - } -#endif - - private: - // The underlying message - zmq_msg_t msg; - - // Disable implicit message copying, so that users won't use shared - // messages (less efficient) without being aware of the fact. - message_t (const message_t&) ZMQ_DELETED_FUNCTION; - void operator = (const message_t&) ZMQ_DELETED_FUNCTION; - }; - - class context_t - { - friend class socket_t; - - public: - inline context_t () - { - ptr = zmq_ctx_new (); - if (ptr == NULL) - throw error_t (); - } - - - inline explicit context_t (int io_threads_, int max_sockets_ = ZMQ_MAX_SOCKETS_DFLT) - { - ptr = zmq_ctx_new (); - if (ptr == NULL) - throw error_t (); - - int rc = zmq_ctx_set (ptr, ZMQ_IO_THREADS, io_threads_); - ZMQ_ASSERT (rc == 0); - - rc = zmq_ctx_set (ptr, ZMQ_MAX_SOCKETS, max_sockets_); - ZMQ_ASSERT (rc == 0); - } - -#ifdef ZMQ_HAS_RVALUE_REFS - inline context_t (context_t &&rhs) ZMQ_NOTHROW : ptr (rhs.ptr) - { - rhs.ptr = NULL; - } - inline context_t &operator = (context_t &&rhs) ZMQ_NOTHROW - { - std::swap (ptr, rhs.ptr); - return *this; - } -#endif - - inline ~context_t () ZMQ_NOTHROW - { - close(); - } - - inline void close() ZMQ_NOTHROW - { - if (ptr == NULL) - return; - - int rc = zmq_ctx_destroy (ptr); - ZMQ_ASSERT (rc == 0); - ptr = NULL; - } - - // Be careful with this, it's probably only useful for - // using the C api together with an existing C++ api. - // Normally you should never need to use this. - inline ZMQ_EXPLICIT operator void* () ZMQ_NOTHROW - { - return ptr; - } - - inline ZMQ_EXPLICIT operator void const* () const ZMQ_NOTHROW - { - return ptr; - } - private: - - void *ptr; - - context_t (const context_t&) ZMQ_DELETED_FUNCTION; - void operator = (const context_t&) ZMQ_DELETED_FUNCTION; - }; - - #ifdef ZMQ_CPP11 - enum class socket_type: int - { - req = ZMQ_REQ, - rep = ZMQ_REP, - dealer = ZMQ_DEALER, - router = ZMQ_ROUTER, - pub = ZMQ_PUB, - sub = ZMQ_SUB, - xpub = ZMQ_XPUB, - xsub = ZMQ_XSUB, - push = ZMQ_PUSH, - pull = ZMQ_PULL, -#if ZMQ_VERSION_MAJOR >= 4 - stream = ZMQ_STREAM, -#endif - pair = ZMQ_PAIR - }; - #endif - - class socket_t - { - friend class monitor_t; - friend class poller_t; - public: - inline socket_t(context_t& context_, int type_) - { - init(context_, type_); - } - - #ifdef ZMQ_CPP11 - inline socket_t(context_t& context_, socket_type type_) - { - init(context_, static_cast(type_)); - } - #endif - -#ifdef ZMQ_HAS_RVALUE_REFS - inline socket_t(socket_t&& rhs) ZMQ_NOTHROW : - ptr(rhs.ptr), - ctxptr(rhs.ctxptr) - { - rhs.ptr = NULL; - rhs.ctxptr = NULL; - } - inline socket_t& operator=(socket_t&& rhs) ZMQ_NOTHROW - { - std::swap(ptr, rhs.ptr); - return *this; - } -#endif - - inline ~socket_t () ZMQ_NOTHROW - { - close(); - } - - inline operator void* () ZMQ_NOTHROW - { - return ptr; - } - - inline operator void const* () const ZMQ_NOTHROW - { - return ptr; - } - - inline void close() ZMQ_NOTHROW - { - if(ptr == NULL) - // already closed - return ; - int rc = zmq_close (ptr); - ZMQ_ASSERT (rc == 0); - ptr = 0 ; - } - - template void setsockopt(int option_, T const& optval) - { - setsockopt(option_, &optval, sizeof(T) ); - } - - inline void setsockopt (int option_, const void *optval_, - size_t optvallen_) - { - int rc = zmq_setsockopt (ptr, option_, optval_, optvallen_); - if (rc != 0) - throw error_t (); - } - - inline void getsockopt (int option_, void *optval_, - size_t *optvallen_) const - { - int rc = zmq_getsockopt (ptr, option_, optval_, optvallen_); - if (rc != 0) - throw error_t (); - } - - template T getsockopt(int option_) const - { - T optval; - size_t optlen = sizeof(T); - getsockopt(option_, &optval, &optlen ); - return optval; - } - - inline void bind(std::string const& addr) - { - bind(addr.c_str()); - } - - inline void bind (const char *addr_) - { - int rc = zmq_bind (ptr, addr_); - if (rc != 0) - throw error_t (); - } - - inline void unbind(std::string const& addr) - { - unbind(addr.c_str()); - } - - inline void unbind (const char *addr_) - { - int rc = zmq_unbind (ptr, addr_); - if (rc != 0) - throw error_t (); - } - - inline void connect(std::string const& addr) - { - connect(addr.c_str()); - } - - inline void connect (const char *addr_) - { - int rc = zmq_connect (ptr, addr_); - if (rc != 0) - throw error_t (); - } - - inline void disconnect(std::string const& addr) - { - disconnect(addr.c_str()); - } - - inline void disconnect (const char *addr_) - { - int rc = zmq_disconnect (ptr, addr_); - if (rc != 0) - throw error_t (); - } - - inline bool connected() const ZMQ_NOTHROW - { - return(ptr != NULL); - } - - inline size_t send (const void *buf_, size_t len_, int flags_ = 0) - { - int nbytes = zmq_send (ptr, buf_, len_, flags_); - if (nbytes >= 0) - return (size_t) nbytes; - if (zmq_errno () == EAGAIN) - return 0; - throw error_t (); - } - - inline bool send (message_t &msg_, int flags_ = 0) - { - int nbytes = zmq_msg_send (&(msg_.msg), ptr, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno () == EAGAIN) - return false; - throw error_t (); - } - - template bool send(I first, I last, int flags_=0) - { - zmq::message_t msg(first, last); - return send(msg, flags_); - } - -#ifdef ZMQ_HAS_RVALUE_REFS - inline bool send (message_t &&msg_, int flags_ = 0) - { - return send(msg_, flags_); - } -#endif - - inline size_t recv (void *buf_, size_t len_, int flags_ = 0) - { - int nbytes = zmq_recv (ptr, buf_, len_, flags_); - if (nbytes >= 0) - return (size_t) nbytes; - if (zmq_errno () == EAGAIN) - return 0; - throw error_t (); - } - - inline bool recv (message_t *msg_, int flags_ = 0) - { - int nbytes = zmq_msg_recv (&(msg_->msg), ptr, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno () == EAGAIN) - return false; - throw error_t (); - } - - private: - inline void init(context_t& context_, int type_) - { - ctxptr = context_.ptr; - ptr = zmq_socket (context_.ptr, type_ ); - if (ptr == NULL) - throw error_t (); - } - - void *ptr; - void *ctxptr; - - socket_t (const socket_t&) ZMQ_DELETED_FUNCTION; - void operator = (const socket_t&) ZMQ_DELETED_FUNCTION; - }; - - class monitor_t - { - public: - monitor_t() : socketPtr(NULL), monitor_socket(NULL) {} - - virtual ~monitor_t() - { - if (socketPtr) - zmq_socket_monitor(socketPtr, NULL, 0); - - if (monitor_socket) - zmq_close (monitor_socket); - - } - - -#ifdef ZMQ_HAS_RVALUE_REFS - monitor_t(monitor_t&& rhs) ZMQ_NOTHROW : - socketPtr(rhs.socketPtr), - monitor_socket(rhs.monitor_socket) - { - rhs.socketPtr = NULL; - rhs.monitor_socket = NULL; - } - - socket_t& operator=(socket_t&& rhs) ZMQ_DELETED_FUNCTION ; -#endif - - - - void monitor(socket_t &socket, std::string const& addr, int events = ZMQ_EVENT_ALL) - { - monitor(socket, addr.c_str(), events); - } - - void monitor(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) - { - init (socket, addr_, events) ; - while(true) - { - check_event(-1) ; - } - } - - void init(socket_t &socket, std::string const& addr, int events = ZMQ_EVENT_ALL) - { - init(socket, addr.c_str(), events); - } - - void init(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) - { - int rc = zmq_socket_monitor(socket.ptr, addr_, events); - if (rc != 0) - throw error_t (); - - socketPtr = socket.ptr; - monitor_socket = zmq_socket (socket.ctxptr, ZMQ_PAIR); - assert (monitor_socket); - - rc = zmq_connect (monitor_socket, addr_); - assert (rc == 0); - - on_monitor_started(); - } - - bool check_event(int timeout = 0) - { - assert (monitor_socket); - - zmq_msg_t eventMsg; - zmq_msg_init (&eventMsg); - - zmq::pollitem_t items [] = { - { monitor_socket, 0, ZMQ_POLLIN, 0 }, - }; - - zmq::poll (&items [0], 1, timeout); - - if (items [0].revents & ZMQ_POLLIN) - { - int rc = zmq_msg_recv (&eventMsg, monitor_socket, 0); - if (rc == -1 && zmq_errno() == ETERM) - return false; - assert (rc != -1); - - } - else - { - zmq_msg_close (&eventMsg); - return false; - } - -#if ZMQ_VERSION_MAJOR >= 4 - const char* data = static_cast(zmq_msg_data(&eventMsg)); - zmq_event_t msgEvent; - memcpy(&msgEvent.event, data, sizeof(uint16_t)); data += sizeof(uint16_t); - memcpy(&msgEvent.value, data, sizeof(int32_t)); - zmq_event_t* event = &msgEvent; -#else - zmq_event_t* event = static_cast(zmq_msg_data(&eventMsg)); -#endif - -#ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT - zmq_msg_t addrMsg; - zmq_msg_init (&addrMsg); - int rc = zmq_msg_recv (&addrMsg, monitor_socket, 0); - if (rc == -1 && zmq_errno() == ETERM) - { - zmq_msg_close (&eventMsg); - return false; - } - - assert (rc != -1); - const char* str = static_cast(zmq_msg_data (&addrMsg)); - std::string address(str, str + zmq_msg_size(&addrMsg)); - zmq_msg_close (&addrMsg); -#else - // Bit of a hack, but all events in the zmq_event_t union have the same layout so this will work for all event types. - std::string address = event->data.connected.addr; -#endif - -#ifdef ZMQ_EVENT_MONITOR_STOPPED - if (event->event == ZMQ_EVENT_MONITOR_STOPPED) - { - zmq_msg_close (&eventMsg); - return true; - } - -#endif - - switch (event->event) { - case ZMQ_EVENT_CONNECTED: - on_event_connected(*event, address.c_str()); - break; - case ZMQ_EVENT_CONNECT_DELAYED: - on_event_connect_delayed(*event, address.c_str()); - break; - case ZMQ_EVENT_CONNECT_RETRIED: - on_event_connect_retried(*event, address.c_str()); - break; - case ZMQ_EVENT_LISTENING: - on_event_listening(*event, address.c_str()); - break; - case ZMQ_EVENT_BIND_FAILED: - on_event_bind_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_ACCEPTED: - on_event_accepted(*event, address.c_str()); - break; - case ZMQ_EVENT_ACCEPT_FAILED: - on_event_accept_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_CLOSED: - on_event_closed(*event, address.c_str()); - break; - case ZMQ_EVENT_CLOSE_FAILED: - on_event_close_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_DISCONNECTED: - on_event_disconnected(*event, address.c_str()); - break; -#ifdef ZMQ_BUILD_DRAFT_API -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) - case ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL: - on_event_handshake_failed_no_detail(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL: - on_event_handshake_failed_protocol(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_FAILED_AUTH: - on_event_handshake_failed_auth(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_SUCCEEDED: - on_event_handshake_succeeded(*event, address.c_str()); - break; -#elif ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 1) - case ZMQ_EVENT_HANDSHAKE_FAILED: - on_event_handshake_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_SUCCEED: - on_event_handshake_succeed(*event, address.c_str()); - break; -#endif -#endif - default: - on_event_unknown(*event, address.c_str()); - break; - } - zmq_msg_close (&eventMsg); - - return true ; - } - -#ifdef ZMQ_EVENT_MONITOR_STOPPED - void abort() - { - if (socketPtr) - zmq_socket_monitor(socketPtr, NULL, 0); - - if (monitor_socket) - zmq_close (monitor_socket); - - socketPtr = NULL; - monitor_socket = NULL; - } -#endif - virtual void on_monitor_started() {} - virtual void on_event_connected(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_connect_delayed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_connect_retried(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_listening(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_bind_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_accepted(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_accept_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_closed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_close_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_disconnected(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) - virtual void on_event_handshake_failed_no_detail(const zmq_event_t &event_, const char* addr_) { (void) event_; (void) addr_; } - virtual void on_event_handshake_failed_protocol(const zmq_event_t &event_, const char* addr_) { (void) event_; (void) addr_; } - virtual void on_event_handshake_failed_auth(const zmq_event_t &event_, const char* addr_) { (void) event_; (void) addr_; } - virtual void on_event_handshake_succeeded(const zmq_event_t &event_, const char* addr_) { (void) event_; (void) addr_; } -#elif ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 1) - virtual void on_event_handshake_failed(const zmq_event_t &event_, const char* addr_) { (void) event_; (void) addr_; } - virtual void on_event_handshake_succeed(const zmq_event_t &event_, const char* addr_) { (void) event_; (void) addr_; } -#endif - virtual void on_event_unknown(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - private: - - monitor_t (const monitor_t&) ZMQ_DELETED_FUNCTION; - void operator = (const monitor_t&) ZMQ_DELETED_FUNCTION; - - void* socketPtr; - void *monitor_socket ; - }; - -#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) - class poller_t - { - public: - poller_t () : poller_ptr (zmq_poller_new ()) - { - if (!poller_ptr) - throw error_t (); - } - - ~poller_t () - { - zmq_poller_destroy (&poller_ptr); - } - - bool add (zmq::socket_t &socket, short events, std::function &handler) - { - if (0 == zmq_poller_add (poller_ptr, socket.ptr, handler ? &handler : NULL, events)) { - poller_events.emplace_back (zmq_poller_event_t ()); - return true; - } - return false; - } - - bool remove (zmq::socket_t &socket) - { - if (0 == zmq_poller_remove (poller_ptr, socket.ptr)) { - poller_events.pop_back (); - return true; - } - return false; - } - - bool wait (std::chrono::milliseconds timeout) - { - int rc = zmq_poller_wait_all (poller_ptr, poller_events.data (), static_cast (poller_events.size ()), static_cast(timeout.count ())); - if (rc >= 0) { - std::for_each (poller_events.begin (), poller_events.begin () + rc, [](zmq_poller_event_t& event) { - if (event.user_data != NULL) - (*reinterpret_cast*> (event.user_data)) (); - }); - return true; - } - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) - if (zmq_errno () == EAGAIN) -#else - if (zmq_errno () == ETIMEDOUT) -#endif - return false; - - throw error_t (); - } - - private: - void *poller_ptr; - std::vector poller_events; - }; -#endif // defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) - -} - -#endif diff --git a/inst/include/zmq_addon.hpp b/inst/include/zmq_addon.hpp deleted file mode 100644 index 0e93ebd..0000000 --- a/inst/include/zmq_addon.hpp +++ /dev/null @@ -1,591 +0,0 @@ -/* - Copyright (c) 2016-2017 ZeroMQ community - Copyright (c) 2016 VOCA AS / Harald Nøkland - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. -*/ - -#ifndef __ZMQ_ADDON_HPP_INCLUDED__ -#define __ZMQ_ADDON_HPP_INCLUDED__ - -#include -#include -#include -#include -#include - -namespace zmq { - -#ifdef ZMQ_HAS_RVALUE_REFS - -/* - This class handles multipart messaging. It is the C++ equivalent of zmsg.h, - which is part of CZMQ (the high-level C binding). Furthermore, it is a major - improvement compared to zmsg.hpp, which is part of the examples in the ØMQ - Guide. Unnecessary copying is avoided by using move semantics to efficiently - add/remove parts. -*/ -class multipart_t -{ -private: - std::deque m_parts; - -public: - - typedef std::deque::iterator iterator; - typedef std::deque::const_iterator const_iterator; - - typedef std::deque::reverse_iterator reverse_iterator; - typedef std::deque::const_reverse_iterator const_reverse_iterator; - - // Default constructor - multipart_t() - {} - - // Construct from socket receive - multipart_t(socket_t& socket) - { - recv(socket); - } - - // Construct from memory block - multipart_t(const void *src, size_t size) - { - addmem(src, size); - } - - // Construct from string - multipart_t(const std::string& string) - { - addstr(string); - } - - // Construct from message part - multipart_t(message_t&& message) - { - add(std::move(message)); - } - - // Move constructor - multipart_t(multipart_t&& other) - { - m_parts = std::move(other.m_parts); - } - - // Move assignment operator - multipart_t& operator=(multipart_t&& other) - { - m_parts = std::move(other.m_parts); - return *this; - } - - // Destructor - virtual ~multipart_t() - { - clear(); - } - - message_t& operator[] (size_t n) - { - return m_parts[n]; - } - - const message_t& operator[] (size_t n) const - { - return m_parts[n]; - } - - message_t& at (size_t n) - { - return m_parts.at(n); - } - - const message_t& at (size_t n) const - { - return m_parts.at(n); - } - - iterator begin() - { - return m_parts.begin(); - } - - const_iterator begin() const - { - return m_parts.begin(); - } - - const_iterator cbegin() const - { - return m_parts.cbegin(); - } - - reverse_iterator rbegin() - { - return m_parts.rbegin(); - } - - const_reverse_iterator rbegin() const - { - return m_parts.rbegin(); - } - - iterator end() - { - return m_parts.end(); - } - - const_iterator end() const - { - return m_parts.end(); - } - - const_iterator cend() const - { - return m_parts.cend(); - } - - reverse_iterator rend() - { - return m_parts.rend(); - } - - const_reverse_iterator rend() const - { - return m_parts.rend(); - } - - // Delete all parts - void clear() - { - m_parts.clear(); - } - - // Get number of parts - size_t size() const - { - return m_parts.size(); - } - - // Check if number of parts is zero - bool empty() const - { - return m_parts.empty(); - } - - // Receive multipart message from socket - bool recv(socket_t& socket, int flags = 0) - { - clear(); - bool more = true; - while (more) - { - message_t message; - if (!socket.recv(&message, flags)) - return false; - more = message.more(); - add(std::move(message)); - } - return true; - } - - // Send multipart message to socket - bool send(socket_t& socket, int flags = 0) - { - flags &= ~(ZMQ_SNDMORE); - bool more = size() > 0; - while (more) - { - message_t message = pop(); - more = size() > 0; - if (!socket.send(message, (more ? ZMQ_SNDMORE : 0) | flags)) - return false; - } - clear(); - return true; - } - - // Concatenate other multipart to front - void prepend(multipart_t&& other) - { - while (!other.empty()) - push(other.remove()); - } - - // Concatenate other multipart to back - void append(multipart_t&& other) - { - while (!other.empty()) - add(other.pop()); - } - - // Push memory block to front - void pushmem(const void *src, size_t size) - { - m_parts.push_front(message_t(src, size)); - } - - // Push memory block to back - void addmem(const void *src, size_t size) - { - m_parts.push_back(message_t(src, size)); - } - - // Push string to front - void pushstr(const std::string& string) - { - m_parts.push_front(message_t(string.data(), string.size())); - } - - // Push string to back - void addstr(const std::string& string) - { - m_parts.push_back(message_t(string.data(), string.size())); - } - - // Push type (fixed-size) to front - template - void pushtyp(const T& type) - { - static_assert(!std::is_same::value, "Use pushstr() instead of pushtyp()"); - m_parts.push_front(message_t(&type, sizeof(type))); - } - - // Push type (fixed-size) to back - template - void addtyp(const T& type) - { - static_assert(!std::is_same::value, "Use addstr() instead of addtyp()"); - m_parts.push_back(message_t(&type, sizeof(type))); - } - - // Push message part to front - void push(message_t&& message) - { - m_parts.push_front(std::move(message)); - } - - // Push message part to back - void add(message_t&& message) - { - m_parts.push_back(std::move(message)); - } - - // Pop string from front - std::string popstr() - { - std::string string(m_parts.front().data(), m_parts.front().size()); - m_parts.pop_front(); - return string; - } - - // Pop type (fixed-size) from front - template - T poptyp() - { - static_assert(!std::is_same::value, "Use popstr() instead of poptyp()"); - if (sizeof(T) != m_parts.front().size()) - throw std::runtime_error("Invalid type, size does not match the message size"); - T type = *m_parts.front().data(); - m_parts.pop_front(); - return type; - } - - // Pop message part from front - message_t pop() - { - message_t message = std::move(m_parts.front()); - m_parts.pop_front(); - return message; - } - - // Pop message part from back - message_t remove() - { - message_t message = std::move(m_parts.back()); - m_parts.pop_back(); - return message; - } - - // Get pointer to a specific message part - const message_t* peek(size_t index) const - { - return &m_parts[index]; - } - - // Get a string copy of a specific message part - std::string peekstr(size_t index) const - { - std::string string(m_parts[index].data(), m_parts[index].size()); - return string; - } - - // Peek type (fixed-size) from front - template - T peektyp(size_t index) const - { - static_assert(!std::is_same::value, "Use peekstr() instead of peektyp()"); - if(sizeof(T) != m_parts[index].size()) - throw std::runtime_error("Invalid type, size does not match the message size"); - T type = *m_parts[index].data(); - return type; - } - - // Create multipart from type (fixed-size) - template - static multipart_t create(const T& type) - { - multipart_t multipart; - multipart.addtyp(type); - return multipart; - } - - // Copy multipart - multipart_t clone() const - { - multipart_t multipart; - for (size_t i = 0; i < size(); i++) - multipart.addmem(m_parts[i].data(), m_parts[i].size()); - return multipart; - } - - // Dump content to string - std::string str() const - { - std::stringstream ss; - for (size_t i = 0; i < m_parts.size(); i++) - { - const unsigned char* data = m_parts[i].data(); - size_t size = m_parts[i].size(); - - // Dump the message as text or binary - bool isText = true; - for (size_t j = 0; j < size; j++) - { - if (data[j] < 32 || data[j] > 127) - { - isText = false; - break; - } - } - ss << "\n[" << std::dec << std::setw(3) << std::setfill('0') << size << "] "; - if (size >= 1000) - { - ss << "... (to big to print)"; - continue; - } - for (size_t j = 0; j < size; j++) - { - if (isText) - ss << static_cast(data[j]); - else - ss << std::hex << std::setw(2) << std::setfill('0') << static_cast(data[j]); - } - } - return ss.str(); - } - - // Check if equal to other multipart - bool equal(const multipart_t* other) const - { - if (size() != other->size()) - return false; - for (size_t i = 0; i < size(); i++) - if (!peek(i)->equal(other->peek(i))) - return false; - return true; - } - - // Self test - static int test() - { - bool ok = true; (void) ok; - float num = 0; (void) num; - std::string str = ""; - message_t msg; - - // Create two PAIR sockets and connect over inproc - context_t context(1); - socket_t output(context, ZMQ_PAIR); - socket_t input(context, ZMQ_PAIR); - output.bind("inproc://multipart.test"); - input.connect("inproc://multipart.test"); - - // Test send and receive of single-frame message - multipart_t multipart; - assert(multipart.empty()); - - multipart.push(message_t("Hello", 5)); - assert(multipart.size() == 1); - - ok = multipart.send(output); - assert(multipart.empty()); - assert(ok); - - ok = multipart.recv(input); - assert(multipart.size() == 1); - assert(ok); - - msg = multipart.pop(); - assert(multipart.empty()); - assert(std::string(msg.data(), msg.size()) == "Hello"); - - // Test send and receive of multi-frame message - multipart.addstr("A"); - multipart.addstr("BB"); - multipart.addstr("CCC"); - assert(multipart.size() == 3); - - multipart_t copy = multipart.clone(); - assert(copy.size() == 3); - - ok = copy.send(output); - assert(copy.empty()); - assert(ok); - - ok = copy.recv(input); - assert(copy.size() == 3); - assert(ok); - assert(copy.equal(&multipart)); - - multipart.clear(); - assert(multipart.empty()); - - // Test message frame manipulation - multipart.add(message_t("Frame5", 6)); - multipart.addstr("Frame6"); - multipart.addstr("Frame7"); - multipart.addtyp(8.0f); - multipart.addmem("Frame9", 6); - multipart.push(message_t("Frame4", 6)); - multipart.pushstr("Frame3"); - multipart.pushstr("Frame2"); - multipart.pushtyp(1.0f); - multipart.pushmem("Frame0", 6); - assert(multipart.size() == 10); - - msg = multipart.remove(); - assert(multipart.size() == 9); - assert(std::string(msg.data(), msg.size()) == "Frame9"); - - msg = multipart.pop(); - assert(multipart.size() == 8); - assert(std::string(msg.data(), msg.size()) == "Frame0"); - - num = multipart.poptyp(); - assert(multipart.size() == 7); - assert(num == 1.0f); - - str = multipart.popstr(); - assert(multipart.size() == 6); - assert(str == "Frame2"); - - str = multipart.popstr(); - assert(multipart.size() == 5); - assert(str == "Frame3"); - - str = multipart.popstr(); - assert(multipart.size() == 4); - assert(str == "Frame4"); - - str = multipart.popstr(); - assert(multipart.size() == 3); - assert(str == "Frame5"); - - str = multipart.popstr(); - assert(multipart.size() == 2); - assert(str == "Frame6"); - - str = multipart.popstr(); - assert(multipart.size() == 1); - assert(str == "Frame7"); - - num = multipart.poptyp(); - assert(multipart.empty()); - assert(num == 8.0f); - - // Test message constructors and concatenation - multipart_t head("One", 3); - head.addstr("Two"); - assert(head.size() == 2); - - multipart_t tail("One-hundred"); - tail.pushstr("Ninety-nine"); - assert(tail.size() == 2); - - multipart_t tmp(message_t("Fifty", 5)); - assert(tmp.size() == 1); - - multipart_t mid = multipart_t::create(49.0f); - mid.append(std::move(tmp)); - assert(mid.size() == 2); - assert(tmp.empty()); - - multipart_t merged(std::move(mid)); - merged.prepend(std::move(head)); - merged.append(std::move(tail)); - assert(merged.size() == 6); - assert(head.empty()); - assert(tail.empty()); - - ok = merged.send(output); - assert(merged.empty()); - assert(ok); - - multipart_t received(input); - assert(received.size() == 6); - - str = received.popstr(); - assert(received.size() == 5); - assert(str == "One"); - - str = received.popstr(); - assert(received.size() == 4); - assert(str == "Two"); - - num = received.poptyp(); - assert(received.size() == 3); - assert(num == 49.0f); - - str = received.popstr(); - assert(received.size() == 2); - assert(str == "Fifty"); - - str = received.popstr(); - assert(received.size() == 1); - assert(str == "Ninety-nine"); - - str = received.popstr(); - assert(received.empty()); - assert(str == "One-hundred"); - - return 0; - } - -private: - // Disable implicit copying (moving is more efficient) - multipart_t(const multipart_t& other) ZMQ_DELETED_FUNCTION; - void operator=(const multipart_t& other) ZMQ_DELETED_FUNCTION; -}; - -#endif - -} - -#endif diff --git a/inst/include/zmq_utils.h b/inst/include/zmq_utils.h deleted file mode 100644 index 2cf7286..0000000 --- a/inst/include/zmq_utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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 . -*/ - -/* This file is deprecated, and all its functionality provided by zmq.h */ -/* Note that -Wpedantic compilation requires GCC to avoid using its custom - extensions such as #warning, hence the trick below. Also, pragmas for - warnings or other messages are not standard, not portable, and not all - compilers even have an equivalent concept. - So in the worst case, this include file is treated as silently empty. */ - -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) -#if defined(__GNUC__) || defined(__GNUG__) -//WCC #pragma GCC diagnostic push -//WCC #pragma GCC diagnostic warning "-Wcpp" -//WCC #pragma GCC diagnostic ignored "-Werror" -//WCC #pragma GCC diagnostic ignored "-Wall" -#endif -//WCC #pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") -#if defined(__GNUC__) || defined(__GNUG__) -//WCC #pragma GCC diagnostic pop -#endif -#endif From 09632200dd7854c9774ebca3e03c052440da30ab Mon Sep 17 00:00:00 2001 From: SpencerA Date: Sun, 7 Jan 2018 11:06:10 -0800 Subject: [PATCH 2/2] ls the directories that should exist and contain zeromq headers --- configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure b/configure index 07b1578..f97c3d6 100755 --- a/configure +++ b/configure @@ -5,6 +5,11 @@ RSCRIPT=${R_HOME}/bin/Rscript PBD_ZMQ=`${RSCRIPT} -e "cat(system.file(package='pbdZMQ'))"` ZMQ_CPPFLAGS="-I${PBD_ZMQ}/zmq/include" + +echo `ls ${PBD_ZMQ}` +echo `ls ${PBD_ZMQ}/zmq` +echo `ls ${PBD_ZMQ}/zmq/include` + ZMQ_LDFLAGS="-L${PBD_ZMQ}/libs -lzmq" if [[ `uname` == 'Darwin' ]]; then ZMQ_LDFLAGS=`${RSCRIPT} -e "pbdZMQ::get.zmq.ldflags()"`