ffi-rzmq 1.0.3 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.travis.yml +1 -1
 - data/AUTHORS.txt +5 -1
 - data/History.txt +24 -0
 - data/README.rdoc +2 -4
 - data/examples/README.rdoc +1 -3
 - data/examples/{v3api/latency_measurement.rb → latency_measurement.rb} +1 -2
 - data/examples/{v3api/local_lat.rb → local_lat.rb} +1 -1
 - data/examples/{v3api/local_lat_poll.rb → local_lat_poll.rb} +4 -4
 - data/examples/{v3api/local_throughput.rb → local_throughput.rb} +1 -1
 - data/examples/{v3api/pub.rb → pub.rb} +1 -1
 - data/examples/{v2api/publish_subscribe.rb → publish_subscribe.rb} +2 -2
 - data/examples/{v2api/remote_lat.rb → remote_lat.rb} +1 -1
 - data/examples/{v3api/remote_throughput.rb → remote_throughput.rb} +4 -3
 - data/examples/repreq_over_curve.rb +60 -0
 - data/examples/{v2api/reqrep_poll.rb → reqrep_poll.rb} +3 -4
 - data/examples/{v2api/request_response.rb → request_response.rb} +1 -2
 - data/examples/{v3api/sub.rb → sub.rb} +1 -2
 - data/examples/{v3api/throughput_measurement.rb → throughput_measurement.rb} +1 -1
 - data/examples/{v3api/xreqxrep_poll.rb → xreqxrep_poll.rb} +6 -7
 - data/ffi-rzmq.gemspec +4 -4
 - data/lib/ffi-rzmq/context.rb +25 -53
 - data/lib/ffi-rzmq/device.rb +8 -4
 - data/lib/ffi-rzmq/exceptions.rb +3 -0
 - data/lib/ffi-rzmq/message.rb +24 -30
 - data/lib/ffi-rzmq/poll.rb +5 -16
 - data/lib/ffi-rzmq/socket.rb +132 -282
 - data/lib/ffi-rzmq/util.rb +28 -36
 - data/lib/ffi-rzmq/version.rb +1 -1
 - data/lib/ffi-rzmq.rb +2 -3
 - data/spec/context_spec.rb +3 -8
 - data/spec/device_spec.rb +10 -9
 - data/spec/nonblocking_recv_spec.rb +7 -7
 - data/spec/pushpull_spec.rb +8 -7
 - data/spec/reqrep_spec.rb +6 -6
 - data/spec/socket_spec.rb +43 -130
 - data/spec/spec_helper.rb +3 -11
 - data/spec/util_spec.rb +28 -0
 - metadata +80 -104
 - data/examples/v2api/latency_measurement.rb +0 -139
 - data/examples/v2api/local_lat.rb +0 -58
 - data/examples/v2api/local_lat_poll.rb +0 -66
 - data/examples/v2api/local_throughput.rb +0 -58
 - data/examples/v2api/pub.rb +0 -46
 - data/examples/v2api/remote_throughput.rb +0 -39
 - data/examples/v2api/sub.rb +0 -74
 - data/examples/v2api/throughput_measurement.rb +0 -138
 - data/examples/v2api/xreqxrep_poll.rb +0 -93
 - data/examples/v3api/publish_subscribe.rb +0 -82
 - data/examples/v3api/remote_lat.rb +0 -71
 - data/examples/v3api/reqrep_poll.rb +0 -62
 - data/examples/v3api/request_response.rb +0 -40
 - data/lib/ffi-rzmq/constants.rb +0 -187
 - data/lib/ffi-rzmq/libc.rb +0 -19
 - data/lib/ffi-rzmq/libzmq.rb +0 -283
 
    
        data/lib/ffi-rzmq/constants.rb
    DELETED
    
    | 
         @@ -1,187 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module ZMQ
         
     | 
| 
       2 
     | 
    
         
            -
              # Set up all of the constants that are *common* to all API
         
     | 
| 
       3 
     | 
    
         
            -
              # versions
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              #  Socket types
         
     | 
| 
       6 
     | 
    
         
            -
              PAIR = 0
         
     | 
| 
       7 
     | 
    
         
            -
              PUB = 1
         
     | 
| 
       8 
     | 
    
         
            -
              SUB = 2
         
     | 
| 
       9 
     | 
    
         
            -
              REQ = 3
         
     | 
| 
       10 
     | 
    
         
            -
              REP = 4
         
     | 
| 
       11 
     | 
    
         
            -
              XREQ = 5
         
     | 
| 
       12 
     | 
    
         
            -
              XREP = 6
         
     | 
| 
       13 
     | 
    
         
            -
              PULL = 7
         
     | 
| 
       14 
     | 
    
         
            -
              PUSH = 8
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              SocketTypeNameMap = {
         
     | 
| 
       17 
     | 
    
         
            -
                PAIR => "PAIR",
         
     | 
| 
       18 
     | 
    
         
            -
                PUB => "PUB",
         
     | 
| 
       19 
     | 
    
         
            -
                SUB => "SUB",
         
     | 
| 
       20 
     | 
    
         
            -
                REQ => "REQ",
         
     | 
| 
       21 
     | 
    
         
            -
                REP => "REP",
         
     | 
| 
       22 
     | 
    
         
            -
                PULL => "PULL",
         
     | 
| 
       23 
     | 
    
         
            -
                PUSH => "PUSH",
         
     | 
| 
       24 
     | 
    
         
            -
                XREQ => "XREQ",
         
     | 
| 
       25 
     | 
    
         
            -
                XREP => "XREP"
         
     | 
| 
       26 
     | 
    
         
            -
              }
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              #  Socket options
         
     | 
