diff options
| author | Martin Lucina <mato@kotelna.sk> | 2011-03-28 10:39:51 +0200 | 
|---|---|---|
| committer | Martin Lucina <martin@lucina.net> | 2012-01-23 08:53:37 +0100 | 
| commit | 3e20cb1b8a2b1ca222011df37334e5f4f88dd565 (patch) | |
| tree | 4a753775186bc7f583f1ceb3f9aa675b6f110596 /include | |
| parent | 3f0085ddbef1a44b6bb7a0b23af497d56e0025fa (diff) | |
| parent | e645fc2693acc796304498909786b7b47005b429 (diff) | |
Imported Debian patch 2.1.3-1debian/2.1.3-1
Diffstat (limited to 'include')
| -rw-r--r-- | include/zmq.h | 49 | ||||
| -rw-r--r-- | include/zmq.hpp | 49 | ||||
| -rw-r--r-- | include/zmq_utils.h | 21 | 
3 files changed, 86 insertions, 33 deletions
| diff --git a/include/zmq.h b/include/zmq.h index 1cb6c03..6cdb085 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -1,19 +1,20 @@  /* -    Copyright (c) 2007-2010 iMatix Corporation +    Copyright (c) 2007-2011 iMatix Corporation +    Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file      This file is part of 0MQ.      0MQ is free software; you can redistribute it and/or modify it under -    the terms of the Lesser GNU General Public License as published by +    the terms of the GNU Lesser General Public License as published by      the Free Software Foundation; either version 3 of the License, or      (at your option) any later version.      0MQ 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 -    Lesser GNU General Public License for more details. +    GNU Lesser General Public License for more details. -    You should have received a copy of the Lesser GNU General Public License +    You should have received a copy of the GNU Lesser General Public License      along with this program.  If not, see <http://www.gnu.org/licenses/>.  */ @@ -30,7 +31,7 @@ extern "C" {  #include "winsock2.h"  #endif -/*  Win32 needs special handling for DLL exports                              */ +/*  Handle DSO symbol visibility                                             */  #if defined _WIN32  #   if defined DLL_EXPORT  #       define ZMQ_EXPORT __declspec(dllexport) @@ -38,7 +39,13 @@ extern "C" {  #       define ZMQ_EXPORT __declspec(dllimport)  #   endif  #else -#   define ZMQ_EXPORT +#   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  /******************************************************************************/ @@ -47,8 +54,8 @@ extern "C" {  /*  Version macros for compile-time API version detection                     */  #define ZMQ_VERSION_MAJOR 2 -#define ZMQ_VERSION_MINOR 0 -#define ZMQ_VERSION_PATCH 10 +#define ZMQ_VERSION_MINOR 1 +#define ZMQ_VERSION_PATCH 3  #define ZMQ_MAKE_VERSION(major, minor, patch) \      ((major) * 10000 + (minor) * 100 + (patch)) @@ -62,7 +69,7 @@ ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);  /*  0MQ errors.                                                               */  /******************************************************************************/ -/*  A number random anough not to collide with different errno ranges on      */ +/*  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 @@ -93,16 +100,16 @@ ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);  #endif  /*  Native 0MQ error codes.                                                   */ -#define EMTHREAD (ZMQ_HAUSNUMERO + 50)  #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 (); +ZMQ_EXPORT int zmq_errno (void);  /*  Resolves system errors and 0MQ errors to human-readable string.           */  ZMQ_EXPORT const char *zmq_strerror (int errnum); @@ -168,10 +175,14 @@ ZMQ_EXPORT int zmq_term (void *context);  #define ZMQ_SUB 2  #define ZMQ_REQ 3  #define ZMQ_REP 4 -#define ZMQ_XREQ 5 -#define ZMQ_XREP 6 +#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_XREQ ZMQ_DEALER        /*  Old alias, remove in 3.x               */ +#define ZMQ_XREP ZMQ_ROUTER        /*  Old alias, remove in 3.x               */  #define ZMQ_UPSTREAM ZMQ_PULL      /*  Old alias, remove in 3.x               */  #define ZMQ_DOWNSTREAM ZMQ_PUSH    /*  Old alias, remove in 3.x               */ @@ -188,7 +199,15 @@ ZMQ_EXPORT int zmq_term (void *context);  #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_RECOVERY_IVL_MSEC 20   /*  opt. recovery time, reconcile in 3.x   */ +#define ZMQ_RECONNECT_IVL_MAX 21 +      /*  Send/recv options.                                                        */  #define ZMQ_NOBLOCK 1  #define ZMQ_SNDMORE 2 @@ -227,7 +246,7 @@ typedef struct  ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);  /******************************************************************************/ -/*  Devices - Experimental.                                                   */ +/*  Built-in devices                                                          */  /******************************************************************************/  #define ZMQ_STREAMER 1 diff --git a/include/zmq.hpp b/include/zmq.hpp index 86ffff6..d73c672 100644 --- a/include/zmq.hpp +++ b/include/zmq.hpp @@ -1,19 +1,20 @@  /* -    Copyright (c) 2007-2010 iMatix Corporation +    Copyright (c) 2007-2011 iMatix Corporation +    Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file      This file is part of 0MQ.      0MQ is free software; you can redistribute it and/or modify it under -    the terms of the Lesser GNU General Public License as published by +    the terms of the GNU Lesser General Public License as published by      the Free Software Foundation; either version 3 of the License, or      (at your option) any later version.      0MQ 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 -    Lesser GNU General Public License for more details. +    GNU Lesser General Public License for more details. -    You should have received a copy of the Lesser GNU General Public License +    You should have received a copy of the GNU Lesser General Public License      along with this program.  If not, see <http://www.gnu.org/licenses/>.  */ @@ -22,8 +23,8 @@  #include "zmq.h" -#include <assert.h> -#include <string.h> +#include <cassert> +#include <cstring>  #include <exception>  namespace zmq @@ -43,6 +44,11 @@ namespace zmq              return zmq_strerror (errnum);          } +        int num () const +        { +            return errnum; +        } +      private:          int errnum; @@ -63,6 +69,11 @@ namespace zmq              throw error_t ();      } +    inline void version (int *major_, int *minor_, int *patch_) +    { +        zmq_version (major_, minor_, patch_); +    } +      class message_t : private zmq_msg_t      {          friend class socket_t; @@ -94,8 +105,7 @@ namespace zmq          inline ~message_t ()          {              int rc = zmq_msg_close (this); -            if (rc != 0) -                throw error_t (); +            assert (rc == 0);          }          inline void rebuild () @@ -180,6 +190,14 @@ namespace zmq              assert (rc == 0);          } +        //  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 operator void* () +        { +            return ptr; +        } +              private:          void *ptr; @@ -201,9 +219,7 @@ namespace zmq          inline ~socket_t ()          { -            int rc = zmq_close (ptr); -            if (rc != 0) -                throw error_t (); +            close();          }          inline operator void* () @@ -211,6 +227,17 @@ namespace zmq              return ptr;          } +        inline void close() +        { +            if(ptr == NULL) +                // already closed +                return ; +            int rc = zmq_close (ptr); +            if (rc != 0) +                throw error_t (); +            ptr = 0 ; +        } +          inline void setsockopt (int option_, const void *optval_,              size_t optvallen_)          { diff --git a/include/zmq_utils.h b/include/zmq_utils.h index 5b78e10..6d8a458 100644 --- a/include/zmq_utils.h +++ b/include/zmq_utils.h @@ -1,19 +1,20 @@  /* -    Copyright (c) 2007-2010 iMatix Corporation +    Copyright (c) 2007-2011 iMatix Corporation +    Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file      This file is part of 0MQ.      0MQ is free software; you can redistribute it and/or modify it under -    the terms of the Lesser GNU General Public License as published by +    the terms of the GNU Lesser General Public License as published by      the Free Software Foundation; either version 3 of the License, or      (at your option) any later version.      0MQ 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 -    Lesser GNU General Public License for more details. +    GNU Lesser General Public License for more details. -    You should have received a copy of the Lesser GNU General Public License +    You should have received a copy of the GNU Lesser General Public License      along with this program.  If not, see <http://www.gnu.org/licenses/>.  */ @@ -24,7 +25,7 @@  extern "C" {  #endif -/*  Win32 needs special handling for DLL exports                              */ +/*  Handle DSO symbol visibility                                             */  #if defined _WIN32  #   if defined DLL_EXPORT  #       define ZMQ_EXPORT __declspec(dllexport) @@ -32,14 +33,20 @@ extern "C" {  #       define ZMQ_EXPORT __declspec(dllimport)  #   endif  #else -#   define ZMQ_EXPORT +#   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  /*  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 (); +ZMQ_EXPORT void *zmq_stopwatch_start (void);  /*  Stops the stopwatch. Returns the number of microseconds elapsed since     */  /*  the stopwatch was started.                                                */ | 