| 
       29 
     | 
    
         
            -
              AFFINITY = 4
         
     | 
| 
       30 
     | 
    
         
            -
              SUBSCRIBE = 6
         
     | 
| 
       31 
     | 
    
         
            -
              UNSUBSCRIBE = 7
         
     | 
| 
       32 
     | 
    
         
            -
              RATE = 8
         
     | 
| 
       33 
     | 
    
         
            -
              RECOVERY_IVL = 9
         
     | 
| 
       34 
     | 
    
         
            -
              SNDBUF = 11
         
     | 
| 
       35 
     | 
    
         
            -
              RCVBUF = 12
         
     | 
| 
       36 
     | 
    
         
            -
              RCVMORE = 13
         
     | 
| 
       37 
     | 
    
         
            -
              FD = 14
         
     | 
| 
       38 
     | 
    
         
            -
              EVENTS = 15
         
     | 
| 
       39 
     | 
    
         
            -
              TYPE = 16
         
     | 
| 
       40 
     | 
    
         
            -
              LINGER = 17
         
     | 
| 
       41 
     | 
    
         
            -
              RECONNECT_IVL = 18
         
     | 
| 
       42 
     | 
    
         
            -
              BACKLOG = 19
         
     | 
| 
       43 
     | 
    
         
            -
              RECONNECT_IVL_MAX = 21
         
     | 
| 
       44 
     | 
    
         
            -
              RCVTIMEO = 27
         
     | 
| 
       45 
     | 
    
         
            -
              SNDTIMEO = 28
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
              #  Send/recv options
         
     | 
| 
       48 
     | 
    
         
            -
              SNDMORE = 2
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
              #  I/O multiplexing
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
              POLL = 1
         
     | 
| 
       53 
     | 
    
         
            -
              POLLIN = 1
         
     | 
| 
       54 
     | 
    
         
            -
              POLLOUT = 2
         
     | 
| 
       55 
     | 
    
         
            -
              POLLERR = 4
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
              #  Socket errors
         
     | 
| 
       58 
     | 
    
         
            -
              EAGAIN = Errno::EAGAIN::Errno
         
     | 
| 
       59 
     | 
    
         
            -
              EINVAL = Errno::EINVAL::Errno
         
     | 
| 
       60 
     | 
    
         
            -
              ENOMEM = Errno::ENOMEM::Errno
         
     | 
| 
       61 
     | 
    
         
            -
              ENODEV = Errno::ENODEV::Errno
         
     | 
| 
       62 
     | 
    
         
            -
              EFAULT = Errno::EFAULT::Errno
         
     | 
| 
       63 
     | 
    
         
            -
              EINTR  = Errno::EINTR::Errno
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
              # ZMQ errors
         
     | 
| 
       66 
     | 
    
         
            -
              HAUSNUMERO     = 156384712
         
     | 
| 
       67 
     | 
    
         
            -
              EFSM           = (HAUSNUMERO + 51)
         
     | 
| 
       68 
     | 
    
         
            -
              ENOCOMPATPROTO = (HAUSNUMERO + 52)
         
     | 
| 
       69 
     | 
    
         
            -
              ETERM          = (HAUSNUMERO + 53)
         
     | 
| 
       70 
     | 
    
         
            -
              EMTHREAD       = (HAUSNUMERO + 54)
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
              # Rescue unknown constants and use the ZeroMQ defined values
         
     | 
| 
       73 
     | 
    
         
            -
              # Usually only happens on Windows though some don't resolve on
         
     | 
| 
       74 
     | 
    
         
            -
              # OSX too (ENOTSUP)
         
     | 
| 
       75 
     | 
    
         
            -
              ENOTSUP         = Errno::ENOTSUP::Errno rescue (HAUSNUMERO + 1)
         
     | 
| 
       76 
     | 
    
         
            -
              EPROTONOSUPPORT = Errno::EPROTONOSUPPORT::Errno rescue (HAUSNUMERO + 2)
         
     | 
| 
       77 
     | 
    
         
            -
              ENOBUFS         = Errno::ENOBUFS::Errno rescue (HAUSNUMERO + 3)
         
     | 
| 
       78 
     | 
    
         
            -
              ENETDOWN        = Errno::ENETDOWN::Errno rescue (HAUSNUMERO + 4)
         
     | 
| 
       79 
     | 
    
         
            -
              EADDRINUSE      = Errno::EADDRINUSE::Errno rescue (HAUSNUMERO + 5)
         
     | 
| 
       80 
     | 
    
         
            -
              EADDRNOTAVAIL   = Errno::EADDRNOTAVAIL::Errno rescue (HAUSNUMERO + 6)
         
     | 
| 
       81 
     | 
    
         
            -
              ECONNREFUSED    = Errno::ECONNREFUSED::Errno rescue (HAUSNUMERO + 7)
         
     | 
| 
       82 
     | 
    
         
            -
              EINPROGRESS     = Errno::EINPROGRESS::Errno rescue (HAUSNUMERO + 8)
         
     | 
| 
       83 
     | 
    
         
            -
              ENOTSOCK        = Errno::ENOTSOCK::Errno rescue (HAUSNUMERO + 9)
         
     | 
| 
       84 
     | 
    
         
            -
              EMSGSIZE        = Errno::EMSGSIZE::Errno rescue (HAUSNUMERO + 10)
         
     | 
| 
       85 
     | 
    
         
            -
              EAFNOSUPPORT    = Errno::EAFNOSUPPORT::Errno rescue (HAUSNUMERO + 11)
         
     | 
| 
       86 
     | 
    
         
            -
              ENETUNREACH     = Errno::ENETUNREACH::Errno rescue (HAUSNUMERO + 12)
         
     | 
| 
       87 
     | 
    
         
            -
              ECONNABORTED    = Errno::ECONNABORTED::Errno rescue (HAUSNUMERO + 13)
         
     | 
| 
       88 
     | 
    
         
            -
              ECONNRESET      = Errno::ECONNRESET::Errno rescue (HAUSNUMERO + 14)
         
     | 
| 
       89 
     | 
    
         
            -
              ENOTCONN        = Errno::ENOTCONN::Errno rescue (HAUSNUMERO + 15)
         
     | 
| 
       90 
     | 
    
         
            -
              ETIMEDOUT       = Errno::ETIMEDOUT::Errno rescue (HAUSNUMERO + 16)
         
     | 
| 
       91 
     | 
    
         
            -
              EHOSTUNREACH    = Errno::EHOSTUNREACH::Errno rescue (HAUSNUMERO + 17)
         
     | 
| 
       92 
     | 
    
         
            -
              ENETRESET       = Errno::ENETRESET::Errno rescue (HAUSNUMERO + 18)
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
              #  Device Types
         
     | 
| 
       95 
     | 
    
         
            -
              STREAMER = 1
         
     | 
| 
       96 
     | 
    
         
            -
              FORWARDER = 2
         
     | 
| 
       97 
     | 
    
         
            -
              QUEUE = 3
         
     | 
| 
       98 
     | 
    
         
            -
            end # module ZMQ
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
            if ZMQ::LibZMQ.version2?
         
     | 
| 
       102 
     | 
    
         
            -
              module ZMQ
         
     | 
| 
       103 
     | 
    
         
            -
                # Socket types
         
     | 
| 
       104 
     | 
    
         
            -
                UPSTREAM = PULL
         
     | 
| 
       105 
     | 
    
         
            -
                DOWNSTREAM = PUSH
         
     | 
| 
       106 
     | 
    
         
            -
                DEALER = XREQ
         
     | 
| 
       107 
     | 
    
         
            -
                ROUTER = XREP
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                SocketTypeNameMap[ROUTER] = 'ROUTER'
         
     | 
| 
       110 
     | 
    
         
            -
                SocketTypeNameMap[DEALER] = 'DEALER'
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
                # Socket options
         
     | 
| 
       113 
     | 
    
         
            -
                HWM = 1
         
     | 
| 
       114 
     | 
    
         
            -
                IDENTITY = 5
         
     | 
| 
       115 
     | 
    
         
            -
                MCAST_LOOP = 10
         
     | 
| 
       116 
     | 
    
         
            -
                SWAP = 3
         
     | 
| 
       117 
     | 
    
         
            -
                RECOVERY_IVL_MSEC = 20
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
                # Send/recv options
         
     | 
| 
       120 
     | 
    
         
            -
                NOBLOCK = 1
         
     | 
| 
       121 
     | 
    
         
            -
                NonBlocking = NOBLOCK
         
     | 
| 
       122 
     | 
    
         
            -
              end
         
     | 
| 
       123 
     | 
    
         
            -
            end # version2?
         
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
            if ZMQ::LibZMQ.version3?
         
     | 
| 
       127 
     | 
    
         
            -
              module ZMQ
         
     | 
| 
       128 
     | 
    
         
            -
                # Socket types
         
     | 
| 
       129 
     | 
    
         
            -
                XPUB = 9
         
     | 
| 
       130 
     | 
    
         
            -
                XSUB = 10
         
     | 
| 
       131 
     | 
    
         
            -
                DEALER = XREQ
         
     | 
| 
       132 
     | 
    
         
            -
                ROUTER = XREP
         
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
                SocketTypeNameMap[ROUTER] = 'ROUTER'
         
     | 
| 
       135 
     | 
    
         
            -
                SocketTypeNameMap[DEALER] = 'DEALER'
         
     | 
| 
       136 
     | 
    
         
            -
                SocketTypeNameMap[XPUB] = 'XPUB'
         
     | 
| 
       137 
     | 
    
         
            -
                SocketTypeNameMap[XSUB] = 'XSUB'
         
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
                # Context options
         
     | 
| 
       140 
     | 
    
         
            -
                IO_THREADS     = 1
         
     | 
| 
       141 
     | 
    
         
            -
                MAX_SOCKETS    = 2
         
     | 
| 
       142 
     | 
    
         
            -
                IO_THREADS_DFLT = 1
         
     | 
| 
       143 
     | 
    
         
            -
                MAX_SOCKETS_DFLT = 1024
         
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
                # Socket options
         
     | 
| 
       146 
     | 
    
         
            -
                IDENTITY       = 5
         
     | 
| 
       147 
     | 
    
         
            -
                MAXMSGSIZE     = 22
         
     | 
| 
       148 
     | 
    
         
            -
                SNDHWM         = 23
         
     | 
| 
       149 
     | 
    
         
            -
                RCVHWM         = 24
         
     | 
| 
       150 
     | 
    
         
            -
                MULTICAST_HOPS = 25
         
     | 
| 
       151 
     | 
    
         
            -
                IPV4ONLY       = 31
         
     | 
| 
       152 
     | 
    
         
            -
                LAST_ENDPOINT  = 32
         
     | 
| 
       153 
     | 
    
         
            -
                ROUTER_BEHAVIOR = 33
         
     | 
| 
       154 
     | 
    
         
            -
                TCP_KEEPALIVE   = 34
         
     | 
| 
       155 
     | 
    
         
            -
                TCP_KEEPALIVE_CNT = 35
         
     | 
| 
       156 
     | 
    
         
            -
                TCP_KEEPALIVE_IDLE = 36
         
     | 
| 
       157 
     | 
    
         
            -
                TCP_KEEPALIVE_INTVL = 37
         
     | 
| 
       158 
     | 
    
         
            -
                TCP_ACCEPT_FILTER = 38
         
     | 
| 
       159 
     | 
    
         
            -
                
         
     | 
| 
       160 
     | 
    
         
            -
                # Message options
         
     | 
| 
       161 
     | 
    
         
            -
                MORE = 1
         
     | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
       163 
     | 
    
         
            -
                # Send/recv options
         
     | 
| 
       164 
     | 
    
         
            -
                DONTWAIT       = 1
         
     | 
| 
       165 
     | 
    
         
            -
                SNDLABEL       = 4
         
     | 
| 
       166 
     | 
    
         
            -
                NonBlocking    = DONTWAIT
         
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
                # Socket events and monitoring
         
     | 
| 
       169 
     | 
    
         
            -
                EVENT_CONNECTED     = 1
         
     | 
| 
       170 
     | 
    
         
            -
                EVENT_CONNECT_DELAYED = 2
         
     | 
| 
       171 
     | 
    
         
            -
                EVENT_CONNECT_RETRIED = 4
         
     | 
| 
       172 
     | 
    
         
            -
                EVENT_LISTENING = 8
         
     | 
| 
       173 
     | 
    
         
            -
                EVENT_BIND_FAILED = 16
         
     | 
| 
       174 
     | 
    
         
            -
                EVENT_ACCEPTED = 32
         
     | 
| 
       175 
     | 
    
         
            -
                EVENT_ACCEPT_FAILED = 64
         
     | 
| 
       176 
     | 
    
         
            -
                EVENT_CLOSED = 128
         
     | 
| 
       177 
     | 
    
         
            -
                EVENT_CLOSE_FAILED = 256
         
     | 
| 
       178 
     | 
    
         
            -
                EVENT_DISCONNECTED = 512
         
     | 
| 
       179 
     | 
    
         
            -
                EVENT_ALL = EVENT_CONNECTED | EVENT_CONNECT_DELAYED | EVENT_CONNECT_RETRIED |
         
     | 
| 
       180 
     | 
    
         
            -
                            EVENT_LISTENING | EVENT_BIND_FAILED | EVENT_ACCEPTED |
         
     | 
| 
       181 
     | 
    
         
            -
                            EVENT_ACCEPT_FAILED | EVENT_CLOSED | EVENT_CLOSE_FAILED |
         
     | 
| 
       182 
     | 
    
         
            -
                            EVENT_DISCONNECTED
         
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
                # Socket & other errors
         
     | 
| 
       185 
     | 
    
         
            -
                EMFILE = Errno::EMFILE::Errno
         
     | 
| 
       186 
     | 
    
         
            -
              end
         
     | 
| 
       187 
     | 
    
         
            -
            end # version3?
         
     | 
    
        data/lib/ffi-rzmq/libc.rb
    DELETED
    
    | 
         @@ -1,19 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            module LibC
         
     | 
| 
       3 
     | 
    
         
            -
              extend FFI::Library
         
     | 
| 
       4 
     | 
    
         
            -
              # figures out the correct libc for each platform including Windows
         
     | 
| 
       5 
     | 
    
         
            -
              library = ffi_lib(FFI::Library::LIBC).first
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
              # Size_t not working properly on Windows
         
     | 
| 
       8 
     | 
    
         
            -
              find_type(:size_t) rescue typedef(:ulong, :size_t)
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              # memory allocators
         
     | 
| 
       11 
     | 
    
         
            -
              attach_function :malloc, [:size_t], :pointer
         
     | 
| 
       12 
     | 
    
         
            -
              attach_function :free, [:pointer], :void
         
     | 
| 
       13 
     | 
    
         
            -
              
         
     | 
| 
       14 
     | 
    
         
            -
              # get a pointer to the free function; used for ZMQ::Message deallocation
         
     | 
| 
       15 
     | 
    
         
            -
              Free = library.find_symbol('free')
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
              # memory movers
         
     | 
| 
       18 
     | 
    
         
            -
              attach_function :memcpy, [:pointer, :pointer, :size_t], :pointer
         
     | 
| 
       19 
     | 
    
         
            -
            end # module LibC
         
     | 
    
        data/lib/ffi-rzmq/libzmq.rb
    DELETED
    
    | 
         @@ -1,283 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module ZMQ
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              # Wraps the libzmq library and attaches to the functions that are
         
     | 
| 
       4 
     | 
    
         
            -
              # common across the 2.x and 3.x APIs.
         
     | 
| 
       5 
     | 
    
         
            -
              #
         
     | 
| 
       6 
     | 
    
         
            -
              module LibZMQ
         
     | 
| 
       7 
     | 
    
         
            -
                extend FFI::Library
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                begin
         
     | 
| 
       10 
     | 
    
         
            -
                  # bias the library discovery to a path inside the gem first, then
         
     | 
| 
       11 
     | 
    
         
            -
                  # to the usual system paths
         
     | 
| 
       12 
     | 
    
         
            -
                  inside_gem = File.join(File.dirname(__FILE__), '..', '..', 'ext')
         
     | 
| 
       13 
     | 
    
         
            -
                  local_path = FFI::Platform::IS_WINDOWS ? ENV['PATH'].split(';') : ENV['PATH'].split(':')
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                  # Search for libzmq in the following order...
         
     | 
| 
       16 
     | 
    
         
            -
                  ZMQ_LIB_PATHS =([inside_gem] + local_path + [
         
     | 
| 
       17 
     | 
    
         
            -
                    '/usr/local/lib', '/opt/local/lib', '/usr/local/homebrew/lib', '/usr/lib64'
         
     | 
| 
       18 
     | 
    
         
            -
                  ]).map{|path| "#{path}/libzmq.#{FFI::Platform::LIBSUFFIX}"}
         
     | 
| 
       19 
     | 
    
         
            -
                  ffi_lib(ZMQ_LIB_PATHS + %w{libzmq})
         
     | 
| 
       20 
     | 
    
         
            -
                rescue LoadError => e
         
     | 
| 
       21 
     | 
    
         
            -
                  if ZMQ_LIB_PATHS.any? {|path| File.file?(path) } 
         
     | 
| 
       22 
     | 
    
         
            -
                    warn "Unable to load this gem. The libzmq library exists, but cannot be loaded."
         
     | 
| 
       23 
     | 
    
         
            -
                    warn "If this is Windows:"
         
     | 
| 
       24 
     | 
    
         
            -
                    warn "-  Check that you have MSVC runtime installed or statically linked"
         
     | 
| 
       25 
     | 
    
         
            -
                    warn "-  Check that your DLL is compiled for #{FFI::Platform::ADDRESS_SIZE} bit"
         
     | 
| 
       26 
     | 
    
         
            -
                  else
         
     | 
| 
       27 
     | 
    
         
            -
                    warn "Unable to load this gem. The libzmq library (or DLL) could not be found."
         
     | 
| 
       28 
     | 
    
         
            -
                    warn "If this is a Windows platform, make sure libzmq.dll is on the PATH."
         
     | 
| 
       29 
     | 
    
         
            -
                    warn "If the DLL was built with mingw, make sure the other two dependent DLLs,"
         
     | 
| 
       30 
     | 
    
         
            -
                    warn "libgcc_s_sjlj-1.dll and libstdc++6.dll, are also on the PATH."
         
     | 
| 
       31 
     | 
    
         
            -
                    warn "For non-Windows platforms, make sure libzmq is located in this search path:"
         
     | 
| 
       32 
     | 
    
         
            -
                    warn ZMQ_LIB_PATHS.inspect
         
     | 
| 
       33 
     | 
    
         
            -
                  end
         
     | 
| 
       34 
     | 
    
         
            -
                  raise LoadError, e.message
         
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
       36 
     | 
    
         
            -
                # Size_t not working properly on Windows
         
     | 
| 
       37 
     | 
    
         
            -
                find_type(:size_t) rescue typedef(:ulong, :size_t)
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                # Context and misc api
         
     | 
| 
       40 
     | 
    
         
            -
                #
         
     | 
| 
       41 
     | 
    
         
            -
                # @blocking = true is a hint to FFI that the following (and only the following)
         
     | 
| 
       42 
     | 
    
         
            -
                # function may block, therefore it should release the GIL before calling it.
         
     | 
| 
       43 
     | 
    
         
            -
                # This can aid in situations where the function call will/may block and another
         
     | 
| 
       44 
     | 
    
         
            -
                # thread within the lib may try to call back into the ruby runtime. Failure to
         
     | 
| 
       45 
     | 
    
         
            -
                # release the GIL will result in a hang; the hint *may* allow things to run
         
     | 
| 
       46 
     | 
    
         
            -
                # smoothly for Ruby runtimes hampered by a GIL.
         
     | 
| 
       47 
     | 
    
         
            -
                #
         
     | 
| 
       48 
     | 
    
         
            -
                # This is really only honored by the MRI implementation but it *is* necessary
         
     | 
| 
       49 
     | 
    
         
            -
                # otherwise the runtime hangs (and requires a kill -9 to terminate)
         
     | 
| 
       50 
     | 
    
         
            -
                #
         
     | 
| 
       51 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       52 
     | 
    
         
            -
                attach_function :zmq_version, [:pointer, :pointer, :pointer], :void
         
     | 
| 
       53 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       54 
     | 
    
         
            -
                attach_function :zmq_errno, [], :int
         
     | 
| 
       55 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       56 
     | 
    
         
            -
                attach_function :zmq_strerror, [:int], :pointer
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
                def self.version
         
     | 
| 
       59 
     | 
    
         
            -
                  if @version.nil?
         
     | 
| 
       60 
     | 
    
         
            -
                    major = FFI::MemoryPointer.new :int
         
     | 
| 
       61 
     | 
    
         
            -
                    minor = FFI::MemoryPointer.new :int
         
     | 
| 
       62 
     | 
    
         
            -
                    patch = FFI::MemoryPointer.new :int
         
     | 
| 
       63 
     | 
    
         
            -
                    LibZMQ.zmq_version major, minor, patch
         
     | 
| 
       64 
     | 
    
         
            -
                    @version = {:major => major.read_int, :minor => minor.read_int, :patch => patch.read_int}
         
     | 
| 
       65 
     | 
    
         
            -
                  end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                  @version
         
     | 
| 
       68 
     | 
    
         
            -
                end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                def self.version2?() version[:major] == 2 && version[:minor] >= 1  end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                def self.version3?() version[:major] == 3 && version[:minor] >= 2 end
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                # Context initialization and destruction
         
     | 
| 
       75 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       76 
     | 
    
         
            -
                attach_function :zmq_init, [:int], :pointer
         
     | 
| 
       77 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       78 
     | 
    
         
            -
                attach_function :zmq_term, [:pointer], :int
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                # Message API
         
     | 
| 
       81 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       82 
     | 
    
         
            -
                attach_function :zmq_msg_init, [:pointer], :int
         
     | 
| 
       83 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       84 
     | 
    
         
            -
                attach_function :zmq_msg_init_size, [:pointer, :size_t], :int
         
     | 
| 
       85 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       86 
     | 
    
         
            -
                attach_function :zmq_msg_init_data, [:pointer, :pointer, :size_t, :pointer, :pointer], :int
         
     | 
| 
       87 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       88 
     | 
    
         
            -
                attach_function :zmq_msg_close, [:pointer], :int
         
     | 
| 
       89 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       90 
     | 
    
         
            -
                attach_function :zmq_msg_data, [:pointer], :pointer
         
     | 
| 
       91 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       92 
     | 
    
         
            -
                attach_function :zmq_msg_size, [:pointer], :size_t
         
     | 
| 
       93 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       94 
     | 
    
         
            -
                attach_function :zmq_msg_copy, [:pointer, :pointer], :int
         
     | 
| 
       95 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       96 
     | 
    
         
            -
                attach_function :zmq_msg_move, [:pointer, :pointer], :int
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
                # Used for casting pointers back to the struct
         
     | 
| 
       99 
     | 
    
         
            -
                #
         
     | 
| 
       100 
     | 
    
         
            -
                class Msg < FFI::Struct
         
     | 
| 
       101 
     | 
    
         
            -
                  layout :content,  :pointer,
         
     | 
| 
       102 
     | 
    
         
            -
                  :flags,    :uint8,
         
     | 
| 
       103 
     | 
    
         
            -
                  :vsm_size, :uint8,
         
     | 
| 
       104 
     | 
    
         
            -
                  :vsm_data, [:uint8, 30]
         
     | 
| 
       105 
     | 
    
         
            -
                end # class Msg
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
                # Socket API
         
     | 
| 
       108 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       109 
     | 
    
         
            -
                attach_function :zmq_socket, [:pointer, :int], :pointer
         
     | 
| 
       110 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       111 
     | 
    
         
            -
                attach_function :zmq_setsockopt, [:pointer, :int, :pointer, :int], :int
         
     | 
| 
       112 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       113 
     | 
    
         
            -
                attach_function :zmq_getsockopt, [:pointer, :int, :pointer, :pointer], :int
         
     | 
| 
       114 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       115 
     | 
    
         
            -
                attach_function :zmq_bind, [:pointer, :string], :int
         
     | 
| 
       116 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       117 
     | 
    
         
            -
                attach_function :zmq_connect, [:pointer, :string], :int
         
     | 
| 
       118 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       119 
     | 
    
         
            -
                attach_function :zmq_close, [:pointer], :int
         
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
                # Device API
         
     | 
| 
       122 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       123 
     | 
    
         
            -
                attach_function :zmq_device, [:int, :pointer, :pointer], :int
         
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
                # Poll API
         
     | 
| 
       126 
     | 
    
         
            -
                @blocking = true
         
     | 
| 
       127 
     | 
    
         
            -
                attach_function :zmq_poll, [:pointer, :int, :long], :int
         
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
                module PollItemLayout
         
     | 
| 
       130 
     | 
    
         
            -
                  def self.included(base)
         
     | 
| 
       131 
     | 
    
         
            -
                    if FFI::Platform::IS_WINDOWS && FFI::Platform::ADDRESS_SIZE==64
         
     | 
| 
       132 
     | 
    
         
            -
                      # On Windows, zmq.h defines fd as a SOCKET, which is 64 bits on x64.
         
     | 
| 
       133 
     | 
    
         
            -
                      fd_type=:uint64
         
     | 
| 
       134 
     | 
    
         
            -
                    else
         
     | 
| 
       135 
     | 
    
         
            -
                      fd_type=:int
         
     | 
| 
       136 
     | 
    
         
            -
                    end
         
     | 
| 
       137 
     | 
    
         
            -
                    base.class_eval do
         
     | 
| 
       138 
     | 
    
         
            -
                      layout :socket,  :pointer,
         
     | 
| 
       139 
     | 
    
         
            -
                        :fd,    fd_type,
         
     | 
| 
       140 
     | 
    
         
            -
                        :events, :short,
         
     | 
| 
       141 
     | 
    
         
            -
                        :revents, :short
         
     | 
| 
       142 
     | 
    
         
            -
                    end
         
     | 
| 
       143 
     | 
    
         
            -
                  end
         
     | 
| 
       144 
     | 
    
         
            -
                end # module PollItemLayout
         
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
                class PollItem < FFI::Struct
         
     | 
| 
       147 
     | 
    
         
            -
                  include PollItemLayout
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                  def socket() self[:socket]; end
         
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
                  def fd() self[:fd]; end
         
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                  def readable?
         
     | 
| 
       154 
     | 
    
         
            -
                    (self[:revents] & ZMQ::POLLIN) > 0
         
     | 
| 
       155 
     | 
    
         
            -
                  end
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
                  def writable?
         
     | 
| 
       158 
     | 
    
         
            -
                    (self[:revents] & ZMQ::POLLOUT) > 0
         
     | 
| 
       159 
     | 
    
         
            -
                  end
         
     | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
       161 
     | 
    
         
            -
                  def both_accessible?
         
     | 
| 
       162 
     | 
    
         
            -
                    readable? && writable?
         
     | 
| 
       163 
     | 
    
         
            -
                  end
         
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
                  def inspect
         
     | 
| 
       166 
     | 
    
         
            -
                    "socket [#{socket}], fd [#{fd}], events [#{self[:events]}], revents [#{self[:revents]}]"
         
     | 
| 
       167 
     | 
    
         
            -
                  end
         
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
                  def to_s; inspect; end
         
     | 
| 
       170 
     | 
    
         
            -
                end # class PollItem
         
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
              end
         
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
              # Attaches to those functions specific to the 2.x API
         
     | 
| 
       176 
     | 
    
         
            -
              #
         
     | 
| 
       177 
     | 
    
         
            -
              if LibZMQ.version2?
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
                module LibZMQ
         
     | 
| 
       180 
     | 
    
         
            -
                  # Socket api
         
     | 
| 
       181 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       182 
     | 
    
         
            -
                  attach_function :zmq_recv, [:pointer, :pointer, :int], :int
         
     | 
| 
       183 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       184 
     | 
    
         
            -
                  attach_function :zmq_send, [:pointer, :pointer, :int], :int
         
     | 
| 
       185 
     | 
    
         
            -
                end
         
     | 
| 
       186 
     | 
    
         
            -
              end
         
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
              # Attaches to those functions specific to the 3.x API
         
     | 
| 
       190 
     | 
    
         
            -
              #
         
     | 
| 
       191 
     | 
    
         
            -
              if LibZMQ.version3?
         
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
       193 
     | 
    
         
            -
                module LibZMQ
         
     | 
| 
       194 
     | 
    
         
            -
                  # New Context API
         
     | 
| 
       195 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       196 
     | 
    
         
            -
                  attach_function :zmq_ctx_new, [], :pointer
         
     | 
| 
       197 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       198 
     | 
    
         
            -
                  attach_function :zmq_ctx_destroy, [:pointer], :int
         
     | 
| 
       199 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       200 
     | 
    
         
            -
                  attach_function :zmq_ctx_set, [:pointer, :int, :int], :int
         
     | 
| 
       201 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       202 
     | 
    
         
            -
                  attach_function :zmq_ctx_get, [:pointer, :int], :int
         
     | 
| 
       203 
     | 
    
         
            -
             
     | 
| 
       204 
     | 
    
         
            -
                  # Message API
         
     | 
| 
       205 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       206 
     | 
    
         
            -
                  attach_function :zmq_msg_send, [:pointer, :pointer, :int], :int
         
     | 
| 
       207 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       208 
     | 
    
         
            -
                  attach_function :zmq_msg_recv, [:pointer, :pointer, :int], :int
         
     | 
| 
       209 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       210 
     | 
    
         
            -
                  attach_function :zmq_msg_more, [:pointer], :int
         
     | 
| 
       211 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       212 
     | 
    
         
            -
                  attach_function :zmq_msg_get, [:pointer, :int], :int
         
     | 
| 
       213 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       214 
     | 
    
         
            -
                  attach_function :zmq_msg_set, [:pointer, :int, :int], :int
         
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
                  # Monitoring API
         
     | 
| 
       217 
     | 
    
         
            -
                  # zmq_ctx_set_monitor is no longer supported as of version >= 3.2.1
         
     | 
| 
       218 
     | 
    
         
            -
                  # replaced by zmq_socket_monitor
         
     | 
| 
       219 
     | 
    
         
            -
                  if LibZMQ.version[:minor] > 2 || (LibZMQ.version[:minor] == 2 && LibZMQ.version[:patch] >= 1)
         
     | 
| 
       220 
     | 
    
         
            -
                    @blocking = true
         
     | 
| 
       221 
     | 
    
         
            -
                    attach_function :zmq_socket_monitor, [:pointer, :pointer, :int], :int
         
     | 
| 
       222 
     | 
    
         
            -
                  else
         
     | 
| 
       223 
     | 
    
         
            -
                    @blocking = true
         
     | 
| 
       224 
     | 
    
         
            -
                    attach_function :zmq_ctx_set_monitor, [:pointer, :pointer], :int
         
     | 
| 
       225 
     | 
    
         
            -
                  end
         
     | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
       227 
     | 
    
         
            -
                  # Socket API
         
     | 
| 
       228 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       229 
     | 
    
         
            -
                  attach_function :zmq_unbind, [:pointer, :string], :int
         
     | 
| 
       230 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       231 
     | 
    
         
            -
                  attach_function :zmq_disconnect, [:pointer, :string], :int
         
     | 
| 
       232 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       233 
     | 
    
         
            -
                  attach_function :zmq_recvmsg, [:pointer, :pointer, :int], :int
         
     | 
| 
       234 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       235 
     | 
    
         
            -
                  attach_function :zmq_recv, [:pointer, :pointer, :size_t, :int], :int
         
     | 
| 
       236 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       237 
     | 
    
         
            -
                  attach_function :zmq_sendmsg, [:pointer, :pointer, :int], :int
         
     | 
| 
       238 
     | 
    
         
            -
                  @blocking = true
         
     | 
| 
       239 
     | 
    
         
            -
                  attach_function :zmq_send, [:pointer, :pointer, :size_t, :int], :int
         
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
       241 
     | 
    
         
            -
                  module EventDataLayout
         
     | 
| 
       242 
     | 
    
         
            -
                    def self.included(base)
         
     | 
| 
       243 
     | 
    
         
            -
                      base.class_eval do
         
     | 
| 
       244 
     | 
    
         
            -
                        layout :event, :int,
         
     | 
| 
       245 
     | 
    
         
            -
                        :addr,  :string,
         
     | 
| 
       246 
     | 
    
         
            -
                        :field2,    :int
         
     | 
| 
       247 
     | 
    
         
            -
                      end
         
     | 
| 
       248 
     | 
    
         
            -
                    end
         
     | 
| 
       249 
     | 
    
         
            -
                  end # module EventDataLayout
         
     | 
| 
       250 
     | 
    
         
            -
             
     | 
| 
       251 
     | 
    
         
            -
                  class EventData < FFI::Struct
         
     | 
| 
       252 
     | 
    
         
            -
                    include EventDataLayout
         
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
       254 
     | 
    
         
            -
                    def event() self[:event]; end
         
     | 
| 
       255 
     | 
    
         
            -
             
     | 
| 
       256 
     | 
    
         
            -
                    def addr() self[:addr]; end
         
     | 
| 
       257 
     | 
    
         
            -
                    alias :address :addr
         
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
                    def fd() self[:field2]; end
         
     | 
| 
       260 
     | 
    
         
            -
                    alias :err :fd
         
     | 
| 
       261 
     | 
    
         
            -
                    alias :interval :fd
         
     | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
       263 
     | 
    
         
            -
                    def inspect
         
     | 
| 
       264 
     | 
    
         
            -
                      "event [#{event}], addr [#{addr}], fd [#{fd}], field2 [#{fd}]"
         
     | 
| 
       265 
     | 
    
         
            -
                    end
         
     | 
| 
       266 
     | 
    
         
            -
             
     | 
| 
       267 
     | 
    
         
            -
                    def to_s; inspect; end
         
     | 
| 
       268 
     | 
    
         
            -
                  end # class EventData
         
     | 
| 
       269 
     | 
    
         
            -
             
     | 
| 
       270 
     | 
    
         
            -
                end
         
     | 
| 
       271 
     | 
    
         
            -
              end
         
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
             
     | 
| 
       274 
     | 
    
         
            -
              # Sanity check; print an error and exit if we are trying to load an unsupported
         
     | 
| 
       275 
     | 
    
         
            -
              # version of libzmq.
         
     | 
| 
       276 
     | 
    
         
            -
              #
         
     | 
| 
       277 
     | 
    
         
            -
              unless LibZMQ.version2? || LibZMQ.version3?
         
     | 
| 
       278 
     | 
    
         
            -
                hash = LibZMQ.version
         
     | 
| 
       279 
     | 
    
         
            -
                version = "#{hash[:major]}.#{hash[:minor]}.#{hash[:patch]}"
         
     | 
| 
       280 
     | 
    
         
            -
                raise LoadError, "The libzmq version #{version} is incompatible with ffi-rzmq."
         
     | 
| 
       281 
     | 
    
         
            -
              end
         
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
       283 
     | 
    
         
            -
            end # module ZMQ
         
     |