summaryrefslogtreecommitdiffstats
path: root/external_libs
diff options
context:
space:
mode:
Diffstat (limited to 'external_libs')
-rw-r--r--external_libs/python/pyzmq-14.7.0/.travis.yml54
-rw-r--r--external_libs/python/pyzmq-14.7.0/AUTHORS.md110
-rw-r--r--external_libs/python/pyzmq-14.7.0/CONTRIBUTING.md86
-rw-r--r--external_libs/python/pyzmq-14.7.0/COPYING.BSD32
-rw-r--r--external_libs/python/pyzmq-14.7.0/COPYING.LESSER165
-rw-r--r--external_libs/python/pyzmq-14.7.0/MANIFEST.in50
-rw-r--r--external_libs/python/pyzmq-14.7.0/PKG-INFO30
-rw-r--r--external_libs/python/pyzmq-14.7.0/README.md88
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/__init__.py11
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/bundle.py223
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/check_sys_un.c8
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/config.py157
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/constants.py83
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/detect.py136
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/dummy.c5
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/include_darwin/platform.hpp294
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/include_freebsd/platform.hpp294
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/include_linux-armv/platform.hpp287
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/include_linux/platform.hpp294
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/crypto_scalarmult_curve25519.h44
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/crypto_stream_salsa20.h54
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/version.h29
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/include_win32/stdint.h11
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/initlibsodium.c45
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/initlibzmq.c45
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/misc.py65
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/msg.py39
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/patch.py61
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/templates/constant_enums.pxi3
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/templates/constants.pxi12
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/templates/zmq_constants.h6
-rw-r--r--external_libs/python/pyzmq-14.7.0/buildutils/vers.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/LICENSE16
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c148
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/crypto_auth.c34
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/api.h9
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/hmac_hmacsha256.c110
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/api.h9
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/hmac_hmacsha512.c110
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c12
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/api.h9
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c12
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/crypto_box.c108
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/crypto_box_easy.c109
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c41
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c22
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h20
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c19
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c38
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c27
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c21
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c108
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c21
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c134
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c21
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c134
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c21
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c134
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c41
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h2
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h137
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h177
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c465
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c108
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c78
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/crypto_hash.c20
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/cp/api.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c296
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c6
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/cp/api.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c323
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c6
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c59
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c105
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h35
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h208
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h202
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c15
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c60
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c13
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c250
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h86
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c302
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c85
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h45
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c207
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c100
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c391
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sysendian.h146
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c34
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h9
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c13
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c456
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/api.h5
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c14
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe.h44
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c23
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c23
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_add_curve25519_ref10.c61
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c33
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c77
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c73
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c18
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul121666_curve25519_ref10.c74
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul_curve25519_ref10.c257
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sq_curve25519_ref10.c153
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c61
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c123
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/montgomery.h140
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h160
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c14
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c139
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c35
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c26
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c27
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h7
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c91
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/crypto_sign.c76
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h15
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base.h1344
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base2.h40
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d.h1
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d2.h1
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe.h56
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_0.c19
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_1.c19
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_add.c57
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c63
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_copy.c29
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c73
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_invert.c14
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c16
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c19
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_mul.c253
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_neg.c45
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c13
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq.c149
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq2.c160
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sub.c57
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_tobytes.c119
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge.h95
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.h97
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c96
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c50
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.h88
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.h88
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c12
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c13
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c8
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.h73
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c9
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c12
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c17
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c12
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c14
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c8
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c111
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.h97
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c14
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c78
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c77
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h160
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h160
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc.h15
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_muladd.c368
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_reduce.c275
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c81
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sqrtm1.h1
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c39
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h12
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519.h54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c348
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h34
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c230
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519.h51
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c150
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c106
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c16
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c159
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h13
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c59
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h788
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c64
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts.h28
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c14
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h56
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c131
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c28
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c181
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c16
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h12
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c276
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c36
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/crypto_stream.c36
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h1
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S944
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h5
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c61
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c69
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c19
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c57
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c60
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h9
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c57
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c60
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c28
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c29
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c11
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/ref/api.h2
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c24
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/verify_16_api.c6
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/ref/api.h2
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c40
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/verify_32_api.c6
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/ref/api.h2
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c72
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/verify_64_api.c6
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium.h50
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/core.h18
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h55
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth.h39
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h58
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h58
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h53
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_box.h142
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h96
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h35
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h35
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h35
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h35
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_generichash.h69
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h107
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash.h39
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_int32.h8
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_int64.h8
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h55
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h89
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h75
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h36
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h31
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_secretbox.h80
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_shorthash.h36
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h30
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign.h74
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h79
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h59
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream.h49
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h60
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h49
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h49
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h43
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h43
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h43
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint16.h8
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint32.h8
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint64.h8
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint8.h8
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_16.h22
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_32.h22
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_64.h22
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/export.h32
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes.h58
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h45
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h45
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/runtime.h27
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/utils.h106
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/version.h.in29
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c65
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c351
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c266
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/core.c25
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/runtime.c134
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/utils.c505
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/version.c20
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/COPYING674
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/builds/msvc/platform.hpp41
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/include/zmq.h463
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/include/zmq_utils.h20
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/address.cpp105
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/address.hpp67
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/array.hpp163
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/atomic_counter.hpp215
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/atomic_ptr.hpp212
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/blob.hpp139
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/clock.cpp210
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/clock.hpp69
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/command.hpp163
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/config.hpp97
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ctx.cpp567
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ctx.hpp223
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_client.cpp459
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_client.hpp129
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_server.cpp729
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_server.hpp138
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dbuffer.hpp144
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dealer.cpp141
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dealer.hpp89
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/decoder.hpp183
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/devpoll.cpp204
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/devpoll.hpp119
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dist.cpp216
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dist.hpp117
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/encoder.hpp185
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/epoll.cpp192
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/epoll.hpp115
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/err.cpp386
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/err.hpp168
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fd.hpp54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fq.cpp162
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fq.hpp92
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_client.cpp230
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_client.hpp93
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_mechanism_base.cpp347
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_mechanism_base.hpp132
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_server.cpp377
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_server.hpp96
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_decoder.hpp61
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_encoder.hpp60
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_engine.hpp65
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_poll_events.hpp55
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_object.cpp116
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_object.hpp89
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_thread.cpp112
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_thread.hpp99
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ip.cpp176
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ip.hpp57
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_address.cpp105
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_address.hpp76
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_connecter.cpp275
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_connecter.hpp137
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_listener.cpp315
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_listener.hpp114
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/kqueue.cpp225
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/kqueue.hpp127
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/lb.cpp160
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/lb.hpp88
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.pc.cmake.in10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.pc.in10
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.vers4
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/likely.hpp42
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mailbox.cpp96
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mailbox.hpp90
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mechanism.cpp194
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mechanism.hpp139
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/metadata.cpp59
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/metadata.hpp70
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/msg.cpp389
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/msg.hpp187
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mtrie.cpp440
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mtrie.hpp101
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mutex.hpp167
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/norm_engine.cpp728
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/norm_engine.hpp188
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/null_mechanism.cpp358
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/null_mechanism.hpp84
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/object.cpp437
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/object.hpp152
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/options.cpp864
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/options.hpp195
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/own.cpp215
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/own.hpp154
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pair.cpp141
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pair.hpp78
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_receiver.cpp306
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_receiver.hpp152
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_sender.cpp249
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_sender.hpp129
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_socket.cpp716
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_socket.hpp131
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pipe.cpp519
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pipe.hpp233
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_client.cpp222
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_client.hpp79
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_server.cpp440
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_server.hpp93
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/platform.hpp.in296
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poll.cpp190
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poll.hpp119
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller.hpp61
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller_base.cpp109
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller_base.hpp95
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/precompiled.cpp30
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/precompiled.hpp56
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/proxy.cpp203
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/proxy.hpp42
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pub.cpp66
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pub.hpp63
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pull.cpp77
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pull.hpp75
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/push.cpp75
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/push.hpp73
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/random.cpp61
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/random.hpp46
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_decoder.cpp73
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_decoder.hpp76
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_encoder.cpp50
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_encoder.hpp70
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/reaper.cpp137
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/reaper.hpp94
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/rep.cpp133
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/rep.hpp73
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/req.cpp289
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/req.hpp120
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/router.cpp479
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/router.hpp140
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/select.cpp234
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/select.hpp140
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/session_base.cpp627
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/session_base.hpp172
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/signaler.cpp568
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/signaler.hpp90
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socket_base.cpp1342
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socket_base.hpp278
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks.cpp283
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks.hpp135
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks_connecter.cpp478
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks_connecter.hpp164
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stdint.hpp72
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream.cpp307
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream.hpp107
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream_engine.cpp960
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream_engine.hpp218
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/sub.cpp90
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/sub.hpp64
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp.cpp254
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp.hpp62
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_address.cpp672
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_address.hpp116
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_connecter.cpp367
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_connecter.hpp131
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_listener.cpp333
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_listener.hpp99
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/thread.cpp144
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/thread.hpp91
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_address.cpp117
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_address.hpp75
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_connecter.cpp266
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_connecter.hpp137
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_listener.cpp188
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_listener.hpp107
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/trie.cpp344
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/trie.hpp86
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_decoder.cpp158
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_decoder.hpp67
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_encoder.cpp75
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_encoder.hpp59
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_decoder.cpp152
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_decoder.hpp67
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_encoder.cpp77
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_encoder.hpp59
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_protocol.hpp49
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/windows.hpp83
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/wire.hpp108
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xpub.cpp207
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xpub.hpp107
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xsub.cpp243
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xsub.hpp103
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe.hpp219
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe_base.hpp54
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe_conflate.hpp137
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/yqueue.hpp205
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/zmq.cpp1095
-rw-r--r--external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/zmq_utils.cpp216
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/Makefile117
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/autogen_api.py48
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/requirements.txt3
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/_static/default.css553
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/_static/logo.pngbin0 -> 8686 bytes
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/_static/zeromq.icobin0 -> 1150 bytes
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/_templates/layout.html23
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/api/index.rst26
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.ioloop.rst20
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.rst30
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.thread.rst24
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.devices.rst86
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.green.rst7
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.rst142
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.utils.win32.rst19
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/changelog.rst529
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/conf.py216
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/devices.rst82
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/eventloop.rst197
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/index.rst96
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/logging.rst84
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/morethanbindings.rst166
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/pyversions.rst195
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/serialization.rst90
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/ssh.rst75
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/source/unicode.rst188
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/sphinxext/apigen.py441
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/sphinxext/docscrape.py497
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/sphinxext/docscrape_sphinx.py136
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/sphinxext/inheritance_diagram.py407
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/sphinxext/ipython_console_highlighting.py114
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/sphinxext/sphinx_cython.py115
-rw-r--r--external_libs/python/pyzmq-14.7.0/docs/update_ghpages.sh33
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/LICENSE3
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/README_PY3K10
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/benchmark.py25
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/jsonrpc_client.py4
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/jsonrpc_server.py8
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/latency.pngbin0 -> 58452 bytes
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec.pngbin0 -> 56500 bytes
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec_log.pngbin0 -> 59966 bytes
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec_ratio.pngbin0 -> 39876 bytes
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/plot_latency.py84
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/pyro_client.py3
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/pyro_server.py14
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/pyzmq_client.py16
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/pyzmq_server.py10
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/xmlrpc_client.py6
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/bench/xmlrpc_server.py8
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/chat/display.py41
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/chat/prompt.py39
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/device/client.py38
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/device/server.py52
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/eventloop/asyncweb.py96
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/eventloop/echo.py27
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/eventloop/echostream.py24
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/eventloop/web.py46
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/gevent/poll.py42
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/gevent/reqrep.py47
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/gevent/simple.py37
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py34
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/heartbeat/heartbeater.py90
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/heartbeat/ping.py35
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/heartbeat/pong.py34
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/logger/zmqlogger.py70
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/mongodb/client.py46
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/mongodb/controller.py91
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/monitoring/simple_monitor.py112
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/poll/pair.py56
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/poll/pubsub.py57
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/poll/reqrep.py71
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/pubsub/publisher.py57
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/pubsub/subscriber.py74
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/pubsub/topics_pub.py64
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/pubsub/topics_sub.py56
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/security/generate_certificates.py49
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/security/grasslands.py29
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/security/ioloop-ironhouse.py116
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/security/ironhouse.py95
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/security/stonehouse.py95
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/security/strawhouse.py94
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/security/woodhouse.py90
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/serialization/serialsocket.py74
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/win32-interrupt/display.py45
-rw-r--r--external_libs/python/pyzmq-14.7.0/examples/win32-interrupt/prompt.py39
-rw-r--r--external_libs/python/pyzmq-14.7.0/perf/perf.py193
-rw-r--r--external_libs/python/pyzmq-14.7.0/setup.cfg.android17
-rw-r--r--external_libs/python/pyzmq-14.7.0/setup.cfg.template12
-rw-r--r--external_libs/python/pyzmq-14.7.0/setup.py1237
-rw-r--r--external_libs/python/pyzmq-14.7.0/setupegg.py14
-rw-r--r--external_libs/python/pyzmq-14.7.0/tools/release_windows.bat48
-rw-r--r--external_libs/python/pyzmq-14.7.0/tools/tasks.py216
-rw-r--r--external_libs/python/pyzmq-14.7.0/tox.ini27
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/__init__.py (renamed from external_libs/python/zmq/__init__.py)17
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/auth/__init__.py (renamed from external_libs/python/zmq/auth/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/auth/base.py (renamed from external_libs/python/zmq/auth/base.py)2
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/auth/certs.py (renamed from external_libs/python/zmq/auth/certs.py)9
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/auth/ioloop.py (renamed from external_libs/python/zmq/auth/ioloop.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/auth/thread.py (renamed from external_libs/python/zmq/auth/thread.py)4
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/__init__.py (renamed from external_libs/python/zmq/backend/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/__init__.py (renamed from external_libs/python/zmq/backend/cffi/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_cdefs.h (renamed from external_libs/python/zmq/backend/cffi/_cdefs.h)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_cffi.py (renamed from external_libs/python/zmq/backend/cffi/_cffi.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_poll.py (renamed from external_libs/python/zmq/backend/cffi/_poll.py)10
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_verify.c (renamed from external_libs/python/zmq/backend/cffi/_verify.c)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/constants.py (renamed from external_libs/python/zmq/backend/cffi/constants.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/context.py (renamed from external_libs/python/zmq/backend/cffi/context.py)15
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/devices.py (renamed from external_libs/python/zmq/backend/cffi/devices.py)11
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/error.py (renamed from external_libs/python/zmq/backend/cffi/error.py)6
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/message.py (renamed from external_libs/python/zmq/backend/cffi/message.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/socket.py (renamed from external_libs/python/zmq/backend/cffi/socket.py)49
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/utils.py (renamed from external_libs/python/zmq/backend/cffi/utils.py)15
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/__init__.py (renamed from external_libs/python/zmq/backend/cython/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_device.c3576
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_device.pyx103
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_poll.c4268
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_poll.pyx144
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_version.c1497
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_version.pyx43
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/checkrc.pxd (renamed from external_libs/python/zmq/backend/cython/checkrc.pxd)7
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constant_enums.pxi155
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.c4184
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.pxi316
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.pyx32
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.c4966
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.pxd (renamed from external_libs/python/zmq/backend/cython/context.pxd)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.pyx250
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/error.c1814
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/error.pyx56
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/libzmq.pxd (renamed from external_libs/python/zmq/backend/cython/libzmq.pxd)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.c8243
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.pxd (renamed from external_libs/python/zmq/backend/cython/message.pxd)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.pyx381
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/rebuffer.pyx104
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.c11739
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.pxd (renamed from external_libs/python/zmq/backend/cython/socket.pxd)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.pyx717
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.c2956
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.pxd (renamed from external_libs/python/zmq/backend/cython/utils.pxd)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.pyx119
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/backend/select.py (renamed from external_libs/python/zmq/backend/select.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/devices/__init__.py (renamed from external_libs/python/zmq/devices/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/devices/basedevice.py (renamed from external_libs/python/zmq/devices/basedevice.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.c5941
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.pxd (renamed from external_libs/python/zmq/devices/monitoredqueue.pxd)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.py37
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.pyx110
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueuedevice.py (renamed from external_libs/python/zmq/devices/monitoredqueuedevice.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/devices/proxydevice.py (renamed from external_libs/python/zmq/devices/proxydevice.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/error.py (renamed from external_libs/python/zmq/error.py)29
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/__init__.py (renamed from external_libs/python/zmq/eventloop/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/ioloop.py (renamed from external_libs/python/zmq/eventloop/ioloop.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/__init__.py (renamed from external_libs/python/zmq/eventloop/minitornado/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/concurrent.py (renamed from external_libs/python/zmq/eventloop/minitornado/concurrent.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/ioloop.py (renamed from external_libs/python/zmq/eventloop/minitornado/ioloop.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/log.py (renamed from external_libs/python/zmq/eventloop/minitornado/log.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/__init__.py (renamed from external_libs/python/zmq/eventloop/minitornado/platform/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/auto.py (renamed from external_libs/python/zmq/eventloop/minitornado/platform/auto.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/common.py (renamed from external_libs/python/zmq/eventloop/minitornado/platform/common.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/interface.py (renamed from external_libs/python/zmq/eventloop/minitornado/platform/interface.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/posix.py (renamed from external_libs/python/zmq/eventloop/minitornado/platform/posix.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/windows.py (renamed from external_libs/python/zmq/eventloop/minitornado/platform/windows.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/stack_context.py (renamed from external_libs/python/zmq/eventloop/minitornado/stack_context.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/util.py (renamed from external_libs/python/zmq/eventloop/minitornado/util.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/eventloop/zmqstream.py (renamed from external_libs/python/zmq/eventloop/zmqstream.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/green/__init__.py (renamed from external_libs/python/zmq/green/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/green/core.py (renamed from external_libs/python/zmq/green/core.py)4
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/green/device.py (renamed from external_libs/python/zmq/green/device.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/__init__.py (renamed from external_libs/python/zmq/green/eventloop/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/ioloop.py (renamed from external_libs/python/zmq/green/eventloop/ioloop.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/zmqstream.py (renamed from external_libs/python/zmq/green/eventloop/zmqstream.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/green/poll.py (renamed from external_libs/python/zmq/green/poll.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/log/__init__.py (renamed from external_libs/python/zmq/log/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/log/handlers.py (renamed from external_libs/python/zmq/log/handlers.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/ssh/__init__.py (renamed from external_libs/python/zmq/ssh/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/ssh/forward.py (renamed from external_libs/python/zmq/ssh/forward.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/ssh/tunnel.py (renamed from external_libs/python/zmq/ssh/tunnel.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/__init__.py (renamed from external_libs/python/zmq/sugar/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/attrsettr.py (renamed from external_libs/python/zmq/sugar/attrsettr.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/constants.py (renamed from external_libs/python/zmq/sugar/constants.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/context.py (renamed from external_libs/python/zmq/sugar/context.py)6
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/frame.py (renamed from external_libs/python/zmq/sugar/frame.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/poll.py (renamed from external_libs/python/zmq/sugar/poll.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/socket.py (renamed from external_libs/python/zmq/sugar/socket.py)61
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/tracker.py (renamed from external_libs/python/zmq/sugar/tracker.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/sugar/version.py (renamed from external_libs/python/zmq/sugar/version.py)4
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/__init__.py (renamed from external_libs/python/zmq/tests/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_auth.py (renamed from external_libs/python/zmq/tests/test_auth.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_cffi_backend.py (renamed from external_libs/python/zmq/tests/test_cffi_backend.py)46
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_constants.py (renamed from external_libs/python/zmq/tests/test_constants.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_context.py (renamed from external_libs/python/zmq/tests/test_context.py)15
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_device.py (renamed from external_libs/python/zmq/tests/test_device.py)13
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_error.py (renamed from external_libs/python/zmq/tests/test_error.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_etc.py (renamed from external_libs/python/zmq/tests/test_etc.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_imports.py (renamed from external_libs/python/zmq/tests/test_imports.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_ioloop.py (renamed from external_libs/python/zmq/tests/test_ioloop.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_log.py (renamed from external_libs/python/zmq/tests/test_log.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_message.py (renamed from external_libs/python/zmq/tests/test_message.py)17
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_monitor.py (renamed from external_libs/python/zmq/tests/test_monitor.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_monqueue.py (renamed from external_libs/python/zmq/tests/test_monqueue.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_multipart.py (renamed from external_libs/python/zmq/tests/test_multipart.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_pair.py (renamed from external_libs/python/zmq/tests/test_pair.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_poll.py (renamed from external_libs/python/zmq/tests/test_poll.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_pubsub.py (renamed from external_libs/python/zmq/tests/test_pubsub.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_reqrep.py (renamed from external_libs/python/zmq/tests/test_reqrep.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_retry_eintr.py92
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_security.py (renamed from external_libs/python/zmq/tests/test_security.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_socket.py (renamed from external_libs/python/zmq/tests/test_socket.py)20
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_stopwatch.py (renamed from external_libs/python/zmq/tests/test_stopwatch.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_version.py (renamed from external_libs/python/zmq/tests/test_version.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_win32_shim.py (renamed from external_libs/python/zmq/tests/test_win32_shim.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_z85.py (renamed from external_libs/python/zmq/tests/test_z85.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/tests/test_zmqstream.py (renamed from external_libs/python/zmq/tests/test_zmqstream.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/__init__.py (renamed from external_libs/python/zmq/utils/__init__.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/buffers.pxd (renamed from external_libs/python/zmq/utils/buffers.pxd)1
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/constant_names.py (renamed from external_libs/python/zmq/utils/constant_names.py)4
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/garbage.py (renamed from external_libs/python/zmq/utils/garbage.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/getpid_compat.h (renamed from external_libs/python/zmq/utils/getpid_compat.h)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/interop.py (renamed from external_libs/python/zmq/utils/interop.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/ipcmaxlen.h (renamed from external_libs/python/zmq/utils/ipcmaxlen.h)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/jsonapi.py (renamed from external_libs/python/zmq/utils/jsonapi.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/monitor.py (renamed from external_libs/python/zmq/utils/monitor.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/pyversion_compat.h (renamed from external_libs/python/zmq/utils/pyversion_compat.h)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/sixcerpt.py (renamed from external_libs/python/zmq/utils/sixcerpt.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/strtypes.py (renamed from external_libs/python/zmq/utils/strtypes.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/win32.py (renamed from external_libs/python/zmq/utils/win32.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/z85.py (renamed from external_libs/python/zmq/utils/z85.py)0
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/zmq_compat.h (renamed from external_libs/python/zmq/utils/zmq_compat.h)2
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmq/utils/zmq_constants.h (renamed from external_libs/python/zmq/utils/zmq_constants.h)4
-rw-r--r--external_libs/python/pyzmq-14.7.0/zmqversion.py119
-rw-r--r--external_libs/python/zmq/backend/cython/_device.py7
-rw-r--r--external_libs/python/zmq/backend/cython/_poll.py7
-rw-r--r--external_libs/python/zmq/backend/cython/_version.py7
-rw-r--r--external_libs/python/zmq/backend/cython/constants.py7
-rw-r--r--external_libs/python/zmq/backend/cython/context.py7
-rw-r--r--external_libs/python/zmq/backend/cython/error.py7
-rw-r--r--external_libs/python/zmq/backend/cython/message.py7
-rw-r--r--external_libs/python/zmq/backend/cython/socket.py7
-rw-r--r--external_libs/python/zmq/backend/cython/utils.py7
-rw-r--r--external_libs/python/zmq/devices/monitoredqueue.py7
-rw-r--r--external_libs/python/zmq/utils/compiler.json24
-rw-r--r--external_libs/python/zmq/utils/config.json10
732 files changed, 122141 insertions, 204 deletions
diff --git a/external_libs/python/pyzmq-14.7.0/.travis.yml b/external_libs/python/pyzmq-14.7.0/.travis.yml
new file mode 100644
index 00000000..fb1e8407
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/.travis.yml
@@ -0,0 +1,54 @@
+language: python
+
+cache:
+ apt
+ pip
+python:
+ - 2.7
+ - 3.4
+ - pypy
+env:
+ - ZMQ=
+ - ZMQ=bundled
+before_install:
+ - sudo add-apt-repository -y ppa:shnatsel/dnscrypt
+ - sudo apt-get update
+ - 'if [[ $ZMQ != bundled ]]; then sudo apt-get install -qq libzmq3-dev libsodium-dev; fi'
+ - 'if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then wget https://github.com/minrk/travis-wheels/archive/master.zip -O wheels.zip && unzip wheels.zip; fi'
+ - 'if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then pip install -q -f travis-wheels-master/wheelhouse cython; fi'
+ - 'if [[ ! -z "$ZMQ" && $ZMQ != bundled ]]; then wget https://github.com/zeromq/$ZMQ/archive/master.zip -O libzmq.zip && unzip libzmq.zip; fi'
+ - 'if [[ ! -z "$ZMQ" && $ZMQ != bundled ]]; then sh -c "set -x; cd $ZMQ-master; sh autogen.sh; ./configure; make -j; sudo make install; sudo ldconfig"; fi'
+ - 'if [[ $TRAVIS_PYTHON_VERSION = 2.7 ]]; then pip install -q -f travis-wheels-master/wheelhouse gevent; fi'
+ - pip install -q nose
+
+install:
+ - 'if [[ ! -z "$ZMQ" && $ZMQ != bundled ]]; then export ZMQ=/usr/local; fi'
+ - python setup.py build_ext --inplace --zmq=$ZMQ
+
+matrix:
+ include:
+ - python: 3.4
+ env: ZMQ=libzmq
+ - python: 3.4
+ env: ZMQ=zeromq4-x
+ - python: 3.4
+ env: ZMQ=zeromq4-1
+ - python: 3.4
+ env: ZMQ=zeromq3-x
+ - python: 2.6
+ env: ZMQ=
+ - python: 3.2
+ env: ZMQ=
+ - python: 3.3
+ env: ZMQ=
+ - python: pypy3
+ env: ZMQ=
+ - python: nightly
+ env: ZMQ=
+ - python: nightly
+ env: ZMQ=bundled
+ allow_failures:
+ - env: ZMQ=libzmq
+ - python: nightly
+
+script: python setup.py test
diff --git a/external_libs/python/pyzmq-14.7.0/AUTHORS.md b/external_libs/python/pyzmq-14.7.0/AUTHORS.md
new file mode 100644
index 00000000..d6b5ee01
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/AUTHORS.md
@@ -0,0 +1,110 @@
+## Authors
+
+This project was started and continues to be led by Brian E. Granger
+(ellisonbg AT gmail DOT com). Min Ragan-Kelley (benjaminrk AT gmail DOT
+com) is the primary developer of pyzmq at this time.
+
+The following people have contributed to the project:
+
+- Alexander Else (alexander DOT else AT team DOT telstra DOT com)
+- Alexander Pyhalov (apyhalov AT gmail DOT com)
+- Alexandr Emelin (frvzmb AT gmail DOT com)
+- Amr Ali (amr AT ledgerx DOT com)
+- Andre Caron (andre DOT l DOT caron AT gmail DOT com)
+- Andrea Crotti (andrea DOT crotti DOT 0 AT gmail DOT com)
+- Andrew Gwozdziewycz (git AT apgwoz DOT com)
+- Baptiste Lepilleur (baptiste DOT lepilleur AT gmail DOT com)
+- Brandyn A. White (bwhite AT dappervision DOT com)
+- Brian E. Granger (ellisonbg AT gmail DOT com)
+- Brian Hoffman (hoffman_brian AT bah DOT com)
+- Carlos A. Rocha (carlos DOT rocha AT gmail DOT com)
+- Chris Laws (clawsicus AT gmail DOT com)
+- Christian Wyglendowski (christian AT bu DOT mp)
+- Christoph Gohlke (cgohlke AT uci DOT edu)
+- Curtis (curtis AT tinbrain DOT net)
+- Cyril Holweck (cyril DOT holweck AT free DOT fr)
+- Dan Colish (dcolish AT gmail DOT com)
+- Daniel Lundin (dln AT eintr DOT org)
+- Daniel Truemper (truemped AT googlemail DOT com)
+- Douglas Creager (douglas DOT creager AT redjack DOT com)
+- Eduardo Stalinho (eduardooc DOT 86 AT gmail DOT com)
+- Eren Güven (erenguven0 AT gmail DOT com)
+- Erick Tryzelaar (erick DOT tryzelaar AT gmail DOT com)
+- Erik Tollerud (erik DOT tollerud AT gmail DOT com)
+- FELD Boris (lothiraldan AT gmail DOT com)
+- Fantix King (fantix DOT king AT gmail DOT com)
+- Felipe Cruz (felipecruz AT loogica DOT net)
+- Fernando Perez (Fernando DOT Perez AT berkeley DOT edu)
+- Frank Wiles (frank AT revsys DOT com)
+- Félix-Antoine Fortin (felix DOT antoine DOT fortin AT gmail DOT com)
+- Gavrie Philipson (gavriep AT il DOT ibm DOT com)
+- Godefroid Chapelle (gotcha AT bubblenet DOT be)
+- Greg Banks (gbanks AT mybasis DOT com)
+- Greg Ward (greg AT gerg DOT ca)
+- Guido Goldstein (github AT a-nugget DOT de)
+- Ian Lee (IanLee1521 AT gmail DOT com)
+- Ionuț Arțăriși (ionut AT artarisi DOT eu)
+- Ivo Danihelka (ivo AT danihelka DOT net)
+- Iyed (iyed DOT bennour AT gmail DOT com)
+- Jim Garrison (jim AT garrison DOT cc)
+- John Gallagher (johnkgallagher AT gmail DOT com)
+- Julian Taylor (jtaylor DOT debian AT googlemail DOT com)
+- Justin Bronder (jsbronder AT gmail DOT com)
+- Justin Riley (justin DOT t DOT riley AT gmail DOT com)
+- Marc Abramowitz (marc AT marc-abramowitz DOT com)
+- Matthew Aburn (mattja6 AT gmail DOT com)
+- Michel Pelletier (pelletier DOT michel AT gmail DOT com)
+- Michel Zou (xantares09 AT hotmail DOT com)
+- Min Ragan-Kelley (benjaminrk AT gmail DOT com)
+- Nell Hardcastle (nell AT dev-nell DOT com)
+- Nicholas Pilkington (nicholas DOT pilkington AT gmail DOT com)
+- Nicholas Piël (nicholas AT nichol DOT as)
+- Nick Pellegrino (npellegrino AT mozilla DOT com)
+- Nicolas Delaby (nicolas DOT delaby AT ezeep DOT com)
+- Ondrej Certik (ondrej AT certik DOT cz)
+- Paul Colomiets (paul AT colomiets DOT name)
+- Pawel Jasinski (pawel DOT jasinski AT gmail DOT com)
+- Phus Lu (phus DOT lu AT gmail DOT com)
+- Robert Buchholz (rbu AT goodpoint DOT de)
+- Robert Jordens (jordens AT gmail DOT com)
+- Ryan Cox (ryan DOT a DOT cox AT gmail DOT com)
+- Ryan Kelly (ryan AT rfk DOT id DOT au)
+- Scott Maxwell (scott AT codecobblers DOT com)
+- Scott Sadler (github AT mashi DOT org)
+- Simon Knight (simon DOT knight AT gmail DOT com)
+- Stefan Friesel (sf AT cloudcontrol DOT de)
+- Stefan van der Walt (stefan AT sun DOT ac DOT za)
+- Stephen Diehl (stephen DOT m DOT diehl AT gmail DOT com)
+- Sylvain Corlay (scorlay AT bloomberg DOT net)
+- Thomas Kluyver (takowl AT gmail DOT com)
+- Thomas Spura (tomspur AT fedoraproject DOT org)
+- Tigger Bear (Tigger AT Tiggers-Mac-mini DOT local)
+- Torsten Landschoff (torsten DOT landschoff AT dynamore DOT de)
+- Vadim Markovtsev (v DOT markovtsev AT samsung DOT com)
+- Yannick Hold (yannickhold AT gmail DOT com)
+- Zbigniew Jędrzejewski-Szmek (zbyszek AT in DOT waw DOT pl)
+- hugo shi (hugoshi AT bleb2 DOT (none))
+- jdgleeson (jdgleeson AT mac DOT com)
+- kyledj (kyle AT bucebuce DOT com)
+- spez (steve AT hipmunk DOT com)
+- stu (stuart DOT axon AT jpcreative DOT co DOT uk)
+- xantares (xantares AT fujitsu-l64 DOT (none))
+
+as reported by:
+
+ git log --all --format='- %aN (%aE)' | sort -u | sed 's/@/ AT /1' | sed -e 's/\.\([^ ]\)/ DOT \1/g'
+
+with some adjustments.
+
+### Not in git log
+
+- Brandon Craig-Rhodes (brandon AT rhodesmill DOT org)
+- Eugene Chernyshov (chernyshov DOT eugene AT gmail DOT com)
+- Craig Austin (craig DOT austin AT gmail DOT com)
+
+### gevent\_zeromq, now zmq.green
+
+- Travis Cline (travis DOT cline AT gmail DOT com)
+- Ryan Kelly (ryan AT rfk DOT id DOT au)
+- Zachary Voase (z AT zacharyvoase DOT com)
+
diff --git a/external_libs/python/pyzmq-14.7.0/CONTRIBUTING.md b/external_libs/python/pyzmq-14.7.0/CONTRIBUTING.md
new file mode 100644
index 00000000..688a6c3c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/CONTRIBUTING.md
@@ -0,0 +1,86 @@
+# Opening an Issue
+
+For a good bug report:
+
+1. [Search][] for existing Issues, both on GitHub and in general with Google/Stack Overflow before posting a duplicate question.
+2. Update to pyzmq master, if possible, especially if you are already using git. It's
+ possible that the bug you are about to report has already been fixed.
+
+Many things reported as pyzmq Issues are often just libzmq-related,
+and don't have anything to do with pyzmq itself.
+These are better directed to [zeromq-dev][].
+
+When making a bug report, it is helpful to tell us as much as you can about your system
+(such as pyzmq version, libzmq version, Python version, OS Version, how you built/installed pyzmq and libzmq, etc.)
+
+The basics:
+
+```python
+import sys
+import zmq
+
+print "libzmq-%s" % zmq.zmq_version()
+print "pyzmq-%s" % zmq.pyzmq_version()
+print "Python-%s" % sys.version
+```
+
+Which will give something like:
+
+ libzmq-3.3.0
+ pyzmq-2.2dev
+ Python-2.7.2 (default, Jun 20 2012, 16:23:33)
+ [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
+
+[search]: https://github.com/zeromq/pyzmq/issues
+[zeromq-dev]: mailto:zeromq-dev@zeromq.org
+
+
+# Licensing and contributing to PyZMQ
+
+PyZMQ uses different licenses for different parts of the code.
+
+The 'core' of PyZMQ (located in zmq/core) is licensed under LGPLv3.
+This just means that if you make any changes to how that code works,
+you must release those changes under the LGPL.
+If you just *use* pyzmq, then you can use any license you want for your own code.
+
+We don't feel that the restrictions imposed by the LGPL make sense for the
+'non-core' functionality in pyzmq (derivative code must *also* be LGPL or GPL),
+especially for examples and utility code, so we have relicensed all 'non-core'
+code under the more permissive BSD (specifically Modified BSD aka New BSD aka
+3-clause BSD), where possible. This means that you can copy this code and build
+your own apps without needing to license your own code with the LGPL or GPL.
+
+## Your contributions
+
+**Pull Requests are welcome!**
+
+When you contribute to PyZMQ, your contributions are made under the same
+license as the file you are working on. Any new, original code should be BSD
+licensed.
+
+We don't enforce strict style, but when in doubt [PEP8][] is a good guideline.
+The only thing we really don't like is mixing up 'cleanup' in real work.
+
+Examples are copyright their respective authors, and BSD unless otherwise
+specified by the author. You can LGPL (or GPL or MIT or Apache, etc.) your own new
+examples if you like, but we strongly encourage using the default BSD license.
+
+[PEP8]: http://www.python.org/dev/peps/pep-0008
+
+## Inherited licenses in pyzmq
+
+Some code outside the core is taken from other open-source projects, and
+inherits that project's license.
+
+* zmq/eventloop contains files inherited and adapted from [tornado][], and inherits the Apache license
+
+* zmq/ssh/forward.py is from [paramiko][], and inherits LGPL
+
+* zmq/devices/monitoredqueue.pxd is derived from the zmq_device function in
+libzmq, and inherits LGPL
+
+* perf examples are (c) iMatix, and LGPL
+
+[tornado]: http://www.tornadoweb.org
+[paramiko]: http://www.lag.net/paramiko \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/COPYING.BSD b/external_libs/python/pyzmq-14.7.0/COPYING.BSD
new file mode 100644
index 00000000..a0a3790b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/COPYING.BSD
@@ -0,0 +1,32 @@
+PyZMQ is licensed under the terms of the Modified BSD License (also known as
+New or Revised BSD), as follows:
+
+Copyright (c) 2009-2012, Brian Granger, Min Ragan-Kelley
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+Neither the name of PyZMQ nor the names of its contributors may be used to
+endorse or promote products derived from this software without specific prior
+written permission.
+
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/external_libs/python/pyzmq-14.7.0/COPYING.LESSER b/external_libs/python/pyzmq-14.7.0/COPYING.LESSER
new file mode 100644
index 00000000..3462706c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/COPYING.LESSER
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library. \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/MANIFEST.in b/external_libs/python/pyzmq-14.7.0/MANIFEST.in
new file mode 100644
index 00000000..7e24b390
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/MANIFEST.in
@@ -0,0 +1,50 @@
+include COPYING.BSD
+include COPYING.LESSER
+include CONTRIBUTING.md
+include MANIFEST.in
+include README.md
+include AUTHORS.md
+include setup.cfg.template
+include setup.cfg.android
+include setup.py
+include setupegg.py
+include zmqversion.py
+include tox.ini
+include .travis.yml
+
+graft docs
+graft tools
+prune docs/build
+prune docs/gh-pages
+
+include bundled/zeromq/COPYING
+graft bundled/zeromq/include
+graft bundled/zeromq/src
+include bundled/zeromq/builds/msvc/platform.hpp
+exclude bundled/zeromq/src/Makefile*
+exclude bundled/zeromq/src/platform.hpp
+
+include bundled/libsodium/LICENSE
+graft bundled/libsodium/src
+
+graft buildutils
+graft examples
+graft zmq
+graft perf
+
+exclude setup.cfg
+exclude zmq/libzmq*
+# exclude docs/_static
+# exclude docs/_templates
+
+global-exclude __pycache__/*
+global-exclude .deps/*
+global-exclude *.so
+global-exclude *.pyd
+global-exclude *.pyc
+global-exclude .git*
+global-exclude .DS_Store
+global-exclude .mailmap
+global-exclude Makefile.am
+global-exclude Makefile.in
+
diff --git a/external_libs/python/pyzmq-14.7.0/PKG-INFO b/external_libs/python/pyzmq-14.7.0/PKG-INFO
new file mode 100644
index 00000000..76af4b10
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/PKG-INFO
@@ -0,0 +1,30 @@
+Metadata-Version: 1.1
+Name: pyzmq
+Version: 14.7.0
+Summary: Python bindings for 0MQ
+Home-page: http://github.com/zeromq/pyzmq
+Author: Brian E. Granger, Min Ragan-Kelley
+Author-email: zeromq-dev@lists.zeromq.org
+License: LGPL+BSD
+Download-URL: http://github.com/zeromq/pyzmq/releases
+Description:
+ PyZMQ is the official Python binding for the ZeroMQ Messaging Library (http://www.zeromq.org).
+
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Science/Research
+Classifier: Intended Audience :: System Administrators
+Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX
+Classifier: Topic :: System :: Networking
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff --git a/external_libs/python/pyzmq-14.7.0/README.md b/external_libs/python/pyzmq-14.7.0/README.md
new file mode 100644
index 00000000..d85fb05a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/README.md
@@ -0,0 +1,88 @@
+# PyZMQ: Python bindings for ØMQ
+
+[![Build Status](https://travis-ci.org/zeromq/pyzmq.svg?branch=master)](https://travis-ci.org/zeromq/pyzmq)
+
+This package contains Python bindings for [ØMQ](http://www.zeromq.org).
+ØMQ is a lightweight and fast messaging implementation.
+
+PyZMQ should work with any Python ≥ 2.6 (including Python 3), as well as PyPy.
+The Cython backend used by CPython supports libzmq ≥ 2.1.4 (including 3.2.x and 4.x),
+but the CFFI backend used by PyPy only supports libzmq ≥ 3.2.2 (including 4.x).
+
+For a summary of changes to pyzmq, see our
+[changelog](https://pyzmq.readthedocs.org/en/latest/changelog.html).
+
+### ØMQ 3.x, 4.x
+
+PyZMQ ≥ 2.2.0 fully supports the 3.x and 4.x APIs of libzmq,
+developed at [zeromq/libzmq](https://github.com/zeromq/libzmq).
+No code to change, no flags to pass,
+just build pyzmq against the latest and it should work.
+
+PyZMQ does not support the old libzmq 2 API on PyPy.
+
+## Documentation
+
+See PyZMQ's Sphinx-generated
+[documentation](http://zeromq.github.com/pyzmq) on GitHub for API
+details, and some notes on Python and Cython development. If you want to
+learn about using ØMQ in general, the excellent [ØMQ
+Guide](http://zguide.zeromq.org/py:all) is the place to start, which has a
+Python version of every example. We also have some information on our
+[wiki](https://github.com/zeromq/pyzmq/wiki).
+
+## Downloading
+
+Unless you specifically want to develop PyZMQ, we recommend downloading
+the PyZMQ source code or wheels from
+[PyPI](http://pypi.python.org/pypi/pyzmq). On Windows, you can get `.exe` installers
+from [Christoph Gohlke](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyzmq).
+
+You can also get the latest source code from our GitHub repository, but
+building from the repository will require that you install Cython
+version 0.16 or later.
+
+## Building and installation
+
+For more detail on building pyzmq, see [our Wiki](https://github.com/zeromq/pyzmq/wiki/Building-and-Installing-PyZMQ).
+
+We build wheels for OS X and Windows, so you can get a binary on those platforms with:
+
+ pip install pyzmq
+
+but compiling from source with `pip install pyzmq` should work in most environments.
+Especially on OS X, make sure you are using the latest pip (≥ 6), or it may not find the right wheels.
+
+If the wheel doesn't work for some reason, or you want to force pyzmq to be compiled
+(this is often preferable if you already have libzmq installed and configured the way you want it),
+you can force installation with:
+
+ pip install --no-use-wheel pyzmq
+
+When compiling pyzmq (e.g. installing with pip on Linux),
+it is generally recommended that zeromq be installed separately,
+via homebrew, apt, yum, etc:
+
+ # Debian-based
+ sudo apt-get install libzmq3-dev
+
+ # RHEL-based
+ sudo yum install libzmq3-devel
+
+If this is not available, pyzmq will *try* to build libzmq as a Python Extension,
+though this is not guaranteed to work.
+
+Building pyzmq from the git repo (including release tags on GitHub) requires Cython.
+
+## Old versions
+
+For libzmq 2.0.x, use pyzmq release 2.0.10.1.
+
+pyzmq-2.1.11 was the last version of pyzmq to support Python 2.5,
+and pyzmq ≥ 2.2.0 requires Python ≥ 2.6.
+pyzmq-13.0.0 introduces PyPy support via CFFI, which only supports libzmq-3.2.2 and newer.
+
+PyZMQ releases ≤ 2.2.0 matched libzmq versioning, but this is no longer the case,
+starting with PyZMQ 13.0.0 (it was the thirteenth release, so why not?).
+PyZMQ ≥ 13.0 follows semantic versioning conventions accounting only for PyZMQ itself.
+
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/__init__.py b/external_libs/python/pyzmq-14.7.0/buildutils/__init__.py
new file mode 100644
index 00000000..699e9178
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/__init__.py
@@ -0,0 +1,11 @@
+"""utilities for building pyzmq.
+
+Largely adapted from h5py
+"""
+
+from .msg import *
+from .config import *
+from .detect import *
+from .bundle import *
+from .misc import *
+from .patch import * \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/bundle.py b/external_libs/python/pyzmq-14.7.0/buildutils/bundle.py
new file mode 100644
index 00000000..7d2f6df7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/bundle.py
@@ -0,0 +1,223 @@
+"""utilities for fetching build dependencies."""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+#
+# This bundling code is largely adapted from pyzmq-static's get.sh by
+# Brandon Craig-Rhodes, which is itself BSD licensed.
+#-----------------------------------------------------------------------------
+
+
+import os
+import shutil
+import stat
+import sys
+import tarfile
+from glob import glob
+import hashlib
+from subprocess import Popen, PIPE
+
+try:
+ # py2
+ from urllib2 import urlopen
+except ImportError:
+ # py3
+ from urllib.request import urlopen
+
+from .msg import fatal, debug, info, warn
+
+pjoin = os.path.join
+
+#-----------------------------------------------------------------------------
+# Constants
+#-----------------------------------------------------------------------------
+
+bundled_version = (4,1,2)
+libzmq = "zeromq-%i.%i.%i.tar.gz" % (bundled_version)
+libzmq_url = "http://download.zeromq.org/" + libzmq
+libzmq_checksum = "sha256:f9162ead6d68521e5154d871bac304f88857308bb02366b81bb588497a345927"
+
+libsodium_version = (1,0,2)
+libsodium = "libsodium-%i.%i.%i.tar.gz" % (libsodium_version)
+libsodium_url = "https://github.com/jedisct1/libsodium/releases/download/%i.%i.%i/" % libsodium_version + libsodium
+libsodium_checksum = "sha256:961d8f10047f545ae658bcc73b8ab0bf2c312ac945968dd579d87c768e5baa19"
+
+HERE = os.path.dirname(__file__)
+ROOT = os.path.dirname(HERE)
+
+#-----------------------------------------------------------------------------
+# Utilities
+#-----------------------------------------------------------------------------
+
+
+def untgz(archive):
+ return archive.replace('.tar.gz', '')
+
+def localpath(*args):
+ """construct an absolute path from a list relative to the root pyzmq directory"""
+ plist = [ROOT] + list(args)
+ return os.path.abspath(pjoin(*plist))
+
+def checksum_file(scheme, path):
+ """Return the checksum (hex digest) of a file"""
+ h = getattr(hashlib, scheme)()
+
+ with open(path, 'rb') as f:
+ chunk = f.read(65535)
+ while chunk:
+ h.update(chunk)
+ chunk = f.read(65535)
+ return h.hexdigest()
+
+def fetch_archive(savedir, url, fname, checksum, force=False):
+ """download an archive to a specific location"""
+ dest = pjoin(savedir, fname)
+ scheme, digest_ref = checksum.split(':')
+
+ if os.path.exists(dest) and not force:
+ info("already have %s" % dest)
+ digest = checksum_file(scheme, fname)
+ if digest == digest_ref:
+ return dest
+ else:
+ warn("but checksum %s != %s, redownloading." % (digest, digest_ref))
+ os.remove(fname)
+
+ info("fetching %s into %s" % (url, savedir))
+ if not os.path.exists(savedir):
+ os.makedirs(savedir)
+ req = urlopen(url)
+ with open(dest, 'wb') as f:
+ f.write(req.read())
+ digest = checksum_file(scheme, dest)
+ if digest != digest_ref:
+ fatal("%s %s mismatch:\nExpected: %s\nActual : %s" % (
+ dest, scheme, digest_ref, digest))
+ return dest
+
+#-----------------------------------------------------------------------------
+# libsodium
+#-----------------------------------------------------------------------------
+
+def fetch_libsodium(savedir):
+ """download and extract libsodium"""
+ dest = pjoin(savedir, 'libsodium')
+ if os.path.exists(dest):
+ info("already have %s" % dest)
+ return
+ path = fetch_archive(savedir, libsodium_url, fname=libsodium, checksum=libsodium_checksum)
+ tf = tarfile.open(path)
+ with_version = pjoin(savedir, tf.firstmember.path)
+ tf.extractall(savedir)
+ tf.close()
+ # remove version suffix:
+ shutil.move(with_version, dest)
+
+def stage_libsodium_headers(libsodium_root):
+ """stage configure headers for libsodium"""
+ src_dir = pjoin(HERE, 'include_sodium')
+ dest_dir = pjoin(libsodium_root, 'src', 'libsodium', 'include', 'sodium')
+ for src in glob(pjoin(src_dir, '*.h')):
+ base = os.path.basename(src)
+ dest = pjoin(dest_dir, base)
+ if os.path.exists(dest):
+ info("already have %s" % base)
+ continue
+ info("staging %s to %s" % (src, dest))
+ shutil.copy(src, dest)
+
+#-----------------------------------------------------------------------------
+# libzmq
+#-----------------------------------------------------------------------------
+
+def fetch_libzmq(savedir):
+ """download and extract libzmq"""
+ dest = pjoin(savedir, 'zeromq')
+ if os.path.exists(dest):
+ info("already have %s" % dest)
+ return
+ path = fetch_archive(savedir, libzmq_url, fname=libzmq, checksum=libzmq_checksum)
+ tf = tarfile.open(path)
+ with_version = pjoin(savedir, tf.firstmember.path)
+ tf.extractall(savedir)
+ tf.close()
+ # remove version suffix:
+ shutil.move(with_version, dest)
+
+def stage_platform_hpp(zmqroot):
+ """stage platform.hpp into libzmq sources
+
+ Tries ./configure first (except on Windows),
+ then falls back on included platform.hpp previously generated.
+ """
+
+ platform_hpp = pjoin(zmqroot, 'src', 'platform.hpp')
+ if os.path.exists(platform_hpp):
+ info("already have platform.hpp")
+ return
+ if os.name == 'nt':
+ # stage msvc platform header
+ platform_dir = pjoin(zmqroot, 'builds', 'msvc')
+ else:
+ info("attempting ./configure to generate platform.hpp")
+
+ p = Popen('./configure', cwd=zmqroot, shell=True,
+ stdout=PIPE, stderr=PIPE,
+ )
+ o,e = p.communicate()
+ if p.returncode:
+ warn("failed to configure libzmq:\n%s" % e)
+ if sys.platform == 'darwin':
+ platform_dir = pjoin(HERE, 'include_darwin')
+ elif sys.platform.startswith('freebsd'):
+ platform_dir = pjoin(HERE, 'include_freebsd')
+ elif sys.platform.startswith('linux-armv'):
+ platform_dir = pjoin(HERE, 'include_linux-armv')
+ else:
+ platform_dir = pjoin(HERE, 'include_linux')
+ else:
+ return
+
+ info("staging platform.hpp from: %s" % platform_dir)
+ shutil.copy(pjoin(platform_dir, 'platform.hpp'), platform_hpp)
+
+
+def copy_and_patch_libzmq(ZMQ, libzmq):
+ """copy libzmq into source dir, and patch it if necessary.
+
+ This command is necessary prior to running a bdist on Linux or OS X.
+ """
+ if sys.platform.startswith('win'):
+ return
+ # copy libzmq into zmq for bdist
+ local = localpath('zmq',libzmq)
+ if not ZMQ and not os.path.exists(local):
+ fatal("Please specify zmq prefix via `setup.py configure --zmq=/path/to/zmq` "
+ "or copy libzmq into zmq/ manually prior to running bdist.")
+ try:
+ # resolve real file through symlinks
+ lib = os.path.realpath(pjoin(ZMQ, 'lib', libzmq))
+ print ("copying %s -> %s"%(lib, local))
+ shutil.copy(lib, local)
+ except Exception:
+ if not os.path.exists(local):
+ fatal("Could not copy libzmq into zmq/, which is necessary for bdist. "
+ "Please specify zmq prefix via `setup.py configure --zmq=/path/to/zmq` "
+ "or copy libzmq into zmq/ manually.")
+
+ if sys.platform == 'darwin':
+ # chmod u+w on the lib,
+ # which can be user-read-only for some reason
+ mode = os.stat(local).st_mode
+ os.chmod(local, mode | stat.S_IWUSR)
+ # patch install_name on darwin, instead of using rpath
+ cmd = ['install_name_tool', '-id', '@loader_path/../%s'%libzmq, local]
+ try:
+ p = Popen(cmd, stdout=PIPE,stderr=PIPE)
+ except OSError:
+ fatal("install_name_tool not found, cannot patch libzmq for bundling.")
+ out,err = p.communicate()
+ if p.returncode:
+ fatal("Could not patch bundled libzmq install_name: %s"%err, p.returncode)
+
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/check_sys_un.c b/external_libs/python/pyzmq-14.7.0/buildutils/check_sys_un.c
new file mode 100644
index 00000000..8c013c41
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/check_sys_un.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include "sys/un.h"
+
+int main(int argc, char **argv) {
+ struct sockaddr_un *dummy;
+ printf("%lu\n", sizeof(dummy->sun_path) - 1);
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/config.py b/external_libs/python/pyzmq-14.7.0/buildutils/config.py
new file mode 100644
index 00000000..c674655a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/config.py
@@ -0,0 +1,157 @@
+"""Config functions"""
+#-----------------------------------------------------------------------------
+# Copyright (C) PyZMQ Developers
+#
+# This file is part of pyzmq, copied and adapted from h5py.
+# h5py source used under the New BSD license
+#
+# h5py: <http://code.google.com/p/h5py/>
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import sys
+import os
+import json
+
+try:
+ from configparser import ConfigParser
+except:
+ from ConfigParser import ConfigParser
+
+pjoin = os.path.join
+from .msg import debug, fatal, warn
+
+#-----------------------------------------------------------------------------
+# Utility functions (adapted from h5py: http://h5py.googlecode.com)
+#-----------------------------------------------------------------------------
+
+
+def load_config(name, base='conf'):
+ """Load config dict from JSON"""
+ fname = pjoin(base, name + '.json')
+ if not os.path.exists(fname):
+ return {}
+ try:
+ with open(fname) as f:
+ cfg = json.load(f)
+ except Exception as e:
+ warn("Couldn't load %s: %s" % (fname, e))
+ cfg = {}
+ return cfg
+
+
+def save_config(name, data, base='conf'):
+ """Save config dict to JSON"""
+ if not os.path.exists(base):
+ os.mkdir(base)
+ fname = pjoin(base, name+'.json')
+ with open(fname, 'w') as f:
+ json.dump(data, f, indent=2)
+
+
+def v_str(v_tuple):
+ """turn (2,0,1) into '2.0.1'."""
+ return ".".join(str(x) for x in v_tuple)
+
+def get_eargs():
+ """ Look for options in environment vars """
+
+ settings = {}
+
+ zmq = os.environ.get("ZMQ_PREFIX", None)
+ if zmq is not None:
+ debug("Found environ var ZMQ_PREFIX=%s" % zmq)
+ settings['zmq_prefix'] = zmq
+
+ return settings
+
+def cfg2dict(cfg):
+ """turn a ConfigParser into a nested dict
+
+ because ConfigParser objects are dumb.
+ """
+ d = {}
+ for section in cfg.sections():
+ d[section] = dict(cfg.items(section))
+ return d
+
+def get_cfg_args():
+ """ Look for options in setup.cfg """
+
+ if not os.path.exists('setup.cfg'):
+ return {}
+ cfg = ConfigParser()
+ cfg.read('setup.cfg')
+ cfg = cfg2dict(cfg)
+
+ g = cfg.setdefault('global', {})
+ # boolean keys:
+ for key in ['libzmq_extension',
+ 'bundle_libzmq_dylib',
+ 'no_libzmq_extension',
+ 'have_sys_un_h',
+ 'skip_check_zmq',
+ ]:
+ if key in g:
+ g[key] = eval(g[key])
+
+ # globals go to top level
+ cfg.update(cfg.pop('global'))
+ return cfg
+
+def config_from_prefix(prefix):
+ """Get config from zmq prefix"""
+ settings = {}
+ if prefix.lower() in ('default', 'auto', ''):
+ settings['zmq_prefix'] = ''
+ settings['libzmq_extension'] = False
+ settings['no_libzmq_extension'] = False
+ elif prefix.lower() in ('bundled', 'extension'):
+ settings['zmq_prefix'] = ''
+ settings['libzmq_extension'] = True
+ settings['no_libzmq_extension'] = False
+ else:
+ settings['zmq_prefix'] = prefix
+ settings['libzmq_extension'] = False
+ settings['no_libzmq_extension'] = True
+ return settings
+
+def merge(into, d):
+ """merge two containers
+
+ into is updated, d has priority
+ """
+ if isinstance(into, dict):
+ for key in d.keys():
+ if key not in into:
+ into[key] = d[key]
+ else:
+ into[key] = merge(into[key], d[key])
+ return into
+ elif isinstance(into, list):
+ return into + d
+ else:
+ return d
+
+def discover_settings(conf_base=None):
+ """ Discover custom settings for ZMQ path"""
+ settings = {
+ 'zmq_prefix': '',
+ 'libzmq_extension': False,
+ 'no_libzmq_extension': False,
+ 'skip_check_zmq': False,
+ 'build_ext': {},
+ 'bdist_egg': {},
+ }
+ if sys.platform.startswith('win'):
+ settings['have_sys_un_h'] = False
+
+ if conf_base:
+ # lowest priority
+ merge(settings, load_config('config', conf_base))
+ merge(settings, get_cfg_args())
+ merge(settings, get_eargs())
+
+ return settings
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/constants.py b/external_libs/python/pyzmq-14.7.0/buildutils/constants.py
new file mode 100644
index 00000000..e98c650b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/constants.py
@@ -0,0 +1,83 @@
+"""
+script for generating files that involve repetitive updates for zmq constants.
+
+Run this after updating utils/constant_names
+
+Currently generates the following files from templates:
+
+- constant_enums.pxi
+- constants.pxi
+- zmq_constants.h
+
+"""
+
+# Copyright (C) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+
+import os
+import sys
+
+from . import info
+pjoin = os.path.join
+
+root = os.path.abspath(pjoin(os.path.dirname(__file__), os.path.pardir))
+
+sys.path.insert(0, pjoin(root, 'zmq', 'utils'))
+from constant_names import all_names, no_prefix
+
+ifndef_t = """#ifndef {0}
+ #define {0} (_PYZMQ_UNDEFINED)
+#endif
+"""
+
+def cython_enums():
+ """generate `enum: ZMQ_CONST` block for constant_enums.pxi"""
+ lines = []
+ for name in all_names:
+ if no_prefix(name):
+ lines.append('enum: ZMQ_{0} "{0}"'.format(name))
+ else:
+ lines.append('enum: ZMQ_{0}'.format(name))
+
+ return dict(ZMQ_ENUMS='\n '.join(lines))
+
+def ifndefs():
+ """generate `#ifndef ZMQ_CONST` block for zmq_constants.h"""
+ lines = ['#define _PYZMQ_UNDEFINED (-9999)']
+ for name in all_names:
+ if not no_prefix(name):
+ name = 'ZMQ_%s' % name
+ lines.append(ifndef_t.format(name))
+ return dict(ZMQ_IFNDEFS='\n'.join(lines))
+
+def constants_pyx():
+ """generate CONST = ZMQ_CONST and __all__ for constants.pxi"""
+ all_lines = []
+ assign_lines = []
+ for name in all_names:
+ if name == "NULL":
+ # avoid conflict with NULL in Cython
+ assign_lines.append("globals()['NULL'] = ZMQ_NULL")
+ else:
+ assign_lines.append('{0} = ZMQ_{0}'.format(name))
+ all_lines.append(' "{0}",'.format(name))
+ return dict(ASSIGNMENTS='\n'.join(assign_lines), ALL='\n'.join(all_lines))
+
+def generate_file(fname, ns_func, dest_dir="."):
+ """generate a constants file from its template"""
+ with open(pjoin(root, 'buildutils', 'templates', '%s' % fname), 'r') as f:
+ tpl = f.read()
+ out = tpl.format(**ns_func())
+ dest = pjoin(dest_dir, fname)
+ info("generating %s from template" % dest)
+ with open(dest, 'w') as f:
+ f.write(out)
+
+def render_constants():
+ """render generated constant files from templates"""
+ generate_file("constant_enums.pxi", cython_enums, pjoin(root, 'zmq', 'backend', 'cython'))
+ generate_file("constants.pxi", constants_pyx, pjoin(root, 'zmq', 'backend', 'cython'))
+ generate_file("zmq_constants.h", ifndefs, pjoin(root, 'zmq', 'utils'))
+
+if __name__ == '__main__':
+ render_constants()
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/detect.py b/external_libs/python/pyzmq-14.7.0/buildutils/detect.py
new file mode 100644
index 00000000..7a6c115a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/detect.py
@@ -0,0 +1,136 @@
+"""Detect zmq version"""
+#-----------------------------------------------------------------------------
+# Copyright (C) PyZMQ Developers
+#
+# This file is part of pyzmq, copied and adapted from h5py.
+# h5py source used under the New BSD license
+#
+# h5py: <http://code.google.com/p/h5py/>
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import shutil
+import sys
+import os
+import logging
+import platform
+from distutils import ccompiler
+from subprocess import Popen, PIPE
+
+from .misc import get_compiler, get_output_error
+from .patch import patch_lib_paths
+
+pjoin = os.path.join
+
+#-----------------------------------------------------------------------------
+# Utility functions (adapted from h5py: http://h5py.googlecode.com)
+#-----------------------------------------------------------------------------
+
+def test_compilation(cfile, compiler=None, **compiler_attrs):
+ """Test simple compilation with given settings"""
+ cc = get_compiler(compiler, **compiler_attrs)
+
+ efile, ext = os.path.splitext(cfile)
+
+ cpreargs = lpreargs = None
+ if sys.platform == 'darwin':
+ # use appropriate arch for compiler
+ if platform.architecture()[0]=='32bit':
+ if platform.processor() == 'powerpc':
+ cpu = 'ppc'
+ else:
+ cpu = 'i386'
+ cpreargs = ['-arch', cpu]
+ lpreargs = ['-arch', cpu, '-undefined', 'dynamic_lookup']
+ else:
+ # allow for missing UB arch, since it will still work:
+ lpreargs = ['-undefined', 'dynamic_lookup']
+ if sys.platform == 'sunos5':
+ if platform.architecture()[0]=='32bit':
+ lpreargs = ['-m32']
+ else:
+ lpreargs = ['-m64']
+ extra = compiler_attrs.get('extra_compile_args', None)
+
+ objs = cc.compile([cfile], extra_preargs=cpreargs, extra_postargs=extra)
+ cc.link_executable(objs, efile, extra_preargs=lpreargs)
+ return efile
+
+def compile_and_run(basedir, src, compiler=None, **compiler_attrs):
+ if not os.path.exists(basedir):
+ os.makedirs(basedir)
+ cfile = pjoin(basedir, os.path.basename(src))
+ shutil.copy(src, cfile)
+ try:
+ cc = get_compiler(compiler, **compiler_attrs)
+ efile = test_compilation(cfile, compiler=cc)
+ patch_lib_paths(efile, cc.library_dirs)
+ result = Popen(efile, stdout=PIPE, stderr=PIPE)
+ so, se = result.communicate()
+ # for py3k:
+ so = so.decode()
+ se = se.decode()
+ finally:
+ shutil.rmtree(basedir)
+
+ return result.returncode, so, se
+
+
+def detect_zmq(basedir, compiler=None, **compiler_attrs):
+ """Compile, link & execute a test program, in empty directory `basedir`.
+
+ The C compiler will be updated with any keywords given via setattr.
+
+ Parameters
+ ----------
+
+ basedir : path
+ The location where the test program will be compiled and run
+ compiler : str
+ The distutils compiler key (e.g. 'unix', 'msvc', or 'mingw32')
+ **compiler_attrs : dict
+ Any extra compiler attributes, which will be set via ``setattr(cc)``.
+
+ Returns
+ -------
+
+ A dict of properties for zmq compilation, with the following two keys:
+
+ vers : tuple
+ The ZMQ version as a tuple of ints, e.g. (2,2,0)
+ settings : dict
+ The compiler options used to compile the test function, e.g. `include_dirs`,
+ `library_dirs`, `libs`, etc.
+ """
+
+ cfile = pjoin(basedir, 'vers.c')
+ shutil.copy(pjoin(os.path.dirname(__file__), 'vers.c'), cfile)
+
+ # check if we need to link against Realtime Extensions library
+ if sys.platform.startswith('linux'):
+ cc = ccompiler.new_compiler(compiler=compiler)
+ cc.output_dir = basedir
+ if not cc.has_function('timer_create'):
+ compiler_attrs['libraries'].append('rt')
+
+ cc = get_compiler(compiler=compiler, **compiler_attrs)
+ efile = test_compilation(cfile, compiler=cc)
+ patch_lib_paths(efile, cc.library_dirs)
+
+ rc, so, se = get_output_error([efile])
+ if rc:
+ msg = "Error running version detection script:\n%s\n%s" % (so,se)
+ logging.error(msg)
+ raise IOError(msg)
+
+ handlers = {'vers': lambda val: tuple(int(v) for v in val.split('.'))}
+
+ props = {}
+ for line in (x for x in so.split('\n') if x):
+ key, val = line.split(':')
+ props[key] = handlers[key](val)
+
+ return props
+
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/dummy.c b/external_libs/python/pyzmq-14.7.0/buildutils/dummy.c
new file mode 100644
index 00000000..4dbdc60f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/dummy.c
@@ -0,0 +1,5 @@
+// empty file, just to test compilation
+
+int main(int argc, char **argv){
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/include_darwin/platform.hpp b/external_libs/python/pyzmq-14.7.0/buildutils/include_darwin/platform.hpp
new file mode 100644
index 00000000..97296951
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/include_darwin/platform.hpp
@@ -0,0 +1,294 @@
+/* src/platform.hpp. Generated from platform.hpp.in by configure. */
+/* src/platform.hpp.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <alloca.h> header file. */
+#define HAVE_ALLOCA_H 1
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+/* #undef HAVE_CLOCK_GETTIME */
+
+/* Define to 1 if you have the declaration of `LOCAL_PEERCRED', and to 0 if
+ you don't. */
+#define HAVE_DECL_LOCAL_PEERCRED 0
+
+/* Define to 1 if you have the declaration of `SO_PEERCRED', and to 0 if you
+ don't. */
+#define HAVE_DECL_SO_PEERCRED 0
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `freeifaddrs' function. */
+#define HAVE_FREEIFADDRS 1
+
+/* Define to 1 if you have the `gethrtime' function. */
+/* #undef HAVE_GETHRTIME */
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#define HAVE_GETIFADDRS 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#define HAVE_IFADDRS_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `gssapi_krb5' library (-lgssapi_krb5). */
+/* #undef HAVE_LIBGSSAPI_KRB5 */
+
+/* Define to 1 if you have the `iphlpapi' library (-liphlpapi). */
+/* #undef HAVE_LIBIPHLPAPI */
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+/* #undef HAVE_LIBNSL */
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#define HAVE_LIBPTHREAD 1
+
+/* Define to 1 if you have the `rpcrt4' library (-lrpcrt4). */
+/* #undef HAVE_LIBRPCRT4 */
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+/* #undef HAVE_LIBRT */
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* The libsodium library is to be used. */
+#define HAVE_LIBSODIUM 1
+
+/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
+/* #undef HAVE_LIBWS2_32 */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define to 1 if you have the `perror' function. */
+#define HAVE_PERROR 1
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+/* #undef HAVE_SYS_EVENTFD_H */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if the system has the type `_Bool'. */
+/* #undef HAVE__BOOL */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "zeromq"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "zeromq-dev@lists.zeromq.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "zeromq"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "zeromq 4.1.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "zeromq"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "4.1.1"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "4.1.1"
+
+/* Enable militant API assertions */
+/* #undef ZMQ_ACT_MILITANT */
+
+/* Force to use mutexes */
+/* #undef ZMQ_FORCE_MUTEXES */
+
+/* Have AIX OS */
+/* #undef ZMQ_HAVE_AIX */
+
+/* Have Android OS */
+/* #undef ZMQ_HAVE_ANDROID */
+
+/* Have Cygwin */
+/* #undef ZMQ_HAVE_CYGWIN */
+
+/* Have eventfd extension. */
+/* #undef ZMQ_HAVE_EVENTFD */
+
+/* Have FreeBSD OS */
+/* #undef ZMQ_HAVE_FREEBSD */
+
+/* Have HPUX OS */
+/* #undef ZMQ_HAVE_HPUX */
+
+/* Have ifaddrs.h header. */
+#define ZMQ_HAVE_IFADDRS 1
+
+/* Have Linux OS */
+/* #undef ZMQ_HAVE_LINUX */
+
+/* Have LOCAL_PEERCRED socket option */
+/* #undef ZMQ_HAVE_LOCAL_PEERCRED */
+
+/* Have MinGW32 */
+/* #undef ZMQ_HAVE_MINGW32 */
+
+/* Have NetBSD OS */
+/* #undef ZMQ_HAVE_NETBSD */
+
+/* Have NORM protocol extension */
+/* #undef ZMQ_HAVE_NORM */
+
+/* Have OpenBSD OS */
+/* #undef ZMQ_HAVE_OPENBSD */
+
+/* Have OpenPGM extension */
+/* #undef ZMQ_HAVE_OPENPGM */
+
+/* Have DarwinOSX OS */
+#define ZMQ_HAVE_OSX 1
+
+/* Have QNX Neutrino OS */
+/* #undef ZMQ_HAVE_QNXNTO */
+
+/* Whether SOCK_CLOEXEC is defined and functioning. */
+/* #undef ZMQ_HAVE_SOCK_CLOEXEC */
+
+/* Have Solaris OS */
+/* #undef ZMQ_HAVE_SOLARIS */
+
+/* Whether SO_KEEPALIVE is supported. */
+#define ZMQ_HAVE_SO_KEEPALIVE 1
+
+/* Have SO_PEERCRED socket option */
+/* #undef ZMQ_HAVE_SO_PEERCRED */
+
+/* Whether TCP_KEEPALIVE is supported. */
+#define ZMQ_HAVE_TCP_KEEPALIVE 1
+
+/* Whether TCP_KEEPCNT is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPCNT */
+
+/* Whether TCP_KEEPIDLE is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPIDLE */
+
+/* Whether TCP_KEEPINTVL is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPINTVL */
+
+/* Have TIPC support */
+/* #undef ZMQ_HAVE_TIPC */
+
+/* Have uio.h header. */
+#define ZMQ_HAVE_UIO 1
+
+/* Have Windows OS */
+/* #undef ZMQ_HAVE_WINDOWS */
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+ code using `volatile' can become incorrect without. Disable with care. */
+/* #undef volatile */
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/include_freebsd/platform.hpp b/external_libs/python/pyzmq-14.7.0/buildutils/include_freebsd/platform.hpp
new file mode 100644
index 00000000..cac36245
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/include_freebsd/platform.hpp
@@ -0,0 +1,294 @@
+/* src/platform.hpp. Generated from platform.hpp.in by configure. */
+/* src/platform.hpp.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <alloca.h> header file. */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the declaration of `LOCAL_PEERCRED', and to 0 if
+ you don't. */
+#define HAVE_DECL_LOCAL_PEERCRED 0
+
+/* Define to 1 if you have the declaration of `SO_PEERCRED', and to 0 if you
+ don't. */
+#define HAVE_DECL_SO_PEERCRED 0
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `freeifaddrs' function. */
+#define HAVE_FREEIFADDRS 1
+
+/* Define to 1 if you have the `gethrtime' function. */
+/* #undef HAVE_GETHRTIME */
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#define HAVE_GETIFADDRS 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#define HAVE_IFADDRS_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `gssapi_krb5' library (-lgssapi_krb5). */
+/* #undef HAVE_LIBGSSAPI_KRB5 */
+
+/* Define to 1 if you have the `iphlpapi' library (-liphlpapi). */
+/* #undef HAVE_LIBIPHLPAPI */
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+/* #undef HAVE_LIBNSL */
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#define HAVE_LIBPTHREAD 1
+
+/* Define to 1 if you have the `rpcrt4' library (-lrpcrt4). */
+/* #undef HAVE_LIBRPCRT4 */
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#define HAVE_LIBRT 1
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* The libsodium library is to be used. */
+#define HAVE_LIBSODIUM 1
+
+/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
+/* #undef HAVE_LIBWS2_32 */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define to 1 if you have the `perror' function. */
+#define HAVE_PERROR 1
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+/* #undef HAVE_STDBOOL_H */
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+/* #undef HAVE_SYS_EVENTFD_H */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if the system has the type `_Bool'. */
+/* #undef HAVE__BOOL */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "zeromq"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "zeromq-dev@lists.zeromq.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "zeromq"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "zeromq 4.1.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "zeromq"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "4.1.1"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "4.1.1"
+
+/* Enable militant API assertions */
+/* #undef ZMQ_ACT_MILITANT */
+
+/* Force to use mutexes */
+/* #undef ZMQ_FORCE_MUTEXES */
+
+/* Have AIX OS */
+/* #undef ZMQ_HAVE_AIX */
+
+/* Have Android OS */
+/* #undef ZMQ_HAVE_ANDROID */
+
+/* Have Cygwin */
+/* #undef ZMQ_HAVE_CYGWIN */
+
+/* Have eventfd extension. */
+/* #undef ZMQ_HAVE_EVENTFD */
+
+/* Have FreeBSD OS */
+#define ZMQ_HAVE_FREEBSD 1
+
+/* Have HPUX OS */
+/* #undef ZMQ_HAVE_HPUX */
+
+/* Have ifaddrs.h header. */
+#define ZMQ_HAVE_IFADDRS 1
+
+/* Have Linux OS */
+/* #undef ZMQ_HAVE_LINUX */
+
+/* Have LOCAL_PEERCRED socket option */
+/* #undef ZMQ_HAVE_LOCAL_PEERCRED */
+
+/* Have MinGW32 */
+/* #undef ZMQ_HAVE_MINGW32 */
+
+/* Have NetBSD OS */
+/* #undef ZMQ_HAVE_NETBSD */
+
+/* Have NORM protocol extension */
+/* #undef ZMQ_HAVE_NORM */
+
+/* Have OpenBSD OS */
+/* #undef ZMQ_HAVE_OPENBSD */
+
+/* Have OpenPGM extension */
+/* #undef ZMQ_HAVE_OPENPGM */
+
+/* Have DarwinOSX OS */
+/* #undef ZMQ_HAVE_OSX */
+
+/* Have QNX Neutrino OS */
+/* #undef ZMQ_HAVE_QNXNTO */
+
+/* Whether SOCK_CLOEXEC is defined and functioning. */
+#define ZMQ_HAVE_SOCK_CLOEXEC 1
+
+/* Have Solaris OS */
+/* #undef ZMQ_HAVE_SOLARIS */
+
+/* Whether SO_KEEPALIVE is supported. */
+#define ZMQ_HAVE_SO_KEEPALIVE 1
+
+/* Have SO_PEERCRED socket option */
+/* #undef ZMQ_HAVE_SO_PEERCRED */
+
+/* Whether TCP_KEEPALIVE is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPALIVE */
+
+/* Whether TCP_KEEPCNT is supported. */
+#define ZMQ_HAVE_TCP_KEEPCNT 1
+
+/* Whether TCP_KEEPIDLE is supported. */
+#define ZMQ_HAVE_TCP_KEEPIDLE 1
+
+/* Whether TCP_KEEPINTVL is supported. */
+#define ZMQ_HAVE_TCP_KEEPINTVL 1
+
+/* Have TIPC support */
+/* #undef ZMQ_HAVE_TIPC */
+
+/* Have uio.h header. */
+#define ZMQ_HAVE_UIO 1
+
+/* Have Windows OS */
+/* #undef ZMQ_HAVE_WINDOWS */
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+ code using `volatile' can become incorrect without. Disable with care. */
+/* #undef volatile */
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/include_linux-armv/platform.hpp b/external_libs/python/pyzmq-14.7.0/buildutils/include_linux-armv/platform.hpp
new file mode 100644
index 00000000..7bff0422
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/include_linux-armv/platform.hpp
@@ -0,0 +1,287 @@
+/* src/platform.hpp. Generated from platform.hpp.in by configure. */
+/* src/platform.hpp.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <alloca.h> header file. */
+#define HAVE_ALLOCA_H 1
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the declaration of `LOCAL_PEERCRED', and to 0 if
+ you don't. */
+#define HAVE_DECL_LOCAL_PEERCRED 0
+
+/* Define to 1 if you have the declaration of `SO_PEERCRED', and to 0 if you
+ don't. */
+#define HAVE_DECL_SO_PEERCRED 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `freeifaddrs' function. */
+/* #undef HAVE_FREEIFADDRS */
+
+/* Define to 1 if you have the `gethrtime' function. */
+/* #undef HAVE_GETHRTIME */
+
+/* Define to 1 if you have the `getifaddrs' function. */
+/* #undef HAVE_GETIFADDRS */
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+/* #undef HAVE_IFADDRS_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `gssapi_krb5' library (-lgssapi_krb5). */
+/* #undef HAVE_LIBGSSAPI_KRB5 */
+
+/* Define to 1 if you have the `iphlpapi' library (-liphlpapi). */
+/* #undef HAVE_LIBIPHLPAPI */
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+/* #undef HAVE_LIBNSL */
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+/* #undef HAVE_LIBPTHREAD */
+
+/* Define to 1 if you have the `rpcrt4' library (-lrpcrt4). */
+/* #undef HAVE_LIBRPCRT4 */
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+/* #undef HAVE_LIBRT */
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* The libsodium library is to be used. */
+/* #undef HAVE_LIBSODIUM */
+
+/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
+/* #undef HAVE_LIBWS2_32 */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define to 1 if you have the `perror' function. */
+#define HAVE_PERROR 1
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+/* #undef HAVE_SYS_EVENTFD_H */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if the system has the type `_Bool'. */
+/* #undef HAVE__BOOL */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "zeromq"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "zeromq-dev@lists.zeromq.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "zeromq"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "zeromq 4.1.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "zeromq"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "4.1.1"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "4.1.1"
+
+/* Enable militant API assertions */
+/* #undef ZMQ_ACT_MILITANT */
+
+/* Force to use mutexes */
+/* #undef ZMQ_FORCE_MUTEXES */
+
+/* Have AIX OS */
+/* #undef ZMQ_HAVE_AIX */
+
+/* Have Android OS */
+#define ZMQ_HAVE_ANDROID 1
+
+/* Have Cygwin */
+/* #undef ZMQ_HAVE_CYGWIN */
+
+/* Have eventfd extension. */
+/* #undef ZMQ_HAVE_EVENTFD */
+
+/* Have FreeBSD OS */
+/* #undef ZMQ_HAVE_FREEBSD */
+
+/* Have HPUX OS */
+/* #undef ZMQ_HAVE_HPUX */
+
+/* Have ifaddrs.h header. */
+/* #undef ZMQ_HAVE_IFADDRS */
+
+/* Have Linux OS */
+#define ZMQ_HAVE_LINUX 1
+
+/* Have LOCAL_PEERCRED socket option */
+/* #undef ZMQ_HAVE_LOCAL_PEERCRED */
+
+/* Have MinGW32 */
+/* #undef ZMQ_HAVE_MINGW32 */
+
+/* Have NetBSD OS */
+/* #undef ZMQ_HAVE_NETBSD */
+
+/* Have NORM protocol extension */
+/* #undef ZMQ_HAVE_NORM */
+
+/* Have OpenBSD OS */
+/* #undef ZMQ_HAVE_OPENBSD */
+
+/* Have OpenPGM extension */
+/* #undef ZMQ_HAVE_OPENPGM */
+
+/* Have DarwinOSX OS */
+/* #undef ZMQ_HAVE_OSX */
+
+/* Have QNX Neutrino OS */
+/* #undef ZMQ_HAVE_QNXNTO */
+
+/* Whether SOCK_CLOEXEC is defined and functioning. */
+/* #undef ZMQ_HAVE_SOCK_CLOEXEC */
+
+/* Have Solaris OS */
+/* #undef ZMQ_HAVE_SOLARIS */
+
+/* Whether SO_KEEPALIVE is supported. */
+/* #undef ZMQ_HAVE_SO_KEEPALIVE */
+
+/* Whether TCP_KEEPALIVE is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPALIVE */
+
+/* Whether TCP_KEEPCNT is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPCNT */
+
+/* Whether TCP_KEEPIDLE is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPIDLE */
+
+/* Whether TCP_KEEPINTVL is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPINTVL */
+/* Have TIPC support */
+/* #undef ZMQ_HAVE_TIPC */
+
+/* Have uio.h header. */
+#define ZMQ_HAVE_UIO 1
+
+/* Have Windows OS */
+/* #undef ZMQ_HAVE_WINDOWS */
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+ code using `volatile' can become incorrect without. Disable with care. */
+/* #undef volatile */
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/include_linux/platform.hpp b/external_libs/python/pyzmq-14.7.0/buildutils/include_linux/platform.hpp
new file mode 100644
index 00000000..2f8daac3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/include_linux/platform.hpp
@@ -0,0 +1,294 @@
+/* src/platform.hpp. Generated from platform.hpp.in by configure. */
+/* src/platform.hpp.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <alloca.h> header file. */
+#define HAVE_ALLOCA_H 1
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the declaration of `LOCAL_PEERCRED', and to 0 if
+ you don't. */
+#define HAVE_DECL_LOCAL_PEERCRED 0
+
+/* Define to 1 if you have the declaration of `SO_PEERCRED', and to 0 if you
+ don't. */
+#define HAVE_DECL_SO_PEERCRED 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `freeifaddrs' function. */
+#define HAVE_FREEIFADDRS 1
+
+/* Define to 1 if you have the `gethrtime' function. */
+/* #undef HAVE_GETHRTIME */
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#define HAVE_GETIFADDRS 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#define HAVE_IFADDRS_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `gssapi_krb5' library (-lgssapi_krb5). */
+/* #undef HAVE_LIBGSSAPI_KRB5 */
+
+/* Define to 1 if you have the `iphlpapi' library (-liphlpapi). */
+/* #undef HAVE_LIBIPHLPAPI */
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+/* #undef HAVE_LIBNSL */
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#define HAVE_LIBPTHREAD 1
+
+/* Define to 1 if you have the `rpcrt4' library (-lrpcrt4). */
+/* #undef HAVE_LIBRPCRT4 */
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#define HAVE_LIBRT 1
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* The libsodium library is to be used. */
+/* #undef HAVE_LIBSODIUM */
+
+/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
+/* #undef HAVE_LIBWS2_32 */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define to 1 if you have the `perror' function. */
+#define HAVE_PERROR 1
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#define HAVE_SYS_EVENTFD_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if the system has the type `_Bool'. */
+/* #undef HAVE__BOOL */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "zeromq"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "zeromq-dev@lists.zeromq.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "zeromq"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "zeromq 4.1.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "zeromq"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "4.1.1"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "4.1.1"
+
+/* Enable militant API assertions */
+/* #undef ZMQ_ACT_MILITANT */
+
+/* Force to use mutexes */
+/* #undef ZMQ_FORCE_MUTEXES */
+
+/* Have AIX OS */
+/* #undef ZMQ_HAVE_AIX */
+
+/* Have Android OS */
+/* #undef ZMQ_HAVE_ANDROID */
+
+/* Have Cygwin */
+/* #undef ZMQ_HAVE_CYGWIN */
+
+/* Have eventfd extension. */
+#define ZMQ_HAVE_EVENTFD 1
+
+/* Have FreeBSD OS */
+/* #undef ZMQ_HAVE_FREEBSD */
+
+/* Have HPUX OS */
+/* #undef ZMQ_HAVE_HPUX */
+
+/* Have ifaddrs.h header. */
+#define ZMQ_HAVE_IFADDRS 1
+
+/* Have Linux OS */
+#define ZMQ_HAVE_LINUX 1
+
+/* Have LOCAL_PEERCRED socket option */
+/* #undef ZMQ_HAVE_LOCAL_PEERCRED */
+
+/* Have MinGW32 */
+/* #undef ZMQ_HAVE_MINGW32 */
+
+/* Have NetBSD OS */
+/* #undef ZMQ_HAVE_NETBSD */
+
+/* Have NORM protocol extension */
+/* #undef ZMQ_HAVE_NORM */
+
+/* Have OpenBSD OS */
+/* #undef ZMQ_HAVE_OPENBSD */
+
+/* Have OpenPGM extension */
+/* #undef ZMQ_HAVE_OPENPGM */
+
+/* Have DarwinOSX OS */
+/* #undef ZMQ_HAVE_OSX */
+
+/* Have QNX Neutrino OS */
+/* #undef ZMQ_HAVE_QNXNTO */
+
+/* Whether SOCK_CLOEXEC is defined and functioning. */
+#define ZMQ_HAVE_SOCK_CLOEXEC 1
+
+/* Have Solaris OS */
+/* #undef ZMQ_HAVE_SOLARIS */
+
+/* Whether SO_KEEPALIVE is supported. */
+#define ZMQ_HAVE_SO_KEEPALIVE 1
+
+/* Have SO_PEERCRED socket option */
+#define ZMQ_HAVE_SO_PEERCRED 1
+
+/* Whether TCP_KEEPALIVE is supported. */
+/* #undef ZMQ_HAVE_TCP_KEEPALIVE */
+
+/* Whether TCP_KEEPCNT is supported. */
+#define ZMQ_HAVE_TCP_KEEPCNT 1
+
+/* Whether TCP_KEEPIDLE is supported. */
+#define ZMQ_HAVE_TCP_KEEPIDLE 1
+
+/* Whether TCP_KEEPINTVL is supported. */
+#define ZMQ_HAVE_TCP_KEEPINTVL 1
+
+/* Have TIPC support */
+/* #undef ZMQ_HAVE_TIPC */
+
+/* Have uio.h header. */
+#define ZMQ_HAVE_UIO 1
+
+/* Have Windows OS */
+/* #undef ZMQ_HAVE_WINDOWS */
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+ code using `volatile' can become incorrect without. Disable with care. */
+/* #undef volatile */
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/crypto_scalarmult_curve25519.h b/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/crypto_scalarmult_curve25519.h
new file mode 100644
index 00000000..a4b4dd19
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/crypto_scalarmult_curve25519.h
@@ -0,0 +1,44 @@
+#ifndef crypto_scalarmult_curve25519_H
+#define crypto_scalarmult_curve25519_H
+
+#if 0
+# ifndef SODIUM_HAVE_TI_MODE
+# define SODIUM_HAVE_TI_MODE
+# endif
+#endif
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_scalarmult_curve25519_BYTES 32
+SODIUM_EXPORT
+size_t crypto_scalarmult_curve25519_bytes(void);
+
+#define crypto_scalarmult_curve25519_SCALARBYTES 32
+SODIUM_EXPORT
+size_t crypto_scalarmult_curve25519_scalarbytes(void);
+
+SODIUM_EXPORT
+int crypto_scalarmult_curve25519(unsigned char *,const unsigned char *,const unsigned char *);
+
+SODIUM_EXPORT
+int crypto_scalarmult_curve25519_base(unsigned char *,const unsigned char *);
+
+#ifdef SODIUM_HAVE_TI_MODE
+# define crypto_scalarmult_curve25519_donna_c64 crypto_scalarmult_curve25519
+# define crypto_scalarmult_curve25519_donna_c64_base crypto_scalarmult_curve25519_base
+#else
+# define crypto_scalarmult_curve25519_ref crypto_scalarmult_curve25519
+# define crypto_scalarmult_curve25519_ref_base crypto_scalarmult_curve25519_base
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/crypto_stream_salsa20.h b/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/crypto_stream_salsa20.h
new file mode 100644
index 00000000..8ce595e5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/crypto_stream_salsa20.h
@@ -0,0 +1,54 @@
+#ifndef crypto_stream_salsa20_H
+#define crypto_stream_salsa20_H
+
+/*
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ * While it provides some protection against eavesdropping, it does NOT
+ * provide any security against active attacks.
+ * Unless you know what you're doing, what you are looking for is probably
+ * the crypto_box functions.
+ */
+
+#if 0
+# ifndef SODIUM_HAVE_AMD64_ASM
+# define SODIUM_HAVE_AMD64_ASM
+# endif
+#endif
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_stream_salsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_salsa20_keybytes(void);
+
+#define crypto_stream_salsa20_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_salsa20_noncebytes(void);
+
+SODIUM_EXPORT
+const char * crypto_stream_salsa20_primitive(void);
+
+SODIUM_EXPORT
+int crypto_stream_salsa20(unsigned char *,unsigned long long,const unsigned char *,const unsigned char *);
+
+SODIUM_EXPORT
+int crypto_stream_salsa20_xor(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *);
+
+#ifdef SODIUM_HAVE_AMD64_ASM
+# define crypto_stream_salsa20_amd64_xmm6 crypto_stream_salsa20
+# define crypto_stream_salsa20_amd64_xmm6_xor crypto_stream_salsa20_xor
+#else
+# define crypto_stream_salsa20_ref crypto_stream_salsa20
+# define crypto_stream_salsa20_ref_xor crypto_stream_salsa20_xor
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/version.h b/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/version.h
new file mode 100644
index 00000000..56b03e2d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/include_sodium/version.h
@@ -0,0 +1,29 @@
+
+#ifndef __SODIUM_VERSION_H__
+#define __SODIUM_VERSION_H__
+
+#include "export.h"
+
+#define SODIUM_VERSION_STRING "0.4.5"
+
+#define SODIUM_LIBRARY_VERSION_MAJOR 4
+#define SODIUM_LIBRARY_VERSION_MINOR 4
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+const char *sodium_version_string(void);
+
+SODIUM_EXPORT
+int sodium_library_version_major(void);
+
+SODIUM_EXPORT
+int sodium_library_version_minor(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/include_win32/stdint.h b/external_libs/python/pyzmq-14.7.0/buildutils/include_win32/stdint.h
new file mode 100644
index 00000000..2cd301fb
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/include_win32/stdint.h
@@ -0,0 +1,11 @@
+#ifndef _stdint_h__
+#define _stdint_h__
+
+#include "../../bundled/zeromq/src/stdint.hpp"
+
+#define UINT8_MAX 0xff
+#define UINT16_MAX 0xffff
+#define UINT32_MAX 0xffffffff
+#define UINT64_MAX 0xffffffffffffffffull
+
+#endif /* _stdint_h__ */
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/initlibsodium.c b/external_libs/python/pyzmq-14.7.0/buildutils/initlibsodium.c
new file mode 100644
index 00000000..4360f1ad
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/initlibsodium.c
@@ -0,0 +1,45 @@
+/*
+This file is from pyzmq-static by Brandon Craig-Rhodes,
+and used under the BSD license
+
+py3compat from http://wiki.python.org/moin/PortingExtensionModulesToPy3k
+
+Provide the init function that Python expects
+when we compile libsodium by pretending it is a Python extension.
+*/
+#include "Python.h"
+
+static PyMethodDef Methods[] = {
+ {NULL, NULL, 0, NULL}
+};
+
+#if PY_MAJOR_VERSION >= 3
+
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "libsodium",
+ NULL,
+ -1,
+ Methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+PyMODINIT_FUNC
+PyInit_libsodium(void)
+{
+ PyObject *module = PyModule_Create(&moduledef);
+ return module;
+}
+
+#else // py2
+
+PyMODINIT_FUNC
+initlibsodium(void)
+{
+ (void) Py_InitModule("libsodium", Methods);
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/initlibzmq.c b/external_libs/python/pyzmq-14.7.0/buildutils/initlibzmq.c
new file mode 100644
index 00000000..ec299f0a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/initlibzmq.c
@@ -0,0 +1,45 @@
+/*
+This file is from pyzmq-static by Brandon Craig-Rhodes,
+and used under the BSD license
+
+py3compat from http://wiki.python.org/moin/PortingExtensionModulesToPy3k
+
+Provide the init function that Python expects
+when we compile libzmq by pretending it is a Python extension.
+*/
+#include "Python.h"
+
+static PyMethodDef Methods[] = {
+ {NULL, NULL, 0, NULL}
+};
+
+#if PY_MAJOR_VERSION >= 3
+
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "libzmq",
+ NULL,
+ -1,
+ Methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+PyMODINIT_FUNC
+PyInit_libzmq(void)
+{
+ PyObject *module = PyModule_Create(&moduledef);
+ return module;
+}
+
+#else // py2
+
+PyMODINIT_FUNC
+initlibzmq(void)
+{
+ (void) Py_InitModule("libzmq", Methods);
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/misc.py b/external_libs/python/pyzmq-14.7.0/buildutils/misc.py
new file mode 100644
index 00000000..a6d61607
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/misc.py
@@ -0,0 +1,65 @@
+"""misc build utility functions"""
+
+# Copyright (c) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+
+import os
+import sys
+import logging
+from distutils import ccompiler
+from distutils.sysconfig import customize_compiler
+from pipes import quote
+from subprocess import Popen, PIPE
+
+pjoin = os.path.join
+
+
+if sys.version_info[0] >= 3:
+ u = lambda x: x
+else:
+ u = lambda x: x.decode('utf8', 'replace')
+
+
+def customize_mingw(cc):
+ # strip -mno-cygwin from mingw32 (Python Issue #12641)
+ for cmd in [cc.compiler, cc.compiler_cxx, cc.compiler_so, cc.linker_exe, cc.linker_so]:
+ if '-mno-cygwin' in cmd:
+ cmd.remove('-mno-cygwin')
+
+ # remove problematic msvcr90
+ if 'msvcr90' in cc.dll_libraries:
+ cc.dll_libraries.remove('msvcr90')
+
+
+def get_compiler(compiler, **compiler_attrs):
+ """get and customize a compiler"""
+ if compiler is None or isinstance(compiler, str):
+ cc = ccompiler.new_compiler(compiler=compiler)
+ customize_compiler(cc)
+ if cc.compiler_type == 'mingw32':
+ customize_mingw(cc)
+ else:
+ cc = compiler
+
+ for name, val in compiler_attrs.items():
+ setattr(cc, name, val)
+
+ return cc
+
+
+def get_output_error(cmd):
+ """Return the exit status, stdout, stderr of a command"""
+ if not isinstance(cmd, list):
+ cmd = [cmd]
+ logging.debug("Running: %s", ' '.join(map(quote, cmd)))
+ try:
+ result = Popen(cmd, stdout=PIPE, stderr=PIPE)
+ except IOError as e:
+ return -1, u(''), u('Failed to run %r: %r' % (cmd, e))
+ so, se = result.communicate()
+ # unicode:
+ so = so.decode('utf8', 'replace')
+ se = se.decode('utf8', 'replace')
+
+ return result.returncode, so, se
+
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/msg.py b/external_libs/python/pyzmq-14.7.0/buildutils/msg.py
new file mode 100644
index 00000000..70cd7166
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/msg.py
@@ -0,0 +1,39 @@
+"""logging"""
+
+# Copyright (c) PyZMQ Developers.
+# Distributed under the terms of the Modified BSD License.
+
+from __future__ import division
+
+import os
+import sys
+import logging
+
+#-----------------------------------------------------------------------------
+# Logging (adapted from h5py: http://h5py.googlecode.com)
+#-----------------------------------------------------------------------------
+
+
+logger = logging.getLogger()
+if os.environ.get('DEBUG'):
+ logger.setLevel(logging.DEBUG)
+else:
+ logger.setLevel(logging.INFO)
+logger.addHandler(logging.StreamHandler(sys.stderr))
+
+def debug(msg):
+ logger.debug(msg)
+
+def info(msg):
+ logger.info(msg)
+
+def fatal(msg, code=1):
+ logger.error("Fatal: " + msg)
+ exit(code)
+
+def warn(msg):
+ logger.error("Warning: " + msg)
+
+def line(c='*', width=48):
+ print(c * (width // len(c)))
+
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/patch.py b/external_libs/python/pyzmq-14.7.0/buildutils/patch.py
new file mode 100644
index 00000000..925b67b7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/patch.py
@@ -0,0 +1,61 @@
+"""utils for patching libraries"""
+
+# Copyright (c) PyZMQ Developers.
+# Distributed under the terms of the Modified BSD License.
+
+
+import re
+import sys
+import os
+import logging
+
+from .misc import get_output_error
+
+pjoin = os.path.join
+
+# LIB_PAT from delocate
+LIB_PAT = re.compile(r"\s*(.*) \(compatibility version (\d+\.\d+\.\d+), "
+ r"current version (\d+\.\d+\.\d+)\)")
+
+def _get_libs(fname):
+ rc, so, se = get_output_error(['otool', '-L', fname])
+ if rc:
+ logging.error("otool -L %s failed: %r" % (fname, se))
+ return
+ for line in so.splitlines()[1:]:
+ m = LIB_PAT.match(line)
+ if m:
+ yield m.group(1)
+
+def _find_library(lib, path):
+ """Find a library"""
+ for d in path[::-1]:
+ real_lib = os.path.join(d, lib)
+ if os.path.exists(real_lib):
+ return real_lib
+
+def _install_name_change(fname, lib, real_lib):
+ rc, so, se = get_output_error(['install_name_tool', '-change', lib, real_lib, fname])
+ if rc:
+ logging.error("Couldn't update load path: %s", se)
+
+def patch_lib_paths(fname, library_dirs):
+ """Load any weakly-defined libraries from their real location
+
+ (only on OS X)
+
+ - Find libraries with `otool -L`
+ - Update with `install_name_tool -change`
+ """
+ if sys.platform != 'darwin':
+ return
+
+ libs = _get_libs(fname)
+ for lib in libs:
+ if not lib.startswith(('@', '/')):
+ real_lib = _find_library(lib, library_dirs)
+ if real_lib:
+ _install_name_change(fname, lib, real_lib)
+
+
+__all__ = ['patch_lib_paths'] \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/templates/constant_enums.pxi b/external_libs/python/pyzmq-14.7.0/buildutils/templates/constant_enums.pxi
new file mode 100644
index 00000000..60395484
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/templates/constant_enums.pxi
@@ -0,0 +1,3 @@
+cdef extern from "zmq.h" nogil:
+
+ {ZMQ_ENUMS}
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/templates/constants.pxi b/external_libs/python/pyzmq-14.7.0/buildutils/templates/constants.pxi
new file mode 100644
index 00000000..042a6e83
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/templates/constants.pxi
@@ -0,0 +1,12 @@
+#-----------------------------------------------------------------------------
+# Python module level constants
+#-----------------------------------------------------------------------------
+
+{ASSIGNMENTS}
+
+#-----------------------------------------------------------------------------
+# Symbols to export
+#-----------------------------------------------------------------------------
+__all__ = [
+{ALL}
+]
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/templates/zmq_constants.h b/external_libs/python/pyzmq-14.7.0/buildutils/templates/zmq_constants.h
new file mode 100644
index 00000000..6855331a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/templates/zmq_constants.h
@@ -0,0 +1,6 @@
+#ifndef _PYZMQ_CONSTANT_DEFS
+#define _PYZMQ_CONSTANT_DEFS
+
+{ZMQ_IFNDEFS}
+
+#endif // ifndef _PYZMQ_CONSTANT_DEFS
diff --git a/external_libs/python/pyzmq-14.7.0/buildutils/vers.c b/external_libs/python/pyzmq-14.7.0/buildutils/vers.c
new file mode 100644
index 00000000..362564f3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/buildutils/vers.c
@@ -0,0 +1,11 @@
+// check libzmq version
+
+#include <stdio.h>
+#include "zmq.h"
+
+int main(int argc, char **argv){
+ int major, minor, patch;
+ zmq_version(&major, &minor, &patch);
+ fprintf(stdout, "vers: %d.%d.%d\n", major, minor, patch);
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/LICENSE b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/LICENSE
new file mode 100644
index 00000000..3edb000f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/LICENSE
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2013-2015
+ * Frank Denis <j at pureftpd dot org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c
new file mode 100644
index 00000000..945efe33
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c
@@ -0,0 +1,148 @@
+
+#include <limits.h>
+#include <string.h>
+
+#include "crypto_aead_chacha20poly1305.h"
+#include "crypto_onetimeauth_poly1305.h"
+#include "crypto_stream_chacha20.h"
+#include "crypto_verify_16.h"
+#include "utils.h"
+
+static inline void
+_u64_le_from_ull(unsigned char out[8U], unsigned long long x)
+{
+ out[0] = (unsigned char) (x & 0xff); x >>= 8;
+ out[1] = (unsigned char) (x & 0xff); x >>= 8;
+ out[2] = (unsigned char) (x & 0xff); x >>= 8;
+ out[3] = (unsigned char) (x & 0xff); x >>= 8;
+ out[4] = (unsigned char) (x & 0xff); x >>= 8;
+ out[5] = (unsigned char) (x & 0xff); x >>= 8;
+ out[6] = (unsigned char) (x & 0xff); x >>= 8;
+ out[7] = (unsigned char) (x & 0xff);
+}
+
+int
+crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
+ unsigned long long *clen,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *ad,
+ unsigned long long adlen,
+ const unsigned char *nsec,
+ const unsigned char *npub,
+ const unsigned char *k)
+{
+ crypto_onetimeauth_poly1305_state state;
+ unsigned char block0[64U];
+ unsigned char slen[8U];
+
+ (void) nsec;
+/* LCOV_EXCL_START */
+#ifdef ULONG_LONG_MAX
+ if (mlen > ULONG_LONG_MAX - crypto_aead_chacha20poly1305_ABYTES) {
+ if (clen != NULL) {
+ *clen = 0ULL;
+ }
+ return -1;
+ }
+#endif
+/* LCOV_EXCL_STOP */
+
+ crypto_stream_chacha20(block0, sizeof block0, npub, k);
+ crypto_onetimeauth_poly1305_init(&state, block0);
+ sodium_memzero(block0, sizeof block0);
+
+ crypto_onetimeauth_poly1305_update(&state, ad, adlen);
+ _u64_le_from_ull(slen, adlen);
+ crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+ crypto_stream_chacha20_xor_ic(c, m, mlen, npub, 1U, k);
+
+ crypto_onetimeauth_poly1305_update(&state, c, mlen);
+ _u64_le_from_ull(slen, mlen);
+ crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+ crypto_onetimeauth_poly1305_final(&state, c + mlen);
+ sodium_memzero(&state, sizeof state);
+
+ if (clen != NULL) {
+ *clen = mlen + crypto_aead_chacha20poly1305_ABYTES;
+ }
+ return 0;
+}
+
+int
+crypto_aead_chacha20poly1305_decrypt(unsigned char *m,
+ unsigned long long *mlen,
+ unsigned char *nsec,
+ const unsigned char *c,
+ unsigned long long clen,
+ const unsigned char *ad,
+ unsigned long long adlen,
+ const unsigned char *npub,
+ const unsigned char *k)
+{
+ crypto_onetimeauth_poly1305_state state;
+ unsigned char block0[64U];
+ unsigned char slen[8U];
+ unsigned char mac[crypto_aead_chacha20poly1305_ABYTES];
+ int ret;
+
+ (void) nsec;
+ if (mlen != NULL) {
+ *mlen = 0ULL;
+ }
+ if (clen < crypto_aead_chacha20poly1305_ABYTES) {
+ return -1;
+ }
+ crypto_stream_chacha20(block0, sizeof block0, npub, k);
+ crypto_onetimeauth_poly1305_init(&state, block0);
+ sodium_memzero(block0, sizeof block0);
+
+ crypto_onetimeauth_poly1305_update(&state, ad, adlen);
+ _u64_le_from_ull(slen, adlen);
+ crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+ crypto_onetimeauth_poly1305_update
+ (&state, c, clen - crypto_aead_chacha20poly1305_ABYTES);
+ _u64_le_from_ull(slen, clen - crypto_aead_chacha20poly1305_ABYTES);
+ crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+ crypto_onetimeauth_poly1305_final(&state, mac);
+ sodium_memzero(&state, sizeof state);
+
+ (void) sizeof(int[sizeof mac == 16U ? 1 : -1]);
+ ret = crypto_verify_16(mac,
+ c + clen - crypto_aead_chacha20poly1305_ABYTES);
+ sodium_memzero(mac, sizeof mac);
+ if (ret != 0) {
+ memset(m, 0, clen - crypto_aead_chacha20poly1305_ABYTES);
+ return -1;
+ }
+ crypto_stream_chacha20_xor_ic
+ (m, c, clen - crypto_aead_chacha20poly1305_ABYTES, npub, 1U, k);
+ if (mlen != NULL) {
+ *mlen = clen - crypto_aead_chacha20poly1305_ABYTES;
+ }
+ return 0;
+}
+
+size_t
+crypto_aead_chacha20poly1305_keybytes(void) {
+ return crypto_aead_chacha20poly1305_KEYBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_npubbytes(void) {
+ return crypto_aead_chacha20poly1305_NPUBBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_nsecbytes(void) {
+ return crypto_aead_chacha20poly1305_NSECBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_abytes(void) {
+ return crypto_aead_chacha20poly1305_ABYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/crypto_auth.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/crypto_auth.c
new file mode 100644
index 00000000..e76b1494
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/crypto_auth.c
@@ -0,0 +1,34 @@
+
+#include "crypto_auth.h"
+
+size_t
+crypto_auth_bytes(void)
+{
+ return crypto_auth_BYTES;
+}
+
+size_t
+crypto_auth_keybytes(void)
+{
+ return crypto_auth_KEYBYTES;
+}
+
+const char *
+crypto_auth_primitive(void)
+{
+ return crypto_auth_PRIMITIVE;
+}
+
+int
+crypto_auth(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ return crypto_auth_hmacsha512256(out, in, inlen, k);
+}
+
+int
+crypto_auth_verify(const unsigned char *h, const unsigned char *in,
+ unsigned long long inlen,const unsigned char *k)
+{
+ return crypto_auth_hmacsha512256_verify(h, in, inlen, k);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c
new file mode 100644
index 00000000..5af3388a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c
@@ -0,0 +1,11 @@
+#include "crypto_auth_hmacsha256.h"
+
+size_t
+crypto_auth_hmacsha256_bytes(void) {
+ return crypto_auth_hmacsha256_BYTES;
+}
+
+size_t
+crypto_auth_hmacsha256_keybytes(void) {
+ return crypto_auth_hmacsha256_KEYBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/api.h
new file mode 100644
index 00000000..cd4d38e7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/api.h
@@ -0,0 +1,9 @@
+
+#include "crypto_auth_hmacsha256.h"
+
+#define crypto_auth crypto_auth_hmacsha256
+#define crypto_auth_verify crypto_auth_hmacsha256_verify
+#define crypto_auth_BYTES crypto_auth_hmacsha256_BYTES
+#define crypto_auth_KEYBYTES crypto_auth_hmacsha256_KEYBYTES
+#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha256_IMPLEMENTATION
+#define crypto_auth_VERSION crypto_auth_hmacsha256_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/hmac_hmacsha256.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/hmac_hmacsha256.c
new file mode 100644
index 00000000..9cd69ac3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/hmac_hmacsha256.c
@@ -0,0 +1,110 @@
+
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "api.h"
+#include "crypto_auth_hmacsha256.h"
+#include "crypto_hash_sha256.h"
+#include "utils.h"
+
+#include <sys/types.h>
+
+#include <stdint.h>
+#include <string.h>
+
+int
+crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
+ const unsigned char *key,
+ size_t keylen)
+{
+ unsigned char pad[64];
+ unsigned char khash[32];
+ size_t i;
+
+ if (keylen > 64) {
+ crypto_hash_sha256_init(&state->ictx);
+ crypto_hash_sha256_update(&state->ictx, key, keylen);
+ crypto_hash_sha256_final(&state->ictx, khash);
+ key = khash;
+ keylen = 32;
+ }
+ crypto_hash_sha256_init(&state->ictx);
+ memset(pad, 0x36, 64);
+ for (i = 0; i < keylen; i++) {
+ pad[i] ^= key[i];
+ }
+ crypto_hash_sha256_update(&state->ictx, pad, 64);
+
+ crypto_hash_sha256_init(&state->octx);
+ memset(pad, 0x5c, 64);
+ for (i = 0; i < keylen; i++) {
+ pad[i] ^= key[i];
+ }
+ crypto_hash_sha256_update(&state->octx, pad, 64);
+
+ sodium_memzero((void *) khash, sizeof khash);
+
+ return 0;
+}
+
+int
+crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ crypto_hash_sha256_update(&state->ictx, in, inlen);
+
+ return 0;
+}
+
+int
+crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
+ unsigned char *out)
+{
+ unsigned char ihash[32];
+
+ crypto_hash_sha256_final(&state->ictx, ihash);
+ crypto_hash_sha256_update(&state->octx, ihash, 32);
+ crypto_hash_sha256_final(&state->octx, out);
+
+ sodium_memzero((void *) ihash, sizeof ihash);
+
+ return 0;
+}
+
+int
+crypto_auth(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ crypto_auth_hmacsha256_state state;
+
+ crypto_auth_hmacsha256_init(&state, k, crypto_auth_KEYBYTES);
+ crypto_auth_hmacsha256_update(&state, in, inlen);
+ crypto_auth_hmacsha256_final(&state, out);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c
new file mode 100644
index 00000000..be9d34fd
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/verify_hmacsha256.c
@@ -0,0 +1,11 @@
+#include "api.h"
+#include "crypto_verify_32.h"
+#include "utils.h"
+
+int crypto_auth_verify(const unsigned char *h,const unsigned char *in,unsigned long long inlen,const unsigned char *k)
+{
+ unsigned char correct[32];
+ crypto_auth(correct,in,inlen,k);
+ return crypto_verify_32(h,correct) | (-(h - correct == 0)) |
+ sodium_memcmp(correct,h,32);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c
new file mode 100644
index 00000000..54584e14
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512_api.c
@@ -0,0 +1,11 @@
+#include "crypto_auth_hmacsha512.h"
+
+size_t
+crypto_auth_hmacsha512_bytes(void) {
+ return crypto_auth_hmacsha512_BYTES;
+}
+
+size_t
+crypto_auth_hmacsha512_keybytes(void) {
+ return crypto_auth_hmacsha512_KEYBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/api.h
new file mode 100644
index 00000000..0ce40434
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/api.h
@@ -0,0 +1,9 @@
+
+#include "crypto_auth_hmacsha512.h"
+
+#define crypto_auth crypto_auth_hmacsha512
+#define crypto_auth_verify crypto_auth_hmacsha512_verify
+#define crypto_auth_BYTES crypto_auth_hmacsha512_BYTES
+#define crypto_auth_KEYBYTES crypto_auth_hmacsha512_KEYBYTES
+#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512_IMPLEMENTATION
+#define crypto_auth_VERSION crypto_auth_hmacsha512_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/hmac_hmacsha512.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/hmac_hmacsha512.c
new file mode 100644
index 00000000..4ffd2645
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/hmac_hmacsha512.c
@@ -0,0 +1,110 @@
+
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "api.h"
+#include "crypto_auth_hmacsha512.h"
+#include "crypto_hash_sha512.h"
+#include "utils.h"
+
+#include <sys/types.h>
+
+#include <stdint.h>
+#include <string.h>
+
+int
+crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
+ const unsigned char *key,
+ size_t keylen)
+{
+ unsigned char pad[128];
+ unsigned char khash[64];
+ size_t i;
+
+ if (keylen > 128) {
+ crypto_hash_sha512_init(&state->ictx);
+ crypto_hash_sha512_update(&state->ictx, key, keylen);
+ crypto_hash_sha512_final(&state->ictx, khash);
+ key = khash;
+ keylen = 64;
+ }
+ crypto_hash_sha512_init(&state->ictx);
+ memset(pad, 0x36, 128);
+ for (i = 0; i < keylen; i++) {
+ pad[i] ^= key[i];
+ }
+ crypto_hash_sha512_update(&state->ictx, pad, 128);
+
+ crypto_hash_sha512_init(&state->octx);
+ memset(pad, 0x5c, 128);
+ for (i = 0; i < keylen; i++) {
+ pad[i] ^= key[i];
+ }
+ crypto_hash_sha512_update(&state->octx, pad, 128);
+
+ sodium_memzero((void *) khash, sizeof khash);
+
+ return 0;
+}
+
+int
+crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ crypto_hash_sha512_update(&state->ictx, in, inlen);
+
+ return 0;
+}
+
+int
+crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
+ unsigned char *out)
+{
+ unsigned char ihash[64];
+
+ crypto_hash_sha512_final(&state->ictx, ihash);
+ crypto_hash_sha512_update(&state->octx, ihash, 64);
+ crypto_hash_sha512_final(&state->octx, out);
+
+ sodium_memzero((void *) ihash, sizeof ihash);
+
+ return 0;
+}
+
+int
+crypto_auth(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ crypto_auth_hmacsha512_state state;
+
+ crypto_auth_hmacsha512_init(&state, k, crypto_auth_KEYBYTES);
+ crypto_auth_hmacsha512_update(&state, in, inlen);
+ crypto_auth_hmacsha512_final(&state, out);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c
new file mode 100644
index 00000000..28e0dfbe
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/verify_hmacsha512.c
@@ -0,0 +1,12 @@
+#include "api.h"
+#include "crypto_verify_64.h"
+#include "utils.h"
+
+int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ unsigned char correct[64];
+ crypto_auth(correct,in,inlen,k);
+ return crypto_verify_64(h,correct) | (-(h - correct == 0)) |
+ sodium_memcmp(correct,h,64);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c
new file mode 100644
index 00000000..fd0fe9c5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c
@@ -0,0 +1,11 @@
+#include "crypto_auth_hmacsha512256.h"
+
+size_t
+crypto_auth_hmacsha512256_bytes(void) {
+ return crypto_auth_hmacsha512256_BYTES;
+}
+
+size_t
+crypto_auth_hmacsha512256_keybytes(void) {
+ return crypto_auth_hmacsha512256_KEYBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/api.h
new file mode 100644
index 00000000..645b2781
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/api.h
@@ -0,0 +1,9 @@
+
+#include "crypto_auth_hmacsha512256.h"
+
+#define crypto_auth crypto_auth_hmacsha512256
+#define crypto_auth_verify crypto_auth_hmacsha512256_verify
+#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
+#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
+#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512256_IMPLEMENTATION
+#define crypto_auth_VERSION crypto_auth_hmacsha512256_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c
new file mode 100644
index 00000000..4b476c33
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c
@@ -0,0 +1,54 @@
+
+#include "api.h"
+#include "crypto_auth_hmacsha512256.h"
+#include "crypto_auth_hmacsha512.h"
+#include "crypto_hash_sha512.h"
+#include "utils.h"
+
+#include <sys/types.h>
+
+#include <stdint.h>
+#include <string.h>
+
+int
+crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
+ const unsigned char *key,
+ size_t keylen)
+{
+ return crypto_auth_hmacsha512_init((crypto_auth_hmacsha512_state *) state,
+ key, keylen);
+}
+
+int
+crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ return crypto_auth_hmacsha512_update((crypto_auth_hmacsha512_state *) state,
+ in, inlen);
+}
+
+int
+crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
+ unsigned char *out)
+{
+ unsigned char out0[64];
+
+ crypto_auth_hmacsha512_final((crypto_auth_hmacsha512_state *) state, out0);
+ memcpy(out, out0, 32);
+
+ return 0;
+}
+
+int
+crypto_auth(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ crypto_auth_hmacsha512256_state state;
+
+ crypto_auth_hmacsha512256_init(&state, k, crypto_auth_KEYBYTES);
+ crypto_auth_hmacsha512256_update(&state, in, inlen);
+ crypto_auth_hmacsha512256_final(&state, out);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c
new file mode 100644
index 00000000..6c263f34
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c
@@ -0,0 +1,12 @@
+#include "api.h"
+#include "crypto_verify_32.h"
+#include "utils.h"
+
+int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ unsigned char correct[32];
+ crypto_auth(correct,in,inlen,k);
+ return crypto_verify_32(h,correct) | (-(h - correct == 0)) |
+ sodium_memcmp(correct,h,32);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/crypto_box.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/crypto_box.c
new file mode 100644
index 00000000..7ae4297c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/crypto_box.c
@@ -0,0 +1,108 @@
+
+#include "crypto_box.h"
+
+size_t
+crypto_box_seedbytes(void)
+{
+ return crypto_box_SEEDBYTES;
+}
+
+size_t
+crypto_box_publickeybytes(void)
+{
+ return crypto_box_PUBLICKEYBYTES;
+}
+
+size_t
+crypto_box_secretkeybytes(void)
+{
+ return crypto_box_SECRETKEYBYTES;
+}
+
+size_t
+crypto_box_beforenmbytes(void)
+{
+ return crypto_box_BEFORENMBYTES;
+}
+
+size_t
+crypto_box_noncebytes(void)
+{
+ return crypto_box_NONCEBYTES;
+}
+
+size_t
+crypto_box_zerobytes(void)
+{
+ return crypto_box_ZEROBYTES;
+}
+
+size_t
+crypto_box_boxzerobytes(void)
+{
+ return crypto_box_BOXZEROBYTES;
+}
+
+size_t
+crypto_box_macbytes(void)
+{
+ return crypto_box_MACBYTES;
+}
+
+const char *
+crypto_box_primitive(void)
+{
+ return crypto_box_PRIMITIVE;
+}
+
+int
+crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
+ const unsigned char *seed)
+{
+ return crypto_box_curve25519xsalsa20poly1305_seed_keypair(pk, sk, seed);
+}
+
+int
+crypto_box_keypair(unsigned char *pk, unsigned char *sk)
+{
+ return crypto_box_curve25519xsalsa20poly1305_keypair(pk, sk);
+}
+
+int
+crypto_box_beforenm(unsigned char *k, const unsigned char *pk,
+ const unsigned char *sk)
+{
+ return crypto_box_curve25519xsalsa20poly1305_beforenm(k, pk, sk);
+}
+
+int
+crypto_box_afternm(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ return crypto_box_curve25519xsalsa20poly1305_afternm(c, m, mlen, n, k);
+}
+
+int
+crypto_box_open_afternm(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k)
+{
+ return crypto_box_curve25519xsalsa20poly1305_open_afternm(m, c, clen, n, k);
+}
+
+int
+crypto_box(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk)
+{
+ return crypto_box_curve25519xsalsa20poly1305(c, m, mlen, n, pk, sk);
+}
+
+int
+crypto_box_open(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk)
+{
+ return crypto_box_curve25519xsalsa20poly1305_open(m, c, clen, n, pk, sk);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/crypto_box_easy.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/crypto_box_easy.c
new file mode 100644
index 00000000..a4066c5c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/crypto_box_easy.c
@@ -0,0 +1,109 @@
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "crypto_box.h"
+#include "crypto_secretbox.h"
+#include "utils.h"
+
+int
+crypto_box_detached_afternm(unsigned char *c, unsigned char *mac,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *n, const unsigned char *k)
+{
+ return crypto_secretbox_detached(c, mac, m, mlen, n, k);
+}
+
+int
+crypto_box_detached(unsigned char *c, unsigned char *mac,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *n, const unsigned char *pk,
+ const unsigned char *sk)
+{
+ unsigned char k[crypto_box_BEFORENMBYTES];
+ int ret;
+
+ (void) sizeof(int[crypto_box_BEFORENMBYTES >=
+ crypto_secretbox_KEYBYTES ? 1 : -1]);
+ crypto_box_beforenm(k, pk, sk);
+ ret = crypto_box_detached_afternm(c, mac, m, mlen, n, k);
+ sodium_memzero(k, sizeof k);
+
+ return ret;
+}
+
+int
+crypto_box_easy_afternm(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ if (mlen > SIZE_MAX - crypto_box_MACBYTES) {
+ return -1;
+ }
+ return crypto_box_detached_afternm(c + crypto_box_MACBYTES, c, m, mlen, n,
+ k);
+}
+
+int
+crypto_box_easy(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk)
+{
+ if (mlen > SIZE_MAX - crypto_box_MACBYTES) {
+ return -1;
+ }
+ return crypto_box_detached(c + crypto_box_MACBYTES, c, m, mlen, n,
+ pk, sk);
+}
+
+int
+crypto_box_open_detached_afternm(unsigned char *m, const unsigned char *c,
+ const unsigned char *mac,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k)
+{
+ return crypto_secretbox_open_detached(m, c, mac, clen, n, k);
+}
+
+int
+crypto_box_open_detached(unsigned char *m, const unsigned char *c,
+ const unsigned char *mac,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk)
+{
+ unsigned char k[crypto_box_BEFORENMBYTES];
+ int ret;
+
+ crypto_box_beforenm(k, pk, sk);
+ ret = crypto_box_open_detached_afternm(m, c, mac, clen, n, k);
+ sodium_memzero(k, sizeof k);
+
+ return ret;
+}
+
+int
+crypto_box_open_easy_afternm(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k)
+{
+ if (clen < crypto_box_MACBYTES) {
+ return -1;
+ }
+ return crypto_box_open_detached_afternm(m, c + crypto_box_MACBYTES, c,
+ clen - crypto_box_MACBYTES,
+ n, k);
+}
+
+int
+crypto_box_open_easy(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk)
+{
+ if (clen < crypto_box_MACBYTES) {
+ return -1;
+ }
+ return crypto_box_open_detached(m, c + crypto_box_MACBYTES, c,
+ clen - crypto_box_MACBYTES,
+ n, pk, sk);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c
new file mode 100644
index 00000000..1c002d2d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c
@@ -0,0 +1,41 @@
+#include "crypto_box_curve25519xsalsa20poly1305.h"
+
+size_t
+crypto_box_curve25519xsalsa20poly1305_seedbytes(void) {
+ return crypto_box_curve25519xsalsa20poly1305_SEEDBYTES;
+}
+
+size_t
+crypto_box_curve25519xsalsa20poly1305_publickeybytes(void) {
+ return crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES;
+}
+
+size_t
+crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void) {
+ return crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES;
+}
+
+size_t
+crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void) {
+ return crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES;
+}
+
+size_t
+crypto_box_curve25519xsalsa20poly1305_noncebytes(void) {
+ return crypto_box_curve25519xsalsa20poly1305_NONCEBYTES;
+}
+
+size_t
+crypto_box_curve25519xsalsa20poly1305_zerobytes(void) {
+ return crypto_box_curve25519xsalsa20poly1305_ZEROBYTES;
+}
+
+size_t
+crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void) {
+ return crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES;
+}
+
+size_t
+crypto_box_curve25519xsalsa20poly1305_macbytes(void) {
+ return crypto_box_curve25519xsalsa20poly1305_MACBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c
new file mode 100644
index 00000000..a830936b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c
@@ -0,0 +1,22 @@
+#include "api.h"
+#include "crypto_secretbox_xsalsa20poly1305.h"
+
+int crypto_box_afternm(
+ unsigned char *c,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ return crypto_secretbox_xsalsa20poly1305(c,m,mlen,n,k);
+}
+
+int crypto_box_open_afternm(
+ unsigned char *m,
+ const unsigned char *c,unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ return crypto_secretbox_xsalsa20poly1305_open(m,c,clen,n,k);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h
new file mode 100644
index 00000000..7f320c6f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h
@@ -0,0 +1,20 @@
+
+#include "crypto_box_curve25519xsalsa20poly1305.h"
+
+#define crypto_box crypto_box_curve25519xsalsa20poly1305
+#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open
+#define crypto_box_seed_keypair crypto_box_curve25519xsalsa20poly1305_seed_keypair
+#define crypto_box_keypair crypto_box_curve25519xsalsa20poly1305_keypair
+#define crypto_box_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm
+#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm
+#define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm
+#define crypto_box_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
+#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
+#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
+#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
+#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
+#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
+#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
+#define crypto_box_MACBYTES (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES)
+#define crypto_box_IMPLEMENTATION crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION
+#define crypto_box_VERSION crypto_box_curve25519xsalsa20poly1305_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c
new file mode 100644
index 00000000..40d4300e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c
@@ -0,0 +1,19 @@
+#include "api.h"
+#include "crypto_core_hsalsa20.h"
+#include "crypto_scalarmult_curve25519.h"
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+static const unsigned char n[16] = {0};
+
+int crypto_box_beforenm(
+ unsigned char *k,
+ const unsigned char *pk,
+ const unsigned char *sk
+)
+{
+ unsigned char s[32];
+ crypto_scalarmult_curve25519(s,sk,pk);
+ return crypto_core_hsalsa20(k,n,s,sigma);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c
new file mode 100644
index 00000000..ebc208a3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c
@@ -0,0 +1,38 @@
+#include "api.h"
+#include "utils.h"
+
+int crypto_box(
+ unsigned char *c,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *pk,
+ const unsigned char *sk
+)
+{
+ unsigned char k[crypto_box_BEFORENMBYTES];
+ int ret;
+
+ crypto_box_beforenm(k,pk,sk);
+ ret = crypto_box_afternm(c,m,mlen,n,k);
+ sodium_memzero(k, sizeof k);
+
+ return ret;
+}
+
+int crypto_box_open(
+ unsigned char *m,
+ const unsigned char *c,unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *pk,
+ const unsigned char *sk
+)
+{
+ unsigned char k[crypto_box_BEFORENMBYTES];
+ int ret;
+
+ crypto_box_beforenm(k,pk,sk);
+ ret = crypto_box_open_afternm(m,c,clen,n,k);
+ sodium_memzero(k, sizeof k);
+
+ return ret;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c
new file mode 100644
index 00000000..e2a03faa
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c
@@ -0,0 +1,27 @@
+#include <string.h>
+
+#include "crypto_hash_sha512.h"
+#include "crypto_scalarmult_curve25519.h"
+#include "api.h"
+#include "randombytes.h"
+
+int crypto_box_seed_keypair(
+ unsigned char *pk,
+ unsigned char *sk,
+ const unsigned char *seed
+)
+{
+ unsigned char hash[64];
+ crypto_hash_sha512(hash,seed,32);
+ memmove(sk,hash,32);
+ return crypto_scalarmult_curve25519_base(pk,sk);
+}
+
+int crypto_box_keypair(
+ unsigned char *pk,
+ unsigned char *sk
+)
+{
+ randombytes_buf(sk,32);
+ return crypto_scalarmult_curve25519_base(pk,sk);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c
new file mode 100644
index 00000000..37c4923a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c
@@ -0,0 +1,21 @@
+#include "crypto_core_hsalsa20.h"
+
+size_t
+crypto_core_hsalsa20_outputbytes(void) {
+ return crypto_core_hsalsa20_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_hsalsa20_inputbytes(void) {
+ return crypto_core_hsalsa20_INPUTBYTES;
+}
+
+size_t
+crypto_core_hsalsa20_keybytes(void) {
+ return crypto_core_hsalsa20_KEYBYTES;
+}
+
+size_t
+crypto_core_hsalsa20_constbytes(void) {
+ return crypto_core_hsalsa20_CONSTBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h
new file mode 100644
index 00000000..582cba65
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h
@@ -0,0 +1,10 @@
+
+#include "crypto_core_hsalsa20.h"
+
+#define crypto_core crypto_core_hsalsa20
+#define crypto_core_OUTPUTBYTES crypto_core_hsalsa20_OUTPUTBYTES
+#define crypto_core_INPUTBYTES crypto_core_hsalsa20_INPUTBYTES
+#define crypto_core_KEYBYTES crypto_core_hsalsa20_KEYBYTES
+#define crypto_core_CONSTBYTES crypto_core_hsalsa20_CONSTBYTES
+#define crypto_core_IMPLEMENTATION crypto_core_hsalsa20_IMPLEMENTATION
+#define crypto_core_VERSION crypto_core_hsalsa20_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c
new file mode 100644
index 00000000..c9bd359e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c
@@ -0,0 +1,108 @@
+/*
+version 20080912
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+
+#define ROUNDS 20
+
+typedef unsigned int uint32;
+
+static uint32 rotate(uint32 u,int c)
+{
+ return (u << c) | (u >> (32 - c));
+}
+
+static uint32 load_littleendian(const unsigned char *x)
+{
+ return
+ (uint32) (x[0]) \
+ | (((uint32) (x[1])) << 8) \
+ | (((uint32) (x[2])) << 16) \
+ | (((uint32) (x[3])) << 24)
+ ;
+}
+
+static void store_littleendian(unsigned char *x,uint32 u)
+{
+ x[0] = u; u >>= 8;
+ x[1] = u; u >>= 8;
+ x[2] = u; u >>= 8;
+ x[3] = u;
+}
+
+int crypto_core(
+ unsigned char *out,
+ const unsigned char *in,
+ const unsigned char *k,
+ const unsigned char *c
+)
+{
+ uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
+ int i;
+
+ x0 = load_littleendian(c + 0);
+ x1 = load_littleendian(k + 0);
+ x2 = load_littleendian(k + 4);
+ x3 = load_littleendian(k + 8);
+ x4 = load_littleendian(k + 12);
+ x5 = load_littleendian(c + 4);
+ x6 = load_littleendian(in + 0);
+ x7 = load_littleendian(in + 4);
+ x8 = load_littleendian(in + 8);
+ x9 = load_littleendian(in + 12);
+ x10 = load_littleendian(c + 8);
+ x11 = load_littleendian(k + 16);
+ x12 = load_littleendian(k + 20);
+ x13 = load_littleendian(k + 24);
+ x14 = load_littleendian(k + 28);
+ x15 = load_littleendian(c + 12);
+
+ for (i = ROUNDS;i > 0;i -= 2) {
+ x4 ^= rotate( x0+x12, 7);
+ x8 ^= rotate( x4+ x0, 9);
+ x12 ^= rotate( x8+ x4,13);
+ x0 ^= rotate(x12+ x8,18);
+ x9 ^= rotate( x5+ x1, 7);
+ x13 ^= rotate( x9+ x5, 9);
+ x1 ^= rotate(x13+ x9,13);
+ x5 ^= rotate( x1+x13,18);
+ x14 ^= rotate(x10+ x6, 7);
+ x2 ^= rotate(x14+x10, 9);
+ x6 ^= rotate( x2+x14,13);
+ x10 ^= rotate( x6+ x2,18);
+ x3 ^= rotate(x15+x11, 7);
+ x7 ^= rotate( x3+x15, 9);
+ x11 ^= rotate( x7+ x3,13);
+ x15 ^= rotate(x11+ x7,18);
+ x1 ^= rotate( x0+ x3, 7);
+ x2 ^= rotate( x1+ x0, 9);
+ x3 ^= rotate( x2+ x1,13);
+ x0 ^= rotate( x3+ x2,18);
+ x6 ^= rotate( x5+ x4, 7);
+ x7 ^= rotate( x6+ x5, 9);
+ x4 ^= rotate( x7+ x6,13);
+ x5 ^= rotate( x4+ x7,18);
+ x11 ^= rotate(x10+ x9, 7);
+ x8 ^= rotate(x11+x10, 9);
+ x9 ^= rotate( x8+x11,13);
+ x10 ^= rotate( x9+ x8,18);
+ x12 ^= rotate(x15+x14, 7);
+ x13 ^= rotate(x12+x15, 9);
+ x14 ^= rotate(x13+x12,13);
+ x15 ^= rotate(x14+x13,18);
+ }
+
+ store_littleendian(out + 0,x0);
+ store_littleendian(out + 4,x5);
+ store_littleendian(out + 8,x10);
+ store_littleendian(out + 12,x15);
+ store_littleendian(out + 16,x6);
+ store_littleendian(out + 20,x7);
+ store_littleendian(out + 24,x8);
+ store_littleendian(out + 28,x9);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c
new file mode 100644
index 00000000..910b4619
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c
@@ -0,0 +1,21 @@
+#include "crypto_core_salsa20.h"
+
+size_t
+crypto_core_salsa20_outputbytes(void) {
+ return crypto_core_salsa20_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_salsa20_inputbytes(void) {
+ return crypto_core_salsa20_INPUTBYTES;
+}
+
+size_t
+crypto_core_salsa20_keybytes(void) {
+ return crypto_core_salsa20_KEYBYTES;
+}
+
+size_t
+crypto_core_salsa20_constbytes(void) {
+ return crypto_core_salsa20_CONSTBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h
new file mode 100644
index 00000000..d34ddeb4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h
@@ -0,0 +1,10 @@
+
+#include "crypto_core_salsa20.h"
+
+#define crypto_core crypto_core_salsa20
+#define crypto_core_OUTPUTBYTES crypto_core_salsa20_OUTPUTBYTES
+#define crypto_core_INPUTBYTES crypto_core_salsa20_INPUTBYTES
+#define crypto_core_KEYBYTES crypto_core_salsa20_KEYBYTES
+#define crypto_core_CONSTBYTES crypto_core_salsa20_CONSTBYTES
+#define crypto_core_IMPLEMENTATION crypto_core_salsa20_IMPLEMENTATION
+#define crypto_core_VERSION crypto_core_salsa20_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c
new file mode 100644
index 00000000..b2f6f5c7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c
@@ -0,0 +1,134 @@
+/*
+version 20080912
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+
+#define ROUNDS 20
+
+typedef unsigned int uint32;
+
+static uint32 rotate(uint32 u,int c)
+{
+ return (u << c) | (u >> (32 - c));
+}
+
+static uint32 load_littleendian(const unsigned char *x)
+{
+ return
+ (uint32) (x[0]) \
+ | (((uint32) (x[1])) << 8) \
+ | (((uint32) (x[2])) << 16) \
+ | (((uint32) (x[3])) << 24)
+ ;
+}
+
+static void store_littleendian(unsigned char *x,uint32 u)
+{
+ x[0] = u; u >>= 8;
+ x[1] = u; u >>= 8;
+ x[2] = u; u >>= 8;
+ x[3] = u;
+}
+
+int crypto_core(
+ unsigned char *out,
+ const unsigned char *in,
+ const unsigned char *k,
+ const unsigned char *c
+)
+{
+ uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
+ uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
+ int i;
+
+ j0 = x0 = load_littleendian(c + 0);
+ j1 = x1 = load_littleendian(k + 0);
+ j2 = x2 = load_littleendian(k + 4);
+ j3 = x3 = load_littleendian(k + 8);
+ j4 = x4 = load_littleendian(k + 12);
+ j5 = x5 = load_littleendian(c + 4);
+ j6 = x6 = load_littleendian(in + 0);
+ j7 = x7 = load_littleendian(in + 4);
+ j8 = x8 = load_littleendian(in + 8);
+ j9 = x9 = load_littleendian(in + 12);
+ j10 = x10 = load_littleendian(c + 8);
+ j11 = x11 = load_littleendian(k + 16);
+ j12 = x12 = load_littleendian(k + 20);
+ j13 = x13 = load_littleendian(k + 24);
+ j14 = x14 = load_littleendian(k + 28);
+ j15 = x15 = load_littleendian(c + 12);
+
+ for (i = ROUNDS;i > 0;i -= 2) {
+ x4 ^= rotate( x0+x12, 7);
+ x8 ^= rotate( x4+ x0, 9);
+ x12 ^= rotate( x8+ x4,13);
+ x0 ^= rotate(x12+ x8,18);
+ x9 ^= rotate( x5+ x1, 7);
+ x13 ^= rotate( x9+ x5, 9);
+ x1 ^= rotate(x13+ x9,13);
+ x5 ^= rotate( x1+x13,18);
+ x14 ^= rotate(x10+ x6, 7);
+ x2 ^= rotate(x14+x10, 9);
+ x6 ^= rotate( x2+x14,13);
+ x10 ^= rotate( x6+ x2,18);
+ x3 ^= rotate(x15+x11, 7);
+ x7 ^= rotate( x3+x15, 9);
+ x11 ^= rotate( x7+ x3,13);
+ x15 ^= rotate(x11+ x7,18);
+ x1 ^= rotate( x0+ x3, 7);
+ x2 ^= rotate( x1+ x0, 9);
+ x3 ^= rotate( x2+ x1,13);
+ x0 ^= rotate( x3+ x2,18);
+ x6 ^= rotate( x5+ x4, 7);
+ x7 ^= rotate( x6+ x5, 9);
+ x4 ^= rotate( x7+ x6,13);
+ x5 ^= rotate( x4+ x7,18);
+ x11 ^= rotate(x10+ x9, 7);
+ x8 ^= rotate(x11+x10, 9);
+ x9 ^= rotate( x8+x11,13);
+ x10 ^= rotate( x9+ x8,18);
+ x12 ^= rotate(x15+x14, 7);
+ x13 ^= rotate(x12+x15, 9);
+ x14 ^= rotate(x13+x12,13);
+ x15 ^= rotate(x14+x13,18);
+ }
+
+ x0 += j0;
+ x1 += j1;
+ x2 += j2;
+ x3 += j3;
+ x4 += j4;
+ x5 += j5;
+ x6 += j6;
+ x7 += j7;
+ x8 += j8;
+ x9 += j9;
+ x10 += j10;
+ x11 += j11;
+ x12 += j12;
+ x13 += j13;
+ x14 += j14;
+ x15 += j15;
+
+ store_littleendian(out + 0,x0);
+ store_littleendian(out + 4,x1);
+ store_littleendian(out + 8,x2);
+ store_littleendian(out + 12,x3);
+ store_littleendian(out + 16,x4);
+ store_littleendian(out + 20,x5);
+ store_littleendian(out + 24,x6);
+ store_littleendian(out + 28,x7);
+ store_littleendian(out + 32,x8);
+ store_littleendian(out + 36,x9);
+ store_littleendian(out + 40,x10);
+ store_littleendian(out + 44,x11);
+ store_littleendian(out + 48,x12);
+ store_littleendian(out + 52,x13);
+ store_littleendian(out + 56,x14);
+ store_littleendian(out + 60,x15);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c
new file mode 100644
index 00000000..e49a81e7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c
@@ -0,0 +1,21 @@
+#include "crypto_core_salsa2012.h"
+
+size_t
+crypto_core_salsa2012_outputbytes(void) {
+ return crypto_core_salsa2012_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_salsa2012_inputbytes(void) {
+ return crypto_core_salsa2012_INPUTBYTES;
+}
+
+size_t
+crypto_core_salsa2012_keybytes(void) {
+ return crypto_core_salsa2012_KEYBYTES;
+}
+
+size_t
+crypto_core_salsa2012_constbytes(void) {
+ return crypto_core_salsa2012_CONSTBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h
new file mode 100644
index 00000000..76919a0c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h
@@ -0,0 +1,10 @@
+
+#include "crypto_core_salsa2012.h"
+
+#define crypto_core crypto_core_salsa2012
+#define crypto_core_OUTPUTBYTES crypto_core_salsa2012_OUTPUTBYTES
+#define crypto_core_INPUTBYTES crypto_core_salsa2012_INPUTBYTES
+#define crypto_core_KEYBYTES crypto_core_salsa2012_KEYBYTES
+#define crypto_core_CONSTBYTES crypto_core_salsa2012_CONSTBYTES
+#define crypto_core_IMPLEMENTATION crypto_core_salsa2012_IMPLEMENTATION
+#define crypto_core_VERSION crypto_core_salsa2012_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c
new file mode 100644
index 00000000..07a72e71
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c
@@ -0,0 +1,134 @@
+/*
+version 20080913
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+
+#define ROUNDS 12
+
+typedef unsigned int uint32;
+
+static uint32 rotate(uint32 u,int c)
+{
+ return (u << c) | (u >> (32 - c));
+}
+
+static uint32 load_littleendian(const unsigned char *x)
+{
+ return
+ (uint32) (x[0]) \
+ | (((uint32) (x[1])) << 8) \
+ | (((uint32) (x[2])) << 16) \
+ | (((uint32) (x[3])) << 24)
+ ;
+}
+
+static void store_littleendian(unsigned char *x,uint32 u)
+{
+ x[0] = u; u >>= 8;
+ x[1] = u; u >>= 8;
+ x[2] = u; u >>= 8;
+ x[3] = u;
+}
+
+int crypto_core(
+ unsigned char *out,
+ const unsigned char *in,
+ const unsigned char *k,
+ const unsigned char *c
+)
+{
+ uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
+ uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
+ int i;
+
+ j0 = x0 = load_littleendian(c + 0);
+ j1 = x1 = load_littleendian(k + 0);
+ j2 = x2 = load_littleendian(k + 4);
+ j3 = x3 = load_littleendian(k + 8);
+ j4 = x4 = load_littleendian(k + 12);
+ j5 = x5 = load_littleendian(c + 4);
+ j6 = x6 = load_littleendian(in + 0);
+ j7 = x7 = load_littleendian(in + 4);
+ j8 = x8 = load_littleendian(in + 8);
+ j9 = x9 = load_littleendian(in + 12);
+ j10 = x10 = load_littleendian(c + 8);
+ j11 = x11 = load_littleendian(k + 16);
+ j12 = x12 = load_littleendian(k + 20);
+ j13 = x13 = load_littleendian(k + 24);
+ j14 = x14 = load_littleendian(k + 28);
+ j15 = x15 = load_littleendian(c + 12);
+
+ for (i = ROUNDS;i > 0;i -= 2) {
+ x4 ^= rotate( x0+x12, 7);
+ x8 ^= rotate( x4+ x0, 9);
+ x12 ^= rotate( x8+ x4,13);
+ x0 ^= rotate(x12+ x8,18);
+ x9 ^= rotate( x5+ x1, 7);
+ x13 ^= rotate( x9+ x5, 9);
+ x1 ^= rotate(x13+ x9,13);
+ x5 ^= rotate( x1+x13,18);
+ x14 ^= rotate(x10+ x6, 7);
+ x2 ^= rotate(x14+x10, 9);
+ x6 ^= rotate( x2+x14,13);
+ x10 ^= rotate( x6+ x2,18);
+ x3 ^= rotate(x15+x11, 7);
+ x7 ^= rotate( x3+x15, 9);
+ x11 ^= rotate( x7+ x3,13);
+ x15 ^= rotate(x11+ x7,18);
+ x1 ^= rotate( x0+ x3, 7);
+ x2 ^= rotate( x1+ x0, 9);
+ x3 ^= rotate( x2+ x1,13);
+ x0 ^= rotate( x3+ x2,18);
+ x6 ^= rotate( x5+ x4, 7);
+ x7 ^= rotate( x6+ x5, 9);
+ x4 ^= rotate( x7+ x6,13);
+ x5 ^= rotate( x4+ x7,18);
+ x11 ^= rotate(x10+ x9, 7);
+ x8 ^= rotate(x11+x10, 9);
+ x9 ^= rotate( x8+x11,13);
+ x10 ^= rotate( x9+ x8,18);
+ x12 ^= rotate(x15+x14, 7);
+ x13 ^= rotate(x12+x15, 9);
+ x14 ^= rotate(x13+x12,13);
+ x15 ^= rotate(x14+x13,18);
+ }
+
+ x0 += j0;
+ x1 += j1;
+ x2 += j2;
+ x3 += j3;
+ x4 += j4;
+ x5 += j5;
+ x6 += j6;
+ x7 += j7;
+ x8 += j8;
+ x9 += j9;
+ x10 += j10;
+ x11 += j11;
+ x12 += j12;
+ x13 += j13;
+ x14 += j14;
+ x15 += j15;
+
+ store_littleendian(out + 0,x0);
+ store_littleendian(out + 4,x1);
+ store_littleendian(out + 8,x2);
+ store_littleendian(out + 12,x3);
+ store_littleendian(out + 16,x4);
+ store_littleendian(out + 20,x5);
+ store_littleendian(out + 24,x6);
+ store_littleendian(out + 28,x7);
+ store_littleendian(out + 32,x8);
+ store_littleendian(out + 36,x9);
+ store_littleendian(out + 40,x10);
+ store_littleendian(out + 44,x11);
+ store_littleendian(out + 48,x12);
+ store_littleendian(out + 52,x13);
+ store_littleendian(out + 56,x14);
+ store_littleendian(out + 60,x15);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c
new file mode 100644
index 00000000..72c336c4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c
@@ -0,0 +1,21 @@
+#include "crypto_core_salsa208.h"
+
+size_t
+crypto_core_salsa208_outputbytes(void) {
+ return crypto_core_salsa208_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_salsa208_inputbytes(void) {
+ return crypto_core_salsa208_INPUTBYTES;
+}
+
+size_t
+crypto_core_salsa208_keybytes(void) {
+ return crypto_core_salsa208_KEYBYTES;
+}
+
+size_t
+crypto_core_salsa208_constbytes(void) {
+ return crypto_core_salsa208_CONSTBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h
new file mode 100644
index 00000000..07d090b3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h
@@ -0,0 +1,10 @@
+
+#include "crypto_core_salsa208.h"
+
+#define crypto_core crypto_core_salsa208
+#define crypto_core_OUTPUTBYTES crypto_core_salsa208_OUTPUTBYTES
+#define crypto_core_INPUTBYTES crypto_core_salsa208_INPUTBYTES
+#define crypto_core_KEYBYTES crypto_core_salsa208_KEYBYTES
+#define crypto_core_CONSTBYTES crypto_core_salsa208_CONSTBYTES
+#define crypto_core_IMPLEMENTATION crypto_core_salsa208_IMPLEMENTATION
+#define crypto_core_VERSION crypto_core_salsa208_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c
new file mode 100644
index 00000000..be26f82a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c
@@ -0,0 +1,134 @@
+/*
+version 20080913
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+
+#define ROUNDS 8
+
+typedef unsigned int uint32;
+
+static uint32 rotate(uint32 u,int c)
+{
+ return (u << c) | (u >> (32 - c));
+}
+
+static uint32 load_littleendian(const unsigned char *x)
+{
+ return
+ (uint32) (x[0]) \
+ | (((uint32) (x[1])) << 8) \
+ | (((uint32) (x[2])) << 16) \
+ | (((uint32) (x[3])) << 24)
+ ;
+}
+
+static void store_littleendian(unsigned char *x,uint32 u)
+{
+ x[0] = u; u >>= 8;
+ x[1] = u; u >>= 8;
+ x[2] = u; u >>= 8;
+ x[3] = u;
+}
+
+int crypto_core(
+ unsigned char *out,
+ const unsigned char *in,
+ const unsigned char *k,
+ const unsigned char *c
+)
+{
+ uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
+ uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
+ int i;
+
+ j0 = x0 = load_littleendian(c + 0);
+ j1 = x1 = load_littleendian(k + 0);
+ j2 = x2 = load_littleendian(k + 4);
+ j3 = x3 = load_littleendian(k + 8);
+ j4 = x4 = load_littleendian(k + 12);
+ j5 = x5 = load_littleendian(c + 4);
+ j6 = x6 = load_littleendian(in + 0);
+ j7 = x7 = load_littleendian(in + 4);
+ j8 = x8 = load_littleendian(in + 8);
+ j9 = x9 = load_littleendian(in + 12);
+ j10 = x10 = load_littleendian(c + 8);
+ j11 = x11 = load_littleendian(k + 16);
+ j12 = x12 = load_littleendian(k + 20);
+ j13 = x13 = load_littleendian(k + 24);
+ j14 = x14 = load_littleendian(k + 28);
+ j15 = x15 = load_littleendian(c + 12);
+
+ for (i = ROUNDS;i > 0;i -= 2) {
+ x4 ^= rotate( x0+x12, 7);
+ x8 ^= rotate( x4+ x0, 9);
+ x12 ^= rotate( x8+ x4,13);
+ x0 ^= rotate(x12+ x8,18);
+ x9 ^= rotate( x5+ x1, 7);
+ x13 ^= rotate( x9+ x5, 9);
+ x1 ^= rotate(x13+ x9,13);
+ x5 ^= rotate( x1+x13,18);
+ x14 ^= rotate(x10+ x6, 7);
+ x2 ^= rotate(x14+x10, 9);
+ x6 ^= rotate( x2+x14,13);
+ x10 ^= rotate( x6+ x2,18);
+ x3 ^= rotate(x15+x11, 7);
+ x7 ^= rotate( x3+x15, 9);
+ x11 ^= rotate( x7+ x3,13);
+ x15 ^= rotate(x11+ x7,18);
+ x1 ^= rotate( x0+ x3, 7);
+ x2 ^= rotate( x1+ x0, 9);
+ x3 ^= rotate( x2+ x1,13);
+ x0 ^= rotate( x3+ x2,18);
+ x6 ^= rotate( x5+ x4, 7);
+ x7 ^= rotate( x6+ x5, 9);
+ x4 ^= rotate( x7+ x6,13);
+ x5 ^= rotate( x4+ x7,18);
+ x11 ^= rotate(x10+ x9, 7);
+ x8 ^= rotate(x11+x10, 9);
+ x9 ^= rotate( x8+x11,13);
+ x10 ^= rotate( x9+ x8,18);
+ x12 ^= rotate(x15+x14, 7);
+ x13 ^= rotate(x12+x15, 9);
+ x14 ^= rotate(x13+x12,13);
+ x15 ^= rotate(x14+x13,18);
+ }
+
+ x0 += j0;
+ x1 += j1;
+ x2 += j2;
+ x3 += j3;
+ x4 += j4;
+ x5 += j5;
+ x6 += j6;
+ x7 += j7;
+ x8 += j8;
+ x9 += j9;
+ x10 += j10;
+ x11 += j11;
+ x12 += j12;
+ x13 += j13;
+ x14 += j14;
+ x15 += j15;
+
+ store_littleendian(out + 0,x0);
+ store_littleendian(out + 4,x1);
+ store_littleendian(out + 8,x2);
+ store_littleendian(out + 12,x3);
+ store_littleendian(out + 16,x4);
+ store_littleendian(out + 20,x5);
+ store_littleendian(out + 24,x6);
+ store_littleendian(out + 28,x7);
+ store_littleendian(out + 32,x8);
+ store_littleendian(out + 36,x9);
+ store_littleendian(out + 40,x10);
+ store_littleendian(out + 44,x11);
+ store_littleendian(out + 48,x12);
+ store_littleendian(out + 52,x13);
+ store_littleendian(out + 56,x14);
+ store_littleendian(out + 60,x15);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c
new file mode 100644
index 00000000..b775921e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c
@@ -0,0 +1,41 @@
+#include "crypto_generichash_blake2b.h"
+
+size_t
+crypto_generichash_blake2b_bytes_min(void) {
+ return crypto_generichash_blake2b_BYTES_MIN;
+}
+
+size_t
+crypto_generichash_blake2b_bytes_max(void) {
+ return crypto_generichash_blake2b_BYTES_MAX;
+}
+
+size_t
+crypto_generichash_blake2b_bytes(void) {
+ return crypto_generichash_blake2b_BYTES;
+}
+
+size_t
+crypto_generichash_blake2b_keybytes_min(void) {
+ return crypto_generichash_blake2b_KEYBYTES_MIN;
+}
+
+size_t
+crypto_generichash_blake2b_keybytes_max(void) {
+ return crypto_generichash_blake2b_KEYBYTES_MAX;
+}
+
+size_t
+crypto_generichash_blake2b_keybytes(void) {
+ return crypto_generichash_blake2b_KEYBYTES;
+}
+
+size_t
+crypto_generichash_blake2b_saltbytes(void) {
+ return crypto_generichash_blake2b_SALTBYTES;
+}
+
+size_t
+crypto_generichash_blake2b_personalbytes(void) {
+ return crypto_generichash_blake2b_PERSONALBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h
new file mode 100644
index 00000000..130d2461
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h
@@ -0,0 +1,2 @@
+
+#include "crypto_generichash_blake2b.h"
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h
new file mode 100644
index 00000000..b4b0229d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h
@@ -0,0 +1,137 @@
+/*
+ BLAKE2 reference source code package - reference C implementations
+
+ Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
+
+ To the extent possible under law, the author(s) have dedicated all copyright
+ and related and neighboring rights to this software to the public domain
+ worldwide. This software is distributed without any warranty.
+
+ You should have received a copy of the CC0 Public Domain Dedication along with
+ this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+*/
+
+#ifndef blake2_impl_H
+#define blake2_impl_H
+
+#include <stdint.h>
+#include <string.h>
+
+#include "utils.h"
+
+static inline uint32_t load32( const void *src )
+{
+#if defined(NATIVE_LITTLE_ENDIAN)
+ uint32_t w;
+ memcpy(&w, src, sizeof w);
+ return w;
+#else
+ const uint8_t *p = ( const uint8_t * )src;
+ uint32_t w = *p++;
+ w |= ( uint32_t )( *p++ ) << 8;
+ w |= ( uint32_t )( *p++ ) << 16;
+ w |= ( uint32_t )( *p++ ) << 24;
+ return w;
+#endif
+}
+
+static inline uint64_t load64( const void *src )
+{
+#if defined(NATIVE_LITTLE_ENDIAN)
+ uint64_t w;
+ memcpy(&w, src, sizeof w);
+ return w;
+#else
+ const uint8_t *p = ( const uint8_t * )src;
+ uint64_t w = *p++;
+ w |= ( uint64_t )( *p++ ) << 8;
+ w |= ( uint64_t )( *p++ ) << 16;
+ w |= ( uint64_t )( *p++ ) << 24;
+ w |= ( uint64_t )( *p++ ) << 32;
+ w |= ( uint64_t )( *p++ ) << 40;
+ w |= ( uint64_t )( *p++ ) << 48;
+ w |= ( uint64_t )( *p++ ) << 56;
+ return w;
+#endif
+}
+
+static inline void store32( void *dst, uint32_t w )
+{
+#if defined(NATIVE_LITTLE_ENDIAN)
+ memcpy(dst, &w, sizeof w);
+#else
+ uint8_t *p = ( uint8_t * )dst;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w;
+#endif
+}
+
+static inline void store64( void *dst, uint64_t w )
+{
+#if defined(NATIVE_LITTLE_ENDIAN)
+ memcpy(dst, &w, sizeof w);
+#else
+ uint8_t *p = ( uint8_t * )dst;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w;
+#endif
+}
+
+static inline uint64_t load48( const void *src )
+{
+ const uint8_t *p = ( const uint8_t * )src;
+ uint64_t w = *p++;
+ w |= ( uint64_t )( *p++ ) << 8;
+ w |= ( uint64_t )( *p++ ) << 16;
+ w |= ( uint64_t )( *p++ ) << 24;
+ w |= ( uint64_t )( *p++ ) << 32;
+ w |= ( uint64_t )( *p++ ) << 40;
+ return w;
+}
+
+static inline void store48( void *dst, uint64_t w )
+{
+ uint8_t *p = ( uint8_t * )dst;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w; w >>= 8;
+ *p++ = ( uint8_t )w;
+}
+
+static inline uint32_t rotl32( const uint32_t w, const unsigned c )
+{
+ return ( w << c ) | ( w >> ( 32 - c ) );
+}
+
+static inline uint64_t rotl64( const uint64_t w, const unsigned c )
+{
+ return ( w << c ) | ( w >> ( 64 - c ) );
+}
+
+static inline uint32_t rotr32( const uint32_t w, const unsigned c )
+{
+ return ( w >> c ) | ( w << ( 32 - c ) );
+}
+
+static inline uint64_t rotr64( const uint64_t w, const unsigned c )
+{
+ return ( w >> c ) | ( w << ( 64 - c ) );
+}
+
+/* prevents compiler optimizing out memset() */
+static inline void secure_zero_memory( void *v, size_t n )
+{
+ sodium_memzero(v, n);
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h
new file mode 100644
index 00000000..e44aac66
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h
@@ -0,0 +1,177 @@
+/*
+ BLAKE2 reference source code package - reference C implementations
+
+ Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
+
+ To the extent possible under law, the author(s) have dedicated all copyright
+ and related and neighboring rights to this software to the public domain
+ worldwide. This software is distributed without any warranty.
+
+ You should have received a copy of the CC0 Public Domain Dedication along with
+ this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+*/
+
+#ifndef blake2_H
+#define blake2_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "crypto_generichash_blake2b.h"
+
+#define blake2b_init_param crypto_generichash_blake2b__init_param
+#define blake2b_init crypto_generichash_blake2b__init
+#define blake2b_init_salt_personal crypto_generichash_blake2b__init_salt_personal
+#define blake2b_init_key crypto_generichash_blake2b__init_key
+#define blake2b_init_key_salt_personal crypto_generichash_blake2b__init_key_salt_personal
+#define blake2b_update crypto_generichash_blake2b__update
+#define blake2b_final crypto_generichash_blake2b__final
+#define blake2b crypto_generichash_blake2b__blake2b
+#define blake2b_salt_personal crypto_generichash_blake2b__blake2b_salt_personal
+
+#if defined(_MSC_VER)
+#define ALIGN(x) __declspec(align(x))
+#else
+#define ALIGN(x) __attribute__((aligned(x)))
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+ enum blake2s_constant
+ {
+ BLAKE2S_BLOCKBYTES = 64,
+ BLAKE2S_OUTBYTES = 32,
+ BLAKE2S_KEYBYTES = 32,
+ BLAKE2S_SALTBYTES = 8,
+ BLAKE2S_PERSONALBYTES = 8
+ };
+
+ enum blake2b_constant
+ {
+ BLAKE2B_BLOCKBYTES = 128,
+ BLAKE2B_OUTBYTES = 64,
+ BLAKE2B_KEYBYTES = 64,
+ BLAKE2B_SALTBYTES = 16,
+ BLAKE2B_PERSONALBYTES = 16
+ };
+
+#pragma pack(push, 1)
+ typedef struct blake2s_param_
+ {
+ uint8_t digest_length; // 1
+ uint8_t key_length; // 2
+ uint8_t fanout; // 3
+ uint8_t depth; // 4
+ uint32_t leaf_length; // 8
+ uint8_t node_offset[6];// 14
+ uint8_t node_depth; // 15
+ uint8_t inner_length; // 16
+ // uint8_t reserved[0];
+ uint8_t salt[BLAKE2S_SALTBYTES]; // 24
+ uint8_t personal[BLAKE2S_PERSONALBYTES]; // 32
+ } blake2s_param;
+
+ ALIGN( 64 ) typedef struct blake2s_state_
+ {
+ uint32_t h[8];
+ uint32_t t[2];
+ uint32_t f[2];
+ uint8_t buf[2 * BLAKE2S_BLOCKBYTES];
+ size_t buflen;
+ uint8_t last_node;
+ } blake2s_state ;
+
+ typedef struct blake2b_param_
+ {
+ uint8_t digest_length; // 1
+ uint8_t key_length; // 2
+ uint8_t fanout; // 3
+ uint8_t depth; // 4
+ uint32_t leaf_length; // 8
+ uint64_t node_offset; // 16
+ uint8_t node_depth; // 17
+ uint8_t inner_length; // 18
+ uint8_t reserved[14]; // 32
+ uint8_t salt[BLAKE2B_SALTBYTES]; // 48
+ uint8_t personal[BLAKE2B_PERSONALBYTES]; // 64
+ } blake2b_param;
+
+#ifndef DEFINE_BLAKE2B_STATE
+typedef crypto_generichash_blake2b_state blake2b_state;
+#else
+ ALIGN( 64 ) typedef struct blake2b_state_
+ {
+ uint64_t h[8];
+ uint64_t t[2];
+ uint64_t f[2];
+ uint8_t buf[2 * BLAKE2B_BLOCKBYTES];
+ size_t buflen;
+ uint8_t last_node;
+ } blake2b_state;
+#endif
+
+ typedef struct blake2sp_state_
+ {
+ blake2s_state S[8][1];
+ blake2s_state R[1];
+ uint8_t buf[8 * BLAKE2S_BLOCKBYTES];
+ size_t buflen;
+ } blake2sp_state;
+
+ typedef struct blake2bp_state_
+ {
+ blake2b_state S[4][1];
+ blake2b_state R[1];
+ uint8_t buf[4 * BLAKE2B_BLOCKBYTES];
+ size_t buflen;
+ } blake2bp_state;
+#pragma pack(pop)
+
+ // Streaming API
+ int blake2s_init( blake2s_state *S, const uint8_t outlen );
+ int blake2s_init_key( blake2s_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
+ int blake2s_init_param( blake2s_state *S, const blake2s_param *P );
+ int blake2s_update( blake2s_state *S, const uint8_t *in, uint64_t inlen );
+ int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen );
+
+ int blake2b_init( blake2b_state *S, const uint8_t outlen );
+ int blake2b_init_salt_personal( blake2b_state *S, const uint8_t outlen,
+ const void *personal, const void *salt );
+ int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
+ int blake2b_init_key_salt_personal( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen,
+ const void *salt, const void *personal );
+ int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
+ int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen );
+ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen );
+
+ int blake2sp_init( blake2sp_state *S, const uint8_t outlen );
+ int blake2sp_init_key( blake2sp_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
+ int blake2sp_update( blake2sp_state *S, const uint8_t *in, uint64_t inlen );
+ int blake2sp_final( blake2sp_state *S, uint8_t *out, uint8_t outlen );
+
+ int blake2bp_init( blake2bp_state *S, const uint8_t outlen );
+ int blake2bp_init_key( blake2bp_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
+ int blake2bp_update( blake2bp_state *S, const uint8_t *in, uint64_t inlen );
+ int blake2bp_final( blake2bp_state *S, uint8_t *out, uint8_t outlen );
+
+ // Simple API
+ int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
+ int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
+ int blake2b_salt_personal( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen, const void *salt, const void *personal );
+
+ int blake2sp( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
+ int blake2bp( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
+
+ static inline int blake2( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen )
+ {
+ return blake2b( out, in, key, outlen, inlen, keylen );
+ }
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c
new file mode 100644
index 00000000..2610477d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c
@@ -0,0 +1,465 @@
+/*
+ BLAKE2 reference source code package - reference C implementations
+
+ Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
+
+ To the extent possible under law, the author(s) have dedicated all copyright
+ and related and neighboring rights to this software to the public domain
+ worldwide. This software is distributed without any warranty.
+
+ You should have received a copy of the CC0 Public Domain Dedication along with
+ this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+*/
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "blake2.h"
+#include "blake2-impl.h"
+
+static const uint64_t blake2b_IV[8] =
+{
+ 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL,
+ 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL,
+ 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
+ 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
+};
+
+static const uint8_t blake2b_sigma[12][16] =
+{
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
+ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
+ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
+ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
+ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } ,
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }
+};
+
+
+/* LCOV_EXCL_START */
+static inline int blake2b_set_lastnode( blake2b_state *S )
+{
+ S->f[1] = ~0ULL;
+ return 0;
+}
+/* LCOV_EXCL_STOP */
+#if 0
+static inline int blake2b_clear_lastnode( blake2b_state *S )
+{
+ S->f[1] = 0ULL;
+ return 0;
+}
+#endif
+/* Some helper functions, not necessarily useful */
+static inline int blake2b_set_lastblock( blake2b_state *S )
+{
+ if( S->last_node ) blake2b_set_lastnode( S );
+
+ S->f[0] = ~0ULL;
+ return 0;
+}
+#if 0
+static inline int blake2b_clear_lastblock( blake2b_state *S )
+{
+ if( S->last_node ) blake2b_clear_lastnode( S );
+
+ S->f[0] = 0ULL;
+ return 0;
+}
+#endif
+static inline int blake2b_increment_counter( blake2b_state *S, const uint64_t inc )
+{
+ S->t[0] += inc;
+ S->t[1] += ( S->t[0] < inc );
+ return 0;
+}
+
+
+
+// Parameter-related functions
+#if 0
+static inline int blake2b_param_set_digest_length( blake2b_param *P, const uint8_t digest_length )
+{
+ P->digest_length = digest_length;
+ return 0;
+}
+
+static inline int blake2b_param_set_fanout( blake2b_param *P, const uint8_t fanout )
+{
+ P->fanout = fanout;
+ return 0;
+}
+
+static inline int blake2b_param_set_max_depth( blake2b_param *P, const uint8_t depth )
+{
+ P->depth = depth;
+ return 0;
+}
+
+static inline int blake2b_param_set_leaf_length( blake2b_param *P, const uint32_t leaf_length )
+{
+ store32( &P->leaf_length, leaf_length );
+ return 0;
+}
+
+static inline int blake2b_param_set_node_offset( blake2b_param *P, const uint64_t node_offset )
+{
+ store64( &P->node_offset, node_offset );
+ return 0;
+}
+
+static inline int blake2b_param_set_node_depth( blake2b_param *P, const uint8_t node_depth )
+{
+ P->node_depth = node_depth;
+ return 0;
+}
+
+static inline int blake2b_param_set_inner_length( blake2b_param *P, const uint8_t inner_length )
+{
+ P->inner_length = inner_length;
+ return 0;
+}
+#endif
+static inline int blake2b_param_set_salt( blake2b_param *P, const uint8_t salt[BLAKE2B_SALTBYTES] )
+{
+ memcpy( P->salt, salt, BLAKE2B_SALTBYTES );
+ return 0;
+}
+
+static inline int blake2b_param_set_personal( blake2b_param *P, const uint8_t personal[BLAKE2B_PERSONALBYTES] )
+{
+ memcpy( P->personal, personal, BLAKE2B_PERSONALBYTES );
+ return 0;
+}
+
+static inline int blake2b_init0( blake2b_state *S )
+{
+ int i;
+ memset( S, 0, sizeof( blake2b_state ) );
+
+ for( i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
+
+ return 0;
+}
+
+/* init xors IV with input parameter block */
+int blake2b_init_param( blake2b_state *S, const blake2b_param *P )
+{
+ size_t i;
+ const uint8_t *p;
+
+ blake2b_init0( S );
+ p = ( const uint8_t * )( P );
+
+ /* IV XOR ParamBlock */
+ for( i = 0; i < 8; ++i )
+ S->h[i] ^= load64( p + sizeof( S->h[i] ) * i );
+
+ return 0;
+}
+
+
+
+int blake2b_init( blake2b_state *S, const uint8_t outlen )
+{
+ blake2b_param P[1];
+
+ if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
+
+ P->digest_length = outlen;
+ P->key_length = 0;
+ P->fanout = 1;
+ P->depth = 1;
+ store32( &P->leaf_length, 0 );
+ store64( &P->node_offset, 0 );
+ P->node_depth = 0;
+ P->inner_length = 0;
+ memset( P->reserved, 0, sizeof( P->reserved ) );
+ memset( P->salt, 0, sizeof( P->salt ) );
+ memset( P->personal, 0, sizeof( P->personal ) );
+ return blake2b_init_param( S, P );
+}
+
+int blake2b_init_salt_personal( blake2b_state *S, const uint8_t outlen,
+ const void *salt, const void *personal )
+{
+ blake2b_param P[1];
+
+ if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
+
+ P->digest_length = outlen;
+ P->key_length = 0;
+ P->fanout = 1;
+ P->depth = 1;
+ store32( &P->leaf_length, 0 );
+ store64( &P->node_offset, 0 );
+ P->node_depth = 0;
+ P->inner_length = 0;
+ memset( P->reserved, 0, sizeof( P->reserved ) );
+ if (salt != NULL) {
+ blake2b_param_set_salt( P, (const uint8_t *) salt );
+ } else {
+ memset( P->salt, 0, sizeof( P->salt ) );
+ }
+ if (personal != NULL) {
+ blake2b_param_set_personal( P, (const uint8_t *) personal );
+ } else {
+ memset( P->personal, 0, sizeof( P->personal ) );
+ }
+ return blake2b_init_param( S, P );
+}
+
+int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen )
+{
+ blake2b_param P[1];
+
+ if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
+
+ if ( !key || !keylen || keylen > BLAKE2B_KEYBYTES ) return -1;
+
+ P->digest_length = outlen;
+ P->key_length = keylen;
+ P->fanout = 1;
+ P->depth = 1;
+ store32( &P->leaf_length, 0 );
+ store64( &P->node_offset, 0 );
+ P->node_depth = 0;
+ P->inner_length = 0;
+ memset( P->reserved, 0, sizeof( P->reserved ) );
+ memset( P->salt, 0, sizeof( P->salt ) );
+ memset( P->personal, 0, sizeof( P->personal ) );
+
+ if( blake2b_init_param( S, P ) < 0 ) return -1;
+
+ {
+ uint8_t block[BLAKE2B_BLOCKBYTES];
+ memset( block, 0, BLAKE2B_BLOCKBYTES );
+ memcpy( block, key, keylen );
+ blake2b_update( S, block, BLAKE2B_BLOCKBYTES );
+ secure_zero_memory( block, BLAKE2B_BLOCKBYTES ); /* Burn the key from stack */
+ }
+ return 0;
+}
+
+int blake2b_init_key_salt_personal( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen,
+ const void *salt, const void *personal )
+{
+ blake2b_param P[1];
+
+ if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
+
+ if ( !key || !keylen || keylen > BLAKE2B_KEYBYTES ) return -1;
+
+ P->digest_length = outlen;
+ P->key_length = keylen;
+ P->fanout = 1;
+ P->depth = 1;
+ store32( &P->leaf_length, 0 );
+ store64( &P->node_offset, 0 );
+ P->node_depth = 0;
+ P->inner_length = 0;
+ memset( P->reserved, 0, sizeof( P->reserved ) );
+ if (salt != NULL) {
+ blake2b_param_set_salt( P, (const uint8_t *) salt );
+ } else {
+ memset( P->salt, 0, sizeof( P->salt ) );
+ }
+ if (personal != NULL) {
+ blake2b_param_set_personal( P, (const uint8_t *) personal );
+ } else {
+ memset( P->personal, 0, sizeof( P->personal ) );
+ }
+
+ if( blake2b_init_param( S, P ) < 0 ) return -1;
+
+ {
+ uint8_t block[BLAKE2B_BLOCKBYTES];
+ memset( block, 0, BLAKE2B_BLOCKBYTES );
+ memcpy( block, key, keylen );
+ blake2b_update( S, block, BLAKE2B_BLOCKBYTES );
+ secure_zero_memory( block, BLAKE2B_BLOCKBYTES ); /* Burn the key from stack */
+ }
+ return 0;
+}
+
+static int blake2b_compress( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] )
+{
+ uint64_t m[16];
+ uint64_t v[16];
+ int i;
+
+ for( i = 0; i < 16; ++i )
+ m[i] = load64( block + i * sizeof( m[i] ) );
+
+ for( i = 0; i < 8; ++i )
+ v[i] = S->h[i];
+
+ v[ 8] = blake2b_IV[0];
+ v[ 9] = blake2b_IV[1];
+ v[10] = blake2b_IV[2];
+ v[11] = blake2b_IV[3];
+ v[12] = S->t[0] ^ blake2b_IV[4];
+ v[13] = S->t[1] ^ blake2b_IV[5];
+ v[14] = S->f[0] ^ blake2b_IV[6];
+ v[15] = S->f[1] ^ blake2b_IV[7];
+#define G(r,i,a,b,c,d) \
+ do { \
+ a = a + b + m[blake2b_sigma[r][2*i+0]]; \
+ d = rotr64(d ^ a, 32); \
+ c = c + d; \
+ b = rotr64(b ^ c, 24); \
+ a = a + b + m[blake2b_sigma[r][2*i+1]]; \
+ d = rotr64(d ^ a, 16); \
+ c = c + d; \
+ b = rotr64(b ^ c, 63); \
+ } while(0)
+#define ROUND(r) \
+ do { \
+ G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \
+ G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \
+ G(r,2,v[ 2],v[ 6],v[10],v[14]); \
+ G(r,3,v[ 3],v[ 7],v[11],v[15]); \
+ G(r,4,v[ 0],v[ 5],v[10],v[15]); \
+ G(r,5,v[ 1],v[ 6],v[11],v[12]); \
+ G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \
+ G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \
+ } while(0)
+ ROUND( 0 );
+ ROUND( 1 );
+ ROUND( 2 );
+ ROUND( 3 );
+ ROUND( 4 );
+ ROUND( 5 );
+ ROUND( 6 );
+ ROUND( 7 );
+ ROUND( 8 );
+ ROUND( 9 );
+ ROUND( 10 );
+ ROUND( 11 );
+
+ for( i = 0; i < 8; ++i )
+ S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
+
+#undef G
+#undef ROUND
+ return 0;
+}
+
+/* inlen now in bytes */
+int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen )
+{
+ while( inlen > 0 )
+ {
+ size_t left = S->buflen;
+ size_t fill = 2 * BLAKE2B_BLOCKBYTES - left;
+
+ if( inlen > fill )
+ {
+ memcpy( S->buf + left, in, fill ); // Fill buffer
+ S->buflen += fill;
+ blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
+ blake2b_compress( S, S->buf ); // Compress
+ memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES ); // Shift buffer left
+ S->buflen -= BLAKE2B_BLOCKBYTES;
+ in += fill;
+ inlen -= fill;
+ }
+ else // inlen <= fill
+ {
+ memcpy( S->buf + left, in, inlen );
+ S->buflen += inlen; // Be lazy, do not compress
+ in += inlen;
+ inlen -= inlen;
+ }
+ }
+
+ return 0;
+}
+
+/* Is this correct? */
+int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
+{
+ uint8_t buffer[BLAKE2B_OUTBYTES];
+ int i;
+
+ if( outlen > BLAKE2B_OUTBYTES ) {
+ return -1;
+ }
+ if( S->buflen > BLAKE2B_BLOCKBYTES )
+ {
+ blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
+ blake2b_compress( S, S->buf );
+ S->buflen -= BLAKE2B_BLOCKBYTES;
+ memmove( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
+ }
+
+ blake2b_increment_counter( S, S->buflen );
+ blake2b_set_lastblock( S );
+ memset( S->buf + S->buflen, 0, 2 * BLAKE2B_BLOCKBYTES - S->buflen ); /* Padding */
+ blake2b_compress( S, S->buf );
+
+ for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
+ store64( buffer + sizeof( S->h[i] ) * i, S->h[i] );
+
+ memcpy( out, buffer, outlen );
+ return 0;
+}
+
+/* inlen, at least, should be uint64_t. Others can be size_t. */
+int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen )
+{
+ blake2b_state S[1];
+
+ /* Verify parameters */
+ if ( NULL == in ) return -1;
+
+ if ( NULL == out ) return -1;
+
+ if( NULL == key ) keylen = 0;
+
+ if( keylen > 0 )
+ {
+ if( blake2b_init_key( S, outlen, key, keylen ) < 0 ) return -1;
+ }
+ else
+ {
+ if( blake2b_init( S, outlen ) < 0 ) return -1;
+ }
+
+ blake2b_update( S, ( const uint8_t * )in, inlen );
+ blake2b_final( S, out, outlen );
+ return 0;
+}
+
+int blake2b_salt_personal( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen,
+ const void *salt, const void *personal )
+{
+ blake2b_state S[1];
+
+ /* Verify parameters */
+ if ( NULL == in ) return -1;
+
+ if ( NULL == out ) return -1;
+
+ if( NULL == key ) keylen = 0;
+
+ if( keylen > 0 )
+ {
+ if( blake2b_init_key_salt_personal( S, outlen, key, keylen, salt, personal ) < 0 ) return -1;
+ }
+ else
+ {
+ if( blake2b_init_salt_personal( S, outlen, salt, personal ) < 0 ) return -1;
+ }
+
+ blake2b_update( S, ( const uint8_t * )in, inlen );
+ blake2b_final( S, out, outlen );
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c
new file mode 100644
index 00000000..7253cbf3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c
@@ -0,0 +1,108 @@
+
+#include <assert.h>
+#include <limits.h>
+#include <stdint.h>
+
+#include "api.h"
+#include "blake2.h"
+
+int
+crypto_generichash_blake2b(unsigned char *out, size_t outlen,
+ const unsigned char *in, unsigned long long inlen,
+ const unsigned char *key, size_t keylen)
+{
+ if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
+ keylen > BLAKE2B_KEYBYTES || inlen > UINT64_MAX) {
+ return -1;
+ }
+ assert(outlen <= UINT8_MAX);
+ assert(keylen <= UINT8_MAX);
+
+ return blake2b((uint8_t *) out, in, key,
+ (uint8_t) outlen, (uint64_t) inlen, (uint8_t) keylen);
+}
+
+int
+crypto_generichash_blake2b_salt_personal(unsigned char *out, size_t outlen,
+ const unsigned char *in, unsigned long long inlen,
+ const unsigned char *key, size_t keylen,
+ const unsigned char *salt,
+ const unsigned char *personal)
+{
+ if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
+ keylen > BLAKE2B_KEYBYTES || inlen > UINT64_MAX) {
+ return -1;
+ }
+ assert(outlen <= UINT8_MAX);
+ assert(keylen <= UINT8_MAX);
+
+ return blake2b_salt_personal((uint8_t *) out, in, key,
+ (uint8_t) outlen, (uint64_t) inlen, (uint8_t) keylen,
+ salt, personal);
+}
+
+int
+crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
+ const unsigned char *key,
+ const size_t keylen, const size_t outlen)
+{
+ if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
+ keylen > BLAKE2B_KEYBYTES) {
+ return -1;
+ }
+ assert(outlen <= UINT8_MAX);
+ assert(keylen <= UINT8_MAX);
+ if (key == NULL || keylen <= 0U) {
+ if (blake2b_init(state, (uint8_t) outlen) != 0) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ } else if (blake2b_init_key(state, (uint8_t) outlen, key,
+ (uint8_t) keylen) != 0) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ return 0;
+}
+
+int
+crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state *state,
+ const unsigned char *key,
+ const size_t keylen, const size_t outlen,
+ const unsigned char *salt,
+ const unsigned char *personal)
+{
+ if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
+ keylen > BLAKE2B_KEYBYTES) {
+ return -1;
+ }
+ assert(outlen <= UINT8_MAX);
+ assert(keylen <= UINT8_MAX);
+ if (key == NULL || keylen <= 0U) {
+ if (blake2b_init_salt_personal(state, (uint8_t) outlen,
+ salt, personal) != 0) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ } else if (blake2b_init_key_salt_personal(state,
+ (uint8_t) outlen, key,
+ (uint8_t) keylen,
+ salt, personal) != 0) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ return 0;
+}
+
+int
+crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ return blake2b_update(state, (const uint8_t *) in, (uint64_t) inlen);
+}
+
+int
+crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
+ unsigned char *out,
+ const size_t outlen)
+{
+ assert(outlen <= UINT8_MAX);
+ return blake2b_final(state, (uint8_t *) out, (uint8_t) outlen);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c
new file mode 100644
index 00000000..e7cc0ae6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c
@@ -0,0 +1,78 @@
+
+#include "crypto_generichash.h"
+
+size_t
+crypto_generichash_bytes_min(void)
+{
+ return crypto_generichash_BYTES_MIN;
+}
+
+size_t
+crypto_generichash_bytes_max(void)
+{
+ return crypto_generichash_BYTES_MAX;
+}
+
+size_t
+crypto_generichash_bytes(void)
+{
+ return crypto_generichash_BYTES;
+}
+
+size_t
+crypto_generichash_keybytes_min(void)
+{
+ return crypto_generichash_KEYBYTES_MIN;
+}
+
+size_t
+crypto_generichash_keybytes_max(void)
+{
+ return crypto_generichash_KEYBYTES_MAX;
+}
+
+size_t
+crypto_generichash_keybytes(void)
+{
+ return crypto_generichash_KEYBYTES;
+}
+
+const char *crypto_generichash_primitive(void)
+{
+ return crypto_generichash_PRIMITIVE;
+}
+
+int
+crypto_generichash(unsigned char *out, size_t outlen, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *key,
+ size_t keylen)
+{
+ return crypto_generichash_blake2b(out, outlen, in, inlen, key, keylen);
+}
+
+int
+crypto_generichash_init(crypto_generichash_state *state,
+ const unsigned char *key,
+ const size_t keylen, const size_t outlen)
+{
+ return crypto_generichash_blake2b_init
+ ((crypto_generichash_blake2b_state *) state,
+ key, keylen, outlen);
+}
+
+int
+crypto_generichash_update(crypto_generichash_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ return crypto_generichash_blake2b_update
+ ((crypto_generichash_blake2b_state *) state, in, inlen);
+}
+
+int
+crypto_generichash_final(crypto_generichash_state *state,
+ unsigned char *out, const size_t outlen)
+{
+ return crypto_generichash_blake2b_final
+ ((crypto_generichash_blake2b_state *) state, out, outlen);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/crypto_hash.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/crypto_hash.c
new file mode 100644
index 00000000..855c560b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/crypto_hash.c
@@ -0,0 +1,20 @@
+
+#include "crypto_hash.h"
+
+size_t
+crypto_hash_bytes(void)
+{
+ return crypto_hash_BYTES;
+}
+
+int
+crypto_hash(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen)
+{
+ return crypto_hash_sha512(out, in, inlen);
+}
+
+const char *
+crypto_hash_primitive(void) {
+ return crypto_hash_PRIMITIVE;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/cp/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/cp/api.h
new file mode 100644
index 00000000..b38a563a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/cp/api.h
@@ -0,0 +1,10 @@
+
+#include "crypto_hash_sha256.h"
+
+#define crypto_hash crypto_hash_sha256
+#define crypto_hash_init crypto_hash_sha256_init
+#define crypto_hash_update crypto_hash_sha256_update
+#define crypto_hash_final crypto_hash_sha256_final
+#define crypto_hash_BYTES crypto_hash_sha256_BYTES
+#define crypto_hash_IMPLEMENTATION crypto_hash_sha256_IMPLEMENTATION
+#define crypto_hash_VERSION crypto_hash_sha256_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c
new file mode 100644
index 00000000..738794ac
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c
@@ -0,0 +1,296 @@
+
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "api.h"
+#include "crypto_hash_sha256.h"
+#include "utils.h"
+
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Avoid namespace collisions with BSD <sys/endian.h>. */
+#define be32dec _sha256_be32dec
+#define be32enc _sha256_be32enc
+
+static inline uint32_t
+be32dec(const void *pp)
+{
+ const uint8_t *p = (uint8_t const *)pp;
+
+ return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
+ ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
+}
+
+static inline void
+be32enc(void *pp, uint32_t x)
+{
+ uint8_t * p = (uint8_t *)pp;
+
+ p[3] = x & 0xff;
+ p[2] = (x >> 8) & 0xff;
+ p[1] = (x >> 16) & 0xff;
+ p[0] = (x >> 24) & 0xff;
+}
+
+static void
+be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len)
+{
+ size_t i;
+
+ for (i = 0; i < len / 4; i++) {
+ be32enc(dst + i * 4, src[i]);
+ }
+}
+
+static void
+be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len)
+{
+ size_t i;
+
+ for (i = 0; i < len / 4; i++) {
+ dst[i] = be32dec(src + i * 4);
+ }
+}
+
+#define Ch(x, y, z) ((x & (y ^ z)) ^ z)
+#define Maj(x, y, z) ((x & (y | z)) | (y & z))
+#define SHR(x, n) (x >> n)
+#define ROTR(x, n) ((x >> n) | (x << (32 - n)))
+#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
+#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
+#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
+#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
+
+#define RND(a, b, c, d, e, f, g, h, k) \
+ t0 = h + S1(e) + Ch(e, f, g) + k; \
+ t1 = S0(a) + Maj(a, b, c); \
+ d += t0; \
+ h = t0 + t1;
+
+#define RNDr(S, W, i, k) \
+ RND(S[(64 - i) % 8], S[(65 - i) % 8], \
+ S[(66 - i) % 8], S[(67 - i) % 8], \
+ S[(68 - i) % 8], S[(69 - i) % 8], \
+ S[(70 - i) % 8], S[(71 - i) % 8], \
+ W[i] + k)
+
+static void
+SHA256_Transform(uint32_t *state, const unsigned char block[64])
+{
+ uint32_t W[64];
+ uint32_t S[8];
+ uint32_t t0, t1;
+ int i;
+
+ be32dec_vect(W, block, 64);
+ for (i = 16; i < 64; i++) {
+ W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16];
+ }
+
+ memcpy(S, state, 32);
+
+ RNDr(S, W, 0, 0x428a2f98);
+ RNDr(S, W, 1, 0x71374491);
+ RNDr(S, W, 2, 0xb5c0fbcf);
+ RNDr(S, W, 3, 0xe9b5dba5);
+ RNDr(S, W, 4, 0x3956c25b);
+ RNDr(S, W, 5, 0x59f111f1);
+ RNDr(S, W, 6, 0x923f82a4);
+ RNDr(S, W, 7, 0xab1c5ed5);
+ RNDr(S, W, 8, 0xd807aa98);
+ RNDr(S, W, 9, 0x12835b01);
+ RNDr(S, W, 10, 0x243185be);
+ RNDr(S, W, 11, 0x550c7dc3);
+ RNDr(S, W, 12, 0x72be5d74);
+ RNDr(S, W, 13, 0x80deb1fe);
+ RNDr(S, W, 14, 0x9bdc06a7);
+ RNDr(S, W, 15, 0xc19bf174);
+ RNDr(S, W, 16, 0xe49b69c1);
+ RNDr(S, W, 17, 0xefbe4786);
+ RNDr(S, W, 18, 0x0fc19dc6);
+ RNDr(S, W, 19, 0x240ca1cc);
+ RNDr(S, W, 20, 0x2de92c6f);
+ RNDr(S, W, 21, 0x4a7484aa);
+ RNDr(S, W, 22, 0x5cb0a9dc);
+ RNDr(S, W, 23, 0x76f988da);
+ RNDr(S, W, 24, 0x983e5152);
+ RNDr(S, W, 25, 0xa831c66d);
+ RNDr(S, W, 26, 0xb00327c8);
+ RNDr(S, W, 27, 0xbf597fc7);
+ RNDr(S, W, 28, 0xc6e00bf3);
+ RNDr(S, W, 29, 0xd5a79147);
+ RNDr(S, W, 30, 0x06ca6351);
+ RNDr(S, W, 31, 0x14292967);
+ RNDr(S, W, 32, 0x27b70a85);
+ RNDr(S, W, 33, 0x2e1b2138);
+ RNDr(S, W, 34, 0x4d2c6dfc);
+ RNDr(S, W, 35, 0x53380d13);
+ RNDr(S, W, 36, 0x650a7354);
+ RNDr(S, W, 37, 0x766a0abb);
+ RNDr(S, W, 38, 0x81c2c92e);
+ RNDr(S, W, 39, 0x92722c85);
+ RNDr(S, W, 40, 0xa2bfe8a1);
+ RNDr(S, W, 41, 0xa81a664b);
+ RNDr(S, W, 42, 0xc24b8b70);
+ RNDr(S, W, 43, 0xc76c51a3);
+ RNDr(S, W, 44, 0xd192e819);
+ RNDr(S, W, 45, 0xd6990624);
+ RNDr(S, W, 46, 0xf40e3585);
+ RNDr(S, W, 47, 0x106aa070);
+ RNDr(S, W, 48, 0x19a4c116);
+ RNDr(S, W, 49, 0x1e376c08);
+ RNDr(S, W, 50, 0x2748774c);
+ RNDr(S, W, 51, 0x34b0bcb5);
+ RNDr(S, W, 52, 0x391c0cb3);
+ RNDr(S, W, 53, 0x4ed8aa4a);
+ RNDr(S, W, 54, 0x5b9cca4f);
+ RNDr(S, W, 55, 0x682e6ff3);
+ RNDr(S, W, 56, 0x748f82ee);
+ RNDr(S, W, 57, 0x78a5636f);
+ RNDr(S, W, 58, 0x84c87814);
+ RNDr(S, W, 59, 0x8cc70208);
+ RNDr(S, W, 60, 0x90befffa);
+ RNDr(S, W, 61, 0xa4506ceb);
+ RNDr(S, W, 62, 0xbef9a3f7);
+ RNDr(S, W, 63, 0xc67178f2);
+
+ for (i = 0; i < 8; i++) {
+ state[i] += S[i];
+ }
+
+ sodium_memzero((void *) W, sizeof W);
+ sodium_memzero((void *) S, sizeof S);
+ sodium_memzero((void *) &t0, sizeof t0);
+ sodium_memzero((void *) &t1, sizeof t1);
+}
+
+static unsigned char PAD[64] = {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static void
+SHA256_Pad(crypto_hash_sha256_state *state)
+{
+ unsigned char len[8];
+ uint32_t r, plen;
+
+ be32enc_vect(len, state->count, 8);
+
+ r = (state->count[1] >> 3) & 0x3f;
+ plen = (r < 56) ? (56 - r) : (120 - r);
+ crypto_hash_sha256_update(state, PAD, (unsigned long long) plen);
+
+ crypto_hash_sha256_update(state, len, 8);
+}
+
+int
+crypto_hash_sha256_init(crypto_hash_sha256_state *state)
+{
+ state->count[0] = state->count[1] = 0;
+
+ state->state[0] = 0x6A09E667;
+ state->state[1] = 0xBB67AE85;
+ state->state[2] = 0x3C6EF372;
+ state->state[3] = 0xA54FF53A;
+ state->state[4] = 0x510E527F;
+ state->state[5] = 0x9B05688C;
+ state->state[6] = 0x1F83D9AB;
+ state->state[7] = 0x5BE0CD19;
+
+ return 0;
+}
+
+int
+crypto_hash_sha256_update(crypto_hash_sha256_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ uint32_t bitlen[2];
+ uint32_t r;
+
+ r = (state->count[1] >> 3) & 0x3f;
+
+ bitlen[1] = ((uint32_t)inlen) << 3;
+ bitlen[0] = (uint32_t)(inlen >> 29);
+
+ /* LCOV_EXCL_START */
+ if ((state->count[1] += bitlen[1]) < bitlen[1]) {
+ state->count[0]++;
+ }
+ /* LCOV_EXCL_STOP */
+ state->count[0] += bitlen[0];
+
+ if (inlen < 64 - r) {
+ memcpy(&state->buf[r], in, inlen);
+ return 0;
+ }
+ memcpy(&state->buf[r], in, 64 - r);
+ SHA256_Transform(state->state, state->buf);
+ in += 64 - r;
+ inlen -= 64 - r;
+
+ while (inlen >= 64) {
+ SHA256_Transform(state->state, in);
+ in += 64;
+ inlen -= 64;
+ }
+ memcpy(state->buf, in, inlen);
+
+ return 0;
+}
+
+int
+crypto_hash_sha256_final(crypto_hash_sha256_state *state,
+ unsigned char *out)
+{
+ SHA256_Pad(state);
+ be32enc_vect(out, state->state, 32);
+ sodium_memzero((void *) state, sizeof *state);
+
+ return 0;
+}
+
+int
+crypto_hash(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen)
+{
+ crypto_hash_sha256_state state;
+
+ crypto_hash_sha256_init(&state);
+ crypto_hash_sha256_update(&state, in, inlen);
+ crypto_hash_sha256_final(&state, out);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c
new file mode 100644
index 00000000..5d2f4783
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c
@@ -0,0 +1,6 @@
+#include "crypto_hash_sha256.h"
+
+size_t
+crypto_hash_sha256_bytes(void) {
+ return crypto_hash_sha256_BYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/cp/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/cp/api.h
new file mode 100644
index 00000000..c3a31883
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/cp/api.h
@@ -0,0 +1,10 @@
+
+#include "crypto_hash_sha512.h"
+
+#define crypto_hash crypto_hash_sha512
+#define crypto_hash_init crypto_hash_sha512_init
+#define crypto_hash_update crypto_hash_sha512_update
+#define crypto_hash_final crypto_hash_sha512_final
+#define crypto_hash_BYTES crypto_hash_sha512_BYTES
+#define crypto_hash_IMPLEMENTATION crypto_hash_sha512_IMPLEMENTATION
+#define crypto_hash_VERSION crypto_hash_sha512_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c
new file mode 100644
index 00000000..e85be74b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c
@@ -0,0 +1,323 @@
+
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "api.h"
+#include "crypto_hash_sha512.h"
+#include "utils.h"
+
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Avoid namespace collisions with BSD <sys/endian.h>. */
+#define be64dec _sha512_be64dec
+#define be64enc _sha512_be64enc
+
+static inline uint64_t
+be64dec(const void *pp)
+{
+ const uint8_t *p = (uint8_t const *)pp;
+
+ return ((uint64_t)(p[7]) + ((uint64_t)(p[6]) << 8) +
+ ((uint64_t)(p[5]) << 16) + ((uint64_t)(p[4]) << 24) +
+ ((uint64_t)(p[3]) << 32) + ((uint64_t)(p[2]) << 40) +
+ ((uint64_t)(p[1]) << 48) + ((uint64_t)(p[0]) << 56));
+}
+
+static inline void
+be64enc(void *pp, uint64_t x)
+{
+ uint8_t *p = (uint8_t *)pp;
+
+ p[7] = x & 0xff;
+ p[6] = (x >> 8) & 0xff;
+ p[5] = (x >> 16) & 0xff;
+ p[4] = (x >> 24) & 0xff;
+ p[3] = (x >> 32) & 0xff;
+ p[2] = (x >> 40) & 0xff;
+ p[1] = (x >> 48) & 0xff;
+ p[0] = (x >> 56) & 0xff;
+}
+
+static void
+be64enc_vect(unsigned char *dst, const uint64_t *src, size_t len)
+{
+ size_t i;
+
+ for (i = 0; i < len / 8; i++) {
+ be64enc(dst + i * 8, src[i]);
+ }
+}
+
+static void
+be64dec_vect(uint64_t *dst, const unsigned char *src, size_t len)
+{
+ size_t i;
+
+ for (i = 0; i < len / 8; i++) {
+ dst[i] = be64dec(src + i * 8);
+ }
+}
+
+#define Ch(x, y, z) ((x & (y ^ z)) ^ z)
+#define Maj(x, y, z) ((x & (y | z)) | (y & z))
+#define SHR(x, n) (x >> n)
+#define ROTR(x, n) ((x >> n) | (x << (64 - n)))
+#define S0(x) (ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39))
+#define S1(x) (ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41))
+#define s0(x) (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7))
+#define s1(x) (ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6))
+
+#define RND(a, b, c, d, e, f, g, h, k) \
+ t0 = h + S1(e) + Ch(e, f, g) + k; \
+ t1 = S0(a) + Maj(a, b, c); \
+ d += t0; \
+ h = t0 + t1;
+
+#define RNDr(S, W, i, k) \
+ RND(S[(80 - i) % 8], S[(81 - i) % 8], \
+ S[(82 - i) % 8], S[(83 - i) % 8], \
+ S[(84 - i) % 8], S[(85 - i) % 8], \
+ S[(86 - i) % 8], S[(87 - i) % 8], \
+ W[i] + k)
+
+static void
+SHA512_Transform(uint64_t *state, const unsigned char block[128])
+{
+ uint64_t W[80];
+ uint64_t S[8];
+ uint64_t t0, t1;
+ int i;
+
+ be64dec_vect(W, block, 128);
+ for (i = 16; i < 80; i++) {
+ W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16];
+ }
+
+ memcpy(S, state, 64);
+
+ RNDr(S, W, 0, 0x428a2f98d728ae22ULL);
+ RNDr(S, W, 1, 0x7137449123ef65cdULL);
+ RNDr(S, W, 2, 0xb5c0fbcfec4d3b2fULL);
+ RNDr(S, W, 3, 0xe9b5dba58189dbbcULL);
+ RNDr(S, W, 4, 0x3956c25bf348b538ULL);
+ RNDr(S, W, 5, 0x59f111f1b605d019ULL);
+ RNDr(S, W, 6, 0x923f82a4af194f9bULL);
+ RNDr(S, W, 7, 0xab1c5ed5da6d8118ULL);
+ RNDr(S, W, 8, 0xd807aa98a3030242ULL);
+ RNDr(S, W, 9, 0x12835b0145706fbeULL);
+ RNDr(S, W, 10, 0x243185be4ee4b28cULL);
+ RNDr(S, W, 11, 0x550c7dc3d5ffb4e2ULL);
+ RNDr(S, W, 12, 0x72be5d74f27b896fULL);
+ RNDr(S, W, 13, 0x80deb1fe3b1696b1ULL);
+ RNDr(S, W, 14, 0x9bdc06a725c71235ULL);
+ RNDr(S, W, 15, 0xc19bf174cf692694ULL);
+ RNDr(S, W, 16, 0xe49b69c19ef14ad2ULL);
+ RNDr(S, W, 17, 0xefbe4786384f25e3ULL);
+ RNDr(S, W, 18, 0x0fc19dc68b8cd5b5ULL);
+ RNDr(S, W, 19, 0x240ca1cc77ac9c65ULL);
+ RNDr(S, W, 20, 0x2de92c6f592b0275ULL);
+ RNDr(S, W, 21, 0x4a7484aa6ea6e483ULL);
+ RNDr(S, W, 22, 0x5cb0a9dcbd41fbd4ULL);
+ RNDr(S, W, 23, 0x76f988da831153b5ULL);
+ RNDr(S, W, 24, 0x983e5152ee66dfabULL);
+ RNDr(S, W, 25, 0xa831c66d2db43210ULL);
+ RNDr(S, W, 26, 0xb00327c898fb213fULL);
+ RNDr(S, W, 27, 0xbf597fc7beef0ee4ULL);
+ RNDr(S, W, 28, 0xc6e00bf33da88fc2ULL);
+ RNDr(S, W, 29, 0xd5a79147930aa725ULL);
+ RNDr(S, W, 30, 0x06ca6351e003826fULL);
+ RNDr(S, W, 31, 0x142929670a0e6e70ULL);
+ RNDr(S, W, 32, 0x27b70a8546d22ffcULL);
+ RNDr(S, W, 33, 0x2e1b21385c26c926ULL);
+ RNDr(S, W, 34, 0x4d2c6dfc5ac42aedULL);
+ RNDr(S, W, 35, 0x53380d139d95b3dfULL);
+ RNDr(S, W, 36, 0x650a73548baf63deULL);
+ RNDr(S, W, 37, 0x766a0abb3c77b2a8ULL);
+ RNDr(S, W, 38, 0x81c2c92e47edaee6ULL);
+ RNDr(S, W, 39, 0x92722c851482353bULL);
+ RNDr(S, W, 40, 0xa2bfe8a14cf10364ULL);
+ RNDr(S, W, 41, 0xa81a664bbc423001ULL);
+ RNDr(S, W, 42, 0xc24b8b70d0f89791ULL);
+ RNDr(S, W, 43, 0xc76c51a30654be30ULL);
+ RNDr(S, W, 44, 0xd192e819d6ef5218ULL);
+ RNDr(S, W, 45, 0xd69906245565a910ULL);
+ RNDr(S, W, 46, 0xf40e35855771202aULL);
+ RNDr(S, W, 47, 0x106aa07032bbd1b8ULL);
+ RNDr(S, W, 48, 0x19a4c116b8d2d0c8ULL);
+ RNDr(S, W, 49, 0x1e376c085141ab53ULL);
+ RNDr(S, W, 50, 0x2748774cdf8eeb99ULL);
+ RNDr(S, W, 51, 0x34b0bcb5e19b48a8ULL);
+ RNDr(S, W, 52, 0x391c0cb3c5c95a63ULL);
+ RNDr(S, W, 53, 0x4ed8aa4ae3418acbULL);
+ RNDr(S, W, 54, 0x5b9cca4f7763e373ULL);
+ RNDr(S, W, 55, 0x682e6ff3d6b2b8a3ULL);
+ RNDr(S, W, 56, 0x748f82ee5defb2fcULL);
+ RNDr(S, W, 57, 0x78a5636f43172f60ULL);
+ RNDr(S, W, 58, 0x84c87814a1f0ab72ULL);
+ RNDr(S, W, 59, 0x8cc702081a6439ecULL);
+ RNDr(S, W, 60, 0x90befffa23631e28ULL);
+ RNDr(S, W, 61, 0xa4506cebde82bde9ULL);
+ RNDr(S, W, 62, 0xbef9a3f7b2c67915ULL);
+ RNDr(S, W, 63, 0xc67178f2e372532bULL);
+ RNDr(S, W, 64, 0xca273eceea26619cULL);
+ RNDr(S, W, 65, 0xd186b8c721c0c207ULL);
+ RNDr(S, W, 66, 0xeada7dd6cde0eb1eULL);
+ RNDr(S, W, 67, 0xf57d4f7fee6ed178ULL);
+ RNDr(S, W, 68, 0x06f067aa72176fbaULL);
+ RNDr(S, W, 69, 0x0a637dc5a2c898a6ULL);
+ RNDr(S, W, 70, 0x113f9804bef90daeULL);
+ RNDr(S, W, 71, 0x1b710b35131c471bULL);
+ RNDr(S, W, 72, 0x28db77f523047d84ULL);
+ RNDr(S, W, 73, 0x32caab7b40c72493ULL);
+ RNDr(S, W, 74, 0x3c9ebe0a15c9bebcULL);
+ RNDr(S, W, 75, 0x431d67c49c100d4cULL);
+ RNDr(S, W, 76, 0x4cc5d4becb3e42b6ULL);
+ RNDr(S, W, 77, 0x597f299cfc657e2aULL);
+ RNDr(S, W, 78, 0x5fcb6fab3ad6faecULL);
+ RNDr(S, W, 79, 0x6c44198c4a475817ULL);
+
+ for (i = 0; i < 8; i++) {
+ state[i] += S[i];
+ }
+
+ sodium_memzero((void *) W, sizeof W);
+ sodium_memzero((void *) S, sizeof S);
+ sodium_memzero((void *) &t0, sizeof t0);
+ sodium_memzero((void *) &t1, sizeof t1);
+}
+
+static unsigned char PAD[128] = {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static void
+SHA512_Pad(crypto_hash_sha512_state *state)
+{
+ unsigned char len[16];
+ uint64_t r, plen;
+
+ be64enc_vect(len, state->count, 16);
+
+ r = (state->count[1] >> 3) & 0x7f;
+ plen = (r < 112) ? (112 - r) : (240 - r);
+ crypto_hash_sha512_update(state, PAD, (unsigned long long) plen);
+
+ crypto_hash_sha512_update(state, len, 16);
+}
+
+int
+crypto_hash_sha512_init(crypto_hash_sha512_state *state)
+{
+ state->count[0] = state->count[1] = 0;
+
+ state->state[0] = 0x6a09e667f3bcc908ULL;
+ state->state[1] = 0xbb67ae8584caa73bULL;
+ state->state[2] = 0x3c6ef372fe94f82bULL;
+ state->state[3] = 0xa54ff53a5f1d36f1ULL;
+ state->state[4] = 0x510e527fade682d1ULL;
+ state->state[5] = 0x9b05688c2b3e6c1fULL;
+ state->state[6] = 0x1f83d9abfb41bd6bULL;
+ state->state[7] = 0x5be0cd19137e2179ULL;
+
+ return 0;
+}
+
+int
+crypto_hash_sha512_update(crypto_hash_sha512_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ uint64_t bitlen[2];
+ uint64_t r;
+ const unsigned char *src = in;
+
+ r = (state->count[1] >> 3) & 0x7f;
+
+ bitlen[1] = ((uint64_t)inlen) << 3;
+ bitlen[0] = ((uint64_t)inlen) >> 61;
+
+ /* LCOV_EXCL_START */
+ if ((state->count[1] += bitlen[1]) < bitlen[1]) {
+ state->count[0]++;
+ }
+ /* LCOV_EXCL_STOP */
+ state->count[0] += bitlen[0];
+
+ if (inlen < 128 - r) {
+ memcpy(&state->buf[r], src, inlen);
+ return 0;
+ }
+ memcpy(&state->buf[r], src, 128 - r);
+ SHA512_Transform(state->state, state->buf);
+ src += 128 - r;
+ inlen -= 128 - r;
+
+ while (inlen >= 128) {
+ SHA512_Transform(state->state, src);
+ src += 128;
+ inlen -= 128;
+ }
+ memcpy(state->buf, src, inlen);
+
+ return 0;
+}
+
+int
+crypto_hash_sha512_final(crypto_hash_sha512_state *state,
+ unsigned char *out)
+{
+ SHA512_Pad(state);
+ be64enc_vect(out, state->state, 64);
+ sodium_memzero((void *) state, sizeof *state);
+
+ return 0;
+}
+
+int
+crypto_hash(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen)
+{
+ crypto_hash_sha512_state state;
+
+ crypto_hash_sha512_init(&state);
+ crypto_hash_sha512_update(&state, in, inlen);
+ crypto_hash_sha512_final(&state, out);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c
new file mode 100644
index 00000000..75971bc2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c
@@ -0,0 +1,6 @@
+#include "crypto_hash_sha512.h"
+
+size_t
+crypto_hash_sha512_bytes(void) {
+ return crypto_hash_sha512_BYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c
new file mode 100644
index 00000000..2af0fdac
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c
@@ -0,0 +1,59 @@
+
+#include "crypto_onetimeauth.h"
+
+size_t
+crypto_onetimeauth_bytes(void)
+{
+ return crypto_onetimeauth_BYTES;
+}
+
+size_t
+crypto_onetimeauth_keybytes(void)
+{
+ return crypto_onetimeauth_KEYBYTES;
+}
+
+const char *
+crypto_onetimeauth_primitive(void)
+{
+ return crypto_onetimeauth_PRIMITIVE;
+}
+
+int
+crypto_onetimeauth(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ return crypto_onetimeauth_poly1305(out, in, inlen, k);
+}
+
+int
+crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ return crypto_onetimeauth_poly1305_verify(h, in, inlen, k);
+}
+
+int
+crypto_onetimeauth_init(crypto_onetimeauth_state *state,
+ const unsigned char *key)
+{
+ return crypto_onetimeauth_poly1305_init
+ ((crypto_onetimeauth_poly1305_state *) state, key);
+}
+
+int
+crypto_onetimeauth_update(crypto_onetimeauth_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ return crypto_onetimeauth_poly1305_update
+ ((crypto_onetimeauth_poly1305_state *) state, in, inlen);
+}
+
+int
+crypto_onetimeauth_final(crypto_onetimeauth_state *state,
+ unsigned char *out)
+{
+ return crypto_onetimeauth_poly1305_final
+ ((crypto_onetimeauth_poly1305_state *) state, out);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c
new file mode 100644
index 00000000..42e21e33
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c
@@ -0,0 +1,105 @@
+
+#include "utils.h"
+#include "poly1305_donna.h"
+#ifdef HAVE_TI_MODE
+# include "poly1305_donna64.h"
+#else
+# include "poly1305_donna32.h"
+#endif
+
+static void
+poly1305_update(poly1305_context *ctx, const unsigned char *m,
+ unsigned long long bytes) {
+ poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx;
+ unsigned long long i;
+
+ /* handle leftover */
+ if (st->leftover) {
+ unsigned long long want = (poly1305_block_size - st->leftover);
+ if (want > bytes)
+ want = bytes;
+ for (i = 0; i < want; i++)
+ st->buffer[st->leftover + i] = m[i];
+ bytes -= want;
+ m += want;
+ st->leftover += want;
+ if (st->leftover < poly1305_block_size)
+ return;
+ poly1305_blocks(st, st->buffer, poly1305_block_size);
+ st->leftover = 0;
+ }
+
+ /* process full blocks */
+ if (bytes >= poly1305_block_size) {
+ unsigned long long want = (bytes & ~(poly1305_block_size - 1));
+ poly1305_blocks(st, m, want);
+ m += want;
+ bytes -= want;
+ }
+
+ /* store leftover */
+ if (bytes) {
+ for (i = 0; i < bytes; i++)
+ st->buffer[st->leftover + i] = m[i];
+ st->leftover += bytes;
+ }
+}
+
+int
+crypto_onetimeauth_poly1305_donna(unsigned char *out, const unsigned char *m,
+ unsigned long long inlen,
+ const unsigned char *key)
+{
+ poly1305_context ctx;
+ poly1305_init(&ctx, key);
+ poly1305_update(&ctx, m, inlen);
+ poly1305_finish(&ctx, out);
+
+ return 0;
+}
+
+int
+crypto_onetimeauth_poly1305_donna_init(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *key)
+{
+ poly1305_init((poly1305_context *) state, key);
+
+ return 0;
+}
+
+int
+crypto_onetimeauth_poly1305_donna_update(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ poly1305_update((poly1305_context *) state, in, inlen);
+
+ return 0;
+}
+
+int
+crypto_onetimeauth_poly1305_donna_final(crypto_onetimeauth_poly1305_state *state,
+ unsigned char *out)
+{
+ poly1305_finish((poly1305_context *) state, out);
+
+ return 0;
+}
+
+/* LCOV_EXCL_START */
+const char *
+crypto_onetimeauth_poly1305_donna_implementation_name(void)
+{
+ return POLY1305_IMPLEMENTATION_NAME;
+}
+/* LCOV_EXCL_STOP */
+
+struct crypto_onetimeauth_poly1305_implementation
+crypto_onetimeauth_poly1305_donna_implementation = {
+ SODIUM_C99(.implementation_name =) crypto_onetimeauth_poly1305_donna_implementation_name,
+ SODIUM_C99(.onetimeauth =) crypto_onetimeauth_poly1305_donna,
+ SODIUM_C99(.onetimeauth_verify =) crypto_onetimeauth_poly1305_donna_verify,
+ SODIUM_C99(.onetimeauth_init =) crypto_onetimeauth_poly1305_donna_init,
+ SODIUM_C99(.onetimeauth_update =) crypto_onetimeauth_poly1305_donna_update,
+ SODIUM_C99(.onetimeauth_final =) crypto_onetimeauth_poly1305_donna_final
+};
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h
new file mode 100644
index 00000000..3c58158e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h
@@ -0,0 +1,35 @@
+#ifndef poly1305_donna_H
+#define poly1305_donna_H
+
+#include <stddef.h>
+
+#include "crypto_onetimeauth_poly1305.h"
+
+typedef crypto_onetimeauth_poly1305_state poly1305_context;
+
+extern struct crypto_onetimeauth_poly1305_implementation
+ crypto_onetimeauth_poly1305_donna_implementation;
+
+const char *crypto_onetimeauth_poly1305_donna_implementation_name(void);
+
+int crypto_onetimeauth_poly1305_donna(unsigned char *out,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+int crypto_onetimeauth_poly1305_donna_verify(const unsigned char *h,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+int crypto_onetimeauth_poly1305_donna_init(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *key);
+
+int crypto_onetimeauth_poly1305_donna_update(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+int crypto_onetimeauth_poly1305_donna_final(crypto_onetimeauth_poly1305_state *state,
+ unsigned char *out);
+
+#endif /* __POLY1305_DONNA_H__ */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h
new file mode 100644
index 00000000..a4696632
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h
@@ -0,0 +1,208 @@
+/*
+ poly1305 implementation using 32 bit * 32 bit = 64 bit multiplication and 64 bit addition
+*/
+
+#define POLY1305_IMPLEMENTATION_NAME "donna32"
+
+#if defined(_MSC_VER)
+# define POLY1305_NOINLINE __declspec(noinline)
+#elif defined(__GNUC__)
+# define POLY1305_NOINLINE __attribute__((noinline))
+#else
+# define POLY1305_NOINLINE
+#endif
+
+#define poly1305_block_size 16
+
+/* 17 + sizeof(unsigned long long) + 14*sizeof(unsigned long) */
+typedef struct poly1305_state_internal_t {
+ unsigned long r[5];
+ unsigned long h[5];
+ unsigned long pad[4];
+ unsigned long long leftover;
+ unsigned char buffer[poly1305_block_size];
+ unsigned char final;
+} poly1305_state_internal_t;
+
+/* interpret four 8 bit unsigned integers as a 32 bit unsigned integer in little endian */
+static unsigned long
+U8TO32(const unsigned char *p) {
+ return
+ (((unsigned long)(p[0] & 0xff) ) |
+ ((unsigned long)(p[1] & 0xff) << 8) |
+ ((unsigned long)(p[2] & 0xff) << 16) |
+ ((unsigned long)(p[3] & 0xff) << 24));
+}
+
+/* store a 32 bit unsigned integer as four 8 bit unsigned integers in little endian */
+static void
+U32TO8(unsigned char *p, unsigned long v) {
+ p[0] = (v ) & 0xff;
+ p[1] = (v >> 8) & 0xff;
+ p[2] = (v >> 16) & 0xff;
+ p[3] = (v >> 24) & 0xff;
+}
+
+static void
+poly1305_init(poly1305_context *ctx, const unsigned char key[32]) {
+ poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx;
+
+ /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */
+ st->r[0] = (U8TO32(&key[ 0]) ) & 0x3ffffff;
+ st->r[1] = (U8TO32(&key[ 3]) >> 2) & 0x3ffff03;
+ st->r[2] = (U8TO32(&key[ 6]) >> 4) & 0x3ffc0ff;
+ st->r[3] = (U8TO32(&key[ 9]) >> 6) & 0x3f03fff;
+ st->r[4] = (U8TO32(&key[12]) >> 8) & 0x00fffff;
+
+ /* h = 0 */
+ st->h[0] = 0;
+ st->h[1] = 0;
+ st->h[2] = 0;
+ st->h[3] = 0;
+ st->h[4] = 0;
+
+ /* save pad for later */
+ st->pad[0] = U8TO32(&key[16]);
+ st->pad[1] = U8TO32(&key[20]);
+ st->pad[2] = U8TO32(&key[24]);
+ st->pad[3] = U8TO32(&key[28]);
+
+ st->leftover = 0;
+ st->final = 0;
+}
+
+static void
+poly1305_blocks(poly1305_state_internal_t *st, const unsigned char *m, unsigned long long bytes) {
+ const unsigned long hibit = (st->final) ? 0 : (1 << 24); /* 1 << 128 */
+ unsigned long r0,r1,r2,r3,r4;
+ unsigned long s1,s2,s3,s4;
+ unsigned long h0,h1,h2,h3,h4;
+ unsigned long long d0,d1,d2,d3,d4;
+ unsigned long c;
+
+ r0 = st->r[0];
+ r1 = st->r[1];
+ r2 = st->r[2];
+ r3 = st->r[3];
+ r4 = st->r[4];
+
+ s1 = r1 * 5;
+ s2 = r2 * 5;
+ s3 = r3 * 5;
+ s4 = r4 * 5;
+
+ h0 = st->h[0];
+ h1 = st->h[1];
+ h2 = st->h[2];
+ h3 = st->h[3];
+ h4 = st->h[4];
+
+ while (bytes >= poly1305_block_size) {
+ /* h += m[i] */
+ h0 += (U8TO32(m+ 0) ) & 0x3ffffff;
+ h1 += (U8TO32(m+ 3) >> 2) & 0x3ffffff;
+ h2 += (U8TO32(m+ 6) >> 4) & 0x3ffffff;
+ h3 += (U8TO32(m+ 9) >> 6) & 0x3ffffff;
+ h4 += (U8TO32(m+12) >> 8) | hibit;
+
+ /* h *= r */
+ d0 = ((unsigned long long)h0 * r0) + ((unsigned long long)h1 * s4) + ((unsigned long long)h2 * s3) + ((unsigned long long)h3 * s2) + ((unsigned long long)h4 * s1);
+ d1 = ((unsigned long long)h0 * r1) + ((unsigned long long)h1 * r0) + ((unsigned long long)h2 * s4) + ((unsigned long long)h3 * s3) + ((unsigned long long)h4 * s2);
+ d2 = ((unsigned long long)h0 * r2) + ((unsigned long long)h1 * r1) + ((unsigned long long)h2 * r0) + ((unsigned long long)h3 * s4) + ((unsigned long long)h4 * s3);
+ d3 = ((unsigned long long)h0 * r3) + ((unsigned long long)h1 * r2) + ((unsigned long long)h2 * r1) + ((unsigned long long)h3 * r0) + ((unsigned long long)h4 * s4);
+ d4 = ((unsigned long long)h0 * r4) + ((unsigned long long)h1 * r3) + ((unsigned long long)h2 * r2) + ((unsigned long long)h3 * r1) + ((unsigned long long)h4 * r0);
+
+ /* (partial) h %= p */
+ c = (unsigned long)(d0 >> 26); h0 = (unsigned long)d0 & 0x3ffffff;
+ d1 += c; c = (unsigned long)(d1 >> 26); h1 = (unsigned long)d1 & 0x3ffffff;
+ d2 += c; c = (unsigned long)(d2 >> 26); h2 = (unsigned long)d2 & 0x3ffffff;
+ d3 += c; c = (unsigned long)(d3 >> 26); h3 = (unsigned long)d3 & 0x3ffffff;
+ d4 += c; c = (unsigned long)(d4 >> 26); h4 = (unsigned long)d4 & 0x3ffffff;
+ h0 += c * 5; c = (h0 >> 26); h0 = h0 & 0x3ffffff;
+ h1 += c;
+
+ m += poly1305_block_size;
+ bytes -= poly1305_block_size;
+ }
+
+ st->h[0] = h0;
+ st->h[1] = h1;
+ st->h[2] = h2;
+ st->h[3] = h3;
+ st->h[4] = h4;
+}
+
+static POLY1305_NOINLINE void
+poly1305_finish(poly1305_context *ctx, unsigned char mac[16]) {
+ poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx;
+ unsigned long h0,h1,h2,h3,h4,c;
+ unsigned long g0,g1,g2,g3,g4;
+ unsigned long long f;
+ unsigned long mask;
+
+ /* process the remaining block */
+ if (st->leftover) {
+ unsigned long long i = st->leftover;
+ st->buffer[i++] = 1;
+ for (; i < poly1305_block_size; i++)
+ st->buffer[i] = 0;
+ st->final = 1;
+ poly1305_blocks(st, st->buffer, poly1305_block_size);
+ }
+
+ /* fully carry h */
+ h0 = st->h[0];
+ h1 = st->h[1];
+ h2 = st->h[2];
+ h3 = st->h[3];
+ h4 = st->h[4];
+
+ c = h1 >> 26; h1 = h1 & 0x3ffffff;
+ h2 += c; c = h2 >> 26; h2 = h2 & 0x3ffffff;
+ h3 += c; c = h3 >> 26; h3 = h3 & 0x3ffffff;
+ h4 += c; c = h4 >> 26; h4 = h4 & 0x3ffffff;
+ h0 += c * 5; c = h0 >> 26; h0 = h0 & 0x3ffffff;
+ h1 += c;
+
+ /* compute h + -p */
+ g0 = h0 + 5; c = g0 >> 26; g0 &= 0x3ffffff;
+ g1 = h1 + c; c = g1 >> 26; g1 &= 0x3ffffff;
+ g2 = h2 + c; c = g2 >> 26; g2 &= 0x3ffffff;
+ g3 = h3 + c; c = g3 >> 26; g3 &= 0x3ffffff;
+ g4 = h4 + c - (1 << 26);
+
+ /* select h if h < p, or h + -p if h >= p */
+ mask = (g4 >> ((sizeof(unsigned long) * 8) - 1)) - 1;
+ g0 &= mask;
+ g1 &= mask;
+ g2 &= mask;
+ g3 &= mask;
+ g4 &= mask;
+ mask = ~mask;
+ h0 = (h0 & mask) | g0;
+ h1 = (h1 & mask) | g1;
+ h2 = (h2 & mask) | g2;
+ h3 = (h3 & mask) | g3;
+ h4 = (h4 & mask) | g4;
+
+ /* h = h % (2^128) */
+ h0 = ((h0 ) | (h1 << 26)) & 0xffffffff;
+ h1 = ((h1 >> 6) | (h2 << 20)) & 0xffffffff;
+ h2 = ((h2 >> 12) | (h3 << 14)) & 0xffffffff;
+ h3 = ((h3 >> 18) | (h4 << 8)) & 0xffffffff;
+
+ /* mac = (h + pad) % (2^128) */
+ f = (unsigned long long)h0 + st->pad[0] ; h0 = (unsigned long)f;
+ f = (unsigned long long)h1 + st->pad[1] + (f >> 32); h1 = (unsigned long)f;
+ f = (unsigned long long)h2 + st->pad[2] + (f >> 32); h2 = (unsigned long)f;
+ f = (unsigned long long)h3 + st->pad[3] + (f >> 32); h3 = (unsigned long)f;
+
+ U32TO8(mac + 0, h0);
+ U32TO8(mac + 4, h1);
+ U32TO8(mac + 8, h2);
+ U32TO8(mac + 12, h3);
+
+ /* zero out the state */
+ sodium_memzero((void *)st, sizeof *st);
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h
new file mode 100644
index 00000000..8b5c764b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h
@@ -0,0 +1,202 @@
+/*
+ poly1305 implementation using 64 bit * 64 bit = 128 bit multiplication and 128 bit addition
+*/
+
+#define POLY1305_IMPLEMENTATION_NAME "donna64"
+
+#if defined(__SIZEOF_INT128__)
+typedef unsigned __int128 uint128_t;
+#else
+typedef unsigned uint128_t __attribute__((mode(TI)));
+#endif
+
+#define MUL(out, x, y) out = ((uint128_t)x * y)
+#define ADD(out, in) out += in
+#define ADDLO(out, in) out += in
+#define SHR(in, shift) (unsigned long long)(in >> (shift))
+#define LO(in) (unsigned long long)(in)
+
+#define POLY1305_NOINLINE __attribute__((noinline))
+
+#define poly1305_block_size 16
+
+/* 17 + sizeof(unsigned long long) + 8*sizeof(unsigned long long) */
+typedef struct poly1305_state_internal_t {
+ unsigned long long r[3];
+ unsigned long long h[3];
+ unsigned long long pad[2];
+ unsigned long long leftover;
+ unsigned char buffer[poly1305_block_size];
+ unsigned char final;
+} poly1305_state_internal_t;
+
+/* interpret eight 8 bit unsigned integers as a 64 bit unsigned integer in little endian */
+static unsigned long long
+U8TO64(const unsigned char *p) {
+ return
+ (((unsigned long long)(p[0] & 0xff) ) |
+ ((unsigned long long)(p[1] & 0xff) << 8) |
+ ((unsigned long long)(p[2] & 0xff) << 16) |
+ ((unsigned long long)(p[3] & 0xff) << 24) |
+ ((unsigned long long)(p[4] & 0xff) << 32) |
+ ((unsigned long long)(p[5] & 0xff) << 40) |
+ ((unsigned long long)(p[6] & 0xff) << 48) |
+ ((unsigned long long)(p[7] & 0xff) << 56));
+}
+
+/* store a 64 bit unsigned integer as eight 8 bit unsigned integers in little endian */
+static void
+U64TO8(unsigned char *p, unsigned long long v) {
+ p[0] = (v ) & 0xff;
+ p[1] = (v >> 8) & 0xff;
+ p[2] = (v >> 16) & 0xff;
+ p[3] = (v >> 24) & 0xff;
+ p[4] = (v >> 32) & 0xff;
+ p[5] = (v >> 40) & 0xff;
+ p[6] = (v >> 48) & 0xff;
+ p[7] = (v >> 56) & 0xff;
+}
+
+static void
+poly1305_init(poly1305_context *ctx, const unsigned char key[32]) {
+ poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx;
+ unsigned long long t0,t1;
+
+ /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */
+ t0 = U8TO64(&key[0]);
+ t1 = U8TO64(&key[8]);
+
+ st->r[0] = ( t0 ) & 0xffc0fffffff;
+ st->r[1] = ((t0 >> 44) | (t1 << 20)) & 0xfffffc0ffff;
+ st->r[2] = ((t1 >> 24) ) & 0x00ffffffc0f;
+
+ /* h = 0 */
+ st->h[0] = 0;
+ st->h[1] = 0;
+ st->h[2] = 0;
+
+ /* save pad for later */
+ st->pad[0] = U8TO64(&key[16]);
+ st->pad[1] = U8TO64(&key[24]);
+
+ st->leftover = 0;
+ st->final = 0;
+}
+
+static void
+poly1305_blocks(poly1305_state_internal_t *st, const unsigned char *m, unsigned long long bytes) {
+ const unsigned long long hibit = (st->final) ? 0 : ((unsigned long long)1 << 40); /* 1 << 128 */
+ unsigned long long r0,r1,r2;
+ unsigned long long s1,s2;
+ unsigned long long h0,h1,h2;
+ unsigned long long c;
+ uint128_t d0,d1,d2,d;
+
+ r0 = st->r[0];
+ r1 = st->r[1];
+ r2 = st->r[2];
+
+ h0 = st->h[0];
+ h1 = st->h[1];
+ h2 = st->h[2];
+
+ s1 = r1 * (5 << 2);
+ s2 = r2 * (5 << 2);
+
+ while (bytes >= poly1305_block_size) {
+ unsigned long long t0,t1;
+
+ /* h += m[i] */
+ t0 = U8TO64(&m[0]);
+ t1 = U8TO64(&m[8]);
+
+ h0 += (( t0 ) & 0xfffffffffff);
+ h1 += (((t0 >> 44) | (t1 << 20)) & 0xfffffffffff);
+ h2 += (((t1 >> 24) ) & 0x3ffffffffff) | hibit;
+
+ /* h *= r */
+ MUL(d0, h0, r0); MUL(d, h1, s2); ADD(d0, d); MUL(d, h2, s1); ADD(d0, d);
+ MUL(d1, h0, r1); MUL(d, h1, r0); ADD(d1, d); MUL(d, h2, s2); ADD(d1, d);
+ MUL(d2, h0, r2); MUL(d, h1, r1); ADD(d2, d); MUL(d, h2, r0); ADD(d2, d);
+
+ /* (partial) h %= p */
+ c = SHR(d0, 44); h0 = LO(d0) & 0xfffffffffff;
+ ADDLO(d1, c); c = SHR(d1, 44); h1 = LO(d1) & 0xfffffffffff;
+ ADDLO(d2, c); c = SHR(d2, 42); h2 = LO(d2) & 0x3ffffffffff;
+ h0 += c * 5; c = (h0 >> 44); h0 = h0 & 0xfffffffffff;
+ h1 += c;
+
+ m += poly1305_block_size;
+ bytes -= poly1305_block_size;
+ }
+
+ st->h[0] = h0;
+ st->h[1] = h1;
+ st->h[2] = h2;
+}
+
+
+static POLY1305_NOINLINE void
+poly1305_finish(poly1305_context *ctx, unsigned char mac[16]) {
+ poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx;
+ unsigned long long h0,h1,h2,c;
+ unsigned long long g0,g1,g2;
+ unsigned long long t0,t1;
+
+ /* process the remaining block */
+ if (st->leftover) {
+ unsigned long long i = st->leftover;
+ st->buffer[i] = 1;
+ for (i = i + 1; i < poly1305_block_size; i++)
+ st->buffer[i] = 0;
+ st->final = 1;
+ poly1305_blocks(st, st->buffer, poly1305_block_size);
+ }
+
+ /* fully carry h */
+ h0 = st->h[0];
+ h1 = st->h[1];
+ h2 = st->h[2];
+
+ c = (h1 >> 44); h1 &= 0xfffffffffff;
+ h2 += c; c = (h2 >> 42); h2 &= 0x3ffffffffff;
+ h0 += c * 5; c = (h0 >> 44); h0 &= 0xfffffffffff;
+ h1 += c; c = (h1 >> 44); h1 &= 0xfffffffffff;
+ h2 += c; c = (h2 >> 42); h2 &= 0x3ffffffffff;
+ h0 += c * 5; c = (h0 >> 44); h0 &= 0xfffffffffff;
+ h1 += c;
+
+ /* compute h + -p */
+ g0 = h0 + 5; c = (g0 >> 44); g0 &= 0xfffffffffff;
+ g1 = h1 + c; c = (g1 >> 44); g1 &= 0xfffffffffff;
+ g2 = h2 + c - ((unsigned long long)1 << 42);
+
+ /* select h if h < p, or h + -p if h >= p */
+ c = (g2 >> ((sizeof(unsigned long long) * 8) - 1)) - 1;
+ g0 &= c;
+ g1 &= c;
+ g2 &= c;
+ c = ~c;
+ h0 = (h0 & c) | g0;
+ h1 = (h1 & c) | g1;
+ h2 = (h2 & c) | g2;
+
+ /* h = (h + pad) */
+ t0 = st->pad[0];
+ t1 = st->pad[1];
+
+ h0 += (( t0 ) & 0xfffffffffff) ; c = (h0 >> 44); h0 &= 0xfffffffffff;
+ h1 += (((t0 >> 44) | (t1 << 20)) & 0xfffffffffff) + c; c = (h1 >> 44); h1 &= 0xfffffffffff;
+ h2 += (((t1 >> 24) ) & 0x3ffffffffff) + c; h2 &= 0x3ffffffffff;
+
+ /* mac = h % (2^128) */
+ h0 = ((h0 ) | (h1 << 44));
+ h1 = ((h1 >> 20) | (h2 << 24));
+
+ U64TO8(&mac[0], h0);
+ U64TO8(&mac[8], h1);
+
+ /* zero out the state */
+ sodium_memzero((void *)st, sizeof *st);
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c
new file mode 100644
index 00000000..e0598423
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c
@@ -0,0 +1,15 @@
+#include "crypto_onetimeauth_poly1305.h"
+#include "crypto_verify_16.h"
+#include "poly1305_donna.h"
+
+int
+crypto_onetimeauth_poly1305_donna_verify(const unsigned char *h,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k)
+{
+ unsigned char correct[16];
+
+ crypto_onetimeauth_poly1305_donna(correct,in,inlen,k);
+ return crypto_verify_16(h,correct);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c
new file mode 100644
index 00000000..14253b7b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c
@@ -0,0 +1,60 @@
+
+#include "crypto_onetimeauth_poly1305.h"
+#include "donna/poly1305_donna.h"
+
+/* LCOV_EXCL_START */
+static const crypto_onetimeauth_poly1305_implementation *implementation =
+ &crypto_onetimeauth_poly1305_donna_implementation;
+
+int
+crypto_onetimeauth_poly1305_set_implementation(crypto_onetimeauth_poly1305_implementation *impl)
+{
+ implementation = impl;
+
+ return 0;
+}
+
+const char *
+crypto_onetimeauth_poly1305_implementation_name(void)
+{
+ return implementation->implementation_name();
+}
+/* LCOV_EXCL_STOP */
+
+int
+crypto_onetimeauth_poly1305(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ return implementation->onetimeauth(out, in, inlen, k);
+}
+
+int
+crypto_onetimeauth_poly1305_verify(const unsigned char *h,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k)
+{
+ return implementation->onetimeauth_verify(h, in, inlen, k);
+}
+
+int
+crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *key)
+{
+ return implementation->onetimeauth_init(state, key);
+}
+
+int
+crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *in,
+ unsigned long long inlen)
+{
+ return implementation->onetimeauth_update(state, in, inlen);
+}
+
+int
+crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
+ unsigned char *out)
+{
+ return implementation->onetimeauth_final(state, out);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c
new file mode 100644
index 00000000..b8878d5d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c
@@ -0,0 +1,11 @@
+#include "crypto_onetimeauth_poly1305.h"
+
+size_t
+crypto_onetimeauth_poly1305_bytes(void) {
+ return crypto_onetimeauth_poly1305_BYTES;
+}
+
+size_t
+crypto_onetimeauth_poly1305_keybytes(void) {
+ return crypto_onetimeauth_poly1305_KEYBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c
new file mode 100644
index 00000000..10084e5b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c
@@ -0,0 +1,13 @@
+
+#include <stdlib.h>
+#include <string.h>
+#include "crypto_onetimeauth.h"
+#include "crypto_onetimeauth_poly1305.h"
+#include "utils.h"
+#include "donna/poly1305_donna.h"
+
+crypto_onetimeauth_poly1305_implementation *
+crypto_onetimeauth_pick_best_implementation(void)
+{
+ return &crypto_onetimeauth_poly1305_donna_implementation;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c
new file mode 100644
index 00000000..77be6ab9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c
@@ -0,0 +1,250 @@
+/*-
+ * Copyright 2013 Alexander Peslyak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "crypto_pwhash_scryptsalsa208sha256.h"
+#include "crypto_scrypt.h"
+#include "runtime.h"
+#include "utils.h"
+
+static const char * const itoa64 =
+ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+static uint8_t *
+encode64_uint32(uint8_t * dst, size_t dstlen, uint32_t src, uint32_t srcbits)
+{
+ uint32_t bit;
+
+ for (bit = 0; bit < srcbits; bit += 6) {
+ if (dstlen < 1) {
+ return NULL; /* LCOV_EXCL_LINE */
+ }
+ *dst++ = itoa64[src & 0x3f];
+ dstlen--;
+ src >>= 6;
+ }
+
+ return dst;
+}
+
+static uint8_t *
+encode64(uint8_t * dst, size_t dstlen, const uint8_t * src, size_t srclen)
+{
+ size_t i;
+
+ for (i = 0; i < srclen; ) {
+ uint8_t * dnext;
+ uint32_t value = 0, bits = 0;
+ do {
+ value |= (uint32_t)src[i++] << bits;
+ bits += 8;
+ } while (bits < 24 && i < srclen);
+ dnext = encode64_uint32(dst, dstlen, value, bits);
+ if (!dnext) {
+ return NULL; /* LCOV_EXCL_LINE */
+ }
+ dstlen -= dnext - dst;
+ dst = dnext;
+ }
+
+ return dst;
+}
+
+static int
+decode64_one(uint32_t * dst, uint8_t src)
+{
+ const char *ptr = strchr(itoa64, src);
+
+ if (ptr) {
+ *dst = (uint32_t) (ptr - itoa64);
+ return 0;
+ }
+ *dst = 0;
+ return -1;
+}
+
+static const uint8_t *
+decode64_uint32(uint32_t * dst, uint32_t dstbits, const uint8_t * src)
+{
+ uint32_t bit;
+ uint32_t value;
+
+ value = 0;
+ for (bit = 0; bit < dstbits; bit += 6) {
+ uint32_t one;
+ if (decode64_one(&one, *src)) {
+ *dst = 0;
+ return NULL;
+ }
+ src++;
+ value |= one << bit;
+ }
+
+ *dst = value;
+ return src;
+}
+
+uint8_t *
+escrypt_r(escrypt_local_t * local, const uint8_t * passwd, size_t passwdlen,
+ const uint8_t * setting, uint8_t * buf, size_t buflen)
+{
+ uint8_t hash[crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES];
+ escrypt_kdf_t escrypt_kdf;
+ const uint8_t *src;
+ const uint8_t *salt;
+ uint8_t *dst;
+ size_t prefixlen;
+ size_t saltlen;
+ size_t need;
+ uint64_t N;
+ uint32_t N_log2;
+ uint32_t r;
+ uint32_t p;
+
+ if (setting[0] != '$' || setting[1] != '7' || setting[2] != '$') {
+ return NULL;
+ }
+ src = setting + 3;
+
+ if (decode64_one(&N_log2, *src)) {
+ return NULL;
+ }
+ src++;
+ N = (uint64_t)1 << N_log2;
+
+ src = decode64_uint32(&r, 30, src);
+ if (!src) {
+ return NULL;
+ }
+ src = decode64_uint32(&p, 30, src);
+ if (!src) {
+ return NULL;
+ }
+ prefixlen = src - setting;
+
+ salt = src;
+ src = (uint8_t *) strrchr((char *)salt, '$');
+ if (src) {
+ saltlen = src - salt;
+ } else {
+ saltlen = strlen((char *)salt);
+ }
+ need = prefixlen + saltlen + 1 +
+ crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED + 1;
+ if (need > buflen || need < saltlen) {
+ return NULL;
+ }
+#if defined(HAVE_EMMINTRIN_H) || defined(_MSC_VER)
+ escrypt_kdf =
+ sodium_runtime_has_sse2() ? escrypt_kdf_sse : escrypt_kdf_nosse;
+#else
+ escrypt_kdf = escrypt_kdf_nosse;
+#endif
+ if (escrypt_kdf(local, passwd, passwdlen, salt, saltlen,
+ N, r, p, hash, sizeof(hash))) {
+ return NULL;
+ }
+
+ dst = buf;
+ memcpy(dst, setting, prefixlen + saltlen);
+ dst += prefixlen + saltlen;
+ *dst++ = '$';
+
+ dst = encode64(dst, buflen - (dst - buf), hash, sizeof(hash));
+ sodium_memzero(hash, sizeof hash);
+ if (!dst || dst >= buf + buflen) {
+ return NULL; /* Can't happen LCOV_EXCL_LINE */
+ }
+ *dst = 0; /* NUL termination */
+
+ return buf;
+}
+
+uint8_t *
+escrypt_gensalt_r(uint32_t N_log2, uint32_t r, uint32_t p,
+ const uint8_t * src, size_t srclen,
+ uint8_t * buf, size_t buflen)
+{
+ uint8_t *dst;
+ size_t prefixlen =
+ (sizeof "$7$" - 1U) + (1U /* N_log2 */) + (5U /* r */) + (5U /* p */);
+ size_t saltlen = BYTES2CHARS(srclen);
+ size_t need;
+
+ need = prefixlen + saltlen + 1;
+ if (need > buflen || need < saltlen || saltlen < srclen) {
+ return NULL; /* LCOV_EXCL_LINE */
+ }
+ if (N_log2 > 63 || ((uint64_t)r * (uint64_t)p >= (1U << 30))) {
+ return NULL;
+ }
+ dst = buf;
+ *dst++ = '$';
+ *dst++ = '7';
+ *dst++ = '$';
+
+ *dst++ = itoa64[N_log2];
+
+ dst = encode64_uint32(dst, buflen - (dst - buf), r, 30);
+ if (!dst) {
+ return NULL; /* Can't happen LCOV_EXCL_LINE */
+ }
+ dst = encode64_uint32(dst, buflen - (dst - buf), p, 30);
+ if (!dst) {
+ return NULL; /* Can't happen LCOV_EXCL_LINE */
+ }
+ dst = encode64(dst, buflen - (dst - buf), src, srclen);
+ if (!dst || dst >= buf + buflen) {
+ return NULL; /* Can't happen LCOV_EXCL_LINE */
+ }
+ *dst = 0; /* NUL termination */
+
+ return buf;
+}
+
+int
+crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
+ const uint8_t * salt, size_t saltlen,
+ uint64_t N, uint32_t r, uint32_t p,
+ uint8_t * buf, size_t buflen)
+{
+ escrypt_kdf_t escrypt_kdf;
+ escrypt_local_t local;
+ int retval;
+
+ if (escrypt_init_local(&local)) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+#if defined(HAVE_EMMINTRIN_H) || defined(_MSC_VER)
+ escrypt_kdf =
+ sodium_runtime_has_sse2() ? escrypt_kdf_sse : escrypt_kdf_nosse;
+#else
+ escrypt_kdf = escrypt_kdf_nosse;
+#endif
+ retval = escrypt_kdf(&local,
+ passwd, passwdlen, salt, saltlen,
+ N, r, p, buf, buflen);
+ if (escrypt_free_local(&local)) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ return retval;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h
new file mode 100644
index 00000000..5f1bb8a4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h
@@ -0,0 +1,86 @@
+/*-
+ * Copyright 2009 Colin Percival
+ * Copyright 2013 Alexander Peslyak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This file was originally written by Colin Percival as part of the Tarsnap
+ * online backup system.
+ */
+#ifndef crypto_scrypt_H
+#define crypto_scrypt_H
+
+#include <stdint.h>
+
+#define crypto_pwhash_scryptsalsa208sha256_STRPREFIXBYTES 14
+#define crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES 57
+#define crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES 32
+#define crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES_ENCODED 43
+#define crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES 32
+#define crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED 43
+
+#define BYTES2CHARS(bytes) ((((bytes) * 8) + 5) / 6)
+
+typedef struct {
+ void * base, * aligned;
+ size_t size;
+} escrypt_region_t;
+
+typedef escrypt_region_t escrypt_local_t;
+
+extern int escrypt_init_local(escrypt_local_t * __local);
+
+extern int escrypt_free_local(escrypt_local_t * __local);
+
+extern void *alloc_region(escrypt_region_t * region, size_t size);
+extern int free_region(escrypt_region_t * region);
+
+typedef int (*escrypt_kdf_t)(escrypt_local_t * __local,
+ const uint8_t * __passwd, size_t __passwdlen,
+ const uint8_t * __salt, size_t __saltlen,
+ uint64_t __N, uint32_t __r, uint32_t __p,
+ uint8_t * __buf, size_t __buflen);
+
+extern int escrypt_kdf_nosse(escrypt_local_t * __local,
+ const uint8_t * __passwd, size_t __passwdlen,
+ const uint8_t * __salt, size_t __saltlen,
+ uint64_t __N, uint32_t __r, uint32_t __p,
+ uint8_t * __buf, size_t __buflen);
+
+extern int escrypt_kdf_sse(escrypt_local_t * __local,
+ const uint8_t * __passwd, size_t __passwdlen,
+ const uint8_t * __salt, size_t __saltlen,
+ uint64_t __N, uint32_t __r, uint32_t __p,
+ uint8_t * __buf, size_t __buflen);
+
+extern uint8_t * escrypt_r(escrypt_local_t * __local,
+ const uint8_t * __passwd, size_t __passwdlen,
+ const uint8_t * __setting,
+ uint8_t * __buf, size_t __buflen);
+
+extern uint8_t * escrypt_gensalt_r(
+ uint32_t __N_log2, uint32_t __r, uint32_t __p,
+ const uint8_t * __src, size_t __srclen,
+ uint8_t * __buf, size_t __buflen);
+
+#endif /* !_CRYPTO_SCRYPT_H_ */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c
new file mode 100644
index 00000000..a9ab966e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c
@@ -0,0 +1,302 @@
+/*-
+ * Copyright 2009 Colin Percival
+ * Copyright 2013 Alexander Peslyak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This file was originally written by Colin Percival as part of the Tarsnap
+ * online backup system.
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../pbkdf2-sha256.h"
+#include "../sysendian.h"
+#include "../crypto_scrypt.h"
+
+static inline void
+blkcpy(void * dest, const void * src, size_t len)
+{
+ size_t * D = (size_t *) dest;
+ const size_t * S = (const size_t *) src;
+ size_t L = len / sizeof(size_t);
+ size_t i;
+
+ for (i = 0; i < L; i++)
+ D[i] = S[i];
+}
+
+static inline void
+blkxor(void * dest, const void * src, size_t len)
+{
+ size_t * D = (size_t *) dest;
+ const size_t * S = (const size_t *) src;
+ size_t L = len / sizeof(size_t);
+ size_t i;
+
+ for (i = 0; i < L; i++)
+ D[i] ^= S[i];
+}
+
+/**
+ * salsa20_8(B):
+ * Apply the salsa20/8 core to the provided block.
+ */
+static void
+salsa20_8(uint32_t B[16])
+{
+ uint32_t x[16];
+ size_t i;
+
+ blkcpy(x, B, 64);
+ for (i = 0; i < 8; i += 2) {
+#define R(a,b) (((a) << (b)) | ((a) >> (32 - (b))))
+ /* Operate on columns. */
+ x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9);
+ x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18);
+
+ x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9);
+ x[ 1] ^= R(x[13]+x[ 9],13); x[ 5] ^= R(x[ 1]+x[13],18);
+
+ x[14] ^= R(x[10]+x[ 6], 7); x[ 2] ^= R(x[14]+x[10], 9);
+ x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],18);
+
+ x[ 3] ^= R(x[15]+x[11], 7); x[ 7] ^= R(x[ 3]+x[15], 9);
+ x[11] ^= R(x[ 7]+x[ 3],13); x[15] ^= R(x[11]+x[ 7],18);
+
+ /* Operate on rows. */
+ x[ 1] ^= R(x[ 0]+x[ 3], 7); x[ 2] ^= R(x[ 1]+x[ 0], 9);
+ x[ 3] ^= R(x[ 2]+x[ 1],13); x[ 0] ^= R(x[ 3]+x[ 2],18);
+
+ x[ 6] ^= R(x[ 5]+x[ 4], 7); x[ 7] ^= R(x[ 6]+x[ 5], 9);
+ x[ 4] ^= R(x[ 7]+x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],18);
+
+ x[11] ^= R(x[10]+x[ 9], 7); x[ 8] ^= R(x[11]+x[10], 9);
+ x[ 9] ^= R(x[ 8]+x[11],13); x[10] ^= R(x[ 9]+x[ 8],18);
+
+ x[12] ^= R(x[15]+x[14], 7); x[13] ^= R(x[12]+x[15], 9);
+ x[14] ^= R(x[13]+x[12],13); x[15] ^= R(x[14]+x[13],18);
+#undef R
+ }
+ for (i = 0; i < 16; i++)
+ B[i] += x[i];
+}
+
+/**
+ * blockmix_salsa8(Bin, Bout, X, r):
+ * Compute Bout = BlockMix_{salsa20/8, r}(Bin). The input Bin must be 128r
+ * bytes in length; the output Bout must also be the same size. The
+ * temporary space X must be 64 bytes.
+ */
+static void
+blockmix_salsa8(const uint32_t * Bin, uint32_t * Bout, uint32_t * X, size_t r)
+{
+ size_t i;
+
+ /* 1: X <-- B_{2r - 1} */
+ blkcpy(X, &Bin[(2 * r - 1) * 16], 64);
+
+ /* 2: for i = 0 to 2r - 1 do */
+ for (i = 0; i < 2 * r; i += 2) {
+ /* 3: X <-- H(X \xor B_i) */
+ blkxor(X, &Bin[i * 16], 64);
+ salsa20_8(X);
+
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ blkcpy(&Bout[i * 8], X, 64);
+
+ /* 3: X <-- H(X \xor B_i) */
+ blkxor(X, &Bin[i * 16 + 16], 64);
+ salsa20_8(X);
+
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ blkcpy(&Bout[i * 8 + r * 16], X, 64);
+ }
+}
+
+/**
+ * integerify(B, r):
+ * Return the result of parsing B_{2r-1} as a little-endian integer.
+ */
+static inline uint64_t
+integerify(const void * B, size_t r)
+{
+ const uint32_t * X = (const uint32_t *)((uintptr_t)(B) + (2 * r - 1) * 64);
+
+ return (((uint64_t)(X[1]) << 32) + X[0]);
+}
+
+/**
+ * smix(B, r, N, V, XY):
+ * Compute B = SMix_r(B, N). The input B must be 128r bytes in length;
+ * the temporary storage V must be 128rN bytes in length; the temporary
+ * storage XY must be 256r + 64 bytes in length. The value N must be a
+ * power of 2 greater than 1. The arrays B, V, and XY must be aligned to a
+ * multiple of 64 bytes.
+ */
+static void
+smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY)
+{
+ uint32_t * X = XY;
+ uint32_t * Y = &XY[32 * r];
+ uint32_t * Z = &XY[64 * r];
+ uint64_t i;
+ uint64_t j;
+ size_t k;
+
+ /* 1: X <-- B */
+ for (k = 0; k < 32 * r; k++)
+ X[k] = le32dec(&B[4 * k]);
+
+ /* 2: for i = 0 to N - 1 do */
+ for (i = 0; i < N; i += 2) {
+ /* 3: V_i <-- X */
+ blkcpy(&V[i * (32 * r)], X, 128 * r);
+
+ /* 4: X <-- H(X) */
+ blockmix_salsa8(X, Y, Z, r);
+
+ /* 3: V_i <-- X */
+ blkcpy(&V[(i + 1) * (32 * r)], Y, 128 * r);
+
+ /* 4: X <-- H(X) */
+ blockmix_salsa8(Y, X, Z, r);
+ }
+
+ /* 6: for i = 0 to N - 1 do */
+ for (i = 0; i < N; i += 2) {
+ /* 7: j <-- Integerify(X) mod N */
+ j = integerify(X, r) & (N - 1);
+
+ /* 8: X <-- H(X \xor V_j) */
+ blkxor(X, &V[j * (32 * r)], 128 * r);
+ blockmix_salsa8(X, Y, Z, r);
+
+ /* 7: j <-- Integerify(X) mod N */
+ j = integerify(Y, r) & (N - 1);
+
+ /* 8: X <-- H(X \xor V_j) */
+ blkxor(Y, &V[j * (32 * r)], 128 * r);
+ blockmix_salsa8(Y, X, Z, r);
+ }
+ /* 10: B' <-- X */
+ for (k = 0; k < 32 * r; k++)
+ le32enc(&B[4 * k], X[k]);
+}
+
+/**
+ * escrypt_kdf(local, passwd, passwdlen, salt, saltlen,
+ * N, r, p, buf, buflen):
+ * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r,
+ * p, buflen) and write the result into buf. The parameters r, p, and buflen
+ * must satisfy r * p < 2^30 and buflen <= (2^32 - 1) * 32. The parameter N
+ * must be a power of 2 greater than 1.
+ *
+ * Return 0 on success; or -1 on error.
+ */
+int
+escrypt_kdf_nosse(escrypt_local_t * local,
+ const uint8_t * passwd, size_t passwdlen,
+ const uint8_t * salt, size_t saltlen,
+ uint64_t N, uint32_t _r, uint32_t _p,
+ uint8_t * buf, size_t buflen)
+{
+ size_t B_size, V_size, XY_size, need;
+ uint8_t * B;
+ uint32_t * V, * XY;
+ size_t r = _r, p = _p;
+ uint32_t i;
+
+ /* Sanity-check parameters. */
+#if SIZE_MAX > UINT32_MAX
+ if (buflen > (((uint64_t)(1) << 32) - 1) * 32) {
+ errno = EFBIG;
+ return -1;
+ }
+#endif
+ if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) {
+ errno = EFBIG;
+ return -1;
+ }
+ if (((N & (N - 1)) != 0) || (N < 2)) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (r == 0 || p == 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ if ((r > SIZE_MAX / 128 / p) ||
+#if SIZE_MAX / 256 <= UINT32_MAX
+ (r > SIZE_MAX / 256) ||
+#endif
+ (N > SIZE_MAX / 128 / r)) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ /* Allocate memory. */
+ B_size = (size_t)128 * r * p;
+ V_size = (size_t)128 * r * N;
+ need = B_size + V_size;
+ if (need < V_size) {
+ errno = ENOMEM;
+ return -1;
+ }
+ XY_size = (size_t)256 * r + 64;
+ need += XY_size;
+ if (need < XY_size) {
+ errno = ENOMEM;
+ return -1;
+ }
+ if (local->size < need) {
+ if (free_region(local))
+ return -1;
+ if (!alloc_region(local, need))
+ return -1;
+ }
+ B = (uint8_t *)local->aligned;
+ V = (uint32_t *)((uint8_t *)B + B_size);
+ XY = (uint32_t *)((uint8_t *)V + V_size);
+
+ /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */
+ PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, B_size);
+
+ /* 2: for i = 0 to p - 1 do */
+ for (i = 0; i < p; i++) {
+ /* 3: B_i <-- MF(B_i, N) */
+ smix(&B[(size_t)128 * i * r], r, N, V, XY);
+ }
+
+ /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */
+ PBKDF2_SHA256(passwd, passwdlen, B, B_size, 1, buf, buflen);
+
+ /* Success! */
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c
new file mode 100644
index 00000000..9b585a27
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c
@@ -0,0 +1,85 @@
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "crypto_auth_hmacsha256.h"
+#include "pbkdf2-sha256.h"
+#include "sysendian.h"
+#include "utils.h"
+
+/**
+ * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
+ * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and
+ * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).
+ */
+void
+PBKDF2_SHA256(const uint8_t * passwd, size_t passwdlen, const uint8_t * salt,
+ size_t saltlen, uint64_t c, uint8_t * buf, size_t dkLen)
+{
+ crypto_auth_hmacsha256_state PShctx, hctx;
+ size_t i;
+ uint8_t ivec[4];
+ uint8_t U[32];
+ uint8_t T[32];
+ uint64_t j;
+ int k;
+ size_t clen;
+
+ crypto_auth_hmacsha256_init(&PShctx, passwd, passwdlen);
+ crypto_auth_hmacsha256_update(&PShctx, salt, saltlen);
+
+ for (i = 0; i * 32 < dkLen; i++) {
+ be32enc(ivec, (uint32_t)(i + 1));
+ memcpy(&hctx, &PShctx, sizeof(crypto_auth_hmacsha256_state));
+ crypto_auth_hmacsha256_update(&hctx, ivec, 4);
+ crypto_auth_hmacsha256_final(&hctx, U);
+
+ memcpy(T, U, 32);
+ /* LCOV_EXCL_START */
+ for (j = 2; j <= c; j++) {
+ crypto_auth_hmacsha256_init(&hctx, passwd, passwdlen);
+ crypto_auth_hmacsha256_update(&hctx, U, 32);
+ crypto_auth_hmacsha256_final(&hctx, U);
+
+ for (k = 0; k < 32; k++) {
+ T[k] ^= U[k];
+ }
+ }
+ /* LCOV_EXCL_STOP */
+
+ clen = dkLen - i * 32;
+ if (clen > 32) {
+ clen = 32;
+ }
+ memcpy(&buf[i * 32], T, clen);
+ }
+ sodium_memzero((void *) &PShctx, sizeof PShctx);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h
new file mode 100644
index 00000000..dbe1875e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h
@@ -0,0 +1,45 @@
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef pbkdf2_sha256_H
+#define pbkdf2_sha256_H
+
+#include <sys/types.h>
+
+#include <stdint.h>
+
+#include "crypto_auth_hmacsha256.h"
+
+/**
+ * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
+ * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and
+ * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).
+ */
+void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t,
+ uint64_t, uint8_t *, size_t);
+
+#endif /* !_SHA256_H_ */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c
new file mode 100644
index 00000000..0051ee0e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c
@@ -0,0 +1,207 @@
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "crypto_pwhash_scryptsalsa208sha256.h"
+#include "crypto_scrypt.h"
+#include "randombytes.h"
+#include "utils.h"
+
+#define SETTING_SIZE(saltbytes) \
+ (sizeof "$7$" - 1U) + \
+ (1U /* N_log2 */) + (5U /* r */) + (5U /* p */) + BYTES2CHARS(saltbytes)
+
+static int
+pickparams(unsigned long long opslimit, const size_t memlimit,
+ uint32_t * const N_log2, uint32_t * const p, uint32_t * const r)
+{
+ unsigned long long maxN;
+ unsigned long long maxrp;
+
+ if (opslimit < 32768) {
+ opslimit = 32768;
+ }
+ *r = 8;
+ if (opslimit < memlimit / 32) {
+ *p = 1;
+ maxN = opslimit / (*r * 4);
+ for (*N_log2 = 1; *N_log2 < 63; *N_log2 += 1) {
+ if ((uint64_t)(1) << *N_log2 > maxN / 2) {
+ break;
+ }
+ }
+ } else {
+ maxN = memlimit / ((size_t) *r * 128);
+ for (*N_log2 = 1; *N_log2 < 63; *N_log2 += 1) {
+ if ((uint64_t) (1) << *N_log2 > maxN / 2) {
+ break;
+ }
+ }
+ maxrp = (opslimit / 4) / ((uint64_t) (1) << *N_log2);
+ /* LCOV_EXCL_START */
+ if (maxrp > 0x3fffffff) {
+ maxrp = 0x3fffffff;
+ }
+ /* LCOV_EXCL_STOP */
+ *p = (uint32_t) (maxrp) / *r;
+ }
+ return 0;
+}
+
+size_t
+crypto_pwhash_scryptsalsa208sha256_saltbytes(void)
+{
+ return crypto_pwhash_scryptsalsa208sha256_SALTBYTES;
+}
+
+size_t
+crypto_pwhash_scryptsalsa208sha256_strbytes(void)
+{
+ return crypto_pwhash_scryptsalsa208sha256_STRBYTES;
+}
+
+const char *
+crypto_pwhash_scryptsalsa208sha256_strprefix(void)
+{
+ return crypto_pwhash_scryptsalsa208sha256_STRPREFIX;
+}
+
+size_t
+crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void)
+{
+ return crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE;
+}
+
+size_t
+crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void)
+{
+ return crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE;
+}
+
+size_t
+crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void)
+{
+ return crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE;
+}
+
+size_t
+crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void)
+{
+ return crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE;
+}
+
+int
+crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
+ unsigned long long outlen,
+ const char * const passwd,
+ unsigned long long passwdlen,
+ const unsigned char * const salt,
+ unsigned long long opslimit,
+ size_t memlimit)
+{
+ uint32_t N_log2;
+ uint32_t p;
+ uint32_t r;
+
+ memset(out, 0, outlen);
+ if (passwdlen > SIZE_MAX || outlen > SIZE_MAX) {
+ errno = EFBIG; /* LCOV_EXCL_LINE */
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ if (pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) {
+ errno = EINVAL; /* LCOV_EXCL_LINE */
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ return crypto_pwhash_scryptsalsa208sha256_ll((const uint8_t *) passwd,
+ (size_t) passwdlen,
+ (const uint8_t *) salt,
+ crypto_pwhash_scryptsalsa208sha256_SALTBYTES,
+ (uint64_t) (1) << N_log2, r, p,
+ out, (size_t) outlen);
+}
+
+int
+crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
+ const char * const passwd,
+ unsigned long long passwdlen,
+ unsigned long long opslimit,
+ size_t memlimit)
+{
+ uint8_t salt[crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES];
+ char setting[crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U];
+ escrypt_local_t escrypt_local;
+ uint32_t N_log2;
+ uint32_t p;
+ uint32_t r;
+
+ memset(out, 0, crypto_pwhash_scryptsalsa208sha256_STRBYTES);
+ if (passwdlen > SIZE_MAX) {
+ errno = EFBIG; /* LCOV_EXCL_LINE */
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ if (pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) {
+ errno = EINVAL; /* LCOV_EXCL_LINE */
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ randombytes_buf(salt, sizeof salt);
+ if (escrypt_gensalt_r(N_log2, r, p, salt, sizeof salt,
+ (uint8_t *) setting, sizeof setting) == NULL) {
+ errno = EINVAL; /* LCOV_EXCL_LINE */
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ if (escrypt_init_local(&escrypt_local) != 0) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ if (escrypt_r(&escrypt_local, (const uint8_t *) passwd, (size_t) passwdlen,
+ (const uint8_t *) setting, (uint8_t *) out,
+ crypto_pwhash_scryptsalsa208sha256_STRBYTES) == NULL) {
+ /* LCOV_EXCL_START */
+ escrypt_free_local(&escrypt_local);
+ errno = EINVAL;
+ return -1;
+ /* LCOV_EXCL_STOP */
+ }
+ escrypt_free_local(&escrypt_local);
+
+ (void) sizeof
+ (int[SETTING_SIZE(crypto_pwhash_scryptsalsa208sha256_STRSALTBYTES)
+ == crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES ? 1 : -1]);
+ (void) sizeof
+ (int[crypto_pwhash_scryptsalsa208sha256_STRSETTINGBYTES + 1U +
+ crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED + 1U
+ == crypto_pwhash_scryptsalsa208sha256_STRBYTES ? 1 : -1]);
+
+ return 0;
+}
+
+int
+crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
+ const char * const passwd,
+ unsigned long long passwdlen)
+{
+ char wanted[crypto_pwhash_scryptsalsa208sha256_STRBYTES];
+ escrypt_local_t escrypt_local;
+ int ret = -1;
+
+ if (memchr(str, 0, crypto_pwhash_scryptsalsa208sha256_STRBYTES) !=
+ &str[crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1U]) {
+ return -1;
+ }
+ if (escrypt_init_local(&escrypt_local) != 0) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ if (escrypt_r(&escrypt_local, (const uint8_t *) passwd, (size_t) passwdlen,
+ (const uint8_t *) str, (uint8_t *) wanted,
+ sizeof wanted) == NULL) {
+ escrypt_free_local(&escrypt_local);
+ return -1;
+ }
+ escrypt_free_local(&escrypt_local);
+ ret = sodium_memcmp(wanted, str, sizeof wanted);
+ sodium_memzero(wanted, sizeof wanted);
+
+ return ret;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c
new file mode 100644
index 00000000..85d4267d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c
@@ -0,0 +1,100 @@
+/*-
+ * Copyright 2013 Alexander Peslyak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
+#include <errno.h>
+#include <stdlib.h>
+
+#include "crypto_scrypt.h"
+#include "runtime.h"
+
+#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
+# define MAP_ANON MAP_ANONYMOUS
+#endif
+
+void *
+alloc_region(escrypt_region_t * region, size_t size)
+{
+ uint8_t * base, * aligned;
+#if defined(MAP_ANON) && defined(HAVE_MMAP)
+ if ((base = (uint8_t *) mmap(NULL, size, PROT_READ | PROT_WRITE,
+#ifdef MAP_NOCORE
+ MAP_ANON | MAP_PRIVATE | MAP_NOCORE,
+#else
+ MAP_ANON | MAP_PRIVATE,
+#endif
+ -1, 0)) == MAP_FAILED)
+ base = NULL; /* LCOV_EXCL_LINE */
+ aligned = base;
+#elif defined(HAVE_POSIX_MEMALIGN)
+ if ((errno = posix_memalign((void **) &base, 64, size)) != 0)
+ base = NULL;
+ aligned = base;
+#else
+ base = aligned = NULL;
+ if (size + 63 < size)
+ errno = ENOMEM;
+ else if ((base = (uint8_t *) malloc(size + 63)) != NULL) {
+ aligned = base + 63;
+ aligned -= (uintptr_t)aligned & 63;
+ }
+#endif
+ region->base = base;
+ region->aligned = aligned;
+ region->size = base ? size : 0;
+ return aligned;
+}
+
+static inline void
+init_region(escrypt_region_t * region)
+{
+ region->base = region->aligned = NULL;
+ region->size = 0;
+}
+
+int
+free_region(escrypt_region_t * region)
+{
+ if (region->base) {
+#if defined(MAP_ANON) && defined(HAVE_MMAP)
+ if (munmap(region->base, region->size))
+ return -1; /* LCOV_EXCL_LINE */
+#else
+ free(region->base);
+#endif
+ }
+ init_region(region);
+ return 0;
+}
+
+int
+escrypt_init_local(escrypt_local_t * local)
+{
+ init_region(local);
+ return 0;
+}
+
+int
+escrypt_free_local(escrypt_local_t * local)
+{
+ return free_region(local);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c
new file mode 100644
index 00000000..a5202ed6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c
@@ -0,0 +1,391 @@
+/*-
+ * Copyright 2009 Colin Percival
+ * Copyright 2012,2013 Alexander Peslyak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This file was originally written by Colin Percival as part of the Tarsnap
+ * online backup system.
+ */
+
+#if defined(HAVE_EMMINTRIN_H) || defined(_MSC_VER)
+#if __GNUC__
+# pragma GCC target("sse2")
+#endif
+#include <emmintrin.h>
+#if defined(__XOP__) && defined(DISABLED)
+# include <x86intrin.h>
+#endif
+
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../pbkdf2-sha256.h"
+#include "../sysendian.h"
+#include "../crypto_scrypt.h"
+
+#if defined(__XOP__) && defined(DISABLED)
+#define ARX(out, in1, in2, s) \
+ out = _mm_xor_si128(out, _mm_roti_epi32(_mm_add_epi32(in1, in2), s));
+#else
+#define ARX(out, in1, in2, s) \
+ { \
+ __m128i T = _mm_add_epi32(in1, in2); \
+ out = _mm_xor_si128(out, _mm_slli_epi32(T, s)); \
+ out = _mm_xor_si128(out, _mm_srli_epi32(T, 32-s)); \
+ }
+#endif
+
+#define SALSA20_2ROUNDS \
+ /* Operate on "columns". */ \
+ ARX(X1, X0, X3, 7) \
+ ARX(X2, X1, X0, 9) \
+ ARX(X3, X2, X1, 13) \
+ ARX(X0, X3, X2, 18) \
+\
+ /* Rearrange data. */ \
+ X1 = _mm_shuffle_epi32(X1, 0x93); \
+ X2 = _mm_shuffle_epi32(X2, 0x4E); \
+ X3 = _mm_shuffle_epi32(X3, 0x39); \
+\
+ /* Operate on "rows". */ \
+ ARX(X3, X0, X1, 7) \
+ ARX(X2, X3, X0, 9) \
+ ARX(X1, X2, X3, 13) \
+ ARX(X0, X1, X2, 18) \
+\
+ /* Rearrange data. */ \
+ X1 = _mm_shuffle_epi32(X1, 0x39); \
+ X2 = _mm_shuffle_epi32(X2, 0x4E); \
+ X3 = _mm_shuffle_epi32(X3, 0x93);
+
+/**
+ * Apply the salsa20/8 core to the block provided in (X0 ... X3) ^ (Z0 ... Z3).
+ */
+#define SALSA20_8_XOR(in, out) \
+ { \
+ __m128i Y0 = X0 = _mm_xor_si128(X0, (in)[0]); \
+ __m128i Y1 = X1 = _mm_xor_si128(X1, (in)[1]); \
+ __m128i Y2 = X2 = _mm_xor_si128(X2, (in)[2]); \
+ __m128i Y3 = X3 = _mm_xor_si128(X3, (in)[3]); \
+ SALSA20_2ROUNDS \
+ SALSA20_2ROUNDS \
+ SALSA20_2ROUNDS \
+ SALSA20_2ROUNDS \
+ (out)[0] = X0 = _mm_add_epi32(X0, Y0); \
+ (out)[1] = X1 = _mm_add_epi32(X1, Y1); \
+ (out)[2] = X2 = _mm_add_epi32(X2, Y2); \
+ (out)[3] = X3 = _mm_add_epi32(X3, Y3); \
+ }
+
+/**
+ * blockmix_salsa8(Bin, Bout, r):
+ * Compute Bout = BlockMix_{salsa20/8, r}(Bin). The input Bin must be 128r
+ * bytes in length; the output Bout must also be the same size.
+ */
+static inline void
+blockmix_salsa8(const __m128i * Bin, __m128i * Bout, size_t r)
+{
+ __m128i X0, X1, X2, X3;
+ size_t i;
+
+ /* 1: X <-- B_{2r - 1} */
+ X0 = Bin[8 * r - 4];
+ X1 = Bin[8 * r - 3];
+ X2 = Bin[8 * r - 2];
+ X3 = Bin[8 * r - 1];
+
+ /* 3: X <-- H(X \xor B_i) */
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ SALSA20_8_XOR(Bin, Bout)
+
+ /* 2: for i = 0 to 2r - 1 do */
+ r--;
+ for (i = 0; i < r;) {
+ /* 3: X <-- H(X \xor B_i) */
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ SALSA20_8_XOR(&Bin[i * 8 + 4], &Bout[(r + i) * 4 + 4])
+
+ i++;
+
+ /* 3: X <-- H(X \xor B_i) */
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ SALSA20_8_XOR(&Bin[i * 8], &Bout[i * 4])
+ }
+
+ /* 3: X <-- H(X \xor B_i) */
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ SALSA20_8_XOR(&Bin[i * 8 + 4], &Bout[(r + i) * 4 + 4])
+}
+
+#define XOR4(in) \
+ X0 = _mm_xor_si128(X0, (in)[0]); \
+ X1 = _mm_xor_si128(X1, (in)[1]); \
+ X2 = _mm_xor_si128(X2, (in)[2]); \
+ X3 = _mm_xor_si128(X3, (in)[3]);
+
+#define XOR4_2(in1, in2) \
+ X0 = _mm_xor_si128((in1)[0], (in2)[0]); \
+ X1 = _mm_xor_si128((in1)[1], (in2)[1]); \
+ X2 = _mm_xor_si128((in1)[2], (in2)[2]); \
+ X3 = _mm_xor_si128((in1)[3], (in2)[3]);
+
+static inline uint32_t
+blockmix_salsa8_xor(const __m128i * Bin1, const __m128i * Bin2, __m128i * Bout,
+ size_t r)
+{
+ __m128i X0, X1, X2, X3;
+ size_t i;
+
+ /* 1: X <-- B_{2r - 1} */
+ XOR4_2(&Bin1[8 * r - 4], &Bin2[8 * r - 4])
+
+ /* 3: X <-- H(X \xor B_i) */
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ XOR4(Bin1)
+ SALSA20_8_XOR(Bin2, Bout)
+
+ /* 2: for i = 0 to 2r - 1 do */
+ r--;
+ for (i = 0; i < r;) {
+ /* 3: X <-- H(X \xor B_i) */
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ XOR4(&Bin1[i * 8 + 4])
+ SALSA20_8_XOR(&Bin2[i * 8 + 4], &Bout[(r + i) * 4 + 4])
+
+ i++;
+
+ /* 3: X <-- H(X \xor B_i) */
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ XOR4(&Bin1[i * 8])
+ SALSA20_8_XOR(&Bin2[i * 8], &Bout[i * 4])
+ }
+
+ /* 3: X <-- H(X \xor B_i) */
+ /* 4: Y_i <-- X */
+ /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */
+ XOR4(&Bin1[i * 8 + 4])
+ SALSA20_8_XOR(&Bin2[i * 8 + 4], &Bout[(r + i) * 4 + 4])
+
+ return _mm_cvtsi128_si32(X0);
+}
+
+#undef ARX
+#undef SALSA20_2ROUNDS
+#undef SALSA20_8_XOR
+#undef XOR4
+#undef XOR4_2
+
+/**
+ * integerify(B, r):
+ * Return the result of parsing B_{2r-1} as a little-endian integer.
+ */
+static inline uint32_t
+integerify(const void * B, size_t r)
+{
+ return *(const uint32_t *)((uintptr_t)(B) + (2 * r - 1) * 64);
+}
+
+/**
+ * smix(B, r, N, V, XY):
+ * Compute B = SMix_r(B, N). The input B must be 128r bytes in length;
+ * the temporary storage V must be 128rN bytes in length; the temporary
+ * storage XY must be 256r + 64 bytes in length. The value N must be a
+ * power of 2 greater than 1. The arrays B, V, and XY must be aligned to a
+ * multiple of 64 bytes.
+ */
+static void
+smix(uint8_t * B, size_t r, uint32_t N, void * V, void * XY)
+{
+ size_t s = 128 * r;
+ __m128i * X = (__m128i *) V, * Y;
+ uint32_t * X32 = (uint32_t *) V;
+ uint32_t i, j;
+ size_t k;
+
+ /* 1: X <-- B */
+ /* 3: V_i <-- X */
+ for (k = 0; k < 2 * r; k++) {
+ for (i = 0; i < 16; i++) {
+ X32[k * 16 + i] =
+ le32dec(&B[(k * 16 + (i * 5 % 16)) * 4]);
+ }
+ }
+
+ /* 2: for i = 0 to N - 1 do */
+ for (i = 1; i < N - 1; i += 2) {
+ /* 4: X <-- H(X) */
+ /* 3: V_i <-- X */
+ Y = (__m128i *)((uintptr_t)(V) + i * s);
+ blockmix_salsa8(X, Y, r);
+
+ /* 4: X <-- H(X) */
+ /* 3: V_i <-- X */
+ X = (__m128i *)((uintptr_t)(V) + (i + 1) * s);
+ blockmix_salsa8(Y, X, r);
+ }
+
+ /* 4: X <-- H(X) */
+ /* 3: V_i <-- X */
+ Y = (__m128i *)((uintptr_t)(V) + i * s);
+ blockmix_salsa8(X, Y, r);
+
+ /* 4: X <-- H(X) */
+ /* 3: V_i <-- X */
+ X = (__m128i *) XY;
+ blockmix_salsa8(Y, X, r);
+
+ X32 = (uint32_t *) XY;
+ Y = (__m128i *)((uintptr_t)(XY) + s);
+
+ /* 7: j <-- Integerify(X) mod N */
+ j = integerify(X, r) & (N - 1);
+
+ /* 6: for i = 0 to N - 1 do */
+ for (i = 0; i < N; i += 2) {
+ __m128i * V_j = (__m128i *)((uintptr_t)(V) + j * s);
+
+ /* 8: X <-- H(X \xor V_j) */
+ /* 7: j <-- Integerify(X) mod N */
+ j = blockmix_salsa8_xor(X, V_j, Y, r) & (N - 1);
+ V_j = (__m128i *)((uintptr_t)(V) + j * s);
+
+ /* 8: X <-- H(X \xor V_j) */
+ /* 7: j <-- Integerify(X) mod N */
+ j = blockmix_salsa8_xor(Y, V_j, X, r) & (N - 1);
+ }
+
+ /* 10: B' <-- X */
+ for (k = 0; k < 2 * r; k++) {
+ for (i = 0; i < 16; i++) {
+ le32enc(&B[(k * 16 + (i * 5 % 16)) * 4],
+ X32[k * 16 + i]);
+ }
+ }
+}
+
+/**
+ * escrypt_kdf(local, passwd, passwdlen, salt, saltlen,
+ * N, r, p, buf, buflen):
+ * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r,
+ * p, buflen) and write the result into buf. The parameters r, p, and buflen
+ * must satisfy r * p < 2^30 and buflen <= (2^32 - 1) * 32. The parameter N
+ * must be a power of 2 greater than 1.
+ *
+ * Return 0 on success; or -1 on error.
+ */
+int
+escrypt_kdf_sse(escrypt_local_t * local,
+ const uint8_t * passwd, size_t passwdlen,
+ const uint8_t * salt, size_t saltlen,
+ uint64_t N, uint32_t _r, uint32_t _p,
+ uint8_t * buf, size_t buflen)
+{
+ size_t B_size, V_size, XY_size, need;
+ uint8_t * B;
+ uint32_t * V, * XY;
+ size_t r = _r, p = _p;
+ uint32_t i;
+
+ /* Sanity-check parameters. */
+#if SIZE_MAX > UINT32_MAX
+ if (buflen > (((uint64_t)(1) << 32) - 1) * 32) {
+ errno = EFBIG;
+ return -1;
+ }
+#endif
+ if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) {
+ errno = EFBIG;
+ return -1;
+ }
+ if (N > UINT32_MAX) {
+ errno = EFBIG;
+ return -1;
+ }
+ if (((N & (N - 1)) != 0) || (N < 2)) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (r == 0 || p == 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ if ((r > SIZE_MAX / 128 / p) ||
+#if SIZE_MAX / 256 <= UINT32_MAX
+ (r > SIZE_MAX / 256) ||
+#endif
+ (N > SIZE_MAX / 128 / r)) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ /* Allocate memory. */
+ B_size = (size_t)128 * r * p;
+ V_size = (size_t)128 * r * N;
+ need = B_size + V_size;
+ if (need < V_size) {
+ errno = ENOMEM;
+ return -1;
+ }
+ XY_size = (size_t)256 * r + 64;
+ need += XY_size;
+ if (need < XY_size) {
+ errno = ENOMEM;
+ return -1;
+ }
+ if (local->size < need) {
+ if (free_region(local))
+ return -1; /* LCOV_EXCL_LINE */
+ if (!alloc_region(local, need))
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ B = (uint8_t *)local->aligned;
+ V = (uint32_t *)((uint8_t *)B + B_size);
+ XY = (uint32_t *)((uint8_t *)V + V_size);
+
+ /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */
+ PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, B_size);
+
+ /* 2: for i = 0 to p - 1 do */
+ for (i = 0; i < p; i++) {
+ /* 3: B_i <-- MF(B_i, N) */
+ smix(&B[(size_t)128 * i * r], r, (uint32_t) N, V, XY);
+ }
+
+ /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */
+ PBKDF2_SHA256(passwd, passwdlen, B, B_size, 1, buf, buflen);
+
+ /* Success! */
+ return 0;
+}
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sysendian.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sysendian.h
new file mode 100644
index 00000000..080aae8b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sysendian.h
@@ -0,0 +1,146 @@
+#ifndef sysendian_H
+#define sysendian_H
+
+#include <stdint.h>
+
+/* Avoid namespace collisions with BSD <sys/endian.h>. */
+#define be16dec scrypt_be16dec
+#define be16enc scrypt_be16enc
+#define be32dec scrypt_be32dec
+#define be32enc scrypt_be32enc
+#define be64dec scrypt_be64dec
+#define be64enc scrypt_be64enc
+#define le16dec scrypt_le16dec
+#define le16enc scrypt_le16enc
+#define le32dec scrypt_le32dec
+#define le32enc scrypt_le32enc
+#define le64dec scrypt_le64dec
+#define le64enc scrypt_le64enc
+
+static inline uint16_t
+be16dec(const void *pp)
+{
+ const uint8_t *p = (uint8_t const *)pp;
+
+ return ((uint16_t)(p[1]) + ((uint16_t)(p[0]) << 8));
+}
+
+static inline void
+be16enc(void *pp, uint16_t x)
+{
+ uint8_t * p = (uint8_t *)pp;
+
+ p[1] = x & 0xff;
+ p[0] = (x >> 8) & 0xff;
+}
+
+static inline uint32_t
+be32dec(const void *pp)
+{
+ const uint8_t *p = (uint8_t const *)pp;
+
+ return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
+ ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
+}
+
+static inline void
+be32enc(void *pp, uint32_t x)
+{
+ uint8_t * p = (uint8_t *)pp;
+
+ p[3] = x & 0xff;
+ p[2] = (x >> 8) & 0xff;
+ p[1] = (x >> 16) & 0xff;
+ p[0] = (x >> 24) & 0xff;
+}
+
+static inline uint64_t
+be64dec(const void *pp)
+{
+ const uint8_t *p = (uint8_t const *)pp;
+
+ return ((uint64_t)(p[7]) + ((uint64_t)(p[6]) << 8) +
+ ((uint64_t)(p[5]) << 16) + ((uint64_t)(p[4]) << 24) +
+ ((uint64_t)(p[3]) << 32) + ((uint64_t)(p[2]) << 40) +
+ ((uint64_t)(p[1]) << 48) + ((uint64_t)(p[0]) << 56));
+}
+
+static inline void
+be64enc(void *pp, uint64_t x)
+{
+ uint8_t * p = (uint8_t *)pp;
+
+ p[7] = x & 0xff;
+ p[6] = (x >> 8) & 0xff;
+ p[5] = (x >> 16) & 0xff;
+ p[4] = (x >> 24) & 0xff;
+ p[3] = (x >> 32) & 0xff;
+ p[2] = (x >> 40) & 0xff;
+ p[1] = (x >> 48) & 0xff;
+ p[0] = (x >> 56) & 0xff;
+}
+
+static inline uint16_t
+le16dec(const void *pp)
+{
+ const uint8_t *p = (uint8_t const *)pp;
+
+ return ((uint16_t)(p[0]) + ((uint16_t)(p[1]) << 8));
+}
+
+static inline void
+le16enc(void *pp, uint16_t x)
+{
+ uint8_t * p = (uint8_t *)pp;
+
+ p[0] = x & 0xff;
+ p[1] = (x >> 8) & 0xff;
+}
+
+static inline uint32_t
+le32dec(const void *pp)
+{
+ const uint8_t *p = (uint8_t const *)pp;
+
+ return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
+ ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
+}
+
+static inline void
+le32enc(void *pp, uint32_t x)
+{
+ uint8_t * p = (uint8_t *)pp;
+
+ p[0] = x & 0xff;
+ p[1] = (x >> 8) & 0xff;
+ p[2] = (x >> 16) & 0xff;
+ p[3] = (x >> 24) & 0xff;
+}
+
+static inline uint64_t
+le64dec(const void *pp)
+{
+ const uint8_t *p = (uint8_t const *)pp;
+
+ return ((uint64_t)(p[0]) + ((uint64_t)(p[1]) << 8) +
+ ((uint64_t)(p[2]) << 16) + ((uint64_t)(p[3]) << 24) +
+ ((uint64_t)(p[4]) << 32) + ((uint64_t)(p[5]) << 40) +
+ ((uint64_t)(p[6]) << 48) + ((uint64_t)(p[7]) << 56));
+}
+
+static inline void
+le64enc(void *pp, uint64_t x)
+{
+ uint8_t * p = (uint8_t *)pp;
+
+ p[0] = x & 0xff;
+ p[1] = (x >> 8) & 0xff;
+ p[2] = (x >> 16) & 0xff;
+ p[3] = (x >> 24) & 0xff;
+ p[4] = (x >> 32) & 0xff;
+ p[5] = (x >> 40) & 0xff;
+ p[6] = (x >> 48) & 0xff;
+ p[7] = (x >> 56) & 0xff;
+}
+
+#endif /* !_SYSENDIAN_H_ */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c
new file mode 100644
index 00000000..25d7397f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c
@@ -0,0 +1,34 @@
+
+#include "crypto_scalarmult.h"
+
+size_t
+crypto_scalarmult_bytes(void)
+{
+ return crypto_scalarmult_BYTES;
+}
+
+size_t
+crypto_scalarmult_scalarbytes(void)
+{
+ return crypto_scalarmult_SCALARBYTES;
+}
+
+const char *
+crypto_scalarmult_primitive(void)
+{
+ return crypto_scalarmult_PRIMITIVE;
+}
+
+int
+crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
+{
+ return crypto_scalarmult_curve25519_base(q, n);
+}
+
+int
+crypto_scalarmult(unsigned char *q, const unsigned char *n,
+ const unsigned char *p)
+{
+ return crypto_scalarmult_curve25519(q, n, p);
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h
new file mode 100644
index 00000000..5c9bba7e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h
@@ -0,0 +1,9 @@
+
+#include "crypto_scalarmult_curve25519.h"
+
+#define crypto_scalarmult_curve25519_implementation_name \
+ crypto_scalarmult_curve25519_donna_c64_implementation_name
+
+#define crypto_scalarmult crypto_scalarmult_curve25519
+#define crypto_scalarmult_base crypto_scalarmult_curve25519_base
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c
new file mode 100644
index 00000000..58a3f1c9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c
@@ -0,0 +1,13 @@
+
+#include "api.h"
+
+#ifdef HAVE_TI_MODE
+
+static const unsigned char basepoint[32] = {9};
+
+int crypto_scalarmult_base(unsigned char *q,const unsigned char *n)
+{
+ return crypto_scalarmult(q, n, basepoint);
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c
new file mode 100644
index 00000000..7da3e1c0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c
@@ -0,0 +1,456 @@
+/* Copyright 2008, Google Inc.
+ * All rights reserved.
+ *
+ * Code released into the public domain.
+ *
+ * curve25519-donna: Curve25519 elliptic curve, public key function
+ *
+ * http://code.google.com/p/curve25519-donna/
+ *
+ * Adam Langley <agl@imperialviolet.org>
+ * Parts optimised by floodyberry
+ * Derived from public domain C code by Daniel J. Bernstein <djb@cr.yp.to>
+ *
+ * More information about curve25519 can be found here
+ * http://cr.yp.to/ecdh.html
+ *
+ * djb's sample implementation of curve25519 is written in a special assembly
+ * language called qhasm and uses the floating point registers.
+ *
+ * This is, almost, a clean room reimplementation from the curve25519 paper. It
+ * uses many of the tricks described therein. Only the crecip function is taken
+ * from the sample implementation.
+ */
+
+#include <string.h>
+#include <stdint.h>
+#include "api.h"
+
+#ifdef HAVE_TI_MODE
+
+typedef uint8_t u8;
+typedef uint64_t limb;
+typedef limb felem[5];
+// This is a special gcc mode for 128-bit integers. It's implemented on 64-bit
+// platforms only as far as I know.
+typedef unsigned uint128_t __attribute__((mode(TI)));
+
+#undef force_inline
+#define force_inline __attribute__((always_inline))
+
+/* Sum two numbers: output += in */
+static inline void force_inline
+fsum(limb *output, const limb *in) {
+ output[0] += in[0];
+ output[1] += in[1];
+ output[2] += in[2];
+ output[3] += in[3];
+ output[4] += in[4];
+}
+
+/* Find the difference of two numbers: output = in - output
+ * (note the order of the arguments!)
+ *
+ * Assumes that out[i] < 2**52
+ * On return, out[i] < 2**55
+ */
+static inline void force_inline
+fdifference_backwards(felem out, const felem in) {
+ /* 152 is 19 << 3 */
+ static const limb two54m152 = (((limb)1) << 54) - 152;
+ static const limb two54m8 = (((limb)1) << 54) - 8;
+
+ out[0] = in[0] + two54m152 - out[0];
+ out[1] = in[1] + two54m8 - out[1];
+ out[2] = in[2] + two54m8 - out[2];
+ out[3] = in[3] + two54m8 - out[3];
+ out[4] = in[4] + two54m8 - out[4];
+}
+
+/* Multiply a number by a scalar: output = in * scalar */
+static inline void force_inline
+fscalar_product(felem output, const felem in, const limb scalar) {
+ uint128_t a;
+
+ a = ((uint128_t) in[0]) * scalar;
+ output[0] = ((limb)a) & 0x7ffffffffffff;
+
+ a = ((uint128_t) in[1]) * scalar + ((limb) (a >> 51));
+ output[1] = ((limb)a) & 0x7ffffffffffff;
+
+ a = ((uint128_t) in[2]) * scalar + ((limb) (a >> 51));
+ output[2] = ((limb)a) & 0x7ffffffffffff;
+
+ a = ((uint128_t) in[3]) * scalar + ((limb) (a >> 51));
+ output[3] = ((limb)a) & 0x7ffffffffffff;
+
+ a = ((uint128_t) in[4]) * scalar + ((limb) (a >> 51));
+ output[4] = ((limb)a) & 0x7ffffffffffff;
+
+ output[0] += (a >> 51) * 19;
+}
+
+/* Multiply two numbers: output = in2 * in
+ *
+ * output must be distinct to both inputs. The inputs are reduced coefficient
+ * form, the output is not.
+ *
+ * Assumes that in[i] < 2**55 and likewise for in2.
+ * On return, output[i] < 2**52
+ */
+static inline void force_inline
+fmul(felem output, const felem in2, const felem in) {
+ uint128_t t[5];
+ limb r0,r1,r2,r3,r4,s0,s1,s2,s3,s4,c;
+
+ r0 = in[0];
+ r1 = in[1];
+ r2 = in[2];
+ r3 = in[3];
+ r4 = in[4];
+
+ s0 = in2[0];
+ s1 = in2[1];
+ s2 = in2[2];
+ s3 = in2[3];
+ s4 = in2[4];
+
+ t[0] = ((uint128_t) r0) * s0;
+ t[1] = ((uint128_t) r0) * s1 + ((uint128_t) r1) * s0;
+ t[2] = ((uint128_t) r0) * s2 + ((uint128_t) r2) * s0 + ((uint128_t) r1) * s1;
+ t[3] = ((uint128_t) r0) * s3 + ((uint128_t) r3) * s0 + ((uint128_t) r1) * s2 + ((uint128_t) r2) * s1;
+ t[4] = ((uint128_t) r0) * s4 + ((uint128_t) r4) * s0 + ((uint128_t) r3) * s1 + ((uint128_t) r1) * s3 + ((uint128_t) r2) * s2;
+
+ r4 *= 19;
+ r1 *= 19;
+ r2 *= 19;
+ r3 *= 19;
+
+ t[0] += ((uint128_t) r4) * s1 + ((uint128_t) r1) * s4 + ((uint128_t) r2) * s3 + ((uint128_t) r3) * s2;
+ t[1] += ((uint128_t) r4) * s2 + ((uint128_t) r2) * s4 + ((uint128_t) r3) * s3;
+ t[2] += ((uint128_t) r4) * s3 + ((uint128_t) r3) * s4;
+ t[3] += ((uint128_t) r4) * s4;
+
+ r0 = (limb)t[0] & 0x7ffffffffffff; c = (limb)(t[0] >> 51);
+ t[1] += c; r1 = (limb)t[1] & 0x7ffffffffffff; c = (limb)(t[1] >> 51);
+ t[2] += c; r2 = (limb)t[2] & 0x7ffffffffffff; c = (limb)(t[2] >> 51);
+ t[3] += c; r3 = (limb)t[3] & 0x7ffffffffffff; c = (limb)(t[3] >> 51);
+ t[4] += c; r4 = (limb)t[4] & 0x7ffffffffffff; c = (limb)(t[4] >> 51);
+ r0 += c * 19; c = r0 >> 51; r0 = r0 & 0x7ffffffffffff;
+ r1 += c; c = r1 >> 51; r1 = r1 & 0x7ffffffffffff;
+ r2 += c;
+
+ output[0] = r0;
+ output[1] = r1;
+ output[2] = r2;
+ output[3] = r3;
+ output[4] = r4;
+}
+
+static inline void force_inline
+fsquare_times(felem output, const felem in, limb count) {
+ uint128_t t[5];
+ limb r0,r1,r2,r3,r4,c;
+ limb d0,d1,d2,d4,d419;
+
+ r0 = in[0];
+ r1 = in[1];
+ r2 = in[2];
+ r3 = in[3];
+ r4 = in[4];
+
+ do {
+ d0 = r0 * 2;
+ d1 = r1 * 2;
+ d2 = r2 * 2 * 19;
+ d419 = r4 * 19;
+ d4 = d419 * 2;
+
+ t[0] = ((uint128_t) r0) * r0 + ((uint128_t) d4) * r1 + (((uint128_t) d2) * (r3 ));
+ t[1] = ((uint128_t) d0) * r1 + ((uint128_t) d4) * r2 + (((uint128_t) r3) * (r3 * 19));
+ t[2] = ((uint128_t) d0) * r2 + ((uint128_t) r1) * r1 + (((uint128_t) d4) * (r3 ));
+ t[3] = ((uint128_t) d0) * r3 + ((uint128_t) d1) * r2 + (((uint128_t) r4) * (d419 ));
+ t[4] = ((uint128_t) d0) * r4 + ((uint128_t) d1) * r3 + (((uint128_t) r2) * (r2 ));
+
+ r0 = (limb)t[0] & 0x7ffffffffffff; c = (limb)(t[0] >> 51);
+ t[1] += c; r1 = (limb)t[1] & 0x7ffffffffffff; c = (limb)(t[1] >> 51);
+ t[2] += c; r2 = (limb)t[2] & 0x7ffffffffffff; c = (limb)(t[2] >> 51);
+ t[3] += c; r3 = (limb)t[3] & 0x7ffffffffffff; c = (limb)(t[3] >> 51);
+ t[4] += c; r4 = (limb)t[4] & 0x7ffffffffffff; c = (limb)(t[4] >> 51);
+ r0 += c * 19; c = r0 >> 51; r0 = r0 & 0x7ffffffffffff;
+ r1 += c; c = r1 >> 51; r1 = r1 & 0x7ffffffffffff;
+ r2 += c;
+ } while(--count);
+
+ output[0] = r0;
+ output[1] = r1;
+ output[2] = r2;
+ output[3] = r3;
+ output[4] = r4;
+}
+
+#if !defined(CPU_ALIGNED_ACCESS_REQUIRED) && defined(NATIVE_LITTLE_ENDIAN)
+# define load_limb(p) (*((const limb *) (p)))
+# define store_limb(p, v) (*((limb *) (p)) = (v))
+#else
+static inline limb force_inline
+load_limb(const u8 *in) {
+ return
+ ((limb)in[0]) |
+ (((limb)in[1]) << 8) |
+ (((limb)in[2]) << 16) |
+ (((limb)in[3]) << 24) |
+ (((limb)in[4]) << 32) |
+ (((limb)in[5]) << 40) |
+ (((limb)in[6]) << 48) |
+ (((limb)in[7]) << 56);
+}
+
+static inline void force_inline
+store_limb(u8 *out, limb in) {
+ out[0] = in & 0xff;
+ out[1] = (in >> 8) & 0xff;
+ out[2] = (in >> 16) & 0xff;
+ out[3] = (in >> 24) & 0xff;
+ out[4] = (in >> 32) & 0xff;
+ out[5] = (in >> 40) & 0xff;
+ out[6] = (in >> 48) & 0xff;
+ out[7] = (in >> 56) & 0xff;
+}
+#endif
+
+/* Take a little-endian, 32-byte number and expand it into polynomial form */
+static void
+fexpand(limb *output, const u8 *in) {
+ output[0] = load_limb(in) & 0x7ffffffffffff;
+ output[1] = (load_limb(in+6) >> 3) & 0x7ffffffffffff;
+ output[2] = (load_limb(in+12) >> 6) & 0x7ffffffffffff;
+ output[3] = (load_limb(in+19) >> 1) & 0x7ffffffffffff;
+ output[4] = (load_limb(in+24) >> 12) & 0x7ffffffffffff;
+}
+
+/* Take a fully reduced polynomial form number and contract it into a
+ * little-endian, 32-byte array
+ */
+static void
+fcontract(u8 *output, const felem input) {
+ uint128_t t[5];
+
+ t[0] = input[0];
+ t[1] = input[1];
+ t[2] = input[2];
+ t[3] = input[3];
+ t[4] = input[4];
+
+ t[1] += t[0] >> 51; t[0] &= 0x7ffffffffffff;
+ t[2] += t[1] >> 51; t[1] &= 0x7ffffffffffff;
+ t[3] += t[2] >> 51; t[2] &= 0x7ffffffffffff;
+ t[4] += t[3] >> 51; t[3] &= 0x7ffffffffffff;
+ t[0] += 19 * (t[4] >> 51); t[4] &= 0x7ffffffffffff;
+
+ t[1] += t[0] >> 51; t[0] &= 0x7ffffffffffff;
+ t[2] += t[1] >> 51; t[1] &= 0x7ffffffffffff;
+ t[3] += t[2] >> 51; t[2] &= 0x7ffffffffffff;
+ t[4] += t[3] >> 51; t[3] &= 0x7ffffffffffff;
+ t[0] += 19 * (t[4] >> 51); t[4] &= 0x7ffffffffffff;
+
+ /* now t is between 0 and 2^255-1, properly carried. */
+ /* case 1: between 0 and 2^255-20. case 2: between 2^255-19 and 2^255-1. */
+
+ t[0] += 19;
+
+ t[1] += t[0] >> 51; t[0] &= 0x7ffffffffffff;
+ t[2] += t[1] >> 51; t[1] &= 0x7ffffffffffff;
+ t[3] += t[2] >> 51; t[2] &= 0x7ffffffffffff;
+ t[4] += t[3] >> 51; t[3] &= 0x7ffffffffffff;
+ t[0] += 19 * (t[4] >> 51); t[4] &= 0x7ffffffffffff;
+
+ /* now between 19 and 2^255-1 in both cases, and offset by 19. */
+
+ t[0] += 0x8000000000000 - 19;
+ t[1] += 0x8000000000000 - 1;
+ t[2] += 0x8000000000000 - 1;
+ t[3] += 0x8000000000000 - 1;
+ t[4] += 0x8000000000000 - 1;
+
+ /* now between 2^255 and 2^256-20, and offset by 2^255. */
+
+ t[1] += t[0] >> 51; t[0] &= 0x7ffffffffffff;
+ t[2] += t[1] >> 51; t[1] &= 0x7ffffffffffff;
+ t[3] += t[2] >> 51; t[2] &= 0x7ffffffffffff;
+ t[4] += t[3] >> 51; t[3] &= 0x7ffffffffffff;
+ t[4] &= 0x7ffffffffffff;
+
+ store_limb(output, t[0] | (t[1] << 51));
+ store_limb(output + 8, (t[1] >> 13) | (t[2] << 38));
+ store_limb(output + 16, (t[2] >> 26) | (t[3] << 25));
+ store_limb(output + 24, (t[3] >> 39) | (t[4] << 12));
+}
+
+/* Input: Q, Q', Q-Q'
+ * Output: 2Q, Q+Q'
+ *
+ * x2 z3: long form
+ * x3 z3: long form
+ * x z: short form, destroyed
+ * xprime zprime: short form, destroyed
+ * qmqp: short form, preserved
+ */
+static void
+fmonty(limb *x2, limb *z2, /* output 2Q */
+ limb *x3, limb *z3, /* output Q + Q' */
+ limb *x, limb *z, /* input Q */
+ limb *xprime, limb *zprime, /* input Q' */
+ const limb *qmqp /* input Q - Q' */) {
+ limb origx[5], origxprime[5], zzz[5], xx[5], zz[5], xxprime[5],
+ zzprime[5], zzzprime[5];
+
+ memcpy(origx, x, 5 * sizeof(limb));
+ fsum(x, z);
+ fdifference_backwards(z, origx); // does x - z
+
+ memcpy(origxprime, xprime, sizeof(limb) * 5);
+ fsum(xprime, zprime);
+ fdifference_backwards(zprime, origxprime);
+ fmul(xxprime, xprime, z);
+ fmul(zzprime, x, zprime);
+ memcpy(origxprime, xxprime, sizeof(limb) * 5);
+ fsum(xxprime, zzprime);
+ fdifference_backwards(zzprime, origxprime);
+ fsquare_times(x3, xxprime, 1);
+ fsquare_times(zzzprime, zzprime, 1);
+ fmul(z3, zzzprime, qmqp);
+
+ fsquare_times(xx, x, 1);
+ fsquare_times(zz, z, 1);
+ fmul(x2, xx, zz);
+ fdifference_backwards(zz, xx); // does zz = xx - zz
+ fscalar_product(zzz, zz, 121665);
+ fsum(zzz, xx);
+ fmul(z2, zz, zzz);
+}
+
+// -----------------------------------------------------------------------------
+// Maybe swap the contents of two limb arrays (@a and @b), each @len elements
+// long. Perform the swap iff @swap is non-zero.
+//
+// This function performs the swap without leaking any side-channel
+// information.
+// -----------------------------------------------------------------------------
+static void
+swap_conditional(limb a[5], limb b[5], limb iswap) {
+ unsigned i;
+ const limb swap = -iswap;
+
+ for (i = 0; i < 5; ++i) {
+ const limb x = swap & (a[i] ^ b[i]);
+ a[i] ^= x;
+ b[i] ^= x;
+ }
+}
+
+/* Calculates nQ where Q is the x-coordinate of a point on the curve
+ *
+ * resultx/resultz: the x coordinate of the resulting curve point (short form)
+ * n: a little endian, 32-byte number
+ * q: a point of the curve (short form)
+ */
+static void
+cmult(limb *resultx, limb *resultz, const u8 *n, const limb *q) {
+ limb a[5] = {0}, b[5] = {1}, c[5] = {1}, d[5] = {0};
+ limb *nqpqx = a, *nqpqz = b, *nqx = c, *nqz = d, *t;
+ limb e[5] = {0}, f[5] = {1}, g[5] = {0}, h[5] = {1};
+ limb *nqpqx2 = e, *nqpqz2 = f, *nqx2 = g, *nqz2 = h;
+
+ unsigned i, j;
+
+ memcpy(nqpqx, q, sizeof(limb) * 5);
+
+ for (i = 0; i < 32; ++i) {
+ u8 byte = n[31 - i];
+ for (j = 0; j < 8; ++j) {
+ const limb bit = byte >> 7;
+
+ swap_conditional(nqx, nqpqx, bit);
+ swap_conditional(nqz, nqpqz, bit);
+ fmonty(nqx2, nqz2,
+ nqpqx2, nqpqz2,
+ nqx, nqz,
+ nqpqx, nqpqz,
+ q);
+ swap_conditional(nqx2, nqpqx2, bit);
+ swap_conditional(nqz2, nqpqz2, bit);
+
+ t = nqx;
+ nqx = nqx2;
+ nqx2 = t;
+ t = nqz;
+ nqz = nqz2;
+ nqz2 = t;
+ t = nqpqx;
+ nqpqx = nqpqx2;
+ nqpqx2 = t;
+ t = nqpqz;
+ nqpqz = nqpqz2;
+ nqpqz2 = t;
+
+ byte <<= 1;
+ }
+ }
+
+ memcpy(resultx, nqx, sizeof(limb) * 5);
+ memcpy(resultz, nqz, sizeof(limb) * 5);
+}
+
+
+// -----------------------------------------------------------------------------
+// Shamelessly copied from djb's code, tightened a little
+// -----------------------------------------------------------------------------
+static void
+crecip(felem out, const felem z) {
+ felem a,t0,b,c;
+
+ /* 2 */ fsquare_times(a, z, 1); // a = 2
+ /* 8 */ fsquare_times(t0, a, 2);
+ /* 9 */ fmul(b, t0, z); // b = 9
+ /* 11 */ fmul(a, b, a); // a = 11
+ /* 22 */ fsquare_times(t0, a, 1);
+ /* 2^5 - 2^0 = 31 */ fmul(b, t0, b);
+ /* 2^10 - 2^5 */ fsquare_times(t0, b, 5);
+ /* 2^10 - 2^0 */ fmul(b, t0, b);
+ /* 2^20 - 2^10 */ fsquare_times(t0, b, 10);
+ /* 2^20 - 2^0 */ fmul(c, t0, b);
+ /* 2^40 - 2^20 */ fsquare_times(t0, c, 20);
+ /* 2^40 - 2^0 */ fmul(t0, t0, c);
+ /* 2^50 - 2^10 */ fsquare_times(t0, t0, 10);
+ /* 2^50 - 2^0 */ fmul(b, t0, b);
+ /* 2^100 - 2^50 */ fsquare_times(t0, b, 50);
+ /* 2^100 - 2^0 */ fmul(c, t0, b);
+ /* 2^200 - 2^100 */ fsquare_times(t0, c, 100);
+ /* 2^200 - 2^0 */ fmul(t0, t0, c);
+ /* 2^250 - 2^50 */ fsquare_times(t0, t0, 50);
+ /* 2^250 - 2^0 */ fmul(t0, t0, b);
+ /* 2^255 - 2^5 */ fsquare_times(t0, t0, 5);
+ /* 2^255 - 21 */ fmul(out, t0, a);
+}
+
+int
+crypto_scalarmult(u8 *mypublic, const u8 *secret, const u8 *basepoint) {
+ limb bp[5], x[5], z[5], zmone[5];
+ uint8_t e[32];
+ int i;
+
+ for (i = 0;i < 32;++i) e[i] = secret[i];
+ e[0] &= 248;
+ e[31] &= 127;
+ e[31] |= 64;
+
+ fexpand(bp, basepoint);
+ cmult(x, z, e, bp);
+ crecip(zmone, z);
+ fmul(z, x, zmone);
+ fcontract(mypublic, z);
+ return 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/api.h
new file mode 100644
index 00000000..40a42065
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/api.h
@@ -0,0 +1,5 @@
+
+#include "crypto_scalarmult_curve25519.h"
+
+#define crypto_scalarmult crypto_scalarmult_curve25519
+#define crypto_scalarmult_base crypto_scalarmult_curve25519_base
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c
new file mode 100644
index 00000000..ce123ddf
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c
@@ -0,0 +1,14 @@
+
+#include "api.h"
+#include "crypto_scalarmult.h"
+
+#ifndef HAVE_TI_MODE
+
+static const unsigned char basepoint[32] = {9};
+
+int crypto_scalarmult_base(unsigned char *q,const unsigned char *n)
+{
+ return crypto_scalarmult(q,n,basepoint);
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe.h
new file mode 100644
index 00000000..05671205
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe.h
@@ -0,0 +1,44 @@
+#ifndef FE_H
+#define FE_H
+
+#include "crypto_int32.h"
+
+typedef crypto_int32 fe[10];
+
+/*
+fe means field element.
+Here the field is \Z/(2^255-19).
+An element t, entries t[0]...t[9], represents the integer
+t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
+Bounds on each t[i] vary depending on context.
+*/
+
+#define fe_frombytes crypto_scalarmult_curve25519_ref10_fe_frombytes
+#define fe_tobytes crypto_scalarmult_curve25519_ref10_fe_tobytes
+#define fe_copy crypto_scalarmult_curve25519_ref10_fe_copy
+#define fe_0 crypto_scalarmult_curve25519_ref10_fe_0
+#define fe_1 crypto_scalarmult_curve25519_ref10_fe_1
+#define fe_cswap crypto_scalarmult_curve25519_ref10_fe_cswap
+#define fe_add crypto_scalarmult_curve25519_ref10_fe_add
+#define fe_sub crypto_scalarmult_curve25519_ref10_fe_sub
+#define fe_mul crypto_scalarmult_curve25519_ref10_fe_mul
+#define fe_sq crypto_scalarmult_curve25519_ref10_fe_sq
+#define fe_mul121666 crypto_scalarmult_curve25519_ref10_fe_mul121666
+#define fe_invert crypto_scalarmult_curve25519_ref10_fe_invert
+
+extern void fe_frombytes(fe,const unsigned char *);
+extern void fe_tobytes(unsigned char *,fe);
+
+extern void fe_copy(fe,fe);
+extern void fe_0(fe);
+extern void fe_1(fe);
+extern void fe_cswap(fe,fe,unsigned int);
+
+extern void fe_add(fe,fe,fe);
+extern void fe_sub(fe,fe,fe);
+extern void fe_mul(fe,fe,fe);
+extern void fe_sq(fe,fe);
+extern void fe_mul121666(fe,fe);
+extern void fe_invert(fe,fe);
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c
new file mode 100644
index 00000000..f351eea9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c
@@ -0,0 +1,23 @@
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+h = 0
+*/
+
+void fe_0(fe h)
+{
+ h[0] = 0;
+ h[1] = 0;
+ h[2] = 0;
+ h[3] = 0;
+ h[4] = 0;
+ h[5] = 0;
+ h[6] = 0;
+ h[7] = 0;
+ h[8] = 0;
+ h[9] = 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c
new file mode 100644
index 00000000..3ef13aa6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c
@@ -0,0 +1,23 @@
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+h = 1
+*/
+
+void fe_1(fe h)
+{
+ h[0] = 1;
+ h[1] = 0;
+ h[2] = 0;
+ h[3] = 0;
+ h[4] = 0;
+ h[5] = 0;
+ h[6] = 0;
+ h[7] = 0;
+ h[8] = 0;
+ h[9] = 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_add_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_add_curve25519_ref10.c
new file mode 100644
index 00000000..488805b8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_add_curve25519_ref10.c
@@ -0,0 +1,61 @@
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+h = f + g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+void fe_add(fe h,fe f,fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 h0 = f0 + g0;
+ crypto_int32 h1 = f1 + g1;
+ crypto_int32 h2 = f2 + g2;
+ crypto_int32 h3 = f3 + g3;
+ crypto_int32 h4 = f4 + g4;
+ crypto_int32 h5 = f5 + g5;
+ crypto_int32 h6 = f6 + g6;
+ crypto_int32 h7 = f7 + g7;
+ crypto_int32 h8 = f8 + g8;
+ crypto_int32 h9 = f9 + g9;
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c
new file mode 100644
index 00000000..2f6a5f53
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c
@@ -0,0 +1,33 @@
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+h = f
+*/
+
+void fe_copy(fe h,fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ h[0] = f0;
+ h[1] = f1;
+ h[2] = f2;
+ h[3] = f3;
+ h[4] = f4;
+ h[5] = f5;
+ h[6] = f6;
+ h[7] = f7;
+ h[8] = f8;
+ h[9] = f9;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c
new file mode 100644
index 00000000..f460674e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c
@@ -0,0 +1,77 @@
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+Replace (f,g) with (g,f) if b == 1;
+replace (f,g) with (f,g) if b == 0.
+
+Preconditions: b in {0,1}.
+*/
+
+void fe_cswap(fe f,fe g,unsigned int b)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 x0 = f0 ^ g0;
+ crypto_int32 x1 = f1 ^ g1;
+ crypto_int32 x2 = f2 ^ g2;
+ crypto_int32 x3 = f3 ^ g3;
+ crypto_int32 x4 = f4 ^ g4;
+ crypto_int32 x5 = f5 ^ g5;
+ crypto_int32 x6 = f6 ^ g6;
+ crypto_int32 x7 = f7 ^ g7;
+ crypto_int32 x8 = f8 ^ g8;
+ crypto_int32 x9 = f9 ^ g9;
+ b = -b;
+ x0 &= b;
+ x1 &= b;
+ x2 &= b;
+ x3 &= b;
+ x4 &= b;
+ x5 &= b;
+ x6 &= b;
+ x7 &= b;
+ x8 &= b;
+ x9 &= b;
+ f[0] = f0 ^ x0;
+ f[1] = f1 ^ x1;
+ f[2] = f2 ^ x2;
+ f[3] = f3 ^ x3;
+ f[4] = f4 ^ x4;
+ f[5] = f5 ^ x5;
+ f[6] = f6 ^ x6;
+ f[7] = f7 ^ x7;
+ f[8] = f8 ^ x8;
+ f[9] = f9 ^ x9;
+ g[0] = g0 ^ x0;
+ g[1] = g1 ^ x1;
+ g[2] = g2 ^ x2;
+ g[3] = g3 ^ x3;
+ g[4] = g4 ^ x4;
+ g[5] = g5 ^ x5;
+ g[6] = g6 ^ x6;
+ g[7] = g7 ^ x7;
+ g[8] = g8 ^ x8;
+ g[9] = g9 ^ x9;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c
new file mode 100644
index 00000000..f5d92efc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c
@@ -0,0 +1,73 @@
+#include "fe.h"
+#include "crypto_int64.h"
+#include "crypto_uint64.h"
+
+#ifndef HAVE_TI_MODE
+
+static crypto_uint64 load_3(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ return result;
+}
+
+static crypto_uint64 load_4(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ result |= ((crypto_uint64) in[3]) << 24;
+ return result;
+}
+
+void fe_frombytes(fe h,const unsigned char *s)
+{
+ crypto_int64 h0 = load_4(s);
+ crypto_int64 h1 = load_3(s + 4) << 6;
+ crypto_int64 h2 = load_3(s + 7) << 5;
+ crypto_int64 h3 = load_3(s + 10) << 3;
+ crypto_int64 h4 = load_3(s + 13) << 2;
+ crypto_int64 h5 = load_4(s + 16);
+ crypto_int64 h6 = load_3(s + 20) << 7;
+ crypto_int64 h7 = load_3(s + 23) << 5;
+ crypto_int64 h8 = load_3(s + 26) << 4;
+ crypto_int64 h9 = (load_3(s + 29) & 8388607) << 2;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c
new file mode 100644
index 00000000..764bf69f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c
@@ -0,0 +1,18 @@
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+void fe_invert(fe out,fe z)
+{
+ fe t0;
+ fe t1;
+ fe t2;
+ fe t3;
+ int i;
+
+#include "pow225521.h"
+
+ return;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul121666_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul121666_curve25519_ref10.c
new file mode 100644
index 00000000..7b222e1a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul121666_curve25519_ref10.c
@@ -0,0 +1,74 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+h = f * 121666
+Can overlap h with f.
+
+Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+*/
+
+void fe_mul121666(fe h,fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int64 h0 = f0 * (crypto_int64) 121666;
+ crypto_int64 h1 = f1 * (crypto_int64) 121666;
+ crypto_int64 h2 = f2 * (crypto_int64) 121666;
+ crypto_int64 h3 = f3 * (crypto_int64) 121666;
+ crypto_int64 h4 = f4 * (crypto_int64) 121666;
+ crypto_int64 h5 = f5 * (crypto_int64) 121666;
+ crypto_int64 h6 = f6 * (crypto_int64) 121666;
+ crypto_int64 h7 = f7 * (crypto_int64) 121666;
+ crypto_int64 h8 = f8 * (crypto_int64) 121666;
+ crypto_int64 h9 = f9 * (crypto_int64) 121666;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul_curve25519_ref10.c
new file mode 100644
index 00000000..96772b9c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul_curve25519_ref10.c
@@ -0,0 +1,257 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+h = f * g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+ |g| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+*/
+
+/*
+Notes on implementation strategy:
+
+Using schoolbook multiplication.
+Karatsuba would save a little in some cost models.
+
+Most multiplications by 2 and 19 are 32-bit precomputations;
+cheaper than 64-bit postcomputations.
+
+There is one remaining multiplication by 19 in the carry chain;
+one *19 precomputation can be merged into this,
+but the resulting data flow is considerably less clean.
+
+There are 12 carries below.
+10 of them are 2-way parallelizable and vectorizable.
+Can get away with 11 carries, but then data flow is much deeper.
+
+With tighter constraints on inputs can squeeze carries into int32.
+*/
+
+void fe_mul(fe h,fe f,fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 g1_19 = 19 * g1; /* 1.4*2^29 */
+ crypto_int32 g2_19 = 19 * g2; /* 1.4*2^30; still ok */
+ crypto_int32 g3_19 = 19 * g3;
+ crypto_int32 g4_19 = 19 * g4;
+ crypto_int32 g5_19 = 19 * g5;
+ crypto_int32 g6_19 = 19 * g6;
+ crypto_int32 g7_19 = 19 * g7;
+ crypto_int32 g8_19 = 19 * g8;
+ crypto_int32 g9_19 = 19 * g9;
+ crypto_int32 f1_2 = 2 * f1;
+ crypto_int32 f3_2 = 2 * f3;
+ crypto_int32 f5_2 = 2 * f5;
+ crypto_int32 f7_2 = 2 * f7;
+ crypto_int32 f9_2 = 2 * f9;
+ crypto_int64 f0g0 = f0 * (crypto_int64) g0;
+ crypto_int64 f0g1 = f0 * (crypto_int64) g1;
+ crypto_int64 f0g2 = f0 * (crypto_int64) g2;
+ crypto_int64 f0g3 = f0 * (crypto_int64) g3;
+ crypto_int64 f0g4 = f0 * (crypto_int64) g4;
+ crypto_int64 f0g5 = f0 * (crypto_int64) g5;
+ crypto_int64 f0g6 = f0 * (crypto_int64) g6;
+ crypto_int64 f0g7 = f0 * (crypto_int64) g7;
+ crypto_int64 f0g8 = f0 * (crypto_int64) g8;
+ crypto_int64 f0g9 = f0 * (crypto_int64) g9;
+ crypto_int64 f1g0 = f1 * (crypto_int64) g0;
+ crypto_int64 f1g1_2 = f1_2 * (crypto_int64) g1;
+ crypto_int64 f1g2 = f1 * (crypto_int64) g2;
+ crypto_int64 f1g3_2 = f1_2 * (crypto_int64) g3;
+ crypto_int64 f1g4 = f1 * (crypto_int64) g4;
+ crypto_int64 f1g5_2 = f1_2 * (crypto_int64) g5;
+ crypto_int64 f1g6 = f1 * (crypto_int64) g6;
+ crypto_int64 f1g7_2 = f1_2 * (crypto_int64) g7;
+ crypto_int64 f1g8 = f1 * (crypto_int64) g8;
+ crypto_int64 f1g9_38 = f1_2 * (crypto_int64) g9_19;
+ crypto_int64 f2g0 = f2 * (crypto_int64) g0;
+ crypto_int64 f2g1 = f2 * (crypto_int64) g1;
+ crypto_int64 f2g2 = f2 * (crypto_int64) g2;
+ crypto_int64 f2g3 = f2 * (crypto_int64) g3;
+ crypto_int64 f2g4 = f2 * (crypto_int64) g4;
+ crypto_int64 f2g5 = f2 * (crypto_int64) g5;
+ crypto_int64 f2g6 = f2 * (crypto_int64) g6;
+ crypto_int64 f2g7 = f2 * (crypto_int64) g7;
+ crypto_int64 f2g8_19 = f2 * (crypto_int64) g8_19;
+ crypto_int64 f2g9_19 = f2 * (crypto_int64) g9_19;
+ crypto_int64 f3g0 = f3 * (crypto_int64) g0;
+ crypto_int64 f3g1_2 = f3_2 * (crypto_int64) g1;
+ crypto_int64 f3g2 = f3 * (crypto_int64) g2;
+ crypto_int64 f3g3_2 = f3_2 * (crypto_int64) g3;
+ crypto_int64 f3g4 = f3 * (crypto_int64) g4;
+ crypto_int64 f3g5_2 = f3_2 * (crypto_int64) g5;
+ crypto_int64 f3g6 = f3 * (crypto_int64) g6;
+ crypto_int64 f3g7_38 = f3_2 * (crypto_int64) g7_19;
+ crypto_int64 f3g8_19 = f3 * (crypto_int64) g8_19;
+ crypto_int64 f3g9_38 = f3_2 * (crypto_int64) g9_19;
+ crypto_int64 f4g0 = f4 * (crypto_int64) g0;
+ crypto_int64 f4g1 = f4 * (crypto_int64) g1;
+ crypto_int64 f4g2 = f4 * (crypto_int64) g2;
+ crypto_int64 f4g3 = f4 * (crypto_int64) g3;
+ crypto_int64 f4g4 = f4 * (crypto_int64) g4;
+ crypto_int64 f4g5 = f4 * (crypto_int64) g5;
+ crypto_int64 f4g6_19 = f4 * (crypto_int64) g6_19;
+ crypto_int64 f4g7_19 = f4 * (crypto_int64) g7_19;
+ crypto_int64 f4g8_19 = f4 * (crypto_int64) g8_19;
+ crypto_int64 f4g9_19 = f4 * (crypto_int64) g9_19;
+ crypto_int64 f5g0 = f5 * (crypto_int64) g0;
+ crypto_int64 f5g1_2 = f5_2 * (crypto_int64) g1;
+ crypto_int64 f5g2 = f5 * (crypto_int64) g2;
+ crypto_int64 f5g3_2 = f5_2 * (crypto_int64) g3;
+ crypto_int64 f5g4 = f5 * (crypto_int64) g4;
+ crypto_int64 f5g5_38 = f5_2 * (crypto_int64) g5_19;
+ crypto_int64 f5g6_19 = f5 * (crypto_int64) g6_19;
+ crypto_int64 f5g7_38 = f5_2 * (crypto_int64) g7_19;
+ crypto_int64 f5g8_19 = f5 * (crypto_int64) g8_19;
+ crypto_int64 f5g9_38 = f5_2 * (crypto_int64) g9_19;
+ crypto_int64 f6g0 = f6 * (crypto_int64) g0;
+ crypto_int64 f6g1 = f6 * (crypto_int64) g1;
+ crypto_int64 f6g2 = f6 * (crypto_int64) g2;
+ crypto_int64 f6g3 = f6 * (crypto_int64) g3;
+ crypto_int64 f6g4_19 = f6 * (crypto_int64) g4_19;
+ crypto_int64 f6g5_19 = f6 * (crypto_int64) g5_19;
+ crypto_int64 f6g6_19 = f6 * (crypto_int64) g6_19;
+ crypto_int64 f6g7_19 = f6 * (crypto_int64) g7_19;
+ crypto_int64 f6g8_19 = f6 * (crypto_int64) g8_19;
+ crypto_int64 f6g9_19 = f6 * (crypto_int64) g9_19;
+ crypto_int64 f7g0 = f7 * (crypto_int64) g0;
+ crypto_int64 f7g1_2 = f7_2 * (crypto_int64) g1;
+ crypto_int64 f7g2 = f7 * (crypto_int64) g2;
+ crypto_int64 f7g3_38 = f7_2 * (crypto_int64) g3_19;
+ crypto_int64 f7g4_19 = f7 * (crypto_int64) g4_19;
+ crypto_int64 f7g5_38 = f7_2 * (crypto_int64) g5_19;
+ crypto_int64 f7g6_19 = f7 * (crypto_int64) g6_19;
+ crypto_int64 f7g7_38 = f7_2 * (crypto_int64) g7_19;
+ crypto_int64 f7g8_19 = f7 * (crypto_int64) g8_19;
+ crypto_int64 f7g9_38 = f7_2 * (crypto_int64) g9_19;
+ crypto_int64 f8g0 = f8 * (crypto_int64) g0;
+ crypto_int64 f8g1 = f8 * (crypto_int64) g1;
+ crypto_int64 f8g2_19 = f8 * (crypto_int64) g2_19;
+ crypto_int64 f8g3_19 = f8 * (crypto_int64) g3_19;
+ crypto_int64 f8g4_19 = f8 * (crypto_int64) g4_19;
+ crypto_int64 f8g5_19 = f8 * (crypto_int64) g5_19;
+ crypto_int64 f8g6_19 = f8 * (crypto_int64) g6_19;
+ crypto_int64 f8g7_19 = f8 * (crypto_int64) g7_19;
+ crypto_int64 f8g8_19 = f8 * (crypto_int64) g8_19;
+ crypto_int64 f8g9_19 = f8 * (crypto_int64) g9_19;
+ crypto_int64 f9g0 = f9 * (crypto_int64) g0;
+ crypto_int64 f9g1_38 = f9_2 * (crypto_int64) g1_19;
+ crypto_int64 f9g2_19 = f9 * (crypto_int64) g2_19;
+ crypto_int64 f9g3_38 = f9_2 * (crypto_int64) g3_19;
+ crypto_int64 f9g4_19 = f9 * (crypto_int64) g4_19;
+ crypto_int64 f9g5_38 = f9_2 * (crypto_int64) g5_19;
+ crypto_int64 f9g6_19 = f9 * (crypto_int64) g6_19;
+ crypto_int64 f9g7_38 = f9_2 * (crypto_int64) g7_19;
+ crypto_int64 f9g8_19 = f9 * (crypto_int64) g8_19;
+ crypto_int64 f9g9_38 = f9_2 * (crypto_int64) g9_19;
+ crypto_int64 h0 = f0g0+f1g9_38+f2g8_19+f3g7_38+f4g6_19+f5g5_38+f6g4_19+f7g3_38+f8g2_19+f9g1_38;
+ crypto_int64 h1 = f0g1+f1g0 +f2g9_19+f3g8_19+f4g7_19+f5g6_19+f6g5_19+f7g4_19+f8g3_19+f9g2_19;
+ crypto_int64 h2 = f0g2+f1g1_2 +f2g0 +f3g9_38+f4g8_19+f5g7_38+f6g6_19+f7g5_38+f8g4_19+f9g3_38;
+ crypto_int64 h3 = f0g3+f1g2 +f2g1 +f3g0 +f4g9_19+f5g8_19+f6g7_19+f7g6_19+f8g5_19+f9g4_19;
+ crypto_int64 h4 = f0g4+f1g3_2 +f2g2 +f3g1_2 +f4g0 +f5g9_38+f6g8_19+f7g7_38+f8g6_19+f9g5_38;
+ crypto_int64 h5 = f0g5+f1g4 +f2g3 +f3g2 +f4g1 +f5g0 +f6g9_19+f7g8_19+f8g7_19+f9g6_19;
+ crypto_int64 h6 = f0g6+f1g5_2 +f2g4 +f3g3_2 +f4g2 +f5g1_2 +f6g0 +f7g9_38+f8g8_19+f9g7_38;
+ crypto_int64 h7 = f0g7+f1g6 +f2g5 +f3g4 +f4g3 +f5g2 +f6g1 +f7g0 +f8g9_19+f9g8_19;
+ crypto_int64 h8 = f0g8+f1g7_2 +f2g6 +f3g5_2 +f4g4 +f5g3_2 +f6g2 +f7g1_2 +f8g0 +f9g9_38;
+ crypto_int64 h9 = f0g9+f1g8 +f2g7 +f3g6 +f4g5 +f5g4 +f6g3 +f7g2 +f8g1 +f9g0 ;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ /*
+ |h0| <= (1.1*1.1*2^52*(1+19+19+19+19)+1.1*1.1*2^50*(38+38+38+38+38))
+ i.e. |h0| <= 1.2*2^59; narrower ranges for h2, h4, h6, h8
+ |h1| <= (1.1*1.1*2^51*(1+1+19+19+19+19+19+19+19+19))
+ i.e. |h1| <= 1.5*2^58; narrower ranges for h3, h5, h7, h9
+ */
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ /* |h0| <= 2^25 */
+ /* |h4| <= 2^25 */
+ /* |h1| <= 1.51*2^58 */
+ /* |h5| <= 1.51*2^58 */
+
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+ /* |h1| <= 2^24; from now on fits into int32 */
+ /* |h5| <= 2^24; from now on fits into int32 */
+ /* |h2| <= 1.21*2^59 */
+ /* |h6| <= 1.21*2^59 */
+
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+ /* |h2| <= 2^25; from now on fits into int32 unchanged */
+ /* |h6| <= 2^25; from now on fits into int32 unchanged */
+ /* |h3| <= 1.51*2^58 */
+ /* |h7| <= 1.51*2^58 */
+
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+ /* |h3| <= 2^24; from now on fits into int32 unchanged */
+ /* |h7| <= 2^24; from now on fits into int32 unchanged */
+ /* |h4| <= 1.52*2^33 */
+ /* |h8| <= 1.52*2^33 */
+
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+ /* |h4| <= 2^25; from now on fits into int32 unchanged */
+ /* |h8| <= 2^25; from now on fits into int32 unchanged */
+ /* |h5| <= 1.01*2^24 */
+ /* |h9| <= 1.51*2^58 */
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+ /* |h9| <= 2^24; from now on fits into int32 unchanged */
+ /* |h0| <= 1.8*2^37 */
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ /* |h0| <= 2^25; from now on fits into int32 unchanged */
+ /* |h1| <= 1.01*2^24 */
+
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sq_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sq_curve25519_ref10.c
new file mode 100644
index 00000000..b5a62115
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sq_curve25519_ref10.c
@@ -0,0 +1,153 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+h = f * f
+Can overlap h with f.
+
+Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+*/
+
+/*
+See fe_mul.c for discussion of implementation strategy.
+*/
+
+void fe_sq(fe h,fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 f0_2 = 2 * f0;
+ crypto_int32 f1_2 = 2 * f1;
+ crypto_int32 f2_2 = 2 * f2;
+ crypto_int32 f3_2 = 2 * f3;
+ crypto_int32 f4_2 = 2 * f4;
+ crypto_int32 f5_2 = 2 * f5;
+ crypto_int32 f6_2 = 2 * f6;
+ crypto_int32 f7_2 = 2 * f7;
+ crypto_int32 f5_38 = 38 * f5; /* 1.31*2^30 */
+ crypto_int32 f6_19 = 19 * f6; /* 1.31*2^30 */
+ crypto_int32 f7_38 = 38 * f7; /* 1.31*2^30 */
+ crypto_int32 f8_19 = 19 * f8; /* 1.31*2^30 */
+ crypto_int32 f9_38 = 38 * f9; /* 1.31*2^30 */
+ crypto_int64 f0f0 = f0 * (crypto_int64) f0;
+ crypto_int64 f0f1_2 = f0_2 * (crypto_int64) f1;
+ crypto_int64 f0f2_2 = f0_2 * (crypto_int64) f2;
+ crypto_int64 f0f3_2 = f0_2 * (crypto_int64) f3;
+ crypto_int64 f0f4_2 = f0_2 * (crypto_int64) f4;
+ crypto_int64 f0f5_2 = f0_2 * (crypto_int64) f5;
+ crypto_int64 f0f6_2 = f0_2 * (crypto_int64) f6;
+ crypto_int64 f0f7_2 = f0_2 * (crypto_int64) f7;
+ crypto_int64 f0f8_2 = f0_2 * (crypto_int64) f8;
+ crypto_int64 f0f9_2 = f0_2 * (crypto_int64) f9;
+ crypto_int64 f1f1_2 = f1_2 * (crypto_int64) f1;
+ crypto_int64 f1f2_2 = f1_2 * (crypto_int64) f2;
+ crypto_int64 f1f3_4 = f1_2 * (crypto_int64) f3_2;
+ crypto_int64 f1f4_2 = f1_2 * (crypto_int64) f4;
+ crypto_int64 f1f5_4 = f1_2 * (crypto_int64) f5_2;
+ crypto_int64 f1f6_2 = f1_2 * (crypto_int64) f6;
+ crypto_int64 f1f7_4 = f1_2 * (crypto_int64) f7_2;
+ crypto_int64 f1f8_2 = f1_2 * (crypto_int64) f8;
+ crypto_int64 f1f9_76 = f1_2 * (crypto_int64) f9_38;
+ crypto_int64 f2f2 = f2 * (crypto_int64) f2;
+ crypto_int64 f2f3_2 = f2_2 * (crypto_int64) f3;
+ crypto_int64 f2f4_2 = f2_2 * (crypto_int64) f4;
+ crypto_int64 f2f5_2 = f2_2 * (crypto_int64) f5;
+ crypto_int64 f2f6_2 = f2_2 * (crypto_int64) f6;
+ crypto_int64 f2f7_2 = f2_2 * (crypto_int64) f7;
+ crypto_int64 f2f8_38 = f2_2 * (crypto_int64) f8_19;
+ crypto_int64 f2f9_38 = f2 * (crypto_int64) f9_38;
+ crypto_int64 f3f3_2 = f3_2 * (crypto_int64) f3;
+ crypto_int64 f3f4_2 = f3_2 * (crypto_int64) f4;
+ crypto_int64 f3f5_4 = f3_2 * (crypto_int64) f5_2;
+ crypto_int64 f3f6_2 = f3_2 * (crypto_int64) f6;
+ crypto_int64 f3f7_76 = f3_2 * (crypto_int64) f7_38;
+ crypto_int64 f3f8_38 = f3_2 * (crypto_int64) f8_19;
+ crypto_int64 f3f9_76 = f3_2 * (crypto_int64) f9_38;
+ crypto_int64 f4f4 = f4 * (crypto_int64) f4;
+ crypto_int64 f4f5_2 = f4_2 * (crypto_int64) f5;
+ crypto_int64 f4f6_38 = f4_2 * (crypto_int64) f6_19;
+ crypto_int64 f4f7_38 = f4 * (crypto_int64) f7_38;
+ crypto_int64 f4f8_38 = f4_2 * (crypto_int64) f8_19;
+ crypto_int64 f4f9_38 = f4 * (crypto_int64) f9_38;
+ crypto_int64 f5f5_38 = f5 * (crypto_int64) f5_38;
+ crypto_int64 f5f6_38 = f5_2 * (crypto_int64) f6_19;
+ crypto_int64 f5f7_76 = f5_2 * (crypto_int64) f7_38;
+ crypto_int64 f5f8_38 = f5_2 * (crypto_int64) f8_19;
+ crypto_int64 f5f9_76 = f5_2 * (crypto_int64) f9_38;
+ crypto_int64 f6f6_19 = f6 * (crypto_int64) f6_19;
+ crypto_int64 f6f7_38 = f6 * (crypto_int64) f7_38;
+ crypto_int64 f6f8_38 = f6_2 * (crypto_int64) f8_19;
+ crypto_int64 f6f9_38 = f6 * (crypto_int64) f9_38;
+ crypto_int64 f7f7_38 = f7 * (crypto_int64) f7_38;
+ crypto_int64 f7f8_38 = f7_2 * (crypto_int64) f8_19;
+ crypto_int64 f7f9_76 = f7_2 * (crypto_int64) f9_38;
+ crypto_int64 f8f8_19 = f8 * (crypto_int64) f8_19;
+ crypto_int64 f8f9_38 = f8 * (crypto_int64) f9_38;
+ crypto_int64 f9f9_38 = f9 * (crypto_int64) f9_38;
+ crypto_int64 h0 = f0f0 +f1f9_76+f2f8_38+f3f7_76+f4f6_38+f5f5_38;
+ crypto_int64 h1 = f0f1_2+f2f9_38+f3f8_38+f4f7_38+f5f6_38;
+ crypto_int64 h2 = f0f2_2+f1f1_2 +f3f9_76+f4f8_38+f5f7_76+f6f6_19;
+ crypto_int64 h3 = f0f3_2+f1f2_2 +f4f9_38+f5f8_38+f6f7_38;
+ crypto_int64 h4 = f0f4_2+f1f3_4 +f2f2 +f5f9_76+f6f8_38+f7f7_38;
+ crypto_int64 h5 = f0f5_2+f1f4_2 +f2f3_2 +f6f9_38+f7f8_38;
+ crypto_int64 h6 = f0f6_2+f1f5_4 +f2f4_2 +f3f3_2 +f7f9_76+f8f8_19;
+ crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38;
+ crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38;
+ crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c
new file mode 100644
index 00000000..0fa49322
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c
@@ -0,0 +1,61 @@
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+h = f - g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+void fe_sub(fe h,fe f,fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 h0 = f0 - g0;
+ crypto_int32 h1 = f1 - g1;
+ crypto_int32 h2 = f2 - g2;
+ crypto_int32 h3 = f3 - g3;
+ crypto_int32 h4 = f4 - g4;
+ crypto_int32 h5 = f5 - g5;
+ crypto_int32 h6 = f6 - g6;
+ crypto_int32 h7 = f7 - g7;
+ crypto_int32 h8 = f8 - g8;
+ crypto_int32 h9 = f9 - g9;
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c
new file mode 100644
index 00000000..4e033fb6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c
@@ -0,0 +1,123 @@
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+/*
+Preconditions:
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Write p=2^255-19; q=floor(h/p).
+Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
+
+Proof:
+ Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
+ Also have |h-2^230 h9|<2^230 so |19 2^(-255)(h-2^230 h9)|<1/4.
+
+ Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
+ Then 0<y<1.
+
+ Write r=h-pq.
+ Have 0<=r<=p-1=2^255-20.
+ Thus 0<=r+19(2^-255)r<r+19(2^-255)2^255<=2^255-1.
+
+ Write x=r+19(2^-255)r+y.
+ Then 0<x<2^255 so floor(2^(-255)x) = 0 so floor(q+2^(-255)x) = q.
+
+ Have q+2^(-255)x = 2^(-255)(h + 19 2^(-25) h9 + 2^(-1))
+ so floor(2^(-255)(h + 19 2^(-25) h9 + 2^(-1))) = q.
+*/
+
+void fe_tobytes(unsigned char *s,fe h)
+{
+ crypto_int32 h0 = h[0];
+ crypto_int32 h1 = h[1];
+ crypto_int32 h2 = h[2];
+ crypto_int32 h3 = h[3];
+ crypto_int32 h4 = h[4];
+ crypto_int32 h5 = h[5];
+ crypto_int32 h6 = h[6];
+ crypto_int32 h7 = h[7];
+ crypto_int32 h8 = h[8];
+ crypto_int32 h9 = h[9];
+ crypto_int32 q;
+ crypto_int32 carry0;
+ crypto_int32 carry1;
+ crypto_int32 carry2;
+ crypto_int32 carry3;
+ crypto_int32 carry4;
+ crypto_int32 carry5;
+ crypto_int32 carry6;
+ crypto_int32 carry7;
+ crypto_int32 carry8;
+ crypto_int32 carry9;
+
+ q = (19 * h9 + (((crypto_int32) 1) << 24)) >> 25;
+ q = (h0 + q) >> 26;
+ q = (h1 + q) >> 25;
+ q = (h2 + q) >> 26;
+ q = (h3 + q) >> 25;
+ q = (h4 + q) >> 26;
+ q = (h5 + q) >> 25;
+ q = (h6 + q) >> 26;
+ q = (h7 + q) >> 25;
+ q = (h8 + q) >> 26;
+ q = (h9 + q) >> 25;
+
+ /* Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. */
+ h0 += 19 * q;
+ /* Goal: Output h-2^255 q, which is between 0 and 2^255-20. */
+
+ carry0 = h0 >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry1 = h1 >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry2 = h2 >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry3 = h3 >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry4 = h4 >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry5 = h5 >> 25; h6 += carry5; h5 -= carry5 << 25;
+ carry6 = h6 >> 26; h7 += carry6; h6 -= carry6 << 26;
+ carry7 = h7 >> 25; h8 += carry7; h7 -= carry7 << 25;
+ carry8 = h8 >> 26; h9 += carry8; h8 -= carry8 << 26;
+ carry9 = h9 >> 25; h9 -= carry9 << 25;
+ /* h10 = carry9 */
+
+ /*
+ Goal: Output h0+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
+ Have h0+...+2^230 h9 between 0 and 2^255-1;
+ evidently 2^255 h10-2^255 q = 0.
+ Goal: Output h0+...+2^230 h9.
+ */
+
+ s[0] = h0 >> 0;
+ s[1] = h0 >> 8;
+ s[2] = h0 >> 16;
+ s[3] = (h0 >> 24) | (h1 << 2);
+ s[4] = h1 >> 6;
+ s[5] = h1 >> 14;
+ s[6] = (h1 >> 22) | (h2 << 3);
+ s[7] = h2 >> 5;
+ s[8] = h2 >> 13;
+ s[9] = (h2 >> 21) | (h3 << 5);
+ s[10] = h3 >> 3;
+ s[11] = h3 >> 11;
+ s[12] = (h3 >> 19) | (h4 << 6);
+ s[13] = h4 >> 2;
+ s[14] = h4 >> 10;
+ s[15] = h4 >> 18;
+ s[16] = h5 >> 0;
+ s[17] = h5 >> 8;
+ s[18] = h5 >> 16;
+ s[19] = (h5 >> 24) | (h6 << 1);
+ s[20] = h6 >> 7;
+ s[21] = h6 >> 15;
+ s[22] = (h6 >> 23) | (h7 << 3);
+ s[23] = h7 >> 5;
+ s[24] = h7 >> 13;
+ s[25] = (h7 >> 21) | (h8 << 4);
+ s[26] = h8 >> 4;
+ s[27] = h8 >> 12;
+ s[28] = (h8 >> 20) | (h9 << 6);
+ s[29] = h9 >> 2;
+ s[30] = h9 >> 10;
+ s[31] = h9 >> 18;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/montgomery.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/montgomery.h
new file mode 100644
index 00000000..91e28c09
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/montgomery.h
@@ -0,0 +1,140 @@
+
+/* qhasm: fe X2 */
+
+/* qhasm: fe Z2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe X4 */
+
+/* qhasm: fe Z4 */
+
+/* qhasm: fe X5 */
+
+/* qhasm: fe Z5 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: fe E */
+
+/* qhasm: fe AA */
+
+/* qhasm: fe BB */
+
+/* qhasm: fe DA */
+
+/* qhasm: fe CB */
+
+/* qhasm: fe t0 */
+
+/* qhasm: fe t1 */
+
+/* qhasm: fe t2 */
+
+/* qhasm: fe t3 */
+
+/* qhasm: fe t4 */
+
+/* qhasm: enter ladder */
+
+/* qhasm: D = X3-Z3 */
+/* asm 1: fe_sub(>D=fe#5,<X3=fe#3,<Z3=fe#4); */
+/* asm 2: fe_sub(>D=tmp0,<X3=x3,<Z3=z3); */
+fe_sub(tmp0,x3,z3);
+
+/* qhasm: B = X2-Z2 */
+/* asm 1: fe_sub(>B=fe#6,<X2=fe#1,<Z2=fe#2); */
+/* asm 2: fe_sub(>B=tmp1,<X2=x2,<Z2=z2); */
+fe_sub(tmp1,x2,z2);
+
+/* qhasm: A = X2+Z2 */
+/* asm 1: fe_add(>A=fe#1,<X2=fe#1,<Z2=fe#2); */
+/* asm 2: fe_add(>A=x2,<X2=x2,<Z2=z2); */
+fe_add(x2,x2,z2);
+
+/* qhasm: C = X3+Z3 */
+/* asm 1: fe_add(>C=fe#2,<X3=fe#3,<Z3=fe#4); */
+/* asm 2: fe_add(>C=z2,<X3=x3,<Z3=z3); */
+fe_add(z2,x3,z3);
+
+/* qhasm: DA = D*A */
+/* asm 1: fe_mul(>DA=fe#4,<D=fe#5,<A=fe#1); */
+/* asm 2: fe_mul(>DA=z3,<D=tmp0,<A=x2); */
+fe_mul(z3,tmp0,x2);
+
+/* qhasm: CB = C*B */
+/* asm 1: fe_mul(>CB=fe#2,<C=fe#2,<B=fe#6); */
+/* asm 2: fe_mul(>CB=z2,<C=z2,<B=tmp1); */
+fe_mul(z2,z2,tmp1);
+
+/* qhasm: BB = B^2 */
+/* asm 1: fe_sq(>BB=fe#5,<B=fe#6); */
+/* asm 2: fe_sq(>BB=tmp0,<B=tmp1); */
+fe_sq(tmp0,tmp1);
+
+/* qhasm: AA = A^2 */
+/* asm 1: fe_sq(>AA=fe#6,<A=fe#1); */
+/* asm 2: fe_sq(>AA=tmp1,<A=x2); */
+fe_sq(tmp1,x2);
+
+/* qhasm: t0 = DA+CB */
+/* asm 1: fe_add(>t0=fe#3,<DA=fe#4,<CB=fe#2); */
+/* asm 2: fe_add(>t0=x3,<DA=z3,<CB=z2); */
+fe_add(x3,z3,z2);
+
+/* qhasm: assign x3 to t0 */
+
+/* qhasm: t1 = DA-CB */
+/* asm 1: fe_sub(>t1=fe#2,<DA=fe#4,<CB=fe#2); */
+/* asm 2: fe_sub(>t1=z2,<DA=z3,<CB=z2); */
+fe_sub(z2,z3,z2);
+
+/* qhasm: X4 = AA*BB */
+/* asm 1: fe_mul(>X4=fe#1,<AA=fe#6,<BB=fe#5); */
+/* asm 2: fe_mul(>X4=x2,<AA=tmp1,<BB=tmp0); */
+fe_mul(x2,tmp1,tmp0);
+
+/* qhasm: E = AA-BB */
+/* asm 1: fe_sub(>E=fe#6,<AA=fe#6,<BB=fe#5); */
+/* asm 2: fe_sub(>E=tmp1,<AA=tmp1,<BB=tmp0); */
+fe_sub(tmp1,tmp1,tmp0);
+
+/* qhasm: t2 = t1^2 */
+/* asm 1: fe_sq(>t2=fe#2,<t1=fe#2); */
+/* asm 2: fe_sq(>t2=z2,<t1=z2); */
+fe_sq(z2,z2);
+
+/* qhasm: t3 = a24*E */
+/* asm 1: fe_mul121666(>t3=fe#4,<E=fe#6); */
+/* asm 2: fe_mul121666(>t3=z3,<E=tmp1); */
+fe_mul121666(z3,tmp1);
+
+/* qhasm: X5 = t0^2 */
+/* asm 1: fe_sq(>X5=fe#3,<t0=fe#3); */
+/* asm 2: fe_sq(>X5=x3,<t0=x3); */
+fe_sq(x3,x3);
+
+/* qhasm: t4 = BB+t3 */
+/* asm 1: fe_add(>t4=fe#5,<BB=fe#5,<t3=fe#4); */
+/* asm 2: fe_add(>t4=tmp0,<BB=tmp0,<t3=z3); */
+fe_add(tmp0,tmp0,z3);
+
+/* qhasm: Z5 = X1*t2 */
+/* asm 1: fe_mul(>Z5=fe#4,x1,<t2=fe#2); */
+/* asm 2: fe_mul(>Z5=z3,x1,<t2=z2); */
+fe_mul(z3,x1,z2);
+
+/* qhasm: Z4 = E*t4 */
+/* asm 1: fe_mul(>Z4=fe#2,<E=fe#6,<t4=fe#5); */
+/* asm 2: fe_mul(>Z4=z2,<E=tmp1,<t4=tmp0); */
+fe_mul(z2,tmp1,tmp0);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h
new file mode 100644
index 00000000..8397222e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h
@@ -0,0 +1,160 @@
+
+/* qhasm: fe z1 */
+
+/* qhasm: fe z2 */
+
+/* qhasm: fe z8 */
+
+/* qhasm: fe z9 */
+
+/* qhasm: fe z11 */
+
+/* qhasm: fe z22 */
+
+/* qhasm: fe z_5_0 */
+
+/* qhasm: fe z_10_5 */
+
+/* qhasm: fe z_10_0 */
+
+/* qhasm: fe z_20_10 */
+
+/* qhasm: fe z_20_0 */
+
+/* qhasm: fe z_40_20 */
+
+/* qhasm: fe z_40_0 */
+
+/* qhasm: fe z_50_10 */
+
+/* qhasm: fe z_50_0 */
+
+/* qhasm: fe z_100_50 */
+
+/* qhasm: fe z_100_0 */
+
+/* qhasm: fe z_200_100 */
+
+/* qhasm: fe z_200_0 */
+
+/* qhasm: fe z_250_50 */
+
+/* qhasm: fe z_250_0 */
+
+/* qhasm: fe z_255_5 */
+
+/* qhasm: fe z_255_21 */
+
+/* qhasm: enter pow225521 */
+
+/* qhasm: z2 = z1^2^1 */
+/* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */
+/* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */
+fe_sq(t0,z); /* for (i = 1;i < 1;++i) fe_sq(t0,t0); */
+
+/* qhasm: z8 = z2^2^2 */
+/* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */
+/* asm 2: fe_sq(>z8=t1,<z2=t0); for (i = 1;i < 2;++i) fe_sq(>z8=t1,>z8=t1); */
+fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
+
+/* qhasm: z9 = z1*z8 */
+/* asm 1: fe_mul(>z9=fe#2,<z1=fe#11,<z8=fe#2); */
+/* asm 2: fe_mul(>z9=t1,<z1=z,<z8=t1); */
+fe_mul(t1,z,t1);
+
+/* qhasm: z11 = z2*z9 */
+/* asm 1: fe_mul(>z11=fe#1,<z2=fe#1,<z9=fe#2); */
+/* asm 2: fe_mul(>z11=t0,<z2=t0,<z9=t1); */
+fe_mul(t0,t0,t1);
+
+/* qhasm: z22 = z11^2^1 */
+/* asm 1: fe_sq(>z22=fe#3,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#3,>z22=fe#3); */
+/* asm 2: fe_sq(>z22=t2,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t2,>z22=t2); */
+fe_sq(t2,t0); /* for (i = 1;i < 1;++i) fe_sq(t2,t2); */
+
+/* qhasm: z_5_0 = z9*z22 */
+/* asm 1: fe_mul(>z_5_0=fe#2,<z9=fe#2,<z22=fe#3); */
+/* asm 2: fe_mul(>z_5_0=t1,<z9=t1,<z22=t2); */
+fe_mul(t1,t1,t2);
+
+/* qhasm: z_10_5 = z_5_0^2^5 */
+/* asm 1: fe_sq(>z_10_5=fe#3,<z_5_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_10_5=fe#3,>z_10_5=fe#3); */
+/* asm 2: fe_sq(>z_10_5=t2,<z_5_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_10_5=t2,>z_10_5=t2); */
+fe_sq(t2,t1); for (i = 1;i < 5;++i) fe_sq(t2,t2);
+
+/* qhasm: z_10_0 = z_10_5*z_5_0 */
+/* asm 1: fe_mul(>z_10_0=fe#2,<z_10_5=fe#3,<z_5_0=fe#2); */
+/* asm 2: fe_mul(>z_10_0=t1,<z_10_5=t2,<z_5_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_20_10 = z_10_0^2^10 */
+/* asm 1: fe_sq(>z_20_10=fe#3,<z_10_0=fe#2); for (i = 1;i < 10;++i) fe_sq(>z_20_10=fe#3,>z_20_10=fe#3); */
+/* asm 2: fe_sq(>z_20_10=t2,<z_10_0=t1); for (i = 1;i < 10;++i) fe_sq(>z_20_10=t2,>z_20_10=t2); */
+fe_sq(t2,t1); for (i = 1;i < 10;++i) fe_sq(t2,t2);
+
+/* qhasm: z_20_0 = z_20_10*z_10_0 */
+/* asm 1: fe_mul(>z_20_0=fe#3,<z_20_10=fe#3,<z_10_0=fe#2); */
+/* asm 2: fe_mul(>z_20_0=t2,<z_20_10=t2,<z_10_0=t1); */
+fe_mul(t2,t2,t1);
+
+/* qhasm: z_40_20 = z_20_0^2^20 */
+/* asm 1: fe_sq(>z_40_20=fe#4,<z_20_0=fe#3); for (i = 1;i < 20;++i) fe_sq(>z_40_20=fe#4,>z_40_20=fe#4); */
+/* asm 2: fe_sq(>z_40_20=t3,<z_20_0=t2); for (i = 1;i < 20;++i) fe_sq(>z_40_20=t3,>z_40_20=t3); */
+fe_sq(t3,t2); for (i = 1;i < 20;++i) fe_sq(t3,t3);
+
+/* qhasm: z_40_0 = z_40_20*z_20_0 */
+/* asm 1: fe_mul(>z_40_0=fe#3,<z_40_20=fe#4,<z_20_0=fe#3); */
+/* asm 2: fe_mul(>z_40_0=t2,<z_40_20=t3,<z_20_0=t2); */
+fe_mul(t2,t3,t2);
+
+/* qhasm: z_50_10 = z_40_0^2^10 */
+/* asm 1: fe_sq(>z_50_10=fe#3,<z_40_0=fe#3); for (i = 1;i < 10;++i) fe_sq(>z_50_10=fe#3,>z_50_10=fe#3); */
+/* asm 2: fe_sq(>z_50_10=t2,<z_40_0=t2); for (i = 1;i < 10;++i) fe_sq(>z_50_10=t2,>z_50_10=t2); */
+fe_sq(t2,t2); for (i = 1;i < 10;++i) fe_sq(t2,t2);
+
+/* qhasm: z_50_0 = z_50_10*z_10_0 */
+/* asm 1: fe_mul(>z_50_0=fe#2,<z_50_10=fe#3,<z_10_0=fe#2); */
+/* asm 2: fe_mul(>z_50_0=t1,<z_50_10=t2,<z_10_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_100_50 = z_50_0^2^50 */
+/* asm 1: fe_sq(>z_100_50=fe#3,<z_50_0=fe#2); for (i = 1;i < 50;++i) fe_sq(>z_100_50=fe#3,>z_100_50=fe#3); */
+/* asm 2: fe_sq(>z_100_50=t2,<z_50_0=t1); for (i = 1;i < 50;++i) fe_sq(>z_100_50=t2,>z_100_50=t2); */
+fe_sq(t2,t1); for (i = 1;i < 50;++i) fe_sq(t2,t2);
+
+/* qhasm: z_100_0 = z_100_50*z_50_0 */
+/* asm 1: fe_mul(>z_100_0=fe#3,<z_100_50=fe#3,<z_50_0=fe#2); */
+/* asm 2: fe_mul(>z_100_0=t2,<z_100_50=t2,<z_50_0=t1); */
+fe_mul(t2,t2,t1);
+
+/* qhasm: z_200_100 = z_100_0^2^100 */
+/* asm 1: fe_sq(>z_200_100=fe#4,<z_100_0=fe#3); for (i = 1;i < 100;++i) fe_sq(>z_200_100=fe#4,>z_200_100=fe#4); */
+/* asm 2: fe_sq(>z_200_100=t3,<z_100_0=t2); for (i = 1;i < 100;++i) fe_sq(>z_200_100=t3,>z_200_100=t3); */
+fe_sq(t3,t2); for (i = 1;i < 100;++i) fe_sq(t3,t3);
+
+/* qhasm: z_200_0 = z_200_100*z_100_0 */
+/* asm 1: fe_mul(>z_200_0=fe#3,<z_200_100=fe#4,<z_100_0=fe#3); */
+/* asm 2: fe_mul(>z_200_0=t2,<z_200_100=t3,<z_100_0=t2); */
+fe_mul(t2,t3,t2);
+
+/* qhasm: z_250_50 = z_200_0^2^50 */
+/* asm 1: fe_sq(>z_250_50=fe#3,<z_200_0=fe#3); for (i = 1;i < 50;++i) fe_sq(>z_250_50=fe#3,>z_250_50=fe#3); */
+/* asm 2: fe_sq(>z_250_50=t2,<z_200_0=t2); for (i = 1;i < 50;++i) fe_sq(>z_250_50=t2,>z_250_50=t2); */
+fe_sq(t2,t2); for (i = 1;i < 50;++i) fe_sq(t2,t2);
+
+/* qhasm: z_250_0 = z_250_50*z_50_0 */
+/* asm 1: fe_mul(>z_250_0=fe#2,<z_250_50=fe#3,<z_50_0=fe#2); */
+/* asm 2: fe_mul(>z_250_0=t1,<z_250_50=t2,<z_50_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_255_5 = z_250_0^2^5 */
+/* asm 1: fe_sq(>z_255_5=fe#2,<z_250_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_255_5=fe#2,>z_255_5=fe#2); */
+/* asm 2: fe_sq(>z_255_5=t1,<z_250_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_255_5=t1,>z_255_5=t1); */
+fe_sq(t1,t1); for (i = 1;i < 5;++i) fe_sq(t1,t1);
+
+/* qhasm: z_255_21 = z_255_5*z11 */
+/* asm 1: fe_mul(>z_255_21=fe#12,<z_255_5=fe#2,<z11=fe#1); */
+/* asm 2: fe_mul(>z_255_21=out,<z_255_5=t1,<z11=t0); */
+fe_mul(out,t1,t0);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c
new file mode 100644
index 00000000..a081430a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c
@@ -0,0 +1,54 @@
+
+#include "api.h"
+#include "crypto_scalarmult.h"
+#include "fe.h"
+
+#ifndef HAVE_TI_MODE
+
+int crypto_scalarmult(unsigned char *q,
+ const unsigned char *n,
+ const unsigned char *p)
+{
+ unsigned char e[32];
+ unsigned int i;
+ fe x1;
+ fe x2;
+ fe z2;
+ fe x3;
+ fe z3;
+ fe tmp0;
+ fe tmp1;
+ int pos;
+ unsigned int swap;
+ unsigned int b;
+
+ for (i = 0;i < 32;++i) e[i] = n[i];
+ e[0] &= 248;
+ e[31] &= 127;
+ e[31] |= 64;
+ fe_frombytes(x1,p);
+ fe_1(x2);
+ fe_0(z2);
+ fe_copy(x3,x1);
+ fe_1(z3);
+
+ swap = 0;
+ for (pos = 254;pos >= 0;--pos) {
+ b = e[pos / 8] >> (pos & 7);
+ b &= 1;
+ swap ^= b;
+ fe_cswap(x2,x3,swap);
+ fe_cswap(z2,z3,swap);
+ swap = b;
+#include "montgomery.h"
+ }
+ fe_cswap(x2,x3,swap);
+ fe_cswap(z2,z3,swap);
+
+ fe_invert(z2,z2);
+ fe_mul(x2,x2,z2);
+ fe_tobytes(q,x2);
+ return 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c
new file mode 100644
index 00000000..94c720a2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c
@@ -0,0 +1,14 @@
+
+#include "crypto_scalarmult_curve25519.h"
+
+size_t
+crypto_scalarmult_curve25519_bytes(void)
+{
+ return crypto_scalarmult_curve25519_BYTES;
+}
+
+size_t
+crypto_scalarmult_curve25519_scalarbytes(void)
+{
+ return crypto_scalarmult_curve25519_SCALARBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c
new file mode 100644
index 00000000..456f9f0a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c
@@ -0,0 +1,54 @@
+
+#include "crypto_secretbox.h"
+
+size_t
+crypto_secretbox_keybytes(void)
+{
+ return crypto_secretbox_KEYBYTES;
+}
+
+size_t
+crypto_secretbox_noncebytes(void)
+{
+ return crypto_secretbox_NONCEBYTES;
+}
+
+size_t
+crypto_secretbox_zerobytes(void)
+{
+ return crypto_secretbox_ZEROBYTES;
+}
+
+size_t
+crypto_secretbox_boxzerobytes(void)
+{
+ return crypto_secretbox_BOXZEROBYTES;
+}
+
+size_t
+crypto_secretbox_macbytes(void)
+{
+ return crypto_secretbox_MACBYTES;
+}
+
+const char *
+crypto_secretbox_primitive(void)
+{
+ return crypto_secretbox_PRIMITIVE;
+}
+
+int
+crypto_secretbox(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ return crypto_secretbox_xsalsa20poly1305(c, m, mlen, n, k);
+}
+
+int
+crypto_secretbox_open(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k)
+{
+ return crypto_secretbox_xsalsa20poly1305_open(m, c, clen, n, k);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c
new file mode 100644
index 00000000..e9b594c1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c
@@ -0,0 +1,139 @@
+
+#include <assert.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "crypto_core_hsalsa20.h"
+#include "crypto_onetimeauth_poly1305.h"
+#include "crypto_secretbox.h"
+#include "crypto_stream_salsa20.h"
+#include "utils.h"
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int
+crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
+ const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ crypto_onetimeauth_poly1305_state state;
+ unsigned char block0[64U];
+ unsigned char subkey[crypto_stream_salsa20_KEYBYTES];
+ unsigned long long i;
+ unsigned long long mlen0;
+
+ crypto_core_hsalsa20(subkey, n, k, sigma);
+
+ if (((uintptr_t) c >= (uintptr_t) m &&
+ (uintptr_t) c - (uintptr_t) m < mlen) ||
+ ((uintptr_t) m >= (uintptr_t) c &&
+ (uintptr_t) m - (uintptr_t) c < mlen)) {
+ memmove(c, m, mlen);
+ m = c;
+ }
+ memset(block0, 0U, crypto_secretbox_ZEROBYTES);
+ (void) sizeof(int[64U >= crypto_secretbox_ZEROBYTES ? 1 : -1]);
+ mlen0 = mlen;
+ if (mlen0 > 64U - crypto_secretbox_ZEROBYTES) {
+ mlen0 = 64U - crypto_secretbox_ZEROBYTES;
+ }
+ for (i = 0U; i < mlen0; i++) {
+ block0[i + crypto_secretbox_ZEROBYTES] = m[i];
+ }
+ crypto_stream_salsa20_xor(block0, block0,
+ mlen0 + crypto_secretbox_ZEROBYTES,
+ n + 16, subkey);
+ (void) sizeof(int[crypto_secretbox_ZEROBYTES >=
+ crypto_onetimeauth_poly1305_KEYBYTES ? 1 : -1]);
+ crypto_onetimeauth_poly1305_init(&state, block0);
+
+ memcpy(c, block0 + crypto_secretbox_ZEROBYTES, mlen0);
+ sodium_memzero(block0, sizeof block0);
+ if (mlen > mlen0) {
+ crypto_stream_salsa20_xor_ic(c + mlen0, m + mlen0, mlen - mlen0,
+ n + 16, 1U, subkey);
+ }
+ sodium_memzero(subkey, sizeof subkey);
+
+ crypto_onetimeauth_poly1305_update(&state, c, mlen);
+ crypto_onetimeauth_poly1305_final(&state, mac);
+ sodium_memzero(&state, sizeof state);
+
+ return 0;
+}
+
+int
+crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ if (mlen > SIZE_MAX - crypto_secretbox_MACBYTES) {
+ return -1;
+ }
+ return crypto_secretbox_detached(c + crypto_secretbox_MACBYTES,
+ c, m, mlen, n, k);
+}
+
+int
+crypto_secretbox_open_detached(unsigned char *m, const unsigned char *c,
+ const unsigned char *mac,
+ unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k)
+{
+ unsigned char block0[64U];
+ unsigned char subkey[crypto_stream_salsa20_KEYBYTES];
+ unsigned long long i;
+ unsigned long long mlen0;
+
+ crypto_core_hsalsa20(subkey, n, k, sigma);
+ crypto_stream_salsa20(block0, crypto_stream_salsa20_KEYBYTES,
+ n + 16, subkey);
+ if (crypto_onetimeauth_poly1305_verify(mac, c, clen, block0) != 0) {
+ sodium_memzero(subkey, sizeof subkey);
+ return -1;
+ }
+ if (((uintptr_t) c >= (uintptr_t) m &&
+ (uintptr_t) c - (uintptr_t) m < clen) ||
+ ((uintptr_t) m >= (uintptr_t) c &&
+ (uintptr_t) m - (uintptr_t) c < clen)) {
+ memmove(m, c, clen);
+ c = m;
+ }
+ mlen0 = clen;
+ if (mlen0 > 64U - crypto_secretbox_ZEROBYTES) {
+ mlen0 = 64U - crypto_secretbox_ZEROBYTES;
+ }
+ memcpy(block0 + crypto_secretbox_ZEROBYTES, c, mlen0);
+ crypto_stream_salsa20_xor(block0, block0,
+ crypto_secretbox_ZEROBYTES + mlen0,
+ n + 16, subkey);
+ for (i = 0U; i < mlen0; i++) {
+ m[i] = block0[i + crypto_secretbox_ZEROBYTES];
+ }
+ if (clen > mlen0) {
+ crypto_stream_salsa20_xor_ic(m + mlen0, c + mlen0, clen - mlen0,
+ n + 16, 1U, subkey);
+ }
+ sodium_memzero(subkey, sizeof subkey);
+
+ return 0;
+}
+
+int
+crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k)
+{
+ if (clen < crypto_secretbox_MACBYTES) {
+ return -1;
+ }
+ return crypto_secretbox_open_detached(m, c + crypto_secretbox_MACBYTES, c,
+ clen - crypto_secretbox_MACBYTES,
+ n, k);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h
new file mode 100644
index 00000000..5eff3d29
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h
@@ -0,0 +1,11 @@
+
+#include "crypto_secretbox_xsalsa20poly1305.h"
+
+#define crypto_secretbox crypto_secretbox_xsalsa20poly1305
+#define crypto_secretbox_open crypto_secretbox_xsalsa20poly1305_open
+#define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES
+#define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES
+#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES
+#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
+#define crypto_secretbox_IMPLEMENTATION crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION
+#define crypto_secretbox_VERSION crypto_secretbox_xsalsa20poly1305_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c
new file mode 100644
index 00000000..f68334ef
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c
@@ -0,0 +1,35 @@
+#include "api.h"
+#include "crypto_onetimeauth_poly1305.h"
+#include "crypto_stream_xsalsa20.h"
+
+int crypto_secretbox(
+ unsigned char *c,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ int i;
+ if (mlen < 32) return -1;
+ crypto_stream_xsalsa20_xor(c,m,mlen,n,k);
+ crypto_onetimeauth_poly1305(c + 16,c + 32,mlen - 32,c);
+ for (i = 0;i < 16;++i) c[i] = 0;
+ return 0;
+}
+
+int crypto_secretbox_open(
+ unsigned char *m,
+ const unsigned char *c,unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ int i;
+ unsigned char subkey[32];
+ if (clen < 32) return -1;
+ crypto_stream_xsalsa20(subkey,32,n,k);
+ if (crypto_onetimeauth_poly1305_verify(c + 16,c + 32,clen - 32,subkey) != 0) return -1;
+ crypto_stream_xsalsa20_xor(m,c,clen,n,k);
+ for (i = 0;i < 32;++i) m[i] = 0;
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c
new file mode 100644
index 00000000..3ab68b16
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c
@@ -0,0 +1,26 @@
+#include "crypto_secretbox_xsalsa20poly1305.h"
+
+size_t
+crypto_secretbox_xsalsa20poly1305_keybytes(void) {
+ return crypto_secretbox_xsalsa20poly1305_KEYBYTES;
+}
+
+size_t
+crypto_secretbox_xsalsa20poly1305_noncebytes(void) {
+ return crypto_secretbox_xsalsa20poly1305_NONCEBYTES;
+}
+
+size_t
+crypto_secretbox_xsalsa20poly1305_zerobytes(void) {
+ return crypto_secretbox_xsalsa20poly1305_ZEROBYTES;
+}
+
+size_t
+crypto_secretbox_xsalsa20poly1305_boxzerobytes(void) {
+ return crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES;
+}
+
+size_t
+crypto_secretbox_xsalsa20poly1305_macbytes(void) {
+ return crypto_secretbox_xsalsa20poly1305_MACBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c
new file mode 100644
index 00000000..b68b58a4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c
@@ -0,0 +1,27 @@
+
+#include "crypto_shorthash.h"
+
+size_t
+crypto_shorthash_bytes(void)
+{
+ return crypto_shorthash_BYTES;
+}
+
+size_t
+crypto_shorthash_keybytes(void)
+{
+ return crypto_shorthash_KEYBYTES;
+}
+
+const char *
+crypto_shorthash_primitive(void)
+{
+ return crypto_shorthash_PRIMITIVE;
+}
+
+int
+crypto_shorthash(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k)
+{
+ return crypto_shorthash_siphash24(out, in, inlen, k);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h
new file mode 100644
index 00000000..a837c8af
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h
@@ -0,0 +1,7 @@
+
+#include "crypto_shorthash_siphash24.h"
+
+#define crypto_shorthash crypto_shorthash_siphash24
+#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES
+#define crypto_shorthash_IMPLEMENTATION crypto_shorthash_siphash24_IMPLEMENTATION
+#define crypto_shorthash_VERSION crypto_shorthash_siphash24_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c
new file mode 100644
index 00000000..36763820
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c
@@ -0,0 +1,91 @@
+#include "api.h"
+#include "crypto_uint64.h"
+#include "crypto_uint32.h"
+#include "crypto_uint8.h"
+
+typedef crypto_uint64 u64;
+typedef crypto_uint32 u32;
+typedef crypto_uint8 u8;
+
+#define ROTL(x,b) (u64)( ((x) << (b)) | ( (x) >> (64 - (b))) )
+
+#define U32TO8_LE(p, v) \
+ (p)[0] = (u8)((v) ); (p)[1] = (u8)((v) >> 8); \
+ (p)[2] = (u8)((v) >> 16); (p)[3] = (u8)((v) >> 24);
+
+#define U64TO8_LE(p, v) \
+ U32TO8_LE((p), (u32)((v) )); \
+ U32TO8_LE((p) + 4, (u32)((v) >> 32));
+
+#define U8TO64_LE(p) \
+ (((u64)((p)[0]) ) | \
+ ((u64)((p)[1]) << 8) | \
+ ((u64)((p)[2]) << 16) | \
+ ((u64)((p)[3]) << 24) | \
+ ((u64)((p)[4]) << 32) | \
+ ((u64)((p)[5]) << 40) | \
+ ((u64)((p)[6]) << 48) | \
+ ((u64)((p)[7]) << 56))
+
+#define SIPROUND \
+ do { \
+ v0 += v1; v1=ROTL(v1,13); v1 ^= v0; v0=ROTL(v0,32); \
+ v2 += v3; v3=ROTL(v3,16); v3 ^= v2; \
+ v0 += v3; v3=ROTL(v3,21); v3 ^= v0; \
+ v2 += v1; v1=ROTL(v1,17); v1 ^= v2; v2=ROTL(v2,32); \
+ } while(0)
+
+int crypto_shorthash(unsigned char *out,const unsigned char *in,unsigned long long inlen,const unsigned char *k)
+{
+ /* "somepseudorandomlygeneratedbytes" */
+ u64 v0 = 0x736f6d6570736575ULL;
+ u64 v1 = 0x646f72616e646f6dULL;
+ u64 v2 = 0x6c7967656e657261ULL;
+ u64 v3 = 0x7465646279746573ULL;
+ u64 b;
+ u64 k0 = U8TO64_LE( k );
+ u64 k1 = U8TO64_LE( k + 8 );
+ u64 m;
+ const u8 *end = in + inlen - ( inlen % sizeof( u64 ) );
+ const int left = inlen & 7;
+ b = ( ( u64 )inlen ) << 56;
+ v3 ^= k1;
+ v2 ^= k0;
+ v1 ^= k1;
+ v0 ^= k0;
+
+ for ( ; in != end; in += 8 )
+ {
+ m = U8TO64_LE( in );
+ v3 ^= m;
+ SIPROUND;
+ SIPROUND;
+ v0 ^= m;
+ }
+
+ switch( left )
+ {
+ case 7: b |= ( ( u64 )in[ 6] ) << 48;
+ case 6: b |= ( ( u64 )in[ 5] ) << 40;
+ case 5: b |= ( ( u64 )in[ 4] ) << 32;
+ case 4: b |= ( ( u64 )in[ 3] ) << 24;
+ case 3: b |= ( ( u64 )in[ 2] ) << 16;
+ case 2: b |= ( ( u64 )in[ 1] ) << 8;
+ case 1: b |= ( ( u64 )in[ 0] ); break;
+ case 0: break;
+ }
+
+ v3 ^= b;
+ SIPROUND;
+ SIPROUND;
+ v0 ^= b;
+ v2 ^= 0xff;
+ SIPROUND;
+ SIPROUND;
+ SIPROUND;
+ SIPROUND;
+ b = v0 ^ v1 ^ v2 ^ v3;
+ U64TO8_LE( out, b );
+ return 0;
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c
new file mode 100644
index 00000000..e2cea776
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c
@@ -0,0 +1,11 @@
+#include "crypto_shorthash_siphash24.h"
+
+size_t
+crypto_shorthash_siphash24_bytes(void) {
+ return crypto_shorthash_siphash24_BYTES;
+}
+
+size_t
+crypto_shorthash_siphash24_keybytes(void) {
+ return crypto_shorthash_siphash24_KEYBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/crypto_sign.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/crypto_sign.c
new file mode 100644
index 00000000..b5508fb8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/crypto_sign.c
@@ -0,0 +1,76 @@
+
+#include "crypto_sign.h"
+
+size_t
+crypto_sign_bytes(void)
+{
+ return crypto_sign_BYTES;
+}
+
+size_t
+crypto_sign_seedbytes(void)
+{
+ return crypto_sign_SEEDBYTES;
+}
+
+size_t
+crypto_sign_publickeybytes(void)
+{
+ return crypto_sign_PUBLICKEYBYTES;
+}
+
+size_t
+crypto_sign_secretkeybytes(void)
+{
+ return crypto_sign_SECRETKEYBYTES;
+}
+
+const char *
+crypto_sign_primitive(void)
+{
+ return crypto_sign_PRIMITIVE;
+}
+
+int
+crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
+ const unsigned char *seed)
+{
+ return crypto_sign_ed25519_seed_keypair(pk, sk, seed);
+}
+
+int
+crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
+{
+ return crypto_sign_ed25519_keypair(pk, sk);
+}
+
+int
+crypto_sign(unsigned char *sm, unsigned long long *smlen_p,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *sk)
+{
+ return crypto_sign_ed25519(sm, smlen_p, m, mlen, sk);
+}
+
+int
+crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
+ const unsigned char *sm, unsigned long long smlen,
+ const unsigned char *pk)
+{
+ return crypto_sign_ed25519_open(m, mlen_p, sm, smlen, pk);
+}
+
+int
+crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *sk)
+{
+ return crypto_sign_ed25519_detached(sig, siglen_p, m, mlen, sk);
+}
+
+int
+crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *pk)
+{
+ return crypto_sign_ed25519_verify_detached(sig, m, mlen, pk);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h
new file mode 100644
index 00000000..0106cf13
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h
@@ -0,0 +1,15 @@
+
+#include "crypto_sign_ed25519.h"
+
+#define crypto_sign crypto_sign_ed25519
+#define crypto_sign_detached crypto_sign_ed25519_detached
+#define crypto_sign_open crypto_sign_ed25519_open
+#define crypto_sign_verify_detached crypto_sign_ed25519_verify_detached
+#define crypto_sign_keypair crypto_sign_ed25519_keypair
+#define crypto_sign_seed_keypair crypto_sign_ed25519_seed_keypair
+#define crypto_sign_BYTES crypto_sign_ed25519_BYTES
+#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES
+#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
+#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
+#define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION
+#define crypto_sign_VERSION crypto_sign_ed25519_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base.h
new file mode 100644
index 00000000..573bd8a0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base.h
@@ -0,0 +1,1344 @@
+{
+ {
+ { 25967493,-14356035,29566456,3660896,-12694345,4014787,27544626,-11754271,-6079156,2047605 },
+ { -12545711,934262,-2722910,3049990,-727428,9406986,12720692,5043384,19500929,-15469378 },
+ { -8738181,4489570,9688441,-14785194,10184609,-12363380,29287919,11864899,-24514362,-4438546 },
+ },
+ {
+ { -12815894,-12976347,-21581243,11784320,-25355658,-2750717,-11717903,-3814571,-358445,-10211303 },
+ { -21703237,6903825,27185491,6451973,-29577724,-9554005,-15616551,11189268,-26829678,-5319081 },
+ { 26966642,11152617,32442495,15396054,14353839,-12752335,-3128826,-9541118,-15472047,-4166697 },
+ },
+ {
+ { 15636291,-9688557,24204773,-7912398,616977,-16685262,27787600,-14772189,28944400,-1550024 },
+ { 16568933,4717097,-11556148,-1102322,15682896,-11807043,16354577,-11775962,7689662,11199574 },
+ { 30464156,-5976125,-11779434,-15670865,23220365,15915852,7512774,10017326,-17749093,-9920357 },
+ },
+ {
+ { -17036878,13921892,10945806,-6033431,27105052,-16084379,-28926210,15006023,3284568,-6276540 },
+ { 23599295,-8306047,-11193664,-7687416,13236774,10506355,7464579,9656445,13059162,10374397 },
+ { 7798556,16710257,3033922,2874086,28997861,2835604,32406664,-3839045,-641708,-101325 },
+ },
+ {
+ { 10861363,11473154,27284546,1981175,-30064349,12577861,32867885,14515107,-15438304,10819380 },
+ { 4708026,6336745,20377586,9066809,-11272109,6594696,-25653668,12483688,-12668491,5581306 },
+ { 19563160,16186464,-29386857,4097519,10237984,-4348115,28542350,13850243,-23678021,-15815942 },
+ },
+ {
+ { -15371964,-12862754,32573250,4720197,-26436522,5875511,-19188627,-15224819,-9818940,-12085777 },
+ { -8549212,109983,15149363,2178705,22900618,4543417,3044240,-15689887,1762328,14866737 },
+ { -18199695,-15951423,-10473290,1707278,-17185920,3916101,-28236412,3959421,27914454,4383652 },
+ },
+ {
+ { 5153746,9909285,1723747,-2777874,30523605,5516873,19480852,5230134,-23952439,-15175766 },
+ { -30269007,-3463509,7665486,10083793,28475525,1649722,20654025,16520125,30598449,7715701 },
+ { 28881845,14381568,9657904,3680757,-20181635,7843316,-31400660,1370708,29794553,-1409300 },
+ },
+ {
+ { 14499471,-2729599,-33191113,-4254652,28494862,14271267,30290735,10876454,-33154098,2381726 },
+ { -7195431,-2655363,-14730155,462251,-27724326,3941372,-6236617,3696005,-32300832,15351955 },
+ { 27431194,8222322,16448760,-3907995,-18707002,11938355,-32961401,-2970515,29551813,10109425 },
+ },
+},
+{
+ {
+ { -13657040,-13155431,-31283750,11777098,21447386,6519384,-2378284,-1627556,10092783,-4764171 },
+ { 27939166,14210322,4677035,16277044,-22964462,-12398139,-32508754,12005538,-17810127,12803510 },
+ { 17228999,-15661624,-1233527,300140,-1224870,-11714777,30364213,-9038194,18016357,4397660 },
+ },
+ {
+ { -10958843,-7690207,4776341,-14954238,27850028,-15602212,-26619106,14544525,-17477504,982639 },
+ { 29253598,15796703,-2863982,-9908884,10057023,3163536,7332899,-4120128,-21047696,9934963 },
+ { 5793303,16271923,-24131614,-10116404,29188560,1206517,-14747930,4559895,-30123922,-10897950 },
+ },
+ {
+ { -27643952,-11493006,16282657,-11036493,28414021,-15012264,24191034,4541697,-13338309,5500568 },
+ { 12650548,-1497113,9052871,11355358,-17680037,-8400164,-17430592,12264343,10874051,13524335 },
+ { 25556948,-3045990,714651,2510400,23394682,-10415330,33119038,5080568,-22528059,5376628 },
+ },
+ {
+ { -26088264,-4011052,-17013699,-3537628,-6726793,1920897,-22321305,-9447443,4535768,1569007 },
+ { -2255422,14606630,-21692440,-8039818,28430649,8775819,-30494562,3044290,31848280,12543772 },
+ { -22028579,2943893,-31857513,6777306,13784462,-4292203,-27377195,-2062731,7718482,14474653 },
+ },
+ {
+ { 2385315,2454213,-22631320,46603,-4437935,-15680415,656965,-7236665,24316168,-5253567 },
+ { 13741529,10911568,-33233417,-8603737,-20177830,-1033297,33040651,-13424532,-20729456,8321686 },
+ { 21060490,-2212744,15712757,-4336099,1639040,10656336,23845965,-11874838,-9984458,608372 },
+ },
+ {
+ { -13672732,-15087586,-10889693,-7557059,-6036909,11305547,1123968,-6780577,27229399,23887 },
+ { -23244140,-294205,-11744728,14712571,-29465699,-2029617,12797024,-6440308,-1633405,16678954 },
+ { -29500620,4770662,-16054387,14001338,7830047,9564805,-1508144,-4795045,-17169265,4904953 },
+ },
+ {
+ { 24059557,14617003,19037157,-15039908,19766093,-14906429,5169211,16191880,2128236,-4326833 },
+ { -16981152,4124966,-8540610,-10653797,30336522,-14105247,-29806336,916033,-6882542,-2986532 },
+ { -22630907,12419372,-7134229,-7473371,-16478904,16739175,285431,2763829,15736322,4143876 },
+ },
+ {
+ { 2379352,11839345,-4110402,-5988665,11274298,794957,212801,-14594663,23527084,-16458268 },
+ { 33431127,-11130478,-17838966,-15626900,8909499,8376530,-32625340,4087881,-15188911,-14416214 },
+ { 1767683,7197987,-13205226,-2022635,-13091350,448826,5799055,4357868,-4774191,-16323038 },
+ },
+},
+{
+ {
+ { 6721966,13833823,-23523388,-1551314,26354293,-11863321,23365147,-3949732,7390890,2759800 },
+ { 4409041,2052381,23373853,10530217,7676779,-12885954,21302353,-4264057,1244380,-12919645 },
+ { -4421239,7169619,4982368,-2957590,30256825,-2777540,14086413,9208236,15886429,16489664 },
+ },
+ {
+ { 1996075,10375649,14346367,13311202,-6874135,-16438411,-13693198,398369,-30606455,-712933 },
+ { -25307465,9795880,-2777414,14878809,-33531835,14780363,13348553,12076947,-30836462,5113182 },
+ { -17770784,11797796,31950843,13929123,-25888302,12288344,-30341101,-7336386,13847711,5387222 },
+ },
+ {
+ { -18582163,-3416217,17824843,-2340966,22744343,-10442611,8763061,3617786,-19600662,10370991 },
+ { 20246567,-14369378,22358229,-543712,18507283,-10413996,14554437,-8746092,32232924,16763880 },
+ { 9648505,10094563,26416693,14745928,-30374318,-6472621,11094161,15689506,3140038,-16510092 },
+ },
+ {
+ { -16160072,5472695,31895588,4744994,8823515,10365685,-27224800,9448613,-28774454,366295 },
+ { 19153450,11523972,-11096490,-6503142,-24647631,5420647,28344573,8041113,719605,11671788 },
+ { 8678025,2694440,-6808014,2517372,4964326,11152271,-15432916,-15266516,27000813,-10195553 },
+ },
+ {
+ { -15157904,7134312,8639287,-2814877,-7235688,10421742,564065,5336097,6750977,-14521026 },
+ { 11836410,-3979488,26297894,16080799,23455045,15735944,1695823,-8819122,8169720,16220347 },
+ { -18115838,8653647,17578566,-6092619,-8025777,-16012763,-11144307,-2627664,-5990708,-14166033 },
+ },
+ {
+ { -23308498,-10968312,15213228,-10081214,-30853605,-11050004,27884329,2847284,2655861,1738395 },
+ { -27537433,-14253021,-25336301,-8002780,-9370762,8129821,21651608,-3239336,-19087449,-11005278 },
+ { 1533110,3437855,23735889,459276,29970501,11335377,26030092,5821408,10478196,8544890 },
+ },
+ {
+ { 32173121,-16129311,24896207,3921497,22579056,-3410854,19270449,12217473,17789017,-3395995 },
+ { -30552961,-2228401,-15578829,-10147201,13243889,517024,15479401,-3853233,30460520,1052596 },
+ { -11614875,13323618,32618793,8175907,-15230173,12596687,27491595,-4612359,3179268,-9478891 },
+ },
+ {
+ { 31947069,-14366651,-4640583,-15339921,-15125977,-6039709,-14756777,-16411740,19072640,-9511060 },
+ { 11685058,11822410,3158003,-13952594,33402194,-4165066,5977896,-5215017,473099,5040608 },
+ { -20290863,8198642,-27410132,11602123,1290375,-2799760,28326862,1721092,-19558642,-3131606 },
+ },
+},
+{
+ {
+ { 7881532,10687937,7578723,7738378,-18951012,-2553952,21820786,8076149,-27868496,11538389 },
+ { -19935666,3899861,18283497,-6801568,-15728660,-11249211,8754525,7446702,-5676054,5797016 },
+ { -11295600,-3793569,-15782110,-7964573,12708869,-8456199,2014099,-9050574,-2369172,-5877341 },
+ },
+ {
+ { -22472376,-11568741,-27682020,1146375,18956691,16640559,1192730,-3714199,15123619,10811505 },
+ { 14352098,-3419715,-18942044,10822655,32750596,4699007,-70363,15776356,-28886779,-11974553 },
+ { -28241164,-8072475,-4978962,-5315317,29416931,1847569,-20654173,-16484855,4714547,-9600655 },
+ },
+ {
+ { 15200332,8368572,19679101,15970074,-31872674,1959451,24611599,-4543832,-11745876,12340220 },
+ { 12876937,-10480056,33134381,6590940,-6307776,14872440,9613953,8241152,15370987,9608631 },
+ { -4143277,-12014408,8446281,-391603,4407738,13629032,-7724868,15866074,-28210621,-8814099 },
+ },
+ {
+ { 26660628,-15677655,8393734,358047,-7401291,992988,-23904233,858697,20571223,8420556 },
+ { 14620715,13067227,-15447274,8264467,14106269,15080814,33531827,12516406,-21574435,-12476749 },
+ { 236881,10476226,57258,-14677024,6472998,2466984,17258519,7256740,8791136,15069930 },
+ },
+ {
+ { 1276410,-9371918,22949635,-16322807,-23493039,-5702186,14711875,4874229,-30663140,-2331391 },
+ { 5855666,4990204,-13711848,7294284,-7804282,1924647,-1423175,-7912378,-33069337,9234253 },
+ { 20590503,-9018988,31529744,-7352666,-2706834,10650548,31559055,-11609587,18979186,13396066 },
+ },
+ {
+ { 24474287,4968103,22267082,4407354,24063882,-8325180,-18816887,13594782,33514650,7021958 },
+ { -11566906,-6565505,-21365085,15928892,-26158305,4315421,-25948728,-3916677,-21480480,12868082 },
+ { -28635013,13504661,19988037,-2132761,21078225,6443208,-21446107,2244500,-12455797,-8089383 },
+ },
+ {
+ { -30595528,13793479,-5852820,319136,-25723172,-6263899,33086546,8957937,-15233648,5540521 },
+ { -11630176,-11503902,-8119500,-7643073,2620056,1022908,-23710744,-1568984,-16128528,-14962807 },
+ { 23152971,775386,27395463,14006635,-9701118,4649512,1689819,892185,-11513277,-15205948 },
+ },
+ {
+ { 9770129,9586738,26496094,4324120,1556511,-3550024,27453819,4763127,-19179614,5867134 },
+ { -32765025,1927590,31726409,-4753295,23962434,-16019500,27846559,5931263,-29749703,-16108455 },
+ { 27461885,-2977536,22380810,1815854,-23033753,-3031938,7283490,-15148073,-19526700,7734629 },
+ },
+},
+{
+ {
+ { -8010264,-9590817,-11120403,6196038,29344158,-13430885,7585295,-3176626,18549497,15302069 },
+ { -32658337,-6171222,-7672793,-11051681,6258878,13504381,10458790,-6418461,-8872242,8424746 },
+ { 24687205,8613276,-30667046,-3233545,1863892,-1830544,19206234,7134917,-11284482,-828919 },
+ },
+ {
+ { 11334899,-9218022,8025293,12707519,17523892,-10476071,10243738,-14685461,-5066034,16498837 },
+ { 8911542,6887158,-9584260,-6958590,11145641,-9543680,17303925,-14124238,6536641,10543906 },
+ { -28946384,15479763,-17466835,568876,-1497683,11223454,-2669190,-16625574,-27235709,8876771 },
+ },
+ {
+ { -25742899,-12566864,-15649966,-846607,-33026686,-796288,-33481822,15824474,-604426,-9039817 },
+ { 10330056,70051,7957388,-9002667,9764902,15609756,27698697,-4890037,1657394,3084098 },
+ { 10477963,-7470260,12119566,-13250805,29016247,-5365589,31280319,14396151,-30233575,15272409 },
+ },
+ {
+ { -12288309,3169463,28813183,16658753,25116432,-5630466,-25173957,-12636138,-25014757,1950504 },
+ { -26180358,9489187,11053416,-14746161,-31053720,5825630,-8384306,-8767532,15341279,8373727 },
+ { 28685821,7759505,-14378516,-12002860,-31971820,4079242,298136,-10232602,-2878207,15190420 },
+ },
+ {
+ { -32932876,13806336,-14337485,-15794431,-24004620,10940928,8669718,2742393,-26033313,-6875003 },
+ { -1580388,-11729417,-25979658,-11445023,-17411874,-10912854,9291594,-16247779,-12154742,6048605 },
+ { -30305315,14843444,1539301,11864366,20201677,1900163,13934231,5128323,11213262,9168384 },
+ },
+ {
+ { -26280513,11007847,19408960,-940758,-18592965,-4328580,-5088060,-11105150,20470157,-16398701 },
+ { -23136053,9282192,14855179,-15390078,-7362815,-14408560,-22783952,14461608,14042978,5230683 },
+ { 29969567,-2741594,-16711867,-8552442,9175486,-2468974,21556951,3506042,-5933891,-12449708 },
+ },
+ {
+ { -3144746,8744661,19704003,4581278,-20430686,6830683,-21284170,8971513,-28539189,15326563 },
+ { -19464629,10110288,-17262528,-3503892,-23500387,1355669,-15523050,15300988,-20514118,9168260 },
+ { -5353335,4488613,-23803248,16314347,7780487,-15638939,-28948358,9601605,33087103,-9011387 },
+ },
+ {
+ { -19443170,-15512900,-20797467,-12445323,-29824447,10229461,-27444329,-15000531,-5996870,15664672 },
+ { 23294591,-16632613,-22650781,-8470978,27844204,11461195,13099750,-2460356,18151676,13417686 },
+ { -24722913,-4176517,-31150679,5988919,-26858785,6685065,1661597,-12551441,15271676,-15452665 },
+ },
+},
+{
+ {
+ { 11433042,-13228665,8239631,-5279517,-1985436,-725718,-18698764,2167544,-6921301,-13440182 },
+ { -31436171,15575146,30436815,12192228,-22463353,9395379,-9917708,-8638997,12215110,12028277 },
+ { 14098400,6555944,23007258,5757252,-15427832,-12950502,30123440,4617780,-16900089,-655628 },
+ },
+ {
+ { -4026201,-15240835,11893168,13718664,-14809462,1847385,-15819999,10154009,23973261,-12684474 },
+ { -26531820,-3695990,-1908898,2534301,-31870557,-16550355,18341390,-11419951,32013174,-10103539 },
+ { -25479301,10876443,-11771086,-14625140,-12369567,1838104,21911214,6354752,4425632,-837822 },
+ },
+ {
+ { -10433389,-14612966,22229858,-3091047,-13191166,776729,-17415375,-12020462,4725005,14044970 },
+ { 19268650,-7304421,1555349,8692754,-21474059,-9910664,6347390,-1411784,-19522291,-16109756 },
+ { -24864089,12986008,-10898878,-5558584,-11312371,-148526,19541418,8180106,9282262,10282508 },
+ },
+ {
+ { -26205082,4428547,-8661196,-13194263,4098402,-14165257,15522535,8372215,5542595,-10702683 },
+ { -10562541,14895633,26814552,-16673850,-17480754,-2489360,-2781891,6993761,-18093885,10114655 },
+ { -20107055,-929418,31422704,10427861,-7110749,6150669,-29091755,-11529146,25953725,-106158 },
+ },
+ {
+ { -4234397,-8039292,-9119125,3046000,2101609,-12607294,19390020,6094296,-3315279,12831125 },
+ { -15998678,7578152,5310217,14408357,-33548620,-224739,31575954,6326196,7381791,-2421839 },
+ { -20902779,3296811,24736065,-16328389,18374254,7318640,6295303,8082724,-15362489,12339664 },
+ },
+ {
+ { 27724736,2291157,6088201,-14184798,1792727,5857634,13848414,15768922,25091167,14856294 },
+ { -18866652,8331043,24373479,8541013,-701998,-9269457,12927300,-12695493,-22182473,-9012899 },
+ { -11423429,-5421590,11632845,3405020,30536730,-11674039,-27260765,13866390,30146206,9142070 },
+ },
+ {
+ { 3924129,-15307516,-13817122,-10054960,12291820,-668366,-27702774,9326384,-8237858,4171294 },
+ { -15921940,16037937,6713787,16606682,-21612135,2790944,26396185,3731949,345228,-5462949 },
+ { -21327538,13448259,25284571,1143661,20614966,-8849387,2031539,-12391231,-16253183,-13582083 },
+ },
+ {
+ { 31016211,-16722429,26371392,-14451233,-5027349,14854137,17477601,3842657,28012650,-16405420 },
+ { -5075835,9368966,-8562079,-4600902,-15249953,6970560,-9189873,16292057,-8867157,3507940 },
+ { 29439664,3537914,23333589,6997794,-17555561,-11018068,-15209202,-15051267,-9164929,6580396 },
+ },
+},
+{
+ {
+ { -12185861,-7679788,16438269,10826160,-8696817,-6235611,17860444,-9273846,-2095802,9304567 },
+ { 20714564,-4336911,29088195,7406487,11426967,-5095705,14792667,-14608617,5289421,-477127 },
+ { -16665533,-10650790,-6160345,-13305760,9192020,-1802462,17271490,12349094,26939669,-3752294 },
+ },
+ {
+ { -12889898,9373458,31595848,16374215,21471720,13221525,-27283495,-12348559,-3698806,117887 },
+ { 22263325,-6560050,3984570,-11174646,-15114008,-566785,28311253,5358056,-23319780,541964 },
+ { 16259219,3261970,2309254,-15534474,-16885711,-4581916,24134070,-16705829,-13337066,-13552195 },
+ },
+ {
+ { 9378160,-13140186,-22845982,-12745264,28198281,-7244098,-2399684,-717351,690426,14876244 },
+ { 24977353,-314384,-8223969,-13465086,28432343,-1176353,-13068804,-12297348,-22380984,6618999 },
+ { -1538174,11685646,12944378,13682314,-24389511,-14413193,8044829,-13817328,32239829,-5652762 },
+ },
+ {
+ { -18603066,4762990,-926250,8885304,-28412480,-3187315,9781647,-10350059,32779359,5095274 },
+ { -33008130,-5214506,-32264887,-3685216,9460461,-9327423,-24601656,14506724,21639561,-2630236 },
+ { -16400943,-13112215,25239338,15531969,3987758,-4499318,-1289502,-6863535,17874574,558605 },
+ },
+ {
+ { -13600129,10240081,9171883,16131053,-20869254,9599700,33499487,5080151,2085892,5119761 },
+ { -22205145,-2519528,-16381601,414691,-25019550,2170430,30634760,-8363614,-31999993,-5759884 },
+ { -6845704,15791202,8550074,-1312654,29928809,-12092256,27534430,-7192145,-22351378,12961482 },
+ },
+ {
+ { -24492060,-9570771,10368194,11582341,-23397293,-2245287,16533930,8206996,-30194652,-5159638 },
+ { -11121496,-3382234,2307366,6362031,-135455,8868177,-16835630,7031275,7589640,8945490 },
+ { -32152748,8917967,6661220,-11677616,-1192060,-15793393,7251489,-11182180,24099109,-14456170 },
+ },
+ {
+ { 5019558,-7907470,4244127,-14714356,-26933272,6453165,-19118182,-13289025,-6231896,-10280736 },
+ { 10853594,10721687,26480089,5861829,-22995819,1972175,-1866647,-10557898,-3363451,-6441124 },
+ { -17002408,5906790,221599,-6563147,7828208,-13248918,24362661,-2008168,-13866408,7421392 },
+ },
+ {
+ { 8139927,-6546497,32257646,-5890546,30375719,1886181,-21175108,15441252,28826358,-4123029 },
+ { 6267086,9695052,7709135,-16603597,-32869068,-1886135,14795160,-7840124,13746021,-1742048 },
+ { 28584902,7787108,-6732942,-15050729,22846041,-7571236,-3181936,-363524,4771362,-8419958 },
+ },
+},
+{
+ {
+ { 24949256,6376279,-27466481,-8174608,-18646154,-9930606,33543569,-12141695,3569627,11342593 },
+ { 26514989,4740088,27912651,3697550,19331575,-11472339,6809886,4608608,7325975,-14801071 },
+ { -11618399,-14554430,-24321212,7655128,-1369274,5214312,-27400540,10258390,-17646694,-8186692 },
+ },
+ {
+ { 11431204,15823007,26570245,14329124,18029990,4796082,-31446179,15580664,9280358,-3973687 },
+ { -160783,-10326257,-22855316,-4304997,-20861367,-13621002,-32810901,-11181622,-15545091,4387441 },
+ { -20799378,12194512,3937617,-5805892,-27154820,9340370,-24513992,8548137,20617071,-7482001 },
+ },
+ {
+ { -938825,-3930586,-8714311,16124718,24603125,-6225393,-13775352,-11875822,24345683,10325460 },
+ { -19855277,-1568885,-22202708,8714034,14007766,6928528,16318175,-1010689,4766743,3552007 },
+ { -21751364,-16730916,1351763,-803421,-4009670,3950935,3217514,14481909,10988822,-3994762 },
+ },
+ {
+ { 15564307,-14311570,3101243,5684148,30446780,-8051356,12677127,-6505343,-8295852,13296005 },
+ { -9442290,6624296,-30298964,-11913677,-4670981,-2057379,31521204,9614054,-30000824,12074674 },
+ { 4771191,-135239,14290749,-13089852,27992298,14998318,-1413936,-1556716,29832613,-16391035 },
+ },
+ {
+ { 7064884,-7541174,-19161962,-5067537,-18891269,-2912736,25825242,5293297,-27122660,13101590 },
+ { -2298563,2439670,-7466610,1719965,-27267541,-16328445,32512469,-5317593,-30356070,-4190957 },
+ { -30006540,10162316,-33180176,3981723,-16482138,-13070044,14413974,9515896,19568978,9628812 },
+ },
+ {
+ { 33053803,199357,15894591,1583059,27380243,-4580435,-17838894,-6106839,-6291786,3437740 },
+ { -18978877,3884493,19469877,12726490,15913552,13614290,-22961733,70104,7463304,4176122 },
+ { -27124001,10659917,11482427,-16070381,12771467,-6635117,-32719404,-5322751,24216882,5944158 },
+ },
+ {
+ { 8894125,7450974,-2664149,-9765752,-28080517,-12389115,19345746,14680796,11632993,5847885 },
+ { 26942781,-2315317,9129564,-4906607,26024105,11769399,-11518837,6367194,-9727230,4782140 },
+ { 19916461,-4828410,-22910704,-11414391,25606324,-5972441,33253853,8220911,6358847,-1873857 },
+ },
+ {
+ { 801428,-2081702,16569428,11065167,29875704,96627,7908388,-4480480,-13538503,1387155 },
+ { 19646058,5720633,-11416706,12814209,11607948,12749789,14147075,15156355,-21866831,11835260 },
+ { 19299512,1155910,28703737,14890794,2925026,7269399,26121523,15467869,-26560550,5052483 },
+ },
+},
+{
+ {
+ { -3017432,10058206,1980837,3964243,22160966,12322533,-6431123,-12618185,12228557,-7003677 },
+ { 32944382,14922211,-22844894,5188528,21913450,-8719943,4001465,13238564,-6114803,8653815 },
+ { 22865569,-4652735,27603668,-12545395,14348958,8234005,24808405,5719875,28483275,2841751 },
+ },
+ {
+ { -16420968,-1113305,-327719,-12107856,21886282,-15552774,-1887966,-315658,19932058,-12739203 },
+ { -11656086,10087521,-8864888,-5536143,-19278573,-3055912,3999228,13239134,-4777469,-13910208 },
+ { 1382174,-11694719,17266790,9194690,-13324356,9720081,20403944,11284705,-14013818,3093230 },
+ },
+ {
+ { 16650921,-11037932,-1064178,1570629,-8329746,7352753,-302424,16271225,-24049421,-6691850 },
+ { -21911077,-5927941,-4611316,-5560156,-31744103,-10785293,24123614,15193618,-21652117,-16739389 },
+ { -9935934,-4289447,-25279823,4372842,2087473,10399484,31870908,14690798,17361620,11864968 },
+ },
+ {
+ { -11307610,6210372,13206574,5806320,-29017692,-13967200,-12331205,-7486601,-25578460,-16240689 },
+ { 14668462,-12270235,26039039,15305210,25515617,4542480,10453892,6577524,9145645,-6443880 },
+ { 5974874,3053895,-9433049,-10385191,-31865124,3225009,-7972642,3936128,-5652273,-3050304 },
+ },
+ {
+ { 30625386,-4729400,-25555961,-12792866,-20484575,7695099,17097188,-16303496,-27999779,1803632 },
+ { -3553091,9865099,-5228566,4272701,-5673832,-16689700,14911344,12196514,-21405489,7047412 },
+ { 20093277,9920966,-11138194,-5343857,13161587,12044805,-32856851,4124601,-32343828,-10257566 },
+ },
+ {
+ { -20788824,14084654,-13531713,7842147,19119038,-13822605,4752377,-8714640,-21679658,2288038 },
+ { -26819236,-3283715,29965059,3039786,-14473765,2540457,29457502,14625692,-24819617,12570232 },
+ { -1063558,-11551823,16920318,12494842,1278292,-5869109,-21159943,-3498680,-11974704,4724943 },
+ },
+ {
+ { 17960970,-11775534,-4140968,-9702530,-8876562,-1410617,-12907383,-8659932,-29576300,1903856 },
+ { 23134274,-14279132,-10681997,-1611936,20684485,15770816,-12989750,3190296,26955097,14109738 },
+ { 15308788,5320727,-30113809,-14318877,22902008,7767164,29425325,-11277562,31960942,11934971 },
+ },
+ {
+ { -27395711,8435796,4109644,12222639,-24627868,14818669,20638173,4875028,10491392,1379718 },
+ { -13159415,9197841,3875503,-8936108,-1383712,-5879801,33518459,16176658,21432314,12180697 },
+ { -11787308,11500838,13787581,-13832590,-22430679,10140205,1465425,12689540,-10301319,-13872883 },
+ },
+},
+{
+ {
+ { 5414091,-15386041,-21007664,9643570,12834970,1186149,-2622916,-1342231,26128231,6032912 },
+ { -26337395,-13766162,32496025,-13653919,17847801,-12669156,3604025,8316894,-25875034,-10437358 },
+ { 3296484,6223048,24680646,-12246460,-23052020,5903205,-8862297,-4639164,12376617,3188849 },
+ },
+ {
+ { 29190488,-14659046,27549113,-1183516,3520066,-10697301,32049515,-7309113,-16109234,-9852307 },
+ { -14744486,-9309156,735818,-598978,-20407687,-5057904,25246078,-15795669,18640741,-960977 },
+ { -6928835,-16430795,10361374,5642961,4910474,12345252,-31638386,-494430,10530747,1053335 },
+ },
+ {
+ { -29265967,-14186805,-13538216,-12117373,-19457059,-10655384,-31462369,-2948985,24018831,15026644 },
+ { -22592535,-3145277,-2289276,5953843,-13440189,9425631,25310643,13003497,-2314791,-15145616 },
+ { -27419985,-603321,-8043984,-1669117,-26092265,13987819,-27297622,187899,-23166419,-2531735 },
+ },
+ {
+ { -21744398,-13810475,1844840,5021428,-10434399,-15911473,9716667,16266922,-5070217,726099 },
+ { 29370922,-6053998,7334071,-15342259,9385287,2247707,-13661962,-4839461,30007388,-15823341 },
+ { -936379,16086691,23751945,-543318,-1167538,-5189036,9137109,730663,9835848,4555336 },
+ },
+ {
+ { -23376435,1410446,-22253753,-12899614,30867635,15826977,17693930,544696,-11985298,12422646 },
+ { 31117226,-12215734,-13502838,6561947,-9876867,-12757670,-5118685,-4096706,29120153,13924425 },
+ { -17400879,-14233209,19675799,-2734756,-11006962,-5858820,-9383939,-11317700,7240931,-237388 },
+ },
+ {
+ { -31361739,-11346780,-15007447,-5856218,-22453340,-12152771,1222336,4389483,3293637,-15551743 },
+ { -16684801,-14444245,11038544,11054958,-13801175,-3338533,-24319580,7733547,12796905,-6335822 },
+ { -8759414,-10817836,-25418864,10783769,-30615557,-9746811,-28253339,3647836,3222231,-11160462 },
+ },
+ {
+ { 18606113,1693100,-25448386,-15170272,4112353,10045021,23603893,-2048234,-7550776,2484985 },
+ { 9255317,-3131197,-12156162,-1004256,13098013,-9214866,16377220,-2102812,-19802075,-3034702 },
+ { -22729289,7496160,-5742199,11329249,19991973,-3347502,-31718148,9936966,-30097688,-10618797 },
+ },
+ {
+ { 21878590,-5001297,4338336,13643897,-3036865,13160960,19708896,5415497,-7360503,-4109293 },
+ { 27736861,10103576,12500508,8502413,-3413016,-9633558,10436918,-1550276,-23659143,-8132100 },
+ { 19492550,-12104365,-29681976,-852630,-3208171,12403437,30066266,8367329,13243957,8709688 },
+ },
+},
+{
+ {
+ { 12015105,2801261,28198131,10151021,24818120,-4743133,-11194191,-5645734,5150968,7274186 },
+ { 2831366,-12492146,1478975,6122054,23825128,-12733586,31097299,6083058,31021603,-9793610 },
+ { -2529932,-2229646,445613,10720828,-13849527,-11505937,-23507731,16354465,15067285,-14147707 },
+ },
+ {
+ { 7840942,14037873,-33364863,15934016,-728213,-3642706,21403988,1057586,-19379462,-12403220 },
+ { 915865,-16469274,15608285,-8789130,-24357026,6060030,-17371319,8410997,-7220461,16527025 },
+ { 32922597,-556987,20336074,-16184568,10903705,-5384487,16957574,52992,23834301,6588044 },
+ },
+ {
+ { 32752030,11232950,3381995,-8714866,22652988,-10744103,17159699,16689107,-20314580,-1305992 },
+ { -4689649,9166776,-25710296,-10847306,11576752,12733943,7924251,-2752281,1976123,-7249027 },
+ { 21251222,16309901,-2983015,-6783122,30810597,12967303,156041,-3371252,12331345,-8237197 },
+ },
+ {
+ { 8651614,-4477032,-16085636,-4996994,13002507,2950805,29054427,-5106970,10008136,-4667901 },
+ { 31486080,15114593,-14261250,12951354,14369431,-7387845,16347321,-13662089,8684155,-10532952 },
+ { 19443825,11385320,24468943,-9659068,-23919258,2187569,-26263207,-6086921,31316348,14219878 },
+ },
+ {
+ { -28594490,1193785,32245219,11392485,31092169,15722801,27146014,6992409,29126555,9207390 },
+ { 32382935,1110093,18477781,11028262,-27411763,-7548111,-4980517,10843782,-7957600,-14435730 },
+ { 2814918,7836403,27519878,-7868156,-20894015,-11553689,-21494559,8550130,28346258,1994730 },
+ },
+ {
+ { -19578299,8085545,-14000519,-3948622,2785838,-16231307,-19516951,7174894,22628102,8115180 },
+ { -30405132,955511,-11133838,-15078069,-32447087,-13278079,-25651578,3317160,-9943017,930272 },
+ { -15303681,-6833769,28856490,1357446,23421993,1057177,24091212,-1388970,-22765376,-10650715 },
+ },
+ {
+ { -22751231,-5303997,-12907607,-12768866,-15811511,-7797053,-14839018,-16554220,-1867018,8398970 },
+ { -31969310,2106403,-4736360,1362501,12813763,16200670,22981545,-6291273,18009408,-15772772 },
+ { -17220923,-9545221,-27784654,14166835,29815394,7444469,29551787,-3727419,19288549,1325865 },
+ },
+ {
+ { 15100157,-15835752,-23923978,-1005098,-26450192,15509408,12376730,-3479146,33166107,-8042750 },
+ { 20909231,13023121,-9209752,16251778,-5778415,-8094914,12412151,10018715,2213263,-13878373 },
+ { 32529814,-11074689,30361439,-16689753,-9135940,1513226,22922121,6382134,-5766928,8371348 },
+ },
+},
+{
+ {
+ { 9923462,11271500,12616794,3544722,-29998368,-1721626,12891687,-8193132,-26442943,10486144 },
+ { -22597207,-7012665,8587003,-8257861,4084309,-12970062,361726,2610596,-23921530,-11455195 },
+ { 5408411,-1136691,-4969122,10561668,24145918,14240566,31319731,-4235541,19985175,-3436086 },
+ },
+ {
+ { -13994457,16616821,14549246,3341099,32155958,13648976,-17577068,8849297,65030,8370684 },
+ { -8320926,-12049626,31204563,5839400,-20627288,-1057277,-19442942,6922164,12743482,-9800518 },
+ { -2361371,12678785,28815050,4759974,-23893047,4884717,23783145,11038569,18800704,255233 },
+ },
+ {
+ { -5269658,-1773886,13957886,7990715,23132995,728773,13393847,9066957,19258688,-14753793 },
+ { -2936654,-10827535,-10432089,14516793,-3640786,4372541,-31934921,2209390,-1524053,2055794 },
+ { 580882,16705327,5468415,-2683018,-30926419,-14696000,-7203346,-8994389,-30021019,7394435 },
+ },
+ {
+ { 23838809,1822728,-15738443,15242727,8318092,-3733104,-21672180,-3492205,-4821741,14799921 },
+ { 13345610,9759151,3371034,-16137791,16353039,8577942,31129804,13496856,-9056018,7402518 },
+ { 2286874,-4435931,-20042458,-2008336,-13696227,5038122,11006906,-15760352,8205061,1607563 },
+ },
+ {
+ { 14414086,-8002132,3331830,-3208217,22249151,-5594188,18364661,-2906958,30019587,-9029278 },
+ { -27688051,1585953,-10775053,931069,-29120221,-11002319,-14410829,12029093,9944378,8024 },
+ { 4368715,-3709630,29874200,-15022983,-20230386,-11410704,-16114594,-999085,-8142388,5640030 },
+ },
+ {
+ { 10299610,13746483,11661824,16234854,7630238,5998374,9809887,-16694564,15219798,-14327783 },
+ { 27425505,-5719081,3055006,10660664,23458024,595578,-15398605,-1173195,-18342183,9742717 },
+ { 6744077,2427284,26042789,2720740,-847906,1118974,32324614,7406442,12420155,1994844 },
+ },
+ {
+ { 14012521,-5024720,-18384453,-9578469,-26485342,-3936439,-13033478,-10909803,24319929,-6446333 },
+ { 16412690,-4507367,10772641,15929391,-17068788,-4658621,10555945,-10484049,-30102368,-4739048 },
+ { 22397382,-7767684,-9293161,-12792868,17166287,-9755136,-27333065,6199366,21880021,-12250760 },
+ },
+ {
+ { -4283307,5368523,-31117018,8163389,-30323063,3209128,16557151,8890729,8840445,4957760 },
+ { -15447727,709327,-6919446,-10870178,-29777922,6522332,-21720181,12130072,-14796503,5005757 },
+ { -2114751,-14308128,23019042,15765735,-25269683,6002752,10183197,-13239326,-16395286,-2176112 },
+ },
+},
+{
+ {
+ { -19025756,1632005,13466291,-7995100,-23640451,16573537,-32013908,-3057104,22208662,2000468 },
+ { 3065073,-1412761,-25598674,-361432,-17683065,-5703415,-8164212,11248527,-3691214,-7414184 },
+ { 10379208,-6045554,8877319,1473647,-29291284,-12507580,16690915,2553332,-3132688,16400289 },
+ },
+ {
+ { 15716668,1254266,-18472690,7446274,-8448918,6344164,-22097271,-7285580,26894937,9132066 },
+ { 24158887,12938817,11085297,-8177598,-28063478,-4457083,-30576463,64452,-6817084,-2692882 },
+ { 13488534,7794716,22236231,5989356,25426474,-12578208,2350710,-3418511,-4688006,2364226 },
+ },
+ {
+ { 16335052,9132434,25640582,6678888,1725628,8517937,-11807024,-11697457,15445875,-7798101 },
+ { 29004207,-7867081,28661402,-640412,-12794003,-7943086,31863255,-4135540,-278050,-15759279 },
+ { -6122061,-14866665,-28614905,14569919,-10857999,-3591829,10343412,-6976290,-29828287,-10815811 },
+ },
+ {
+ { 27081650,3463984,14099042,-4517604,1616303,-6205604,29542636,15372179,17293797,960709 },
+ { 20263915,11434237,-5765435,11236810,13505955,-10857102,-16111345,6493122,-19384511,7639714 },
+ { -2830798,-14839232,25403038,-8215196,-8317012,-16173699,18006287,-16043750,29994677,-15808121 },
+ },
+ {
+ { 9769828,5202651,-24157398,-13631392,-28051003,-11561624,-24613141,-13860782,-31184575,709464 },
+ { 12286395,13076066,-21775189,-1176622,-25003198,4057652,-32018128,-8890874,16102007,13205847 },
+ { 13733362,5599946,10557076,3195751,-5557991,8536970,-25540170,8525972,10151379,10394400 },
+ },
+ {
+ { 4024660,-16137551,22436262,12276534,-9099015,-2686099,19698229,11743039,-33302334,8934414 },
+ { -15879800,-4525240,-8580747,-2934061,14634845,-698278,-9449077,3137094,-11536886,11721158 },
+ { 17555939,-5013938,8268606,2331751,-22738815,9761013,9319229,8835153,-9205489,-1280045 },
+ },
+ {
+ { -461409,-7830014,20614118,16688288,-7514766,-4807119,22300304,505429,6108462,-6183415 },
+ { -5070281,12367917,-30663534,3234473,32617080,-8422642,29880583,-13483331,-26898490,-7867459 },
+ { -31975283,5726539,26934134,10237677,-3173717,-605053,24199304,3795095,7592688,-14992079 },
+ },
+ {
+ { 21594432,-14964228,17466408,-4077222,32537084,2739898,6407723,12018833,-28256052,4298412 },
+ { -20650503,-11961496,-27236275,570498,3767144,-1717540,13891942,-1569194,13717174,10805743 },
+ { -14676630,-15644296,15287174,11927123,24177847,-8175568,-796431,14860609,-26938930,-5863836 },
+ },
+},
+{
+ {
+ { 12962541,5311799,-10060768,11658280,18855286,-7954201,13286263,-12808704,-4381056,9882022 },
+ { 18512079,11319350,-20123124,15090309,18818594,5271736,-22727904,3666879,-23967430,-3299429 },
+ { -6789020,-3146043,16192429,13241070,15898607,-14206114,-10084880,-6661110,-2403099,5276065 },
+ },
+ {
+ { 30169808,-5317648,26306206,-11750859,27814964,7069267,7152851,3684982,1449224,13082861 },
+ { 10342826,3098505,2119311,193222,25702612,12233820,23697382,15056736,-21016438,-8202000 },
+ { -33150110,3261608,22745853,7948688,19370557,-15177665,-26171976,6482814,-10300080,-11060101 },
+ },
+ {
+ { 32869458,-5408545,25609743,15678670,-10687769,-15471071,26112421,2521008,-22664288,6904815 },
+ { 29506923,4457497,3377935,-9796444,-30510046,12935080,1561737,3841096,-29003639,-6657642 },
+ { 10340844,-6630377,-18656632,-2278430,12621151,-13339055,30878497,-11824370,-25584551,5181966 },
+ },
+ {
+ { 25940115,-12658025,17324188,-10307374,-8671468,15029094,24396252,-16450922,-2322852,-12388574 },
+ { -21765684,9916823,-1300409,4079498,-1028346,11909559,1782390,12641087,20603771,-6561742 },
+ { -18882287,-11673380,24849422,11501709,13161720,-4768874,1925523,11914390,4662781,7820689 },
+ },
+ {
+ { 12241050,-425982,8132691,9393934,32846760,-1599620,29749456,12172924,16136752,15264020 },
+ { -10349955,-14680563,-8211979,2330220,-17662549,-14545780,10658213,6671822,19012087,3772772 },
+ { 3753511,-3421066,10617074,2028709,14841030,-6721664,28718732,-15762884,20527771,12988982 },
+ },
+ {
+ { -14822485,-5797269,-3707987,12689773,-898983,-10914866,-24183046,-10564943,3299665,-12424953 },
+ { -16777703,-15253301,-9642417,4978983,3308785,8755439,6943197,6461331,-25583147,8991218 },
+ { -17226263,1816362,-1673288,-6086439,31783888,-8175991,-32948145,7417950,-30242287,1507265 },
+ },
+ {
+ { 29692663,6829891,-10498800,4334896,20945975,-11906496,-28887608,8209391,14606362,-10647073 },
+ { -3481570,8707081,32188102,5672294,22096700,1711240,-33020695,9761487,4170404,-2085325 },
+ { -11587470,14855945,-4127778,-1531857,-26649089,15084046,22186522,16002000,-14276837,-8400798 },
+ },
+ {
+ { -4811456,13761029,-31703877,-2483919,-3312471,7869047,-7113572,-9620092,13240845,10965870 },
+ { -7742563,-8256762,-14768334,-13656260,-23232383,12387166,4498947,14147411,29514390,4302863 },
+ { -13413405,-12407859,20757302,-13801832,14785143,8976368,-5061276,-2144373,17846988,-13971927 },
+ },
+},
+{
+ {
+ { -2244452,-754728,-4597030,-1066309,-6247172,1455299,-21647728,-9214789,-5222701,12650267 },
+ { -9906797,-16070310,21134160,12198166,-27064575,708126,387813,13770293,-19134326,10958663 },
+ { 22470984,12369526,23446014,-5441109,-21520802,-9698723,-11772496,-11574455,-25083830,4271862 },
+ },
+ {
+ { -25169565,-10053642,-19909332,15361595,-5984358,2159192,75375,-4278529,-32526221,8469673 },
+ { 15854970,4148314,-8893890,7259002,11666551,13824734,-30531198,2697372,24154791,-9460943 },
+ { 15446137,-15806644,29759747,14019369,30811221,-9610191,-31582008,12840104,24913809,9815020 },
+ },
+ {
+ { -4709286,-5614269,-31841498,-12288893,-14443537,10799414,-9103676,13438769,18735128,9466238 },
+ { 11933045,9281483,5081055,-5183824,-2628162,-4905629,-7727821,-10896103,-22728655,16199064 },
+ { 14576810,379472,-26786533,-8317236,-29426508,-10812974,-102766,1876699,30801119,2164795 },
+ },
+ {
+ { 15995086,3199873,13672555,13712240,-19378835,-4647646,-13081610,-15496269,-13492807,1268052 },
+ { -10290614,-3659039,-3286592,10948818,23037027,3794475,-3470338,-12600221,-17055369,3565904 },
+ { 29210088,-9419337,-5919792,-4952785,10834811,-13327726,-16512102,-10820713,-27162222,-14030531 },
+ },
+ {
+ { -13161890,15508588,16663704,-8156150,-28349942,9019123,-29183421,-3769423,2244111,-14001979 },
+ { -5152875,-3800936,-9306475,-6071583,16243069,14684434,-25673088,-16180800,13491506,4641841 },
+ { 10813417,643330,-19188515,-728916,30292062,-16600078,27548447,-7721242,14476989,-12767431 },
+ },
+ {
+ { 10292079,9984945,6481436,8279905,-7251514,7032743,27282937,-1644259,-27912810,12651324 },
+ { -31185513,-813383,22271204,11835308,10201545,15351028,17099662,3988035,21721536,-3148940 },
+ { 10202177,-6545839,-31373232,-9574638,-32150642,-8119683,-12906320,3852694,13216206,14842320 },
+ },
+ {
+ { -15815640,-10601066,-6538952,-7258995,-6984659,-6581778,-31500847,13765824,-27434397,9900184 },
+ { 14465505,-13833331,-32133984,-14738873,-27443187,12990492,33046193,15796406,-7051866,-8040114 },
+ { 30924417,-8279620,6359016,-12816335,16508377,9071735,-25488601,15413635,9524356,-7018878 },
+ },
+ {
+ { 12274201,-13175547,32627641,-1785326,6736625,13267305,5237659,-5109483,15663516,4035784 },
+ { -2951309,8903985,17349946,601635,-16432815,-4612556,-13732739,-15889334,-22258478,4659091 },
+ { -16916263,-4952973,-30393711,-15158821,20774812,15897498,5736189,15026997,-2178256,-13455585 },
+ },
+},
+{
+ {
+ { -8858980,-2219056,28571666,-10155518,-474467,-10105698,-3801496,278095,23440562,-290208 },
+ { 10226241,-5928702,15139956,120818,-14867693,5218603,32937275,11551483,-16571960,-7442864 },
+ { 17932739,-12437276,-24039557,10749060,11316803,7535897,22503767,5561594,-3646624,3898661 },
+ },
+ {
+ { 7749907,-969567,-16339731,-16464,-25018111,15122143,-1573531,7152530,21831162,1245233 },
+ { 26958459,-14658026,4314586,8346991,-5677764,11960072,-32589295,-620035,-30402091,-16716212 },
+ { -12165896,9166947,33491384,13673479,29787085,13096535,6280834,14587357,-22338025,13987525 },
+ },
+ {
+ { -24349909,7778775,21116000,15572597,-4833266,-5357778,-4300898,-5124639,-7469781,-2858068 },
+ { 9681908,-6737123,-31951644,13591838,-6883821,386950,31622781,6439245,-14581012,4091397 },
+ { -8426427,1470727,-28109679,-1596990,3978627,-5123623,-19622683,12092163,29077877,-14741988 },
+ },
+ {
+ { 5269168,-6859726,-13230211,-8020715,25932563,1763552,-5606110,-5505881,-20017847,2357889 },
+ { 32264008,-15407652,-5387735,-1160093,-2091322,-3946900,23104804,-12869908,5727338,189038 },
+ { 14609123,-8954470,-6000566,-16622781,-14577387,-7743898,-26745169,10942115,-25888931,-14884697 },
+ },
+ {
+ { 20513500,5557931,-15604613,7829531,26413943,-2019404,-21378968,7471781,13913677,-5137875 },
+ { -25574376,11967826,29233242,12948236,-6754465,4713227,-8940970,14059180,12878652,8511905 },
+ { -25656801,3393631,-2955415,-7075526,-2250709,9366908,-30223418,6812974,5568676,-3127656 },
+ },
+ {
+ { 11630004,12144454,2116339,13606037,27378885,15676917,-17408753,-13504373,-14395196,8070818 },
+ { 27117696,-10007378,-31282771,-5570088,1127282,12772488,-29845906,10483306,-11552749,-1028714 },
+ { 10637467,-5688064,5674781,1072708,-26343588,-6982302,-1683975,9177853,-27493162,15431203 },
+ },
+ {
+ { 20525145,10892566,-12742472,12779443,-29493034,16150075,-28240519,14943142,-15056790,-7935931 },
+ { -30024462,5626926,-551567,-9981087,753598,11981191,25244767,-3239766,-3356550,9594024 },
+ { -23752644,2636870,-5163910,-10103818,585134,7877383,11345683,-6492290,13352335,-10977084 },
+ },
+ {
+ { -1931799,-5407458,3304649,-12884869,17015806,-4877091,-29783850,-7752482,-13215537,-319204 },
+ { 20239939,6607058,6203985,3483793,-18386976,-779229,-20723742,15077870,-22750759,14523817 },
+ { 27406042,-6041657,27423596,-4497394,4996214,10002360,-28842031,-4545494,-30172742,-4805667 },
+ },
+},
+{
+ {
+ { 11374242,12660715,17861383,-12540833,10935568,1099227,-13886076,-9091740,-27727044,11358504 },
+ { -12730809,10311867,1510375,10778093,-2119455,-9145702,32676003,11149336,-26123651,4985768 },
+ { -19096303,341147,-6197485,-239033,15756973,-8796662,-983043,13794114,-19414307,-15621255 },
+ },
+ {
+ { 6490081,11940286,25495923,-7726360,8668373,-8751316,3367603,6970005,-1691065,-9004790 },
+ { 1656497,13457317,15370807,6364910,13605745,8362338,-19174622,-5475723,-16796596,-5031438 },
+ { -22273315,-13524424,-64685,-4334223,-18605636,-10921968,-20571065,-7007978,-99853,-10237333 },
+ },
+ {
+ { 17747465,10039260,19368299,-4050591,-20630635,-16041286,31992683,-15857976,-29260363,-5511971 },
+ { 31932027,-4986141,-19612382,16366580,22023614,88450,11371999,-3744247,4882242,-10626905 },
+ { 29796507,37186,19818052,10115756,-11829032,3352736,18551198,3272828,-5190932,-4162409 },
+ },
+ {
+ { 12501286,4044383,-8612957,-13392385,-32430052,5136599,-19230378,-3529697,330070,-3659409 },
+ { 6384877,2899513,17807477,7663917,-2358888,12363165,25366522,-8573892,-271295,12071499 },
+ { -8365515,-4042521,25133448,-4517355,-6211027,2265927,-32769618,1936675,-5159697,3829363 },
+ },
+ {
+ { 28425966,-5835433,-577090,-4697198,-14217555,6870930,7921550,-6567787,26333140,14267664 },
+ { -11067219,11871231,27385719,-10559544,-4585914,-11189312,10004786,-8709488,-21761224,8930324 },
+ { -21197785,-16396035,25654216,-1725397,12282012,11008919,1541940,4757911,-26491501,-16408940 },
+ },
+ {
+ { 13537262,-7759490,-20604840,10961927,-5922820,-13218065,-13156584,6217254,-15943699,13814990 },
+ { -17422573,15157790,18705543,29619,24409717,-260476,27361681,9257833,-1956526,-1776914 },
+ { -25045300,-10191966,15366585,15166509,-13105086,8423556,-29171540,12361135,-18685978,4578290 },
+ },
+ {
+ { 24579768,3711570,1342322,-11180126,-27005135,14124956,-22544529,14074919,21964432,8235257 },
+ { -6528613,-2411497,9442966,-5925588,12025640,-1487420,-2981514,-1669206,13006806,2355433 },
+ { -16304899,-13605259,-6632427,-5142349,16974359,-10911083,27202044,1719366,1141648,-12796236 },
+ },
+ {
+ { -12863944,-13219986,-8318266,-11018091,-6810145,-4843894,13475066,-3133972,32674895,13715045 },
+ { 11423335,-5468059,32344216,8962751,24989809,9241752,-13265253,16086212,-28740881,-15642093 },
+ { -1409668,12530728,-6368726,10847387,19531186,-14132160,-11709148,7791794,-27245943,4383347 },
+ },
+},
+{
+ {
+ { -28970898,5271447,-1266009,-9736989,-12455236,16732599,-4862407,-4906449,27193557,6245191 },
+ { -15193956,5362278,-1783893,2695834,4960227,12840725,23061898,3260492,22510453,8577507 },
+ { -12632451,11257346,-32692994,13548177,-721004,10879011,31168030,13952092,-29571492,-3635906 },
+ },
+ {
+ { 3877321,-9572739,32416692,5405324,-11004407,-13656635,3759769,11935320,5611860,8164018 },
+ { -16275802,14667797,15906460,12155291,-22111149,-9039718,32003002,-8832289,5773085,-8422109 },
+ { -23788118,-8254300,1950875,8937633,18686727,16459170,-905725,12376320,31632953,190926 },
+ },
+ {
+ { -24593607,-16138885,-8423991,13378746,14162407,6901328,-8288749,4508564,-25341555,-3627528 },
+ { 8884438,-5884009,6023974,10104341,-6881569,-4941533,18722941,-14786005,-1672488,827625 },
+ { -32720583,-16289296,-32503547,7101210,13354605,2659080,-1800575,-14108036,-24878478,1541286 },
+ },
+ {
+ { 2901347,-1117687,3880376,-10059388,-17620940,-3612781,-21802117,-3567481,20456845,-1885033 },
+ { 27019610,12299467,-13658288,-1603234,-12861660,-4861471,-19540150,-5016058,29439641,15138866 },
+ { 21536104,-6626420,-32447818,-10690208,-22408077,5175814,-5420040,-16361163,7779328,109896 },
+ },
+ {
+ { 30279744,14648750,-8044871,6425558,13639621,-743509,28698390,12180118,23177719,-554075 },
+ { 26572847,3405927,-31701700,12890905,-19265668,5335866,-6493768,2378492,4439158,-13279347 },
+ { -22716706,3489070,-9225266,-332753,18875722,-1140095,14819434,-12731527,-17717757,-5461437 },
+ },
+ {
+ { -5056483,16566551,15953661,3767752,-10436499,15627060,-820954,2177225,8550082,-15114165 },
+ { -18473302,16596775,-381660,15663611,22860960,15585581,-27844109,-3582739,-23260460,-8428588 },
+ { -32480551,15707275,-8205912,-5652081,29464558,2713815,-22725137,15860482,-21902570,1494193 },
+ },
+ {
+ { -19562091,-14087393,-25583872,-9299552,13127842,759709,21923482,16529112,8742704,12967017 },
+ { -28464899,1553205,32536856,-10473729,-24691605,-406174,-8914625,-2933896,-29903758,15553883 },
+ { 21877909,3230008,9881174,10539357,-4797115,2841332,11543572,14513274,19375923,-12647961 },
+ },
+ {
+ { 8832269,-14495485,13253511,5137575,5037871,4078777,24880818,-6222716,2862653,9455043 },
+ { 29306751,5123106,20245049,-14149889,9592566,8447059,-2077124,-2990080,15511449,4789663 },
+ { -20679756,7004547,8824831,-9434977,-4045704,-3750736,-5754762,108893,23513200,16652362 },
+ },
+},
+{
+ {
+ { -33256173,4144782,-4476029,-6579123,10770039,-7155542,-6650416,-12936300,-18319198,10212860 },
+ { 2756081,8598110,7383731,-6859892,22312759,-1105012,21179801,2600940,-9988298,-12506466 },
+ { -24645692,13317462,-30449259,-15653928,21365574,-10869657,11344424,864440,-2499677,-16710063 },
+ },
+ {
+ { -26432803,6148329,-17184412,-14474154,18782929,-275997,-22561534,211300,2719757,4940997 },
+ { -1323882,3911313,-6948744,14759765,-30027150,7851207,21690126,8518463,26699843,5276295 },
+ { -13149873,-6429067,9396249,365013,24703301,-10488939,1321586,149635,-15452774,7159369 },
+ },
+ {
+ { 9987780,-3404759,17507962,9505530,9731535,-2165514,22356009,8312176,22477218,-8403385 },
+ { 18155857,-16504990,19744716,9006923,15154154,-10538976,24256460,-4864995,-22548173,9334109 },
+ { 2986088,-4911893,10776628,-3473844,10620590,-7083203,-21413845,14253545,-22587149,536906 },
+ },
+ {
+ { 4377756,8115836,24567078,15495314,11625074,13064599,7390551,10589625,10838060,-15420424 },
+ { -19342404,867880,9277171,-3218459,-14431572,-1986443,19295826,-15796950,6378260,699185 },
+ { 7895026,4057113,-7081772,-13077756,-17886831,-323126,-716039,15693155,-5045064,-13373962 },
+ },
+ {
+ { -7737563,-5869402,-14566319,-7406919,11385654,13201616,31730678,-10962840,-3918636,-9669325 },
+ { 10188286,-15770834,-7336361,13427543,22223443,14896287,30743455,7116568,-21786507,5427593 },
+ { 696102,13206899,27047647,-10632082,15285305,-9853179,10798490,-4578720,19236243,12477404 },
+ },
+ {
+ { -11229439,11243796,-17054270,-8040865,-788228,-8167967,-3897669,11180504,-23169516,7733644 },
+ { 17800790,-14036179,-27000429,-11766671,23887827,3149671,23466177,-10538171,10322027,15313801 },
+ { 26246234,11968874,32263343,-5468728,6830755,-13323031,-15794704,-101982,-24449242,10890804 },
+ },
+ {
+ { -31365647,10271363,-12660625,-6267268,16690207,-13062544,-14982212,16484931,25180797,-5334884 },
+ { -586574,10376444,-32586414,-11286356,19801893,10997610,2276632,9482883,316878,13820577 },
+ { -9882808,-4510367,-2115506,16457136,-11100081,11674996,30756178,-7515054,30696930,-3712849 },
+ },
+ {
+ { 32988917,-9603412,12499366,7910787,-10617257,-11931514,-7342816,-9985397,-32349517,7392473 },
+ { -8855661,15927861,9866406,-3649411,-2396914,-16655781,-30409476,-9134995,25112947,-2926644 },
+ { -2504044,-436966,25621774,-5678772,15085042,-5479877,-24884878,-13526194,5537438,-13914319 },
+ },
+},
+{
+ {
+ { -11225584,2320285,-9584280,10149187,-33444663,5808648,-14876251,-1729667,31234590,6090599 },
+ { -9633316,116426,26083934,2897444,-6364437,-2688086,609721,15878753,-6970405,-9034768 },
+ { -27757857,247744,-15194774,-9002551,23288161,-10011936,-23869595,6503646,20650474,1804084 },
+ },
+ {
+ { -27589786,15456424,8972517,8469608,15640622,4439847,3121995,-10329713,27842616,-202328 },
+ { -15306973,2839644,22530074,10026331,4602058,5048462,28248656,5031932,-11375082,12714369 },
+ { 20807691,-7270825,29286141,11421711,-27876523,-13868230,-21227475,1035546,-19733229,12796920 },
+ },
+ {
+ { 12076899,-14301286,-8785001,-11848922,-25012791,16400684,-17591495,-12899438,3480665,-15182815 },
+ { -32361549,5457597,28548107,7833186,7303070,-11953545,-24363064,-15921875,-33374054,2771025 },
+ { -21389266,421932,26597266,6860826,22486084,-6737172,-17137485,-4210226,-24552282,15673397 },
+ },
+ {
+ { -20184622,2338216,19788685,-9620956,-4001265,-8740893,-20271184,4733254,3727144,-12934448 },
+ { 6120119,814863,-11794402,-622716,6812205,-15747771,2019594,7975683,31123697,-10958981 },
+ { 30069250,-11435332,30434654,2958439,18399564,-976289,12296869,9204260,-16432438,9648165 },
+ },
+ {
+ { 32705432,-1550977,30705658,7451065,-11805606,9631813,3305266,5248604,-26008332,-11377501 },
+ { 17219865,2375039,-31570947,-5575615,-19459679,9219903,294711,15298639,2662509,-16297073 },
+ { -1172927,-7558695,-4366770,-4287744,-21346413,-8434326,32087529,-1222777,32247248,-14389861 },
+ },
+ {
+ { 14312628,1221556,17395390,-8700143,-4945741,-8684635,-28197744,-9637817,-16027623,-13378845 },
+ { -1428825,-9678990,-9235681,6549687,-7383069,-468664,23046502,9803137,17597934,2346211 },
+ { 18510800,15337574,26171504,981392,-22241552,7827556,-23491134,-11323352,3059833,-11782870 },
+ },
+ {
+ { 10141598,6082907,17829293,-1947643,9830092,13613136,-25556636,-5544586,-33502212,3592096 },
+ { 33114168,-15889352,-26525686,-13343397,33076705,8716171,1151462,1521897,-982665,-6837803 },
+ { -32939165,-4255815,23947181,-324178,-33072974,-12305637,-16637686,3891704,26353178,693168 },
+ },
+ {
+ { 30374239,1595580,-16884039,13186931,4600344,406904,9585294,-400668,31375464,14369965 },
+ { -14370654,-7772529,1510301,6434173,-18784789,-6262728,32732230,-13108839,17901441,16011505 },
+ { 18171223,-11934626,-12500402,15197122,-11038147,-15230035,-19172240,-16046376,8764035,12309598 },
+ },
+},
+{
+ {
+ { 5975908,-5243188,-19459362,-9681747,-11541277,14015782,-23665757,1228319,17544096,-10593782 },
+ { 5811932,-1715293,3442887,-2269310,-18367348,-8359541,-18044043,-15410127,-5565381,12348900 },
+ { -31399660,11407555,25755363,6891399,-3256938,14872274,-24849353,8141295,-10632534,-585479 },
+ },
+ {
+ { -12675304,694026,-5076145,13300344,14015258,-14451394,-9698672,-11329050,30944593,1130208 },
+ { 8247766,-6710942,-26562381,-7709309,-14401939,-14648910,4652152,2488540,23550156,-271232 },
+ { 17294316,-3788438,7026748,15626851,22990044,113481,2267737,-5908146,-408818,-137719 },
+ },
+ {
+ { 16091085,-16253926,18599252,7340678,2137637,-1221657,-3364161,14550936,3260525,-7166271 },
+ { -4910104,-13332887,18550887,10864893,-16459325,-7291596,-23028869,-13204905,-12748722,2701326 },
+ { -8574695,16099415,4629974,-16340524,-20786213,-6005432,-10018363,9276971,11329923,1862132 },
+ },
+ {
+ { 14763076,-15903608,-30918270,3689867,3511892,10313526,-21951088,12219231,-9037963,-940300 },
+ { 8894987,-3446094,6150753,3013931,301220,15693451,-31981216,-2909717,-15438168,11595570 },
+ { 15214962,3537601,-26238722,-14058872,4418657,-15230761,13947276,10730794,-13489462,-4363670 },
+ },
+ {
+ { -2538306,7682793,32759013,263109,-29984731,-7955452,-22332124,-10188635,977108,699994 },
+ { -12466472,4195084,-9211532,550904,-15565337,12917920,19118110,-439841,-30534533,-14337913 },
+ { 31788461,-14507657,4799989,7372237,8808585,-14747943,9408237,-10051775,12493932,-5409317 },
+ },
+ {
+ { -25680606,5260744,-19235809,-6284470,-3695942,16566087,27218280,2607121,29375955,6024730 },
+ { 842132,-2794693,-4763381,-8722815,26332018,-12405641,11831880,6985184,-9940361,2854096 },
+ { -4847262,-7969331,2516242,-5847713,9695691,-7221186,16512645,960770,12121869,16648078 },
+ },
+ {
+ { -15218652,14667096,-13336229,2013717,30598287,-464137,-31504922,-7882064,20237806,2838411 },
+ { -19288047,4453152,15298546,-16178388,22115043,-15972604,12544294,-13470457,1068881,-12499905 },
+ { -9558883,-16518835,33238498,13506958,30505848,-1114596,-8486907,-2630053,12521378,4845654 },
+ },
+ {
+ { -28198521,10744108,-2958380,10199664,7759311,-13088600,3409348,-873400,-6482306,-12885870 },
+ { -23561822,6230156,-20382013,10655314,-24040585,-11621172,10477734,-1240216,-3113227,13974498 },
+ { 12966261,15550616,-32038948,-1615346,21025980,-629444,5642325,7188737,18895762,12629579 },
+ },
+},
+{
+ {
+ { 14741879,-14946887,22177208,-11721237,1279741,8058600,11758140,789443,32195181,3895677 },
+ { 10758205,15755439,-4509950,9243698,-4879422,6879879,-2204575,-3566119,-8982069,4429647 },
+ { -2453894,15725973,-20436342,-10410672,-5803908,-11040220,-7135870,-11642895,18047436,-15281743 },
+ },
+ {
+ { -25173001,-11307165,29759956,11776784,-22262383,-15820455,10993114,-12850837,-17620701,-9408468 },
+ { 21987233,700364,-24505048,14972008,-7774265,-5718395,32155026,2581431,-29958985,8773375 },
+ { -25568350,454463,-13211935,16126715,25240068,8594567,20656846,12017935,-7874389,-13920155 },
+ },
+ {
+ { 6028182,6263078,-31011806,-11301710,-818919,2461772,-31841174,-5468042,-1721788,-2776725 },
+ { -12278994,16624277,987579,-5922598,32908203,1248608,7719845,-4166698,28408820,6816612 },
+ { -10358094,-8237829,19549651,-12169222,22082623,16147817,20613181,13982702,-10339570,5067943 },
+ },
+ {
+ { -30505967,-3821767,12074681,13582412,-19877972,2443951,-19719286,12746132,5331210,-10105944 },
+ { 30528811,3601899,-1957090,4619785,-27361822,-15436388,24180793,-12570394,27679908,-1648928 },
+ { 9402404,-13957065,32834043,10838634,-26580150,-13237195,26653274,-8685565,22611444,-12715406 },
+ },
+ {
+ { 22190590,1118029,22736441,15130463,-30460692,-5991321,19189625,-4648942,4854859,6622139 },
+ { -8310738,-2953450,-8262579,-3388049,-10401731,-271929,13424426,-3567227,26404409,13001963 },
+ { -31241838,-15415700,-2994250,8939346,11562230,-12840670,-26064365,-11621720,-15405155,11020693 },
+ },
+ {
+ { 1866042,-7949489,-7898649,-10301010,12483315,13477547,3175636,-12424163,28761762,1406734 },
+ { -448555,-1777666,13018551,3194501,-9580420,-11161737,24760585,-4347088,25577411,-13378680 },
+ { -24290378,4759345,-690653,-1852816,2066747,10693769,-29595790,9884936,-9368926,4745410 },
+ },
+ {
+ { -9141284,6049714,-19531061,-4341411,-31260798,9944276,-15462008,-11311852,10931924,-11931931 },
+ { -16561513,14112680,-8012645,4817318,-8040464,-11414606,-22853429,10856641,-20470770,13434654 },
+ { 22759489,-10073434,-16766264,-1871422,13637442,-10168091,1765144,-12654326,28445307,-5364710 },
+ },
+ {
+ { 29875063,12493613,2795536,-3786330,1710620,15181182,-10195717,-8788675,9074234,1167180 },
+ { -26205683,11014233,-9842651,-2635485,-26908120,7532294,-18716888,-9535498,3843903,9367684 },
+ { -10969595,-6403711,9591134,9582310,11349256,108879,16235123,8601684,-139197,4242895 },
+ },
+},
+{
+ {
+ { 22092954,-13191123,-2042793,-11968512,32186753,-11517388,-6574341,2470660,-27417366,16625501 },
+ { -11057722,3042016,13770083,-9257922,584236,-544855,-7770857,2602725,-27351616,14247413 },
+ { 6314175,-10264892,-32772502,15957557,-10157730,168750,-8618807,14290061,27108877,-1180880 },
+ },
+ {
+ { -8586597,-7170966,13241782,10960156,-32991015,-13794596,33547976,-11058889,-27148451,981874 },
+ { 22833440,9293594,-32649448,-13618667,-9136966,14756819,-22928859,-13970780,-10479804,-16197962 },
+ { -7768587,3326786,-28111797,10783824,19178761,14905060,22680049,13906969,-15933690,3797899 },
+ },
+ {
+ { 21721356,-4212746,-12206123,9310182,-3882239,-13653110,23740224,-2709232,20491983,-8042152 },
+ { 9209270,-15135055,-13256557,-6167798,-731016,15289673,25947805,15286587,30997318,-6703063 },
+ { 7392032,16618386,23946583,-8039892,-13265164,-1533858,-14197445,-2321576,17649998,-250080 },
+ },
+ {
+ { -9301088,-14193827,30609526,-3049543,-25175069,-1283752,-15241566,-9525724,-2233253,7662146 },
+ { -17558673,1763594,-33114336,15908610,-30040870,-12174295,7335080,-8472199,-3174674,3440183 },
+ { -19889700,-5977008,-24111293,-9688870,10799743,-16571957,40450,-4431835,4862400,1133 },
+ },
+ {
+ { -32856209,-7873957,-5422389,14860950,-16319031,7956142,7258061,311861,-30594991,-7379421 },
+ { -3773428,-1565936,28985340,7499440,24445838,9325937,29727763,16527196,18278453,15405622 },
+ { -4381906,8508652,-19898366,-3674424,-5984453,15149970,-13313598,843523,-21875062,13626197 },
+ },
+ {
+ { 2281448,-13487055,-10915418,-2609910,1879358,16164207,-10783882,3953792,13340839,15928663 },
+ { 31727126,-7179855,-18437503,-8283652,2875793,-16390330,-25269894,-7014826,-23452306,5964753 },
+ { 4100420,-5959452,-17179337,6017714,-18705837,12227141,-26684835,11344144,2538215,-7570755 },
+ },
+ {
+ { -9433605,6123113,11159803,-2156608,30016280,14966241,-20474983,1485421,-629256,-15958862 },
+ { -26804558,4260919,11851389,9658551,-32017107,16367492,-20205425,-13191288,11659922,-11115118 },
+ { 26180396,10015009,-30844224,-8581293,5418197,9480663,2231568,-10170080,33100372,-1306171 },
+ },
+ {
+ { 15121113,-5201871,-10389905,15427821,-27509937,-15992507,21670947,4486675,-5931810,-14466380 },
+ { 16166486,-9483733,-11104130,6023908,-31926798,-1364923,2340060,-16254968,-10735770,-10039824 },
+ { 28042865,-3557089,-12126526,12259706,-3717498,-6945899,6766453,-8689599,18036436,5803270 },
+ },
+},
+{
+ {
+ { -817581,6763912,11803561,1585585,10958447,-2671165,23855391,4598332,-6159431,-14117438 },
+ { -31031306,-14256194,17332029,-2383520,31312682,-5967183,696309,50292,-20095739,11763584 },
+ { -594563,-2514283,-32234153,12643980,12650761,14811489,665117,-12613632,-19773211,-10713562 },
+ },
+ {
+ { 30464590,-11262872,-4127476,-12734478,19835327,-7105613,-24396175,2075773,-17020157,992471 },
+ { 18357185,-6994433,7766382,16342475,-29324918,411174,14578841,8080033,-11574335,-10601610 },
+ { 19598397,10334610,12555054,2555664,18821899,-10339780,21873263,16014234,26224780,16452269 },
+ },
+ {
+ { -30223925,5145196,5944548,16385966,3976735,2009897,-11377804,-7618186,-20533829,3698650 },
+ { 14187449,3448569,-10636236,-10810935,-22663880,-3433596,7268410,-10890444,27394301,12015369 },
+ { 19695761,16087646,28032085,12999827,6817792,11427614,20244189,-1312777,-13259127,-3402461 },
+ },
+ {
+ { 30860103,12735208,-1888245,-4699734,-16974906,2256940,-8166013,12298312,-8550524,-10393462 },
+ { -5719826,-11245325,-1910649,15569035,26642876,-7587760,-5789354,-15118654,-4976164,12651793 },
+ { -2848395,9953421,11531313,-5282879,26895123,-12697089,-13118820,-16517902,9768698,-2533218 },
+ },
+ {
+ { -24719459,1894651,-287698,-4704085,15348719,-8156530,32767513,12765450,4940095,10678226 },
+ { 18860224,15980149,-18987240,-1562570,-26233012,-11071856,-7843882,13944024,-24372348,16582019 },
+ { -15504260,4970268,-29893044,4175593,-20993212,-2199756,-11704054,15444560,-11003761,7989037 },
+ },
+ {
+ { 31490452,5568061,-2412803,2182383,-32336847,4531686,-32078269,6200206,-19686113,-14800171 },
+ { -17308668,-15879940,-31522777,-2831,-32887382,16375549,8680158,-16371713,28550068,-6857132 },
+ { -28126887,-5688091,16837845,-1820458,-6850681,12700016,-30039981,4364038,1155602,5988841 },
+ },
+ {
+ { 21890435,-13272907,-12624011,12154349,-7831873,15300496,23148983,-4470481,24618407,8283181 },
+ { -33136107,-10512751,9975416,6841041,-31559793,16356536,3070187,-7025928,1466169,10740210 },
+ { -1509399,-15488185,-13503385,-10655916,32799044,909394,-13938903,-5779719,-32164649,-15327040 },
+ },
+ {
+ { 3960823,-14267803,-28026090,-15918051,-19404858,13146868,15567327,951507,-3260321,-573935 },
+ { 24740841,5052253,-30094131,8961361,25877428,6165135,-24368180,14397372,-7380369,-6144105 },
+ { -28888365,3510803,-28103278,-1158478,-11238128,-10631454,-15441463,-14453128,-1625486,-6494814 },
+ },
+},
+{
+ {
+ { 793299,-9230478,8836302,-6235707,-27360908,-2369593,33152843,-4885251,-9906200,-621852 },
+ { 5666233,525582,20782575,-8038419,-24538499,14657740,16099374,1468826,-6171428,-15186581 },
+ { -4859255,-3779343,-2917758,-6748019,7778750,11688288,-30404353,-9871238,-1558923,-9863646 },
+ },
+ {
+ { 10896332,-7719704,824275,472601,-19460308,3009587,25248958,14783338,-30581476,-15757844 },
+ { 10566929,12612572,-31944212,11118703,-12633376,12362879,21752402,8822496,24003793,14264025 },
+ { 27713862,-7355973,-11008240,9227530,27050101,2504721,23886875,-13117525,13958495,-5732453 },
+ },
+ {
+ { -23481610,4867226,-27247128,3900521,29838369,-8212291,-31889399,-10041781,7340521,-15410068 },
+ { 4646514,-8011124,-22766023,-11532654,23184553,8566613,31366726,-1381061,-15066784,-10375192 },
+ { -17270517,12723032,-16993061,14878794,21619651,-6197576,27584817,3093888,-8843694,3849921 },
+ },
+ {
+ { -9064912,2103172,25561640,-15125738,-5239824,9582958,32477045,-9017955,5002294,-15550259 },
+ { -12057553,-11177906,21115585,-13365155,8808712,-12030708,16489530,13378448,-25845716,12741426 },
+ { -5946367,10645103,-30911586,15390284,-3286982,-7118677,24306472,15852464,28834118,-7646072 },
+ },
+ {
+ { -17335748,-9107057,-24531279,9434953,-8472084,-583362,-13090771,455841,20461858,5491305 },
+ { 13669248,-16095482,-12481974,-10203039,-14569770,-11893198,-24995986,11293807,-28588204,-9421832 },
+ { 28497928,6272777,-33022994,14470570,8906179,-1225630,18504674,-14165166,29867745,-8795943 },
+ },
+ {
+ { -16207023,13517196,-27799630,-13697798,24009064,-6373891,-6367600,-13175392,22853429,-4012011 },
+ { 24191378,16712145,-13931797,15217831,14542237,1646131,18603514,-11037887,12876623,-2112447 },
+ { 17902668,4518229,-411702,-2829247,26878217,5258055,-12860753,608397,16031844,3723494 },
+ },
+ {
+ { -28632773,12763728,-20446446,7577504,33001348,-13017745,17558842,-7872890,23896954,-4314245 },
+ { -20005381,-12011952,31520464,605201,2543521,5991821,-2945064,7229064,-9919646,-8826859 },
+ { 28816045,298879,-28165016,-15920938,19000928,-1665890,-12680833,-2949325,-18051778,-2082915 },
+ },
+ {
+ { 16000882,-344896,3493092,-11447198,-29504595,-13159789,12577740,16041268,-19715240,7847707 },
+ { 10151868,10572098,27312476,7922682,14825339,4723128,-32855931,-6519018,-10020567,3852848 },
+ { -11430470,15697596,-21121557,-4420647,5386314,15063598,16514493,-15932110,29330899,-15076224 },
+ },
+},
+{
+ {
+ { -25499735,-4378794,-15222908,-6901211,16615731,2051784,3303702,15490,-27548796,12314391 },
+ { 15683520,-6003043,18109120,-9980648,15337968,-5997823,-16717435,15921866,16103996,-3731215 },
+ { -23169824,-10781249,13588192,-1628807,-3798557,-1074929,-19273607,5402699,-29815713,-9841101 },
+ },
+ {
+ { 23190676,2384583,-32714340,3462154,-29903655,-1529132,-11266856,8911517,-25205859,2739713 },
+ { 21374101,-3554250,-33524649,9874411,15377179,11831242,-33529904,6134907,4931255,11987849 },
+ { -7732,-2978858,-16223486,7277597,105524,-322051,-31480539,13861388,-30076310,10117930 },
+ },
+ {
+ { -29501170,-10744872,-26163768,13051539,-25625564,5089643,-6325503,6704079,12890019,15728940 },
+ { -21972360,-11771379,-951059,-4418840,14704840,2695116,903376,-10428139,12885167,8311031 },
+ { -17516482,5352194,10384213,-13811658,7506451,13453191,26423267,4384730,1888765,-5435404 },
+ },
+ {
+ { -25817338,-3107312,-13494599,-3182506,30896459,-13921729,-32251644,-12707869,-19464434,-3340243 },
+ { -23607977,-2665774,-526091,4651136,5765089,4618330,6092245,14845197,17151279,-9854116 },
+ { -24830458,-12733720,-15165978,10367250,-29530908,-265356,22825805,-7087279,-16866484,16176525 },
+ },
+ {
+ { -23583256,6564961,20063689,3798228,-4740178,7359225,2006182,-10363426,-28746253,-10197509 },
+ { -10626600,-4486402,-13320562,-5125317,3432136,-6393229,23632037,-1940610,32808310,1099883 },
+ { 15030977,5768825,-27451236,-2887299,-6427378,-15361371,-15277896,-6809350,2051441,-15225865 },
+ },
+ {
+ { -3362323,-7239372,7517890,9824992,23555850,295369,5148398,-14154188,-22686354,16633660 },
+ { 4577086,-16752288,13249841,-15304328,19958763,-14537274,18559670,-10759549,8402478,-9864273 },
+ { -28406330,-1051581,-26790155,-907698,-17212414,-11030789,9453451,-14980072,17983010,9967138 },
+ },
+ {
+ { -25762494,6524722,26585488,9969270,24709298,1220360,-1677990,7806337,17507396,3651560 },
+ { -10420457,-4118111,14584639,15971087,-15768321,8861010,26556809,-5574557,-18553322,-11357135 },
+ { 2839101,14284142,4029895,3472686,14402957,12689363,-26642121,8459447,-5605463,-7621941 },
+ },
+ {
+ { -4839289,-3535444,9744961,2871048,25113978,3187018,-25110813,-849066,17258084,-7977739 },
+ { 18164541,-10595176,-17154882,-1542417,19237078,-9745295,23357533,-15217008,26908270,12150756 },
+ { -30264870,-7647865,5112249,-7036672,-1499807,-6974257,43168,-5537701,-32302074,16215819 },
+ },
+},
+{
+ {
+ { -6898905,9824394,-12304779,-4401089,-31397141,-6276835,32574489,12532905,-7503072,-8675347 },
+ { -27343522,-16515468,-27151524,-10722951,946346,16291093,254968,7168080,21676107,-1943028 },
+ { 21260961,-8424752,-16831886,-11920822,-23677961,3968121,-3651949,-6215466,-3556191,-7913075 },
+ },
+ {
+ { 16544754,13250366,-16804428,15546242,-4583003,12757258,-2462308,-8680336,-18907032,-9662799 },
+ { -2415239,-15577728,18312303,4964443,-15272530,-12653564,26820651,16690659,25459437,-4564609 },
+ { -25144690,11425020,28423002,-11020557,-6144921,-15826224,9142795,-2391602,-6432418,-1644817 },
+ },
+ {
+ { -23104652,6253476,16964147,-3768872,-25113972,-12296437,-27457225,-16344658,6335692,7249989 },
+ { -30333227,13979675,7503222,-12368314,-11956721,-4621693,-30272269,2682242,25993170,-12478523 },
+ { 4364628,5930691,32304656,-10044554,-8054781,15091131,22857016,-10598955,31820368,15075278 },
+ },
+ {
+ { 31879134,-8918693,17258761,90626,-8041836,-4917709,24162788,-9650886,-17970238,12833045 },
+ { 19073683,14851414,-24403169,-11860168,7625278,11091125,-19619190,2074449,-9413939,14905377 },
+ { 24483667,-11935567,-2518866,-11547418,-1553130,15355506,-25282080,9253129,27628530,-7555480 },
+ },
+ {
+ { 17597607,8340603,19355617,552187,26198470,-3176583,4593324,-9157582,-14110875,15297016 },
+ { 510886,14337390,-31785257,16638632,6328095,2713355,-20217417,-11864220,8683221,2921426 },
+ { 18606791,11874196,27155355,-5281482,-24031742,6265446,-25178240,-1278924,4674690,13890525 },
+ },
+ {
+ { 13609624,13069022,-27372361,-13055908,24360586,9592974,14977157,9835105,4389687,288396 },
+ { 9922506,-519394,13613107,5883594,-18758345,-434263,-12304062,8317628,23388070,16052080 },
+ { 12720016,11937594,-31970060,-5028689,26900120,8561328,-20155687,-11632979,-14754271,-10812892 },
+ },
+ {
+ { 15961858,14150409,26716931,-665832,-22794328,13603569,11829573,7467844,-28822128,929275 },
+ { 11038231,-11582396,-27310482,-7316562,-10498527,-16307831,-23479533,-9371869,-21393143,2465074 },
+ { 20017163,-4323226,27915242,1529148,12396362,15675764,13817261,-9658066,2463391,-4622140 },
+ },
+ {
+ { -16358878,-12663911,-12065183,4996454,-1256422,1073572,9583558,12851107,4003896,12673717 },
+ { -1731589,-15155870,-3262930,16143082,19294135,13385325,14741514,-9103726,7903886,2348101 },
+ { 24536016,-16515207,12715592,-3862155,1511293,10047386,-3842346,-7129159,-28377538,10048127 },
+ },
+},
+{
+ {
+ { -12622226,-6204820,30718825,2591312,-10617028,12192840,18873298,-7297090,-32297756,15221632 },
+ { -26478122,-11103864,11546244,-1852483,9180880,7656409,-21343950,2095755,29769758,6593415 },
+ { -31994208,-2907461,4176912,3264766,12538965,-868111,26312345,-6118678,30958054,8292160 },
+ },
+ {
+ { 31429822,-13959116,29173532,15632448,12174511,-2760094,32808831,3977186,26143136,-3148876 },
+ { 22648901,1402143,-22799984,13746059,7936347,365344,-8668633,-1674433,-3758243,-2304625 },
+ { -15491917,8012313,-2514730,-12702462,-23965846,-10254029,-1612713,-1535569,-16664475,8194478 },
+ },
+ {
+ { 27338066,-7507420,-7414224,10140405,-19026427,-6589889,27277191,8855376,28572286,3005164 },
+ { 26287124,4821776,25476601,-4145903,-3764513,-15788984,-18008582,1182479,-26094821,-13079595 },
+ { -7171154,3178080,23970071,6201893,-17195577,-4489192,-21876275,-13982627,32208683,-1198248 },
+ },
+ {
+ { -16657702,2817643,-10286362,14811298,6024667,13349505,-27315504,-10497842,-27672585,-11539858 },
+ { 15941029,-9405932,-21367050,8062055,31876073,-238629,-15278393,-1444429,15397331,-4130193 },
+ { 8934485,-13485467,-23286397,-13423241,-32446090,14047986,31170398,-1441021,-27505566,15087184 },
+ },
+ {
+ { -18357243,-2156491,24524913,-16677868,15520427,-6360776,-15502406,11461896,16788528,-5868942 },
+ { -1947386,16013773,21750665,3714552,-17401782,-16055433,-3770287,-10323320,31322514,-11615635 },
+ { 21426655,-5650218,-13648287,-5347537,-28812189,-4920970,-18275391,-14621414,13040862,-12112948 },
+ },
+ {
+ { 11293895,12478086,-27136401,15083750,-29307421,14748872,14555558,-13417103,1613711,4896935 },
+ { -25894883,15323294,-8489791,-8057900,25967126,-13425460,2825960,-4897045,-23971776,-11267415 },
+ { -15924766,-5229880,-17443532,6410664,3622847,10243618,20615400,12405433,-23753030,-8436416 },
+ },
+ {
+ { -7091295,12556208,-20191352,9025187,-17072479,4333801,4378436,2432030,23097949,-566018 },
+ { 4565804,-16025654,20084412,-7842817,1724999,189254,24767264,10103221,-18512313,2424778 },
+ { 366633,-11976806,8173090,-6890119,30788634,5745705,-7168678,1344109,-3642553,12412659 },
+ },
+ {
+ { -24001791,7690286,14929416,-168257,-32210835,-13412986,24162697,-15326504,-3141501,11179385 },
+ { 18289522,-14724954,8056945,16430056,-21729724,7842514,-6001441,-1486897,-18684645,-11443503 },
+ { 476239,6601091,-6152790,-9723375,17503545,-4863900,27672959,13403813,11052904,5219329 },
+ },
+},
+{
+ {
+ { 20678546,-8375738,-32671898,8849123,-5009758,14574752,31186971,-3973730,9014762,-8579056 },
+ { -13644050,-10350239,-15962508,5075808,-1514661,-11534600,-33102500,9160280,8473550,-3256838 },
+ { 24900749,14435722,17209120,-15292541,-22592275,9878983,-7689309,-16335821,-24568481,11788948 },
+ },
+ {
+ { -3118155,-11395194,-13802089,14797441,9652448,-6845904,-20037437,10410733,-24568470,-1458691 },
+ { -15659161,16736706,-22467150,10215878,-9097177,7563911,11871841,-12505194,-18513325,8464118 },
+ { -23400612,8348507,-14585951,-861714,-3950205,-6373419,14325289,8628612,33313881,-8370517 },
+ },
+ {
+ { -20186973,-4967935,22367356,5271547,-1097117,-4788838,-24805667,-10236854,-8940735,-5818269 },
+ { -6948785,-1795212,-32625683,-16021179,32635414,-7374245,15989197,-12838188,28358192,-4253904 },
+ { -23561781,-2799059,-32351682,-1661963,-9147719,10429267,-16637684,4072016,-5351664,5596589 },
+ },
+ {
+ { -28236598,-3390048,12312896,6213178,3117142,16078565,29266239,2557221,1768301,15373193 },
+ { -7243358,-3246960,-4593467,-7553353,-127927,-912245,-1090902,-4504991,-24660491,3442910 },
+ { -30210571,5124043,14181784,8197961,18964734,-11939093,22597931,7176455,-18585478,13365930 },
+ },
+ {
+ { -7877390,-1499958,8324673,4690079,6261860,890446,24538107,-8570186,-9689599,-3031667 },
+ { 25008904,-10771599,-4305031,-9638010,16265036,15721635,683793,-11823784,15723479,-15163481 },
+ { -9660625,12374379,-27006999,-7026148,-7724114,-12314514,11879682,5400171,519526,-1235876 },
+ },
+ {
+ { 22258397,-16332233,-7869817,14613016,-22520255,-2950923,-20353881,7315967,16648397,7605640 },
+ { -8081308,-8464597,-8223311,9719710,19259459,-15348212,23994942,-5281555,-9468848,4763278 },
+ { -21699244,9220969,-15730624,1084137,-25476107,-2852390,31088447,-7764523,-11356529,728112 },
+ },
+ {
+ { 26047220,-11751471,-6900323,-16521798,24092068,9158119,-4273545,-12555558,-29365436,-5498272 },
+ { 17510331,-322857,5854289,8403524,17133918,-3112612,-28111007,12327945,10750447,10014012 },
+ { -10312768,3936952,9156313,-8897683,16498692,-994647,-27481051,-666732,3424691,7540221 },
+ },
+ {
+ { 30322361,-6964110,11361005,-4143317,7433304,4989748,-7071422,-16317219,-9244265,15258046 },
+ { 13054562,-2779497,19155474,469045,-12482797,4566042,5631406,2711395,1062915,-5136345 },
+ { -19240248,-11254599,-29509029,-7499965,-5835763,13005411,-6066489,12194497,32960380,1459310 },
+ },
+},
+{
+ {
+ { 19852034,7027924,23669353,10020366,8586503,-6657907,394197,-6101885,18638003,-11174937 },
+ { 31395534,15098109,26581030,8030562,-16527914,-5007134,9012486,-7584354,-6643087,-5442636 },
+ { -9192165,-2347377,-1997099,4529534,25766844,607986,-13222,9677543,-32294889,-6456008 },
+ },
+ {
+ { -2444496,-149937,29348902,8186665,1873760,12489863,-30934579,-7839692,-7852844,-8138429 },
+ { -15236356,-15433509,7766470,746860,26346930,-10221762,-27333451,10754588,-9431476,5203576 },
+ { 31834314,14135496,-770007,5159118,20917671,-16768096,-7467973,-7337524,31809243,7347066 },
+ },
+ {
+ { -9606723,-11874240,20414459,13033986,13716524,-11691881,19797970,-12211255,15192876,-2087490 },
+ { -12663563,-2181719,1168162,-3804809,26747877,-14138091,10609330,12694420,33473243,-13382104 },
+ { 33184999,11180355,15832085,-11385430,-1633671,225884,15089336,-11023903,-6135662,14480053 },
+ },
+ {
+ { 31308717,-5619998,31030840,-1897099,15674547,-6582883,5496208,13685227,27595050,8737275 },
+ { -20318852,-15150239,10933843,-16178022,8335352,-7546022,-31008351,-12610604,26498114,66511 },
+ { 22644454,-8761729,-16671776,4884562,-3105614,-13559366,30540766,-4286747,-13327787,-7515095 },
+ },
+ {
+ { -28017847,9834845,18617207,-2681312,-3401956,-13307506,8205540,13585437,-17127465,15115439 },
+ { 23711543,-672915,31206561,-8362711,6164647,-9709987,-33535882,-1426096,8236921,16492939 },
+ { -23910559,-13515526,-26299483,-4503841,25005590,-7687270,19574902,10071562,6708380,-6222424 },
+ },
+ {
+ { 2101391,-4930054,19702731,2367575,-15427167,1047675,5301017,9328700,29955601,-11678310 },
+ { 3096359,9271816,-21620864,-15521844,-14847996,-7592937,-25892142,-12635595,-9917575,6216608 },
+ { -32615849,338663,-25195611,2510422,-29213566,-13820213,24822830,-6146567,-26767480,7525079 },
+ },
+ {
+ { -23066649,-13985623,16133487,-7896178,-3389565,778788,-910336,-2782495,-19386633,11994101 },
+ { 21691500,-13624626,-641331,-14367021,3285881,-3483596,-25064666,9718258,-7477437,13381418 },
+ { 18445390,-4202236,14979846,11622458,-1727110,-3582980,23111648,-6375247,28535282,15779576 },
+ },
+ {
+ { 30098053,3089662,-9234387,16662135,-21306940,11308411,-14068454,12021730,9955285,-16303356 },
+ { 9734894,-14576830,-7473633,-9138735,2060392,11313496,-18426029,9924399,20194861,13380996 },
+ { -26378102,-7965207,-22167821,15789297,-18055342,-6168792,-1984914,15707771,26342023,10146099 },
+ },
+},
+{
+ {
+ { -26016874,-219943,21339191,-41388,19745256,-2878700,-29637280,2227040,21612326,-545728 },
+ { -13077387,1184228,23562814,-5970442,-20351244,-6348714,25764461,12243797,-20856566,11649658 },
+ { -10031494,11262626,27384172,2271902,26947504,-15997771,39944,6114064,33514190,2333242 },
+ },
+ {
+ { -21433588,-12421821,8119782,7219913,-21830522,-9016134,-6679750,-12670638,24350578,-13450001 },
+ { -4116307,-11271533,-23886186,4843615,-30088339,690623,-31536088,-10406836,8317860,12352766 },
+ { 18200138,-14475911,-33087759,-2696619,-23702521,-9102511,-23552096,-2287550,20712163,6719373 },
+ },
+ {
+ { 26656208,6075253,-7858556,1886072,-28344043,4262326,11117530,-3763210,26224235,-3297458 },
+ { -17168938,-14854097,-3395676,-16369877,-19954045,14050420,21728352,9493610,18620611,-16428628 },
+ { -13323321,13325349,11432106,5964811,18609221,6062965,-5269471,-9725556,-30701573,-16479657 },
+ },
+ {
+ { -23860538,-11233159,26961357,1640861,-32413112,-16737940,12248509,-5240639,13735342,1934062 },
+ { 25089769,6742589,17081145,-13406266,21909293,-16067981,-15136294,-3765346,-21277997,5473616 },
+ { 31883677,-7961101,1083432,-11572403,22828471,13290673,-7125085,12469656,29111212,-5451014 },
+ },
+ {
+ { 24244947,-15050407,-26262976,2791540,-14997599,16666678,24367466,6388839,-10295587,452383 },
+ { -25640782,-3417841,5217916,16224624,19987036,-4082269,-24236251,-5915248,15766062,8407814 },
+ { -20406999,13990231,15495425,16395525,5377168,15166495,-8917023,-4388953,-8067909,2276718 },
+ },
+ {
+ { 30157918,12924066,-17712050,9245753,19895028,3368142,-23827587,5096219,22740376,-7303417 },
+ { 2041139,-14256350,7783687,13876377,-25946985,-13352459,24051124,13742383,-15637599,13295222 },
+ { 33338237,-8505733,12532113,7977527,9106186,-1715251,-17720195,-4612972,-4451357,-14669444 },
+ },
+ {
+ { -20045281,5454097,-14346548,6447146,28862071,1883651,-2469266,-4141880,7770569,9620597 },
+ { 23208068,7979712,33071466,8149229,1758231,-10834995,30945528,-1694323,-33502340,-14767970 },
+ { 1439958,-16270480,-1079989,-793782,4625402,10647766,-5043801,1220118,30494170,-11440799 },
+ },
+ {
+ { -5037580,-13028295,-2970559,-3061767,15640974,-6701666,-26739026,926050,-1684339,-13333647 },
+ { 13908495,-3549272,30919928,-6273825,-21521863,7989039,9021034,9078865,3353509,4033511 },
+ { -29663431,-15113610,32259991,-344482,24295849,-12912123,23161163,8839127,27485041,7356032 },
+ },
+},
+{
+ {
+ { 9661027,705443,11980065,-5370154,-1628543,14661173,-6346142,2625015,28431036,-16771834 },
+ { -23839233,-8311415,-25945511,7480958,-17681669,-8354183,-22545972,14150565,15970762,4099461 },
+ { 29262576,16756590,26350592,-8793563,8529671,-11208050,13617293,-9937143,11465739,8317062 },
+ },
+ {
+ { -25493081,-6962928,32500200,-9419051,-23038724,-2302222,14898637,3848455,20969334,-5157516 },
+ { -20384450,-14347713,-18336405,13884722,-33039454,2842114,-21610826,-3649888,11177095,14989547 },
+ { -24496721,-11716016,16959896,2278463,12066309,10137771,13515641,2581286,-28487508,9930240 },
+ },
+ {
+ { -17751622,-2097826,16544300,-13009300,-15914807,-14949081,18345767,-13403753,16291481,-5314038 },
+ { -33229194,2553288,32678213,9875984,8534129,6889387,-9676774,6957617,4368891,9788741 },
+ { 16660756,7281060,-10830758,12911820,20108584,-8101676,-21722536,-8613148,16250552,-11111103 },
+ },
+ {
+ { -19765507,2390526,-16551031,14161980,1905286,6414907,4689584,10604807,-30190403,4782747 },
+ { -1354539,14736941,-7367442,-13292886,7710542,-14155590,-9981571,4383045,22546403,437323 },
+ { 31665577,-12180464,-16186830,1491339,-18368625,3294682,27343084,2786261,-30633590,-14097016 },
+ },
+ {
+ { -14467279,-683715,-33374107,7448552,19294360,14334329,-19690631,2355319,-19284671,-6114373 },
+ { 15121312,-15796162,6377020,-6031361,-10798111,-12957845,18952177,15496498,-29380133,11754228 },
+ { -2637277,-13483075,8488727,-14303896,12728761,-1622493,7141596,11724556,22761615,-10134141 },
+ },
+ {
+ { 16918416,11729663,-18083579,3022987,-31015732,-13339659,-28741185,-12227393,32851222,11717399 },
+ { 11166634,7338049,-6722523,4531520,-29468672,-7302055,31474879,3483633,-1193175,-4030831 },
+ { -185635,9921305,31456609,-13536438,-12013818,13348923,33142652,6546660,-19985279,-3948376 },
+ },
+ {
+ { -32460596,11266712,-11197107,-7899103,31703694,3855903,-8537131,-12833048,-30772034,-15486313 },
+ { -18006477,12709068,3991746,-6479188,-21491523,-10550425,-31135347,-16049879,10928917,3011958 },
+ { -6957757,-15594337,31696059,334240,29576716,14796075,-30831056,-12805180,18008031,10258577 },
+ },
+ {
+ { -22448644,15655569,7018479,-4410003,-30314266,-1201591,-1853465,1367120,25127874,6671743 },
+ { 29701166,-14373934,-10878120,9279288,-17568,13127210,21382910,11042292,25838796,4642684 },
+ { -20430234,14955537,-24126347,8124619,-5369288,-5990470,30468147,-13900640,18423289,4177476 },
+ },
+},
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base2.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base2.h
new file mode 100644
index 00000000..8c538440
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base2.h
@@ -0,0 +1,40 @@
+ {
+ { 25967493,-14356035,29566456,3660896,-12694345,4014787,27544626,-11754271,-6079156,2047605 },
+ { -12545711,934262,-2722910,3049990,-727428,9406986,12720692,5043384,19500929,-15469378 },
+ { -8738181,4489570,9688441,-14785194,10184609,-12363380,29287919,11864899,-24514362,-4438546 },
+ },
+ {
+ { 15636291,-9688557,24204773,-7912398,616977,-16685262,27787600,-14772189,28944400,-1550024 },
+ { 16568933,4717097,-11556148,-1102322,15682896,-11807043,16354577,-11775962,7689662,11199574 },
+ { 30464156,-5976125,-11779434,-15670865,23220365,15915852,7512774,10017326,-17749093,-9920357 },
+ },
+ {
+ { 10861363,11473154,27284546,1981175,-30064349,12577861,32867885,14515107,-15438304,10819380 },
+ { 4708026,6336745,20377586,9066809,-11272109,6594696,-25653668,12483688,-12668491,5581306 },
+ { 19563160,16186464,-29386857,4097519,10237984,-4348115,28542350,13850243,-23678021,-15815942 },
+ },
+ {
+ { 5153746,9909285,1723747,-2777874,30523605,5516873,19480852,5230134,-23952439,-15175766 },
+ { -30269007,-3463509,7665486,10083793,28475525,1649722,20654025,16520125,30598449,7715701 },
+ { 28881845,14381568,9657904,3680757,-20181635,7843316,-31400660,1370708,29794553,-1409300 },
+ },
+ {
+ { -22518993,-6692182,14201702,-8745502,-23510406,8844726,18474211,-1361450,-13062696,13821877 },
+ { -6455177,-7839871,3374702,-4740862,-27098617,-10571707,31655028,-7212327,18853322,-14220951 },
+ { 4566830,-12963868,-28974889,-12240689,-7602672,-2830569,-8514358,-10431137,2207753,-3209784 },
+ },
+ {
+ { -25154831,-4185821,29681144,7868801,-6854661,-9423865,-12437364,-663000,-31111463,-16132436 },
+ { 25576264,-2703214,7349804,-11814844,16472782,9300885,3844789,15725684,171356,6466918 },
+ { 23103977,13316479,9739013,-16149481,817875,-15038942,8965339,-14088058,-30714912,16193877 },
+ },
+ {
+ { -33521811,3180713,-2394130,14003687,-16903474,-16270840,17238398,4729455,-18074513,9256800 },
+ { -25182317,-4174131,32336398,5036987,-21236817,11360617,22616405,9761698,-19827198,630305 },
+ { -13720693,2639453,-24237460,-7406481,9494427,-5774029,-6554551,-15960994,-2449256,-14291300 },
+ },
+ {
+ { -3151181,-5046075,9282714,6866145,-31907062,-863023,-18940575,15033784,25105118,-7894876 },
+ { -24326370,15950226,-31801215,-14592823,-11662737,-5090925,1573892,-2625887,2198790,-15804619 },
+ { -3099351,10324967,-2241613,7453183,-5446979,-2735503,-13812022,-16236442,-32461234,-12290683 },
+ },
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d.h
new file mode 100644
index 00000000..e25f5783
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d.h
@@ -0,0 +1 @@
+-10913610,13857413,-15372611,6949391,114729,-8787816,-6275908,-3247719,-18696448,-12055116
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d2.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d2.h
new file mode 100644
index 00000000..01aaec75
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d2.h
@@ -0,0 +1 @@
+-21827239,-5839606,-30745221,13898782,229458,15978800,-12551817,-6495438,29715968,9444199
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe.h
new file mode 100644
index 00000000..60c308ba
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe.h
@@ -0,0 +1,56 @@
+#ifndef FE_H
+#define FE_H
+
+#include "crypto_int32.h"
+
+typedef crypto_int32 fe[10];
+
+/*
+fe means field element.
+Here the field is \Z/(2^255-19).
+An element t, entries t[0]...t[9], represents the integer
+t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
+Bounds on each t[i] vary depending on context.
+*/
+
+#define fe_frombytes crypto_sign_ed25519_ref10_fe_frombytes
+#define fe_tobytes crypto_sign_ed25519_ref10_fe_tobytes
+#define fe_copy crypto_sign_ed25519_ref10_fe_copy
+#define fe_isnonzero crypto_sign_ed25519_ref10_fe_isnonzero
+#define fe_isnegative crypto_sign_ed25519_ref10_fe_isnegative
+#define fe_0 crypto_sign_ed25519_ref10_fe_0
+#define fe_1 crypto_sign_ed25519_ref10_fe_1
+#define fe_cswap crypto_sign_ed25519_ref10_fe_cswap
+#define fe_cmov crypto_sign_ed25519_ref10_fe_cmov
+#define fe_add crypto_sign_ed25519_ref10_fe_add
+#define fe_sub crypto_sign_ed25519_ref10_fe_sub
+#define fe_neg crypto_sign_ed25519_ref10_fe_neg
+#define fe_mul crypto_sign_ed25519_ref10_fe_mul
+#define fe_sq crypto_sign_ed25519_ref10_fe_sq
+#define fe_sq2 crypto_sign_ed25519_ref10_fe_sq2
+#define fe_mul121666 crypto_sign_ed25519_ref10_fe_mul121666
+#define fe_invert crypto_sign_ed25519_ref10_fe_invert
+#define fe_pow22523 crypto_sign_ed25519_ref10_fe_pow22523
+
+extern void fe_frombytes(fe,const unsigned char *);
+extern void fe_tobytes(unsigned char *,const fe);
+
+extern void fe_copy(fe,const fe);
+extern int fe_isnonzero(const fe);
+extern int fe_isnegative(const fe);
+extern void fe_0(fe);
+extern void fe_1(fe);
+extern void fe_cswap(fe,fe,unsigned int);
+extern void fe_cmov(fe,const fe,unsigned int);
+
+extern void fe_add(fe,const fe,const fe);
+extern void fe_sub(fe,const fe,const fe);
+extern void fe_neg(fe,const fe);
+extern void fe_mul(fe,const fe,const fe);
+extern void fe_sq(fe,const fe);
+extern void fe_sq2(fe,const fe);
+extern void fe_mul121666(fe,const fe);
+extern void fe_invert(fe,const fe);
+extern void fe_pow22523(fe,const fe);
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_0.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_0.c
new file mode 100644
index 00000000..ec879d73
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_0.c
@@ -0,0 +1,19 @@
+#include "fe.h"
+
+/*
+h = 0
+*/
+
+void fe_0(fe h)
+{
+ h[0] = 0;
+ h[1] = 0;
+ h[2] = 0;
+ h[3] = 0;
+ h[4] = 0;
+ h[5] = 0;
+ h[6] = 0;
+ h[7] = 0;
+ h[8] = 0;
+ h[9] = 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_1.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_1.c
new file mode 100644
index 00000000..8cf77848
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_1.c
@@ -0,0 +1,19 @@
+#include "fe.h"
+
+/*
+h = 1
+*/
+
+void fe_1(fe h)
+{
+ h[0] = 1;
+ h[1] = 0;
+ h[2] = 0;
+ h[3] = 0;
+ h[4] = 0;
+ h[5] = 0;
+ h[6] = 0;
+ h[7] = 0;
+ h[8] = 0;
+ h[9] = 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_add.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_add.c
new file mode 100644
index 00000000..e6a81da2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_add.c
@@ -0,0 +1,57 @@
+#include "fe.h"
+
+/*
+h = f + g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+void fe_add(fe h,const fe f,const fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 h0 = f0 + g0;
+ crypto_int32 h1 = f1 + g1;
+ crypto_int32 h2 = f2 + g2;
+ crypto_int32 h3 = f3 + g3;
+ crypto_int32 h4 = f4 + g4;
+ crypto_int32 h5 = f5 + g5;
+ crypto_int32 h6 = f6 + g6;
+ crypto_int32 h7 = f7 + g7;
+ crypto_int32 h8 = f8 + g8;
+ crypto_int32 h9 = f9 + g9;
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c
new file mode 100644
index 00000000..8ca584fb
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c
@@ -0,0 +1,63 @@
+#include "fe.h"
+
+/*
+Replace (f,g) with (g,g) if b == 1;
+replace (f,g) with (f,g) if b == 0.
+
+Preconditions: b in {0,1}.
+*/
+
+void fe_cmov(fe f,const fe g,unsigned int b)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 x0 = f0 ^ g0;
+ crypto_int32 x1 = f1 ^ g1;
+ crypto_int32 x2 = f2 ^ g2;
+ crypto_int32 x3 = f3 ^ g3;
+ crypto_int32 x4 = f4 ^ g4;
+ crypto_int32 x5 = f5 ^ g5;
+ crypto_int32 x6 = f6 ^ g6;
+ crypto_int32 x7 = f7 ^ g7;
+ crypto_int32 x8 = f8 ^ g8;
+ crypto_int32 x9 = f9 ^ g9;
+ b = -b;
+ x0 &= b;
+ x1 &= b;
+ x2 &= b;
+ x3 &= b;
+ x4 &= b;
+ x5 &= b;
+ x6 &= b;
+ x7 &= b;
+ x8 &= b;
+ x9 &= b;
+ f[0] = f0 ^ x0;
+ f[1] = f1 ^ x1;
+ f[2] = f2 ^ x2;
+ f[3] = f3 ^ x3;
+ f[4] = f4 ^ x4;
+ f[5] = f5 ^ x5;
+ f[6] = f6 ^ x6;
+ f[7] = f7 ^ x7;
+ f[8] = f8 ^ x8;
+ f[9] = f9 ^ x9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_copy.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_copy.c
new file mode 100644
index 00000000..9c5bf865
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_copy.c
@@ -0,0 +1,29 @@
+#include "fe.h"
+
+/*
+h = f
+*/
+
+void fe_copy(fe h,const fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ h[0] = f0;
+ h[1] = f1;
+ h[2] = f2;
+ h[3] = f3;
+ h[4] = f4;
+ h[5] = f5;
+ h[6] = f6;
+ h[7] = f7;
+ h[8] = f8;
+ h[9] = f9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c
new file mode 100644
index 00000000..87e24942
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c
@@ -0,0 +1,73 @@
+#include "fe.h"
+#include "crypto_int64.h"
+#include "crypto_uint64.h"
+
+static crypto_uint64 load_3(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ return result;
+}
+
+static crypto_uint64 load_4(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ result |= ((crypto_uint64) in[3]) << 24;
+ return result;
+}
+
+/*
+Ignores top bit of h.
+*/
+
+void fe_frombytes(fe h,const unsigned char *s)
+{
+ crypto_int64 h0 = load_4(s);
+ crypto_int64 h1 = load_3(s + 4) << 6;
+ crypto_int64 h2 = load_3(s + 7) << 5;
+ crypto_int64 h3 = load_3(s + 10) << 3;
+ crypto_int64 h4 = load_3(s + 13) << 2;
+ crypto_int64 h5 = load_4(s + 16);
+ crypto_int64 h6 = load_3(s + 20) << 7;
+ crypto_int64 h7 = load_3(s + 23) << 5;
+ crypto_int64 h8 = load_3(s + 26) << 4;
+ crypto_int64 h9 = (load_3(s + 29) & 8388607) << 2;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ h[0] = (crypto_int32) h0;
+ h[1] = (crypto_int32) h1;
+ h[2] = (crypto_int32) h2;
+ h[3] = (crypto_int32) h3;
+ h[4] = (crypto_int32) h4;
+ h[5] = (crypto_int32) h5;
+ h[6] = (crypto_int32) h6;
+ h[7] = (crypto_int32) h7;
+ h[8] = (crypto_int32) h8;
+ h[9] = (crypto_int32) h9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_invert.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_invert.c
new file mode 100644
index 00000000..bcfdb8ff
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_invert.c
@@ -0,0 +1,14 @@
+#include "fe.h"
+
+void fe_invert(fe out,const fe z)
+{
+ fe t0;
+ fe t1;
+ fe t2;
+ fe t3;
+ int i;
+
+#include "pow225521.h"
+
+ return;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c
new file mode 100644
index 00000000..3b2c8b8d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c
@@ -0,0 +1,16 @@
+#include "fe.h"
+
+/*
+return 1 if f is in {1,3,5,...,q-2}
+return 0 if f is in {0,2,4,...,q-1}
+
+Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+int fe_isnegative(const fe f)
+{
+ unsigned char s[32];
+ fe_tobytes(s,f);
+ return s[0] & 1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c
new file mode 100644
index 00000000..db29c254
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c
@@ -0,0 +1,19 @@
+#include "fe.h"
+#include "crypto_verify_32.h"
+
+/*
+return 1 if f == 0
+return 0 if f != 0
+
+Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+static unsigned char zero[32];
+
+int fe_isnonzero(const fe f)
+{
+ unsigned char s[32];
+ fe_tobytes(s,f);
+ return crypto_verify_32(s,zero);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_mul.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_mul.c
new file mode 100644
index 00000000..d68e2101
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_mul.c
@@ -0,0 +1,253 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+/*
+h = f * g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+ |g| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+*/
+
+/*
+Notes on implementation strategy:
+
+Using schoolbook multiplication.
+Karatsuba would save a little in some cost models.
+
+Most multiplications by 2 and 19 are 32-bit precomputations;
+cheaper than 64-bit postcomputations.
+
+There is one remaining multiplication by 19 in the carry chain;
+one *19 precomputation can be merged into this,
+but the resulting data flow is considerably less clean.
+
+There are 12 carries below.
+10 of them are 2-way parallelizable and vectorizable.
+Can get away with 11 carries, but then data flow is much deeper.
+
+With tighter constraints on inputs can squeeze carries into int32.
+*/
+
+void fe_mul(fe h,const fe f,const fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 g1_19 = 19 * g1; /* 1.959375*2^29 */
+ crypto_int32 g2_19 = 19 * g2; /* 1.959375*2^30; still ok */
+ crypto_int32 g3_19 = 19 * g3;
+ crypto_int32 g4_19 = 19 * g4;
+ crypto_int32 g5_19 = 19 * g5;
+ crypto_int32 g6_19 = 19 * g6;
+ crypto_int32 g7_19 = 19 * g7;
+ crypto_int32 g8_19 = 19 * g8;
+ crypto_int32 g9_19 = 19 * g9;
+ crypto_int32 f1_2 = 2 * f1;
+ crypto_int32 f3_2 = 2 * f3;
+ crypto_int32 f5_2 = 2 * f5;
+ crypto_int32 f7_2 = 2 * f7;
+ crypto_int32 f9_2 = 2 * f9;
+ crypto_int64 f0g0 = f0 * (crypto_int64) g0;
+ crypto_int64 f0g1 = f0 * (crypto_int64) g1;
+ crypto_int64 f0g2 = f0 * (crypto_int64) g2;
+ crypto_int64 f0g3 = f0 * (crypto_int64) g3;
+ crypto_int64 f0g4 = f0 * (crypto_int64) g4;
+ crypto_int64 f0g5 = f0 * (crypto_int64) g5;
+ crypto_int64 f0g6 = f0 * (crypto_int64) g6;
+ crypto_int64 f0g7 = f0 * (crypto_int64) g7;
+ crypto_int64 f0g8 = f0 * (crypto_int64) g8;
+ crypto_int64 f0g9 = f0 * (crypto_int64) g9;
+ crypto_int64 f1g0 = f1 * (crypto_int64) g0;
+ crypto_int64 f1g1_2 = f1_2 * (crypto_int64) g1;
+ crypto_int64 f1g2 = f1 * (crypto_int64) g2;
+ crypto_int64 f1g3_2 = f1_2 * (crypto_int64) g3;
+ crypto_int64 f1g4 = f1 * (crypto_int64) g4;
+ crypto_int64 f1g5_2 = f1_2 * (crypto_int64) g5;
+ crypto_int64 f1g6 = f1 * (crypto_int64) g6;
+ crypto_int64 f1g7_2 = f1_2 * (crypto_int64) g7;
+ crypto_int64 f1g8 = f1 * (crypto_int64) g8;
+ crypto_int64 f1g9_38 = f1_2 * (crypto_int64) g9_19;
+ crypto_int64 f2g0 = f2 * (crypto_int64) g0;
+ crypto_int64 f2g1 = f2 * (crypto_int64) g1;
+ crypto_int64 f2g2 = f2 * (crypto_int64) g2;
+ crypto_int64 f2g3 = f2 * (crypto_int64) g3;
+ crypto_int64 f2g4 = f2 * (crypto_int64) g4;
+ crypto_int64 f2g5 = f2 * (crypto_int64) g5;
+ crypto_int64 f2g6 = f2 * (crypto_int64) g6;
+ crypto_int64 f2g7 = f2 * (crypto_int64) g7;
+ crypto_int64 f2g8_19 = f2 * (crypto_int64) g8_19;
+ crypto_int64 f2g9_19 = f2 * (crypto_int64) g9_19;
+ crypto_int64 f3g0 = f3 * (crypto_int64) g0;
+ crypto_int64 f3g1_2 = f3_2 * (crypto_int64) g1;
+ crypto_int64 f3g2 = f3 * (crypto_int64) g2;
+ crypto_int64 f3g3_2 = f3_2 * (crypto_int64) g3;
+ crypto_int64 f3g4 = f3 * (crypto_int64) g4;
+ crypto_int64 f3g5_2 = f3_2 * (crypto_int64) g5;
+ crypto_int64 f3g6 = f3 * (crypto_int64) g6;
+ crypto_int64 f3g7_38 = f3_2 * (crypto_int64) g7_19;
+ crypto_int64 f3g8_19 = f3 * (crypto_int64) g8_19;
+ crypto_int64 f3g9_38 = f3_2 * (crypto_int64) g9_19;
+ crypto_int64 f4g0 = f4 * (crypto_int64) g0;
+ crypto_int64 f4g1 = f4 * (crypto_int64) g1;
+ crypto_int64 f4g2 = f4 * (crypto_int64) g2;
+ crypto_int64 f4g3 = f4 * (crypto_int64) g3;
+ crypto_int64 f4g4 = f4 * (crypto_int64) g4;
+ crypto_int64 f4g5 = f4 * (crypto_int64) g5;
+ crypto_int64 f4g6_19 = f4 * (crypto_int64) g6_19;
+ crypto_int64 f4g7_19 = f4 * (crypto_int64) g7_19;
+ crypto_int64 f4g8_19 = f4 * (crypto_int64) g8_19;
+ crypto_int64 f4g9_19 = f4 * (crypto_int64) g9_19;
+ crypto_int64 f5g0 = f5 * (crypto_int64) g0;
+ crypto_int64 f5g1_2 = f5_2 * (crypto_int64) g1;
+ crypto_int64 f5g2 = f5 * (crypto_int64) g2;
+ crypto_int64 f5g3_2 = f5_2 * (crypto_int64) g3;
+ crypto_int64 f5g4 = f5 * (crypto_int64) g4;
+ crypto_int64 f5g5_38 = f5_2 * (crypto_int64) g5_19;
+ crypto_int64 f5g6_19 = f5 * (crypto_int64) g6_19;
+ crypto_int64 f5g7_38 = f5_2 * (crypto_int64) g7_19;
+ crypto_int64 f5g8_19 = f5 * (crypto_int64) g8_19;
+ crypto_int64 f5g9_38 = f5_2 * (crypto_int64) g9_19;
+ crypto_int64 f6g0 = f6 * (crypto_int64) g0;
+ crypto_int64 f6g1 = f6 * (crypto_int64) g1;
+ crypto_int64 f6g2 = f6 * (crypto_int64) g2;
+ crypto_int64 f6g3 = f6 * (crypto_int64) g3;
+ crypto_int64 f6g4_19 = f6 * (crypto_int64) g4_19;
+ crypto_int64 f6g5_19 = f6 * (crypto_int64) g5_19;
+ crypto_int64 f6g6_19 = f6 * (crypto_int64) g6_19;
+ crypto_int64 f6g7_19 = f6 * (crypto_int64) g7_19;
+ crypto_int64 f6g8_19 = f6 * (crypto_int64) g8_19;
+ crypto_int64 f6g9_19 = f6 * (crypto_int64) g9_19;
+ crypto_int64 f7g0 = f7 * (crypto_int64) g0;
+ crypto_int64 f7g1_2 = f7_2 * (crypto_int64) g1;
+ crypto_int64 f7g2 = f7 * (crypto_int64) g2;
+ crypto_int64 f7g3_38 = f7_2 * (crypto_int64) g3_19;
+ crypto_int64 f7g4_19 = f7 * (crypto_int64) g4_19;
+ crypto_int64 f7g5_38 = f7_2 * (crypto_int64) g5_19;
+ crypto_int64 f7g6_19 = f7 * (crypto_int64) g6_19;
+ crypto_int64 f7g7_38 = f7_2 * (crypto_int64) g7_19;
+ crypto_int64 f7g8_19 = f7 * (crypto_int64) g8_19;
+ crypto_int64 f7g9_38 = f7_2 * (crypto_int64) g9_19;
+ crypto_int64 f8g0 = f8 * (crypto_int64) g0;
+ crypto_int64 f8g1 = f8 * (crypto_int64) g1;
+ crypto_int64 f8g2_19 = f8 * (crypto_int64) g2_19;
+ crypto_int64 f8g3_19 = f8 * (crypto_int64) g3_19;
+ crypto_int64 f8g4_19 = f8 * (crypto_int64) g4_19;
+ crypto_int64 f8g5_19 = f8 * (crypto_int64) g5_19;
+ crypto_int64 f8g6_19 = f8 * (crypto_int64) g6_19;
+ crypto_int64 f8g7_19 = f8 * (crypto_int64) g7_19;
+ crypto_int64 f8g8_19 = f8 * (crypto_int64) g8_19;
+ crypto_int64 f8g9_19 = f8 * (crypto_int64) g9_19;
+ crypto_int64 f9g0 = f9 * (crypto_int64) g0;
+ crypto_int64 f9g1_38 = f9_2 * (crypto_int64) g1_19;
+ crypto_int64 f9g2_19 = f9 * (crypto_int64) g2_19;
+ crypto_int64 f9g3_38 = f9_2 * (crypto_int64) g3_19;
+ crypto_int64 f9g4_19 = f9 * (crypto_int64) g4_19;
+ crypto_int64 f9g5_38 = f9_2 * (crypto_int64) g5_19;
+ crypto_int64 f9g6_19 = f9 * (crypto_int64) g6_19;
+ crypto_int64 f9g7_38 = f9_2 * (crypto_int64) g7_19;
+ crypto_int64 f9g8_19 = f9 * (crypto_int64) g8_19;
+ crypto_int64 f9g9_38 = f9_2 * (crypto_int64) g9_19;
+ crypto_int64 h0 = f0g0+f1g9_38+f2g8_19+f3g7_38+f4g6_19+f5g5_38+f6g4_19+f7g3_38+f8g2_19+f9g1_38;
+ crypto_int64 h1 = f0g1+f1g0 +f2g9_19+f3g8_19+f4g7_19+f5g6_19+f6g5_19+f7g4_19+f8g3_19+f9g2_19;
+ crypto_int64 h2 = f0g2+f1g1_2 +f2g0 +f3g9_38+f4g8_19+f5g7_38+f6g6_19+f7g5_38+f8g4_19+f9g3_38;
+ crypto_int64 h3 = f0g3+f1g2 +f2g1 +f3g0 +f4g9_19+f5g8_19+f6g7_19+f7g6_19+f8g5_19+f9g4_19;
+ crypto_int64 h4 = f0g4+f1g3_2 +f2g2 +f3g1_2 +f4g0 +f5g9_38+f6g8_19+f7g7_38+f8g6_19+f9g5_38;
+ crypto_int64 h5 = f0g5+f1g4 +f2g3 +f3g2 +f4g1 +f5g0 +f6g9_19+f7g8_19+f8g7_19+f9g6_19;
+ crypto_int64 h6 = f0g6+f1g5_2 +f2g4 +f3g3_2 +f4g2 +f5g1_2 +f6g0 +f7g9_38+f8g8_19+f9g7_38;
+ crypto_int64 h7 = f0g7+f1g6 +f2g5 +f3g4 +f4g3 +f5g2 +f6g1 +f7g0 +f8g9_19+f9g8_19;
+ crypto_int64 h8 = f0g8+f1g7_2 +f2g6 +f3g5_2 +f4g4 +f5g3_2 +f6g2 +f7g1_2 +f8g0 +f9g9_38;
+ crypto_int64 h9 = f0g9+f1g8 +f2g7 +f3g6 +f4g5 +f5g4 +f6g3 +f7g2 +f8g1 +f9g0 ;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ /*
+ |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38))
+ i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8
+ |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19))
+ i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9
+ */
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ /* |h0| <= 2^25 */
+ /* |h4| <= 2^25 */
+ /* |h1| <= 1.71*2^59 */
+ /* |h5| <= 1.71*2^59 */
+
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+ /* |h1| <= 2^24; from now on fits into int32 */
+ /* |h5| <= 2^24; from now on fits into int32 */
+ /* |h2| <= 1.41*2^60 */
+ /* |h6| <= 1.41*2^60 */
+
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+ /* |h2| <= 2^25; from now on fits into int32 unchanged */
+ /* |h6| <= 2^25; from now on fits into int32 unchanged */
+ /* |h3| <= 1.71*2^59 */
+ /* |h7| <= 1.71*2^59 */
+
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+ /* |h3| <= 2^24; from now on fits into int32 unchanged */
+ /* |h7| <= 2^24; from now on fits into int32 unchanged */
+ /* |h4| <= 1.72*2^34 */
+ /* |h8| <= 1.41*2^60 */
+
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+ /* |h4| <= 2^25; from now on fits into int32 unchanged */
+ /* |h8| <= 2^25; from now on fits into int32 unchanged */
+ /* |h5| <= 1.01*2^24 */
+ /* |h9| <= 1.71*2^59 */
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+ /* |h9| <= 2^24; from now on fits into int32 unchanged */
+ /* |h0| <= 1.1*2^39 */
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ /* |h0| <= 2^25; from now on fits into int32 unchanged */
+ /* |h1| <= 1.01*2^24 */
+
+ h[0] = (crypto_int32) h0;
+ h[1] = (crypto_int32) h1;
+ h[2] = (crypto_int32) h2;
+ h[3] = (crypto_int32) h3;
+ h[4] = (crypto_int32) h4;
+ h[5] = (crypto_int32) h5;
+ h[6] = (crypto_int32) h6;
+ h[7] = (crypto_int32) h7;
+ h[8] = (crypto_int32) h8;
+ h[9] = (crypto_int32) h9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_neg.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_neg.c
new file mode 100644
index 00000000..2078ce52
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_neg.c
@@ -0,0 +1,45 @@
+#include "fe.h"
+
+/*
+h = -f
+
+Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+*/
+
+void fe_neg(fe h,const fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 h0 = -f0;
+ crypto_int32 h1 = -f1;
+ crypto_int32 h2 = -f2;
+ crypto_int32 h3 = -f3;
+ crypto_int32 h4 = -f4;
+ crypto_int32 h5 = -f5;
+ crypto_int32 h6 = -f6;
+ crypto_int32 h7 = -f7;
+ crypto_int32 h8 = -f8;
+ crypto_int32 h9 = -f9;
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c
new file mode 100644
index 00000000..56675a59
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c
@@ -0,0 +1,13 @@
+#include "fe.h"
+
+void fe_pow22523(fe out,const fe z)
+{
+ fe t0;
+ fe t1;
+ fe t2;
+ int i;
+
+#include "pow22523.h"
+
+ return;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq.c
new file mode 100644
index 00000000..54a39496
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq.c
@@ -0,0 +1,149 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+/*
+h = f * f
+Can overlap h with f.
+
+Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+*/
+
+/*
+See fe_mul.c for discussion of implementation strategy.
+*/
+
+void fe_sq(fe h,const fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 f0_2 = 2 * f0;
+ crypto_int32 f1_2 = 2 * f1;
+ crypto_int32 f2_2 = 2 * f2;
+ crypto_int32 f3_2 = 2 * f3;
+ crypto_int32 f4_2 = 2 * f4;
+ crypto_int32 f5_2 = 2 * f5;
+ crypto_int32 f6_2 = 2 * f6;
+ crypto_int32 f7_2 = 2 * f7;
+ crypto_int32 f5_38 = 38 * f5; /* 1.959375*2^30 */
+ crypto_int32 f6_19 = 19 * f6; /* 1.959375*2^30 */
+ crypto_int32 f7_38 = 38 * f7; /* 1.959375*2^30 */
+ crypto_int32 f8_19 = 19 * f8; /* 1.959375*2^30 */
+ crypto_int32 f9_38 = 38 * f9; /* 1.959375*2^30 */
+ crypto_int64 f0f0 = f0 * (crypto_int64) f0;
+ crypto_int64 f0f1_2 = f0_2 * (crypto_int64) f1;
+ crypto_int64 f0f2_2 = f0_2 * (crypto_int64) f2;
+ crypto_int64 f0f3_2 = f0_2 * (crypto_int64) f3;
+ crypto_int64 f0f4_2 = f0_2 * (crypto_int64) f4;
+ crypto_int64 f0f5_2 = f0_2 * (crypto_int64) f5;
+ crypto_int64 f0f6_2 = f0_2 * (crypto_int64) f6;
+ crypto_int64 f0f7_2 = f0_2 * (crypto_int64) f7;
+ crypto_int64 f0f8_2 = f0_2 * (crypto_int64) f8;
+ crypto_int64 f0f9_2 = f0_2 * (crypto_int64) f9;
+ crypto_int64 f1f1_2 = f1_2 * (crypto_int64) f1;
+ crypto_int64 f1f2_2 = f1_2 * (crypto_int64) f2;
+ crypto_int64 f1f3_4 = f1_2 * (crypto_int64) f3_2;
+ crypto_int64 f1f4_2 = f1_2 * (crypto_int64) f4;
+ crypto_int64 f1f5_4 = f1_2 * (crypto_int64) f5_2;
+ crypto_int64 f1f6_2 = f1_2 * (crypto_int64) f6;
+ crypto_int64 f1f7_4 = f1_2 * (crypto_int64) f7_2;
+ crypto_int64 f1f8_2 = f1_2 * (crypto_int64) f8;
+ crypto_int64 f1f9_76 = f1_2 * (crypto_int64) f9_38;
+ crypto_int64 f2f2 = f2 * (crypto_int64) f2;
+ crypto_int64 f2f3_2 = f2_2 * (crypto_int64) f3;
+ crypto_int64 f2f4_2 = f2_2 * (crypto_int64) f4;
+ crypto_int64 f2f5_2 = f2_2 * (crypto_int64) f5;
+ crypto_int64 f2f6_2 = f2_2 * (crypto_int64) f6;
+ crypto_int64 f2f7_2 = f2_2 * (crypto_int64) f7;
+ crypto_int64 f2f8_38 = f2_2 * (crypto_int64) f8_19;
+ crypto_int64 f2f9_38 = f2 * (crypto_int64) f9_38;
+ crypto_int64 f3f3_2 = f3_2 * (crypto_int64) f3;
+ crypto_int64 f3f4_2 = f3_2 * (crypto_int64) f4;
+ crypto_int64 f3f5_4 = f3_2 * (crypto_int64) f5_2;
+ crypto_int64 f3f6_2 = f3_2 * (crypto_int64) f6;
+ crypto_int64 f3f7_76 = f3_2 * (crypto_int64) f7_38;
+ crypto_int64 f3f8_38 = f3_2 * (crypto_int64) f8_19;
+ crypto_int64 f3f9_76 = f3_2 * (crypto_int64) f9_38;
+ crypto_int64 f4f4 = f4 * (crypto_int64) f4;
+ crypto_int64 f4f5_2 = f4_2 * (crypto_int64) f5;
+ crypto_int64 f4f6_38 = f4_2 * (crypto_int64) f6_19;
+ crypto_int64 f4f7_38 = f4 * (crypto_int64) f7_38;
+ crypto_int64 f4f8_38 = f4_2 * (crypto_int64) f8_19;
+ crypto_int64 f4f9_38 = f4 * (crypto_int64) f9_38;
+ crypto_int64 f5f5_38 = f5 * (crypto_int64) f5_38;
+ crypto_int64 f5f6_38 = f5_2 * (crypto_int64) f6_19;
+ crypto_int64 f5f7_76 = f5_2 * (crypto_int64) f7_38;
+ crypto_int64 f5f8_38 = f5_2 * (crypto_int64) f8_19;
+ crypto_int64 f5f9_76 = f5_2 * (crypto_int64) f9_38;
+ crypto_int64 f6f6_19 = f6 * (crypto_int64) f6_19;
+ crypto_int64 f6f7_38 = f6 * (crypto_int64) f7_38;
+ crypto_int64 f6f8_38 = f6_2 * (crypto_int64) f8_19;
+ crypto_int64 f6f9_38 = f6 * (crypto_int64) f9_38;
+ crypto_int64 f7f7_38 = f7 * (crypto_int64) f7_38;
+ crypto_int64 f7f8_38 = f7_2 * (crypto_int64) f8_19;
+ crypto_int64 f7f9_76 = f7_2 * (crypto_int64) f9_38;
+ crypto_int64 f8f8_19 = f8 * (crypto_int64) f8_19;
+ crypto_int64 f8f9_38 = f8 * (crypto_int64) f9_38;
+ crypto_int64 f9f9_38 = f9 * (crypto_int64) f9_38;
+ crypto_int64 h0 = f0f0 +f1f9_76+f2f8_38+f3f7_76+f4f6_38+f5f5_38;
+ crypto_int64 h1 = f0f1_2+f2f9_38+f3f8_38+f4f7_38+f5f6_38;
+ crypto_int64 h2 = f0f2_2+f1f1_2 +f3f9_76+f4f8_38+f5f7_76+f6f6_19;
+ crypto_int64 h3 = f0f3_2+f1f2_2 +f4f9_38+f5f8_38+f6f7_38;
+ crypto_int64 h4 = f0f4_2+f1f3_4 +f2f2 +f5f9_76+f6f8_38+f7f7_38;
+ crypto_int64 h5 = f0f5_2+f1f4_2 +f2f3_2 +f6f9_38+f7f8_38;
+ crypto_int64 h6 = f0f6_2+f1f5_4 +f2f4_2 +f3f3_2 +f7f9_76+f8f8_19;
+ crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38;
+ crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38;
+ crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+
+ h[0] = (crypto_int32) h0;
+ h[1] = (crypto_int32) h1;
+ h[2] = (crypto_int32) h2;
+ h[3] = (crypto_int32) h3;
+ h[4] = (crypto_int32) h4;
+ h[5] = (crypto_int32) h5;
+ h[6] = (crypto_int32) h6;
+ h[7] = (crypto_int32) h7;
+ h[8] = (crypto_int32) h8;
+ h[9] = (crypto_int32) h9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq2.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq2.c
new file mode 100644
index 00000000..01b149f5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq2.c
@@ -0,0 +1,160 @@
+#include "fe.h"
+#include "crypto_int64.h"
+
+/*
+h = 2 * f * f
+Can overlap h with f.
+
+Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+
+Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+*/
+
+/*
+See fe_mul.c for discussion of implementation strategy.
+*/
+
+void fe_sq2(fe h,const fe f)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 f0_2 = 2 * f0;
+ crypto_int32 f1_2 = 2 * f1;
+ crypto_int32 f2_2 = 2 * f2;
+ crypto_int32 f3_2 = 2 * f3;
+ crypto_int32 f4_2 = 2 * f4;
+ crypto_int32 f5_2 = 2 * f5;
+ crypto_int32 f6_2 = 2 * f6;
+ crypto_int32 f7_2 = 2 * f7;
+ crypto_int32 f5_38 = 38 * f5; /* 1.959375*2^30 */
+ crypto_int32 f6_19 = 19 * f6; /* 1.959375*2^30 */
+ crypto_int32 f7_38 = 38 * f7; /* 1.959375*2^30 */
+ crypto_int32 f8_19 = 19 * f8; /* 1.959375*2^30 */
+ crypto_int32 f9_38 = 38 * f9; /* 1.959375*2^30 */
+ crypto_int64 f0f0 = f0 * (crypto_int64) f0;
+ crypto_int64 f0f1_2 = f0_2 * (crypto_int64) f1;
+ crypto_int64 f0f2_2 = f0_2 * (crypto_int64) f2;
+ crypto_int64 f0f3_2 = f0_2 * (crypto_int64) f3;
+ crypto_int64 f0f4_2 = f0_2 * (crypto_int64) f4;
+ crypto_int64 f0f5_2 = f0_2 * (crypto_int64) f5;
+ crypto_int64 f0f6_2 = f0_2 * (crypto_int64) f6;
+ crypto_int64 f0f7_2 = f0_2 * (crypto_int64) f7;
+ crypto_int64 f0f8_2 = f0_2 * (crypto_int64) f8;
+ crypto_int64 f0f9_2 = f0_2 * (crypto_int64) f9;
+ crypto_int64 f1f1_2 = f1_2 * (crypto_int64) f1;
+ crypto_int64 f1f2_2 = f1_2 * (crypto_int64) f2;
+ crypto_int64 f1f3_4 = f1_2 * (crypto_int64) f3_2;
+ crypto_int64 f1f4_2 = f1_2 * (crypto_int64) f4;
+ crypto_int64 f1f5_4 = f1_2 * (crypto_int64) f5_2;
+ crypto_int64 f1f6_2 = f1_2 * (crypto_int64) f6;
+ crypto_int64 f1f7_4 = f1_2 * (crypto_int64) f7_2;
+ crypto_int64 f1f8_2 = f1_2 * (crypto_int64) f8;
+ crypto_int64 f1f9_76 = f1_2 * (crypto_int64) f9_38;
+ crypto_int64 f2f2 = f2 * (crypto_int64) f2;
+ crypto_int64 f2f3_2 = f2_2 * (crypto_int64) f3;
+ crypto_int64 f2f4_2 = f2_2 * (crypto_int64) f4;
+ crypto_int64 f2f5_2 = f2_2 * (crypto_int64) f5;
+ crypto_int64 f2f6_2 = f2_2 * (crypto_int64) f6;
+ crypto_int64 f2f7_2 = f2_2 * (crypto_int64) f7;
+ crypto_int64 f2f8_38 = f2_2 * (crypto_int64) f8_19;
+ crypto_int64 f2f9_38 = f2 * (crypto_int64) f9_38;
+ crypto_int64 f3f3_2 = f3_2 * (crypto_int64) f3;
+ crypto_int64 f3f4_2 = f3_2 * (crypto_int64) f4;
+ crypto_int64 f3f5_4 = f3_2 * (crypto_int64) f5_2;
+ crypto_int64 f3f6_2 = f3_2 * (crypto_int64) f6;
+ crypto_int64 f3f7_76 = f3_2 * (crypto_int64) f7_38;
+ crypto_int64 f3f8_38 = f3_2 * (crypto_int64) f8_19;
+ crypto_int64 f3f9_76 = f3_2 * (crypto_int64) f9_38;
+ crypto_int64 f4f4 = f4 * (crypto_int64) f4;
+ crypto_int64 f4f5_2 = f4_2 * (crypto_int64) f5;
+ crypto_int64 f4f6_38 = f4_2 * (crypto_int64) f6_19;
+ crypto_int64 f4f7_38 = f4 * (crypto_int64) f7_38;
+ crypto_int64 f4f8_38 = f4_2 * (crypto_int64) f8_19;
+ crypto_int64 f4f9_38 = f4 * (crypto_int64) f9_38;
+ crypto_int64 f5f5_38 = f5 * (crypto_int64) f5_38;
+ crypto_int64 f5f6_38 = f5_2 * (crypto_int64) f6_19;
+ crypto_int64 f5f7_76 = f5_2 * (crypto_int64) f7_38;
+ crypto_int64 f5f8_38 = f5_2 * (crypto_int64) f8_19;
+ crypto_int64 f5f9_76 = f5_2 * (crypto_int64) f9_38;
+ crypto_int64 f6f6_19 = f6 * (crypto_int64) f6_19;
+ crypto_int64 f6f7_38 = f6 * (crypto_int64) f7_38;
+ crypto_int64 f6f8_38 = f6_2 * (crypto_int64) f8_19;
+ crypto_int64 f6f9_38 = f6 * (crypto_int64) f9_38;
+ crypto_int64 f7f7_38 = f7 * (crypto_int64) f7_38;
+ crypto_int64 f7f8_38 = f7_2 * (crypto_int64) f8_19;
+ crypto_int64 f7f9_76 = f7_2 * (crypto_int64) f9_38;
+ crypto_int64 f8f8_19 = f8 * (crypto_int64) f8_19;
+ crypto_int64 f8f9_38 = f8 * (crypto_int64) f9_38;
+ crypto_int64 f9f9_38 = f9 * (crypto_int64) f9_38;
+ crypto_int64 h0 = f0f0 +f1f9_76+f2f8_38+f3f7_76+f4f6_38+f5f5_38;
+ crypto_int64 h1 = f0f1_2+f2f9_38+f3f8_38+f4f7_38+f5f6_38;
+ crypto_int64 h2 = f0f2_2+f1f1_2 +f3f9_76+f4f8_38+f5f7_76+f6f6_19;
+ crypto_int64 h3 = f0f3_2+f1f2_2 +f4f9_38+f5f8_38+f6f7_38;
+ crypto_int64 h4 = f0f4_2+f1f3_4 +f2f2 +f5f9_76+f6f8_38+f7f7_38;
+ crypto_int64 h5 = f0f5_2+f1f4_2 +f2f3_2 +f6f9_38+f7f8_38;
+ crypto_int64 h6 = f0f6_2+f1f5_4 +f2f4_2 +f3f3_2 +f7f9_76+f8f8_19;
+ crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38;
+ crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38;
+ crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+
+ h0 += h0;
+ h1 += h1;
+ h2 += h2;
+ h3 += h3;
+ h4 += h4;
+ h5 += h5;
+ h6 += h6;
+ h7 += h7;
+ h8 += h8;
+ h9 += h9;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+
+ carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
+
+ carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
+
+ carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
+
+ carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
+
+ carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
+
+ carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
+
+ h[0] = (crypto_int32) h0;
+ h[1] = (crypto_int32) h1;
+ h[2] = (crypto_int32) h2;
+ h[3] = (crypto_int32) h3;
+ h[4] = (crypto_int32) h4;
+ h[5] = (crypto_int32) h5;
+ h[6] = (crypto_int32) h6;
+ h[7] = (crypto_int32) h7;
+ h[8] = (crypto_int32) h8;
+ h[9] = (crypto_int32) h9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sub.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sub.c
new file mode 100644
index 00000000..6e26b7df
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sub.c
@@ -0,0 +1,57 @@
+#include "fe.h"
+
+/*
+h = f - g
+Can overlap h with f or g.
+
+Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+
+Postconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+*/
+
+void fe_sub(fe h,const fe f,const fe g)
+{
+ crypto_int32 f0 = f[0];
+ crypto_int32 f1 = f[1];
+ crypto_int32 f2 = f[2];
+ crypto_int32 f3 = f[3];
+ crypto_int32 f4 = f[4];
+ crypto_int32 f5 = f[5];
+ crypto_int32 f6 = f[6];
+ crypto_int32 f7 = f[7];
+ crypto_int32 f8 = f[8];
+ crypto_int32 f9 = f[9];
+ crypto_int32 g0 = g[0];
+ crypto_int32 g1 = g[1];
+ crypto_int32 g2 = g[2];
+ crypto_int32 g3 = g[3];
+ crypto_int32 g4 = g[4];
+ crypto_int32 g5 = g[5];
+ crypto_int32 g6 = g[6];
+ crypto_int32 g7 = g[7];
+ crypto_int32 g8 = g[8];
+ crypto_int32 g9 = g[9];
+ crypto_int32 h0 = f0 - g0;
+ crypto_int32 h1 = f1 - g1;
+ crypto_int32 h2 = f2 - g2;
+ crypto_int32 h3 = f3 - g3;
+ crypto_int32 h4 = f4 - g4;
+ crypto_int32 h5 = f5 - g5;
+ crypto_int32 h6 = f6 - g6;
+ crypto_int32 h7 = f7 - g7;
+ crypto_int32 h8 = f8 - g8;
+ crypto_int32 h9 = f9 - g9;
+ h[0] = h0;
+ h[1] = h1;
+ h[2] = h2;
+ h[3] = h3;
+ h[4] = h4;
+ h[5] = h5;
+ h[6] = h6;
+ h[7] = h7;
+ h[8] = h8;
+ h[9] = h9;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_tobytes.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_tobytes.c
new file mode 100644
index 00000000..0a63baf9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_tobytes.c
@@ -0,0 +1,119 @@
+#include "fe.h"
+
+/*
+Preconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+
+Write p=2^255-19; q=floor(h/p).
+Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
+
+Proof:
+ Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
+ Also have |h-2^230 h9|<2^231 so |19 2^(-255)(h-2^230 h9)|<1/4.
+
+ Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
+ Then 0<y<1.
+
+ Write r=h-pq.
+ Have 0<=r<=p-1=2^255-20.
+ Thus 0<=r+19(2^-255)r<r+19(2^-255)2^255<=2^255-1.
+
+ Write x=r+19(2^-255)r+y.
+ Then 0<x<2^255 so floor(2^(-255)x) = 0 so floor(q+2^(-255)x) = q.
+
+ Have q+2^(-255)x = 2^(-255)(h + 19 2^(-25) h9 + 2^(-1))
+ so floor(2^(-255)(h + 19 2^(-25) h9 + 2^(-1))) = q.
+*/
+
+void fe_tobytes(unsigned char *s,const fe h)
+{
+ crypto_int32 h0 = h[0];
+ crypto_int32 h1 = h[1];
+ crypto_int32 h2 = h[2];
+ crypto_int32 h3 = h[3];
+ crypto_int32 h4 = h[4];
+ crypto_int32 h5 = h[5];
+ crypto_int32 h6 = h[6];
+ crypto_int32 h7 = h[7];
+ crypto_int32 h8 = h[8];
+ crypto_int32 h9 = h[9];
+ crypto_int32 q;
+ crypto_int32 carry0;
+ crypto_int32 carry1;
+ crypto_int32 carry2;
+ crypto_int32 carry3;
+ crypto_int32 carry4;
+ crypto_int32 carry5;
+ crypto_int32 carry6;
+ crypto_int32 carry7;
+ crypto_int32 carry8;
+ crypto_int32 carry9;
+
+ q = (19 * h9 + (((crypto_int32) 1) << 24)) >> 25;
+ q = (h0 + q) >> 26;
+ q = (h1 + q) >> 25;
+ q = (h2 + q) >> 26;
+ q = (h3 + q) >> 25;
+ q = (h4 + q) >> 26;
+ q = (h5 + q) >> 25;
+ q = (h6 + q) >> 26;
+ q = (h7 + q) >> 25;
+ q = (h8 + q) >> 26;
+ q = (h9 + q) >> 25;
+
+ /* Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. */
+ h0 += 19 * q;
+ /* Goal: Output h-2^255 q, which is between 0 and 2^255-20. */
+
+ carry0 = h0 >> 26; h1 += carry0; h0 -= carry0 << 26;
+ carry1 = h1 >> 25; h2 += carry1; h1 -= carry1 << 25;
+ carry2 = h2 >> 26; h3 += carry2; h2 -= carry2 << 26;
+ carry3 = h3 >> 25; h4 += carry3; h3 -= carry3 << 25;
+ carry4 = h4 >> 26; h5 += carry4; h4 -= carry4 << 26;
+ carry5 = h5 >> 25; h6 += carry5; h5 -= carry5 << 25;
+ carry6 = h6 >> 26; h7 += carry6; h6 -= carry6 << 26;
+ carry7 = h7 >> 25; h8 += carry7; h7 -= carry7 << 25;
+ carry8 = h8 >> 26; h9 += carry8; h8 -= carry8 << 26;
+ carry9 = h9 >> 25; h9 -= carry9 << 25;
+ /* h10 = carry9 */
+
+ /*
+ Goal: Output h0+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
+ Have h0+...+2^230 h9 between 0 and 2^255-1;
+ evidently 2^255 h10-2^255 q = 0.
+ Goal: Output h0+...+2^230 h9.
+ */
+
+ s[0] = h0 >> 0;
+ s[1] = h0 >> 8;
+ s[2] = h0 >> 16;
+ s[3] = (h0 >> 24) | (h1 << 2);
+ s[4] = h1 >> 6;
+ s[5] = h1 >> 14;
+ s[6] = (h1 >> 22) | (h2 << 3);
+ s[7] = h2 >> 5;
+ s[8] = h2 >> 13;
+ s[9] = (h2 >> 21) | (h3 << 5);
+ s[10] = h3 >> 3;
+ s[11] = h3 >> 11;
+ s[12] = (h3 >> 19) | (h4 << 6);
+ s[13] = h4 >> 2;
+ s[14] = h4 >> 10;
+ s[15] = h4 >> 18;
+ s[16] = h5 >> 0;
+ s[17] = h5 >> 8;
+ s[18] = h5 >> 16;
+ s[19] = (h5 >> 24) | (h6 << 1);
+ s[20] = h6 >> 7;
+ s[21] = h6 >> 15;
+ s[22] = (h6 >> 23) | (h7 << 3);
+ s[23] = h7 >> 5;
+ s[24] = h7 >> 13;
+ s[25] = (h7 >> 21) | (h8 << 4);
+ s[26] = h8 >> 4;
+ s[27] = h8 >> 12;
+ s[28] = (h8 >> 20) | (h9 << 6);
+ s[29] = h9 >> 2;
+ s[30] = h9 >> 10;
+ s[31] = h9 >> 18;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge.h
new file mode 100644
index 00000000..55e95f95
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge.h
@@ -0,0 +1,95 @@
+#ifndef GE_H
+#define GE_H
+
+/*
+ge means group element.
+
+Here the group is the set of pairs (x,y) of field elements (see fe.h)
+satisfying -x^2 + y^2 = 1 + d x^2y^2
+where d = -121665/121666.
+
+Representations:
+ ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
+ ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
+ ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
+ ge_precomp (Duif): (y+x,y-x,2dxy)
+*/
+
+#include "fe.h"
+
+typedef struct {
+ fe X;
+ fe Y;
+ fe Z;
+} ge_p2;
+
+typedef struct {
+ fe X;
+ fe Y;
+ fe Z;
+ fe T;
+} ge_p3;
+
+typedef struct {
+ fe X;
+ fe Y;
+ fe Z;
+ fe T;
+} ge_p1p1;
+
+typedef struct {
+ fe yplusx;
+ fe yminusx;
+ fe xy2d;
+} ge_precomp;
+
+typedef struct {
+ fe YplusX;
+ fe YminusX;
+ fe Z;
+ fe T2d;
+} ge_cached;
+
+#define ge_frombytes_negate_vartime crypto_sign_ed25519_ref10_ge_frombytes_negate_vartime
+#define ge_tobytes crypto_sign_ed25519_ref10_ge_tobytes
+#define ge_p3_tobytes crypto_sign_ed25519_ref10_ge_p3_tobytes
+
+#define ge_p2_0 crypto_sign_ed25519_ref10_ge_p2_0
+#define ge_p3_0 crypto_sign_ed25519_ref10_ge_p3_0
+#define ge_precomp_0 crypto_sign_ed25519_ref10_ge_precomp_0
+#define ge_p3_to_p2 crypto_sign_ed25519_ref10_ge_p3_to_p2
+#define ge_p3_to_cached crypto_sign_ed25519_ref10_ge_p3_to_cached
+#define ge_p1p1_to_p2 crypto_sign_ed25519_ref10_ge_p1p1_to_p2
+#define ge_p1p1_to_p3 crypto_sign_ed25519_ref10_ge_p1p1_to_p3
+#define ge_p2_dbl crypto_sign_ed25519_ref10_ge_p2_dbl
+#define ge_p3_dbl crypto_sign_ed25519_ref10_ge_p3_dbl
+
+#define ge_madd crypto_sign_ed25519_ref10_ge_madd
+#define ge_msub crypto_sign_ed25519_ref10_ge_msub
+#define ge_add crypto_sign_ed25519_ref10_ge_add
+#define ge_sub crypto_sign_ed25519_ref10_ge_sub
+#define ge_scalarmult_base crypto_sign_ed25519_ref10_ge_scalarmult_base
+#define ge_double_scalarmult_vartime crypto_sign_ed25519_ref10_ge_double_scalarmult_vartime
+
+extern void ge_tobytes(unsigned char *,const ge_p2 *);
+extern void ge_p3_tobytes(unsigned char *,const ge_p3 *);
+extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *);
+
+extern void ge_p2_0(ge_p2 *);
+extern void ge_p3_0(ge_p3 *);
+extern void ge_precomp_0(ge_precomp *);
+extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *);
+extern void ge_p3_to_cached(ge_cached *,const ge_p3 *);
+extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *);
+extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *);
+extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *);
+extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *);
+
+extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
+extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
+extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *);
+extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *);
+extern void ge_scalarmult_base(ge_p3 *,const unsigned char *);
+extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *);
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.c
new file mode 100644
index 00000000..da7ff5d2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = p + q
+*/
+
+void ge_add(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q)
+{
+ fe t0;
+#include "ge_add.h"
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.h
new file mode 100644
index 00000000..7481f8ff
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.h
@@ -0,0 +1,97 @@
+
+/* qhasm: enter ge_add */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe Z2 */
+
+/* qhasm: fe T1 */
+
+/* qhasm: fe ZZ */
+
+/* qhasm: fe YpX2 */
+
+/* qhasm: fe YmX2 */
+
+/* qhasm: fe T2d2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: fe YpX1 */
+
+/* qhasm: fe YmX1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: YpX1 = Y1+X1 */
+/* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
+fe_add(r->X,p->Y,p->X);
+
+/* qhasm: YmX1 = Y1-X1 */
+/* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
+fe_sub(r->Y,p->Y,p->X);
+
+/* qhasm: A = YpX1*YpX2 */
+/* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<YpX2=fe#15); */
+/* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<YpX2=q->YplusX); */
+fe_mul(r->Z,r->X,q->YplusX);
+
+/* qhasm: B = YmX1*YmX2 */
+/* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<YmX2=fe#16); */
+/* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<YmX2=q->YminusX); */
+fe_mul(r->Y,r->Y,q->YminusX);
+
+/* qhasm: C = T2d2*T1 */
+/* asm 1: fe_mul(>C=fe#4,<T2d2=fe#18,<T1=fe#14); */
+/* asm 2: fe_mul(>C=r->T,<T2d2=q->T2d,<T1=p->T); */
+fe_mul(r->T,q->T2d,p->T);
+
+/* qhasm: ZZ = Z1*Z2 */
+/* asm 1: fe_mul(>ZZ=fe#1,<Z1=fe#13,<Z2=fe#17); */
+/* asm 2: fe_mul(>ZZ=r->X,<Z1=p->Z,<Z2=q->Z); */
+fe_mul(r->X,p->Z,q->Z);
+
+/* qhasm: D = 2*ZZ */
+/* asm 1: fe_add(>D=fe#5,<ZZ=fe#1,<ZZ=fe#1); */
+/* asm 2: fe_add(>D=t0,<ZZ=r->X,<ZZ=r->X); */
+fe_add(t0,r->X,r->X);
+
+/* qhasm: X3 = A-B */
+/* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
+fe_sub(r->X,r->Z,r->Y);
+
+/* qhasm: Y3 = A+B */
+/* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
+fe_add(r->Y,r->Z,r->Y);
+
+/* qhasm: Z3 = D+C */
+/* asm 1: fe_add(>Z3=fe#3,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_add(>Z3=r->Z,<D=t0,<C=r->T); */
+fe_add(r->Z,t0,r->T);
+
+/* qhasm: T3 = D-C */
+/* asm 1: fe_sub(>T3=fe#4,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_sub(>T3=r->T,<D=t0,<C=r->T); */
+fe_sub(r->T,t0,r->T);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c
new file mode 100644
index 00000000..f8bf4bf7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c
@@ -0,0 +1,96 @@
+#include "ge.h"
+
+static void slide(signed char *r,const unsigned char *a)
+{
+ int i;
+ int b;
+ int k;
+
+ for (i = 0;i < 256;++i)
+ r[i] = 1 & (a[i >> 3] >> (i & 7));
+
+ for (i = 0;i < 256;++i)
+ if (r[i]) {
+ for (b = 1;b <= 6 && i + b < 256;++b) {
+ if (r[i + b]) {
+ if (r[i] + (r[i + b] << b) <= 15) {
+ r[i] += r[i + b] << b; r[i + b] = 0;
+ } else if (r[i] - (r[i + b] << b) >= -15) {
+ r[i] -= r[i + b] << b;
+ for (k = i + b;k < 256;++k) {
+ if (!r[k]) {
+ r[k] = 1;
+ break;
+ }
+ r[k] = 0;
+ }
+ } else
+ break;
+ }
+ }
+ }
+
+}
+
+static ge_precomp Bi[8] = {
+#include "base2.h"
+} ;
+
+/*
+r = a * A + b * B
+where a = a[0]+256*a[1]+...+256^31 a[31].
+and b = b[0]+256*b[1]+...+256^31 b[31].
+B is the Ed25519 base point (x,4/5) with x positive.
+*/
+
+void ge_double_scalarmult_vartime(ge_p2 *r,const unsigned char *a,const ge_p3 *A,const unsigned char *b)
+{
+ signed char aslide[256];
+ signed char bslide[256];
+ ge_cached Ai[8]; /* A,3A,5A,7A,9A,11A,13A,15A */
+ ge_p1p1 t;
+ ge_p3 u;
+ ge_p3 A2;
+ int i;
+
+ slide(aslide,a);
+ slide(bslide,b);
+
+ ge_p3_to_cached(&Ai[0],A);
+ ge_p3_dbl(&t,A); ge_p1p1_to_p3(&A2,&t);
+ ge_add(&t,&A2,&Ai[0]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[1],&u);
+ ge_add(&t,&A2,&Ai[1]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[2],&u);
+ ge_add(&t,&A2,&Ai[2]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[3],&u);
+ ge_add(&t,&A2,&Ai[3]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[4],&u);
+ ge_add(&t,&A2,&Ai[4]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[5],&u);
+ ge_add(&t,&A2,&Ai[5]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[6],&u);
+ ge_add(&t,&A2,&Ai[6]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[7],&u);
+
+ ge_p2_0(r);
+
+ for (i = 255;i >= 0;--i) {
+ if (aslide[i] || bslide[i]) break;
+ }
+
+ for (;i >= 0;--i) {
+ ge_p2_dbl(&t,r);
+
+ if (aslide[i] > 0) {
+ ge_p1p1_to_p3(&u,&t);
+ ge_add(&t,&u,&Ai[aslide[i]/2]);
+ } else if (aslide[i] < 0) {
+ ge_p1p1_to_p3(&u,&t);
+ ge_sub(&t,&u,&Ai[(-aslide[i])/2]);
+ }
+
+ if (bslide[i] > 0) {
+ ge_p1p1_to_p3(&u,&t);
+ ge_madd(&t,&u,&Bi[bslide[i]/2]);
+ } else if (bslide[i] < 0) {
+ ge_p1p1_to_p3(&u,&t);
+ ge_msub(&t,&u,&Bi[(-bslide[i])/2]);
+ }
+
+ ge_p1p1_to_p2(r,&t);
+ }
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
new file mode 100644
index 00000000..1a059ee9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
@@ -0,0 +1,50 @@
+#include "ge.h"
+
+static const fe d = {
+#include "d.h"
+} ;
+
+static const fe sqrtm1 = {
+#include "sqrtm1.h"
+} ;
+
+int ge_frombytes_negate_vartime(ge_p3 *h,const unsigned char *s)
+{
+ fe u;
+ fe v;
+ fe v3;
+ fe vxx;
+ fe check;
+
+ fe_frombytes(h->Y,s);
+ fe_1(h->Z);
+ fe_sq(u,h->Y);
+ fe_mul(v,u,d);
+ fe_sub(u,u,h->Z); /* u = y^2-1 */
+ fe_add(v,v,h->Z); /* v = dy^2+1 */
+
+ fe_sq(v3,v);
+ fe_mul(v3,v3,v); /* v3 = v^3 */
+ fe_sq(h->X,v3);
+ fe_mul(h->X,h->X,v);
+ fe_mul(h->X,h->X,u); /* x = uv^7 */
+
+ fe_pow22523(h->X,h->X); /* x = (uv^7)^((q-5)/8) */
+ fe_mul(h->X,h->X,v3);
+ fe_mul(h->X,h->X,u); /* x = uv^3(uv^7)^((q-5)/8) */
+
+ fe_sq(vxx,h->X);
+ fe_mul(vxx,vxx,v);
+ fe_sub(check,vxx,u); /* vx^2-u */
+ if (fe_isnonzero(check)) {
+ fe_add(check,vxx,u); /* vx^2+u */
+ if (fe_isnonzero(check)) return -1;
+ fe_mul(h->X,h->X,sqrtm1);
+ }
+
+ if (fe_isnegative(h->X) == (s[31] >> 7))
+ fe_neg(h->X,h->X);
+
+ fe_mul(h->T,h->X,h->Y);
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.c
new file mode 100644
index 00000000..62257177
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = p + q
+*/
+
+void ge_madd(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q)
+{
+ fe t0;
+#include "ge_madd.h"
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.h
new file mode 100644
index 00000000..ecae8495
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.h
@@ -0,0 +1,88 @@
+
+/* qhasm: enter ge_madd */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe T1 */
+
+/* qhasm: fe ypx2 */
+
+/* qhasm: fe ymx2 */
+
+/* qhasm: fe xy2d2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: fe YpX1 */
+
+/* qhasm: fe YmX1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: YpX1 = Y1+X1 */
+/* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
+fe_add(r->X,p->Y,p->X);
+
+/* qhasm: YmX1 = Y1-X1 */
+/* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
+fe_sub(r->Y,p->Y,p->X);
+
+/* qhasm: A = YpX1*ypx2 */
+/* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<ypx2=fe#15); */
+/* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<ypx2=q->yplusx); */
+fe_mul(r->Z,r->X,q->yplusx);
+
+/* qhasm: B = YmX1*ymx2 */
+/* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<ymx2=fe#16); */
+/* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<ymx2=q->yminusx); */
+fe_mul(r->Y,r->Y,q->yminusx);
+
+/* qhasm: C = xy2d2*T1 */
+/* asm 1: fe_mul(>C=fe#4,<xy2d2=fe#17,<T1=fe#14); */
+/* asm 2: fe_mul(>C=r->T,<xy2d2=q->xy2d,<T1=p->T); */
+fe_mul(r->T,q->xy2d,p->T);
+
+/* qhasm: D = 2*Z1 */
+/* asm 1: fe_add(>D=fe#5,<Z1=fe#13,<Z1=fe#13); */
+/* asm 2: fe_add(>D=t0,<Z1=p->Z,<Z1=p->Z); */
+fe_add(t0,p->Z,p->Z);
+
+/* qhasm: X3 = A-B */
+/* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
+fe_sub(r->X,r->Z,r->Y);
+
+/* qhasm: Y3 = A+B */
+/* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
+fe_add(r->Y,r->Z,r->Y);
+
+/* qhasm: Z3 = D+C */
+/* asm 1: fe_add(>Z3=fe#3,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_add(>Z3=r->Z,<D=t0,<C=r->T); */
+fe_add(r->Z,t0,r->T);
+
+/* qhasm: T3 = D-C */
+/* asm 1: fe_sub(>T3=fe#4,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_sub(>T3=r->T,<D=t0,<C=r->T); */
+fe_sub(r->T,t0,r->T);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.c
new file mode 100644
index 00000000..741ecbf1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = p - q
+*/
+
+void ge_msub(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q)
+{
+ fe t0;
+#include "ge_msub.h"
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.h
new file mode 100644
index 00000000..500f986b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.h
@@ -0,0 +1,88 @@
+
+/* qhasm: enter ge_msub */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe T1 */
+
+/* qhasm: fe ypx2 */
+
+/* qhasm: fe ymx2 */
+
+/* qhasm: fe xy2d2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: fe YpX1 */
+
+/* qhasm: fe YmX1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: YpX1 = Y1+X1 */
+/* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
+fe_add(r->X,p->Y,p->X);
+
+/* qhasm: YmX1 = Y1-X1 */
+/* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
+fe_sub(r->Y,p->Y,p->X);
+
+/* qhasm: A = YpX1*ymx2 */
+/* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<ymx2=fe#16); */
+/* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<ymx2=q->yminusx); */
+fe_mul(r->Z,r->X,q->yminusx);
+
+/* qhasm: B = YmX1*ypx2 */
+/* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<ypx2=fe#15); */
+/* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<ypx2=q->yplusx); */
+fe_mul(r->Y,r->Y,q->yplusx);
+
+/* qhasm: C = xy2d2*T1 */
+/* asm 1: fe_mul(>C=fe#4,<xy2d2=fe#17,<T1=fe#14); */
+/* asm 2: fe_mul(>C=r->T,<xy2d2=q->xy2d,<T1=p->T); */
+fe_mul(r->T,q->xy2d,p->T);
+
+/* qhasm: D = 2*Z1 */
+/* asm 1: fe_add(>D=fe#5,<Z1=fe#13,<Z1=fe#13); */
+/* asm 2: fe_add(>D=t0,<Z1=p->Z,<Z1=p->Z); */
+fe_add(t0,p->Z,p->Z);
+
+/* qhasm: X3 = A-B */
+/* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
+fe_sub(r->X,r->Z,r->Y);
+
+/* qhasm: Y3 = A+B */
+/* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
+fe_add(r->Y,r->Z,r->Y);
+
+/* qhasm: Z3 = D-C */
+/* asm 1: fe_sub(>Z3=fe#3,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_sub(>Z3=r->Z,<D=t0,<C=r->T); */
+fe_sub(r->Z,t0,r->T);
+
+/* qhasm: T3 = D+C */
+/* asm 1: fe_add(>T3=fe#4,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_add(>T3=r->T,<D=t0,<C=r->T); */
+fe_add(r->T,t0,r->T);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c
new file mode 100644
index 00000000..9bb5013d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c
@@ -0,0 +1,12 @@
+#include "ge.h"
+
+/*
+r = p
+*/
+
+extern void ge_p1p1_to_p2(ge_p2 *r,const ge_p1p1 *p)
+{
+ fe_mul(r->X,p->X,p->T);
+ fe_mul(r->Y,p->Y,p->Z);
+ fe_mul(r->Z,p->Z,p->T);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c
new file mode 100644
index 00000000..2f57b109
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c
@@ -0,0 +1,13 @@
+#include "ge.h"
+
+/*
+r = p
+*/
+
+extern void ge_p1p1_to_p3(ge_p3 *r,const ge_p1p1 *p)
+{
+ fe_mul(r->X,p->X,p->T);
+ fe_mul(r->Y,p->Y,p->Z);
+ fe_mul(r->Z,p->Z,p->T);
+ fe_mul(r->T,p->X,p->Y);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c
new file mode 100644
index 00000000..6191d1e6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c
@@ -0,0 +1,8 @@
+#include "ge.h"
+
+void ge_p2_0(ge_p2 *h)
+{
+ fe_0(h->X);
+ fe_1(h->Y);
+ fe_1(h->Z);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c
new file mode 100644
index 00000000..2e332b5c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = 2 * p
+*/
+
+void ge_p2_dbl(ge_p1p1 *r,const ge_p2 *p)
+{
+ fe t0;
+#include "ge_p2_dbl.h"
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.h
new file mode 100644
index 00000000..128efed9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.h
@@ -0,0 +1,73 @@
+
+/* qhasm: enter ge_p2_dbl */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe AA */
+
+/* qhasm: fe XX */
+
+/* qhasm: fe YY */
+
+/* qhasm: fe B */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: XX=X1^2 */
+/* asm 1: fe_sq(>XX=fe#1,<X1=fe#11); */
+/* asm 2: fe_sq(>XX=r->X,<X1=p->X); */
+fe_sq(r->X,p->X);
+
+/* qhasm: YY=Y1^2 */
+/* asm 1: fe_sq(>YY=fe#3,<Y1=fe#12); */
+/* asm 2: fe_sq(>YY=r->Z,<Y1=p->Y); */
+fe_sq(r->Z,p->Y);
+
+/* qhasm: B=2*Z1^2 */
+/* asm 1: fe_sq2(>B=fe#4,<Z1=fe#13); */
+/* asm 2: fe_sq2(>B=r->T,<Z1=p->Z); */
+fe_sq2(r->T,p->Z);
+
+/* qhasm: A=X1+Y1 */
+/* asm 1: fe_add(>A=fe#2,<X1=fe#11,<Y1=fe#12); */
+/* asm 2: fe_add(>A=r->Y,<X1=p->X,<Y1=p->Y); */
+fe_add(r->Y,p->X,p->Y);
+
+/* qhasm: AA=A^2 */
+/* asm 1: fe_sq(>AA=fe#5,<A=fe#2); */
+/* asm 2: fe_sq(>AA=t0,<A=r->Y); */
+fe_sq(t0,r->Y);
+
+/* qhasm: Y3=YY+XX */
+/* asm 1: fe_add(>Y3=fe#2,<YY=fe#3,<XX=fe#1); */
+/* asm 2: fe_add(>Y3=r->Y,<YY=r->Z,<XX=r->X); */
+fe_add(r->Y,r->Z,r->X);
+
+/* qhasm: Z3=YY-XX */
+/* asm 1: fe_sub(>Z3=fe#3,<YY=fe#3,<XX=fe#1); */
+/* asm 2: fe_sub(>Z3=r->Z,<YY=r->Z,<XX=r->X); */
+fe_sub(r->Z,r->Z,r->X);
+
+/* qhasm: X3=AA-Y3 */
+/* asm 1: fe_sub(>X3=fe#1,<AA=fe#5,<Y3=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<AA=t0,<Y3=r->Y); */
+fe_sub(r->X,t0,r->Y);
+
+/* qhasm: T3=B-Z3 */
+/* asm 1: fe_sub(>T3=fe#4,<B=fe#4,<Z3=fe#3); */
+/* asm 2: fe_sub(>T3=r->T,<B=r->T,<Z3=r->Z); */
+fe_sub(r->T,r->T,r->Z);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c
new file mode 100644
index 00000000..401b2935
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c
@@ -0,0 +1,9 @@
+#include "ge.h"
+
+void ge_p3_0(ge_p3 *h)
+{
+ fe_0(h->X);
+ fe_1(h->Y);
+ fe_1(h->Z);
+ fe_0(h->T);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c
new file mode 100644
index 00000000..0d8a0591
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c
@@ -0,0 +1,12 @@
+#include "ge.h"
+
+/*
+r = 2 * p
+*/
+
+void ge_p3_dbl(ge_p1p1 *r,const ge_p3 *p)
+{
+ ge_p2 q;
+ ge_p3_to_p2(&q,p);
+ ge_p2_dbl(r,&q);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c
new file mode 100644
index 00000000..bde64228
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c
@@ -0,0 +1,17 @@
+#include "ge.h"
+
+/*
+r = p
+*/
+
+static const fe d2 = {
+#include "d2.h"
+} ;
+
+extern void ge_p3_to_cached(ge_cached *r,const ge_p3 *p)
+{
+ fe_add(r->YplusX,p->Y,p->X);
+ fe_sub(r->YminusX,p->Y,p->X);
+ fe_copy(r->Z,p->Z);
+ fe_mul(r->T2d,p->T,d2);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c
new file mode 100644
index 00000000..e532a9e4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c
@@ -0,0 +1,12 @@
+#include "ge.h"
+
+/*
+r = p
+*/
+
+extern void ge_p3_to_p2(ge_p2 *r,const ge_p3 *p)
+{
+ fe_copy(r->X,p->X);
+ fe_copy(r->Y,p->Y);
+ fe_copy(r->Z,p->Z);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c
new file mode 100644
index 00000000..21cb2fc6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c
@@ -0,0 +1,14 @@
+#include "ge.h"
+
+void ge_p3_tobytes(unsigned char *s,const ge_p3 *h)
+{
+ fe recip;
+ fe x;
+ fe y;
+
+ fe_invert(recip,h->Z);
+ fe_mul(x,h->X,recip);
+ fe_mul(y,h->Y,recip);
+ fe_tobytes(s,y);
+ s[31] ^= fe_isnegative(x) << 7;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c
new file mode 100644
index 00000000..2e218861
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c
@@ -0,0 +1,8 @@
+#include "ge.h"
+
+void ge_precomp_0(ge_precomp *h)
+{
+ fe_1(h->yplusx);
+ fe_1(h->yminusx);
+ fe_0(h->xy2d);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c
new file mode 100644
index 00000000..f3490a94
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c
@@ -0,0 +1,111 @@
+#include "ge.h"
+#include "crypto_uint32.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+#endif
+
+static unsigned char equal(signed char b,signed char c)
+{
+ unsigned char ub = b;
+ unsigned char uc = c;
+ unsigned char x = ub ^ uc; /* 0: yes; 1..255: no */
+ crypto_uint32 y = x; /* 0: yes; 1..255: no */
+ y -= 1; /* 4294967295: yes; 0..254: no */
+ y >>= 31; /* 1: yes; 0: no */
+ return y;
+}
+
+static unsigned char negative(signed char b)
+{
+ unsigned long long x = b; /* 18446744073709551361..18446744073709551615: yes; 0..255: no */
+ x >>= 63; /* 1: yes; 0: no */
+ return x;
+}
+
+static void cmov(ge_precomp *t,ge_precomp *u,unsigned char b)
+{
+ fe_cmov(t->yplusx,u->yplusx,b);
+ fe_cmov(t->yminusx,u->yminusx,b);
+ fe_cmov(t->xy2d,u->xy2d,b);
+}
+
+/* base[i][j] = (j+1)*256^i*B */
+static ge_precomp base[32][8] = {
+#include "base.h"
+} ;
+
+static void ge_select(ge_precomp *t,int pos,signed char b)
+{
+ ge_precomp minust;
+ unsigned char bnegative = negative(b);
+ unsigned char babs = b - (((-bnegative) & b) << 1);
+
+ ge_precomp_0(t);
+ cmov(t,&base[pos][0],equal(babs,1));
+ cmov(t,&base[pos][1],equal(babs,2));
+ cmov(t,&base[pos][2],equal(babs,3));
+ cmov(t,&base[pos][3],equal(babs,4));
+ cmov(t,&base[pos][4],equal(babs,5));
+ cmov(t,&base[pos][5],equal(babs,6));
+ cmov(t,&base[pos][6],equal(babs,7));
+ cmov(t,&base[pos][7],equal(babs,8));
+ fe_copy(minust.yplusx,t->yminusx);
+ fe_copy(minust.yminusx,t->yplusx);
+ fe_neg(minust.xy2d,t->xy2d);
+ cmov(t,&minust,bnegative);
+}
+
+/*
+h = a * B
+where a = a[0]+256*a[1]+...+256^31 a[31]
+B is the Ed25519 base point (x,4/5) with x positive.
+
+Preconditions:
+ a[31] <= 127
+*/
+
+void ge_scalarmult_base(ge_p3 *h,const unsigned char *a)
+{
+ signed char e[64];
+ signed char carry;
+ ge_p1p1 r;
+ ge_p2 s;
+ ge_precomp t;
+ int i;
+
+ for (i = 0;i < 32;++i) {
+ e[2 * i + 0] = (a[i] >> 0) & 15;
+ e[2 * i + 1] = (a[i] >> 4) & 15;
+ }
+ /* each e[i] is between 0 and 15 */
+ /* e[63] is between 0 and 7 */
+
+ carry = 0;
+ for (i = 0;i < 63;++i) {
+ e[i] += carry;
+ carry = e[i] + 8;
+ carry >>= 4;
+ e[i] -= carry << 4;
+ }
+ e[63] += carry;
+ /* each e[i] is between -8 and 8 */
+
+ ge_p3_0(h);
+ for (i = 1;i < 64;i += 2) {
+ ge_select(&t,i / 2,e[i]);
+ ge_madd(&r,h,&t); ge_p1p1_to_p3(h,&r);
+ }
+
+ ge_p3_dbl(&r,h); ge_p1p1_to_p2(&s,&r);
+ ge_p2_dbl(&r,&s); ge_p1p1_to_p2(&s,&r);
+ ge_p2_dbl(&r,&s); ge_p1p1_to_p2(&s,&r);
+ ge_p2_dbl(&r,&s); ge_p1p1_to_p3(h,&r);
+
+ for (i = 0;i < 64;i += 2) {
+ ge_select(&t,i / 2,e[i]);
+ ge_madd(&r,h,&t); ge_p1p1_to_p3(h,&r);
+ }
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.c
new file mode 100644
index 00000000..69f3d540
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.c
@@ -0,0 +1,11 @@
+#include "ge.h"
+
+/*
+r = p - q
+*/
+
+void ge_sub(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q)
+{
+ fe t0;
+#include "ge_sub.h"
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.h
new file mode 100644
index 00000000..b4ef1f5d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.h
@@ -0,0 +1,97 @@
+
+/* qhasm: enter ge_sub */
+
+/* qhasm: fe X1 */
+
+/* qhasm: fe Y1 */
+
+/* qhasm: fe Z1 */
+
+/* qhasm: fe Z2 */
+
+/* qhasm: fe T1 */
+
+/* qhasm: fe ZZ */
+
+/* qhasm: fe YpX2 */
+
+/* qhasm: fe YmX2 */
+
+/* qhasm: fe T2d2 */
+
+/* qhasm: fe X3 */
+
+/* qhasm: fe Y3 */
+
+/* qhasm: fe Z3 */
+
+/* qhasm: fe T3 */
+
+/* qhasm: fe YpX1 */
+
+/* qhasm: fe YmX1 */
+
+/* qhasm: fe A */
+
+/* qhasm: fe B */
+
+/* qhasm: fe C */
+
+/* qhasm: fe D */
+
+/* qhasm: YpX1 = Y1+X1 */
+/* asm 1: fe_add(>YpX1=fe#1,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_add(>YpX1=r->X,<Y1=p->Y,<X1=p->X); */
+fe_add(r->X,p->Y,p->X);
+
+/* qhasm: YmX1 = Y1-X1 */
+/* asm 1: fe_sub(>YmX1=fe#2,<Y1=fe#12,<X1=fe#11); */
+/* asm 2: fe_sub(>YmX1=r->Y,<Y1=p->Y,<X1=p->X); */
+fe_sub(r->Y,p->Y,p->X);
+
+/* qhasm: A = YpX1*YmX2 */
+/* asm 1: fe_mul(>A=fe#3,<YpX1=fe#1,<YmX2=fe#16); */
+/* asm 2: fe_mul(>A=r->Z,<YpX1=r->X,<YmX2=q->YminusX); */
+fe_mul(r->Z,r->X,q->YminusX);
+
+/* qhasm: B = YmX1*YpX2 */
+/* asm 1: fe_mul(>B=fe#2,<YmX1=fe#2,<YpX2=fe#15); */
+/* asm 2: fe_mul(>B=r->Y,<YmX1=r->Y,<YpX2=q->YplusX); */
+fe_mul(r->Y,r->Y,q->YplusX);
+
+/* qhasm: C = T2d2*T1 */
+/* asm 1: fe_mul(>C=fe#4,<T2d2=fe#18,<T1=fe#14); */
+/* asm 2: fe_mul(>C=r->T,<T2d2=q->T2d,<T1=p->T); */
+fe_mul(r->T,q->T2d,p->T);
+
+/* qhasm: ZZ = Z1*Z2 */
+/* asm 1: fe_mul(>ZZ=fe#1,<Z1=fe#13,<Z2=fe#17); */
+/* asm 2: fe_mul(>ZZ=r->X,<Z1=p->Z,<Z2=q->Z); */
+fe_mul(r->X,p->Z,q->Z);
+
+/* qhasm: D = 2*ZZ */
+/* asm 1: fe_add(>D=fe#5,<ZZ=fe#1,<ZZ=fe#1); */
+/* asm 2: fe_add(>D=t0,<ZZ=r->X,<ZZ=r->X); */
+fe_add(t0,r->X,r->X);
+
+/* qhasm: X3 = A-B */
+/* asm 1: fe_sub(>X3=fe#1,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_sub(>X3=r->X,<A=r->Z,<B=r->Y); */
+fe_sub(r->X,r->Z,r->Y);
+
+/* qhasm: Y3 = A+B */
+/* asm 1: fe_add(>Y3=fe#2,<A=fe#3,<B=fe#2); */
+/* asm 2: fe_add(>Y3=r->Y,<A=r->Z,<B=r->Y); */
+fe_add(r->Y,r->Z,r->Y);
+
+/* qhasm: Z3 = D-C */
+/* asm 1: fe_sub(>Z3=fe#3,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_sub(>Z3=r->Z,<D=t0,<C=r->T); */
+fe_sub(r->Z,t0,r->T);
+
+/* qhasm: T3 = D+C */
+/* asm 1: fe_add(>T3=fe#4,<D=fe#5,<C=fe#4); */
+/* asm 2: fe_add(>T3=r->T,<D=t0,<C=r->T); */
+fe_add(r->T,t0,r->T);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c
new file mode 100644
index 00000000..31b3d33e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c
@@ -0,0 +1,14 @@
+#include "ge.h"
+
+void ge_tobytes(unsigned char *s,const ge_p2 *h)
+{
+ fe recip;
+ fe x;
+ fe y;
+
+ fe_invert(recip,h->Z);
+ fe_mul(x,h->X,recip);
+ fe_mul(y,h->Y,recip);
+ fe_tobytes(s,y);
+ s[31] ^= fe_isnegative(x) << 7;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c
new file mode 100644
index 00000000..b6335f39
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c
@@ -0,0 +1,78 @@
+
+#include <string.h>
+
+#include "api.h"
+#include "crypto_hash_sha512.h"
+#include "crypto_scalarmult_curve25519.h"
+#include "randombytes.h"
+#include "utils.h"
+#include "fe.h"
+#include "ge.h"
+
+int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
+ const unsigned char *seed)
+{
+ ge_p3 A;
+
+ crypto_hash_sha512(sk,seed,32);
+ sk[0] &= 248;
+ sk[31] &= 63;
+ sk[31] |= 64;
+
+ ge_scalarmult_base(&A,sk);
+ ge_p3_tobytes(pk,&A);
+
+ memmove(sk, seed, 32);
+ memmove(sk + 32, pk, 32);
+ return 0;
+}
+
+int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
+{
+ unsigned char seed[32];
+ int ret;
+
+ randombytes_buf(seed, sizeof seed);
+ ret = crypto_sign_seed_keypair(pk, sk, seed);
+ sodium_memzero(seed, sizeof seed);
+
+ return ret;
+}
+
+int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk,
+ const unsigned char *ed25519_pk)
+{
+ ge_p3 A;
+ fe x;
+ fe one_minus_y;
+
+ if (ge_frombytes_negate_vartime(&A, ed25519_pk) != 0) {
+ return -1;
+ }
+ fe_1(one_minus_y);
+ fe_sub(one_minus_y, one_minus_y, A.Y);
+ fe_invert(one_minus_y, one_minus_y);
+ fe_1(x);
+ fe_add(x, x, A.Y);
+ fe_mul(x, x, one_minus_y);
+ fe_tobytes(curve25519_pk, x);
+
+ return 0;
+}
+
+int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
+ const unsigned char *ed25519_sk)
+{
+ unsigned char h[crypto_hash_sha512_BYTES];
+
+ crypto_hash_sha512(h, ed25519_sk,
+ crypto_sign_ed25519_SECRETKEYBYTES -
+ crypto_sign_ed25519_PUBLICKEYBYTES);
+ h[0] &= 248;
+ h[31] &= 127;
+ h[31] |= 64;
+ memcpy(curve25519_sk, h, crypto_scalarmult_curve25519_BYTES);
+ sodium_memzero(h, sizeof h);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c
new file mode 100644
index 00000000..1e2b7add
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c
@@ -0,0 +1,77 @@
+
+#include <limits.h>
+#include <string.h>
+
+#include "api.h"
+#include "crypto_hash_sha512.h"
+#include "crypto_verify_32.h"
+#include "ge.h"
+#include "sc.h"
+#include "utils.h"
+
+int
+crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *pk)
+{
+ crypto_hash_sha512_state hs;
+ unsigned char h[64];
+ unsigned char rcheck[32];
+ unsigned int i;
+ unsigned char d = 0;
+ ge_p3 A;
+ ge_p2 R;
+
+ if (sig[63] & 224) {
+ return -1;
+ }
+ if (ge_frombytes_negate_vartime(&A, pk) != 0) {
+ return -1;
+ }
+ for (i = 0; i < 32; ++i) {
+ d |= pk[i];
+ }
+ if (d == 0) {
+ return -1;
+ }
+ crypto_hash_sha512_init(&hs);
+ crypto_hash_sha512_update(&hs, sig, 32);
+ crypto_hash_sha512_update(&hs, pk, 32);
+ crypto_hash_sha512_update(&hs, m, mlen);
+ crypto_hash_sha512_final(&hs, h);
+ sc_reduce(h);
+
+ ge_double_scalarmult_vartime(&R, h, &A, sig + 32);
+ ge_tobytes(rcheck, &R);
+
+ return crypto_verify_32(rcheck, sig) | (-(rcheck - sig == 0)) |
+ sodium_memcmp(sig, rcheck, 32);
+}
+
+int
+crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
+ const unsigned char *sm, unsigned long long smlen,
+ const unsigned char *pk)
+{
+ unsigned long long mlen;
+
+ if (smlen < 64 || smlen > SIZE_MAX) {
+ goto badsig;
+ }
+ mlen = smlen - 64;
+ if (crypto_sign_verify_detached(sm, sm + 64, mlen, pk) != 0) {
+ memset(m, 0, mlen);
+ goto badsig;
+ }
+ if (mlen_p != NULL) {
+ *mlen_p = mlen;
+ }
+ memmove(m, sm + 64, mlen);
+
+ return 0;
+
+badsig:
+ if (mlen_p != NULL) {
+ *mlen_p = 0;
+ }
+ return -1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h
new file mode 100644
index 00000000..9bd45f13
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h
@@ -0,0 +1,160 @@
+
+/* qhasm: fe z1 */
+
+/* qhasm: fe z2 */
+
+/* qhasm: fe z8 */
+
+/* qhasm: fe z9 */
+
+/* qhasm: fe z11 */
+
+/* qhasm: fe z22 */
+
+/* qhasm: fe z_5_0 */
+
+/* qhasm: fe z_10_5 */
+
+/* qhasm: fe z_10_0 */
+
+/* qhasm: fe z_20_10 */
+
+/* qhasm: fe z_20_0 */
+
+/* qhasm: fe z_40_20 */
+
+/* qhasm: fe z_40_0 */
+
+/* qhasm: fe z_50_10 */
+
+/* qhasm: fe z_50_0 */
+
+/* qhasm: fe z_100_50 */
+
+/* qhasm: fe z_100_0 */
+
+/* qhasm: fe z_200_100 */
+
+/* qhasm: fe z_200_0 */
+
+/* qhasm: fe z_250_50 */
+
+/* qhasm: fe z_250_0 */
+
+/* qhasm: fe z_252_2 */
+
+/* qhasm: fe z_252_3 */
+
+/* qhasm: enter pow22523 */
+
+/* qhasm: z2 = z1^2^1 */
+/* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */
+/* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */
+fe_sq(t0,z); /* for (i = 1;i < 1;++i) fe_sq(t0,t0); */
+
+/* qhasm: z8 = z2^2^2 */
+/* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */
+/* asm 2: fe_sq(>z8=t1,<z2=t0); for (i = 1;i < 2;++i) fe_sq(>z8=t1,>z8=t1); */
+fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
+
+/* qhasm: z9 = z1*z8 */
+/* asm 1: fe_mul(>z9=fe#2,<z1=fe#11,<z8=fe#2); */
+/* asm 2: fe_mul(>z9=t1,<z1=z,<z8=t1); */
+fe_mul(t1,z,t1);
+
+/* qhasm: z11 = z2*z9 */
+/* asm 1: fe_mul(>z11=fe#1,<z2=fe#1,<z9=fe#2); */
+/* asm 2: fe_mul(>z11=t0,<z2=t0,<z9=t1); */
+fe_mul(t0,t0,t1);
+
+/* qhasm: z22 = z11^2^1 */
+/* asm 1: fe_sq(>z22=fe#1,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#1,>z22=fe#1); */
+/* asm 2: fe_sq(>z22=t0,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t0,>z22=t0); */
+fe_sq(t0,t0); /* for (i = 1;i < 1;++i) fe_sq(t0,t0); */
+
+/* qhasm: z_5_0 = z9*z22 */
+/* asm 1: fe_mul(>z_5_0=fe#1,<z9=fe#2,<z22=fe#1); */
+/* asm 2: fe_mul(>z_5_0=t0,<z9=t1,<z22=t0); */
+fe_mul(t0,t1,t0);
+
+/* qhasm: z_10_5 = z_5_0^2^5 */
+/* asm 1: fe_sq(>z_10_5=fe#2,<z_5_0=fe#1); for (i = 1;i < 5;++i) fe_sq(>z_10_5=fe#2,>z_10_5=fe#2); */
+/* asm 2: fe_sq(>z_10_5=t1,<z_5_0=t0); for (i = 1;i < 5;++i) fe_sq(>z_10_5=t1,>z_10_5=t1); */
+fe_sq(t1,t0); for (i = 1;i < 5;++i) fe_sq(t1,t1);
+
+/* qhasm: z_10_0 = z_10_5*z_5_0 */
+/* asm 1: fe_mul(>z_10_0=fe#1,<z_10_5=fe#2,<z_5_0=fe#1); */
+/* asm 2: fe_mul(>z_10_0=t0,<z_10_5=t1,<z_5_0=t0); */
+fe_mul(t0,t1,t0);
+
+/* qhasm: z_20_10 = z_10_0^2^10 */
+/* asm 1: fe_sq(>z_20_10=fe#2,<z_10_0=fe#1); for (i = 1;i < 10;++i) fe_sq(>z_20_10=fe#2,>z_20_10=fe#2); */
+/* asm 2: fe_sq(>z_20_10=t1,<z_10_0=t0); for (i = 1;i < 10;++i) fe_sq(>z_20_10=t1,>z_20_10=t1); */
+fe_sq(t1,t0); for (i = 1;i < 10;++i) fe_sq(t1,t1);
+
+/* qhasm: z_20_0 = z_20_10*z_10_0 */
+/* asm 1: fe_mul(>z_20_0=fe#2,<z_20_10=fe#2,<z_10_0=fe#1); */
+/* asm 2: fe_mul(>z_20_0=t1,<z_20_10=t1,<z_10_0=t0); */
+fe_mul(t1,t1,t0);
+
+/* qhasm: z_40_20 = z_20_0^2^20 */
+/* asm 1: fe_sq(>z_40_20=fe#3,<z_20_0=fe#2); for (i = 1;i < 20;++i) fe_sq(>z_40_20=fe#3,>z_40_20=fe#3); */
+/* asm 2: fe_sq(>z_40_20=t2,<z_20_0=t1); for (i = 1;i < 20;++i) fe_sq(>z_40_20=t2,>z_40_20=t2); */
+fe_sq(t2,t1); for (i = 1;i < 20;++i) fe_sq(t2,t2);
+
+/* qhasm: z_40_0 = z_40_20*z_20_0 */
+/* asm 1: fe_mul(>z_40_0=fe#2,<z_40_20=fe#3,<z_20_0=fe#2); */
+/* asm 2: fe_mul(>z_40_0=t1,<z_40_20=t2,<z_20_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_50_10 = z_40_0^2^10 */
+/* asm 1: fe_sq(>z_50_10=fe#2,<z_40_0=fe#2); for (i = 1;i < 10;++i) fe_sq(>z_50_10=fe#2,>z_50_10=fe#2); */
+/* asm 2: fe_sq(>z_50_10=t1,<z_40_0=t1); for (i = 1;i < 10;++i) fe_sq(>z_50_10=t1,>z_50_10=t1); */
+fe_sq(t1,t1); for (i = 1;i < 10;++i) fe_sq(t1,t1);
+
+/* qhasm: z_50_0 = z_50_10*z_10_0 */
+/* asm 1: fe_mul(>z_50_0=fe#1,<z_50_10=fe#2,<z_10_0=fe#1); */
+/* asm 2: fe_mul(>z_50_0=t0,<z_50_10=t1,<z_10_0=t0); */
+fe_mul(t0,t1,t0);
+
+/* qhasm: z_100_50 = z_50_0^2^50 */
+/* asm 1: fe_sq(>z_100_50=fe#2,<z_50_0=fe#1); for (i = 1;i < 50;++i) fe_sq(>z_100_50=fe#2,>z_100_50=fe#2); */
+/* asm 2: fe_sq(>z_100_50=t1,<z_50_0=t0); for (i = 1;i < 50;++i) fe_sq(>z_100_50=t1,>z_100_50=t1); */
+fe_sq(t1,t0); for (i = 1;i < 50;++i) fe_sq(t1,t1);
+
+/* qhasm: z_100_0 = z_100_50*z_50_0 */
+/* asm 1: fe_mul(>z_100_0=fe#2,<z_100_50=fe#2,<z_50_0=fe#1); */
+/* asm 2: fe_mul(>z_100_0=t1,<z_100_50=t1,<z_50_0=t0); */
+fe_mul(t1,t1,t0);
+
+/* qhasm: z_200_100 = z_100_0^2^100 */
+/* asm 1: fe_sq(>z_200_100=fe#3,<z_100_0=fe#2); for (i = 1;i < 100;++i) fe_sq(>z_200_100=fe#3,>z_200_100=fe#3); */
+/* asm 2: fe_sq(>z_200_100=t2,<z_100_0=t1); for (i = 1;i < 100;++i) fe_sq(>z_200_100=t2,>z_200_100=t2); */
+fe_sq(t2,t1); for (i = 1;i < 100;++i) fe_sq(t2,t2);
+
+/* qhasm: z_200_0 = z_200_100*z_100_0 */
+/* asm 1: fe_mul(>z_200_0=fe#2,<z_200_100=fe#3,<z_100_0=fe#2); */
+/* asm 2: fe_mul(>z_200_0=t1,<z_200_100=t2,<z_100_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_250_50 = z_200_0^2^50 */
+/* asm 1: fe_sq(>z_250_50=fe#2,<z_200_0=fe#2); for (i = 1;i < 50;++i) fe_sq(>z_250_50=fe#2,>z_250_50=fe#2); */
+/* asm 2: fe_sq(>z_250_50=t1,<z_200_0=t1); for (i = 1;i < 50;++i) fe_sq(>z_250_50=t1,>z_250_50=t1); */
+fe_sq(t1,t1); for (i = 1;i < 50;++i) fe_sq(t1,t1);
+
+/* qhasm: z_250_0 = z_250_50*z_50_0 */
+/* asm 1: fe_mul(>z_250_0=fe#1,<z_250_50=fe#2,<z_50_0=fe#1); */
+/* asm 2: fe_mul(>z_250_0=t0,<z_250_50=t1,<z_50_0=t0); */
+fe_mul(t0,t1,t0);
+
+/* qhasm: z_252_2 = z_250_0^2^2 */
+/* asm 1: fe_sq(>z_252_2=fe#1,<z_250_0=fe#1); for (i = 1;i < 2;++i) fe_sq(>z_252_2=fe#1,>z_252_2=fe#1); */
+/* asm 2: fe_sq(>z_252_2=t0,<z_250_0=t0); for (i = 1;i < 2;++i) fe_sq(>z_252_2=t0,>z_252_2=t0); */
+fe_sq(t0,t0); for (i = 1;i < 2;++i) fe_sq(t0,t0);
+
+/* qhasm: z_252_3 = z_252_2*z1 */
+/* asm 1: fe_mul(>z_252_3=fe#12,<z_252_2=fe#1,<z1=fe#11); */
+/* asm 2: fe_mul(>z_252_3=out,<z_252_2=t0,<z1=z); */
+fe_mul(out,t0,z);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h
new file mode 100644
index 00000000..8397222e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h
@@ -0,0 +1,160 @@
+
+/* qhasm: fe z1 */
+
+/* qhasm: fe z2 */
+
+/* qhasm: fe z8 */
+
+/* qhasm: fe z9 */
+
+/* qhasm: fe z11 */
+
+/* qhasm: fe z22 */
+
+/* qhasm: fe z_5_0 */
+
+/* qhasm: fe z_10_5 */
+
+/* qhasm: fe z_10_0 */
+
+/* qhasm: fe z_20_10 */
+
+/* qhasm: fe z_20_0 */
+
+/* qhasm: fe z_40_20 */
+
+/* qhasm: fe z_40_0 */
+
+/* qhasm: fe z_50_10 */
+
+/* qhasm: fe z_50_0 */
+
+/* qhasm: fe z_100_50 */
+
+/* qhasm: fe z_100_0 */
+
+/* qhasm: fe z_200_100 */
+
+/* qhasm: fe z_200_0 */
+
+/* qhasm: fe z_250_50 */
+
+/* qhasm: fe z_250_0 */
+
+/* qhasm: fe z_255_5 */
+
+/* qhasm: fe z_255_21 */
+
+/* qhasm: enter pow225521 */
+
+/* qhasm: z2 = z1^2^1 */
+/* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */
+/* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */
+fe_sq(t0,z); /* for (i = 1;i < 1;++i) fe_sq(t0,t0); */
+
+/* qhasm: z8 = z2^2^2 */
+/* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */
+/* asm 2: fe_sq(>z8=t1,<z2=t0); for (i = 1;i < 2;++i) fe_sq(>z8=t1,>z8=t1); */
+fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
+
+/* qhasm: z9 = z1*z8 */
+/* asm 1: fe_mul(>z9=fe#2,<z1=fe#11,<z8=fe#2); */
+/* asm 2: fe_mul(>z9=t1,<z1=z,<z8=t1); */
+fe_mul(t1,z,t1);
+
+/* qhasm: z11 = z2*z9 */
+/* asm 1: fe_mul(>z11=fe#1,<z2=fe#1,<z9=fe#2); */
+/* asm 2: fe_mul(>z11=t0,<z2=t0,<z9=t1); */
+fe_mul(t0,t0,t1);
+
+/* qhasm: z22 = z11^2^1 */
+/* asm 1: fe_sq(>z22=fe#3,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#3,>z22=fe#3); */
+/* asm 2: fe_sq(>z22=t2,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t2,>z22=t2); */
+fe_sq(t2,t0); /* for (i = 1;i < 1;++i) fe_sq(t2,t2); */
+
+/* qhasm: z_5_0 = z9*z22 */
+/* asm 1: fe_mul(>z_5_0=fe#2,<z9=fe#2,<z22=fe#3); */
+/* asm 2: fe_mul(>z_5_0=t1,<z9=t1,<z22=t2); */
+fe_mul(t1,t1,t2);
+
+/* qhasm: z_10_5 = z_5_0^2^5 */
+/* asm 1: fe_sq(>z_10_5=fe#3,<z_5_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_10_5=fe#3,>z_10_5=fe#3); */
+/* asm 2: fe_sq(>z_10_5=t2,<z_5_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_10_5=t2,>z_10_5=t2); */
+fe_sq(t2,t1); for (i = 1;i < 5;++i) fe_sq(t2,t2);
+
+/* qhasm: z_10_0 = z_10_5*z_5_0 */
+/* asm 1: fe_mul(>z_10_0=fe#2,<z_10_5=fe#3,<z_5_0=fe#2); */
+/* asm 2: fe_mul(>z_10_0=t1,<z_10_5=t2,<z_5_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_20_10 = z_10_0^2^10 */
+/* asm 1: fe_sq(>z_20_10=fe#3,<z_10_0=fe#2); for (i = 1;i < 10;++i) fe_sq(>z_20_10=fe#3,>z_20_10=fe#3); */
+/* asm 2: fe_sq(>z_20_10=t2,<z_10_0=t1); for (i = 1;i < 10;++i) fe_sq(>z_20_10=t2,>z_20_10=t2); */
+fe_sq(t2,t1); for (i = 1;i < 10;++i) fe_sq(t2,t2);
+
+/* qhasm: z_20_0 = z_20_10*z_10_0 */
+/* asm 1: fe_mul(>z_20_0=fe#3,<z_20_10=fe#3,<z_10_0=fe#2); */
+/* asm 2: fe_mul(>z_20_0=t2,<z_20_10=t2,<z_10_0=t1); */
+fe_mul(t2,t2,t1);
+
+/* qhasm: z_40_20 = z_20_0^2^20 */
+/* asm 1: fe_sq(>z_40_20=fe#4,<z_20_0=fe#3); for (i = 1;i < 20;++i) fe_sq(>z_40_20=fe#4,>z_40_20=fe#4); */
+/* asm 2: fe_sq(>z_40_20=t3,<z_20_0=t2); for (i = 1;i < 20;++i) fe_sq(>z_40_20=t3,>z_40_20=t3); */
+fe_sq(t3,t2); for (i = 1;i < 20;++i) fe_sq(t3,t3);
+
+/* qhasm: z_40_0 = z_40_20*z_20_0 */
+/* asm 1: fe_mul(>z_40_0=fe#3,<z_40_20=fe#4,<z_20_0=fe#3); */
+/* asm 2: fe_mul(>z_40_0=t2,<z_40_20=t3,<z_20_0=t2); */
+fe_mul(t2,t3,t2);
+
+/* qhasm: z_50_10 = z_40_0^2^10 */
+/* asm 1: fe_sq(>z_50_10=fe#3,<z_40_0=fe#3); for (i = 1;i < 10;++i) fe_sq(>z_50_10=fe#3,>z_50_10=fe#3); */
+/* asm 2: fe_sq(>z_50_10=t2,<z_40_0=t2); for (i = 1;i < 10;++i) fe_sq(>z_50_10=t2,>z_50_10=t2); */
+fe_sq(t2,t2); for (i = 1;i < 10;++i) fe_sq(t2,t2);
+
+/* qhasm: z_50_0 = z_50_10*z_10_0 */
+/* asm 1: fe_mul(>z_50_0=fe#2,<z_50_10=fe#3,<z_10_0=fe#2); */
+/* asm 2: fe_mul(>z_50_0=t1,<z_50_10=t2,<z_10_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_100_50 = z_50_0^2^50 */
+/* asm 1: fe_sq(>z_100_50=fe#3,<z_50_0=fe#2); for (i = 1;i < 50;++i) fe_sq(>z_100_50=fe#3,>z_100_50=fe#3); */
+/* asm 2: fe_sq(>z_100_50=t2,<z_50_0=t1); for (i = 1;i < 50;++i) fe_sq(>z_100_50=t2,>z_100_50=t2); */
+fe_sq(t2,t1); for (i = 1;i < 50;++i) fe_sq(t2,t2);
+
+/* qhasm: z_100_0 = z_100_50*z_50_0 */
+/* asm 1: fe_mul(>z_100_0=fe#3,<z_100_50=fe#3,<z_50_0=fe#2); */
+/* asm 2: fe_mul(>z_100_0=t2,<z_100_50=t2,<z_50_0=t1); */
+fe_mul(t2,t2,t1);
+
+/* qhasm: z_200_100 = z_100_0^2^100 */
+/* asm 1: fe_sq(>z_200_100=fe#4,<z_100_0=fe#3); for (i = 1;i < 100;++i) fe_sq(>z_200_100=fe#4,>z_200_100=fe#4); */
+/* asm 2: fe_sq(>z_200_100=t3,<z_100_0=t2); for (i = 1;i < 100;++i) fe_sq(>z_200_100=t3,>z_200_100=t3); */
+fe_sq(t3,t2); for (i = 1;i < 100;++i) fe_sq(t3,t3);
+
+/* qhasm: z_200_0 = z_200_100*z_100_0 */
+/* asm 1: fe_mul(>z_200_0=fe#3,<z_200_100=fe#4,<z_100_0=fe#3); */
+/* asm 2: fe_mul(>z_200_0=t2,<z_200_100=t3,<z_100_0=t2); */
+fe_mul(t2,t3,t2);
+
+/* qhasm: z_250_50 = z_200_0^2^50 */
+/* asm 1: fe_sq(>z_250_50=fe#3,<z_200_0=fe#3); for (i = 1;i < 50;++i) fe_sq(>z_250_50=fe#3,>z_250_50=fe#3); */
+/* asm 2: fe_sq(>z_250_50=t2,<z_200_0=t2); for (i = 1;i < 50;++i) fe_sq(>z_250_50=t2,>z_250_50=t2); */
+fe_sq(t2,t2); for (i = 1;i < 50;++i) fe_sq(t2,t2);
+
+/* qhasm: z_250_0 = z_250_50*z_50_0 */
+/* asm 1: fe_mul(>z_250_0=fe#2,<z_250_50=fe#3,<z_50_0=fe#2); */
+/* asm 2: fe_mul(>z_250_0=t1,<z_250_50=t2,<z_50_0=t1); */
+fe_mul(t1,t2,t1);
+
+/* qhasm: z_255_5 = z_250_0^2^5 */
+/* asm 1: fe_sq(>z_255_5=fe#2,<z_250_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_255_5=fe#2,>z_255_5=fe#2); */
+/* asm 2: fe_sq(>z_255_5=t1,<z_250_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_255_5=t1,>z_255_5=t1); */
+fe_sq(t1,t1); for (i = 1;i < 5;++i) fe_sq(t1,t1);
+
+/* qhasm: z_255_21 = z_255_5*z11 */
+/* asm 1: fe_mul(>z_255_21=fe#12,<z_255_5=fe#2,<z11=fe#1); */
+/* asm 2: fe_mul(>z_255_21=out,<z_255_5=t1,<z11=t0); */
+fe_mul(out,t1,t0);
+
+/* qhasm: return */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc.h
new file mode 100644
index 00000000..d32ed2e8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc.h
@@ -0,0 +1,15 @@
+#ifndef SC_H
+#define SC_H
+
+/*
+The set of scalars is \Z/l
+where l = 2^252 + 27742317777372353535851937790883648493.
+*/
+
+#define sc_reduce crypto_sign_ed25519_ref10_sc_reduce
+#define sc_muladd crypto_sign_ed25519_ref10_sc_muladd
+
+extern void sc_reduce(unsigned char *);
+extern void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *);
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_muladd.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_muladd.c
new file mode 100644
index 00000000..ccf4a682
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_muladd.c
@@ -0,0 +1,368 @@
+#include "sc.h"
+#include "crypto_int64.h"
+#include "crypto_uint32.h"
+#include "crypto_uint64.h"
+
+static crypto_uint64 load_3(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ return result;
+}
+
+static crypto_uint64 load_4(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ result |= ((crypto_uint64) in[3]) << 24;
+ return result;
+}
+
+/*
+Input:
+ a[0]+256*a[1]+...+256^31*a[31] = a
+ b[0]+256*b[1]+...+256^31*b[31] = b
+ c[0]+256*c[1]+...+256^31*c[31] = c
+
+Output:
+ s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+*/
+
+void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,const unsigned char *c)
+{
+ crypto_int64 a0 = 2097151 & load_3(a);
+ crypto_int64 a1 = 2097151 & (load_4(a + 2) >> 5);
+ crypto_int64 a2 = 2097151 & (load_3(a + 5) >> 2);
+ crypto_int64 a3 = 2097151 & (load_4(a + 7) >> 7);
+ crypto_int64 a4 = 2097151 & (load_4(a + 10) >> 4);
+ crypto_int64 a5 = 2097151 & (load_3(a + 13) >> 1);
+ crypto_int64 a6 = 2097151 & (load_4(a + 15) >> 6);
+ crypto_int64 a7 = 2097151 & (load_3(a + 18) >> 3);
+ crypto_int64 a8 = 2097151 & load_3(a + 21);
+ crypto_int64 a9 = 2097151 & (load_4(a + 23) >> 5);
+ crypto_int64 a10 = 2097151 & (load_3(a + 26) >> 2);
+ crypto_int64 a11 = (load_4(a + 28) >> 7);
+ crypto_int64 b0 = 2097151 & load_3(b);
+ crypto_int64 b1 = 2097151 & (load_4(b + 2) >> 5);
+ crypto_int64 b2 = 2097151 & (load_3(b + 5) >> 2);
+ crypto_int64 b3 = 2097151 & (load_4(b + 7) >> 7);
+ crypto_int64 b4 = 2097151 & (load_4(b + 10) >> 4);
+ crypto_int64 b5 = 2097151 & (load_3(b + 13) >> 1);
+ crypto_int64 b6 = 2097151 & (load_4(b + 15) >> 6);
+ crypto_int64 b7 = 2097151 & (load_3(b + 18) >> 3);
+ crypto_int64 b8 = 2097151 & load_3(b + 21);
+ crypto_int64 b9 = 2097151 & (load_4(b + 23) >> 5);
+ crypto_int64 b10 = 2097151 & (load_3(b + 26) >> 2);
+ crypto_int64 b11 = (load_4(b + 28) >> 7);
+ crypto_int64 c0 = 2097151 & load_3(c);
+ crypto_int64 c1 = 2097151 & (load_4(c + 2) >> 5);
+ crypto_int64 c2 = 2097151 & (load_3(c + 5) >> 2);
+ crypto_int64 c3 = 2097151 & (load_4(c + 7) >> 7);
+ crypto_int64 c4 = 2097151 & (load_4(c + 10) >> 4);
+ crypto_int64 c5 = 2097151 & (load_3(c + 13) >> 1);
+ crypto_int64 c6 = 2097151 & (load_4(c + 15) >> 6);
+ crypto_int64 c7 = 2097151 & (load_3(c + 18) >> 3);
+ crypto_int64 c8 = 2097151 & load_3(c + 21);
+ crypto_int64 c9 = 2097151 & (load_4(c + 23) >> 5);
+ crypto_int64 c10 = 2097151 & (load_3(c + 26) >> 2);
+ crypto_int64 c11 = (load_4(c + 28) >> 7);
+ crypto_int64 s0;
+ crypto_int64 s1;
+ crypto_int64 s2;
+ crypto_int64 s3;
+ crypto_int64 s4;
+ crypto_int64 s5;
+ crypto_int64 s6;
+ crypto_int64 s7;
+ crypto_int64 s8;
+ crypto_int64 s9;
+ crypto_int64 s10;
+ crypto_int64 s11;
+ crypto_int64 s12;
+ crypto_int64 s13;
+ crypto_int64 s14;
+ crypto_int64 s15;
+ crypto_int64 s16;
+ crypto_int64 s17;
+ crypto_int64 s18;
+ crypto_int64 s19;
+ crypto_int64 s20;
+ crypto_int64 s21;
+ crypto_int64 s22;
+ crypto_int64 s23;
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+ crypto_int64 carry10;
+ crypto_int64 carry11;
+ crypto_int64 carry12;
+ crypto_int64 carry13;
+ crypto_int64 carry14;
+ crypto_int64 carry15;
+ crypto_int64 carry16;
+ crypto_int64 carry17;
+ crypto_int64 carry18;
+ crypto_int64 carry19;
+ crypto_int64 carry20;
+ crypto_int64 carry21;
+ crypto_int64 carry22;
+
+ s0 = c0 + a0*b0;
+ s1 = c1 + a0*b1 + a1*b0;
+ s2 = c2 + a0*b2 + a1*b1 + a2*b0;
+ s3 = c3 + a0*b3 + a1*b2 + a2*b1 + a3*b0;
+ s4 = c4 + a0*b4 + a1*b3 + a2*b2 + a3*b1 + a4*b0;
+ s5 = c5 + a0*b5 + a1*b4 + a2*b3 + a3*b2 + a4*b1 + a5*b0;
+ s6 = c6 + a0*b6 + a1*b5 + a2*b4 + a3*b3 + a4*b2 + a5*b1 + a6*b0;
+ s7 = c7 + a0*b7 + a1*b6 + a2*b5 + a3*b4 + a4*b3 + a5*b2 + a6*b1 + a7*b0;
+ s8 = c8 + a0*b8 + a1*b7 + a2*b6 + a3*b5 + a4*b4 + a5*b3 + a6*b2 + a7*b1 + a8*b0;
+ s9 = c9 + a0*b9 + a1*b8 + a2*b7 + a3*b6 + a4*b5 + a5*b4 + a6*b3 + a7*b2 + a8*b1 + a9*b0;
+ s10 = c10 + a0*b10 + a1*b9 + a2*b8 + a3*b7 + a4*b6 + a5*b5 + a6*b4 + a7*b3 + a8*b2 + a9*b1 + a10*b0;
+ s11 = c11 + a0*b11 + a1*b10 + a2*b9 + a3*b8 + a4*b7 + a5*b6 + a6*b5 + a7*b4 + a8*b3 + a9*b2 + a10*b1 + a11*b0;
+ s12 = a1*b11 + a2*b10 + a3*b9 + a4*b8 + a5*b7 + a6*b6 + a7*b5 + a8*b4 + a9*b3 + a10*b2 + a11*b1;
+ s13 = a2*b11 + a3*b10 + a4*b9 + a5*b8 + a6*b7 + a7*b6 + a8*b5 + a9*b4 + a10*b3 + a11*b2;
+ s14 = a3*b11 + a4*b10 + a5*b9 + a6*b8 + a7*b7 + a8*b6 + a9*b5 + a10*b4 + a11*b3;
+ s15 = a4*b11 + a5*b10 + a6*b9 + a7*b8 + a8*b7 + a9*b6 + a10*b5 + a11*b4;
+ s16 = a5*b11 + a6*b10 + a7*b9 + a8*b8 + a9*b7 + a10*b6 + a11*b5;
+ s17 = a6*b11 + a7*b10 + a8*b9 + a9*b8 + a10*b7 + a11*b6;
+ s18 = a7*b11 + a8*b10 + a9*b9 + a10*b8 + a11*b7;
+ s19 = a8*b11 + a9*b10 + a10*b9 + a11*b8;
+ s20 = a9*b11 + a10*b10 + a11*b9;
+ s21 = a10*b11 + a11*b10;
+ s22 = a11*b11;
+ s23 = 0;
+
+ carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
+ carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
+ carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
+ carry18 = (s18 + (1<<20)) >> 21; s19 += carry18; s18 -= carry18 << 21;
+ carry20 = (s20 + (1<<20)) >> 21; s21 += carry20; s20 -= carry20 << 21;
+ carry22 = (s22 + (1<<20)) >> 21; s23 += carry22; s22 -= carry22 << 21;
+
+ carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+ carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
+ carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
+ carry17 = (s17 + (1<<20)) >> 21; s18 += carry17; s17 -= carry17 << 21;
+ carry19 = (s19 + (1<<20)) >> 21; s20 += carry19; s19 -= carry19 << 21;
+ carry21 = (s21 + (1<<20)) >> 21; s22 += carry21; s21 -= carry21 << 21;
+
+ s11 += s23 * 666643;
+ s12 += s23 * 470296;
+ s13 += s23 * 654183;
+ s14 -= s23 * 997805;
+ s15 += s23 * 136657;
+ s16 -= s23 * 683901;
+
+
+ s10 += s22 * 666643;
+ s11 += s22 * 470296;
+ s12 += s22 * 654183;
+ s13 -= s22 * 997805;
+ s14 += s22 * 136657;
+ s15 -= s22 * 683901;
+
+
+ s9 += s21 * 666643;
+ s10 += s21 * 470296;
+ s11 += s21 * 654183;
+ s12 -= s21 * 997805;
+ s13 += s21 * 136657;
+ s14 -= s21 * 683901;
+
+
+ s8 += s20 * 666643;
+ s9 += s20 * 470296;
+ s10 += s20 * 654183;
+ s11 -= s20 * 997805;
+ s12 += s20 * 136657;
+ s13 -= s20 * 683901;
+
+
+ s7 += s19 * 666643;
+ s8 += s19 * 470296;
+ s9 += s19 * 654183;
+ s10 -= s19 * 997805;
+ s11 += s19 * 136657;
+ s12 -= s19 * 683901;
+
+
+ s6 += s18 * 666643;
+ s7 += s18 * 470296;
+ s8 += s18 * 654183;
+ s9 -= s18 * 997805;
+ s10 += s18 * 136657;
+ s11 -= s18 * 683901;
+
+
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
+ carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
+ carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
+
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+ carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
+ carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
+
+ s5 += s17 * 666643;
+ s6 += s17 * 470296;
+ s7 += s17 * 654183;
+ s8 -= s17 * 997805;
+ s9 += s17 * 136657;
+ s10 -= s17 * 683901;
+
+
+ s4 += s16 * 666643;
+ s5 += s16 * 470296;
+ s6 += s16 * 654183;
+ s7 -= s16 * 997805;
+ s8 += s16 * 136657;
+ s9 -= s16 * 683901;
+
+
+ s3 += s15 * 666643;
+ s4 += s15 * 470296;
+ s5 += s15 * 654183;
+ s6 -= s15 * 997805;
+ s7 += s15 * 136657;
+ s8 -= s15 * 683901;
+
+
+ s2 += s14 * 666643;
+ s3 += s14 * 470296;
+ s4 += s14 * 654183;
+ s5 -= s14 * 997805;
+ s6 += s14 * 136657;
+ s7 -= s14 * 683901;
+
+
+ s1 += s13 * 666643;
+ s2 += s13 * 470296;
+ s3 += s13 * 654183;
+ s4 -= s13 * 997805;
+ s5 += s13 * 136657;
+ s6 -= s13 * 683901;
+
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+
+ carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry11 = s11 >> 21; s12 += carry11; s11 -= carry11 << 21;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+
+
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
+
+ s[0] = s0 >> 0;
+ s[1] = s0 >> 8;
+ s[2] = (s0 >> 16) | (s1 << 5);
+ s[3] = s1 >> 3;
+ s[4] = s1 >> 11;
+ s[5] = (s1 >> 19) | (s2 << 2);
+ s[6] = s2 >> 6;
+ s[7] = (s2 >> 14) | (s3 << 7);
+ s[8] = s3 >> 1;
+ s[9] = s3 >> 9;
+ s[10] = (s3 >> 17) | (s4 << 4);
+ s[11] = s4 >> 4;
+ s[12] = s4 >> 12;
+ s[13] = (s4 >> 20) | (s5 << 1);
+ s[14] = s5 >> 7;
+ s[15] = (s5 >> 15) | (s6 << 6);
+ s[16] = s6 >> 2;
+ s[17] = s6 >> 10;
+ s[18] = (s6 >> 18) | (s7 << 3);
+ s[19] = s7 >> 5;
+ s[20] = s7 >> 13;
+ s[21] = s8 >> 0;
+ s[22] = s8 >> 8;
+ s[23] = (s8 >> 16) | (s9 << 5);
+ s[24] = s9 >> 3;
+ s[25] = s9 >> 11;
+ s[26] = (s9 >> 19) | (s10 << 2);
+ s[27] = s10 >> 6;
+ s[28] = (s10 >> 14) | (s11 << 7);
+ s[29] = s11 >> 1;
+ s[30] = s11 >> 9;
+ s[31] = s11 >> 17;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_reduce.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_reduce.c
new file mode 100644
index 00000000..e5caefc2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_reduce.c
@@ -0,0 +1,275 @@
+#include "sc.h"
+#include "crypto_int64.h"
+#include "crypto_uint32.h"
+#include "crypto_uint64.h"
+
+static crypto_uint64 load_3(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ return result;
+}
+
+static crypto_uint64 load_4(const unsigned char *in)
+{
+ crypto_uint64 result;
+ result = (crypto_uint64) in[0];
+ result |= ((crypto_uint64) in[1]) << 8;
+ result |= ((crypto_uint64) in[2]) << 16;
+ result |= ((crypto_uint64) in[3]) << 24;
+ return result;
+}
+
+/*
+Input:
+ s[0]+256*s[1]+...+256^63*s[63] = s
+
+Output:
+ s[0]+256*s[1]+...+256^31*s[31] = s mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ Overwrites s in place.
+*/
+
+void sc_reduce(unsigned char *s)
+{
+ crypto_int64 s0 = 2097151 & load_3(s);
+ crypto_int64 s1 = 2097151 & (load_4(s + 2) >> 5);
+ crypto_int64 s2 = 2097151 & (load_3(s + 5) >> 2);
+ crypto_int64 s3 = 2097151 & (load_4(s + 7) >> 7);
+ crypto_int64 s4 = 2097151 & (load_4(s + 10) >> 4);
+ crypto_int64 s5 = 2097151 & (load_3(s + 13) >> 1);
+ crypto_int64 s6 = 2097151 & (load_4(s + 15) >> 6);
+ crypto_int64 s7 = 2097151 & (load_3(s + 18) >> 3);
+ crypto_int64 s8 = 2097151 & load_3(s + 21);
+ crypto_int64 s9 = 2097151 & (load_4(s + 23) >> 5);
+ crypto_int64 s10 = 2097151 & (load_3(s + 26) >> 2);
+ crypto_int64 s11 = 2097151 & (load_4(s + 28) >> 7);
+ crypto_int64 s12 = 2097151 & (load_4(s + 31) >> 4);
+ crypto_int64 s13 = 2097151 & (load_3(s + 34) >> 1);
+ crypto_int64 s14 = 2097151 & (load_4(s + 36) >> 6);
+ crypto_int64 s15 = 2097151 & (load_3(s + 39) >> 3);
+ crypto_int64 s16 = 2097151 & load_3(s + 42);
+ crypto_int64 s17 = 2097151 & (load_4(s + 44) >> 5);
+ crypto_int64 s18 = 2097151 & (load_3(s + 47) >> 2);
+ crypto_int64 s19 = 2097151 & (load_4(s + 49) >> 7);
+ crypto_int64 s20 = 2097151 & (load_4(s + 52) >> 4);
+ crypto_int64 s21 = 2097151 & (load_3(s + 55) >> 1);
+ crypto_int64 s22 = 2097151 & (load_4(s + 57) >> 6);
+ crypto_int64 s23 = (load_4(s + 60) >> 3);
+ crypto_int64 carry0;
+ crypto_int64 carry1;
+ crypto_int64 carry2;
+ crypto_int64 carry3;
+ crypto_int64 carry4;
+ crypto_int64 carry5;
+ crypto_int64 carry6;
+ crypto_int64 carry7;
+ crypto_int64 carry8;
+ crypto_int64 carry9;
+ crypto_int64 carry10;
+ crypto_int64 carry11;
+ crypto_int64 carry12;
+ crypto_int64 carry13;
+ crypto_int64 carry14;
+ crypto_int64 carry15;
+ crypto_int64 carry16;
+
+ s11 += s23 * 666643;
+ s12 += s23 * 470296;
+ s13 += s23 * 654183;
+ s14 -= s23 * 997805;
+ s15 += s23 * 136657;
+ s16 -= s23 * 683901;
+
+
+ s10 += s22 * 666643;
+ s11 += s22 * 470296;
+ s12 += s22 * 654183;
+ s13 -= s22 * 997805;
+ s14 += s22 * 136657;
+ s15 -= s22 * 683901;
+
+
+ s9 += s21 * 666643;
+ s10 += s21 * 470296;
+ s11 += s21 * 654183;
+ s12 -= s21 * 997805;
+ s13 += s21 * 136657;
+ s14 -= s21 * 683901;
+
+
+ s8 += s20 * 666643;
+ s9 += s20 * 470296;
+ s10 += s20 * 654183;
+ s11 -= s20 * 997805;
+ s12 += s20 * 136657;
+ s13 -= s20 * 683901;
+
+
+ s7 += s19 * 666643;
+ s8 += s19 * 470296;
+ s9 += s19 * 654183;
+ s10 -= s19 * 997805;
+ s11 += s19 * 136657;
+ s12 -= s19 * 683901;
+
+
+ s6 += s18 * 666643;
+ s7 += s18 * 470296;
+ s8 += s18 * 654183;
+ s9 -= s18 * 997805;
+ s10 += s18 * 136657;
+ s11 -= s18 * 683901;
+
+
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
+ carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
+ carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
+
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+ carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
+ carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
+
+ s5 += s17 * 666643;
+ s6 += s17 * 470296;
+ s7 += s17 * 654183;
+ s8 -= s17 * 997805;
+ s9 += s17 * 136657;
+ s10 -= s17 * 683901;
+
+
+ s4 += s16 * 666643;
+ s5 += s16 * 470296;
+ s6 += s16 * 654183;
+ s7 -= s16 * 997805;
+ s8 += s16 * 136657;
+ s9 -= s16 * 683901;
+
+
+ s3 += s15 * 666643;
+ s4 += s15 * 470296;
+ s5 += s15 * 654183;
+ s6 -= s15 * 997805;
+ s7 += s15 * 136657;
+ s8 -= s15 * 683901;
+
+
+ s2 += s14 * 666643;
+ s3 += s14 * 470296;
+ s4 += s14 * 654183;
+ s5 -= s14 * 997805;
+ s6 += s14 * 136657;
+ s7 -= s14 * 683901;
+
+
+ s1 += s13 * 666643;
+ s2 += s13 * 470296;
+ s3 += s13 * 654183;
+ s4 -= s13 * 997805;
+ s5 += s13 * 136657;
+ s6 -= s13 * 683901;
+
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
+
+ carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+ s12 = 0;
+
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
+ carry11 = s11 >> 21; s12 += carry11; s11 -= carry11 << 21;
+
+ s0 += s12 * 666643;
+ s1 += s12 * 470296;
+ s2 += s12 * 654183;
+ s3 -= s12 * 997805;
+ s4 += s12 * 136657;
+ s5 -= s12 * 683901;
+
+
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
+
+ s[0] = s0 >> 0;
+ s[1] = s0 >> 8;
+ s[2] = (s0 >> 16) | (s1 << 5);
+ s[3] = s1 >> 3;
+ s[4] = s1 >> 11;
+ s[5] = (s1 >> 19) | (s2 << 2);
+ s[6] = s2 >> 6;
+ s[7] = (s2 >> 14) | (s3 << 7);
+ s[8] = s3 >> 1;
+ s[9] = s3 >> 9;
+ s[10] = (s3 >> 17) | (s4 << 4);
+ s[11] = s4 >> 4;
+ s[12] = s4 >> 12;
+ s[13] = (s4 >> 20) | (s5 << 1);
+ s[14] = s5 >> 7;
+ s[15] = (s5 >> 15) | (s6 << 6);
+ s[16] = s6 >> 2;
+ s[17] = s6 >> 10;
+ s[18] = (s6 >> 18) | (s7 << 3);
+ s[19] = s7 >> 5;
+ s[20] = s7 >> 13;
+ s[21] = s8 >> 0;
+ s[22] = s8 >> 8;
+ s[23] = (s8 >> 16) | (s9 << 5);
+ s[24] = s9 >> 3;
+ s[25] = s9 >> 11;
+ s[26] = (s9 >> 19) | (s10 << 2);
+ s[27] = s10 >> 6;
+ s[28] = (s10 >> 14) | (s11 << 7);
+ s[29] = s11 >> 1;
+ s[30] = s11 >> 9;
+ s[31] = s11 >> 17;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c
new file mode 100644
index 00000000..fa3080eb
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c
@@ -0,0 +1,81 @@
+
+#include <string.h>
+
+#include "api.h"
+#include "crypto_hash_sha512.h"
+#include "ge.h"
+#include "sc.h"
+#include "utils.h"
+
+int
+crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *sk)
+{
+ crypto_hash_sha512_state hs;
+ unsigned char pk[32];
+ unsigned char az[64];
+ unsigned char nonce[64];
+ unsigned char hram[64];
+ ge_p3 R;
+
+ memmove(pk, sk + 32, 32);
+
+ crypto_hash_sha512(az, sk, 32);
+ az[0] &= 248;
+ az[31] &= 63;
+ az[31] |= 64;
+
+ crypto_hash_sha512_init(&hs);
+ crypto_hash_sha512_update(&hs, az + 32, 32);
+ crypto_hash_sha512_update(&hs, m, mlen);
+ crypto_hash_sha512_final(&hs, nonce);
+
+ memmove(sig + 32, pk, 32);
+
+ sc_reduce(nonce);
+ ge_scalarmult_base(&R, nonce);
+ ge_p3_tobytes(sig, &R);
+
+ crypto_hash_sha512_init(&hs);
+ crypto_hash_sha512_update(&hs, sig, 64);
+ crypto_hash_sha512_update(&hs, m, mlen);
+ crypto_hash_sha512_final(&hs, hram);
+
+ sc_reduce(hram);
+ sc_muladd(sig + 32, hram, az, nonce);
+
+ sodium_memzero(az, sizeof az);
+ sodium_memzero(nonce, sizeof nonce);
+
+ if (siglen_p != NULL) {
+ *siglen_p = 64U;
+ }
+ return 0;
+}
+
+int
+crypto_sign(unsigned char *sm, unsigned long long *smlen_p,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *sk)
+{
+ unsigned long long siglen;
+
+ memmove(sm + crypto_sign_ed25519_BYTES, m, mlen);
+/* LCOV_EXCL_START */
+ if (crypto_sign_detached(sm, &siglen, sm + crypto_sign_ed25519_BYTES,
+ mlen, sk) != 0 ||
+ siglen != crypto_sign_ed25519_BYTES) {
+ if (smlen_p != NULL) {
+ *smlen_p = 0;
+ }
+ memset(sm, 0, mlen + crypto_sign_ed25519_BYTES);
+ return -1;
+ }
+/* LCOV_EXCL_STOP */
+
+ if (smlen_p != NULL) {
+ *smlen_p = mlen + siglen;
+ }
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sqrtm1.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sqrtm1.h
new file mode 100644
index 00000000..d8caa23b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sqrtm1.h
@@ -0,0 +1 @@
+-32595792,-7943725,9377950,3500415,12389472,-272473,-25146209,-2005654,326686,11406482
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c
new file mode 100644
index 00000000..7ba6b4c3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c
@@ -0,0 +1,39 @@
+
+#include <string.h>
+
+#include "crypto_sign_ed25519.h"
+
+size_t
+crypto_sign_ed25519_bytes(void) {
+ return crypto_sign_ed25519_BYTES;
+}
+
+size_t
+crypto_sign_ed25519_seedbytes(void) {
+ return crypto_sign_ed25519_SEEDBYTES;
+}
+
+size_t
+crypto_sign_ed25519_publickeybytes(void) {
+ return crypto_sign_ed25519_PUBLICKEYBYTES;
+}
+
+size_t
+crypto_sign_ed25519_secretkeybytes(void) {
+ return crypto_sign_ed25519_SECRETKEYBYTES;
+}
+
+int
+crypto_sign_ed25519_sk_to_seed(unsigned char *seed, const unsigned char *sk)
+{
+ memmove(seed, sk, crypto_sign_ed25519_SEEDBYTES);
+ return 0;
+}
+
+int
+crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
+{
+ memmove(pk, sk + crypto_sign_ed25519_SEEDBYTES,
+ crypto_sign_ed25519_PUBLICKEYBYTES);
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h
new file mode 100644
index 00000000..5cb0f760
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h
@@ -0,0 +1,12 @@
+
+#include "crypto_sign_edwards25519sha512batch.h"
+
+#define crypto_sign crypto_sign_edwards25519sha512batch
+#define crypto_sign_open crypto_sign_edwards25519sha512batch_open
+#define crypto_sign_keypair crypto_sign_edwards25519sha512batch_keypair
+#define crypto_sign_BYTES crypto_sign_edwards25519sha512batch_BYTES
+#define crypto_sign_PUBLICKEYBYTES crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES
+#define crypto_sign_SECRETKEYBYTES crypto_sign_edwards25519sha512batch_SECRETKEYBYTES
+#define crypto_sign_IMPLEMENTATION crypto_sign_edwards25519sha512batch_IMPLEMENTATION
+#define crypto_sign_VERSION crypto_sign_edwards25519sha512batch_VERSION
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519.h
new file mode 100644
index 00000000..98c613fa
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519.h
@@ -0,0 +1,54 @@
+#ifndef FE25519_H
+#define FE25519_H
+
+#define fe25519 crypto_sign_edwards25519sha512batch_fe25519
+#define fe25519_unpack crypto_sign_edwards25519sha512batch_fe25519_unpack
+#define fe25519_pack crypto_sign_edwards25519sha512batch_fe25519_pack
+#define fe25519_cmov crypto_sign_edwards25519sha512batch_fe25519_cmov
+#define fe25519_setone crypto_sign_edwards25519sha512batch_fe25519_setone
+#define fe25519_setzero crypto_sign_edwards25519sha512batch_fe25519_setzero
+#define fe25519_neg crypto_sign_edwards25519sha512batch_fe25519_neg
+#define fe25519_getparity crypto_sign_edwards25519sha512batch_fe25519_getparity
+#define fe25519_add crypto_sign_edwards25519sha512batch_fe25519_add
+#define fe25519_sub crypto_sign_edwards25519sha512batch_fe25519_sub
+#define fe25519_mul crypto_sign_edwards25519sha512batch_fe25519_mul
+#define fe25519_square crypto_sign_edwards25519sha512batch_fe25519_square
+#define fe25519_pow crypto_sign_edwards25519sha512batch_fe25519_pow
+#define fe25519_sqrt_vartime crypto_sign_edwards25519sha512batch_fe25519_sqrt_vartime
+#define fe25519_invert crypto_sign_edwards25519sha512batch_fe25519_invert
+
+#include "crypto_uint32.h"
+
+typedef struct {
+ crypto_uint32 v[32];
+} fe25519;
+
+void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
+
+void fe25519_pack(unsigned char r[32], const fe25519 *x);
+
+void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b);
+
+void fe25519_setone(fe25519 *r);
+
+void fe25519_setzero(fe25519 *r);
+
+void fe25519_neg(fe25519 *r, const fe25519 *x);
+
+unsigned char fe25519_getparity(const fe25519 *x);
+
+void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
+
+void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
+
+void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
+
+void fe25519_square(fe25519 *r, const fe25519 *x);
+
+void fe25519_pow(fe25519 *r, const fe25519 *x, const unsigned char *e);
+
+int fe25519_sqrt_vartime(fe25519 *r, const fe25519 *x, unsigned char parity);
+
+void fe25519_invert(fe25519 *r, const fe25519 *x);
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c
new file mode 100644
index 00000000..df7a923e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c
@@ -0,0 +1,348 @@
+#include "fe25519.h"
+
+#define WINDOWSIZE 4 /* Should be 1,2, or 4 */
+#define WINDOWMASK ((1<<WINDOWSIZE)-1)
+
+static void reduce_add_sub(fe25519 *r)
+{
+ crypto_uint32 t;
+ int i,rep;
+
+ for(rep=0;rep<4;rep++)
+ {
+ t = r->v[31] >> 7;
+ r->v[31] &= 127;
+ t *= 19;
+ r->v[0] += t;
+ for(i=0;i<31;i++)
+ {
+ t = r->v[i] >> 8;
+ r->v[i+1] += t;
+ r->v[i] &= 255;
+ }
+ }
+}
+
+static void reduce_mul(fe25519 *r)
+{
+ crypto_uint32 t;
+ int i,rep;
+
+ for(rep=0;rep<2;rep++)
+ {
+ t = r->v[31] >> 7;
+ r->v[31] &= 127;
+ t *= 19;
+ r->v[0] += t;
+ for(i=0;i<31;i++)
+ {
+ t = r->v[i] >> 8;
+ r->v[i+1] += t;
+ r->v[i] &= 255;
+ }
+ }
+}
+
+/* reduction modulo 2^255-19 */
+static void freeze(fe25519 *r)
+{
+ int i;
+ unsigned int m = (r->v[31] == 127);
+ for(i=30;i>1;i--)
+ m *= (r->v[i] == 255);
+ m *= (r->v[0] >= 237);
+
+ r->v[31] -= m*127;
+ for(i=30;i>0;i--)
+ r->v[i] -= m*255;
+ r->v[0] -= m*237;
+}
+
+/*freeze input before calling isone*/
+static int isone(const fe25519 *x)
+{
+ int i;
+ int r = (x->v[0] == 1);
+ for(i=1;i<32;i++)
+ r *= (x->v[i] == 0);
+ return r;
+}
+
+/*freeze input before calling iszero*/
+static int iszero(const fe25519 *x)
+{
+ int i;
+ int r = (x->v[0] == 0);
+ for(i=1;i<32;i++)
+ r *= (x->v[i] == 0);
+ return r;
+}
+
+
+static int issquare(const fe25519 *x)
+{
+ unsigned char e[32] = {0xf6,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f}; /* (p-1)/2 */
+ fe25519 t;
+
+ fe25519_pow(&t,x,e);
+ freeze(&t);
+ return isone(&t) || iszero(&t);
+}
+
+void fe25519_unpack(fe25519 *r, const unsigned char x[32])
+{
+ int i;
+ for(i=0;i<32;i++) r->v[i] = x[i];
+ r->v[31] &= 127;
+}
+
+/* Assumes input x being reduced mod 2^255 */
+void fe25519_pack(unsigned char r[32], const fe25519 *x)
+{
+ int i;
+ unsigned int m;
+ for(i=0;i<32;i++)
+ r[i] = x->v[i];
+
+ /* freeze byte array */
+ m = (r[31] == 127); /* XXX: some compilers might use branches; fix */
+ for(i=30;i>1;i--)
+ m *= (r[i] == 255);
+ m *= (r[0] >= 237);
+ r[31] -= m*127;
+ for(i=30;i>0;i--)
+ r[i] -= m*255;
+ r[0] -= m*237;
+}
+
+void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b)
+{
+ unsigned char nb = 1-b;
+ int i;
+ for(i=0;i<32;i++) r->v[i] = nb * r->v[i] + b * x->v[i];
+}
+
+unsigned char fe25519_getparity(const fe25519 *x)
+{
+ fe25519 t;
+ int i;
+ for(i=0;i<32;i++) t.v[i] = x->v[i];
+ freeze(&t);
+ return t.v[0] & 1;
+}
+
+void fe25519_setone(fe25519 *r)
+{
+ int i;
+ r->v[0] = 1;
+ for(i=1;i<32;i++) r->v[i]=0;
+}
+
+void fe25519_setzero(fe25519 *r)
+{
+ int i;
+ for(i=0;i<32;i++) r->v[i]=0;
+}
+
+void fe25519_neg(fe25519 *r, const fe25519 *x)
+{
+ fe25519 t;
+ int i;
+ for(i=0;i<32;i++) t.v[i]=x->v[i];
+ fe25519_setzero(r);
+ fe25519_sub(r, r, &t);
+}
+
+void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y)
+{
+ int i;
+ for(i=0;i<32;i++) r->v[i] = x->v[i] + y->v[i];
+ reduce_add_sub(r);
+}
+
+void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y)
+{
+ int i;
+ crypto_uint32 t[32];
+ t[0] = x->v[0] + 0x1da;
+ t[31] = x->v[31] + 0xfe;
+ for(i=1;i<31;i++) t[i] = x->v[i] + 0x1fe;
+ for(i=0;i<32;i++) r->v[i] = t[i] - y->v[i];
+ reduce_add_sub(r);
+}
+
+void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y)
+{
+ int i,j;
+ crypto_uint32 t[63];
+ for(i=0;i<63;i++)t[i] = 0;
+
+ for(i=0;i<32;i++)
+ for(j=0;j<32;j++)
+ t[i+j] += x->v[i] * y->v[j];
+
+ for(i=32;i<63;i++)
+ r->v[i-32] = t[i-32] + 38*t[i];
+ r->v[31] = t[31]; /* result now in r[0]...r[31] */
+
+ reduce_mul(r);
+}
+
+void fe25519_square(fe25519 *r, const fe25519 *x)
+{
+ fe25519_mul(r, x, x);
+}
+
+/*XXX: Make constant time! */
+void fe25519_pow(fe25519 *r, const fe25519 *x, const unsigned char *e)
+{
+ /*
+ fe25519 g;
+ fe25519_setone(&g);
+ int i;
+ unsigned char j;
+ for(i=32;i>0;i--)
+ {
+ for(j=128;j>0;j>>=1)
+ {
+ fe25519_square(&g,&g);
+ if(e[i-1] & j)
+ fe25519_mul(&g,&g,x);
+ }
+ }
+ for(i=0;i<32;i++) r->v[i] = g.v[i];
+ */
+ fe25519 g;
+ int i,j,k;
+ fe25519 t;
+ unsigned char w;
+ fe25519 pre[(1 << WINDOWSIZE)];
+
+ fe25519_setone(&g);
+
+ // Precomputation
+ fe25519_setone(pre);
+ pre[1] = *x;
+ for(i=2;i<(1<<WINDOWSIZE);i+=2)
+ {
+ fe25519_square(pre+i, pre+i/2);
+ fe25519_mul(pre+i+1, pre+i, pre+1);
+ }
+
+ // Fixed-window scalar multiplication
+ for(i=32;i>0;i--)
+ {
+ for(j=8-WINDOWSIZE;j>=0;j-=WINDOWSIZE)
+ {
+ for(k=0;k<WINDOWSIZE;k++)
+ fe25519_square(&g, &g);
+ // Cache-timing resistant loading of precomputed value:
+ w = (e[i-1]>>j) & WINDOWMASK;
+ t = pre[0];
+ for(k=1;k<(1<<WINDOWSIZE);k++)
+ fe25519_cmov(&t, &pre[k], k==w);
+ fe25519_mul(&g, &g, &t);
+ }
+ }
+ *r = g;
+}
+
+/* Return 0 on success, 1 otherwise */
+int fe25519_sqrt_vartime(fe25519 *r, const fe25519 *x, unsigned char parity)
+{
+ unsigned char e[32] = {0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f}; /* (p-1)/4 */
+ unsigned char e2[32] = {0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f}; /* (p+3)/8 */
+ unsigned char e3[32] = {0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f}; /* (p-5)/8 */
+ fe25519 p = {{0}};
+ fe25519 d;
+ int i;
+
+ /* See HAC, Alg. 3.37 */
+ if (!issquare(x)) return -1;
+ fe25519_pow(&d,x,e);
+ freeze(&d);
+ if(isone(&d))
+ fe25519_pow(r,x,e2);
+ else
+ {
+ for(i=0;i<32;i++)
+ d.v[i] = 4*x->v[i];
+ fe25519_pow(&d,&d,e3);
+ for(i=0;i<32;i++)
+ r->v[i] = 2*x->v[i];
+ fe25519_mul(r,r,&d);
+ }
+ freeze(r);
+ if((r->v[0] & 1) != (parity & 1))
+ {
+ fe25519_sub(r,&p,r);
+ }
+ return 0;
+}
+
+void fe25519_invert(fe25519 *r, const fe25519 *x)
+{
+ fe25519 z2;
+ fe25519 z9;
+ fe25519 z11;
+ fe25519 z2_5_0;
+ fe25519 z2_10_0;
+ fe25519 z2_20_0;
+ fe25519 z2_50_0;
+ fe25519 z2_100_0;
+ fe25519 t0;
+ fe25519 t1;
+ int i;
+
+ /* 2 */ fe25519_square(&z2,x);
+ /* 4 */ fe25519_square(&t1,&z2);
+ /* 8 */ fe25519_square(&t0,&t1);
+ /* 9 */ fe25519_mul(&z9,&t0,x);
+ /* 11 */ fe25519_mul(&z11,&z9,&z2);
+ /* 22 */ fe25519_square(&t0,&z11);
+ /* 2^5 - 2^0 = 31 */ fe25519_mul(&z2_5_0,&t0,&z9);
+
+ /* 2^6 - 2^1 */ fe25519_square(&t0,&z2_5_0);
+ /* 2^7 - 2^2 */ fe25519_square(&t1,&t0);
+ /* 2^8 - 2^3 */ fe25519_square(&t0,&t1);
+ /* 2^9 - 2^4 */ fe25519_square(&t1,&t0);
+ /* 2^10 - 2^5 */ fe25519_square(&t0,&t1);
+ /* 2^10 - 2^0 */ fe25519_mul(&z2_10_0,&t0,&z2_5_0);
+
+ /* 2^11 - 2^1 */ fe25519_square(&t0,&z2_10_0);
+ /* 2^12 - 2^2 */ fe25519_square(&t1,&t0);
+ /* 2^20 - 2^10 */ for (i = 2;i < 10;i += 2) { fe25519_square(&t0,&t1); fe25519_square(&t1,&t0); }
+ /* 2^20 - 2^0 */ fe25519_mul(&z2_20_0,&t1,&z2_10_0);
+
+ /* 2^21 - 2^1 */ fe25519_square(&t0,&z2_20_0);
+ /* 2^22 - 2^2 */ fe25519_square(&t1,&t0);
+ /* 2^40 - 2^20 */ for (i = 2;i < 20;i += 2) { fe25519_square(&t0,&t1); fe25519_square(&t1,&t0); }
+ /* 2^40 - 2^0 */ fe25519_mul(&t0,&t1,&z2_20_0);
+
+ /* 2^41 - 2^1 */ fe25519_square(&t1,&t0);
+ /* 2^42 - 2^2 */ fe25519_square(&t0,&t1);
+ /* 2^50 - 2^10 */ for (i = 2;i < 10;i += 2) { fe25519_square(&t1,&t0); fe25519_square(&t0,&t1); }
+ /* 2^50 - 2^0 */ fe25519_mul(&z2_50_0,&t0,&z2_10_0);
+
+ /* 2^51 - 2^1 */ fe25519_square(&t0,&z2_50_0);
+ /* 2^52 - 2^2 */ fe25519_square(&t1,&t0);
+ /* 2^100 - 2^50 */ for (i = 2;i < 50;i += 2) { fe25519_square(&t0,&t1); fe25519_square(&t1,&t0); }
+ /* 2^100 - 2^0 */ fe25519_mul(&z2_100_0,&t1,&z2_50_0);
+
+ /* 2^101 - 2^1 */ fe25519_square(&t1,&z2_100_0);
+ /* 2^102 - 2^2 */ fe25519_square(&t0,&t1);
+ /* 2^200 - 2^100 */ for (i = 2;i < 100;i += 2) { fe25519_square(&t1,&t0); fe25519_square(&t0,&t1); }
+ /* 2^200 - 2^0 */ fe25519_mul(&t1,&t0,&z2_100_0);
+
+ /* 2^201 - 2^1 */ fe25519_square(&t0,&t1);
+ /* 2^202 - 2^2 */ fe25519_square(&t1,&t0);
+ /* 2^250 - 2^50 */ for (i = 2;i < 50;i += 2) { fe25519_square(&t0,&t1); fe25519_square(&t1,&t0); }
+ /* 2^250 - 2^0 */ fe25519_mul(&t0,&t1,&z2_50_0);
+
+ /* 2^251 - 2^1 */ fe25519_square(&t1,&t0);
+ /* 2^252 - 2^2 */ fe25519_square(&t0,&t1);
+ /* 2^253 - 2^3 */ fe25519_square(&t1,&t0);
+ /* 2^254 - 2^4 */ fe25519_square(&t0,&t1);
+ /* 2^255 - 2^5 */ fe25519_square(&t1,&t0);
+ /* 2^255 - 21 */ fe25519_mul(r,&t1,&z11);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h
new file mode 100644
index 00000000..49ad163a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h
@@ -0,0 +1,34 @@
+#ifndef GE25519_H
+#define GE25519_H
+
+#include "fe25519.h"
+#include "sc25519.h"
+
+#define ge25519 crypto_sign_edwards25519sha512batch_ge25519
+#define ge25519_unpack_vartime crypto_sign_edwards25519sha512batch_ge25519_unpack_vartime
+#define ge25519_pack crypto_sign_edwards25519sha512batch_ge25519_pack
+#define ge25519_add crypto_sign_edwards25519sha512batch_ge25519_add
+#define ge25519_double crypto_sign_edwards25519sha512batch_ge25519_double
+#define ge25519_scalarmult crypto_sign_edwards25519sha512batch_ge25519_scalarmult
+#define ge25519_scalarmult_base crypto_sign_edwards25519sha512batch_ge25519_scalarmult_base
+
+typedef struct {
+ fe25519 x;
+ fe25519 y;
+ fe25519 z;
+ fe25519 t;
+} ge25519;
+
+int ge25519_unpack_vartime(ge25519 *r, const unsigned char p[32]);
+
+void ge25519_pack(unsigned char r[32], const ge25519 *p);
+
+void ge25519_add(ge25519 *r, const ge25519 *p, const ge25519 *q);
+
+void ge25519_double(ge25519 *r, const ge25519 *p);
+
+void ge25519_scalarmult(ge25519 *r, const ge25519 *p, const sc25519 *s);
+
+void ge25519_scalarmult_base(ge25519 *r, const sc25519 *s);
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c
new file mode 100644
index 00000000..253b68f4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c
@@ -0,0 +1,230 @@
+#include "fe25519.h"
+#include "sc25519.h"
+#include "ge25519.h"
+
+/*
+ * Arithmetic on the twisted Edwards curve -x^2 + y^2 = 1 + dx^2y^2
+ * with d = -(121665/121666) = 37095705934669439343138083508754565189542113879843219016388785533085940283555
+ * Base point: (15112221349535400772501151409588531511454012693041857206046113283949847762202,46316835694926478169428394003475163141307993866256225615783033603165251855960);
+ */
+
+typedef struct
+{
+ fe25519 x;
+ fe25519 z;
+ fe25519 y;
+ fe25519 t;
+} ge25519_p1p1;
+
+typedef struct
+{
+ fe25519 x;
+ fe25519 y;
+ fe25519 z;
+} ge25519_p2;
+
+#define ge25519_p3 ge25519
+
+/* Windowsize for fixed-window scalar multiplication */
+#define WINDOWSIZE 2 /* Should be 1,2, or 4 */
+#define WINDOWMASK ((1<<WINDOWSIZE)-1)
+
+/* packed parameter d in the Edwards curve equation */
+static const unsigned char ecd[32] = {0xA3, 0x78, 0x59, 0x13, 0xCA, 0x4D, 0xEB, 0x75, 0xAB, 0xD8, 0x41, 0x41, 0x4D, 0x0A, 0x70, 0x00,
+ 0x98, 0xE8, 0x79, 0x77, 0x79, 0x40, 0xC7, 0x8C, 0x73, 0xFE, 0x6F, 0x2B, 0xEE, 0x6C, 0x03, 0x52};
+
+/* Packed coordinates of the base point */
+static const unsigned char ge25519_base_x[32] = {0x1A, 0xD5, 0x25, 0x8F, 0x60, 0x2D, 0x56, 0xC9, 0xB2, 0xA7, 0x25, 0x95, 0x60, 0xC7, 0x2C, 0x69,
+ 0x5C, 0xDC, 0xD6, 0xFD, 0x31, 0xE2, 0xA4, 0xC0, 0xFE, 0x53, 0x6E, 0xCD, 0xD3, 0x36, 0x69, 0x21};
+static const unsigned char ge25519_base_y[32] = {0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66};
+static const unsigned char ge25519_base_z[32] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static const unsigned char ge25519_base_t[32] = {0xA3, 0xDD, 0xB7, 0xA5, 0xB3, 0x8A, 0xDE, 0x6D, 0xF5, 0x52, 0x51, 0x77, 0x80, 0x9F, 0xF0, 0x20,
+ 0x7D, 0xE3, 0xAB, 0x64, 0x8E, 0x4E, 0xEA, 0x66, 0x65, 0x76, 0x8B, 0xD7, 0x0F, 0x5F, 0x87, 0x67};
+
+/* Packed coordinates of the neutral element */
+static const unsigned char ge25519_neutral_x[32] = {0};
+static const unsigned char ge25519_neutral_y[32] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static const unsigned char ge25519_neutral_z[32] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static const unsigned char ge25519_neutral_t[32] = {0};
+
+static void p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p)
+{
+ fe25519_mul(&r->x, &p->x, &p->t);
+ fe25519_mul(&r->y, &p->y, &p->z);
+ fe25519_mul(&r->z, &p->z, &p->t);
+}
+
+static void p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p)
+{
+ p1p1_to_p2((ge25519_p2 *)r, p);
+ fe25519_mul(&r->t, &p->x, &p->y);
+}
+
+/* Constant-time version of: if(b) r = p */
+static void cmov_p3(ge25519_p3 *r, const ge25519_p3 *p, unsigned char b)
+{
+ fe25519_cmov(&r->x, &p->x, b);
+ fe25519_cmov(&r->y, &p->y, b);
+ fe25519_cmov(&r->z, &p->z, b);
+ fe25519_cmov(&r->t, &p->t, b);
+}
+
+/* See http://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd */
+static void dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p)
+{
+ fe25519 a,b,c,d;
+ fe25519_square(&a, &p->x);
+ fe25519_square(&b, &p->y);
+ fe25519_square(&c, &p->z);
+ fe25519_add(&c, &c, &c);
+ fe25519_neg(&d, &a);
+
+ fe25519_add(&r->x, &p->x, &p->y);
+ fe25519_square(&r->x, &r->x);
+ fe25519_sub(&r->x, &r->x, &a);
+ fe25519_sub(&r->x, &r->x, &b);
+ fe25519_add(&r->z, &d, &b);
+ fe25519_sub(&r->t, &r->z, &c);
+ fe25519_sub(&r->y, &d, &b);
+}
+
+static void add_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_p3 *q)
+{
+ fe25519 a, b, c, d, t, fd;
+ fe25519_unpack(&fd, ecd);
+
+ fe25519_sub(&a, &p->y, &p->x); // A = (Y1-X1)*(Y2-X2)
+ fe25519_sub(&t, &q->y, &q->x);
+ fe25519_mul(&a, &a, &t);
+ fe25519_add(&b, &p->x, &p->y); // B = (Y1+X1)*(Y2+X2)
+ fe25519_add(&t, &q->x, &q->y);
+ fe25519_mul(&b, &b, &t);
+ fe25519_mul(&c, &p->t, &q->t); //C = T1*k*T2
+ fe25519_mul(&c, &c, &fd);
+ fe25519_add(&c, &c, &c); //XXX: Can save this addition by precomputing 2*ecd
+ fe25519_mul(&d, &p->z, &q->z); //D = Z1*2*Z2
+ fe25519_add(&d, &d, &d);
+ fe25519_sub(&r->x, &b, &a); // E = B-A
+ fe25519_sub(&r->t, &d, &c); // F = D-C
+ fe25519_add(&r->z, &d, &c); // G = D+C
+ fe25519_add(&r->y, &b, &a); // H = B+A
+}
+
+/* ********************************************************************
+ * EXPORTED FUNCTIONS
+ ******************************************************************** */
+
+/* return 0 on success, -1 otherwise */
+int ge25519_unpack_vartime(ge25519_p3 *r, const unsigned char p[32])
+{
+ int ret;
+ fe25519 t, fd;
+ unsigned char par;
+
+ fe25519_setone(&r->z);
+ fe25519_unpack(&fd, ecd);
+ par = p[31] >> 7;
+ fe25519_unpack(&r->y, p);
+ fe25519_square(&r->x, &r->y);
+ fe25519_mul(&t, &r->x, &fd);
+ fe25519_sub(&r->x, &r->x, &r->z);
+ fe25519_add(&t, &r->z, &t);
+ fe25519_invert(&t, &t);
+ fe25519_mul(&r->x, &r->x, &t);
+ ret = fe25519_sqrt_vartime(&r->x, &r->x, par);
+ fe25519_mul(&r->t, &r->x, &r->y);
+ return ret;
+}
+
+void ge25519_pack(unsigned char r[32], const ge25519_p3 *p)
+{
+ fe25519 tx, ty, zi;
+ fe25519_invert(&zi, &p->z);
+ fe25519_mul(&tx, &p->x, &zi);
+ fe25519_mul(&ty, &p->y, &zi);
+ fe25519_pack(r, &ty);
+ r[31] ^= fe25519_getparity(&tx) << 7;
+}
+
+void ge25519_add(ge25519_p3 *r, const ge25519_p3 *p, const ge25519_p3 *q)
+{
+ ge25519_p1p1 grp1p1;
+ add_p1p1(&grp1p1, p, q);
+ p1p1_to_p3(r, &grp1p1);
+}
+
+void ge25519_double(ge25519_p3 *r, const ge25519_p3 *p)
+{
+ ge25519_p1p1 grp1p1;
+ dbl_p1p1(&grp1p1, (const ge25519_p2 *)p);
+ p1p1_to_p3(r, &grp1p1);
+}
+
+void ge25519_scalarmult(ge25519_p3 *r, const ge25519_p3 *p, const sc25519 *s)
+{
+ int i,j,k;
+ ge25519_p3 g;
+ ge25519_p3 pre[(1 << WINDOWSIZE)];
+ ge25519_p3 t;
+ ge25519_p1p1 tp1p1;
+ unsigned char w;
+ unsigned char sb[32];
+
+ fe25519_unpack(&g.x, ge25519_neutral_x);
+ fe25519_unpack(&g.y, ge25519_neutral_y);
+ fe25519_unpack(&g.z, ge25519_neutral_z);
+ fe25519_unpack(&g.t, ge25519_neutral_t);
+
+ sc25519_to32bytes(sb, s);
+
+ // Precomputation
+ pre[0] = g;
+ pre[1] = *p;
+ for(i=2;i<(1<<WINDOWSIZE);i+=2)
+ {
+ dbl_p1p1(&tp1p1, (ge25519_p2 *)(pre+i/2));
+ p1p1_to_p3(pre+i, &tp1p1);
+ add_p1p1(&tp1p1, pre+i, pre+1);
+ p1p1_to_p3(pre+i+1, &tp1p1);
+ }
+
+ // Fixed-window scalar multiplication
+ for(i=32;i>0;i--)
+ {
+ for(j=8-WINDOWSIZE;j>=0;j-=WINDOWSIZE)
+ {
+ for(k=0;k<WINDOWSIZE-1;k++)
+ {
+ dbl_p1p1(&tp1p1, (ge25519_p2 *)&g);
+ p1p1_to_p2((ge25519_p2 *)&g, &tp1p1);
+ }
+ dbl_p1p1(&tp1p1, (ge25519_p2 *)&g);
+ p1p1_to_p3(&g, &tp1p1);
+ // Cache-timing resistant loading of precomputed value:
+ w = (sb[i-1]>>j) & WINDOWMASK;
+ t = pre[0];
+ for(k=1;k<(1<<WINDOWSIZE);k++)
+ cmov_p3(&t, &pre[k], k==w);
+
+ add_p1p1(&tp1p1, &g, &t);
+ if(j != 0) p1p1_to_p2((ge25519_p2 *)&g, &tp1p1);
+ else p1p1_to_p3(&g, &tp1p1); /* convert to p3 representation at the end */
+ }
+ }
+ r->x = g.x;
+ r->y = g.y;
+ r->z = g.z;
+ r->t = g.t;
+}
+
+void ge25519_scalarmult_base(ge25519_p3 *r, const sc25519 *s)
+{
+ /* XXX: Better algorithm for known-base-point scalar multiplication */
+ ge25519_p3 t;
+ fe25519_unpack(&t.x, ge25519_base_x);
+ fe25519_unpack(&t.y, ge25519_base_y);
+ fe25519_unpack(&t.z, ge25519_base_z);
+ fe25519_unpack(&t.t, ge25519_base_t);
+ ge25519_scalarmult(r, &t, s);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519.h
new file mode 100644
index 00000000..f791dea4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519.h
@@ -0,0 +1,51 @@
+#ifndef SC25519_H
+#define SC25519_H
+
+#define sc25519 crypto_sign_edwards25519sha512batch_sc25519
+#define sc25519_from32bytes crypto_sign_edwards25519sha512batch_sc25519_from32bytes
+#define sc25519_from64bytes crypto_sign_edwards25519sha512batch_sc25519_from64bytes
+#define sc25519_to32bytes crypto_sign_edwards25519sha512batch_sc25519_to32bytes
+#define sc25519_pack crypto_sign_edwards25519sha512batch_sc25519_pack
+#define sc25519_getparity crypto_sign_edwards25519sha512batch_sc25519_getparity
+#define sc25519_setone crypto_sign_edwards25519sha512batch_sc25519_setone
+#define sc25519_setzero crypto_sign_edwards25519sha512batch_sc25519_setzero
+#define sc25519_neg crypto_sign_edwards25519sha512batch_sc25519_neg
+#define sc25519_add crypto_sign_edwards25519sha512batch_sc25519_add
+#define sc25519_sub crypto_sign_edwards25519sha512batch_sc25519_sub
+#define sc25519_mul crypto_sign_edwards25519sha512batch_sc25519_mul
+#define sc25519_square crypto_sign_edwards25519sha512batch_sc25519_square
+#define sc25519_invert crypto_sign_edwards25519sha512batch_sc25519_invert
+
+#include "crypto_uint32.h"
+
+typedef struct {
+ crypto_uint32 v[32];
+} sc25519;
+
+void sc25519_from32bytes(sc25519 *r, const unsigned char x[32]);
+
+void sc25519_from64bytes(sc25519 *r, const unsigned char x[64]);
+
+void sc25519_to32bytes(unsigned char r[32], const sc25519 *x);
+
+void sc25519_pack(unsigned char r[32], const sc25519 *x);
+
+unsigned char sc25519_getparity(const sc25519 *x);
+
+void sc25519_setone(sc25519 *r);
+
+void sc25519_setzero(sc25519 *r);
+
+void sc25519_neg(sc25519 *r, const sc25519 *x);
+
+void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y);
+
+void sc25519_sub(sc25519 *r, const sc25519 *x, const sc25519 *y);
+
+void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y);
+
+void sc25519_square(sc25519 *r, const sc25519 *x);
+
+void sc25519_invert(sc25519 *r, const sc25519 *x);
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c
new file mode 100644
index 00000000..085e3f92
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c
@@ -0,0 +1,150 @@
+#include "sc25519.h"
+
+/*Arithmetic modulo the group order n = 2^252 + 27742317777372353535851937790883648493 = 7237005577332262213973186563042994240857116359379907606001950938285454250989 */
+
+static const crypto_uint32 m[32] = {0xED, 0xD3, 0xF5, 0x5C, 0x1A, 0x63, 0x12, 0x58, 0xD6, 0x9C, 0xF7, 0xA2, 0xDE, 0xF9, 0xDE, 0x14,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10};
+
+static const crypto_uint32 mu[33] = {0x1B, 0x13, 0x2C, 0x0A, 0xA3, 0xE5, 0x9C, 0xED, 0xA7, 0x29, 0x63, 0x08, 0x5D, 0x21, 0x06, 0x21,
+ 0xEB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F};
+
+/* Reduce coefficients of r before calling reduce_add_sub */
+static void reduce_add_sub(sc25519 *r)
+{
+ int i, b, pb=0, nb;
+ unsigned char t[32];
+
+ for(i=0;i<32;i++)
+ {
+ b = (r->v[i]<pb+m[i]);
+ t[i] = r->v[i]-pb-m[i]+b*256;
+ pb = b;
+ }
+ nb = 1-b;
+ for(i=0;i<32;i++)
+ r->v[i] = r->v[i]*b + t[i]*nb;
+}
+
+/* Reduce coefficients of x before calling barrett_reduce */
+static void barrett_reduce(sc25519 *r, const crypto_uint32 x[64])
+{
+ /* See HAC, Alg. 14.42 */
+ int i,j;
+ crypto_uint32 q2[66] = {0};
+ crypto_uint32 *q3 = q2 + 33;
+ crypto_uint32 r1[33];
+ crypto_uint32 r2[33] = {0};
+ crypto_uint32 carry;
+ int b, pb=0;
+
+ for(i=0;i<33;i++)
+ for(j=0;j<33;j++)
+ if(i+j >= 31) q2[i+j] += mu[i]*x[j+31];
+ carry = q2[31] >> 8;
+ q2[32] += carry;
+ carry = q2[32] >> 8;
+ q2[33] += carry;
+
+ for(i=0;i<33;i++)r1[i] = x[i];
+ for(i=0;i<32;i++) {
+ for(j=0;j<33;j++) {
+ if(i+j < 33) {
+ /* coverity[overrun-local] */
+ r2[i+j] += m[i]*q3[j];
+ }
+ }
+ }
+ for(i=0;i<32;i++)
+ {
+ carry = r2[i] >> 8;
+ r2[i+1] += carry;
+ r2[i] &= 0xff;
+ }
+
+ for(i=0;i<32;i++)
+ {
+ b = (r1[i]<pb+r2[i]);
+ r->v[i] = r1[i]-pb-r2[i]+b*256;
+ pb = b;
+ }
+
+ /* XXX: Can it really happen that r<0?, See HAC, Alg 14.42, Step 3
+ * If so: Handle it here!
+ */
+
+ reduce_add_sub(r);
+ reduce_add_sub(r);
+}
+
+/*
+static int iszero(const sc25519 *x)
+{
+ // Implement
+ return 0;
+}
+*/
+
+void sc25519_from32bytes(sc25519 *r, const unsigned char x[32])
+{
+ int i;
+ crypto_uint32 t[64] = {0};
+ for(i=0;i<32;i++) t[i] = x[i];
+ barrett_reduce(r, t);
+}
+
+void sc25519_from64bytes(sc25519 *r, const unsigned char x[64])
+{
+ int i;
+ crypto_uint32 t[64] = {0};
+ for(i=0;i<64;i++) t[i] = x[i];
+ barrett_reduce(r, t);
+}
+
+/* XXX: What we actually want for crypto_group is probably just something like
+ * void sc25519_frombytes(sc25519 *r, const unsigned char *x, size_t xlen)
+ */
+
+void sc25519_to32bytes(unsigned char r[32], const sc25519 *x)
+{
+ int i;
+ for(i=0;i<32;i++) r[i] = x->v[i];
+}
+
+void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y)
+{
+ int i, carry;
+ for(i=0;i<32;i++) r->v[i] = x->v[i] + y->v[i];
+ for(i=0;i<31;i++)
+ {
+ carry = r->v[i] >> 8;
+ r->v[i+1] += carry;
+ r->v[i] &= 0xff;
+ }
+ reduce_add_sub(r);
+}
+
+void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y)
+{
+ int i,j,carry;
+ crypto_uint32 t[64];
+ for(i=0;i<64;i++)t[i] = 0;
+
+ for(i=0;i<32;i++)
+ for(j=0;j<32;j++)
+ t[i+j] += x->v[i] * y->v[j];
+
+ /* Reduce coefficients */
+ for(i=0;i<63;i++)
+ {
+ carry = t[i] >> 8;
+ t[i+1] += carry;
+ t[i] &= 0xff;
+ }
+
+ barrett_reduce(r, t);
+}
+
+void sc25519_square(sc25519 *r, const sc25519 *x)
+{
+ sc25519_mul(r, x, x);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c
new file mode 100644
index 00000000..b3c0c0d5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c
@@ -0,0 +1,106 @@
+#include "api.h"
+#include "crypto_hash_sha512.h"
+#include "randombytes.h"
+#include "crypto_verify_32.h"
+
+#include "ge25519.h"
+
+int crypto_sign_keypair(
+ unsigned char *pk,
+ unsigned char *sk
+ )
+{
+ sc25519 scsk;
+ ge25519 gepk;
+
+ randombytes_buf(sk, 32);
+ crypto_hash_sha512(sk, sk, 32);
+ sk[0] &= 248;
+ sk[31] &= 127;
+ sk[31] |= 64;
+
+ sc25519_from32bytes(&scsk,sk);
+
+ ge25519_scalarmult_base(&gepk, &scsk);
+ ge25519_pack(pk, &gepk);
+ return 0;
+}
+
+int crypto_sign(
+ unsigned char *sm,unsigned long long *smlen_p,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *sk
+ )
+{
+ sc25519 sck, scs, scsk;
+ ge25519 ger;
+ unsigned char r[32];
+ unsigned char s[32];
+ unsigned long long i;
+ unsigned char hmg[crypto_hash_sha512_BYTES];
+ unsigned char hmr[crypto_hash_sha512_BYTES];
+
+ if (smlen_p != NULL) {
+ *smlen_p = mlen+64;
+ }
+ for(i=0;i<mlen;i++)
+ sm[32 + i] = m[i];
+ for(i=0;i<32;i++)
+ sm[i] = sk[32+i];
+ crypto_hash_sha512(hmg, sm, mlen+32); /* Generate k as h(m,sk[32],...,sk[63]) */
+
+ sc25519_from64bytes(&sck, hmg);
+ ge25519_scalarmult_base(&ger, &sck);
+ ge25519_pack(r, &ger);
+
+ for(i=0;i<32;i++)
+ sm[i] = r[i];
+
+ crypto_hash_sha512(hmr, sm, mlen+32); /* Compute h(m,r) */
+ sc25519_from64bytes(&scs, hmr);
+ sc25519_mul(&scs, &scs, &sck);
+
+ sc25519_from32bytes(&scsk, sk);
+ sc25519_add(&scs, &scs, &scsk);
+
+ sc25519_to32bytes(s,&scs); /* cat s */
+ for(i=0;i<32;i++)
+ sm[mlen+32+i] = s[i];
+
+ return 0;
+}
+
+int crypto_sign_open(
+ unsigned char *m,unsigned long long *mlen_p,
+ const unsigned char *sm,unsigned long long smlen,
+ const unsigned char *pk
+ )
+{
+ unsigned long long i;
+ unsigned char t1[32], t2[32];
+ ge25519 get1, get2, gepk;
+ sc25519 schmr, scs;
+ unsigned char hmr[crypto_hash_sha512_BYTES];
+
+ if (ge25519_unpack_vartime(&get1, sm)) return -1;
+ if (ge25519_unpack_vartime(&gepk, pk)) return -1;
+
+ crypto_hash_sha512(hmr,sm,smlen-32);
+
+ sc25519_from64bytes(&schmr, hmr);
+ ge25519_scalarmult(&get1, &get1, &schmr);
+ ge25519_add(&get1, &get1, &gepk);
+ ge25519_pack(t1, &get1);
+
+ sc25519_from32bytes(&scs, &sm[smlen-32]);
+ ge25519_scalarmult_base(&get2, &scs);
+ ge25519_pack(t2, &get2);
+
+ for(i=0;i<smlen-64;i++) {
+ m[i] = sm[i + 32];
+ }
+ if (mlen_p != NULL) {
+ *mlen_p = smlen-64;
+ }
+ return crypto_verify_32(t1, t2);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c
new file mode 100644
index 00000000..28a5e545
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c
@@ -0,0 +1,16 @@
+#include "crypto_sign_edwards25519sha512batch.h"
+
+size_t
+crypto_sign_edwards25519sha512batch_bytes(void) {
+ return crypto_sign_edwards25519sha512batch_BYTES;
+}
+
+size_t
+crypto_sign_edwards25519sha512batch_publickeybytes(void) {
+ return crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES;
+}
+
+size_t
+crypto_sign_edwards25519sha512batch_secretkeybytes(void) {
+ return crypto_sign_edwards25519sha512batch_SECRETKEYBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c
new file mode 100644
index 00000000..a5a9a7a9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c
@@ -0,0 +1,159 @@
+/* Author: Peter Schwabe, ported from an assembly implementation by Emilia Käsper
+ * Date: 2009-03-19
+ * Public domain */
+
+#include "api.h"
+#include "int128.h"
+#include "common.h"
+#include "consts.h"
+
+int crypto_stream_afternm(unsigned char *out, unsigned long long len, const unsigned char *nonce, const unsigned char *c)
+{
+
+ int128 xmm0;
+ int128 xmm1;
+ int128 xmm2;
+ int128 xmm3;
+ int128 xmm4;
+ int128 xmm5;
+ int128 xmm6;
+ int128 xmm7;
+
+ int128 xmm8;
+ int128 xmm9;
+ int128 xmm10;
+ int128 xmm11;
+ int128 xmm12;
+ int128 xmm13;
+ int128 xmm14;
+ int128 xmm15;
+
+ int128 nonce_stack;
+ unsigned long long lensav;
+ unsigned char bl[128];
+ unsigned char *blp;
+ unsigned char *np;
+ unsigned char b;
+
+ uint32 tmp;
+
+ /* Copy nonce on the stack */
+ copy2(&nonce_stack, (const int128 *) (nonce + 0));
+ np = (unsigned char *)&nonce_stack;
+
+ enc_block:
+
+ xmm0 = *(int128 *) (np + 0);
+ copy2(&xmm1, &xmm0);
+ shufb(&xmm1, SWAP32);
+ copy2(&xmm2, &xmm1);
+ copy2(&xmm3, &xmm1);
+ copy2(&xmm4, &xmm1);
+ copy2(&xmm5, &xmm1);
+ copy2(&xmm6, &xmm1);
+ copy2(&xmm7, &xmm1);
+
+ add_uint32_big(&xmm1, 1);
+ add_uint32_big(&xmm2, 2);
+ add_uint32_big(&xmm3, 3);
+ add_uint32_big(&xmm4, 4);
+ add_uint32_big(&xmm5, 5);
+ add_uint32_big(&xmm6, 6);
+ add_uint32_big(&xmm7, 7);
+
+ shufb(&xmm0, M0);
+ shufb(&xmm1, M0SWAP);
+ shufb(&xmm2, M0SWAP);
+ shufb(&xmm3, M0SWAP);
+ shufb(&xmm4, M0SWAP);
+ shufb(&xmm5, M0SWAP);
+ shufb(&xmm6, M0SWAP);
+ shufb(&xmm7, M0SWAP);
+
+ bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, xmm8)
+
+ aesround( 1, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ aesround( 2, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+ aesround( 3, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ aesround( 4, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+ aesround( 5, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ aesround( 6, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+ aesround( 7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ aesround( 8, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+ aesround( 9, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ lastround(xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+
+ bitslice(xmm13, xmm10, xmm15, xmm11, xmm14, xmm12, xmm9, xmm8, xmm0)
+
+ if(len < 128) goto partial;
+ if(len == 128) goto full;
+
+ tmp = load32_bigendian(np + 12);
+ tmp += 8;
+ store32_bigendian(np + 12, tmp);
+
+ *(int128 *) (out + 0) = xmm8;
+ *(int128 *) (out + 16) = xmm9;
+ *(int128 *) (out + 32) = xmm12;
+ *(int128 *) (out + 48) = xmm14;
+ *(int128 *) (out + 64) = xmm11;
+ *(int128 *) (out + 80) = xmm15;
+ *(int128 *) (out + 96) = xmm10;
+ *(int128 *) (out + 112) = xmm13;
+
+ len -= 128;
+ out += 128;
+
+ goto enc_block;
+
+ partial:
+
+ lensav = len;
+ len >>= 4;
+
+ tmp = load32_bigendian(np + 12);
+ tmp += len;
+ store32_bigendian(np + 12, tmp);
+
+ blp = bl;
+ *(int128 *)(blp + 0) = xmm8;
+ *(int128 *)(blp + 16) = xmm9;
+ *(int128 *)(blp + 32) = xmm12;
+ *(int128 *)(blp + 48) = xmm14;
+ *(int128 *)(blp + 64) = xmm11;
+ *(int128 *)(blp + 80) = xmm15;
+ *(int128 *)(blp + 96) = xmm10;
+ *(int128 *)(blp + 112) = xmm13;
+
+ bytes:
+
+ if(lensav == 0) goto end;
+
+ b = blp[0]; /* clang false positive */
+ *(unsigned char *)(out + 0) = b;
+
+ blp += 1;
+ out +=1;
+ lensav -= 1;
+
+ goto bytes;
+
+ full:
+
+ tmp = load32_bigendian(np + 12);
+ tmp += 8;
+ store32_bigendian(np + 12, tmp);
+
+ *(int128 *) (out + 0) = xmm8;
+ *(int128 *) (out + 16) = xmm9;
+ *(int128 *) (out + 32) = xmm12;
+ *(int128 *) (out + 48) = xmm14;
+ *(int128 *) (out + 64) = xmm11;
+ *(int128 *) (out + 80) = xmm15;
+ *(int128 *) (out + 96) = xmm10;
+ *(int128 *) (out + 112) = xmm13;
+
+ end:
+ return 0;
+
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h
new file mode 100644
index 00000000..3c53fb95
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h
@@ -0,0 +1,13 @@
+
+#include "crypto_stream_aes128ctr.h"
+
+#define crypto_stream crypto_stream_aes128ctr
+#define crypto_stream_xor crypto_stream_aes128ctr_xor
+#define crypto_stream_beforenm crypto_stream_aes128ctr_beforenm
+#define crypto_stream_afternm crypto_stream_aes128ctr_afternm
+#define crypto_stream_xor_afternm crypto_stream_aes128ctr_xor_afternm
+#define crypto_stream_KEYBYTES crypto_stream_aes128ctr_KEYBYTES
+#define crypto_stream_NONCEBYTES crypto_stream_aes128ctr_NONCEBYTES
+#define crypto_stream_BEFORENMBYTES crypto_stream_aes128ctr_BEFORENMBYTES
+#define crypto_stream_IMPLEMENTATION crypto_stream_aes128ctr_IMPLEMENTATION
+#define crypto_stream_VERSION crypto_stream_aes128ctr_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c
new file mode 100644
index 00000000..f8623dd2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c
@@ -0,0 +1,59 @@
+/* Author: Peter Schwabe, ported from an assembly implementation by Emilia Käsper
+ * Date: 2009-03-19
+ * Public domain */
+
+#include "api.h"
+#include "consts.h"
+#include "int128.h"
+#include "common.h"
+
+int crypto_stream_beforenm(unsigned char *c, const unsigned char *k)
+{
+
+ /*
+ int64 x0;
+ int64 x1;
+ int64 x2;
+ int64 x3;
+ int64 e;
+ int64 q0;
+ int64 q1;
+ int64 q2;
+ int64 q3;
+ */
+
+ int128 xmm0;
+ int128 xmm1;
+ int128 xmm2;
+ int128 xmm3;
+ int128 xmm4;
+ int128 xmm5;
+ int128 xmm6;
+ int128 xmm7;
+ int128 xmm8;
+ int128 xmm9;
+ int128 xmm10;
+ int128 xmm11;
+ int128 xmm12;
+ int128 xmm13;
+ int128 xmm14;
+ int128 xmm15;
+ int128 t;
+
+ bitslicekey0(k, c)
+
+ keyexpbs1(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ keyexpbs(xmm0, xmm1, xmm4, xmm6, xmm3, xmm7, xmm2, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm1);, 2,c)
+ keyexpbs(xmm0, xmm1, xmm3, xmm2, xmm6, xmm5, xmm4, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm6);, 3,c)
+ keyexpbs(xmm0, xmm1, xmm6, xmm4, xmm2, xmm7, xmm3, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm3);, 4,c)
+
+ keyexpbs(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm3);, 5,c)
+ keyexpbs(xmm0, xmm1, xmm4, xmm6, xmm3, xmm7, xmm2, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm5);, 6,c)
+ keyexpbs(xmm0, xmm1, xmm3, xmm2, xmm6, xmm5, xmm4, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm3);, 7,c)
+ keyexpbs(xmm0, xmm1, xmm6, xmm4, xmm2, xmm7, xmm3, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm7);, 8,c)
+
+ keyexpbs(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xor_rcon(&xmm0); xor_rcon(&xmm1); xor_rcon(&xmm6); xor_rcon(&xmm3);, 9,c)
+ keyexpbs10(xmm0, xmm1, xmm4, xmm6, xmm3, xmm7, xmm2, xmm5, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h
new file mode 100644
index 00000000..3923c02d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h
@@ -0,0 +1,788 @@
+/* Author: Peter Schwabe, ported from an assembly implementation by Emilia Käsper
+ Date: 2009-03-19
+ Public domain */
+#ifndef COMMON_H
+#define COMMON_H
+
+#include "types.h"
+
+#define load32_bigendian crypto_stream_aes128ctr_portable_load32_bigendian
+uint32 load32_bigendian(const unsigned char *x);
+
+#define store32_bigendian crypto_stream_aes128ctr_portable_store32_bigendian
+void store32_bigendian(unsigned char *x,uint32 u);
+
+#define load32_littleendian crypto_stream_aes128ctr_portable_load32_littleendian
+uint32 load32_littleendian(const unsigned char *x);
+
+#define store32_littleendian crypto_stream_aes128ctr_portable_store32_littleendian
+void store32_littleendian(unsigned char *x,uint32 u);
+
+#define load64_littleendian crypto_stream_aes128ctr_portable_load64_littleendian
+uint64 load64_littleendian(const unsigned char *x);
+
+#define store64_littleendian crypto_stream_aes128ctr_portable_store64_littleendian
+void store64_littleendian(unsigned char *x,uint64 u);
+
+/* Macros required only for key expansion */
+
+#define keyexpbs1(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, bskey) \
+ rotbyte(&b0);\
+ rotbyte(&b1);\
+ rotbyte(&b2);\
+ rotbyte(&b3);\
+ rotbyte(&b4);\
+ rotbyte(&b5);\
+ rotbyte(&b6);\
+ rotbyte(&b7);\
+ ;\
+ sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
+ ;\
+ xor_rcon(&b0);\
+ shufb(&b0, EXPB0);\
+ shufb(&b1, EXPB0);\
+ shufb(&b4, EXPB0);\
+ shufb(&b6, EXPB0);\
+ shufb(&b3, EXPB0);\
+ shufb(&b7, EXPB0);\
+ shufb(&b2, EXPB0);\
+ shufb(&b5, EXPB0);\
+ shufb(&b0, EXPB0);\
+ ;\
+ t0 = *(int128 *)(bskey + 0);\
+ t1 = *(int128 *)(bskey + 16);\
+ t2 = *(int128 *)(bskey + 32);\
+ t3 = *(int128 *)(bskey + 48);\
+ t4 = *(int128 *)(bskey + 64);\
+ t5 = *(int128 *)(bskey + 80);\
+ t6 = *(int128 *)(bskey + 96);\
+ t7 = *(int128 *)(bskey + 112);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ *(int128 *)(bskey + 128) = b0;\
+ *(int128 *)(bskey + 144) = b1;\
+ *(int128 *)(bskey + 160) = b4;\
+ *(int128 *)(bskey + 176) = b6;\
+ *(int128 *)(bskey + 192) = b3;\
+ *(int128 *)(bskey + 208) = b7;\
+ *(int128 *)(bskey + 224) = b2;\
+ *(int128 *)(bskey + 240) = b5;\
+
+#define keyexpbs10(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, bskey) ;\
+ toggle(&b0);\
+ toggle(&b1);\
+ toggle(&b5);\
+ toggle(&b6);\
+ rotbyte(&b0);\
+ rotbyte(&b1);\
+ rotbyte(&b2);\
+ rotbyte(&b3);\
+ rotbyte(&b4);\
+ rotbyte(&b5);\
+ rotbyte(&b6);\
+ rotbyte(&b7);\
+ ;\
+ sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
+ ;\
+ xor_rcon(&b1);\
+ xor_rcon(&b4);\
+ xor_rcon(&b3);\
+ xor_rcon(&b7);\
+ shufb(&b0, EXPB0);\
+ shufb(&b1, EXPB0);\
+ shufb(&b4, EXPB0);\
+ shufb(&b6, EXPB0);\
+ shufb(&b3, EXPB0);\
+ shufb(&b7, EXPB0);\
+ shufb(&b2, EXPB0);\
+ shufb(&b5, EXPB0);\
+ ;\
+ t0 = *(int128 *)(bskey + 9 * 128 + 0);\
+ t1 = *(int128 *)(bskey + 9 * 128 + 16);\
+ t2 = *(int128 *)(bskey + 9 * 128 + 32);\
+ t3 = *(int128 *)(bskey + 9 * 128 + 48);\
+ t4 = *(int128 *)(bskey + 9 * 128 + 64);\
+ t5 = *(int128 *)(bskey + 9 * 128 + 80);\
+ t6 = *(int128 *)(bskey + 9 * 128 + 96);\
+ t7 = *(int128 *)(bskey + 9 * 128 + 112);\
+ ;\
+ toggle(&t0);\
+ toggle(&t1);\
+ toggle(&t5);\
+ toggle(&t6);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ shufb(&b0, M0);\
+ shufb(&b1, M0);\
+ shufb(&b2, M0);\
+ shufb(&b3, M0);\
+ shufb(&b4, M0);\
+ shufb(&b5, M0);\
+ shufb(&b6, M0);\
+ shufb(&b7, M0);\
+ ;\
+ *(int128 *)(bskey + 1280) = b0;\
+ *(int128 *)(bskey + 1296) = b1;\
+ *(int128 *)(bskey + 1312) = b4;\
+ *(int128 *)(bskey + 1328) = b6;\
+ *(int128 *)(bskey + 1344) = b3;\
+ *(int128 *)(bskey + 1360) = b7;\
+ *(int128 *)(bskey + 1376) = b2;\
+ *(int128 *)(bskey + 1392) = b5;\
+
+
+#define keyexpbs(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, rcon, i, bskey) \
+ toggle(&b0);\
+ toggle(&b1);\
+ toggle(&b5);\
+ toggle(&b6);\
+ rotbyte(&b0);\
+ rotbyte(&b1);\
+ rotbyte(&b2);\
+ rotbyte(&b3);\
+ rotbyte(&b4);\
+ rotbyte(&b5);\
+ rotbyte(&b6);\
+ rotbyte(&b7);\
+ ;\
+ sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
+ ;\
+ rcon;\
+ shufb(&b0, EXPB0);\
+ shufb(&b1, EXPB0);\
+ shufb(&b4, EXPB0);\
+ shufb(&b6, EXPB0);\
+ shufb(&b3, EXPB0);\
+ shufb(&b7, EXPB0);\
+ shufb(&b2, EXPB0);\
+ shufb(&b5, EXPB0);\
+ ;\
+ t0 = *(int128 *)(bskey + (i-1) * 128 + 0);\
+ t1 = *(int128 *)(bskey + (i-1) * 128 + 16);\
+ t2 = *(int128 *)(bskey + (i-1) * 128 + 32);\
+ t3 = *(int128 *)(bskey + (i-1) * 128 + 48);\
+ t4 = *(int128 *)(bskey + (i-1) * 128 + 64);\
+ t5 = *(int128 *)(bskey + (i-1) * 128 + 80);\
+ t6 = *(int128 *)(bskey + (i-1) * 128 + 96);\
+ t7 = *(int128 *)(bskey + (i-1) * 128 + 112);\
+ ;\
+ toggle(&t0);\
+ toggle(&t1);\
+ toggle(&t5);\
+ toggle(&t6);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ rshift32_littleendian(&t0, 8);\
+ rshift32_littleendian(&t1, 8);\
+ rshift32_littleendian(&t2, 8);\
+ rshift32_littleendian(&t3, 8);\
+ rshift32_littleendian(&t4, 8);\
+ rshift32_littleendian(&t5, 8);\
+ rshift32_littleendian(&t6, 8);\
+ rshift32_littleendian(&t7, 8);\
+ ;\
+ xor2(&b0, &t0);\
+ xor2(&b1, &t1);\
+ xor2(&b4, &t2);\
+ xor2(&b6, &t3);\
+ xor2(&b3, &t4);\
+ xor2(&b7, &t5);\
+ xor2(&b2, &t6);\
+ xor2(&b5, &t7);\
+ ;\
+ *(int128 *)(bskey + i*128 + 0) = b0;\
+ *(int128 *)(bskey + i*128 + 16) = b1;\
+ *(int128 *)(bskey + i*128 + 32) = b4;\
+ *(int128 *)(bskey + i*128 + 48) = b6;\
+ *(int128 *)(bskey + i*128 + 64) = b3;\
+ *(int128 *)(bskey + i*128 + 80) = b7;\
+ *(int128 *)(bskey + i*128 + 96) = b2;\
+ *(int128 *)(bskey + i*128 + 112) = b5;\
+
+/* Macros used in multiple contexts */
+
+#define bitslicekey0(key, bskey) \
+ xmm0 = *(const int128 *) (key + 0);\
+ shufb(&xmm0, M0);\
+ copy2(&xmm1, &xmm0);\
+ copy2(&xmm2, &xmm0);\
+ copy2(&xmm3, &xmm0);\
+ copy2(&xmm4, &xmm0);\
+ copy2(&xmm5, &xmm0);\
+ copy2(&xmm6, &xmm0);\
+ copy2(&xmm7, &xmm0);\
+ ;\
+ bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, t);\
+ ;\
+ *(int128 *) (bskey + 0) = xmm0;\
+ *(int128 *) (bskey + 16) = xmm1;\
+ *(int128 *) (bskey + 32) = xmm2;\
+ *(int128 *) (bskey + 48) = xmm3;\
+ *(int128 *) (bskey + 64) = xmm4;\
+ *(int128 *) (bskey + 80) = xmm5;\
+ *(int128 *) (bskey + 96) = xmm6;\
+ *(int128 *) (bskey + 112) = xmm7;\
+
+
+#define bitslicekey10(key, bskey) \
+ xmm0 = *(int128 *) (key + 0);\
+ copy2(xmm1, xmm0);\
+ copy2(xmm2, xmm0);\
+ copy2(xmm3, xmm0);\
+ copy2(xmm4, xmm0);\
+ copy2(xmm5, xmm0);\
+ copy2(xmm6, xmm0);\
+ copy2(xmm7, xmm0);\
+ ;\
+ bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, t);\
+ ;\
+ toggle(&xmm6);\
+ toggle(&xmm5);\
+ toggle(&xmm1);\
+ toggle(&xmm0);\
+ ;\
+ *(int128 *) (bskey + 0 + 1280) = xmm0;\
+ *(int128 *) (bskey + 16 + 1280) = xmm1;\
+ *(int128 *) (bskey + 32 + 1280) = xmm2;\
+ *(int128 *) (bskey + 48 + 1280) = xmm3;\
+ *(int128 *) (bskey + 64 + 1280) = xmm4;\
+ *(int128 *) (bskey + 80 + 1280) = xmm5;\
+ *(int128 *) (bskey + 96 + 1280) = xmm6;\
+ *(int128 *) (bskey + 112 + 1280) = xmm7;\
+
+
+#define bitslicekey(i,key,bskey) \
+ xmm0 = *(int128 *) (key + 0);\
+ shufb(&xmm0, M0);\
+ copy2(&xmm1, &xmm0);\
+ copy2(&xmm2, &xmm0);\
+ copy2(&xmm3, &xmm0);\
+ copy2(&xmm4, &xmm0);\
+ copy2(&xmm5, &xmm0);\
+ copy2(&xmm6, &xmm0);\
+ copy2(&xmm7, &xmm0);\
+ ;\
+ bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, t);\
+ ;\
+ toggle(&xmm6);\
+ toggle(&xmm5);\
+ toggle(&xmm1);\
+ toggle(&xmm0);\
+ ;\
+ *(int128 *) (bskey + 0 + 128*i) = xmm0;\
+ *(int128 *) (bskey + 16 + 128*i) = xmm1;\
+ *(int128 *) (bskey + 32 + 128*i) = xmm2;\
+ *(int128 *) (bskey + 48 + 128*i) = xmm3;\
+ *(int128 *) (bskey + 64 + 128*i) = xmm4;\
+ *(int128 *) (bskey + 80 + 128*i) = xmm5;\
+ *(int128 *) (bskey + 96 + 128*i) = xmm6;\
+ *(int128 *) (bskey + 112 + 128*i) = xmm7;\
+
+
+#define bitslice(x0, x1, x2, x3, x4, x5, x6, x7, t) \
+ swapmove(x0, x1, 1, BS0, t);\
+ swapmove(x2, x3, 1, BS0, t);\
+ swapmove(x4, x5, 1, BS0, t);\
+ swapmove(x6, x7, 1, BS0, t);\
+ ;\
+ swapmove(x0, x2, 2, BS1, t);\
+ swapmove(x1, x3, 2, BS1, t);\
+ swapmove(x4, x6, 2, BS1, t);\
+ swapmove(x5, x7, 2, BS1, t);\
+ ;\
+ swapmove(x0, x4, 4, BS2, t);\
+ swapmove(x1, x5, 4, BS2, t);\
+ swapmove(x2, x6, 4, BS2, t);\
+ swapmove(x3, x7, 4, BS2, t);\
+
+
+#define swapmove(a, b, n, m, t) \
+ copy2(&t, &b);\
+ rshift64_littleendian(&t, n);\
+ xor2(&t, &a);\
+ and2(&t, &m);\
+ xor2(&a, &t);\
+ lshift64_littleendian(&t, n);\
+ xor2(&b, &t);
+
+#define rotbyte(x) \
+ shufb(x, ROTB) /* TODO: Make faster */
+
+
+/* Macros used for encryption (and decryption) */
+
+#define shiftrows(x0, x1, x2, x3, x4, x5, x6, x7, i, M, bskey) \
+ xor2(&x0, (const int128 *)(bskey + 128*(i-1) + 0));\
+ shufb(&x0, M);\
+ xor2(&x1, (const int128 *)(bskey + 128*(i-1) + 16));\
+ shufb(&x1, M);\
+ xor2(&x2, (const int128 *)(bskey + 128*(i-1) + 32));\
+ shufb(&x2, M);\
+ xor2(&x3, (const int128 *)(bskey + 128*(i-1) + 48));\
+ shufb(&x3, M);\
+ xor2(&x4, (const int128 *)(bskey + 128*(i-1) + 64));\
+ shufb(&x4, M);\
+ xor2(&x5, (const int128 *)(bskey + 128*(i-1) + 80));\
+ shufb(&x5, M);\
+ xor2(&x6, (const int128 *)(bskey + 128*(i-1) + 96));\
+ shufb(&x6, M);\
+ xor2(&x7, (const int128 *)(bskey + 128*(i-1) + 112));\
+ shufb(&x7, M);\
+
+
+#define mixcolumns(x0, x1, x2, x3, x4, x5, x6, x7, t0, t1, t2, t3, t4, t5, t6, t7) \
+ shufd(&t0, &x0, 0x93);\
+ shufd(&t1, &x1, 0x93);\
+ shufd(&t2, &x2, 0x93);\
+ shufd(&t3, &x3, 0x93);\
+ shufd(&t4, &x4, 0x93);\
+ shufd(&t5, &x5, 0x93);\
+ shufd(&t6, &x6, 0x93);\
+ shufd(&t7, &x7, 0x93);\
+ ;\
+ xor2(&x0, &t0);\
+ xor2(&x1, &t1);\
+ xor2(&x2, &t2);\
+ xor2(&x3, &t3);\
+ xor2(&x4, &t4);\
+ xor2(&x5, &t5);\
+ xor2(&x6, &t6);\
+ xor2(&x7, &t7);\
+ ;\
+ xor2(&t0, &x7);\
+ xor2(&t1, &x0);\
+ xor2(&t2, &x1);\
+ xor2(&t1, &x7);\
+ xor2(&t3, &x2);\
+ xor2(&t4, &x3);\
+ xor2(&t5, &x4);\
+ xor2(&t3, &x7);\
+ xor2(&t6, &x5);\
+ xor2(&t7, &x6);\
+ xor2(&t4, &x7);\
+ ;\
+ shufd(&x0, &x0, 0x4e);\
+ shufd(&x1, &x1, 0x4e);\
+ shufd(&x2, &x2, 0x4e);\
+ shufd(&x3, &x3, 0x4e);\
+ shufd(&x4, &x4, 0x4e);\
+ shufd(&x5, &x5, 0x4e);\
+ shufd(&x6, &x6, 0x4e);\
+ shufd(&x7, &x7, 0x4e);\
+ ;\
+ xor2(&t0, &x0);\
+ xor2(&t1, &x1);\
+ xor2(&t2, &x2);\
+ xor2(&t3, &x3);\
+ xor2(&t4, &x4);\
+ xor2(&t5, &x5);\
+ xor2(&t6, &x6);\
+ xor2(&t7, &x7);\
+
+
+#define aesround(i, b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, bskey) \
+ shiftrows(b0, b1, b2, b3, b4, b5, b6, b7, i, SR, bskey);\
+ sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
+ mixcolumns(b0, b1, b4, b6, b3, b7, b2, b5, t0, t1, t2, t3, t4, t5, t6, t7);\
+
+
+#define lastround(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7, bskey) \
+ shiftrows(b0, b1, b2, b3, b4, b5, b6, b7, 10, SRM0, bskey);\
+ sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, t4, t5, t6, t7);\
+ xor2(&b0,(const int128 *)(bskey + 128*10));\
+ xor2(&b1,(const int128 *)(bskey + 128*10+16));\
+ xor2(&b4,(const int128 *)(bskey + 128*10+32));\
+ xor2(&b6,(const int128 *)(bskey + 128*10+48));\
+ xor2(&b3,(const int128 *)(bskey + 128*10+64));\
+ xor2(&b7,(const int128 *)(bskey + 128*10+80));\
+ xor2(&b2,(const int128 *)(bskey + 128*10+96));\
+ xor2(&b5,(const int128 *)(bskey + 128*10+112));\
+
+
+#define sbox(b0, b1, b2, b3, b4, b5, b6, b7, t0, t1, t2, t3, s0, s1, s2, s3) \
+ InBasisChange(b0, b1, b2, b3, b4, b5, b6, b7); \
+ Inv_GF256(b6, b5, b0, b3, b7, b1, b4, b2, t0, t1, t2, t3, s0, s1, s2, s3); \
+ OutBasisChange(b7, b1, b4, b2, b6, b5, b0, b3); \
+
+
+#define InBasisChange(b0, b1, b2, b3, b4, b5, b6, b7) \
+ xor2(&b5, &b6);\
+ xor2(&b2, &b1);\
+ xor2(&b5, &b0);\
+ xor2(&b6, &b2);\
+ xor2(&b3, &b0);\
+ ;\
+ xor2(&b6, &b3);\
+ xor2(&b3, &b7);\
+ xor2(&b3, &b4);\
+ xor2(&b7, &b5);\
+ xor2(&b3, &b1);\
+ ;\
+ xor2(&b4, &b5);\
+ xor2(&b2, &b7);\
+ xor2(&b1, &b5);\
+
+#define OutBasisChange(b0, b1, b2, b3, b4, b5, b6, b7) \
+ xor2(&b0, &b6);\
+ xor2(&b1, &b4);\
+ xor2(&b2, &b0);\
+ xor2(&b4, &b6);\
+ xor2(&b6, &b1);\
+ ;\
+ xor2(&b1, &b5);\
+ xor2(&b5, &b3);\
+ xor2(&b2, &b5);\
+ xor2(&b3, &b7);\
+ xor2(&b7, &b5);\
+ ;\
+ xor2(&b4, &b7);\
+
+#define Mul_GF4(x0, x1, y0, y1, t0) \
+ copy2(&t0, &y0);\
+ xor2(&t0, &y1);\
+ and2(&t0, &x0);\
+ xor2(&x0, &x1);\
+ and2(&x0, &y1);\
+ and2(&x1, &y0);\
+ xor2(&x0, &x1);\
+ xor2(&x1, &t0);\
+
+#define Mul_GF4_N(x0, x1, y0, y1, t0) \
+ copy2(&t0, &y0);\
+ xor2(&t0, &y1);\
+ and2(&t0, &x0);\
+ xor2(&x0, &x1);\
+ and2(&x0, &y1);\
+ and2(&x1, &y0);\
+ xor2(&x1, &x0);\
+ xor2(&x0, &t0);\
+
+#define Mul_GF4_2(x0, x1, x2, x3, y0, y1, t0, t1) \
+ copy2(&t0, = y0);\
+ xor2(&t0, &y1);\
+ copy2(&t1, &t0);\
+ and2(&t0, &x0);\
+ and2(&t1, &x2);\
+ xor2(&x0, &x1);\
+ xor2(&x2, &x3);\
+ and2(&x0, &y1);\
+ and2(&x2, &y1);\
+ and2(&x1, &y0);\
+ and2(&x3, &y0);\
+ xor2(&x0, &x1);\
+ xor2(&x2, &x3);\
+ xor2(&x1, &t0);\
+ xor2(&x3, &t1);\
+
+#define Mul_GF16(x0, x1, x2, x3, y0, y1, y2, y3, t0, t1, t2, t3) \
+ copy2(&t0, &x0);\
+ copy2(&t1, &x1);\
+ Mul_GF4(x0, x1, y0, y1, t2);\
+ xor2(&t0, &x2);\
+ xor2(&t1, &x3);\
+ xor2(&y0, &y2);\
+ xor2(&y1, &y3);\
+ Mul_GF4_N(t0, t1, y0, y1, t2);\
+ Mul_GF4(x2, x3, y2, y3, t3);\
+ ;\
+ xor2(&x0, &t0);\
+ xor2(&x2, &t0);\
+ xor2(&x1, &t1);\
+ xor2(&x3, &t1);\
+
+#define Mul_GF16_2(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, t0, t1, t2, t3) \
+ copy2(&t0, &x0);\
+ copy2(&t1, &x1);\
+ Mul_GF4(x0, x1, y0, y1, t2);\
+ xor2(&t0, &x2);\
+ xor2(&t1, &x3);\
+ xor2(&y0, &y2);\
+ xor2(&y1, &y3);\
+ Mul_GF4_N(t0, t1, y0, y1, t3);\
+ Mul_GF4(x2, x3, y2, y3, t2);\
+ ;\
+ xor2(&x0, &t0);\
+ xor2(&x2, &t0);\
+ xor2(&x1, &t1);\
+ xor2(&x3, &t1);\
+ ;\
+ copy2(&t0, &x4);\
+ copy2(&t1, &x5);\
+ xor2(&t0, &x6);\
+ xor2(&t1, &x7);\
+ Mul_GF4_N(t0, t1, y0, y1, t3);\
+ Mul_GF4(x6, x7, y2, y3, t2);\
+ xor2(&y0, &y2);\
+ xor2(&y1, &y3);\
+ Mul_GF4(x4, x5, y0, y1, t3);\
+ ;\
+ xor2(&x4, &t0);\
+ xor2(&x6, &t0);\
+ xor2(&x5, &t1);\
+ xor2(&x7, &t1);\
+
+#define Inv_GF16(x0, x1, x2, x3, t0, t1, t2, t3) \
+ copy2(&t0, &x1);\
+ copy2(&t1, &x0);\
+ and2(&t0, &x3);\
+ or2(&t1, &x2);\
+ copy2(&t2, &x1);\
+ copy2(&t3, &x0);\
+ or2(&t2, &x2);\
+ or2(&t3, &x3);\
+ xor2(&t2, &t3);\
+ ;\
+ xor2(&t0, &t2);\
+ xor2(&t1, &t2);\
+ ;\
+ Mul_GF4_2(x0, x1, x2, x3, t1, t0, t2, t3);\
+
+
+#define Inv_GF256(x0, x1, x2, x3, x4, x5, x6, x7, t0, t1, t2, t3, s0, s1, s2, s3) \
+ copy2(&t3, &x4);\
+ copy2(&t2, &x5);\
+ copy2(&t1, &x1);\
+ copy2(&s1, &x7);\
+ copy2(&s0, &x0);\
+ ;\
+ xor2(&t3, &x6);\
+ xor2(&t2, &x7);\
+ xor2(&t1, &x3);\
+ xor2(&s1, &x6);\
+ xor2(&s0, &x2);\
+ ;\
+ copy2(&s2, &t3);\
+ copy2(&t0, &t2);\
+ copy2(&s3, &t3);\
+ ;\
+ or2(&t2, &t1);\
+ or2(&t3, &s0);\
+ xor2(&s3, &t0);\
+ and2(&s2, &s0);\
+ and2(&t0, &t1);\
+ xor2(&s0, &t1);\
+ and2(&s3, &s0);\
+ copy2(&s0, &x3);\
+ xor2(&s0, &x2);\
+ and2(&s1, &s0);\
+ xor2(&t3, &s1);\
+ xor2(&t2, &s1);\
+ copy2(&s1, &x4);\
+ xor2(&s1, &x5);\
+ copy2(&s0, &x1);\
+ copy2(&t1, &s1);\
+ xor2(&s0, &x0);\
+ or2(&t1, &s0);\
+ and2(&s1, &s0);\
+ xor2(&t0, &s1);\
+ xor2(&t3, &s3);\
+ xor2(&t2, &s2);\
+ xor2(&t1, &s3);\
+ xor2(&t0, &s2);\
+ xor2(&t1, &s2);\
+ copy2(&s0, &x7);\
+ copy2(&s1, &x6);\
+ copy2(&s2, &x5);\
+ copy2(&s3, &x4);\
+ and2(&s0, &x3);\
+ and2(&s1, &x2);\
+ and2(&s2, &x1);\
+ or2(&s3, &x0);\
+ xor2(&t3, &s0);\
+ xor2(&t2, &s1);\
+ xor2(&t1, &s2);\
+ xor2(&t0, &s3);\
+ ;\
+ copy2(&s0, &t3);\
+ xor2(&s0, &t2);\
+ and2(&t3, &t1);\
+ copy2(&s2, &t0);\
+ xor2(&s2, &t3);\
+ copy2(&s3, &s0);\
+ and2(&s3, &s2);\
+ xor2(&s3, &t2);\
+ copy2(&s1, &t1);\
+ xor2(&s1, &t0);\
+ xor2(&t3, &t2);\
+ and2(&s1, &t3);\
+ xor2(&s1, &t0);\
+ xor2(&t1, &s1);\
+ copy2(&t2, &s2);\
+ xor2(&t2, &s1);\
+ and2(&t2, &t0);\
+ xor2(&t1, &t2);\
+ xor2(&s2, &t2);\
+ and2(&s2, &s3);\
+ xor2(&s2, &s0);\
+ ;\
+ Mul_GF16_2(x0, x1, x2, x3, x4, x5, x6, x7, s3, s2, s1, t1, s0, t0, t2, t3);\
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
new file mode 100644
index 00000000..14a28cc6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
@@ -0,0 +1,64 @@
+#include "common.h"
+
+uint32 load32_bigendian(const unsigned char *x)
+{
+ return
+ (uint32) (x[3]) \
+ | (((uint32) (x[2])) << 8) \
+ | (((uint32) (x[1])) << 16) \
+ | (((uint32) (x[0])) << 24)
+ ;
+}
+
+void store32_bigendian(unsigned char *x,uint32 u)
+{
+ x[3] = u; u >>= 8;
+ x[2] = u; u >>= 8;
+ x[1] = u; u >>= 8;
+ x[0] = u;
+}
+
+uint32 load32_littleendian(const unsigned char *x)
+{
+ return
+ (uint32) (x[0]) \
+ | (((uint32) (x[1])) << 8) \
+ | (((uint32) (x[2])) << 16) \
+ | (((uint32) (x[3])) << 24)
+ ;
+}
+
+void store32_littleendian(unsigned char *x,uint32 u)
+{
+ x[0] = u; u >>= 8;
+ x[1] = u; u >>= 8;
+ x[2] = u; u >>= 8;
+ x[3] = u;
+}
+
+
+uint64 load64_littleendian(const unsigned char *x)
+{
+ return
+ (uint64) (x[0]) \
+ | (((uint64) (x[1])) << 8) \
+ | (((uint64) (x[2])) << 16) \
+ | (((uint64) (x[3])) << 24)
+ | (((uint64) (x[4])) << 32)
+ | (((uint64) (x[5])) << 40)
+ | (((uint64) (x[6])) << 48)
+ | (((uint64) (x[7])) << 56)
+ ;
+}
+
+void store64_littleendian(unsigned char *x,uint64 u)
+{
+ x[0] = u; u >>= 8;
+ x[1] = u; u >>= 8;
+ x[2] = u; u >>= 8;
+ x[3] = u; u >>= 8;
+ x[4] = u; u >>= 8;
+ x[5] = u; u >>= 8;
+ x[6] = u; u >>= 8;
+ x[7] = u;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts.h
new file mode 100644
index 00000000..4c50360b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts.h
@@ -0,0 +1,28 @@
+#ifndef CONSTS_H
+#define CONSTS_H
+
+#include "int128.h"
+
+#define ROTB crypto_stream_aes128ctr_portable_ROTB
+#define M0 crypto_stream_aes128ctr_portable_M0
+#define EXPB0 crypto_stream_aes128ctr_portable_EXPB0
+#define SWAP32 crypto_stream_aes128ctr_portable_SWAP32
+#define M0SWAP crypto_stream_aes128ctr_portable_M0SWAP
+#define SR crypto_stream_aes128ctr_portable_SR
+#define SRM0 crypto_stream_aes128ctr_portable_SRM0
+#define BS0 crypto_stream_aes128ctr_portable_BS0
+#define BS1 crypto_stream_aes128ctr_portable_BS1
+#define BS2 crypto_stream_aes128ctr_portable_BS2
+
+extern const unsigned char ROTB[16];
+extern const unsigned char M0[16];
+extern const unsigned char EXPB0[16];
+extern const unsigned char SWAP32[16];
+extern const unsigned char M0SWAP[16];
+extern const unsigned char SR[16];
+extern const unsigned char SRM0[16];
+extern const int128 BS0;
+extern const int128 BS1;
+extern const int128 BS2;
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c
new file mode 100644
index 00000000..f8029b84
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c
@@ -0,0 +1,14 @@
+#include "consts.h"
+
+const unsigned char ROTB[16] = {0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08};
+const unsigned char M0[16] = {0x0f, 0x0b, 0x07, 0x03, 0x0e, 0x0a, 0x06, 0x02, 0x0d, 0x09, 0x05, 0x01, 0x0c, 0x08, 0x04, 0x00};
+const unsigned char EXPB0[16] = {0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0b, 0x0f, 0x0f, 0x0f, 0x0f};
+
+const unsigned char SWAP32[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c};
+const unsigned char M0SWAP[16] = {0x0c, 0x08, 0x04, 0x00, 0x0d, 0x09, 0x05, 0x01, 0x0e, 0x0a, 0x06, 0x02, 0x0f, 0x0b, 0x07, 0x03};
+const unsigned char SR[16] = {0x01, 0x02, 0x03, 0x00, 0x06, 0x07, 0x04, 0x05, 0x0b, 0x08, 0x09, 0x0a, 0x0c, 0x0d, 0x0e, 0x0f};
+const unsigned char SRM0[16] = {0x0f, 0x0a, 0x05, 0x00, 0x0e, 0x09, 0x04, 0x03, 0x0d, 0x08, 0x07, 0x02, 0x0c, 0x0b, 0x06, 0x01};
+
+const int128 BS0 = {{0x5555555555555555ULL, 0x5555555555555555ULL}};
+const int128 BS1 = {{0x3333333333333333ULL, 0x3333333333333333ULL}};
+const int128 BS2 = {{0x0f0f0f0f0f0f0f0fULL, 0x0f0f0f0f0f0f0f0fULL}};
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h
new file mode 100644
index 00000000..3fd2111d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h
@@ -0,0 +1,56 @@
+#ifndef INT128_H
+#define INT128_H
+
+#include <stdint.h>
+
+#include "common.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+#endif
+
+typedef union {
+ uint64_t u64[2];
+ uint32_t u32[4];
+ uint8_t u8[16];
+} int128;
+
+#define xor2 crypto_stream_aes128ctr_portable_xor2
+void xor2(int128 *r, const int128 *x);
+
+#define and2 crypto_stream_aes128ctr_portable_and2
+void and2(int128 *r, const int128 *x);
+
+#define or2 crypto_stream_aes128ctr_portable_or2
+void or2(int128 *r, const int128 *x);
+
+#define copy2 crypto_stream_aes128ctr_portable_copy2
+void copy2(int128 *r, const int128 *x);
+
+#define shufb crypto_stream_aes128ctr_portable_shufb
+void shufb(int128 *r, const unsigned char *l);
+
+#define shufd crypto_stream_aes128ctr_portable_shufd
+void shufd(int128 *r, const int128 *x, const unsigned int c);
+
+#define rshift32_littleendian crypto_stream_aes128ctr_portable_rshift32_littleendian
+void rshift32_littleendian(int128 *r, const unsigned int n);
+
+#define rshift64_littleendian crypto_stream_aes128ctr_portable_rshift64_littleendian
+void rshift64_littleendian(int128 *r, const unsigned int n);
+
+#define lshift64_littleendian crypto_stream_aes128ctr_portable_lshift64_littleendian
+void lshift64_littleendian(int128 *r, const unsigned int n);
+
+#define toggle crypto_stream_aes128ctr_portable_toggle
+void toggle(int128 *r);
+
+#define xor_rcon crypto_stream_aes128ctr_portable_xor_rcon
+void xor_rcon(int128 *r);
+
+#define add_uint32_big crypto_stream_aes128ctr_portable_add_uint32_big
+void add_uint32_big(int128 *r, uint32 x);
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c
new file mode 100644
index 00000000..703de39b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c
@@ -0,0 +1,131 @@
+
+#include "int128.h"
+#include "common.h"
+
+void xor2(int128 *r, const int128 *x)
+{
+ r->u64[0] ^= x->u64[0];
+ r->u64[1] ^= x->u64[1];
+}
+
+void and2(int128 *r, const int128 *x)
+{
+ r->u64[0] &= x->u64[0];
+ r->u64[1] &= x->u64[1];
+}
+
+void or2(int128 *r, const int128 *x)
+{
+ r->u64[0] |= x->u64[0];
+ r->u64[1] |= x->u64[1];
+}
+
+void copy2(int128 *r, const int128 *x)
+{
+ r->u64[0] = x->u64[0];
+ r->u64[1] = x->u64[1];
+}
+
+void shufb(int128 *r, const unsigned char *l)
+{
+ int128 t;
+ uint8_t *ct;
+ uint8_t *cr;
+
+ copy2(&t, r);
+ cr = r->u8;
+ ct = t.u8;
+ cr[0] = ct[l[0]];
+ cr[1] = ct[l[1]];
+ cr[2] = ct[l[2]];
+ cr[3] = ct[l[3]];
+ cr[4] = ct[l[4]];
+ cr[5] = ct[l[5]];
+ cr[6] = ct[l[6]];
+ cr[7] = ct[l[7]];
+ cr[8] = ct[l[8]];
+ cr[9] = ct[l[9]];
+ cr[10] = ct[l[10]];
+ cr[11] = ct[l[11]];
+ cr[12] = ct[l[12]];
+ cr[13] = ct[l[13]];
+ cr[14] = ct[l[14]];
+ cr[15] = ct[l[15]];
+}
+
+void shufd(int128 *r, const int128 *x, const unsigned int c)
+{
+ int128 t;
+
+ t.u32[0] = x->u32[c >> 0 & 3];
+ t.u32[1] = x->u32[c >> 2 & 3];
+ t.u32[2] = x->u32[c >> 4 & 3];
+ t.u32[3] = x->u32[c >> 6 & 3];
+ copy2(r, &t);
+}
+
+void rshift32_littleendian(int128 *r, const unsigned int n)
+{
+ unsigned char *rp = (unsigned char *)r;
+ uint32 t;
+ t = load32_littleendian(rp);
+ t >>= n;
+ store32_littleendian(rp, t);
+ t = load32_littleendian(rp+4);
+ t >>= n;
+ store32_littleendian(rp+4, t);
+ t = load32_littleendian(rp+8);
+ t >>= n;
+ store32_littleendian(rp+8, t);
+ t = load32_littleendian(rp+12);
+ t >>= n;
+ store32_littleendian(rp+12, t);
+}
+
+void rshift64_littleendian(int128 *r, const unsigned int n)
+{
+ unsigned char *rp = (unsigned char *)r;
+ uint64 t;
+ t = load64_littleendian(rp);
+ t >>= n;
+ store64_littleendian(rp, t);
+ t = load64_littleendian(rp+8);
+ t >>= n;
+ store64_littleendian(rp+8, t);
+}
+
+void lshift64_littleendian(int128 *r, const unsigned int n)
+{
+ unsigned char *rp = (unsigned char *)r;
+ uint64 t;
+ t = load64_littleendian(rp);
+ t <<= n;
+ store64_littleendian(rp, t);
+ t = load64_littleendian(rp+8);
+ t <<= n;
+ store64_littleendian(rp+8, t);
+}
+
+void toggle(int128 *r)
+{
+ r->u64[0] ^= 0xffffffffffffffffULL;
+ r->u64[1] ^= 0xffffffffffffffffULL;
+}
+
+void xor_rcon(int128 *r)
+{
+ unsigned char *rp = (unsigned char *)r;
+ uint32 t;
+ t = load32_littleendian(rp+12);
+ t ^= 0xffffffff;
+ store32_littleendian(rp+12, t);
+}
+
+void add_uint32_big(int128 *r, uint32 x)
+{
+ unsigned char *rp = (unsigned char *)r;
+ uint32 t;
+ t = load32_littleendian(rp+12);
+ t += x;
+ store32_littleendian(rp+12, t);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c
new file mode 100644
index 00000000..8f4ec72a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c
@@ -0,0 +1,28 @@
+#include "api.h"
+
+int crypto_stream(
+ unsigned char *out,
+ unsigned long long outlen,
+ const unsigned char *n,
+ const unsigned char *k
+ )
+{
+ unsigned char d[crypto_stream_BEFORENMBYTES];
+ crypto_stream_beforenm(d, k);
+ crypto_stream_afternm(out, outlen, n, d);
+ return 0;
+}
+
+int crypto_stream_xor(
+ unsigned char *out,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *n,
+ const unsigned char *k
+ )
+{
+ unsigned char d[crypto_stream_BEFORENMBYTES];
+ crypto_stream_beforenm(d, k);
+ crypto_stream_xor_afternm(out, in, inlen, n, d);
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h
new file mode 100644
index 00000000..6aa502fc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h
@@ -0,0 +1,10 @@
+#ifndef TYPES_H
+#define TYPES_H
+
+#include "crypto_uint32.h"
+typedef crypto_uint32 uint32;
+
+#include "crypto_uint64.h"
+typedef crypto_uint64 uint64;
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c
new file mode 100644
index 00000000..139dbe51
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c
@@ -0,0 +1,181 @@
+/* Author: Peter Schwabe, ported from an assembly implementation by Emilia Käsper
+ * Date: 2009-03-19
+ * Public domain */
+
+#include <stdio.h>
+#include "api.h"
+#include "int128.h"
+#include "common.h"
+#include "consts.h"
+
+int crypto_stream_xor_afternm(unsigned char *out, const unsigned char *in, unsigned long long len, const unsigned char *nonce, const unsigned char *c)
+{
+
+ int128 xmm0;
+ int128 xmm1;
+ int128 xmm2;
+ int128 xmm3;
+ int128 xmm4;
+ int128 xmm5;
+ int128 xmm6;
+ int128 xmm7;
+
+ int128 xmm8;
+ int128 xmm9;
+ int128 xmm10;
+ int128 xmm11;
+ int128 xmm12;
+ int128 xmm13;
+ int128 xmm14;
+ int128 xmm15;
+
+ int128 nonce_stack;
+ unsigned long long lensav;
+ unsigned char bl[128];
+ unsigned char *blp;
+ unsigned char *np;
+ unsigned char b;
+
+ uint32 tmp;
+
+ /* Copy nonce on the stack */
+ copy2(&nonce_stack, (const int128 *) (nonce + 0));
+ np = (unsigned char *)&nonce_stack;
+
+ enc_block:
+
+ xmm0 = *(int128 *) (np + 0);
+ copy2(&xmm1, &xmm0);
+ shufb(&xmm1, SWAP32);
+ copy2(&xmm2, &xmm1);
+ copy2(&xmm3, &xmm1);
+ copy2(&xmm4, &xmm1);
+ copy2(&xmm5, &xmm1);
+ copy2(&xmm6, &xmm1);
+ copy2(&xmm7, &xmm1);
+
+ add_uint32_big(&xmm1, 1);
+ add_uint32_big(&xmm2, 2);
+ add_uint32_big(&xmm3, 3);
+ add_uint32_big(&xmm4, 4);
+ add_uint32_big(&xmm5, 5);
+ add_uint32_big(&xmm6, 6);
+ add_uint32_big(&xmm7, 7);
+
+ shufb(&xmm0, M0);
+ shufb(&xmm1, M0SWAP);
+ shufb(&xmm2, M0SWAP);
+ shufb(&xmm3, M0SWAP);
+ shufb(&xmm4, M0SWAP);
+ shufb(&xmm5, M0SWAP);
+ shufb(&xmm6, M0SWAP);
+ shufb(&xmm7, M0SWAP);
+
+ bitslice(xmm7, xmm6, xmm5, xmm4, xmm3, xmm2, xmm1, xmm0, xmm8)
+
+ aesround( 1, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ aesround( 2, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+ aesround( 3, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ aesround( 4, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+ aesround( 5, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ aesround( 6, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+ aesround( 7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ aesround( 8, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+ aesround( 9, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,c)
+ lastround(xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,c)
+
+ bitslice(xmm13, xmm10, xmm15, xmm11, xmm14, xmm12, xmm9, xmm8, xmm0)
+
+ if(len < 128) goto partial;
+ if(len == 128) goto full;
+
+ tmp = load32_bigendian(np + 12);
+ tmp += 8;
+ store32_bigendian(np + 12, tmp);
+
+ xor2(&xmm8, (const int128 *)(in + 0));
+ xor2(&xmm9, (const int128 *)(in + 16));
+ xor2(&xmm12, (const int128 *)(in + 32));
+ xor2(&xmm14, (const int128 *)(in + 48));
+ xor2(&xmm11, (const int128 *)(in + 64));
+ xor2(&xmm15, (const int128 *)(in + 80));
+ xor2(&xmm10, (const int128 *)(in + 96));
+ xor2(&xmm13, (const int128 *)(in + 112));
+
+ *(int128 *) (out + 0) = xmm8;
+ *(int128 *) (out + 16) = xmm9;
+ *(int128 *) (out + 32) = xmm12;
+ *(int128 *) (out + 48) = xmm14;
+ *(int128 *) (out + 64) = xmm11;
+ *(int128 *) (out + 80) = xmm15;
+ *(int128 *) (out + 96) = xmm10;
+ *(int128 *) (out + 112) = xmm13;
+
+ len -= 128;
+ in += 128;
+ out += 128;
+
+ goto enc_block;
+
+ partial:
+
+ lensav = len;
+ len >>= 4;
+
+ tmp = load32_bigendian(np + 12);
+ tmp += len;
+ store32_bigendian(np + 12, tmp);
+
+ blp = bl;
+ *(int128 *)(blp + 0) = xmm8;
+ *(int128 *)(blp + 16) = xmm9;
+ *(int128 *)(blp + 32) = xmm12;
+ *(int128 *)(blp + 48) = xmm14;
+ *(int128 *)(blp + 64) = xmm11;
+ *(int128 *)(blp + 80) = xmm15;
+ *(int128 *)(blp + 96) = xmm10;
+ *(int128 *)(blp + 112) = xmm13;
+
+ bytes:
+
+ if(lensav == 0) goto end;
+
+ b = blp[0]; /* clang false positive */
+ b ^= *(const unsigned char *)(in + 0);
+ *(unsigned char *)(out + 0) = b;
+
+ blp += 1;
+ in +=1;
+ out +=1;
+ lensav -= 1;
+
+ goto bytes;
+
+ full:
+
+ tmp = load32_bigendian(np + 12);
+ tmp += 8;
+ store32_bigendian(np + 12, tmp);
+
+ xor2(&xmm8, (const int128 *)(in + 0));
+ xor2(&xmm9, (const int128 *)(in + 16));
+ xor2(&xmm12, (const int128 *)(in + 32));
+ xor2(&xmm14, (const int128 *)(in + 48));
+ xor2(&xmm11, (const int128 *)(in + 64));
+ xor2(&xmm15, (const int128 *)(in + 80));
+ xor2(&xmm10, (const int128 *)(in + 96));
+ xor2(&xmm13, (const int128 *)(in + 112));
+
+ *(int128 *) (out + 0) = xmm8;
+ *(int128 *) (out + 16) = xmm9;
+ *(int128 *) (out + 32) = xmm12;
+ *(int128 *) (out + 48) = xmm14;
+ *(int128 *) (out + 64) = xmm11;
+ *(int128 *) (out + 80) = xmm15;
+ *(int128 *) (out + 96) = xmm10;
+ *(int128 *) (out + 112) = xmm13;
+
+ end:
+ return 0;
+
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c
new file mode 100644
index 00000000..184ad3fb
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c
@@ -0,0 +1,16 @@
+#include "crypto_stream_aes128ctr.h"
+
+size_t
+crypto_stream_aes128ctr_keybytes(void) {
+ return crypto_stream_aes128ctr_KEYBYTES;
+}
+
+size_t
+crypto_stream_aes128ctr_noncebytes(void) {
+ return crypto_stream_aes128ctr_NONCEBYTES;
+}
+
+size_t
+crypto_stream_aes128ctr_beforenmbytes(void) {
+ return crypto_stream_aes128ctr_BEFORENMBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h
new file mode 100644
index 00000000..3d858670
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h
@@ -0,0 +1,12 @@
+
+#include "crypto_stream_chacha20.h"
+
+int
+crypto_stream_chacha20_ref(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
+
+int
+crypto_stream_chacha20_ref_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint64_t ic,
+ const unsigned char *k);
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c
new file mode 100644
index 00000000..967015f2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c
@@ -0,0 +1,276 @@
+
+/* $OpenBSD: chacha.c,v 1.1 2013/11/21 00:45:44 djm Exp $ */
+
+/*
+ chacha-merged.c version 20080118
+ D. J. Bernstein
+ Public domain.
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "api.h"
+#include "crypto_stream_chacha20.h"
+#include "utils.h"
+
+struct chacha_ctx {
+ uint32_t input[16];
+};
+
+typedef uint8_t u8;
+typedef uint32_t u32;
+
+typedef struct chacha_ctx chacha_ctx;
+
+#define U8C(v) (v##U)
+#define U32C(v) (v##U)
+
+#define U8V(v) ((u8)(v) & U8C(0xFF))
+#define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF))
+
+#define ROTL32(v, n) \
+ (U32V((v) << (n)) | ((v) >> (32 - (n))))
+
+#define U8TO32_LITTLE(p) \
+ (((u32)((p)[0]) ) | \
+ ((u32)((p)[1]) << 8) | \
+ ((u32)((p)[2]) << 16) | \
+ ((u32)((p)[3]) << 24))
+
+#define U32TO8_LITTLE(p, v) \
+ do { \
+ (p)[0] = U8V((v) ); \
+ (p)[1] = U8V((v) >> 8); \
+ (p)[2] = U8V((v) >> 16); \
+ (p)[3] = U8V((v) >> 24); \
+ } while (0)
+
+#define ROTATE(v,c) (ROTL32(v,c))
+#define XOR(v,w) ((v) ^ (w))
+#define PLUS(v,w) (U32V((v) + (w)))
+#define PLUSONE(v) (PLUS((v),1))
+
+#define QUARTERROUND(a,b,c,d) \
+ a = PLUS(a,b); d = ROTATE(XOR(d,a),16); \
+ c = PLUS(c,d); b = ROTATE(XOR(b,c),12); \
+ a = PLUS(a,b); d = ROTATE(XOR(d,a), 8); \
+ c = PLUS(c,d); b = ROTATE(XOR(b,c), 7);
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+static void
+chacha_keysetup(chacha_ctx *x, const u8 *k)
+{
+ const unsigned char *constants;
+
+ x->input[4] = U8TO32_LITTLE(k + 0);
+ x->input[5] = U8TO32_LITTLE(k + 4);
+ x->input[6] = U8TO32_LITTLE(k + 8);
+ x->input[7] = U8TO32_LITTLE(k + 12);
+ k += 16;
+ constants = sigma;
+ x->input[8] = U8TO32_LITTLE(k + 0);
+ x->input[9] = U8TO32_LITTLE(k + 4);
+ x->input[10] = U8TO32_LITTLE(k + 8);
+ x->input[11] = U8TO32_LITTLE(k + 12);
+ x->input[0] = U8TO32_LITTLE(constants + 0);
+ x->input[1] = U8TO32_LITTLE(constants + 4);
+ x->input[2] = U8TO32_LITTLE(constants + 8);
+ x->input[3] = U8TO32_LITTLE(constants + 12);
+}
+
+static void
+chacha_ivsetup(chacha_ctx *x, const u8 *iv, const u8 *counter)
+{
+ x->input[12] = counter == NULL ? 0 : U8TO32_LITTLE(counter + 0);
+ x->input[13] = counter == NULL ? 0 : U8TO32_LITTLE(counter + 4);
+ x->input[14] = U8TO32_LITTLE(iv + 0);
+ x->input[15] = U8TO32_LITTLE(iv + 4);
+}
+
+static void
+chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, unsigned long long bytes)
+{
+ u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
+ u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
+ u8 *ctarget = NULL;
+ u8 tmp[64];
+ unsigned int i;
+
+ if (!bytes) {
+ return; /* LCOV_EXCL_LINE */
+ }
+ j0 = x->input[0];
+ j1 = x->input[1];
+ j2 = x->input[2];
+ j3 = x->input[3];
+ j4 = x->input[4];
+ j5 = x->input[5];
+ j6 = x->input[6];
+ j7 = x->input[7];
+ j8 = x->input[8];
+ j9 = x->input[9];
+ j10 = x->input[10];
+ j11 = x->input[11];
+ j12 = x->input[12];
+ j13 = x->input[13];
+ j14 = x->input[14];
+ j15 = x->input[15];
+
+ for (;;) {
+ if (bytes < 64) {
+ for (i = 0; i < bytes; ++i) {
+ tmp[i] = m[i];
+ }
+ m = tmp;
+ ctarget = c;
+ c = tmp;
+ }
+ x0 = j0;
+ x1 = j1;
+ x2 = j2;
+ x3 = j3;
+ x4 = j4;
+ x5 = j5;
+ x6 = j6;
+ x7 = j7;
+ x8 = j8;
+ x9 = j9;
+ x10 = j10;
+ x11 = j11;
+ x12 = j12;
+ x13 = j13;
+ x14 = j14;
+ x15 = j15;
+ for (i = 20; i > 0; i -= 2) {
+ QUARTERROUND(x0, x4, x8, x12)
+ QUARTERROUND(x1, x5, x9, x13)
+ QUARTERROUND(x2, x6, x10, x14)
+ QUARTERROUND(x3, x7, x11, x15)
+ QUARTERROUND(x0, x5, x10, x15)
+ QUARTERROUND(x1, x6, x11, x12)
+ QUARTERROUND(x2, x7, x8, x13)
+ QUARTERROUND(x3, x4, x9, x14)
+ }
+ x0 = PLUS(x0, j0);
+ x1 = PLUS(x1, j1);
+ x2 = PLUS(x2, j2);
+ x3 = PLUS(x3, j3);
+ x4 = PLUS(x4, j4);
+ x5 = PLUS(x5, j5);
+ x6 = PLUS(x6, j6);
+ x7 = PLUS(x7, j7);
+ x8 = PLUS(x8, j8);
+ x9 = PLUS(x9, j9);
+ x10 = PLUS(x10, j10);
+ x11 = PLUS(x11, j11);
+ x12 = PLUS(x12, j12);
+ x13 = PLUS(x13, j13);
+ x14 = PLUS(x14, j14);
+ x15 = PLUS(x15, j15);
+
+ x0 = XOR(x0, U8TO32_LITTLE(m + 0));
+ x1 = XOR(x1, U8TO32_LITTLE(m + 4));
+ x2 = XOR(x2, U8TO32_LITTLE(m + 8));
+ x3 = XOR(x3, U8TO32_LITTLE(m + 12));
+ x4 = XOR(x4, U8TO32_LITTLE(m + 16));
+ x5 = XOR(x5, U8TO32_LITTLE(m + 20));
+ x6 = XOR(x6, U8TO32_LITTLE(m + 24));
+ x7 = XOR(x7, U8TO32_LITTLE(m + 28));
+ x8 = XOR(x8, U8TO32_LITTLE(m + 32));
+ x9 = XOR(x9, U8TO32_LITTLE(m + 36));
+ x10 = XOR(x10, U8TO32_LITTLE(m + 40));
+ x11 = XOR(x11, U8TO32_LITTLE(m + 44));
+ x12 = XOR(x12, U8TO32_LITTLE(m + 48));
+ x13 = XOR(x13, U8TO32_LITTLE(m + 52));
+ x14 = XOR(x14, U8TO32_LITTLE(m + 56));
+ x15 = XOR(x15, U8TO32_LITTLE(m + 60));
+
+ j12 = PLUSONE(j12);
+ /* LCOV_EXCL_START */
+ if (!j12) {
+ j13 = PLUSONE(j13);
+ }
+ /* LCOV_EXCL_STOP */
+
+ U32TO8_LITTLE(c + 0, x0);
+ U32TO8_LITTLE(c + 4, x1);
+ U32TO8_LITTLE(c + 8, x2);
+ U32TO8_LITTLE(c + 12, x3);
+ U32TO8_LITTLE(c + 16, x4);
+ U32TO8_LITTLE(c + 20, x5);
+ U32TO8_LITTLE(c + 24, x6);
+ U32TO8_LITTLE(c + 28, x7);
+ U32TO8_LITTLE(c + 32, x8);
+ U32TO8_LITTLE(c + 36, x9);
+ U32TO8_LITTLE(c + 40, x10);
+ U32TO8_LITTLE(c + 44, x11);
+ U32TO8_LITTLE(c + 48, x12);
+ U32TO8_LITTLE(c + 52, x13);
+ U32TO8_LITTLE(c + 56, x14);
+ U32TO8_LITTLE(c + 60, x15);
+
+ if (bytes <= 64) {
+ if (bytes < 64) {
+ for (i = 0; i < (unsigned int) bytes; ++i) {
+ ctarget[i] = c[i];
+ }
+ }
+ x->input[12] = j12;
+ x->input[13] = j13;
+ return;
+ }
+ bytes -= 64;
+ c += 64;
+ m += 64;
+ }
+}
+
+int
+crypto_stream_chacha20_ref(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k)
+{
+ struct chacha_ctx ctx;
+
+ if (!clen) {
+ return 0;
+ }
+ (void) sizeof(int[crypto_stream_chacha20_KEYBYTES == 256 / 8 ? 1 : -1]);
+ chacha_keysetup(&ctx, k);
+ chacha_ivsetup(&ctx, n, NULL);
+ memset(c, 0, clen);
+ chacha_encrypt_bytes(&ctx, c, c, clen);
+ sodium_memzero(&ctx, sizeof ctx);
+
+ return 0;
+}
+
+int
+crypto_stream_chacha20_ref_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint64_t ic,
+ const unsigned char *k)
+{
+ struct chacha_ctx ctx;
+ uint8_t ic_bytes[8];
+ uint32_t ic_high;
+ uint32_t ic_low;
+
+ if (!mlen) {
+ return 0;
+ }
+ ic_high = U32V(ic >> 32);
+ ic_low = U32V(ic);
+ U32TO8_LITTLE(&ic_bytes[0], ic_low);
+ U32TO8_LITTLE(&ic_bytes[4], ic_high);
+ chacha_keysetup(&ctx, k);
+ chacha_ivsetup(&ctx, n, ic_bytes);
+ chacha_encrypt_bytes(&ctx, m, c, mlen);
+ sodium_memzero(&ctx, sizeof ctx);
+ sodium_memzero(ic_bytes, sizeof ic_bytes);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c
new file mode 100644
index 00000000..412cdfab
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c
@@ -0,0 +1,36 @@
+#include "crypto_stream_chacha20.h"
+#include "ref/api.h"
+
+size_t
+crypto_stream_chacha20_keybytes(void) {
+ return crypto_stream_chacha20_KEYBYTES;
+}
+
+size_t
+crypto_stream_chacha20_noncebytes(void) {
+ return crypto_stream_chacha20_NONCEBYTES;
+}
+
+int
+crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k)
+{
+ return crypto_stream_chacha20_ref(c, clen, n, k);
+}
+
+int
+crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint64_t ic,
+ const unsigned char *k)
+{
+ return crypto_stream_chacha20_ref_xor_ic(c, m, mlen, n, ic, k);
+}
+
+int
+crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ return crypto_stream_chacha20_ref_xor_ic(c, m, mlen, n, 0U, k);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/crypto_stream.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/crypto_stream.c
new file mode 100644
index 00000000..50a9c1c0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/crypto_stream.c
@@ -0,0 +1,36 @@
+
+#include "crypto_stream.h"
+
+size_t
+crypto_stream_keybytes(void)
+{
+ return crypto_stream_KEYBYTES;
+}
+
+size_t
+crypto_stream_noncebytes(void)
+{
+ return crypto_stream_NONCEBYTES;
+}
+
+const char *
+crypto_stream_primitive(void)
+{
+ return crypto_stream_PRIMITIVE;
+}
+
+int
+crypto_stream(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k)
+{
+ return crypto_stream_xsalsa20(c, clen, n, k);
+}
+
+
+int
+crypto_stream_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ return crypto_stream_xsalsa20_xor(c, m, mlen, n, k);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h
new file mode 100644
index 00000000..037fb59d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h
@@ -0,0 +1 @@
+#include "crypto_stream_salsa20.h"
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S
new file mode 100644
index 00000000..f2415685
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S
@@ -0,0 +1,944 @@
+#if defined(__amd64) || defined(__amd64__) || defined(__x86_64__)
+
+.text
+.p2align 5
+
+.globl crypto_stream_salsa20
+.globl _crypto_stream_salsa20
+#ifdef __ELF__
+.type crypto_stream_salsa20, @function
+.type _crypto_stream_salsa20, @function
+#endif
+crypto_stream_salsa20:
+_crypto_stream_salsa20:
+mov %rsp,%r11
+and $31,%r11
+add $512,%r11
+sub %r11,%rsp
+movq %r11,416(%rsp)
+movq %r12,424(%rsp)
+movq %r13,432(%rsp)
+movq %r14,440(%rsp)
+movq %r15,448(%rsp)
+movq %rbx,456(%rsp)
+movq %rbp,464(%rsp)
+mov %rsi,%r9
+mov %rdi,%rdi
+mov %rdi,%rsi
+mov %rdx,%rdx
+mov %rcx,%r10
+cmp $0,%r9
+jbe ._done
+mov $0,%rax
+mov %r9,%rcx
+rep stosb
+sub %r9,%rdi
+movq $0,472(%rsp)
+jmp ._start
+
+.text
+.p2align 5
+
+.globl crypto_stream_salsa20_xor_ic
+.globl _crypto_stream_salsa20_xor_ic
+#ifdef __ELF__
+.type crypto_stream_salsa20_xor_ic, @function
+.type _crypto_stream_salsa20_xor_ic, @function
+#endif
+crypto_stream_salsa20_xor_ic:
+_crypto_stream_salsa20_xor_ic:
+
+mov %rsp,%r11
+and $31,%r11
+add $512,%r11
+sub %r11,%rsp
+movq %r11,416(%rsp)
+movq %r12,424(%rsp)
+movq %r13,432(%rsp)
+movq %r14,440(%rsp)
+movq %r15,448(%rsp)
+movq %rbx,456(%rsp)
+movq %rbp,464(%rsp)
+mov %rdi,%rdi
+mov %rsi,%rsi
+mov %r9,%r10
+movq %r8,472(%rsp)
+mov %rdx,%r9
+mov %rcx,%rdx
+cmp $0,%r9
+jbe ._done
+
+._start:
+movl 20(%r10),%ecx
+movl 0(%r10),%r8d
+movl 0(%rdx),%eax
+movl 16(%r10),%r11d
+movl %ecx,64(%rsp)
+movl %r8d,4+64(%rsp)
+movl %eax,8+64(%rsp)
+movl %r11d,12+64(%rsp)
+movl 24(%r10),%r8d
+movl 4(%r10),%eax
+movl 4(%rdx),%edx
+movq 472(%rsp),%rcx
+movl %ecx,80(%rsp)
+movl %r8d,4+80(%rsp)
+movl %eax,8+80(%rsp)
+movl %edx,12+80(%rsp)
+movl 12(%r10),%edx
+shr $32,%rcx
+movl 28(%r10),%r8d
+movl 8(%r10),%eax
+movl %edx,96(%rsp)
+movl %ecx,4+96(%rsp)
+movl %r8d,8+96(%rsp)
+movl %eax,12+96(%rsp)
+mov $1634760805,%rdx
+mov $857760878,%rcx
+mov $2036477234,%r8
+mov $1797285236,%rax
+movl %edx,112(%rsp)
+movl %ecx,4+112(%rsp)
+movl %r8d,8+112(%rsp)
+movl %eax,12+112(%rsp)
+cmp $256,%r9
+jb ._bytesbetween1and255
+movdqa 112(%rsp),%xmm0
+pshufd $0x55,%xmm0,%xmm1
+pshufd $0xaa,%xmm0,%xmm2
+pshufd $0xff,%xmm0,%xmm3
+pshufd $0x00,%xmm0,%xmm0
+movdqa %xmm1,128(%rsp)
+movdqa %xmm2,144(%rsp)
+movdqa %xmm3,160(%rsp)
+movdqa %xmm0,176(%rsp)
+movdqa 64(%rsp),%xmm0
+pshufd $0xaa,%xmm0,%xmm1
+pshufd $0xff,%xmm0,%xmm2
+pshufd $0x00,%xmm0,%xmm3
+pshufd $0x55,%xmm0,%xmm0
+movdqa %xmm1,192(%rsp)
+movdqa %xmm2,208(%rsp)
+movdqa %xmm3,224(%rsp)
+movdqa %xmm0,240(%rsp)
+movdqa 80(%rsp),%xmm0
+pshufd $0xff,%xmm0,%xmm1
+pshufd $0x55,%xmm0,%xmm2
+pshufd $0xaa,%xmm0,%xmm0
+movdqa %xmm1,256(%rsp)
+movdqa %xmm2,272(%rsp)
+movdqa %xmm0,288(%rsp)
+movdqa 96(%rsp),%xmm0
+pshufd $0x00,%xmm0,%xmm1
+pshufd $0xaa,%xmm0,%xmm2
+pshufd $0xff,%xmm0,%xmm0
+movdqa %xmm1,304(%rsp)
+movdqa %xmm2,320(%rsp)
+movdqa %xmm0,336(%rsp)
+
+._bytesatleast256:
+movq 472(%rsp),%rdx
+mov %rdx,%rcx
+shr $32,%rcx
+movl %edx,352(%rsp)
+movl %ecx,368(%rsp)
+add $1,%rdx
+mov %rdx,%rcx
+shr $32,%rcx
+movl %edx,4+352(%rsp)
+movl %ecx,4+368(%rsp)
+add $1,%rdx
+mov %rdx,%rcx
+shr $32,%rcx
+movl %edx,8+352(%rsp)
+movl %ecx,8+368(%rsp)
+add $1,%rdx
+mov %rdx,%rcx
+shr $32,%rcx
+movl %edx,12+352(%rsp)
+movl %ecx,12+368(%rsp)
+add $1,%rdx
+mov %rdx,%rcx
+shr $32,%rcx
+movl %edx,80(%rsp)
+movl %ecx,4+96(%rsp)
+movq %rdx,472(%rsp)
+movq %r9,480(%rsp)
+mov $20,%rdx
+movdqa 128(%rsp),%xmm0
+movdqa 144(%rsp),%xmm1
+movdqa 160(%rsp),%xmm2
+movdqa 320(%rsp),%xmm3
+movdqa 336(%rsp),%xmm4
+movdqa 192(%rsp),%xmm5
+movdqa 208(%rsp),%xmm6
+movdqa 240(%rsp),%xmm7
+movdqa 256(%rsp),%xmm8
+movdqa 272(%rsp),%xmm9
+movdqa 288(%rsp),%xmm10
+movdqa 368(%rsp),%xmm11
+movdqa 176(%rsp),%xmm12
+movdqa 224(%rsp),%xmm13
+movdqa 304(%rsp),%xmm14
+movdqa 352(%rsp),%xmm15
+
+._mainloop1:
+movdqa %xmm1,384(%rsp)
+movdqa %xmm2,400(%rsp)
+movdqa %xmm13,%xmm1
+paddd %xmm12,%xmm1
+movdqa %xmm1,%xmm2
+pslld $7,%xmm1
+pxor %xmm1,%xmm14
+psrld $25,%xmm2
+pxor %xmm2,%xmm14
+movdqa %xmm7,%xmm1
+paddd %xmm0,%xmm1
+movdqa %xmm1,%xmm2
+pslld $7,%xmm1
+pxor %xmm1,%xmm11
+psrld $25,%xmm2
+pxor %xmm2,%xmm11
+movdqa %xmm12,%xmm1
+paddd %xmm14,%xmm1
+movdqa %xmm1,%xmm2
+pslld $9,%xmm1
+pxor %xmm1,%xmm15
+psrld $23,%xmm2
+pxor %xmm2,%xmm15
+movdqa %xmm0,%xmm1
+paddd %xmm11,%xmm1
+movdqa %xmm1,%xmm2
+pslld $9,%xmm1
+pxor %xmm1,%xmm9
+psrld $23,%xmm2
+pxor %xmm2,%xmm9
+movdqa %xmm14,%xmm1
+paddd %xmm15,%xmm1
+movdqa %xmm1,%xmm2
+pslld $13,%xmm1
+pxor %xmm1,%xmm13
+psrld $19,%xmm2
+pxor %xmm2,%xmm13
+movdqa %xmm11,%xmm1
+paddd %xmm9,%xmm1
+movdqa %xmm1,%xmm2
+pslld $13,%xmm1
+pxor %xmm1,%xmm7
+psrld $19,%xmm2
+pxor %xmm2,%xmm7
+movdqa %xmm15,%xmm1
+paddd %xmm13,%xmm1
+movdqa %xmm1,%xmm2
+pslld $18,%xmm1
+pxor %xmm1,%xmm12
+psrld $14,%xmm2
+pxor %xmm2,%xmm12
+movdqa 384(%rsp),%xmm1
+movdqa %xmm12,384(%rsp)
+movdqa %xmm9,%xmm2
+paddd %xmm7,%xmm2
+movdqa %xmm2,%xmm12
+pslld $18,%xmm2
+pxor %xmm2,%xmm0
+psrld $14,%xmm12
+pxor %xmm12,%xmm0
+movdqa %xmm5,%xmm2
+paddd %xmm1,%xmm2
+movdqa %xmm2,%xmm12
+pslld $7,%xmm2
+pxor %xmm2,%xmm3
+psrld $25,%xmm12
+pxor %xmm12,%xmm3
+movdqa 400(%rsp),%xmm2
+movdqa %xmm0,400(%rsp)
+movdqa %xmm6,%xmm0
+paddd %xmm2,%xmm0
+movdqa %xmm0,%xmm12
+pslld $7,%xmm0
+pxor %xmm0,%xmm4
+psrld $25,%xmm12
+pxor %xmm12,%xmm4
+movdqa %xmm1,%xmm0
+paddd %xmm3,%xmm0
+movdqa %xmm0,%xmm12
+pslld $9,%xmm0
+pxor %xmm0,%xmm10
+psrld $23,%xmm12
+pxor %xmm12,%xmm10
+movdqa %xmm2,%xmm0
+paddd %xmm4,%xmm0
+movdqa %xmm0,%xmm12
+pslld $9,%xmm0
+pxor %xmm0,%xmm8
+psrld $23,%xmm12
+pxor %xmm12,%xmm8
+movdqa %xmm3,%xmm0
+paddd %xmm10,%xmm0
+movdqa %xmm0,%xmm12
+pslld $13,%xmm0
+pxor %xmm0,%xmm5
+psrld $19,%xmm12
+pxor %xmm12,%xmm5
+movdqa %xmm4,%xmm0
+paddd %xmm8,%xmm0
+movdqa %xmm0,%xmm12
+pslld $13,%xmm0
+pxor %xmm0,%xmm6
+psrld $19,%xmm12
+pxor %xmm12,%xmm6
+movdqa %xmm10,%xmm0
+paddd %xmm5,%xmm0
+movdqa %xmm0,%xmm12
+pslld $18,%xmm0
+pxor %xmm0,%xmm1
+psrld $14,%xmm12
+pxor %xmm12,%xmm1
+movdqa 384(%rsp),%xmm0
+movdqa %xmm1,384(%rsp)
+movdqa %xmm4,%xmm1
+paddd %xmm0,%xmm1
+movdqa %xmm1,%xmm12
+pslld $7,%xmm1
+pxor %xmm1,%xmm7
+psrld $25,%xmm12
+pxor %xmm12,%xmm7
+movdqa %xmm8,%xmm1
+paddd %xmm6,%xmm1
+movdqa %xmm1,%xmm12
+pslld $18,%xmm1
+pxor %xmm1,%xmm2
+psrld $14,%xmm12
+pxor %xmm12,%xmm2
+movdqa 400(%rsp),%xmm12
+movdqa %xmm2,400(%rsp)
+movdqa %xmm14,%xmm1
+paddd %xmm12,%xmm1
+movdqa %xmm1,%xmm2
+pslld $7,%xmm1
+pxor %xmm1,%xmm5
+psrld $25,%xmm2
+pxor %xmm2,%xmm5
+movdqa %xmm0,%xmm1
+paddd %xmm7,%xmm1
+movdqa %xmm1,%xmm2
+pslld $9,%xmm1
+pxor %xmm1,%xmm10
+psrld $23,%xmm2
+pxor %xmm2,%xmm10
+movdqa %xmm12,%xmm1
+paddd %xmm5,%xmm1
+movdqa %xmm1,%xmm2
+pslld $9,%xmm1
+pxor %xmm1,%xmm8
+psrld $23,%xmm2
+pxor %xmm2,%xmm8
+movdqa %xmm7,%xmm1
+paddd %xmm10,%xmm1
+movdqa %xmm1,%xmm2
+pslld $13,%xmm1
+pxor %xmm1,%xmm4
+psrld $19,%xmm2
+pxor %xmm2,%xmm4
+movdqa %xmm5,%xmm1
+paddd %xmm8,%xmm1
+movdqa %xmm1,%xmm2
+pslld $13,%xmm1
+pxor %xmm1,%xmm14
+psrld $19,%xmm2
+pxor %xmm2,%xmm14
+movdqa %xmm10,%xmm1
+paddd %xmm4,%xmm1
+movdqa %xmm1,%xmm2
+pslld $18,%xmm1
+pxor %xmm1,%xmm0
+psrld $14,%xmm2
+pxor %xmm2,%xmm0
+movdqa 384(%rsp),%xmm1
+movdqa %xmm0,384(%rsp)
+movdqa %xmm8,%xmm0
+paddd %xmm14,%xmm0
+movdqa %xmm0,%xmm2
+pslld $18,%xmm0
+pxor %xmm0,%xmm12
+psrld $14,%xmm2
+pxor %xmm2,%xmm12
+movdqa %xmm11,%xmm0
+paddd %xmm1,%xmm0
+movdqa %xmm0,%xmm2
+pslld $7,%xmm0
+pxor %xmm0,%xmm6
+psrld $25,%xmm2
+pxor %xmm2,%xmm6
+movdqa 400(%rsp),%xmm2
+movdqa %xmm12,400(%rsp)
+movdqa %xmm3,%xmm0
+paddd %xmm2,%xmm0
+movdqa %xmm0,%xmm12
+pslld $7,%xmm0
+pxor %xmm0,%xmm13
+psrld $25,%xmm12
+pxor %xmm12,%xmm13
+movdqa %xmm1,%xmm0
+paddd %xmm6,%xmm0
+movdqa %xmm0,%xmm12
+pslld $9,%xmm0
+pxor %xmm0,%xmm15
+psrld $23,%xmm12
+pxor %xmm12,%xmm15
+movdqa %xmm2,%xmm0
+paddd %xmm13,%xmm0
+movdqa %xmm0,%xmm12
+pslld $9,%xmm0
+pxor %xmm0,%xmm9
+psrld $23,%xmm12
+pxor %xmm12,%xmm9
+movdqa %xmm6,%xmm0
+paddd %xmm15,%xmm0
+movdqa %xmm0,%xmm12
+pslld $13,%xmm0
+pxor %xmm0,%xmm11
+psrld $19,%xmm12
+pxor %xmm12,%xmm11
+movdqa %xmm13,%xmm0
+paddd %xmm9,%xmm0
+movdqa %xmm0,%xmm12
+pslld $13,%xmm0
+pxor %xmm0,%xmm3
+psrld $19,%xmm12
+pxor %xmm12,%xmm3
+movdqa %xmm15,%xmm0
+paddd %xmm11,%xmm0
+movdqa %xmm0,%xmm12
+pslld $18,%xmm0
+pxor %xmm0,%xmm1
+psrld $14,%xmm12
+pxor %xmm12,%xmm1
+movdqa %xmm9,%xmm0
+paddd %xmm3,%xmm0
+movdqa %xmm0,%xmm12
+pslld $18,%xmm0
+pxor %xmm0,%xmm2
+psrld $14,%xmm12
+pxor %xmm12,%xmm2
+movdqa 384(%rsp),%xmm12
+movdqa 400(%rsp),%xmm0
+sub $2,%rdx
+ja ._mainloop1
+paddd 176(%rsp),%xmm12
+paddd 240(%rsp),%xmm7
+paddd 288(%rsp),%xmm10
+paddd 336(%rsp),%xmm4
+movd %xmm12,%rdx
+movd %xmm7,%rcx
+movd %xmm10,%r8
+movd %xmm4,%r9
+pshufd $0x39,%xmm12,%xmm12
+pshufd $0x39,%xmm7,%xmm7
+pshufd $0x39,%xmm10,%xmm10
+pshufd $0x39,%xmm4,%xmm4
+xorl 0(%rsi),%edx
+xorl 4(%rsi),%ecx
+xorl 8(%rsi),%r8d
+xorl 12(%rsi),%r9d
+movl %edx,0(%rdi)
+movl %ecx,4(%rdi)
+movl %r8d,8(%rdi)
+movl %r9d,12(%rdi)
+movd %xmm12,%rdx
+movd %xmm7,%rcx
+movd %xmm10,%r8
+movd %xmm4,%r9
+pshufd $0x39,%xmm12,%xmm12
+pshufd $0x39,%xmm7,%xmm7
+pshufd $0x39,%xmm10,%xmm10
+pshufd $0x39,%xmm4,%xmm4
+xorl 64(%rsi),%edx
+xorl 68(%rsi),%ecx
+xorl 72(%rsi),%r8d
+xorl 76(%rsi),%r9d
+movl %edx,64(%rdi)
+movl %ecx,68(%rdi)
+movl %r8d,72(%rdi)
+movl %r9d,76(%rdi)
+movd %xmm12,%rdx
+movd %xmm7,%rcx
+movd %xmm10,%r8
+movd %xmm4,%r9
+pshufd $0x39,%xmm12,%xmm12
+pshufd $0x39,%xmm7,%xmm7
+pshufd $0x39,%xmm10,%xmm10
+pshufd $0x39,%xmm4,%xmm4
+xorl 128(%rsi),%edx
+xorl 132(%rsi),%ecx
+xorl 136(%rsi),%r8d
+xorl 140(%rsi),%r9d
+movl %edx,128(%rdi)
+movl %ecx,132(%rdi)
+movl %r8d,136(%rdi)
+movl %r9d,140(%rdi)
+movd %xmm12,%rdx
+movd %xmm7,%rcx
+movd %xmm10,%r8
+movd %xmm4,%r9
+xorl 192(%rsi),%edx
+xorl 196(%rsi),%ecx
+xorl 200(%rsi),%r8d
+xorl 204(%rsi),%r9d
+movl %edx,192(%rdi)
+movl %ecx,196(%rdi)
+movl %r8d,200(%rdi)
+movl %r9d,204(%rdi)
+paddd 304(%rsp),%xmm14
+paddd 128(%rsp),%xmm0
+paddd 192(%rsp),%xmm5
+paddd 256(%rsp),%xmm8
+movd %xmm14,%rdx
+movd %xmm0,%rcx
+movd %xmm5,%r8
+movd %xmm8,%r9
+pshufd $0x39,%xmm14,%xmm14
+pshufd $0x39,%xmm0,%xmm0
+pshufd $0x39,%xmm5,%xmm5
+pshufd $0x39,%xmm8,%xmm8
+xorl 16(%rsi),%edx
+xorl 20(%rsi),%ecx
+xorl 24(%rsi),%r8d
+xorl 28(%rsi),%r9d
+movl %edx,16(%rdi)
+movl %ecx,20(%rdi)
+movl %r8d,24(%rdi)
+movl %r9d,28(%rdi)
+movd %xmm14,%rdx
+movd %xmm0,%rcx
+movd %xmm5,%r8
+movd %xmm8,%r9
+pshufd $0x39,%xmm14,%xmm14
+pshufd $0x39,%xmm0,%xmm0
+pshufd $0x39,%xmm5,%xmm5
+pshufd $0x39,%xmm8,%xmm8
+xorl 80(%rsi),%edx
+xorl 84(%rsi),%ecx
+xorl 88(%rsi),%r8d
+xorl 92(%rsi),%r9d
+movl %edx,80(%rdi)
+movl %ecx,84(%rdi)
+movl %r8d,88(%rdi)
+movl %r9d,92(%rdi)
+movd %xmm14,%rdx
+movd %xmm0,%rcx
+movd %xmm5,%r8
+movd %xmm8,%r9
+pshufd $0x39,%xmm14,%xmm14
+pshufd $0x39,%xmm0,%xmm0
+pshufd $0x39,%xmm5,%xmm5
+pshufd $0x39,%xmm8,%xmm8
+xorl 144(%rsi),%edx
+xorl 148(%rsi),%ecx
+xorl 152(%rsi),%r8d
+xorl 156(%rsi),%r9d
+movl %edx,144(%rdi)
+movl %ecx,148(%rdi)
+movl %r8d,152(%rdi)
+movl %r9d,156(%rdi)
+movd %xmm14,%rdx
+movd %xmm0,%rcx
+movd %xmm5,%r8
+movd %xmm8,%r9
+xorl 208(%rsi),%edx
+xorl 212(%rsi),%ecx
+xorl 216(%rsi),%r8d
+xorl 220(%rsi),%r9d
+movl %edx,208(%rdi)
+movl %ecx,212(%rdi)
+movl %r8d,216(%rdi)
+movl %r9d,220(%rdi)
+paddd 352(%rsp),%xmm15
+paddd 368(%rsp),%xmm11
+paddd 144(%rsp),%xmm1
+paddd 208(%rsp),%xmm6
+movd %xmm15,%rdx
+movd %xmm11,%rcx
+movd %xmm1,%r8
+movd %xmm6,%r9
+pshufd $0x39,%xmm15,%xmm15
+pshufd $0x39,%xmm11,%xmm11
+pshufd $0x39,%xmm1,%xmm1
+pshufd $0x39,%xmm6,%xmm6
+xorl 32(%rsi),%edx
+xorl 36(%rsi),%ecx
+xorl 40(%rsi),%r8d
+xorl 44(%rsi),%r9d
+movl %edx,32(%rdi)
+movl %ecx,36(%rdi)
+movl %r8d,40(%rdi)
+movl %r9d,44(%rdi)
+movd %xmm15,%rdx
+movd %xmm11,%rcx
+movd %xmm1,%r8
+movd %xmm6,%r9
+pshufd $0x39,%xmm15,%xmm15
+pshufd $0x39,%xmm11,%xmm11
+pshufd $0x39,%xmm1,%xmm1
+pshufd $0x39,%xmm6,%xmm6
+xorl 96(%rsi),%edx
+xorl 100(%rsi),%ecx
+xorl 104(%rsi),%r8d
+xorl 108(%rsi),%r9d
+movl %edx,96(%rdi)
+movl %ecx,100(%rdi)
+movl %r8d,104(%rdi)
+movl %r9d,108(%rdi)
+movd %xmm15,%rdx
+movd %xmm11,%rcx
+movd %xmm1,%r8
+movd %xmm6,%r9
+pshufd $0x39,%xmm15,%xmm15
+pshufd $0x39,%xmm11,%xmm11
+pshufd $0x39,%xmm1,%xmm1
+pshufd $0x39,%xmm6,%xmm6
+xorl 160(%rsi),%edx
+xorl 164(%rsi),%ecx
+xorl 168(%rsi),%r8d
+xorl 172(%rsi),%r9d
+movl %edx,160(%rdi)
+movl %ecx,164(%rdi)
+movl %r8d,168(%rdi)
+movl %r9d,172(%rdi)
+movd %xmm15,%rdx
+movd %xmm11,%rcx
+movd %xmm1,%r8
+movd %xmm6,%r9
+xorl 224(%rsi),%edx
+xorl 228(%rsi),%ecx
+xorl 232(%rsi),%r8d
+xorl 236(%rsi),%r9d
+movl %edx,224(%rdi)
+movl %ecx,228(%rdi)
+movl %r8d,232(%rdi)
+movl %r9d,236(%rdi)
+paddd 224(%rsp),%xmm13
+paddd 272(%rsp),%xmm9
+paddd 320(%rsp),%xmm3
+paddd 160(%rsp),%xmm2
+movd %xmm13,%rdx
+movd %xmm9,%rcx
+movd %xmm3,%r8
+movd %xmm2,%r9
+pshufd $0x39,%xmm13,%xmm13
+pshufd $0x39,%xmm9,%xmm9
+pshufd $0x39,%xmm3,%xmm3
+pshufd $0x39,%xmm2,%xmm2
+xorl 48(%rsi),%edx
+xorl 52(%rsi),%ecx
+xorl 56(%rsi),%r8d
+xorl 60(%rsi),%r9d
+movl %edx,48(%rdi)
+movl %ecx,52(%rdi)
+movl %r8d,56(%rdi)
+movl %r9d,60(%rdi)
+movd %xmm13,%rdx
+movd %xmm9,%rcx
+movd %xmm3,%r8
+movd %xmm2,%r9
+pshufd $0x39,%xmm13,%xmm13
+pshufd $0x39,%xmm9,%xmm9
+pshufd $0x39,%xmm3,%xmm3
+pshufd $0x39,%xmm2,%xmm2
+xorl 112(%rsi),%edx
+xorl 116(%rsi),%ecx
+xorl 120(%rsi),%r8d
+xorl 124(%rsi),%r9d
+movl %edx,112(%rdi)
+movl %ecx,116(%rdi)
+movl %r8d,120(%rdi)
+movl %r9d,124(%rdi)
+movd %xmm13,%rdx
+movd %xmm9,%rcx
+movd %xmm3,%r8
+movd %xmm2,%r9
+pshufd $0x39,%xmm13,%xmm13
+pshufd $0x39,%xmm9,%xmm9
+pshufd $0x39,%xmm3,%xmm3
+pshufd $0x39,%xmm2,%xmm2
+xorl 176(%rsi),%edx
+xorl 180(%rsi),%ecx
+xorl 184(%rsi),%r8d
+xorl 188(%rsi),%r9d
+movl %edx,176(%rdi)
+movl %ecx,180(%rdi)
+movl %r8d,184(%rdi)
+movl %r9d,188(%rdi)
+movd %xmm13,%rdx
+movd %xmm9,%rcx
+movd %xmm3,%r8
+movd %xmm2,%r9
+xorl 240(%rsi),%edx
+xorl 244(%rsi),%ecx
+xorl 248(%rsi),%r8d
+xorl 252(%rsi),%r9d
+movl %edx,240(%rdi)
+movl %ecx,244(%rdi)
+movl %r8d,248(%rdi)
+movl %r9d,252(%rdi)
+movq 480(%rsp),%r9
+sub $256,%r9
+add $256,%rsi
+add $256,%rdi
+cmp $256,%r9
+jae ._bytesatleast256
+cmp $0,%r9
+jbe ._done
+
+._bytesbetween1and255:
+cmp $64,%r9
+jae ._nocopy
+mov %rdi,%rdx
+leaq 0(%rsp),%rdi
+mov %r9,%rcx
+rep movsb
+leaq 0(%rsp),%rdi
+leaq 0(%rsp),%rsi
+
+._nocopy:
+movq %r9,480(%rsp)
+movdqa 112(%rsp),%xmm0
+movdqa 64(%rsp),%xmm1
+movdqa 80(%rsp),%xmm2
+movdqa 96(%rsp),%xmm3
+movdqa %xmm1,%xmm4
+mov $20,%rcx
+
+._mainloop2:
+paddd %xmm0,%xmm4
+movdqa %xmm0,%xmm5
+movdqa %xmm4,%xmm6
+pslld $7,%xmm4
+psrld $25,%xmm6
+pxor %xmm4,%xmm3
+pxor %xmm6,%xmm3
+paddd %xmm3,%xmm5
+movdqa %xmm3,%xmm4
+movdqa %xmm5,%xmm6
+pslld $9,%xmm5
+psrld $23,%xmm6
+pxor %xmm5,%xmm2
+pshufd $0x93,%xmm3,%xmm3
+pxor %xmm6,%xmm2
+paddd %xmm2,%xmm4
+movdqa %xmm2,%xmm5
+movdqa %xmm4,%xmm6
+pslld $13,%xmm4
+psrld $19,%xmm6
+pxor %xmm4,%xmm1
+pshufd $0x4e,%xmm2,%xmm2
+pxor %xmm6,%xmm1
+paddd %xmm1,%xmm5
+movdqa %xmm3,%xmm4
+movdqa %xmm5,%xmm6
+pslld $18,%xmm5
+psrld $14,%xmm6
+pxor %xmm5,%xmm0
+pshufd $0x39,%xmm1,%xmm1
+pxor %xmm6,%xmm0
+paddd %xmm0,%xmm4
+movdqa %xmm0,%xmm5
+movdqa %xmm4,%xmm6
+pslld $7,%xmm4
+psrld $25,%xmm6
+pxor %xmm4,%xmm1
+pxor %xmm6,%xmm1
+paddd %xmm1,%xmm5
+movdqa %xmm1,%xmm4
+movdqa %xmm5,%xmm6
+pslld $9,%xmm5
+psrld $23,%xmm6
+pxor %xmm5,%xmm2
+pshufd $0x93,%xmm1,%xmm1
+pxor %xmm6,%xmm2
+paddd %xmm2,%xmm4
+movdqa %xmm2,%xmm5
+movdqa %xmm4,%xmm6
+pslld $13,%xmm4
+psrld $19,%xmm6
+pxor %xmm4,%xmm3
+pshufd $0x4e,%xmm2,%xmm2
+pxor %xmm6,%xmm3
+paddd %xmm3,%xmm5
+movdqa %xmm1,%xmm4
+movdqa %xmm5,%xmm6
+pslld $18,%xmm5
+psrld $14,%xmm6
+pxor %xmm5,%xmm0
+pshufd $0x39,%xmm3,%xmm3
+pxor %xmm6,%xmm0
+paddd %xmm0,%xmm4
+movdqa %xmm0,%xmm5
+movdqa %xmm4,%xmm6
+pslld $7,%xmm4
+psrld $25,%xmm6
+pxor %xmm4,%xmm3
+pxor %xmm6,%xmm3
+paddd %xmm3,%xmm5
+movdqa %xmm3,%xmm4
+movdqa %xmm5,%xmm6
+pslld $9,%xmm5
+psrld $23,%xmm6
+pxor %xmm5,%xmm2
+pshufd $0x93,%xmm3,%xmm3
+pxor %xmm6,%xmm2
+paddd %xmm2,%xmm4
+movdqa %xmm2,%xmm5
+movdqa %xmm4,%xmm6
+pslld $13,%xmm4
+psrld $19,%xmm6
+pxor %xmm4,%xmm1
+pshufd $0x4e,%xmm2,%xmm2
+pxor %xmm6,%xmm1
+paddd %xmm1,%xmm5
+movdqa %xmm3,%xmm4
+movdqa %xmm5,%xmm6
+pslld $18,%xmm5
+psrld $14,%xmm6
+pxor %xmm5,%xmm0
+pshufd $0x39,%xmm1,%xmm1
+pxor %xmm6,%xmm0
+paddd %xmm0,%xmm4
+movdqa %xmm0,%xmm5
+movdqa %xmm4,%xmm6
+pslld $7,%xmm4
+psrld $25,%xmm6
+pxor %xmm4,%xmm1
+pxor %xmm6,%xmm1
+paddd %xmm1,%xmm5
+movdqa %xmm1,%xmm4
+movdqa %xmm5,%xmm6
+pslld $9,%xmm5
+psrld $23,%xmm6
+pxor %xmm5,%xmm2
+pshufd $0x93,%xmm1,%xmm1
+pxor %xmm6,%xmm2
+paddd %xmm2,%xmm4
+movdqa %xmm2,%xmm5
+movdqa %xmm4,%xmm6
+pslld $13,%xmm4
+psrld $19,%xmm6
+pxor %xmm4,%xmm3
+pshufd $0x4e,%xmm2,%xmm2
+pxor %xmm6,%xmm3
+sub $4,%rcx
+paddd %xmm3,%xmm5
+movdqa %xmm1,%xmm4
+movdqa %xmm5,%xmm6
+pslld $18,%xmm5
+pxor %xmm7,%xmm7
+psrld $14,%xmm6
+pxor %xmm5,%xmm0
+pshufd $0x39,%xmm3,%xmm3
+pxor %xmm6,%xmm0
+ja ._mainloop2
+paddd 112(%rsp),%xmm0
+paddd 64(%rsp),%xmm1
+paddd 80(%rsp),%xmm2
+paddd 96(%rsp),%xmm3
+movd %xmm0,%rcx
+movd %xmm1,%r8
+movd %xmm2,%r9
+movd %xmm3,%rax
+pshufd $0x39,%xmm0,%xmm0
+pshufd $0x39,%xmm1,%xmm1
+pshufd $0x39,%xmm2,%xmm2
+pshufd $0x39,%xmm3,%xmm3
+xorl 0(%rsi),%ecx
+xorl 48(%rsi),%r8d
+xorl 32(%rsi),%r9d
+xorl 16(%rsi),%eax
+movl %ecx,0(%rdi)
+movl %r8d,48(%rdi)
+movl %r9d,32(%rdi)
+movl %eax,16(%rdi)
+movd %xmm0,%rcx
+movd %xmm1,%r8
+movd %xmm2,%r9
+movd %xmm3,%rax
+pshufd $0x39,%xmm0,%xmm0
+pshufd $0x39,%xmm1,%xmm1
+pshufd $0x39,%xmm2,%xmm2
+pshufd $0x39,%xmm3,%xmm3
+xorl 20(%rsi),%ecx
+xorl 4(%rsi),%r8d
+xorl 52(%rsi),%r9d
+xorl 36(%rsi),%eax
+movl %ecx,20(%rdi)
+movl %r8d,4(%rdi)
+movl %r9d,52(%rdi)
+movl %eax,36(%rdi)
+movd %xmm0,%rcx
+movd %xmm1,%r8
+movd %xmm2,%r9
+movd %xmm3,%rax
+pshufd $0x39,%xmm0,%xmm0
+pshufd $0x39,%xmm1,%xmm1
+pshufd $0x39,%xmm2,%xmm2
+pshufd $0x39,%xmm3,%xmm3
+xorl 40(%rsi),%ecx
+xorl 24(%rsi),%r8d
+xorl 8(%rsi),%r9d
+xorl 56(%rsi),%eax
+movl %ecx,40(%rdi)
+movl %r8d,24(%rdi)
+movl %r9d,8(%rdi)
+movl %eax,56(%rdi)
+movd %xmm0,%rcx
+movd %xmm1,%r8
+movd %xmm2,%r9
+movd %xmm3,%rax
+xorl 60(%rsi),%ecx
+xorl 44(%rsi),%r8d
+xorl 28(%rsi),%r9d
+xorl 12(%rsi),%eax
+movl %ecx,60(%rdi)
+movl %r8d,44(%rdi)
+movl %r9d,28(%rdi)
+movl %eax,12(%rdi)
+movq 480(%rsp),%r9
+movq 472(%rsp),%rcx
+add $1,%rcx
+mov %rcx,%r8
+shr $32,%r8
+movl %ecx,80(%rsp)
+movl %r8d,4+96(%rsp)
+movq %rcx,472(%rsp)
+cmp $64,%r9
+ja ._bytesatleast65
+jae ._bytesatleast64
+mov %rdi,%rsi
+mov %rdx,%rdi
+mov %r9,%rcx
+rep movsb
+
+._bytesatleast64:
+._done:
+movq 416(%rsp),%r11
+movq 424(%rsp),%r12
+movq 432(%rsp),%r13
+movq 440(%rsp),%r14
+movq 448(%rsp),%r15
+movq 456(%rsp),%rbx
+movq 464(%rsp),%rbp
+add %r11,%rsp
+xor %rax,%rax
+mov %rsi,%rdx
+ret
+
+._bytesatleast65:
+sub $64,%r9
+add $64,%rdi
+add $64,%rsi
+jmp ._bytesbetween1and255
+
+#endif
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h
new file mode 100644
index 00000000..3616ea71
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h
@@ -0,0 +1,5 @@
+
+#include "crypto_stream_salsa20.h"
+
+#define crypto_stream crypto_stream_salsa20
+#define crypto_stream_xor crypto_stream_salsa20_xor
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c
new file mode 100644
index 00000000..b90827c0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c
@@ -0,0 +1,61 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+#include "crypto_core_salsa20.h"
+#include "utils.h"
+
+#ifndef HAVE_AMD64_ASM
+
+typedef unsigned int uint32;
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int crypto_stream(
+ unsigned char *c,unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ unsigned char in[16];
+ unsigned char block[64];
+ unsigned char kcopy[32];
+ unsigned int i;
+ unsigned int u;
+
+ if (!clen) return 0;
+
+ for (i = 0;i < 32;++i) kcopy[i] = k[i];
+ for (i = 0;i < 8;++i) in[i] = n[i];
+ for (i = 8;i < 16;++i) in[i] = 0;
+
+ while (clen >= 64) {
+ crypto_core_salsa20(c,in,kcopy,sigma);
+
+ u = 1;
+ for (i = 8;i < 16;++i) {
+ u += (unsigned int) in[i];
+ in[i] = u;
+ u >>= 8;
+ }
+
+ clen -= 64;
+ c += 64;
+ }
+
+ if (clen) {
+ crypto_core_salsa20(block,in,kcopy,sigma);
+ for (i = 0;i < (unsigned int) clen;++i) c[i] = block[i];
+ }
+ sodium_memzero(block, sizeof block);
+ sodium_memzero(kcopy, sizeof kcopy);
+
+ return 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c
new file mode 100644
index 00000000..27cf1470
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c
@@ -0,0 +1,69 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include <stdint.h>
+
+#include "api.h"
+#include "crypto_core_salsa20.h"
+#include "utils.h"
+
+#ifndef HAVE_AMD64_ASM
+
+typedef unsigned int uint32;
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int crypto_stream_salsa20_xor_ic(
+ unsigned char *c,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *n, uint64_t ic,
+ const unsigned char *k
+)
+{
+ unsigned char in[16];
+ unsigned char block[64];
+ unsigned char kcopy[32];
+ unsigned int i;
+ unsigned int u;
+
+ if (!mlen) return 0;
+
+ for (i = 0;i < 32;++i) kcopy[i] = k[i];
+ for (i = 0;i < 8;++i) in[i] = n[i];
+ for (i = 8;i < 16;++i) {
+ in[i] = (unsigned char) (ic & 0xff);
+ ic >>= 8;
+ }
+
+ while (mlen >= 64) {
+ crypto_core_salsa20(block,in,kcopy,sigma);
+ for (i = 0;i < 64;++i) c[i] = m[i] ^ block[i];
+
+ u = 1;
+ for (i = 8;i < 16;++i) {
+ u += (unsigned int) in[i];
+ in[i] = u;
+ u >>= 8;
+ }
+
+ mlen -= 64;
+ c += 64;
+ m += 64;
+ }
+
+ if (mlen) {
+ crypto_core_salsa20(block,in,kcopy,sigma);
+ for (i = 0;i < (unsigned int) mlen;++i) c[i] = m[i] ^ block[i];
+ }
+ sodium_memzero(block, sizeof block);
+ sodium_memzero(kcopy, sizeof kcopy);
+
+ return 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c
new file mode 100644
index 00000000..3bc05801
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c
@@ -0,0 +1,19 @@
+#include "crypto_stream_salsa20.h"
+
+size_t
+crypto_stream_salsa20_keybytes(void) {
+ return crypto_stream_salsa20_KEYBYTES;
+}
+
+size_t
+crypto_stream_salsa20_noncebytes(void) {
+ return crypto_stream_salsa20_NONCEBYTES;
+}
+
+int
+crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k)
+{
+ return crypto_stream_salsa20_xor_ic(c, m, mlen, n, 0U, k);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h
new file mode 100644
index 00000000..0efe8b8a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h
@@ -0,0 +1,10 @@
+
+#include "crypto_stream_salsa2012.h"
+
+#define crypto_stream crypto_stream_salsa2012
+#define crypto_stream_xor crypto_stream_salsa2012_xor
+#define crypto_stream_KEYBYTES crypto_stream_salsa2012_KEYBYTES
+#define crypto_stream_NONCEBYTES crypto_stream_salsa2012_NONCEBYTES
+#define crypto_stream_IMPLEMENTATION crypto_stream_salsa2012_IMPLEMENTATION
+#define crypto_stream_VERSION crypto_stream_salsa2012_VERSION
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c
new file mode 100644
index 00000000..ef121235
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c
@@ -0,0 +1,57 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+#include "crypto_core_salsa2012.h"
+#include "utils.h"
+
+typedef unsigned int uint32;
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int crypto_stream(
+ unsigned char *c,unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ unsigned char in[16];
+ unsigned char block[64];
+ unsigned char kcopy[32];
+ unsigned int i;
+ unsigned int u;
+
+ if (!clen) return 0;
+
+ for (i = 0;i < 32;++i) kcopy[i] = k[i];
+ for (i = 0;i < 8;++i) in[i] = n[i];
+ for (i = 8;i < 16;++i) in[i] = 0;
+
+ while (clen >= 64) {
+ crypto_core_salsa2012(c,in,kcopy,sigma);
+
+ u = 1;
+ for (i = 8;i < 16;++i) {
+ u += (unsigned int) in[i];
+ in[i] = u;
+ u >>= 8;
+ }
+
+ clen -= 64;
+ c += 64;
+ }
+
+ if (clen) {
+ crypto_core_salsa2012(block,in,kcopy,sigma);
+ for (i = 0;i < (unsigned int) clen;++i) c[i] = block[i];
+ }
+ sodium_memzero(block, sizeof block);
+ sodium_memzero(kcopy, sizeof kcopy);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c
new file mode 100644
index 00000000..132a720a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c
@@ -0,0 +1,60 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+#include "crypto_core_salsa2012.h"
+#include "utils.h"
+
+typedef unsigned int uint32;
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int crypto_stream_xor(
+ unsigned char *c,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ unsigned char in[16];
+ unsigned char block[64];
+ unsigned char kcopy[32];
+ unsigned int i;
+ unsigned int u;
+
+ if (!mlen) return 0;
+
+ for (i = 0;i < 32;++i) kcopy[i] = k[i];
+ for (i = 0;i < 8;++i) in[i] = n[i];
+ for (i = 8;i < 16;++i) in[i] = 0;
+
+ while (mlen >= 64) {
+ crypto_core_salsa2012(block,in,kcopy,sigma);
+ for (i = 0;i < 64;++i) c[i] = m[i] ^ block[i];
+
+ u = 1;
+ for (i = 8;i < 16;++i) {
+ u += (unsigned int) in[i];
+ in[i] = u;
+ u >>= 8;
+ }
+
+ mlen -= 64;
+ c += 64;
+ m += 64;
+ }
+
+ if (mlen) {
+ crypto_core_salsa2012(block,in,kcopy,sigma);
+ for (i = 0;i < (unsigned int) mlen;++i) c[i] = m[i] ^ block[i];
+ }
+ sodium_memzero(block, sizeof block);
+ sodium_memzero(kcopy, sizeof kcopy);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c
new file mode 100644
index 00000000..3b5685f3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c
@@ -0,0 +1,11 @@
+#include "crypto_stream_salsa2012.h"
+
+size_t
+crypto_stream_salsa2012_keybytes(void) {
+ return crypto_stream_salsa2012_KEYBYTES;
+}
+
+size_t
+crypto_stream_salsa2012_noncebytes(void) {
+ return crypto_stream_salsa2012_NONCEBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h
new file mode 100644
index 00000000..14b4a775
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h
@@ -0,0 +1,9 @@
+
+#include "crypto_stream_salsa208.h"
+
+#define crypto_stream crypto_stream_salsa208
+#define crypto_stream_xor crypto_stream_salsa208_xor
+#define crypto_stream_KEYBYTES crypto_stream_salsa208_KEYBYTES
+#define crypto_stream_NONCEBYTES crypto_stream_salsa208_NONCEBYTES
+#define crypto_stream_IMPLEMENTATION crypto_stream_salsa208_IMPLEMENTATION
+#define crypto_stream_VERSION crypto_stream_salsa208_VERSION
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c
new file mode 100644
index 00000000..6a15ff15
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c
@@ -0,0 +1,57 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+#include "crypto_core_salsa208.h"
+#include "utils.h"
+
+typedef unsigned int uint32;
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int crypto_stream(
+ unsigned char *c,unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ unsigned char in[16];
+ unsigned char block[64];
+ unsigned char kcopy[32];
+ unsigned int i;
+ unsigned int u;
+
+ if (!clen) return 0;
+
+ for (i = 0;i < 32;++i) kcopy[i] = k[i];
+ for (i = 0;i < 8;++i) in[i] = n[i];
+ for (i = 8;i < 16;++i) in[i] = 0;
+
+ while (clen >= 64) {
+ crypto_core_salsa208(c,in,kcopy,sigma);
+
+ u = 1;
+ for (i = 8;i < 16;++i) {
+ u += (unsigned int) in[i];
+ in[i] = u;
+ u >>= 8;
+ }
+
+ clen -= 64;
+ c += 64;
+ }
+
+ if (clen) {
+ crypto_core_salsa208(block,in,kcopy,sigma);
+ for (i = 0;i < (unsigned int) clen;++i) c[i] = block[i];
+ }
+ sodium_memzero(block, sizeof block);
+ sodium_memzero(kcopy, sizeof kcopy);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c
new file mode 100644
index 00000000..de0eae9f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c
@@ -0,0 +1,60 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+#include "crypto_core_salsa208.h"
+#include "utils.h"
+
+typedef unsigned int uint32;
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int crypto_stream_xor(
+ unsigned char *c,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ unsigned char in[16];
+ unsigned char block[64];
+ unsigned char kcopy[32];
+ unsigned int i;
+ unsigned int u;
+
+ if (!mlen) return 0;
+
+ for (i = 0;i < 32;++i) kcopy[i] = k[i];
+ for (i = 0;i < 8;++i) in[i] = n[i];
+ for (i = 8;i < 16;++i) in[i] = 0;
+
+ while (mlen >= 64) {
+ crypto_core_salsa208(block,in,kcopy,sigma);
+ for (i = 0;i < 64;++i) c[i] = m[i] ^ block[i];
+
+ u = 1;
+ for (i = 8;i < 16;++i) {
+ u += (unsigned int) in[i];
+ in[i] = u;
+ u >>= 8;
+ }
+
+ mlen -= 64;
+ c += 64;
+ m += 64;
+ }
+
+ if (mlen) {
+ crypto_core_salsa208(block,in,kcopy,sigma);
+ for (i = 0;i < (unsigned int) mlen;++i) c[i] = m[i] ^ block[i];
+ }
+ sodium_memzero(block, sizeof block);
+ sodium_memzero(kcopy, sizeof kcopy);
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c
new file mode 100644
index 00000000..640a8b2e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c
@@ -0,0 +1,11 @@
+#include "crypto_stream_salsa208.h"
+
+size_t
+crypto_stream_salsa208_keybytes(void) {
+ return crypto_stream_salsa208_KEYBYTES;
+}
+
+size_t
+crypto_stream_salsa208_noncebytes(void) {
+ return crypto_stream_salsa208_NONCEBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h
new file mode 100644
index 00000000..58915f31
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h
@@ -0,0 +1,10 @@
+
+#include "crypto_stream_xsalsa20.h"
+
+#define crypto_stream crypto_stream_xsalsa20
+#define crypto_stream_xor crypto_stream_xsalsa20_xor
+#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES
+#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES
+#define crypto_stream_IMPLEMENTATION crypto_stream_xsalsa20_IMPLEMENTATION
+#define crypto_stream_VERSION crypto_stream_xsalsa20_VERSION
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c
new file mode 100644
index 00000000..64e42cb7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c
@@ -0,0 +1,28 @@
+/*
+version 20080914
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+#include "crypto_core_hsalsa20.h"
+#include "crypto_stream_salsa20.h"
+#include "utils.h"
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int crypto_stream(
+ unsigned char *c,unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ unsigned char subkey[32];
+ int ret;
+ crypto_core_hsalsa20(subkey,n,k,sigma);
+ ret = crypto_stream_salsa20(c,clen,n + 16,subkey);
+ sodium_memzero(subkey, sizeof subkey);
+ return ret;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c
new file mode 100644
index 00000000..b77b9f78
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c
@@ -0,0 +1,29 @@
+/*
+version 20080913
+D. J. Bernstein
+Public domain.
+*/
+
+#include "api.h"
+#include "crypto_core_hsalsa20.h"
+#include "crypto_stream_salsa20.h"
+#include "utils.h"
+
+static const unsigned char sigma[16] = {
+ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
+};
+
+int crypto_stream_xor(
+ unsigned char *c,
+ const unsigned char *m,unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *k
+)
+{
+ unsigned char subkey[32];
+ int ret;
+ crypto_core_hsalsa20(subkey,n,k,sigma);
+ ret = crypto_stream_salsa20_xor(c,m,mlen,n + 16,subkey);
+ sodium_memzero(subkey, sizeof subkey);
+ return ret;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c
new file mode 100644
index 00000000..256084e5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c
@@ -0,0 +1,11 @@
+#include "crypto_stream_xsalsa20.h"
+
+size_t
+crypto_stream_xsalsa20_keybytes(void) {
+ return crypto_stream_xsalsa20_KEYBYTES;
+}
+
+size_t
+crypto_stream_xsalsa20_noncebytes(void) {
+ return crypto_stream_xsalsa20_NONCEBYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/ref/api.h
new file mode 100644
index 00000000..8dcaf872
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/ref/api.h
@@ -0,0 +1,2 @@
+
+#include "crypto_verify_16.h"
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c
new file mode 100644
index 00000000..f7e33f1c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c
@@ -0,0 +1,24 @@
+#include "api.h"
+
+int crypto_verify_16(const unsigned char *x,const unsigned char *y)
+{
+ unsigned int differentbits = 0;
+#define F(i) differentbits |= x[i] ^ y[i];
+ F(0)
+ F(1)
+ F(2)
+ F(3)
+ F(4)
+ F(5)
+ F(6)
+ F(7)
+ F(8)
+ F(9)
+ F(10)
+ F(11)
+ F(12)
+ F(13)
+ F(14)
+ F(15)
+ return (1 & ((differentbits - 1) >> 8)) - 1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/verify_16_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/verify_16_api.c
new file mode 100644
index 00000000..757f9b63
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/16/verify_16_api.c
@@ -0,0 +1,6 @@
+#include "crypto_verify_16.h"
+
+size_t
+crypto_verify_16_bytes(void) {
+ return crypto_verify_16_BYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/ref/api.h
new file mode 100644
index 00000000..e2e3a1c7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/ref/api.h
@@ -0,0 +1,2 @@
+
+#include "crypto_verify_32.h"
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c
new file mode 100644
index 00000000..31c36971
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c
@@ -0,0 +1,40 @@
+#include "api.h"
+
+int crypto_verify_32(const unsigned char *x,const unsigned char *y)
+{
+ unsigned int differentbits = 0;
+#define F(i) differentbits |= x[i] ^ y[i];
+ F(0)
+ F(1)
+ F(2)
+ F(3)
+ F(4)
+ F(5)
+ F(6)
+ F(7)
+ F(8)
+ F(9)
+ F(10)
+ F(11)
+ F(12)
+ F(13)
+ F(14)
+ F(15)
+ F(16)
+ F(17)
+ F(18)
+ F(19)
+ F(20)
+ F(21)
+ F(22)
+ F(23)
+ F(24)
+ F(25)
+ F(26)
+ F(27)
+ F(28)
+ F(29)
+ F(30)
+ F(31)
+ return (1 & ((differentbits - 1) >> 8)) - 1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/verify_32_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/verify_32_api.c
new file mode 100644
index 00000000..6241c4d3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/32/verify_32_api.c
@@ -0,0 +1,6 @@
+#include "crypto_verify_32.h"
+
+size_t
+crypto_verify_32_bytes(void) {
+ return crypto_verify_32_BYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/ref/api.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/ref/api.h
new file mode 100644
index 00000000..1ffd2f82
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/ref/api.h
@@ -0,0 +1,2 @@
+
+#include "crypto_verify_64.h"
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c
new file mode 100644
index 00000000..730f598b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/ref/verify_64.c
@@ -0,0 +1,72 @@
+#include "api.h"
+
+int crypto_verify_64(const unsigned char *x,const unsigned char *y)
+{
+ unsigned int differentbits = 0;
+#define F(i) differentbits |= x[i] ^ y[i];
+ F(0)
+ F(1)
+ F(2)
+ F(3)
+ F(4)
+ F(5)
+ F(6)
+ F(7)
+ F(8)
+ F(9)
+ F(10)
+ F(11)
+ F(12)
+ F(13)
+ F(14)
+ F(15)
+ F(16)
+ F(17)
+ F(18)
+ F(19)
+ F(20)
+ F(21)
+ F(22)
+ F(23)
+ F(24)
+ F(25)
+ F(26)
+ F(27)
+ F(28)
+ F(29)
+ F(30)
+ F(31)
+ F(32)
+ F(33)
+ F(34)
+ F(35)
+ F(36)
+ F(37)
+ F(38)
+ F(39)
+ F(40)
+ F(41)
+ F(42)
+ F(43)
+ F(44)
+ F(45)
+ F(46)
+ F(47)
+ F(48)
+ F(49)
+ F(50)
+ F(51)
+ F(52)
+ F(53)
+ F(54)
+ F(55)
+ F(56)
+ F(57)
+ F(58)
+ F(59)
+ F(60)
+ F(61)
+ F(62)
+ F(63)
+ return (1 & ((differentbits - 1) >> 8)) - 1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/verify_64_api.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/verify_64_api.c
new file mode 100644
index 00000000..ec3e4d49
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/crypto_verify/64/verify_64_api.c
@@ -0,0 +1,6 @@
+#include "crypto_verify_64.h"
+
+size_t
+crypto_verify_64_bytes(void) {
+ return crypto_verify_64_BYTES;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium.h
new file mode 100644
index 00000000..207bdede
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium.h
@@ -0,0 +1,50 @@
+
+#ifndef sodium_H
+#define sodium_H
+
+#include "sodium/core.h"
+#include "sodium/crypto_aead_chacha20poly1305.h"
+#include "sodium/crypto_auth.h"
+#include "sodium/crypto_auth_hmacsha256.h"
+#include "sodium/crypto_auth_hmacsha512.h"
+#include "sodium/crypto_auth_hmacsha512256.h"
+#include "sodium/crypto_box.h"
+#include "sodium/crypto_box_curve25519xsalsa20poly1305.h"
+#include "sodium/crypto_core_hsalsa20.h"
+#include "sodium/crypto_core_salsa20.h"
+#include "sodium/crypto_core_salsa2012.h"
+#include "sodium/crypto_core_salsa208.h"
+#include "sodium/crypto_generichash.h"
+#include "sodium/crypto_generichash_blake2b.h"
+#include "sodium/crypto_hash.h"
+#include "sodium/crypto_hash_sha256.h"
+#include "sodium/crypto_hash_sha512.h"
+#include "sodium/crypto_onetimeauth.h"
+#include "sodium/crypto_onetimeauth_poly1305.h"
+#include "sodium/crypto_pwhash_scryptsalsa208sha256.h"
+#include "sodium/crypto_scalarmult.h"
+#include "sodium/crypto_scalarmult_curve25519.h"
+#include "sodium/crypto_secretbox.h"
+#include "sodium/crypto_secretbox_xsalsa20poly1305.h"
+#include "sodium/crypto_shorthash.h"
+#include "sodium/crypto_shorthash_siphash24.h"
+#include "sodium/crypto_sign.h"
+#include "sodium/crypto_sign_ed25519.h"
+#include "sodium/crypto_stream.h"
+#include "sodium/crypto_stream_aes128ctr.h"
+#include "sodium/crypto_stream_chacha20.h"
+#include "sodium/crypto_stream_salsa20.h"
+#include "sodium/crypto_stream_salsa2012.h"
+#include "sodium/crypto_stream_salsa208.h"
+#include "sodium/crypto_stream_xsalsa20.h"
+#include "sodium/crypto_verify_16.h"
+#include "sodium/crypto_verify_32.h"
+#include "sodium/crypto_verify_64.h"
+#include "sodium/randombytes.h"
+#include "sodium/randombytes_salsa20_random.h"
+#include "sodium/randombytes_sysrandom.h"
+#include "sodium/runtime.h"
+#include "sodium/utils.h"
+#include "sodium/version.h"
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/core.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/core.h
new file mode 100644
index 00000000..7faa983e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/core.h
@@ -0,0 +1,18 @@
+
+#ifndef sodium_core_H
+#define sodium_core_H
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+int sodium_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h
new file mode 100644
index 00000000..b36807c6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h
@@ -0,0 +1,55 @@
+#ifndef crypto_aead_chacha20poly1305_H
+#define crypto_aead_chacha20poly1305_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_aead_chacha20poly1305_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_keybytes(void);
+
+#define crypto_aead_chacha20poly1305_NSECBYTES 0U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_nsecbytes(void);
+
+#define crypto_aead_chacha20poly1305_NPUBBYTES 8U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_npubbytes(void);
+
+#define crypto_aead_chacha20poly1305_ABYTES 16U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_abytes(void);
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
+ unsigned long long *clen,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *ad,
+ unsigned long long adlen,
+ const unsigned char *nsec,
+ const unsigned char *npub,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_decrypt(unsigned char *m,
+ unsigned long long *mlen,
+ unsigned char *nsec,
+ const unsigned char *c,
+ unsigned long long clen,
+ const unsigned char *ad,
+ unsigned long long adlen,
+ const unsigned char *npub,
+ const unsigned char *k);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth.h
new file mode 100644
index 00000000..1c8d22e7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth.h
@@ -0,0 +1,39 @@
+#ifndef crypto_auth_H
+#define crypto_auth_H
+
+#include <stddef.h>
+
+#include "crypto_auth_hmacsha512256.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
+SODIUM_EXPORT
+size_t crypto_auth_bytes(void);
+
+#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
+SODIUM_EXPORT
+size_t crypto_auth_keybytes(void);
+
+#define crypto_auth_PRIMITIVE "hmacsha512256"
+SODIUM_EXPORT
+const char *crypto_auth_primitive(void);
+
+SODIUM_EXPORT
+int crypto_auth(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h
new file mode 100644
index 00000000..6869b56f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h
@@ -0,0 +1,58 @@
+#ifndef crypto_auth_hmacsha256_H
+#define crypto_auth_hmacsha256_H
+
+#include <stddef.h>
+#include "crypto_hash_sha256.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct crypto_auth_hmacsha256_state {
+ crypto_hash_sha256_state ictx;
+ crypto_hash_sha256_state octx;
+} crypto_auth_hmacsha256_state;
+
+#define crypto_auth_hmacsha256_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha256_bytes(void);
+
+#define crypto_auth_hmacsha256_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha256_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256(unsigned char *out,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256_verify(const unsigned char *h,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
+ const unsigned char *key,
+ size_t keylen);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
+ unsigned char *out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h
new file mode 100644
index 00000000..7df1f135
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h
@@ -0,0 +1,58 @@
+#ifndef crypto_auth_hmacsha512_H
+#define crypto_auth_hmacsha512_H
+
+#include <stddef.h>
+#include "crypto_hash_sha512.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct crypto_auth_hmacsha512_state {
+ crypto_hash_sha512_state ictx;
+ crypto_hash_sha512_state octx;
+} crypto_auth_hmacsha512_state;
+
+#define crypto_auth_hmacsha512_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512_bytes(void);
+
+#define crypto_auth_hmacsha512_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512(unsigned char *out,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512_verify(const unsigned char *h,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
+ const unsigned char *key,
+ size_t keylen);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
+ unsigned char *out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h
new file mode 100644
index 00000000..d0064c8d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h
@@ -0,0 +1,53 @@
+#ifndef crypto_auth_hmacsha512256_H
+#define crypto_auth_hmacsha512256_H
+
+#include <stddef.h>
+#include "crypto_auth_hmacsha512.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct crypto_auth_hmacsha512_state crypto_auth_hmacsha512256_state;
+
+#define crypto_auth_hmacsha512256_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512256_bytes(void);
+
+#define crypto_auth_hmacsha512256_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512256_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen,const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256_verify(const unsigned char *h,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
+ const unsigned char *key,
+ size_t keylen);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
+ unsigned char *out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_box.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_box.h
new file mode 100644
index 00000000..8fff2d27
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_box.h
@@ -0,0 +1,142 @@
+#ifndef crypto_box_H
+#define crypto_box_H
+
+/*
+ * THREAD SAFETY: crypto_box_keypair() is thread-safe,
+ * provided that you called sodium_init() once before using any
+ * other libsodium function.
+ * Other functions are always thread-safe.
+ */
+
+#include <stddef.h>
+
+#include "crypto_box_curve25519xsalsa20poly1305.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_box_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
+SODIUM_EXPORT
+size_t crypto_box_seedbytes(void);
+
+#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
+SODIUM_EXPORT
+size_t crypto_box_publickeybytes(void);
+
+#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
+SODIUM_EXPORT
+size_t crypto_box_secretkeybytes(void);
+
+#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
+SODIUM_EXPORT
+size_t crypto_box_noncebytes(void);
+
+#define crypto_box_MACBYTES crypto_box_curve25519xsalsa20poly1305_MACBYTES
+SODIUM_EXPORT
+size_t crypto_box_macbytes(void);
+
+#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
+SODIUM_EXPORT
+const char *crypto_box_primitive(void);
+
+SODIUM_EXPORT
+int crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
+ const unsigned char *seed);
+
+SODIUM_EXPORT
+int crypto_box_keypair(unsigned char *pk, unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_easy(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_open_easy(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_detached(unsigned char *c, unsigned char *mac,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *n, const unsigned char *pk,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_open_detached(unsigned char *m, const unsigned char *c,
+ const unsigned char *mac,
+ unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *pk,
+ const unsigned char *sk);
+
+/* -- Precomputation interface -- */
+
+#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
+SODIUM_EXPORT
+size_t crypto_box_beforenmbytes(void);
+
+SODIUM_EXPORT
+int crypto_box_beforenm(unsigned char *k, const unsigned char *pk,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_easy_afternm(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_box_open_easy_afternm(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_box_detached_afternm(unsigned char *c, unsigned char *mac,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *n, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_box_open_detached_afternm(unsigned char *m, const unsigned char *c,
+ const unsigned char *mac,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k);
+
+/* -- NaCl compatibility interface ; Requires padding -- */
+
+#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
+SODIUM_EXPORT
+size_t crypto_box_zerobytes(void);
+
+#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
+SODIUM_EXPORT
+size_t crypto_box_boxzerobytes(void);
+
+SODIUM_EXPORT
+int crypto_box(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_open(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *pk, const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_afternm(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_box_open_afternm(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h
new file mode 100644
index 00000000..865602fa
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h
@@ -0,0 +1,96 @@
+#ifndef crypto_box_curve25519xsalsa20poly1305_H
+#define crypto_box_curve25519xsalsa20poly1305_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_box_curve25519xsalsa20poly1305_SEEDBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_seedbytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_MACBYTES \
+ (crypto_box_curve25519xsalsa20poly1305_ZEROBYTES - \
+ crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES)
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305(unsigned char *c,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *pk,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
+ const unsigned char *c,
+ unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *pk,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
+ unsigned char *sk,
+ const unsigned char *seed);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
+ unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
+ const unsigned char *pk,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m,
+ const unsigned char *c,
+ unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h
new file mode 100644
index 00000000..82e475b8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h
@@ -0,0 +1,35 @@
+#ifndef crypto_core_hsalsa20_H
+#define crypto_core_hsalsa20_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_hsalsa20_OUTPUTBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_hsalsa20_outputbytes(void);
+
+#define crypto_core_hsalsa20_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_hsalsa20_inputbytes(void);
+
+#define crypto_core_hsalsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_hsalsa20_keybytes(void);
+
+#define crypto_core_hsalsa20_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_hsalsa20_constbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_hsalsa20(unsigned char *out, const unsigned char *in,
+ const unsigned char *k, const unsigned char *c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h
new file mode 100644
index 00000000..160cc56d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h
@@ -0,0 +1,35 @@
+#ifndef crypto_core_salsa20_H
+#define crypto_core_salsa20_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_salsa20_OUTPUTBYTES 64U
+SODIUM_EXPORT
+size_t crypto_core_salsa20_outputbytes(void);
+
+#define crypto_core_salsa20_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa20_inputbytes(void);
+
+#define crypto_core_salsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_salsa20_keybytes(void);
+
+#define crypto_core_salsa20_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa20_constbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_salsa20(unsigned char *out, const unsigned char *in,
+ const unsigned char *k, const unsigned char *c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h
new file mode 100644
index 00000000..bdd5f9fd
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h
@@ -0,0 +1,35 @@
+#ifndef crypto_core_salsa2012_H
+#define crypto_core_salsa2012_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_salsa2012_OUTPUTBYTES 64U
+SODIUM_EXPORT
+size_t crypto_core_salsa2012_outputbytes(void);
+
+#define crypto_core_salsa2012_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa2012_inputbytes(void);
+
+#define crypto_core_salsa2012_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_salsa2012_keybytes(void);
+
+#define crypto_core_salsa2012_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa2012_constbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_salsa2012(unsigned char *out, const unsigned char *in,
+ const unsigned char *k, const unsigned char *c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h
new file mode 100644
index 00000000..3c13efa4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h
@@ -0,0 +1,35 @@
+#ifndef crypto_core_salsa208_H
+#define crypto_core_salsa208_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_salsa208_OUTPUTBYTES 64U
+SODIUM_EXPORT
+size_t crypto_core_salsa208_outputbytes(void);
+
+#define crypto_core_salsa208_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa208_inputbytes(void);
+
+#define crypto_core_salsa208_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_salsa208_keybytes(void);
+
+#define crypto_core_salsa208_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa208_constbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_salsa208(unsigned char *out, const unsigned char *in,
+ const unsigned char *k, const unsigned char *c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_generichash.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_generichash.h
new file mode 100644
index 00000000..851ada42
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_generichash.h
@@ -0,0 +1,69 @@
+#ifndef crypto_generichash_H
+#define crypto_generichash_H
+
+#include <stddef.h>
+
+#include "crypto_generichash_blake2b.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_generichash_BYTES_MIN crypto_generichash_blake2b_BYTES_MIN
+SODIUM_EXPORT
+size_t crypto_generichash_bytes_min(void);
+
+#define crypto_generichash_BYTES_MAX crypto_generichash_blake2b_BYTES_MAX
+SODIUM_EXPORT
+size_t crypto_generichash_bytes_max(void);
+
+#define crypto_generichash_BYTES crypto_generichash_blake2b_BYTES
+SODIUM_EXPORT
+size_t crypto_generichash_bytes(void);
+
+#define crypto_generichash_KEYBYTES_MIN crypto_generichash_blake2b_KEYBYTES_MIN
+SODIUM_EXPORT
+size_t crypto_generichash_keybytes_min(void);
+
+#define crypto_generichash_KEYBYTES_MAX crypto_generichash_blake2b_KEYBYTES_MAX
+SODIUM_EXPORT
+size_t crypto_generichash_keybytes_max(void);
+
+#define crypto_generichash_KEYBYTES crypto_generichash_blake2b_KEYBYTES
+SODIUM_EXPORT
+size_t crypto_generichash_keybytes(void);
+
+#define crypto_generichash_PRIMITIVE "blake2b"
+SODIUM_EXPORT
+const char *crypto_generichash_primitive(void);
+
+typedef crypto_generichash_blake2b_state crypto_generichash_state;
+
+SODIUM_EXPORT
+int crypto_generichash(unsigned char *out, size_t outlen,
+ const unsigned char *in, unsigned long long inlen,
+ const unsigned char *key, size_t keylen);
+
+SODIUM_EXPORT
+int crypto_generichash_init(crypto_generichash_state *state,
+ const unsigned char *key,
+ const size_t keylen, const size_t outlen);
+
+SODIUM_EXPORT
+int crypto_generichash_update(crypto_generichash_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_generichash_final(crypto_generichash_state *state,
+ unsigned char *out, const size_t outlen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h
new file mode 100644
index 00000000..df1771f6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h
@@ -0,0 +1,107 @@
+#ifndef crypto_generichash_blake2b_H
+#define crypto_generichash_blake2b_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "export.h"
+
+#if defined(_MSC_VER)
+# define CRYPTO_ALIGN(x) __declspec(align(x))
+#else
+# define CRYPTO_ALIGN(x) __attribute__((aligned(x)))
+#endif
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#pragma pack(push, 1)
+CRYPTO_ALIGN(64) typedef struct crypto_generichash_blake2b_state {
+ uint64_t h[8];
+ uint64_t t[2];
+ uint64_t f[2];
+ uint8_t buf[2 * 128];
+ size_t buflen;
+ uint8_t last_node;
+} crypto_generichash_blake2b_state;
+#pragma pack(pop)
+
+#define crypto_generichash_blake2b_BYTES_MIN 16U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_bytes_min(void);
+
+#define crypto_generichash_blake2b_BYTES_MAX 64U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_bytes_max(void);
+
+#define crypto_generichash_blake2b_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_bytes(void);
+
+#define crypto_generichash_blake2b_KEYBYTES_MIN 16U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_keybytes_min(void);
+
+#define crypto_generichash_blake2b_KEYBYTES_MAX 64U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_keybytes_max(void);
+
+#define crypto_generichash_blake2b_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_keybytes(void);
+
+#define crypto_generichash_blake2b_SALTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_saltbytes(void);
+
+#define crypto_generichash_blake2b_PERSONALBYTES 16U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_personalbytes(void);
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b(unsigned char *out, size_t outlen,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *key, size_t keylen);
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_salt_personal(unsigned char *out, size_t outlen,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *key,
+ size_t keylen,
+ const unsigned char *salt,
+ const unsigned char *personal);
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
+ const unsigned char *key,
+ const size_t keylen, const size_t outlen);
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state *state,
+ const unsigned char *key,
+ const size_t keylen, const size_t outlen,
+ const unsigned char *salt,
+ const unsigned char *personal);
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
+ unsigned char *out,
+ const size_t outlen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash.h
new file mode 100644
index 00000000..d455bd51
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash.h
@@ -0,0 +1,39 @@
+#ifndef crypto_hash_H
+#define crypto_hash_H
+
+/*
+ * WARNING: Unless you absolutely need to use SHA512 for interoperatibility,
+ * purposes, you might want to consider crypto_generichash() instead.
+ * Unlike SHA512, crypto_generichash() is not vulnerable to length
+ * extension attacks.
+ */
+
+#include <stddef.h>
+
+#include "crypto_hash_sha512.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_hash_BYTES crypto_hash_sha512_BYTES
+SODIUM_EXPORT
+size_t crypto_hash_bytes(void);
+
+SODIUM_EXPORT
+int crypto_hash(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen);
+
+#define crypto_hash_PRIMITIVE "sha512"
+SODIUM_EXPORT
+const char *crypto_hash_primitive(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h
new file mode 100644
index 00000000..449ddf22
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h
@@ -0,0 +1,54 @@
+#ifndef crypto_hash_sha256_H
+#define crypto_hash_sha256_H
+
+/*
+ * WARNING: Unless you absolutely need to use SHA256 for interoperatibility,
+ * purposes, you might want to consider crypto_generichash() instead.
+ * Unlike SHA256, crypto_generichash() is not vulnerable to length
+ * extension attacks.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct crypto_hash_sha256_state {
+ uint32_t state[8];
+ uint32_t count[2];
+ unsigned char buf[64];
+} crypto_hash_sha256_state;
+
+#define crypto_hash_sha256_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_hash_sha256_bytes(void);
+
+SODIUM_EXPORT
+int crypto_hash_sha256(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_hash_sha256_init(crypto_hash_sha256_state *state);
+
+SODIUM_EXPORT
+int crypto_hash_sha256_update(crypto_hash_sha256_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_hash_sha256_final(crypto_hash_sha256_state *state,
+ unsigned char *out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h
new file mode 100644
index 00000000..e8ef2e36
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h
@@ -0,0 +1,54 @@
+#ifndef crypto_hash_sha512_H
+#define crypto_hash_sha512_H
+
+/*
+ * WARNING: Unless you absolutely need to use SHA512 for interoperatibility,
+ * purposes, you might want to consider crypto_generichash() instead.
+ * Unlike SHA512, crypto_generichash() is not vulnerable to length
+ * extension attacks.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct crypto_hash_sha512_state {
+ uint64_t state[8];
+ uint64_t count[2];
+ unsigned char buf[128];
+} crypto_hash_sha512_state;
+
+#define crypto_hash_sha512_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_hash_sha512_bytes(void);
+
+SODIUM_EXPORT
+int crypto_hash_sha512(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_hash_sha512_init(crypto_hash_sha512_state *state);
+
+SODIUM_EXPORT
+int crypto_hash_sha512_update(crypto_hash_sha512_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_hash_sha512_final(crypto_hash_sha512_state *state,
+ unsigned char *out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_int32.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_int32.h
new file mode 100644
index 00000000..a22019d8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_int32.h
@@ -0,0 +1,8 @@
+#ifndef crypto_int32_H
+#define crypto_int32_H
+
+#include <stdint.h>
+
+typedef int32_t crypto_int32;
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_int64.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_int64.h
new file mode 100644
index 00000000..f68a2836
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_int64.h
@@ -0,0 +1,8 @@
+#ifndef crypto_int64_H
+#define crypto_int64_H
+
+#include <stdint.h>
+
+typedef int64_t crypto_int64;
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h
new file mode 100644
index 00000000..02d41a9e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h
@@ -0,0 +1,55 @@
+#ifndef crypto_onetimeauth_H
+#define crypto_onetimeauth_H
+
+#include <stddef.h>
+
+#include "crypto_onetimeauth_poly1305.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef crypto_onetimeauth_poly1305_state crypto_onetimeauth_state;
+
+#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES
+SODIUM_EXPORT
+size_t crypto_onetimeauth_bytes(void);
+
+#define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES
+SODIUM_EXPORT
+size_t crypto_onetimeauth_keybytes(void);
+
+#define crypto_onetimeauth_PRIMITIVE "poly1305"
+SODIUM_EXPORT
+const char *crypto_onetimeauth_primitive(void);
+
+SODIUM_EXPORT
+int crypto_onetimeauth(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_init(crypto_onetimeauth_state *state,
+ const unsigned char *key);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_update(crypto_onetimeauth_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_final(crypto_onetimeauth_state *state,
+ unsigned char *out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h
new file mode 100644
index 00000000..fb6eb499
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h
@@ -0,0 +1,89 @@
+#ifndef crypto_onetimeauth_poly1305_H
+#define crypto_onetimeauth_poly1305_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+#include <stdint.h>
+#include <stdio.h>
+
+typedef struct crypto_onetimeauth_poly1305_state {
+ unsigned long long aligner;
+ unsigned char opaque[136];
+} crypto_onetimeauth_poly1305_state;
+
+typedef struct crypto_onetimeauth_poly1305_implementation {
+ const char *(*implementation_name)(void);
+ int (*onetimeauth)(unsigned char *out,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+ int (*onetimeauth_verify)(const unsigned char *h,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+ int (*onetimeauth_init)(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *key);
+ int (*onetimeauth_update)(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+ int (*onetimeauth_final)(crypto_onetimeauth_poly1305_state *state,
+ unsigned char *out);
+} crypto_onetimeauth_poly1305_implementation;
+
+#define crypto_onetimeauth_poly1305_BYTES 16U
+SODIUM_EXPORT
+size_t crypto_onetimeauth_poly1305_bytes(void);
+
+#define crypto_onetimeauth_poly1305_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_onetimeauth_poly1305_keybytes(void);
+
+SODIUM_EXPORT
+const char *crypto_onetimeauth_poly1305_implementation_name(void);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_set_implementation(crypto_onetimeauth_poly1305_implementation *impl);
+
+crypto_onetimeauth_poly1305_implementation *
+crypto_onetimeauth_pick_best_implementation(void);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305(unsigned char *out,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_verify(const unsigned char *h,
+ const unsigned char *in,
+ unsigned long long inlen,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *key);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
+ const unsigned char *in,
+ unsigned long long inlen);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
+ unsigned char *out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h
new file mode 100644
index 00000000..0d98e0b2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h
@@ -0,0 +1,75 @@
+#ifndef crypto_pwhash_scryptsalsa208sha256_H
+#define crypto_pwhash_scryptsalsa208sha256_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_STRPREFIX "$7$"
+SODIUM_EXPORT
+const char *crypto_pwhash_scryptsalsa208sha256_strprefix(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288ULL
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216ULL
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432ULL
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824ULL
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void);
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
+ unsigned long long outlen,
+ const char * const passwd,
+ unsigned long long passwdlen,
+ const unsigned char * const salt,
+ unsigned long long opslimit,
+ size_t memlimit);
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
+ const char * const passwd,
+ unsigned long long passwdlen,
+ unsigned long long opslimit,
+ size_t memlimit);
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
+ const char * const passwd,
+ unsigned long long passwdlen);
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
+ const uint8_t * salt, size_t saltlen,
+ uint64_t N, uint32_t r, uint32_t p,
+ uint8_t * buf, size_t buflen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h
new file mode 100644
index 00000000..3d59b3a2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h
@@ -0,0 +1,36 @@
+#ifndef crypto_scalarmult_H
+#define crypto_scalarmult_H
+
+#include <stddef.h>
+
+#include "crypto_scalarmult_curve25519.h"
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES
+SODIUM_EXPORT
+size_t crypto_scalarmult_bytes(void);
+
+#define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES
+SODIUM_EXPORT
+size_t crypto_scalarmult_scalarbytes(void);
+
+#define crypto_scalarmult_PRIMITIVE "curve25519"
+SODIUM_EXPORT
+const char *crypto_scalarmult_primitive(void);
+
+SODIUM_EXPORT
+int crypto_scalarmult_base(unsigned char *q, const unsigned char *n);
+
+SODIUM_EXPORT
+int crypto_scalarmult(unsigned char *q, const unsigned char *n,
+ const unsigned char *p);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h
new file mode 100644
index 00000000..c75d2242
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h
@@ -0,0 +1,31 @@
+#ifndef crypto_scalarmult_curve25519_H
+#define crypto_scalarmult_curve25519_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_scalarmult_curve25519_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_scalarmult_curve25519_bytes(void);
+
+#define crypto_scalarmult_curve25519_SCALARBYTES 32U
+SODIUM_EXPORT
+size_t crypto_scalarmult_curve25519_scalarbytes(void);
+
+SODIUM_EXPORT
+int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
+ const unsigned char *p);
+
+SODIUM_EXPORT
+int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_secretbox.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_secretbox.h
new file mode 100644
index 00000000..e0d6969e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_secretbox.h
@@ -0,0 +1,80 @@
+#ifndef crypto_secretbox_H
+#define crypto_secretbox_H
+
+#include <stddef.h>
+
+#include "crypto_secretbox_xsalsa20poly1305.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES
+SODIUM_EXPORT
+size_t crypto_secretbox_keybytes(void);
+
+#define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES
+SODIUM_EXPORT
+size_t crypto_secretbox_noncebytes(void);
+
+#define crypto_secretbox_MACBYTES crypto_secretbox_xsalsa20poly1305_MACBYTES
+SODIUM_EXPORT
+size_t crypto_secretbox_macbytes(void);
+
+#define crypto_secretbox_PRIMITIVE "xsalsa20poly1305"
+SODIUM_EXPORT
+const char *crypto_secretbox_primitive(void);
+
+SODIUM_EXPORT
+int crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_secretbox_open_detached(unsigned char *m,
+ const unsigned char *c,
+ const unsigned char *mac,
+ unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k);
+
+/* -- NaCl compatibility interface ; Requires padding -- */
+
+#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES
+SODIUM_EXPORT
+size_t crypto_secretbox_zerobytes(void);
+
+#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
+SODIUM_EXPORT
+size_t crypto_secretbox_boxzerobytes(void);
+
+SODIUM_EXPORT
+int crypto_secretbox(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_secretbox_open(unsigned char *m, const unsigned char *c,
+ unsigned long long clen, const unsigned char *n,
+ const unsigned char *k);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h
new file mode 100644
index 00000000..4afc2cdf
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h
@@ -0,0 +1,54 @@
+#ifndef crypto_secretbox_xsalsa20poly1305_H
+#define crypto_secretbox_xsalsa20poly1305_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_secretbox_xsalsa20poly1305_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_keybytes(void);
+
+#define crypto_secretbox_xsalsa20poly1305_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void);
+
+#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES 32U
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void);
+
+#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void);
+
+#define crypto_secretbox_xsalsa20poly1305_MACBYTES \
+ (crypto_secretbox_xsalsa20poly1305_ZEROBYTES - \
+ crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES)
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_macbytes(void);
+
+SODIUM_EXPORT
+int crypto_secretbox_xsalsa20poly1305(unsigned char *c,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_secretbox_xsalsa20poly1305_open(unsigned char *m,
+ const unsigned char *c,
+ unsigned long long clen,
+ const unsigned char *n,
+ const unsigned char *k);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_shorthash.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_shorthash.h
new file mode 100644
index 00000000..5458b9c3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_shorthash.h
@@ -0,0 +1,36 @@
+#ifndef crypto_shorthash_H
+#define crypto_shorthash_H
+
+#include <stddef.h>
+
+#include "crypto_shorthash_siphash24.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES
+SODIUM_EXPORT
+size_t crypto_shorthash_bytes(void);
+
+#define crypto_shorthash_KEYBYTES crypto_shorthash_siphash24_KEYBYTES
+SODIUM_EXPORT
+size_t crypto_shorthash_keybytes(void);
+
+#define crypto_shorthash_PRIMITIVE "siphash24"
+SODIUM_EXPORT
+const char *crypto_shorthash_primitive(void);
+
+SODIUM_EXPORT
+int crypto_shorthash(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h
new file mode 100644
index 00000000..a2cab0c1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h
@@ -0,0 +1,30 @@
+#ifndef crypto_shorthash_siphash24_H
+#define crypto_shorthash_siphash24_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_shorthash_siphash24_BYTES 8U
+SODIUM_EXPORT
+size_t crypto_shorthash_siphash24_bytes(void);
+
+#define crypto_shorthash_siphash24_KEYBYTES 16U
+SODIUM_EXPORT
+size_t crypto_shorthash_siphash24_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *k);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign.h
new file mode 100644
index 00000000..8b854d37
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign.h
@@ -0,0 +1,74 @@
+#ifndef crypto_sign_H
+#define crypto_sign_H
+
+/*
+ * THREAD SAFETY: crypto_sign_keypair() is thread-safe,
+ * provided that you called sodium_init() once before using any
+ * other libsodium function.
+ * Other functions, including crypto_sign_seed_keypair() are always thread-safe.
+ */
+
+#include <stddef.h>
+
+#include "crypto_sign_ed25519.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_sign_BYTES crypto_sign_ed25519_BYTES
+SODIUM_EXPORT
+size_t crypto_sign_bytes(void);
+
+#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES
+SODIUM_EXPORT
+size_t crypto_sign_seedbytes(void);
+
+#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
+SODIUM_EXPORT
+size_t crypto_sign_publickeybytes(void);
+
+#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
+SODIUM_EXPORT
+size_t crypto_sign_secretkeybytes(void);
+
+#define crypto_sign_PRIMITIVE "ed25519"
+SODIUM_EXPORT
+const char *crypto_sign_primitive(void);
+
+SODIUM_EXPORT
+int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
+ const unsigned char *seed);
+
+SODIUM_EXPORT
+int crypto_sign_keypair(unsigned char *pk, unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_sign(unsigned char *sm, unsigned long long *smlen_p,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
+ const unsigned char *sm, unsigned long long smlen,
+ const unsigned char *pk);
+
+SODIUM_EXPORT
+int crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_sign_verify_detached(const unsigned char *sig,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *pk);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h
new file mode 100644
index 00000000..5238c2a2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h
@@ -0,0 +1,79 @@
+#ifndef crypto_sign_ed25519_H
+#define crypto_sign_ed25519_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_sign_ed25519_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_bytes(void);
+
+#define crypto_sign_ed25519_SEEDBYTES 32U
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_seedbytes(void);
+
+#define crypto_sign_ed25519_PUBLICKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_publickeybytes(void);
+
+#define crypto_sign_ed25519_SECRETKEYBYTES (32U + 32U)
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_secretkeybytes(void);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
+ const unsigned char *m, unsigned long long mlen,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p,
+ const unsigned char *sm, unsigned long long smlen,
+ const unsigned char *pk);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_detached(unsigned char *sig,
+ unsigned long long *siglen_p,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_verify_detached(const unsigned char *sig,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *pk);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
+ const unsigned char *seed);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk,
+ const unsigned char *ed25519_pk);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
+ const unsigned char *ed25519_sk);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_sk_to_seed(unsigned char *seed,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h
new file mode 100644
index 00000000..01b4f2ea
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h
@@ -0,0 +1,59 @@
+#ifndef crypto_sign_edwards25519sha512batch_H
+#define crypto_sign_edwards25519sha512batch_H
+
+/*
+ * WARNING: This construction was a prototype, which should not be used
+ * any more in new projects.
+ *
+ * crypto_sign_edwards25519sha512batch is provided for applications
+ * initially built with NaCl, but as recommended by the author of this
+ * construction, new applications should use ed25519 instead.
+ *
+ * In Sodium, you should use the high-level crypto_sign_*() functions instead.
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_sign_edwards25519sha512batch_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_sign_edwards25519sha512batch_bytes(void);
+
+#define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_sign_edwards25519sha512batch_publickeybytes(void);
+
+#define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U)
+SODIUM_EXPORT
+size_t crypto_sign_edwards25519sha512batch_secretkeybytes(void);
+
+SODIUM_EXPORT
+int crypto_sign_edwards25519sha512batch(unsigned char *sm,
+ unsigned long long *smlen_p,
+ const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *sk);
+
+SODIUM_EXPORT
+int crypto_sign_edwards25519sha512batch_open(unsigned char *m,
+ unsigned long long *mlen_p,
+ const unsigned char *sm,
+ unsigned long long smlen,
+ const unsigned char *pk);
+
+SODIUM_EXPORT
+int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk,
+ unsigned char *sk);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream.h
new file mode 100644
index 00000000..b0c6c41a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream.h
@@ -0,0 +1,49 @@
+#ifndef crypto_stream_H
+#define crypto_stream_H
+
+/*
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ * While it provides some protection against eavesdropping, it does NOT
+ * provide any security against active attacks.
+ * Unless you know what you're doing, what you are looking for is probably
+ * the crypto_box functions.
+ */
+
+#include <stddef.h>
+
+#include "crypto_stream_xsalsa20.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES
+SODIUM_EXPORT
+size_t crypto_stream_keybytes(void);
+
+#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES
+SODIUM_EXPORT
+size_t crypto_stream_noncebytes(void);
+
+#define crypto_stream_PRIMITIVE "xsalsa20"
+SODIUM_EXPORT
+const char *crypto_stream_primitive(void);
+
+SODIUM_EXPORT
+int crypto_stream(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h
new file mode 100644
index 00000000..29133196
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h
@@ -0,0 +1,60 @@
+#ifndef crypto_stream_aes128ctr_H
+#define crypto_stream_aes128ctr_H
+
+/*
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ * While it provides some protection against eavesdropping, it does NOT
+ * provide any security against active attacks.
+ * Unless you know what you're doing, what you are looking for is probably
+ * the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_aes128ctr_KEYBYTES 16U
+SODIUM_EXPORT
+size_t crypto_stream_aes128ctr_keybytes(void);
+
+#define crypto_stream_aes128ctr_NONCEBYTES 16U
+SODIUM_EXPORT
+size_t crypto_stream_aes128ctr_noncebytes(void);
+
+#define crypto_stream_aes128ctr_BEFORENMBYTES 1408U
+SODIUM_EXPORT
+size_t crypto_stream_aes128ctr_beforenmbytes(void);
+
+SODIUM_EXPORT
+int crypto_stream_aes128ctr(unsigned char *out, unsigned long long outlen,
+ const unsigned char *n, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_aes128ctr_xor(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_aes128ctr_beforenm(unsigned char *c, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_aes128ctr_afternm(unsigned char *out, unsigned long long len,
+ const unsigned char *nonce, const unsigned char *c);
+
+SODIUM_EXPORT
+int crypto_stream_aes128ctr_xor_afternm(unsigned char *out, const unsigned char *in,
+ unsigned long long len,
+ const unsigned char *nonce,
+ const unsigned char *c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h
new file mode 100644
index 00000000..6b577fcc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h
@@ -0,0 +1,49 @@
+#ifndef crypto_stream_chacha20_H
+#define crypto_stream_chacha20_H
+
+/*
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ * While it provides some protection against eavesdropping, it does NOT
+ * provide any security against active attacks.
+ * Unless you know what you're doing, what you are looking for is probably
+ * the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_chacha20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_chacha20_keybytes(void);
+
+#define crypto_stream_chacha20_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_chacha20_noncebytes(void);
+
+SODIUM_EXPORT
+int crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint64_t ic,
+ const unsigned char *k);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h
new file mode 100644
index 00000000..1c06512b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h
@@ -0,0 +1,49 @@
+#ifndef crypto_stream_salsa20_H
+#define crypto_stream_salsa20_H
+
+/*
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ * While it provides some protection against eavesdropping, it does NOT
+ * provide any security against active attacks.
+ * Unless you know what you're doing, what you are looking for is probably
+ * the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_salsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_salsa20_keybytes(void);
+
+#define crypto_stream_salsa20_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_salsa20_noncebytes(void);
+
+SODIUM_EXPORT
+int crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen,
+ const unsigned char *n, uint64_t ic,
+ const unsigned char *k);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h
new file mode 100644
index 00000000..6fcf436f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h
@@ -0,0 +1,43 @@
+#ifndef crypto_stream_salsa2012_H
+#define crypto_stream_salsa2012_H
+
+/*
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ * While it provides some protection against eavesdropping, it does NOT
+ * provide any security against active attacks.
+ * Unless you know what you're doing, what you are looking for is probably
+ * the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_salsa2012_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_salsa2012_keybytes(void);
+
+#define crypto_stream_salsa2012_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_salsa2012_noncebytes(void);
+
+SODIUM_EXPORT
+int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_salsa2012_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h
new file mode 100644
index 00000000..a8fd2cef
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h
@@ -0,0 +1,43 @@
+#ifndef crypto_stream_salsa208_H
+#define crypto_stream_salsa208_H
+
+/*
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ * While it provides some protection against eavesdropping, it does NOT
+ * provide any security against active attacks.
+ * Unless you know what you're doing, what you are looking for is probably
+ * the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_salsa208_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_salsa208_keybytes(void);
+
+#define crypto_stream_salsa208_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_salsa208_noncebytes(void);
+
+SODIUM_EXPORT
+int crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h
new file mode 100644
index 00000000..f7ea1449
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h
@@ -0,0 +1,43 @@
+#ifndef crypto_stream_xsalsa20_H
+#define crypto_stream_xsalsa20_H
+
+/*
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ * While it provides some protection against eavesdropping, it does NOT
+ * provide any security against active attacks.
+ * Unless you know what you're doing, what you are looking for is probably
+ * the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_xsalsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_xsalsa20_keybytes(void);
+
+#define crypto_stream_xsalsa20_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_stream_xsalsa20_noncebytes(void);
+
+SODIUM_EXPORT
+int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen,
+ const unsigned char *n, const unsigned char *k);
+
+SODIUM_EXPORT
+int crypto_stream_xsalsa20_xor(unsigned char *c, const unsigned char *m,
+ unsigned long long mlen, const unsigned char *n,
+ const unsigned char *k);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint16.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint16.h
new file mode 100644
index 00000000..6be4e347
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint16.h
@@ -0,0 +1,8 @@
+#ifndef crypto_uint16_H
+#define crypto_uint16_H
+
+#include <stdint.h>
+
+typedef uint16_t crypto_uint16;
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint32.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint32.h
new file mode 100644
index 00000000..ba66cecc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint32.h
@@ -0,0 +1,8 @@
+#ifndef crypto_uint32_H
+#define crypto_uint32_H
+
+#include <stdint.h>
+
+typedef uint32_t crypto_uint32;
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint64.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint64.h
new file mode 100644
index 00000000..98b3f6d3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint64.h
@@ -0,0 +1,8 @@
+#ifndef crypto_uint64_H
+#define crypto_uint64_H
+
+#include <stdint.h>
+
+typedef uint64_t crypto_uint64;
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint8.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint8.h
new file mode 100644
index 00000000..789613ba
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_uint8.h
@@ -0,0 +1,8 @@
+#ifndef crypto_uint8_H
+#define crypto_uint8_H
+
+#include <stdint.h>
+
+typedef uint8_t crypto_uint8;
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_16.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_16.h
new file mode 100644
index 00000000..7370b15f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_16.h
@@ -0,0 +1,22 @@
+#ifndef crypto_verify_16_H
+#define crypto_verify_16_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_verify_16_BYTES 16U
+SODIUM_EXPORT
+size_t crypto_verify_16_bytes(void);
+
+SODIUM_EXPORT
+int crypto_verify_16(const unsigned char *x, const unsigned char *y);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_32.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_32.h
new file mode 100644
index 00000000..58e4d0e8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_32.h
@@ -0,0 +1,22 @@
+#ifndef crypto_verify_32_H
+#define crypto_verify_32_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_verify_32_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_verify_32_bytes(void);
+
+SODIUM_EXPORT
+int crypto_verify_32(const unsigned char *x, const unsigned char *y);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_64.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_64.h
new file mode 100644
index 00000000..7ed9c89f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/crypto_verify_64.h
@@ -0,0 +1,22 @@
+#ifndef crypto_verify_64_H
+#define crypto_verify_64_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_verify_64_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_verify_64_bytes(void);
+
+SODIUM_EXPORT
+int crypto_verify_64(const unsigned char *x, const unsigned char *y);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/export.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/export.h
new file mode 100644
index 00000000..53fcd7b5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/export.h
@@ -0,0 +1,32 @@
+
+#ifndef sodium_export_H
+#define sodium_export_H
+
+#ifndef __GNUC__
+# ifdef __attribute__
+# undef __attribute__
+# endif
+# define __attribute__(a)
+#endif
+
+#ifdef SODIUM_STATIC
+# define SODIUM_EXPORT
+#else
+# if defined(_MSC_VER)
+# ifdef SODIUM_DLL_EXPORT
+# define SODIUM_EXPORT __declspec(dllexport)
+# else
+# define SODIUM_EXPORT __declspec(dllimport)
+# endif
+# else
+# if defined(__SUNPRO_C)
+# define SODIUM_EXPORT __attribute__ __global
+# elif defined(_MSG_VER)
+# define SODIUM_EXPORT extern __declspec(dllexport)
+# else
+# define SODIUM_EXPORT __attribute__ ((visibility ("default")))
+# endif
+# endif
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes.h
new file mode 100644
index 00000000..d92c1a4d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes.h
@@ -0,0 +1,58 @@
+
+#ifndef randombytes_H
+#define randombytes_H
+
+#include <sys/types.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct randombytes_implementation {
+ const char *(*implementation_name)(void);
+ uint32_t (*random)(void);
+ void (*stir)(void);
+ uint32_t (*uniform)(const uint32_t upper_bound);
+ void (*buf)(void * const buf, const size_t size);
+ int (*close)(void);
+} randombytes_implementation;
+
+SODIUM_EXPORT
+void randombytes_buf(void * const buf, const size_t size);
+
+SODIUM_EXPORT
+uint32_t randombytes_random(void);
+
+SODIUM_EXPORT
+uint32_t randombytes_uniform(const uint32_t upper_bound);
+
+SODIUM_EXPORT
+void randombytes_stir(void);
+
+SODIUM_EXPORT
+int randombytes_close(void);
+
+SODIUM_EXPORT
+int randombytes_set_implementation(randombytes_implementation *impl);
+
+SODIUM_EXPORT
+const char *randombytes_implementation_name(void);
+
+/* -- NaCl compatibility interface -- */
+
+SODIUM_EXPORT
+void randombytes(unsigned char * const buf, const unsigned long long buf_len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h
new file mode 100644
index 00000000..46d38c54
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h
@@ -0,0 +1,45 @@
+
+#ifndef randombytes_salsa20_random_H
+#define randombytes_salsa20_random_H
+
+/*
+ * THREAD SAFETY: randombytes_salsa20_random*() functions are
+ * fork()-safe but not thread-safe.
+ * Always wrap them in a mutex if you need thread safety.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+extern struct randombytes_implementation randombytes_salsa20_implementation;
+
+SODIUM_EXPORT
+const char *randombytes_salsa20_implementation_name(void);
+
+SODIUM_EXPORT
+uint32_t randombytes_salsa20_random(void);
+
+SODIUM_EXPORT
+void randombytes_salsa20_random_stir(void);
+
+SODIUM_EXPORT
+uint32_t randombytes_salsa20_random_uniform(const uint32_t upper_bound);
+
+SODIUM_EXPORT
+void randombytes_salsa20_random_buf(void * const buf, const size_t size);
+
+SODIUM_EXPORT
+int randombytes_salsa20_random_close(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h
new file mode 100644
index 00000000..20dab781
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h
@@ -0,0 +1,45 @@
+
+#ifndef randombytes_sysrandom_H
+#define randombytes_sysrandom_H
+
+/*
+ * THREAD SAFETY: randombytes_sysrandom() functions are thread-safe,
+ * provided that you called sodium_init() once before using any
+ * other libsodium function.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+extern struct randombytes_implementation randombytes_sysrandom_implementation;
+
+SODIUM_EXPORT
+const char *randombytes_sysrandom_implementation_name(void);
+
+SODIUM_EXPORT
+uint32_t randombytes_sysrandom(void);
+
+SODIUM_EXPORT
+void randombytes_sysrandom_stir(void);
+
+SODIUM_EXPORT
+uint32_t randombytes_sysrandom_uniform(const uint32_t upper_bound);
+
+SODIUM_EXPORT
+void randombytes_sysrandom_buf(void * const buf, const size_t size);
+
+SODIUM_EXPORT
+int randombytes_sysrandom_close(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/runtime.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/runtime.h
new file mode 100644
index 00000000..50226ae1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/runtime.h
@@ -0,0 +1,27 @@
+
+#ifndef sodium_runtime_H
+#define sodium_runtime_H
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+int sodium_runtime_get_cpu_features(void);
+
+SODIUM_EXPORT
+int sodium_runtime_has_neon(void);
+
+SODIUM_EXPORT
+int sodium_runtime_has_sse2(void);
+
+SODIUM_EXPORT
+int sodium_runtime_has_sse3(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/utils.h b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/utils.h
new file mode 100644
index 00000000..3b1502a4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/utils.h
@@ -0,0 +1,106 @@
+
+#ifndef sodium_utils_H
+#define sodium_utils_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
+# define SODIUM_C99(X)
+#else
+# define SODIUM_C99(X) X
+#endif
+
+SODIUM_EXPORT
+void sodium_memzero(void * const pnt, const size_t len);
+
+/* WARNING: sodium_memcmp() must be used to verify if two secret keys
+ * are equal, in constant time.
+ * It returns 0 if the keys are equal, and -1 if they differ.
+ * This function is not designed for lexicographical comparisons.
+ */
+SODIUM_EXPORT
+int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len);
+
+SODIUM_EXPORT
+char *sodium_bin2hex(char * const hex, const size_t hex_maxlen,
+ const unsigned char * const bin, const size_t bin_len);
+
+SODIUM_EXPORT
+int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen,
+ const char * const hex, const size_t hex_len,
+ const char * const ignore, size_t * const bin_len,
+ const char ** const hex_end);
+
+SODIUM_EXPORT
+int sodium_mlock(void * const addr, const size_t len);
+
+SODIUM_EXPORT
+int sodium_munlock(void * const addr, const size_t len);
+
+/* WARNING: sodium_malloc() and sodium_allocarray() are not general-purpose
+ * allocation functions.
+ *
+ * They return a pointer to a region filled with 0xd0 bytes, immediately
+ * followed by a guard page.
+ * As a result, accessing a single byte after the requested allocation size
+ * will intentionally trigger a segmentation fault.
+ *
+ * A canary and an additional guard page placed before the beginning of the
+ * region may also kill the process if a buffer underflow is detected.
+ *
+ * The memory layout is:
+ * [unprotected region size (read only)][guard page (no access)][unprotected pages (read/write)][guard page (no access)]
+ * With the layout of the unprotected pages being:
+ * [optional padding][16-bytes canary][user region]
+ *
+ * However:
+ * - These functions are significantly slower than standard functions
+ * - Each allocation requires 3 or 4 additional pages
+ * - The returned address will not be aligned if the allocation size is not
+ * a multiple of the required alignment. For this reason, these functions
+ * are designed to store data, such as secret keys and messages.
+ *
+ * sodium_malloc() can be used to allocate any libsodium data structure,
+ * with the exception of crypto_generichash_state.
+ *
+ * The crypto_generichash_state structure is packed and its length is
+ * either 357 or 361 bytes. For this reason, when using sodium_malloc() to
+ * allocate a crypto_generichash_state structure, padding must be added in
+ * order to ensure proper alignment:
+ * state = sodium_malloc((sizeof(crypto_generichash_state)
+ * + (size_t) 63U) & ~(size_t) 63U);
+ */
+
+SODIUM_EXPORT
+void *sodium_malloc(const size_t size);
+
+SODIUM_EXPORT
+void *sodium_allocarray(size_t count, size_t size);
+
+SODIUM_EXPORT
+void sodium_free(void *ptr);
+
+SODIUM_EXPORT
+int sodium_mprotect_noaccess(void *ptr);
+
+SODIUM_EXPORT
+int sodium_mprotect_readonly(void *ptr);
+
+SODIUM_EXPORT
+int sodium_mprotect_readwrite(void *ptr);
+
+/* -------- */
+
+int _sodium_alloc_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/version.h.in b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/version.h.in
new file mode 100644
index 00000000..ef230efc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/include/sodium/version.h.in
@@ -0,0 +1,29 @@
+
+#ifndef sodium_version_H
+#define sodium_version_H
+
+#include "export.h"
+
+#define SODIUM_VERSION_STRING "@VERSION@"
+
+#define SODIUM_LIBRARY_VERSION_MAJOR @SODIUM_LIBRARY_VERSION_MAJOR@
+#define SODIUM_LIBRARY_VERSION_MINOR @SODIUM_LIBRARY_VERSION_MINOR@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+const char *sodium_version_string(void);
+
+SODIUM_EXPORT
+int sodium_library_version_major(void);
+
+SODIUM_EXPORT
+int sodium_library_version_minor(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c
new file mode 100644
index 00000000..07e23410
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/randombytes.c
@@ -0,0 +1,65 @@
+
+#include <sys/types.h>
+
+#include <assert.h>
+#include <limits.h>
+#include <stdint.h>
+
+#include "randombytes.h"
+#include "randombytes_sysrandom.h"
+
+static const randombytes_implementation *implementation =
+ &randombytes_sysrandom_implementation;
+
+int
+randombytes_set_implementation(randombytes_implementation *impl)
+{
+ implementation = impl;
+
+ return 0;
+}
+
+const char *
+randombytes_implementation_name(void)
+{
+ return implementation->implementation_name();
+}
+
+uint32_t
+randombytes_random(void)
+{
+ return implementation->random();
+}
+
+void
+randombytes_stir(void)
+{
+ implementation->stir();
+}
+
+uint32_t
+randombytes_uniform(const uint32_t upper_bound)
+{
+ return implementation->uniform(upper_bound);
+}
+
+void
+randombytes_buf(void * const buf, const size_t size)
+{
+ if (size > (size_t) 0U) {
+ implementation->buf(buf, size);
+ }
+}
+
+int
+randombytes_close(void)
+{
+ return implementation->close();
+}
+
+void
+randombytes(unsigned char * const buf, const unsigned long long buf_len)
+{
+ assert(buf_len <= SIZE_MAX);
+ randombytes_buf(buf, (size_t) buf_len);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c
new file mode 100644
index 00000000..3d7627d2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c
@@ -0,0 +1,351 @@
+
+#include <sys/types.h>
+#ifndef _WIN32
+# include <sys/stat.h>
+# include <sys/time.h>
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef _MSC_VER
+# include <unistd.h>
+#endif
+
+#include "crypto_core_salsa20.h"
+#include "crypto_auth_hmacsha512256.h"
+#include "crypto_stream_salsa20.h"
+#include "randombytes.h"
+#include "randombytes_salsa20_random.h"
+#include "utils.h"
+
+#ifdef _WIN32
+# include <windows.h>
+# include <sys/timeb.h>
+# define RtlGenRandom SystemFunction036
+# if defined(__cplusplus)
+extern "C"
+# endif
+BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
+# pragma comment(lib, "advapi32.lib")
+#endif
+
+#define SALSA20_RANDOM_BLOCK_SIZE crypto_core_salsa20_OUTPUTBYTES
+#define SHA512_BLOCK_SIZE 128U
+#define SHA512_MIN_PAD_SIZE (1U + 16U)
+#define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1])
+
+typedef struct Salsa20Random_ {
+ unsigned char key[crypto_stream_salsa20_KEYBYTES];
+ unsigned char rnd32[16U * SALSA20_RANDOM_BLOCK_SIZE];
+ uint64_t nonce;
+ size_t rnd32_outleft;
+#ifndef _MSC_VER
+ pid_t pid;
+#endif
+ int random_data_source_fd;
+ int initialized;
+} Salsa20Random;
+
+static Salsa20Random stream = {
+ SODIUM_C99(.random_data_source_fd =) -1,
+ SODIUM_C99(.rnd32_outleft =) (size_t) 0U,
+ SODIUM_C99(.initialized =) 0
+};
+
+static uint64_t
+sodium_hrtime(void)
+{
+ struct timeval tv;
+ uint64_t ts = (uint64_t) 0U;
+ int ret;
+
+#ifdef _WIN32
+ struct _timeb tb;
+
+# pragma warning(push)
+# pragma warning(disable: 4996)
+ _ftime(&tb);
+# pragma warning(pop)
+ tv.tv_sec = (long) tb.time;
+ tv.tv_usec = ((int) tb.millitm) * 1000;
+ ret = 0;
+#else
+ ret = gettimeofday(&tv, NULL);
+#endif
+ assert(ret == 0);
+ if (ret == 0) {
+ ts = (uint64_t) tv.tv_sec * 1000000U + (uint64_t) tv.tv_usec;
+ }
+ return ts;
+}
+
+#ifndef _WIN32
+static ssize_t
+safe_read(const int fd, void * const buf_, size_t count)
+{
+ unsigned char *buf = (unsigned char *) buf_;
+ ssize_t readnb;
+
+ assert(count > (size_t) 0U);
+ do {
+ while ((readnb = read(fd, buf, count)) < (ssize_t) 0 &&
+ (errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */
+ if (readnb < (ssize_t) 0) {
+ return readnb; /* LCOV_EXCL_LINE */
+ }
+ if (readnb == (ssize_t) 0) {
+ break; /* LCOV_EXCL_LINE */
+ }
+ count -= (size_t) readnb;
+ buf += readnb;
+ } while (count > (ssize_t) 0);
+
+ return (ssize_t) (buf - (unsigned char *) buf_);
+}
+#endif
+
+#ifndef _WIN32
+static int
+randombytes_salsa20_random_random_dev_open(void)
+{
+/* LCOV_EXCL_START */
+ struct stat st;
+ static const char *devices[] = {
+# ifndef USE_BLOCKING_RANDOM
+ "/dev/urandom",
+# endif
+ "/dev/random", NULL
+ };
+ const char ** device = devices;
+ int fd;
+
+ do {
+ fd = open(*device, O_RDONLY);
+ if (fd != -1) {
+ if (fstat(fd, &st) == 0 && S_ISCHR(st.st_mode)) {
+# if defined(F_SETFD) && defined(FD_CLOEXEC)
+ (void) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+# endif
+ return fd;
+ }
+ (void) close(fd);
+ } else if (errno == EINTR) {
+ continue;
+ }
+ device++;
+ } while (*device != NULL);
+
+ errno = EIO;
+ return -1;
+/* LCOV_EXCL_STOP */
+}
+
+static void
+randombytes_salsa20_random_init(void)
+{
+ const int errno_save = errno;
+
+ stream.nonce = sodium_hrtime();
+ assert(stream.nonce != (uint64_t) 0U);
+
+ if ((stream.random_data_source_fd =
+ randombytes_salsa20_random_random_dev_open()) == -1) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+ errno = errno_save;
+}
+
+#else /* _WIN32 */
+
+static void
+randombytes_salsa20_random_init(void)
+{
+ stream.nonce = sodium_hrtime();
+ assert(stream.nonce != (uint64_t) 0U);
+}
+#endif
+
+void
+randombytes_salsa20_random_stir(void)
+{
+ const unsigned char s[crypto_auth_hmacsha512256_KEYBYTES] = {
+ 'T', 'h', 'i', 's', 'I', 's', 'J', 'u', 's', 't', 'A', 'T',
+ 'h', 'i', 'r', 't', 'y', 'T', 'w', 'o', 'B', 'y', 't', 'e',
+ 's', 'S', 'e', 'e', 'd', '.', '.', '.'
+ };
+ unsigned char m0[crypto_auth_hmacsha512256_BYTES +
+ 2U * SHA512_BLOCK_SIZE - SHA512_MIN_PAD_SIZE];
+ unsigned char *k0 = m0 + crypto_auth_hmacsha512256_BYTES;
+ size_t i;
+ size_t sizeof_k0 = sizeof m0 - crypto_auth_hmacsha512256_BYTES;
+
+ memset(stream.rnd32, 0, sizeof stream.rnd32);
+ stream.rnd32_outleft = (size_t) 0U;
+ if (stream.initialized == 0) {
+ randombytes_salsa20_random_init();
+ stream.initialized = 1;
+ }
+#ifndef _WIN32
+ if (safe_read(stream.random_data_source_fd, m0,
+ sizeof m0) != (ssize_t) sizeof m0) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+#else /* _WIN32 */
+ if (! RtlGenRandom((PVOID) m0, (ULONG) sizeof m0)) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+#endif
+ COMPILER_ASSERT(sizeof stream.key == crypto_auth_hmacsha512256_BYTES);
+ crypto_auth_hmacsha512256(stream.key, k0, sizeof_k0, s);
+ COMPILER_ASSERT(sizeof stream.key <= sizeof m0);
+ for (i = (size_t) 0U; i < sizeof stream.key; i++) {
+ stream.key[i] ^= m0[i];
+ }
+ sodium_memzero(m0, sizeof m0);
+}
+
+static void
+randombytes_salsa20_random_stir_if_needed(void)
+{
+#ifdef _MSC_VER
+ if (stream.initialized == 0) {
+ randombytes_salsa20_random_stir();
+ }
+#else
+ const pid_t pid = getpid();
+
+ if (stream.initialized == 0 || stream.pid != pid) {
+ stream.pid = pid;
+ randombytes_salsa20_random_stir();
+ }
+#endif
+}
+
+static void
+randombytes_salsa20_random_rekey(const unsigned char * const mix)
+{
+ unsigned char *key = stream.key;
+ size_t i;
+
+ for (i = (size_t) 0U; i < sizeof stream.key; i++) {
+ key[i] ^= mix[i];
+ }
+}
+
+static uint32_t
+randombytes_salsa20_random_getword(void)
+{
+ uint32_t val;
+ int ret;
+
+ COMPILER_ASSERT(sizeof stream.rnd32 >= (sizeof stream.key) + (sizeof val));
+ COMPILER_ASSERT(((sizeof stream.rnd32) - (sizeof stream.key))
+ % sizeof val == (size_t) 0U);
+ if (stream.rnd32_outleft <= (size_t) 0U) {
+ randombytes_salsa20_random_stir_if_needed();
+ COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_salsa20_NONCEBYTES);
+ ret = crypto_stream_salsa20((unsigned char *) stream.rnd32,
+ (unsigned long long) sizeof stream.rnd32,
+ (unsigned char *) &stream.nonce,
+ stream.key);
+ assert(ret == 0);
+ stream.rnd32_outleft = (sizeof stream.rnd32) - (sizeof stream.key);
+ randombytes_salsa20_random_rekey(&stream.rnd32[stream.rnd32_outleft]);
+ stream.nonce++;
+ }
+ stream.rnd32_outleft -= sizeof val;
+ memcpy(&val, &stream.rnd32[stream.rnd32_outleft], sizeof val);
+ memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof val);
+
+ return val;
+}
+
+int
+randombytes_salsa20_random_close(void)
+{
+ int ret = -1;
+
+#ifndef _WIN32
+ if (stream.random_data_source_fd != -1 &&
+ close(stream.random_data_source_fd) == 0) {
+ stream.random_data_source_fd = -1;
+ stream.initialized = 0;
+ ret = 0;
+ }
+#else /* _WIN32 */
+ if (stream.initialized != 0) {
+ stream.initialized = 0;
+ ret = 0;
+ }
+#endif
+ return ret;
+}
+
+uint32_t
+randombytes_salsa20_random(void)
+{
+ return randombytes_salsa20_random_getword();
+}
+
+void
+randombytes_salsa20_random_buf(void * const buf, const size_t size)
+{
+ int ret;
+
+ randombytes_salsa20_random_stir_if_needed();
+ COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_salsa20_NONCEBYTES);
+#ifdef ULONG_LONG_MAX
+ /* coverity[result_independent_of_operands] */
+ assert(size <= ULONG_LONG_MAX);
+#endif
+ ret = crypto_stream_salsa20((unsigned char *) buf, (unsigned long long) size,
+ (unsigned char *) &stream.nonce, stream.key);
+ assert(ret == 0);
+ stream.nonce++;
+ crypto_stream_salsa20_xor(stream.key, stream.key, sizeof stream.key,
+ (unsigned char *) &stream.nonce, stream.key);
+}
+
+/*
+ * randombytes_salsa20_random_uniform() derives from OpenBSD's arc4random_uniform()
+ * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
+ */
+
+uint32_t
+randombytes_salsa20_random_uniform(const uint32_t upper_bound)
+{
+ uint32_t min;
+ uint32_t r;
+
+ if (upper_bound < 2) {
+ return 0;
+ }
+ min = (uint32_t) (-upper_bound % upper_bound);
+ for (;;) {
+ r = randombytes_salsa20_random();
+ if (r >= min) {
+ break;
+ }
+ } /* LCOV_EXCL_LINE */
+ return r % upper_bound;
+}
+
+const char *
+randombytes_salsa20_implementation_name(void)
+{
+ return "salsa20";
+}
+
+struct randombytes_implementation randombytes_salsa20_implementation = {
+ SODIUM_C99(.implementation_name =) randombytes_salsa20_implementation_name,
+ SODIUM_C99(.random =) randombytes_salsa20_random,
+ SODIUM_C99(.stir =) randombytes_salsa20_random_stir,
+ SODIUM_C99(.uniform =) randombytes_salsa20_random_uniform,
+ SODIUM_C99(.buf =) randombytes_salsa20_random_buf,
+ SODIUM_C99(.close =) randombytes_salsa20_random_close
+};
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c
new file mode 100644
index 00000000..15b223b4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c
@@ -0,0 +1,266 @@
+
+#include <sys/types.h>
+#ifndef _WIN32
+# include <sys/stat.h>
+# include <sys/time.h>
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef _WIN32
+# include <unistd.h>
+#endif
+
+#include "randombytes.h"
+#include "randombytes_sysrandom.h"
+#include "utils.h"
+
+#ifdef _WIN32
+# include <windows.h>
+# define RtlGenRandom SystemFunction036
+# if defined(__cplusplus)
+extern "C"
+# endif
+BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
+# pragma comment(lib, "advapi32.lib")
+#endif
+
+#ifdef __OpenBSD__
+
+uint32_t
+randombytes_sysrandom(void)
+{
+ return arc4random();
+}
+
+void
+randombytes_sysrandom_stir(void)
+{
+}
+
+uint32_t
+randombytes_sysrandom_uniform(const uint32_t upper_bound)
+{
+ return arc4random_uniform(upper_bound);
+}
+
+void
+randombytes_sysrandom_buf(void * const buf, const size_t size)
+{
+ return arc4random_buf(buf, size);
+}
+
+int
+randombytes_sysrandom_close(void)
+{
+ return 0;
+}
+
+#else /* __OpenBSD__ */
+
+typedef struct SysRandom_ {
+ int random_data_source_fd;
+ int initialized;
+} SysRandom;
+
+static SysRandom stream = {
+ SODIUM_C99(.random_data_source_fd =) -1,
+ SODIUM_C99(.initialized =) 0
+};
+
+#ifndef _WIN32
+static ssize_t
+safe_read(const int fd, void * const buf_, size_t count)
+{
+ unsigned char *buf = (unsigned char *) buf_;
+ ssize_t readnb;
+
+ assert(count > (size_t) 0U);
+ do {
+ while ((readnb = read(fd, buf, count)) < (ssize_t) 0 &&
+ (errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */
+ if (readnb < (ssize_t) 0) {
+ return readnb; /* LCOV_EXCL_LINE */
+ }
+ if (readnb == (ssize_t) 0) {
+ break; /* LCOV_EXCL_LINE */
+ }
+ count -= (size_t) readnb;
+ buf += readnb;
+ } while (count > (ssize_t) 0);
+
+ return (ssize_t) (buf - (unsigned char *) buf_);
+}
+#endif
+
+#ifndef _WIN32
+static int
+randombytes_sysrandom_random_dev_open(void)
+{
+/* LCOV_EXCL_START */
+ struct stat st;
+ static const char *devices[] = {
+# ifndef USE_BLOCKING_RANDOM
+ "/dev/urandom",
+# endif
+ "/dev/random", NULL
+ };
+ const char ** device = devices;
+ int fd;
+
+ do {
+ fd = open(*device, O_RDONLY);
+ if (fd != -1) {
+ if (fstat(fd, &st) == 0 && S_ISCHR(st.st_mode)) {
+# if defined(F_SETFD) && defined(FD_CLOEXEC)
+ (void) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+# endif
+ return fd;
+ }
+ (void) close(fd);
+ } else if (errno == EINTR) {
+ continue;
+ }
+ device++;
+ } while (*device != NULL);
+
+ errno = EIO;
+ return -1;
+/* LCOV_EXCL_STOP */
+}
+
+static void
+randombytes_sysrandom_init(void)
+{
+ const int errno_save = errno;
+
+ if ((stream.random_data_source_fd =
+ randombytes_sysrandom_random_dev_open()) == -1) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+ errno = errno_save;
+}
+
+#else /* _WIN32 */
+
+static void
+randombytes_sysrandom_init(void)
+{
+}
+#endif
+
+void
+randombytes_sysrandom_stir(void)
+{
+ if (stream.initialized == 0) {
+ randombytes_sysrandom_init();
+ stream.initialized = 1;
+ }
+}
+
+static void
+randombytes_sysrandom_stir_if_needed(void)
+{
+ if (stream.initialized == 0) {
+ randombytes_sysrandom_stir();
+ }
+}
+
+int
+randombytes_sysrandom_close(void)
+{
+ int ret = -1;
+
+#ifndef _WIN32
+ if (stream.random_data_source_fd != -1 &&
+ close(stream.random_data_source_fd) == 0) {
+ stream.random_data_source_fd = -1;
+ stream.initialized = 0;
+ ret = 0;
+ }
+#else /* _WIN32 */
+ if (stream.initialized != 0) {
+ stream.initialized = 0;
+ ret = 0;
+ }
+#endif
+ return ret;
+}
+
+uint32_t
+randombytes_sysrandom(void)
+{
+ uint32_t r;
+
+ randombytes_sysrandom_buf(&r, sizeof r);
+
+ return r;
+}
+
+void
+randombytes_sysrandom_buf(void * const buf, const size_t size)
+{
+ randombytes_sysrandom_stir_if_needed();
+#ifdef ULONG_LONG_MAX
+ /* coverity[result_independent_of_operands] */
+ assert(size <= ULONG_LONG_MAX);
+#endif
+#ifndef _WIN32
+ if (safe_read(stream.random_data_source_fd, buf, size) != (ssize_t) size) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+#else
+ if (size > (size_t) 0xffffffff) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+ if (! RtlGenRandom((PVOID) buf, (ULONG) size)) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+#endif
+}
+
+/*
+ * randombytes_sysrandom_uniform() derives from OpenBSD's arc4random_uniform()
+ * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
+ */
+
+uint32_t
+randombytes_sysrandom_uniform(const uint32_t upper_bound)
+{
+ uint32_t min;
+ uint32_t r;
+
+ if (upper_bound < 2) {
+ return 0;
+ }
+ min = (uint32_t) (-upper_bound % upper_bound);
+ for (;;) {
+ r = randombytes_sysrandom();
+ if (r >= min) {
+ break;
+ }
+ } /* LCOV_EXCL_LINE */
+ return r % upper_bound;
+}
+
+#endif
+
+const char *
+randombytes_sysrandom_implementation_name(void)
+{
+ return "sysrandom";
+}
+
+struct randombytes_implementation randombytes_sysrandom_implementation = {
+ SODIUM_C99(.implementation_name =) randombytes_sysrandom_implementation_name,
+ SODIUM_C99(.random =) randombytes_sysrandom,
+ SODIUM_C99(.stir =) randombytes_sysrandom_stir,
+ SODIUM_C99(.uniform =) randombytes_sysrandom_uniform,
+ SODIUM_C99(.buf =) randombytes_sysrandom_buf,
+ SODIUM_C99(.close =) randombytes_sysrandom_close
+};
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/core.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/core.c
new file mode 100644
index 00000000..367f2751
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/core.c
@@ -0,0 +1,25 @@
+
+#include "core.h"
+#include "crypto_onetimeauth.h"
+#include "randombytes.h"
+#include "runtime.h"
+#include "utils.h"
+
+static int initialized;
+
+int
+sodium_init(void)
+{
+ if (initialized != 0) {
+ return 1;
+ }
+ sodium_runtime_get_cpu_features();
+ if (crypto_onetimeauth_pick_best_implementation() == NULL) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ randombytes_stir();
+ _sodium_alloc_init();
+ initialized = 1;
+
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/runtime.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/runtime.c
new file mode 100644
index 00000000..3e424a01
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/runtime.c
@@ -0,0 +1,134 @@
+
+#ifdef HAVE_ANDROID_GETCPUFEATURES
+# include <cpu-features.h>
+#endif
+
+#include "runtime.h"
+
+typedef struct CPUFeatures_ {
+ int initialized;
+ int has_neon;
+ int has_sse2;
+ int has_sse3;
+} CPUFeatures;
+
+static CPUFeatures _cpu_features;
+
+#define CPUID_SSE2 0x04000000
+#define CPUIDECX_SSE3 0x00000001
+
+static int
+_sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
+{
+#ifndef __arm__
+ cpu_features->has_neon = 0;
+ return -1;
+#else
+# ifdef __APPLE__
+# ifdef __ARM_NEON__
+ cpu_features->has_neon = 1;
+# else
+ cpu_features->has_neon = 0;
+# endif
+# elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_NEON)
+ cpu_features->has_neon =
+ (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0x0;
+# else
+ cpu_features->has_neon = 0;
+# endif
+ return 0;
+#endif
+}
+
+static void
+_cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
+{
+#ifdef _MSC_VER
+ __cpuid((int *) cpu_info, cpu_info_type);
+#elif defined(HAVE_CPUID)
+ cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
+# ifdef __i386__
+ __asm__ __volatile__ ("pushfl; pushfl; "
+ "popl %0; "
+ "movl %0, %1; xorl %2, %0; "
+ "pushl %0; "
+ "popfl; pushfl; popl %0; popfl" :
+ "=&r" (cpu_info[0]), "=&r" (cpu_info[1]) :
+ "i" (0x200000));
+ if (((cpu_info[0] ^ cpu_info[1]) & 0x200000) == 0x0) {
+ return; /* LCOV_EXCL_LINE */
+ }
+# endif
+# ifdef __i386__
+ __asm__ __volatile__ ("xchgl %%ebx, %k1; cpuid; xchgl %%ebx, %k1" :
+ "=a" (cpu_info[0]), "=&r" (cpu_info[1]),
+ "=c" (cpu_info[2]), "=d" (cpu_info[3]) :
+ "0" (cpu_info_type), "2" (0U));
+# elif defined(__x86_64__)
+ __asm__ __volatile__ ("xchgq %%rbx, %q1; cpuid; xchgq %%rbx, %q1" :
+ "=a" (cpu_info[0]), "=&r" (cpu_info[1]),
+ "=c" (cpu_info[2]), "=d" (cpu_info[3]) :
+ "0" (cpu_info_type), "2" (0U));
+# else
+ __asm__ __volatile__ ("cpuid" :
+ "=a" (cpu_info[0]), "=b" (cpu_info[1]),
+ "=c" (cpu_info[2]), "=d" (cpu_info[3]) :
+ "0" (cpu_info_type), "2" (0U));
+# endif
+#else
+ cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
+#endif
+}
+
+static int
+_sodium_runtime_intel_cpu_features(CPUFeatures * const cpu_features)
+{
+ unsigned int cpu_info[4];
+ unsigned int id;
+
+ _cpuid(cpu_info, 0x0);
+ if ((id = cpu_info[0]) == 0U) {
+ return -1; /* LCOV_EXCL_LINE */
+ }
+ _cpuid(cpu_info, 0x00000001);
+#ifndef HAVE_EMMINTRIN_H
+ cpu_features->has_sse2 = 0;
+#else
+ cpu_features->has_sse2 = ((cpu_info[3] & CPUID_SSE2) != 0x0);
+#endif
+
+#ifndef HAVE_PMMINTRIN_H
+ cpu_features->has_sse3 = 0;
+#else
+ cpu_features->has_sse3 = ((cpu_info[2] & CPUIDECX_SSE3) != 0x0);
+#endif
+
+ return 0;
+}
+
+int
+sodium_runtime_get_cpu_features(void)
+{
+ int ret = -1;
+
+ ret &= _sodium_runtime_arm_cpu_features(&_cpu_features);
+ ret &= _sodium_runtime_intel_cpu_features(&_cpu_features);
+ _cpu_features.initialized = 1;
+
+ return ret;
+}
+
+int
+sodium_runtime_has_neon(void) {
+ return _cpu_features.has_neon;
+}
+
+int
+sodium_runtime_has_sse2(void) {
+ return _cpu_features.has_sse2;
+}
+
+int
+sodium_runtime_has_sse3(void) {
+ return _cpu_features.has_sse3;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/utils.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/utils.c
new file mode 100644
index 00000000..dd59dbca
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/utils.c
@@ -0,0 +1,505 @@
+#ifndef __STDC_WANT_LIB_EXT1__
+# define __STDC_WANT_LIB_EXT1__ 1
+#endif
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
+
+#include "utils.h"
+#include "randombytes.h"
+#ifdef _WIN32
+# include <windows.h>
+# include <wincrypt.h>
+#else
+# include <unistd.h>
+#endif
+
+#define CANARY_SIZE 16U
+#define GARBAGE_VALUE 0xd0
+
+#ifndef MAP_NOCORE
+# define MAP_NOCORE 0
+#endif
+#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
+# define MAP_ANON MAP_ANONYMOUS
+#endif
+#if defined(_WIN32) || (defined(MAP_ANON) && defined(HAVE_MMAP)) || defined(HAVE_POSIX_MEMALIGN)
+# define HAVE_ALIGNED_MALLOC
+#endif
+#if defined(HAVE_MPROTECT) && !(defined(PROT_NONE) && defined(PROT_READ) && defined(PROT_WRITE))
+# undef HAVE_MPROTECT
+#endif
+#if defined(HAVE_ALIGNED_MALLOC) && (defined(_WIN32) || defined(HAVE_MPROTECT))
+# define HAVE_PAGE_PROTECTION
+#endif
+
+static size_t page_size;
+static unsigned char canary[CANARY_SIZE];
+
+#ifdef HAVE_WEAK_SYMBOLS
+__attribute__((weak)) void
+_sodium_dummy_symbol_to_prevent_lto(void * const pnt, const size_t len)
+{
+ (void) pnt;
+ (void) len;
+}
+#endif
+
+void
+sodium_memzero(void * const pnt, const size_t len)
+{
+#ifdef _WIN32
+ SecureZeroMemory(pnt, len);
+#elif defined(HAVE_MEMSET_S)
+ if (memset_s(pnt, (rsize_t) len, 0, (rsize_t) len) != 0) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+#elif defined(HAVE_EXPLICIT_BZERO)
+ explicit_bzero(pnt, len);
+#elif HAVE_WEAK_SYMBOLS
+ memset(pnt, 0, len);
+ _sodium_dummy_symbol_to_prevent_lto(pnt, len);
+#else
+ volatile unsigned char *pnt_ = (volatile unsigned char *) pnt;
+ size_t i = (size_t) 0U;
+
+ while (i < len) {
+ pnt_[i++] = 0U;
+ }
+#endif
+}
+
+int
+sodium_memcmp(const void * const b1_, const void * const b2_, size_t len)
+{
+ const unsigned char *b1 = (const unsigned char *) b1_;
+ const unsigned char *b2 = (const unsigned char *) b2_;
+ size_t i;
+ unsigned char d = (unsigned char) 0U;
+
+ for (i = 0U; i < len; i++) {
+ d |= b1[i] ^ b2[i];
+ }
+ return (int) ((1 & ((d - 1) >> 8)) - 1);
+}
+
+/* Derived from original code by CodesInChaos */
+char *
+sodium_bin2hex(char * const hex, const size_t hex_maxlen,
+ const unsigned char * const bin, const size_t bin_len)
+{
+ size_t i = (size_t) 0U;
+ unsigned int x;
+ int b;
+ int c;
+
+ if (bin_len >= SIZE_MAX / 2 || hex_maxlen < bin_len * 2U) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+ while (i < bin_len) {
+ c = bin[i] & 0xf;
+ b = bin[i] >> 4;
+ x = (unsigned char) (87 + c + (((c - 10) >> 31) & -39)) << 8 |
+ (unsigned char) (87 + b + (((b - 10) >> 31) & -39));
+ hex[i * 2U] = (char) x;
+ x >>= 8;
+ hex[i * 2U + 1U] = (char) x;
+ i++;
+ }
+ hex[i * 2U] = 0;
+
+ return hex;
+}
+
+int
+sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen,
+ const char * const hex, const size_t hex_len,
+ const char * const ignore, size_t * const bin_len,
+ const char ** const hex_end)
+{
+ size_t bin_pos = (size_t) 0U;
+ size_t hex_pos = (size_t) 0U;
+ int ret = 0;
+ unsigned char c;
+ unsigned char c_acc = 0U;
+ unsigned char c_num;
+ unsigned char c_val;
+ unsigned char state = 0U;
+
+ while (hex_pos < hex_len) {
+ c = (unsigned char) hex[hex_pos];
+ if ((c_num = c ^ 48U) < 10U) {
+ c_val = c_num;
+ } else if ((c_num = (c & ~32U)) > 64 && c_num < 71U) {
+ c_val = c_num - 55U;
+ } else if (ignore != NULL && strchr(ignore, c) != NULL && state == 0U) {
+ hex_pos++;
+ continue;
+ } else {
+ break;
+ }
+ if (bin_pos >= bin_maxlen) {
+ ret = -1;
+ errno = ERANGE;
+ break;
+ }
+ if (state == 0U) {
+ c_acc = c_val * 16U;
+ } else {
+ bin[bin_pos++] = c_acc | c_val;
+ }
+ state = ~state;
+ hex_pos++;
+ }
+ if (state != 0U) {
+ hex_pos--;
+ }
+ if (hex_end != NULL) {
+ *hex_end = &hex[hex_pos];
+ }
+ if (bin_len != NULL) {
+ *bin_len = bin_pos;
+ }
+ return ret;
+}
+
+int
+_sodium_alloc_init(void)
+{
+#ifdef HAVE_ALIGNED_MALLOC
+# if defined(_SC_PAGESIZE)
+ long page_size_ = sysconf(_SC_PAGESIZE);
+ if (page_size_ > 0L) {
+ page_size = (size_t) page_size_;
+ }
+# elif defined(_WIN32)
+ SYSTEM_INFO si;
+ GetSystemInfo(&si);
+ page_size = (size_t) si.dwPageSize;
+# endif
+ if (page_size < CANARY_SIZE || page_size < sizeof(size_t)) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+#endif
+ randombytes_buf(canary, sizeof canary);
+
+ return 0;
+}
+
+int
+sodium_mlock(void * const addr, const size_t len)
+{
+#if defined(MADV_DONTDUMP) && defined(HAVE_MADVISE)
+ (void) madvise(addr, len, MADV_DONTDUMP);
+#endif
+#ifdef HAVE_MLOCK
+ return mlock(addr, len);
+#elif defined(_WIN32)
+ return -(VirtualLock(addr, len) == 0);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+int
+sodium_munlock(void * const addr, const size_t len)
+{
+ sodium_memzero(addr, len);
+#if defined(MADV_DODUMP) && defined(HAVE_MADVISE)
+ (void) madvise(addr, len, MADV_DODUMP);
+#endif
+#ifdef HAVE_MLOCK
+ return munlock(addr, len);
+#elif defined(_WIN32)
+ return -(VirtualUnlock(addr, len) == 0);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+static int
+_mprotect_noaccess(void *ptr, size_t size)
+{
+#ifdef HAVE_MPROTECT
+ return mprotect(ptr, size, PROT_NONE);
+#elif defined(_WIN32)
+ DWORD old;
+ return -(VirtualProtect(ptr, size, PAGE_NOACCESS, &old) == 0);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+static int
+_mprotect_readonly(void *ptr, size_t size)
+{
+#ifdef HAVE_MPROTECT
+ return mprotect(ptr, size, PROT_READ);
+#elif defined(_WIN32)
+ DWORD old;
+ return -(VirtualProtect(ptr, size, PAGE_READONLY, &old) == 0);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+static int
+_mprotect_readwrite(void *ptr, size_t size)
+{
+#ifdef HAVE_MPROTECT
+ return mprotect(ptr, size, PROT_READ | PROT_WRITE);
+#elif defined(_WIN32)
+ DWORD old;
+ return -(VirtualProtect(ptr, size, PAGE_READWRITE, &old) == 0);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+#ifdef HAVE_ALIGNED_MALLOC
+
+static void
+_out_of_bounds(void)
+{
+# ifdef SIGSEGV
+ raise(SIGSEGV);
+# elif defined(SIGKILL)
+ raise(SIGKILL);
+# endif
+ abort();
+} /* LCOV_EXCL_LINE */
+
+static inline size_t
+_page_round(const size_t size)
+{
+ const size_t page_mask = page_size - 1U;
+
+ return (size + page_mask) & ~page_mask;
+}
+
+static __attribute__((malloc)) unsigned char *
+_alloc_aligned(const size_t size)
+{
+ void *ptr;
+
+# if defined(MAP_ANON) && defined(HAVE_MMAP)
+ if ((ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_PRIVATE | MAP_NOCORE, -1, 0)) == MAP_FAILED) {
+ ptr = NULL; /* LCOV_EXCL_LINE */
+ } /* LCOV_EXCL_LINE */
+# elif defined(HAVE_POSIX_MEMALIGN)
+ if (posix_memalign(&ptr, page_size, size) != 0) {
+ ptr = NULL; /* LCOV_EXCL_LINE */
+ } /* LCOV_EXCL_LINE */
+# elif defined(_WIN32)
+ ptr = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
+# else
+# error Bug
+# endif
+ return (unsigned char *) ptr;
+}
+
+static void
+_free_aligned(unsigned char * const ptr, const size_t size)
+{
+# if defined(MAP_ANON) && defined(HAVE_MMAP)
+ (void) munmap(ptr, size);
+# elif defined(HAVE_POSIX_MEMALIGN)
+ free(ptr);
+# elif defined(_WIN32)
+ VirtualFree(ptr, 0U, MEM_RELEASE);
+# else
+# error Bug
+# endif
+}
+
+static unsigned char *
+_unprotected_ptr_from_user_ptr(const void *ptr)
+{
+ uintptr_t unprotected_ptr_u;
+ unsigned char *canary_ptr;
+ size_t page_mask;
+
+ canary_ptr = ((unsigned char *) ptr) - sizeof canary;
+ page_mask = page_size - 1U;
+ unprotected_ptr_u = ((uintptr_t) canary_ptr & (uintptr_t) ~page_mask);
+ if (unprotected_ptr_u <= page_size * 2U) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+ return (unsigned char *) unprotected_ptr_u;
+}
+
+#endif /* HAVE_ALIGNED_MALLOC */
+
+#ifndef HAVE_ALIGNED_MALLOC
+static __attribute__((malloc)) void *
+_sodium_malloc(const size_t size)
+{
+ return malloc(size);
+}
+#else
+static __attribute__((malloc)) void *
+_sodium_malloc(const size_t size)
+{
+ void *user_ptr;
+ unsigned char *base_ptr;
+ unsigned char *canary_ptr;
+ unsigned char *unprotected_ptr;
+ size_t size_with_canary;
+ size_t total_size;
+ size_t unprotected_size;
+
+ if (size >= (size_t) SIZE_MAX - page_size * 4U) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ if (page_size <= sizeof canary || page_size < sizeof unprotected_size) {
+ abort(); /* LCOV_EXCL_LINE */
+ }
+ size_with_canary = (sizeof canary) + size;
+ unprotected_size = _page_round(size_with_canary);
+ total_size = page_size + page_size + unprotected_size + page_size;
+ if ((base_ptr = _alloc_aligned(total_size)) == NULL) {
+ return NULL; /* LCOV_EXCL_LINE */
+ }
+ unprotected_ptr = base_ptr + page_size * 2U;
+ _mprotect_noaccess(base_ptr + page_size, page_size);
+# ifndef HAVE_PAGE_PROTECTION
+ memcpy(unprotected_ptr + unprotected_size, canary, sizeof canary);
+# endif
+ _mprotect_noaccess(unprotected_ptr + unprotected_size, page_size);
+ sodium_mlock(unprotected_ptr, unprotected_size);
+ canary_ptr = unprotected_ptr + _page_round(size_with_canary) -
+ size_with_canary;
+ user_ptr = canary_ptr + sizeof canary;
+ memcpy(canary_ptr, canary, sizeof canary);
+ memcpy(base_ptr, &unprotected_size, sizeof unprotected_size);
+ _mprotect_readonly(base_ptr, page_size);
+ assert(_unprotected_ptr_from_user_ptr(user_ptr) == unprotected_ptr);
+
+ return user_ptr;
+}
+#endif /* !HAVE_ALIGNED_MALLOC */
+
+__attribute__((malloc)) void *
+sodium_malloc(const size_t size)
+{
+ void *ptr;
+
+ if ((ptr = _sodium_malloc(size)) == NULL) {
+ return NULL; /* LCOV_EXCL_LINE */
+ }
+ memset(ptr, (int) GARBAGE_VALUE, size);
+
+ return ptr;
+}
+
+__attribute__((malloc)) void *
+sodium_allocarray(size_t count, size_t size)
+{
+ size_t total_size;
+
+ if (size >= (size_t) SIZE_MAX / count) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ total_size = count * size;
+
+ return sodium_malloc(total_size);
+}
+
+#ifndef HAVE_ALIGNED_MALLOC
+void
+sodium_free(void *ptr)
+{
+ free(ptr);
+}
+#else
+void
+sodium_free(void *ptr)
+{
+ unsigned char *base_ptr;
+ unsigned char *canary_ptr;
+ unsigned char *unprotected_ptr;
+ size_t total_size;
+ size_t unprotected_size;
+
+ if (ptr == NULL) {
+ return;
+ }
+ canary_ptr = ((unsigned char *) ptr) - sizeof canary;
+ unprotected_ptr = _unprotected_ptr_from_user_ptr(ptr);
+ base_ptr = unprotected_ptr - page_size * 2U;
+ memcpy(&unprotected_size, base_ptr, sizeof unprotected_size);
+ total_size = page_size + page_size + unprotected_size + page_size;
+ _mprotect_readwrite(base_ptr, total_size);
+ if (sodium_memcmp(canary_ptr, canary, sizeof canary) != 0) {
+ _out_of_bounds();
+ }
+# ifndef HAVE_PAGE_PROTECTION
+ if (sodium_memcmp(unprotected_ptr + unprotected_size,
+ canary, sizeof canary) != 0) {
+ _out_of_bounds();
+ }
+# endif
+ sodium_munlock(unprotected_ptr, unprotected_size);
+ _free_aligned(base_ptr, total_size);
+}
+#endif /* HAVE_ALIGNED_MALLOC */
+
+#ifndef HAVE_PAGE_PROTECTION
+static int
+_sodium_mprotect(void *ptr, int (*cb)(void *ptr, size_t size))
+{
+ (void) ptr;
+ (void) cb;
+ errno = ENOSYS;
+ return -1;
+}
+#else
+static int
+_sodium_mprotect(void *ptr, int (*cb)(void *ptr, size_t size))
+{
+ unsigned char *base_ptr;
+ unsigned char *unprotected_ptr;
+ size_t unprotected_size;
+
+ unprotected_ptr = _unprotected_ptr_from_user_ptr(ptr);
+ base_ptr = unprotected_ptr - page_size * 2U;
+ memcpy(&unprotected_size, base_ptr, sizeof unprotected_size);
+
+ return cb(unprotected_ptr, unprotected_size);
+}
+#endif
+
+int
+sodium_mprotect_noaccess(void *ptr)
+{
+ return _sodium_mprotect(ptr, _mprotect_noaccess);
+}
+
+int
+sodium_mprotect_readonly(void *ptr)
+{
+ return _sodium_mprotect(ptr, _mprotect_readonly);
+}
+
+int
+sodium_mprotect_readwrite(void *ptr)
+{
+ return _sodium_mprotect(ptr, _mprotect_readwrite);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/version.c b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/version.c
new file mode 100644
index 00000000..4083c812
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/libsodium/src/libsodium/sodium/version.c
@@ -0,0 +1,20 @@
+
+#include "version.h"
+
+const char *
+sodium_version_string(void)
+{
+ return SODIUM_VERSION_STRING;
+}
+
+int
+sodium_library_version_major(void)
+{
+ return SODIUM_LIBRARY_VERSION_MAJOR;
+}
+
+int
+sodium_library_version_minor(void)
+{
+ return SODIUM_LIBRARY_VERSION_MINOR;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/COPYING b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/COPYING
new file mode 100644
index 00000000..b6f3fd5d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/builds/msvc/platform.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/builds/msvc/platform.hpp
new file mode 100644
index 00000000..c255ff68
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/builds/msvc/platform.hpp
@@ -0,0 +1,41 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
+#define __ZMQ_PLATFORM_HPP_INCLUDED__
+
+// This is the platform definition for the MSVC platform.
+// As a first step of the build process it is copied to
+// zmq directory to take place of platform.hpp generated from
+// platform.hpp.in on platforms supported by GNU autotools.
+// Place any MSVC-specific definitions here.
+
+#define ZMQ_HAVE_WINDOWS
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/include/zmq.h b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/include/zmq.h
new file mode 100644
index 00000000..edaa1d78
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/include/zmq.h
@@ -0,0 +1,463 @@
+/*
+ Copyright (c) 2007-2015 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 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
+ 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 <http://www.gnu.org/licenses/>.
+
+ *************************************************************************
+ NOTE to contributors. This file comprises the principal public contract
+ for ZeroMQ API users (along with zmq_utils.h). 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 1
+#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 <errno.h>
+#endif
+#include <stddef.h>
+#include <stdio.h>
+#if defined _WIN32
+#include <winsock2.h>
+#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 <inttypes.h>
+#else
+# include <stdint.h>
+#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. */
+/******************************************************************************/
+
+/* New API */
+/* 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
+
+/* 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 *ctx_);
+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. */
+/******************************************************************************/
+
+typedef struct zmq_msg_t {unsigned char _ [64];} 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
+
+/* Message options */
+#define ZMQ_MORE 1
+#define ZMQ_SRCFD 2
+#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
+
+/* 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
+
+/******************************************************************************/
+/* 0MQ socket events and monitoring */
+/******************************************************************************/
+
+/* Socket transport events (TCP and IPC 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
+
+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);
+
+
+/******************************************************************************/
+/* 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 libsodium. */
+/* Returns 0 on success. */
+ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key);
+
+
+/******************************************************************************/
+/* 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. */
+/******************************************************************************/
+
+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);
+
+/* 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);
+
+
+#undef ZMQ_EXPORT
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/include/zmq_utils.h b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/include/zmq_utils.h
new file mode 100644
index 00000000..3392a8e0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/include/zmq_utils.h
@@ -0,0 +1,20 @@
+/*
+ Copyright (c) 2007-2015 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 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
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+/* This file is deprecated, and all its functionality provided by zmq.h */
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/address.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/address.cpp
new file mode 100644
index 00000000..c8697ecc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/address.cpp
@@ -0,0 +1,105 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+#include "address.hpp"
+#include "err.hpp"
+#include "tcp_address.hpp"
+#include "ipc_address.hpp"
+#include "tipc_address.hpp"
+
+#include <string>
+#include <sstream>
+
+zmq::address_t::address_t (
+ const std::string &protocol_, const std::string &address_)
+ : protocol (protocol_),
+ address (address_)
+{
+ memset (&resolved, 0, sizeof resolved);
+}
+
+zmq::address_t::~address_t ()
+{
+ if (protocol == "tcp") {
+ if (resolved.tcp_addr) {
+ delete resolved.tcp_addr;
+ resolved.tcp_addr = 0;
+ }
+ }
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+ else
+ if (protocol == "ipc") {
+ if (resolved.ipc_addr) {
+ delete resolved.ipc_addr;
+ resolved.ipc_addr = 0;
+ }
+ }
+#endif
+#if defined ZMQ_HAVE_TIPC
+ else
+ if (protocol == "tipc") {
+ if (resolved.tipc_addr) {
+ delete resolved.tipc_addr;
+ resolved.tipc_addr = 0;
+ }
+ }
+#endif
+}
+
+int zmq::address_t::to_string (std::string &addr_) const
+{
+ if (protocol == "tcp") {
+ if (resolved.tcp_addr)
+ return resolved.tcp_addr->to_string (addr_);
+ }
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+ else
+ if (protocol == "ipc") {
+ if (resolved.ipc_addr)
+ return resolved.ipc_addr->to_string (addr_);
+ }
+#endif
+#if defined ZMQ_HAVE_TIPC
+ else
+ if (protocol == "tipc") {
+ if (resolved.tipc_addr)
+ return resolved.tipc_addr->to_string (addr_);
+ }
+#endif
+
+ if (!protocol.empty () && !address.empty ()) {
+ std::stringstream s;
+ s << protocol << "://" << address;
+ addr_ = s.str ();
+ return 0;
+ }
+ addr_.clear ();
+ return -1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/address.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/address.hpp
new file mode 100644
index 00000000..28421f06
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/address.hpp
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_ADDRESS_HPP_INCLUDED__
+#define __ZMQ_ADDRESS_HPP_INCLUDED__
+
+#include <string>
+
+namespace zmq
+{
+ class tcp_address_t;
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+ class ipc_address_t;
+#endif
+#if defined ZMQ_HAVE_LINUX
+ class tipc_address_t;
+#endif
+ struct address_t {
+ address_t (const std::string &protocol_, const std::string &address_);
+
+ ~address_t ();
+
+ const std::string protocol;
+ const std::string address;
+
+ // Protocol specific resolved address
+ union {
+ tcp_address_t *tcp_addr;
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+ ipc_address_t *ipc_addr;
+#endif
+#if defined ZMQ_HAVE_LINUX
+ tipc_address_t *tipc_addr;
+#endif
+ } resolved;
+
+ int to_string (std::string &addr_) const;
+ };
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/array.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/array.hpp
new file mode 100644
index 00000000..35e3c405
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/array.hpp
@@ -0,0 +1,163 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_ARRAY_INCLUDED__
+#define __ZMQ_ARRAY_INCLUDED__
+
+#include <vector>
+#include <algorithm>
+
+namespace zmq
+{
+
+ // Base class for objects stored in the array. If you want to store
+ // same object in mutliple arrays, each of those arrays has to have
+ // different ID. The item itself has to be derived from instantiations of
+ // array_item_t template for all relevant IDs.
+
+ template <int ID = 0> class array_item_t
+ {
+ public:
+
+ inline array_item_t () :
+ array_index (-1)
+ {
+ }
+
+ // The destructor doesn't have to be virtual. It is mad virtual
+ // just to keep ICC and code checking tools from complaining.
+ inline virtual ~array_item_t ()
+ {
+ }
+
+ inline void set_array_index (int index_)
+ {
+ array_index = index_;
+ }
+
+ inline int get_array_index ()
+ {
+ return array_index;
+ }
+
+ private:
+
+ int array_index;
+
+ array_item_t (const array_item_t&);
+ const array_item_t &operator = (const array_item_t&);
+ };
+
+ // Fast array implementation with O(1) access to item, insertion and
+ // removal. Array stores pointers rather than objects. The objects have
+ // to be derived from array_item_t<ID> class.
+
+ template <typename T, int ID = 0> class array_t
+ {
+ private:
+
+ typedef array_item_t <ID> item_t;
+
+ public:
+
+ typedef typename std::vector <T*>::size_type size_type;
+
+ inline array_t ()
+ {
+ }
+
+ inline ~array_t ()
+ {
+ }
+
+ inline size_type size ()
+ {
+ return items.size ();
+ }
+
+ inline bool empty ()
+ {
+ return items.empty ();
+ }
+
+ inline T *&operator [] (size_type index_)
+ {
+ return items [index_];
+ }
+
+ inline void push_back (T *item_)
+ {
+ if (item_)
+ ((item_t*) item_)->set_array_index ((int) items.size ());
+ items.push_back (item_);
+ }
+
+ inline void erase (T *item_) {
+ erase (((item_t*) item_)->get_array_index ());
+ }
+
+ inline void erase (size_type index_) {
+ if (items.back ())
+ ((item_t*) items.back ())->set_array_index ((int) index_);
+ items [index_] = items.back ();
+ items.pop_back ();
+ }
+
+ inline void swap (size_type index1_, size_type index2_)
+ {
+ if (items [index1_])
+ ((item_t*) items [index1_])->set_array_index ((int) index2_);
+ if (items [index2_])
+ ((item_t*) items [index2_])->set_array_index ((int) index1_);
+ std::swap (items [index1_], items [index2_]);
+ }
+
+ inline void clear ()
+ {
+ items.clear ();
+ }
+
+ inline size_type index (T *item_)
+ {
+ return (size_type) ((item_t*) item_)->get_array_index ();
+ }
+
+ private:
+
+ typedef std::vector <T*> items_t;
+ items_t items;
+
+ array_t (const array_t&);
+ const array_t &operator = (const array_t&);
+ };
+
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/atomic_counter.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/atomic_counter.hpp
new file mode 100644
index 00000000..44e9ec02
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/atomic_counter.hpp
@@ -0,0 +1,215 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_ATOMIC_COUNTER_HPP_INCLUDED__
+#define __ZMQ_ATOMIC_COUNTER_HPP_INCLUDED__
+
+#include "stdint.hpp"
+#include "platform.hpp"
+
+#if defined ZMQ_FORCE_MUTEXES
+#define ZMQ_ATOMIC_COUNTER_MUTEX
+#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
+#define ZMQ_ATOMIC_COUNTER_X86
+#elif defined __ARM_ARCH_7A__ && defined __GNUC__
+#define ZMQ_ATOMIC_COUNTER_ARM
+#elif defined ZMQ_HAVE_WINDOWS
+#define ZMQ_ATOMIC_COUNTER_WINDOWS
+#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
+#define ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#elif defined __tile__
+#define ZMQ_ATOMIC_COUNTER_TILE
+#else
+#define ZMQ_ATOMIC_COUNTER_MUTEX
+#endif
+
+#if defined ZMQ_ATOMIC_COUNTER_MUTEX
+#include "mutex.hpp"
+#elif defined ZMQ_ATOMIC_COUNTER_WINDOWS
+#include "windows.hpp"
+#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#include <atomic.h>
+#elif defined ZMQ_ATOMIC_COUNTER_TILE
+#include <arch/atomic.h>
+#endif
+
+namespace zmq
+{
+
+ // This class represents an integer that can be incremented/decremented
+ // in atomic fashion.
+
+ class atomic_counter_t
+ {
+ public:
+
+ typedef uint32_t integer_t;
+
+ inline atomic_counter_t (integer_t value_ = 0) :
+ value (value_)
+ {
+ }
+
+ inline ~atomic_counter_t ()
+ {
+ }
+
+ // Set counter value (not thread-safe).
+ inline void set (integer_t value_)
+ {
+ value = value_;
+ }
+
+ // Atomic addition. Returns the old value.
+ inline integer_t add (integer_t increment_)
+ {
+ integer_t old_value;
+
+#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
+ old_value = InterlockedExchangeAdd ((LONG*) &value, increment_);
+#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
+ integer_t new_value = atomic_add_32_nv (&value, increment_);
+ old_value = new_value - increment_;
+#elif defined ZMQ_ATOMIC_COUNTER_TILE
+ old_value = arch_atomic_add (&value, increment_);
+#elif defined ZMQ_ATOMIC_COUNTER_X86
+ __asm__ volatile (
+ "lock; xadd %0, %1 \n\t"
+ : "=r" (old_value), "=m" (value)
+ : "0" (increment_), "m" (value)
+ : "cc", "memory");
+#elif defined ZMQ_ATOMIC_COUNTER_ARM
+ integer_t flag, tmp;
+ __asm__ volatile (
+ " dmb sy\n\t"
+ "1: ldrex %0, [%5]\n\t"
+ " add %2, %0, %4\n\t"
+ " strex %1, %2, [%5]\n\t"
+ " teq %1, #0\n\t"
+ " bne 1b\n\t"
+ " dmb sy\n\t"
+ : "=&r"(old_value), "=&r"(flag), "=&r"(tmp), "+Qo"(value)
+ : "Ir"(increment_), "r"(&value)
+ : "cc");
+#elif defined ZMQ_ATOMIC_COUNTER_MUTEX
+ sync.lock ();
+ old_value = value;
+ value += increment_;
+ sync.unlock ();
+#else
+#error atomic_counter is not implemented for this platform
+#endif
+ return old_value;
+ }
+
+ // Atomic subtraction. Returns false if the counter drops to zero.
+ inline bool sub (integer_t decrement)
+ {
+#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
+ LONG delta = - ((LONG) decrement);
+ integer_t old = InterlockedExchangeAdd ((LONG*) &value, delta);
+ return old - decrement != 0;
+#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
+ int32_t delta = - ((int32_t) decrement);
+ integer_t nv = atomic_add_32_nv (&value, delta);
+ return nv != 0;
+#elif defined ZMQ_ATOMIC_COUNTER_TILE
+ int32_t delta = - ((int32_t) decrement);
+ integer_t nv = arch_atomic_add (&value, delta);
+ return nv != 0;
+#elif defined ZMQ_ATOMIC_COUNTER_X86
+ integer_t oldval = -decrement;
+ volatile integer_t *val = &value;
+ __asm__ volatile ("lock; xaddl %0,%1"
+ : "=r" (oldval), "=m" (*val)
+ : "0" (oldval), "m" (*val)
+ : "cc", "memory");
+ return oldval != decrement;
+#elif defined ZMQ_ATOMIC_COUNTER_ARM
+ integer_t old_value, flag, tmp;
+ __asm__ volatile (
+ " dmb sy\n\t"
+ "1: ldrex %0, [%5]\n\t"
+ " sub %2, %0, %4\n\t"
+ " strex %1, %2, [%5]\n\t"
+ " teq %1, #0\n\t"
+ " bne 1b\n\t"
+ " dmb sy\n\t"
+ : "=&r"(old_value), "=&r"(flag), "=&r"(tmp), "+Qo"(value)
+ : "Ir"(decrement), "r"(&value)
+ : "cc");
+ return old_value - decrement != 0;
+#elif defined ZMQ_ATOMIC_COUNTER_MUTEX
+ sync.lock ();
+ value -= decrement;
+ bool result = value ? true : false;
+ sync.unlock ();
+ return result;
+#else
+#error atomic_counter is not implemented for this platform
+#endif
+ }
+
+ inline integer_t get ()
+ {
+ return value;
+ }
+
+ private:
+
+ volatile integer_t value;
+#if defined ZMQ_ATOMIC_COUNTER_MUTEX
+ mutex_t sync;
+#endif
+
+ atomic_counter_t (const atomic_counter_t&);
+ const atomic_counter_t& operator = (const atomic_counter_t&);
+ };
+
+}
+
+// Remove macros local to this file.
+#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
+#undef ZMQ_ATOMIC_COUNTER_WINDOWS
+#endif
+#if defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#undef ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#endif
+#if defined ZMQ_ATOMIC_COUNTER_X86
+#undef ZMQ_ATOMIC_COUNTER_X86
+#endif
+#if defined ZMQ_ATOMIC_COUNTER_ARM
+#undef ZMQ_ATOMIC_COUNTER_ARM
+#endif
+#if defined ZMQ_ATOMIC_COUNTER_MUTEX
+#undef ZMQ_ATOMIC_COUNTER_MUTEX
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/atomic_ptr.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/atomic_ptr.hpp
new file mode 100644
index 00000000..0e981821
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/atomic_ptr.hpp
@@ -0,0 +1,212 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_ATOMIC_PTR_HPP_INCLUDED__
+#define __ZMQ_ATOMIC_PTR_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_FORCE_MUTEXES
+#define ZMQ_ATOMIC_PTR_MUTEX
+#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
+#define ZMQ_ATOMIC_PTR_X86
+#elif defined __ARM_ARCH_7A__ && defined __GNUC__
+#define ZMQ_ATOMIC_PTR_ARM
+#elif defined __tile__
+#define ZMQ_ATOMIC_PTR_TILE
+#elif defined ZMQ_HAVE_WINDOWS
+#define ZMQ_ATOMIC_PTR_WINDOWS
+#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
+#define ZMQ_ATOMIC_PTR_ATOMIC_H
+#else
+#define ZMQ_ATOMIC_PTR_MUTEX
+#endif
+
+#if defined ZMQ_ATOMIC_PTR_MUTEX
+#include "mutex.hpp"
+#elif defined ZMQ_ATOMIC_PTR_WINDOWS
+#include "windows.hpp"
+#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
+#include <atomic.h>
+#elif defined ZMQ_ATOMIC_PTR_TILE
+#include <arch/atomic.h>
+#endif
+
+namespace zmq
+{
+
+ // This class encapsulates several atomic operations on pointers.
+
+ template <typename T> class atomic_ptr_t
+ {
+ public:
+
+ // Initialise atomic pointer
+ inline atomic_ptr_t ()
+ {
+ ptr = NULL;
+ }
+
+ // Destroy atomic pointer
+ inline ~atomic_ptr_t ()
+ {
+ }
+
+ // Set value of atomic pointer in a non-threadsafe way
+ // Use this function only when you are sure that at most one
+ // thread is accessing the pointer at the moment.
+ inline void set (T *ptr_)
+ {
+ this->ptr = ptr_;
+ }
+
+ // Perform atomic 'exchange pointers' operation. Pointer is set
+ // to the 'val' value. Old value is returned.
+ inline T *xchg (T *val_)
+ {
+#if defined ZMQ_ATOMIC_PTR_WINDOWS
+ return (T*) InterlockedExchangePointer ((PVOID*) &ptr, val_);
+#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
+ return (T*) atomic_swap_ptr (&ptr, val_);
+#elif defined ZMQ_ATOMIC_PTR_TILE
+ return (T*) arch_atomic_exchange (&ptr, val_);
+#elif defined ZMQ_ATOMIC_PTR_X86
+ T *old;
+ __asm__ volatile (
+ "lock; xchg %0, %2"
+ : "=r" (old), "=m" (ptr)
+ : "m" (ptr), "0" (val_));
+ return old;
+#elif defined ZMQ_ATOMIC_PTR_ARM
+ T* old;
+ unsigned int flag;
+ __asm__ volatile (
+ " dmb sy\n\t"
+ "1: ldrex %1, [%3]\n\t"
+ " strex %0, %4, [%3]\n\t"
+ " teq %0, #0\n\t"
+ " bne 1b\n\t"
+ " dmb sy\n\t"
+ : "=&r"(flag), "=&r"(old), "+Qo"(ptr)
+ : "r"(&ptr), "r"(val_)
+ : "cc");
+ return old;
+#elif defined ZMQ_ATOMIC_PTR_MUTEX
+ sync.lock ();
+ T *old = (T*) ptr;
+ ptr = val_;
+ sync.unlock ();
+ return old;
+#else
+#error atomic_ptr is not implemented for this platform
+#endif
+ }
+
+ // Perform atomic 'compare and swap' operation on the pointer.
+ // The pointer is compared to 'cmp' argument and if they are
+ // equal, its value is set to 'val'. Old value of the pointer
+ // is returned.
+ inline T *cas (T *cmp_, T *val_)
+ {
+#if defined ZMQ_ATOMIC_PTR_WINDOWS
+ return (T*) InterlockedCompareExchangePointer (
+ (volatile PVOID*) &ptr, val_, cmp_);
+#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
+ return (T*) atomic_cas_ptr (&ptr, cmp_, val_);
+#elif defined ZMQ_ATOMIC_PTR_TILE
+ return (T*) arch_atomic_val_compare_and_exchange (&ptr, cmp_, val_);
+#elif defined ZMQ_ATOMIC_PTR_X86
+ T *old;
+ __asm__ volatile (
+ "lock; cmpxchg %2, %3"
+ : "=a" (old), "=m" (ptr)
+ : "r" (val_), "m" (ptr), "0" (cmp_)
+ : "cc");
+ return old;
+#elif defined ZMQ_ATOMIC_PTR_ARM
+ T *old;
+ unsigned int flag;
+ __asm__ volatile (
+ " dmb sy\n\t"
+ "1: ldrex %1, [%3]\n\t"
+ " mov %0, #0\n\t"
+ " teq %1, %4\n\t"
+ " it eq\n\t"
+ " strexeq %0, %5, [%3]\n\t"
+ " teq %0, #0\n\t"
+ " bne 1b\n\t"
+ " dmb sy\n\t"
+ : "=&r"(flag), "=&r"(old), "+Qo"(ptr)
+ : "r"(&ptr), "r"(cmp_), "r"(val_)
+ : "cc");
+ return old;
+#elif defined ZMQ_ATOMIC_PTR_MUTEX
+ sync.lock ();
+ T *old = (T*) ptr;
+ if (ptr == cmp_)
+ ptr = val_;
+ sync.unlock ();
+ return old;
+#else
+#error atomic_ptr is not implemented for this platform
+#endif
+ }
+
+ private:
+
+ volatile T *ptr;
+#if defined ZMQ_ATOMIC_PTR_MUTEX
+ mutex_t sync;
+#endif
+
+ atomic_ptr_t (const atomic_ptr_t&);
+ const atomic_ptr_t &operator = (const atomic_ptr_t&);
+ };
+
+}
+
+// Remove macros local to this file.
+#if defined ZMQ_ATOMIC_PTR_WINDOWS
+#undef ZMQ_ATOMIC_PTR_WINDOWS
+#endif
+#if defined ZMQ_ATOMIC_PTR_ATOMIC_H
+#undef ZMQ_ATOMIC_PTR_ATOMIC_H
+#endif
+#if defined ZMQ_ATOMIC_PTR_X86
+#undef ZMQ_ATOMIC_PTR_X86
+#endif
+#if defined ZMQ_ATOMIC_PTR_ARM
+#undef ZMQ_ATOMIC_PTR_ARM
+#endif
+#if defined ZMQ_ATOMIC_PTR_MUTEX
+#undef ZMQ_ATOMIC_PTR_MUTEX
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/blob.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/blob.hpp
new file mode 100644
index 00000000..689b60b2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/blob.hpp
@@ -0,0 +1,139 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_BLOB_HPP_INCLUDED__
+#define __ZMQ_BLOB_HPP_INCLUDED__
+
+#include <string>
+#include <string.h>
+
+// Borrowed from id3lib_strings.h:
+// They seem to be doing something for MSC, but since I only have gcc, I'll just do that
+// Assuming this is uneccessary on GCC 4
+// #if (defined(__GNUC__) && (__GNUC__ >= 3) || (defined(_MSC_VER) && _MSC_VER > 1000))
+#if (defined(__GNUC__) && (__GNUC__ >= 3) && (__GNUC__ <= 4))
+namespace std
+{
+ template<>
+ struct char_traits<unsigned char>
+ {
+ typedef unsigned char char_type;
+ // Unsigned as wint_t in unsigned.
+ typedef unsigned long int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (!eq(__s1[__i], __s2[__i]))
+ return lt(__s1[__i], __s2[__i]) ? -1 : 1;
+ return 0;
+ }
+
+ static size_t
+ length(const char_type* __s)
+ {
+ const char_type* __p = __s;
+ while (__p)
+ ++__p;
+ return (__p - __s);
+ }
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a)
+ {
+ for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
+ if (*__p == __a) return __p;
+ return 0;
+ }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n)
+ { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a)
+ {
+ for (char_type* __p = __s; __p < __s + __n; ++__p)
+ assign(*__p, __a);
+ return __s;
+ }
+
+ static char_type
+ to_char_type(const int_type& __c)
+ { return char_type(__c); }
+
+ static int_type
+ to_int_type(const char_type& __c) { return int_type(__c); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type
+ eof() { return static_cast<int_type>(-1); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return eq_int_type(__c, eof()) ? int_type(0) : __c; }
+ };
+
+} // namespace std
+#endif // GCC version 3
+
+
+namespace zmq
+{
+
+ // Object to hold dynamically allocated opaque binary data.
+ typedef std::basic_string <unsigned char> blob_t;
+
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/clock.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/clock.cpp
new file mode 100644
index 00000000..dab08793
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/clock.cpp
@@ -0,0 +1,210 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "clock.hpp"
+#include "platform.hpp"
+#include "likely.hpp"
+#include "config.hpp"
+#include "err.hpp"
+#include "mutex.hpp"
+
+#include <stddef.h>
+
+#if defined _MSC_VER
+#if defined _WIN32_WCE
+#include <cmnintrin.h>
+#else
+#include <intrin.h>
+#endif
+#endif
+
+#if !defined ZMQ_HAVE_WINDOWS
+#include <sys/time.h>
+#endif
+
+#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETHRTIME
+#include <time.h>
+#endif
+
+#ifdef ZMQ_HAVE_WINDOWS
+typedef ULONGLONG (*f_compatible_get_tick_count64)();
+
+static zmq::mutex_t compatible_get_tick_count64_mutex;
+
+ULONGLONG compatible_get_tick_count64()
+{
+ compatible_get_tick_count64_mutex.lock();
+ static DWORD s_wrap = 0;
+ static DWORD s_last_tick = 0;
+ const DWORD current_tick = ::GetTickCount();
+ if (current_tick < s_last_tick)
+ ++s_wrap;
+
+ s_last_tick = current_tick;
+ const ULONGLONG result = (static_cast<ULONGLONG>(s_wrap) << 32) + static_cast<ULONGLONG>(current_tick);
+ compatible_get_tick_count64_mutex.unlock();
+ return result;
+}
+
+f_compatible_get_tick_count64 init_compatible_get_tick_count64()
+{
+ f_compatible_get_tick_count64 func = NULL;
+ HMODULE module = ::LoadLibraryA("Kernel32.dll");
+ if (module != NULL)
+ func = reinterpret_cast<f_compatible_get_tick_count64>(::GetProcAddress(module, "GetTickCount64"));
+
+ if (func == NULL)
+ func = compatible_get_tick_count64;
+
+ return func;
+}
+
+static f_compatible_get_tick_count64 my_get_tick_count64 = init_compatible_get_tick_count64();
+#endif
+
+zmq::clock_t::clock_t () :
+ last_tsc (rdtsc ()),
+#ifdef ZMQ_HAVE_WINDOWS
+ last_time (static_cast<uint64_t>((*my_get_tick_count64)()))
+#else
+ last_time (now_us () / 1000)
+#endif
+{
+}
+
+zmq::clock_t::~clock_t ()
+{
+}
+
+uint64_t zmq::clock_t::now_us ()
+{
+#if defined ZMQ_HAVE_WINDOWS
+
+ // Get the high resolution counter's accuracy.
+ LARGE_INTEGER ticksPerSecond;
+ QueryPerformanceFrequency (&ticksPerSecond);
+
+ // What time is it?
+ LARGE_INTEGER tick;
+ QueryPerformanceCounter (&tick);
+
+ // Convert the tick number into the number of seconds
+ // since the system was started.
+ double ticks_div = ticksPerSecond.QuadPart / 1000000.0;
+ return (uint64_t) (tick.QuadPart / ticks_div);
+
+#elif defined HAVE_CLOCK_GETTIME && defined CLOCK_MONOTONIC
+
+ // Use POSIX clock_gettime function to get precise monotonic time.
+ struct timespec tv;
+ int rc = clock_gettime (CLOCK_MONOTONIC, &tv);
+ // Fix case where system has clock_gettime but CLOCK_MONOTONIC is not supported.
+ // This should be a configuration check, but I looked into it and writing an
+ // AC_FUNC_CLOCK_MONOTONIC seems beyond my powers.
+ if( rc != 0) {
+ // Use POSIX gettimeofday function to get precise time.
+ struct timeval tv;
+ int rc = gettimeofday (&tv, NULL);
+ errno_assert (rc == 0);
+ return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_usec);
+ }
+ return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_nsec / 1000);
+
+#elif defined HAVE_GETHRTIME
+
+ return (gethrtime () / 1000);
+
+#else
+
+ // Use POSIX gettimeofday function to get precise time.
+ struct timeval tv;
+ int rc = gettimeofday (&tv, NULL);
+ errno_assert (rc == 0);
+ return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_usec);
+
+#endif
+}
+
+uint64_t zmq::clock_t::now_ms ()
+{
+ uint64_t tsc = rdtsc ();
+
+ // If TSC is not supported, get precise time and chop off the microseconds.
+ if (!tsc)
+ {
+#ifdef ZMQ_HAVE_WINDOWS
+ // Under Windows, now_us is not so reliable since QueryPerformanceCounter
+ // does not guarantee that it will use a hardware that offers a monotonic timer.
+ // So, lets use GetTickCount when GetTickCount64 is not available with an workaround
+ // to its 32 bit limitation.
+ return static_cast<uint64_t>((*my_get_tick_count64)());
+#else
+ return now_us () / 1000;
+#endif
+ }
+
+ // If TSC haven't jumped back (in case of migration to a different
+ // CPU core) and if not too much time elapsed since last measurement,
+ // we can return cached time value.
+ if (likely (tsc - last_tsc <= (clock_precision / 2) && tsc >= last_tsc))
+ return last_time;
+
+ last_tsc = tsc;
+#ifdef ZMQ_HAVE_WINDOWS
+ last_time = static_cast<uint64_t>((*my_get_tick_count64)());
+#else
+ last_time = now_us () / 1000;
+#endif
+ return last_time;
+}
+
+uint64_t zmq::clock_t::rdtsc ()
+{
+#if (defined _MSC_VER && (defined _M_IX86 || defined _M_X64))
+ return __rdtsc ();
+#elif (defined __GNUC__ && (defined __i386__ || defined __x86_64__))
+ uint32_t low, high;
+ __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
+ return (uint64_t) high << 32 | low;
+#elif (defined __SUNPRO_CC && (__SUNPRO_CC >= 0x5100) && (defined __i386 || \
+ defined __amd64 || defined __x86_64))
+ union {
+ uint64_t u64val;
+ uint32_t u32val [2];
+ } tsc;
+ asm("rdtsc" : "=a" (tsc.u32val [0]), "=d" (tsc.u32val [1]));
+ return tsc.u64val;
+#elif defined(__s390__)
+ uint64_t tsc;
+ asm("\tstck\t%0\n" : "=Q" (tsc) : : "cc");
+ return(tsc);
+#else
+ return 0;
+#endif
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/clock.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/clock.hpp
new file mode 100644
index 00000000..f56f618e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/clock.hpp
@@ -0,0 +1,69 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_CLOCK_HPP_INCLUDED__
+#define __ZMQ_CLOCK_HPP_INCLUDED__
+
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ class clock_t
+ {
+ public:
+
+ clock_t ();
+ ~clock_t ();
+
+ // CPU's timestamp counter. Returns 0 if it's not available.
+ static uint64_t rdtsc ();
+
+ // High precision timestamp.
+ static uint64_t now_us ();
+
+ // Low precision timestamp. In tight loops generating it can be
+ // 10 to 100 times faster than the high precision timestamp.
+ uint64_t now_ms ();
+
+ private:
+
+ // TSC timestamp of when last time measurement was made.
+ uint64_t last_tsc;
+
+ // Physical time corresponding to the TSC above (in milliseconds).
+ uint64_t last_time;
+
+ clock_t (const clock_t&);
+ const clock_t &operator = (const clock_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/command.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/command.hpp
new file mode 100644
index 00000000..a10d8ec1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/command.hpp
@@ -0,0 +1,163 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_COMMAND_HPP_INCLUDED__
+#define __ZMQ_COMMAND_HPP_INCLUDED__
+
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ class object_t;
+ class own_t;
+ struct i_engine;
+ class pipe_t;
+ class socket_base_t;
+
+ // This structure defines the commands that can be sent between threads.
+
+ struct command_t
+ {
+ // Object to process the command.
+ zmq::object_t *destination;
+
+ enum type_t
+ {
+ stop,
+ plug,
+ own,
+ attach,
+ bind,
+ activate_read,
+ activate_write,
+ hiccup,
+ pipe_term,
+ pipe_term_ack,
+ term_req,
+ term,
+ term_ack,
+ reap,
+ reaped,
+ inproc_connected,
+ done
+ } type;
+
+ union {
+
+ // Sent to I/O thread to let it know that it should
+ // terminate itself.
+ struct {
+ } stop;
+
+ // Sent to I/O object to make it register with its I/O thread.
+ struct {
+ } plug;
+
+ // Sent to socket to let it know about the newly created object.
+ struct {
+ zmq::own_t *object;
+ } own;
+
+ // Attach the engine to the session. If engine is NULL, it informs
+ // session that the connection have failed.
+ struct {
+ struct i_engine *engine;
+ } attach;
+
+ // Sent from session to socket to establish pipe(s) between them.
+ // Caller have used inc_seqnum beforehand sending the command.
+ struct {
+ zmq::pipe_t *pipe;
+ } bind;
+
+ // Sent by pipe writer to inform dormant pipe reader that there
+ // are messages in the pipe.
+ struct {
+ } activate_read;
+
+ // Sent by pipe reader to inform pipe writer about how many
+ // messages it has read so far.
+ struct {
+ uint64_t msgs_read;
+ } activate_write;
+
+ // Sent by pipe reader to writer after creating a new inpipe.
+ // The parameter is actually of type pipe_t::upipe_t, however,
+ // its definition is private so we'll have to do with void*.
+ struct {
+ void *pipe;
+ } hiccup;
+
+ // Sent by pipe reader to pipe writer to ask it to terminate
+ // its end of the pipe.
+ struct {
+ } pipe_term;
+
+ // Pipe writer acknowledges pipe_term command.
+ struct {
+ } pipe_term_ack;
+
+ // Sent by I/O object ot the socket to request the shutdown of
+ // the I/O object.
+ struct {
+ zmq::own_t *object;
+ } term_req;
+
+ // Sent by socket to I/O object to start its shutdown.
+ struct {
+ int linger;
+ } term;
+
+ // Sent by I/O object to the socket to acknowledge it has
+ // shut down.
+ struct {
+ } term_ack;
+
+ // Transfers the ownership of the closed socket
+ // to the reaper thread.
+ struct {
+ zmq::socket_base_t *socket;
+ } reap;
+
+ // Closed socket notifies the reaper that it's already deallocated.
+ struct {
+ } reaped;
+
+ // Sent by reaper thread to the term thread when all the sockets
+ // are successfully deallocated.
+ struct {
+ } done;
+
+ } args;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/config.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/config.hpp
new file mode 100644
index 00000000..b483c469
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/config.hpp
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_CONFIG_HPP_INCLUDED__
+#define __ZMQ_CONFIG_HPP_INCLUDED__
+
+namespace zmq
+{
+
+ // Compile-time settings.
+
+ enum
+ {
+ // Number of new messages in message pipe needed to trigger new memory
+ // allocation. Setting this parameter to 256 decreases the impact of
+ // memory allocation by approximately 99.6%
+ message_pipe_granularity = 256,
+
+ // Commands in pipe per allocation event.
+ command_pipe_granularity = 16,
+
+ // Determines how often does socket poll for new commands when it
+ // still has unprocessed messages to handle. Thus, if it is set to 100,
+ // socket will process 100 inbound messages before doing the poll.
+ // If there are no unprocessed messages available, poll is done
+ // immediately. Decreasing the value trades overall latency for more
+ // real-time behaviour (less latency peaks).
+ inbound_poll_rate = 100,
+
+ // Maximal batching size for engines with receiving functionality.
+ // So, if there are 10 messages that fit into the batch size, all of
+ // them may be read by a single 'recv' system call, thus avoiding
+ // unnecessary network stack traversals.
+ in_batch_size = 8192,
+
+ // Maximal batching size for engines with sending functionality.
+ // So, if there are 10 messages that fit into the batch size, all of
+ // them may be written by a single 'send' system call, thus avoiding
+ // unnecessary network stack traversals.
+ out_batch_size = 8192,
+
+ // Maximal delta between high and low watermark.
+ max_wm_delta = 1024,
+
+ // Maximum number of events the I/O thread can process in one go.
+ max_io_events = 256,
+
+ // Maximal delay to process command in API thread (in CPU ticks).
+ // 3,000,000 ticks equals to 1 - 2 milliseconds on current CPUs.
+ // Note that delay is only applied when there is continuous stream of
+ // messages to process. If not so, commands are processed immediately.
+ max_command_delay = 3000000,
+
+ // Low-precision clock precision in CPU ticks. 1ms. Value of 1000000
+ // should be OK for CPU frequencies above 1GHz. If should work
+ // reasonably well for CPU frequencies above 500MHz. For lower CPU
+ // frequencies you may consider lowering this value to get best
+ // possible latencies.
+ clock_precision = 1000000,
+
+ // Maximum transport data unit size for PGM (TPDU).
+ pgm_max_tpdu = 1500,
+
+ // On some OSes the signaler has to be emulated using a TCP
+ // connection. In such cases following port is used.
+ signaler_port = 5905
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ctx.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ctx.cpp
new file mode 100644
index 00000000..0dd3cc48
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ctx.cpp
@@ -0,0 +1,567 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <unistd.h>
+#endif
+
+#include <limits>
+#include <new>
+#include <string.h>
+
+#include "ctx.hpp"
+#include "socket_base.hpp"
+#include "io_thread.hpp"
+#include "reaper.hpp"
+#include "pipe.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+
+#ifdef HAVE_LIBSODIUM
+#ifdef HAVE_TWEETNACL
+#include "randombytes.h"
+#else
+#include "sodium.h"
+#endif
+#endif
+
+#define ZMQ_CTX_TAG_VALUE_GOOD 0xabadcafe
+#define ZMQ_CTX_TAG_VALUE_BAD 0xdeadbeef
+
+int clipped_maxsocket(int max_requested)
+{
+ if (max_requested >= zmq::poller_t::max_fds () && zmq::poller_t::max_fds () != -1)
+ // -1 because we need room for the reaper mailbox.
+ max_requested = zmq::poller_t::max_fds () - 1;
+
+ return max_requested;
+}
+
+zmq::ctx_t::ctx_t () :
+ tag (ZMQ_CTX_TAG_VALUE_GOOD),
+ starting (true),
+ terminating (false),
+ reaper (NULL),
+ slot_count (0),
+ slots (NULL),
+ max_sockets (clipped_maxsocket (ZMQ_MAX_SOCKETS_DFLT)),
+ io_thread_count (ZMQ_IO_THREADS_DFLT),
+ ipv6 (false),
+ thread_priority (ZMQ_THREAD_PRIORITY_DFLT),
+ thread_sched_policy (ZMQ_THREAD_SCHED_POLICY_DFLT)
+{
+#ifdef HAVE_FORK
+ pid = getpid();
+#endif
+}
+
+bool zmq::ctx_t::check_tag ()
+{
+ return tag == ZMQ_CTX_TAG_VALUE_GOOD;
+}
+
+zmq::ctx_t::~ctx_t ()
+{
+ // Check that there are no remaining sockets.
+ zmq_assert (sockets.empty ());
+
+ // Ask I/O threads to terminate. If stop signal wasn't sent to I/O
+ // thread subsequent invocation of destructor would hang-up.
+ for (io_threads_t::size_type i = 0; i != io_threads.size (); i++)
+ io_threads [i]->stop ();
+
+ // Wait till I/O threads actually terminate.
+ for (io_threads_t::size_type i = 0; i != io_threads.size (); i++)
+ delete io_threads [i];
+
+ // Deallocate the reaper thread object.
+ delete reaper;
+
+ // Deallocate the array of mailboxes. No special work is
+ // needed as mailboxes themselves were deallocated with their
+ // corresponding io_thread/socket objects.
+ free (slots);
+
+ // If we've done any Curve encryption, we may have a file handle
+ // to /dev/urandom open that needs to be cleaned up.
+#ifdef HAVE_LIBSODIUM
+ randombytes_close();
+#endif
+
+ // Remove the tag, so that the object is considered dead.
+ tag = ZMQ_CTX_TAG_VALUE_BAD;
+}
+
+int zmq::ctx_t::terminate ()
+{
+ // Connect up any pending inproc connections, otherwise we will hang
+ pending_connections_t copy = pending_connections;
+ for (pending_connections_t::iterator p = copy.begin (); p != copy.end (); ++p) {
+ zmq::socket_base_t *s = create_socket (ZMQ_PAIR);
+ s->bind (p->first.c_str ());
+ s->close ();
+ }
+
+ slot_sync.lock ();
+ if (!starting) {
+
+#ifdef HAVE_FORK
+ if (pid != getpid ()) {
+ // we are a forked child process. Close all file descriptors
+ // inherited from the parent.
+ for (sockets_t::size_type i = 0; i != sockets.size (); i++)
+ sockets [i]->get_mailbox ()->forked ();
+
+ term_mailbox.forked ();
+ }
+#endif
+
+ // Check whether termination was already underway, but interrupted and now
+ // restarted.
+ bool restarted = terminating;
+ terminating = true;
+
+ // First attempt to terminate the context.
+ if (!restarted) {
+ // First send stop command to sockets so that any blocking calls
+ // can be interrupted. If there are no sockets we can ask reaper
+ // thread to stop.
+ for (sockets_t::size_type i = 0; i != sockets.size (); i++)
+ sockets [i]->stop ();
+ if (sockets.empty ())
+ reaper->stop ();
+ }
+ slot_sync.unlock();
+
+ // Wait till reaper thread closes all the sockets.
+ command_t cmd;
+ int rc = term_mailbox.recv (&cmd, -1);
+ if (rc == -1 && errno == EINTR)
+ return -1;
+ errno_assert (rc == 0);
+ zmq_assert (cmd.type == command_t::done);
+ slot_sync.lock ();
+ zmq_assert (sockets.empty ());
+ }
+ slot_sync.unlock ();
+
+ // Deallocate the resources.
+ delete this;
+
+ return 0;
+}
+
+int zmq::ctx_t::shutdown ()
+{
+ slot_sync.lock ();
+ if (!starting && !terminating) {
+ terminating = true;
+
+ // Send stop command to sockets so that any blocking calls
+ // can be interrupted. If there are no sockets we can ask reaper
+ // thread to stop.
+ for (sockets_t::size_type i = 0; i != sockets.size (); i++)
+ sockets [i]->stop ();
+ if (sockets.empty ())
+ reaper->stop ();
+ }
+ slot_sync.unlock ();
+
+ return 0;
+}
+
+int zmq::ctx_t::set (int option_, int optval_)
+{
+ int rc = 0;
+ if (option_ == ZMQ_MAX_SOCKETS
+ && optval_ >= 1 && optval_ == clipped_maxsocket (optval_)) {
+ opt_sync.lock ();
+ max_sockets = optval_;
+ opt_sync.unlock ();
+ }
+ else
+ if (option_ == ZMQ_IO_THREADS && optval_ >= 0) {
+ opt_sync.lock ();
+ io_thread_count = optval_;
+ opt_sync.unlock ();
+ }
+ else
+ if (option_ == ZMQ_IPV6 && optval_ >= 0) {
+ opt_sync.lock ();
+ ipv6 = (optval_ != 0);
+ opt_sync.unlock ();
+ }
+ else
+ if (option_ == ZMQ_THREAD_PRIORITY && optval_ >= 0) {
+ opt_sync.lock();
+ thread_priority = optval_;
+ opt_sync.unlock();
+ }
+ else
+ if (option_ == ZMQ_THREAD_SCHED_POLICY && optval_ >= 0) {
+ opt_sync.lock();
+ thread_sched_policy = optval_;
+ opt_sync.unlock();
+ }
+ else {
+ errno = EINVAL;
+ rc = -1;
+ }
+ return rc;
+}
+
+int zmq::ctx_t::get (int option_)
+{
+ int rc = 0;
+ if (option_ == ZMQ_MAX_SOCKETS)
+ rc = max_sockets;
+ else
+ if (option_ == ZMQ_SOCKET_LIMIT)
+ rc = clipped_maxsocket (65535);
+ else
+ if (option_ == ZMQ_IO_THREADS)
+ rc = io_thread_count;
+ else
+ if (option_ == ZMQ_IPV6)
+ rc = ipv6;
+ else {
+ errno = EINVAL;
+ rc = -1;
+ }
+ return rc;
+}
+
+zmq::socket_base_t *zmq::ctx_t::create_socket (int type_)
+{
+ slot_sync.lock ();
+ if (unlikely (starting)) {
+
+ starting = false;
+ // Initialise the array of mailboxes. Additional three slots are for
+ // zmq_ctx_term thread and reaper thread.
+ opt_sync.lock ();
+ int mazmq = max_sockets;
+ int ios = io_thread_count;
+ opt_sync.unlock ();
+ slot_count = mazmq + ios + 2;
+ slots = (mailbox_t **) malloc (sizeof (mailbox_t*) * slot_count);
+ alloc_assert (slots);
+
+ // Initialise the infrastructure for zmq_ctx_term thread.
+ slots [term_tid] = &term_mailbox;
+
+ // Create the reaper thread.
+ reaper = new (std::nothrow) reaper_t (this, reaper_tid);
+ alloc_assert (reaper);
+ slots [reaper_tid] = reaper->get_mailbox ();
+ reaper->start ();
+
+ // Create I/O thread objects and launch them.
+ for (int i = 2; i != ios + 2; i++) {
+ io_thread_t *io_thread = new (std::nothrow) io_thread_t (this, i);
+ alloc_assert (io_thread);
+ io_threads.push_back (io_thread);
+ slots [i] = io_thread->get_mailbox ();
+ io_thread->start ();
+ }
+
+ // In the unused part of the slot array, create a list of empty slots.
+ for (int32_t i = (int32_t) slot_count - 1;
+ i >= (int32_t) ios + 2; i--) {
+ empty_slots.push_back (i);
+ slots [i] = NULL;
+ }
+ }
+
+ // Once zmq_ctx_term() was called, we can't create new sockets.
+ if (terminating) {
+ slot_sync.unlock ();
+ errno = ETERM;
+ return NULL;
+ }
+
+ // If max_sockets limit was reached, return error.
+ if (empty_slots.empty ()) {
+ slot_sync.unlock ();
+ errno = EMFILE;
+ return NULL;
+ }
+
+ // Choose a slot for the socket.
+ uint32_t slot = empty_slots.back ();
+ empty_slots.pop_back ();
+
+ // Generate new unique socket ID.
+ int sid = ((int) max_socket_id.add (1)) + 1;
+
+ // Create the socket and register its mailbox.
+ socket_base_t *s = socket_base_t::create (type_, this, slot, sid);
+ if (!s) {
+ empty_slots.push_back (slot);
+ slot_sync.unlock ();
+ return NULL;
+ }
+ sockets.push_back (s);
+ slots [slot] = s->get_mailbox ();
+
+ slot_sync.unlock ();
+ return s;
+}
+
+void zmq::ctx_t::destroy_socket (class socket_base_t *socket_)
+{
+ slot_sync.lock ();
+
+ // Free the associated thread slot.
+ uint32_t tid = socket_->get_tid ();
+ empty_slots.push_back (tid);
+ slots [tid] = NULL;
+
+ // Remove the socket from the list of sockets.
+ sockets.erase (socket_);
+
+ // If zmq_ctx_term() was already called and there are no more socket
+ // we can ask reaper thread to terminate.
+ if (terminating && sockets.empty ())
+ reaper->stop ();
+
+ slot_sync.unlock ();
+}
+
+zmq::object_t *zmq::ctx_t::get_reaper ()
+{
+ return reaper;
+}
+
+void zmq::ctx_t::start_thread (thread_t &thread_, thread_fn *tfn_, void *arg_) const
+{
+ thread_.start(tfn_, arg_);
+ thread_.setSchedulingParameters(thread_priority, thread_sched_policy);
+}
+
+void zmq::ctx_t::send_command (uint32_t tid_, const command_t &command_)
+{
+ slots [tid_]->send (command_);
+}
+
+zmq::io_thread_t *zmq::ctx_t::choose_io_thread (uint64_t affinity_)
+{
+ if (io_threads.empty ())
+ return NULL;
+
+ // Find the I/O thread with minimum load.
+ int min_load = -1;
+ io_thread_t *selected_io_thread = NULL;
+ for (io_threads_t::size_type i = 0; i != io_threads.size (); i++) {
+ if (!affinity_ || (affinity_ & (uint64_t (1) << i))) {
+ int load = io_threads [i]->get_load ();
+ if (selected_io_thread == NULL || load < min_load) {
+ min_load = load;
+ selected_io_thread = io_threads [i];
+ }
+ }
+ }
+ return selected_io_thread;
+}
+
+int zmq::ctx_t::register_endpoint (const char *addr_,
+ const endpoint_t &endpoint_)
+{
+ endpoints_sync.lock ();
+
+ const bool inserted = endpoints.insert (
+ endpoints_t::value_type (std::string (addr_), endpoint_)).second;
+
+ endpoints_sync.unlock ();
+
+ if (!inserted) {
+ errno = EADDRINUSE;
+ return -1;
+ }
+ return 0;
+}
+
+int zmq::ctx_t::unregister_endpoint (
+ const std::string &addr_, socket_base_t *socket_)
+{
+ endpoints_sync.lock ();
+
+ const endpoints_t::iterator it = endpoints.find (addr_);
+ if (it == endpoints.end () || it->second.socket != socket_) {
+ endpoints_sync.unlock ();
+ errno = ENOENT;
+ return -1;
+ }
+
+ // Remove endpoint.
+ endpoints.erase (it);
+
+ endpoints_sync.unlock ();
+
+ return 0;
+}
+
+void zmq::ctx_t::unregister_endpoints (socket_base_t *socket_)
+{
+ endpoints_sync.lock ();
+
+ endpoints_t::iterator it = endpoints.begin ();
+ while (it != endpoints.end ()) {
+ if (it->second.socket == socket_) {
+ endpoints_t::iterator to_erase = it;
+ ++it;
+ endpoints.erase (to_erase);
+ continue;
+ }
+ ++it;
+ }
+
+ endpoints_sync.unlock ();
+}
+
+zmq::endpoint_t zmq::ctx_t::find_endpoint (const char *addr_)
+{
+ endpoints_sync.lock ();
+
+ endpoints_t::iterator it = endpoints.find (addr_);
+ if (it == endpoints.end ()) {
+ endpoints_sync.unlock ();
+ errno = ECONNREFUSED;
+ endpoint_t empty = {NULL, options_t()};
+ return empty;
+ }
+ endpoint_t endpoint = it->second;
+
+ // Increment the command sequence number of the peer so that it won't
+ // get deallocated until "bind" command is issued by the caller.
+ // The subsequent 'bind' has to be called with inc_seqnum parameter
+ // set to false, so that the seqnum isn't incremented twice.
+ endpoint.socket->inc_seqnum ();
+
+ endpoints_sync.unlock ();
+ return endpoint;
+}
+
+void zmq::ctx_t::pend_connection (const std::string &addr_,
+ const endpoint_t &endpoint_, pipe_t **pipes_)
+{
+ const pending_connection_t pending_connection =
+ {endpoint_, pipes_ [0], pipes_ [1]};
+
+ endpoints_sync.lock ();
+
+ endpoints_t::iterator it = endpoints.find (addr_);
+ if (it == endpoints.end ()) {
+ // Still no bind.
+ endpoint_.socket->inc_seqnum ();
+ pending_connections.insert (pending_connections_t::value_type (addr_, pending_connection));
+ }
+ else
+ // Bind has happened in the mean time, connect directly
+ connect_inproc_sockets (it->second.socket, it->second.options, pending_connection, connect_side);
+
+ endpoints_sync.unlock ();
+}
+
+void zmq::ctx_t::connect_pending (const char *addr_, zmq::socket_base_t *bind_socket_)
+{
+ endpoints_sync.lock ();
+
+ std::pair<pending_connections_t::iterator, pending_connections_t::iterator> pending = pending_connections.equal_range(addr_);
+
+ for (pending_connections_t::iterator p = pending.first; p != pending.second; ++p)
+ connect_inproc_sockets(bind_socket_, endpoints[addr_].options, p->second, bind_side);
+
+ pending_connections.erase(pending.first, pending.second);
+ endpoints_sync.unlock ();
+}
+
+void zmq::ctx_t::connect_inproc_sockets (zmq::socket_base_t *bind_socket_,
+ options_t& bind_options, const pending_connection_t &pending_connection_, side side_)
+{
+ bind_socket_->inc_seqnum();
+ pending_connection_.bind_pipe->set_tid (bind_socket_->get_tid ());
+
+ if (!bind_options.recv_identity) {
+ msg_t msg;
+ const bool ok = pending_connection_.bind_pipe->read (&msg);
+ zmq_assert (ok);
+ const int rc = msg.close ();
+ errno_assert (rc == 0);
+ }
+
+
+ int sndhwm = 0;
+ if (pending_connection_.endpoint.options.sndhwm != 0 && bind_options.rcvhwm != 0)
+ sndhwm = pending_connection_.endpoint.options.sndhwm + bind_options.rcvhwm;
+
+ int rcvhwm = 0;
+ if (pending_connection_.endpoint.options.rcvhwm != 0 && bind_options.sndhwm != 0)
+ rcvhwm = pending_connection_.endpoint.options.rcvhwm + bind_options.sndhwm;
+
+ bool conflate = pending_connection_.endpoint.options.conflate &&
+ (pending_connection_.endpoint.options.type == ZMQ_DEALER ||
+ pending_connection_.endpoint.options.type == ZMQ_PULL ||
+ pending_connection_.endpoint.options.type == ZMQ_PUSH ||
+ pending_connection_.endpoint.options.type == ZMQ_PUB ||
+ pending_connection_.endpoint.options.type == ZMQ_SUB);
+
+ int hwms [2] = {conflate? -1 : sndhwm, conflate? -1 : rcvhwm};
+ pending_connection_.connect_pipe->set_hwms(hwms [1], hwms [0]);
+ pending_connection_.bind_pipe->set_hwms(hwms [0], hwms [1]);
+
+ if (side_ == bind_side) {
+ command_t cmd;
+ cmd.type = command_t::bind;
+ cmd.args.bind.pipe = pending_connection_.bind_pipe;
+ bind_socket_->process_command (cmd);
+ bind_socket_->send_inproc_connected (pending_connection_.endpoint.socket);
+ }
+ else
+ pending_connection_.connect_pipe->send_bind (bind_socket_, pending_connection_.bind_pipe, false);
+
+ if (pending_connection_.endpoint.options.recv_identity) {
+ msg_t id;
+ int rc = id.init_size (bind_options.identity_size);
+ errno_assert (rc == 0);
+ memcpy (id.data (), bind_options.identity, bind_options.identity_size);
+ id.set_flags (msg_t::identity);
+ bool written = pending_connection_.bind_pipe->write (&id);
+ zmq_assert (written);
+ pending_connection_.bind_pipe->flush ();
+ }
+}
+
+// The last used socket ID, or 0 if no socket was used so far. Note that this
+// is a global variable. Thus, even sockets created in different contexts have
+// unique IDs.
+zmq::atomic_counter_t zmq::ctx_t::max_socket_id;
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ctx.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ctx.hpp
new file mode 100644
index 00000000..dd397abe
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ctx.hpp
@@ -0,0 +1,223 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_CTX_HPP_INCLUDED__
+#define __ZMQ_CTX_HPP_INCLUDED__
+
+#include <map>
+#include <vector>
+#include <string>
+#include <stdarg.h>
+
+#include "mailbox.hpp"
+#include "array.hpp"
+#include "config.hpp"
+#include "mutex.hpp"
+#include "stdint.hpp"
+#include "options.hpp"
+#include "atomic_counter.hpp"
+#include "thread.hpp"
+
+namespace zmq
+{
+
+ class object_t;
+ class io_thread_t;
+ class socket_base_t;
+ class reaper_t;
+ class pipe_t;
+
+ // Information associated with inproc endpoint. Note that endpoint options
+ // are registered as well so that the peer can access them without a need
+ // for synchronisation, handshaking or similar.
+ struct endpoint_t
+ {
+ socket_base_t *socket;
+ options_t options;
+ };
+
+ // Context object encapsulates all the global state associated with
+ // the library.
+
+ class ctx_t
+ {
+ public:
+
+ // Create the context object.
+ ctx_t ();
+
+ // Returns false if object is not a context.
+ bool check_tag ();
+
+ // This function is called when user invokes zmq_term. If there are
+ // no more sockets open it'll cause all the infrastructure to be shut
+ // down. If there are open sockets still, the deallocation happens
+ // after the last one is closed.
+ int terminate ();
+
+ // This function starts the terminate process by unblocking any blocking
+ // operations currently in progress and stopping any more socket activity
+ // (except zmq_close).
+ // This function is non-blocking.
+ // terminate must still be called afterwards.
+ // This function is optional, terminate will unblock any current
+ // operations as well.
+ int shutdown();
+
+ // Set and get context properties.
+ int set (int option_, int optval_);
+ int get (int option_);
+
+ // Create and destroy a socket.
+ zmq::socket_base_t *create_socket (int type_);
+ void destroy_socket (zmq::socket_base_t *socket_);
+
+ // Start a new thread with proper scheduling parameters.
+ void start_thread (thread_t &thread_, thread_fn *tfn_, void *arg_) const;
+
+ // Send command to the destination thread.
+ void send_command (uint32_t tid_, const command_t &command_);
+
+ // Returns the I/O thread that is the least busy at the moment.
+ // Affinity specifies which I/O threads are eligible (0 = all).
+ // Returns NULL if no I/O thread is available.
+ zmq::io_thread_t *choose_io_thread (uint64_t affinity_);
+
+ // Returns reaper thread object.
+ zmq::object_t *get_reaper ();
+
+ // Management of inproc endpoints.
+ int register_endpoint (const char *addr_, const endpoint_t &endpoint_);
+ int unregister_endpoint (const std::string &addr_, socket_base_t *socket_);
+ void unregister_endpoints (zmq::socket_base_t *socket_);
+ endpoint_t find_endpoint (const char *addr_);
+ void pend_connection (const std::string &addr_,
+ const endpoint_t &endpoint_, pipe_t **pipes_);
+ void connect_pending (const char *addr_, zmq::socket_base_t *bind_socket_);
+
+ enum {
+ term_tid = 0,
+ reaper_tid = 1
+ };
+
+ ~ctx_t ();
+
+ private:
+
+ struct pending_connection_t
+ {
+ endpoint_t endpoint;
+ pipe_t* connect_pipe;
+ pipe_t* bind_pipe;
+ };
+
+ // Used to check whether the object is a context.
+ uint32_t tag;
+
+ // Sockets belonging to this context. We need the list so that
+ // we can notify the sockets when zmq_term() is called. The sockets
+ // will return ETERM then.
+ typedef array_t <socket_base_t> sockets_t;
+ sockets_t sockets;
+
+ // List of unused thread slots.
+ typedef std::vector <uint32_t> empty_slots_t;
+ empty_slots_t empty_slots;
+
+ // If true, zmq_init has been called but no socket has been created
+ // yet. Launching of I/O threads is delayed.
+ bool starting;
+
+ // If true, zmq_term was already called.
+ bool terminating;
+
+ // Synchronisation of accesses to global slot-related data:
+ // sockets, empty_slots, terminating. It also synchronises
+ // access to zombie sockets as such (as opposed to slots) and provides
+ // a memory barrier to ensure that all CPU cores see the same data.
+ mutex_t slot_sync;
+
+ // The reaper thread.
+ zmq::reaper_t *reaper;
+
+ // I/O threads.
+ typedef std::vector <zmq::io_thread_t*> io_threads_t;
+ io_threads_t io_threads;
+
+ // Array of pointers to mailboxes for both application and I/O threads.
+ uint32_t slot_count;
+ mailbox_t **slots;
+
+ // Mailbox for zmq_term thread.
+ mailbox_t term_mailbox;
+
+ // List of inproc endpoints within this context.
+ typedef std::map <std::string, endpoint_t> endpoints_t;
+ endpoints_t endpoints;
+
+ // List of inproc connection endpoints pending a bind
+ typedef std::multimap <std::string, pending_connection_t> pending_connections_t;
+ pending_connections_t pending_connections;
+
+ // Synchronisation of access to the list of inproc endpoints.
+ mutex_t endpoints_sync;
+
+ // Maximum socket ID.
+ static atomic_counter_t max_socket_id;
+
+ // Maximum number of sockets that can be opened at the same time.
+ int max_sockets;
+
+ // Number of I/O threads to launch.
+ int io_thread_count;
+
+ // Is IPv6 enabled on this context?
+ bool ipv6;
+
+ // Thread scheduling parameters.
+ int thread_priority;
+ int thread_sched_policy;
+
+ // Synchronisation of access to context options.
+ mutex_t opt_sync;
+
+ ctx_t (const ctx_t&);
+ const ctx_t &operator = (const ctx_t&);
+
+#ifdef HAVE_FORK
+ // the process that created this context. Used to detect forking.
+ pid_t pid;
+#endif
+ enum side { connect_side, bind_side };
+ void connect_inproc_sockets(zmq::socket_base_t *bind_socket_, options_t& bind_options, const pending_connection_t &pending_connection_, side side_);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_client.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_client.cpp
new file mode 100644
index 00000000..842e504a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_client.cpp
@@ -0,0 +1,459 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#ifdef HAVE_LIBSODIUM
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "msg.hpp"
+#include "session_base.hpp"
+#include "err.hpp"
+#include "curve_client.hpp"
+#include "wire.hpp"
+
+zmq::curve_client_t::curve_client_t (const options_t &options_) :
+ mechanism_t (options_),
+ state (send_hello),
+ cn_nonce(1),
+ cn_peer_nonce(1),
+ sync()
+{
+ memcpy (public_key, options_.curve_public_key, crypto_box_PUBLICKEYBYTES);
+ memcpy (secret_key, options_.curve_secret_key, crypto_box_SECRETKEYBYTES);
+ memcpy (server_key, options_.curve_server_key, crypto_box_PUBLICKEYBYTES);
+ scoped_lock_t lock (sync);
+#if defined(HAVE_TWEETNACL)
+ // allow opening of /dev/urandom
+ unsigned char tmpbytes[4];
+ randombytes(tmpbytes, 4);
+#else
+ // todo check return code
+ sodium_init();
+#endif
+
+ // Generate short-term key pair
+ const int rc = crypto_box_keypair (cn_public, cn_secret);
+ zmq_assert (rc == 0);
+}
+
+zmq::curve_client_t::~curve_client_t ()
+{
+}
+
+int zmq::curve_client_t::next_handshake_command (msg_t *msg_)
+{
+ int rc = 0;
+
+ switch (state) {
+ case send_hello:
+ rc = produce_hello (msg_);
+ if (rc == 0)
+ state = expect_welcome;
+ break;
+ case send_initiate:
+ rc = produce_initiate (msg_);
+ if (rc == 0)
+ state = expect_ready;
+ break;
+ default:
+ errno = EAGAIN;
+ rc = -1;
+ }
+ return rc;
+}
+
+int zmq::curve_client_t::process_handshake_command (msg_t *msg_)
+{
+ const unsigned char *msg_data =
+ static_cast <unsigned char *> (msg_->data ());
+ const size_t msg_size = msg_->size ();
+
+ int rc = 0;
+ if (msg_size >= 8 && !memcmp (msg_data, "\7WELCOME", 8))
+ rc = process_welcome (msg_data, msg_size);
+ else
+ if (msg_size >= 6 && !memcmp (msg_data, "\5READY", 6))
+ rc = process_ready (msg_data, msg_size);
+ else
+ if (msg_size >= 6 && !memcmp (msg_data, "\5ERROR", 6))
+ rc = process_error (msg_data, msg_size);
+ else {
+ errno = EPROTO;
+ rc = -1;
+ }
+
+ if (rc == 0) {
+ rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ }
+
+ return rc;
+}
+
+int zmq::curve_client_t::encode (msg_t *msg_)
+{
+ zmq_assert (state == connected);
+
+ uint8_t flags = 0;
+ if (msg_->flags () & msg_t::more)
+ flags |= 0x01;
+
+ uint8_t message_nonce [crypto_box_NONCEBYTES];
+ memcpy (message_nonce, "CurveZMQMESSAGEC", 16);
+ put_uint64 (message_nonce + 16, cn_nonce);
+
+ const size_t mlen = crypto_box_ZEROBYTES + 1 + msg_->size ();
+
+ uint8_t *message_plaintext = static_cast <uint8_t *> (malloc (mlen));
+ alloc_assert (message_plaintext);
+
+ memset (message_plaintext, 0, crypto_box_ZEROBYTES);
+ message_plaintext [crypto_box_ZEROBYTES] = flags;
+ memcpy (message_plaintext + crypto_box_ZEROBYTES + 1,
+ msg_->data (), msg_->size ());
+
+ uint8_t *message_box = static_cast <uint8_t *> (malloc (mlen));
+ alloc_assert (message_box);
+
+ int rc = crypto_box_afternm (message_box, message_plaintext,
+ mlen, message_nonce, cn_precom);
+ zmq_assert (rc == 0);
+
+ rc = msg_->close ();
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (16 + mlen - crypto_box_BOXZEROBYTES);
+ zmq_assert (rc == 0);
+
+ uint8_t *message = static_cast <uint8_t *> (msg_->data ());
+
+ memcpy (message, "\x07MESSAGE", 8);
+ memcpy (message + 8, message_nonce + 16, 8);
+ memcpy (message + 16, message_box + crypto_box_BOXZEROBYTES,
+ mlen - crypto_box_BOXZEROBYTES);
+
+ free (message_plaintext);
+ free (message_box);
+
+ cn_nonce++;
+
+ return 0;
+}
+
+int zmq::curve_client_t::decode (msg_t *msg_)
+{
+ zmq_assert (state == connected);
+
+ if (msg_->size () < 33) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ const uint8_t *message = static_cast <uint8_t *> (msg_->data ());
+ if (memcmp (message, "\x07MESSAGE", 8)) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ uint8_t message_nonce [crypto_box_NONCEBYTES];
+ memcpy (message_nonce, "CurveZMQMESSAGES", 16);
+ memcpy (message_nonce + 16, message + 8, 8);
+ uint64_t nonce = get_uint64(message + 8);
+ if (nonce <= cn_peer_nonce) {
+ errno = EPROTO;
+ return -1;
+ }
+ cn_peer_nonce = nonce;
+
+
+ const size_t clen = crypto_box_BOXZEROBYTES + (msg_->size () - 16);
+
+ uint8_t *message_plaintext = static_cast <uint8_t *> (malloc (clen));
+ alloc_assert (message_plaintext);
+
+ uint8_t *message_box = static_cast <uint8_t *> (malloc (clen));
+ alloc_assert (message_box);
+
+ memset (message_box, 0, crypto_box_BOXZEROBYTES);
+ memcpy (message_box + crypto_box_BOXZEROBYTES,
+ message + 16, msg_->size () - 16);
+
+ int rc = crypto_box_open_afternm (message_plaintext, message_box,
+ clen, message_nonce, cn_precom);
+ if (rc == 0) {
+ rc = msg_->close ();
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (clen - 1 - crypto_box_ZEROBYTES);
+ zmq_assert (rc == 0);
+
+ const uint8_t flags = message_plaintext [crypto_box_ZEROBYTES];
+ if (flags & 0x01)
+ msg_->set_flags (msg_t::more);
+
+ memcpy (msg_->data (),
+ message_plaintext + crypto_box_ZEROBYTES + 1,
+ msg_->size ());
+ }
+ else
+ errno = EPROTO;
+
+ free (message_plaintext);
+ free (message_box);
+
+ return rc;
+}
+
+zmq::mechanism_t::status_t zmq::curve_client_t::status () const
+{
+ if (state == connected)
+ return mechanism_t::ready;
+ else
+ if (state == error_received)
+ return mechanism_t::error;
+ else
+ return mechanism_t::handshaking;
+}
+
+int zmq::curve_client_t::produce_hello (msg_t *msg_)
+{
+ uint8_t hello_nonce [crypto_box_NONCEBYTES];
+ uint8_t hello_plaintext [crypto_box_ZEROBYTES + 64];
+ uint8_t hello_box [crypto_box_BOXZEROBYTES + 80];
+
+ // Prepare the full nonce
+ memcpy (hello_nonce, "CurveZMQHELLO---", 16);
+ put_uint64 (hello_nonce + 16, cn_nonce);
+
+ // Create Box [64 * %x0](C'->S)
+ memset (hello_plaintext, 0, sizeof hello_plaintext);
+
+ int rc = crypto_box (hello_box, hello_plaintext,
+ sizeof hello_plaintext,
+ hello_nonce, server_key, cn_secret);
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (200);
+ errno_assert (rc == 0);
+ uint8_t *hello = static_cast <uint8_t *> (msg_->data ());
+
+ memcpy (hello, "\x05HELLO", 6);
+ // CurveZMQ major and minor version numbers
+ memcpy (hello + 6, "\1\0", 2);
+ // Anti-amplification padding
+ memset (hello + 8, 0, 72);
+ // Client public connection key
+ memcpy (hello + 80, cn_public, crypto_box_PUBLICKEYBYTES);
+ // Short nonce, prefixed by "CurveZMQHELLO---"
+ memcpy (hello + 112, hello_nonce + 16, 8);
+ // Signature, Box [64 * %x0](C'->S)
+ memcpy (hello + 120, hello_box + crypto_box_BOXZEROBYTES, 80);
+
+ cn_nonce++;
+
+ return 0;
+}
+
+int zmq::curve_client_t::process_welcome (
+ const uint8_t *msg_data, size_t msg_size)
+{
+ if (msg_size != 168) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ uint8_t welcome_nonce [crypto_box_NONCEBYTES];
+ uint8_t welcome_plaintext [crypto_box_ZEROBYTES + 128];
+ uint8_t welcome_box [crypto_box_BOXZEROBYTES + 144];
+
+ // Open Box [S' + cookie](C'->S)
+ memset (welcome_box, 0, crypto_box_BOXZEROBYTES);
+ memcpy (welcome_box + crypto_box_BOXZEROBYTES, msg_data + 24, 144);
+
+ memcpy (welcome_nonce, "WELCOME-", 8);
+ memcpy (welcome_nonce + 8, msg_data + 8, 16);
+
+ int rc = crypto_box_open (welcome_plaintext, welcome_box,
+ sizeof welcome_box,
+ welcome_nonce, server_key, cn_secret);
+ if (rc != 0) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ memcpy (cn_server, welcome_plaintext + crypto_box_ZEROBYTES, 32);
+ memcpy (cn_cookie, welcome_plaintext + crypto_box_ZEROBYTES + 32, 16 + 80);
+
+ // Message independent precomputation
+ rc = crypto_box_beforenm (cn_precom, cn_server, cn_secret);
+ zmq_assert (rc == 0);
+
+ state = send_initiate;
+
+ return 0;
+}
+
+int zmq::curve_client_t::produce_initiate (msg_t *msg_)
+{
+ uint8_t vouch_nonce [crypto_box_NONCEBYTES];
+ uint8_t vouch_plaintext [crypto_box_ZEROBYTES + 64];
+ uint8_t vouch_box [crypto_box_BOXZEROBYTES + 80];
+
+ // Create vouch = Box [C',S](C->S')
+ memset (vouch_plaintext, 0, crypto_box_ZEROBYTES);
+ memcpy (vouch_plaintext + crypto_box_ZEROBYTES, cn_public, 32);
+ memcpy (vouch_plaintext + crypto_box_ZEROBYTES + 32, server_key, 32);
+
+ memcpy (vouch_nonce, "VOUCH---", 8);
+ randombytes (vouch_nonce + 8, 16);
+
+ int rc = crypto_box (vouch_box, vouch_plaintext,
+ sizeof vouch_plaintext,
+ vouch_nonce, cn_server, secret_key);
+ zmq_assert (rc == 0);
+
+ // Assume here that metadata is limited to 256 bytes
+ uint8_t initiate_nonce [crypto_box_NONCEBYTES];
+ uint8_t initiate_plaintext [crypto_box_ZEROBYTES + 128 + 256];
+ uint8_t initiate_box [crypto_box_BOXZEROBYTES + 144 + 256];
+
+ // Create Box [C + vouch + metadata](C'->S')
+ memset (initiate_plaintext, 0, crypto_box_ZEROBYTES);
+ memcpy (initiate_plaintext + crypto_box_ZEROBYTES,
+ public_key, 32);
+ memcpy (initiate_plaintext + crypto_box_ZEROBYTES + 32,
+ vouch_nonce + 8, 16);
+ memcpy (initiate_plaintext + crypto_box_ZEROBYTES + 48,
+ vouch_box + crypto_box_BOXZEROBYTES, 80);
+
+ // Metadata starts after vouch
+ uint8_t *ptr = initiate_plaintext + crypto_box_ZEROBYTES + 128;
+
+ // Add socket type property
+ const char *socket_type = socket_type_string (options.type);
+ ptr += add_property (ptr, "Socket-Type", socket_type, strlen (socket_type));
+
+ // Add identity property
+ if (options.type == ZMQ_REQ
+ || options.type == ZMQ_DEALER
+ || options.type == ZMQ_ROUTER)
+ ptr += add_property (ptr, "Identity", options.identity, options.identity_size);
+
+ const size_t mlen = ptr - initiate_plaintext;
+
+ memcpy (initiate_nonce, "CurveZMQINITIATE", 16);
+ put_uint64 (initiate_nonce + 16, cn_nonce);
+
+ rc = crypto_box (initiate_box, initiate_plaintext,
+ mlen, initiate_nonce, cn_server, cn_secret);
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (113 + mlen - crypto_box_BOXZEROBYTES);
+ errno_assert (rc == 0);
+
+ uint8_t *initiate = static_cast <uint8_t *> (msg_->data ());
+
+ memcpy (initiate, "\x08INITIATE", 9);
+ // Cookie provided by the server in the WELCOME command
+ memcpy (initiate + 9, cn_cookie, 96);
+ // Short nonce, prefixed by "CurveZMQINITIATE"
+ memcpy (initiate + 105, initiate_nonce + 16, 8);
+ // Box [C + vouch + metadata](C'->S')
+ memcpy (initiate + 113, initiate_box + crypto_box_BOXZEROBYTES,
+ mlen - crypto_box_BOXZEROBYTES);
+ cn_nonce++;
+
+ return 0;
+}
+
+int zmq::curve_client_t::process_ready (
+ const uint8_t *msg_data, size_t msg_size)
+{
+ if (msg_size < 30) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ const size_t clen = (msg_size - 14) + crypto_box_BOXZEROBYTES;
+
+ uint8_t ready_nonce [crypto_box_NONCEBYTES];
+ uint8_t ready_plaintext [crypto_box_ZEROBYTES + 256];
+ uint8_t ready_box [crypto_box_BOXZEROBYTES + 16 + 256];
+
+ memset (ready_box, 0, crypto_box_BOXZEROBYTES);
+ memcpy (ready_box + crypto_box_BOXZEROBYTES,
+ msg_data + 14, clen - crypto_box_BOXZEROBYTES);
+
+ memcpy (ready_nonce, "CurveZMQREADY---", 16);
+ memcpy (ready_nonce + 16, msg_data + 6, 8);
+ cn_peer_nonce = get_uint64(msg_data + 6);
+
+ int rc = crypto_box_open_afternm (ready_plaintext, ready_box,
+ clen, ready_nonce, cn_precom);
+
+ if (rc != 0) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ rc = parse_metadata (ready_plaintext + crypto_box_ZEROBYTES,
+ clen - crypto_box_ZEROBYTES);
+ if (rc == 0)
+ state = connected;
+
+ return rc;
+}
+
+int zmq::curve_client_t::process_error (
+ const uint8_t *msg_data, size_t msg_size)
+{
+ if (state != expect_welcome && state != expect_ready) {
+ errno = EPROTO;
+ return -1;
+ }
+ if (msg_size < 7) {
+ errno = EPROTO;
+ return -1;
+ }
+ const size_t error_reason_len = static_cast <size_t> (msg_data [6]);
+ if (error_reason_len > msg_size - 7) {
+ errno = EPROTO;
+ return -1;
+ }
+ state = error_received;
+ return 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_client.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_client.hpp
new file mode 100644
index 00000000..ffae1236
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_client.hpp
@@ -0,0 +1,129 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_CURVE_CLIENT_HPP_INCLUDED__
+#define __ZMQ_CURVE_CLIENT_HPP_INCLUDED__
+
+#include "platform.hpp"
+#include "mutex.hpp"
+
+#ifdef HAVE_LIBSODIUM
+#ifdef HAVE_TWEETNACL
+#include "tweetnacl_base.h"
+#include "randombytes.h"
+#else
+#include "sodium.h"
+#endif
+
+#if crypto_box_NONCEBYTES != 24 \
+|| crypto_box_PUBLICKEYBYTES != 32 \
+|| crypto_box_SECRETKEYBYTES != 32 \
+|| crypto_box_ZEROBYTES != 32 \
+|| crypto_box_BOXZEROBYTES != 16
+#error "libsodium not built properly"
+#endif
+
+#include "mechanism.hpp"
+#include "options.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+ class session_base_t;
+
+ class curve_client_t : public mechanism_t
+ {
+ public:
+
+ curve_client_t (const options_t &options_);
+ virtual ~curve_client_t ();
+
+ // mechanism implementation
+ virtual int next_handshake_command (msg_t *msg_);
+ virtual int process_handshake_command (msg_t *msg_);
+ virtual int encode (msg_t *msg_);
+ virtual int decode (msg_t *msg_);
+ virtual status_t status () const;
+
+ private:
+
+ enum state_t {
+ send_hello,
+ expect_welcome,
+ send_initiate,
+ expect_ready,
+ error_received,
+ connected
+ };
+
+ // Current FSM state
+ state_t state;
+
+ // Our public key (C)
+ uint8_t public_key [crypto_box_PUBLICKEYBYTES];
+
+ // Our secret key (c)
+ uint8_t secret_key [crypto_box_SECRETKEYBYTES];
+
+ // Our short-term public key (C')
+ uint8_t cn_public [crypto_box_PUBLICKEYBYTES];
+
+ // Our short-term secret key (c')
+ uint8_t cn_secret [crypto_box_SECRETKEYBYTES];
+
+ // Server's public key (S)
+ uint8_t server_key [crypto_box_PUBLICKEYBYTES];
+
+ // Server's short-term public key (S')
+ uint8_t cn_server [crypto_box_PUBLICKEYBYTES];
+
+ // Cookie received from server
+ uint8_t cn_cookie [16 + 80];
+
+ // Intermediary buffer used to seepd up boxing and unboxing.
+ uint8_t cn_precom [crypto_box_BEFORENMBYTES];
+
+ // Nonce
+ uint64_t cn_nonce;
+ uint64_t cn_peer_nonce;
+
+ int produce_hello (msg_t *msg_);
+ int process_welcome (const uint8_t *cmd_data, size_t data_size);
+ int produce_initiate (msg_t *msg_);
+ int process_ready (const uint8_t *cmd_data, size_t data_size);
+ int process_error (const uint8_t *cmd_data, size_t data_size);
+ mutex_t sync;
+ };
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_server.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_server.cpp
new file mode 100644
index 00000000..7bdd8a91
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_server.cpp
@@ -0,0 +1,729 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#ifdef HAVE_LIBSODIUM
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "msg.hpp"
+#include "session_base.hpp"
+#include "err.hpp"
+#include "curve_server.hpp"
+#include "wire.hpp"
+
+zmq::curve_server_t::curve_server_t (session_base_t *session_,
+ const std::string &peer_address_,
+ const options_t &options_) :
+ mechanism_t (options_),
+ session (session_),
+ peer_address (peer_address_),
+ state (expect_hello),
+ cn_nonce (1),
+ cn_peer_nonce(1),
+ sync()
+{
+ // Fetch our secret key from socket options
+ memcpy (secret_key, options_.curve_secret_key, crypto_box_SECRETKEYBYTES);
+ scoped_lock_t lock (sync);
+#if defined(HAVE_TWEETNACL)
+ // allow opening of /dev/urandom
+ unsigned char tmpbytes[4];
+ randombytes(tmpbytes, 4);
+#else
+ // todo check return code
+ sodium_init();
+#endif
+
+ // Generate short-term key pair
+ const int rc = crypto_box_keypair (cn_public, cn_secret);
+ zmq_assert (rc == 0);
+}
+
+zmq::curve_server_t::~curve_server_t ()
+{
+}
+
+int zmq::curve_server_t::next_handshake_command (msg_t *msg_)
+{
+ int rc = 0;
+
+ switch (state) {
+ case send_welcome:
+ rc = produce_welcome (msg_);
+ if (rc == 0)
+ state = expect_initiate;
+ break;
+ case send_ready:
+ rc = produce_ready (msg_);
+ if (rc == 0)
+ state = connected;
+ break;
+ case send_error:
+ rc = produce_error (msg_);
+ if (rc == 0)
+ state = error_sent;
+ break;
+ default:
+ errno = EAGAIN;
+ rc = -1;
+ break;
+ }
+ return rc;
+}
+
+int zmq::curve_server_t::process_handshake_command (msg_t *msg_)
+{
+ int rc = 0;
+
+ switch (state) {
+ case expect_hello:
+ rc = process_hello (msg_);
+ break;
+ case expect_initiate:
+ rc = process_initiate (msg_);
+ break;
+ default:
+ // Temporary support for security debugging
+ puts ("CURVE I: invalid handshake command");
+ errno = EPROTO;
+ rc = -1;
+ break;
+ }
+ if (rc == 0) {
+ rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ }
+ return rc;
+}
+
+int zmq::curve_server_t::encode (msg_t *msg_)
+{
+ zmq_assert (state == connected);
+
+ const size_t mlen = crypto_box_ZEROBYTES + 1 + msg_->size ();
+
+ uint8_t message_nonce [crypto_box_NONCEBYTES];
+ memcpy (message_nonce, "CurveZMQMESSAGES", 16);
+ put_uint64 (message_nonce + 16, cn_nonce);
+
+ uint8_t flags = 0;
+ if (msg_->flags () & msg_t::more)
+ flags |= 0x01;
+
+ uint8_t *message_plaintext = static_cast <uint8_t *> (malloc (mlen));
+ alloc_assert (message_plaintext);
+
+ memset (message_plaintext, 0, crypto_box_ZEROBYTES);
+ message_plaintext [crypto_box_ZEROBYTES] = flags;
+ memcpy (message_plaintext + crypto_box_ZEROBYTES + 1,
+ msg_->data (), msg_->size ());
+
+ uint8_t *message_box = static_cast <uint8_t *> (malloc (mlen));
+ alloc_assert (message_box);
+
+ int rc = crypto_box_afternm (message_box, message_plaintext,
+ mlen, message_nonce, cn_precom);
+ zmq_assert (rc == 0);
+
+ rc = msg_->close ();
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (16 + mlen - crypto_box_BOXZEROBYTES);
+ zmq_assert (rc == 0);
+
+ uint8_t *message = static_cast <uint8_t *> (msg_->data ());
+
+ memcpy (message, "\x07MESSAGE", 8);
+ memcpy (message + 8, message_nonce + 16, 8);
+ memcpy (message + 16, message_box + crypto_box_BOXZEROBYTES,
+ mlen - crypto_box_BOXZEROBYTES);
+
+ free (message_plaintext);
+ free (message_box);
+
+ cn_nonce++;
+
+ return 0;
+}
+
+int zmq::curve_server_t::decode (msg_t *msg_)
+{
+ zmq_assert (state == connected);
+
+ if (msg_->size () < 33) {
+ // Temporary support for security debugging
+ puts ("CURVE I: invalid CURVE client, sent malformed command");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const uint8_t *message = static_cast <uint8_t *> (msg_->data ());
+ if (memcmp (message, "\x07MESSAGE", 8)) {
+ // Temporary support for security debugging
+ puts ("CURVE I: invalid CURVE client, did not send MESSAGE");
+ errno = EPROTO;
+ return -1;
+ }
+
+ uint8_t message_nonce [crypto_box_NONCEBYTES];
+ memcpy (message_nonce, "CurveZMQMESSAGEC", 16);
+ memcpy (message_nonce + 16, message + 8, 8);
+ uint64_t nonce = get_uint64(message + 8);
+ if (nonce <= cn_peer_nonce) {
+ errno = EPROTO;
+ return -1;
+ }
+ cn_peer_nonce = nonce;
+
+ const size_t clen = crypto_box_BOXZEROBYTES + msg_->size () - 16;
+
+ uint8_t *message_plaintext = static_cast <uint8_t *> (malloc (clen));
+ alloc_assert (message_plaintext);
+
+ uint8_t *message_box = static_cast <uint8_t *> (malloc (clen));
+ alloc_assert (message_box);
+
+ memset (message_box, 0, crypto_box_BOXZEROBYTES);
+ memcpy (message_box + crypto_box_BOXZEROBYTES,
+ message + 16, msg_->size () - 16);
+
+ int rc = crypto_box_open_afternm (message_plaintext, message_box,
+ clen, message_nonce, cn_precom);
+ if (rc == 0) {
+ rc = msg_->close ();
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (clen - 1 - crypto_box_ZEROBYTES);
+ zmq_assert (rc == 0);
+
+ const uint8_t flags = message_plaintext [crypto_box_ZEROBYTES];
+ if (flags & 0x01)
+ msg_->set_flags (msg_t::more);
+
+ memcpy (msg_->data (),
+ message_plaintext + crypto_box_ZEROBYTES + 1,
+ msg_->size ());
+ }
+ else {
+ // Temporary support for security debugging
+ puts ("CURVE I: connection key used for MESSAGE is wrong");
+ errno = EPROTO;
+ }
+ free (message_plaintext);
+ free (message_box);
+
+ return rc;
+}
+
+int zmq::curve_server_t::zap_msg_available ()
+{
+ if (state != expect_zap_reply) {
+ errno = EFSM;
+ return -1;
+ }
+ const int rc = receive_and_process_zap_reply ();
+ if (rc == 0)
+ state = status_code == "200"
+ ? send_ready
+ : send_error;
+ return rc;
+}
+
+zmq::mechanism_t::status_t zmq::curve_server_t::status () const
+{
+ if (state == connected)
+ return mechanism_t::ready;
+ else
+ if (state == error_sent)
+ return mechanism_t::error;
+ else
+ return mechanism_t::handshaking;
+}
+
+int zmq::curve_server_t::process_hello (msg_t *msg_)
+{
+ if (msg_->size () != 200) {
+ // Temporary support for security debugging
+ puts ("CURVE I: client HELLO is not correct size");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const uint8_t * const hello = static_cast <uint8_t *> (msg_->data ());
+ if (memcmp (hello, "\x05HELLO", 6)) {
+ // Temporary support for security debugging
+ puts ("CURVE I: client HELLO has invalid command name");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const uint8_t major = hello [6];
+ const uint8_t minor = hello [7];
+
+ if (major != 1 || minor != 0) {
+ // Temporary support for security debugging
+ puts ("CURVE I: client HELLO has unknown version number");
+ errno = EPROTO;
+ return -1;
+ }
+
+ // Save client's short-term public key (C')
+ memcpy (cn_client, hello + 80, 32);
+
+ uint8_t hello_nonce [crypto_box_NONCEBYTES];
+ uint8_t hello_plaintext [crypto_box_ZEROBYTES + 64];
+ uint8_t hello_box [crypto_box_BOXZEROBYTES + 80];
+
+ memcpy (hello_nonce, "CurveZMQHELLO---", 16);
+ memcpy (hello_nonce + 16, hello + 112, 8);
+ cn_peer_nonce = get_uint64(hello + 112);
+
+ memset (hello_box, 0, crypto_box_BOXZEROBYTES);
+ memcpy (hello_box + crypto_box_BOXZEROBYTES, hello + 120, 80);
+
+ // Open Box [64 * %x0](C'->S)
+ int rc = crypto_box_open (hello_plaintext, hello_box,
+ sizeof hello_box,
+ hello_nonce, cn_client, secret_key);
+ if (rc != 0) {
+ // Temporary support for security debugging
+ puts ("CURVE I: cannot open client HELLO -- wrong server key?");
+ errno = EPROTO;
+ return -1;
+ }
+
+ state = send_welcome;
+ return rc;
+}
+
+int zmq::curve_server_t::produce_welcome (msg_t *msg_)
+{
+ uint8_t cookie_nonce [crypto_secretbox_NONCEBYTES];
+ uint8_t cookie_plaintext [crypto_secretbox_ZEROBYTES + 64];
+ uint8_t cookie_ciphertext [crypto_secretbox_BOXZEROBYTES + 80];
+
+ // Create full nonce for encryption
+ // 8-byte prefix plus 16-byte random nonce
+ memcpy (cookie_nonce, "COOKIE--", 8);
+ randombytes (cookie_nonce + 8, 16);
+
+ // Generate cookie = Box [C' + s'](t)
+ memset (cookie_plaintext, 0, crypto_secretbox_ZEROBYTES);
+ memcpy (cookie_plaintext + crypto_secretbox_ZEROBYTES,
+ cn_client, 32);
+ memcpy (cookie_plaintext + crypto_secretbox_ZEROBYTES + 32,
+ cn_secret, 32);
+
+ // Generate fresh cookie key
+ randombytes (cookie_key, crypto_secretbox_KEYBYTES);
+
+ // Encrypt using symmetric cookie key
+ int rc = crypto_secretbox (cookie_ciphertext, cookie_plaintext,
+ sizeof cookie_plaintext,
+ cookie_nonce, cookie_key);
+ zmq_assert (rc == 0);
+
+ uint8_t welcome_nonce [crypto_box_NONCEBYTES];
+ uint8_t welcome_plaintext [crypto_box_ZEROBYTES + 128];
+ uint8_t welcome_ciphertext [crypto_box_BOXZEROBYTES + 144];
+
+ // Create full nonce for encryption
+ // 8-byte prefix plus 16-byte random nonce
+ memcpy (welcome_nonce, "WELCOME-", 8);
+ randombytes (welcome_nonce + 8, crypto_box_NONCEBYTES - 8);
+
+ // Create 144-byte Box [S' + cookie](S->C')
+ memset (welcome_plaintext, 0, crypto_box_ZEROBYTES);
+ memcpy (welcome_plaintext + crypto_box_ZEROBYTES, cn_public, 32);
+ memcpy (welcome_plaintext + crypto_box_ZEROBYTES + 32,
+ cookie_nonce + 8, 16);
+ memcpy (welcome_plaintext + crypto_box_ZEROBYTES + 48,
+ cookie_ciphertext + crypto_secretbox_BOXZEROBYTES, 80);
+
+ rc = crypto_box (welcome_ciphertext, welcome_plaintext,
+ sizeof welcome_plaintext,
+ welcome_nonce, cn_client, secret_key);
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (168);
+ errno_assert (rc == 0);
+
+ uint8_t * const welcome = static_cast <uint8_t *> (msg_->data ());
+ memcpy (welcome, "\x07WELCOME", 8);
+ memcpy (welcome + 8, welcome_nonce + 8, 16);
+ memcpy (welcome + 24, welcome_ciphertext + crypto_box_BOXZEROBYTES, 144);
+
+ return 0;
+}
+
+int zmq::curve_server_t::process_initiate (msg_t *msg_)
+{
+ if (msg_->size () < 257) {
+ // Temporary support for security debugging
+ puts ("CURVE I: client INITIATE is not correct size");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const uint8_t *initiate = static_cast <uint8_t *> (msg_->data ());
+ if (memcmp (initiate, "\x08INITIATE", 9)) {
+ // Temporary support for security debugging
+ puts ("CURVE I: client INITIATE has invalid command name");
+ errno = EPROTO;
+ return -1;
+ }
+
+ uint8_t cookie_nonce [crypto_secretbox_NONCEBYTES];
+ uint8_t cookie_plaintext [crypto_secretbox_ZEROBYTES + 64];
+ uint8_t cookie_box [crypto_secretbox_BOXZEROBYTES + 80];
+
+ // Open Box [C' + s'](t)
+ memset (cookie_box, 0, crypto_secretbox_BOXZEROBYTES);
+ memcpy (cookie_box + crypto_secretbox_BOXZEROBYTES, initiate + 25, 80);
+
+ memcpy (cookie_nonce, "COOKIE--", 8);
+ memcpy (cookie_nonce + 8, initiate + 9, 16);
+
+ int rc = crypto_secretbox_open (cookie_plaintext, cookie_box,
+ sizeof cookie_box,
+ cookie_nonce, cookie_key);
+ if (rc != 0) {
+ // Temporary support for security debugging
+ puts ("CURVE I: cannot open client INITIATE cookie");
+ errno = EPROTO;
+ return -1;
+ }
+
+ // Check cookie plain text is as expected [C' + s']
+ if (memcmp (cookie_plaintext + crypto_secretbox_ZEROBYTES, cn_client, 32)
+ || memcmp (cookie_plaintext + crypto_secretbox_ZEROBYTES + 32, cn_secret, 32)) {
+ // Temporary support for security debugging
+ puts ("CURVE I: client INITIATE cookie is not valid");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const size_t clen = (msg_->size () - 113) + crypto_box_BOXZEROBYTES;
+
+ uint8_t initiate_nonce [crypto_box_NONCEBYTES];
+ uint8_t initiate_plaintext [crypto_box_ZEROBYTES + 128 + 256];
+ uint8_t initiate_box [crypto_box_BOXZEROBYTES + 144 + 256];
+
+ // Open Box [C + vouch + metadata](C'->S')
+ memset (initiate_box, 0, crypto_box_BOXZEROBYTES);
+ memcpy (initiate_box + crypto_box_BOXZEROBYTES,
+ initiate + 113, clen - crypto_box_BOXZEROBYTES);
+
+ memcpy (initiate_nonce, "CurveZMQINITIATE", 16);
+ memcpy (initiate_nonce + 16, initiate + 105, 8);
+ cn_peer_nonce = get_uint64(initiate + 105);
+
+ rc = crypto_box_open (initiate_plaintext, initiate_box,
+ clen, initiate_nonce, cn_client, cn_secret);
+ if (rc != 0) {
+ // Temporary support for security debugging
+ puts ("CURVE I: cannot open client INITIATE");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const uint8_t *client_key = initiate_plaintext + crypto_box_ZEROBYTES;
+
+ uint8_t vouch_nonce [crypto_box_NONCEBYTES];
+ uint8_t vouch_plaintext [crypto_box_ZEROBYTES + 64];
+ uint8_t vouch_box [crypto_box_BOXZEROBYTES + 80];
+
+ // Open Box Box [C',S](C->S') and check contents
+ memset (vouch_box, 0, crypto_box_BOXZEROBYTES);
+ memcpy (vouch_box + crypto_box_BOXZEROBYTES,
+ initiate_plaintext + crypto_box_ZEROBYTES + 48, 80);
+
+ memcpy (vouch_nonce, "VOUCH---", 8);
+ memcpy (vouch_nonce + 8,
+ initiate_plaintext + crypto_box_ZEROBYTES + 32, 16);
+
+ rc = crypto_box_open (vouch_plaintext, vouch_box,
+ sizeof vouch_box,
+ vouch_nonce, client_key, cn_secret);
+ if (rc != 0) {
+ // Temporary support for security debugging
+ puts ("CURVE I: cannot open client INITIATE vouch");
+ errno = EPROTO;
+ return -1;
+ }
+
+ // What we decrypted must be the client's short-term public key
+ if (memcmp (vouch_plaintext + crypto_box_ZEROBYTES, cn_client, 32)) {
+ // Temporary support for security debugging
+ puts ("CURVE I: invalid handshake from client (public key)");
+ errno = EPROTO;
+ return -1;
+ }
+
+ // Precompute connection secret from client key
+ rc = crypto_box_beforenm (cn_precom, cn_client, cn_secret);
+ zmq_assert (rc == 0);
+
+ // Use ZAP protocol (RFC 27) to authenticate the user.
+ rc = session->zap_connect ();
+ if (rc == 0) {
+ send_zap_request (client_key);
+ rc = receive_and_process_zap_reply ();
+ if (rc == 0)
+ state = status_code == "200"
+ ? send_ready
+ : send_error;
+ else
+ if (errno == EAGAIN)
+ state = expect_zap_reply;
+ else
+ return -1;
+ }
+ else
+ state = send_ready;
+
+ return parse_metadata (initiate_plaintext + crypto_box_ZEROBYTES + 128,
+ clen - crypto_box_ZEROBYTES - 128);
+}
+
+int zmq::curve_server_t::produce_ready (msg_t *msg_)
+{
+ uint8_t ready_nonce [crypto_box_NONCEBYTES];
+ uint8_t ready_plaintext [crypto_box_ZEROBYTES + 256];
+ uint8_t ready_box [crypto_box_BOXZEROBYTES + 16 + 256];
+
+ // Create Box [metadata](S'->C')
+ memset (ready_plaintext, 0, crypto_box_ZEROBYTES);
+ uint8_t *ptr = ready_plaintext + crypto_box_ZEROBYTES;
+
+ // Add socket type property
+ const char *socket_type = socket_type_string (options.type);
+ ptr += add_property (ptr, "Socket-Type", socket_type, strlen (socket_type));
+
+ // Add identity property
+ if (options.type == ZMQ_REQ
+ || options.type == ZMQ_DEALER
+ || options.type == ZMQ_ROUTER)
+ ptr += add_property (ptr, "Identity", options.identity, options.identity_size);
+
+ const size_t mlen = ptr - ready_plaintext;
+
+ memcpy (ready_nonce, "CurveZMQREADY---", 16);
+ put_uint64 (ready_nonce + 16, cn_nonce);
+
+ int rc = crypto_box_afternm (ready_box, ready_plaintext,
+ mlen, ready_nonce, cn_precom);
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (14 + mlen - crypto_box_BOXZEROBYTES);
+ errno_assert (rc == 0);
+
+ uint8_t *ready = static_cast <uint8_t *> (msg_->data ());
+
+ memcpy (ready, "\x05READY", 6);
+ // Short nonce, prefixed by "CurveZMQREADY---"
+ memcpy (ready + 6, ready_nonce + 16, 8);
+ // Box [metadata](S'->C')
+ memcpy (ready + 14, ready_box + crypto_box_BOXZEROBYTES,
+ mlen - crypto_box_BOXZEROBYTES);
+
+ cn_nonce++;
+
+ return 0;
+}
+
+int zmq::curve_server_t::produce_error (msg_t *msg_) const
+{
+ zmq_assert (status_code.length () == 3);
+ const int rc = msg_->init_size (6 + 1 + status_code.length ());
+ zmq_assert (rc == 0);
+ char *msg_data = static_cast <char *> (msg_->data ());
+ memcpy (msg_data, "\5ERROR", 6);
+ msg_data [6] = sizeof status_code;
+ memcpy (msg_data + 7, status_code.c_str (), status_code.length ());
+ return 0;
+}
+
+void zmq::curve_server_t::send_zap_request (const uint8_t *key)
+{
+ int rc;
+ msg_t msg;
+
+ // Address delimiter frame
+ rc = msg.init ();
+ errno_assert (rc == 0);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Version frame
+ rc = msg.init_size (3);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "1.0", 3);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Request ID frame
+ rc = msg.init_size (1);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "1", 1);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Domain frame
+ rc = msg.init_size (options.zap_domain.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), options.zap_domain.c_str (), options.zap_domain.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Address frame
+ rc = msg.init_size (peer_address.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), peer_address.c_str (), peer_address.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Identity frame
+ rc = msg.init_size (options.identity_size);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), options.identity, options.identity_size);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Mechanism frame
+ rc = msg.init_size (5);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "CURVE", 5);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Credentials frame
+ rc = msg.init_size (crypto_box_PUBLICKEYBYTES);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), key, crypto_box_PUBLICKEYBYTES);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+}
+
+int zmq::curve_server_t::receive_and_process_zap_reply ()
+{
+ int rc = 0;
+ msg_t msg [7]; // ZAP reply consists of 7 frames
+
+ // Initialize all reply frames
+ for (int i = 0; i < 7; i++) {
+ rc = msg [i].init ();
+ errno_assert (rc == 0);
+ }
+
+ for (int i = 0; i < 7; i++) {
+ rc = session->read_zap_msg (&msg [i]);
+ if (rc == -1)
+ break;
+ if ((msg [i].flags () & msg_t::more) == (i < 6? 0: msg_t::more)) {
+ // Temporary support for security debugging
+ puts ("CURVE I: ZAP handler sent incomplete reply message");
+ errno = EPROTO;
+ rc = -1;
+ break;
+ }
+ }
+
+ if (rc != 0)
+ goto error;
+
+ // Address delimiter frame
+ if (msg [0].size () > 0) {
+ // Temporary support for security debugging
+ puts ("CURVE I: ZAP handler sent malformed reply message");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Version frame
+ if (msg [1].size () != 3 || memcmp (msg [1].data (), "1.0", 3)) {
+ // Temporary support for security debugging
+ puts ("CURVE I: ZAP handler sent bad version number");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Request id frame
+ if (msg [2].size () != 1 || memcmp (msg [2].data (), "1", 1)) {
+ // Temporary support for security debugging
+ puts ("CURVE I: ZAP handler sent bad request ID");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Status code frame
+ if (msg [3].size () != 3) {
+ // Temporary support for security debugging
+ puts ("CURVE I: ZAP handler rejected client authentication");
+ errno = EACCES;
+ rc = -1;
+ goto error;
+ }
+
+ // Save status code
+ status_code.assign (static_cast <char *> (msg [3].data ()), 3);
+
+ // Save user id
+ set_user_id (msg [5].data (), msg [5].size ());
+
+ // Process metadata frame
+ rc = parse_metadata (static_cast <const unsigned char*> (msg [6].data ()),
+ msg [6].size (), true);
+
+error:
+ for (int i = 0; i < 7; i++) {
+ const int rc2 = msg [i].close ();
+ errno_assert (rc2 == 0);
+ }
+
+ return rc;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_server.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_server.hpp
new file mode 100644
index 00000000..fe7cf877
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/curve_server.hpp
@@ -0,0 +1,138 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_CURVE_SERVER_HPP_INCLUDED__
+#define __ZMQ_CURVE_SERVER_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#ifdef HAVE_LIBSODIUM
+#ifdef HAVE_TWEETNACL
+#include "tweetnacl_base.h"
+#include "randombytes.h"
+#else
+#include "sodium.h"
+#endif
+#if crypto_box_NONCEBYTES != 24 \
+|| crypto_box_PUBLICKEYBYTES != 32 \
+|| crypto_box_SECRETKEYBYTES != 32 \
+|| crypto_box_ZEROBYTES != 32 \
+|| crypto_box_BOXZEROBYTES != 16 \
+|| crypto_secretbox_NONCEBYTES != 24 \
+|| crypto_secretbox_ZEROBYTES != 32 \
+|| crypto_secretbox_BOXZEROBYTES != 16
+#error "libsodium not built properly"
+#endif
+
+#include "mechanism.hpp"
+#include "options.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+ class session_base_t;
+
+ class curve_server_t : public mechanism_t
+ {
+ public:
+
+ curve_server_t (session_base_t *session_,
+ const std::string &peer_address_,
+ const options_t &options_);
+ virtual ~curve_server_t ();
+
+ // mechanism implementation
+ virtual int next_handshake_command (msg_t *msg_);
+ virtual int process_handshake_command (msg_t *msg_);
+ virtual int encode (msg_t *msg_);
+ virtual int decode (msg_t *msg_);
+ virtual int zap_msg_available ();
+ virtual status_t status () const;
+
+ private:
+
+ enum state_t {
+ expect_hello,
+ send_welcome,
+ expect_initiate,
+ expect_zap_reply,
+ send_ready,
+ send_error,
+ error_sent,
+ connected
+ };
+
+ session_base_t * const session;
+
+ const std::string peer_address;
+
+ // Current FSM state
+ state_t state;
+
+ // Status code as received from ZAP handler
+ std::string status_code;
+
+ uint64_t cn_nonce;
+ uint64_t cn_peer_nonce;
+
+ // Our secret key (s)
+ uint8_t secret_key [crypto_box_SECRETKEYBYTES];
+
+ // Our short-term public key (S')
+ uint8_t cn_public [crypto_box_PUBLICKEYBYTES];
+
+ // Our short-term secret key (s')
+ uint8_t cn_secret [crypto_box_SECRETKEYBYTES];
+
+ // Client's short-term public key (C')
+ uint8_t cn_client [crypto_box_PUBLICKEYBYTES];
+
+ // Key used to produce cookie
+ uint8_t cookie_key [crypto_secretbox_KEYBYTES];
+
+ // Intermediary buffer used to speed up boxing and unboxing.
+ uint8_t cn_precom [crypto_box_BEFORENMBYTES];
+
+ int process_hello (msg_t *msg_);
+ int produce_welcome (msg_t *msg_);
+ int process_initiate (msg_t *msg_);
+ int produce_ready (msg_t *msg_);
+ int produce_error (msg_t *msg_) const;
+
+ void send_zap_request (const uint8_t *key);
+ int receive_and_process_zap_reply ();
+ mutex_t sync;
+ };
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dbuffer.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dbuffer.hpp
new file mode 100644
index 00000000..46fe2441
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dbuffer.hpp
@@ -0,0 +1,144 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_DBUFFER_HPP_INCLUDED__
+#define __ZMQ_DBUFFER_HPP_INCLUDED__
+
+#include <stdlib.h>
+#include <stddef.h>
+#include <algorithm>
+
+#include "mutex.hpp"
+#include "msg.hpp"
+
+namespace zmq
+{
+
+ // dbuffer is a single-producer single-consumer double-buffer
+ // implementation.
+ //
+ // The producer writes to a back buffer and then tries to swap
+ // pointers between the back and front buffers. If it fails,
+ // due to the consumer reading from the front buffer, it just
+ // gives up, which is ok since writes are many and redundant.
+ //
+ // The reader simply reads from the front buffer.
+ //
+ // has_msg keeps track of whether there has been a not yet read
+ // value written, it is used by ypipe_conflate to mimic ypipe
+ // functionality regarding a reader being asleep
+
+ template <typename T> class dbuffer_t;
+
+ template <> class dbuffer_t<msg_t>
+ {
+ public:
+
+ inline dbuffer_t ()
+ : back (&storage[0])
+ , front (&storage[1])
+ , has_msg (false)
+ {
+ back->init ();
+ front->init ();
+ }
+
+ inline ~dbuffer_t()
+ {
+ back->close ();
+ front->close ();
+ }
+
+ inline void write (const msg_t &value_)
+ {
+ msg_t& xvalue = const_cast<msg_t&>(value_);
+
+ zmq_assert (xvalue.check ());
+ back->move (xvalue); // cannot just overwrite, might leak
+
+ zmq_assert (back->check ());
+
+ if (sync.try_lock ())
+ {
+ std::swap (back, front);
+ has_msg = true;
+
+ sync.unlock ();
+ }
+ }
+
+ inline bool read (msg_t *value_)
+ {
+ if (!value_)
+ return false;
+
+ {
+ scoped_lock_t lock (sync);
+ if (!has_msg)
+ return false;
+
+ zmq_assert (front->check ());
+
+ *value_ = *front;
+ front->init (); // avoid double free
+
+ has_msg = false;
+ return true;
+ }
+ }
+
+
+ inline bool check_read ()
+ {
+ scoped_lock_t lock (sync);
+
+ return has_msg;
+ }
+
+ inline bool probe (bool (*fn)(const msg_t &))
+ {
+ scoped_lock_t lock (sync);
+ return (*fn) (*front);
+ }
+
+
+ private:
+ msg_t storage[2];
+ msg_t *back, *front;
+
+ mutex_t sync;
+ bool has_msg;
+
+ // Disable copying of dbuffer.
+ dbuffer_t (const dbuffer_t&);
+ const dbuffer_t &operator = (const dbuffer_t&);
+ };
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dealer.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dealer.cpp
new file mode 100644
index 00000000..2a3a5aa3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dealer.cpp
@@ -0,0 +1,141 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "dealer.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+
+zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ socket_base_t (parent_, tid_, sid_),
+ probe_router (false)
+{
+ options.type = ZMQ_DEALER;
+}
+
+zmq::dealer_t::~dealer_t ()
+{
+}
+
+void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ // subscribe_to_all_ is unused
+ (void) subscribe_to_all_;
+
+ zmq_assert (pipe_);
+
+ if (probe_router) {
+ msg_t probe_msg_;
+ int rc = probe_msg_.init ();
+ errno_assert (rc == 0);
+
+ rc = pipe_->write (&probe_msg_);
+ // zmq_assert (rc) is not applicable here, since it is not a bug.
+ pipe_->flush ();
+
+ rc = probe_msg_.close ();
+ errno_assert (rc == 0);
+ }
+
+ fq.attach (pipe_);
+ lb.attach (pipe_);
+}
+
+int zmq::dealer_t::xsetsockopt (int option_, const void *optval_,
+ size_t optvallen_)
+{
+ bool is_int = (optvallen_ == sizeof (int));
+ int value = is_int? *((int *) optval_): 0;
+
+ switch (option_) {
+ case ZMQ_PROBE_ROUTER:
+ if (is_int && value >= 0) {
+ probe_router = (value != 0);
+ return 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+
+int zmq::dealer_t::xsend (msg_t *msg_)
+{
+ return sendpipe (msg_, NULL);
+}
+
+int zmq::dealer_t::xrecv (msg_t *msg_)
+{
+ return recvpipe (msg_, NULL);
+}
+
+bool zmq::dealer_t::xhas_in ()
+{
+ return fq.has_in ();
+}
+
+bool zmq::dealer_t::xhas_out ()
+{
+ return lb.has_out ();
+}
+
+zmq::blob_t zmq::dealer_t::get_credential () const
+{
+ return fq.get_credential ();
+}
+
+
+void zmq::dealer_t::xread_activated (pipe_t *pipe_)
+{
+ fq.activated (pipe_);
+}
+
+void zmq::dealer_t::xwrite_activated (pipe_t *pipe_)
+{
+ lb.activated (pipe_);
+}
+
+void zmq::dealer_t::xpipe_terminated (pipe_t *pipe_)
+{
+ fq.pipe_terminated (pipe_);
+ lb.pipe_terminated (pipe_);
+}
+
+int zmq::dealer_t::sendpipe (msg_t *msg_, pipe_t **pipe_)
+{
+ return lb.sendpipe (msg_, pipe_);
+}
+
+int zmq::dealer_t::recvpipe (msg_t *msg_, pipe_t **pipe_)
+{
+ return fq.recvpipe (msg_, pipe_);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dealer.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dealer.hpp
new file mode 100644
index 00000000..3b1d636a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dealer.hpp
@@ -0,0 +1,89 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_DEALER_HPP_INCLUDED__
+#define __ZMQ_DEALER_HPP_INCLUDED__
+
+#include "socket_base.hpp"
+#include "session_base.hpp"
+#include "fq.hpp"
+#include "lb.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class msg_t;
+ class pipe_t;
+ class io_thread_t;
+ class socket_base_t;
+
+ class dealer_t :
+ public socket_base_t
+ {
+ public:
+
+ dealer_t (zmq::ctx_t *parent_, uint32_t tid_, int sid);
+ ~dealer_t ();
+
+ protected:
+
+ // Overrides of functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
+ int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ bool xhas_out ();
+ blob_t get_credential () const;
+ void xread_activated (zmq::pipe_t *pipe_);
+ void xwrite_activated (zmq::pipe_t *pipe_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+
+ // Send and recv - knowing which pipe was used.
+ int sendpipe (zmq::msg_t *msg_, zmq::pipe_t **pipe_);
+ int recvpipe (zmq::msg_t *msg_, zmq::pipe_t **pipe_);
+
+ private:
+
+ // Messages are fair-queued from inbound pipes. And load-balanced to
+ // the outbound pipes.
+ fq_t fq;
+ lb_t lb;
+
+ // if true, send an empty message to every connected router peer
+ bool probe_router;
+
+ dealer_t (const dealer_t&);
+ const dealer_t &operator = (const dealer_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/decoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/decoder.hpp
new file mode 100644
index 00000000..fc4b177d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/decoder.hpp
@@ -0,0 +1,183 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_DECODER_HPP_INCLUDED__
+#define __ZMQ_DECODER_HPP_INCLUDED__
+
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+#include <algorithm>
+
+#include "err.hpp"
+#include "msg.hpp"
+#include "i_decoder.hpp"
+#include "stdint.hpp"
+
+namespace zmq
+{
+ // Helper base class for decoders that know the amount of data to read
+ // in advance at any moment. Knowing the amount in advance is a property
+ // of the protocol used. 0MQ framing protocol is based size-prefixed
+ // paradigm, which qualifies it to be parsed by this class.
+ // On the other hand, XML-based transports (like XMPP or SOAP) don't allow
+ // for knowing the size of data to read in advance and should use different
+ // decoding algorithms.
+ //
+ // This class implements the state machine that parses the incoming buffer.
+ // Derived class should implement individual state machine actions.
+
+ template <typename T> class decoder_base_t : public i_decoder
+ {
+ public:
+
+ inline decoder_base_t (size_t bufsize_) :
+ next (NULL),
+ read_pos (NULL),
+ to_read (0),
+ bufsize (bufsize_)
+ {
+ buf = (unsigned char*) malloc (bufsize_);
+ alloc_assert (buf);
+ }
+
+ // The destructor doesn't have to be virtual. It is mad virtual
+ // just to keep ICC and code checking tools from complaining.
+ inline virtual ~decoder_base_t ()
+ {
+ free (buf);
+ }
+
+ // Returns a buffer to be filled with binary data.
+ inline void get_buffer (unsigned char **data_, size_t *size_)
+ {
+ // If we are expected to read large message, we'll opt for zero-
+ // copy, i.e. we'll ask caller to fill the data directly to the
+ // message. Note that subsequent read(s) are non-blocking, thus
+ // each single read reads at most SO_RCVBUF bytes at once not
+ // depending on how large is the chunk returned from here.
+ // As a consequence, large messages being received won't block
+ // other engines running in the same I/O thread for excessive
+ // amounts of time.
+ if (to_read >= bufsize) {
+ *data_ = read_pos;
+ *size_ = to_read;
+ return;
+ }
+
+ *data_ = buf;
+ *size_ = bufsize;
+ }
+
+ // Processes the data in the buffer previously allocated using
+ // get_buffer function. size_ argument specifies nemuber of bytes
+ // actually filled into the buffer. Function returns 1 when the
+ // whole message was decoded or 0 when more data is required.
+ // On error, -1 is returned and errno set accordingly.
+ // Number of bytes processed is returned in byts_used_.
+ inline int decode (const unsigned char *data_, size_t size_,
+ size_t &bytes_used_)
+ {
+ bytes_used_ = 0;
+
+ // In case of zero-copy simply adjust the pointers, no copying
+ // is required. Also, run the state machine in case all the data
+ // were processed.
+ if (data_ == read_pos) {
+ zmq_assert (size_ <= to_read);
+ read_pos += size_;
+ to_read -= size_;
+ bytes_used_ = size_;
+
+ while (!to_read) {
+ const int rc = (static_cast <T*> (this)->*next) ();
+ if (rc != 0)
+ return rc;
+ }
+ return 0;
+ }
+
+ while (bytes_used_ < size_) {
+ // Copy the data from buffer to the message.
+ const size_t to_copy = std::min (to_read, size_ - bytes_used_);
+ memcpy (read_pos, data_ + bytes_used_, to_copy);
+ read_pos += to_copy;
+ to_read -= to_copy;
+ bytes_used_ += to_copy;
+ // Try to get more space in the message to fill in.
+ // If none is available, return.
+ while (to_read == 0) {
+ const int rc = (static_cast <T*> (this)->*next) ();
+ if (rc != 0)
+ return rc;
+ }
+ }
+
+ return 0;
+ }
+
+ protected:
+
+ // Prototype of state machine action. Action should return false if
+ // it is unable to push the data to the system.
+ typedef int (T::*step_t) ();
+
+ // This function should be called from derived class to read data
+ // from the buffer and schedule next state machine action.
+ inline void next_step (void *read_pos_, size_t to_read_, step_t next_)
+ {
+ read_pos = (unsigned char*) read_pos_;
+ to_read = to_read_;
+ next = next_;
+ }
+
+ private:
+
+ // Next step. If set to NULL, it means that associated data stream
+ // is dead. Note that there can be still data in the process in such
+ // case.
+ step_t next;
+
+ // Where to store the read data.
+ unsigned char *read_pos;
+
+ // How much data to read before taking next step.
+ size_t to_read;
+
+ // The duffer for data to decode.
+ size_t bufsize;
+ unsigned char *buf;
+
+ decoder_base_t (const decoder_base_t&);
+ const decoder_base_t &operator = (const decoder_base_t&);
+ };
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/devpoll.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/devpoll.cpp
new file mode 100644
index 00000000..6c97256e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/devpoll.cpp
@@ -0,0 +1,204 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "devpoll.hpp"
+#if defined ZMQ_USE_DEVPOLL
+
+#include <sys/devpoll.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <limits.h>
+#include <algorithm>
+
+#include "devpoll.hpp"
+#include "err.hpp"
+#include "config.hpp"
+#include "i_poll_events.hpp"
+
+zmq::devpoll_t::devpoll_t (const zmq::ctx_t &ctx_) :
+ ctx(ctx_),
+ stopping (false)
+{
+ devpoll_fd = open ("/dev/poll", O_RDWR);
+ errno_assert (devpoll_fd != -1);
+}
+
+zmq::devpoll_t::~devpoll_t ()
+{
+ worker.stop ();
+ close (devpoll_fd);
+}
+
+void zmq::devpoll_t::devpoll_ctl (fd_t fd_, short events_)
+{
+ struct pollfd pfd = {fd_, events_, 0};
+ ssize_t rc = write (devpoll_fd, &pfd, sizeof pfd);
+ zmq_assert (rc == sizeof pfd);
+}
+
+zmq::devpoll_t::handle_t zmq::devpoll_t::add_fd (fd_t fd_,
+ i_poll_events *reactor_)
+{
+ // If the file descriptor table is too small expand it.
+ fd_table_t::size_type sz = fd_table.size ();
+ if (sz <= (fd_table_t::size_type) fd_) {
+ fd_table.resize (fd_ + 1);
+ while (sz != (fd_table_t::size_type) (fd_ + 1)) {
+ fd_table [sz].valid = false;
+ ++sz;
+ }
+ }
+
+ zmq_assert (!fd_table [fd_].valid);
+
+ fd_table [fd_].events = 0;
+ fd_table [fd_].reactor = reactor_;
+ fd_table [fd_].valid = true;
+ fd_table [fd_].accepted = false;
+
+ devpoll_ctl (fd_, 0);
+ pending_list.push_back (fd_);
+
+ // Increase the load metric of the thread.
+ adjust_load (1);
+
+ return fd_;
+}
+
+void zmq::devpoll_t::rm_fd (handle_t handle_)
+{
+ zmq_assert (fd_table [handle_].valid);
+
+ devpoll_ctl (handle_, POLLREMOVE);
+ fd_table [handle_].valid = false;
+
+ // Decrease the load metric of the thread.
+ adjust_load (-1);
+}
+
+void zmq::devpoll_t::set_pollin (handle_t handle_)
+{
+ devpoll_ctl (handle_, POLLREMOVE);
+ fd_table [handle_].events |= POLLIN;
+ devpoll_ctl (handle_, fd_table [handle_].events);
+}
+
+void zmq::devpoll_t::reset_pollin (handle_t handle_)
+{
+ devpoll_ctl (handle_, POLLREMOVE);
+ fd_table [handle_].events &= ~((short) POLLIN);
+ devpoll_ctl (handle_, fd_table [handle_].events);
+}
+
+void zmq::devpoll_t::set_pollout (handle_t handle_)
+{
+ devpoll_ctl (handle_, POLLREMOVE);
+ fd_table [handle_].events |= POLLOUT;
+ devpoll_ctl (handle_, fd_table [handle_].events);
+}
+
+void zmq::devpoll_t::reset_pollout (handle_t handle_)
+{
+ devpoll_ctl (handle_, POLLREMOVE);
+ fd_table [handle_].events &= ~((short) POLLOUT);
+ devpoll_ctl (handle_, fd_table [handle_].events);
+}
+
+void zmq::devpoll_t::start ()
+{
+ ctx.start_thread (worker, worker_routine, this);
+}
+
+void zmq::devpoll_t::stop ()
+{
+ stopping = true;
+}
+
+int zmq::devpoll_t::max_fds ()
+{
+ return -1;
+}
+
+void zmq::devpoll_t::loop ()
+{
+ while (!stopping) {
+
+ struct pollfd ev_buf [max_io_events];
+ struct dvpoll poll_req;
+
+ for (pending_list_t::size_type i = 0; i < pending_list.size (); i ++)
+ fd_table [pending_list [i]].accepted = true;
+ pending_list.clear ();
+
+ // Execute any due timers.
+ int timeout = (int) execute_timers ();
+
+ // Wait for events.
+ // On Solaris, we can retrieve no more then (OPEN_MAX - 1) events.
+ poll_req.dp_fds = &ev_buf [0];
+#if defined ZMQ_HAVE_SOLARIS
+ poll_req.dp_nfds = std::min ((int) max_io_events, OPEN_MAX - 1);
+#else
+ poll_req.dp_nfds = max_io_events;
+#endif
+ poll_req.dp_timeout = timeout ? timeout : -1;
+ int n = ioctl (devpoll_fd, DP_POLL, &poll_req);
+ if (n == -1 && errno == EINTR)
+ continue;
+ errno_assert (n != -1);
+
+ for (int i = 0; i < n; i ++) {
+
+ fd_entry_t *fd_ptr = &fd_table [ev_buf [i].fd];
+ if (!fd_ptr->valid || !fd_ptr->accepted)
+ continue;
+ if (ev_buf [i].revents & (POLLERR | POLLHUP))
+ fd_ptr->reactor->in_event ();
+ if (!fd_ptr->valid || !fd_ptr->accepted)
+ continue;
+ if (ev_buf [i].revents & POLLOUT)
+ fd_ptr->reactor->out_event ();
+ if (!fd_ptr->valid || !fd_ptr->accepted)
+ continue;
+ if (ev_buf [i].revents & POLLIN)
+ fd_ptr->reactor->in_event ();
+ }
+ }
+}
+
+void zmq::devpoll_t::worker_routine (void *arg_)
+{
+ ((devpoll_t*) arg_)->loop ();
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/devpoll.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/devpoll.hpp
new file mode 100644
index 00000000..5d77b8fc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/devpoll.hpp
@@ -0,0 +1,119 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_DEVPOLL_HPP_INCLUDED__
+#define __ZMQ_DEVPOLL_HPP_INCLUDED__
+
+// poller.hpp decides which polling mechanism to use.
+#include "poller.hpp"
+#if defined ZMQ_USE_DEVPOLL
+
+#include <vector>
+
+#include "ctx.hpp"
+#include "fd.hpp"
+#include "thread.hpp"
+#include "poller_base.hpp"
+
+namespace zmq
+{
+
+ struct i_poll_events;
+
+ // Implements socket polling mechanism using the "/dev/poll" interface.
+
+ class devpoll_t : public poller_base_t
+ {
+ public:
+
+ typedef fd_t handle_t;
+
+ devpoll_t (const ctx_t &ctx_);
+ ~devpoll_t ();
+
+ // "poller" concept.
+ handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ void rm_fd (handle_t handle_);
+ void set_pollin (handle_t handle_);
+ void reset_pollin (handle_t handle_);
+ void set_pollout (handle_t handle_);
+ void reset_pollout (handle_t handle_);
+ void start ();
+ void stop ();
+
+ static int max_fds ();
+
+ private:
+
+ // Main worker thread routine.
+ static void worker_routine (void *arg_);
+
+ // Main event loop.
+ void loop ();
+
+ // Reference to ZMQ context.
+ const ctx_t &ctx;
+
+ // File descriptor referring to "/dev/poll" pseudo-device.
+ fd_t devpoll_fd;
+
+ struct fd_entry_t
+ {
+ short events;
+ zmq::i_poll_events *reactor;
+ bool valid;
+ bool accepted;
+ };
+
+ typedef std::vector <fd_entry_t> fd_table_t;
+ fd_table_t fd_table;
+
+ typedef std::vector <fd_t> pending_list_t;
+ pending_list_t pending_list;
+
+ // Pollset manipulation function.
+ void devpoll_ctl (fd_t fd_, short events_);
+
+ // If true, thread is in the process of shutting down.
+ bool stopping;
+
+ // Handle of the physical thread doing the I/O work.
+ thread_t worker;
+
+ devpoll_t (const devpoll_t&);
+ const devpoll_t &operator = (const devpoll_t&);
+ };
+
+ typedef devpoll_t poller_t;
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dist.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dist.cpp
new file mode 100644
index 00000000..e7e18233
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dist.cpp
@@ -0,0 +1,216 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "dist.hpp"
+#include "pipe.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+#include "likely.hpp"
+
+zmq::dist_t::dist_t () :
+ matching (0),
+ active (0),
+ eligible (0),
+ more (false)
+{
+}
+
+zmq::dist_t::~dist_t ()
+{
+ zmq_assert (pipes.empty ());
+}
+
+void zmq::dist_t::attach (pipe_t *pipe_)
+{
+ // If we are in the middle of sending a message, we'll add new pipe
+ // into the list of eligible pipes. Otherwise we add it to the list
+ // of active pipes.
+ if (more) {
+ pipes.push_back (pipe_);
+ pipes.swap (eligible, pipes.size () - 1);
+ eligible++;
+ }
+ else {
+ pipes.push_back (pipe_);
+ pipes.swap (active, pipes.size () - 1);
+ active++;
+ eligible++;
+ }
+}
+
+void zmq::dist_t::match (pipe_t *pipe_)
+{
+ // If pipe is already matching do nothing.
+ if (pipes.index (pipe_) < matching)
+ return;
+
+ // If the pipe isn't eligible, ignore it.
+ if (pipes.index (pipe_) >= eligible)
+ return;
+
+ // Mark the pipe as matching.
+ pipes.swap (pipes.index (pipe_), matching);
+ matching++;
+}
+
+void zmq::dist_t::unmatch ()
+{
+ matching = 0;
+}
+
+void zmq::dist_t::pipe_terminated (pipe_t *pipe_)
+{
+ // Remove the pipe from the list; adjust number of matching, active and/or
+ // eligible pipes accordingly.
+ if (pipes.index (pipe_) < matching) {
+ pipes.swap (pipes.index (pipe_), matching - 1);
+ matching--;
+ }
+ if (pipes.index (pipe_) < active) {
+ pipes.swap (pipes.index (pipe_), active - 1);
+ active--;
+ }
+ if (pipes.index (pipe_) < eligible) {
+ pipes.swap (pipes.index (pipe_), eligible - 1);
+ eligible--;
+ }
+
+ pipes.erase (pipe_);
+}
+
+void zmq::dist_t::activated (pipe_t *pipe_)
+{
+ // Move the pipe from passive to eligible state.
+ pipes.swap (pipes.index (pipe_), eligible);
+ eligible++;
+
+ // If there's no message being sent at the moment, move it to
+ // the active state.
+ if (!more) {
+ pipes.swap (eligible - 1, active);
+ active++;
+ }
+}
+
+int zmq::dist_t::send_to_all (msg_t *msg_)
+{
+ matching = active;
+ return send_to_matching (msg_);
+}
+
+int zmq::dist_t::send_to_matching (msg_t *msg_)
+{
+ // Is this end of a multipart message?
+ bool msg_more = msg_->flags () & msg_t::more ? true : false;
+
+ // Push the message to matching pipes.
+ distribute (msg_);
+
+ // If mutlipart message is fully sent, activate all the eligible pipes.
+ if (!msg_more)
+ active = eligible;
+
+ more = msg_more;
+
+ return 0;
+}
+
+void zmq::dist_t::distribute (msg_t *msg_)
+{
+ // If there are no matching pipes available, simply drop the message.
+ if (matching == 0) {
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ return;
+ }
+
+ if (msg_->is_vsm ()) {
+ for (pipes_t::size_type i = 0; i < matching; ++i)
+ if(!write (pipes [i], msg_))
+ --i; // Retry last write because index will have been swapped
+ int rc = msg_->close();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ return;
+ }
+
+ // Add matching-1 references to the message. We already hold one reference,
+ // that's why -1.
+ msg_->add_refs ((int) matching - 1);
+
+ // Push copy of the message to each matching pipe.
+ int failed = 0;
+ for (pipes_t::size_type i = 0; i < matching; ++i)
+ if (!write (pipes [i], msg_)) {
+ ++failed;
+ --i; // Retry last write because index will have been swapped
+ }
+ if (unlikely (failed))
+ msg_->rm_refs (failed);
+
+ // Detach the original message from the data buffer. Note that we don't
+ // close the message. That's because we've already used all the references.
+ int rc = msg_->init ();
+ errno_assert (rc == 0);
+}
+
+bool zmq::dist_t::has_out ()
+{
+ return true;
+}
+
+bool zmq::dist_t::write (pipe_t *pipe_, msg_t *msg_)
+{
+ if (!pipe_->write (msg_)) {
+ pipes.swap (pipes.index (pipe_), matching - 1);
+ matching--;
+ pipes.swap (pipes.index (pipe_), active - 1);
+ active--;
+ pipes.swap (active, eligible - 1);
+ eligible--;
+ return false;
+ }
+ if (!(msg_->flags () & msg_t::more))
+ pipe_->flush ();
+ return true;
+}
+
+bool zmq::dist_t::check_hwm ()
+{
+ for (pipes_t::size_type i = 0; i < matching; ++i)
+ if (!pipes [i]->check_hwm ())
+ return false;
+
+ return true;
+}
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dist.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dist.hpp
new file mode 100644
index 00000000..3b5e5702
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/dist.hpp
@@ -0,0 +1,117 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_DIST_HPP_INCLUDED__
+#define __ZMQ_DIST_HPP_INCLUDED__
+
+#include <vector>
+
+#include "array.hpp"
+#include "pipe.hpp"
+
+namespace zmq
+{
+
+ class pipe_t;
+ class msg_t;
+
+ // Class manages a set of outbound pipes. It sends each messages to
+ // each of them.
+ class dist_t
+ {
+ public:
+
+ dist_t ();
+ ~dist_t ();
+
+ // Adds the pipe to the distributor object.
+ void attach (zmq::pipe_t *pipe_);
+
+ // Activates pipe that have previously reached high watermark.
+ void activated (zmq::pipe_t *pipe_);
+
+ // Mark the pipe as matching. Subsequent call to send_to_matching
+ // will send message also to this pipe.
+ void match (zmq::pipe_t *pipe_);
+
+ // Mark all pipes as non-matching.
+ void unmatch ();
+
+ // Removes the pipe from the distributor object.
+ void pipe_terminated (zmq::pipe_t *pipe_);
+
+ // Send the message to the matching outbound pipes.
+ int send_to_matching (zmq::msg_t *msg_);
+
+ // Send the message to all the outbound pipes.
+ int send_to_all (zmq::msg_t *msg_);
+
+ bool has_out ();
+
+ // check HWM of all pipes matching
+ bool check_hwm ();
+
+ private:
+
+ // Write the message to the pipe. Make the pipe inactive if writing
+ // fails. In such a case false is returned.
+ bool write (zmq::pipe_t *pipe_, zmq::msg_t *msg_);
+
+ // Put the message to all active pipes.
+ void distribute (zmq::msg_t *msg_);
+
+ // List of outbound pipes.
+ typedef array_t <zmq::pipe_t, 2> pipes_t;
+ pipes_t pipes;
+
+ // Number of all the pipes to send the next message to.
+ pipes_t::size_type matching;
+
+ // Number of active pipes. All the active pipes are located at the
+ // beginning of the pipes array. These are the pipes the messages
+ // can be sent to at the moment.
+ pipes_t::size_type active;
+
+ // Number of pipes eligible for sending messages to. This includes all
+ // the active pipes plus all the pipes that we can in theory send
+ // messages to (the HWM is not yet reached), but sending a message
+ // to them would result in partial message being delivered, ie. message
+ // with initial parts missing.
+ pipes_t::size_type eligible;
+
+ // True if last we are in the middle of a multipart message.
+ bool more;
+
+ dist_t (const dist_t&);
+ const dist_t &operator = (const dist_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/encoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/encoder.hpp
new file mode 100644
index 00000000..8d8a0ff5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/encoder.hpp
@@ -0,0 +1,185 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_ENCODER_HPP_INCLUDED__
+#define __ZMQ_ENCODER_HPP_INCLUDED__
+
+#if defined(_MSC_VER)
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+#include <algorithm>
+
+#include "err.hpp"
+#include "msg.hpp"
+#include "i_encoder.hpp"
+
+namespace zmq
+{
+
+ // Helper base class for encoders. It implements the state machine that
+ // fills the outgoing buffer. Derived classes should implement individual
+ // state machine actions.
+
+ template <typename T> class encoder_base_t : public i_encoder
+ {
+ public:
+
+ inline encoder_base_t (size_t bufsize_) :
+ bufsize (bufsize_),
+ in_progress (NULL)
+ {
+ buf = (unsigned char*) malloc (bufsize_);
+ alloc_assert (buf);
+ }
+
+ // The destructor doesn't have to be virtual. It is made virtual
+ // just to keep ICC and code checking tools from complaining.
+ inline virtual ~encoder_base_t ()
+ {
+ free (buf);
+ }
+
+ // The function returns a batch of binary data. The data
+ // are filled to a supplied buffer. If no buffer is supplied (data_
+ // points to NULL) decoder object will provide buffer of its own.
+ inline size_t encode (unsigned char **data_, size_t size_)
+ {
+ unsigned char *buffer = !*data_ ? buf : *data_;
+ size_t buffersize = !*data_ ? bufsize : size_;
+
+ if (in_progress == NULL)
+ return 0;
+
+ size_t pos = 0;
+ while (pos < buffersize) {
+
+ // If there are no more data to return, run the state machine.
+ // If there are still no data, return what we already have
+ // in the buffer.
+ if (!to_write) {
+ if (new_msg_flag) {
+ int rc = in_progress->close ();
+ errno_assert (rc == 0);
+ rc = in_progress->init ();
+ errno_assert (rc == 0);
+ in_progress = NULL;
+ break;
+ }
+ (static_cast <T*> (this)->*next) ();
+ }
+
+ // If there are no data in the buffer yet and we are able to
+ // fill whole buffer in a single go, let's use zero-copy.
+ // There's no disadvantage to it as we cannot stuck multiple
+ // messages into the buffer anyway. Note that subsequent
+ // write(s) are non-blocking, thus each single write writes
+ // at most SO_SNDBUF bytes at once not depending on how large
+ // is the chunk returned from here.
+ // As a consequence, large messages being sent won't block
+ // other engines running in the same I/O thread for excessive
+ // amounts of time.
+ if (!pos && !*data_ && to_write >= buffersize) {
+ *data_ = write_pos;
+ pos = to_write;
+ write_pos = NULL;
+ to_write = 0;
+ return pos;
+ }
+
+ // Copy data to the buffer. If the buffer is full, return.
+ size_t to_copy = std::min (to_write, buffersize - pos);
+ memcpy (buffer + pos, write_pos, to_copy);
+ pos += to_copy;
+ write_pos += to_copy;
+ to_write -= to_copy;
+ }
+
+ *data_ = buffer;
+ return pos;
+ }
+
+ void load_msg (msg_t *msg_)
+ {
+ zmq_assert (in_progress == NULL);
+ in_progress = msg_;
+ (static_cast <T*> (this)->*next) ();
+ }
+
+ protected:
+
+ // Prototype of state machine action.
+ typedef void (T::*step_t) ();
+
+ // This function should be called from derived class to write the data
+ // to the buffer and schedule next state machine action.
+ inline void next_step (void *write_pos_, size_t to_write_,
+ step_t next_, bool new_msg_flag_)
+ {
+ write_pos = (unsigned char*) write_pos_;
+ to_write = to_write_;
+ next = next_;
+ new_msg_flag = new_msg_flag_;
+ }
+
+ private:
+
+ // Where to get the data to write from.
+ unsigned char *write_pos;
+
+ // How much data to write before next step should be executed.
+ size_t to_write;
+
+ // Next step. If set to NULL, it means that associated data stream
+ // is dead.
+ step_t next;
+
+ bool new_msg_flag;
+
+ // The buffer for encoded data.
+ size_t bufsize;
+ unsigned char *buf;
+
+ encoder_base_t (const encoder_base_t&);
+ void operator = (const encoder_base_t&);
+
+ protected:
+
+ msg_t *in_progress;
+
+ };
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/epoll.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/epoll.cpp
new file mode 100644
index 00000000..1de68c52
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/epoll.cpp
@@ -0,0 +1,192 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "epoll.hpp"
+#if defined ZMQ_USE_EPOLL
+
+#include <sys/epoll.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <algorithm>
+#include <new>
+
+#include "epoll.hpp"
+#include "err.hpp"
+#include "config.hpp"
+#include "i_poll_events.hpp"
+
+zmq::epoll_t::epoll_t (const zmq::ctx_t &ctx_) :
+ ctx(ctx_),
+ stopping (false)
+{
+ epoll_fd = epoll_create (1);
+ errno_assert (epoll_fd != -1);
+}
+
+zmq::epoll_t::~epoll_t ()
+{
+ // Wait till the worker thread exits.
+ worker.stop ();
+
+ close (epoll_fd);
+ for (retired_t::iterator it = retired.begin (); it != retired.end (); ++it)
+ delete *it;
+}
+
+zmq::epoll_t::handle_t zmq::epoll_t::add_fd (fd_t fd_, i_poll_events *events_)
+{
+ poll_entry_t *pe = new (std::nothrow) poll_entry_t;
+ alloc_assert (pe);
+
+ // The memset is not actually needed. It's here to prevent debugging
+ // tools to complain about using uninitialised memory.
+ memset (pe, 0, sizeof (poll_entry_t));
+
+ pe->fd = fd_;
+ pe->ev.events = 0;
+ pe->ev.data.ptr = pe;
+ pe->events = events_;
+
+ int rc = epoll_ctl (epoll_fd, EPOLL_CTL_ADD, fd_, &pe->ev);
+ errno_assert (rc != -1);
+
+ // Increase the load metric of the thread.
+ adjust_load (1);
+
+ return pe;
+}
+
+void zmq::epoll_t::rm_fd (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ int rc = epoll_ctl (epoll_fd, EPOLL_CTL_DEL, pe->fd, &pe->ev);
+ errno_assert (rc != -1);
+ pe->fd = retired_fd;
+ retired.push_back (pe);
+
+ // Decrease the load metric of the thread.
+ adjust_load (-1);
+}
+
+void zmq::epoll_t::set_pollin (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ pe->ev.events |= EPOLLIN;
+ int rc = epoll_ctl (epoll_fd, EPOLL_CTL_MOD, pe->fd, &pe->ev);
+ errno_assert (rc != -1);
+}
+
+void zmq::epoll_t::reset_pollin (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ pe->ev.events &= ~((short) EPOLLIN);
+ int rc = epoll_ctl (epoll_fd, EPOLL_CTL_MOD, pe->fd, &pe->ev);
+ errno_assert (rc != -1);
+}
+
+void zmq::epoll_t::set_pollout (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ pe->ev.events |= EPOLLOUT;
+ int rc = epoll_ctl (epoll_fd, EPOLL_CTL_MOD, pe->fd, &pe->ev);
+ errno_assert (rc != -1);
+}
+
+void zmq::epoll_t::reset_pollout (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ pe->ev.events &= ~((short) EPOLLOUT);
+ int rc = epoll_ctl (epoll_fd, EPOLL_CTL_MOD, pe->fd, &pe->ev);
+ errno_assert (rc != -1);
+}
+
+void zmq::epoll_t::start ()
+{
+ ctx.start_thread (worker, worker_routine, this);
+}
+
+void zmq::epoll_t::stop ()
+{
+ stopping = true;
+}
+
+int zmq::epoll_t::max_fds ()
+{
+ return -1;
+}
+
+void zmq::epoll_t::loop ()
+{
+ epoll_event ev_buf [max_io_events];
+
+ while (!stopping) {
+
+ // Execute any due timers.
+ int timeout = (int) execute_timers ();
+
+ // Wait for events.
+ int n = epoll_wait (epoll_fd, &ev_buf [0], max_io_events,
+ timeout ? timeout : -1);
+ if (n == -1) {
+ errno_assert (errno == EINTR);
+ continue;
+ }
+
+ for (int i = 0; i < n; i ++) {
+ poll_entry_t *pe = ((poll_entry_t*) ev_buf [i].data.ptr);
+
+ if (pe->fd == retired_fd)
+ continue;
+ if (ev_buf [i].events & (EPOLLERR | EPOLLHUP))
+ pe->events->in_event ();
+ if (pe->fd == retired_fd)
+ continue;
+ if (ev_buf [i].events & EPOLLOUT)
+ pe->events->out_event ();
+ if (pe->fd == retired_fd)
+ continue;
+ if (ev_buf [i].events & EPOLLIN)
+ pe->events->in_event ();
+ }
+
+ // Destroy retired event sources.
+ for (retired_t::iterator it = retired.begin (); it != retired.end ();
+ ++it)
+ delete *it;
+ retired.clear ();
+ }
+}
+
+void zmq::epoll_t::worker_routine (void *arg_)
+{
+ ((epoll_t*) arg_)->loop ();
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/epoll.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/epoll.hpp
new file mode 100644
index 00000000..8f79343c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/epoll.hpp
@@ -0,0 +1,115 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_EPOLL_HPP_INCLUDED__
+#define __ZMQ_EPOLL_HPP_INCLUDED__
+
+// poller.hpp decides which polling mechanism to use.
+#include "poller.hpp"
+#if defined ZMQ_USE_EPOLL
+
+#include <vector>
+#include <sys/epoll.h>
+
+#include "ctx.hpp"
+#include "fd.hpp"
+#include "thread.hpp"
+#include "poller_base.hpp"
+
+namespace zmq
+{
+
+ struct i_poll_events;
+
+ // This class implements socket polling mechanism using the Linux-specific
+ // epoll mechanism.
+
+ class epoll_t : public poller_base_t
+ {
+ public:
+
+ typedef void* handle_t;
+
+ epoll_t (const ctx_t &ctx_);
+ ~epoll_t ();
+
+ // "poller" concept.
+ handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ void rm_fd (handle_t handle_);
+ void set_pollin (handle_t handle_);
+ void reset_pollin (handle_t handle_);
+ void set_pollout (handle_t handle_);
+ void reset_pollout (handle_t handle_);
+ void start ();
+ void stop ();
+
+ static int max_fds ();
+
+ private:
+
+ // Main worker thread routine.
+ static void worker_routine (void *arg_);
+
+ // Main event loop.
+ void loop ();
+
+ // Reference to ZMQ context.
+ const ctx_t &ctx;
+
+ // Main epoll file descriptor
+ fd_t epoll_fd;
+
+ struct poll_entry_t
+ {
+ fd_t fd;
+ epoll_event ev;
+ zmq::i_poll_events *events;
+ };
+
+ // List of retired event sources.
+ typedef std::vector <poll_entry_t*> retired_t;
+ retired_t retired;
+
+ // If true, thread is in the process of shutting down.
+ bool stopping;
+
+ // Handle of the physical thread doing the I/O work.
+ thread_t worker;
+
+ epoll_t (const epoll_t&);
+ const epoll_t &operator = (const epoll_t&);
+ };
+
+ typedef epoll_t poller_t;
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/err.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/err.cpp
new file mode 100644
index 00000000..1ca7200e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/err.cpp
@@ -0,0 +1,386 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "err.hpp"
+#include "platform.hpp"
+
+const char *zmq::errno_to_string (int errno_)
+{
+ switch (errno_) {
+#if defined ZMQ_HAVE_WINDOWS
+ case ENOTSUP:
+ return "Not supported";
+ case EPROTONOSUPPORT:
+ return "Protocol not supported";
+ case ENOBUFS:
+ return "No buffer space available";
+ case ENETDOWN:
+ return "Network is down";
+ case EADDRINUSE:
+ return "Address in use";
+ case EADDRNOTAVAIL:
+ return "Address not available";
+ case ECONNREFUSED:
+ return "Connection refused";
+ case EINPROGRESS:
+ return "Operation in progress";
+#endif
+ case EFSM:
+ return "Operation cannot be accomplished in current state";
+ case ENOCOMPATPROTO:
+ return "The protocol is not compatible with the socket type";
+ case ETERM:
+ return "Context was terminated";
+ case EMTHREAD:
+ return "No thread available";
+ default:
+#if defined _MSC_VER
+#pragma warning (push)
+#pragma warning (disable:4996)
+#endif
+ return strerror (errno_);
+#if defined _MSC_VER
+#pragma warning (pop)
+#endif
+ }
+}
+
+void zmq::zmq_abort(const char *errmsg_)
+{
+#if defined ZMQ_HAVE_WINDOWS
+
+ // Raise STATUS_FATAL_APP_EXIT.
+ ULONG_PTR extra_info [1];
+ extra_info [0] = (ULONG_PTR) errmsg_;
+ RaiseException (0x40000015, EXCEPTION_NONCONTINUABLE, 1, extra_info);
+#else
+ (void)errmsg_;
+ abort ();
+#endif
+}
+
+#ifdef ZMQ_HAVE_WINDOWS
+
+const char *zmq::wsa_error()
+{
+ int no = WSAGetLastError ();
+ // TODO: This is not a generic way to handle this...
+ if (no == WSAEWOULDBLOCK)
+ return NULL;
+
+ return wsa_error_no (no);
+}
+
+const char *zmq::wsa_error_no (int no_)
+{
+ // TODO: It seems that list of Windows socket errors is longer than this.
+ // Investigate whether there's a way to convert it into the string
+ // automatically (wsaError->HRESULT->string?).
+ return
+ (no_ == WSABASEERR) ?
+ "No Error" :
+ (no_ == WSAEINTR) ?
+ "Interrupted system call" :
+ (no_ == WSAEBADF) ?
+ "Bad file number" :
+ (no_ == WSAEACCES) ?
+ "Permission denied" :
+ (no_ == WSAEFAULT) ?
+ "Bad address" :
+ (no_ == WSAEINVAL) ?
+ "Invalid argument" :
+ (no_ == WSAEMFILE) ?
+ "Too many open files" :
+ (no_ == WSAEWOULDBLOCK) ?
+ "Operation would block" :
+ (no_ == WSAEINPROGRESS) ?
+ "Operation now in progress" :
+ (no_ == WSAEALREADY) ?
+ "Operation already in progress" :
+ (no_ == WSAENOTSOCK) ?
+ "Socket operation on non-socket" :
+ (no_ == WSAEDESTADDRREQ) ?
+ "Destination address required" :
+ (no_ == WSAEMSGSIZE) ?
+ "Message too long" :
+ (no_ == WSAEPROTOTYPE) ?
+ "Protocol wrong type for socket" :
+ (no_ == WSAENOPROTOOPT) ?
+ "Bad protocol option" :
+ (no_ == WSAEPROTONOSUPPORT) ?
+ "Protocol not supported" :
+ (no_ == WSAESOCKTNOSUPPORT) ?
+ "Socket type not supported" :
+ (no_ == WSAEOPNOTSUPP) ?
+ "Operation not supported on socket" :
+ (no_ == WSAEPFNOSUPPORT) ?
+ "Protocol family not supported" :
+ (no_ == WSAEAFNOSUPPORT) ?
+ "Address family not supported by protocol family" :
+ (no_ == WSAEADDRINUSE) ?
+ "Address already in use" :
+ (no_ == WSAEADDRNOTAVAIL) ?
+ "Can't assign requested address" :
+ (no_ == WSAENETDOWN) ?
+ "Network is down" :
+ (no_ == WSAENETUNREACH) ?
+ "Network is unreachable" :
+ (no_ == WSAENETRESET) ?
+ "Net dropped connection or reset" :
+ (no_ == WSAECONNABORTED) ?
+ "Software caused connection abort" :
+ (no_ == WSAECONNRESET) ?
+ "Connection reset by peer" :
+ (no_ == WSAENOBUFS) ?
+ "No buffer space available" :
+ (no_ == WSAEISCONN) ?
+ "Socket is already connected" :
+ (no_ == WSAENOTCONN) ?
+ "Socket is not connected" :
+ (no_ == WSAESHUTDOWN) ?
+ "Can't send after socket shutdown" :
+ (no_ == WSAETOOMANYREFS) ?
+ "Too many references can't splice" :
+ (no_ == WSAETIMEDOUT) ?
+ "Connection timed out" :
+ (no_ == WSAECONNREFUSED) ?
+ "Connection refused" :
+ (no_ == WSAELOOP) ?
+ "Too many levels of symbolic links" :
+ (no_ == WSAENAMETOOLONG) ?
+ "File name too long" :
+ (no_ == WSAEHOSTDOWN) ?
+ "Host is down" :
+ (no_ == WSAEHOSTUNREACH) ?
+ "No Route to Host" :
+ (no_ == WSAENOTEMPTY) ?
+ "Directory not empty" :
+ (no_ == WSAEPROCLIM) ?
+ "Too many processes" :
+ (no_ == WSAEUSERS) ?
+ "Too many users" :
+ (no_ == WSAEDQUOT) ?
+ "Disc Quota Exceeded" :
+ (no_ == WSAESTALE) ?
+ "Stale NFS file handle" :
+ (no_ == WSAEREMOTE) ?
+ "Too many levels of remote in path" :
+ (no_ == WSASYSNOTREADY) ?
+ "Network SubSystem is unavailable" :
+ (no_ == WSAVERNOTSUPPORTED) ?
+ "WINSOCK DLL Version out of range" :
+ (no_ == WSANOTINITIALISED) ?
+ "Successful WSASTARTUP not yet performed" :
+ (no_ == WSAHOST_NOT_FOUND) ?
+ "Host not found" :
+ (no_ == WSATRY_AGAIN) ?
+ "Non-Authoritative Host not found" :
+ (no_ == WSANO_RECOVERY) ?
+ "Non-Recoverable errors: FORMERR REFUSED NOTIMP" :
+ (no_ == WSANO_DATA) ?
+ "Valid name no data record of requested" :
+ "error not defined";
+}
+
+void zmq::win_error (char *buffer_, size_t buffer_size_)
+{
+ DWORD errcode = GetLastError ();
+#if defined _WIN32_WCE
+ DWORD rc = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errcode, MAKELANGID(LANG_NEUTRAL,
+ SUBLANG_DEFAULT), (LPWSTR)buffer_, buffer_size_ / sizeof(wchar_t), NULL );
+#else
+ DWORD rc = FormatMessageA (FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errcode, MAKELANGID(LANG_NEUTRAL,
+ SUBLANG_DEFAULT), buffer_, (DWORD) buffer_size_, NULL );
+#endif
+ zmq_assert (rc);
+}
+
+int zmq::wsa_error_to_errno (int errcode)
+{
+ switch (errcode) {
+// 10004 - Interrupted system call.
+ case WSAEINTR:
+ return EINTR;
+// 10009 - File handle is not valid.
+ case WSAEBADF:
+ return EBADF;
+// 10013 - Permission denied.
+ case WSAEACCES:
+ return EACCES;
+// 10014 - Bad address.
+ case WSAEFAULT:
+ return EFAULT;
+// 10022 - Invalid argument.
+ case WSAEINVAL:
+ return EINVAL;
+// 10024 - Too many open files.
+ case WSAEMFILE:
+ return EMFILE;
+// 10035 - Operation would block.
+ case WSAEWOULDBLOCK:
+ return EBUSY;
+// 10036 - Operation now in progress.
+ case WSAEINPROGRESS:
+ return EAGAIN;
+// 10037 - Operation already in progress.
+ case WSAEALREADY:
+ return EAGAIN;
+// 10038 - Socket operation on non-socket.
+ case WSAENOTSOCK:
+ return ENOTSOCK;
+// 10039 - Destination address required.
+ case WSAEDESTADDRREQ:
+ return EFAULT;
+// 10040 - Message too long.
+ case WSAEMSGSIZE:
+ return EMSGSIZE;
+// 10041 - Protocol wrong type for socket.
+ case WSAEPROTOTYPE:
+ return EFAULT;
+// 10042 - Bad protocol option.
+ case WSAENOPROTOOPT:
+ return EINVAL;
+// 10043 - Protocol not supported.
+ case WSAEPROTONOSUPPORT:
+ return EPROTONOSUPPORT;
+// 10044 - Socket type not supported.
+ case WSAESOCKTNOSUPPORT:
+ return EFAULT;
+// 10045 - Operation not supported on socket.
+ case WSAEOPNOTSUPP:
+ return EFAULT;
+// 10046 - Protocol family not supported.
+ case WSAEPFNOSUPPORT:
+ return EPROTONOSUPPORT;
+// 10047 - Address family not supported by protocol family.
+ case WSAEAFNOSUPPORT:
+ return EAFNOSUPPORT;
+// 10048 - Address already in use.
+ case WSAEADDRINUSE:
+ return EADDRINUSE;
+// 10049 - Cannot assign requested address.
+ case WSAEADDRNOTAVAIL:
+ return EADDRNOTAVAIL;
+// 10050 - Network is down.
+ case WSAENETDOWN:
+ return ENETDOWN;
+// 10051 - Network is unreachable.
+ case WSAENETUNREACH:
+ return ENETUNREACH;
+// 10052 - Network dropped connection on reset.
+ case WSAENETRESET:
+ return ENETRESET;
+// 10053 - Software caused connection abort.
+ case WSAECONNABORTED:
+ return ECONNABORTED;
+// 10054 - Connection reset by peer.
+ case WSAECONNRESET:
+ return ECONNRESET;
+// 10055 - No buffer space available.
+ case WSAENOBUFS:
+ return ENOBUFS;
+// 10056 - Socket is already connected.
+ case WSAEISCONN:
+ return EFAULT;
+// 10057 - Socket is not connected.
+ case WSAENOTCONN:
+ return ENOTCONN;
+// 10058 - Can't send after socket shutdown.
+ case WSAESHUTDOWN:
+ return EFAULT;
+// 10059 - Too many references can't splice.
+ case WSAETOOMANYREFS:
+ return EFAULT;
+// 10060 - Connection timed out.
+ case WSAETIMEDOUT:
+ return ETIMEDOUT;
+// 10061 - Connection refused.
+ case WSAECONNREFUSED:
+ return ECONNREFUSED;
+// 10062 - Too many levels of symbolic links.
+ case WSAELOOP:
+ return EFAULT;
+// 10063 - File name too long.
+ case WSAENAMETOOLONG:
+ return EFAULT;
+// 10064 - Host is down.
+ case WSAEHOSTDOWN:
+ return EAGAIN;
+// 10065 - No route to host.
+ case WSAEHOSTUNREACH:
+ return EHOSTUNREACH;
+// 10066 - Directory not empty.
+ case WSAENOTEMPTY:
+ return EFAULT;
+// 10067 - Too many processes.
+ case WSAEPROCLIM:
+ return EFAULT;
+// 10068 - Too many users.
+ case WSAEUSERS:
+ return EFAULT;
+// 10069 - Disc Quota Exceeded.
+ case WSAEDQUOT:
+ return EFAULT;
+// 10070 - Stale NFS file handle.
+ case WSAESTALE:
+ return EFAULT;
+// 10071 - Too many levels of remote in path.
+ case WSAEREMOTE:
+ return EFAULT;
+// 10091 - Network SubSystem is unavailable.
+ case WSASYSNOTREADY:
+ return EFAULT;
+// 10092 - WINSOCK DLL Version out of range.
+ case WSAVERNOTSUPPORTED:
+ return EFAULT;
+// 10093 - Successful WSASTARTUP not yet performed.
+ case WSANOTINITIALISED:
+ return EFAULT;
+// 11001 - Host not found.
+ case WSAHOST_NOT_FOUND:
+ return EFAULT;
+// 11002 - Non-Authoritative Host not found.
+ case WSATRY_AGAIN:
+ return EFAULT;
+// 11003 - Non-Recoverable errors: FORMERR REFUSED NOTIMP.
+ case WSANO_RECOVERY:
+ return EFAULT;
+// 11004 - Valid name no data record of requested.
+ case WSANO_DATA:
+ return EFAULT;
+ default:
+ wsa_assert (false);
+ }
+ // Not reachable
+ return 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/err.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/err.hpp
new file mode 100644
index 00000000..fcefb892
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/err.hpp
@@ -0,0 +1,168 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_ERR_HPP_INCLUDED__
+#define __ZMQ_ERR_HPP_INCLUDED__
+
+#include <assert.h>
+#if defined _WIN32_WCE
+#include "..\builds\msvc\errno.hpp"
+#else
+#include <errno.h>
+#endif
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "platform.hpp"
+#include "likely.hpp"
+
+// 0MQ-specific error codes are defined in zmq.h
+#include "../include/zmq.h"
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <netdb.h>
+#endif
+
+// EPROTO is not used by OpenBSD and maybe other platforms.
+#ifndef EPROTO
+#define EPROTO 0
+#endif
+
+namespace zmq
+{
+ const char *errno_to_string (int errno_);
+ void zmq_abort (const char *errmsg_);
+}
+
+#ifdef ZMQ_HAVE_WINDOWS
+
+namespace zmq
+{
+ const char *wsa_error ();
+ const char *wsa_error_no (int no_);
+ void win_error (char *buffer_, size_t buffer_size_);
+ int wsa_error_to_errno (int errcode);
+}
+
+// Provides convenient way to check WSA-style errors on Windows.
+#define wsa_assert(x) \
+ do {\
+ if (unlikely (!(x))) {\
+ const char *errstr = zmq::wsa_error ();\
+ if (errstr != NULL) {\
+ fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
+ __FILE__, __LINE__);\
+ zmq::zmq_abort (errstr);\
+ }\
+ }\
+ } while (false)
+
+// Provides convenient way to assert on WSA-style errors on Windows.
+#define wsa_assert_no(no) \
+ do {\
+ const char *errstr = zmq::wsa_error_no (no);\
+ if (errstr != NULL) {\
+ fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
+ __FILE__, __LINE__);\
+ zmq::zmq_abort (errstr);\
+ }\
+ } while (false)
+
+// Provides convenient way to check GetLastError-style errors on Windows.
+#define win_assert(x) \
+ do {\
+ if (unlikely (!(x))) {\
+ char errstr [256];\
+ zmq::win_error (errstr, 256);\
+ fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
+ __FILE__, __LINE__);\
+ zmq::zmq_abort (errstr);\
+ }\
+ } while (false)
+
+#endif
+
+// This macro works in exactly the same way as the normal assert. It is used
+// in its stead because standard assert on Win32 in broken - it prints nothing
+// when used within the scope of JNI library.
+#define zmq_assert(x) \
+ do {\
+ if (unlikely (!(x))) {\
+ fprintf (stderr, "Assertion failed: %s (%s:%d)\n", #x, \
+ __FILE__, __LINE__);\
+ zmq::zmq_abort (#x);\
+ }\
+ } while (false)
+
+// Provides convenient way to check for errno-style errors.
+#define errno_assert(x) \
+ do {\
+ if (unlikely (!(x))) {\
+ const char *errstr = strerror (errno);\
+ fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
+ zmq::zmq_abort (errstr);\
+ }\
+ } while (false)
+
+// Provides convenient way to check for POSIX errors.
+#define posix_assert(x) \
+ do {\
+ if (unlikely (x)) {\
+ const char *errstr = strerror (x);\
+ fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
+ zmq::zmq_abort (errstr);\
+ }\
+ } while (false)
+
+// Provides convenient way to check for errors from getaddrinfo.
+#define gai_assert(x) \
+ do {\
+ if (unlikely (x)) {\
+ const char *errstr = gai_strerror (x);\
+ fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
+ zmq::zmq_abort (errstr);\
+ }\
+ } while (false)
+
+// Provides convenient way to check whether memory allocation have succeeded.
+#define alloc_assert(x) \
+ do {\
+ if (unlikely (!x)) {\
+ fprintf (stderr, "FATAL ERROR: OUT OF MEMORY (%s:%d)\n",\
+ __FILE__, __LINE__);\
+ zmq::zmq_abort ("FATAL ERROR: OUT OF MEMORY");\
+ }\
+ } while (false)
+
+#endif
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fd.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fd.hpp
new file mode 100644
index 00000000..315c7fae
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fd.hpp
@@ -0,0 +1,54 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_FD_HPP_INCLUDED__
+#define __ZMQ_FD_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+namespace zmq
+{
+#ifdef ZMQ_HAVE_WINDOWS
+#if defined _MSC_VER &&_MSC_VER <= 1400
+ typedef UINT_PTR fd_t;
+ enum {retired_fd = (fd_t)(~0)};
+#else
+ typedef SOCKET fd_t;
+ enum {retired_fd = (fd_t)INVALID_SOCKET};
+#endif
+#else
+ typedef int fd_t;
+ enum {retired_fd = -1};
+#endif
+}
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fq.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fq.cpp
new file mode 100644
index 00000000..9269eb20
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fq.cpp
@@ -0,0 +1,162 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "fq.hpp"
+#include "pipe.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+
+zmq::fq_t::fq_t () :
+ active (0),
+ last_in (NULL),
+ current (0),
+ more (false)
+{
+}
+
+zmq::fq_t::~fq_t ()
+{
+ zmq_assert (pipes.empty ());
+}
+
+void zmq::fq_t::attach (pipe_t *pipe_)
+{
+ pipes.push_back (pipe_);
+ pipes.swap (active, pipes.size () - 1);
+ active++;
+}
+
+void zmq::fq_t::pipe_terminated (pipe_t *pipe_)
+{
+ const pipes_t::size_type index = pipes.index (pipe_);
+
+ // Remove the pipe from the list; adjust number of active pipes
+ // accordingly.
+ if (index < active) {
+ active--;
+ pipes.swap (index, active);
+ if (current == active)
+ current = 0;
+ }
+ pipes.erase (pipe_);
+
+ if (last_in == pipe_) {
+ saved_credential = last_in->get_credential ();
+ last_in = NULL;
+ }
+}
+
+void zmq::fq_t::activated (pipe_t *pipe_)
+{
+ // Move the pipe to the list of active pipes.
+ pipes.swap (pipes.index (pipe_), active);
+ active++;
+}
+
+int zmq::fq_t::recv (msg_t *msg_)
+{
+ return recvpipe (msg_, NULL);
+}
+
+int zmq::fq_t::recvpipe (msg_t *msg_, pipe_t **pipe_)
+{
+ // Deallocate old content of the message.
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+
+ // Round-robin over the pipes to get the next message.
+ while (active > 0) {
+
+ // Try to fetch new message. If we've already read part of the message
+ // subsequent part should be immediately available.
+ bool fetched = pipes [current]->read (msg_);
+
+ // Note that when message is not fetched, current pipe is deactivated
+ // and replaced by another active pipe. Thus we don't have to increase
+ // the 'current' pointer.
+ if (fetched) {
+ if (pipe_)
+ *pipe_ = pipes [current];
+ more = msg_->flags () & msg_t::more? true: false;
+ if (!more) {
+ last_in = pipes [current];
+ current = (current + 1) % active;
+ }
+ return 0;
+ }
+
+ // Check the atomicity of the message.
+ // If we've already received the first part of the message
+ // we should get the remaining parts without blocking.
+ zmq_assert (!more);
+
+ active--;
+ pipes.swap (current, active);
+ if (current == active)
+ current = 0;
+ }
+
+ // No message is available. Initialise the output parameter
+ // to be a 0-byte message.
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ errno = EAGAIN;
+ return -1;
+}
+
+bool zmq::fq_t::has_in ()
+{
+ // There are subsequent parts of the partly-read message available.
+ if (more)
+ return true;
+
+ // Note that messing with current doesn't break the fairness of fair
+ // queueing algorithm. If there are no messages available current will
+ // get back to its original value. Otherwise it'll point to the first
+ // pipe holding messages, skipping only pipes with no messages available.
+ while (active > 0) {
+ if (pipes [current]->check_read ())
+ return true;
+
+ // Deactivate the pipe.
+ active--;
+ pipes.swap (current, active);
+ if (current == active)
+ current = 0;
+ }
+
+ return false;
+}
+
+zmq::blob_t zmq::fq_t::get_credential () const
+{
+ return last_in?
+ last_in->get_credential (): saved_credential;
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fq.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fq.hpp
new file mode 100644
index 00000000..6c06c691
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/fq.hpp
@@ -0,0 +1,92 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_FQ_HPP_INCLUDED__
+#define __ZMQ_FQ_HPP_INCLUDED__
+
+#include "array.hpp"
+#include "blob.hpp"
+#include "pipe.hpp"
+#include "msg.hpp"
+
+namespace zmq
+{
+
+ // Class manages a set of inbound pipes. On receive it performs fair
+ // queueing so that senders gone berserk won't cause denial of
+ // service for decent senders.
+
+ class fq_t
+ {
+ public:
+
+ fq_t ();
+ ~fq_t ();
+
+ void attach (pipe_t *pipe_);
+ void activated (pipe_t *pipe_);
+ void pipe_terminated (pipe_t *pipe_);
+
+ int recv (msg_t *msg_);
+ int recvpipe (msg_t *msg_, pipe_t **pipe_);
+ bool has_in ();
+ blob_t get_credential () const;
+
+ private:
+
+ // Inbound pipes.
+ typedef array_t <pipe_t, 1> pipes_t;
+ pipes_t pipes;
+
+ // Number of active pipes. All the active pipes are located at the
+ // beginning of the pipes array.
+ pipes_t::size_type active;
+
+ // Pointer to the last pipe we received message from.
+ // NULL when no message has been received or the pipe
+ // has terminated.
+ pipe_t *last_in;
+
+ // Index of the next bound pipe to read a message from.
+ pipes_t::size_type current;
+
+ // If true, part of a multipart message was already received, but
+ // there are following parts still waiting in the current pipe.
+ bool more;
+
+ // Holds credential after the last_acive_pipe has terminated.
+ blob_t saved_credential;
+
+ fq_t (const fq_t&);
+ const fq_t &operator = (const fq_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_client.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_client.cpp
new file mode 100644
index 00000000..3373c7ed
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_client.cpp
@@ -0,0 +1,230 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#ifdef HAVE_LIBGSSAPI_KRB5
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <string.h>
+#include <string>
+
+#include "msg.hpp"
+#include "session_base.hpp"
+#include "err.hpp"
+#include "gssapi_client.hpp"
+#include "wire.hpp"
+
+zmq::gssapi_client_t::gssapi_client_t (const options_t &options_) :
+ gssapi_mechanism_base_t (options_),
+ state (call_next_init),
+ token_ptr (GSS_C_NO_BUFFER),
+ mechs (),
+ security_context_established (false)
+{
+ const std::string::size_type service_size = options_.gss_service_principal.size();
+ service_name = static_cast <char *>(malloc(service_size+1));
+ assert(service_name);
+ memcpy(service_name, options_.gss_service_principal.c_str(), service_size+1 );
+
+ maj_stat = GSS_S_COMPLETE;
+ if(!options_.gss_principal.empty())
+ {
+ const std::string::size_type principal_size = options_.gss_principal.size();
+ principal_name = static_cast <char *>(malloc(principal_size+1));
+ assert(principal_name);
+ memcpy(principal_name, options_.gss_principal.c_str(), principal_size+1 );
+
+ if (acquire_credentials (principal_name, &cred) != 0)
+ maj_stat = GSS_S_FAILURE;
+ }
+
+ mechs.elements = NULL;
+ mechs.count = 0;
+}
+
+zmq::gssapi_client_t::~gssapi_client_t ()
+{
+ if(service_name)
+ free (service_name);
+ if(cred)
+ gss_release_cred(&min_stat, &cred);
+}
+
+int zmq::gssapi_client_t::next_handshake_command (msg_t *msg_)
+{
+ if (state == send_ready) {
+ int rc = produce_ready(msg_);
+ if (rc == 0)
+ state = connected;
+
+ return rc;
+ }
+
+ if (state != call_next_init) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ if (initialize_context () < 0)
+ return -1;
+
+ if (produce_next_token (msg_) < 0)
+ return -1;
+
+ if (maj_stat != GSS_S_CONTINUE_NEEDED && maj_stat != GSS_S_COMPLETE)
+ return -1;
+
+ if (maj_stat == GSS_S_COMPLETE) {
+ security_context_established = true;
+ state = recv_ready;
+ }
+ else
+ state = recv_next_token;
+
+ return 0;
+}
+
+int zmq::gssapi_client_t::process_handshake_command (msg_t *msg_)
+{
+ if (state == recv_ready) {
+ int rc = process_ready(msg_);
+ if (rc == 0)
+ state = send_ready;
+
+ return rc;
+ }
+
+ if (state != recv_next_token) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ if (process_next_token (msg_) < 0)
+ return -1;
+
+ if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED)
+ return -1;
+
+ state = call_next_init;
+
+ errno_assert (msg_->close () == 0);
+ errno_assert (msg_->init () == 0);
+
+ return 0;
+}
+
+int zmq::gssapi_client_t::encode (msg_t *msg_)
+{
+ zmq_assert (state == connected);
+
+ if (do_encryption)
+ return encode_message (msg_);
+
+ return 0;
+}
+
+int zmq::gssapi_client_t::decode (msg_t *msg_)
+{
+ zmq_assert (state == connected);
+
+ if (do_encryption)
+ return decode_message (msg_);
+
+ return 0;
+}
+
+zmq::mechanism_t::status_t zmq::gssapi_client_t::status () const
+{
+ return state == connected? mechanism_t::ready: mechanism_t::handshaking;
+}
+
+int zmq::gssapi_client_t::initialize_context ()
+{
+ // First time through, import service_name into target_name
+ if (target_name == GSS_C_NO_NAME) {
+ send_tok.value = service_name;
+ send_tok.length = strlen(service_name);
+ OM_uint32 maj = gss_import_name(&min_stat, &send_tok,
+ GSS_C_NT_HOSTBASED_SERVICE,
+ &target_name);
+
+ if (maj != GSS_S_COMPLETE)
+ return -1;
+ }
+
+ maj_stat = gss_init_sec_context(&init_sec_min_stat, cred, &context,
+ target_name, mechs.elements,
+ gss_flags, 0, NULL, token_ptr, NULL,
+ &send_tok, &ret_flags, NULL);
+
+ if (token_ptr != GSS_C_NO_BUFFER)
+ free(recv_tok.value);
+
+ return 0;
+}
+
+int zmq::gssapi_client_t::produce_next_token (msg_t *msg_)
+{
+ if (send_tok.length != 0) { // Server expects another token
+ if (produce_initiate(msg_, send_tok.value, send_tok.length) < 0) {
+ gss_release_buffer(&min_stat, &send_tok);
+ gss_release_name(&min_stat, &target_name);
+ return -1;
+ }
+ }
+ gss_release_buffer(&min_stat, &send_tok);
+
+ if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED) {
+ gss_release_name(&min_stat, &target_name);
+ if (context != GSS_C_NO_CONTEXT)
+ gss_delete_sec_context(&min_stat, &context, GSS_C_NO_BUFFER);
+ return -1;
+ }
+
+ return 0;
+}
+
+int zmq::gssapi_client_t::process_next_token (msg_t *msg_)
+{
+ if (maj_stat == GSS_S_CONTINUE_NEEDED) {
+ if (process_initiate(msg_, &recv_tok.value, recv_tok.length) < 0) {
+ gss_release_name(&min_stat, &target_name);
+ return -1;
+ }
+ token_ptr = &recv_tok;
+ }
+
+ return 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_client.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_client.hpp
new file mode 100644
index 00000000..7bc9d5af
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_client.hpp
@@ -0,0 +1,93 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_GSSAPI_CLIENT_HPP_INCLUDED__
+#define __ZMQ_GSSAPI_CLIENT_HPP_INCLUDED__
+
+#ifdef HAVE_LIBGSSAPI_KRB5
+
+#include "gssapi_mechanism_base.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+
+ class gssapi_client_t :
+ public gssapi_mechanism_base_t
+ {
+ public:
+
+ gssapi_client_t (const options_t &options_);
+ virtual ~gssapi_client_t ();
+
+ // mechanism implementation
+ virtual int next_handshake_command (msg_t *msg_);
+ virtual int process_handshake_command (msg_t *msg_);
+ virtual int encode (msg_t *msg_);
+ virtual int decode (msg_t *msg_);
+ virtual status_t status () const;
+
+ private:
+
+ enum state_t {
+ call_next_init,
+ send_next_token,
+ recv_next_token,
+ send_ready,
+ recv_ready,
+ connected
+ };
+
+ // Human-readable principal name of the service we are connecting to
+ char * service_name;
+
+ // Current FSM state
+ state_t state;
+
+ // Points to either send_tok or recv_tok
+ // during context initialization
+ gss_buffer_desc *token_ptr;
+
+ // The desired underlying mechanism
+ gss_OID_set_desc mechs;
+
+ // True iff client considers the server authenticated
+ bool security_context_established;
+
+ int initialize_context ();
+ int produce_next_token (msg_t *msg_);
+ int process_next_token (msg_t *msg_);
+ };
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_mechanism_base.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_mechanism_base.cpp
new file mode 100644
index 00000000..355f1528
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_mechanism_base.cpp
@@ -0,0 +1,347 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#ifdef HAVE_LIBGSSAPI_KRB5
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <string.h>
+#include <string>
+
+#include "msg.hpp"
+#include "session_base.hpp"
+#include "err.hpp"
+#include "gssapi_mechanism_base.hpp"
+#include "wire.hpp"
+
+zmq::gssapi_mechanism_base_t::gssapi_mechanism_base_t (const options_t & options_) :
+ mechanism_t(options_),
+ send_tok (),
+ recv_tok (),
+ /// FIXME remove? in_buf (),
+ target_name (GSS_C_NO_NAME),
+ principal_name (NULL),
+ maj_stat (GSS_S_COMPLETE),
+ min_stat (0),
+ init_sec_min_stat (0),
+ ret_flags (0),
+ gss_flags (GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG),
+ cred (GSS_C_NO_CREDENTIAL),
+ context (GSS_C_NO_CONTEXT),
+ do_encryption (!options_.gss_plaintext)
+{
+}
+
+zmq::gssapi_mechanism_base_t::~gssapi_mechanism_base_t ()
+{
+ if(target_name)
+ gss_release_name(&min_stat, &target_name);
+ if(context)
+ gss_delete_sec_context(&min_stat, &context, GSS_C_NO_BUFFER);
+}
+
+int zmq::gssapi_mechanism_base_t::encode_message (msg_t *msg_)
+{
+ // Wrap the token value
+ int state;
+ gss_buffer_desc plaintext;
+ gss_buffer_desc wrapped;
+
+ uint8_t flags = 0;
+ if (msg_->flags () & msg_t::more)
+ flags |= 0x01;
+
+ uint8_t *plaintext_buffer = static_cast <uint8_t *>(malloc(msg_->size ()+1));
+ plaintext_buffer[0] = flags;
+ memcpy (plaintext_buffer+1, msg_->data(), msg_->size());
+
+ plaintext.value = plaintext_buffer;
+ plaintext.length = msg_->size ()+1;
+
+ maj_stat = gss_wrap(&min_stat, context, 1, GSS_C_QOP_DEFAULT,
+ &plaintext, &state, &wrapped);
+
+ zmq_assert (maj_stat == GSS_S_COMPLETE);
+ zmq_assert (state);
+
+ // Re-initialize msg_ for wrapped text
+ int rc = msg_->close ();
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (8 + 4 + wrapped.length);
+ zmq_assert (rc == 0);
+
+ uint8_t *ptr = static_cast <uint8_t *> (msg_->data ());
+
+ // Add command string
+ memcpy (ptr, "\x07MESSAGE", 8);
+ ptr += 8;
+
+ // Add token length
+ put_uint32 (ptr, static_cast <uint32_t> (wrapped.length));
+ ptr += 4;
+
+ // Add wrapped token value
+ memcpy (ptr, wrapped.value, wrapped.length);
+ ptr += wrapped.length;
+
+ gss_release_buffer (&min_stat, &wrapped);
+
+ return 0;
+}
+
+int zmq::gssapi_mechanism_base_t::decode_message (msg_t *msg_)
+{
+ const uint8_t *ptr = static_cast <uint8_t *> (msg_->data ());
+ size_t bytes_left = msg_->size ();
+
+ // Get command string
+ if (bytes_left < 8 || memcmp (ptr, "\x07MESSAGE", 8)) {
+ errno = EPROTO;
+ return -1;
+ }
+ ptr += 8;
+ bytes_left -= 8;
+
+ // Get token length
+ if (bytes_left < 4) {
+ errno = EPROTO;
+ return -1;
+ }
+ gss_buffer_desc wrapped;
+ wrapped.length = get_uint32 (ptr);
+ ptr += 4;
+ bytes_left -= 4;
+
+ // Get token value
+ if (bytes_left < wrapped.length) {
+ errno = EPROTO;
+ return -1;
+ }
+ // TODO: instead of malloc/memcpy, can we just do: wrapped.value = ptr;
+ const size_t alloc_length = wrapped.length? wrapped.length: 1;
+ wrapped.value = static_cast <char *> (malloc (alloc_length));
+ if (wrapped.length) {
+ alloc_assert (wrapped.value);
+ memcpy(wrapped.value, ptr, wrapped.length);
+ ptr += wrapped.length;
+ bytes_left -= wrapped.length;
+ }
+
+ // Unwrap the token value
+ int state;
+ gss_buffer_desc plaintext;
+ maj_stat = gss_unwrap(&min_stat, context, &wrapped, &plaintext,
+ &state, (gss_qop_t *) NULL);
+
+ zmq_assert(maj_stat == GSS_S_COMPLETE);
+ zmq_assert(state);
+
+ // Re-initialize msg_ for plaintext
+ int rc = msg_->close ();
+ zmq_assert (rc == 0);
+
+ rc = msg_->init_size (plaintext.length-1);
+ zmq_assert (rc == 0);
+
+ const uint8_t flags = static_cast <char *> (plaintext.value)[0];
+ if (flags & 0x01)
+ msg_->set_flags (msg_t::more);
+
+ memcpy (msg_->data (), static_cast <char *> (plaintext.value)+1, plaintext.length-1);
+
+ gss_release_buffer (&min_stat, &plaintext);
+ gss_release_buffer (&min_stat, &wrapped);
+
+ if (bytes_left > 0) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ return 0;
+}
+
+int zmq::gssapi_mechanism_base_t::produce_initiate (msg_t *msg_, void *token_value_, size_t token_length_)
+{
+ zmq_assert (token_value_);
+ zmq_assert (token_length_ <= 0xFFFFFFFFUL);
+
+ const size_t command_size = 9 + 4 + token_length_;
+
+ const int rc = msg_->init_size (command_size);
+ errno_assert (rc == 0);
+
+ uint8_t *ptr = static_cast <uint8_t *> (msg_->data ());
+
+ // Add command string
+ memcpy (ptr, "\x08INITIATE", 9);
+ ptr += 9;
+
+ // Add token length
+ put_uint32 (ptr, static_cast <uint32_t> (token_length_));
+ ptr += 4;
+
+ // Add token value
+ memcpy (ptr, token_value_, token_length_);
+ ptr += token_length_;
+
+ return 0;
+}
+
+int zmq::gssapi_mechanism_base_t::process_initiate (msg_t *msg_, void **token_value_, size_t &token_length_)
+{
+ zmq_assert (token_value_);
+
+ const uint8_t *ptr = static_cast <uint8_t *> (msg_->data ());
+ size_t bytes_left = msg_->size ();
+
+ // Get command string
+ if (bytes_left < 9 || memcmp (ptr, "\x08INITIATE", 9)) {
+ errno = EPROTO;
+ return -1;
+ }
+ ptr += 9;
+ bytes_left -= 9;
+
+ // Get token length
+ if (bytes_left < 4) {
+ errno = EPROTO;
+ return -1;
+ }
+ token_length_ = get_uint32 (ptr);
+ ptr += 4;
+ bytes_left -= 4;
+
+ // Get token value
+ if (bytes_left < token_length_) {
+ errno = EPROTO;
+ return -1;
+ }
+ *token_value_ = static_cast <char *> (malloc (token_length_ ? token_length_ : 1));
+ if (token_length_) {
+ alloc_assert (*token_value_);
+ memcpy(*token_value_, ptr, token_length_);
+ ptr += token_length_;
+ bytes_left -= token_length_;
+ }
+
+ if (bytes_left > 0) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ return 0;
+}
+
+int zmq::gssapi_mechanism_base_t::produce_ready (msg_t *msg_)
+{
+ unsigned char * const command_buffer = (unsigned char *) malloc (512);
+ alloc_assert (command_buffer);
+
+ unsigned char *ptr = command_buffer;
+
+ // Add command name
+ memcpy (ptr, "\x05READY", 6);
+ ptr += 6;
+
+ // Add socket type property
+ const char *socket_type = socket_type_string (options.type);
+ ptr += add_property (ptr, "Socket-Type", socket_type, strlen (socket_type));
+
+ // Add identity property
+ if (options.type == ZMQ_REQ
+ || options.type == ZMQ_DEALER
+ || options.type == ZMQ_ROUTER)
+ ptr += add_property (ptr, "Identity", options.identity, options.identity_size);
+
+ const size_t command_size = ptr - command_buffer;
+ const int rc = msg_->init_size (command_size);
+ errno_assert (rc == 0);
+ memcpy (msg_->data (), command_buffer, command_size);
+ free (command_buffer);
+
+ if (do_encryption)
+ return encode_message (msg_);
+
+ return 0;
+}
+
+int zmq::gssapi_mechanism_base_t::process_ready (msg_t *msg_)
+{
+ if (do_encryption) {
+ const int rc = decode_message (msg_);
+ if (rc != 0)
+ return rc;
+ }
+
+ const unsigned char *ptr = static_cast <unsigned char *> (msg_->data ());
+ size_t bytes_left = msg_->size ();
+
+ if (bytes_left < 6 || memcmp (ptr, "\x05READY", 6)) {
+ errno = EPROTO;
+ return -1;
+ }
+ ptr += 6;
+ bytes_left -= 6;
+ return parse_metadata (ptr, bytes_left);
+}
+
+int zmq::gssapi_mechanism_base_t::acquire_credentials (char * service_name_, gss_cred_id_t * cred_)
+{
+ OM_uint32 maj_stat;
+ OM_uint32 min_stat;
+ gss_name_t server_name;
+
+ gss_buffer_desc name_buf;
+ name_buf.value = service_name_;
+ name_buf.length = strlen ((char *) name_buf.value) + 1;
+
+ maj_stat = gss_import_name (&min_stat, &name_buf,
+ GSS_C_NT_HOSTBASED_SERVICE, &server_name);
+
+ if (maj_stat != GSS_S_COMPLETE)
+ return -1;
+
+ maj_stat = gss_acquire_cred (&min_stat, server_name, 0,
+ GSS_C_NO_OID_SET, GSS_C_ACCEPT,
+ cred_, NULL, NULL);
+
+ if (maj_stat != GSS_S_COMPLETE)
+ return -1;
+
+ gss_release_name(&min_stat, &server_name);
+
+ return 0;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_mechanism_base.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_mechanism_base.hpp
new file mode 100644
index 00000000..1e26a950
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_mechanism_base.hpp
@@ -0,0 +1,132 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_GSSAPI_MECHANISM_BASE_HPP_INCLUDED__
+#define __ZMQ_GSSAPI_MECHANISM_BASE_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#ifdef HAVE_LIBGSSAPI_KRB5
+
+#ifndef ZMQ_HAVE_FREEBSD
+#include <gssapi/gssapi_generic.h>
+#endif
+#include <gssapi/gssapi_krb5.h>
+
+#include "mechanism.hpp"
+#include "options.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+
+ /// Commonalities between clients and servers are captured here.
+ /// For example, clients and servers both need to produce and
+ /// process context-level GSSAPI tokens (via INITIATE commands)
+ /// and per-message GSSAPI tokens (via MESSAGE commands).
+ class gssapi_mechanism_base_t:
+ public mechanism_t
+ {
+ public:
+ gssapi_mechanism_base_t (const options_t &options_);
+ virtual ~gssapi_mechanism_base_t () = 0;
+
+ protected:
+ // Produce a context-level GSSAPI token (INITIATE command)
+ // during security context initialization.
+ int produce_initiate (msg_t *msg_, void *data_, size_t data_len_);
+
+ // Process a context-level GSSAPI token (INITIATE command)
+ // during security context initialization.
+ int process_initiate (msg_t *msg_, void **data_, size_t &data_len_);
+
+ // Produce a metadata ready msg (READY) to conclude handshake
+ int produce_ready (msg_t *msg_);
+
+ // Process a metadata ready msg (READY)
+ int process_ready (msg_t *msg_);
+
+ // Encode a per-message GSSAPI token (MESSAGE command) using
+ // the established security context.
+ int encode_message (msg_t *msg_);
+
+ // Decode a per-message GSSAPI token (MESSAGE command) using
+ // the established security context.
+ int decode_message (msg_t *msg_);
+
+ // Acquire security context credentials from the
+ // underlying mechanism.
+ static int acquire_credentials (char * principal_name_,
+ gss_cred_id_t * cred_);
+
+ protected:
+ // Opaque GSSAPI token for outgoing data
+ gss_buffer_desc send_tok;
+
+ // Opaque GSSAPI token for incoming data
+ gss_buffer_desc recv_tok;
+
+ // Opaque GSSAPI representation of principal
+ gss_name_t target_name;
+
+ // Human-readable principal name
+ char * principal_name;
+
+ // Status code returned by GSSAPI functions
+ OM_uint32 maj_stat;
+
+ // Status code returned by the underlying mechanism
+ OM_uint32 min_stat;
+
+ // Status code returned by the underlying mechanism
+ // during context initialization
+ OM_uint32 init_sec_min_stat;
+
+ // Flags returned by GSSAPI (ignored)
+ OM_uint32 ret_flags;
+
+ // Flags returned by GSSAPI (ignored)
+ OM_uint32 gss_flags;
+
+ // Credentials used to establish security context
+ gss_cred_id_t cred;
+
+ // Opaque GSSAPI representation of the security context
+ gss_ctx_id_t context;
+
+ // If true, use gss to encrypt messages. If false, only utilize gss for auth.
+ bool do_encryption;
+ };
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_server.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_server.cpp
new file mode 100644
index 00000000..97f3f9b5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_server.cpp
@@ -0,0 +1,377 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#ifdef HAVE_LIBGSSAPI_KRB5
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <string.h>
+#include <string>
+
+#include "msg.hpp"
+#include "session_base.hpp"
+#include "err.hpp"
+#include "gssapi_server.hpp"
+#include "wire.hpp"
+
+#include <gssapi/gssapi.h>
+
+zmq::gssapi_server_t::gssapi_server_t (session_base_t *session_,
+ const std::string &peer_address_,
+ const options_t &options_) :
+ gssapi_mechanism_base_t (options_),
+ session (session_),
+ peer_address (peer_address_),
+ state (recv_next_token),
+ security_context_established (false)
+{
+ maj_stat = GSS_S_CONTINUE_NEEDED;
+ if(!options_.gss_principal.empty())
+ {
+ const std::string::size_type principal_size = options_.gss_principal.size();
+ principal_name = static_cast <char *>(malloc(principal_size+1));
+ assert(principal_name);
+ memcpy(principal_name, options_.gss_principal.c_str(), principal_size+1 );
+
+ if (acquire_credentials (principal_name, &cred) != 0)
+ maj_stat = GSS_S_FAILURE;
+ }
+}
+
+zmq::gssapi_server_t::~gssapi_server_t ()
+{
+ if(cred)
+ gss_release_cred(&min_stat, &cred);
+
+ if(target_name)
+ gss_release_name(&min_stat, &target_name);
+}
+
+int zmq::gssapi_server_t::next_handshake_command (msg_t *msg_)
+{
+ if (state == send_ready) {
+ int rc = produce_ready(msg_);
+ if (rc == 0)
+ state = recv_ready;
+
+ return rc;
+ }
+
+ if (state != send_next_token) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ if (produce_next_token (msg_) < 0)
+ return -1;
+
+ if (maj_stat != GSS_S_CONTINUE_NEEDED && maj_stat != GSS_S_COMPLETE)
+ return -1;
+
+ if (maj_stat == GSS_S_COMPLETE) {
+ security_context_established = true;
+ }
+
+ state = recv_next_token;
+
+ return 0;
+}
+
+int zmq::gssapi_server_t::process_handshake_command (msg_t *msg_)
+{
+ if (state == recv_ready) {
+ int rc = process_ready(msg_);
+ if (rc == 0)
+ state = connected;
+
+ return rc;
+ }
+
+ if (state != recv_next_token) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ if (security_context_established) {
+ // Use ZAP protocol (RFC 27) to authenticate the user.
+ bool expecting_zap_reply = false;
+ int rc = session->zap_connect ();
+ if (rc == 0) {
+ send_zap_request();
+ rc = receive_and_process_zap_reply ();
+ if (rc != 0) {
+ if (errno != EAGAIN)
+ return -1;
+ expecting_zap_reply = true;
+ }
+ }
+ state = expecting_zap_reply? expect_zap_reply: send_ready;
+ return 0;
+ }
+
+ if (process_next_token (msg_) < 0)
+ return -1;
+
+ accept_context ();
+ state = send_next_token;
+
+ errno_assert (msg_->close () == 0);
+ errno_assert (msg_->init () == 0);
+
+ return 0;
+}
+
+void zmq::gssapi_server_t::send_zap_request ()
+{
+ int rc;
+ msg_t msg;
+
+ // Address delimiter frame
+ rc = msg.init ();
+ errno_assert (rc == 0);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Version frame
+ rc = msg.init_size (3);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "1.0", 3);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Request ID frame
+ rc = msg.init_size (1);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "1", 1);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Domain frame
+ rc = msg.init_size (options.zap_domain.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), options.zap_domain.c_str (), options.zap_domain.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Address frame
+ rc = msg.init_size (peer_address.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), peer_address.c_str (), peer_address.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Identity frame
+ rc = msg.init_size (options.identity_size);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), options.identity, options.identity_size);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Mechanism frame
+ rc = msg.init_size (6);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "GSSAPI", 6);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Principal frame
+ gss_buffer_desc principal;
+ gss_display_name(&min_stat, target_name, &principal, NULL);
+
+ rc = msg.init_size (principal.length);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), principal.value, principal.length);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+ gss_release_buffer(&min_stat, &principal);
+}
+
+int zmq::gssapi_server_t::receive_and_process_zap_reply ()
+{
+ int rc = 0;
+ msg_t msg [7]; // ZAP reply consists of 7 frames
+
+ // Initialize all reply frames
+ for (int i = 0; i < 7; i++) {
+ rc = msg [i].init ();
+ errno_assert (rc == 0);
+ }
+
+ for (int i = 0; i < 7; i++) {
+ rc = session->read_zap_msg (&msg [i]);
+ if (rc == -1)
+ break;
+ if ((msg [i].flags () & msg_t::more) == (i < 6? 0: msg_t::more)) {
+ errno = EPROTO;
+ rc = -1;
+ break;
+ }
+ }
+
+ if (rc != 0)
+ goto error;
+
+ // Address delimiter frame
+ if (msg [0].size () > 0) {
+ rc = -1;
+ errno = EPROTO;
+ goto error;
+ }
+
+ // Version frame
+ if (msg [1].size () != 3 || memcmp (msg [1].data (), "1.0", 3)) {
+ rc = -1;
+ errno = EPROTO;
+ goto error;
+ }
+
+ // Request id frame
+ if (msg [2].size () != 1 || memcmp (msg [2].data (), "1", 1)) {
+ rc = -1;
+ errno = EPROTO;
+ goto error;
+ }
+
+ // Status code frame
+ if (msg [3].size () != 3 || memcmp (msg [3].data (), "200", 3)) {
+ rc = -1;
+ errno = EACCES;
+ goto error;
+ }
+
+ // Save user id
+ set_user_id (msg [5].data (), msg [5].size ());
+
+ // Process metadata frame
+ rc = parse_metadata (static_cast <const unsigned char*> (msg [6].data ()),
+ msg [6].size (), true);
+
+error:
+ for (int i = 0; i < 7; i++) {
+ const int rc2 = msg [i].close ();
+ errno_assert (rc2 == 0);
+ }
+
+ return rc;
+}
+
+
+int zmq::gssapi_server_t::encode (msg_t *msg_)
+{
+ zmq_assert (state == connected);
+
+ if (do_encryption)
+ return encode_message (msg_);
+
+ return 0;
+}
+
+int zmq::gssapi_server_t::decode (msg_t *msg_)
+{
+ zmq_assert (state == connected);
+
+ if (do_encryption)
+ return decode_message (msg_);
+
+ return 0;
+}
+
+int zmq::gssapi_server_t::zap_msg_available ()
+{
+ if (state != expect_zap_reply) {
+ errno = EFSM;
+ return -1;
+ }
+ const int rc = receive_and_process_zap_reply ();
+ if (rc == 0)
+ state = send_ready;
+ return rc;
+}
+
+zmq::mechanism_t::status_t zmq::gssapi_server_t::status () const
+{
+ return state == connected? mechanism_t::ready: mechanism_t::handshaking;
+}
+
+int zmq::gssapi_server_t::produce_next_token (msg_t *msg_)
+{
+ if (send_tok.length != 0) { // Client expects another token
+ if (produce_initiate(msg_, send_tok.value, send_tok.length) < 0)
+ return -1;
+ gss_release_buffer(&min_stat, &send_tok);
+ }
+
+ if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED) {
+ gss_release_name(&min_stat, &target_name);
+ if (context != GSS_C_NO_CONTEXT)
+ gss_delete_sec_context(&min_stat, &context, GSS_C_NO_BUFFER);
+ return -1;
+ }
+
+ return 0;
+}
+
+int zmq::gssapi_server_t::process_next_token (msg_t *msg_)
+{
+ if (maj_stat == GSS_S_CONTINUE_NEEDED) {
+ if (process_initiate(msg_, &recv_tok.value, recv_tok.length) < 0) {
+ if (target_name != GSS_C_NO_NAME)
+ gss_release_name(&min_stat, &target_name);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+void zmq::gssapi_server_t::accept_context ()
+{
+ maj_stat = gss_accept_sec_context(&init_sec_min_stat, &context, cred,
+ &recv_tok, GSS_C_NO_CHANNEL_BINDINGS,
+ &target_name, &doid, &send_tok,
+ &ret_flags, NULL, NULL);
+
+ if (recv_tok.value) {
+ free (recv_tok.value);
+ recv_tok.value = NULL;
+ }
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_server.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_server.hpp
new file mode 100644
index 00000000..c3782230
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/gssapi_server.hpp
@@ -0,0 +1,96 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_GSSAPI_SERVER_HPP_INCLUDED__
+#define __ZMQ_GSSAPI_SERVER_HPP_INCLUDED__
+
+#ifdef HAVE_LIBGSSAPI_KRB5
+
+#include "gssapi_mechanism_base.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+ class session_base_t;
+
+ class gssapi_server_t :
+ public gssapi_mechanism_base_t
+ {
+ public:
+
+ gssapi_server_t (session_base_t *session_,
+ const std::string &peer_address,
+ const options_t &options_);
+ virtual ~gssapi_server_t ();
+
+ // mechanism implementation
+ virtual int next_handshake_command (msg_t *msg_);
+ virtual int process_handshake_command (msg_t *msg_);
+ virtual int encode (msg_t *msg_);
+ virtual int decode (msg_t *msg_);
+ virtual int zap_msg_available ();
+ virtual status_t status () const;
+
+ private:
+
+ enum state_t {
+ send_next_token,
+ recv_next_token,
+ expect_zap_reply,
+ send_ready,
+ recv_ready,
+ connected
+ };
+
+ session_base_t * const session;
+
+ const std::string peer_address;
+
+ // Current FSM state
+ state_t state;
+
+ // True iff server considers the client authenticated
+ bool security_context_established;
+
+ // The underlying mechanism type (ignored)
+ gss_OID doid;
+
+ void accept_context ();
+ int produce_next_token (msg_t *msg_);
+ int process_next_token (msg_t *msg_);
+ void send_zap_request ();
+ int receive_and_process_zap_reply();
+ };
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_decoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_decoder.hpp
new file mode 100644
index 00000000..b003cf81
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_decoder.hpp
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_I_DECODER_HPP_INCLUDED__
+#define __ZMQ_I_DECODER_HPP_INCLUDED__
+
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+
+ // Interface to be implemented by message decoder.
+
+ class i_decoder
+ {
+ public:
+ virtual ~i_decoder () {}
+
+ virtual void get_buffer (unsigned char **data_, size_t *size_) = 0;
+
+ // Decodes data pointed to by data_.
+ // When a message is decoded, 1 is returned.
+ // When the decoder needs more data, 0 is returnd.
+ // On error, -1 is returned and errno is set accordingly.
+ virtual int decode (const unsigned char *data_, size_t size_,
+ size_t &processed) = 0;
+
+ virtual msg_t *msg () = 0;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_encoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_encoder.hpp
new file mode 100644
index 00000000..eb341e57
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_encoder.hpp
@@ -0,0 +1,60 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_I_ENCODER_HPP_INCLUDED__
+#define __ZMQ_I_ENCODER_HPP_INCLUDED__
+
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ // Forward declaration
+ class msg_t;
+
+ // Interface to be implemented by message encoder.
+
+ struct i_encoder
+ {
+ virtual ~i_encoder () {}
+
+ // The function returns a batch of binary data. The data
+ // are filled to a supplied buffer. If no buffer is supplied (data_
+ // is NULL) encoder will provide buffer of its own.
+ // Function returns 0 when a new message is required.
+ virtual size_t encode (unsigned char **data_, size_t size) = 0;
+
+ // Load a new message into encoder.
+ virtual void load_msg (msg_t *msg_) = 0;
+
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_engine.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_engine.hpp
new file mode 100644
index 00000000..7a61e8e9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_engine.hpp
@@ -0,0 +1,65 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_I_ENGINE_HPP_INCLUDED__
+#define __ZMQ_I_ENGINE_HPP_INCLUDED__
+
+namespace zmq
+{
+
+ class io_thread_t;
+
+ // Abstract interface to be implemented by various engines.
+
+ struct i_engine
+ {
+ virtual ~i_engine () {}
+
+ // Plug the engine to the session.
+ virtual void plug (zmq::io_thread_t *io_thread_,
+ class session_base_t *session_) = 0;
+
+ // Terminate and deallocate the engine. Note that 'detached'
+ // events are not fired on termination.
+ virtual void terminate () = 0;
+
+ // This method is called by the session to signalise that more
+ // messages can be written to the pipe.
+ virtual void restart_input () = 0;
+
+ // This method is called by the session to signalise that there
+ // are messages to send available.
+ virtual void restart_output () = 0;
+
+ virtual void zap_msg_available () = 0;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_poll_events.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_poll_events.hpp
new file mode 100644
index 00000000..e42556bb
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/i_poll_events.hpp
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
+#define __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
+
+namespace zmq
+{
+
+ // Virtual interface to be exposed by object that want to be notified
+ // about events on file descriptors.
+
+ struct i_poll_events
+ {
+ virtual ~i_poll_events () {}
+
+ // Called by I/O thread when file descriptor is ready for reading.
+ virtual void in_event () = 0;
+
+ // Called by I/O thread when file descriptor is ready for writing.
+ virtual void out_event () = 0;
+
+ // Called when timer expires.
+ virtual void timer_event (int id_) = 0;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_object.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_object.cpp
new file mode 100644
index 00000000..71067bc0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_object.cpp
@@ -0,0 +1,116 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "io_object.hpp"
+#include "io_thread.hpp"
+#include "err.hpp"
+
+zmq::io_object_t::io_object_t (io_thread_t *io_thread_) :
+ poller (NULL)
+{
+ if (io_thread_)
+ plug (io_thread_);
+}
+
+zmq::io_object_t::~io_object_t ()
+{
+}
+
+void zmq::io_object_t::plug (io_thread_t *io_thread_)
+{
+ zmq_assert (io_thread_);
+ zmq_assert (!poller);
+
+ // Retrieve the poller from the thread we are running in.
+ poller = io_thread_->get_poller ();
+}
+
+void zmq::io_object_t::unplug ()
+{
+ zmq_assert (poller);
+
+ // Forget about old poller in preparation to be migrated
+ // to a different I/O thread.
+ poller = NULL;
+}
+
+zmq::io_object_t::handle_t zmq::io_object_t::add_fd (fd_t fd_)
+{
+ return poller->add_fd (fd_, this);
+}
+
+void zmq::io_object_t::rm_fd (handle_t handle_)
+{
+ poller->rm_fd (handle_);
+}
+
+void zmq::io_object_t::set_pollin (handle_t handle_)
+{
+ poller->set_pollin (handle_);
+}
+
+void zmq::io_object_t::reset_pollin (handle_t handle_)
+{
+ poller->reset_pollin (handle_);
+}
+
+void zmq::io_object_t::set_pollout (handle_t handle_)
+{
+ poller->set_pollout (handle_);
+}
+
+void zmq::io_object_t::reset_pollout (handle_t handle_)
+{
+ poller->reset_pollout (handle_);
+}
+
+void zmq::io_object_t::add_timer (int timeout_, int id_)
+{
+ poller->add_timer (timeout_, this, id_);
+}
+
+void zmq::io_object_t::cancel_timer (int id_)
+{
+ poller->cancel_timer (this, id_);
+}
+
+void zmq::io_object_t::in_event ()
+{
+ zmq_assert (false);
+}
+
+void zmq::io_object_t::out_event ()
+{
+ zmq_assert (false);
+}
+
+void zmq::io_object_t::timer_event (int)
+{
+ zmq_assert (false);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_object.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_object.hpp
new file mode 100644
index 00000000..d414678d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_object.hpp
@@ -0,0 +1,89 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_IO_OBJECT_HPP_INCLUDED__
+#define __ZMQ_IO_OBJECT_HPP_INCLUDED__
+
+#include <stddef.h>
+
+#include "stdint.hpp"
+#include "poller.hpp"
+#include "i_poll_events.hpp"
+
+namespace zmq
+{
+
+ class io_thread_t;
+
+ // Simple base class for objects that live in I/O threads.
+ // It makes communication with the poller object easier and
+ // makes defining unneeded event handlers unnecessary.
+
+ class io_object_t : public i_poll_events
+ {
+ public:
+
+ io_object_t (zmq::io_thread_t *io_thread_ = NULL);
+ ~io_object_t ();
+
+ // When migrating an object from one I/O thread to another, first
+ // unplug it, then migrate it, then plug it to the new thread.
+ void plug (zmq::io_thread_t *io_thread_);
+ void unplug ();
+
+ protected:
+
+ typedef poller_t::handle_t handle_t;
+
+ // Methods to access underlying poller object.
+ handle_t add_fd (fd_t fd_);
+ void rm_fd (handle_t handle_);
+ void set_pollin (handle_t handle_);
+ void reset_pollin (handle_t handle_);
+ void set_pollout (handle_t handle_);
+ void reset_pollout (handle_t handle_);
+ void add_timer (int timout_, int id_);
+ void cancel_timer (int id_);
+
+ // i_poll_events interface implementation.
+ void in_event ();
+ void out_event ();
+ void timer_event (int id_);
+
+ private:
+
+ poller_t *poller;
+
+ io_object_t (const io_object_t&);
+ const io_object_t &operator = (const io_object_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_thread.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_thread.cpp
new file mode 100644
index 00000000..8c394d4a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_thread.cpp
@@ -0,0 +1,112 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <new>
+
+#include "io_thread.hpp"
+#include "platform.hpp"
+#include "err.hpp"
+#include "ctx.hpp"
+
+zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) :
+ object_t (ctx_, tid_)
+{
+ poller = new (std::nothrow) poller_t (*ctx_);
+ alloc_assert (poller);
+
+ mailbox_handle = poller->add_fd (mailbox.get_fd (), this);
+ poller->set_pollin (mailbox_handle);
+}
+
+zmq::io_thread_t::~io_thread_t ()
+{
+ delete poller;
+}
+
+void zmq::io_thread_t::start ()
+{
+ // Start the underlying I/O thread.
+ poller->start ();
+}
+
+void zmq::io_thread_t::stop ()
+{
+ send_stop ();
+}
+
+zmq::mailbox_t *zmq::io_thread_t::get_mailbox ()
+{
+ return &mailbox;
+}
+
+int zmq::io_thread_t::get_load ()
+{
+ return poller->get_load ();
+}
+
+void zmq::io_thread_t::in_event ()
+{
+ // TODO: Do we want to limit number of commands I/O thread can
+ // process in a single go?
+
+ command_t cmd;
+ int rc = mailbox.recv (&cmd, 0);
+
+ while (rc == 0 || errno == EINTR) {
+ if (rc == 0)
+ cmd.destination->process_command (cmd);
+ rc = mailbox.recv (&cmd, 0);
+ }
+
+ errno_assert (rc != 0 && errno == EAGAIN);
+}
+
+void zmq::io_thread_t::out_event ()
+{
+ // We are never polling for POLLOUT here. This function is never called.
+ zmq_assert (false);
+}
+
+void zmq::io_thread_t::timer_event (int)
+{
+ // No timers here. This function is never called.
+ zmq_assert (false);
+}
+
+zmq::poller_t *zmq::io_thread_t::get_poller ()
+{
+ zmq_assert (poller);
+ return poller;
+}
+
+void zmq::io_thread_t::process_stop ()
+{
+ poller->rm_fd (mailbox_handle);
+ poller->stop ();
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_thread.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_thread.hpp
new file mode 100644
index 00000000..b1f0e3e9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/io_thread.hpp
@@ -0,0 +1,99 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_IO_THREAD_HPP_INCLUDED__
+#define __ZMQ_IO_THREAD_HPP_INCLUDED__
+
+#include <vector>
+
+#include "stdint.hpp"
+#include "object.hpp"
+#include "poller.hpp"
+#include "i_poll_events.hpp"
+#include "mailbox.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+
+ // Generic part of the I/O thread. Polling-mechanism-specific features
+ // are implemented in separate "polling objects".
+
+ class io_thread_t : public object_t, public i_poll_events
+ {
+ public:
+
+ io_thread_t (zmq::ctx_t *ctx_, uint32_t tid_);
+
+ // Clean-up. If the thread was started, it's neccessary to call 'stop'
+ // before invoking destructor. Otherwise the destructor would hang up.
+ ~io_thread_t ();
+
+ // Launch the physical thread.
+ void start ();
+
+ // Ask underlying thread to stop.
+ void stop ();
+
+ // Returns mailbox associated with this I/O thread.
+ mailbox_t *get_mailbox ();
+
+ // i_poll_events implementation.
+ void in_event ();
+ void out_event ();
+ void timer_event (int id_);
+
+ // Used by io_objects to retrieve the assciated poller object.
+ poller_t *get_poller ();
+
+ // Command handlers.
+ void process_stop ();
+
+ // Returns load experienced by the I/O thread.
+ int get_load ();
+
+ private:
+
+ // I/O thread accesses incoming commands via this mailbox.
+ mailbox_t mailbox;
+
+ // Handle associated with mailbox' file descriptor.
+ poller_t::handle_t mailbox_handle;
+
+ // I/O multiplexing is performed using a poller object.
+ poller_t *poller;
+
+ io_thread_t (const io_thread_t&);
+ const io_thread_t &operator = (const io_thread_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ip.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ip.cpp
new file mode 100644
index 00000000..d17f19c9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ip.cpp
@@ -0,0 +1,176 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "ip.hpp"
+#include "err.hpp"
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#endif
+
+#if defined ZMQ_HAVE_OPENVMS
+#include <ioctl.h>
+#endif
+
+zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
+{
+ // Setting this option result in sane behaviour when exec() functions
+ // are used. Old sockets are closed and don't block TCP ports etc.
+#if defined ZMQ_HAVE_SOCK_CLOEXEC
+ type_ |= SOCK_CLOEXEC;
+#endif
+
+ fd_t s = socket (domain_, type_, protocol_);
+#ifdef ZMQ_HAVE_WINDOWS
+ if (s == INVALID_SOCKET)
+ return INVALID_SOCKET;
+#else
+ if (s == -1)
+ return -1;
+#endif
+
+ // If there's no SOCK_CLOEXEC, let's try the second best option. Note that
+ // race condition can cause socket not to be closed (if fork happens
+ // between socket creation and this point).
+#if !defined ZMQ_HAVE_SOCK_CLOEXEC && defined FD_CLOEXEC
+ int rc = fcntl (s, F_SETFD, FD_CLOEXEC);
+ errno_assert (rc != -1);
+#endif
+
+ // On Windows, preventing sockets to be inherited by child processes.
+#if defined ZMQ_HAVE_WINDOWS && defined HANDLE_FLAG_INHERIT
+ BOOL brc = SetHandleInformation ((HANDLE) s, HANDLE_FLAG_INHERIT, 0);
+ win_assert (brc);
+#endif
+
+ return s;
+}
+
+void zmq::unblock_socket (fd_t s_)
+{
+#if defined ZMQ_HAVE_WINDOWS
+ u_long nonblock = 1;
+ int rc = ioctlsocket (s_, FIONBIO, &nonblock);
+ wsa_assert (rc != SOCKET_ERROR);
+#elif defined ZMQ_HAVE_OPENVMS
+ int nonblock = 1;
+ int rc = ioctl (s_, FIONBIO, &nonblock);
+ errno_assert (rc != -1);
+#else
+ int flags = fcntl (s_, F_GETFL, 0);
+ if (flags == -1)
+ flags = 0;
+ int rc = fcntl (s_, F_SETFL, flags | O_NONBLOCK);
+ errno_assert (rc != -1);
+#endif
+}
+
+void zmq::enable_ipv4_mapping (fd_t s_)
+{
+ (void) s_;
+
+#ifdef IPV6_V6ONLY
+#ifdef ZMQ_HAVE_WINDOWS
+ DWORD flag = 0;
+#else
+ int flag = 0;
+#endif
+ int rc = setsockopt (s_, IPPROTO_IPV6, IPV6_V6ONLY, (const char*) &flag,
+ sizeof (flag));
+#ifdef ZMQ_HAVE_WINDOWS
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ errno_assert (rc == 0);
+#endif
+#endif
+}
+
+int zmq::get_peer_ip_address (fd_t sockfd_, std::string &ip_addr_)
+{
+ int rc;
+ struct sockaddr_storage ss;
+
+#if defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_WINDOWS
+ int addrlen = static_cast <int> (sizeof ss);
+#else
+ socklen_t addrlen = sizeof ss;
+#endif
+ rc = getpeername (sockfd_, (struct sockaddr*) &ss, &addrlen);
+#ifdef ZMQ_HAVE_WINDOWS
+ if (rc == SOCKET_ERROR) {
+ wsa_assert (WSAGetLastError () != WSANOTINITIALISED &&
+ WSAGetLastError () != WSAEFAULT &&
+ WSAGetLastError () != WSAEINPROGRESS &&
+ WSAGetLastError () != WSAENOTSOCK);
+ return 0;
+ }
+#else
+ if (rc == -1) {
+ errno_assert (errno != EBADF &&
+ errno != EFAULT &&
+ errno != ENOTSOCK);
+ return 0;
+ }
+#endif
+
+ char host [NI_MAXHOST];
+ rc = getnameinfo ((struct sockaddr*) &ss, addrlen, host, sizeof host,
+ NULL, 0, NI_NUMERICHOST);
+ if (rc != 0)
+ return 0;
+
+ ip_addr_ = host;
+
+ union {
+ struct sockaddr sa;
+ struct sockaddr_storage sa_stor;
+ } u;
+
+ u.sa_stor = ss;
+ return (int) u.sa.sa_family;
+}
+
+void zmq::set_ip_type_of_service (fd_t s_, int iptos)
+{
+ int rc = setsockopt(s_, IPPROTO_IP, IP_TOS, reinterpret_cast<const char*>(&iptos), sizeof(iptos));
+
+#ifdef ZMQ_HAVE_WINDOWS
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ errno_assert (rc == 0);
+#endif
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ip.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ip.hpp
new file mode 100644
index 00000000..7ea3f15a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ip.hpp
@@ -0,0 +1,57 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_IP_HPP_INCLUDED__
+#define __ZMQ_IP_HPP_INCLUDED__
+
+#include <string>
+#include "fd.hpp"
+
+namespace zmq
+{
+
+ // Same as socket(2), but allows for transparent tweaking the options.
+ fd_t open_socket (int domain_, int type_, int protocol_);
+
+ // Sets the socket into non-blocking mode.
+ void unblock_socket (fd_t s_);
+
+ // Enable IPv4-mapping of addresses in case it is disabled by default.
+ void enable_ipv4_mapping (fd_t s_);
+
+ // Returns string representation of peer's address.
+ // Socket sockfd_ must be connected. Returns true iff successful.
+ int get_peer_ip_address (fd_t sockfd_, std::string &ip_addr_);
+
+ // Sets the IP Type-Of-Service for the underlying socket
+ void set_ip_type_of_service (fd_t s_, int iptos);
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_address.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_address.cpp
new file mode 100644
index 00000000..ba247600
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_address.cpp
@@ -0,0 +1,105 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "ipc_address.hpp"
+
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+
+#include "err.hpp"
+
+#include <string>
+#include <sstream>
+
+zmq::ipc_address_t::ipc_address_t ()
+{
+ memset (&address, 0, sizeof address);
+}
+
+zmq::ipc_address_t::ipc_address_t (const sockaddr *sa, socklen_t sa_len)
+{
+ zmq_assert (sa && sa_len > 0);
+
+ memset (&address, 0, sizeof address);
+ if (sa->sa_family == AF_UNIX)
+ memcpy(&address, sa, sa_len);
+}
+
+zmq::ipc_address_t::~ipc_address_t ()
+{
+}
+
+int zmq::ipc_address_t::resolve (const char *path_)
+{
+ if (strlen (path_) >= sizeof address.sun_path) {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+ if (path_ [0] == '@' && !path_ [1]) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ address.sun_family = AF_UNIX;
+ strcpy (address.sun_path, path_);
+ /* Abstract sockets start with '\0' */
+ if (path_ [0] == '@')
+ *address.sun_path = '\0';
+ return 0;
+}
+
+int zmq::ipc_address_t::to_string (std::string &addr_)
+{
+ if (address.sun_family != AF_UNIX) {
+ addr_.clear ();
+ return -1;
+ }
+
+ std::stringstream s;
+ s << "ipc://";
+ if (!address.sun_path [0] && address.sun_path [1])
+ s << "@" << address.sun_path + 1;
+ else
+ s << address.sun_path;
+ addr_ = s.str ();
+ return 0;
+}
+
+const sockaddr *zmq::ipc_address_t::addr () const
+{
+ return (sockaddr*) &address;
+}
+
+socklen_t zmq::ipc_address_t::addrlen () const
+{
+ if (!address.sun_path [0] && address.sun_path [1])
+ return (socklen_t) strlen (address.sun_path + 1) + sizeof (sa_family_t) + 1;
+ return (socklen_t) sizeof address;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_address.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_address.hpp
new file mode 100644
index 00000000..27c299aa
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_address.hpp
@@ -0,0 +1,76 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_IPC_ADDRESS_HPP_INCLUDED__
+#define __ZMQ_IPC_ADDRESS_HPP_INCLUDED__
+
+#include <string>
+
+#include "platform.hpp"
+
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
+namespace zmq
+{
+
+ class ipc_address_t
+ {
+ public:
+
+ ipc_address_t ();
+ ipc_address_t (const sockaddr *sa, socklen_t sa_len);
+ ~ipc_address_t ();
+
+ // This function sets up the address for UNIX domain transport.
+ int resolve (const char *path_);
+
+ // The opposite to resolve()
+ int to_string (std::string &addr_);
+
+ const sockaddr *addr () const;
+ socklen_t addrlen () const;
+
+ private:
+
+ struct sockaddr_un address;
+
+ ipc_address_t (const ipc_address_t&);
+ const ipc_address_t &operator = (const ipc_address_t&);
+ };
+
+}
+
+#endif
+
+#endif
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_connecter.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_connecter.cpp
new file mode 100644
index 00000000..34abb568
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_connecter.cpp
@@ -0,0 +1,275 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "ipc_connecter.hpp"
+
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+
+#include <new>
+#include <string>
+
+#include "stream_engine.hpp"
+#include "io_thread.hpp"
+#include "platform.hpp"
+#include "random.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+#include "address.hpp"
+#include "ipc_address.hpp"
+#include "session_base.hpp"
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+zmq::ipc_connecter_t::ipc_connecter_t (class io_thread_t *io_thread_,
+ class session_base_t *session_, const options_t &options_,
+ const address_t *addr_, bool delayed_start_) :
+ own_t (io_thread_, options_),
+ io_object_t (io_thread_),
+ addr (addr_),
+ s (retired_fd),
+ handle_valid (false),
+ delayed_start (delayed_start_),
+ timer_started (false),
+ session (session_),
+ current_reconnect_ivl(options.reconnect_ivl)
+{
+ zmq_assert (addr);
+ zmq_assert (addr->protocol == "ipc");
+ addr->to_string (endpoint);
+ socket = session-> get_socket();
+}
+
+zmq::ipc_connecter_t::~ipc_connecter_t ()
+{
+ zmq_assert (!timer_started);
+ zmq_assert (!handle_valid);
+ zmq_assert (s == retired_fd);
+}
+
+void zmq::ipc_connecter_t::process_plug ()
+{
+ if (delayed_start)
+ add_reconnect_timer ();
+ else
+ start_connecting ();
+}
+
+void zmq::ipc_connecter_t::process_term (int linger_)
+{
+ if (timer_started) {
+ cancel_timer (reconnect_timer_id);
+ timer_started = false;
+ }
+
+ if (handle_valid) {
+ rm_fd (handle);
+ handle_valid = false;
+ }
+
+ if (s != retired_fd)
+ close ();
+
+ own_t::process_term (linger_);
+}
+
+void zmq::ipc_connecter_t::in_event ()
+{
+ // We are not polling for incomming data, so we are actually called
+ // because of error here. However, we can get error on out event as well
+ // on some platforms, so we'll simply handle both events in the same way.
+ out_event ();
+}
+
+void zmq::ipc_connecter_t::out_event ()
+{
+ fd_t fd = connect ();
+ rm_fd (handle);
+ handle_valid = false;
+
+ // Handle the error condition by attempt to reconnect.
+ if (fd == retired_fd) {
+ close ();
+ add_reconnect_timer();
+ return;
+ }
+ // Create the engine object for this connection.
+ stream_engine_t *engine = new (std::nothrow)
+ stream_engine_t (fd, options, endpoint);
+ alloc_assert (engine);
+
+ // Attach the engine to the corresponding session object.
+ send_attach (session, engine);
+
+ // Shut the connecter down.
+ terminate ();
+
+ socket->event_connected (endpoint, fd);
+}
+
+void zmq::ipc_connecter_t::timer_event (int id_)
+{
+ zmq_assert (id_ == reconnect_timer_id);
+ timer_started = false;
+ start_connecting ();
+}
+
+void zmq::ipc_connecter_t::start_connecting ()
+{
+ // Open the connecting socket.
+ int rc = open ();
+
+ // Connect may succeed in synchronous manner.
+ if (rc == 0) {
+ handle = add_fd (s);
+ handle_valid = true;
+ out_event ();
+ }
+
+ // Connection establishment may be delayed. Poll for its completion.
+ else
+ if (rc == -1 && errno == EINPROGRESS) {
+ handle = add_fd (s);
+ handle_valid = true;
+ set_pollout (handle);
+ socket->event_connect_delayed (endpoint, zmq_errno());
+ }
+
+ // Handle any other error condition by eventual reconnect.
+ else {
+ if (s != retired_fd)
+ close ();
+ add_reconnect_timer ();
+ }
+}
+
+void zmq::ipc_connecter_t::add_reconnect_timer()
+{
+ int rc_ivl = get_new_reconnect_ivl();
+ add_timer (rc_ivl, reconnect_timer_id);
+ socket->event_connect_retried (endpoint, rc_ivl);
+ timer_started = true;
+}
+
+int zmq::ipc_connecter_t::get_new_reconnect_ivl ()
+{
+ // The new interval is the current interval + random value.
+ int this_interval = current_reconnect_ivl +
+ (generate_random () % options.reconnect_ivl);
+
+ // Only change the current reconnect interval if the maximum reconnect
+ // interval was set and if it's larger than the reconnect interval.
+ if (options.reconnect_ivl_max > 0 &&
+ options.reconnect_ivl_max > options.reconnect_ivl) {
+
+ // Calculate the next interval
+ current_reconnect_ivl = current_reconnect_ivl * 2;
+ if(current_reconnect_ivl >= options.reconnect_ivl_max) {
+ current_reconnect_ivl = options.reconnect_ivl_max;
+ }
+ }
+ return this_interval;
+}
+
+int zmq::ipc_connecter_t::open ()
+{
+ zmq_assert (s == retired_fd);
+
+ // Create the socket.
+ s = open_socket (AF_UNIX, SOCK_STREAM, 0);
+ if (s == -1)
+ return -1;
+
+ // Set the non-blocking flag.
+ unblock_socket (s);
+
+ // Connect to the remote peer.
+ int rc = ::connect (
+ s, addr->resolved.ipc_addr->addr (),
+ addr->resolved.ipc_addr->addrlen ());
+
+ // Connect was successfull immediately.
+ if (rc == 0)
+ return 0;
+
+ // Translate other error codes indicating asynchronous connect has been
+ // launched to a uniform EINPROGRESS.
+ if (rc == -1 && errno == EINTR) {
+ errno = EINPROGRESS;
+ return -1;
+ }
+
+ // Forward the error.
+ return -1;
+}
+
+int zmq::ipc_connecter_t::close ()
+{
+ zmq_assert (s != retired_fd);
+ int rc = ::close (s);
+ errno_assert (rc == 0);
+ socket->event_closed (endpoint, s);
+ s = retired_fd;
+ return 0;
+}
+
+zmq::fd_t zmq::ipc_connecter_t::connect ()
+{
+ // Following code should handle both Berkeley-derived socket
+ // implementations and Solaris.
+ int err = 0;
+#if defined ZMQ_HAVE_HPUX
+ int len = sizeof (err);
+#else
+ socklen_t len = sizeof (err);
+#endif
+ int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
+ if (rc == -1)
+ err = errno;
+ if (err != 0) {
+
+ // Assert if the error was caused by 0MQ bug.
+ // Networking problems are OK. No need to assert.
+ errno = err;
+ errno_assert (errno == ECONNREFUSED || errno == ECONNRESET ||
+ errno == ETIMEDOUT || errno == EHOSTUNREACH ||
+ errno == ENETUNREACH || errno == ENETDOWN);
+
+ return retired_fd;
+ }
+
+ fd_t result = s;
+ s = retired_fd;
+ return result;
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_connecter.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_connecter.hpp
new file mode 100644
index 00000000..5c032063
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_connecter.hpp
@@ -0,0 +1,137 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __IPC_CONNECTER_HPP_INCLUDED__
+#define __IPC_CONNECTER_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+
+#include "fd.hpp"
+#include "own.hpp"
+#include "stdint.hpp"
+#include "io_object.hpp"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class session_base_t;
+ struct address_t;
+
+ class ipc_connecter_t : public own_t, public io_object_t
+ {
+ public:
+
+ // If 'delayed_start' is true connecter first waits for a while,
+ // then starts connection process.
+ ipc_connecter_t (zmq::io_thread_t *io_thread_,
+ zmq::session_base_t *session_, const options_t &options_,
+ const address_t *addr_, bool delayed_start_);
+ ~ipc_connecter_t ();
+
+ private:
+
+ // ID of the timer used to delay the reconnection.
+ enum {reconnect_timer_id = 1};
+
+ // Handlers for incoming commands.
+ void process_plug ();
+ void process_term (int linger_);
+
+ // Handlers for I/O events.
+ void in_event ();
+ void out_event ();
+ void timer_event (int id_);
+
+ // Internal function to start the actual connection establishment.
+ void start_connecting ();
+
+ // Internal function to add a reconnect timer
+ void add_reconnect_timer();
+
+ // Internal function to return a reconnect backoff delay.
+ // Will modify the current_reconnect_ivl used for next call
+ // Returns the currently used interval
+ int get_new_reconnect_ivl ();
+
+ // Open IPC connecting socket. Returns -1 in case of error,
+ // 0 if connect was successfull immediately. Returns -1 with
+ // EAGAIN errno if async connect was launched.
+ int open ();
+
+ // Close the connecting socket.
+ int close ();
+
+ // Get the file descriptor of newly created connection. Returns
+ // retired_fd if the connection was unsuccessfull.
+ fd_t connect ();
+
+ // Address to connect to. Owned by session_base_t.
+ const address_t *addr;
+
+ // Underlying socket.
+ fd_t s;
+
+ // Handle corresponding to the listening socket.
+ handle_t handle;
+
+ // If true file descriptor is registered with the poller and 'handle'
+ // contains valid value.
+ bool handle_valid;
+
+ // If true, connecter is waiting a while before trying to connect.
+ const bool delayed_start;
+
+ // True iff a timer has been started.
+ bool timer_started;
+
+ // Reference to the session we belong to.
+ zmq::session_base_t *session;
+
+ // Current reconnect ivl, updated for backoff strategy
+ int current_reconnect_ivl;
+
+ // String representation of endpoint to connect to
+ std::string endpoint;
+
+ // Socket
+ zmq::socket_base_t *socket;
+
+ ipc_connecter_t (const ipc_connecter_t&);
+ const ipc_connecter_t &operator = (const ipc_connecter_t&);
+ };
+
+}
+
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_listener.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_listener.cpp
new file mode 100644
index 00000000..5c2a028f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_listener.cpp
@@ -0,0 +1,315 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "ipc_listener.hpp"
+
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+
+#include <new>
+
+#include <string.h>
+
+#include "stream_engine.hpp"
+#include "ipc_address.hpp"
+#include "io_thread.hpp"
+#include "session_base.hpp"
+#include "config.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+#include "socket_base.hpp"
+
+#include <unistd.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <sys/un.h>
+
+#if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
+# include <sys/types.h>
+#endif
+#ifdef ZMQ_HAVE_SO_PEERCRED
+# include <pwd.h>
+# include <grp.h>
+# if defined ZMQ_HAVE_OPENBSD
+# define ucred sockpeercred
+# endif
+#endif
+
+zmq::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_,
+ socket_base_t *socket_, const options_t &options_) :
+ own_t (io_thread_, options_),
+ io_object_t (io_thread_),
+ has_file (false),
+ s (retired_fd),
+ socket (socket_)
+{
+}
+
+zmq::ipc_listener_t::~ipc_listener_t ()
+{
+ zmq_assert (s == retired_fd);
+}
+
+void zmq::ipc_listener_t::process_plug ()
+{
+ // Start polling for incoming connections.
+ handle = add_fd (s);
+ set_pollin (handle);
+}
+
+void zmq::ipc_listener_t::process_term (int linger_)
+{
+ rm_fd (handle);
+ close ();
+ own_t::process_term (linger_);
+}
+
+void zmq::ipc_listener_t::in_event ()
+{
+ fd_t fd = accept ();
+
+ // If connection was reset by the peer in the meantime, just ignore it.
+ // TODO: Handle specific errors like ENFILE/EMFILE etc.
+ if (fd == retired_fd) {
+ socket->event_accept_failed (endpoint, zmq_errno());
+ return;
+ }
+
+ // Create the engine object for this connection.
+ stream_engine_t *engine = new (std::nothrow)
+ stream_engine_t (fd, options, endpoint);
+ alloc_assert (engine);
+
+ // Choose I/O thread to run connecter in. Given that we are already
+ // running in an I/O thread, there must be at least one available.
+ io_thread_t *io_thread = choose_io_thread (options.affinity);
+ zmq_assert (io_thread);
+
+ // Create and launch a session object.
+ session_base_t *session = session_base_t::create (io_thread, false, socket,
+ options, NULL);
+ errno_assert (session);
+ session->inc_seqnum ();
+ launch_child (session);
+ send_attach (session, engine, false);
+ socket->event_accepted (endpoint, fd);
+}
+
+int zmq::ipc_listener_t::get_address (std::string &addr_)
+{
+ struct sockaddr_storage ss;
+#ifdef ZMQ_HAVE_HPUX
+ int sl = sizeof (ss);
+#else
+ socklen_t sl = sizeof (ss);
+#endif
+ int rc = getsockname (s, (sockaddr *) &ss, &sl);
+ if (rc != 0) {
+ addr_.clear ();
+ return rc;
+ }
+
+ ipc_address_t addr ((struct sockaddr *) &ss, sl);
+ return addr.to_string (addr_);
+}
+
+int zmq::ipc_listener_t::set_address (const char *addr_)
+{
+ // Create addr on stack for auto-cleanup
+ std::string addr (addr_);
+
+ // Allow wildcard file
+ if (addr [0] == '*') {
+ char buffer [12] = "2134XXXXXX";
+ int fd = mkstemp (buffer);
+ if (fd == -1)
+ return -1;
+ addr.assign (buffer);
+ ::close (fd);
+ }
+
+ // Get rid of the file associated with the UNIX domain socket that
+ // may have been left behind by the previous run of the application.
+ ::unlink (addr.c_str());
+ filename.clear ();
+
+ // Initialise the address structure.
+ ipc_address_t address;
+ int rc = address.resolve (addr.c_str());
+ if (rc != 0)
+ return -1;
+
+ // Create a listening socket.
+ s = open_socket (AF_UNIX, SOCK_STREAM, 0);
+ if (s == -1)
+ return -1;
+
+ address.to_string (endpoint);
+
+ // Bind the socket to the file path.
+ rc = bind (s, address.addr (), address.addrlen ());
+ if (rc != 0)
+ goto error;
+
+ filename.assign (addr.c_str());
+ has_file = true;
+
+ // Listen for incoming connections.
+ rc = listen (s, options.backlog);
+ if (rc != 0)
+ goto error;
+
+ socket->event_listening (endpoint, s);
+ return 0;
+
+error:
+ int err = errno;
+ close ();
+ errno = err;
+ return -1;
+}
+
+int zmq::ipc_listener_t::close ()
+{
+ zmq_assert (s != retired_fd);
+ int rc = ::close (s);
+ errno_assert (rc == 0);
+
+ s = retired_fd;
+
+ // If there's an underlying UNIX domain socket, get rid of the file it
+ // is associated with.
+ if (has_file && !filename.empty ()) {
+ rc = ::unlink(filename.c_str ());
+ if (rc != 0) {
+ socket->event_close_failed (endpoint, zmq_errno());
+ return -1;
+ }
+ }
+
+ socket->event_closed (endpoint, s);
+ return 0;
+}
+
+#if defined ZMQ_HAVE_SO_PEERCRED
+
+bool zmq::ipc_listener_t::filter (fd_t sock)
+{
+ if (options.ipc_uid_accept_filters.empty () &&
+ options.ipc_pid_accept_filters.empty () &&
+ options.ipc_gid_accept_filters.empty ())
+ return true;
+
+ struct ucred cred;
+ socklen_t size = sizeof (cred);
+
+ if (getsockopt (sock, SOL_SOCKET, SO_PEERCRED, &cred, &size))
+ return false;
+ if (options.ipc_uid_accept_filters.find (cred.uid) != options.ipc_uid_accept_filters.end () ||
+ options.ipc_gid_accept_filters.find (cred.gid) != options.ipc_gid_accept_filters.end () ||
+ options.ipc_pid_accept_filters.find (cred.pid) != options.ipc_pid_accept_filters.end ())
+ return true;
+
+ struct passwd *pw;
+ struct group *gr;
+
+ if (!(pw = getpwuid (cred.uid)))
+ return false;
+ for (options_t::ipc_gid_accept_filters_t::const_iterator it = options.ipc_gid_accept_filters.begin ();
+ it != options.ipc_gid_accept_filters.end (); it++) {
+ if (!(gr = getgrgid (*it)))
+ continue;
+ for (char **mem = gr->gr_mem; *mem; mem++) {
+ if (!strcmp (*mem, pw->pw_name))
+ return true;
+ }
+ }
+ return false;
+}
+
+#elif defined ZMQ_HAVE_LOCAL_PEERCRED
+
+bool zmq::ipc_listener_t::filter (fd_t sock)
+{
+ if (options.ipc_uid_accept_filters.empty () &&
+ options.ipc_gid_accept_filters.empty ())
+ return true;
+
+ struct xucred cred;
+ socklen_t size = sizeof (cred);
+
+ if (getsockopt (sock, 0, LOCAL_PEERCRED, &cred, &size))
+ return false;
+ if (cred.cr_version != XUCRED_VERSION)
+ return false;
+ if (options.ipc_uid_accept_filters.find (cred.cr_uid) != options.ipc_uid_accept_filters.end ())
+ return true;
+ for (int i = 0; i < cred.cr_ngroups; i++) {
+ if (options.ipc_gid_accept_filters.find (cred.cr_groups[i]) != options.ipc_gid_accept_filters.end ())
+ return true;
+ }
+
+ return false;
+}
+
+#endif
+
+zmq::fd_t zmq::ipc_listener_t::accept ()
+{
+ // Accept one connection and deal with different failure modes.
+ // The situation where connection cannot be accepted due to insufficient
+ // resources is considered valid and treated by ignoring the connection.
+ zmq_assert (s != retired_fd);
+ fd_t sock = ::accept (s, NULL, NULL);
+ if (sock == -1) {
+ errno_assert (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINTR || errno == ECONNABORTED || errno == EPROTO ||
+ errno == ENFILE);
+ return retired_fd;
+ }
+
+ // Race condition can cause socket not to be closed (if fork happens
+ // between accept and this point).
+#ifdef FD_CLOEXEC
+ int rc = fcntl (sock, F_SETFD, FD_CLOEXEC);
+ errno_assert (rc != -1);
+#endif
+
+ // IPC accept() filters
+#if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
+ if (!filter (sock)) {
+ int rc = ::close (sock);
+ errno_assert (rc == 0);
+ return retired_fd;
+ }
+#endif
+
+ return sock;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_listener.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_listener.hpp
new file mode 100644
index 00000000..445f96ba
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ipc_listener.hpp
@@ -0,0 +1,114 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_IPC_LISTENER_HPP_INCLUDED__
+#define __ZMQ_IPC_LISTENER_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+
+#include <string>
+
+#include "fd.hpp"
+#include "own.hpp"
+#include "stdint.hpp"
+#include "io_object.hpp"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class socket_base_t;
+
+ class ipc_listener_t : public own_t, public io_object_t
+ {
+ public:
+
+ ipc_listener_t (zmq::io_thread_t *io_thread_,
+ zmq::socket_base_t *socket_, const options_t &options_);
+ ~ipc_listener_t ();
+
+ // Set address to listen on.
+ int set_address (const char *addr_);
+
+ // Get the bound address for use with wildcards
+ int get_address (std::string &addr_);
+
+ private:
+
+ // Handlers for incoming commands.
+ void process_plug ();
+ void process_term (int linger_);
+
+ // Handlers for I/O events.
+ void in_event ();
+
+ // Close the listening socket.
+ int close ();
+
+ // Filter new connections if the OS provides a mechanism to get
+ // the credentials of the peer process. Called from accept().
+# if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
+ bool filter (fd_t sock);
+# endif
+
+ // Accept the new connection. Returns the file descriptor of the
+ // newly created connection. The function may return retired_fd
+ // if the connection was dropped while waiting in the listen backlog.
+ fd_t accept ();
+
+ // True, if the undelying file for UNIX domain socket exists.
+ bool has_file;
+
+ // Name of the file associated with the UNIX domain address.
+ std::string filename;
+
+ // Underlying socket.
+ fd_t s;
+
+ // Handle corresponding to the listening socket.
+ handle_t handle;
+
+ // Socket the listerner belongs to.
+ zmq::socket_base_t *socket;
+
+ // String representation of endpoint to bind to
+ std::string endpoint;
+
+ ipc_listener_t (const ipc_listener_t&);
+ const ipc_listener_t &operator = (const ipc_listener_t&);
+ };
+
+}
+
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/kqueue.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/kqueue.cpp
new file mode 100644
index 00000000..3095ab7a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/kqueue.cpp
@@ -0,0 +1,225 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "kqueue.hpp"
+#if defined ZMQ_USE_KQUEUE
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/event.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <algorithm>
+#include <new>
+
+#include "kqueue.hpp"
+#include "err.hpp"
+#include "config.hpp"
+#include "i_poll_events.hpp"
+#include "likely.hpp"
+
+// NetBSD defines (struct kevent).udata as intptr_t, everyone else
+// as void *.
+#if defined ZMQ_HAVE_NETBSD
+#define kevent_udata_t intptr_t
+#else
+#define kevent_udata_t void *
+#endif
+
+zmq::kqueue_t::kqueue_t (const zmq::ctx_t &ctx_) :
+ ctx(ctx_),
+ stopping (false)
+{
+ // Create event queue
+ kqueue_fd = kqueue ();
+ errno_assert (kqueue_fd != -1);
+#ifdef HAVE_FORK
+ pid = getpid();
+#endif
+}
+
+zmq::kqueue_t::~kqueue_t ()
+{
+ worker.stop ();
+ close (kqueue_fd);
+}
+
+void zmq::kqueue_t::kevent_add (fd_t fd_, short filter_, void *udata_)
+{
+ struct kevent ev;
+
+ EV_SET (&ev, fd_, filter_, EV_ADD, 0, 0, (kevent_udata_t)udata_);
+ int rc = kevent (kqueue_fd, &ev, 1, NULL, 0, NULL);
+ errno_assert (rc != -1);
+}
+
+void zmq::kqueue_t::kevent_delete (fd_t fd_, short filter_)
+{
+ struct kevent ev;
+
+ EV_SET (&ev, fd_, filter_, EV_DELETE, 0, 0, 0);
+ int rc = kevent (kqueue_fd, &ev, 1, NULL, 0, NULL);
+ errno_assert (rc != -1);
+}
+
+zmq::kqueue_t::handle_t zmq::kqueue_t::add_fd (fd_t fd_,
+ i_poll_events *reactor_)
+{
+ poll_entry_t *pe = new (std::nothrow) poll_entry_t;
+ alloc_assert (pe);
+
+ pe->fd = fd_;
+ pe->flag_pollin = 0;
+ pe->flag_pollout = 0;
+ pe->reactor = reactor_;
+
+ adjust_load (1);
+
+ return pe;
+}
+
+void zmq::kqueue_t::rm_fd (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ if (pe->flag_pollin)
+ kevent_delete (pe->fd, EVFILT_READ);
+ if (pe->flag_pollout)
+ kevent_delete (pe->fd, EVFILT_WRITE);
+ pe->fd = retired_fd;
+ retired.push_back (pe);
+
+ adjust_load (-1);
+}
+
+void zmq::kqueue_t::set_pollin (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ if (likely (!pe->flag_pollin)) {
+ pe->flag_pollin = true;
+ kevent_add (pe->fd, EVFILT_READ, pe);
+ }
+}
+
+void zmq::kqueue_t::reset_pollin (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ if (likely (pe->flag_pollin)) {
+ pe->flag_pollin = false;
+ kevent_delete (pe->fd, EVFILT_READ);
+ }
+}
+
+void zmq::kqueue_t::set_pollout (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ if (likely (!pe->flag_pollout)) {
+ pe->flag_pollout = true;
+ kevent_add (pe->fd, EVFILT_WRITE, pe);
+ }
+}
+
+void zmq::kqueue_t::reset_pollout (handle_t handle_)
+{
+ poll_entry_t *pe = (poll_entry_t*) handle_;
+ if (likely (pe->flag_pollout)) {
+ pe->flag_pollout = false;
+ kevent_delete (pe->fd, EVFILT_WRITE);
+ }
+}
+
+void zmq::kqueue_t::start ()
+{
+ ctx.start_thread (worker, worker_routine, this);
+}
+
+void zmq::kqueue_t::stop ()
+{
+ stopping = true;
+}
+
+int zmq::kqueue_t::max_fds ()
+{
+ return -1;
+}
+
+void zmq::kqueue_t::loop ()
+{
+ while (!stopping) {
+
+ // Execute any due timers.
+ int timeout = (int) execute_timers ();
+
+ // Wait for events.
+ struct kevent ev_buf [max_io_events];
+ timespec ts = {timeout / 1000, (timeout % 1000) * 1000000};
+ int n = kevent (kqueue_fd, NULL, 0, &ev_buf [0], max_io_events,
+ timeout ? &ts: NULL);
+#ifdef HAVE_FORK
+ if (unlikely(pid != getpid())) {
+ //printf("zmq::kqueue_t::loop aborting on forked child %d\n", (int)getpid());
+ // simply exit the loop in a forked process.
+ return;
+ }
+#endif
+ if (n == -1) {
+ errno_assert (errno == EINTR);
+ continue;
+ }
+
+ for (int i = 0; i < n; i ++) {
+ poll_entry_t *pe = (poll_entry_t*) ev_buf [i].udata;
+
+ if (pe->fd == retired_fd)
+ continue;
+ if (ev_buf [i].flags & EV_EOF)
+ pe->reactor->in_event ();
+ if (pe->fd == retired_fd)
+ continue;
+ if (ev_buf [i].filter == EVFILT_WRITE)
+ pe->reactor->out_event ();
+ if (pe->fd == retired_fd)
+ continue;
+ if (ev_buf [i].filter == EVFILT_READ)
+ pe->reactor->in_event ();
+ }
+
+ // Destroy retired event sources.
+ for (retired_t::iterator it = retired.begin (); it != retired.end ();
+ ++it)
+ delete *it;
+ retired.clear ();
+ }
+}
+
+void zmq::kqueue_t::worker_routine (void *arg_)
+{
+ ((kqueue_t*) arg_)->loop ();
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/kqueue.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/kqueue.hpp
new file mode 100644
index 00000000..b6680b6a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/kqueue.hpp
@@ -0,0 +1,127 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_KQUEUE_HPP_INCLUDED__
+#define __ZMQ_KQUEUE_HPP_INCLUDED__
+
+// poller.hpp decides which polling mechanism to use.
+#include "poller.hpp"
+#if defined ZMQ_USE_KQUEUE
+
+#include <vector>
+#include <unistd.h>
+
+#include "ctx.hpp"
+#include "fd.hpp"
+#include "thread.hpp"
+#include "poller_base.hpp"
+
+namespace zmq
+{
+
+ struct i_poll_events;
+
+ // Implements socket polling mechanism using the BSD-specific
+ // kqueue interface.
+
+ class kqueue_t : public poller_base_t
+ {
+ public:
+
+ typedef void* handle_t;
+
+ kqueue_t (const ctx_t &ctx_);
+ ~kqueue_t ();
+
+ // "poller" concept.
+ handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ void rm_fd (handle_t handle_);
+ void set_pollin (handle_t handle_);
+ void reset_pollin (handle_t handle_);
+ void set_pollout (handle_t handle_);
+ void reset_pollout (handle_t handle_);
+ void start ();
+ void stop ();
+
+ static int max_fds ();
+
+ private:
+
+ // Main worker thread routine.
+ static void worker_routine (void *arg_);
+
+ // Main event loop.
+ void loop ();
+
+ // Reference to ZMQ context.
+ const ctx_t &ctx;
+
+ // File descriptor referring to the kernel event queue.
+ fd_t kqueue_fd;
+
+ // Adds the event to the kqueue.
+ void kevent_add (fd_t fd_, short filter_, void *udata_);
+
+ // Deletes the event from the kqueue.
+ void kevent_delete (fd_t fd_, short filter_);
+
+ struct poll_entry_t
+ {
+ fd_t fd;
+ bool flag_pollin;
+ bool flag_pollout;
+ zmq::i_poll_events *reactor;
+ };
+
+ // List of retired event sources.
+ typedef std::vector <poll_entry_t*> retired_t;
+ retired_t retired;
+
+ // If true, thread is in the process of shutting down.
+ bool stopping;
+
+ // Handle of the physical thread doing the I/O work.
+ thread_t worker;
+
+ kqueue_t (const kqueue_t&);
+ const kqueue_t &operator = (const kqueue_t&);
+
+#ifdef HAVE_FORK
+ // the process that created this context. Used to detect forking.
+ pid_t pid;
+#endif
+ };
+
+ typedef kqueue_t poller_t;
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/lb.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/lb.cpp
new file mode 100644
index 00000000..44b11ea7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/lb.cpp
@@ -0,0 +1,160 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "lb.hpp"
+#include "pipe.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+
+zmq::lb_t::lb_t () :
+ active (0),
+ current (0),
+ more (false),
+ dropping (false)
+{
+}
+
+zmq::lb_t::~lb_t ()
+{
+ zmq_assert (pipes.empty ());
+}
+
+void zmq::lb_t::attach (pipe_t *pipe_)
+{
+ pipes.push_back (pipe_);
+ activated (pipe_);
+}
+
+void zmq::lb_t::pipe_terminated (pipe_t *pipe_)
+{
+ pipes_t::size_type index = pipes.index (pipe_);
+
+ // If we are in the middle of multipart message and current pipe
+ // have disconnected, we have to drop the remainder of the message.
+ if (index == current && more)
+ dropping = true;
+
+ // Remove the pipe from the list; adjust number of active pipes
+ // accordingly.
+ if (index < active) {
+ active--;
+ pipes.swap (index, active);
+ if (current == active)
+ current = 0;
+ }
+ pipes.erase (pipe_);
+}
+
+void zmq::lb_t::activated (pipe_t *pipe_)
+{
+ // Move the pipe to the list of active pipes.
+ pipes.swap (pipes.index (pipe_), active);
+ active++;
+}
+
+int zmq::lb_t::send (msg_t *msg_)
+{
+ return sendpipe (msg_, NULL);
+}
+
+int zmq::lb_t::sendpipe (msg_t *msg_, pipe_t **pipe_)
+{
+ // Drop the message if required. If we are at the end of the message
+ // switch back to non-dropping mode.
+ if (dropping) {
+
+ more = msg_->flags () & msg_t::more ? true : false;
+ dropping = more;
+
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ return 0;
+ }
+
+ while (active > 0) {
+ if (pipes [current]->write (msg_))
+ {
+ if (pipe_)
+ *pipe_ = pipes [current];
+ break;
+ }
+
+ zmq_assert (!more);
+ active--;
+ if (current < active)
+ pipes.swap (current, active);
+ else
+ current = 0;
+ }
+
+ // If there are no pipes we cannot send the message.
+ if (active == 0) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ // If it's final part of the message we can flush it downstream and
+ // continue round-robining (load balance).
+ more = msg_->flags () & msg_t::more? true: false;
+ if (!more) {
+ pipes [current]->flush ();
+ current = (current + 1) % active;
+ }
+
+ // Detach the message from the data buffer.
+ int rc = msg_->init ();
+ errno_assert (rc == 0);
+
+ return 0;
+}
+
+bool zmq::lb_t::has_out ()
+{
+ // If one part of the message was already written we can definitely
+ // write the rest of the message.
+ if (more)
+ return true;
+
+ while (active > 0) {
+
+ // Check whether a pipe has room for another message.
+ if (pipes [current]->check_write ())
+ return true;
+
+ // Deactivate the pipe.
+ active--;
+ pipes.swap (current, active);
+ if (current == active)
+ current = 0;
+ }
+
+ return false;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/lb.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/lb.hpp
new file mode 100644
index 00000000..b43a8ff1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/lb.hpp
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_LB_HPP_INCLUDED__
+#define __ZMQ_LB_HPP_INCLUDED__
+
+#include "array.hpp"
+#include "pipe.hpp"
+
+namespace zmq
+{
+
+ // This class manages a set of outbound pipes. On send it load balances
+ // messages fairly among the pipes.
+
+ class lb_t
+ {
+ public:
+
+ lb_t ();
+ ~lb_t ();
+
+ void attach (pipe_t *pipe_);
+ void activated (pipe_t *pipe_);
+ void pipe_terminated (pipe_t *pipe_);
+
+ int send (msg_t *msg_);
+
+ // Sends a message and stores the pipe that was used in pipe_.
+ // It is possible for this function to return success but keep pipe_
+ // unset if the rest of a multipart message to a terminated pipe is
+ // being dropped. For the first frame, this will never happen.
+ int sendpipe (msg_t *msg_, pipe_t **pipe_);
+
+ bool has_out ();
+
+ private:
+
+ // List of outbound pipes.
+ typedef array_t <pipe_t, 2> pipes_t;
+ pipes_t pipes;
+
+ // Number of active pipes. All the active pipes are located at the
+ // beginning of the pipes array.
+ pipes_t::size_type active;
+
+ // Points to the last pipe that the most recent message was sent to.
+ pipes_t::size_type current;
+
+ // True if last we are in the middle of a multipart message.
+ bool more;
+
+ // True if we are dropping current message.
+ bool dropping;
+
+ lb_t (const lb_t&);
+ const lb_t &operator = (const lb_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.pc.cmake.in b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.pc.cmake.in
new file mode 100644
index 00000000..4f57939d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.pc.cmake.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: libzmq
+Description: 0MQ c++ library
+Version: @ZMQ_VERSION_MAJOR@.@ZMQ_VERSION_MINOR@.@ZMQ_VERSION_PATCH@
+Libs: -L${libdir} -lzmq
+Cflags: -I${includedir}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.pc.in b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.pc.in
new file mode 100644
index 00000000..ba155a38
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libzmq
+Description: 0MQ c++ library
+Version: @VERSION@
+Libs: -L${libdir} -lzmq
+Cflags: -I${includedir}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.vers b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.vers
new file mode 100644
index 00000000..9a2d4154
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/libzmq.vers
@@ -0,0 +1,4 @@
+{
+ global: zmq_*;
+ local: *;
+};
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/likely.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/likely.hpp
new file mode 100644
index 00000000..b7f5ef27
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/likely.hpp
@@ -0,0 +1,42 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_LIKELY_HPP_INCLUDED__
+#define __ZMQ_LIKELY_HPP_INCLUDED__
+
+#if defined __GNUC__
+#define likely(x) __builtin_expect ((x), 1)
+#define unlikely(x) __builtin_expect ((x), 0)
+#else
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mailbox.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mailbox.cpp
new file mode 100644
index 00000000..e3c2e8a1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mailbox.cpp
@@ -0,0 +1,96 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "mailbox.hpp"
+#include "err.hpp"
+
+zmq::mailbox_t::mailbox_t ()
+{
+ // Get the pipe into passive state. That way, if the users starts by
+ // polling on the associated file descriptor it will get woken up when
+ // new command is posted.
+ const bool ok = cpipe.read (NULL);
+ zmq_assert (!ok);
+ active = false;
+}
+
+zmq::mailbox_t::~mailbox_t ()
+{
+ // TODO: Retrieve and deallocate commands inside the cpipe.
+
+ // Work around problem that other threads might still be in our
+ // send() method, by waiting on the mutex before disappearing.
+ sync.lock ();
+ sync.unlock ();
+}
+
+zmq::fd_t zmq::mailbox_t::get_fd () const
+{
+ return signaler.get_fd ();
+}
+
+void zmq::mailbox_t::send (const command_t &cmd_)
+{
+ sync.lock ();
+ cpipe.write (cmd_, false);
+ const bool ok = cpipe.flush ();
+ sync.unlock ();
+ if (!ok)
+ signaler.send ();
+}
+
+int zmq::mailbox_t::recv (command_t *cmd_, int timeout_)
+{
+ // Try to get the command straight away.
+ if (active) {
+ if (cpipe.read (cmd_))
+ return 0;
+
+ // If there are no more commands available, switch into passive state.
+ active = false;
+ }
+
+ // Wait for signal from the command sender.
+ const int rc = signaler.wait (timeout_);
+ if (rc == -1) {
+ errno_assert (errno == EAGAIN || errno == EINTR);
+ return -1;
+ }
+
+ // Receive the signal.
+ signaler.recv ();
+
+ // Switch into active state.
+ active = true;
+
+ // Get a command.
+ const bool ok = cpipe.read (cmd_);
+ zmq_assert (ok);
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mailbox.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mailbox.hpp
new file mode 100644
index 00000000..7d3aed4c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mailbox.hpp
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_MAILBOX_HPP_INCLUDED__
+#define __ZMQ_MAILBOX_HPP_INCLUDED__
+
+#include <stddef.h>
+
+#include "platform.hpp"
+#include "signaler.hpp"
+#include "fd.hpp"
+#include "config.hpp"
+#include "command.hpp"
+#include "ypipe.hpp"
+#include "mutex.hpp"
+
+namespace zmq
+{
+
+ class mailbox_t
+ {
+ public:
+
+ mailbox_t ();
+ ~mailbox_t ();
+
+ fd_t get_fd () const;
+ void send (const command_t &cmd_);
+ int recv (command_t *cmd_, int timeout_);
+
+#ifdef HAVE_FORK
+ // close the file descriptors in the signaller. This is used in a forked
+ // child process to close the file descriptors so that they do not interfere
+ // with the context in the parent process.
+ void forked () { signaler.forked (); }
+#endif
+
+ private:
+
+ // The pipe to store actual commands.
+ typedef ypipe_t <command_t, command_pipe_granularity> cpipe_t;
+ cpipe_t cpipe;
+
+ // Signaler to pass signals from writer thread to reader thread.
+ signaler_t signaler;
+
+ // There's only one thread receiving from the mailbox, but there
+ // is arbitrary number of threads sending. Given that ypipe requires
+ // synchronised access on both of its endpoints, we have to synchronise
+ // the sending side.
+ mutex_t sync;
+
+ // True if the underlying pipe is active, ie. when we are allowed to
+ // read commands from it.
+ bool active;
+
+ // Disable copying of mailbox_t object.
+ mailbox_t (const mailbox_t&);
+ const mailbox_t &operator = (const mailbox_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mechanism.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mechanism.cpp
new file mode 100644
index 00000000..84f15dad
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mechanism.cpp
@@ -0,0 +1,194 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+#include "mechanism.hpp"
+#include "options.hpp"
+#include "msg.hpp"
+#include "err.hpp"
+#include "wire.hpp"
+
+zmq::mechanism_t::mechanism_t (const options_t &options_) :
+ options (options_)
+{
+}
+
+zmq::mechanism_t::~mechanism_t ()
+{
+}
+
+void zmq::mechanism_t::set_peer_identity (const void *id_ptr, size_t id_size)
+{
+ identity = blob_t (static_cast <const unsigned char*> (id_ptr), id_size);
+}
+
+void zmq::mechanism_t::peer_identity (msg_t *msg_)
+{
+ const int rc = msg_->init_size (identity.size ());
+ errno_assert (rc == 0);
+ memcpy (msg_->data (), identity.data (), identity.size ());
+ msg_->set_flags (msg_t::identity);
+}
+
+void zmq::mechanism_t::set_user_id (const void *data_, size_t size_)
+{
+ user_id = blob_t (static_cast <const unsigned char*> (data_), size_);
+ zap_properties.insert (
+ metadata_t::dict_t::value_type (
+ "User-Id", std::string ((char *) data_, size_)));
+}
+
+zmq::blob_t zmq::mechanism_t::get_user_id () const
+{
+ return user_id;
+}
+
+const char *zmq::mechanism_t::socket_type_string (int socket_type) const
+{
+ static const char *names [] = {"PAIR", "PUB", "SUB", "REQ", "REP",
+ "DEALER", "ROUTER", "PULL", "PUSH",
+ "XPUB", "XSUB", "STREAM"};
+ zmq_assert (socket_type >= 0 && socket_type <= 10);
+ return names [socket_type];
+}
+
+size_t zmq::mechanism_t::add_property (unsigned char *ptr, const char *name,
+ const void *value, size_t value_len) const
+{
+ const size_t name_len = strlen (name);
+ zmq_assert (name_len <= 255);
+ *ptr++ = static_cast <unsigned char> (name_len);
+ memcpy (ptr, name, name_len);
+ ptr += name_len;
+ zmq_assert (value_len <= 0x7FFFFFFF);
+ put_uint32 (ptr, static_cast <uint32_t> (value_len));
+ ptr += 4;
+ memcpy (ptr, value, value_len);
+
+ return 1 + name_len + 4 + value_len;
+}
+
+int zmq::mechanism_t::parse_metadata (const unsigned char *ptr_,
+ size_t length_, bool zap_flag)
+{
+ size_t bytes_left = length_;
+
+ while (bytes_left > 1) {
+ const size_t name_length = static_cast <size_t> (*ptr_);
+ ptr_ += 1;
+ bytes_left -= 1;
+ if (bytes_left < name_length)
+ break;
+
+ const std::string name = std::string ((char *) ptr_, name_length);
+ ptr_ += name_length;
+ bytes_left -= name_length;
+ if (bytes_left < 4)
+ break;
+
+ const size_t value_length = static_cast <size_t> (get_uint32 (ptr_));
+ ptr_ += 4;
+ bytes_left -= 4;
+ if (bytes_left < value_length)
+ break;
+
+ const uint8_t *value = ptr_;
+ ptr_ += value_length;
+ bytes_left -= value_length;
+
+ if (name == "Identity" && options.recv_identity)
+ set_peer_identity (value, value_length);
+ else
+ if (name == "Socket-Type") {
+ const std::string socket_type ((char *) value, value_length);
+ if (!check_socket_type (socket_type)) {
+ errno = EINVAL;
+ return -1;
+ }
+ }
+ else {
+ const int rc = property (name, value, value_length);
+ if (rc == -1)
+ return -1;
+ }
+ if (zap_flag)
+ zap_properties.insert (
+ metadata_t::dict_t::value_type (
+ name, std::string ((char *) value, value_length)));
+ else
+ zmtp_properties.insert (
+ metadata_t::dict_t::value_type (
+ name, std::string ((char *) value, value_length)));
+ }
+ if (bytes_left > 0) {
+ errno = EPROTO;
+ return -1;
+ }
+ return 0;
+}
+
+int zmq::mechanism_t::property (const std::string& /* name_ */,
+ const void * /* value_ */, size_t /* length_ */)
+{
+ // Default implementation does not check
+ // property values and returns 0 to signal success.
+ return 0;
+}
+
+bool zmq::mechanism_t::check_socket_type (const std::string& type_) const
+{
+ switch (options.type) {
+ case ZMQ_REQ:
+ return type_ == "REP" || type_ == "ROUTER";
+ case ZMQ_REP:
+ return type_ == "REQ" || type_ == "DEALER";
+ case ZMQ_DEALER:
+ return type_ == "REP" || type_ == "DEALER" || type_ == "ROUTER";
+ case ZMQ_ROUTER:
+ return type_ == "REQ" || type_ == "DEALER" || type_ == "ROUTER";
+ case ZMQ_PUSH:
+ return type_ == "PULL";
+ case ZMQ_PULL:
+ return type_ == "PUSH";
+ case ZMQ_PUB:
+ return type_ == "SUB" || type_ == "XSUB";
+ case ZMQ_SUB:
+ return type_ == "PUB" || type_ == "XPUB";
+ case ZMQ_XPUB:
+ return type_ == "SUB" || type_ == "XSUB";
+ case ZMQ_XSUB:
+ return type_ == "PUB" || type_ == "XPUB";
+ case ZMQ_PAIR:
+ return type_ == "PAIR";
+ default:
+ break;
+ }
+ return false;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mechanism.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mechanism.hpp
new file mode 100644
index 00000000..1c7c01ba
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mechanism.hpp
@@ -0,0 +1,139 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_MECHANISM_HPP_INCLUDED__
+#define __ZMQ_MECHANISM_HPP_INCLUDED__
+
+#include "stdint.hpp"
+#include "options.hpp"
+#include "blob.hpp"
+#include "metadata.hpp"
+
+namespace zmq
+{
+
+ // Abstract class representing security mechanism.
+ // Different mechanism extedns this class.
+
+ class msg_t;
+
+ class mechanism_t
+ {
+ public:
+
+ enum status_t {
+ handshaking,
+ ready,
+ error
+ };
+
+ mechanism_t (const options_t &options_);
+
+ virtual ~mechanism_t ();
+
+ // Prepare next handshake command that is to be sent to the peer.
+ virtual int next_handshake_command (msg_t *msg_) = 0;
+
+ // Process the handshake command received from the peer.
+ virtual int process_handshake_command (msg_t *msg_) = 0;
+
+ virtual int encode (msg_t *) { return 0; }
+
+ virtual int decode (msg_t *) { return 0; }
+
+ // Notifies mechanism about availability of ZAP message.
+ virtual int zap_msg_available () { return 0; }
+
+ // Returns the status of this mechanism.
+ virtual status_t status () const = 0;
+
+ void set_peer_identity (const void *id_ptr, size_t id_size);
+
+ void peer_identity (msg_t *msg_);
+
+ void set_user_id (const void *user_id, size_t size);
+
+ blob_t get_user_id () const;
+
+ const metadata_t::dict_t& get_zmtp_properties () {
+ return zmtp_properties;
+ }
+
+ const metadata_t::dict_t& get_zap_properties () {
+ return zap_properties;
+ }
+
+ protected:
+
+ // Only used to identify the socket for the Socket-Type
+ // property in the wire protocol.
+ const char *socket_type_string (int socket_type) const;
+
+ size_t add_property (unsigned char *ptr, const char *name,
+ const void *value, size_t value_len) const;
+
+ // Parses a metadata.
+ // Metadata consists of a list of properties consisting of
+ // name and value as size-specified strings.
+ // Returns 0 on success and -1 on error, in which case errno is set.
+ int parse_metadata (
+ const unsigned char *ptr_, size_t length, bool zap_flag = false);
+
+ // This is called by parse_property method whenever it
+ // parses a new property. The function should return 0
+ // on success and -1 on error, in which case it should
+ // set errno. Signaling error prevents parser from
+ // parsing remaining data.
+ // Derived classes are supposed to override this
+ // method to handle custom processing.
+ virtual int property (const std::string& name_,
+ const void *value_, size_t length_);
+
+ // Properties received from ZMTP peer.
+ metadata_t::dict_t zmtp_properties;
+
+ // Properties received from ZAP server.
+ metadata_t::dict_t zap_properties;
+
+ options_t options;
+
+ private:
+
+ blob_t identity;
+
+ blob_t user_id;
+
+ // Returns true iff socket associated with the mechanism
+ // is compatible with a given socket type 'type_'.
+ bool check_socket_type (const std::string& type_) const;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/metadata.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/metadata.cpp
new file mode 100644
index 00000000..956bf989
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/metadata.cpp
@@ -0,0 +1,59 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "metadata.hpp"
+
+zmq::metadata_t::metadata_t (const dict_t &dict) :
+ ref_cnt (1),
+ dict (dict)
+{
+}
+
+zmq::metadata_t::~metadata_t ()
+{
+}
+
+const char *zmq::metadata_t::get (const std::string &property) const
+{
+ dict_t::const_iterator it = dict.find (property);
+ if (it == dict.end ())
+ return NULL;
+ else
+ return it->second.c_str ();
+}
+
+void zmq::metadata_t::add_ref ()
+{
+ ref_cnt.add (1);
+}
+
+bool zmq::metadata_t::drop_ref ()
+{
+ return !ref_cnt.sub (1);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/metadata.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/metadata.hpp
new file mode 100644
index 00000000..7181d784
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/metadata.hpp
@@ -0,0 +1,70 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_METADATA_HPP_INCLUDED__
+#define __ZMQ_METADATA_HPP_INCLUDED__
+
+#include <map>
+#include <string>
+
+#include "atomic_counter.hpp"
+
+namespace zmq
+{
+ class metadata_t
+ {
+ public:
+
+ typedef std::map <std::string, const std::string> dict_t;
+
+ metadata_t (const dict_t &dict);
+ virtual ~metadata_t ();
+
+ // Returns pointer to property value or NULL if
+ // property is not found.
+ virtual const char *get (const std::string &property) const;
+
+ virtual void add_ref ();
+
+ // Drop reference. Returns true iff the reference
+ // counter drops to zero.
+ virtual bool drop_ref ();
+
+ private:
+
+ // Reference counter.
+ atomic_counter_t ref_cnt;
+
+ // Dictionary holding metadata.
+ const dict_t dict;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/msg.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/msg.cpp
new file mode 100644
index 00000000..00ed1595
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/msg.cpp
@@ -0,0 +1,389 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "msg.hpp"
+#include "../include/zmq.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <new>
+
+#include "stdint.hpp"
+#include "likely.hpp"
+#include "metadata.hpp"
+#include "err.hpp"
+
+// Check whether the sizes of public representation of the message (zmq_msg_t)
+// and private representation of the message (zmq::msg_t) match.
+
+typedef char zmq_msg_size_check
+ [2 * ((sizeof (zmq::msg_t) == sizeof (zmq_msg_t)) != 0) - 1];
+
+bool zmq::msg_t::check ()
+{
+ return u.base.type >= type_min && u.base.type <= type_max;
+}
+
+int zmq::msg_t::init ()
+{
+ u.vsm.metadata = NULL;
+ u.vsm.type = type_vsm;
+ u.vsm.flags = 0;
+ u.vsm.size = 0;
+ file_desc = -1;
+ return 0;
+}
+
+int zmq::msg_t::init_size (size_t size_)
+{
+ file_desc = -1;
+ if (size_ <= max_vsm_size) {
+ u.vsm.metadata = NULL;
+ u.vsm.type = type_vsm;
+ u.vsm.flags = 0;
+ u.vsm.size = (unsigned char) size_;
+ }
+ else {
+ u.lmsg.metadata = NULL;
+ u.lmsg.type = type_lmsg;
+ u.lmsg.flags = 0;
+ u.lmsg.content =
+ (content_t*) malloc (sizeof (content_t) + size_);
+ if (unlikely (!u.lmsg.content)) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ u.lmsg.content->data = u.lmsg.content + 1;
+ u.lmsg.content->size = size_;
+ u.lmsg.content->ffn = NULL;
+ u.lmsg.content->hint = NULL;
+ new (&u.lmsg.content->refcnt) zmq::atomic_counter_t ();
+ }
+ return 0;
+}
+
+int zmq::msg_t::init_data (void *data_, size_t size_, msg_free_fn *ffn_,
+ void *hint_)
+{
+ // If data is NULL and size is not 0, a segfault
+ // would occur once the data is accessed
+ zmq_assert (data_ != NULL || size_ == 0);
+
+ file_desc = -1;
+
+ // Initialize constant message if there's no need to deallocate
+ if (ffn_ == NULL) {
+ u.cmsg.metadata = NULL;
+ u.cmsg.type = type_cmsg;
+ u.cmsg.flags = 0;
+ u.cmsg.data = data_;
+ u.cmsg.size = size_;
+ }
+ else {
+ u.lmsg.metadata = NULL;
+ u.lmsg.type = type_lmsg;
+ u.lmsg.flags = 0;
+ u.lmsg.content = (content_t*) malloc (sizeof (content_t));
+ if (!u.lmsg.content) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ u.lmsg.content->data = data_;
+ u.lmsg.content->size = size_;
+ u.lmsg.content->ffn = ffn_;
+ u.lmsg.content->hint = hint_;
+ new (&u.lmsg.content->refcnt) zmq::atomic_counter_t ();
+ }
+ return 0;
+
+}
+
+int zmq::msg_t::init_delimiter ()
+{
+ u.delimiter.metadata = NULL;
+ u.delimiter.type = type_delimiter;
+ u.delimiter.flags = 0;
+ return 0;
+}
+
+int zmq::msg_t::close ()
+{
+ // Check the validity of the message.
+ if (unlikely (!check ())) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ if (u.base.type == type_lmsg) {
+
+ // If the content is not shared, or if it is shared and the reference
+ // count has dropped to zero, deallocate it.
+ if (!(u.lmsg.flags & msg_t::shared) ||
+ !u.lmsg.content->refcnt.sub (1)) {
+
+ // We used "placement new" operator to initialize the reference
+ // counter so we call the destructor explicitly now.
+ u.lmsg.content->refcnt.~atomic_counter_t ();
+
+ if (u.lmsg.content->ffn)
+ u.lmsg.content->ffn (u.lmsg.content->data,
+ u.lmsg.content->hint);
+ free (u.lmsg.content);
+ }
+ }
+
+ if (u.base.metadata != NULL)
+ if (u.base.metadata->drop_ref ())
+ delete u.base.metadata;
+
+ // Make the message invalid.
+ u.base.type = 0;
+
+ return 0;
+}
+
+int zmq::msg_t::move (msg_t &src_)
+{
+ // Check the validity of the source.
+ if (unlikely (!src_.check ())) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ int rc = close ();
+ if (unlikely (rc < 0))
+ return rc;
+
+ *this = src_;
+
+ rc = src_.init ();
+ if (unlikely (rc < 0))
+ return rc;
+
+ return 0;
+}
+
+int zmq::msg_t::copy (msg_t &src_)
+{
+ // Check the validity of the source.
+ if (unlikely (!src_.check ())) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ int rc = close ();
+ if (unlikely (rc < 0))
+ return rc;
+
+ if (src_.u.base.type == type_lmsg) {
+
+ // One reference is added to shared messages. Non-shared messages
+ // are turned into shared messages and reference count is set to 2.
+ if (src_.u.lmsg.flags & msg_t::shared)
+ src_.u.lmsg.content->refcnt.add (1);
+ else {
+ src_.u.lmsg.flags |= msg_t::shared;
+ src_.u.lmsg.content->refcnt.set (2);
+ }
+ }
+
+ if (src_.u.base.metadata != NULL)
+ src_.u.base.metadata->add_ref ();
+
+ *this = src_;
+
+ return 0;
+
+}
+
+void *zmq::msg_t::data ()
+{
+ // Check the validity of the message.
+ zmq_assert (check ());
+
+ switch (u.base.type) {
+ case type_vsm:
+ return u.vsm.data;
+ case type_lmsg:
+ return u.lmsg.content->data;
+ case type_cmsg:
+ return u.cmsg.data;
+ default:
+ zmq_assert (false);
+ return NULL;
+ }
+}
+
+size_t zmq::msg_t::size ()
+{
+ // Check the validity of the message.
+ zmq_assert (check ());
+
+ switch (u.base.type) {
+ case type_vsm:
+ return u.vsm.size;
+ case type_lmsg:
+ return u.lmsg.content->size;
+ case type_cmsg:
+ return u.cmsg.size;
+ default:
+ zmq_assert (false);
+ return 0;
+ }
+}
+
+unsigned char zmq::msg_t::flags ()
+{
+ return u.base.flags;
+}
+
+void zmq::msg_t::set_flags (unsigned char flags_)
+{
+ u.base.flags |= flags_;
+}
+
+void zmq::msg_t::reset_flags (unsigned char flags_)
+{
+ u.base.flags &= ~flags_;
+}
+
+int64_t zmq::msg_t::fd ()
+{
+ return file_desc;
+}
+
+void zmq::msg_t::set_fd (int64_t fd_)
+{
+ file_desc = fd_;
+}
+
+zmq::metadata_t *zmq::msg_t::metadata () const
+{
+ return u.base.metadata;
+}
+
+void zmq::msg_t::set_metadata (zmq::metadata_t *metadata_)
+{
+ assert (metadata_ != NULL);
+ assert (u.base.metadata == NULL);
+ metadata_->add_ref ();
+ u.base.metadata = metadata_;
+}
+
+void zmq::msg_t::reset_metadata ()
+{
+ if (u.base.metadata) {
+ if (u.base.metadata->drop_ref ())
+ delete u.base.metadata;
+ u.base.metadata = NULL;
+ }
+}
+
+bool zmq::msg_t::is_identity () const
+{
+ return (u.base.flags & identity) == identity;
+}
+
+bool zmq::msg_t::is_credential () const
+{
+ return (u.base.flags & credential) == credential;
+}
+
+bool zmq::msg_t::is_delimiter () const
+{
+ return u.base.type == type_delimiter;
+}
+
+bool zmq::msg_t::is_vsm ()
+{
+ return u.base.type == type_vsm;
+}
+
+bool zmq::msg_t::is_cmsg ()
+{
+ return u.base.type == type_cmsg;
+}
+
+void zmq::msg_t::add_refs (int refs_)
+{
+ zmq_assert (refs_ >= 0);
+
+ // Operation not supported for messages with metadata.
+ zmq_assert (u.base.metadata == NULL);
+
+ // No copies required.
+ if (!refs_)
+ return;
+
+ // VSMs, CMSGS and delimiters can be copied straight away. The only
+ // message type that needs special care are long messages.
+ if (u.base.type == type_lmsg) {
+ if (u.lmsg.flags & msg_t::shared)
+ u.lmsg.content->refcnt.add (refs_);
+ else {
+ u.lmsg.content->refcnt.set (refs_ + 1);
+ u.lmsg.flags |= msg_t::shared;
+ }
+ }
+}
+
+bool zmq::msg_t::rm_refs (int refs_)
+{
+ zmq_assert (refs_ >= 0);
+
+ // Operation not supported for messages with metadata.
+ zmq_assert (u.base.metadata == NULL);
+
+ // No copies required.
+ if (!refs_)
+ return true;
+
+ // If there's only one reference close the message.
+ if (u.base.type != type_lmsg || !(u.lmsg.flags & msg_t::shared)) {
+ close ();
+ return false;
+ }
+
+ // The only message type that needs special care are long messages.
+ if (!u.lmsg.content->refcnt.sub (refs_)) {
+ // We used "placement new" operator to initialize the reference
+ // counter so we call the destructor explicitly now.
+ u.lmsg.content->refcnt.~atomic_counter_t ();
+
+ if (u.lmsg.content->ffn)
+ u.lmsg.content->ffn (u.lmsg.content->data, u.lmsg.content->hint);
+ free (u.lmsg.content);
+
+ return false;
+ }
+
+ return true;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/msg.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/msg.hpp
new file mode 100644
index 00000000..9a8baca0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/msg.hpp
@@ -0,0 +1,187 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_MSG_HPP_INCLUDE__
+#define __ZMQ_MSG_HPP_INCLUDE__
+
+#include <stddef.h>
+#include <stdio.h>
+
+#include "config.hpp"
+#include "atomic_counter.hpp"
+#include "metadata.hpp"
+
+// Signature for free function to deallocate the message content.
+// Note that it has to be declared as "C" so that it is the same as
+// zmq_free_fn defined in zmq.h.
+extern "C"
+{
+ typedef void (msg_free_fn) (void *data, void *hint);
+}
+
+namespace zmq
+{
+
+ // Note that this structure needs to be explicitly constructed
+ // (init functions) and destructed (close function).
+
+ class msg_t
+ {
+ public:
+
+ // Message flags.
+ enum
+ {
+ more = 1, // Followed by more parts
+ command = 2, // Command frame (see ZMTP spec)
+ credential = 32,
+ identity = 64,
+ shared = 128
+ };
+
+ bool check ();
+ int init ();
+ int init_size (size_t size_);
+ int init_data (void *data_, size_t size_, msg_free_fn *ffn_,
+ void *hint_);
+ int init_delimiter ();
+ int close ();
+ int move (msg_t &src_);
+ int copy (msg_t &src_);
+ void *data ();
+ size_t size ();
+ unsigned char flags ();
+ void set_flags (unsigned char flags_);
+ void reset_flags (unsigned char flags_);
+ int64_t fd ();
+ void set_fd (int64_t fd_);
+ metadata_t *metadata () const;
+ void set_metadata (metadata_t *metadata_);
+ void reset_metadata ();
+ bool is_identity () const;
+ bool is_credential () const;
+ bool is_delimiter () const;
+ bool is_vsm ();
+ bool is_cmsg ();
+
+ // After calling this function you can copy the message in POD-style
+ // refs_ times. No need to call copy.
+ void add_refs (int refs_);
+
+ // Removes references previously added by add_refs. If the number of
+ // references drops to 0, the message is closed and false is returned.
+ bool rm_refs (int refs_);
+
+ private:
+
+ // Size in bytes of the largest message that is still copied around
+ // rather than being reference-counted.
+ enum { msg_t_size = 64 };
+ enum { max_vsm_size = msg_t_size - (8 + sizeof (metadata_t *) + 3) };
+
+ // Shared message buffer. Message data are either allocated in one
+ // continuous block along with this structure - thus avoiding one
+ // malloc/free pair or they are stored in used-supplied memory.
+ // In the latter case, ffn member stores pointer to the function to be
+ // used to deallocate the data. If the buffer is actually shared (there
+ // are at least 2 references to it) refcount member contains number of
+ // references.
+ struct content_t
+ {
+ void *data;
+ size_t size;
+ msg_free_fn *ffn;
+ void *hint;
+ zmq::atomic_counter_t refcnt;
+ };
+
+ // Different message types.
+ enum type_t
+ {
+ type_min = 101,
+ // VSM messages store the content in the message itself
+ type_vsm = 101,
+ // LMSG messages store the content in malloc-ed memory
+ type_lmsg = 102,
+ // Delimiter messages are used in envelopes
+ type_delimiter = 103,
+ // CMSG messages point to constant data
+ type_cmsg = 104,
+ type_max = 104
+ };
+
+ // the file descriptor where this message originated, needs to be 64bit due to alignment
+ int64_t file_desc;
+
+ // Note that fields shared between different message types are not
+ // moved to tha parent class (msg_t). This way we get tighter packing
+ // of the data. Shared fields can be accessed via 'base' member of
+ // the union.
+ union {
+ struct {
+ metadata_t *metadata;
+ unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + 2)];
+ unsigned char type;
+ unsigned char flags;
+ } base;
+ struct {
+ metadata_t *metadata;
+ unsigned char data [max_vsm_size];
+ unsigned char size;
+ unsigned char type;
+ unsigned char flags;
+ } vsm;
+ struct {
+ metadata_t *metadata;
+ content_t *content;
+ unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + sizeof (content_t*) + 2)];
+ unsigned char type;
+ unsigned char flags;
+ } lmsg;
+ struct {
+ metadata_t *metadata;
+ void* data;
+ size_t size;
+ unsigned char unused
+ [msg_t_size - (8 + sizeof (metadata_t *) + sizeof (void*) + sizeof (size_t) + 2)];
+ unsigned char type;
+ unsigned char flags;
+ } cmsg;
+ struct {
+ metadata_t *metadata;
+ unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + 2)];
+ unsigned char type;
+ unsigned char flags;
+ } delimiter;
+ } u;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mtrie.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mtrie.cpp
new file mode 100644
index 00000000..8a838905
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mtrie.cpp
@@ -0,0 +1,440 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+
+#include <new>
+#include <algorithm>
+
+#include "platform.hpp"
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "err.hpp"
+#include "pipe.hpp"
+#include "mtrie.hpp"
+
+zmq::mtrie_t::mtrie_t () :
+ pipes (0),
+ min (0),
+ count (0),
+ live_nodes (0)
+{
+}
+
+zmq::mtrie_t::~mtrie_t ()
+{
+ if (pipes) {
+ delete pipes;
+ pipes = 0;
+ }
+
+ if (count == 1) {
+ zmq_assert (next.node);
+ delete next.node;
+ next.node = 0;
+ }
+ else
+ if (count > 1) {
+ for (unsigned short i = 0; i != count; ++i)
+ delete next.table [i];
+ free (next.table);
+ }
+}
+
+bool zmq::mtrie_t::add (unsigned char *prefix_, size_t size_, pipe_t *pipe_)
+{
+ return add_helper (prefix_, size_, pipe_);
+}
+
+bool zmq::mtrie_t::add_helper (unsigned char *prefix_, size_t size_,
+ pipe_t *pipe_)
+{
+ // We are at the node corresponding to the prefix. We are done.
+ if (!size_) {
+ bool result = !pipes;
+ if (!pipes) {
+ pipes = new (std::nothrow) pipes_t;
+ alloc_assert (pipes);
+ }
+ pipes->insert (pipe_);
+ return result;
+ }
+
+ unsigned char c = *prefix_;
+ if (c < min || c >= min + count) {
+
+ // The character is out of range of currently handled
+ // charcters. We have to extend the table.
+ if (!count) {
+ min = c;
+ count = 1;
+ next.node = NULL;
+ }
+ else
+ if (count == 1) {
+ unsigned char oldc = min;
+ mtrie_t *oldp = next.node;
+ count = (min < c ? c - min : min - c) + 1;
+ next.table = (mtrie_t**)
+ malloc (sizeof (mtrie_t*) * count);
+ alloc_assert (next.table);
+ for (unsigned short i = 0; i != count; ++i)
+ next.table [i] = 0;
+ min = std::min (min, c);
+ next.table [oldc - min] = oldp;
+ }
+ else
+ if (min < c) {
+ // The new character is above the current character range.
+ unsigned short old_count = count;
+ count = c - min + 1;
+ next.table = (mtrie_t**) realloc (next.table,
+ sizeof (mtrie_t*) * count);
+ alloc_assert (next.table);
+ for (unsigned short i = old_count; i != count; i++)
+ next.table [i] = NULL;
+ }
+ else {
+ // The new character is below the current character range.
+ unsigned short old_count = count;
+ count = (min + old_count) - c;
+ next.table = (mtrie_t**) realloc (next.table,
+ sizeof (mtrie_t*) * count);
+ alloc_assert (next.table);
+ memmove (next.table + min - c, next.table,
+ old_count * sizeof (mtrie_t*));
+ for (unsigned short i = 0; i != min - c; i++)
+ next.table [i] = NULL;
+ min = c;
+ }
+ }
+
+ // If next node does not exist, create one.
+ if (count == 1) {
+ if (!next.node) {
+ next.node = new (std::nothrow) mtrie_t;
+ alloc_assert (next.node);
+ ++live_nodes;
+ }
+ return next.node->add_helper (prefix_ + 1, size_ - 1, pipe_);
+ }
+ else {
+ if (!next.table [c - min]) {
+ next.table [c - min] = new (std::nothrow) mtrie_t;
+ alloc_assert (next.table [c - min]);
+ ++live_nodes;
+ }
+ return next.table [c - min]->add_helper (prefix_ + 1, size_ - 1, pipe_);
+ }
+}
+
+
+void zmq::mtrie_t::rm (pipe_t *pipe_,
+ void (*func_) (unsigned char *data_, size_t size_, void *arg_),
+ void *arg_)
+{
+ unsigned char *buff = NULL;
+ rm_helper (pipe_, &buff, 0, 0, func_, arg_);
+ free (buff);
+}
+
+void zmq::mtrie_t::rm_helper (pipe_t *pipe_, unsigned char **buff_,
+ size_t buffsize_, size_t maxbuffsize_,
+ void (*func_) (unsigned char *data_, size_t size_, void *arg_),
+ void *arg_)
+{
+ // Remove the subscription from this node.
+ if (pipes && pipes->erase (pipe_) && pipes->empty ()) {
+ func_ (*buff_, buffsize_, arg_);
+ delete pipes;
+ pipes = 0;
+ }
+
+ // Adjust the buffer.
+ if (buffsize_ >= maxbuffsize_) {
+ maxbuffsize_ = buffsize_ + 256;
+ *buff_ = (unsigned char*) realloc (*buff_, maxbuffsize_);
+ alloc_assert (*buff_);
+ }
+
+ // If there are no subnodes in the trie, return.
+ if (count == 0)
+ return;
+
+ // If there's one subnode (optimisation).
+ if (count == 1) {
+ (*buff_) [buffsize_] = min;
+ buffsize_++;
+ next.node->rm_helper (pipe_, buff_, buffsize_, maxbuffsize_,
+ func_, arg_);
+
+ // Prune the node if it was made redundant by the removal
+ if (next.node->is_redundant ()) {
+ delete next.node;
+ next.node = 0;
+ count = 0;
+ --live_nodes;
+ zmq_assert (live_nodes == 0);
+ }
+ return;
+ }
+
+ // If there are multiple subnodes.
+ //
+ // New min non-null character in the node table after the removal
+ unsigned char new_min = min + count - 1;
+ // New max non-null character in the node table after the removal
+ unsigned char new_max = min;
+ for (unsigned short c = 0; c != count; c++) {
+ (*buff_) [buffsize_] = min + c;
+ if (next.table [c]) {
+ next.table [c]->rm_helper (pipe_, buff_, buffsize_ + 1,
+ maxbuffsize_, func_, arg_);
+
+ // Prune redundant nodes from the mtrie
+ if (next.table [c]->is_redundant ()) {
+ delete next.table [c];
+ next.table [c] = 0;
+
+ zmq_assert (live_nodes > 0);
+ --live_nodes;
+ }
+ else {
+ // The node is not redundant, so it's a candidate for being
+ // the new min/max node.
+ //
+ // We loop through the node array from left to right, so the
+ // first non-null, non-redundant node encountered is the new
+ // minimum index. Conversely, the last non-redundant, non-null
+ // node encountered is the new maximum index.
+ if (c + min < new_min)
+ new_min = c + min;
+ if (c + min > new_max)
+ new_max = c + min;
+ }
+ }
+ }
+
+ zmq_assert (count > 1);
+
+ // Free the node table if it's no longer used.
+ if (live_nodes == 0) {
+ free (next.table);
+ next.table = NULL;
+ count = 0;
+ }
+ // Compact the node table if possible
+ else
+ if (live_nodes == 1) {
+ // If there's only one live node in the table we can
+ // switch to using the more compact single-node
+ // representation
+ zmq_assert (new_min == new_max);
+ zmq_assert (new_min >= min && new_min < min + count);
+ mtrie_t *node = next.table [new_min - min];
+ zmq_assert (node);
+ free (next.table);
+ next.node = node;
+ count = 1;
+ min = new_min;
+ }
+ else
+ if (new_min > min || new_max < min + count - 1) {
+ zmq_assert (new_max - new_min + 1 > 1);
+
+ mtrie_t **old_table = next.table;
+ zmq_assert (new_min > min || new_max < min + count - 1);
+ zmq_assert (new_min >= min);
+ zmq_assert (new_max <= min + count - 1);
+ zmq_assert (new_max - new_min + 1 < count);
+
+ count = new_max - new_min + 1;
+ next.table = (mtrie_t**) malloc (sizeof (mtrie_t*) * count);
+ alloc_assert (next.table);
+
+ memmove (next.table, old_table + (new_min - min),
+ sizeof (mtrie_t*) * count);
+ free (old_table);
+
+ min = new_min;
+ }
+}
+
+bool zmq::mtrie_t::rm (unsigned char *prefix_, size_t size_, pipe_t *pipe_)
+{
+ return rm_helper (prefix_, size_, pipe_);
+}
+
+bool zmq::mtrie_t::rm_helper (unsigned char *prefix_, size_t size_,
+ pipe_t *pipe_)
+{
+ if (!size_) {
+ if (pipes) {
+ pipes_t::size_type erased = pipes->erase (pipe_);
+ zmq_assert (erased == 1);
+ if (pipes->empty ()) {
+ delete pipes;
+ pipes = 0;
+ }
+ }
+ return !pipes;
+ }
+
+ unsigned char c = *prefix_;
+ if (!count || c < min || c >= min + count)
+ return false;
+
+ mtrie_t *next_node =
+ count == 1 ? next.node : next.table [c - min];
+
+ if (!next_node)
+ return false;
+
+ bool ret = next_node->rm_helper (prefix_ + 1, size_ - 1, pipe_);
+
+ if (next_node->is_redundant ()) {
+ delete next_node;
+ zmq_assert (count > 0);
+
+ if (count == 1) {
+ next.node = 0;
+ count = 0;
+ --live_nodes;
+ zmq_assert (live_nodes == 0);
+ }
+ else {
+ next.table [c - min] = 0;
+ zmq_assert (live_nodes > 1);
+ --live_nodes;
+
+ // Compact the table if possible
+ if (live_nodes == 1) {
+ // If there's only one live node in the table we can
+ // switch to using the more compact single-node
+ // representation
+ unsigned short i;
+ for (i = 0; i < count; ++i)
+ if (next.table [i])
+ break;
+
+ zmq_assert (i < count);
+ min += i;
+ count = 1;
+ mtrie_t *oldp = next.table [i];
+ free (next.table);
+ next.node = oldp;
+ }
+ else
+ if (c == min) {
+ // We can compact the table "from the left"
+ unsigned short i;
+ for (i = 1; i < count; ++i)
+ if (next.table [i])
+ break;
+
+ zmq_assert (i < count);
+ min += i;
+ count -= i;
+ mtrie_t **old_table = next.table;
+ next.table = (mtrie_t**) malloc (sizeof (mtrie_t*) * count);
+ alloc_assert (next.table);
+ memmove (next.table, old_table + i, sizeof (mtrie_t*) * count);
+ free (old_table);
+ }
+ else
+ if (c == min + count - 1) {
+ // We can compact the table "from the right"
+ unsigned short i;
+ for (i = 1; i < count; ++i)
+ if (next.table [count - 1 - i])
+ break;
+
+ zmq_assert (i < count);
+ count -= i;
+ mtrie_t **old_table = next.table;
+ next.table = (mtrie_t**) malloc (sizeof (mtrie_t*) * count);
+ alloc_assert (next.table);
+ memmove (next.table, old_table, sizeof (mtrie_t*) * count);
+ free (old_table);
+ }
+ }
+ }
+
+ return ret;
+}
+
+void zmq::mtrie_t::match (unsigned char *data_, size_t size_,
+ void (*func_) (pipe_t *pipe_, void *arg_), void *arg_)
+{
+ mtrie_t *current = this;
+ while (true) {
+
+ // Signal the pipes attached to this node.
+ if (current->pipes) {
+ for (pipes_t::iterator it = current->pipes->begin ();
+ it != current->pipes->end (); ++it)
+ func_ (*it, arg_);
+ }
+
+ // If we are at the end of the message, there's nothing more to match.
+ if (!size_)
+ break;
+
+ // If there are no subnodes in the trie, return.
+ if (current->count == 0)
+ break;
+
+ // If there's one subnode (optimisation).
+ if (current->count == 1) {
+ if (data_ [0] != current->min)
+ break;
+ current = current->next.node;
+ data_++;
+ size_--;
+ continue;
+ }
+
+ // If there are multiple subnodes.
+ if (data_ [0] < current->min || data_ [0] >=
+ current->min + current->count)
+ break;
+ if (!current->next.table [data_ [0] - current->min])
+ break;
+ current = current->next.table [data_ [0] - current->min];
+ data_++;
+ size_--;
+ }
+}
+
+bool zmq::mtrie_t::is_redundant () const
+{
+ return !pipes && live_nodes == 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mtrie.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mtrie.hpp
new file mode 100644
index 00000000..6d49380c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mtrie.hpp
@@ -0,0 +1,101 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_MTRIE_HPP_INCLUDED__
+#define __ZMQ_MTRIE_HPP_INCLUDED__
+
+#include <stddef.h>
+#include <set>
+
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ class pipe_t;
+
+ // Multi-trie. Each node in the trie is a set of pointers to pipes.
+
+ class mtrie_t
+ {
+ public:
+
+ mtrie_t ();
+ ~mtrie_t ();
+
+ // Add key to the trie. Returns true if it's a new subscription
+ // rather than a duplicate.
+ bool add (unsigned char *prefix_, size_t size_, zmq::pipe_t *pipe_);
+
+ // Remove all subscriptions for a specific peer from the trie.
+ // If there are no subscriptions left on some topics, invoke the
+ // supplied callback function.
+ void rm (zmq::pipe_t *pipe_,
+ void (*func_) (unsigned char *data_, size_t size_, void *arg_),
+ void *arg_);
+
+ // Remove specific subscription from the trie. Return true is it was
+ // actually removed rather than de-duplicated.
+ bool rm (unsigned char *prefix_, size_t size_, zmq::pipe_t *pipe_);
+
+ // Signal all the matching pipes.
+ void match (unsigned char *data_, size_t size_,
+ void (*func_) (zmq::pipe_t *pipe_, void *arg_), void *arg_);
+
+ private:
+
+ bool add_helper (unsigned char *prefix_, size_t size_,
+ zmq::pipe_t *pipe_);
+ void rm_helper (zmq::pipe_t *pipe_, unsigned char **buff_,
+ size_t buffsize_, size_t maxbuffsize_,
+ void (*func_) (unsigned char *data_, size_t size_, void *arg_),
+ void *arg_);
+ bool rm_helper (unsigned char *prefix_, size_t size_,
+ zmq::pipe_t *pipe_);
+ bool is_redundant () const;
+
+ typedef std::set <zmq::pipe_t*> pipes_t;
+ pipes_t *pipes;
+
+ unsigned char min;
+ unsigned short count;
+ unsigned short live_nodes;
+ union {
+ class mtrie_t *node;
+ class mtrie_t **table;
+ } next;
+
+ mtrie_t (const mtrie_t&);
+ const mtrie_t &operator = (const mtrie_t&);
+ };
+
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mutex.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mutex.hpp
new file mode 100644
index 00000000..80a38f5c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/mutex.hpp
@@ -0,0 +1,167 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_MUTEX_HPP_INCLUDED__
+#define __ZMQ_MUTEX_HPP_INCLUDED__
+
+#include "platform.hpp"
+#include "err.hpp"
+
+// Mutex class encapsulates OS mutex in a platform-independent way.
+
+#ifdef ZMQ_HAVE_WINDOWS
+
+#include "windows.hpp"
+
+namespace zmq
+{
+
+ class mutex_t
+ {
+ public:
+ inline mutex_t ()
+ {
+ InitializeCriticalSection (&cs);
+ }
+
+ inline ~mutex_t ()
+ {
+ DeleteCriticalSection (&cs);
+ }
+
+ inline void lock ()
+ {
+ EnterCriticalSection (&cs);
+ }
+
+ inline bool try_lock ()
+ {
+ return (TryEnterCriticalSection (&cs)) ? true : false;
+ }
+
+ inline void unlock ()
+ {
+ LeaveCriticalSection (&cs);
+ }
+
+ private:
+
+ CRITICAL_SECTION cs;
+
+ // Disable copy construction and assignment.
+ mutex_t (const mutex_t&);
+ void operator = (const mutex_t&);
+ };
+
+}
+
+#else
+
+#include <pthread.h>
+
+namespace zmq
+{
+
+ class mutex_t
+ {
+ public:
+ inline mutex_t ()
+ {
+ int rc = pthread_mutex_init (&mutex, NULL);
+ posix_assert (rc);
+ }
+
+ inline ~mutex_t ()
+ {
+ int rc = pthread_mutex_destroy (&mutex);
+ posix_assert (rc);
+ }
+
+ inline void lock ()
+ {
+ int rc = pthread_mutex_lock (&mutex);
+ posix_assert (rc);
+ }
+
+ inline bool try_lock ()
+ {
+ int rc = pthread_mutex_trylock (&mutex);
+ if (rc == EBUSY)
+ return false;
+
+ posix_assert (rc);
+ return true;
+ }
+
+ inline void unlock ()
+ {
+ int rc = pthread_mutex_unlock (&mutex);
+ posix_assert (rc);
+ }
+
+ private:
+
+ pthread_mutex_t mutex;
+
+ // Disable copy construction and assignment.
+ mutex_t (const mutex_t&);
+ const mutex_t &operator = (const mutex_t&);
+ };
+
+}
+
+#endif
+
+
+namespace zmq
+{
+ struct scoped_lock_t
+ {
+ scoped_lock_t (mutex_t& mutex_)
+ : mutex (mutex_)
+ {
+ mutex.lock ();
+ }
+
+ ~scoped_lock_t ()
+ {
+ mutex.unlock ();
+ }
+
+ private:
+
+ mutex_t& mutex;
+
+ // Disable copy construction and assignment.
+ scoped_lock_t (const scoped_lock_t&);
+ const scoped_lock_t &operator = (const scoped_lock_t&);
+ };
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/norm_engine.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/norm_engine.cpp
new file mode 100644
index 00000000..23eac066
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/norm_engine.cpp
@@ -0,0 +1,728 @@
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_NORM
+
+#include "norm_engine.hpp"
+#include "session_base.hpp"
+#include "v2_protocol.hpp"
+
+zmq::norm_engine_t::norm_engine_t(io_thread_t* parent_,
+ const options_t& options_)
+ : io_object_t(parent_), zmq_session(NULL), options(options_),
+ norm_instance(NORM_INSTANCE_INVALID), norm_session(NORM_SESSION_INVALID),
+ is_sender(false), is_receiver(false),
+ zmq_encoder(0), norm_tx_stream(NORM_OBJECT_INVALID),
+ tx_first_msg(true), tx_more_bit(false),
+ zmq_output_ready(false), norm_tx_ready(false),
+ tx_index(0), tx_len(0),
+ zmq_input_ready(false)
+{
+ int rc = tx_msg.init();
+ errno_assert(0 == rc);
+}
+
+zmq::norm_engine_t::~norm_engine_t()
+{
+ shutdown(); // in case it was not already called
+}
+
+
+int zmq::norm_engine_t::init(const char* network_, bool send, bool recv)
+{
+ // Parse the "network_" address int "iface", "addr", and "port"
+ // norm endpoint format: [id,][<iface>;]<addr>:<port>
+ // First, look for optional local NormNodeId
+ // (default NORM_NODE_ANY causes NORM to use host IP addr for NormNodeId)
+ NormNodeId localId = NORM_NODE_ANY;
+ const char* ifacePtr = strchr(network_, ',');
+ if (NULL != ifacePtr)
+ {
+ size_t idLen = ifacePtr - network_;
+ if (idLen > 31) idLen = 31;
+ char idText[32];
+ strncpy(idText, network_, idLen);
+ idText[idLen] = '\0';
+ localId = (NormNodeId)atoi(idText);
+ ifacePtr++;
+ }
+ else
+ {
+ ifacePtr = network_;
+ }
+
+ // Second, look for optional multicast ifaceName
+ char ifaceName[256];
+ const char* addrPtr = strchr(ifacePtr, ';');
+ if (NULL != addrPtr)
+ {
+ size_t ifaceLen = addrPtr - ifacePtr;
+ if (ifaceLen > 255) ifaceLen = 255; // return error instead?
+ strncpy(ifaceName, ifacePtr, ifaceLen);
+ ifaceName[ifaceLen] = '\0';
+ ifacePtr = ifaceName;
+ addrPtr++;
+ }
+ else
+ {
+ addrPtr = ifacePtr;
+ ifacePtr = NULL;
+ }
+
+ // Finally, parse IP address and port number
+ const char* portPtr = strrchr(addrPtr, ':');
+ if (NULL == portPtr)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ char addr[256];
+ size_t addrLen = portPtr - addrPtr;
+ if (addrLen > 255) addrLen = 255;
+ strncpy(addr, addrPtr, addrLen);
+ addr[addrLen] = '\0';
+ portPtr++;
+ unsigned short portNumber = atoi(portPtr);
+
+ if (NORM_INSTANCE_INVALID == norm_instance)
+ {
+ if (NORM_INSTANCE_INVALID == (norm_instance = NormCreateInstance()))
+ {
+ // errno set by whatever caused NormCreateInstance() to fail
+ return -1;
+ }
+ }
+
+ // TBD - What do we use for our local NormNodeId?
+ // (for now we use automatic, IP addr based assignment or passed in 'id')
+ // a) Use ZMQ Identity somehow?
+ // b) Add function to use iface addr
+ // c) Randomize and implement a NORM session layer
+ // conflict detection/resolution protocol
+
+ norm_session = NormCreateSession(norm_instance, addr, portNumber, localId);
+ if (NORM_SESSION_INVALID == norm_session)
+ {
+ int savedErrno = errno;
+ NormDestroyInstance(norm_instance);
+ norm_instance = NORM_INSTANCE_INVALID;
+ errno = savedErrno;
+ return -1;
+ }
+ // There's many other useful NORM options that could be applied here
+ if (NormIsUnicastAddress(addr))
+ {
+ NormSetDefaultUnicastNack(norm_session, true);
+ }
+ else
+ {
+ // These only apply for multicast sessions
+ //NormSetTTL(norm_session, options.multicast_hops); // ZMQ default is 1
+ NormSetTTL(norm_session, 255); // since the ZMQ_MULTICAST_HOPS socket option isn't well-supported
+ NormSetRxPortReuse(norm_session, true); // port reuse doesn't work for non-connected unicast
+ NormSetLoopback(norm_session, true); // needed when multicast users on same machine
+ if (NULL != ifacePtr)
+ {
+ // Note a bad interface may not be caught until sender or receiver start
+ // (Since sender/receiver is not yet started, this always succeeds here)
+ NormSetMulticastInterface(norm_session, ifacePtr);
+ }
+ }
+
+ if (recv)
+ {
+ // The alternative NORM_SYNC_CURRENT here would provide "instant"
+ // receiver sync to the sender's _current_ message transmission.
+ // NORM_SYNC_STREAM tries to get everything the sender has cached/buffered
+ NormSetDefaultSyncPolicy(norm_session, NORM_SYNC_STREAM);
+ if (!NormStartReceiver(norm_session, 2*1024*1024))
+ {
+ // errno set by whatever failed
+ int savedErrno = errno;
+ NormDestroyInstance(norm_instance); // session gets closed, too
+ norm_session = NORM_SESSION_INVALID;
+ norm_instance = NORM_INSTANCE_INVALID;
+ errno = savedErrno;
+ return -1;
+ }
+ is_receiver = true;
+ }
+
+ if (send)
+ {
+ // Pick a random sender instance id (aka norm sender session id)
+ NormSessionId instanceId = NormGetRandomSessionId();
+ // TBD - provide "options" for some NORM sender parameters
+ if (!NormStartSender(norm_session, instanceId, 2*1024*1024, 1400, 16, 4))
+ {
+ // errno set by whatever failed
+ int savedErrno = errno;
+ NormDestroyInstance(norm_instance); // session gets closed, too
+ norm_session = NORM_SESSION_INVALID;
+ norm_instance = NORM_INSTANCE_INVALID;
+ errno = savedErrno;
+ return -1;
+ }
+ NormSetCongestionControl(norm_session, true);
+ norm_tx_ready = true;
+ is_sender = true;
+ if (NORM_OBJECT_INVALID == (norm_tx_stream = NormStreamOpen(norm_session, 2*1024*1024)))
+ {
+ // errno set by whatever failed
+ int savedErrno = errno;
+ NormDestroyInstance(norm_instance); // session gets closed, too
+ norm_session = NORM_SESSION_INVALID;
+ norm_instance = NORM_INSTANCE_INVALID;
+ errno = savedErrno;
+ return -1;
+ }
+ }
+
+ //NormSetMessageTrace(norm_session, true);
+ //NormSetDebugLevel(3);
+ //NormOpenDebugLog(norm_instance, "normLog.txt");
+
+ return 0; // no error
+} // end zmq::norm_engine_t::init()
+
+void zmq::norm_engine_t::shutdown()
+{
+ // TBD - implement a more graceful shutdown option
+ if (is_receiver)
+ {
+ NormStopReceiver(norm_session);
+
+ // delete any active NormRxStreamState
+ rx_pending_list.Destroy();
+ rx_ready_list.Destroy();
+ msg_ready_list.Destroy();
+
+ is_receiver = false;
+ }
+ if (is_sender)
+ {
+ NormStopSender(norm_session);
+ is_sender = false;
+ }
+ if (NORM_SESSION_INVALID != norm_session)
+ {
+ NormDestroySession(norm_session);
+ norm_session = NORM_SESSION_INVALID;
+ }
+ if (NORM_INSTANCE_INVALID != norm_instance)
+ {
+ NormStopInstance(norm_instance);
+ NormDestroyInstance(norm_instance);
+ norm_instance = NORM_INSTANCE_INVALID;
+ }
+} // end zmq::norm_engine_t::shutdown()
+
+void zmq::norm_engine_t::plug (io_thread_t* io_thread_, session_base_t *session_)
+{
+ // TBD - we may assign the NORM engine to an io_thread in the future???
+ zmq_session = session_;
+ if (is_sender) zmq_output_ready = true;
+ if (is_receiver) zmq_input_ready = true;
+
+ fd_t normDescriptor = NormGetDescriptor(norm_instance);
+ norm_descriptor_handle = add_fd(normDescriptor);
+ // Set POLLIN for notification of pending NormEvents
+ set_pollin(norm_descriptor_handle);
+
+ if (is_sender) send_data();
+
+} // end zmq::norm_engine_t::init()
+
+void zmq::norm_engine_t::unplug()
+{
+ rm_fd(norm_descriptor_handle);
+
+ zmq_session = NULL;
+} // end zmq::norm_engine_t::unplug()
+
+void zmq::norm_engine_t::terminate()
+{
+ unplug();
+ shutdown();
+ delete this;
+}
+
+void zmq::norm_engine_t::restart_output()
+{
+ // There's new message data available from the session
+ zmq_output_ready = true;
+ if (norm_tx_ready) send_data();
+
+} // end zmq::norm_engine_t::restart_output()
+
+void zmq::norm_engine_t::send_data()
+{
+ // Here we write as much as is available or we can
+ while (zmq_output_ready && norm_tx_ready)
+ {
+ if (0 == tx_len)
+ {
+ // Our tx_buffer needs data to send
+ // Get more data from encoder
+ size_t space = BUFFER_SIZE;
+ unsigned char* bufPtr = (unsigned char*)tx_buffer;
+ tx_len = zmq_encoder.encode(&bufPtr, space);
+ if (0 == tx_len)
+ {
+ if (tx_first_msg)
+ {
+ // We don't need to mark eom/flush until a message is sent
+ tx_first_msg = false;
+ }
+ else
+ {
+ // A prior message was completely written to stream, so
+ // mark end-of-message and possibly flush (to force packet transmission,
+ // even if it's not a full segment so message gets delivered quickly)
+ // NormStreamMarkEom(norm_tx_stream); // the flush below marks eom
+ // Note NORM_FLUSH_ACTIVE makes NORM fairly chatty for low duty cycle messaging
+ // but makes sure content is delivered quickly. Positive acknowledgements
+ // with flush override would make NORM more succinct here
+ NormStreamFlush(norm_tx_stream, true, NORM_FLUSH_ACTIVE);
+ }
+ // Need to pull and load a new message to send
+ if (-1 == zmq_session->pull_msg(&tx_msg))
+ {
+ // We need to wait for "restart_output()" to be called by ZMQ
+ zmq_output_ready = false;
+ break;
+ }
+ zmq_encoder.load_msg(&tx_msg);
+ // Should we write message size header for NORM to use? Or expect NORM
+ // receiver to decode ZMQ message framing format(s)?
+ // OK - we need to use a byte to denote when the ZMQ frame is the _first_
+ // frame of a message so it can be decoded properly when a receiver
+ // 'syncs' mid-stream. We key off the the state of the 'more_flag'
+ // I.e.,If more_flag _was_ false previously, this is the first
+ // frame of a ZMQ message.
+ if (tx_more_bit)
+ tx_buffer[0] = (char)0xff; // this is not first frame of message
+ else
+ tx_buffer[0] = 0x00; // this is first frame of message
+ tx_more_bit = (0 != (tx_msg.flags() & msg_t::more));
+ // Go ahead an get a first chunk of the message
+ bufPtr++;
+ space--;
+ tx_len = 1 + zmq_encoder.encode(&bufPtr, space);
+ tx_index = 0;
+ }
+ }
+ // Do we have data in our tx_buffer pending
+ if (tx_index < tx_len)
+ {
+ // We have data in our tx_buffer to send, so write it to the stream
+ tx_index += NormStreamWrite(norm_tx_stream, tx_buffer + tx_index, tx_len - tx_index);
+ if (tx_index < tx_len)
+ {
+ // NORM stream buffer full, wait for NORM_TX_QUEUE_VACANCY
+ norm_tx_ready = false;
+ break;
+ }
+ tx_len = 0; // all buffered data was written
+ }
+ } // end while (zmq_output_ready && norm_tx_ready)
+} // end zmq::norm_engine_t::send_data()
+
+void zmq::norm_engine_t::in_event()
+{
+ // This means a NormEvent is pending, so call NormGetNextEvent() and handle
+ NormEvent event;
+ if (!NormGetNextEvent(norm_instance, &event))
+ {
+ // NORM has died before we unplugged?!
+ zmq_assert(false);
+ return;
+ }
+
+ switch(event.type)
+ {
+ case NORM_TX_QUEUE_VACANCY:
+ case NORM_TX_QUEUE_EMPTY:
+ if (!norm_tx_ready)
+ {
+ norm_tx_ready = true;
+ send_data();
+ }
+ break;
+
+ case NORM_RX_OBJECT_NEW:
+ //break;
+ case NORM_RX_OBJECT_UPDATED:
+ recv_data(event.object);
+ break;
+
+ case NORM_RX_OBJECT_ABORTED:
+ {
+ NormRxStreamState* rxState = (NormRxStreamState*)NormObjectGetUserData(event.object);
+ if (NULL != rxState)
+ {
+ // Remove the state from the list it's in
+ // This is now unnecessary since deletion takes care of list removal
+ // but in the interest of being clear ...
+ NormRxStreamState::List* list = rxState->AccessList();
+ if (NULL != list) list->Remove(*rxState);
+ }
+ delete rxState;
+ break;
+ }
+ case NORM_REMOTE_SENDER_INACTIVE:
+ // Here we free resources used for this formerly active sender.
+ // Note w/ NORM_SYNC_STREAM, if sender reactivates, we may
+ // get some messages delivered twice. NORM_SYNC_CURRENT would
+ // mitigate that but might miss data at startup. Always tradeoffs.
+ // Instead of immediately deleting, we could instead initiate a
+ // user configurable timeout here to wait some amount of time
+ // after this event to declare the remote sender truly dead
+ // and delete its state???
+ NormNodeDelete(event.sender);
+ break;
+
+ default:
+ // We ignore some NORM events
+ break;
+ }
+} // zmq::norm_engine_t::in_event()
+
+void zmq::norm_engine_t::restart_input()
+{
+ // TBD - should we check/assert that zmq_input_ready was false???
+ zmq_input_ready = true;
+ // Process any pending received messages
+ if (!msg_ready_list.IsEmpty())
+ recv_data(NORM_OBJECT_INVALID);
+
+} // end zmq::norm_engine_t::restart_input()
+
+void zmq::norm_engine_t::recv_data(NormObjectHandle object)
+{
+ if (NORM_OBJECT_INVALID != object)
+ {
+ // Call result of NORM_RX_OBJECT_UPDATED notification
+ // This is a rx_ready indication for a new or existing rx stream
+ // First, determine if this is a stream we already know
+ zmq_assert(NORM_OBJECT_STREAM == NormObjectGetType(object));
+ // Since there can be multiple senders (publishers), we keep
+ // state for each separate rx stream.
+ NormRxStreamState* rxState = (NormRxStreamState*)NormObjectGetUserData(object);
+ if (NULL == rxState)
+ {
+ // This is a new stream, so create rxState with zmq decoder, etc
+ rxState = new NormRxStreamState(object, options.maxmsgsize);
+ if (!rxState->Init())
+ {
+ errno_assert(false);
+ delete rxState;
+ return;
+ }
+ NormObjectSetUserData(object, rxState);
+ }
+ else if (!rxState->IsRxReady())
+ {
+ // Existing non-ready stream, so remove from pending
+ // list to be promoted to rx_ready_list ...
+ rx_pending_list.Remove(*rxState);
+ }
+ if (!rxState->IsRxReady())
+ {
+ // TBD - prepend up front for immediate service?
+ rxState->SetRxReady(true);
+ rx_ready_list.Append(*rxState);
+ }
+ }
+ // This loop repeats until we've read all data available from "rx ready" inbound streams
+ // and pushed any accumulated messages we can up to the zmq session.
+ while (!rx_ready_list.IsEmpty() || (zmq_input_ready && !msg_ready_list.IsEmpty()))
+ {
+ // Iterate through our rx_ready streams, reading data into the decoder
+ // (This services incoming "rx ready" streams in a round-robin fashion)
+ NormRxStreamState::List::Iterator iterator(rx_ready_list);
+ NormRxStreamState* rxState;
+ while (NULL != (rxState = iterator.GetNextItem()))
+ {
+ switch(rxState->Decode())
+ {
+ case 1: // msg completed
+ // Complete message decoded, move this stream to msg_ready_list
+ // to push the message up to the session below. Note the stream
+ // will be returned to the "rx_ready_list" after that's done
+ rx_ready_list.Remove(*rxState);
+ msg_ready_list.Append(*rxState);
+ continue;
+
+ case -1: // decoding error (shouldn't happen w/ NORM, but ...)
+ // We need to re-sync this stream (decoder buffer was reset)
+ rxState->SetSync(false);
+ break;
+
+ default: // 0 - need more data
+ break;
+ }
+ // Get more data from this stream
+ NormObjectHandle stream = rxState->GetStreamHandle();
+ // First, make sure we're in sync ...
+ while (!rxState->InSync())
+ {
+ // seek NORM message start
+ if (!NormStreamSeekMsgStart(stream))
+ {
+ // Need to wait for more data
+ break;
+ }
+ // read message 'flag' byte to see if this it's a 'final' frame
+ char syncFlag;
+ unsigned int numBytes = 1;
+ if (!NormStreamRead(stream, &syncFlag, &numBytes))
+ {
+ // broken stream (shouldn't happen after seek msg start?)
+ zmq_assert(false);
+ continue;
+ }
+ if (0 == numBytes)
+ {
+ // This probably shouldn't happen either since we found msg start
+ // Need to wait for more data
+ break;
+ }
+ if (0 == syncFlag) rxState->SetSync(true);
+ // else keep seeking ...
+ } // end while(!rxState->InSync())
+ if (!rxState->InSync())
+ {
+ // Need more data for this stream, so remove from "rx ready"
+ // list and iterate to next "rx ready" stream
+ rxState->SetRxReady(false);
+ // Move from rx_ready_list to rx_pending_list
+ rx_ready_list.Remove(*rxState);
+ rx_pending_list.Append(*rxState);
+ continue;
+ }
+ // Now we're actually ready to read data from the NORM stream to the zmq_decoder
+ // the underlying zmq_decoder->get_buffer() call sets how much is needed.
+ unsigned int numBytes = rxState->GetBytesNeeded();
+ if (!NormStreamRead(stream, rxState->AccessBuffer(), &numBytes))
+ {
+ // broken NORM stream, so re-sync
+ rxState->Init(); // TBD - check result
+ // This will retry syncing, and getting data from this stream
+ // since we don't increment the "it" iterator
+ continue;
+ }
+ rxState->IncrementBufferCount(numBytes);
+ if (0 == numBytes)
+ {
+ // All the data available has been read
+ // Need to wait for NORM_RX_OBJECT_UPDATED for this stream
+ rxState->SetRxReady(false);
+ // Move from rx_ready_list to rx_pending_list
+ rx_ready_list.Remove(*rxState);
+ rx_pending_list.Append(*rxState);
+ }
+ } // end while(NULL != (rxState = iterator.GetNextItem()))
+
+ if (zmq_input_ready)
+ {
+ // At this point, we've made a pass through the "rx_ready" stream list
+ // Now make a pass through the "msg_pending" list (if the zmq session
+ // ready for more input). This may possibly return streams back to
+ // the "rx ready" stream list after their pending message is handled
+ NormRxStreamState::List::Iterator iterator(msg_ready_list);
+ NormRxStreamState* rxState;
+ while (NULL != (rxState = iterator.GetNextItem()))
+ {
+ msg_t* msg = rxState->AccessMsg();
+ int rc = zmq_session->push_msg(msg);
+ if (-1 == rc)
+ {
+ if (EAGAIN == errno)
+ {
+ // need to wait until session calls "restart_input()"
+ zmq_input_ready = false;
+ break;
+ }
+ else
+ {
+ // session rejected message?
+ // TBD - handle this better
+ zmq_assert(false);
+ }
+ }
+ // else message was accepted.
+ msg_ready_list.Remove(*rxState);
+ if (rxState->IsRxReady()) // Move back to "rx_ready" list to read more data
+ rx_ready_list.Append(*rxState);
+ else // Move back to "rx_pending" list until NORM_RX_OBJECT_UPDATED
+ msg_ready_list.Append(*rxState);
+ } // end while(NULL != (rxState = iterator.GetNextItem()))
+ } // end if (zmq_input_ready)
+ } // end while ((!rx_ready_list.empty() || (zmq_input_ready && !msg_ready_list.empty()))
+
+ // Alert zmq of the messages we have pushed up
+ zmq_session->flush();
+
+} // end zmq::norm_engine_t::recv_data()
+
+zmq::norm_engine_t::NormRxStreamState::NormRxStreamState(NormObjectHandle normStream,
+ int64_t maxMsgSize)
+ : norm_stream(normStream), max_msg_size(maxMsgSize),
+ in_sync(false), rx_ready(false), zmq_decoder(NULL), skip_norm_sync(false),
+ buffer_ptr(NULL), buffer_size(0), buffer_count(0),
+ prev(NULL), next(NULL), list(NULL)
+{
+}
+
+zmq::norm_engine_t::NormRxStreamState::~NormRxStreamState()
+{
+ if (NULL != zmq_decoder)
+ {
+ delete zmq_decoder;
+ zmq_decoder = NULL;
+ }
+ if (NULL != list)
+ {
+ list->Remove(*this);
+ list = NULL;
+ }
+}
+
+bool zmq::norm_engine_t::NormRxStreamState::Init()
+{
+ in_sync = false;
+ skip_norm_sync = false;
+ if (NULL != zmq_decoder) delete zmq_decoder;
+ // Note "in_batch_size" comes from config.h
+ zmq_decoder = new (std::nothrow) v2_decoder_t (in_batch_size, max_msg_size);
+ alloc_assert (zmq_decoder);
+ if (NULL != zmq_decoder)
+ {
+ buffer_count = 0;
+ buffer_size = 0;
+ zmq_decoder->get_buffer(&buffer_ptr, &buffer_size);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+} // end zmq::norm_engine_t::NormRxStreamState::Init()
+
+// This decodes any pending data sitting in our stream decoder buffer
+// It returns 1 upon message completion, -1 on error, 1 on msg completion
+int zmq::norm_engine_t::NormRxStreamState::Decode()
+{
+ // If we have pending bytes to decode, process those first
+ while (buffer_count > 0)
+ {
+ // There's pending data for the decoder to decode
+ size_t processed = 0;
+
+ // This a bit of a kludgy approach used to weed
+ // out the NORM ZMQ message transport "syncFlag" byte
+ // from the ZMQ message stream being decoded (but it works!)
+ if (skip_norm_sync)
+ {
+ buffer_ptr++;
+ buffer_count--;
+ skip_norm_sync = false;
+ }
+
+ int rc = zmq_decoder->decode(buffer_ptr, buffer_count, processed);
+ buffer_ptr += processed;
+ buffer_count -= processed;
+ switch (rc)
+ {
+ case 1:
+ // msg completed
+ if (0 == buffer_count)
+ {
+ buffer_size = 0;
+ zmq_decoder->get_buffer(&buffer_ptr, &buffer_size);
+ }
+ skip_norm_sync = true;
+ return 1;
+ case -1:
+ // decoder error (reset decoder and state variables)
+ in_sync = false;
+ skip_norm_sync = false; // will get consumed by norm sync check
+ Init();
+ break;
+
+ case 0:
+ // need more data, keep decoding until buffer exhausted
+ break;
+ }
+ }
+ // Reset buffer pointer/count for next read
+ buffer_count = 0;
+ buffer_size = 0;
+ zmq_decoder->get_buffer(&buffer_ptr, &buffer_size);
+ return 0; // need more data
+
+} // end zmq::norm_engine_t::NormRxStreamState::Decode()
+
+zmq::norm_engine_t::NormRxStreamState::List::List()
+ : head(NULL), tail(NULL)
+{
+}
+
+zmq::norm_engine_t::NormRxStreamState::List::~List()
+{
+ Destroy();
+}
+
+void zmq::norm_engine_t::NormRxStreamState::List::Destroy()
+{
+ NormRxStreamState* item = head;
+ while (NULL != item)
+ {
+ Remove(*item);
+ delete item;
+ item = head;
+ }
+} // end zmq::norm_engine_t::NormRxStreamState::List::Destroy()
+
+void zmq::norm_engine_t::NormRxStreamState::List::Append(NormRxStreamState& item)
+{
+ item.prev = tail;
+ if (NULL != tail)
+ tail->next = &item;
+ else
+ head = &item;
+ item.next = NULL;
+ tail = &item;
+ item.list = this;
+} // end zmq::norm_engine_t::NormRxStreamState::List::Append()
+
+void zmq::norm_engine_t::NormRxStreamState::List::Remove(NormRxStreamState& item)
+{
+ if (NULL != item.prev)
+ item.prev->next = item.next;
+ else
+ head = item.next;
+ if (NULL != item.next)
+ item.next ->prev = item.prev;
+ else
+ tail = item.prev;
+ item.prev = item.next = NULL;
+ item.list = NULL;
+} // end zmq::norm_engine_t::NormRxStreamState::List::Remove()
+
+zmq::norm_engine_t::NormRxStreamState::List::Iterator::Iterator(const List& list)
+ : next_item(list.head)
+{
+}
+
+zmq::norm_engine_t::NormRxStreamState* zmq::norm_engine_t::NormRxStreamState::List::Iterator::GetNextItem()
+{
+ NormRxStreamState* nextItem = next_item;
+ if (NULL != nextItem) next_item = nextItem->next;
+ return nextItem;
+} // end zmq::norm_engine_t::NormRxStreamState::List::Iterator::GetNextItem()
+
+
+#endif // ZMQ_HAVE_NORM
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/norm_engine.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/norm_engine.hpp
new file mode 100644
index 00000000..72542e19
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/norm_engine.hpp
@@ -0,0 +1,188 @@
+
+#ifndef __ZMQ_NORM_ENGINE_HPP_INCLUDED__
+#define __ZMQ_NORM_ENGINE_HPP_INCLUDED__
+
+#if defined ZMQ_HAVE_NORM
+
+#include "io_object.hpp"
+#include "i_engine.hpp"
+#include "options.hpp"
+#include "v2_decoder.hpp"
+#include "v2_encoder.hpp"
+
+#include <normApi.h>
+
+namespace zmq
+{
+ class io_thread_t;
+ class session_base_t;
+
+ class norm_engine_t : public io_object_t, public i_engine
+ {
+ public:
+ norm_engine_t (zmq::io_thread_t *parent_, const options_t &options_);
+ ~norm_engine_t ();
+
+ // create NORM instance, session, etc
+ int init(const char* network_, bool send, bool recv);
+ void shutdown();
+
+ // i_engine interface implementation.
+ // Plug the engine to the session.
+ virtual void plug (zmq::io_thread_t *io_thread_,
+ class session_base_t *session_);
+
+ // Terminate and deallocate the engine. Note that 'detached'
+ // events are not fired on termination.
+ virtual void terminate ();
+
+ // This method is called by the session to signalise that more
+ // messages can be written to the pipe.
+ virtual void restart_input ();
+
+ // This method is called by the session to signalise that there
+ // are messages to send available.
+ virtual void restart_output ();
+
+ virtual void zap_msg_available () {};
+
+ // i_poll_events interface implementation.
+ // (we only need in_event() for NormEvent notification)
+ // (i.e., don't have any output events or timers (yet))
+ void in_event ();
+
+ private:
+ void unplug();
+ void send_data();
+ void recv_data(NormObjectHandle stream);
+
+
+ enum {BUFFER_SIZE = 2048};
+
+ // Used to keep track of streams from multiple senders
+ class NormRxStreamState
+ {
+ public:
+ NormRxStreamState(NormObjectHandle normStream,
+ int64_t maxMsgSize);
+ ~NormRxStreamState();
+
+ NormObjectHandle GetStreamHandle() const
+ {return norm_stream;}
+
+ bool Init();
+
+ void SetRxReady(bool state)
+ {rx_ready = state;}
+ bool IsRxReady() const
+ {return rx_ready;}
+
+ void SetSync(bool state)
+ {in_sync = state;}
+ bool InSync() const
+ {return in_sync;}
+
+ // These are used to feed data to decoder
+ // and its underlying "msg" buffer
+ char* AccessBuffer()
+ {return (char*)(buffer_ptr + buffer_count);}
+ size_t GetBytesNeeded() const
+ {return (buffer_size - buffer_count);}
+ void IncrementBufferCount(size_t count)
+ {buffer_count += count;}
+ msg_t* AccessMsg()
+ {return zmq_decoder->msg();}
+ // This invokes the decoder "decode" method
+ // returning 0 if more data is needed,
+ // 1 if the message is complete, If an error
+ // occurs the 'sync' is dropped and the
+ // decoder re-initialized
+ int Decode();
+
+ class List
+ {
+ public:
+ List();
+ ~List();
+
+ void Append(NormRxStreamState& item);
+ void Remove(NormRxStreamState& item);
+
+ bool IsEmpty() const
+ {return (NULL == head);}
+
+ void Destroy();
+
+ class Iterator
+ {
+ public:
+ Iterator(const List& list);
+ NormRxStreamState* GetNextItem();
+ private:
+ NormRxStreamState* next_item;
+ };
+ friend class Iterator;
+
+ private:
+ NormRxStreamState* head;
+ NormRxStreamState* tail;
+
+ }; // end class zmq::norm_engine_t::NormRxStreamState::List
+
+ friend class List;
+
+ List* AccessList()
+ {return list;}
+
+
+ private:
+ NormObjectHandle norm_stream;
+ int64_t max_msg_size;
+ bool in_sync;
+ bool rx_ready;
+ v2_decoder_t* zmq_decoder;
+ bool skip_norm_sync;
+ unsigned char* buffer_ptr;
+ size_t buffer_size;
+ size_t buffer_count;
+
+ NormRxStreamState* prev;
+ NormRxStreamState* next;
+ NormRxStreamState::List* list;
+
+ }; // end class zmq::norm_engine_t::NormRxStreamState
+
+ session_base_t* zmq_session;
+ options_t options;
+ NormInstanceHandle norm_instance;
+ handle_t norm_descriptor_handle;
+ NormSessionHandle norm_session;
+ bool is_sender;
+ bool is_receiver;
+ // Sender state
+ msg_t tx_msg;
+ v2_encoder_t zmq_encoder; // for tx messages (we use v2 for now)
+ NormObjectHandle norm_tx_stream;
+ bool tx_first_msg;
+ bool tx_more_bit;
+ bool zmq_output_ready; // zmq has msg(s) to send
+ bool norm_tx_ready; // norm has tx queue vacancy
+ // tbd - maybe don't need buffer if can access zmq message buffer directly?
+ char tx_buffer[BUFFER_SIZE];
+ unsigned int tx_index;
+ unsigned int tx_len;
+
+ // Receiver state
+ // Lists of norm rx streams from remote senders
+ bool zmq_input_ready; // zmq ready to receive msg(s)
+ NormRxStreamState::List rx_pending_list; // rx streams waiting for data reception
+ NormRxStreamState::List rx_ready_list; // rx streams ready for NormStreamRead()
+ NormRxStreamState::List msg_ready_list; // rx streams w/ msg ready for push to zmq
+
+
+ }; // end class norm_engine_t
+}
+
+#endif // ZMQ_HAVE_NORM
+
+#endif // !__ZMQ_NORM_ENGINE_HPP_INCLUDED__
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/null_mechanism.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/null_mechanism.cpp
new file mode 100644
index 00000000..d9157e20
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/null_mechanism.cpp
@@ -0,0 +1,358 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "err.hpp"
+#include "msg.hpp"
+#include "session_base.hpp"
+#include "wire.hpp"
+#include "null_mechanism.hpp"
+
+zmq::null_mechanism_t::null_mechanism_t (session_base_t *session_,
+ const std::string &peer_address_,
+ const options_t &options_) :
+ mechanism_t (options_),
+ session (session_),
+ peer_address (peer_address_),
+ ready_command_sent (false),
+ error_command_sent (false),
+ ready_command_received (false),
+ error_command_received (false),
+ zap_connected (false),
+ zap_request_sent (false),
+ zap_reply_received (false)
+{
+ // NULL mechanism only uses ZAP if there's a domain defined
+ // This prevents ZAP requests on naive sockets
+ if (options.zap_domain.size () > 0
+ && session->zap_connect () == 0)
+ zap_connected = true;
+}
+
+zmq::null_mechanism_t::~null_mechanism_t ()
+{
+}
+
+int zmq::null_mechanism_t::next_handshake_command (msg_t *msg_)
+{
+ if (ready_command_sent || error_command_sent) {
+ errno = EAGAIN;
+ return -1;
+ }
+ if (zap_connected && !zap_reply_received) {
+ if (zap_request_sent) {
+ errno = EAGAIN;
+ return -1;
+ }
+ send_zap_request ();
+ zap_request_sent = true;
+ const int rc = receive_and_process_zap_reply ();
+ if (rc != 0)
+ return -1;
+ zap_reply_received = true;
+ }
+
+ if (zap_reply_received
+ && strncmp (status_code, "200", sizeof status_code) != 0) {
+ const int rc = msg_->init_size (6 + 1 + sizeof status_code);
+ zmq_assert (rc == 0);
+ unsigned char *msg_data =
+ static_cast <unsigned char *> (msg_->data ());
+ memcpy (msg_data, "\5ERROR", 6);
+ msg_data [6] = sizeof status_code;
+ memcpy (msg_data + 7, status_code, sizeof status_code);
+ error_command_sent = true;
+ return 0;
+ }
+
+ unsigned char *const command_buffer = (unsigned char *) malloc (512);
+ alloc_assert (command_buffer);
+
+ unsigned char *ptr = command_buffer;
+
+ // Add mechanism string
+ memcpy (ptr, "\5READY", 6);
+ ptr += 6;
+
+ // Add socket type property
+ const char *socket_type = socket_type_string (options.type);
+ ptr += add_property (ptr, "Socket-Type", socket_type, strlen (socket_type));
+
+ // Add identity property
+ if (options.type == ZMQ_REQ
+ || options.type == ZMQ_DEALER
+ || options.type == ZMQ_ROUTER)
+ ptr += add_property (ptr, "Identity", options.identity, options.identity_size);
+
+ const size_t command_size = ptr - command_buffer;
+ const int rc = msg_->init_size (command_size);
+ errno_assert (rc == 0);
+ memcpy (msg_->data (), command_buffer, command_size);
+ free (command_buffer);
+
+ ready_command_sent = true;
+
+ return 0;
+}
+
+int zmq::null_mechanism_t::process_handshake_command (msg_t *msg_)
+{
+ if (ready_command_received || error_command_received) {
+ // Temporary support for security debugging
+ puts ("NULL I: client sent invalid NULL handshake (duplicate READY)");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const unsigned char *cmd_data =
+ static_cast <unsigned char *> (msg_->data ());
+ const size_t data_size = msg_->size ();
+
+ int rc = 0;
+ if (data_size >= 6 && !memcmp (cmd_data, "\5READY", 6))
+ rc = process_ready_command (cmd_data, data_size);
+ else
+ if (data_size >= 6 && !memcmp (cmd_data, "\5ERROR", 6))
+ rc = process_error_command (cmd_data, data_size);
+ else {
+ // Temporary support for security debugging
+ puts ("NULL I: client sent invalid NULL handshake (not READY)");
+ errno = EPROTO;
+ rc = -1;
+ }
+
+ if (rc == 0) {
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ }
+ return rc;
+}
+
+int zmq::null_mechanism_t::process_ready_command (
+ const unsigned char *cmd_data, size_t data_size)
+{
+ ready_command_received = true;
+ return parse_metadata (cmd_data + 6, data_size - 6);
+}
+
+int zmq::null_mechanism_t::process_error_command (
+ const unsigned char *cmd_data, size_t data_size)
+{
+ if (data_size < 7) {
+ errno = EPROTO;
+ return -1;
+ }
+ const size_t error_reason_len = static_cast <size_t> (cmd_data [6]);
+ if (error_reason_len > data_size - 7) {
+ errno = EPROTO;
+ return -1;
+ }
+ error_command_received = true;
+ return 0;
+}
+
+int zmq::null_mechanism_t::zap_msg_available ()
+{
+ if (zap_reply_received) {
+ errno = EFSM;
+ return -1;
+ }
+ const int rc = receive_and_process_zap_reply ();
+ if (rc == 0)
+ zap_reply_received = true;
+ return rc;
+}
+
+zmq::mechanism_t::status_t zmq::null_mechanism_t::status () const
+{
+ const bool command_sent =
+ ready_command_sent || error_command_sent;
+ const bool command_received =
+ ready_command_received || error_command_received;
+
+ if (ready_command_sent && ready_command_received)
+ return ready;
+ else
+ if (command_sent && command_received)
+ return error;
+ else
+ return handshaking;
+}
+
+void zmq::null_mechanism_t::send_zap_request ()
+{
+ int rc;
+ msg_t msg;
+
+ // Address delimiter frame
+ rc = msg.init ();
+ errno_assert (rc == 0);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Version frame
+ rc = msg.init_size (3);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "1.0", 3);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Request id frame
+ rc = msg.init_size (1);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "1", 1);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Domain frame
+ rc = msg.init_size (options.zap_domain.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), options.zap_domain.c_str (), options.zap_domain.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Address frame
+ rc = msg.init_size (peer_address.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), peer_address.c_str (), peer_address.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Identity frame
+ rc = msg.init_size (options.identity_size);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), options.identity, options.identity_size);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Mechanism frame
+ rc = msg.init_size (4);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "NULL", 4);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+}
+
+int zmq::null_mechanism_t::receive_and_process_zap_reply ()
+{
+ int rc = 0;
+ msg_t msg [7]; // ZAP reply consists of 7 frames
+
+ // Initialize all reply frames
+ for (int i = 0; i < 7; i++) {
+ rc = msg [i].init ();
+ errno_assert (rc == 0);
+ }
+
+ for (int i = 0; i < 7; i++) {
+ rc = session->read_zap_msg (&msg [i]);
+ if (rc == -1)
+ break;
+ if ((msg [i].flags () & msg_t::more) == (i < 6? 0: msg_t::more)) {
+ // Temporary support for security debugging
+ puts ("NULL I: ZAP handler sent incomplete reply message");
+ errno = EPROTO;
+ rc = -1;
+ break;
+ }
+ }
+
+ if (rc != 0)
+ goto error;
+
+ // Address delimiter frame
+ if (msg [0].size () > 0) {
+ // Temporary support for security debugging
+ puts ("NULL I: ZAP handler sent malformed reply message");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Version frame
+ if (msg [1].size () != 3 || memcmp (msg [1].data (), "1.0", 3)) {
+ // Temporary support for security debugging
+ puts ("NULL I: ZAP handler sent bad version number");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Request id frame
+ if (msg [2].size () != 1 || memcmp (msg [2].data (), "1", 1)) {
+ // Temporary support for security debugging
+ puts ("NULL I: ZAP handler sent bad request ID");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Status code frame
+ if (msg [3].size () != 3) {
+ // Temporary support for security debugging
+ puts ("NULL I: ZAP handler rejected client authentication");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Save status code
+ memcpy (status_code, msg [3].data (), sizeof status_code);
+
+ // Save user id
+ set_user_id (msg [5].data (), msg [5].size ());
+
+ // Process metadata frame
+ rc = parse_metadata (static_cast <const unsigned char*> (msg [6].data ()),
+ msg [6].size (), true);
+
+error:
+ for (int i = 0; i < 7; i++) {
+ const int rc2 = msg [i].close ();
+ errno_assert (rc2 == 0);
+ }
+
+ return rc;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/null_mechanism.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/null_mechanism.hpp
new file mode 100644
index 00000000..ff1eb96d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/null_mechanism.hpp
@@ -0,0 +1,84 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_NULL_MECHANISM_HPP_INCLUDED__
+#define __ZMQ_NULL_MECHANISM_HPP_INCLUDED__
+
+#include "mechanism.hpp"
+#include "options.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+ class session_base_t;
+
+ class null_mechanism_t : public mechanism_t
+ {
+ public:
+
+ null_mechanism_t (session_base_t *session_,
+ const std::string &peer_address,
+ const options_t &options_);
+ virtual ~null_mechanism_t ();
+
+ // mechanism implementation
+ virtual int next_handshake_command (msg_t *msg_);
+ virtual int process_handshake_command (msg_t *msg_);
+ virtual int zap_msg_available ();
+ virtual status_t status () const;
+
+ private:
+
+ session_base_t * const session;
+
+ char status_code [3];
+
+ const std::string peer_address;
+
+ bool ready_command_sent;
+ bool error_command_sent;
+ bool ready_command_received;
+ bool error_command_received;
+ bool zap_connected;
+ bool zap_request_sent;
+ bool zap_reply_received;
+
+ int process_ready_command (
+ const unsigned char *cmd_data, size_t data_size);
+ int process_error_command (
+ const unsigned char *cmd_data, size_t data_size);
+
+ void send_zap_request ();
+ int receive_and_process_zap_reply ();
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/object.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/object.cpp
new file mode 100644
index 00000000..ea4f7d56
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/object.cpp
@@ -0,0 +1,437 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+#include <stdarg.h>
+
+#include "object.hpp"
+#include "ctx.hpp"
+#include "err.hpp"
+#include "pipe.hpp"
+#include "io_thread.hpp"
+#include "session_base.hpp"
+#include "socket_base.hpp"
+
+zmq::object_t::object_t (ctx_t *ctx_, uint32_t tid_) :
+ ctx (ctx_),
+ tid (tid_)
+{
+}
+
+zmq::object_t::object_t (object_t *parent_) :
+ ctx (parent_->ctx),
+ tid (parent_->tid)
+{
+}
+
+zmq::object_t::~object_t ()
+{
+}
+
+uint32_t zmq::object_t::get_tid ()
+{
+ return tid;
+}
+
+void zmq::object_t::set_tid(uint32_t id)
+{
+ tid = id;
+}
+
+zmq::ctx_t *zmq::object_t::get_ctx ()
+{
+ return ctx;
+}
+
+void zmq::object_t::process_command (command_t &cmd_)
+{
+ switch (cmd_.type) {
+
+ case command_t::activate_read:
+ process_activate_read ();
+ break;
+
+ case command_t::activate_write:
+ process_activate_write (cmd_.args.activate_write.msgs_read);
+ break;
+
+ case command_t::stop:
+ process_stop ();
+ break;
+
+ case command_t::plug:
+ process_plug ();
+ process_seqnum ();
+ break;
+
+ case command_t::own:
+ process_own (cmd_.args.own.object);
+ process_seqnum ();
+ break;
+
+ case command_t::attach:
+ process_attach (cmd_.args.attach.engine);
+ process_seqnum ();
+ break;
+
+ case command_t::bind:
+ process_bind (cmd_.args.bind.pipe);
+ process_seqnum ();
+ break;
+
+ case command_t::hiccup:
+ process_hiccup (cmd_.args.hiccup.pipe);
+ break;
+
+ case command_t::pipe_term:
+ process_pipe_term ();
+ break;
+
+ case command_t::pipe_term_ack:
+ process_pipe_term_ack ();
+ break;
+
+ case command_t::term_req:
+ process_term_req (cmd_.args.term_req.object);
+ break;
+
+ case command_t::term:
+ process_term (cmd_.args.term.linger);
+ break;
+
+ case command_t::term_ack:
+ process_term_ack ();
+ break;
+
+ case command_t::reap:
+ process_reap (cmd_.args.reap.socket);
+ break;
+
+ case command_t::reaped:
+ process_reaped ();
+ break;
+
+ case command_t::inproc_connected:
+ process_seqnum ();
+ break;
+
+ case command_t::done:
+ default:
+ zmq_assert (false);
+ }
+}
+
+int zmq::object_t::register_endpoint (const char *addr_,
+ const endpoint_t &endpoint_)
+{
+ return ctx->register_endpoint (addr_, endpoint_);
+}
+
+int zmq::object_t::unregister_endpoint (
+ const std::string &addr_, socket_base_t *socket_)
+{
+ return ctx->unregister_endpoint (addr_, socket_);
+}
+
+void zmq::object_t::unregister_endpoints (socket_base_t *socket_)
+{
+ return ctx->unregister_endpoints (socket_);
+}
+
+zmq::endpoint_t zmq::object_t::find_endpoint (const char *addr_)
+{
+ return ctx->find_endpoint (addr_);
+}
+
+void zmq::object_t::pend_connection (const std::string &addr_,
+ const endpoint_t &endpoint_, pipe_t **pipes_)
+{
+ ctx->pend_connection (addr_, endpoint_, pipes_);
+}
+
+void zmq::object_t::connect_pending (const char *addr_, zmq::socket_base_t *bind_socket_)
+{
+ return ctx->connect_pending(addr_, bind_socket_);
+}
+
+void zmq::object_t::destroy_socket (socket_base_t *socket_)
+{
+ ctx->destroy_socket (socket_);
+}
+
+zmq::io_thread_t *zmq::object_t::choose_io_thread (uint64_t affinity_)
+{
+ return ctx->choose_io_thread (affinity_);
+}
+
+void zmq::object_t::send_stop ()
+{
+ // 'stop' command goes always from administrative thread to
+ // the current object.
+ command_t cmd;
+ cmd.destination = this;
+ cmd.type = command_t::stop;
+ ctx->send_command (tid, cmd);
+}
+
+void zmq::object_t::send_plug (own_t *destination_, bool inc_seqnum_)
+{
+ if (inc_seqnum_)
+ destination_->inc_seqnum ();
+
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::plug;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_own (own_t *destination_, own_t *object_)
+{
+ destination_->inc_seqnum ();
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::own;
+ cmd.args.own.object = object_;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_attach (session_base_t *destination_,
+ i_engine *engine_, bool inc_seqnum_)
+{
+ if (inc_seqnum_)
+ destination_->inc_seqnum ();
+
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::attach;
+ cmd.args.attach.engine = engine_;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_bind (own_t *destination_, pipe_t *pipe_,
+ bool inc_seqnum_)
+{
+ if (inc_seqnum_)
+ destination_->inc_seqnum ();
+
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::bind;
+ cmd.args.bind.pipe = pipe_;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_activate_read (pipe_t *destination_)
+{
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::activate_read;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_activate_write (pipe_t *destination_,
+ uint64_t msgs_read_)
+{
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::activate_write;
+ cmd.args.activate_write.msgs_read = msgs_read_;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_hiccup (pipe_t *destination_, void *pipe_)
+{
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::hiccup;
+ cmd.args.hiccup.pipe = pipe_;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_pipe_term (pipe_t *destination_)
+{
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::pipe_term;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_pipe_term_ack (pipe_t *destination_)
+{
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::pipe_term_ack;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_term_req (own_t *destination_,
+ own_t *object_)
+{
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::term_req;
+ cmd.args.term_req.object = object_;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_term (own_t *destination_, int linger_)
+{
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::term;
+ cmd.args.term.linger = linger_;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_term_ack (own_t *destination_)
+{
+ command_t cmd;
+ cmd.destination = destination_;
+ cmd.type = command_t::term_ack;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_reap (class socket_base_t *socket_)
+{
+ command_t cmd;
+ cmd.destination = ctx->get_reaper ();
+ cmd.type = command_t::reap;
+ cmd.args.reap.socket = socket_;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_reaped ()
+{
+ command_t cmd;
+ cmd.destination = ctx->get_reaper ();
+ cmd.type = command_t::reaped;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_inproc_connected (zmq::socket_base_t *socket_)
+{
+ command_t cmd;
+ cmd.destination = socket_;
+ cmd.type = command_t::inproc_connected;
+ send_command (cmd);
+}
+
+void zmq::object_t::send_done ()
+{
+ command_t cmd;
+ cmd.destination = NULL;
+ cmd.type = command_t::done;
+ ctx->send_command (ctx_t::term_tid, cmd);
+}
+
+void zmq::object_t::process_stop ()
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_plug ()
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_own (own_t *)
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_attach (i_engine *)
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_bind (pipe_t *)
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_activate_read ()
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_activate_write (uint64_t)
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_hiccup (void *)
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_pipe_term ()
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_pipe_term_ack ()
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_term_req (own_t *)
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_term (int)
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_term_ack ()
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_reap (class socket_base_t *)
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_reaped ()
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::process_seqnum ()
+{
+ zmq_assert (false);
+}
+
+void zmq::object_t::send_command (command_t &cmd_)
+{
+ ctx->send_command (cmd_.destination->get_tid (), cmd_);
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/object.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/object.hpp
new file mode 100644
index 00000000..73e5a9e2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/object.hpp
@@ -0,0 +1,152 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_OBJECT_HPP_INCLUDED__
+#define __ZMQ_OBJECT_HPP_INCLUDED__
+
+#include <string>
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ struct i_engine;
+ struct endpoint_t;
+ struct pending_connection_t;
+ struct command_t;
+ class ctx_t;
+ class pipe_t;
+ class socket_base_t;
+ class session_base_t;
+ class io_thread_t;
+ class own_t;
+
+ // Base class for all objects that participate in inter-thread
+ // communication.
+
+ class object_t
+ {
+ public:
+
+ object_t (zmq::ctx_t *ctx_, uint32_t tid_);
+ object_t (object_t *parent_);
+ virtual ~object_t ();
+
+ uint32_t get_tid ();
+ void set_tid(uint32_t id);
+ ctx_t *get_ctx ();
+ void process_command (zmq::command_t &cmd_);
+ void send_inproc_connected (zmq::socket_base_t *socket_);
+ void send_bind (zmq::own_t *destination_, zmq::pipe_t *pipe_, bool inc_seqnum_ = true);
+
+ protected:
+
+ // Using following function, socket is able to access global
+ // repository of inproc endpoints.
+ int register_endpoint (const char *addr_,
+ const zmq::endpoint_t &endpoint_);
+ int unregister_endpoint (
+ const std::string &addr_, socket_base_t *socket_);
+ void unregister_endpoints (zmq::socket_base_t *socket_);
+ zmq::endpoint_t find_endpoint (const char *addr_);
+ void pend_connection (const std::string &addr_,
+ const endpoint_t &endpoint, pipe_t **pipes_);
+ void connect_pending (const char *addr_, zmq::socket_base_t *bind_socket_);
+
+ void destroy_socket (zmq::socket_base_t *socket_);
+
+ // Logs an message.
+ void log (const char *format_, ...);
+
+ // Chooses least loaded I/O thread.
+ zmq::io_thread_t *choose_io_thread (uint64_t affinity_);
+
+ // Derived object can use these functions to send commands
+ // to other objects.
+ void send_stop ();
+ void send_plug (zmq::own_t *destination_,
+ bool inc_seqnum_ = true);
+ void send_own (zmq::own_t *destination_,
+ zmq::own_t *object_);
+ void send_attach (zmq::session_base_t *destination_,
+ zmq::i_engine *engine_, bool inc_seqnum_ = true);
+ void send_activate_read (zmq::pipe_t *destination_);
+ void send_activate_write (zmq::pipe_t *destination_,
+ uint64_t msgs_read_);
+ void send_hiccup (zmq::pipe_t *destination_, void *pipe_);
+ void send_pipe_term (zmq::pipe_t *destination_);
+ void send_pipe_term_ack (zmq::pipe_t *destination_);
+ void send_term_req (zmq::own_t *destination_,
+ zmq::own_t *object_);
+ void send_term (zmq::own_t *destination_, int linger_);
+ void send_term_ack (zmq::own_t *destination_);
+ void send_reap (zmq::socket_base_t *socket_);
+ void send_reaped ();
+ void send_done ();
+
+ // These handlers can be overrided by the derived objects. They are
+ // called when command arrives from another thread.
+ virtual void process_stop ();
+ virtual void process_plug ();
+ virtual void process_own (zmq::own_t *object_);
+ virtual void process_attach (zmq::i_engine *engine_);
+ virtual void process_bind (zmq::pipe_t *pipe_);
+ virtual void process_activate_read ();
+ virtual void process_activate_write (uint64_t msgs_read_);
+ virtual void process_hiccup (void *pipe_);
+ virtual void process_pipe_term ();
+ virtual void process_pipe_term_ack ();
+ virtual void process_term_req (zmq::own_t *object_);
+ virtual void process_term (int linger_);
+ virtual void process_term_ack ();
+ virtual void process_reap (zmq::socket_base_t *socket_);
+ virtual void process_reaped ();
+
+ // Special handler called after a command that requires a seqnum
+ // was processed. The implementation should catch up with its counter
+ // of processed commands here.
+ virtual void process_seqnum ();
+
+ private:
+
+ // Context provides access to the global state.
+ zmq::ctx_t *ctx;
+
+ // Thread ID of the thread the object belongs to.
+ uint32_t tid;
+
+ void send_command (command_t &cmd_);
+
+ object_t (const object_t&);
+ const object_t &operator = (const object_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/options.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/options.cpp
new file mode 100644
index 00000000..ea4f74c9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/options.cpp
@@ -0,0 +1,864 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+#include "options.hpp"
+#include "err.hpp"
+#include "../include/zmq_utils.h"
+
+zmq::options_t::options_t () :
+ sndhwm (1000),
+ rcvhwm (1000),
+ affinity (0),
+ identity_size (0),
+ rate (100),
+ recovery_ivl (10000),
+ multicast_hops (1),
+ sndbuf (0),
+ rcvbuf (0),
+ tos (0),
+ type (-1),
+ linger (-1),
+ reconnect_ivl (100),
+ reconnect_ivl_max (0),
+ backlog (100),
+ maxmsgsize (-1),
+ rcvtimeo (-1),
+ sndtimeo (-1),
+ ipv6 (0),
+ immediate (0),
+ filter (false),
+ recv_identity (false),
+ raw_sock (false),
+ tcp_keepalive (-1),
+ tcp_keepalive_cnt (-1),
+ tcp_keepalive_idle (-1),
+ tcp_keepalive_intvl (-1),
+ mechanism (ZMQ_NULL),
+ as_server (0),
+ gss_plaintext (false),
+ socket_id (0),
+ conflate (false),
+ handshake_ivl (30000)
+{
+}
+
+int zmq::options_t::setsockopt (int option_, const void *optval_,
+ size_t optvallen_)
+{
+ bool is_int = (optvallen_ == sizeof (int));
+ int value = is_int? *((int *) optval_): 0;
+#if defined (ZMQ_ACT_MILITANT)
+ bool malformed = true; // Did caller pass a bad option value?
+#endif
+
+ switch (option_) {
+ case ZMQ_SNDHWM:
+ if (is_int && value >= 0) {
+ sndhwm = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RCVHWM:
+ if (is_int && value >= 0) {
+ rcvhwm = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_AFFINITY:
+ if (optvallen_ == sizeof (uint64_t)) {
+ affinity = *((uint64_t*) optval_);
+ return 0;
+ }
+ break;
+
+ case ZMQ_IDENTITY:
+ // Identity is any binary string from 1 to 255 octets
+ if (optvallen_ > 0 && optvallen_ < 256) {
+ identity_size = optvallen_;
+ memcpy (identity, optval_, identity_size);
+ return 0;
+ }
+ break;
+
+ case ZMQ_RATE:
+ if (is_int && value > 0) {
+ rate = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RECOVERY_IVL:
+ if (is_int && value >= 0) {
+ recovery_ivl = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_SNDBUF:
+ if (is_int && value >= 0) {
+ sndbuf = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RCVBUF:
+ if (is_int && value >= 0) {
+ rcvbuf = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TOS:
+ if (is_int && value >= 0) {
+ tos = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_LINGER:
+ if (is_int && value >= -1) {
+ linger = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RECONNECT_IVL:
+ if (is_int && value >= -1) {
+ reconnect_ivl = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RECONNECT_IVL_MAX:
+ if (is_int && value >= 0) {
+ reconnect_ivl_max = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_BACKLOG:
+ if (is_int && value >= 0) {
+ backlog = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_MAXMSGSIZE:
+ if (optvallen_ == sizeof (int64_t)) {
+ maxmsgsize = *((int64_t *) optval_);
+ return 0;
+ }
+ break;
+
+ case ZMQ_MULTICAST_HOPS:
+ if (is_int && value > 0) {
+ multicast_hops = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RCVTIMEO:
+ if (is_int && value >= -1) {
+ rcvtimeo = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_SNDTIMEO:
+ if (is_int && value >= -1) {
+ sndtimeo = value;
+ return 0;
+ }
+ break;
+
+ /* Deprecated in favor of ZMQ_IPV6 */
+ case ZMQ_IPV4ONLY:
+ if (is_int && (value == 0 || value == 1)) {
+ ipv6 = (value == 0);
+ return 0;
+ }
+ break;
+
+ /* To replace the somewhat surprising IPV4ONLY */
+ case ZMQ_IPV6:
+ if (is_int && (value == 0 || value == 1)) {
+ ipv6 = (value != 0);
+ return 0;
+ }
+ break;
+
+ case ZMQ_SOCKS_PROXY:
+ if (optval_ == NULL && optvallen_ == 0) {
+ socks_proxy_address.clear ();
+ return 0;
+ }
+ else
+ if (optval_ != NULL && optvallen_ > 0 ) {
+ socks_proxy_address =
+ std::string ((const char *) optval_, optvallen_);
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_KEEPALIVE:
+ if (is_int && (value == -1 || value == 0 || value == 1)) {
+ tcp_keepalive = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_KEEPALIVE_CNT:
+ if (is_int && (value == -1 || value >= 0)) {
+ tcp_keepalive_cnt = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_KEEPALIVE_IDLE:
+ if (is_int && (value == -1 || value >= 0)) {
+ tcp_keepalive_idle = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_KEEPALIVE_INTVL:
+ if (is_int && (value == -1 || value >= 0)) {
+ tcp_keepalive_intvl = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_IMMEDIATE:
+ if (is_int && (value == 0 || value == 1)) {
+ immediate = value;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_ACCEPT_FILTER:
+ if (optvallen_ == 0 && optval_ == NULL) {
+ tcp_accept_filters.clear ();
+ return 0;
+ }
+ else
+ if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL && *((const char*) optval_) != 0) {
+ std::string filter_str ((const char *) optval_, optvallen_);
+ tcp_address_mask_t mask;
+ int rc = mask.resolve (filter_str.c_str (), ipv6);
+ if (rc == 0) {
+ tcp_accept_filters.push_back (mask);
+ return 0;
+ }
+ }
+ break;
+
+# if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
+ case ZMQ_IPC_FILTER_UID:
+ if (optvallen_ == 0 && optval_ == NULL) {
+ ipc_uid_accept_filters.clear ();
+ return 0;
+ }
+ else
+ if (optvallen_ == sizeof (uid_t) && optval_ != NULL) {
+ ipc_uid_accept_filters.insert (*((uid_t *) optval_));
+ return 0;
+ }
+ break;
+
+ case ZMQ_IPC_FILTER_GID:
+ if (optvallen_ == 0 && optval_ == NULL) {
+ ipc_gid_accept_filters.clear ();
+ return 0;
+ }
+ else
+ if (optvallen_ == sizeof (gid_t) && optval_ != NULL) {
+ ipc_gid_accept_filters.insert (*((gid_t *) optval_));
+ return 0;
+ }
+ break;
+# endif
+
+# if defined ZMQ_HAVE_SO_PEERCRED
+ case ZMQ_IPC_FILTER_PID:
+ if (optvallen_ == 0 && optval_ == NULL) {
+ ipc_pid_accept_filters.clear ();
+ return 0;
+ }
+ else
+ if (optvallen_ == sizeof (pid_t) && optval_ != NULL) {
+ ipc_pid_accept_filters.insert (*((pid_t *) optval_));
+ return 0;
+ }
+ break;
+# endif
+
+ case ZMQ_PLAIN_SERVER:
+ if (is_int && (value == 0 || value == 1)) {
+ as_server = value;
+ mechanism = value? ZMQ_PLAIN: ZMQ_NULL;
+ return 0;
+ }
+ break;
+
+ case ZMQ_PLAIN_USERNAME:
+ if (optvallen_ == 0 && optval_ == NULL) {
+ mechanism = ZMQ_NULL;
+ return 0;
+ }
+ else
+ if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
+ plain_username.assign ((const char *) optval_, optvallen_);
+ as_server = 0;
+ mechanism = ZMQ_PLAIN;
+ return 0;
+ }
+ break;
+
+ case ZMQ_PLAIN_PASSWORD:
+ if (optvallen_ == 0 && optval_ == NULL) {
+ mechanism = ZMQ_NULL;
+ return 0;
+ }
+ else
+ if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
+ plain_password.assign ((const char *) optval_, optvallen_);
+ as_server = 0;
+ mechanism = ZMQ_PLAIN;
+ return 0;
+ }
+ break;
+
+ case ZMQ_ZAP_DOMAIN:
+ if (optvallen_ < 256) {
+ zap_domain.assign ((const char *) optval_, optvallen_);
+ return 0;
+ }
+ break;
+
+ // If libsodium isn't installed, these options provoke EINVAL
+# ifdef HAVE_LIBSODIUM
+ case ZMQ_CURVE_SERVER:
+ if (is_int && (value == 0 || value == 1)) {
+ as_server = value;
+ mechanism = value? ZMQ_CURVE: ZMQ_NULL;
+ return 0;
+ }
+ break;
+
+ case ZMQ_CURVE_PUBLICKEY:
+ // TODO: refactor repeated code for these three options
+ // into set_curve_key (destination, optval, optlen) method
+ // ==> set_curve_key (curve_public_key, optval_, optvallen_);
+ if (optvallen_ == CURVE_KEYSIZE) {
+ memcpy (curve_public_key, optval_, CURVE_KEYSIZE);
+ mechanism = ZMQ_CURVE;
+ return 0;
+ }
+ else
+ if (optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
+ zmq_z85_decode (curve_public_key, (char *) optval_);
+ mechanism = ZMQ_CURVE;
+ return 0;
+ }
+ else
+ // Deprecated, not symmetrical with zmq_getsockopt
+ if (optvallen_ == CURVE_KEYSIZE_Z85) {
+ char z85_key [41];
+ memcpy (z85_key, (char *) optval_, CURVE_KEYSIZE_Z85);
+ z85_key [CURVE_KEYSIZE_Z85] = 0;
+ zmq_z85_decode (curve_public_key, z85_key);
+ mechanism = ZMQ_CURVE;
+ return 0;
+ }
+ break;
+
+ case ZMQ_CURVE_SECRETKEY:
+ if (optvallen_ == CURVE_KEYSIZE) {
+ memcpy (curve_secret_key, optval_, CURVE_KEYSIZE);
+ mechanism = ZMQ_CURVE;
+ return 0;
+ }
+ else
+ if (optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
+ zmq_z85_decode (curve_secret_key, (char *) optval_);
+ mechanism = ZMQ_CURVE;
+ return 0;
+ }
+ else
+ // Deprecated, not symmetrical with zmq_getsockopt
+ if (optvallen_ == CURVE_KEYSIZE_Z85) {
+ char z85_key [41];
+ memcpy (z85_key, (char *) optval_, CURVE_KEYSIZE_Z85);
+ z85_key [CURVE_KEYSIZE_Z85] = 0;
+ zmq_z85_decode (curve_secret_key, z85_key);
+ mechanism = ZMQ_CURVE;
+ return 0;
+ }
+ break;
+
+ case ZMQ_CURVE_SERVERKEY:
+ if (optvallen_ == CURVE_KEYSIZE) {
+ memcpy (curve_server_key, optval_, CURVE_KEYSIZE);
+ mechanism = ZMQ_CURVE;
+ as_server = 0;
+ return 0;
+ }
+ else
+ if (optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
+ zmq_z85_decode (curve_server_key, (char *) optval_);
+ mechanism = ZMQ_CURVE;
+ as_server = 0;
+ return 0;
+ }
+ else
+ // Deprecated, not symmetrical with zmq_getsockopt
+ if (optvallen_ == CURVE_KEYSIZE_Z85) {
+ char z85_key [41];
+ memcpy (z85_key, (char *) optval_, CURVE_KEYSIZE_Z85);
+ z85_key [CURVE_KEYSIZE_Z85] = 0;
+ zmq_z85_decode (curve_server_key, z85_key);
+ mechanism = ZMQ_CURVE;
+ as_server = 0;
+ return 0;
+ }
+ break;
+# endif
+
+ case ZMQ_CONFLATE:
+ if (is_int && (value == 0 || value == 1)) {
+ conflate = (value != 0);
+ return 0;
+ }
+ break;
+
+ // If libgssapi isn't installed, these options provoke EINVAL
+# ifdef HAVE_LIBGSSAPI_KRB5
+ case ZMQ_GSSAPI_SERVER:
+ if (is_int && (value == 0 || value == 1)) {
+ as_server = value;
+ mechanism = ZMQ_GSSAPI;
+ return 0;
+ }
+ break;
+
+ case ZMQ_GSSAPI_PRINCIPAL:
+ if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
+ gss_principal.assign ((const char *) optval_, optvallen_);
+ mechanism = ZMQ_GSSAPI;
+ return 0;
+ }
+ break;
+
+ case ZMQ_GSSAPI_SERVICE_PRINCIPAL:
+ if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
+ gss_service_principal.assign ((const char *) optval_, optvallen_);
+ mechanism = ZMQ_GSSAPI;
+ as_server = 0;
+ return 0;
+ }
+ break;
+
+ case ZMQ_GSSAPI_PLAINTEXT:
+ if (is_int && (value == 0 || value == 1)) {
+ gss_plaintext = (value != 0);
+ return 0;
+ }
+ break;
+# endif
+
+ case ZMQ_HANDSHAKE_IVL:
+ if (is_int && value >= 0) {
+ handshake_ivl = value;
+ return 0;
+ }
+ break;
+
+ default:
+#if defined (ZMQ_ACT_MILITANT)
+ // There are valid scenarios for probing with unknown socket option
+ // values, e.g. to check if security is enabled or not. This will not
+ // provoke a militant assert. However, passing bad values to a valid
+ // socket option will, if ZMQ_ACT_MILITANT is defined.
+ malformed = false;
+#endif
+ break;
+ }
+#if defined (ZMQ_ACT_MILITANT)
+ // There is no valid use case for passing an error back to the application
+ // when it sent malformed arguments to a socket option. Use ./configure
+ // --with-militant to enable this checking.
+ if (malformed)
+ zmq_assert (false);
+#endif
+ errno = EINVAL;
+ return -1;
+}
+
+int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
+{
+ bool is_int = (*optvallen_ == sizeof (int));
+ int *value = (int *) optval_;
+#if defined (ZMQ_ACT_MILITANT)
+ bool malformed = true; // Did caller pass a bad option value?
+#endif
+
+ switch (option_) {
+ case ZMQ_SNDHWM:
+ if (is_int) {
+ *value = sndhwm;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RCVHWM:
+ if (is_int) {
+ *value = rcvhwm;
+ return 0;
+ }
+ break;
+
+ case ZMQ_AFFINITY:
+ if (*optvallen_ == sizeof (uint64_t)) {
+ *((uint64_t *) optval_) = affinity;
+ return 0;
+ }
+ break;
+
+ case ZMQ_IDENTITY:
+ if (*optvallen_ >= identity_size) {
+ memcpy (optval_, identity, identity_size);
+ *optvallen_ = identity_size;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RATE:
+ if (is_int) {
+ *value = rate;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RECOVERY_IVL:
+ if (is_int) {
+ *value = recovery_ivl;
+ return 0;
+ }
+ break;
+
+ case ZMQ_SNDBUF:
+ if (is_int) {
+ *value = sndbuf;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RCVBUF:
+ if (is_int) {
+ *value = rcvbuf;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TOS:
+ if (is_int) {
+ *value = tos;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TYPE:
+ if (is_int) {
+ *value = type;
+ return 0;
+ }
+ break;
+
+ case ZMQ_LINGER:
+ if (is_int) {
+ *value = linger;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RECONNECT_IVL:
+ if (is_int) {
+ *value = reconnect_ivl;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RECONNECT_IVL_MAX:
+ if (is_int) {
+ *value = reconnect_ivl_max;
+ return 0;
+ }
+ break;
+
+ case ZMQ_BACKLOG:
+ if (is_int) {
+ *value = backlog;
+ return 0;
+ }
+ break;
+
+ case ZMQ_MAXMSGSIZE:
+ if (*optvallen_ == sizeof (int64_t)) {
+ *((int64_t *) optval_) = maxmsgsize;
+ *optvallen_ = sizeof (int64_t);
+ return 0;
+ }
+ break;
+
+ case ZMQ_MULTICAST_HOPS:
+ if (is_int) {
+ *value = multicast_hops;
+ return 0;
+ }
+ break;
+
+ case ZMQ_RCVTIMEO:
+ if (is_int) {
+ *value = rcvtimeo;
+ return 0;
+ }
+ break;
+
+ case ZMQ_SNDTIMEO:
+ if (is_int) {
+ *value = sndtimeo;
+ return 0;
+ }
+ break;
+
+ case ZMQ_IPV4ONLY:
+ if (is_int) {
+ *value = 1 - ipv6;
+ return 0;
+ }
+ break;
+
+ case ZMQ_IPV6:
+ if (is_int) {
+ *value = ipv6;
+ return 0;
+ }
+ break;
+
+ case ZMQ_IMMEDIATE:
+ if (is_int) {
+ *value = immediate;
+ return 0;
+ }
+ break;
+
+ case ZMQ_SOCKS_PROXY:
+ if (*optvallen_ >= socks_proxy_address.size () + 1) {
+ memcpy (optval_, socks_proxy_address.c_str (), socks_proxy_address.size () + 1);
+ *optvallen_ = socks_proxy_address.size () + 1;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_KEEPALIVE:
+ if (is_int) {
+ *value = tcp_keepalive;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_KEEPALIVE_CNT:
+ if (is_int) {
+ *value = tcp_keepalive_cnt;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_KEEPALIVE_IDLE:
+ if (is_int) {
+ *value = tcp_keepalive_idle;
+ return 0;
+ }
+ break;
+
+ case ZMQ_TCP_KEEPALIVE_INTVL:
+ if (is_int) {
+ *value = tcp_keepalive_intvl;
+ return 0;
+ }
+ break;
+
+ case ZMQ_MECHANISM:
+ if (is_int) {
+ *value = mechanism;
+ return 0;
+ }
+ break;
+
+ case ZMQ_PLAIN_SERVER:
+ if (is_int) {
+ *value = as_server && mechanism == ZMQ_PLAIN;
+ return 0;
+ }
+ break;
+
+ case ZMQ_PLAIN_USERNAME:
+ if (*optvallen_ >= plain_username.size () + 1) {
+ memcpy (optval_, plain_username.c_str (), plain_username.size () + 1);
+ *optvallen_ = plain_username.size () + 1;
+ return 0;
+ }
+ break;
+
+ case ZMQ_PLAIN_PASSWORD:
+ if (*optvallen_ >= plain_password.size () + 1) {
+ memcpy (optval_, plain_password.c_str (), plain_password.size () + 1);
+ *optvallen_ = plain_password.size () + 1;
+ return 0;
+ }
+ break;
+
+ case ZMQ_ZAP_DOMAIN:
+ if (*optvallen_ >= zap_domain.size () + 1) {
+ memcpy (optval_, zap_domain.c_str (), zap_domain.size () + 1);
+ *optvallen_ = zap_domain.size () + 1;
+ return 0;
+ }
+ break;
+
+ // If libsodium isn't installed, these options provoke EINVAL
+# ifdef HAVE_LIBSODIUM
+ case ZMQ_CURVE_SERVER:
+ if (is_int) {
+ *value = as_server && mechanism == ZMQ_CURVE;
+ return 0;
+ }
+ break;
+
+ case ZMQ_CURVE_PUBLICKEY:
+ if (*optvallen_ == CURVE_KEYSIZE) {
+ memcpy (optval_, curve_public_key, CURVE_KEYSIZE);
+ return 0;
+ }
+ else
+ if (*optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
+ zmq_z85_encode ((char *) optval_, curve_public_key, CURVE_KEYSIZE);
+ return 0;
+ }
+ break;
+
+ case ZMQ_CURVE_SECRETKEY:
+ if (*optvallen_ == CURVE_KEYSIZE) {
+ memcpy (optval_, curve_secret_key, CURVE_KEYSIZE);
+ return 0;
+ }
+ else
+ if (*optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
+ zmq_z85_encode ((char *) optval_, curve_secret_key, CURVE_KEYSIZE);
+ return 0;
+ }
+ break;
+
+ case ZMQ_CURVE_SERVERKEY:
+ if (*optvallen_ == CURVE_KEYSIZE) {
+ memcpy (optval_, curve_server_key, CURVE_KEYSIZE);
+ return 0;
+ }
+ else
+ if (*optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
+ zmq_z85_encode ((char *) optval_, curve_server_key, CURVE_KEYSIZE);
+ return 0;
+ }
+ break;
+# endif
+
+ case ZMQ_CONFLATE:
+ if (is_int) {
+ *value = conflate;
+ return 0;
+ }
+ break;
+
+ // If libgssapi isn't installed, these options provoke EINVAL
+# ifdef HAVE_LIBGSSAPI_KRB5
+ case ZMQ_GSSAPI_SERVER:
+ if (is_int) {
+ *value = as_server && mechanism == ZMQ_GSSAPI;
+ return 0;
+ }
+ break;
+
+ case ZMQ_GSSAPI_PRINCIPAL:
+ if (*optvallen_ >= gss_principal.size () + 1) {
+ memcpy (optval_, gss_principal.c_str (), gss_principal.size () + 1);
+ *optvallen_ = gss_principal.size () + 1;
+ return 0;
+ }
+ break;
+
+ case ZMQ_GSSAPI_SERVICE_PRINCIPAL:
+ if (*optvallen_ >= gss_service_principal.size () + 1) {
+ memcpy (optval_, gss_service_principal.c_str (), gss_service_principal.size () + 1);
+ *optvallen_ = gss_service_principal.size () + 1;
+ return 0;
+ }
+ break;
+
+ case ZMQ_GSSAPI_PLAINTEXT:
+ if (is_int) {
+ *value = gss_plaintext;
+ return 0;
+ }
+ break;
+#endif
+
+ case ZMQ_HANDSHAKE_IVL:
+ if (is_int) {
+ *value = handshake_ivl;
+ return 0;
+ }
+ break;
+
+ default:
+#if defined (ZMQ_ACT_MILITANT)
+ malformed = false;
+#endif
+ break;
+ }
+#if defined (ZMQ_ACT_MILITANT)
+ if (malformed)
+ zmq_assert (false);
+#endif
+ errno = EINVAL;
+ return -1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/options.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/options.hpp
new file mode 100644
index 00000000..b4a019cd
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/options.hpp
@@ -0,0 +1,195 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_OPTIONS_HPP_INCLUDED__
+#define __ZMQ_OPTIONS_HPP_INCLUDED__
+
+#include <string>
+#include <vector>
+#include <set>
+
+#include "stddef.h"
+#include "stdint.hpp"
+#include "tcp_address.hpp"
+#include "../include/zmq.h"
+
+#if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
+#include <sys/types.h>
+#endif
+
+// Normal base 256 key is 32 bytes
+#define CURVE_KEYSIZE 32
+// Key encoded using Z85 is 40 bytes
+#define CURVE_KEYSIZE_Z85 40
+
+namespace zmq
+{
+ struct options_t
+ {
+ options_t ();
+
+ int setsockopt (int option_, const void *optval_, size_t optvallen_);
+ int getsockopt (int option_, void *optval_, size_t *optvallen_);
+
+ // High-water marks for message pipes.
+ int sndhwm;
+ int rcvhwm;
+
+ // I/O thread affinity.
+ uint64_t affinity;
+
+ // Socket identity
+ unsigned char identity_size;
+ unsigned char identity [256];
+
+ // Maximum transfer rate [kb/s]. Default 100kb/s.
+ int rate;
+
+ // Reliability time interval [ms]. Default 10 seconds.
+ int recovery_ivl;
+
+ // Sets the time-to-live field in every multicast packet sent.
+ int multicast_hops;
+
+ // SO_SNDBUF and SO_RCVBUF to be passed to underlying transport sockets.
+ int sndbuf;
+ int rcvbuf;
+
+ // Type of service (containing DSCP and ECN socket options)
+ int tos;
+
+ // Socket type.
+ int type;
+
+ // Linger time, in milliseconds.
+ int linger;
+
+ // Minimum interval between attempts to reconnect, in milliseconds.
+ // Default 100ms
+ int reconnect_ivl;
+
+ // Maximum interval between attempts to reconnect, in milliseconds.
+ // Default 0 (unused)
+ int reconnect_ivl_max;
+
+ // Maximum backlog for pending connections.
+ int backlog;
+
+ // Maximal size of message to handle.
+ int64_t maxmsgsize;
+
+ // The timeout for send/recv operations for this socket.
+ int rcvtimeo;
+ int sndtimeo;
+
+ // If true, IPv6 is enabled (as well as IPv4)
+ bool ipv6;
+
+ // If 1, connecting pipes are not attached immediately, meaning a send()
+ // on a socket with only connecting pipes would block
+ int immediate;
+
+ // If 1, (X)SUB socket should filter the messages. If 0, it should not.
+ bool filter;
+
+ // If true, the identity message is forwarded to the socket.
+ bool recv_identity;
+
+ // if true, router socket accepts non-zmq tcp connections
+ bool raw_sock;
+
+ // Addres of SOCKS proxy
+ std::string socks_proxy_address;
+
+ // TCP keep-alive settings.
+ // Defaults to -1 = do not change socket options
+ int tcp_keepalive;
+ int tcp_keepalive_cnt;
+ int tcp_keepalive_idle;
+ int tcp_keepalive_intvl;
+
+ // TCP accept() filters
+ typedef std::vector <tcp_address_mask_t> tcp_accept_filters_t;
+ tcp_accept_filters_t tcp_accept_filters;
+
+ // IPC accept() filters
+# if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
+ bool zap_ipc_creds;
+ typedef std::set <uid_t> ipc_uid_accept_filters_t;
+ ipc_uid_accept_filters_t ipc_uid_accept_filters;
+ typedef std::set <gid_t> ipc_gid_accept_filters_t;
+ ipc_gid_accept_filters_t ipc_gid_accept_filters;
+# endif
+# if defined ZMQ_HAVE_SO_PEERCRED
+ typedef std::set <pid_t> ipc_pid_accept_filters_t;
+ ipc_pid_accept_filters_t ipc_pid_accept_filters;
+# endif
+
+ // Security mechanism for all connections on this socket
+ int mechanism;
+
+ // If peer is acting as server for PLAIN or CURVE mechanisms
+ int as_server;
+
+ // ZAP authentication domain
+ std::string zap_domain;
+
+ // Security credentials for PLAIN mechanism
+ std::string plain_username;
+ std::string plain_password;
+
+ // Security credentials for CURVE mechanism
+ uint8_t curve_public_key [CURVE_KEYSIZE];
+ uint8_t curve_secret_key [CURVE_KEYSIZE];
+ uint8_t curve_server_key [CURVE_KEYSIZE];
+
+ // Principals for GSSAPI mechanism
+ std::string gss_principal;
+ std::string gss_service_principal;
+
+ // If true, gss encryption will be disabled
+ bool gss_plaintext;
+
+ // ID of the socket.
+ int socket_id;
+
+ // If true, socket conflates outgoing/incoming messages.
+ // Applicable to dealer, push/pull, pub/sub socket types.
+ // Cannot receive multi-part messages.
+ // Ignores hwm
+ bool conflate;
+
+ // If connection handshake is not done after this many milliseconds,
+ // close socket. Default is 30 secs. 0 means no handshake timeout.
+ int handshake_ivl;
+
+ };
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/own.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/own.cpp
new file mode 100644
index 00000000..8a4da3a7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/own.cpp
@@ -0,0 +1,215 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "own.hpp"
+#include "err.hpp"
+#include "io_thread.hpp"
+
+zmq::own_t::own_t (class ctx_t *parent_, uint32_t tid_) :
+ object_t (parent_, tid_),
+ terminating (false),
+ sent_seqnum (0),
+ processed_seqnum (0),
+ owner (NULL),
+ term_acks (0)
+{
+}
+
+zmq::own_t::own_t (io_thread_t *io_thread_, const options_t &options_) :
+ object_t (io_thread_),
+ options (options_),
+ terminating (false),
+ sent_seqnum (0),
+ processed_seqnum (0),
+ owner (NULL),
+ term_acks (0)
+{
+}
+
+zmq::own_t::~own_t ()
+{
+}
+
+void zmq::own_t::set_owner (own_t *owner_)
+{
+ zmq_assert (!owner);
+ owner = owner_;
+}
+
+void zmq::own_t::inc_seqnum ()
+{
+ // This function may be called from a different thread!
+ sent_seqnum.add (1);
+}
+
+void zmq::own_t::process_seqnum ()
+{
+ // Catch up with counter of processed commands.
+ processed_seqnum++;
+
+ // We may have catched up and still have pending terms acks.
+ check_term_acks ();
+}
+
+void zmq::own_t::launch_child (own_t *object_)
+{
+ // Specify the owner of the object.
+ object_->set_owner (this);
+
+ // Plug the object into the I/O thread.
+ send_plug (object_);
+
+ // Take ownership of the object.
+ send_own (this, object_);
+}
+
+void zmq::own_t::term_child (own_t *object_)
+{
+ process_term_req (object_);
+}
+
+void zmq::own_t::process_term_req (own_t *object_)
+{
+ // When shutting down we can ignore termination requests from owned
+ // objects. The termination request was already sent to the object.
+ if (terminating)
+ return;
+
+ // If I/O object is well and alive let's ask it to terminate.
+ owned_t::iterator it = std::find (owned.begin (), owned.end (), object_);
+
+ // If not found, we assume that termination request was already sent to
+ // the object so we can safely ignore the request.
+ if (it == owned.end ())
+ return;
+
+ owned.erase (it);
+ register_term_acks (1);
+
+ // Note that this object is the root of the (partial shutdown) thus, its
+ // value of linger is used, rather than the value stored by the children.
+ send_term (object_, options.linger);
+}
+
+void zmq::own_t::process_own (own_t *object_)
+{
+ // If the object is already being shut down, new owned objects are
+ // immediately asked to terminate. Note that linger is set to zero.
+ if (terminating) {
+ register_term_acks (1);
+ send_term (object_, 0);
+ return;
+ }
+
+ // Store the reference to the owned object.
+ owned.insert (object_);
+}
+
+void zmq::own_t::terminate ()
+{
+ // If termination is already underway, there's no point
+ // in starting it anew.
+ if (terminating)
+ return;
+
+ // As for the root of the ownership tree, there's noone to terminate it,
+ // so it has to terminate itself.
+ if (!owner) {
+ process_term (options.linger);
+ return;
+ }
+
+ // If I am an owned object, I'll ask my owner to terminate me.
+ send_term_req (owner, this);
+}
+
+bool zmq::own_t::is_terminating ()
+{
+ return terminating;
+}
+
+void zmq::own_t::process_term (int linger_)
+{
+ // Double termination should never happen.
+ zmq_assert (!terminating);
+
+ // Send termination request to all owned objects.
+ for (owned_t::iterator it = owned.begin (); it != owned.end (); ++it)
+ send_term (*it, linger_);
+ register_term_acks ((int) owned.size ());
+ owned.clear ();
+
+ // Start termination process and check whether by chance we cannot
+ // terminate immediately.
+ terminating = true;
+ check_term_acks ();
+}
+
+void zmq::own_t::register_term_acks (int count_)
+{
+ term_acks += count_;
+}
+
+void zmq::own_t::unregister_term_ack ()
+{
+ zmq_assert (term_acks > 0);
+ term_acks--;
+
+ // This may be a last ack we are waiting for before termination...
+ check_term_acks ();
+}
+
+void zmq::own_t::process_term_ack ()
+{
+ unregister_term_ack ();
+}
+
+void zmq::own_t::check_term_acks ()
+{
+ if (terminating && processed_seqnum == sent_seqnum.get () &&
+ term_acks == 0) {
+
+ // Sanity check. There should be no active children at this point.
+ zmq_assert (owned.empty ());
+
+ // The root object has nobody to confirm the termination to.
+ // Other nodes will confirm the termination to the owner.
+ if (owner)
+ send_term_ack (owner);
+
+ // Deallocate the resources.
+ process_destroy ();
+ }
+}
+
+void zmq::own_t::process_destroy ()
+{
+ delete this;
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/own.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/own.hpp
new file mode 100644
index 00000000..40be503f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/own.hpp
@@ -0,0 +1,154 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_OWN_HPP_INCLUDED__
+#define __ZMQ_OWN_HPP_INCLUDED__
+
+#include <set>
+#include <algorithm>
+
+#include "object.hpp"
+#include "options.hpp"
+#include "atomic_counter.hpp"
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class io_thread_t;
+
+ // Base class for objects forming a part of ownership hierarchy.
+ // It handles initialisation and destruction of such objects.
+
+ class own_t : public object_t
+ {
+ public:
+
+ // Note that the owner is unspecified in the constructor.
+ // It'll be supplied later on when the object is plugged in.
+
+ // The object is not living within an I/O thread. It has it's own
+ // thread outside of 0MQ infrastructure.
+ own_t (zmq::ctx_t *parent_, uint32_t tid_);
+
+ // The object is living within I/O thread.
+ own_t (zmq::io_thread_t *io_thread_, const options_t &options_);
+
+ // When another owned object wants to send command to this object
+ // it calls this function to let it know it should not shut down
+ // before the command is delivered.
+ void inc_seqnum ();
+
+ // Use following two functions to wait for arbitrary events before
+ // terminating. Just add number of events to wait for using
+ // register_tem_acks functions. When event occurs, call
+ // remove_term_ack. When number of pending acks reaches zero
+ // object will be deallocated.
+ void register_term_acks (int count_);
+ void unregister_term_ack ();
+
+ protected:
+
+ // Launch the supplied object and become its owner.
+ void launch_child (own_t *object_);
+
+ // Terminate owned object
+ void term_child (own_t *object_);
+
+ // Ask owner object to terminate this object. It may take a while
+ // while actual termination is started. This function should not be
+ // called more than once.
+ void terminate ();
+
+ // Returns true if the object is in process of termination.
+ bool is_terminating ();
+
+ // Derived object destroys own_t. There's no point in allowing
+ // others to invoke the destructor. At the same time, it has to be
+ // virtual so that generic own_t deallocation mechanism destroys
+ // specific type of the owned object correctly.
+ virtual ~own_t ();
+
+ // Term handler is protocted rather than private so that it can
+ // be intercepted by the derived class. This is useful to add custom
+ // steps to the beginning of the termination process.
+ void process_term (int linger_);
+
+ // A place to hook in when phyicallal destruction of the object
+ // is to be delayed.
+ virtual void process_destroy ();
+
+ // Socket options associated with this object.
+ options_t options;
+
+ private:
+
+ // Set owner of the object
+ void set_owner (own_t *owner_);
+
+ // Handlers for incoming commands.
+ void process_own (own_t *object_);
+ void process_term_req (own_t *object_);
+ void process_term_ack ();
+ void process_seqnum ();
+
+ // Check whether all the peding term acks were delivered.
+ // If so, deallocate this object.
+ void check_term_acks ();
+
+ // True if termination was already initiated. If so, we can destroy
+ // the object if there are no more child objects or pending term acks.
+ bool terminating;
+
+ // Sequence number of the last command sent to this object.
+ atomic_counter_t sent_seqnum;
+
+ // Sequence number of the last command processed by this object.
+ uint64_t processed_seqnum;
+
+ // Socket owning this object. It's responsible for shutting down
+ // this object.
+ own_t *owner;
+
+ // List of all objects owned by this socket. We are responsible
+ // for deallocating them before we quit.
+ typedef std::set <own_t*> owned_t;
+ owned_t owned;
+
+ // Number of events we have to get before we can destroy the object.
+ int term_acks;
+
+ own_t (const own_t&);
+ const own_t &operator = (const own_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pair.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pair.cpp
new file mode 100644
index 00000000..ee2da2b2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pair.cpp
@@ -0,0 +1,141 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "pair.hpp"
+#include "err.hpp"
+#include "pipe.hpp"
+#include "msg.hpp"
+
+zmq::pair_t::pair_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ socket_base_t (parent_, tid_, sid_),
+ pipe (NULL),
+ last_in (NULL)
+{
+ options.type = ZMQ_PAIR;
+}
+
+zmq::pair_t::~pair_t ()
+{
+ zmq_assert (!pipe);
+}
+
+void zmq::pair_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ // subscribe_to_all_ is unused
+ (void)subscribe_to_all_;
+
+ zmq_assert (pipe_ != NULL);
+
+ // ZMQ_PAIR socket can only be connected to a single peer.
+ // The socket rejects any further connection requests.
+ if (pipe == NULL)
+ pipe = pipe_;
+ else
+ pipe_->terminate (false);
+}
+
+void zmq::pair_t::xpipe_terminated (pipe_t *pipe_)
+{
+ if (pipe_ == pipe) {
+ if (last_in == pipe) {
+ saved_credential = last_in->get_credential ();
+ last_in = NULL;
+ }
+ pipe = NULL;
+ }
+}
+
+void zmq::pair_t::xread_activated (pipe_t *)
+{
+ // There's just one pipe. No lists of active and inactive pipes.
+ // There's nothing to do here.
+}
+
+void zmq::pair_t::xwrite_activated (pipe_t *)
+{
+ // There's just one pipe. No lists of active and inactive pipes.
+ // There's nothing to do here.
+}
+
+int zmq::pair_t::xsend (msg_t *msg_)
+{
+ if (!pipe || !pipe->write (msg_)) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ if (!(msg_->flags () & msg_t::more))
+ pipe->flush ();
+
+ // Detach the original message from the data buffer.
+ int rc = msg_->init ();
+ errno_assert (rc == 0);
+
+ return 0;
+}
+
+int zmq::pair_t::xrecv (msg_t *msg_)
+{
+ // Deallocate old content of the message.
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+
+ if (!pipe || !pipe->read (msg_)) {
+
+ // Initialise the output parameter to be a 0-byte message.
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+
+ errno = EAGAIN;
+ return -1;
+ }
+ last_in = pipe;
+ return 0;
+}
+
+bool zmq::pair_t::xhas_in ()
+{
+ if (!pipe)
+ return false;
+
+ return pipe->check_read ();
+}
+
+bool zmq::pair_t::xhas_out ()
+{
+ if (!pipe)
+ return false;
+
+ return pipe->check_write ();
+}
+
+zmq::blob_t zmq::pair_t::get_credential () const
+{
+ return last_in? last_in->get_credential (): saved_credential;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pair.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pair.hpp
new file mode 100644
index 00000000..f7f74a39
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pair.hpp
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PAIR_HPP_INCLUDED__
+#define __ZMQ_PAIR_HPP_INCLUDED__
+
+#include "blob.hpp"
+#include "socket_base.hpp"
+#include "session_base.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class msg_t;
+ class pipe_t;
+ class io_thread_t;
+
+ class pair_t :
+ public socket_base_t
+ {
+ public:
+
+ pair_t (zmq::ctx_t *parent_, uint32_t tid_, int sid);
+ ~pair_t ();
+
+ // Overrides of functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ bool xhas_out ();
+ blob_t get_credential () const;
+ void xread_activated (zmq::pipe_t *pipe_);
+ void xwrite_activated (zmq::pipe_t *pipe_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+
+ private:
+
+ zmq::pipe_t *pipe;
+
+ zmq::pipe_t *last_in;
+
+ blob_t saved_credential;
+
+ pair_t (const pair_t&);
+ const pair_t &operator = (const pair_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_receiver.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_receiver.cpp
new file mode 100644
index 00000000..261ff3c0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_receiver.cpp
@@ -0,0 +1,306 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_OPENPGM
+
+#include <new>
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "pgm_receiver.hpp"
+#include "session_base.hpp"
+#include "v1_decoder.hpp"
+#include "stdint.hpp"
+#include "wire.hpp"
+#include "err.hpp"
+
+zmq::pgm_receiver_t::pgm_receiver_t (class io_thread_t *parent_,
+ const options_t &options_) :
+ io_object_t (parent_),
+ has_rx_timer (false),
+ pgm_socket (true, options_),
+ options (options_),
+ session (NULL),
+ active_tsi (NULL),
+ insize (0)
+{
+}
+
+zmq::pgm_receiver_t::~pgm_receiver_t ()
+{
+ // Destructor should not be called before unplug.
+ zmq_assert (peers.empty ());
+}
+
+int zmq::pgm_receiver_t::init (bool udp_encapsulation_, const char *network_)
+{
+ return pgm_socket.init (udp_encapsulation_, network_);
+}
+
+void zmq::pgm_receiver_t::plug (io_thread_t *io_thread_,
+ session_base_t *session_)
+{
+ // Retrieve PGM fds and start polling.
+ fd_t socket_fd = retired_fd;
+ fd_t waiting_pipe_fd = retired_fd;
+ pgm_socket.get_receiver_fds (&socket_fd, &waiting_pipe_fd);
+ socket_handle = add_fd (socket_fd);
+ pipe_handle = add_fd (waiting_pipe_fd);
+ set_pollin (pipe_handle);
+ set_pollin (socket_handle);
+
+ session = session_;
+
+ // If there are any subscriptions already queued in the session, drop them.
+ drop_subscriptions ();
+}
+
+void zmq::pgm_receiver_t::unplug ()
+{
+ // Delete decoders.
+ for (peers_t::iterator it = peers.begin (); it != peers.end (); ++it) {
+ if (it->second.decoder != NULL)
+ delete it->second.decoder;
+ }
+ peers.clear ();
+ active_tsi = NULL;
+
+ if (has_rx_timer) {
+ cancel_timer (rx_timer_id);
+ has_rx_timer = false;
+ }
+
+ rm_fd (socket_handle);
+ rm_fd (pipe_handle);
+
+ session = NULL;
+}
+
+void zmq::pgm_receiver_t::terminate ()
+{
+ unplug ();
+ delete this;
+}
+
+void zmq::pgm_receiver_t::restart_output ()
+{
+ drop_subscriptions ();
+}
+
+void zmq::pgm_receiver_t::restart_input ()
+{
+ zmq_assert (session != NULL);
+ zmq_assert (active_tsi != NULL);
+
+ const peers_t::iterator it = peers.find (*active_tsi);
+ zmq_assert (it != peers.end ());
+ zmq_assert (it->second.joined);
+
+ // Push the pending message into the session.
+ int rc = session->push_msg (it->second.decoder->msg ());
+ errno_assert (rc == 0);
+
+ if (insize > 0) {
+ rc = process_input (it->second.decoder);
+ if (rc == -1) {
+ // HWM reached; we will try later.
+ if (errno == EAGAIN) {
+ session->flush ();
+ return;
+ }
+ // Data error. Delete message decoder, mark the
+ // peer as not joined and drop remaining data.
+ it->second.joined = false;
+ delete it->second.decoder;
+ it->second.decoder = NULL;
+ insize = 0;
+ }
+ }
+
+ // Resume polling.
+ set_pollin (pipe_handle);
+ set_pollin (socket_handle);
+
+ active_tsi = NULL;
+ in_event ();
+}
+
+void zmq::pgm_receiver_t::in_event ()
+{
+ // Read data from the underlying pgm_socket.
+ const pgm_tsi_t *tsi = NULL;
+
+ if (has_rx_timer) {
+ cancel_timer (rx_timer_id);
+ has_rx_timer = false;
+ }
+
+ // TODO: This loop can effectively block other engines in the same I/O
+ // thread in the case of high load.
+ while (true) {
+
+ // Get new batch of data.
+ // Note the workaround made not to break strict-aliasing rules.
+ void *tmp = NULL;
+ ssize_t received = pgm_socket.receive (&tmp, &tsi);
+ inpos = (unsigned char*) tmp;
+
+ // No data to process. This may happen if the packet received is
+ // neither ODATA nor ODATA.
+ if (received == 0) {
+ if (errno == ENOMEM || errno == EBUSY) {
+ const long timeout = pgm_socket.get_rx_timeout ();
+ add_timer (timeout, rx_timer_id);
+ has_rx_timer = true;
+ }
+ break;
+ }
+
+ // Find the peer based on its TSI.
+ peers_t::iterator it = peers.find (*tsi);
+
+ // Data loss. Delete decoder and mark the peer as disjoint.
+ if (received == -1) {
+ if (it != peers.end ()) {
+ it->second.joined = false;
+ if (it->second.decoder != NULL) {
+ delete it->second.decoder;
+ it->second.decoder = NULL;
+ }
+ }
+ break;
+ }
+
+ // New peer. Add it to the list of know but unjoint peers.
+ if (it == peers.end ()) {
+ peer_info_t peer_info = {false, NULL};
+ it = peers.insert (peers_t::value_type (*tsi, peer_info)).first;
+ }
+
+ insize = static_cast <size_t> (received);
+
+ // Read the offset of the fist message in the current packet.
+ zmq_assert (insize >= sizeof (uint16_t));
+ uint16_t offset = get_uint16 (inpos);
+ inpos += sizeof (uint16_t);
+ insize -= sizeof (uint16_t);
+
+ // Join the stream if needed.
+ if (!it->second.joined) {
+
+ // There is no beginning of the message in current packet.
+ // Ignore the data.
+ if (offset == 0xffff)
+ continue;
+
+ zmq_assert (offset <= insize);
+ zmq_assert (it->second.decoder == NULL);
+
+ // We have to move data to the begining of the first message.
+ inpos += offset;
+ insize -= offset;
+
+ // Mark the stream as joined.
+ it->second.joined = true;
+
+ // Create and connect decoder for the peer.
+ it->second.decoder = new (std::nothrow)
+ v1_decoder_t (0, options.maxmsgsize);
+ alloc_assert (it->second.decoder);
+ }
+
+ int rc = process_input (it->second.decoder);
+ if (rc == -1) {
+ if (errno == EAGAIN) {
+ active_tsi = tsi;
+
+ // Stop polling.
+ reset_pollin (pipe_handle);
+ reset_pollin (socket_handle);
+
+ break;
+ }
+
+ it->second.joined = false;
+ delete it->second.decoder;
+ it->second.decoder = NULL;
+ insize = 0;
+ }
+ }
+
+ // Flush any messages decoder may have produced.
+ session->flush ();
+}
+
+int zmq::pgm_receiver_t::process_input (v1_decoder_t *decoder)
+{
+ zmq_assert (session != NULL);
+
+ while (insize > 0) {
+ size_t n = 0;
+ int rc = decoder->decode (inpos, insize, n);
+ if (rc == -1)
+ return -1;
+ inpos += n;
+ insize -= n;
+ if (rc == 0)
+ break;
+ rc = session->push_msg (decoder->msg ());
+ if (rc == -1) {
+ errno_assert (errno == EAGAIN);
+ return -1;
+ }
+ }
+ return 0;
+}
+
+
+void zmq::pgm_receiver_t::timer_event (int token)
+{
+ zmq_assert (token == rx_timer_id);
+
+ // Timer cancels on return by poller_base.
+ has_rx_timer = false;
+ in_event ();
+}
+
+void zmq::pgm_receiver_t::drop_subscriptions ()
+{
+ msg_t msg;
+ msg.init ();
+ while (session->pull_msg (&msg) == 0)
+ msg.close ();
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_receiver.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_receiver.hpp
new file mode 100644
index 00000000..4594ab46
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_receiver.hpp
@@ -0,0 +1,152 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PGM_RECEIVER_HPP_INCLUDED__
+#define __ZMQ_PGM_RECEIVER_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_OPENPGM
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <map>
+#include <algorithm>
+
+#include "io_object.hpp"
+#include "i_engine.hpp"
+#include "options.hpp"
+#include "v1_decoder.hpp"
+#include "pgm_socket.hpp"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class session_base_t;
+
+ class pgm_receiver_t : public io_object_t, public i_engine
+ {
+
+ public:
+
+ pgm_receiver_t (zmq::io_thread_t *parent_, const options_t &options_);
+ ~pgm_receiver_t ();
+
+ int init (bool udp_encapsulation_, const char *network_);
+
+ // i_engine interface implementation.
+ void plug (zmq::io_thread_t *io_thread_,
+ zmq::session_base_t *session_);
+ void terminate ();
+ void restart_input ();
+ void restart_output ();
+ void zap_msg_available () {}
+
+ // i_poll_events interface implementation.
+ void in_event ();
+ void timer_event (int token);
+
+ private:
+
+ // Unplug the engine from the session.
+ void unplug ();
+
+ // Decode received data (inpos, insize) and forward decoded
+ // messages to the session.
+ int process_input (v1_decoder_t *decoder);
+
+ // PGM is not able to move subscriptions upstream. Thus, drop all
+ // the pending subscriptions.
+ void drop_subscriptions ();
+
+ // RX timeout timer ID.
+ enum {rx_timer_id = 0xa1};
+
+ // RX timer is running.
+ bool has_rx_timer;
+
+ // If joined is true we are already getting messages from the peer.
+ // It it's false, we are getting data but still we haven't seen
+ // beginning of a message.
+ struct peer_info_t
+ {
+ bool joined;
+ v1_decoder_t *decoder;
+ };
+
+ struct tsi_comp
+ {
+ bool operator () (const pgm_tsi_t &ltsi,
+ const pgm_tsi_t &rtsi) const
+ {
+ uint32_t ll[2], rl[2];
+ memcpy (ll, &ltsi, sizeof (ll));
+ memcpy (rl, &rtsi, sizeof (rl));
+ return (ll[0] < rl[0]) || (ll[0] == rl[0] && ll[1] < rl[1]);
+ }
+ };
+
+ typedef std::map <pgm_tsi_t, peer_info_t, tsi_comp> peers_t;
+ peers_t peers;
+
+ // PGM socket.
+ pgm_socket_t pgm_socket;
+
+ // Socket options.
+ options_t options;
+
+ // Associated session.
+ zmq::session_base_t *session;
+
+ const pgm_tsi_t *active_tsi;
+
+ // Number of bytes not consumed by the decoder due to pipe overflow.
+ size_t insize;
+
+ // Pointer to data still waiting to be processed by the decoder.
+ const unsigned char *inpos;
+
+ // Poll handle associated with PGM socket.
+ handle_t socket_handle;
+
+ // Poll handle associated with engine PGM waiting pipe.
+ handle_t pipe_handle;
+
+ pgm_receiver_t (const pgm_receiver_t&);
+ const pgm_receiver_t &operator = (const pgm_receiver_t&);
+ };
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_sender.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_sender.cpp
new file mode 100644
index 00000000..593aa641
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_sender.cpp
@@ -0,0 +1,249 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_OPENPGM
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <stdlib.h>
+
+#include "io_thread.hpp"
+#include "pgm_sender.hpp"
+#include "session_base.hpp"
+#include "err.hpp"
+#include "wire.hpp"
+#include "stdint.hpp"
+
+zmq::pgm_sender_t::pgm_sender_t (io_thread_t *parent_,
+ const options_t &options_) :
+ io_object_t (parent_),
+ has_tx_timer (false),
+ has_rx_timer (false),
+ session (NULL),
+ encoder (0),
+ more_flag (false),
+ pgm_socket (false, options_),
+ options (options_),
+ out_buffer (NULL),
+ out_buffer_size (0),
+ write_size (0)
+{
+ int rc = msg.init ();
+ errno_assert (rc == 0);
+}
+
+int zmq::pgm_sender_t::init (bool udp_encapsulation_, const char *network_)
+{
+ int rc = pgm_socket.init (udp_encapsulation_, network_);
+ if (rc != 0)
+ return rc;
+
+ out_buffer_size = pgm_socket.get_max_tsdu_size ();
+ out_buffer = (unsigned char*) malloc (out_buffer_size);
+ alloc_assert (out_buffer);
+
+ return rc;
+}
+
+void zmq::pgm_sender_t::plug (io_thread_t *io_thread_, session_base_t *session_)
+{
+ // Alocate 2 fds for PGM socket.
+ fd_t downlink_socket_fd = retired_fd;
+ fd_t uplink_socket_fd = retired_fd;
+ fd_t rdata_notify_fd = retired_fd;
+ fd_t pending_notify_fd = retired_fd;
+
+ session = session_;
+
+ // Fill fds from PGM transport and add them to the poller.
+ pgm_socket.get_sender_fds (&downlink_socket_fd, &uplink_socket_fd,
+ &rdata_notify_fd, &pending_notify_fd);
+
+ handle = add_fd (downlink_socket_fd);
+ uplink_handle = add_fd (uplink_socket_fd);
+ rdata_notify_handle = add_fd (rdata_notify_fd);
+ pending_notify_handle = add_fd (pending_notify_fd);
+
+ // Set POLLIN. We wont never want to stop polling for uplink = we never
+ // want to stop porocess NAKs.
+ set_pollin (uplink_handle);
+ set_pollin (rdata_notify_handle);
+ set_pollin (pending_notify_handle);
+
+ // Set POLLOUT for downlink_socket_handle.
+ set_pollout (handle);
+}
+
+void zmq::pgm_sender_t::unplug ()
+{
+ if (has_rx_timer) {
+ cancel_timer (rx_timer_id);
+ has_rx_timer = false;
+ }
+
+ if (has_tx_timer) {
+ cancel_timer (tx_timer_id);
+ has_tx_timer = false;
+ }
+
+ rm_fd (handle);
+ rm_fd (uplink_handle);
+ rm_fd (rdata_notify_handle);
+ rm_fd (pending_notify_handle);
+ session = NULL;
+}
+
+void zmq::pgm_sender_t::terminate ()
+{
+ unplug ();
+ delete this;
+}
+
+void zmq::pgm_sender_t::restart_output ()
+{
+ set_pollout (handle);
+ out_event ();
+}
+
+void zmq::pgm_sender_t::restart_input ()
+{
+ zmq_assert (false);
+}
+
+zmq::pgm_sender_t::~pgm_sender_t ()
+{
+ int rc = msg.close ();
+ errno_assert (rc == 0);
+
+ if (out_buffer) {
+ free (out_buffer);
+ out_buffer = NULL;
+ }
+}
+
+void zmq::pgm_sender_t::in_event ()
+{
+ if (has_rx_timer) {
+ cancel_timer (rx_timer_id);
+ has_rx_timer = false;
+ }
+
+ // In-event on sender side means NAK or SPMR receiving from some peer.
+ pgm_socket.process_upstream ();
+ if (errno == ENOMEM || errno == EBUSY) {
+ const long timeout = pgm_socket.get_rx_timeout ();
+ add_timer (timeout, rx_timer_id);
+ has_rx_timer = true;
+ }
+}
+
+void zmq::pgm_sender_t::out_event ()
+{
+ // POLLOUT event from send socket. If write buffer is empty,
+ // try to read new data from the encoder.
+ if (write_size == 0) {
+
+ // First two bytes (sizeof uint16_t) are used to store message
+ // offset in following steps. Note that by passing our buffer to
+ // the get data function we prevent it from returning its own buffer.
+ unsigned char *bf = out_buffer + sizeof (uint16_t);
+ size_t bfsz = out_buffer_size - sizeof (uint16_t);
+ uint16_t offset = 0xffff;
+
+ size_t bytes = encoder.encode (&bf, bfsz);
+ while (bytes < bfsz) {
+ if (!more_flag && offset == 0xffff)
+ offset = static_cast <uint16_t> (bytes);
+ int rc = session->pull_msg (&msg);
+ if (rc == -1)
+ break;
+ more_flag = msg.flags () & msg_t::more;
+ encoder.load_msg (&msg);
+ bf = out_buffer + sizeof (uint16_t) + bytes;
+ bytes += encoder.encode (&bf, bfsz - bytes);
+ }
+
+ // If there are no data to write stop polling for output.
+ if (bytes == 0) {
+ reset_pollout (handle);
+ return;
+ }
+
+ write_size = sizeof (uint16_t) + bytes;
+
+ // Put offset information in the buffer.
+ put_uint16 (out_buffer, offset);
+ }
+
+ if (has_tx_timer) {
+ cancel_timer (tx_timer_id);
+ has_tx_timer = false;
+ }
+
+ // Send the data.
+ size_t nbytes = pgm_socket.send (out_buffer, write_size);
+
+ // We can write either all data or 0 which means rate limit reached.
+ if (nbytes == write_size)
+ write_size = 0;
+ else {
+ zmq_assert (nbytes == 0);
+
+ if (errno == ENOMEM) {
+ const long timeout = pgm_socket.get_tx_timeout ();
+ add_timer (timeout, tx_timer_id);
+ has_tx_timer = true;
+ }
+ else
+ errno_assert (errno == EBUSY);
+ }
+}
+
+void zmq::pgm_sender_t::timer_event (int token)
+{
+ // Timer cancels on return by poller_base.
+ if (token == rx_timer_id) {
+ has_rx_timer = false;
+ in_event ();
+ }
+ else
+ if (token == tx_timer_id) {
+ has_tx_timer = false;
+ out_event ();
+ }
+ else
+ zmq_assert (false);
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_sender.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_sender.hpp
new file mode 100644
index 00000000..bed05f75
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_sender.hpp
@@ -0,0 +1,129 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PGM_SENDER_HPP_INCLUDED__
+#define __ZMQ_PGM_SENDER_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_OPENPGM
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "stdint.hpp"
+#include "io_object.hpp"
+#include "i_engine.hpp"
+#include "options.hpp"
+#include "pgm_socket.hpp"
+#include "v1_encoder.hpp"
+#include "msg.hpp"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class session_base_t;
+
+ class pgm_sender_t : public io_object_t, public i_engine
+ {
+
+ public:
+
+ pgm_sender_t (zmq::io_thread_t *parent_, const options_t &options_);
+ ~pgm_sender_t ();
+
+ int init (bool udp_encapsulation_, const char *network_);
+
+ // i_engine interface implementation.
+ void plug (zmq::io_thread_t *io_thread_,
+ zmq::session_base_t *session_);
+ void terminate ();
+ void restart_input ();
+ void restart_output ();
+ void zap_msg_available () {}
+
+ // i_poll_events interface implementation.
+ void in_event ();
+ void out_event ();
+ void timer_event (int token);
+
+ private:
+
+ // Unplug the engine from the session.
+ void unplug ();
+
+ // TX and RX timeout timer ID's.
+ enum {tx_timer_id = 0xa0, rx_timer_id = 0xa1};
+
+ // Timers are running.
+ bool has_tx_timer;
+ bool has_rx_timer;
+
+ session_base_t *session;
+
+ // Message encoder.
+ v1_encoder_t encoder;
+
+ msg_t msg;
+
+ // Keeps track of message boundaries.
+ bool more_flag;
+
+ // PGM socket.
+ pgm_socket_t pgm_socket;
+
+ // Socket options.
+ options_t options;
+
+ // Poll handle associated with PGM socket.
+ handle_t handle;
+ handle_t uplink_handle;
+ handle_t rdata_notify_handle;
+ handle_t pending_notify_handle;
+
+ // Output buffer from pgm_socket.
+ unsigned char *out_buffer;
+
+ // Output buffer size.
+ size_t out_buffer_size;
+
+ // Number of bytes in the buffer to be written to the socket.
+ // If zero, there are no data to be sent.
+ size_t write_size;
+
+ pgm_sender_t (const pgm_sender_t&);
+ const pgm_sender_t &operator = (const pgm_sender_t&);
+ };
+
+}
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_socket.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_socket.cpp
new file mode 100644
index 00000000..da8a9591
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_socket.cpp
@@ -0,0 +1,716 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#ifdef ZMQ_HAVE_OPENPGM
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#ifdef ZMQ_HAVE_LINUX
+#include <poll.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <string>
+
+#include "options.hpp"
+#include "pgm_socket.hpp"
+#include "config.hpp"
+#include "err.hpp"
+#include "random.hpp"
+#include "stdint.hpp"
+
+#ifndef MSG_ERRQUEUE
+#define MSG_ERRQUEUE 0x2000
+#endif
+
+zmq::pgm_socket_t::pgm_socket_t (bool receiver_, const options_t &options_) :
+ sock (NULL),
+ options (options_),
+ receiver (receiver_),
+ pgm_msgv (NULL),
+ pgm_msgv_len (0),
+ nbytes_rec (0),
+ nbytes_processed (0),
+ pgm_msgv_processed (0)
+{
+}
+
+// Resolve PGM socket address.
+// network_ of the form <interface & multicast group decls>:<IP port>
+// e.g. eth0;239.192.0.1:7500
+// link-local;224.250.0.1,224.250.0.2;224.250.0.3:8000
+// ;[fe80::1%en0]:7500
+int zmq::pgm_socket_t::init_address (const char *network_,
+ struct pgm_addrinfo_t **res, uint16_t *port_number)
+{
+ // Parse port number, start from end for IPv6
+ const char *port_delim = strrchr (network_, ':');
+ if (!port_delim) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ *port_number = atoi (port_delim + 1);
+
+ char network [256];
+ if (port_delim - network_ >= (int) sizeof (network) - 1) {
+ errno = EINVAL;
+ return -1;
+ }
+ memset (network, '\0', sizeof (network));
+ memcpy (network, network_, port_delim - network_);
+
+ pgm_error_t *pgm_error = NULL;
+ struct pgm_addrinfo_t hints;
+
+ memset (&hints, 0, sizeof (hints));
+ hints.ai_family = AF_UNSPEC;
+ if (!pgm_getaddrinfo (network, NULL, res, &pgm_error)) {
+
+ // Invalid parameters don't set pgm_error_t.
+ zmq_assert (pgm_error != NULL);
+ if (pgm_error->domain == PGM_ERROR_DOMAIN_IF &&
+
+ // NB: cannot catch EAI_BADFLAGS.
+ ( pgm_error->code != PGM_ERROR_SERVICE &&
+ pgm_error->code != PGM_ERROR_SOCKTNOSUPPORT)) {
+
+ // User, host, or network configuration or transient error.
+ pgm_error_free (pgm_error);
+ errno = EINVAL;
+ return -1;
+ }
+
+ // Fatal OpenPGM internal error.
+ zmq_assert (false);
+ }
+ return 0;
+}
+
+// Create, bind and connect PGM socket.
+int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
+{
+ // Can not open transport before destroying old one.
+ zmq_assert (sock == NULL);
+ zmq_assert (options.rate > 0);
+
+ // Zero counter used in msgrecv.
+ nbytes_rec = 0;
+ nbytes_processed = 0;
+ pgm_msgv_processed = 0;
+
+ uint16_t port_number;
+ struct pgm_addrinfo_t *res = NULL;
+ sa_family_t sa_family;
+
+ pgm_error_t *pgm_error = NULL;
+
+ if (init_address(network_, &res, &port_number) < 0) {
+ goto err_abort;
+ }
+
+ zmq_assert (res != NULL);
+
+ // Pick up detected IP family.
+ sa_family = res->ai_send_addrs[0].gsr_group.ss_family;
+
+ // Create IP/PGM or UDP/PGM socket.
+ if (udp_encapsulation_) {
+ if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_UDP,
+ &pgm_error)) {
+
+ // Invalid parameters don't set pgm_error_t.
+ zmq_assert (pgm_error != NULL);
+ if (pgm_error->domain == PGM_ERROR_DOMAIN_SOCKET && (
+ pgm_error->code != PGM_ERROR_BADF &&
+ pgm_error->code != PGM_ERROR_FAULT &&
+ pgm_error->code != PGM_ERROR_NOPROTOOPT &&
+ pgm_error->code != PGM_ERROR_FAILED))
+
+ // User, host, or network configuration or transient error.
+ goto err_abort;
+
+ // Fatal OpenPGM internal error.
+ zmq_assert (false);
+ }
+
+ // All options are of data type int
+ const int encapsulation_port = port_number;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_UCAST_PORT,
+ &encapsulation_port, sizeof (encapsulation_port)))
+ goto err_abort;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_UDP_ENCAP_MCAST_PORT,
+ &encapsulation_port, sizeof (encapsulation_port)))
+ goto err_abort;
+ }
+ else {
+ if (!pgm_socket (&sock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM,
+ &pgm_error)) {
+
+ // Invalid parameters don't set pgm_error_t.
+ zmq_assert (pgm_error != NULL);
+ if (pgm_error->domain == PGM_ERROR_DOMAIN_SOCKET && (
+ pgm_error->code != PGM_ERROR_BADF &&
+ pgm_error->code != PGM_ERROR_FAULT &&
+ pgm_error->code != PGM_ERROR_NOPROTOOPT &&
+ pgm_error->code != PGM_ERROR_FAILED))
+
+ // User, host, or network configuration or transient error.
+ goto err_abort;
+
+ // Fatal OpenPGM internal error.
+ zmq_assert (false);
+ }
+ }
+
+ {
+ const int rcvbuf = (int) options.rcvbuf;
+ if (rcvbuf) {
+ if (!pgm_setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &rcvbuf,
+ sizeof (rcvbuf)))
+ goto err_abort;
+ }
+
+ const int sndbuf = (int) options.sndbuf;
+ if (sndbuf) {
+ if (!pgm_setsockopt (sock, SOL_SOCKET, SO_SNDBUF, &sndbuf,
+ sizeof (sndbuf)))
+ goto err_abort;
+ }
+
+ const int max_tpdu = (int) pgm_max_tpdu;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MTU, &max_tpdu,
+ sizeof (max_tpdu)))
+ goto err_abort;
+ }
+
+ if (receiver) {
+ const int recv_only = 1,
+ rxw_max_tpdu = (int) pgm_max_tpdu,
+ rxw_sqns = compute_sqns (rxw_max_tpdu),
+ peer_expiry = pgm_secs (300),
+ spmr_expiry = pgm_msecs (25),
+ nak_bo_ivl = pgm_msecs (50),
+ nak_rpt_ivl = pgm_msecs (200),
+ nak_rdata_ivl = pgm_msecs (200),
+ nak_data_retries = 50,
+ nak_ncf_retries = 50;
+
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_RECV_ONLY, &recv_only,
+ sizeof (recv_only)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_RXW_SQNS, &rxw_sqns,
+ sizeof (rxw_sqns)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_PEER_EXPIRY, &peer_expiry,
+ sizeof (peer_expiry)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &spmr_expiry,
+ sizeof (spmr_expiry)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_BO_IVL, &nak_bo_ivl,
+ sizeof (nak_bo_ivl)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &nak_rpt_ivl,
+ sizeof (nak_rpt_ivl)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_RDATA_IVL,
+ &nak_rdata_ivl, sizeof (nak_rdata_ivl)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES,
+ &nak_data_retries, sizeof (nak_data_retries)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES,
+ &nak_ncf_retries, sizeof (nak_ncf_retries)))
+ goto err_abort;
+ }
+ else {
+ const int send_only = 1,
+ max_rte = (int) ((options.rate * 1000) / 8),
+ txw_max_tpdu = (int) pgm_max_tpdu,
+ txw_sqns = compute_sqns (txw_max_tpdu),
+ ambient_spm = pgm_secs (30),
+ heartbeat_spm[] = { pgm_msecs (100),
+ pgm_msecs (100),
+ pgm_msecs (100),
+ pgm_msecs (100),
+ pgm_msecs (1300),
+ pgm_secs (7),
+ pgm_secs (16),
+ pgm_secs (25),
+ pgm_secs (30) };
+
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_SEND_ONLY,
+ &send_only, sizeof (send_only)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_ODATA_MAX_RTE,
+ &max_rte, sizeof (max_rte)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_TXW_SQNS,
+ &txw_sqns, sizeof (txw_sqns)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_AMBIENT_SPM,
+ &ambient_spm, sizeof (ambient_spm)) ||
+ !pgm_setsockopt (sock, IPPROTO_PGM, PGM_HEARTBEAT_SPM,
+ &heartbeat_spm, sizeof (heartbeat_spm)))
+ goto err_abort;
+ }
+
+ // PGM transport GSI.
+ struct pgm_sockaddr_t addr;
+
+ memset (&addr, 0, sizeof(addr));
+ addr.sa_port = port_number;
+ addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT;
+
+ // Create random GSI.
+ uint32_t buf [2];
+ buf [0] = generate_random ();
+ buf [1] = generate_random ();
+ if (!pgm_gsi_create_from_data (&addr.sa_addr.gsi, (uint8_t*) buf, 8))
+ goto err_abort;
+
+
+ // Bind a transport to the specified network devices.
+ struct pgm_interface_req_t if_req;
+ memset (&if_req, 0, sizeof(if_req));
+ if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
+ if_req.ir_scope_id = 0;
+ if (AF_INET6 == sa_family) {
+ struct sockaddr_in6 sa6;
+ memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof (sa6));
+ if_req.ir_scope_id = sa6.sin6_scope_id;
+ }
+ if (!pgm_bind3 (sock, &addr, sizeof (addr), &if_req, sizeof (if_req),
+ &if_req, sizeof (if_req), &pgm_error)) {
+
+ // Invalid parameters don't set pgm_error_t.
+ zmq_assert (pgm_error != NULL);
+ if ((pgm_error->domain == PGM_ERROR_DOMAIN_SOCKET ||
+ pgm_error->domain == PGM_ERROR_DOMAIN_IF) && (
+ pgm_error->code != PGM_ERROR_INVAL &&
+ pgm_error->code != PGM_ERROR_BADF &&
+ pgm_error->code != PGM_ERROR_FAULT))
+
+ // User, host, or network configuration or transient error.
+ goto err_abort;
+
+ // Fatal OpenPGM internal error.
+ zmq_assert (false);
+ }
+
+ // Join IP multicast groups.
+ for (unsigned i = 0; i < res->ai_recv_addrs_len; i++) {
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_JOIN_GROUP,
+ &res->ai_recv_addrs [i], sizeof (struct group_req)))
+ goto err_abort;
+ }
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_SEND_GROUP,
+ &res->ai_send_addrs [0], sizeof (struct group_req)))
+ goto err_abort;
+
+ pgm_freeaddrinfo (res);
+ res = NULL;
+
+ // Set IP level parameters.
+ {
+ // Multicast loopback disabled by default
+ const int multicast_loop = 0;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_LOOP,
+ &multicast_loop, sizeof (multicast_loop)))
+ goto err_abort;
+
+ const int multicast_hops = options.multicast_hops;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_HOPS,
+ &multicast_hops, sizeof (multicast_hops)))
+ goto err_abort;
+
+ // Expedited Forwarding PHB for network elements, no ECN.
+ // Ignore return value due to varied runtime support.
+ const int dscp = 0x2e << 2;
+ if (AF_INET6 != sa_family)
+ pgm_setsockopt (sock, IPPROTO_PGM, PGM_TOS,
+ &dscp, sizeof (dscp));
+
+ const int nonblocking = 1;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_NOBLOCK,
+ &nonblocking, sizeof (nonblocking)))
+ goto err_abort;
+ }
+
+ // Connect PGM transport to start state machine.
+ if (!pgm_connect (sock, &pgm_error)) {
+
+ // Invalid parameters don't set pgm_error_t.
+ zmq_assert (pgm_error != NULL);
+ goto err_abort;
+ }
+
+ // For receiver transport preallocate pgm_msgv array.
+ if (receiver) {
+ zmq_assert (in_batch_size > 0);
+ size_t max_tsdu_size = get_max_tsdu_size ();
+ pgm_msgv_len = (int) in_batch_size / max_tsdu_size;
+ if ((int) in_batch_size % max_tsdu_size)
+ pgm_msgv_len++;
+ zmq_assert (pgm_msgv_len);
+
+ pgm_msgv = (pgm_msgv_t*) malloc (sizeof (pgm_msgv_t) * pgm_msgv_len);
+ alloc_assert (pgm_msgv);
+ }
+
+ return 0;
+
+err_abort:
+ if (sock != NULL) {
+ pgm_close (sock, FALSE);
+ sock = NULL;
+ }
+ if (res != NULL) {
+ pgm_freeaddrinfo (res);
+ res = NULL;
+ }
+ if (pgm_error != NULL) {
+ pgm_error_free (pgm_error);
+ pgm_error = NULL;
+ }
+ errno = EINVAL;
+ return -1;
+}
+
+zmq::pgm_socket_t::~pgm_socket_t ()
+{
+ if (pgm_msgv)
+ free (pgm_msgv);
+ if (sock)
+ pgm_close (sock, TRUE);
+}
+
+// Get receiver fds. receive_fd_ is signaled for incoming packets,
+// waiting_pipe_fd_ is signaled for state driven events and data.
+void zmq::pgm_socket_t::get_receiver_fds (fd_t *receive_fd_,
+ fd_t *waiting_pipe_fd_)
+{
+ socklen_t socklen;
+ bool rc;
+
+ zmq_assert (receive_fd_);
+ zmq_assert (waiting_pipe_fd_);
+
+ socklen = sizeof (*receive_fd_);
+ rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_RECV_SOCK, receive_fd_,
+ &socklen);
+ zmq_assert (rc);
+ zmq_assert (socklen == sizeof (*receive_fd_));
+
+ socklen = sizeof (*waiting_pipe_fd_);
+ rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_PENDING_SOCK, waiting_pipe_fd_,
+ &socklen);
+ zmq_assert (rc);
+ zmq_assert (socklen == sizeof (*waiting_pipe_fd_));
+}
+
+// Get fds and store them into user allocated memory.
+// send_fd is for non-blocking send wire notifications.
+// receive_fd_ is for incoming back-channel protocol packets.
+// rdata_notify_fd_ is raised for waiting repair transmissions.
+// pending_notify_fd_ is for state driven events.
+void zmq::pgm_socket_t::get_sender_fds (fd_t *send_fd_, fd_t *receive_fd_,
+ fd_t *rdata_notify_fd_, fd_t *pending_notify_fd_)
+{
+ socklen_t socklen;
+ bool rc;
+
+ zmq_assert (send_fd_);
+ zmq_assert (receive_fd_);
+ zmq_assert (rdata_notify_fd_);
+ zmq_assert (pending_notify_fd_);
+
+ socklen = sizeof (*send_fd_);
+ rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_SEND_SOCK, send_fd_, &socklen);
+ zmq_assert (rc);
+ zmq_assert (socklen == sizeof (*receive_fd_));
+
+ socklen = sizeof (*receive_fd_);
+ rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_RECV_SOCK, receive_fd_,
+ &socklen);
+ zmq_assert (rc);
+ zmq_assert (socklen == sizeof (*receive_fd_));
+
+ socklen = sizeof (*rdata_notify_fd_);
+ rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_REPAIR_SOCK, rdata_notify_fd_,
+ &socklen);
+ zmq_assert (rc);
+ zmq_assert (socklen == sizeof (*rdata_notify_fd_));
+
+ socklen = sizeof (*pending_notify_fd_);
+ rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_PENDING_SOCK,
+ pending_notify_fd_, &socklen);
+ zmq_assert (rc);
+ zmq_assert (socklen == sizeof (*pending_notify_fd_));
+}
+
+// Send one APDU, transmit window owned memory.
+// data_len_ must be less than one TPDU.
+size_t zmq::pgm_socket_t::send (unsigned char *data_, size_t data_len_)
+{
+ size_t nbytes = 0;
+
+ const int status = pgm_send (sock, data_, data_len_, &nbytes);
+
+ // We have to write all data as one packet.
+ if (nbytes > 0) {
+ zmq_assert (status == PGM_IO_STATUS_NORMAL);
+ zmq_assert (nbytes == data_len_);
+ }
+ else {
+ zmq_assert (status == PGM_IO_STATUS_RATE_LIMITED ||
+ status == PGM_IO_STATUS_WOULD_BLOCK);
+
+ if (status == PGM_IO_STATUS_RATE_LIMITED)
+ errno = ENOMEM;
+ else
+ errno = EBUSY;
+ }
+
+ // Save return value.
+ last_tx_status = status;
+
+ return nbytes;
+}
+
+long zmq::pgm_socket_t::get_rx_timeout ()
+{
+ if (last_rx_status != PGM_IO_STATUS_RATE_LIMITED &&
+ last_rx_status != PGM_IO_STATUS_TIMER_PENDING)
+ return -1;
+
+ struct timeval tv;
+ socklen_t optlen = sizeof (tv);
+ const bool rc = pgm_getsockopt (sock, IPPROTO_PGM,
+ last_rx_status == PGM_IO_STATUS_RATE_LIMITED ? PGM_RATE_REMAIN :
+ PGM_TIME_REMAIN, &tv, &optlen);
+ zmq_assert (rc);
+
+ const long timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+
+ return timeout;
+}
+
+long zmq::pgm_socket_t::get_tx_timeout ()
+{
+ if (last_tx_status != PGM_IO_STATUS_RATE_LIMITED)
+ return -1;
+
+ struct timeval tv;
+ socklen_t optlen = sizeof (tv);
+ const bool rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv,
+ &optlen);
+ zmq_assert (rc);
+
+ const long timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+
+ return timeout;
+}
+
+// Return max TSDU size without fragmentation from current PGM transport.
+size_t zmq::pgm_socket_t::get_max_tsdu_size ()
+{
+ int max_tsdu = 0;
+ socklen_t optlen = sizeof (max_tsdu);
+
+ bool rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_MSS, &max_tsdu, &optlen);
+ zmq_assert (rc);
+ zmq_assert (optlen == sizeof (max_tsdu));
+ return (size_t) max_tsdu;
+}
+
+// pgm_recvmsgv is called to fill the pgm_msgv array up to pgm_msgv_len.
+// In subsequent calls data from pgm_msgv structure are returned.
+ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
+{
+ size_t raw_data_len = 0;
+
+ // We just sent all data from pgm_transport_recvmsgv up
+ // and have to return 0 that another engine in this thread is scheduled.
+ if (nbytes_rec == nbytes_processed && nbytes_rec > 0) {
+
+ // Reset all the counters.
+ nbytes_rec = 0;
+ nbytes_processed = 0;
+ pgm_msgv_processed = 0;
+ errno = EAGAIN;
+ return 0;
+ }
+
+ // If we have are going first time or if we have processed all pgm_msgv_t
+ // structure previously read from the pgm socket.
+ if (nbytes_rec == nbytes_processed) {
+
+ // Check program flow.
+ zmq_assert (pgm_msgv_processed == 0);
+ zmq_assert (nbytes_processed == 0);
+ zmq_assert (nbytes_rec == 0);
+
+ // Receive a vector of Application Protocol Domain Unit's (APDUs)
+ // from the transport.
+ pgm_error_t *pgm_error = NULL;
+
+ const int status = pgm_recvmsgv (sock, pgm_msgv,
+ pgm_msgv_len, MSG_ERRQUEUE, &nbytes_rec, &pgm_error);
+
+ // Invalid parameters.
+ zmq_assert (status != PGM_IO_STATUS_ERROR);
+
+ last_rx_status = status;
+
+ // In a case when no ODATA/RDATA fired POLLIN event (SPM...)
+ // pgm_recvmsg returns PGM_IO_STATUS_TIMER_PENDING.
+ if (status == PGM_IO_STATUS_TIMER_PENDING) {
+
+ zmq_assert (nbytes_rec == 0);
+
+ // In case if no RDATA/ODATA caused POLLIN 0 is
+ // returned.
+ nbytes_rec = 0;
+ errno = EBUSY;
+ return 0;
+ }
+
+ // Send SPMR, NAK, ACK is rate limited.
+ if (status == PGM_IO_STATUS_RATE_LIMITED) {
+
+ zmq_assert (nbytes_rec == 0);
+
+ // In case if no RDATA/ODATA caused POLLIN 0 is returned.
+ nbytes_rec = 0;
+ errno = ENOMEM;
+ return 0;
+ }
+
+ // No peers and hence no incoming packets.
+ if (status == PGM_IO_STATUS_WOULD_BLOCK) {
+
+ zmq_assert (nbytes_rec == 0);
+
+ // In case if no RDATA/ODATA caused POLLIN 0 is returned.
+ nbytes_rec = 0;
+ errno = EAGAIN;
+ return 0;
+ }
+
+ // Data loss.
+ if (status == PGM_IO_STATUS_RESET) {
+
+ struct pgm_sk_buff_t* skb = pgm_msgv [0].msgv_skb [0];
+
+ // Save lost data TSI.
+ *tsi_ = &skb->tsi;
+ nbytes_rec = 0;
+
+ // In case of dala loss -1 is returned.
+ errno = EINVAL;
+ pgm_free_skb (skb);
+ return -1;
+ }
+
+ zmq_assert (status == PGM_IO_STATUS_NORMAL);
+ }
+ else
+ {
+ zmq_assert (pgm_msgv_processed <= pgm_msgv_len);
+ }
+
+ // Zero byte payloads are valid in PGM, but not 0MQ protocol.
+ zmq_assert (nbytes_rec > 0);
+
+ // Only one APDU per pgm_msgv_t structure is allowed.
+ zmq_assert (pgm_msgv [pgm_msgv_processed].msgv_len == 1);
+
+ struct pgm_sk_buff_t* skb =
+ pgm_msgv [pgm_msgv_processed].msgv_skb [0];
+
+ // Take pointers from pgm_msgv_t structure.
+ *raw_data_ = skb->data;
+ raw_data_len = skb->len;
+
+ // Save current TSI.
+ *tsi_ = &skb->tsi;
+
+ // Move the the next pgm_msgv_t structure.
+ pgm_msgv_processed++;
+ zmq_assert (pgm_msgv_processed <= pgm_msgv_len);
+ nbytes_processed +=raw_data_len;
+
+ return raw_data_len;
+}
+
+void zmq::pgm_socket_t::process_upstream ()
+{
+ pgm_msgv_t dummy_msg;
+
+ size_t dummy_bytes = 0;
+ pgm_error_t *pgm_error = NULL;
+
+ const int status = pgm_recvmsgv (sock, &dummy_msg,
+ 1, MSG_ERRQUEUE, &dummy_bytes, &pgm_error);
+
+ // Invalid parameters.
+ zmq_assert (status != PGM_IO_STATUS_ERROR);
+
+ // No data should be returned.
+ zmq_assert (dummy_bytes == 0 && (status == PGM_IO_STATUS_TIMER_PENDING ||
+ status == PGM_IO_STATUS_RATE_LIMITED ||
+ status == PGM_IO_STATUS_WOULD_BLOCK));
+
+ last_rx_status = status;
+
+ if (status == PGM_IO_STATUS_TIMER_PENDING)
+ errno = EBUSY;
+ else
+ if (status == PGM_IO_STATUS_RATE_LIMITED)
+ errno = ENOMEM;
+ else
+ errno = EAGAIN;
+}
+
+int zmq::pgm_socket_t::compute_sqns (int tpdu_)
+{
+ // Convert rate into B/ms.
+ uint64_t rate = uint64_t (options.rate) / 8;
+
+ // Compute the size of the buffer in bytes.
+ uint64_t size = uint64_t (options.recovery_ivl) * rate;
+
+ // Translate the size into number of packets.
+ uint64_t sqns = size / tpdu_;
+
+ // Buffer should be able to hold at least one packet.
+ if (sqns == 0)
+ sqns = 1;
+
+ return (int) sqns;
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_socket.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_socket.hpp
new file mode 100644
index 00000000..c180f488
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pgm_socket.hpp
@@ -0,0 +1,131 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __PGM_SOCKET_HPP_INCLUDED__
+#define __PGM_SOCKET_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_OPENPGM
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#define __PGM_WININT_H__
+#endif
+
+#include <pgm/pgm.h>
+
+#ifdef ZMQ_HAVE_OSX
+#include <pgm/in.h>
+#endif
+
+#include "fd.hpp"
+#include "options.hpp"
+
+namespace zmq
+{
+ // Encapsulates PGM socket.
+ class pgm_socket_t
+ {
+
+ public:
+
+ // If receiver_ is true PGM transport is not generating SPM packets.
+ pgm_socket_t (bool receiver_, const options_t &options_);
+
+ // Closes the transport.
+ ~pgm_socket_t ();
+
+ // Initialize PGM network structures (GSI, GSRs).
+ int init (bool udp_encapsulation_, const char *network_);
+
+ // Resolve PGM socket address.
+ static int init_address(const char *network_, struct pgm_addrinfo_t **addr, uint16_t *port_number);
+
+ // Get receiver fds and store them into user allocated memory.
+ void get_receiver_fds (fd_t *receive_fd_, fd_t *waiting_pipe_fd_);
+
+ // Get sender and receiver fds and store it to user allocated
+ // memory. Receive fd is used to process NAKs from peers.
+ void get_sender_fds (fd_t *send_fd_, fd_t *receive_fd_,
+ fd_t *rdata_notify_fd_, fd_t *pending_notify_fd_);
+
+ // Send data as one APDU, transmit window owned memory.
+ size_t send (unsigned char *data_, size_t data_len_);
+
+ // Returns max tsdu size without fragmentation.
+ size_t get_max_tsdu_size ();
+
+ // Receive data from pgm socket.
+ ssize_t receive (void **data_, const pgm_tsi_t **tsi_);
+
+ long get_rx_timeout ();
+ long get_tx_timeout ();
+
+ // POLLIN on sender side should mean NAK or SPMR receiving.
+ // process_upstream function is used to handle such a situation.
+ void process_upstream ();
+
+ private:
+
+ // Compute size of the buffer based on rate and recovery interval.
+ int compute_sqns (int tpdu_);
+
+ // OpenPGM transport.
+ pgm_sock_t* sock;
+
+ int last_rx_status, last_tx_status;
+
+ // Associated socket options.
+ options_t options;
+
+ // true when pgm_socket should create receiving side.
+ bool receiver;
+
+ // Array of pgm_msgv_t structures to store received data
+ // from the socket (pgm_transport_recvmsgv).
+ pgm_msgv_t *pgm_msgv;
+
+ // Size of pgm_msgv array.
+ size_t pgm_msgv_len;
+
+ // How many bytes were read from pgm socket.
+ size_t nbytes_rec;
+
+ // How many bytes were processed from last pgm socket read.
+ size_t nbytes_processed;
+
+ // How many messages from pgm_msgv were already sent up.
+ size_t pgm_msgv_processed;
+ };
+}
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pipe.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pipe.cpp
new file mode 100644
index 00000000..8d983604
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pipe.cpp
@@ -0,0 +1,519 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <new>
+#include <stddef.h>
+
+#include "pipe.hpp"
+#include "err.hpp"
+
+#include "ypipe.hpp"
+#include "ypipe_conflate.hpp"
+
+int zmq::pipepair (class object_t *parents_ [2], class pipe_t* pipes_ [2],
+ int hwms_ [2], bool conflate_ [2])
+{
+ // Creates two pipe objects. These objects are connected by two ypipes,
+ // each to pass messages in one direction.
+
+ typedef ypipe_t <msg_t, message_pipe_granularity> upipe_normal_t;
+ typedef ypipe_conflate_t <msg_t> upipe_conflate_t;
+
+ pipe_t::upipe_t *upipe1;
+ if(conflate_ [0])
+ upipe1 = new (std::nothrow) upipe_conflate_t ();
+ else
+ upipe1 = new (std::nothrow) upipe_normal_t ();
+ alloc_assert (upipe1);
+
+ pipe_t::upipe_t *upipe2;
+ if(conflate_ [1])
+ upipe2 = new (std::nothrow) upipe_conflate_t ();
+ else
+ upipe2 = new (std::nothrow) upipe_normal_t ();
+ alloc_assert (upipe2);
+
+ pipes_ [0] = new (std::nothrow) pipe_t (parents_ [0], upipe1, upipe2,
+ hwms_ [1], hwms_ [0], conflate_ [0]);
+ alloc_assert (pipes_ [0]);
+ pipes_ [1] = new (std::nothrow) pipe_t (parents_ [1], upipe2, upipe1,
+ hwms_ [0], hwms_ [1], conflate_ [1]);
+ alloc_assert (pipes_ [1]);
+
+ pipes_ [0]->set_peer (pipes_ [1]);
+ pipes_ [1]->set_peer (pipes_ [0]);
+
+ return 0;
+}
+
+zmq::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_,
+ int inhwm_, int outhwm_, bool conflate_) :
+ object_t (parent_),
+ inpipe (inpipe_),
+ outpipe (outpipe_),
+ in_active (true),
+ out_active (true),
+ hwm (outhwm_),
+ lwm (compute_lwm (inhwm_)),
+ msgs_read (0),
+ msgs_written (0),
+ peers_msgs_read (0),
+ peer (NULL),
+ sink (NULL),
+ state (active),
+ delay (true),
+ conflate (conflate_)
+{
+}
+
+zmq::pipe_t::~pipe_t ()
+{
+}
+
+void zmq::pipe_t::set_peer (pipe_t *peer_)
+{
+ // Peer can be set once only.
+ zmq_assert (!peer);
+ peer = peer_;
+}
+
+void zmq::pipe_t::set_event_sink (i_pipe_events *sink_)
+{
+ // Sink can be set once only.
+ zmq_assert (!sink);
+ sink = sink_;
+}
+
+void zmq::pipe_t::set_identity (const blob_t &identity_)
+{
+ identity = identity_;
+}
+
+zmq::blob_t zmq::pipe_t::get_identity ()
+{
+ return identity;
+}
+
+zmq::blob_t zmq::pipe_t::get_credential () const
+{
+ return credential;
+}
+
+bool zmq::pipe_t::check_read ()
+{
+ if (unlikely (!in_active))
+ return false;
+ if (unlikely (state != active && state != waiting_for_delimiter))
+ return false;
+
+ // Check if there's an item in the pipe.
+ if (!inpipe->check_read ()) {
+ in_active = false;
+ return false;
+ }
+
+ // If the next item in the pipe is message delimiter,
+ // initiate termination process.
+ if (inpipe->probe (is_delimiter)) {
+ msg_t msg;
+ bool ok = inpipe->read (&msg);
+ zmq_assert (ok);
+ process_delimiter ();
+ return false;
+ }
+
+ return true;
+}
+
+bool zmq::pipe_t::read (msg_t *msg_)
+{
+ if (unlikely (!in_active))
+ return false;
+ if (unlikely (state != active && state != waiting_for_delimiter))
+ return false;
+
+read_message:
+ if (!inpipe->read (msg_)) {
+ in_active = false;
+ return false;
+ }
+
+ // If this is a credential, save a copy and receive next message.
+ if (unlikely (msg_->is_credential ())) {
+ const unsigned char *data = static_cast <const unsigned char *> (msg_->data ());
+ credential = blob_t (data, msg_->size ());
+ const int rc = msg_->close ();
+ zmq_assert (rc == 0);
+ goto read_message;
+ }
+
+ // If delimiter was read, start termination process of the pipe.
+ if (msg_->is_delimiter ()) {
+ process_delimiter ();
+ return false;
+ }
+
+ if (!(msg_->flags () & msg_t::more) && !msg_->is_identity ())
+ msgs_read++;
+
+ if (lwm > 0 && msgs_read % lwm == 0)
+ send_activate_write (peer, msgs_read);
+
+ return true;
+}
+
+bool zmq::pipe_t::check_write ()
+{
+ if (unlikely (!out_active || state != active))
+ return false;
+
+ bool full = hwm > 0 && msgs_written - peers_msgs_read == uint64_t (hwm);
+
+ if (unlikely (full)) {
+ out_active = false;
+ return false;
+ }
+
+ return true;
+}
+
+bool zmq::pipe_t::write (msg_t *msg_)
+{
+ if (unlikely (!check_write ()))
+ return false;
+
+ bool more = msg_->flags () & msg_t::more ? true : false;
+ const bool is_identity = msg_->is_identity ();
+ outpipe->write (*msg_, more);
+ if (!more && !is_identity)
+ msgs_written++;
+
+ return true;
+}
+
+void zmq::pipe_t::rollback ()
+{
+ // Remove incomplete message from the outbound pipe.
+ msg_t msg;
+ if (outpipe) {
+ while (outpipe->unwrite (&msg)) {
+ zmq_assert (msg.flags () & msg_t::more);
+ int rc = msg.close ();
+ errno_assert (rc == 0);
+ }
+ }
+}
+
+void zmq::pipe_t::flush ()
+{
+ // The peer does not exist anymore at this point.
+ if (state == term_ack_sent)
+ return;
+
+ if (outpipe && !outpipe->flush ())
+ send_activate_read (peer);
+}
+
+void zmq::pipe_t::process_activate_read ()
+{
+ if (!in_active && (state == active || state == waiting_for_delimiter)) {
+ in_active = true;
+ sink->read_activated (this);
+ }
+}
+
+void zmq::pipe_t::process_activate_write (uint64_t msgs_read_)
+{
+ // Remember the peers's message sequence number.
+ peers_msgs_read = msgs_read_;
+
+ if (!out_active && state == active) {
+ out_active = true;
+ sink->write_activated (this);
+ }
+}
+
+void zmq::pipe_t::process_hiccup (void *pipe_)
+{
+ // Destroy old outpipe. Note that the read end of the pipe was already
+ // migrated to this thread.
+ zmq_assert (outpipe);
+ outpipe->flush ();
+ msg_t msg;
+ while (outpipe->read (&msg)) {
+ if (!(msg.flags () & msg_t::more))
+ msgs_written--;
+ int rc = msg.close ();
+ errno_assert (rc == 0);
+ }
+ delete outpipe;
+
+ // Plug in the new outpipe.
+ zmq_assert (pipe_);
+ outpipe = (upipe_t*) pipe_;
+ out_active = true;
+
+ // If appropriate, notify the user about the hiccup.
+ if (state == active)
+ sink->hiccuped (this);
+}
+
+void zmq::pipe_t::process_pipe_term ()
+{
+ zmq_assert (state == active
+ || state == delimiter_received
+ || state == term_req_sent1);
+
+ // This is the simple case of peer-induced termination. If there are no
+ // more pending messages to read, or if the pipe was configured to drop
+ // pending messages, we can move directly to the term_ack_sent state.
+ // Otherwise we'll hang up in waiting_for_delimiter state till all
+ // pending messages are read.
+ if (state == active) {
+ if (delay)
+ state = waiting_for_delimiter;
+ else {
+ state = term_ack_sent;
+ outpipe = NULL;
+ send_pipe_term_ack (peer);
+ }
+ }
+
+ // Delimiter happened to arrive before the term command. Now we have the
+ // term command as well, so we can move straight to term_ack_sent state.
+ else
+ if (state == delimiter_received) {
+ state = term_ack_sent;
+ outpipe = NULL;
+ send_pipe_term_ack (peer);
+ }
+
+ // This is the case where both ends of the pipe are closed in parallel.
+ // We simply reply to the request by ack and continue waiting for our
+ // own ack.
+ else
+ if (state == term_req_sent1) {
+ state = term_req_sent2;
+ outpipe = NULL;
+ send_pipe_term_ack (peer);
+ }
+}
+
+void zmq::pipe_t::process_pipe_term_ack ()
+{
+ // Notify the user that all the references to the pipe should be dropped.
+ zmq_assert (sink);
+ sink->pipe_terminated (this);
+
+ // In term_ack_sent and term_req_sent2 states there's nothing to do.
+ // Simply deallocate the pipe. In term_req_sent1 state we have to ack
+ // the peer before deallocating this side of the pipe.
+ // All the other states are invalid.
+ if (state == term_req_sent1) {
+ outpipe = NULL;
+ send_pipe_term_ack (peer);
+ }
+ else
+ zmq_assert (state == term_ack_sent || state == term_req_sent2);
+
+ // We'll deallocate the inbound pipe, the peer will deallocate the outbound
+ // pipe (which is an inbound pipe from its point of view).
+ // First, delete all the unread messages in the pipe. We have to do it by
+ // hand because msg_t doesn't have automatic destructor. Then deallocate
+ // the ypipe itself.
+
+ if (!conflate) {
+ msg_t msg;
+ while (inpipe->read (&msg)) {
+ int rc = msg.close ();
+ errno_assert (rc == 0);
+ }
+ }
+
+ delete inpipe;
+
+ // Deallocate the pipe object
+ delete this;
+}
+
+void zmq::pipe_t::set_nodelay ()
+{
+ this->delay = false;
+}
+
+void zmq::pipe_t::terminate (bool delay_)
+{
+ // Overload the value specified at pipe creation.
+ delay = delay_;
+
+ // If terminate was already called, we can ignore the duplicit invocation.
+ if (state == term_req_sent1 || state == term_req_sent2)
+ return;
+
+ // If the pipe is in the final phase of async termination, it's going to
+ // closed anyway. No need to do anything special here.
+ else
+ if (state == term_ack_sent)
+ return;
+
+ // The simple sync termination case. Ask the peer to terminate and wait
+ // for the ack.
+ else
+ if (state == active) {
+ send_pipe_term (peer);
+ state = term_req_sent1;
+ }
+
+ // There are still pending messages available, but the user calls
+ // 'terminate'. We can act as if all the pending messages were read.
+ else
+ if (state == waiting_for_delimiter && !delay) {
+ outpipe = NULL;
+ send_pipe_term_ack (peer);
+ state = term_ack_sent;
+ }
+
+ // If there are pending messages still availabe, do nothing.
+ else
+ if (state == waiting_for_delimiter) {
+ }
+
+ // We've already got delimiter, but not term command yet. We can ignore
+ // the delimiter and ack synchronously terminate as if we were in
+ // active state.
+ else
+ if (state == delimiter_received) {
+ send_pipe_term (peer);
+ state = term_req_sent1;
+ }
+
+ // There are no other states.
+ else
+ zmq_assert (false);
+
+ // Stop outbound flow of messages.
+ out_active = false;
+
+ if (outpipe) {
+
+ // Drop any unfinished outbound messages.
+ rollback ();
+
+ // Write the delimiter into the pipe. Note that watermarks are not
+ // checked; thus the delimiter can be written even when the pipe is full.
+ msg_t msg;
+ msg.init_delimiter ();
+ outpipe->write (msg, false);
+ flush ();
+ }
+}
+
+bool zmq::pipe_t::is_delimiter (const msg_t &msg_)
+{
+ return msg_.is_delimiter ();
+}
+
+int zmq::pipe_t::compute_lwm (int hwm_)
+{
+ // Compute the low water mark. Following point should be taken
+ // into consideration:
+ //
+ // 1. LWM has to be less than HWM.
+ // 2. LWM cannot be set to very low value (such as zero) as after filling
+ // the queue it would start to refill only after all the messages are
+ // read from it and thus unnecessarily hold the progress back.
+ // 3. LWM cannot be set to very high value (such as HWM-1) as it would
+ // result in lock-step filling of the queue - if a single message is
+ // read from a full queue, writer thread is resumed to write exactly one
+ // message to the queue and go back to sleep immediately. This would
+ // result in low performance.
+ //
+ // Given the 3. it would be good to keep HWM and LWM as far apart as
+ // possible to reduce the thread switching overhead to almost zero,
+ // say HWM-LWM should be max_wm_delta.
+ //
+ // That done, we still we have to account for the cases where
+ // HWM < max_wm_delta thus driving LWM to negative numbers.
+ // Let's make LWM 1/2 of HWM in such cases.
+ int result = (hwm_ > max_wm_delta * 2) ?
+ hwm_ - max_wm_delta : (hwm_ + 1) / 2;
+
+ return result;
+}
+
+void zmq::pipe_t::process_delimiter ()
+{
+ zmq_assert (state == active
+ || state == waiting_for_delimiter);
+
+ if (state == active)
+ state = delimiter_received;
+ else {
+ outpipe = NULL;
+ send_pipe_term_ack (peer);
+ state = term_ack_sent;
+ }
+}
+
+void zmq::pipe_t::hiccup ()
+{
+ // If termination is already under way do nothing.
+ if (state != active)
+ return;
+
+ // We'll drop the pointer to the inpipe. From now on, the peer is
+ // responsible for deallocating it.
+ inpipe = NULL;
+
+ // Create new inpipe.
+ if (conflate)
+ inpipe = new (std::nothrow)
+ ypipe_conflate_t <msg_t> ();
+ else
+ inpipe = new (std::nothrow)
+ ypipe_t <msg_t, message_pipe_granularity> ();
+
+ alloc_assert (inpipe);
+ in_active = true;
+
+ // Notify the peer about the hiccup.
+ send_hiccup (peer, (void*) inpipe);
+}
+
+void zmq::pipe_t::set_hwms (int inhwm_, int outhwm_)
+{
+ lwm = compute_lwm (inhwm_);
+ hwm = outhwm_;
+}
+
+bool zmq::pipe_t::check_hwm () const
+{
+ bool full = hwm > 0 && msgs_written - peers_msgs_read >= uint64_t (hwm - 1);
+ return( !full );
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pipe.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pipe.hpp
new file mode 100644
index 00000000..b7d7f8f4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pipe.hpp
@@ -0,0 +1,233 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PIPE_HPP_INCLUDED__
+#define __ZMQ_PIPE_HPP_INCLUDED__
+
+#include "msg.hpp"
+#include "ypipe_base.hpp"
+#include "config.hpp"
+#include "object.hpp"
+#include "stdint.hpp"
+#include "array.hpp"
+#include "blob.hpp"
+
+namespace zmq
+{
+
+ class object_t;
+ class pipe_t;
+
+ // Create a pipepair for bi-directional transfer of messages.
+ // First HWM is for messages passed from first pipe to the second pipe.
+ // Second HWM is for messages passed from second pipe to the first pipe.
+ // Delay specifies how the pipe behaves when the peer terminates. If true
+ // pipe receives all the pending messages before terminating, otherwise it
+ // terminates straight away.
+ // If conflate is true, only the most recently arrived message could be
+ // read (older messages are discarded)
+ int pipepair (zmq::object_t *parents_ [2], zmq::pipe_t* pipes_ [2],
+ int hwms_ [2], bool conflate_ [2]);
+
+ struct i_pipe_events
+ {
+ virtual ~i_pipe_events () {}
+
+ virtual void read_activated (zmq::pipe_t *pipe_) = 0;
+ virtual void write_activated (zmq::pipe_t *pipe_) = 0;
+ virtual void hiccuped (zmq::pipe_t *pipe_) = 0;
+ virtual void pipe_terminated (zmq::pipe_t *pipe_) = 0;
+ };
+
+ // Note that pipe can be stored in three different arrays.
+ // The array of inbound pipes (1), the array of outbound pipes (2) and
+ // the generic array of pipes to deallocate (3).
+
+ class pipe_t :
+ public object_t,
+ public array_item_t <1>,
+ public array_item_t <2>,
+ public array_item_t <3>
+ {
+ // This allows pipepair to create pipe objects.
+ friend int pipepair (zmq::object_t *parents_ [2], zmq::pipe_t* pipes_ [2],
+ int hwms_ [2], bool conflate_ [2]);
+
+ public:
+
+ // Specifies the object to send events to.
+ void set_event_sink (i_pipe_events *sink_);
+
+ // Pipe endpoint can store an opaque ID to be used by its clients.
+ void set_identity (const blob_t &identity_);
+ blob_t get_identity ();
+
+ blob_t get_credential () const;
+
+ // Returns true if there is at least one message to read in the pipe.
+ bool check_read ();
+
+ // Reads a message to the underlying pipe.
+ bool read (msg_t *msg_);
+
+ // Checks whether messages can be written to the pipe. If writing
+ // the message would cause high watermark the function returns false.
+ bool check_write ();
+
+ // Writes a message to the underlying pipe. Returns false if the
+ // message cannot be written because high watermark was reached.
+ bool write (msg_t *msg_);
+
+ // Remove unfinished parts of the outbound message from the pipe.
+ void rollback ();
+
+ // Flush the messages downsteam.
+ void flush ();
+
+ // Temporaraily disconnects the inbound message stream and drops
+ // all the messages on the fly. Causes 'hiccuped' event to be generated
+ // in the peer.
+ void hiccup ();
+
+ // Ensure the pipe wont block on receiving pipe_term.
+ void set_nodelay ();
+
+ // Ask pipe to terminate. The termination will happen asynchronously
+ // and user will be notified about actual deallocation by 'terminated'
+ // event. If delay is true, the pending messages will be processed
+ // before actual shutdown.
+ void terminate (bool delay_);
+
+ // set the high water marks.
+ void set_hwms (int inhwm_, int outhwm_);
+
+ // check HWM
+ bool check_hwm () const;
+ private:
+
+ // Type of the underlying lock-free pipe.
+ typedef ypipe_base_t <msg_t> upipe_t;
+
+ // Command handlers.
+ void process_activate_read ();
+ void process_activate_write (uint64_t msgs_read_);
+ void process_hiccup (void *pipe_);
+ void process_pipe_term ();
+ void process_pipe_term_ack ();
+
+ // Handler for delimiter read from the pipe.
+ void process_delimiter ();
+
+ // Constructor is private. Pipe can only be created using
+ // pipepair function.
+ pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_,
+ int inhwm_, int outhwm_, bool conflate_);
+
+ // Pipepair uses this function to let us know about
+ // the peer pipe object.
+ void set_peer (pipe_t *pipe_);
+
+ // Destructor is private. Pipe objects destroy themselves.
+ ~pipe_t ();
+
+ // Underlying pipes for both directions.
+ upipe_t *inpipe;
+ upipe_t *outpipe;
+
+ // Can the pipe be read from / written to?
+ bool in_active;
+ bool out_active;
+
+ // High watermark for the outbound pipe.
+ int hwm;
+
+ // Low watermark for the inbound pipe.
+ int lwm;
+
+ // Number of messages read and written so far.
+ uint64_t msgs_read;
+ uint64_t msgs_written;
+
+ // Last received peer's msgs_read. The actual number in the peer
+ // can be higher at the moment.
+ uint64_t peers_msgs_read;
+
+ // The pipe object on the other side of the pipepair.
+ pipe_t *peer;
+
+ // Sink to send events to.
+ i_pipe_events *sink;
+
+ // States of the pipe endpoint:
+ // active: common state before any termination begins,
+ // delimiter_received: delimiter was read from pipe before
+ // term command was received,
+ // waiting_fo_delimiter: term command was already received
+ // from the peer but there are still pending messages to read,
+ // term_ack_sent: all pending messages were already read and
+ // all we are waiting for is ack from the peer,
+ // term_req_sent1: 'terminate' was explicitly called by the user,
+ // term_req_sent2: user called 'terminate' and then we've got
+ // term command from the peer as well.
+ enum {
+ active,
+ delimiter_received,
+ waiting_for_delimiter,
+ term_ack_sent,
+ term_req_sent1,
+ term_req_sent2
+ } state;
+
+ // If true, we receive all the pending inbound messages before
+ // terminating. If false, we terminate immediately when the peer
+ // asks us to.
+ bool delay;
+
+ // Identity of the writer. Used uniquely by the reader side.
+ blob_t identity;
+
+ // Pipe's credential.
+ blob_t credential;
+
+ // Returns true if the message is delimiter; false otherwise.
+ static bool is_delimiter (const msg_t &msg_);
+
+ // Computes appropriate low watermark from the given high watermark.
+ static int compute_lwm (int hwm_);
+
+ const bool conflate;
+
+ // Disable copying.
+ pipe_t (const pipe_t&);
+ const pipe_t &operator = (const pipe_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_client.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_client.cpp
new file mode 100644
index 00000000..04be39f3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_client.cpp
@@ -0,0 +1,222 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <string>
+
+#include "msg.hpp"
+#include "err.hpp"
+#include "plain_client.hpp"
+
+zmq::plain_client_t::plain_client_t (const options_t &options_) :
+ mechanism_t (options_),
+ state (sending_hello)
+{
+}
+
+zmq::plain_client_t::~plain_client_t ()
+{
+}
+
+int zmq::plain_client_t::next_handshake_command (msg_t *msg_)
+{
+ int rc = 0;
+
+ switch (state) {
+ case sending_hello:
+ rc = produce_hello (msg_);
+ if (rc == 0)
+ state = waiting_for_welcome;
+ break;
+ case sending_initiate:
+ rc = produce_initiate (msg_);
+ if (rc == 0)
+ state = waiting_for_ready;
+ break;
+ default:
+ errno = EAGAIN;
+ rc = -1;
+ }
+ return rc;
+}
+
+int zmq::plain_client_t::process_handshake_command (msg_t *msg_)
+{
+ const unsigned char *cmd_data =
+ static_cast <unsigned char *> (msg_->data ());
+ const size_t data_size = msg_->size ();
+
+ int rc = 0;
+ if (data_size >= 8 && !memcmp (cmd_data, "\7WELCOME", 8))
+ rc = process_welcome (cmd_data, data_size);
+ else
+ if (data_size >= 6 && !memcmp (cmd_data, "\5READY", 6))
+ rc = process_ready (cmd_data, data_size);
+ else
+ if (data_size >= 6 && !memcmp (cmd_data, "\5ERROR", 6))
+ rc = process_error (cmd_data, data_size);
+ else {
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid handshake command");
+ errno = EPROTO;
+ rc = -1;
+ }
+
+ if (rc == 0) {
+ rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ }
+
+ return rc;
+}
+
+zmq::mechanism_t::status_t zmq::plain_client_t::status () const
+{
+ if (state == ready)
+ return mechanism_t::ready;
+ else
+ if (state == error_command_received)
+ return mechanism_t::error;
+ else
+ return mechanism_t::handshaking;
+}
+
+int zmq::plain_client_t::produce_hello (msg_t *msg_) const
+{
+ const std::string username = options.plain_username;
+ zmq_assert (username.length () < 256);
+
+ const std::string password = options.plain_password;
+ zmq_assert (password.length () < 256);
+
+ const size_t command_size = 6 + 1 + username.length ()
+ + 1 + password.length ();
+
+ const int rc = msg_->init_size (command_size);
+ errno_assert (rc == 0);
+
+ unsigned char *ptr = static_cast <unsigned char *> (msg_->data ());
+ memcpy (ptr, "\x05HELLO", 6);
+ ptr += 6;
+
+ *ptr++ = static_cast <unsigned char> (username.length ());
+ memcpy (ptr, username.c_str (), username.length ());
+ ptr += username.length ();
+
+ *ptr++ = static_cast <unsigned char> (password.length ());
+ memcpy (ptr, password.c_str (), password.length ());
+ ptr += password.length ();
+
+ return 0;
+}
+
+int zmq::plain_client_t::process_welcome (
+ const unsigned char *cmd_data, size_t data_size)
+{
+ if (state != waiting_for_welcome) {
+ errno = EPROTO;
+ return -1;
+ }
+ if (data_size != 8) {
+ errno = EPROTO;
+ return -1;
+ }
+ state = sending_initiate;
+ return 0;
+}
+
+int zmq::plain_client_t::produce_initiate (msg_t *msg_) const
+{
+ unsigned char * const command_buffer = (unsigned char *) malloc (512);
+ alloc_assert (command_buffer);
+
+ unsigned char *ptr = command_buffer;
+
+ // Add mechanism string
+ memcpy (ptr, "\x08INITIATE", 9);
+ ptr += 9;
+
+ // Add socket type property
+ const char *socket_type = socket_type_string (options.type);
+ ptr += add_property (ptr, "Socket-Type", socket_type, strlen (socket_type));
+
+ // Add identity property
+ if (options.type == ZMQ_REQ
+ || options.type == ZMQ_DEALER
+ || options.type == ZMQ_ROUTER)
+ ptr += add_property (
+ ptr, "Identity", options.identity, options.identity_size);
+
+ const size_t command_size = ptr - command_buffer;
+ const int rc = msg_->init_size (command_size);
+ errno_assert (rc == 0);
+ memcpy (msg_->data (), command_buffer, command_size);
+ free (command_buffer);
+
+ return 0;
+}
+
+int zmq::plain_client_t::process_ready (
+ const unsigned char *cmd_data, size_t data_size)
+{
+ if (state != waiting_for_ready) {
+ errno = EPROTO;
+ return -1;
+ }
+ const int rc = parse_metadata (cmd_data + 6, data_size - 6);
+ if (rc == 0)
+ state = ready;
+ return rc;
+}
+
+int zmq::plain_client_t::process_error (
+ const unsigned char *cmd_data, size_t data_size)
+{
+ if (state != waiting_for_welcome && state != waiting_for_ready) {
+ errno = EPROTO;
+ return -1;
+ }
+ if (data_size < 7) {
+ errno = EPROTO;
+ return -1;
+ }
+ const size_t error_reason_len = static_cast <size_t> (cmd_data [6]);
+ if (error_reason_len > data_size - 7) {
+ errno = EPROTO;
+ return -1;
+ }
+ state = error_command_received;
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_client.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_client.hpp
new file mode 100644
index 00000000..b00fe17a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_client.hpp
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PLAIN_CLIENT_HPP_INCLUDED__
+#define __ZMQ_PLAIN_CLIENT_HPP_INCLUDED__
+
+#include "mechanism.hpp"
+#include "options.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+
+ class plain_client_t : public mechanism_t
+ {
+ public:
+
+ plain_client_t (const options_t &options_);
+ virtual ~plain_client_t ();
+
+ // mechanism implementation
+ virtual int next_handshake_command (msg_t *msg_);
+ virtual int process_handshake_command (msg_t *msg_);
+ virtual status_t status () const;
+
+ private:
+
+ enum state_t {
+ sending_hello,
+ waiting_for_welcome,
+ sending_initiate,
+ waiting_for_ready,
+ error_command_received,
+ ready
+ };
+
+ state_t state;
+
+ int produce_hello (msg_t *msg_) const;
+ int produce_initiate (msg_t *msg_) const;
+
+ int process_welcome (
+ const unsigned char *cmd_data, size_t data_size);
+ int process_ready (
+ const unsigned char *cmd_data, size_t data_size);
+ int process_error (
+ const unsigned char *cmd_data, size_t data_size);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_server.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_server.cpp
new file mode 100644
index 00000000..bddd4071
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_server.cpp
@@ -0,0 +1,440 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include <string>
+
+#include "msg.hpp"
+#include "session_base.hpp"
+#include "err.hpp"
+#include "plain_server.hpp"
+#include "wire.hpp"
+
+zmq::plain_server_t::plain_server_t (session_base_t *session_,
+ const std::string &peer_address_,
+ const options_t &options_) :
+ mechanism_t (options_),
+ session (session_),
+ peer_address (peer_address_),
+ state (waiting_for_hello)
+{
+}
+
+zmq::plain_server_t::~plain_server_t ()
+{
+}
+
+int zmq::plain_server_t::next_handshake_command (msg_t *msg_)
+{
+ int rc = 0;
+
+ switch (state) {
+ case sending_welcome:
+ rc = produce_welcome (msg_);
+ if (rc == 0)
+ state = waiting_for_initiate;
+ break;
+ case sending_ready:
+ rc = produce_ready (msg_);
+ if (rc == 0)
+ state = ready;
+ break;
+ case sending_error:
+ rc = produce_error (msg_);
+ if (rc == 0)
+ state = error_command_sent;
+ break;
+ default:
+ errno = EAGAIN;
+ rc = -1;
+ }
+ return rc;
+}
+
+int zmq::plain_server_t::process_handshake_command (msg_t *msg_)
+{
+ int rc = 0;
+
+ switch (state) {
+ case waiting_for_hello:
+ rc = process_hello (msg_);
+ break;
+ case waiting_for_initiate:
+ rc = process_initiate (msg_);
+ break;
+ default:
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid handshake command");
+ errno = EPROTO;
+ rc = -1;
+ break;
+ }
+ if (rc == 0) {
+ rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ }
+ return rc;
+}
+
+zmq::mechanism_t::status_t zmq::plain_server_t::status () const
+{
+ if (state == ready)
+ return mechanism_t::ready;
+ else
+ if (state == error_command_sent)
+ return mechanism_t::error;
+ else
+ return mechanism_t::handshaking;
+}
+
+int zmq::plain_server_t::zap_msg_available ()
+{
+ if (state != waiting_for_zap_reply) {
+ errno = EFSM;
+ return -1;
+ }
+ const int rc = receive_and_process_zap_reply ();
+ if (rc == 0)
+ state = status_code == "200"
+ ? sending_welcome
+ : sending_error;
+ return rc;
+}
+
+int zmq::plain_server_t::process_hello (msg_t *msg_)
+{
+ const unsigned char *ptr = static_cast <unsigned char *> (msg_->data ());
+ size_t bytes_left = msg_->size ();
+
+ if (bytes_left < 6 || memcmp (ptr, "\x05HELLO", 6)) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid PLAIN client, did not send HELLO");
+ errno = EPROTO;
+ return -1;
+ }
+ ptr += 6;
+ bytes_left -= 6;
+
+ if (bytes_left < 1) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid PLAIN client, did not send username");
+ errno = EPROTO;
+ return -1;
+ }
+ const size_t username_length = static_cast <size_t> (*ptr++);
+ bytes_left -= 1;
+
+ if (bytes_left < username_length) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid PLAIN client, sent malformed username");
+ errno = EPROTO;
+ return -1;
+ }
+ const std::string username = std::string ((char *) ptr, username_length);
+ ptr += username_length;
+ bytes_left -= username_length;
+ if (bytes_left < 1) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid PLAIN client, did not send password");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const size_t password_length = static_cast <size_t> (*ptr++);
+ bytes_left -= 1;
+ if (bytes_left < password_length) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid PLAIN client, sent malformed password");
+ errno = EPROTO;
+ return -1;
+ }
+
+ const std::string password = std::string ((char *) ptr, password_length);
+ ptr += password_length;
+ bytes_left -= password_length;
+ if (bytes_left > 0) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid PLAIN client, sent extraneous data");
+ errno = EPROTO;
+ return -1;
+ }
+
+ // Use ZAP protocol (RFC 27) to authenticate the user.
+ int rc = session->zap_connect ();
+ if (rc == 0) {
+ send_zap_request (username, password);
+ rc = receive_and_process_zap_reply ();
+ if (rc == 0)
+ state = status_code == "200"
+ ? sending_welcome
+ : sending_error;
+ else
+ if (errno == EAGAIN)
+ state = waiting_for_zap_reply;
+ else
+ return -1;
+ }
+ else
+ state = sending_welcome;
+
+ return 0;
+}
+
+int zmq::plain_server_t::produce_welcome (msg_t *msg_) const
+{
+ const int rc = msg_->init_size (8);
+ errno_assert (rc == 0);
+ memcpy (msg_->data (), "\x07WELCOME", 8);
+ return 0;
+}
+
+int zmq::plain_server_t::process_initiate (msg_t *msg_)
+{
+ const unsigned char *ptr = static_cast <unsigned char *> (msg_->data ());
+ const size_t bytes_left = msg_->size ();
+
+ if (bytes_left < 9 || memcmp (ptr, "\x08INITIATE", 9)) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: invalid PLAIN client, did not send INITIATE");
+ errno = EPROTO;
+ return -1;
+ }
+ const int rc = parse_metadata (ptr + 9, bytes_left - 9);
+ if (rc == 0)
+ state = sending_ready;
+ return rc;
+}
+
+int zmq::plain_server_t::produce_ready (msg_t *msg_) const
+{
+ unsigned char * const command_buffer = (unsigned char *) malloc (512);
+ alloc_assert (command_buffer);
+
+ unsigned char *ptr = command_buffer;
+
+ // Add command name
+ memcpy (ptr, "\x05READY", 6);
+ ptr += 6;
+
+ // Add socket type property
+ const char *socket_type = socket_type_string (options.type);
+ ptr += add_property (ptr, "Socket-Type", socket_type, strlen (socket_type));
+
+ // Add identity property
+ if (options.type == ZMQ_REQ
+ || options.type == ZMQ_DEALER
+ || options.type == ZMQ_ROUTER)
+ ptr += add_property (
+ ptr, "Identity", options.identity, options.identity_size);
+
+ const size_t command_size = ptr - command_buffer;
+ const int rc = msg_->init_size (command_size);
+ errno_assert (rc == 0);
+ memcpy (msg_->data (), command_buffer, command_size);
+ free (command_buffer);
+
+ return 0;
+}
+
+int zmq::plain_server_t::produce_error (msg_t *msg_) const
+{
+ zmq_assert (status_code.length () == 3);
+ const int rc = msg_->init_size (6 + 1 + status_code.length ());
+ zmq_assert (rc == 0);
+ char *msg_data = static_cast <char *> (msg_->data ());
+ memcpy (msg_data, "\5ERROR", 6);
+ msg_data [6] = status_code.length ();
+ memcpy (msg_data + 7, status_code.c_str (), status_code.length ());
+ return 0;
+}
+
+void zmq::plain_server_t::send_zap_request (const std::string &username,
+ const std::string &password)
+{
+ int rc;
+ msg_t msg;
+
+ // Address delimiter frame
+ rc = msg.init ();
+ errno_assert (rc == 0);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Version frame
+ rc = msg.init_size (3);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "1.0", 3);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Request id frame
+ rc = msg.init_size (1);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "1", 1);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Domain frame
+ rc = msg.init_size (options.zap_domain.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), options.zap_domain.c_str (), options.zap_domain.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Address frame
+ rc = msg.init_size (peer_address.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), peer_address.c_str (), peer_address.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Identity frame
+ rc = msg.init_size (options.identity_size);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), options.identity, options.identity_size);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Mechanism frame
+ rc = msg.init_size (5);
+ errno_assert (rc == 0);
+ memcpy (msg.data (), "PLAIN", 5);
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Username frame
+ rc = msg.init_size (username.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), username.c_str (), username.length ());
+ msg.set_flags (msg_t::more);
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+
+ // Password frame
+ rc = msg.init_size (password.length ());
+ errno_assert (rc == 0);
+ memcpy (msg.data (), password.c_str (), password.length ());
+ rc = session->write_zap_msg (&msg);
+ errno_assert (rc == 0);
+}
+
+int zmq::plain_server_t::receive_and_process_zap_reply ()
+{
+ int rc = 0;
+ msg_t msg [7]; // ZAP reply consists of 7 frames
+
+ // Initialize all reply frames
+ for (int i = 0; i < 7; i++) {
+ rc = msg [i].init ();
+ errno_assert (rc == 0);
+ }
+
+ for (int i = 0; i < 7; i++) {
+ rc = session->read_zap_msg (&msg [i]);
+ if (rc == -1)
+ break;
+ if ((msg [i].flags () & msg_t::more) == (i < 6? 0: msg_t::more)) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: ZAP handler sent incomplete reply message");
+ errno = EPROTO;
+ rc = -1;
+ break;
+ }
+ }
+
+ if (rc != 0)
+ goto error;
+
+ // Address delimiter frame
+ if (msg [0].size () > 0) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: ZAP handler sent malformed reply message");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Version frame
+ if (msg [1].size () != 3 || memcmp (msg [1].data (), "1.0", 3)) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: ZAP handler sent bad version number");
+ errno = EPROTO;
+ rc = -1;
+ goto error;
+ }
+
+ // Request id frame
+ if (msg [2].size () != 1 || memcmp (msg [2].data (), "1", 1)) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: ZAP handler sent bad request ID");
+ rc = -1;
+ errno = EPROTO;
+ goto error;
+ }
+
+ // Status code frame
+ if (msg [3].size () != 3) {
+ // Temporary support for security debugging
+ puts ("PLAIN I: ZAP handler rejected client authentication");
+ errno = EACCES;
+ rc = -1;
+ goto error;
+ }
+
+ // Save status code
+ status_code.assign (static_cast <char *> (msg [3].data ()), 3);
+
+ // Save user id
+ set_user_id (msg [5].data (), msg [5].size ());
+
+ // Process metadata frame
+ rc = parse_metadata (static_cast <const unsigned char*> (msg [6].data ()),
+ msg [6].size (), true);
+
+error:
+ for (int i = 0; i < 7; i++) {
+ const int rc2 = msg [i].close ();
+ errno_assert (rc2 == 0);
+ }
+
+ return rc;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_server.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_server.hpp
new file mode 100644
index 00000000..6cde4c71
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/plain_server.hpp
@@ -0,0 +1,93 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PLAIN_SERVER_HPP_INCLUDED__
+#define __ZMQ_PLAIN_SERVER_HPP_INCLUDED__
+
+#include "mechanism.hpp"
+#include "options.hpp"
+
+namespace zmq
+{
+
+ class msg_t;
+ class session_base_t;
+
+ class plain_server_t : public mechanism_t
+ {
+ public:
+
+ plain_server_t (session_base_t *session_,
+ const std::string &peer_address_,
+ const options_t &options_);
+ virtual ~plain_server_t ();
+
+ // mechanism implementation
+ virtual int next_handshake_command (msg_t *msg_);
+ virtual int process_handshake_command (msg_t *msg_);
+ virtual int zap_msg_available ();
+ virtual status_t status () const;
+
+ private:
+
+ enum state_t {
+ waiting_for_hello,
+ sending_welcome,
+ waiting_for_initiate,
+ sending_ready,
+ waiting_for_zap_reply,
+ sending_error,
+ error_command_sent,
+ ready
+ };
+
+ session_base_t * const session;
+
+ const std::string peer_address;
+
+ // Status code as received from ZAP handler
+ std::string status_code;
+
+ state_t state;
+
+ int produce_welcome (msg_t *msg_) const;
+ int produce_ready (msg_t *msg_) const;
+ int produce_error (msg_t *msg_) const;
+
+ int process_hello (msg_t *msg_);
+ int process_initiate (msg_t *msg_);
+
+ void send_zap_request (const std::string &username,
+ const std::string &password);
+ int receive_and_process_zap_reply ();
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/platform.hpp.in b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/platform.hpp.in
new file mode 100644
index 00000000..f7fcde39
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/platform.hpp.in
@@ -0,0 +1,296 @@
+/* src/platform.hpp.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <alloca.h> header file. */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the declaration of `LOCAL_PEERCRED', and to 0 if
+ you don't. */
+#undef HAVE_DECL_LOCAL_PEERCRED
+
+/* Define to 1 if you have the declaration of `SO_PEERCRED', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SO_PEERCRED
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `freeifaddrs' function. */
+#undef HAVE_FREEIFADDRS
+
+/* Define to 1 if you have the `gethrtime' function. */
+#undef HAVE_GETHRTIME
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#undef HAVE_GETIFADDRS
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#undef HAVE_IFADDRS_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `gssapi_krb5' library (-lgssapi_krb5). */
+#undef HAVE_LIBGSSAPI_KRB5
+
+/* Define to 1 if you have the `iphlpapi' library (-liphlpapi). */
+#undef HAVE_LIBIPHLPAPI
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#undef HAVE_LIBPTHREAD
+
+/* Define to 1 if you have the `rpcrt4' library (-lrpcrt4). */
+#undef HAVE_LIBRPCRT4
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#undef HAVE_LIBRT
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* The libsodium library is to be used. */
+#undef HAVE_LIBSODIUM
+
+/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
+#undef HAVE_LIBWS2_32
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#undef HAVE_NETINET_TCP_H
+
+/* Define to 1 if you have the `perror' function. */
+#undef HAVE_PERROR
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#undef HAVE_SYS_EVENTFD_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#undef HAVE_SYS_UIO_H
+
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Enable militant API assertions */
+#undef ZMQ_ACT_MILITANT
+
+/* Force to use mutexes */
+#undef ZMQ_FORCE_MUTEXES
+
+/* Have AIX OS */
+#undef ZMQ_HAVE_AIX
+
+/* Have Android OS */
+#undef ZMQ_HAVE_ANDROID
+
+/* Have Cygwin */
+#undef ZMQ_HAVE_CYGWIN
+
+/* Have eventfd extension. */
+#undef ZMQ_HAVE_EVENTFD
+
+/* Have FreeBSD OS */
+#undef ZMQ_HAVE_FREEBSD
+
+/* Have HPUX OS */
+#undef ZMQ_HAVE_HPUX
+
+/* Have ifaddrs.h header. */
+#undef ZMQ_HAVE_IFADDRS
+
+/* Have Linux OS */
+#undef ZMQ_HAVE_LINUX
+
+/* Have LOCAL_PEERCRED socket option */
+#undef ZMQ_HAVE_LOCAL_PEERCRED
+
+/* Have MinGW32 */
+#undef ZMQ_HAVE_MINGW32
+
+/* Have NetBSD OS */
+#undef ZMQ_HAVE_NETBSD
+
+/* Have NORM protocol extension */
+#undef ZMQ_HAVE_NORM
+
+/* Have OpenBSD OS */
+#undef ZMQ_HAVE_OPENBSD
+
+/* Have OpenPGM extension */
+#undef ZMQ_HAVE_OPENPGM
+
+/* Have DarwinOSX OS */
+#undef ZMQ_HAVE_OSX
+
+/* Have QNX Neutrino OS */
+#undef ZMQ_HAVE_QNXNTO
+
+/* Whether SOCK_CLOEXEC is defined and functioning. */
+#undef ZMQ_HAVE_SOCK_CLOEXEC
+
+/* Have Solaris OS */
+#undef ZMQ_HAVE_SOLARIS
+
+/* Whether SO_KEEPALIVE is supported. */
+#undef ZMQ_HAVE_SO_KEEPALIVE
+
+/* Have SO_PEERCRED socket option */
+#undef ZMQ_HAVE_SO_PEERCRED
+
+/* Whether TCP_KEEPALIVE is supported. */
+#undef ZMQ_HAVE_TCP_KEEPALIVE
+
+/* Whether TCP_KEEPCNT is supported. */
+#undef ZMQ_HAVE_TCP_KEEPCNT
+
+/* Whether TCP_KEEPIDLE is supported. */
+#undef ZMQ_HAVE_TCP_KEEPIDLE
+
+/* Whether TCP_KEEPINTVL is supported. */
+#undef ZMQ_HAVE_TCP_KEEPINTVL
+
+/* Have TIPC support */
+#undef ZMQ_HAVE_TIPC
+
+/* Have uio.h header. */
+#undef ZMQ_HAVE_UIO
+
+/* Have Windows OS */
+#undef ZMQ_HAVE_WINDOWS
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef ssize_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+ code using `volatile' can become incorrect without. Disable with care. */
+#undef volatile
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poll.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poll.cpp
new file mode 100644
index 00000000..74484e31
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poll.cpp
@@ -0,0 +1,190 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "poll.hpp"
+#if defined ZMQ_USE_POLL
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <poll.h>
+#include <algorithm>
+
+#include "poll.hpp"
+#include "err.hpp"
+#include "config.hpp"
+#include "i_poll_events.hpp"
+
+zmq::poll_t::poll_t (const zmq::ctx_t &ctx_) :
+ ctx(ctx_),
+ retired (false),
+ stopping (false)
+{
+}
+
+zmq::poll_t::~poll_t ()
+{
+ worker.stop ();
+}
+
+zmq::poll_t::handle_t zmq::poll_t::add_fd (fd_t fd_, i_poll_events *events_)
+{
+ // If the file descriptor table is too small expand it.
+ fd_table_t::size_type sz = fd_table.size ();
+ if (sz <= (fd_table_t::size_type) fd_) {
+ fd_table.resize (fd_ + 1);
+ while (sz != (fd_table_t::size_type) (fd_ + 1)) {
+ fd_table [sz].index = retired_fd;
+ ++sz;
+ }
+ }
+
+ pollfd pfd = {fd_, 0, 0};
+ pollset.push_back (pfd);
+ zmq_assert (fd_table [fd_].index == retired_fd);
+
+ fd_table [fd_].index = pollset.size() - 1;
+ fd_table [fd_].events = events_;
+
+ // Increase the load metric of the thread.
+ adjust_load (1);
+
+ return fd_;
+}
+
+void zmq::poll_t::rm_fd (handle_t handle_)
+{
+ fd_t index = fd_table [handle_].index;
+ zmq_assert (index != retired_fd);
+
+ // Mark the fd as unused.
+ pollset [index].fd = retired_fd;
+ fd_table [handle_].index = retired_fd;
+ retired = true;
+
+ // Decrease the load metric of the thread.
+ adjust_load (-1);
+}
+
+void zmq::poll_t::set_pollin (handle_t handle_)
+{
+ int index = fd_table [handle_].index;
+ pollset [index].events |= POLLIN;
+}
+
+void zmq::poll_t::reset_pollin (handle_t handle_)
+{
+ int index = fd_table [handle_].index;
+ pollset [index].events &= ~((short) POLLIN);
+}
+
+void zmq::poll_t::set_pollout (handle_t handle_)
+{
+ int index = fd_table [handle_].index;
+ pollset [index].events |= POLLOUT;
+}
+
+void zmq::poll_t::reset_pollout (handle_t handle_)
+{
+ int index = fd_table [handle_].index;
+ pollset [index].events &= ~((short) POLLOUT);
+}
+
+void zmq::poll_t::start ()
+{
+ ctx.start_thread (worker, worker_routine, this);
+}
+
+void zmq::poll_t::stop ()
+{
+ stopping = true;
+}
+
+int zmq::poll_t::max_fds ()
+{
+ return -1;
+}
+
+void zmq::poll_t::loop ()
+{
+ while (!stopping) {
+
+ // Execute any due timers.
+ int timeout = (int) execute_timers ();
+
+ // Wait for events.
+ int rc = poll (&pollset [0], pollset.size (), timeout ? timeout : -1);
+ if (rc == -1) {
+ errno_assert (errno == EINTR);
+ continue;
+ }
+
+ // If there are no events (i.e. it's a timeout) there's no point
+ // in checking the pollset.
+ if (rc == 0)
+ continue;
+
+ for (pollset_t::size_type i = 0; i != pollset.size (); i++) {
+
+ zmq_assert (!(pollset [i].revents & POLLNVAL));
+ if (pollset [i].fd == retired_fd)
+ continue;
+ if (pollset [i].revents & (POLLERR | POLLHUP))
+ fd_table [pollset [i].fd].events->in_event ();
+ if (pollset [i].fd == retired_fd)
+ continue;
+ if (pollset [i].revents & POLLOUT)
+ fd_table [pollset [i].fd].events->out_event ();
+ if (pollset [i].fd == retired_fd)
+ continue;
+ if (pollset [i].revents & POLLIN)
+ fd_table [pollset [i].fd].events->in_event ();
+ }
+
+ // Clean up the pollset and update the fd_table accordingly.
+ if (retired) {
+ pollset_t::size_type i = 0;
+ while (i < pollset.size ()) {
+ if (pollset [i].fd == retired_fd)
+ pollset.erase (pollset.begin () + i);
+ else {
+ fd_table [pollset [i].fd].index = i;
+ i ++;
+ }
+ }
+ retired = false;
+ }
+ }
+}
+
+void zmq::poll_t::worker_routine (void *arg_)
+{
+ ((poll_t*) arg_)->loop ();
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poll.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poll.hpp
new file mode 100644
index 00000000..227e51c7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poll.hpp
@@ -0,0 +1,119 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_POLL_HPP_INCLUDED__
+#define __ZMQ_POLL_HPP_INCLUDED__
+
+// poller.hpp decides which polling mechanism to use.
+#include "poller.hpp"
+#if defined ZMQ_USE_POLL
+
+#include <poll.h>
+#include <stddef.h>
+#include <vector>
+
+#include "ctx.hpp"
+#include "fd.hpp"
+#include "thread.hpp"
+#include "poller_base.hpp"
+
+namespace zmq
+{
+
+ struct i_poll_events;
+
+ // Implements socket polling mechanism using the POSIX.1-2001
+ // poll() system call.
+
+ class poll_t : public poller_base_t
+ {
+ public:
+
+ typedef fd_t handle_t;
+
+ poll_t (const ctx_t &ctx_);
+ ~poll_t ();
+
+ // "poller" concept.
+ handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ void rm_fd (handle_t handle_);
+ void set_pollin (handle_t handle_);
+ void reset_pollin (handle_t handle_);
+ void set_pollout (handle_t handle_);
+ void reset_pollout (handle_t handle_);
+ void start ();
+ void stop ();
+
+ static int max_fds ();
+
+ private:
+
+ // Main worker thread routine.
+ static void worker_routine (void *arg_);
+
+ // Main event loop.
+ void loop ();
+
+ // Reference to ZMQ context.
+ const ctx_t &ctx;
+
+ struct fd_entry_t
+ {
+ fd_t index;
+ zmq::i_poll_events *events;
+ };
+
+ // This table stores data for registered descriptors.
+ typedef std::vector <fd_entry_t> fd_table_t;
+ fd_table_t fd_table;
+
+ // Pollset to pass to the poll function.
+ typedef std::vector <pollfd> pollset_t;
+ pollset_t pollset;
+
+ // If true, there's at least one retired event source.
+ bool retired;
+
+ // If true, thread is in the process of shutting down.
+ bool stopping;
+
+ // Handle of the physical thread doing the I/O work.
+ thread_t worker;
+
+ poll_t (const poll_t&);
+ const poll_t &operator = (const poll_t&);
+ };
+
+ typedef poll_t poller_t;
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller.hpp
new file mode 100644
index 00000000..b91e551c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller.hpp
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_POLLER_HPP_INCLUDED__
+#define __ZMQ_POLLER_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_USE_KQUEUE + defined ZMQ_USE_EPOLL \
+ + defined ZMQ_USE_DEVPOLL + defined ZMQ_USE_POLL \
+ + defined ZMQ_USE_SELECT > 1
+#error More than one of the ZMQ_USE_* macros defined
+#endif
+
+#if defined ZMQ_USE_KQUEUE
+#include "kqueue.hpp"
+#elif defined ZMQ_USE_EPOLL
+#include "epoll.hpp"
+#elif defined ZMQ_USE_DEVPOLL
+#include "devpoll.hpp"
+#elif defined ZMQ_USE_POLL
+#include "poll.hpp"
+#elif defined ZMQ_USE_SELECT
+#include "select.hpp"
+#else
+#error None of the ZMQ_USE_* macros defined
+#endif
+
+#if defined ZMQ_USE_SELECT
+#define ZMQ_POLL_BASED_ON_SELECT
+#else
+#define ZMQ_POLL_BASED_ON_POLL
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller_base.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller_base.cpp
new file mode 100644
index 00000000..532d3072
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller_base.cpp
@@ -0,0 +1,109 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "poller_base.hpp"
+#include "i_poll_events.hpp"
+#include "err.hpp"
+
+zmq::poller_base_t::poller_base_t ()
+{
+}
+
+zmq::poller_base_t::~poller_base_t ()
+{
+ // Make sure there is no more load on the shutdown.
+ zmq_assert (get_load () == 0);
+}
+
+int zmq::poller_base_t::get_load ()
+{
+ return load.get ();
+}
+
+void zmq::poller_base_t::adjust_load (int amount_)
+{
+ if (amount_ > 0)
+ load.add (amount_);
+ else
+ if (amount_ < 0)
+ load.sub (-amount_);
+}
+
+void zmq::poller_base_t::add_timer (int timeout_, i_poll_events *sink_, int id_)
+{
+ uint64_t expiration = clock.now_ms () + timeout_;
+ timer_info_t info = {sink_, id_};
+ timers.insert (timers_t::value_type (expiration, info));
+}
+
+void zmq::poller_base_t::cancel_timer (i_poll_events *sink_, int id_)
+{
+ // Complexity of this operation is O(n). We assume it is rarely used.
+ for (timers_t::iterator it = timers.begin (); it != timers.end (); ++it)
+ if (it->second.sink == sink_ && it->second.id == id_) {
+ timers.erase (it);
+ return;
+ }
+
+ // Timer not found.
+ zmq_assert (false);
+}
+
+uint64_t zmq::poller_base_t::execute_timers ()
+{
+ // Fast track.
+ if (timers.empty ())
+ return 0;
+
+ // Get the current time.
+ uint64_t current = clock.now_ms ();
+
+ // Execute the timers that are already due.
+ timers_t::iterator it = timers.begin ();
+ while (it != timers.end ()) {
+
+ // If we have to wait to execute the item, same will be true about
+ // all the following items (multimap is sorted). Thus we can stop
+ // checking the subsequent timers and return the time to wait for
+ // the next timer (at least 1ms).
+ if (it->first > current)
+ return it->first - current;
+
+ // Trigger the timer.
+ it->second.sink->timer_event (it->second.id);
+
+ // Remove it from the list of active timers.
+ timers_t::iterator o = it;
+ ++it;
+ timers.erase (o);
+ }
+
+ // There are no more timers.
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller_base.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller_base.hpp
new file mode 100644
index 00000000..41720e38
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/poller_base.hpp
@@ -0,0 +1,95 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_POLLER_BASE_HPP_INCLUDED__
+#define __ZMQ_POLLER_BASE_HPP_INCLUDED__
+
+#include <map>
+
+#include "clock.hpp"
+#include "atomic_counter.hpp"
+
+namespace zmq
+{
+
+ struct i_poll_events;
+
+ class poller_base_t
+ {
+ public:
+
+ poller_base_t ();
+ virtual ~poller_base_t ();
+
+ // Returns load of the poller. Note that this function can be
+ // invoked from a different thread!
+ int get_load ();
+
+ // Add a timeout to expire in timeout_ milliseconds. After the
+ // expiration timer_event on sink_ object will be called with
+ // argument set to id_.
+ void add_timer (int timeout_, zmq::i_poll_events *sink_, int id_);
+
+ // Cancel the timer created by sink_ object with ID equal to id_.
+ void cancel_timer (zmq::i_poll_events *sink_, int id_);
+
+ protected:
+
+ // Called by individual poller implementations to manage the load.
+ void adjust_load (int amount_);
+
+ // Executes any timers that are due. Returns number of milliseconds
+ // to wait to match the next timer or 0 meaning "no timers".
+ uint64_t execute_timers ();
+
+ private:
+
+ // Clock instance private to this I/O thread.
+ clock_t clock;
+
+ // List of active timers.
+ struct timer_info_t
+ {
+ zmq::i_poll_events *sink;
+ int id;
+ };
+ typedef std::multimap <uint64_t, timer_info_t> timers_t;
+ timers_t timers;
+
+ // Load of the poller. Currently the number of file descriptors
+ // registered.
+ atomic_counter_t load;
+
+ poller_base_t (const poller_base_t&);
+ const poller_base_t &operator = (const poller_base_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/precompiled.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/precompiled.cpp
new file mode 100644
index 00000000..7cd571dc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/precompiled.cpp
@@ -0,0 +1,30 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "precompiled.hpp"
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/precompiled.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/precompiled.hpp
new file mode 100644
index 00000000..36447d21
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/precompiled.hpp
@@ -0,0 +1,56 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PRECOMPILED_HPP_INCLUDED__
+#define __ZMQ_PRECOMPILED_HPP_INCLUDED__
+
+#ifdef _MSC_VER
+
+// Windows headers
+#include "platform.hpp"
+#include "windows.hpp"
+#include <fcntl.h>
+#include <intrin.h>
+#include <io.h>
+#include <rpc.h>
+#include <sys/stat.h>
+
+// standard C++ headers
+#include <algorithm>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+// 0MQ definitions and exported functions
+#include "../include/zmq.h"
+
+#endif // _MSC_VER
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/proxy.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/proxy.cpp
new file mode 100644
index 00000000..6e05d8a8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/proxy.cpp
@@ -0,0 +1,203 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <stddef.h>
+#include "poller.hpp"
+#include "proxy.hpp"
+#include "likely.hpp"
+
+// On AIX platform, poll.h has to be included first to get consistent
+// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents'
+// instead of 'events' and 'revents' and defines macros to map from POSIX-y
+// names to AIX-specific names).
+#if defined ZMQ_POLL_BASED_ON_POLL
+#include <poll.h>
+#endif
+
+// These headers end up pulling in zmq.h somewhere in their include
+// dependency chain
+#include "socket_base.hpp"
+#include "err.hpp"
+
+// zmq.h must be included *after* poll.h for AIX to build properly
+#include "../include/zmq.h"
+
+int capture(
+ class zmq::socket_base_t *capture_,
+ zmq::msg_t& msg_,
+ int more_ = 0)
+{
+ // Copy message to capture socket if any
+ if (capture_) {
+ zmq::msg_t ctrl;
+ int rc = ctrl.init ();
+ if (unlikely (rc < 0))
+ return -1;
+ rc = ctrl.copy (msg_);
+ if (unlikely (rc < 0))
+ return -1;
+ rc = capture_->send (&ctrl, more_? ZMQ_SNDMORE: 0);
+ if (unlikely (rc < 0))
+ return -1;
+ }
+ return 0;
+}
+
+int forward(
+ class zmq::socket_base_t *from_,
+ class zmq::socket_base_t *to_,
+ class zmq::socket_base_t *capture_,
+ zmq::msg_t& msg_)
+{
+ int more;
+ size_t moresz;
+ while (true) {
+ int rc = from_->recv (&msg_, 0);
+ if (unlikely (rc < 0))
+ return -1;
+
+ moresz = sizeof more;
+ rc = from_->getsockopt (ZMQ_RCVMORE, &more, &moresz);
+ if (unlikely (rc < 0))
+ return -1;
+
+ // Copy message to capture socket if any
+ rc = capture(capture_, msg_, more);
+ if (unlikely (rc < 0))
+ return -1;
+
+ rc = to_->send (&msg_, more? ZMQ_SNDMORE: 0);
+ if (unlikely (rc < 0))
+ return -1;
+ if (more == 0)
+ break;
+ }
+ return 0;
+}
+
+int zmq::proxy (
+ class socket_base_t *frontend_,
+ class socket_base_t *backend_,
+ class socket_base_t *capture_,
+ class socket_base_t *control_)
+{
+ msg_t msg;
+ int rc = msg.init ();
+ if (rc != 0)
+ return -1;
+
+ // The algorithm below assumes ratio of requests and replies processed
+ // under full load to be 1:1.
+
+ int more;
+ size_t moresz;
+ zmq_pollitem_t items [] = {
+ { frontend_, 0, ZMQ_POLLIN, 0 },
+ { backend_, 0, ZMQ_POLLIN, 0 },
+ { control_, 0, ZMQ_POLLIN, 0 }
+ };
+ int qt_poll_items = (control_ ? 3 : 2);
+ zmq_pollitem_t itemsout [] = {
+ { frontend_, 0, ZMQ_POLLOUT, 0 },
+ { backend_, 0, ZMQ_POLLOUT, 0 }
+ };
+
+ // Proxy can be in these three states
+ enum {
+ active,
+ paused,
+ terminated
+ } state = active;
+
+ while (state != terminated) {
+ // Wait while there are either requests or replies to process.
+ rc = zmq_poll (&items [0], qt_poll_items, -1);
+ if (unlikely (rc < 0))
+ return -1;
+
+ // Get the pollout separately because when combining this with pollin it maxes the CPU
+ // because pollout shall most of the time return directly.
+ // POLLOUT is only checked when frontend and backend sockets are not the same.
+ if (frontend_ != backend_) {
+ rc = zmq_poll (&itemsout [0], 2, 0);
+ if (unlikely (rc < 0)) {
+ return -1;
+ }
+ }
+
+ // Process a control command if any
+ if (control_ && items [2].revents & ZMQ_POLLIN) {
+ rc = control_->recv (&msg, 0);
+ if (unlikely (rc < 0))
+ return -1;
+
+ moresz = sizeof more;
+ rc = control_->getsockopt (ZMQ_RCVMORE, &more, &moresz);
+ if (unlikely (rc < 0) || more)
+ return -1;
+
+ // Copy message to capture socket if any
+ rc = capture(capture_, msg);
+ if (unlikely (rc < 0))
+ return -1;
+
+ if (msg.size () == 5 && memcmp (msg.data (), "PAUSE", 5) == 0)
+ state = paused;
+ else
+ if (msg.size () == 6 && memcmp (msg.data (), "RESUME", 6) == 0)
+ state = active;
+ else
+ if (msg.size () == 9 && memcmp (msg.data (), "TERMINATE", 9) == 0)
+ state = terminated;
+ else {
+ // This is an API error, we should assert
+ puts ("E: invalid command sent to proxy");
+ zmq_assert (false);
+ }
+ }
+ // Process a request
+ if (state == active
+ && items [0].revents & ZMQ_POLLIN
+ && (frontend_ == backend_ || itemsout [1].revents & ZMQ_POLLOUT)) {
+ rc = forward(frontend_, backend_, capture_,msg);
+ if (unlikely (rc < 0))
+ return -1;
+ }
+ // Process a reply
+ if (state == active
+ && frontend_ != backend_
+ && items [1].revents & ZMQ_POLLIN
+ && itemsout [0].revents & ZMQ_POLLOUT) {
+ rc = forward(backend_, frontend_, capture_,msg);
+ if (unlikely (rc < 0))
+ return -1;
+ }
+ }
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/proxy.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/proxy.hpp
new file mode 100644
index 00000000..14b056cd
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/proxy.hpp
@@ -0,0 +1,42 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PROXY_HPP_INCLUDED__
+#define __ZMQ_PROXY_HPP_INCLUDED__
+
+namespace zmq
+{
+ int proxy (
+ class socket_base_t *frontend_,
+ class socket_base_t *backend_,
+ class socket_base_t *capture_,
+ class socket_base_t *control_ = NULL); // backward compatibility without this argument
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pub.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pub.cpp
new file mode 100644
index 00000000..7e6eee43
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pub.cpp
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "pub.hpp"
+#include "pipe.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+
+zmq::pub_t::pub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ xpub_t (parent_, tid_, sid_)
+{
+ options.type = ZMQ_PUB;
+}
+
+zmq::pub_t::~pub_t ()
+{
+}
+
+void zmq::pub_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ zmq_assert (pipe_);
+
+ // Don't delay pipe termination as there is no one
+ // to receive the delimiter.
+ pipe_->set_nodelay ();
+
+ xpub_t::xattach_pipe (pipe_, subscribe_to_all_);
+}
+
+int zmq::pub_t::xrecv (class msg_t *)
+{
+ // Messages cannot be received from PUB socket.
+ errno = ENOTSUP;
+ return -1;
+}
+
+bool zmq::pub_t::xhas_in ()
+{
+ return false;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pub.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pub.hpp
new file mode 100644
index 00000000..4a70dcc2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pub.hpp
@@ -0,0 +1,63 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PUB_HPP_INCLUDED__
+#define __ZMQ_PUB_HPP_INCLUDED__
+
+#include "xpub.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class io_thread_t;
+ class socket_base_t;
+ class msg_t;
+
+ class pub_t : public xpub_t
+ {
+ public:
+
+ pub_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ ~pub_t ();
+
+ // Implementations of virtual functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_ = false);
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+
+ private:
+
+ pub_t (const pub_t&);
+ const pub_t &operator = (const pub_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pull.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pull.cpp
new file mode 100644
index 00000000..4754cda1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pull.cpp
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "pull.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+#include "pipe.hpp"
+
+zmq::pull_t::pull_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ socket_base_t (parent_, tid_, sid_)
+{
+ options.type = ZMQ_PULL;
+}
+
+zmq::pull_t::~pull_t ()
+{
+}
+
+void zmq::pull_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ // subscribe_to_all_ is unused
+ (void)subscribe_to_all_;
+
+ zmq_assert (pipe_);
+ fq.attach (pipe_);
+}
+
+void zmq::pull_t::xread_activated (pipe_t *pipe_)
+{
+ fq.activated (pipe_);
+}
+
+void zmq::pull_t::xpipe_terminated (pipe_t *pipe_)
+{
+ fq.pipe_terminated (pipe_);
+}
+
+int zmq::pull_t::xrecv (msg_t *msg_)
+{
+ return fq.recv (msg_);
+}
+
+bool zmq::pull_t::xhas_in ()
+{
+ return fq.has_in ();
+}
+
+zmq::blob_t zmq::pull_t::get_credential () const
+{
+ return fq.get_credential ();
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pull.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pull.hpp
new file mode 100644
index 00000000..6a2f953a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/pull.hpp
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PULL_HPP_INCLUDED__
+#define __ZMQ_PULL_HPP_INCLUDED__
+
+#include "socket_base.hpp"
+#include "session_base.hpp"
+#include "fq.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class pipe_t;
+ class msg_t;
+ class io_thread_t;
+
+ class pull_t :
+ public socket_base_t
+ {
+ public:
+
+ pull_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ ~pull_t ();
+
+ protected:
+
+ // Overrides of functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ blob_t get_credential () const;
+ void xread_activated (zmq::pipe_t *pipe_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+
+ private:
+
+ // Fair queueing object for inbound pipes.
+ fq_t fq;
+
+ pull_t (const pull_t&);
+ const pull_t &operator = (const pull_t&);
+
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/push.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/push.cpp
new file mode 100644
index 00000000..65fac5ff
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/push.cpp
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "push.hpp"
+#include "pipe.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+
+zmq::push_t::push_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ socket_base_t (parent_, tid_, sid_)
+{
+ options.type = ZMQ_PUSH;
+}
+
+zmq::push_t::~push_t ()
+{
+}
+
+void zmq::push_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ // subscribe_to_all_ is unused
+ (void)subscribe_to_all_;
+ // Don't delay pipe termination as there is no one
+ // to receive the delimiter.
+ pipe_->set_nodelay ();
+
+ zmq_assert (pipe_);
+ lb.attach (pipe_);
+}
+
+void zmq::push_t::xwrite_activated (pipe_t *pipe_)
+{
+ lb.activated (pipe_);
+}
+
+void zmq::push_t::xpipe_terminated (pipe_t *pipe_)
+{
+ lb.pipe_terminated (pipe_);
+}
+
+int zmq::push_t::xsend (msg_t *msg_)
+{
+ return lb.send (msg_);
+}
+
+bool zmq::push_t::xhas_out ()
+{
+ return lb.has_out ();
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/push.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/push.hpp
new file mode 100644
index 00000000..238ce82f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/push.hpp
@@ -0,0 +1,73 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PUSH_HPP_INCLUDED__
+#define __ZMQ_PUSH_HPP_INCLUDED__
+
+#include "socket_base.hpp"
+#include "session_base.hpp"
+#include "lb.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class pipe_t;
+ class msg_t;
+ class io_thread_t;
+
+ class push_t :
+ public socket_base_t
+ {
+ public:
+
+ push_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ ~push_t ();
+
+ protected:
+
+ // Overrides of functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
+ int xsend (zmq::msg_t *msg_);
+ bool xhas_out ();
+ void xwrite_activated (zmq::pipe_t *pipe_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+
+ private:
+
+ // Load balancer managing the outbound pipes.
+ lb_t lb;
+
+ push_t (const push_t&);
+ const push_t &operator = (const push_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/random.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/random.cpp
new file mode 100644
index 00000000..5c9932b6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/random.cpp
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+
+#include "platform.hpp"
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <unistd.h>
+#endif
+
+#include "random.hpp"
+#include "stdint.hpp"
+#include "clock.hpp"
+
+void zmq::seed_random ()
+{
+#if defined ZMQ_HAVE_WINDOWS
+ int pid = (int) GetCurrentProcessId ();
+#else
+ int pid = (int) getpid ();
+#endif
+ srand ((unsigned int) (clock_t::now_us () + pid));
+}
+
+uint32_t zmq::generate_random ()
+{
+ // Compensate for the fact that rand() returns signed integer.
+ uint32_t low = (uint32_t) rand ();
+ uint32_t high = (uint32_t) rand ();
+ high <<= (sizeof (int) * 8 - 1);
+ return high | low;
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/random.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/random.hpp
new file mode 100644
index 00000000..bd47c611
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/random.hpp
@@ -0,0 +1,46 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_RANDOM_HPP_INCLUDED__
+#define __ZMQ_RANDOM_HPP_INCLUDED__
+
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ // Seeds the random number generator.
+ void seed_random ();
+
+ // Generates random value.
+ uint32_t generate_random ();
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_decoder.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_decoder.cpp
new file mode 100644
index 00000000..b98826cb
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_decoder.cpp
@@ -0,0 +1,73 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "platform.hpp"
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "raw_decoder.hpp"
+#include "err.hpp"
+
+zmq::raw_decoder_t::raw_decoder_t (size_t bufsize_) :
+ bufsize (bufsize_)
+{
+ int rc = in_progress.init ();
+ errno_assert (rc == 0);
+
+ buffer = (unsigned char *) malloc (bufsize);
+ alloc_assert (buffer);
+}
+
+zmq::raw_decoder_t::~raw_decoder_t ()
+{
+ int rc = in_progress.close ();
+ errno_assert (rc == 0);
+
+ free (buffer);
+}
+
+void zmq::raw_decoder_t::get_buffer (unsigned char **data_, size_t *size_)
+{
+ *data_ = buffer;
+ *size_ = bufsize;
+}
+
+int zmq::raw_decoder_t::decode (const uint8_t *data_, size_t size_,
+ size_t &bytes_used_)
+{
+ int rc = in_progress.init_size (size_);
+ errno_assert (rc != -1);
+ memcpy (in_progress.data (), data_, size_);
+ bytes_used_ = size_;
+ return 1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_decoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_decoder.hpp
new file mode 100644
index 00000000..fc88add1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_decoder.hpp
@@ -0,0 +1,76 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_RAW_DECODER_HPP_INCLUDED__
+#define __ZMQ_RAW_DECODER_HPP_INCLUDED__
+
+#include "err.hpp"
+#include "msg.hpp"
+#include "i_decoder.hpp"
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ // Decoder for 0MQ v1 framing protocol. Converts data stream into messages.
+
+ class raw_decoder_t : public i_decoder
+ {
+ public:
+
+ raw_decoder_t (size_t bufsize_);
+ virtual ~raw_decoder_t ();
+
+ // i_decoder interface.
+
+ virtual void get_buffer (unsigned char **data_, size_t *size_);
+
+ virtual int decode (const unsigned char *data_, size_t size_,
+ size_t &processed);
+
+ virtual msg_t *msg () { return &in_progress; }
+
+
+ private:
+
+
+ msg_t in_progress;
+
+ const size_t bufsize;
+
+ unsigned char *buffer;
+
+ raw_decoder_t (const raw_decoder_t&);
+ void operator = (const raw_decoder_t&);
+ };
+
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_encoder.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_encoder.cpp
new file mode 100644
index 00000000..d0881aae
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_encoder.cpp
@@ -0,0 +1,50 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "encoder.hpp"
+#include "raw_encoder.hpp"
+#include "likely.hpp"
+#include "wire.hpp"
+
+zmq::raw_encoder_t::raw_encoder_t (size_t bufsize_) :
+ encoder_base_t <raw_encoder_t> (bufsize_)
+{
+ // Write 0 bytes to the batch and go to message_ready state.
+ next_step (NULL, 0, &raw_encoder_t::raw_message_ready, true);
+}
+
+zmq::raw_encoder_t::~raw_encoder_t ()
+{
+}
+
+void zmq::raw_encoder_t::raw_message_ready ()
+{
+ next_step (in_progress->data (), in_progress->size (),
+ &raw_encoder_t::raw_message_ready, true);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_encoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_encoder.hpp
new file mode 100644
index 00000000..417cff4a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/raw_encoder.hpp
@@ -0,0 +1,70 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_RAW_ENCODER_HPP_INCLUDED__
+#define __ZMQ_RAW_ENCODER_HPP_INCLUDED__
+
+#if defined(_MSC_VER)
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+#include <algorithm>
+
+#include "err.hpp"
+#include "msg.hpp"
+#include "i_encoder.hpp"
+
+namespace zmq
+{
+
+ // Encoder for 0MQ framing protocol. Converts messages into data batches.
+
+ class raw_encoder_t : public encoder_base_t <raw_encoder_t>
+ {
+ public:
+
+ raw_encoder_t (size_t bufsize_);
+ ~raw_encoder_t ();
+
+ private:
+
+ void raw_message_ready ();
+
+ raw_encoder_t (const raw_encoder_t&);
+ const raw_encoder_t &operator = (const raw_encoder_t&);
+ };
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/reaper.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/reaper.cpp
new file mode 100644
index 00000000..ea5f0c56
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/reaper.cpp
@@ -0,0 +1,137 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "reaper.hpp"
+#include "socket_base.hpp"
+#include "err.hpp"
+
+zmq::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) :
+ object_t (ctx_, tid_),
+ sockets (0),
+ terminating (false)
+{
+ poller = new (std::nothrow) poller_t (*ctx_);
+ alloc_assert (poller);
+
+ mailbox_handle = poller->add_fd (mailbox.get_fd (), this);
+ poller->set_pollin (mailbox_handle);
+
+#ifdef HAVE_FORK
+ pid = getpid();
+#endif
+}
+
+zmq::reaper_t::~reaper_t ()
+{
+ delete poller;
+}
+
+zmq::mailbox_t *zmq::reaper_t::get_mailbox ()
+{
+ return &mailbox;
+}
+
+void zmq::reaper_t::start ()
+{
+ // Start the thread.
+ poller->start ();
+}
+
+void zmq::reaper_t::stop ()
+{
+ send_stop ();
+}
+
+void zmq::reaper_t::in_event ()
+{
+ while (true) {
+#ifdef HAVE_FORK
+ if (unlikely(pid != getpid()))
+ {
+ //printf("zmq::reaper_t::in_event return in child process %d\n", (int)getpid());
+ return;
+ }
+#endif
+
+ // Get the next command. If there is none, exit.
+ command_t cmd;
+ int rc = mailbox.recv (&cmd, 0);
+ if (rc != 0 && errno == EINTR)
+ continue;
+ if (rc != 0 && errno == EAGAIN)
+ break;
+ errno_assert (rc == 0);
+
+ // Process the command.
+ cmd.destination->process_command (cmd);
+ }
+}
+
+void zmq::reaper_t::out_event ()
+{
+ zmq_assert (false);
+}
+
+void zmq::reaper_t::timer_event (int)
+{
+ zmq_assert (false);
+}
+
+void zmq::reaper_t::process_stop ()
+{
+ terminating = true;
+
+ // If there are no sockets being reaped finish immediately.
+ if (!sockets) {
+ send_done ();
+ poller->rm_fd (mailbox_handle);
+ poller->stop ();
+ }
+}
+
+void zmq::reaper_t::process_reap (socket_base_t *socket_)
+{
+ // Add the socket to the poller.
+ socket_->start_reaping (poller);
+
+ ++sockets;
+}
+
+void zmq::reaper_t::process_reaped ()
+{
+ --sockets;
+
+ // If reaped was already asked to terminate and there are no more sockets,
+ // finish immediately.
+ if (!sockets && terminating) {
+ send_done ();
+ poller->rm_fd (mailbox_handle);
+ poller->stop ();
+ }
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/reaper.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/reaper.hpp
new file mode 100644
index 00000000..25a6186f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/reaper.hpp
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_REAPER_HPP_INCLUDED__
+#define __ZMQ_REAPER_HPP_INCLUDED__
+
+#include "object.hpp"
+#include "mailbox.hpp"
+#include "poller.hpp"
+#include "i_poll_events.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class socket_base_t;
+
+ class reaper_t : public object_t, public i_poll_events
+ {
+ public:
+
+ reaper_t (zmq::ctx_t *ctx_, uint32_t tid_);
+ ~reaper_t ();
+
+ mailbox_t *get_mailbox ();
+
+ void start ();
+ void stop ();
+
+ // i_poll_events implementation.
+ void in_event ();
+ void out_event ();
+ void timer_event (int id_);
+
+ private:
+
+ // Command handlers.
+ void process_stop ();
+ void process_reap (zmq::socket_base_t *socket_);
+ void process_reaped ();
+
+ // Reaper thread accesses incoming commands via this mailbox.
+ mailbox_t mailbox;
+
+ // Handle associated with mailbox' file descriptor.
+ poller_t::handle_t mailbox_handle;
+
+ // I/O multiplexing is performed using a poller object.
+ poller_t *poller;
+
+ // Number of sockets being reaped at the moment.
+ int sockets;
+
+ // If true, we were already asked to terminate.
+ bool terminating;
+
+ reaper_t (const reaper_t&);
+ const reaper_t &operator = (const reaper_t&);
+
+#ifdef HAVE_FORK
+ // the process that created this context. Used to detect forking.
+ pid_t pid;
+#endif
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/rep.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/rep.cpp
new file mode 100644
index 00000000..0efdec9c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/rep.cpp
@@ -0,0 +1,133 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "rep.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+
+zmq::rep_t::rep_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ router_t (parent_, tid_, sid_),
+ sending_reply (false),
+ request_begins (true)
+{
+ options.type = ZMQ_REP;
+}
+
+zmq::rep_t::~rep_t ()
+{
+}
+
+int zmq::rep_t::xsend (msg_t *msg_)
+{
+ // If we are in the middle of receiving a request, we cannot send reply.
+ if (!sending_reply) {
+ errno = EFSM;
+ return -1;
+ }
+
+ bool more = msg_->flags () & msg_t::more ? true : false;
+
+ // Push message to the reply pipe.
+ int rc = router_t::xsend (msg_);
+ if (rc != 0)
+ return rc;
+
+ // If the reply is complete flip the FSM back to request receiving state.
+ if (!more)
+ sending_reply = false;
+
+ return 0;
+}
+
+int zmq::rep_t::xrecv (msg_t *msg_)
+{
+ // If we are in middle of sending a reply, we cannot receive next request.
+ if (sending_reply) {
+ errno = EFSM;
+ return -1;
+ }
+
+ // First thing to do when receiving a request is to copy all the labels
+ // to the reply pipe.
+ if (request_begins) {
+ while (true) {
+ int rc = router_t::xrecv (msg_);
+ if (rc != 0)
+ return rc;
+
+ if ((msg_->flags () & msg_t::more)) {
+ // Empty message part delimits the traceback stack.
+ bool bottom = (msg_->size () == 0);
+
+ // Push it to the reply pipe.
+ rc = router_t::xsend (msg_);
+ errno_assert (rc == 0);
+
+ if (bottom)
+ break;
+ }
+ else {
+ // If the traceback stack is malformed, discard anything
+ // already sent to pipe (we're at end of invalid message).
+ rc = router_t::rollback ();
+ errno_assert (rc == 0);
+ }
+ }
+ request_begins = false;
+ }
+
+ // Get next message part to return to the user.
+ int rc = router_t::xrecv (msg_);
+ if (rc != 0)
+ return rc;
+
+ // If whole request is read, flip the FSM to reply-sending state.
+ if (!(msg_->flags () & msg_t::more)) {
+ sending_reply = true;
+ request_begins = true;
+ }
+
+ return 0;
+}
+
+bool zmq::rep_t::xhas_in ()
+{
+ if (sending_reply)
+ return false;
+
+ return router_t::xhas_in ();
+}
+
+bool zmq::rep_t::xhas_out ()
+{
+ if (!sending_reply)
+ return false;
+
+ return router_t::xhas_out ();
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/rep.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/rep.hpp
new file mode 100644
index 00000000..177872e4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/rep.hpp
@@ -0,0 +1,73 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_REP_HPP_INCLUDED__
+#define __ZMQ_REP_HPP_INCLUDED__
+
+#include "router.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class msg_t;
+ class io_thread_t;
+ class socket_base_t;
+
+ class rep_t : public router_t
+ {
+ public:
+
+ rep_t (zmq::ctx_t *parent_, uint32_t tid_, int sid);
+ ~rep_t ();
+
+ // Overrides of functions from socket_base_t.
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ bool xhas_out ();
+
+ private:
+
+ // If true, we are in process of sending the reply. If false we are
+ // in process of receiving a request.
+ bool sending_reply;
+
+ // If true, we are starting to receive a request. The beginning
+ // of the request is the backtrace stack.
+ bool request_begins;
+
+ rep_t (const rep_t&);
+ const rep_t &operator = (const rep_t&);
+
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/req.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/req.cpp
new file mode 100644
index 00000000..3a930349
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/req.cpp
@@ -0,0 +1,289 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "req.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+#include "wire.hpp"
+#include "random.hpp"
+#include "likely.hpp"
+
+zmq::req_t::req_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ dealer_t (parent_, tid_, sid_),
+ receiving_reply (false),
+ message_begins (true),
+ reply_pipe (NULL),
+ request_id_frames_enabled (false),
+ request_id (generate_random()),
+ strict (true)
+{
+ options.type = ZMQ_REQ;
+}
+
+zmq::req_t::~req_t ()
+{
+}
+
+int zmq::req_t::xsend (msg_t *msg_)
+{
+ // If we've sent a request and we still haven't got the reply,
+ // we can't send another request unless the strict option is disabled.
+ if (receiving_reply) {
+ if (strict) {
+ errno = EFSM;
+ return -1;
+ }
+
+ if (reply_pipe)
+ reply_pipe->terminate (false);
+ receiving_reply = false;
+ message_begins = true;
+ }
+
+ // First part of the request is the request identity.
+ if (message_begins) {
+ reply_pipe = NULL;
+
+ if (request_id_frames_enabled) {
+ request_id++;
+
+ msg_t id;
+ int rc = id.init_data (&request_id, sizeof (request_id), NULL, NULL);
+ errno_assert (rc == 0);
+ id.set_flags (msg_t::more);
+
+ rc = dealer_t::sendpipe (&id, &reply_pipe);
+ if (rc != 0)
+ return -1;
+ }
+
+ msg_t bottom;
+ int rc = bottom.init ();
+ errno_assert (rc == 0);
+ bottom.set_flags (msg_t::more);
+
+ rc = dealer_t::sendpipe (&bottom, &reply_pipe);
+ if (rc != 0)
+ return -1;
+ zmq_assert (reply_pipe);
+
+ message_begins = false;
+
+ // Eat all currently avaliable messages before the request is fully
+ // sent. This is done to avoid:
+ // REQ sends request to A, A replies, B replies too.
+ // A's reply was first and matches, that is used.
+ // An hour later REQ sends a request to B. B's old reply is used.
+ msg_t drop;
+ while (true) {
+ rc = drop.init ();
+ errno_assert (rc == 0);
+ rc = dealer_t::xrecv (&drop);
+ if (rc != 0)
+ break;
+ drop.close ();
+ }
+ }
+
+ bool more = msg_->flags () & msg_t::more ? true : false;
+
+ int rc = dealer_t::xsend (msg_);
+ if (rc != 0)
+ return rc;
+
+ // If the request was fully sent, flip the FSM into reply-receiving state.
+ if (!more) {
+ receiving_reply = true;
+ message_begins = true;
+ }
+
+ return 0;
+}
+
+int zmq::req_t::xrecv (msg_t *msg_)
+{
+ // If request wasn't send, we can't wait for reply.
+ if (!receiving_reply) {
+ errno = EFSM;
+ return -1;
+ }
+
+ // Skip messages until one with the right first frames is found.
+ while (message_begins) {
+ // If enabled, the first frame must have the correct request_id.
+ if (request_id_frames_enabled) {
+ int rc = recv_reply_pipe (msg_);
+ if (rc != 0)
+ return rc;
+
+ if (unlikely (!(msg_->flags () & msg_t::more) ||
+ msg_->size () != sizeof (request_id) ||
+ *static_cast<uint32_t *> (msg_->data ()) != request_id)) {
+ // Skip the remaining frames and try the next message
+ while (msg_->flags () & msg_t::more) {
+ rc = recv_reply_pipe (msg_);
+ errno_assert (rc == 0);
+ }
+ continue;
+ }
+ }
+
+ // The next frame must be 0.
+ // TODO: Failing this check should also close the connection with the peer!
+ int rc = recv_reply_pipe (msg_);
+ if (rc != 0)
+ return rc;
+
+ if (unlikely (!(msg_->flags () & msg_t::more) || msg_->size () != 0)) {
+ // Skip the remaining frames and try the next message
+ while (msg_->flags () & msg_t::more) {
+ rc = recv_reply_pipe (msg_);
+ errno_assert (rc == 0);
+ }
+ continue;
+ }
+
+ message_begins = false;
+ }
+
+ int rc = recv_reply_pipe (msg_);
+ if (rc != 0)
+ return rc;
+
+ // If the reply is fully received, flip the FSM into request-sending state.
+ if (!(msg_->flags () & msg_t::more)) {
+ receiving_reply = false;
+ message_begins = true;
+ }
+
+ return 0;
+}
+
+bool zmq::req_t::xhas_in ()
+{
+ // TODO: Duplicates should be removed here.
+
+ if (!receiving_reply)
+ return false;
+
+ return dealer_t::xhas_in ();
+}
+
+bool zmq::req_t::xhas_out ()
+{
+ if (receiving_reply)
+ return false;
+
+ return dealer_t::xhas_out ();
+}
+
+int zmq::req_t::xsetsockopt (int option_, const void *optval_, size_t optvallen_)
+{
+ bool is_int = (optvallen_ == sizeof (int));
+ int value = is_int? *((int *) optval_): 0;
+ switch (option_) {
+ case ZMQ_REQ_CORRELATE:
+ if (is_int && value >= 0) {
+ request_id_frames_enabled = (value != 0);
+ return 0;
+ }
+ break;
+
+ case ZMQ_REQ_RELAXED:
+ if (is_int && value >= 0) {
+ strict = (value == 0);
+ return 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return dealer_t::xsetsockopt (option_, optval_, optvallen_);
+}
+
+void zmq::req_t::xpipe_terminated (pipe_t *pipe_)
+{
+ if (reply_pipe == pipe_)
+ reply_pipe = NULL;
+ dealer_t::xpipe_terminated (pipe_);
+}
+
+int zmq::req_t::recv_reply_pipe (msg_t *msg_)
+{
+ while (true) {
+ pipe_t *pipe = NULL;
+ int rc = dealer_t::recvpipe (msg_, &pipe);
+ if (rc != 0)
+ return rc;
+ if (!reply_pipe || pipe == reply_pipe)
+ return 0;
+ }
+}
+
+zmq::req_session_t::req_session_t (io_thread_t *io_thread_, bool connect_,
+ socket_base_t *socket_, const options_t &options_,
+ address_t *addr_) :
+ session_base_t (io_thread_, connect_, socket_, options_, addr_),
+ state (bottom)
+{
+}
+
+zmq::req_session_t::~req_session_t ()
+{
+}
+
+int zmq::req_session_t::push_msg (msg_t *msg_)
+{
+ switch (state) {
+ case bottom:
+ if (msg_->flags () == msg_t::more && msg_->size () == 0) {
+ state = body;
+ return session_base_t::push_msg (msg_);
+ }
+ break;
+ case body:
+ if (msg_->flags () == msg_t::more)
+ return session_base_t::push_msg (msg_);
+ if (msg_->flags () == 0) {
+ state = bottom;
+ return session_base_t::push_msg (msg_);
+ }
+ break;
+ }
+ errno = EFAULT;
+ return -1;
+}
+
+void zmq::req_session_t::reset ()
+{
+ session_base_t::reset ();
+ state = bottom;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/req.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/req.hpp
new file mode 100644
index 00000000..66512cae
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/req.hpp
@@ -0,0 +1,120 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_REQ_HPP_INCLUDED__
+#define __ZMQ_REQ_HPP_INCLUDED__
+
+#include "dealer.hpp"
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class msg_t;
+ class io_thread_t;
+ class socket_base_t;
+
+ class req_t : public dealer_t
+ {
+ public:
+
+ req_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ ~req_t ();
+
+ // Overrides of functions from socket_base_t.
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ bool xhas_out ();
+ int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+
+ protected:
+
+ // Receive only from the pipe the request was sent to, discarding
+ // frames from other pipes.
+ int recv_reply_pipe (zmq::msg_t *msg_);
+
+ private:
+
+ // If true, request was already sent and reply wasn't received yet or
+ // was raceived partially.
+ bool receiving_reply;
+
+ // If true, we are starting to send/recv a message. The first part
+ // of the message must be empty message part (backtrace stack bottom).
+ bool message_begins;
+
+ // The pipe the request was sent to and where the reply is expected.
+ zmq::pipe_t *reply_pipe;
+
+ // Whether request id frames shall be sent and expected.
+ bool request_id_frames_enabled;
+
+ // The current request id. It is incremented every time before a new
+ // request is sent.
+ uint32_t request_id;
+
+ // If false, send() will reset its internal state and terminate the
+ // reply_pipe's connection instead of failing if a previous request is
+ // still pending.
+ bool strict;
+
+ req_t (const req_t&);
+ const req_t &operator = (const req_t&);
+ };
+
+ class req_session_t : public session_base_t
+ {
+ public:
+
+ req_session_t (zmq::io_thread_t *io_thread_, bool connect_,
+ zmq::socket_base_t *socket_, const options_t &options_,
+ address_t *addr_);
+ ~req_session_t ();
+
+ // Overrides of the functions from session_base_t.
+ int push_msg (msg_t *msg_);
+ void reset ();
+
+ private:
+
+ enum {
+ bottom,
+ body
+ } state;
+
+ req_session_t (const req_session_t&);
+ const req_session_t &operator = (const req_session_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/router.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/router.cpp
new file mode 100644
index 00000000..fc46ae19
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/router.cpp
@@ -0,0 +1,479 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "router.hpp"
+#include "pipe.hpp"
+#include "wire.hpp"
+#include "random.hpp"
+#include "likely.hpp"
+#include "err.hpp"
+
+zmq::router_t::router_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ socket_base_t (parent_, tid_, sid_),
+ prefetched (false),
+ identity_sent (false),
+ more_in (false),
+ current_out (NULL),
+ more_out (false),
+ next_rid (generate_random ()),
+ mandatory (false),
+ // raw_sock functionality in ROUTER is deprecated
+ raw_sock (false),
+ probe_router (false),
+ handover (false)
+{
+ options.type = ZMQ_ROUTER;
+ options.recv_identity = true;
+ options.raw_sock = false;
+
+ prefetched_id.init ();
+ prefetched_msg.init ();
+}
+
+zmq::router_t::~router_t ()
+{
+ zmq_assert (anonymous_pipes.empty ());;
+ zmq_assert (outpipes.empty ());
+ prefetched_id.close ();
+ prefetched_msg.close ();
+}
+
+void zmq::router_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ // subscribe_to_all_ is unused
+ (void)subscribe_to_all_;
+
+ zmq_assert (pipe_);
+
+ if (probe_router) {
+ msg_t probe_msg_;
+ int rc = probe_msg_.init ();
+ errno_assert (rc == 0);
+
+ rc = pipe_->write (&probe_msg_);
+ // zmq_assert (rc) is not applicable here, since it is not a bug.
+ pipe_->flush ();
+
+ rc = probe_msg_.close ();
+ errno_assert (rc == 0);
+ }
+
+ bool identity_ok = identify_peer (pipe_);
+ if (identity_ok)
+ fq.attach (pipe_);
+ else
+ anonymous_pipes.insert (pipe_);
+}
+
+int zmq::router_t::xsetsockopt (int option_, const void *optval_,
+ size_t optvallen_)
+{
+ bool is_int = (optvallen_ == sizeof (int));
+ int value = is_int? *((int *) optval_): 0;
+
+ switch (option_) {
+ case ZMQ_CONNECT_RID:
+ if (optval_ && optvallen_) {
+ connect_rid.assign ((char *) optval_, optvallen_);
+ return 0;
+ }
+ break;
+ case ZMQ_ROUTER_RAW:
+ if (is_int && value >= 0) {
+ raw_sock = (value != 0);
+ if (raw_sock) {
+ options.recv_identity = false;
+ options.raw_sock = true;
+ }
+ return 0;
+ }
+ break;
+
+ case ZMQ_ROUTER_MANDATORY:
+ if (is_int && value >= 0) {
+ mandatory = (value != 0);
+ return 0;
+ }
+ break;
+
+ case ZMQ_PROBE_ROUTER:
+ if (is_int && value >= 0) {
+ probe_router = (value != 0);
+ return 0;
+ }
+ break;
+
+ case ZMQ_ROUTER_HANDOVER:
+ if (is_int && value >= 0) {
+ handover = (value != 0);
+ return 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+ errno = EINVAL;
+ return -1;
+}
+
+
+void zmq::router_t::xpipe_terminated (pipe_t *pipe_)
+{
+ std::set <pipe_t*>::iterator it = anonymous_pipes.find (pipe_);
+ if (it != anonymous_pipes.end ())
+ anonymous_pipes.erase (it);
+ else {
+ outpipes_t::iterator it = outpipes.find (pipe_->get_identity ());
+ zmq_assert (it != outpipes.end ());
+ outpipes.erase (it);
+ fq.pipe_terminated (pipe_);
+ if (pipe_ == current_out)
+ current_out = NULL;
+ }
+}
+
+void zmq::router_t::xread_activated (pipe_t *pipe_)
+{
+ std::set <pipe_t*>::iterator it = anonymous_pipes.find (pipe_);
+ if (it == anonymous_pipes.end ())
+ fq.activated (pipe_);
+ else {
+ bool identity_ok = identify_peer (pipe_);
+ if (identity_ok) {
+ anonymous_pipes.erase (it);
+ fq.attach (pipe_);
+ }
+ }
+}
+
+void zmq::router_t::xwrite_activated (pipe_t *pipe_)
+{
+ outpipes_t::iterator it;
+ for (it = outpipes.begin (); it != outpipes.end (); ++it)
+ if (it->second.pipe == pipe_)
+ break;
+
+ zmq_assert (it != outpipes.end ());
+ zmq_assert (!it->second.active);
+ it->second.active = true;
+}
+
+int zmq::router_t::xsend (msg_t *msg_)
+{
+ // If this is the first part of the message it's the ID of the
+ // peer to send the message to.
+ if (!more_out) {
+ zmq_assert (!current_out);
+
+ // If we have malformed message (prefix with no subsequent message)
+ // then just silently ignore it.
+ // TODO: The connections should be killed instead.
+ if (msg_->flags () & msg_t::more) {
+
+ more_out = true;
+
+ // Find the pipe associated with the identity stored in the prefix.
+ // If there's no such pipe just silently ignore the message, unless
+ // router_mandatory is set.
+ blob_t identity ((unsigned char*) msg_->data (), msg_->size ());
+ outpipes_t::iterator it = outpipes.find (identity);
+
+ if (it != outpipes.end ()) {
+ current_out = it->second.pipe;
+ if (!current_out->check_write ()) {
+ it->second.active = false;
+ current_out = NULL;
+ if (mandatory) {
+ more_out = false;
+ errno = EAGAIN;
+ return -1;
+ }
+ }
+ }
+ else
+ if (mandatory) {
+ more_out = false;
+ errno = EHOSTUNREACH;
+ return -1;
+ }
+ }
+
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ return 0;
+ }
+
+ // Ignore the MORE flag for raw-sock or assert?
+ if (options.raw_sock)
+ msg_->reset_flags (msg_t::more);
+
+ // Check whether this is the last part of the message.
+ more_out = msg_->flags () & msg_t::more ? true : false;
+
+ // Push the message into the pipe. If there's no out pipe, just drop it.
+ if (current_out) {
+
+ // Close the remote connection if user has asked to do so
+ // by sending zero length message.
+ // Pending messages in the pipe will be dropped (on receiving term- ack)
+ if (raw_sock && msg_->size() == 0) {
+ current_out->terminate (false);
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ current_out = NULL;
+ return 0;
+ }
+
+ bool ok = current_out->write (msg_);
+ if (unlikely (!ok)) {
+ // Message failed to send - we must close it ourselves.
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ current_out = NULL;
+ } else {
+ if (!more_out) {
+ current_out->flush ();
+ current_out = NULL;
+ }
+ }
+ }
+ else {
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ }
+
+ // Detach the message from the data buffer.
+ int rc = msg_->init ();
+ errno_assert (rc == 0);
+
+ return 0;
+}
+
+int zmq::router_t::xrecv (msg_t *msg_)
+{
+ if (prefetched) {
+ if (!identity_sent) {
+ int rc = msg_->move (prefetched_id);
+ errno_assert (rc == 0);
+ identity_sent = true;
+ }
+ else {
+ int rc = msg_->move (prefetched_msg);
+ errno_assert (rc == 0);
+ prefetched = false;
+ }
+ more_in = msg_->flags () & msg_t::more ? true : false;
+ return 0;
+ }
+
+ pipe_t *pipe = NULL;
+ int rc = fq.recvpipe (msg_, &pipe);
+
+ // It's possible that we receive peer's identity. That happens
+ // after reconnection. The current implementation assumes that
+ // the peer always uses the same identity.
+ while (rc == 0 && msg_->is_identity ())
+ rc = fq.recvpipe (msg_, &pipe);
+
+ if (rc != 0)
+ return -1;
+
+ zmq_assert (pipe != NULL);
+
+ // If we are in the middle of reading a message, just return the next part.
+ if (more_in)
+ more_in = msg_->flags () & msg_t::more ? true : false;
+ else {
+ // We are at the beginning of a message.
+ // Keep the message part we have in the prefetch buffer
+ // and return the ID of the peer instead.
+ rc = prefetched_msg.move (*msg_);
+ errno_assert (rc == 0);
+ prefetched = true;
+
+ blob_t identity = pipe->get_identity ();
+ rc = msg_->init_size (identity.size ());
+ errno_assert (rc == 0);
+ memcpy (msg_->data (), identity.data (), identity.size ());
+ msg_->set_flags (msg_t::more);
+ identity_sent = true;
+ }
+
+ return 0;
+}
+
+int zmq::router_t::rollback (void)
+{
+ if (current_out) {
+ current_out->rollback ();
+ current_out = NULL;
+ more_out = false;
+ }
+ return 0;
+}
+
+bool zmq::router_t::xhas_in ()
+{
+ // If we are in the middle of reading the messages, there are
+ // definitely more parts available.
+ if (more_in)
+ return true;
+
+ // We may already have a message pre-fetched.
+ if (prefetched)
+ return true;
+
+ // Try to read the next message.
+ // The message, if read, is kept in the pre-fetch buffer.
+ pipe_t *pipe = NULL;
+ int rc = fq.recvpipe (&prefetched_msg, &pipe);
+
+ // It's possible that we receive peer's identity. That happens
+ // after reconnection. The current implementation assumes that
+ // the peer always uses the same identity.
+ // TODO: handle the situation when the peer changes its identity.
+ while (rc == 0 && prefetched_msg.is_identity ())
+ rc = fq.recvpipe (&prefetched_msg, &pipe);
+
+ if (rc != 0)
+ return false;
+
+ zmq_assert (pipe != NULL);
+
+ blob_t identity = pipe->get_identity ();
+ rc = prefetched_id.init_size (identity.size ());
+ errno_assert (rc == 0);
+ memcpy (prefetched_id.data (), identity.data (), identity.size ());
+ prefetched_id.set_flags (msg_t::more);
+
+ prefetched = true;
+ identity_sent = false;
+
+ return true;
+}
+
+bool zmq::router_t::xhas_out ()
+{
+ // In theory, ROUTER socket is always ready for writing. Whether actual
+ // attempt to write succeeds depends on whitch pipe the message is going
+ // to be routed to.
+ return true;
+}
+
+zmq::blob_t zmq::router_t::get_credential () const
+{
+ return fq.get_credential ();
+}
+
+bool zmq::router_t::identify_peer (pipe_t *pipe_)
+{
+ msg_t msg;
+ blob_t identity;
+ bool ok;
+
+ if (connect_rid.length()) {
+ identity = blob_t ((unsigned char*) connect_rid.c_str (),
+ connect_rid.length());
+ connect_rid.clear ();
+ outpipes_t::iterator it = outpipes.find (identity);
+ if (it != outpipes.end ())
+ zmq_assert(false); // Not allowed to duplicate an existing rid
+ }
+ else
+ if (options.raw_sock) { // Always assign identity for raw-socket
+ unsigned char buf [5];
+ buf [0] = 0;
+ put_uint32 (buf + 1, next_rid++);
+ identity = blob_t (buf, sizeof buf);
+ }
+ else
+ if (!options.raw_sock) {
+ // Pick up handshake cases and also case where next identity is set
+ msg.init ();
+ ok = pipe_->read (&msg);
+ if (!ok)
+ return false;
+
+ if (msg.size () == 0) {
+ // Fall back on the auto-generation
+ unsigned char buf [5];
+ buf [0] = 0;
+ put_uint32 (buf + 1, next_rid++);
+ identity = blob_t (buf, sizeof buf);
+ msg.close ();
+ }
+ else {
+ identity = blob_t ((unsigned char*) msg.data (), msg.size ());
+ outpipes_t::iterator it = outpipes.find (identity);
+ msg.close ();
+
+ if (it != outpipes.end ()) {
+ if (!handover)
+ // Ignore peers with duplicate ID
+ return false;
+ else {
+ // We will allow the new connection to take over this
+ // identity. Temporarily assign a new identity to the
+ // existing pipe so we can terminate it asynchronously.
+ unsigned char buf [5];
+ buf [0] = 0;
+ put_uint32 (buf + 1, next_rid++);
+ blob_t new_identity = blob_t (buf, sizeof buf);
+
+ it->second.pipe->set_identity (new_identity);
+ outpipe_t existing_outpipe =
+ {it->second.pipe, it->second.active};
+
+ ok = outpipes.insert (outpipes_t::value_type (
+ new_identity, existing_outpipe)).second;
+ zmq_assert (ok);
+
+ // Remove the existing identity entry to allow the new
+ // connection to take the identity.
+ outpipes.erase (it);
+
+ existing_outpipe.pipe->terminate (true);
+ }
+ }
+ }
+ }
+
+ pipe_->set_identity (identity);
+ // Add the record into output pipes lookup table
+ outpipe_t outpipe = {pipe_, true};
+ ok = outpipes.insert (outpipes_t::value_type (identity, outpipe)).second;
+ zmq_assert (ok);
+
+ return true;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/router.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/router.hpp
new file mode 100644
index 00000000..9877217f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/router.hpp
@@ -0,0 +1,140 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_ROUTER_HPP_INCLUDED__
+#define __ZMQ_ROUTER_HPP_INCLUDED__
+
+#include <map>
+
+#include "socket_base.hpp"
+#include "session_base.hpp"
+#include "stdint.hpp"
+#include "blob.hpp"
+#include "msg.hpp"
+#include "fq.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class pipe_t;
+
+ // TODO: This class uses O(n) scheduling. Rewrite it to use O(1) algorithm.
+ class router_t :
+ public socket_base_t
+ {
+ public:
+
+ router_t (zmq::ctx_t *parent_, uint32_t tid_, int sid);
+ ~router_t ();
+
+ // Overrides of functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
+ int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ bool xhas_out ();
+ void xread_activated (zmq::pipe_t *pipe_);
+ void xwrite_activated (zmq::pipe_t *pipe_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+
+ protected:
+
+ // Rollback any message parts that were sent but not yet flushed.
+ int rollback ();
+ blob_t get_credential () const;
+
+ private:
+
+ // Receive peer id and update lookup map
+ bool identify_peer (pipe_t *pipe_);
+
+ // Fair queueing object for inbound pipes.
+ fq_t fq;
+
+ // True iff there is a message held in the pre-fetch buffer.
+ bool prefetched;
+
+ // If true, the receiver got the message part with
+ // the peer's identity.
+ bool identity_sent;
+
+ // Holds the prefetched identity.
+ msg_t prefetched_id;
+
+ // Holds the prefetched message.
+ msg_t prefetched_msg;
+
+ // If true, more incoming message parts are expected.
+ bool more_in;
+
+ struct outpipe_t
+ {
+ zmq::pipe_t *pipe;
+ bool active;
+ };
+
+ // We keep a set of pipes that have not been identified yet.
+ std::set <pipe_t*> anonymous_pipes;
+
+ // Outbound pipes indexed by the peer IDs.
+ typedef std::map <blob_t, outpipe_t> outpipes_t;
+ outpipes_t outpipes;
+
+ // The pipe we are currently writing to.
+ zmq::pipe_t *current_out;
+
+ // If true, more outgoing message parts are expected.
+ bool more_out;
+
+ // Routing IDs are generated. It's a simple increment and wrap-over
+ // algorithm. This value is the next ID to use (if not used already).
+ uint32_t next_rid;
+
+ // If true, report EAGAIN to the caller instead of silently dropping
+ // the message targeting an unknown peer.
+ bool mandatory;
+ bool raw_sock;
+
+ // if true, send an empty message to every connected router peer
+ bool probe_router;
+
+ // If true, the router will reassign an identity upon encountering a
+ // name collision. The new pipe will take the identity, the old pipe
+ // will be terminated.
+ bool handover;
+
+ router_t (const router_t&);
+ const router_t &operator = (const router_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/select.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/select.cpp
new file mode 100644
index 00000000..ec0d2e82
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/select.cpp
@@ -0,0 +1,234 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "select.hpp"
+#if defined ZMQ_USE_SELECT
+
+#include "platform.hpp"
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#elif defined ZMQ_HAVE_HPUX
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#elif defined ZMQ_HAVE_OPENVMS
+#include <sys/types.h>
+#include <sys/time.h>
+#else
+#include <sys/select.h>
+#endif
+
+#include <string.h>
+#include <algorithm>
+
+#include "err.hpp"
+#include "config.hpp"
+#include "i_poll_events.hpp"
+
+zmq::select_t::select_t (const zmq::ctx_t &ctx_) :
+ ctx(ctx_),
+ maxfd (retired_fd),
+ retired (false),
+ stopping (false)
+{
+ // Clear file descriptor sets.
+ FD_ZERO (&source_set_in);
+ FD_ZERO (&source_set_out);
+ FD_ZERO (&source_set_err);
+}
+
+zmq::select_t::~select_t ()
+{
+ worker.stop ();
+}
+
+zmq::select_t::handle_t zmq::select_t::add_fd (fd_t fd_, i_poll_events *events_)
+{
+ // Store the file descriptor.
+ fd_entry_t entry = {fd_, events_};
+ fds.push_back (entry);
+
+ // Ensure we do not attempt to select () on more than FD_SETSIZE
+ // file descriptors.
+ zmq_assert (fds.size () <= FD_SETSIZE);
+
+ // Start polling on errors.
+ FD_SET (fd_, &source_set_err);
+
+ // Adjust maxfd if necessary.
+ if (fd_ > maxfd)
+ maxfd = fd_;
+
+ // Increase the load metric of the thread.
+ adjust_load (1);
+
+ return fd_;
+}
+
+void zmq::select_t::rm_fd (handle_t handle_)
+{
+ // Mark the descriptor as retired.
+ fd_set_t::iterator it;
+ for (it = fds.begin (); it != fds.end (); ++it)
+ if (it->fd == handle_)
+ break;
+ zmq_assert (it != fds.end ());
+ it->fd = retired_fd;
+ retired = true;
+
+ // Stop polling on the descriptor.
+ FD_CLR (handle_, &source_set_in);
+ FD_CLR (handle_, &source_set_out);
+ FD_CLR (handle_, &source_set_err);
+
+ // Discard all events generated on this file descriptor.
+ FD_CLR (handle_, &readfds);
+ FD_CLR (handle_, &writefds);
+ FD_CLR (handle_, &exceptfds);
+
+ // Adjust the maxfd attribute if we have removed the
+ // highest-numbered file descriptor.
+ if (handle_ == maxfd) {
+ maxfd = retired_fd;
+ for (fd_set_t::iterator it = fds.begin (); it != fds.end (); ++it)
+ if (it->fd > maxfd)
+ maxfd = it->fd;
+ }
+
+ // Decrease the load metric of the thread.
+ adjust_load (-1);
+}
+
+void zmq::select_t::set_pollin (handle_t handle_)
+{
+ FD_SET (handle_, &source_set_in);
+}
+
+void zmq::select_t::reset_pollin (handle_t handle_)
+{
+ FD_CLR (handle_, &source_set_in);
+}
+
+void zmq::select_t::set_pollout (handle_t handle_)
+{
+ FD_SET (handle_, &source_set_out);
+}
+
+void zmq::select_t::reset_pollout (handle_t handle_)
+{
+ FD_CLR (handle_, &source_set_out);
+}
+
+void zmq::select_t::start ()
+{
+ ctx.start_thread (worker, worker_routine, this);
+}
+
+void zmq::select_t::stop ()
+{
+ stopping = true;
+}
+
+int zmq::select_t::max_fds ()
+{
+ return FD_SETSIZE;
+}
+
+void zmq::select_t::loop ()
+{
+ while (!stopping) {
+
+ // Execute any due timers.
+ int timeout = (int) execute_timers ();
+
+ // Intialise the pollsets.
+ memcpy (&readfds, &source_set_in, sizeof source_set_in);
+ memcpy (&writefds, &source_set_out, sizeof source_set_out);
+ memcpy (&exceptfds, &source_set_err, sizeof source_set_err);
+
+ // Wait for events.
+#ifdef ZMQ_HAVE_OSX
+ struct timeval tv = {(long) (timeout / 1000), timeout % 1000 * 1000};
+#else
+ struct timeval tv = {(long) (timeout / 1000),
+ (long) (timeout % 1000 * 1000)};
+#endif
+#ifdef ZMQ_HAVE_WINDOWS
+ int rc = select (0, &readfds, &writefds, &exceptfds,
+ timeout ? &tv : NULL);
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ int rc = select (maxfd + 1, &readfds, &writefds, &exceptfds,
+ timeout ? &tv : NULL);
+ if (rc == -1) {
+ errno_assert (errno == EINTR);
+ continue;
+ }
+#endif
+
+ // If there are no events (i.e. it's a timeout) there's no point
+ // in checking the pollset.
+ if (rc == 0)
+ continue;
+
+ for (fd_set_t::size_type i = 0; i < fds.size (); i ++) {
+ if (fds [i].fd == retired_fd)
+ continue;
+ if (FD_ISSET (fds [i].fd, &exceptfds))
+ fds [i].events->in_event ();
+ if (fds [i].fd == retired_fd)
+ continue;
+ if (FD_ISSET (fds [i].fd, &writefds))
+ fds [i].events->out_event ();
+ if (fds [i].fd == retired_fd)
+ continue;
+ if (FD_ISSET (fds [i].fd, &readfds))
+ fds [i].events->in_event ();
+ }
+
+ // Destroy retired event sources.
+ if (retired) {
+ fds.erase (std::remove_if (fds.begin (), fds.end (),
+ zmq::select_t::is_retired_fd), fds.end ());
+ retired = false;
+ }
+ }
+}
+
+void zmq::select_t::worker_routine (void *arg_)
+{
+ ((select_t*) arg_)->loop ();
+}
+
+bool zmq::select_t::is_retired_fd (const fd_entry_t &entry)
+{
+ return (entry.fd == retired_fd);
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/select.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/select.hpp
new file mode 100644
index 00000000..0eb29ec9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/select.hpp
@@ -0,0 +1,140 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_SELECT_HPP_INCLUDED__
+#define __ZMQ_SELECT_HPP_INCLUDED__
+
+// poller.hpp decides which polling mechanism to use.
+#include "poller.hpp"
+#if defined ZMQ_USE_SELECT
+
+#include "platform.hpp"
+
+#include <stddef.h>
+#include <vector>
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include <winsock2.h>
+#elif defined ZMQ_HAVE_OPENVMS
+#include <sys/types.h>
+#include <sys/time.h>
+#else
+#include <sys/select.h>
+#endif
+
+#include "ctx.hpp"
+#include "fd.hpp"
+#include "thread.hpp"
+#include "poller_base.hpp"
+
+namespace zmq
+{
+
+ struct i_poll_events;
+
+ // Implements socket polling mechanism using POSIX.1-2001 select()
+ // function.
+
+ class select_t : public poller_base_t
+ {
+ public:
+
+ typedef fd_t handle_t;
+
+ select_t (const ctx_t &ctx_);
+ ~select_t ();
+
+ // "poller" concept.
+ handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ void rm_fd (handle_t handle_);
+ void set_pollin (handle_t handle_);
+ void reset_pollin (handle_t handle_);
+ void set_pollout (handle_t handle_);
+ void reset_pollout (handle_t handle_);
+ void start ();
+ void stop ();
+
+ static int max_fds ();
+
+ private:
+
+ // Main worker thread routine.
+ static void worker_routine (void *arg_);
+
+ // Main event loop.
+ void loop ();
+
+ // Reference to ZMQ context.
+ const ctx_t &ctx;
+
+ struct fd_entry_t
+ {
+ fd_t fd;
+ zmq::i_poll_events *events;
+ };
+
+ // Checks if an fd_entry_t is retired.
+ static bool is_retired_fd (const fd_entry_t &entry);
+
+ // Set of file descriptors that are used to retreive
+ // information for fd_set.
+ typedef std::vector <fd_entry_t> fd_set_t;
+ fd_set_t fds;
+
+ fd_set source_set_in;
+ fd_set source_set_out;
+ fd_set source_set_err;
+
+ fd_set readfds;
+ fd_set writefds;
+ fd_set exceptfds;
+
+ // Maximum file descriptor.
+ fd_t maxfd;
+
+ // If true, at least one file descriptor has retired.
+ bool retired;
+
+ // If true, thread is shutting down.
+ bool stopping;
+
+ // Handle of the physical thread doing the I/O work.
+ thread_t worker;
+
+ select_t (const select_t&);
+ const select_t &operator = (const select_t&);
+ };
+
+ typedef select_t poller_t;
+
+}
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/session_base.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/session_base.cpp
new file mode 100644
index 00000000..86bfd8ff
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/session_base.cpp
@@ -0,0 +1,627 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "session_base.hpp"
+#include "i_engine.hpp"
+#include "err.hpp"
+#include "pipe.hpp"
+#include "likely.hpp"
+#include "tcp_connecter.hpp"
+#include "ipc_connecter.hpp"
+#include "tipc_connecter.hpp"
+#include "socks_connecter.hpp"
+#include "pgm_sender.hpp"
+#include "pgm_receiver.hpp"
+#include "address.hpp"
+#include "norm_engine.hpp"
+
+#include "ctx.hpp"
+#include "req.hpp"
+
+zmq::session_base_t *zmq::session_base_t::create (class io_thread_t *io_thread_,
+ bool active_, class socket_base_t *socket_, const options_t &options_,
+ address_t *addr_)
+{
+ session_base_t *s = NULL;
+ switch (options_.type) {
+ case ZMQ_REQ:
+ s = new (std::nothrow) req_session_t (io_thread_, active_,
+ socket_, options_, addr_);
+ break;
+ case ZMQ_DEALER:
+ case ZMQ_REP:
+ case ZMQ_ROUTER:
+ case ZMQ_PUB:
+ case ZMQ_XPUB:
+ case ZMQ_SUB:
+ case ZMQ_XSUB:
+ case ZMQ_PUSH:
+ case ZMQ_PULL:
+ case ZMQ_PAIR:
+ case ZMQ_STREAM:
+ s = new (std::nothrow) session_base_t (io_thread_, active_,
+ socket_, options_, addr_);
+ break;
+ default:
+ errno = EINVAL;
+ return NULL;
+ }
+ alloc_assert (s);
+ return s;
+}
+
+zmq::session_base_t::session_base_t (class io_thread_t *io_thread_,
+ bool active_, class socket_base_t *socket_, const options_t &options_,
+ address_t *addr_) :
+ own_t (io_thread_, options_),
+ io_object_t (io_thread_),
+ active (active_),
+ pipe (NULL),
+ zap_pipe (NULL),
+ incomplete_in (false),
+ pending (false),
+ engine (NULL),
+ socket (socket_),
+ io_thread (io_thread_),
+ has_linger_timer (false),
+ addr (addr_)
+{
+}
+
+zmq::session_base_t::~session_base_t ()
+{
+ zmq_assert (!pipe);
+ zmq_assert (!zap_pipe);
+
+ // If there's still a pending linger timer, remove it.
+ if (has_linger_timer) {
+ cancel_timer (linger_timer_id);
+ has_linger_timer = false;
+ }
+
+ // Close the engine.
+ if (engine)
+ engine->terminate ();
+
+ delete addr;
+}
+
+void zmq::session_base_t::attach_pipe (pipe_t *pipe_)
+{
+ zmq_assert (!is_terminating ());
+ zmq_assert (!pipe);
+ zmq_assert (pipe_);
+ pipe = pipe_;
+ pipe->set_event_sink (this);
+}
+
+int zmq::session_base_t::pull_msg (msg_t *msg_)
+{
+ if (!pipe || !pipe->read (msg_)) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ incomplete_in = msg_->flags () & msg_t::more ? true : false;
+
+ return 0;
+}
+
+int zmq::session_base_t::push_msg (msg_t *msg_)
+{
+ if (pipe && pipe->write (msg_)) {
+ int rc = msg_->init ();
+ errno_assert (rc == 0);
+ return 0;
+ }
+
+ errno = EAGAIN;
+ return -1;
+}
+
+int zmq::session_base_t::read_zap_msg (msg_t *msg_)
+{
+ if (zap_pipe == NULL) {
+ errno = ENOTCONN;
+ return -1;
+ }
+
+ if (!zap_pipe->read (msg_)) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ return 0;
+}
+
+int zmq::session_base_t::write_zap_msg (msg_t *msg_)
+{
+ if (zap_pipe == NULL) {
+ errno = ENOTCONN;
+ return -1;
+ }
+
+ const bool ok = zap_pipe->write (msg_);
+ zmq_assert (ok);
+
+ if ((msg_->flags () & msg_t::more) == 0)
+ zap_pipe->flush ();
+
+ const int rc = msg_->init ();
+ errno_assert (rc == 0);
+ return 0;
+}
+
+void zmq::session_base_t::reset ()
+{
+}
+
+void zmq::session_base_t::flush ()
+{
+ if (pipe)
+ pipe->flush ();
+}
+
+void zmq::session_base_t::clean_pipes ()
+{
+ zmq_assert (pipe != NULL);
+
+ // Get rid of half-processed messages in the out pipe. Flush any
+ // unflushed messages upstream.
+ pipe->rollback ();
+ pipe->flush ();
+
+ // Remove any half-read message from the in pipe.
+ while (incomplete_in) {
+ msg_t msg;
+ int rc = msg.init ();
+ errno_assert (rc == 0);
+ rc = pull_msg (&msg);
+ errno_assert (rc == 0);
+ rc = msg.close ();
+ errno_assert (rc == 0);
+ }
+}
+
+void zmq::session_base_t::pipe_terminated (pipe_t *pipe_)
+{
+ // Drop the reference to the deallocated pipe if required.
+ zmq_assert (pipe_ == pipe
+ || pipe_ == zap_pipe
+ || terminating_pipes.count (pipe_) == 1);
+
+ if (pipe_ == pipe) {
+ // If this is our current pipe, remove it
+ pipe = NULL;
+ if (has_linger_timer) {
+ cancel_timer (linger_timer_id);
+ has_linger_timer = false;
+ }
+ } else
+ if (pipe_ == zap_pipe)
+ zap_pipe = NULL;
+ else
+ // Remove the pipe from the detached pipes set
+ terminating_pipes.erase (pipe_);
+
+ if (!is_terminating () && options.raw_sock) {
+ if (engine) {
+ engine->terminate ();
+ engine = NULL;
+ }
+ terminate ();
+ }
+
+ // If we are waiting for pending messages to be sent, at this point
+ // we are sure that there will be no more messages and we can proceed
+ // with termination safely.
+ if (pending && !pipe && !zap_pipe && terminating_pipes.empty ()) {
+ pending = false;
+ own_t::process_term (0);
+ }
+}
+
+void zmq::session_base_t::read_activated (pipe_t *pipe_)
+{
+ // Skip activating if we're detaching this pipe
+ if (unlikely (pipe_ != pipe && pipe_ != zap_pipe)) {
+ zmq_assert (terminating_pipes.count (pipe_) == 1);
+ return;
+ }
+
+ if (unlikely (engine == NULL)) {
+ pipe->check_read ();
+ return;
+ }
+
+ if (likely (pipe_ == pipe))
+ engine->restart_output ();
+ else
+ engine->zap_msg_available ();
+}
+
+void zmq::session_base_t::write_activated (pipe_t *pipe_)
+{
+ // Skip activating if we're detaching this pipe
+ if (pipe != pipe_) {
+ zmq_assert (terminating_pipes.count (pipe_) == 1);
+ return;
+ }
+
+ if (engine)
+ engine->restart_input ();
+}
+
+void zmq::session_base_t::hiccuped (pipe_t *)
+{
+ // Hiccups are always sent from session to socket, not the other
+ // way round.
+ zmq_assert (false);
+}
+
+zmq::socket_base_t *zmq::session_base_t::get_socket ()
+{
+ return socket;
+}
+
+void zmq::session_base_t::process_plug ()
+{
+ if (active)
+ start_connecting (false);
+}
+
+int zmq::session_base_t::zap_connect ()
+{
+ zmq_assert (zap_pipe == NULL);
+
+ endpoint_t peer = find_endpoint ("inproc://zeromq.zap.01");
+ if (peer.socket == NULL) {
+ errno = ECONNREFUSED;
+ return -1;
+ }
+ if (peer.options.type != ZMQ_REP
+ && peer.options.type != ZMQ_ROUTER) {
+ errno = ECONNREFUSED;
+ return -1;
+ }
+
+ // Create a bi-directional pipe that will connect
+ // session with zap socket.
+ object_t *parents [2] = {this, peer.socket};
+ pipe_t *new_pipes [2] = {NULL, NULL};
+ int hwms [2] = {0, 0};
+ bool conflates [2] = {false, false};
+ int rc = pipepair (parents, new_pipes, hwms, conflates);
+ errno_assert (rc == 0);
+
+ // Attach local end of the pipe to this socket object.
+ zap_pipe = new_pipes [0];
+ zap_pipe->set_nodelay ();
+ zap_pipe->set_event_sink (this);
+
+ send_bind (peer.socket, new_pipes [1], false);
+
+ // Send empty identity if required by the peer.
+ if (peer.options.recv_identity) {
+ msg_t id;
+ rc = id.init ();
+ errno_assert (rc == 0);
+ id.set_flags (msg_t::identity);
+ bool ok = zap_pipe->write (&id);
+ zmq_assert (ok);
+ zap_pipe->flush ();
+ }
+
+ return 0;
+}
+
+bool zmq::session_base_t::zap_enabled ()
+{
+ return (
+ options.mechanism != ZMQ_NULL ||
+ (options.mechanism == ZMQ_NULL && options.zap_domain.length() > 0)
+ );
+}
+
+void zmq::session_base_t::process_attach (i_engine *engine_)
+{
+ zmq_assert (engine_ != NULL);
+
+ // Create the pipe if it does not exist yet.
+ if (!pipe && !is_terminating ()) {
+ object_t *parents [2] = {this, socket};
+ pipe_t *pipes [2] = {NULL, NULL};
+
+ bool conflate = options.conflate &&
+ (options.type == ZMQ_DEALER ||
+ options.type == ZMQ_PULL ||
+ options.type == ZMQ_PUSH ||
+ options.type == ZMQ_PUB ||
+ options.type == ZMQ_SUB);
+
+ int hwms [2] = {conflate? -1 : options.rcvhwm,
+ conflate? -1 : options.sndhwm};
+ bool conflates [2] = {conflate, conflate};
+ int rc = pipepair (parents, pipes, hwms, conflates);
+ errno_assert (rc == 0);
+
+ // Plug the local end of the pipe.
+ pipes [0]->set_event_sink (this);
+
+ // Remember the local end of the pipe.
+ zmq_assert (!pipe);
+ pipe = pipes [0];
+
+ // Ask socket to plug into the remote end of the pipe.
+ send_bind (socket, pipes [1]);
+ }
+
+ // Plug in the engine.
+ zmq_assert (!engine);
+ engine = engine_;
+ engine->plug (io_thread, this);
+}
+
+void zmq::session_base_t::engine_error (
+ zmq::stream_engine_t::error_reason_t reason)
+{
+ // Engine is dead. Let's forget about it.
+ engine = NULL;
+
+ // Remove any half-done messages from the pipes.
+ if (pipe)
+ clean_pipes ();
+
+ zmq_assert (reason == stream_engine_t::connection_error
+ || reason == stream_engine_t::timeout_error
+ || reason == stream_engine_t::protocol_error);
+
+ switch (reason) {
+ case stream_engine_t::timeout_error:
+ case stream_engine_t::connection_error:
+ if (active)
+ reconnect ();
+ else
+ terminate ();
+ break;
+ case stream_engine_t::protocol_error:
+ terminate ();
+ break;
+ }
+
+ // Just in case there's only a delimiter in the pipe.
+ if (pipe)
+ pipe->check_read ();
+
+ if (zap_pipe)
+ zap_pipe->check_read ();
+}
+
+void zmq::session_base_t::process_term (int linger_)
+{
+ zmq_assert (!pending);
+
+ // If the termination of the pipe happens before the term command is
+ // delivered there's nothing much to do. We can proceed with the
+ // standard termination immediately.
+ if (!pipe && !zap_pipe && terminating_pipes.empty ()) {
+ own_t::process_term (0);
+ return;
+ }
+
+ pending = true;
+
+ if (pipe != NULL) {
+ // If there's finite linger value, delay the termination.
+ // If linger is infinite (negative) we don't even have to set
+ // the timer.
+ if (linger_ > 0) {
+ zmq_assert (!has_linger_timer);
+ add_timer (linger_, linger_timer_id);
+ has_linger_timer = true;
+ }
+
+ // Start pipe termination process. Delay the termination till all messages
+ // are processed in case the linger time is non-zero.
+ pipe->terminate (linger_ != 0);
+
+ // TODO: Should this go into pipe_t::terminate ?
+ // In case there's no engine and there's only delimiter in the
+ // pipe it wouldn't be ever read. Thus we check for it explicitly.
+ pipe->check_read ();
+ }
+
+ if (zap_pipe != NULL)
+ zap_pipe->terminate (false);
+}
+
+void zmq::session_base_t::timer_event (int id_)
+{
+ // Linger period expired. We can proceed with termination even though
+ // there are still pending messages to be sent.
+ zmq_assert (id_ == linger_timer_id);
+ has_linger_timer = false;
+
+ // Ask pipe to terminate even though there may be pending messages in it.
+ zmq_assert (pipe);
+ pipe->terminate (false);
+}
+
+void zmq::session_base_t::reconnect ()
+{
+ // For delayed connect situations, terminate the pipe
+ // and reestablish later on
+ if (pipe && options.immediate == 1
+ && addr->protocol != "pgm" && addr->protocol != "epgm"
+ && addr->protocol != "norm") {
+ pipe->hiccup ();
+ pipe->terminate (false);
+ terminating_pipes.insert (pipe);
+ pipe = NULL;
+ }
+
+ reset ();
+
+ // Reconnect.
+ if (options.reconnect_ivl != -1)
+ start_connecting (true);
+
+ // For subscriber sockets we hiccup the inbound pipe, which will cause
+ // the socket object to resend all the subscriptions.
+ if (pipe && (options.type == ZMQ_SUB || options.type == ZMQ_XSUB))
+ pipe->hiccup ();
+}
+
+void zmq::session_base_t::start_connecting (bool wait_)
+{
+ zmq_assert (active);
+
+ // Choose I/O thread to run connecter in. Given that we are already
+ // running in an I/O thread, there must be at least one available.
+ io_thread_t *io_thread = choose_io_thread (options.affinity);
+ zmq_assert (io_thread);
+
+ // Create the connecter object.
+
+ if (addr->protocol == "tcp") {
+ if (!options.socks_proxy_address.empty()) {
+ address_t *proxy_address = new (std::nothrow)
+ address_t ("tcp", options.socks_proxy_address);
+ alloc_assert (proxy_address);
+ socks_connecter_t *connecter =
+ new (std::nothrow) socks_connecter_t (
+ io_thread, this, options, addr, proxy_address, wait_);
+ alloc_assert (connecter);
+ launch_child (connecter);
+ }
+ else {
+ tcp_connecter_t *connecter = new (std::nothrow)
+ tcp_connecter_t (io_thread, this, options, addr, wait_);
+ alloc_assert (connecter);
+ launch_child (connecter);
+ }
+ return;
+ }
+
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+ if (addr->protocol == "ipc") {
+ ipc_connecter_t *connecter = new (std::nothrow) ipc_connecter_t (
+ io_thread, this, options, addr, wait_);
+ alloc_assert (connecter);
+ launch_child (connecter);
+ return;
+ }
+#endif
+#if defined ZMQ_HAVE_TIPC
+ if (addr->protocol == "tipc") {
+ tipc_connecter_t *connecter = new (std::nothrow) tipc_connecter_t (
+ io_thread, this, options, addr, wait_);
+ alloc_assert (connecter);
+ launch_child (connecter);
+ return;
+ }
+#endif
+
+#ifdef ZMQ_HAVE_OPENPGM
+
+ // Both PGM and EPGM transports are using the same infrastructure.
+ if (addr->protocol == "pgm" || addr->protocol == "epgm") {
+
+ zmq_assert (options.type == ZMQ_PUB || options.type == ZMQ_XPUB
+ || options.type == ZMQ_SUB || options.type == ZMQ_XSUB);
+
+ // For EPGM transport with UDP encapsulation of PGM is used.
+ bool const udp_encapsulation = addr->protocol == "epgm";
+
+ // At this point we'll create message pipes to the session straight
+ // away. There's no point in delaying it as no concept of 'connect'
+ // exists with PGM anyway.
+ if (options.type == ZMQ_PUB || options.type == ZMQ_XPUB) {
+
+ // PGM sender.
+ pgm_sender_t *pgm_sender = new (std::nothrow) pgm_sender_t (
+ io_thread, options);
+ alloc_assert (pgm_sender);
+
+ int rc = pgm_sender->init (udp_encapsulation, addr->address.c_str ());
+ errno_assert (rc == 0);
+
+ send_attach (this, pgm_sender);
+ }
+ else {
+
+ // PGM receiver.
+ pgm_receiver_t *pgm_receiver = new (std::nothrow) pgm_receiver_t (
+ io_thread, options);
+ alloc_assert (pgm_receiver);
+
+ int rc = pgm_receiver->init (udp_encapsulation, addr->address.c_str ());
+ errno_assert (rc == 0);
+
+ send_attach (this, pgm_receiver);
+ }
+
+ return;
+ }
+#endif
+
+#ifdef ZMQ_HAVE_NORM
+ if (addr->protocol == "norm") {
+ // At this point we'll create message pipes to the session straight
+ // away. There's no point in delaying it as no concept of 'connect'
+ // exists with NORM anyway.
+ if (options.type == ZMQ_PUB || options.type == ZMQ_XPUB) {
+
+ // NORM sender.
+ norm_engine_t* norm_sender = new (std::nothrow) norm_engine_t(io_thread, options);
+ alloc_assert (norm_sender);
+
+ int rc = norm_sender->init (addr->address.c_str (), true, false);
+ errno_assert (rc == 0);
+
+ send_attach (this, norm_sender);
+ }
+ else { // ZMQ_SUB or ZMQ_XSUB
+
+ // NORM receiver.
+ norm_engine_t* norm_receiver = new (std::nothrow) norm_engine_t (io_thread, options);
+ alloc_assert (norm_receiver);
+
+ int rc = norm_receiver->init (addr->address.c_str (), false, true);
+ errno_assert (rc == 0);
+
+ send_attach (this, norm_receiver);
+ }
+ return;
+ }
+#endif // ZMQ_HAVE_NORM
+
+ zmq_assert (false);
+}
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/session_base.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/session_base.hpp
new file mode 100644
index 00000000..8730c271
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/session_base.hpp
@@ -0,0 +1,172 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_SESSION_BASE_HPP_INCLUDED__
+#define __ZMQ_SESSION_BASE_HPP_INCLUDED__
+
+#include <string>
+#include <stdarg.h>
+
+#include "own.hpp"
+#include "io_object.hpp"
+#include "pipe.hpp"
+#include "socket_base.hpp"
+#include "stream_engine.hpp"
+
+namespace zmq
+{
+
+ class pipe_t;
+ class io_thread_t;
+ class socket_base_t;
+ struct i_engine;
+ struct address_t;
+
+ class session_base_t :
+ public own_t,
+ public io_object_t,
+ public i_pipe_events
+ {
+ public:
+
+ // Create a session of the particular type.
+ static session_base_t *create (zmq::io_thread_t *io_thread_,
+ bool active_, zmq::socket_base_t *socket_,
+ const options_t &options_, address_t *addr_);
+
+ // To be used once only, when creating the session.
+ void attach_pipe (zmq::pipe_t *pipe_);
+
+ // Following functions are the interface exposed towards the engine.
+ virtual void reset ();
+ void flush ();
+ void engine_error (zmq::stream_engine_t::error_reason_t reason);
+
+ // i_pipe_events interface implementation.
+ void read_activated (zmq::pipe_t *pipe_);
+ void write_activated (zmq::pipe_t *pipe_);
+ void hiccuped (zmq::pipe_t *pipe_);
+ void pipe_terminated (zmq::pipe_t *pipe_);
+
+ // Delivers a message. Returns 0 if successful; -1 otherwise.
+ // The function takes ownership of the message.
+ int push_msg (msg_t *msg_);
+
+ int zap_connect ();
+ bool zap_enabled ();
+
+ // Fetches a message. Returns 0 if successful; -1 otherwise.
+ // The caller is responsible for freeing the message when no
+ // longer used.
+ int pull_msg (msg_t *msg_);
+
+ // Receives message from ZAP socket.
+ // Returns 0 on success; -1 otherwise.
+ // The caller is responsible for freeing the message.
+ int read_zap_msg (msg_t *msg_);
+
+ // Sends message to ZAP socket.
+ // Returns 0 on success; -1 otherwise.
+ // The function takes ownership of the message.
+ int write_zap_msg (msg_t *msg_);
+
+ socket_base_t *get_socket ();
+
+ protected:
+
+ session_base_t (zmq::io_thread_t *io_thread_, bool active_,
+ zmq::socket_base_t *socket_, const options_t &options_,
+ address_t *addr_);
+ virtual ~session_base_t ();
+
+ private:
+
+ void start_connecting (bool wait_);
+
+ void reconnect ();
+
+ // Handlers for incoming commands.
+ void process_plug ();
+ void process_attach (zmq::i_engine *engine_);
+ void process_term (int linger_);
+
+ // i_poll_events handlers.
+ void timer_event (int id_);
+
+ // Remove any half processed messages. Flush unflushed messages.
+ // Call this function when engine disconnect to get rid of leftovers.
+ void clean_pipes ();
+
+ // If true, this session (re)connects to the peer. Otherwise, it's
+ // a transient session created by the listener.
+ const bool active;
+
+ // Pipe connecting the session to its socket.
+ zmq::pipe_t *pipe;
+
+ // Pipe used to exchange messages with ZAP socket.
+ zmq::pipe_t *zap_pipe;
+
+ // This set is added to with pipes we are disconnecting, but haven't yet completed
+ std::set <pipe_t *> terminating_pipes;
+
+ // This flag is true if the remainder of the message being processed
+ // is still in the in pipe.
+ bool incomplete_in;
+
+ // True if termination have been suspended to push the pending
+ // messages to the network.
+ bool pending;
+
+ // The protocol I/O engine connected to the session.
+ zmq::i_engine *engine;
+
+ // The socket the session belongs to.
+ zmq::socket_base_t *socket;
+
+ // I/O thread the session is living in. It will be used to plug in
+ // the engines into the same thread.
+ zmq::io_thread_t *io_thread;
+
+ // ID of the linger timer
+ enum {linger_timer_id = 0x20};
+
+ // True is linger timer is running.
+ bool has_linger_timer;
+
+ // Protocol and address to use when connecting.
+ address_t *addr;
+
+ session_base_t (const session_base_t&);
+ const session_base_t &operator = (const session_base_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/signaler.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/signaler.cpp
new file mode 100644
index 00000000..e6fa9833
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/signaler.cpp
@@ -0,0 +1,568 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "poller.hpp"
+
+// On AIX, poll.h has to be included before zmq.h to get consistent
+// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents'
+// instead of 'events' and 'revents' and defines macros to map from POSIX-y
+// names to AIX-specific names).
+#if defined ZMQ_POLL_BASED_ON_POLL
+#include <poll.h>
+#elif defined ZMQ_POLL_BASED_ON_SELECT
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#elif defined ZMQ_HAVE_HPUX
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#elif defined ZMQ_HAVE_OPENVMS
+#include <sys/types.h>
+#include <sys/time.h>
+#else
+#include <sys/select.h>
+#endif
+#endif
+
+#include "signaler.hpp"
+#include "likely.hpp"
+#include "stdint.hpp"
+#include "config.hpp"
+#include "err.hpp"
+#include "fd.hpp"
+#include "ip.hpp"
+
+#if defined ZMQ_HAVE_EVENTFD
+#include <sys/eventfd.h>
+#endif
+
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <unistd.h>
+#include <netinet/tcp.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#endif
+
+#if !defined (ZMQ_HAVE_WINDOWS)
+// Helper to sleep for specific number of milliseconds (or until signal)
+//
+static int sleep_ms (unsigned int ms_)
+{
+ if (ms_ == 0)
+ return 0;
+#if defined ZMQ_HAVE_WINDOWS
+ Sleep (ms_ > 0 ? ms_ : INFINITE);
+ return 0;
+#elif defined ZMQ_HAVE_ANDROID
+ usleep (ms_ * 1000);
+ return 0;
+#else
+ return usleep (ms_ * 1000);
+#endif
+}
+
+// Helper to wait on close(), for non-blocking sockets, until it completes
+// If EAGAIN is received, will sleep briefly (1-100ms) then try again, until
+// the overall timeout is reached.
+//
+static int close_wait_ms (int fd_, unsigned int max_ms_ = 2000)
+{
+ unsigned int ms_so_far = 0;
+ unsigned int step_ms = max_ms_ / 10;
+ if (step_ms < 1)
+ step_ms = 1;
+
+ if (step_ms > 100)
+ step_ms = 100;
+
+ int rc = 0; // do not sleep on first attempt
+
+ do
+ {
+ if (rc == -1 && errno == EAGAIN)
+ {
+ sleep_ms (step_ms);
+ ms_so_far += step_ms;
+ }
+
+ rc = close (fd_);
+ } while (ms_so_far < max_ms_ && rc == -1 && errno == EAGAIN);
+
+ return rc;
+}
+#endif
+
+zmq::signaler_t::signaler_t ()
+{
+ // Create the socketpair for signaling.
+ if (make_fdpair (&r, &w) == 0) {
+ unblock_socket (w);
+ unblock_socket (r);
+ }
+#ifdef HAVE_FORK
+ pid = getpid ();
+#endif
+}
+
+zmq::signaler_t::~signaler_t ()
+{
+#if defined ZMQ_HAVE_EVENTFD
+ int rc = close_wait_ms (r);
+ errno_assert (rc == 0);
+#elif defined ZMQ_HAVE_WINDOWS
+ const struct linger so_linger = { 1, 0 };
+ int rc = setsockopt (w, SOL_SOCKET, SO_LINGER,
+ (const char *) &so_linger, sizeof so_linger);
+ // Only check shutdown if WSASTARTUP was previously done
+ if (rc == 0 || WSAGetLastError () != WSANOTINITIALISED) {
+ wsa_assert (rc != SOCKET_ERROR);
+ rc = closesocket (w);
+ wsa_assert (rc != SOCKET_ERROR);
+ rc = closesocket (r);
+ wsa_assert (rc != SOCKET_ERROR);
+ }
+#else
+ int rc = close_wait_ms (w);
+ errno_assert (rc == 0);
+ rc = close_wait_ms (r);
+ errno_assert (rc == 0);
+#endif
+}
+
+zmq::fd_t zmq::signaler_t::get_fd () const
+{
+ return r;
+}
+
+void zmq::signaler_t::send ()
+{
+#if defined HAVE_FORK
+ if (unlikely (pid != getpid ())) {
+ //printf("Child process %d signaler_t::send returning without sending #1\n", getpid());
+ return; // do not send anything in forked child context
+ }
+#endif
+#if defined ZMQ_HAVE_EVENTFD
+ const uint64_t inc = 1;
+ ssize_t sz = write (w, &inc, sizeof (inc));
+ errno_assert (sz == sizeof (inc));
+#elif defined ZMQ_HAVE_WINDOWS
+ unsigned char dummy = 0;
+ int nbytes = ::send (w, (char*) &dummy, sizeof (dummy), 0);
+ wsa_assert (nbytes != SOCKET_ERROR);
+ zmq_assert (nbytes == sizeof (dummy));
+#else
+ unsigned char dummy = 0;
+ while (true) {
+ ssize_t nbytes = ::send (w, &dummy, sizeof (dummy), 0);
+ if (unlikely (nbytes == -1 && errno == EINTR))
+ continue;
+#if defined(HAVE_FORK)
+ if (unlikely (pid != getpid ())) {
+ //printf("Child process %d signaler_t::send returning without sending #2\n", getpid());
+ errno = EINTR;
+ break;
+ }
+#endif
+ zmq_assert (nbytes == sizeof dummy);
+ break;
+ }
+#endif
+}
+
+int zmq::signaler_t::wait (int timeout_)
+{
+#ifdef HAVE_FORK
+ if (unlikely (pid != getpid ())) {
+ // we have forked and the file descriptor is closed. Emulate an interupt
+ // response.
+ //printf("Child process %d signaler_t::wait returning simulating interrupt #1\n", getpid());
+ errno = EINTR;
+ return -1;
+ }
+#endif
+
+#ifdef ZMQ_POLL_BASED_ON_POLL
+ struct pollfd pfd;
+ pfd.fd = r;
+ pfd.events = POLLIN;
+ int rc = poll (&pfd, 1, timeout_);
+ if (unlikely (rc < 0)) {
+ errno_assert (errno == EINTR);
+ return -1;
+ }
+ else
+ if (unlikely (rc == 0)) {
+ errno = EAGAIN;
+ return -1;
+ }
+#ifdef HAVE_FORK
+ else
+ if (unlikely (pid != getpid ())) {
+ // we have forked and the file descriptor is closed. Emulate an interupt
+ // response.
+ //printf("Child process %d signaler_t::wait returning simulating interrupt #2\n", getpid());
+ errno = EINTR;
+ return -1;
+ }
+#endif
+ zmq_assert (rc == 1);
+ zmq_assert (pfd.revents & POLLIN);
+ return 0;
+
+#elif defined ZMQ_POLL_BASED_ON_SELECT
+
+ fd_set fds;
+ FD_ZERO (&fds);
+ FD_SET (r, &fds);
+ struct timeval timeout;
+ if (timeout_ >= 0) {
+ timeout.tv_sec = timeout_ / 1000;
+ timeout.tv_usec = timeout_ % 1000 * 1000;
+ }
+#ifdef ZMQ_HAVE_WINDOWS
+ int rc = select (0, &fds, NULL, NULL,
+ timeout_ >= 0 ? &timeout : NULL);
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ int rc = select (r + 1, &fds, NULL, NULL,
+ timeout_ >= 0 ? &timeout : NULL);
+ if (unlikely (rc < 0)) {
+ errno_assert (errno == EINTR);
+ return -1;
+ }
+#endif
+ if (unlikely (rc == 0)) {
+ errno = EAGAIN;
+ return -1;
+ }
+ zmq_assert (rc == 1);
+ return 0;
+
+#else
+#error
+#endif
+}
+
+void zmq::signaler_t::recv ()
+{
+ // Attempt to read a signal.
+#if defined ZMQ_HAVE_EVENTFD
+ uint64_t dummy;
+ ssize_t sz = read (r, &dummy, sizeof (dummy));
+ errno_assert (sz == sizeof (dummy));
+
+ // If we accidentally grabbed the next signal along with the current
+ // one, return it back to the eventfd object.
+ if (unlikely (dummy == 2)) {
+ const uint64_t inc = 1;
+ ssize_t sz2 = write (w, &inc, sizeof (inc));
+ errno_assert (sz2 == sizeof (inc));
+ return;
+ }
+
+ zmq_assert (dummy == 1);
+#else
+ unsigned char dummy;
+#if defined ZMQ_HAVE_WINDOWS
+ int nbytes = ::recv (r, (char*) &dummy, sizeof (dummy), 0);
+ wsa_assert (nbytes != SOCKET_ERROR);
+#else
+ ssize_t nbytes = ::recv (r, &dummy, sizeof (dummy), 0);
+ errno_assert (nbytes >= 0);
+#endif
+ zmq_assert (nbytes == sizeof (dummy));
+ zmq_assert (dummy == 0);
+#endif
+}
+
+#ifdef HAVE_FORK
+void zmq::signaler_t::forked ()
+{
+ // Close file descriptors created in the parent and create new pair
+ close (r);
+ close (w);
+ make_fdpair (&r, &w);
+}
+#endif
+
+// Returns -1 if we could not make the socket pair successfully
+int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
+{
+#if defined ZMQ_HAVE_EVENTFD
+ fd_t fd = eventfd (0, 0);
+ if (fd == -1) {
+ errno_assert (errno == ENFILE || errno == EMFILE);
+ *w_ = *r_ = -1;
+ return -1;
+ }
+ else {
+ *w_ = *r_ = fd;
+ return 0;
+ }
+
+#elif defined ZMQ_HAVE_WINDOWS
+# if !defined _WIN32_WCE
+ // Windows CE does not manage security attributes
+ SECURITY_DESCRIPTOR sd;
+ SECURITY_ATTRIBUTES sa;
+ memset (&sd, 0, sizeof sd);
+ memset (&sa, 0, sizeof sa);
+
+ InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
+ SetSecurityDescriptorDacl (&sd, TRUE, 0, FALSE);
+
+ sa.nLength = sizeof (SECURITY_ATTRIBUTES);
+ sa.lpSecurityDescriptor = &sd;
+# endif
+
+ // This function has to be in a system-wide critical section so that
+ // two instances of the library don't accidentally create signaler
+ // crossing the process boundary.
+ // We'll use named event object to implement the critical section.
+ // Note that if the event object already exists, the CreateEvent requests
+ // EVENT_ALL_ACCESS access right. If this fails, we try to open
+ // the event object asking for SYNCHRONIZE access only.
+ HANDLE sync = NULL;
+
+ // Create critical section only if using fixed signaler port
+ // Use problematic Event implementation for compatibility if using old port 5905.
+ // Otherwise use Mutex implementation.
+ int event_signaler_port = 5905;
+
+ if (signaler_port == event_signaler_port) {
+# if !defined _WIN32_WCE
+ sync = CreateEventW (&sa, FALSE, TRUE, L"Global\\zmq-signaler-port-sync");
+# else
+ sync = CreateEventW (NULL, FALSE, TRUE, L"Global\\zmq-signaler-port-sync");
+# endif
+ if (sync == NULL && GetLastError () == ERROR_ACCESS_DENIED)
+ sync = OpenEventW (SYNCHRONIZE | EVENT_MODIFY_STATE,
+ FALSE, L"Global\\zmq-signaler-port-sync");
+
+ win_assert (sync != NULL);
+ }
+ else
+ if (signaler_port != 0) {
+ wchar_t mutex_name [MAX_PATH];
+# ifdef __MINGW32__
+ _snwprintf (mutex_name, MAX_PATH, L"Global\\zmq-signaler-port-%d", signaler_port);
+# else
+ swprintf (mutex_name, MAX_PATH, L"Global\\zmq-signaler-port-%d", signaler_port);
+# endif
+
+# if !defined _WIN32_WCE
+ sync = CreateMutexW (&sa, FALSE, mutex_name);
+# else
+ sync = CreateMutexW (NULL, FALSE, mutex_name);
+# endif
+ if (sync == NULL && GetLastError () == ERROR_ACCESS_DENIED)
+ sync = OpenMutexW (SYNCHRONIZE, FALSE, mutex_name);
+
+ win_assert (sync != NULL);
+ }
+
+ // Windows has no 'socketpair' function. CreatePipe is no good as pipe
+ // handles cannot be polled on. Here we create the socketpair by hand.
+ *w_ = INVALID_SOCKET;
+ *r_ = INVALID_SOCKET;
+
+ // Create listening socket.
+ SOCKET listener;
+ listener = open_socket (AF_INET, SOCK_STREAM, 0);
+ wsa_assert (listener != INVALID_SOCKET);
+
+ // Set SO_REUSEADDR and TCP_NODELAY on listening socket.
+ BOOL so_reuseaddr = 1;
+ int rc = setsockopt (listener, SOL_SOCKET, SO_REUSEADDR,
+ (char *)&so_reuseaddr, sizeof so_reuseaddr);
+ wsa_assert (rc != SOCKET_ERROR);
+ BOOL tcp_nodelay = 1;
+ rc = setsockopt (listener, IPPROTO_TCP, TCP_NODELAY,
+ (char *)&tcp_nodelay, sizeof tcp_nodelay);
+ wsa_assert (rc != SOCKET_ERROR);
+
+ // Init sockaddr to signaler port.
+ struct sockaddr_in addr;
+ memset (&addr, 0, sizeof addr);
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
+ addr.sin_port = htons (signaler_port);
+
+ // Create the writer socket.
+ *w_ = open_socket (AF_INET, SOCK_STREAM, 0);
+ wsa_assert (*w_ != INVALID_SOCKET);
+
+ // Set TCP_NODELAY on writer socket.
+ rc = setsockopt (*w_, IPPROTO_TCP, TCP_NODELAY,
+ (char *) &tcp_nodelay, sizeof tcp_nodelay);
+ wsa_assert (rc != SOCKET_ERROR);
+
+ if (sync != NULL) {
+ // Enter the critical section.
+ DWORD dwrc = WaitForSingleObject (sync, INFINITE);
+ zmq_assert (dwrc == WAIT_OBJECT_0 || dwrc == WAIT_ABANDONED);
+ }
+
+ // Bind listening socket to signaler port.
+ rc = bind (listener, (const struct sockaddr*) &addr, sizeof addr);
+
+ if (rc != SOCKET_ERROR && signaler_port == 0) {
+ // Retrieve ephemeral port number
+ int addrlen = sizeof addr;
+ rc = getsockname (listener, (struct sockaddr*) &addr, &addrlen);
+ }
+
+ // Listen for incoming connections.
+ if (rc != SOCKET_ERROR)
+ rc = listen (listener, 1);
+
+ // Connect writer to the listener.
+ if (rc != SOCKET_ERROR)
+ rc = connect (*w_, (struct sockaddr*) &addr, sizeof addr);
+
+ // Accept connection from writer.
+ if (rc != SOCKET_ERROR)
+ *r_ = accept (listener, NULL, NULL);
+
+ // Save errno if error occurred in bind/listen/connect/accept.
+ int saved_errno = 0;
+ if (*r_ == INVALID_SOCKET)
+ saved_errno = WSAGetLastError ();
+
+ // We don't need the listening socket anymore. Close it.
+ closesocket (listener);
+
+ if (sync != NULL) {
+ // Exit the critical section.
+ BOOL brc;
+ if (signaler_port == event_signaler_port)
+ brc = SetEvent (sync);
+ else
+ brc = ReleaseMutex (sync);
+ win_assert (brc != 0);
+
+ // Release the kernel object
+ brc = CloseHandle (sync);
+ win_assert (brc != 0);
+ }
+
+ if (*r_ != INVALID_SOCKET) {
+# if !defined _WIN32_WCE
+ // On Windows, preventing sockets to be inherited by child processes.
+ BOOL brc = SetHandleInformation ((HANDLE) *r_, HANDLE_FLAG_INHERIT, 0);
+ win_assert (brc);
+# endif
+ return 0;
+ }
+ else {
+ // Cleanup writer if connection failed
+ if (*w_ != INVALID_SOCKET) {
+ rc = closesocket (*w_);
+ wsa_assert (rc != SOCKET_ERROR);
+ *w_ = INVALID_SOCKET;
+ }
+ // Set errno from saved value
+ errno = wsa_error_to_errno (saved_errno);
+ return -1;
+ }
+
+#elif defined ZMQ_HAVE_OPENVMS
+
+ // Whilst OpenVMS supports socketpair - it maps to AF_INET only. Further,
+ // it does not set the socket options TCP_NODELAY and TCP_NODELACK which
+ // can lead to performance problems.
+ //
+ // The bug will be fixed in V5.6 ECO4 and beyond. In the meantime, we'll
+ // create the socket pair manually.
+ struct sockaddr_in lcladdr;
+ memset (&lcladdr, 0, sizeof lcladdr);
+ lcladdr.sin_family = AF_INET;
+ lcladdr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
+ lcladdr.sin_port = 0;
+
+ int listener = open_socket (AF_INET, SOCK_STREAM, 0);
+ errno_assert (listener != -1);
+
+ int on = 1;
+ int rc = setsockopt (listener, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on);
+ errno_assert (rc != -1);
+
+ rc = setsockopt (listener, IPPROTO_TCP, TCP_NODELACK, &on, sizeof on);
+ errno_assert (rc != -1);
+
+ rc = bind (listener, (struct sockaddr*) &lcladdr, sizeof lcladdr);
+ errno_assert (rc != -1);
+
+ socklen_t lcladdr_len = sizeof lcladdr;
+
+ rc = getsockname (listener, (struct sockaddr*) &lcladdr, &lcladdr_len);
+ errno_assert (rc != -1);
+
+ rc = listen (listener, 1);
+ errno_assert (rc != -1);
+
+ *w_ = open_socket (AF_INET, SOCK_STREAM, 0);
+ errno_assert (*w_ != -1);
+
+ rc = setsockopt (*w_, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on);
+ errno_assert (rc != -1);
+
+ rc = setsockopt (*w_, IPPROTO_TCP, TCP_NODELACK, &on, sizeof on);
+ errno_assert (rc != -1);
+
+ rc = connect (*w_, (struct sockaddr*) &lcladdr, sizeof lcladdr);
+ errno_assert (rc != -1);
+
+ *r_ = accept (listener, NULL, NULL);
+ errno_assert (*r_ != -1);
+
+ close (listener);
+
+ return 0;
+
+#else
+ // All other implementations support socketpair()
+ int sv [2];
+ int rc = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
+ if (rc == -1) {
+ errno_assert (errno == ENFILE || errno == EMFILE);
+ *w_ = *r_ = -1;
+ return -1;
+ }
+ else {
+ *w_ = sv [0];
+ *r_ = sv [1];
+ return 0;
+ }
+#endif
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/signaler.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/signaler.hpp
new file mode 100644
index 00000000..1ab25dc2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/signaler.hpp
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_SIGNALER_HPP_INCLUDED__
+#define __ZMQ_SIGNALER_HPP_INCLUDED__
+
+#ifdef HAVE_FORK
+#include <unistd.h>
+#endif
+
+#include "fd.hpp"
+
+namespace zmq
+{
+
+ // This is a cross-platform equivalent to signal_fd. However, as opposed
+ // to signal_fd there can be at most one signal in the signaler at any
+ // given moment. Attempt to send a signal before receiving the previous
+ // one will result in undefined behaviour.
+
+ class signaler_t
+ {
+ public:
+
+ signaler_t ();
+ ~signaler_t ();
+
+ fd_t get_fd () const;
+ void send ();
+ int wait (int timeout_);
+ void recv ();
+
+#ifdef HAVE_FORK
+ // close the file descriptors in a forked child process so that they
+ // do not interfere with the context in the parent process.
+ void forked ();
+#endif
+
+ private:
+
+ // Creates a pair of filedescriptors that will be used
+ // to pass the signals.
+ static int make_fdpair (fd_t *r_, fd_t *w_);
+
+ // Underlying write & read file descriptor
+ // Will be -1 if we exceeded number of available handles
+ fd_t w;
+ fd_t r;
+
+ // Disable copying of signaler_t object.
+ signaler_t (const signaler_t&);
+ const signaler_t &operator = (const signaler_t&);
+
+#ifdef HAVE_FORK
+ // the process that created this context. Used to detect forking.
+ pid_t pid;
+ // idempotent close of file descriptors that is safe to use by destructor
+ // and forked().
+ void close_internal ();
+#endif
+ };
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socket_base.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socket_base.cpp
new file mode 100644
index 00000000..bff70684
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socket_base.cpp
@@ -0,0 +1,1342 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <new>
+#include <string>
+#include <algorithm>
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#if defined _MSC_VER
+#if defined _WIN32_WCE
+#include <cmnintrin.h>
+#else
+#include <intrin.h>
+#endif
+#endif
+#else
+#include <unistd.h>
+#endif
+
+#include "socket_base.hpp"
+#include "tcp_listener.hpp"
+#include "ipc_listener.hpp"
+#include "tipc_listener.hpp"
+#include "tcp_connecter.hpp"
+#include "io_thread.hpp"
+#include "session_base.hpp"
+#include "config.hpp"
+#include "pipe.hpp"
+#include "err.hpp"
+#include "ctx.hpp"
+#include "platform.hpp"
+#include "likely.hpp"
+#include "msg.hpp"
+#include "address.hpp"
+#include "ipc_address.hpp"
+#include "tcp_address.hpp"
+#include "tipc_address.hpp"
+#ifdef ZMQ_HAVE_OPENPGM
+#include "pgm_socket.hpp"
+#endif
+
+#include "pair.hpp"
+#include "pub.hpp"
+#include "sub.hpp"
+#include "req.hpp"
+#include "rep.hpp"
+#include "pull.hpp"
+#include "push.hpp"
+#include "dealer.hpp"
+#include "router.hpp"
+#include "xpub.hpp"
+#include "xsub.hpp"
+#include "stream.hpp"
+
+bool zmq::socket_base_t::check_tag ()
+{
+ return tag == 0xbaddecaf;
+}
+
+zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
+ uint32_t tid_, int sid_)
+{
+ socket_base_t *s = NULL;
+ switch (type_) {
+ case ZMQ_PAIR:
+ s = new (std::nothrow) pair_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_PUB:
+ s = new (std::nothrow) pub_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_SUB:
+ s = new (std::nothrow) sub_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_REQ:
+ s = new (std::nothrow) req_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_REP:
+ s = new (std::nothrow) rep_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_DEALER:
+ s = new (std::nothrow) dealer_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_ROUTER:
+ s = new (std::nothrow) router_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_PULL:
+ s = new (std::nothrow) pull_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_PUSH:
+ s = new (std::nothrow) push_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_XPUB:
+ s = new (std::nothrow) xpub_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_XSUB:
+ s = new (std::nothrow) xsub_t (parent_, tid_, sid_);
+ break;
+ case ZMQ_STREAM:
+ s = new (std::nothrow) stream_t (parent_, tid_, sid_);
+ break;
+ default:
+ errno = EINVAL;
+ return NULL;
+ }
+
+ alloc_assert (s);
+ if (s->mailbox.get_fd () == retired_fd)
+ return NULL;
+
+ return s;
+}
+
+zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_) :
+ own_t (parent_, tid_),
+ tag (0xbaddecaf),
+ ctx_terminated (false),
+ destroyed (false),
+ last_tsc (0),
+ ticks (0),
+ rcvmore (false),
+ file_desc(-1),
+ monitor_socket (NULL),
+ monitor_events (0)
+{
+ options.socket_id = sid_;
+ options.ipv6 = (parent_->get (ZMQ_IPV6) != 0);
+}
+
+zmq::socket_base_t::~socket_base_t ()
+{
+ stop_monitor ();
+ zmq_assert (destroyed);
+}
+
+zmq::mailbox_t *zmq::socket_base_t::get_mailbox ()
+{
+ return &mailbox;
+}
+
+void zmq::socket_base_t::stop ()
+{
+ // Called by ctx when it is terminated (zmq_term).
+ // 'stop' command is sent from the threads that called zmq_term to
+ // the thread owning the socket. This way, blocking call in the
+ // owner thread can be interrupted.
+ send_stop ();
+}
+
+int zmq::socket_base_t::parse_uri (const char *uri_,
+ std::string &protocol_, std::string &address_)
+{
+ zmq_assert (uri_ != NULL);
+
+ std::string uri (uri_);
+ std::string::size_type pos = uri.find ("://");
+ if (pos == std::string::npos) {
+ errno = EINVAL;
+ return -1;
+ }
+ protocol_ = uri.substr (0, pos);
+ address_ = uri.substr (pos + 3);
+
+ if (protocol_.empty () || address_.empty ()) {
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
+
+int zmq::socket_base_t::check_protocol (const std::string &protocol_)
+{
+ // First check out whether the protcol is something we are aware of.
+ if (protocol_ != "inproc"
+ && protocol_ != "ipc"
+ && protocol_ != "tcp"
+ && protocol_ != "pgm"
+ && protocol_ != "epgm"
+ && protocol_ != "tipc"
+ && protocol_ != "norm") {
+ errno = EPROTONOSUPPORT;
+ return -1;
+ }
+ // If 0MQ is not compiled with OpenPGM, pgm and epgm transports
+ // are not avaialble.
+#if !defined ZMQ_HAVE_OPENPGM
+ if (protocol_ == "pgm" || protocol_ == "epgm") {
+ errno = EPROTONOSUPPORT;
+ return -1;
+ }
+#endif
+
+#if !defined ZMQ_HAVE_NORM
+ if (protocol_ == "norm") {
+ errno = EPROTONOSUPPORT;
+ return -1;
+ }
+#endif // !ZMQ_HAVE_NORM
+
+ // IPC transport is not available on Windows and OpenVMS.
+#if defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS
+ if (protocol_ == "ipc") {
+ // Unknown protocol.
+ errno = EPROTONOSUPPORT;
+ return -1;
+ }
+#endif
+
+ // TIPC transport is only available on Linux.
+#if !defined ZMQ_HAVE_TIPC
+ if (protocol_ == "tipc") {
+ errno = EPROTONOSUPPORT;
+ return -1;
+ }
+#endif
+
+ // Check whether socket type and transport protocol match.
+ // Specifically, multicast protocols can't be combined with
+ // bi-directional messaging patterns (socket types).
+ if ((protocol_ == "pgm" || protocol_ == "epgm" || protocol_ == "norm") &&
+ options.type != ZMQ_PUB && options.type != ZMQ_SUB &&
+ options.type != ZMQ_XPUB && options.type != ZMQ_XSUB) {
+ errno = ENOCOMPATPROTO;
+ return -1;
+ }
+
+ // Protocol is available.
+ return 0;
+}
+
+void zmq::socket_base_t::attach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ // First, register the pipe so that we can terminate it later on.
+ pipe_->set_event_sink (this);
+ pipes.push_back (pipe_);
+
+ // Let the derived socket type know about new pipe.
+ xattach_pipe (pipe_, subscribe_to_all_);
+
+ // If the socket is already being closed, ask any new pipes to terminate
+ // straight away.
+ if (is_terminating ()) {
+ register_term_acks (1);
+ pipe_->terminate (false);
+ }
+}
+
+int zmq::socket_base_t::setsockopt (int option_, const void *optval_,
+ size_t optvallen_)
+{
+ if (unlikely (ctx_terminated)) {
+ errno = ETERM;
+ return -1;
+ }
+
+ // First, check whether specific socket type overloads the option.
+ int rc = xsetsockopt (option_, optval_, optvallen_);
+ if (rc == 0 || errno != EINVAL)
+ return rc;
+
+ // If the socket type doesn't support the option, pass it to
+ // the generic option parser.
+ return options.setsockopt (option_, optval_, optvallen_);
+}
+
+int zmq::socket_base_t::getsockopt (int option_, void *optval_,
+ size_t *optvallen_)
+{
+ if (unlikely (ctx_terminated)) {
+ errno = ETERM;
+ return -1;
+ }
+
+ if (option_ == ZMQ_RCVMORE) {
+ if (*optvallen_ < sizeof (int)) {
+ errno = EINVAL;
+ return -1;
+ }
+ *((int*) optval_) = rcvmore ? 1 : 0;
+ *optvallen_ = sizeof (int);
+ return 0;
+ }
+
+ if (option_ == ZMQ_FD) {
+ if (*optvallen_ < sizeof (fd_t)) {
+ errno = EINVAL;
+ return -1;
+ }
+ *((fd_t*) optval_) = mailbox.get_fd ();
+ *optvallen_ = sizeof (fd_t);
+ return 0;
+ }
+
+ if (option_ == ZMQ_EVENTS) {
+ if (*optvallen_ < sizeof (int)) {
+ errno = EINVAL;
+ return -1;
+ }
+ int rc = process_commands (0, false);
+ if (rc != 0 && (errno == EINTR || errno == ETERM))
+ return -1;
+ errno_assert (rc == 0);
+ *((int*) optval_) = 0;
+ if (has_out ())
+ *((int*) optval_) |= ZMQ_POLLOUT;
+ if (has_in ())
+ *((int*) optval_) |= ZMQ_POLLIN;
+ *optvallen_ = sizeof (int);
+ return 0;
+ }
+
+ if (option_ == ZMQ_LAST_ENDPOINT) {
+ if (*optvallen_ < last_endpoint.size () + 1) {
+ errno = EINVAL;
+ return -1;
+ }
+ strcpy (static_cast <char *> (optval_), last_endpoint.c_str ());
+ *optvallen_ = last_endpoint.size () + 1;
+ return 0;
+ }
+
+ return options.getsockopt (option_, optval_, optvallen_);
+}
+
+int zmq::socket_base_t::bind (const char *addr_)
+{
+ if (unlikely (ctx_terminated)) {
+ errno = ETERM;
+ return -1;
+ }
+
+ // Process pending commands, if any.
+ int rc = process_commands (0, false);
+ if (unlikely (rc != 0))
+ return -1;
+
+ // Parse addr_ string.
+ std::string protocol;
+ std::string address;
+ if (parse_uri (addr_, protocol, address) || check_protocol (protocol))
+ return -1;
+
+ if (protocol == "inproc") {
+ const endpoint_t endpoint = { this, options };
+ const int rc = register_endpoint (addr_, endpoint);
+ if (rc == 0) {
+ connect_pending (addr_, this);
+ last_endpoint.assign (addr_);
+ }
+ return rc;
+ }
+
+ if (protocol == "pgm" || protocol == "epgm" || protocol == "norm") {
+ // For convenience's sake, bind can be used interchageable with
+ // connect for PGM, EPGM and NORM transports.
+ return connect (addr_);
+ }
+
+ // Remaining trasnports require to be run in an I/O thread, so at this
+ // point we'll choose one.
+ io_thread_t *io_thread = choose_io_thread (options.affinity);
+ if (!io_thread) {
+ errno = EMTHREAD;
+ return -1;
+ }
+
+ if (protocol == "tcp") {
+ tcp_listener_t *listener = new (std::nothrow) tcp_listener_t (
+ io_thread, this, options);
+ alloc_assert (listener);
+ int rc = listener->set_address (address.c_str ());
+ if (rc != 0) {
+ delete listener;
+ event_bind_failed (address, zmq_errno());
+ return -1;
+ }
+
+ // Save last endpoint URI
+ listener->get_address (last_endpoint);
+
+ add_endpoint (last_endpoint.c_str (), (own_t *) listener, NULL);
+ return 0;
+ }
+
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+ if (protocol == "ipc") {
+ ipc_listener_t *listener = new (std::nothrow) ipc_listener_t (
+ io_thread, this, options);
+ alloc_assert (listener);
+ int rc = listener->set_address (address.c_str ());
+ if (rc != 0) {
+ delete listener;
+ event_bind_failed (address, zmq_errno());
+ return -1;
+ }
+
+ // Save last endpoint URI
+ listener->get_address (last_endpoint);
+
+ add_endpoint (last_endpoint.c_str (), (own_t *) listener, NULL);
+ return 0;
+ }
+#endif
+#if defined ZMQ_HAVE_TIPC
+ if (protocol == "tipc") {
+ tipc_listener_t *listener = new (std::nothrow) tipc_listener_t (
+ io_thread, this, options);
+ alloc_assert (listener);
+ int rc = listener->set_address (address.c_str ());
+ if (rc != 0) {
+ delete listener;
+ event_bind_failed (address, zmq_errno());
+ return -1;
+ }
+
+ // Save last endpoint URI
+ listener->get_address (last_endpoint);
+
+ add_endpoint (addr_, (own_t *) listener, NULL);
+ return 0;
+ }
+#endif
+
+ zmq_assert (false);
+ return -1;
+}
+
+int zmq::socket_base_t::connect (const char *addr_)
+{
+ if (unlikely (ctx_terminated)) {
+ errno = ETERM;
+ return -1;
+ }
+
+ // Process pending commands, if any.
+ int rc = process_commands (0, false);
+ if (unlikely (rc != 0))
+ return -1;
+
+ // Parse addr_ string.
+ std::string protocol;
+ std::string address;
+ if (parse_uri (addr_, protocol, address) || check_protocol (protocol))
+ return -1;
+
+ if (protocol == "inproc") {
+
+ // TODO: inproc connect is specific with respect to creating pipes
+ // as there's no 'reconnect' functionality implemented. Once that
+ // is in place we should follow generic pipe creation algorithm.
+
+ // Find the peer endpoint.
+ endpoint_t peer = find_endpoint (addr_);
+
+ // The total HWM for an inproc connection should be the sum of
+ // the binder's HWM and the connector's HWM.
+ int sndhwm = 0;
+ if (peer.socket == NULL)
+ sndhwm = options.sndhwm;
+ else if (options.sndhwm != 0 && peer.options.rcvhwm != 0)
+ sndhwm = options.sndhwm + peer.options.rcvhwm;
+ int rcvhwm = 0;
+ if (peer.socket == NULL)
+ rcvhwm = options.rcvhwm;
+ else
+ if (options.rcvhwm != 0 && peer.options.sndhwm != 0)
+ rcvhwm = options.rcvhwm + peer.options.sndhwm;
+
+ // Create a bi-directional pipe to connect the peers.
+ object_t *parents [2] = {this, peer.socket == NULL ? this : peer.socket};
+ pipe_t *new_pipes [2] = {NULL, NULL};
+
+ bool conflate = options.conflate &&
+ (options.type == ZMQ_DEALER ||
+ options.type == ZMQ_PULL ||
+ options.type == ZMQ_PUSH ||
+ options.type == ZMQ_PUB ||
+ options.type == ZMQ_SUB);
+
+ int hwms [2] = {conflate? -1 : sndhwm, conflate? -1 : rcvhwm};
+ bool conflates [2] = {conflate, conflate};
+ int rc = pipepair (parents, new_pipes, hwms, conflates);
+ errno_assert (rc == 0);
+
+ // Attach local end of the pipe to this socket object.
+ attach_pipe (new_pipes [0]);
+
+ if (!peer.socket) {
+ // The peer doesn't exist yet so we don't know whether
+ // to send the identity message or not. To resolve this,
+ // we always send our identity and drop it later if
+ // the peer doesn't expect it.
+ msg_t id;
+ rc = id.init_size (options.identity_size);
+ errno_assert (rc == 0);
+ memcpy (id.data (), options.identity, options.identity_size);
+ id.set_flags (msg_t::identity);
+ bool written = new_pipes [0]->write (&id);
+ zmq_assert (written);
+ new_pipes [0]->flush ();
+
+ const endpoint_t endpoint = {this, options};
+ pend_connection (std::string (addr_), endpoint, new_pipes);
+ }
+ else {
+ // If required, send the identity of the local socket to the peer.
+ if (peer.options.recv_identity) {
+ msg_t id;
+ rc = id.init_size (options.identity_size);
+ errno_assert (rc == 0);
+ memcpy (id.data (), options.identity, options.identity_size);
+ id.set_flags (msg_t::identity);
+ bool written = new_pipes [0]->write (&id);
+ zmq_assert (written);
+ new_pipes [0]->flush ();
+ }
+
+ // If required, send the identity of the peer to the local socket.
+ if (options.recv_identity) {
+ msg_t id;
+ rc = id.init_size (peer.options.identity_size);
+ errno_assert (rc == 0);
+ memcpy (id.data (), peer.options.identity, peer.options.identity_size);
+ id.set_flags (msg_t::identity);
+ bool written = new_pipes [1]->write (&id);
+ zmq_assert (written);
+ new_pipes [1]->flush ();
+ }
+
+ // Attach remote end of the pipe to the peer socket. Note that peer's
+ // seqnum was incremented in find_endpoint function. We don't need it
+ // increased here.
+ send_bind (peer.socket, new_pipes [1], false);
+ }
+
+ // Save last endpoint URI
+ last_endpoint.assign (addr_);
+
+ // remember inproc connections for disconnect
+ inprocs.insert (inprocs_t::value_type (std::string (addr_), new_pipes [0]));
+
+ return 0;
+ }
+ bool is_single_connect = (options.type == ZMQ_DEALER ||
+ options.type == ZMQ_SUB ||
+ options.type == ZMQ_REQ);
+ if (unlikely (is_single_connect)) {
+ const endpoints_t::iterator it = endpoints.find (addr_);
+ if (it != endpoints.end ()) {
+ // There is no valid use for multiple connects for SUB-PUB nor
+ // DEALER-ROUTER nor REQ-REP. Multiple connects produces
+ // nonsensical results.
+ return 0;
+ }
+ }
+
+ // Choose the I/O thread to run the session in.
+ io_thread_t *io_thread = choose_io_thread (options.affinity);
+ if (!io_thread) {
+ errno = EMTHREAD;
+ return -1;
+ }
+
+ address_t *paddr = new (std::nothrow) address_t (protocol, address);
+ alloc_assert (paddr);
+
+ // Resolve address (if needed by the protocol)
+ if (protocol == "tcp") {
+ // Do some basic sanity checks on tcp:// address syntax
+ // - hostname starts with digit or letter, with embedded '-' or '.'
+ // - IPv6 address may contain hex chars and colons.
+ // - IPv4 address may contain decimal digits and dots.
+ // - Address must end in ":port" where port is *, or numeric
+ // - Address may contain two parts separated by ':'
+ // Following code is quick and dirty check to catch obvious errors,
+ // without trying to be fully accurate.
+ const char *check = address.c_str ();
+ if (isalnum (*check) || isxdigit (*check)) {
+ check++;
+ while (isalnum (*check)
+ || isxdigit (*check)
+ || *check == '.' || *check == '-' || *check == ':'|| *check == ';')
+ check++;
+ }
+ // Assume the worst, now look for success
+ rc = -1;
+ // Did we reach the end of the address safely?
+ if (*check == 0) {
+ // Do we have a valid port string? (cannot be '*' in connect
+ check = strrchr (address.c_str (), ':');
+ if (check) {
+ check++;
+ if (*check && (isdigit (*check)))
+ rc = 0; // Valid
+ }
+ }
+ if (rc == -1) {
+ errno = EINVAL;
+ delete paddr;
+ return -1;
+ }
+ // Defer resolution until a socket is opened
+ paddr->resolved.tcp_addr = NULL;
+ }
+#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+ else
+ if (protocol == "ipc") {
+ paddr->resolved.ipc_addr = new (std::nothrow) ipc_address_t ();
+ alloc_assert (paddr->resolved.ipc_addr);
+ int rc = paddr->resolved.ipc_addr->resolve (address.c_str ());
+ if (rc != 0) {
+ delete paddr;
+ return -1;
+ }
+ }
+#endif
+
+// TBD - Should we check address for ZMQ_HAVE_NORM???
+
+#ifdef ZMQ_HAVE_OPENPGM
+ if (protocol == "pgm" || protocol == "epgm") {
+ struct pgm_addrinfo_t *res = NULL;
+ uint16_t port_number = 0;
+ int rc = pgm_socket_t::init_address(address.c_str(), &res, &port_number);
+ if (res != NULL)
+ pgm_freeaddrinfo (res);
+ if (rc != 0 || port_number == 0)
+ return -1;
+ }
+#endif
+#if defined ZMQ_HAVE_TIPC
+ else
+ if (protocol == "tipc") {
+ paddr->resolved.tipc_addr = new (std::nothrow) tipc_address_t ();
+ alloc_assert (paddr->resolved.tipc_addr);
+ int rc = paddr->resolved.tipc_addr->resolve (address.c_str());
+ if (rc != 0) {
+ delete paddr;
+ return -1;
+ }
+ }
+#endif
+
+ // Create session.
+ session_base_t *session = session_base_t::create (io_thread, true, this,
+ options, paddr);
+ errno_assert (session);
+
+ // PGM does not support subscription forwarding; ask for all data to be
+ // sent to this pipe. (same for NORM, currently?)
+ bool subscribe_to_all = protocol == "pgm" || protocol == "epgm" || protocol == "norm";
+ pipe_t *newpipe = NULL;
+
+ if (options.immediate != 1 || subscribe_to_all) {
+ // Create a bi-directional pipe.
+ object_t *parents [2] = {this, session};
+ pipe_t *new_pipes [2] = {NULL, NULL};
+
+ bool conflate = options.conflate &&
+ (options.type == ZMQ_DEALER ||
+ options.type == ZMQ_PULL ||
+ options.type == ZMQ_PUSH ||
+ options.type == ZMQ_PUB ||
+ options.type == ZMQ_SUB);
+
+ int hwms [2] = {conflate? -1 : options.sndhwm,
+ conflate? -1 : options.rcvhwm};
+ bool conflates [2] = {conflate, conflate};
+ rc = pipepair (parents, new_pipes, hwms, conflates);
+ errno_assert (rc == 0);
+
+ // Attach local end of the pipe to the socket object.
+ attach_pipe (new_pipes [0], subscribe_to_all);
+ newpipe = new_pipes [0];
+
+ // Attach remote end of the pipe to the session object later on.
+ session->attach_pipe (new_pipes [1]);
+ }
+
+ // Save last endpoint URI
+ paddr->to_string (last_endpoint);
+
+ add_endpoint (addr_, (own_t *) session, newpipe);
+ return 0;
+}
+
+void zmq::socket_base_t::add_endpoint (const char *addr_, own_t *endpoint_, pipe_t *pipe)
+{
+ // Activate the session. Make it a child of this socket.
+ launch_child (endpoint_);
+ endpoints.insert (endpoints_t::value_type (std::string (addr_), endpoint_pipe_t (endpoint_, pipe)));
+}
+
+int zmq::socket_base_t::term_endpoint (const char *addr_)
+{
+ // Check whether the library haven't been shut down yet.
+ if (unlikely (ctx_terminated)) {
+ errno = ETERM;
+ return -1;
+ }
+
+ // Check whether endpoint address passed to the function is valid.
+ if (unlikely (!addr_)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ // Process pending commands, if any, since there could be pending unprocessed process_own()'s
+ // (from launch_child() for example) we're asked to terminate now.
+ int rc = process_commands (0, false);
+ if (unlikely (rc != 0))
+ return -1;
+
+ // Parse addr_ string.
+ std::string protocol;
+ std::string address;
+ if (parse_uri (addr_, protocol, address) || check_protocol (protocol))
+ return -1;
+
+ // Disconnect an inproc socket
+ if (protocol == "inproc") {
+ if (unregister_endpoint (std::string (addr_), this) == 0)
+ return 0;
+ std::pair <inprocs_t::iterator, inprocs_t::iterator> range = inprocs.equal_range (std::string (addr_));
+ if (range.first == range.second) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ for (inprocs_t::iterator it = range.first; it != range.second; ++it)
+ it->second->terminate (true);
+ inprocs.erase (range.first, range.second);
+ return 0;
+ }
+
+ // Find the endpoints range (if any) corresponding to the addr_ string.
+ std::pair <endpoints_t::iterator, endpoints_t::iterator> range = endpoints.equal_range (std::string (addr_));
+ if (range.first == range.second) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ for (endpoints_t::iterator it = range.first; it != range.second; ++it) {
+ // If we have an associated pipe, terminate it.
+ if (it->second.second != NULL)
+ it->second.second->terminate (false);
+ term_child (it->second.first);
+ }
+ endpoints.erase (range.first, range.second);
+ return 0;
+}
+
+int zmq::socket_base_t::send (msg_t *msg_, int flags_)
+{
+ // Check whether the library haven't been shut down yet.
+ if (unlikely (ctx_terminated)) {
+ errno = ETERM;
+ return -1;
+ }
+
+ // Check whether message passed to the function is valid.
+ if (unlikely (!msg_ || !msg_->check ())) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ // Process pending commands, if any.
+ int rc = process_commands (0, true);
+ if (unlikely (rc != 0))
+ return -1;
+
+ // Clear any user-visible flags that are set on the message.
+ msg_->reset_flags (msg_t::more);
+
+ // At this point we impose the flags on the message.
+ if (flags_ & ZMQ_SNDMORE)
+ msg_->set_flags (msg_t::more);
+
+ msg_->reset_metadata ();
+
+ // Try to send the message.
+ rc = xsend (msg_);
+ if (rc == 0)
+ return 0;
+ if (unlikely (errno != EAGAIN))
+ return -1;
+
+ // In case of non-blocking send we'll simply propagate
+ // the error - including EAGAIN - up the stack.
+ if (flags_ & ZMQ_DONTWAIT || options.sndtimeo == 0)
+ return -1;
+
+ // Compute the time when the timeout should occur.
+ // If the timeout is infinite, don't care.
+ int timeout = options.sndtimeo;
+ uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout);
+
+ // Oops, we couldn't send the message. Wait for the next
+ // command, process it and try to send the message again.
+ // If timeout is reached in the meantime, return EAGAIN.
+ while (true) {
+ if (unlikely (process_commands (timeout, false) != 0))
+ return -1;
+ rc = xsend (msg_);
+ if (rc == 0)
+ break;
+ if (unlikely (errno != EAGAIN))
+ return -1;
+ if (timeout > 0) {
+ timeout = (int) (end - clock.now_ms ());
+ if (timeout <= 0) {
+ errno = EAGAIN;
+ return -1;
+ }
+ }
+ }
+ return 0;
+}
+
+int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
+{
+ // Check whether the library haven't been shut down yet.
+ if (unlikely (ctx_terminated)) {
+ errno = ETERM;
+ return -1;
+ }
+
+ // Check whether message passed to the function is valid.
+ if (unlikely (!msg_ || !msg_->check ())) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ // Once every inbound_poll_rate messages check for signals and process
+ // incoming commands. This happens only if we are not polling altogether
+ // because there are messages available all the time. If poll occurs,
+ // ticks is set to zero and thus we avoid this code.
+ //
+ // Note that 'recv' uses different command throttling algorithm (the one
+ // described above) from the one used by 'send'. This is because counting
+ // ticks is more efficient than doing RDTSC all the time.
+ if (++ticks == inbound_poll_rate) {
+ if (unlikely (process_commands (0, false) != 0))
+ return -1;
+ ticks = 0;
+ }
+
+ // Get the message.
+ int rc = xrecv (msg_);
+ if (unlikely (rc != 0 && errno != EAGAIN))
+ return -1;
+
+ // If we have the message, return immediately.
+ if (rc == 0) {
+ if (file_desc != retired_fd)
+ msg_->set_fd(file_desc);
+ extract_flags (msg_);
+ return 0;
+ }
+
+ // If the message cannot be fetched immediately, there are two scenarios.
+ // For non-blocking recv, commands are processed in case there's an
+ // activate_reader command already waiting int a command pipe.
+ // If it's not, return EAGAIN.
+ if (flags_ & ZMQ_DONTWAIT || options.rcvtimeo == 0) {
+ if (unlikely (process_commands (0, false) != 0))
+ return -1;
+ ticks = 0;
+
+ rc = xrecv (msg_);
+ if (rc < 0)
+ return rc;
+ if (file_desc != retired_fd)
+ msg_->set_fd(file_desc);
+ extract_flags (msg_);
+ return 0;
+ }
+
+ // Compute the time when the timeout should occur.
+ // If the timeout is infinite, don't care.
+ int timeout = options.rcvtimeo;
+ uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout);
+
+ // In blocking scenario, commands are processed over and over again until
+ // we are able to fetch a message.
+ bool block = (ticks != 0);
+ while (true) {
+ if (unlikely (process_commands (block ? timeout : 0, false) != 0))
+ return -1;
+ rc = xrecv (msg_);
+ if (rc == 0) {
+ ticks = 0;
+ break;
+ }
+ if (unlikely (errno != EAGAIN))
+ return -1;
+ block = true;
+ if (timeout > 0) {
+ timeout = (int) (end - clock.now_ms ());
+ if (timeout <= 0) {
+ errno = EAGAIN;
+ return -1;
+ }
+ }
+ }
+
+ if (file_desc != retired_fd)
+ msg_->set_fd(file_desc);
+ extract_flags (msg_);
+ return 0;
+}
+
+int zmq::socket_base_t::close ()
+{
+ // Mark the socket as dead
+ tag = 0xdeadbeef;
+
+ // Transfer the ownership of the socket from this application thread
+ // to the reaper thread which will take care of the rest of shutdown
+ // process.
+ send_reap (this);
+
+ return 0;
+}
+
+bool zmq::socket_base_t::has_in ()
+{
+ return xhas_in ();
+}
+
+bool zmq::socket_base_t::has_out ()
+{
+ return xhas_out ();
+}
+
+void zmq::socket_base_t::start_reaping (poller_t *poller_)
+{
+ // Plug the socket to the reaper thread.
+ poller = poller_;
+ handle = poller->add_fd (mailbox.get_fd (), this);
+ poller->set_pollin (handle);
+
+ // Initialise the termination and check whether it can be deallocated
+ // immediately.
+ terminate ();
+ check_destroy ();
+}
+
+int zmq::socket_base_t::process_commands (int timeout_, bool throttle_)
+{
+ int rc;
+ command_t cmd;
+ if (timeout_ != 0) {
+
+ // If we are asked to wait, simply ask mailbox to wait.
+ rc = mailbox.recv (&cmd, timeout_);
+ }
+ else {
+
+ // If we are asked not to wait, check whether we haven't processed
+ // commands recently, so that we can throttle the new commands.
+
+ // Get the CPU's tick counter. If 0, the counter is not available.
+ const uint64_t tsc = zmq::clock_t::rdtsc ();
+
+ // Optimised version of command processing - it doesn't have to check
+ // for incoming commands each time. It does so only if certain time
+ // elapsed since last command processing. Command delay varies
+ // depending on CPU speed: It's ~1ms on 3GHz CPU, ~2ms on 1.5GHz CPU
+ // etc. The optimisation makes sense only on platforms where getting
+ // a timestamp is a very cheap operation (tens of nanoseconds).
+ if (tsc && throttle_) {
+
+ // Check whether TSC haven't jumped backwards (in case of migration
+ // between CPU cores) and whether certain time have elapsed since
+ // last command processing. If it didn't do nothing.
+ if (tsc >= last_tsc && tsc - last_tsc <= max_command_delay)
+ return 0;
+ last_tsc = tsc;
+ }
+
+ // Check whether there are any commands pending for this thread.
+ rc = mailbox.recv (&cmd, 0);
+ }
+
+ // Process all available commands.
+ while (rc == 0) {
+ cmd.destination->process_command (cmd);
+ rc = mailbox.recv (&cmd, 0);
+ }
+
+ if (errno == EINTR)
+ return -1;
+
+ zmq_assert (errno == EAGAIN);
+
+ if (ctx_terminated) {
+ errno = ETERM;
+ return -1;
+ }
+
+ return 0;
+}
+
+void zmq::socket_base_t::process_stop ()
+{
+ // Here, someone have called zmq_term while the socket was still alive.
+ // We'll remember the fact so that any blocking call is interrupted and any
+ // further attempt to use the socket will return ETERM. The user is still
+ // responsible for calling zmq_close on the socket though!
+ stop_monitor ();
+ ctx_terminated = true;
+}
+
+void zmq::socket_base_t::process_bind (pipe_t *pipe_)
+{
+ attach_pipe (pipe_);
+}
+
+void zmq::socket_base_t::process_term (int linger_)
+{
+ // Unregister all inproc endpoints associated with this socket.
+ // Doing this we make sure that no new pipes from other sockets (inproc)
+ // will be initiated.
+ unregister_endpoints (this);
+
+ // Ask all attached pipes to terminate.
+ for (pipes_t::size_type i = 0; i != pipes.size (); ++i)
+ pipes [i]->terminate (false);
+ register_term_acks ((int) pipes.size ());
+
+ // Continue the termination process immediately.
+ own_t::process_term (linger_);
+}
+
+void zmq::socket_base_t::process_destroy ()
+{
+ destroyed = true;
+}
+
+int zmq::socket_base_t::xsetsockopt (int, const void *, size_t)
+{
+ errno = EINVAL;
+ return -1;
+}
+
+bool zmq::socket_base_t::xhas_out ()
+{
+ return false;
+}
+
+int zmq::socket_base_t::xsend (msg_t *)
+{
+ errno = ENOTSUP;
+ return -1;
+}
+
+bool zmq::socket_base_t::xhas_in ()
+{
+ return false;
+}
+
+int zmq::socket_base_t::xrecv (msg_t *)
+{
+ errno = ENOTSUP;
+ return -1;
+}
+
+zmq::blob_t zmq::socket_base_t::get_credential () const
+{
+ return blob_t ();
+}
+
+void zmq::socket_base_t::xread_activated (pipe_t *)
+{
+ zmq_assert (false);
+}
+void zmq::socket_base_t::xwrite_activated (pipe_t *)
+{
+ zmq_assert (false);
+}
+
+void zmq::socket_base_t::xhiccuped (pipe_t *)
+{
+ zmq_assert (false);
+}
+
+void zmq::socket_base_t::in_event ()
+{
+ // This function is invoked only once the socket is running in the context
+ // of the reaper thread. Process any commands from other threads/sockets
+ // that may be available at the moment. Ultimately, the socket will
+ // be destroyed.
+ process_commands (0, false);
+ check_destroy ();
+}
+
+void zmq::socket_base_t::out_event ()
+{
+ zmq_assert (false);
+}
+
+void zmq::socket_base_t::timer_event (int)
+{
+ zmq_assert (false);
+}
+
+void zmq::socket_base_t::check_destroy ()
+{
+ // If the object was already marked as destroyed, finish the deallocation.
+ if (destroyed) {
+
+ // Remove the socket from the reaper's poller.
+ poller->rm_fd (handle);
+
+ // Remove the socket from the context.
+ destroy_socket (this);
+
+ // Notify the reaper about the fact.
+ send_reaped ();
+
+ // Deallocate.
+ own_t::process_destroy ();
+ }
+}
+
+void zmq::socket_base_t::read_activated (pipe_t *pipe_)
+{
+ xread_activated (pipe_);
+}
+
+void zmq::socket_base_t::write_activated (pipe_t *pipe_)
+{
+ xwrite_activated (pipe_);
+}
+
+void zmq::socket_base_t::hiccuped (pipe_t *pipe_)
+{
+ if (options.immediate == 1)
+ pipe_->terminate (false);
+ else
+ // Notify derived sockets of the hiccup
+ xhiccuped (pipe_);
+}
+
+void zmq::socket_base_t::pipe_terminated (pipe_t *pipe_)
+{
+ // Notify the specific socket type about the pipe termination.
+ xpipe_terminated (pipe_);
+
+ // Remove pipe from inproc pipes
+ for (inprocs_t::iterator it = inprocs.begin (); it != inprocs.end (); ++it)
+ if (it->second == pipe_) {
+ inprocs.erase (it);
+ break;
+ }
+
+ // Remove the pipe from the list of attached pipes and confirm its
+ // termination if we are already shutting down.
+ pipes.erase (pipe_);
+ if (is_terminating ())
+ unregister_term_ack ();
+}
+
+void zmq::socket_base_t::extract_flags (msg_t *msg_)
+{
+ // Test whether IDENTITY flag is valid for this socket type.
+ if (unlikely (msg_->flags () & msg_t::identity))
+ zmq_assert (options.recv_identity);
+
+ // Remove MORE flag.
+ rcvmore = msg_->flags () & msg_t::more ? true : false;
+}
+
+int zmq::socket_base_t::monitor (const char *addr_, int events_)
+{
+ if (unlikely (ctx_terminated)) {
+ errno = ETERM;
+ return -1;
+ }
+ // Support deregistering monitoring endpoints as well
+ if (addr_ == NULL) {
+ stop_monitor ();
+ return 0;
+ }
+ // Parse addr_ string.
+ std::string protocol;
+ std::string address;
+ if (parse_uri (addr_, protocol, address) || check_protocol (protocol))
+ return -1;
+
+ // Event notification only supported over inproc://
+ if (protocol != "inproc") {
+ errno = EPROTONOSUPPORT;
+ return -1;
+ }
+ // Register events to monitor
+ monitor_events = events_;
+ monitor_socket = zmq_socket (get_ctx (), ZMQ_PAIR);
+ if (monitor_socket == NULL)
+ return -1;
+
+ // Never block context termination on pending event messages
+ int linger = 0;
+ int rc = zmq_setsockopt (monitor_socket, ZMQ_LINGER, &linger, sizeof (linger));
+ if (rc == -1)
+ stop_monitor ();
+
+ // Spawn the monitor socket endpoint
+ rc = zmq_bind (monitor_socket, addr_);
+ if (rc == -1)
+ stop_monitor ();
+ return rc;
+}
+
+void zmq::socket_base_t::set_fd(zmq::fd_t fd_)
+{
+ file_desc = fd_;
+}
+
+zmq::fd_t zmq::socket_base_t::fd()
+{
+ return file_desc;
+}
+
+void zmq::socket_base_t::event_connected (const std::string &addr_, int fd_)
+{
+ if (monitor_events & ZMQ_EVENT_CONNECTED)
+ monitor_event (ZMQ_EVENT_CONNECTED, fd_, addr_);
+}
+
+void zmq::socket_base_t::event_connect_delayed (const std::string &addr_, int err_)
+{
+ if (monitor_events & ZMQ_EVENT_CONNECT_DELAYED)
+ monitor_event (ZMQ_EVENT_CONNECT_DELAYED, err_, addr_);
+}
+
+void zmq::socket_base_t::event_connect_retried (const std::string &addr_, int interval_)
+{
+ if (monitor_events & ZMQ_EVENT_CONNECT_RETRIED)
+ monitor_event (ZMQ_EVENT_CONNECT_RETRIED, interval_, addr_);
+}
+
+void zmq::socket_base_t::event_listening (const std::string &addr_, int fd_)
+{
+ if (monitor_events & ZMQ_EVENT_LISTENING)
+ monitor_event (ZMQ_EVENT_LISTENING, fd_, addr_);
+}
+
+void zmq::socket_base_t::event_bind_failed (const std::string &addr_, int err_)
+{
+ if (monitor_events & ZMQ_EVENT_BIND_FAILED)
+ monitor_event (ZMQ_EVENT_BIND_FAILED, err_, addr_);
+}
+
+void zmq::socket_base_t::event_accepted (const std::string &addr_, int fd_)
+{
+ if (monitor_events & ZMQ_EVENT_ACCEPTED)
+ monitor_event (ZMQ_EVENT_ACCEPTED, fd_, addr_);
+}
+
+void zmq::socket_base_t::event_accept_failed (const std::string &addr_, int err_)
+{
+ if (monitor_events & ZMQ_EVENT_ACCEPT_FAILED)
+ monitor_event (ZMQ_EVENT_ACCEPT_FAILED, err_, addr_);
+}
+
+void zmq::socket_base_t::event_closed (const std::string &addr_, int fd_)
+{
+ if (monitor_events & ZMQ_EVENT_CLOSED)
+ monitor_event (ZMQ_EVENT_CLOSED, fd_, addr_);
+}
+
+void zmq::socket_base_t::event_close_failed (const std::string &addr_, int err_)
+{
+ if (monitor_events & ZMQ_EVENT_CLOSE_FAILED)
+ monitor_event (ZMQ_EVENT_CLOSE_FAILED, err_, addr_);
+}
+
+void zmq::socket_base_t::event_disconnected (const std::string &addr_, int fd_)
+{
+ if (monitor_events & ZMQ_EVENT_DISCONNECTED)
+ monitor_event (ZMQ_EVENT_DISCONNECTED, fd_, addr_);
+}
+
+// Send a monitor event
+void zmq::socket_base_t::monitor_event (int event_, int value_, const std::string &addr_)
+{
+ if (monitor_socket) {
+ // Send event in first frame
+ zmq_msg_t msg;
+ zmq_msg_init_size (&msg, 6);
+ uint8_t *data = (uint8_t *) zmq_msg_data (&msg);
+ *(uint16_t *) (data + 0) = (uint16_t) event_;
+ *(uint32_t *) (data + 2) = (uint32_t) value_;
+ zmq_sendmsg (monitor_socket, &msg, ZMQ_SNDMORE);
+
+ // Send address in second frame
+ zmq_msg_init_size (&msg, addr_.size());
+ memcpy (zmq_msg_data (&msg), addr_.c_str (), addr_.size ());
+ zmq_sendmsg (monitor_socket, &msg, 0);
+ }
+}
+
+void zmq::socket_base_t::stop_monitor (void)
+{
+ if (monitor_socket) {
+ if (monitor_events & ZMQ_EVENT_MONITOR_STOPPED)
+ monitor_event (ZMQ_EVENT_MONITOR_STOPPED, 0, "");
+ zmq_close (monitor_socket);
+ monitor_socket = NULL;
+ monitor_events = 0;
+ }
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socket_base.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socket_base.hpp
new file mode 100644
index 00000000..171b5b8b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socket_base.hpp
@@ -0,0 +1,278 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_SOCKET_BASE_HPP_INCLUDED__
+#define __ZMQ_SOCKET_BASE_HPP_INCLUDED__
+
+#include <string>
+#include <map>
+#include <stdarg.h>
+
+#include "own.hpp"
+#include "array.hpp"
+#include "blob.hpp"
+#include "stdint.hpp"
+#include "poller.hpp"
+#include "atomic_counter.hpp"
+#include "i_poll_events.hpp"
+#include "mailbox.hpp"
+#include "stdint.hpp"
+#include "clock.hpp"
+#include "pipe.hpp"
+
+extern "C"
+{
+ void zmq_free_event (void *data, void *hint);
+}
+
+namespace zmq
+{
+
+ class ctx_t;
+ class msg_t;
+ class pipe_t;
+
+ class socket_base_t :
+ public own_t,
+ public array_item_t <>,
+ public i_poll_events,
+ public i_pipe_events
+ {
+ friend class reaper_t;
+
+ public:
+
+ // Returns false if object is not a socket.
+ bool check_tag ();
+
+ // Create a socket of a specified type.
+ static socket_base_t *create (int type_, zmq::ctx_t *parent_,
+ uint32_t tid_, int sid_);
+
+ // Returns the mailbox associated with this socket.
+ mailbox_t *get_mailbox ();
+
+ // Interrupt blocking call if the socket is stuck in one.
+ // This function can be called from a different thread!
+ void stop ();
+
+ // Interface for communication with the API layer.
+ int setsockopt (int option_, const void *optval_, size_t optvallen_);
+ int getsockopt (int option_, void *optval_, size_t *optvallen_);
+ int bind (const char *addr_);
+ int connect (const char *addr_);
+ int term_endpoint (const char *addr_);
+ int send (zmq::msg_t *msg_, int flags_);
+ int recv (zmq::msg_t *msg_, int flags_);
+ int close ();
+
+ // These functions are used by the polling mechanism to determine
+ // which events are to be reported from this socket.
+ bool has_in ();
+ bool has_out ();
+
+ // Using this function reaper thread ask the socket to regiter with
+ // its poller.
+ void start_reaping (poller_t *poller_);
+
+ // i_poll_events implementation. This interface is used when socket
+ // is handled by the poller in the reaper thread.
+ void in_event ();
+ void out_event ();
+ void timer_event (int id_);
+
+ // i_pipe_events interface implementation.
+ void read_activated (pipe_t *pipe_);
+ void write_activated (pipe_t *pipe_);
+ void hiccuped (pipe_t *pipe_);
+ void pipe_terminated (pipe_t *pipe_);
+ void lock();
+ void unlock();
+
+ int monitor (const char *endpoint_, int events_);
+
+ void set_fd(fd_t fd_);
+ fd_t fd();
+
+ void event_connected (const std::string &addr_, int fd_);
+ void event_connect_delayed (const std::string &addr_, int err_);
+ void event_connect_retried (const std::string &addr_, int interval_);
+ void event_listening (const std::string &addr_, int fd_);
+ void event_bind_failed (const std::string &addr_, int err_);
+ void event_accepted (const std::string &addr_, int fd_);
+ void event_accept_failed (const std::string &addr_, int err_);
+ void event_closed (const std::string &addr_, int fd_);
+ void event_close_failed (const std::string &addr_, int fd_);
+ void event_disconnected (const std::string &addr_, int fd_);
+
+ protected:
+
+ socket_base_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ virtual ~socket_base_t ();
+
+ // Concrete algorithms for the x- methods are to be defined by
+ // individual socket types.
+ virtual void xattach_pipe (zmq::pipe_t *pipe_,
+ bool subscribe_to_all_ = false) = 0;
+
+ // The default implementation assumes there are no specific socket
+ // options for the particular socket type. If not so, override this
+ // method.
+ virtual int xsetsockopt (int option_, const void *optval_,
+ size_t optvallen_);
+
+ // The default implementation assumes that send is not supported.
+ virtual bool xhas_out ();
+ virtual int xsend (zmq::msg_t *msg_);
+
+ // The default implementation assumes that recv in not supported.
+ virtual bool xhas_in ();
+ virtual int xrecv (zmq::msg_t *msg_);
+
+ // Returns the credential for the peer from which we have received
+ // the last message. If no message has been received yet,
+ // the function returns empty credential.
+ virtual blob_t get_credential () const;
+
+ // i_pipe_events will be forwarded to these functions.
+ virtual void xread_activated (pipe_t *pipe_);
+ virtual void xwrite_activated (pipe_t *pipe_);
+ virtual void xhiccuped (pipe_t *pipe_);
+ virtual void xpipe_terminated (pipe_t *pipe_) = 0;
+
+ // Delay actual destruction of the socket.
+ void process_destroy ();
+
+ // Socket event data dispath
+ void monitor_event (int event_, int value_, const std::string& addr_);
+
+ // Monitor socket cleanup
+ void stop_monitor ();
+
+ // Next assigned name on a zmq_connect() call used by ROUTER and STREAM socket types
+ std::string connect_rid;
+
+ private:
+ // Creates new endpoint ID and adds the endpoint to the map.
+ void add_endpoint (const char *addr_, own_t *endpoint_, pipe_t *pipe);
+
+ // Map of open endpoints.
+ typedef std::pair <own_t *, pipe_t*> endpoint_pipe_t;
+ typedef std::multimap <std::string, endpoint_pipe_t> endpoints_t;
+ endpoints_t endpoints;
+
+ // Map of open inproc endpoints.
+ typedef std::multimap <std::string, pipe_t *> inprocs_t;
+ inprocs_t inprocs;
+
+ // To be called after processing commands or invoking any command
+ // handlers explicitly. If required, it will deallocate the socket.
+ void check_destroy ();
+
+ // Moves the flags from the message to local variables,
+ // to be later retrieved by getsockopt.
+ void extract_flags (msg_t *msg_);
+
+ // Used to check whether the object is a socket.
+ uint32_t tag;
+
+ // If true, associated context was already terminated.
+ bool ctx_terminated;
+
+ // If true, object should have been already destroyed. However,
+ // destruction is delayed while we unwind the stack to the point
+ // where it doesn't intersect the object being destroyed.
+ bool destroyed;
+
+ // Parse URI string.
+ int parse_uri (const char *uri_, std::string &protocol_,
+ std::string &address_);
+
+ // Check whether transport protocol, as specified in connect or
+ // bind, is available and compatible with the socket type.
+ int check_protocol (const std::string &protocol_);
+
+ // Register the pipe with this socket.
+ void attach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_ = false);
+
+ // Processes commands sent to this socket (if any). If timeout is -1,
+ // returns only after at least one command was processed.
+ // If throttle argument is true, commands are processed at most once
+ // in a predefined time period.
+ int process_commands (int timeout_, bool throttle_);
+
+ // Handlers for incoming commands.
+ void process_stop ();
+ void process_bind (zmq::pipe_t *pipe_);
+ void process_term (int linger_);
+
+ // Socket's mailbox object.
+ mailbox_t mailbox;
+
+ // List of attached pipes.
+ typedef array_t <pipe_t, 3> pipes_t;
+ pipes_t pipes;
+
+ // Reaper's poller and handle of this socket within it.
+ poller_t *poller;
+ poller_t::handle_t handle;
+
+ // Timestamp of when commands were processed the last time.
+ uint64_t last_tsc;
+
+ // Number of messages received since last command processing.
+ int ticks;
+
+ // True if the last message received had MORE flag set.
+ bool rcvmore;
+
+ // File descriptor if applicable
+ fd_t file_desc;
+
+ // Improves efficiency of time measurement.
+ clock_t clock;
+
+ // Monitor socket;
+ void *monitor_socket;
+
+ // Bitmask of events being monitored
+ int monitor_events;
+
+ // Last socket endpoint resolved URI
+ std::string last_endpoint;
+
+ socket_base_t (const socket_base_t&);
+ const socket_base_t &operator = (const socket_base_t&);
+ mutex_t sync;
+ };
+
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks.cpp
new file mode 100644
index 00000000..ecd0e270
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks.cpp
@@ -0,0 +1,283 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <sys/types.h>
+
+#include "err.hpp"
+#include "platform.hpp"
+#include "socks.hpp"
+#include "tcp.hpp"
+
+#ifndef ZMQ_HAVE_WINDOWS
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#endif
+
+zmq::socks_greeting_t::socks_greeting_t (uint8_t method_) :
+ num_methods (1)
+{
+ methods [0] = method_;
+}
+
+zmq::socks_greeting_t::socks_greeting_t (
+ uint8_t *methods_, size_t num_methods_)
+ : num_methods (num_methods_)
+{
+ zmq_assert (num_methods_ <= 255);
+
+ for (size_t i = 0; i < num_methods_; i++)
+ methods [i] = methods_ [i];
+}
+
+zmq::socks_greeting_encoder_t::socks_greeting_encoder_t ()
+ : bytes_encoded (0), bytes_written (0)
+{}
+
+void zmq::socks_greeting_encoder_t::encode (const socks_greeting_t &greeting_)
+{
+ uint8_t *ptr = buf;
+
+ *ptr++ = 0x05;
+ *ptr++ = greeting_.num_methods;
+ for (size_t i = 0; i < greeting_.num_methods; i++)
+ *ptr++ = greeting_.methods [i];
+
+ bytes_encoded = 2 + greeting_.num_methods;
+ bytes_written = 0;
+}
+
+int zmq::socks_greeting_encoder_t::output (fd_t fd_)
+{
+ const int rc = tcp_write (
+ fd_, buf + bytes_written, bytes_encoded - bytes_written);
+ if (rc > 0)
+ bytes_written += static_cast <size_t> (rc);
+ return rc;
+}
+
+bool zmq::socks_greeting_encoder_t::has_pending_data () const
+{
+ return bytes_written < bytes_encoded;
+}
+
+void zmq::socks_greeting_encoder_t::reset ()
+{
+ bytes_encoded = bytes_written = 0;
+}
+
+zmq::socks_choice_t::socks_choice_t (unsigned char method_)
+ : method (method_)
+{}
+
+zmq::socks_choice_decoder_t::socks_choice_decoder_t ()
+ : bytes_read (0)
+{}
+
+int zmq::socks_choice_decoder_t::input (fd_t fd_)
+{
+ zmq_assert (bytes_read < 2);
+ const int rc = tcp_read (fd_, buf + bytes_read, 2 - bytes_read);
+ if (rc > 0) {
+ bytes_read += static_cast <size_t> (rc);
+ if (buf [0] != 0x05)
+ return -1;
+ }
+ return rc;
+}
+
+bool zmq::socks_choice_decoder_t::message_ready () const
+{
+ return bytes_read == 2;
+}
+
+zmq::socks_choice_t zmq::socks_choice_decoder_t::decode ()
+{
+ zmq_assert (message_ready ());
+ return socks_choice_t (buf [1]);
+}
+
+void zmq::socks_choice_decoder_t::reset ()
+{
+ bytes_read = 0;
+}
+
+zmq::socks_request_t::socks_request_t (
+ uint8_t command_, std::string hostname_, uint16_t port_)
+ : command (command_), hostname (hostname_), port (port_)
+{}
+
+zmq::socks_request_encoder_t::socks_request_encoder_t ()
+ : bytes_encoded (0), bytes_written (0)
+{}
+
+void zmq::socks_request_encoder_t::encode (const socks_request_t &req)
+{
+ unsigned char *ptr = buf;
+ *ptr++ = 0x05;
+ *ptr++ = req.command;
+ *ptr++ = 0x00;
+
+#if defined ZMQ_HAVE_OPENVMS && defined __ia64 && __INITIAL_POINTER_SIZE == 64
+ __addrinfo64 hints, *res = NULL;
+#else
+ addrinfo hints, *res = NULL;
+#endif
+
+ memset (&hints, 0, sizeof hints);
+
+ // Suppress potential DNS lookups.
+ hints.ai_flags = AI_NUMERICHOST;
+
+ const int rc = getaddrinfo (req.hostname.c_str (), NULL, &hints, &res);
+ if (rc == 0 && res->ai_family == AF_INET) {
+ struct sockaddr_in *sockaddr_in =
+ reinterpret_cast <struct sockaddr_in *> (res->ai_addr);
+ *ptr++ = 0x01;
+ memcpy (ptr, &sockaddr_in->sin_addr, 4);
+ ptr += 4;
+ }
+ else
+ if (rc == 0 && res->ai_family == AF_INET6) {
+ struct sockaddr_in6 *sockaddr_in6 =
+ reinterpret_cast <struct sockaddr_in6 *> (res->ai_addr);
+ *ptr++ = 0x04;
+ memcpy (ptr, &sockaddr_in6->sin6_addr, 16);
+ ptr += 16;
+ }
+ else {
+ *ptr++ = 0x03;
+ *ptr++ = req.hostname.size ();
+ memcpy (ptr, req.hostname.c_str (), req.hostname.size ());
+ ptr += req.hostname.size ();
+ }
+
+ if (rc == 0)
+ freeaddrinfo (res);
+
+ *ptr++ = req.port / 256;
+ *ptr++ = req.port % 256;
+
+ bytes_encoded = ptr - buf;
+ bytes_written = 0;
+}
+
+int zmq::socks_request_encoder_t::output (fd_t fd_)
+{
+ const int rc = tcp_write (
+ fd_, buf + bytes_written, bytes_encoded - bytes_written);
+ if (rc > 0)
+ bytes_written += static_cast <size_t> (rc);
+ return rc;
+}
+
+bool zmq::socks_request_encoder_t::has_pending_data () const
+{
+ return bytes_written < bytes_encoded;
+}
+
+void zmq::socks_request_encoder_t::reset ()
+{
+ bytes_encoded = bytes_written = 0;
+}
+
+zmq::socks_response_t::socks_response_t (
+ uint8_t response_code_, std::string address_, uint16_t port_)
+ : response_code (response_code_), address (address_), port (port_)
+{}
+
+zmq::socks_response_decoder_t::socks_response_decoder_t ()
+ : bytes_read (0)
+{}
+
+int zmq::socks_response_decoder_t::input (fd_t fd_)
+{
+ size_t n = 0;
+
+ if (bytes_read < 5)
+ n = 5 - bytes_read;
+ else {
+ const uint8_t atyp = buf [3];
+ zmq_assert (atyp == 0x01 || atyp == 0x03 || atyp == 0x04);
+ if (atyp == 0x01)
+ n = 3 + 2;
+ else
+ if (atyp == 0x03)
+ n = buf [4] + 2;
+ else
+ if (atyp == 0x04)
+ n = 15 + 2;
+ }
+ const int rc = tcp_read (fd_, buf + bytes_read, n);
+ if (rc > 0) {
+ bytes_read += static_cast <size_t> (rc);
+ if (buf [0] != 0x05)
+ return -1;
+ if (bytes_read >= 2)
+ if (buf [1] > 0x08)
+ return -1;
+ if (bytes_read >= 3)
+ if (buf [2] != 0x00)
+ return -1;
+ if (bytes_read >= 4) {
+ const uint8_t atyp = buf [3];
+ if (atyp != 0x01 && atyp != 0x03 && atyp != 0x04)
+ return -1;
+ }
+ }
+ return rc;
+}
+
+bool zmq::socks_response_decoder_t::message_ready () const
+{
+ if (bytes_read < 4)
+ return false;
+ else {
+ const uint8_t atyp = buf [3];
+ zmq_assert (atyp == 0x01 || atyp == 0x03 || atyp == 0x04);
+ if (atyp == 0x01)
+ return bytes_read == 10;
+ else
+ if (atyp == 0x03)
+ return bytes_read > 4 && bytes_read == 4 + 1 + buf [4] + 2u;
+ else
+ return bytes_read == 22;
+ }
+}
+
+zmq::socks_response_t zmq::socks_response_decoder_t::decode ()
+{
+ zmq_assert (message_ready ());
+ return socks_response_t (buf [1], "", 0);
+}
+
+void zmq::socks_response_decoder_t::reset ()
+{
+ bytes_read = 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks.hpp
new file mode 100644
index 00000000..d64acd83
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks.hpp
@@ -0,0 +1,135 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_SOCKS_HPP_INCLUDED__
+#define __ZMQ_SOCKS_HPP_INCLUDED__
+
+#include <string>
+#include "fd.hpp"
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ struct socks_greeting_t
+ {
+ socks_greeting_t (uint8_t method);
+ socks_greeting_t (uint8_t *methods_, size_t num_methods_);
+
+ uint8_t methods [255];
+ const size_t num_methods;
+ };
+
+ class socks_greeting_encoder_t
+ {
+ public:
+ socks_greeting_encoder_t ();
+ void encode (const socks_greeting_t &greeting_);
+ int output (fd_t fd_);
+ bool has_pending_data () const;
+ void reset ();
+
+ private:
+ size_t bytes_encoded;
+ size_t bytes_written;
+ uint8_t buf [2 + 255];
+ };
+
+ struct socks_choice_t
+ {
+ socks_choice_t (uint8_t method_);
+
+ uint8_t method;
+ };
+
+ class socks_choice_decoder_t
+ {
+ public:
+ socks_choice_decoder_t ();
+ int input (fd_t fd_);
+ bool message_ready () const;
+ socks_choice_t decode ();
+ void reset ();
+
+ private:
+ unsigned char buf [2];
+ size_t bytes_read;
+ };
+
+ struct socks_request_t
+ {
+ socks_request_t (
+ uint8_t command_, std::string hostname_, uint16_t port_);
+
+ const uint8_t command;
+ const std::string hostname;
+ const uint16_t port;
+ };
+
+ class socks_request_encoder_t
+ {
+ public:
+ socks_request_encoder_t ();
+ void encode (const socks_request_t &req);
+ int output (fd_t fd_);
+ bool has_pending_data () const;
+ void reset ();
+
+ private:
+ size_t bytes_encoded;
+ size_t bytes_written;
+ uint8_t buf [4 + 256 + 2];
+ };
+
+ struct socks_response_t
+ {
+ socks_response_t (
+ uint8_t response_code_, std::string address_, uint16_t port_);
+ uint8_t response_code;
+ std::string address;
+ uint16_t port;
+ };
+
+ class socks_response_decoder_t
+ {
+ public:
+ socks_response_decoder_t ();
+ int input (fd_t fd_);
+ bool message_ready () const;
+ socks_response_t decode ();
+ void reset ();
+
+ private:
+ uint8_t buf [4 + 256 + 2];
+ size_t bytes_read;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks_connecter.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks_connecter.cpp
new file mode 100644
index 00000000..a3b70436
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks_connecter.cpp
@@ -0,0 +1,478 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <new>
+#include <string>
+
+#include "socks_connecter.hpp"
+#include "stream_engine.hpp"
+#include "platform.hpp"
+#include "random.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+#include "tcp.hpp"
+#include "address.hpp"
+#include "tcp_address.hpp"
+#include "session_base.hpp"
+#include "socks.hpp"
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#endif
+
+zmq::socks_connecter_t::socks_connecter_t (class io_thread_t *io_thread_,
+ class session_base_t *session_, const options_t &options_,
+ address_t *addr_, address_t *proxy_addr_, bool delayed_start_) :
+ own_t (io_thread_, options_),
+ io_object_t (io_thread_),
+ addr (addr_),
+ proxy_addr (proxy_addr_),
+ status (unplugged),
+ s (retired_fd),
+ delayed_start (delayed_start_),
+ session (session_),
+ current_reconnect_ivl (options.reconnect_ivl)
+{
+ zmq_assert (addr);
+ zmq_assert (addr->protocol == "tcp");
+ proxy_addr->to_string (endpoint);
+ socket = session->get_socket ();
+}
+
+zmq::socks_connecter_t::~socks_connecter_t ()
+{
+ zmq_assert (s == retired_fd);
+ delete proxy_addr;
+}
+
+void zmq::socks_connecter_t::process_plug ()
+{
+ if (delayed_start)
+ start_timer ();
+ else
+ initiate_connect ();
+}
+
+void zmq::socks_connecter_t::process_term (int linger_)
+{
+ switch (status) {
+ case unplugged:
+ break;
+ case waiting_for_reconnect_time:
+ cancel_timer (reconnect_timer_id);
+ break;
+ case waiting_for_proxy_connection:
+ case sending_greeting:
+ case waiting_for_choice:
+ case sending_request:
+ case waiting_for_response:
+ rm_fd (handle);
+ if (s != retired_fd)
+ close ();
+ break;
+ }
+
+ own_t::process_term (linger_);
+}
+
+void zmq::socks_connecter_t::in_event ()
+{
+ zmq_assert (status != unplugged
+ && status != waiting_for_reconnect_time);
+
+ if (status == waiting_for_choice) {
+ const int rc = choice_decoder.input (s);
+ if (rc == 0 || rc == -1)
+ error ();
+ else
+ if (choice_decoder.message_ready ()) {
+ const socks_choice_t choice = choice_decoder.decode ();
+ const int rc = process_server_response (choice);
+ if (rc == -1)
+ error ();
+ else {
+ std::string hostname = "";
+ uint16_t port = 0;
+ if (parse_address (addr->address, hostname, port) == -1)
+ error ();
+ else {
+ request_encoder.encode (
+ socks_request_t (1, hostname, port));
+ reset_pollin (handle);
+ set_pollout (handle);
+ status = sending_request;
+ }
+ }
+ }
+ }
+ else
+ if (status == waiting_for_response) {
+ const int rc = response_decoder.input (s);
+ if (rc == 0 || rc == -1)
+ error ();
+ else
+ if (response_decoder.message_ready ()) {
+ const socks_response_t response = response_decoder.decode ();
+ const int rc = process_server_response (response);
+ if (rc == -1)
+ error ();
+ else {
+ // Remember our fd for ZMQ_SRCFD in messages
+ socket->set_fd (s);
+
+ // Create the engine object for this connection.
+ stream_engine_t *engine = new (std::nothrow)
+ stream_engine_t (s, options, endpoint);
+ alloc_assert (engine);
+
+ // Attach the engine to the corresponding session object.
+ send_attach (session, engine);
+
+ socket->event_connected (endpoint, s);
+
+ rm_fd (handle);
+ s = -1;
+ status = unplugged;
+
+ // Shut the connecter down.
+ terminate ();
+ }
+ }
+ }
+ else
+ error ();
+}
+
+void zmq::socks_connecter_t::out_event ()
+{
+ zmq_assert (status == waiting_for_proxy_connection
+ || status == sending_greeting
+ || status == sending_request);
+
+ if (status == waiting_for_proxy_connection) {
+ const int rc = check_proxy_connection ();
+ if (rc == -1)
+ error ();
+ else {
+ greeting_encoder.encode (
+ socks_greeting_t (socks_no_auth_required));
+ status = sending_greeting;
+ }
+ }
+ else
+ if (status == sending_greeting) {
+ zmq_assert (greeting_encoder.has_pending_data ());
+ const int rc = greeting_encoder.output (s);
+ if (rc == -1 || rc == 0)
+ error ();
+ else
+ if (!greeting_encoder.has_pending_data ()) {
+ reset_pollout (handle);
+ set_pollin (handle);
+ status = waiting_for_choice;
+ }
+ }
+ else {
+ zmq_assert (request_encoder.has_pending_data ());
+ const int rc = request_encoder.output (s);
+ if (rc == -1 || rc == 0)
+ error ();
+ else
+ if (!request_encoder.has_pending_data ()) {
+ reset_pollout (handle);
+ set_pollin (handle);
+ status = waiting_for_response;
+ }
+ }
+}
+
+void zmq::socks_connecter_t::initiate_connect ()
+{
+ // Open the connecting socket.
+ const int rc = connect_to_proxy ();
+
+ // Connect may succeed in synchronous manner.
+ if (rc == 0) {
+ handle = add_fd (s);
+ set_pollout (handle);
+ status = sending_greeting;
+ }
+ // Connection establishment may be delayed. Poll for its completion.
+ else
+ if (errno == EINPROGRESS) {
+ handle = add_fd (s);
+ set_pollout (handle);
+ status = waiting_for_proxy_connection;
+ socket->event_connect_delayed (endpoint, zmq_errno ());
+ }
+ // Handle any other error condition by eventual reconnect.
+ else {
+ if (s != retired_fd)
+ close ();
+ start_timer ();
+ }
+}
+
+int zmq::socks_connecter_t::process_server_response (
+ const socks_choice_t &response)
+{
+ // We do not support any authentication method for now.
+ return response.method == 0? 0: -1;
+}
+
+int zmq::socks_connecter_t::process_server_response (
+ const socks_response_t &response)
+{
+ return response.response_code == 0? 0: -1;
+}
+
+void zmq::socks_connecter_t::timer_event (int id_)
+{
+ zmq_assert (status == waiting_for_reconnect_time);
+ zmq_assert (id_ == reconnect_timer_id);
+ initiate_connect ();
+}
+
+void zmq::socks_connecter_t::error ()
+{
+ rm_fd (handle);
+ close ();
+ greeting_encoder.reset ();
+ choice_decoder.reset ();
+ request_encoder.reset ();
+ response_decoder.reset ();
+ start_timer ();
+}
+
+void zmq::socks_connecter_t::start_timer ()
+{
+ const int interval = get_new_reconnect_ivl ();
+ add_timer (interval, reconnect_timer_id);
+ status = waiting_for_reconnect_time;
+ socket->event_connect_retried (endpoint, interval);
+}
+
+int zmq::socks_connecter_t::get_new_reconnect_ivl ()
+{
+ // The new interval is the current interval + random value.
+ const int interval = current_reconnect_ivl +
+ generate_random () % options.reconnect_ivl;
+
+ // Only change the current reconnect interval if the maximum reconnect
+ // interval was set and if it's larger than the reconnect interval.
+ if (options.reconnect_ivl_max > 0 &&
+ options.reconnect_ivl_max > options.reconnect_ivl)
+ // Calculate the next interval
+ current_reconnect_ivl =
+ std::min (current_reconnect_ivl * 2, options.reconnect_ivl_max);
+ return interval;
+}
+
+int zmq::socks_connecter_t::connect_to_proxy ()
+{
+ zmq_assert (s == retired_fd);
+
+ // Resolve the address
+ delete proxy_addr->resolved.tcp_addr;
+ proxy_addr->resolved.tcp_addr = new (std::nothrow) tcp_address_t ();
+ alloc_assert (proxy_addr->resolved.tcp_addr);
+
+ int rc = proxy_addr->resolved.tcp_addr->resolve (
+ proxy_addr->address.c_str (), false, options.ipv6);
+ if (rc != 0) {
+ delete proxy_addr->resolved.tcp_addr;
+ proxy_addr->resolved.tcp_addr = NULL;
+ return -1;
+ }
+ zmq_assert (proxy_addr->resolved.tcp_addr != NULL);
+ const tcp_address_t *tcp_addr = proxy_addr->resolved.tcp_addr;
+
+ // Create the socket.
+ s = open_socket (tcp_addr->family (), SOCK_STREAM, IPPROTO_TCP);
+#ifdef ZMQ_HAVE_WINDOWS
+ if (s == INVALID_SOCKET)
+ return -1;
+#else
+ if (s == -1)
+ return -1;
+#endif
+
+ // On some systems, IPv4 mapping in IPv6 sockets is disabled by default.
+ // Switch it on in such cases.
+ if (tcp_addr->family () == AF_INET6)
+ enable_ipv4_mapping (s);
+
+ // Set the IP Type-Of-Service priority for this socket
+ if (options.tos != 0)
+ set_ip_type_of_service (s, options.tos);
+
+ // Set the socket to non-blocking mode so that we get async connect().
+ unblock_socket (s);
+
+ // Set the socket buffer limits for the underlying socket.
+ if (options.sndbuf != 0)
+ set_tcp_send_buffer (s, options.sndbuf);
+ if (options.rcvbuf != 0)
+ set_tcp_receive_buffer (s, options.rcvbuf);
+
+ // Set the IP Type-Of-Service for the underlying socket
+ if (options.tos != 0)
+ set_ip_type_of_service (s, options.tos);
+
+ // Set a source address for conversations
+ if (tcp_addr->has_src_addr ()) {
+ rc = ::bind (s, tcp_addr->src_addr (), tcp_addr->src_addrlen ());
+ if (rc == -1) {
+ close ();
+ return -1;
+ }
+ }
+
+ // Connect to the remote peer.
+ rc = ::connect (s, tcp_addr->addr (), tcp_addr->addrlen ());
+
+ // Connect was successfull immediately.
+ if (rc == 0)
+ return 0;
+
+ // Translate error codes indicating asynchronous connect has been
+ // launched to a uniform EINPROGRESS.
+#ifdef ZMQ_HAVE_WINDOWS
+ const int error_code = WSAGetLastError ();
+ if (error_code == WSAEINPROGRESS || error_code == WSAEWOULDBLOCK)
+ errno = EINPROGRESS;
+ else {
+ errno = wsa_error_to_errno (error_code);
+ close ();
+ }
+#else
+ if (errno == EINTR)
+ errno = EINPROGRESS;
+#endif
+ return -1;
+}
+
+zmq::fd_t zmq::socks_connecter_t::check_proxy_connection ()
+{
+ // Async connect has finished. Check whether an error occurred
+ int err = 0;
+#ifdef ZMQ_HAVE_HPUX
+ int len = sizeof err;
+#else
+ socklen_t len = sizeof err;
+#endif
+
+ const int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
+
+ // Assert if the error was caused by 0MQ bug.
+ // Networking problems are OK. No need to assert.
+#ifdef ZMQ_HAVE_WINDOWS
+ zmq_assert (rc == 0);
+ if (err != 0) {
+ wsa_assert (err == WSAECONNREFUSED
+ || err == WSAETIMEDOUT
+ || err == WSAECONNABORTED
+ || err == WSAEHOSTUNREACH
+ || err == WSAENETUNREACH
+ || err == WSAENETDOWN
+ || err == WSAEACCES
+ || err == WSAEINVAL
+ || err == WSAEADDRINUSE);
+ return -1;
+ }
+#else
+ // Following code should handle both Berkeley-derived socket
+ // implementations and Solaris.
+ if (rc == -1)
+ err = errno;
+ if (err != 0) {
+ errno = err;
+ errno_assert (
+ errno == ECONNREFUSED ||
+ errno == ECONNRESET ||
+ errno == ETIMEDOUT ||
+ errno == EHOSTUNREACH ||
+ errno == ENETUNREACH ||
+ errno == ENETDOWN ||
+ errno == EINVAL);
+ return -1;
+ }
+#endif
+
+ tune_tcp_socket (s);
+ tune_tcp_keepalives (s, options.tcp_keepalive, options.tcp_keepalive_cnt,
+ options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
+
+ return 0;
+}
+
+void zmq::socks_connecter_t::close ()
+{
+ zmq_assert (s != retired_fd);
+#ifdef ZMQ_HAVE_WINDOWS
+ const int rc = closesocket (s);
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ const int rc = ::close (s);
+ errno_assert (rc == 0);
+#endif
+ socket->event_closed (endpoint, s);
+ s = retired_fd;
+}
+
+int zmq::socks_connecter_t::parse_address (
+ const std::string &address_, std::string &hostname_, uint16_t &port_)
+{
+ // Find the ':' at end that separates address from the port number.
+ const size_t idx = address_.rfind (':');
+ if (idx == std::string::npos) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ // Extract hostname
+ if (idx < 2 || address_ [0] != '[' || address_ [idx - 1] != ']')
+ hostname_ = address_.substr (0, idx);
+ else
+ hostname_ = address_.substr (1, idx - 2);
+
+ // Separate the hostname/port.
+ const std::string port_str = address_.substr (idx + 1);
+ // Parse the port number (0 is not a valid port).
+ port_ = (uint16_t) atoi (port_str.c_str ());
+ if (port_ == 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks_connecter.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks_connecter.hpp
new file mode 100644
index 00000000..a3c5a94f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/socks_connecter.hpp
@@ -0,0 +1,164 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __SOCKS_CONNECTER_HPP_INCLUDED__
+#define __SOCKS_CONNECTER_HPP_INCLUDED__
+
+#include "fd.hpp"
+#include "io_object.hpp"
+#include "own.hpp"
+#include "stdint.hpp"
+#include "../include/zmq.h"
+#include "socks.hpp"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class session_base_t;
+ struct address_t;
+
+ class socks_connecter_t : public own_t, public io_object_t
+ {
+ public:
+
+ // If 'delayed_start' is true connecter first waits for a while,
+ // then starts connection process.
+ socks_connecter_t (zmq::io_thread_t *io_thread_,
+ zmq::session_base_t *session_, const options_t &options_,
+ address_t *addr_, address_t *proxy_addr_, bool delayed_start_);
+ ~socks_connecter_t ();
+
+ private:
+ enum {
+ unplugged,
+ waiting_for_reconnect_time,
+ waiting_for_proxy_connection,
+ sending_greeting,
+ waiting_for_choice,
+ sending_request,
+ waiting_for_response
+ };
+
+ // ID of the timer used to delay the reconnection.
+ enum { reconnect_timer_id = 1 };
+
+ // Method ID
+ enum { socks_no_auth_required = 0 };
+
+ // Handlers for incoming commands.
+ virtual void process_plug ();
+ virtual void process_term (int linger_);
+
+ // Handlers for I/O events.
+ virtual void in_event ();
+ virtual void out_event ();
+ virtual void timer_event (int id_);
+
+ // Internal function to start the actual connection establishment.
+ void initiate_connect ();
+
+ int process_server_response (const socks_choice_t &response);
+ int process_server_response (const socks_response_t &response);
+
+ int parse_address (const std::string &address_,
+ std::string &hostname_, uint16_t &port_);
+
+ int connect_to_proxy ();
+
+ void error ();
+
+ // Internal function to start reconnect timer
+ void start_timer ();
+
+ // Internal function to return a reconnect backoff delay.
+ // Will modify the current_reconnect_ivl used for next call
+ // Returns the currently used interval
+ int get_new_reconnect_ivl ();
+
+ // Open TCP connecting socket. Returns -1 in case of error,
+ // 0 if connect was successfull immediately. Returns -1 with
+ // EAGAIN errno if async connect was launched.
+ int open ();
+
+ // Close the connecting socket.
+ void close ();
+
+ // Get the file descriptor of newly created connection. Returns
+ // retired_fd if the connection was unsuccessfull.
+ zmq::fd_t check_proxy_connection ();
+
+ socks_greeting_encoder_t greeting_encoder;
+ socks_choice_decoder_t choice_decoder;
+ socks_request_encoder_t request_encoder;
+ socks_response_decoder_t response_decoder;
+
+ // Address to connect to. Owned by session_base_t.
+ address_t *addr;
+
+ // SOCKS address; owned by this connecter.
+ address_t *proxy_addr;
+
+ int status;
+
+ // Underlying socket.
+ fd_t s;
+
+ // Handle corresponding to the listening socket.
+ handle_t handle;
+
+ // If true file descriptor is registered with the poller and 'handle'
+ // contains valid value.
+ bool handle_valid;
+
+ // If true, connecter is waiting a while before trying to connect.
+ const bool delayed_start;
+
+ // True iff a timer has been started.
+ bool timer_started;
+
+ // Reference to the session we belong to.
+ zmq::session_base_t *session;
+
+ // Current reconnect ivl, updated for backoff strategy
+ int current_reconnect_ivl;
+
+ // String representation of endpoint to connect to
+ std::string endpoint;
+
+ // Socket
+ zmq::socket_base_t *socket;
+
+ socks_connecter_t (const socks_connecter_t&);
+ const socks_connecter_t &operator = (const socks_connecter_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stdint.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stdint.hpp
new file mode 100644
index 00000000..955e2bc2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stdint.hpp
@@ -0,0 +1,72 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_STDINT_HPP_INCLUDED__
+#define __ZMQ_STDINT_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS
+
+#include <inttypes.h>
+
+#elif defined _MSC_VER && _MSC_VER < 1600
+
+#ifndef int8_t
+typedef __int8 int8_t;
+#endif
+#ifndef int16_t
+typedef __int16 int16_t;
+#endif
+#ifndef int32_t
+typedef __int32 int32_t;
+#endif
+#ifndef int64_t
+typedef __int64 int64_t;
+#endif
+#ifndef uint8_t
+typedef unsigned __int8 uint8_t;
+#endif
+#ifndef uint16_t
+typedef unsigned __int16 uint16_t;
+#endif
+#ifndef uint32_t
+typedef unsigned __int32 uint32_t;
+#endif
+#ifndef uint64_t
+typedef unsigned __int64 uint64_t;
+#endif
+
+#else
+
+#include <stdint.h>
+
+#endif
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream.cpp
new file mode 100644
index 00000000..112a116f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream.cpp
@@ -0,0 +1,307 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "stream.hpp"
+#include "pipe.hpp"
+#include "wire.hpp"
+#include "random.hpp"
+#include "likely.hpp"
+#include "err.hpp"
+
+zmq::stream_t::stream_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ socket_base_t (parent_, tid_, sid_),
+ prefetched (false),
+ identity_sent (false),
+ current_out (NULL),
+ more_out (false),
+ next_rid (generate_random ())
+{
+ options.type = ZMQ_STREAM;
+ options.raw_sock = true;
+
+ prefetched_id.init ();
+ prefetched_msg.init ();
+}
+
+zmq::stream_t::~stream_t ()
+{
+ zmq_assert (outpipes.empty ());
+ prefetched_id.close ();
+ prefetched_msg.close ();
+}
+
+void zmq::stream_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ // subscribe_to_all_ is unused
+ (void)subscribe_to_all_;
+
+ zmq_assert (pipe_);
+
+ identify_peer (pipe_);
+ fq.attach (pipe_);
+}
+
+void zmq::stream_t::xpipe_terminated (pipe_t *pipe_)
+{
+ outpipes_t::iterator it = outpipes.find (pipe_->get_identity ());
+ zmq_assert (it != outpipes.end ());
+ outpipes.erase (it);
+ fq.pipe_terminated (pipe_);
+ if (pipe_ == current_out)
+ current_out = NULL;
+}
+
+void zmq::stream_t::xread_activated (pipe_t *pipe_)
+{
+ fq.activated (pipe_);
+}
+
+void zmq::stream_t::xwrite_activated (pipe_t *pipe_)
+{
+ outpipes_t::iterator it;
+ for (it = outpipes.begin (); it != outpipes.end (); ++it)
+ if (it->second.pipe == pipe_)
+ break;
+
+ zmq_assert (it != outpipes.end ());
+ zmq_assert (!it->second.active);
+ it->second.active = true;
+}
+
+int zmq::stream_t::xsend (msg_t *msg_)
+{
+ // If this is the first part of the message it's the ID of the
+ // peer to send the message to.
+ if (!more_out) {
+ zmq_assert (!current_out);
+
+ // If we have malformed message (prefix with no subsequent message)
+ // then just silently ignore it.
+ // TODO: The connections should be killed instead.
+ if (msg_->flags () & msg_t::more) {
+
+ // Find the pipe associated with the identity stored in the prefix.
+ // If there's no such pipe return an error
+ blob_t identity ((unsigned char*) msg_->data (), msg_->size ());
+ outpipes_t::iterator it = outpipes.find (identity);
+
+ if (it != outpipes.end ()) {
+ current_out = it->second.pipe;
+ if (!current_out->check_write ()) {
+ it->second.active = false;
+ current_out = NULL;
+ errno = EAGAIN;
+ return -1;
+ }
+ }
+ else {
+ errno = EHOSTUNREACH;
+ return -1;
+ }
+ }
+
+ // Expect one more message frame.
+ more_out = true;
+
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ return 0;
+ }
+
+ // Ignore the MORE flag
+ msg_->reset_flags (msg_t::more);
+
+ // This is the last part of the message.
+ more_out = false;
+
+ // Push the message into the pipe. If there's no out pipe, just drop it.
+ if (current_out) {
+
+ // Close the remote connection if user has asked to do so
+ // by sending zero length message.
+ // Pending messages in the pipe will be dropped (on receiving term- ack)
+ if (msg_->size () == 0) {
+ current_out->terminate (false);
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ current_out = NULL;
+ return 0;
+ }
+ bool ok = current_out->write (msg_);
+ if (likely (ok))
+ current_out->flush ();
+ current_out = NULL;
+ }
+ else {
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ }
+
+ // Detach the message from the data buffer.
+ int rc = msg_->init ();
+ errno_assert (rc == 0);
+
+ return 0;
+}
+
+int zmq::stream_t::xsetsockopt (int option_, const void *optval_,
+ size_t optvallen_)
+{
+ switch (option_) {
+ case ZMQ_CONNECT_RID:
+ if (optval_ && optvallen_) {
+ connect_rid.assign ((char*) optval_, optvallen_);
+ return 0;
+ }
+ break;
+ default:
+ break;
+ }
+ errno = EINVAL;
+ return -1;
+}
+
+int zmq::stream_t::xrecv (msg_t *msg_)
+{
+ if (prefetched) {
+ if (!identity_sent) {
+ int rc = msg_->move (prefetched_id);
+ errno_assert (rc == 0);
+ identity_sent = true;
+ }
+ else {
+ int rc = msg_->move (prefetched_msg);
+ errno_assert (rc == 0);
+ prefetched = false;
+ }
+ return 0;
+ }
+
+ pipe_t *pipe = NULL;
+ int rc = fq.recvpipe (&prefetched_msg, &pipe);
+ if (rc != 0)
+ return -1;
+
+ zmq_assert (pipe != NULL);
+ zmq_assert ((prefetched_msg.flags () & msg_t::more) == 0);
+
+ // We have received a frame with TCP data.
+ // Rather than sendig this frame, we keep it in prefetched
+ // buffer and send a frame with peer's ID.
+ blob_t identity = pipe->get_identity ();
+ rc = msg_->init_size (identity.size ());
+ errno_assert (rc == 0);
+
+ // forward metadata (if any)
+ metadata_t *metadata = prefetched_msg.metadata();
+ if (metadata)
+ msg_->set_metadata(metadata);
+
+ memcpy (msg_->data (), identity.data (), identity.size ());
+ msg_->set_flags (msg_t::more);
+
+ prefetched = true;
+ identity_sent = true;
+
+ return 0;
+}
+
+bool zmq::stream_t::xhas_in ()
+{
+ // We may already have a message pre-fetched.
+ if (prefetched)
+ return true;
+
+ // Try to read the next message.
+ // The message, if read, is kept in the pre-fetch buffer.
+ pipe_t *pipe = NULL;
+ int rc = fq.recvpipe (&prefetched_msg, &pipe);
+ if (rc != 0)
+ return false;
+
+ zmq_assert (pipe != NULL);
+ zmq_assert ((prefetched_msg.flags () & msg_t::more) == 0);
+
+ blob_t identity = pipe->get_identity ();
+ rc = prefetched_id.init_size (identity.size ());
+ errno_assert (rc == 0);
+
+ // forward metadata (if any)
+ metadata_t *metadata = prefetched_msg.metadata();
+ if (metadata)
+ prefetched_id.set_metadata(metadata);
+
+ memcpy (prefetched_id.data (), identity.data (), identity.size ());
+ prefetched_id.set_flags (msg_t::more);
+
+ prefetched = true;
+ identity_sent = false;
+
+ return true;
+}
+
+bool zmq::stream_t::xhas_out ()
+{
+ // In theory, STREAM socket is always ready for writing. Whether actual
+ // attempt to write succeeds depends on which pipe the message is going
+ // to be routed to.
+ return true;
+}
+
+void zmq::stream_t::identify_peer (pipe_t *pipe_)
+{
+ // Always assign identity for raw-socket
+ unsigned char buffer [5];
+ buffer [0] = 0;
+ blob_t identity;
+ if (connect_rid.length ()) {
+ identity = blob_t ((unsigned char*) connect_rid.c_str(),
+ connect_rid.length ());
+ connect_rid.clear ();
+ outpipes_t::iterator it = outpipes.find (identity);
+ if (it != outpipes.end ())
+ zmq_assert(false);
+ }
+ else {
+ put_uint32 (buffer + 1, next_rid++);
+ identity = blob_t (buffer, sizeof buffer);
+ memcpy (options.identity, identity.data (), identity.size ());
+ options.identity_size = identity.size ();
+ }
+ pipe_->set_identity (identity);
+ // Add the record into output pipes lookup table
+ outpipe_t outpipe = {pipe_, true};
+ const bool ok = outpipes.insert (
+ outpipes_t::value_type (identity, outpipe)).second;
+ zmq_assert (ok);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream.hpp
new file mode 100644
index 00000000..741a56a2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream.hpp
@@ -0,0 +1,107 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_STREAM_HPP_INCLUDED__
+#define __ZMQ_STREAM_HPP_INCLUDED__
+
+#include <map>
+
+#include "router.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class pipe_t;
+
+ class stream_t :
+ public socket_base_t
+ {
+ public:
+
+ stream_t (zmq::ctx_t *parent_, uint32_t tid_, int sid);
+ ~stream_t ();
+
+ // Overrides of functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ bool xhas_out ();
+ void xread_activated (zmq::pipe_t *pipe_);
+ void xwrite_activated (zmq::pipe_t *pipe_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+ int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
+ private:
+ // Generate peer's id and update lookup map
+ void identify_peer (pipe_t *pipe_);
+
+ // Fair queueing object for inbound pipes.
+ fq_t fq;
+
+ // True iff there is a message held in the pre-fetch buffer.
+ bool prefetched;
+
+ // If true, the receiver got the message part with
+ // the peer's identity.
+ bool identity_sent;
+
+ // Holds the prefetched identity.
+ msg_t prefetched_id;
+
+ // Holds the prefetched message.
+ msg_t prefetched_msg;
+
+ struct outpipe_t
+ {
+ zmq::pipe_t *pipe;
+ bool active;
+ };
+
+ // Outbound pipes indexed by the peer IDs.
+ typedef std::map <blob_t, outpipe_t> outpipes_t;
+ outpipes_t outpipes;
+
+ // The pipe we are currently writing to.
+ zmq::pipe_t *current_out;
+
+ // If true, more outgoing message parts are expected.
+ bool more_out;
+
+ // Routing IDs are generated. It's a simple increment and wrap-over
+ // algorithm. This value is the next ID to use (if not used already).
+ uint32_t next_rid;
+
+ stream_t (const stream_t&);
+ const stream_t &operator = (const stream_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream_engine.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream_engine.cpp
new file mode 100644
index 00000000..87186cc0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream_engine.cpp
@@ -0,0 +1,960 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <unistd.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/tcp.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <fcntl.h>
+#if defined ZMQ_HAVE_OPENBSD
+#define ucred sockpeercred
+#endif
+#endif
+
+#include <string.h>
+#include <new>
+#include <sstream>
+#include <iostream>
+
+#include "stream_engine.hpp"
+#include "io_thread.hpp"
+#include "session_base.hpp"
+#include "v1_encoder.hpp"
+#include "v1_decoder.hpp"
+#include "v2_encoder.hpp"
+#include "v2_decoder.hpp"
+#include "null_mechanism.hpp"
+#include "plain_client.hpp"
+#include "plain_server.hpp"
+#include "gssapi_client.hpp"
+#include "gssapi_server.hpp"
+#include "curve_client.hpp"
+#include "curve_server.hpp"
+#include "raw_decoder.hpp"
+#include "raw_encoder.hpp"
+#include "config.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+#include "tcp.hpp"
+#include "likely.hpp"
+#include "wire.hpp"
+
+zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_,
+ const std::string &endpoint_) :
+ s (fd_),
+ inpos (NULL),
+ insize (0),
+ decoder (NULL),
+ outpos (NULL),
+ outsize (0),
+ encoder (NULL),
+ metadata (NULL),
+ handshaking (true),
+ greeting_size (v2_greeting_size),
+ greeting_bytes_read (0),
+ session (NULL),
+ options (options_),
+ endpoint (endpoint_),
+ plugged (false),
+ next_msg (&stream_engine_t::identity_msg),
+ process_msg (&stream_engine_t::process_identity_msg),
+ io_error (false),
+ subscription_required (false),
+ mechanism (NULL),
+ input_stopped (false),
+ output_stopped (false),
+ has_handshake_timer (false),
+ socket (NULL)
+{
+ int rc = tx_msg.init ();
+ errno_assert (rc == 0);
+
+ // Put the socket into non-blocking mode.
+ unblock_socket (s);
+
+ int family = get_peer_ip_address (s, peer_address);
+ if (family == 0)
+ peer_address.clear();
+#if defined ZMQ_HAVE_SO_PEERCRED
+ else
+ if (family == PF_UNIX) {
+ struct ucred cred;
+ socklen_t size = sizeof (cred);
+ if (!getsockopt (s, SOL_SOCKET, SO_PEERCRED, &cred, &size)) {
+ std::ostringstream buf;
+ buf << ":" << cred.uid << ":" << cred.gid << ":" << cred.pid;
+ peer_address += buf.str ();
+ }
+ }
+#elif defined ZMQ_HAVE_LOCAL_PEERCRED
+ else
+ if (family == PF_UNIX) {
+ struct xucred cred;
+ socklen_t size = sizeof (cred);
+ if (!getsockopt (s, 0, LOCAL_PEERCRED, &cred, &size)
+ && cred.cr_version == XUCRED_VERSION) {
+ std::ostringstream buf;
+ buf << ":" << cred.cr_uid << ":";
+ if (cred.cr_ngroups > 0)
+ buf << cred.cr_groups[0];
+ buf << ":";
+ peer_address += buf.str ();
+ }
+ }
+#endif
+
+#ifdef SO_NOSIGPIPE
+ // Make sure that SIGPIPE signal is not generated when writing to a
+ // connection that was already closed by the peer.
+ int set = 1;
+ rc = setsockopt (s, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof (int));
+ errno_assert (rc == 0);
+#endif
+}
+
+zmq::stream_engine_t::~stream_engine_t ()
+{
+ zmq_assert (!plugged);
+
+ if (s != retired_fd) {
+#ifdef ZMQ_HAVE_WINDOWS
+ int rc = closesocket (s);
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ int rc = close (s);
+ errno_assert (rc == 0);
+#endif
+ s = retired_fd;
+ }
+
+ int rc = tx_msg.close ();
+ errno_assert (rc == 0);
+
+ // Drop reference to metadata and destroy it if we are
+ // the only user.
+ if (metadata != NULL)
+ if (metadata->drop_ref ())
+ delete metadata;
+
+ delete encoder;
+ delete decoder;
+ delete mechanism;
+}
+
+void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
+ session_base_t *session_)
+{
+ zmq_assert (!plugged);
+ plugged = true;
+
+ // Connect to session object.
+ zmq_assert (!session);
+ zmq_assert (session_);
+ session = session_;
+ socket = session-> get_socket ();
+
+ // Connect to I/O threads poller object.
+ io_object_t::plug (io_thread_);
+ handle = add_fd (s);
+ io_error = false;
+
+ if (options.raw_sock) {
+ // no handshaking for raw sock, instantiate raw encoder and decoders
+ encoder = new (std::nothrow) raw_encoder_t (out_batch_size);
+ alloc_assert (encoder);
+
+ decoder = new (std::nothrow) raw_decoder_t (in_batch_size);
+ alloc_assert (decoder);
+
+ // disable handshaking for raw socket
+ handshaking = false;
+
+ next_msg = &stream_engine_t::pull_msg_from_session;
+ process_msg = &stream_engine_t::push_raw_msg_to_session;
+
+ if (!peer_address.empty()) {
+ // Compile metadata.
+ typedef metadata_t::dict_t properties_t;
+ properties_t properties;
+ properties.insert(std::make_pair("Peer-Address", peer_address));
+ zmq_assert (metadata == NULL);
+ metadata = new (std::nothrow) metadata_t (properties);
+ }
+
+ // For raw sockets, send an initial 0-length message to the
+ // application so that it knows a peer has connected.
+ msg_t connector;
+ connector.init();
+ push_raw_msg_to_session (&connector);
+ connector.close();
+ session->flush ();
+ }
+ else {
+ // start optional timer, to prevent handshake hanging on no input
+ set_handshake_timer ();
+
+ // Send the 'length' and 'flags' fields of the identity message.
+ // The 'length' field is encoded in the long format.
+ outpos = greeting_send;
+ outpos [outsize++] = 0xff;
+ put_uint64 (&outpos [outsize], options.identity_size + 1);
+ outsize += 8;
+ outpos [outsize++] = 0x7f;
+ }
+
+ set_pollin (handle);
+ set_pollout (handle);
+ // Flush all the data that may have been already received downstream.
+ in_event ();
+}
+
+void zmq::stream_engine_t::unplug ()
+{
+ zmq_assert (plugged);
+ plugged = false;
+
+ // Cancel all timers.
+ if (has_handshake_timer) {
+ cancel_timer (handshake_timer_id);
+ has_handshake_timer = false;
+ }
+
+ // Cancel all fd subscriptions.
+ if (!io_error)
+ rm_fd (handle);
+
+ // Disconnect from I/O threads poller object.
+ io_object_t::unplug ();
+
+ session = NULL;
+}
+
+void zmq::stream_engine_t::terminate ()
+{
+ unplug ();
+ delete this;
+}
+
+void zmq::stream_engine_t::in_event ()
+{
+ zmq_assert (!io_error);
+
+ // If still handshaking, receive and process the greeting message.
+ if (unlikely (handshaking))
+ if (!handshake ())
+ return;
+
+ zmq_assert (decoder);
+
+ // If there has been an I/O error, stop polling.
+ if (input_stopped) {
+ rm_fd (handle);
+ io_error = true;
+ return;
+ }
+
+ // If there's no data to process in the buffer...
+ if (!insize) {
+
+ // Retrieve the buffer and read as much data as possible.
+ // Note that buffer can be arbitrarily large. However, we assume
+ // the underlying TCP layer has fixed buffer size and thus the
+ // number of bytes read will be always limited.
+ size_t bufsize = 0;
+ decoder->get_buffer (&inpos, &bufsize);
+
+ const int rc = tcp_read (s, inpos, bufsize);
+ if (rc == 0) {
+ error (connection_error);
+ return;
+ }
+ if (rc == -1) {
+ if (errno != EAGAIN)
+ error (connection_error);
+ return;
+ }
+
+ // Adjust input size
+ insize = static_cast <size_t> (rc);
+ }
+
+ int rc = 0;
+ size_t processed = 0;
+
+ while (insize > 0) {
+ rc = decoder->decode (inpos, insize, processed);
+ zmq_assert (processed <= insize);
+ inpos += processed;
+ insize -= processed;
+ if (rc == 0 || rc == -1)
+ break;
+ rc = (this->*process_msg) (decoder->msg ());
+ if (rc == -1)
+ break;
+ }
+
+ // Tear down the connection if we have failed to decode input data
+ // or the session has rejected the message.
+ if (rc == -1) {
+ if (errno != EAGAIN) {
+ error (protocol_error);
+ return;
+ }
+ input_stopped = true;
+ reset_pollin (handle);
+ }
+
+ session->flush ();
+}
+
+void zmq::stream_engine_t::out_event ()
+{
+ zmq_assert (!io_error);
+
+ // If write buffer is empty, try to read new data from the encoder.
+ if (!outsize) {
+
+ // Even when we stop polling as soon as there is no
+ // data to send, the poller may invoke out_event one
+ // more time due to 'speculative write' optimisation.
+ if (unlikely (encoder == NULL)) {
+ zmq_assert (handshaking);
+ return;
+ }
+
+ outpos = NULL;
+ outsize = encoder->encode (&outpos, 0);
+
+ while (outsize < out_batch_size) {
+ if ((this->*next_msg) (&tx_msg) == -1)
+ break;
+ encoder->load_msg (&tx_msg);
+ unsigned char *bufptr = outpos + outsize;
+ size_t n = encoder->encode (&bufptr, out_batch_size - outsize);
+ zmq_assert (n > 0);
+ if (outpos == NULL)
+ outpos = bufptr;
+ outsize += n;
+ }
+
+ // If there is no data to send, stop polling for output.
+ if (outsize == 0) {
+ output_stopped = true;
+ reset_pollout (handle);
+ return;
+ }
+ }
+
+ // If there are any data to write in write buffer, write as much as
+ // possible to the socket. Note that amount of data to write can be
+ // arbitrarily large. However, we assume that underlying TCP layer has
+ // limited transmission buffer and thus the actual number of bytes
+ // written should be reasonably modest.
+ const int nbytes = tcp_write (s, outpos, outsize);
+
+ // IO error has occurred. We stop waiting for output events.
+ // The engine is not terminated until we detect input error;
+ // this is necessary to prevent losing incoming messages.
+ if (nbytes == -1) {
+ reset_pollout (handle);
+ return;
+ }
+
+ outpos += nbytes;
+ outsize -= nbytes;
+
+ // If we are still handshaking and there are no data
+ // to send, stop polling for output.
+ if (unlikely (handshaking))
+ if (outsize == 0)
+ reset_pollout (handle);
+}
+
+void zmq::stream_engine_t::restart_output ()
+{
+ if (unlikely (io_error))
+ return;
+
+ if (likely (output_stopped)) {
+ set_pollout (handle);
+ output_stopped = false;
+ }
+
+ // Speculative write: The assumption is that at the moment new message
+ // was sent by the user the socket is probably available for writing.
+ // Thus we try to write the data to socket avoiding polling for POLLOUT.
+ // Consequently, the latency should be better in request/reply scenarios.
+ out_event ();
+}
+
+void zmq::stream_engine_t::restart_input ()
+{
+ zmq_assert (input_stopped);
+ zmq_assert (session != NULL);
+ zmq_assert (decoder != NULL);
+
+ int rc = (this->*process_msg) (decoder->msg ());
+ if (rc == -1) {
+ if (errno == EAGAIN)
+ session->flush ();
+ else
+ error (protocol_error);
+ return;
+ }
+
+ while (insize > 0) {
+ size_t processed = 0;
+ rc = decoder->decode (inpos, insize, processed);
+ zmq_assert (processed <= insize);
+ inpos += processed;
+ insize -= processed;
+ if (rc == 0 || rc == -1)
+ break;
+ rc = (this->*process_msg) (decoder->msg ());
+ if (rc == -1)
+ break;
+ }
+
+ if (rc == -1 && errno == EAGAIN)
+ session->flush ();
+ else
+ if (io_error)
+ error (connection_error);
+ else
+ if (rc == -1)
+ error (protocol_error);
+ else {
+ input_stopped = false;
+ set_pollin (handle);
+ session->flush ();
+
+ // Speculative read.
+ in_event ();
+ }
+}
+
+bool zmq::stream_engine_t::handshake ()
+{
+ zmq_assert (handshaking);
+ zmq_assert (greeting_bytes_read < greeting_size);
+ // Receive the greeting.
+ while (greeting_bytes_read < greeting_size) {
+ const int n = tcp_read (s, greeting_recv + greeting_bytes_read,
+ greeting_size - greeting_bytes_read);
+ if (n == 0) {
+ error (connection_error);
+ return false;
+ }
+ if (n == -1) {
+ if (errno != EAGAIN)
+ error (connection_error);
+ return false;
+ }
+
+ greeting_bytes_read += n;
+
+ // We have received at least one byte from the peer.
+ // If the first byte is not 0xff, we know that the
+ // peer is using unversioned protocol.
+ if (greeting_recv [0] != 0xff)
+ break;
+
+ if (greeting_bytes_read < signature_size)
+ continue;
+
+ // Inspect the right-most bit of the 10th byte (which coincides
+ // with the 'flags' field if a regular message was sent).
+ // Zero indicates this is a header of identity message
+ // (i.e. the peer is using the unversioned protocol).
+ if (!(greeting_recv [9] & 0x01))
+ break;
+
+ // The peer is using versioned protocol.
+ // Send the major version number.
+ if (outpos + outsize == greeting_send + signature_size) {
+ if (outsize == 0)
+ set_pollout (handle);
+ outpos [outsize++] = 3; // Major version number
+ }
+
+ if (greeting_bytes_read > signature_size) {
+ if (outpos + outsize == greeting_send + signature_size + 1) {
+ if (outsize == 0)
+ set_pollout (handle);
+
+ // Use ZMTP/2.0 to talk to older peers.
+ if (greeting_recv [10] == ZMTP_1_0
+ || greeting_recv [10] == ZMTP_2_0)
+ outpos [outsize++] = options.type;
+ else {
+ outpos [outsize++] = 0; // Minor version number
+ memset (outpos + outsize, 0, 20);
+
+ zmq_assert (options.mechanism == ZMQ_NULL
+ || options.mechanism == ZMQ_PLAIN
+ || options.mechanism == ZMQ_CURVE
+ || options.mechanism == ZMQ_GSSAPI);
+
+ if (options.mechanism == ZMQ_NULL)
+ memcpy (outpos + outsize, "NULL", 4);
+ else
+ if (options.mechanism == ZMQ_PLAIN)
+ memcpy (outpos + outsize, "PLAIN", 5);
+ else
+ if (options.mechanism == ZMQ_GSSAPI)
+ memcpy (outpos + outsize, "GSSAPI", 6);
+ else
+ if (options.mechanism == ZMQ_CURVE)
+ memcpy (outpos + outsize, "CURVE", 5);
+ outsize += 20;
+ memset (outpos + outsize, 0, 32);
+ outsize += 32;
+ greeting_size = v3_greeting_size;
+ }
+ }
+ }
+ }
+
+ // Position of the revision field in the greeting.
+ const size_t revision_pos = 10;
+
+ // Is the peer using ZMTP/1.0 with no revision number?
+ // If so, we send and receive rest of identity message
+ if (greeting_recv [0] != 0xff || !(greeting_recv [9] & 0x01)) {
+ if (session->zap_enabled ()) {
+ // reject ZMTP 1.0 connections if ZAP is enabled
+ error (protocol_error);
+ return false;
+ }
+
+ encoder = new (std::nothrow) v1_encoder_t (out_batch_size);
+ alloc_assert (encoder);
+
+ decoder = new (std::nothrow) v1_decoder_t (in_batch_size, options.maxmsgsize);
+ alloc_assert (decoder);
+
+ // We have already sent the message header.
+ // Since there is no way to tell the encoder to
+ // skip the message header, we simply throw that
+ // header data away.
+ const size_t header_size = options.identity_size + 1 >= 255 ? 10 : 2;
+ unsigned char tmp [10], *bufferp = tmp;
+
+ // Prepare the identity message and load it into encoder.
+ // Then consume bytes we have already sent to the peer.
+ const int rc = tx_msg.init_size (options.identity_size);
+ zmq_assert (rc == 0);
+ memcpy (tx_msg.data (), options.identity, options.identity_size);
+ encoder->load_msg (&tx_msg);
+ size_t buffer_size = encoder->encode (&bufferp, header_size);
+ zmq_assert (buffer_size == header_size);
+
+ // Make sure the decoder sees the data we have already received.
+ inpos = greeting_recv;
+ insize = greeting_bytes_read;
+
+ // To allow for interoperability with peers that do not forward
+ // their subscriptions, we inject a phantom subscription message
+ // message into the incoming message stream.
+ if (options.type == ZMQ_PUB || options.type == ZMQ_XPUB)
+ subscription_required = true;
+
+ // We are sending our identity now and the next message
+ // will come from the socket.
+ next_msg = &stream_engine_t::pull_msg_from_session;
+
+ // We are expecting identity message.
+ process_msg = &stream_engine_t::process_identity_msg;
+ }
+ else
+ if (greeting_recv [revision_pos] == ZMTP_1_0) {
+ if (session->zap_enabled ()) {
+ // reject ZMTP 1.0 connections if ZAP is enabled
+ error (protocol_error);
+ return false;
+ }
+
+ encoder = new (std::nothrow) v1_encoder_t (
+ out_batch_size);
+ alloc_assert (encoder);
+
+ decoder = new (std::nothrow) v1_decoder_t (
+ in_batch_size, options.maxmsgsize);
+ alloc_assert (decoder);
+ }
+ else
+ if (greeting_recv [revision_pos] == ZMTP_2_0) {
+ if (session->zap_enabled ()) {
+ // reject ZMTP 2.0 connections if ZAP is enabled
+ error (protocol_error);
+ return false;
+ }
+
+ encoder = new (std::nothrow) v2_encoder_t (out_batch_size);
+ alloc_assert (encoder);
+
+ decoder = new (std::nothrow) v2_decoder_t (
+ in_batch_size, options.maxmsgsize);
+ alloc_assert (decoder);
+ }
+ else {
+ encoder = new (std::nothrow) v2_encoder_t (out_batch_size);
+ alloc_assert (encoder);
+
+ decoder = new (std::nothrow) v2_decoder_t (
+ in_batch_size, options.maxmsgsize);
+ alloc_assert (decoder);
+
+ if (options.mechanism == ZMQ_NULL
+ && memcmp (greeting_recv + 12, "NULL\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 20) == 0) {
+ mechanism = new (std::nothrow)
+ null_mechanism_t (session, peer_address, options);
+ alloc_assert (mechanism);
+ }
+ else
+ if (options.mechanism == ZMQ_PLAIN
+ && memcmp (greeting_recv + 12, "PLAIN\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 20) == 0) {
+ if (options.as_server)
+ mechanism = new (std::nothrow)
+ plain_server_t (session, peer_address, options);
+ else
+ mechanism = new (std::nothrow)
+ plain_client_t (options);
+ alloc_assert (mechanism);
+ }
+#ifdef HAVE_LIBSODIUM
+ else
+ if (options.mechanism == ZMQ_CURVE
+ && memcmp (greeting_recv + 12, "CURVE\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 20) == 0) {
+ if (options.as_server)
+ mechanism = new (std::nothrow)
+ curve_server_t (session, peer_address, options);
+ else
+ mechanism = new (std::nothrow) curve_client_t (options);
+ alloc_assert (mechanism);
+ }
+#endif
+#ifdef HAVE_LIBGSSAPI_KRB5
+ else
+ if (options.mechanism == ZMQ_GSSAPI
+ && memcmp (greeting_recv + 12, "GSSAPI\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 20) == 0) {
+ if (options.as_server)
+ mechanism = new (std::nothrow)
+ gssapi_server_t (session, peer_address, options);
+ else
+ mechanism = new (std::nothrow) gssapi_client_t (options);
+ alloc_assert (mechanism);
+ }
+#endif
+ else {
+ error (protocol_error);
+ return false;
+ }
+ next_msg = &stream_engine_t::next_handshake_command;
+ process_msg = &stream_engine_t::process_handshake_command;
+ }
+
+ // Start polling for output if necessary.
+ if (outsize == 0)
+ set_pollout (handle);
+
+ // Handshaking was successful.
+ // Switch into the normal message flow.
+ handshaking = false;
+
+ if (has_handshake_timer) {
+ cancel_timer (handshake_timer_id);
+ has_handshake_timer = false;
+ }
+
+ return true;
+}
+
+int zmq::stream_engine_t::identity_msg (msg_t *msg_)
+{
+ int rc = msg_->init_size (options.identity_size);
+ errno_assert (rc == 0);
+ if (options.identity_size > 0)
+ memcpy (msg_->data (), options.identity, options.identity_size);
+ next_msg = &stream_engine_t::pull_msg_from_session;
+ return 0;
+}
+
+int zmq::stream_engine_t::process_identity_msg (msg_t *msg_)
+{
+ if (options.recv_identity) {
+ msg_->set_flags (msg_t::identity);
+ int rc = session->push_msg (msg_);
+ errno_assert (rc == 0);
+ }
+ else {
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+ }
+
+ if (subscription_required)
+ process_msg = &stream_engine_t::write_subscription_msg;
+ else
+ process_msg = &stream_engine_t::push_msg_to_session;
+
+ return 0;
+}
+
+int zmq::stream_engine_t::next_handshake_command (msg_t *msg_)
+{
+ zmq_assert (mechanism != NULL);
+
+ if (mechanism->status () == mechanism_t::ready) {
+ mechanism_ready ();
+ return pull_and_encode (msg_);
+ }
+ else
+ if (mechanism->status () == mechanism_t::error) {
+ errno = EPROTO;
+ return -1;
+ }
+ else {
+ const int rc = mechanism->next_handshake_command (msg_);
+ if (rc == 0)
+ msg_->set_flags (msg_t::command);
+ return rc;
+ }
+}
+
+int zmq::stream_engine_t::process_handshake_command (msg_t *msg_)
+{
+ zmq_assert (mechanism != NULL);
+ const int rc = mechanism->process_handshake_command (msg_);
+ if (rc == 0) {
+ if (mechanism->status () == mechanism_t::ready)
+ mechanism_ready ();
+ else
+ if (mechanism->status () == mechanism_t::error) {
+ errno = EPROTO;
+ return -1;
+ }
+ if (output_stopped)
+ restart_output ();
+ }
+
+ return rc;
+}
+
+void zmq::stream_engine_t::zap_msg_available ()
+{
+ zmq_assert (mechanism != NULL);
+
+ const int rc = mechanism->zap_msg_available ();
+ if (rc == -1) {
+ error (protocol_error);
+ return;
+ }
+ if (input_stopped)
+ restart_input ();
+ if (output_stopped)
+ restart_output ();
+}
+
+void zmq::stream_engine_t::mechanism_ready ()
+{
+ if (options.recv_identity) {
+ msg_t identity;
+ mechanism->peer_identity (&identity);
+ const int rc = session->push_msg (&identity);
+ if (rc == -1 && errno == EAGAIN) {
+ // If the write is failing at this stage with
+ // an EAGAIN the pipe must be being shut down,
+ // so we can just bail out of the identity set.
+ return;
+ }
+ errno_assert (rc == 0);
+ session->flush ();
+ }
+
+ next_msg = &stream_engine_t::pull_and_encode;
+ process_msg = &stream_engine_t::write_credential;
+
+ // Compile metadata.
+ typedef metadata_t::dict_t properties_t;
+ properties_t properties;
+ properties_t::const_iterator it;
+
+ // If we have a peer_address, add it to metadata
+ if (!peer_address.empty()) {
+ properties.insert(std::make_pair("Peer-Address", peer_address));
+ }
+
+ // Add ZAP properties.
+ const properties_t& zap_properties = mechanism->get_zap_properties ();
+ properties.insert(zap_properties.begin (), zap_properties.end ());
+
+ // Add ZMTP properties.
+ const properties_t& zmtp_properties = mechanism->get_zmtp_properties ();
+ properties.insert(zmtp_properties.begin (), zmtp_properties.end ());
+
+ zmq_assert (metadata == NULL);
+ if (!properties.empty ())
+ metadata = new (std::nothrow) metadata_t (properties);
+}
+
+int zmq::stream_engine_t::pull_msg_from_session (msg_t *msg_)
+{
+ return session->pull_msg (msg_);
+}
+
+int zmq::stream_engine_t::push_msg_to_session (msg_t *msg_)
+{
+ return session->push_msg (msg_);
+}
+
+int zmq::stream_engine_t::push_raw_msg_to_session (msg_t *msg_) {
+ if (metadata)
+ msg_->set_metadata(metadata);
+ return push_msg_to_session(msg_);
+}
+
+int zmq::stream_engine_t::write_credential (msg_t *msg_)
+{
+ zmq_assert (mechanism != NULL);
+ zmq_assert (session != NULL);
+
+ const blob_t credential = mechanism->get_user_id ();
+ if (credential.size () > 0) {
+ msg_t msg;
+ int rc = msg.init_size (credential.size ());
+ zmq_assert (rc == 0);
+ memcpy (msg.data (), credential.data (), credential.size ());
+ msg.set_flags (msg_t::credential);
+ rc = session->push_msg (&msg);
+ if (rc == -1) {
+ rc = msg.close ();
+ errno_assert (rc == 0);
+ return -1;
+ }
+ }
+ process_msg = &stream_engine_t::decode_and_push;
+ return decode_and_push (msg_);
+}
+
+int zmq::stream_engine_t::pull_and_encode (msg_t *msg_)
+{
+ zmq_assert (mechanism != NULL);
+
+ if (session->pull_msg (msg_) == -1)
+ return -1;
+ if (mechanism->encode (msg_) == -1)
+ return -1;
+ return 0;
+}
+
+int zmq::stream_engine_t::decode_and_push (msg_t *msg_)
+{
+ zmq_assert (mechanism != NULL);
+
+ if (mechanism->decode (msg_) == -1)
+ return -1;
+ if (metadata)
+ msg_->set_metadata (metadata);
+ if (session->push_msg (msg_) == -1) {
+ if (errno == EAGAIN)
+ process_msg = &stream_engine_t::push_one_then_decode_and_push;
+ return -1;
+ }
+ return 0;
+}
+
+int zmq::stream_engine_t::push_one_then_decode_and_push (msg_t *msg_)
+{
+ const int rc = session->push_msg (msg_);
+ if (rc == 0)
+ process_msg = &stream_engine_t::decode_and_push;
+ return rc;
+}
+
+int zmq::stream_engine_t::write_subscription_msg (msg_t *msg_)
+{
+ msg_t subscription;
+
+ // Inject the subscription message, so that also
+ // ZMQ 2.x peers receive published messages.
+ int rc = subscription.init_size (1);
+ errno_assert (rc == 0);
+ *(unsigned char*) subscription.data () = 1;
+ rc = session->push_msg (&subscription);
+ if (rc == -1)
+ return -1;
+
+ process_msg = &stream_engine_t::push_msg_to_session;
+ return push_msg_to_session (msg_);
+}
+
+void zmq::stream_engine_t::error (error_reason_t reason)
+{
+ if (options.raw_sock) {
+ // For raw sockets, send a final 0-length message to the application
+ // so that it knows the peer has been disconnected.
+ msg_t terminator;
+ terminator.init();
+ (this->*process_msg) (&terminator);
+ terminator.close();
+ }
+ zmq_assert (session);
+ socket->event_disconnected (endpoint, s);
+ session->flush ();
+ session->engine_error (reason);
+ unplug ();
+ delete this;
+}
+
+void zmq::stream_engine_t::set_handshake_timer ()
+{
+ zmq_assert (!has_handshake_timer);
+
+ if (!options.raw_sock && options.handshake_ivl > 0) {
+ add_timer (options.handshake_ivl, handshake_timer_id);
+ has_handshake_timer = true;
+ }
+}
+
+void zmq::stream_engine_t::timer_event (int id_)
+{
+ zmq_assert (id_ == handshake_timer_id);
+ has_handshake_timer = false;
+
+ // handshake timer expired before handshake completed, so engine fails
+ error (timeout_error);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream_engine.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream_engine.hpp
new file mode 100644
index 00000000..d42c6929
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/stream_engine.hpp
@@ -0,0 +1,218 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_STREAM_ENGINE_HPP_INCLUDED__
+#define __ZMQ_STREAM_ENGINE_HPP_INCLUDED__
+
+#include <stddef.h>
+
+#include "fd.hpp"
+#include "i_engine.hpp"
+#include "io_object.hpp"
+#include "i_encoder.hpp"
+#include "i_decoder.hpp"
+#include "options.hpp"
+#include "socket_base.hpp"
+#include "../include/zmq.h"
+#include "metadata.hpp"
+
+namespace zmq
+{
+ // Protocol revisions
+ enum
+ {
+ ZMTP_1_0 = 0,
+ ZMTP_2_0 = 1
+ };
+
+ class io_thread_t;
+ class msg_t;
+ class session_base_t;
+ class mechanism_t;
+
+ // This engine handles any socket with SOCK_STREAM semantics,
+ // e.g. TCP socket or an UNIX domain socket.
+
+ class stream_engine_t : public io_object_t, public i_engine
+ {
+ public:
+
+ enum error_reason_t {
+ protocol_error,
+ connection_error,
+ timeout_error
+ };
+
+ stream_engine_t (fd_t fd_, const options_t &options_,
+ const std::string &endpoint);
+ ~stream_engine_t ();
+
+ // i_engine interface implementation.
+ void plug (zmq::io_thread_t *io_thread_,
+ zmq::session_base_t *session_);
+ void terminate ();
+ void restart_input ();
+ void restart_output ();
+ void zap_msg_available ();
+
+ // i_poll_events interface implementation.
+ void in_event ();
+ void out_event ();
+ void timer_event (int id_);
+
+ private:
+
+ // Unplug the engine from the session.
+ void unplug ();
+
+ // Function to handle network disconnections.
+ void error (error_reason_t reason);
+
+ // Receives the greeting message from the peer.
+ int receive_greeting ();
+
+ // Detects the protocol used by the peer.
+ bool handshake ();
+
+ int identity_msg (msg_t *msg_);
+ int process_identity_msg (msg_t *msg_);
+
+ int next_handshake_command (msg_t *msg);
+ int process_handshake_command (msg_t *msg);
+
+ int push_raw_msg_to_session (msg_t *msg);
+
+ int pull_msg_from_session (msg_t *msg_);
+ int push_msg_to_session (msg_t *msg);
+
+ int write_credential (msg_t *msg_);
+ int pull_and_encode (msg_t *msg_);
+ int decode_and_push (msg_t *msg_);
+ int push_one_then_decode_and_push (msg_t *msg_);
+
+ void mechanism_ready ();
+
+ int write_subscription_msg (msg_t *msg_);
+
+ size_t add_property (unsigned char *ptr,
+ const char *name, const void *value, size_t value_len);
+
+ void set_handshake_timer();
+
+ // Underlying socket.
+ fd_t s;
+
+ // True iff this is server's engine.
+ bool as_server;
+
+ msg_t tx_msg;
+
+ handle_t handle;
+
+ unsigned char *inpos;
+ size_t insize;
+ i_decoder *decoder;
+
+ unsigned char *outpos;
+ size_t outsize;
+ i_encoder *encoder;
+
+ // Metadata to be attached to received messages. May be NULL.
+ metadata_t *metadata;
+
+ // When true, we are still trying to determine whether
+ // the peer is using versioned protocol, and if so, which
+ // version. When false, normal message flow has started.
+ bool handshaking;
+
+ static const size_t signature_size = 10;
+
+ // Size of ZMTP/1.0 and ZMTP/2.0 greeting message
+ static const size_t v2_greeting_size = 12;
+
+ // Size of ZMTP/3.0 greeting message
+ static const size_t v3_greeting_size = 64;
+
+ // Expected greeting size.
+ size_t greeting_size;
+
+ // Greeting received from, and sent to peer
+ unsigned char greeting_recv [v3_greeting_size];
+ unsigned char greeting_send [v3_greeting_size];
+
+ // Size of greeting received so far
+ unsigned int greeting_bytes_read;
+
+ // The session this engine is attached to.
+ zmq::session_base_t *session;
+
+ options_t options;
+
+ // String representation of endpoint
+ std::string endpoint;
+
+ bool plugged;
+
+ int (stream_engine_t::*next_msg) (msg_t *msg_);
+
+ int (stream_engine_t::*process_msg) (msg_t *msg_);
+
+ bool io_error;
+
+ // Indicates whether the engine is to inject a phantom
+ // subscription message into the incoming stream.
+ // Needed to support old peers.
+ bool subscription_required;
+
+ mechanism_t *mechanism;
+
+ // True iff the engine couldn't consume the last decoded message.
+ bool input_stopped;
+
+ // True iff the engine doesn't have any message to encode.
+ bool output_stopped;
+
+ // ID of the handshake timer
+ enum {handshake_timer_id = 0x40};
+
+ // True is linger timer is running.
+ bool has_handshake_timer;
+
+ // Socket
+ zmq::socket_base_t *socket;
+
+ std::string peer_address;
+
+ stream_engine_t (const stream_engine_t&);
+ const stream_engine_t &operator = (const stream_engine_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/sub.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/sub.cpp
new file mode 100644
index 00000000..831230ad
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/sub.cpp
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "sub.hpp"
+#include "msg.hpp"
+
+zmq::sub_t::sub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ xsub_t (parent_, tid_, sid_)
+{
+ options.type = ZMQ_SUB;
+
+ // Switch filtering messages on (as opposed to XSUB which where the
+ // filtering is off).
+ options.filter = true;
+}
+
+zmq::sub_t::~sub_t ()
+{
+}
+
+int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
+ size_t optvallen_)
+{
+ if (option_ != ZMQ_SUBSCRIBE && option_ != ZMQ_UNSUBSCRIBE) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ // Create the subscription message.
+ msg_t msg;
+ int rc = msg.init_size (optvallen_ + 1);
+ errno_assert (rc == 0);
+ unsigned char *data = (unsigned char*) msg.data ();
+ if (option_ == ZMQ_SUBSCRIBE)
+ *data = 1;
+ else
+ if (option_ == ZMQ_UNSUBSCRIBE)
+ *data = 0;
+ memcpy (data + 1, optval_, optvallen_);
+
+ // Pass it further on in the stack.
+ int err = 0;
+ rc = xsub_t::xsend (&msg);
+ if (rc != 0)
+ err = errno;
+ int rc2 = msg.close ();
+ errno_assert (rc2 == 0);
+ if (rc != 0)
+ errno = err;
+ return rc;
+}
+
+int zmq::sub_t::xsend (msg_t *)
+{
+ // Override the XSUB's send.
+ errno = ENOTSUP;
+ return -1;
+}
+
+bool zmq::sub_t::xhas_out ()
+{
+ // Override the XSUB's send.
+ return false;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/sub.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/sub.hpp
new file mode 100644
index 00000000..1615effa
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/sub.hpp
@@ -0,0 +1,64 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_SUB_HPP_INCLUDED__
+#define __ZMQ_SUB_HPP_INCLUDED__
+
+#include "xsub.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class msg_t;
+ class io_thread_t;
+ class socket_base_t;
+
+ class sub_t : public xsub_t
+ {
+ public:
+
+ sub_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ ~sub_t ();
+
+ protected:
+
+ int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
+ int xsend (zmq::msg_t *msg_);
+ bool xhas_out ();
+
+ private:
+
+ sub_t (const sub_t&);
+ const sub_t &operator = (const sub_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp.cpp
new file mode 100644
index 00000000..21814104
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp.cpp
@@ -0,0 +1,254 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "ip.hpp"
+#include "tcp.hpp"
+#include "err.hpp"
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#endif
+
+#if defined ZMQ_HAVE_OPENVMS
+#include <ioctl.h>
+#endif
+
+void zmq::tune_tcp_socket (fd_t s_)
+{
+ // Disable Nagle's algorithm. We are doing data batching on 0MQ level,
+ // so using Nagle wouldn't improve throughput in anyway, but it would
+ // hurt latency.
+ int nodelay = 1;
+ int rc = setsockopt (s_, IPPROTO_TCP, TCP_NODELAY, (char*) &nodelay,
+ sizeof (int));
+#ifdef ZMQ_HAVE_WINDOWS
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ errno_assert (rc == 0);
+#endif
+
+#ifdef ZMQ_HAVE_OPENVMS
+ // Disable delayed acknowledgements as they hurt latency is serious manner.
+ int nodelack = 1;
+ rc = setsockopt (s_, IPPROTO_TCP, TCP_NODELACK, (char*) &nodelack,
+ sizeof (int));
+ errno_assert (rc != SOCKET_ERROR);
+#endif
+}
+
+void zmq::set_tcp_send_buffer (fd_t sockfd_, int bufsize_)
+{
+ const int rc = setsockopt (sockfd_, SOL_SOCKET, SO_SNDBUF,
+ (char*) &bufsize_, sizeof bufsize_);
+#ifdef ZMQ_HAVE_WINDOWS
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ errno_assert (rc == 0);
+#endif
+}
+
+void zmq::set_tcp_receive_buffer (fd_t sockfd_, int bufsize_)
+{
+ const int rc = setsockopt (sockfd_, SOL_SOCKET, SO_RCVBUF,
+ (char*) &bufsize_, sizeof bufsize_);
+#ifdef ZMQ_HAVE_WINDOWS
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ errno_assert (rc == 0);
+#endif
+}
+
+void zmq::tune_tcp_keepalives (fd_t s_, int keepalive_, int keepalive_cnt_, int keepalive_idle_, int keepalive_intvl_)
+{
+ // These options are used only under certain #ifdefs below.
+ (void)keepalive_;
+ (void)keepalive_cnt_;
+ (void)keepalive_idle_;
+ (void)keepalive_intvl_;
+
+ // If none of the #ifdefs apply, then s_ is unused.
+ (void)s_;
+
+ // Tuning TCP keep-alives if platform allows it
+ // All values = -1 means skip and leave it for OS
+#ifdef ZMQ_HAVE_WINDOWS
+ if (keepalive_ != -1) {
+ tcp_keepalive keepalive_opts;
+ keepalive_opts.onoff = keepalive_;
+ keepalive_opts.keepalivetime = keepalive_idle_ != -1 ? keepalive_idle_ * 1000 : 7200000;
+ keepalive_opts.keepaliveinterval = keepalive_intvl_ != -1 ? keepalive_intvl_ * 1000 : 1000;
+ DWORD num_bytes_returned;
+ int rc = WSAIoctl(s_, SIO_KEEPALIVE_VALS, &keepalive_opts, sizeof(keepalive_opts), NULL, 0, &num_bytes_returned, NULL, NULL);
+ wsa_assert (rc != SOCKET_ERROR);
+ }
+#else
+#ifdef ZMQ_HAVE_SO_KEEPALIVE
+ if (keepalive_ != -1) {
+ int rc = setsockopt (s_, SOL_SOCKET, SO_KEEPALIVE, (char*) &keepalive_, sizeof (int));
+ errno_assert (rc == 0);
+
+#ifdef ZMQ_HAVE_TCP_KEEPCNT
+ if (keepalive_cnt_ != -1) {
+ int rc = setsockopt (s_, IPPROTO_TCP, TCP_KEEPCNT, &keepalive_cnt_, sizeof (int));
+ errno_assert (rc == 0);
+ }
+#endif // ZMQ_HAVE_TCP_KEEPCNT
+
+#ifdef ZMQ_HAVE_TCP_KEEPIDLE
+ if (keepalive_idle_ != -1) {
+ int rc = setsockopt (s_, IPPROTO_TCP, TCP_KEEPIDLE, &keepalive_idle_, sizeof (int));
+ errno_assert (rc == 0);
+ }
+#else // ZMQ_HAVE_TCP_KEEPIDLE
+#ifdef ZMQ_HAVE_TCP_KEEPALIVE
+ if (keepalive_idle_ != -1) {
+ int rc = setsockopt (s_, IPPROTO_TCP, TCP_KEEPALIVE, &keepalive_idle_, sizeof (int));
+ errno_assert (rc == 0);
+ }
+#endif // ZMQ_HAVE_TCP_KEEPALIVE
+#endif // ZMQ_HAVE_TCP_KEEPIDLE
+
+#ifdef ZMQ_HAVE_TCP_KEEPINTVL
+ if (keepalive_intvl_ != -1) {
+ int rc = setsockopt (s_, IPPROTO_TCP, TCP_KEEPINTVL, &keepalive_intvl_, sizeof (int));
+ errno_assert (rc == 0);
+ }
+#endif // ZMQ_HAVE_TCP_KEEPINTVL
+ }
+#endif // ZMQ_HAVE_SO_KEEPALIVE
+#endif // ZMQ_HAVE_WINDOWS
+}
+
+int zmq::tcp_write (fd_t s_, const void *data_, size_t size_)
+{
+#ifdef ZMQ_HAVE_WINDOWS
+
+ int nbytes = send (s_, (char*) data_, (int) size_, 0);
+
+ // If not a single byte can be written to the socket in non-blocking mode
+ // we'll get an error (this may happen during the speculative write).
+ if (nbytes == SOCKET_ERROR && WSAGetLastError () == WSAEWOULDBLOCK)
+ return 0;
+
+ // Signalise peer failure.
+ if (nbytes == SOCKET_ERROR && (
+ WSAGetLastError () == WSAENETDOWN ||
+ WSAGetLastError () == WSAENETRESET ||
+ WSAGetLastError () == WSAEHOSTUNREACH ||
+ WSAGetLastError () == WSAECONNABORTED ||
+ WSAGetLastError () == WSAETIMEDOUT ||
+ WSAGetLastError () == WSAECONNRESET))
+ return -1;
+
+ wsa_assert (nbytes != SOCKET_ERROR);
+ return nbytes;
+
+#else
+ ssize_t nbytes = send (s_, data_, size_, 0);
+
+ // Several errors are OK. When speculative write is being done we may not
+ // be able to write a single byte from the socket. Also, SIGSTOP issued
+ // by a debugging tool can result in EINTR error.
+ if (nbytes == -1 && (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINTR))
+ return 0;
+
+ // Signalise peer failure.
+ if (nbytes == -1) {
+ errno_assert (errno != EACCES
+ && errno != EBADF
+ && errno != EDESTADDRREQ
+ && errno != EFAULT
+ && errno != EINVAL
+ && errno != EISCONN
+ && errno != EMSGSIZE
+ && errno != ENOMEM
+ && errno != ENOTSOCK
+ && errno != EOPNOTSUPP);
+ return -1;
+ }
+
+ return static_cast <int> (nbytes);
+
+#endif
+}
+
+int zmq::tcp_read (fd_t s_, void *data_, size_t size_)
+{
+#ifdef ZMQ_HAVE_WINDOWS
+
+ const int rc = recv (s_, (char*) data_, (int) size_, 0);
+
+ // If not a single byte can be read from the socket in non-blocking mode
+ // we'll get an error (this may happen during the speculative read).
+ if (rc == SOCKET_ERROR) {
+ if (WSAGetLastError () == WSAEWOULDBLOCK)
+ errno = EAGAIN;
+ else {
+ wsa_assert (WSAGetLastError () == WSAENETDOWN
+ || WSAGetLastError () == WSAENETRESET
+ || WSAGetLastError () == WSAECONNABORTED
+ || WSAGetLastError () == WSAETIMEDOUT
+ || WSAGetLastError () == WSAECONNRESET
+ || WSAGetLastError () == WSAECONNREFUSED
+ || WSAGetLastError () == WSAENOTCONN);
+ errno = wsa_error_to_errno (WSAGetLastError ());
+ }
+ }
+
+ return rc == SOCKET_ERROR? -1: rc;
+
+#else
+
+ const ssize_t rc = recv (s_, data_, size_, 0);
+
+ // Several errors are OK. When speculative read is being done we may not
+ // be able to read a single byte from the socket. Also, SIGSTOP issued
+ // by a debugging tool can result in EINTR error.
+ if (rc == -1) {
+ errno_assert (errno != EBADF
+ && errno != EFAULT
+ && errno != EINVAL
+ && errno != ENOMEM
+ && errno != ENOTSOCK);
+ if (errno == EWOULDBLOCK || errno == EINTR)
+ errno = EAGAIN;
+ }
+
+ return static_cast <int> (rc);
+
+#endif
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp.hpp
new file mode 100644
index 00000000..130b4c89
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp.hpp
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_TCP_HPP_INCLUDED__
+#define __ZMQ_TCP_HPP_INCLUDED__
+
+#include "fd.hpp"
+
+namespace zmq
+{
+
+ // Tunes the supplied TCP socket for the best latency.
+ void tune_tcp_socket (fd_t s_);
+
+ // Sets the socket send buffer size.
+ void set_tcp_send_buffer (fd_t sockfd_, int bufsize_);
+
+ // Sets the socket receive buffer size.
+ void set_tcp_receive_buffer (fd_t sockfd_, int bufsize_);
+
+ // Tunes TCP keep-alives
+ void tune_tcp_keepalives (fd_t s_, int keepalive_, int keepalive_cnt_, int keepalive_idle_, int keepalive_intvl_);
+
+ // Writes data to the socket. Returns the number of bytes actually
+ // written (even zero is to be considered to be a success). In case
+ // of error or orderly shutdown by the other peer -1 is returned.
+ int tcp_write (fd_t s_, const void *data_, size_t size_);
+
+ // Reads data from the socket (up to 'size' bytes).
+ // Returns the number of bytes actually read or -1 on error.
+ // Zero indicates the peer has closed the connection.
+ int tcp_read (fd_t s_, void *data_, size_t size_);
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_address.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_address.cpp
new file mode 100644
index 00000000..c8689322
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_address.cpp
@@ -0,0 +1,672 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <string>
+#include <sstream>
+
+#include "tcp_address.hpp"
+#include "platform.hpp"
+#include "stdint.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <netinet/tcp.h>
+#include <netdb.h>
+#endif
+
+#ifdef ZMQ_HAVE_SOLARIS
+
+#include <sys/sockio.h>
+#include <net/if.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+// On Solaris platform, network interface name can be queried by ioctl.
+int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_src_)
+{
+ // TODO: Unused parameter, IPv6 support not implemented for Solaris.
+ (void) ipv6_;
+
+ // Create a socket.
+ const int fd = open_socket (AF_INET, SOCK_DGRAM, 0);
+ errno_assert (fd != -1);
+
+ // Retrieve number of interfaces.
+ lifnum ifn;
+ ifn.lifn_family = AF_INET;
+ ifn.lifn_flags = 0;
+ int rc = ioctl (fd, SIOCGLIFNUM, (char*) &ifn);
+ errno_assert (rc != -1);
+
+ // Allocate memory to get interface names.
+ const size_t ifr_size = sizeof (struct lifreq) * ifn.lifn_count;
+ char *ifr = (char*) malloc (ifr_size);
+ alloc_assert (ifr);
+
+ // Retrieve interface names.
+ lifconf ifc;
+ ifc.lifc_family = AF_INET;
+ ifc.lifc_flags = 0;
+ ifc.lifc_len = ifr_size;
+ ifc.lifc_buf = ifr;
+ rc = ioctl (fd, SIOCGLIFCONF, (char*) &ifc);
+ errno_assert (rc != -1);
+
+ // Find the interface with the specified name and AF_INET family.
+ bool found = false;
+ lifreq *ifrp = ifc.lifc_req;
+ for (int n = 0; n < (int) (ifc.lifc_len / sizeof lifreq);
+ n ++, ifrp ++) {
+ if (!strcmp (nic_, ifrp->lifr_name)) {
+ rc = ioctl (fd, SIOCGLIFADDR, (char*) ifrp);
+ errno_assert (rc != -1);
+ if (ifrp->lifr_addr.ss_family == AF_INET) {
+ if (is_src_)
+ source_address.ipv4 = *(sockaddr_in*) &ifrp->lifr_addr;
+ else
+ address.ipv4 = *(sockaddr_in*) &ifrp->lifr_addr;
+ found = true;
+ break;
+ }
+ }
+ }
+
+ // Clean-up.
+ free (ifr);
+ close (fd);
+
+ if (!found) {
+ errno = ENODEV;
+ return -1;
+ }
+ return 0;
+}
+
+#elif defined ZMQ_HAVE_AIX || defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_ANDROID
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+
+int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_src_)
+{
+ // TODO: Unused parameter, IPv6 support not implemented for AIX or HP/UX.
+ (void) ipv6_;
+
+ // Create a socket.
+ const int sd = open_socket (AF_INET, SOCK_DGRAM, 0);
+ errno_assert (sd != -1);
+
+ struct ifreq ifr;
+
+ // Copy interface name for ioctl get.
+ strncpy (ifr.ifr_name, nic_, sizeof ifr.ifr_name);
+
+ // Fetch interface address.
+ const int rc = ioctl (sd, SIOCGIFADDR, (caddr_t) &ifr, sizeof ifr);
+
+ // Clean up.
+ close (sd);
+
+ if (rc == -1) {
+ errno = ENODEV;
+ return -1;
+ }
+ if (is_src_)
+ memcpy (&source_address.ipv4.sin_addr,
+ &((sockaddr_in*) &ifr.ifr_addr)->sin_addr, sizeof (struct in_addr));
+ else
+ memcpy (&address.ipv4.sin_addr,
+ &((sockaddr_in*) &ifr.ifr_addr)->sin_addr, sizeof (struct in_addr));
+
+ return 0;
+}
+
+#elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
+ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\
+ defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD)\
+ && defined ZMQ_HAVE_IFADDRS)
+
+#include <ifaddrs.h>
+
+// On these platforms, network interface name can be queried
+// using getifaddrs function.
+int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_src_)
+{
+ // Get the addresses.
+ ifaddrs *ifa = NULL;
+ const int rc = getifaddrs (&ifa);
+ errno_assert (rc == 0);
+ zmq_assert (ifa != NULL);
+
+ // Find the corresponding network interface.
+ bool found = false;
+ for (ifaddrs *ifp = ifa; ifp != NULL; ifp = ifp->ifa_next) {
+ if (ifp->ifa_addr == NULL)
+ continue;
+
+ const int family = ifp->ifa_addr->sa_family;
+ if ((family == AF_INET || (ipv6_ && family == AF_INET6))
+ && !strcmp (nic_, ifp->ifa_name)) {
+ if (is_src_)
+ memcpy (&source_address, ifp->ifa_addr,
+ (family == AF_INET) ? sizeof (struct sockaddr_in)
+ : sizeof (struct sockaddr_in6));
+ else
+ memcpy (&address, ifp->ifa_addr,
+ (family == AF_INET) ? sizeof (struct sockaddr_in)
+ : sizeof (struct sockaddr_in6));
+ found = true;
+ break;
+ }
+ }
+
+ // Clean-up;
+ freeifaddrs (ifa);
+
+ if (!found) {
+ errno = ENODEV;
+ return -1;
+ }
+ return 0;
+}
+
+#else
+
+// On other platforms we assume there are no sane interface names.
+// This is true especially of Windows.
+int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_src_)
+{
+ // All unused parameters.
+ (void) nic_;
+ (void) ipv6_;
+
+ errno = ENODEV;
+ return -1;
+}
+
+#endif
+
+int zmq::tcp_address_t::resolve_interface (const char *interface_, bool ipv6_, bool is_src_)
+{
+ // Initialize temporary output pointers with storage address.
+ sockaddr_storage ss;
+ sockaddr *out_addr = (sockaddr*) &ss;
+ size_t out_addrlen;
+
+ // Initialise IP-format family/port and populate temporary output pointers
+ // with the address.
+ if (ipv6_) {
+ sockaddr_in6 ip6_addr;
+ memset (&ip6_addr, 0, sizeof ip6_addr);
+ ip6_addr.sin6_family = AF_INET6;
+ memcpy (&ip6_addr.sin6_addr, &in6addr_any, sizeof in6addr_any);
+ out_addrlen = sizeof ip6_addr;
+ memcpy (out_addr, &ip6_addr, out_addrlen);
+ }
+ else {
+ sockaddr_in ip4_addr;
+ memset (&ip4_addr, 0, sizeof ip4_addr);
+ ip4_addr.sin_family = AF_INET;
+ ip4_addr.sin_addr.s_addr = htonl (INADDR_ANY);
+ out_addrlen = sizeof ip4_addr;
+ memcpy (out_addr, &ip4_addr, out_addrlen);
+ }
+ // "*" resolves to INADDR_ANY or in6addr_any.
+ if (strcmp (interface_, "*") == 0) {
+ zmq_assert (out_addrlen <= sizeof address);
+ if (is_src_)
+ memcpy (&source_address, out_addr, out_addrlen);
+ else
+ memcpy (&address, out_addr, out_addrlen);
+ return 0;
+ }
+
+ // Try to resolve the string as a NIC name.
+ int rc = resolve_nic_name (interface_, ipv6_, is_src_);
+ if (rc == 0 || errno != ENODEV)
+ return rc;
+
+ // There's no such interface name. Assume literal address.
+#if defined ZMQ_HAVE_OPENVMS && defined __ia64
+ __addrinfo64 *res = NULL;
+ __addrinfo64 req;
+#else
+ addrinfo *res = NULL;
+ addrinfo req;
+#endif
+ memset (&req, 0, sizeof req);
+
+ // Choose IPv4 or IPv6 protocol family. Note that IPv6 allows for
+ // IPv4-in-IPv6 addresses.
+ req.ai_family = ipv6_? AF_INET6: AF_INET;
+
+ // Arbitrary, not used in the output, but avoids duplicate results.
+ req.ai_socktype = SOCK_STREAM;
+
+ // Restrict hostname/service to literals to avoid any DNS lookups or
+ // service-name irregularity due to indeterminate socktype.
+ req.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
+
+#if defined AI_V4MAPPED && !defined ZMQ_HAVE_FREEBSD
+ // In this API we only require IPv4-mapped addresses when
+ // no native IPv6 interfaces are available (~AI_ALL).
+ // This saves an additional DNS roundtrip for IPv4 addresses.
+ // Note: While the AI_V4MAPPED flag is defined on FreeBSD system,
+ // it is not supported here. See libzmq issue #331.
+ if (req.ai_family == AF_INET6)
+ req.ai_flags |= AI_V4MAPPED;
+#endif
+
+ // Resolve the literal address. Some of the error info is lost in case
+ // of error, however, there's no way to report EAI errors via errno.
+ rc = getaddrinfo (interface_, NULL, &req, &res);
+ if (rc) {
+ errno = ENODEV;
+ return -1;
+ }
+
+ // Use the first result.
+ zmq_assert (res != NULL);
+ zmq_assert ((size_t) res->ai_addrlen <= sizeof address);
+ if (is_src_)
+ memcpy (&source_address, res->ai_addr, res->ai_addrlen);
+ else
+ memcpy (&address, res->ai_addr, res->ai_addrlen);
+
+ // Cleanup getaddrinfo after copying the possibly referenced result.
+ freeaddrinfo (res);
+
+ return 0;
+}
+
+int zmq::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv6_, bool is_src_)
+{
+ // Set up the query.
+#if defined ZMQ_HAVE_OPENVMS && defined __ia64 && __INITIAL_POINTER_SIZE == 64
+ __addrinfo64 req;
+#else
+ addrinfo req;
+#endif
+ memset (&req, 0, sizeof req);
+
+ // Choose IPv4 or IPv6 protocol family. Note that IPv6 allows for
+ // IPv4-in-IPv6 addresses.
+ req.ai_family = ipv6_? AF_INET6: AF_INET;
+
+ // Need to choose one to avoid duplicate results from getaddrinfo() - this
+ // doesn't really matter, since it's not included in the addr-output.
+ req.ai_socktype = SOCK_STREAM;
+
+#if defined AI_V4MAPPED && !defined ZMQ_HAVE_FREEBSD
+ // In this API we only require IPv4-mapped addresses when
+ // no native IPv6 interfaces are available.
+ // This saves an additional DNS roundtrip for IPv4 addresses.
+ // Note: While the AI_V4MAPPED flag is defined on FreeBSD system,
+ // it is not supported here. See libzmq issue #331.
+ if (req.ai_family == AF_INET6)
+ req.ai_flags |= AI_V4MAPPED;
+#endif
+
+ // Resolve host name. Some of the error info is lost in case of error,
+ // however, there's no way to report EAI errors via errno.
+#if defined ZMQ_HAVE_OPENVMS && defined __ia64 && __INITIAL_POINTER_SIZE == 64
+ __addrinfo64 *res;
+#else
+ addrinfo *res;
+#endif
+ const int rc = getaddrinfo (hostname_, NULL, &req, &res);
+ if (rc) {
+ switch (rc) {
+ case EAI_MEMORY:
+ errno = ENOMEM;
+ break;
+ default:
+ errno = EINVAL;
+ break;
+ }
+ return -1;
+ }
+
+ // Copy first result to output addr with hostname and service.
+ zmq_assert ((size_t) res->ai_addrlen <= sizeof address);
+ if (is_src_)
+ memcpy (&source_address, res->ai_addr, res->ai_addrlen);
+ else
+ memcpy (&address, res->ai_addr, res->ai_addrlen);
+
+ freeaddrinfo (res);
+
+ return 0;
+}
+
+zmq::tcp_address_t::tcp_address_t () :
+ _has_src_addr (false)
+{
+ memset (&address, 0, sizeof address);
+ memset (&source_address, 0, sizeof source_address);
+}
+
+zmq::tcp_address_t::tcp_address_t (const sockaddr *sa, socklen_t sa_len) :
+ _has_src_addr (false)
+{
+ zmq_assert (sa && sa_len > 0);
+
+ memset (&address, 0, sizeof address);
+ memset (&source_address, 0, sizeof source_address);
+ if (sa->sa_family == AF_INET && sa_len >= (socklen_t) sizeof address.ipv4)
+ memcpy (&address.ipv4, sa, sizeof address.ipv4);
+ else
+ if (sa->sa_family == AF_INET6 && sa_len >= (socklen_t) sizeof address.ipv6)
+ memcpy (&address.ipv6, sa, sizeof address.ipv6);
+}
+
+zmq::tcp_address_t::~tcp_address_t ()
+{
+}
+
+int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv6_, bool is_src_)
+{
+ if (!is_src_) {
+ // Test the ';' to know if we have a source address in name_
+ const char *src_delimiter = strrchr (name_, ';');
+ if (src_delimiter) {
+ std::string src_name (name_, src_delimiter - name_);
+ const int rc = resolve (src_name.c_str (), local_, ipv6_, true);
+ if (rc != 0)
+ return -1;
+ name_ = src_delimiter + 1;
+ _has_src_addr = true;
+ }
+ }
+
+ // Find the ':' at end that separates address from the port number.
+ const char *delimiter = strrchr (name_, ':');
+ if (!delimiter) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ // Separate the address/port.
+ std::string addr_str (name_, delimiter - name_);
+ std::string port_str (delimiter + 1);
+
+ // Remove square brackets around the address, if any, as used in IPv6
+ if (addr_str.size () >= 2 && addr_str [0] == '[' &&
+ addr_str [addr_str.size () - 1] == ']')
+ addr_str = addr_str.substr (1, addr_str.size () - 2);
+
+ // Allow 0 specifically, to detect invalid port error in atoi if not
+ uint16_t port;
+ if (port_str == "*" || port_str == "0")
+ // Resolve wildcard to 0 to allow autoselection of port
+ port = 0;
+ else {
+ // Parse the port number (0 is not a valid port).
+ port = (uint16_t) atoi (port_str.c_str ());
+ if (port == 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ }
+
+ // Resolve the IP address.
+ int rc;
+ if (local_)
+ rc = resolve_interface (addr_str.c_str (), ipv6_, is_src_);
+ else
+ rc = resolve_hostname (addr_str.c_str (), ipv6_, is_src_);
+ if (rc != 0)
+ return -1;
+
+ // Set the port into the address structure.
+ if (is_src_) {
+ if (source_address.generic.sa_family == AF_INET6)
+ source_address.ipv6.sin6_port = htons (port);
+ else
+ source_address.ipv4.sin_port = htons (port);
+ }
+ else {
+ if (address.generic.sa_family == AF_INET6)
+ address.ipv6.sin6_port = htons (port);
+ else
+ address.ipv4.sin_port = htons (port);
+ }
+
+ return 0;
+}
+
+int zmq::tcp_address_t::to_string (std::string &addr_)
+{
+ if (address.generic.sa_family != AF_INET
+ && address.generic.sa_family != AF_INET6) {
+ addr_.clear ();
+ return -1;
+ }
+
+ // Not using service resolv because of
+ // https://github.com/zeromq/libzmq/commit/1824574f9b5a8ce786853320e3ea09fe1f822bc4
+ char hbuf [NI_MAXHOST];
+ int rc = getnameinfo (addr (), addrlen (), hbuf, sizeof hbuf, NULL, 0, NI_NUMERICHOST);
+ if (rc != 0) {
+ addr_.clear ();
+ return rc;
+ }
+
+ if (address.generic.sa_family == AF_INET6) {
+ std::stringstream s;
+ s << "tcp://[" << hbuf << "]:" << ntohs (address.ipv6.sin6_port);
+ addr_ = s.str ();
+ }
+ else {
+ std::stringstream s;
+ s << "tcp://" << hbuf << ":" << ntohs (address.ipv4.sin_port);
+ addr_ = s.str ();
+ }
+ return 0;
+}
+
+const sockaddr *zmq::tcp_address_t::addr () const
+{
+ return &address.generic;
+}
+
+socklen_t zmq::tcp_address_t::addrlen () const
+{
+ if (address.generic.sa_family == AF_INET6)
+ return (socklen_t) sizeof address.ipv6;
+ else
+ return (socklen_t) sizeof address.ipv4;
+}
+
+const sockaddr *zmq::tcp_address_t::src_addr () const
+{
+ return &source_address.generic;
+}
+
+socklen_t zmq::tcp_address_t::src_addrlen () const
+{
+ if (address.generic.sa_family == AF_INET6)
+ return (socklen_t) sizeof source_address.ipv6;
+ else
+ return (socklen_t) sizeof source_address.ipv4;
+}
+
+bool zmq::tcp_address_t::has_src_addr () const
+{
+ return _has_src_addr;
+}
+
+#if defined ZMQ_HAVE_WINDOWS
+unsigned short zmq::tcp_address_t::family () const
+#else
+sa_family_t zmq::tcp_address_t::family () const
+#endif
+{
+ return address.generic.sa_family;
+}
+
+zmq::tcp_address_mask_t::tcp_address_mask_t () :
+ tcp_address_t (),
+ address_mask (-1)
+{
+}
+
+int zmq::tcp_address_mask_t::mask () const
+{
+ return address_mask;
+}
+
+int zmq::tcp_address_mask_t::resolve (const char *name_, bool ipv6_)
+{
+ // Find '/' at the end that separates address from the cidr mask number.
+ // Allow empty mask clause and treat it like '/32' for ipv4 or '/128' for ipv6.
+ std::string addr_str, mask_str;
+ const char *delimiter = strrchr (name_, '/');
+ if (delimiter != NULL) {
+ addr_str.assign (name_, delimiter - name_);
+ mask_str.assign (delimiter + 1);
+ if (mask_str.empty ()) {
+ errno = EINVAL;
+ return -1;
+ }
+ }
+ else
+ addr_str.assign (name_);
+
+ // Parse address part using standard routines.
+ const int rc =
+ tcp_address_t::resolve_hostname (addr_str.c_str (), ipv6_);
+ if (rc != 0)
+ return rc;
+
+ // Parse the cidr mask number.
+ if (mask_str.empty ()) {
+ if (address.generic.sa_family == AF_INET6)
+ address_mask = 128;
+ else
+ address_mask = 32;
+ }
+ else
+ if (mask_str == "0")
+ address_mask = 0;
+ else {
+ const int mask = atoi (mask_str.c_str ());
+ if (
+ (mask < 1) ||
+ (address.generic.sa_family == AF_INET6 && mask > 128) ||
+ (address.generic.sa_family != AF_INET6 && mask > 32)
+ ) {
+ errno = EINVAL;
+ return -1;
+ }
+ address_mask = mask;
+ }
+
+ return 0;
+}
+
+int zmq::tcp_address_mask_t::to_string (std::string &addr_)
+{
+ if (address.generic.sa_family != AF_INET
+ && address.generic.sa_family != AF_INET6) {
+ addr_.clear ();
+ return -1;
+ }
+ if (address_mask == -1) {
+ addr_.clear ();
+ return -1;
+ }
+
+ char hbuf [NI_MAXHOST];
+ int rc = getnameinfo (addr (), addrlen (), hbuf, sizeof hbuf, NULL, 0, NI_NUMERICHOST);
+ if (rc != 0) {
+ addr_.clear ();
+ return rc;
+ }
+
+ if (address.generic.sa_family == AF_INET6) {
+ std::stringstream s;
+ s << "[" << hbuf << "]/" << address_mask;
+ addr_ = s.str ();
+ }
+ else {
+ std::stringstream s;
+ s << hbuf << "/" << address_mask;
+ addr_ = s.str ();
+ }
+ return 0;
+}
+
+bool zmq::tcp_address_mask_t::match_address (const struct sockaddr *ss, const socklen_t ss_len) const
+{
+ zmq_assert (address_mask != -1
+ && ss != NULL
+ && ss_len >= (socklen_t) sizeof (struct sockaddr));
+
+ if (ss->sa_family != address.generic.sa_family)
+ return false;
+
+ if (address_mask > 0) {
+ int mask;
+ const uint8_t *our_bytes, *their_bytes;
+ if (ss->sa_family == AF_INET6) {
+ zmq_assert (ss_len == sizeof (struct sockaddr_in6));
+ their_bytes = (const uint8_t *) &(((const struct sockaddr_in6 *) ss)->sin6_addr);
+ our_bytes = (const uint8_t *) &address.ipv6.sin6_addr;
+ mask = sizeof (struct in6_addr) * 8;
+ }
+ else {
+ zmq_assert (ss_len == sizeof (struct sockaddr_in));
+ their_bytes = (const uint8_t *) &(((const struct sockaddr_in *) ss)->sin_addr);
+ our_bytes = (const uint8_t *) &address.ipv4.sin_addr;
+ mask = sizeof (struct in_addr) * 8;
+ }
+ if (address_mask < mask)
+ mask = address_mask;
+
+ const size_t full_bytes = mask / 8;
+ if (memcmp (our_bytes, their_bytes, full_bytes))
+ return false;
+
+ const uint8_t last_byte_bits = 0xffU << (8 - mask % 8);
+ if (last_byte_bits) {
+ if ((their_bytes [full_bytes] & last_byte_bits) != (our_bytes [full_bytes] & last_byte_bits))
+ return false;
+ }
+ }
+
+ return true;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_address.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_address.hpp
new file mode 100644
index 00000000..31e8c2a5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_address.hpp
@@ -0,0 +1,116 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_TCP_ADDRESS_HPP_INCLUDED__
+#define __ZMQ_TCP_ADDRESS_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <sys/socket.h>
+#include <netinet/in.h>
+#endif
+
+namespace zmq
+{
+
+ class tcp_address_t
+ {
+ public:
+
+ tcp_address_t ();
+ tcp_address_t (const sockaddr *sa, socklen_t sa_len);
+ virtual ~tcp_address_t ();
+
+ // This function translates textual TCP address into an address
+ // strcuture. If 'local' is true, names are resolved as local interface
+ // names. If it is false, names are resolved as remote hostnames.
+ // If 'ipv6' is true, the name may resolve to IPv6 address.
+ int resolve (const char *name_, bool local_, bool ipv6_, bool is_src_ = false);
+
+ // The opposite to resolve()
+ virtual int to_string (std::string &addr_);
+
+#if defined ZMQ_HAVE_WINDOWS
+ unsigned short family () const;
+#else
+ sa_family_t family () const;
+#endif
+ const sockaddr *addr () const;
+ socklen_t addrlen () const;
+
+ const sockaddr *src_addr () const;
+ socklen_t src_addrlen () const;
+ bool has_src_addr () const;
+
+ protected:
+ int resolve_nic_name (const char *nic_, bool ipv6_, bool is_src_ = false);
+ int resolve_interface (const char *interface_, bool ipv6_, bool is_src_ = false);
+ int resolve_hostname (const char *hostname_, bool ipv6_, bool is_src_ = false);
+
+ union {
+ sockaddr generic;
+ sockaddr_in ipv4;
+ sockaddr_in6 ipv6;
+ } address;
+
+ union {
+ sockaddr generic;
+ sockaddr_in ipv4;
+ sockaddr_in6 ipv6;
+ } source_address;
+ bool _has_src_addr;
+ };
+
+ class tcp_address_mask_t : public tcp_address_t
+ {
+ public:
+ tcp_address_mask_t ();
+
+ // This function enhances tcp_address_t::resolve() with ability to parse
+ // additional cidr-like(/xx) mask value at the end of the name string.
+ // Works only with remote hostnames.
+ int resolve (const char *name_, bool ipv6_);
+
+ // The opposite to resolve()
+ int to_string (std::string &addr_);
+
+ int mask () const;
+
+ bool match_address (const struct sockaddr *ss, const socklen_t ss_len) const;
+
+ private:
+ int address_mask;
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_connecter.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_connecter.cpp
new file mode 100644
index 00000000..fdbc45c2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_connecter.cpp
@@ -0,0 +1,367 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <new>
+#include <string>
+
+#include "tcp_connecter.hpp"
+#include "stream_engine.hpp"
+#include "io_thread.hpp"
+#include "platform.hpp"
+#include "random.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+#include "tcp.hpp"
+#include "address.hpp"
+#include "tcp_address.hpp"
+#include "session_base.hpp"
+
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/tcp.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <fcntl.h>
+#ifdef ZMQ_HAVE_OPENVMS
+#include <ioctl.h>
+#endif
+#endif
+
+zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
+ class session_base_t *session_, const options_t &options_,
+ address_t *addr_, bool delayed_start_) :
+ own_t (io_thread_, options_),
+ io_object_t (io_thread_),
+ addr (addr_),
+ s (retired_fd),
+ handle_valid (false),
+ delayed_start (delayed_start_),
+ timer_started (false),
+ session (session_),
+ current_reconnect_ivl (options.reconnect_ivl)
+{
+ zmq_assert (addr);
+ zmq_assert (addr->protocol == "tcp");
+ addr->to_string (endpoint);
+ socket = session->get_socket ();
+}
+
+zmq::tcp_connecter_t::~tcp_connecter_t ()
+{
+ zmq_assert (!timer_started);
+ zmq_assert (!handle_valid);
+ zmq_assert (s == retired_fd);
+}
+
+void zmq::tcp_connecter_t::process_plug ()
+{
+ if (delayed_start)
+ add_reconnect_timer ();
+ else
+ start_connecting ();
+}
+
+void zmq::tcp_connecter_t::process_term (int linger_)
+{
+ if (timer_started) {
+ cancel_timer (reconnect_timer_id);
+ timer_started = false;
+ }
+
+ if (handle_valid) {
+ rm_fd (handle);
+ handle_valid = false;
+ }
+
+ if (s != retired_fd)
+ close ();
+
+ own_t::process_term (linger_);
+}
+
+void zmq::tcp_connecter_t::in_event ()
+{
+ // We are not polling for incoming data, so we are actually called
+ // because of error here. However, we can get error on out event as well
+ // on some platforms, so we'll simply handle both events in the same way.
+ out_event ();
+}
+
+void zmq::tcp_connecter_t::out_event ()
+{
+ rm_fd (handle);
+ handle_valid = false;
+
+ const fd_t fd = connect ();
+ // Handle the error condition by attempt to reconnect.
+ if (fd == retired_fd) {
+ close ();
+ add_reconnect_timer ();
+ return;
+ }
+
+ tune_tcp_socket (fd);
+ tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt, options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
+
+ // remember our fd for ZMQ_SRCFD in messages
+ socket->set_fd (fd);
+
+ // Create the engine object for this connection.
+ stream_engine_t *engine = new (std::nothrow)
+ stream_engine_t (fd, options, endpoint);
+ alloc_assert (engine);
+
+ // Attach the engine to the corresponding session object.
+ send_attach (session, engine);
+
+ // Shut the connecter down.
+ terminate ();
+
+ socket->event_connected (endpoint, fd);
+}
+
+void zmq::tcp_connecter_t::timer_event (int id_)
+{
+ zmq_assert (id_ == reconnect_timer_id);
+ timer_started = false;
+ start_connecting ();
+}
+
+void zmq::tcp_connecter_t::start_connecting ()
+{
+ // Open the connecting socket.
+ const int rc = open ();
+
+ // Connect may succeed in synchronous manner.
+ if (rc == 0) {
+ handle = add_fd (s);
+ handle_valid = true;
+ out_event ();
+ }
+
+ // Connection establishment may be delayed. Poll for its completion.
+ else
+ if (rc == -1 && errno == EINPROGRESS) {
+ handle = add_fd (s);
+ handle_valid = true;
+ set_pollout (handle);
+ socket->event_connect_delayed (endpoint, zmq_errno());
+ }
+
+ // Handle any other error condition by eventual reconnect.
+ else {
+ if (s != retired_fd)
+ close ();
+ add_reconnect_timer ();
+ }
+}
+
+void zmq::tcp_connecter_t::add_reconnect_timer ()
+{
+ const int interval = get_new_reconnect_ivl ();
+ add_timer (interval, reconnect_timer_id);
+ socket->event_connect_retried (endpoint, interval);
+ timer_started = true;
+}
+
+int zmq::tcp_connecter_t::get_new_reconnect_ivl ()
+{
+ // The new interval is the current interval + random value.
+ const int interval = current_reconnect_ivl +
+ generate_random () % options.reconnect_ivl;
+
+ // Only change the current reconnect interval if the maximum reconnect
+ // interval was set and if it's larger than the reconnect interval.
+ if (options.reconnect_ivl_max > 0 &&
+ options.reconnect_ivl_max > options.reconnect_ivl)
+ // Calculate the next interval
+ current_reconnect_ivl =
+ std::min (current_reconnect_ivl * 2, options.reconnect_ivl_max);
+ return interval;
+}
+
+int zmq::tcp_connecter_t::open ()
+{
+ zmq_assert (s == retired_fd);
+
+ // Resolve the address
+ if (addr->resolved.tcp_addr != NULL) {
+ delete addr->resolved.tcp_addr;
+ addr->resolved.tcp_addr = NULL;
+ }
+
+ addr->resolved.tcp_addr = new (std::nothrow) tcp_address_t ();
+ alloc_assert (addr->resolved.tcp_addr);
+ int rc = addr->resolved.tcp_addr->resolve (
+ addr->address.c_str (), false, options.ipv6);
+ if (rc != 0) {
+ delete addr->resolved.tcp_addr;
+ addr->resolved.tcp_addr = NULL;
+ return -1;
+ }
+ zmq_assert (addr->resolved.tcp_addr != NULL);
+ tcp_address_t * const tcp_addr = addr->resolved.tcp_addr;
+
+ // Create the socket.
+ s = open_socket (tcp_addr->family (), SOCK_STREAM, IPPROTO_TCP);
+#ifdef ZMQ_HAVE_WINDOWS
+ if (s == INVALID_SOCKET) {
+ errno = wsa_error_to_errno (WSAGetLastError ());
+ return -1;
+ }
+#else
+ if (s == -1)
+ return -1;
+#endif
+
+ // On some systems, IPv4 mapping in IPv6 sockets is disabled by default.
+ // Switch it on in such cases.
+ if (tcp_addr->family () == AF_INET6)
+ enable_ipv4_mapping (s);
+
+ // Set the IP Type-Of-Service priority for this socket
+ if (options.tos != 0)
+ set_ip_type_of_service (s, options.tos);
+
+ // Set the socket to non-blocking mode so that we get async connect().
+ unblock_socket (s);
+
+ // Set the socket buffer limits for the underlying socket.
+ if (options.sndbuf != 0)
+ set_tcp_send_buffer (s, options.sndbuf);
+ if (options.rcvbuf != 0)
+ set_tcp_receive_buffer (s, options.rcvbuf);
+
+ // Set the IP Type-Of-Service for the underlying socket
+ if (options.tos != 0)
+ set_ip_type_of_service (s, options.tos);
+
+ // Set a source address for conversations
+ if (tcp_addr->has_src_addr ()) {
+ rc = ::bind (s, tcp_addr->src_addr (), tcp_addr->src_addrlen ());
+ if (rc == -1)
+ return -1;
+ }
+
+ // Connect to the remote peer.
+ rc = ::connect (s, tcp_addr->addr (), tcp_addr->addrlen ());
+
+ // Connect was successfull immediately.
+ if (rc == 0)
+ return 0;
+
+ // Translate error codes indicating asynchronous connect has been
+ // launched to a uniform EINPROGRESS.
+#ifdef ZMQ_HAVE_WINDOWS
+ const int error_code = WSAGetLastError ();
+ if (error_code == WSAEINPROGRESS || error_code == WSAEWOULDBLOCK)
+ errno = EINPROGRESS;
+ else
+ errno = wsa_error_to_errno (error_code);
+#else
+ if (errno == EINTR)
+ errno = EINPROGRESS;
+#endif
+ return -1;
+}
+
+zmq::fd_t zmq::tcp_connecter_t::connect ()
+{
+ // Async connect has finished. Check whether an error occurred
+ int err = 0;
+#ifdef ZMQ_HAVE_HPUX
+ int len = sizeof err;
+#else
+ socklen_t len = sizeof err;
+#endif
+
+ const int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
+
+ // Assert if the error was caused by 0MQ bug.
+ // Networking problems are OK. No need to assert.
+#ifdef ZMQ_HAVE_WINDOWS
+ zmq_assert (rc == 0);
+ if (err != 0) {
+ if (err != WSAECONNREFUSED
+ && err != WSAETIMEDOUT
+ && err != WSAECONNABORTED
+ && err != WSAEHOSTUNREACH
+ && err != WSAENETUNREACH
+ && err != WSAENETDOWN
+ && err != WSAEACCES
+ && err != WSAEINVAL
+ && err != WSAEADDRINUSE)
+ {
+ wsa_assert_no (err);
+ }
+ return retired_fd;
+ }
+#else
+ // Following code should handle both Berkeley-derived socket
+ // implementations and Solaris.
+ if (rc == -1)
+ err = errno;
+ if (err != 0) {
+ errno = err;
+ errno_assert (
+ errno == ECONNREFUSED ||
+ errno == ECONNRESET ||
+ errno == ETIMEDOUT ||
+ errno == EHOSTUNREACH ||
+ errno == ENETUNREACH ||
+ errno == ENETDOWN ||
+ errno == EINVAL);
+ return retired_fd;
+ }
+#endif
+
+ // Return the newly connected socket.
+ const fd_t result = s;
+ s = retired_fd;
+ return result;
+}
+
+void zmq::tcp_connecter_t::close ()
+{
+ zmq_assert (s != retired_fd);
+#ifdef ZMQ_HAVE_WINDOWS
+ const int rc = closesocket (s);
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ const int rc = ::close (s);
+ errno_assert (rc == 0);
+#endif
+ socket->event_closed (endpoint, s);
+ s = retired_fd;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_connecter.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_connecter.hpp
new file mode 100644
index 00000000..340c7f56
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_connecter.hpp
@@ -0,0 +1,131 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __TCP_CONNECTER_HPP_INCLUDED__
+#define __TCP_CONNECTER_HPP_INCLUDED__
+
+#include "fd.hpp"
+#include "own.hpp"
+#include "stdint.hpp"
+#include "io_object.hpp"
+#include "../include/zmq.h"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class session_base_t;
+ struct address_t;
+
+ class tcp_connecter_t : public own_t, public io_object_t
+ {
+ public:
+
+ // If 'delayed_start' is true connecter first waits for a while,
+ // then starts connection process.
+ tcp_connecter_t (zmq::io_thread_t *io_thread_,
+ zmq::session_base_t *session_, const options_t &options_,
+ address_t *addr_, bool delayed_start_);
+ ~tcp_connecter_t ();
+
+ private:
+
+ // ID of the timer used to delay the reconnection.
+ enum {reconnect_timer_id = 1};
+
+ // Handlers for incoming commands.
+ void process_plug ();
+ void process_term (int linger_);
+
+ // Handlers for I/O events.
+ void in_event ();
+ void out_event ();
+ void timer_event (int id_);
+
+ // Internal function to start the actual connection establishment.
+ void start_connecting ();
+
+ // Internal function to add a reconnect timer
+ void add_reconnect_timer();
+
+ // Internal function to return a reconnect backoff delay.
+ // Will modify the current_reconnect_ivl used for next call
+ // Returns the currently used interval
+ int get_new_reconnect_ivl ();
+
+ // Open TCP connecting socket. Returns -1 in case of error,
+ // 0 if connect was successfull immediately. Returns -1 with
+ // EAGAIN errno if async connect was launched.
+ int open ();
+
+ // Close the connecting socket.
+ void close ();
+
+ // Get the file descriptor of newly created connection. Returns
+ // retired_fd if the connection was unsuccessfull.
+ fd_t connect ();
+
+ // Address to connect to. Owned by session_base_t.
+ address_t *addr;
+
+ // Underlying socket.
+ fd_t s;
+
+ // Handle corresponding to the listening socket.
+ handle_t handle;
+
+ // If true file descriptor is registered with the poller and 'handle'
+ // contains valid value.
+ bool handle_valid;
+
+ // If true, connecter is waiting a while before trying to connect.
+ const bool delayed_start;
+
+ // True iff a timer has been started.
+ bool timer_started;
+
+ // Reference to the session we belong to.
+ zmq::session_base_t *session;
+
+ // Current reconnect ivl, updated for backoff strategy
+ int current_reconnect_ivl;
+
+ // String representation of endpoint to connect to
+ std::string endpoint;
+
+ // Socket
+ zmq::socket_base_t *socket;
+
+ tcp_connecter_t (const tcp_connecter_t&);
+ const tcp_connecter_t &operator = (const tcp_connecter_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_listener.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_listener.cpp
new file mode 100644
index 00000000..05171b35
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_listener.cpp
@@ -0,0 +1,333 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <new>
+
+#include <string>
+#include <stdio.h>
+
+#include "platform.hpp"
+#include "tcp_listener.hpp"
+#include "stream_engine.hpp"
+#include "io_thread.hpp"
+#include "session_base.hpp"
+#include "config.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+#include "tcp.hpp"
+#include "socket_base.hpp"
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <unistd.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/tcp.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <fcntl.h>
+#endif
+
+#ifdef ZMQ_HAVE_OPENVMS
+#include <ioctl.h>
+#endif
+
+zmq::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_,
+ socket_base_t *socket_, const options_t &options_) :
+ own_t (io_thread_, options_),
+ io_object_t (io_thread_),
+ s (retired_fd),
+ socket (socket_)
+{
+}
+
+zmq::tcp_listener_t::~tcp_listener_t ()
+{
+ zmq_assert (s == retired_fd);
+}
+
+void zmq::tcp_listener_t::process_plug ()
+{
+ // Start polling for incoming connections.
+ handle = add_fd (s);
+ set_pollin (handle);
+}
+
+void zmq::tcp_listener_t::process_term (int linger_)
+{
+ rm_fd (handle);
+ close ();
+ own_t::process_term (linger_);
+}
+
+void zmq::tcp_listener_t::in_event ()
+{
+ fd_t fd = accept ();
+
+ // If connection was reset by the peer in the meantime, just ignore it.
+ // TODO: Handle specific errors like ENFILE/EMFILE etc.
+ if (fd == retired_fd) {
+ socket->event_accept_failed (endpoint, zmq_errno());
+ return;
+ }
+
+ tune_tcp_socket (fd);
+ tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt, options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
+
+ // remember our fd for ZMQ_SRCFD in messages
+ socket->set_fd(fd);
+
+ // Create the engine object for this connection.
+ stream_engine_t *engine = new (std::nothrow)
+ stream_engine_t (fd, options, endpoint);
+ alloc_assert (engine);
+
+ // Choose I/O thread to run connecter in. Given that we are already
+ // running in an I/O thread, there must be at least one available.
+ io_thread_t *io_thread = choose_io_thread (options.affinity);
+ zmq_assert (io_thread);
+
+ // Create and launch a session object.
+ session_base_t *session = session_base_t::create (io_thread, false, socket,
+ options, NULL);
+ errno_assert (session);
+ session->inc_seqnum ();
+ launch_child (session);
+ send_attach (session, engine, false);
+ socket->event_accepted (endpoint, fd);
+}
+
+void zmq::tcp_listener_t::close ()
+{
+ zmq_assert (s != retired_fd);
+#ifdef ZMQ_HAVE_WINDOWS
+ int rc = closesocket (s);
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ int rc = ::close (s);
+ errno_assert (rc == 0);
+#endif
+ socket->event_closed (endpoint, s);
+ s = retired_fd;
+}
+
+int zmq::tcp_listener_t::get_address (std::string &addr_)
+{
+ // Get the details of the TCP socket
+ struct sockaddr_storage ss;
+#ifdef ZMQ_HAVE_HPUX
+ int sl = sizeof (ss);
+#else
+ socklen_t sl = sizeof (ss);
+#endif
+ int rc = getsockname (s, (struct sockaddr *) &ss, &sl);
+
+ if (rc != 0) {
+ addr_.clear ();
+ return rc;
+ }
+
+ tcp_address_t addr ((struct sockaddr *) &ss, sl);
+ return addr.to_string (addr_);
+}
+
+int zmq::tcp_listener_t::set_address (const char *addr_)
+{
+ // Convert the textual address into address structure.
+ int rc = address.resolve (addr_, true, options.ipv6);
+ if (rc != 0)
+ return -1;
+
+ // Create a listening socket.
+ s = open_socket (address.family (), SOCK_STREAM, IPPROTO_TCP);
+#ifdef ZMQ_HAVE_WINDOWS
+ if (s == INVALID_SOCKET)
+ errno = wsa_error_to_errno (WSAGetLastError ());
+#endif
+
+ // IPv6 address family not supported, try automatic downgrade to IPv4.
+ if (address.family () == AF_INET6
+ && errno == EAFNOSUPPORT
+ && options.ipv6) {
+ rc = address.resolve (addr_, true, true);
+ if (rc != 0)
+ return rc;
+ s = ::socket (address.family (), SOCK_STREAM, IPPROTO_TCP);
+ }
+
+#ifdef ZMQ_HAVE_WINDOWS
+ if (s == INVALID_SOCKET) {
+ errno = wsa_error_to_errno (WSAGetLastError ());
+ return -1;
+ }
+#if !defined _WIN32_WCE
+ // On Windows, preventing sockets to be inherited by child processes.
+ BOOL brc = SetHandleInformation ((HANDLE) s, HANDLE_FLAG_INHERIT, 0);
+ win_assert (brc);
+#endif
+#else
+ if (s == -1)
+ return -1;
+#endif
+
+ // On some systems, IPv4 mapping in IPv6 sockets is disabled by default.
+ // Switch it on in such cases.
+ if (address.family () == AF_INET6)
+ enable_ipv4_mapping (s);
+
+ // Set the IP Type-Of-Service for the underlying socket
+ if (options.tos != 0)
+ set_ip_type_of_service (s, options.tos);
+
+ // Set the socket buffer limits for the underlying socket.
+ if (options.sndbuf != 0)
+ set_tcp_send_buffer (s, options.sndbuf);
+ if (options.rcvbuf != 0)
+ set_tcp_receive_buffer (s, options.rcvbuf);
+
+ // Allow reusing of the address.
+ int flag = 1;
+#ifdef ZMQ_HAVE_WINDOWS
+ rc = setsockopt (s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
+ (const char*) &flag, sizeof (int));
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ rc = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof (int));
+ errno_assert (rc == 0);
+#endif
+
+ address.to_string (endpoint);
+
+ // Bind the socket to the network interface and port.
+ rc = bind (s, address.addr (), address.addrlen ());
+#ifdef ZMQ_HAVE_WINDOWS
+ if (rc == SOCKET_ERROR) {
+ errno = wsa_error_to_errno (WSAGetLastError ());
+ goto error;
+ }
+#else
+ if (rc != 0)
+ goto error;
+#endif
+
+ // Listen for incoming connections.
+ rc = listen (s, options.backlog);
+#ifdef ZMQ_HAVE_WINDOWS
+ if (rc == SOCKET_ERROR) {
+ errno = wsa_error_to_errno (WSAGetLastError ());
+ goto error;
+ }
+#else
+ if (rc != 0)
+ goto error;
+#endif
+
+ socket->event_listening (endpoint, s);
+ return 0;
+
+error:
+ int err = errno;
+ close ();
+ errno = err;
+ return -1;
+}
+
+zmq::fd_t zmq::tcp_listener_t::accept ()
+{
+ // The situation where connection cannot be accepted due to insufficient
+ // resources is considered valid and treated by ignoring the connection.
+ // Accept one connection and deal with different failure modes.
+ zmq_assert (s != retired_fd);
+
+ struct sockaddr_storage ss;
+ memset (&ss, 0, sizeof (ss));
+#ifdef ZMQ_HAVE_HPUX
+ int ss_len = sizeof (ss);
+#else
+ socklen_t ss_len = sizeof (ss);
+#endif
+ fd_t sock = ::accept (s, (struct sockaddr *) &ss, &ss_len);
+
+#ifdef ZMQ_HAVE_WINDOWS
+ if (sock == INVALID_SOCKET) {
+ wsa_assert (WSAGetLastError () == WSAEWOULDBLOCK ||
+ WSAGetLastError () == WSAECONNRESET ||
+ WSAGetLastError () == WSAEMFILE ||
+ WSAGetLastError () == WSAENOBUFS);
+ return retired_fd;
+ }
+#if !defined _WIN32_WCE
+ // On Windows, preventing sockets to be inherited by child processes.
+ BOOL brc = SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0);
+ win_assert (brc);
+#endif
+#else
+ if (sock == -1) {
+ errno_assert (errno == EAGAIN || errno == EWOULDBLOCK ||
+ errno == EINTR || errno == ECONNABORTED || errno == EPROTO ||
+ errno == ENOBUFS || errno == ENOMEM || errno == EMFILE ||
+ errno == ENFILE);
+ return retired_fd;
+ }
+#endif
+
+ // Race condition can cause socket not to be closed (if fork happens
+ // between accept and this point).
+#ifdef FD_CLOEXEC
+ int rc = fcntl (sock, F_SETFD, FD_CLOEXEC);
+ errno_assert (rc != -1);
+#endif
+
+ if (!options.tcp_accept_filters.empty ()) {
+ bool matched = false;
+ for (options_t::tcp_accept_filters_t::size_type i = 0; i != options.tcp_accept_filters.size (); ++i) {
+ if (options.tcp_accept_filters[i].match_address ((struct sockaddr *) &ss, ss_len)) {
+ matched = true;
+ break;
+ }
+ }
+ if (!matched) {
+#ifdef ZMQ_HAVE_WINDOWS
+ int rc = closesocket (sock);
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ int rc = ::close (sock);
+ errno_assert (rc == 0);
+#endif
+ return retired_fd;
+ }
+ }
+
+ // Set the IP Type-Of-Service priority for this client socket
+ if (options.tos != 0)
+ set_ip_type_of_service (sock, options.tos);
+
+ return sock;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_listener.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_listener.hpp
new file mode 100644
index 00000000..4b9dc7ed
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tcp_listener.hpp
@@ -0,0 +1,99 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_TCP_LISTENER_HPP_INCLUDED__
+#define __ZMQ_TCP_LISTENER_HPP_INCLUDED__
+
+#include "fd.hpp"
+#include "own.hpp"
+#include "stdint.hpp"
+#include "io_object.hpp"
+#include "tcp_address.hpp"
+#include "../include/zmq.h"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class socket_base_t;
+
+ class tcp_listener_t : public own_t, public io_object_t
+ {
+ public:
+
+ tcp_listener_t (zmq::io_thread_t *io_thread_,
+ zmq::socket_base_t *socket_, const options_t &options_);
+ ~tcp_listener_t ();
+
+ // Set address to listen on.
+ int set_address (const char *addr_);
+
+ // Get the bound address for use with wildcard
+ int get_address (std::string &addr_);
+
+ private:
+
+ // Handlers for incoming commands.
+ void process_plug ();
+ void process_term (int linger_);
+
+ // Handlers for I/O events.
+ void in_event ();
+
+ // Close the listening socket.
+ void close ();
+
+ // Accept the new connection. Returns the file descriptor of the
+ // newly created connection. The function may return retired_fd
+ // if the connection was dropped while waiting in the listen backlog
+ // or was denied because of accept filters.
+ fd_t accept ();
+
+ // Address to listen on.
+ tcp_address_t address;
+
+ // Underlying socket.
+ fd_t s;
+
+ // Handle corresponding to the listening socket.
+ handle_t handle;
+
+ // Socket the listerner belongs to.
+ zmq::socket_base_t *socket;
+
+ // String representation of endpoint to bind to
+ std::string endpoint;
+
+ tcp_listener_t (const tcp_listener_t&);
+ const tcp_listener_t &operator = (const tcp_listener_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/thread.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/thread.cpp
new file mode 100644
index 00000000..dc3d6d7f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/thread.cpp
@@ -0,0 +1,144 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "thread.hpp"
+#include "err.hpp"
+#include "platform.hpp"
+
+#ifdef ZMQ_HAVE_WINDOWS
+
+extern "C"
+{
+#if defined _WIN32_WCE
+ static DWORD thread_routine (LPVOID arg_)
+#else
+ static unsigned int __stdcall thread_routine (void *arg_)
+#endif
+ {
+ zmq::thread_t *self = (zmq::thread_t*) arg_;
+ self->tfn (self->arg);
+ return 0;
+ }
+}
+
+void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
+{
+ tfn = tfn_;
+ arg = arg_;
+#if defined _WIN32_WCE
+ descriptor = (HANDLE) CreateThread (NULL, 0,
+ &::thread_routine, this, 0 , NULL);
+#else
+ descriptor = (HANDLE) _beginthreadex (NULL, 0,
+ &::thread_routine, this, 0 , NULL);
+#endif
+ win_assert (descriptor != NULL);
+}
+
+void zmq::thread_t::stop ()
+{
+ DWORD rc = WaitForSingleObject (descriptor, INFINITE);
+ win_assert (rc != WAIT_FAILED);
+ BOOL rc2 = CloseHandle (descriptor);
+ win_assert (rc2 != 0);
+}
+
+void zmq::thread_t::setSchedulingParameters(int priority_, int schedulingPolicy_)
+{
+ // not implemented
+}
+
+#else
+
+#include <signal.h>
+
+extern "C"
+{
+ static void *thread_routine (void *arg_)
+ {
+#if !defined ZMQ_HAVE_OPENVMS && !defined ZMQ_HAVE_ANDROID
+ // Following code will guarantee more predictable latencies as it'll
+ // disallow any signal handling in the I/O thread.
+ sigset_t signal_set;
+ int rc = sigfillset (&signal_set);
+ errno_assert (rc == 0);
+ rc = pthread_sigmask (SIG_BLOCK, &signal_set, NULL);
+ posix_assert (rc);
+#endif
+
+ zmq::thread_t *self = (zmq::thread_t*) arg_;
+ self->tfn (self->arg);
+ return NULL;
+ }
+}
+
+void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
+{
+ tfn = tfn_;
+ arg = arg_;
+ int rc = pthread_create (&descriptor, NULL, thread_routine, this);
+ posix_assert (rc);
+}
+
+void zmq::thread_t::stop ()
+{
+ int rc = pthread_join (descriptor, NULL);
+ posix_assert (rc);
+}
+
+void zmq::thread_t::setSchedulingParameters(int priority_, int schedulingPolicy_)
+{
+#if !defined ZMQ_HAVE_ZOS
+ int policy = 0;
+ struct sched_param param;
+
+ int rc = pthread_getschedparam(descriptor, &policy, &param);
+ posix_assert (rc);
+
+ if(priority_ != -1)
+ {
+ param.sched_priority = priority_;
+ }
+
+ if(schedulingPolicy_ != -1)
+ {
+ policy = schedulingPolicy_;
+ }
+
+ rc = pthread_setschedparam(descriptor, policy, &param);
+ posix_assert (rc);
+#endif
+}
+
+#endif
+
+
+
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/thread.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/thread.hpp
new file mode 100644
index 00000000..bfb61d8e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/thread.hpp
@@ -0,0 +1,91 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_THREAD_HPP_INCLUDED__
+#define __ZMQ_THREAD_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <pthread.h>
+#endif
+
+namespace zmq
+{
+
+ typedef void (thread_fn) (void*);
+
+ // Class encapsulating OS thread. Thread initiation/termination is done
+ // using special functions rather than in constructor/destructor so that
+ // thread isn't created during object construction by accident, causing
+ // newly created thread to access half-initialised object. Same applies
+ // to the destruction process: Thread should be terminated before object
+ // destruction begins, otherwise it can access half-destructed object.
+
+ class thread_t
+ {
+ public:
+
+ inline thread_t ()
+ {
+ }
+
+ // Creates OS thread. 'tfn' is main thread function. It'll be passed
+ // 'arg' as an argument.
+ void start (thread_fn *tfn_, void *arg_);
+
+ // Waits for thread termination.
+ void stop ();
+
+ // Sets the thread scheduling parameters. Only implemented for
+ // pthread. Has no effect on other platforms.
+ void setSchedulingParameters(int priority_, int schedulingPolicy_);
+
+ // These are internal members. They should be private, however then
+ // they would not be accessible from the main C routine of the thread.
+ thread_fn *tfn;
+ void *arg;
+
+ private:
+
+#ifdef ZMQ_HAVE_WINDOWS
+ HANDLE descriptor;
+#else
+ pthread_t descriptor;
+#endif
+
+ thread_t (const thread_t&);
+ const thread_t &operator = (const thread_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_address.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_address.cpp
new file mode 100644
index 00000000..07f83ae8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_address.cpp
@@ -0,0 +1,117 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "tipc_address.hpp"
+
+#if defined ZMQ_HAVE_TIPC
+
+#include "err.hpp"
+
+#include <string>
+#include <sstream>
+
+zmq::tipc_address_t::tipc_address_t ()
+{
+ memset (&address, 0, sizeof address);
+}
+
+zmq::tipc_address_t::tipc_address_t (const sockaddr *sa, socklen_t sa_len)
+{
+ zmq_assert (sa && sa_len > 0);
+
+ memset (&address, 0, sizeof address);
+ if (sa->sa_family == AF_TIPC)
+ memcpy (&address, sa, sa_len);
+}
+
+zmq::tipc_address_t::~tipc_address_t ()
+{
+}
+
+int zmq::tipc_address_t::resolve (const char *name)
+{
+ unsigned int type = 0;
+ unsigned int lower = 0;
+ unsigned int upper = 0;
+
+ const int res = sscanf (name, "{%u,%u,%u}", &type, &lower, &upper);
+ if (res == 3)
+ goto nameseq;
+ else
+ if (res == 2 && type > TIPC_RESERVED_TYPES) {
+ address.family = AF_TIPC;
+ address.addrtype = TIPC_ADDR_NAME;
+ address.addr.name.name.type = type;
+ address.addr.name.name.instance = lower;
+ /* Since we can't specify lookup domain when connecting
+ * (and we're not sure that we want it to be configurable)
+ * Change from 'closest first' approach, to search entire zone */
+ address.addr.name.domain = tipc_addr (1, 0, 0);
+ address.scope = 0;
+ return 0;
+ }
+ else
+ return EINVAL;
+nameseq:
+ if (type < TIPC_RESERVED_TYPES || upper < lower)
+ return EINVAL;
+ address.family = AF_TIPC;
+ address.addrtype = TIPC_ADDR_NAMESEQ;
+ address.addr.nameseq.type = type;
+ address.addr.nameseq.lower = lower;
+ address.addr.nameseq.upper = upper;
+ address.scope = TIPC_ZONE_SCOPE;
+ return 0;
+}
+
+int zmq::tipc_address_t::to_string (std::string &addr_)
+{
+ if (address.family != AF_TIPC) {
+ addr_.clear ();
+ return -1;
+ }
+ std::stringstream s;
+ s << "tipc://" << "{" << address.addr.nameseq.type;
+ s << ", " << address.addr.nameseq.lower;
+ s << ", " << address.addr.nameseq.upper << "}";
+ addr_ = s.str ();
+ return 0;
+}
+
+const sockaddr *zmq::tipc_address_t::addr () const
+{
+ return (sockaddr*) &address;
+}
+
+socklen_t zmq::tipc_address_t::addrlen () const
+{
+ return (socklen_t) sizeof address;
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_address.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_address.hpp
new file mode 100644
index 00000000..0d6baa20
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_address.hpp
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_TIPC_ADDRESS_HPP_INCLUDED__
+#define __ZMQ_TIPC_ADDRESS_HPP_INCLUDED__
+
+#include <string>
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_TIPC
+
+#include <sys/socket.h>
+#include <linux/tipc.h>
+
+namespace zmq
+{
+
+ class tipc_address_t
+ {
+ public:
+
+ tipc_address_t ();
+ tipc_address_t (const sockaddr *sa, socklen_t sa_len);
+ ~tipc_address_t ();
+
+ // This function sets up the address "{type, lower, upper}" for TIPC transport
+ int resolve (const char *name);
+
+ // The opposite to resolve()
+ int to_string (std::string &addr_);
+
+ const sockaddr *addr () const;
+ socklen_t addrlen () const;
+
+ private:
+
+ struct sockaddr_tipc address;
+
+ tipc_address_t (const tipc_address_t&);
+ const tipc_address_t &operator = (const tipc_address_t&);
+ };
+
+}
+
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_connecter.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_connecter.cpp
new file mode 100644
index 00000000..11b53c50
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_connecter.cpp
@@ -0,0 +1,266 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "tipc_connecter.hpp"
+
+#if defined ZMQ_HAVE_TIPC
+
+#include <new>
+#include <string>
+
+#include "stream_engine.hpp"
+#include "io_thread.hpp"
+#include "platform.hpp"
+#include "random.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+#include "address.hpp"
+#include "tipc_address.hpp"
+#include "session_base.hpp"
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+zmq::tipc_connecter_t::tipc_connecter_t (class io_thread_t *io_thread_,
+ class session_base_t *session_, const options_t &options_,
+ const address_t *addr_, bool delayed_start_) :
+ own_t (io_thread_, options_),
+ io_object_t (io_thread_),
+ addr (addr_),
+ s (retired_fd),
+ handle_valid (false),
+ delayed_start (delayed_start_),
+ timer_started (false),
+ session (session_),
+ current_reconnect_ivl(options.reconnect_ivl)
+{
+ zmq_assert (addr);
+ zmq_assert (addr->protocol == "tipc");
+ addr->to_string (endpoint);
+ socket = session-> get_socket();
+}
+
+zmq::tipc_connecter_t::~tipc_connecter_t ()
+{
+ zmq_assert (!timer_started);
+ zmq_assert (!handle_valid);
+ zmq_assert (s == retired_fd);
+}
+
+void zmq::tipc_connecter_t::process_plug ()
+{
+ if (delayed_start)
+ add_reconnect_timer ();
+ else
+ start_connecting ();
+}
+
+void zmq::tipc_connecter_t::process_term (int linger_)
+{
+ if (timer_started) {
+ cancel_timer (reconnect_timer_id);
+ timer_started = false;
+ }
+
+ if (handle_valid) {
+ rm_fd (handle);
+ handle_valid = false;
+ }
+
+ if (s != retired_fd)
+ close ();
+
+ own_t::process_term (linger_);
+}
+
+void zmq::tipc_connecter_t::in_event ()
+{
+ // We are not polling for incomming data, so we are actually called
+ // because of error here. However, we can get error on out event as well
+ // on some platforms, so we'll simply handle both events in the same way.
+ out_event ();
+}
+
+void zmq::tipc_connecter_t::out_event ()
+{
+ fd_t fd = connect ();
+ rm_fd (handle);
+ handle_valid = false;
+
+ // Handle the error condition by attempt to reconnect.
+ if (fd == retired_fd) {
+ close ();
+ add_reconnect_timer();
+ return;
+ }
+ // Create the engine object for this connection.
+ stream_engine_t *engine = new (std::nothrow) stream_engine_t (fd, options, endpoint);
+ alloc_assert (engine);
+
+ // Attach the engine to the corresponding session object.
+ send_attach (session, engine);
+
+ // Shut the connecter down.
+ terminate ();
+
+ socket->event_connected (endpoint, fd);
+}
+
+void zmq::tipc_connecter_t::timer_event (int id_)
+{
+ zmq_assert (id_ == reconnect_timer_id);
+ timer_started = false;
+ start_connecting ();
+}
+
+void zmq::tipc_connecter_t::start_connecting ()
+{
+ // Open the connecting socket.
+ int rc = open ();
+
+ // Connect may succeed in synchronous manner.
+ if (rc == 0) {
+ handle = add_fd (s);
+ handle_valid = true;
+ out_event ();
+ }
+
+ // Connection establishment may be delayed. Poll for its completion.
+ else
+ if (rc == -1 && errno == EINPROGRESS) {
+ handle = add_fd (s);
+ handle_valid = true;
+ set_pollout (handle);
+ socket->event_connect_delayed (endpoint, zmq_errno());
+ }
+
+ // Handle any other error condition by eventual reconnect.
+ else {
+ if (s != retired_fd)
+ close ();
+ add_reconnect_timer ();
+ }
+}
+
+void zmq::tipc_connecter_t::add_reconnect_timer()
+{
+ int rc_ivl = get_new_reconnect_ivl();
+ add_timer (rc_ivl, reconnect_timer_id);
+ socket->event_connect_retried (endpoint, rc_ivl);
+ timer_started = true;
+}
+
+int zmq::tipc_connecter_t::get_new_reconnect_ivl ()
+{
+ // The new interval is the current interval + random value.
+ int this_interval = current_reconnect_ivl +
+ (generate_random () % options.reconnect_ivl);
+
+ // Only change the current reconnect interval if the maximum reconnect
+ // interval was set and if it's larger than the reconnect interval.
+ if (options.reconnect_ivl_max > 0 &&
+ options.reconnect_ivl_max > options.reconnect_ivl) {
+
+ // Calculate the next interval
+ current_reconnect_ivl = current_reconnect_ivl * 2;
+ if(current_reconnect_ivl >= options.reconnect_ivl_max) {
+ current_reconnect_ivl = options.reconnect_ivl_max;
+ }
+ }
+ return this_interval;
+}
+
+int zmq::tipc_connecter_t::open ()
+{
+ zmq_assert (s == retired_fd);
+
+ // Create the socket.
+ s = open_socket (AF_TIPC, SOCK_STREAM, 0);
+ if (s == -1)
+ return -1;
+
+ // Set the non-blocking flag.
+ unblock_socket (s);
+ // Connect to the remote peer.
+ int rc = ::connect (
+ s, addr->resolved.tipc_addr->addr (),
+ addr->resolved.tipc_addr->addrlen ());
+
+ // Connect was successfull immediately.
+ if (rc == 0)
+ return 0;
+
+ // Translate other error codes indicating asynchronous connect has been
+ // launched to a uniform EINPROGRESS.
+ if (rc == -1 && errno == EINTR) {
+ errno = EINPROGRESS;
+ return -1;
+ }
+ // Forward the error.
+ return -1;
+}
+
+void zmq::tipc_connecter_t::close ()
+{
+ zmq_assert (s != retired_fd);
+ int rc = ::close (s);
+ errno_assert (rc == 0);
+ socket->event_closed (endpoint, s);
+ s = retired_fd;
+}
+
+zmq::fd_t zmq::tipc_connecter_t::connect ()
+{
+ // Following code should handle both Berkeley-derived socket
+ // implementations and Solaris.
+ int err = 0;
+ socklen_t len = sizeof (err);
+
+ int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
+ if (rc == -1)
+ err = errno;
+ if (err != 0) {
+
+ // Assert if the error was caused by 0MQ bug.
+ // Networking problems are OK. No need to assert.
+ errno = err;
+ errno_assert (errno == ECONNREFUSED || errno == ECONNRESET ||
+ errno == ETIMEDOUT || errno == EHOSTUNREACH ||
+ errno == ENETUNREACH || errno == ENETDOWN);
+
+ return retired_fd;
+ }
+ fd_t result = s;
+ s = retired_fd;
+ return result;
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_connecter.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_connecter.hpp
new file mode 100644
index 00000000..6bfc7677
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_connecter.hpp
@@ -0,0 +1,137 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __TIPC_CONNECTER_HPP_INCLUDED__
+#define __TIPC_CONNECTER_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_TIPC
+
+#include "fd.hpp"
+#include "own.hpp"
+#include "stdint.hpp"
+#include "io_object.hpp"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class session_base_t;
+ struct address_t;
+
+ class tipc_connecter_t : public own_t, public io_object_t
+ {
+ public:
+
+ // If 'delayed_start' is true connecter first waits for a while,
+ // then starts connection process.
+ tipc_connecter_t (zmq::io_thread_t *io_thread_,
+ zmq::session_base_t *session_, const options_t &options_,
+ const address_t *addr_, bool delayed_start_);
+ ~tipc_connecter_t ();
+
+ private:
+
+ // ID of the timer used to delay the reconnection.
+ enum {reconnect_timer_id = 1};
+
+ // Handlers for incoming commands.
+ void process_plug ();
+ void process_term (int linger_);
+
+ // Handlers for I/O events.
+ void in_event ();
+ void out_event ();
+ void timer_event (int id_);
+
+ // Internal function to start the actual connection establishment.
+ void start_connecting ();
+
+ // Internal function to add a reconnect timer
+ void add_reconnect_timer();
+
+ // Close the connecting socket.
+ void close ();
+
+ // Get the file descriptor of newly created connection. Returns
+ // retired_fd if the connection was unsuccessfull.
+ fd_t connect ();
+
+ // Address to connect to. Owned by session_base_t.
+ const address_t *addr;
+
+ // Underlying socket.
+ fd_t s;
+
+ // Handle corresponding to the listening socket.
+ handle_t handle;
+
+ // If true file descriptor is registered with the poller and 'handle'
+ // contains valid value.
+ bool handle_valid;
+
+ // If true, connecter is waiting a while before trying to connect.
+ const bool delayed_start;
+
+ // True iff a timer has been started.
+ bool timer_started;
+
+ // Reference to the session we belong to.
+ zmq::session_base_t *session;
+
+ // Current reconnect ivl, updated for backoff strategy
+ int current_reconnect_ivl;
+
+ // String representation of endpoint to connect to
+ std::string endpoint;
+
+ // Socket
+ zmq::socket_base_t *socket;
+
+ // Internal function to return a reconnect backoff delay.
+ // Will modify the current_reconnect_ivl used for next call
+ // Returns the currently used interval
+ int get_new_reconnect_ivl ();
+
+ // Open IPC connecting socket. Returns -1 in case of error,
+ // 0 if connect was successfull immediately. Returns -1 with
+ // EAGAIN errno if async connect was launched.
+ int open ();
+
+ tipc_connecter_t (const tipc_connecter_t&);
+ const tipc_connecter_t &operator = (const tipc_connecter_t&);
+ };
+
+}
+
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_listener.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_listener.cpp
new file mode 100644
index 00000000..fb8df6c3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_listener.cpp
@@ -0,0 +1,188 @@
+ /*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "tipc_listener.hpp"
+
+#if defined ZMQ_HAVE_TIPC
+
+#include <new>
+
+#include <string.h>
+
+#include "stream_engine.hpp"
+#include "tipc_address.hpp"
+#include "io_thread.hpp"
+#include "session_base.hpp"
+#include "config.hpp"
+#include "err.hpp"
+#include "ip.hpp"
+#include "socket_base.hpp"
+
+#include <unistd.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <linux/tipc.h>
+
+zmq::tipc_listener_t::tipc_listener_t (io_thread_t *io_thread_,
+ socket_base_t *socket_, const options_t &options_) :
+ own_t (io_thread_, options_),
+ io_object_t (io_thread_),
+ s (retired_fd),
+ socket (socket_)
+{
+}
+
+zmq::tipc_listener_t::~tipc_listener_t ()
+{
+ zmq_assert (s == retired_fd);
+}
+
+void zmq::tipc_listener_t::process_plug ()
+{
+ // Start polling for incoming connections.
+ handle = add_fd (s);
+ set_pollin (handle);
+}
+
+void zmq::tipc_listener_t::process_term (int linger_)
+{
+ rm_fd (handle);
+ close ();
+ own_t::process_term (linger_);
+}
+
+void zmq::tipc_listener_t::in_event ()
+{
+ fd_t fd = accept ();
+
+ // If connection was reset by the peer in the meantime, just ignore it.
+ // TODO: Handle specific errors like ENFILE/EMFILE etc.
+ if (fd == retired_fd) {
+ socket->event_accept_failed (endpoint, zmq_errno());
+ return;
+ }
+
+ // Create the engine object for this connection.
+ stream_engine_t *engine = new (std::nothrow) stream_engine_t (fd, options, endpoint);
+ alloc_assert (engine);
+
+ // Choose I/O thread to run connecter in. Given that we are already
+ // running in an I/O thread, there must be at least one available.
+ io_thread_t *io_thread = choose_io_thread (options.affinity);
+ zmq_assert (io_thread);
+
+ // Create and launch a session object.
+ session_base_t *session = session_base_t::create (io_thread, false, socket,
+ options, NULL);
+ errno_assert (session);
+ session->inc_seqnum ();
+ launch_child (session);
+ send_attach (session, engine, false);
+ socket->event_accepted (endpoint, fd);
+}
+
+int zmq::tipc_listener_t::get_address (std::string &addr_)
+{
+ struct sockaddr_storage ss;
+ socklen_t sl = sizeof (ss);
+
+ int rc = getsockname (s, (sockaddr *) &ss, &sl);
+ if (rc != 0) {
+ addr_.clear ();
+ return rc;
+ }
+
+ tipc_address_t addr ((struct sockaddr *) &ss, sl);
+ return addr.to_string (addr_);
+}
+
+int zmq::tipc_listener_t::set_address (const char *addr_)
+{
+ //convert str to address struct
+ int rc = address.resolve(addr_);
+ if (rc != 0)
+ return -1;
+ // Create a listening socket.
+ s = open_socket (AF_TIPC, SOCK_STREAM, 0);
+ if (s == -1)
+ return -1;
+
+ address.to_string (endpoint);
+
+ // Bind the socket to tipc name.
+ rc = bind (s, address.addr (), address.addrlen ());
+ if (rc != 0)
+ goto error;
+
+ // Listen for incomming connections.
+ rc = listen (s, options.backlog);
+ if (rc != 0)
+ goto error;
+
+ socket->event_listening (endpoint, s);
+ return 0;
+
+error:
+ int err = errno;
+ close ();
+ errno = err;
+ return -1;
+}
+
+void zmq::tipc_listener_t::close ()
+{
+ zmq_assert (s != retired_fd);
+ int rc = ::close (s);
+ errno_assert (rc == 0);
+ s = retired_fd;
+ socket->event_closed (endpoint, s);
+}
+
+zmq::fd_t zmq::tipc_listener_t::accept ()
+{
+ // Accept one connection and deal with different failure modes.
+ // The situation where connection cannot be accepted due to insufficient
+ // resources is considered valid and treated by ignoring the connection.
+ struct sockaddr_storage ss = {};
+ socklen_t ss_len = sizeof(ss);
+
+ zmq_assert (s != retired_fd);
+ fd_t sock = ::accept (s, (struct sockaddr *) &ss, &ss_len);
+ if (sock == -1) {
+ errno_assert (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS ||
+ errno == EINTR || errno == ECONNABORTED || errno == EPROTO || errno == EMFILE ||
+ errno == ENFILE);
+ return retired_fd;
+ }
+ /*FIXME Accept filters?*/
+ return sock;
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_listener.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_listener.hpp
new file mode 100644
index 00000000..06d201ac
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/tipc_listener.hpp
@@ -0,0 +1,107 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_TIPC_LISTENER_HPP_INCLUDED__
+#define __ZMQ_TIPC_LISTENER_HPP_INCLUDED__
+
+#include "platform.hpp"
+
+#if defined ZMQ_HAVE_TIPC
+
+#include <string>
+
+#include "fd.hpp"
+#include "own.hpp"
+#include "stdint.hpp"
+#include "io_object.hpp"
+#include "tipc_address.hpp"
+
+namespace zmq
+{
+
+ class io_thread_t;
+ class socket_base_t;
+
+ class tipc_listener_t : public own_t, public io_object_t
+ {
+ public:
+
+ tipc_listener_t (zmq::io_thread_t *io_thread_,
+ zmq::socket_base_t *socket_, const options_t &options_);
+ ~tipc_listener_t ();
+
+ // Set address to listen on.
+ int set_address (const char *addr_);
+
+ // Get the bound address for use with wildcards
+ int get_address (std::string &addr_);
+
+ private:
+
+ // Handlers for incoming commands.
+ void process_plug ();
+ void process_term (int linger_);
+
+ // Handlers for I/O events.
+ void in_event ();
+
+ // Close the listening socket.
+ void close ();
+
+ // Accept the new connection. Returns the file descriptor of the
+ // newly created connection. The function may return retired_fd
+ // if the connection was dropped while waiting in the listen backlog.
+ fd_t accept ();
+
+ // Address to listen on
+ tipc_address_t address;
+
+ // Underlying socket.
+ fd_t s;
+
+
+ // Handle corresponding to the listening socket.
+ handle_t handle;
+
+ // Socket the listerner belongs to.
+ zmq::socket_base_t *socket;
+
+ // String representation of endpoint to bind to
+ std::string endpoint;
+
+ tipc_listener_t (const tipc_listener_t&);
+ const tipc_listener_t &operator = (const tipc_listener_t&);
+ };
+
+}
+
+#endif
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/trie.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/trie.cpp
new file mode 100644
index 00000000..e48cac0a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/trie.cpp
@@ -0,0 +1,344 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+
+#include <new>
+#include <algorithm>
+
+#include "platform.hpp"
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "err.hpp"
+#include "trie.hpp"
+
+zmq::trie_t::trie_t () :
+ refcnt (0),
+ min (0),
+ count (0),
+ live_nodes (0)
+{
+}
+
+zmq::trie_t::~trie_t ()
+{
+ if (count == 1) {
+ zmq_assert (next.node);
+ delete next.node;
+ next.node = 0;
+ }
+ else
+ if (count > 1) {
+ for (unsigned short i = 0; i != count; ++i)
+ delete next.table [i];
+ free (next.table);
+ }
+}
+
+bool zmq::trie_t::add (unsigned char *prefix_, size_t size_)
+{
+ // We are at the node corresponding to the prefix. We are done.
+ if (!size_) {
+ ++refcnt;
+ return refcnt == 1;
+ }
+
+ unsigned char c = *prefix_;
+ if (c < min || c >= min + count) {
+
+ // The character is out of range of currently handled
+ // charcters. We have to extend the table.
+ if (!count) {
+ min = c;
+ count = 1;
+ next.node = NULL;
+ }
+ else
+ if (count == 1) {
+ unsigned char oldc = min;
+ trie_t *oldp = next.node;
+ count = (min < c ? c - min : min - c) + 1;
+ next.table = (trie_t**)
+ malloc (sizeof (trie_t*) * count);
+ alloc_assert (next.table);
+ for (unsigned short i = 0; i != count; ++i)
+ next.table [i] = 0;
+ min = std::min (min, c);
+ next.table [oldc - min] = oldp;
+ }
+ else
+ if (min < c) {
+ // The new character is above the current character range.
+ unsigned short old_count = count;
+ count = c - min + 1;
+ next.table = (trie_t**) realloc ((void*) next.table,
+ sizeof (trie_t*) * count);
+ zmq_assert (next.table);
+ for (unsigned short i = old_count; i != count; i++)
+ next.table [i] = NULL;
+ }
+ else {
+
+ // The new character is below the current character range.
+ unsigned short old_count = count;
+ count = (min + old_count) - c;
+ next.table = (trie_t**) realloc ((void*) next.table,
+ sizeof (trie_t*) * count);
+ zmq_assert (next.table);
+ memmove (next.table + min - c, next.table,
+ old_count * sizeof (trie_t*));
+ for (unsigned short i = 0; i != min - c; i++)
+ next.table [i] = NULL;
+ min = c;
+ }
+ }
+
+ // If next node does not exist, create one.
+ if (count == 1) {
+ if (!next.node) {
+ next.node = new (std::nothrow) trie_t;
+ alloc_assert (next.node);
+ ++live_nodes;
+ zmq_assert (live_nodes == 1);
+ }
+ return next.node->add (prefix_ + 1, size_ - 1);
+ }
+ else {
+ if (!next.table [c - min]) {
+ next.table [c - min] = new (std::nothrow) trie_t;
+ alloc_assert (next.table [c - min]);
+ ++live_nodes;
+ zmq_assert (live_nodes > 1);
+ }
+ return next.table [c - min]->add (prefix_ + 1, size_ - 1);
+ }
+}
+
+bool zmq::trie_t::rm (unsigned char *prefix_, size_t size_)
+{
+ // TODO: Shouldn't an error be reported if the key does not exist?
+ if (!size_) {
+ if (!refcnt)
+ return false;
+ refcnt--;
+ return refcnt == 0;
+ }
+ unsigned char c = *prefix_;
+ if (!count || c < min || c >= min + count)
+ return false;
+
+ trie_t *next_node =
+ count == 1 ? next.node : next.table [c - min];
+
+ if (!next_node)
+ return false;
+
+ bool ret = next_node->rm (prefix_ + 1, size_ - 1);
+
+ // Prune redundant nodes
+ if (next_node->is_redundant ()) {
+ delete next_node;
+ zmq_assert (count > 0);
+
+ if (count == 1) {
+ // The just pruned node is was the only live node
+ next.node = 0;
+ count = 0;
+ --live_nodes;
+ zmq_assert (live_nodes == 0);
+ }
+ else {
+ next.table [c - min] = 0;
+ zmq_assert (live_nodes > 1);
+ --live_nodes;
+
+ // Compact the table if possible
+ if (live_nodes == 1) {
+ // We can switch to using the more compact single-node
+ // representation since the table only contains one live node
+ trie_t *node = 0;
+ // Since we always compact the table the pruned node must
+ // either be the left-most or right-most ptr in the node
+ // table
+ if (c == min) {
+ // The pruned node is the left-most node ptr in the
+ // node table => keep the right-most node
+ node = next.table [count - 1];
+ min += count - 1;
+ }
+ else
+ if (c == min + count - 1) {
+ // The pruned node is the right-most node ptr in the
+ // node table => keep the left-most node
+ node = next.table [0];
+ }
+ zmq_assert (node);
+ free (next.table);
+ next.node = node;
+ count = 1;
+ }
+ else
+ if (c == min) {
+ // We can compact the table "from the left".
+ // Find the left-most non-null node ptr, which we'll use as
+ // our new min
+ unsigned char new_min = min;
+ for (unsigned short i = 1; i < count; ++i) {
+ if (next.table [i]) {
+ new_min = i + min;
+ break;
+ }
+ }
+ zmq_assert (new_min != min);
+
+ trie_t **old_table = next.table;
+ zmq_assert (new_min > min);
+ zmq_assert (count > new_min - min);
+
+ count = count - (new_min - min);
+ next.table = (trie_t**) malloc (sizeof (trie_t*) * count);
+ alloc_assert (next.table);
+
+ memmove (next.table, old_table + (new_min - min),
+ sizeof (trie_t*) * count);
+ free (old_table);
+
+ min = new_min;
+ }
+ else
+ if (c == min + count - 1) {
+ // We can compact the table "from the right".
+ // Find the right-most non-null node ptr, which we'll use to
+ // determine the new table size
+ unsigned short new_count = count;
+ for (unsigned short i = 1; i < count; ++i) {
+ if (next.table [count - 1 - i]) {
+ new_count = count - i;
+ break;
+ }
+ }
+ zmq_assert (new_count != count);
+ count = new_count;
+
+ trie_t **old_table = next.table;
+ next.table = (trie_t**) malloc (sizeof (trie_t*) * count);
+ alloc_assert (next.table);
+
+ memmove (next.table, old_table, sizeof (trie_t*) * count);
+ free (old_table);
+ }
+ }
+ }
+ return ret;
+}
+
+bool zmq::trie_t::check (unsigned char *data_, size_t size_)
+{
+ // This function is on critical path. It deliberately doesn't use
+ // recursion to get a bit better performance.
+ trie_t *current = this;
+ while (true) {
+
+ // We've found a corresponding subscription!
+ if (current->refcnt)
+ return true;
+
+ // We've checked all the data and haven't found matching subscription.
+ if (!size_)
+ return false;
+
+ // If there's no corresponding slot for the first character
+ // of the prefix, the message does not match.
+ unsigned char c = *data_;
+ if (c < current->min || c >= current->min + current->count)
+ return false;
+
+ // Move to the next character.
+ if (current->count == 1)
+ current = current->next.node;
+ else {
+ current = current->next.table [c - current->min];
+ if (!current)
+ return false;
+ }
+ data_++;
+ size_--;
+ }
+}
+
+void zmq::trie_t::apply (void (*func_) (unsigned char *data_, size_t size_,
+ void *arg_), void *arg_)
+{
+ unsigned char *buff = NULL;
+ apply_helper (&buff, 0, 0, func_, arg_);
+ free (buff);
+}
+
+void zmq::trie_t::apply_helper (
+ unsigned char **buff_, size_t buffsize_, size_t maxbuffsize_,
+ void (*func_) (unsigned char *data_, size_t size_, void *arg_), void *arg_)
+{
+ // If this node is a subscription, apply the function.
+ if (refcnt)
+ func_ (*buff_, buffsize_, arg_);
+
+ // Adjust the buffer.
+ if (buffsize_ >= maxbuffsize_) {
+ maxbuffsize_ = buffsize_ + 256;
+ *buff_ = (unsigned char*) realloc (*buff_, maxbuffsize_);
+ zmq_assert (*buff_);
+ }
+
+ // If there are no subnodes in the trie, return.
+ if (count == 0)
+ return;
+
+ // If there's one subnode (optimisation).
+ if (count == 1) {
+ (*buff_) [buffsize_] = min;
+ buffsize_++;
+ next.node->apply_helper (buff_, buffsize_, maxbuffsize_, func_, arg_);
+ return;
+ }
+
+ // If there are multiple subnodes.
+ for (unsigned short c = 0; c != count; c++) {
+ (*buff_) [buffsize_] = min + c;
+ if (next.table [c])
+ next.table [c]->apply_helper (buff_, buffsize_ + 1, maxbuffsize_,
+ func_, arg_);
+ }
+}
+
+bool zmq::trie_t::is_redundant () const
+{
+ return refcnt == 0 && live_nodes == 0;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/trie.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/trie.hpp
new file mode 100644
index 00000000..d714c617
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/trie.hpp
@@ -0,0 +1,86 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_TRIE_HPP_INCLUDED__
+#define __ZMQ_TRIE_HPP_INCLUDED__
+
+#include <stddef.h>
+
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ class trie_t
+ {
+ public:
+
+ trie_t ();
+ ~trie_t ();
+
+ // Add key to the trie. Returns true if this is a new item in the trie
+ // rather than a duplicate.
+ bool add (unsigned char *prefix_, size_t size_);
+
+ // Remove key from the trie. Returns true if the item is actually
+ // removed from the trie.
+ bool rm (unsigned char *prefix_, size_t size_);
+
+ // Check whether particular key is in the trie.
+ bool check (unsigned char *data_, size_t size_);
+
+ // Apply the function supplied to each subscription in the trie.
+ void apply (void (*func_) (unsigned char *data_, size_t size_,
+ void *arg_), void *arg_);
+
+ private:
+
+ void apply_helper (
+ unsigned char **buff_, size_t buffsize_, size_t maxbuffsize_,
+ void (*func_) (unsigned char *data_, size_t size_, void *arg_),
+ void *arg_);
+ bool is_redundant () const;
+
+ uint32_t refcnt;
+ unsigned char min;
+ unsigned short count;
+ unsigned short live_nodes;
+ union {
+ class trie_t *node;
+ class trie_t **table;
+ } next;
+
+ trie_t (const trie_t&);
+ const trie_t &operator = (const trie_t&);
+ };
+
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_decoder.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_decoder.cpp
new file mode 100644
index 00000000..a21bb2f5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_decoder.cpp
@@ -0,0 +1,158 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <limits>
+
+#include "platform.hpp"
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "decoder.hpp"
+#include "v1_decoder.hpp"
+#include "likely.hpp"
+#include "wire.hpp"
+#include "err.hpp"
+
+zmq::v1_decoder_t::v1_decoder_t (size_t bufsize_, int64_t maxmsgsize_) :
+ decoder_base_t <v1_decoder_t> (bufsize_),
+ maxmsgsize (maxmsgsize_)
+{
+ int rc = in_progress.init ();
+ errno_assert (rc == 0);
+
+ // At the beginning, read one byte and go to one_byte_size_ready state.
+ next_step (tmpbuf, 1, &v1_decoder_t::one_byte_size_ready);
+}
+
+zmq::v1_decoder_t::~v1_decoder_t ()
+{
+ int rc = in_progress.close ();
+ errno_assert (rc == 0);
+}
+
+int zmq::v1_decoder_t::one_byte_size_ready ()
+{
+ // First byte of size is read. If it is 0xff read 8-byte size.
+ // Otherwise allocate the buffer for message data and read the
+ // message data into it.
+ if (*tmpbuf == 0xff)
+ next_step (tmpbuf, 8, &v1_decoder_t::eight_byte_size_ready);
+ else {
+
+ // There has to be at least one byte (the flags) in the message).
+ if (!*tmpbuf) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ if (maxmsgsize >= 0 && (int64_t) (*tmpbuf - 1) > maxmsgsize) {
+ errno = EMSGSIZE;
+ return -1;
+ }
+
+ // in_progress is initialised at this point so in theory we should
+ // close it before calling zmq_msg_init_size, however, it's a 0-byte
+ // message and thus we can treat it as uninitialised...
+ int rc = in_progress.init_size (*tmpbuf - 1);
+ if (rc != 0) {
+ errno_assert (errno == ENOMEM);
+ rc = in_progress.init ();
+ errno_assert (rc == 0);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ next_step (tmpbuf, 1, &v1_decoder_t::flags_ready);
+ }
+ return 0;
+}
+
+int zmq::v1_decoder_t::eight_byte_size_ready ()
+{
+ // 8-byte payload length is read. Allocate the buffer
+ // for message body and read the message data into it.
+ const uint64_t payload_length = get_uint64 (tmpbuf);
+
+ // There has to be at least one byte (the flags) in the message).
+ if (payload_length == 0) {
+ errno = EPROTO;
+ return -1;
+ }
+
+ // Message size must not exceed the maximum allowed size.
+ if (maxmsgsize >= 0 && payload_length - 1 > (uint64_t) maxmsgsize) {
+ errno = EMSGSIZE;
+ return -1;
+ }
+
+ // Message size must fit within range of size_t data type.
+ if (payload_length - 1 > std::numeric_limits <size_t>::max ()) {
+ errno = EMSGSIZE;
+ return -1;
+ }
+
+ const size_t msg_size = static_cast <size_t> (payload_length - 1);
+
+ // in_progress is initialised at this point so in theory we should
+ // close it before calling init_size, however, it's a 0-byte
+ // message and thus we can treat it as uninitialised...
+ int rc = in_progress.init_size (msg_size);
+ if (rc != 0) {
+ errno_assert (errno == ENOMEM);
+ rc = in_progress.init ();
+ errno_assert (rc == 0);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ next_step (tmpbuf, 1, &v1_decoder_t::flags_ready);
+ return 0;
+}
+
+int zmq::v1_decoder_t::flags_ready ()
+{
+ // Store the flags from the wire into the message structure.
+ in_progress.set_flags (tmpbuf [0] & msg_t::more);
+
+ next_step (in_progress.data (), in_progress.size (),
+ &v1_decoder_t::message_ready);
+
+ return 0;
+}
+
+int zmq::v1_decoder_t::message_ready ()
+{
+ // Message is completely read. Push it further and start reading
+ // new message. (in_progress is a 0-byte message after this point.)
+ next_step (tmpbuf, 1, &v1_decoder_t::one_byte_size_ready);
+ return 1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_decoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_decoder.hpp
new file mode 100644
index 00000000..69207236
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_decoder.hpp
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_V1_DECODER_HPP_INCLUDED__
+#define __ZMQ_V1_DECODER_HPP_INCLUDED__
+
+#include "decoder.hpp"
+
+namespace zmq
+{
+ // Decoder for ZMTP/1.0 protocol. Converts data batches into messages.
+
+ class v1_decoder_t : public decoder_base_t <v1_decoder_t>
+ {
+ public:
+
+ v1_decoder_t (size_t bufsize_, int64_t maxmsgsize_);
+ ~v1_decoder_t ();
+
+ virtual msg_t *msg () { return &in_progress; }
+
+ private:
+
+ int one_byte_size_ready ();
+ int eight_byte_size_ready ();
+ int flags_ready ();
+ int message_ready ();
+
+ unsigned char tmpbuf [8];
+ msg_t in_progress;
+
+ int64_t maxmsgsize;
+
+ v1_decoder_t (const v1_decoder_t&);
+ void operator = (const v1_decoder_t&);
+ };
+
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_encoder.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_encoder.cpp
new file mode 100644
index 00000000..d77ccb25
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_encoder.cpp
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "encoder.hpp"
+#include "v1_encoder.hpp"
+#include "likely.hpp"
+#include "wire.hpp"
+
+zmq::v1_encoder_t::v1_encoder_t (size_t bufsize_) :
+ encoder_base_t <v1_encoder_t> (bufsize_)
+{
+ // Write 0 bytes to the batch and go to message_ready state.
+ next_step (NULL, 0, &v1_encoder_t::message_ready, true);
+}
+
+zmq::v1_encoder_t::~v1_encoder_t ()
+{
+}
+
+void zmq::v1_encoder_t::size_ready ()
+{
+ // Write message body into the buffer.
+ next_step (in_progress->data (), in_progress->size (),
+ &v1_encoder_t::message_ready, true);
+}
+
+void zmq::v1_encoder_t::message_ready ()
+{
+ // Get the message size.
+ size_t size = in_progress->size ();
+
+ // Account for the 'flags' byte.
+ size++;
+
+ // For messages less than 255 bytes long, write one byte of message size.
+ // For longer messages write 0xff escape character followed by 8-byte
+ // message size. In both cases 'flags' field follows.
+ if (size < 255) {
+ tmpbuf [0] = (unsigned char) size;
+ tmpbuf [1] = (in_progress->flags () & msg_t::more);
+ next_step (tmpbuf, 2, &v1_encoder_t::size_ready, false);
+ }
+ else {
+ tmpbuf [0] = 0xff;
+ put_uint64 (tmpbuf + 1, size);
+ tmpbuf [9] = (in_progress->flags () & msg_t::more);
+ next_step (tmpbuf, 10, &v1_encoder_t::size_ready, false);
+ }
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_encoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_encoder.hpp
new file mode 100644
index 00000000..4636d190
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v1_encoder.hpp
@@ -0,0 +1,59 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_V1_ENCODER_HPP_INCLUDED__
+#define __ZMQ_V1_ENCODER_HPP_INCLUDED__
+
+#include "encoder.hpp"
+
+namespace zmq
+{
+ // Encoder for ZMTP/1.0 protocol. Converts messages into data batches.
+
+ class v1_encoder_t : public encoder_base_t <v1_encoder_t>
+ {
+ public:
+
+ v1_encoder_t (size_t bufsize_);
+ ~v1_encoder_t ();
+
+ private:
+
+ void size_ready ();
+ void message_ready ();
+
+ unsigned char tmpbuf [10];
+
+ v1_encoder_t (const v1_encoder_t&);
+ const v1_encoder_t &operator = (const v1_encoder_t&);
+ };
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_decoder.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_decoder.cpp
new file mode 100644
index 00000000..394b1e9f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_decoder.cpp
@@ -0,0 +1,152 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "platform.hpp"
+#ifdef ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#endif
+
+#include "v2_protocol.hpp"
+#include "v2_decoder.hpp"
+#include "likely.hpp"
+#include "wire.hpp"
+#include "err.hpp"
+
+zmq::v2_decoder_t::v2_decoder_t (size_t bufsize_, int64_t maxmsgsize_) :
+ decoder_base_t <v2_decoder_t> (bufsize_),
+ msg_flags (0),
+ maxmsgsize (maxmsgsize_)
+{
+ int rc = in_progress.init ();
+ errno_assert (rc == 0);
+
+ // At the beginning, read one byte and go to flags_ready state.
+ next_step (tmpbuf, 1, &v2_decoder_t::flags_ready);
+}
+
+zmq::v2_decoder_t::~v2_decoder_t ()
+{
+ int rc = in_progress.close ();
+ errno_assert (rc == 0);
+}
+
+int zmq::v2_decoder_t::flags_ready ()
+{
+ msg_flags = 0;
+ if (tmpbuf [0] & v2_protocol_t::more_flag)
+ msg_flags |= msg_t::more;
+ if (tmpbuf [0] & v2_protocol_t::command_flag)
+ msg_flags |= msg_t::command;
+
+ // The payload length is either one or eight bytes,
+ // depending on whether the 'large' bit is set.
+ if (tmpbuf [0] & v2_protocol_t::large_flag)
+ next_step (tmpbuf, 8, &v2_decoder_t::eight_byte_size_ready);
+ else
+ next_step (tmpbuf, 1, &v2_decoder_t::one_byte_size_ready);
+
+ return 0;
+}
+
+int zmq::v2_decoder_t::one_byte_size_ready ()
+{
+ // Message size must not exceed the maximum allowed size.
+ if (maxmsgsize >= 0)
+ if (unlikely (tmpbuf [0] > static_cast <uint64_t> (maxmsgsize))) {
+ errno = EMSGSIZE;
+ return -1;
+ }
+
+ // in_progress is initialised at this point so in theory we should
+ // close it before calling zmq_msg_init_size, however, it's a 0-byte
+ // message and thus we can treat it as uninitialised...
+ int rc = in_progress.init_size (tmpbuf [0]);
+ if (unlikely (rc)) {
+ errno_assert (errno == ENOMEM);
+ rc = in_progress.init ();
+ errno_assert (rc == 0);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ in_progress.set_flags (msg_flags);
+ next_step (in_progress.data (), in_progress.size (),
+ &v2_decoder_t::message_ready);
+
+ return 0;
+}
+
+int zmq::v2_decoder_t::eight_byte_size_ready ()
+{
+ // The payload size is encoded as 64-bit unsigned integer.
+ // The most significant byte comes first.
+ const uint64_t msg_size = get_uint64 (tmpbuf);
+
+ // Message size must not exceed the maximum allowed size.
+ if (maxmsgsize >= 0)
+ if (unlikely (msg_size > static_cast <uint64_t> (maxmsgsize))) {
+ errno = EMSGSIZE;
+ return -1;
+ }
+
+ // Message size must fit into size_t data type.
+ if (unlikely (msg_size != static_cast <size_t> (msg_size))) {
+ errno = EMSGSIZE;
+ return -1;
+ }
+
+ // in_progress is initialised at this point so in theory we should
+ // close it before calling init_size, however, it's a 0-byte
+ // message and thus we can treat it as uninitialised.
+ int rc = in_progress.init_size (static_cast <size_t> (msg_size));
+ if (unlikely (rc)) {
+ errno_assert (errno == ENOMEM);
+ rc = in_progress.init ();
+ errno_assert (rc == 0);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ in_progress.set_flags (msg_flags);
+ next_step (in_progress.data (), in_progress.size (),
+ &v2_decoder_t::message_ready);
+
+ return 0;
+}
+
+int zmq::v2_decoder_t::message_ready ()
+{
+ // Message is completely read. Signal this to the caller
+ // and prepare to decode next message.
+ next_step (tmpbuf, 1, &v2_decoder_t::flags_ready);
+ return 1;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_decoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_decoder.hpp
new file mode 100644
index 00000000..14c48e4e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_decoder.hpp
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_V2_DECODER_HPP_INCLUDED__
+#define __ZMQ_V2_DECODER_HPP_INCLUDED__
+
+#include "decoder.hpp"
+
+namespace zmq
+{
+ // Decoder for ZMTP/2.x framing protocol. Converts data stream into messages.
+ class v2_decoder_t : public decoder_base_t <v2_decoder_t>
+ {
+ public:
+
+ v2_decoder_t (size_t bufsize_, int64_t maxmsgsize_);
+ virtual ~v2_decoder_t ();
+
+ // i_decoder interface.
+ virtual msg_t *msg () { return &in_progress; }
+
+ private:
+
+ int flags_ready ();
+ int one_byte_size_ready ();
+ int eight_byte_size_ready ();
+ int message_ready ();
+
+ unsigned char tmpbuf [8];
+ unsigned char msg_flags;
+ msg_t in_progress;
+
+ const int64_t maxmsgsize;
+
+ v2_decoder_t (const v2_decoder_t&);
+ void operator = (const v2_decoder_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_encoder.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_encoder.cpp
new file mode 100644
index 00000000..1adca93d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_encoder.cpp
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "v2_protocol.hpp"
+#include "v2_encoder.hpp"
+#include "likely.hpp"
+#include "wire.hpp"
+
+zmq::v2_encoder_t::v2_encoder_t (size_t bufsize_) :
+ encoder_base_t <v2_encoder_t> (bufsize_)
+{
+ // Write 0 bytes to the batch and go to message_ready state.
+ next_step (NULL, 0, &v2_encoder_t::message_ready, true);
+}
+
+zmq::v2_encoder_t::~v2_encoder_t ()
+{
+}
+
+void zmq::v2_encoder_t::message_ready ()
+{
+ // Encode flags.
+ unsigned char &protocol_flags = tmpbuf [0];
+ protocol_flags = 0;
+ if (in_progress->flags () & msg_t::more)
+ protocol_flags |= v2_protocol_t::more_flag;
+ if (in_progress->size () > 255)
+ protocol_flags |= v2_protocol_t::large_flag;
+ if (in_progress->flags () & msg_t::command)
+ protocol_flags |= v2_protocol_t::command_flag;
+
+ // Encode the message length. For messages less then 256 bytes,
+ // the length is encoded as 8-bit unsigned integer. For larger
+ // messages, 64-bit unsigned integer in network byte order is used.
+ const size_t size = in_progress->size ();
+ if (unlikely (size > 255)) {
+ put_uint64 (tmpbuf + 1, size);
+ next_step (tmpbuf, 9, &v2_encoder_t::size_ready, false);
+ }
+ else {
+ tmpbuf [1] = static_cast <uint8_t> (size);
+ next_step (tmpbuf, 2, &v2_encoder_t::size_ready, false);
+ }
+}
+
+void zmq::v2_encoder_t::size_ready ()
+{
+ // Write message body into the buffer.
+ next_step (in_progress->data (), in_progress->size (),
+ &v2_encoder_t::message_ready, true);
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_encoder.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_encoder.hpp
new file mode 100644
index 00000000..a23f9780
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_encoder.hpp
@@ -0,0 +1,59 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_V2_ENCODER_HPP_INCLUDED__
+#define __ZMQ_V2_ENCODER_HPP_INCLUDED__
+
+#include "encoder.hpp"
+
+namespace zmq
+{
+ // Encoder for 0MQ framing protocol. Converts messages into data stream.
+
+ class v2_encoder_t : public encoder_base_t <v2_encoder_t>
+ {
+ public:
+
+ v2_encoder_t (size_t bufsize_);
+ virtual ~v2_encoder_t ();
+
+ private:
+
+ void size_ready ();
+ void message_ready ();
+
+ unsigned char tmpbuf [9];
+
+ v2_encoder_t (const v2_encoder_t&);
+ const v2_encoder_t &operator = (const v2_encoder_t&);
+ };
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_protocol.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_protocol.hpp
new file mode 100644
index 00000000..4233343c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/v2_protocol.hpp
@@ -0,0 +1,49 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_V2_PROTOCOL_HPP_INCLUDED__
+#define __ZMQ_V2_PROTOCOL_HPP_INCLUDED__
+
+namespace zmq
+{
+ // Definition of constants for ZMTP/2.0 transport protocol.
+ class v2_protocol_t
+ {
+ public:
+ // Message flags.
+ enum
+ {
+ more_flag = 1,
+ large_flag = 2,
+ command_flag = 4
+ };
+ };
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/windows.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/windows.hpp
new file mode 100644
index 00000000..3ced6adf
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/windows.hpp
@@ -0,0 +1,83 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_WINDOWS_HPP_INCLUDED__
+#define __ZMQ_WINDOWS_HPP_INCLUDED__
+
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+#ifndef NOMINMAX
+#define NOMINMAX // Macros min(a,b) and max(a,b)
+#endif
+
+// Set target version to Windows Server 2003, Windows XP/SP1 or higher.
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+
+#ifdef __MINGW32__
+// Require Windows XP or higher with MinGW for getaddrinfo().
+#if(_WIN32_WINNT >= 0x0501)
+#else
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+#endif
+
+#include <winsock2.h>
+#include <windows.h>
+#include <mswsock.h>
+
+#if !defined __MINGW32__
+#include <Mstcpip.h>
+#endif
+
+// Workaround missing Mstcpip.h in mingw32 (MinGW64 provides this)
+// __MINGW64_VERSION_MAJOR is only defined when using in mingw-w64
+#if defined __MINGW32__ && !defined SIO_KEEPALIVE_VALS && !defined __MINGW64_VERSION_MAJOR
+struct tcp_keepalive {
+ u_long onoff;
+ u_long keepalivetime;
+ u_long keepaliveinterval;
+};
+#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4)
+#endif
+
+#include <ws2tcpip.h>
+#include <ipexport.h>
+#if !defined _WIN32_WCE
+#include <process.h>
+#endif
+
+// In MinGW environment AI_NUMERICSERV is not defined.
+#ifndef AI_NUMERICSERV
+#define AI_NUMERICSERV 0x0400
+#endif
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/wire.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/wire.hpp
new file mode 100644
index 00000000..6c2bee0e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/wire.hpp
@@ -0,0 +1,108 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_WIRE_HPP_INCLUDED__
+#define __ZMQ_WIRE_HPP_INCLUDED__
+
+#include "stdint.hpp"
+
+namespace zmq
+{
+
+ // Helper functions to convert different integer types to/from network
+ // byte order.
+
+ inline void put_uint8 (unsigned char *buffer_, uint8_t value)
+ {
+ *buffer_ = value;
+ }
+
+ inline uint8_t get_uint8 (const unsigned char *buffer_)
+ {
+ return *buffer_;
+ }
+
+ inline void put_uint16 (unsigned char *buffer_, uint16_t value)
+ {
+ buffer_ [0] = (unsigned char) (((value) >> 8) & 0xff);
+ buffer_ [1] = (unsigned char) (value & 0xff);
+ }
+
+ inline uint16_t get_uint16 (const unsigned char *buffer_)
+ {
+ return
+ (((uint16_t) buffer_ [0]) << 8) |
+ ((uint16_t) buffer_ [1]);
+ }
+
+ inline void put_uint32 (unsigned char *buffer_, uint32_t value)
+ {
+ buffer_ [0] = (unsigned char) (((value) >> 24) & 0xff);
+ buffer_ [1] = (unsigned char) (((value) >> 16) & 0xff);
+ buffer_ [2] = (unsigned char) (((value) >> 8) & 0xff);
+ buffer_ [3] = (unsigned char) (value & 0xff);
+ }
+
+ inline uint32_t get_uint32 (const unsigned char *buffer_)
+ {
+ return
+ (((uint32_t) buffer_ [0]) << 24) |
+ (((uint32_t) buffer_ [1]) << 16) |
+ (((uint32_t) buffer_ [2]) << 8) |
+ ((uint32_t) buffer_ [3]);
+ }
+
+ inline void put_uint64 (unsigned char *buffer_, uint64_t value)
+ {
+ buffer_ [0] = (unsigned char) (((value) >> 56) & 0xff);
+ buffer_ [1] = (unsigned char) (((value) >> 48) & 0xff);
+ buffer_ [2] = (unsigned char) (((value) >> 40) & 0xff);
+ buffer_ [3] = (unsigned char) (((value) >> 32) & 0xff);
+ buffer_ [4] = (unsigned char) (((value) >> 24) & 0xff);
+ buffer_ [5] = (unsigned char) (((value) >> 16) & 0xff);
+ buffer_ [6] = (unsigned char) (((value) >> 8) & 0xff);
+ buffer_ [7] = (unsigned char) (value & 0xff);
+ }
+
+ inline uint64_t get_uint64 (const unsigned char *buffer_)
+ {
+ return
+ (((uint64_t) buffer_ [0]) << 56) |
+ (((uint64_t) buffer_ [1]) << 48) |
+ (((uint64_t) buffer_ [2]) << 40) |
+ (((uint64_t) buffer_ [3]) << 32) |
+ (((uint64_t) buffer_ [4]) << 24) |
+ (((uint64_t) buffer_ [5]) << 16) |
+ (((uint64_t) buffer_ [6]) << 8) |
+ ((uint64_t) buffer_ [7]);
+ }
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xpub.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xpub.cpp
new file mode 100644
index 00000000..445ef060
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xpub.cpp
@@ -0,0 +1,207 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+#include "xpub.hpp"
+#include "pipe.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+
+zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ socket_base_t (parent_, tid_, sid_),
+ verbose (false),
+ more (false),
+ lossy (true)
+{
+ options.type = ZMQ_XPUB;
+}
+
+zmq::xpub_t::~xpub_t ()
+{
+}
+
+void zmq::xpub_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ zmq_assert (pipe_);
+ dist.attach (pipe_);
+
+ // If subscribe_to_all_ is specified, the caller would like to subscribe
+ // to all data on this pipe, implicitly.
+ if (subscribe_to_all_)
+ subscriptions.add (NULL, 0, pipe_);
+
+ // The pipe is active when attached. Let's read the subscriptions from
+ // it, if any.
+ xread_activated (pipe_);
+}
+
+void zmq::xpub_t::xread_activated (pipe_t *pipe_)
+{
+ // There are some subscriptions waiting. Let's process them.
+ msg_t sub;
+ while (pipe_->read (&sub)) {
+ // Apply the subscription to the trie
+ unsigned char *const data = (unsigned char *) sub.data ();
+ const size_t size = sub.size ();
+ if (size > 0 && (*data == 0 || *data == 1)) {
+ bool unique;
+ if (*data == 0)
+ unique = subscriptions.rm (data + 1, size - 1, pipe_);
+ else
+ unique = subscriptions.add (data + 1, size - 1, pipe_);
+
+ // If the subscription is not a duplicate store it so that it can be
+ // passed to used on next recv call. (Unsubscribe is not verbose.)
+ if (options.type == ZMQ_XPUB && (unique || (*data && verbose))) {
+ pending_data.push_back (blob_t (data, size));
+ pending_flags.push_back (0);
+ }
+ }
+ else {
+ // Process user message coming upstream from xsub socket
+ pending_data.push_back (blob_t (data, size));
+ pending_flags.push_back (sub.flags ());
+ }
+ sub.close ();
+ }
+}
+
+void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
+{
+ dist.activated (pipe_);
+}
+
+int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
+ size_t optvallen_)
+{
+ if (optvallen_ != sizeof (int) || *static_cast <const int*> (optval_) < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (option_ == ZMQ_XPUB_VERBOSE)
+ verbose = (*static_cast <const int*> (optval_) != 0);
+ else
+ if (option_ == ZMQ_XPUB_NODROP)
+ lossy = (*static_cast <const int*> (optval_) == 0);
+ else {
+ errno = EINVAL;
+ return -1;
+ }
+ return 0;
+}
+
+void zmq::xpub_t::xpipe_terminated (pipe_t *pipe_)
+{
+ // Remove the pipe from the trie. If there are topics that nobody
+ // is interested in anymore, send corresponding unsubscriptions
+ // upstream.
+ subscriptions.rm (pipe_, send_unsubscription, this);
+
+ dist.pipe_terminated (pipe_);
+}
+
+void zmq::xpub_t::mark_as_matching (pipe_t *pipe_, void *arg_)
+{
+ xpub_t *self = (xpub_t*) arg_;
+ self->dist.match (pipe_);
+}
+
+int zmq::xpub_t::xsend (msg_t *msg_)
+{
+ bool msg_more = msg_->flags () & msg_t::more ? true : false;
+
+ // For the first part of multi-part message, find the matching pipes.
+ if (!more)
+ subscriptions.match ((unsigned char*) msg_->data (), msg_->size (),
+ mark_as_matching, this);
+
+ int rc = -1; // Assume we fail
+ if (lossy || dist.check_hwm ()) {
+ if (dist.send_to_matching (msg_) == 0) {
+ // If we are at the end of multi-part message we can mark
+ // all the pipes as non-matching.
+ if (!msg_more)
+ dist.unmatch ();
+ more = msg_more;
+ rc = 0; // Yay, sent successfully
+ }
+ }
+ else
+ errno = EAGAIN;
+ return rc;
+}
+
+bool zmq::xpub_t::xhas_out ()
+{
+ return dist.has_out ();
+}
+
+int zmq::xpub_t::xrecv (msg_t *msg_)
+{
+ // If there is at least one
+ if (pending_data.empty ()) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init_size (pending_data.front ().size ());
+ errno_assert (rc == 0);
+ memcpy (msg_->data (),
+ pending_data.front ().data (),
+ pending_data.front ().size ());
+ msg_->set_flags (pending_flags.front ());
+ pending_data.pop_front ();
+ pending_flags.pop_front ();
+ return 0;
+}
+
+bool zmq::xpub_t::xhas_in ()
+{
+ return !pending_data.empty ();
+}
+
+void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
+ void *arg_)
+{
+ xpub_t *self = (xpub_t*) arg_;
+
+ if (self->options.type != ZMQ_PUB) {
+ // Place the unsubscription to the queue of pending (un)sunscriptions
+ // to be retrived by the user later on.
+ blob_t unsub (size_ + 1, 0);
+ unsub [0] = 0;
+ if (size_ > 0)
+ memcpy (&unsub [1], data_, size_);
+ self->pending_data.push_back (unsub);
+ self->pending_flags.push_back (0);
+ }
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xpub.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xpub.hpp
new file mode 100644
index 00000000..549b670c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xpub.hpp
@@ -0,0 +1,107 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_XPUB_HPP_INCLUDED__
+#define __ZMQ_XPUB_HPP_INCLUDED__
+
+#include <deque>
+#include <string>
+
+#include "socket_base.hpp"
+#include "session_base.hpp"
+#include "mtrie.hpp"
+#include "array.hpp"
+#include "dist.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class msg_t;
+ class pipe_t;
+ class io_thread_t;
+
+ class xpub_t :
+ public socket_base_t
+ {
+ public:
+
+ xpub_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ ~xpub_t ();
+
+ // Implementations of virtual functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_ = false);
+ int xsend (zmq::msg_t *msg_);
+ bool xhas_out ();
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ void xread_activated (zmq::pipe_t *pipe_);
+ void xwrite_activated (zmq::pipe_t *pipe_);
+ int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+
+ private:
+
+ // Function to be applied to the trie to send all the subsciptions
+ // upstream.
+ static void send_unsubscription (unsigned char *data_, size_t size_,
+ void *arg_);
+
+ // Function to be applied to each matching pipes.
+ static void mark_as_matching (zmq::pipe_t *pipe_, void *arg_);
+
+ // List of all subscriptions mapped to corresponding pipes.
+ mtrie_t subscriptions;
+
+ // Distributor of messages holding the list of outbound pipes.
+ dist_t dist;
+
+ // If true, send all subscription messages upstream, not just
+ // unique ones
+ bool verbose;
+
+ // True if we are in the middle of sending a multi-part message.
+ bool more;
+
+ // Drop messages if HWM reached, otherwise return with EAGAIN
+ bool lossy;
+
+ // List of pending (un)subscriptions, ie. those that were already
+ // applied to the trie, but not yet received by the user.
+ typedef std::basic_string <unsigned char> blob_t;
+ std::deque <blob_t> pending_data;
+ std::deque <unsigned char> pending_flags;
+
+ xpub_t (const xpub_t&);
+ const xpub_t &operator = (const xpub_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xsub.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xsub.cpp
new file mode 100644
index 00000000..5d9efddf
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xsub.cpp
@@ -0,0 +1,243 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+#include "xsub.hpp"
+#include "err.hpp"
+
+zmq::xsub_t::xsub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+ socket_base_t (parent_, tid_, sid_),
+ has_message (false),
+ more (false)
+{
+ options.type = ZMQ_XSUB;
+
+ // When socket is being closed down we don't want to wait till pending
+ // subscription commands are sent to the wire.
+ options.linger = 0;
+
+ int rc = message.init ();
+ errno_assert (rc == 0);
+}
+
+zmq::xsub_t::~xsub_t ()
+{
+ int rc = message.close ();
+ errno_assert (rc == 0);
+}
+
+void zmq::xsub_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
+{
+ // subscribe_to_all_ is unused
+ (void) subscribe_to_all_;
+
+ zmq_assert (pipe_);
+ fq.attach (pipe_);
+ dist.attach (pipe_);
+
+ // Send all the cached subscriptions to the new upstream peer.
+ subscriptions.apply (send_subscription, pipe_);
+ pipe_->flush ();
+}
+
+void zmq::xsub_t::xread_activated (pipe_t *pipe_)
+{
+ fq.activated (pipe_);
+}
+
+void zmq::xsub_t::xwrite_activated (pipe_t *pipe_)
+{
+ dist.activated (pipe_);
+}
+
+void zmq::xsub_t::xpipe_terminated (pipe_t *pipe_)
+{
+ fq.pipe_terminated (pipe_);
+ dist.pipe_terminated (pipe_);
+}
+
+void zmq::xsub_t::xhiccuped (pipe_t *pipe_)
+{
+ // Send all the cached subscriptions to the hiccuped pipe.
+ subscriptions.apply (send_subscription, pipe_);
+ pipe_->flush ();
+}
+
+int zmq::xsub_t::xsend (msg_t *msg_)
+{
+ size_t size = msg_->size ();
+ unsigned char *data = (unsigned char *) msg_->data ();
+
+ if (size > 0 && *data == 1) {
+ // Process subscribe message
+ // This used to filter out duplicate subscriptions,
+ // however this is alread done on the XPUB side and
+ // doing it here as well breaks ZMQ_XPUB_VERBOSE
+ // when there are forwarding devices involved.
+ subscriptions.add (data + 1, size - 1);
+ return dist.send_to_all (msg_);
+ }
+ else
+ if (size > 0 && *data == 0) {
+ // Process unsubscribe message
+ if (subscriptions.rm (data + 1, size - 1))
+ return dist.send_to_all (msg_);
+ }
+ else
+ // User message sent upstream to XPUB socket
+ return dist.send_to_all (msg_);
+
+ int rc = msg_->close ();
+ errno_assert (rc == 0);
+ rc = msg_->init ();
+ errno_assert (rc == 0);
+
+ return 0;
+}
+
+bool zmq::xsub_t::xhas_out ()
+{
+ // Subscription can be added/removed anytime.
+ return true;
+}
+
+int zmq::xsub_t::xrecv (msg_t *msg_)
+{
+ // If there's already a message prepared by a previous call to zmq_poll,
+ // return it straight ahead.
+ if (has_message) {
+ int rc = msg_->move (message);
+ errno_assert (rc == 0);
+ has_message = false;
+ more = msg_->flags () & msg_t::more ? true : false;
+ return 0;
+ }
+
+ // TODO: This can result in infinite loop in the case of continuous
+ // stream of non-matching messages which breaks the non-blocking recv
+ // semantics.
+ while (true) {
+
+ // Get a message using fair queueing algorithm.
+ int rc = fq.recv (msg_);
+
+ // If there's no message available, return immediately.
+ // The same when error occurs.
+ if (rc != 0)
+ return -1;
+
+ // Check whether the message matches at least one subscription.
+ // Non-initial parts of the message are passed
+ if (more || !options.filter || match (msg_)) {
+ more = msg_->flags () & msg_t::more ? true : false;
+ return 0;
+ }
+
+ // Message doesn't match. Pop any remaining parts of the message
+ // from the pipe.
+ while (msg_->flags () & msg_t::more) {
+ rc = fq.recv (msg_);
+ errno_assert (rc == 0);
+ }
+ }
+}
+
+bool zmq::xsub_t::xhas_in ()
+{
+ // There are subsequent parts of the partly-read message available.
+ if (more)
+ return true;
+
+ // If there's already a message prepared by a previous call to zmq_poll,
+ // return straight ahead.
+ if (has_message)
+ return true;
+
+ // TODO: This can result in infinite loop in the case of continuous
+ // stream of non-matching messages.
+ while (true) {
+
+ // Get a message using fair queueing algorithm.
+ int rc = fq.recv (&message);
+
+ // If there's no message available, return immediately.
+ // The same when error occurs.
+ if (rc != 0) {
+ errno_assert (errno == EAGAIN);
+ return false;
+ }
+
+ // Check whether the message matches at least one subscription.
+ if (!options.filter || match (&message)) {
+ has_message = true;
+ return true;
+ }
+
+ // Message doesn't match. Pop any remaining parts of the message
+ // from the pipe.
+ while (message.flags () & msg_t::more) {
+ rc = fq.recv (&message);
+ errno_assert (rc == 0);
+ }
+ }
+}
+
+zmq::blob_t zmq::xsub_t::get_credential () const
+{
+ return fq.get_credential ();
+}
+
+bool zmq::xsub_t::match (msg_t *msg_)
+{
+ return subscriptions.check ((unsigned char*) msg_->data (), msg_->size ());
+}
+
+void zmq::xsub_t::send_subscription (unsigned char *data_, size_t size_,
+ void *arg_)
+{
+ pipe_t *pipe = (pipe_t*) arg_;
+
+ // Create the subsctription message.
+ msg_t msg;
+ int rc = msg.init_size (size_ + 1);
+ errno_assert (rc == 0);
+ unsigned char *data = (unsigned char*) msg.data ();
+ data [0] = 1;
+ memcpy (data + 1, data_, size_);
+
+ // Send it to the pipe.
+ bool sent = pipe->write (&msg);
+ // If we reached the SNDHWM, and thus cannot send the subscription, drop
+ // the subscription message instead. This matches the behaviour of
+ // zmq_setsockopt(ZMQ_SUBSCRIBE, ...), which also drops subscriptions
+ // when the SNDHWM is reached.
+ if (!sent)
+ msg.close ();
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xsub.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xsub.hpp
new file mode 100644
index 00000000..3a15fe7f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/xsub.hpp
@@ -0,0 +1,103 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_XSUB_HPP_INCLUDED__
+#define __ZMQ_XSUB_HPP_INCLUDED__
+
+#include "socket_base.hpp"
+#include "session_base.hpp"
+#include "dist.hpp"
+#include "fq.hpp"
+#include "trie.hpp"
+
+namespace zmq
+{
+
+ class ctx_t;
+ class pipe_t;
+ class io_thread_t;
+
+ class xsub_t :
+ public socket_base_t
+ {
+ public:
+
+ xsub_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ ~xsub_t ();
+
+ protected:
+
+ // Overrides of functions from socket_base_t.
+ void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
+ int xsend (zmq::msg_t *msg_);
+ bool xhas_out ();
+ int xrecv (zmq::msg_t *msg_);
+ bool xhas_in ();
+ blob_t get_credential () const;
+ void xread_activated (zmq::pipe_t *pipe_);
+ void xwrite_activated (zmq::pipe_t *pipe_);
+ void xhiccuped (pipe_t *pipe_);
+ void xpipe_terminated (zmq::pipe_t *pipe_);
+
+ private:
+
+ // Check whether the message matches at least one subscription.
+ bool match (zmq::msg_t *msg_);
+
+ // Function to be applied to the trie to send all the subsciptions
+ // upstream.
+ static void send_subscription (unsigned char *data_, size_t size_,
+ void *arg_);
+
+ // Fair queueing object for inbound pipes.
+ fq_t fq;
+
+ // Object for distributing the subscriptions upstream.
+ dist_t dist;
+
+ // The repository of subscriptions.
+ trie_t subscriptions;
+
+ // If true, 'message' contains a matching message to return on the
+ // next recv call.
+ bool has_message;
+ msg_t message;
+
+ // If true, part of a multipart message was already received, but
+ // there are following parts still waiting.
+ bool more;
+
+ xsub_t (const xsub_t&);
+ const xsub_t &operator = (const xsub_t&);
+ };
+
+}
+
+#endif
+
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe.hpp
new file mode 100644
index 00000000..c3f2e96d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe.hpp
@@ -0,0 +1,219 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_YPIPE_HPP_INCLUDED__
+#define __ZMQ_YPIPE_HPP_INCLUDED__
+
+#include "atomic_ptr.hpp"
+#include "yqueue.hpp"
+#include "platform.hpp"
+#include "ypipe_base.hpp"
+
+namespace zmq
+{
+
+ // Lock-free queue implementation.
+ // Only a single thread can read from the pipe at any specific moment.
+ // Only a single thread can write to the pipe at any specific moment.
+ // T is the type of the object in the queue.
+ // N is granularity of the pipe, i.e. how many items are needed to
+ // perform next memory allocation.
+
+ template <typename T, int N> class ypipe_t : public ypipe_base_t <T>
+ {
+ public:
+
+ // Initialises the pipe.
+ inline ypipe_t ()
+ {
+ // Insert terminator element into the queue.
+ queue.push ();
+
+ // Let all the pointers to point to the terminator.
+ // (unless pipe is dead, in which case c is set to NULL).
+ r = w = f = &queue.back ();
+ c.set (&queue.back ());
+ }
+
+ // The destructor doesn't have to be virtual. It is mad virtual
+ // just to keep ICC and code checking tools from complaining.
+ inline virtual ~ypipe_t ()
+ {
+ }
+
+ // Following function (write) deliberately copies uninitialised data
+ // when used with zmq_msg. Initialising the VSM body for
+ // non-VSM messages won't be good for performance.
+
+#ifdef ZMQ_HAVE_OPENVMS
+#pragma message save
+#pragma message disable(UNINIT)
+#endif
+
+ // Write an item to the pipe. Don't flush it yet. If incomplete is
+ // set to true the item is assumed to be continued by items
+ // subsequently written to the pipe. Incomplete items are never
+ // flushed down the stream.
+ inline void write (const T &value_, bool incomplete_)
+ {
+ // Place the value to the queue, add new terminator element.
+ queue.back () = value_;
+ queue.push ();
+
+ // Move the "flush up to here" poiter.
+ if (!incomplete_)
+ f = &queue.back ();
+ }
+
+#ifdef ZMQ_HAVE_OPENVMS
+#pragma message restore
+#endif
+
+ // Pop an incomplete item from the pipe. Returns true is such
+ // item exists, false otherwise.
+ inline bool unwrite (T *value_)
+ {
+ if (f == &queue.back ())
+ return false;
+ queue.unpush ();
+ *value_ = queue.back ();
+ return true;
+ }
+
+ // Flush all the completed items into the pipe. Returns false if
+ // the reader thread is sleeping. In that case, caller is obliged to
+ // wake the reader up before using the pipe again.
+ inline bool flush ()
+ {
+ // If there are no un-flushed items, do nothing.
+ if (w == f)
+ return true;
+
+ // Try to set 'c' to 'f'.
+ if (c.cas (w, f) != w) {
+
+ // Compare-and-swap was unseccessful because 'c' is NULL.
+ // This means that the reader is asleep. Therefore we don't
+ // care about thread-safeness and update c in non-atomic
+ // manner. We'll return false to let the caller know
+ // that reader is sleeping.
+ c.set (f);
+ w = f;
+ return false;
+ }
+
+ // Reader is alive. Nothing special to do now. Just move
+ // the 'first un-flushed item' pointer to 'f'.
+ w = f;
+ return true;
+ }
+
+ // Check whether item is available for reading.
+ inline bool check_read ()
+ {
+ // Was the value prefetched already? If so, return.
+ if (&queue.front () != r && r)
+ return true;
+
+ // There's no prefetched value, so let us prefetch more values.
+ // Prefetching is to simply retrieve the
+ // pointer from c in atomic fashion. If there are no
+ // items to prefetch, set c to NULL (using compare-and-swap).
+ r = c.cas (&queue.front (), NULL);
+
+ // If there are no elements prefetched, exit.
+ // During pipe's lifetime r should never be NULL, however,
+ // it can happen during pipe shutdown when items
+ // are being deallocated.
+ if (&queue.front () == r || !r)
+ return false;
+
+ // There was at least one value prefetched.
+ return true;
+ }
+
+ // Reads an item from the pipe. Returns false if there is no value.
+ // available.
+ inline bool read (T *value_)
+ {
+ // Try to prefetch a value.
+ if (!check_read ())
+ return false;
+
+ // There was at least one value prefetched.
+ // Return it to the caller.
+ *value_ = queue.front ();
+ queue.pop ();
+ return true;
+ }
+
+ // Applies the function fn to the first elemenent in the pipe
+ // and returns the value returned by the fn.
+ // The pipe mustn't be empty or the function crashes.
+ inline bool probe (bool (*fn)(const T &))
+ {
+ bool rc = check_read ();
+ zmq_assert (rc);
+
+ return (*fn) (queue.front ());
+ }
+
+ protected:
+
+ // Allocation-efficient queue to store pipe items.
+ // Front of the queue points to the first prefetched item, back of
+ // the pipe points to last un-flushed item. Front is used only by
+ // reader thread, while back is used only by writer thread.
+ yqueue_t <T, N> queue;
+
+ // Points to the first un-flushed item. This variable is used
+ // exclusively by writer thread.
+ T *w;
+
+ // Points to the first un-prefetched item. This variable is used
+ // exclusively by reader thread.
+ T *r;
+
+ // Points to the first item to be flushed in the future.
+ T *f;
+
+ // The single point of contention between writer and reader thread.
+ // Points past the last flushed item. If it is NULL,
+ // reader is asleep. This pointer should be always accessed using
+ // atomic operations.
+ atomic_ptr_t <T> c;
+
+ // Disable copying of ypipe object.
+ ypipe_t (const ypipe_t&);
+ const ypipe_t &operator = (const ypipe_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe_base.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe_base.hpp
new file mode 100644
index 00000000..c541d2fb
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe_base.hpp
@@ -0,0 +1,54 @@
+
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_YPIPE_BASE_HPP_INCLUDED__
+#define __ZMQ_YPIPE_BASE_HPP_INCLUDED__
+
+
+namespace zmq
+{
+ // ypipe_base abstracts ypipe and ypipe_conflate specific
+ // classes, one is selected according to a the conflate
+ // socket option
+
+ template <typename T> class ypipe_base_t
+ {
+ public:
+ virtual ~ypipe_base_t () {}
+ virtual void write (const T &value_, bool incomplete_) = 0;
+ virtual bool unwrite (T *value_) = 0;
+ virtual bool flush () = 0;
+ virtual bool check_read () = 0;
+ virtual bool read (T *value_) = 0;
+ virtual bool probe (bool (*fn)(const T &)) = 0;
+ };
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe_conflate.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe_conflate.hpp
new file mode 100644
index 00000000..683137a9
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/ypipe_conflate.hpp
@@ -0,0 +1,137 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_YPIPE_CONFLATE_HPP_INCLUDED__
+#define __ZMQ_YPIPE_CONFLATE_HPP_INCLUDED__
+
+#include "platform.hpp"
+#include "dbuffer.hpp"
+#include "ypipe_base.hpp"
+
+namespace zmq
+{
+
+ // Adapter for dbuffer, to plug it in instead of a queue for the sake
+ // of implementing the conflate socket option, which, if set, makes
+ // the receiving side to discard all incoming messages but the last one.
+ //
+ // reader_awake flag is needed here to mimic ypipe delicate behaviour
+ // around the reader being asleep (see 'c' pointer being NULL in ypipe.hpp)
+
+ template <typename T> class ypipe_conflate_t : public ypipe_base_t <T>
+ {
+ public:
+
+ // Initialises the pipe.
+ inline ypipe_conflate_t ()
+ : reader_awake(false)
+ {
+ }
+
+ // The destructor doesn't have to be virtual. It is mad virtual
+ // just to keep ICC and code checking tools from complaining.
+ inline virtual ~ypipe_conflate_t ()
+ {
+ }
+
+ // Following function (write) deliberately copies uninitialised data
+ // when used with zmq_msg. Initialising the VSM body for
+ // non-VSM messages won't be good for performance.
+
+#ifdef ZMQ_HAVE_OPENVMS
+#pragma message save
+#pragma message disable(UNINIT)
+#endif
+ inline void write (const T &value_, bool incomplete_)
+ {
+ (void)incomplete_;
+
+ dbuffer.write (value_);
+ }
+
+#ifdef ZMQ_HAVE_OPENVMS
+#pragma message restore
+#endif
+
+ // There are no incomplete items for conflate ypipe
+ inline bool unwrite (T *)
+ {
+ return false;
+ }
+
+ // Flush is no-op for conflate ypipe. Reader asleep behaviour
+ // is as of the usual ypipe.
+ // Returns false if the reader thread is sleeping. In that case,
+ // caller is obliged to wake the reader up before using the pipe again.
+ inline bool flush ()
+ {
+ return reader_awake;
+ }
+
+ // Check whether item is available for reading.
+ inline bool check_read ()
+ {
+ bool res = dbuffer.check_read ();
+ if (!res)
+ reader_awake = false;
+
+ return res;
+ }
+
+ // Reads an item from the pipe. Returns false if there is no value.
+ // available.
+ inline bool read (T *value_)
+ {
+ if (!check_read ())
+ return false;
+
+ return dbuffer.read (value_);
+ }
+
+ // Applies the function fn to the first elemenent in the pipe
+ // and returns the value returned by the fn.
+ // The pipe mustn't be empty or the function crashes.
+ inline bool probe (bool (*fn)(const T &))
+ {
+ return dbuffer.probe (fn);
+ }
+
+ protected:
+
+ dbuffer_t <T> dbuffer;
+ bool reader_awake;
+
+ // Disable copying of ypipe object.
+ ypipe_conflate_t (const ypipe_conflate_t&);
+ const ypipe_conflate_t &operator = (const ypipe_conflate_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/yqueue.hpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/yqueue.hpp
new file mode 100644
index 00000000..bd42b8a6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/yqueue.hpp
@@ -0,0 +1,205 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_YQUEUE_HPP_INCLUDED__
+#define __ZMQ_YQUEUE_HPP_INCLUDED__
+
+#include <stdlib.h>
+#include <stddef.h>
+
+#include "err.hpp"
+#include "atomic_ptr.hpp"
+
+namespace zmq
+{
+
+ // yqueue is an efficient queue implementation. The main goal is
+ // to minimise number of allocations/deallocations needed. Thus yqueue
+ // allocates/deallocates elements in batches of N.
+ //
+ // yqueue allows one thread to use push/back function and another one
+ // to use pop/front functions. However, user must ensure that there's no
+ // pop on the empty queue and that both threads don't access the same
+ // element in unsynchronised manner.
+ //
+ // T is the type of the object in the queue.
+ // N is granularity of the queue (how many pushes have to be done till
+ // actual memory allocation is required).
+
+ template <typename T, int N> class yqueue_t
+ {
+ public:
+
+ // Create the queue.
+ inline yqueue_t ()
+ {
+ begin_chunk = (chunk_t*) malloc (sizeof (chunk_t));
+ alloc_assert (begin_chunk);
+ begin_pos = 0;
+ back_chunk = NULL;
+ back_pos = 0;
+ end_chunk = begin_chunk;
+ end_pos = 0;
+ }
+
+ // Destroy the queue.
+ inline ~yqueue_t ()
+ {
+ while (true) {
+ if (begin_chunk == end_chunk) {
+ free (begin_chunk);
+ break;
+ }
+ chunk_t *o = begin_chunk;
+ begin_chunk = begin_chunk->next;
+ free (o);
+ }
+
+ chunk_t *sc = spare_chunk.xchg (NULL);
+ free (sc);
+ }
+
+ // Returns reference to the front element of the queue.
+ // If the queue is empty, behaviour is undefined.
+ inline T &front ()
+ {
+ return begin_chunk->values [begin_pos];
+ }
+
+ // Returns reference to the back element of the queue.
+ // If the queue is empty, behaviour is undefined.
+ inline T &back ()
+ {
+ return back_chunk->values [back_pos];
+ }
+
+ // Adds an element to the back end of the queue.
+ inline void push ()
+ {
+ back_chunk = end_chunk;
+ back_pos = end_pos;
+
+ if (++end_pos != N)
+ return;
+
+ chunk_t *sc = spare_chunk.xchg (NULL);
+ if (sc) {
+ end_chunk->next = sc;
+ sc->prev = end_chunk;
+ } else {
+ end_chunk->next = (chunk_t*) malloc (sizeof (chunk_t));
+ alloc_assert (end_chunk->next);
+ end_chunk->next->prev = end_chunk;
+ }
+ end_chunk = end_chunk->next;
+ end_pos = 0;
+ }
+
+ // Removes element from the back end of the queue. In other words
+ // it rollbacks last push to the queue. Take care: Caller is
+ // responsible for destroying the object being unpushed.
+ // The caller must also guarantee that the queue isn't empty when
+ // unpush is called. It cannot be done automatically as the read
+ // side of the queue can be managed by different, completely
+ // unsynchronised thread.
+ inline void unpush ()
+ {
+ // First, move 'back' one position backwards.
+ if (back_pos)
+ --back_pos;
+ else {
+ back_pos = N - 1;
+ back_chunk = back_chunk->prev;
+ }
+
+ // Now, move 'end' position backwards. Note that obsolete end chunk
+ // is not used as a spare chunk. The analysis shows that doing so
+ // would require free and atomic operation per chunk deallocated
+ // instead of a simple free.
+ if (end_pos)
+ --end_pos;
+ else {
+ end_pos = N - 1;
+ end_chunk = end_chunk->prev;
+ free (end_chunk->next);
+ end_chunk->next = NULL;
+ }
+ }
+
+ // Removes an element from the front end of the queue.
+ inline void pop ()
+ {
+ if (++ begin_pos == N) {
+ chunk_t *o = begin_chunk;
+ begin_chunk = begin_chunk->next;
+ begin_chunk->prev = NULL;
+ begin_pos = 0;
+
+ // 'o' has been more recently used than spare_chunk,
+ // so for cache reasons we'll get rid of the spare and
+ // use 'o' as the spare.
+ chunk_t *cs = spare_chunk.xchg (o);
+ free (cs);
+ }
+ }
+
+ private:
+
+ // Individual memory chunk to hold N elements.
+ struct chunk_t
+ {
+ T values [N];
+ chunk_t *prev;
+ chunk_t *next;
+ };
+
+ // Back position may point to invalid memory if the queue is empty,
+ // while begin & end positions are always valid. Begin position is
+ // accessed exclusively be queue reader (front/pop), while back and
+ // end positions are accessed exclusively by queue writer (back/push).
+ chunk_t *begin_chunk;
+ int begin_pos;
+ chunk_t *back_chunk;
+ int back_pos;
+ chunk_t *end_chunk;
+ int end_pos;
+
+ // People are likely to produce and consume at similar rates. In
+ // this scenario holding onto the most recently freed chunk saves
+ // us from having to call malloc/free.
+ atomic_ptr_t<chunk_t> spare_chunk;
+
+ // Disable copying of yqueue.
+ yqueue_t (const yqueue_t&);
+ const yqueue_t &operator = (const yqueue_t&);
+ };
+
+}
+
+#endif
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/zmq.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/zmq.cpp
new file mode 100644
index 00000000..f0f9a099
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/zmq.cpp
@@ -0,0 +1,1095 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+#define ZMQ_TYPE_UNSAFE
+
+#include "poller.hpp"
+
+// On AIX platform, poll.h has to be included first to get consistent
+// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents'
+// instead of 'events' and 'revents' and defines macros to map from POSIX-y
+// names to AIX-specific names).
+#if defined ZMQ_POLL_BASED_ON_POLL
+#include <poll.h>
+#endif
+
+// zmq.h must be included *after* poll.h for AIX to build properly
+#include "../include/zmq.h"
+
+#if defined ZMQ_HAVE_WINDOWS
+#include "windows.hpp"
+#else
+#include <unistd.h>
+#endif
+
+
+// XSI vector I/O
+#if defined ZMQ_HAVE_UIO
+#include <sys/uio.h>
+#else
+struct iovec {
+ void *iov_base;
+ size_t iov_len;
+};
+#endif
+
+
+#include <string.h>
+#include <stdlib.h>
+#include <new>
+
+#include "proxy.hpp"
+#include "socket_base.hpp"
+#include "stdint.hpp"
+#include "config.hpp"
+#include "likely.hpp"
+#include "clock.hpp"
+#include "ctx.hpp"
+#include "err.hpp"
+#include "msg.hpp"
+#include "fd.hpp"
+#include "metadata.hpp"
+
+#if !defined ZMQ_HAVE_WINDOWS
+#include <unistd.h>
+#endif
+
+#if defined ZMQ_HAVE_OPENPGM
+#define __PGM_WININT_H__
+#include <pgm/pgm.h>
+#endif
+
+// Compile time check whether msg_t fits into zmq_msg_t.
+typedef char check_msg_t_size
+ [sizeof (zmq::msg_t) == sizeof (zmq_msg_t) ? 1 : -1];
+
+
+void zmq_version (int *major_, int *minor_, int *patch_)
+{
+ *major_ = ZMQ_VERSION_MAJOR;
+ *minor_ = ZMQ_VERSION_MINOR;
+ *patch_ = ZMQ_VERSION_PATCH;
+}
+
+
+const char *zmq_strerror (int errnum_)
+{
+ return zmq::errno_to_string (errnum_);
+}
+
+int zmq_errno (void)
+{
+ return errno;
+}
+
+
+// New context API
+
+void *zmq_ctx_new (void)
+{
+#if defined ZMQ_HAVE_OPENPGM
+
+ // Init PGM transport. Ensure threading and timer are enabled. Find PGM
+ // protocol ID. Note that if you want to use gettimeofday and sleep for
+ // openPGM timing, set environment variables PGM_TIMER to "GTOD" and
+ // PGM_SLEEP to "USLEEP".
+ pgm_error_t *pgm_error = NULL;
+ const bool ok = pgm_init (&pgm_error);
+ if (ok != TRUE) {
+
+ // Invalid parameters don't set pgm_error_t
+ zmq_assert (pgm_error != NULL);
+ if (pgm_error->domain == PGM_ERROR_DOMAIN_TIME && (
+ pgm_error->code == PGM_ERROR_FAILED)) {
+
+ // Failed to access RTC or HPET device.
+ pgm_error_free (pgm_error);
+ errno = EINVAL;
+ return NULL;
+ }
+
+ // PGM_ERROR_DOMAIN_ENGINE: WSAStartup errors or missing WSARecvMsg.
+ zmq_assert (false);
+ }
+#endif
+
+#ifdef ZMQ_HAVE_WINDOWS
+ // Intialise Windows sockets. Note that WSAStartup can be called multiple
+ // times given that WSACleanup will be called for each WSAStartup.
+ // We do this before the ctx constructor since its embedded mailbox_t
+ // object needs Winsock to be up and running.
+ WORD version_requested = MAKEWORD (2, 2);
+ WSADATA wsa_data;
+ int rc = WSAStartup (version_requested, &wsa_data);
+ zmq_assert (rc == 0);
+ zmq_assert (LOBYTE (wsa_data.wVersion) == 2 &&
+ HIBYTE (wsa_data.wVersion) == 2);
+#endif
+
+ // Create 0MQ context.
+ zmq::ctx_t *ctx = new (std::nothrow) zmq::ctx_t;
+ alloc_assert (ctx);
+ return ctx;
+}
+
+int zmq_ctx_term (void *ctx_)
+{
+ if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ int rc = ((zmq::ctx_t*) ctx_)->terminate ();
+ int en = errno;
+
+ // Shut down only if termination was not interrupted by a signal.
+ if (!rc || en != EINTR) {
+#ifdef ZMQ_HAVE_WINDOWS
+ // On Windows, uninitialise socket layer.
+ rc = WSACleanup ();
+ wsa_assert (rc != SOCKET_ERROR);
+#endif
+
+#if defined ZMQ_HAVE_OPENPGM
+ // Shut down the OpenPGM library.
+ if (pgm_shutdown () != TRUE)
+ zmq_assert (false);
+#endif
+ }
+
+ errno = en;
+ return rc;
+}
+
+int zmq_ctx_shutdown (void *ctx_)
+{
+ if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ return ((zmq::ctx_t*) ctx_)->shutdown ();
+}
+
+int zmq_ctx_set (void *ctx_, int option_, int optval_)
+{
+ if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
+ errno = EFAULT;
+ return -1;
+ }
+ return ((zmq::ctx_t*) ctx_)->set (option_, optval_);
+}
+
+int zmq_ctx_get (void *ctx_, int option_)
+{
+ if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
+ errno = EFAULT;
+ return -1;
+ }
+ return ((zmq::ctx_t*) ctx_)->get (option_);
+}
+
+// Stable/legacy context API
+
+void *zmq_init (int io_threads_)
+{
+ if (io_threads_ >= 0) {
+ void *ctx = zmq_ctx_new ();
+ zmq_ctx_set (ctx, ZMQ_IO_THREADS, io_threads_);
+ return ctx;
+ }
+ errno = EINVAL;
+ return NULL;
+}
+
+int zmq_term (void *ctx_)
+{
+ return zmq_ctx_term (ctx_);
+}
+
+int zmq_ctx_destroy (void *ctx_)
+{
+ return zmq_ctx_term (ctx_);
+}
+
+
+// Sockets
+
+void *zmq_socket (void *ctx_, int type_)
+{
+ if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
+ errno = EFAULT;
+ return NULL;
+ }
+ zmq::ctx_t *ctx = (zmq::ctx_t*) ctx_;
+ zmq::socket_base_t *s = ctx->create_socket (type_);
+ return (void *) s;
+}
+
+int zmq_close (void *s_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ ((zmq::socket_base_t*) s_)->close ();
+ return 0;
+}
+
+int zmq_setsockopt (void *s_, int option_, const void *optval_,
+ size_t optvallen_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ int result = s->setsockopt (option_, optval_, optvallen_);
+ return result;
+}
+
+int zmq_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ int result = s->getsockopt (option_, optval_, optvallen_);
+ return result;
+}
+
+int zmq_socket_monitor (void *s_, const char *addr_, int events_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ int result = s->monitor (addr_, events_);
+ return result;
+}
+
+int zmq_bind (void *s_, const char *addr_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ int result = s->bind (addr_);
+ return result;
+}
+
+int zmq_connect (void *s_, const char *addr_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ int result = s->connect (addr_);
+ return result;
+}
+
+int zmq_unbind (void *s_, const char *addr_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ return s->term_endpoint (addr_);
+}
+
+int zmq_disconnect (void *s_, const char *addr_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ return s->term_endpoint (addr_);
+}
+
+// Sending functions.
+
+static int
+s_sendmsg (zmq::socket_base_t *s_, zmq_msg_t *msg_, int flags_)
+{
+ int sz = (int) zmq_msg_size (msg_);
+ int rc = s_->send ((zmq::msg_t*) msg_, flags_);
+ if (unlikely (rc < 0))
+ return -1;
+ return sz;
+}
+
+/* To be deprecated once zmq_msg_send() is stable */
+int zmq_sendmsg (void *s_, zmq_msg_t *msg_, int flags_)
+{
+ return zmq_msg_send (msg_, s_, flags_);
+}
+
+int zmq_send (void *s_, const void *buf_, size_t len_, int flags_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq_msg_t msg;
+ int rc = zmq_msg_init_size (&msg, len_);
+ if (rc != 0)
+ return -1;
+ memcpy (zmq_msg_data (&msg), buf_, len_);
+
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ rc = s_sendmsg (s, &msg, flags_);
+ if (unlikely (rc < 0)) {
+ int err = errno;
+ int rc2 = zmq_msg_close (&msg);
+ errno_assert (rc2 == 0);
+ errno = err;
+ return -1;
+ }
+
+ // Note the optimisation here. We don't close the msg object as it is
+ // empty anyway. This may change when implementation of zmq_msg_t changes.
+ return rc;
+}
+
+int zmq_send_const (void *s_, const void *buf_, size_t len_, int flags_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq_msg_t msg;
+ int rc = zmq_msg_init_data (&msg, (void*)buf_, len_, NULL, NULL);
+ if (rc != 0)
+ return -1;
+
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ rc = s_sendmsg (s, &msg, flags_);
+ if (unlikely (rc < 0)) {
+ int err = errno;
+ int rc2 = zmq_msg_close (&msg);
+ errno_assert (rc2 == 0);
+ errno = err;
+ return -1;
+ }
+
+ // Note the optimisation here. We don't close the msg object as it is
+ // empty anyway. This may change when implementation of zmq_msg_t changes.
+ return rc;
+}
+
+
+// Send multiple messages.
+// TODO: this function has no man page
+//
+// If flag bit ZMQ_SNDMORE is set the vector is treated as
+// a single multi-part message, i.e. the last message has
+// ZMQ_SNDMORE bit switched off.
+//
+int zmq_sendiov (void *s_, iovec *a_, size_t count_, int flags_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ int rc = 0;
+ zmq_msg_t msg;
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+
+ for (size_t i = 0; i < count_; ++i) {
+ rc = zmq_msg_init_size (&msg, a_[i].iov_len);
+ if (rc != 0) {
+ rc = -1;
+ break;
+ }
+ memcpy (zmq_msg_data (&msg), a_[i].iov_base, a_[i].iov_len);
+ if (i == count_ - 1)
+ flags_ = flags_ & ~ZMQ_SNDMORE;
+ rc = s_sendmsg (s, &msg, flags_);
+ if (unlikely (rc < 0)) {
+ int err = errno;
+ int rc2 = zmq_msg_close (&msg);
+ errno_assert (rc2 == 0);
+ errno = err;
+ rc = -1;
+ break;
+ }
+ }
+ return rc;
+}
+
+// Receiving functions.
+
+static int
+s_recvmsg (zmq::socket_base_t *s_, zmq_msg_t *msg_, int flags_)
+{
+ int rc = s_->recv ((zmq::msg_t*) msg_, flags_);
+ if (unlikely (rc < 0))
+ return -1;
+ return (int) zmq_msg_size (msg_);
+}
+
+/* To be deprecated once zmq_msg_recv() is stable */
+int zmq_recvmsg (void *s_, zmq_msg_t *msg_, int flags_)
+{
+ return zmq_msg_recv (msg_, s_, flags_);
+}
+
+
+int zmq_recv (void *s_, void *buf_, size_t len_, int flags_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq_msg_t msg;
+ int rc = zmq_msg_init (&msg);
+ errno_assert (rc == 0);
+
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ int nbytes = s_recvmsg (s, &msg, flags_);
+ if (unlikely (nbytes < 0)) {
+ int err = errno;
+ rc = zmq_msg_close (&msg);
+ errno_assert (rc == 0);
+ errno = err;
+ return -1;
+ }
+
+ // At the moment an oversized message is silently truncated.
+ // TODO: Build in a notification mechanism to report the overflows.
+ size_t to_copy = size_t (nbytes) < len_ ? size_t (nbytes) : len_;
+ memcpy (buf_, zmq_msg_data (&msg), to_copy);
+
+ rc = zmq_msg_close (&msg);
+ errno_assert (rc == 0);
+
+ return nbytes;
+}
+
+// Receive a multi-part message
+//
+// Receives up to *count_ parts of a multi-part message.
+// Sets *count_ to the actual number of parts read.
+// ZMQ_RCVMORE is set to indicate if a complete multi-part message was read.
+// Returns number of message parts read, or -1 on error.
+//
+// Note: even if -1 is returned, some parts of the message
+// may have been read. Therefore the client must consult
+// *count_ to retrieve message parts successfully read,
+// even if -1 is returned.
+//
+// The iov_base* buffers of each iovec *a_ filled in by this
+// function may be freed using free().
+// TODO: this function has no man page
+//
+int zmq_recviov (void *s_, iovec *a_, size_t *count_, int flags_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+
+ size_t count = *count_;
+ int nread = 0;
+ bool recvmore = true;
+
+ *count_ = 0;
+
+ for (size_t i = 0; recvmore && i < count; ++i) {
+
+ zmq_msg_t msg;
+ int rc = zmq_msg_init (&msg);
+ errno_assert (rc == 0);
+
+ int nbytes = s_recvmsg (s, &msg, flags_);
+ if (unlikely (nbytes < 0)) {
+ int err = errno;
+ rc = zmq_msg_close (&msg);
+ errno_assert (rc == 0);
+ errno = err;
+ nread = -1;
+ break;
+ }
+
+ a_[i].iov_len = zmq_msg_size (&msg);
+ a_[i].iov_base = static_cast<char *> (malloc(a_[i].iov_len));
+ if (unlikely (!a_[i].iov_base)) {
+ errno = ENOMEM;
+ return -1;
+ }
+ memcpy(a_[i].iov_base,static_cast<char *> (zmq_msg_data (&msg)),
+ a_[i].iov_len);
+ // Assume zmq_socket ZMQ_RVCMORE is properly set.
+ recvmore = ((zmq::msg_t*) (void *) &msg)->flags () & zmq::msg_t::more;
+ rc = zmq_msg_close(&msg);
+ errno_assert (rc == 0);
+ ++*count_;
+ ++nread;
+ }
+ return nread;
+}
+
+// Message manipulators.
+
+int zmq_msg_init (zmq_msg_t *msg_)
+{
+ return ((zmq::msg_t*) msg_)->init ();
+}
+
+int zmq_msg_init_size (zmq_msg_t *msg_, size_t size_)
+{
+ return ((zmq::msg_t*) msg_)->init_size (size_);
+}
+
+int zmq_msg_init_data (zmq_msg_t *msg_, void *data_, size_t size_,
+ zmq_free_fn *ffn_, void *hint_)
+{
+ return ((zmq::msg_t*) msg_)->init_data (data_, size_, ffn_, hint_);
+}
+
+int zmq_msg_send (zmq_msg_t *msg_, void *s_, int flags_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ int result = s_sendmsg (s, msg_, flags_);
+ return result;
+}
+
+int zmq_msg_recv (zmq_msg_t *msg_, void *s_, int flags_)
+{
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
+ return -1;
+ }
+ zmq::socket_base_t *s = (zmq::socket_base_t *) s_;
+ int result = s_recvmsg (s, msg_, flags_);
+ return result;
+}
+
+int zmq_msg_close (zmq_msg_t *msg_)
+{
+ return ((zmq::msg_t*) msg_)->close ();
+}
+
+int zmq_msg_move (zmq_msg_t *dest_, zmq_msg_t *src_)
+{
+ return ((zmq::msg_t*) dest_)->move (*(zmq::msg_t*) src_);
+}
+
+int zmq_msg_copy (zmq_msg_t *dest_, zmq_msg_t *src_)
+{
+ return ((zmq::msg_t*) dest_)->copy (*(zmq::msg_t*) src_);
+}
+
+void *zmq_msg_data (zmq_msg_t *msg_)
+{
+ return ((zmq::msg_t*) msg_)->data ();
+}
+
+size_t zmq_msg_size (zmq_msg_t *msg_)
+{
+ return ((zmq::msg_t*) msg_)->size ();
+}
+
+int zmq_msg_more (zmq_msg_t *msg_)
+{
+ return zmq_msg_get (msg_, ZMQ_MORE);
+}
+
+int zmq_msg_get (zmq_msg_t *msg_, int property_)
+{
+ switch (property_) {
+ case ZMQ_MORE:
+ return (((zmq::msg_t*) msg_)->flags () & zmq::msg_t::more)? 1: 0;
+ case ZMQ_SRCFD:
+ // warning: int64_t to int
+ return ((zmq::msg_t*) msg_)->fd ();
+ case ZMQ_SHARED:
+ return (((zmq::msg_t*) msg_)->is_cmsg ()) ||
+ (((zmq::msg_t*) msg_)->flags () & zmq::msg_t::shared)? 1: 0;
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
+
+int zmq_msg_set (zmq_msg_t *, int, int)
+{
+ // No properties supported at present
+ errno = EINVAL;
+ return -1;
+}
+
+
+// Get message metadata string
+
+const char *zmq_msg_gets (zmq_msg_t *msg_, const char *property_)
+{
+ zmq::metadata_t *metadata = ((zmq::msg_t*) msg_)->metadata ();
+ const char *value = NULL;
+ if (metadata)
+ value = metadata->get (std::string (property_));
+ if (value)
+ return value;
+ else {
+ errno = EINVAL;
+ return NULL;
+ }
+}
+
+// Polling.
+
+int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
+{
+#if defined ZMQ_POLL_BASED_ON_POLL
+ if (unlikely (nitems_ < 0)) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (unlikely (nitems_ == 0)) {
+ if (timeout_ == 0)
+ return 0;
+#if defined ZMQ_HAVE_WINDOWS
+ Sleep (timeout_ > 0 ? timeout_ : INFINITE);
+ return 0;
+#elif defined ZMQ_HAVE_ANDROID
+ usleep (timeout_ * 1000);
+ return 0;
+#else
+ return usleep (timeout_ * 1000);
+#endif
+ }
+
+ if (!items_) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ zmq::clock_t clock;
+ uint64_t now = 0;
+ uint64_t end = 0;
+ pollfd spollfds[ZMQ_POLLITEMS_DFLT];
+ pollfd *pollfds = spollfds;
+
+ if (nitems_ > ZMQ_POLLITEMS_DFLT) {
+ pollfds = (pollfd*) malloc (nitems_ * sizeof (pollfd));
+ alloc_assert (pollfds);
+ }
+
+ // Build pollset for poll () system call.
+ for (int i = 0; i != nitems_; i++) {
+
+ // If the poll item is a 0MQ socket, we poll on the file descriptor
+ // retrieved by the ZMQ_FD socket option.
+ if (items_ [i].socket) {
+ size_t zmq_fd_size = sizeof (zmq::fd_t);
+ if (zmq_getsockopt (items_ [i].socket, ZMQ_FD, &pollfds [i].fd,
+ &zmq_fd_size) == -1) {
+ if (pollfds != spollfds)
+ free (pollfds);
+ return -1;
+ }
+ pollfds [i].events = items_ [i].events ? POLLIN : 0;
+ }
+ // Else, the poll item is a raw file descriptor. Just convert the
+ // events to normal POLLIN/POLLOUT for poll ().
+ else {
+ pollfds [i].fd = items_ [i].fd;
+ pollfds [i].events =
+ (items_ [i].events & ZMQ_POLLIN ? POLLIN : 0) |
+ (items_ [i].events & ZMQ_POLLOUT ? POLLOUT : 0);
+ }
+ }
+
+ bool first_pass = true;
+ int nevents = 0;
+
+ while (true) {
+ // Compute the timeout for the subsequent poll.
+ int timeout;
+ if (first_pass)
+ timeout = 0;
+ else
+ if (timeout_ < 0)
+ timeout = -1;
+ else
+ timeout = end - now;
+
+ // Wait for events.
+ while (true) {
+ int rc = poll (pollfds, nitems_, timeout);
+ if (rc == -1 && errno == EINTR) {
+ if (pollfds != spollfds)
+ free (pollfds);
+ return -1;
+ }
+ errno_assert (rc >= 0);
+ break;
+ }
+ // Check for the events.
+ for (int i = 0; i != nitems_; i++) {
+
+ items_ [i].revents = 0;
+
+ // The poll item is a 0MQ socket. Retrieve pending events
+ // using the ZMQ_EVENTS socket option.
+ if (items_ [i].socket) {
+ size_t zmq_events_size = sizeof (uint32_t);
+ uint32_t zmq_events;
+ if (zmq_getsockopt (items_ [i].socket, ZMQ_EVENTS, &zmq_events,
+ &zmq_events_size) == -1) {
+ if (pollfds != spollfds)
+ free (pollfds);
+ return -1;
+ }
+ if ((items_ [i].events & ZMQ_POLLOUT) &&
+ (zmq_events & ZMQ_POLLOUT))
+ items_ [i].revents |= ZMQ_POLLOUT;
+ if ((items_ [i].events & ZMQ_POLLIN) &&
+ (zmq_events & ZMQ_POLLIN))
+ items_ [i].revents |= ZMQ_POLLIN;
+ }
+ // Else, the poll item is a raw file descriptor, simply convert
+ // the events to zmq_pollitem_t-style format.
+ else {
+ if (pollfds [i].revents & POLLIN)
+ items_ [i].revents |= ZMQ_POLLIN;
+ if (pollfds [i].revents & POLLOUT)
+ items_ [i].revents |= ZMQ_POLLOUT;
+ if (pollfds [i].revents & ~(POLLIN | POLLOUT))
+ items_ [i].revents |= ZMQ_POLLERR;
+ }
+
+ if (items_ [i].revents)
+ nevents++;
+ }
+
+ // If timout is zero, exit immediately whether there are events or not.
+ if (timeout_ == 0)
+ break;
+
+ // If there are events to return, we can exit immediately.
+ if (nevents)
+ break;
+
+ // At this point we are meant to wait for events but there are none.
+ // If timeout is infinite we can just loop until we get some events.
+ if (timeout_ < 0) {
+ if (first_pass)
+ first_pass = false;
+ continue;
+ }
+
+ // The timeout is finite and there are no events. In the first pass
+ // we get a timestamp of when the polling have begun. (We assume that
+ // first pass have taken negligible time). We also compute the time
+ // when the polling should time out.
+ if (first_pass) {
+ now = clock.now_ms ();
+ end = now + timeout_;
+ if (now == end)
+ break;
+ first_pass = false;
+ continue;
+ }
+
+ // Find out whether timeout have expired.
+ now = clock.now_ms ();
+ if (now >= end)
+ break;
+ }
+
+ if (pollfds != spollfds)
+ free (pollfds);
+ return nevents;
+
+#elif defined ZMQ_POLL_BASED_ON_SELECT
+
+ if (unlikely (nitems_ < 0)) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (unlikely (nitems_ == 0)) {
+ if (timeout_ == 0)
+ return 0;
+#if defined ZMQ_HAVE_WINDOWS
+ Sleep (timeout_ > 0 ? timeout_ : INFINITE);
+ return 0;
+#else
+ return usleep (timeout_ * 1000);
+#endif
+ }
+ zmq::clock_t clock;
+ uint64_t now = 0;
+ uint64_t end = 0;
+
+ // Ensure we do not attempt to select () on more than FD_SETSIZE
+ // file descriptors.
+ zmq_assert (nitems_ <= FD_SETSIZE);
+
+ fd_set pollset_in;
+ FD_ZERO (&pollset_in);
+ fd_set pollset_out;
+ FD_ZERO (&pollset_out);
+ fd_set pollset_err;
+ FD_ZERO (&pollset_err);
+
+ zmq::fd_t maxfd = 0;
+
+ // Build the fd_sets for passing to select ().
+ for (int i = 0; i != nitems_; i++) {
+
+ // If the poll item is a 0MQ socket we are interested in input on the
+ // notification file descriptor retrieved by the ZMQ_FD socket option.
+ if (items_ [i].socket) {
+ size_t zmq_fd_size = sizeof (zmq::fd_t);
+ zmq::fd_t notify_fd;
+ if (zmq_getsockopt (items_ [i].socket, ZMQ_FD, &notify_fd,
+ &zmq_fd_size) == -1)
+ return -1;
+ if (items_ [i].events) {
+ FD_SET (notify_fd, &pollset_in);
+ if (maxfd < notify_fd)
+ maxfd = notify_fd;
+ }
+ }
+ // Else, the poll item is a raw file descriptor. Convert the poll item
+ // events to the appropriate fd_sets.
+ else {
+ if (items_ [i].events & ZMQ_POLLIN)
+ FD_SET (items_ [i].fd, &pollset_in);
+ if (items_ [i].events & ZMQ_POLLOUT)
+ FD_SET (items_ [i].fd, &pollset_out);
+ if (items_ [i].events & ZMQ_POLLERR)
+ FD_SET (items_ [i].fd, &pollset_err);
+ if (maxfd < items_ [i].fd)
+ maxfd = items_ [i].fd;
+ }
+ }
+
+ bool first_pass = true;
+ int nevents = 0;
+ fd_set inset, outset, errset;
+
+ while (true) {
+
+ // Compute the timeout for the subsequent poll.
+ timeval timeout;
+ timeval *ptimeout;
+ if (first_pass) {
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ ptimeout = &timeout;
+ }
+ else
+ if (timeout_ < 0)
+ ptimeout = NULL;
+ else {
+ timeout.tv_sec = (long) ((end - now) / 1000);
+ timeout.tv_usec = (long) ((end - now) % 1000 * 1000);
+ ptimeout = &timeout;
+ }
+
+ // Wait for events. Ignore interrupts if there's infinite timeout.
+ while (true) {
+ memcpy (&inset, &pollset_in, sizeof (fd_set));
+ memcpy (&outset, &pollset_out, sizeof (fd_set));
+ memcpy (&errset, &pollset_err, sizeof (fd_set));
+#if defined ZMQ_HAVE_WINDOWS
+ int rc = select (0, &inset, &outset, &errset, ptimeout);
+ if (unlikely (rc == SOCKET_ERROR)) {
+ errno = zmq::wsa_error_to_errno (WSAGetLastError ());
+ wsa_assert (errno == ENOTSOCK);
+ return -1;
+ }
+#else
+ int rc = select (maxfd + 1, &inset, &outset, &errset, ptimeout);
+ if (unlikely (rc == -1)) {
+ errno_assert (errno == EINTR || errno == EBADF);
+ return -1;
+ }
+#endif
+ break;
+ }
+
+ // Check for the events.
+ for (int i = 0; i != nitems_; i++) {
+
+ items_ [i].revents = 0;
+
+ // The poll item is a 0MQ socket. Retrieve pending events
+ // using the ZMQ_EVENTS socket option.
+ if (items_ [i].socket) {
+ size_t zmq_events_size = sizeof (uint32_t);
+ uint32_t zmq_events;
+ if (zmq_getsockopt (items_ [i].socket, ZMQ_EVENTS, &zmq_events,
+ &zmq_events_size) == -1)
+ return -1;
+ if ((items_ [i].events & ZMQ_POLLOUT) &&
+ (zmq_events & ZMQ_POLLOUT))
+ items_ [i].revents |= ZMQ_POLLOUT;
+ if ((items_ [i].events & ZMQ_POLLIN) &&
+ (zmq_events & ZMQ_POLLIN))
+ items_ [i].revents |= ZMQ_POLLIN;
+ }
+ // Else, the poll item is a raw file descriptor, simply convert
+ // the events to zmq_pollitem_t-style format.
+ else {
+ if (FD_ISSET (items_ [i].fd, &inset))
+ items_ [i].revents |= ZMQ_POLLIN;
+ if (FD_ISSET (items_ [i].fd, &outset))
+ items_ [i].revents |= ZMQ_POLLOUT;
+ if (FD_ISSET (items_ [i].fd, &errset))
+ items_ [i].revents |= ZMQ_POLLERR;
+ }
+
+ if (items_ [i].revents)
+ nevents++;
+ }
+
+ // If timout is zero, exit immediately whether there are events or not.
+ if (timeout_ == 0)
+ break;
+
+ // If there are events to return, we can exit immediately.
+ if (nevents)
+ break;
+
+ // At this point we are meant to wait for events but there are none.
+ // If timeout is infinite we can just loop until we get some events.
+ if (timeout_ < 0) {
+ if (first_pass)
+ first_pass = false;
+ continue;
+ }
+
+ // The timeout is finite and there are no events. In the first pass
+ // we get a timestamp of when the polling have begun. (We assume that
+ // first pass have taken negligible time). We also compute the time
+ // when the polling should time out.
+ if (first_pass) {
+ now = clock.now_ms ();
+ end = now + timeout_;
+ if (now == end)
+ break;
+ first_pass = false;
+ continue;
+ }
+
+ // Find out whether timeout have expired.
+ now = clock.now_ms ();
+ if (now >= end)
+ break;
+ }
+
+ return nevents;
+
+#else
+ // Exotic platforms that support neither poll() nor select().
+ errno = ENOTSUP;
+ return -1;
+#endif
+}
+
+// The proxy functionality
+
+int zmq_proxy (void *frontend_, void *backend_, void *capture_)
+{
+ if (!frontend_ || !backend_) {
+ errno = EFAULT;
+ return -1;
+ }
+ return zmq::proxy (
+ (zmq::socket_base_t*) frontend_,
+ (zmq::socket_base_t*) backend_,
+ (zmq::socket_base_t*) capture_);
+}
+
+int zmq_proxy_steerable (void *frontend_, void *backend_, void *capture_, void *control_)
+{
+ if (!frontend_ || !backend_) {
+ errno = EFAULT;
+ return -1;
+ }
+ return zmq::proxy (
+ (zmq::socket_base_t*) frontend_,
+ (zmq::socket_base_t*) backend_,
+ (zmq::socket_base_t*) capture_,
+ (zmq::socket_base_t*) control_);
+}
+
+// The deprecated device functionality
+
+int zmq_device (int /* type */, void *frontend_, void *backend_)
+{
+ return zmq::proxy (
+ (zmq::socket_base_t*) frontend_,
+ (zmq::socket_base_t*) backend_, NULL);
+}
+
+// Probe library capabilities; for now, reports on transport and security
+
+int zmq_has (const char *capability)
+{
+#if !defined (ZMQ_HAVE_WINDOWS) && !defined (ZMQ_HAVE_OPENVMS)
+ if (strcmp (capability, "ipc") == 0)
+ return true;
+#endif
+#if defined (ZMQ_HAVE_OPENPGM)
+ if (strcmp (capability, "pgm") == 0)
+ return true;
+#endif
+#if defined (ZMQ_HAVE_TIPC)
+ if (strcmp (capability, "tipc") == 0)
+ return true;
+#endif
+#if defined (ZMQ_HAVE_NORM)
+ if (strcmp (capability, "norm") == 0)
+ return true;
+#endif
+#if defined (HAVE_LIBSODIUM)
+ if (strcmp (capability, "curve") == 0)
+ return true;
+#endif
+#if defined (HAVE_LIBGSSAPI_KRB5)
+ if (strcmp (capability, "gssapi") == 0)
+ return true;
+#endif
+ // Whatever the application asked for, we don't have
+ return false;
+}
diff --git a/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/zmq_utils.cpp b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/zmq_utils.cpp
new file mode 100644
index 00000000..f8a69714
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/bundled/zeromq/src/zmq_utils.cpp
@@ -0,0 +1,216 @@
+/*
+ Copyright (c) 2007-2015 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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "platform.hpp"
+
+#include "clock.hpp"
+#include "err.hpp"
+#include "thread.hpp"
+#include <assert.h>
+#include "../include/zmq_utils.h"
+
+#if !defined ZMQ_HAVE_WINDOWS
+#include <unistd.h>
+#else
+#include "windows.hpp"
+#endif
+
+#ifdef HAVE_LIBSODIUM
+#ifdef HAVE_TWEETNACL
+#include "tweetnacl_base.h"
+#else
+#include "sodium.h"
+#endif
+#endif
+
+
+void zmq_sleep (int seconds_)
+{
+#if defined ZMQ_HAVE_WINDOWS
+ Sleep (seconds_ * 1000);
+#else
+ sleep (seconds_);
+#endif
+}
+
+void *zmq_stopwatch_start ()
+{
+ uint64_t *watch = (uint64_t*) malloc (sizeof (uint64_t));
+ alloc_assert (watch);
+ *watch = zmq::clock_t::now_us ();
+ return (void*) watch;
+}
+
+unsigned long zmq_stopwatch_stop (void *watch_)
+{
+ uint64_t end = zmq::clock_t::now_us ();
+ uint64_t start = *(uint64_t*) watch_;
+ free (watch_);
+ return (unsigned long) (end - start);
+}
+
+void *zmq_threadstart(zmq_thread_fn* func, void* arg)
+{
+ zmq::thread_t* thread = new zmq::thread_t;
+ thread->start(func, arg);
+ return thread;
+}
+
+void zmq_threadclose(void* thread)
+{
+ zmq::thread_t* pThread = static_cast<zmq::thread_t*>(thread);
+ pThread->stop();
+ delete pThread;
+}
+
+// Z85 codec, taken from 0MQ RFC project, implements RFC32 Z85 encoding
+
+// Maps base 256 to base 85
+static char encoder [85 + 1] = {
+ "0123456789" "abcdefghij" "klmnopqrst" "uvwxyzABCD"
+ "EFGHIJKLMN" "OPQRSTUVWX" "YZ.-:+=^!/" "*?&<>()[]{"
+ "}@%$#"
+};
+
+// Maps base 85 to base 256
+// We chop off lower 32 and higher 128 ranges
+static uint8_t decoder [96] = {
+ 0x00, 0x44, 0x00, 0x54, 0x53, 0x52, 0x48, 0x00,
+ 0x4B, 0x4C, 0x46, 0x41, 0x00, 0x3F, 0x3E, 0x45,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x40, 0x00, 0x49, 0x42, 0x4A, 0x47,
+ 0x51, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A,
+ 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32,
+ 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
+ 0x3B, 0x3C, 0x3D, 0x4D, 0x00, 0x4E, 0x43, 0x00,
+ 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
+ 0x21, 0x22, 0x23, 0x4F, 0x00, 0x50, 0x00, 0x00
+};
+
+// --------------------------------------------------------------------------
+// Encode a binary frame as a string; destination string MUST be at least
+// size * 5 / 4 bytes long plus 1 byte for the null terminator. Returns
+// dest. Size must be a multiple of 4.
+// Returns NULL and sets errno = EINVAL for invalid input.
+
+char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size)
+{
+ if (size % 4 != 0) {
+ errno = EINVAL;
+ return NULL;
+ }
+ unsigned int char_nbr = 0;
+ unsigned int byte_nbr = 0;
+ uint32_t value = 0;
+ while (byte_nbr < size) {
+ // Accumulate value in base 256 (binary)
+ value = value * 256 + data [byte_nbr++];
+ if (byte_nbr % 4 == 0) {
+ // Output value in base 85
+ unsigned int divisor = 85 * 85 * 85 * 85;
+ while (divisor) {
+ dest [char_nbr++] = encoder [value / divisor % 85];
+ divisor /= 85;
+ }
+ value = 0;
+ }
+ }
+ assert (char_nbr == size * 5 / 4);
+ dest [char_nbr] = 0;
+ return dest;
+}
+
+
+// --------------------------------------------------------------------------
+// Decode an encoded string into a binary frame; dest must be at least
+// strlen (string) * 4 / 5 bytes long. Returns dest. strlen (string)
+// must be a multiple of 5.
+// Returns NULL and sets errno = EINVAL for invalid input.
+
+uint8_t *zmq_z85_decode (uint8_t *dest, const char *string)
+{
+ if (strlen (string) % 5 != 0) {
+ errno = EINVAL;
+ return NULL;
+ }
+ unsigned int byte_nbr = 0;
+ unsigned int char_nbr = 0;
+ unsigned int string_len = strlen (string);
+ uint32_t value = 0;
+ while (char_nbr < string_len) {
+ // Accumulate value in base 85
+ value = value * 85 + decoder [(uint8_t) string [char_nbr++] - 32];
+ if (char_nbr % 5 == 0) {
+ // Output value in base 256
+ unsigned int divisor = 256 * 256 * 256;
+ while (divisor) {
+ dest [byte_nbr++] = value / divisor % 256;
+ divisor /= 256;
+ }
+ value = 0;
+ }
+ }
+ assert (byte_nbr == strlen (string) * 4 / 5);
+ return dest;
+}
+
+// --------------------------------------------------------------------------
+// Generate a public/private keypair with libsodium.
+// Generated keys will be 40 byte z85-encoded strings.
+// Returns 0 on success, -1 on failure, setting errno.
+// Sets errno = ENOTSUP in the absence of libsodium.
+
+int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
+{
+#ifdef HAVE_LIBSODIUM
+# if crypto_box_PUBLICKEYBYTES != 32 \
+ || crypto_box_SECRETKEYBYTES != 32
+# error "libsodium not built correctly"
+# endif
+
+ uint8_t public_key [32];
+ uint8_t secret_key [32];
+
+ int rc = crypto_box_keypair (public_key, secret_key);
+ // Is there a sensible errno to set here?
+ if (rc)
+ return rc;
+
+ zmq_z85_encode (z85_public_key, public_key, 32);
+ zmq_z85_encode (z85_secret_key, secret_key, 32);
+
+ return 0;
+#else // requires libsodium
+ (void) z85_public_key, (void) z85_secret_key;
+ errno = ENOTSUP;
+ return -1;
+#endif
+}
diff --git a/external_libs/python/pyzmq-14.7.0/docs/Makefile b/external_libs/python/pyzmq-14.7.0/docs/Makefile
new file mode 100644
index 00000000..87988f82
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/Makefile
@@ -0,0 +1,117 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = build
+SRCDIR = source
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
+
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
+
+default: html
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ -rm -rf $(BUILDDIR)/*
+ -rm -rf $(SRCDIR)/api/generated/*
+ -rm -rf dist
+ -rm -rf gh-pages
+
+api: $(SRCDIR)/api/generated/gen.rst
+
+$(SRCDIR)/api/generated/gen.rst:
+ python autogen_api.py
+ @echo "Build API docs finished."
+
+dist: all
+ mkdir -p dist
+ rm -rf dist/*
+ ln $(BUILDDIR)/latex/PyZMQ.pdf dist/
+ cp -a $(BUILDDIR)/html dist/
+ @echo "Build finished. Final docs are in dist/"
+
+pdf: latex
+ cd $(BUILDDIR)/latex && make all-pdf
+
+all: html pdf
+
+html: api
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PyZMQ.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PyZMQ.qhc"
+
+latex: api
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+ "run these through (pdf)latex."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+gh-pages: html
+ sh update_ghpages.sh
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/autogen_api.py b/external_libs/python/pyzmq-14.7.0/docs/autogen_api.py
new file mode 100644
index 00000000..004c4612
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/autogen_api.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+"""Script to auto-generate our API docs.
+"""
+# stdlib imports
+import os
+import sys
+
+# local imports
+sys.path.append(os.path.abspath('sphinxext'))
+# import sphinx_cython
+from apigen import ApiDocWriter
+
+#*****************************************************************************
+if __name__ == '__main__':
+ pjoin = os.path.join
+ package = 'zmq'
+ outdir = pjoin('source','api','generated')
+ docwriter = ApiDocWriter(package,rst_extension='.rst')
+ # You have to escape the . here because . is a special char for regexps.
+ # You must do make clean if you change this!
+ docwriter.package_skip_patterns += [
+ r'\.tests$',
+ r'\.backend$',
+ r'\.auth$',
+ r'\.eventloop\.minitornado$',
+ r'\.green\.eventloop$',
+ r'\.sugar$',
+ r'\.devices$',
+ ]
+
+ docwriter.module_skip_patterns += [
+ r'\.eventloop\.stack_context$',
+ r'\.error$',
+ r'\.green\..+$',
+ r'\.utils\.initthreads$',
+ r'\.utils\.constant_names$',
+ r'\.utils\.garbage$',
+ r'\.utils\.rebuffer$',
+ r'\.utils\.strtypes$',
+ ]
+
+ # Now, generate the outputs
+ docwriter.write_api_docs(outdir)
+ docwriter.write_index(outdir, 'gen',
+ relative_to = pjoin('source','api')
+ )
+
+ print('%d files written' % len(docwriter.written_modules))
diff --git a/external_libs/python/pyzmq-14.7.0/docs/requirements.txt b/external_libs/python/pyzmq-14.7.0/docs/requirements.txt
new file mode 100644
index 00000000..44371de1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/requirements.txt
@@ -0,0 +1,3 @@
+cython>=0.20
+sphinx>=1.3
+gevent
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/_static/default.css b/external_libs/python/pyzmq-14.7.0/docs/source/_static/default.css
new file mode 100644
index 00000000..71c9d5ea
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/_static/default.css
@@ -0,0 +1,553 @@
+/**
+ * Alternate Sphinx design
+ * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
+ */
+
+body {
+ font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
+ font-size: 14px;
+ letter-spacing: -0.01em;
+ line-height: 150%;
+ text-align: center;
+ /*background-color: #AFC1C4; */
+ background-color: #BFD1D4;
+ color: black;
+ padding: 0;
+ border: 1px solid #aaa;
+
+ margin: 0px 80px 0px 80px;
+ min-width: 740px;
+}
+
+a {
+ color: #CA7900;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #2491CF;
+}
+
+pre {
+ font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.95em;
+ letter-spacing: 0.015em;
+ padding: 0.5em;
+ border: 1px solid #ccc;
+ background-color: #f8f8f8;
+}
+
+td.linenos pre {
+ padding: 0.5em 0;
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ margin-left: 0.5em;
+}
+
+table.highlighttable td {
+ padding: 0 0.5em 0 0.5em;
+}
+
+cite, code, tt {
+ font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.95em;
+ letter-spacing: 0.01em;
+}
+
+hr {
+ border: 1px solid #abc;
+ margin: 2em;
+}
+
+tt {
+ background-color: #f2f2f2;
+ border-bottom: 1px solid #ddd;
+ color: #333;
+}
+
+tt.descname {
+ background-color: transparent;
+ font-weight: bold;
+ font-size: 1.2em;
+ border: 0;
+}
+
+tt.descclassname {
+ background-color: transparent;
+ border: 0;
+}
+
+tt.xref {
+ background-color: transparent;
+ font-weight: bold;
+ border: 0;
+}
+
+a tt {
+ background-color: transparent;
+ font-weight: bold;
+ border: 0;
+ color: #CA7900;
+}
+
+a tt:hover {
+ color: #2491CF;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd p {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+.refcount {
+ color: #060;
+}
+
+dt:target,
+.highlight {
+ background-color: #fbe54e;
+}
+
+dl.class, dl.function {
+ border-top: 2px solid #888;
+}
+
+dl.method, dl.attribute {
+ border-top: 1px solid #aaa;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+pre {
+ line-height: 120%;
+}
+
+pre a {
+ color: inherit;
+ text-decoration: underline;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+div.document {
+ background-color: white;
+ text-align: left;
+ background-image: url(contents.png);
+ background-repeat: repeat-x;
+}
+
+/*
+div.documentwrapper {
+ width: 100%;
+}
+*/
+
+div.clearer {
+ clear: both;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ background-image: url(navigation.png);
+ height: 2em;
+ list-style: none;
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 0;
+ padding-left: 10px;
+}
+
+div.related ul li {
+ margin: 0;
+ padding: 0;
+ height: 2em;
+ float: left;
+}
+
+div.related ul li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+div.related ul li a {
+ margin: 0;
+ padding: 0 5px 0 5px;
+ line-height: 1.75em;
+ color: #EE9816;
+}
+
+div.related ul li a:hover {
+ color: #3CA8E7;
+}
+
+div.body {
+ margin: 0;
+ padding: 0.5em 20px 20px 20px;
+}
+
+div.bodywrapper {
+ margin: 0 240px 0 0;
+ border-right: 1px solid #ccc;
+}
+
+div.body a {
+ text-decoration: underline;
+}
+
+div.sphinxsidebar {
+ margin: 0;
+ padding: 0.5em 15px 15px 0;
+ width: 210px;
+ float: right;
+ text-align: left;
+/* margin-left: -100%; */
+}
+
+div.sphinxsidebar h4, div.sphinxsidebar h3 {
+ margin: 1em 0 0.5em 0;
+ font-size: 0.9em;
+ padding: 0.1em 0 0.1em 0.5em;
+ color: white;
+ border: 1px solid #86989B;
+ background-color: #AFC1C4;
+}
+
+div.sphinxsidebar ul {
+ padding-left: 1.5em;
+ margin-top: 7px;
+ list-style: none;
+ padding: 0;
+ line-height: 130%;
+}
+
+div.sphinxsidebar ul ul {
+ list-style: square;
+ margin-left: 20px;
+}
+
+p {
+ margin: 0.8em 0 0.5em 0;
+}
+
+p.rubric {
+ font-weight: bold;
+}
+
+h1 {
+ margin: 0;
+ padding: 0.7em 0 0.3em 0;
+ font-size: 1.5em;
+ color: #11557C;
+}
+
+h2 {
+ margin: 1.3em 0 0.2em 0;
+ font-size: 1.35em;
+ padding: 0;
+}
+
+h3 {
+ margin: 1em 0 -0.3em 0;
+ font-size: 1.2em;
+}
+
+h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
+ color: black!important;
+}
+
+h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
+ display: none;
+ margin: 0 0 0 0.3em;
+ padding: 0 0.2em 0 0.2em;
+ color: #aaa!important;
+}
+
+h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
+h5:hover a.anchor, h6:hover a.anchor {
+ display: inline;
+}
+
+h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
+h5 a.anchor:hover, h6 a.anchor:hover {
+ color: #777;
+ background-color: #eee;
+}
+
+table {
+ border-collapse: collapse;
+ margin: 0 -0.5em 0 -0.5em;
+}
+
+table td, table th {
+ padding: 0.2em 0.5em 0.2em 0.5em;
+}
+
+div.footer {
+ background-color: #E3EFF1;
+ color: #86989B;
+ padding: 3px 8px 3px 0;
+ clear: both;
+ font-size: 0.8em;
+ text-align: right;
+}
+
+div.footer a {
+ color: #86989B;
+ text-decoration: underline;
+}
+
+div.pagination {
+ margin-top: 2em;
+ padding-top: 0.5em;
+ border-top: 1px solid black;
+ text-align: center;
+}
+
+div.sphinxsidebar ul.toc {
+ margin: 1em 0 1em 0;
+ padding: 0 0 0 0.5em;
+ list-style: none;
+}
+
+div.sphinxsidebar ul.toc li {
+ margin: 0.5em 0 0.5em 0;
+ font-size: 0.9em;
+ line-height: 130%;
+}
+
+div.sphinxsidebar ul.toc li p {
+ margin: 0;
+ padding: 0;
+}
+
+div.sphinxsidebar ul.toc ul {
+ margin: 0.2em 0 0.2em 0;
+ padding: 0 0 0 1.8em;
+}
+
+div.sphinxsidebar ul.toc ul li {
+ padding: 0;
+}
+
+div.admonition, div.warning {
+ font-size: 0.9em;
+ margin: 1em 0 0 0;
+ border: 1px solid #86989B;
+ background-color: #f7f7f7;
+}
+
+div.admonition p, div.warning p {
+ margin: 0.5em 1em 0.5em 1em;
+ padding: 0;
+}
+
+div.admonition pre, div.warning pre {
+ margin: 0.4em 1em 0.4em 1em;
+}
+
+div.admonition p.admonition-title,
+div.warning p.admonition-title {
+ margin: 0;
+ padding: 0.1em 0 0.1em 0.5em;
+ color: white;
+ border-bottom: 1px solid #86989B;
+ font-weight: bold;
+ background-color: #AFC1C4;
+}
+
+div.warning {
+ border: 1px solid #940000;
+}
+
+div.warning p.admonition-title {
+ background-color: #CF0000;
+ border-bottom-color: #940000;
+}
+
+div.admonition ul, div.admonition ol,
+div.warning ul, div.warning ol {
+ margin: 0.1em 0.5em 0.5em 3em;
+ padding: 0;
+}
+
+div.versioninfo {
+ margin: 1em 0 0 0;
+ border: 1px solid #ccc;
+ background-color: #DDEAF0;
+ padding: 8px;
+ line-height: 1.3em;
+ font-size: 0.9em;
+}
+
+
+a.headerlink {
+ color: #c60f0f!important;
+ font-size: 1em;
+ margin-left: 6px;
+ padding: 0 4px 0 4px;
+ text-decoration: none!important;
+ visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+ visibility: visible;
+}
+
+a.headerlink:hover {
+ background-color: #ccc;
+ color: white!important;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+img.inheritance {
+ border: 0px
+}
+
+form.pfform {
+ margin: 10px 0 20px 0;
+}
+
+table.contentstable {
+ width: 90%;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li div.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
+/* from numpy:*/
+td.field-body > blockquote {
+ margin-top: 0.1em;
+ margin-bottom: 0.5em;
+}
+/* spacing in see also definition lists */
+dl.last > dd {
+ margin-top: 1px;
+ margin-bottom: 5px;
+ margin-left: 30px;
+}
+
+.field-list th {
+ color: rgb(0,102,204);
+ background: #eee;
+}
+
+table.field-list th {
+/* border-left: 1px solid #aaa !important;*/
+ padding-left: 5px;
+ white-space: nowrap;
+}
+
+table.field-list {
+ border-collapse: separate;
+ border-spacing: 10px;
+}
+
+th.field-name {
+/* border-left: 1px solid #aaa !important;*/
+padding-left: .5em;
+padding-right: .5em;
+text-align: right;
+
+}
+
+.rubric {
+ color: rgb(0,50,150);
+ background-color: ;
+ font-style: italic;
+}
+
+.versionadded {
+ font-style: italic;
+ background: #ffe;
+} \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/_static/logo.png b/external_libs/python/pyzmq-14.7.0/docs/source/_static/logo.png
new file mode 100644
index 00000000..c3e8dabb
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/_static/logo.png
Binary files differ
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/_static/zeromq.ico b/external_libs/python/pyzmq-14.7.0/docs/source/_static/zeromq.ico
new file mode 100644
index 00000000..3f810a1f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/_static/zeromq.ico
Binary files differ
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/_templates/layout.html b/external_libs/python/pyzmq-14.7.0/docs/source/_templates/layout.html
new file mode 100644
index 00000000..a3eebdbf
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/_templates/layout.html
@@ -0,0 +1,23 @@
+{% extends "!layout.html" %}
+
+
+{% block rootrellink %}
+ <li><a href="{{ pathto('index') }}">home</a>|&nbsp;</li>
+ <li><a href="{{ pathto('search') }}">search</a>|&nbsp;</li>
+ <li><a href="{{ pathto('api/index') }}">API</a> &raquo;</li>
+{% endblock %}
+
+
+{% block relbar1 %}
+
+<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
+<a href="{{ pathto('index') }}"><img src="{{
+pathto("_static/logo.png", 1) }}" border="0" alt="PyZMQ Documentation"/></a>
+</div>
+{{ super() }}
+{% endblock %}
+
+{# put the sidebar before the body #}
+{% block sidebar1 %}{{ sidebar() }}{% endblock %}
+{% block sidebar2 %}{% endblock %}
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/api/index.rst b/external_libs/python/pyzmq-14.7.0/docs/source/api/index.rst
new file mode 100644
index 00000000..87ef242e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/api/index.rst
@@ -0,0 +1,26 @@
+.. _api-index:
+
+###################
+ The PyZMQ API
+###################
+
+:Release: |release|
+:Date: |today|
+
+.. toctree::
+
+ zmq
+ zmq.devices
+ zmq.green
+ generated/zmq.eventloop.ioloop
+ generated/zmq.eventloop.zmqstream
+ zmq.auth
+ zmq.auth.thread
+ zmq.auth.ioloop
+ generated/zmq.log.handlers
+ generated/zmq.ssh.tunnel
+ generated/zmq.utils.jsonapi
+ generated/zmq.utils.monitor
+ generated/zmq.utils.z85
+ zmq.utils.win32
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.ioloop.rst b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.ioloop.rst
new file mode 100644
index 00000000..efcb0263
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.ioloop.rst
@@ -0,0 +1,20 @@
+.. AUTO-GENERATED FILE -- DO NOT EDIT!
+
+auth.ioloop
+===========
+
+Module: :mod:`auth.ioloop`
+--------------------------
+.. automodule:: zmq.auth.ioloop
+
+.. currentmodule:: zmq.auth.ioloop
+
+:class:`IOLoopAuthenticator`
+----------------------------
+
+
+.. autoclass:: IOLoopAuthenticator
+ :members:
+ :undoc-members:
+ :inherited-members:
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.rst b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.rst
new file mode 100644
index 00000000..6ca29d71
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.rst
@@ -0,0 +1,30 @@
+auth
+====
+
+Module: :mod:`auth`
+-------------------
+.. automodule:: zmq.auth
+
+.. currentmodule:: zmq.auth
+
+
+:class:`Authenticator`
+----------------------
+
+
+.. autoclass:: Authenticator
+ :members:
+ :undoc-members:
+ :inherited-members:
+
+
+Functions
+---------
+
+
+.. autofunction:: create_certificates
+
+.. autofunction:: load_certificate
+
+.. autofunction:: load_certificates
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.thread.rst b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.thread.rst
new file mode 100644
index 00000000..e2c0b1b3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.auth.thread.rst
@@ -0,0 +1,24 @@
+.. AUTO-GENERATED FILE -- DO NOT EDIT!
+
+auth.thread
+===========
+
+Module: :mod:`auth.thread`
+--------------------------
+.. automodule:: zmq.auth.thread
+
+.. currentmodule:: zmq.auth.thread
+
+Classes
+-------
+
+
+:class:`ThreadAuthenticator`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
+.. autoclass:: ThreadAuthenticator
+ :members:
+ :undoc-members:
+ :inherited-members:
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.devices.rst b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.devices.rst
new file mode 100644
index 00000000..690b0b55
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.devices.rst
@@ -0,0 +1,86 @@
+devices
+=======
+
+Functions
+---------
+
+.. autofunction:: zmq.device
+
+.. autofunction:: zmq.proxy
+
+Module: :mod:`zmq.devices`
+--------------------------
+.. automodule:: zmq.devices
+
+.. currentmodule:: zmq.devices
+
+
+Base Devices
+------------
+
+:class:`Device`
+***************
+
+.. autoclass:: Device
+ :members:
+ :exclude-members: context_factory, run, run_device
+
+:class:`ThreadDevice`
+*********************
+
+.. autoclass:: ThreadDevice
+ :members:
+
+:class:`ProcessDevice`
+**********************
+
+.. autoclass:: ProcessDevice
+ :members:
+
+
+Proxy Devices
+-------------
+
+:class:`Proxy`
+********************
+
+.. autoclass:: Proxy
+ :members: bind_mon, connect_mon, setsockopt_mon
+
+:class:`ThreadProxy`
+********************
+
+.. autoclass:: ThreadProxy
+ :members:
+
+:class:`ProcessProxy`
+*********************
+
+.. autoclass:: ProcessProxy
+ :members:
+
+
+MonitoredQueue Devices
+----------------------
+
+.. autofunction:: zmq.devices.monitored_queue
+
+:class:`MonitoredQueue`
+*****************************
+
+.. autoclass:: MonitoredQueue
+ :members:
+
+:class:`ThreadMonitoredQueue`
+*****************************
+
+.. autoclass:: ThreadMonitoredQueue
+ :members:
+
+:class:`ProcessMonitoredQueue`
+******************************
+
+.. autoclass:: ProcessMonitoredQueue
+ :members:
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.green.rst b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.green.rst
new file mode 100644
index 00000000..6d0667a0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.green.rst
@@ -0,0 +1,7 @@
+green
+=====
+
+Module: :mod:`green`
+--------------------
+
+.. automodule:: zmq.green
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.rst b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.rst
new file mode 100644
index 00000000..c7c2fb21
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.rst
@@ -0,0 +1,142 @@
+zmq
+===
+
+.. automodule:: zmq
+
+.. currentmodule:: zmq
+
+Basic Classes
+-------------
+
+:class:`Context`
+****************
+
+
+.. autoclass:: Context
+ :members:
+ :undoc-members:
+ :inherited-members:
+ :exclude-members: sockopts, closed
+
+ .. attribute:: closed
+
+ boolean - whether the context has been terminated.
+ If True, you can no longer use this Context.
+
+
+:class:`Socket`
+***************
+
+
+.. autoclass:: Socket
+ :members:
+ :undoc-members:
+ :inherited-members:
+ :exclude-members: closed, context, getsockopt_unicode, recv_unicode, setsockopt_unicode, send_unicode
+
+ .. attribute:: closed
+
+ boolean - whether the socket has been closed.
+ If True, you can no longer use this Socket.
+
+
+
+:class:`Frame`
+**************
+
+
+.. autoclass:: Frame
+ :members:
+ :inherited-members:
+
+
+:class:`MessageTracker`
+***********************
+
+
+.. autoclass:: MessageTracker
+ :members:
+ :inherited-members:
+
+
+Polling
+-------
+
+:class:`Poller`
+***************
+
+.. autoclass:: Poller
+ :members:
+ :inherited-members:
+
+
+.. autofunction:: zmq.select
+
+
+Exceptions
+----------
+
+:class:`ZMQError`
+*****************
+
+.. autoclass:: ZMQError
+ :members:
+ :inherited-members:
+
+
+:class:`ZMQVersionError`
+*****************
+
+.. autoclass:: ZMQVersionError
+ :members:
+ :inherited-members:
+
+:class:`Again`
+**************
+
+
+.. autoclass:: Again
+
+
+:class:`ContextTerminated`
+**************************
+
+
+.. autoclass:: ContextTerminated
+
+
+:class:`NotDone`
+****************
+
+
+.. autoclass:: NotDone
+
+
+:class:`ZMQBindError`
+*********************
+
+
+.. autoclass:: ZMQBindError
+
+
+
+Functions
+---------
+
+.. autofunction:: zmq.zmq_version
+
+.. autofunction:: zmq.pyzmq_version
+
+.. autofunction:: zmq.zmq_version_info
+
+.. autofunction:: zmq.pyzmq_version_info
+
+.. autofunction:: zmq.has
+
+.. autofunction:: zmq.device
+
+.. autofunction:: zmq.proxy
+
+.. autofunction:: zmq.curve_keypair
+
+.. autofunction:: zmq.get_includes \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.utils.win32.rst b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.utils.win32.rst
new file mode 100644
index 00000000..921701ae
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/api/zmq.utils.win32.rst
@@ -0,0 +1,19 @@
+utils.win32
+===========
+
+
+Module: :mod:`zmq.utils.win32`
+------------------------------
+
+.. automodule:: zmq.utils.win32
+
+.. currentmodule:: zmq.utils.win32
+
+
+:class:`allow_interrupt`
+------------------------
+
+
+.. autoclass:: allow_interrupt
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/changelog.rst b/external_libs/python/pyzmq-14.7.0/docs/source/changelog.rst
new file mode 100644
index 00000000..fbca17ea
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/changelog.rst
@@ -0,0 +1,529 @@
+.. PyZMQ changelog summary, started by Min Ragan-Kelley, 2011
+
+.. _changelog:
+
+================
+Changes in PyZMQ
+================
+
+This is a coarse summary of changes in pyzmq versions. For a real changelog, consult the
+`git log <https://github.com/zeromq/pyzmq/commits>`_
+
+14.7.0
+======
+
+Changes:
+
+- Update bundled libzmq to 4.1.2.
+- Following the `lead of Python 3.5 <https://www.python.org/dev/peps/pep-0475/>`_,
+ interrupted system calls will be retried.
+
+Fixes:
+
+- Fixes for CFFI backend on Python 3 + support for PyPy 3.
+- Verify types of all frames in :meth:`~zmq.Socket.send_multipart` before sending,
+ to avoid partial messages.
+- Fix build on Windows when both debug and release versions of libzmq are found.
+- Windows build fixes for Python 3.5.
+
+14.6.0
+======
+
+Changes:
+
+- improvements in :meth:`zmq.Socket.bind_to_random_port`:
+ - use system to allocate ports by default
+ - catch EACCES on Windows
+- include libsodium when building bundled libzmq on Windows (includes wheels on PyPI)
+- pyzmq no longer bundles external libzmq when making a bdist.
+ You can use `delocate <https://pypi.python.org/pypi/delocate>`_ to do this.
+
+Bugfixes:
+
+- add missing :attr:`ndim` on memoryviews of Frames
+- allow :func:`copy.copy` and :func:`copy.deepcopy` on Sockets, Contexts
+
+
+14.5.0
+======
+
+Changes:
+
+- use pickle.DEFAULT_PROTOCOL by default in send_pickle
+- with the release of pip-6, OS X wheels are only marked as 10.6-intel,
+ indicating that they should be installable on any newer or single-arch Python.
+- raise SSHException on failed check of host key
+
+Bugfixes:
+
+- fix method name in utils.wi32.allow_interrupt
+- fork-related fixes in garbage collection thread
+- add missing import in ``zmq.__init__``, causing failure to import in some circumstances
+
+
+14.4.1
+======
+
+Bugfixes for 14.4
+
+- SyntaxError on Python 2.6 in zmq.ssh
+- Handle possible bug in garbage collection after fork
+
+
+14.4.0
+======
+
+New features:
+
+- Experimental support for libzmq-4.1.0 rc (new constants, plus :func:`zmq.has`).
+- Update bundled libzmq to 4.0.5
+- Update bundled libsodium to 1.0.0
+- Fixes for SSH dialogs when using :mod:`zmq.ssh` to create tunnels
+- More build/link/load fixes on OS X and Solaris
+- Get Frame metadata via dict access (libzmq 4)
+- Contexts and Sockets are context managers (term/close on ``__exit__``)
+- Add :class:`zmq.utils.win32.allow_interrupt` context manager for catching SIGINT on Windows
+
+Bugs fixed:
+
+- Bundled libzmq should not trigger recompilation after install on PyPy
+
+14.3.1
+======
+
+.. note::
+
+ pyzmq-14.3.1 is the last version to include bdists for Python 3.3
+
+Minor bugfixes to pyzmq 14.3:
+
+- Fixes to building bundled libzmq on OS X < 10.9
+- Fixes to import-failure warnings on Python 3.4
+- Fixes to tests
+- Pull upstream fixes to zmq.ssh for ssh multiplexing
+
+14.3.0
+======
+
+- PyZMQ no longer calls :meth:`.Socket.close` or :meth:`.Context.term` during process cleanup.
+ Changes to garbage collection in Python 3.4 make this impossible to do sensibly.
+- :meth:`ZMQStream.close` closes its socket immediately, rather than scheduling a timeout.
+- Raise the original ImportError when importing zmq fails.
+ Should be more informative than `no module cffi...`.
+
+.. warning::
+
+ Users of Python 3.4 should not use pyzmq < 14.3, due to changes in garbage collection.
+
+
+14.2.0
+======
+
+New Stuff
+---------
+
+- Raise new ZMQVersionError when a requested method is not supported by the linked libzmq.
+ For backward compatibility, this subclasses NotImplementedError.
+
+
+Bugs Fixed
+----------
+
+- Memory leak introduced in pyzmq-14.0 in zero copy.
+- OverflowError on 32 bit systems in zero copy.
+
+
+14.1.0
+======
+
+Security
+--------
+
+The headline features for 14.1 are adding better support for libzmq's
+security features.
+
+- When libzmq is bundled as a Python extension (e.g. wheels, eggs),
+ libsodium is also bundled (excluding Windows),
+ ensuring that libzmq security is available to users who install from wheels
+- New :mod:`zmq.auth`, implementing zeromq's ZAP authentication,
+ modeled on czmq zauth.
+ For more information, see the `examples <https://github.com/zeromq/pyzmq/tree/master/examples/>`_.
+
+
+Other New Stuff
+---------------
+
+- Add PYZMQ_BACKEND for enabling use of backends outside the pyzmq codebase.
+- Add :attr:`~.Context.underlying` property and :meth:`~.Context.shadow`
+ method to Context and Socket, for handing off sockets and contexts.
+ between pyzmq and other bindings (mainly pyczmq_).
+- Add TOS, ROUTER_HANDOVER, and IPC_FILTER constants from libzmq-4.1-dev.
+- Add Context option support in the CFFI backend.
+- Various small unicode and build fixes, as always.
+- :meth:`~.Socket.send_json` and :meth:`~.Socket.recv_json` pass any extra kwargs to ``json.dumps/loads``.
+
+
+.. _pyczmq: https://github.com/zeromq/pyczmq
+
+
+Deprecations
+------------
+
+- ``Socket.socket_type`` is deprecated, in favor of ``Socket.type``,
+ which has been available since 2.1.
+
+
+14.0.1
+======
+
+Bugfix release
+
+- Update bundled libzmq to current (4.0.3).
+- Fix bug in :meth:`.Context.destroy` with no open sockets.
+- Threadsafety fixes in the garbage collector.
+- Python 3 fixes in :mod:`zmq.ssh`.
+
+
+14.0.0
+======
+
+* Update bundled libzmq to current (4.0.1).
+* Backends are now implemented in ``zmq.backend`` instead of ``zmq.core``.
+ This has no effect on public APIs.
+* Various build improvements for Cython and CFFI backends (PyPy compiles at build time).
+* Various GIL-related performance improvements - the GIL is no longer touched from a zmq IO thread.
+* Adding a constant should now be a bit easier - only zmq/sugar/constant_names should need updating,
+ all other constant-related files should be automatically updated by ``setup.py constants``.
+* add support for latest libzmq-4.0.1
+ (includes ZMQ_CURVE security and socket event monitoring).
+
+New stuff
+---------
+
+- :meth:`.Socket.monitor`
+- :meth:`.Socket.get_monitor_socket`
+- :func:`zmq.curve_keypair`
+- :mod:`zmq.utils.monitor`
+- :mod:`zmq.utils.z85`
+
+
+13.1.0
+======
+
+The main new feature is improved tornado 3 compatibility.
+PyZMQ ships a 'minitornado' submodule, which contains a small subset of tornado 3.0.1,
+in order to get the IOLoop base class. zmq.eventloop.ioloop.IOLoop is now a simple subclass,
+and if the system tornado is ≥ 3.0, then the zmq IOLoop is a proper registered subclass
+of the tornado one itself, and minitornado is entirely unused.
+
+13.0.2
+======
+
+Bugfix release!
+
+A few things were broken in 13.0.0, so this is a quick bugfix release.
+
+* **FIXED** EAGAIN was unconditionally turned into KeyboardInterrupt
+* **FIXED** we used totally deprecated ctypes_configure to generate constants in CFFI backend
+* **FIXED** memory leak in CFFI backend for PyPy
+* **FIXED** typo prevented IPC_PATH_MAX_LEN from ever being defined
+* **FIXED** various build fixes - linking with librt, Cython compatibility, etc.
+
+13.0.1
+======
+
+defunct bugfix. We do not speak of this...
+
+13.0.0
+======
+
+PyZMQ now officially targets libzmq-3 (3.2.2),
+0MQ ≥ 2.1.4 is still supported for the indefinite future, but 3.x is recommended.
+PyZMQ has detached from libzmq versioning,
+and will just follow its own regular versioning scheme from now on.
+PyZMQ bdists will include whatever is the latest stable libzmq release (3.2.2 for pyzmq-13.0).
+
+.. note::
+
+ set/get methods are exposed via get/setattr on all Context, Socket, and Frame classes.
+ This means that subclasses of these classes that require extra attributes
+ **must declare these attributes at the class level**.
+
+Experiments Removed
+-------------------
+
+* The Threadsafe ZMQStream experiment in 2.2.0.1 was deemed inappropriate and not useful,
+ and has been removed.
+* The :mod:`zmq.web` experiment has been removed,
+ to be developed as a `standalone project <https://github.com/ellisonbg/zmqweb>`_.
+
+New Stuff
+---------
+
+* Support for PyPy via CFFI backend (requires py, ctypes-configure, and cffi).
+* Add support for new APIs in libzmq-3
+
+ - :meth:`.Socket.disconnect`
+ - :meth:`.Socket.unbind`
+ - :meth:`.Context.set`
+ - :meth:`.Context.get`
+ - :meth:`.Frame.set`
+ - :meth:`.Frame.get`
+ - :func:`zmq.proxy`
+ - :class:`zmq.devices.Proxy`
+ - Exceptions for common zmq errnos: :class:`zmq.Again`, :class:`zmq.ContextTerminated`
+ (subclass :class:`ZMQError`, so fully backward-compatible).
+
+
+* Setting and getting :attr:`.Socket.hwm` sets or gets *both* SNDHWM/RCVHWM for libzmq-3.
+* Implementation splits core Cython bindings from pure-Python subclasses
+ with sugar methods (send/recv_multipart). This should facilitate
+ non-Cython backends and PyPy support [spoiler: it did!].
+
+
+Bugs Fixed
+----------
+
+* Unicode fixes in log and monitored queue
+* MinGW, ppc, cross-compilation, and HP-UX build fixes
+* :mod:`zmq.green` should be complete - devices and tornado eventloop both work
+ in gevent contexts.
+
+
+2.2.0.1
+=======
+
+This is a tech-preview release, to try out some new features.
+It is expected to be short-lived, as there are likely to be issues to iron out,
+particularly with the new pip-install support.
+
+Experimental New Stuff
+----------------------
+
+These features are marked 'experimental', which means that their APIs are not set in stone,
+and may be removed or changed in incompatible ways in later releases.
+
+
+Threadsafe ZMQStream
+********************
+
+With the IOLoop inherited from tornado, there is exactly one method that is threadsafe:
+:meth:`.IOLoop.add_callback`. With this release, we are trying an experimental option
+to pass all IOLoop calls via this method, so that ZMQStreams can be used from one thread
+while the IOLoop runs in another. To try out a threadsafe stream:
+
+.. sourcecode:: python
+
+ stream = ZMQStream(socket, threadsafe=True)
+
+
+pip install pyzmq
+*****************
+
+PyZMQ should now be pip installable, even on systems without libzmq.
+In these cases, when pyzmq fails to find an appropriate libzmq to link against,
+it will try to build libzmq as a Python extension.
+This work is derived from `pyzmq_static <https://github.com/brandon-rhodes/pyzmq-static>`_.
+
+To this end, PyZMQ source distributions include the sources for libzmq (2.2.0) and libuuid (2.21),
+both used under the LGPL.
+
+
+zmq.green
+*********
+
+The excellent `gevent_zeromq <https://github.com/traviscline/gevent_zeromq>`_ socket
+subclass which provides `gevent <http://www.gevent.org/>`_ compatibility has been merged as
+:mod:`zmq.green`.
+
+.. seealso::
+
+ :ref:`zmq_green`
+
+
+Bugs Fixed
+----------
+
+* TIMEO sockopts are properly included for libzmq-2.2.0
+* avoid garbage collection of sockets after fork (would cause ``assert (mailbox.cpp:79)``).
+
+
+2.2.0
+=====
+
+Some effort has gone into refining the pyzmq API in this release to make it a model for
+other language bindings. This is principally made in a few renames of objects and methods,
+all of which leave the old name for backwards compatibility.
+
+.. note::
+
+ As of this release, all code outside ``zmq.core`` is BSD licensed (where
+ possible), to allow more permissive use of less-critical code and utilities.
+
+Name Changes
+------------
+
+* The :class:`~.Message` class has been renamed to :class:`~.Frame`, to better match other
+ zmq bindings. The old Message name remains for backwards-compatibility. Wherever pyzmq
+ docs say "Message", they should refer to a complete zmq atom of communication (one or
+ more Frames, connected by ZMQ_SNDMORE). Please report any remaining instances of
+ Message==MessagePart with an Issue (or better yet a Pull Request).
+
+* All ``foo_unicode`` methods are now called ``foo_string`` (``_unicode`` remains for
+ backwards compatibility). This is not only for cross-language consistency, but it makes
+ more sense in Python 3, where native strings are unicode, and the ``_unicode`` suffix
+ was wedded too much to Python 2.
+
+Other Changes and Removals
+--------------------------
+
+* ``prefix`` removed as an unused keyword argument from :meth:`~.Socket.send_multipart`.
+
+* ZMQStream :meth:`~.ZMQStream.send` default has been changed to `copy=True`, so it matches
+ Socket :meth:`~.Socket.send`.
+
+* ZMQStream :meth:`~.ZMQStream.on_err` is deprecated, because it never did anything.
+
+* Python 2.5 compatibility has been dropped, and some code has been cleaned up to reflect
+ no-longer-needed hacks.
+
+* Some Cython files in :mod:`zmq.core` have been split, to reduce the amount of
+ Cython-compiled code. Much of the body of these files were pure Python, and thus did
+ not benefit from the increased compile time. This change also aims to ease maintaining
+ feature parity in other projects, such as
+ `pyzmq-ctypes <https://github.com/svpcom/pyzmq-ctypes>`_.
+
+
+New Stuff
+---------
+
+* :class:`~.Context` objects can now set default options when they create a socket. These
+ are set and accessed as attributes to the context. Socket options that do not apply to a
+ socket (e.g. SUBSCRIBE on non-SUB sockets) will simply be ignored.
+
+* :meth:`~.ZMQStream.on_recv_stream` has been added, which adds the stream itself as a
+ second argument to the callback, making it easier to use a single callback on multiple
+ streams.
+
+* A :attr:`~Frame.more` boolean attribute has been added to the :class:`~.Frame` (née
+ Message) class, so that frames can be identified as terminal without extra queires of
+ :attr:`~.Socket.rcvmore`.
+
+
+Experimental New Stuff
+----------------------
+
+These features are marked 'experimental', which means that their APIs are not
+set in stone, and may be removed or changed in incompatible ways in later releases.
+
+* :mod:`zmq.web` added for load-balancing requests in a tornado webapp with zeromq.
+
+
+2.1.11
+======
+
+* remove support for LABEL prefixes. A major feature of libzmq-3.0, the LABEL
+ prefix, has been removed from libzmq, prior to the first stable libzmq 3.x release.
+
+ * The prefix argument to :meth:`~.Socket.send_multipart` remains, but it continue to behave in
+ exactly the same way as it always has on 2.1.x, simply prepending message parts.
+
+ * :meth:`~.Socket.recv_multipart` will always return a list, because prefixes are once
+ again indistinguishable from regular message parts.
+
+* add :meth:`.Socket.poll` method, for simple polling of events on a single socket.
+
+* no longer require monkeypatching tornado IOLoop. The :class:`.ioloop.ZMQPoller` class
+ is a poller implementation that matches tornado's expectations, and pyzmq sockets can
+ be used with any tornado application just by specifying the use of this poller. The
+ pyzmq IOLoop implementation now only trivially differs from tornado's.
+
+ It is still recommended to use :func:`.ioloop.install`, which sets *both* the zmq and
+ tornado global IOLoop instances to the same object, but it is no longer necessary.
+
+ .. warning::
+
+ The most important part of this change is that the ``IOLoop.READ/WRITE/ERROR``
+ constants now match tornado's, rather than being mapped directly to the zmq
+ ``POLLIN/OUT/ERR``. So applications that used the low-level :meth:`IOLoop.add_handler`
+ code with ``POLLIN/OUT/ERR`` directly (used to work, but was incorrect), rather than
+ using the IOLoop class constants will no longer work. Fixing these to use the IOLoop
+ constants should be insensitive to the actual value of the constants.
+
+2.1.10
+======
+
+* Add support for libzmq-3.0 LABEL prefixes:
+
+ .. warning::
+
+ This feature has been removed from libzmq, and thus removed from future pyzmq
+ as well.
+
+ * send a message with label-prefix with:
+
+ .. sourcecode:: python
+
+ send_multipart([b'msg', b'parts'], prefix=[b'label', b'prefix'])
+
+ * :meth:`recv_multipart` returns a tuple of ``(prefix,msg)`` if a label prefix is detected
+ * ZMQStreams and devices also respect the LABEL prefix
+
+* add czmq-style close&term as :meth:`ctx.destroy`, so that :meth:`ctx.term`
+ remains threadsafe and 1:1 with libzmq.
+* :meth:`Socket.close` takes optional linger option, for setting linger prior
+ to closing.
+* add :func:`~zmq.core.version.zmq_version_info` and
+ :func:`~zmq.core.version.pyzmq_version_info` for getting libzmq and pyzmq versions as
+ tuples of numbers. This helps with the fact that version string comparison breaks down
+ once versions get into double-digits.
+* ioloop changes merged from upstream `Tornado <http://www.tornadoweb.org>`_ 2.1
+
+2.1.9
+=====
+
+* added zmq.ssh tools for tunneling socket connections, copied from IPython
+* Expanded sockopt support to cover changes in libzmq-4.0 dev.
+* Fixed an issue that prevented :exc:`KeyboardInterrupts` from being catchable.
+* Added attribute-access for set/getsockopt. Setting/Getting attributes of :class:`Sockets`
+ with the names of socket options is mapped to calls of set/getsockopt.
+
+.. sourcecode:: python
+
+ s.hwm = 10
+ s.identity = b'whoda'
+ s.linger
+ # -1
+
+* Terminating a :class:`~Context` closes the sockets it created, matching the behavior in
+ `czmq <http://czmq.zeromq.org/>`_.
+* :class:`ThreadDevices` use :meth:`Context.instance` to create sockets, so they can use
+ inproc connections to sockets in other threads.
+* fixed units error on :func:`zmq.select`, where the poll timeout was 1000 times longer
+ than expected.
+* Add missing ``DEALER/ROUTER`` socket type names (currently aliases, to be replacements for ``XREP/XREQ``).
+* base libzmq dependency raised to 2.1.4 (first stable release) from 2.1.0.
+
+
+2.1.7.1
+=======
+
+* bdist for 64b Windows only. This fixed a type mismatch on the ``ZMQ_FD`` sockopt
+ that only affected that platform.
+
+
+2.1.7
+=====
+
+* Added experimental support for libzmq-3.0 API
+* Add :func:`zmq.eventloop.ioloop.install` for using pyzmq's IOLoop in a tornado
+ application.
+
+
+2.1.4
+=====
+
+* First version with binary distribution support
+* Added :meth:`~Context.instance()` method for using a single Context throughout an application
+ without passing references around.
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/conf.py b/external_libs/python/pyzmq-14.7.0/docs/source/conf.py
new file mode 100644
index 00000000..dcccabad
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/conf.py
@@ -0,0 +1,216 @@
+# -*- coding: utf-8 -*-
+#
+# PyZMQ documentation build configuration file, created by
+# sphinx-quickstart on Sat Feb 20 23:31:19 2010.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+import string
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('../sphinxext'))
+sys.path.append(os.path.abspath('../..'))
+
+# set target libzmq version
+from buildutils.bundle import bundled_version
+target_libzmq = '%i.%i.%i' % bundled_version
+
+rst_epilog = """
+.. |target_libzmq| replace:: {target_libzmq}
+""".format(**locals())
+
+# patch autodoc to work with Cython Sources
+import sphinx_cython
+
+# -- General configuration -----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.intersphinx',
+ 'sphinx.ext.napoleon',
+ ]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'PyZMQ'
+copyright = u"""Brian E. Granger & Min Ragan-Kelley.
+ØMQ logo © iMatix Corportation, used under the Creative Commons Attribution-Share Alike 3.0 License.
+Python logo ™ of the Python Software Foundation, used by Min RK with permission from the Foundation"""
+
+intersphinx_mapping = {'python': ('http://docs.python.org/3', None)}
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+
+import zmq
+
+# The short X.Y version.
+version = zmq.__version__.split('-')[0]
+# The full version, including alpha/beta/rc tags.
+release = zmq.__version__
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+# html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+html_favicon = '_static/zeromq.ico'
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'PyZMQdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+ ('index', 'PyZMQ.tex', u'PyZMQ Documentation',
+ u'Brian E. Granger \\and Min Ragan-Kelley', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/devices.rst b/external_libs/python/pyzmq-14.7.0/docs/source/devices.rst
new file mode 100644
index 00000000..4ef70cee
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/devices.rst
@@ -0,0 +1,82 @@
+.. PyZMQ devices doc, by Min Ragan-Kelley, 2011
+
+.. _devices:
+
+Devices in PyZMQ
+================
+
+.. seealso::
+
+ ØMQ Guide `Device coverage <http://zguide.zeromq.org/chapter:all#toc32>`_.
+
+ØMQ has a notion of Devices - simple programs that manage a send-recv pattern for
+connecting two or more sockets. Being full programs, devices include a ``while(True)``
+loop and thus block execution permanently once invoked. We have provided in the
+:mod:`devices` subpackage some facilities for running these devices in the background, as
+well as a custom three-socket MonitoredQueue_ device.
+
+
+BackgroundDevices
+-----------------
+
+It seems fairly rare that in a Python program one would actually want to create a zmq
+device via :func:`.device` in the main thread, since such a call would block execution
+forever. The most likely model for launching devices is in background threads or
+processes. We have provided classes for launching devices in a background thread with
+:class:`.ThreadDevice` and via multiprocessing with :class:`.ProcessDevice`. For
+threadsafety and running across processes, these methods do not take Socket objects as
+arguments, but rather socket types, and then the socket creation and configuration happens
+via the BackgroundDevice's :meth:`foo_in` proxy methods. For each configuration method
+(bind/connect/setsockopt), there are proxy methods for calling those methods on the Socket
+objects created in the background thread or process, prefixed with 'in\_' or 'out\_',
+corresponding to the `in_socket` and `out_socket`::
+
+ from zmq.devices import ProcessDevice
+
+ pd = ProcessDevice(zmq.QUEUE, zmq.ROUTER, zmq.DEALER)
+ pd.bind_in('tcp://*:12345')
+ pd.connect_out('tcp://127.0.0.1:12543')
+ pd.setsockopt_in(zmq.IDENTITY, 'ROUTER')
+ pd.setsockopt_out(zmq.IDENTITY, 'DEALER')
+ pd.start()
+ # it will now be running in a background process
+
+MonitoredQueue
+--------------
+
+One of ØMQ's builtin devices is the ``QUEUE``. This is a symmetric two-socket device that
+fully supports passing messages in either direction via any pattern. We saw a logical
+extension of the ``QUEUE`` as one that behaves in the same way with respect to the in/out
+sockets, but also sends every message in either direction *also* on a third `monitor`
+socket. For performance reasons, this :func:`.monitored_queue` function is written in
+Cython, so the loop does not involve Python, and should have the same performance as the
+basic ``QUEUE`` device.
+
+One shortcoming of the ``QUEUE`` device is that it does not support having ``ROUTER``
+sockets as both input and output. This is because ``ROUTER`` sockets, when they receive a
+message, prepend the ``IDENTITY`` of the socket that sent the message (for use in routing
+the reply). The result is that the output socket will always try to route the incoming
+message back to the original sender, which is presumably not the intended pattern. In
+order for the queue to support a ROUTER-ROUTER connection, it must swap the first two parts
+of the message in order to get the right message out the other side.
+
+To invoke a monitored queue is similar to invoking a regular ØMQ device::
+
+ from zmq.devices import monitored_queue
+ ins = ctx.socket(zmq.ROUTER)
+ outs = ctx.socket(zmq.DEALER)
+ mons = ctx.socket(zmq.PUB)
+ configure_sockets(ins,outs,mons)
+ monitored_queue(ins, outs, mons, in_prefix='in', out_prefix='out')
+
+The `in_prefix` and `out_prefix` default to 'in' and 'out' respectively, and a PUB socket
+is most logical for the monitor socket, since it will never receive messages, and the
+in/out prefix is well suited to the PUB/SUB topic subscription model. All messages sent on
+`mons` will be multipart, the first part being the prefix corresponding to the socket that
+received the message.
+
+Or for launching an MQ in the background, there are :class:`.ThreadMonitoredQueue` and
+:class:`.ProcessMonitoredQueue`, which function just like the base
+BackgroundDevice objects, but add :meth:`foo_mon` methods for configuring the monitor socket.
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/eventloop.rst b/external_libs/python/pyzmq-14.7.0/docs/source/eventloop.rst
new file mode 100644
index 00000000..3126b8b6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/eventloop.rst
@@ -0,0 +1,197 @@
+.. PyZMQ eventloop doc, by Min Ragan-Kelley, 2011
+
+.. _eventloop:
+
+====================
+Eventloops and PyZMQ
+====================
+
+Tornado IOLoop
+==============
+
+Facebook's `Tornado`_ includes an eventloop for handing poll events on filedescriptors and
+native sockets. We have included a small part of Tornado (specifically its
+:mod:`.ioloop`), and adapted its :class:`IOStream` class into :class:`.ZMQStream` for
+handling poll events on ØMQ sockets. A ZMQStream object works much like a Socket object,
+but instead of calling :meth:`~.Socket.recv` directly, you register a callback with
+:meth:`~.ZMQStream.on_recv`. Callbacks can also be registered for send events
+with :meth:`~.ZMQStream.on_send`.
+
+
+:func:`install()`
+-----------------
+
+With PyZMQ's ioloop, you can use zmq sockets in any tornado application. You must first
+install PyZMQ's :class:`.IOLoop`, with the :func:`.ioloop.install` function:
+
+.. sourcecode:: python
+
+ from zmq.eventloop import ioloop
+ ioloop.install()
+
+This sets the global instance of :class:`tornado.ioloop.IOLoop` with the global instance of
+our IOLoop class. The reason this must happen is that tornado objects avoid having to pass
+the active IOLoop instance around by having a staticmethod :meth:`.IOLoop.instance`, which
+always returns the active instance. If PyZMQ's IOLoop is installed after the first call to
+:meth:`.IOLoop.instance()` (called in almost every tornado object constructor), then it will
+raise an :exc:`AssertionError`, because the global IOLoop instance has already been
+created, and proceeding would result in not all objects being associated with the right
+IOLoop.
+
+It is possible to use PyZMQ sockets with tornado *without* calling :func:`.ioloop.install`,
+but it is less convenient. First, you must instruct the tornado IOLoop to use the zmq poller:
+
+.. sourcecode:: python
+
+ from zmq.eventloop.ioloop import ZMQIOLoop
+
+ loop = ZMQIOLoop()
+
+Then, when you instantiate tornado and ZMQStream objects, you must pass the `io_loop`
+argument to ensure that they use this loop, instead of the global instance.
+
+This is especially useful for writing tests, such as this:
+
+.. sourcecode:: python
+
+ from tornado.testing import AsyncTestCase
+ from zmq.eventloop.ioloop import ZMQIOLoop
+ from zmq.eventloop.zmqstream import ZMQStream
+
+ class TestZMQBridge(AsyncTestCase):
+
+ # Use a ZMQ-compatible I/O loop so that we can use `ZMQStream`.
+ def get_new_ioloop(self):
+ return ZMQIOLoop()
+
+You can also manually install this IOLoop as the global tornado instance, with:
+
+.. sourcecode:: python
+
+ from zmq.eventloop.ioloop import ZMQIOLoop
+ loop = ZMQIOLoop()
+ loop.install()
+
+but it will **NOT** be the global *pyzmq* IOLoop instance, so it must still be
+passed to your ZMQStream constructors.
+
+
+:meth:`send`
+------------
+
+ZMQStream objects do have :meth:`~.ZMQStream.send` and :meth:`~.ZMQStream.send_multipart`
+methods, which behaves the same way as :meth:`.Socket.send`, but instead of sending right
+away, the :class:`.IOLoop` will wait until socket is able to send (for instance if ``HWM``
+is met, or a ``REQ/REP`` pattern prohibits sending at a certain point). Messages sent via
+send will also be passed to the callback registered with :meth:`~.ZMQStream.on_send` after
+sending.
+
+:meth:`on_recv`
+---------------
+
+:meth:`.ZMQStream.on_recv` is the primary method for using a ZMQStream. It registers a
+callback to fire with messages as they are received, which will *always* be multipart,
+even if its length is 1. You can easily use this to build things like an echo socket:
+
+.. sourcecode:: python
+
+ s = ctx.socket(zmq.REP)
+ s.bind('tcp://localhost:12345')
+ stream = ZMQStream(s)
+ def echo(msg):
+ stream.send_multipart(msg)
+ stream.on_recv(echo)
+ ioloop.IOLoop.instance().start()
+
+on_recv can also take a `copy` flag, just like :meth:`.Socket.recv`. If `copy=False`, then
+callbacks registered with on_recv will receive tracked :class:`.Frame` objects instead of
+bytes.
+
+.. note::
+
+ A callback must be registered using either :meth:`.ZMQStream.on_recv` or
+ :meth:`.ZMQStream.on_recv_stream` before any data will be received on the
+ underlying socket. This allows you to temporarily pause processing on a
+ socket by setting both callbacks to None. Processing can later be resumed
+ by restoring either callback.
+
+
+:meth:`on_recv_stream`
+----------------------
+
+:meth:`.ZMQStream.on_recv_stream` is just like on_recv above, but the callback will be
+passed both the message and the stream, rather than just the message. This is meant to make
+it easier to use a single callback with multiple streams.
+
+.. sourcecode:: python
+
+ s1 = ctx.socket(zmq.REP)
+ s1.bind('tcp://localhost:12345')
+ stream1 = ZMQStream(s1)
+
+ s2 = ctx.socket(zmq.REP)
+ s2.bind('tcp://localhost:54321')
+ stream2 = ZMQStream(s2)
+
+ def echo(stream, msg):
+ stream.send_multipart(msg)
+
+ stream1.on_recv_stream(echo)
+ stream2.on_recv_stream(echo)
+
+ ioloop.IOLoop.instance().start()
+
+
+:meth:`flush`
+-------------
+
+Sometimes with an eventloop, there can be multiple events ready on a single iteration of
+the loop. The :meth:`~.ZMQStream.flush` method allows developers to pull messages off of
+the queue to enforce some priority over the event loop ordering. flush pulls any pending
+events off of the queue. You can specify to flush only recv events, only send events, or
+any events, and you can specify a limit for how many events to flush in order to prevent
+starvation.
+
+.. _Tornado: https://github.com/facebook/tornado
+
+.. _zmq_green:
+
+PyZMQ and gevent
+================
+
+PyZMQ ≥ 2.2.0.1 ships with a `gevent <http://www.gevent.org/>`_ compatible API as :mod:`zmq.green`.
+To use it, simply:
+
+.. sourcecode:: python
+
+ import zmq.green as zmq
+
+Then write your code as normal.
+
+Socket.send/recv and zmq.Poller are gevent-aware.
+
+In PyZMQ ≥ 2.2.0.2, green.device and green.eventloop should be gevent-friendly as well.
+
+.. note::
+
+ The green device does *not* release the GIL, unlike the true device in zmq.core.
+
+zmq.green.eventloop includes minimally patched IOLoop/ZMQStream in order to use the gevent-enabled Poller,
+so you should be able to use the ZMQStream interface in gevent apps as well,
+though using two eventloops simultaneously (tornado + gevent) is not recommended.
+
+.. warning::
+
+ There is a `known issue <https://github.com/zeromq/pyzmq/issues/229>`_ in gevent ≤ 1.0 or libevent,
+ which can cause zeromq socket events to be missed.
+ PyZMQ works around this by adding a timeout so it will not wait forever for gevent to notice events.
+ The only known solution for this is to use gevent ≥ 1.0, which is currently at 1.0b3,
+ and does not exhibit this behavior.
+
+.. seealso::
+
+ zmq.green examples `on GitHub <https://github.com/zeromq/pyzmq/tree/master/examples/gevent>`_.
+
+:mod:`zmq.green` is simply `gevent_zeromq <https://github.com/traviscline/gevent_zeromq>`_,
+merged into the pyzmq project.
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/index.rst b/external_libs/python/pyzmq-14.7.0/docs/source/index.rst
new file mode 100644
index 00000000..84e2500b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/index.rst
@@ -0,0 +1,96 @@
+.. PyZMQ documentation master file, created by
+ sphinx-quickstart on Sat Feb 20 23:31:19 2010.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+PyZMQ Documentation
+===================
+
+:Release: |release|
+:Date: |today|
+
+
+PyZMQ is the Python bindings for ØMQ_. This
+documentation currently contains notes on some important aspects of developing PyZMQ and
+an overview of what the ØMQ API looks like in Python. For information on how to use
+ØMQ in general, see the many examples in the excellent `ØMQ Guide`_, all of which
+have a version in Python.
+
+PyZMQ works with Python 3 (≥ 3.2), and Python 2 (≥ 2.6), with no transformations or 2to3,
+as well as PyPy (at least 2.0 beta), thanks to a new CFFI backend.
+
+Please don't hesitate to report pyzmq-specific issues to our tracker_ on GitHub.
+General questions about ØMQ are better sent to the ØMQ `mailing list`_ or `IRC Channel`_.
+
+:ref:`Summary of Changes in PyZMQ <changelog>`
+
+
+Supported LibZMQ
+================
+
+PyZMQ aims to support all stable ( ≥2.1.4, ≥ 3.2.2, ≥ 4.0.1 ) and active development ( ≥ 4.2.0 )
+versions of libzmq. Building the same pyzmq against various versions of libzmq is supported,
+but only the functionality of the linked libzmq will be available.
+
+.. note::
+
+ libzmq 3.0-3.1 are not, and will never be supported.
+ There never was a stable release of either.
+
+
+Binary distributions (wheels on `PyPI <http://pypi.python.org/pypi/pyzmq>`__
+or `GitHub <https://www.github.com/zeromq/pyzmq/downloads>`__) of PyZMQ ship with
+the stable version of libzmq at the time of release, built with default configuration,
+and include libsodium for security.
+For pyzmq-|release|, this is |target_libzmq|.
+
+Using PyZMQ
+===========
+
+.. toctree::
+ :maxdepth: 2
+
+ api/index.rst
+ morethanbindings.rst
+ serialization.rst
+ devices.rst
+ eventloop.rst
+ logging.rst
+ ssh.rst
+
+
+Notes from developing PyZMQ
+===========================
+
+.. toctree::
+ :maxdepth: 2
+
+ pyversions.rst
+ unicode.rst
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
+Links
+=====
+
+* ØMQ_ Home
+* The `ØMQ Guide`_
+* `PyZMQ Installation`_ notes on the ZeroMQ website
+* PyZMQ on GitHub_
+* Issue Tracker_
+
+.. _ØMQ: http://www.zeromq.org
+.. _ØMQ Guide: http://zguide.zeromq.org
+.. _mailing list: http://www.zeromq.org/docs:mailing-lists
+.. _IRC Channel: http://www.zeromq.org/chatroom
+.. _Cython: http://cython.org/
+.. _GitHub: https://www.github.com/zeromq/pyzmq
+.. _ØMQ Manual: http://www.zeromq.org/intro:read-the-manual
+.. _PyZMQ Installation: http://www.zeromq.org/bindings:python
+.. _tracker: https://www.github.com/zeromq/pyzmq/issues
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/logging.rst b/external_libs/python/pyzmq-14.7.0/docs/source/logging.rst
new file mode 100644
index 00000000..d5204af4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/logging.rst
@@ -0,0 +1,84 @@
+.. PyZMQ logging doc, by Min Ragan-Kelley, 2011
+
+.. _logging:
+
+Asynchronous Logging via PyZMQ
+==============================
+
+.. seealso::
+
+ * The ØMQ guide `coverage <http://zguide.zeromq.org/chapter:all#toc7>`_ of PUB/SUB
+ messaging
+ * Python logging module `documentation <http://docs.python.org/library/logging.html>`_
+
+Python provides extensible logging facilities through its :py:mod:`logging` module. This
+module allows for easily extensible logging functionality through the use of
+:py:class:`~logging.Handler` objects. The most obvious case for hooking up pyzmq to
+logging would be to broadcast log messages over a PUB socket, so we have provided a
+:class:`.PUBHandler` class for doing just that.
+
+PUB/SUB and Topics
+------------------
+
+The ØMQ PUB/SUB pattern consists of a PUB socket broadcasting messages, and a collection
+of SUB sockets that receive those messages. Each PUB message is a multipart-message, where
+the first part is interpreted as a topic. SUB sockets can subscribe to topics by setting
+their ``SUBSCRIBE`` sockopt, e.g.::
+
+ sub = ctx.socket(zmq.SUB)
+ sub.setsockopt(zmq.SUBSCRIBE, 'topic1')
+ sub.setsockopt(zmq.SUBSCRIBE, 'topic2')
+
+When subscribed, the SUB socket will only receive messages where the first part *starts
+with* one of the topics set via ``SUBSCRIBE``. The default behavior is to exclude all
+messages, and subscribing to the empty string '' will receive all messages.
+
+PUBHandler
+----------
+
+The :class:`.PUBHandler` object is created for allowing the python logging to be emitted
+on a PUB socket. The main difference between a PUBHandler and a regular logging Handler is
+the inclusion of topics. For the most basic logging, you can simply create a PUBHandler
+with an interface or a configured PUB socket, and just let it go::
+
+ pub = context.socket(zmq.PUB)
+ pub.bind('tcp://*:12345')
+ handler = PUBHandler(pub)
+ logger = logging.getLogger()
+ logger.addHandler(handler)
+
+At this point, all messages logged with the default logger will be broadcast on the pub
+socket.
+
+the PUBHandler does work with topics, and the handler has an attribute ``root_topic``::
+
+ handler.root_topic = 'myprogram'
+
+Python loggers also have loglevels. The base topic of messages emitted by the PUBHandler
+will be of the form: ``<handler.root_topic>.<loglevel>``, e.g. 'myprogram.INFO' or
+'whatever.ERROR'. This way, subscribers can easily subscribe to subsets of the logging
+messages. Log messages are always two-part, where the first part is the topic tree, and
+the second part is the actual log message.
+
+ >>> logger.info('hello there')
+ >>> print sub.recv_multipart()
+ ['myprogram.INFO', 'hello there']
+
+Subtopics
+*********
+
+You can also add to the topic tree below the loglevel on an individual message basis.
+Assuming your logger is connected to a PUBHandler, you can add as many additional topics
+on the front of the message, which will be added always after the loglevel. A special
+delimiter defined at ``zmq.log.handlers.TOPIC_DELIM`` is scanned by the PUBHandler, so if
+you pass your own subtopics prior to that symbol, they will be stripped from the message
+and added to the topic tree::
+
+ >>> log_msg = "hello there"
+ >>> subtopic = "sub.topic"
+ >>> msg = zmq.log.handlers.TOPIC_DELIM.join([subtopic, log_msg])
+ >>> logger.warn(msg)
+ >>> print sub.recv_multipart()
+ ['myprogram.WARN.sub.topic', 'hello there']
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/morethanbindings.rst b/external_libs/python/pyzmq-14.7.0/docs/source/morethanbindings.rst
new file mode 100644
index 00000000..1bff8f0c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/morethanbindings.rst
@@ -0,0 +1,166 @@
+.. PyZMQ Bindings doc, by Min Ragan-Kelley, 2011
+
+.. _bindings:
+
+More Than Just Bindings
+=======================
+
+PyZMQ is ostensibly the Python bindings for `ØMQ`_, but the project, following
+Python's 'batteries included' philosophy, provides more than just Python methods and
+objects for calling into the ØMQ C++ library.
+
+
+
+The Core as Bindings
+--------------------
+
+PyZMQ is currently broken up into four subpackages. First, is the Core. :mod:`zmq.core`
+contains the actual bindings for ZeroMQ, and no extended functionality beyond the very
+basic. The core modules are split, such that each basic ZeroMQ object (or function, if no
+object is associated) is a separate module, e.g. :mod:`zmq.core.context` contains the
+:class:`.Context` object, :mod:`zmq.core.poll` contains a :class:`.Poller` object, as well
+as the :func:`.select` function, etc. ZMQ constants are, for convenience, all kept
+together in :mod:`zmq.core.constants`.
+
+There are two reasons for breaking the core into submodules: *recompilation* and
+*derivative projects*. The monolithic PyZMQ became quite tedious to have to recompile
+everything for a small change to a single object. With separate files, that's no longer
+necessary. The second reason has to do with Cython. PyZMQ is written in Cython, a tool for
+efficiently writing C-extensions for Python. By separating out our objects into individual
+`pyx` files, each with their declarations in a `pxd` header, other projects can write
+extensions in Cython and call directly to ZeroMQ at the C-level without the penalty of
+going through our Python objects.
+
+Thread Safety
+-------------
+
+In ØMQ, Contexts are threadsafe objects, but Sockets are **not**. It is safe to use a
+single Context (e.g. via :meth:`zmq.Context.instance`) in your entire multithreaded
+application, but you should create sockets on a per-thread basis. If you share sockets
+across threads, you are likely to encounter uncatchable c-level crashes of your
+application unless you use judicious application of :py:class:`threading.Lock`, but this
+approach is not recommended.
+
+.. seealso::
+
+ ZeroMQ API note on threadsafety on `2.2 <http://api.zeromq.org/2-2:zmq>`_
+ or `3.2 <http://api.zeromq.org/3-2:zmq>`_
+
+
+Socket Options as Attributes
+----------------------------
+
+.. versionadded:: 2.1.9
+
+In 0MQ, socket options are set/retrieved with the :meth:`set/getsockopt` methods. With the
+class-based approach in pyzmq, it would be logical to perform these operations with
+simple attribute access, and this has been added in pyzmq 2.1.9. Simply assign to or
+request a Socket attribute with the (case-insensitive) name of a sockopt, and it should
+behave just as you would expect:
+
+.. sourcecode:: python
+
+ s = ctx.socket(zmq.DEALER)
+ s.identity = b'dealer'
+ s.hwm = 10
+ s.events
+ # 0
+ s.fd
+ # 16
+
+
+Default Options on the Context
+******************************
+
+.. versionadded:: 2.1.11
+
+Just like setting socket options as attributes on Sockets, you can do the same on Contexts.
+This affects the default options of any *new* sockets created after the assignment.
+
+.. sourcecode:: python
+
+ ctx = zmq.Context()
+ ctx.linger = 0
+ rep = ctx.socket(zmq.REP)
+ req = ctx.socket(zmq.REQ)
+
+Socket options that do not apply to a socket (e.g. SUBSCRIBE on non-SUB sockets) will
+simply be ignored.
+
+
+Core Extensions
+---------------
+
+We have extended the core functionality in two ways that appear inside the :mod:`core`
+bindings, and are not general ØMQ features.
+
+Builtin Serialization
+*********************
+
+First, we added common serialization with the builtin :py:mod:`json` and :py:mod:`pickle`
+as first-class methods to the :class:`Socket` class. A socket has the methods
+:meth:`~.Socket.send_json` and :meth:`~.Socket.send_pyobj`, which correspond to sending an
+object over the wire after serializing with :mod:`json` and :mod:`pickle` respectively,
+and any object sent via those methods can be reconstructed with the
+:meth:`~.Socket.recv_json` and :meth:`~.Socket.recv_pyobj` methods. Unicode strings are
+other objects that are not unambiguously sendable over the wire, so we include
+:meth:`~.Socket.send_string` and :meth:`~.Socket.recv_string` that simply send bytes
+after encoding the message ('utf-8' is the default).
+
+.. seealso::
+
+ * :ref:`Further information <serialization>` on serialization in pyzmq.
+
+ * :ref:`Our Unicode discussion <unicode>` for more information on the trials and
+ tribulations of working with Unicode in a C extension while supporting Python 2 and 3.
+
+
+MessageTracker
+**************
+
+The second extension of basic ØMQ functionality is the :class:`MessageTracker`. The
+MessageTracker is an object used to track when the underlying ZeroMQ is done with a
+message buffer. One of the main use cases for ØMQ in Python is the ability to perform
+non-copying sends. Thanks to Python's buffer interface, many objects (including NumPy
+arrays) provide the buffer interface, and are thus directly sendable. However, as with any
+asynchronous non-copying messaging system like ØMQ or MPI, it can be important to know
+when the message has actually been sent, so it is safe again to edit the buffer without
+worry of corrupting the message. This is what the MessageTracker is for.
+
+The MessageTracker is a simple object, but there is a penalty to its use. Since by its
+very nature, the MessageTracker must involve threadsafe communication (specifically a
+builtin :py:class:`~Queue.Queue` object), instantiating a MessageTracker takes a modest
+amount of time (10s of µs), so in situations instantiating many small messages, this can
+actually dominate performance. As a result, tracking is optional, via the ``track`` flag,
+which is optionally passed, always defaulting to ``False``, in each of the three places
+where a Frame object (the pyzmq object for wrapping a segment of a message) is
+instantiated: The :class:`.Frame` constructor, and non-copying sends and receives.
+
+A MessageTracker is very simple, and has just one method and one attribute. The property
+:attr:`MessageTracker.done` will be ``True`` when the Frame(s) being tracked are no
+longer in use by ØMQ, and :meth:`.MessageTracker.wait` will block, waiting for the
+Frame(s) to be released.
+
+.. Note::
+
+ A Frame cannot be tracked after it has been instantiated without tracking. If a
+ Frame is to even have the *option* of tracking, it must be constructed with
+ ``track=True``.
+
+
+Extensions
+----------
+
+So far, PyZMQ includes four extensions to core ØMQ that we found basic enough to be
+included in PyZMQ itself:
+
+* :ref:`zmq.log <logging>` : Logging handlers for hooking Python logging up to the
+ network
+* :ref:`zmq.devices <devices>` : Custom devices and objects for running devices in the
+ background
+* :ref:`zmq.eventloop <eventloop>` : The `Tornado`_ event loop, adapted for use
+ with ØMQ sockets.
+* :ref:`zmq.ssh <ssh>` : Simple tools for tunneling zeromq connections via ssh.
+
+.. _ØMQ: http://www.zeromq.org
+.. _Tornado: https://github.com/facebook/tornado
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/pyversions.rst b/external_libs/python/pyzmq-14.7.0/docs/source/pyversions.rst
new file mode 100644
index 00000000..8a509dc3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/pyversions.rst
@@ -0,0 +1,195 @@
+.. PyZMQ Version compatibility doc, by Min Ragan-Kelley, 2010
+
+.. _pyversions:
+
+PyZMQ, Python2.5, and Python3
+=============================
+
+PyZMQ is a fairly light, low-level library, so supporting as many versions
+as is reasonable is our goal. Currently, we support at least Python 2.5-3.1.
+Making the changes to the codebase required a few tricks, which are documented here
+for future reference, either by us or by other developers looking to support several
+versions of Python.
+
+.. Note::
+
+ It is far simpler to support 2.6-3.x than to include 2.5. Many of the significant
+ syntax changes have been backported to 2.6, so just writing new-style code would work
+ in many cases. I will try to note these points as they come up.
+
+
+pyversion_compat.h
+------------------
+
+Many functions we use, primarily involved in converting between C-buffers and Python
+objects, are not available on all supported versions of Python. In order to resolve
+missing symbols, we added a header :file:`utils/pyversion_compat.h` that defines missing
+symbols with macros. Some of these macros alias new names to old functions (e.g.
+``PyBytes_AsString``), so that we can call new-style functions on older versions, and some
+simply define the function as an empty exception raiser. The important thing is that the
+symbols are defined to prevent compiler warnings and linking errors. Everywhere we use
+C-API functions that may not be available in a supported version, at the top of the file
+is the code:
+
+.. sourcecode:: guess
+
+ cdef extern from "pyversion_compat.h":
+ pass
+
+This ensures that the symbols are defined in the Cython generated C-code. Higher level
+switching logic exists in the code itself, to prevent actually calling unavailable
+functions, but the symbols must still be defined.
+
+Bytes and Strings
+-----------------
+
+.. Note::
+
+ If you are using Python >= 2.6, to prepare your PyZMQ code for Python3 you should use
+ the ``b'message'`` syntax to ensure all your string literal messages will still be
+ :class:`bytes` after you make the upgrade.
+
+The most cumbersome part of PyZMQ compatibility from a user's perspective is the fact
+that, since ØMQ uses C-strings, and would like to do so without copying, we must use the
+Py3k :class:`bytes` object, which is backported to 2.6. In order to do this in a
+Python-version independent way, we added a small utility that unambiguously defines the
+string types: :class:`bytes`, :class:`unicode`, :obj:`basestring`. This is important,
+because :class:`str` means different things on 2.x and 3.x, and :class:`bytes` is
+undefined on 2.5, and both :class:`unicode` and :obj:`basestring` are undefined on 3.x.
+All typechecking in PyZMQ is done against these types:
+
+================= ================= ====================
+Explicit Type 2.x 3.x
+================= ================= ====================
+:obj:`bytes` :obj:`str` :obj:`bytes`
+:obj:`unicode` :obj:`unicode` :obj:`str`
+:obj:`basestring` :obj:`basestring` :obj:`(str, bytes)`
+================= ================= ====================
+
+.. Note::
+
+ 2.5 specific
+
+ Where we really noticed the issue of :class:`bytes` vs :obj:`strings` coming up for
+ users was in updating the tests to run on every version. Since the ``b'bytes
+ literal'`` syntax was not backported to 2.5, we must call ``"message".encode()`` for
+ *every* string in the test suite.
+
+.. seealso:: :ref:`Unicode discussion <unicode>` for more information on strings/bytes.
+
+``PyBytes_*``
+*************
+
+The standard C-API function for turning a C-string into a Python string was a set of
+functions with the prefix ``PyString_*``. However, with the Unicode changes made in
+Python3, this was broken into ``PyBytes_*`` for bytes objects and ``PyUnicode_*`` for
+unicode objects. We changed all our ``PyString_*`` code to ``PyBytes_*``, which was
+backported to 2.6.
+
+
+.. Note::
+
+ 2.5 Specific:
+
+ Since Python 2.5 doesn't support the ``PyBytes_*`` functions, we had to alias them to
+ the ``PyString_*`` methods in utils/pyversion_compat.h.
+
+ .. sourcecode:: c++
+
+ #define PyBytes_FromStringAndSize PyString_FromStringAndSize
+ #define PyBytes_FromString PyString_FromString
+ #define PyBytes_AsString PyString_AsString
+ #define PyBytes_Size PyString_Size
+
+Buffers
+-------
+
+The layer that is most complicated for developers, but shouldn't trouble users, is the
+Python C-Buffer APIs. These are the methods for converting between Python objects and C
+buffers. The reason it is complicated is that it keeps changing.
+
+There are two buffer interfaces for converting an object to a C-buffer, known as new-style
+and old-style. Old-style buffers were introduced long ago, but the new-style is only
+backported to 2.6. The old-style buffer interface is not available in 3.x. There is also
+an old- and new-style interface for creating Python objects that view C-memory. The
+old-style object is called a :class:`buffer`, and the new-style object is
+:class:`memoryview`. Unlike the new-style buffer interface for objects,
+:class:`memoryview` has only been backported to *2.7*. This means that the available
+buffer-related functions are not the same in any two versions of Python 2.5, 2.6, 2.7, or
+3.1.
+
+We have a :file:`utils/buffers.pxd` file that defines our :func:`asbuffer` and
+:func:`frombuffer` functions. :file:`utils/buffers.pxd` was adapted from mpi4py_'s
+:file:`asbuffer.pxi`. The :func:`frombuffer` functionality was added. These functions
+internally switch based on Python version to call the appropriate C-API functions.
+
+.. seealso:: `Python Buffer API <bufferapi>`_
+
+.. _bufferapi: http://docs.python.org/c-api/buffer.html
+
+
+``__str__``
+-----------
+
+As discussed, :class:`str` is not a platform independent type. The two places where we are
+required to return native str objects are :func:`error.strerror`, and
+:func:`Message.__str__`. In both of these cases, the natural return is actually a
+:class:`bytes` object. In the methods, the native :class:`str` type is checked, and if the
+native str is actually unicode, then we decode the bytes into unicode:
+
+.. sourcecode:: py
+
+ # ...
+ b = natural_result()
+ if str is unicode:
+ return b.decode()
+ else:
+ return b
+
+Exceptions
+----------
+
+.. Note::
+
+ This section is only relevant for supporting Python 2.5 and 3.x, not for 2.6-3.x.
+
+The syntax for handling exceptions has `changed <PEP-3110>`_ in Python 3. The old syntax:
+
+.. sourcecode:: py
+
+ try:
+ s.send(msg)
+ except zmq.ZMQError, e:
+ handle(e)
+
+is no longer valid in Python 3. Instead, the new syntax for this is:
+
+.. sourcecode:: py
+
+ try:
+ s.send(msg)
+ except zmq.ZMQError as e:
+ handle(e)
+
+This new syntax is backported to Python 2.6, but is invalid on 2.5. For 2.6-3.x compatible
+code, we could just use the new syntax. However, the only method we found to catch an
+exception for handling on both 2.5 and 3.1 is to get the exception object inside the
+exception block:
+
+.. sourcecode:: py
+
+ try:
+ s.send(msg)
+ except zmq.ZMQError:
+ e = sys.exc_info()[1]
+ handle(e)
+
+This is certainly not as elegant as either the old or new syntax, but it's the only way we
+have found to work everywhere.
+
+.. seealso:: PEP-3110_
+
+.. _PEP-3110: http://www.python.org/dev/peps/pep-3110/
+
+
+.. _mpi4py: http://mpi4py.googlecode.com \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/serialization.rst b/external_libs/python/pyzmq-14.7.0/docs/source/serialization.rst
new file mode 100644
index 00000000..eccd6557
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/serialization.rst
@@ -0,0 +1,90 @@
+.. PyZMQ serialization doc, by Min Ragan-Kelley, 2011
+
+.. _serialization:
+
+Serializing messages with PyZMQ
+===============================
+
+When sending messages over a network, you often need to marshall your data into bytes.
+
+
+Builtin serialization
+---------------------
+
+PyZMQ is primarily bindings for libzmq, but we do provide three builtin serialization
+methods for convenience, to help Python developers learn libzmq. Python has two primary
+packages for serializing objects: :py:mod:`json` and :py:mod:`pickle`, so we provide
+simple convenience methods for sending and receiving objects serialized with these
+modules. A socket has the methods :meth:`~.Socket.send_json` and
+:meth:`~.Socket.send_pyobj`, which correspond to sending an object over the wire after
+serializing with json and pickle respectively, and any object sent via those
+methods can be reconstructed with the :meth:`~.Socket.recv_json` and
+:meth:`~.Socket.recv_pyobj` methods.
+
+
+These methods designed for convenience, not for performance, so developers who do want
+to emphasize performance should use their own serialized send/recv methods.
+
+Using your own serialization
+----------------------------
+
+In general, you will want to provide your own serialization that is optimized for your
+application or library availability. This may include using your own preferred
+serialization ([msgpack]_, [protobuf]_), or adding compression via [zlib]_ in the standard
+library, or the super fast [blosc]_ library.
+
+There are two simple models for implementing your own serialization: write a function
+that takes the socket as an argument, or subclass Socket for use in your own apps.
+
+For instance, pickles can often be reduced substantially in size by compressing the data.
+The following will send *compressed* pickles over the wire:
+
+.. sourcecode:: python
+
+ import zlib, cPickle as pickle
+
+ def send_zipped_pickle(socket, obj, flags=0, protocol=-1):
+ """pickle an object, and zip the pickle before sending it"""
+ p = pickle.dumps(obj, protocol)
+ z = zlib.compress(p)
+ return socket.send(z, flags=flags)
+
+ def recv_zipped_pickle(socket, flags=0, protocol=-1):
+ """inverse of send_zipped_pickle"""
+ z = socket.recv(flags)
+ p = zlib.decompress(z)
+ return pickle.loads(p)
+
+A common data structure in Python is the numpy array. PyZMQ supports sending
+numpy arrays without copying any data, since they provide the Python buffer interface.
+However just the buffer is not enough information to reconstruct the array on the
+receiving side. Here is an example of a send/recv that allow non-copying
+sends/recvs of numpy arrays including the dtype/shape data necessary for reconstructing
+the array.
+
+.. sourcecode:: python
+
+ import numpy
+
+ def send_array(socket, A, flags=0, copy=True, track=False):
+ """send a numpy array with metadata"""
+ md = dict(
+ dtype = str(A.dtype),
+ shape = A.shape,
+ )
+ socket.send_json(md, flags|zmq.SNDMORE)
+ return socket.send(A, flags, copy=copy, track=track)
+
+ def recv_array(socket, flags=0, copy=True, track=False):
+ """recv a numpy array"""
+ md = socket.recv_json(flags=flags)
+ msg = socket.recv(flags=flags, copy=copy, track=track)
+ buf = buffer(msg)
+ A = numpy.frombuffer(buf, dtype=md['dtype'])
+ return A.reshape(md['shape'])
+
+
+.. [msgpack] Message Pack serialization library http://msgpack.org
+.. [protobuf] Google Protocol Buffers http://code.google.com/p/protobuf
+.. [zlib] Python stdlib module for zip compression: :py:mod:`zlib`
+.. [blosc] Blosc: A blocking, shuffling and loss-less (and crazy-fast) compression library http://blosc.pytables.org/trac
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/ssh.rst b/external_libs/python/pyzmq-14.7.0/docs/source/ssh.rst
new file mode 100644
index 00000000..f1c1df38
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/ssh.rst
@@ -0,0 +1,75 @@
+.. PyZMQ ssh doc, by Min Ragan-Kelley, 2011
+
+.. _ssh:
+
+Tunneling PyZMQ Connections with SSH
+====================================
+
+.. versionadded:: 2.1.9
+
+You may want to connect ØMQ sockets across machines, or untrusted networks. One common way
+to do this is to tunnel the connection via SSH. IPython_ introduced some tools for
+tunneling ØMQ connections over ssh in simple cases. These functions have been brought into
+pyzmq as :mod:`zmq.ssh` under IPython's BSD license.
+
+PyZMQ will use the shell ssh command via pexpect_ by default, but it also supports
+using paramiko_ for tunnels, so it should work on Windows.
+
+An SSH tunnel has five basic components:
+
+* server : the SSH server through which the tunnel will be created
+* remote ip : the IP of the remote machine *as seen from the server*
+ (remote ip may be, but is not not generally the same machine as server).
+* remote port : the port on the remote machine that you want to connect to.
+* local ip : the interface on your local machine you want to use (default: 127.0.0.1)
+* local port : the local port you want to forward to the remote port (default: high random)
+
+So once you have established the tunnel, connections to ``localip:localport`` will actually
+be connections to ``remoteip:remoteport``.
+
+In most cases, you have a zeromq url for a remote machine, but you need to tunnel the
+connection through an ssh server. This is
+
+So if you would use this command from the same LAN as the remote machine:
+
+.. sourcecode:: python
+
+ sock.connect("tcp://10.0.1.2:5555")
+
+to make the same connection from another machine that is outside the network, but you have
+ssh access to a machine ``server`` on the same LAN, you would simply do:
+
+.. sourcecode:: python
+
+ from zmq import ssh
+ ssh.tunnel_connection(sock, "tcp://10.0.1.2:5555", "server")
+
+Note that ``"server"`` can actually be a fully specified ``"user@server:port"`` ssh url.
+Since this really just launches a shell command, all your ssh configuration of usernames,
+aliases, keys, etc. will be respected. If necessary, :func:`tunnel_connection` does take
+arguments for specific passwords, private keys (the ssh ``-i`` option), and non-default
+choice of whether to use paramiko.
+
+If you are on the same network as the machine, but it is only listening on localhost, you
+can still connect by making the machine itself the server, and using loopback as the
+remote ip:
+
+.. sourcecode:: python
+
+ from zmq import ssh
+ ssh.tunnel_connection(sock, "tcp://127.0.0.1:5555", "10.0.1.2")
+
+The :func:`tunnel_connection` function is a simple utility that forwards a random
+localhost port to the real destination, and connects a socket to the new local url,
+rather than the remote one that wouldn't actually work.
+
+.. seealso::
+
+ A short discussion of ssh tunnels: http://www.revsys.com/writings/quicktips/ssh-tunnel.html
+
+
+.. _IPython: http://ipython.org
+.. _pexpect: http://www.noah.org/wiki/pexpect
+.. _pexpect-u: http://pypi.python.org/pypi/pexpect-u
+.. _paramiko: http://www.lag.net/paramiko/
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/source/unicode.rst b/external_libs/python/pyzmq-14.7.0/docs/source/unicode.rst
new file mode 100644
index 00000000..a0c78789
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/source/unicode.rst
@@ -0,0 +1,188 @@
+.. PyZMQ Unicode doc, by Min Ragan-Kelley, 2010
+
+.. _unicode:
+
+PyZMQ and Unicode
+=================
+
+PyZMQ is built with an eye towards an easy transition to Python 3, and part of
+that is dealing with unicode strings. This is an overview of some of what we
+found, and what it means for PyZMQ.
+
+First, Unicode in Python 2 and 3
+********************************
+
+In Python < 3, a ``str`` object is really a C string with some sugar - a
+specific series of bytes with some fun methods like ``endswith()`` and
+``split()``. In 2.0, the ``unicode`` object was added, which handles different
+methods of encoding. In Python 3, however, the meaning of ``str`` changes. A
+``str`` in Python 3 is a full unicode object, with encoding and everything. If
+you want a C string with some sugar, there is a new object called ``bytes``,
+that behaves much like the 2.x ``str``. The idea is that for a user, a string is
+a series of *characters*, not a series of bytes. For simple ascii, the two are
+interchangeable, but if you consider accents and non-Latin characters, then the
+character meaning of byte sequences can be ambiguous, since it depends on the
+encoding scheme. They decided to avoid the ambiguity by forcing users who want
+the actual bytes to specify the encoding every time they want to convert a
+string to bytes. That way, users are aware of the difference between a series of
+bytes and a collection of characters, and don't confuse the two, as happens in
+Python 2.x.
+
+The problems (on both sides) come from the fact that regardless of the language
+design, users are mostly going to use ``str`` objects to represent collections
+of characters, and the behavior of that object is dramatically different in
+certain aspects between the 2.x ``bytes`` approach and the 3.x ``unicode``
+approach. The ``unicode`` approach has the advantage of removing byte ambiguity
+- it's a list of characters, not bytes. However, if you really do want the
+bytes, it's very inefficient to get them. The ``bytes`` approach has the
+advantage of efficiency. A ``bytes`` object really is just a char* pointer with
+some methods to be used on it, so when interacting with, so interacting with C
+code, etc is highly efficient and straightforward. However, understanding a
+bytes object as a string with extended characters introduces ambiguity and
+possibly confusion.
+
+To avoid ambiguity, hereafter we will refer to encoded C arrays as 'bytes' and
+abstract unicode objects as 'strings'.
+
+Unicode Buffers
+---------------
+
+Since unicode objects have a wide range of representations, they are not stored
+as the bytes according to their encoding, but rather in a format called UCS (an
+older fixed-width Unicode format). On some platforms (OS X, Windows), the storage
+is UCS-2, which is 2 bytes per character. On most \*ix systems, it is UCS-4, or
+4 bytes per character. The contents of the *buffer* of a ``unicode`` object are
+not encoding dependent (always UCS-2 or UCS-4), but they are *platform*
+dependent. As a result of this, and the further insistence on not interpreting
+``unicode`` objects as bytes without specifying encoding, ``str`` objects in
+Python 3 don't even provide the buffer interface. You simply cannot get the raw
+bytes of a ``unicode`` object without specifying the encoding for the bytes. In
+Python 2.x, you can get to the raw buffer, but the platform dependence and the
+fact that the encoding of the buffer is not the encoding of the object makes it
+very confusing, so this is probably a good move.
+
+The efficiency problem here comes from the fact that simple ascii strings are 4x
+as big in memory as they need to be (on most Linux, 2x on other platforms).
+Also, to translate to/from C code that works with char*, you always have to copy
+data and encode/decode the bytes. This really is horribly inefficient from a
+memory standpoint. Essentially, Where memory efficiency matters to you, you
+should never ever use strings; use bytes. The problem is that users will almost
+always use ``str``, and in 2.x they are efficient, but in 3.x they are not. We
+want to make sure that we don't help the user make this mistake, so we ensure
+that zmq methods don't try to hide what strings really are.
+
+What This Means for PyZMQ
+*************************
+
+PyZMQ is a wrapper for a C library, so it really should use bytes, since a
+string is not a simple wrapper for ``char *`` like it used to be, but an
+abstract sequence of characters. The representations of bytes in Python are
+either the ``bytes`` object itself, or any object that provides the buffer
+interface (aka memoryview). In Python 2.x, unicode objects do provide the buffer
+interface, but as they do not in Python 3, where pyzmq requires bytes, we
+specifically reject unicode objects.
+
+The relevant methods here are ``socket.send/recv``, ``socket.get/setsockopt``,
+``socket.bind/connect``. The important consideration for send/recv and
+set/getsockopt is that when you put in something, you really should get the same
+object back with its partner method. We can easily coerce unicode objects to
+bytes with send/setsockopt, but the problem is that the pair method of
+recv/getsockopt will always be bytes, and there should be symmetry. We certainly
+shouldn't try to always decode on the retrieval side, because if users just want
+bytes, then we are potentially using up enormous amounts of excess memory
+unnecessarily, due to copying and larger memory footprint of unicode strings.
+
+Still, we recognize the fact that users will quite frequently have unicode
+strings that they want to send, so we have added ``socket.<method>_string()``
+wrappers. These methods simply wrap their bytes counterpart by encoding
+to/decoding from bytes around them, and they all take an `encoding` keyword
+argument that defaults to utf-8. Since encoding and decoding are necessary to
+translate between unicode and bytes, it is impossible to perform non-copying
+actions with these wrappers.
+
+``socket.bind/connect`` methods are different from these, in that they are
+strictly setters and there is not corresponding getter method. As a result, we
+feel that we can safely coerce unicode objects to bytes (always to utf-8) in
+these methods.
+
+.. note::
+
+ For cross-language symmetry (including Python 3), the ``_unicode`` methods
+ are now ``_string``. Many languages have a notion of native strings, and
+ the use of ``_unicode`` was wedded too closely to the name of such objects
+ in Python 2. For the time being, anywhere you see ``_string``, ``_unicode``
+ also works, and is the only option in pyzmq ≤ 2.1.11.
+
+
+The Methods
+-----------
+
+Overview of the relevant methods:
+
+.. py:function:: socket.bind(self, addr)
+
+ `addr` is ``bytes`` or ``unicode``. If ``unicode``,
+ encoded to utf-8 ``bytes``
+
+.. py:function:: socket.connect(self, addr)
+
+ `addr` is ``bytes`` or ``unicode``. If ``unicode``,
+ encoded to utf-8 ``bytes``
+
+.. py:function:: socket.send(self, object obj, flags=0, copy=True)
+
+ `obj` is ``bytes`` or provides buffer interface.
+
+ if `obj` is ``unicode``, raise ``TypeError``
+
+.. py:function:: socket.recv(self, flags=0, copy=True)
+
+ returns ``bytes`` if `copy=True`
+
+ returns ``zmq.Message`` if `copy=False`:
+
+ `message.buffer` is a buffer view of the ``bytes``
+
+ `str(message)` provides the ``bytes``
+
+ `unicode(message)` decodes `message.buffer` with utf-8
+
+.. py:function:: socket.send_string(self, unicode s, flags=0, encoding='utf-8')
+
+ takes a ``unicode`` string `s`, and sends the ``bytes``
+ after encoding without an extra copy, via:
+
+ `socket.send(s.encode(encoding), flags, copy=False)`
+
+.. py:function:: socket.recv_string(self, flags=0, encoding='utf-8')
+
+ always returns ``unicode`` string
+
+ there will be a ``UnicodeError`` if it cannot decode the buffer
+
+ performs non-copying `recv`, and decodes the buffer with `encoding`
+
+.. py:function:: socket.setsockopt(self, opt, optval)
+
+ only accepts ``bytes`` for `optval` (or ``int``, depending on `opt`)
+
+ ``TypeError`` if ``unicode`` or anything else
+
+.. py:function:: socket.getsockopt(self, opt)
+
+ returns ``bytes`` (or ``int``), never ``unicode``
+
+.. py:function:: socket.setsockopt_string(self, opt, unicode optval, encoding='utf-8')
+
+ accepts ``unicode`` string for `optval`
+
+ encodes `optval` with `encoding` before passing the ``bytes`` to
+ `setsockopt`
+
+.. py:function:: socket.getsockopt_string(self, opt, encoding='utf-8')
+
+ always returns ``unicode`` string, after decoding with `encoding`
+
+ note that `zmq.IDENTITY` is the only `sockopt` with a string value
+ that can be queried with `getsockopt`
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/sphinxext/apigen.py b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/apigen.py
new file mode 100644
index 00000000..3c2c41b3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/apigen.py
@@ -0,0 +1,441 @@
+"""Attempt to generate templates for module reference with Sphinx
+
+XXX - we exclude extension modules
+
+To include extension modules, first identify them as valid in the
+``_uri2path`` method, then handle them in the ``_parse_module`` script.
+
+We get functions and classes by parsing the text of .py files.
+Alternatively we could import the modules for discovery, and we'd have
+to do that for extension modules. This would involve changing the
+``_parse_module`` method to work via import and introspection, and
+might involve changing ``discover_modules`` (which determines which
+files are modules, and therefore which module URIs will be passed to
+``_parse_module``).
+
+NOTE: this is a modified version of a script originally shipped with the
+PyMVPA project, which we've adapted for NIPY use. PyMVPA is an MIT-licensed
+project."""
+
+from __future__ import print_function
+
+import os
+import re
+
+class ApiDocWriter(object):
+ ''' Class for automatic detection and parsing of API docs
+ to Sphinx-parsable reST format'''
+
+ # only separating first two levels
+ rst_section_levels = ['*', '=', '-', '~', '^']
+
+ def __init__(self,
+ package_name,
+ rst_extension='.rst',
+ package_skip_patterns=None,
+ module_skip_patterns=None,
+ ):
+ ''' Initialize package for parsing
+
+ Parameters
+ ----------
+ package_name : string
+ Name of the top-level package. *package_name* must be the
+ name of an importable package
+ rst_extension : string, optional
+ Extension for reST files, default '.rst'
+ package_skip_patterns : None or sequence of {strings, regexps}
+ Sequence of strings giving URIs of packages to be excluded
+ Operates on the package path, starting at (including) the
+ first dot in the package path, after *package_name* - so,
+ if *package_name* is ``sphinx``, then ``sphinx.util`` will
+ result in ``.util`` being passed for earching by these
+ regexps. If is None, gives default. Default is:
+ ['\.tests$']
+ module_skip_patterns : None or sequence
+ Sequence of strings giving URIs of modules to be excluded
+ Operates on the module name including preceding URI path,
+ back to the first dot after *package_name*. For example
+ ``sphinx.util.console`` results in the string to search of
+ ``.util.console``
+ If is None, gives default. Default is:
+ ['\.setup$', '\._']
+ '''
+ if package_skip_patterns is None:
+ package_skip_patterns = ['\\.tests$']
+ if module_skip_patterns is None:
+ module_skip_patterns = ['\\.setup$', '\\._']
+ self.package_name = package_name
+ self.rst_extension = rst_extension
+ self.package_skip_patterns = package_skip_patterns
+ self.module_skip_patterns = module_skip_patterns
+
+ def get_package_name(self):
+ return self._package_name
+
+ def set_package_name(self, package_name):
+ ''' Set package_name
+
+ >>> docwriter = ApiDocWriter('sphinx')
+ >>> import sphinx
+ >>> docwriter.root_path == sphinx.__path__[0]
+ True
+ >>> docwriter.package_name = 'docutils'
+ >>> import docutils
+ >>> docwriter.root_path == docutils.__path__[0]
+ True
+ '''
+ # It's also possible to imagine caching the module parsing here
+ self._package_name = package_name
+ self.root_module = __import__(package_name)
+ self.root_path = self.root_module.__path__[0]
+ self.written_modules = None
+
+ package_name = property(get_package_name, set_package_name, None,
+ 'get/set package_name')
+
+ def _get_object_name(self, line):
+ ''' Get second token in line
+ >>> docwriter = ApiDocWriter('sphinx')
+ >>> docwriter._get_object_name(" def func(): ")
+ 'func'
+ >>> docwriter._get_object_name(" class Klass(object): ")
+ 'Klass'
+ >>> docwriter._get_object_name(" class Klass: ")
+ 'Klass'
+ '''
+ if line.startswith('cdef'):
+ line = line.split(None,1)[1]
+ name = line.split()[1].split('(')[0].strip()
+ # in case we have classes which are not derived from object
+ # ie. old style classes
+ return name.rstrip(':')
+
+ def _uri2path(self, uri):
+ ''' Convert uri to absolute filepath
+
+ Parameters
+ ----------
+ uri : string
+ URI of python module to return path for
+
+ Returns
+ -------
+ path : None or string
+ Returns None if there is no valid path for this URI
+ Otherwise returns absolute file system path for URI
+
+ Examples
+ --------
+ >>> docwriter = ApiDocWriter('sphinx')
+ >>> import sphinx
+ >>> modpath = sphinx.__path__[0]
+ >>> res = docwriter._uri2path('sphinx.builder')
+ >>> res == os.path.join(modpath, 'builder.py')
+ True
+ >>> res = docwriter._uri2path('sphinx')
+ >>> res == os.path.join(modpath, '__init__.py')
+ True
+ >>> docwriter._uri2path('sphinx.does_not_exist')
+
+ '''
+ if uri == self.package_name:
+ return os.path.join(self.root_path, '__init__.py')
+ path = uri.replace('.', os.path.sep)
+ path = path.replace(self.package_name + os.path.sep, '')
+ path = os.path.join(self.root_path, path)
+ # XXX maybe check for extensions as well?
+ if os.path.exists(path + '.py'): # file
+ path += '.py'
+ elif os.path.exists(path + '.pyx'): # file
+ path += '.pyx'
+ elif os.path.exists(os.path.join(path, '__init__.py')):
+ path = os.path.join(path, '__init__.py')
+ else:
+ return None
+ return path
+
+ def _path2uri(self, dirpath):
+ ''' Convert directory path to uri '''
+ relpath = dirpath.replace(self.root_path, self.package_name)
+ if relpath.startswith(os.path.sep):
+ relpath = relpath[1:]
+ return relpath.replace(os.path.sep, '.')
+
+ def _parse_module(self, uri):
+ ''' Parse module defined in *uri* '''
+ filename = self._uri2path(uri)
+ if filename is None:
+ # nothing that we could handle here.
+ return ([],[])
+ f = open(filename, 'rt')
+ functions, classes = self._parse_lines(f)
+ f.close()
+ return functions, classes
+
+ def _parse_lines(self, linesource):
+ ''' Parse lines of text for functions and classes '''
+ functions = []
+ classes = []
+ for line in linesource:
+ if line.startswith('def ') and line.count('('):
+ # exclude private stuff
+ name = self._get_object_name(line)
+ if not name.startswith('_'):
+ functions.append(name)
+ elif line.startswith('class '):
+ # exclude private stuff
+ name = self._get_object_name(line)
+ if not name.startswith('_'):
+ classes.append(name)
+ elif line.startswith('cpdef ') and line.count('('):
+ # exclude private stuff
+ name = self._get_object_name(line)
+ if not name.startswith('_'):
+ functions.append(name)
+ elif line.startswith('cdef class '):
+ # exclude private stuff
+ name = self._get_object_name(line)
+ if not name.startswith('_'):
+ classes.append(name)
+ else:
+ pass
+ functions.sort()
+ classes.sort()
+ return functions, classes
+
+ def generate_api_doc(self, uri):
+ '''Make autodoc documentation template string for a module
+
+ Parameters
+ ----------
+ uri : string
+ python location of module - e.g 'sphinx.builder'
+
+ Returns
+ -------
+ S : string
+ Contents of API doc
+ '''
+ # get the names of all classes and functions
+ functions, classes = self._parse_module(uri)
+ if not len(functions) and not len(classes):
+ print('WARNING: Empty -', uri)
+ return ''
+
+ # Make a shorter version of the uri that omits the package name for
+ # titles
+ uri_short = re.sub(r'^%s\.' % self.package_name,'',uri)
+
+ ad = '.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n'
+
+ chap_title = uri_short
+ ad += (chap_title+'\n'+ self.rst_section_levels[1] * len(chap_title)
+ + '\n\n')
+
+ # Set the chapter title to read 'module' for all modules except for the
+ # main packages
+ if '.' in uri:
+ title = 'Module: :mod:`' + uri_short + '`'
+ else:
+ title = ':mod:`' + uri_short + '`'
+ ad += title + '\n' + self.rst_section_levels[2] * len(title)
+
+ # if len(classes):
+ # ad += '\nInheritance diagram for ``%s``:\n\n' % uri
+ # ad += '.. inheritance-diagram:: %s \n' % uri
+ # ad += ' :parts: 3\n'
+
+ ad += '\n.. automodule:: ' + uri + '\n'
+ ad += '\n.. currentmodule:: ' + uri + '\n'
+ multi_class = len(classes) > 1
+ multi_fx = len(functions) > 1
+ if multi_class:
+ ad += '\n' + 'Classes' + '\n' + \
+ self.rst_section_levels[2] * 7 + '\n'
+ elif len(classes) and multi_fx:
+ ad += '\n' + 'Class' + '\n' + \
+ self.rst_section_levels[2] * 5 + '\n'
+ for c in classes:
+ ad += '\n:class:`' + c + '`\n' \
+ + self.rst_section_levels[multi_class + 2 ] * \
+ (len(c)+9) + '\n\n'
+ ad += '\n.. autoclass:: ' + c + '\n'
+ # must NOT exclude from index to keep cross-refs working
+ ad += ' :members:\n' \
+ ' :undoc-members:\n' \
+ ' :inherited-members:\n' \
+ '\n'
+ # skip class.__init__()
+ # ' .. automethod:: __init__\n'
+ if multi_fx:
+ ad += '\n' + 'Functions' + '\n' + \
+ self.rst_section_levels[2] * 9 + '\n\n'
+ elif len(functions) and multi_class:
+ ad += '\n' + 'Function' + '\n' + \
+ self.rst_section_levels[2] * 8 + '\n\n'
+ for f in functions:
+ # must NOT exclude from index to keep cross-refs working
+ ad += '\n.. autofunction:: ' + uri + '.' + f + '\n\n'
+ return ad
+
+ def _survives_exclude(self, matchstr, match_type):
+ ''' Returns True if *matchstr* does not match patterns
+
+ ``self.package_name`` removed from front of string if present
+
+ Examples
+ --------
+ >>> dw = ApiDocWriter('sphinx')
+ >>> dw._survives_exclude('sphinx.okpkg', 'package')
+ True
+ >>> dw.package_skip_patterns.append('^\\.badpkg$')
+ >>> dw._survives_exclude('sphinx.badpkg', 'package')
+ False
+ >>> dw._survives_exclude('sphinx.badpkg', 'module')
+ True
+ >>> dw._survives_exclude('sphinx.badmod', 'module')
+ True
+ >>> dw.module_skip_patterns.append('^\\.badmod$')
+ >>> dw._survives_exclude('sphinx.badmod', 'module')
+ False
+ '''
+ if match_type == 'module':
+ patterns = self.module_skip_patterns
+ elif match_type == 'package':
+ patterns = self.package_skip_patterns
+ else:
+ raise ValueError('Cannot interpret match type "%s"'
+ % match_type)
+ # Match to URI without package name
+ L = len(self.package_name)
+ if matchstr[:L] == self.package_name:
+ matchstr = matchstr[L:]
+ for pat in patterns:
+ try:
+ pat.search
+ except AttributeError:
+ pat = re.compile(pat)
+ if pat.search(matchstr):
+ return False
+ return True
+
+ def discover_modules(self):
+ ''' Return module sequence discovered from ``self.package_name``
+
+
+ Parameters
+ ----------
+ None
+
+ Returns
+ -------
+ mods : sequence
+ Sequence of module names within ``self.package_name``
+
+ Examples
+ --------
+ >>> dw = ApiDocWriter('sphinx')
+ >>> mods = dw.discover_modules()
+ >>> 'sphinx.util' in mods
+ True
+ >>> dw.package_skip_patterns.append('\.util$')
+ >>> 'sphinx.util' in dw.discover_modules()
+ False
+ >>>
+ '''
+ modules = [self.package_name]
+ # raw directory parsing
+ for dirpath, dirnames, filenames in os.walk(self.root_path):
+ # Check directory names for packages
+ root_uri = self._path2uri(os.path.join(self.root_path,
+ dirpath))
+ for dirname in dirnames[:]: # copy list - we modify inplace
+ package_uri = '.'.join((root_uri, dirname))
+ if (self._uri2path(package_uri) and
+ self._survives_exclude(package_uri, 'package')):
+ modules.append(package_uri)
+ else:
+ dirnames.remove(dirname)
+ # Check filenames for modules
+ for filename in filenames:
+ module_name = filename[:-3]
+ module_uri = '.'.join((root_uri, module_name))
+ if (self._uri2path(module_uri) and
+ self._survives_exclude(module_uri, 'module')):
+ modules.append(module_uri)
+ return sorted(modules)
+
+ def write_modules_api(self, modules,outdir):
+ # write the list
+ written_modules = []
+ for m in modules:
+ api_str = self.generate_api_doc(m)
+ if not api_str:
+ continue
+ # write out to file
+ outfile = os.path.join(outdir,
+ m + self.rst_extension)
+ fileobj = open(outfile, 'wt')
+ fileobj.write(api_str)
+ fileobj.close()
+ written_modules.append(m)
+ self.written_modules = written_modules
+
+ def write_api_docs(self, outdir):
+ """Generate API reST files.
+
+ Parameters
+ ----------
+ outdir : string
+ Directory name in which to store files
+ We create automatic filenames for each module
+
+ Returns
+ -------
+ None
+
+ Notes
+ -----
+ Sets self.written_modules to list of written modules
+ """
+ if not os.path.exists(outdir):
+ os.mkdir(outdir)
+ # compose list of modules
+ modules = self.discover_modules()
+ self.write_modules_api(modules,outdir)
+
+ def write_index(self, outdir, froot='gen', relative_to=None):
+ """Make a reST API index file from written files
+
+ Parameters
+ ----------
+ path : string
+ Filename to write index to
+ outdir : string
+ Directory to which to write generated index file
+ froot : string, optional
+ root (filename without extension) of filename to write to
+ Defaults to 'gen'. We add ``self.rst_extension``.
+ relative_to : string
+ path to which written filenames are relative. This
+ component of the written file path will be removed from
+ outdir, in the generated index. Default is None, meaning,
+ leave path as it is.
+ """
+ if self.written_modules is None:
+ raise ValueError('No modules written')
+ # Get full filename path
+ path = os.path.join(outdir, froot+self.rst_extension)
+ # Path written into index is relative to rootpath
+ if relative_to is not None:
+ relpath = outdir.replace(relative_to + os.path.sep, '')
+ else:
+ relpath = outdir
+ idx = open(path,'wt')
+ w = idx.write
+ w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n')
+ w('.. toctree::\n\n')
+ for f in self.written_modules:
+ w(' %s\n' % os.path.join(relpath,f))
+ idx.close()
diff --git a/external_libs/python/pyzmq-14.7.0/docs/sphinxext/docscrape.py b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/docscrape.py
new file mode 100644
index 00000000..f374b3dd
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/docscrape.py
@@ -0,0 +1,497 @@
+"""Extract reference documentation from the NumPy source tree.
+
+"""
+
+import inspect
+import textwrap
+import re
+import pydoc
+from StringIO import StringIO
+from warnings import warn
+4
+class Reader(object):
+ """A line-based string reader.
+
+ """
+ def __init__(self, data):
+ """
+ Parameters
+ ----------
+ data : str
+ String with lines separated by '\n'.
+
+ """
+ if isinstance(data,list):
+ self._str = data
+ else:
+ self._str = data.split('\n') # store string as list of lines
+
+ self.reset()
+
+ def __getitem__(self, n):
+ return self._str[n]
+
+ def reset(self):
+ self._l = 0 # current line nr
+
+ def read(self):
+ if not self.eof():
+ out = self[self._l]
+ self._l += 1
+ return out
+ else:
+ return ''
+
+ def seek_next_non_empty_line(self):
+ for l in self[self._l:]:
+ if l.strip():
+ break
+ else:
+ self._l += 1
+
+ def eof(self):
+ return self._l >= len(self._str)
+
+ def read_to_condition(self, condition_func):
+ start = self._l
+ for line in self[start:]:
+ if condition_func(line):
+ return self[start:self._l]
+ self._l += 1
+ if self.eof():
+ return self[start:self._l+1]
+ return []
+
+ def read_to_next_empty_line(self):
+ self.seek_next_non_empty_line()
+ def is_empty(line):
+ return not line.strip()
+ return self.read_to_condition(is_empty)
+
+ def read_to_next_unindented_line(self):
+ def is_unindented(line):
+ return (line.strip() and (len(line.lstrip()) == len(line)))
+ return self.read_to_condition(is_unindented)
+
+ def peek(self,n=0):
+ if self._l + n < len(self._str):
+ return self[self._l + n]
+ else:
+ return ''
+
+ def is_empty(self):
+ return not ''.join(self._str).strip()
+
+
+class NumpyDocString(object):
+ def __init__(self,docstring):
+ docstring = textwrap.dedent(docstring).split('\n')
+
+ self._doc = Reader(docstring)
+ self._parsed_data = {
+ 'Signature': '',
+ 'Summary': [''],
+ 'Extended Summary': [],
+ 'Parameters': [],
+ 'Returns': [],
+ 'Raises': [],
+ 'Warns': [],
+ 'Other Parameters': [],
+ 'Attributes': [],
+ 'Methods': [],
+ 'See Also': [],
+ 'Notes': [],
+ 'Warnings': [],
+ 'References': '',
+ 'Examples': '',
+ 'index': {}
+ }
+
+ self._parse()
+
+ def __getitem__(self,key):
+ return self._parsed_data[key]
+
+ def __setitem__(self,key,val):
+ if not self._parsed_data.has_key(key):
+ warn("Unknown section %s" % key)
+ else:
+ self._parsed_data[key] = val
+
+ def _is_at_section(self):
+ self._doc.seek_next_non_empty_line()
+
+ if self._doc.eof():
+ return False
+
+ l1 = self._doc.peek().strip() # e.g. Parameters
+
+ if l1.startswith('.. index::'):
+ return True
+
+ l2 = self._doc.peek(1).strip() # ---------- or ==========
+ return l2.startswith('-'*len(l1)) or l2.startswith('='*len(l1))
+
+ def _strip(self,doc):
+ i = 0
+ j = 0
+ for i,line in enumerate(doc):
+ if line.strip(): break
+
+ for j,line in enumerate(doc[::-1]):
+ if line.strip(): break
+
+ return doc[i:len(doc)-j]
+
+ def _read_to_next_section(self):
+ section = self._doc.read_to_next_empty_line()
+
+ while not self._is_at_section() and not self._doc.eof():
+ if not self._doc.peek(-1).strip(): # previous line was empty
+ section += ['']
+
+ section += self._doc.read_to_next_empty_line()
+
+ return section
+
+ def _read_sections(self):
+ while not self._doc.eof():
+ data = self._read_to_next_section()
+ name = data[0].strip()
+
+ if name.startswith('..'): # index section
+ yield name, data[1:]
+ elif len(data) < 2:
+ yield StopIteration
+ else:
+ yield name, self._strip(data[2:])
+
+ def _parse_param_list(self,content):
+ r = Reader(content)
+ params = []
+ while not r.eof():
+ header = r.read().strip()
+ if ' : ' in header:
+ arg_name, arg_type = header.split(' : ')[:2]
+ else:
+ arg_name, arg_type = header, ''
+
+ desc = r.read_to_next_unindented_line()
+ desc = dedent_lines(desc)
+
+ params.append((arg_name,arg_type,desc))
+
+ return params
+
+
+ _name_rgx = re.compile(r"^\s*(:(?P<role>\w+):`(?P<name>[a-zA-Z0-9_.-]+)`|"
+ r" (?P<name2>[a-zA-Z0-9_.-]+))\s*", re.X)
+ def _parse_see_also(self, content):
+ """
+ func_name : Descriptive text
+ continued text
+ another_func_name : Descriptive text
+ func_name1, func_name2, :meth:`func_name`, func_name3
+
+ """
+ items = []
+
+ def parse_item_name(text):
+ """Match ':role:`name`' or 'name'"""
+ m = self._name_rgx.match(text)
+ if m:
+ g = m.groups()
+ if g[1] is None:
+ return g[3], None
+ else:
+ return g[2], g[1]
+ raise ValueError("%s is not a item name" % text)
+
+ def push_item(name, rest):
+ if not name:
+ return
+ name, role = parse_item_name(name)
+ items.append((name, list(rest), role))
+ del rest[:]
+
+ current_func = None
+ rest = []
+
+ for line in content:
+ if not line.strip(): continue
+
+ m = self._name_rgx.match(line)
+ if m and line[m.end():].strip().startswith(':'):
+ push_item(current_func, rest)
+ current_func, line = line[:m.end()], line[m.end():]
+ rest = [line.split(':', 1)[1].strip()]
+ if not rest[0]:
+ rest = []
+ elif not line.startswith(' '):
+ push_item(current_func, rest)
+ current_func = None
+ if ',' in line:
+ for func in line.split(','):
+ push_item(func, [])
+ elif line.strip():
+ current_func = line
+ elif current_func is not None:
+ rest.append(line.strip())
+ push_item(current_func, rest)
+ return items
+
+ def _parse_index(self, section, content):
+ """
+ .. index: default
+ :refguide: something, else, and more
+
+ """
+ def strip_each_in(lst):
+ return [s.strip() for s in lst]
+
+ out = {}
+ section = section.split('::')
+ if len(section) > 1:
+ out['default'] = strip_each_in(section[1].split(','))[0]
+ for line in content:
+ line = line.split(':')
+ if len(line) > 2:
+ out[line[1]] = strip_each_in(line[2].split(','))
+ return out
+
+ def _parse_summary(self):
+ """Grab signature (if given) and summary"""
+ if self._is_at_section():
+ return
+
+ summary = self._doc.read_to_next_empty_line()
+ summary_str = " ".join([s.strip() for s in summary]).strip()
+ if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
+ self['Signature'] = summary_str
+ if not self._is_at_section():
+ self['Summary'] = self._doc.read_to_next_empty_line()
+ else:
+ self['Summary'] = summary
+
+ if not self._is_at_section():
+ self['Extended Summary'] = self._read_to_next_section()
+
+ def _parse(self):
+ self._doc.reset()
+ self._parse_summary()
+
+ for (section,content) in self._read_sections():
+ if not section.startswith('..'):
+ section = ' '.join([s.capitalize() for s in section.split(' ')])
+ if section in ('Parameters', 'Attributes', 'Methods',
+ 'Returns', 'Raises', 'Warns'):
+ self[section] = self._parse_param_list(content)
+ elif section.startswith('.. index::'):
+ self['index'] = self._parse_index(section, content)
+ elif section == 'See Also':
+ self['See Also'] = self._parse_see_also(content)
+ else:
+ self[section] = content
+
+ # string conversion routines
+
+ def _str_header(self, name, symbol='-'):
+ return [name, len(name)*symbol]
+
+ def _str_indent(self, doc, indent=4):
+ out = []
+ for line in doc:
+ out += [' '*indent + line]
+ return out
+
+ def _str_signature(self):
+ if self['Signature']:
+ return [self['Signature'].replace('*','\*')] + ['']
+ else:
+ return ['']
+
+ def _str_summary(self):
+ if self['Summary']:
+ return self['Summary'] + ['']
+ else:
+ return []
+
+ def _str_extended_summary(self):
+ if self['Extended Summary']:
+ return self['Extended Summary'] + ['']
+ else:
+ return []
+
+ def _str_param_list(self, name):
+ out = []
+ if self[name]:
+ out += self._str_header(name)
+ for param,param_type,desc in self[name]:
+ out += ['%s : %s' % (param, param_type)]
+ out += self._str_indent(desc)
+ out += ['']
+ return out
+
+ def _str_section(self, name):
+ out = []
+ if self[name]:
+ out += self._str_header(name)
+ out += self[name]
+ out += ['']
+ return out
+
+ def _str_see_also(self, func_role):
+ if not self['See Also']: return []
+ out = []
+ out += self._str_header("See Also")
+ last_had_desc = True
+ for func, desc, role in self['See Also']:
+ if role:
+ link = ':%s:`%s`' % (role, func)
+ elif func_role:
+ link = ':%s:`%s`' % (func_role, func)
+ else:
+ link = "`%s`_" % func
+ if desc or last_had_desc:
+ out += ['']
+ out += [link]
+ else:
+ out[-1] += ", %s" % link
+ if desc:
+ out += self._str_indent([' '.join(desc)])
+ last_had_desc = True
+ else:
+ last_had_desc = False
+ out += ['']
+ return out
+
+ def _str_index(self):
+ idx = self['index']
+ out = []
+ out += ['.. index:: %s' % idx.get('default','')]
+ for section, references in idx.iteritems():
+ if section == 'default':
+ continue
+ out += [' :%s: %s' % (section, ', '.join(references))]
+ return out
+
+ def __str__(self, func_role=''):
+ out = []
+ out += self._str_signature()
+ out += self._str_summary()
+ out += self._str_extended_summary()
+ for param_list in ('Parameters','Returns','Raises'):
+ out += self._str_param_list(param_list)
+ out += self._str_section('Warnings')
+ out += self._str_see_also(func_role)
+ for s in ('Notes','References','Examples'):
+ out += self._str_section(s)
+ out += self._str_index()
+ return '\n'.join(out)
+
+
+def indent(str,indent=4):
+ indent_str = ' '*indent
+ if str is None:
+ return indent_str
+ lines = str.split('\n')
+ return '\n'.join(indent_str + l for l in lines)
+
+def dedent_lines(lines):
+ """Deindent a list of lines maximally"""
+ return textwrap.dedent("\n".join(lines)).split("\n")
+
+def header(text, style='-'):
+ return text + '\n' + style*len(text) + '\n'
+
+
+class FunctionDoc(NumpyDocString):
+ def __init__(self, func, role='func', doc=None):
+ self._f = func
+ self._role = role # e.g. "func" or "meth"
+ if doc is None:
+ doc = inspect.getdoc(func) or ''
+ try:
+ NumpyDocString.__init__(self, doc)
+ except ValueError, e:
+ print '*'*78
+ print "ERROR: '%s' while parsing `%s`" % (e, self._f)
+ print '*'*78
+ #print "Docstring follows:"
+ #print doclines
+ #print '='*78
+
+ if not self['Signature']:
+ func, func_name = self.get_func()
+ try:
+ # try to read signature
+ argspec = inspect.getargspec(func)
+ argspec = inspect.formatargspec(*argspec)
+ argspec = argspec.replace('*','\*')
+ signature = '%s%s' % (func_name, argspec)
+ except TypeError, e:
+ signature = '%s()' % func_name
+ self['Signature'] = signature
+
+ def get_func(self):
+ func_name = getattr(self._f, '__name__', self.__class__.__name__)
+ if inspect.isclass(self._f):
+ func = getattr(self._f, '__call__', self._f.__init__)
+ else:
+ func = self._f
+ return func, func_name
+
+ def __str__(self):
+ out = ''
+
+ func, func_name = self.get_func()
+ signature = self['Signature'].replace('*', '\*')
+
+ roles = {'func': 'function',
+ 'meth': 'method'}
+
+ if self._role:
+ if not roles.has_key(self._role):
+ print "Warning: invalid role %s" % self._role
+ out += '.. %s:: %s\n \n\n' % (roles.get(self._role,''),
+ func_name)
+
+ out += super(FunctionDoc, self).__str__(func_role=self._role)
+ return out
+
+
+class ClassDoc(NumpyDocString):
+ def __init__(self,cls,modulename='',func_doc=FunctionDoc,doc=None):
+ if not inspect.isclass(cls):
+ raise ValueError("Initialise using a class. Got %r" % cls)
+ self._cls = cls
+
+ if modulename and not modulename.endswith('.'):
+ modulename += '.'
+ self._mod = modulename
+ self._name = cls.__name__
+ self._func_doc = func_doc
+
+ if doc is None:
+ doc = pydoc.getdoc(cls)
+
+ NumpyDocString.__init__(self, doc)
+
+ @property
+ def methods(self):
+ return [name for name,func in inspect.getmembers(self._cls)
+ if not name.startswith('_') and callable(func)]
+
+ def __str__(self):
+ out = ''
+ out += super(ClassDoc, self).__str__()
+ out += "\n\n"
+
+ #for m in self.methods:
+ # print "Parsing `%s`" % m
+ # out += str(self._func_doc(getattr(self._cls,m), 'meth')) + '\n\n'
+ # out += '.. index::\n single: %s; %s\n\n' % (self._name, m)
+
+ return out
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/sphinxext/docscrape_sphinx.py b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/docscrape_sphinx.py
new file mode 100644
index 00000000..77ed271b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/docscrape_sphinx.py
@@ -0,0 +1,136 @@
+import re, inspect, textwrap, pydoc
+from docscrape import NumpyDocString, FunctionDoc, ClassDoc
+
+class SphinxDocString(NumpyDocString):
+ # string conversion routines
+ def _str_header(self, name, symbol='`'):
+ return ['.. rubric:: ' + name, '']
+
+ def _str_field_list(self, name):
+ return [':' + name + ':']
+
+ def _str_indent(self, doc, indent=4):
+ out = []
+ for line in doc:
+ out += [' '*indent + line]
+ return out
+
+ def _str_signature(self):
+ return ['']
+ if self['Signature']:
+ return ['``%s``' % self['Signature']] + ['']
+ else:
+ return ['']
+
+ def _str_summary(self):
+ return self['Summary'] + ['']
+
+ def _str_extended_summary(self):
+ return self['Extended Summary'] + ['']
+
+ def _str_param_list(self, name):
+ out = []
+ if self[name]:
+ out += self._str_field_list(name)
+ out += ['']
+ for param,param_type,desc in self[name]:
+ out += self._str_indent(['**%s** : %s' % (param.strip(),
+ param_type)])
+ out += ['']
+ out += self._str_indent(desc,8)
+ out += ['']
+ return out
+
+ def _str_section(self, name):
+ out = []
+ if self[name]:
+ out += self._str_header(name)
+ out += ['']
+ content = textwrap.dedent("\n".join(self[name])).split("\n")
+ out += content
+ out += ['']
+ return out
+
+ def _str_see_also(self, func_role):
+ out = []
+ if self['See Also']:
+ see_also = super(SphinxDocString, self)._str_see_also(func_role)
+ out = ['.. seealso::', '']
+ out += self._str_indent(see_also[2:])
+ return out
+
+ def _str_warnings(self):
+ out = []
+ if self['Warnings']:
+ out = ['.. warning::', '']
+ out += self._str_indent(self['Warnings'])
+ return out
+
+ def _str_index(self):
+ idx = self['index']
+ out = []
+ if len(idx) == 0:
+ return out
+
+ out += ['.. index:: %s' % idx.get('default','')]
+ for section, references in idx.iteritems():
+ if section == 'default':
+ continue
+ elif section == 'refguide':
+ out += [' single: %s' % (', '.join(references))]
+ else:
+ out += [' %s: %s' % (section, ','.join(references))]
+ return out
+
+ def _str_references(self):
+ out = []
+ if self['References']:
+ out += self._str_header('References')
+ if isinstance(self['References'], str):
+ self['References'] = [self['References']]
+ out.extend(self['References'])
+ out += ['']
+ return out
+
+ def __str__(self, indent=0, func_role="obj"):
+ out = []
+ out += self._str_signature()
+ out += self._str_index() + ['']
+ out += self._str_summary()
+ out += self._str_extended_summary()
+ for param_list in ('Parameters', 'Attributes', 'Methods',
+ 'Returns','Raises'):
+ out += self._str_param_list(param_list)
+ out += self._str_warnings()
+ out += self._str_see_also(func_role)
+ out += self._str_section('Notes')
+ out += self._str_references()
+ out += self._str_section('Examples')
+ out = self._str_indent(out,indent)
+ return '\n'.join(out)
+
+class SphinxFunctionDoc(SphinxDocString, FunctionDoc):
+ pass
+
+class SphinxClassDoc(SphinxDocString, ClassDoc):
+ pass
+
+def get_doc_object(obj, what=None, doc=None):
+ if what is None:
+ if inspect.isclass(obj):
+ what = 'class'
+ elif inspect.ismodule(obj):
+ what = 'module'
+ elif callable(obj):
+ what = 'function'
+ else:
+ what = 'object'
+ if what == 'class':
+ return SphinxClassDoc(obj, '', func_doc=SphinxFunctionDoc, doc=doc)
+ elif what in ('function', 'method'):
+ return SphinxFunctionDoc(obj, '', doc=doc)
+ else:
+ if doc is None:
+ doc = pydoc.getdoc(obj)
+ return SphinxDocString(doc)
+
diff --git a/external_libs/python/pyzmq-14.7.0/docs/sphinxext/inheritance_diagram.py b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/inheritance_diagram.py
new file mode 100644
index 00000000..407fc13f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/inheritance_diagram.py
@@ -0,0 +1,407 @@
+"""
+Defines a docutils directive for inserting inheritance diagrams.
+
+Provide the directive with one or more classes or modules (separated
+by whitespace). For modules, all of the classes in that module will
+be used.
+
+Example::
+
+ Given the following classes:
+
+ class A: pass
+ class B(A): pass
+ class C(A): pass
+ class D(B, C): pass
+ class E(B): pass
+
+ .. inheritance-diagram: D E
+
+ Produces a graph like the following:
+
+ A
+ / \
+ B C
+ / \ /
+ E D
+
+The graph is inserted as a PNG+image map into HTML and a PDF in
+LaTeX.
+"""
+
+import inspect
+import os
+import re
+import subprocess
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
+from docutils.nodes import Body, Element
+from docutils.parsers.rst import directives
+from sphinx.roles import xfileref_role
+
+def my_import(name):
+ """Module importer - taken from the python documentation.
+
+ This function allows importing names with dots in them."""
+
+ mod = __import__(name)
+ components = name.split('.')
+ for comp in components[1:]:
+ mod = getattr(mod, comp)
+ return mod
+
+class DotException(Exception):
+ pass
+
+class InheritanceGraph(object):
+ """
+ Given a list of classes, determines the set of classes that
+ they inherit from all the way to the root "object", and then
+ is able to generate a graphviz dot graph from them.
+ """
+ def __init__(self, class_names, show_builtins=False):
+ """
+ *class_names* is a list of child classes to show bases from.
+
+ If *show_builtins* is True, then Python builtins will be shown
+ in the graph.
+ """
+ self.class_names = class_names
+ self.classes = self._import_classes(class_names)
+ self.all_classes = self._all_classes(self.classes)
+ if len(self.all_classes) == 0:
+ raise ValueError("No classes found for inheritance diagram")
+ self.show_builtins = show_builtins
+
+ py_sig_re = re.compile(r'''^([\w.]*\.)? # class names
+ (\w+) \s* $ # optionally arguments
+ ''', re.VERBOSE)
+
+ def _import_class_or_module(self, name):
+ """
+ Import a class using its fully-qualified *name*.
+ """
+ try:
+ path, base = self.py_sig_re.match(name).groups()
+ except:
+ raise ValueError(
+ "Invalid class or module '%s' specified for inheritance diagram" % name)
+ fullname = (path or '') + base
+ path = (path and path.rstrip('.'))
+ if not path:
+ path = base
+ try:
+ module = __import__(path, None, None, [])
+ # We must do an import of the fully qualified name. Otherwise if a
+ # subpackage 'a.b' is requested where 'import a' does NOT provide
+ # 'a.b' automatically, then 'a.b' will not be found below. This
+ # second call will force the equivalent of 'import a.b' to happen
+ # after the top-level import above.
+ my_import(fullname)
+
+ except ImportError:
+ raise ValueError(
+ "Could not import class or module '%s' specified for inheritance diagram" % name)
+
+ try:
+ todoc = module
+ for comp in fullname.split('.')[1:]:
+ todoc = getattr(todoc, comp)
+ except AttributeError:
+ raise ValueError(
+ "Could not find class or module '%s' specified for inheritance diagram" % name)
+
+ # If a class, just return it
+ if inspect.isclass(todoc):
+ return [todoc]
+ elif inspect.ismodule(todoc):
+ classes = []
+ for cls in todoc.__dict__.values():
+ if inspect.isclass(cls) and cls.__module__ == todoc.__name__:
+ classes.append(cls)
+ return classes
+ raise ValueError(
+ "'%s' does not resolve to a class or module" % name)
+
+ def _import_classes(self, class_names):
+ """
+ Import a list of classes.
+ """
+ classes = []
+ for name in class_names:
+ classes.extend(self._import_class_or_module(name))
+ return classes
+
+ def _all_classes(self, classes):
+ """
+ Return a list of all classes that are ancestors of *classes*.
+ """
+ all_classes = {}
+
+ def recurse(cls):
+ all_classes[cls] = None
+ for c in cls.__bases__:
+ if c not in all_classes:
+ recurse(c)
+
+ for cls in classes:
+ recurse(cls)
+
+ return all_classes.keys()
+
+ def class_name(self, cls, parts=0):
+ """
+ Given a class object, return a fully-qualified name. This
+ works for things I've tested in matplotlib so far, but may not
+ be completely general.
+ """
+ module = cls.__module__
+ if module == '__builtin__':
+ fullname = cls.__name__
+ else:
+ fullname = "%s.%s" % (module, cls.__name__)
+ if parts == 0:
+ return fullname
+ name_parts = fullname.split('.')
+ return '.'.join(name_parts[-parts:])
+
+ def get_all_class_names(self):
+ """
+ Get all of the class names involved in the graph.
+ """
+ return [self.class_name(x) for x in self.all_classes]
+
+ # These are the default options for graphviz
+ default_graph_options = {
+ "rankdir": "LR",
+ "size": '"8.0, 12.0"'
+ }
+ default_node_options = {
+ "shape": "box",
+ "fontsize": 10,
+ "height": 0.25,
+ "fontname": "Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",
+ "style": '"setlinewidth(0.5)"'
+ }
+ default_edge_options = {
+ "arrowsize": 0.5,
+ "style": '"setlinewidth(0.5)"'
+ }
+
+ def _format_node_options(self, options):
+ return ','.join(["%s=%s" % x for x in options.items()])
+ def _format_graph_options(self, options):
+ return ''.join(["%s=%s;\n" % x for x in options.items()])
+
+ def generate_dot(self, fd, name, parts=0, urls={},
+ graph_options={}, node_options={},
+ edge_options={}):
+ """
+ Generate a graphviz dot graph from the classes that
+ were passed in to __init__.
+
+ *fd* is a Python file-like object to write to.
+
+ *name* is the name of the graph
+
+ *urls* is a dictionary mapping class names to http urls
+
+ *graph_options*, *node_options*, *edge_options* are
+ dictionaries containing key/value pairs to pass on as graphviz
+ properties.
+ """
+ g_options = self.default_graph_options.copy()
+ g_options.update(graph_options)
+ n_options = self.default_node_options.copy()
+ n_options.update(node_options)
+ e_options = self.default_edge_options.copy()
+ e_options.update(edge_options)
+
+ fd.write('digraph %s {\n' % name)
+ fd.write(self._format_graph_options(g_options))
+
+ for cls in self.all_classes:
+ if not self.show_builtins and cls in __builtins__.values():
+ continue
+
+ name = self.class_name(cls, parts)
+
+ # Write the node
+ this_node_options = n_options.copy()
+ url = urls.get(self.class_name(cls))
+ if url is not None:
+ this_node_options['URL'] = '"%s"' % url
+ fd.write(' "%s" [%s];\n' %
+ (name, self._format_node_options(this_node_options)))
+
+ # Write the edges
+ for base in cls.__bases__:
+ if not self.show_builtins and base in __builtins__.values():
+ continue
+
+ base_name = self.class_name(base, parts)
+ fd.write(' "%s" -> "%s" [%s];\n' %
+ (base_name, name,
+ self._format_node_options(e_options)))
+ fd.write('}\n')
+
+ def run_dot(self, args, name, parts=0, urls={},
+ graph_options={}, node_options={}, edge_options={}):
+ """
+ Run graphviz 'dot' over this graph, returning whatever 'dot'
+ writes to stdout.
+
+ *args* will be passed along as commandline arguments.
+
+ *name* is the name of the graph
+
+ *urls* is a dictionary mapping class names to http urls
+
+ Raises DotException for any of the many os and
+ installation-related errors that may occur.
+ """
+ try:
+ dot = subprocess.Popen(['dot'] + list(args),
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ close_fds=True)
+ except OSError:
+ raise DotException("Could not execute 'dot'. Are you sure you have 'graphviz' installed?")
+ except ValueError:
+ raise DotException("'dot' called with invalid arguments")
+ except:
+ raise DotException("Unexpected error calling 'dot'")
+
+ self.generate_dot(dot.stdin, name, parts, urls, graph_options,
+ node_options, edge_options)
+ dot.stdin.close()
+ result = dot.stdout.read()
+ returncode = dot.wait()
+ if returncode != 0:
+ raise DotException("'dot' returned the errorcode %d" % returncode)
+ return result
+
+class inheritance_diagram(Body, Element):
+ """
+ A docutils node to use as a placeholder for the inheritance
+ diagram.
+ """
+ pass
+
+def inheritance_diagram_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state,
+ state_machine):
+ """
+ Run when the inheritance_diagram directive is first encountered.
+ """
+ node = inheritance_diagram()
+
+ class_names = arguments
+
+ # Create a graph starting with the list of classes
+ graph = InheritanceGraph(class_names)
+
+ # Create xref nodes for each target of the graph's image map and
+ # add them to the doc tree so that Sphinx can resolve the
+ # references to real URLs later. These nodes will eventually be
+ # removed from the doctree after we're done with them.
+ for name in graph.get_all_class_names():
+ refnodes, x = xfileref_role(
+ 'class', ':class:`%s`' % name, name, 0, state)
+ node.extend(refnodes)
+ # Store the graph object so we can use it to generate the
+ # dot file later
+ node['graph'] = graph
+ # Store the original content for use as a hash
+ node['parts'] = options.get('parts', 0)
+ node['content'] = " ".join(class_names)
+ return [node]
+
+def get_graph_hash(node):
+ return md5(node['content'] + str(node['parts'])).hexdigest()[-10:]
+
+def html_output_graph(self, node):
+ """
+ Output the graph for HTML. This will insert a PNG with clickable
+ image map.
+ """
+ graph = node['graph']
+ parts = node['parts']
+
+ graph_hash = get_graph_hash(node)
+ name = "inheritance%s" % graph_hash
+ path = '_images'
+ dest_path = os.path.join(setup.app.builder.outdir, path)
+ if not os.path.exists(dest_path):
+ os.makedirs(dest_path)
+ png_path = os.path.join(dest_path, name + ".png")
+ path = setup.app.builder.imgpath
+
+ # Create a mapping from fully-qualified class names to URLs.
+ urls = {}
+ for child in node:
+ if child.get('refuri') is not None:
+ urls[child['reftitle']] = child.get('refuri')
+ elif child.get('refid') is not None:
+ urls[child['reftitle']] = '#' + child.get('refid')
+
+ # These arguments to dot will save a PNG file to disk and write
+ # an HTML image map to stdout.
+ image_map = graph.run_dot(['-Tpng', '-o%s' % png_path, '-Tcmapx'],
+ name, parts, urls)
+ return ('<img src="%s/%s.png" usemap="#%s" class="inheritance"/>%s' %
+ (path, name, name, image_map))
+
+def latex_output_graph(self, node):
+ """
+ Output the graph for LaTeX. This will insert a PDF.
+ """
+ graph = node['graph']
+ parts = node['parts']
+
+ graph_hash = get_graph_hash(node)
+ name = "inheritance%s" % graph_hash
+ dest_path = os.path.abspath(os.path.join(setup.app.builder.outdir, '_images'))
+ if not os.path.exists(dest_path):
+ os.makedirs(dest_path)
+ pdf_path = os.path.abspath(os.path.join(dest_path, name + ".pdf"))
+
+ graph.run_dot(['-Tpdf', '-o%s' % pdf_path],
+ name, parts, graph_options={'size': '"6.0,6.0"'})
+ return '\n\\includegraphics{%s}\n\n' % pdf_path
+
+def visit_inheritance_diagram(inner_func):
+ """
+ This is just a wrapper around html/latex_output_graph to make it
+ easier to handle errors and insert warnings.
+ """
+ def visitor(self, node):
+ try:
+ content = inner_func(self, node)
+ except DotException, e:
+ # Insert the exception as a warning in the document
+ warning = self.document.reporter.warning(str(e), line=node.line)
+ warning.parent = node
+ node.children = [warning]
+ else:
+ source = self.document.attributes['source']
+ self.body.append(content)
+ node.children = []
+ return visitor
+
+def do_nothing(self, node):
+ pass
+
+def setup(app):
+ setup.app = app
+ setup.confdir = app.confdir
+
+ app.add_node(
+ inheritance_diagram,
+ latex=(visit_inheritance_diagram(latex_output_graph), do_nothing),
+ html=(visit_inheritance_diagram(html_output_graph), do_nothing))
+ app.add_directive(
+ 'inheritance-diagram', inheritance_diagram_directive,
+ False, (1, 100, 0), parts = directives.nonnegative_int)
diff --git a/external_libs/python/pyzmq-14.7.0/docs/sphinxext/ipython_console_highlighting.py b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/ipython_console_highlighting.py
new file mode 100644
index 00000000..217b779d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/ipython_console_highlighting.py
@@ -0,0 +1,114 @@
+"""reST directive for syntax-highlighting ipython interactive sessions.
+
+XXX - See what improvements can be made based on the new (as of Sept 2009)
+'pycon' lexer for the python console. At the very least it will give better
+highlighted tracebacks.
+"""
+
+#-----------------------------------------------------------------------------
+# Needed modules
+
+# Standard library
+import re
+
+# Third party
+from pygments.lexer import Lexer, do_insertions
+from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
+ PythonTracebackLexer)
+from pygments.token import Comment, Generic
+
+from sphinx import highlighting
+
+#-----------------------------------------------------------------------------
+# Global constants
+line_re = re.compile('.*?\n')
+
+#-----------------------------------------------------------------------------
+# Code begins - classes and functions
+
+class IPythonConsoleLexer(Lexer):
+ """
+ For IPython console output or doctests, such as:
+
+ .. sourcecode:: ipython
+
+ In [1]: a = 'foo'
+
+ In [2]: a
+ Out[2]: 'foo'
+
+ In [3]: print a
+ foo
+
+ In [4]: 1 / 0
+
+ Notes:
+
+ - Tracebacks are not currently supported.
+
+ - It assumes the default IPython prompts, not customized ones.
+ """
+
+ name = 'IPython console session'
+ aliases = ['ipython']
+ mimetypes = ['text/x-ipython-console']
+ input_prompt = re.compile("(In \[[0-9]+\]: )|( \.\.\.+:)")
+ output_prompt = re.compile("(Out\[[0-9]+\]: )|( \.\.\.+:)")
+ continue_prompt = re.compile(" \.\.\.+:")
+ tb_start = re.compile("\-+")
+
+ def get_tokens_unprocessed(self, text):
+ pylexer = PythonLexer(**self.options)
+ tblexer = PythonTracebackLexer(**self.options)
+
+ curcode = ''
+ insertions = []
+ for match in line_re.finditer(text):
+ line = match.group()
+ input_prompt = self.input_prompt.match(line)
+ continue_prompt = self.continue_prompt.match(line.rstrip())
+ output_prompt = self.output_prompt.match(line)
+ if line.startswith("#"):
+ insertions.append((len(curcode),
+ [(0, Comment, line)]))
+ elif input_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt, input_prompt.group())]))
+ curcode += line[input_prompt.end():]
+ elif continue_prompt is not None:
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt, continue_prompt.group())]))
+ curcode += line[continue_prompt.end():]
+ elif output_prompt is not None:
+ # Use the 'error' token for output. We should probably make
+ # our own token, but error is typicaly in a bright color like
+ # red, so it works fine for our output prompts.
+ insertions.append((len(curcode),
+ [(0, Generic.Error, output_prompt.group())]))
+ curcode += line[output_prompt.end():]
+ else:
+ if curcode:
+ for item in do_insertions(insertions,
+ pylexer.get_tokens_unprocessed(curcode)):
+ yield item
+ curcode = ''
+ insertions = []
+ yield match.start(), Generic.Output, line
+ if curcode:
+ for item in do_insertions(insertions,
+ pylexer.get_tokens_unprocessed(curcode)):
+ yield item
+
+
+def setup(app):
+ """Setup as a sphinx extension."""
+
+ # This is only a lexer, so adding it below to pygments appears sufficient.
+ # But if somebody knows that the right API usage should be to do that via
+ # sphinx, by all means fix it here. At least having this setup.py
+ # suppresses the sphinx warning we'd get without it.
+ pass
+
+#-----------------------------------------------------------------------------
+# Register the extension as a valid pygments lexer
+highlighting.lexers['ipython'] = IPythonConsoleLexer()
diff --git a/external_libs/python/pyzmq-14.7.0/docs/sphinxext/sphinx_cython.py b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/sphinx_cython.py
new file mode 100644
index 00000000..38c63225
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/sphinxext/sphinx_cython.py
@@ -0,0 +1,115 @@
+'''
+
+sphinx_cython.py
+
+This module monkeypatches sphinx autodoc to support Cython generated
+function signatures in the first line of the docstring of functions
+implemented as C extensions.
+
+Copyright (C) Nikolaus Rath <Nikolaus@rath.org>
+
+This file is part of LLFUSE (http://python-llfuse.googlecode.com).
+LLFUSE can be distributed under the terms of the GNU LGPL.
+
+It has been slightly modified by MinRK.
+'''
+
+import sphinx.ext.autodoc as SphinxAutodoc
+from sphinx.util.docstrings import prepare_docstring
+import inspect
+import re
+from sphinx.util import force_decode
+
+TYPE_RE = re.compile(r'(?:int|char)(?:\s+\*?\s*|\s*\*?\s+)([a-zA-Z_].*)')
+
+ClassDocumenter = SphinxAutodoc.ClassDocumenter
+MethodDocumenter = SphinxAutodoc.MethodDocumenter
+FunctionDocumenter = SphinxAutodoc.FunctionDocumenter
+
+class MyDocumenter(SphinxAutodoc.Documenter):
+ '''
+ Overwrites `get_doc()` to remove function and
+ method signatures and `format_args` to parse and give
+ precedence to function signatures in the first line
+ of the docstring.
+ '''
+
+ def get_doc(self, encoding=None):
+ docstr = self.get_attr(self.object, '__doc__', None)
+ if docstr:
+ docstr = force_decode(docstr, encoding)
+
+ myname = self.fullname[len(self.modname)+1:]
+ if myname.endswith('()'):
+ myname = myname[:-2]
+
+ if (docstr
+ and (myname + '(') in docstr
+ and '\n' in docstr
+ and docstr[docstr.index('\n')-1] == ')'):
+ docstr = docstr[docstr.index('\n')+1:]
+
+ if docstr:
+ # make sure we have Unicode docstrings, then sanitize and split
+ # into lines
+ return [prepare_docstring(force_decode(docstr, encoding))]
+ return []
+
+
+ def format_args(self):
+ myname = self.fullname[len(self.modname)+1:]
+ if myname.endswith('()'):
+ myname = myname[:-2]
+ # Try to parse docstring
+ docstr = self.get_attr(self.object, '__doc__', None)
+ if docstr:
+ docstr = force_decode(docstr, 'utf-8')
+ if (docstr
+ and (myname + '(') in docstr
+ and '\n' in docstr
+ and docstr[docstr.index('\n')-1] == ')'):
+ args = docstr[len(myname)+1:docstr.index('\n')-1]
+
+ # Get rid of Cython style types declarations
+ argl = []
+ for arg in [ x.strip() for x in args.split(',') ]:
+ if (arg in ('cls', 'self')
+ and isinstance(self, SphinxAutodoc.MethodDocumenter)):
+ continue
+ hit = TYPE_RE.match(arg)
+ if hit:
+ argl.append(hit.group(1))
+ else:
+ argl.append(arg)
+ args = '(%s)' % ', '.join(argl)
+ else:
+ # super seems to get this wrong:
+ for cls in (MethodDocumenter,
+ FunctionDocumenter,
+ ClassDocumenter):
+ if isinstance(self, cls):
+ return cls.format_args(self)
+ # return super(self.__class__, self).format_args()
+
+ # escape backslashes for reST
+ args = args.replace('\\', '\\\\')
+ return args
+
+
+class MyFunctionDocumenter(MyDocumenter, SphinxAutodoc.FunctionDocumenter):
+ pass
+
+class MyMethodDocumenter(MyDocumenter, SphinxAutodoc.MethodDocumenter):
+ pass
+
+class MyClassDocumenter(MyDocumenter, SphinxAutodoc.ClassDocumenter):
+ def format_signature(self):
+ return self.format_args() or "()"
+
+SphinxAutodoc.ClassDocumenter = MyClassDocumenter
+SphinxAutodoc.MethodDocumenter = MyMethodDocumenter
+SphinxAutodoc.FunctionDocumenter = MyFunctionDocumenter
+
+# don't use AttributeDocumenter on 'method_descriptor' members:
+AD = SphinxAutodoc.AttributeDocumenter
+AD.method_types = tuple(list(AD.method_types) + [type(str.count)])
diff --git a/external_libs/python/pyzmq-14.7.0/docs/update_ghpages.sh b/external_libs/python/pyzmq-14.7.0/docs/update_ghpages.sh
new file mode 100644
index 00000000..a0976912
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/docs/update_ghpages.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env sh
+# pick repo for gh-pages branch
+repo=origin
+
+if [ ! -d gh-pages ]; then
+ echo "setting up gh-pages subdir"
+ mkdir gh-pages || exit -1
+ cp -r ../.git gh-pages/ || exit -1
+ cd gh-pages || exit -1
+ init=0
+ git checkout $repo/gh-pages || init=1
+ if [ "$init" != "0" ]; then
+ echo "initializing gh-pages repo"
+ git symbolic-ref HEAD refs/heads/gh-pages || exit -1
+ rm .git/index || exit -1
+ git clean -fdx || exit -1
+ touch index.html
+ git add .
+ git commit -a -m 'init gh-pages' || exit -1
+ git push origin HEAD:gh-pages
+ fi
+ cd ..
+fi
+echo "updating local gh-pages with html build"
+rsync -va build/html/ gh-pages/ --delete --exclude .git --exclude .nojekyll || exit -1
+cd gh-pages
+touch .nojekyll
+git add .nojekyll
+git add .
+git commit -a || exit -1
+echo "pushing to remote gh-pages"
+# pwd
+git push $repo HEAD:gh-pages
diff --git a/external_libs/python/pyzmq-14.7.0/examples/LICENSE b/external_libs/python/pyzmq-14.7.0/examples/LICENSE
new file mode 100644
index 00000000..d4d39502
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/LICENSE
@@ -0,0 +1,3 @@
+PyZMQ examples are copyright their respective authors, and licensed
+under the New BSD License as described in COPYING.BSD unless otherwise
+specified in the file. \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/README_PY3K b/external_libs/python/pyzmq-14.7.0/examples/README_PY3K
new file mode 100644
index 00000000..d5272d0c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/README_PY3K
@@ -0,0 +1,10 @@
+These examples use Python2 syntax. Due to the change in Python from bytestring str objects
+to unicode str objects, 2to3 does not perform an adequate transform of the code. Examples
+can be valid on both Python2.5 and Python3, but such code is less readable than it should be.
+
+As a result, the Python3 examples are kept in a separate repo:
+
+https://github.com/minrk/pyzmq-py3k-examples
+
+
+The differences are very small, but important. \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/benchmark.py b/external_libs/python/pyzmq-14.7.0/examples/bench/benchmark.py
new file mode 100644
index 00000000..c379af9a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/benchmark.py
@@ -0,0 +1,25 @@
+from timeit import default_timer as timer
+
+def benchmark(f, size, reps):
+ msg = size*'0'
+ t1 = timer()
+ for i in range(reps):
+ msg2 = f(msg)
+ assert msg == msg2
+ t2 = timer()
+ diff = (t2-t1)
+ latency = diff/reps
+ return latency*1000000
+
+kB = [1000*2**n for n in range(10)]
+MB = [1000000*2**n for n in range(8)]
+sizes = [1] + kB + MB
+
+def benchmark_set(f, sizes, reps):
+ latencies = []
+ for size, rep in zip(sizes, reps):
+ print "Running benchmark with %r reps of %r bytes" % (rep, size)
+ lat = benchmark(f, size, rep)
+ latencies.append(lat)
+ return sizes, latencies
+
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/jsonrpc_client.py b/external_libs/python/pyzmq-14.7.0/examples/bench/jsonrpc_client.py
new file mode 100644
index 00000000..7fb6ef48
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/jsonrpc_client.py
@@ -0,0 +1,4 @@
+from timeit import default_timer as timer
+from jsonrpclib import Server
+
+client = Server('http://localhost:10000')
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/jsonrpc_server.py b/external_libs/python/pyzmq-14.7.0/examples/bench/jsonrpc_server.py
new file mode 100644
index 00000000..4500a02f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/jsonrpc_server.py
@@ -0,0 +1,8 @@
+from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+
+def echo(x):
+ return x
+
+server = SimpleJSONRPCServer(('localhost',10000))
+server.register_function(echo)
+server.serve_forever() \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/latency.png b/external_libs/python/pyzmq-14.7.0/examples/bench/latency.png
new file mode 100644
index 00000000..bb414b59
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/latency.png
Binary files differ
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec.png b/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec.png
new file mode 100644
index 00000000..a7b294ba
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec.png
Binary files differ
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec_log.png b/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec_log.png
new file mode 100644
index 00000000..c3a361e1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec_log.png
Binary files differ
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec_ratio.png b/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec_ratio.png
new file mode 100644
index 00000000..0a873318
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/msgs_sec_ratio.png
Binary files differ
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/plot_latency.py b/external_libs/python/pyzmq-14.7.0/examples/bench/plot_latency.py
new file mode 100644
index 00000000..f50ef295
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/plot_latency.py
@@ -0,0 +1,84 @@
+"""Plot latency data from messaging benchmarks.
+
+To generate the data for each library, I started the server and then did
+the following for each client::
+
+ from xmlrpc_client import client
+ for i in range(9):
+ s = '0'*10**i
+ print s
+ %timeit client.echo(s)
+"""
+
+from matplotlib.pylab import *
+
+rawdata = """# Data in milliseconds
+Bytes JSONRPC PYRO XMLRPC pyzmq_copy pyzmq_nocopy
+1 2.15 0.186 2.07 0.111 0.136
+10 2.49 0.187 1.87 0.115 0.137
+100 2.5 0.189 1.9 0.126 0.138
+1000 2.54 0.196 1.91 0.129 0.141
+10000 2.91 0.271 2.77 0.204 0.197
+100000 6.65 1.44 9.17 0.961 0.546
+1000000 50.2 15.8 81.5 8.39 2.25
+10000000 491 159 816 91.7 25.2
+100000000 5010 1560 8300 893 248
+
+"""
+with open('latency.csv','w') as f:
+ f.writelines(rawdata)
+
+data = csv2rec('latency.csv',delimiter='\t')
+
+loglog(data.bytes, data.xmlrpc*1000, label='XMLRPC')
+loglog(data.bytes, data.jsonrpc*1000, label='JSONRPC')
+loglog(data.bytes, data.pyro*1000, label='Pyro')
+loglog(data.bytes, data.pyzmq_nocopy*1000, label='PyZMQ')
+loglog(data.bytes, len(data.bytes)*[60], label='Ping')
+legend(loc=2)
+title('Latency')
+xlabel('Number of bytes')
+ylabel('Round trip latency ($\mu s$)')
+grid(True)
+show()
+savefig('latency.png')
+
+clf()
+
+semilogx(data.bytes, 1000/data.xmlrpc, label='XMLRPC')
+semilogx(data.bytes, 1000/data.jsonrpc, label='JSONRPC')
+semilogx(data.bytes, 1000/data.pyro, label='Pyro')
+semilogx(data.bytes, 1000/data.pyzmq_nocopy, label='PyZMQ')
+legend(loc=1)
+xlabel('Number of bytes')
+ylabel('Message/s')
+title('Message Throughput')
+grid(True)
+show()
+savefig('msgs_sec.png')
+
+clf()
+
+loglog(data.bytes, 1000/data.xmlrpc, label='XMLRPC')
+loglog(data.bytes, 1000/data.jsonrpc, label='JSONRPC')
+loglog(data.bytes, 1000/data.pyro, label='Pyro')
+loglog(data.bytes, 1000/data.pyzmq_nocopy, label='PyZMQ')
+legend(loc=3)
+xlabel('Number of bytes')
+ylabel('Message/s')
+title('Message Throughput')
+grid(True)
+show()
+savefig('msgs_sec_log.png')
+
+clf()
+
+semilogx(data.bytes, data.pyro/data.pyzmq_nocopy, label="No-copy")
+semilogx(data.bytes, data.pyro/data.pyzmq_copy, label="Copy")
+xlabel('Number of bytes')
+ylabel('Ratio throughputs')
+title('PyZMQ Throughput/Pyro Throughput')
+grid(True)
+legend(loc=2)
+show()
+savefig('msgs_sec_ratio.png')
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/pyro_client.py b/external_libs/python/pyzmq-14.7.0/examples/bench/pyro_client.py
new file mode 100644
index 00000000..5e25feb2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/pyro_client.py
@@ -0,0 +1,3 @@
+import Pyro.core
+
+client = Pyro.core.getProxyForURI("PYROLOC://localhost:7766/echo") \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/pyro_server.py b/external_libs/python/pyzmq-14.7.0/examples/bench/pyro_server.py
new file mode 100644
index 00000000..a2a2446a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/pyro_server.py
@@ -0,0 +1,14 @@
+import Pyro.core
+
+class Echo(Pyro.core.ObjBase):
+ def __init__(self):
+ Pyro.core.ObjBase.__init__(self)
+ def echo(self, x):
+ return x
+
+Pyro.core.initServer()
+daemon=Pyro.core.Daemon()
+uri=daemon.connect(Echo(),"echo")
+
+daemon.requestLoop()
+ \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/pyzmq_client.py b/external_libs/python/pyzmq-14.7.0/examples/bench/pyzmq_client.py
new file mode 100644
index 00000000..9afccec3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/pyzmq_client.py
@@ -0,0 +1,16 @@
+import zmq
+
+c = zmq.Context()
+s = c.socket(zmq.REQ)
+s.connect('tcp://127.0.0.1:10001')
+
+def echo(msg):
+ s.send(msg, copy=False)
+ msg2 = s.recv(copy=False)
+ return msg2
+
+class Client(object):
+ pass
+
+client = Client()
+client.echo = echo
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/pyzmq_server.py b/external_libs/python/pyzmq-14.7.0/examples/bench/pyzmq_server.py
new file mode 100644
index 00000000..cab00822
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/pyzmq_server.py
@@ -0,0 +1,10 @@
+import zmq
+
+c = zmq.Context()
+s = c.socket(zmq.REP)
+s.bind('tcp://127.0.0.1:10001')
+
+while True:
+ msg = s.recv(copy=False)
+ s.send(msg)
+
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/xmlrpc_client.py b/external_libs/python/pyzmq-14.7.0/examples/bench/xmlrpc_client.py
new file mode 100644
index 00000000..a73ddfd7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/xmlrpc_client.py
@@ -0,0 +1,6 @@
+from timeit import default_timer as timer
+from xmlrpclib import ServerProxy
+
+client = ServerProxy('http://localhost:10002')
+
+ \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/bench/xmlrpc_server.py b/external_libs/python/pyzmq-14.7.0/examples/bench/xmlrpc_server.py
new file mode 100644
index 00000000..24ab0190
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/bench/xmlrpc_server.py
@@ -0,0 +1,8 @@
+from SimpleXMLRPCServer import SimpleXMLRPCServer
+
+def echo(x):
+ return x
+
+server = SimpleXMLRPCServer(('localhost',10002))
+server.register_function(echo)
+server.serve_forever() \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/chat/display.py b/external_libs/python/pyzmq-14.7.0/examples/chat/display.py
new file mode 100644
index 00000000..d4e240a2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/chat/display.py
@@ -0,0 +1,41 @@
+"""The display part of a simply two process chat app."""
+
+#
+# Copyright (c) 2010 Andrew Gwozdziewycz
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import zmq
+
+def main(addrs):
+
+ context = zmq.Context()
+ socket = context.socket(zmq.SUB)
+ socket.setsockopt(zmq.SUBSCRIBE, "")
+ for addr in addrs:
+ print "Connecting to: ", addr
+ socket.connect(addr)
+
+ while True:
+ msg = socket.recv_pyobj()
+ print "%s: %s" % (msg[1], msg[0])
+
+if __name__ == '__main__':
+ import sys
+ if len(sys.argv) < 2:
+ print "usage: display.py <address> [,<address>...]"
+ raise SystemExit
+ main(sys.argv[1:])
diff --git a/external_libs/python/pyzmq-14.7.0/examples/chat/prompt.py b/external_libs/python/pyzmq-14.7.0/examples/chat/prompt.py
new file mode 100644
index 00000000..d9b12ec4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/chat/prompt.py
@@ -0,0 +1,39 @@
+"""The prompt part of a simply two process chat app."""
+
+#
+# Copyright (c) 2010 Andrew Gwozdziewycz
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import zmq
+
+def main(addr, who):
+
+ ctx = zmq.Context()
+ socket = ctx.socket(zmq.PUB)
+ socket.bind(addr)
+
+ while True:
+ msg = raw_input("%s> " % who)
+ socket.send_pyobj((msg, who))
+
+
+if __name__ == '__main__':
+ import sys
+ if len(sys.argv) != 3:
+ print "usage: prompt.py <address> <username>"
+ raise SystemExit
+ main(sys.argv[1], sys.argv[2])
diff --git a/external_libs/python/pyzmq-14.7.0/examples/device/client.py b/external_libs/python/pyzmq-14.7.0/examples/device/client.py
new file mode 100644
index 00000000..14a4e26a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/device/client.py
@@ -0,0 +1,38 @@
+"""A client for the device based server."""
+
+#
+# Copyright (c) 2010 Brian E. Granger and Eugene Chernyshov
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import zmq
+import os
+from time import time
+
+print 'Client', os.getpid()
+
+context = zmq.Context(1)
+
+socket = context.socket(zmq.REQ)
+socket.connect('tcp://127.0.0.1:5555')
+
+while True:
+ data = zmq.Message(str(os.getpid()))
+ start = time()
+ socket.send(data)
+ data = socket.recv()
+ print time()-start, data
+
diff --git a/external_libs/python/pyzmq-14.7.0/examples/device/server.py b/external_libs/python/pyzmq-14.7.0/examples/device/server.py
new file mode 100644
index 00000000..b29a3c1b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/device/server.py
@@ -0,0 +1,52 @@
+"""A device based server."""
+
+#
+# Copyright (c) 2010 Brian E. Granger and Eugene Chernyshov
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import zmq
+import os
+import threading
+import time
+
+print 'Server', os.getpid()
+
+def routine(context):
+ socket = context.socket(zmq.REP)
+
+ socket.connect("inproc://workers")
+
+ while True:
+ message = socket.recv()
+ time.sleep(1)
+ socket.send(message)
+
+context = zmq.Context(1)
+
+workers = context.socket(zmq.DEALER)
+workers.bind("inproc://workers");
+
+clients = context.socket(zmq.DEALER)
+clients.bind('tcp://127.0.0.1:5555')
+
+for i in range(10):
+ thread = threading.Thread(target=routine, args=(context, ))
+ thread.start()
+
+zmq.device(zmq.QUEUE, clients, workers)
+
+print "Finished"
diff --git a/external_libs/python/pyzmq-14.7.0/examples/eventloop/asyncweb.py b/external_libs/python/pyzmq-14.7.0/examples/eventloop/asyncweb.py
new file mode 100644
index 00000000..06b03f3f
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/eventloop/asyncweb.py
@@ -0,0 +1,96 @@
+"""Async web request example with tornado.
+
+Requests to localhost:8888 will be relayed via 0MQ to a slow responder,
+who will take 1-5 seconds to respond. The tornado app will remain responsive
+duriung this time, and when the worker replies, the web request will finish.
+
+A '.' is printed every 100ms to demonstrate that the zmq request is not blocking
+the event loop.
+"""
+
+
+import sys
+import random
+import threading
+import time
+
+import zmq
+from zmq.eventloop import ioloop, zmqstream
+
+"""
+ioloop.install() must be called prior to instantiating *any* tornado objects,
+and ideally before importing anything from tornado, just to be safe.
+
+install() sets the singleton instance of tornado.ioloop.IOLoop with zmq's
+IOLoop. If this is not done properly, multiple IOLoop instances may be
+created, which will have the effect of some subset of handlers never being
+called, because only one loop will be running.
+"""
+
+ioloop.install()
+
+import tornado
+from tornado import web
+
+
+def slow_responder():
+ """thread for slowly responding to replies."""
+ ctx = zmq.Context.instance()
+ socket = ctx.socket(zmq.REP)
+ socket.linger = 0
+ socket.bind('tcp://127.0.0.1:5555')
+ i=0
+ while True:
+ msg = socket.recv()
+ print "\nworker received %r\n" % msg
+ time.sleep(random.randint(1,5))
+ socket.send(msg + " to you too, #%i" % i)
+ i+=1
+
+def dot():
+ """callback for showing that IOLoop is still responsive while we wait"""
+ sys.stdout.write('.')
+ sys.stdout.flush()
+
+def printer(msg):
+ print (msg)
+
+class TestHandler(web.RequestHandler):
+
+ @web.asynchronous
+ def get(self):
+ ctx = zmq.Context.instance()
+ s = ctx.socket(zmq.REQ)
+ s.connect('tcp://127.0.0.1:5555')
+ # send request to worker
+ s.send('hello')
+ loop = ioloop.IOLoop.instance()
+ self.stream = zmqstream.ZMQStream(s)
+ self.stream.on_recv(self.handle_reply)
+
+ def handle_reply(self, msg):
+ # finish web request with worker's reply
+ reply = msg[0]
+ print "\nfinishing with %r\n" % reply,
+ self.stream.close()
+ self.write(reply)
+ self.finish()
+
+def main():
+ worker = threading.Thread(target=slow_responder)
+ worker.daemon=True
+ worker.start()
+
+ application = web.Application([(r"/", TestHandler)])
+ beat = ioloop.PeriodicCallback(dot, 100)
+ beat.start()
+ application.listen(8888)
+ try:
+ ioloop.IOLoop.instance().start()
+ except KeyboardInterrupt:
+ print ' Interrupted'
+
+
+if __name__ == "__main__":
+ main()
+
diff --git a/external_libs/python/pyzmq-14.7.0/examples/eventloop/echo.py b/external_libs/python/pyzmq-14.7.0/examples/eventloop/echo.py
new file mode 100644
index 00000000..9be079b6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/eventloop/echo.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+"""A trivial ZMQ echo server using the eventloop.
+
+Authors
+-------
+* MinRK
+"""
+
+import zmq
+from zmq.eventloop import ioloop
+
+loop = ioloop.IOLoop.instance()
+
+ctx = zmq.Context()
+s = ctx.socket(zmq.REP)
+s.bind('tcp://127.0.0.1:5555')
+
+def rep_handler(sock, events):
+ # We don't know how many recv's we can do?
+ msg = sock.recv()
+ # No guarantee that we can do the send. We need a way of putting the
+ # send in the event loop.
+ sock.send(msg)
+
+loop.add_handler(s, rep_handler, zmq.POLLIN)
+
+loop.start() \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/eventloop/echostream.py b/external_libs/python/pyzmq-14.7.0/examples/eventloop/echostream.py
new file mode 100644
index 00000000..04c1532e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/eventloop/echostream.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+"""Adapted echo.py to put the send in the event loop using a ZMQStream.
+
+Authors
+-------
+* MinRK
+"""
+
+import zmq
+from zmq.eventloop import ioloop, zmqstream
+loop = ioloop.IOLoop.instance()
+
+ctx = zmq.Context()
+s = ctx.socket(zmq.REP)
+s.bind('tcp://127.0.0.1:5555')
+stream = zmqstream.ZMQStream(s, loop)
+
+def echo(msg):
+ print " ".join(msg)
+ stream.send_multipart(msg)
+
+stream.on_recv(echo)
+
+loop.start() \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/eventloop/web.py b/external_libs/python/pyzmq-14.7.0/examples/eventloop/web.py
new file mode 100644
index 00000000..1285f950
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/eventloop/web.py
@@ -0,0 +1,46 @@
+import zmq
+from zmq.eventloop import ioloop, zmqstream
+
+"""
+ioloop.install() must be called prior to instantiating *any* tornado objects,
+and ideally before importing anything from tornado, just to be safe.
+
+install() sets the singleton instance of tornado.ioloop.IOLoop with zmq's
+IOLoop. If this is not done properly, multiple IOLoop instances may be
+created, which will have the effect of some subset of handlers never being
+called, because only one loop will be running.
+"""
+
+ioloop.install()
+
+import tornado
+import tornado.web
+
+
+"""
+this application can be used with echostream.py, start echostream.py,
+start web.py, then every time you hit http://localhost:8888/,
+echostream.py will print out 'hello'
+"""
+
+def printer(msg):
+ print (msg)
+
+ctx = zmq.Context()
+s = ctx.socket(zmq.REQ)
+s.connect('tcp://127.0.0.1:5555')
+stream = zmqstream.ZMQStream(s)
+stream.on_recv(printer)
+
+class TestHandler(tornado.web.RequestHandler):
+ def get(self):
+ print ("sending hello")
+ stream.send("hello")
+ self.write("hello")
+application = tornado.web.Application([(r"/", TestHandler)])
+
+if __name__ == "__main__":
+ application.listen(8888)
+ ioloop.IOLoop.instance().start()
+
+
diff --git a/external_libs/python/pyzmq-14.7.0/examples/gevent/poll.py b/external_libs/python/pyzmq-14.7.0/examples/gevent/poll.py
new file mode 100644
index 00000000..1daf80a7
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/gevent/poll.py
@@ -0,0 +1,42 @@
+import gevent
+from zmq import green as zmq
+
+# Connect to both receiving sockets and send 10 messages
+def sender():
+
+ sender = context.socket(zmq.PUSH)
+ sender.connect('inproc://polltest1')
+ sender.connect('inproc://polltest2')
+
+ for i in xrange(10):
+ sender.send('test %d' % i)
+ gevent.sleep(1)
+
+
+# create zmq context, and bind to pull sockets
+context = zmq.Context()
+receiver1 = context.socket(zmq.PULL)
+receiver1.bind('inproc://polltest1')
+receiver2 = context.socket(zmq.PULL)
+receiver2.bind('inproc://polltest2')
+
+gevent.spawn(sender)
+
+# Create poller and register both reciever sockets
+poller = zmq.Poller()
+poller.register(receiver1, zmq.POLLIN)
+poller.register(receiver2, zmq.POLLIN)
+
+# Read 10 messages from both reciever sockets
+msgcnt = 0
+while msgcnt < 10:
+ socks = dict(poller.poll())
+ if receiver1 in socks and socks[receiver1] == zmq.POLLIN:
+ print "Message from receiver1: %s" % receiver1.recv()
+ msgcnt += 1
+
+ if receiver2 in socks and socks[receiver2] == zmq.POLLIN:
+ print "Message from receiver2: %s" % receiver2.recv()
+ msgcnt += 1
+
+print "%d messages received" % msgcnt
diff --git a/external_libs/python/pyzmq-14.7.0/examples/gevent/reqrep.py b/external_libs/python/pyzmq-14.7.0/examples/gevent/reqrep.py
new file mode 100644
index 00000000..2a4f3079
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/gevent/reqrep.py
@@ -0,0 +1,47 @@
+"""
+Complex example which is a combination of the rr* examples from the zguide.
+"""
+from gevent import spawn
+import zmq.green as zmq
+
+# server
+context = zmq.Context()
+socket = context.socket(zmq.REP)
+socket.connect("tcp://localhost:5560")
+
+def serve(socket):
+ while True:
+ message = socket.recv()
+ print "Received request: ", message
+ socket.send("World")
+server = spawn(serve, socket)
+
+
+# client
+context = zmq.Context()
+socket = context.socket(zmq.REQ)
+socket.connect("tcp://localhost:5559")
+
+# Do 10 requests, waiting each time for a response
+def client():
+ for request in range(1,10):
+ socket.send("Hello")
+ message = socket.recv()
+ print "Received reply ", request, "[", message, "]"
+
+
+# broker
+frontend = context.socket(zmq.ROUTER)
+backend = context.socket(zmq.DEALER);
+frontend.bind("tcp://*:5559")
+backend.bind("tcp://*:5560")
+
+def proxy(socket_from, socket_to):
+ while True:
+ m = socket_from.recv_multipart()
+ socket_to.send_multipart(m)
+
+a = spawn(proxy, frontend, backend)
+b = spawn(proxy, backend, frontend)
+
+spawn(client).join()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/gevent/simple.py b/external_libs/python/pyzmq-14.7.0/examples/gevent/simple.py
new file mode 100644
index 00000000..ae065b35
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/gevent/simple.py
@@ -0,0 +1,37 @@
+from gevent import spawn, spawn_later
+import zmq.green as zmq
+
+# server
+print zmq.Context
+ctx = zmq.Context()
+sock = ctx.socket(zmq.PUSH)
+sock.bind('ipc:///tmp/zmqtest')
+
+spawn(sock.send_pyobj, ('this', 'is', 'a', 'python', 'tuple'))
+spawn_later(1, sock.send_pyobj, {'hi': 1234})
+spawn_later(2, sock.send_pyobj, ({'this': ['is a more complicated object', ':)']}, 42, 42, 42))
+spawn_later(3, sock.send_pyobj, 'foobar')
+spawn_later(4, sock.send_pyobj, 'quit')
+
+
+# client
+ctx = zmq.Context() # create a new context to kick the wheels
+sock = ctx.socket(zmq.PULL)
+sock.connect('ipc:///tmp/zmqtest')
+
+def get_objs(sock):
+ while True:
+ o = sock.recv_pyobj()
+ print 'received python object:', o
+ if o == 'quit':
+ print 'exiting.'
+ break
+
+def print_every(s, t=None):
+ print s
+ if t:
+ spawn_later(t, print_every, s, t)
+
+print_every('printing every half second', 0.5)
+spawn(get_objs, sock).join()
+
diff --git a/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py
new file mode 100644
index 00000000..175370ef
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+"""This launches an echoing rep socket device,
+and runs a blocking numpy action. The rep socket should
+remain responsive to pings during this time. Use heartbeater.py to
+ping this heart, and see the responsiveness.
+
+Authors
+-------
+* MinRK
+"""
+
+import time
+import numpy
+import zmq
+from zmq import devices
+
+ctx = zmq.Context()
+
+dev = devices.ThreadDevice(zmq.FORWARDER, zmq.SUB, zmq.DEALER)
+dev.setsockopt_in(zmq.SUBSCRIBE, "")
+dev.connect_in('tcp://127.0.0.1:5555')
+dev.connect_out('tcp://127.0.0.1:5556')
+dev.start()
+
+#wait for connections
+time.sleep(1)
+
+A = numpy.random.random((2**11,2**11))
+print "starting blocking loop"
+while True:
+ tic = time.time()
+ numpy.dot(A,A.transpose())
+ print "blocked for %.3f s"%(time.time()-tic)
+
diff --git a/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heartbeater.py b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heartbeater.py
new file mode 100644
index 00000000..180828a6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heartbeater.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+"""
+
+For use with heart.py
+
+A basic heartbeater using PUB and ROUTER sockets. pings are sent out on the PUB, and hearts
+are tracked based on their DEALER identities.
+
+You can start many hearts with heart.py, and the heartbeater will monitor all of them, and notice when they stop responding.
+
+Authors
+-------
+* MinRK
+"""
+
+import time
+import zmq
+from zmq.eventloop import ioloop, zmqstream
+
+
+class HeartBeater(object):
+ """A basic HeartBeater class
+ pingstream: a PUB stream
+ pongstream: an ROUTER stream"""
+
+ def __init__(self, loop, pingstream, pongstream, period=1000):
+ self.loop = loop
+ self.period = period
+
+ self.pingstream = pingstream
+ self.pongstream = pongstream
+ self.pongstream.on_recv(self.handle_pong)
+
+ self.hearts = set()
+ self.responses = set()
+ self.lifetime = 0
+ self.tic = time.time()
+
+ self.caller = ioloop.PeriodicCallback(self.beat, period, self.loop)
+ self.caller.start()
+
+ def beat(self):
+ toc = time.time()
+ self.lifetime += toc-self.tic
+ self.tic = toc
+ print self.lifetime
+ # self.message = str(self.lifetime)
+ goodhearts = self.hearts.intersection(self.responses)
+ heartfailures = self.hearts.difference(goodhearts)
+ newhearts = self.responses.difference(goodhearts)
+ # print newhearts, goodhearts, heartfailures
+ map(self.handle_new_heart, newhearts)
+ map(self.handle_heart_failure, heartfailures)
+ self.responses = set()
+ print "%i beating hearts: %s"%(len(self.hearts),self.hearts)
+ self.pingstream.send(str(self.lifetime))
+
+ def handle_new_heart(self, heart):
+ print "yay, got new heart %s!"%heart
+ self.hearts.add(heart)
+
+ def handle_heart_failure(self, heart):
+ print "Heart %s failed :("%heart
+ self.hearts.remove(heart)
+
+
+ def handle_pong(self, msg):
+ "if heart is beating"
+ if msg[1] == str(self.lifetime):
+ self.responses.add(msg[0])
+ else:
+ print "got bad heartbeat (possibly old?): %s"%msg[1]
+
+# sub.setsockopt(zmq.SUBSCRIBE)
+
+
+if __name__ == '__main__':
+ loop = ioloop.IOLoop()
+ context = zmq.Context()
+ pub = context.socket(zmq.PUB)
+ pub.bind('tcp://127.0.0.1:5555')
+ router = context.socket(zmq.ROUTER)
+ router.bind('tcp://127.0.0.1:5556')
+
+ outstream = zmqstream.ZMQStream(pub, loop)
+ instream = zmqstream.ZMQStream(router, loop)
+
+ hb = HeartBeater(loop, outstream, instream)
+
+ loop.start()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/heartbeat/ping.py b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/ping.py
new file mode 100644
index 00000000..797cb8c2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/ping.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+"""For use with pong.py
+
+This script simply pings a process started by pong.py or tspong.py, to
+demonstrate that zmq remains responsive while Python blocks.
+
+Authors
+-------
+* MinRK
+"""
+from __future__ import print_function
+
+import sys
+import time
+import numpy
+import zmq
+
+ctx = zmq.Context()
+
+req = ctx.socket(zmq.REQ)
+req.connect('tcp://127.0.0.1:10111')
+
+#wait for connects
+time.sleep(1)
+n=0
+while True:
+ time.sleep(numpy.random.random())
+ for i in range(4):
+ n+=1
+ msg = 'ping %i' % n
+ tic = time.time()
+ req.send_string(msg)
+ resp = req.recv_string()
+ print("%s: %.2f ms" % (msg, 1000*(time.time()-tic)))
+ assert msg == resp
diff --git a/external_libs/python/pyzmq-14.7.0/examples/heartbeat/pong.py b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/pong.py
new file mode 100644
index 00000000..524f3947
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/pong.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+"""This launches an echoing rep socket device using
+zmq.devices.ThreadDevice, and runs a blocking numpy action.
+The rep socket should remain responsive to pings during this time.
+
+Use ping.py to see how responsive it is.
+
+Authors
+-------
+* MinRK
+"""
+from __future__ import print_function
+
+import time
+import numpy
+import zmq
+from zmq import devices
+
+ctx = zmq.Context()
+
+dev = devices.ThreadDevice(zmq.FORWARDER, zmq.REP, -1)
+dev.bind_in('tcp://127.0.0.1:10111')
+dev.setsockopt_in(zmq.IDENTITY, b"whoda")
+dev.start()
+
+#wait for connections
+time.sleep(1)
+
+A = numpy.random.random((2**11,2**12))
+print("starting blocking loop")
+while True:
+ tic = time.time()
+ numpy.dot(A,A.transpose())
+ print("blocked for %.3f s"%(time.time()-tic))
diff --git a/external_libs/python/pyzmq-14.7.0/examples/logger/zmqlogger.py b/external_libs/python/pyzmq-14.7.0/examples/logger/zmqlogger.py
new file mode 100644
index 00000000..c55b51b3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/logger/zmqlogger.py
@@ -0,0 +1,70 @@
+"""
+Simple example of using zmq log handlers
+
+This starts a number of subprocesses with PUBHandlers that generate
+log messages at a regular interval. The main process has a SUB socket,
+which aggregates and logs all of the messages to the root logger.
+"""
+
+import logging
+from multiprocessing import Process
+import os
+import random
+import sys
+import time
+
+import zmq
+from zmq.log.handlers import PUBHandler
+
+LOG_LEVELS = (logging.DEBUG, logging.INFO, logging.WARN, logging.ERROR, logging.CRITICAL)
+
+def sub_logger(port, level=logging.DEBUG):
+ ctx = zmq.Context()
+ sub = ctx.socket(zmq.SUB)
+ sub.bind('tcp://127.0.0.1:%i' % port)
+ sub.setsockopt(zmq.SUBSCRIBE, "")
+ logging.basicConfig(level=level)
+
+ while True:
+ level, message = sub.recv_multipart()
+ if message.endswith('\n'):
+ # trim trailing newline, which will get appended again
+ message = message[:-1]
+ log = getattr(logging, level.lower())
+ log(message)
+
+def log_worker(port, interval=1, level=logging.DEBUG):
+ ctx = zmq.Context()
+ pub = ctx.socket(zmq.PUB)
+ pub.connect('tcp://127.0.0.1:%i' % port)
+
+ logger = logging.getLogger(str(os.getpid()))
+ logger.setLevel(level)
+ handler = PUBHandler(pub)
+ logger.addHandler(handler)
+ print "starting logger at %i with level=%s" % (os.getpid(), level)
+
+ while True:
+ level = random.choice(LOG_LEVELS)
+ logger.log(level, "Hello from %i!" % os.getpid())
+ time.sleep(interval)
+
+if __name__ == '__main__':
+ if len(sys.argv) > 1:
+ n = int(sys.argv[1])
+ else:
+ n = 2
+
+ port = 5555
+
+ # start the log generators
+ workers = [ Process(target=log_worker, args=(port,), kwargs=dict(level=random.choice(LOG_LEVELS))) for i in range(n) ]
+ [ w.start() for w in workers ]
+
+ # start the log watcher
+ try:
+ sub_logger(port)
+ except KeyboardInterrupt:
+ pass
+ finally:
+ [ w.terminate() for w in workers ]
diff --git a/external_libs/python/pyzmq-14.7.0/examples/mongodb/client.py b/external_libs/python/pyzmq-14.7.0/examples/mongodb/client.py
new file mode 100644
index 00000000..839dce71
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/mongodb/client.py
@@ -0,0 +1,46 @@
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Justin Riley
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import json
+import zmq
+
+class MongoZMQClient(object):
+ """
+ Client that connects with MongoZMQ server to add/fetch docs
+ """
+
+ def __init__(self, connect_addr='tcp://127.0.0.1:5000'):
+ self._context = zmq.Context()
+ self._socket = self._context.socket(zmq.DEALER)
+ self._socket.connect(connect_addr)
+
+ def _send_recv_msg(self, msg):
+ self._socket.send_multipart(msg)
+ return self._socket.recv_multipart()[0]
+
+ def get_doc(self, keys):
+ msg = ['get', json.dumps(keys)]
+ json_str = self._send_recv_msg(msg)
+ return json.loads(json_str)
+
+ def add_doc(self, doc):
+ msg = ['add', json.dumps(doc)]
+ return self._send_recv_msg(msg)
+
+def main():
+ client = MongoZMQClient()
+ for i in range(10):
+ doc = {'job': str(i)}
+ print "Adding doc", doc
+ print client.add_doc(doc)
+ for i in range(10):
+ query = {'job': str(i)}
+ print "Getting doc matching query:", query
+ print client.get_doc(query)
+
+if __name__ == "__main__":
+ main()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/mongodb/controller.py b/external_libs/python/pyzmq-14.7.0/examples/mongodb/controller.py
new file mode 100644
index 00000000..e154f1c5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/mongodb/controller.py
@@ -0,0 +1,91 @@
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Justin Riley
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import sys
+import zmq
+import pymongo
+import pymongo.json_util
+import json
+
+class MongoZMQ(object):
+ """
+ ZMQ server that adds/fetches documents (ie dictionaries) to a MongoDB.
+
+ NOTE: mongod must be started before using this class
+ """
+
+ def __init__(self, db_name, table_name, bind_addr="tcp://127.0.0.1:5000"):
+ """
+ bind_addr: address to bind zmq socket on
+ db_name: name of database to write to (created if doesnt exist)
+ table_name: name of mongodb 'table' in the db to write to (created if doesnt exist)
+ """
+ self._bind_addr = bind_addr
+ self._db_name = db_name
+ self._table_name = table_name
+ self._conn = pymongo.Connection()
+ self._db = self._conn[self._db_name]
+ self._table = self._db[self._table_name]
+
+ def _doc_to_json(self, doc):
+ return json.dumps(doc,default=pymongo.json_util.default)
+
+ def add_document(self, doc):
+ """
+ Inserts a document (dictionary) into mongo database table
+ """
+ print 'adding docment %s' % (doc)
+ try:
+ self._table.insert(doc)
+ except Exception,e:
+ return 'Error: %s' % e
+
+ def get_document_by_keys(self, keys):
+ """
+ Attempts to return a single document from database table that matches
+ each key/value in keys dictionary.
+ """
+ print 'attempting to retrieve document using keys: %s' % keys
+ try:
+ return self._table.find_one(keys)
+ except Exception,e:
+ return 'Error: %s' % e
+
+ def start(self):
+ context = zmq.Context()
+ socket = context.socket(zmq.ROUTER)
+ socket.bind(self._bind_addr)
+ while True:
+ msg = socket.recv_multipart()
+ print "Received msg: ", msg
+ if len(msg) != 3:
+ error_msg = 'invalid message received: %s' % msg
+ print error_msg
+ reply = [msg[0], error_msg]
+ socket.send_multipart(reply)
+ continue
+ id = msg[0]
+ operation = msg[1]
+ contents = json.loads(msg[2])
+ # always send back the id with ROUTER
+ reply = [id]
+ if operation == 'add':
+ self.add_document(contents)
+ reply.append("success")
+ elif operation == 'get':
+ doc = self.get_document_by_keys(contents)
+ json_doc = self._doc_to_json(doc)
+ reply.append(json_doc)
+ else:
+ print 'unknown request'
+ socket.send_multipart(reply)
+
+def main():
+ MongoZMQ('ipcontroller','jobs').start()
+
+if __name__ == "__main__":
+ main()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/monitoring/simple_monitor.py b/external_libs/python/pyzmq-14.7.0/examples/monitoring/simple_monitor.py
new file mode 100644
index 00000000..20ffbe55
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/monitoring/simple_monitor.py
@@ -0,0 +1,112 @@
+# -*- coding: utf-8 -*-
+"""Simple example demonstrating the use of the socket monitoring feature."""
+
+# This file is part of pyzmq.
+#
+# Distributed under the terms of the New BSD License. The full
+# license is in the file COPYING.BSD, distributed as part of this
+# software.
+from __future__ import print_function
+
+__author__ = 'Guido Goldstein'
+
+import threading
+import time
+
+import zmq
+from zmq.utils.monitor import recv_monitor_message
+
+
+line = lambda: print('-' * 40)
+
+
+print("libzmq-%s" % zmq.zmq_version())
+if zmq.zmq_version_info() < (4, 0):
+ raise RuntimeError("monitoring in libzmq version < 4.0 is not supported")
+
+EVENT_MAP = {}
+print("Event names:")
+for name in dir(zmq):
+ if name.startswith('EVENT_'):
+ value = getattr(zmq, name)
+ print("%21s : %4i" % (name, value))
+ EVENT_MAP[value] = name
+
+
+def event_monitor(monitor):
+ while monitor.poll():
+ evt = recv_monitor_message(monitor)
+ evt.update({'description': EVENT_MAP[evt['event']]})
+ print("Event: {}".format(evt))
+ if evt['event'] == zmq.EVENT_MONITOR_STOPPED:
+ break
+ monitor.close()
+ print()
+ print("event monitor thread done!")
+
+
+ctx = zmq.Context.instance()
+rep = ctx.socket(zmq.REP)
+req = ctx.socket(zmq.REQ)
+
+monitor = req.get_monitor_socket()
+
+t = threading.Thread(target=event_monitor, args=(monitor,))
+t.start()
+
+line()
+print("bind req")
+req.bind("tcp://127.0.0.1:6666")
+req.bind("tcp://127.0.0.1:6667")
+time.sleep(1)
+
+line()
+print("connect rep")
+rep.connect("tcp://127.0.0.1:6667")
+time.sleep(0.2)
+rep.connect("tcp://127.0.0.1:6666")
+time.sleep(1)
+
+line()
+print("disconnect rep")
+rep.disconnect("tcp://127.0.0.1:6667")
+time.sleep(1)
+rep.disconnect("tcp://127.0.0.1:6666")
+time.sleep(1)
+
+line()
+print("close rep")
+rep.close()
+time.sleep(1)
+
+line()
+print("disabling event monitor")
+req.disable_monitor()
+
+line()
+print("event monitor thread should now terminate")
+
+# Create a new socket to connect to listener, no more
+# events should be observed.
+rep = ctx.socket(zmq.REP)
+
+line()
+print("connect rep")
+rep.connect("tcp://127.0.0.1:6667")
+time.sleep(0.2)
+
+line()
+print("disconnect rep")
+rep.disconnect("tcp://127.0.0.1:6667")
+time.sleep(0.2)
+
+line()
+print("close rep")
+rep.close()
+
+line()
+print("close req")
+req.close()
+
+print("END")
+ctx.term()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/poll/pair.py b/external_libs/python/pyzmq-14.7.0/examples/poll/pair.py
new file mode 100644
index 00000000..81c8b3a1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/poll/pair.py
@@ -0,0 +1,56 @@
+"""A thorough test of polling PAIR sockets."""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Brian Granger
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import time
+import zmq
+
+print "Running polling tests for PAIR sockets..."
+
+addr = 'tcp://127.0.0.1:5555'
+ctx = zmq.Context()
+s1 = ctx.socket(zmq.PAIR)
+s2 = ctx.socket(zmq.PAIR)
+
+s1.bind(addr)
+s2.connect(addr)
+
+# Sleep to allow sockets to connect.
+time.sleep(1.0)
+
+poller = zmq.Poller()
+poller.register(s1, zmq.POLLIN|zmq.POLLOUT)
+poller.register(s2, zmq.POLLIN|zmq.POLLOUT)
+
+# Now make sure that both are send ready.
+socks = dict(poller.poll())
+assert socks[s1] == zmq.POLLOUT
+assert socks[s2] == zmq.POLLOUT
+
+# Now do a send on both, wait and test for zmq.POLLOUT|zmq.POLLIN
+s1.send('msg1')
+s2.send('msg2')
+time.sleep(1.0)
+socks = dict(poller.poll())
+assert socks[s1] == zmq.POLLOUT|zmq.POLLIN
+assert socks[s2] == zmq.POLLOUT|zmq.POLLIN
+
+# Make sure that both are in POLLOUT after recv.
+s1.recv()
+s2.recv()
+socks = dict(poller.poll())
+assert socks[s1] == zmq.POLLOUT
+assert socks[s2] == zmq.POLLOUT
+
+poller.unregister(s1)
+poller.unregister(s2)
+
+# Wait for everything to finish.
+time.sleep(1.0)
+
+print "Finished." \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/examples/poll/pubsub.py b/external_libs/python/pyzmq-14.7.0/examples/poll/pubsub.py
new file mode 100644
index 00000000..a590fa9c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/poll/pubsub.py
@@ -0,0 +1,57 @@
+"""A thorough test of polling PUB/SUB sockets."""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Brian Granger
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import time
+import zmq
+
+print "Running polling tets for PUB/SUB sockets..."
+
+addr = 'tcp://127.0.0.1:5555'
+ctx = zmq.Context()
+s1 = ctx.socket(zmq.PUB)
+s2 = ctx.socket(zmq.SUB)
+s2.setsockopt(zmq.SUBSCRIBE, '')
+
+s1.bind(addr)
+s2.connect(addr)
+
+# Sleep to allow sockets to connect.
+time.sleep(1.0)
+
+poller = zmq.Poller()
+poller.register(s1, zmq.POLLIN|zmq.POLLOUT)
+poller.register(s2, zmq.POLLIN|zmq.POLLOUT)
+
+# Now make sure that both are send ready.
+socks = dict(poller.poll())
+assert socks[s1] == zmq.POLLOUT
+assert not socks.has_key(s2)
+
+# Make sure that s1 stays in POLLOUT after a send.
+s1.send('msg1')
+socks = dict(poller.poll())
+assert socks[s1] == zmq.POLLOUT
+
+# Make sure that s2 is POLLIN after waiting.
+time.sleep(0.5)
+socks = dict(poller.poll())
+assert socks[s2] == zmq.POLLIN
+
+# Make sure that s2 goes into 0 after recv.
+s2.recv()
+socks = dict(poller.poll())
+assert not socks.has_key(s2)
+
+poller.unregister(s1)
+poller.unregister(s2)
+
+# Wait for everything to finish.
+time.sleep(1.0)
+
+print "Finished."
diff --git a/external_libs/python/pyzmq-14.7.0/examples/poll/reqrep.py b/external_libs/python/pyzmq-14.7.0/examples/poll/reqrep.py
new file mode 100644
index 00000000..ef4436c0
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/poll/reqrep.py
@@ -0,0 +1,71 @@
+"""A thorough test of polling REQ/REP sockets."""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Brian Granger
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import time
+import zmq
+
+print "Running polling tests for REQ/REP sockets..."
+
+addr = 'tcp://127.0.0.1:5555'
+ctx = zmq.Context()
+s1 = ctx.socket(zmq.REP)
+s2 = ctx.socket(zmq.REQ)
+
+s1.bind(addr)
+s2.connect(addr)
+
+# Sleep to allow sockets to connect.
+time.sleep(1.0)
+
+poller = zmq.Poller()
+poller.register(s1, zmq.POLLIN|zmq.POLLOUT)
+poller.register(s2, zmq.POLLIN|zmq.POLLOUT)
+
+# Make sure that s1 is in state 0 and s2 is in POLLOUT
+socks = dict(poller.poll())
+assert not socks.has_key(s1)
+assert socks[s2] == zmq.POLLOUT
+
+# Make sure that s2 goes immediately into state 0 after send.
+s2.send('msg1')
+socks = dict(poller.poll())
+assert not socks.has_key(s2)
+
+# Make sure that s1 goes into POLLIN state after a time.sleep().
+time.sleep(0.5)
+socks = dict(poller.poll())
+assert socks[s1] == zmq.POLLIN
+
+# Make sure that s1 goes into POLLOUT after recv.
+s1.recv()
+socks = dict(poller.poll())
+assert socks[s1] == zmq.POLLOUT
+
+# Make sure s1 goes into state 0 after send.
+s1.send('msg2')
+socks = dict(poller.poll())
+assert not socks.has_key(s1)
+
+# Wait and then see that s2 is in POLLIN.
+time.sleep(0.5)
+socks = dict(poller.poll())
+assert socks[s2] == zmq.POLLIN
+
+# Make sure that s2 is in POLLOUT after recv.
+s2.recv()
+socks = dict(poller.poll())
+assert socks[s2] == zmq.POLLOUT
+
+poller.unregister(s1)
+poller.unregister(s2)
+
+# Wait for everything to finish.
+time.sleep(1.0)
+
+print "Finished."
diff --git a/external_libs/python/pyzmq-14.7.0/examples/pubsub/publisher.py b/external_libs/python/pyzmq-14.7.0/examples/pubsub/publisher.py
new file mode 100644
index 00000000..a2ce6c9c
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/pubsub/publisher.py
@@ -0,0 +1,57 @@
+"""A test that publishes NumPy arrays.
+
+Uses REQ/REP (on PUB/SUB socket + 1) to synchronize
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Brian Granger
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import sys
+import time
+
+import zmq
+import numpy
+
+def sync(bind_to):
+ # use bind socket + 1
+ sync_with = ':'.join(bind_to.split(':')[:-1] +
+ [str(int(bind_to.split(':')[-1]) + 1)])
+ ctx = zmq.Context.instance()
+ s = ctx.socket(zmq.REP)
+ s.bind(sync_with)
+ print "Waiting for subscriber to connect..."
+ s.recv()
+ print " Done."
+ s.send('GO')
+
+def main():
+ if len (sys.argv) != 4:
+ print 'usage: publisher <bind-to> <array-size> <array-count>'
+ sys.exit (1)
+
+ try:
+ bind_to = sys.argv[1]
+ array_size = int(sys.argv[2])
+ array_count = int (sys.argv[3])
+ except (ValueError, OverflowError), e:
+ print 'array-size and array-count must be integers'
+ sys.exit (1)
+
+ ctx = zmq.Context()
+ s = ctx.socket(zmq.PUB)
+ s.bind(bind_to)
+
+ sync(bind_to)
+
+ print "Sending arrays..."
+ for i in range(array_count):
+ a = numpy.random.rand(array_size, array_size)
+ s.send_pyobj(a)
+ print " Done."
+
+if __name__ == "__main__":
+ main()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/pubsub/subscriber.py b/external_libs/python/pyzmq-14.7.0/examples/pubsub/subscriber.py
new file mode 100644
index 00000000..b996ad8d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/pubsub/subscriber.py
@@ -0,0 +1,74 @@
+"""A test that subscribes to NumPy arrays.
+
+Uses REQ/REP (on PUB/SUB socket + 1) to synchronize
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Brian Granger
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+
+import sys
+import time
+
+import zmq
+import numpy
+
+def sync(connect_to):
+ # use connect socket + 1
+ sync_with = ':'.join(connect_to.split(':')[:-1] +
+ [str(int(connect_to.split(':')[-1]) + 1)]
+ )
+ ctx = zmq.Context.instance()
+ s = ctx.socket(zmq.REQ)
+ s.connect(sync_with)
+ s.send('READY')
+ s.recv()
+
+def main():
+ if len (sys.argv) != 3:
+ print 'usage: subscriber <connect_to> <array-count>'
+ sys.exit (1)
+
+ try:
+ connect_to = sys.argv[1]
+ array_count = int (sys.argv[2])
+ except (ValueError, OverflowError), e:
+ print 'array-count must be integers'
+ sys.exit (1)
+
+ ctx = zmq.Context()
+ s = ctx.socket(zmq.SUB)
+ s.connect(connect_to)
+ s.setsockopt(zmq.SUBSCRIBE,'')
+
+ sync(connect_to)
+
+ start = time.clock()
+
+ print "Receiving arrays..."
+ for i in range(array_count):
+ a = s.recv_pyobj()
+ print " Done."
+
+ end = time.clock()
+
+ elapsed = (end - start) * 1000000
+ if elapsed == 0:
+ elapsed = 1
+ throughput = (1000000.0 * float (array_count)) / float (elapsed)
+ message_size = a.nbytes
+ megabits = float (throughput * message_size * 8) / 1000000
+
+ print "message size: %.0f [B]" % (message_size, )
+ print "array count: %.0f" % (array_count, )
+ print "mean throughput: %.0f [msg/s]" % (throughput, )
+ print "mean throughput: %.3f [Mb/s]" % (megabits, )
+
+ time.sleep(1.0)
+
+if __name__ == "__main__":
+ main()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/pubsub/topics_pub.py b/external_libs/python/pyzmq-14.7.0/examples/pubsub/topics_pub.py
new file mode 100644
index 00000000..73b3d1c5
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/pubsub/topics_pub.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+"""Simple example of publish/subscribe illustrating topics.
+
+Publisher and subscriber can be started in any order, though if publisher
+starts first, any messages sent before subscriber starts are lost. More than
+one subscriber can listen, and they can listen to different topics.
+
+Topic filtering is done simply on the start of the string, e.g. listening to
+'s' will catch 'sports...' and 'stocks' while listening to 'w' is enough to
+catch 'weather'.
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Brian Granger
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import itertools
+import sys
+import time
+
+import zmq
+
+def main():
+ if len (sys.argv) != 2:
+ print 'usage: publisher <bind-to>'
+ sys.exit (1)
+
+ bind_to = sys.argv[1]
+
+ all_topics = ['sports.general','sports.football','sports.basketball',
+ 'stocks.general','stocks.GOOG','stocks.AAPL',
+ 'weather']
+
+ ctx = zmq.Context()
+ s = ctx.socket(zmq.PUB)
+ s.bind(bind_to)
+
+ print "Starting broadcast on topics:"
+ print " %s" % all_topics
+ print "Hit Ctrl-C to stop broadcasting."
+ print "Waiting so subscriber sockets can connect..."
+ print
+ time.sleep(1.0)
+
+ msg_counter = itertools.count()
+ try:
+ for topic in itertools.cycle(all_topics):
+ msg_body = str(msg_counter.next())
+ print ' Topic: %s, msg:%s' % (topic, msg_body)
+ s.send_multipart([topic, msg_body])
+ # short wait so we don't hog the cpu
+ time.sleep(0.1)
+ except KeyboardInterrupt:
+ pass
+
+ print "Waiting for message queues to flush..."
+ time.sleep(0.5)
+ print "Done."
+
+if __name__ == "__main__":
+ main()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/pubsub/topics_sub.py b/external_libs/python/pyzmq-14.7.0/examples/pubsub/topics_sub.py
new file mode 100644
index 00000000..4a61fb55
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/pubsub/topics_sub.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+"""Simple example of publish/subscribe illustrating topics.
+
+Publisher and subscriber can be started in any order, though if publisher
+starts first, any messages sent before subscriber starts are lost. More than
+one subscriber can listen, and they can listen to different topics.
+
+Topic filtering is done simply on the start of the string, e.g. listening to
+'s' will catch 'sports...' and 'stocks' while listening to 'w' is enough to
+catch 'weather'.
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010 Brian Granger, Fernando Perez
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+import sys
+import time
+
+import zmq
+import numpy
+
+def main():
+ if len (sys.argv) < 2:
+ print 'usage: subscriber <connect_to> [topic topic ...]'
+ sys.exit (1)
+
+ connect_to = sys.argv[1]
+ topics = sys.argv[2:]
+
+ ctx = zmq.Context()
+ s = ctx.socket(zmq.SUB)
+ s.connect(connect_to)
+
+ # manage subscriptions
+ if not topics:
+ print "Receiving messages on ALL topics..."
+ s.setsockopt(zmq.SUBSCRIBE,'')
+ else:
+ print "Receiving messages on topics: %s ..." % topics
+ for t in topics:
+ s.setsockopt(zmq.SUBSCRIBE,t)
+ print
+ try:
+ while True:
+ topic, msg = s.recv_multipart()
+ print ' Topic: %s, msg:%s' % (topic, msg)
+ except KeyboardInterrupt:
+ pass
+ print "Done."
+
+if __name__ == "__main__":
+ main()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/security/generate_certificates.py b/external_libs/python/pyzmq-14.7.0/examples/security/generate_certificates.py
new file mode 100644
index 00000000..80db258b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/security/generate_certificates.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+"""
+Generate client and server CURVE certificate files then move them into the
+appropriate store directory, private_keys or public_keys. The certificates
+generated by this script are used by the stonehouse and ironhouse examples.
+
+In practice this would be done by hand or some out-of-band process.
+
+Author: Chris Laws
+"""
+
+import os
+import shutil
+import zmq.auth
+
+def generate_certificates(base_dir):
+ ''' Generate client and server CURVE certificate files'''
+ keys_dir = os.path.join(base_dir, 'certificates')
+ public_keys_dir = os.path.join(base_dir, 'public_keys')
+ secret_keys_dir = os.path.join(base_dir, 'private_keys')
+
+ # Create directories for certificates, remove old content if necessary
+ for d in [keys_dir, public_keys_dir, secret_keys_dir]:
+ if os.path.exists(d):
+ shutil.rmtree(d)
+ os.mkdir(d)
+
+ # create new keys in certificates dir
+ server_public_file, server_secret_file = zmq.auth.create_certificates(keys_dir, "server")
+ client_public_file, client_secret_file = zmq.auth.create_certificates(keys_dir, "client")
+
+ # move public keys to appropriate directory
+ for key_file in os.listdir(keys_dir):
+ if key_file.endswith(".key"):
+ shutil.move(os.path.join(keys_dir, key_file),
+ os.path.join(public_keys_dir, '.'))
+
+ # move secret keys to appropriate directory
+ for key_file in os.listdir(keys_dir):
+ if key_file.endswith(".key_secret"):
+ shutil.move(os.path.join(keys_dir, key_file),
+ os.path.join(secret_keys_dir, '.'))
+
+if __name__ == '__main__':
+ if zmq.zmq_version_info() < (4,0):
+ raise RuntimeError("Security is not supported in libzmq version < 4.0. libzmq version {0}".format(zmq.zmq_version()))
+
+ generate_certificates(os.path.dirname(__file__))
diff --git a/external_libs/python/pyzmq-14.7.0/examples/security/grasslands.py b/external_libs/python/pyzmq-14.7.0/examples/security/grasslands.py
new file mode 100644
index 00000000..2e36ab62
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/security/grasslands.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+'''
+No protection at all.
+
+All connections are accepted, there is no authentication, and no privacy.
+
+This is how ZeroMQ always worked until we built security into the wire
+protocol in early 2013. Internally, it uses a security mechanism called
+"NULL".
+
+Author: Chris Laws
+'''
+
+import zmq
+
+
+ctx = zmq.Context.instance()
+
+server = ctx.socket(zmq.PUSH)
+server.bind('tcp://*:9000')
+
+client = ctx.socket(zmq.PULL)
+client.connect('tcp://127.0.0.1:9000')
+
+server.send(b"Hello")
+msg = client.recv()
+if msg == b"Hello":
+ print("Grasslands test OK")
diff --git a/external_libs/python/pyzmq-14.7.0/examples/security/ioloop-ironhouse.py b/external_libs/python/pyzmq-14.7.0/examples/security/ioloop-ironhouse.py
new file mode 100644
index 00000000..fbde3062
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/security/ioloop-ironhouse.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+
+'''
+Ironhouse extends Stonehouse with client public key authentication.
+
+This is the strongest security model we have today, protecting against every
+attack we know about, except end-point attacks (where an attacker plants
+spyware on a machine to capture data before it's encrypted, or after it's
+decrypted).
+
+This example demonstrates using the IOLoopAuthenticator.
+
+Author: Chris Laws
+'''
+
+import logging
+import os
+import sys
+
+import zmq
+import zmq.auth
+from zmq.auth.ioloop import IOLoopAuthenticator
+from zmq.eventloop import ioloop, zmqstream
+
+def echo(server, msg):
+ logging.debug("server recvd %s", msg)
+ reply = msg + [b'World']
+ logging.debug("server sending %s", reply)
+ server.send_multipart(reply)
+
+def setup_server(server_secret_file, endpoint='tcp://127.0.0.1:9000'):
+ """setup a simple echo server with CURVE auth"""
+ server = zmq.Context.instance().socket(zmq.ROUTER)
+
+ server_public, server_secret = zmq.auth.load_certificate(server_secret_file)
+ server.curve_secretkey = server_secret
+ server.curve_publickey = server_public
+ server.curve_server = True # must come before bind
+ server.bind(endpoint)
+
+ server_stream = zmqstream.ZMQStream(server)
+ # simple echo
+ server_stream.on_recv_stream(echo)
+ return server_stream
+
+def client_msg_recvd(msg):
+ logging.debug("client recvd %s", msg)
+ logging.info("Ironhouse test OK")
+ # stop the loop when we get the reply
+ ioloop.IOLoop.instance().stop()
+
+def setup_client(client_secret_file, server_public_file, endpoint='tcp://127.0.0.1:9000'):
+ """setup a simple client with CURVE auth"""
+
+ client = zmq.Context.instance().socket(zmq.DEALER)
+
+ # We need two certificates, one for the client and one for
+ # the server. The client must know the server's public key
+ # to make a CURVE connection.
+ client_public, client_secret = zmq.auth.load_certificate(client_secret_file)
+ client.curve_secretkey = client_secret
+ client.curve_publickey = client_public
+
+ server_public, _ = zmq.auth.load_certificate(server_public_file)
+ # The client must know the server's public key to make a CURVE connection.
+ client.curve_serverkey = server_public
+ client.connect(endpoint)
+
+ client_stream = zmqstream.ZMQStream(client)
+ client_stream.on_recv(client_msg_recvd)
+ return client_stream
+
+
+def run():
+ '''Run Ironhouse example'''
+
+ # These direcotries are generated by the generate_certificates script
+ base_dir = os.path.dirname(__file__)
+ keys_dir = os.path.join(base_dir, 'certificates')
+ public_keys_dir = os.path.join(base_dir, 'public_keys')
+ secret_keys_dir = os.path.join(base_dir, 'private_keys')
+
+ if not (os.path.exists(keys_dir) and
+ os.path.exists(public_keys_dir) and
+ os.path.exists(secret_keys_dir)):
+ logging.critical("Certificates are missing - run generate_certificates script first")
+ sys.exit(1)
+
+ # Start an authenticator for this context.
+ auth = IOLoopAuthenticator()
+ auth.allow('127.0.0.1')
+ # Tell authenticator to use the certificate in a directory
+ auth.configure_curve(domain='*', location=public_keys_dir)
+
+ server_secret_file = os.path.join(secret_keys_dir, "server.key_secret")
+ server = setup_server(server_secret_file)
+ server_public_file = os.path.join(public_keys_dir, "server.key")
+ client_secret_file = os.path.join(secret_keys_dir, "client.key_secret")
+ client = setup_client(client_secret_file, server_public_file)
+ client.send(b'Hello')
+
+ auth.start()
+ ioloop.IOLoop.instance().start()
+
+if __name__ == '__main__':
+ if zmq.zmq_version_info() < (4,0):
+ raise RuntimeError("Security is not supported in libzmq version < 4.0. libzmq version {0}".format(zmq.zmq_version()))
+
+ if '-v' in sys.argv:
+ level = logging.DEBUG
+ else:
+ level = logging.INFO
+
+ logging.basicConfig(level=level, format="[%(levelname)s] %(message)s")
+
+ run()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/security/ironhouse.py b/external_libs/python/pyzmq-14.7.0/examples/security/ironhouse.py
new file mode 100644
index 00000000..8166e322
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/security/ironhouse.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+'''
+Ironhouse extends Stonehouse with client public key authentication.
+
+This is the strongest security model we have today, protecting against every
+attack we know about, except end-point attacks (where an attacker plants
+spyware on a machine to capture data before it's encrypted, or after it's
+decrypted).
+
+Author: Chris Laws
+'''
+
+import logging
+import os
+import sys
+
+import zmq
+import zmq.auth
+from zmq.auth.thread import ThreadAuthenticator
+
+
+def run():
+ ''' Run Ironhouse example '''
+
+ # These direcotries are generated by the generate_certificates script
+ base_dir = os.path.dirname(__file__)
+ keys_dir = os.path.join(base_dir, 'certificates')
+ public_keys_dir = os.path.join(base_dir, 'public_keys')
+ secret_keys_dir = os.path.join(base_dir, 'private_keys')
+
+ if not (os.path.exists(keys_dir) and
+ os.path.exists(public_keys_dir) and
+ os.path.exists(secret_keys_dir)):
+ logging.critical("Certificates are missing - run generate_certificates.py script first")
+ sys.exit(1)
+
+ ctx = zmq.Context.instance()
+
+ # Start an authenticator for this context.
+ auth = ThreadAuthenticator(ctx)
+ auth.start()
+ auth.allow('127.0.0.1')
+ # Tell authenticator to use the certificate in a directory
+ auth.configure_curve(domain='*', location=public_keys_dir)
+
+ server = ctx.socket(zmq.PUSH)
+
+ server_secret_file = os.path.join(secret_keys_dir, "server.key_secret")
+ server_public, server_secret = zmq.auth.load_certificate(server_secret_file)
+ server.curve_secretkey = server_secret
+ server.curve_publickey = server_public
+ server.curve_server = True # must come before bind
+ server.bind('tcp://*:9000')
+
+ client = ctx.socket(zmq.PULL)
+
+ # We need two certificates, one for the client and one for
+ # the server. The client must know the server's public key
+ # to make a CURVE connection.
+ client_secret_file = os.path.join(secret_keys_dir, "client.key_secret")
+ client_public, client_secret = zmq.auth.load_certificate(client_secret_file)
+ client.curve_secretkey = client_secret
+ client.curve_publickey = client_public
+
+ server_public_file = os.path.join(public_keys_dir, "server.key")
+ server_public, _ = zmq.auth.load_certificate(server_public_file)
+ # The client must know the server's public key to make a CURVE connection.
+ client.curve_serverkey = server_public
+ client.connect('tcp://127.0.0.1:9000')
+
+ server.send(b"Hello")
+
+ if client.poll(1000):
+ msg = client.recv()
+ if msg == b"Hello":
+ logging.info("Ironhouse test OK")
+ else:
+ logging.error("Ironhouse test FAIL")
+
+ # stop auth thread
+ auth.stop()
+
+if __name__ == '__main__':
+ if zmq.zmq_version_info() < (4,0):
+ raise RuntimeError("Security is not supported in libzmq version < 4.0. libzmq version {0}".format(zmq.zmq_version()))
+
+ if '-v' in sys.argv:
+ level = logging.DEBUG
+ else:
+ level = logging.INFO
+
+ logging.basicConfig(level=level, format="[%(levelname)s] %(message)s")
+
+ run()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/security/stonehouse.py b/external_libs/python/pyzmq-14.7.0/examples/security/stonehouse.py
new file mode 100644
index 00000000..924ff706
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/security/stonehouse.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+'''
+Stonehouse uses the "CURVE" security mechanism.
+
+This gives us strong encryption on data, and (as far as we know) unbreakable
+authentication. Stonehouse is the minimum you would use over public networks,
+and assures clients that they are speaking to an authentic server, while
+allowing any client to connect.
+
+Author: Chris Laws
+'''
+
+import logging
+import os
+import sys
+import time
+
+import zmq
+import zmq.auth
+from zmq.auth.thread import ThreadAuthenticator
+
+
+def run():
+ ''' Run Stonehouse example '''
+
+ # These directories are generated by the generate_certificates script
+ base_dir = os.path.dirname(__file__)
+ keys_dir = os.path.join(base_dir, 'certificates')
+ public_keys_dir = os.path.join(base_dir, 'public_keys')
+ secret_keys_dir = os.path.join(base_dir, 'private_keys')
+
+ if not (os.path.exists(keys_dir) and
+ os.path.exists(public_keys_dir) and
+ os.path.exists(secret_keys_dir)):
+ logging.critical("Certificates are missing: run generate_certificates.py script first")
+ sys.exit(1)
+
+ ctx = zmq.Context.instance()
+
+ # Start an authenticator for this context.
+ auth = ThreadAuthenticator(ctx)
+ auth.start()
+ auth.allow('127.0.0.1')
+ # Tell the authenticator how to handle CURVE requests
+ auth.configure_curve(domain='*', location=zmq.auth.CURVE_ALLOW_ANY)
+
+ server = ctx.socket(zmq.PUSH)
+ server_secret_file = os.path.join(secret_keys_dir, "server.key_secret")
+ server_public, server_secret = zmq.auth.load_certificate(server_secret_file)
+ server.curve_secretkey = server_secret
+ server.curve_publickey = server_public
+ server.curve_server = True # must come before bind
+ server.bind('tcp://*:9000')
+
+ client = ctx.socket(zmq.PULL)
+ # We need two certificates, one for the client and one for
+ # the server. The client must know the server's public key
+ # to make a CURVE connection.
+ client_secret_file = os.path.join(secret_keys_dir, "client.key_secret")
+ client_public, client_secret = zmq.auth.load_certificate(client_secret_file)
+ client.curve_secretkey = client_secret
+ client.curve_publickey = client_public
+
+ # The client must know the server's public key to make a CURVE connection.
+ server_public_file = os.path.join(public_keys_dir, "server.key")
+ server_public, _ = zmq.auth.load_certificate(server_public_file)
+ client.curve_serverkey = server_public
+
+ client.connect('tcp://127.0.0.1:9000')
+
+ server.send(b"Hello")
+
+ if client.poll(1000):
+ msg = client.recv()
+ if msg == b"Hello":
+ logging.info("Stonehouse test OK")
+ else:
+ logging.error("Stonehouse test FAIL")
+
+ # stop auth thread
+ auth.stop()
+
+if __name__ == '__main__':
+ if zmq.zmq_version_info() < (4,0):
+ raise RuntimeError("Security is not supported in libzmq version < 4.0. libzmq version {0}".format(zmq.zmq_version()))
+
+ if '-v' in sys.argv:
+ level = logging.DEBUG
+ else:
+ level = logging.INFO
+
+ logging.basicConfig(level=level, format="[%(levelname)s] %(message)s")
+
+ run()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/security/strawhouse.py b/external_libs/python/pyzmq-14.7.0/examples/security/strawhouse.py
new file mode 100644
index 00000000..442dcda2
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/security/strawhouse.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+
+'''
+Allow or deny clients based on IP address.
+
+Strawhouse, which is plain text with filtering on IP addresses. It still
+uses the NULL mechanism, but we install an authentication hook that checks
+the IP address against a whitelist or blacklist and allows or denies it
+accordingly.
+
+Author: Chris Laws
+'''
+
+import logging
+import sys
+
+import zmq
+import zmq.auth
+from zmq.auth.thread import ThreadAuthenticator
+
+
+def run():
+ '''Run strawhouse client'''
+
+ allow_test_pass = False
+ deny_test_pass = False
+
+ ctx = zmq.Context.instance()
+
+ # Start an authenticator for this context.
+ auth = ThreadAuthenticator(ctx)
+ auth.start()
+
+ # Part 1 - demonstrate allowing clients based on IP address
+ auth.allow('127.0.0.1')
+
+ server = ctx.socket(zmq.PUSH)
+ server.zap_domain = b'global' # must come before bind
+ server.bind('tcp://*:9000')
+
+ client_allow = ctx.socket(zmq.PULL)
+ client_allow.connect('tcp://127.0.0.1:9000')
+
+ server.send(b"Hello")
+
+ msg = client_allow.recv()
+ if msg == b"Hello":
+ allow_test_pass = True
+
+ client_allow.close()
+
+ # Part 2 - demonstrate denying clients based on IP address
+ auth.stop()
+
+ auth = ThreadAuthenticator(ctx)
+ auth.start()
+
+ auth.deny('127.0.0.1')
+
+ client_deny = ctx.socket(zmq.PULL)
+ client_deny.connect('tcp://127.0.0.1:9000')
+
+ if server.poll(50, zmq.POLLOUT):
+ server.send(b"Hello")
+
+ if client_deny.poll(50):
+ msg = client_deny.recv()
+ else:
+ deny_test_pass = True
+ else:
+ deny_test_pass = True
+
+ client_deny.close()
+
+ auth.stop() # stop auth thread
+
+ if allow_test_pass and deny_test_pass:
+ logging.info("Strawhouse test OK")
+ else:
+ logging.error("Strawhouse test FAIL")
+
+
+if __name__ == '__main__':
+ if zmq.zmq_version_info() < (4,0):
+ raise RuntimeError("Security is not supported in libzmq version < 4.0. libzmq version {0}".format(zmq.zmq_version()))
+
+ if '-v' in sys.argv:
+ level = logging.DEBUG
+ else:
+ level = logging.INFO
+
+ logging.basicConfig(level=level, format="[%(levelname)s] %(message)s")
+
+ run()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/security/woodhouse.py b/external_libs/python/pyzmq-14.7.0/examples/security/woodhouse.py
new file mode 100644
index 00000000..0db97343
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/security/woodhouse.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+
+'''
+Woodhouse extends Strawhouse with a name and password check.
+
+This uses the PLAIN mechanism which does plain-text username and password authentication).
+It's not really secure, and anyone sniffing the network (trivial with WiFi)
+can capture passwords and then login.
+
+Author: Chris Laws
+'''
+
+import logging
+import sys
+
+import zmq
+import zmq.auth
+from zmq.auth.thread import ThreadAuthenticator
+
+def run():
+ '''Run woodhouse example'''
+
+ valid_client_test_pass = False
+ invalid_client_test_pass = False
+
+ ctx = zmq.Context.instance()
+
+ # Start an authenticator for this context.
+ auth = ThreadAuthenticator(ctx)
+ auth.start()
+ auth.allow('127.0.0.1')
+ # Instruct authenticator to handle PLAIN requests
+ auth.configure_plain(domain='*', passwords={'admin': 'secret'})
+
+ server = ctx.socket(zmq.PUSH)
+ server.plain_server = True # must come before bind
+ server.bind('tcp://*:9000')
+
+ client = ctx.socket(zmq.PULL)
+ client.plain_username = b'admin'
+ client.plain_password = b'secret'
+ client.connect('tcp://127.0.0.1:9000')
+
+ server.send(b"Hello")
+
+ if client.poll():
+ msg = client.recv()
+ if msg == b"Hello":
+ valid_client_test_pass = True
+
+ client.close()
+
+
+ # now use invalid credentials - expect no msg received
+ client2 = ctx.socket(zmq.PULL)
+ client2.plain_username = b'admin'
+ client2.plain_password = b'bogus'
+ client2.connect('tcp://127.0.0.1:9000')
+
+ server.send(b"World")
+
+ if client2.poll(50):
+ msg = client.recv()
+ if msg == "World":
+ invalid_client_test_pass = False
+ else:
+ # no message is expected
+ invalid_client_test_pass = True
+
+ # stop auth thread
+ auth.stop()
+
+ if valid_client_test_pass and invalid_client_test_pass:
+ logging.info("Woodhouse test OK")
+ else:
+ logging.error("Woodhouse test FAIL")
+
+
+if __name__ == '__main__':
+ if zmq.zmq_version_info() < (4,0):
+ raise RuntimeError("Security is not supported in libzmq version < 4.0. libzmq version {0}".format(zmq.zmq_version()))
+
+ if '-v' in sys.argv:
+ level = logging.DEBUG
+ else:
+ level = logging.INFO
+
+ logging.basicConfig(level=level, format="[%(levelname)s] %(message)s")
+
+ run()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/serialization/serialsocket.py b/external_libs/python/pyzmq-14.7.0/examples/serialization/serialsocket.py
new file mode 100644
index 00000000..186a3416
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/serialization/serialsocket.py
@@ -0,0 +1,74 @@
+"""A Socket subclass that adds some serialization methods."""
+
+import zlib
+import pickle
+
+import numpy
+
+import zmq
+
+class SerializingSocket(zmq.Socket):
+ """A class with some extra serialization methods
+
+ send_zipped_pickle is just like send_pyobj, but uses
+ zlib to compress the stream before sending.
+
+ send_array sends numpy arrays with metadata necessary
+ for reconstructing the array on the other side (dtype,shape).
+ """
+
+ def send_zipped_pickle(self, obj, flags=0, protocol=-1):
+ """pack and compress an object with pickle and zlib."""
+ pobj = pickle.dumps(obj, protocol)
+ zobj = zlib.compress(pobj)
+ print('zipped pickle is %i bytes' % len(zobj))
+ return self.send(zobj, flags=flags)
+
+ def recv_zipped_pickle(self, flags=0):
+ """reconstruct a Python object sent with zipped_pickle"""
+ zobj = self.recv(flags)
+ pobj = zlib.decompress(zobj)
+ return pickle.loads(pobj)
+
+ def send_array(self, A, flags=0, copy=True, track=False):
+ """send a numpy array with metadata"""
+ md = dict(
+ dtype = str(A.dtype),
+ shape = A.shape,
+ )
+ self.send_json(md, flags|zmq.SNDMORE)
+ return self.send(A, flags, copy=copy, track=track)
+
+ def recv_array(self, flags=0, copy=True, track=False):
+ """recv a numpy array"""
+ md = self.recv_json(flags=flags)
+ msg = self.recv(flags=flags, copy=copy, track=track)
+ A = numpy.frombuffer(msg, dtype=md['dtype'])
+ return A.reshape(md['shape'])
+
+class SerializingContext(zmq.Context):
+ _socket_class = SerializingSocket
+
+def main():
+ ctx = SerializingContext()
+ req = ctx.socket(zmq.REQ)
+ rep = ctx.socket(zmq.REP)
+
+ rep.bind('inproc://a')
+ req.connect('inproc://a')
+ A = numpy.ones((1024,1024))
+ print ("Array is %i bytes" % (A.size * A.itemsize))
+
+ # send/recv with pickle+zip
+ req.send_zipped_pickle(A)
+ B = rep.recv_zipped_pickle()
+ # now try non-copying version
+ rep.send_array(A, copy=False)
+ C = req.recv_array(copy=False)
+ print ("Checking zipped pickle...")
+ print ("Okay" if (A==B).all() else "Failed")
+ print ("Checking send_array...")
+ print ("Okay" if (C==B).all() else "Failed")
+
+if __name__ == '__main__':
+ main()
diff --git a/external_libs/python/pyzmq-14.7.0/examples/win32-interrupt/display.py b/external_libs/python/pyzmq-14.7.0/examples/win32-interrupt/display.py
new file mode 100644
index 00000000..25da5d90
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/win32-interrupt/display.py
@@ -0,0 +1,45 @@
+"""The display part of a simply two process chat app."""
+
+# This file has been placed in the public domain.
+
+
+import zmq
+from zmq.utils.win32 import allow_interrupt
+
+
+def main(addrs):
+ context = zmq.Context()
+ control = context.socket(zmq.PUB)
+ control.bind('inproc://control')
+ updates = context.socket(zmq.SUB)
+ updates.setsockopt(zmq.SUBSCRIBE, "")
+ updates.connect('inproc://control')
+ for addr in addrs:
+ print "Connecting to: ", addr
+ updates.connect(addr)
+
+ def interrupt_polling():
+ """Fix CTRL-C on Windows using "self pipe trick"."""
+ control.send_multipart(['', 'quit'])
+
+ with allow_interrupt(interrupt_polling):
+ message = ''
+ while message != 'quit':
+ message = updates.recv_multipart()
+ if len(message) < 2:
+ print 'Invalid message.'
+ continue
+ account = message[0]
+ message = ' '.join(message[1:])
+ if message == 'quit':
+ print 'Killed by "%s".' % account
+ break
+ print '%s: %s' % (account, message)
+
+
+if __name__ == '__main__':
+ import sys
+ if len(sys.argv) < 2:
+ print "usage: display.py <address> [,<address>...]"
+ raise SystemExit
+ main(sys.argv[1:])
diff --git a/external_libs/python/pyzmq-14.7.0/examples/win32-interrupt/prompt.py b/external_libs/python/pyzmq-14.7.0/examples/win32-interrupt/prompt.py
new file mode 100644
index 00000000..96dc5c6d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/examples/win32-interrupt/prompt.py
@@ -0,0 +1,39 @@
+"""The prompt part of a simply two process chat app."""
+
+#
+# Copyright (c) 2010 Andrew Gwozdziewycz
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import zmq
+
+def main(addr, account):
+
+ ctx = zmq.Context()
+ socket = ctx.socket(zmq.PUB)
+ socket.bind(addr)
+
+ while True:
+ message = raw_input("%s> " % account)
+ socket.send_multipart((account, message))
+
+
+if __name__ == '__main__':
+ import sys
+ if len(sys.argv) != 3:
+ print "usage: prompt.py <address> <username>"
+ raise SystemExit
+ main(sys.argv[1], sys.argv[2])
diff --git a/external_libs/python/pyzmq-14.7.0/perf/perf.py b/external_libs/python/pyzmq-14.7.0/perf/perf.py
new file mode 100644
index 00000000..a0254b4a
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/perf/perf.py
@@ -0,0 +1,193 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+# Copyright (C) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+#
+# Some original test code Copyright (c) 2007-2010 iMatix Corporation,
+# Used under LGPLv3
+
+import argparse
+import time
+
+from multiprocessing import Process
+
+import zmq
+
+def parse_args(argv=None):
+
+ parser = argparse.ArgumentParser(description='Run a zmq performance test')
+ parser.add_argument('-p', '--poll', action='store_true',
+ help='use a zmq Poller instead of raw send/recv')
+ parser.add_argument('-c', '--copy', action='store_true',
+ help='copy messages instead of using zero-copy')
+ parser.add_argument('-s', '--size', type=int, default=10240,
+ help='size (in bytes) of the test message')
+ parser.add_argument('-n', '--count', type=int, default=10240,
+ help='number of test messages to send')
+ parser.add_argument('--url', dest='url', type=str, default='tcp://127.0.0.1:5555',
+ help='the zmq URL on which to run the test')
+ parser.add_argument(dest='test', type=str, default='lat', choices=['lat', 'thr'],
+ help='which test to run')
+ return parser.parse_args(argv)
+
+def latency_echo(url, count, poll, copy):
+ """echo messages on a REP socket
+
+ Should be started before `latency`
+ """
+ ctx = zmq.Context()
+ s = ctx.socket(zmq.REP)
+
+ if poll:
+ p = zmq.Poller()
+ p.register(s)
+
+ s.bind(url)
+
+ block = zmq.NOBLOCK if poll else 0
+
+ for i in range(count):
+ if poll:
+ res = p.poll()
+ msg = s.recv(block, copy=copy)
+
+ if poll:
+ res = p.poll()
+ s.send(msg, block, copy=copy)
+
+ msg = s.recv()
+ assert msg == b'done'
+
+ s.close()
+ ctx.term()
+
+def latency(url, count, size, poll, copy):
+ """Perform a latency test"""
+ ctx = zmq.Context()
+ s = ctx.socket(zmq.REQ)
+ s.setsockopt(zmq.LINGER, -1)
+ s.connect(url)
+ if poll:
+ p = zmq.Poller()
+ p.register(s)
+
+ msg = b' ' * size
+
+ watch = zmq.Stopwatch()
+
+ block = zmq.NOBLOCK if poll else 0
+ time.sleep(1)
+ watch.start()
+
+ for i in range (0, count):
+ if poll:
+ res = p.poll()
+ assert(res[0][1] & zmq.POLLOUT)
+ s.send(msg, block, copy=copy)
+
+ if poll:
+ res = p.poll()
+ assert(res[0][1] & zmq.POLLIN)
+ msg = s.recv(block, copy=copy)
+
+ assert len(msg) == size
+
+ elapsed = watch.stop()
+
+ s.send(b'done')
+
+ latency = elapsed / (count * 2.)
+
+ print ("message size : %8i [B]" % (size, ))
+ print ("roundtrip count: %8i [msgs]" % (count, ))
+ print ("mean latency : %12.3f [µs]" % (latency, ))
+ print ("test time : %12.3f [s]" % (elapsed * 1e-6, ))
+
+def pusher(url, count, size, copy, poll):
+ """send a bunch of messages on a PUSH socket"""
+ ctx = zmq.Context()
+ s = ctx.socket(zmq.PUSH)
+
+ # Add your socket options here.
+ # For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
+
+ if poll:
+ p = zmq.Poller()
+ p.register(s)
+
+ s.connect(url)
+
+ msg = zmq.Message(b' ' * size)
+ block = zmq.NOBLOCK if poll else 0
+
+ for i in range(count):
+ if poll:
+ res = p.poll()
+ assert(res[0][1] & zmq.POLLOUT)
+ s.send(msg, block, copy=copy)
+
+ s.close()
+ ctx.term()
+
+def throughput(url, count, size, poll, copy):
+ """recv a bunch of messages on a PULL socket
+
+ Should be started before `pusher`
+ """
+ ctx = zmq.Context()
+ s = ctx.socket(zmq.PULL)
+
+ # Add your socket options here.
+ # For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
+
+ if poll:
+ p = zmq.Poller()
+ p.register(s)
+
+ s.bind(url)
+
+ watch = zmq.Stopwatch()
+ block = zmq.NOBLOCK if poll else 0
+
+ # Wait for the other side to connect.
+ msg = s.recv()
+ assert len (msg) == size
+
+ watch.start()
+ for i in range (count-1):
+ if poll:
+ res = p.poll()
+ msg = s.recv(block, copy=copy)
+ elapsed = watch.stop()
+ if elapsed == 0:
+ elapsed = 1
+
+ throughput = (1e6 * float(count)) / float(elapsed)
+ megabits = float(throughput * size * 8) / 1e6
+
+ print ("message size : %8i [B]" % (size, ))
+ print ("message count : %8i [msgs]" % (count, ))
+ print ("mean throughput: %8.0f [msg/s]" % (throughput, ))
+ print ("mean throughput: %12.3f [Mb/s]" % (megabits, ))
+ print ("test time : %12.3f [s]" % (elapsed * 1e-6, ))
+
+
+def main():
+ args = parse_args()
+ tic = time.time()
+ if args.test == 'lat':
+ bg = Process(target=latency_echo, args=(args.url, args.count, args.poll, args.copy))
+ bg.start()
+ latency(args.url, args.count, args.size, args.poll, args.copy)
+ elif args.test == 'thr':
+ bg = Process(target=throughput, args=(args.url, args.count, args.size, args.poll, args.copy))
+ bg.start()
+ pusher(args.url, args.count, args.size, args.poll, args.copy)
+ bg.join()
+ toc = time.time()
+ if (toc - tic) < 3:
+ print ("For best results, tests should take at least a few seconds.")
+
+if __name__ == '__main__':
+ main()
diff --git a/external_libs/python/pyzmq-14.7.0/setup.cfg.android b/external_libs/python/pyzmq-14.7.0/setup.cfg.android
new file mode 100644
index 00000000..8b635ad3
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/setup.cfg.android
@@ -0,0 +1,17 @@
+[global]
+# the prefix with which libzmq was configured / installed
+zmq_prefix = /tmp/zeromq-android
+have_sys_un_h = False
+
+[build_ext]
+libraries = python2.6
+# path to your python-for-android
+# the result of:
+# wget http://python-for-android.googlecode.com/files/python-lib_r16.zip
+# unzip python-lib_r16.zip -dpython-lib
+library_dirs = ../python-lib/lib/
+include_dirs = ../python-lib/include/python2.6
+
+[bdist_egg]
+plat-name = linux-armv
+
diff --git a/external_libs/python/pyzmq-14.7.0/setup.cfg.template b/external_libs/python/pyzmq-14.7.0/setup.cfg.template
new file mode 100644
index 00000000..e81a3dc4
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/setup.cfg.template
@@ -0,0 +1,12 @@
+[global]
+# zmq_prefix = /usr/local # (adds zmq_prefix/include to include_dirs and zmq_prefix/lib to library_dirs)
+# have_sys_un_h = False # does sys/un.h exist? pyzmq will try to detect it, but you can override
+# skip_check_zmq = True # skip checking zmq verson (if it doesn't work for some reason)
+# libzmq_extension = True # force building libzmq as an extension (same as --zmq=bundled)
+# no_libzmq_extension = True # prevent fallback on building libzmq as an extension if regular build fails
+[build_ext]
+
+# Edit these to add any paths you need to include (e.g. where libzmq is defined)
+library_dirs = /usr/local/lib
+include_dirs = /usr/local/include
+
diff --git a/external_libs/python/pyzmq-14.7.0/setup.py b/external_libs/python/pyzmq-14.7.0/setup.py
new file mode 100644
index 00000000..ae403079
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/setup.py
@@ -0,0 +1,1237 @@
+#!/usr/bin/env python
+#-----------------------------------------------------------------------------
+# Copyright (C) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+#
+# The `configure` subcommand is copied and adaped from h5py
+# h5py source used under the New BSD license
+#
+# h5py: <http://code.google.com/p/h5py/>
+#
+# The code to bundle libzmq as an Extension is from pyzmq-static
+# pyzmq-static source used under the New BSD license
+#
+# pyzmq-static: <https://github.com/brandon-rhodes/pyzmq-static>
+#-----------------------------------------------------------------------------
+
+from __future__ import with_statement, print_function
+
+import copy
+import os
+import shutil
+import subprocess
+import sys
+import time
+import errno
+import platform
+from traceback import print_exc
+
+# whether any kind of bdist is happening
+# do this before importing anything from distutils
+doing_bdist = any(arg.startswith('bdist') for arg in sys.argv[1:])
+
+if doing_bdist:
+ try:
+ import setuptools
+ except Exception:
+ warn("doing a bdist, but setuptools is unavailable")
+
+import distutils
+from distutils.core import setup, Command
+from distutils.ccompiler import get_default_compiler
+from distutils.ccompiler import new_compiler
+from distutils.extension import Extension
+from distutils.command.build_ext import build_ext
+from distutils.command.sdist import sdist
+from distutils.version import LooseVersion as V
+
+from unittest import TextTestRunner, TestLoader
+from glob import glob
+from os.path import splitext, basename, join as pjoin
+
+from subprocess import Popen, PIPE
+
+try:
+ import nose
+except ImportError:
+ nose = None
+
+# local script imports:
+from buildutils import (
+ discover_settings, v_str, save_config, detect_zmq, merge,
+ config_from_prefix,
+ info, warn, fatal, debug, line, copy_and_patch_libzmq, localpath,
+ fetch_libsodium, stage_libsodium_headers, fetch_libzmq, stage_platform_hpp,
+ bundled_version, customize_mingw,
+ compile_and_run,
+ patch_lib_paths,
+ )
+
+#-----------------------------------------------------------------------------
+# Flags
+#-----------------------------------------------------------------------------
+
+pypy = 'PyPy' in sys.version
+
+# reference points for zmq compatibility
+min_zmq = (2,1,4)
+target_zmq = bundled_version
+dev_zmq = (target_zmq[0], target_zmq[1] + 1, 0)
+
+# set dylib ext:
+if sys.platform.startswith('win'):
+ lib_ext = '.dll'
+elif sys.platform == 'darwin':
+ lib_ext = '.dylib'
+else:
+ lib_ext = '.so'
+
+# allow `--zmq=foo` to be passed at any point,
+# but always assign it to configure
+
+configure_idx = -1
+fetch_idx = -1
+for idx, arg in enumerate(list(sys.argv)):
+ # track index of configure and fetch_libzmq
+ if arg == 'configure':
+ configure_idx = idx
+ elif arg == 'fetch_libzmq':
+ fetch_idx = idx
+
+ if arg.startswith('--zmq='):
+ sys.argv.pop(idx)
+ if configure_idx < 0:
+ if fetch_idx < 0:
+ configure_idx = 1
+ else:
+ configure_idx = fetch_idx + 1
+ sys.argv.insert(configure_idx, 'configure')
+ sys.argv.insert(configure_idx + 1, arg)
+ break
+
+#-----------------------------------------------------------------------------
+# Configuration (adapted from h5py: http://h5py.googlecode.com)
+#-----------------------------------------------------------------------------
+
+# --- compiler settings -------------------------------------------------
+
+def bundled_settings(debug):
+ """settings for linking extensions against bundled libzmq"""
+ settings = {}
+ settings['libraries'] = []
+ settings['library_dirs'] = []
+ settings['include_dirs'] = [pjoin("bundled", "zeromq", "include")]
+ settings['runtime_library_dirs'] = []
+ # add pthread on freebsd
+ # is this necessary?
+ if sys.platform.startswith('freebsd'):
+ settings['libraries'].append('pthread')
+ elif sys.platform.startswith('win'):
+ # link against libzmq in build dir:
+ plat = distutils.util.get_platform()
+ temp = 'temp.%s-%i.%i' % (plat, sys.version_info[0], sys.version_info[1])
+ suffix = ''
+ if sys.version_info >= (3,5):
+ # Python 3.5 adds EXT_SUFFIX to libs
+ ext_suffix = distutils.sysconfig.get_config_var('EXT_SUFFIX')
+ suffix = os.path.splitext(ext_suffix)[0]
+
+
+ if debug:
+ suffix = '_d' + suffix
+ release = 'Debug'
+ else:
+ release = 'Release'
+
+ settings['libraries'].append('libzmq' + suffix)
+ settings['library_dirs'].append(pjoin('build', temp, release, 'buildutils'))
+
+ return settings
+
+
+def settings_from_prefix(prefix=None, bundle_libzmq_dylib=False):
+ """load appropriate library/include settings from ZMQ prefix"""
+ settings = {}
+ settings['libraries'] = []
+ settings['include_dirs'] = []
+ settings['library_dirs'] = []
+ settings['runtime_library_dirs'] = []
+ settings['extra_link_args'] = []
+
+ if sys.platform.startswith('win'):
+ settings['libraries'].append('libzmq')
+
+ if prefix:
+ settings['include_dirs'] += [pjoin(prefix, 'include')]
+ settings['library_dirs'] += [pjoin(prefix, 'lib')]
+ else:
+
+ # If prefix is not explicitly set, pull it from pkg-config by default.
+
+ if not prefix:
+ try:
+ p = Popen('pkg-config --variable=prefix --print-errors libzmq'.split(), stdout=PIPE, stderr=PIPE)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ info("pkg-config not found")
+ else:
+ warn("Running pkg-config failed - %s." % e)
+ p = None
+ if p is not None:
+ if p.wait():
+ info("Did not find libzmq via pkg-config:")
+ info(p.stderr.read().decode())
+ else:
+ prefix = p.stdout.readline().strip().decode()
+ info("Using zmq-prefix %s (found via pkg-config)." % prefix)
+
+ settings['libraries'].append('zmq')
+ # add pthread on freebsd
+ if sys.platform.startswith('freebsd'):
+ settings['libraries'].append('pthread')
+
+ if sys.platform.startswith('sunos'):
+ if platform.architecture()[0] == '32bit':
+ settings['extra_link_args'] += ['-m32']
+ else:
+ settings['extra_link_args'] += ['-m64']
+
+ if prefix:
+ settings['include_dirs'] += [pjoin(prefix, 'include')]
+ if not bundle_libzmq_dylib:
+ if sys.platform.startswith('sunos') and platform.architecture()[0] == '64bit':
+ settings['library_dirs'] += [pjoin(prefix, 'lib/amd64')]
+ settings['library_dirs'] += [pjoin(prefix, 'lib')]
+ else:
+ if sys.platform == 'darwin' and os.path.isdir('/opt/local/lib'):
+ # allow macports default
+ settings['include_dirs'] += ['/opt/local/include']
+ settings['library_dirs'] += ['/opt/local/lib']
+ if os.environ.get('VIRTUAL_ENV', None):
+ # find libzmq installed in virtualenv
+ env = os.environ['VIRTUAL_ENV']
+ settings['include_dirs'] += [pjoin(env, 'include')]
+ settings['library_dirs'] += [pjoin(env, 'lib')]
+
+ if bundle_libzmq_dylib:
+ # bdist should link against bundled libzmq
+ settings['library_dirs'].append('zmq')
+ if sys.platform == 'darwin':
+ pass
+ # unused rpath args for OS X:
+ # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/..']
+ else:
+ settings['runtime_library_dirs'] += ['$ORIGIN/..']
+ elif sys.platform != 'darwin':
+ settings['runtime_library_dirs'] += [
+ os.path.abspath(x) for x in settings['library_dirs']
+ ]
+
+ return settings
+
+
+#-----------------------------------------------------------------------------
+# Extra commands
+#-----------------------------------------------------------------------------
+
+class Configure(build_ext):
+ """Configure command adapted from h5py"""
+
+ description = "Discover ZMQ version and features"
+
+ user_options = build_ext.user_options + [
+ ('zmq=', None, "libzmq install prefix"),
+ ('build-base=', 'b', "base directory for build library"), # build_base from build
+
+ ]
+ def initialize_options(self):
+ build_ext.initialize_options(self)
+ self.zmq = None
+ self.build_base = 'build'
+
+ # DON'T REMOVE: distutils demands these be here even if they do nothing.
+ def finalize_options(self):
+ build_ext.finalize_options(self)
+ self.tempdir = pjoin(self.build_temp, 'scratch')
+ self.has_run = False
+ self.config = discover_settings(self.build_base)
+ if self.zmq is not None:
+ merge(self.config, config_from_prefix(self.zmq))
+ self.init_settings_from_config()
+
+ def save_config(self, name, cfg):
+ """write config to JSON"""
+ save_config(name, cfg, self.build_base)
+ # write to zmq.utils.[name].json
+ save_config(name, cfg, os.path.join('zmq', 'utils'))
+ # also write to build_lib, because we might be run after copying to
+ # build_lib has already happened.
+ build_lib_utils = os.path.join(self.build_lib, 'zmq', 'utils')
+ if os.path.exists(build_lib_utils):
+ save_config(name, cfg, build_lib_utils)
+
+ def init_settings_from_config(self):
+ """set up compiler settings, based on config"""
+ cfg = self.config
+
+ if cfg['libzmq_extension']:
+ settings = bundled_settings(self.debug)
+ else:
+ settings = settings_from_prefix(cfg['zmq_prefix'], self.bundle_libzmq_dylib)
+
+ if 'have_sys_un_h' not in cfg:
+ # don't link against anything when checking for sys/un.h
+ minus_zmq = copy.deepcopy(settings)
+ try:
+ minus_zmq['libraries'] = []
+ except Exception:
+ pass
+ try:
+ compile_and_run(self.tempdir,
+ pjoin('buildutils', 'check_sys_un.c'),
+ **minus_zmq
+ )
+ except Exception as e:
+ warn("No sys/un.h, IPC_PATH_MAX_LEN will be undefined: %s" % e)
+ cfg['have_sys_un_h'] = False
+ else:
+ cfg['have_sys_un_h'] = True
+
+ self.save_config('config', cfg)
+
+ if cfg['have_sys_un_h']:
+ settings['define_macros'] = [('HAVE_SYS_UN_H', 1)]
+
+ settings.setdefault('define_macros', [])
+
+ # include internal directories
+ settings.setdefault('include_dirs', [])
+ settings['include_dirs'] += [pjoin('zmq', sub) for sub in (
+ 'utils',
+ pjoin('backend', 'cython'),
+ 'devices',
+ )]
+ if sys.platform.startswith('win') and sys.version_info < (3, 3):
+ settings['include_dirs'].insert(0, pjoin('buildutils', 'include_win32'))
+
+ for ext in self.distribution.ext_modules:
+ if ext.name.startswith('zmq.lib'):
+ continue
+ for attr, value in settings.items():
+ setattr(ext, attr, value)
+
+ self.compiler_settings = settings
+ self.save_config('compiler', settings)
+
+ def create_tempdir(self):
+ self.erase_tempdir()
+ os.makedirs(self.tempdir)
+ if sys.platform.startswith('win'):
+ # fetch libzmq.dll into local dir
+ local_dll = pjoin(self.tempdir, 'libzmq.dll')
+ if not self.config['zmq_prefix'] and not os.path.exists(local_dll):
+ fatal("ZMQ directory must be specified on Windows via setup.cfg"
+ " or 'python setup.py configure --zmq=/path/to/zeromq2'")
+
+ try:
+ shutil.copy(pjoin(self.config['zmq_prefix'], 'lib', 'libzmq.dll'), local_dll)
+ except Exception:
+ if not os.path.exists(local_dll):
+ warn("Could not copy libzmq into zmq/, which is usually necessary on Windows."
+ "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy "
+ "libzmq into zmq/ manually.")
+
+ def erase_tempdir(self):
+ try:
+ shutil.rmtree(self.tempdir)
+ except Exception:
+ pass
+
+ @property
+ def compiler_type(self):
+ compiler = self.compiler
+ if compiler is None:
+ return get_default_compiler()
+ elif isinstance(compiler, str):
+ return compiler
+ else:
+ return compiler.compiler_type
+
+ @property
+ def cross_compiling(self):
+ return self.config['bdist_egg'].get('plat-name', sys.platform) != sys.platform
+
+ @property
+ def bundle_libzmq_dylib(self):
+ """
+ bundle_libzmq_dylib flag for whether external libzmq library will be included in pyzmq:
+ only relevant when not building libzmq extension
+ """
+ if 'bundle_libzmq_dylib' in self.config:
+ return self.config['bundle_libzmq_dylib']
+ elif (sys.platform.startswith('win') or self.cross_compiling) \
+ and not self.config['libzmq_extension']:
+ # always bundle libzmq on Windows and cross-compilation
+ return True
+ else:
+ return False
+
+ def check_zmq_version(self):
+ """check the zmq version"""
+ cfg = self.config
+
+ # build test program
+ zmq_prefix = self.config['zmq_prefix']
+ detected = self.test_build(zmq_prefix, self.compiler_settings)
+ # now check the libzmq version
+
+ vers = tuple(detected['vers'])
+ vs = v_str(vers)
+ if vers < min_zmq:
+ fatal("Detected ZMQ version: %s, but depend on ZMQ >= %s"%(
+ vs, v_str(min_zmq))
+ +'\n Using ZMQ=%s' % (zmq_prefix or 'unspecified'))
+
+ if vers < target_zmq:
+ warn("Detected ZMQ version: %s, but pyzmq targets ZMQ %s." % (
+ vs, v_str(target_zmq))
+ )
+ warn("libzmq features and fixes introduced after %s will be unavailable." % vs)
+ line()
+ elif vers >= dev_zmq:
+ warn("Detected ZMQ version: %s. Some new features in libzmq may not be exposed by pyzmq." % vs)
+ line()
+
+ if sys.platform.startswith('win'):
+ # fetch libzmq.dll into local dir
+ local_dll = localpath('zmq','libzmq.dll')
+ if not zmq_prefix and not os.path.exists(local_dll):
+ fatal("ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'")
+ try:
+ shutil.copy(pjoin(zmq_prefix, 'lib', 'libzmq.dll'), local_dll)
+ except Exception:
+ if not os.path.exists(local_dll):
+ warn("Could not copy libzmq into zmq/, which is usually necessary on Windows."
+ "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy "
+ "libzmq into zmq/ manually.")
+
+ def bundle_libsodium_extension(self, libzmq):
+ bundledir = "bundled"
+ ext_modules = self.distribution.ext_modules
+ if ext_modules and any(m.name == 'zmq.libsodium' for m in ext_modules):
+ # I've already been run
+ return
+
+ if not os.path.exists(bundledir):
+ os.makedirs(bundledir)
+
+ line()
+ info("Using bundled libsodium")
+
+ # fetch sources for libsodium
+ fetch_libsodium(bundledir)
+
+ # stage headers
+ stage_libsodium_headers(pjoin(bundledir, 'libsodium'))
+
+ # construct the Extension
+ libsodium_src = pjoin(bundledir, 'libsodium', 'src', 'libsodium')
+ exclude = pjoin(libsodium_src, 'crypto_stream', 'salsa20', 'amd64_xmm6') # or ref?
+ exclude = pjoin(libsodium_src, 'crypto_scalarmult', 'curve25519', 'donna_c64') # or ref?
+
+ libsodium_sources = [pjoin('buildutils', 'initlibsodium.c')]
+
+ for dir,subdirs,files in os.walk(libsodium_src):
+ if dir.startswith(exclude):
+ continue
+ for f in files:
+ if f.endswith('.c'):
+ libsodium_sources.append(pjoin(dir, f))
+
+ libsodium = Extension(
+ 'zmq.libsodium',
+ sources = libsodium_sources,
+ include_dirs = [
+ pjoin(libsodium_src, 'include'),
+ pjoin(libsodium_src, 'include', 'sodium'),
+ ],
+ )
+ # There are a few extra things we need to do to build libsodium on
+ # Windows:
+ # 1) tell libsodium to export its symbols;
+ # 2) prevent libsodium from defining C99 `static inline` functions
+ # which aren't parsed correctly by VS2008 nor VS2010;
+ # 3) provide an implementation of <stdint.h> which is not provided in
+ # VS2008's "standard" library;
+ # 4) link against Microsoft's s crypto API.
+ if sys.platform.startswith('win'):
+ libsodium.define_macros.append(('SODIUM_DLL_EXPORT', 1))
+ libsodium.define_macros.append(('inline', ''))
+ if sys.version_info < (3, 3):
+ libsodium.include_dirs.append(pjoin('buildutils', 'include_win32'))
+ libsodium.libraries.append('advapi32')
+ # register the Extension
+ self.distribution.ext_modules.insert(0, libsodium)
+
+ if sys.byteorder == 'little':
+ libsodium.define_macros.append(("NATIVE_LITTLE_ENDIAN", 1))
+ else:
+ libsodium.define_macros.append(("NATIVE_BIG_ENDIAN", 1))
+
+ # tell libzmq about libsodium
+ libzmq.define_macros.append(("HAVE_LIBSODIUM", 1))
+ libzmq.include_dirs.extend(libsodium.include_dirs)
+
+ def bundle_libzmq_extension(self):
+ bundledir = "bundled"
+ ext_modules = self.distribution.ext_modules
+ if ext_modules and any(m.name == 'zmq.libzmq' for m in ext_modules):
+ # I've already been run
+ return
+
+ line()
+ info("Using bundled libzmq")
+
+ # fetch sources for libzmq extension:
+ if not os.path.exists(bundledir):
+ os.makedirs(bundledir)
+
+ fetch_libzmq(bundledir)
+
+ stage_platform_hpp(pjoin(bundledir, 'zeromq'))
+
+ # construct the Extensions:
+ libzmq = Extension(
+ 'zmq.libzmq',
+ sources = [pjoin('buildutils', 'initlibzmq.c')] +
+ glob(pjoin(bundledir, 'zeromq', 'src', '*.cpp')),
+ include_dirs = [
+ pjoin(bundledir, 'zeromq', 'include'),
+ ],
+ )
+
+ # register the extension:
+ self.distribution.ext_modules.insert(0, libzmq)
+
+ # select polling subsystem based on platform
+ if sys.platform == 'darwin' or 'bsd' in sys.platform:
+ libzmq.define_macros.append(('ZMQ_USE_KQUEUE', 1))
+ elif 'linux' in sys.platform:
+ libzmq.define_macros.append(('ZMQ_USE_EPOLL', 1))
+ elif sys.platform.startswith('win'):
+ libzmq.define_macros.append(('ZMQ_USE_SELECT', 1))
+ else:
+ # this may not be sufficiently precise
+ libzmq.define_macros.append(('ZMQ_USE_POLL', 1))
+
+ if sys.platform.startswith('win'):
+ # include defines from zeromq msvc project:
+ libzmq.define_macros.append(('FD_SETSIZE', 1024))
+ libzmq.define_macros.append(('DLL_EXPORT', 1))
+ libzmq.define_macros.append(('_CRT_SECURE_NO_WARNINGS', 1))
+
+ # When compiling the C++ code inside of libzmq itself, we want to
+ # avoid "warning C4530: C++ exception handler used, but unwind
+ # semantics are not enabled. Specify /EHsc".
+ if self.compiler_type == 'msvc':
+ libzmq.extra_compile_args.append('/EHsc')
+ elif self.compiler_type == 'mingw32':
+ libzmq.define_macros.append(('ZMQ_HAVE_MINGW32', 1))
+
+ # And things like sockets come from libraries that must be named.
+ libzmq.libraries.extend(['rpcrt4', 'ws2_32', 'advapi32'])
+
+ # link against libsodium in build dir:
+ suffix = ''
+ if sys.version_info >= (3,5):
+ # Python 3.5 adds EXT_SUFFIX to libs
+ ext_suffix = distutils.sysconfig.get_config_var('EXT_SUFFIX')
+ suffix = os.path.splitext(ext_suffix)[0]
+ if self.debug:
+ suffix = '_d' + suffix
+ libzmq.libraries.append('libsodium' + suffix)
+ libzmq.library_dirs.append(pjoin(self.build_temp, 'buildutils'))
+
+ else:
+ libzmq.include_dirs.append(bundledir)
+
+ # check if we need to link against Realtime Extensions library
+ cc = new_compiler(compiler=self.compiler_type)
+ cc.output_dir = self.build_temp
+ if not sys.platform.startswith(('darwin', 'freebsd')):
+ line()
+ info("checking for timer_create")
+ if not cc.has_function('timer_create'):
+ info("no timer_create, linking librt")
+ libzmq.libraries.append('rt')
+ else:
+ info("ok")
+
+ if pypy:
+ # seem to need explicit libstdc++ on linux + pypy
+ # not sure why
+ libzmq.libraries.append("stdc++")
+
+ # Also bundle libsodium, even on Windows.
+ self.bundle_libsodium_extension(libzmq)
+
+ # update other extensions, with bundled settings
+ self.config['libzmq_extension'] = True
+ self.init_settings_from_config()
+ self.save_config('config', self.config)
+
+
+ def fallback_on_bundled(self):
+ """Couldn't build, fallback after waiting a while"""
+
+ line()
+
+ warn('\n'.join([
+ "Failed to build or run libzmq detection test.",
+ "",
+ "If you expected pyzmq to link against an installed libzmq, please check to make sure:",
+ "",
+ " * You have a C compiler installed",
+ " * A development version of Python is installed (including headers)",
+ " * A development version of ZMQ >= %s is installed (including headers)" % v_str(min_zmq),
+ " * If ZMQ is not in a default location, supply the argument --zmq=<path>",
+ " * If you did recently install ZMQ to a default location,",
+ " try rebuilding the ld cache with `sudo ldconfig`",
+ " or specify zmq's location with `--zmq=/usr/local`",
+ "",
+ ]))
+
+ info('\n'.join([
+ "You can skip all this detection/waiting nonsense if you know",
+ "you want pyzmq to bundle libzmq as an extension by passing:",
+ "",
+ " `--zmq=bundled`",
+ "",
+ "I will now try to build libzmq as a Python extension",
+ "unless you interrupt me (^C) in the next 10 seconds...",
+ "",
+ ]))
+
+ for i in range(10,0,-1):
+ sys.stdout.write('\r%2i...' % i)
+ sys.stdout.flush()
+ time.sleep(1)
+
+ info("")
+
+ return self.bundle_libzmq_extension()
+
+
+ def test_build(self, prefix, settings):
+ """do a test build ob libzmq"""
+ self.create_tempdir()
+ settings = settings.copy()
+ if self.bundle_libzmq_dylib and not sys.platform.startswith('win'):
+ # rpath slightly differently here, because libzmq not in .. but ../zmq:
+ settings['library_dirs'] = ['zmq']
+ if sys.platform == 'darwin':
+ pass
+ # unused rpath args for OS X:
+ # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/../zmq']
+ else:
+ settings['runtime_library_dirs'] = [ os.path.abspath(pjoin('.', 'zmq')) ]
+
+ line()
+ info("Configure: Autodetecting ZMQ settings...")
+ info(" Custom ZMQ dir: %s" % prefix)
+ try:
+ detected = detect_zmq(self.tempdir, compiler=self.compiler_type, **settings)
+ finally:
+ self.erase_tempdir()
+
+ info(" ZMQ version detected: %s" % v_str(detected['vers']))
+
+ return detected
+
+
+ def finish_run(self):
+ self.save_config('config', self.config)
+ line()
+
+ def run(self):
+ cfg = self.config
+
+ if cfg['libzmq_extension']:
+ self.bundle_libzmq_extension()
+ self.finish_run()
+ return
+
+ # When cross-compiling and zmq is given explicitly, we can't testbuild
+ # (as we can't testrun the binary), we assume things are alright.
+ if cfg['skip_check_zmq'] or self.cross_compiling:
+ warn("Skipping zmq version check")
+ self.finish_run()
+ return
+
+ zmq_prefix = cfg['zmq_prefix']
+ # There is no available default on Windows, so start with fallback unless
+ # zmq was given explicitly, or libzmq extension was explicitly prohibited.
+ if sys.platform.startswith("win") and \
+ not cfg['no_libzmq_extension'] and \
+ not zmq_prefix:
+ self.fallback_on_bundled()
+ self.finish_run()
+ return
+
+ if zmq_prefix and self.bundle_libzmq_dylib and not sys.platform.startswith('win'):
+ copy_and_patch_libzmq(zmq_prefix, 'libzmq'+lib_ext)
+
+ # first try with given config or defaults
+ try:
+ self.check_zmq_version()
+ except Exception as e:
+ # print the error as distutils would if we let it raise:
+ info("\nerror: %s\n" % e)
+ else:
+ self.finish_run()
+ return
+
+ # try fallback on /usr/local on *ix if no prefix is given
+ if not zmq_prefix and not sys.platform.startswith('win'):
+ info("Failed with default libzmq, trying again with /usr/local")
+ time.sleep(1)
+ zmq_prefix = cfg['zmq_prefix'] = '/usr/local'
+ self.init_settings_from_config()
+ try:
+ self.check_zmq_version()
+ except Exception as e:
+ # print the error as distutils would if we let it raise:
+ info("\nerror: %s\n" % e)
+ else:
+ # if we get here the second run succeeded, so we need to update compiler
+ # settings for the extensions with /usr/local prefix
+ self.finish_run()
+ return
+
+ # finally, fallback on bundled
+
+ if cfg['no_libzmq_extension']:
+ fatal("Falling back on bundled libzmq,"
+ " but setup.cfg has explicitly prohibited building the libzmq extension."
+ )
+
+ self.fallback_on_bundled()
+
+ self.finish_run()
+
+
+class FetchCommand(Command):
+ """Fetch libzmq sources, that's it."""
+
+ description = "Fetch libzmq sources into bundled/zeromq"
+
+ user_options = [ ]
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ # fetch sources for libzmq extension:
+ bundledir = "bundled"
+ if os.path.exists(bundledir):
+ info("Scrubbing directory: %s" % bundledir)
+ shutil.rmtree(bundledir)
+ if not os.path.exists(bundledir):
+ os.makedirs(bundledir)
+ fetch_libsodium(bundledir)
+ fetch_libzmq(bundledir)
+ for tarball in glob(pjoin(bundledir, '*.tar.gz')):
+ os.remove(tarball)
+
+
+
+class TestCommand(Command):
+ """Custom distutils command to run the test suite."""
+
+ description = "Test PyZMQ (must have been built inplace: `setup.py build_ext --inplace`)"
+
+ user_options = [ ]
+
+ def initialize_options(self):
+ self._dir = os.getcwd()
+
+ def finalize_options(self):
+ pass
+
+ def run_nose(self):
+ """Run the test suite with nose."""
+ nose = 'nose.__main__' if sys.version_info < (2,7) else 'nose'
+ if subprocess.call([sys.executable, '-m', nose, '-vvx', pjoin(self._dir, 'zmq', 'tests')]):
+ sys.exit(1)
+
+ def run_unittest(self):
+ """Finds all the tests modules in zmq/tests/ and runs them."""
+ testfiles = [ ]
+ for t in glob(pjoin(self._dir, 'zmq', 'tests', '*.py')):
+ name = splitext(basename(t))[0]
+ if name.startswith('test_'):
+ testfiles.append('.'.join(
+ ['zmq.tests', name])
+ )
+ tests = TestLoader().loadTestsFromNames(testfiles)
+ t = TextTestRunner(verbosity = 2)
+ t.run(tests)
+
+ def run(self):
+ """Run the test suite, with nose, or unittest if nose is unavailable"""
+ # crude check for inplace build:
+ try:
+ import zmq
+ except ImportError:
+ print_exc()
+ fatal('\n '.join(["Could not import zmq!",
+ "You must build pyzmq with 'python setup.py build_ext --inplace' for 'python setup.py test' to work.",
+ "If you did build pyzmq in-place, then this is a real error."]))
+ sys.exit(1)
+
+ info("Testing pyzmq-%s with libzmq-%s" % (zmq.pyzmq_version(), zmq.zmq_version()))
+
+ if nose is None:
+ warn("nose unavailable, falling back on unittest. Skipped tests will appear as ERRORs.")
+ return self.run_unittest()
+ else:
+ return self.run_nose()
+
+class GitRevisionCommand(Command):
+ """find the current git revision and add it to zmq.sugar.version.__revision__"""
+
+ description = "Store current git revision in version.py"
+
+ user_options = [ ]
+
+ def initialize_options(self):
+ self.version_py = pjoin('zmq','sugar','version.py')
+
+ def run(self):
+ try:
+ p = Popen('git log -1'.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ except IOError:
+ warn("No git found, skipping git revision")
+ return
+
+ if p.wait():
+ warn("checking git branch failed")
+ info(p.stderr.read())
+ return
+
+ line = p.stdout.readline().decode().strip()
+ if not line.startswith('commit'):
+ warn("bad commit line: %r" % line)
+ return
+
+ rev = line.split()[-1]
+
+ # now that we have the git revision, we can apply it to version.py
+ with open(self.version_py) as f:
+ lines = f.readlines()
+
+ for i,line in enumerate(lines):
+ if line.startswith('__revision__'):
+ lines[i] = "__revision__ = '%s'\n"%rev
+ break
+ with open(self.version_py, 'w') as f:
+ f.writelines(lines)
+
+ def finalize_options(self):
+ pass
+
+class CleanCommand(Command):
+ """Custom distutils command to clean the .so and .pyc files."""
+ user_options = [('all', 'a',
+ "remove all build output, not just temporary by-products")
+ ]
+
+ boolean_options = ['all']
+
+ def initialize_options(self):
+ self.all = None
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ _clean_me = []
+ _clean_trees = []
+
+ for d in ('build', 'dist', 'conf'):
+ if os.path.exists(d):
+ _clean_trees.append(d)
+
+ for root, dirs, files in os.walk('buildutils'):
+ if any(root.startswith(pre) for pre in _clean_trees):
+ continue
+ for f in files:
+ if os.path.splitext(f)[-1] == '.pyc':
+ _clean_me.append(pjoin(root, f))
+
+ if '__pycache__' in dirs:
+ _clean_trees.append(pjoin(root, '__pycache__'))
+
+ for root, dirs, files in os.walk('zmq'):
+ if any(root.startswith(pre) for pre in _clean_trees):
+ continue
+
+ for f in files:
+ if os.path.splitext(f)[-1] in ('.pyc', '.so', '.o', '.pyd', '.json'):
+ _clean_me.append(pjoin(root, f))
+
+ for d in dirs:
+ if d == '__pycache__':
+ _clean_trees.append(pjoin(root, d))
+
+ # remove generated cython files
+ if self.all:
+ for root, dirs, files in os.walk(pjoin('zmq', 'backend', 'cython')):
+ if os.path.splitext(f)[-1] == '.c':
+ _clean_me.append(pjoin(root, f))
+
+ bundled = glob(pjoin('zmq', 'libzmq*'))
+ _clean_me.extend([ b for b in bundled if b not in _clean_me ])
+
+ for clean_me in _clean_me:
+ print("removing %s" % clean_me)
+ try:
+ os.unlink(clean_me)
+ except Exception as e:
+ print(e, file=sys.stderr)
+ for clean_tree in _clean_trees:
+ print("removing %s/" % clean_tree)
+ try:
+ shutil.rmtree(clean_tree)
+ except Exception as e:
+ print(e, file=sys.stderr)
+
+
+class CheckSDist(sdist):
+ """Custom sdist that ensures Cython has compiled all pyx files to c."""
+
+ def initialize_options(self):
+ sdist.initialize_options(self)
+ self._pyxfiles = []
+ for root, dirs, files in os.walk('zmq'):
+ for f in files:
+ if f.endswith('.pyx'):
+ self._pyxfiles.append(pjoin(root, f))
+ def run(self):
+ self.run_command('fetch_libzmq')
+ if 'cython' in cmdclass:
+ self.run_command('cython')
+ else:
+ for pyxfile in self._pyxfiles:
+ cfile = pyxfile[:-3]+'c'
+ msg = "C-source file '%s' not found."%(cfile)+\
+ " Run 'setup.py cython' before sdist."
+ assert os.path.isfile(cfile), msg
+ sdist.run(self)
+
+class CheckingBuildExt(build_ext):
+ """Subclass build_ext to get clearer report if Cython is necessary."""
+
+ def check_cython_extensions(self, extensions):
+ for ext in extensions:
+ for src in ext.sources:
+ if not os.path.exists(src):
+ fatal("""Cython-generated file '%s' not found.
+ Cython >= 0.16 is required to compile pyzmq from a development branch.
+ Please install Cython or download a release package of pyzmq.
+ """%src)
+
+ def build_extensions(self):
+ self.check_cython_extensions(self.extensions)
+ self.check_extensions_list(self.extensions)
+
+ if self.compiler.compiler_type == 'mingw32':
+ customize_mingw(self.compiler)
+
+ for ext in self.extensions:
+ self.build_extension(ext)
+
+ def build_extension(self, ext):
+ build_ext.build_extension(self, ext)
+ ext_path = self.get_ext_fullpath(ext.name)
+ patch_lib_paths(ext_path, self.compiler.library_dirs)
+
+ def run(self):
+ # check version, to prevent confusing undefined constant errors
+ self.distribution.run_command('configure')
+ build_ext.run(self)
+
+
+class ConstantsCommand(Command):
+ """Rebuild templated files for constants
+
+ To be run after adding new constants to `utils/constant_names`.
+ """
+ user_options = []
+ def initialize_options(self):
+ return
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ from buildutils.constants import render_constants
+ render_constants()
+
+#-----------------------------------------------------------------------------
+# Extensions
+#-----------------------------------------------------------------------------
+
+cmdclass = {'test':TestCommand, 'clean':CleanCommand, 'revision':GitRevisionCommand,
+ 'configure': Configure, 'fetch_libzmq': FetchCommand,
+ 'sdist': CheckSDist, 'constants': ConstantsCommand,
+ }
+
+
+def makename(path, ext):
+ return os.path.abspath(pjoin('zmq', *path)) + ext
+
+pxd = lambda *path: makename(path, '.pxd')
+pxi = lambda *path: makename(path, '.pxi')
+pyx = lambda *path: makename(path, '.pyx')
+dotc = lambda *path: makename(path, '.c')
+
+libzmq = pxd('backend', 'cython', 'libzmq')
+buffers = pxd('utils', 'buffers')
+message = pxd('backend', 'cython', 'message')
+context = pxd('backend', 'cython', 'context')
+socket = pxd('backend', 'cython', 'socket')
+utils = pxd('backend', 'cython', 'utils')
+checkrc = pxd('backend', 'cython', 'checkrc')
+monqueue = pxd('devices', 'monitoredqueue')
+
+submodules = {
+ 'backend.cython' : {'constants': [libzmq, pxi('backend', 'cython', 'constants')],
+ 'error':[libzmq, checkrc],
+ '_poll':[libzmq, socket, context, checkrc],
+ 'utils':[libzmq, utils, checkrc],
+ 'context':[context, libzmq, checkrc],
+ 'message':[libzmq, buffers, message, checkrc],
+ 'socket':[context, message, socket, libzmq, buffers, checkrc],
+ '_device':[libzmq, socket, context, checkrc],
+ '_version':[libzmq],
+ },
+ 'devices' : {
+ 'monitoredqueue':[buffers, libzmq, monqueue, socket, context, checkrc],
+ },
+}
+
+try:
+ import Cython
+ if V(Cython.__version__) < V('0.16'):
+ raise ImportError("Cython >= 0.16 required, found %s" % Cython.__version__)
+ from Cython.Distutils import build_ext as build_ext_c
+ cython=True
+except Exception:
+ cython=False
+ suffix = '.c'
+ cmdclass['build_ext'] = CheckingBuildExt
+
+ class MissingCython(Command):
+
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ try:
+ import Cython
+ except ImportError:
+ warn("Cython is missing")
+ else:
+ cv = getattr(Cython, "__version__", None)
+ if cv is None or V(cv) < V('0.16'):
+ warn(
+ "Cython >= 0.16 is required for compiling Cython sources, "
+ "found: %s" % (cv or "super old")
+ )
+ cmdclass['cython'] = MissingCython
+else:
+
+ suffix = '.pyx'
+
+ class CythonCommand(build_ext_c):
+ """Custom distutils command subclassed from Cython.Distutils.build_ext
+ to compile pyx->c, and stop there. All this does is override the
+ C-compile method build_extension() with a no-op."""
+
+ description = "Compile Cython sources to C"
+
+ def build_extension(self, ext):
+ pass
+
+ class zbuild_ext(build_ext_c):
+
+ def build_extensions(self):
+ if self.compiler.compiler_type == 'mingw32':
+ customize_mingw(self.compiler)
+ return build_ext_c.build_extensions(self)
+
+ def build_extension(self, ext):
+ build_ext_c.build_extension(self, ext)
+ ext_path = self.get_ext_fullpath(ext.name)
+ patch_lib_paths(ext_path, self.compiler.library_dirs)
+
+ def run(self):
+ self.distribution.run_command('configure')
+
+ return build_ext_c.run(self)
+
+ cmdclass['cython'] = CythonCommand
+ cmdclass['build_ext'] = zbuild_ext
+
+extensions = []
+for submod, packages in submodules.items():
+ for pkg in sorted(packages):
+ sources = [pjoin('zmq', submod.replace('.', os.path.sep), pkg+suffix)]
+ if suffix == '.pyx':
+ sources.extend(packages[pkg])
+ ext = Extension(
+ 'zmq.%s.%s'%(submod, pkg),
+ sources = sources,
+ include_dirs=[pjoin('zmq', sub) for sub in ('utils',pjoin('backend', 'cython'),'devices')],
+ )
+ if suffix == '.pyx' and ext.sources[0].endswith('.c'):
+ # undo setuptools stupidly clobbering cython sources:
+ ext.sources = sources
+ extensions.append(ext)
+
+if pypy:
+ # add dummy extension, to ensure build_ext runs
+ dummy_ext = Extension('dummy', sources=[])
+ extensions = [dummy_ext]
+
+ bld_ext = cmdclass['build_ext']
+ class pypy_build_ext(bld_ext):
+ """hack to build pypy extension only after building bundled libzmq
+
+ otherwise it will fail when libzmq is bundled.
+ """
+ def build_extensions(self):
+ self.extensions.remove(dummy_ext)
+ bld_ext.build_extensions(self)
+ # build ffi extension after bundled libzmq,
+ # because it may depend on linking it
+ here = os.getcwd()
+ if self.inplace:
+ sys.path.insert(0, '')
+ else:
+ sys.path.insert(0, self.build_lib)
+ try:
+ from zmq.backend.cffi import ffi
+ except ImportError as e:
+ warn("Couldn't get CFFI extension: %s" % e)
+ else:
+ ext = ffi.verifier.get_extension()
+ if not ext.name.startswith('zmq.'):
+ ext.name = 'zmq.backend.cffi.' + ext.name
+ self.extensions.append(ext)
+ self.build_extension(ext)
+ finally:
+ sys.path.pop(0)
+
+
+ # How many build_ext subclasses is this? 5? Gross.
+ cmdclass['build_ext'] = pypy_build_ext
+
+
+package_data = {'zmq': ['*.pxd'],
+ 'zmq.backend.cython': ['*.pxd'],
+ 'zmq.backend.cffi': ['*.h', '*.c'],
+ 'zmq.devices': ['*.pxd'],
+ 'zmq.utils': ['*.pxd', '*.h', '*.json'],
+}
+
+package_data['zmq'].append('libzmq'+lib_ext)
+
+def extract_version():
+ """extract pyzmq version from sugar/version.py, so it's not multiply defined"""
+ with open(pjoin('zmq', 'sugar', 'version.py')) as f:
+ while True:
+ line = f.readline()
+ if line.startswith('VERSION'):
+ lines = []
+ while line and not line.startswith('def'):
+ lines.append(line)
+ line = f.readline()
+ break
+ ns = {}
+ exec(''.join(lines), ns)
+ return ns['__version__']
+
+def find_packages():
+ """adapted from IPython's setupbase.find_packages()"""
+ packages = []
+ for dir,subdirs,files in os.walk('zmq'):
+ package = dir.replace(os.path.sep, '.')
+ if '__init__.py' not in files:
+ # not a package
+ continue
+ packages.append(package)
+ return packages
+
+#-----------------------------------------------------------------------------
+# Main setup
+#-----------------------------------------------------------------------------
+
+long_desc = \
+"""
+PyZMQ is the official Python binding for the ZeroMQ Messaging Library (http://www.zeromq.org).
+"""
+
+setup_args = dict(
+ name = "pyzmq",
+ version = extract_version(),
+ packages = find_packages(),
+ ext_modules = extensions,
+ package_data = package_data,
+ author = "Brian E. Granger, Min Ragan-Kelley",
+ author_email = "zeromq-dev@lists.zeromq.org",
+ url = 'http://github.com/zeromq/pyzmq',
+ download_url = 'http://github.com/zeromq/pyzmq/releases',
+ description = "Python bindings for 0MQ",
+ long_description = long_desc,
+ license = "LGPL+BSD",
+ cmdclass = cmdclass,
+ classifiers = [
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: Science/Research',
+ 'Intended Audience :: System Administrators',
+ 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
+ 'License :: OSI Approved :: BSD License',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX',
+ 'Topic :: System :: Networking',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.2',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
+ ],
+)
+if 'setuptools' in sys.modules:
+ setup_args['zip_safe'] = False
+ if pypy:
+ setup_args['install_requires'] = [
+ 'py',
+ 'cffi',
+ ]
+
+setup(**setup_args)
+
diff --git a/external_libs/python/pyzmq-14.7.0/setupegg.py b/external_libs/python/pyzmq-14.7.0/setupegg.py
new file mode 100644
index 00000000..a1da2807
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/setupegg.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+"""Wrapper to run setup.py using setuptools."""
+
+import os, sys
+import warnings
+
+warnings.warn("setupegg.py is deprecated. Don't use it anymore, it's a bit silly.")
+
+# now, import setuptools and call the actual setup
+import setuptools
+try:
+ execfile('setup.py')
+except NameError:
+ exec( open('setup.py','rb').read() )
diff --git a/external_libs/python/pyzmq-14.7.0/tools/release_windows.bat b/external_libs/python/pyzmq-14.7.0/tools/release_windows.bat
new file mode 100644
index 00000000..a970e69e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/tools/release_windows.bat
@@ -0,0 +1,48 @@
+@echo off
+REM build a pyzmq release on Windows
+REM 32+64b eggs on Python 27, and wheels on 27, 34
+REM that's 6 bdists
+REM requires Windows SDK 7.0 (for py2) and 7.1 (for py3)
+REM and Python installed in the locations: C:\Python34 (32b) and C:\Python34_64 (64b)
+
+REM run with cmd /k $PWD/tools/release_windows.bat
+
+setlocal EnableDelayedExpansion
+
+set SDKS=C:\Program Files\Microsoft SDKs\Windows
+set SDK7=%SDKS%\v7.0
+set SDK71=%SDKS%\v7.1
+set DISTUTILS_USE_SDK=1
+set UPLOAD=%~1
+set PYROOT=C:\
+
+for %%p in (35, 34, 27) do (
+ if "%%p"=="27" (
+ set SDK=%SDK7%
+ set cmd=build bdist_egg bdist_wheel --zmq=bundled %UPLOAD%
+ ) else (
+ set SDK=%SDK71%
+ set cmd=build bdist_wheel --zmq=bundled %UPLOAD%
+ )
+
+ for %%b in (64, 32) do (
+ if "%%b"=="64" (
+ set SUFFIX=_64
+ set ARCH=/x64
+ ) else (
+ set SUFFIX=
+ set ARCH=/x86
+ )
+ set PY=%PYROOT%\Python%%p!SUFFIX!\Python
+ echo !PY! !SDK!
+ !PY! -m pip install --upgrade setuptools pip wheel
+
+ @call "!SDK!\Bin\SetEnv.cmd" /release !ARCH!
+ if !errorlevel! neq 0 exit /b !errorlevel!
+ @echo on
+ !PY! setup.py !cmd!
+ @echo off
+ if !errorlevel! neq 0 exit !errorlevel!
+ )
+)
+exit
diff --git a/external_libs/python/pyzmq-14.7.0/tools/tasks.py b/external_libs/python/pyzmq-14.7.0/tools/tasks.py
new file mode 100644
index 00000000..1a329417
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/tools/tasks.py
@@ -0,0 +1,216 @@
+#!/usr/bin/env python
+"""
+invoke script for releasing pyzmq
+
+usage:
+
+ invoke release 14.3.1
+
+"""
+
+# Copyright (C) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+
+
+from __future__ import print_function
+
+import glob
+import os
+import pipes
+import re
+import shutil
+import sys
+
+from contextlib import contextmanager
+from subprocess import check_call
+
+from invoke import task, run as invoke_run
+
+pjoin = os.path.join
+
+repo = "git@github.com:zeromq/pyzmq"
+
+_framework_py = lambda xy: "/Library/Frameworks/Python.framework/Versions/{0}/bin/python{0}".format(xy)
+py_exes = {
+ '2.7' : _framework_py('2.7'),
+ '3.4' : _framework_py('3.4'),
+ '3.5' : _framework_py('3.5'),
+ 'pypy': "/usr/local/bin/pypy",
+ 'pypy3': "/usr/local/bin/pypy3",
+}
+egg_pys = {'2.7'}
+
+tmp = "/tmp"
+env_root = os.path.join(tmp, 'envs')
+repo_root = pjoin(tmp, 'pyzmq-release')
+sdist_root = pjoin(tmp, 'pyzmq-sdist')
+
+def _py(py):
+ return py_exes.get(py, py)
+
+def run(cmd, **kwargs):
+ """wrapper around invoke.run that accepts a Popen list"""
+ if isinstance(cmd, list):
+ cmd = " ".join(pipes.quote(s) for s in cmd)
+ kwargs.setdefault('echo', True)
+ return invoke_run(cmd, **kwargs)
+
+@contextmanager
+def cd(path):
+ """Context manager for temporary CWD"""
+ cwd = os.getcwd()
+ os.chdir(path)
+ try:
+ yield
+ finally:
+ os.chdir(cwd)
+
+@task
+def clone_repo(reset=False):
+ """Clone the repo"""
+ if os.path.exists(repo_root) and reset:
+ shutil.rmtree(repo_root)
+ if os.path.exists(repo_root):
+ with cd(repo_root):
+ run("git pull")
+ else:
+ run("git clone %s %s" % (repo, repo_root))
+
+@task
+def patch_version(vs):
+ """Patch zmq/sugar/version.py for the current release"""
+ major, minor, patch = vs_to_tup(vs)
+ version_py = pjoin(repo_root, 'zmq', 'sugar', 'version.py')
+ print("patching %s with %s" % (version_py, vs))
+ # read version.py, minus VERSION_ constants
+ with open(version_py) as f:
+ pre_lines = []
+ post_lines = []
+ lines = pre_lines
+ for line in f:
+ if line.startswith("VERSION_"):
+ lines = post_lines
+ else:
+ lines.append(line)
+
+ # write new version.py with given VERSION_ constants
+ with open(version_py, 'w') as f:
+ for line in pre_lines:
+ f.write(line)
+ f.write('VERSION_MAJOR = %s\n' % major)
+ f.write('VERSION_MINOR = %s\n' % minor)
+ f.write('VERSION_PATCH = %s\n' % patch)
+ f.write('VERSION_EXTRA = ""\n')
+ for line in post_lines:
+ f.write(line)
+
+@task
+def tag(vs, push=False):
+ """Make the tag (don't push)"""
+ patch_version(vs)
+ with cd(repo_root):
+ run('git commit -a -m "release {}"'.format(vs))
+ run('git tag -a -m "release {0}" v{0}'.format(vs))
+ if push:
+ run('git push')
+ run('git push --tags')
+
+def make_env(py_exe, *packages):
+ """Make a virtualenv
+
+ Assumes `which python` has the `virtualenv` package
+ """
+ py_exe = py_exes.get(py_exe, py_exe)
+
+ if not os.path.exists(env_root):
+ os.makedirs(env_root)
+
+ env = os.path.join(env_root, os.path.basename(py_exe))
+ py = pjoin(env, 'bin', 'python')
+ # new env
+ if not os.path.exists(py):
+ run('python -m virtualenv {} -p {}'.format(
+ pipes.quote(env),
+ pipes.quote(py_exe),
+ ))
+ py = pjoin(env, 'bin', 'python')
+ run([py, '-V'])
+ install(py, 'pip', 'setuptools')
+ install(py, *packages)
+ return py
+
+def build_sdist(py, upload=False):
+ """Build sdists
+
+ Returns the path to the tarball
+ """
+ install(py, 'cython')
+ with cd(repo_root):
+ cmd = [py, 'setup.py', 'sdist', '--formats=zip,gztar']
+ if upload:
+ cmd.append('upload')
+ run(cmd)
+
+ return glob.glob(pjoin(repo_root, 'dist', '*.tar.gz'))[0]
+
+@task
+def sdist(vs, upload=False):
+ clone_repo()
+ tag(vs, push=upload)
+ py = make_env('2.7', 'cython')
+ tarball = build_sdist(py, upload=upload)
+ return untar(tarball)
+
+def install(py, *packages):
+ packages
+ run([py, '-m', 'pip', 'install', '--upgrade'] + list(packages))
+
+def vs_to_tup(vs):
+ """version string to tuple"""
+ return re.findall(r'\d+', vs)
+
+def tup_to_vs(tup):
+ """tuple to version string"""
+ return '.'.join(tup)
+
+def untar(tarball):
+ if os.path.exists(sdist_root):
+ shutil.rmtree(sdist_root)
+ os.makedirs(sdist_root)
+ with cd(sdist_root):
+ run(['tar', '-xzf', tarball])
+
+ return glob.glob(pjoin(sdist_root, '*'))[0]
+
+def bdist(py, upload=False, wheel=True, egg=False):
+ py = make_env(py, 'wheel')
+ cmd = [py, 'setup.py']
+ if wheel:
+ cmd.append('bdist_wheel')
+ if egg:
+ cmd.append('bdist_egg')
+ if upload:
+ cmd.append('upload')
+ cmd.append('--zmq=bundled')
+
+ run(cmd)
+
+@task
+def release(vs, upload=False):
+ """Release pyzmq"""
+ # Ensure all our Pythons exist before we start:
+ for v, path in py_exes.items():
+ if not os.path.exists(path):
+ raise ValueError("Need %s at %s" % (v, path))
+
+ # start from scrach with clone and envs
+ clone_repo(reset=True)
+ if os.path.exists(env_root):
+ shutil.rmtree(env_root)
+
+ path = sdist(vs, upload=upload)
+
+ with cd(path):
+ for v in py_exes:
+ bdist(v, upload=upload, wheel=True, egg=(v in egg_pys))
+
diff --git a/external_libs/python/pyzmq-14.7.0/tox.ini b/external_libs/python/pyzmq-14.7.0/tox.ini
new file mode 100644
index 00000000..d493e2cc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/tox.ini
@@ -0,0 +1,27 @@
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = pypy, py26, py27, py32, py33, py34
+
+[testenv]
+changedir = {toxworkdir}
+commands =
+ python -V
+ python -c 'import zmq; print("pyzmq-%s" % zmq.pyzmq_version())'
+ python -c 'import zmq; print("libzmq-%s" % zmq.zmq_version())'
+ nosetests zmq.tests {posargs}
+deps =
+ nose
+
+[testenv:py27]
+deps =
+ gevent
+ {[testenv]deps}
+[testenv:pypy]
+deps =
+ py
+ cffi
+ {[testenv]deps}
diff --git a/external_libs/python/zmq/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/__init__.py
index 3408b3ba..8648e3eb 100644
--- a/external_libs/python/zmq/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/__init__.py
@@ -17,6 +17,23 @@ for ext in ('pyd', 'so', 'dll', 'dylib'):
bundled_sodium.extend(glob.glob(os.path.join(here, 'libsodium*.%s*' % ext)))
bundled.extend(glob.glob(os.path.join(here, 'libzmq*.%s*' % ext)))
+# If we are running in a debug interpreter, load libzmq_d.pyd instead of libzmq.pyd
+# hasattr(sys, 'gettotalrefcount') is used to detect whether we are running in a debug interpreter
+# Taken from http://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter
+if os.name == 'nt':
+ def is_debug_filename(name):
+ # Note this fails for filenames like foo.bar_d.so.x.y.z,
+ # but such names should not appear on Windows.
+ root, ext = os.path.splitext(name)
+ return root.endswith('_d')
+
+ if hasattr(sys, 'gettotalrefcount'):
+ bundled_sodium = [x for x in bundled_sodium if is_debug_filename(x)]
+ bundled = [x for x in bundled if is_debug_filename(x)]
+ else:
+ bundled_sodium = [x for x in bundled_sodium if not is_debug_filename(x)]
+ bundled = [x for x in bundled if not is_debug_filename(x)]
+
if bundled:
import ctypes
if bundled_sodium:
diff --git a/external_libs/python/zmq/auth/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/auth/__init__.py
index 11d3ad6b..11d3ad6b 100644
--- a/external_libs/python/zmq/auth/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/auth/__init__.py
diff --git a/external_libs/python/zmq/auth/base.py b/external_libs/python/pyzmq-14.7.0/zmq/auth/base.py
index 9b4aaed7..ecd085b7 100644
--- a/external_libs/python/zmq/auth/base.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/auth/base.py
@@ -244,7 +244,7 @@ class Authenticator(object):
if domain in self.certs:
# The certs dict stores keys in z85 format, convert binary key to z85 bytes
z85_client_key = z85.encode(client_key)
- if z85_client_key in self.certs[domain] or self.certs[domain] == b'OK':
+ if self.certs[domain].get(z85_client_key):
allowed = True
reason = b"OK"
else:
diff --git a/external_libs/python/zmq/auth/certs.py b/external_libs/python/pyzmq-14.7.0/zmq/auth/certs.py
index 4d26ad7b..d4febdb5 100644
--- a/external_libs/python/zmq/auth/certs.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/auth/certs.py
@@ -38,6 +38,8 @@ def _write_key_file(key_filename, banner, public_key, secret_key=None, metadata=
f.write(u('metadata\n'))
if metadata:
for k, v in metadata.items():
+ if isinstance(k, bytes):
+ k = k.decode(encoding)
if isinstance(v, bytes):
v = v.decode(encoding)
f.write(u(" {0} = {1}\n").format(k, v))
@@ -80,6 +82,8 @@ def load_certificate(filename):
If the certificate file only contains the public key,
secret_key will be None.
+
+ If there is no public key found in the file, ValueError will be raised.
"""
public_key = None
secret_key = None
@@ -98,6 +102,9 @@ def load_certificate(filename):
if public_key and secret_key:
break
+ if public_key is None:
+ raise ValueError("No public key found in %s" % filename)
+
return public_key, secret_key
@@ -113,7 +120,7 @@ def load_certificates(directory='.'):
for cert_file in cert_files:
public_key, _ = load_certificate(cert_file)
if public_key:
- certs[public_key] = 'OK'
+ certs[public_key] = True
return certs
__all__ = ['create_certificates', 'load_certificate', 'load_certificates']
diff --git a/external_libs/python/zmq/auth/ioloop.py b/external_libs/python/pyzmq-14.7.0/zmq/auth/ioloop.py
index 1f448b47..1f448b47 100644
--- a/external_libs/python/zmq/auth/ioloop.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/auth/ioloop.py
diff --git a/external_libs/python/zmq/auth/thread.py b/external_libs/python/pyzmq-14.7.0/zmq/auth/thread.py
index 8c3355a9..24457d6c 100644
--- a/external_libs/python/zmq/auth/thread.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/auth/thread.py
@@ -21,12 +21,12 @@ class AuthenticationThread(Thread):
This is run in the background by ThreadedAuthenticator
"""
- def __init__(self, context, endpoint, encoding='utf-8', log=None):
+ def __init__(self, context, endpoint, encoding='utf-8', log=None, authenticator=None):
super(AuthenticationThread, self).__init__()
self.context = context or zmq.Context.instance()
self.encoding = encoding
self.log = log = log or logging.getLogger('zmq.auth')
- self.authenticator = Authenticator(context, encoding=encoding, log=log)
+ self.authenticator = authenticator or Authenticator(context, encoding=encoding, log=log)
# create a socket to communicate back to main thread.
self.pipe = context.socket(zmq.PAIR)
diff --git a/external_libs/python/zmq/backend/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/__init__.py
index 7cac725c..7cac725c 100644
--- a/external_libs/python/zmq/backend/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/__init__.py
diff --git a/external_libs/python/zmq/backend/cffi/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/__init__.py
index ca3164d3..ca3164d3 100644
--- a/external_libs/python/zmq/backend/cffi/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/__init__.py
diff --git a/external_libs/python/zmq/backend/cffi/_cdefs.h b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_cdefs.h
index d3300575..d3300575 100644
--- a/external_libs/python/zmq/backend/cffi/_cdefs.h
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_cdefs.h
diff --git a/external_libs/python/zmq/backend/cffi/_cffi.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_cffi.py
index c73ebf83..c73ebf83 100644
--- a/external_libs/python/zmq/backend/cffi/_cffi.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_cffi.py
diff --git a/external_libs/python/zmq/backend/cffi/_poll.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_poll.py
index 9bca34ca..941b0801 100644
--- a/external_libs/python/zmq/backend/cffi/_poll.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_poll.py
@@ -4,11 +4,8 @@
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
-from ._cffi import C, ffi, zmq_version_info
-
-from .constants import *
-
-from zmq.error import _check_rc
+from ._cffi import C, ffi
+from .utils import _retry_sys_call
def _make_zmq_pollitem(socket, flags):
@@ -41,8 +38,7 @@ def zmq_poll(sockets, timeout):
items = ffi.new('zmq_pollitem_t[]', cffi_pollitem_list)
list_length = ffi.cast('int', len(cffi_pollitem_list))
c_timeout = ffi.cast('long', timeout)
- rc = C.zmq_poll(items, list_length, c_timeout)
- _check_rc(rc)
+ _retry_sys_call(C.zmq_poll, items, list_length, c_timeout)
result = []
for index in range(len(items)):
if not items[index].socket == ffi.NULL:
diff --git a/external_libs/python/zmq/backend/cffi/_verify.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_verify.c
index 547840eb..547840eb 100644
--- a/external_libs/python/zmq/backend/cffi/_verify.c
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/_verify.c
diff --git a/external_libs/python/zmq/backend/cffi/constants.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/constants.py
index ee293e74..ee293e74 100644
--- a/external_libs/python/zmq/backend/cffi/constants.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/constants.py
diff --git a/external_libs/python/zmq/backend/cffi/context.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/context.py
index 16a7b257..2cc610eb 100644
--- a/external_libs/python/zmq/backend/cffi/context.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/context.py
@@ -8,10 +8,9 @@ import weakref
from ._cffi import C, ffi
-from .socket import *
-from .constants import *
+from .constants import EINVAL, IO_THREADS, LINGER
-from zmq.error import ZMQError, _check_rc
+from zmq.error import ZMQError, InterruptedSystemCall, _check_rc
class Context(object):
_zmq_ctx = None
@@ -76,8 +75,14 @@ class Context(object):
def term(self):
if self.closed:
return
-
- C.zmq_ctx_destroy(self._zmq_ctx)
+
+ rc = C.zmq_ctx_destroy(self._zmq_ctx)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ # ignore interrupted term
+ # see PEP 475 notes about close & EINTR for why
+ pass
self._zmq_ctx = None
self._closed = True
diff --git a/external_libs/python/zmq/backend/cffi/devices.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/devices.py
index c7a514a8..de01f35b 100644
--- a/external_libs/python/zmq/backend/cffi/devices.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/devices.py
@@ -4,13 +4,13 @@
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
-from ._cffi import C, ffi, zmq_version_info
+from ._cffi import C, ffi
from .socket import Socket
-from zmq.error import ZMQError, _check_rc
+from .utils import _retry_sys_call
+
def device(device_type, frontend, backend):
- rc = C.zmq_proxy(frontend._zmq_socket, backend._zmq_socket, ffi.NULL)
- _check_rc(rc)
+ return proxy(frontend, backend)
def proxy(frontend, backend, capture=None):
if isinstance(capture, Socket):
@@ -18,7 +18,6 @@ def proxy(frontend, backend, capture=None):
else:
capture = ffi.NULL
- rc = C.zmq_proxy(frontend._zmq_socket, backend._zmq_socket, capture)
- _check_rc(rc)
+ _retry_sys_call(C.zmq_proxy, frontend._zmq_socket, backend._zmq_socket, capture)
__all__ = ['device', 'proxy']
diff --git a/external_libs/python/zmq/backend/cffi/error.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/error.py
index 3bb64de0..a3d6bfc0 100644
--- a/external_libs/python/zmq/backend/cffi/error.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/error.py
@@ -6,7 +6,11 @@
from ._cffi import C, ffi
def strerror(errno):
- return ffi.string(C.zmq_strerror(errno))
+ s = ffi.string(C.zmq_strerror(errno))
+ if not isinstance(s, str):
+ # py3
+ s = s.decode()
+ return s
zmq_errno = C.zmq_errno
diff --git a/external_libs/python/zmq/backend/cffi/message.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/message.py
index c35decb6..c35decb6 100644
--- a/external_libs/python/zmq/backend/cffi/message.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/message.py
diff --git a/external_libs/python/zmq/backend/cffi/socket.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/socket.py
index 3c427739..4bcb96f7 100644
--- a/external_libs/python/zmq/backend/cffi/socket.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/socket.py
@@ -4,9 +4,6 @@
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
-import random
-import codecs
-
import errno as errno_mod
from ._cffi import (C, ffi, new_uint64_pointer, new_int64_pointer,
@@ -15,7 +12,8 @@ from ._cffi import (C, ffi, new_uint64_pointer, new_int64_pointer,
IPC_PATH_MAX_LEN)
from .message import Frame
-from .constants import *
+from .constants import RCVMORE
+from .utils import _retry_sys_call
import zmq
from zmq.error import ZMQError, _check_rc, _check_version
@@ -150,11 +148,11 @@ class Socket(object):
c_value_pointer = c_data[0]
c_sizet = c_data[1]
- rc = C.zmq_setsockopt(self._zmq_socket,
- option,
- ffi.cast('void*', c_value_pointer),
- c_sizet)
- _check_rc(rc)
+ _retry_sys_call(C.zmq_setsockopt,
+ self._zmq_socket,
+ option,
+ ffi.cast('void*', c_value_pointer),
+ c_sizet)
def get(self, option):
c_data = new_pointer_from_opt(option, length=255)
@@ -162,11 +160,11 @@ class Socket(object):
c_value_pointer = c_data[0]
c_sizet_pointer = c_data[1]
- rc = C.zmq_getsockopt(self._zmq_socket,
- option,
- c_value_pointer,
- c_sizet_pointer)
- _check_rc(rc)
+ _retry_sys_call(C.zmq_getsockopt,
+ self._zmq_socket,
+ option,
+ c_value_pointer,
+ c_sizet_pointer)
sz = c_sizet_pointer[0]
v = value_from_opt_pointer(option, c_value_pointer, sz)
@@ -184,11 +182,11 @@ class Socket(object):
zmq_msg = ffi.new('zmq_msg_t*')
c_message = ffi.new('char[]', message)
rc = C.zmq_msg_init_size(zmq_msg, len(message))
- C.memcpy(C.zmq_msg_data(zmq_msg), c_message, len(message))
-
- rc = C.zmq_msg_send(zmq_msg, self._zmq_socket, flags)
- C.zmq_msg_close(zmq_msg)
_check_rc(rc)
+ C.memcpy(C.zmq_msg_data(zmq_msg), c_message, len(message))
+ _retry_sys_call(C.zmq_msg_send, zmq_msg, self._zmq_socket, flags)
+ rc2 = C.zmq_msg_close(zmq_msg)
+ _check_rc(rc2)
if track:
return zmq.MessageTracker()
@@ -196,16 +194,17 @@ class Socket(object):
def recv(self, flags=0, copy=True, track=False):
zmq_msg = ffi.new('zmq_msg_t*')
C.zmq_msg_init(zmq_msg)
-
- rc = C.zmq_msg_recv(zmq_msg, self._zmq_socket, flags)
-
- if rc < 0:
+
+ try:
+ _retry_sys_call(C.zmq_msg_recv, zmq_msg, self._zmq_socket, flags)
+ except Exception:
C.zmq_msg_close(zmq_msg)
- _check_rc(rc)
+ raise
_buffer = ffi.buffer(C.zmq_msg_data(zmq_msg), C.zmq_msg_size(zmq_msg))
value = _buffer[:]
- C.zmq_msg_close(zmq_msg)
+ rc = C.zmq_msg_close(zmq_msg)
+ _check_rc(rc)
frame = Frame(value, track=track)
frame.more = self.getsockopt(RCVMORE)
@@ -238,6 +237,8 @@ class Socket(object):
events = zmq.EVENT_ALL
if addr is None:
addr = ffi.NULL
+ if isinstance(addr, unicode):
+ addr = addr.encode('utf8')
rc = C.zmq_socket_monitor(self._zmq_socket, addr, events)
diff --git a/external_libs/python/zmq/backend/cffi/utils.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/utils.py
index fde7827b..dc368295 100644
--- a/external_libs/python/zmq/backend/cffi/utils.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cffi/utils.py
@@ -4,9 +4,11 @@
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
+from errno import EINTR
+
from ._cffi import ffi, C
-from zmq.error import ZMQError, _check_rc, _check_version
+from zmq.error import ZMQError, InterruptedSystemCall, _check_rc, _check_version
from zmq.utils.strtypes import unicode
def has(capability):
@@ -59,4 +61,15 @@ class Stopwatch(object):
def sleep(self, seconds):
C.zmq_sleep(seconds)
+def _retry_sys_call(f, *args, **kwargs):
+ """make a call, retrying if interrupted with EINTR"""
+ while True:
+ rc = f(*args)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+
__all__ = ['has', 'curve_keypair', 'Stopwatch']
diff --git a/external_libs/python/zmq/backend/cython/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/__init__.py
index e5358185..e5358185 100644
--- a/external_libs/python/zmq/backend/cython/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/__init__.py
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_device.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_device.c
new file mode 100644
index 00000000..3d43c853
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_device.c
@@ -0,0 +1,3576 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython___device
+#define __PYX_HAVE_API__zmq__backend__cython___device
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#include "errno.h"
+#include "string.h"
+#include "stdio.h"
+#include "pythread.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/_device.pyx",
+ "zmq/backend/cython/checkrc.pxd",
+ "zmq/backend/cython/context.pxd",
+ "zmq/backend/cython/socket.pxd",
+ "type.pxd",
+ "bool.pxd",
+ "complex.pxd",
+};
+
+/*--- Type declarations ---*/
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context;
+struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv;
+
+/* "zmq/backend/cython/socket.pxd":45
+ *
+ * # cpdef methods for direct-cython access:
+ * cpdef object send(self, object data, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
+ * cpdef object recv(self, int flags=*, copy=*, track=*)
+ *
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send {
+ int __pyx_n;
+ int flags;
+ PyObject *copy;
+ PyObject *track;
+};
+
+/* "zmq/backend/cython/socket.pxd":46
+ * # cpdef methods for direct-cython access:
+ * cpdef object send(self, object data, int flags=*, copy=*, track=*)
+ * cpdef object recv(self, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
+ *
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv {
+ int __pyx_n;
+ int flags;
+ PyObject *copy;
+ PyObject *track;
+};
+
+/* "context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ void **_sockets;
+ size_t _n_sockets;
+ size_t _max_sockets;
+ int _pid;
+ int closed;
+};
+
+
+/* "zmq/backend/cython/socket.pxd":33
+ *
+ *
+ * cdef class Socket: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ struct __pyx_obj_3zmq_7backend_6cython_7context_Context *context;
+ int _closed;
+ int _pid;
+};
+
+
+
+/* "context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context {
+ int (*_term)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *);
+ void (*_add_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+ void (*_remove_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtabptr_3zmq_7backend_6cython_7context_Context;
+
+
+/* "zmq/backend/cython/socket.pxd":33
+ *
+ *
+ * cdef class Socket: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket {
+ PyObject *(*send)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args);
+ PyObject *(*recv)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket;
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+ const char* function_name);
+
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+static void* __Pyx_GetVtable(PyObject *dict);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+#ifndef __PYX_FORCE_INIT_THREADS
+ #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static int __Pyx_check_binary_version(void);
+
+#if !defined(__Pyx_PyIdentifier_FromString)
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
+#else
+ #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
+#endif
+#endif
+
+static PyObject *__Pyx_ImportModule(const char *name);
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'zmq.backend.cython.context' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7context_Context = 0;
+
+/* Module declarations from 'zmq.backend.cython.socket' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_6socket_Socket = 0;
+
+/* Module declarations from 'libc.errno' */
+
+/* Module declarations from 'cpython.version' */
+
+/* Module declarations from 'cpython.ref' */
+
+/* Module declarations from 'cpython.exc' */
+
+/* Module declarations from 'cpython.module' */
+
+/* Module declarations from 'cpython.mem' */
+
+/* Module declarations from 'cpython.tuple' */
+
+/* Module declarations from 'cpython.list' */
+
+/* Module declarations from 'libc.string' */
+
+/* Module declarations from 'libc.stdio' */
+
+/* Module declarations from 'cpython.object' */
+
+/* Module declarations from 'cpython.sequence' */
+
+/* Module declarations from 'cpython.mapping' */
+
+/* Module declarations from 'cpython.iterator' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
+
+/* Module declarations from 'cpython.number' */
+
+/* Module declarations from 'cpython.int' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.bool' */
+static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
+
+/* Module declarations from 'cpython.long' */
+
+/* Module declarations from 'cpython.float' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.complex' */
+static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
+
+/* Module declarations from 'cpython.string' */
+
+/* Module declarations from 'cpython.unicode' */
+
+/* Module declarations from 'cpython.dict' */
+
+/* Module declarations from 'cpython.instance' */
+
+/* Module declarations from 'cpython.function' */
+
+/* Module declarations from 'cpython.method' */
+
+/* Module declarations from 'cpython.weakref' */
+
+/* Module declarations from 'cpython.getargs' */
+
+/* Module declarations from 'cpython.pythread' */
+
+/* Module declarations from 'cpython.pystate' */
+
+/* Module declarations from 'cpython.cobject' */
+
+/* Module declarations from 'cpython.oldbuffer' */
+
+/* Module declarations from 'cpython.set' */
+
+/* Module declarations from 'cpython.buffer' */
+
+/* Module declarations from 'cpython.bytes' */
+
+/* Module declarations from 'cpython.pycapsule' */
+
+/* Module declarations from 'cpython' */
+
+/* Module declarations from 'zmq.backend.cython.checkrc' */
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int); /*proto*/
+
+/* Module declarations from 'zmq.backend.cython._device' */
+#define __Pyx_MODULE_NAME "zmq.backend.cython._device"
+int __pyx_module_is_main_zmq__backend__cython___device = 0;
+
+/* Implementation of 'zmq.backend.cython._device' */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7_device_device(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_device_type, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_frontend, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_backend); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7_device_2proxy(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_frontend, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_backend, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_capture); /* proto */
+static char __pyx_k_rc[] = "rc";
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_Again[] = "Again";
+static char __pyx_k_proxy[] = "proxy";
+static char __pyx_k_device[] = "device";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_backend[] = "backend";
+static char __pyx_k_capture[] = "capture";
+static char __pyx_k_ZMQError[] = "ZMQError";
+static char __pyx_k_frontend[] = "frontend";
+static char __pyx_k_zmq_error[] = "zmq.error";
+static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static char __pyx_k_device_type[] = "device_type";
+static char __pyx_k_capture_handle[] = "capture_handle";
+static char __pyx_k_ContextTerminated[] = "ContextTerminated";
+static char __pyx_k_InterruptedSystemCall[] = "InterruptedSystemCall";
+static char __pyx_k_zmq_backend_cython__device[] = "zmq.backend.cython._device";
+static char __pyx_k_private_tmp_pyzmq_release_zmq_b[] = "/private/tmp/pyzmq-release/zmq/backend/cython/_device.pyx";
+static char __pyx_k_Python_binding_for_0MQ_device_fu[] = "Python binding for 0MQ device function.";
+static PyObject *__pyx_n_s_Again;
+static PyObject *__pyx_n_s_ContextTerminated;
+static PyObject *__pyx_n_s_InterruptedSystemCall;
+static PyObject *__pyx_n_s_ZMQError;
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_backend;
+static PyObject *__pyx_n_s_capture;
+static PyObject *__pyx_n_s_capture_handle;
+static PyObject *__pyx_n_s_device;
+static PyObject *__pyx_n_s_device_type;
+static PyObject *__pyx_n_s_frontend;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_kp_s_private_tmp_pyzmq_release_zmq_b;
+static PyObject *__pyx_n_s_proxy;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_n_s_rc;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_zmq_backend_cython__device;
+static PyObject *__pyx_n_s_zmq_error;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_codeobj__2;
+static PyObject *__pyx_codeobj__4;
+
+/* "zmq/backend/cython/_device.pyx":36
+ * #-----------------------------------------------------------------------------
+ *
+ * def device(int device_type, cSocket frontend, cSocket backend=None): # <<<<<<<<<<<<<<
+ * """device(device_type, frontend, backend)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7_device_1device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7_device_device[] = "device(device_type, frontend, backend)\n\n Start a zeromq device.\n \n .. deprecated:: libzmq-3.2\n Use zmq.proxy\n\n Parameters\n ----------\n device_type : (QUEUE, FORWARDER, STREAMER)\n The type of device to start.\n frontend : Socket\n The Socket instance for the incoming traffic.\n backend : Socket\n The Socket instance for the outbound traffic.\n ";
+static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_7_device_1device = {"device", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7_device_1device, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_7_device_device};
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7_device_1device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_v_device_type;
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_frontend = 0;
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_backend = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("device (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_device_type,&__pyx_n_s_frontend,&__pyx_n_s_backend,0};
+ PyObject* values[3] = {0,0,0};
+ values[2] = (PyObject *)((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)Py_None);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_device_type)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frontend)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("device", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ case 2:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_backend);
+ if (value) { values[2] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "device") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_device_type = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_device_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_frontend = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)values[1]);
+ __pyx_v_backend = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)values[2]);
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("device", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython._device.device", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_frontend), __pyx_ptype_3zmq_7backend_6cython_6socket_Socket, 1, "frontend", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_backend), __pyx_ptype_3zmq_7backend_6cython_6socket_Socket, 1, "backend", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7_device_device(__pyx_self, __pyx_v_device_type, __pyx_v_frontend, __pyx_v_backend);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7_device_device(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_device_type, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_frontend, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_backend) {
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ int __pyx_t_10;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("device", 0);
+
+ /* "zmq/backend/cython/_device.pyx":53
+ * The Socket instance for the outbound traffic.
+ * """
+ * if ZMQ_VERSION_MAJOR >= 3: # <<<<<<<<<<<<<<
+ * return proxy(frontend, backend)
+ *
+ */
+ __pyx_t_1 = ((ZMQ_VERSION_MAJOR >= 3) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/_device.pyx":54
+ * """
+ * if ZMQ_VERSION_MAJOR >= 3:
+ * return proxy(frontend, backend) # <<<<<<<<<<<<<<
+ *
+ * cdef int rc = 0
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_proxy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
+ __Pyx_INCREF(((PyObject *)__pyx_v_frontend));
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_frontend));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_frontend));
+ __Pyx_INCREF(((PyObject *)__pyx_v_backend));
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_backend));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_backend));
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/_device.pyx":56
+ * return proxy(frontend, backend)
+ *
+ * cdef int rc = 0 # <<<<<<<<<<<<<<
+ * while True:
+ * with nogil:
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/_device.pyx":57
+ *
+ * cdef int rc = 0
+ * while True: # <<<<<<<<<<<<<<
+ * with nogil:
+ * rc = zmq_device(device_type, frontend.handle, backend.handle)
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/_device.pyx":58
+ * cdef int rc = 0
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_device(device_type, frontend.handle, backend.handle)
+ * try:
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/_device.pyx":59
+ * while True:
+ * with nogil:
+ * rc = zmq_device(device_type, frontend.handle, backend.handle) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = zmq_device(__pyx_v_device_type, __pyx_v_frontend->handle, __pyx_v_backend->handle);
+ }
+
+ /* "zmq/backend/cython/_device.pyx":58
+ * cdef int rc = 0
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_device(device_type, frontend.handle, backend.handle)
+ * try:
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+ }
+ }
+
+ /* "zmq/backend/cython/_device.pyx":60
+ * with nogil:
+ * rc = zmq_device(device_type, frontend.handle, backend.handle)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/_device.pyx":61
+ * rc = zmq_device(device_type, frontend.handle, backend.handle)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_10 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/_device.pyx":65
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ * return rc
+ *
+ */
+ goto __pyx_L16_try_break;
+ }
+ __pyx_L11_error:;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/_device.pyx":62
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_10 = PyErr_ExceptionMatches(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_10) {
+ __Pyx_AddTraceback("zmq.backend.cython._device.device", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "zmq/backend/cython/_device.pyx":63
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L20_except_continue;
+ __pyx_L20_except_continue:;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L17_try_continue;
+ }
+ goto __pyx_L13_except_error;
+ __pyx_L13_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ goto __pyx_L1_error;
+ __pyx_L16_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ goto __pyx_L5_break;
+ __pyx_L17_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ goto __pyx_L4_continue;
+ }
+ __pyx_L4_continue:;
+ }
+ __pyx_L5_break:;
+
+ /* "zmq/backend/cython/_device.pyx":66
+ * else:
+ * break
+ * return rc # <<<<<<<<<<<<<<
+ *
+ * def proxy(cSocket frontend, cSocket backend, cSocket capture=None):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_r = __pyx_t_6;
+ __pyx_t_6 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/_device.pyx":36
+ * #-----------------------------------------------------------------------------
+ *
+ * def device(int device_type, cSocket frontend, cSocket backend=None): # <<<<<<<<<<<<<<
+ * """device(device_type, frontend, backend)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("zmq.backend.cython._device.device", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/_device.pyx":68
+ * return rc
+ *
+ * def proxy(cSocket frontend, cSocket backend, cSocket capture=None): # <<<<<<<<<<<<<<
+ * """proxy(frontend, backend, capture)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7_device_3proxy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7_device_2proxy[] = "proxy(frontend, backend, capture)\n \n Start a zeromq proxy (replacement for device).\n \n .. versionadded:: libzmq-3.2\n .. versionadded:: 13.0\n \n Parameters\n ----------\n frontend : Socket\n The Socket instance for the incoming traffic.\n backend : Socket\n The Socket instance for the outbound traffic.\n capture : Socket (optional)\n The Socket instance for capturing traffic.\n ";
+static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_7_device_3proxy = {"proxy", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7_device_3proxy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_7_device_2proxy};
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7_device_3proxy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_frontend = 0;
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_backend = 0;
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_capture = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("proxy (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frontend,&__pyx_n_s_backend,&__pyx_n_s_capture,0};
+ PyObject* values[3] = {0,0,0};
+ values[2] = (PyObject *)((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)Py_None);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_frontend)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_backend)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("proxy", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ case 2:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_capture);
+ if (value) { values[2] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "proxy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_frontend = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)values[0]);
+ __pyx_v_backend = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)values[1]);
+ __pyx_v_capture = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)values[2]);
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("proxy", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython._device.proxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_frontend), __pyx_ptype_3zmq_7backend_6cython_6socket_Socket, 1, "frontend", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_backend), __pyx_ptype_3zmq_7backend_6cython_6socket_Socket, 1, "backend", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_capture), __pyx_ptype_3zmq_7backend_6cython_6socket_Socket, 1, "capture", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7_device_2proxy(__pyx_self, __pyx_v_frontend, __pyx_v_backend, __pyx_v_capture);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7_device_2proxy(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_frontend, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_backend, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_capture) {
+ int __pyx_v_rc;
+ void *__pyx_v_capture_handle;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ void *__pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("proxy", 0);
+
+ /* "zmq/backend/cython/_device.pyx":85
+ * The Socket instance for capturing traffic.
+ * """
+ * cdef int rc = 0 # <<<<<<<<<<<<<<
+ * cdef void* capture_handle
+ * if isinstance(capture, cSocket):
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/_device.pyx":87
+ * cdef int rc = 0
+ * cdef void* capture_handle
+ * if isinstance(capture, cSocket): # <<<<<<<<<<<<<<
+ * capture_handle = capture.handle
+ * else:
+ */
+ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_capture), ((PyObject*)__pyx_ptype_3zmq_7backend_6cython_6socket_Socket));
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/_device.pyx":88
+ * cdef void* capture_handle
+ * if isinstance(capture, cSocket):
+ * capture_handle = capture.handle # <<<<<<<<<<<<<<
+ * else:
+ * capture_handle = NULL
+ */
+ __pyx_t_3 = __pyx_v_capture->handle;
+ __pyx_v_capture_handle = __pyx_t_3;
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/_device.pyx":90
+ * capture_handle = capture.handle
+ * else:
+ * capture_handle = NULL # <<<<<<<<<<<<<<
+ * while True:
+ * with nogil:
+ */
+ __pyx_v_capture_handle = NULL;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/_device.pyx":91
+ * else:
+ * capture_handle = NULL
+ * while True: # <<<<<<<<<<<<<<
+ * with nogil:
+ * rc = zmq_proxy(frontend.handle, backend.handle, capture_handle)
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/_device.pyx":92
+ * capture_handle = NULL
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_proxy(frontend.handle, backend.handle, capture_handle)
+ * try:
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/_device.pyx":93
+ * while True:
+ * with nogil:
+ * rc = zmq_proxy(frontend.handle, backend.handle, capture_handle) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = zmq_proxy(__pyx_v_frontend->handle, __pyx_v_backend->handle, __pyx_v_capture_handle);
+ }
+
+ /* "zmq/backend/cython/_device.pyx":92
+ * capture_handle = NULL
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_proxy(frontend.handle, backend.handle, capture_handle)
+ * try:
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+ }
+ }
+
+ /* "zmq/backend/cython/_device.pyx":94
+ * with nogil:
+ * rc = zmq_proxy(frontend.handle, backend.handle, capture_handle)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_6);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/_device.pyx":95
+ * rc = zmq_proxy(frontend.handle, backend.handle, capture_handle)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_7 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/_device.pyx":99
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ * return rc
+ *
+ */
+ goto __pyx_L16_try_break;
+ }
+ __pyx_L11_error:;
+
+ /* "zmq/backend/cython/_device.pyx":96
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_7 = PyErr_ExceptionMatches(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (__pyx_t_7) {
+ __Pyx_AddTraceback("zmq.backend.cython._device.proxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_10);
+
+ /* "zmq/backend/cython/_device.pyx":97
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L20_except_continue;
+ __pyx_L20_except_continue:;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ goto __pyx_L17_try_continue;
+ }
+ goto __pyx_L13_except_error;
+ __pyx_L13_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L1_error;
+ __pyx_L16_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L5_break;
+ __pyx_L17_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L4_continue;
+ }
+ __pyx_L4_continue:;
+ }
+ __pyx_L5_break:;
+
+ /* "zmq/backend/cython/_device.pyx":100
+ * else:
+ * break
+ * return rc # <<<<<<<<<<<<<<
+ *
+ * __all__ = ['device', 'proxy']
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_r = __pyx_t_10;
+ __pyx_t_10 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/_device.pyx":68
+ * return rc
+ *
+ * def proxy(cSocket frontend, cSocket backend, cSocket capture=None): # <<<<<<<<<<<<<<
+ * """proxy(frontend, backend, capture)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_AddTraceback("zmq.backend.cython._device.proxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int __pyx_v_rc) {
+ int __pyx_v_errno;
+ PyObject *__pyx_v_InterruptedSystemCall = NULL;
+ PyObject *__pyx_v_Again = NULL;
+ PyObject *__pyx_v_ContextTerminated = NULL;
+ PyObject *__pyx_v_ZMQError = NULL;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_check_rc", 0);
+
+ /* "zmq/backend/cython/checkrc.pxd":11
+ * and raising the appropriate Exception class
+ * """
+ * cdef int errno = zmq_errno() # <<<<<<<<<<<<<<
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ */
+ __pyx_v_errno = zmq_errno();
+
+ /* "zmq/backend/cython/checkrc.pxd":12
+ * """
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals() # <<<<<<<<<<<<<<
+ * if rc < 0:
+ * if errno == EINTR:
+ */
+ __pyx_t_1 = PyErr_CheckSignals(); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/checkrc.pxd":13
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals()
+ * if rc < 0: # <<<<<<<<<<<<<<
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ */
+ __pyx_t_2 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ switch (__pyx_v_errno) {
+
+ /* "zmq/backend/cython/checkrc.pxd":14
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ * if errno == EINTR: # <<<<<<<<<<<<<<
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ */
+ case EINTR:
+
+ /* "zmq/backend/cython/checkrc.pxd":15
+ * if rc < 0:
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ */
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_4 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_InterruptedSystemCall = __pyx_t_3;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":16
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno) # <<<<<<<<<<<<<<
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_InterruptedSystemCall);
+ __pyx_t_5 = __pyx_v_InterruptedSystemCall; __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":17
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN: # <<<<<<<<<<<<<<
+ * from zmq.error import Again
+ * raise Again(errno)
+ */
+ case EAGAIN:
+
+ /* "zmq/backend/cython/checkrc.pxd":18
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ * from zmq.error import Again # <<<<<<<<<<<<<<
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ */
+ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_Again);
+ PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Again);
+ __Pyx_GIVEREF(__pyx_n_s_Again);
+ __pyx_t_5 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Again); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v_Again = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":19
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ * raise Again(errno) # <<<<<<<<<<<<<<
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ */
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_Again);
+ __pyx_t_7 = __pyx_v_Again; __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ case ETERM:
+
+ /* "zmq/backend/cython/checkrc.pxd":21
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated # <<<<<<<<<<<<<<
+ * raise ContextTerminated(errno)
+ * else:
+ */
+ __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_ContextTerminated);
+ PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_ContextTerminated);
+ __Pyx_GIVEREF(__pyx_n_s_ContextTerminated);
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_5, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ContextTerminated); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_v_ContextTerminated = __pyx_t_5;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":22
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno) # <<<<<<<<<<<<<<
+ * else:
+ * from zmq.error import ZMQError
+ */
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_v_ContextTerminated);
+ __pyx_t_6 = __pyx_v_ContextTerminated; __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_t_7, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ default:
+
+ /* "zmq/backend/cython/checkrc.pxd":24
+ * raise ContextTerminated(errno)
+ * else:
+ * from zmq.error import ZMQError # <<<<<<<<<<<<<<
+ * raise ZMQError(errno)
+ * return 0
+ */
+ __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_7, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_7);
+ __pyx_v_ZMQError = __pyx_t_7;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":25
+ * else:
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno) # <<<<<<<<<<<<<<
+ * return 0
+ */
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_v_ZMQError);
+ __pyx_t_3 = __pyx_v_ZMQError; __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ }
+ }
+
+ /* "zmq/backend/cython/checkrc.pxd":26
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno)
+ * return 0 # <<<<<<<<<<<<<<
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.checkrc._check_rc", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_InterruptedSystemCall);
+ __Pyx_XDECREF(__pyx_v_Again);
+ __Pyx_XDECREF(__pyx_v_ContextTerminated);
+ __Pyx_XDECREF(__pyx_v_ZMQError);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "_device",
+ __pyx_k_Python_binding_for_0MQ_device_fu, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_Again, __pyx_k_Again, sizeof(__pyx_k_Again), 0, 0, 1, 1},
+ {&__pyx_n_s_ContextTerminated, __pyx_k_ContextTerminated, sizeof(__pyx_k_ContextTerminated), 0, 0, 1, 1},
+ {&__pyx_n_s_InterruptedSystemCall, __pyx_k_InterruptedSystemCall, sizeof(__pyx_k_InterruptedSystemCall), 0, 0, 1, 1},
+ {&__pyx_n_s_ZMQError, __pyx_k_ZMQError, sizeof(__pyx_k_ZMQError), 0, 0, 1, 1},
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_backend, __pyx_k_backend, sizeof(__pyx_k_backend), 0, 0, 1, 1},
+ {&__pyx_n_s_capture, __pyx_k_capture, sizeof(__pyx_k_capture), 0, 0, 1, 1},
+ {&__pyx_n_s_capture_handle, __pyx_k_capture_handle, sizeof(__pyx_k_capture_handle), 0, 0, 1, 1},
+ {&__pyx_n_s_device, __pyx_k_device, sizeof(__pyx_k_device), 0, 0, 1, 1},
+ {&__pyx_n_s_device_type, __pyx_k_device_type, sizeof(__pyx_k_device_type), 0, 0, 1, 1},
+ {&__pyx_n_s_frontend, __pyx_k_frontend, sizeof(__pyx_k_frontend), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_k_private_tmp_pyzmq_release_zmq_b, sizeof(__pyx_k_private_tmp_pyzmq_release_zmq_b), 0, 0, 1, 0},
+ {&__pyx_n_s_proxy, __pyx_k_proxy, sizeof(__pyx_k_proxy), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
+ {&__pyx_n_s_rc, __pyx_k_rc, sizeof(__pyx_k_rc), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_backend_cython__device, __pyx_k_zmq_backend_cython__device, sizeof(__pyx_k_zmq_backend_cython__device), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_error, __pyx_k_zmq_error, sizeof(__pyx_k_zmq_error), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ return 0;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "zmq/backend/cython/_device.pyx":36
+ * #-----------------------------------------------------------------------------
+ *
+ * def device(int device_type, cSocket frontend, cSocket backend=None): # <<<<<<<<<<<<<<
+ * """device(device_type, frontend, backend)
+ *
+ */
+ __pyx_tuple_ = PyTuple_Pack(4, __pyx_n_s_device_type, __pyx_n_s_frontend, __pyx_n_s_backend, __pyx_n_s_rc); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+ __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_device, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/_device.pyx":68
+ * return rc
+ *
+ * def proxy(cSocket frontend, cSocket backend, cSocket capture=None): # <<<<<<<<<<<<<<
+ * """proxy(frontend, backend, capture)
+ *
+ */
+ __pyx_tuple__3 = PyTuple_Pack(5, __pyx_n_s_frontend, __pyx_n_s_backend, __pyx_n_s_capture, __pyx_n_s_rc, __pyx_n_s_capture_handle); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+ __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_proxy, 68, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC init_device(void); /*proto*/
+PyMODINIT_FUNC init_device(void)
+#else
+PyMODINIT_FUNC PyInit__device(void); /*proto*/
+PyMODINIT_FUNC PyInit__device(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__device(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("_device", __pyx_methods, __pyx_k_Python_binding_for_0MQ_device_fu, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython___device) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython._device")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython._device", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ /*--- Type import code ---*/
+ __pyx_ptype_3zmq_7backend_6cython_7context_Context = __Pyx_ImportType("zmq.backend.cython.context", "Context", sizeof(struct __pyx_obj_3zmq_7backend_6cython_7context_Context), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_7context_Context)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_3zmq_7backend_6cython_7context_Context = (struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context*)__Pyx_GetVtable(__pyx_ptype_3zmq_7backend_6cython_7context_Context->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_7backend_6cython_7context_Context)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3zmq_7backend_6cython_6socket_Socket = __Pyx_ImportType("zmq.backend.cython.socket", "Socket", sizeof(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_6socket_Socket)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket = (struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket*)__Pyx_GetVtable(__pyx_ptype_3zmq_7backend_6cython_6socket_Socket->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
+ #if CYTHON_COMPILING_IN_PYPY
+ sizeof(PyTypeObject),
+ #else
+ sizeof(PyHeapTypeObject),
+ #endif
+ 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/_device.pyx":30
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ *
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ *
+ * #-----------------------------------------------------------------------------
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_InterruptedSystemCall, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/_device.pyx":36
+ * #-----------------------------------------------------------------------------
+ *
+ * def device(int device_type, cSocket frontend, cSocket backend=None): # <<<<<<<<<<<<<<
+ * """device(device_type, frontend, backend)
+ *
+ */
+ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_7_device_1device, NULL, __pyx_n_s_zmq_backend_cython__device); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_device, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/_device.pyx":68
+ * return rc
+ *
+ * def proxy(cSocket frontend, cSocket backend, cSocket capture=None): # <<<<<<<<<<<<<<
+ * """proxy(frontend, backend, capture)
+ *
+ */
+ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_7_device_3proxy, NULL, __pyx_n_s_zmq_backend_cython__device); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_proxy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/_device.pyx":102
+ * return rc
+ *
+ * __all__ = ['device', 'proxy'] # <<<<<<<<<<<<<<
+ *
+ */
+ __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_device);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_device);
+ __Pyx_GIVEREF(__pyx_n_s_device);
+ __Pyx_INCREF(__pyx_n_s_proxy);
+ PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_proxy);
+ __Pyx_GIVEREF(__pyx_n_s_proxy);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/_device.pyx":1
+ * """Python binding for 0MQ device function.""" # <<<<<<<<<<<<<<
+ *
+ * #
+ */
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython._device", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython._device");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AsString(kw_name));
+ #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ continue;
+ }
+ name = first_kw_arg;
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+ while (*name) {
+ if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**name, key)) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ if ((**argname == key) || (
+ (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**argname, key))) {
+ goto arg_passed_twice;
+ }
+ argname++;
+ }
+ }
+ } else
+ #endif
+ if (likely(PyUnicode_Check(key))) {
+ while (*name) {
+ int cmp = (**name == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**name, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ int cmp = (**argname == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**argname, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) goto arg_passed_twice;
+ argname++;
+ }
+ }
+ } else
+ goto invalid_keyword_type;
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, key);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
+ name, type->tp_name, Py_TYPE(obj)->tp_name);
+}
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact)
+{
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
+ return 0;
+ }
+ if (none_allowed && obj == Py_None) return 1;
+ else if (exact) {
+ if (likely(Py_TYPE(obj) == type)) return 1;
+ #if PY_MAJOR_VERSION == 2
+ else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
+ #endif
+ }
+ else {
+ if (likely(PyObject_TypeCheck(obj, type))) return 1;
+ }
+ __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
+ return 0;
+}
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+#else
+ PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ local_type = tstate->curexc_type;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
+ PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
+ goto bad;
+ #if PY_MAJOR_VERSION >= 3
+ if (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
+ return 0;
+bad:
+ *type = 0;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_Restore(type, value, tb);
+#endif
+}
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+static void* __Pyx_GetVtable(PyObject *dict) {
+ void* ptr;
+ PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
+ if (!ob)
+ goto bad;
+#if PY_VERSION_HEX >= 0x02070000
+ ptr = PyCapsule_GetPointer(ob, 0);
+#else
+ ptr = PyCObject_AsVoidPtr(ob);
+#endif
+ if (!ptr && !PyErr_Occurred())
+ PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
+ Py_DECREF(ob);
+ return ptr;
+bad:
+ Py_XDECREF(ob);
+ return NULL;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+ PyObject *py_name = 0;
+ PyObject *py_module = 0;
+ py_name = __Pyx_PyIdentifier_FromString(name);
+ if (!py_name)
+ goto bad;
+ py_module = PyImport_Import(py_name);
+ Py_DECREF(py_name);
+ return py_module;
+bad:
+ Py_XDECREF(py_name);
+ return 0;
+}
+#endif
+
+#ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
+ size_t size, int strict)
+{
+ PyObject *py_module = 0;
+ PyObject *result = 0;
+ PyObject *py_name = 0;
+ char warning[200];
+ Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+ PyObject *py_basicsize;
+#endif
+ py_module = __Pyx_ImportModule(module_name);
+ if (!py_module)
+ goto bad;
+ py_name = __Pyx_PyIdentifier_FromString(class_name);
+ if (!py_name)
+ goto bad;
+ result = PyObject_GetAttr(py_module, py_name);
+ Py_DECREF(py_name);
+ py_name = 0;
+ Py_DECREF(py_module);
+ py_module = 0;
+ if (!result)
+ goto bad;
+ if (!PyType_Check(result)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s.%.200s is not a type object",
+ module_name, class_name);
+ goto bad;
+ }
+#ifndef Py_LIMITED_API
+ basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+ py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+ if (!py_basicsize)
+ goto bad;
+ basicsize = PyLong_AsSsize_t(py_basicsize);
+ Py_DECREF(py_basicsize);
+ py_basicsize = 0;
+ if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+ goto bad;
+#endif
+ if (!strict && (size_t)basicsize > size) {
+ PyOS_snprintf(warning, sizeof(warning),
+ "%s.%s size changed, may indicate binary incompatibility",
+ module_name, class_name);
+ if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
+ }
+ else if ((size_t)basicsize != size) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.%.200s has the wrong size, try recompiling",
+ module_name, class_name);
+ goto bad;
+ }
+ return (PyTypeObject *)result;
+bad:
+ Py_XDECREF(py_module);
+ Py_XDECREF(result);
+ return NULL;
+}
+#endif
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_device.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_device.pyx
new file mode 100644
index 00000000..b5ba1112
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_device.pyx
@@ -0,0 +1,103 @@
+"""Python binding for 0MQ device function."""
+
+#
+# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+from libzmq cimport zmq_device, zmq_proxy, ZMQ_VERSION_MAJOR
+from zmq.backend.cython.socket cimport Socket as cSocket
+from zmq.backend.cython.checkrc cimport _check_rc
+
+from zmq.error import InterruptedSystemCall
+
+#-----------------------------------------------------------------------------
+# Basic device API
+#-----------------------------------------------------------------------------
+
+def device(int device_type, cSocket frontend, cSocket backend=None):
+ """device(device_type, frontend, backend)
+
+ Start a zeromq device.
+
+ .. deprecated:: libzmq-3.2
+ Use zmq.proxy
+
+ Parameters
+ ----------
+ device_type : (QUEUE, FORWARDER, STREAMER)
+ The type of device to start.
+ frontend : Socket
+ The Socket instance for the incoming traffic.
+ backend : Socket
+ The Socket instance for the outbound traffic.
+ """
+ if ZMQ_VERSION_MAJOR >= 3:
+ return proxy(frontend, backend)
+
+ cdef int rc = 0
+ while True:
+ with nogil:
+ rc = zmq_device(device_type, frontend.handle, backend.handle)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+ return rc
+
+def proxy(cSocket frontend, cSocket backend, cSocket capture=None):
+ """proxy(frontend, backend, capture)
+
+ Start a zeromq proxy (replacement for device).
+
+ .. versionadded:: libzmq-3.2
+ .. versionadded:: 13.0
+
+ Parameters
+ ----------
+ frontend : Socket
+ The Socket instance for the incoming traffic.
+ backend : Socket
+ The Socket instance for the outbound traffic.
+ capture : Socket (optional)
+ The Socket instance for capturing traffic.
+ """
+ cdef int rc = 0
+ cdef void* capture_handle
+ if isinstance(capture, cSocket):
+ capture_handle = capture.handle
+ else:
+ capture_handle = NULL
+ while True:
+ with nogil:
+ rc = zmq_proxy(frontend.handle, backend.handle, capture_handle)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+ return rc
+
+__all__ = ['device', 'proxy']
+
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_poll.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_poll.c
new file mode 100644
index 00000000..950392a1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_poll.c
@@ -0,0 +1,4268 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython___poll
+#define __PYX_HAVE_API__zmq__backend__cython___poll
+#include "string.h"
+#include "stdlib.h"
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#include "errno.h"
+#include "stdio.h"
+#include "pythread.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/_poll.pyx",
+ "zmq/backend/cython/checkrc.pxd",
+ "zmq/backend/cython/context.pxd",
+ "zmq/backend/cython/socket.pxd",
+ "type.pxd",
+ "bool.pxd",
+ "complex.pxd",
+};
+
+/*--- Type declarations ---*/
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context;
+struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv;
+
+/* "socket.pxd":45
+ *
+ * # cpdef methods for direct-cython access:
+ * cpdef object send(self, object data, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
+ * cpdef object recv(self, int flags=*, copy=*, track=*)
+ *
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send {
+ int __pyx_n;
+ int flags;
+ PyObject *copy;
+ PyObject *track;
+};
+
+/* "socket.pxd":46
+ * # cpdef methods for direct-cython access:
+ * cpdef object send(self, object data, int flags=*, copy=*, track=*)
+ * cpdef object recv(self, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
+ *
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv {
+ int __pyx_n;
+ int flags;
+ PyObject *copy;
+ PyObject *track;
+};
+
+/* "context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ void **_sockets;
+ size_t _n_sockets;
+ size_t _max_sockets;
+ int _pid;
+ int closed;
+};
+
+
+/* "socket.pxd":33
+ *
+ *
+ * cdef class Socket: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ struct __pyx_obj_3zmq_7backend_6cython_7context_Context *context;
+ int _closed;
+ int _pid;
+};
+
+
+
+/* "context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context {
+ int (*_term)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *);
+ void (*_add_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+ void (*_remove_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtabptr_3zmq_7backend_6cython_7context_Context;
+
+
+/* "socket.pxd":33
+ *
+ *
+ * cdef class Socket: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket {
+ PyObject *(*send)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args);
+ PyObject *(*recv)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket;
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+ const char* function_name);
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
+ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i))))
+#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
+ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
+ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck);
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+static CYTHON_INLINE int __Pyx_IterFinish(void);
+
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+ PyListObject* L = (PyListObject*) list;
+ Py_ssize_t len = Py_SIZE(list);
+ if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+ Py_INCREF(x);
+ PyList_SET_ITEM(list, len, x);
+ Py_SIZE(list) = len+1;
+ return 0;
+ }
+ return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#endif
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+static void* __Pyx_GetVtable(PyObject *dict);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *);
+
+#ifndef __PYX_FORCE_INIT_THREADS
+ #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);
+
+static int __Pyx_check_binary_version(void);
+
+#if !defined(__Pyx_PyIdentifier_FromString)
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
+#else
+ #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
+#endif
+#endif
+
+static PyObject *__Pyx_ImportModule(const char *name);
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+
+/* Module declarations from 'libc.string' */
+
+/* Module declarations from 'libc.stdlib' */
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'zmq.backend.cython.context' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7context_Context = 0;
+
+/* Module declarations from 'zmq.backend.cython.socket' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_6socket_Socket = 0;
+
+/* Module declarations from 'libc.errno' */
+
+/* Module declarations from 'cpython.version' */
+
+/* Module declarations from 'cpython.ref' */
+
+/* Module declarations from 'cpython.exc' */
+
+/* Module declarations from 'cpython.module' */
+
+/* Module declarations from 'cpython.mem' */
+
+/* Module declarations from 'cpython.tuple' */
+
+/* Module declarations from 'cpython.list' */
+
+/* Module declarations from 'libc.stdio' */
+
+/* Module declarations from 'cpython.object' */
+
+/* Module declarations from 'cpython.sequence' */
+
+/* Module declarations from 'cpython.mapping' */
+
+/* Module declarations from 'cpython.iterator' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
+
+/* Module declarations from 'cpython.number' */
+
+/* Module declarations from 'cpython.int' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.bool' */
+static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
+
+/* Module declarations from 'cpython.long' */
+
+/* Module declarations from 'cpython.float' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.complex' */
+static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
+
+/* Module declarations from 'cpython.string' */
+
+/* Module declarations from 'cpython.unicode' */
+
+/* Module declarations from 'cpython.dict' */
+
+/* Module declarations from 'cpython.instance' */
+
+/* Module declarations from 'cpython.function' */
+
+/* Module declarations from 'cpython.method' */
+
+/* Module declarations from 'cpython.weakref' */
+
+/* Module declarations from 'cpython.getargs' */
+
+/* Module declarations from 'cpython.pythread' */
+
+/* Module declarations from 'cpython.pystate' */
+
+/* Module declarations from 'cpython.cobject' */
+
+/* Module declarations from 'cpython.oldbuffer' */
+
+/* Module declarations from 'cpython.set' */
+
+/* Module declarations from 'cpython.buffer' */
+
+/* Module declarations from 'cpython.bytes' */
+
+/* Module declarations from 'cpython.pycapsule' */
+
+/* Module declarations from 'cpython' */
+
+/* Module declarations from 'zmq.backend.cython.checkrc' */
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int); /*proto*/
+
+/* Module declarations from 'zmq.backend.cython._poll' */
+#define __Pyx_MODULE_NAME "zmq.backend.cython._poll"
+int __pyx_module_is_main_zmq__backend__cython___poll = 0;
+
+/* Implementation of 'zmq.backend.cython._poll' */
+static PyObject *__pyx_builtin_MemoryError;
+static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_ValueError;
+static PyObject *__pyx_builtin_TypeError;
+static PyObject *__pyx_builtin_Exception;
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5_poll_zmq_poll(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sockets, long __pyx_v_timeout); /* proto */
+static char __pyx_k_i[] = "i";
+static char __pyx_k_s[] = "s";
+static char __pyx_k_rc[] = "rc";
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_sys[] = "sys";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_Again[] = "Again";
+static char __pyx_k_int_t[] = "int_t";
+static char __pyx_k_range[] = "range";
+static char __pyx_k_events[] = "events";
+static char __pyx_k_fileno[] = "fileno";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_results[] = "results";
+static char __pyx_k_revents[] = "revents";
+static char __pyx_k_sockets[] = "sockets";
+static char __pyx_k_timeout[] = "timeout";
+static char __pyx_k_ZMQError[] = "ZMQError";
+static char __pyx_k_nsockets[] = "nsockets";
+static char __pyx_k_zmq_poll[] = "zmq_poll";
+static char __pyx_k_Exception[] = "Exception";
+static char __pyx_k_TypeError[] = "TypeError";
+static char __pyx_k_pollitems[] = "pollitems";
+static char __pyx_k_zmq_error[] = "zmq.error";
+static char __pyx_k_ValueError[] = "ValueError";
+static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static char __pyx_k_MemoryError[] = "MemoryError";
+static char __pyx_k_version_info[] = "version_info";
+static char __pyx_k_current_socket[] = "current_socket";
+static char __pyx_k_ContextTerminated[] = "ContextTerminated";
+static char __pyx_k_InterruptedSystemCall[] = "InterruptedSystemCall";
+static char __pyx_k_zmq_backend_cython__poll[] = "zmq.backend.cython._poll";
+static char __pyx_k_Could_not_allocate_poll_items[] = "Could not allocate poll items";
+static char __pyx_k_private_tmp_pyzmq_release_zmq_b[] = "/private/tmp/pyzmq-release/zmq/backend/cython/_poll.pyx";
+static char __pyx_k_0MQ_polling_related_functions_an[] = "0MQ polling related functions and classes.";
+static char __pyx_k_Socket_must_be_a_0MQ_socket_an_i[] = "Socket must be a 0MQ socket, an integer fd or have a fileno() method: %r";
+static char __pyx_k_fileno_must_return_a_valid_integ[] = "fileno() must return a valid integer fd";
+static PyObject *__pyx_n_s_Again;
+static PyObject *__pyx_n_s_ContextTerminated;
+static PyObject *__pyx_kp_s_Could_not_allocate_poll_items;
+static PyObject *__pyx_n_s_Exception;
+static PyObject *__pyx_n_s_InterruptedSystemCall;
+static PyObject *__pyx_n_s_MemoryError;
+static PyObject *__pyx_kp_s_Socket_must_be_a_0MQ_socket_an_i;
+static PyObject *__pyx_n_s_TypeError;
+static PyObject *__pyx_n_s_ValueError;
+static PyObject *__pyx_n_s_ZMQError;
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_current_socket;
+static PyObject *__pyx_n_s_events;
+static PyObject *__pyx_n_s_fileno;
+static PyObject *__pyx_kp_s_fileno_must_return_a_valid_integ;
+static PyObject *__pyx_n_s_i;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_int_t;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_nsockets;
+static PyObject *__pyx_n_s_pollitems;
+static PyObject *__pyx_kp_s_private_tmp_pyzmq_release_zmq_b;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_n_s_range;
+static PyObject *__pyx_n_s_rc;
+static PyObject *__pyx_n_s_results;
+static PyObject *__pyx_n_s_revents;
+static PyObject *__pyx_n_s_s;
+static PyObject *__pyx_n_s_sockets;
+static PyObject *__pyx_n_s_sys;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_timeout;
+static PyObject *__pyx_n_s_version_info;
+static PyObject *__pyx_n_s_zmq_backend_cython__poll;
+static PyObject *__pyx_n_s_zmq_error;
+static PyObject *__pyx_n_s_zmq_poll;
+static PyObject *__pyx_int_3;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__2;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_codeobj__4;
+
+/* "zmq/backend/cython/_poll.pyx":48
+ *
+ *
+ * def zmq_poll(sockets, long timeout=-1): # <<<<<<<<<<<<<<
+ * """zmq_poll(sockets, timeout=-1)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5_poll_1zmq_poll(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_5_poll_zmq_poll[] = "zmq_poll(sockets, timeout=-1)\n\n Poll a set of 0MQ sockets, native file descs. or sockets.\n\n Parameters\n ----------\n sockets : list of tuples of (socket, flags)\n Each element of this list is a two-tuple containing a socket\n and a flags. The socket may be a 0MQ socket or any object with\n a ``fileno()`` method. The flags can be zmq.POLLIN (for detecting\n for incoming messages), zmq.POLLOUT (for detecting that send is OK)\n or zmq.POLLIN|zmq.POLLOUT for detecting both.\n timeout : int\n The number of milliseconds to poll for. Negative means no timeout.\n ";
+static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_5_poll_1zmq_poll = {"zmq_poll", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5_poll_1zmq_poll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_5_poll_zmq_poll};
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5_poll_1zmq_poll(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_sockets = 0;
+ long __pyx_v_timeout;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("zmq_poll (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sockets,&__pyx_n_s_timeout,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sockets)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zmq_poll") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_sockets = values[0];
+ if (values[1]) {
+ __pyx_v_timeout = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ } else {
+ __pyx_v_timeout = ((long)-1);
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("zmq_poll", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython._poll.zmq_poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5_poll_zmq_poll(__pyx_self, __pyx_v_sockets, __pyx_v_timeout);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5_poll_zmq_poll(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sockets, long __pyx_v_timeout) {
+ int __pyx_v_rc;
+ int __pyx_v_i;
+ zmq_pollitem_t *__pyx_v_pollitems;
+ int __pyx_v_nsockets;
+ PyObject *__pyx_v_s = NULL;
+ PyObject *__pyx_v_events = NULL;
+ PyObject *__pyx_v_fileno = NULL;
+ PyObject *__pyx_v_results = NULL;
+ short __pyx_v_revents;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ Py_ssize_t __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ int __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *(*__pyx_t_9)(PyObject *);
+ int __pyx_t_10;
+ void *__pyx_t_11;
+ short __pyx_t_12;
+ int __pyx_t_13;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ PyObject *__pyx_t_17 = NULL;
+ PyObject *__pyx_t_18 = NULL;
+ PyObject *__pyx_t_19 = NULL;
+ int __pyx_t_20;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("zmq_poll", 0);
+
+ /* "zmq/backend/cython/_poll.pyx":65
+ * """
+ * cdef int rc, i
+ * cdef zmq_pollitem_t *pollitems = NULL # <<<<<<<<<<<<<<
+ * cdef int nsockets = <int>len(sockets)
+ * cdef Socket current_socket
+ */
+ __pyx_v_pollitems = NULL;
+
+ /* "zmq/backend/cython/_poll.pyx":66
+ * cdef int rc, i
+ * cdef zmq_pollitem_t *pollitems = NULL
+ * cdef int nsockets = <int>len(sockets) # <<<<<<<<<<<<<<
+ * cdef Socket current_socket
+ *
+ */
+ __pyx_t_1 = PyObject_Length(__pyx_v_sockets); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_nsockets = ((int)__pyx_t_1);
+
+ /* "zmq/backend/cython/_poll.pyx":69
+ * cdef Socket current_socket
+ *
+ * if nsockets == 0: # <<<<<<<<<<<<<<
+ * return []
+ *
+ */
+ __pyx_t_2 = ((__pyx_v_nsockets == 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/_poll.pyx":70
+ *
+ * if nsockets == 0:
+ * return [] # <<<<<<<<<<<<<<
+ *
+ * pollitems = <zmq_pollitem_t *>malloc(nsockets*sizeof(zmq_pollitem_t))
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":72
+ * return []
+ *
+ * pollitems = <zmq_pollitem_t *>malloc(nsockets*sizeof(zmq_pollitem_t)) # <<<<<<<<<<<<<<
+ * if pollitems == NULL:
+ * raise MemoryError("Could not allocate poll items")
+ */
+ __pyx_v_pollitems = ((zmq_pollitem_t *)malloc((__pyx_v_nsockets * (sizeof(zmq_pollitem_t)))));
+
+ /* "zmq/backend/cython/_poll.pyx":73
+ *
+ * pollitems = <zmq_pollitem_t *>malloc(nsockets*sizeof(zmq_pollitem_t))
+ * if pollitems == NULL: # <<<<<<<<<<<<<<
+ * raise MemoryError("Could not allocate poll items")
+ *
+ */
+ __pyx_t_2 = ((__pyx_v_pollitems == NULL) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/_poll.pyx":74
+ * pollitems = <zmq_pollitem_t *>malloc(nsockets*sizeof(zmq_pollitem_t))
+ * if pollitems == NULL:
+ * raise MemoryError("Could not allocate poll items") # <<<<<<<<<<<<<<
+ *
+ * if ZMQ_VERSION_MAJOR < 3:
+ */
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":76
+ * raise MemoryError("Could not allocate poll items")
+ *
+ * if ZMQ_VERSION_MAJOR < 3: # <<<<<<<<<<<<<<
+ * # timeout is us in 2.x, ms in 3.x
+ * # expected input is ms (matches 3.x)
+ */
+ __pyx_t_2 = ((ZMQ_VERSION_MAJOR < 3) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/_poll.pyx":79
+ * # timeout is us in 2.x, ms in 3.x
+ * # expected input is ms (matches 3.x)
+ * timeout = 1000*timeout # <<<<<<<<<<<<<<
+ *
+ * for i in range(nsockets):
+ */
+ __pyx_v_timeout = (1000 * __pyx_v_timeout);
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "zmq/backend/cython/_poll.pyx":81
+ * timeout = 1000*timeout
+ *
+ * for i in range(nsockets): # <<<<<<<<<<<<<<
+ * s, events = sockets[i]
+ * if isinstance(s, Socket):
+ */
+ __pyx_t_4 = __pyx_v_nsockets;
+ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
+ __pyx_v_i = __pyx_t_5;
+
+ /* "zmq/backend/cython/_poll.pyx":82
+ *
+ * for i in range(nsockets):
+ * s, events = sockets[i] # <<<<<<<<<<<<<<
+ * if isinstance(s, Socket):
+ * pollitems[i].socket = (<Socket>s).handle
+ */
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_sockets, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ Py_ssize_t size = Py_SIZE(sequence);
+ #else
+ Py_ssize_t size = PySequence_Size(sequence);
+ #endif
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #if CYTHON_COMPILING_IN_CPYTHON
+ if (likely(PyTuple_CheckExact(sequence))) {
+ __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
+ } else {
+ __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
+ }
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ #else
+ __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ #endif
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ Py_ssize_t index = -1;
+ __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
+ index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_6);
+ index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = NULL;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L9_unpacking_done;
+ __pyx_L8_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_9 = NULL;
+ if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L9_unpacking_done:;
+ }
+ __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_events, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":83
+ * for i in range(nsockets):
+ * s, events = sockets[i]
+ * if isinstance(s, Socket): # <<<<<<<<<<<<<<
+ * pollitems[i].socket = (<Socket>s).handle
+ * pollitems[i].events = events
+ */
+ __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_s, ((PyObject*)__pyx_ptype_3zmq_7backend_6cython_6socket_Socket));
+ __pyx_t_10 = (__pyx_t_2 != 0);
+ if (__pyx_t_10) {
+
+ /* "zmq/backend/cython/_poll.pyx":84
+ * s, events = sockets[i]
+ * if isinstance(s, Socket):
+ * pollitems[i].socket = (<Socket>s).handle # <<<<<<<<<<<<<<
+ * pollitems[i].events = events
+ * pollitems[i].revents = 0
+ */
+ __pyx_t_11 = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_s)->handle;
+ (__pyx_v_pollitems[__pyx_v_i]).socket = __pyx_t_11;
+
+ /* "zmq/backend/cython/_poll.pyx":85
+ * if isinstance(s, Socket):
+ * pollitems[i].socket = (<Socket>s).handle
+ * pollitems[i].events = events # <<<<<<<<<<<<<<
+ * pollitems[i].revents = 0
+ * elif isinstance(s, int_t):
+ */
+ __pyx_t_12 = __Pyx_PyInt_As_short(__pyx_v_events); if (unlikely((__pyx_t_12 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ (__pyx_v_pollitems[__pyx_v_i]).events = __pyx_t_12;
+
+ /* "zmq/backend/cython/_poll.pyx":86
+ * pollitems[i].socket = (<Socket>s).handle
+ * pollitems[i].events = events
+ * pollitems[i].revents = 0 # <<<<<<<<<<<<<<
+ * elif isinstance(s, int_t):
+ * pollitems[i].socket = NULL
+ */
+ (__pyx_v_pollitems[__pyx_v_i]).revents = 0;
+ goto __pyx_L10;
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":87
+ * pollitems[i].events = events
+ * pollitems[i].revents = 0
+ * elif isinstance(s, int_t): # <<<<<<<<<<<<<<
+ * pollitems[i].socket = NULL
+ * pollitems[i].fd = s
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_int_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_10 = PyObject_IsInstance(__pyx_v_s, __pyx_t_3); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_2 = (__pyx_t_10 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/_poll.pyx":88
+ * pollitems[i].revents = 0
+ * elif isinstance(s, int_t):
+ * pollitems[i].socket = NULL # <<<<<<<<<<<<<<
+ * pollitems[i].fd = s
+ * pollitems[i].events = events
+ */
+ (__pyx_v_pollitems[__pyx_v_i]).socket = NULL;
+
+ /* "zmq/backend/cython/_poll.pyx":89
+ * elif isinstance(s, int_t):
+ * pollitems[i].socket = NULL
+ * pollitems[i].fd = s # <<<<<<<<<<<<<<
+ * pollitems[i].events = events
+ * pollitems[i].revents = 0
+ */
+ __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_s); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ (__pyx_v_pollitems[__pyx_v_i]).fd = __pyx_t_13;
+
+ /* "zmq/backend/cython/_poll.pyx":90
+ * pollitems[i].socket = NULL
+ * pollitems[i].fd = s
+ * pollitems[i].events = events # <<<<<<<<<<<<<<
+ * pollitems[i].revents = 0
+ * elif hasattr(s, 'fileno'):
+ */
+ __pyx_t_12 = __Pyx_PyInt_As_short(__pyx_v_events); if (unlikely((__pyx_t_12 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ (__pyx_v_pollitems[__pyx_v_i]).events = __pyx_t_12;
+
+ /* "zmq/backend/cython/_poll.pyx":91
+ * pollitems[i].fd = s
+ * pollitems[i].events = events
+ * pollitems[i].revents = 0 # <<<<<<<<<<<<<<
+ * elif hasattr(s, 'fileno'):
+ * try:
+ */
+ (__pyx_v_pollitems[__pyx_v_i]).revents = 0;
+ goto __pyx_L10;
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":92
+ * pollitems[i].events = events
+ * pollitems[i].revents = 0
+ * elif hasattr(s, 'fileno'): # <<<<<<<<<<<<<<
+ * try:
+ * fileno = int(s.fileno())
+ */
+ __pyx_t_2 = PyObject_HasAttr(__pyx_v_s, __pyx_n_s_fileno); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = (__pyx_t_2 != 0);
+ if (__pyx_t_10) {
+
+ /* "zmq/backend/cython/_poll.pyx":93
+ * pollitems[i].revents = 0
+ * elif hasattr(s, 'fileno'):
+ * try: # <<<<<<<<<<<<<<
+ * fileno = int(s.fileno())
+ * except:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_16);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":94
+ * elif hasattr(s, 'fileno'):
+ * try:
+ * fileno = int(s.fileno()) # <<<<<<<<<<<<<<
+ * except:
+ * free(pollitems)
+ */
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_fileno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_fileno, __pyx_t_7);
+ __pyx_t_7 = 0;
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":99
+ * raise ValueError('fileno() must return a valid integer fd')
+ * else:
+ * pollitems[i].socket = NULL # <<<<<<<<<<<<<<
+ * pollitems[i].fd = fileno
+ * pollitems[i].events = events
+ */
+ (__pyx_v_pollitems[__pyx_v_i]).socket = NULL;
+
+ /* "zmq/backend/cython/_poll.pyx":100
+ * else:
+ * pollitems[i].socket = NULL
+ * pollitems[i].fd = fileno # <<<<<<<<<<<<<<
+ * pollitems[i].events = events
+ * pollitems[i].revents = 0
+ */
+ __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_fileno); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ (__pyx_v_pollitems[__pyx_v_i]).fd = __pyx_t_13;
+
+ /* "zmq/backend/cython/_poll.pyx":101
+ * pollitems[i].socket = NULL
+ * pollitems[i].fd = fileno
+ * pollitems[i].events = events # <<<<<<<<<<<<<<
+ * pollitems[i].revents = 0
+ * else:
+ */
+ __pyx_t_12 = __Pyx_PyInt_As_short(__pyx_v_events); if (unlikely((__pyx_t_12 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ (__pyx_v_pollitems[__pyx_v_i]).events = __pyx_t_12;
+
+ /* "zmq/backend/cython/_poll.pyx":102
+ * pollitems[i].fd = fileno
+ * pollitems[i].events = events
+ * pollitems[i].revents = 0 # <<<<<<<<<<<<<<
+ * else:
+ * free(pollitems)
+ */
+ (__pyx_v_pollitems[__pyx_v_i]).revents = 0;
+ }
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ goto __pyx_L18_try_end;
+ __pyx_L11_error:;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":95
+ * try:
+ * fileno = int(s.fileno())
+ * except: # <<<<<<<<<<<<<<
+ * free(pollitems)
+ * raise ValueError('fileno() must return a valid integer fd')
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("zmq.backend.cython._poll.zmq_poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "zmq/backend/cython/_poll.pyx":96
+ * fileno = int(s.fileno())
+ * except:
+ * free(pollitems) # <<<<<<<<<<<<<<
+ * raise ValueError('fileno() must return a valid integer fd')
+ * else:
+ */
+ free(__pyx_v_pollitems);
+
+ /* "zmq/backend/cython/_poll.pyx":97
+ * except:
+ * free(pollitems)
+ * raise ValueError('fileno() must return a valid integer fd') # <<<<<<<<<<<<<<
+ * else:
+ * pollitems[i].socket = NULL
+ */
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ }
+ __pyx_L13_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
+ goto __pyx_L1_error;
+ __pyx_L18_try_end:;
+ }
+ goto __pyx_L10;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":104
+ * pollitems[i].revents = 0
+ * else:
+ * free(pollitems) # <<<<<<<<<<<<<<
+ * raise TypeError(
+ * "Socket must be a 0MQ socket, an integer fd or have "
+ */
+ free(__pyx_v_pollitems);
+
+ /* "zmq/backend/cython/_poll.pyx":107
+ * raise TypeError(
+ * "Socket must be a 0MQ socket, an integer fd or have "
+ * "a fileno() method: %r" % s # <<<<<<<<<<<<<<
+ * )
+ *
+ */
+ __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Socket_must_be_a_0MQ_socket_an_i, __pyx_v_s); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "zmq/backend/cython/_poll.pyx":105
+ * else:
+ * free(pollitems)
+ * raise TypeError( # <<<<<<<<<<<<<<
+ * "Socket must be a 0MQ socket, an integer fd or have "
+ * "a fileno() method: %r" % s
+ */
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_L10:;
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":110
+ * )
+ *
+ * try: # <<<<<<<<<<<<<<
+ * while True:
+ * with nogil:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_16);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __Pyx_XGOTREF(__pyx_t_14);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":111
+ *
+ * try:
+ * while True: # <<<<<<<<<<<<<<
+ * with nogil:
+ * rc = zmq_poll_c(pollitems, nsockets, timeout)
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/_poll.pyx":112
+ * try:
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_poll_c(pollitems, nsockets, timeout)
+ * try:
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":113
+ * while True:
+ * with nogil:
+ * rc = zmq_poll_c(pollitems, nsockets, timeout) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = zmq_poll(__pyx_v_pollitems, __pyx_v_nsockets, __pyx_v_timeout);
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":112
+ * try:
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_poll_c(pollitems, nsockets, timeout)
+ * try:
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L35;
+ }
+ __pyx_L35:;
+ }
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":114
+ * with nogil:
+ * rc = zmq_poll_c(pollitems, nsockets, timeout)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
+ __Pyx_XGOTREF(__pyx_t_17);
+ __Pyx_XGOTREF(__pyx_t_18);
+ __Pyx_XGOTREF(__pyx_t_19);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":115
+ * rc = zmq_poll_c(pollitems, nsockets, timeout)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_4 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L36_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":119
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ * except Exception:
+ * free(pollitems)
+ */
+ goto __pyx_L41_try_break;
+ }
+ __pyx_L36_error:;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":116
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L38_except_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("zmq.backend.cython._poll.zmq_poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L38_except_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "zmq/backend/cython/_poll.pyx":117
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L45_except_continue;
+ __pyx_L45_except_continue:;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L42_try_continue;
+ }
+ goto __pyx_L38_except_error;
+ __pyx_L38_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_XGIVEREF(__pyx_t_19);
+ __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
+ goto __pyx_L21_error;
+ __pyx_L41_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_XGIVEREF(__pyx_t_19);
+ __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
+ goto __pyx_L30_break;
+ __pyx_L42_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_17);
+ __Pyx_XGIVEREF(__pyx_t_18);
+ __Pyx_XGIVEREF(__pyx_t_19);
+ __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
+ goto __pyx_L29_continue;
+ }
+ __pyx_L29_continue:;
+ }
+ __pyx_L30_break:;
+ }
+ __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ goto __pyx_L28_try_end;
+ __pyx_L21_error:;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":120
+ * else:
+ * break
+ * except Exception: # <<<<<<<<<<<<<<
+ * free(pollitems)
+ * raise
+ */
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("zmq.backend.cython._poll.zmq_poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "zmq/backend/cython/_poll.pyx":121
+ * break
+ * except Exception:
+ * free(pollitems) # <<<<<<<<<<<<<<
+ * raise
+ *
+ */
+ free(__pyx_v_pollitems);
+
+ /* "zmq/backend/cython/_poll.pyx":122
+ * except Exception:
+ * free(pollitems)
+ * raise # <<<<<<<<<<<<<<
+ *
+ * results = []
+ */
+ __Pyx_GIVEREF(__pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ErrRestore(__pyx_t_7, __pyx_t_3, __pyx_t_6);
+ __pyx_t_7 = 0; __pyx_t_3 = 0; __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+ }
+ goto __pyx_L23_except_error;
+ __pyx_L23_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14);
+ goto __pyx_L1_error;
+ __pyx_L28_try_end:;
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":124
+ * raise
+ *
+ * results = [] # <<<<<<<<<<<<<<
+ * for i in range(nsockets):
+ * revents = pollitems[i].revents
+ */
+ __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_v_results = ((PyObject*)__pyx_t_6);
+ __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":125
+ *
+ * results = []
+ * for i in range(nsockets): # <<<<<<<<<<<<<<
+ * revents = pollitems[i].revents
+ * # for compatibility with select.poll:
+ */
+ __pyx_t_4 = __pyx_v_nsockets;
+ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
+ __pyx_v_i = __pyx_t_5;
+
+ /* "zmq/backend/cython/_poll.pyx":126
+ * results = []
+ * for i in range(nsockets):
+ * revents = pollitems[i].revents # <<<<<<<<<<<<<<
+ * # for compatibility with select.poll:
+ * # - only return sockets with non-zero status
+ */
+ __pyx_t_12 = (__pyx_v_pollitems[__pyx_v_i]).revents;
+ __pyx_v_revents = __pyx_t_12;
+
+ /* "zmq/backend/cython/_poll.pyx":130
+ * # - only return sockets with non-zero status
+ * # - return the fd for plain sockets
+ * if revents > 0: # <<<<<<<<<<<<<<
+ * if pollitems[i].socket != NULL:
+ * s = sockets[i][0]
+ */
+ __pyx_t_10 = ((__pyx_v_revents > 0) != 0);
+ if (__pyx_t_10) {
+
+ /* "zmq/backend/cython/_poll.pyx":131
+ * # - return the fd for plain sockets
+ * if revents > 0:
+ * if pollitems[i].socket != NULL: # <<<<<<<<<<<<<<
+ * s = sockets[i][0]
+ * else:
+ */
+ __pyx_t_10 = (((__pyx_v_pollitems[__pyx_v_i]).socket != NULL) != 0);
+ if (__pyx_t_10) {
+
+ /* "zmq/backend/cython/_poll.pyx":132
+ * if revents > 0:
+ * if pollitems[i].socket != NULL:
+ * s = sockets[i][0] # <<<<<<<<<<<<<<
+ * else:
+ * s = pollitems[i].fd
+ */
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_sockets, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_3);
+ __pyx_t_3 = 0;
+ goto __pyx_L51;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":134
+ * s = sockets[i][0]
+ * else:
+ * s = pollitems[i].fd # <<<<<<<<<<<<<<
+ * results.append((s, revents))
+ *
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_pollitems[__pyx_v_i]).fd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_3);
+ __pyx_t_3 = 0;
+ }
+ __pyx_L51:;
+
+ /* "zmq/backend/cython/_poll.pyx":135
+ * else:
+ * s = pollitems[i].fd
+ * results.append((s, revents)) # <<<<<<<<<<<<<<
+ *
+ * free(pollitems)
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_short(__pyx_v_revents); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_v_s);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_s);
+ __Pyx_GIVEREF(__pyx_v_s);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_20 = __Pyx_PyList_Append(__pyx_v_results, __pyx_t_6); if (unlikely(__pyx_t_20 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L50;
+ }
+ __pyx_L50:;
+ }
+
+ /* "zmq/backend/cython/_poll.pyx":137
+ * results.append((s, revents))
+ *
+ * free(pollitems) # <<<<<<<<<<<<<<
+ * return results
+ *
+ */
+ free(__pyx_v_pollitems);
+
+ /* "zmq/backend/cython/_poll.pyx":138
+ *
+ * free(pollitems)
+ * return results # <<<<<<<<<<<<<<
+ *
+ * #-----------------------------------------------------------------------------
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_results);
+ __pyx_r = __pyx_v_results;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/_poll.pyx":48
+ *
+ *
+ * def zmq_poll(sockets, long timeout=-1): # <<<<<<<<<<<<<<
+ * """zmq_poll(sockets, timeout=-1)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("zmq.backend.cython._poll.zmq_poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_s);
+ __Pyx_XDECREF(__pyx_v_events);
+ __Pyx_XDECREF(__pyx_v_fileno);
+ __Pyx_XDECREF(__pyx_v_results);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int __pyx_v_rc) {
+ int __pyx_v_errno;
+ PyObject *__pyx_v_InterruptedSystemCall = NULL;
+ PyObject *__pyx_v_Again = NULL;
+ PyObject *__pyx_v_ContextTerminated = NULL;
+ PyObject *__pyx_v_ZMQError = NULL;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_check_rc", 0);
+
+ /* "zmq/backend/cython/checkrc.pxd":11
+ * and raising the appropriate Exception class
+ * """
+ * cdef int errno = zmq_errno() # <<<<<<<<<<<<<<
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ */
+ __pyx_v_errno = zmq_errno();
+
+ /* "zmq/backend/cython/checkrc.pxd":12
+ * """
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals() # <<<<<<<<<<<<<<
+ * if rc < 0:
+ * if errno == EINTR:
+ */
+ __pyx_t_1 = PyErr_CheckSignals(); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/checkrc.pxd":13
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals()
+ * if rc < 0: # <<<<<<<<<<<<<<
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ */
+ __pyx_t_2 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ switch (__pyx_v_errno) {
+
+ /* "zmq/backend/cython/checkrc.pxd":14
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ * if errno == EINTR: # <<<<<<<<<<<<<<
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ */
+ case EINTR:
+
+ /* "zmq/backend/cython/checkrc.pxd":15
+ * if rc < 0:
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ */
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_4 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_InterruptedSystemCall = __pyx_t_3;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":16
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno) # <<<<<<<<<<<<<<
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_InterruptedSystemCall);
+ __pyx_t_5 = __pyx_v_InterruptedSystemCall; __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":17
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN: # <<<<<<<<<<<<<<
+ * from zmq.error import Again
+ * raise Again(errno)
+ */
+ case EAGAIN:
+
+ /* "zmq/backend/cython/checkrc.pxd":18
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ * from zmq.error import Again # <<<<<<<<<<<<<<
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ */
+ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_Again);
+ PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Again);
+ __Pyx_GIVEREF(__pyx_n_s_Again);
+ __pyx_t_5 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Again); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v_Again = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":19
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ * raise Again(errno) # <<<<<<<<<<<<<<
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ */
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_Again);
+ __pyx_t_7 = __pyx_v_Again; __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ case ETERM:
+
+ /* "zmq/backend/cython/checkrc.pxd":21
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated # <<<<<<<<<<<<<<
+ * raise ContextTerminated(errno)
+ * else:
+ */
+ __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_ContextTerminated);
+ PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_ContextTerminated);
+ __Pyx_GIVEREF(__pyx_n_s_ContextTerminated);
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_5, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ContextTerminated); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_v_ContextTerminated = __pyx_t_5;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":22
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno) # <<<<<<<<<<<<<<
+ * else:
+ * from zmq.error import ZMQError
+ */
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_v_ContextTerminated);
+ __pyx_t_6 = __pyx_v_ContextTerminated; __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_t_7, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ default:
+
+ /* "zmq/backend/cython/checkrc.pxd":24
+ * raise ContextTerminated(errno)
+ * else:
+ * from zmq.error import ZMQError # <<<<<<<<<<<<<<
+ * raise ZMQError(errno)
+ * return 0
+ */
+ __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_7, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_7);
+ __pyx_v_ZMQError = __pyx_t_7;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":25
+ * else:
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno) # <<<<<<<<<<<<<<
+ * return 0
+ */
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_v_ZMQError);
+ __pyx_t_3 = __pyx_v_ZMQError; __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ }
+ }
+
+ /* "zmq/backend/cython/checkrc.pxd":26
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno)
+ * return 0 # <<<<<<<<<<<<<<
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.checkrc._check_rc", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_InterruptedSystemCall);
+ __Pyx_XDECREF(__pyx_v_Again);
+ __Pyx_XDECREF(__pyx_v_ContextTerminated);
+ __Pyx_XDECREF(__pyx_v_ZMQError);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "_poll",
+ __pyx_k_0MQ_polling_related_functions_an, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_Again, __pyx_k_Again, sizeof(__pyx_k_Again), 0, 0, 1, 1},
+ {&__pyx_n_s_ContextTerminated, __pyx_k_ContextTerminated, sizeof(__pyx_k_ContextTerminated), 0, 0, 1, 1},
+ {&__pyx_kp_s_Could_not_allocate_poll_items, __pyx_k_Could_not_allocate_poll_items, sizeof(__pyx_k_Could_not_allocate_poll_items), 0, 0, 1, 0},
+ {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
+ {&__pyx_n_s_InterruptedSystemCall, __pyx_k_InterruptedSystemCall, sizeof(__pyx_k_InterruptedSystemCall), 0, 0, 1, 1},
+ {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
+ {&__pyx_kp_s_Socket_must_be_a_0MQ_socket_an_i, __pyx_k_Socket_must_be_a_0MQ_socket_an_i, sizeof(__pyx_k_Socket_must_be_a_0MQ_socket_an_i), 0, 0, 1, 0},
+ {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
+ {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
+ {&__pyx_n_s_ZMQError, __pyx_k_ZMQError, sizeof(__pyx_k_ZMQError), 0, 0, 1, 1},
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_current_socket, __pyx_k_current_socket, sizeof(__pyx_k_current_socket), 0, 0, 1, 1},
+ {&__pyx_n_s_events, __pyx_k_events, sizeof(__pyx_k_events), 0, 0, 1, 1},
+ {&__pyx_n_s_fileno, __pyx_k_fileno, sizeof(__pyx_k_fileno), 0, 0, 1, 1},
+ {&__pyx_kp_s_fileno_must_return_a_valid_integ, __pyx_k_fileno_must_return_a_valid_integ, sizeof(__pyx_k_fileno_must_return_a_valid_integ), 0, 0, 1, 0},
+ {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_int_t, __pyx_k_int_t, sizeof(__pyx_k_int_t), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_nsockets, __pyx_k_nsockets, sizeof(__pyx_k_nsockets), 0, 0, 1, 1},
+ {&__pyx_n_s_pollitems, __pyx_k_pollitems, sizeof(__pyx_k_pollitems), 0, 0, 1, 1},
+ {&__pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_k_private_tmp_pyzmq_release_zmq_b, sizeof(__pyx_k_private_tmp_pyzmq_release_zmq_b), 0, 0, 1, 0},
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
+ {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
+ {&__pyx_n_s_rc, __pyx_k_rc, sizeof(__pyx_k_rc), 0, 0, 1, 1},
+ {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1},
+ {&__pyx_n_s_revents, __pyx_k_revents, sizeof(__pyx_k_revents), 0, 0, 1, 1},
+ {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
+ {&__pyx_n_s_sockets, __pyx_k_sockets, sizeof(__pyx_k_sockets), 0, 0, 1, 1},
+ {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1},
+ {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_backend_cython__poll, __pyx_k_zmq_backend_cython__poll, sizeof(__pyx_k_zmq_backend_cython__poll), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_error, __pyx_k_zmq_error, sizeof(__pyx_k_zmq_error), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_poll, __pyx_k_zmq_poll, sizeof(__pyx_k_zmq_poll), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "zmq/backend/cython/_poll.pyx":74
+ * pollitems = <zmq_pollitem_t *>malloc(nsockets*sizeof(zmq_pollitem_t))
+ * if pollitems == NULL:
+ * raise MemoryError("Could not allocate poll items") # <<<<<<<<<<<<<<
+ *
+ * if ZMQ_VERSION_MAJOR < 3:
+ */
+ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Could_not_allocate_poll_items); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+
+ /* "zmq/backend/cython/_poll.pyx":97
+ * except:
+ * free(pollitems)
+ * raise ValueError('fileno() must return a valid integer fd') # <<<<<<<<<<<<<<
+ * else:
+ * pollitems[i].socket = NULL
+ */
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_fileno_must_return_a_valid_integ); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__2);
+ __Pyx_GIVEREF(__pyx_tuple__2);
+
+ /* "zmq/backend/cython/_poll.pyx":48
+ *
+ *
+ * def zmq_poll(sockets, long timeout=-1): # <<<<<<<<<<<<<<
+ * """zmq_poll(sockets, timeout=-1)
+ *
+ */
+ __pyx_tuple__3 = PyTuple_Pack(12, __pyx_n_s_sockets, __pyx_n_s_timeout, __pyx_n_s_rc, __pyx_n_s_i, __pyx_n_s_pollitems, __pyx_n_s_nsockets, __pyx_n_s_current_socket, __pyx_n_s_s, __pyx_n_s_events, __pyx_n_s_fileno, __pyx_n_s_results, __pyx_n_s_revents); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+ __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_zmq_poll, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC init_poll(void); /*proto*/
+PyMODINIT_FUNC init_poll(void)
+#else
+PyMODINIT_FUNC PyInit__poll(void); /*proto*/
+PyMODINIT_FUNC PyInit__poll(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__poll(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("_poll", __pyx_methods, __pyx_k_0MQ_polling_related_functions_an, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython___poll) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython._poll")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython._poll", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ /*--- Type import code ---*/
+ __pyx_ptype_3zmq_7backend_6cython_7context_Context = __Pyx_ImportType("zmq.backend.cython.context", "Context", sizeof(struct __pyx_obj_3zmq_7backend_6cython_7context_Context), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_7context_Context)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_3zmq_7backend_6cython_7context_Context = (struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context*)__Pyx_GetVtable(__pyx_ptype_3zmq_7backend_6cython_7context_Context->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_7backend_6cython_7context_Context)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3zmq_7backend_6cython_6socket_Socket = __Pyx_ImportType("zmq.backend.cython.socket", "Socket", sizeof(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_6socket_Socket)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket = (struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket*)__Pyx_GetVtable(__pyx_ptype_3zmq_7backend_6cython_6socket_Socket->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
+ #if CYTHON_COMPILING_IN_PYPY
+ sizeof(PyTypeObject),
+ #else
+ sizeof(PyHeapTypeObject),
+ #endif
+ 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/_poll.pyx":32
+ * from socket cimport Socket
+ *
+ * import sys # <<<<<<<<<<<<<<
+ *
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":35
+ *
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ *
+ * #-----------------------------------------------------------------------------
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_InterruptedSystemCall, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":42
+ *
+ * # version-independent typecheck for int/long
+ * if sys.version_info[0] >= 3: # <<<<<<<<<<<<<<
+ * int_t = int
+ * else:
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_version_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/_poll.pyx":43
+ * # version-independent typecheck for int/long
+ * if sys.version_info[0] >= 3:
+ * int_t = int # <<<<<<<<<<<<<<
+ * else:
+ * int_t = (int,long)
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_int_t, ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/_poll.pyx":45
+ * int_t = int
+ * else:
+ * int_t = (int,long) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyLong_Type))));
+ PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((PyObject*)(&PyLong_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyLong_Type))));
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_int_t, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __pyx_L2:;
+
+ /* "zmq/backend/cython/_poll.pyx":48
+ *
+ *
+ * def zmq_poll(sockets, long timeout=-1): # <<<<<<<<<<<<<<
+ * """zmq_poll(sockets, timeout=-1)
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_5_poll_1zmq_poll, NULL, __pyx_n_s_zmq_backend_cython__poll); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_zmq_poll, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":144
+ * #-----------------------------------------------------------------------------
+ *
+ * __all__ = [ 'zmq_poll' ] # <<<<<<<<<<<<<<
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_zmq_poll);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_zmq_poll);
+ __Pyx_GIVEREF(__pyx_n_s_zmq_poll);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/_poll.pyx":1
+ * """0MQ polling related functions and classes.""" # <<<<<<<<<<<<<<
+ *
+ * #
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython._poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython._poll");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AsString(kw_name));
+ #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ continue;
+ }
+ name = first_kw_arg;
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+ while (*name) {
+ if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**name, key)) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ if ((**argname == key) || (
+ (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**argname, key))) {
+ goto arg_passed_twice;
+ }
+ argname++;
+ }
+ }
+ } else
+ #endif
+ if (likely(PyUnicode_Check(key))) {
+ while (*name) {
+ int cmp = (**name == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**name, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ int cmp = (**argname == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**argname, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) goto arg_passed_twice;
+ argname++;
+ }
+ }
+ } else
+ goto invalid_keyword_type;
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, key);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_Restore(type, value, tb);
+#endif
+}
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+ PyObject *r;
+ if (!j) return NULL;
+ r = PyObject_GetItem(o, j);
+ Py_DECREF(j);
+ return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+ if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+ PyObject *r = PyList_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (is_list || PyList_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+ if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+ PyObject *r = PyList_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ }
+ else if (PyTuple_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ } else {
+ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+ if (likely(m && m->sq_item)) {
+ if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+ Py_ssize_t l = m->sq_length(o);
+ if (likely(l >= 0)) {
+ i += l;
+ } else {
+ if (PyErr_ExceptionMatches(PyExc_OverflowError))
+ PyErr_Clear();
+ else
+ return NULL;
+ }
+ }
+ return m->sq_item(o, i);
+ }
+ }
+#else
+ if (is_list || PySequence_Check(o)) {
+ return PySequence_GetItem(o, i);
+ }
+#endif
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+ PyErr_Format(PyExc_ValueError,
+ "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
+}
+
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
+ PyErr_Format(PyExc_ValueError,
+ "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
+ index, (index == 1) ? "" : "s");
+}
+
+static CYTHON_INLINE int __Pyx_IterFinish(void) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* exc_type = tstate->curexc_type;
+ if (unlikely(exc_type)) {
+ if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
+ PyObject *exc_value, *exc_tb;
+ exc_value = tstate->curexc_value;
+ exc_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+ Py_DECREF(exc_type);
+ Py_XDECREF(exc_value);
+ Py_XDECREF(exc_tb);
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+#else
+ if (unlikely(PyErr_Occurred())) {
+ if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
+ PyErr_Clear();
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+#endif
+}
+
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
+ if (unlikely(retval)) {
+ Py_DECREF(retval);
+ __Pyx_RaiseTooManyValuesError(expected);
+ return -1;
+ } else {
+ return __Pyx_IterFinish();
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+#else
+ PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ local_type = tstate->curexc_type;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
+ PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
+ goto bad;
+ #if PY_MAJOR_VERSION >= 3
+ if (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
+ return 0;
+bad:
+ *type = 0;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+static void* __Pyx_GetVtable(PyObject *dict) {
+ void* ptr;
+ PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
+ if (!ob)
+ goto bad;
+#if PY_VERSION_HEX >= 0x02070000
+ ptr = PyCapsule_GetPointer(ob, 0);
+#else
+ ptr = PyCObject_AsVoidPtr(ob);
+#endif
+ if (!ptr && !PyErr_Occurred())
+ PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
+ Py_DECREF(ob);
+ return ptr;
+bad:
+ Py_XDECREF(ob);
+ return NULL;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) {
+ const short neg_one = (short) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(short) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (short) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(short, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(short) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(short, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(short) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(short, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(short, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(short) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(short, long, PyLong_AsLong(x))
+ } else if (sizeof(short) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(short, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ short val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (short) -1;
+ }
+ } else {
+ short val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (short) -1;
+ val = __Pyx_PyInt_As_short(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to short");
+ return (short) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to short");
+ return (short) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
+ const short neg_one = (short) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(short) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(short) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(short) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(short) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(short) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(short),
+ little, !is_unsigned);
+ }
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+ PyObject *py_name = 0;
+ PyObject *py_module = 0;
+ py_name = __Pyx_PyIdentifier_FromString(name);
+ if (!py_name)
+ goto bad;
+ py_module = PyImport_Import(py_name);
+ Py_DECREF(py_name);
+ return py_module;
+bad:
+ Py_XDECREF(py_name);
+ return 0;
+}
+#endif
+
+#ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
+ size_t size, int strict)
+{
+ PyObject *py_module = 0;
+ PyObject *result = 0;
+ PyObject *py_name = 0;
+ char warning[200];
+ Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+ PyObject *py_basicsize;
+#endif
+ py_module = __Pyx_ImportModule(module_name);
+ if (!py_module)
+ goto bad;
+ py_name = __Pyx_PyIdentifier_FromString(class_name);
+ if (!py_name)
+ goto bad;
+ result = PyObject_GetAttr(py_module, py_name);
+ Py_DECREF(py_name);
+ py_name = 0;
+ Py_DECREF(py_module);
+ py_module = 0;
+ if (!result)
+ goto bad;
+ if (!PyType_Check(result)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s.%.200s is not a type object",
+ module_name, class_name);
+ goto bad;
+ }
+#ifndef Py_LIMITED_API
+ basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+ py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+ if (!py_basicsize)
+ goto bad;
+ basicsize = PyLong_AsSsize_t(py_basicsize);
+ Py_DECREF(py_basicsize);
+ py_basicsize = 0;
+ if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+ goto bad;
+#endif
+ if (!strict && (size_t)basicsize > size) {
+ PyOS_snprintf(warning, sizeof(warning),
+ "%s.%s size changed, may indicate binary incompatibility",
+ module_name, class_name);
+ if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
+ }
+ else if ((size_t)basicsize != size) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.%.200s has the wrong size, try recompiling",
+ module_name, class_name);
+ goto bad;
+ }
+ return (PyTypeObject *)result;
+bad:
+ Py_XDECREF(py_module);
+ Py_XDECREF(result);
+ return NULL;
+}
+#endif
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_poll.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_poll.pyx
new file mode 100644
index 00000000..7b5300b1
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_poll.pyx
@@ -0,0 +1,144 @@
+"""0MQ polling related functions and classes."""
+
+#
+# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+from libc.stdlib cimport free, malloc
+
+from libzmq cimport zmq_pollitem_t, ZMQ_VERSION_MAJOR
+from libzmq cimport zmq_poll as zmq_poll_c
+from socket cimport Socket
+
+import sys
+
+from zmq.backend.cython.checkrc cimport _check_rc
+from zmq.error import InterruptedSystemCall
+
+#-----------------------------------------------------------------------------
+# Polling related methods
+#-----------------------------------------------------------------------------
+
+# version-independent typecheck for int/long
+if sys.version_info[0] >= 3:
+ int_t = int
+else:
+ int_t = (int,long)
+
+
+def zmq_poll(sockets, long timeout=-1):
+ """zmq_poll(sockets, timeout=-1)
+
+ Poll a set of 0MQ sockets, native file descs. or sockets.
+
+ Parameters
+ ----------
+ sockets : list of tuples of (socket, flags)
+ Each element of this list is a two-tuple containing a socket
+ and a flags. The socket may be a 0MQ socket or any object with
+ a ``fileno()`` method. The flags can be zmq.POLLIN (for detecting
+ for incoming messages), zmq.POLLOUT (for detecting that send is OK)
+ or zmq.POLLIN|zmq.POLLOUT for detecting both.
+ timeout : int
+ The number of milliseconds to poll for. Negative means no timeout.
+ """
+ cdef int rc, i
+ cdef zmq_pollitem_t *pollitems = NULL
+ cdef int nsockets = <int>len(sockets)
+ cdef Socket current_socket
+
+ if nsockets == 0:
+ return []
+
+ pollitems = <zmq_pollitem_t *>malloc(nsockets*sizeof(zmq_pollitem_t))
+ if pollitems == NULL:
+ raise MemoryError("Could not allocate poll items")
+
+ if ZMQ_VERSION_MAJOR < 3:
+ # timeout is us in 2.x, ms in 3.x
+ # expected input is ms (matches 3.x)
+ timeout = 1000*timeout
+
+ for i in range(nsockets):
+ s, events = sockets[i]
+ if isinstance(s, Socket):
+ pollitems[i].socket = (<Socket>s).handle
+ pollitems[i].events = events
+ pollitems[i].revents = 0
+ elif isinstance(s, int_t):
+ pollitems[i].socket = NULL
+ pollitems[i].fd = s
+ pollitems[i].events = events
+ pollitems[i].revents = 0
+ elif hasattr(s, 'fileno'):
+ try:
+ fileno = int(s.fileno())
+ except:
+ free(pollitems)
+ raise ValueError('fileno() must return a valid integer fd')
+ else:
+ pollitems[i].socket = NULL
+ pollitems[i].fd = fileno
+ pollitems[i].events = events
+ pollitems[i].revents = 0
+ else:
+ free(pollitems)
+ raise TypeError(
+ "Socket must be a 0MQ socket, an integer fd or have "
+ "a fileno() method: %r" % s
+ )
+
+ try:
+ while True:
+ with nogil:
+ rc = zmq_poll_c(pollitems, nsockets, timeout)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+ except Exception:
+ free(pollitems)
+ raise
+
+ results = []
+ for i in range(nsockets):
+ revents = pollitems[i].revents
+ # for compatibility with select.poll:
+ # - only return sockets with non-zero status
+ # - return the fd for plain sockets
+ if revents > 0:
+ if pollitems[i].socket != NULL:
+ s = sockets[i][0]
+ else:
+ s = pollitems[i].fd
+ results.append((s, revents))
+
+ free(pollitems)
+ return results
+
+#-----------------------------------------------------------------------------
+# Symbols to export
+#-----------------------------------------------------------------------------
+
+__all__ = [ 'zmq_poll' ]
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_version.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_version.c
new file mode 100644
index 00000000..11c11259
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_version.c
@@ -0,0 +1,1497 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython___version
+#define __PYX_HAVE_API__zmq__backend__cython___version
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/_version.pyx",
+};
+
+/*--- Type declarations ---*/
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static int __Pyx_check_binary_version(void);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'zmq.backend.cython._version' */
+#define __Pyx_MODULE_NAME "zmq.backend.cython._version"
+int __pyx_module_is_main_zmq__backend__cython___version = 0;
+
+/* Implementation of 'zmq.backend.cython._version' */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_8_version_zmq_version_info(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_major[] = "major";
+static char __pyx_k_minor[] = "minor";
+static char __pyx_k_patch[] = "patch";
+static char __pyx_k_zmq_version_info[] = "zmq_version_info";
+static char __pyx_k_zmq_backend_cython__version[] = "zmq.backend.cython._version";
+static char __pyx_k_PyZMQ_and_0MQ_version_functions[] = "PyZMQ and 0MQ version functions.";
+static char __pyx_k_private_tmp_pyzmq_release_zmq_b[] = "/private/tmp/pyzmq-release/zmq/backend/cython/_version.pyx";
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_major;
+static PyObject *__pyx_n_s_minor;
+static PyObject *__pyx_n_s_patch;
+static PyObject *__pyx_kp_s_private_tmp_pyzmq_release_zmq_b;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_zmq_backend_cython__version;
+static PyObject *__pyx_n_s_zmq_version_info;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_codeobj__2;
+
+/* "zmq/backend/cython/_version.pyx":32
+ * #-----------------------------------------------------------------------------
+ *
+ * def zmq_version_info(): # <<<<<<<<<<<<<<
+ * """zmq_version_info()
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_8_version_1zmq_version_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_8_version_zmq_version_info[] = "zmq_version_info()\n\n Return the version of ZeroMQ itself as a 3-tuple of ints.\n ";
+static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_8_version_1zmq_version_info = {"zmq_version_info", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_8_version_1zmq_version_info, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_8_version_zmq_version_info};
+static PyObject *__pyx_pw_3zmq_7backend_6cython_8_version_1zmq_version_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("zmq_version_info (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_8_version_zmq_version_info(__pyx_self);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_8_version_zmq_version_info(CYTHON_UNUSED PyObject *__pyx_self) {
+ int __pyx_v_major;
+ int __pyx_v_minor;
+ int __pyx_v_patch;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("zmq_version_info", 0);
+
+ /* "zmq/backend/cython/_version.pyx":38
+ * """
+ * cdef int major, minor, patch
+ * _zmq_version(&major, &minor, &patch) # <<<<<<<<<<<<<<
+ * return (major, minor, patch)
+ *
+ */
+ zmq_version((&__pyx_v_major), (&__pyx_v_minor), (&__pyx_v_patch));
+
+ /* "zmq/backend/cython/_version.pyx":39
+ * cdef int major, minor, patch
+ * _zmq_version(&major, &minor, &patch)
+ * return (major, minor, patch) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_major); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_minor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_patch); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/_version.pyx":32
+ * #-----------------------------------------------------------------------------
+ *
+ * def zmq_version_info(): # <<<<<<<<<<<<<<
+ * """zmq_version_info()
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("zmq.backend.cython._version.zmq_version_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "_version",
+ __pyx_k_PyZMQ_and_0MQ_version_functions, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 0, 1, 1},
+ {&__pyx_n_s_minor, __pyx_k_minor, sizeof(__pyx_k_minor), 0, 0, 1, 1},
+ {&__pyx_n_s_patch, __pyx_k_patch, sizeof(__pyx_k_patch), 0, 0, 1, 1},
+ {&__pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_k_private_tmp_pyzmq_release_zmq_b, sizeof(__pyx_k_private_tmp_pyzmq_release_zmq_b), 0, 0, 1, 0},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_backend_cython__version, __pyx_k_zmq_backend_cython__version, sizeof(__pyx_k_zmq_backend_cython__version), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_version_info, __pyx_k_zmq_version_info, sizeof(__pyx_k_zmq_version_info), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ return 0;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "zmq/backend/cython/_version.pyx":32
+ * #-----------------------------------------------------------------------------
+ *
+ * def zmq_version_info(): # <<<<<<<<<<<<<<
+ * """zmq_version_info()
+ *
+ */
+ __pyx_tuple_ = PyTuple_Pack(3, __pyx_n_s_major, __pyx_n_s_minor, __pyx_n_s_patch); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+ __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_zmq_version_info, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC init_version(void); /*proto*/
+PyMODINIT_FUNC init_version(void)
+#else
+PyMODINIT_FUNC PyInit__version(void); /*proto*/
+PyMODINIT_FUNC PyInit__version(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__version(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("_version", __pyx_methods, __pyx_k_PyZMQ_and_0MQ_version_functions, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython___version) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython._version")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython._version", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ /*--- Type import code ---*/
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/_version.pyx":32
+ * #-----------------------------------------------------------------------------
+ *
+ * def zmq_version_info(): # <<<<<<<<<<<<<<
+ * """zmq_version_info()
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_8_version_1zmq_version_info, NULL, __pyx_n_s_zmq_backend_cython__version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_zmq_version_info, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/_version.pyx":42
+ *
+ *
+ * __all__ = ['zmq_version_info'] # <<<<<<<<<<<<<<
+ *
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_zmq_version_info);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_zmq_version_info);
+ __Pyx_GIVEREF(__pyx_n_s_zmq_version_info);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/_version.pyx":1
+ * """PyZMQ and 0MQ version functions.""" # <<<<<<<<<<<<<<
+ *
+ * #
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython._version", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython._version");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_version.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_version.pyx
new file mode 100644
index 00000000..02cf6fcc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/_version.pyx
@@ -0,0 +1,43 @@
+"""PyZMQ and 0MQ version functions."""
+
+#
+# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+from libzmq cimport _zmq_version
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+def zmq_version_info():
+ """zmq_version_info()
+
+ Return the version of ZeroMQ itself as a 3-tuple of ints.
+ """
+ cdef int major, minor, patch
+ _zmq_version(&major, &minor, &patch)
+ return (major, minor, patch)
+
+
+__all__ = ['zmq_version_info']
+
diff --git a/external_libs/python/zmq/backend/cython/checkrc.pxd b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/checkrc.pxd
index 3bf69fc3..a3afc6bb 100644
--- a/external_libs/python/zmq/backend/cython/checkrc.pxd
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/checkrc.pxd
@@ -2,6 +2,7 @@ from libc.errno cimport EINTR, EAGAIN
from cpython cimport PyErr_CheckSignals
from libzmq cimport zmq_errno, ZMQ_ETERM
+
cdef inline int _check_rc(int rc) except -1:
"""internal utility for checking zmq return condition
@@ -10,7 +11,10 @@ cdef inline int _check_rc(int rc) except -1:
cdef int errno = zmq_errno()
PyErr_CheckSignals()
if rc < 0:
- if errno == EAGAIN:
+ if errno == EINTR:
+ from zmq.error import InterruptedSystemCall
+ raise InterruptedSystemCall(errno)
+ elif errno == EAGAIN:
from zmq.error import Again
raise Again(errno)
elif errno == ZMQ_ETERM:
@@ -19,5 +23,4 @@ cdef inline int _check_rc(int rc) except -1:
else:
from zmq.error import ZMQError
raise ZMQError(errno)
- # return -1
return 0
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constant_enums.pxi b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constant_enums.pxi
new file mode 100644
index 00000000..9295ecd6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constant_enums.pxi
@@ -0,0 +1,155 @@
+cdef extern from "zmq.h" nogil:
+
+ enum: ZMQ_VERSION
+ enum: ZMQ_VERSION_MAJOR
+ enum: ZMQ_VERSION_MINOR
+ enum: ZMQ_VERSION_PATCH
+ enum: ZMQ_NOBLOCK
+ enum: ZMQ_DONTWAIT
+ enum: ZMQ_POLLIN
+ enum: ZMQ_POLLOUT
+ enum: ZMQ_POLLERR
+ enum: ZMQ_SNDMORE
+ enum: ZMQ_STREAMER
+ enum: ZMQ_FORWARDER
+ enum: ZMQ_QUEUE
+ enum: ZMQ_IO_THREADS_DFLT
+ enum: ZMQ_MAX_SOCKETS_DFLT
+ enum: ZMQ_POLLITEMS_DFLT
+ enum: ZMQ_THREAD_PRIORITY_DFLT
+ enum: ZMQ_THREAD_SCHED_POLICY_DFLT
+ enum: ZMQ_PAIR
+ enum: ZMQ_PUB
+ enum: ZMQ_SUB
+ enum: ZMQ_REQ
+ enum: ZMQ_REP
+ enum: ZMQ_DEALER
+ enum: ZMQ_ROUTER
+ enum: ZMQ_XREQ
+ enum: ZMQ_XREP
+ enum: ZMQ_PULL
+ enum: ZMQ_PUSH
+ enum: ZMQ_XPUB
+ enum: ZMQ_XSUB
+ enum: ZMQ_UPSTREAM
+ enum: ZMQ_DOWNSTREAM
+ enum: ZMQ_STREAM
+ enum: ZMQ_EVENT_CONNECTED
+ enum: ZMQ_EVENT_CONNECT_DELAYED
+ enum: ZMQ_EVENT_CONNECT_RETRIED
+ enum: ZMQ_EVENT_LISTENING
+ enum: ZMQ_EVENT_BIND_FAILED
+ enum: ZMQ_EVENT_ACCEPTED
+ enum: ZMQ_EVENT_ACCEPT_FAILED
+ enum: ZMQ_EVENT_CLOSED
+ enum: ZMQ_EVENT_CLOSE_FAILED
+ enum: ZMQ_EVENT_DISCONNECTED
+ enum: ZMQ_EVENT_ALL
+ enum: ZMQ_EVENT_MONITOR_STOPPED
+ enum: ZMQ_NULL
+ enum: ZMQ_PLAIN
+ enum: ZMQ_CURVE
+ enum: ZMQ_GSSAPI
+ enum: ZMQ_EAGAIN "EAGAIN"
+ enum: ZMQ_EINVAL "EINVAL"
+ enum: ZMQ_EFAULT "EFAULT"
+ enum: ZMQ_ENOMEM "ENOMEM"
+ enum: ZMQ_ENODEV "ENODEV"
+ enum: ZMQ_EMSGSIZE "EMSGSIZE"
+ enum: ZMQ_EAFNOSUPPORT "EAFNOSUPPORT"
+ enum: ZMQ_ENETUNREACH "ENETUNREACH"
+ enum: ZMQ_ECONNABORTED "ECONNABORTED"
+ enum: ZMQ_ECONNRESET "ECONNRESET"
+ enum: ZMQ_ENOTCONN "ENOTCONN"
+ enum: ZMQ_ETIMEDOUT "ETIMEDOUT"
+ enum: ZMQ_EHOSTUNREACH "EHOSTUNREACH"
+ enum: ZMQ_ENETRESET "ENETRESET"
+ enum: ZMQ_HAUSNUMERO
+ enum: ZMQ_ENOTSUP "ENOTSUP"
+ enum: ZMQ_EPROTONOSUPPORT "EPROTONOSUPPORT"
+ enum: ZMQ_ENOBUFS "ENOBUFS"
+ enum: ZMQ_ENETDOWN "ENETDOWN"
+ enum: ZMQ_EADDRINUSE "EADDRINUSE"
+ enum: ZMQ_EADDRNOTAVAIL "EADDRNOTAVAIL"
+ enum: ZMQ_ECONNREFUSED "ECONNREFUSED"
+ enum: ZMQ_EINPROGRESS "EINPROGRESS"
+ enum: ZMQ_ENOTSOCK "ENOTSOCK"
+ enum: ZMQ_EFSM "EFSM"
+ enum: ZMQ_ENOCOMPATPROTO "ENOCOMPATPROTO"
+ enum: ZMQ_ETERM "ETERM"
+ enum: ZMQ_EMTHREAD "EMTHREAD"
+ enum: ZMQ_IO_THREADS
+ enum: ZMQ_MAX_SOCKETS
+ enum: ZMQ_SOCKET_LIMIT
+ enum: ZMQ_THREAD_PRIORITY
+ enum: ZMQ_THREAD_SCHED_POLICY
+ enum: ZMQ_IDENTITY
+ enum: ZMQ_SUBSCRIBE
+ enum: ZMQ_UNSUBSCRIBE
+ enum: ZMQ_LAST_ENDPOINT
+ enum: ZMQ_TCP_ACCEPT_FILTER
+ enum: ZMQ_PLAIN_USERNAME
+ enum: ZMQ_PLAIN_PASSWORD
+ enum: ZMQ_CURVE_PUBLICKEY
+ enum: ZMQ_CURVE_SECRETKEY
+ enum: ZMQ_CURVE_SERVERKEY
+ enum: ZMQ_ZAP_DOMAIN
+ enum: ZMQ_CONNECT_RID
+ enum: ZMQ_GSSAPI_PRINCIPAL
+ enum: ZMQ_GSSAPI_SERVICE_PRINCIPAL
+ enum: ZMQ_SOCKS_PROXY
+ enum: ZMQ_FD
+ enum: ZMQ_RECONNECT_IVL_MAX
+ enum: ZMQ_SNDTIMEO
+ enum: ZMQ_RCVTIMEO
+ enum: ZMQ_SNDHWM
+ enum: ZMQ_RCVHWM
+ enum: ZMQ_MULTICAST_HOPS
+ enum: ZMQ_IPV4ONLY
+ enum: ZMQ_ROUTER_BEHAVIOR
+ enum: ZMQ_TCP_KEEPALIVE
+ enum: ZMQ_TCP_KEEPALIVE_CNT
+ enum: ZMQ_TCP_KEEPALIVE_IDLE
+ enum: ZMQ_TCP_KEEPALIVE_INTVL
+ enum: ZMQ_DELAY_ATTACH_ON_CONNECT
+ enum: ZMQ_XPUB_VERBOSE
+ enum: ZMQ_EVENTS
+ enum: ZMQ_TYPE
+ enum: ZMQ_LINGER
+ enum: ZMQ_RECONNECT_IVL
+ enum: ZMQ_BACKLOG
+ enum: ZMQ_ROUTER_MANDATORY
+ enum: ZMQ_FAIL_UNROUTABLE
+ enum: ZMQ_ROUTER_RAW
+ enum: ZMQ_IMMEDIATE
+ enum: ZMQ_IPV6
+ enum: ZMQ_MECHANISM
+ enum: ZMQ_PLAIN_SERVER
+ enum: ZMQ_CURVE_SERVER
+ enum: ZMQ_PROBE_ROUTER
+ enum: ZMQ_REQ_RELAXED
+ enum: ZMQ_REQ_CORRELATE
+ enum: ZMQ_CONFLATE
+ enum: ZMQ_ROUTER_HANDOVER
+ enum: ZMQ_TOS
+ enum: ZMQ_IPC_FILTER_PID
+ enum: ZMQ_IPC_FILTER_UID
+ enum: ZMQ_IPC_FILTER_GID
+ enum: ZMQ_GSSAPI_SERVER
+ enum: ZMQ_GSSAPI_PLAINTEXT
+ enum: ZMQ_HANDSHAKE_IVL
+ enum: ZMQ_XPUB_NODROP
+ enum: ZMQ_AFFINITY
+ enum: ZMQ_MAXMSGSIZE
+ enum: ZMQ_HWM
+ enum: ZMQ_SWAP
+ enum: ZMQ_MCAST_LOOP
+ enum: ZMQ_RECOVERY_IVL_MSEC
+ enum: ZMQ_RATE
+ enum: ZMQ_RECOVERY_IVL
+ enum: ZMQ_SNDBUF
+ enum: ZMQ_RCVBUF
+ enum: ZMQ_RCVMORE
+ enum: ZMQ_MORE
+ enum: ZMQ_SRCFD
+ enum: ZMQ_SHARED
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.c
new file mode 100644
index 00000000..4c3b113e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.c
@@ -0,0 +1,4184 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython__constants
+#define __PYX_HAVE_API__zmq__backend__cython__constants
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/constants.pyx",
+ "zmq/backend/cython/constants.pxi",
+};
+
+/*--- Type declarations ---*/
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
+
+static PyObject* __Pyx_Globals(void);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static int __Pyx_check_binary_version(void);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'zmq.backend.cython.constants' */
+#define __Pyx_MODULE_NAME "zmq.backend.cython.constants"
+int __pyx_module_is_main_zmq__backend__cython__constants = 0;
+
+/* Implementation of 'zmq.backend.cython.constants' */
+static char __pyx_k_FD[] = "FD";
+static char __pyx_k_HWM[] = "HWM";
+static char __pyx_k_PUB[] = "PUB";
+static char __pyx_k_REP[] = "REP";
+static char __pyx_k_REQ[] = "REQ";
+static char __pyx_k_SUB[] = "SUB";
+static char __pyx_k_TOS[] = "TOS";
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_EFSM[] = "EFSM";
+static char __pyx_k_IPV6[] = "IPV6";
+static char __pyx_k_MORE[] = "MORE";
+static char __pyx_k_NULL[] = "NULL";
+static char __pyx_k_PAIR[] = "PAIR";
+static char __pyx_k_PULL[] = "PULL";
+static char __pyx_k_PUSH[] = "PUSH";
+static char __pyx_k_RATE[] = "RATE";
+static char __pyx_k_SWAP[] = "SWAP";
+static char __pyx_k_TYPE[] = "TYPE";
+static char __pyx_k_XPUB[] = "XPUB";
+static char __pyx_k_XREP[] = "XREP";
+static char __pyx_k_XREQ[] = "XREQ";
+static char __pyx_k_XSUB[] = "XSUB";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_CURVE[] = "CURVE";
+static char __pyx_k_ETERM[] = "ETERM";
+static char __pyx_k_PLAIN[] = "PLAIN";
+static char __pyx_k_QUEUE[] = "QUEUE";
+static char __pyx_k_SRCFD[] = "SRCFD";
+static char __pyx_k_DEALER[] = "DEALER";
+static char __pyx_k_EAGAIN[] = "EAGAIN";
+static char __pyx_k_EFAULT[] = "EFAULT";
+static char __pyx_k_EINVAL[] = "EINVAL";
+static char __pyx_k_ENODEV[] = "ENODEV";
+static char __pyx_k_ENOMEM[] = "ENOMEM";
+static char __pyx_k_EVENTS[] = "EVENTS";
+static char __pyx_k_GSSAPI[] = "GSSAPI";
+static char __pyx_k_LINGER[] = "LINGER";
+static char __pyx_k_POLLIN[] = "POLLIN";
+static char __pyx_k_RCVBUF[] = "RCVBUF";
+static char __pyx_k_RCVHWM[] = "RCVHWM";
+static char __pyx_k_ROUTER[] = "ROUTER";
+static char __pyx_k_SHARED[] = "SHARED";
+static char __pyx_k_SNDBUF[] = "SNDBUF";
+static char __pyx_k_SNDHWM[] = "SNDHWM";
+static char __pyx_k_STREAM[] = "STREAM";
+static char __pyx_k_BACKLOG[] = "BACKLOG";
+static char __pyx_k_ENOBUFS[] = "ENOBUFS";
+static char __pyx_k_ENOTSUP[] = "ENOTSUP";
+static char __pyx_k_NOBLOCK[] = "NOBLOCK";
+static char __pyx_k_POLLERR[] = "POLLERR";
+static char __pyx_k_POLLOUT[] = "POLLOUT";
+static char __pyx_k_RCVMORE[] = "RCVMORE";
+static char __pyx_k_SNDMORE[] = "SNDMORE";
+static char __pyx_k_VERSION[] = "VERSION";
+static char __pyx_k_AFFINITY[] = "AFFINITY";
+static char __pyx_k_CONFLATE[] = "CONFLATE";
+static char __pyx_k_DONTWAIT[] = "DONTWAIT";
+static char __pyx_k_EMSGSIZE[] = "EMSGSIZE";
+static char __pyx_k_EMTHREAD[] = "EMTHREAD";
+static char __pyx_k_ENETDOWN[] = "ENETDOWN";
+static char __pyx_k_ENOTCONN[] = "ENOTCONN";
+static char __pyx_k_ENOTSOCK[] = "ENOTSOCK";
+static char __pyx_k_IDENTITY[] = "IDENTITY";
+static char __pyx_k_IPV4ONLY[] = "IPV4ONLY";
+static char __pyx_k_RCVTIMEO[] = "RCVTIMEO";
+static char __pyx_k_SNDTIMEO[] = "SNDTIMEO";
+static char __pyx_k_STREAMER[] = "STREAMER";
+static char __pyx_k_UPSTREAM[] = "UPSTREAM";
+static char __pyx_k_ENETRESET[] = "ENETRESET";
+static char __pyx_k_ETIMEDOUT[] = "ETIMEDOUT";
+static char __pyx_k_EVENT_ALL[] = "EVENT_ALL";
+static char __pyx_k_FORWARDER[] = "FORWARDER";
+static char __pyx_k_IMMEDIATE[] = "IMMEDIATE";
+static char __pyx_k_MECHANISM[] = "MECHANISM";
+static char __pyx_k_SUBSCRIBE[] = "SUBSCRIBE";
+static char __pyx_k_DOWNSTREAM[] = "DOWNSTREAM";
+static char __pyx_k_EADDRINUSE[] = "EADDRINUSE";
+static char __pyx_k_ECONNRESET[] = "ECONNRESET";
+static char __pyx_k_HAUSNUMERO[] = "HAUSNUMERO";
+static char __pyx_k_IO_THREADS[] = "IO_THREADS";
+static char __pyx_k_MAXMSGSIZE[] = "MAXMSGSIZE";
+static char __pyx_k_MCAST_LOOP[] = "MCAST_LOOP";
+static char __pyx_k_ROUTER_RAW[] = "ROUTER_RAW";
+static char __pyx_k_ZAP_DOMAIN[] = "ZAP_DOMAIN";
+static char __pyx_k_CONNECT_RID[] = "CONNECT_RID";
+static char __pyx_k_EINPROGRESS[] = "EINPROGRESS";
+static char __pyx_k_ENETUNREACH[] = "ENETUNREACH";
+static char __pyx_k_MAX_SOCKETS[] = "MAX_SOCKETS";
+static char __pyx_k_REQ_RELAXED[] = "REQ_RELAXED";
+static char __pyx_k_SOCKS_PROXY[] = "SOCKS_PROXY";
+static char __pyx_k_UNSUBSCRIBE[] = "UNSUBSCRIBE";
+static char __pyx_k_XPUB_NODROP[] = "XPUB_NODROP";
+static char __pyx_k_CURVE_SERVER[] = "CURVE_SERVER";
+static char __pyx_k_EAFNOSUPPORT[] = "EAFNOSUPPORT";
+static char __pyx_k_ECONNABORTED[] = "ECONNABORTED";
+static char __pyx_k_ECONNREFUSED[] = "ECONNREFUSED";
+static char __pyx_k_EHOSTUNREACH[] = "EHOSTUNREACH";
+static char __pyx_k_EVENT_CLOSED[] = "EVENT_CLOSED";
+static char __pyx_k_PLAIN_SERVER[] = "PLAIN_SERVER";
+static char __pyx_k_PROBE_ROUTER[] = "PROBE_ROUTER";
+static char __pyx_k_RECOVERY_IVL[] = "RECOVERY_IVL";
+static char __pyx_k_SOCKET_LIMIT[] = "SOCKET_LIMIT";
+static char __pyx_k_XPUB_VERBOSE[] = "XPUB_VERBOSE";
+static char __pyx_k_0MQ_Constants[] = "0MQ Constants.";
+static char __pyx_k_EADDRNOTAVAIL[] = "EADDRNOTAVAIL";
+static char __pyx_k_GSSAPI_SERVER[] = "GSSAPI_SERVER";
+static char __pyx_k_HANDSHAKE_IVL[] = "HANDSHAKE_IVL";
+static char __pyx_k_LAST_ENDPOINT[] = "LAST_ENDPOINT";
+static char __pyx_k_RECONNECT_IVL[] = "RECONNECT_IVL";
+static char __pyx_k_REQ_CORRELATE[] = "REQ_CORRELATE";
+static char __pyx_k_TCP_KEEPALIVE[] = "TCP_KEEPALIVE";
+static char __pyx_k_VERSION_MAJOR[] = "VERSION_MAJOR";
+static char __pyx_k_VERSION_MINOR[] = "VERSION_MINOR";
+static char __pyx_k_VERSION_PATCH[] = "VERSION_PATCH";
+static char __pyx_k_ENOCOMPATPROTO[] = "ENOCOMPATPROTO";
+static char __pyx_k_EVENT_ACCEPTED[] = "EVENT_ACCEPTED";
+static char __pyx_k_IPC_FILTER_GID[] = "IPC_FILTER_GID";
+static char __pyx_k_IPC_FILTER_PID[] = "IPC_FILTER_PID";
+static char __pyx_k_IPC_FILTER_UID[] = "IPC_FILTER_UID";
+static char __pyx_k_MULTICAST_HOPS[] = "MULTICAST_HOPS";
+static char __pyx_k_PLAIN_PASSWORD[] = "PLAIN_PASSWORD";
+static char __pyx_k_PLAIN_USERNAME[] = "PLAIN_USERNAME";
+static char __pyx_k_POLLITEMS_DFLT[] = "POLLITEMS_DFLT";
+static char __pyx_k_CURVE_PUBLICKEY[] = "CURVE_PUBLICKEY";
+static char __pyx_k_CURVE_SECRETKEY[] = "CURVE_SECRETKEY";
+static char __pyx_k_CURVE_SERVERKEY[] = "CURVE_SERVERKEY";
+static char __pyx_k_EPROTONOSUPPORT[] = "EPROTONOSUPPORT";
+static char __pyx_k_EVENT_CONNECTED[] = "EVENT_CONNECTED";
+static char __pyx_k_EVENT_LISTENING[] = "EVENT_LISTENING";
+static char __pyx_k_FAIL_UNROUTABLE[] = "FAIL_UNROUTABLE";
+static char __pyx_k_IO_THREADS_DFLT[] = "IO_THREADS_DFLT";
+static char __pyx_k_ROUTER_BEHAVIOR[] = "ROUTER_BEHAVIOR";
+static char __pyx_k_ROUTER_HANDOVER[] = "ROUTER_HANDOVER";
+static char __pyx_k_THREAD_PRIORITY[] = "THREAD_PRIORITY";
+static char __pyx_k_GSSAPI_PLAINTEXT[] = "GSSAPI_PLAINTEXT";
+static char __pyx_k_GSSAPI_PRINCIPAL[] = "GSSAPI_PRINCIPAL";
+static char __pyx_k_MAX_SOCKETS_DFLT[] = "MAX_SOCKETS_DFLT";
+static char __pyx_k_ROUTER_MANDATORY[] = "ROUTER_MANDATORY";
+static char __pyx_k_EVENT_BIND_FAILED[] = "EVENT_BIND_FAILED";
+static char __pyx_k_RECONNECT_IVL_MAX[] = "RECONNECT_IVL_MAX";
+static char __pyx_k_RECOVERY_IVL_MSEC[] = "RECOVERY_IVL_MSEC";
+static char __pyx_k_TCP_ACCEPT_FILTER[] = "TCP_ACCEPT_FILTER";
+static char __pyx_k_TCP_KEEPALIVE_CNT[] = "TCP_KEEPALIVE_CNT";
+static char __pyx_k_EVENT_CLOSE_FAILED[] = "EVENT_CLOSE_FAILED";
+static char __pyx_k_EVENT_DISCONNECTED[] = "EVENT_DISCONNECTED";
+static char __pyx_k_TCP_KEEPALIVE_IDLE[] = "TCP_KEEPALIVE_IDLE";
+static char __pyx_k_EVENT_ACCEPT_FAILED[] = "EVENT_ACCEPT_FAILED";
+static char __pyx_k_TCP_KEEPALIVE_INTVL[] = "TCP_KEEPALIVE_INTVL";
+static char __pyx_k_THREAD_SCHED_POLICY[] = "THREAD_SCHED_POLICY";
+static char __pyx_k_THREAD_PRIORITY_DFLT[] = "THREAD_PRIORITY_DFLT";
+static char __pyx_k_EVENT_CONNECT_DELAYED[] = "EVENT_CONNECT_DELAYED";
+static char __pyx_k_EVENT_CONNECT_RETRIED[] = "EVENT_CONNECT_RETRIED";
+static char __pyx_k_EVENT_MONITOR_STOPPED[] = "EVENT_MONITOR_STOPPED";
+static char __pyx_k_DELAY_ATTACH_ON_CONNECT[] = "DELAY_ATTACH_ON_CONNECT";
+static char __pyx_k_GSSAPI_SERVICE_PRINCIPAL[] = "GSSAPI_SERVICE_PRINCIPAL";
+static char __pyx_k_THREAD_SCHED_POLICY_DFLT[] = "THREAD_SCHED_POLICY_DFLT";
+static PyObject *__pyx_n_s_AFFINITY;
+static PyObject *__pyx_n_s_BACKLOG;
+static PyObject *__pyx_n_s_CONFLATE;
+static PyObject *__pyx_n_s_CONNECT_RID;
+static PyObject *__pyx_n_s_CURVE;
+static PyObject *__pyx_n_s_CURVE_PUBLICKEY;
+static PyObject *__pyx_n_s_CURVE_SECRETKEY;
+static PyObject *__pyx_n_s_CURVE_SERVER;
+static PyObject *__pyx_n_s_CURVE_SERVERKEY;
+static PyObject *__pyx_n_s_DEALER;
+static PyObject *__pyx_n_s_DELAY_ATTACH_ON_CONNECT;
+static PyObject *__pyx_n_s_DONTWAIT;
+static PyObject *__pyx_n_s_DOWNSTREAM;
+static PyObject *__pyx_n_s_EADDRINUSE;
+static PyObject *__pyx_n_s_EADDRNOTAVAIL;
+static PyObject *__pyx_n_s_EAFNOSUPPORT;
+static PyObject *__pyx_n_s_EAGAIN;
+static PyObject *__pyx_n_s_ECONNABORTED;
+static PyObject *__pyx_n_s_ECONNREFUSED;
+static PyObject *__pyx_n_s_ECONNRESET;
+static PyObject *__pyx_n_s_EFAULT;
+static PyObject *__pyx_n_s_EFSM;
+static PyObject *__pyx_n_s_EHOSTUNREACH;
+static PyObject *__pyx_n_s_EINPROGRESS;
+static PyObject *__pyx_n_s_EINVAL;
+static PyObject *__pyx_n_s_EMSGSIZE;
+static PyObject *__pyx_n_s_EMTHREAD;
+static PyObject *__pyx_n_s_ENETDOWN;
+static PyObject *__pyx_n_s_ENETRESET;
+static PyObject *__pyx_n_s_ENETUNREACH;
+static PyObject *__pyx_n_s_ENOBUFS;
+static PyObject *__pyx_n_s_ENOCOMPATPROTO;
+static PyObject *__pyx_n_s_ENODEV;
+static PyObject *__pyx_n_s_ENOMEM;
+static PyObject *__pyx_n_s_ENOTCONN;
+static PyObject *__pyx_n_s_ENOTSOCK;
+static PyObject *__pyx_n_s_ENOTSUP;
+static PyObject *__pyx_n_s_EPROTONOSUPPORT;
+static PyObject *__pyx_n_s_ETERM;
+static PyObject *__pyx_n_s_ETIMEDOUT;
+static PyObject *__pyx_n_s_EVENTS;
+static PyObject *__pyx_n_s_EVENT_ACCEPTED;
+static PyObject *__pyx_n_s_EVENT_ACCEPT_FAILED;
+static PyObject *__pyx_n_s_EVENT_ALL;
+static PyObject *__pyx_n_s_EVENT_BIND_FAILED;
+static PyObject *__pyx_n_s_EVENT_CLOSED;
+static PyObject *__pyx_n_s_EVENT_CLOSE_FAILED;
+static PyObject *__pyx_n_s_EVENT_CONNECTED;
+static PyObject *__pyx_n_s_EVENT_CONNECT_DELAYED;
+static PyObject *__pyx_n_s_EVENT_CONNECT_RETRIED;
+static PyObject *__pyx_n_s_EVENT_DISCONNECTED;
+static PyObject *__pyx_n_s_EVENT_LISTENING;
+static PyObject *__pyx_n_s_EVENT_MONITOR_STOPPED;
+static PyObject *__pyx_n_s_FAIL_UNROUTABLE;
+static PyObject *__pyx_n_s_FD;
+static PyObject *__pyx_n_s_FORWARDER;
+static PyObject *__pyx_n_s_GSSAPI;
+static PyObject *__pyx_n_s_GSSAPI_PLAINTEXT;
+static PyObject *__pyx_n_s_GSSAPI_PRINCIPAL;
+static PyObject *__pyx_n_s_GSSAPI_SERVER;
+static PyObject *__pyx_n_s_GSSAPI_SERVICE_PRINCIPAL;
+static PyObject *__pyx_n_s_HANDSHAKE_IVL;
+static PyObject *__pyx_n_s_HAUSNUMERO;
+static PyObject *__pyx_n_s_HWM;
+static PyObject *__pyx_n_s_IDENTITY;
+static PyObject *__pyx_n_s_IMMEDIATE;
+static PyObject *__pyx_n_s_IO_THREADS;
+static PyObject *__pyx_n_s_IO_THREADS_DFLT;
+static PyObject *__pyx_n_s_IPC_FILTER_GID;
+static PyObject *__pyx_n_s_IPC_FILTER_PID;
+static PyObject *__pyx_n_s_IPC_FILTER_UID;
+static PyObject *__pyx_n_s_IPV4ONLY;
+static PyObject *__pyx_n_s_IPV6;
+static PyObject *__pyx_n_s_LAST_ENDPOINT;
+static PyObject *__pyx_n_s_LINGER;
+static PyObject *__pyx_n_s_MAXMSGSIZE;
+static PyObject *__pyx_n_s_MAX_SOCKETS;
+static PyObject *__pyx_n_s_MAX_SOCKETS_DFLT;
+static PyObject *__pyx_n_s_MCAST_LOOP;
+static PyObject *__pyx_n_s_MECHANISM;
+static PyObject *__pyx_n_s_MORE;
+static PyObject *__pyx_n_s_MULTICAST_HOPS;
+static PyObject *__pyx_n_s_NOBLOCK;
+static PyObject *__pyx_n_s_NULL;
+static PyObject *__pyx_n_s_PAIR;
+static PyObject *__pyx_n_s_PLAIN;
+static PyObject *__pyx_n_s_PLAIN_PASSWORD;
+static PyObject *__pyx_n_s_PLAIN_SERVER;
+static PyObject *__pyx_n_s_PLAIN_USERNAME;
+static PyObject *__pyx_n_s_POLLERR;
+static PyObject *__pyx_n_s_POLLIN;
+static PyObject *__pyx_n_s_POLLITEMS_DFLT;
+static PyObject *__pyx_n_s_POLLOUT;
+static PyObject *__pyx_n_s_PROBE_ROUTER;
+static PyObject *__pyx_n_s_PUB;
+static PyObject *__pyx_n_s_PULL;
+static PyObject *__pyx_n_s_PUSH;
+static PyObject *__pyx_n_s_QUEUE;
+static PyObject *__pyx_n_s_RATE;
+static PyObject *__pyx_n_s_RCVBUF;
+static PyObject *__pyx_n_s_RCVHWM;
+static PyObject *__pyx_n_s_RCVMORE;
+static PyObject *__pyx_n_s_RCVTIMEO;
+static PyObject *__pyx_n_s_RECONNECT_IVL;
+static PyObject *__pyx_n_s_RECONNECT_IVL_MAX;
+static PyObject *__pyx_n_s_RECOVERY_IVL;
+static PyObject *__pyx_n_s_RECOVERY_IVL_MSEC;
+static PyObject *__pyx_n_s_REP;
+static PyObject *__pyx_n_s_REQ;
+static PyObject *__pyx_n_s_REQ_CORRELATE;
+static PyObject *__pyx_n_s_REQ_RELAXED;
+static PyObject *__pyx_n_s_ROUTER;
+static PyObject *__pyx_n_s_ROUTER_BEHAVIOR;
+static PyObject *__pyx_n_s_ROUTER_HANDOVER;
+static PyObject *__pyx_n_s_ROUTER_MANDATORY;
+static PyObject *__pyx_n_s_ROUTER_RAW;
+static PyObject *__pyx_n_s_SHARED;
+static PyObject *__pyx_n_s_SNDBUF;
+static PyObject *__pyx_n_s_SNDHWM;
+static PyObject *__pyx_n_s_SNDMORE;
+static PyObject *__pyx_n_s_SNDTIMEO;
+static PyObject *__pyx_n_s_SOCKET_LIMIT;
+static PyObject *__pyx_n_s_SOCKS_PROXY;
+static PyObject *__pyx_n_s_SRCFD;
+static PyObject *__pyx_n_s_STREAM;
+static PyObject *__pyx_n_s_STREAMER;
+static PyObject *__pyx_n_s_SUB;
+static PyObject *__pyx_n_s_SUBSCRIBE;
+static PyObject *__pyx_n_s_SWAP;
+static PyObject *__pyx_n_s_TCP_ACCEPT_FILTER;
+static PyObject *__pyx_n_s_TCP_KEEPALIVE;
+static PyObject *__pyx_n_s_TCP_KEEPALIVE_CNT;
+static PyObject *__pyx_n_s_TCP_KEEPALIVE_IDLE;
+static PyObject *__pyx_n_s_TCP_KEEPALIVE_INTVL;
+static PyObject *__pyx_n_s_THREAD_PRIORITY;
+static PyObject *__pyx_n_s_THREAD_PRIORITY_DFLT;
+static PyObject *__pyx_n_s_THREAD_SCHED_POLICY;
+static PyObject *__pyx_n_s_THREAD_SCHED_POLICY_DFLT;
+static PyObject *__pyx_n_s_TOS;
+static PyObject *__pyx_n_s_TYPE;
+static PyObject *__pyx_n_s_UNSUBSCRIBE;
+static PyObject *__pyx_n_s_UPSTREAM;
+static PyObject *__pyx_n_s_VERSION;
+static PyObject *__pyx_n_s_VERSION_MAJOR;
+static PyObject *__pyx_n_s_VERSION_MINOR;
+static PyObject *__pyx_n_s_VERSION_PATCH;
+static PyObject *__pyx_n_s_XPUB;
+static PyObject *__pyx_n_s_XPUB_NODROP;
+static PyObject *__pyx_n_s_XPUB_VERBOSE;
+static PyObject *__pyx_n_s_XREP;
+static PyObject *__pyx_n_s_XREQ;
+static PyObject *__pyx_n_s_XSUB;
+static PyObject *__pyx_n_s_ZAP_DOMAIN;
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_test;
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "constants",
+ __pyx_k_0MQ_Constants, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_AFFINITY, __pyx_k_AFFINITY, sizeof(__pyx_k_AFFINITY), 0, 0, 1, 1},
+ {&__pyx_n_s_BACKLOG, __pyx_k_BACKLOG, sizeof(__pyx_k_BACKLOG), 0, 0, 1, 1},
+ {&__pyx_n_s_CONFLATE, __pyx_k_CONFLATE, sizeof(__pyx_k_CONFLATE), 0, 0, 1, 1},
+ {&__pyx_n_s_CONNECT_RID, __pyx_k_CONNECT_RID, sizeof(__pyx_k_CONNECT_RID), 0, 0, 1, 1},
+ {&__pyx_n_s_CURVE, __pyx_k_CURVE, sizeof(__pyx_k_CURVE), 0, 0, 1, 1},
+ {&__pyx_n_s_CURVE_PUBLICKEY, __pyx_k_CURVE_PUBLICKEY, sizeof(__pyx_k_CURVE_PUBLICKEY), 0, 0, 1, 1},
+ {&__pyx_n_s_CURVE_SECRETKEY, __pyx_k_CURVE_SECRETKEY, sizeof(__pyx_k_CURVE_SECRETKEY), 0, 0, 1, 1},
+ {&__pyx_n_s_CURVE_SERVER, __pyx_k_CURVE_SERVER, sizeof(__pyx_k_CURVE_SERVER), 0, 0, 1, 1},
+ {&__pyx_n_s_CURVE_SERVERKEY, __pyx_k_CURVE_SERVERKEY, sizeof(__pyx_k_CURVE_SERVERKEY), 0, 0, 1, 1},
+ {&__pyx_n_s_DEALER, __pyx_k_DEALER, sizeof(__pyx_k_DEALER), 0, 0, 1, 1},
+ {&__pyx_n_s_DELAY_ATTACH_ON_CONNECT, __pyx_k_DELAY_ATTACH_ON_CONNECT, sizeof(__pyx_k_DELAY_ATTACH_ON_CONNECT), 0, 0, 1, 1},
+ {&__pyx_n_s_DONTWAIT, __pyx_k_DONTWAIT, sizeof(__pyx_k_DONTWAIT), 0, 0, 1, 1},
+ {&__pyx_n_s_DOWNSTREAM, __pyx_k_DOWNSTREAM, sizeof(__pyx_k_DOWNSTREAM), 0, 0, 1, 1},
+ {&__pyx_n_s_EADDRINUSE, __pyx_k_EADDRINUSE, sizeof(__pyx_k_EADDRINUSE), 0, 0, 1, 1},
+ {&__pyx_n_s_EADDRNOTAVAIL, __pyx_k_EADDRNOTAVAIL, sizeof(__pyx_k_EADDRNOTAVAIL), 0, 0, 1, 1},
+ {&__pyx_n_s_EAFNOSUPPORT, __pyx_k_EAFNOSUPPORT, sizeof(__pyx_k_EAFNOSUPPORT), 0, 0, 1, 1},
+ {&__pyx_n_s_EAGAIN, __pyx_k_EAGAIN, sizeof(__pyx_k_EAGAIN), 0, 0, 1, 1},
+ {&__pyx_n_s_ECONNABORTED, __pyx_k_ECONNABORTED, sizeof(__pyx_k_ECONNABORTED), 0, 0, 1, 1},
+ {&__pyx_n_s_ECONNREFUSED, __pyx_k_ECONNREFUSED, sizeof(__pyx_k_ECONNREFUSED), 0, 0, 1, 1},
+ {&__pyx_n_s_ECONNRESET, __pyx_k_ECONNRESET, sizeof(__pyx_k_ECONNRESET), 0, 0, 1, 1},
+ {&__pyx_n_s_EFAULT, __pyx_k_EFAULT, sizeof(__pyx_k_EFAULT), 0, 0, 1, 1},
+ {&__pyx_n_s_EFSM, __pyx_k_EFSM, sizeof(__pyx_k_EFSM), 0, 0, 1, 1},
+ {&__pyx_n_s_EHOSTUNREACH, __pyx_k_EHOSTUNREACH, sizeof(__pyx_k_EHOSTUNREACH), 0, 0, 1, 1},
+ {&__pyx_n_s_EINPROGRESS, __pyx_k_EINPROGRESS, sizeof(__pyx_k_EINPROGRESS), 0, 0, 1, 1},
+ {&__pyx_n_s_EINVAL, __pyx_k_EINVAL, sizeof(__pyx_k_EINVAL), 0, 0, 1, 1},
+ {&__pyx_n_s_EMSGSIZE, __pyx_k_EMSGSIZE, sizeof(__pyx_k_EMSGSIZE), 0, 0, 1, 1},
+ {&__pyx_n_s_EMTHREAD, __pyx_k_EMTHREAD, sizeof(__pyx_k_EMTHREAD), 0, 0, 1, 1},
+ {&__pyx_n_s_ENETDOWN, __pyx_k_ENETDOWN, sizeof(__pyx_k_ENETDOWN), 0, 0, 1, 1},
+ {&__pyx_n_s_ENETRESET, __pyx_k_ENETRESET, sizeof(__pyx_k_ENETRESET), 0, 0, 1, 1},
+ {&__pyx_n_s_ENETUNREACH, __pyx_k_ENETUNREACH, sizeof(__pyx_k_ENETUNREACH), 0, 0, 1, 1},
+ {&__pyx_n_s_ENOBUFS, __pyx_k_ENOBUFS, sizeof(__pyx_k_ENOBUFS), 0, 0, 1, 1},
+ {&__pyx_n_s_ENOCOMPATPROTO, __pyx_k_ENOCOMPATPROTO, sizeof(__pyx_k_ENOCOMPATPROTO), 0, 0, 1, 1},
+ {&__pyx_n_s_ENODEV, __pyx_k_ENODEV, sizeof(__pyx_k_ENODEV), 0, 0, 1, 1},
+ {&__pyx_n_s_ENOMEM, __pyx_k_ENOMEM, sizeof(__pyx_k_ENOMEM), 0, 0, 1, 1},
+ {&__pyx_n_s_ENOTCONN, __pyx_k_ENOTCONN, sizeof(__pyx_k_ENOTCONN), 0, 0, 1, 1},
+ {&__pyx_n_s_ENOTSOCK, __pyx_k_ENOTSOCK, sizeof(__pyx_k_ENOTSOCK), 0, 0, 1, 1},
+ {&__pyx_n_s_ENOTSUP, __pyx_k_ENOTSUP, sizeof(__pyx_k_ENOTSUP), 0, 0, 1, 1},
+ {&__pyx_n_s_EPROTONOSUPPORT, __pyx_k_EPROTONOSUPPORT, sizeof(__pyx_k_EPROTONOSUPPORT), 0, 0, 1, 1},
+ {&__pyx_n_s_ETERM, __pyx_k_ETERM, sizeof(__pyx_k_ETERM), 0, 0, 1, 1},
+ {&__pyx_n_s_ETIMEDOUT, __pyx_k_ETIMEDOUT, sizeof(__pyx_k_ETIMEDOUT), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENTS, __pyx_k_EVENTS, sizeof(__pyx_k_EVENTS), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_ACCEPTED, __pyx_k_EVENT_ACCEPTED, sizeof(__pyx_k_EVENT_ACCEPTED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_ACCEPT_FAILED, __pyx_k_EVENT_ACCEPT_FAILED, sizeof(__pyx_k_EVENT_ACCEPT_FAILED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_ALL, __pyx_k_EVENT_ALL, sizeof(__pyx_k_EVENT_ALL), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_BIND_FAILED, __pyx_k_EVENT_BIND_FAILED, sizeof(__pyx_k_EVENT_BIND_FAILED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_CLOSED, __pyx_k_EVENT_CLOSED, sizeof(__pyx_k_EVENT_CLOSED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_CLOSE_FAILED, __pyx_k_EVENT_CLOSE_FAILED, sizeof(__pyx_k_EVENT_CLOSE_FAILED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_CONNECTED, __pyx_k_EVENT_CONNECTED, sizeof(__pyx_k_EVENT_CONNECTED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_CONNECT_DELAYED, __pyx_k_EVENT_CONNECT_DELAYED, sizeof(__pyx_k_EVENT_CONNECT_DELAYED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_CONNECT_RETRIED, __pyx_k_EVENT_CONNECT_RETRIED, sizeof(__pyx_k_EVENT_CONNECT_RETRIED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_DISCONNECTED, __pyx_k_EVENT_DISCONNECTED, sizeof(__pyx_k_EVENT_DISCONNECTED), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_LISTENING, __pyx_k_EVENT_LISTENING, sizeof(__pyx_k_EVENT_LISTENING), 0, 0, 1, 1},
+ {&__pyx_n_s_EVENT_MONITOR_STOPPED, __pyx_k_EVENT_MONITOR_STOPPED, sizeof(__pyx_k_EVENT_MONITOR_STOPPED), 0, 0, 1, 1},
+ {&__pyx_n_s_FAIL_UNROUTABLE, __pyx_k_FAIL_UNROUTABLE, sizeof(__pyx_k_FAIL_UNROUTABLE), 0, 0, 1, 1},
+ {&__pyx_n_s_FD, __pyx_k_FD, sizeof(__pyx_k_FD), 0, 0, 1, 1},
+ {&__pyx_n_s_FORWARDER, __pyx_k_FORWARDER, sizeof(__pyx_k_FORWARDER), 0, 0, 1, 1},
+ {&__pyx_n_s_GSSAPI, __pyx_k_GSSAPI, sizeof(__pyx_k_GSSAPI), 0, 0, 1, 1},
+ {&__pyx_n_s_GSSAPI_PLAINTEXT, __pyx_k_GSSAPI_PLAINTEXT, sizeof(__pyx_k_GSSAPI_PLAINTEXT), 0, 0, 1, 1},
+ {&__pyx_n_s_GSSAPI_PRINCIPAL, __pyx_k_GSSAPI_PRINCIPAL, sizeof(__pyx_k_GSSAPI_PRINCIPAL), 0, 0, 1, 1},
+ {&__pyx_n_s_GSSAPI_SERVER, __pyx_k_GSSAPI_SERVER, sizeof(__pyx_k_GSSAPI_SERVER), 0, 0, 1, 1},
+ {&__pyx_n_s_GSSAPI_SERVICE_PRINCIPAL, __pyx_k_GSSAPI_SERVICE_PRINCIPAL, sizeof(__pyx_k_GSSAPI_SERVICE_PRINCIPAL), 0, 0, 1, 1},
+ {&__pyx_n_s_HANDSHAKE_IVL, __pyx_k_HANDSHAKE_IVL, sizeof(__pyx_k_HANDSHAKE_IVL), 0, 0, 1, 1},
+ {&__pyx_n_s_HAUSNUMERO, __pyx_k_HAUSNUMERO, sizeof(__pyx_k_HAUSNUMERO), 0, 0, 1, 1},
+ {&__pyx_n_s_HWM, __pyx_k_HWM, sizeof(__pyx_k_HWM), 0, 0, 1, 1},
+ {&__pyx_n_s_IDENTITY, __pyx_k_IDENTITY, sizeof(__pyx_k_IDENTITY), 0, 0, 1, 1},
+ {&__pyx_n_s_IMMEDIATE, __pyx_k_IMMEDIATE, sizeof(__pyx_k_IMMEDIATE), 0, 0, 1, 1},
+ {&__pyx_n_s_IO_THREADS, __pyx_k_IO_THREADS, sizeof(__pyx_k_IO_THREADS), 0, 0, 1, 1},
+ {&__pyx_n_s_IO_THREADS_DFLT, __pyx_k_IO_THREADS_DFLT, sizeof(__pyx_k_IO_THREADS_DFLT), 0, 0, 1, 1},
+ {&__pyx_n_s_IPC_FILTER_GID, __pyx_k_IPC_FILTER_GID, sizeof(__pyx_k_IPC_FILTER_GID), 0, 0, 1, 1},
+ {&__pyx_n_s_IPC_FILTER_PID, __pyx_k_IPC_FILTER_PID, sizeof(__pyx_k_IPC_FILTER_PID), 0, 0, 1, 1},
+ {&__pyx_n_s_IPC_FILTER_UID, __pyx_k_IPC_FILTER_UID, sizeof(__pyx_k_IPC_FILTER_UID), 0, 0, 1, 1},
+ {&__pyx_n_s_IPV4ONLY, __pyx_k_IPV4ONLY, sizeof(__pyx_k_IPV4ONLY), 0, 0, 1, 1},
+ {&__pyx_n_s_IPV6, __pyx_k_IPV6, sizeof(__pyx_k_IPV6), 0, 0, 1, 1},
+ {&__pyx_n_s_LAST_ENDPOINT, __pyx_k_LAST_ENDPOINT, sizeof(__pyx_k_LAST_ENDPOINT), 0, 0, 1, 1},
+ {&__pyx_n_s_LINGER, __pyx_k_LINGER, sizeof(__pyx_k_LINGER), 0, 0, 1, 1},
+ {&__pyx_n_s_MAXMSGSIZE, __pyx_k_MAXMSGSIZE, sizeof(__pyx_k_MAXMSGSIZE), 0, 0, 1, 1},
+ {&__pyx_n_s_MAX_SOCKETS, __pyx_k_MAX_SOCKETS, sizeof(__pyx_k_MAX_SOCKETS), 0, 0, 1, 1},
+ {&__pyx_n_s_MAX_SOCKETS_DFLT, __pyx_k_MAX_SOCKETS_DFLT, sizeof(__pyx_k_MAX_SOCKETS_DFLT), 0, 0, 1, 1},
+ {&__pyx_n_s_MCAST_LOOP, __pyx_k_MCAST_LOOP, sizeof(__pyx_k_MCAST_LOOP), 0, 0, 1, 1},
+ {&__pyx_n_s_MECHANISM, __pyx_k_MECHANISM, sizeof(__pyx_k_MECHANISM), 0, 0, 1, 1},
+ {&__pyx_n_s_MORE, __pyx_k_MORE, sizeof(__pyx_k_MORE), 0, 0, 1, 1},
+ {&__pyx_n_s_MULTICAST_HOPS, __pyx_k_MULTICAST_HOPS, sizeof(__pyx_k_MULTICAST_HOPS), 0, 0, 1, 1},
+ {&__pyx_n_s_NOBLOCK, __pyx_k_NOBLOCK, sizeof(__pyx_k_NOBLOCK), 0, 0, 1, 1},
+ {&__pyx_n_s_NULL, __pyx_k_NULL, sizeof(__pyx_k_NULL), 0, 0, 1, 1},
+ {&__pyx_n_s_PAIR, __pyx_k_PAIR, sizeof(__pyx_k_PAIR), 0, 0, 1, 1},
+ {&__pyx_n_s_PLAIN, __pyx_k_PLAIN, sizeof(__pyx_k_PLAIN), 0, 0, 1, 1},
+ {&__pyx_n_s_PLAIN_PASSWORD, __pyx_k_PLAIN_PASSWORD, sizeof(__pyx_k_PLAIN_PASSWORD), 0, 0, 1, 1},
+ {&__pyx_n_s_PLAIN_SERVER, __pyx_k_PLAIN_SERVER, sizeof(__pyx_k_PLAIN_SERVER), 0, 0, 1, 1},
+ {&__pyx_n_s_PLAIN_USERNAME, __pyx_k_PLAIN_USERNAME, sizeof(__pyx_k_PLAIN_USERNAME), 0, 0, 1, 1},
+ {&__pyx_n_s_POLLERR, __pyx_k_POLLERR, sizeof(__pyx_k_POLLERR), 0, 0, 1, 1},
+ {&__pyx_n_s_POLLIN, __pyx_k_POLLIN, sizeof(__pyx_k_POLLIN), 0, 0, 1, 1},
+ {&__pyx_n_s_POLLITEMS_DFLT, __pyx_k_POLLITEMS_DFLT, sizeof(__pyx_k_POLLITEMS_DFLT), 0, 0, 1, 1},
+ {&__pyx_n_s_POLLOUT, __pyx_k_POLLOUT, sizeof(__pyx_k_POLLOUT), 0, 0, 1, 1},
+ {&__pyx_n_s_PROBE_ROUTER, __pyx_k_PROBE_ROUTER, sizeof(__pyx_k_PROBE_ROUTER), 0, 0, 1, 1},
+ {&__pyx_n_s_PUB, __pyx_k_PUB, sizeof(__pyx_k_PUB), 0, 0, 1, 1},
+ {&__pyx_n_s_PULL, __pyx_k_PULL, sizeof(__pyx_k_PULL), 0, 0, 1, 1},
+ {&__pyx_n_s_PUSH, __pyx_k_PUSH, sizeof(__pyx_k_PUSH), 0, 0, 1, 1},
+ {&__pyx_n_s_QUEUE, __pyx_k_QUEUE, sizeof(__pyx_k_QUEUE), 0, 0, 1, 1},
+ {&__pyx_n_s_RATE, __pyx_k_RATE, sizeof(__pyx_k_RATE), 0, 0, 1, 1},
+ {&__pyx_n_s_RCVBUF, __pyx_k_RCVBUF, sizeof(__pyx_k_RCVBUF), 0, 0, 1, 1},
+ {&__pyx_n_s_RCVHWM, __pyx_k_RCVHWM, sizeof(__pyx_k_RCVHWM), 0, 0, 1, 1},
+ {&__pyx_n_s_RCVMORE, __pyx_k_RCVMORE, sizeof(__pyx_k_RCVMORE), 0, 0, 1, 1},
+ {&__pyx_n_s_RCVTIMEO, __pyx_k_RCVTIMEO, sizeof(__pyx_k_RCVTIMEO), 0, 0, 1, 1},
+ {&__pyx_n_s_RECONNECT_IVL, __pyx_k_RECONNECT_IVL, sizeof(__pyx_k_RECONNECT_IVL), 0, 0, 1, 1},
+ {&__pyx_n_s_RECONNECT_IVL_MAX, __pyx_k_RECONNECT_IVL_MAX, sizeof(__pyx_k_RECONNECT_IVL_MAX), 0, 0, 1, 1},
+ {&__pyx_n_s_RECOVERY_IVL, __pyx_k_RECOVERY_IVL, sizeof(__pyx_k_RECOVERY_IVL), 0, 0, 1, 1},
+ {&__pyx_n_s_RECOVERY_IVL_MSEC, __pyx_k_RECOVERY_IVL_MSEC, sizeof(__pyx_k_RECOVERY_IVL_MSEC), 0, 0, 1, 1},
+ {&__pyx_n_s_REP, __pyx_k_REP, sizeof(__pyx_k_REP), 0, 0, 1, 1},
+ {&__pyx_n_s_REQ, __pyx_k_REQ, sizeof(__pyx_k_REQ), 0, 0, 1, 1},
+ {&__pyx_n_s_REQ_CORRELATE, __pyx_k_REQ_CORRELATE, sizeof(__pyx_k_REQ_CORRELATE), 0, 0, 1, 1},
+ {&__pyx_n_s_REQ_RELAXED, __pyx_k_REQ_RELAXED, sizeof(__pyx_k_REQ_RELAXED), 0, 0, 1, 1},
+ {&__pyx_n_s_ROUTER, __pyx_k_ROUTER, sizeof(__pyx_k_ROUTER), 0, 0, 1, 1},
+ {&__pyx_n_s_ROUTER_BEHAVIOR, __pyx_k_ROUTER_BEHAVIOR, sizeof(__pyx_k_ROUTER_BEHAVIOR), 0, 0, 1, 1},
+ {&__pyx_n_s_ROUTER_HANDOVER, __pyx_k_ROUTER_HANDOVER, sizeof(__pyx_k_ROUTER_HANDOVER), 0, 0, 1, 1},
+ {&__pyx_n_s_ROUTER_MANDATORY, __pyx_k_ROUTER_MANDATORY, sizeof(__pyx_k_ROUTER_MANDATORY), 0, 0, 1, 1},
+ {&__pyx_n_s_ROUTER_RAW, __pyx_k_ROUTER_RAW, sizeof(__pyx_k_ROUTER_RAW), 0, 0, 1, 1},
+ {&__pyx_n_s_SHARED, __pyx_k_SHARED, sizeof(__pyx_k_SHARED), 0, 0, 1, 1},
+ {&__pyx_n_s_SNDBUF, __pyx_k_SNDBUF, sizeof(__pyx_k_SNDBUF), 0, 0, 1, 1},
+ {&__pyx_n_s_SNDHWM, __pyx_k_SNDHWM, sizeof(__pyx_k_SNDHWM), 0, 0, 1, 1},
+ {&__pyx_n_s_SNDMORE, __pyx_k_SNDMORE, sizeof(__pyx_k_SNDMORE), 0, 0, 1, 1},
+ {&__pyx_n_s_SNDTIMEO, __pyx_k_SNDTIMEO, sizeof(__pyx_k_SNDTIMEO), 0, 0, 1, 1},
+ {&__pyx_n_s_SOCKET_LIMIT, __pyx_k_SOCKET_LIMIT, sizeof(__pyx_k_SOCKET_LIMIT), 0, 0, 1, 1},
+ {&__pyx_n_s_SOCKS_PROXY, __pyx_k_SOCKS_PROXY, sizeof(__pyx_k_SOCKS_PROXY), 0, 0, 1, 1},
+ {&__pyx_n_s_SRCFD, __pyx_k_SRCFD, sizeof(__pyx_k_SRCFD), 0, 0, 1, 1},
+ {&__pyx_n_s_STREAM, __pyx_k_STREAM, sizeof(__pyx_k_STREAM), 0, 0, 1, 1},
+ {&__pyx_n_s_STREAMER, __pyx_k_STREAMER, sizeof(__pyx_k_STREAMER), 0, 0, 1, 1},
+ {&__pyx_n_s_SUB, __pyx_k_SUB, sizeof(__pyx_k_SUB), 0, 0, 1, 1},
+ {&__pyx_n_s_SUBSCRIBE, __pyx_k_SUBSCRIBE, sizeof(__pyx_k_SUBSCRIBE), 0, 0, 1, 1},
+ {&__pyx_n_s_SWAP, __pyx_k_SWAP, sizeof(__pyx_k_SWAP), 0, 0, 1, 1},
+ {&__pyx_n_s_TCP_ACCEPT_FILTER, __pyx_k_TCP_ACCEPT_FILTER, sizeof(__pyx_k_TCP_ACCEPT_FILTER), 0, 0, 1, 1},
+ {&__pyx_n_s_TCP_KEEPALIVE, __pyx_k_TCP_KEEPALIVE, sizeof(__pyx_k_TCP_KEEPALIVE), 0, 0, 1, 1},
+ {&__pyx_n_s_TCP_KEEPALIVE_CNT, __pyx_k_TCP_KEEPALIVE_CNT, sizeof(__pyx_k_TCP_KEEPALIVE_CNT), 0, 0, 1, 1},
+ {&__pyx_n_s_TCP_KEEPALIVE_IDLE, __pyx_k_TCP_KEEPALIVE_IDLE, sizeof(__pyx_k_TCP_KEEPALIVE_IDLE), 0, 0, 1, 1},
+ {&__pyx_n_s_TCP_KEEPALIVE_INTVL, __pyx_k_TCP_KEEPALIVE_INTVL, sizeof(__pyx_k_TCP_KEEPALIVE_INTVL), 0, 0, 1, 1},
+ {&__pyx_n_s_THREAD_PRIORITY, __pyx_k_THREAD_PRIORITY, sizeof(__pyx_k_THREAD_PRIORITY), 0, 0, 1, 1},
+ {&__pyx_n_s_THREAD_PRIORITY_DFLT, __pyx_k_THREAD_PRIORITY_DFLT, sizeof(__pyx_k_THREAD_PRIORITY_DFLT), 0, 0, 1, 1},
+ {&__pyx_n_s_THREAD_SCHED_POLICY, __pyx_k_THREAD_SCHED_POLICY, sizeof(__pyx_k_THREAD_SCHED_POLICY), 0, 0, 1, 1},
+ {&__pyx_n_s_THREAD_SCHED_POLICY_DFLT, __pyx_k_THREAD_SCHED_POLICY_DFLT, sizeof(__pyx_k_THREAD_SCHED_POLICY_DFLT), 0, 0, 1, 1},
+ {&__pyx_n_s_TOS, __pyx_k_TOS, sizeof(__pyx_k_TOS), 0, 0, 1, 1},
+ {&__pyx_n_s_TYPE, __pyx_k_TYPE, sizeof(__pyx_k_TYPE), 0, 0, 1, 1},
+ {&__pyx_n_s_UNSUBSCRIBE, __pyx_k_UNSUBSCRIBE, sizeof(__pyx_k_UNSUBSCRIBE), 0, 0, 1, 1},
+ {&__pyx_n_s_UPSTREAM, __pyx_k_UPSTREAM, sizeof(__pyx_k_UPSTREAM), 0, 0, 1, 1},
+ {&__pyx_n_s_VERSION, __pyx_k_VERSION, sizeof(__pyx_k_VERSION), 0, 0, 1, 1},
+ {&__pyx_n_s_VERSION_MAJOR, __pyx_k_VERSION_MAJOR, sizeof(__pyx_k_VERSION_MAJOR), 0, 0, 1, 1},
+ {&__pyx_n_s_VERSION_MINOR, __pyx_k_VERSION_MINOR, sizeof(__pyx_k_VERSION_MINOR), 0, 0, 1, 1},
+ {&__pyx_n_s_VERSION_PATCH, __pyx_k_VERSION_PATCH, sizeof(__pyx_k_VERSION_PATCH), 0, 0, 1, 1},
+ {&__pyx_n_s_XPUB, __pyx_k_XPUB, sizeof(__pyx_k_XPUB), 0, 0, 1, 1},
+ {&__pyx_n_s_XPUB_NODROP, __pyx_k_XPUB_NODROP, sizeof(__pyx_k_XPUB_NODROP), 0, 0, 1, 1},
+ {&__pyx_n_s_XPUB_VERBOSE, __pyx_k_XPUB_VERBOSE, sizeof(__pyx_k_XPUB_VERBOSE), 0, 0, 1, 1},
+ {&__pyx_n_s_XREP, __pyx_k_XREP, sizeof(__pyx_k_XREP), 0, 0, 1, 1},
+ {&__pyx_n_s_XREQ, __pyx_k_XREQ, sizeof(__pyx_k_XREQ), 0, 0, 1, 1},
+ {&__pyx_n_s_XSUB, __pyx_k_XSUB, sizeof(__pyx_k_XSUB), 0, 0, 1, 1},
+ {&__pyx_n_s_ZAP_DOMAIN, __pyx_k_ZAP_DOMAIN, sizeof(__pyx_k_ZAP_DOMAIN), 0, 0, 1, 1},
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ return 0;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+ __Pyx_RefNannyFinishContext();
+ return 0;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initconstants(void); /*proto*/
+PyMODINIT_FUNC initconstants(void)
+#else
+PyMODINIT_FUNC PyInit_constants(void); /*proto*/
+PyMODINIT_FUNC PyInit_constants(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_constants(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("constants", __pyx_methods, __pyx_k_0MQ_Constants, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython__constants) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython.constants")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython.constants", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ /*--- Type import code ---*/
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/constants.pxi":5
+ * #-----------------------------------------------------------------------------
+ *
+ * VERSION = ZMQ_VERSION # <<<<<<<<<<<<<<
+ * VERSION_MAJOR = ZMQ_VERSION_MAJOR
+ * VERSION_MINOR = ZMQ_VERSION_MINOR
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_VERSION); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":6
+ *
+ * VERSION = ZMQ_VERSION
+ * VERSION_MAJOR = ZMQ_VERSION_MAJOR # <<<<<<<<<<<<<<
+ * VERSION_MINOR = ZMQ_VERSION_MINOR
+ * VERSION_PATCH = ZMQ_VERSION_PATCH
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_VERSION_MAJOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_MAJOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":7
+ * VERSION = ZMQ_VERSION
+ * VERSION_MAJOR = ZMQ_VERSION_MAJOR
+ * VERSION_MINOR = ZMQ_VERSION_MINOR # <<<<<<<<<<<<<<
+ * VERSION_PATCH = ZMQ_VERSION_PATCH
+ * NOBLOCK = ZMQ_NOBLOCK
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_VERSION_MINOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_MINOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":8
+ * VERSION_MAJOR = ZMQ_VERSION_MAJOR
+ * VERSION_MINOR = ZMQ_VERSION_MINOR
+ * VERSION_PATCH = ZMQ_VERSION_PATCH # <<<<<<<<<<<<<<
+ * NOBLOCK = ZMQ_NOBLOCK
+ * DONTWAIT = ZMQ_DONTWAIT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_VERSION_PATCH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_PATCH, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":9
+ * VERSION_MINOR = ZMQ_VERSION_MINOR
+ * VERSION_PATCH = ZMQ_VERSION_PATCH
+ * NOBLOCK = ZMQ_NOBLOCK # <<<<<<<<<<<<<<
+ * DONTWAIT = ZMQ_DONTWAIT
+ * POLLIN = ZMQ_POLLIN
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_NOBLOCK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_NOBLOCK, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":10
+ * VERSION_PATCH = ZMQ_VERSION_PATCH
+ * NOBLOCK = ZMQ_NOBLOCK
+ * DONTWAIT = ZMQ_DONTWAIT # <<<<<<<<<<<<<<
+ * POLLIN = ZMQ_POLLIN
+ * POLLOUT = ZMQ_POLLOUT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_DONTWAIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DONTWAIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":11
+ * NOBLOCK = ZMQ_NOBLOCK
+ * DONTWAIT = ZMQ_DONTWAIT
+ * POLLIN = ZMQ_POLLIN # <<<<<<<<<<<<<<
+ * POLLOUT = ZMQ_POLLOUT
+ * POLLERR = ZMQ_POLLERR
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_POLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_POLLIN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":12
+ * DONTWAIT = ZMQ_DONTWAIT
+ * POLLIN = ZMQ_POLLIN
+ * POLLOUT = ZMQ_POLLOUT # <<<<<<<<<<<<<<
+ * POLLERR = ZMQ_POLLERR
+ * SNDMORE = ZMQ_SNDMORE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_POLLOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_POLLOUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":13
+ * POLLIN = ZMQ_POLLIN
+ * POLLOUT = ZMQ_POLLOUT
+ * POLLERR = ZMQ_POLLERR # <<<<<<<<<<<<<<
+ * SNDMORE = ZMQ_SNDMORE
+ * STREAMER = ZMQ_STREAMER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_POLLERR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_POLLERR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":14
+ * POLLOUT = ZMQ_POLLOUT
+ * POLLERR = ZMQ_POLLERR
+ * SNDMORE = ZMQ_SNDMORE # <<<<<<<<<<<<<<
+ * STREAMER = ZMQ_STREAMER
+ * FORWARDER = ZMQ_FORWARDER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SNDMORE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SNDMORE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":15
+ * POLLERR = ZMQ_POLLERR
+ * SNDMORE = ZMQ_SNDMORE
+ * STREAMER = ZMQ_STREAMER # <<<<<<<<<<<<<<
+ * FORWARDER = ZMQ_FORWARDER
+ * QUEUE = ZMQ_QUEUE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_STREAMER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_STREAMER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":16
+ * SNDMORE = ZMQ_SNDMORE
+ * STREAMER = ZMQ_STREAMER
+ * FORWARDER = ZMQ_FORWARDER # <<<<<<<<<<<<<<
+ * QUEUE = ZMQ_QUEUE
+ * IO_THREADS_DFLT = ZMQ_IO_THREADS_DFLT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_FORWARDER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_FORWARDER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":17
+ * STREAMER = ZMQ_STREAMER
+ * FORWARDER = ZMQ_FORWARDER
+ * QUEUE = ZMQ_QUEUE # <<<<<<<<<<<<<<
+ * IO_THREADS_DFLT = ZMQ_IO_THREADS_DFLT
+ * MAX_SOCKETS_DFLT = ZMQ_MAX_SOCKETS_DFLT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_QUEUE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_QUEUE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":18
+ * FORWARDER = ZMQ_FORWARDER
+ * QUEUE = ZMQ_QUEUE
+ * IO_THREADS_DFLT = ZMQ_IO_THREADS_DFLT # <<<<<<<<<<<<<<
+ * MAX_SOCKETS_DFLT = ZMQ_MAX_SOCKETS_DFLT
+ * POLLITEMS_DFLT = ZMQ_POLLITEMS_DFLT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IO_THREADS_DFLT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IO_THREADS_DFLT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":19
+ * QUEUE = ZMQ_QUEUE
+ * IO_THREADS_DFLT = ZMQ_IO_THREADS_DFLT
+ * MAX_SOCKETS_DFLT = ZMQ_MAX_SOCKETS_DFLT # <<<<<<<<<<<<<<
+ * POLLITEMS_DFLT = ZMQ_POLLITEMS_DFLT
+ * THREAD_PRIORITY_DFLT = ZMQ_THREAD_PRIORITY_DFLT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_MAX_SOCKETS_DFLT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_SOCKETS_DFLT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":20
+ * IO_THREADS_DFLT = ZMQ_IO_THREADS_DFLT
+ * MAX_SOCKETS_DFLT = ZMQ_MAX_SOCKETS_DFLT
+ * POLLITEMS_DFLT = ZMQ_POLLITEMS_DFLT # <<<<<<<<<<<<<<
+ * THREAD_PRIORITY_DFLT = ZMQ_THREAD_PRIORITY_DFLT
+ * THREAD_SCHED_POLICY_DFLT = ZMQ_THREAD_SCHED_POLICY_DFLT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_POLLITEMS_DFLT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_POLLITEMS_DFLT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":21
+ * MAX_SOCKETS_DFLT = ZMQ_MAX_SOCKETS_DFLT
+ * POLLITEMS_DFLT = ZMQ_POLLITEMS_DFLT
+ * THREAD_PRIORITY_DFLT = ZMQ_THREAD_PRIORITY_DFLT # <<<<<<<<<<<<<<
+ * THREAD_SCHED_POLICY_DFLT = ZMQ_THREAD_SCHED_POLICY_DFLT
+ * PAIR = ZMQ_PAIR
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_THREAD_PRIORITY_DFLT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_THREAD_PRIORITY_DFLT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":22
+ * POLLITEMS_DFLT = ZMQ_POLLITEMS_DFLT
+ * THREAD_PRIORITY_DFLT = ZMQ_THREAD_PRIORITY_DFLT
+ * THREAD_SCHED_POLICY_DFLT = ZMQ_THREAD_SCHED_POLICY_DFLT # <<<<<<<<<<<<<<
+ * PAIR = ZMQ_PAIR
+ * PUB = ZMQ_PUB
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_THREAD_SCHED_POLICY_DFLT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_THREAD_SCHED_POLICY_DFLT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":23
+ * THREAD_PRIORITY_DFLT = ZMQ_THREAD_PRIORITY_DFLT
+ * THREAD_SCHED_POLICY_DFLT = ZMQ_THREAD_SCHED_POLICY_DFLT
+ * PAIR = ZMQ_PAIR # <<<<<<<<<<<<<<
+ * PUB = ZMQ_PUB
+ * SUB = ZMQ_SUB
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PAIR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PAIR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":24
+ * THREAD_SCHED_POLICY_DFLT = ZMQ_THREAD_SCHED_POLICY_DFLT
+ * PAIR = ZMQ_PAIR
+ * PUB = ZMQ_PUB # <<<<<<<<<<<<<<
+ * SUB = ZMQ_SUB
+ * REQ = ZMQ_REQ
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PUB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PUB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":25
+ * PAIR = ZMQ_PAIR
+ * PUB = ZMQ_PUB
+ * SUB = ZMQ_SUB # <<<<<<<<<<<<<<
+ * REQ = ZMQ_REQ
+ * REP = ZMQ_REP
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SUB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SUB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":26
+ * PUB = ZMQ_PUB
+ * SUB = ZMQ_SUB
+ * REQ = ZMQ_REQ # <<<<<<<<<<<<<<
+ * REP = ZMQ_REP
+ * DEALER = ZMQ_DEALER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_REQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_REQ, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":27
+ * SUB = ZMQ_SUB
+ * REQ = ZMQ_REQ
+ * REP = ZMQ_REP # <<<<<<<<<<<<<<
+ * DEALER = ZMQ_DEALER
+ * ROUTER = ZMQ_ROUTER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_REP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_REP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":28
+ * REQ = ZMQ_REQ
+ * REP = ZMQ_REP
+ * DEALER = ZMQ_DEALER # <<<<<<<<<<<<<<
+ * ROUTER = ZMQ_ROUTER
+ * XREQ = ZMQ_XREQ
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_DEALER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEALER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":29
+ * REP = ZMQ_REP
+ * DEALER = ZMQ_DEALER
+ * ROUTER = ZMQ_ROUTER # <<<<<<<<<<<<<<
+ * XREQ = ZMQ_XREQ
+ * XREP = ZMQ_XREP
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_ROUTER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ROUTER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":30
+ * DEALER = ZMQ_DEALER
+ * ROUTER = ZMQ_ROUTER
+ * XREQ = ZMQ_XREQ # <<<<<<<<<<<<<<
+ * XREP = ZMQ_XREP
+ * PULL = ZMQ_PULL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_XREQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_XREQ, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":31
+ * ROUTER = ZMQ_ROUTER
+ * XREQ = ZMQ_XREQ
+ * XREP = ZMQ_XREP # <<<<<<<<<<<<<<
+ * PULL = ZMQ_PULL
+ * PUSH = ZMQ_PUSH
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_XREP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_XREP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":32
+ * XREQ = ZMQ_XREQ
+ * XREP = ZMQ_XREP
+ * PULL = ZMQ_PULL # <<<<<<<<<<<<<<
+ * PUSH = ZMQ_PUSH
+ * XPUB = ZMQ_XPUB
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PULL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":33
+ * XREP = ZMQ_XREP
+ * PULL = ZMQ_PULL
+ * PUSH = ZMQ_PUSH # <<<<<<<<<<<<<<
+ * XPUB = ZMQ_XPUB
+ * XSUB = ZMQ_XSUB
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PUSH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PUSH, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":34
+ * PULL = ZMQ_PULL
+ * PUSH = ZMQ_PUSH
+ * XPUB = ZMQ_XPUB # <<<<<<<<<<<<<<
+ * XSUB = ZMQ_XSUB
+ * UPSTREAM = ZMQ_UPSTREAM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_XPUB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPUB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":35
+ * PUSH = ZMQ_PUSH
+ * XPUB = ZMQ_XPUB
+ * XSUB = ZMQ_XSUB # <<<<<<<<<<<<<<
+ * UPSTREAM = ZMQ_UPSTREAM
+ * DOWNSTREAM = ZMQ_DOWNSTREAM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_XSUB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_XSUB, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":36
+ * XPUB = ZMQ_XPUB
+ * XSUB = ZMQ_XSUB
+ * UPSTREAM = ZMQ_UPSTREAM # <<<<<<<<<<<<<<
+ * DOWNSTREAM = ZMQ_DOWNSTREAM
+ * STREAM = ZMQ_STREAM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_UPSTREAM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_UPSTREAM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":37
+ * XSUB = ZMQ_XSUB
+ * UPSTREAM = ZMQ_UPSTREAM
+ * DOWNSTREAM = ZMQ_DOWNSTREAM # <<<<<<<<<<<<<<
+ * STREAM = ZMQ_STREAM
+ * EVENT_CONNECTED = ZMQ_EVENT_CONNECTED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_DOWNSTREAM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DOWNSTREAM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":38
+ * UPSTREAM = ZMQ_UPSTREAM
+ * DOWNSTREAM = ZMQ_DOWNSTREAM
+ * STREAM = ZMQ_STREAM # <<<<<<<<<<<<<<
+ * EVENT_CONNECTED = ZMQ_EVENT_CONNECTED
+ * EVENT_CONNECT_DELAYED = ZMQ_EVENT_CONNECT_DELAYED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_STREAM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_STREAM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":39
+ * DOWNSTREAM = ZMQ_DOWNSTREAM
+ * STREAM = ZMQ_STREAM
+ * EVENT_CONNECTED = ZMQ_EVENT_CONNECTED # <<<<<<<<<<<<<<
+ * EVENT_CONNECT_DELAYED = ZMQ_EVENT_CONNECT_DELAYED
+ * EVENT_CONNECT_RETRIED = ZMQ_EVENT_CONNECT_RETRIED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_CONNECTED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_CONNECTED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":40
+ * STREAM = ZMQ_STREAM
+ * EVENT_CONNECTED = ZMQ_EVENT_CONNECTED
+ * EVENT_CONNECT_DELAYED = ZMQ_EVENT_CONNECT_DELAYED # <<<<<<<<<<<<<<
+ * EVENT_CONNECT_RETRIED = ZMQ_EVENT_CONNECT_RETRIED
+ * EVENT_LISTENING = ZMQ_EVENT_LISTENING
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_CONNECT_DELAYED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_CONNECT_DELAYED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":41
+ * EVENT_CONNECTED = ZMQ_EVENT_CONNECTED
+ * EVENT_CONNECT_DELAYED = ZMQ_EVENT_CONNECT_DELAYED
+ * EVENT_CONNECT_RETRIED = ZMQ_EVENT_CONNECT_RETRIED # <<<<<<<<<<<<<<
+ * EVENT_LISTENING = ZMQ_EVENT_LISTENING
+ * EVENT_BIND_FAILED = ZMQ_EVENT_BIND_FAILED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_CONNECT_RETRIED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_CONNECT_RETRIED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":42
+ * EVENT_CONNECT_DELAYED = ZMQ_EVENT_CONNECT_DELAYED
+ * EVENT_CONNECT_RETRIED = ZMQ_EVENT_CONNECT_RETRIED
+ * EVENT_LISTENING = ZMQ_EVENT_LISTENING # <<<<<<<<<<<<<<
+ * EVENT_BIND_FAILED = ZMQ_EVENT_BIND_FAILED
+ * EVENT_ACCEPTED = ZMQ_EVENT_ACCEPTED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_LISTENING); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_LISTENING, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":43
+ * EVENT_CONNECT_RETRIED = ZMQ_EVENT_CONNECT_RETRIED
+ * EVENT_LISTENING = ZMQ_EVENT_LISTENING
+ * EVENT_BIND_FAILED = ZMQ_EVENT_BIND_FAILED # <<<<<<<<<<<<<<
+ * EVENT_ACCEPTED = ZMQ_EVENT_ACCEPTED
+ * EVENT_ACCEPT_FAILED = ZMQ_EVENT_ACCEPT_FAILED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_BIND_FAILED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_BIND_FAILED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":44
+ * EVENT_LISTENING = ZMQ_EVENT_LISTENING
+ * EVENT_BIND_FAILED = ZMQ_EVENT_BIND_FAILED
+ * EVENT_ACCEPTED = ZMQ_EVENT_ACCEPTED # <<<<<<<<<<<<<<
+ * EVENT_ACCEPT_FAILED = ZMQ_EVENT_ACCEPT_FAILED
+ * EVENT_CLOSED = ZMQ_EVENT_CLOSED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_ACCEPTED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_ACCEPTED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":45
+ * EVENT_BIND_FAILED = ZMQ_EVENT_BIND_FAILED
+ * EVENT_ACCEPTED = ZMQ_EVENT_ACCEPTED
+ * EVENT_ACCEPT_FAILED = ZMQ_EVENT_ACCEPT_FAILED # <<<<<<<<<<<<<<
+ * EVENT_CLOSED = ZMQ_EVENT_CLOSED
+ * EVENT_CLOSE_FAILED = ZMQ_EVENT_CLOSE_FAILED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_ACCEPT_FAILED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_ACCEPT_FAILED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":46
+ * EVENT_ACCEPTED = ZMQ_EVENT_ACCEPTED
+ * EVENT_ACCEPT_FAILED = ZMQ_EVENT_ACCEPT_FAILED
+ * EVENT_CLOSED = ZMQ_EVENT_CLOSED # <<<<<<<<<<<<<<
+ * EVENT_CLOSE_FAILED = ZMQ_EVENT_CLOSE_FAILED
+ * EVENT_DISCONNECTED = ZMQ_EVENT_DISCONNECTED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_CLOSED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_CLOSED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":47
+ * EVENT_ACCEPT_FAILED = ZMQ_EVENT_ACCEPT_FAILED
+ * EVENT_CLOSED = ZMQ_EVENT_CLOSED
+ * EVENT_CLOSE_FAILED = ZMQ_EVENT_CLOSE_FAILED # <<<<<<<<<<<<<<
+ * EVENT_DISCONNECTED = ZMQ_EVENT_DISCONNECTED
+ * EVENT_ALL = ZMQ_EVENT_ALL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_CLOSE_FAILED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_CLOSE_FAILED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":48
+ * EVENT_CLOSED = ZMQ_EVENT_CLOSED
+ * EVENT_CLOSE_FAILED = ZMQ_EVENT_CLOSE_FAILED
+ * EVENT_DISCONNECTED = ZMQ_EVENT_DISCONNECTED # <<<<<<<<<<<<<<
+ * EVENT_ALL = ZMQ_EVENT_ALL
+ * EVENT_MONITOR_STOPPED = ZMQ_EVENT_MONITOR_STOPPED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_DISCONNECTED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_DISCONNECTED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":49
+ * EVENT_CLOSE_FAILED = ZMQ_EVENT_CLOSE_FAILED
+ * EVENT_DISCONNECTED = ZMQ_EVENT_DISCONNECTED
+ * EVENT_ALL = ZMQ_EVENT_ALL # <<<<<<<<<<<<<<
+ * EVENT_MONITOR_STOPPED = ZMQ_EVENT_MONITOR_STOPPED
+ * globals()['NULL'] = ZMQ_NULL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_ALL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_ALL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":50
+ * EVENT_DISCONNECTED = ZMQ_EVENT_DISCONNECTED
+ * EVENT_ALL = ZMQ_EVENT_ALL
+ * EVENT_MONITOR_STOPPED = ZMQ_EVENT_MONITOR_STOPPED # <<<<<<<<<<<<<<
+ * globals()['NULL'] = ZMQ_NULL
+ * PLAIN = ZMQ_PLAIN
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENT_MONITOR_STOPPED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENT_MONITOR_STOPPED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":51
+ * EVENT_ALL = ZMQ_EVENT_ALL
+ * EVENT_MONITOR_STOPPED = ZMQ_EVENT_MONITOR_STOPPED
+ * globals()['NULL'] = ZMQ_NULL # <<<<<<<<<<<<<<
+ * PLAIN = ZMQ_PLAIN
+ * CURVE = ZMQ_CURVE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_s_NULL, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":52
+ * EVENT_MONITOR_STOPPED = ZMQ_EVENT_MONITOR_STOPPED
+ * globals()['NULL'] = ZMQ_NULL
+ * PLAIN = ZMQ_PLAIN # <<<<<<<<<<<<<<
+ * CURVE = ZMQ_CURVE
+ * GSSAPI = ZMQ_GSSAPI
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PLAIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PLAIN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":53
+ * globals()['NULL'] = ZMQ_NULL
+ * PLAIN = ZMQ_PLAIN
+ * CURVE = ZMQ_CURVE # <<<<<<<<<<<<<<
+ * GSSAPI = ZMQ_GSSAPI
+ * EAGAIN = ZMQ_EAGAIN
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_CURVE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CURVE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":54
+ * PLAIN = ZMQ_PLAIN
+ * CURVE = ZMQ_CURVE
+ * GSSAPI = ZMQ_GSSAPI # <<<<<<<<<<<<<<
+ * EAGAIN = ZMQ_EAGAIN
+ * EINVAL = ZMQ_EINVAL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_GSSAPI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_GSSAPI, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":55
+ * CURVE = ZMQ_CURVE
+ * GSSAPI = ZMQ_GSSAPI
+ * EAGAIN = ZMQ_EAGAIN # <<<<<<<<<<<<<<
+ * EINVAL = ZMQ_EINVAL
+ * EFAULT = ZMQ_EFAULT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EAGAIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EAGAIN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":56
+ * GSSAPI = ZMQ_GSSAPI
+ * EAGAIN = ZMQ_EAGAIN
+ * EINVAL = ZMQ_EINVAL # <<<<<<<<<<<<<<
+ * EFAULT = ZMQ_EFAULT
+ * ENOMEM = ZMQ_ENOMEM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EINVAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EINVAL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":57
+ * EAGAIN = ZMQ_EAGAIN
+ * EINVAL = ZMQ_EINVAL
+ * EFAULT = ZMQ_EFAULT # <<<<<<<<<<<<<<
+ * ENOMEM = ZMQ_ENOMEM
+ * ENODEV = ZMQ_ENODEV
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EFAULT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EFAULT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":58
+ * EINVAL = ZMQ_EINVAL
+ * EFAULT = ZMQ_EFAULT
+ * ENOMEM = ZMQ_ENOMEM # <<<<<<<<<<<<<<
+ * ENODEV = ZMQ_ENODEV
+ * EMSGSIZE = ZMQ_EMSGSIZE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENOMEM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENOMEM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":59
+ * EFAULT = ZMQ_EFAULT
+ * ENOMEM = ZMQ_ENOMEM
+ * ENODEV = ZMQ_ENODEV # <<<<<<<<<<<<<<
+ * EMSGSIZE = ZMQ_EMSGSIZE
+ * EAFNOSUPPORT = ZMQ_EAFNOSUPPORT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENODEV); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENODEV, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":60
+ * ENOMEM = ZMQ_ENOMEM
+ * ENODEV = ZMQ_ENODEV
+ * EMSGSIZE = ZMQ_EMSGSIZE # <<<<<<<<<<<<<<
+ * EAFNOSUPPORT = ZMQ_EAFNOSUPPORT
+ * ENETUNREACH = ZMQ_ENETUNREACH
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EMSGSIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EMSGSIZE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":61
+ * ENODEV = ZMQ_ENODEV
+ * EMSGSIZE = ZMQ_EMSGSIZE
+ * EAFNOSUPPORT = ZMQ_EAFNOSUPPORT # <<<<<<<<<<<<<<
+ * ENETUNREACH = ZMQ_ENETUNREACH
+ * ECONNABORTED = ZMQ_ECONNABORTED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EAFNOSUPPORT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EAFNOSUPPORT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":62
+ * EMSGSIZE = ZMQ_EMSGSIZE
+ * EAFNOSUPPORT = ZMQ_EAFNOSUPPORT
+ * ENETUNREACH = ZMQ_ENETUNREACH # <<<<<<<<<<<<<<
+ * ECONNABORTED = ZMQ_ECONNABORTED
+ * ECONNRESET = ZMQ_ECONNRESET
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENETUNREACH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENETUNREACH, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":63
+ * EAFNOSUPPORT = ZMQ_EAFNOSUPPORT
+ * ENETUNREACH = ZMQ_ENETUNREACH
+ * ECONNABORTED = ZMQ_ECONNABORTED # <<<<<<<<<<<<<<
+ * ECONNRESET = ZMQ_ECONNRESET
+ * ENOTCONN = ZMQ_ENOTCONN
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ECONNABORTED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ECONNABORTED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":64
+ * ENETUNREACH = ZMQ_ENETUNREACH
+ * ECONNABORTED = ZMQ_ECONNABORTED
+ * ECONNRESET = ZMQ_ECONNRESET # <<<<<<<<<<<<<<
+ * ENOTCONN = ZMQ_ENOTCONN
+ * ETIMEDOUT = ZMQ_ETIMEDOUT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ECONNRESET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ECONNRESET, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":65
+ * ECONNABORTED = ZMQ_ECONNABORTED
+ * ECONNRESET = ZMQ_ECONNRESET
+ * ENOTCONN = ZMQ_ENOTCONN # <<<<<<<<<<<<<<
+ * ETIMEDOUT = ZMQ_ETIMEDOUT
+ * EHOSTUNREACH = ZMQ_EHOSTUNREACH
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENOTCONN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENOTCONN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":66
+ * ECONNRESET = ZMQ_ECONNRESET
+ * ENOTCONN = ZMQ_ENOTCONN
+ * ETIMEDOUT = ZMQ_ETIMEDOUT # <<<<<<<<<<<<<<
+ * EHOSTUNREACH = ZMQ_EHOSTUNREACH
+ * ENETRESET = ZMQ_ENETRESET
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ETIMEDOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ETIMEDOUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":67
+ * ENOTCONN = ZMQ_ENOTCONN
+ * ETIMEDOUT = ZMQ_ETIMEDOUT
+ * EHOSTUNREACH = ZMQ_EHOSTUNREACH # <<<<<<<<<<<<<<
+ * ENETRESET = ZMQ_ENETRESET
+ * HAUSNUMERO = ZMQ_HAUSNUMERO
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EHOSTUNREACH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EHOSTUNREACH, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":68
+ * ETIMEDOUT = ZMQ_ETIMEDOUT
+ * EHOSTUNREACH = ZMQ_EHOSTUNREACH
+ * ENETRESET = ZMQ_ENETRESET # <<<<<<<<<<<<<<
+ * HAUSNUMERO = ZMQ_HAUSNUMERO
+ * ENOTSUP = ZMQ_ENOTSUP
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENETRESET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENETRESET, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":69
+ * EHOSTUNREACH = ZMQ_EHOSTUNREACH
+ * ENETRESET = ZMQ_ENETRESET
+ * HAUSNUMERO = ZMQ_HAUSNUMERO # <<<<<<<<<<<<<<
+ * ENOTSUP = ZMQ_ENOTSUP
+ * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_HAUSNUMERO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_HAUSNUMERO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":70
+ * ENETRESET = ZMQ_ENETRESET
+ * HAUSNUMERO = ZMQ_HAUSNUMERO
+ * ENOTSUP = ZMQ_ENOTSUP # <<<<<<<<<<<<<<
+ * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT
+ * ENOBUFS = ZMQ_ENOBUFS
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENOTSUP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENOTSUP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":71
+ * HAUSNUMERO = ZMQ_HAUSNUMERO
+ * ENOTSUP = ZMQ_ENOTSUP
+ * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT # <<<<<<<<<<<<<<
+ * ENOBUFS = ZMQ_ENOBUFS
+ * ENETDOWN = ZMQ_ENETDOWN
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EPROTONOSUPPORT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPROTONOSUPPORT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":72
+ * ENOTSUP = ZMQ_ENOTSUP
+ * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT
+ * ENOBUFS = ZMQ_ENOBUFS # <<<<<<<<<<<<<<
+ * ENETDOWN = ZMQ_ENETDOWN
+ * EADDRINUSE = ZMQ_EADDRINUSE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENOBUFS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENOBUFS, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":73
+ * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT
+ * ENOBUFS = ZMQ_ENOBUFS
+ * ENETDOWN = ZMQ_ENETDOWN # <<<<<<<<<<<<<<
+ * EADDRINUSE = ZMQ_EADDRINUSE
+ * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENETDOWN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENETDOWN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":74
+ * ENOBUFS = ZMQ_ENOBUFS
+ * ENETDOWN = ZMQ_ENETDOWN
+ * EADDRINUSE = ZMQ_EADDRINUSE # <<<<<<<<<<<<<<
+ * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
+ * ECONNREFUSED = ZMQ_ECONNREFUSED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EADDRINUSE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EADDRINUSE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":75
+ * ENETDOWN = ZMQ_ENETDOWN
+ * EADDRINUSE = ZMQ_EADDRINUSE
+ * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL # <<<<<<<<<<<<<<
+ * ECONNREFUSED = ZMQ_ECONNREFUSED
+ * EINPROGRESS = ZMQ_EINPROGRESS
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EADDRNOTAVAIL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EADDRNOTAVAIL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":76
+ * EADDRINUSE = ZMQ_EADDRINUSE
+ * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
+ * ECONNREFUSED = ZMQ_ECONNREFUSED # <<<<<<<<<<<<<<
+ * EINPROGRESS = ZMQ_EINPROGRESS
+ * ENOTSOCK = ZMQ_ENOTSOCK
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ECONNREFUSED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ECONNREFUSED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":77
+ * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
+ * ECONNREFUSED = ZMQ_ECONNREFUSED
+ * EINPROGRESS = ZMQ_EINPROGRESS # <<<<<<<<<<<<<<
+ * ENOTSOCK = ZMQ_ENOTSOCK
+ * EFSM = ZMQ_EFSM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EINPROGRESS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EINPROGRESS, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":78
+ * ECONNREFUSED = ZMQ_ECONNREFUSED
+ * EINPROGRESS = ZMQ_EINPROGRESS
+ * ENOTSOCK = ZMQ_ENOTSOCK # <<<<<<<<<<<<<<
+ * EFSM = ZMQ_EFSM
+ * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENOTSOCK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENOTSOCK, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":79
+ * EINPROGRESS = ZMQ_EINPROGRESS
+ * ENOTSOCK = ZMQ_ENOTSOCK
+ * EFSM = ZMQ_EFSM # <<<<<<<<<<<<<<
+ * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO
+ * ETERM = ZMQ_ETERM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EFSM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EFSM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":80
+ * ENOTSOCK = ZMQ_ENOTSOCK
+ * EFSM = ZMQ_EFSM
+ * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO # <<<<<<<<<<<<<<
+ * ETERM = ZMQ_ETERM
+ * EMTHREAD = ZMQ_EMTHREAD
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ENOCOMPATPROTO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENOCOMPATPROTO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":81
+ * EFSM = ZMQ_EFSM
+ * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO
+ * ETERM = ZMQ_ETERM # <<<<<<<<<<<<<<
+ * EMTHREAD = ZMQ_EMTHREAD
+ * IO_THREADS = ZMQ_IO_THREADS
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ETERM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ETERM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":82
+ * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO
+ * ETERM = ZMQ_ETERM
+ * EMTHREAD = ZMQ_EMTHREAD # <<<<<<<<<<<<<<
+ * IO_THREADS = ZMQ_IO_THREADS
+ * MAX_SOCKETS = ZMQ_MAX_SOCKETS
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(EMTHREAD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EMTHREAD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":83
+ * ETERM = ZMQ_ETERM
+ * EMTHREAD = ZMQ_EMTHREAD
+ * IO_THREADS = ZMQ_IO_THREADS # <<<<<<<<<<<<<<
+ * MAX_SOCKETS = ZMQ_MAX_SOCKETS
+ * SOCKET_LIMIT = ZMQ_SOCKET_LIMIT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IO_THREADS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IO_THREADS, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":84
+ * EMTHREAD = ZMQ_EMTHREAD
+ * IO_THREADS = ZMQ_IO_THREADS
+ * MAX_SOCKETS = ZMQ_MAX_SOCKETS # <<<<<<<<<<<<<<
+ * SOCKET_LIMIT = ZMQ_SOCKET_LIMIT
+ * THREAD_PRIORITY = ZMQ_THREAD_PRIORITY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_MAX_SOCKETS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_SOCKETS, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":85
+ * IO_THREADS = ZMQ_IO_THREADS
+ * MAX_SOCKETS = ZMQ_MAX_SOCKETS
+ * SOCKET_LIMIT = ZMQ_SOCKET_LIMIT # <<<<<<<<<<<<<<
+ * THREAD_PRIORITY = ZMQ_THREAD_PRIORITY
+ * THREAD_SCHED_POLICY = ZMQ_THREAD_SCHED_POLICY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SOCKET_LIMIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SOCKET_LIMIT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":86
+ * MAX_SOCKETS = ZMQ_MAX_SOCKETS
+ * SOCKET_LIMIT = ZMQ_SOCKET_LIMIT
+ * THREAD_PRIORITY = ZMQ_THREAD_PRIORITY # <<<<<<<<<<<<<<
+ * THREAD_SCHED_POLICY = ZMQ_THREAD_SCHED_POLICY
+ * IDENTITY = ZMQ_IDENTITY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_THREAD_PRIORITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_THREAD_PRIORITY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":87
+ * SOCKET_LIMIT = ZMQ_SOCKET_LIMIT
+ * THREAD_PRIORITY = ZMQ_THREAD_PRIORITY
+ * THREAD_SCHED_POLICY = ZMQ_THREAD_SCHED_POLICY # <<<<<<<<<<<<<<
+ * IDENTITY = ZMQ_IDENTITY
+ * SUBSCRIBE = ZMQ_SUBSCRIBE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_THREAD_SCHED_POLICY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_THREAD_SCHED_POLICY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":88
+ * THREAD_PRIORITY = ZMQ_THREAD_PRIORITY
+ * THREAD_SCHED_POLICY = ZMQ_THREAD_SCHED_POLICY
+ * IDENTITY = ZMQ_IDENTITY # <<<<<<<<<<<<<<
+ * SUBSCRIBE = ZMQ_SUBSCRIBE
+ * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IDENTITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IDENTITY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":89
+ * THREAD_SCHED_POLICY = ZMQ_THREAD_SCHED_POLICY
+ * IDENTITY = ZMQ_IDENTITY
+ * SUBSCRIBE = ZMQ_SUBSCRIBE # <<<<<<<<<<<<<<
+ * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
+ * LAST_ENDPOINT = ZMQ_LAST_ENDPOINT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SUBSCRIBE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SUBSCRIBE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":90
+ * IDENTITY = ZMQ_IDENTITY
+ * SUBSCRIBE = ZMQ_SUBSCRIBE
+ * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE # <<<<<<<<<<<<<<
+ * LAST_ENDPOINT = ZMQ_LAST_ENDPOINT
+ * TCP_ACCEPT_FILTER = ZMQ_TCP_ACCEPT_FILTER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_UNSUBSCRIBE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_UNSUBSCRIBE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":91
+ * SUBSCRIBE = ZMQ_SUBSCRIBE
+ * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
+ * LAST_ENDPOINT = ZMQ_LAST_ENDPOINT # <<<<<<<<<<<<<<
+ * TCP_ACCEPT_FILTER = ZMQ_TCP_ACCEPT_FILTER
+ * PLAIN_USERNAME = ZMQ_PLAIN_USERNAME
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_LAST_ENDPOINT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_LAST_ENDPOINT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":92
+ * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
+ * LAST_ENDPOINT = ZMQ_LAST_ENDPOINT
+ * TCP_ACCEPT_FILTER = ZMQ_TCP_ACCEPT_FILTER # <<<<<<<<<<<<<<
+ * PLAIN_USERNAME = ZMQ_PLAIN_USERNAME
+ * PLAIN_PASSWORD = ZMQ_PLAIN_PASSWORD
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_TCP_ACCEPT_FILTER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TCP_ACCEPT_FILTER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":93
+ * LAST_ENDPOINT = ZMQ_LAST_ENDPOINT
+ * TCP_ACCEPT_FILTER = ZMQ_TCP_ACCEPT_FILTER
+ * PLAIN_USERNAME = ZMQ_PLAIN_USERNAME # <<<<<<<<<<<<<<
+ * PLAIN_PASSWORD = ZMQ_PLAIN_PASSWORD
+ * CURVE_PUBLICKEY = ZMQ_CURVE_PUBLICKEY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PLAIN_USERNAME); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PLAIN_USERNAME, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":94
+ * TCP_ACCEPT_FILTER = ZMQ_TCP_ACCEPT_FILTER
+ * PLAIN_USERNAME = ZMQ_PLAIN_USERNAME
+ * PLAIN_PASSWORD = ZMQ_PLAIN_PASSWORD # <<<<<<<<<<<<<<
+ * CURVE_PUBLICKEY = ZMQ_CURVE_PUBLICKEY
+ * CURVE_SECRETKEY = ZMQ_CURVE_SECRETKEY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PLAIN_PASSWORD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PLAIN_PASSWORD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":95
+ * PLAIN_USERNAME = ZMQ_PLAIN_USERNAME
+ * PLAIN_PASSWORD = ZMQ_PLAIN_PASSWORD
+ * CURVE_PUBLICKEY = ZMQ_CURVE_PUBLICKEY # <<<<<<<<<<<<<<
+ * CURVE_SECRETKEY = ZMQ_CURVE_SECRETKEY
+ * CURVE_SERVERKEY = ZMQ_CURVE_SERVERKEY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_CURVE_PUBLICKEY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CURVE_PUBLICKEY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":96
+ * PLAIN_PASSWORD = ZMQ_PLAIN_PASSWORD
+ * CURVE_PUBLICKEY = ZMQ_CURVE_PUBLICKEY
+ * CURVE_SECRETKEY = ZMQ_CURVE_SECRETKEY # <<<<<<<<<<<<<<
+ * CURVE_SERVERKEY = ZMQ_CURVE_SERVERKEY
+ * ZAP_DOMAIN = ZMQ_ZAP_DOMAIN
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_CURVE_SECRETKEY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CURVE_SECRETKEY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":97
+ * CURVE_PUBLICKEY = ZMQ_CURVE_PUBLICKEY
+ * CURVE_SECRETKEY = ZMQ_CURVE_SECRETKEY
+ * CURVE_SERVERKEY = ZMQ_CURVE_SERVERKEY # <<<<<<<<<<<<<<
+ * ZAP_DOMAIN = ZMQ_ZAP_DOMAIN
+ * CONNECT_RID = ZMQ_CONNECT_RID
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_CURVE_SERVERKEY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CURVE_SERVERKEY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":98
+ * CURVE_SECRETKEY = ZMQ_CURVE_SECRETKEY
+ * CURVE_SERVERKEY = ZMQ_CURVE_SERVERKEY
+ * ZAP_DOMAIN = ZMQ_ZAP_DOMAIN # <<<<<<<<<<<<<<
+ * CONNECT_RID = ZMQ_CONNECT_RID
+ * GSSAPI_PRINCIPAL = ZMQ_GSSAPI_PRINCIPAL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_ZAP_DOMAIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZAP_DOMAIN, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":99
+ * CURVE_SERVERKEY = ZMQ_CURVE_SERVERKEY
+ * ZAP_DOMAIN = ZMQ_ZAP_DOMAIN
+ * CONNECT_RID = ZMQ_CONNECT_RID # <<<<<<<<<<<<<<
+ * GSSAPI_PRINCIPAL = ZMQ_GSSAPI_PRINCIPAL
+ * GSSAPI_SERVICE_PRINCIPAL = ZMQ_GSSAPI_SERVICE_PRINCIPAL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_CONNECT_RID); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CONNECT_RID, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":100
+ * ZAP_DOMAIN = ZMQ_ZAP_DOMAIN
+ * CONNECT_RID = ZMQ_CONNECT_RID
+ * GSSAPI_PRINCIPAL = ZMQ_GSSAPI_PRINCIPAL # <<<<<<<<<<<<<<
+ * GSSAPI_SERVICE_PRINCIPAL = ZMQ_GSSAPI_SERVICE_PRINCIPAL
+ * SOCKS_PROXY = ZMQ_SOCKS_PROXY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_GSSAPI_PRINCIPAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_GSSAPI_PRINCIPAL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":101
+ * CONNECT_RID = ZMQ_CONNECT_RID
+ * GSSAPI_PRINCIPAL = ZMQ_GSSAPI_PRINCIPAL
+ * GSSAPI_SERVICE_PRINCIPAL = ZMQ_GSSAPI_SERVICE_PRINCIPAL # <<<<<<<<<<<<<<
+ * SOCKS_PROXY = ZMQ_SOCKS_PROXY
+ * FD = ZMQ_FD
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_GSSAPI_SERVICE_PRINCIPAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_GSSAPI_SERVICE_PRINCIPAL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":102
+ * GSSAPI_PRINCIPAL = ZMQ_GSSAPI_PRINCIPAL
+ * GSSAPI_SERVICE_PRINCIPAL = ZMQ_GSSAPI_SERVICE_PRINCIPAL
+ * SOCKS_PROXY = ZMQ_SOCKS_PROXY # <<<<<<<<<<<<<<
+ * FD = ZMQ_FD
+ * RECONNECT_IVL_MAX = ZMQ_RECONNECT_IVL_MAX
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SOCKS_PROXY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SOCKS_PROXY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":103
+ * GSSAPI_SERVICE_PRINCIPAL = ZMQ_GSSAPI_SERVICE_PRINCIPAL
+ * SOCKS_PROXY = ZMQ_SOCKS_PROXY
+ * FD = ZMQ_FD # <<<<<<<<<<<<<<
+ * RECONNECT_IVL_MAX = ZMQ_RECONNECT_IVL_MAX
+ * SNDTIMEO = ZMQ_SNDTIMEO
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_FD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_FD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":104
+ * SOCKS_PROXY = ZMQ_SOCKS_PROXY
+ * FD = ZMQ_FD
+ * RECONNECT_IVL_MAX = ZMQ_RECONNECT_IVL_MAX # <<<<<<<<<<<<<<
+ * SNDTIMEO = ZMQ_SNDTIMEO
+ * RCVTIMEO = ZMQ_RCVTIMEO
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RECONNECT_IVL_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RECONNECT_IVL_MAX, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":105
+ * FD = ZMQ_FD
+ * RECONNECT_IVL_MAX = ZMQ_RECONNECT_IVL_MAX
+ * SNDTIMEO = ZMQ_SNDTIMEO # <<<<<<<<<<<<<<
+ * RCVTIMEO = ZMQ_RCVTIMEO
+ * SNDHWM = ZMQ_SNDHWM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SNDTIMEO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SNDTIMEO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":106
+ * RECONNECT_IVL_MAX = ZMQ_RECONNECT_IVL_MAX
+ * SNDTIMEO = ZMQ_SNDTIMEO
+ * RCVTIMEO = ZMQ_RCVTIMEO # <<<<<<<<<<<<<<
+ * SNDHWM = ZMQ_SNDHWM
+ * RCVHWM = ZMQ_RCVHWM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RCVTIMEO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RCVTIMEO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":107
+ * SNDTIMEO = ZMQ_SNDTIMEO
+ * RCVTIMEO = ZMQ_RCVTIMEO
+ * SNDHWM = ZMQ_SNDHWM # <<<<<<<<<<<<<<
+ * RCVHWM = ZMQ_RCVHWM
+ * MULTICAST_HOPS = ZMQ_MULTICAST_HOPS
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SNDHWM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SNDHWM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":108
+ * RCVTIMEO = ZMQ_RCVTIMEO
+ * SNDHWM = ZMQ_SNDHWM
+ * RCVHWM = ZMQ_RCVHWM # <<<<<<<<<<<<<<
+ * MULTICAST_HOPS = ZMQ_MULTICAST_HOPS
+ * IPV4ONLY = ZMQ_IPV4ONLY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RCVHWM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RCVHWM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":109
+ * SNDHWM = ZMQ_SNDHWM
+ * RCVHWM = ZMQ_RCVHWM
+ * MULTICAST_HOPS = ZMQ_MULTICAST_HOPS # <<<<<<<<<<<<<<
+ * IPV4ONLY = ZMQ_IPV4ONLY
+ * ROUTER_BEHAVIOR = ZMQ_ROUTER_BEHAVIOR
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_MULTICAST_HOPS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_MULTICAST_HOPS, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":110
+ * RCVHWM = ZMQ_RCVHWM
+ * MULTICAST_HOPS = ZMQ_MULTICAST_HOPS
+ * IPV4ONLY = ZMQ_IPV4ONLY # <<<<<<<<<<<<<<
+ * ROUTER_BEHAVIOR = ZMQ_ROUTER_BEHAVIOR
+ * TCP_KEEPALIVE = ZMQ_TCP_KEEPALIVE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IPV4ONLY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IPV4ONLY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":111
+ * MULTICAST_HOPS = ZMQ_MULTICAST_HOPS
+ * IPV4ONLY = ZMQ_IPV4ONLY
+ * ROUTER_BEHAVIOR = ZMQ_ROUTER_BEHAVIOR # <<<<<<<<<<<<<<
+ * TCP_KEEPALIVE = ZMQ_TCP_KEEPALIVE
+ * TCP_KEEPALIVE_CNT = ZMQ_TCP_KEEPALIVE_CNT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_ROUTER_BEHAVIOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ROUTER_BEHAVIOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":112
+ * IPV4ONLY = ZMQ_IPV4ONLY
+ * ROUTER_BEHAVIOR = ZMQ_ROUTER_BEHAVIOR
+ * TCP_KEEPALIVE = ZMQ_TCP_KEEPALIVE # <<<<<<<<<<<<<<
+ * TCP_KEEPALIVE_CNT = ZMQ_TCP_KEEPALIVE_CNT
+ * TCP_KEEPALIVE_IDLE = ZMQ_TCP_KEEPALIVE_IDLE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_TCP_KEEPALIVE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TCP_KEEPALIVE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":113
+ * ROUTER_BEHAVIOR = ZMQ_ROUTER_BEHAVIOR
+ * TCP_KEEPALIVE = ZMQ_TCP_KEEPALIVE
+ * TCP_KEEPALIVE_CNT = ZMQ_TCP_KEEPALIVE_CNT # <<<<<<<<<<<<<<
+ * TCP_KEEPALIVE_IDLE = ZMQ_TCP_KEEPALIVE_IDLE
+ * TCP_KEEPALIVE_INTVL = ZMQ_TCP_KEEPALIVE_INTVL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_TCP_KEEPALIVE_CNT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TCP_KEEPALIVE_CNT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":114
+ * TCP_KEEPALIVE = ZMQ_TCP_KEEPALIVE
+ * TCP_KEEPALIVE_CNT = ZMQ_TCP_KEEPALIVE_CNT
+ * TCP_KEEPALIVE_IDLE = ZMQ_TCP_KEEPALIVE_IDLE # <<<<<<<<<<<<<<
+ * TCP_KEEPALIVE_INTVL = ZMQ_TCP_KEEPALIVE_INTVL
+ * DELAY_ATTACH_ON_CONNECT = ZMQ_DELAY_ATTACH_ON_CONNECT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_TCP_KEEPALIVE_IDLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TCP_KEEPALIVE_IDLE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":115
+ * TCP_KEEPALIVE_CNT = ZMQ_TCP_KEEPALIVE_CNT
+ * TCP_KEEPALIVE_IDLE = ZMQ_TCP_KEEPALIVE_IDLE
+ * TCP_KEEPALIVE_INTVL = ZMQ_TCP_KEEPALIVE_INTVL # <<<<<<<<<<<<<<
+ * DELAY_ATTACH_ON_CONNECT = ZMQ_DELAY_ATTACH_ON_CONNECT
+ * XPUB_VERBOSE = ZMQ_XPUB_VERBOSE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_TCP_KEEPALIVE_INTVL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TCP_KEEPALIVE_INTVL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":116
+ * TCP_KEEPALIVE_IDLE = ZMQ_TCP_KEEPALIVE_IDLE
+ * TCP_KEEPALIVE_INTVL = ZMQ_TCP_KEEPALIVE_INTVL
+ * DELAY_ATTACH_ON_CONNECT = ZMQ_DELAY_ATTACH_ON_CONNECT # <<<<<<<<<<<<<<
+ * XPUB_VERBOSE = ZMQ_XPUB_VERBOSE
+ * EVENTS = ZMQ_EVENTS
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_DELAY_ATTACH_ON_CONNECT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_DELAY_ATTACH_ON_CONNECT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":117
+ * TCP_KEEPALIVE_INTVL = ZMQ_TCP_KEEPALIVE_INTVL
+ * DELAY_ATTACH_ON_CONNECT = ZMQ_DELAY_ATTACH_ON_CONNECT
+ * XPUB_VERBOSE = ZMQ_XPUB_VERBOSE # <<<<<<<<<<<<<<
+ * EVENTS = ZMQ_EVENTS
+ * TYPE = ZMQ_TYPE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_XPUB_VERBOSE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPUB_VERBOSE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":118
+ * DELAY_ATTACH_ON_CONNECT = ZMQ_DELAY_ATTACH_ON_CONNECT
+ * XPUB_VERBOSE = ZMQ_XPUB_VERBOSE
+ * EVENTS = ZMQ_EVENTS # <<<<<<<<<<<<<<
+ * TYPE = ZMQ_TYPE
+ * LINGER = ZMQ_LINGER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_EVENTS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_EVENTS, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":119
+ * XPUB_VERBOSE = ZMQ_XPUB_VERBOSE
+ * EVENTS = ZMQ_EVENTS
+ * TYPE = ZMQ_TYPE # <<<<<<<<<<<<<<
+ * LINGER = ZMQ_LINGER
+ * RECONNECT_IVL = ZMQ_RECONNECT_IVL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_TYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":120
+ * EVENTS = ZMQ_EVENTS
+ * TYPE = ZMQ_TYPE
+ * LINGER = ZMQ_LINGER # <<<<<<<<<<<<<<
+ * RECONNECT_IVL = ZMQ_RECONNECT_IVL
+ * BACKLOG = ZMQ_BACKLOG
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_LINGER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_LINGER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":121
+ * TYPE = ZMQ_TYPE
+ * LINGER = ZMQ_LINGER
+ * RECONNECT_IVL = ZMQ_RECONNECT_IVL # <<<<<<<<<<<<<<
+ * BACKLOG = ZMQ_BACKLOG
+ * ROUTER_MANDATORY = ZMQ_ROUTER_MANDATORY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RECONNECT_IVL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RECONNECT_IVL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":122
+ * LINGER = ZMQ_LINGER
+ * RECONNECT_IVL = ZMQ_RECONNECT_IVL
+ * BACKLOG = ZMQ_BACKLOG # <<<<<<<<<<<<<<
+ * ROUTER_MANDATORY = ZMQ_ROUTER_MANDATORY
+ * FAIL_UNROUTABLE = ZMQ_FAIL_UNROUTABLE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_BACKLOG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_BACKLOG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":123
+ * RECONNECT_IVL = ZMQ_RECONNECT_IVL
+ * BACKLOG = ZMQ_BACKLOG
+ * ROUTER_MANDATORY = ZMQ_ROUTER_MANDATORY # <<<<<<<<<<<<<<
+ * FAIL_UNROUTABLE = ZMQ_FAIL_UNROUTABLE
+ * ROUTER_RAW = ZMQ_ROUTER_RAW
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_ROUTER_MANDATORY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ROUTER_MANDATORY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":124
+ * BACKLOG = ZMQ_BACKLOG
+ * ROUTER_MANDATORY = ZMQ_ROUTER_MANDATORY
+ * FAIL_UNROUTABLE = ZMQ_FAIL_UNROUTABLE # <<<<<<<<<<<<<<
+ * ROUTER_RAW = ZMQ_ROUTER_RAW
+ * IMMEDIATE = ZMQ_IMMEDIATE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_FAIL_UNROUTABLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_FAIL_UNROUTABLE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":125
+ * ROUTER_MANDATORY = ZMQ_ROUTER_MANDATORY
+ * FAIL_UNROUTABLE = ZMQ_FAIL_UNROUTABLE
+ * ROUTER_RAW = ZMQ_ROUTER_RAW # <<<<<<<<<<<<<<
+ * IMMEDIATE = ZMQ_IMMEDIATE
+ * IPV6 = ZMQ_IPV6
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_ROUTER_RAW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ROUTER_RAW, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":126
+ * FAIL_UNROUTABLE = ZMQ_FAIL_UNROUTABLE
+ * ROUTER_RAW = ZMQ_ROUTER_RAW
+ * IMMEDIATE = ZMQ_IMMEDIATE # <<<<<<<<<<<<<<
+ * IPV6 = ZMQ_IPV6
+ * MECHANISM = ZMQ_MECHANISM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IMMEDIATE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IMMEDIATE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":127
+ * ROUTER_RAW = ZMQ_ROUTER_RAW
+ * IMMEDIATE = ZMQ_IMMEDIATE
+ * IPV6 = ZMQ_IPV6 # <<<<<<<<<<<<<<
+ * MECHANISM = ZMQ_MECHANISM
+ * PLAIN_SERVER = ZMQ_PLAIN_SERVER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IPV6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IPV6, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":128
+ * IMMEDIATE = ZMQ_IMMEDIATE
+ * IPV6 = ZMQ_IPV6
+ * MECHANISM = ZMQ_MECHANISM # <<<<<<<<<<<<<<
+ * PLAIN_SERVER = ZMQ_PLAIN_SERVER
+ * CURVE_SERVER = ZMQ_CURVE_SERVER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_MECHANISM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_MECHANISM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":129
+ * IPV6 = ZMQ_IPV6
+ * MECHANISM = ZMQ_MECHANISM
+ * PLAIN_SERVER = ZMQ_PLAIN_SERVER # <<<<<<<<<<<<<<
+ * CURVE_SERVER = ZMQ_CURVE_SERVER
+ * PROBE_ROUTER = ZMQ_PROBE_ROUTER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PLAIN_SERVER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PLAIN_SERVER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":130
+ * MECHANISM = ZMQ_MECHANISM
+ * PLAIN_SERVER = ZMQ_PLAIN_SERVER
+ * CURVE_SERVER = ZMQ_CURVE_SERVER # <<<<<<<<<<<<<<
+ * PROBE_ROUTER = ZMQ_PROBE_ROUTER
+ * REQ_RELAXED = ZMQ_REQ_RELAXED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_CURVE_SERVER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CURVE_SERVER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":131
+ * PLAIN_SERVER = ZMQ_PLAIN_SERVER
+ * CURVE_SERVER = ZMQ_CURVE_SERVER
+ * PROBE_ROUTER = ZMQ_PROBE_ROUTER # <<<<<<<<<<<<<<
+ * REQ_RELAXED = ZMQ_REQ_RELAXED
+ * REQ_CORRELATE = ZMQ_REQ_CORRELATE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_PROBE_ROUTER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_PROBE_ROUTER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":132
+ * CURVE_SERVER = ZMQ_CURVE_SERVER
+ * PROBE_ROUTER = ZMQ_PROBE_ROUTER
+ * REQ_RELAXED = ZMQ_REQ_RELAXED # <<<<<<<<<<<<<<
+ * REQ_CORRELATE = ZMQ_REQ_CORRELATE
+ * CONFLATE = ZMQ_CONFLATE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_REQ_RELAXED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_REQ_RELAXED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":133
+ * PROBE_ROUTER = ZMQ_PROBE_ROUTER
+ * REQ_RELAXED = ZMQ_REQ_RELAXED
+ * REQ_CORRELATE = ZMQ_REQ_CORRELATE # <<<<<<<<<<<<<<
+ * CONFLATE = ZMQ_CONFLATE
+ * ROUTER_HANDOVER = ZMQ_ROUTER_HANDOVER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_REQ_CORRELATE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_REQ_CORRELATE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":134
+ * REQ_RELAXED = ZMQ_REQ_RELAXED
+ * REQ_CORRELATE = ZMQ_REQ_CORRELATE
+ * CONFLATE = ZMQ_CONFLATE # <<<<<<<<<<<<<<
+ * ROUTER_HANDOVER = ZMQ_ROUTER_HANDOVER
+ * TOS = ZMQ_TOS
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_CONFLATE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CONFLATE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":135
+ * REQ_CORRELATE = ZMQ_REQ_CORRELATE
+ * CONFLATE = ZMQ_CONFLATE
+ * ROUTER_HANDOVER = ZMQ_ROUTER_HANDOVER # <<<<<<<<<<<<<<
+ * TOS = ZMQ_TOS
+ * IPC_FILTER_PID = ZMQ_IPC_FILTER_PID
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_ROUTER_HANDOVER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ROUTER_HANDOVER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":136
+ * CONFLATE = ZMQ_CONFLATE
+ * ROUTER_HANDOVER = ZMQ_ROUTER_HANDOVER
+ * TOS = ZMQ_TOS # <<<<<<<<<<<<<<
+ * IPC_FILTER_PID = ZMQ_IPC_FILTER_PID
+ * IPC_FILTER_UID = ZMQ_IPC_FILTER_UID
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_TOS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TOS, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":137
+ * ROUTER_HANDOVER = ZMQ_ROUTER_HANDOVER
+ * TOS = ZMQ_TOS
+ * IPC_FILTER_PID = ZMQ_IPC_FILTER_PID # <<<<<<<<<<<<<<
+ * IPC_FILTER_UID = ZMQ_IPC_FILTER_UID
+ * IPC_FILTER_GID = ZMQ_IPC_FILTER_GID
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IPC_FILTER_PID); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IPC_FILTER_PID, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":138
+ * TOS = ZMQ_TOS
+ * IPC_FILTER_PID = ZMQ_IPC_FILTER_PID
+ * IPC_FILTER_UID = ZMQ_IPC_FILTER_UID # <<<<<<<<<<<<<<
+ * IPC_FILTER_GID = ZMQ_IPC_FILTER_GID
+ * GSSAPI_SERVER = ZMQ_GSSAPI_SERVER
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IPC_FILTER_UID); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IPC_FILTER_UID, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":139
+ * IPC_FILTER_PID = ZMQ_IPC_FILTER_PID
+ * IPC_FILTER_UID = ZMQ_IPC_FILTER_UID
+ * IPC_FILTER_GID = ZMQ_IPC_FILTER_GID # <<<<<<<<<<<<<<
+ * GSSAPI_SERVER = ZMQ_GSSAPI_SERVER
+ * GSSAPI_PLAINTEXT = ZMQ_GSSAPI_PLAINTEXT
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_IPC_FILTER_GID); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IPC_FILTER_GID, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":140
+ * IPC_FILTER_UID = ZMQ_IPC_FILTER_UID
+ * IPC_FILTER_GID = ZMQ_IPC_FILTER_GID
+ * GSSAPI_SERVER = ZMQ_GSSAPI_SERVER # <<<<<<<<<<<<<<
+ * GSSAPI_PLAINTEXT = ZMQ_GSSAPI_PLAINTEXT
+ * HANDSHAKE_IVL = ZMQ_HANDSHAKE_IVL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_GSSAPI_SERVER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_GSSAPI_SERVER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":141
+ * IPC_FILTER_GID = ZMQ_IPC_FILTER_GID
+ * GSSAPI_SERVER = ZMQ_GSSAPI_SERVER
+ * GSSAPI_PLAINTEXT = ZMQ_GSSAPI_PLAINTEXT # <<<<<<<<<<<<<<
+ * HANDSHAKE_IVL = ZMQ_HANDSHAKE_IVL
+ * XPUB_NODROP = ZMQ_XPUB_NODROP
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_GSSAPI_PLAINTEXT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_GSSAPI_PLAINTEXT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":142
+ * GSSAPI_SERVER = ZMQ_GSSAPI_SERVER
+ * GSSAPI_PLAINTEXT = ZMQ_GSSAPI_PLAINTEXT
+ * HANDSHAKE_IVL = ZMQ_HANDSHAKE_IVL # <<<<<<<<<<<<<<
+ * XPUB_NODROP = ZMQ_XPUB_NODROP
+ * AFFINITY = ZMQ_AFFINITY
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_HANDSHAKE_IVL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_HANDSHAKE_IVL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":143
+ * GSSAPI_PLAINTEXT = ZMQ_GSSAPI_PLAINTEXT
+ * HANDSHAKE_IVL = ZMQ_HANDSHAKE_IVL
+ * XPUB_NODROP = ZMQ_XPUB_NODROP # <<<<<<<<<<<<<<
+ * AFFINITY = ZMQ_AFFINITY
+ * MAXMSGSIZE = ZMQ_MAXMSGSIZE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_XPUB_NODROP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_XPUB_NODROP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":144
+ * HANDSHAKE_IVL = ZMQ_HANDSHAKE_IVL
+ * XPUB_NODROP = ZMQ_XPUB_NODROP
+ * AFFINITY = ZMQ_AFFINITY # <<<<<<<<<<<<<<
+ * MAXMSGSIZE = ZMQ_MAXMSGSIZE
+ * HWM = ZMQ_HWM
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_AFFINITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_AFFINITY, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":145
+ * XPUB_NODROP = ZMQ_XPUB_NODROP
+ * AFFINITY = ZMQ_AFFINITY
+ * MAXMSGSIZE = ZMQ_MAXMSGSIZE # <<<<<<<<<<<<<<
+ * HWM = ZMQ_HWM
+ * SWAP = ZMQ_SWAP
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_MAXMSGSIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAXMSGSIZE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":146
+ * AFFINITY = ZMQ_AFFINITY
+ * MAXMSGSIZE = ZMQ_MAXMSGSIZE
+ * HWM = ZMQ_HWM # <<<<<<<<<<<<<<
+ * SWAP = ZMQ_SWAP
+ * MCAST_LOOP = ZMQ_MCAST_LOOP
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_HWM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_HWM, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":147
+ * MAXMSGSIZE = ZMQ_MAXMSGSIZE
+ * HWM = ZMQ_HWM
+ * SWAP = ZMQ_SWAP # <<<<<<<<<<<<<<
+ * MCAST_LOOP = ZMQ_MCAST_LOOP
+ * RECOVERY_IVL_MSEC = ZMQ_RECOVERY_IVL_MSEC
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SWAP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SWAP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":148
+ * HWM = ZMQ_HWM
+ * SWAP = ZMQ_SWAP
+ * MCAST_LOOP = ZMQ_MCAST_LOOP # <<<<<<<<<<<<<<
+ * RECOVERY_IVL_MSEC = ZMQ_RECOVERY_IVL_MSEC
+ * RATE = ZMQ_RATE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_MCAST_LOOP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_MCAST_LOOP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":149
+ * SWAP = ZMQ_SWAP
+ * MCAST_LOOP = ZMQ_MCAST_LOOP
+ * RECOVERY_IVL_MSEC = ZMQ_RECOVERY_IVL_MSEC # <<<<<<<<<<<<<<
+ * RATE = ZMQ_RATE
+ * RECOVERY_IVL = ZMQ_RECOVERY_IVL
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RECOVERY_IVL_MSEC); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RECOVERY_IVL_MSEC, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":150
+ * MCAST_LOOP = ZMQ_MCAST_LOOP
+ * RECOVERY_IVL_MSEC = ZMQ_RECOVERY_IVL_MSEC
+ * RATE = ZMQ_RATE # <<<<<<<<<<<<<<
+ * RECOVERY_IVL = ZMQ_RECOVERY_IVL
+ * SNDBUF = ZMQ_SNDBUF
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RATE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RATE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":151
+ * RECOVERY_IVL_MSEC = ZMQ_RECOVERY_IVL_MSEC
+ * RATE = ZMQ_RATE
+ * RECOVERY_IVL = ZMQ_RECOVERY_IVL # <<<<<<<<<<<<<<
+ * SNDBUF = ZMQ_SNDBUF
+ * RCVBUF = ZMQ_RCVBUF
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RECOVERY_IVL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RECOVERY_IVL, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":152
+ * RATE = ZMQ_RATE
+ * RECOVERY_IVL = ZMQ_RECOVERY_IVL
+ * SNDBUF = ZMQ_SNDBUF # <<<<<<<<<<<<<<
+ * RCVBUF = ZMQ_RCVBUF
+ * RCVMORE = ZMQ_RCVMORE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SNDBUF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SNDBUF, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":153
+ * RECOVERY_IVL = ZMQ_RECOVERY_IVL
+ * SNDBUF = ZMQ_SNDBUF
+ * RCVBUF = ZMQ_RCVBUF # <<<<<<<<<<<<<<
+ * RCVMORE = ZMQ_RCVMORE
+ * MORE = ZMQ_MORE
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RCVBUF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RCVBUF, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":154
+ * SNDBUF = ZMQ_SNDBUF
+ * RCVBUF = ZMQ_RCVBUF
+ * RCVMORE = ZMQ_RCVMORE # <<<<<<<<<<<<<<
+ * MORE = ZMQ_MORE
+ * SRCFD = ZMQ_SRCFD
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_RCVMORE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_RCVMORE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":155
+ * RCVBUF = ZMQ_RCVBUF
+ * RCVMORE = ZMQ_RCVMORE
+ * MORE = ZMQ_MORE # <<<<<<<<<<<<<<
+ * SRCFD = ZMQ_SRCFD
+ * SHARED = ZMQ_SHARED
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_MORE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_MORE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":156
+ * RCVMORE = ZMQ_RCVMORE
+ * MORE = ZMQ_MORE
+ * SRCFD = ZMQ_SRCFD # <<<<<<<<<<<<<<
+ * SHARED = ZMQ_SHARED
+ *
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SRCFD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SRCFD, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":157
+ * MORE = ZMQ_MORE
+ * SRCFD = ZMQ_SRCFD
+ * SHARED = ZMQ_SHARED # <<<<<<<<<<<<<<
+ *
+ * #-----------------------------------------------------------------------------
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(ZMQ_SHARED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SHARED, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pxi":162
+ * # Symbols to export
+ * #-----------------------------------------------------------------------------
+ * __all__ = [ # <<<<<<<<<<<<<<
+ * "VERSION",
+ * "VERSION_MAJOR",
+ */
+ __pyx_t_1 = PyList_New(153); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_VERSION);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_VERSION);
+ __Pyx_GIVEREF(__pyx_n_s_VERSION);
+ __Pyx_INCREF(__pyx_n_s_VERSION_MAJOR);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_VERSION_MAJOR);
+ __Pyx_GIVEREF(__pyx_n_s_VERSION_MAJOR);
+ __Pyx_INCREF(__pyx_n_s_VERSION_MINOR);
+ PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_VERSION_MINOR);
+ __Pyx_GIVEREF(__pyx_n_s_VERSION_MINOR);
+ __Pyx_INCREF(__pyx_n_s_VERSION_PATCH);
+ PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_VERSION_PATCH);
+ __Pyx_GIVEREF(__pyx_n_s_VERSION_PATCH);
+ __Pyx_INCREF(__pyx_n_s_NOBLOCK);
+ PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_NOBLOCK);
+ __Pyx_GIVEREF(__pyx_n_s_NOBLOCK);
+ __Pyx_INCREF(__pyx_n_s_DONTWAIT);
+ PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_DONTWAIT);
+ __Pyx_GIVEREF(__pyx_n_s_DONTWAIT);
+ __Pyx_INCREF(__pyx_n_s_POLLIN);
+ PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_POLLIN);
+ __Pyx_GIVEREF(__pyx_n_s_POLLIN);
+ __Pyx_INCREF(__pyx_n_s_POLLOUT);
+ PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_POLLOUT);
+ __Pyx_GIVEREF(__pyx_n_s_POLLOUT);
+ __Pyx_INCREF(__pyx_n_s_POLLERR);
+ PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_s_POLLERR);
+ __Pyx_GIVEREF(__pyx_n_s_POLLERR);
+ __Pyx_INCREF(__pyx_n_s_SNDMORE);
+ PyList_SET_ITEM(__pyx_t_1, 9, __pyx_n_s_SNDMORE);
+ __Pyx_GIVEREF(__pyx_n_s_SNDMORE);
+ __Pyx_INCREF(__pyx_n_s_STREAMER);
+ PyList_SET_ITEM(__pyx_t_1, 10, __pyx_n_s_STREAMER);
+ __Pyx_GIVEREF(__pyx_n_s_STREAMER);
+ __Pyx_INCREF(__pyx_n_s_FORWARDER);
+ PyList_SET_ITEM(__pyx_t_1, 11, __pyx_n_s_FORWARDER);
+ __Pyx_GIVEREF(__pyx_n_s_FORWARDER);
+ __Pyx_INCREF(__pyx_n_s_QUEUE);
+ PyList_SET_ITEM(__pyx_t_1, 12, __pyx_n_s_QUEUE);
+ __Pyx_GIVEREF(__pyx_n_s_QUEUE);
+ __Pyx_INCREF(__pyx_n_s_IO_THREADS_DFLT);
+ PyList_SET_ITEM(__pyx_t_1, 13, __pyx_n_s_IO_THREADS_DFLT);
+ __Pyx_GIVEREF(__pyx_n_s_IO_THREADS_DFLT);
+ __Pyx_INCREF(__pyx_n_s_MAX_SOCKETS_DFLT);
+ PyList_SET_ITEM(__pyx_t_1, 14, __pyx_n_s_MAX_SOCKETS_DFLT);
+ __Pyx_GIVEREF(__pyx_n_s_MAX_SOCKETS_DFLT);
+ __Pyx_INCREF(__pyx_n_s_POLLITEMS_DFLT);
+ PyList_SET_ITEM(__pyx_t_1, 15, __pyx_n_s_POLLITEMS_DFLT);
+ __Pyx_GIVEREF(__pyx_n_s_POLLITEMS_DFLT);
+ __Pyx_INCREF(__pyx_n_s_THREAD_PRIORITY_DFLT);
+ PyList_SET_ITEM(__pyx_t_1, 16, __pyx_n_s_THREAD_PRIORITY_DFLT);
+ __Pyx_GIVEREF(__pyx_n_s_THREAD_PRIORITY_DFLT);
+ __Pyx_INCREF(__pyx_n_s_THREAD_SCHED_POLICY_DFLT);
+ PyList_SET_ITEM(__pyx_t_1, 17, __pyx_n_s_THREAD_SCHED_POLICY_DFLT);
+ __Pyx_GIVEREF(__pyx_n_s_THREAD_SCHED_POLICY_DFLT);
+ __Pyx_INCREF(__pyx_n_s_PAIR);
+ PyList_SET_ITEM(__pyx_t_1, 18, __pyx_n_s_PAIR);
+ __Pyx_GIVEREF(__pyx_n_s_PAIR);
+ __Pyx_INCREF(__pyx_n_s_PUB);
+ PyList_SET_ITEM(__pyx_t_1, 19, __pyx_n_s_PUB);
+ __Pyx_GIVEREF(__pyx_n_s_PUB);
+ __Pyx_INCREF(__pyx_n_s_SUB);
+ PyList_SET_ITEM(__pyx_t_1, 20, __pyx_n_s_SUB);
+ __Pyx_GIVEREF(__pyx_n_s_SUB);
+ __Pyx_INCREF(__pyx_n_s_REQ);
+ PyList_SET_ITEM(__pyx_t_1, 21, __pyx_n_s_REQ);
+ __Pyx_GIVEREF(__pyx_n_s_REQ);
+ __Pyx_INCREF(__pyx_n_s_REP);
+ PyList_SET_ITEM(__pyx_t_1, 22, __pyx_n_s_REP);
+ __Pyx_GIVEREF(__pyx_n_s_REP);
+ __Pyx_INCREF(__pyx_n_s_DEALER);
+ PyList_SET_ITEM(__pyx_t_1, 23, __pyx_n_s_DEALER);
+ __Pyx_GIVEREF(__pyx_n_s_DEALER);
+ __Pyx_INCREF(__pyx_n_s_ROUTER);
+ PyList_SET_ITEM(__pyx_t_1, 24, __pyx_n_s_ROUTER);
+ __Pyx_GIVEREF(__pyx_n_s_ROUTER);
+ __Pyx_INCREF(__pyx_n_s_XREQ);
+ PyList_SET_ITEM(__pyx_t_1, 25, __pyx_n_s_XREQ);
+ __Pyx_GIVEREF(__pyx_n_s_XREQ);
+ __Pyx_INCREF(__pyx_n_s_XREP);
+ PyList_SET_ITEM(__pyx_t_1, 26, __pyx_n_s_XREP);
+ __Pyx_GIVEREF(__pyx_n_s_XREP);
+ __Pyx_INCREF(__pyx_n_s_PULL);
+ PyList_SET_ITEM(__pyx_t_1, 27, __pyx_n_s_PULL);
+ __Pyx_GIVEREF(__pyx_n_s_PULL);
+ __Pyx_INCREF(__pyx_n_s_PUSH);
+ PyList_SET_ITEM(__pyx_t_1, 28, __pyx_n_s_PUSH);
+ __Pyx_GIVEREF(__pyx_n_s_PUSH);
+ __Pyx_INCREF(__pyx_n_s_XPUB);
+ PyList_SET_ITEM(__pyx_t_1, 29, __pyx_n_s_XPUB);
+ __Pyx_GIVEREF(__pyx_n_s_XPUB);
+ __Pyx_INCREF(__pyx_n_s_XSUB);
+ PyList_SET_ITEM(__pyx_t_1, 30, __pyx_n_s_XSUB);
+ __Pyx_GIVEREF(__pyx_n_s_XSUB);
+ __Pyx_INCREF(__pyx_n_s_UPSTREAM);
+ PyList_SET_ITEM(__pyx_t_1, 31, __pyx_n_s_UPSTREAM);
+ __Pyx_GIVEREF(__pyx_n_s_UPSTREAM);
+ __Pyx_INCREF(__pyx_n_s_DOWNSTREAM);
+ PyList_SET_ITEM(__pyx_t_1, 32, __pyx_n_s_DOWNSTREAM);
+ __Pyx_GIVEREF(__pyx_n_s_DOWNSTREAM);
+ __Pyx_INCREF(__pyx_n_s_STREAM);
+ PyList_SET_ITEM(__pyx_t_1, 33, __pyx_n_s_STREAM);
+ __Pyx_GIVEREF(__pyx_n_s_STREAM);
+ __Pyx_INCREF(__pyx_n_s_EVENT_CONNECTED);
+ PyList_SET_ITEM(__pyx_t_1, 34, __pyx_n_s_EVENT_CONNECTED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_CONNECTED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_CONNECT_DELAYED);
+ PyList_SET_ITEM(__pyx_t_1, 35, __pyx_n_s_EVENT_CONNECT_DELAYED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_CONNECT_DELAYED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_CONNECT_RETRIED);
+ PyList_SET_ITEM(__pyx_t_1, 36, __pyx_n_s_EVENT_CONNECT_RETRIED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_CONNECT_RETRIED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_LISTENING);
+ PyList_SET_ITEM(__pyx_t_1, 37, __pyx_n_s_EVENT_LISTENING);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_LISTENING);
+ __Pyx_INCREF(__pyx_n_s_EVENT_BIND_FAILED);
+ PyList_SET_ITEM(__pyx_t_1, 38, __pyx_n_s_EVENT_BIND_FAILED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_BIND_FAILED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_ACCEPTED);
+ PyList_SET_ITEM(__pyx_t_1, 39, __pyx_n_s_EVENT_ACCEPTED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_ACCEPTED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_ACCEPT_FAILED);
+ PyList_SET_ITEM(__pyx_t_1, 40, __pyx_n_s_EVENT_ACCEPT_FAILED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_ACCEPT_FAILED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_CLOSED);
+ PyList_SET_ITEM(__pyx_t_1, 41, __pyx_n_s_EVENT_CLOSED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_CLOSED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_CLOSE_FAILED);
+ PyList_SET_ITEM(__pyx_t_1, 42, __pyx_n_s_EVENT_CLOSE_FAILED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_CLOSE_FAILED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_DISCONNECTED);
+ PyList_SET_ITEM(__pyx_t_1, 43, __pyx_n_s_EVENT_DISCONNECTED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_DISCONNECTED);
+ __Pyx_INCREF(__pyx_n_s_EVENT_ALL);
+ PyList_SET_ITEM(__pyx_t_1, 44, __pyx_n_s_EVENT_ALL);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_ALL);
+ __Pyx_INCREF(__pyx_n_s_EVENT_MONITOR_STOPPED);
+ PyList_SET_ITEM(__pyx_t_1, 45, __pyx_n_s_EVENT_MONITOR_STOPPED);
+ __Pyx_GIVEREF(__pyx_n_s_EVENT_MONITOR_STOPPED);
+ __Pyx_INCREF(__pyx_n_s_NULL);
+ PyList_SET_ITEM(__pyx_t_1, 46, __pyx_n_s_NULL);
+ __Pyx_GIVEREF(__pyx_n_s_NULL);
+ __Pyx_INCREF(__pyx_n_s_PLAIN);
+ PyList_SET_ITEM(__pyx_t_1, 47, __pyx_n_s_PLAIN);
+ __Pyx_GIVEREF(__pyx_n_s_PLAIN);
+ __Pyx_INCREF(__pyx_n_s_CURVE);
+ PyList_SET_ITEM(__pyx_t_1, 48, __pyx_n_s_CURVE);
+ __Pyx_GIVEREF(__pyx_n_s_CURVE);
+ __Pyx_INCREF(__pyx_n_s_GSSAPI);
+ PyList_SET_ITEM(__pyx_t_1, 49, __pyx_n_s_GSSAPI);
+ __Pyx_GIVEREF(__pyx_n_s_GSSAPI);
+ __Pyx_INCREF(__pyx_n_s_EAGAIN);
+ PyList_SET_ITEM(__pyx_t_1, 50, __pyx_n_s_EAGAIN);
+ __Pyx_GIVEREF(__pyx_n_s_EAGAIN);
+ __Pyx_INCREF(__pyx_n_s_EINVAL);
+ PyList_SET_ITEM(__pyx_t_1, 51, __pyx_n_s_EINVAL);
+ __Pyx_GIVEREF(__pyx_n_s_EINVAL);
+ __Pyx_INCREF(__pyx_n_s_EFAULT);
+ PyList_SET_ITEM(__pyx_t_1, 52, __pyx_n_s_EFAULT);
+ __Pyx_GIVEREF(__pyx_n_s_EFAULT);
+ __Pyx_INCREF(__pyx_n_s_ENOMEM);
+ PyList_SET_ITEM(__pyx_t_1, 53, __pyx_n_s_ENOMEM);
+ __Pyx_GIVEREF(__pyx_n_s_ENOMEM);
+ __Pyx_INCREF(__pyx_n_s_ENODEV);
+ PyList_SET_ITEM(__pyx_t_1, 54, __pyx_n_s_ENODEV);
+ __Pyx_GIVEREF(__pyx_n_s_ENODEV);
+ __Pyx_INCREF(__pyx_n_s_EMSGSIZE);
+ PyList_SET_ITEM(__pyx_t_1, 55, __pyx_n_s_EMSGSIZE);
+ __Pyx_GIVEREF(__pyx_n_s_EMSGSIZE);
+ __Pyx_INCREF(__pyx_n_s_EAFNOSUPPORT);
+ PyList_SET_ITEM(__pyx_t_1, 56, __pyx_n_s_EAFNOSUPPORT);
+ __Pyx_GIVEREF(__pyx_n_s_EAFNOSUPPORT);
+ __Pyx_INCREF(__pyx_n_s_ENETUNREACH);
+ PyList_SET_ITEM(__pyx_t_1, 57, __pyx_n_s_ENETUNREACH);
+ __Pyx_GIVEREF(__pyx_n_s_ENETUNREACH);
+ __Pyx_INCREF(__pyx_n_s_ECONNABORTED);
+ PyList_SET_ITEM(__pyx_t_1, 58, __pyx_n_s_ECONNABORTED);
+ __Pyx_GIVEREF(__pyx_n_s_ECONNABORTED);
+ __Pyx_INCREF(__pyx_n_s_ECONNRESET);
+ PyList_SET_ITEM(__pyx_t_1, 59, __pyx_n_s_ECONNRESET);
+ __Pyx_GIVEREF(__pyx_n_s_ECONNRESET);
+ __Pyx_INCREF(__pyx_n_s_ENOTCONN);
+ PyList_SET_ITEM(__pyx_t_1, 60, __pyx_n_s_ENOTCONN);
+ __Pyx_GIVEREF(__pyx_n_s_ENOTCONN);
+ __Pyx_INCREF(__pyx_n_s_ETIMEDOUT);
+ PyList_SET_ITEM(__pyx_t_1, 61, __pyx_n_s_ETIMEDOUT);
+ __Pyx_GIVEREF(__pyx_n_s_ETIMEDOUT);
+ __Pyx_INCREF(__pyx_n_s_EHOSTUNREACH);
+ PyList_SET_ITEM(__pyx_t_1, 62, __pyx_n_s_EHOSTUNREACH);
+ __Pyx_GIVEREF(__pyx_n_s_EHOSTUNREACH);
+ __Pyx_INCREF(__pyx_n_s_ENETRESET);
+ PyList_SET_ITEM(__pyx_t_1, 63, __pyx_n_s_ENETRESET);
+ __Pyx_GIVEREF(__pyx_n_s_ENETRESET);
+ __Pyx_INCREF(__pyx_n_s_HAUSNUMERO);
+ PyList_SET_ITEM(__pyx_t_1, 64, __pyx_n_s_HAUSNUMERO);
+ __Pyx_GIVEREF(__pyx_n_s_HAUSNUMERO);
+ __Pyx_INCREF(__pyx_n_s_ENOTSUP);
+ PyList_SET_ITEM(__pyx_t_1, 65, __pyx_n_s_ENOTSUP);
+ __Pyx_GIVEREF(__pyx_n_s_ENOTSUP);
+ __Pyx_INCREF(__pyx_n_s_EPROTONOSUPPORT);
+ PyList_SET_ITEM(__pyx_t_1, 66, __pyx_n_s_EPROTONOSUPPORT);
+ __Pyx_GIVEREF(__pyx_n_s_EPROTONOSUPPORT);
+ __Pyx_INCREF(__pyx_n_s_ENOBUFS);
+ PyList_SET_ITEM(__pyx_t_1, 67, __pyx_n_s_ENOBUFS);
+ __Pyx_GIVEREF(__pyx_n_s_ENOBUFS);
+ __Pyx_INCREF(__pyx_n_s_ENETDOWN);
+ PyList_SET_ITEM(__pyx_t_1, 68, __pyx_n_s_ENETDOWN);
+ __Pyx_GIVEREF(__pyx_n_s_ENETDOWN);
+ __Pyx_INCREF(__pyx_n_s_EADDRINUSE);
+ PyList_SET_ITEM(__pyx_t_1, 69, __pyx_n_s_EADDRINUSE);
+ __Pyx_GIVEREF(__pyx_n_s_EADDRINUSE);
+ __Pyx_INCREF(__pyx_n_s_EADDRNOTAVAIL);
+ PyList_SET_ITEM(__pyx_t_1, 70, __pyx_n_s_EADDRNOTAVAIL);
+ __Pyx_GIVEREF(__pyx_n_s_EADDRNOTAVAIL);
+ __Pyx_INCREF(__pyx_n_s_ECONNREFUSED);
+ PyList_SET_ITEM(__pyx_t_1, 71, __pyx_n_s_ECONNREFUSED);
+ __Pyx_GIVEREF(__pyx_n_s_ECONNREFUSED);
+ __Pyx_INCREF(__pyx_n_s_EINPROGRESS);
+ PyList_SET_ITEM(__pyx_t_1, 72, __pyx_n_s_EINPROGRESS);
+ __Pyx_GIVEREF(__pyx_n_s_EINPROGRESS);
+ __Pyx_INCREF(__pyx_n_s_ENOTSOCK);
+ PyList_SET_ITEM(__pyx_t_1, 73, __pyx_n_s_ENOTSOCK);
+ __Pyx_GIVEREF(__pyx_n_s_ENOTSOCK);
+ __Pyx_INCREF(__pyx_n_s_EFSM);
+ PyList_SET_ITEM(__pyx_t_1, 74, __pyx_n_s_EFSM);
+ __Pyx_GIVEREF(__pyx_n_s_EFSM);
+ __Pyx_INCREF(__pyx_n_s_ENOCOMPATPROTO);
+ PyList_SET_ITEM(__pyx_t_1, 75, __pyx_n_s_ENOCOMPATPROTO);
+ __Pyx_GIVEREF(__pyx_n_s_ENOCOMPATPROTO);
+ __Pyx_INCREF(__pyx_n_s_ETERM);
+ PyList_SET_ITEM(__pyx_t_1, 76, __pyx_n_s_ETERM);
+ __Pyx_GIVEREF(__pyx_n_s_ETERM);
+ __Pyx_INCREF(__pyx_n_s_EMTHREAD);
+ PyList_SET_ITEM(__pyx_t_1, 77, __pyx_n_s_EMTHREAD);
+ __Pyx_GIVEREF(__pyx_n_s_EMTHREAD);
+ __Pyx_INCREF(__pyx_n_s_IO_THREADS);
+ PyList_SET_ITEM(__pyx_t_1, 78, __pyx_n_s_IO_THREADS);
+ __Pyx_GIVEREF(__pyx_n_s_IO_THREADS);
+ __Pyx_INCREF(__pyx_n_s_MAX_SOCKETS);
+ PyList_SET_ITEM(__pyx_t_1, 79, __pyx_n_s_MAX_SOCKETS);
+ __Pyx_GIVEREF(__pyx_n_s_MAX_SOCKETS);
+ __Pyx_INCREF(__pyx_n_s_SOCKET_LIMIT);
+ PyList_SET_ITEM(__pyx_t_1, 80, __pyx_n_s_SOCKET_LIMIT);
+ __Pyx_GIVEREF(__pyx_n_s_SOCKET_LIMIT);
+ __Pyx_INCREF(__pyx_n_s_THREAD_PRIORITY);
+ PyList_SET_ITEM(__pyx_t_1, 81, __pyx_n_s_THREAD_PRIORITY);
+ __Pyx_GIVEREF(__pyx_n_s_THREAD_PRIORITY);
+ __Pyx_INCREF(__pyx_n_s_THREAD_SCHED_POLICY);
+ PyList_SET_ITEM(__pyx_t_1, 82, __pyx_n_s_THREAD_SCHED_POLICY);
+ __Pyx_GIVEREF(__pyx_n_s_THREAD_SCHED_POLICY);
+ __Pyx_INCREF(__pyx_n_s_IDENTITY);
+ PyList_SET_ITEM(__pyx_t_1, 83, __pyx_n_s_IDENTITY);
+ __Pyx_GIVEREF(__pyx_n_s_IDENTITY);
+ __Pyx_INCREF(__pyx_n_s_SUBSCRIBE);
+ PyList_SET_ITEM(__pyx_t_1, 84, __pyx_n_s_SUBSCRIBE);
+ __Pyx_GIVEREF(__pyx_n_s_SUBSCRIBE);
+ __Pyx_INCREF(__pyx_n_s_UNSUBSCRIBE);
+ PyList_SET_ITEM(__pyx_t_1, 85, __pyx_n_s_UNSUBSCRIBE);
+ __Pyx_GIVEREF(__pyx_n_s_UNSUBSCRIBE);
+ __Pyx_INCREF(__pyx_n_s_LAST_ENDPOINT);
+ PyList_SET_ITEM(__pyx_t_1, 86, __pyx_n_s_LAST_ENDPOINT);
+ __Pyx_GIVEREF(__pyx_n_s_LAST_ENDPOINT);
+ __Pyx_INCREF(__pyx_n_s_TCP_ACCEPT_FILTER);
+ PyList_SET_ITEM(__pyx_t_1, 87, __pyx_n_s_TCP_ACCEPT_FILTER);
+ __Pyx_GIVEREF(__pyx_n_s_TCP_ACCEPT_FILTER);
+ __Pyx_INCREF(__pyx_n_s_PLAIN_USERNAME);
+ PyList_SET_ITEM(__pyx_t_1, 88, __pyx_n_s_PLAIN_USERNAME);
+ __Pyx_GIVEREF(__pyx_n_s_PLAIN_USERNAME);
+ __Pyx_INCREF(__pyx_n_s_PLAIN_PASSWORD);
+ PyList_SET_ITEM(__pyx_t_1, 89, __pyx_n_s_PLAIN_PASSWORD);
+ __Pyx_GIVEREF(__pyx_n_s_PLAIN_PASSWORD);
+ __Pyx_INCREF(__pyx_n_s_CURVE_PUBLICKEY);
+ PyList_SET_ITEM(__pyx_t_1, 90, __pyx_n_s_CURVE_PUBLICKEY);
+ __Pyx_GIVEREF(__pyx_n_s_CURVE_PUBLICKEY);
+ __Pyx_INCREF(__pyx_n_s_CURVE_SECRETKEY);
+ PyList_SET_ITEM(__pyx_t_1, 91, __pyx_n_s_CURVE_SECRETKEY);
+ __Pyx_GIVEREF(__pyx_n_s_CURVE_SECRETKEY);
+ __Pyx_INCREF(__pyx_n_s_CURVE_SERVERKEY);
+ PyList_SET_ITEM(__pyx_t_1, 92, __pyx_n_s_CURVE_SERVERKEY);
+ __Pyx_GIVEREF(__pyx_n_s_CURVE_SERVERKEY);
+ __Pyx_INCREF(__pyx_n_s_ZAP_DOMAIN);
+ PyList_SET_ITEM(__pyx_t_1, 93, __pyx_n_s_ZAP_DOMAIN);
+ __Pyx_GIVEREF(__pyx_n_s_ZAP_DOMAIN);
+ __Pyx_INCREF(__pyx_n_s_CONNECT_RID);
+ PyList_SET_ITEM(__pyx_t_1, 94, __pyx_n_s_CONNECT_RID);
+ __Pyx_GIVEREF(__pyx_n_s_CONNECT_RID);
+ __Pyx_INCREF(__pyx_n_s_GSSAPI_PRINCIPAL);
+ PyList_SET_ITEM(__pyx_t_1, 95, __pyx_n_s_GSSAPI_PRINCIPAL);
+ __Pyx_GIVEREF(__pyx_n_s_GSSAPI_PRINCIPAL);
+ __Pyx_INCREF(__pyx_n_s_GSSAPI_SERVICE_PRINCIPAL);
+ PyList_SET_ITEM(__pyx_t_1, 96, __pyx_n_s_GSSAPI_SERVICE_PRINCIPAL);
+ __Pyx_GIVEREF(__pyx_n_s_GSSAPI_SERVICE_PRINCIPAL);
+ __Pyx_INCREF(__pyx_n_s_SOCKS_PROXY);
+ PyList_SET_ITEM(__pyx_t_1, 97, __pyx_n_s_SOCKS_PROXY);
+ __Pyx_GIVEREF(__pyx_n_s_SOCKS_PROXY);
+ __Pyx_INCREF(__pyx_n_s_FD);
+ PyList_SET_ITEM(__pyx_t_1, 98, __pyx_n_s_FD);
+ __Pyx_GIVEREF(__pyx_n_s_FD);
+ __Pyx_INCREF(__pyx_n_s_RECONNECT_IVL_MAX);
+ PyList_SET_ITEM(__pyx_t_1, 99, __pyx_n_s_RECONNECT_IVL_MAX);
+ __Pyx_GIVEREF(__pyx_n_s_RECONNECT_IVL_MAX);
+ __Pyx_INCREF(__pyx_n_s_SNDTIMEO);
+ PyList_SET_ITEM(__pyx_t_1, 100, __pyx_n_s_SNDTIMEO);
+ __Pyx_GIVEREF(__pyx_n_s_SNDTIMEO);
+ __Pyx_INCREF(__pyx_n_s_RCVTIMEO);
+ PyList_SET_ITEM(__pyx_t_1, 101, __pyx_n_s_RCVTIMEO);
+ __Pyx_GIVEREF(__pyx_n_s_RCVTIMEO);
+ __Pyx_INCREF(__pyx_n_s_SNDHWM);
+ PyList_SET_ITEM(__pyx_t_1, 102, __pyx_n_s_SNDHWM);
+ __Pyx_GIVEREF(__pyx_n_s_SNDHWM);
+ __Pyx_INCREF(__pyx_n_s_RCVHWM);
+ PyList_SET_ITEM(__pyx_t_1, 103, __pyx_n_s_RCVHWM);
+ __Pyx_GIVEREF(__pyx_n_s_RCVHWM);
+ __Pyx_INCREF(__pyx_n_s_MULTICAST_HOPS);
+ PyList_SET_ITEM(__pyx_t_1, 104, __pyx_n_s_MULTICAST_HOPS);
+ __Pyx_GIVEREF(__pyx_n_s_MULTICAST_HOPS);
+ __Pyx_INCREF(__pyx_n_s_IPV4ONLY);
+ PyList_SET_ITEM(__pyx_t_1, 105, __pyx_n_s_IPV4ONLY);
+ __Pyx_GIVEREF(__pyx_n_s_IPV4ONLY);
+ __Pyx_INCREF(__pyx_n_s_ROUTER_BEHAVIOR);
+ PyList_SET_ITEM(__pyx_t_1, 106, __pyx_n_s_ROUTER_BEHAVIOR);
+ __Pyx_GIVEREF(__pyx_n_s_ROUTER_BEHAVIOR);
+ __Pyx_INCREF(__pyx_n_s_TCP_KEEPALIVE);
+ PyList_SET_ITEM(__pyx_t_1, 107, __pyx_n_s_TCP_KEEPALIVE);
+ __Pyx_GIVEREF(__pyx_n_s_TCP_KEEPALIVE);
+ __Pyx_INCREF(__pyx_n_s_TCP_KEEPALIVE_CNT);
+ PyList_SET_ITEM(__pyx_t_1, 108, __pyx_n_s_TCP_KEEPALIVE_CNT);
+ __Pyx_GIVEREF(__pyx_n_s_TCP_KEEPALIVE_CNT);
+ __Pyx_INCREF(__pyx_n_s_TCP_KEEPALIVE_IDLE);
+ PyList_SET_ITEM(__pyx_t_1, 109, __pyx_n_s_TCP_KEEPALIVE_IDLE);
+ __Pyx_GIVEREF(__pyx_n_s_TCP_KEEPALIVE_IDLE);
+ __Pyx_INCREF(__pyx_n_s_TCP_KEEPALIVE_INTVL);
+ PyList_SET_ITEM(__pyx_t_1, 110, __pyx_n_s_TCP_KEEPALIVE_INTVL);
+ __Pyx_GIVEREF(__pyx_n_s_TCP_KEEPALIVE_INTVL);
+ __Pyx_INCREF(__pyx_n_s_DELAY_ATTACH_ON_CONNECT);
+ PyList_SET_ITEM(__pyx_t_1, 111, __pyx_n_s_DELAY_ATTACH_ON_CONNECT);
+ __Pyx_GIVEREF(__pyx_n_s_DELAY_ATTACH_ON_CONNECT);
+ __Pyx_INCREF(__pyx_n_s_XPUB_VERBOSE);
+ PyList_SET_ITEM(__pyx_t_1, 112, __pyx_n_s_XPUB_VERBOSE);
+ __Pyx_GIVEREF(__pyx_n_s_XPUB_VERBOSE);
+ __Pyx_INCREF(__pyx_n_s_EVENTS);
+ PyList_SET_ITEM(__pyx_t_1, 113, __pyx_n_s_EVENTS);
+ __Pyx_GIVEREF(__pyx_n_s_EVENTS);
+ __Pyx_INCREF(__pyx_n_s_TYPE);
+ PyList_SET_ITEM(__pyx_t_1, 114, __pyx_n_s_TYPE);
+ __Pyx_GIVEREF(__pyx_n_s_TYPE);
+ __Pyx_INCREF(__pyx_n_s_LINGER);
+ PyList_SET_ITEM(__pyx_t_1, 115, __pyx_n_s_LINGER);
+ __Pyx_GIVEREF(__pyx_n_s_LINGER);
+ __Pyx_INCREF(__pyx_n_s_RECONNECT_IVL);
+ PyList_SET_ITEM(__pyx_t_1, 116, __pyx_n_s_RECONNECT_IVL);
+ __Pyx_GIVEREF(__pyx_n_s_RECONNECT_IVL);
+ __Pyx_INCREF(__pyx_n_s_BACKLOG);
+ PyList_SET_ITEM(__pyx_t_1, 117, __pyx_n_s_BACKLOG);
+ __Pyx_GIVEREF(__pyx_n_s_BACKLOG);
+ __Pyx_INCREF(__pyx_n_s_ROUTER_MANDATORY);
+ PyList_SET_ITEM(__pyx_t_1, 118, __pyx_n_s_ROUTER_MANDATORY);
+ __Pyx_GIVEREF(__pyx_n_s_ROUTER_MANDATORY);
+ __Pyx_INCREF(__pyx_n_s_FAIL_UNROUTABLE);
+ PyList_SET_ITEM(__pyx_t_1, 119, __pyx_n_s_FAIL_UNROUTABLE);
+ __Pyx_GIVEREF(__pyx_n_s_FAIL_UNROUTABLE);
+ __Pyx_INCREF(__pyx_n_s_ROUTER_RAW);
+ PyList_SET_ITEM(__pyx_t_1, 120, __pyx_n_s_ROUTER_RAW);
+ __Pyx_GIVEREF(__pyx_n_s_ROUTER_RAW);
+ __Pyx_INCREF(__pyx_n_s_IMMEDIATE);
+ PyList_SET_ITEM(__pyx_t_1, 121, __pyx_n_s_IMMEDIATE);
+ __Pyx_GIVEREF(__pyx_n_s_IMMEDIATE);
+ __Pyx_INCREF(__pyx_n_s_IPV6);
+ PyList_SET_ITEM(__pyx_t_1, 122, __pyx_n_s_IPV6);
+ __Pyx_GIVEREF(__pyx_n_s_IPV6);
+ __Pyx_INCREF(__pyx_n_s_MECHANISM);
+ PyList_SET_ITEM(__pyx_t_1, 123, __pyx_n_s_MECHANISM);
+ __Pyx_GIVEREF(__pyx_n_s_MECHANISM);
+ __Pyx_INCREF(__pyx_n_s_PLAIN_SERVER);
+ PyList_SET_ITEM(__pyx_t_1, 124, __pyx_n_s_PLAIN_SERVER);
+ __Pyx_GIVEREF(__pyx_n_s_PLAIN_SERVER);
+ __Pyx_INCREF(__pyx_n_s_CURVE_SERVER);
+ PyList_SET_ITEM(__pyx_t_1, 125, __pyx_n_s_CURVE_SERVER);
+ __Pyx_GIVEREF(__pyx_n_s_CURVE_SERVER);
+ __Pyx_INCREF(__pyx_n_s_PROBE_ROUTER);
+ PyList_SET_ITEM(__pyx_t_1, 126, __pyx_n_s_PROBE_ROUTER);
+ __Pyx_GIVEREF(__pyx_n_s_PROBE_ROUTER);
+ __Pyx_INCREF(__pyx_n_s_REQ_RELAXED);
+ PyList_SET_ITEM(__pyx_t_1, 127, __pyx_n_s_REQ_RELAXED);
+ __Pyx_GIVEREF(__pyx_n_s_REQ_RELAXED);
+ __Pyx_INCREF(__pyx_n_s_REQ_CORRELATE);
+ PyList_SET_ITEM(__pyx_t_1, 128, __pyx_n_s_REQ_CORRELATE);
+ __Pyx_GIVEREF(__pyx_n_s_REQ_CORRELATE);
+ __Pyx_INCREF(__pyx_n_s_CONFLATE);
+ PyList_SET_ITEM(__pyx_t_1, 129, __pyx_n_s_CONFLATE);
+ __Pyx_GIVEREF(__pyx_n_s_CONFLATE);
+ __Pyx_INCREF(__pyx_n_s_ROUTER_HANDOVER);
+ PyList_SET_ITEM(__pyx_t_1, 130, __pyx_n_s_ROUTER_HANDOVER);
+ __Pyx_GIVEREF(__pyx_n_s_ROUTER_HANDOVER);
+ __Pyx_INCREF(__pyx_n_s_TOS);
+ PyList_SET_ITEM(__pyx_t_1, 131, __pyx_n_s_TOS);
+ __Pyx_GIVEREF(__pyx_n_s_TOS);
+ __Pyx_INCREF(__pyx_n_s_IPC_FILTER_PID);
+ PyList_SET_ITEM(__pyx_t_1, 132, __pyx_n_s_IPC_FILTER_PID);
+ __Pyx_GIVEREF(__pyx_n_s_IPC_FILTER_PID);
+ __Pyx_INCREF(__pyx_n_s_IPC_FILTER_UID);
+ PyList_SET_ITEM(__pyx_t_1, 133, __pyx_n_s_IPC_FILTER_UID);
+ __Pyx_GIVEREF(__pyx_n_s_IPC_FILTER_UID);
+ __Pyx_INCREF(__pyx_n_s_IPC_FILTER_GID);
+ PyList_SET_ITEM(__pyx_t_1, 134, __pyx_n_s_IPC_FILTER_GID);
+ __Pyx_GIVEREF(__pyx_n_s_IPC_FILTER_GID);
+ __Pyx_INCREF(__pyx_n_s_GSSAPI_SERVER);
+ PyList_SET_ITEM(__pyx_t_1, 135, __pyx_n_s_GSSAPI_SERVER);
+ __Pyx_GIVEREF(__pyx_n_s_GSSAPI_SERVER);
+ __Pyx_INCREF(__pyx_n_s_GSSAPI_PLAINTEXT);
+ PyList_SET_ITEM(__pyx_t_1, 136, __pyx_n_s_GSSAPI_PLAINTEXT);
+ __Pyx_GIVEREF(__pyx_n_s_GSSAPI_PLAINTEXT);
+ __Pyx_INCREF(__pyx_n_s_HANDSHAKE_IVL);
+ PyList_SET_ITEM(__pyx_t_1, 137, __pyx_n_s_HANDSHAKE_IVL);
+ __Pyx_GIVEREF(__pyx_n_s_HANDSHAKE_IVL);
+ __Pyx_INCREF(__pyx_n_s_XPUB_NODROP);
+ PyList_SET_ITEM(__pyx_t_1, 138, __pyx_n_s_XPUB_NODROP);
+ __Pyx_GIVEREF(__pyx_n_s_XPUB_NODROP);
+ __Pyx_INCREF(__pyx_n_s_AFFINITY);
+ PyList_SET_ITEM(__pyx_t_1, 139, __pyx_n_s_AFFINITY);
+ __Pyx_GIVEREF(__pyx_n_s_AFFINITY);
+ __Pyx_INCREF(__pyx_n_s_MAXMSGSIZE);
+ PyList_SET_ITEM(__pyx_t_1, 140, __pyx_n_s_MAXMSGSIZE);
+ __Pyx_GIVEREF(__pyx_n_s_MAXMSGSIZE);
+ __Pyx_INCREF(__pyx_n_s_HWM);
+ PyList_SET_ITEM(__pyx_t_1, 141, __pyx_n_s_HWM);
+ __Pyx_GIVEREF(__pyx_n_s_HWM);
+ __Pyx_INCREF(__pyx_n_s_SWAP);
+ PyList_SET_ITEM(__pyx_t_1, 142, __pyx_n_s_SWAP);
+ __Pyx_GIVEREF(__pyx_n_s_SWAP);
+ __Pyx_INCREF(__pyx_n_s_MCAST_LOOP);
+ PyList_SET_ITEM(__pyx_t_1, 143, __pyx_n_s_MCAST_LOOP);
+ __Pyx_GIVEREF(__pyx_n_s_MCAST_LOOP);
+ __Pyx_INCREF(__pyx_n_s_RECOVERY_IVL_MSEC);
+ PyList_SET_ITEM(__pyx_t_1, 144, __pyx_n_s_RECOVERY_IVL_MSEC);
+ __Pyx_GIVEREF(__pyx_n_s_RECOVERY_IVL_MSEC);
+ __Pyx_INCREF(__pyx_n_s_RATE);
+ PyList_SET_ITEM(__pyx_t_1, 145, __pyx_n_s_RATE);
+ __Pyx_GIVEREF(__pyx_n_s_RATE);
+ __Pyx_INCREF(__pyx_n_s_RECOVERY_IVL);
+ PyList_SET_ITEM(__pyx_t_1, 146, __pyx_n_s_RECOVERY_IVL);
+ __Pyx_GIVEREF(__pyx_n_s_RECOVERY_IVL);
+ __Pyx_INCREF(__pyx_n_s_SNDBUF);
+ PyList_SET_ITEM(__pyx_t_1, 147, __pyx_n_s_SNDBUF);
+ __Pyx_GIVEREF(__pyx_n_s_SNDBUF);
+ __Pyx_INCREF(__pyx_n_s_RCVBUF);
+ PyList_SET_ITEM(__pyx_t_1, 148, __pyx_n_s_RCVBUF);
+ __Pyx_GIVEREF(__pyx_n_s_RCVBUF);
+ __Pyx_INCREF(__pyx_n_s_RCVMORE);
+ PyList_SET_ITEM(__pyx_t_1, 149, __pyx_n_s_RCVMORE);
+ __Pyx_GIVEREF(__pyx_n_s_RCVMORE);
+ __Pyx_INCREF(__pyx_n_s_MORE);
+ PyList_SET_ITEM(__pyx_t_1, 150, __pyx_n_s_MORE);
+ __Pyx_GIVEREF(__pyx_n_s_MORE);
+ __Pyx_INCREF(__pyx_n_s_SRCFD);
+ PyList_SET_ITEM(__pyx_t_1, 151, __pyx_n_s_SRCFD);
+ __Pyx_GIVEREF(__pyx_n_s_SRCFD);
+ __Pyx_INCREF(__pyx_n_s_SHARED);
+ PyList_SET_ITEM(__pyx_t_1, 152, __pyx_n_s_SHARED);
+ __Pyx_GIVEREF(__pyx_n_s_SHARED);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/constants.pyx":1
+ * """0MQ Constants.""" # <<<<<<<<<<<<<<
+ *
+ * #
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython.constants", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython.constants");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+ if (likely(PyUnicode_Check(n)))
+#else
+ if (likely(PyString_Check(n)))
+#endif
+ return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+ return PyObject_GetAttr(o, n);
+}
+
+static PyObject* __Pyx_Globals(void) {
+ Py_ssize_t i;
+ PyObject *names;
+ PyObject *globals = __pyx_d;
+ Py_INCREF(globals);
+ names = PyObject_Dir(__pyx_m);
+ if (!names)
+ goto bad;
+ for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject* name = PySequence_GetItem(names, i);
+ if (!name)
+ goto bad;
+#else
+ PyObject* name = PyList_GET_ITEM(names, i);
+#endif
+ if (!PyDict_Contains(globals, name)) {
+ PyObject* value = __Pyx_GetAttr(__pyx_m, name);
+ if (!value) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ goto bad;
+ }
+ if (PyDict_SetItem(globals, name, value) < 0) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ Py_DECREF(value);
+ goto bad;
+ }
+ }
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
+ }
+ Py_DECREF(names);
+ return globals;
+bad:
+ Py_XDECREF(names);
+ Py_XDECREF(globals);
+ return NULL;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.pxi b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.pxi
new file mode 100644
index 00000000..7c58c213
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.pxi
@@ -0,0 +1,316 @@
+#-----------------------------------------------------------------------------
+# Python module level constants
+#-----------------------------------------------------------------------------
+
+VERSION = ZMQ_VERSION
+VERSION_MAJOR = ZMQ_VERSION_MAJOR
+VERSION_MINOR = ZMQ_VERSION_MINOR
+VERSION_PATCH = ZMQ_VERSION_PATCH
+NOBLOCK = ZMQ_NOBLOCK
+DONTWAIT = ZMQ_DONTWAIT
+POLLIN = ZMQ_POLLIN
+POLLOUT = ZMQ_POLLOUT
+POLLERR = ZMQ_POLLERR
+SNDMORE = ZMQ_SNDMORE
+STREAMER = ZMQ_STREAMER
+FORWARDER = ZMQ_FORWARDER
+QUEUE = ZMQ_QUEUE
+IO_THREADS_DFLT = ZMQ_IO_THREADS_DFLT
+MAX_SOCKETS_DFLT = ZMQ_MAX_SOCKETS_DFLT
+POLLITEMS_DFLT = ZMQ_POLLITEMS_DFLT
+THREAD_PRIORITY_DFLT = ZMQ_THREAD_PRIORITY_DFLT
+THREAD_SCHED_POLICY_DFLT = ZMQ_THREAD_SCHED_POLICY_DFLT
+PAIR = ZMQ_PAIR
+PUB = ZMQ_PUB
+SUB = ZMQ_SUB
+REQ = ZMQ_REQ
+REP = ZMQ_REP
+DEALER = ZMQ_DEALER
+ROUTER = ZMQ_ROUTER
+XREQ = ZMQ_XREQ
+XREP = ZMQ_XREP
+PULL = ZMQ_PULL
+PUSH = ZMQ_PUSH
+XPUB = ZMQ_XPUB
+XSUB = ZMQ_XSUB
+UPSTREAM = ZMQ_UPSTREAM
+DOWNSTREAM = ZMQ_DOWNSTREAM
+STREAM = ZMQ_STREAM
+EVENT_CONNECTED = ZMQ_EVENT_CONNECTED
+EVENT_CONNECT_DELAYED = ZMQ_EVENT_CONNECT_DELAYED
+EVENT_CONNECT_RETRIED = ZMQ_EVENT_CONNECT_RETRIED
+EVENT_LISTENING = ZMQ_EVENT_LISTENING
+EVENT_BIND_FAILED = ZMQ_EVENT_BIND_FAILED
+EVENT_ACCEPTED = ZMQ_EVENT_ACCEPTED
+EVENT_ACCEPT_FAILED = ZMQ_EVENT_ACCEPT_FAILED
+EVENT_CLOSED = ZMQ_EVENT_CLOSED
+EVENT_CLOSE_FAILED = ZMQ_EVENT_CLOSE_FAILED
+EVENT_DISCONNECTED = ZMQ_EVENT_DISCONNECTED
+EVENT_ALL = ZMQ_EVENT_ALL
+EVENT_MONITOR_STOPPED = ZMQ_EVENT_MONITOR_STOPPED
+globals()['NULL'] = ZMQ_NULL
+PLAIN = ZMQ_PLAIN
+CURVE = ZMQ_CURVE
+GSSAPI = ZMQ_GSSAPI
+EAGAIN = ZMQ_EAGAIN
+EINVAL = ZMQ_EINVAL
+EFAULT = ZMQ_EFAULT
+ENOMEM = ZMQ_ENOMEM
+ENODEV = ZMQ_ENODEV
+EMSGSIZE = ZMQ_EMSGSIZE
+EAFNOSUPPORT = ZMQ_EAFNOSUPPORT
+ENETUNREACH = ZMQ_ENETUNREACH
+ECONNABORTED = ZMQ_ECONNABORTED
+ECONNRESET = ZMQ_ECONNRESET
+ENOTCONN = ZMQ_ENOTCONN
+ETIMEDOUT = ZMQ_ETIMEDOUT
+EHOSTUNREACH = ZMQ_EHOSTUNREACH
+ENETRESET = ZMQ_ENETRESET
+HAUSNUMERO = ZMQ_HAUSNUMERO
+ENOTSUP = ZMQ_ENOTSUP
+EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT
+ENOBUFS = ZMQ_ENOBUFS
+ENETDOWN = ZMQ_ENETDOWN
+EADDRINUSE = ZMQ_EADDRINUSE
+EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
+ECONNREFUSED = ZMQ_ECONNREFUSED
+EINPROGRESS = ZMQ_EINPROGRESS
+ENOTSOCK = ZMQ_ENOTSOCK
+EFSM = ZMQ_EFSM
+ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO
+ETERM = ZMQ_ETERM
+EMTHREAD = ZMQ_EMTHREAD
+IO_THREADS = ZMQ_IO_THREADS
+MAX_SOCKETS = ZMQ_MAX_SOCKETS
+SOCKET_LIMIT = ZMQ_SOCKET_LIMIT
+THREAD_PRIORITY = ZMQ_THREAD_PRIORITY
+THREAD_SCHED_POLICY = ZMQ_THREAD_SCHED_POLICY
+IDENTITY = ZMQ_IDENTITY
+SUBSCRIBE = ZMQ_SUBSCRIBE
+UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
+LAST_ENDPOINT = ZMQ_LAST_ENDPOINT
+TCP_ACCEPT_FILTER = ZMQ_TCP_ACCEPT_FILTER
+PLAIN_USERNAME = ZMQ_PLAIN_USERNAME
+PLAIN_PASSWORD = ZMQ_PLAIN_PASSWORD
+CURVE_PUBLICKEY = ZMQ_CURVE_PUBLICKEY
+CURVE_SECRETKEY = ZMQ_CURVE_SECRETKEY
+CURVE_SERVERKEY = ZMQ_CURVE_SERVERKEY
+ZAP_DOMAIN = ZMQ_ZAP_DOMAIN
+CONNECT_RID = ZMQ_CONNECT_RID
+GSSAPI_PRINCIPAL = ZMQ_GSSAPI_PRINCIPAL
+GSSAPI_SERVICE_PRINCIPAL = ZMQ_GSSAPI_SERVICE_PRINCIPAL
+SOCKS_PROXY = ZMQ_SOCKS_PROXY
+FD = ZMQ_FD
+RECONNECT_IVL_MAX = ZMQ_RECONNECT_IVL_MAX
+SNDTIMEO = ZMQ_SNDTIMEO
+RCVTIMEO = ZMQ_RCVTIMEO
+SNDHWM = ZMQ_SNDHWM
+RCVHWM = ZMQ_RCVHWM
+MULTICAST_HOPS = ZMQ_MULTICAST_HOPS
+IPV4ONLY = ZMQ_IPV4ONLY
+ROUTER_BEHAVIOR = ZMQ_ROUTER_BEHAVIOR
+TCP_KEEPALIVE = ZMQ_TCP_KEEPALIVE
+TCP_KEEPALIVE_CNT = ZMQ_TCP_KEEPALIVE_CNT
+TCP_KEEPALIVE_IDLE = ZMQ_TCP_KEEPALIVE_IDLE
+TCP_KEEPALIVE_INTVL = ZMQ_TCP_KEEPALIVE_INTVL
+DELAY_ATTACH_ON_CONNECT = ZMQ_DELAY_ATTACH_ON_CONNECT
+XPUB_VERBOSE = ZMQ_XPUB_VERBOSE
+EVENTS = ZMQ_EVENTS
+TYPE = ZMQ_TYPE
+LINGER = ZMQ_LINGER
+RECONNECT_IVL = ZMQ_RECONNECT_IVL
+BACKLOG = ZMQ_BACKLOG
+ROUTER_MANDATORY = ZMQ_ROUTER_MANDATORY
+FAIL_UNROUTABLE = ZMQ_FAIL_UNROUTABLE
+ROUTER_RAW = ZMQ_ROUTER_RAW
+IMMEDIATE = ZMQ_IMMEDIATE
+IPV6 = ZMQ_IPV6
+MECHANISM = ZMQ_MECHANISM
+PLAIN_SERVER = ZMQ_PLAIN_SERVER
+CURVE_SERVER = ZMQ_CURVE_SERVER
+PROBE_ROUTER = ZMQ_PROBE_ROUTER
+REQ_RELAXED = ZMQ_REQ_RELAXED
+REQ_CORRELATE = ZMQ_REQ_CORRELATE
+CONFLATE = ZMQ_CONFLATE
+ROUTER_HANDOVER = ZMQ_ROUTER_HANDOVER
+TOS = ZMQ_TOS
+IPC_FILTER_PID = ZMQ_IPC_FILTER_PID
+IPC_FILTER_UID = ZMQ_IPC_FILTER_UID
+IPC_FILTER_GID = ZMQ_IPC_FILTER_GID
+GSSAPI_SERVER = ZMQ_GSSAPI_SERVER
+GSSAPI_PLAINTEXT = ZMQ_GSSAPI_PLAINTEXT
+HANDSHAKE_IVL = ZMQ_HANDSHAKE_IVL
+XPUB_NODROP = ZMQ_XPUB_NODROP
+AFFINITY = ZMQ_AFFINITY
+MAXMSGSIZE = ZMQ_MAXMSGSIZE
+HWM = ZMQ_HWM
+SWAP = ZMQ_SWAP
+MCAST_LOOP = ZMQ_MCAST_LOOP
+RECOVERY_IVL_MSEC = ZMQ_RECOVERY_IVL_MSEC
+RATE = ZMQ_RATE
+RECOVERY_IVL = ZMQ_RECOVERY_IVL
+SNDBUF = ZMQ_SNDBUF
+RCVBUF = ZMQ_RCVBUF
+RCVMORE = ZMQ_RCVMORE
+MORE = ZMQ_MORE
+SRCFD = ZMQ_SRCFD
+SHARED = ZMQ_SHARED
+
+#-----------------------------------------------------------------------------
+# Symbols to export
+#-----------------------------------------------------------------------------
+__all__ = [
+ "VERSION",
+ "VERSION_MAJOR",
+ "VERSION_MINOR",
+ "VERSION_PATCH",
+ "NOBLOCK",
+ "DONTWAIT",
+ "POLLIN",
+ "POLLOUT",
+ "POLLERR",
+ "SNDMORE",
+ "STREAMER",
+ "FORWARDER",
+ "QUEUE",
+ "IO_THREADS_DFLT",
+ "MAX_SOCKETS_DFLT",
+ "POLLITEMS_DFLT",
+ "THREAD_PRIORITY_DFLT",
+ "THREAD_SCHED_POLICY_DFLT",
+ "PAIR",
+ "PUB",
+ "SUB",
+ "REQ",
+ "REP",
+ "DEALER",
+ "ROUTER",
+ "XREQ",
+ "XREP",
+ "PULL",
+ "PUSH",
+ "XPUB",
+ "XSUB",
+ "UPSTREAM",
+ "DOWNSTREAM",
+ "STREAM",
+ "EVENT_CONNECTED",
+ "EVENT_CONNECT_DELAYED",
+ "EVENT_CONNECT_RETRIED",
+ "EVENT_LISTENING",
+ "EVENT_BIND_FAILED",
+ "EVENT_ACCEPTED",
+ "EVENT_ACCEPT_FAILED",
+ "EVENT_CLOSED",
+ "EVENT_CLOSE_FAILED",
+ "EVENT_DISCONNECTED",
+ "EVENT_ALL",
+ "EVENT_MONITOR_STOPPED",
+ "NULL",
+ "PLAIN",
+ "CURVE",
+ "GSSAPI",
+ "EAGAIN",
+ "EINVAL",
+ "EFAULT",
+ "ENOMEM",
+ "ENODEV",
+ "EMSGSIZE",
+ "EAFNOSUPPORT",
+ "ENETUNREACH",
+ "ECONNABORTED",
+ "ECONNRESET",
+ "ENOTCONN",
+ "ETIMEDOUT",
+ "EHOSTUNREACH",
+ "ENETRESET",
+ "HAUSNUMERO",
+ "ENOTSUP",
+ "EPROTONOSUPPORT",
+ "ENOBUFS",
+ "ENETDOWN",
+ "EADDRINUSE",
+ "EADDRNOTAVAIL",
+ "ECONNREFUSED",
+ "EINPROGRESS",
+ "ENOTSOCK",
+ "EFSM",
+ "ENOCOMPATPROTO",
+ "ETERM",
+ "EMTHREAD",
+ "IO_THREADS",
+ "MAX_SOCKETS",
+ "SOCKET_LIMIT",
+ "THREAD_PRIORITY",
+ "THREAD_SCHED_POLICY",
+ "IDENTITY",
+ "SUBSCRIBE",
+ "UNSUBSCRIBE",
+ "LAST_ENDPOINT",
+ "TCP_ACCEPT_FILTER",
+ "PLAIN_USERNAME",
+ "PLAIN_PASSWORD",
+ "CURVE_PUBLICKEY",
+ "CURVE_SECRETKEY",
+ "CURVE_SERVERKEY",
+ "ZAP_DOMAIN",
+ "CONNECT_RID",
+ "GSSAPI_PRINCIPAL",
+ "GSSAPI_SERVICE_PRINCIPAL",
+ "SOCKS_PROXY",
+ "FD",
+ "RECONNECT_IVL_MAX",
+ "SNDTIMEO",
+ "RCVTIMEO",
+ "SNDHWM",
+ "RCVHWM",
+ "MULTICAST_HOPS",
+ "IPV4ONLY",
+ "ROUTER_BEHAVIOR",
+ "TCP_KEEPALIVE",
+ "TCP_KEEPALIVE_CNT",
+ "TCP_KEEPALIVE_IDLE",
+ "TCP_KEEPALIVE_INTVL",
+ "DELAY_ATTACH_ON_CONNECT",
+ "XPUB_VERBOSE",
+ "EVENTS",
+ "TYPE",
+ "LINGER",
+ "RECONNECT_IVL",
+ "BACKLOG",
+ "ROUTER_MANDATORY",
+ "FAIL_UNROUTABLE",
+ "ROUTER_RAW",
+ "IMMEDIATE",
+ "IPV6",
+ "MECHANISM",
+ "PLAIN_SERVER",
+ "CURVE_SERVER",
+ "PROBE_ROUTER",
+ "REQ_RELAXED",
+ "REQ_CORRELATE",
+ "CONFLATE",
+ "ROUTER_HANDOVER",
+ "TOS",
+ "IPC_FILTER_PID",
+ "IPC_FILTER_UID",
+ "IPC_FILTER_GID",
+ "GSSAPI_SERVER",
+ "GSSAPI_PLAINTEXT",
+ "HANDSHAKE_IVL",
+ "XPUB_NODROP",
+ "AFFINITY",
+ "MAXMSGSIZE",
+ "HWM",
+ "SWAP",
+ "MCAST_LOOP",
+ "RECOVERY_IVL_MSEC",
+ "RATE",
+ "RECOVERY_IVL",
+ "SNDBUF",
+ "RCVBUF",
+ "RCVMORE",
+ "MORE",
+ "SRCFD",
+ "SHARED",
+]
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.pyx
new file mode 100644
index 00000000..f924f030
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/constants.pyx
@@ -0,0 +1,32 @@
+"""0MQ Constants."""
+
+#
+# Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+from libzmq cimport *
+
+#-----------------------------------------------------------------------------
+# Python module level constants
+#-----------------------------------------------------------------------------
+
+include "constants.pxi"
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.c
new file mode 100644
index 00000000..9ca804bc
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.c
@@ -0,0 +1,4966 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython__context
+#define __PYX_HAVE_API__zmq__backend__cython__context
+#include "string.h"
+#include "stdlib.h"
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#include "getpid_compat.h"
+#include "errno.h"
+#include "stdio.h"
+#include "pythread.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/context.pyx",
+ "zmq/backend/cython/context.pxd",
+ "zmq/backend/cython/checkrc.pxd",
+ "type.pxd",
+ "bool.pxd",
+ "complex.pxd",
+};
+
+/*--- Type declarations ---*/
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context;
+
+/* "zmq/backend/cython/context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ void **_sockets;
+ size_t _n_sockets;
+ size_t _max_sockets;
+ int _pid;
+ int closed;
+};
+
+
+
+/* "zmq/backend/cython/context.pyx":20
+ * _instance = None
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ * """Context(io_threads=1)
+ *
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context {
+ int (*_term)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *);
+ void (*_add_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+ void (*_remove_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtabptr_3zmq_7backend_6cython_7context_Context;
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7context_7Context__term(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *);
+static CYTHON_INLINE void __pyx_f_3zmq_7backend_6cython_7context_7Context__add_socket(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+static CYTHON_INLINE void __pyx_f_3zmq_7backend_6cython_7context_7Context__remove_socket(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+ const char* function_name);
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+ int lineno, const char *filename,
+ int full_traceback);
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable);
+
+static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
+
+#ifndef __PYX_FORCE_INIT_THREADS
+ #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static int __Pyx_check_binary_version(void);
+
+#if !defined(__Pyx_PyIdentifier_FromString)
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
+#else
+ #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
+#endif
+#endif
+
+static PyObject *__Pyx_ImportModule(const char *name);
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+static CYTHON_INLINE void __pyx_f_3zmq_7backend_6cython_7context_7Context__add_socket(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, void *__pyx_v_handle); /* proto*/
+static CYTHON_INLINE void __pyx_f_3zmq_7backend_6cython_7context_7Context__remove_socket(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, void *__pyx_v_handle); /* proto*/
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7context_7Context__term(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self); /* proto*/
+
+/* Module declarations from 'libc.string' */
+
+/* Module declarations from 'libc.stdlib' */
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'libc.errno' */
+
+/* Module declarations from 'cpython.version' */
+
+/* Module declarations from 'cpython.ref' */
+
+/* Module declarations from 'cpython.exc' */
+
+/* Module declarations from 'cpython.module' */
+
+/* Module declarations from 'cpython.mem' */
+
+/* Module declarations from 'cpython.tuple' */
+
+/* Module declarations from 'cpython.list' */
+
+/* Module declarations from 'libc.stdio' */
+
+/* Module declarations from 'cpython.object' */
+
+/* Module declarations from 'cpython.sequence' */
+
+/* Module declarations from 'cpython.mapping' */
+
+/* Module declarations from 'cpython.iterator' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
+
+/* Module declarations from 'cpython.number' */
+
+/* Module declarations from 'cpython.int' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.bool' */
+static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
+
+/* Module declarations from 'cpython.long' */
+
+/* Module declarations from 'cpython.float' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.complex' */
+static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
+
+/* Module declarations from 'cpython.string' */
+
+/* Module declarations from 'cpython.unicode' */
+
+/* Module declarations from 'cpython.dict' */
+
+/* Module declarations from 'cpython.instance' */
+
+/* Module declarations from 'cpython.function' */
+
+/* Module declarations from 'cpython.method' */
+
+/* Module declarations from 'cpython.weakref' */
+
+/* Module declarations from 'cpython.getargs' */
+
+/* Module declarations from 'cpython.pythread' */
+
+/* Module declarations from 'cpython.pystate' */
+
+/* Module declarations from 'cpython.cobject' */
+
+/* Module declarations from 'cpython.oldbuffer' */
+
+/* Module declarations from 'cpython.set' */
+
+/* Module declarations from 'cpython.buffer' */
+
+/* Module declarations from 'cpython.bytes' */
+
+/* Module declarations from 'cpython.pycapsule' */
+
+/* Module declarations from 'cpython' */
+
+/* Module declarations from 'zmq.backend.cython.checkrc' */
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int); /*proto*/
+
+/* Module declarations from 'zmq.backend.cython.context' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7context_Context = 0;
+#define __Pyx_MODULE_NAME "zmq.backend.cython.context"
+int __pyx_module_is_main_zmq__backend__cython__context = 0;
+
+/* Implementation of 'zmq.backend.cython.context' */
+static PyObject *__pyx_builtin_property;
+static PyObject *__pyx_builtin_MemoryError;
+static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_RuntimeError;
+static PyObject *__pyx_builtin_TypeError;
+static int __pyx_pf_3zmq_7backend_6cython_7context_7Context___init__(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_io_threads, CYTHON_UNUSED PyObject *__pyx_v_shadow); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7context_7Context_2__cinit__(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, int __pyx_v_io_threads, size_t __pyx_v_shadow, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
+static void __pyx_pf_3zmq_7backend_6cython_7context_7Context_4__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_6underlying(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_8term(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_10set(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, int __pyx_v_option, PyObject *__pyx_v_optval); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_12get(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, int __pyx_v_option); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_14destroy(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, PyObject *__pyx_v_linger); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_6closed___get__(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7context_7Context_6closed_2__set__(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_7context_Context(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_term[] = "term";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_Again[] = "Again";
+static char __pyx_k_range[] = "range";
+static char __pyx_k_handle[] = "_handle";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_linger[] = "linger";
+static char __pyx_k_option[] = "option";
+static char __pyx_k_optval[] = "optval";
+static char __pyx_k_shadow[] = "shadow";
+static char __pyx_k_Context[] = "Context";
+static char __pyx_k_ZMQError[] = "ZMQError";
+static char __pyx_k_instance[] = "_instance";
+static char __pyx_k_property[] = "property";
+static char __pyx_k_TypeError[] = "TypeError";
+static char __pyx_k_zmq_error[] = "zmq.error";
+static char __pyx_k_io_threads[] = "io_threads";
+static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static char __pyx_k_underlying[] = "underlying";
+static char __pyx_k_MemoryError[] = "MemoryError";
+static char __pyx_k_RuntimeError[] = "RuntimeError";
+static char __pyx_k_0MQ_Context_class[] = "0MQ Context class.";
+static char __pyx_k_ContextTerminated[] = "ContextTerminated";
+static char __pyx_k_expected_int_got_r[] = "expected int, got: %r";
+static char __pyx_k_InterruptedSystemCall[] = "InterruptedSystemCall";
+static char __pyx_k_Context_has_been_destroyed[] = "Context has been destroyed";
+static char __pyx_k_Could_not_allocate__sockets_arra[] = "Could not allocate _sockets array";
+static char __pyx_k_Could_not_reallocate__sockets_ar[] = "Could not reallocate _sockets array";
+static PyObject *__pyx_n_s_Again;
+static PyObject *__pyx_n_s_Context;
+static PyObject *__pyx_n_s_ContextTerminated;
+static PyObject *__pyx_kp_s_Context_has_been_destroyed;
+static PyObject *__pyx_kp_s_Could_not_allocate__sockets_arra;
+static PyObject *__pyx_kp_s_Could_not_reallocate__sockets_ar;
+static PyObject *__pyx_n_s_InterruptedSystemCall;
+static PyObject *__pyx_n_s_MemoryError;
+static PyObject *__pyx_n_s_RuntimeError;
+static PyObject *__pyx_n_s_TypeError;
+static PyObject *__pyx_n_s_ZMQError;
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_kp_s_expected_int_got_r;
+static PyObject *__pyx_n_s_handle;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_instance;
+static PyObject *__pyx_n_s_io_threads;
+static PyObject *__pyx_n_s_linger;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_option;
+static PyObject *__pyx_n_s_optval;
+static PyObject *__pyx_n_s_property;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_n_s_range;
+static PyObject *__pyx_n_s_shadow;
+static PyObject *__pyx_n_s_term;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_underlying;
+static PyObject *__pyx_n_s_zmq_error;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__2;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__4;
+
+/* "zmq/backend/cython/context.pyx":32
+ *
+ * # no-op for the signature
+ * def __init__(self, io_threads=1, shadow=0): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7context_7Context_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7context_7Context_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ CYTHON_UNUSED PyObject *__pyx_v_io_threads = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_shadow = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_io_threads,&__pyx_n_s_shadow,0};
+ PyObject* values[2] = {0,0};
+ values[0] = ((PyObject *)__pyx_int_1);
+ values[1] = ((PyObject *)__pyx_int_0);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_io_threads);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shadow);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_io_threads = values[0];
+ __pyx_v_shadow = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context___init__(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self), __pyx_v_io_threads, __pyx_v_shadow);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7context_7Context___init__(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_io_threads, CYTHON_UNUSED PyObject *__pyx_v_shadow) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__", 0);
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/context.pyx":35
+ * pass
+ *
+ * def __cinit__(self, int io_threads=1, size_t shadow=0, **kwargs): # <<<<<<<<<<<<<<
+ * self.handle = NULL
+ * self._sockets = NULL
+ */
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7context_7Context_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7context_7Context_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_v_io_threads;
+ size_t __pyx_v_shadow;
+ CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
+ __Pyx_GOTREF(__pyx_v_kwargs);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_io_threads,&__pyx_n_s_shadow,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_io_threads);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shadow);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ if (values[0]) {
+ __pyx_v_io_threads = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_io_threads == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ } else {
+ __pyx_v_io_threads = ((int)1);
+ }
+ if (values[1]) {
+ __pyx_v_shadow = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_shadow == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ } else {
+ __pyx_v_shadow = ((size_t)0);
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context_2__cinit__(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self), __pyx_v_io_threads, __pyx_v_shadow, __pyx_v_kwargs);
+
+ /* function exit code */
+ __Pyx_XDECREF(__pyx_v_kwargs);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7context_7Context_2__cinit__(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, int __pyx_v_io_threads, size_t __pyx_v_shadow, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
+ int __pyx_v_rc;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ int __pyx_t_6;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "zmq/backend/cython/context.pyx":36
+ *
+ * def __cinit__(self, int io_threads=1, size_t shadow=0, **kwargs):
+ * self.handle = NULL # <<<<<<<<<<<<<<
+ * self._sockets = NULL
+ * if shadow:
+ */
+ __pyx_v_self->handle = NULL;
+
+ /* "zmq/backend/cython/context.pyx":37
+ * def __cinit__(self, int io_threads=1, size_t shadow=0, **kwargs):
+ * self.handle = NULL
+ * self._sockets = NULL # <<<<<<<<<<<<<<
+ * if shadow:
+ * self.handle = <void *>shadow
+ */
+ __pyx_v_self->_sockets = NULL;
+
+ /* "zmq/backend/cython/context.pyx":38
+ * self.handle = NULL
+ * self._sockets = NULL
+ * if shadow: # <<<<<<<<<<<<<<
+ * self.handle = <void *>shadow
+ * self._shadow = True
+ */
+ __pyx_t_1 = (__pyx_v_shadow != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":39
+ * self._sockets = NULL
+ * if shadow:
+ * self.handle = <void *>shadow # <<<<<<<<<<<<<<
+ * self._shadow = True
+ * else:
+ */
+ __pyx_v_self->handle = ((void *)__pyx_v_shadow);
+
+ /* "zmq/backend/cython/context.pyx":40
+ * if shadow:
+ * self.handle = <void *>shadow
+ * self._shadow = True # <<<<<<<<<<<<<<
+ * else:
+ * self._shadow = False
+ */
+ __pyx_v_self->_shadow = 1;
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/context.pyx":42
+ * self._shadow = True
+ * else:
+ * self._shadow = False # <<<<<<<<<<<<<<
+ * if ZMQ_VERSION_MAJOR >= 3:
+ * self.handle = zmq_ctx_new()
+ */
+ __pyx_v_self->_shadow = 0;
+
+ /* "zmq/backend/cython/context.pyx":43
+ * else:
+ * self._shadow = False
+ * if ZMQ_VERSION_MAJOR >= 3: # <<<<<<<<<<<<<<
+ * self.handle = zmq_ctx_new()
+ * else:
+ */
+ __pyx_t_1 = ((ZMQ_VERSION_MAJOR >= 3) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":44
+ * self._shadow = False
+ * if ZMQ_VERSION_MAJOR >= 3:
+ * self.handle = zmq_ctx_new() # <<<<<<<<<<<<<<
+ * else:
+ * self.handle = zmq_init(io_threads)
+ */
+ __pyx_v_self->handle = zmq_ctx_new();
+ goto __pyx_L4;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/context.pyx":46
+ * self.handle = zmq_ctx_new()
+ * else:
+ * self.handle = zmq_init(io_threads) # <<<<<<<<<<<<<<
+ *
+ * if self.handle == NULL:
+ */
+ __pyx_v_self->handle = zmq_init(__pyx_v_io_threads);
+ }
+ __pyx_L4:;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/context.pyx":48
+ * self.handle = zmq_init(io_threads)
+ *
+ * if self.handle == NULL: # <<<<<<<<<<<<<<
+ * raise ZMQError()
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_self->handle == NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":49
+ *
+ * if self.handle == NULL:
+ * raise ZMQError() # <<<<<<<<<<<<<<
+ *
+ * cdef int rc = 0
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/context.pyx":51
+ * raise ZMQError()
+ *
+ * cdef int rc = 0 # <<<<<<<<<<<<<<
+ * if ZMQ_VERSION_MAJOR >= 3 and not self._shadow:
+ * rc = zmq_ctx_set(self.handle, ZMQ_IO_THREADS, io_threads)
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/context.pyx":52
+ *
+ * cdef int rc = 0
+ * if ZMQ_VERSION_MAJOR >= 3 and not self._shadow: # <<<<<<<<<<<<<<
+ * rc = zmq_ctx_set(self.handle, ZMQ_IO_THREADS, io_threads)
+ * _check_rc(rc)
+ */
+ __pyx_t_5 = ((ZMQ_VERSION_MAJOR >= 3) != 0);
+ if (__pyx_t_5) {
+ } else {
+ __pyx_t_1 = __pyx_t_5;
+ goto __pyx_L7_bool_binop_done;
+ }
+ __pyx_t_5 = ((!(__pyx_v_self->_shadow != 0)) != 0);
+ __pyx_t_1 = __pyx_t_5;
+ __pyx_L7_bool_binop_done:;
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":53
+ * cdef int rc = 0
+ * if ZMQ_VERSION_MAJOR >= 3 and not self._shadow:
+ * rc = zmq_ctx_set(self.handle, ZMQ_IO_THREADS, io_threads) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_ctx_set(__pyx_v_self->handle, ZMQ_IO_THREADS, __pyx_v_io_threads);
+
+ /* "zmq/backend/cython/context.pyx":54
+ * if ZMQ_VERSION_MAJOR >= 3 and not self._shadow:
+ * rc = zmq_ctx_set(self.handle, ZMQ_IO_THREADS, io_threads)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * self.closed = False
+ */
+ __pyx_t_6 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "zmq/backend/cython/context.pyx":56
+ * _check_rc(rc)
+ *
+ * self.closed = False # <<<<<<<<<<<<<<
+ * self._n_sockets = 0
+ * self._max_sockets = 32
+ */
+ __pyx_v_self->closed = 0;
+
+ /* "zmq/backend/cython/context.pyx":57
+ *
+ * self.closed = False
+ * self._n_sockets = 0 # <<<<<<<<<<<<<<
+ * self._max_sockets = 32
+ *
+ */
+ __pyx_v_self->_n_sockets = 0;
+
+ /* "zmq/backend/cython/context.pyx":58
+ * self.closed = False
+ * self._n_sockets = 0
+ * self._max_sockets = 32 # <<<<<<<<<<<<<<
+ *
+ * self._sockets = <void **>malloc(self._max_sockets*sizeof(void *))
+ */
+ __pyx_v_self->_max_sockets = 32;
+
+ /* "zmq/backend/cython/context.pyx":60
+ * self._max_sockets = 32
+ *
+ * self._sockets = <void **>malloc(self._max_sockets*sizeof(void *)) # <<<<<<<<<<<<<<
+ * if self._sockets == NULL:
+ * raise MemoryError("Could not allocate _sockets array")
+ */
+ __pyx_v_self->_sockets = ((void **)malloc((__pyx_v_self->_max_sockets * (sizeof(void *)))));
+
+ /* "zmq/backend/cython/context.pyx":61
+ *
+ * self._sockets = <void **>malloc(self._max_sockets*sizeof(void *))
+ * if self._sockets == NULL: # <<<<<<<<<<<<<<
+ * raise MemoryError("Could not allocate _sockets array")
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_self->_sockets == NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":62
+ * self._sockets = <void **>malloc(self._max_sockets*sizeof(void *))
+ * if self._sockets == NULL:
+ * raise MemoryError("Could not allocate _sockets array") # <<<<<<<<<<<<<<
+ *
+ * self._pid = getpid()
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/context.pyx":64
+ * raise MemoryError("Could not allocate _sockets array")
+ *
+ * self._pid = getpid() # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(self):
+ */
+ __pyx_v_self->_pid = getpid();
+
+ /* "zmq/backend/cython/context.pyx":35
+ * pass
+ *
+ * def __cinit__(self, int io_threads=1, size_t shadow=0, **kwargs): # <<<<<<<<<<<<<<
+ * self.handle = NULL
+ * self._sockets = NULL
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/context.pyx":66
+ * self._pid = getpid()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * """don't touch members in dealloc, just cleanup allocations"""
+ * cdef int rc
+ */
+
+/* Python wrapper */
+static void __pyx_pw_3zmq_7backend_6cython_7context_7Context_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_3zmq_7backend_6cython_7context_7Context_5__dealloc__(PyObject *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_pf_3zmq_7backend_6cython_7context_7Context_4__dealloc__(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_pf_3zmq_7backend_6cython_7context_7Context_4__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__dealloc__", 0);
+
+ /* "zmq/backend/cython/context.pyx":69
+ * """don't touch members in dealloc, just cleanup allocations"""
+ * cdef int rc
+ * if self._sockets != NULL: # <<<<<<<<<<<<<<
+ * free(self._sockets)
+ * self._sockets = NULL
+ */
+ __pyx_t_1 = ((__pyx_v_self->_sockets != NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":70
+ * cdef int rc
+ * if self._sockets != NULL:
+ * free(self._sockets) # <<<<<<<<<<<<<<
+ * self._sockets = NULL
+ * self._n_sockets = 0
+ */
+ free(__pyx_v_self->_sockets);
+
+ /* "zmq/backend/cython/context.pyx":71
+ * if self._sockets != NULL:
+ * free(self._sockets)
+ * self._sockets = NULL # <<<<<<<<<<<<<<
+ * self._n_sockets = 0
+ *
+ */
+ __pyx_v_self->_sockets = NULL;
+
+ /* "zmq/backend/cython/context.pyx":72
+ * free(self._sockets)
+ * self._sockets = NULL
+ * self._n_sockets = 0 # <<<<<<<<<<<<<<
+ *
+ * # we can't call object methods in dealloc as it
+ */
+ __pyx_v_self->_n_sockets = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/context.pyx":76
+ * # we can't call object methods in dealloc as it
+ * # might already be partially deleted
+ * if not self._shadow: # <<<<<<<<<<<<<<
+ * self._term()
+ *
+ */
+ __pyx_t_1 = ((!(__pyx_v_self->_shadow != 0)) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":77
+ * # might already be partially deleted
+ * if not self._shadow:
+ * self._term() # <<<<<<<<<<<<<<
+ *
+ * cdef inline void _add_socket(self, void* handle):
+ */
+ __pyx_f_3zmq_7backend_6cython_7context_7Context__term(__pyx_v_self);
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/context.pyx":66
+ * self._pid = getpid()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * """don't touch members in dealloc, just cleanup allocations"""
+ * cdef int rc
+ */
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "zmq/backend/cython/context.pyx":79
+ * self._term()
+ *
+ * cdef inline void _add_socket(self, void* handle): # <<<<<<<<<<<<<<
+ * """Add a socket handle to be closed when Context terminates.
+ *
+ */
+
+static CYTHON_INLINE void __pyx_f_3zmq_7backend_6cython_7context_7Context__add_socket(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, void *__pyx_v_handle) {
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_add_socket", 0);
+
+ /* "zmq/backend/cython/context.pyx":84
+ * This is to be called in the Socket constructor.
+ * """
+ * if self._n_sockets >= self._max_sockets: # <<<<<<<<<<<<<<
+ * self._max_sockets *= 2
+ * self._sockets = <void **>realloc(self._sockets, self._max_sockets*sizeof(void *))
+ */
+ __pyx_t_1 = ((__pyx_v_self->_n_sockets >= __pyx_v_self->_max_sockets) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":85
+ * """
+ * if self._n_sockets >= self._max_sockets:
+ * self._max_sockets *= 2 # <<<<<<<<<<<<<<
+ * self._sockets = <void **>realloc(self._sockets, self._max_sockets*sizeof(void *))
+ * if self._sockets == NULL:
+ */
+ __pyx_v_self->_max_sockets = (__pyx_v_self->_max_sockets * 2);
+
+ /* "zmq/backend/cython/context.pyx":86
+ * if self._n_sockets >= self._max_sockets:
+ * self._max_sockets *= 2
+ * self._sockets = <void **>realloc(self._sockets, self._max_sockets*sizeof(void *)) # <<<<<<<<<<<<<<
+ * if self._sockets == NULL:
+ * raise MemoryError("Could not reallocate _sockets array")
+ */
+ __pyx_v_self->_sockets = ((void **)realloc(__pyx_v_self->_sockets, (__pyx_v_self->_max_sockets * (sizeof(void *)))));
+
+ /* "zmq/backend/cython/context.pyx":87
+ * self._max_sockets *= 2
+ * self._sockets = <void **>realloc(self._sockets, self._max_sockets*sizeof(void *))
+ * if self._sockets == NULL: # <<<<<<<<<<<<<<
+ * raise MemoryError("Could not reallocate _sockets array")
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_self->_sockets == NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":88
+ * self._sockets = <void **>realloc(self._sockets, self._max_sockets*sizeof(void *))
+ * if self._sockets == NULL:
+ * raise MemoryError("Could not reallocate _sockets array") # <<<<<<<<<<<<<<
+ *
+ * self._sockets[self._n_sockets] = handle
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/context.pyx":90
+ * raise MemoryError("Could not reallocate _sockets array")
+ *
+ * self._sockets[self._n_sockets] = handle # <<<<<<<<<<<<<<
+ * self._n_sockets += 1
+ *
+ */
+ (__pyx_v_self->_sockets[__pyx_v_self->_n_sockets]) = __pyx_v_handle;
+
+ /* "zmq/backend/cython/context.pyx":91
+ *
+ * self._sockets[self._n_sockets] = handle
+ * self._n_sockets += 1 # <<<<<<<<<<<<<<
+ *
+ * cdef inline void _remove_socket(self, void* handle):
+ */
+ __pyx_v_self->_n_sockets = (__pyx_v_self->_n_sockets + 1);
+
+ /* "zmq/backend/cython/context.pyx":79
+ * self._term()
+ *
+ * cdef inline void _add_socket(self, void* handle): # <<<<<<<<<<<<<<
+ * """Add a socket handle to be closed when Context terminates.
+ *
+ */
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_WriteUnraisable("zmq.backend.cython.context.Context._add_socket", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "zmq/backend/cython/context.pyx":93
+ * self._n_sockets += 1
+ *
+ * cdef inline void _remove_socket(self, void* handle): # <<<<<<<<<<<<<<
+ * """Remove a socket from the collected handles.
+ *
+ */
+
+static CYTHON_INLINE void __pyx_f_3zmq_7backend_6cython_7context_7Context__remove_socket(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, void *__pyx_v_handle) {
+ int __pyx_v_found;
+ size_t __pyx_v_idx;
+ __Pyx_RefNannyDeclarations
+ size_t __pyx_t_1;
+ size_t __pyx_t_2;
+ int __pyx_t_3;
+ __Pyx_RefNannySetupContext("_remove_socket", 0);
+
+ /* "zmq/backend/cython/context.pyx":99
+ * close a socket a second time.
+ * """
+ * cdef bint found = False # <<<<<<<<<<<<<<
+ *
+ * for idx in range(self._n_sockets):
+ */
+ __pyx_v_found = 0;
+
+ /* "zmq/backend/cython/context.pyx":101
+ * cdef bint found = False
+ *
+ * for idx in range(self._n_sockets): # <<<<<<<<<<<<<<
+ * if self._sockets[idx] == handle:
+ * found=True
+ */
+ __pyx_t_1 = __pyx_v_self->_n_sockets;
+ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
+ __pyx_v_idx = __pyx_t_2;
+
+ /* "zmq/backend/cython/context.pyx":102
+ *
+ * for idx in range(self._n_sockets):
+ * if self._sockets[idx] == handle: # <<<<<<<<<<<<<<
+ * found=True
+ * break
+ */
+ __pyx_t_3 = (((__pyx_v_self->_sockets[__pyx_v_idx]) == __pyx_v_handle) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/context.pyx":103
+ * for idx in range(self._n_sockets):
+ * if self._sockets[idx] == handle:
+ * found=True # <<<<<<<<<<<<<<
+ * break
+ *
+ */
+ __pyx_v_found = 1;
+
+ /* "zmq/backend/cython/context.pyx":104
+ * if self._sockets[idx] == handle:
+ * found=True
+ * break # <<<<<<<<<<<<<<
+ *
+ * if found:
+ */
+ goto __pyx_L4_break;
+ }
+ }
+ __pyx_L4_break:;
+
+ /* "zmq/backend/cython/context.pyx":106
+ * break
+ *
+ * if found: # <<<<<<<<<<<<<<
+ * self._n_sockets -= 1
+ * if self._n_sockets:
+ */
+ __pyx_t_3 = (__pyx_v_found != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/context.pyx":107
+ *
+ * if found:
+ * self._n_sockets -= 1 # <<<<<<<<<<<<<<
+ * if self._n_sockets:
+ * # move last handle to closed socket's index
+ */
+ __pyx_v_self->_n_sockets = (__pyx_v_self->_n_sockets - 1);
+
+ /* "zmq/backend/cython/context.pyx":108
+ * if found:
+ * self._n_sockets -= 1
+ * if self._n_sockets: # <<<<<<<<<<<<<<
+ * # move last handle to closed socket's index
+ * self._sockets[idx] = self._sockets[self._n_sockets]
+ */
+ __pyx_t_3 = (__pyx_v_self->_n_sockets != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/context.pyx":110
+ * if self._n_sockets:
+ * # move last handle to closed socket's index
+ * self._sockets[idx] = self._sockets[self._n_sockets] # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ (__pyx_v_self->_sockets[__pyx_v_idx]) = (__pyx_v_self->_sockets[__pyx_v_self->_n_sockets]);
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "zmq/backend/cython/context.pyx":93
+ * self._n_sockets += 1
+ *
+ * cdef inline void _remove_socket(self, void* handle): # <<<<<<<<<<<<<<
+ * """Remove a socket from the collected handles.
+ *
+ */
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "zmq/backend/cython/context.pyx":114
+ *
+ * @property
+ * def underlying(self): # <<<<<<<<<<<<<<
+ * """The address of the underlying libzmq context"""
+ * return <size_t> self.handle
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_7underlying(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7context_7Context_6underlying[] = "The address of the underlying libzmq context";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_7underlying(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("underlying (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context_6underlying(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_6underlying(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("underlying", 0);
+
+ /* "zmq/backend/cython/context.pyx":116
+ * def underlying(self):
+ * """The address of the underlying libzmq context"""
+ * return <size_t> self.handle # <<<<<<<<<<<<<<
+ *
+ * # backward-compat, though nobody is using it
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_self->handle)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/context.pyx":114
+ *
+ * @property
+ * def underlying(self): # <<<<<<<<<<<<<<
+ * """The address of the underlying libzmq context"""
+ * return <size_t> self.handle
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.underlying", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/context.pyx":121
+ * _handle = underlying
+ *
+ * cdef inline int _term(self): # <<<<<<<<<<<<<<
+ * cdef int rc=0
+ * if self.handle != NULL and not self.closed and getpid() == self._pid:
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7context_7Context__term(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self) {
+ int __pyx_v_rc;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ __Pyx_RefNannySetupContext("_term", 0);
+
+ /* "zmq/backend/cython/context.pyx":122
+ *
+ * cdef inline int _term(self):
+ * cdef int rc=0 # <<<<<<<<<<<<<<
+ * if self.handle != NULL and not self.closed and getpid() == self._pid:
+ * with nogil:
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/context.pyx":123
+ * cdef inline int _term(self):
+ * cdef int rc=0
+ * if self.handle != NULL and not self.closed and getpid() == self._pid: # <<<<<<<<<<<<<<
+ * with nogil:
+ * rc = zmq_ctx_destroy(self.handle)
+ */
+ __pyx_t_2 = ((__pyx_v_self->handle != NULL) != 0);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_2 = ((!(__pyx_v_self->closed != 0)) != 0);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_2 = ((getpid() == __pyx_v_self->_pid) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":124
+ * cdef int rc=0
+ * if self.handle != NULL and not self.closed and getpid() == self._pid:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_ctx_destroy(self.handle)
+ * self.handle = NULL
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/context.pyx":125
+ * if self.handle != NULL and not self.closed and getpid() == self._pid:
+ * with nogil:
+ * rc = zmq_ctx_destroy(self.handle) # <<<<<<<<<<<<<<
+ * self.handle = NULL
+ * return rc
+ */
+ __pyx_v_rc = zmq_ctx_destroy(__pyx_v_self->handle);
+ }
+
+ /* "zmq/backend/cython/context.pyx":124
+ * cdef int rc=0
+ * if self.handle != NULL and not self.closed and getpid() == self._pid:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_ctx_destroy(self.handle)
+ * self.handle = NULL
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+ }
+ }
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/context.pyx":126
+ * with nogil:
+ * rc = zmq_ctx_destroy(self.handle)
+ * self.handle = NULL # <<<<<<<<<<<<<<
+ * return rc
+ *
+ */
+ __pyx_v_self->handle = NULL;
+
+ /* "zmq/backend/cython/context.pyx":127
+ * rc = zmq_ctx_destroy(self.handle)
+ * self.handle = NULL
+ * return rc # <<<<<<<<<<<<<<
+ *
+ * def term(self):
+ */
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/context.pyx":121
+ * _handle = underlying
+ *
+ * cdef inline int _term(self): # <<<<<<<<<<<<<<
+ * cdef int rc=0
+ * if self.handle != NULL and not self.closed and getpid() == self._pid:
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/context.pyx":129
+ * return rc
+ *
+ * def term(self): # <<<<<<<<<<<<<<
+ * """ctx.term()
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_9term(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7context_7Context_8term[] = "ctx.term()\n\n Close or terminate the context.\n \n This can be called to close the context by hand. If this is not called,\n the context will automatically be closed when it is garbage collected.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_9term(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("term (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context_8term(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_8term(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self) {
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("term", 0);
+
+ /* "zmq/backend/cython/context.pyx":137
+ * the context will automatically be closed when it is garbage collected.
+ * """
+ * cdef int rc=0 # <<<<<<<<<<<<<<
+ * rc = self._term()
+ * try:
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/context.pyx":138
+ * """
+ * cdef int rc=0
+ * rc = self._term() # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = __pyx_f_3zmq_7backend_6cython_7context_7Context__term(__pyx_v_self);
+
+ /* "zmq/backend/cython/context.pyx":139
+ * cdef int rc=0
+ * rc = self._term()
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/context.pyx":140
+ * rc = self._term()
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * # ignore interrupted term
+ */
+ __pyx_t_4 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L10_try_end;
+ __pyx_L3_error:;
+
+ /* "zmq/backend/cython/context.pyx":141
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * # ignore interrupted term
+ * # see PEP 475 notes about close & EINTR for why
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_4) {
+ PyErr_Restore(0,0,0);
+ goto __pyx_L4_exception_handled;
+ }
+ goto __pyx_L5_except_error;
+ __pyx_L5_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L1_error;
+ __pyx_L4_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ __pyx_L10_try_end:;
+ }
+
+ /* "zmq/backend/cython/context.pyx":146
+ * pass
+ *
+ * self.closed = True # <<<<<<<<<<<<<<
+ *
+ * def set(self, int option, optval):
+ */
+ __pyx_v_self->closed = 1;
+
+ /* "zmq/backend/cython/context.pyx":129
+ * return rc
+ *
+ * def term(self): # <<<<<<<<<<<<<<
+ * """ctx.term()
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.term", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/context.pyx":148
+ * self.closed = True
+ *
+ * def set(self, int option, optval): # <<<<<<<<<<<<<<
+ * """ctx.set(option, optval)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_11set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7context_7Context_10set[] = "ctx.set(option, optval)\n\n Set a context option.\n\n See the 0MQ API documentation for zmq_ctx_set\n for details on specific options.\n \n .. versionadded:: libzmq-3.2\n .. versionadded:: 13.0\n\n Parameters\n ----------\n option : int\n The option to set. Available values will depend on your\n version of libzmq. Examples include::\n \n zmq.IO_THREADS, zmq.MAX_SOCKETS\n \n optval : int\n The value of the option to set.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_11set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_v_option;
+ PyObject *__pyx_v_optval = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("set (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_option,&__pyx_n_s_optval,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_option)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_optval)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ __pyx_v_option = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_optval = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context_10set(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self), __pyx_v_option, __pyx_v_optval);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_10set(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, int __pyx_v_option, PyObject *__pyx_v_optval) {
+ int __pyx_v_optval_int_c;
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("set", 0);
+
+ /* "zmq/backend/cython/context.pyx":174
+ * cdef char* optval_c
+ *
+ * if self.closed: # <<<<<<<<<<<<<<
+ * raise RuntimeError("Context has been destroyed")
+ *
+ */
+ __pyx_t_1 = (__pyx_v_self->closed != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":175
+ *
+ * if self.closed:
+ * raise RuntimeError("Context has been destroyed") # <<<<<<<<<<<<<<
+ *
+ * if not isinstance(optval, int):
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/context.pyx":177
+ * raise RuntimeError("Context has been destroyed")
+ *
+ * if not isinstance(optval, int): # <<<<<<<<<<<<<<
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int_c = optval
+ */
+ __pyx_t_1 = PyInt_Check(__pyx_v_optval);
+ __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/context.pyx":178
+ *
+ * if not isinstance(optval, int):
+ * raise TypeError('expected int, got: %r' % optval) # <<<<<<<<<<<<<<
+ * optval_int_c = optval
+ * rc = zmq_ctx_set(self.handle, option, optval_int_c)
+ */
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_expected_int_got_r, __pyx_v_optval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/context.pyx":179
+ * if not isinstance(optval, int):
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int_c = optval # <<<<<<<<<<<<<<
+ * rc = zmq_ctx_set(self.handle, option, optval_int_c)
+ * _check_rc(rc)
+ */
+ __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_optval); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_optval_int_c = __pyx_t_5;
+
+ /* "zmq/backend/cython/context.pyx":180
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int_c = optval
+ * rc = zmq_ctx_set(self.handle, option, optval_int_c) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_ctx_set(__pyx_v_self->handle, __pyx_v_option, __pyx_v_optval_int_c);
+
+ /* "zmq/backend/cython/context.pyx":181
+ * optval_int_c = optval
+ * rc = zmq_ctx_set(self.handle, option, optval_int_c)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * def get(self, int option):
+ */
+ __pyx_t_5 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/context.pyx":148
+ * self.closed = True
+ *
+ * def set(self, int option, optval): # <<<<<<<<<<<<<<
+ * """ctx.set(option, optval)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/context.pyx":183
+ * _check_rc(rc)
+ *
+ * def get(self, int option): # <<<<<<<<<<<<<<
+ * """ctx.get(option)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_13get(PyObject *__pyx_v_self, PyObject *__pyx_arg_option); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7context_7Context_12get[] = "ctx.get(option)\n\n Get the value of a context option.\n\n See the 0MQ API documentation for zmq_ctx_get\n for details on specific options.\n \n .. versionadded:: libzmq-3.2\n .. versionadded:: 13.0\n\n Parameters\n ----------\n option : int\n The option to get. Available values will depend on your\n version of libzmq. Examples include::\n \n zmq.IO_THREADS, zmq.MAX_SOCKETS\n \n Returns\n -------\n optval : int\n The value of the option as an integer.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_13get(PyObject *__pyx_v_self, PyObject *__pyx_arg_option) {
+ int __pyx_v_option;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("get (wrapper)", 0);
+ assert(__pyx_arg_option); {
+ __pyx_v_option = __Pyx_PyInt_As_int(__pyx_arg_option); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context_12get(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self), ((int)__pyx_v_option));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_12get(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, int __pyx_v_option) {
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("get", 0);
+
+ /* "zmq/backend/cython/context.pyx":211
+ * cdef int rc
+ *
+ * if self.closed: # <<<<<<<<<<<<<<
+ * raise RuntimeError("Context has been destroyed")
+ *
+ */
+ __pyx_t_1 = (__pyx_v_self->closed != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/context.pyx":212
+ *
+ * if self.closed:
+ * raise RuntimeError("Context has been destroyed") # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_ctx_get(self.handle, option)
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/context.pyx":214
+ * raise RuntimeError("Context has been destroyed")
+ *
+ * rc = zmq_ctx_get(self.handle, option) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_ctx_get(__pyx_v_self->handle, __pyx_v_option);
+
+ /* "zmq/backend/cython/context.pyx":215
+ *
+ * rc = zmq_ctx_get(self.handle, option)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * return rc
+ */
+ __pyx_t_3 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/context.pyx":217
+ * _check_rc(rc)
+ *
+ * return rc # <<<<<<<<<<<<<<
+ *
+ * def destroy(self, linger=None):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/context.pyx":183
+ * _check_rc(rc)
+ *
+ * def get(self, int option): # <<<<<<<<<<<<<<
+ * """ctx.get(option)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/context.pyx":219
+ * return rc
+ *
+ * def destroy(self, linger=None): # <<<<<<<<<<<<<<
+ * """ctx.destroy(linger=None)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_15destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7context_7Context_14destroy[] = "ctx.destroy(linger=None)\n \n Close all sockets associated with this context, and then terminate\n the context. If linger is specified,\n the LINGER sockopt of the sockets will be set prior to closing.\n \n .. warning::\n \n destroy involves calling ``zmq_close()``, which is **NOT** threadsafe.\n If there are active sockets in other threads, this must not be called.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_15destroy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_linger = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_linger,0};
+ PyObject* values[1] = {0};
+ values[0] = ((PyObject *)Py_None);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_linger);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "destroy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_linger = values[0];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("destroy", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context_14destroy(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self), __pyx_v_linger);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_14destroy(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, PyObject *__pyx_v_linger) {
+ int __pyx_v_linger_c;
+ int __pyx_v_setlinger;
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("destroy", 0);
+
+ /* "zmq/backend/cython/context.pyx":233
+ *
+ * cdef int linger_c
+ * cdef bint setlinger=False # <<<<<<<<<<<<<<
+ *
+ * if linger is not None:
+ */
+ __pyx_v_setlinger = 0;
+
+ /* "zmq/backend/cython/context.pyx":235
+ * cdef bint setlinger=False
+ *
+ * if linger is not None: # <<<<<<<<<<<<<<
+ * linger_c = linger
+ * setlinger=True
+ */
+ __pyx_t_1 = (__pyx_v_linger != Py_None);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/context.pyx":236
+ *
+ * if linger is not None:
+ * linger_c = linger # <<<<<<<<<<<<<<
+ * setlinger=True
+ *
+ */
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_linger); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_linger_c = __pyx_t_3;
+
+ /* "zmq/backend/cython/context.pyx":237
+ * if linger is not None:
+ * linger_c = linger
+ * setlinger=True # <<<<<<<<<<<<<<
+ *
+ * if self.handle != NULL and not self.closed and self._n_sockets:
+ */
+ __pyx_v_setlinger = 1;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/context.pyx":239
+ * setlinger=True
+ *
+ * if self.handle != NULL and not self.closed and self._n_sockets: # <<<<<<<<<<<<<<
+ * while self._n_sockets:
+ * if setlinger:
+ */
+ __pyx_t_1 = ((__pyx_v_self->handle != NULL) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_1 = ((!(__pyx_v_self->closed != 0)) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_1 = (__pyx_v_self->_n_sockets != 0);
+ __pyx_t_2 = __pyx_t_1;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/context.pyx":240
+ *
+ * if self.handle != NULL and not self.closed and self._n_sockets:
+ * while self._n_sockets: # <<<<<<<<<<<<<<
+ * if setlinger:
+ * zmq_setsockopt(self._sockets[0], ZMQ_LINGER, &linger_c, sizeof(int))
+ */
+ while (1) {
+ __pyx_t_2 = (__pyx_v_self->_n_sockets != 0);
+ if (!__pyx_t_2) break;
+
+ /* "zmq/backend/cython/context.pyx":241
+ * if self.handle != NULL and not self.closed and self._n_sockets:
+ * while self._n_sockets:
+ * if setlinger: # <<<<<<<<<<<<<<
+ * zmq_setsockopt(self._sockets[0], ZMQ_LINGER, &linger_c, sizeof(int))
+ * rc = zmq_close(self._sockets[0])
+ */
+ __pyx_t_2 = (__pyx_v_setlinger != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/context.pyx":242
+ * while self._n_sockets:
+ * if setlinger:
+ * zmq_setsockopt(self._sockets[0], ZMQ_LINGER, &linger_c, sizeof(int)) # <<<<<<<<<<<<<<
+ * rc = zmq_close(self._sockets[0])
+ * if rc < 0 and zmq_errno() != ZMQ_ENOTSOCK:
+ */
+ zmq_setsockopt((__pyx_v_self->_sockets[0]), ZMQ_LINGER, (&__pyx_v_linger_c), (sizeof(int)));
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+
+ /* "zmq/backend/cython/context.pyx":243
+ * if setlinger:
+ * zmq_setsockopt(self._sockets[0], ZMQ_LINGER, &linger_c, sizeof(int))
+ * rc = zmq_close(self._sockets[0]) # <<<<<<<<<<<<<<
+ * if rc < 0 and zmq_errno() != ZMQ_ENOTSOCK:
+ * raise ZMQError()
+ */
+ __pyx_v_rc = zmq_close((__pyx_v_self->_sockets[0]));
+
+ /* "zmq/backend/cython/context.pyx":244
+ * zmq_setsockopt(self._sockets[0], ZMQ_LINGER, &linger_c, sizeof(int))
+ * rc = zmq_close(self._sockets[0])
+ * if rc < 0 and zmq_errno() != ZMQ_ENOTSOCK: # <<<<<<<<<<<<<<
+ * raise ZMQError()
+ * self._n_sockets -= 1
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L12_bool_binop_done;
+ }
+ __pyx_t_1 = ((zmq_errno() != ENOTSOCK) != 0);
+ __pyx_t_2 = __pyx_t_1;
+ __pyx_L12_bool_binop_done:;
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/context.pyx":245
+ * rc = zmq_close(self._sockets[0])
+ * if rc < 0 and zmq_errno() != ZMQ_ENOTSOCK:
+ * raise ZMQError() # <<<<<<<<<<<<<<
+ * self._n_sockets -= 1
+ * self._sockets[0] = self._sockets[self._n_sockets]
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/context.pyx":246
+ * if rc < 0 and zmq_errno() != ZMQ_ENOTSOCK:
+ * raise ZMQError()
+ * self._n_sockets -= 1 # <<<<<<<<<<<<<<
+ * self._sockets[0] = self._sockets[self._n_sockets]
+ * self.term()
+ */
+ __pyx_v_self->_n_sockets = (__pyx_v_self->_n_sockets - 1);
+
+ /* "zmq/backend/cython/context.pyx":247
+ * raise ZMQError()
+ * self._n_sockets -= 1
+ * self._sockets[0] = self._sockets[self._n_sockets] # <<<<<<<<<<<<<<
+ * self.term()
+ *
+ */
+ (__pyx_v_self->_sockets[0]) = (__pyx_v_self->_sockets[__pyx_v_self->_n_sockets]);
+ }
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/context.pyx":248
+ * self._n_sockets -= 1
+ * self._sockets[0] = self._sockets[self._n_sockets]
+ * self.term() # <<<<<<<<<<<<<<
+ *
+ * __all__ = ['Context']
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_term); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "zmq/backend/cython/context.pyx":219
+ * return rc
+ *
+ * def destroy(self, linger=None): # <<<<<<<<<<<<<<
+ * """ctx.destroy(linger=None)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/context.pxd":36
+ * cdef int _pid # the pid of the process which created me (for fork safety)
+ *
+ * cdef public bint closed # bool property for a closed context. # <<<<<<<<<<<<<<
+ * cdef inline int _term(self)
+ * # helpers for events on _sockets in Socket.__cinit__()/close()
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7context_7Context_6closed_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context_6closed___get__(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7context_7Context_6closed___get__(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7context_7Context_6closed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7context_7Context_6closed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7context_7Context_6closed_2__set__(((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7context_7Context_6closed_2__set__(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->closed = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.context.Context.closed.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int __pyx_v_rc) {
+ int __pyx_v_errno;
+ PyObject *__pyx_v_InterruptedSystemCall = NULL;
+ PyObject *__pyx_v_Again = NULL;
+ PyObject *__pyx_v_ContextTerminated = NULL;
+ PyObject *__pyx_v_ZMQError = NULL;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_check_rc", 0);
+
+ /* "zmq/backend/cython/checkrc.pxd":11
+ * and raising the appropriate Exception class
+ * """
+ * cdef int errno = zmq_errno() # <<<<<<<<<<<<<<
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ */
+ __pyx_v_errno = zmq_errno();
+
+ /* "zmq/backend/cython/checkrc.pxd":12
+ * """
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals() # <<<<<<<<<<<<<<
+ * if rc < 0:
+ * if errno == EINTR:
+ */
+ __pyx_t_1 = PyErr_CheckSignals(); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/checkrc.pxd":13
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals()
+ * if rc < 0: # <<<<<<<<<<<<<<
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ */
+ __pyx_t_2 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ switch (__pyx_v_errno) {
+
+ /* "zmq/backend/cython/checkrc.pxd":14
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ * if errno == EINTR: # <<<<<<<<<<<<<<
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ */
+ case EINTR:
+
+ /* "zmq/backend/cython/checkrc.pxd":15
+ * if rc < 0:
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ */
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_4 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_InterruptedSystemCall = __pyx_t_3;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":16
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno) # <<<<<<<<<<<<<<
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_InterruptedSystemCall);
+ __pyx_t_5 = __pyx_v_InterruptedSystemCall; __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":17
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN: # <<<<<<<<<<<<<<
+ * from zmq.error import Again
+ * raise Again(errno)
+ */
+ case EAGAIN:
+
+ /* "zmq/backend/cython/checkrc.pxd":18
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ * from zmq.error import Again # <<<<<<<<<<<<<<
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ */
+ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_Again);
+ PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Again);
+ __Pyx_GIVEREF(__pyx_n_s_Again);
+ __pyx_t_5 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Again); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v_Again = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":19
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ * raise Again(errno) # <<<<<<<<<<<<<<
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ */
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_Again);
+ __pyx_t_7 = __pyx_v_Again; __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ case ETERM:
+
+ /* "zmq/backend/cython/checkrc.pxd":21
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated # <<<<<<<<<<<<<<
+ * raise ContextTerminated(errno)
+ * else:
+ */
+ __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_ContextTerminated);
+ PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_ContextTerminated);
+ __Pyx_GIVEREF(__pyx_n_s_ContextTerminated);
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_5, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ContextTerminated); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_v_ContextTerminated = __pyx_t_5;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":22
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno) # <<<<<<<<<<<<<<
+ * else:
+ * from zmq.error import ZMQError
+ */
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_v_ContextTerminated);
+ __pyx_t_6 = __pyx_v_ContextTerminated; __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_t_7, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ default:
+
+ /* "zmq/backend/cython/checkrc.pxd":24
+ * raise ContextTerminated(errno)
+ * else:
+ * from zmq.error import ZMQError # <<<<<<<<<<<<<<
+ * raise ZMQError(errno)
+ * return 0
+ */
+ __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_7, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_7);
+ __pyx_v_ZMQError = __pyx_t_7;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":25
+ * else:
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno) # <<<<<<<<<<<<<<
+ * return 0
+ */
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_v_ZMQError);
+ __pyx_t_3 = __pyx_v_ZMQError; __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ }
+ }
+
+ /* "zmq/backend/cython/checkrc.pxd":26
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno)
+ * return 0 # <<<<<<<<<<<<<<
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.checkrc._check_rc", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_InterruptedSystemCall);
+ __Pyx_XDECREF(__pyx_v_Again);
+ __Pyx_XDECREF(__pyx_v_ContextTerminated);
+ __Pyx_XDECREF(__pyx_v_ZMQError);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context __pyx_vtable_3zmq_7backend_6cython_7context_Context;
+
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_7context_Context(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_3zmq_7backend_6cython_7context_Context *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)o);
+ p->__pyx_vtab = __pyx_vtabptr_3zmq_7backend_6cython_7context_Context;
+ if (unlikely(__pyx_pw_3zmq_7backend_6cython_7context_7Context_3__cinit__(o, a, k) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
+ return o;
+}
+
+static void __pyx_tp_dealloc_3zmq_7backend_6cython_7context_Context(PyObject *o) {
+ struct __pyx_obj_3zmq_7backend_6cython_7context_Context *p = (struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_3zmq_7backend_6cython_7context_7Context_5__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ if (p->__weakref__) PyObject_ClearWeakRefs(o);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_3zmq_7backend_6cython_7context_7Context_closed(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_3zmq_7backend_6cython_7context_7Context_6closed_1__get__(o);
+}
+
+static int __pyx_setprop_3zmq_7backend_6cython_7context_7Context_closed(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_3zmq_7backend_6cython_7context_7Context_6closed_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_3zmq_7backend_6cython_7context_Context[] = {
+ {"underlying", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7context_7Context_7underlying, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_7context_7Context_6underlying},
+ {"term", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7context_7Context_9term, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_7context_7Context_8term},
+ {"set", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7context_7Context_11set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_7context_7Context_10set},
+ {"get", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7context_7Context_13get, METH_O, __pyx_doc_3zmq_7backend_6cython_7context_7Context_12get},
+ {"destroy", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7context_7Context_15destroy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_7context_7Context_14destroy},
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_3zmq_7backend_6cython_7context_Context[] = {
+ {(char *)"closed", __pyx_getprop_3zmq_7backend_6cython_7context_7Context_closed, __pyx_setprop_3zmq_7backend_6cython_7context_7Context_closed, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_3zmq_7backend_6cython_7context_Context = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "zmq.backend.cython.context.Context", /*tp_name*/
+ sizeof(struct __pyx_obj_3zmq_7backend_6cython_7context_Context), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_3zmq_7backend_6cython_7context_Context, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "Context(io_threads=1)\n\n Manage the lifecycle of a 0MQ context.\n\n Parameters\n ----------\n io_threads : int\n The number of IO threads.\n ", /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_3zmq_7backend_6cython_7context_Context, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_3zmq_7backend_6cython_7context_Context, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_3zmq_7backend_6cython_7context_7Context_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_3zmq_7backend_6cython_7context_Context, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "context",
+ __pyx_k_0MQ_Context_class, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_Again, __pyx_k_Again, sizeof(__pyx_k_Again), 0, 0, 1, 1},
+ {&__pyx_n_s_Context, __pyx_k_Context, sizeof(__pyx_k_Context), 0, 0, 1, 1},
+ {&__pyx_n_s_ContextTerminated, __pyx_k_ContextTerminated, sizeof(__pyx_k_ContextTerminated), 0, 0, 1, 1},
+ {&__pyx_kp_s_Context_has_been_destroyed, __pyx_k_Context_has_been_destroyed, sizeof(__pyx_k_Context_has_been_destroyed), 0, 0, 1, 0},
+ {&__pyx_kp_s_Could_not_allocate__sockets_arra, __pyx_k_Could_not_allocate__sockets_arra, sizeof(__pyx_k_Could_not_allocate__sockets_arra), 0, 0, 1, 0},
+ {&__pyx_kp_s_Could_not_reallocate__sockets_ar, __pyx_k_Could_not_reallocate__sockets_ar, sizeof(__pyx_k_Could_not_reallocate__sockets_ar), 0, 0, 1, 0},
+ {&__pyx_n_s_InterruptedSystemCall, __pyx_k_InterruptedSystemCall, sizeof(__pyx_k_InterruptedSystemCall), 0, 0, 1, 1},
+ {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
+ {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
+ {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
+ {&__pyx_n_s_ZMQError, __pyx_k_ZMQError, sizeof(__pyx_k_ZMQError), 0, 0, 1, 1},
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_kp_s_expected_int_got_r, __pyx_k_expected_int_got_r, sizeof(__pyx_k_expected_int_got_r), 0, 0, 1, 0},
+ {&__pyx_n_s_handle, __pyx_k_handle, sizeof(__pyx_k_handle), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_instance, __pyx_k_instance, sizeof(__pyx_k_instance), 0, 0, 1, 1},
+ {&__pyx_n_s_io_threads, __pyx_k_io_threads, sizeof(__pyx_k_io_threads), 0, 0, 1, 1},
+ {&__pyx_n_s_linger, __pyx_k_linger, sizeof(__pyx_k_linger), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_option, __pyx_k_option, sizeof(__pyx_k_option), 0, 0, 1, 1},
+ {&__pyx_n_s_optval, __pyx_k_optval, sizeof(__pyx_k_optval), 0, 0, 1, 1},
+ {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
+ {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
+ {&__pyx_n_s_shadow, __pyx_k_shadow, sizeof(__pyx_k_shadow), 0, 0, 1, 1},
+ {&__pyx_n_s_term, __pyx_k_term, sizeof(__pyx_k_term), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_underlying, __pyx_k_underlying, sizeof(__pyx_k_underlying), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_error, __pyx_k_zmq_error, sizeof(__pyx_k_zmq_error), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "zmq/backend/cython/context.pyx":62
+ * self._sockets = <void **>malloc(self._max_sockets*sizeof(void *))
+ * if self._sockets == NULL:
+ * raise MemoryError("Could not allocate _sockets array") # <<<<<<<<<<<<<<
+ *
+ * self._pid = getpid()
+ */
+ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Could_not_allocate__sockets_arra); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+
+ /* "zmq/backend/cython/context.pyx":88
+ * self._sockets = <void **>realloc(self._sockets, self._max_sockets*sizeof(void *))
+ * if self._sockets == NULL:
+ * raise MemoryError("Could not reallocate _sockets array") # <<<<<<<<<<<<<<
+ *
+ * self._sockets[self._n_sockets] = handle
+ */
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Could_not_reallocate__sockets_ar); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__2);
+ __Pyx_GIVEREF(__pyx_tuple__2);
+
+ /* "zmq/backend/cython/context.pyx":175
+ *
+ * if self.closed:
+ * raise RuntimeError("Context has been destroyed") # <<<<<<<<<<<<<<
+ *
+ * if not isinstance(optval, int):
+ */
+ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Context_has_been_destroyed); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+
+ /* "zmq/backend/cython/context.pyx":212
+ *
+ * if self.closed:
+ * raise RuntimeError("Context has been destroyed") # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_ctx_get(self.handle, option)
+ */
+ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Context_has_been_destroyed); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__4);
+ __Pyx_GIVEREF(__pyx_tuple__4);
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initcontext(void); /*proto*/
+PyMODINIT_FUNC initcontext(void)
+#else
+PyMODINIT_FUNC PyInit_context(void); /*proto*/
+PyMODINIT_FUNC PyInit_context(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_context(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("context", __pyx_methods, __pyx_k_0MQ_Context_class, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython__context) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython.context")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython.context", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ __pyx_vtabptr_3zmq_7backend_6cython_7context_Context = &__pyx_vtable_3zmq_7backend_6cython_7context_Context;
+ __pyx_vtable_3zmq_7backend_6cython_7context_Context._term = (int (*)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *))__pyx_f_3zmq_7backend_6cython_7context_7Context__term;
+ __pyx_vtable_3zmq_7backend_6cython_7context_Context._add_socket = (void (*)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *))__pyx_f_3zmq_7backend_6cython_7context_7Context__add_socket;
+ __pyx_vtable_3zmq_7backend_6cython_7context_Context._remove_socket = (void (*)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *))__pyx_f_3zmq_7backend_6cython_7context_7Context__remove_socket;
+ if (PyType_Ready(&__pyx_type_3zmq_7backend_6cython_7context_Context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_3zmq_7backend_6cython_7context_Context.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_3zmq_7backend_6cython_7context_Context.tp_dict, __pyx_vtabptr_3zmq_7backend_6cython_7context_Context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Context", (PyObject *)&__pyx_type_3zmq_7backend_6cython_7context_Context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_type_3zmq_7backend_6cython_7context_Context.tp_weaklistoffset == 0) __pyx_type_3zmq_7backend_6cython_7context_Context.tp_weaklistoffset = offsetof(struct __pyx_obj_3zmq_7backend_6cython_7context_Context, __weakref__);
+ __pyx_ptype_3zmq_7backend_6cython_7context_Context = &__pyx_type_3zmq_7backend_6cython_7context_Context;
+ /*--- Type import code ---*/
+ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
+ #if CYTHON_COMPILING_IN_PYPY
+ sizeof(PyTypeObject),
+ #else
+ sizeof(PyHeapTypeObject),
+ #endif
+ 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/context.pyx":14
+ * int getpid()
+ *
+ * from zmq.error import ZMQError, InterruptedSystemCall # <<<<<<<<<<<<<<
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ *
+ */
+ __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZMQError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_InterruptedSystemCall, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/context.pyx":18
+ *
+ *
+ * _instance = None # <<<<<<<<<<<<<<
+ *
+ * cdef class Context:
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_instance, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/context.pyx":114
+ *
+ * @property
+ * def underlying(self): # <<<<<<<<<<<<<<
+ * """The address of the underlying libzmq context"""
+ * return <size_t> self.handle
+ */
+ __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3zmq_7backend_6cython_7context_Context, __pyx_n_s_underlying); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+
+ /* "zmq/backend/cython/context.pyx":113
+ *
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def underlying(self):
+ * """The address of the underlying libzmq context"""
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_3zmq_7backend_6cython_7context_Context->tp_dict, __pyx_n_s_underlying, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ PyType_Modified(__pyx_ptype_3zmq_7backend_6cython_7context_Context);
+
+ /* "zmq/backend/cython/context.pyx":119
+ *
+ * # backward-compat, though nobody is using it
+ * _handle = underlying # <<<<<<<<<<<<<<
+ *
+ * cdef inline int _term(self):
+ */
+ __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3zmq_7backend_6cython_7context_Context, __pyx_n_s_underlying); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_3zmq_7backend_6cython_7context_Context->tp_dict, __pyx_n_s_handle, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ PyType_Modified(__pyx_ptype_3zmq_7backend_6cython_7context_Context);
+
+ /* "zmq/backend/cython/context.pyx":250
+ * self.term()
+ *
+ * __all__ = ['Context'] # <<<<<<<<<<<<<<
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_Context);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Context);
+ __Pyx_GIVEREF(__pyx_n_s_Context);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/context.pyx":1
+ * """0MQ Context class.""" # <<<<<<<<<<<<<<
+ * # coding: utf-8
+ *
+ */
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython.context", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython.context");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AsString(kw_name));
+ #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ continue;
+ }
+ name = first_kw_arg;
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+ while (*name) {
+ if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**name, key)) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ if ((**argname == key) || (
+ (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**argname, key))) {
+ goto arg_passed_twice;
+ }
+ argname++;
+ }
+ }
+ } else
+ #endif
+ if (likely(PyUnicode_Check(key))) {
+ while (*name) {
+ int cmp = (**name == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**name, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ int cmp = (**argname == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**argname, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) goto arg_passed_twice;
+ argname++;
+ }
+ }
+ } else
+ goto invalid_keyword_type;
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, key);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_Restore(type, value, tb);
+#endif
+}
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+ CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
+ int full_traceback) {
+ PyObject *old_exc, *old_val, *old_tb;
+ PyObject *ctx;
+ __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+ if (full_traceback) {
+ Py_XINCREF(old_exc);
+ Py_XINCREF(old_val);
+ Py_XINCREF(old_tb);
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ PyErr_PrintEx(1);
+ }
+ #if PY_MAJOR_VERSION < 3
+ ctx = PyString_FromString(name);
+ #else
+ ctx = PyUnicode_FromString(name);
+ #endif
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ if (!ctx) {
+ PyErr_WriteUnraisable(Py_None);
+ } else {
+ PyErr_WriteUnraisable(ctx);
+ Py_DECREF(ctx);
+ }
+}
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+#else
+ PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000
+ PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+ PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+ if (!ob)
+ goto bad;
+ if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
+ goto bad;
+ Py_DECREF(ob);
+ return 0;
+bad:
+ Py_XDECREF(ob);
+ return -1;
+}
+
+static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
+ PyObject *result;
+ result = __Pyx_PyObject_GetAttrStr(nmspace, name);
+ if (!result)
+ result = __Pyx_GetModuleGlobalName(name);
+ return result;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
+ const size_t neg_one = (size_t) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(size_t) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (size_t) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(size_t) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(size_t) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong(x))
+ } else if (sizeof(size_t) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ size_t val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (size_t) -1;
+ }
+ } else {
+ size_t val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (size_t) -1;
+ val = __Pyx_PyInt_As_size_t(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to size_t");
+ return (size_t) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to size_t");
+ return (size_t) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+ PyObject *py_name = 0;
+ PyObject *py_module = 0;
+ py_name = __Pyx_PyIdentifier_FromString(name);
+ if (!py_name)
+ goto bad;
+ py_module = PyImport_Import(py_name);
+ Py_DECREF(py_name);
+ return py_module;
+bad:
+ Py_XDECREF(py_name);
+ return 0;
+}
+#endif
+
+#ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
+ size_t size, int strict)
+{
+ PyObject *py_module = 0;
+ PyObject *result = 0;
+ PyObject *py_name = 0;
+ char warning[200];
+ Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+ PyObject *py_basicsize;
+#endif
+ py_module = __Pyx_ImportModule(module_name);
+ if (!py_module)
+ goto bad;
+ py_name = __Pyx_PyIdentifier_FromString(class_name);
+ if (!py_name)
+ goto bad;
+ result = PyObject_GetAttr(py_module, py_name);
+ Py_DECREF(py_name);
+ py_name = 0;
+ Py_DECREF(py_module);
+ py_module = 0;
+ if (!result)
+ goto bad;
+ if (!PyType_Check(result)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s.%.200s is not a type object",
+ module_name, class_name);
+ goto bad;
+ }
+#ifndef Py_LIMITED_API
+ basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+ py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+ if (!py_basicsize)
+ goto bad;
+ basicsize = PyLong_AsSsize_t(py_basicsize);
+ Py_DECREF(py_basicsize);
+ py_basicsize = 0;
+ if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+ goto bad;
+#endif
+ if (!strict && (size_t)basicsize > size) {
+ PyOS_snprintf(warning, sizeof(warning),
+ "%s.%s size changed, may indicate binary incompatibility",
+ module_name, class_name);
+ if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
+ }
+ else if ((size_t)basicsize != size) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.%.200s has the wrong size, try recompiling",
+ module_name, class_name);
+ goto bad;
+ }
+ return (PyTypeObject *)result;
+bad:
+ Py_XDECREF(py_module);
+ Py_XDECREF(result);
+ return NULL;
+}
+#endif
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/zmq/backend/cython/context.pxd b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.pxd
index 9c9267a5..9c9267a5 100644
--- a/external_libs/python/zmq/backend/cython/context.pxd
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.pxd
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.pyx
new file mode 100644
index 00000000..2cb74091
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/context.pyx
@@ -0,0 +1,250 @@
+"""0MQ Context class."""
+# coding: utf-8
+
+# Copyright (c) PyZMQ Developers.
+# Distributed under the terms of the Lesser GNU Public License (LGPL).
+
+from libc.stdlib cimport free, malloc, realloc
+
+from libzmq cimport *
+
+cdef extern from "getpid_compat.h":
+ int getpid()
+
+from zmq.error import ZMQError, InterruptedSystemCall
+from zmq.backend.cython.checkrc cimport _check_rc
+
+
+_instance = None
+
+cdef class Context:
+ """Context(io_threads=1)
+
+ Manage the lifecycle of a 0MQ context.
+
+ Parameters
+ ----------
+ io_threads : int
+ The number of IO threads.
+ """
+
+ # no-op for the signature
+ def __init__(self, io_threads=1, shadow=0):
+ pass
+
+ def __cinit__(self, int io_threads=1, size_t shadow=0, **kwargs):
+ self.handle = NULL
+ self._sockets = NULL
+ if shadow:
+ self.handle = <void *>shadow
+ self._shadow = True
+ else:
+ self._shadow = False
+ if ZMQ_VERSION_MAJOR >= 3:
+ self.handle = zmq_ctx_new()
+ else:
+ self.handle = zmq_init(io_threads)
+
+ if self.handle == NULL:
+ raise ZMQError()
+
+ cdef int rc = 0
+ if ZMQ_VERSION_MAJOR >= 3 and not self._shadow:
+ rc = zmq_ctx_set(self.handle, ZMQ_IO_THREADS, io_threads)
+ _check_rc(rc)
+
+ self.closed = False
+ self._n_sockets = 0
+ self._max_sockets = 32
+
+ self._sockets = <void **>malloc(self._max_sockets*sizeof(void *))
+ if self._sockets == NULL:
+ raise MemoryError("Could not allocate _sockets array")
+
+ self._pid = getpid()
+
+ def __dealloc__(self):
+ """don't touch members in dealloc, just cleanup allocations"""
+ cdef int rc
+ if self._sockets != NULL:
+ free(self._sockets)
+ self._sockets = NULL
+ self._n_sockets = 0
+
+ # we can't call object methods in dealloc as it
+ # might already be partially deleted
+ if not self._shadow:
+ self._term()
+
+ cdef inline void _add_socket(self, void* handle):
+ """Add a socket handle to be closed when Context terminates.
+
+ This is to be called in the Socket constructor.
+ """
+ if self._n_sockets >= self._max_sockets:
+ self._max_sockets *= 2
+ self._sockets = <void **>realloc(self._sockets, self._max_sockets*sizeof(void *))
+ if self._sockets == NULL:
+ raise MemoryError("Could not reallocate _sockets array")
+
+ self._sockets[self._n_sockets] = handle
+ self._n_sockets += 1
+
+ cdef inline void _remove_socket(self, void* handle):
+ """Remove a socket from the collected handles.
+
+ This should be called by Socket.close, to prevent trying to
+ close a socket a second time.
+ """
+ cdef bint found = False
+
+ for idx in range(self._n_sockets):
+ if self._sockets[idx] == handle:
+ found=True
+ break
+
+ if found:
+ self._n_sockets -= 1
+ if self._n_sockets:
+ # move last handle to closed socket's index
+ self._sockets[idx] = self._sockets[self._n_sockets]
+
+
+ @property
+ def underlying(self):
+ """The address of the underlying libzmq context"""
+ return <size_t> self.handle
+
+ # backward-compat, though nobody is using it
+ _handle = underlying
+
+ cdef inline int _term(self):
+ cdef int rc=0
+ if self.handle != NULL and not self.closed and getpid() == self._pid:
+ with nogil:
+ rc = zmq_ctx_destroy(self.handle)
+ self.handle = NULL
+ return rc
+
+ def term(self):
+ """ctx.term()
+
+ Close or terminate the context.
+
+ This can be called to close the context by hand. If this is not called,
+ the context will automatically be closed when it is garbage collected.
+ """
+ cdef int rc=0
+ rc = self._term()
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ # ignore interrupted term
+ # see PEP 475 notes about close & EINTR for why
+ pass
+
+ self.closed = True
+
+ def set(self, int option, optval):
+ """ctx.set(option, optval)
+
+ Set a context option.
+
+ See the 0MQ API documentation for zmq_ctx_set
+ for details on specific options.
+
+ .. versionadded:: libzmq-3.2
+ .. versionadded:: 13.0
+
+ Parameters
+ ----------
+ option : int
+ The option to set. Available values will depend on your
+ version of libzmq. Examples include::
+
+ zmq.IO_THREADS, zmq.MAX_SOCKETS
+
+ optval : int
+ The value of the option to set.
+ """
+ cdef int optval_int_c
+ cdef int rc
+ cdef char* optval_c
+
+ if self.closed:
+ raise RuntimeError("Context has been destroyed")
+
+ if not isinstance(optval, int):
+ raise TypeError('expected int, got: %r' % optval)
+ optval_int_c = optval
+ rc = zmq_ctx_set(self.handle, option, optval_int_c)
+ _check_rc(rc)
+
+ def get(self, int option):
+ """ctx.get(option)
+
+ Get the value of a context option.
+
+ See the 0MQ API documentation for zmq_ctx_get
+ for details on specific options.
+
+ .. versionadded:: libzmq-3.2
+ .. versionadded:: 13.0
+
+ Parameters
+ ----------
+ option : int
+ The option to get. Available values will depend on your
+ version of libzmq. Examples include::
+
+ zmq.IO_THREADS, zmq.MAX_SOCKETS
+
+ Returns
+ -------
+ optval : int
+ The value of the option as an integer.
+ """
+ cdef int optval_int_c
+ cdef size_t sz
+ cdef int rc
+
+ if self.closed:
+ raise RuntimeError("Context has been destroyed")
+
+ rc = zmq_ctx_get(self.handle, option)
+ _check_rc(rc)
+
+ return rc
+
+ def destroy(self, linger=None):
+ """ctx.destroy(linger=None)
+
+ Close all sockets associated with this context, and then terminate
+ the context. If linger is specified,
+ the LINGER sockopt of the sockets will be set prior to closing.
+
+ .. warning::
+
+ destroy involves calling ``zmq_close()``, which is **NOT** threadsafe.
+ If there are active sockets in other threads, this must not be called.
+ """
+
+ cdef int linger_c
+ cdef bint setlinger=False
+
+ if linger is not None:
+ linger_c = linger
+ setlinger=True
+
+ if self.handle != NULL and not self.closed and self._n_sockets:
+ while self._n_sockets:
+ if setlinger:
+ zmq_setsockopt(self._sockets[0], ZMQ_LINGER, &linger_c, sizeof(int))
+ rc = zmq_close(self._sockets[0])
+ if rc < 0 and zmq_errno() != ZMQ_ENOTSOCK:
+ raise ZMQError()
+ self._n_sockets -= 1
+ self._sockets[0] = self._sockets[self._n_sockets]
+ self.term()
+
+__all__ = ['Context']
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/error.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/error.c
new file mode 100644
index 00000000..86e0d562
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/error.c
@@ -0,0 +1,1814 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython__error
+#define __PYX_HAVE_API__zmq__backend__cython__error
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/error.pyx",
+};
+
+/*--- Type declarations ---*/
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+#include <string.h>
+
+static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
+ const char* cstring, Py_ssize_t start, Py_ssize_t stop,
+ const char* encoding, const char* errors,
+ PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static int __Pyx_check_binary_version(void);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'zmq.backend.cython.error' */
+#define __Pyx_MODULE_NAME "zmq.backend.cython.error"
+int __pyx_module_is_main_zmq__backend__cython__error = 0;
+
+/* Implementation of 'zmq.backend.cython.error' */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5error_strerror(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_errno); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5error_2zmq_errno(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_bytes[] = "bytes";
+static char __pyx_k_errno[] = "errno";
+static char __pyx_k_str_e[] = "str_e";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_strerror[] = "strerror";
+static char __pyx_k_zmq_errno[] = "zmq_errno";
+static char __pyx_k_zmq_utils_strtypes[] = "zmq.utils.strtypes";
+static char __pyx_k_zmq_backend_cython_error[] = "zmq.backend.cython.error";
+static char __pyx_k_0MQ_Error_classes_and_functions[] = "0MQ Error classes and functions.";
+static char __pyx_k_private_tmp_pyzmq_release_zmq_b[] = "/private/tmp/pyzmq-release/zmq/backend/cython/error.pyx";
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_bytes;
+static PyObject *__pyx_n_s_errno;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_kp_s_private_tmp_pyzmq_release_zmq_b;
+static PyObject *__pyx_n_s_str_e;
+static PyObject *__pyx_n_s_strerror;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_zmq_backend_cython_error;
+static PyObject *__pyx_n_s_zmq_errno;
+static PyObject *__pyx_n_s_zmq_utils_strtypes;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_codeobj__2;
+static PyObject *__pyx_codeobj__3;
+
+/* "zmq/backend/cython/error.pyx":34
+ * from zmq.utils.strtypes import bytes
+ *
+ * def strerror(int errno): # <<<<<<<<<<<<<<
+ * """strerror(errno)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5error_1strerror(PyObject *__pyx_self, PyObject *__pyx_arg_errno); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_5error_strerror[] = "strerror(errno)\n\n Return the error string given the error number.\n ";
+static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_5error_1strerror = {"strerror", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5error_1strerror, METH_O, __pyx_doc_3zmq_7backend_6cython_5error_strerror};
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5error_1strerror(PyObject *__pyx_self, PyObject *__pyx_arg_errno) {
+ int __pyx_v_errno;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("strerror (wrapper)", 0);
+ assert(__pyx_arg_errno); {
+ __pyx_v_errno = __Pyx_PyInt_As_int(__pyx_arg_errno); if (unlikely((__pyx_v_errno == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.error.strerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5error_strerror(__pyx_self, ((int)__pyx_v_errno));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5error_strerror(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_errno) {
+ const char* __pyx_v_str_e;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("strerror", 0);
+
+ /* "zmq/backend/cython/error.pyx":41
+ * cdef const_char_ptr str_e
+ * # char * will be a bytes object:
+ * str_e = zmq_strerror(errno) # <<<<<<<<<<<<<<
+ * if str is bytes:
+ * # Python 2: str is bytes, so we already have the right type
+ */
+ __pyx_v_str_e = zmq_strerror(__pyx_v_errno);
+
+ /* "zmq/backend/cython/error.pyx":42
+ * # char * will be a bytes object:
+ * str_e = zmq_strerror(errno)
+ * if str is bytes: # <<<<<<<<<<<<<<
+ * # Python 2: str is bytes, so we already have the right type
+ * return str_e
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = (((PyObject*)(&PyString_Type)) == ((PyObject*)__pyx_t_1));
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/error.pyx":44
+ * if str is bytes:
+ * # Python 2: str is bytes, so we already have the right type
+ * return str_e # <<<<<<<<<<<<<<
+ * else:
+ * # Python 3: decode bytes to unicode str
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_str_e); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/error.pyx":47
+ * else:
+ * # Python 3: decode bytes to unicode str
+ * return str_e.decode() # <<<<<<<<<<<<<<
+ *
+ * def zmq_errno():
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_str_e, 0, strlen(__pyx_v_str_e), NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/error.pyx":34
+ * from zmq.utils.strtypes import bytes
+ *
+ * def strerror(int errno): # <<<<<<<<<<<<<<
+ * """strerror(errno)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.error.strerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/error.pyx":49
+ * return str_e.decode()
+ *
+ * def zmq_errno(): # <<<<<<<<<<<<<<
+ * """zmq_errno()
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5error_3zmq_errno(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_5error_2zmq_errno[] = "zmq_errno()\n \n Return the integer errno of the most recent zmq error.\n ";
+static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_5error_3zmq_errno = {"zmq_errno", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5error_3zmq_errno, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_5error_2zmq_errno};
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5error_3zmq_errno(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("zmq_errno (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5error_2zmq_errno(__pyx_self);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5error_2zmq_errno(CYTHON_UNUSED PyObject *__pyx_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("zmq_errno", 0);
+
+ /* "zmq/backend/cython/error.pyx":54
+ * Return the integer errno of the most recent zmq error.
+ * """
+ * return zmq_errno_c() # <<<<<<<<<<<<<<
+ *
+ * __all__ = ['strerror', 'zmq_errno']
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_From_int(zmq_errno()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/error.pyx":49
+ * return str_e.decode()
+ *
+ * def zmq_errno(): # <<<<<<<<<<<<<<
+ * """zmq_errno()
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.error.zmq_errno", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "error",
+ __pyx_k_0MQ_Error_classes_and_functions, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
+ {&__pyx_n_s_errno, __pyx_k_errno, sizeof(__pyx_k_errno), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_k_private_tmp_pyzmq_release_zmq_b, sizeof(__pyx_k_private_tmp_pyzmq_release_zmq_b), 0, 0, 1, 0},
+ {&__pyx_n_s_str_e, __pyx_k_str_e, sizeof(__pyx_k_str_e), 0, 0, 1, 1},
+ {&__pyx_n_s_strerror, __pyx_k_strerror, sizeof(__pyx_k_strerror), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_backend_cython_error, __pyx_k_zmq_backend_cython_error, sizeof(__pyx_k_zmq_backend_cython_error), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_errno, __pyx_k_zmq_errno, sizeof(__pyx_k_zmq_errno), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_utils_strtypes, __pyx_k_zmq_utils_strtypes, sizeof(__pyx_k_zmq_utils_strtypes), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ return 0;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "zmq/backend/cython/error.pyx":34
+ * from zmq.utils.strtypes import bytes
+ *
+ * def strerror(int errno): # <<<<<<<<<<<<<<
+ * """strerror(errno)
+ *
+ */
+ __pyx_tuple_ = PyTuple_Pack(3, __pyx_n_s_errno, __pyx_n_s_errno, __pyx_n_s_str_e); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+ __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_strerror, 34, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/error.pyx":49
+ * return str_e.decode()
+ *
+ * def zmq_errno(): # <<<<<<<<<<<<<<
+ * """zmq_errno()
+ *
+ */
+ __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_zmq_errno, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initerror(void); /*proto*/
+PyMODINIT_FUNC initerror(void)
+#else
+PyMODINIT_FUNC PyInit_error(void); /*proto*/
+PyMODINIT_FUNC PyInit_error(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_error(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("error", __pyx_methods, __pyx_k_0MQ_Error_classes_and_functions, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython__error) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython.error")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython.error", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ /*--- Type import code ---*/
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/error.pyx":32
+ * from libzmq cimport zmq_strerror, zmq_errno as zmq_errno_c
+ *
+ * from zmq.utils.strtypes import bytes # <<<<<<<<<<<<<<
+ *
+ * def strerror(int errno):
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_bytes);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_bytes);
+ __Pyx_GIVEREF(__pyx_n_s_bytes);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_zmq_utils_strtypes, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/error.pyx":34
+ * from zmq.utils.strtypes import bytes
+ *
+ * def strerror(int errno): # <<<<<<<<<<<<<<
+ * """strerror(errno)
+ *
+ */
+ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_5error_1strerror, NULL, __pyx_n_s_zmq_backend_cython_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_strerror, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/error.pyx":49
+ * return str_e.decode()
+ *
+ * def zmq_errno(): # <<<<<<<<<<<<<<
+ * """zmq_errno()
+ *
+ */
+ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_5error_3zmq_errno, NULL, __pyx_n_s_zmq_backend_cython_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_zmq_errno, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/error.pyx":56
+ * return zmq_errno_c()
+ *
+ * __all__ = ['strerror', 'zmq_errno'] # <<<<<<<<<<<<<<
+ */
+ __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_strerror);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_strerror);
+ __Pyx_GIVEREF(__pyx_n_s_strerror);
+ __Pyx_INCREF(__pyx_n_s_zmq_errno);
+ PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_zmq_errno);
+ __Pyx_GIVEREF(__pyx_n_s_zmq_errno);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/error.pyx":1
+ * """0MQ Error classes and functions.""" # <<<<<<<<<<<<<<
+ *
+ * #
+ */
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython.error");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
+ const char* cstring, Py_ssize_t start, Py_ssize_t stop,
+ const char* encoding, const char* errors,
+ PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
+ Py_ssize_t length;
+ if (unlikely((start < 0) | (stop < 0))) {
+ length = strlen(cstring);
+ if (start < 0) {
+ start += length;
+ if (start < 0)
+ start = 0;
+ }
+ if (stop < 0)
+ stop += length;
+ }
+ length = stop - start;
+ if (unlikely(length <= 0))
+ return PyUnicode_FromUnicode(NULL, 0);
+ cstring += start;
+ if (decode_func) {
+ return decode_func(cstring, length, errors);
+ } else {
+ return PyUnicode_Decode(cstring, length, encoding, errors);
+ }
+}
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/error.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/error.pyx
new file mode 100644
index 00000000..85e785f6
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/error.pyx
@@ -0,0 +1,56 @@
+"""0MQ Error classes and functions."""
+
+#
+# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+# allow const char*
+cdef extern from *:
+ ctypedef char* const_char_ptr "const char*"
+
+from libzmq cimport zmq_strerror, zmq_errno as zmq_errno_c
+
+from zmq.utils.strtypes import bytes
+
+def strerror(int errno):
+ """strerror(errno)
+
+ Return the error string given the error number.
+ """
+ cdef const_char_ptr str_e
+ # char * will be a bytes object:
+ str_e = zmq_strerror(errno)
+ if str is bytes:
+ # Python 2: str is bytes, so we already have the right type
+ return str_e
+ else:
+ # Python 3: decode bytes to unicode str
+ return str_e.decode()
+
+def zmq_errno():
+ """zmq_errno()
+
+ Return the integer errno of the most recent zmq error.
+ """
+ return zmq_errno_c()
+
+__all__ = ['strerror', 'zmq_errno']
diff --git a/external_libs/python/zmq/backend/cython/libzmq.pxd b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/libzmq.pxd
index e42f6d6b..e42f6d6b 100644
--- a/external_libs/python/zmq/backend/cython/libzmq.pxd
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/libzmq.pxd
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.c
new file mode 100644
index 00000000..374189be
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.c
@@ -0,0 +1,8243 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython__message
+#define __PYX_HAVE_API__zmq__backend__cython__message
+#include "string.h"
+#include "stdio.h"
+#include "pythread.h"
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#include "pyversion_compat.h"
+#include "stdlib.h"
+#include "errno.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/message.pyx",
+ "zmq/backend/cython/message.pxd",
+ "zmq/backend/cython/checkrc.pxd",
+ "zmq/utils/buffers.pxd",
+ "type.pxd",
+ "bool.pxd",
+ "complex.pxd",
+};
+
+/*--- Type declarations ---*/
+struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker;
+struct __pyx_obj_3zmq_7backend_6cython_7message_Frame;
+struct __pyx_t_3zmq_7backend_6cython_7message_zhint;
+typedef struct __pyx_t_3zmq_7backend_6cython_7message_zhint __pyx_t_3zmq_7backend_6cython_7message_zhint;
+
+/* "zmq/backend/cython/message.pyx":61
+ * #-----------------------------------------------------------------------------
+ *
+ * ctypedef struct zhint: # <<<<<<<<<<<<<<
+ * void *ctx
+ * size_t id
+ */
+struct __pyx_t_3zmq_7backend_6cython_7message_zhint {
+ void *ctx;
+ size_t id;
+};
+
+/* "zmq/backend/cython/message.pxd":34
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class MessageTracker(object): # <<<<<<<<<<<<<<
+ *
+ * cdef set events # Message Event objects to track.
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker {
+ PyObject_HEAD
+ PyObject *events;
+ PyObject *peers;
+};
+
+
+/* "zmq/backend/cython/message.pxd":40
+ *
+ *
+ * cdef class Frame: # <<<<<<<<<<<<<<
+ *
+ * cdef zmq_msg_t zmq_msg
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7message_Frame {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *__pyx_vtab;
+ zmq_msg_t zmq_msg;
+ PyObject *_data;
+ PyObject *_buffer;
+ PyObject *_bytes;
+ int _failed_init;
+ PyObject *tracker_event;
+ PyObject *tracker;
+ int more;
+};
+
+
+
+/* "zmq/backend/cython/message.pyx":111
+ * gc = None
+ *
+ * cdef class Frame: # <<<<<<<<<<<<<<
+ * """Frame(data=None, track=False)
+ *
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame {
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *(*fast_copy)(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *);
+ PyObject *(*_getbuffer)(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *__pyx_vtabptr_3zmq_7backend_6cython_7message_Frame;
+static PyObject *__pyx_f_3zmq_7backend_6cython_7message_5Frame__getbuffer(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *);
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+ const char* function_name);
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+ int lineno, const char *filename,
+ int full_traceback);
+
+#include <string.h>
+
+static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
+ const char* cstring, Py_ssize_t start, Py_ssize_t stop,
+ const char* encoding, const char* errors,
+ PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable);
+
+static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
+
+#ifndef __PYX_FORCE_INIT_THREADS
+ #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static int __Pyx_check_binary_version(void);
+
+#if !defined(__Pyx_PyIdentifier_FromString)
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
+#else
+ #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
+#endif
+#endif
+
+static PyObject *__Pyx_ImportModule(const char *name);
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+static struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_f_3zmq_7backend_6cython_7message_5Frame_fast_copy(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto*/
+static PyObject *__pyx_f_3zmq_7backend_6cython_7message_5Frame__getbuffer(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto*/
+
+/* Module declarations from 'cpython.version' */
+
+/* Module declarations from 'cpython.ref' */
+
+/* Module declarations from 'cpython.exc' */
+
+/* Module declarations from 'cpython.module' */
+
+/* Module declarations from 'cpython.mem' */
+
+/* Module declarations from 'cpython.tuple' */
+
+/* Module declarations from 'cpython.list' */
+
+/* Module declarations from 'libc.string' */
+
+/* Module declarations from 'libc.stdio' */
+
+/* Module declarations from 'cpython.object' */
+
+/* Module declarations from 'cpython.sequence' */
+
+/* Module declarations from 'cpython.mapping' */
+
+/* Module declarations from 'cpython.iterator' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
+
+/* Module declarations from 'cpython.number' */
+
+/* Module declarations from 'cpython.int' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.bool' */
+static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
+
+/* Module declarations from 'cpython.long' */
+
+/* Module declarations from 'cpython.float' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.complex' */
+static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
+
+/* Module declarations from 'cpython.string' */
+
+/* Module declarations from 'cpython.unicode' */
+
+/* Module declarations from 'cpython.dict' */
+
+/* Module declarations from 'cpython.instance' */
+
+/* Module declarations from 'cpython.function' */
+
+/* Module declarations from 'cpython.method' */
+
+/* Module declarations from 'cpython.weakref' */
+
+/* Module declarations from 'cpython.getargs' */
+
+/* Module declarations from 'cpython.pythread' */
+
+/* Module declarations from 'cpython.pystate' */
+
+/* Module declarations from 'cpython.cobject' */
+
+/* Module declarations from 'cpython.oldbuffer' */
+
+/* Module declarations from 'cpython.set' */
+
+/* Module declarations from 'cpython.buffer' */
+
+/* Module declarations from 'cpython.bytes' */
+
+/* Module declarations from 'cpython.pycapsule' */
+
+/* Module declarations from 'cpython' */
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'buffers' */
+static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void); /*proto*/
+static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void); /*proto*/
+static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *, int, int, void **, Py_ssize_t *, Py_ssize_t *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *, void **, Py_ssize_t *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *); /*proto*/
+
+/* Module declarations from 'libc.stdlib' */
+
+/* Module declarations from 'libc.errno' */
+
+/* Module declarations from 'zmq.backend.cython.checkrc' */
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int); /*proto*/
+
+/* Module declarations from 'zmq.backend.cython.message' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7message_MessageTracker = 0;
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7message_Frame = 0;
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_7message_copy_zmq_msg_bytes(zmq_msg_t *); /*proto*/
+static void __pyx_f_3zmq_7backend_6cython_7message_free_python_msg(void *, void *); /*proto*/
+#define __Pyx_MODULE_NAME "zmq.backend.cython.message"
+int __pyx_module_is_main_zmq__backend__cython__message = 0;
+
+/* Implementation of 'zmq.backend.cython.message' */
+static PyObject *__pyx_builtin_ImportError;
+static PyObject *__pyx_builtin_AttributeError;
+static PyObject *__pyx_builtin_property;
+static PyObject *__pyx_builtin_TypeError;
+static PyObject *__pyx_builtin_SystemError;
+static PyObject *__pyx_builtin_NotImplementedError;
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame___cinit__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_track, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_2__init__(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data, CYTHON_UNUSED PyObject *__pyx_v_track); /* proto */
+static void __pyx_pf_3zmq_7backend_6cython_7message_5Frame_4__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_6__getbuffer__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, Py_buffer *__pyx_v_buffer, CYTHON_UNUSED int __pyx_v_flags); /* proto */
+#if PY_MAJOR_VERSION < 3
+static Py_ssize_t __pyx_pf_3zmq_7backend_6cython_7message_5Frame_8__getsegcount__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, Py_ssize_t *__pyx_v_lenp); /* proto */
+#endif
+#if PY_MAJOR_VERSION < 3
+static Py_ssize_t __pyx_pf_3zmq_7backend_6cython_7message_5Frame_10__getreadbuffer__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p); /* proto */
+#endif
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_12__copy__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static Py_ssize_t __pyx_pf_3zmq_7backend_6cython_7message_5Frame_14__len__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_16__str__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_18buffer(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_20bytes(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_22set(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, int __pyx_v_option, int __pyx_v_value); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_24get(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_option); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event___get__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event_2__set__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event_4__del__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker___get__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker_2__set__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker_4__del__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_4more___get__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_4more_2__set__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_7message_MessageTracker(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_7message_Frame(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_B[] = "B";
+static char __pyx_k__7[] = "";
+static char __pyx_k_gc[] = "gc";
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_zmq[] = "zmq";
+static char __pyx_k_char[] = "char";
+static char __pyx_k_data[] = "data";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_time[] = "time";
+static char __pyx_k_utf8[] = "utf8";
+static char __pyx_k_Again[] = "Again";
+static char __pyx_k_Event[] = "Event";
+static char __pyx_k_Frame[] = "Frame";
+static char __pyx_k_ascii[] = "ascii";
+static char __pyx_k_bytes[] = "bytes";
+static char __pyx_k_dtype[] = "dtype";
+static char __pyx_k_store[] = "store";
+static char __pyx_k_track[] = "track";
+static char __pyx_k_value[] = "value";
+static char __pyx_k_buffer[] = "buffer";
+static char __pyx_k_decode[] = "decode";
+static char __pyx_k_encode[] = "encode";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_option[] = "option";
+static char __pyx_k_Event_2[] = "_Event";
+static char __pyx_k_Message[] = "Message";
+static char __pyx_k_context[] = "_context";
+static char __pyx_k_unicode[] = "unicode";
+static char __pyx_k_ZMQError[] = "ZMQError";
+static char __pyx_k_itemsize[] = "itemsize";
+static char __pyx_k_property[] = "property";
+static char __pyx_k_typecode[] = "typecode";
+static char __pyx_k_TypeError[] = "TypeError";
+static char __pyx_k_threading[] = "threading";
+static char __pyx_k_zmq_error[] = "zmq.error";
+static char __pyx_k_basestring[] = "basestring";
+static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static char __pyx_k_underlying[] = "underlying";
+static char __pyx_k_ImportError[] = "ImportError";
+static char __pyx_k_SystemError[] = "SystemError";
+static char __pyx_k_check_version[] = "_check_version";
+static char __pyx_k_AttributeError[] = "AttributeError";
+static char __pyx_k_MessageTracker[] = "MessageTracker";
+static char __pyx_k_ContextTerminated[] = "ContextTerminated";
+static char __pyx_k_zmq_utils_garbage[] = "zmq.utils.garbage";
+static char __pyx_k_expected_str_got_r[] = "expected str, got: %r";
+static char __pyx_k_inproc_pyzmq_gc_01[] = "inproc://pyzmq.gc.01";
+static char __pyx_k_zmq_utils_strtypes[] = "zmq.utils.strtypes";
+static char __pyx_k_NotImplementedError[] = "NotImplementedError";
+static char __pyx_k_InterruptedSystemCall[] = "InterruptedSystemCall";
+static char __pyx_k_get_string_properties[] = "get string properties";
+static char __pyx_k_pyzmq_gc_send_failed_s[] = "pyzmq-gc send failed: %s\n";
+static char __pyx_k_pyzmq_gc_connect_failed_s[] = "pyzmq-gc connect failed: %s\n";
+static char __pyx_k_0MQ_Message_related_classes[] = "0MQ Message related classes.";
+static char __pyx_k_Old_style_buffers_not_available[] = "Old style buffers not available.";
+static char __pyx_k_r_does_not_provide_a_buffer_int[] = "%r does not provide a buffer interface.";
+static char __pyx_k_Unicode_objects_not_allowed_Only[] = "Unicode objects not allowed. Only: str/bytes, buffer interfaces.";
+static char __pyx_k_accessing_non_existent_buffer_se[] = "accessing non-existent buffer segment";
+static PyObject *__pyx_n_s_Again;
+static PyObject *__pyx_n_s_AttributeError;
+static PyObject *__pyx_n_b_B;
+static PyObject *__pyx_n_s_ContextTerminated;
+static PyObject *__pyx_n_s_Event;
+static PyObject *__pyx_n_s_Event_2;
+static PyObject *__pyx_n_s_Frame;
+static PyObject *__pyx_n_s_ImportError;
+static PyObject *__pyx_n_s_InterruptedSystemCall;
+static PyObject *__pyx_n_s_Message;
+static PyObject *__pyx_n_s_MessageTracker;
+static PyObject *__pyx_n_s_NotImplementedError;
+static PyObject *__pyx_kp_s_Old_style_buffers_not_available;
+static PyObject *__pyx_n_s_SystemError;
+static PyObject *__pyx_n_s_TypeError;
+static PyObject *__pyx_kp_s_Unicode_objects_not_allowed_Only;
+static PyObject *__pyx_n_s_ZMQError;
+static PyObject *__pyx_kp_s__7;
+static PyObject *__pyx_kp_s_accessing_non_existent_buffer_se;
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_ascii;
+static PyObject *__pyx_n_s_basestring;
+static PyObject *__pyx_n_s_buffer;
+static PyObject *__pyx_n_s_bytes;
+static PyObject *__pyx_n_s_char;
+static PyObject *__pyx_n_s_check_version;
+static PyObject *__pyx_n_s_context;
+static PyObject *__pyx_n_s_data;
+static PyObject *__pyx_n_s_decode;
+static PyObject *__pyx_n_s_dtype;
+static PyObject *__pyx_n_s_encode;
+static PyObject *__pyx_kp_s_expected_str_got_r;
+static PyObject *__pyx_n_s_gc;
+static PyObject *__pyx_kp_s_get_string_properties;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_itemsize;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_option;
+static PyObject *__pyx_n_s_property;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_kp_s_r_does_not_provide_a_buffer_int;
+static PyObject *__pyx_n_s_store;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_threading;
+static PyObject *__pyx_n_s_time;
+static PyObject *__pyx_n_s_track;
+static PyObject *__pyx_n_s_typecode;
+static PyObject *__pyx_n_s_underlying;
+static PyObject *__pyx_n_s_unicode;
+static PyObject *__pyx_n_s_utf8;
+static PyObject *__pyx_n_s_value;
+static PyObject *__pyx_n_s_zmq;
+static PyObject *__pyx_n_s_zmq_error;
+static PyObject *__pyx_n_s_zmq_utils_garbage;
+static PyObject *__pyx_n_s_zmq_utils_strtypes;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_4;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__2;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__4;
+static PyObject *__pyx_tuple__5;
+static PyObject *__pyx_tuple__6;
+static PyObject *__pyx_tuple__8;
+
+/* "zmq/backend/cython/message.pyx":65
+ * size_t id
+ *
+ * cdef void free_python_msg(void *data, void *vhint) nogil: # <<<<<<<<<<<<<<
+ * """A pure-C function for DECREF'ing Python-owned message data.
+ *
+ */
+
+static void __pyx_f_3zmq_7backend_6cython_7message_free_python_msg(CYTHON_UNUSED void *__pyx_v_data, void *__pyx_v_vhint) {
+ void *__pyx_v_push;
+ zmq_msg_t __pyx_v_msg;
+ __pyx_t_3zmq_7backend_6cython_7message_zhint *__pyx_v_hint;
+ int __pyx_v_rc;
+ int __pyx_t_1;
+
+ /* "zmq/backend/cython/message.pyx":87
+ * cdef void *push
+ * cdef zmq_msg_t msg
+ * cdef zhint *hint = <zhint *> vhint # <<<<<<<<<<<<<<
+ * if hint != NULL:
+ * zmq_msg_init_size(&msg, sizeof(size_t))
+ */
+ __pyx_v_hint = ((__pyx_t_3zmq_7backend_6cython_7message_zhint *)__pyx_v_vhint);
+
+ /* "zmq/backend/cython/message.pyx":88
+ * cdef zmq_msg_t msg
+ * cdef zhint *hint = <zhint *> vhint
+ * if hint != NULL: # <<<<<<<<<<<<<<
+ * zmq_msg_init_size(&msg, sizeof(size_t))
+ * memcpy(zmq_msg_data(&msg), &hint.id, sizeof(size_t))
+ */
+ __pyx_t_1 = ((__pyx_v_hint != NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":89
+ * cdef zhint *hint = <zhint *> vhint
+ * if hint != NULL:
+ * zmq_msg_init_size(&msg, sizeof(size_t)) # <<<<<<<<<<<<<<
+ * memcpy(zmq_msg_data(&msg), &hint.id, sizeof(size_t))
+ *
+ */
+ zmq_msg_init_size((&__pyx_v_msg), (sizeof(size_t)));
+
+ /* "zmq/backend/cython/message.pyx":90
+ * if hint != NULL:
+ * zmq_msg_init_size(&msg, sizeof(size_t))
+ * memcpy(zmq_msg_data(&msg), &hint.id, sizeof(size_t)) # <<<<<<<<<<<<<<
+ *
+ * push = zmq_socket(hint.ctx, ZMQ_PUSH)
+ */
+ memcpy(zmq_msg_data((&__pyx_v_msg)), (&__pyx_v_hint->id), (sizeof(size_t)));
+
+ /* "zmq/backend/cython/message.pyx":92
+ * memcpy(zmq_msg_data(&msg), &hint.id, sizeof(size_t))
+ *
+ * push = zmq_socket(hint.ctx, ZMQ_PUSH) # <<<<<<<<<<<<<<
+ * if push == NULL:
+ * # this will happen if the context has been terminated
+ */
+ __pyx_v_push = zmq_socket(__pyx_v_hint->ctx, ZMQ_PUSH);
+
+ /* "zmq/backend/cython/message.pyx":93
+ *
+ * push = zmq_socket(hint.ctx, ZMQ_PUSH)
+ * if push == NULL: # <<<<<<<<<<<<<<
+ * # this will happen if the context has been terminated
+ * return
+ */
+ __pyx_t_1 = ((__pyx_v_push == NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":95
+ * if push == NULL:
+ * # this will happen if the context has been terminated
+ * return # <<<<<<<<<<<<<<
+ * rc = zmq_connect(push, "inproc://pyzmq.gc.01")
+ * if rc < 0:
+ */
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/message.pyx":96
+ * # this will happen if the context has been terminated
+ * return
+ * rc = zmq_connect(push, "inproc://pyzmq.gc.01") # <<<<<<<<<<<<<<
+ * if rc < 0:
+ * fprintf(cstderr, "pyzmq-gc connect failed: %s\n", zmq_strerror(zmq_errno()))
+ */
+ __pyx_v_rc = zmq_connect(__pyx_v_push, __pyx_k_inproc_pyzmq_gc_01);
+
+ /* "zmq/backend/cython/message.pyx":97
+ * return
+ * rc = zmq_connect(push, "inproc://pyzmq.gc.01")
+ * if rc < 0: # <<<<<<<<<<<<<<
+ * fprintf(cstderr, "pyzmq-gc connect failed: %s\n", zmq_strerror(zmq_errno()))
+ * return
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":98
+ * rc = zmq_connect(push, "inproc://pyzmq.gc.01")
+ * if rc < 0:
+ * fprintf(cstderr, "pyzmq-gc connect failed: %s\n", zmq_strerror(zmq_errno())) # <<<<<<<<<<<<<<
+ * return
+ *
+ */
+ fprintf(stderr, __pyx_k_pyzmq_gc_connect_failed_s, zmq_strerror(zmq_errno()));
+
+ /* "zmq/backend/cython/message.pyx":99
+ * if rc < 0:
+ * fprintf(cstderr, "pyzmq-gc connect failed: %s\n", zmq_strerror(zmq_errno()))
+ * return # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_msg_send(&msg, push, 0)
+ */
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/message.pyx":101
+ * return
+ *
+ * rc = zmq_msg_send(&msg, push, 0) # <<<<<<<<<<<<<<
+ * if rc < 0:
+ * fprintf(cstderr, "pyzmq-gc send failed: %s\n", zmq_strerror(zmq_errno()))
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_msg), __pyx_v_push, 0);
+
+ /* "zmq/backend/cython/message.pyx":102
+ *
+ * rc = zmq_msg_send(&msg, push, 0)
+ * if rc < 0: # <<<<<<<<<<<<<<
+ * fprintf(cstderr, "pyzmq-gc send failed: %s\n", zmq_strerror(zmq_errno()))
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":103
+ * rc = zmq_msg_send(&msg, push, 0)
+ * if rc < 0:
+ * fprintf(cstderr, "pyzmq-gc send failed: %s\n", zmq_strerror(zmq_errno())) # <<<<<<<<<<<<<<
+ *
+ * zmq_msg_close(&msg)
+ */
+ fprintf(stderr, __pyx_k_pyzmq_gc_send_failed_s, zmq_strerror(zmq_errno()));
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "zmq/backend/cython/message.pyx":105
+ * fprintf(cstderr, "pyzmq-gc send failed: %s\n", zmq_strerror(zmq_errno()))
+ *
+ * zmq_msg_close(&msg) # <<<<<<<<<<<<<<
+ * zmq_close(push)
+ * free(hint)
+ */
+ zmq_msg_close((&__pyx_v_msg));
+
+ /* "zmq/backend/cython/message.pyx":106
+ *
+ * zmq_msg_close(&msg)
+ * zmq_close(push) # <<<<<<<<<<<<<<
+ * free(hint)
+ *
+ */
+ zmq_close(__pyx_v_push);
+
+ /* "zmq/backend/cython/message.pyx":107
+ * zmq_msg_close(&msg)
+ * zmq_close(push)
+ * free(hint) # <<<<<<<<<<<<<<
+ *
+ * gc = None
+ */
+ free(__pyx_v_hint);
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/message.pyx":65
+ * size_t id
+ *
+ * cdef void free_python_msg(void *data, void *vhint) nogil: # <<<<<<<<<<<<<<
+ * """A pure-C function for DECREF'ing Python-owned message data.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+}
+
+/* "zmq/backend/cython/message.pyx":138
+ * """
+ *
+ * def __cinit__(self, object data=None, track=False, **kwargs): # <<<<<<<<<<<<<<
+ * cdef int rc
+ * cdef char *data_c = NULL
+ */
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_data = 0;
+ PyObject *__pyx_v_track = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
+ __Pyx_GOTREF(__pyx_v_kwargs);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_track,0};
+ PyObject* values[2] = {0,0};
+ values[0] = ((PyObject *)Py_None);
+ values[1] = ((PyObject *)Py_False);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_track);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_data = values[0];
+ __pyx_v_track = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame___cinit__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), __pyx_v_data, __pyx_v_track, __pyx_v_kwargs);
+
+ /* function exit code */
+ __Pyx_XDECREF(__pyx_v_kwargs);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame___cinit__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_track, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
+ int __pyx_v_rc;
+ char *__pyx_v_data_c;
+ Py_ssize_t __pyx_v_data_len_c;
+ __pyx_t_3zmq_7backend_6cython_7message_zhint *__pyx_v_hint;
+ PyObject *__pyx_v_evt = NULL;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ Py_ssize_t __pyx_t_8;
+ size_t __pyx_t_9;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "zmq/backend/cython/message.pyx":140
+ * def __cinit__(self, object data=None, track=False, **kwargs):
+ * cdef int rc
+ * cdef char *data_c = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t data_len_c=0
+ * cdef zhint *hint
+ */
+ __pyx_v_data_c = NULL;
+
+ /* "zmq/backend/cython/message.pyx":141
+ * cdef int rc
+ * cdef char *data_c = NULL
+ * cdef Py_ssize_t data_len_c=0 # <<<<<<<<<<<<<<
+ * cdef zhint *hint
+ *
+ */
+ __pyx_v_data_len_c = 0;
+
+ /* "zmq/backend/cython/message.pyx":145
+ *
+ * # init more as False
+ * self.more = False # <<<<<<<<<<<<<<
+ *
+ * # Save the data object in case the user wants the the data as a str.
+ */
+ __pyx_v_self->more = 0;
+
+ /* "zmq/backend/cython/message.pyx":148
+ *
+ * # Save the data object in case the user wants the the data as a str.
+ * self._data = data # <<<<<<<<<<<<<<
+ * self._failed_init = True # bool switch for dealloc
+ * self._buffer = None # buffer view of data
+ */
+ __Pyx_INCREF(__pyx_v_data);
+ __Pyx_GIVEREF(__pyx_v_data);
+ __Pyx_GOTREF(__pyx_v_self->_data);
+ __Pyx_DECREF(__pyx_v_self->_data);
+ __pyx_v_self->_data = __pyx_v_data;
+
+ /* "zmq/backend/cython/message.pyx":149
+ * # Save the data object in case the user wants the the data as a str.
+ * self._data = data
+ * self._failed_init = True # bool switch for dealloc # <<<<<<<<<<<<<<
+ * self._buffer = None # buffer view of data
+ * self._bytes = None # bytes copy of data
+ */
+ __pyx_v_self->_failed_init = 1;
+
+ /* "zmq/backend/cython/message.pyx":150
+ * self._data = data
+ * self._failed_init = True # bool switch for dealloc
+ * self._buffer = None # buffer view of data # <<<<<<<<<<<<<<
+ * self._bytes = None # bytes copy of data
+ *
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->_buffer);
+ __Pyx_DECREF(__pyx_v_self->_buffer);
+ __pyx_v_self->_buffer = Py_None;
+
+ /* "zmq/backend/cython/message.pyx":151
+ * self._failed_init = True # bool switch for dealloc
+ * self._buffer = None # buffer view of data
+ * self._bytes = None # bytes copy of data # <<<<<<<<<<<<<<
+ *
+ * # Event and MessageTracker for monitoring when zmq is done with data:
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->_bytes);
+ __Pyx_DECREF(__pyx_v_self->_bytes);
+ __pyx_v_self->_bytes = Py_None;
+
+ /* "zmq/backend/cython/message.pyx":154
+ *
+ * # Event and MessageTracker for monitoring when zmq is done with data:
+ * if track: # <<<<<<<<<<<<<<
+ * evt = Event()
+ * self.tracker_event = evt
+ */
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_track); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":155
+ * # Event and MessageTracker for monitoring when zmq is done with data:
+ * if track:
+ * evt = Event() # <<<<<<<<<<<<<<
+ * self.tracker_event = evt
+ * self.tracker = zmq.MessageTracker(evt)
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Event); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_evt = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/message.pyx":156
+ * if track:
+ * evt = Event()
+ * self.tracker_event = evt # <<<<<<<<<<<<<<
+ * self.tracker = zmq.MessageTracker(evt)
+ * else:
+ */
+ __Pyx_INCREF(__pyx_v_evt);
+ __Pyx_GIVEREF(__pyx_v_evt);
+ __Pyx_GOTREF(__pyx_v_self->tracker_event);
+ __Pyx_DECREF(__pyx_v_self->tracker_event);
+ __pyx_v_self->tracker_event = __pyx_v_evt;
+
+ /* "zmq/backend/cython/message.pyx":157
+ * evt = Event()
+ * self.tracker_event = evt
+ * self.tracker = zmq.MessageTracker(evt) # <<<<<<<<<<<<<<
+ * else:
+ * self.tracker_event = None
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_MessageTracker); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_evt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_v_evt);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_evt);
+ __Pyx_GIVEREF(__pyx_v_evt);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GIVEREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_v_self->tracker);
+ __Pyx_DECREF(__pyx_v_self->tracker);
+ __pyx_v_self->tracker = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/message.pyx":159
+ * self.tracker = zmq.MessageTracker(evt)
+ * else:
+ * self.tracker_event = None # <<<<<<<<<<<<<<
+ * self.tracker = None
+ *
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->tracker_event);
+ __Pyx_DECREF(__pyx_v_self->tracker_event);
+ __pyx_v_self->tracker_event = Py_None;
+
+ /* "zmq/backend/cython/message.pyx":160
+ * else:
+ * self.tracker_event = None
+ * self.tracker = None # <<<<<<<<<<<<<<
+ *
+ * if isinstance(data, unicode):
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->tracker);
+ __Pyx_DECREF(__pyx_v_self->tracker);
+ __pyx_v_self->tracker = Py_None;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/message.pyx":162
+ * self.tracker = None
+ *
+ * if isinstance(data, unicode): # <<<<<<<<<<<<<<
+ * raise TypeError("Unicode objects not allowed. Only: str/bytes, buffer interfaces.")
+ *
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyObject_IsInstance(__pyx_v_data, __pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = (__pyx_t_1 != 0);
+ if (__pyx_t_6) {
+
+ /* "zmq/backend/cython/message.pyx":163
+ *
+ * if isinstance(data, unicode):
+ * raise TypeError("Unicode objects not allowed. Only: str/bytes, buffer interfaces.") # <<<<<<<<<<<<<<
+ *
+ * if data is None:
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/message.pyx":165
+ * raise TypeError("Unicode objects not allowed. Only: str/bytes, buffer interfaces.")
+ *
+ * if data is None: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_init(&self.zmq_msg)
+ * _check_rc(rc)
+ */
+ __pyx_t_6 = (__pyx_v_data == Py_None);
+ __pyx_t_1 = (__pyx_t_6 != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":166
+ *
+ * if data is None:
+ * rc = zmq_msg_init(&self.zmq_msg) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * self._failed_init = False
+ */
+ __pyx_v_rc = zmq_msg_init((&__pyx_v_self->zmq_msg));
+
+ /* "zmq/backend/cython/message.pyx":167
+ * if data is None:
+ * rc = zmq_msg_init(&self.zmq_msg)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * self._failed_init = False
+ * return
+ */
+ __pyx_t_7 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/message.pyx":168
+ * rc = zmq_msg_init(&self.zmq_msg)
+ * _check_rc(rc)
+ * self._failed_init = False # <<<<<<<<<<<<<<
+ * return
+ * else:
+ */
+ __pyx_v_self->_failed_init = 0;
+
+ /* "zmq/backend/cython/message.pyx":169
+ * _check_rc(rc)
+ * self._failed_init = False
+ * return # <<<<<<<<<<<<<<
+ * else:
+ * asbuffer_r(data, <void **>&data_c, &data_len_c)
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/message.pyx":171
+ * return
+ * else:
+ * asbuffer_r(data, <void **>&data_c, &data_len_c) # <<<<<<<<<<<<<<
+ *
+ * # create the hint for zmq_free_fn
+ */
+ __pyx_t_2 = __pyx_f_7buffers_asbuffer_r(__pyx_v_data, ((void **)(&__pyx_v_data_c)), (&__pyx_v_data_len_c)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ }
+
+ /* "zmq/backend/cython/message.pyx":177
+ * # allows libzmq to signal to Python when it is done with Python-owned memory.
+ * global gc
+ * if gc is None: # <<<<<<<<<<<<<<
+ * from zmq.utils.garbage import gc
+ *
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = (__pyx_t_2 == Py_None);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = (__pyx_t_1 != 0);
+ if (__pyx_t_6) {
+
+ /* "zmq/backend/cython/message.pyx":178
+ * global gc
+ * if gc is None:
+ * from zmq.utils.garbage import gc # <<<<<<<<<<<<<<
+ *
+ * hint = <zhint *> malloc(sizeof(zhint))
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_gc);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_gc);
+ __Pyx_GIVEREF(__pyx_n_s_gc);
+ __pyx_t_4 = __Pyx_Import(__pyx_n_s_zmq_utils_garbage, __pyx_t_2, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_gc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_gc, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "zmq/backend/cython/message.pyx":180
+ * from zmq.utils.garbage import gc
+ *
+ * hint = <zhint *> malloc(sizeof(zhint)) # <<<<<<<<<<<<<<
+ * hint.id = gc.store(data, self.tracker_event)
+ * hint.ctx = <void *> <size_t> gc._context.underlying
+ */
+ __pyx_v_hint = ((__pyx_t_3zmq_7backend_6cython_7message_zhint *)malloc((sizeof(__pyx_t_3zmq_7backend_6cython_7message_zhint))));
+
+ /* "zmq/backend/cython/message.pyx":181
+ *
+ * hint = <zhint *> malloc(sizeof(zhint))
+ * hint.id = gc.store(data, self.tracker_event) # <<<<<<<<<<<<<<
+ * hint.ctx = <void *> <size_t> gc._context.underlying
+ *
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_store); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_2) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_data);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_v_data);
+ __Pyx_GIVEREF(__pyx_v_data);
+ __Pyx_INCREF(__pyx_v_self->tracker_event);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_v_self->tracker_event);
+ __Pyx_GIVEREF(__pyx_v_self->tracker_event);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_hint->id = __pyx_t_9;
+
+ /* "zmq/backend/cython/message.pyx":182
+ * hint = <zhint *> malloc(sizeof(zhint))
+ * hint.id = gc.store(data, self.tracker_event)
+ * hint.ctx = <void *> <size_t> gc._context.underlying # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_msg_init_data(
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_gc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_context); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_underlying); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_hint->ctx = ((void *)((size_t)__pyx_t_9));
+
+ /* "zmq/backend/cython/message.pyx":184
+ * hint.ctx = <void *> <size_t> gc._context.underlying
+ *
+ * rc = zmq_msg_init_data( # <<<<<<<<<<<<<<
+ * &self.zmq_msg, <void *>data_c, data_len_c,
+ * <zmq_free_fn *>free_python_msg, <void *>hint
+ */
+ __pyx_v_rc = zmq_msg_init_data((&__pyx_v_self->zmq_msg), ((void *)__pyx_v_data_c), __pyx_v_data_len_c, ((zmq_free_fn *)__pyx_f_3zmq_7backend_6cython_7message_free_python_msg), ((void *)__pyx_v_hint));
+
+ /* "zmq/backend/cython/message.pyx":188
+ * <zmq_free_fn *>free_python_msg, <void *>hint
+ * )
+ * if rc != 0: # <<<<<<<<<<<<<<
+ * free(hint)
+ * _check_rc(rc)
+ */
+ __pyx_t_6 = ((__pyx_v_rc != 0) != 0);
+ if (__pyx_t_6) {
+
+ /* "zmq/backend/cython/message.pyx":189
+ * )
+ * if rc != 0:
+ * free(hint) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * self._failed_init = False
+ */
+ free(__pyx_v_hint);
+
+ /* "zmq/backend/cython/message.pyx":190
+ * if rc != 0:
+ * free(hint)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * self._failed_init = False
+ *
+ */
+ __pyx_t_7 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "zmq/backend/cython/message.pyx":191
+ * free(hint)
+ * _check_rc(rc)
+ * self._failed_init = False # <<<<<<<<<<<<<<
+ *
+ * def __init__(self, object data=None, track=False):
+ */
+ __pyx_v_self->_failed_init = 0;
+
+ /* "zmq/backend/cython/message.pyx":138
+ * """
+ *
+ * def __cinit__(self, object data=None, track=False, **kwargs): # <<<<<<<<<<<<<<
+ * cdef int rc
+ * cdef char *data_c = NULL
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_evt);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":193
+ * self._failed_init = False
+ *
+ * def __init__(self, object data=None, track=False): # <<<<<<<<<<<<<<
+ * """Enforce signature"""
+ * pass
+ */
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7message_5Frame_2__init__[] = "Enforce signature";
+#if CYTHON_COMPILING_IN_CPYTHON
+struct wrapperbase __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_2__init__;
+#endif
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ CYTHON_UNUSED PyObject *__pyx_v_data = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_track = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_track,0};
+ PyObject* values[2] = {0,0};
+ values[0] = ((PyObject *)Py_None);
+ values[1] = ((PyObject *)Py_False);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_track);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_data = values[0];
+ __pyx_v_track = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_2__init__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), __pyx_v_data, __pyx_v_track);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_2__init__(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data, CYTHON_UNUSED PyObject *__pyx_v_track) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__", 0);
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":197
+ * pass
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * cdef int rc
+ * if self._failed_init:
+ */
+
+/* Python wrapper */
+static void __pyx_pw_3zmq_7backend_6cython_7message_5Frame_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_3zmq_7backend_6cython_7message_5Frame_5__dealloc__(PyObject *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_pf_3zmq_7backend_6cython_7message_5Frame_4__dealloc__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_pf_3zmq_7backend_6cython_7message_5Frame_4__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ int __pyx_v_rc;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__dealloc__", 0);
+
+ /* "zmq/backend/cython/message.pyx":199
+ * def __dealloc__(self):
+ * cdef int rc
+ * if self._failed_init: # <<<<<<<<<<<<<<
+ * return
+ * # This simply decreases the 0MQ ref-count of zmq_msg.
+ */
+ __pyx_t_1 = (__pyx_v_self->_failed_init != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":200
+ * cdef int rc
+ * if self._failed_init:
+ * return # <<<<<<<<<<<<<<
+ * # This simply decreases the 0MQ ref-count of zmq_msg.
+ * with nogil:
+ */
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/message.pyx":202
+ * return
+ * # This simply decreases the 0MQ ref-count of zmq_msg.
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_close(&self.zmq_msg)
+ * _check_rc(rc)
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/message.pyx":203
+ * # This simply decreases the 0MQ ref-count of zmq_msg.
+ * with nogil:
+ * rc = zmq_msg_close(&self.zmq_msg) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_msg_close((&__pyx_v_self->zmq_msg));
+ }
+
+ /* "zmq/backend/cython/message.pyx":202
+ * return
+ * # This simply decreases the 0MQ ref-count of zmq_msg.
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_close(&self.zmq_msg)
+ * _check_rc(rc)
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+ }
+ }
+
+ /* "zmq/backend/cython/message.pyx":204
+ * with nogil:
+ * rc = zmq_msg_close(&self.zmq_msg)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * # buffer interface code adapted from petsc4py by Lisandro Dalcin, a BSD project
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/message.pyx":197
+ * pass
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * cdef int rc
+ * if self._failed_init:
+ */
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_WriteUnraisable("zmq.backend.cython.message.Frame.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "zmq/backend/cython/message.pyx":208
+ * # buffer interface code adapted from petsc4py by Lisandro Dalcin, a BSD project
+ *
+ * def __getbuffer__(self, Py_buffer* buffer, int flags): # <<<<<<<<<<<<<<
+ * # new-style (memoryview) buffer interface
+ * buffer.buf = zmq_msg_data(&self.zmq_msg)
+ */
+
+/* Python wrapper */
+static CYTHON_UNUSED int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_6__getbuffer__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer), ((int)__pyx_v_flags));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_6__getbuffer__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, Py_buffer *__pyx_v_buffer, CYTHON_UNUSED int __pyx_v_flags) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getbuffer__", 0);
+ if (__pyx_v_buffer != NULL) {
+ __pyx_v_buffer->obj = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(__pyx_v_buffer->obj);
+ }
+
+ /* "zmq/backend/cython/message.pyx":210
+ * def __getbuffer__(self, Py_buffer* buffer, int flags):
+ * # new-style (memoryview) buffer interface
+ * buffer.buf = zmq_msg_data(&self.zmq_msg) # <<<<<<<<<<<<<<
+ * buffer.len = zmq_msg_size(&self.zmq_msg)
+ *
+ */
+ __pyx_v_buffer->buf = zmq_msg_data((&__pyx_v_self->zmq_msg));
+
+ /* "zmq/backend/cython/message.pyx":211
+ * # new-style (memoryview) buffer interface
+ * buffer.buf = zmq_msg_data(&self.zmq_msg)
+ * buffer.len = zmq_msg_size(&self.zmq_msg) # <<<<<<<<<<<<<<
+ *
+ * buffer.obj = self
+ */
+ __pyx_v_buffer->len = zmq_msg_size((&__pyx_v_self->zmq_msg));
+
+ /* "zmq/backend/cython/message.pyx":213
+ * buffer.len = zmq_msg_size(&self.zmq_msg)
+ *
+ * buffer.obj = self # <<<<<<<<<<<<<<
+ * buffer.readonly = 1
+ * buffer.format = "B"
+ */
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+ __Pyx_GOTREF(__pyx_v_buffer->obj);
+ __Pyx_DECREF(__pyx_v_buffer->obj);
+ __pyx_v_buffer->obj = ((PyObject *)__pyx_v_self);
+
+ /* "zmq/backend/cython/message.pyx":214
+ *
+ * buffer.obj = self
+ * buffer.readonly = 1 # <<<<<<<<<<<<<<
+ * buffer.format = "B"
+ * buffer.ndim = 1
+ */
+ __pyx_v_buffer->readonly = 1;
+
+ /* "zmq/backend/cython/message.pyx":215
+ * buffer.obj = self
+ * buffer.readonly = 1
+ * buffer.format = "B" # <<<<<<<<<<<<<<
+ * buffer.ndim = 1
+ * buffer.shape = &(buffer.len)
+ */
+ __pyx_v_buffer->format = __pyx_k_B;
+
+ /* "zmq/backend/cython/message.pyx":216
+ * buffer.readonly = 1
+ * buffer.format = "B"
+ * buffer.ndim = 1 # <<<<<<<<<<<<<<
+ * buffer.shape = &(buffer.len)
+ * buffer.strides = NULL
+ */
+ __pyx_v_buffer->ndim = 1;
+
+ /* "zmq/backend/cython/message.pyx":217
+ * buffer.format = "B"
+ * buffer.ndim = 1
+ * buffer.shape = &(buffer.len) # <<<<<<<<<<<<<<
+ * buffer.strides = NULL
+ * buffer.suboffsets = NULL
+ */
+ __pyx_v_buffer->shape = (&__pyx_v_buffer->len);
+
+ /* "zmq/backend/cython/message.pyx":218
+ * buffer.ndim = 1
+ * buffer.shape = &(buffer.len)
+ * buffer.strides = NULL # <<<<<<<<<<<<<<
+ * buffer.suboffsets = NULL
+ * buffer.itemsize = 1
+ */
+ __pyx_v_buffer->strides = NULL;
+
+ /* "zmq/backend/cython/message.pyx":219
+ * buffer.shape = &(buffer.len)
+ * buffer.strides = NULL
+ * buffer.suboffsets = NULL # <<<<<<<<<<<<<<
+ * buffer.itemsize = 1
+ * buffer.internal = NULL
+ */
+ __pyx_v_buffer->suboffsets = NULL;
+
+ /* "zmq/backend/cython/message.pyx":220
+ * buffer.strides = NULL
+ * buffer.suboffsets = NULL
+ * buffer.itemsize = 1 # <<<<<<<<<<<<<<
+ * buffer.internal = NULL
+ *
+ */
+ __pyx_v_buffer->itemsize = 1;
+
+ /* "zmq/backend/cython/message.pyx":221
+ * buffer.suboffsets = NULL
+ * buffer.itemsize = 1
+ * buffer.internal = NULL # <<<<<<<<<<<<<<
+ *
+ * def __getsegcount__(self, Py_ssize_t *lenp):
+ */
+ __pyx_v_buffer->internal = NULL;
+
+ /* "zmq/backend/cython/message.pyx":208
+ * # buffer interface code adapted from petsc4py by Lisandro Dalcin, a BSD project
+ *
+ * def __getbuffer__(self, Py_buffer* buffer, int flags): # <<<<<<<<<<<<<<
+ * # new-style (memoryview) buffer interface
+ * buffer.buf = zmq_msg_data(&self.zmq_msg)
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ if (__pyx_v_buffer != NULL && __pyx_v_buffer->obj == Py_None) {
+ __Pyx_GOTREF(Py_None);
+ __Pyx_DECREF(Py_None); __pyx_v_buffer->obj = NULL;
+ }
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":223
+ * buffer.internal = NULL
+ *
+ * def __getsegcount__(self, Py_ssize_t *lenp): # <<<<<<<<<<<<<<
+ * # required for getreadbuffer
+ * if lenp != NULL:
+ */
+
+/* Python wrapper */
+#if PY_MAJOR_VERSION < 3
+static Py_ssize_t __pyx_pw_3zmq_7backend_6cython_7message_5Frame_9__getsegcount__(PyObject *__pyx_v_self, Py_ssize_t *__pyx_v_lenp); /*proto*/
+static Py_ssize_t __pyx_pw_3zmq_7backend_6cython_7message_5Frame_9__getsegcount__(PyObject *__pyx_v_self, Py_ssize_t *__pyx_v_lenp) {
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getsegcount__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_8__getsegcount__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), ((Py_ssize_t *)__pyx_v_lenp));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+#endif /*!(#if PY_MAJOR_VERSION < 3)*/
+
+#if PY_MAJOR_VERSION < 3
+static Py_ssize_t __pyx_pf_3zmq_7backend_6cython_7message_5Frame_8__getsegcount__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, Py_ssize_t *__pyx_v_lenp) {
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__getsegcount__", 0);
+
+ /* "zmq/backend/cython/message.pyx":225
+ * def __getsegcount__(self, Py_ssize_t *lenp):
+ * # required for getreadbuffer
+ * if lenp != NULL: # <<<<<<<<<<<<<<
+ * lenp[0] = zmq_msg_size(&self.zmq_msg)
+ * return 1
+ */
+ __pyx_t_1 = ((__pyx_v_lenp != NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":226
+ * # required for getreadbuffer
+ * if lenp != NULL:
+ * lenp[0] = zmq_msg_size(&self.zmq_msg) # <<<<<<<<<<<<<<
+ * return 1
+ *
+ */
+ (__pyx_v_lenp[0]) = zmq_msg_size((&__pyx_v_self->zmq_msg));
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/message.pyx":227
+ * if lenp != NULL:
+ * lenp[0] = zmq_msg_size(&self.zmq_msg)
+ * return 1 # <<<<<<<<<<<<<<
+ *
+ * def __getreadbuffer__(self, Py_ssize_t idx, void **p):
+ */
+ __pyx_r = 1;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pyx":223
+ * buffer.internal = NULL
+ *
+ * def __getsegcount__(self, Py_ssize_t *lenp): # <<<<<<<<<<<<<<
+ * # required for getreadbuffer
+ * if lenp != NULL:
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+#endif /*!(#if PY_MAJOR_VERSION < 3)*/
+
+/* "zmq/backend/cython/message.pyx":229
+ * return 1
+ *
+ * def __getreadbuffer__(self, Py_ssize_t idx, void **p): # <<<<<<<<<<<<<<
+ * # old-style (buffer) interface
+ * cdef char *data_c = NULL
+ */
+
+/* Python wrapper */
+#if PY_MAJOR_VERSION < 3
+static Py_ssize_t __pyx_pw_3zmq_7backend_6cython_7message_5Frame_11__getreadbuffer__(PyObject *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p); /*proto*/
+static Py_ssize_t __pyx_pw_3zmq_7backend_6cython_7message_5Frame_11__getreadbuffer__(PyObject *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p) {
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getreadbuffer__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_10__getreadbuffer__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), ((Py_ssize_t)__pyx_v_idx), ((void **)__pyx_v_p));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+#endif /*!(#if PY_MAJOR_VERSION < 3)*/
+
+#if PY_MAJOR_VERSION < 3
+static Py_ssize_t __pyx_pf_3zmq_7backend_6cython_7message_5Frame_10__getreadbuffer__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, Py_ssize_t __pyx_v_idx, void **__pyx_v_p) {
+ char *__pyx_v_data_c;
+ Py_ssize_t __pyx_v_data_len_c;
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__getreadbuffer__", 0);
+
+ /* "zmq/backend/cython/message.pyx":231
+ * def __getreadbuffer__(self, Py_ssize_t idx, void **p):
+ * # old-style (buffer) interface
+ * cdef char *data_c = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t data_len_c
+ * if idx != 0:
+ */
+ __pyx_v_data_c = NULL;
+
+ /* "zmq/backend/cython/message.pyx":233
+ * cdef char *data_c = NULL
+ * cdef Py_ssize_t data_len_c
+ * if idx != 0: # <<<<<<<<<<<<<<
+ * raise SystemError("accessing non-existent buffer segment")
+ * # read-only, because we don't want to allow
+ */
+ __pyx_t_1 = ((__pyx_v_idx != 0) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":234
+ * cdef Py_ssize_t data_len_c
+ * if idx != 0:
+ * raise SystemError("accessing non-existent buffer segment") # <<<<<<<<<<<<<<
+ * # read-only, because we don't want to allow
+ * # editing of the message in-place
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_SystemError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/message.pyx":237
+ * # read-only, because we don't want to allow
+ * # editing of the message in-place
+ * data_c = <char *>zmq_msg_data(&self.zmq_msg) # <<<<<<<<<<<<<<
+ * data_len_c = zmq_msg_size(&self.zmq_msg)
+ * if p != NULL:
+ */
+ __pyx_v_data_c = ((char *)zmq_msg_data((&__pyx_v_self->zmq_msg)));
+
+ /* "zmq/backend/cython/message.pyx":238
+ * # editing of the message in-place
+ * data_c = <char *>zmq_msg_data(&self.zmq_msg)
+ * data_len_c = zmq_msg_size(&self.zmq_msg) # <<<<<<<<<<<<<<
+ * if p != NULL:
+ * p[0] = <void*>data_c
+ */
+ __pyx_v_data_len_c = zmq_msg_size((&__pyx_v_self->zmq_msg));
+
+ /* "zmq/backend/cython/message.pyx":239
+ * data_c = <char *>zmq_msg_data(&self.zmq_msg)
+ * data_len_c = zmq_msg_size(&self.zmq_msg)
+ * if p != NULL: # <<<<<<<<<<<<<<
+ * p[0] = <void*>data_c
+ * return data_len_c
+ */
+ __pyx_t_1 = ((__pyx_v_p != NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":240
+ * data_len_c = zmq_msg_size(&self.zmq_msg)
+ * if p != NULL:
+ * p[0] = <void*>data_c # <<<<<<<<<<<<<<
+ * return data_len_c
+ *
+ */
+ (__pyx_v_p[0]) = ((void *)__pyx_v_data_c);
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/message.pyx":241
+ * if p != NULL:
+ * p[0] = <void*>data_c
+ * return data_len_c # <<<<<<<<<<<<<<
+ *
+ * # end buffer interface
+ */
+ __pyx_r = __pyx_v_data_len_c;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pyx":229
+ * return 1
+ *
+ * def __getreadbuffer__(self, Py_ssize_t idx, void **p): # <<<<<<<<<<<<<<
+ * # old-style (buffer) interface
+ * cdef char *data_c = NULL
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.__getreadbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+#endif /*!(#if PY_MAJOR_VERSION < 3)*/
+
+/* "zmq/backend/cython/message.pyx":245
+ * # end buffer interface
+ *
+ * def __copy__(self): # <<<<<<<<<<<<<<
+ * """Create a shallow copy of the message.
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_13__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7message_5Frame_12__copy__[] = "Create a shallow copy of the message.\n\n This does not copy the contents of the Frame, just the pointer.\n This will increment the 0MQ ref count of the message, but not\n the ref count of the Python object. That is only done once when\n the Python is first turned into a 0MQ message.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_13__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_12__copy__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_12__copy__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__copy__", 0);
+
+ /* "zmq/backend/cython/message.pyx":253
+ * the Python is first turned into a 0MQ message.
+ * """
+ * return self.fast_copy() # <<<<<<<<<<<<<<
+ *
+ * cdef Frame fast_copy(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self->__pyx_vtab)->fast_copy(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pyx":245
+ * # end buffer interface
+ *
+ * def __copy__(self): # <<<<<<<<<<<<<<
+ * """Create a shallow copy of the message.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":255
+ * return self.fast_copy()
+ *
+ * cdef Frame fast_copy(self): # <<<<<<<<<<<<<<
+ * """Fast, cdef'd version of shallow copy of the Frame."""
+ * cdef Frame new_msg
+ */
+
+static struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_f_3zmq_7backend_6cython_7message_5Frame_fast_copy(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_new_msg = 0;
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("fast_copy", 0);
+
+ /* "zmq/backend/cython/message.pyx":258
+ * """Fast, cdef'd version of shallow copy of the Frame."""
+ * cdef Frame new_msg
+ * new_msg = Frame() # <<<<<<<<<<<<<<
+ * # This does not copy the contents, but just increases the ref-count
+ * # of the zmq_msg by one.
+ */
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3zmq_7backend_6cython_7message_Frame)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_new_msg = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/message.pyx":261
+ * # This does not copy the contents, but just increases the ref-count
+ * # of the zmq_msg by one.
+ * zmq_msg_copy(&new_msg.zmq_msg, &self.zmq_msg) # <<<<<<<<<<<<<<
+ * # Copy the ref to data so the copy won't create a copy when str is
+ * # called.
+ */
+ zmq_msg_copy((&__pyx_v_new_msg->zmq_msg), (&__pyx_v_self->zmq_msg));
+
+ /* "zmq/backend/cython/message.pyx":264
+ * # Copy the ref to data so the copy won't create a copy when str is
+ * # called.
+ * if self._data is not None: # <<<<<<<<<<<<<<
+ * new_msg._data = self._data
+ * if self._buffer is not None:
+ */
+ __pyx_t_2 = (__pyx_v_self->_data != Py_None);
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/message.pyx":265
+ * # called.
+ * if self._data is not None:
+ * new_msg._data = self._data # <<<<<<<<<<<<<<
+ * if self._buffer is not None:
+ * new_msg._buffer = self._buffer
+ */
+ __pyx_t_1 = __pyx_v_self->_data;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_new_msg->_data);
+ __Pyx_DECREF(__pyx_v_new_msg->_data);
+ __pyx_v_new_msg->_data = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/message.pyx":266
+ * if self._data is not None:
+ * new_msg._data = self._data
+ * if self._buffer is not None: # <<<<<<<<<<<<<<
+ * new_msg._buffer = self._buffer
+ * if self._bytes is not None:
+ */
+ __pyx_t_3 = (__pyx_v_self->_buffer != Py_None);
+ __pyx_t_2 = (__pyx_t_3 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/message.pyx":267
+ * new_msg._data = self._data
+ * if self._buffer is not None:
+ * new_msg._buffer = self._buffer # <<<<<<<<<<<<<<
+ * if self._bytes is not None:
+ * new_msg._bytes = self._bytes
+ */
+ __pyx_t_1 = __pyx_v_self->_buffer;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_new_msg->_buffer);
+ __Pyx_DECREF(__pyx_v_new_msg->_buffer);
+ __pyx_v_new_msg->_buffer = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/message.pyx":268
+ * if self._buffer is not None:
+ * new_msg._buffer = self._buffer
+ * if self._bytes is not None: # <<<<<<<<<<<<<<
+ * new_msg._bytes = self._bytes
+ *
+ */
+ __pyx_t_2 = (__pyx_v_self->_bytes != Py_None);
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/message.pyx":269
+ * new_msg._buffer = self._buffer
+ * if self._bytes is not None:
+ * new_msg._bytes = self._bytes # <<<<<<<<<<<<<<
+ *
+ * # Frame copies share the tracker and tracker_event
+ */
+ __pyx_t_1 = __pyx_v_self->_bytes;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_new_msg->_bytes);
+ __Pyx_DECREF(__pyx_v_new_msg->_bytes);
+ __pyx_v_new_msg->_bytes = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "zmq/backend/cython/message.pyx":272
+ *
+ * # Frame copies share the tracker and tracker_event
+ * new_msg.tracker_event = self.tracker_event # <<<<<<<<<<<<<<
+ * new_msg.tracker = self.tracker
+ *
+ */
+ __pyx_t_1 = __pyx_v_self->tracker_event;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_new_msg->tracker_event);
+ __Pyx_DECREF(__pyx_v_new_msg->tracker_event);
+ __pyx_v_new_msg->tracker_event = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/message.pyx":273
+ * # Frame copies share the tracker and tracker_event
+ * new_msg.tracker_event = self.tracker_event
+ * new_msg.tracker = self.tracker # <<<<<<<<<<<<<<
+ *
+ * return new_msg
+ */
+ __pyx_t_1 = __pyx_v_self->tracker;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_new_msg->tracker);
+ __Pyx_DECREF(__pyx_v_new_msg->tracker);
+ __pyx_v_new_msg->tracker = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/message.pyx":275
+ * new_msg.tracker = self.tracker
+ *
+ * return new_msg # <<<<<<<<<<<<<<
+ *
+ * def __len__(self):
+ */
+ __Pyx_XDECREF(((PyObject *)__pyx_r));
+ __Pyx_INCREF(((PyObject *)__pyx_v_new_msg));
+ __pyx_r = __pyx_v_new_msg;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pyx":255
+ * return self.fast_copy()
+ *
+ * cdef Frame fast_copy(self): # <<<<<<<<<<<<<<
+ * """Fast, cdef'd version of shallow copy of the Frame."""
+ * cdef Frame new_msg
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.fast_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_new_msg);
+ __Pyx_XGIVEREF((PyObject *)__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":277
+ * return new_msg
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * """Return the length of the message in bytes."""
+ * cdef size_t sz
+ */
+
+/* Python wrapper */
+static Py_ssize_t __pyx_pw_3zmq_7backend_6cython_7message_5Frame_15__len__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7message_5Frame_14__len__[] = "Return the length of the message in bytes.";
+#if CYTHON_COMPILING_IN_CPYTHON
+struct wrapperbase __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_14__len__;
+#endif
+static Py_ssize_t __pyx_pw_3zmq_7backend_6cython_7message_5Frame_15__len__(PyObject *__pyx_v_self) {
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_14__len__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static Py_ssize_t __pyx_pf_3zmq_7backend_6cython_7message_5Frame_14__len__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ size_t __pyx_v_sz;
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__len__", 0);
+
+ /* "zmq/backend/cython/message.pyx":280
+ * """Return the length of the message in bytes."""
+ * cdef size_t sz
+ * sz = zmq_msg_size(&self.zmq_msg) # <<<<<<<<<<<<<<
+ * return sz
+ * # return <int>zmq_msg_size(&self.zmq_msg)
+ */
+ __pyx_v_sz = zmq_msg_size((&__pyx_v_self->zmq_msg));
+
+ /* "zmq/backend/cython/message.pyx":281
+ * cdef size_t sz
+ * sz = zmq_msg_size(&self.zmq_msg)
+ * return sz # <<<<<<<<<<<<<<
+ * # return <int>zmq_msg_size(&self.zmq_msg)
+ *
+ */
+ __pyx_r = __pyx_v_sz;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pyx":277
+ * return new_msg
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * """Return the length of the message in bytes."""
+ * cdef size_t sz
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":284
+ * # return <int>zmq_msg_size(&self.zmq_msg)
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * """Return the str form of the message."""
+ * if isinstance(self._data, bytes):
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_17__str__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7message_5Frame_16__str__[] = "Return the str form of the message.";
+#if CYTHON_COMPILING_IN_CPYTHON
+struct wrapperbase __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_16__str__;
+#endif
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_17__str__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_16__str__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_16__str__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ PyObject *__pyx_v_b = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__str__", 0);
+
+ /* "zmq/backend/cython/message.pyx":286
+ * def __str__(self):
+ * """Return the str form of the message."""
+ * if isinstance(self._data, bytes): # <<<<<<<<<<<<<<
+ * b = self._data
+ * else:
+ */
+ __pyx_t_1 = __pyx_v_self->_data;
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "zmq/backend/cython/message.pyx":287
+ * """Return the str form of the message."""
+ * if isinstance(self._data, bytes):
+ * b = self._data # <<<<<<<<<<<<<<
+ * else:
+ * b = self.bytes
+ */
+ __pyx_t_2 = __pyx_v_self->_data;
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_v_b = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/message.pyx":289
+ * b = self._data
+ * else:
+ * b = self.bytes # <<<<<<<<<<<<<<
+ * if str is unicode:
+ * return b.decode()
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_bytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v_b = __pyx_t_2;
+ __pyx_t_2 = 0;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/message.pyx":290
+ * else:
+ * b = self.bytes
+ * if str is unicode: # <<<<<<<<<<<<<<
+ * return b.decode()
+ * else:
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = (((PyObject*)(&PyString_Type)) == ((PyObject*)__pyx_t_2));
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_3 = (__pyx_t_4 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/message.pyx":291
+ * b = self.bytes
+ * if str is unicode:
+ * return b.decode() # <<<<<<<<<<<<<<
+ * else:
+ * return b
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_b, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/message.pyx":293
+ * return b.decode()
+ * else:
+ * return b # <<<<<<<<<<<<<<
+ *
+ * cdef inline object _getbuffer(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_b);
+ __pyx_r = __pyx_v_b;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/message.pyx":284
+ * # return <int>zmq_msg_size(&self.zmq_msg)
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * """Return the str form of the message."""
+ * if isinstance(self._data, bytes):
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_b);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":295
+ * return b
+ *
+ * cdef inline object _getbuffer(self): # <<<<<<<<<<<<<<
+ * """Create a Python buffer/view of the message data.
+ *
+ */
+
+static PyObject *__pyx_f_3zmq_7backend_6cython_7message_5Frame__getbuffer(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_getbuffer", 0);
+
+ /* "zmq/backend/cython/message.pyx":301
+ * is accessed. Subsequent calls use a cached copy.
+ * """
+ * if self._data is None: # <<<<<<<<<<<<<<
+ * return viewfromobject_r(self)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_self->_data == Py_None);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/message.pyx":302
+ * """
+ * if self._data is None:
+ * return viewfromobject_r(self) # <<<<<<<<<<<<<<
+ * else:
+ * return viewfromobject_r(self._data)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __pyx_f_7buffers_viewfromobject_r(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/message.pyx":304
+ * return viewfromobject_r(self)
+ * else:
+ * return viewfromobject_r(self._data) # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __pyx_v_self->_data;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_4 = __pyx_f_7buffers_viewfromobject_r(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/message.pyx":295
+ * return b
+ *
+ * cdef inline object _getbuffer(self): # <<<<<<<<<<<<<<
+ * """Create a Python buffer/view of the message data.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame._getbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":307
+ *
+ * @property
+ * def buffer(self): # <<<<<<<<<<<<<<
+ * """A read-only buffer view of the message contents."""
+ * if self._buffer is None:
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_19buffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7message_5Frame_18buffer[] = "A read-only buffer view of the message contents.";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_19buffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("buffer (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_18buffer(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_18buffer(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("buffer", 0);
+
+ /* "zmq/backend/cython/message.pyx":309
+ * def buffer(self):
+ * """A read-only buffer view of the message contents."""
+ * if self._buffer is None: # <<<<<<<<<<<<<<
+ * self._buffer = self._getbuffer()
+ * return self._buffer
+ */
+ __pyx_t_1 = (__pyx_v_self->_buffer == Py_None);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/message.pyx":310
+ * """A read-only buffer view of the message contents."""
+ * if self._buffer is None:
+ * self._buffer = self._getbuffer() # <<<<<<<<<<<<<<
+ * return self._buffer
+ *
+ */
+ __pyx_t_3 = __pyx_f_3zmq_7backend_6cython_7message_5Frame__getbuffer(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_v_self->_buffer);
+ __Pyx_DECREF(__pyx_v_self->_buffer);
+ __pyx_v_self->_buffer = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/message.pyx":311
+ * if self._buffer is None:
+ * self._buffer = self._getbuffer()
+ * return self._buffer # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->_buffer);
+ __pyx_r = __pyx_v_self->_buffer;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pyx":307
+ *
+ * @property
+ * def buffer(self): # <<<<<<<<<<<<<<
+ * """A read-only buffer view of the message contents."""
+ * if self._buffer is None:
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":314
+ *
+ * @property
+ * def bytes(self): # <<<<<<<<<<<<<<
+ * """The message content as a Python bytes object.
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_21bytes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7message_5Frame_20bytes[] = "The message content as a Python bytes object.\n\n The first time this property is accessed, a copy of the message \n contents is made. From then on that same copy of the message is\n returned.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_21bytes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("bytes (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_20bytes(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_20bytes(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("bytes", 0);
+
+ /* "zmq/backend/cython/message.pyx":321
+ * returned.
+ * """
+ * if self._bytes is None: # <<<<<<<<<<<<<<
+ * self._bytes = copy_zmq_msg_bytes(&self.zmq_msg)
+ * return self._bytes
+ */
+ __pyx_t_1 = (__pyx_v_self->_bytes == Py_None);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/message.pyx":322
+ * """
+ * if self._bytes is None:
+ * self._bytes = copy_zmq_msg_bytes(&self.zmq_msg) # <<<<<<<<<<<<<<
+ * return self._bytes
+ *
+ */
+ __pyx_t_3 = __pyx_f_3zmq_7backend_6cython_7message_copy_zmq_msg_bytes((&__pyx_v_self->zmq_msg)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_v_self->_bytes);
+ __Pyx_DECREF(__pyx_v_self->_bytes);
+ __pyx_v_self->_bytes = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/message.pyx":323
+ * if self._bytes is None:
+ * self._bytes = copy_zmq_msg_bytes(&self.zmq_msg)
+ * return self._bytes # <<<<<<<<<<<<<<
+ *
+ * def set(self, int option, int value):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->_bytes);
+ __pyx_r = __pyx_v_self->_bytes;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pyx":314
+ *
+ * @property
+ * def bytes(self): # <<<<<<<<<<<<<<
+ * """The message content as a Python bytes object.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":325
+ * return self._bytes
+ *
+ * def set(self, int option, int value): # <<<<<<<<<<<<<<
+ * """Frame.set(option, value)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_23set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7message_5Frame_22set[] = "Frame.set(option, value)\n \n Set a Frame option.\n \n See the 0MQ API documentation for zmq_msg_set\n for details on specific options.\n \n .. versionadded:: libzmq-3.2\n .. versionadded:: 13.0\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_23set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_v_option;
+ int __pyx_v_value;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("set (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_option,&__pyx_n_s_value,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_option)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ __pyx_v_option = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_value = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_22set(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), __pyx_v_option, __pyx_v_value);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_22set(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, int __pyx_v_option, int __pyx_v_value) {
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("set", 0);
+
+ /* "zmq/backend/cython/message.pyx":336
+ * .. versionadded:: 13.0
+ * """
+ * cdef int rc = zmq_msg_set(&self.zmq_msg, option, value) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_msg_set((&__pyx_v_self->zmq_msg), __pyx_v_option, __pyx_v_value);
+
+ /* "zmq/backend/cython/message.pyx":337
+ * """
+ * cdef int rc = zmq_msg_set(&self.zmq_msg, option, value)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * def get(self, option):
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/message.pyx":325
+ * return self._bytes
+ *
+ * def set(self, int option, int value): # <<<<<<<<<<<<<<
+ * """Frame.set(option, value)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pyx":339
+ * _check_rc(rc)
+ *
+ * def get(self, option): # <<<<<<<<<<<<<<
+ * """Frame.get(option)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_25get(PyObject *__pyx_v_self, PyObject *__pyx_v_option); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_7message_5Frame_24get[] = "Frame.get(option)\n\n Get a Frame option or property.\n\n See the 0MQ API documentation for zmq_msg_get and zmq_msg_gets\n for details on specific options.\n\n .. versionadded:: libzmq-3.2\n .. versionadded:: 13.0\n \n .. versionchanged:: 14.3\n add support for zmq_msg_gets (requires libzmq-4.1)\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_25get(PyObject *__pyx_v_self, PyObject *__pyx_v_option) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("get (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_24get(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), ((PyObject *)__pyx_v_option));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_24get(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_option) {
+ int __pyx_v_rc;
+ char *__pyx_v_property_c;
+ CYTHON_UNUSED Py_ssize_t __pyx_v_property_len_c;
+ char const *__pyx_v_result;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ char *__pyx_t_6;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("get", 0);
+ __Pyx_INCREF(__pyx_v_option);
+
+ /* "zmq/backend/cython/message.pyx":353
+ * add support for zmq_msg_gets (requires libzmq-4.1)
+ * """
+ * cdef int rc = 0 # <<<<<<<<<<<<<<
+ * cdef char *property_c = NULL
+ * cdef Py_ssize_t property_len_c = 0
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/message.pyx":354
+ * """
+ * cdef int rc = 0
+ * cdef char *property_c = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t property_len_c = 0
+ *
+ */
+ __pyx_v_property_c = NULL;
+
+ /* "zmq/backend/cython/message.pyx":355
+ * cdef int rc = 0
+ * cdef char *property_c = NULL
+ * cdef Py_ssize_t property_len_c = 0 # <<<<<<<<<<<<<<
+ *
+ * # zmq_msg_get
+ */
+ __pyx_v_property_len_c = 0;
+
+ /* "zmq/backend/cython/message.pyx":358
+ *
+ * # zmq_msg_get
+ * if isinstance(option, int): # <<<<<<<<<<<<<<
+ * rc = zmq_msg_get(&self.zmq_msg, option)
+ * _check_rc(rc)
+ */
+ __pyx_t_1 = PyInt_Check(__pyx_v_option);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/message.pyx":359
+ * # zmq_msg_get
+ * if isinstance(option, int):
+ * rc = zmq_msg_get(&self.zmq_msg, option) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * return rc
+ */
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_option); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_rc = zmq_msg_get((&__pyx_v_self->zmq_msg), __pyx_t_3);
+
+ /* "zmq/backend/cython/message.pyx":360
+ * if isinstance(option, int):
+ * rc = zmq_msg_get(&self.zmq_msg, option)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * return rc
+ *
+ */
+ __pyx_t_3 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/message.pyx":361
+ * rc = zmq_msg_get(&self.zmq_msg, option)
+ * _check_rc(rc)
+ * return rc # <<<<<<<<<<<<<<
+ *
+ * # zmq_msg_gets
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/message.pyx":364
+ *
+ * # zmq_msg_gets
+ * _check_version((4,1), "get string properties") # <<<<<<<<<<<<<<
+ * if isinstance(option, unicode):
+ * option = option.encode('utf8')
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "zmq/backend/cython/message.pyx":365
+ * # zmq_msg_gets
+ * _check_version((4,1), "get string properties")
+ * if isinstance(option, unicode): # <<<<<<<<<<<<<<
+ * option = option.encode('utf8')
+ *
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_option, __pyx_t_5); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = (__pyx_t_2 != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/message.pyx":366
+ * _check_version((4,1), "get string properties")
+ * if isinstance(option, unicode):
+ * option = option.encode('utf8') # <<<<<<<<<<<<<<
+ *
+ * if not isinstance(option, bytes):
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_option, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF_SET(__pyx_v_option, __pyx_t_4);
+ __pyx_t_4 = 0;
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/message.pyx":368
+ * option = option.encode('utf8')
+ *
+ * if not isinstance(option, bytes): # <<<<<<<<<<<<<<
+ * raise TypeError("expected str, got: %r" % option)
+ *
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_IsInstance(__pyx_v_option, __pyx_t_4); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/message.pyx":369
+ *
+ * if not isinstance(option, bytes):
+ * raise TypeError("expected str, got: %r" % option) # <<<<<<<<<<<<<<
+ *
+ * property_c = option
+ */
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_option); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/message.pyx":371
+ * raise TypeError("expected str, got: %r" % option)
+ *
+ * property_c = option # <<<<<<<<<<<<<<
+ *
+ * cdef const char *result = <char *>zmq_msg_gets(&self.zmq_msg, property_c)
+ */
+ __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_option); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_property_c = __pyx_t_6;
+
+ /* "zmq/backend/cython/message.pyx":373
+ * property_c = option
+ *
+ * cdef const char *result = <char *>zmq_msg_gets(&self.zmq_msg, property_c) # <<<<<<<<<<<<<<
+ * if result == NULL:
+ * _check_rc(-1)
+ */
+ __pyx_v_result = ((char *)zmq_msg_gets((&__pyx_v_self->zmq_msg), __pyx_v_property_c));
+
+ /* "zmq/backend/cython/message.pyx":374
+ *
+ * cdef const char *result = <char *>zmq_msg_gets(&self.zmq_msg, property_c)
+ * if result == NULL: # <<<<<<<<<<<<<<
+ * _check_rc(-1)
+ * return result.decode('utf8')
+ */
+ __pyx_t_2 = ((__pyx_v_result == NULL) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/message.pyx":375
+ * cdef const char *result = <char *>zmq_msg_gets(&self.zmq_msg, property_c)
+ * if result == NULL:
+ * _check_rc(-1) # <<<<<<<<<<<<<<
+ * return result.decode('utf8')
+ *
+ */
+ __pyx_t_3 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(-1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "zmq/backend/cython/message.pyx":376
+ * if result == NULL:
+ * _check_rc(-1)
+ * return result.decode('utf8') # <<<<<<<<<<<<<<
+ *
+ * # legacy Message name
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_result, 0, strlen(__pyx_v_result), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pyx":339
+ * _check_rc(rc)
+ *
+ * def get(self, option): # <<<<<<<<<<<<<<
+ * """Frame.get(option)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_option);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pxd":47
+ * cdef object _bytes # A bytes/str copy of the message.
+ * cdef bint _failed_init # Flag to handle failed zmq_msg_init
+ * cdef public object tracker_event # Event for use with zmq_free_fn. # <<<<<<<<<<<<<<
+ * cdef public object tracker # MessageTracker object.
+ * cdef public bint more # whether RCVMORE was set
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event___get__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event___get__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->tracker_event);
+ __pyx_r = __pyx_v_self->tracker_event;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event_2__set__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event_2__set__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ __Pyx_GOTREF(__pyx_v_self->tracker_event);
+ __Pyx_DECREF(__pyx_v_self->tracker_event);
+ __pyx_v_self->tracker_event = __pyx_v_value;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event_4__del__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_13tracker_event_4__del__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->tracker_event);
+ __Pyx_DECREF(__pyx_v_self->tracker_event);
+ __pyx_v_self->tracker_event = Py_None;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pxd":48
+ * cdef bint _failed_init # Flag to handle failed zmq_msg_init
+ * cdef public object tracker_event # Event for use with zmq_free_fn.
+ * cdef public object tracker # MessageTracker object. # <<<<<<<<<<<<<<
+ * cdef public bint more # whether RCVMORE was set
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker___get__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker___get__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->tracker);
+ __pyx_r = __pyx_v_self->tracker;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker_2__set__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker_2__set__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __Pyx_INCREF(__pyx_v_value);
+ __Pyx_GIVEREF(__pyx_v_value);
+ __Pyx_GOTREF(__pyx_v_self->tracker);
+ __Pyx_DECREF(__pyx_v_self->tracker);
+ __pyx_v_self->tracker = __pyx_v_value;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker_4__del__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_7tracker_4__del__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->tracker);
+ __Pyx_DECREF(__pyx_v_self->tracker);
+ __pyx_v_self->tracker = Py_None;
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pxd":49
+ * cdef public object tracker_event # Event for use with zmq_free_fn.
+ * cdef public object tracker # MessageTracker object.
+ * cdef public bint more # whether RCVMORE was set # <<<<<<<<<<<<<<
+ *
+ * cdef Frame fast_copy(self) # Create shallow copy of Message object.
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_4more_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_3zmq_7backend_6cython_7message_5Frame_4more_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_4more___get__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_7message_5Frame_4more___get__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->more); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.more.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_4more_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_7message_5Frame_4more_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_7message_5Frame_4more_2__set__(((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_7message_5Frame_4more_2__set__(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->more = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.message.Frame.more.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int __pyx_v_rc) {
+ int __pyx_v_errno;
+ PyObject *__pyx_v_InterruptedSystemCall = NULL;
+ PyObject *__pyx_v_Again = NULL;
+ PyObject *__pyx_v_ContextTerminated = NULL;
+ PyObject *__pyx_v_ZMQError = NULL;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_check_rc", 0);
+
+ /* "zmq/backend/cython/checkrc.pxd":11
+ * and raising the appropriate Exception class
+ * """
+ * cdef int errno = zmq_errno() # <<<<<<<<<<<<<<
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ */
+ __pyx_v_errno = zmq_errno();
+
+ /* "zmq/backend/cython/checkrc.pxd":12
+ * """
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals() # <<<<<<<<<<<<<<
+ * if rc < 0:
+ * if errno == EINTR:
+ */
+ __pyx_t_1 = PyErr_CheckSignals(); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/checkrc.pxd":13
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals()
+ * if rc < 0: # <<<<<<<<<<<<<<
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ */
+ __pyx_t_2 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ switch (__pyx_v_errno) {
+
+ /* "zmq/backend/cython/checkrc.pxd":14
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ * if errno == EINTR: # <<<<<<<<<<<<<<
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ */
+ case EINTR:
+
+ /* "zmq/backend/cython/checkrc.pxd":15
+ * if rc < 0:
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ */
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_4 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_InterruptedSystemCall = __pyx_t_3;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":16
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno) # <<<<<<<<<<<<<<
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_InterruptedSystemCall);
+ __pyx_t_5 = __pyx_v_InterruptedSystemCall; __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":17
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN: # <<<<<<<<<<<<<<
+ * from zmq.error import Again
+ * raise Again(errno)
+ */
+ case EAGAIN:
+
+ /* "zmq/backend/cython/checkrc.pxd":18
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ * from zmq.error import Again # <<<<<<<<<<<<<<
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ */
+ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_Again);
+ PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Again);
+ __Pyx_GIVEREF(__pyx_n_s_Again);
+ __pyx_t_5 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Again); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v_Again = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":19
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ * raise Again(errno) # <<<<<<<<<<<<<<
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ */
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_Again);
+ __pyx_t_7 = __pyx_v_Again; __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ case ETERM:
+
+ /* "zmq/backend/cython/checkrc.pxd":21
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated # <<<<<<<<<<<<<<
+ * raise ContextTerminated(errno)
+ * else:
+ */
+ __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_ContextTerminated);
+ PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_ContextTerminated);
+ __Pyx_GIVEREF(__pyx_n_s_ContextTerminated);
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_5, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ContextTerminated); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_v_ContextTerminated = __pyx_t_5;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":22
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno) # <<<<<<<<<<<<<<
+ * else:
+ * from zmq.error import ZMQError
+ */
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_v_ContextTerminated);
+ __pyx_t_6 = __pyx_v_ContextTerminated; __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_t_7, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ default:
+
+ /* "zmq/backend/cython/checkrc.pxd":24
+ * raise ContextTerminated(errno)
+ * else:
+ * from zmq.error import ZMQError # <<<<<<<<<<<<<<
+ * raise ZMQError(errno)
+ * return 0
+ */
+ __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_7, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_7);
+ __pyx_v_ZMQError = __pyx_t_7;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":25
+ * else:
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno) # <<<<<<<<<<<<<<
+ * return 0
+ */
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_v_ZMQError);
+ __pyx_t_3 = __pyx_v_ZMQError; __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ }
+ }
+
+ /* "zmq/backend/cython/checkrc.pxd":26
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno)
+ * return 0 # <<<<<<<<<<<<<<
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.checkrc._check_rc", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_InterruptedSystemCall);
+ __Pyx_XDECREF(__pyx_v_Again);
+ __Pyx_XDECREF(__pyx_v_ContextTerminated);
+ __Pyx_XDECREF(__pyx_v_ZMQError);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/message.pxd":55
+ *
+ *
+ * cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg): # <<<<<<<<<<<<<<
+ * """ Copy the data from a zmq_msg_t """
+ * cdef char *data_c = NULL
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_7message_copy_zmq_msg_bytes(zmq_msg_t *__pyx_v_zmq_msg) {
+ char *__pyx_v_data_c;
+ Py_ssize_t __pyx_v_data_len_c;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("copy_zmq_msg_bytes", 0);
+
+ /* "zmq/backend/cython/message.pxd":57
+ * cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg):
+ * """ Copy the data from a zmq_msg_t """
+ * cdef char *data_c = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t data_len_c
+ * data_c = <char *>zmq_msg_data(zmq_msg)
+ */
+ __pyx_v_data_c = NULL;
+
+ /* "zmq/backend/cython/message.pxd":59
+ * cdef char *data_c = NULL
+ * cdef Py_ssize_t data_len_c
+ * data_c = <char *>zmq_msg_data(zmq_msg) # <<<<<<<<<<<<<<
+ * data_len_c = zmq_msg_size(zmq_msg)
+ * return PyBytes_FromStringAndSize(data_c, data_len_c)
+ */
+ __pyx_v_data_c = ((char *)zmq_msg_data(__pyx_v_zmq_msg));
+
+ /* "zmq/backend/cython/message.pxd":60
+ * cdef Py_ssize_t data_len_c
+ * data_c = <char *>zmq_msg_data(zmq_msg)
+ * data_len_c = zmq_msg_size(zmq_msg) # <<<<<<<<<<<<<<
+ * return PyBytes_FromStringAndSize(data_c, data_len_c)
+ *
+ */
+ __pyx_v_data_len_c = zmq_msg_size(__pyx_v_zmq_msg);
+
+ /* "zmq/backend/cython/message.pxd":61
+ * data_c = <char *>zmq_msg_data(zmq_msg)
+ * data_len_c = zmq_msg_size(zmq_msg)
+ * return PyBytes_FromStringAndSize(data_c, data_len_c) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_data_c, __pyx_v_data_len_c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/message.pxd":55
+ *
+ *
+ * cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg): # <<<<<<<<<<<<<<
+ * """ Copy the data from a zmq_msg_t """
+ * cdef char *data_c = NULL
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.message.copy_zmq_msg_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":88
+ *
+ *
+ * cdef inline int memoryview_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ __Pyx_RefNannySetupContext("memoryview_available", 0);
+
+ /* "buffers.pxd":89
+ *
+ * cdef inline int memoryview_available():
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7) # <<<<<<<<<<<<<<
+ *
+ * cdef inline int oldstyle_available():
+ */
+ __pyx_t_2 = (PY_MAJOR_VERSION >= 3);
+ if (!__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L3_bool_binop_done;
+ }
+ __pyx_t_2 = (PY_MAJOR_VERSION >= 2);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L3_bool_binop_done;
+ }
+ __pyx_t_2 = (PY_MINOR_VERSION >= 7);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L3_bool_binop_done:;
+ __pyx_r = __pyx_t_1;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":88
+ *
+ *
+ * cdef inline int memoryview_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":91
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ * cdef inline int oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION < 3
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("oldstyle_available", 0);
+
+ /* "buffers.pxd":92
+ *
+ * cdef inline int oldstyle_available():
+ * return PY_MAJOR_VERSION < 3 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = (PY_MAJOR_VERSION < 3);
+ goto __pyx_L0;
+
+ /* "buffers.pxd":91
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ * cdef inline int oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION < 3
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":95
+ *
+ *
+ * cdef inline int check_buffer(object ob): # <<<<<<<<<<<<<<
+ * """Version independent check for whether an object is a buffer.
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *__pyx_v_ob) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ __Pyx_RefNannySetupContext("check_buffer", 0);
+
+ /* "buffers.pxd":107
+ * int : 0 if no buffer interface, 3 if newstyle buffer interface, 2 if oldstyle.
+ * """
+ * if PyObject_CheckBuffer(ob): # <<<<<<<<<<<<<<
+ * return 3
+ * if oldstyle_available():
+ */
+ __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_ob) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":108
+ * """
+ * if PyObject_CheckBuffer(ob):
+ * return 3 # <<<<<<<<<<<<<<
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2
+ */
+ __pyx_r = 3;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":109
+ * if PyObject_CheckBuffer(ob):
+ * return 3
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PyObject_CheckReadBuffer(ob) and 2
+ * return 0
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":110
+ * return 3
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2 # <<<<<<<<<<<<<<
+ * return 0
+ *
+ */
+ __pyx_t_3 = PyObject_CheckReadBuffer(__pyx_v_ob);
+ if (__pyx_t_3) {
+ } else {
+ __pyx_t_2 = __pyx_t_3;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_2 = 2;
+ __pyx_L5_bool_binop_done:;
+ __pyx_r = __pyx_t_2;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":111
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2
+ * return 0 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":95
+ *
+ *
+ * cdef inline int check_buffer(object ob): # <<<<<<<<<<<<<<
+ * """Version independent check for whether an object is a buffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":114
+ *
+ *
+ * cdef inline object asbuffer(object ob, int writable, int format, # <<<<<<<<<<<<<<
+ * void **base, Py_ssize_t *size,
+ * Py_ssize_t *itemsize):
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *__pyx_v_ob, int __pyx_v_writable, int __pyx_v_format, void **__pyx_v_base, Py_ssize_t *__pyx_v_size, Py_ssize_t *__pyx_v_itemsize) {
+ void *__pyx_v_bptr;
+ Py_ssize_t __pyx_v_blen;
+ Py_ssize_t __pyx_v_bitemlen;
+ Py_buffer __pyx_v_view;
+ int __pyx_v_flags;
+ int __pyx_v_mode;
+ PyObject *__pyx_v_bfmt = NULL;
+ PyObject *__pyx_v_dtype = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ void *__pyx_t_5;
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ int __pyx_t_17;
+ int __pyx_t_18;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer", 0);
+
+ /* "buffers.pxd":141
+ * """
+ *
+ * cdef void *bptr = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t blen = 0, bitemlen = 0
+ * cdef Py_buffer view
+ */
+ __pyx_v_bptr = NULL;
+
+ /* "buffers.pxd":142
+ *
+ * cdef void *bptr = NULL
+ * cdef Py_ssize_t blen = 0, bitemlen = 0 # <<<<<<<<<<<<<<
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE
+ */
+ __pyx_v_blen = 0;
+ __pyx_v_bitemlen = 0;
+
+ /* "buffers.pxd":144
+ * cdef Py_ssize_t blen = 0, bitemlen = 0
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE # <<<<<<<<<<<<<<
+ * cdef int mode = 0
+ *
+ */
+ __pyx_v_flags = PyBUF_SIMPLE;
+
+ /* "buffers.pxd":145
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE
+ * cdef int mode = 0 # <<<<<<<<<<<<<<
+ *
+ * bfmt = None
+ */
+ __pyx_v_mode = 0;
+
+ /* "buffers.pxd":147
+ * cdef int mode = 0
+ *
+ * bfmt = None # <<<<<<<<<<<<<<
+ *
+ * mode = check_buffer(ob)
+ */
+ __Pyx_INCREF(Py_None);
+ __pyx_v_bfmt = Py_None;
+
+ /* "buffers.pxd":149
+ * bfmt = None
+ *
+ * mode = check_buffer(ob) # <<<<<<<<<<<<<<
+ * if mode == 0:
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ */
+ __pyx_v_mode = __pyx_f_7buffers_check_buffer(__pyx_v_ob);
+
+ /* "buffers.pxd":150
+ *
+ * mode = check_buffer(ob)
+ * if mode == 0: # <<<<<<<<<<<<<<
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_mode == 0) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":151
+ * mode = check_buffer(ob)
+ * if mode == 0:
+ * raise TypeError("%r does not provide a buffer interface."%ob) # <<<<<<<<<<<<<<
+ *
+ * if mode == 3:
+ */
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_r_does_not_provide_a_buffer_int, __pyx_v_ob); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "buffers.pxd":153
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ *
+ * if mode == 3: # <<<<<<<<<<<<<<
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable:
+ */
+ __pyx_t_1 = ((__pyx_v_mode == 3) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":154
+ *
+ * if mode == 3:
+ * flags = PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
+ * if writable:
+ * flags |= PyBUF_WRITABLE
+ */
+ __pyx_v_flags = PyBUF_ANY_CONTIGUOUS;
+
+ /* "buffers.pxd":155
+ * if mode == 3:
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable: # <<<<<<<<<<<<<<
+ * flags |= PyBUF_WRITABLE
+ * if format:
+ */
+ __pyx_t_1 = (__pyx_v_writable != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":156
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable:
+ * flags |= PyBUF_WRITABLE # <<<<<<<<<<<<<<
+ * if format:
+ * flags |= PyBUF_FORMAT
+ */
+ __pyx_v_flags = (__pyx_v_flags | PyBUF_WRITABLE);
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "buffers.pxd":157
+ * if writable:
+ * flags |= PyBUF_WRITABLE
+ * if format: # <<<<<<<<<<<<<<
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags)
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":158
+ * flags |= PyBUF_WRITABLE
+ * if format:
+ * flags |= PyBUF_FORMAT # <<<<<<<<<<<<<<
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf
+ */
+ __pyx_v_flags = (__pyx_v_flags | PyBUF_FORMAT);
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "buffers.pxd":159
+ * if format:
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags) # <<<<<<<<<<<<<<
+ * bptr = view.buf
+ * blen = view.len
+ */
+ __pyx_t_4 = PyObject_GetBuffer(__pyx_v_ob, (&__pyx_v_view), __pyx_v_flags); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "buffers.pxd":160
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf # <<<<<<<<<<<<<<
+ * blen = view.len
+ * if format:
+ */
+ __pyx_t_5 = __pyx_v_view.buf;
+ __pyx_v_bptr = __pyx_t_5;
+
+ /* "buffers.pxd":161
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf
+ * blen = view.len # <<<<<<<<<<<<<<
+ * if format:
+ * if view.format != NULL:
+ */
+ __pyx_t_6 = __pyx_v_view.len;
+ __pyx_v_blen = __pyx_t_6;
+
+ /* "buffers.pxd":162
+ * bptr = view.buf
+ * blen = view.len
+ * if format: # <<<<<<<<<<<<<<
+ * if view.format != NULL:
+ * bfmt = view.format
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":163
+ * blen = view.len
+ * if format:
+ * if view.format != NULL: # <<<<<<<<<<<<<<
+ * bfmt = view.format
+ * bitemlen = view.itemsize
+ */
+ __pyx_t_1 = ((__pyx_v_view.format != NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":164
+ * if format:
+ * if view.format != NULL:
+ * bfmt = view.format # <<<<<<<<<<<<<<
+ * bitemlen = view.itemsize
+ * PyBuffer_Release(&view)
+ */
+ __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_view.format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":165
+ * if view.format != NULL:
+ * bfmt = view.format
+ * bitemlen = view.itemsize # <<<<<<<<<<<<<<
+ * PyBuffer_Release(&view)
+ * else: # oldstyle
+ */
+ __pyx_t_6 = __pyx_v_view.itemsize;
+ __pyx_v_bitemlen = __pyx_t_6;
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "buffers.pxd":166
+ * bfmt = view.format
+ * bitemlen = view.itemsize
+ * PyBuffer_Release(&view) # <<<<<<<<<<<<<<
+ * else: # oldstyle
+ * if writable:
+ */
+ PyBuffer_Release((&__pyx_v_view));
+ goto __pyx_L4;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":168
+ * PyBuffer_Release(&view)
+ * else: # oldstyle
+ * if writable: # <<<<<<<<<<<<<<
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_writable != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":169
+ * else: # oldstyle
+ * if writable:
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen) # <<<<<<<<<<<<<<
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ */
+ __pyx_t_4 = PyObject_AsWriteBuffer(__pyx_v_ob, (&__pyx_v_bptr), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L9;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":171
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen)
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen) # <<<<<<<<<<<<<<
+ * if format:
+ * try: # numpy.ndarray
+ */
+ __pyx_t_4 = PyObject_AsReadBuffer(__pyx_v_ob, ((const void **)(&__pyx_v_bptr)), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_L9:;
+
+ /* "buffers.pxd":172
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ * if format: # <<<<<<<<<<<<<<
+ * try: # numpy.ndarray
+ * dtype = ob.dtype
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":173
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ * if format:
+ * try: # numpy.ndarray # <<<<<<<<<<<<<<
+ * dtype = ob.dtype
+ * bfmt = dtype.char
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ /*try:*/ {
+
+ /* "buffers.pxd":174
+ * if format:
+ * try: # numpy.ndarray
+ * dtype = ob.dtype # <<<<<<<<<<<<<<
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v_dtype = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":175
+ * try: # numpy.ndarray
+ * dtype = ob.dtype
+ * bfmt = dtype.char # <<<<<<<<<<<<<<
+ * bitemlen = dtype.itemsize
+ * except AttributeError:
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_char); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":176
+ * dtype = ob.dtype
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize # <<<<<<<<<<<<<<
+ * except AttributeError:
+ * try: # array.array
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_bitemlen = __pyx_t_6;
+ }
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L18_try_end;
+ __pyx_L11_error:;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "buffers.pxd":177
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize
+ * except AttributeError: # <<<<<<<<<<<<<<
+ * try: # array.array
+ * bfmt = ob.typecode
+ */
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_10);
+
+ /* "buffers.pxd":178
+ * bitemlen = dtype.itemsize
+ * except AttributeError:
+ * try: # array.array # <<<<<<<<<<<<<<
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ /*try:*/ {
+
+ /* "buffers.pxd":179
+ * except AttributeError:
+ * try: # array.array
+ * bfmt = ob.typecode # <<<<<<<<<<<<<<
+ * bitemlen = ob.itemsize
+ * except AttributeError:
+ */
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_typecode); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_14);
+ __pyx_t_14 = 0;
+
+ /* "buffers.pxd":180
+ * try: # array.array
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize # <<<<<<<<<<<<<<
+ * except AttributeError:
+ * if isinstance(ob, bytes):
+ */
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_14); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_v_bitemlen = __pyx_t_6;
+ }
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ goto __pyx_L28_try_end;
+ __pyx_L21_error:;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "buffers.pxd":181
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize
+ * except AttributeError: # <<<<<<<<<<<<<<
+ * if isinstance(ob, bytes):
+ * bfmt = b"B"
+ */
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_16);
+
+ /* "buffers.pxd":182
+ * bitemlen = ob.itemsize
+ * except AttributeError:
+ * if isinstance(ob, bytes): # <<<<<<<<<<<<<<
+ * bfmt = b"B"
+ * bitemlen = 1
+ */
+ __pyx_t_1 = PyBytes_Check(__pyx_v_ob);
+ __pyx_t_17 = (__pyx_t_1 != 0);
+ if (__pyx_t_17) {
+
+ /* "buffers.pxd":183
+ * except AttributeError:
+ * if isinstance(ob, bytes):
+ * bfmt = b"B" # <<<<<<<<<<<<<<
+ * bitemlen = 1
+ * else:
+ */
+ __Pyx_INCREF(__pyx_n_b_B);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_n_b_B);
+
+ /* "buffers.pxd":184
+ * if isinstance(ob, bytes):
+ * bfmt = b"B"
+ * bitemlen = 1 # <<<<<<<<<<<<<<
+ * else:
+ * # nothing found
+ */
+ __pyx_v_bitemlen = 1;
+ goto __pyx_L31;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":187
+ * else:
+ * # nothing found
+ * bfmt = None # <<<<<<<<<<<<<<
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, Py_None);
+
+ /* "buffers.pxd":188
+ * # nothing found
+ * bfmt = None
+ * bitemlen = 0 # <<<<<<<<<<<<<<
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen
+ */
+ __pyx_v_bitemlen = 0;
+ }
+ __pyx_L31:;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ goto __pyx_L22_exception_handled;
+ }
+ goto __pyx_L23_except_error;
+ __pyx_L23_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ goto __pyx_L13_except_error;
+ __pyx_L22_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ __pyx_L28_try_end:;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ goto __pyx_L12_exception_handled;
+ }
+ goto __pyx_L13_except_error;
+ __pyx_L13_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ goto __pyx_L1_error;
+ __pyx_L12_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ __pyx_L18_try_end:;
+ }
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+ }
+ __pyx_L4:;
+
+ /* "buffers.pxd":189
+ * bfmt = None
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr # <<<<<<<<<<<<<<
+ * if size: size[0] = <Py_ssize_t>blen
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ */
+ __pyx_t_17 = (__pyx_v_base != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_base[0]) = ((void *)__pyx_v_bptr);
+ goto __pyx_L32;
+ }
+ __pyx_L32:;
+
+ /* "buffers.pxd":190
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen # <<<<<<<<<<<<<<
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ *
+ */
+ __pyx_t_17 = (__pyx_v_size != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_size[0]) = ((Py_ssize_t)__pyx_v_blen);
+ goto __pyx_L33;
+ }
+ __pyx_L33:;
+
+ /* "buffers.pxd":191
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen # <<<<<<<<<<<<<<
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ */
+ __pyx_t_17 = (__pyx_v_itemsize != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_itemsize[0]) = ((Py_ssize_t)__pyx_v_bitemlen);
+ goto __pyx_L34;
+ }
+ __pyx_L34:;
+
+ /* "buffers.pxd":193
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None: # <<<<<<<<<<<<<<
+ * return bfmt.decode('ascii')
+ * return bfmt
+ */
+ __pyx_t_1 = ((PY_MAJOR_VERSION >= 3) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_17 = __pyx_t_1;
+ goto __pyx_L36_bool_binop_done;
+ }
+ __pyx_t_1 = (__pyx_v_bfmt != Py_None);
+ __pyx_t_18 = (__pyx_t_1 != 0);
+ __pyx_t_17 = __pyx_t_18;
+ __pyx_L36_bool_binop_done:;
+ if (__pyx_t_17) {
+
+ /* "buffers.pxd":194
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii') # <<<<<<<<<<<<<<
+ * return bfmt
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bfmt, __pyx_n_s_decode); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":195
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii')
+ * return bfmt # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_bfmt);
+ __pyx_r = __pyx_v_bfmt;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":114
+ *
+ *
+ * cdef inline object asbuffer(object ob, int writable, int format, # <<<<<<<<<<<<<<
+ * void **base, Py_ssize_t *size,
+ * Py_ssize_t *itemsize):
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_14);
+ __Pyx_XDECREF(__pyx_t_15);
+ __Pyx_XDECREF(__pyx_t_16);
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_bfmt);
+ __Pyx_XDECREF(__pyx_v_dtype);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":198
+ *
+ *
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer_r", 0);
+
+ /* "buffers.pxd":200
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size):
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL) # <<<<<<<<<<<<<<
+ * return ob
+ *
+ */
+ __pyx_t_1 = __pyx_f_7buffers_asbuffer(__pyx_v_ob, 0, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "buffers.pxd":201
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ * return ob # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ob);
+ __pyx_r = __pyx_v_ob;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":198
+ *
+ *
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.asbuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":204
+ *
+ *
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_w(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer_w", 0);
+
+ /* "buffers.pxd":206
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size):
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL) # <<<<<<<<<<<<<<
+ * return ob
+ *
+ */
+ __pyx_t_1 = __pyx_f_7buffers_asbuffer(__pyx_v_ob, 1, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "buffers.pxd":207
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ * return ob # <<<<<<<<<<<<<<
+ *
+ * #------------------------------------------------------------------------------
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ob);
+ __pyx_r = __pyx_v_ob;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":204
+ *
+ *
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.asbuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":214
+ *
+ *
+ * cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 3 version of frombuffer.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ Py_buffer __pyx_v_pybuf;
+ Py_ssize_t *__pyx_v_shape;
+ PyObject *__pyx_v_astr = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ Py_ssize_t __pyx_t_1[1];
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_3", 0);
+
+ /* "buffers.pxd":221
+ * """
+ * cdef Py_buffer pybuf
+ * cdef Py_ssize_t *shape = [s] # <<<<<<<<<<<<<<
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ */
+ __pyx_t_1[0] = __pyx_v_s;
+ __pyx_v_shape = __pyx_t_1;
+
+ /* "buffers.pxd":222
+ * cdef Py_buffer pybuf
+ * cdef Py_ssize_t *shape = [s]
+ * cdef str astr="" # <<<<<<<<<<<<<<
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B"
+ */
+ __Pyx_INCREF(__pyx_kp_s__7);
+ __pyx_v_astr = __pyx_kp_s__7;
+
+ /* "buffers.pxd":223
+ * cdef Py_ssize_t *shape = [s]
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE) # <<<<<<<<<<<<<<
+ * pybuf.format = "B"
+ * pybuf.shape = shape
+ */
+ __pyx_t_2 = PyBuffer_FillInfo((&__pyx_v_pybuf), __pyx_v_astr, __pyx_v_ptr, __pyx_v_s, __pyx_v_readonly, PyBUF_SIMPLE); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "buffers.pxd":224
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B" # <<<<<<<<<<<<<<
+ * pybuf.shape = shape
+ * pybuf.ndim = 1
+ */
+ __pyx_v_pybuf.format = __pyx_k_B;
+
+ /* "buffers.pxd":225
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B"
+ * pybuf.shape = shape # <<<<<<<<<<<<<<
+ * pybuf.ndim = 1
+ * return PyMemoryView_FromBuffer(&pybuf)
+ */
+ __pyx_v_pybuf.shape = __pyx_v_shape;
+
+ /* "buffers.pxd":226
+ * pybuf.format = "B"
+ * pybuf.shape = shape
+ * pybuf.ndim = 1 # <<<<<<<<<<<<<<
+ * return PyMemoryView_FromBuffer(&pybuf)
+ *
+ */
+ __pyx_v_pybuf.ndim = 1;
+
+ /* "buffers.pxd":227
+ * pybuf.shape = shape
+ * pybuf.ndim = 1
+ * return PyMemoryView_FromBuffer(&pybuf) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = PyMemoryView_FromBuffer((&__pyx_v_pybuf)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":214
+ *
+ *
+ * cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 3 version of frombuffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("buffers.frombuffer_3", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_astr);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":230
+ *
+ *
+ * cdef inline object frombuffer_2(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 2 version of frombuffer.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_2", 0);
+
+ /* "buffers.pxd":236
+ * """
+ *
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * if readonly:
+ * return PyBuffer_FromMemory(ptr, s)
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":237
+ *
+ * if oldstyle_available():
+ * if readonly: # <<<<<<<<<<<<<<
+ * return PyBuffer_FromMemory(ptr, s)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_readonly != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":238
+ * if oldstyle_available():
+ * if readonly:
+ * return PyBuffer_FromMemory(ptr, s) # <<<<<<<<<<<<<<
+ * else:
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":240
+ * return PyBuffer_FromMemory(ptr, s)
+ * else:
+ * return PyBuffer_FromReadWriteMemory(ptr, s) # <<<<<<<<<<<<<<
+ * else:
+ * raise NotImplementedError("Old style buffers not available.")
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromReadWriteMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":242
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ * else:
+ * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "buffers.pxd":230
+ *
+ *
+ * cdef inline object frombuffer_2(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 2 version of frombuffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.frombuffer_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":245
+ *
+ *
+ * cdef inline object frombuffer(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Create a Python Buffer/View of a C array.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer", 0);
+
+ /* "buffers.pxd":262
+ * """
+ * # oldstyle first priority for now
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * return frombuffer_2(ptr, s, readonly)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":263
+ * # oldstyle first priority for now
+ * if oldstyle_available():
+ * return frombuffer_2(ptr, s, readonly) # <<<<<<<<<<<<<<
+ * else:
+ * return frombuffer_3(ptr, s, readonly)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_f_7buffers_frombuffer_2(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":265
+ * return frombuffer_2(ptr, s, readonly)
+ * else:
+ * return frombuffer_3(ptr, s, readonly) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_f_7buffers_frombuffer_3(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":245
+ *
+ *
+ * cdef inline object frombuffer(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Create a Python Buffer/View of a C array.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.frombuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":268
+ *
+ *
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_r(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_r", 0);
+
+ /* "buffers.pxd":270
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s):
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":268
+ *
+ *
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.frombuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":273
+ *
+ *
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_w(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_w", 0);
+
+ /* "buffers.pxd":275
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s):
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0) # <<<<<<<<<<<<<<
+ *
+ * #------------------------------------------------------------------------------
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":273
+ *
+ *
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.frombuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":282
+ * #------------------------------------------------------------------------------
+ *
+ * cdef inline object viewfromobject(object obj, int readonly): # <<<<<<<<<<<<<<
+ * """Construct a Python Buffer/View object from another Python object.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *__pyx_v_obj, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject", 0);
+
+ /* "buffers.pxd":298
+ * Buffer/View of the original object.
+ * """
+ * if not memoryview_available(): # <<<<<<<<<<<<<<
+ * if readonly:
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ */
+ __pyx_t_1 = ((!(__pyx_f_7buffers_memoryview_available() != 0)) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":299
+ * """
+ * if not memoryview_available():
+ * if readonly: # <<<<<<<<<<<<<<
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_readonly != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":300
+ * if not memoryview_available():
+ * if readonly:
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
+ * else:
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromObject(__pyx_v_obj, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":302
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
+ * else:
+ * return PyMemoryView_FromObject(obj)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromReadWriteObject(__pyx_v_obj, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":304
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ * return PyMemoryView_FromObject(obj) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyMemoryView_FromObject(__pyx_v_obj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":282
+ * #------------------------------------------------------------------------------
+ *
+ * cdef inline object viewfromobject(object obj, int readonly): # <<<<<<<<<<<<<<
+ * """Construct a Python Buffer/View object from another Python object.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.viewfromobject", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":307
+ *
+ *
+ * cdef inline object viewfromobject_r(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *__pyx_v_obj) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject_r", 0);
+
+ /* "buffers.pxd":309
+ * cdef inline object viewfromobject_r(object obj):
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_viewfromobject(__pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":307
+ *
+ *
+ * cdef inline object viewfromobject_r(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.viewfromobject_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":312
+ *
+ *
+ * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_w(PyObject *__pyx_v_obj) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject_w", 0);
+
+ /* "buffers.pxd":314
+ * cdef inline object viewfromobject_w(object obj):
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0) # <<<<<<<<<<<<<<
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_viewfromobject(__pyx_v_obj, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":312
+ *
+ *
+ * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.viewfromobject_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_7message_MessageTracker(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker *)o);
+ p->events = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ p->peers = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ return o;
+}
+
+static void __pyx_tp_dealloc_3zmq_7backend_6cython_7message_MessageTracker(PyObject *o) {
+ struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker *p = (struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->events);
+ Py_CLEAR(p->peers);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_3zmq_7backend_6cython_7message_MessageTracker(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker *p = (struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker *)o;
+ if (p->events) {
+ e = (*v)(p->events, a); if (e) return e;
+ }
+ if (p->peers) {
+ e = (*v)(p->peers, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_3zmq_7backend_6cython_7message_MessageTracker(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker *p = (struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker *)o;
+ tmp = ((PyObject*)p->events);
+ p->events = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->peers);
+ p->peers = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyTypeObject __pyx_type_3zmq_7backend_6cython_7message_MessageTracker = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "zmq.backend.cython.message.MessageTracker", /*tp_name*/
+ sizeof(struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_3zmq_7backend_6cython_7message_MessageTracker, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_doc*/
+ __pyx_tp_traverse_3zmq_7backend_6cython_7message_MessageTracker, /*tp_traverse*/
+ __pyx_tp_clear_3zmq_7backend_6cython_7message_MessageTracker, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ 0, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_3zmq_7backend_6cython_7message_MessageTracker, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame __pyx_vtable_3zmq_7backend_6cython_7message_Frame;
+
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_7message_Frame(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)o);
+ p->__pyx_vtab = __pyx_vtabptr_3zmq_7backend_6cython_7message_Frame;
+ p->_data = Py_None; Py_INCREF(Py_None);
+ p->_buffer = Py_None; Py_INCREF(Py_None);
+ p->_bytes = Py_None; Py_INCREF(Py_None);
+ p->tracker_event = Py_None; Py_INCREF(Py_None);
+ p->tracker = Py_None; Py_INCREF(Py_None);
+ if (unlikely(__pyx_pw_3zmq_7backend_6cython_7message_5Frame_1__cinit__(o, a, k) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
+ return o;
+}
+
+static void __pyx_tp_dealloc_3zmq_7backend_6cython_7message_Frame(PyObject *o) {
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *p = (struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ PyObject_GC_UnTrack(o);
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_3zmq_7backend_6cython_7message_5Frame_5__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ Py_CLEAR(p->_data);
+ Py_CLEAR(p->_buffer);
+ Py_CLEAR(p->_bytes);
+ Py_CLEAR(p->tracker_event);
+ Py_CLEAR(p->tracker);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_3zmq_7backend_6cython_7message_Frame(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *p = (struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)o;
+ if (p->_data) {
+ e = (*v)(p->_data, a); if (e) return e;
+ }
+ if (p->_buffer) {
+ e = (*v)(p->_buffer, a); if (e) return e;
+ }
+ if (p->_bytes) {
+ e = (*v)(p->_bytes, a); if (e) return e;
+ }
+ if (p->tracker_event) {
+ e = (*v)(p->tracker_event, a); if (e) return e;
+ }
+ if (p->tracker) {
+ e = (*v)(p->tracker, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_3zmq_7backend_6cython_7message_Frame(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *p = (struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)o;
+ tmp = ((PyObject*)p->_data);
+ p->_data = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->_buffer);
+ p->_buffer = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->_bytes);
+ p->_bytes = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->tracker_event);
+ p->tracker_event = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->tracker);
+ p->tracker = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyObject *__pyx_getprop_3zmq_7backend_6cython_7message_5Frame_tracker_event(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_1__get__(o);
+}
+
+static int __pyx_setprop_3zmq_7backend_6cython_7message_5Frame_tracker_event(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_3zmq_7backend_6cython_7message_5Frame_13tracker_event_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_3zmq_7backend_6cython_7message_5Frame_tracker(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_1__get__(o);
+}
+
+static int __pyx_setprop_3zmq_7backend_6cython_7message_5Frame_tracker(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7tracker_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_3zmq_7backend_6cython_7message_5Frame_more(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_3zmq_7backend_6cython_7message_5Frame_4more_1__get__(o);
+}
+
+static int __pyx_setprop_3zmq_7backend_6cython_7message_5Frame_more(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_3zmq_7backend_6cython_7message_5Frame_4more_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_3zmq_7backend_6cython_7message_Frame[] = {
+ {"__copy__", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7message_5Frame_13__copy__, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_7message_5Frame_12__copy__},
+ {"buffer", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7message_5Frame_19buffer, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_7message_5Frame_18buffer},
+ {"bytes", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7message_5Frame_21bytes, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_7message_5Frame_20bytes},
+ {"set", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7message_5Frame_23set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_7message_5Frame_22set},
+ {"get", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_7message_5Frame_25get, METH_O, __pyx_doc_3zmq_7backend_6cython_7message_5Frame_24get},
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_3zmq_7backend_6cython_7message_Frame[] = {
+ {(char *)"tracker_event", __pyx_getprop_3zmq_7backend_6cython_7message_5Frame_tracker_event, __pyx_setprop_3zmq_7backend_6cython_7message_5Frame_tracker_event, 0, 0},
+ {(char *)"tracker", __pyx_getprop_3zmq_7backend_6cython_7message_5Frame_tracker, __pyx_setprop_3zmq_7backend_6cython_7message_5Frame_tracker, 0, 0},
+ {(char *)"more", __pyx_getprop_3zmq_7backend_6cython_7message_5Frame_more, __pyx_setprop_3zmq_7backend_6cython_7message_5Frame_more, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_Frame = {
+ __pyx_pw_3zmq_7backend_6cython_7message_5Frame_15__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ 0, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_Frame = {
+ __pyx_pw_3zmq_7backend_6cython_7message_5Frame_15__len__, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer_Frame = {
+ #if PY_MAJOR_VERSION < 3
+ __pyx_pw_3zmq_7backend_6cython_7message_5Frame_11__getreadbuffer__, /*bf_getreadbuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getwritebuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ __pyx_pw_3zmq_7backend_6cython_7message_5Frame_9__getsegcount__, /*bf_getsegcount*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getcharbuffer*/
+ #endif
+ __pyx_pw_3zmq_7backend_6cython_7message_5Frame_7__getbuffer__, /*bf_getbuffer*/
+ 0, /*bf_releasebuffer*/
+};
+
+static PyTypeObject __pyx_type_3zmq_7backend_6cython_7message_Frame = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "zmq.backend.cython.message.Frame", /*tp_name*/
+ sizeof(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_3zmq_7backend_6cython_7message_Frame, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ &__pyx_tp_as_sequence_Frame, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_Frame, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ __pyx_pw_3zmq_7backend_6cython_7message_5Frame_17__str__, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &__pyx_tp_as_buffer_Frame, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ "Frame(data=None, track=False)\n\n A zmq message Frame class for non-copy send/recvs.\n\n This class is only needed if you want to do non-copying send and recvs.\n When you pass a string to this class, like ``Frame(s)``, the \n ref-count of `s` is increased by two: once because the Frame saves `s` as \n an instance attribute and another because a ZMQ message is created that\n points to the buffer of `s`. This second ref-count increase makes sure\n that `s` lives until all messages that use it have been sent. Once 0MQ\n sends all the messages and it doesn't need the buffer of s, 0MQ will call\n ``Py_DECREF(s)``.\n\n Parameters\n ----------\n\n data : object, optional\n any object that provides the buffer interface will be used to\n construct the 0MQ message data.\n track : bool [default: False]\n whether a MessageTracker_ should be created to track this object.\n Tracking a message has a cost at creation, because it creates a threadsafe\n Event object.\n \n ", /*tp_doc*/
+ __pyx_tp_traverse_3zmq_7backend_6cython_7message_Frame, /*tp_traverse*/
+ __pyx_tp_clear_3zmq_7backend_6cython_7message_Frame, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_3zmq_7backend_6cython_7message_Frame, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_3zmq_7backend_6cython_7message_Frame, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_3zmq_7backend_6cython_7message_5Frame_3__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_3zmq_7backend_6cython_7message_Frame, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "message",
+ __pyx_k_0MQ_Message_related_classes, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_Again, __pyx_k_Again, sizeof(__pyx_k_Again), 0, 0, 1, 1},
+ {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
+ {&__pyx_n_b_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 0, 1},
+ {&__pyx_n_s_ContextTerminated, __pyx_k_ContextTerminated, sizeof(__pyx_k_ContextTerminated), 0, 0, 1, 1},
+ {&__pyx_n_s_Event, __pyx_k_Event, sizeof(__pyx_k_Event), 0, 0, 1, 1},
+ {&__pyx_n_s_Event_2, __pyx_k_Event_2, sizeof(__pyx_k_Event_2), 0, 0, 1, 1},
+ {&__pyx_n_s_Frame, __pyx_k_Frame, sizeof(__pyx_k_Frame), 0, 0, 1, 1},
+ {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
+ {&__pyx_n_s_InterruptedSystemCall, __pyx_k_InterruptedSystemCall, sizeof(__pyx_k_InterruptedSystemCall), 0, 0, 1, 1},
+ {&__pyx_n_s_Message, __pyx_k_Message, sizeof(__pyx_k_Message), 0, 0, 1, 1},
+ {&__pyx_n_s_MessageTracker, __pyx_k_MessageTracker, sizeof(__pyx_k_MessageTracker), 0, 0, 1, 1},
+ {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
+ {&__pyx_kp_s_Old_style_buffers_not_available, __pyx_k_Old_style_buffers_not_available, sizeof(__pyx_k_Old_style_buffers_not_available), 0, 0, 1, 0},
+ {&__pyx_n_s_SystemError, __pyx_k_SystemError, sizeof(__pyx_k_SystemError), 0, 0, 1, 1},
+ {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
+ {&__pyx_kp_s_Unicode_objects_not_allowed_Only, __pyx_k_Unicode_objects_not_allowed_Only, sizeof(__pyx_k_Unicode_objects_not_allowed_Only), 0, 0, 1, 0},
+ {&__pyx_n_s_ZMQError, __pyx_k_ZMQError, sizeof(__pyx_k_ZMQError), 0, 0, 1, 1},
+ {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0},
+ {&__pyx_kp_s_accessing_non_existent_buffer_se, __pyx_k_accessing_non_existent_buffer_se, sizeof(__pyx_k_accessing_non_existent_buffer_se), 0, 0, 1, 0},
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
+ {&__pyx_n_s_basestring, __pyx_k_basestring, sizeof(__pyx_k_basestring), 0, 0, 1, 1},
+ {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1},
+ {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
+ {&__pyx_n_s_char, __pyx_k_char, sizeof(__pyx_k_char), 0, 0, 1, 1},
+ {&__pyx_n_s_check_version, __pyx_k_check_version, sizeof(__pyx_k_check_version), 0, 0, 1, 1},
+ {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
+ {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
+ {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
+ {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
+ {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
+ {&__pyx_kp_s_expected_str_got_r, __pyx_k_expected_str_got_r, sizeof(__pyx_k_expected_str_got_r), 0, 0, 1, 0},
+ {&__pyx_n_s_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 0, 1, 1},
+ {&__pyx_kp_s_get_string_properties, __pyx_k_get_string_properties, sizeof(__pyx_k_get_string_properties), 0, 0, 1, 0},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_option, __pyx_k_option, sizeof(__pyx_k_option), 0, 0, 1, 1},
+ {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
+ {&__pyx_kp_s_r_does_not_provide_a_buffer_int, __pyx_k_r_does_not_provide_a_buffer_int, sizeof(__pyx_k_r_does_not_provide_a_buffer_int), 0, 0, 1, 0},
+ {&__pyx_n_s_store, __pyx_k_store, sizeof(__pyx_k_store), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1},
+ {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
+ {&__pyx_n_s_track, __pyx_k_track, sizeof(__pyx_k_track), 0, 0, 1, 1},
+ {&__pyx_n_s_typecode, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
+ {&__pyx_n_s_underlying, __pyx_k_underlying, sizeof(__pyx_k_underlying), 0, 0, 1, 1},
+ {&__pyx_n_s_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 0, 1, 1},
+ {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1},
+ {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq, __pyx_k_zmq, sizeof(__pyx_k_zmq), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_error, __pyx_k_zmq_error, sizeof(__pyx_k_zmq_error), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_utils_garbage, __pyx_k_zmq_utils_garbage, sizeof(__pyx_k_zmq_utils_garbage), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_utils_strtypes, __pyx_k_zmq_utils_strtypes, sizeof(__pyx_k_zmq_utils_strtypes), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_SystemError = __Pyx_GetBuiltinName(__pyx_n_s_SystemError); if (!__pyx_builtin_SystemError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "zmq/backend/cython/message.pyx":163
+ *
+ * if isinstance(data, unicode):
+ * raise TypeError("Unicode objects not allowed. Only: str/bytes, buffer interfaces.") # <<<<<<<<<<<<<<
+ *
+ * if data is None:
+ */
+ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Unicode_objects_not_allowed_Only); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+
+ /* "zmq/backend/cython/message.pyx":234
+ * cdef Py_ssize_t data_len_c
+ * if idx != 0:
+ * raise SystemError("accessing non-existent buffer segment") # <<<<<<<<<<<<<<
+ * # read-only, because we don't want to allow
+ * # editing of the message in-place
+ */
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_accessing_non_existent_buffer_se); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__2);
+ __Pyx_GIVEREF(__pyx_tuple__2);
+
+ /* "zmq/backend/cython/message.pyx":364
+ *
+ * # zmq_msg_gets
+ * _check_version((4,1), "get string properties") # <<<<<<<<<<<<<<
+ * if isinstance(option, unicode):
+ * option = option.encode('utf8')
+ */
+ __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_4, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+ __pyx_tuple__4 = PyTuple_Pack(2, __pyx_tuple__3, __pyx_kp_s_get_string_properties); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__4);
+ __Pyx_GIVEREF(__pyx_tuple__4);
+
+ /* "zmq/backend/cython/message.pyx":366
+ * _check_version((4,1), "get string properties")
+ * if isinstance(option, unicode):
+ * option = option.encode('utf8') # <<<<<<<<<<<<<<
+ *
+ * if not isinstance(option, bytes):
+ */
+ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__5);
+ __Pyx_GIVEREF(__pyx_tuple__5);
+
+ /* "buffers.pxd":194
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii') # <<<<<<<<<<<<<<
+ * return bfmt
+ *
+ */
+ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__6);
+ __Pyx_GIVEREF(__pyx_tuple__6);
+
+ /* "buffers.pxd":242
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ * else:
+ * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Old_style_buffers_not_available); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__8);
+ __Pyx_GIVEREF(__pyx_tuple__8);
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initmessage(void); /*proto*/
+PyMODINIT_FUNC initmessage(void)
+#else
+PyMODINIT_FUNC PyInit_message(void); /*proto*/
+PyMODINIT_FUNC PyInit_message(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_message(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("message", __pyx_methods, __pyx_k_0MQ_Message_related_classes, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython__message) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython.message")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython.message", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ if (PyType_Ready(&__pyx_type_3zmq_7backend_6cython_7message_MessageTracker) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_3zmq_7backend_6cython_7message_MessageTracker.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "MessageTracker", (PyObject *)&__pyx_type_3zmq_7backend_6cython_7message_MessageTracker) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3zmq_7backend_6cython_7message_MessageTracker = &__pyx_type_3zmq_7backend_6cython_7message_MessageTracker;
+ __pyx_vtabptr_3zmq_7backend_6cython_7message_Frame = &__pyx_vtable_3zmq_7backend_6cython_7message_Frame;
+ __pyx_vtable_3zmq_7backend_6cython_7message_Frame.fast_copy = (struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *(*)(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *))__pyx_f_3zmq_7backend_6cython_7message_5Frame_fast_copy;
+ __pyx_vtable_3zmq_7backend_6cython_7message_Frame._getbuffer = (PyObject *(*)(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *))__pyx_f_3zmq_7backend_6cython_7message_5Frame__getbuffer;
+ if (PyType_Ready(&__pyx_type_3zmq_7backend_6cython_7message_Frame) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_3zmq_7backend_6cython_7message_Frame.tp_print = 0;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_3zmq_7backend_6cython_7message_Frame, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_2__init__.doc = __pyx_doc_3zmq_7backend_6cython_7message_5Frame_2__init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_2__init__;
+ }
+ }
+ #endif
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_3zmq_7backend_6cython_7message_Frame, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_14__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_14__len__.doc = __pyx_doc_3zmq_7backend_6cython_7message_5Frame_14__len__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_14__len__;
+ }
+ }
+ #endif
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_3zmq_7backend_6cython_7message_Frame, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_16__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_16__str__.doc = __pyx_doc_3zmq_7backend_6cython_7message_5Frame_16__str__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_3zmq_7backend_6cython_7message_5Frame_16__str__;
+ }
+ }
+ #endif
+ if (__Pyx_SetVtable(__pyx_type_3zmq_7backend_6cython_7message_Frame.tp_dict, __pyx_vtabptr_3zmq_7backend_6cython_7message_Frame) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Frame", (PyObject *)&__pyx_type_3zmq_7backend_6cython_7message_Frame) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3zmq_7backend_6cython_7message_Frame = &__pyx_type_3zmq_7backend_6cython_7message_Frame;
+ /*--- Type import code ---*/
+ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
+ #if CYTHON_COMPILING_IN_PYPY
+ sizeof(PyTypeObject),
+ #else
+ sizeof(PyHeapTypeObject),
+ #endif
+ 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/message.pyx":43
+ * from libc.string cimport memcpy
+ *
+ * import time # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/message.pyx":45
+ * import time
+ *
+ * try: # <<<<<<<<<<<<<<
+ * # below 3.3
+ * from threading import _Event as Event
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_4);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/message.pyx":47
+ * try:
+ * # below 3.3
+ * from threading import _Event as Event # <<<<<<<<<<<<<<
+ * except (ImportError, AttributeError):
+ * # python throws ImportError, cython throws AttributeError
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_Event_2);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Event_2);
+ __Pyx_GIVEREF(__pyx_n_s_Event_2);
+ __pyx_t_5 = __Pyx_Import(__pyx_n_s_threading, __pyx_t_1, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Event_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_Event, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L9_try_end;
+ __pyx_L2_error:;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "zmq/backend/cython/message.pyx":48
+ * # below 3.3
+ * from threading import _Event as Event
+ * except (ImportError, AttributeError): # <<<<<<<<<<<<<<
+ * # python throws ImportError, cython throws AttributeError
+ * from threading import Event
+ */
+ __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError) || PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
+ if (__pyx_t_6) {
+ __Pyx_AddTraceback("zmq.backend.cython.message", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "zmq/backend/cython/message.pyx":50
+ * except (ImportError, AttributeError):
+ * # python throws ImportError, cython throws AttributeError
+ * from threading import Event # <<<<<<<<<<<<<<
+ *
+ * import zmq
+ */
+ __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_n_s_Event);
+ PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_Event);
+ __Pyx_GIVEREF(__pyx_n_s_Event);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_threading, __pyx_t_8, -1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_Event); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_Event, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L3_exception_handled;
+ }
+ goto __pyx_L4_except_error;
+ __pyx_L4_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L1_error;
+ __pyx_L3_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ __pyx_L9_try_end:;
+ }
+
+ /* "zmq/backend/cython/message.pyx":52
+ * from threading import Event
+ *
+ * import zmq # <<<<<<<<<<<<<<
+ * from zmq.error import _check_version
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ */
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_zmq, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_zmq, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/message.pyx":53
+ *
+ * import zmq
+ * from zmq.error import _check_version # <<<<<<<<<<<<<<
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ * from zmq.utils.strtypes import bytes,unicode,basestring
+ */
+ __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_n_s_check_version);
+ PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_check_version);
+ __Pyx_GIVEREF(__pyx_n_s_check_version);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_7, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_version); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_version, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/message.pyx":55
+ * from zmq.error import _check_version
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ * from zmq.utils.strtypes import bytes,unicode,basestring # <<<<<<<<<<<<<<
+ *
+ * #-----------------------------------------------------------------------------
+ */
+ __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_bytes);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_bytes);
+ __Pyx_GIVEREF(__pyx_n_s_bytes);
+ __Pyx_INCREF(__pyx_n_s_unicode);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_unicode);
+ __Pyx_GIVEREF(__pyx_n_s_unicode);
+ __Pyx_INCREF(__pyx_n_s_basestring);
+ PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_basestring);
+ __Pyx_GIVEREF(__pyx_n_s_basestring);
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_zmq_utils_strtypes, __pyx_t_1, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_unicode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_basestring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_basestring, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/message.pyx":109
+ * free(hint)
+ *
+ * gc = None # <<<<<<<<<<<<<<
+ *
+ * cdef class Frame:
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_gc, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/message.pyx":307
+ *
+ * @property
+ * def buffer(self): # <<<<<<<<<<<<<<
+ * """A read-only buffer view of the message contents."""
+ * if self._buffer is None:
+ */
+ __pyx_t_7 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3zmq_7backend_6cython_7message_Frame, __pyx_n_s_buffer); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "zmq/backend/cython/message.pyx":306
+ * return viewfromobject_r(self._data)
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def buffer(self):
+ * """A read-only buffer view of the message contents."""
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_3zmq_7backend_6cython_7message_Frame->tp_dict, __pyx_n_s_buffer, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ PyType_Modified(__pyx_ptype_3zmq_7backend_6cython_7message_Frame);
+
+ /* "zmq/backend/cython/message.pyx":314
+ *
+ * @property
+ * def bytes(self): # <<<<<<<<<<<<<<
+ * """The message content as a Python bytes object.
+ *
+ */
+ __pyx_t_7 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3zmq_7backend_6cython_7message_Frame, __pyx_n_s_bytes); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "zmq/backend/cython/message.pyx":313
+ * return self._buffer
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def bytes(self):
+ * """The message content as a Python bytes object.
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_3zmq_7backend_6cython_7message_Frame->tp_dict, __pyx_n_s_bytes, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ PyType_Modified(__pyx_ptype_3zmq_7backend_6cython_7message_Frame);
+
+ /* "zmq/backend/cython/message.pyx":379
+ *
+ * # legacy Message name
+ * Message = Frame # <<<<<<<<<<<<<<
+ *
+ * __all__ = ['Frame', 'Message']
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_Message, ((PyObject *)((PyObject*)__pyx_ptype_3zmq_7backend_6cython_7message_Frame))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/message.pyx":381
+ * Message = Frame
+ *
+ * __all__ = ['Frame', 'Message'] # <<<<<<<<<<<<<<
+ */
+ __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_n_s_Frame);
+ PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_Frame);
+ __Pyx_GIVEREF(__pyx_n_s_Frame);
+ __Pyx_INCREF(__pyx_n_s_Message);
+ PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_Message);
+ __Pyx_GIVEREF(__pyx_n_s_Message);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/message.pyx":1
+ * """0MQ Message related classes.""" # <<<<<<<<<<<<<<
+ *
+ * #
+ */
+ __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "buffers.pxd":312
+ *
+ *
+ * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0)
+ */
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython.message", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython.message");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AsString(kw_name));
+ #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ continue;
+ }
+ name = first_kw_arg;
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+ while (*name) {
+ if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**name, key)) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ if ((**argname == key) || (
+ (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**argname, key))) {
+ goto arg_passed_twice;
+ }
+ argname++;
+ }
+ }
+ } else
+ #endif
+ if (likely(PyUnicode_Check(key))) {
+ while (*name) {
+ int cmp = (**name == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**name, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ int cmp = (**argname == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**argname, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) goto arg_passed_twice;
+ argname++;
+ }
+ }
+ } else
+ goto invalid_keyword_type;
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, key);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_Restore(type, value, tb);
+#endif
+}
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+ CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
+ int full_traceback) {
+ PyObject *old_exc, *old_val, *old_tb;
+ PyObject *ctx;
+ __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+ if (full_traceback) {
+ Py_XINCREF(old_exc);
+ Py_XINCREF(old_val);
+ Py_XINCREF(old_tb);
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ PyErr_PrintEx(1);
+ }
+ #if PY_MAJOR_VERSION < 3
+ ctx = PyString_FromString(name);
+ #else
+ ctx = PyUnicode_FromString(name);
+ #endif
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ if (!ctx) {
+ PyErr_WriteUnraisable(Py_None);
+ } else {
+ PyErr_WriteUnraisable(ctx);
+ Py_DECREF(ctx);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
+ const char* cstring, Py_ssize_t start, Py_ssize_t stop,
+ const char* encoding, const char* errors,
+ PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
+ Py_ssize_t length;
+ if (unlikely((start < 0) | (stop < 0))) {
+ length = strlen(cstring);
+ if (start < 0) {
+ start += length;
+ if (start < 0)
+ start = 0;
+ }
+ if (stop < 0)
+ stop += length;
+ }
+ length = stop - start;
+ if (unlikely(length <= 0))
+ return PyUnicode_FromUnicode(NULL, 0);
+ cstring += start;
+ if (decode_func) {
+ return decode_func(cstring, length, errors);
+ } else {
+ return PyUnicode_Decode(cstring, length, encoding, errors);
+ }
+}
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+#else
+ PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ local_type = tstate->curexc_type;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
+ PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
+ goto bad;
+ #if PY_MAJOR_VERSION >= 3
+ if (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
+ return 0;
+bad:
+ *type = 0;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000
+ PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+ PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+ if (!ob)
+ goto bad;
+ if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
+ goto bad;
+ Py_DECREF(ob);
+ return 0;
+bad:
+ Py_XDECREF(ob);
+ return -1;
+}
+
+static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
+ PyObject *result;
+ result = __Pyx_PyObject_GetAttrStr(nmspace, name);
+ if (!result)
+ result = __Pyx_GetModuleGlobalName(name);
+ return result;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
+ const size_t neg_one = (size_t) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(size_t) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (size_t) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(size_t) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(size_t) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong(x))
+ } else if (sizeof(size_t) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ size_t val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (size_t) -1;
+ }
+ } else {
+ size_t val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (size_t) -1;
+ val = __Pyx_PyInt_As_size_t(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to size_t");
+ return (size_t) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to size_t");
+ return (size_t) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+ PyObject *py_name = 0;
+ PyObject *py_module = 0;
+ py_name = __Pyx_PyIdentifier_FromString(name);
+ if (!py_name)
+ goto bad;
+ py_module = PyImport_Import(py_name);
+ Py_DECREF(py_name);
+ return py_module;
+bad:
+ Py_XDECREF(py_name);
+ return 0;
+}
+#endif
+
+#ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
+ size_t size, int strict)
+{
+ PyObject *py_module = 0;
+ PyObject *result = 0;
+ PyObject *py_name = 0;
+ char warning[200];
+ Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+ PyObject *py_basicsize;
+#endif
+ py_module = __Pyx_ImportModule(module_name);
+ if (!py_module)
+ goto bad;
+ py_name = __Pyx_PyIdentifier_FromString(class_name);
+ if (!py_name)
+ goto bad;
+ result = PyObject_GetAttr(py_module, py_name);
+ Py_DECREF(py_name);
+ py_name = 0;
+ Py_DECREF(py_module);
+ py_module = 0;
+ if (!result)
+ goto bad;
+ if (!PyType_Check(result)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s.%.200s is not a type object",
+ module_name, class_name);
+ goto bad;
+ }
+#ifndef Py_LIMITED_API
+ basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+ py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+ if (!py_basicsize)
+ goto bad;
+ basicsize = PyLong_AsSsize_t(py_basicsize);
+ Py_DECREF(py_basicsize);
+ py_basicsize = 0;
+ if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+ goto bad;
+#endif
+ if (!strict && (size_t)basicsize > size) {
+ PyOS_snprintf(warning, sizeof(warning),
+ "%s.%s size changed, may indicate binary incompatibility",
+ module_name, class_name);
+ if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
+ }
+ else if ((size_t)basicsize != size) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.%.200s has the wrong size, try recompiling",
+ module_name, class_name);
+ goto bad;
+ }
+ return (PyTypeObject *)result;
+bad:
+ Py_XDECREF(py_module);
+ Py_XDECREF(result);
+ return NULL;
+}
+#endif
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/zmq/backend/cython/message.pxd b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.pxd
index 4781195f..4781195f 100644
--- a/external_libs/python/zmq/backend/cython/message.pxd
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.pxd
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.pyx
new file mode 100644
index 00000000..8ae235de
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/message.pyx
@@ -0,0 +1,381 @@
+"""0MQ Message related classes."""
+
+#
+# Copyright (c) 2013 Brian E. Granger & Min Ragan-Kelley
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+# get version-independent aliases:
+cdef extern from "pyversion_compat.h":
+ pass
+
+from cpython cimport Py_DECREF, Py_INCREF
+
+from buffers cimport asbuffer_r, viewfromobject_r
+
+cdef extern from "Python.h":
+ ctypedef int Py_ssize_t
+
+from libzmq cimport *
+
+from libc.stdio cimport fprintf, stderr as cstderr
+from libc.stdlib cimport malloc, free
+from libc.string cimport memcpy
+
+import time
+
+try:
+ # below 3.3
+ from threading import _Event as Event
+except (ImportError, AttributeError):
+ # python throws ImportError, cython throws AttributeError
+ from threading import Event
+
+import zmq
+from zmq.error import _check_version
+from zmq.backend.cython.checkrc cimport _check_rc
+from zmq.utils.strtypes import bytes,unicode,basestring
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+ctypedef struct zhint:
+ void *ctx
+ size_t id
+
+cdef void free_python_msg(void *data, void *vhint) nogil:
+ """A pure-C function for DECREF'ing Python-owned message data.
+
+ Sends a message on a PUSH socket
+
+ The hint is a `zhint` struct with two values:
+
+ ctx (void *): pointer to the Garbage Collector's context
+ id (size_t): the id to be used to construct a zmq_msg_t that should be sent on a PUSH socket,
+ signaling the Garbage Collector to remove its reference to the object.
+
+ - A PUSH socket is created in the context,
+ - it is connected to the garbage collector inproc channel,
+ - it sends the gc message
+ - the PUSH socket is closed
+
+ When the Garbage Collector's PULL socket receives the message,
+ it deletes its reference to the object,
+ allowing Python to free the memory.
+ """
+ cdef void *push
+ cdef zmq_msg_t msg
+ cdef zhint *hint = <zhint *> vhint
+ if hint != NULL:
+ zmq_msg_init_size(&msg, sizeof(size_t))
+ memcpy(zmq_msg_data(&msg), &hint.id, sizeof(size_t))
+
+ push = zmq_socket(hint.ctx, ZMQ_PUSH)
+ if push == NULL:
+ # this will happen if the context has been terminated
+ return
+ rc = zmq_connect(push, "inproc://pyzmq.gc.01")
+ if rc < 0:
+ fprintf(cstderr, "pyzmq-gc connect failed: %s\n", zmq_strerror(zmq_errno()))
+ return
+
+ rc = zmq_msg_send(&msg, push, 0)
+ if rc < 0:
+ fprintf(cstderr, "pyzmq-gc send failed: %s\n", zmq_strerror(zmq_errno()))
+
+ zmq_msg_close(&msg)
+ zmq_close(push)
+ free(hint)
+
+gc = None
+
+cdef class Frame:
+ """Frame(data=None, track=False)
+
+ A zmq message Frame class for non-copy send/recvs.
+
+ This class is only needed if you want to do non-copying send and recvs.
+ When you pass a string to this class, like ``Frame(s)``, the
+ ref-count of `s` is increased by two: once because the Frame saves `s` as
+ an instance attribute and another because a ZMQ message is created that
+ points to the buffer of `s`. This second ref-count increase makes sure
+ that `s` lives until all messages that use it have been sent. Once 0MQ
+ sends all the messages and it doesn't need the buffer of s, 0MQ will call
+ ``Py_DECREF(s)``.
+
+ Parameters
+ ----------
+
+ data : object, optional
+ any object that provides the buffer interface will be used to
+ construct the 0MQ message data.
+ track : bool [default: False]
+ whether a MessageTracker_ should be created to track this object.
+ Tracking a message has a cost at creation, because it creates a threadsafe
+ Event object.
+
+ """
+
+ def __cinit__(self, object data=None, track=False, **kwargs):
+ cdef int rc
+ cdef char *data_c = NULL
+ cdef Py_ssize_t data_len_c=0
+ cdef zhint *hint
+
+ # init more as False
+ self.more = False
+
+ # Save the data object in case the user wants the the data as a str.
+ self._data = data
+ self._failed_init = True # bool switch for dealloc
+ self._buffer = None # buffer view of data
+ self._bytes = None # bytes copy of data
+
+ # Event and MessageTracker for monitoring when zmq is done with data:
+ if track:
+ evt = Event()
+ self.tracker_event = evt
+ self.tracker = zmq.MessageTracker(evt)
+ else:
+ self.tracker_event = None
+ self.tracker = None
+
+ if isinstance(data, unicode):
+ raise TypeError("Unicode objects not allowed. Only: str/bytes, buffer interfaces.")
+
+ if data is None:
+ rc = zmq_msg_init(&self.zmq_msg)
+ _check_rc(rc)
+ self._failed_init = False
+ return
+ else:
+ asbuffer_r(data, <void **>&data_c, &data_len_c)
+
+ # create the hint for zmq_free_fn
+ # two pointers: the gc context and a message to be sent to the gc PULL socket
+ # allows libzmq to signal to Python when it is done with Python-owned memory.
+ global gc
+ if gc is None:
+ from zmq.utils.garbage import gc
+
+ hint = <zhint *> malloc(sizeof(zhint))
+ hint.id = gc.store(data, self.tracker_event)
+ hint.ctx = <void *> <size_t> gc._context.underlying
+
+ rc = zmq_msg_init_data(
+ &self.zmq_msg, <void *>data_c, data_len_c,
+ <zmq_free_fn *>free_python_msg, <void *>hint
+ )
+ if rc != 0:
+ free(hint)
+ _check_rc(rc)
+ self._failed_init = False
+
+ def __init__(self, object data=None, track=False):
+ """Enforce signature"""
+ pass
+
+ def __dealloc__(self):
+ cdef int rc
+ if self._failed_init:
+ return
+ # This simply decreases the 0MQ ref-count of zmq_msg.
+ with nogil:
+ rc = zmq_msg_close(&self.zmq_msg)
+ _check_rc(rc)
+
+ # buffer interface code adapted from petsc4py by Lisandro Dalcin, a BSD project
+
+ def __getbuffer__(self, Py_buffer* buffer, int flags):
+ # new-style (memoryview) buffer interface
+ buffer.buf = zmq_msg_data(&self.zmq_msg)
+ buffer.len = zmq_msg_size(&self.zmq_msg)
+
+ buffer.obj = self
+ buffer.readonly = 1
+ buffer.format = "B"
+ buffer.ndim = 1
+ buffer.shape = &(buffer.len)
+ buffer.strides = NULL
+ buffer.suboffsets = NULL
+ buffer.itemsize = 1
+ buffer.internal = NULL
+
+ def __getsegcount__(self, Py_ssize_t *lenp):
+ # required for getreadbuffer
+ if lenp != NULL:
+ lenp[0] = zmq_msg_size(&self.zmq_msg)
+ return 1
+
+ def __getreadbuffer__(self, Py_ssize_t idx, void **p):
+ # old-style (buffer) interface
+ cdef char *data_c = NULL
+ cdef Py_ssize_t data_len_c
+ if idx != 0:
+ raise SystemError("accessing non-existent buffer segment")
+ # read-only, because we don't want to allow
+ # editing of the message in-place
+ data_c = <char *>zmq_msg_data(&self.zmq_msg)
+ data_len_c = zmq_msg_size(&self.zmq_msg)
+ if p != NULL:
+ p[0] = <void*>data_c
+ return data_len_c
+
+ # end buffer interface
+
+ def __copy__(self):
+ """Create a shallow copy of the message.
+
+ This does not copy the contents of the Frame, just the pointer.
+ This will increment the 0MQ ref count of the message, but not
+ the ref count of the Python object. That is only done once when
+ the Python is first turned into a 0MQ message.
+ """
+ return self.fast_copy()
+
+ cdef Frame fast_copy(self):
+ """Fast, cdef'd version of shallow copy of the Frame."""
+ cdef Frame new_msg
+ new_msg = Frame()
+ # This does not copy the contents, but just increases the ref-count
+ # of the zmq_msg by one.
+ zmq_msg_copy(&new_msg.zmq_msg, &self.zmq_msg)
+ # Copy the ref to data so the copy won't create a copy when str is
+ # called.
+ if self._data is not None:
+ new_msg._data = self._data
+ if self._buffer is not None:
+ new_msg._buffer = self._buffer
+ if self._bytes is not None:
+ new_msg._bytes = self._bytes
+
+ # Frame copies share the tracker and tracker_event
+ new_msg.tracker_event = self.tracker_event
+ new_msg.tracker = self.tracker
+
+ return new_msg
+
+ def __len__(self):
+ """Return the length of the message in bytes."""
+ cdef size_t sz
+ sz = zmq_msg_size(&self.zmq_msg)
+ return sz
+ # return <int>zmq_msg_size(&self.zmq_msg)
+
+ def __str__(self):
+ """Return the str form of the message."""
+ if isinstance(self._data, bytes):
+ b = self._data
+ else:
+ b = self.bytes
+ if str is unicode:
+ return b.decode()
+ else:
+ return b
+
+ cdef inline object _getbuffer(self):
+ """Create a Python buffer/view of the message data.
+
+ This will be called only once, the first time the `buffer` property
+ is accessed. Subsequent calls use a cached copy.
+ """
+ if self._data is None:
+ return viewfromobject_r(self)
+ else:
+ return viewfromobject_r(self._data)
+
+ @property
+ def buffer(self):
+ """A read-only buffer view of the message contents."""
+ if self._buffer is None:
+ self._buffer = self._getbuffer()
+ return self._buffer
+
+ @property
+ def bytes(self):
+ """The message content as a Python bytes object.
+
+ The first time this property is accessed, a copy of the message
+ contents is made. From then on that same copy of the message is
+ returned.
+ """
+ if self._bytes is None:
+ self._bytes = copy_zmq_msg_bytes(&self.zmq_msg)
+ return self._bytes
+
+ def set(self, int option, int value):
+ """Frame.set(option, value)
+
+ Set a Frame option.
+
+ See the 0MQ API documentation for zmq_msg_set
+ for details on specific options.
+
+ .. versionadded:: libzmq-3.2
+ .. versionadded:: 13.0
+ """
+ cdef int rc = zmq_msg_set(&self.zmq_msg, option, value)
+ _check_rc(rc)
+
+ def get(self, option):
+ """Frame.get(option)
+
+ Get a Frame option or property.
+
+ See the 0MQ API documentation for zmq_msg_get and zmq_msg_gets
+ for details on specific options.
+
+ .. versionadded:: libzmq-3.2
+ .. versionadded:: 13.0
+
+ .. versionchanged:: 14.3
+ add support for zmq_msg_gets (requires libzmq-4.1)
+ """
+ cdef int rc = 0
+ cdef char *property_c = NULL
+ cdef Py_ssize_t property_len_c = 0
+
+ # zmq_msg_get
+ if isinstance(option, int):
+ rc = zmq_msg_get(&self.zmq_msg, option)
+ _check_rc(rc)
+ return rc
+
+ # zmq_msg_gets
+ _check_version((4,1), "get string properties")
+ if isinstance(option, unicode):
+ option = option.encode('utf8')
+
+ if not isinstance(option, bytes):
+ raise TypeError("expected str, got: %r" % option)
+
+ property_c = option
+
+ cdef const char *result = <char *>zmq_msg_gets(&self.zmq_msg, property_c)
+ if result == NULL:
+ _check_rc(-1)
+ return result.decode('utf8')
+
+# legacy Message name
+Message = Frame
+
+__all__ = ['Frame', 'Message']
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/rebuffer.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/rebuffer.pyx
new file mode 100644
index 00000000..402e3b6e
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/rebuffer.pyx
@@ -0,0 +1,104 @@
+"""
+Utility for changing itemsize of memoryviews, and getting
+numpy arrays from byte-arrays that should be interpreted with a different
+itemsize.
+
+Authors
+-------
+* MinRK
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010-2012 Brian Granger, Min Ragan-Kelley
+#
+# This file is part of pyzmq
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+from libc.stdlib cimport malloc
+from buffers cimport *
+
+cdef inline object _rebuffer(object obj, char * format, int itemsize):
+ """clobber the format & itemsize of a 1-D
+
+ This is the Python 3 model, but will work on Python >= 2.6. Currently,
+ we use it only on >= 3.0.
+ """
+ cdef Py_buffer view
+ cdef int flags = PyBUF_SIMPLE
+ cdef int mode = 0
+ # cdef Py_ssize_t *shape, *strides, *suboffsets
+
+ mode = check_buffer(obj)
+ if mode == 0:
+ raise TypeError("%r does not provide a buffer interface."%obj)
+
+ if mode == 3:
+ flags = PyBUF_ANY_CONTIGUOUS
+ if format:
+ flags |= PyBUF_FORMAT
+ PyObject_GetBuffer(obj, &view, flags)
+ assert view.ndim <= 1, "Can only reinterpret 1-D memoryviews"
+ assert view.len % itemsize == 0, "Buffer of length %i not divisible into items of size %i"%(view.len, itemsize)
+ # hack the format
+ view.ndim = 1
+ view.format = format
+ view.itemsize = itemsize
+ view.strides = <Py_ssize_t *>malloc(sizeof(Py_ssize_t))
+ view.strides[0] = itemsize
+ view.shape = <Py_ssize_t *>malloc(sizeof(Py_ssize_t))
+ view.shape[0] = view.len/itemsize
+ view.suboffsets = <Py_ssize_t *>malloc(sizeof(Py_ssize_t))
+ view.suboffsets[0] = 0
+ # for debug: make buffer writable, for zero-copy testing
+ # view.readonly = 0
+
+ return PyMemoryView_FromBuffer(&view)
+ else:
+ raise TypeError("This funciton is only for new-style buffer objects.")
+
+def rebuffer(obj, format, itemsize):
+ """Change the itemsize of a memoryview.
+
+ Only for 1D contiguous buffers.
+ """
+ return _rebuffer(obj, format, itemsize)
+
+def array_from_buffer(view, dtype, shape):
+ """Get a numpy array from a memoryview, regardless of the itemsize of the original
+ memoryview. This is important, because pyzmq does not send memoryview shape data
+ over the wire, so we need to change the memoryview itemsize before calling
+ asarray.
+ """
+ import numpy
+ A = numpy.array([],dtype=dtype)
+ ref = viewfromobject(A,0)
+ fmt = ref.format.encode()
+ buf = viewfromobject(view, 0)
+ buf = _rebuffer(view, fmt, ref.itemsize)
+ return numpy.asarray(buf, dtype=dtype).reshape(shape)
+
+def print_view_info(obj):
+ """simple utility for printing info on a new-style buffer object"""
+ cdef Py_buffer view
+ cdef int flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT
+ cdef int mode = 0
+
+ mode = check_buffer(obj)
+ if mode == 0:
+ raise TypeError("%r does not provide a buffer interface."%obj)
+
+ if mode == 3:
+ PyObject_GetBuffer(obj, &view, flags)
+ print <size_t>view.buf, view.len, view.format, view.ndim,
+ if view.ndim:
+ if view.shape:
+ print view.shape[0],
+ if view.strides:
+ print view.strides[0],
+ if view.suboffsets:
+ print view.suboffsets[0],
+ print
+ \ No newline at end of file
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.c
new file mode 100644
index 00000000..535072c8
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.c
@@ -0,0 +1,11739 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython__socket
+#define __PYX_HAVE_API__zmq__backend__cython__socket
+#include "pyversion_compat.h"
+#include "errno.h"
+#include "string.h"
+#include "stdio.h"
+#include "pythread.h"
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#include "ipcmaxlen.h"
+#include "getpid_compat.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/socket.pyx",
+ "zmq/backend/cython/socket.pxd",
+ "zmq/backend/cython/checkrc.pxd",
+ "zmq/backend/cython/message.pxd",
+ "zmq/utils/buffers.pxd",
+ "zmq/backend/cython/context.pxd",
+ "type.pxd",
+ "bool.pxd",
+ "complex.pxd",
+};
+
+/*--- Type declarations ---*/
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context;
+struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker;
+struct __pyx_obj_3zmq_7backend_6cython_7message_Frame;
+struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy;
+
+/* "zmq/backend/cython/socket.pxd":45
+ *
+ * # cpdef methods for direct-cython access:
+ * cpdef object send(self, object data, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
+ * cpdef object recv(self, int flags=*, copy=*, track=*)
+ *
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send {
+ int __pyx_n;
+ int flags;
+ PyObject *copy;
+ PyObject *track;
+};
+
+/* "zmq/backend/cython/socket.pxd":46
+ * # cpdef methods for direct-cython access:
+ * cpdef object send(self, object data, int flags=*, copy=*, track=*)
+ * cpdef object recv(self, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
+ *
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv {
+ int __pyx_n;
+ int flags;
+ PyObject *copy;
+ PyObject *track;
+};
+
+/* "zmq/backend/cython/socket.pyx":121
+ * return False
+ *
+ * cdef inline Frame _recv_frame(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
+ * """Receive a message in a non-copying manner and return a Frame."""
+ * cdef int rc
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame {
+ int __pyx_n;
+ int flags;
+ PyObject *track;
+};
+
+/* "zmq/backend/cython/socket.pyx":138
+ * return msg
+ *
+ * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
+ * """Receive a message and return a copy"""
+ * cdef zmq_msg_t zmq_msg
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy {
+ int __pyx_n;
+ int flags;
+};
+
+/* "zmq/backend/cython/socket.pyx":156
+ * return msg_bytes
+ *
+ * cdef inline object _send_frame(void *handle, Frame msg, int flags=0): # <<<<<<<<<<<<<<
+ * """Send a Frame on this socket in a non-copy manner."""
+ * cdef int rc
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame {
+ int __pyx_n;
+ int flags;
+};
+
+/* "zmq/backend/cython/socket.pyx":178
+ *
+ *
+ * cdef inline object _send_copy(void *handle, object msg, int flags=0): # <<<<<<<<<<<<<<
+ * """Send a message on this socket by copying its content."""
+ * cdef int rc, rc2
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy {
+ int __pyx_n;
+ int flags;
+};
+
+/* "context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ void **_sockets;
+ size_t _n_sockets;
+ size_t _max_sockets;
+ int _pid;
+ int closed;
+};
+
+
+/* "message.pxd":34
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class MessageTracker(object): # <<<<<<<<<<<<<<
+ *
+ * cdef set events # Message Event objects to track.
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker {
+ PyObject_HEAD
+ PyObject *events;
+ PyObject *peers;
+};
+
+
+/* "message.pxd":40
+ *
+ *
+ * cdef class Frame: # <<<<<<<<<<<<<<
+ *
+ * cdef zmq_msg_t zmq_msg
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7message_Frame {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *__pyx_vtab;
+ zmq_msg_t zmq_msg;
+ PyObject *_data;
+ PyObject *_buffer;
+ PyObject *_bytes;
+ int _failed_init;
+ PyObject *tracker_event;
+ PyObject *tracker;
+ int more;
+};
+
+
+/* "zmq/backend/cython/socket.pxd":33
+ *
+ *
+ * cdef class Socket: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ struct __pyx_obj_3zmq_7backend_6cython_7context_Context *context;
+ int _closed;
+ int _pid;
+};
+
+
+
+/* "context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context {
+ int (*_term)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *);
+ void (*_add_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+ void (*_remove_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtabptr_3zmq_7backend_6cython_7context_Context;
+
+
+/* "message.pxd":40
+ *
+ *
+ * cdef class Frame: # <<<<<<<<<<<<<<
+ *
+ * cdef zmq_msg_t zmq_msg
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame {
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *(*fast_copy)(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *);
+ PyObject *(*_getbuffer)(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *__pyx_vtabptr_3zmq_7backend_6cython_7message_Frame;
+
+
+/* "zmq/backend/cython/socket.pyx":239
+ *
+ *
+ * cdef class Socket: # <<<<<<<<<<<<<<
+ * """Socket(context, socket_type)
+ *
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket {
+ PyObject *(*send)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args);
+ PyObject *(*recv)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket;
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+ const char* function_name);
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
+
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+ int lineno, const char *filename,
+ int full_traceback);
+
+static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
+ int result = PySequence_Contains(seq, item);
+ return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+}
+
+#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
+ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i))))
+#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
+ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
+ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck);
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable);
+
+static void* __Pyx_GetVtable(PyObject *dict);
+
+static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
+
+#ifndef __PYX_FORCE_INIT_THREADS
+ #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static CYTHON_INLINE pyzmq_int64_t __Pyx_PyInt_As_pyzmq_int64_t(PyObject *);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_pyzmq_int64_t(pyzmq_int64_t value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ZMQ_FD_T(ZMQ_FD_T value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
+
+static int __Pyx_check_binary_version(void);
+
+#if !defined(__Pyx_PyIdentifier_FromString)
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
+#else
+ #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
+#endif
+#endif
+
+static PyObject *__Pyx_ImportModule(const char *name);
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+static PyObject *__pyx_f_3zmq_7backend_6cython_6socket_6Socket_send(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args); /* proto*/
+static PyObject *__pyx_f_3zmq_7backend_6cython_6socket_6Socket_recv(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args); /* proto*/
+
+/* Module declarations from 'zmq.backend.cython.context' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7context_Context = 0;
+
+/* Module declarations from 'libc.errno' */
+
+/* Module declarations from 'libc.string' */
+
+/* Module declarations from 'cpython.version' */
+
+/* Module declarations from 'cpython.ref' */
+
+/* Module declarations from 'cpython.exc' */
+
+/* Module declarations from 'cpython.module' */
+
+/* Module declarations from 'cpython.mem' */
+
+/* Module declarations from 'cpython.tuple' */
+
+/* Module declarations from 'cpython.list' */
+
+/* Module declarations from 'libc.stdio' */
+
+/* Module declarations from 'cpython.object' */
+
+/* Module declarations from 'cpython.sequence' */
+
+/* Module declarations from 'cpython.mapping' */
+
+/* Module declarations from 'cpython.iterator' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
+
+/* Module declarations from 'cpython.number' */
+
+/* Module declarations from 'cpython.int' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.bool' */
+static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
+
+/* Module declarations from 'cpython.long' */
+
+/* Module declarations from 'cpython.float' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.complex' */
+static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
+
+/* Module declarations from 'cpython.string' */
+
+/* Module declarations from 'cpython.unicode' */
+
+/* Module declarations from 'cpython.dict' */
+
+/* Module declarations from 'cpython.instance' */
+
+/* Module declarations from 'cpython.function' */
+
+/* Module declarations from 'cpython.method' */
+
+/* Module declarations from 'cpython.weakref' */
+
+/* Module declarations from 'cpython.getargs' */
+
+/* Module declarations from 'cpython.pythread' */
+
+/* Module declarations from 'cpython.pystate' */
+
+/* Module declarations from 'cpython.cobject' */
+
+/* Module declarations from 'cpython.oldbuffer' */
+
+/* Module declarations from 'cpython.set' */
+
+/* Module declarations from 'cpython.buffer' */
+
+/* Module declarations from 'cpython.bytes' */
+
+/* Module declarations from 'cpython.pycapsule' */
+
+/* Module declarations from 'cpython' */
+
+/* Module declarations from 'buffers' */
+static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void); /*proto*/
+static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void); /*proto*/
+static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *, int, int, void **, Py_ssize_t *, Py_ssize_t *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *, void **, Py_ssize_t *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *); /*proto*/
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'zmq.backend.cython.message' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7message_MessageTracker = 0;
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7message_Frame = 0;
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_7message_copy_zmq_msg_bytes(zmq_msg_t *); /*proto*/
+
+/* Module declarations from 'zmq.backend.cython.checkrc' */
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int); /*proto*/
+
+/* Module declarations from 'zmq.backend.cython.socket' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_6socket_Socket = 0;
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__check_closed(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__check_closed_deep(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *); /*proto*/
+static CYTHON_INLINE struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_f_3zmq_7backend_6cython_6socket__recv_frame(void *, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame *__pyx_optional_args); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__recv_copy(void *, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy *__pyx_optional_args); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__send_frame(void *, struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame *__pyx_optional_args); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__send_copy(void *, PyObject *, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy *__pyx_optional_args); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__getsockopt(void *, int, void *, size_t *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__setsockopt(void *, int, void *, size_t); /*proto*/
+#define __Pyx_MODULE_NAME "zmq.backend.cython.socket"
+int __pyx_module_is_main_zmq__backend__cython__socket = 0;
+
+/* Implementation of 'zmq.backend.cython.socket' */
+static PyObject *__pyx_builtin_property;
+static PyObject *__pyx_builtin_TypeError;
+static PyObject *__pyx_builtin_ValueError;
+static PyObject *__pyx_builtin_AttributeError;
+static PyObject *__pyx_builtin_NotImplementedError;
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket___init__(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_socket_type, CYTHON_UNUSED PyObject *__pyx_v_shadow); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_2__cinit__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_context, int __pyx_v_socket_type, size_t __pyx_v_shadow, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
+static void __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_4__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_6underlying(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_8closed(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_10close(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_linger); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_12set(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_option, PyObject *__pyx_v_optval); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_14get(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_option); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_16bind(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_18connect(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_20unbind(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_22disconnect(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_24monitor(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr, int __pyx_v_events); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_26send(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_v_flags, PyObject *__pyx_v_copy, PyObject *__pyx_v_track); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_28recv(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_flags, PyObject *__pyx_v_copy, PyObject *__pyx_v_track); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context___get__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context_2__set__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context_4__del__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7_closed___get__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7_closed_2__set__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_6socket_Socket(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_B[] = "B";
+static char __pyx_k__6[] = "://";
+static char __pyx_k__22[] = "";
+static char __pyx_k__24[] = "*";
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_msg[] = "msg";
+static char __pyx_k_sys[] = "sys";
+static char __pyx_k_zmq[] = "zmq";
+static char __pyx_k_addr[] = "addr";
+static char __pyx_k_char[] = "char";
+static char __pyx_k_copy[] = "copy";
+static char __pyx_k_data[] = "data";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_recv[] = "recv";
+static char __pyx_k_send[] = "send";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_time[] = "time";
+static char __pyx_k_Again[] = "Again";
+static char __pyx_k_Frame[] = "Frame";
+static char __pyx_k_ascii[] = "ascii";
+static char __pyx_k_bytes[] = "bytes";
+static char __pyx_k_dtype[] = "dtype";
+static char __pyx_k_flags[] = "flags";
+static char __pyx_k_split[] = "split";
+static char __pyx_k_track[] = "track";
+static char __pyx_k_utf_8[] = "utf-8";
+static char __pyx_k_Socket[] = "Socket";
+static char __pyx_k_buffer[] = "buffer";
+static char __pyx_k_closed[] = "closed";
+static char __pyx_k_codecs[] = "codecs";
+static char __pyx_k_decode[] = "decode";
+static char __pyx_k_encode[] = "encode";
+static char __pyx_k_events[] = "events";
+static char __pyx_k_format[] = "format";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_linger[] = "linger";
+static char __pyx_k_option[] = "option";
+static char __pyx_k_optval[] = "optval";
+static char __pyx_k_pickle[] = "pickle";
+static char __pyx_k_random[] = "random";
+static char __pyx_k_shadow[] = "shadow";
+static char __pyx_k_struct[] = "struct";
+static char __pyx_k_unbind[] = "unbind";
+static char __pyx_k_RCVMORE[] = "RCVMORE";
+static char __pyx_k_cPickle[] = "cPickle";
+static char __pyx_k_context[] = "context";
+static char __pyx_k_jsonapi[] = "jsonapi";
+static char __pyx_k_monitor[] = "monitor";
+static char __pyx_k_replace[] = "replace";
+static char __pyx_k_tracker[] = "tracker";
+static char __pyx_k_unicode[] = "unicode";
+static char __pyx_k_ENOTSOCK[] = "ENOTSOCK";
+static char __pyx_k_ZMQError[] = "ZMQError";
+static char __pyx_k_copy_mod[] = "copy_mod";
+static char __pyx_k_itemsize[] = "itemsize";
+static char __pyx_k_property[] = "property";
+static char __pyx_k_typecode[] = "typecode";
+static char __pyx_k_TypeError[] = "TypeError";
+static char __pyx_k_constants[] = "constants";
+static char __pyx_k_zmq_error[] = "zmq.error";
+static char __pyx_k_zmq_utils[] = "zmq.utils";
+static char __pyx_k_ValueError[] = "ValueError";
+static char __pyx_k_basestring[] = "basestring";
+static char __pyx_k_disconnect[] = "disconnect";
+static char __pyx_k_getsockopt[] = "getsockopt";
+static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static char __pyx_k_underlying[] = "underlying";
+static char __pyx_k_fd_sockopts[] = "fd_sockopts";
+static char __pyx_k_socket_type[] = "socket_type";
+static char __pyx_k_ZMQBindError[] = "ZMQBindError";
+static char __pyx_k_check_version[] = "_check_version";
+static char __pyx_k_AttributeError[] = "AttributeError";
+static char __pyx_k_bytes_sockopts[] = "bytes_sockopts";
+static char __pyx_k_int64_sockopts[] = "int64_sockopts";
+static char __pyx_k_0MQ_Socket_class[] = "0MQ Socket class.";
+static char __pyx_k_IPC_PATH_MAX_LEN[] = "IPC_PATH_MAX_LEN";
+static char __pyx_k_ContextTerminated[] = "ContextTerminated";
+static char __pyx_k_expected_int_got_r[] = "expected int, got: %r";
+static char __pyx_k_expected_str_got_r[] = "expected str, got: %r";
+static char __pyx_k_zmq_backend_cython[] = "zmq.backend.cython";
+static char __pyx_k_zmq_utils_strtypes[] = "zmq.utils.strtypes";
+static char __pyx_k_NotImplementedError[] = "NotImplementedError";
+static char __pyx_k_expected_bytes_got_r[] = "expected bytes, got: %r";
+static char __pyx_k_InterruptedSystemCall[] = "InterruptedSystemCall";
+static char __pyx_k_Not_a_tracked_message[] = "Not a tracked message";
+static char __pyx_k_context_must_be_specified[] = "context must be specified";
+static char __pyx_k_zmq_backend_cython_constants[] = "zmq.backend.cython.constants";
+static char __pyx_k_socket_type_must_be_specified[] = "socket_type must be specified";
+static char __pyx_k_Old_style_buffers_not_available[] = "Old style buffers not available.";
+static char __pyx_k_r_does_not_provide_a_buffer_int[] = "%r does not provide a buffer interface.";
+static char __pyx_k_ipc_path_0_is_longer_than_1_char[] = "ipc path \"{0}\" is longer than {1} characters (sizeof(sockaddr_un.sun_path)). zmq.IPC_PATH_MAX_LEN constant can be used to check addr length (if it is defined).";
+static char __pyx_k_unicode_not_allowed_use_send_str[] = "unicode not allowed, use send_string";
+static char __pyx_k_unicode_not_allowed_use_setsocko[] = "unicode not allowed, use setsockopt_string";
+static PyObject *__pyx_n_s_Again;
+static PyObject *__pyx_n_s_AttributeError;
+static PyObject *__pyx_n_b_B;
+static PyObject *__pyx_n_s_ContextTerminated;
+static PyObject *__pyx_n_s_ENOTSOCK;
+static PyObject *__pyx_n_s_Frame;
+static PyObject *__pyx_n_s_IPC_PATH_MAX_LEN;
+static PyObject *__pyx_n_s_InterruptedSystemCall;
+static PyObject *__pyx_n_s_NotImplementedError;
+static PyObject *__pyx_kp_s_Not_a_tracked_message;
+static PyObject *__pyx_kp_s_Old_style_buffers_not_available;
+static PyObject *__pyx_n_s_RCVMORE;
+static PyObject *__pyx_n_s_Socket;
+static PyObject *__pyx_n_s_TypeError;
+static PyObject *__pyx_n_s_ValueError;
+static PyObject *__pyx_n_s_ZMQBindError;
+static PyObject *__pyx_n_s_ZMQError;
+static PyObject *__pyx_kp_s__22;
+static PyObject *__pyx_n_s__24;
+static PyObject *__pyx_kp_s__6;
+static PyObject *__pyx_n_s_addr;
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_ascii;
+static PyObject *__pyx_n_s_basestring;
+static PyObject *__pyx_n_s_buffer;
+static PyObject *__pyx_n_s_bytes;
+static PyObject *__pyx_n_s_bytes_sockopts;
+static PyObject *__pyx_n_s_cPickle;
+static PyObject *__pyx_n_s_char;
+static PyObject *__pyx_n_s_check_version;
+static PyObject *__pyx_n_s_closed;
+static PyObject *__pyx_n_s_codecs;
+static PyObject *__pyx_n_s_constants;
+static PyObject *__pyx_n_s_context;
+static PyObject *__pyx_kp_s_context_must_be_specified;
+static PyObject *__pyx_n_s_copy;
+static PyObject *__pyx_n_s_copy_mod;
+static PyObject *__pyx_n_s_data;
+static PyObject *__pyx_n_s_decode;
+static PyObject *__pyx_n_s_disconnect;
+static PyObject *__pyx_n_s_dtype;
+static PyObject *__pyx_n_s_encode;
+static PyObject *__pyx_n_s_events;
+static PyObject *__pyx_kp_s_expected_bytes_got_r;
+static PyObject *__pyx_kp_s_expected_int_got_r;
+static PyObject *__pyx_kp_s_expected_str_got_r;
+static PyObject *__pyx_n_s_fd_sockopts;
+static PyObject *__pyx_n_s_flags;
+static PyObject *__pyx_n_s_format;
+static PyObject *__pyx_n_s_getsockopt;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_int64_sockopts;
+static PyObject *__pyx_kp_s_ipc_path_0_is_longer_than_1_char;
+static PyObject *__pyx_n_s_itemsize;
+static PyObject *__pyx_n_s_jsonapi;
+static PyObject *__pyx_n_s_linger;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_monitor;
+static PyObject *__pyx_n_s_msg;
+static PyObject *__pyx_n_s_option;
+static PyObject *__pyx_n_s_optval;
+static PyObject *__pyx_n_s_pickle;
+static PyObject *__pyx_n_s_property;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_kp_s_r_does_not_provide_a_buffer_int;
+static PyObject *__pyx_n_s_random;
+static PyObject *__pyx_n_s_recv;
+static PyObject *__pyx_n_s_replace;
+static PyObject *__pyx_n_s_send;
+static PyObject *__pyx_n_s_shadow;
+static PyObject *__pyx_n_s_socket_type;
+static PyObject *__pyx_kp_s_socket_type_must_be_specified;
+static PyObject *__pyx_n_s_split;
+static PyObject *__pyx_n_s_struct;
+static PyObject *__pyx_n_s_sys;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_time;
+static PyObject *__pyx_n_s_track;
+static PyObject *__pyx_n_s_tracker;
+static PyObject *__pyx_n_s_typecode;
+static PyObject *__pyx_n_s_unbind;
+static PyObject *__pyx_n_s_underlying;
+static PyObject *__pyx_n_s_unicode;
+static PyObject *__pyx_kp_s_unicode_not_allowed_use_send_str;
+static PyObject *__pyx_kp_s_unicode_not_allowed_use_setsocko;
+static PyObject *__pyx_kp_s_utf_8;
+static PyObject *__pyx_n_s_zmq;
+static PyObject *__pyx_n_s_zmq_backend_cython;
+static PyObject *__pyx_n_s_zmq_backend_cython_constants;
+static PyObject *__pyx_n_s_zmq_error;
+static PyObject *__pyx_n_s_zmq_utils;
+static PyObject *__pyx_n_s_zmq_utils_strtypes;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_2;
+static PyObject *__pyx_int_3;
+static PyObject *__pyx_int_neg_1;
+static int __pyx_k__15;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__2;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__4;
+static PyObject *__pyx_tuple__5;
+static PyObject *__pyx_tuple__7;
+static PyObject *__pyx_tuple__8;
+static PyObject *__pyx_tuple__9;
+static PyObject *__pyx_tuple__10;
+static PyObject *__pyx_tuple__11;
+static PyObject *__pyx_tuple__12;
+static PyObject *__pyx_tuple__13;
+static PyObject *__pyx_tuple__14;
+static PyObject *__pyx_tuple__16;
+static PyObject *__pyx_tuple__17;
+static PyObject *__pyx_tuple__18;
+static PyObject *__pyx_tuple__19;
+static PyObject *__pyx_tuple__20;
+static PyObject *__pyx_tuple__21;
+static PyObject *__pyx_tuple__23;
+
+/* "zmq/backend/cython/socket.pyx":90
+ * # true methods frequently cannot be inlined, acc. Cython docs
+ *
+ * cdef inline _check_closed(Socket s): # <<<<<<<<<<<<<<
+ * """raise ENOTSUP if socket is closed
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__check_closed(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_s) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_check_closed", 0);
+
+ /* "zmq/backend/cython/socket.pyx":95
+ * Does not do a deep check
+ * """
+ * if s._closed: # <<<<<<<<<<<<<<
+ * raise ZMQError(ENOTSOCK)
+ *
+ */
+ __pyx_t_1 = (__pyx_v_s->_closed != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/socket.pyx":96
+ * """
+ * if s._closed:
+ * raise ZMQError(ENOTSOCK) # <<<<<<<<<<<<<<
+ *
+ * cdef inline _check_closed_deep(Socket s):
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ENOTSOCK); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_2);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":90
+ * # true methods frequently cannot be inlined, acc. Cython docs
+ *
+ * cdef inline _check_closed(Socket s): # <<<<<<<<<<<<<<
+ * """raise ENOTSUP if socket is closed
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("zmq.backend.cython.socket._check_closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":98
+ * raise ZMQError(ENOTSOCK)
+ *
+ * cdef inline _check_closed_deep(Socket s): # <<<<<<<<<<<<<<
+ * """thorough check of whether the socket has been closed,
+ * even if by another entity (e.g. ctx.destroy).
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__check_closed_deep(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_s) {
+ int __pyx_v_rc;
+ int __pyx_v_stype;
+ size_t __pyx_v_sz;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_check_closed_deep", 0);
+
+ /* "zmq/backend/cython/socket.pyx":109
+ * cdef int errno
+ * cdef int stype
+ * cdef size_t sz=sizeof(int) # <<<<<<<<<<<<<<
+ * if s._closed:
+ * return True
+ */
+ __pyx_v_sz = (sizeof(int));
+
+ /* "zmq/backend/cython/socket.pyx":110
+ * cdef int stype
+ * cdef size_t sz=sizeof(int)
+ * if s._closed: # <<<<<<<<<<<<<<
+ * return True
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_s->_closed != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/socket.pyx":111
+ * cdef size_t sz=sizeof(int)
+ * if s._closed:
+ * return True # <<<<<<<<<<<<<<
+ * else:
+ * rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_True);
+ __pyx_r = Py_True;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/socket.pyx":113
+ * return True
+ * else:
+ * rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz) # <<<<<<<<<<<<<<
+ * if rc < 0 and zmq_errno() == ENOTSOCK:
+ * s._closed = True
+ */
+ __pyx_v_rc = zmq_getsockopt(__pyx_v_s->handle, ZMQ_TYPE, ((void *)(&__pyx_v_stype)), (&__pyx_v_sz));
+
+ /* "zmq/backend/cython/socket.pyx":114
+ * else:
+ * rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
+ * if rc < 0 and zmq_errno() == ENOTSOCK: # <<<<<<<<<<<<<<
+ * s._closed = True
+ * return True
+ */
+ __pyx_t_2 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_3 = __Pyx_PyInt_From_int(zmq_errno()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ENOTSOCK); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/socket.pyx":115
+ * rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
+ * if rc < 0 and zmq_errno() == ENOTSOCK:
+ * s._closed = True # <<<<<<<<<<<<<<
+ * return True
+ * else:
+ */
+ __pyx_v_s->_closed = 1;
+
+ /* "zmq/backend/cython/socket.pyx":116
+ * if rc < 0 and zmq_errno() == ENOTSOCK:
+ * s._closed = True
+ * return True # <<<<<<<<<<<<<<
+ * else:
+ * _check_rc(rc)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_True);
+ __pyx_r = Py_True;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/socket.pyx":118
+ * return True
+ * else:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * return False
+ *
+ */
+ __pyx_t_6 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":119
+ * else:
+ * _check_rc(rc)
+ * return False # <<<<<<<<<<<<<<
+ *
+ * cdef inline Frame _recv_frame(void *handle, int flags=0, track=False):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(Py_False);
+ __pyx_r = Py_False;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/socket.pyx":98
+ * raise ZMQError(ENOTSOCK)
+ *
+ * cdef inline _check_closed_deep(Socket s): # <<<<<<<<<<<<<<
+ * """thorough check of whether the socket has been closed,
+ * even if by another entity (e.g. ctx.destroy).
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.backend.cython.socket._check_closed_deep", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":121
+ * return False
+ *
+ * cdef inline Frame _recv_frame(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
+ * """Receive a message in a non-copying manner and return a Frame."""
+ * cdef int rc
+ */
+
+static CYTHON_INLINE struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_f_3zmq_7backend_6cython_6socket__recv_frame(void *__pyx_v_handle, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame *__pyx_optional_args) {
+ int __pyx_v_flags = ((int)0);
+ PyObject *__pyx_v_track = ((PyObject *)Py_False);
+ int __pyx_v_rc;
+ PyObject *__pyx_v_msg = NULL;
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_cmsg = 0;
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_recv_frame", 0);
+ if (__pyx_optional_args) {
+ if (__pyx_optional_args->__pyx_n > 0) {
+ __pyx_v_flags = __pyx_optional_args->flags;
+ if (__pyx_optional_args->__pyx_n > 1) {
+ __pyx_v_track = __pyx_optional_args->track;
+ }
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":124
+ * """Receive a message in a non-copying manner and return a Frame."""
+ * cdef int rc
+ * msg = zmq.Frame(track=track) # <<<<<<<<<<<<<<
+ * cdef Frame cmsg = msg
+ *
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Frame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_track, __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_msg = __pyx_t_3;
+ __pyx_t_3 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":125
+ * cdef int rc
+ * msg = zmq.Frame(track=track)
+ * cdef Frame cmsg = msg # <<<<<<<<<<<<<<
+ *
+ * while True:
+ */
+ if (!(likely(((__pyx_v_msg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_msg, __pyx_ptype_3zmq_7backend_6cython_7message_Frame))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_v_msg;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_cmsg = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":127
+ * cdef Frame cmsg = msg
+ *
+ * while True: # <<<<<<<<<<<<<<
+ * with nogil:
+ * rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/socket.pyx":128
+ *
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
+ * try:
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":129
+ * while True:
+ * with nogil:
+ * rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = zmq_msg_recv((&__pyx_v_cmsg->zmq_msg), __pyx_v_handle, __pyx_v_flags);
+ }
+
+ /* "zmq/backend/cython/socket.pyx":128
+ *
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
+ * try:
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":130
+ * with nogil:
+ * rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_6);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":131
+ * rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_7 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":135
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ * return msg
+ *
+ */
+ goto __pyx_L15_try_break;
+ }
+ __pyx_L10_error:;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":132
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = PyErr_ExceptionMatches(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_7) {
+ __Pyx_AddTraceback("zmq.backend.cython.socket._recv_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_2);
+
+ /* "zmq/backend/cython/socket.pyx":133
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L19_except_continue;
+ __pyx_L19_except_continue:;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L16_try_continue;
+ }
+ goto __pyx_L12_except_error;
+ __pyx_L12_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L1_error;
+ __pyx_L15_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L4_break;
+ __pyx_L16_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L3_continue;
+ }
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "zmq/backend/cython/socket.pyx":136
+ * else:
+ * break
+ * return msg # <<<<<<<<<<<<<<
+ *
+ * cdef inline object _recv_copy(void *handle, int flags=0):
+ */
+ __Pyx_XDECREF(((PyObject *)__pyx_r));
+ if (!(likely(((__pyx_v_msg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_msg, __pyx_ptype_3zmq_7backend_6cython_7message_Frame))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_v_msg);
+ __pyx_r = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_msg);
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/socket.pyx":121
+ * return False
+ *
+ * cdef inline Frame _recv_frame(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
+ * """Receive a message in a non-copying manner and return a Frame."""
+ * cdef int rc
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("zmq.backend.cython.socket._recv_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_msg);
+ __Pyx_XDECREF((PyObject *)__pyx_v_cmsg);
+ __Pyx_XGIVEREF((PyObject *)__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":138
+ * return msg
+ *
+ * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
+ * """Receive a message and return a copy"""
+ * cdef zmq_msg_t zmq_msg
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__recv_copy(void *__pyx_v_handle, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy *__pyx_optional_args) {
+ int __pyx_v_flags = ((int)0);
+ zmq_msg_t __pyx_v_zmq_msg;
+ int __pyx_v_rc;
+ PyObject *__pyx_v_msg_bytes = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_recv_copy", 0);
+ if (__pyx_optional_args) {
+ if (__pyx_optional_args->__pyx_n > 0) {
+ __pyx_v_flags = __pyx_optional_args->flags;
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":141
+ * """Receive a message and return a copy"""
+ * cdef zmq_msg_t zmq_msg
+ * rc = zmq_msg_init (&zmq_msg) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * while True:
+ */
+ __pyx_v_rc = zmq_msg_init((&__pyx_v_zmq_msg));
+
+ /* "zmq/backend/cython/socket.pyx":142
+ * cdef zmq_msg_t zmq_msg
+ * rc = zmq_msg_init (&zmq_msg)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * while True:
+ * with nogil:
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/socket.pyx":143
+ * rc = zmq_msg_init (&zmq_msg)
+ * _check_rc(rc)
+ * while True: # <<<<<<<<<<<<<<
+ * with nogil:
+ * rc = zmq_msg_recv(&zmq_msg, handle, flags)
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/socket.pyx":144
+ * _check_rc(rc)
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_recv(&zmq_msg, handle, flags)
+ * try:
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":145
+ * while True:
+ * with nogil:
+ * rc = zmq_msg_recv(&zmq_msg, handle, flags) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = zmq_msg_recv((&__pyx_v_zmq_msg), __pyx_v_handle, __pyx_v_flags);
+ }
+
+ /* "zmq/backend/cython/socket.pyx":144
+ * _check_rc(rc)
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_recv(&zmq_msg, handle, flags)
+ * try:
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":146
+ * with nogil:
+ * rc = zmq_msg_recv(&zmq_msg, handle, flags)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_4);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":147
+ * rc = zmq_msg_recv(&zmq_msg, handle, flags)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":151
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
+ * zmq_msg_close(&zmq_msg)
+ */
+ goto __pyx_L15_try_break;
+ }
+ __pyx_L10_error:;
+
+ /* "zmq/backend/cython/socket.pyx":148
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = PyErr_ExceptionMatches(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_1) {
+ __Pyx_AddTraceback("zmq.backend.cython.socket._recv_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "zmq/backend/cython/socket.pyx":149
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L19_except_continue;
+ __pyx_L19_except_continue:;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L16_try_continue;
+ }
+ goto __pyx_L12_except_error;
+ __pyx_L12_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L1_error;
+ __pyx_L15_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L4_break;
+ __pyx_L16_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L3_continue;
+ }
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "zmq/backend/cython/socket.pyx":152
+ * else:
+ * break
+ * msg_bytes = copy_zmq_msg_bytes(&zmq_msg) # <<<<<<<<<<<<<<
+ * zmq_msg_close(&zmq_msg)
+ * return msg_bytes
+ */
+ __pyx_t_7 = __pyx_f_3zmq_7backend_6cython_7message_copy_zmq_msg_bytes((&__pyx_v_zmq_msg)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_v_msg_bytes = __pyx_t_7;
+ __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":153
+ * break
+ * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
+ * zmq_msg_close(&zmq_msg) # <<<<<<<<<<<<<<
+ * return msg_bytes
+ *
+ */
+ zmq_msg_close((&__pyx_v_zmq_msg));
+
+ /* "zmq/backend/cython/socket.pyx":154
+ * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
+ * zmq_msg_close(&zmq_msg)
+ * return msg_bytes # <<<<<<<<<<<<<<
+ *
+ * cdef inline object _send_frame(void *handle, Frame msg, int flags=0):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_msg_bytes);
+ __pyx_r = __pyx_v_msg_bytes;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/socket.pyx":138
+ * return msg
+ *
+ * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
+ * """Receive a message and return a copy"""
+ * cdef zmq_msg_t zmq_msg
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.socket._recv_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_msg_bytes);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":156
+ * return msg_bytes
+ *
+ * cdef inline object _send_frame(void *handle, Frame msg, int flags=0): # <<<<<<<<<<<<<<
+ * """Send a Frame on this socket in a non-copy manner."""
+ * cdef int rc
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__send_frame(void *__pyx_v_handle, struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_msg, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame *__pyx_optional_args) {
+ int __pyx_v_flags = ((int)0);
+ int __pyx_v_rc;
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_msg_copy = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_send_frame", 0);
+ if (__pyx_optional_args) {
+ if (__pyx_optional_args->__pyx_n > 0) {
+ __pyx_v_flags = __pyx_optional_args->flags;
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":163
+ * # Always copy so the original message isn't garbage collected.
+ * # This doesn't do a real copy, just a reference.
+ * msg_copy = msg.fast_copy() # <<<<<<<<<<<<<<
+ *
+ * while True:
+ */
+ __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *)__pyx_v_msg->__pyx_vtab)->fast_copy(__pyx_v_msg)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_msg_copy = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":165
+ * msg_copy = msg.fast_copy()
+ *
+ * while True: # <<<<<<<<<<<<<<
+ * with nogil:
+ * rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/socket.pyx":166
+ *
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
+ * try:
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":167
+ * while True:
+ * with nogil:
+ * rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_msg_copy->zmq_msg), __pyx_v_handle, __pyx_v_flags);
+ }
+
+ /* "zmq/backend/cython/socket.pyx":166
+ *
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
+ * try:
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":168
+ * with nogil:
+ * rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_4);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":169
+ * rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_5 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":173
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ *
+ * return msg.tracker
+ */
+ goto __pyx_L15_try_break;
+ }
+ __pyx_L10_error:;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":170
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = PyErr_ExceptionMatches(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_5) {
+ __Pyx_AddTraceback("zmq.backend.cython.socket._send_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "zmq/backend/cython/socket.pyx":171
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L19_except_continue;
+ __pyx_L19_except_continue:;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L16_try_continue;
+ }
+ goto __pyx_L12_except_error;
+ __pyx_L12_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L1_error;
+ __pyx_L15_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L4_break;
+ __pyx_L16_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L3_continue;
+ }
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "zmq/backend/cython/socket.pyx":175
+ * break
+ *
+ * return msg.tracker # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_msg->tracker);
+ __pyx_r = __pyx_v_msg->tracker;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/socket.pyx":156
+ * return msg_bytes
+ *
+ * cdef inline object _send_frame(void *handle, Frame msg, int flags=0): # <<<<<<<<<<<<<<
+ * """Send a Frame on this socket in a non-copy manner."""
+ * cdef int rc
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.socket._send_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_msg_copy);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":178
+ *
+ *
+ * cdef inline object _send_copy(void *handle, object msg, int flags=0): # <<<<<<<<<<<<<<
+ * """Send a message on this socket by copying its content."""
+ * cdef int rc, rc2
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__send_copy(void *__pyx_v_handle, PyObject *__pyx_v_msg, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy *__pyx_optional_args) {
+ int __pyx_v_flags = ((int)0);
+ int __pyx_v_rc;
+ int __pyx_v_rc2;
+ zmq_msg_t __pyx_v_data;
+ char *__pyx_v_msg_c;
+ Py_ssize_t __pyx_v_msg_c_len;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_send_copy", 0);
+ if (__pyx_optional_args) {
+ if (__pyx_optional_args->__pyx_n > 0) {
+ __pyx_v_flags = __pyx_optional_args->flags;
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":183
+ * cdef zmq_msg_t data
+ * cdef char *msg_c
+ * cdef Py_ssize_t msg_c_len=0 # <<<<<<<<<<<<<<
+ *
+ * # copy to c array:
+ */
+ __pyx_v_msg_c_len = 0;
+
+ /* "zmq/backend/cython/socket.pyx":186
+ *
+ * # copy to c array:
+ * asbuffer_r(msg, <void **>&msg_c, &msg_c_len) # <<<<<<<<<<<<<<
+ *
+ * # Copy the msg before sending. This avoids any complications with
+ */
+ __pyx_t_1 = __pyx_f_7buffers_asbuffer_r(__pyx_v_msg, ((void **)(&__pyx_v_msg_c)), (&__pyx_v_msg_c_len)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":191
+ * # the GIL, etc.
+ * # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
+ * rc = zmq_msg_init_size(&data, msg_c_len) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_msg_init_size((&__pyx_v_data), __pyx_v_msg_c_len);
+
+ /* "zmq/backend/cython/socket.pyx":192
+ * # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
+ * rc = zmq_msg_init_size(&data, msg_c_len)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * while True:
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/socket.pyx":194
+ * _check_rc(rc)
+ *
+ * while True: # <<<<<<<<<<<<<<
+ * with nogil:
+ * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/socket.pyx":195
+ *
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
+ * rc = zmq_msg_send(&data, handle, flags)
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":196
+ * while True:
+ * with nogil:
+ * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data)) # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&data, handle, flags)
+ * if not rc < 0:
+ */
+ memcpy(zmq_msg_data((&__pyx_v_data)), __pyx_v_msg_c, zmq_msg_size((&__pyx_v_data)));
+
+ /* "zmq/backend/cython/socket.pyx":197
+ * with nogil:
+ * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
+ * rc = zmq_msg_send(&data, handle, flags) # <<<<<<<<<<<<<<
+ * if not rc < 0:
+ * rc2 = zmq_msg_close(&data)
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_data), __pyx_v_handle, __pyx_v_flags);
+
+ /* "zmq/backend/cython/socket.pyx":198
+ * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
+ * rc = zmq_msg_send(&data, handle, flags)
+ * if not rc < 0: # <<<<<<<<<<<<<<
+ * rc2 = zmq_msg_close(&data)
+ * try:
+ */
+ __pyx_t_3 = ((!((__pyx_v_rc < 0) != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":199
+ * rc = zmq_msg_send(&data, handle, flags)
+ * if not rc < 0:
+ * rc2 = zmq_msg_close(&data) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc2 = zmq_msg_close((&__pyx_v_data));
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":195
+ *
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
+ * rc = zmq_msg_send(&data, handle, flags)
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+ }
+ }
+
+ /* "zmq/backend/cython/socket.pyx":200
+ * if not rc < 0:
+ * rc2 = zmq_msg_close(&data)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_6);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":201
+ * rc2 = zmq_msg_close(&data)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":205
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ * _check_rc(rc2)
+ *
+ */
+ goto __pyx_L16_try_break;
+ }
+ __pyx_L11_error:;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":202
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyErr_ExceptionMatches(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
+ __Pyx_AddTraceback("zmq.backend.cython.socket._send_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_8);
+
+ /* "zmq/backend/cython/socket.pyx":203
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L20_except_continue;
+ __pyx_L20_except_continue:;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L17_try_continue;
+ }
+ goto __pyx_L13_except_error;
+ __pyx_L13_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L1_error;
+ __pyx_L16_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L4_break;
+ __pyx_L17_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+ goto __pyx_L3_continue;
+ }
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "zmq/backend/cython/socket.pyx":206
+ * else:
+ * break
+ * _check_rc(rc2) # <<<<<<<<<<<<<<
+ *
+ * cdef inline object _getsockopt(void *handle, int option, void *optval, size_t *sz):
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc2); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/socket.pyx":178
+ *
+ *
+ * cdef inline object _send_copy(void *handle, object msg, int flags=0): # <<<<<<<<<<<<<<
+ * """Send a message on this socket by copying its content."""
+ * cdef int rc, rc2
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("zmq.backend.cython.socket._send_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":208
+ * _check_rc(rc2)
+ *
+ * cdef inline object _getsockopt(void *handle, int option, void *optval, size_t *sz): # <<<<<<<<<<<<<<
+ * """getsockopt, retrying interrupted calls
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__getsockopt(void *__pyx_v_handle, int __pyx_v_option, void *__pyx_v_optval, size_t *__pyx_v_sz) {
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_getsockopt", 0);
+
+ /* "zmq/backend/cython/socket.pyx":213
+ * checks rc, raising ZMQError on failure.
+ * """
+ * cdef int rc=0 # <<<<<<<<<<<<<<
+ * while True:
+ * rc = zmq_getsockopt(handle, option, optval, sz)
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/socket.pyx":214
+ * """
+ * cdef int rc=0
+ * while True: # <<<<<<<<<<<<<<
+ * rc = zmq_getsockopt(handle, option, optval, sz)
+ * try:
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/socket.pyx":215
+ * cdef int rc=0
+ * while True:
+ * rc = zmq_getsockopt(handle, option, optval, sz) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = zmq_getsockopt(__pyx_v_handle, __pyx_v_option, __pyx_v_optval, __pyx_v_sz);
+
+ /* "zmq/backend/cython/socket.pyx":216
+ * while True:
+ * rc = zmq_getsockopt(handle, option, optval, sz)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":217
+ * rc = zmq_getsockopt(handle, option, optval, sz)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_4 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":221
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ *
+ * cdef inline object _setsockopt(void *handle, int option, void *optval, size_t sz):
+ */
+ goto __pyx_L10_try_break;
+ }
+ __pyx_L5_error:;
+
+ /* "zmq/backend/cython/socket.pyx":218
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("zmq.backend.cython.socket._getsockopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "zmq/backend/cython/socket.pyx":219
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L14_except_continue;
+ __pyx_L14_except_continue:;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L11_try_continue;
+ }
+ goto __pyx_L7_except_error;
+ __pyx_L7_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L1_error;
+ __pyx_L10_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L4_break;
+ __pyx_L11_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L3_continue;
+ }
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "zmq/backend/cython/socket.pyx":208
+ * _check_rc(rc2)
+ *
+ * cdef inline object _getsockopt(void *handle, int option, void *optval, size_t *sz): # <<<<<<<<<<<<<<
+ * """getsockopt, retrying interrupted calls
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.socket._getsockopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":223
+ * break
+ *
+ * cdef inline object _setsockopt(void *handle, int option, void *optval, size_t sz): # <<<<<<<<<<<<<<
+ * """setsockopt, retrying interrupted calls
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__setsockopt(void *__pyx_v_handle, int __pyx_v_option, void *__pyx_v_optval, size_t __pyx_v_sz) {
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_setsockopt", 0);
+
+ /* "zmq/backend/cython/socket.pyx":228
+ * checks rc, raising ZMQError on failure.
+ * """
+ * cdef int rc=0 # <<<<<<<<<<<<<<
+ * while True:
+ * rc = zmq_setsockopt(handle, option, optval, sz)
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/socket.pyx":229
+ * """
+ * cdef int rc=0
+ * while True: # <<<<<<<<<<<<<<
+ * rc = zmq_setsockopt(handle, option, optval, sz)
+ * try:
+ */
+ while (1) {
+
+ /* "zmq/backend/cython/socket.pyx":230
+ * cdef int rc=0
+ * while True:
+ * rc = zmq_setsockopt(handle, option, optval, sz) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = zmq_setsockopt(__pyx_v_handle, __pyx_v_option, __pyx_v_optval, __pyx_v_sz);
+
+ /* "zmq/backend/cython/socket.pyx":231
+ * while True:
+ * rc = zmq_setsockopt(handle, option, optval, sz)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_1);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":232
+ * rc = zmq_setsockopt(handle, option, optval, sz)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_4 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":236
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ goto __pyx_L10_try_break;
+ }
+ __pyx_L5_error:;
+
+ /* "zmq/backend/cython/socket.pyx":233
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("zmq.backend.cython.socket._setsockopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "zmq/backend/cython/socket.pyx":234
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L14_except_continue;
+ __pyx_L14_except_continue:;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ goto __pyx_L11_try_continue;
+ }
+ goto __pyx_L7_except_error;
+ __pyx_L7_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L1_error;
+ __pyx_L10_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L4_break;
+ __pyx_L11_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
+ goto __pyx_L3_continue;
+ }
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "zmq/backend/cython/socket.pyx":223
+ * break
+ *
+ * cdef inline object _setsockopt(void *handle, int option, void *optval, size_t sz): # <<<<<<<<<<<<<<
+ * """setsockopt, retrying interrupted calls
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.socket._setsockopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":262
+ *
+ * # no-op for the signature
+ * def __init__(self, context=None, socket_type=-1, shadow=0): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ CYTHON_UNUSED PyObject *__pyx_v_context = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_socket_type = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_shadow = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_socket_type,&__pyx_n_s_shadow,0};
+ PyObject* values[3] = {0,0,0};
+ values[0] = ((PyObject *)Py_None);
+ values[1] = ((PyObject *)__pyx_int_neg_1);
+ values[2] = ((PyObject *)__pyx_int_0);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_socket_type);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ case 2:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shadow);
+ if (value) { values[2] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_context = values[0];
+ __pyx_v_socket_type = values[1];
+ __pyx_v_shadow = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket___init__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_context, __pyx_v_socket_type, __pyx_v_shadow);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket___init__(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_socket_type, CYTHON_UNUSED PyObject *__pyx_v_shadow) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__", 0);
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":265
+ * pass
+ *
+ * def __cinit__(self, Context context=None, int socket_type=-1, size_t shadow=0, *args, **kwargs): # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t c_handle
+ *
+ */
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_context = 0;
+ int __pyx_v_socket_type;
+ size_t __pyx_v_shadow;
+ CYTHON_UNUSED PyObject *__pyx_v_args = 0;
+ CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
+ __Pyx_GOTREF(__pyx_v_kwargs);
+ if (PyTuple_GET_SIZE(__pyx_args) > 3) {
+ __pyx_v_args = PyTuple_GetSlice(__pyx_args, 3, PyTuple_GET_SIZE(__pyx_args));
+ if (unlikely(!__pyx_v_args)) {
+ __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ }
+ __Pyx_GOTREF(__pyx_v_args);
+ } else {
+ __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
+ }
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_socket_type,&__pyx_n_s_shadow,0};
+ PyObject* values[3] = {0,0,0};
+ values[0] = (PyObject *)((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)Py_None);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ default:
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_socket_type);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ case 2:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shadow);
+ if (value) { values[2] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ const Py_ssize_t used_pos_args = (pos_args < 3) ? pos_args : 3;
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ default:
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ }
+ }
+ __pyx_v_context = ((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)values[0]);
+ if (values[1]) {
+ __pyx_v_socket_type = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_socket_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ } else {
+ __pyx_v_socket_type = ((int)-1);
+ }
+ if (values[2]) {
+ __pyx_v_shadow = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_shadow == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ } else {
+ __pyx_v_shadow = ((size_t)0);
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
+ __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_3zmq_7backend_6cython_7context_Context, 1, "context", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_2__cinit__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_context, __pyx_v_socket_type, __pyx_v_shadow, __pyx_v_args, __pyx_v_kwargs);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_args);
+ __Pyx_XDECREF(__pyx_v_kwargs);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_2__cinit__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_context, int __pyx_v_socket_type, size_t __pyx_v_shadow, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "zmq/backend/cython/socket.pyx":268
+ * cdef Py_ssize_t c_handle
+ *
+ * self.handle = NULL # <<<<<<<<<<<<<<
+ * self.context = context
+ * if shadow:
+ */
+ __pyx_v_self->handle = NULL;
+
+ /* "zmq/backend/cython/socket.pyx":269
+ *
+ * self.handle = NULL
+ * self.context = context # <<<<<<<<<<<<<<
+ * if shadow:
+ * self._shadow = True
+ */
+ __Pyx_INCREF(((PyObject *)__pyx_v_context));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
+ __Pyx_GOTREF(__pyx_v_self->context);
+ __Pyx_DECREF(((PyObject *)__pyx_v_self->context));
+ __pyx_v_self->context = __pyx_v_context;
+
+ /* "zmq/backend/cython/socket.pyx":270
+ * self.handle = NULL
+ * self.context = context
+ * if shadow: # <<<<<<<<<<<<<<
+ * self._shadow = True
+ * self.handle = <void *>shadow
+ */
+ __pyx_t_1 = (__pyx_v_shadow != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/socket.pyx":271
+ * self.context = context
+ * if shadow:
+ * self._shadow = True # <<<<<<<<<<<<<<
+ * self.handle = <void *>shadow
+ * else:
+ */
+ __pyx_v_self->_shadow = 1;
+
+ /* "zmq/backend/cython/socket.pyx":272
+ * if shadow:
+ * self._shadow = True
+ * self.handle = <void *>shadow # <<<<<<<<<<<<<<
+ * else:
+ * if context is None:
+ */
+ __pyx_v_self->handle = ((void *)__pyx_v_shadow);
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/socket.pyx":274
+ * self.handle = <void *>shadow
+ * else:
+ * if context is None: # <<<<<<<<<<<<<<
+ * raise TypeError("context must be specified")
+ * if socket_type < 0:
+ */
+ __pyx_t_1 = (((PyObject *)__pyx_v_context) == Py_None);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":275
+ * else:
+ * if context is None:
+ * raise TypeError("context must be specified") # <<<<<<<<<<<<<<
+ * if socket_type < 0:
+ * raise TypeError("socket_type must be specified")
+ */
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":276
+ * if context is None:
+ * raise TypeError("context must be specified")
+ * if socket_type < 0: # <<<<<<<<<<<<<<
+ * raise TypeError("socket_type must be specified")
+ * self._shadow = False
+ */
+ __pyx_t_2 = ((__pyx_v_socket_type < 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":277
+ * raise TypeError("context must be specified")
+ * if socket_type < 0:
+ * raise TypeError("socket_type must be specified") # <<<<<<<<<<<<<<
+ * self._shadow = False
+ * self.handle = zmq_socket(context.handle, socket_type)
+ */
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":278
+ * if socket_type < 0:
+ * raise TypeError("socket_type must be specified")
+ * self._shadow = False # <<<<<<<<<<<<<<
+ * self.handle = zmq_socket(context.handle, socket_type)
+ * if self.handle == NULL:
+ */
+ __pyx_v_self->_shadow = 0;
+
+ /* "zmq/backend/cython/socket.pyx":279
+ * raise TypeError("socket_type must be specified")
+ * self._shadow = False
+ * self.handle = zmq_socket(context.handle, socket_type) # <<<<<<<<<<<<<<
+ * if self.handle == NULL:
+ * raise ZMQError()
+ */
+ __pyx_v_self->handle = zmq_socket(__pyx_v_context->handle, __pyx_v_socket_type);
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":280
+ * self._shadow = False
+ * self.handle = zmq_socket(context.handle, socket_type)
+ * if self.handle == NULL: # <<<<<<<<<<<<<<
+ * raise ZMQError()
+ * self._closed = False
+ */
+ __pyx_t_2 = ((__pyx_v_self->handle == NULL) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":281
+ * self.handle = zmq_socket(context.handle, socket_type)
+ * if self.handle == NULL:
+ * raise ZMQError() # <<<<<<<<<<<<<<
+ * self._closed = False
+ * self._pid = getpid()
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":282
+ * if self.handle == NULL:
+ * raise ZMQError()
+ * self._closed = False # <<<<<<<<<<<<<<
+ * self._pid = getpid()
+ * if context:
+ */
+ __pyx_v_self->_closed = 0;
+
+ /* "zmq/backend/cython/socket.pyx":283
+ * raise ZMQError()
+ * self._closed = False
+ * self._pid = getpid() # <<<<<<<<<<<<<<
+ * if context:
+ * context._add_socket(self.handle)
+ */
+ __pyx_v_self->_pid = getpid();
+
+ /* "zmq/backend/cython/socket.pyx":284
+ * self._closed = False
+ * self._pid = getpid()
+ * if context: # <<<<<<<<<<<<<<
+ * context._add_socket(self.handle)
+ *
+ */
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_context)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":285
+ * self._pid = getpid()
+ * if context:
+ * context._add_socket(self.handle) # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(self):
+ */
+ ((struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *)__pyx_v_context->__pyx_vtab)->_add_socket(__pyx_v_context, __pyx_v_self->handle);
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "zmq/backend/cython/socket.pyx":265
+ * pass
+ *
+ * def __cinit__(self, Context context=None, int socket_type=-1, size_t shadow=0, *args, **kwargs): # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t c_handle
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":287
+ * context._add_socket(self.handle)
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * """remove from context's list
+ *
+ */
+
+/* Python wrapper */
+static void __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_5__dealloc__(PyObject *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_4__dealloc__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_4__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__dealloc__", 0);
+
+ /* "zmq/backend/cython/socket.pyx":292
+ * But be careful that context might not exist if called during gc
+ * """
+ * if self.handle != NULL and not self._shadow and getpid() == self._pid: # <<<<<<<<<<<<<<
+ * # during gc, self.context might be NULL
+ * if self.context and not self.context.closed:
+ */
+ __pyx_t_2 = ((__pyx_v_self->handle != NULL) != 0);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_2 = ((!(__pyx_v_self->_shadow != 0)) != 0);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_2 = ((getpid() == __pyx_v_self->_pid) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/socket.pyx":294
+ * if self.handle != NULL and not self._shadow and getpid() == self._pid:
+ * # during gc, self.context might be NULL
+ * if self.context and not self.context.closed: # <<<<<<<<<<<<<<
+ * self.context._remove_socket(self.handle)
+ *
+ */
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->context)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L8_bool_binop_done;
+ }
+ __pyx_t_2 = ((!(__pyx_v_self->context->closed != 0)) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L8_bool_binop_done:;
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/socket.pyx":295
+ * # during gc, self.context might be NULL
+ * if self.context and not self.context.closed:
+ * self.context._remove_socket(self.handle) # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ ((struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *)__pyx_v_self->context->__pyx_vtab)->_remove_socket(__pyx_v_self->context, __pyx_v_self->handle);
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":287
+ * context._add_socket(self.handle)
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * """remove from context's list
+ *
+ */
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_WriteUnraisable("zmq.backend.cython.socket.Socket.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "zmq/backend/cython/socket.pyx":298
+ *
+ * @property
+ * def underlying(self): # <<<<<<<<<<<<<<
+ * """The address of the underlying libzmq socket"""
+ * return <size_t> self.handle
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7underlying(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_6underlying[] = "The address of the underlying libzmq socket";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7underlying(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("underlying (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_6underlying(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_6underlying(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("underlying", 0);
+
+ /* "zmq/backend/cython/socket.pyx":300
+ * def underlying(self):
+ * """The address of the underlying libzmq socket"""
+ * return <size_t> self.handle # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_self->handle)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/socket.pyx":298
+ *
+ * @property
+ * def underlying(self): # <<<<<<<<<<<<<<
+ * """The address of the underlying libzmq socket"""
+ * return <size_t> self.handle
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.underlying", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":303
+ *
+ * @property
+ * def closed(self): # <<<<<<<<<<<<<<
+ * return _check_closed_deep(self)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_9closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_9closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("closed (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_8closed(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_8closed(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("closed", 0);
+
+ /* "zmq/backend/cython/socket.pyx":304
+ * @property
+ * def closed(self):
+ * return _check_closed_deep(self) # <<<<<<<<<<<<<<
+ *
+ * def close(self, linger=None):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed_deep(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/socket.pyx":303
+ *
+ * @property
+ * def closed(self): # <<<<<<<<<<<<<<
+ * return _check_closed_deep(self)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":306
+ * return _check_closed_deep(self)
+ *
+ * def close(self, linger=None): # <<<<<<<<<<<<<<
+ * """s.close(linger=None)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_11close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_10close[] = "s.close(linger=None)\n\n Close the socket.\n \n If linger is specified, LINGER sockopt will be set prior to closing.\n\n This can be called to close the socket by hand. If this is not\n called, the socket will automatically be closed when it is\n garbage collected.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_11close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_linger = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("close (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_linger,0};
+ PyObject* values[1] = {0};
+ values[0] = ((PyObject *)Py_None);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_linger);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "close") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_linger = values[0];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("close", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_10close(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_linger);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_10close(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_linger) {
+ int __pyx_v_rc;
+ int __pyx_v_linger_c;
+ int __pyx_v_setlinger;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("close", 0);
+
+ /* "zmq/backend/cython/socket.pyx":317
+ * garbage collected.
+ * """
+ * cdef int rc=0 # <<<<<<<<<<<<<<
+ * cdef int linger_c
+ * cdef bint setlinger=False
+ */
+ __pyx_v_rc = 0;
+
+ /* "zmq/backend/cython/socket.pyx":319
+ * cdef int rc=0
+ * cdef int linger_c
+ * cdef bint setlinger=False # <<<<<<<<<<<<<<
+ *
+ * if linger is not None:
+ */
+ __pyx_v_setlinger = 0;
+
+ /* "zmq/backend/cython/socket.pyx":321
+ * cdef bint setlinger=False
+ *
+ * if linger is not None: # <<<<<<<<<<<<<<
+ * linger_c = linger
+ * setlinger=True
+ */
+ __pyx_t_1 = (__pyx_v_linger != Py_None);
+ __pyx_t_2 = (__pyx_t_1 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":322
+ *
+ * if linger is not None:
+ * linger_c = linger # <<<<<<<<<<<<<<
+ * setlinger=True
+ *
+ */
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_linger); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_linger_c = __pyx_t_3;
+
+ /* "zmq/backend/cython/socket.pyx":323
+ * if linger is not None:
+ * linger_c = linger
+ * setlinger=True # <<<<<<<<<<<<<<
+ *
+ * if self.handle != NULL and not self._closed and getpid() == self._pid:
+ */
+ __pyx_v_setlinger = 1;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":325
+ * setlinger=True
+ *
+ * if self.handle != NULL and not self._closed and getpid() == self._pid: # <<<<<<<<<<<<<<
+ * if setlinger:
+ * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
+ */
+ __pyx_t_1 = ((__pyx_v_self->handle != NULL) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_1 = ((!(__pyx_v_self->_closed != 0)) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_1 = ((getpid() == __pyx_v_self->_pid) != 0);
+ __pyx_t_2 = __pyx_t_1;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":326
+ *
+ * if self.handle != NULL and not self._closed and getpid() == self._pid:
+ * if setlinger: # <<<<<<<<<<<<<<
+ * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
+ * rc = zmq_close(self.handle)
+ */
+ __pyx_t_2 = (__pyx_v_setlinger != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":327
+ * if self.handle != NULL and not self._closed and getpid() == self._pid:
+ * if setlinger:
+ * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int)) # <<<<<<<<<<<<<<
+ * rc = zmq_close(self.handle)
+ * if rc < 0 and zmq_errno() != ENOTSOCK:
+ */
+ zmq_setsockopt(__pyx_v_self->handle, ZMQ_LINGER, (&__pyx_v_linger_c), (sizeof(int)));
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "zmq/backend/cython/socket.pyx":328
+ * if setlinger:
+ * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
+ * rc = zmq_close(self.handle) # <<<<<<<<<<<<<<
+ * if rc < 0 and zmq_errno() != ENOTSOCK:
+ * # ignore ENOTSOCK (closed by Context)
+ */
+ __pyx_v_rc = zmq_close(__pyx_v_self->handle);
+
+ /* "zmq/backend/cython/socket.pyx":329
+ * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
+ * rc = zmq_close(self.handle)
+ * if rc < 0 and zmq_errno() != ENOTSOCK: # <<<<<<<<<<<<<<
+ * # ignore ENOTSOCK (closed by Context)
+ * _check_rc(rc)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L10_bool_binop_done;
+ }
+ __pyx_t_4 = __Pyx_PyInt_From_int(zmq_errno()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ENOTSOCK); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_2 = __pyx_t_1;
+ __pyx_L10_bool_binop_done:;
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":331
+ * if rc < 0 and zmq_errno() != ENOTSOCK:
+ * # ignore ENOTSOCK (closed by Context)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * self._closed = True
+ * # during gc, self.context might be NULL
+ */
+ __pyx_t_3 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+
+ /* "zmq/backend/cython/socket.pyx":332
+ * # ignore ENOTSOCK (closed by Context)
+ * _check_rc(rc)
+ * self._closed = True # <<<<<<<<<<<<<<
+ * # during gc, self.context might be NULL
+ * if self.context:
+ */
+ __pyx_v_self->_closed = 1;
+
+ /* "zmq/backend/cython/socket.pyx":334
+ * self._closed = True
+ * # during gc, self.context might be NULL
+ * if self.context: # <<<<<<<<<<<<<<
+ * self.context._remove_socket(self.handle)
+ * self.handle = NULL
+ */
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->context)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":335
+ * # during gc, self.context might be NULL
+ * if self.context:
+ * self.context._remove_socket(self.handle) # <<<<<<<<<<<<<<
+ * self.handle = NULL
+ *
+ */
+ ((struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *)__pyx_v_self->context->__pyx_vtab)->_remove_socket(__pyx_v_self->context, __pyx_v_self->handle);
+ goto __pyx_L12;
+ }
+ __pyx_L12:;
+
+ /* "zmq/backend/cython/socket.pyx":336
+ * if self.context:
+ * self.context._remove_socket(self.handle)
+ * self.handle = NULL # <<<<<<<<<<<<<<
+ *
+ * def set(self, int option, optval):
+ */
+ __pyx_v_self->handle = NULL;
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/socket.pyx":306
+ * return _check_closed_deep(self)
+ *
+ * def close(self, linger=None): # <<<<<<<<<<<<<<
+ * """s.close(linger=None)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":338
+ * self.handle = NULL
+ *
+ * def set(self, int option, optval): # <<<<<<<<<<<<<<
+ * """s.set(option, optval)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_13set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_12set[] = "s.set(option, optval)\n\n Set socket options.\n\n See the 0MQ API documentation for details on specific options.\n\n Parameters\n ----------\n option : int\n The option to set. Available values will depend on your\n version of libzmq. Examples include::\n \n zmq.SUBSCRIBE, UNSUBSCRIBE, IDENTITY, HWM, LINGER, FD\n \n optval : int or bytes\n The value of the option to set.\n\n Notes\n -----\n .. warning::\n\n All options other than zmq.SUBSCRIBE, zmq.UNSUBSCRIBE and\n zmq.LINGER only take effect for subsequent socket bind/connects.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_13set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_v_option;
+ PyObject *__pyx_v_optval = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("set (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_option,&__pyx_n_s_optval,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_option)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_optval)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ __pyx_v_option = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_optval = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_12set(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_option, __pyx_v_optval);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_12set(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_option, PyObject *__pyx_v_optval) {
+ pyzmq_int64_t __pyx_v_optval_int64_c;
+ int __pyx_v_optval_int_c;
+ char *__pyx_v_optval_c;
+ Py_ssize_t __pyx_v_sz;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ char *__pyx_t_6;
+ Py_ssize_t __pyx_t_7;
+ pyzmq_int64_t __pyx_t_8;
+ int __pyx_t_9;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("set", 0);
+
+ /* "zmq/backend/cython/socket.pyx":368
+ * cdef Py_ssize_t sz
+ *
+ * _check_closed(self) # <<<<<<<<<<<<<<
+ * if isinstance(optval, unicode):
+ * raise TypeError("unicode not allowed, use setsockopt_string")
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":369
+ *
+ * _check_closed(self)
+ * if isinstance(optval, unicode): # <<<<<<<<<<<<<<
+ * raise TypeError("unicode not allowed, use setsockopt_string")
+ *
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_optval, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":370
+ * _check_closed(self)
+ * if isinstance(optval, unicode):
+ * raise TypeError("unicode not allowed, use setsockopt_string") # <<<<<<<<<<<<<<
+ *
+ * if option in zmq.constants.bytes_sockopts:
+ */
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":372
+ * raise TypeError("unicode not allowed, use setsockopt_string")
+ *
+ * if option in zmq.constants.bytes_sockopts: # <<<<<<<<<<<<<<
+ * if not isinstance(optval, bytes):
+ * raise TypeError('expected bytes, got: %r' % optval)
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_constants); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_bytes_sockopts); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_t_1, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_2 = (__pyx_t_3 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":373
+ *
+ * if option in zmq.constants.bytes_sockopts:
+ * if not isinstance(optval, bytes): # <<<<<<<<<<<<<<
+ * raise TypeError('expected bytes, got: %r' % optval)
+ * optval_c = PyBytes_AsString(optval)
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_optval, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":374
+ * if option in zmq.constants.bytes_sockopts:
+ * if not isinstance(optval, bytes):
+ * raise TypeError('expected bytes, got: %r' % optval) # <<<<<<<<<<<<<<
+ * optval_c = PyBytes_AsString(optval)
+ * sz = PyBytes_Size(optval)
+ */
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_expected_bytes_got_r, __pyx_v_optval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":375
+ * if not isinstance(optval, bytes):
+ * raise TypeError('expected bytes, got: %r' % optval)
+ * optval_c = PyBytes_AsString(optval) # <<<<<<<<<<<<<<
+ * sz = PyBytes_Size(optval)
+ * _setsockopt(self.handle, option, optval_c, sz)
+ */
+ __pyx_t_6 = PyBytes_AsString(__pyx_v_optval); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_optval_c = __pyx_t_6;
+
+ /* "zmq/backend/cython/socket.pyx":376
+ * raise TypeError('expected bytes, got: %r' % optval)
+ * optval_c = PyBytes_AsString(optval)
+ * sz = PyBytes_Size(optval) # <<<<<<<<<<<<<<
+ * _setsockopt(self.handle, option, optval_c, sz)
+ * elif option in zmq.constants.int64_sockopts:
+ */
+ __pyx_t_7 = PyBytes_Size(__pyx_v_optval); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_sz = __pyx_t_7;
+
+ /* "zmq/backend/cython/socket.pyx":377
+ * optval_c = PyBytes_AsString(optval)
+ * sz = PyBytes_Size(optval)
+ * _setsockopt(self.handle, option, optval_c, sz) # <<<<<<<<<<<<<<
+ * elif option in zmq.constants.int64_sockopts:
+ * if not isinstance(optval, int):
+ */
+ __pyx_t_4 = __pyx_f_3zmq_7backend_6cython_6socket__setsockopt(__pyx_v_self->handle, __pyx_v_option, __pyx_v_optval_c, __pyx_v_sz); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L4;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":378
+ * sz = PyBytes_Size(optval)
+ * _setsockopt(self.handle, option, optval_c, sz)
+ * elif option in zmq.constants.int64_sockopts: # <<<<<<<<<<<<<<
+ * if not isinstance(optval, int):
+ * raise TypeError('expected int, got: %r' % optval)
+ */
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_constants); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64_sockopts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_t_4, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_2 = (__pyx_t_3 != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":379
+ * _setsockopt(self.handle, option, optval_c, sz)
+ * elif option in zmq.constants.int64_sockopts:
+ * if not isinstance(optval, int): # <<<<<<<<<<<<<<
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int64_c = optval
+ */
+ __pyx_t_2 = PyInt_Check(__pyx_v_optval);
+ __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":380
+ * elif option in zmq.constants.int64_sockopts:
+ * if not isinstance(optval, int):
+ * raise TypeError('expected int, got: %r' % optval) # <<<<<<<<<<<<<<
+ * optval_int64_c = optval
+ * _setsockopt(self.handle, option, &optval_int64_c, sizeof(int64_t))
+ */
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_int_got_r, __pyx_v_optval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":381
+ * if not isinstance(optval, int):
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int64_c = optval # <<<<<<<<<<<<<<
+ * _setsockopt(self.handle, option, &optval_int64_c, sizeof(int64_t))
+ * else:
+ */
+ __pyx_t_8 = __Pyx_PyInt_As_pyzmq_int64_t(__pyx_v_optval); if (unlikely((__pyx_t_8 == (pyzmq_int64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_optval_int64_c = __pyx_t_8;
+
+ /* "zmq/backend/cython/socket.pyx":382
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int64_c = optval
+ * _setsockopt(self.handle, option, &optval_int64_c, sizeof(int64_t)) # <<<<<<<<<<<<<<
+ * else:
+ * # default is to assume int, which is what most new sockopts will be
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__setsockopt(__pyx_v_self->handle, __pyx_v_option, (&__pyx_v_optval_int64_c), (sizeof(pyzmq_int64_t))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L4;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/socket.pyx":389
+ * # sockopts will still raise just the same, but it will be libzmq doing
+ * # the raising.
+ * if not isinstance(optval, int): # <<<<<<<<<<<<<<
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int_c = optval
+ */
+ __pyx_t_3 = PyInt_Check(__pyx_v_optval);
+ __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":390
+ * # the raising.
+ * if not isinstance(optval, int):
+ * raise TypeError('expected int, got: %r' % optval) # <<<<<<<<<<<<<<
+ * optval_int_c = optval
+ * _setsockopt(self.handle, option, &optval_int_c, sizeof(int))
+ */
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_int_got_r, __pyx_v_optval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":391
+ * if not isinstance(optval, int):
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int_c = optval # <<<<<<<<<<<<<<
+ * _setsockopt(self.handle, option, &optval_int_c, sizeof(int))
+ *
+ */
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_optval); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_optval_int_c = __pyx_t_9;
+
+ /* "zmq/backend/cython/socket.pyx":392
+ * raise TypeError('expected int, got: %r' % optval)
+ * optval_int_c = optval
+ * _setsockopt(self.handle, option, &optval_int_c, sizeof(int)) # <<<<<<<<<<<<<<
+ *
+ * def get(self, int option):
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__setsockopt(__pyx_v_self->handle, __pyx_v_option, (&__pyx_v_optval_int_c), (sizeof(int))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/socket.pyx":338
+ * self.handle = NULL
+ *
+ * def set(self, int option, optval): # <<<<<<<<<<<<<<
+ * """s.set(option, optval)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":394
+ * _setsockopt(self.handle, option, &optval_int_c, sizeof(int))
+ *
+ * def get(self, int option): # <<<<<<<<<<<<<<
+ * """s.get(option)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_15get(PyObject *__pyx_v_self, PyObject *__pyx_arg_option); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_14get[] = "s.get(option)\n\n Get the value of a socket option.\n\n See the 0MQ API documentation for details on specific options.\n\n Parameters\n ----------\n option : int\n The option to get. Available values will depend on your\n version of libzmq. Examples include::\n \n zmq.IDENTITY, HWM, LINGER, FD, EVENTS\n\n Returns\n -------\n optval : int or bytes\n The value of the option as a bytestring or int.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_15get(PyObject *__pyx_v_self, PyObject *__pyx_arg_option) {
+ int __pyx_v_option;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("get (wrapper)", 0);
+ assert(__pyx_arg_option); {
+ __pyx_v_option = __Pyx_PyInt_As_int(__pyx_arg_option); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_14get(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((int)__pyx_v_option));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_14get(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_option) {
+ pyzmq_int64_t __pyx_v_optval_int64_c;
+ int __pyx_v_optval_int_c;
+ ZMQ_FD_T __pyx_v_optval_fd_c;
+ char __pyx_v_identity_str_c[255];
+ size_t __pyx_v_sz;
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ int __pyx_t_5;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("get", 0);
+
+ /* "zmq/backend/cython/socket.pyx":421
+ * cdef int rc
+ *
+ * _check_closed(self) # <<<<<<<<<<<<<<
+ *
+ * if option in zmq.constants.bytes_sockopts:
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":423
+ * _check_closed(self)
+ *
+ * if option in zmq.constants.bytes_sockopts: # <<<<<<<<<<<<<<
+ * sz = 255
+ * _getsockopt(self.handle, option, <void *>identity_str_c, &sz)
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_bytes_sockopts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_1, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = (__pyx_t_4 != 0);
+ if (__pyx_t_5) {
+
+ /* "zmq/backend/cython/socket.pyx":424
+ *
+ * if option in zmq.constants.bytes_sockopts:
+ * sz = 255 # <<<<<<<<<<<<<<
+ * _getsockopt(self.handle, option, <void *>identity_str_c, &sz)
+ * # strip null-terminated strings *except* identity
+ */
+ __pyx_v_sz = 255;
+
+ /* "zmq/backend/cython/socket.pyx":425
+ * if option in zmq.constants.bytes_sockopts:
+ * sz = 255
+ * _getsockopt(self.handle, option, <void *>identity_str_c, &sz) # <<<<<<<<<<<<<<
+ * # strip null-terminated strings *except* identity
+ * if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0':
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_6socket__getsockopt(__pyx_v_self->handle, __pyx_v_option, ((void *)__pyx_v_identity_str_c), (&__pyx_v_sz)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":427
+ * _getsockopt(self.handle, option, <void *>identity_str_c, &sz)
+ * # strip null-terminated strings *except* identity
+ * if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0': # <<<<<<<<<<<<<<
+ * sz -= 1
+ * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
+ */
+ __pyx_t_4 = ((__pyx_v_option != ZMQ_IDENTITY) != 0);
+ if (__pyx_t_4) {
+ } else {
+ __pyx_t_5 = __pyx_t_4;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_4 = ((__pyx_v_sz > 0) != 0);
+ if (__pyx_t_4) {
+ } else {
+ __pyx_t_5 = __pyx_t_4;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_4 = (((((char *)__pyx_v_identity_str_c)[(__pyx_v_sz - 1)]) == '\x00') != 0);
+ __pyx_t_5 = __pyx_t_4;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_5) {
+
+ /* "zmq/backend/cython/socket.pyx":428
+ * # strip null-terminated strings *except* identity
+ * if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0':
+ * sz -= 1 # <<<<<<<<<<<<<<
+ * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
+ * elif option in zmq.constants.int64_sockopts:
+ */
+ __pyx_v_sz = (__pyx_v_sz - 1);
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/socket.pyx":429
+ * if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0':
+ * sz -= 1
+ * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz) # <<<<<<<<<<<<<<
+ * elif option in zmq.constants.int64_sockopts:
+ * sz = sizeof(int64_t)
+ */
+ __pyx_t_2 = PyBytes_FromStringAndSize(((char *)__pyx_v_identity_str_c), __pyx_v_sz); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v_result = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L3;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":430
+ * sz -= 1
+ * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
+ * elif option in zmq.constants.int64_sockopts: # <<<<<<<<<<<<<<
+ * sz = sizeof(int64_t)
+ * _getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
+ */
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64_sockopts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_t_2, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = (__pyx_t_5 != 0);
+ if (__pyx_t_4) {
+
+ /* "zmq/backend/cython/socket.pyx":431
+ * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
+ * elif option in zmq.constants.int64_sockopts:
+ * sz = sizeof(int64_t) # <<<<<<<<<<<<<<
+ * _getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
+ * result = optval_int64_c
+ */
+ __pyx_v_sz = (sizeof(pyzmq_int64_t));
+
+ /* "zmq/backend/cython/socket.pyx":432
+ * elif option in zmq.constants.int64_sockopts:
+ * sz = sizeof(int64_t)
+ * _getsockopt(self.handle, option, <void *>&optval_int64_c, &sz) # <<<<<<<<<<<<<<
+ * result = optval_int64_c
+ * elif option in zmq.constants.fd_sockopts:
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__getsockopt(__pyx_v_self->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int64_c)), (&__pyx_v_sz)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":433
+ * sz = sizeof(int64_t)
+ * _getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
+ * result = optval_int64_c # <<<<<<<<<<<<<<
+ * elif option in zmq.constants.fd_sockopts:
+ * sz = sizeof(fd_t)
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_pyzmq_int64_t(__pyx_v_optval_int64_c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_result = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L3;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":434
+ * _getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
+ * result = optval_int64_c
+ * elif option in zmq.constants.fd_sockopts: # <<<<<<<<<<<<<<
+ * sz = sizeof(fd_t)
+ * _getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fd_sockopts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_1, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = (__pyx_t_4 != 0);
+ if (__pyx_t_5) {
+
+ /* "zmq/backend/cython/socket.pyx":435
+ * result = optval_int64_c
+ * elif option in zmq.constants.fd_sockopts:
+ * sz = sizeof(fd_t) # <<<<<<<<<<<<<<
+ * _getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
+ * result = optval_fd_c
+ */
+ __pyx_v_sz = (sizeof(ZMQ_FD_T));
+
+ /* "zmq/backend/cython/socket.pyx":436
+ * elif option in zmq.constants.fd_sockopts:
+ * sz = sizeof(fd_t)
+ * _getsockopt(self.handle, option, <void *>&optval_fd_c, &sz) # <<<<<<<<<<<<<<
+ * result = optval_fd_c
+ * else:
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_6socket__getsockopt(__pyx_v_self->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_fd_c)), (&__pyx_v_sz)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":437
+ * sz = sizeof(fd_t)
+ * _getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
+ * result = optval_fd_c # <<<<<<<<<<<<<<
+ * else:
+ * # default is to assume int, which is what most new sockopts will be
+ */
+ __pyx_t_2 = __Pyx_PyInt_From_ZMQ_FD_T(__pyx_v_optval_fd_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v_result = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/socket.pyx":444
+ * # sockopts will still raise just the same, but it will be libzmq doing
+ * # the raising.
+ * sz = sizeof(int) # <<<<<<<<<<<<<<
+ * _getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
+ * result = optval_int_c
+ */
+ __pyx_v_sz = (sizeof(int));
+
+ /* "zmq/backend/cython/socket.pyx":445
+ * # the raising.
+ * sz = sizeof(int)
+ * _getsockopt(self.handle, option, <void *>&optval_int_c, &sz) # <<<<<<<<<<<<<<
+ * result = optval_int_c
+ *
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_6socket__getsockopt(__pyx_v_self->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int_c)), (&__pyx_v_sz)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":446
+ * sz = sizeof(int)
+ * _getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
+ * result = optval_int_c # <<<<<<<<<<<<<<
+ *
+ * return result
+ */
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_optval_int_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v_result = __pyx_t_2;
+ __pyx_t_2 = 0;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":448
+ * result = optval_int_c
+ *
+ * return result # <<<<<<<<<<<<<<
+ *
+ * def bind(self, addr):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/socket.pyx":394
+ * _setsockopt(self.handle, option, &optval_int_c, sizeof(int))
+ *
+ * def get(self, int option): # <<<<<<<<<<<<<<
+ * """s.get(option)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":450
+ * return result
+ *
+ * def bind(self, addr): # <<<<<<<<<<<<<<
+ * """s.bind(addr)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_17bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_16bind[] = "s.bind(addr)\n\n Bind the socket to an address.\n\n This causes the socket to listen on a network port. Sockets on the\n other side of this connection will use ``Socket.connect(addr)`` to\n connect to this socket.\n\n Parameters\n ----------\n addr : str\n The address string. This has the form 'protocol://interface:port',\n for example 'tcp://127.0.0.1:5555'. Protocols supported include\n tcp, udp, pgm, epgm, inproc and ipc. If the address is unicode, it is\n encoded to utf-8 first.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_17bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("bind (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_16bind(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_addr));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_16bind(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr) {
+ int __pyx_v_rc;
+ char *__pyx_v_c_addr;
+ PyObject *__pyx_v_path = NULL;
+ PyObject *__pyx_v_msg = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ char *__pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ Py_ssize_t __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ int __pyx_t_10;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("bind", 0);
+ __Pyx_INCREF(__pyx_v_addr);
+
+ /* "zmq/backend/cython/socket.pyx":470
+ * cdef char* c_addr
+ *
+ * _check_closed(self) # <<<<<<<<<<<<<<
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":471
+ *
+ * _check_closed(self)
+ * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":472
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_4);
+ __pyx_t_4 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":473
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":474
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
+ * c_addr = addr
+ * rc = zmq_bind(self.handle, c_addr)
+ */
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":475
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr # <<<<<<<<<<<<<<
+ * rc = zmq_bind(self.handle, c_addr)
+ * if rc != 0:
+ */
+ __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_c_addr = __pyx_t_5;
+
+ /* "zmq/backend/cython/socket.pyx":476
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr
+ * rc = zmq_bind(self.handle, c_addr) # <<<<<<<<<<<<<<
+ * if rc != 0:
+ * if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG:
+ */
+ __pyx_v_rc = zmq_bind(__pyx_v_self->handle, __pyx_v_c_addr);
+
+ /* "zmq/backend/cython/socket.pyx":477
+ * c_addr = addr
+ * rc = zmq_bind(self.handle, c_addr)
+ * if rc != 0: # <<<<<<<<<<<<<<
+ * if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG:
+ * # py3compat: addr is bytes, but msg wants str
+ */
+ __pyx_t_2 = ((__pyx_v_rc != 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":478
+ * rc = zmq_bind(self.handle, c_addr)
+ * if rc != 0:
+ * if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG: # <<<<<<<<<<<<<<
+ * # py3compat: addr is bytes, but msg wants str
+ * if str is unicode:
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_IPC_PATH_MAX_LEN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_3) {
+ } else {
+ __pyx_t_2 = __pyx_t_3;
+ goto __pyx_L7_bool_binop_done;
+ }
+ __pyx_t_3 = ((zmq_errno() == ENAMETOOLONG) != 0);
+ __pyx_t_2 = __pyx_t_3;
+ __pyx_L7_bool_binop_done:;
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":480
+ * if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG:
+ * # py3compat: addr is bytes, but msg wants str
+ * if str is unicode: # <<<<<<<<<<<<<<
+ * addr = addr.decode('utf-8', 'replace')
+ * path = addr.split('://', 1)[-1]
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = (((PyObject*)(&PyString_Type)) == ((PyObject*)__pyx_t_4));
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":481
+ * # py3compat: addr is bytes, but msg wants str
+ * if str is unicode:
+ * addr = addr.decode('utf-8', 'replace') # <<<<<<<<<<<<<<
+ * path = addr.split('://', 1)[-1]
+ * msg = ('ipc path "{0}" is longer than {1} '
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
+ __pyx_t_1 = 0;
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+
+ /* "zmq/backend/cython/socket.pyx":482
+ * if str is unicode:
+ * addr = addr.decode('utf-8', 'replace')
+ * path = addr.split('://', 1)[-1] # <<<<<<<<<<<<<<
+ * msg = ('ipc path "{0}" is longer than {1} '
+ * 'characters (sizeof(sockaddr_un.sun_path)). '
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_path = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":487
+ * 'zmq.IPC_PATH_MAX_LEN constant can be used '
+ * 'to check addr length (if it is defined).'
+ * .format(path, IPC_PATH_MAX_LEN)) # <<<<<<<<<<<<<<
+ * raise ZMQError(msg=msg)
+ * _check_rc(rc)
+ */
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_ipc_path_0_is_longer_than_1_char, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_IPC_PATH_MAX_LEN); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_7) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_path);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_path);
+ __Pyx_GIVEREF(__pyx_v_path);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_msg = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":488
+ * 'to check addr length (if it is defined).'
+ * .format(path, IPC_PATH_MAX_LEN))
+ * raise ZMQError(msg=msg) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_msg, __pyx_v_msg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_9, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "zmq/backend/cython/socket.pyx":489
+ * .format(path, IPC_PATH_MAX_LEN))
+ * raise ZMQError(msg=msg)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * def connect(self, addr):
+ */
+ __pyx_t_10 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/socket.pyx":450
+ * return result
+ *
+ * def bind(self, addr): # <<<<<<<<<<<<<<
+ * """s.bind(addr)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_path);
+ __Pyx_XDECREF(__pyx_v_msg);
+ __Pyx_XDECREF(__pyx_v_addr);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":491
+ * _check_rc(rc)
+ *
+ * def connect(self, addr): # <<<<<<<<<<<<<<
+ * """s.connect(addr)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_19connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_18connect[] = "s.connect(addr)\n\n Connect to a remote 0MQ socket.\n\n Parameters\n ----------\n addr : str\n The address string. This has the form 'protocol://interface:port',\n for example 'tcp://127.0.0.1:5555'. Protocols supported are\n tcp, upd, pgm, inproc and ipc. If the address is unicode, it is\n encoded to utf-8 first.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_19connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("connect (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_18connect(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_addr));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_18connect(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr) {
+ int __pyx_v_rc;
+ char *__pyx_v_c_addr;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ char *__pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("connect", 0);
+ __Pyx_INCREF(__pyx_v_addr);
+
+ /* "zmq/backend/cython/socket.pyx":507
+ * cdef char* c_addr
+ *
+ * _check_closed(self) # <<<<<<<<<<<<<<
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":508
+ *
+ * _check_closed(self)
+ * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = (__pyx_t_2 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":509
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_4);
+ __pyx_t_4 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":510
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr
+ */
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":511
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
+ * c_addr = addr
+ *
+ */
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":512
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_connect(self.handle, c_addr)
+ */
+ __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_c_addr = __pyx_t_5;
+
+ /* "zmq/backend/cython/socket.pyx":514
+ * c_addr = addr
+ *
+ * rc = zmq_connect(self.handle, c_addr) # <<<<<<<<<<<<<<
+ * if rc != 0:
+ * raise ZMQError()
+ */
+ __pyx_v_rc = zmq_connect(__pyx_v_self->handle, __pyx_v_c_addr);
+
+ /* "zmq/backend/cython/socket.pyx":515
+ *
+ * rc = zmq_connect(self.handle, c_addr)
+ * if rc != 0: # <<<<<<<<<<<<<<
+ * raise ZMQError()
+ *
+ */
+ __pyx_t_2 = ((__pyx_v_rc != 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/socket.pyx":516
+ * rc = zmq_connect(self.handle, c_addr)
+ * if rc != 0:
+ * raise ZMQError() # <<<<<<<<<<<<<<
+ *
+ * def unbind(self, addr):
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":491
+ * _check_rc(rc)
+ *
+ * def connect(self, addr): # <<<<<<<<<<<<<<
+ * """s.connect(addr)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_addr);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":518
+ * raise ZMQError()
+ *
+ * def unbind(self, addr): # <<<<<<<<<<<<<<
+ * """s.unbind(addr)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_21unbind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_20unbind[] = "s.unbind(addr)\n \n Unbind from an address (undoes a call to bind).\n \n .. versionadded:: libzmq-3.2\n .. versionadded:: 13.0\n\n Parameters\n ----------\n addr : str\n The address string. This has the form 'protocol://interface:port',\n for example 'tcp://127.0.0.1:5555'. Protocols supported are\n tcp, upd, pgm, inproc and ipc. If the address is unicode, it is\n encoded to utf-8 first.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_21unbind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("unbind (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_20unbind(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_addr));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_20unbind(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr) {
+ int __pyx_v_rc;
+ char *__pyx_v_c_addr;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ char *__pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("unbind", 0);
+ __Pyx_INCREF(__pyx_v_addr);
+
+ /* "zmq/backend/cython/socket.pyx":537
+ * cdef char* c_addr
+ *
+ * _check_version((3,2), "unbind") # <<<<<<<<<<<<<<
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":538
+ *
+ * _check_version((3,2), "unbind")
+ * _check_closed(self) # <<<<<<<<<<<<<<
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":539
+ * _check_version((3,2), "unbind")
+ * _check_closed(self)
+ * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "zmq/backend/cython/socket.pyx":540
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
+ __pyx_t_1 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":541
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":542
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
+ * c_addr = addr
+ *
+ */
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":543
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_unbind(self.handle, c_addr)
+ */
+ __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_c_addr = __pyx_t_5;
+
+ /* "zmq/backend/cython/socket.pyx":545
+ * c_addr = addr
+ *
+ * rc = zmq_unbind(self.handle, c_addr) # <<<<<<<<<<<<<<
+ * if rc != 0:
+ * raise ZMQError()
+ */
+ __pyx_v_rc = zmq_unbind(__pyx_v_self->handle, __pyx_v_c_addr);
+
+ /* "zmq/backend/cython/socket.pyx":546
+ *
+ * rc = zmq_unbind(self.handle, c_addr)
+ * if rc != 0: # <<<<<<<<<<<<<<
+ * raise ZMQError()
+ *
+ */
+ __pyx_t_3 = ((__pyx_v_rc != 0) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":547
+ * rc = zmq_unbind(self.handle, c_addr)
+ * if rc != 0:
+ * raise ZMQError() # <<<<<<<<<<<<<<
+ *
+ * def disconnect(self, addr):
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":518
+ * raise ZMQError()
+ *
+ * def unbind(self, addr): # <<<<<<<<<<<<<<
+ * """s.unbind(addr)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.unbind", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_addr);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":549
+ * raise ZMQError()
+ *
+ * def disconnect(self, addr): # <<<<<<<<<<<<<<
+ * """s.disconnect(addr)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_23disconnect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_22disconnect[] = "s.disconnect(addr)\n\n Disconnect from a remote 0MQ socket (undoes a call to connect).\n \n .. versionadded:: libzmq-3.2\n .. versionadded:: 13.0\n\n Parameters\n ----------\n addr : str\n The address string. This has the form 'protocol://interface:port',\n for example 'tcp://127.0.0.1:5555'. Protocols supported are\n tcp, upd, pgm, inproc and ipc. If the address is unicode, it is\n encoded to utf-8 first.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_23disconnect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("disconnect (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_22disconnect(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_addr));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_22disconnect(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr) {
+ int __pyx_v_rc;
+ char *__pyx_v_c_addr;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ char *__pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("disconnect", 0);
+ __Pyx_INCREF(__pyx_v_addr);
+
+ /* "zmq/backend/cython/socket.pyx":568
+ * cdef char* c_addr
+ *
+ * _check_version((3,2), "disconnect") # <<<<<<<<<<<<<<
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":569
+ *
+ * _check_version((3,2), "disconnect")
+ * _check_closed(self) # <<<<<<<<<<<<<<
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ */
+ __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":570
+ * _check_version((3,2), "disconnect")
+ * _check_closed(self)
+ * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "zmq/backend/cython/socket.pyx":571
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
+ __pyx_t_1 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":572
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":573
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
+ * c_addr = addr
+ *
+ */
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":574
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_disconnect(self.handle, c_addr)
+ */
+ __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_c_addr = __pyx_t_5;
+
+ /* "zmq/backend/cython/socket.pyx":576
+ * c_addr = addr
+ *
+ * rc = zmq_disconnect(self.handle, c_addr) # <<<<<<<<<<<<<<
+ * if rc != 0:
+ * raise ZMQError()
+ */
+ __pyx_v_rc = zmq_disconnect(__pyx_v_self->handle, __pyx_v_c_addr);
+
+ /* "zmq/backend/cython/socket.pyx":577
+ *
+ * rc = zmq_disconnect(self.handle, c_addr)
+ * if rc != 0: # <<<<<<<<<<<<<<
+ * raise ZMQError()
+ *
+ */
+ __pyx_t_3 = ((__pyx_v_rc != 0) != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":578
+ * rc = zmq_disconnect(self.handle, c_addr)
+ * if rc != 0:
+ * raise ZMQError() # <<<<<<<<<<<<<<
+ *
+ * def monitor(self, addr, int events=ZMQ_EVENT_ALL):
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":549
+ * raise ZMQError()
+ *
+ * def disconnect(self, addr): # <<<<<<<<<<<<<<
+ * """s.disconnect(addr)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_addr);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":580
+ * raise ZMQError()
+ *
+ * def monitor(self, addr, int events=ZMQ_EVENT_ALL): # <<<<<<<<<<<<<<
+ * """s.monitor(addr, flags)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_25monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_24monitor[] = "s.monitor(addr, flags)\n\n Start publishing socket events on inproc.\n See libzmq docs for zmq_monitor for details.\n \n While this function is available from libzmq 3.2,\n pyzmq cannot parse monitor messages from libzmq prior to 4.0.\n \n .. versionadded: libzmq-3.2\n .. versionadded: 14.0\n \n Parameters\n ----------\n addr : str\n The inproc url used for monitoring. Passing None as\n the addr will cause an existing socket monitor to be\n deregistered.\n events : int [default: zmq.EVENT_ALL]\n The zmq event bitmask for which events will be sent to the monitor.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_25monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_addr = 0;
+ int __pyx_v_events;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("monitor (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_events,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_events);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "monitor") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_addr = values[0];
+ if (values[1]) {
+ __pyx_v_events = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ } else {
+ __pyx_v_events = __pyx_k__15;
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("monitor", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_24monitor(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_addr, __pyx_v_events);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_24monitor(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr, int __pyx_v_events) {
+ int __pyx_v_rc;
+ int __pyx_v_c_flags;
+ char *__pyx_v_c_addr;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ char *__pyx_t_5;
+ int __pyx_t_6;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("monitor", 0);
+ __Pyx_INCREF(__pyx_v_addr);
+
+ /* "zmq/backend/cython/socket.pyx":602
+ * """
+ * cdef int rc, c_flags
+ * cdef char* c_addr = NULL # <<<<<<<<<<<<<<
+ *
+ * _check_version((3,2), "monitor")
+ */
+ __pyx_v_c_addr = NULL;
+
+ /* "zmq/backend/cython/socket.pyx":604
+ * cdef char* c_addr = NULL
+ *
+ * _check_version((3,2), "monitor") # <<<<<<<<<<<<<<
+ * if addr is not None:
+ * if isinstance(addr, unicode):
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":605
+ *
+ * _check_version((3,2), "monitor")
+ * if addr is not None: # <<<<<<<<<<<<<<
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ */
+ __pyx_t_3 = (__pyx_v_addr != Py_None);
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "zmq/backend/cython/socket.pyx":606
+ * _check_version((3,2), "monitor")
+ * if addr is not None:
+ * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_3 = (__pyx_t_4 != 0);
+ if (__pyx_t_3) {
+
+ /* "zmq/backend/cython/socket.pyx":607
+ * if addr is not None:
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
+ __pyx_t_1 = 0;
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/backend/cython/socket.pyx":608
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0);
+ if (__pyx_t_4) {
+
+ /* "zmq/backend/cython/socket.pyx":609
+ * addr = addr.encode('utf-8')
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
+ * c_addr = addr
+ * c_flags = events
+ */
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":610
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr # <<<<<<<<<<<<<<
+ * c_flags = events
+ * rc = zmq_socket_monitor(self.handle, c_addr, c_flags)
+ */
+ __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_c_addr = __pyx_t_5;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/socket.pyx":611
+ * raise TypeError('expected str, got: %r' % addr)
+ * c_addr = addr
+ * c_flags = events # <<<<<<<<<<<<<<
+ * rc = zmq_socket_monitor(self.handle, c_addr, c_flags)
+ * _check_rc(rc)
+ */
+ __pyx_v_c_flags = __pyx_v_events;
+
+ /* "zmq/backend/cython/socket.pyx":612
+ * c_addr = addr
+ * c_flags = events
+ * rc = zmq_socket_monitor(self.handle, c_addr, c_flags) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_socket_monitor(__pyx_v_self->handle, __pyx_v_c_addr, __pyx_v_c_flags);
+
+ /* "zmq/backend/cython/socket.pyx":613
+ * c_flags = events
+ * rc = zmq_socket_monitor(self.handle, c_addr, c_flags)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * #-------------------------------------------------------------------------
+ */
+ __pyx_t_6 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/socket.pyx":580
+ * raise ZMQError()
+ *
+ * def monitor(self, addr, int events=ZMQ_EVENT_ALL): # <<<<<<<<<<<<<<
+ * """s.monitor(addr, flags)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_addr);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":619
+ * #-------------------------------------------------------------------------
+ *
+ * cpdef object send(self, object data, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
+ * """s.send(data, flags=0, copy=True, track=False)
+ *
+ */
+
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_27send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_3zmq_7backend_6cython_6socket_6Socket_send(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args) {
+ int __pyx_v_flags = ((int)0);
+ PyObject *__pyx_v_copy = ((PyObject *)Py_True);
+ PyObject *__pyx_v_track = ((PyObject *)Py_False);
+ PyObject *__pyx_v_msg = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
+ int __pyx_t_9;
+ struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy __pyx_t_10;
+ int __pyx_t_11;
+ struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame __pyx_t_12;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("send", 0);
+ if (__pyx_optional_args) {
+ if (__pyx_optional_args->__pyx_n > 0) {
+ __pyx_v_flags = __pyx_optional_args->flags;
+ if (__pyx_optional_args->__pyx_n > 1) {
+ __pyx_v_copy = __pyx_optional_args->copy;
+ if (__pyx_optional_args->__pyx_n > 2) {
+ __pyx_v_track = __pyx_optional_args->track;
+ }
+ }
+ }
+ }
+ __Pyx_INCREF(__pyx_v_data);
+ /* Check if called by wrapper */
+ if (unlikely(__pyx_skip_dispatch)) ;
+ /* Check if overridden in Python */
+ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_27send)) {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
+ __Pyx_INCREF(__pyx_v_data);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_data);
+ __Pyx_GIVEREF(__pyx_v_data);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_copy);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_copy);
+ __Pyx_GIVEREF(__pyx_v_copy);
+ __Pyx_INCREF(__pyx_v_track);
+ PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_v_track);
+ __Pyx_GIVEREF(__pyx_v_track);
+ __pyx_t_3 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L0;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":656
+ *
+ * """
+ * _check_closed(self) # <<<<<<<<<<<<<<
+ *
+ * if isinstance(data, unicode):
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":658
+ * _check_closed(self)
+ *
+ * if isinstance(data, unicode): # <<<<<<<<<<<<<<
+ * raise TypeError("unicode not allowed, use send_string")
+ *
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = PyObject_IsInstance(__pyx_v_data, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_9 = (__pyx_t_8 != 0);
+ if (__pyx_t_9) {
+
+ /* "zmq/backend/cython/socket.pyx":659
+ *
+ * if isinstance(data, unicode):
+ * raise TypeError("unicode not allowed, use send_string") # <<<<<<<<<<<<<<
+ *
+ * if copy:
+ */
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":661
+ * raise TypeError("unicode not allowed, use send_string")
+ *
+ * if copy: # <<<<<<<<<<<<<<
+ * # msg.bytes never returns the input data object
+ * # it is always a copy, but always the same copy
+ */
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_9) {
+
+ /* "zmq/backend/cython/socket.pyx":664
+ * # msg.bytes never returns the input data object
+ * # it is always a copy, but always the same copy
+ * if isinstance(data, Frame): # <<<<<<<<<<<<<<
+ * data = data.buffer
+ * return _send_copy(self.handle, data, flags)
+ */
+ __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_data, ((PyObject*)__pyx_ptype_3zmq_7backend_6cython_7message_Frame));
+ __pyx_t_8 = (__pyx_t_9 != 0);
+ if (__pyx_t_8) {
+
+ /* "zmq/backend/cython/socket.pyx":665
+ * # it is always a copy, but always the same copy
+ * if isinstance(data, Frame):
+ * data = data.buffer # <<<<<<<<<<<<<<
+ * return _send_copy(self.handle, data, flags)
+ * else:
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_buffer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_1);
+ __pyx_t_1 = 0;
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "zmq/backend/cython/socket.pyx":666
+ * if isinstance(data, Frame):
+ * data = data.buffer
+ * return _send_copy(self.handle, data, flags) # <<<<<<<<<<<<<<
+ * else:
+ * if isinstance(data, Frame):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_10.__pyx_n = 1;
+ __pyx_t_10.flags = __pyx_v_flags;
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__send_copy(__pyx_v_self->handle, __pyx_v_data, &__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/socket.pyx":668
+ * return _send_copy(self.handle, data, flags)
+ * else:
+ * if isinstance(data, Frame): # <<<<<<<<<<<<<<
+ * if track and not data.tracker:
+ * raise ValueError('Not a tracked message')
+ */
+ __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_data, ((PyObject*)__pyx_ptype_3zmq_7backend_6cython_7message_Frame));
+ __pyx_t_9 = (__pyx_t_8 != 0);
+ if (__pyx_t_9) {
+
+ /* "zmq/backend/cython/socket.pyx":669
+ * else:
+ * if isinstance(data, Frame):
+ * if track and not data.tracker: # <<<<<<<<<<<<<<
+ * raise ValueError('Not a tracked message')
+ * msg = data
+ */
+ __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_track); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_8) {
+ } else {
+ __pyx_t_9 = __pyx_t_8;
+ goto __pyx_L8_bool_binop_done;
+ }
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_tracker); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_11 = ((!__pyx_t_8) != 0);
+ __pyx_t_9 = __pyx_t_11;
+ __pyx_L8_bool_binop_done:;
+ if (__pyx_t_9) {
+
+ /* "zmq/backend/cython/socket.pyx":670
+ * if isinstance(data, Frame):
+ * if track and not data.tracker:
+ * raise ValueError('Not a tracked message') # <<<<<<<<<<<<<<
+ * msg = data
+ * else:
+ */
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "zmq/backend/cython/socket.pyx":671
+ * if track and not data.tracker:
+ * raise ValueError('Not a tracked message')
+ * msg = data # <<<<<<<<<<<<<<
+ * else:
+ * msg = Frame(data, track=track)
+ */
+ __Pyx_INCREF(__pyx_v_data);
+ __pyx_v_msg = __pyx_v_data;
+ goto __pyx_L6;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/socket.pyx":673
+ * msg = data
+ * else:
+ * msg = Frame(data, track=track) # <<<<<<<<<<<<<<
+ * return _send_frame(self.handle, msg, flags)
+ *
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_data);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data);
+ __Pyx_GIVEREF(__pyx_v_data);
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_track, __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3zmq_7backend_6cython_7message_Frame)), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_msg = __pyx_t_4;
+ __pyx_t_4 = 0;
+ }
+ __pyx_L6:;
+
+ /* "zmq/backend/cython/socket.pyx":674
+ * else:
+ * msg = Frame(data, track=track)
+ * return _send_frame(self.handle, msg, flags) # <<<<<<<<<<<<<<
+ *
+ * cpdef object recv(self, int flags=0, copy=True, track=False):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ if (!(likely(((__pyx_v_msg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_msg, __pyx_ptype_3zmq_7backend_6cython_7message_Frame))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12.__pyx_n = 1;
+ __pyx_t_12.flags = __pyx_v_flags;
+ __pyx_t_4 = __pyx_f_3zmq_7backend_6cython_6socket__send_frame(__pyx_v_self->handle, ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_msg), &__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":619
+ * #-------------------------------------------------------------------------
+ *
+ * cpdef object send(self, object data, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
+ * """s.send(data, flags=0, copy=True, track=False)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.send", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_msg);
+ __Pyx_XDECREF(__pyx_v_data);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_27send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_26send[] = "s.send(data, flags=0, copy=True, track=False)\n\n Send a message on this socket.\n\n This queues the message to be sent by the IO thread at a later time.\n\n Parameters\n ----------\n data : object, str, Frame\n The content of the message.\n flags : int\n Any supported flag: NOBLOCK, SNDMORE.\n copy : bool\n Should the message be sent in a copying or non-copying manner.\n track : bool\n Should the message be tracked for notification that ZMQ has\n finished with it? (ignored if copy=True)\n\n Returns\n -------\n None : if `copy` or not track\n None if message was sent, raises an exception otherwise.\n MessageTracker : if track and not copy\n a MessageTracker object, whose `pending` property will\n be True until the send is completed.\n \n Raises\n ------\n TypeError\n If a unicode object is passed\n ValueError\n If `track=True`, but an untracked Frame is passed.\n ZMQError\n If the send does not succeed for any reason.\n \n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_27send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_data = 0;
+ int __pyx_v_flags;
+ PyObject *__pyx_v_copy = 0;
+ PyObject *__pyx_v_track = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("send (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_flags,&__pyx_n_s_copy,&__pyx_n_s_track,0};
+ PyObject* values[4] = {0,0,0,0};
+ values[2] = ((PyObject *)Py_True);
+ values[3] = ((PyObject *)Py_False);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ case 2:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_copy);
+ if (value) { values[2] = value; kw_args--; }
+ }
+ case 3:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_track);
+ if (value) { values[3] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_data = values[0];
+ if (values[1]) {
+ __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ } else {
+ __pyx_v_flags = ((int)0);
+ }
+ __pyx_v_copy = values[2];
+ __pyx_v_track = values[3];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("send", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.send", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_26send(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_data, __pyx_v_flags, __pyx_v_copy, __pyx_v_track);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_26send(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_v_flags, PyObject *__pyx_v_copy, PyObject *__pyx_v_track) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send __pyx_t_2;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("send", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2.__pyx_n = 3;
+ __pyx_t_2.flags = __pyx_v_flags;
+ __pyx_t_2.copy = __pyx_v_copy;
+ __pyx_t_2.track = __pyx_v_track;
+ __pyx_t_1 = __pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket->send(__pyx_v_self, __pyx_v_data, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.send", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pyx":676
+ * return _send_frame(self.handle, msg, flags)
+ *
+ * cpdef object recv(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
+ * """s.recv(flags=0, copy=True, track=False)
+ *
+ */
+
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_29recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_3zmq_7backend_6cython_6socket_6Socket_recv(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args) {
+ int __pyx_v_flags = ((int)0);
+ PyObject *__pyx_v_copy = ((PyObject *)Py_True);
+ PyObject *__pyx_v_track = ((PyObject *)Py_False);
+ struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_frame = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
+ struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy __pyx_t_9;
+ struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame __pyx_t_10;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("recv", 0);
+ if (__pyx_optional_args) {
+ if (__pyx_optional_args->__pyx_n > 0) {
+ __pyx_v_flags = __pyx_optional_args->flags;
+ if (__pyx_optional_args->__pyx_n > 1) {
+ __pyx_v_copy = __pyx_optional_args->copy;
+ if (__pyx_optional_args->__pyx_n > 2) {
+ __pyx_v_track = __pyx_optional_args->track;
+ }
+ }
+ }
+ }
+ /* Check if called by wrapper */
+ if (unlikely(__pyx_skip_dispatch)) ;
+ /* Check if overridden in Python */
+ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_recv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_29recv)) {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_copy);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_copy);
+ __Pyx_GIVEREF(__pyx_v_copy);
+ __Pyx_INCREF(__pyx_v_track);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_track);
+ __Pyx_GIVEREF(__pyx_v_track);
+ __pyx_t_3 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ goto __pyx_L0;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":707
+ * for any of the reasons zmq_msg_recv might fail.
+ * """
+ * _check_closed(self) # <<<<<<<<<<<<<<
+ *
+ * if copy:
+ */
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":709
+ * _check_closed(self)
+ *
+ * if copy: # <<<<<<<<<<<<<<
+ * return _recv_copy(self.handle, flags)
+ * else:
+ */
+ __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_8) {
+
+ /* "zmq/backend/cython/socket.pyx":710
+ *
+ * if copy:
+ * return _recv_copy(self.handle, flags) # <<<<<<<<<<<<<<
+ * else:
+ * frame = _recv_frame(self.handle, flags, track)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_9.__pyx_n = 1;
+ __pyx_t_9.flags = __pyx_v_flags;
+ __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__recv_copy(__pyx_v_self->handle, &__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/socket.pyx":712
+ * return _recv_copy(self.handle, flags)
+ * else:
+ * frame = _recv_frame(self.handle, flags, track) # <<<<<<<<<<<<<<
+ * frame.more = self.getsockopt(zmq.RCVMORE)
+ * return frame
+ */
+ __pyx_t_10.__pyx_n = 2;
+ __pyx_t_10.flags = __pyx_v_flags;
+ __pyx_t_10.track = __pyx_v_track;
+ __pyx_t_1 = ((PyObject *)__pyx_f_3zmq_7backend_6cython_6socket__recv_frame(__pyx_v_self->handle, &__pyx_t_10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_frame = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":713
+ * else:
+ * frame = _recv_frame(self.handle, flags, track)
+ * frame.more = self.getsockopt(zmq.RCVMORE) # <<<<<<<<<<<<<<
+ * return frame
+ *
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getsockopt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_RCVMORE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_frame->more = __pyx_t_8;
+
+ /* "zmq/backend/cython/socket.pyx":714
+ * frame = _recv_frame(self.handle, flags, track)
+ * frame.more = self.getsockopt(zmq.RCVMORE)
+ * return frame # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_frame));
+ __pyx_r = ((PyObject *)__pyx_v_frame);
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":676
+ * return _send_frame(self.handle, msg, flags)
+ *
+ * cpdef object recv(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
+ * """s.recv(flags=0, copy=True, track=False)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_frame);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_29recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_28recv[] = "s.recv(flags=0, copy=True, track=False)\n\n Receive a message.\n\n Parameters\n ----------\n flags : int\n Any supported flag: NOBLOCK. If NOBLOCK is set, this method\n will raise a ZMQError with EAGAIN if a message is not ready.\n If NOBLOCK is not set, then this method will block until a\n message arrives.\n copy : bool\n Should the message be received in a copying or non-copying manner?\n If False a Frame object is returned, if True a string copy of\n message is returned.\n track : bool\n Should the message be tracked for notification that ZMQ has\n finished with it? (ignored if copy=True)\n\n Returns\n -------\n msg : bytes, Frame\n The received message frame. If `copy` is False, then it will be a Frame,\n otherwise it will be bytes.\n \n Raises\n ------\n ZMQError\n for any of the reasons zmq_msg_recv might fail.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_29recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_v_flags;
+ PyObject *__pyx_v_copy = 0;
+ PyObject *__pyx_v_track = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("recv (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flags,&__pyx_n_s_copy,&__pyx_n_s_track,0};
+ PyObject* values[3] = {0,0,0};
+ values[1] = ((PyObject *)Py_True);
+ values[2] = ((PyObject *)Py_False);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_copy);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ case 2:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_track);
+ if (value) { values[2] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "recv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ if (values[0]) {
+ __pyx_v_flags = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ } else {
+ __pyx_v_flags = ((int)0);
+ }
+ __pyx_v_copy = values[1];
+ __pyx_v_track = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("recv", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_28recv(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_flags, __pyx_v_copy, __pyx_v_track);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_28recv(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_flags, PyObject *__pyx_v_copy, PyObject *__pyx_v_track) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv __pyx_t_2;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("recv", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2.__pyx_n = 3;
+ __pyx_t_2.flags = __pyx_v_flags;
+ __pyx_t_2.copy = __pyx_v_copy;
+ __pyx_t_2.track = __pyx_v_track;
+ __pyx_t_1 = __pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket->recv(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pxd":40
+ * # Hold on to a reference to the context to make sure it is not garbage
+ * # collected until the socket it done with it.
+ * cdef public Context context # The zmq Context object that owns this. # <<<<<<<<<<<<<<
+ * cdef public bint _closed # bool property for a closed socket.
+ * cdef int _pid # the pid of the process which created me (for fork safety)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context___get__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context___get__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self->context));
+ __pyx_r = ((PyObject *)__pyx_v_self->context);
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context_2__set__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context_2__set__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_3zmq_7backend_6cython_7context_Context))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_self->context);
+ __Pyx_DECREF(((PyObject *)__pyx_v_self->context));
+ __pyx_v_self->context = ((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.context.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_5__del__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_5__del__(PyObject *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context_4__del__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context_4__del__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__del__", 0);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_self->context);
+ __Pyx_DECREF(((PyObject *)__pyx_v_self->context));
+ __pyx_v_self->context = ((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)Py_None);
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/socket.pxd":41
+ * # collected until the socket it done with it.
+ * cdef public Context context # The zmq Context object that owns this.
+ * cdef public bint _closed # bool property for a closed socket. # <<<<<<<<<<<<<<
+ * cdef int _pid # the pid of the process which created me (for fork safety)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7_closed_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7_closed_1__get__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7_closed___get__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7_closed___get__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket._closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7_closed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7_closed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7_closed_2__set__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7_closed_2__set__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__set__", 0);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->_closed = __pyx_t_1;
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.socket.Socket._closed.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int __pyx_v_rc) {
+ int __pyx_v_errno;
+ PyObject *__pyx_v_InterruptedSystemCall = NULL;
+ PyObject *__pyx_v_Again = NULL;
+ PyObject *__pyx_v_ContextTerminated = NULL;
+ PyObject *__pyx_v_ZMQError = NULL;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_check_rc", 0);
+
+ /* "zmq/backend/cython/checkrc.pxd":11
+ * and raising the appropriate Exception class
+ * """
+ * cdef int errno = zmq_errno() # <<<<<<<<<<<<<<
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ */
+ __pyx_v_errno = zmq_errno();
+
+ /* "zmq/backend/cython/checkrc.pxd":12
+ * """
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals() # <<<<<<<<<<<<<<
+ * if rc < 0:
+ * if errno == EINTR:
+ */
+ __pyx_t_1 = PyErr_CheckSignals(); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/checkrc.pxd":13
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals()
+ * if rc < 0: # <<<<<<<<<<<<<<
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ */
+ __pyx_t_2 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ switch (__pyx_v_errno) {
+
+ /* "zmq/backend/cython/checkrc.pxd":14
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ * if errno == EINTR: # <<<<<<<<<<<<<<
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ */
+ case EINTR:
+
+ /* "zmq/backend/cython/checkrc.pxd":15
+ * if rc < 0:
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ */
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_4 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_InterruptedSystemCall = __pyx_t_3;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":16
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno) # <<<<<<<<<<<<<<
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_InterruptedSystemCall);
+ __pyx_t_5 = __pyx_v_InterruptedSystemCall; __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":17
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN: # <<<<<<<<<<<<<<
+ * from zmq.error import Again
+ * raise Again(errno)
+ */
+ case EAGAIN:
+
+ /* "zmq/backend/cython/checkrc.pxd":18
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ * from zmq.error import Again # <<<<<<<<<<<<<<
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ */
+ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_Again);
+ PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Again);
+ __Pyx_GIVEREF(__pyx_n_s_Again);
+ __pyx_t_5 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Again); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v_Again = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":19
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ * raise Again(errno) # <<<<<<<<<<<<<<
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ */
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_Again);
+ __pyx_t_7 = __pyx_v_Again; __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ case ETERM:
+
+ /* "zmq/backend/cython/checkrc.pxd":21
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated # <<<<<<<<<<<<<<
+ * raise ContextTerminated(errno)
+ * else:
+ */
+ __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_ContextTerminated);
+ PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_ContextTerminated);
+ __Pyx_GIVEREF(__pyx_n_s_ContextTerminated);
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_5, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ContextTerminated); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_v_ContextTerminated = __pyx_t_5;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":22
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno) # <<<<<<<<<<<<<<
+ * else:
+ * from zmq.error import ZMQError
+ */
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_v_ContextTerminated);
+ __pyx_t_6 = __pyx_v_ContextTerminated; __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_t_7, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ default:
+
+ /* "zmq/backend/cython/checkrc.pxd":24
+ * raise ContextTerminated(errno)
+ * else:
+ * from zmq.error import ZMQError # <<<<<<<<<<<<<<
+ * raise ZMQError(errno)
+ * return 0
+ */
+ __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_7, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_7);
+ __pyx_v_ZMQError = __pyx_t_7;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":25
+ * else:
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno) # <<<<<<<<<<<<<<
+ * return 0
+ */
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_v_ZMQError);
+ __pyx_t_3 = __pyx_v_ZMQError; __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ }
+ }
+
+ /* "zmq/backend/cython/checkrc.pxd":26
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno)
+ * return 0 # <<<<<<<<<<<<<<
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.checkrc._check_rc", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_InterruptedSystemCall);
+ __Pyx_XDECREF(__pyx_v_Again);
+ __Pyx_XDECREF(__pyx_v_ContextTerminated);
+ __Pyx_XDECREF(__pyx_v_ZMQError);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "message.pxd":55
+ *
+ *
+ * cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg): # <<<<<<<<<<<<<<
+ * """ Copy the data from a zmq_msg_t """
+ * cdef char *data_c = NULL
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_7message_copy_zmq_msg_bytes(zmq_msg_t *__pyx_v_zmq_msg) {
+ char *__pyx_v_data_c;
+ Py_ssize_t __pyx_v_data_len_c;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("copy_zmq_msg_bytes", 0);
+
+ /* "message.pxd":57
+ * cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg):
+ * """ Copy the data from a zmq_msg_t """
+ * cdef char *data_c = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t data_len_c
+ * data_c = <char *>zmq_msg_data(zmq_msg)
+ */
+ __pyx_v_data_c = NULL;
+
+ /* "message.pxd":59
+ * cdef char *data_c = NULL
+ * cdef Py_ssize_t data_len_c
+ * data_c = <char *>zmq_msg_data(zmq_msg) # <<<<<<<<<<<<<<
+ * data_len_c = zmq_msg_size(zmq_msg)
+ * return PyBytes_FromStringAndSize(data_c, data_len_c)
+ */
+ __pyx_v_data_c = ((char *)zmq_msg_data(__pyx_v_zmq_msg));
+
+ /* "message.pxd":60
+ * cdef Py_ssize_t data_len_c
+ * data_c = <char *>zmq_msg_data(zmq_msg)
+ * data_len_c = zmq_msg_size(zmq_msg) # <<<<<<<<<<<<<<
+ * return PyBytes_FromStringAndSize(data_c, data_len_c)
+ *
+ */
+ __pyx_v_data_len_c = zmq_msg_size(__pyx_v_zmq_msg);
+
+ /* "message.pxd":61
+ * data_c = <char *>zmq_msg_data(zmq_msg)
+ * data_len_c = zmq_msg_size(zmq_msg)
+ * return PyBytes_FromStringAndSize(data_c, data_len_c) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_data_c, __pyx_v_data_len_c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "message.pxd":55
+ *
+ *
+ * cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg): # <<<<<<<<<<<<<<
+ * """ Copy the data from a zmq_msg_t """
+ * cdef char *data_c = NULL
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("zmq.backend.cython.message.copy_zmq_msg_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":88
+ *
+ *
+ * cdef inline int memoryview_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ __Pyx_RefNannySetupContext("memoryview_available", 0);
+
+ /* "buffers.pxd":89
+ *
+ * cdef inline int memoryview_available():
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7) # <<<<<<<<<<<<<<
+ *
+ * cdef inline int oldstyle_available():
+ */
+ __pyx_t_2 = (PY_MAJOR_VERSION >= 3);
+ if (!__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L3_bool_binop_done;
+ }
+ __pyx_t_2 = (PY_MAJOR_VERSION >= 2);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L3_bool_binop_done;
+ }
+ __pyx_t_2 = (PY_MINOR_VERSION >= 7);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L3_bool_binop_done:;
+ __pyx_r = __pyx_t_1;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":88
+ *
+ *
+ * cdef inline int memoryview_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":91
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ * cdef inline int oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION < 3
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("oldstyle_available", 0);
+
+ /* "buffers.pxd":92
+ *
+ * cdef inline int oldstyle_available():
+ * return PY_MAJOR_VERSION < 3 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = (PY_MAJOR_VERSION < 3);
+ goto __pyx_L0;
+
+ /* "buffers.pxd":91
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ * cdef inline int oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION < 3
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":95
+ *
+ *
+ * cdef inline int check_buffer(object ob): # <<<<<<<<<<<<<<
+ * """Version independent check for whether an object is a buffer.
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *__pyx_v_ob) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ __Pyx_RefNannySetupContext("check_buffer", 0);
+
+ /* "buffers.pxd":107
+ * int : 0 if no buffer interface, 3 if newstyle buffer interface, 2 if oldstyle.
+ * """
+ * if PyObject_CheckBuffer(ob): # <<<<<<<<<<<<<<
+ * return 3
+ * if oldstyle_available():
+ */
+ __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_ob) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":108
+ * """
+ * if PyObject_CheckBuffer(ob):
+ * return 3 # <<<<<<<<<<<<<<
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2
+ */
+ __pyx_r = 3;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":109
+ * if PyObject_CheckBuffer(ob):
+ * return 3
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PyObject_CheckReadBuffer(ob) and 2
+ * return 0
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":110
+ * return 3
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2 # <<<<<<<<<<<<<<
+ * return 0
+ *
+ */
+ __pyx_t_3 = PyObject_CheckReadBuffer(__pyx_v_ob);
+ if (__pyx_t_3) {
+ } else {
+ __pyx_t_2 = __pyx_t_3;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_2 = 2;
+ __pyx_L5_bool_binop_done:;
+ __pyx_r = __pyx_t_2;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":111
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2
+ * return 0 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":95
+ *
+ *
+ * cdef inline int check_buffer(object ob): # <<<<<<<<<<<<<<
+ * """Version independent check for whether an object is a buffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":114
+ *
+ *
+ * cdef inline object asbuffer(object ob, int writable, int format, # <<<<<<<<<<<<<<
+ * void **base, Py_ssize_t *size,
+ * Py_ssize_t *itemsize):
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *__pyx_v_ob, int __pyx_v_writable, int __pyx_v_format, void **__pyx_v_base, Py_ssize_t *__pyx_v_size, Py_ssize_t *__pyx_v_itemsize) {
+ void *__pyx_v_bptr;
+ Py_ssize_t __pyx_v_blen;
+ Py_ssize_t __pyx_v_bitemlen;
+ Py_buffer __pyx_v_view;
+ int __pyx_v_flags;
+ int __pyx_v_mode;
+ PyObject *__pyx_v_bfmt = NULL;
+ PyObject *__pyx_v_dtype = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ void *__pyx_t_5;
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ int __pyx_t_17;
+ int __pyx_t_18;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer", 0);
+
+ /* "buffers.pxd":141
+ * """
+ *
+ * cdef void *bptr = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t blen = 0, bitemlen = 0
+ * cdef Py_buffer view
+ */
+ __pyx_v_bptr = NULL;
+
+ /* "buffers.pxd":142
+ *
+ * cdef void *bptr = NULL
+ * cdef Py_ssize_t blen = 0, bitemlen = 0 # <<<<<<<<<<<<<<
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE
+ */
+ __pyx_v_blen = 0;
+ __pyx_v_bitemlen = 0;
+
+ /* "buffers.pxd":144
+ * cdef Py_ssize_t blen = 0, bitemlen = 0
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE # <<<<<<<<<<<<<<
+ * cdef int mode = 0
+ *
+ */
+ __pyx_v_flags = PyBUF_SIMPLE;
+
+ /* "buffers.pxd":145
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE
+ * cdef int mode = 0 # <<<<<<<<<<<<<<
+ *
+ * bfmt = None
+ */
+ __pyx_v_mode = 0;
+
+ /* "buffers.pxd":147
+ * cdef int mode = 0
+ *
+ * bfmt = None # <<<<<<<<<<<<<<
+ *
+ * mode = check_buffer(ob)
+ */
+ __Pyx_INCREF(Py_None);
+ __pyx_v_bfmt = Py_None;
+
+ /* "buffers.pxd":149
+ * bfmt = None
+ *
+ * mode = check_buffer(ob) # <<<<<<<<<<<<<<
+ * if mode == 0:
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ */
+ __pyx_v_mode = __pyx_f_7buffers_check_buffer(__pyx_v_ob);
+
+ /* "buffers.pxd":150
+ *
+ * mode = check_buffer(ob)
+ * if mode == 0: # <<<<<<<<<<<<<<
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_mode == 0) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":151
+ * mode = check_buffer(ob)
+ * if mode == 0:
+ * raise TypeError("%r does not provide a buffer interface."%ob) # <<<<<<<<<<<<<<
+ *
+ * if mode == 3:
+ */
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_r_does_not_provide_a_buffer_int, __pyx_v_ob); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "buffers.pxd":153
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ *
+ * if mode == 3: # <<<<<<<<<<<<<<
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable:
+ */
+ __pyx_t_1 = ((__pyx_v_mode == 3) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":154
+ *
+ * if mode == 3:
+ * flags = PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
+ * if writable:
+ * flags |= PyBUF_WRITABLE
+ */
+ __pyx_v_flags = PyBUF_ANY_CONTIGUOUS;
+
+ /* "buffers.pxd":155
+ * if mode == 3:
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable: # <<<<<<<<<<<<<<
+ * flags |= PyBUF_WRITABLE
+ * if format:
+ */
+ __pyx_t_1 = (__pyx_v_writable != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":156
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable:
+ * flags |= PyBUF_WRITABLE # <<<<<<<<<<<<<<
+ * if format:
+ * flags |= PyBUF_FORMAT
+ */
+ __pyx_v_flags = (__pyx_v_flags | PyBUF_WRITABLE);
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "buffers.pxd":157
+ * if writable:
+ * flags |= PyBUF_WRITABLE
+ * if format: # <<<<<<<<<<<<<<
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags)
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":158
+ * flags |= PyBUF_WRITABLE
+ * if format:
+ * flags |= PyBUF_FORMAT # <<<<<<<<<<<<<<
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf
+ */
+ __pyx_v_flags = (__pyx_v_flags | PyBUF_FORMAT);
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "buffers.pxd":159
+ * if format:
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags) # <<<<<<<<<<<<<<
+ * bptr = view.buf
+ * blen = view.len
+ */
+ __pyx_t_4 = PyObject_GetBuffer(__pyx_v_ob, (&__pyx_v_view), __pyx_v_flags); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "buffers.pxd":160
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf # <<<<<<<<<<<<<<
+ * blen = view.len
+ * if format:
+ */
+ __pyx_t_5 = __pyx_v_view.buf;
+ __pyx_v_bptr = __pyx_t_5;
+
+ /* "buffers.pxd":161
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf
+ * blen = view.len # <<<<<<<<<<<<<<
+ * if format:
+ * if view.format != NULL:
+ */
+ __pyx_t_6 = __pyx_v_view.len;
+ __pyx_v_blen = __pyx_t_6;
+
+ /* "buffers.pxd":162
+ * bptr = view.buf
+ * blen = view.len
+ * if format: # <<<<<<<<<<<<<<
+ * if view.format != NULL:
+ * bfmt = view.format
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":163
+ * blen = view.len
+ * if format:
+ * if view.format != NULL: # <<<<<<<<<<<<<<
+ * bfmt = view.format
+ * bitemlen = view.itemsize
+ */
+ __pyx_t_1 = ((__pyx_v_view.format != NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":164
+ * if format:
+ * if view.format != NULL:
+ * bfmt = view.format # <<<<<<<<<<<<<<
+ * bitemlen = view.itemsize
+ * PyBuffer_Release(&view)
+ */
+ __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_view.format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":165
+ * if view.format != NULL:
+ * bfmt = view.format
+ * bitemlen = view.itemsize # <<<<<<<<<<<<<<
+ * PyBuffer_Release(&view)
+ * else: # oldstyle
+ */
+ __pyx_t_6 = __pyx_v_view.itemsize;
+ __pyx_v_bitemlen = __pyx_t_6;
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "buffers.pxd":166
+ * bfmt = view.format
+ * bitemlen = view.itemsize
+ * PyBuffer_Release(&view) # <<<<<<<<<<<<<<
+ * else: # oldstyle
+ * if writable:
+ */
+ PyBuffer_Release((&__pyx_v_view));
+ goto __pyx_L4;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":168
+ * PyBuffer_Release(&view)
+ * else: # oldstyle
+ * if writable: # <<<<<<<<<<<<<<
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_writable != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":169
+ * else: # oldstyle
+ * if writable:
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen) # <<<<<<<<<<<<<<
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ */
+ __pyx_t_4 = PyObject_AsWriteBuffer(__pyx_v_ob, (&__pyx_v_bptr), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L9;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":171
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen)
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen) # <<<<<<<<<<<<<<
+ * if format:
+ * try: # numpy.ndarray
+ */
+ __pyx_t_4 = PyObject_AsReadBuffer(__pyx_v_ob, ((const void **)(&__pyx_v_bptr)), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_L9:;
+
+ /* "buffers.pxd":172
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ * if format: # <<<<<<<<<<<<<<
+ * try: # numpy.ndarray
+ * dtype = ob.dtype
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":173
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ * if format:
+ * try: # numpy.ndarray # <<<<<<<<<<<<<<
+ * dtype = ob.dtype
+ * bfmt = dtype.char
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ /*try:*/ {
+
+ /* "buffers.pxd":174
+ * if format:
+ * try: # numpy.ndarray
+ * dtype = ob.dtype # <<<<<<<<<<<<<<
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v_dtype = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":175
+ * try: # numpy.ndarray
+ * dtype = ob.dtype
+ * bfmt = dtype.char # <<<<<<<<<<<<<<
+ * bitemlen = dtype.itemsize
+ * except AttributeError:
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_char); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":176
+ * dtype = ob.dtype
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize # <<<<<<<<<<<<<<
+ * except AttributeError:
+ * try: # array.array
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_bitemlen = __pyx_t_6;
+ }
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L18_try_end;
+ __pyx_L11_error:;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "buffers.pxd":177
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize
+ * except AttributeError: # <<<<<<<<<<<<<<
+ * try: # array.array
+ * bfmt = ob.typecode
+ */
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_10);
+
+ /* "buffers.pxd":178
+ * bitemlen = dtype.itemsize
+ * except AttributeError:
+ * try: # array.array # <<<<<<<<<<<<<<
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ /*try:*/ {
+
+ /* "buffers.pxd":179
+ * except AttributeError:
+ * try: # array.array
+ * bfmt = ob.typecode # <<<<<<<<<<<<<<
+ * bitemlen = ob.itemsize
+ * except AttributeError:
+ */
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_typecode); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_14);
+ __pyx_t_14 = 0;
+
+ /* "buffers.pxd":180
+ * try: # array.array
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize # <<<<<<<<<<<<<<
+ * except AttributeError:
+ * if isinstance(ob, bytes):
+ */
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_14); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_v_bitemlen = __pyx_t_6;
+ }
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ goto __pyx_L28_try_end;
+ __pyx_L21_error:;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "buffers.pxd":181
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize
+ * except AttributeError: # <<<<<<<<<<<<<<
+ * if isinstance(ob, bytes):
+ * bfmt = b"B"
+ */
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_16);
+
+ /* "buffers.pxd":182
+ * bitemlen = ob.itemsize
+ * except AttributeError:
+ * if isinstance(ob, bytes): # <<<<<<<<<<<<<<
+ * bfmt = b"B"
+ * bitemlen = 1
+ */
+ __pyx_t_1 = PyBytes_Check(__pyx_v_ob);
+ __pyx_t_17 = (__pyx_t_1 != 0);
+ if (__pyx_t_17) {
+
+ /* "buffers.pxd":183
+ * except AttributeError:
+ * if isinstance(ob, bytes):
+ * bfmt = b"B" # <<<<<<<<<<<<<<
+ * bitemlen = 1
+ * else:
+ */
+ __Pyx_INCREF(__pyx_n_b_B);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_n_b_B);
+
+ /* "buffers.pxd":184
+ * if isinstance(ob, bytes):
+ * bfmt = b"B"
+ * bitemlen = 1 # <<<<<<<<<<<<<<
+ * else:
+ * # nothing found
+ */
+ __pyx_v_bitemlen = 1;
+ goto __pyx_L31;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":187
+ * else:
+ * # nothing found
+ * bfmt = None # <<<<<<<<<<<<<<
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, Py_None);
+
+ /* "buffers.pxd":188
+ * # nothing found
+ * bfmt = None
+ * bitemlen = 0 # <<<<<<<<<<<<<<
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen
+ */
+ __pyx_v_bitemlen = 0;
+ }
+ __pyx_L31:;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ goto __pyx_L22_exception_handled;
+ }
+ goto __pyx_L23_except_error;
+ __pyx_L23_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ goto __pyx_L13_except_error;
+ __pyx_L22_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ __pyx_L28_try_end:;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ goto __pyx_L12_exception_handled;
+ }
+ goto __pyx_L13_except_error;
+ __pyx_L13_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ goto __pyx_L1_error;
+ __pyx_L12_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ __pyx_L18_try_end:;
+ }
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+ }
+ __pyx_L4:;
+
+ /* "buffers.pxd":189
+ * bfmt = None
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr # <<<<<<<<<<<<<<
+ * if size: size[0] = <Py_ssize_t>blen
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ */
+ __pyx_t_17 = (__pyx_v_base != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_base[0]) = ((void *)__pyx_v_bptr);
+ goto __pyx_L32;
+ }
+ __pyx_L32:;
+
+ /* "buffers.pxd":190
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen # <<<<<<<<<<<<<<
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ *
+ */
+ __pyx_t_17 = (__pyx_v_size != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_size[0]) = ((Py_ssize_t)__pyx_v_blen);
+ goto __pyx_L33;
+ }
+ __pyx_L33:;
+
+ /* "buffers.pxd":191
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen # <<<<<<<<<<<<<<
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ */
+ __pyx_t_17 = (__pyx_v_itemsize != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_itemsize[0]) = ((Py_ssize_t)__pyx_v_bitemlen);
+ goto __pyx_L34;
+ }
+ __pyx_L34:;
+
+ /* "buffers.pxd":193
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None: # <<<<<<<<<<<<<<
+ * return bfmt.decode('ascii')
+ * return bfmt
+ */
+ __pyx_t_1 = ((PY_MAJOR_VERSION >= 3) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_17 = __pyx_t_1;
+ goto __pyx_L36_bool_binop_done;
+ }
+ __pyx_t_1 = (__pyx_v_bfmt != Py_None);
+ __pyx_t_18 = (__pyx_t_1 != 0);
+ __pyx_t_17 = __pyx_t_18;
+ __pyx_L36_bool_binop_done:;
+ if (__pyx_t_17) {
+
+ /* "buffers.pxd":194
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii') # <<<<<<<<<<<<<<
+ * return bfmt
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bfmt, __pyx_n_s_decode); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":195
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii')
+ * return bfmt # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_bfmt);
+ __pyx_r = __pyx_v_bfmt;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":114
+ *
+ *
+ * cdef inline object asbuffer(object ob, int writable, int format, # <<<<<<<<<<<<<<
+ * void **base, Py_ssize_t *size,
+ * Py_ssize_t *itemsize):
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_14);
+ __Pyx_XDECREF(__pyx_t_15);
+ __Pyx_XDECREF(__pyx_t_16);
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_bfmt);
+ __Pyx_XDECREF(__pyx_v_dtype);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":198
+ *
+ *
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer_r", 0);
+
+ /* "buffers.pxd":200
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size):
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL) # <<<<<<<<<<<<<<
+ * return ob
+ *
+ */
+ __pyx_t_1 = __pyx_f_7buffers_asbuffer(__pyx_v_ob, 0, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "buffers.pxd":201
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ * return ob # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ob);
+ __pyx_r = __pyx_v_ob;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":198
+ *
+ *
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.asbuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":204
+ *
+ *
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_w(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer_w", 0);
+
+ /* "buffers.pxd":206
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size):
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL) # <<<<<<<<<<<<<<
+ * return ob
+ *
+ */
+ __pyx_t_1 = __pyx_f_7buffers_asbuffer(__pyx_v_ob, 1, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "buffers.pxd":207
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ * return ob # <<<<<<<<<<<<<<
+ *
+ * #------------------------------------------------------------------------------
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ob);
+ __pyx_r = __pyx_v_ob;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":204
+ *
+ *
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.asbuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":214
+ *
+ *
+ * cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 3 version of frombuffer.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ Py_buffer __pyx_v_pybuf;
+ Py_ssize_t *__pyx_v_shape;
+ PyObject *__pyx_v_astr = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ Py_ssize_t __pyx_t_1[1];
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_3", 0);
+
+ /* "buffers.pxd":221
+ * """
+ * cdef Py_buffer pybuf
+ * cdef Py_ssize_t *shape = [s] # <<<<<<<<<<<<<<
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ */
+ __pyx_t_1[0] = __pyx_v_s;
+ __pyx_v_shape = __pyx_t_1;
+
+ /* "buffers.pxd":222
+ * cdef Py_buffer pybuf
+ * cdef Py_ssize_t *shape = [s]
+ * cdef str astr="" # <<<<<<<<<<<<<<
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B"
+ */
+ __Pyx_INCREF(__pyx_kp_s__22);
+ __pyx_v_astr = __pyx_kp_s__22;
+
+ /* "buffers.pxd":223
+ * cdef Py_ssize_t *shape = [s]
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE) # <<<<<<<<<<<<<<
+ * pybuf.format = "B"
+ * pybuf.shape = shape
+ */
+ __pyx_t_2 = PyBuffer_FillInfo((&__pyx_v_pybuf), __pyx_v_astr, __pyx_v_ptr, __pyx_v_s, __pyx_v_readonly, PyBUF_SIMPLE); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "buffers.pxd":224
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B" # <<<<<<<<<<<<<<
+ * pybuf.shape = shape
+ * pybuf.ndim = 1
+ */
+ __pyx_v_pybuf.format = __pyx_k_B;
+
+ /* "buffers.pxd":225
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B"
+ * pybuf.shape = shape # <<<<<<<<<<<<<<
+ * pybuf.ndim = 1
+ * return PyMemoryView_FromBuffer(&pybuf)
+ */
+ __pyx_v_pybuf.shape = __pyx_v_shape;
+
+ /* "buffers.pxd":226
+ * pybuf.format = "B"
+ * pybuf.shape = shape
+ * pybuf.ndim = 1 # <<<<<<<<<<<<<<
+ * return PyMemoryView_FromBuffer(&pybuf)
+ *
+ */
+ __pyx_v_pybuf.ndim = 1;
+
+ /* "buffers.pxd":227
+ * pybuf.shape = shape
+ * pybuf.ndim = 1
+ * return PyMemoryView_FromBuffer(&pybuf) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = PyMemoryView_FromBuffer((&__pyx_v_pybuf)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":214
+ *
+ *
+ * cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 3 version of frombuffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("buffers.frombuffer_3", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_astr);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":230
+ *
+ *
+ * cdef inline object frombuffer_2(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 2 version of frombuffer.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_2", 0);
+
+ /* "buffers.pxd":236
+ * """
+ *
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * if readonly:
+ * return PyBuffer_FromMemory(ptr, s)
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":237
+ *
+ * if oldstyle_available():
+ * if readonly: # <<<<<<<<<<<<<<
+ * return PyBuffer_FromMemory(ptr, s)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_readonly != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":238
+ * if oldstyle_available():
+ * if readonly:
+ * return PyBuffer_FromMemory(ptr, s) # <<<<<<<<<<<<<<
+ * else:
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":240
+ * return PyBuffer_FromMemory(ptr, s)
+ * else:
+ * return PyBuffer_FromReadWriteMemory(ptr, s) # <<<<<<<<<<<<<<
+ * else:
+ * raise NotImplementedError("Old style buffers not available.")
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromReadWriteMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":242
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ * else:
+ * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[4]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "buffers.pxd":230
+ *
+ *
+ * cdef inline object frombuffer_2(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 2 version of frombuffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.frombuffer_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":245
+ *
+ *
+ * cdef inline object frombuffer(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Create a Python Buffer/View of a C array.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer", 0);
+
+ /* "buffers.pxd":262
+ * """
+ * # oldstyle first priority for now
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * return frombuffer_2(ptr, s, readonly)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":263
+ * # oldstyle first priority for now
+ * if oldstyle_available():
+ * return frombuffer_2(ptr, s, readonly) # <<<<<<<<<<<<<<
+ * else:
+ * return frombuffer_3(ptr, s, readonly)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_f_7buffers_frombuffer_2(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":265
+ * return frombuffer_2(ptr, s, readonly)
+ * else:
+ * return frombuffer_3(ptr, s, readonly) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_f_7buffers_frombuffer_3(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":245
+ *
+ *
+ * cdef inline object frombuffer(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Create a Python Buffer/View of a C array.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.frombuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":268
+ *
+ *
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_r(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_r", 0);
+
+ /* "buffers.pxd":270
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s):
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":268
+ *
+ *
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.frombuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":273
+ *
+ *
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_w(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_w", 0);
+
+ /* "buffers.pxd":275
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s):
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0) # <<<<<<<<<<<<<<
+ *
+ * #------------------------------------------------------------------------------
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":273
+ *
+ *
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.frombuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":282
+ * #------------------------------------------------------------------------------
+ *
+ * cdef inline object viewfromobject(object obj, int readonly): # <<<<<<<<<<<<<<
+ * """Construct a Python Buffer/View object from another Python object.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *__pyx_v_obj, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject", 0);
+
+ /* "buffers.pxd":298
+ * Buffer/View of the original object.
+ * """
+ * if not memoryview_available(): # <<<<<<<<<<<<<<
+ * if readonly:
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ */
+ __pyx_t_1 = ((!(__pyx_f_7buffers_memoryview_available() != 0)) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":299
+ * """
+ * if not memoryview_available():
+ * if readonly: # <<<<<<<<<<<<<<
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_readonly != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":300
+ * if not memoryview_available():
+ * if readonly:
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
+ * else:
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromObject(__pyx_v_obj, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":302
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
+ * else:
+ * return PyMemoryView_FromObject(obj)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromReadWriteObject(__pyx_v_obj, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":304
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ * return PyMemoryView_FromObject(obj) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyMemoryView_FromObject(__pyx_v_obj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":282
+ * #------------------------------------------------------------------------------
+ *
+ * cdef inline object viewfromobject(object obj, int readonly): # <<<<<<<<<<<<<<
+ * """Construct a Python Buffer/View object from another Python object.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.viewfromobject", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":307
+ *
+ *
+ * cdef inline object viewfromobject_r(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *__pyx_v_obj) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject_r", 0);
+
+ /* "buffers.pxd":309
+ * cdef inline object viewfromobject_r(object obj):
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_viewfromobject(__pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":307
+ *
+ *
+ * cdef inline object viewfromobject_r(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.viewfromobject_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":312
+ *
+ *
+ * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_w(PyObject *__pyx_v_obj) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject_w", 0);
+
+ /* "buffers.pxd":314
+ * cdef inline object viewfromobject_w(object obj):
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0) # <<<<<<<<<<<<<<
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_viewfromobject(__pyx_v_obj, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":312
+ *
+ *
+ * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.viewfromobject_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket __pyx_vtable_3zmq_7backend_6cython_6socket_Socket;
+
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_6socket_Socket(PyTypeObject *t, PyObject *a, PyObject *k) {
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)o);
+ p->__pyx_vtab = __pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket;
+ p->context = ((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)Py_None); Py_INCREF(Py_None);
+ if (unlikely(__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_3__cinit__(o, a, k) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
+ return o;
+}
+
+static void __pyx_tp_dealloc_3zmq_7backend_6cython_6socket_Socket(PyObject *o) {
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *p = (struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ PyObject_GC_UnTrack(o);
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_5__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ if (p->__weakref__) PyObject_ClearWeakRefs(o);
+ Py_CLEAR(p->context);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_3zmq_7backend_6cython_6socket_Socket(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *p = (struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)o;
+ if (p->context) {
+ e = (*v)(((PyObject*)p->context), a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_3zmq_7backend_6cython_6socket_Socket(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *p = (struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)o;
+ tmp = ((PyObject*)p->context);
+ p->context = ((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyObject *__pyx_getprop_3zmq_7backend_6cython_6socket_6Socket_context(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_1__get__(o);
+}
+
+static int __pyx_setprop_3zmq_7backend_6cython_6socket_6Socket_context(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7context_5__del__(o);
+ }
+}
+
+static PyObject *__pyx_getprop_3zmq_7backend_6cython_6socket_6Socket__closed(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7_closed_1__get__(o);
+}
+
+static int __pyx_setprop_3zmq_7backend_6cython_6socket_6Socket__closed(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7_closed_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_3zmq_7backend_6cython_6socket_Socket[] = {
+ {"underlying", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7underlying, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_6underlying},
+ {"closed", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_9closed, METH_NOARGS, 0},
+ {"close", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_11close, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_10close},
+ {"set", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_13set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_12set},
+ {"get", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_15get, METH_O, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_14get},
+ {"bind", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_17bind, METH_O, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_16bind},
+ {"connect", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_19connect, METH_O, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_18connect},
+ {"unbind", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_21unbind, METH_O, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_20unbind},
+ {"disconnect", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_23disconnect, METH_O, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_22disconnect},
+ {"monitor", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_25monitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_24monitor},
+ {"send", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_27send, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_26send},
+ {"recv", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_29recv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_28recv},
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_3zmq_7backend_6cython_6socket_Socket[] = {
+ {(char *)"context", __pyx_getprop_3zmq_7backend_6cython_6socket_6Socket_context, __pyx_setprop_3zmq_7backend_6cython_6socket_6Socket_context, 0, 0},
+ {(char *)"_closed", __pyx_getprop_3zmq_7backend_6cython_6socket_6Socket__closed, __pyx_setprop_3zmq_7backend_6cython_6socket_6Socket__closed, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_3zmq_7backend_6cython_6socket_Socket = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "zmq.backend.cython.socket.Socket", /*tp_name*/
+ sizeof(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_3zmq_7backend_6cython_6socket_Socket, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ "Socket(context, socket_type)\n\n A 0MQ socket.\n\n These objects will generally be constructed via the socket() method of a Context object.\n \n Note: 0MQ Sockets are *not* threadsafe. **DO NOT** share them across threads.\n \n Parameters\n ----------\n context : Context\n The 0MQ Context this Socket belongs to.\n socket_type : int\n The socket type, which can be any of the 0MQ socket types: \n REQ, REP, PUB, SUB, PAIR, DEALER, ROUTER, PULL, PUSH, XPUB, XSUB.\n \n See Also\n --------\n .Context.socket : method for creating a socket bound to a Context.\n ", /*tp_doc*/
+ __pyx_tp_traverse_3zmq_7backend_6cython_6socket_Socket, /*tp_traverse*/
+ __pyx_tp_clear_3zmq_7backend_6cython_6socket_Socket, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_3zmq_7backend_6cython_6socket_Socket, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_3zmq_7backend_6cython_6socket_Socket, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_3zmq_7backend_6cython_6socket_Socket, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) {
+ static const char* internal_type_names[] = {
+ "Context",
+ "Frame",
+ "Py_ssize_t",
+ "Socket",
+ "__pyx_ctuple_long__and_long",
+ "__pyx_ctuple_long__and_long_struct",
+ "__pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv",
+ "__pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send",
+ "__pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy",
+ "__pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame",
+ "__pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy",
+ "__pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame",
+ "const_char_ptr",
+ "const_void_ptr",
+ "fd_t",
+ "int64_t",
+ "zmq_free_fn",
+ "zmq_msg_t",
+ "zmq_pollitem_t",
+ 0
+ };
+ const char** type_name = internal_type_names;
+ while (*type_name) {
+ if (__Pyx_StrEq(name, *type_name)) {
+ PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name);
+ goto bad;
+ }
+ type_name++;
+ }
+ if (0);
+ else {
+ if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad;
+ }
+ return 0;
+ bad:
+ return -1;
+}
+
+
+/* import_all_from is an unexposed function from ceval.c */
+
+static int
+__Pyx_import_all_from(PyObject *locals, PyObject *v)
+{
+ PyObject *all = PyObject_GetAttrString(v, "__all__");
+ PyObject *dict, *name, *value;
+ int skip_leading_underscores = 0;
+ int pos, err;
+
+ if (all == NULL) {
+ if (!PyErr_ExceptionMatches(PyExc_AttributeError))
+ return -1; /* Unexpected error */
+ PyErr_Clear();
+ dict = PyObject_GetAttrString(v, "__dict__");
+ if (dict == NULL) {
+ if (!PyErr_ExceptionMatches(PyExc_AttributeError))
+ return -1;
+ PyErr_SetString(PyExc_ImportError,
+ "from-import-* object has no __dict__ and no __all__");
+ return -1;
+ }
+#if PY_MAJOR_VERSION < 3
+ all = PyObject_CallMethod(dict, (char *)"keys", NULL);
+#else
+ all = PyMapping_Keys(dict);
+#endif
+ Py_DECREF(dict);
+ if (all == NULL)
+ return -1;
+ skip_leading_underscores = 1;
+ }
+
+ for (pos = 0, err = 0; ; pos++) {
+ name = PySequence_GetItem(all, pos);
+ if (name == NULL) {
+ if (!PyErr_ExceptionMatches(PyExc_IndexError))
+ err = -1;
+ else
+ PyErr_Clear();
+ break;
+ }
+ if (skip_leading_underscores &&
+#if PY_MAJOR_VERSION < 3
+ PyString_Check(name) &&
+ PyString_AS_STRING(name)[0] == '_')
+#else
+ PyUnicode_Check(name) &&
+ PyUnicode_AS_UNICODE(name)[0] == '_')
+#endif
+ {
+ Py_DECREF(name);
+ continue;
+ }
+ value = PyObject_GetAttr(v, name);
+ if (value == NULL)
+ err = -1;
+ else if (PyDict_CheckExact(locals))
+ err = PyDict_SetItem(locals, name, value);
+ else
+ err = PyObject_SetItem(locals, name, value);
+ Py_DECREF(name);
+ Py_XDECREF(value);
+ if (err != 0)
+ break;
+ }
+ Py_DECREF(all);
+ return err;
+}
+
+
+static int __pyx_import_star(PyObject* m) {
+
+ int i;
+ int ret = -1;
+ char* s;
+ PyObject *locals = 0;
+ PyObject *list = 0;
+#if PY_MAJOR_VERSION >= 3
+ PyObject *utf8_name = 0;
+#endif
+ PyObject *name;
+ PyObject *item;
+
+ locals = PyDict_New(); if (!locals) goto bad;
+ if (__Pyx_import_all_from(locals, m) < 0) goto bad;
+ list = PyDict_Items(locals); if (!list) goto bad;
+
+ for(i=0; i<PyList_GET_SIZE(list); i++) {
+ name = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 0);
+ item = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 1);
+#if PY_MAJOR_VERSION >= 3
+ utf8_name = PyUnicode_AsUTF8String(name);
+ if (!utf8_name) goto bad;
+ s = PyBytes_AS_STRING(utf8_name);
+ if (__pyx_import_star_set(item, name, s) < 0) goto bad;
+ Py_DECREF(utf8_name); utf8_name = 0;
+#else
+ s = PyString_AsString(name);
+ if (!s) goto bad;
+ if (__pyx_import_star_set(item, name, s) < 0) goto bad;
+#endif
+ }
+ ret = 0;
+
+bad:
+ Py_XDECREF(locals);
+ Py_XDECREF(list);
+#if PY_MAJOR_VERSION >= 3
+ Py_XDECREF(utf8_name);
+#endif
+ return ret;
+}
+
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "socket",
+ __pyx_k_0MQ_Socket_class, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_Again, __pyx_k_Again, sizeof(__pyx_k_Again), 0, 0, 1, 1},
+ {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
+ {&__pyx_n_b_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 0, 1},
+ {&__pyx_n_s_ContextTerminated, __pyx_k_ContextTerminated, sizeof(__pyx_k_ContextTerminated), 0, 0, 1, 1},
+ {&__pyx_n_s_ENOTSOCK, __pyx_k_ENOTSOCK, sizeof(__pyx_k_ENOTSOCK), 0, 0, 1, 1},
+ {&__pyx_n_s_Frame, __pyx_k_Frame, sizeof(__pyx_k_Frame), 0, 0, 1, 1},
+ {&__pyx_n_s_IPC_PATH_MAX_LEN, __pyx_k_IPC_PATH_MAX_LEN, sizeof(__pyx_k_IPC_PATH_MAX_LEN), 0, 0, 1, 1},
+ {&__pyx_n_s_InterruptedSystemCall, __pyx_k_InterruptedSystemCall, sizeof(__pyx_k_InterruptedSystemCall), 0, 0, 1, 1},
+ {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
+ {&__pyx_kp_s_Not_a_tracked_message, __pyx_k_Not_a_tracked_message, sizeof(__pyx_k_Not_a_tracked_message), 0, 0, 1, 0},
+ {&__pyx_kp_s_Old_style_buffers_not_available, __pyx_k_Old_style_buffers_not_available, sizeof(__pyx_k_Old_style_buffers_not_available), 0, 0, 1, 0},
+ {&__pyx_n_s_RCVMORE, __pyx_k_RCVMORE, sizeof(__pyx_k_RCVMORE), 0, 0, 1, 1},
+ {&__pyx_n_s_Socket, __pyx_k_Socket, sizeof(__pyx_k_Socket), 0, 0, 1, 1},
+ {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
+ {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
+ {&__pyx_n_s_ZMQBindError, __pyx_k_ZMQBindError, sizeof(__pyx_k_ZMQBindError), 0, 0, 1, 1},
+ {&__pyx_n_s_ZMQError, __pyx_k_ZMQError, sizeof(__pyx_k_ZMQError), 0, 0, 1, 1},
+ {&__pyx_kp_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 0},
+ {&__pyx_n_s__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 0, 1, 1},
+ {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
+ {&__pyx_n_s_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 0, 0, 1, 1},
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
+ {&__pyx_n_s_basestring, __pyx_k_basestring, sizeof(__pyx_k_basestring), 0, 0, 1, 1},
+ {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1},
+ {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
+ {&__pyx_n_s_bytes_sockopts, __pyx_k_bytes_sockopts, sizeof(__pyx_k_bytes_sockopts), 0, 0, 1, 1},
+ {&__pyx_n_s_cPickle, __pyx_k_cPickle, sizeof(__pyx_k_cPickle), 0, 0, 1, 1},
+ {&__pyx_n_s_char, __pyx_k_char, sizeof(__pyx_k_char), 0, 0, 1, 1},
+ {&__pyx_n_s_check_version, __pyx_k_check_version, sizeof(__pyx_k_check_version), 0, 0, 1, 1},
+ {&__pyx_n_s_closed, __pyx_k_closed, sizeof(__pyx_k_closed), 0, 0, 1, 1},
+ {&__pyx_n_s_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 0, 0, 1, 1},
+ {&__pyx_n_s_constants, __pyx_k_constants, sizeof(__pyx_k_constants), 0, 0, 1, 1},
+ {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
+ {&__pyx_kp_s_context_must_be_specified, __pyx_k_context_must_be_specified, sizeof(__pyx_k_context_must_be_specified), 0, 0, 1, 0},
+ {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
+ {&__pyx_n_s_copy_mod, __pyx_k_copy_mod, sizeof(__pyx_k_copy_mod), 0, 0, 1, 1},
+ {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
+ {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
+ {&__pyx_n_s_disconnect, __pyx_k_disconnect, sizeof(__pyx_k_disconnect), 0, 0, 1, 1},
+ {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
+ {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
+ {&__pyx_n_s_events, __pyx_k_events, sizeof(__pyx_k_events), 0, 0, 1, 1},
+ {&__pyx_kp_s_expected_bytes_got_r, __pyx_k_expected_bytes_got_r, sizeof(__pyx_k_expected_bytes_got_r), 0, 0, 1, 0},
+ {&__pyx_kp_s_expected_int_got_r, __pyx_k_expected_int_got_r, sizeof(__pyx_k_expected_int_got_r), 0, 0, 1, 0},
+ {&__pyx_kp_s_expected_str_got_r, __pyx_k_expected_str_got_r, sizeof(__pyx_k_expected_str_got_r), 0, 0, 1, 0},
+ {&__pyx_n_s_fd_sockopts, __pyx_k_fd_sockopts, sizeof(__pyx_k_fd_sockopts), 0, 0, 1, 1},
+ {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
+ {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
+ {&__pyx_n_s_getsockopt, __pyx_k_getsockopt, sizeof(__pyx_k_getsockopt), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_int64_sockopts, __pyx_k_int64_sockopts, sizeof(__pyx_k_int64_sockopts), 0, 0, 1, 1},
+ {&__pyx_kp_s_ipc_path_0_is_longer_than_1_char, __pyx_k_ipc_path_0_is_longer_than_1_char, sizeof(__pyx_k_ipc_path_0_is_longer_than_1_char), 0, 0, 1, 0},
+ {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
+ {&__pyx_n_s_jsonapi, __pyx_k_jsonapi, sizeof(__pyx_k_jsonapi), 0, 0, 1, 1},
+ {&__pyx_n_s_linger, __pyx_k_linger, sizeof(__pyx_k_linger), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_monitor, __pyx_k_monitor, sizeof(__pyx_k_monitor), 0, 0, 1, 1},
+ {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
+ {&__pyx_n_s_option, __pyx_k_option, sizeof(__pyx_k_option), 0, 0, 1, 1},
+ {&__pyx_n_s_optval, __pyx_k_optval, sizeof(__pyx_k_optval), 0, 0, 1, 1},
+ {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
+ {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
+ {&__pyx_kp_s_r_does_not_provide_a_buffer_int, __pyx_k_r_does_not_provide_a_buffer_int, sizeof(__pyx_k_r_does_not_provide_a_buffer_int), 0, 0, 1, 0},
+ {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1},
+ {&__pyx_n_s_recv, __pyx_k_recv, sizeof(__pyx_k_recv), 0, 0, 1, 1},
+ {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
+ {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
+ {&__pyx_n_s_shadow, __pyx_k_shadow, sizeof(__pyx_k_shadow), 0, 0, 1, 1},
+ {&__pyx_n_s_socket_type, __pyx_k_socket_type, sizeof(__pyx_k_socket_type), 0, 0, 1, 1},
+ {&__pyx_kp_s_socket_type_must_be_specified, __pyx_k_socket_type_must_be_specified, sizeof(__pyx_k_socket_type_must_be_specified), 0, 0, 1, 0},
+ {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
+ {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
+ {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
+ {&__pyx_n_s_track, __pyx_k_track, sizeof(__pyx_k_track), 0, 0, 1, 1},
+ {&__pyx_n_s_tracker, __pyx_k_tracker, sizeof(__pyx_k_tracker), 0, 0, 1, 1},
+ {&__pyx_n_s_typecode, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
+ {&__pyx_n_s_unbind, __pyx_k_unbind, sizeof(__pyx_k_unbind), 0, 0, 1, 1},
+ {&__pyx_n_s_underlying, __pyx_k_underlying, sizeof(__pyx_k_underlying), 0, 0, 1, 1},
+ {&__pyx_n_s_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 0, 1, 1},
+ {&__pyx_kp_s_unicode_not_allowed_use_send_str, __pyx_k_unicode_not_allowed_use_send_str, sizeof(__pyx_k_unicode_not_allowed_use_send_str), 0, 0, 1, 0},
+ {&__pyx_kp_s_unicode_not_allowed_use_setsocko, __pyx_k_unicode_not_allowed_use_setsocko, sizeof(__pyx_k_unicode_not_allowed_use_setsocko), 0, 0, 1, 0},
+ {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
+ {&__pyx_n_s_zmq, __pyx_k_zmq, sizeof(__pyx_k_zmq), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_backend_cython, __pyx_k_zmq_backend_cython, sizeof(__pyx_k_zmq_backend_cython), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_backend_cython_constants, __pyx_k_zmq_backend_cython_constants, sizeof(__pyx_k_zmq_backend_cython_constants), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_error, __pyx_k_zmq_error, sizeof(__pyx_k_zmq_error), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_utils, __pyx_k_zmq_utils, sizeof(__pyx_k_zmq_utils), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_utils_strtypes, __pyx_k_zmq_utils_strtypes, sizeof(__pyx_k_zmq_utils_strtypes), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "zmq/backend/cython/socket.pyx":275
+ * else:
+ * if context is None:
+ * raise TypeError("context must be specified") # <<<<<<<<<<<<<<
+ * if socket_type < 0:
+ * raise TypeError("socket_type must be specified")
+ */
+ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_context_must_be_specified); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+
+ /* "zmq/backend/cython/socket.pyx":277
+ * raise TypeError("context must be specified")
+ * if socket_type < 0:
+ * raise TypeError("socket_type must be specified") # <<<<<<<<<<<<<<
+ * self._shadow = False
+ * self.handle = zmq_socket(context.handle, socket_type)
+ */
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_socket_type_must_be_specified); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__2);
+ __Pyx_GIVEREF(__pyx_tuple__2);
+
+ /* "zmq/backend/cython/socket.pyx":370
+ * _check_closed(self)
+ * if isinstance(optval, unicode):
+ * raise TypeError("unicode not allowed, use setsockopt_string") # <<<<<<<<<<<<<<
+ *
+ * if option in zmq.constants.bytes_sockopts:
+ */
+ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_unicode_not_allowed_use_setsocko); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+
+ /* "zmq/backend/cython/socket.pyx":472
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__4);
+ __Pyx_GIVEREF(__pyx_tuple__4);
+
+ /* "zmq/backend/cython/socket.pyx":481
+ * # py3compat: addr is bytes, but msg wants str
+ * if str is unicode:
+ * addr = addr.decode('utf-8', 'replace') # <<<<<<<<<<<<<<
+ * path = addr.split('://', 1)[-1]
+ * msg = ('ipc path "{0}" is longer than {1} '
+ */
+ __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_s_utf_8, __pyx_n_s_replace); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__5);
+ __Pyx_GIVEREF(__pyx_tuple__5);
+
+ /* "zmq/backend/cython/socket.pyx":482
+ * if str is unicode:
+ * addr = addr.decode('utf-8', 'replace')
+ * path = addr.split('://', 1)[-1] # <<<<<<<<<<<<<<
+ * msg = ('ipc path "{0}" is longer than {1} '
+ * 'characters (sizeof(sockaddr_un.sun_path)). '
+ */
+ __pyx_tuple__7 = PyTuple_Pack(2, __pyx_kp_s__6, __pyx_int_1); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__7);
+ __Pyx_GIVEREF(__pyx_tuple__7);
+
+ /* "zmq/backend/cython/socket.pyx":509
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__8);
+ __Pyx_GIVEREF(__pyx_tuple__8);
+
+ /* "zmq/backend/cython/socket.pyx":537
+ * cdef char* c_addr
+ *
+ * _check_version((3,2), "unbind") # <<<<<<<<<<<<<<
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ */
+ __pyx_tuple__9 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_2); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__9);
+ __Pyx_GIVEREF(__pyx_tuple__9);
+ __pyx_tuple__10 = PyTuple_Pack(2, __pyx_tuple__9, __pyx_n_s_unbind); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__10);
+ __Pyx_GIVEREF(__pyx_tuple__10);
+
+ /* "zmq/backend/cython/socket.pyx":540
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__11);
+ __Pyx_GIVEREF(__pyx_tuple__11);
+
+ /* "zmq/backend/cython/socket.pyx":568
+ * cdef char* c_addr
+ *
+ * _check_version((3,2), "disconnect") # <<<<<<<<<<<<<<
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ */
+ __pyx_tuple__12 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_2); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__12);
+ __Pyx_GIVEREF(__pyx_tuple__12);
+ __pyx_tuple__13 = PyTuple_Pack(2, __pyx_tuple__12, __pyx_n_s_disconnect); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__13);
+ __Pyx_GIVEREF(__pyx_tuple__13);
+
+ /* "zmq/backend/cython/socket.pyx":571
+ * _check_closed(self)
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__14);
+ __Pyx_GIVEREF(__pyx_tuple__14);
+
+ /* "zmq/backend/cython/socket.pyx":604
+ * cdef char* c_addr = NULL
+ *
+ * _check_version((3,2), "monitor") # <<<<<<<<<<<<<<
+ * if addr is not None:
+ * if isinstance(addr, unicode):
+ */
+ __pyx_tuple__16 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_2); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__16);
+ __Pyx_GIVEREF(__pyx_tuple__16);
+ __pyx_tuple__17 = PyTuple_Pack(2, __pyx_tuple__16, __pyx_n_s_monitor); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__17);
+ __Pyx_GIVEREF(__pyx_tuple__17);
+
+ /* "zmq/backend/cython/socket.pyx":607
+ * if addr is not None:
+ * if isinstance(addr, unicode):
+ * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
+ * if not isinstance(addr, bytes):
+ * raise TypeError('expected str, got: %r' % addr)
+ */
+ __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__18);
+ __Pyx_GIVEREF(__pyx_tuple__18);
+
+ /* "zmq/backend/cython/socket.pyx":659
+ *
+ * if isinstance(data, unicode):
+ * raise TypeError("unicode not allowed, use send_string") # <<<<<<<<<<<<<<
+ *
+ * if copy:
+ */
+ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_unicode_not_allowed_use_send_str); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__19);
+ __Pyx_GIVEREF(__pyx_tuple__19);
+
+ /* "zmq/backend/cython/socket.pyx":670
+ * if isinstance(data, Frame):
+ * if track and not data.tracker:
+ * raise ValueError('Not a tracked message') # <<<<<<<<<<<<<<
+ * msg = data
+ * else:
+ */
+ __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Not_a_tracked_message); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__20);
+ __Pyx_GIVEREF(__pyx_tuple__20);
+
+ /* "buffers.pxd":194
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii') # <<<<<<<<<<<<<<
+ * return bfmt
+ *
+ */
+ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__21);
+ __Pyx_GIVEREF(__pyx_tuple__21);
+
+ /* "buffers.pxd":242
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ * else:
+ * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Old_style_buffers_not_available); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__23);
+ __Pyx_GIVEREF(__pyx_tuple__23);
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initsocket(void); /*proto*/
+PyMODINIT_FUNC initsocket(void)
+#else
+PyMODINIT_FUNC PyInit_socket(void); /*proto*/
+PyMODINIT_FUNC PyInit_socket(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_socket(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("socket", __pyx_methods, __pyx_k_0MQ_Socket_class, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython__socket) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython.socket")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython.socket", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ __pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket = &__pyx_vtable_3zmq_7backend_6cython_6socket_Socket;
+ __pyx_vtable_3zmq_7backend_6cython_6socket_Socket.send = (PyObject *(*)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args))__pyx_f_3zmq_7backend_6cython_6socket_6Socket_send;
+ __pyx_vtable_3zmq_7backend_6cython_6socket_Socket.recv = (PyObject *(*)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args))__pyx_f_3zmq_7backend_6cython_6socket_6Socket_recv;
+ if (PyType_Ready(&__pyx_type_3zmq_7backend_6cython_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_3zmq_7backend_6cython_6socket_Socket.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_3zmq_7backend_6cython_6socket_Socket.tp_dict, __pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Socket", (PyObject *)&__pyx_type_3zmq_7backend_6cython_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_type_3zmq_7backend_6cython_6socket_Socket.tp_weaklistoffset == 0) __pyx_type_3zmq_7backend_6cython_6socket_Socket.tp_weaklistoffset = offsetof(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket, __weakref__);
+ __pyx_ptype_3zmq_7backend_6cython_6socket_Socket = &__pyx_type_3zmq_7backend_6cython_6socket_Socket;
+ /*--- Type import code ---*/
+ __pyx_ptype_3zmq_7backend_6cython_7context_Context = __Pyx_ImportType("zmq.backend.cython.context", "Context", sizeof(struct __pyx_obj_3zmq_7backend_6cython_7context_Context), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_7context_Context)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_3zmq_7backend_6cython_7context_Context = (struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context*)__Pyx_GetVtable(__pyx_ptype_3zmq_7backend_6cython_7context_Context->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_7backend_6cython_7context_Context)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
+ #if CYTHON_COMPILING_IN_PYPY
+ sizeof(PyTypeObject),
+ #else
+ sizeof(PyHeapTypeObject),
+ #endif
+ 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3zmq_7backend_6cython_7message_MessageTracker = __Pyx_ImportType("zmq.backend.cython.message", "MessageTracker", sizeof(struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_7message_MessageTracker)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3zmq_7backend_6cython_7message_Frame = __Pyx_ImportType("zmq.backend.cython.message", "Frame", sizeof(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_7message_Frame)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_3zmq_7backend_6cython_7message_Frame = (struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame*)__Pyx_GetVtable(__pyx_ptype_3zmq_7backend_6cython_7message_Frame->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_7backend_6cython_7message_Frame)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/socket.pyx":58
+ * #-----------------------------------------------------------------------------
+ *
+ * import copy as copy_mod # <<<<<<<<<<<<<<
+ * import time
+ * import sys
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_copy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy_mod, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":59
+ *
+ * import copy as copy_mod
+ * import time # <<<<<<<<<<<<<<
+ * import sys
+ * import random
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":60
+ * import copy as copy_mod
+ * import time
+ * import sys # <<<<<<<<<<<<<<
+ * import random
+ * import struct
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":61
+ * import time
+ * import sys
+ * import random # <<<<<<<<<<<<<<
+ * import struct
+ * import codecs
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_random, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_random, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":62
+ * import sys
+ * import random
+ * import struct # <<<<<<<<<<<<<<
+ * import codecs
+ *
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":63
+ * import random
+ * import struct
+ * import codecs # <<<<<<<<<<<<<<
+ *
+ * from zmq.utils import jsonapi
+ */
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_codecs, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_codecs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":65
+ * import codecs
+ *
+ * from zmq.utils import jsonapi # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_jsonapi);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_jsonapi);
+ __Pyx_GIVEREF(__pyx_n_s_jsonapi);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_zmq_utils, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_jsonapi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_jsonapi, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":67
+ * from zmq.utils import jsonapi
+ *
+ * try: # <<<<<<<<<<<<<<
+ * import cPickle
+ * pickle = cPickle
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_5);
+ /*try:*/ {
+
+ /* "zmq/backend/cython/socket.pyx":68
+ *
+ * try:
+ * import cPickle # <<<<<<<<<<<<<<
+ * pickle = cPickle
+ * except:
+ */
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_cPickle, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_cPickle, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":69
+ * try:
+ * import cPickle
+ * pickle = cPickle # <<<<<<<<<<<<<<
+ * except:
+ * cPickle = None
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_cPickle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pickle, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ }
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L9_try_end;
+ __pyx_L2_error:;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":70
+ * import cPickle
+ * pickle = cPickle
+ * except: # <<<<<<<<<<<<<<
+ * cPickle = None
+ * import pickle
+ */
+ /*except:*/ {
+ __Pyx_AddTraceback("zmq.backend.cython.socket", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "zmq/backend/cython/socket.pyx":71
+ * pickle = cPickle
+ * except:
+ * cPickle = None # <<<<<<<<<<<<<<
+ * import pickle
+ *
+ */
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_cPickle, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+
+ /* "zmq/backend/cython/socket.pyx":72
+ * except:
+ * cPickle = None
+ * import pickle # <<<<<<<<<<<<<<
+ *
+ * import zmq
+ */
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_pickle, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pickle, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ goto __pyx_L3_exception_handled;
+ }
+ __pyx_L4_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
+ goto __pyx_L1_error;
+ __pyx_L3_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
+ __pyx_L9_try_end:;
+ }
+
+ /* "zmq/backend/cython/socket.pyx":74
+ * import pickle
+ *
+ * import zmq # <<<<<<<<<<<<<<
+ * from zmq.backend.cython import constants
+ * from zmq.backend.cython.constants import *
+ */
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq, 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_zmq, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":75
+ *
+ * import zmq
+ * from zmq.backend.cython import constants # <<<<<<<<<<<<<<
+ * from zmq.backend.cython.constants import *
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ */
+ __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_n_s_constants);
+ PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_constants);
+ __Pyx_GIVEREF(__pyx_n_s_constants);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_zmq_backend_cython, __pyx_t_6, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_constants); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_constants, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":76
+ * import zmq
+ * from zmq.backend.cython import constants
+ * from zmq.backend.cython.constants import * # <<<<<<<<<<<<<<
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ * from zmq.error import ZMQError, ZMQBindError, InterruptedSystemCall, _check_version
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s__24);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__24);
+ __Pyx_GIVEREF(__pyx_n_s__24);
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq_backend_cython_constants, __pyx_t_1, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_import_star(__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":78
+ * from zmq.backend.cython.constants import *
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ * from zmq.error import ZMQError, ZMQBindError, InterruptedSystemCall, _check_version # <<<<<<<<<<<<<<
+ * from zmq.utils.strtypes import bytes,unicode,basestring
+ *
+ */
+ __pyx_t_6 = PyList_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __Pyx_INCREF(__pyx_n_s_ZMQBindError);
+ PyList_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_ZMQBindError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQBindError);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_6, 2, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __Pyx_INCREF(__pyx_n_s_check_version);
+ PyList_SET_ITEM(__pyx_t_6, 3, __pyx_n_s_check_version);
+ __Pyx_GIVEREF(__pyx_n_s_check_version);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_6, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZMQError, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ZMQBindError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZMQBindError, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_InterruptedSystemCall, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_version); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_version, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":79
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ * from zmq.error import ZMQError, ZMQBindError, InterruptedSystemCall, _check_version
+ * from zmq.utils.strtypes import bytes,unicode,basestring # <<<<<<<<<<<<<<
+ *
+ * #-----------------------------------------------------------------------------
+ */
+ __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_bytes);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_bytes);
+ __Pyx_GIVEREF(__pyx_n_s_bytes);
+ __Pyx_INCREF(__pyx_n_s_unicode);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_unicode);
+ __Pyx_GIVEREF(__pyx_n_s_unicode);
+ __Pyx_INCREF(__pyx_n_s_basestring);
+ PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_basestring);
+ __Pyx_GIVEREF(__pyx_n_s_basestring);
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq_utils_strtypes, __pyx_t_1, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_unicode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_basestring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_basestring, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":85
+ * #-----------------------------------------------------------------------------
+ *
+ * IPC_PATH_MAX_LEN = get_ipc_path_max_len() # <<<<<<<<<<<<<<
+ *
+ * # inline some small socket submethods:
+ */
+ __pyx_t_6 = __Pyx_PyInt_From_int(get_ipc_path_max_len()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_IPC_PATH_MAX_LEN, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":298
+ *
+ * @property
+ * def underlying(self): # <<<<<<<<<<<<<<
+ * """The address of the underlying libzmq socket"""
+ * return <size_t> self.handle
+ */
+ __pyx_t_6 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3zmq_7backend_6cython_6socket_Socket, __pyx_n_s_underlying); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "zmq/backend/cython/socket.pyx":297
+ * self.context._remove_socket(self.handle)
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def underlying(self):
+ * """The address of the underlying libzmq socket"""
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_3zmq_7backend_6cython_6socket_Socket->tp_dict, __pyx_n_s_underlying, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ PyType_Modified(__pyx_ptype_3zmq_7backend_6cython_6socket_Socket);
+
+ /* "zmq/backend/cython/socket.pyx":303
+ *
+ * @property
+ * def closed(self): # <<<<<<<<<<<<<<
+ * return _check_closed_deep(self)
+ *
+ */
+ __pyx_t_6 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_3zmq_7backend_6cython_6socket_Socket, __pyx_n_s_closed); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "zmq/backend/cython/socket.pyx":302
+ * return <size_t> self.handle
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def closed(self):
+ * return _check_closed_deep(self)
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_3zmq_7backend_6cython_6socket_Socket->tp_dict, __pyx_n_s_closed, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ PyType_Modified(__pyx_ptype_3zmq_7backend_6cython_6socket_Socket);
+
+ /* "zmq/backend/cython/socket.pyx":580
+ * raise ZMQError()
+ *
+ * def monitor(self, addr, int events=ZMQ_EVENT_ALL): # <<<<<<<<<<<<<<
+ * """s.monitor(addr, flags)
+ *
+ */
+ __pyx_k__15 = ZMQ_EVENT_ALL;
+
+ /* "zmq/backend/cython/socket.pyx":717
+ *
+ *
+ * __all__ = ['Socket', 'IPC_PATH_MAX_LEN'] # <<<<<<<<<<<<<<
+ */
+ __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_n_s_Socket);
+ PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_Socket);
+ __Pyx_GIVEREF(__pyx_n_s_Socket);
+ __Pyx_INCREF(__pyx_n_s_IPC_PATH_MAX_LEN);
+ PyList_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_IPC_PATH_MAX_LEN);
+ __Pyx_GIVEREF(__pyx_n_s_IPC_PATH_MAX_LEN);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/socket.pyx":1
+ * """0MQ Socket class.""" # <<<<<<<<<<<<<<
+ *
+ * #
+ */
+ __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "buffers.pxd":312
+ *
+ *
+ * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0)
+ */
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython.socket", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython.socket");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_Restore(type, value, tb);
+#endif
+}
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
+ return 0;
+ }
+ if (likely(PyObject_TypeCheck(obj, type)))
+ return 1;
+ PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
+ Py_TYPE(obj)->tp_name, type->tp_name);
+ return 0;
+}
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+#else
+ PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ local_type = tstate->curexc_type;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
+ PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
+ goto bad;
+ #if PY_MAJOR_VERSION >= 3
+ if (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
+ return 0;
+bad:
+ *type = 0;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AsString(kw_name));
+ #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ continue;
+ }
+ name = first_kw_arg;
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+ while (*name) {
+ if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**name, key)) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ if ((**argname == key) || (
+ (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**argname, key))) {
+ goto arg_passed_twice;
+ }
+ argname++;
+ }
+ }
+ } else
+ #endif
+ if (likely(PyUnicode_Check(key))) {
+ while (*name) {
+ int cmp = (**name == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**name, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ int cmp = (**argname == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**argname, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) goto arg_passed_twice;
+ argname++;
+ }
+ }
+ } else
+ goto invalid_keyword_type;
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, key);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
+ name, type->tp_name, Py_TYPE(obj)->tp_name);
+}
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact)
+{
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
+ return 0;
+ }
+ if (none_allowed && obj == Py_None) return 1;
+ else if (exact) {
+ if (likely(Py_TYPE(obj) == type)) return 1;
+ #if PY_MAJOR_VERSION == 2
+ else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
+ #endif
+ }
+ else {
+ if (likely(PyObject_TypeCheck(obj, type))) return 1;
+ }
+ __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
+ return 0;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+ CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
+ int full_traceback) {
+ PyObject *old_exc, *old_val, *old_tb;
+ PyObject *ctx;
+ __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+ if (full_traceback) {
+ Py_XINCREF(old_exc);
+ Py_XINCREF(old_val);
+ Py_XINCREF(old_tb);
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ PyErr_PrintEx(1);
+ }
+ #if PY_MAJOR_VERSION < 3
+ ctx = PyString_FromString(name);
+ #else
+ ctx = PyUnicode_FromString(name);
+ #endif
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ if (!ctx) {
+ PyErr_WriteUnraisable(Py_None);
+ } else {
+ PyErr_WriteUnraisable(ctx);
+ Py_DECREF(ctx);
+ }
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+ PyObject *r;
+ if (!j) return NULL;
+ r = PyObject_GetItem(o, j);
+ Py_DECREF(j);
+ return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+ if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+ PyObject *r = PyList_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, i);
+ Py_INCREF(r);
+ return r;
+ }
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+ return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (is_list || PyList_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+ if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+ PyObject *r = PyList_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ }
+ else if (PyTuple_CheckExact(o)) {
+ Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+ if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+ PyObject *r = PyTuple_GET_ITEM(o, n);
+ Py_INCREF(r);
+ return r;
+ }
+ } else {
+ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+ if (likely(m && m->sq_item)) {
+ if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+ Py_ssize_t l = m->sq_length(o);
+ if (likely(l >= 0)) {
+ i += l;
+ } else {
+ if (PyErr_ExceptionMatches(PyExc_OverflowError))
+ PyErr_Clear();
+ else
+ return NULL;
+ }
+ }
+ return m->sq_item(o, i);
+ }
+ }
+#else
+ if (is_list || PySequence_Check(o)) {
+ return PySequence_GetItem(o, i);
+ }
+#endif
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000
+ PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+ PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+ if (!ob)
+ goto bad;
+ if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
+ goto bad;
+ Py_DECREF(ob);
+ return 0;
+bad:
+ Py_XDECREF(ob);
+ return -1;
+}
+
+static void* __Pyx_GetVtable(PyObject *dict) {
+ void* ptr;
+ PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
+ if (!ob)
+ goto bad;
+#if PY_VERSION_HEX >= 0x02070000
+ ptr = PyCapsule_GetPointer(ob, 0);
+#else
+ ptr = PyCObject_AsVoidPtr(ob);
+#endif
+ if (!ptr && !PyErr_Occurred())
+ PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
+ Py_DECREF(ob);
+ return ptr;
+bad:
+ Py_XDECREF(ob);
+ return NULL;
+}
+
+static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
+ PyObject *result;
+ result = __Pyx_PyObject_GetAttrStr(nmspace, name);
+ if (!result)
+ result = __Pyx_GetModuleGlobalName(name);
+ return result;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
+ const size_t neg_one = (size_t) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(size_t) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (size_t) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(size_t) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(size_t) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong(x))
+ } else if (sizeof(size_t) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ size_t val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (size_t) -1;
+ }
+ } else {
+ size_t val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (size_t) -1;
+ val = __Pyx_PyInt_As_size_t(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to size_t");
+ return (size_t) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to size_t");
+ return (size_t) -1;
+}
+
+static CYTHON_INLINE pyzmq_int64_t __Pyx_PyInt_As_pyzmq_int64_t(PyObject *x) {
+ const pyzmq_int64_t neg_one = (pyzmq_int64_t) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(pyzmq_int64_t) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(pyzmq_int64_t, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (pyzmq_int64_t) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(pyzmq_int64_t, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(pyzmq_int64_t) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(pyzmq_int64_t, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(pyzmq_int64_t) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(pyzmq_int64_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(pyzmq_int64_t, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(pyzmq_int64_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(pyzmq_int64_t) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(pyzmq_int64_t, long, PyLong_AsLong(x))
+ } else if (sizeof(pyzmq_int64_t) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(pyzmq_int64_t, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ pyzmq_int64_t val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (pyzmq_int64_t) -1;
+ }
+ } else {
+ pyzmq_int64_t val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (pyzmq_int64_t) -1;
+ val = __Pyx_PyInt_As_pyzmq_int64_t(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to pyzmq_int64_t");
+ return (pyzmq_int64_t) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to pyzmq_int64_t");
+ return (pyzmq_int64_t) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_pyzmq_int64_t(pyzmq_int64_t value) {
+ const pyzmq_int64_t neg_one = (pyzmq_int64_t) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(pyzmq_int64_t) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(pyzmq_int64_t) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(pyzmq_int64_t) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(pyzmq_int64_t) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(pyzmq_int64_t) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(pyzmq_int64_t),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ZMQ_FD_T(ZMQ_FD_T value) {
+ const ZMQ_FD_T neg_one = (ZMQ_FD_T) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(ZMQ_FD_T) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(ZMQ_FD_T) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(ZMQ_FD_T) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(ZMQ_FD_T) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(ZMQ_FD_T) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(ZMQ_FD_T),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
+ while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
+ return *s1 == *s2;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+ PyObject *py_name = 0;
+ PyObject *py_module = 0;
+ py_name = __Pyx_PyIdentifier_FromString(name);
+ if (!py_name)
+ goto bad;
+ py_module = PyImport_Import(py_name);
+ Py_DECREF(py_name);
+ return py_module;
+bad:
+ Py_XDECREF(py_name);
+ return 0;
+}
+#endif
+
+#ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
+ size_t size, int strict)
+{
+ PyObject *py_module = 0;
+ PyObject *result = 0;
+ PyObject *py_name = 0;
+ char warning[200];
+ Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+ PyObject *py_basicsize;
+#endif
+ py_module = __Pyx_ImportModule(module_name);
+ if (!py_module)
+ goto bad;
+ py_name = __Pyx_PyIdentifier_FromString(class_name);
+ if (!py_name)
+ goto bad;
+ result = PyObject_GetAttr(py_module, py_name);
+ Py_DECREF(py_name);
+ py_name = 0;
+ Py_DECREF(py_module);
+ py_module = 0;
+ if (!result)
+ goto bad;
+ if (!PyType_Check(result)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s.%.200s is not a type object",
+ module_name, class_name);
+ goto bad;
+ }
+#ifndef Py_LIMITED_API
+ basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+ py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+ if (!py_basicsize)
+ goto bad;
+ basicsize = PyLong_AsSsize_t(py_basicsize);
+ Py_DECREF(py_basicsize);
+ py_basicsize = 0;
+ if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+ goto bad;
+#endif
+ if (!strict && (size_t)basicsize > size) {
+ PyOS_snprintf(warning, sizeof(warning),
+ "%s.%s size changed, may indicate binary incompatibility",
+ module_name, class_name);
+ if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
+ }
+ else if ((size_t)basicsize != size) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.%.200s has the wrong size, try recompiling",
+ module_name, class_name);
+ goto bad;
+ }
+ return (PyTypeObject *)result;
+bad:
+ Py_XDECREF(py_module);
+ Py_XDECREF(result);
+ return NULL;
+}
+#endif
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/zmq/backend/cython/socket.pxd b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.pxd
index b8a331e2..b8a331e2 100644
--- a/external_libs/python/zmq/backend/cython/socket.pxd
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.pxd
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.pyx
new file mode 100644
index 00000000..30abbb7d
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/socket.pyx
@@ -0,0 +1,717 @@
+"""0MQ Socket class."""
+
+#
+# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+#-----------------------------------------------------------------------------
+# Cython Imports
+#-----------------------------------------------------------------------------
+
+# get version-independent aliases:
+cdef extern from "pyversion_compat.h":
+ pass
+
+from libc.errno cimport ENAMETOOLONG
+from libc.string cimport memcpy
+
+from cpython cimport PyBytes_FromStringAndSize
+from cpython cimport PyBytes_AsString, PyBytes_Size
+from cpython cimport Py_DECREF, Py_INCREF
+
+from buffers cimport asbuffer_r, viewfromobject_r
+
+from libzmq cimport *
+from message cimport Frame, copy_zmq_msg_bytes
+
+from context cimport Context
+
+cdef extern from "Python.h":
+ ctypedef int Py_ssize_t
+
+cdef extern from "ipcmaxlen.h":
+ int get_ipc_path_max_len()
+
+cdef extern from "getpid_compat.h":
+ int getpid()
+
+
+#-----------------------------------------------------------------------------
+# Python Imports
+#-----------------------------------------------------------------------------
+
+import copy as copy_mod
+import time
+import sys
+import random
+import struct
+import codecs
+
+from zmq.utils import jsonapi
+
+try:
+ import cPickle
+ pickle = cPickle
+except:
+ cPickle = None
+ import pickle
+
+import zmq
+from zmq.backend.cython import constants
+from zmq.backend.cython.constants import *
+from zmq.backend.cython.checkrc cimport _check_rc
+from zmq.error import ZMQError, ZMQBindError, InterruptedSystemCall, _check_version
+from zmq.utils.strtypes import bytes,unicode,basestring
+
+#-----------------------------------------------------------------------------
+# Code
+#-----------------------------------------------------------------------------
+
+IPC_PATH_MAX_LEN = get_ipc_path_max_len()
+
+# inline some small socket submethods:
+# true methods frequently cannot be inlined, acc. Cython docs
+
+cdef inline _check_closed(Socket s):
+ """raise ENOTSUP if socket is closed
+
+ Does not do a deep check
+ """
+ if s._closed:
+ raise ZMQError(ENOTSOCK)
+
+cdef inline _check_closed_deep(Socket s):
+ """thorough check of whether the socket has been closed,
+ even if by another entity (e.g. ctx.destroy).
+
+ Only used by the `closed` property.
+
+ returns True if closed, False otherwise
+ """
+ cdef int rc
+ cdef int errno
+ cdef int stype
+ cdef size_t sz=sizeof(int)
+ if s._closed:
+ return True
+ else:
+ rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
+ if rc < 0 and zmq_errno() == ENOTSOCK:
+ s._closed = True
+ return True
+ else:
+ _check_rc(rc)
+ return False
+
+cdef inline Frame _recv_frame(void *handle, int flags=0, track=False):
+ """Receive a message in a non-copying manner and return a Frame."""
+ cdef int rc
+ msg = zmq.Frame(track=track)
+ cdef Frame cmsg = msg
+
+ while True:
+ with nogil:
+ rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+ return msg
+
+cdef inline object _recv_copy(void *handle, int flags=0):
+ """Receive a message and return a copy"""
+ cdef zmq_msg_t zmq_msg
+ rc = zmq_msg_init (&zmq_msg)
+ _check_rc(rc)
+ while True:
+ with nogil:
+ rc = zmq_msg_recv(&zmq_msg, handle, flags)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+ msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
+ zmq_msg_close(&zmq_msg)
+ return msg_bytes
+
+cdef inline object _send_frame(void *handle, Frame msg, int flags=0):
+ """Send a Frame on this socket in a non-copy manner."""
+ cdef int rc
+ cdef Frame msg_copy
+
+ # Always copy so the original message isn't garbage collected.
+ # This doesn't do a real copy, just a reference.
+ msg_copy = msg.fast_copy()
+
+ while True:
+ with nogil:
+ rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+
+ return msg.tracker
+
+
+cdef inline object _send_copy(void *handle, object msg, int flags=0):
+ """Send a message on this socket by copying its content."""
+ cdef int rc, rc2
+ cdef zmq_msg_t data
+ cdef char *msg_c
+ cdef Py_ssize_t msg_c_len=0
+
+ # copy to c array:
+ asbuffer_r(msg, <void **>&msg_c, &msg_c_len)
+
+ # Copy the msg before sending. This avoids any complications with
+ # the GIL, etc.
+ # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
+ rc = zmq_msg_init_size(&data, msg_c_len)
+ _check_rc(rc)
+
+ while True:
+ with nogil:
+ memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
+ rc = zmq_msg_send(&data, handle, flags)
+ if not rc < 0:
+ rc2 = zmq_msg_close(&data)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+ _check_rc(rc2)
+
+cdef inline object _getsockopt(void *handle, int option, void *optval, size_t *sz):
+ """getsockopt, retrying interrupted calls
+
+ checks rc, raising ZMQError on failure.
+ """
+ cdef int rc=0
+ while True:
+ rc = zmq_getsockopt(handle, option, optval, sz)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+
+cdef inline object _setsockopt(void *handle, int option, void *optval, size_t sz):
+ """setsockopt, retrying interrupted calls
+
+ checks rc, raising ZMQError on failure.
+ """
+ cdef int rc=0
+ while True:
+ rc = zmq_setsockopt(handle, option, optval, sz)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+
+
+cdef class Socket:
+ """Socket(context, socket_type)
+
+ A 0MQ socket.
+
+ These objects will generally be constructed via the socket() method of a Context object.
+
+ Note: 0MQ Sockets are *not* threadsafe. **DO NOT** share them across threads.
+
+ Parameters
+ ----------
+ context : Context
+ The 0MQ Context this Socket belongs to.
+ socket_type : int
+ The socket type, which can be any of the 0MQ socket types:
+ REQ, REP, PUB, SUB, PAIR, DEALER, ROUTER, PULL, PUSH, XPUB, XSUB.
+
+ See Also
+ --------
+ .Context.socket : method for creating a socket bound to a Context.
+ """
+
+ # no-op for the signature
+ def __init__(self, context=None, socket_type=-1, shadow=0):
+ pass
+
+ def __cinit__(self, Context context=None, int socket_type=-1, size_t shadow=0, *args, **kwargs):
+ cdef Py_ssize_t c_handle
+
+ self.handle = NULL
+ self.context = context
+ if shadow:
+ self._shadow = True
+ self.handle = <void *>shadow
+ else:
+ if context is None:
+ raise TypeError("context must be specified")
+ if socket_type < 0:
+ raise TypeError("socket_type must be specified")
+ self._shadow = False
+ self.handle = zmq_socket(context.handle, socket_type)
+ if self.handle == NULL:
+ raise ZMQError()
+ self._closed = False
+ self._pid = getpid()
+ if context:
+ context._add_socket(self.handle)
+
+ def __dealloc__(self):
+ """remove from context's list
+
+ But be careful that context might not exist if called during gc
+ """
+ if self.handle != NULL and not self._shadow and getpid() == self._pid:
+ # during gc, self.context might be NULL
+ if self.context and not self.context.closed:
+ self.context._remove_socket(self.handle)
+
+ @property
+ def underlying(self):
+ """The address of the underlying libzmq socket"""
+ return <size_t> self.handle
+
+ @property
+ def closed(self):
+ return _check_closed_deep(self)
+
+ def close(self, linger=None):
+ """s.close(linger=None)
+
+ Close the socket.
+
+ If linger is specified, LINGER sockopt will be set prior to closing.
+
+ This can be called to close the socket by hand. If this is not
+ called, the socket will automatically be closed when it is
+ garbage collected.
+ """
+ cdef int rc=0
+ cdef int linger_c
+ cdef bint setlinger=False
+
+ if linger is not None:
+ linger_c = linger
+ setlinger=True
+
+ if self.handle != NULL and not self._closed and getpid() == self._pid:
+ if setlinger:
+ zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
+ rc = zmq_close(self.handle)
+ if rc < 0 and zmq_errno() != ENOTSOCK:
+ # ignore ENOTSOCK (closed by Context)
+ _check_rc(rc)
+ self._closed = True
+ # during gc, self.context might be NULL
+ if self.context:
+ self.context._remove_socket(self.handle)
+ self.handle = NULL
+
+ def set(self, int option, optval):
+ """s.set(option, optval)
+
+ Set socket options.
+
+ See the 0MQ API documentation for details on specific options.
+
+ Parameters
+ ----------
+ option : int
+ The option to set. Available values will depend on your
+ version of libzmq. Examples include::
+
+ zmq.SUBSCRIBE, UNSUBSCRIBE, IDENTITY, HWM, LINGER, FD
+
+ optval : int or bytes
+ The value of the option to set.
+
+ Notes
+ -----
+ .. warning::
+
+ All options other than zmq.SUBSCRIBE, zmq.UNSUBSCRIBE and
+ zmq.LINGER only take effect for subsequent socket bind/connects.
+ """
+ cdef int64_t optval_int64_c
+ cdef int optval_int_c
+ cdef char* optval_c
+ cdef Py_ssize_t sz
+
+ _check_closed(self)
+ if isinstance(optval, unicode):
+ raise TypeError("unicode not allowed, use setsockopt_string")
+
+ if option in zmq.constants.bytes_sockopts:
+ if not isinstance(optval, bytes):
+ raise TypeError('expected bytes, got: %r' % optval)
+ optval_c = PyBytes_AsString(optval)
+ sz = PyBytes_Size(optval)
+ _setsockopt(self.handle, option, optval_c, sz)
+ elif option in zmq.constants.int64_sockopts:
+ if not isinstance(optval, int):
+ raise TypeError('expected int, got: %r' % optval)
+ optval_int64_c = optval
+ _setsockopt(self.handle, option, &optval_int64_c, sizeof(int64_t))
+ else:
+ # default is to assume int, which is what most new sockopts will be
+ # this lets pyzmq work with newer libzmq which may add constants
+ # pyzmq has not yet added, rather than artificially raising. Invalid
+ # sockopts will still raise just the same, but it will be libzmq doing
+ # the raising.
+ if not isinstance(optval, int):
+ raise TypeError('expected int, got: %r' % optval)
+ optval_int_c = optval
+ _setsockopt(self.handle, option, &optval_int_c, sizeof(int))
+
+ def get(self, int option):
+ """s.get(option)
+
+ Get the value of a socket option.
+
+ See the 0MQ API documentation for details on specific options.
+
+ Parameters
+ ----------
+ option : int
+ The option to get. Available values will depend on your
+ version of libzmq. Examples include::
+
+ zmq.IDENTITY, HWM, LINGER, FD, EVENTS
+
+ Returns
+ -------
+ optval : int or bytes
+ The value of the option as a bytestring or int.
+ """
+ cdef int64_t optval_int64_c
+ cdef int optval_int_c
+ cdef fd_t optval_fd_c
+ cdef char identity_str_c [255]
+ cdef size_t sz
+ cdef int rc
+
+ _check_closed(self)
+
+ if option in zmq.constants.bytes_sockopts:
+ sz = 255
+ _getsockopt(self.handle, option, <void *>identity_str_c, &sz)
+ # strip null-terminated strings *except* identity
+ if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0':
+ sz -= 1
+ result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
+ elif option in zmq.constants.int64_sockopts:
+ sz = sizeof(int64_t)
+ _getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
+ result = optval_int64_c
+ elif option in zmq.constants.fd_sockopts:
+ sz = sizeof(fd_t)
+ _getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
+ result = optval_fd_c
+ else:
+ # default is to assume int, which is what most new sockopts will be
+ # this lets pyzmq work with newer libzmq which may add constants
+ # pyzmq has not yet added, rather than artificially raising. Invalid
+ # sockopts will still raise just the same, but it will be libzmq doing
+ # the raising.
+ sz = sizeof(int)
+ _getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
+ result = optval_int_c
+
+ return result
+
+ def bind(self, addr):
+ """s.bind(addr)
+
+ Bind the socket to an address.
+
+ This causes the socket to listen on a network port. Sockets on the
+ other side of this connection will use ``Socket.connect(addr)`` to
+ connect to this socket.
+
+ Parameters
+ ----------
+ addr : str
+ The address string. This has the form 'protocol://interface:port',
+ for example 'tcp://127.0.0.1:5555'. Protocols supported include
+ tcp, udp, pgm, epgm, inproc and ipc. If the address is unicode, it is
+ encoded to utf-8 first.
+ """
+ cdef int rc
+ cdef char* c_addr
+
+ _check_closed(self)
+ if isinstance(addr, unicode):
+ addr = addr.encode('utf-8')
+ if not isinstance(addr, bytes):
+ raise TypeError('expected str, got: %r' % addr)
+ c_addr = addr
+ rc = zmq_bind(self.handle, c_addr)
+ if rc != 0:
+ if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG:
+ # py3compat: addr is bytes, but msg wants str
+ if str is unicode:
+ addr = addr.decode('utf-8', 'replace')
+ path = addr.split('://', 1)[-1]
+ msg = ('ipc path "{0}" is longer than {1} '
+ 'characters (sizeof(sockaddr_un.sun_path)). '
+ 'zmq.IPC_PATH_MAX_LEN constant can be used '
+ 'to check addr length (if it is defined).'
+ .format(path, IPC_PATH_MAX_LEN))
+ raise ZMQError(msg=msg)
+ _check_rc(rc)
+
+ def connect(self, addr):
+ """s.connect(addr)
+
+ Connect to a remote 0MQ socket.
+
+ Parameters
+ ----------
+ addr : str
+ The address string. This has the form 'protocol://interface:port',
+ for example 'tcp://127.0.0.1:5555'. Protocols supported are
+ tcp, upd, pgm, inproc and ipc. If the address is unicode, it is
+ encoded to utf-8 first.
+ """
+ cdef int rc
+ cdef char* c_addr
+
+ _check_closed(self)
+ if isinstance(addr, unicode):
+ addr = addr.encode('utf-8')
+ if not isinstance(addr, bytes):
+ raise TypeError('expected str, got: %r' % addr)
+ c_addr = addr
+
+ rc = zmq_connect(self.handle, c_addr)
+ if rc != 0:
+ raise ZMQError()
+
+ def unbind(self, addr):
+ """s.unbind(addr)
+
+ Unbind from an address (undoes a call to bind).
+
+ .. versionadded:: libzmq-3.2
+ .. versionadded:: 13.0
+
+ Parameters
+ ----------
+ addr : str
+ The address string. This has the form 'protocol://interface:port',
+ for example 'tcp://127.0.0.1:5555'. Protocols supported are
+ tcp, upd, pgm, inproc and ipc. If the address is unicode, it is
+ encoded to utf-8 first.
+ """
+ cdef int rc
+ cdef char* c_addr
+
+ _check_version((3,2), "unbind")
+ _check_closed(self)
+ if isinstance(addr, unicode):
+ addr = addr.encode('utf-8')
+ if not isinstance(addr, bytes):
+ raise TypeError('expected str, got: %r' % addr)
+ c_addr = addr
+
+ rc = zmq_unbind(self.handle, c_addr)
+ if rc != 0:
+ raise ZMQError()
+
+ def disconnect(self, addr):
+ """s.disconnect(addr)
+
+ Disconnect from a remote 0MQ socket (undoes a call to connect).
+
+ .. versionadded:: libzmq-3.2
+ .. versionadded:: 13.0
+
+ Parameters
+ ----------
+ addr : str
+ The address string. This has the form 'protocol://interface:port',
+ for example 'tcp://127.0.0.1:5555'. Protocols supported are
+ tcp, upd, pgm, inproc and ipc. If the address is unicode, it is
+ encoded to utf-8 first.
+ """
+ cdef int rc
+ cdef char* c_addr
+
+ _check_version((3,2), "disconnect")
+ _check_closed(self)
+ if isinstance(addr, unicode):
+ addr = addr.encode('utf-8')
+ if not isinstance(addr, bytes):
+ raise TypeError('expected str, got: %r' % addr)
+ c_addr = addr
+
+ rc = zmq_disconnect(self.handle, c_addr)
+ if rc != 0:
+ raise ZMQError()
+
+ def monitor(self, addr, int events=ZMQ_EVENT_ALL):
+ """s.monitor(addr, flags)
+
+ Start publishing socket events on inproc.
+ See libzmq docs for zmq_monitor for details.
+
+ While this function is available from libzmq 3.2,
+ pyzmq cannot parse monitor messages from libzmq prior to 4.0.
+
+ .. versionadded: libzmq-3.2
+ .. versionadded: 14.0
+
+ Parameters
+ ----------
+ addr : str
+ The inproc url used for monitoring. Passing None as
+ the addr will cause an existing socket monitor to be
+ deregistered.
+ events : int [default: zmq.EVENT_ALL]
+ The zmq event bitmask for which events will be sent to the monitor.
+ """
+ cdef int rc, c_flags
+ cdef char* c_addr = NULL
+
+ _check_version((3,2), "monitor")
+ if addr is not None:
+ if isinstance(addr, unicode):
+ addr = addr.encode('utf-8')
+ if not isinstance(addr, bytes):
+ raise TypeError('expected str, got: %r' % addr)
+ c_addr = addr
+ c_flags = events
+ rc = zmq_socket_monitor(self.handle, c_addr, c_flags)
+ _check_rc(rc)
+
+ #-------------------------------------------------------------------------
+ # Sending and receiving messages
+ #-------------------------------------------------------------------------
+
+ cpdef object send(self, object data, int flags=0, copy=True, track=False):
+ """s.send(data, flags=0, copy=True, track=False)
+
+ Send a message on this socket.
+
+ This queues the message to be sent by the IO thread at a later time.
+
+ Parameters
+ ----------
+ data : object, str, Frame
+ The content of the message.
+ flags : int
+ Any supported flag: NOBLOCK, SNDMORE.
+ copy : bool
+ Should the message be sent in a copying or non-copying manner.
+ track : bool
+ Should the message be tracked for notification that ZMQ has
+ finished with it? (ignored if copy=True)
+
+ Returns
+ -------
+ None : if `copy` or not track
+ None if message was sent, raises an exception otherwise.
+ MessageTracker : if track and not copy
+ a MessageTracker object, whose `pending` property will
+ be True until the send is completed.
+
+ Raises
+ ------
+ TypeError
+ If a unicode object is passed
+ ValueError
+ If `track=True`, but an untracked Frame is passed.
+ ZMQError
+ If the send does not succeed for any reason.
+
+ """
+ _check_closed(self)
+
+ if isinstance(data, unicode):
+ raise TypeError("unicode not allowed, use send_string")
+
+ if copy:
+ # msg.bytes never returns the input data object
+ # it is always a copy, but always the same copy
+ if isinstance(data, Frame):
+ data = data.buffer
+ return _send_copy(self.handle, data, flags)
+ else:
+ if isinstance(data, Frame):
+ if track and not data.tracker:
+ raise ValueError('Not a tracked message')
+ msg = data
+ else:
+ msg = Frame(data, track=track)
+ return _send_frame(self.handle, msg, flags)
+
+ cpdef object recv(self, int flags=0, copy=True, track=False):
+ """s.recv(flags=0, copy=True, track=False)
+
+ Receive a message.
+
+ Parameters
+ ----------
+ flags : int
+ Any supported flag: NOBLOCK. If NOBLOCK is set, this method
+ will raise a ZMQError with EAGAIN if a message is not ready.
+ If NOBLOCK is not set, then this method will block until a
+ message arrives.
+ copy : bool
+ Should the message be received in a copying or non-copying manner?
+ If False a Frame object is returned, if True a string copy of
+ message is returned.
+ track : bool
+ Should the message be tracked for notification that ZMQ has
+ finished with it? (ignored if copy=True)
+
+ Returns
+ -------
+ msg : bytes, Frame
+ The received message frame. If `copy` is False, then it will be a Frame,
+ otherwise it will be bytes.
+
+ Raises
+ ------
+ ZMQError
+ for any of the reasons zmq_msg_recv might fail.
+ """
+ _check_closed(self)
+
+ if copy:
+ return _recv_copy(self.handle, flags)
+ else:
+ frame = _recv_frame(self.handle, flags, track)
+ frame.more = self.getsockopt(zmq.RCVMORE)
+ return frame
+
+
+__all__ = ['Socket', 'IPC_PATH_MAX_LEN']
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.c b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.c
new file mode 100644
index 00000000..37606e06
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.c
@@ -0,0 +1,2956 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__backend__cython__utils
+#define __PYX_HAVE_API__zmq__backend__cython__utils
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/backend/cython/utils.pyx",
+};
+
+/*--- Type declarations ---*/
+struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch;
+
+/* "zmq/backend/cython/utils.pxd":27
+ *
+ *
+ * cdef class Stopwatch: # <<<<<<<<<<<<<<
+ * cdef void *watch # The C handle for the underlying zmq object
+ *
+ */
+struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch {
+ PyObject_HEAD
+ void *watch;
+};
+
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value);
+
+#ifndef __PYX_FORCE_INIT_THREADS
+ #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static int __Pyx_check_binary_version(void);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'zmq.backend.cython.utils' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_5utils_Stopwatch = 0;
+#define __Pyx_MODULE_NAME "zmq.backend.cython.utils"
+int __pyx_module_is_main_zmq__backend__cython__utils = 0;
+
+/* Implementation of 'zmq.backend.cython.utils' */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_has(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_capability); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_2curve_keypair(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static int __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch___cinit__(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self); /* proto */
+static void __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_2__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_4start(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_6stop(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_8sleep(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self, int __pyx_v_seconds); /* proto */
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_5utils_Stopwatch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_rc[] = "rc";
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_has[] = "has";
+static char __pyx_k_ccap[] = "ccap";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_utf8[] = "utf8";
+static char __pyx_k_encode[] = "encode";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_unicode[] = "unicode";
+static char __pyx_k_zmq_has[] = "zmq.has";
+static char __pyx_k_ZMQError[] = "ZMQError";
+static char __pyx_k_check_rc[] = "_check_rc";
+static char __pyx_k_0MQ_utils[] = "0MQ utils.";
+static char __pyx_k_Stopwatch[] = "Stopwatch";
+static char __pyx_k_zmq_error[] = "zmq.error";
+static char __pyx_k_capability[] = "capability";
+static char __pyx_k_public_key[] = "public_key";
+static char __pyx_k_secret_key[] = "secret_key";
+static char __pyx_k_check_version[] = "_check_version";
+static char __pyx_k_curve_keypair[] = "curve_keypair";
+static char __pyx_k_zmq_utils_strtypes[] = "zmq.utils.strtypes";
+static char __pyx_k_zmq_backend_cython_utils[] = "zmq.backend.cython.utils";
+static char __pyx_k_Stopwatch_is_already_running[] = "Stopwatch is already running.";
+static char __pyx_k_Must_start_the_Stopwatch_before[] = "Must start the Stopwatch before calling stop.";
+static char __pyx_k_private_tmp_pyzmq_release_zmq_b[] = "/private/tmp/pyzmq-release/zmq/backend/cython/utils.pyx";
+static PyObject *__pyx_kp_s_Must_start_the_Stopwatch_before;
+static PyObject *__pyx_n_s_Stopwatch;
+static PyObject *__pyx_kp_s_Stopwatch_is_already_running;
+static PyObject *__pyx_n_s_ZMQError;
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_capability;
+static PyObject *__pyx_n_s_ccap;
+static PyObject *__pyx_n_s_check_rc;
+static PyObject *__pyx_n_s_check_version;
+static PyObject *__pyx_n_s_curve_keypair;
+static PyObject *__pyx_n_s_encode;
+static PyObject *__pyx_n_s_has;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_kp_s_private_tmp_pyzmq_release_zmq_b;
+static PyObject *__pyx_n_s_public_key;
+static PyObject *__pyx_n_s_rc;
+static PyObject *__pyx_n_s_secret_key;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_unicode;
+static PyObject *__pyx_n_s_utf8;
+static PyObject *__pyx_n_s_zmq_backend_cython_utils;
+static PyObject *__pyx_n_s_zmq_error;
+static PyObject *__pyx_kp_s_zmq_has;
+static PyObject *__pyx_n_s_zmq_utils_strtypes;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_4;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__2;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__4;
+static PyObject *__pyx_tuple__5;
+static PyObject *__pyx_tuple__6;
+static PyObject *__pyx_tuple__7;
+static PyObject *__pyx_tuple__8;
+static PyObject *__pyx_tuple__10;
+static PyObject *__pyx_codeobj__9;
+static PyObject *__pyx_codeobj__11;
+
+/* "zmq/backend/cython/utils.pyx":29
+ * from zmq.utils.strtypes import unicode
+ *
+ * def has(capability): # <<<<<<<<<<<<<<
+ * """Check for zmq capability by name (e.g. 'ipc', 'curve')
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_1has(PyObject *__pyx_self, PyObject *__pyx_v_capability); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_5utils_has[] = "Check for zmq capability by name (e.g. 'ipc', 'curve')\n \n .. versionadded:: libzmq-4.1\n .. versionadded:: 14.1\n ";
+static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_5utils_1has = {"has", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5utils_1has, METH_O, __pyx_doc_3zmq_7backend_6cython_5utils_has};
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_1has(PyObject *__pyx_self, PyObject *__pyx_v_capability) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("has (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5utils_has(__pyx_self, ((PyObject *)__pyx_v_capability));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_has(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_capability) {
+ PyObject *__pyx_v_ccap = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ const char * __pyx_t_5;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("has", 0);
+ __Pyx_INCREF(__pyx_v_capability);
+
+ /* "zmq/backend/cython/utils.pyx":35
+ * .. versionadded:: 14.1
+ * """
+ * _check_version((4,1), 'zmq.has') # <<<<<<<<<<<<<<
+ * cdef bytes ccap
+ * if isinstance(capability, unicode):
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":37
+ * _check_version((4,1), 'zmq.has')
+ * cdef bytes ccap
+ * if isinstance(capability, unicode): # <<<<<<<<<<<<<<
+ * capability = capability.encode('utf8')
+ * ccap = capability
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_IsInstance(__pyx_v_capability, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = (__pyx_t_3 != 0);
+ if (__pyx_t_4) {
+
+ /* "zmq/backend/cython/utils.pyx":38
+ * cdef bytes ccap
+ * if isinstance(capability, unicode):
+ * capability = capability.encode('utf8') # <<<<<<<<<<<<<<
+ * ccap = capability
+ * return bool(zmq_has(ccap))
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_capability, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF_SET(__pyx_v_capability, __pyx_t_1);
+ __pyx_t_1 = 0;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/utils.pyx":39
+ * if isinstance(capability, unicode):
+ * capability = capability.encode('utf8')
+ * ccap = capability # <<<<<<<<<<<<<<
+ * return bool(zmq_has(ccap))
+ *
+ */
+ if (!(likely(PyBytes_CheckExact(__pyx_v_capability))||((__pyx_v_capability) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_capability)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_v_capability;
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_v_ccap = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":40
+ * capability = capability.encode('utf8')
+ * ccap = capability
+ * return bool(zmq_has(ccap)) # <<<<<<<<<<<<<<
+ *
+ * def curve_keypair():
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_ccap); if (unlikely((__pyx_t_5 == (const char *)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(zmq_has(__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_4))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/utils.pyx":29
+ * from zmq.utils.strtypes import unicode
+ *
+ * def has(capability): # <<<<<<<<<<<<<<
+ * """Check for zmq capability by name (e.g. 'ipc', 'curve')
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("zmq.backend.cython.utils.has", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_ccap);
+ __Pyx_XDECREF(__pyx_v_capability);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/utils.pyx":42
+ * return bool(zmq_has(ccap))
+ *
+ * def curve_keypair(): # <<<<<<<<<<<<<<
+ * """generate a Z85 keypair for use with zmq.CURVE security
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_3curve_keypair(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_5utils_2curve_keypair[] = "generate a Z85 keypair for use with zmq.CURVE security\n \n Requires libzmq (\342\211\245 4.0) to have been linked with libsodium.\n \n .. versionadded:: libzmq-4.0\n .. versionadded:: 14.0\n \n Returns\n -------\n (public, secret) : two bytestrings\n The public and private keypair as 40 byte z85-encoded bytestrings.\n ";
+static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_5utils_3curve_keypair = {"curve_keypair", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5utils_3curve_keypair, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_5utils_2curve_keypair};
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_3curve_keypair(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("curve_keypair (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5utils_2curve_keypair(__pyx_self);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_2curve_keypair(CYTHON_UNUSED PyObject *__pyx_self) {
+ int __pyx_v_rc;
+ char __pyx_v_public_key[64];
+ char __pyx_v_secret_key[64];
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("curve_keypair", 0);
+
+ /* "zmq/backend/cython/utils.pyx":58
+ * cdef char[64] public_key
+ * cdef char[64] secret_key
+ * _check_version((4,0), "curve_keypair") # <<<<<<<<<<<<<<
+ * rc = zmq_curve_keypair (public_key, secret_key)
+ * _check_rc(rc)
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":59
+ * cdef char[64] secret_key
+ * _check_version((4,0), "curve_keypair")
+ * rc = zmq_curve_keypair (public_key, secret_key) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * return public_key, secret_key
+ */
+ __pyx_v_rc = zmq_curve_keypair(__pyx_v_public_key, __pyx_v_secret_key);
+
+ /* "zmq/backend/cython/utils.pyx":60
+ * _check_version((4,0), "curve_keypair")
+ * rc = zmq_curve_keypair (public_key, secret_key)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * return public_key, secret_key
+ *
+ */
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_rc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_2);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":61
+ * rc = zmq_curve_keypair (public_key, secret_key)
+ * _check_rc(rc)
+ * return public_key, secret_key # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_public_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_FromString(__pyx_v_secret_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_2 = 0;
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/utils.pyx":42
+ * return bool(zmq_has(ccap))
+ *
+ * def curve_keypair(): # <<<<<<<<<<<<<<
+ * """generate a Z85 keypair for use with zmq.CURVE security
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.backend.cython.utils.curve_keypair", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/utils.pyx":72
+ * """
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.watch = NULL
+ *
+ */
+
+/* Python wrapper */
+static int __pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+ if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch___cinit__(((struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch___cinit__(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "zmq/backend/cython/utils.pyx":73
+ *
+ * def __cinit__(self):
+ * self.watch = NULL # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(self):
+ */
+ __pyx_v_self->watch = NULL;
+
+ /* "zmq/backend/cython/utils.pyx":72
+ * """
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.watch = NULL
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/utils.pyx":75
+ * self.watch = NULL
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * # copy of self.stop() we can't call object methods in dealloc as it
+ * # might already be partially deleted
+ */
+
+/* Python wrapper */
+static void __pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_3__dealloc__(PyObject *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_2__dealloc__(((struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_2__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ __Pyx_RefNannySetupContext("__dealloc__", 0);
+
+ /* "zmq/backend/cython/utils.pyx":78
+ * # copy of self.stop() we can't call object methods in dealloc as it
+ * # might already be partially deleted
+ * if self.watch: # <<<<<<<<<<<<<<
+ * zmq_stopwatch_stop(self.watch)
+ * self.watch = NULL
+ */
+ __pyx_t_1 = (__pyx_v_self->watch != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/utils.pyx":79
+ * # might already be partially deleted
+ * if self.watch:
+ * zmq_stopwatch_stop(self.watch) # <<<<<<<<<<<<<<
+ * self.watch = NULL
+ *
+ */
+ zmq_stopwatch_stop(__pyx_v_self->watch);
+
+ /* "zmq/backend/cython/utils.pyx":80
+ * if self.watch:
+ * zmq_stopwatch_stop(self.watch)
+ * self.watch = NULL # <<<<<<<<<<<<<<
+ *
+ * def start(self):
+ */
+ __pyx_v_self->watch = NULL;
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/utils.pyx":75
+ * self.watch = NULL
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * # copy of self.stop() we can't call object methods in dealloc as it
+ * # might already be partially deleted
+ */
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "zmq/backend/cython/utils.pyx":82
+ * self.watch = NULL
+ *
+ * def start(self): # <<<<<<<<<<<<<<
+ * """s.start()
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_5start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_5utils_9Stopwatch_4start[] = "s.start()\n\n Start the stopwatch.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_5start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("start (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_4start(((struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_4start(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("start", 0);
+
+ /* "zmq/backend/cython/utils.pyx":87
+ * Start the stopwatch.
+ * """
+ * if self.watch == NULL: # <<<<<<<<<<<<<<
+ * self.watch = zmq_stopwatch_start()
+ * else:
+ */
+ __pyx_t_1 = ((__pyx_v_self->watch == NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/utils.pyx":88
+ * """
+ * if self.watch == NULL:
+ * self.watch = zmq_stopwatch_start() # <<<<<<<<<<<<<<
+ * else:
+ * raise ZMQError('Stopwatch is already running.')
+ */
+ __pyx_v_self->watch = zmq_stopwatch_start();
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/utils.pyx":90
+ * self.watch = zmq_stopwatch_start()
+ * else:
+ * raise ZMQError('Stopwatch is already running.') # <<<<<<<<<<<<<<
+ *
+ * def stop(self):
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_L3:;
+
+ /* "zmq/backend/cython/utils.pyx":82
+ * self.watch = NULL
+ *
+ * def start(self): # <<<<<<<<<<<<<<
+ * """s.start()
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("zmq.backend.cython.utils.Stopwatch.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/utils.pyx":92
+ * raise ZMQError('Stopwatch is already running.')
+ *
+ * def stop(self): # <<<<<<<<<<<<<<
+ * """s.stop()
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_7stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_5utils_9Stopwatch_6stop[] = "s.stop()\n\n Stop the stopwatch.\n \n Returns\n -------\n t : unsigned long int\n the number of microseconds since ``start()`` was called.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_7stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("stop (wrapper)", 0);
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_6stop(((struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_6stop(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self) {
+ unsigned long __pyx_v_time;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("stop", 0);
+
+ /* "zmq/backend/cython/utils.pyx":103
+ * """
+ * cdef unsigned long time
+ * if self.watch == NULL: # <<<<<<<<<<<<<<
+ * raise ZMQError('Must start the Stopwatch before calling stop.')
+ * else:
+ */
+ __pyx_t_1 = ((__pyx_v_self->watch == NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/backend/cython/utils.pyx":104
+ * cdef unsigned long time
+ * if self.watch == NULL:
+ * raise ZMQError('Must start the Stopwatch before calling stop.') # <<<<<<<<<<<<<<
+ * else:
+ * time = zmq_stopwatch_stop(self.watch)
+ */
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ /*else*/ {
+
+ /* "zmq/backend/cython/utils.pyx":106
+ * raise ZMQError('Must start the Stopwatch before calling stop.')
+ * else:
+ * time = zmq_stopwatch_stop(self.watch) # <<<<<<<<<<<<<<
+ * self.watch = NULL
+ * return time
+ */
+ __pyx_v_time = zmq_stopwatch_stop(__pyx_v_self->watch);
+
+ /* "zmq/backend/cython/utils.pyx":107
+ * else:
+ * time = zmq_stopwatch_stop(self.watch)
+ * self.watch = NULL # <<<<<<<<<<<<<<
+ * return time
+ *
+ */
+ __pyx_v_self->watch = NULL;
+
+ /* "zmq/backend/cython/utils.pyx":108
+ * time = zmq_stopwatch_stop(self.watch)
+ * self.watch = NULL
+ * return time # <<<<<<<<<<<<<<
+ *
+ * def sleep(self, int seconds):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = __Pyx_PyInt_From_unsigned_long(__pyx_v_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/backend/cython/utils.pyx":92
+ * raise ZMQError('Stopwatch is already running.')
+ *
+ * def stop(self): # <<<<<<<<<<<<<<
+ * """s.stop()
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("zmq.backend.cython.utils.Stopwatch.stop", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/utils.pyx":110
+ * return time
+ *
+ * def sleep(self, int seconds): # <<<<<<<<<<<<<<
+ * """s.sleep(seconds)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_9sleep(PyObject *__pyx_v_self, PyObject *__pyx_arg_seconds); /*proto*/
+static char __pyx_doc_3zmq_7backend_6cython_5utils_9Stopwatch_8sleep[] = "s.sleep(seconds)\n\n Sleep for an integer number of seconds.\n ";
+static PyObject *__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_9sleep(PyObject *__pyx_v_self, PyObject *__pyx_arg_seconds) {
+ int __pyx_v_seconds;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("sleep (wrapper)", 0);
+ assert(__pyx_arg_seconds); {
+ __pyx_v_seconds = __Pyx_PyInt_As_int(__pyx_arg_seconds); if (unlikely((__pyx_v_seconds == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.backend.cython.utils.Stopwatch.sleep", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_8sleep(((struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *)__pyx_v_self), ((int)__pyx_v_seconds));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7backend_6cython_5utils_9Stopwatch_8sleep(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch *__pyx_v_self, int __pyx_v_seconds) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("sleep", 0);
+
+ /* "zmq/backend/cython/utils.pyx":115
+ * Sleep for an integer number of seconds.
+ * """
+ * with nogil: # <<<<<<<<<<<<<<
+ * zmq_sleep(seconds)
+ *
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/backend/cython/utils.pyx":116
+ * """
+ * with nogil:
+ * zmq_sleep(seconds) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ zmq_sleep(__pyx_v_seconds);
+ }
+
+ /* "zmq/backend/cython/utils.pyx":115
+ * Sleep for an integer number of seconds.
+ * """
+ * with nogil: # <<<<<<<<<<<<<<
+ * zmq_sleep(seconds)
+ *
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+ }
+ }
+
+ /* "zmq/backend/cython/utils.pyx":110
+ * return time
+ *
+ * def sleep(self, int seconds): # <<<<<<<<<<<<<<
+ * """s.sleep(seconds)
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_tp_new_3zmq_7backend_6cython_5utils_Stopwatch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
+ return o;
+}
+
+static void __pyx_tp_dealloc_3zmq_7backend_6cython_5utils_Stopwatch(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyMethodDef __pyx_methods_3zmq_7backend_6cython_5utils_Stopwatch[] = {
+ {"start", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_5start, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_5utils_9Stopwatch_4start},
+ {"stop", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_7stop, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_5utils_9Stopwatch_6stop},
+ {"sleep", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5utils_9Stopwatch_9sleep, METH_O, __pyx_doc_3zmq_7backend_6cython_5utils_9Stopwatch_8sleep},
+ {0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_3zmq_7backend_6cython_5utils_Stopwatch = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "zmq.backend.cython.utils.Stopwatch", /*tp_name*/
+ sizeof(struct __pyx_obj_3zmq_7backend_6cython_5utils_Stopwatch), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_3zmq_7backend_6cython_5utils_Stopwatch, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "Stopwatch()\n\n A simple stopwatch based on zmq_stopwatch_start/stop.\n\n This class should be used for benchmarking and timing 0MQ code.\n ", /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_3zmq_7backend_6cython_5utils_Stopwatch, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_3zmq_7backend_6cython_5utils_Stopwatch, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "utils",
+ __pyx_k_0MQ_utils, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_kp_s_Must_start_the_Stopwatch_before, __pyx_k_Must_start_the_Stopwatch_before, sizeof(__pyx_k_Must_start_the_Stopwatch_before), 0, 0, 1, 0},
+ {&__pyx_n_s_Stopwatch, __pyx_k_Stopwatch, sizeof(__pyx_k_Stopwatch), 0, 0, 1, 1},
+ {&__pyx_kp_s_Stopwatch_is_already_running, __pyx_k_Stopwatch_is_already_running, sizeof(__pyx_k_Stopwatch_is_already_running), 0, 0, 1, 0},
+ {&__pyx_n_s_ZMQError, __pyx_k_ZMQError, sizeof(__pyx_k_ZMQError), 0, 0, 1, 1},
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_capability, __pyx_k_capability, sizeof(__pyx_k_capability), 0, 0, 1, 1},
+ {&__pyx_n_s_ccap, __pyx_k_ccap, sizeof(__pyx_k_ccap), 0, 0, 1, 1},
+ {&__pyx_n_s_check_rc, __pyx_k_check_rc, sizeof(__pyx_k_check_rc), 0, 0, 1, 1},
+ {&__pyx_n_s_check_version, __pyx_k_check_version, sizeof(__pyx_k_check_version), 0, 0, 1, 1},
+ {&__pyx_n_s_curve_keypair, __pyx_k_curve_keypair, sizeof(__pyx_k_curve_keypair), 0, 0, 1, 1},
+ {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
+ {&__pyx_n_s_has, __pyx_k_has, sizeof(__pyx_k_has), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_k_private_tmp_pyzmq_release_zmq_b, sizeof(__pyx_k_private_tmp_pyzmq_release_zmq_b), 0, 0, 1, 0},
+ {&__pyx_n_s_public_key, __pyx_k_public_key, sizeof(__pyx_k_public_key), 0, 0, 1, 1},
+ {&__pyx_n_s_rc, __pyx_k_rc, sizeof(__pyx_k_rc), 0, 0, 1, 1},
+ {&__pyx_n_s_secret_key, __pyx_k_secret_key, sizeof(__pyx_k_secret_key), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 0, 1, 1},
+ {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_backend_cython_utils, __pyx_k_zmq_backend_cython_utils, sizeof(__pyx_k_zmq_backend_cython_utils), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_error, __pyx_k_zmq_error, sizeof(__pyx_k_zmq_error), 0, 0, 1, 1},
+ {&__pyx_kp_s_zmq_has, __pyx_k_zmq_has, sizeof(__pyx_k_zmq_has), 0, 0, 1, 0},
+ {&__pyx_n_s_zmq_utils_strtypes, __pyx_k_zmq_utils_strtypes, sizeof(__pyx_k_zmq_utils_strtypes), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ return 0;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "zmq/backend/cython/utils.pyx":35
+ * .. versionadded:: 14.1
+ * """
+ * _check_version((4,1), 'zmq.has') # <<<<<<<<<<<<<<
+ * cdef bytes ccap
+ * if isinstance(capability, unicode):
+ */
+ __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_4, __pyx_int_1); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+ __pyx_tuple__2 = PyTuple_Pack(2, __pyx_tuple_, __pyx_kp_s_zmq_has); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__2);
+ __Pyx_GIVEREF(__pyx_tuple__2);
+
+ /* "zmq/backend/cython/utils.pyx":38
+ * cdef bytes ccap
+ * if isinstance(capability, unicode):
+ * capability = capability.encode('utf8') # <<<<<<<<<<<<<<
+ * ccap = capability
+ * return bool(zmq_has(ccap))
+ */
+ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+
+ /* "zmq/backend/cython/utils.pyx":58
+ * cdef char[64] public_key
+ * cdef char[64] secret_key
+ * _check_version((4,0), "curve_keypair") # <<<<<<<<<<<<<<
+ * rc = zmq_curve_keypair (public_key, secret_key)
+ * _check_rc(rc)
+ */
+ __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_4, __pyx_int_0); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__4);
+ __Pyx_GIVEREF(__pyx_tuple__4);
+ __pyx_tuple__5 = PyTuple_Pack(2, __pyx_tuple__4, __pyx_n_s_curve_keypair); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__5);
+ __Pyx_GIVEREF(__pyx_tuple__5);
+
+ /* "zmq/backend/cython/utils.pyx":90
+ * self.watch = zmq_stopwatch_start()
+ * else:
+ * raise ZMQError('Stopwatch is already running.') # <<<<<<<<<<<<<<
+ *
+ * def stop(self):
+ */
+ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Stopwatch_is_already_running); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__6);
+ __Pyx_GIVEREF(__pyx_tuple__6);
+
+ /* "zmq/backend/cython/utils.pyx":104
+ * cdef unsigned long time
+ * if self.watch == NULL:
+ * raise ZMQError('Must start the Stopwatch before calling stop.') # <<<<<<<<<<<<<<
+ * else:
+ * time = zmq_stopwatch_stop(self.watch)
+ */
+ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Must_start_the_Stopwatch_before); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__7);
+ __Pyx_GIVEREF(__pyx_tuple__7);
+
+ /* "zmq/backend/cython/utils.pyx":29
+ * from zmq.utils.strtypes import unicode
+ *
+ * def has(capability): # <<<<<<<<<<<<<<
+ * """Check for zmq capability by name (e.g. 'ipc', 'curve')
+ *
+ */
+ __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_capability, __pyx_n_s_ccap); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__8);
+ __Pyx_GIVEREF(__pyx_tuple__8);
+ __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_has, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/utils.pyx":42
+ * return bool(zmq_has(ccap))
+ *
+ * def curve_keypair(): # <<<<<<<<<<<<<<
+ * """generate a Z85 keypair for use with zmq.CURVE security
+ *
+ */
+ __pyx_tuple__10 = PyTuple_Pack(3, __pyx_n_s_rc, __pyx_n_s_public_key, __pyx_n_s_secret_key); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__10);
+ __Pyx_GIVEREF(__pyx_tuple__10);
+ __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_curve_keypair, 42, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initutils(void); /*proto*/
+PyMODINIT_FUNC initutils(void)
+#else
+PyMODINIT_FUNC PyInit_utils(void); /*proto*/
+PyMODINIT_FUNC PyInit_utils(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_utils(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("utils", __pyx_methods, __pyx_k_0MQ_utils, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__backend__cython__utils) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.backend.cython.utils")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython.utils", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ if (PyType_Ready(&__pyx_type_3zmq_7backend_6cython_5utils_Stopwatch) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_3zmq_7backend_6cython_5utils_Stopwatch.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Stopwatch", (PyObject *)&__pyx_type_3zmq_7backend_6cython_5utils_Stopwatch) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3zmq_7backend_6cython_5utils_Stopwatch = &__pyx_type_3zmq_7backend_6cython_5utils_Stopwatch;
+ /*--- Type import code ---*/
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/backend/cython/utils.pyx":26
+ * zmq_has, const_char_ptr
+ * )
+ * from zmq.error import ZMQError, _check_rc, _check_version # <<<<<<<<<<<<<<
+ * from zmq.utils.strtypes import unicode
+ *
+ */
+ __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __Pyx_INCREF(__pyx_n_s_check_rc);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_check_rc);
+ __Pyx_GIVEREF(__pyx_n_s_check_rc);
+ __Pyx_INCREF(__pyx_n_s_check_version);
+ PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_check_version);
+ __Pyx_GIVEREF(__pyx_n_s_check_version);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZMQError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_check_rc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_rc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_version, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":27
+ * )
+ * from zmq.error import ZMQError, _check_rc, _check_version
+ * from zmq.utils.strtypes import unicode # <<<<<<<<<<<<<<
+ *
+ * def has(capability):
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_unicode);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_unicode);
+ __Pyx_GIVEREF(__pyx_n_s_unicode);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_zmq_utils_strtypes, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_unicode, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":29
+ * from zmq.utils.strtypes import unicode
+ *
+ * def has(capability): # <<<<<<<<<<<<<<
+ * """Check for zmq capability by name (e.g. 'ipc', 'curve')
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_5utils_1has, NULL, __pyx_n_s_zmq_backend_cython_utils); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_has, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":42
+ * return bool(zmq_has(ccap))
+ *
+ * def curve_keypair(): # <<<<<<<<<<<<<<
+ * """generate a Z85 keypair for use with zmq.CURVE security
+ *
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_5utils_3curve_keypair, NULL, __pyx_n_s_zmq_backend_cython_utils); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_curve_keypair, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":119
+ *
+ *
+ * __all__ = ['has', 'curve_keypair', 'Stopwatch'] # <<<<<<<<<<<<<<
+ */
+ __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_has);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_has);
+ __Pyx_GIVEREF(__pyx_n_s_has);
+ __Pyx_INCREF(__pyx_n_s_curve_keypair);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_curve_keypair);
+ __Pyx_GIVEREF(__pyx_n_s_curve_keypair);
+ __Pyx_INCREF(__pyx_n_s_Stopwatch);
+ PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_Stopwatch);
+ __Pyx_GIVEREF(__pyx_n_s_Stopwatch);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/backend/cython/utils.pyx":1
+ * """0MQ utils.""" # <<<<<<<<<<<<<<
+ *
+ * #
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.backend.cython.utils", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython.utils");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
+ PyObject *kwdict,
+ const char* function_name,
+ int kw_allowed)
+{
+ PyObject* key = 0;
+ Py_ssize_t pos = 0;
+#if CYTHON_COMPILING_IN_PYPY
+ if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
+ goto invalid_keyword;
+ return 1;
+#else
+ while (PyDict_Next(kwdict, &pos, &key, 0)) {
+ #if PY_MAJOR_VERSION < 3
+ if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
+ #endif
+ if (unlikely(!PyUnicode_Check(key)))
+ goto invalid_keyword_type;
+ }
+ if ((!kw_allowed) && unlikely(key))
+ goto invalid_keyword;
+ return 1;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ return 0;
+#endif
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+ return 0;
+}
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_Restore(type, value, tb);
+#endif
+}
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) {
+ const unsigned long neg_one = (unsigned long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(unsigned long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(unsigned long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(unsigned long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(unsigned long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/zmq/backend/cython/utils.pxd b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.pxd
index 1d7117f1..1d7117f1 100644
--- a/external_libs/python/zmq/backend/cython/utils.pxd
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.pxd
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.pyx b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.pyx
new file mode 100644
index 00000000..68976e3b
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/cython/utils.pyx
@@ -0,0 +1,119 @@
+"""0MQ utils."""
+
+#
+# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
+#
+# This file is part of pyzmq.
+#
+# pyzmq 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 Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# pyzmq 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.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+from libzmq cimport (
+ zmq_stopwatch_start, zmq_stopwatch_stop, zmq_sleep, zmq_curve_keypair,
+ zmq_has, const_char_ptr
+)
+from zmq.error import ZMQError, _check_rc, _check_version
+from zmq.utils.strtypes import unicode
+
+def has(capability):
+ """Check for zmq capability by name (e.g. 'ipc', 'curve')
+
+ .. versionadded:: libzmq-4.1
+ .. versionadded:: 14.1
+ """
+ _check_version((4,1), 'zmq.has')
+ cdef bytes ccap
+ if isinstance(capability, unicode):
+ capability = capability.encode('utf8')
+ ccap = capability
+ return bool(zmq_has(ccap))
+
+def curve_keypair():
+ """generate a Z85 keypair for use with zmq.CURVE security
+
+ Requires libzmq (≥ 4.0) to have been linked with libsodium.
+
+ .. versionadded:: libzmq-4.0
+ .. versionadded:: 14.0
+
+ Returns
+ -------
+ (public, secret) : two bytestrings
+ The public and private keypair as 40 byte z85-encoded bytestrings.
+ """
+ cdef int rc
+ cdef char[64] public_key
+ cdef char[64] secret_key
+ _check_version((4,0), "curve_keypair")
+ rc = zmq_curve_keypair (public_key, secret_key)
+ _check_rc(rc)
+ return public_key, secret_key
+
+
+cdef class Stopwatch:
+ """Stopwatch()
+
+ A simple stopwatch based on zmq_stopwatch_start/stop.
+
+ This class should be used for benchmarking and timing 0MQ code.
+ """
+
+ def __cinit__(self):
+ self.watch = NULL
+
+ def __dealloc__(self):
+ # copy of self.stop() we can't call object methods in dealloc as it
+ # might already be partially deleted
+ if self.watch:
+ zmq_stopwatch_stop(self.watch)
+ self.watch = NULL
+
+ def start(self):
+ """s.start()
+
+ Start the stopwatch.
+ """
+ if self.watch == NULL:
+ self.watch = zmq_stopwatch_start()
+ else:
+ raise ZMQError('Stopwatch is already running.')
+
+ def stop(self):
+ """s.stop()
+
+ Stop the stopwatch.
+
+ Returns
+ -------
+ t : unsigned long int
+ the number of microseconds since ``start()`` was called.
+ """
+ cdef unsigned long time
+ if self.watch == NULL:
+ raise ZMQError('Must start the Stopwatch before calling stop.')
+ else:
+ time = zmq_stopwatch_stop(self.watch)
+ self.watch = NULL
+ return time
+
+ def sleep(self, int seconds):
+ """s.sleep(seconds)
+
+ Sleep for an integer number of seconds.
+ """
+ with nogil:
+ zmq_sleep(seconds)
+
+
+__all__ = ['has', 'curve_keypair', 'Stopwatch']
diff --git a/external_libs/python/zmq/backend/select.py b/external_libs/python/pyzmq-14.7.0/zmq/backend/select.py
index 0a2e09a2..0a2e09a2 100644
--- a/external_libs/python/zmq/backend/select.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/backend/select.py
diff --git a/external_libs/python/zmq/devices/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/devices/__init__.py
index 23715963..23715963 100644
--- a/external_libs/python/zmq/devices/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/devices/__init__.py
diff --git a/external_libs/python/zmq/devices/basedevice.py b/external_libs/python/pyzmq-14.7.0/zmq/devices/basedevice.py
index 7ba1b7ac..7ba1b7ac 100644
--- a/external_libs/python/zmq/devices/basedevice.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/devices/basedevice.py
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.c b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.c
new file mode 100644
index 00000000..8aa90f07
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.c
@@ -0,0 +1,5941 @@
+/* Generated by Cython 0.22 */
+
+#define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
+#else
+#define CYTHON_ABI "0_22"
+#include <stddef.h>
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+#define Py_OptimizeFlag 0
+#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyType_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+ #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t PyInt_AsLong
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#else
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+ a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+ a quiet NaN. */
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+template<typename T>
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(T& ref) : ptr(&ref) { }
+ T *operator->() { return ptr; }
+ operator T&() { return *ptr; }
+ private:
+ T *ptr;
+};
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#ifndef __PYX_EXTERN_C
+ #ifdef __cplusplus
+ #define __PYX_EXTERN_C extern "C"
+ #else
+ #define __PYX_EXTERN_C extern
+ #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE__zmq__devices__monitoredqueue
+#define __PYX_HAVE_API__zmq__devices__monitoredqueue
+#include "zmq_compat.h"
+#include "zmq.h"
+#include "zmq_utils.h"
+#include "string.h"
+#include "pyversion_compat.h"
+#include "errno.h"
+#include "stdio.h"
+#include "pythread.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_d;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+static const char *__pyx_f[] = {
+ "zmq/devices/monitoredqueue.pyx",
+ "zmq/backend/cython/checkrc.pxd",
+ "zmq/utils/buffers.pxd",
+ "zmq/backend/cython/context.pxd",
+ "zmq/backend/cython/socket.pxd",
+ "type.pxd",
+ "bool.pxd",
+ "complex.pxd",
+};
+
+/*--- Type declarations ---*/
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context;
+struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send;
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv;
+
+/* "zmq/backend/cython/socket.pxd":45
+ *
+ * # cpdef methods for direct-cython access:
+ * cpdef object send(self, object data, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
+ * cpdef object recv(self, int flags=*, copy=*, track=*)
+ *
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send {
+ int __pyx_n;
+ int flags;
+ PyObject *copy;
+ PyObject *track;
+};
+
+/* "zmq/backend/cython/socket.pxd":46
+ * # cpdef methods for direct-cython access:
+ * cpdef object send(self, object data, int flags=*, copy=*, track=*)
+ * cpdef object recv(self, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
+ *
+ */
+struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv {
+ int __pyx_n;
+ int flags;
+ PyObject *copy;
+ PyObject *track;
+};
+
+/* "context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_7context_Context {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ void **_sockets;
+ size_t _n_sockets;
+ size_t _max_sockets;
+ int _pid;
+ int closed;
+};
+
+
+/* "zmq/backend/cython/socket.pxd":33
+ *
+ *
+ * cdef class Socket: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtab;
+ PyObject *__weakref__;
+ void *handle;
+ int _shadow;
+ struct __pyx_obj_3zmq_7backend_6cython_7context_Context *context;
+ int _closed;
+ int _pid;
+};
+
+
+
+/* "context.pxd":26
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef class Context: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context {
+ int (*_term)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *);
+ void (*_add_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+ void (*_remove_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtabptr_3zmq_7backend_6cython_7context_Context;
+
+
+/* "zmq/backend/cython/socket.pxd":33
+ *
+ *
+ * cdef class Socket: # <<<<<<<<<<<<<<
+ *
+ * cdef object __weakref__ # enable weakref
+ */
+
+struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket {
+ PyObject *(*send)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args);
+ PyObject *(*recv)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args);
+};
+static struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket;
+
+/* --- Runtime support code (head) --- */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, int);
+ void (*DECREF)(void*, PyObject*, int);
+ void (*GOTREF)(void*, PyObject*, int);
+ void (*GIVEREF)(void*, PyObject*, int);
+ void* (*SetupContext)(const char*, int, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ if (acquire_gil) { \
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ PyGILState_Release(__pyx_gilstate_save); \
+ } else { \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+ #define __Pyx_RefNannyFinishContext() \
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+ const char* function_name);
+
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+ PyTypeObject* tp = Py_TYPE(obj);
+ if (likely(tp->tp_getattro))
+ return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+ if (likely(tp->tp_getattr))
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+ return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+static void* __Pyx_GetVtable(PyObject *dict);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+#ifndef __PYX_FORCE_INIT_THREADS
+ #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+static int __Pyx_check_binary_version(void);
+
+#if !defined(__Pyx_PyIdentifier_FromString)
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
+#else
+ #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
+#endif
+#endif
+
+static PyObject *__Pyx_ImportModule(const char *name);
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+
+/* Module declarations from 'libzmq' */
+
+/* Module declarations from 'libc.string' */
+
+/* Module declarations from 'buffers' */
+static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void); /*proto*/
+static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void); /*proto*/
+static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *, int, int, void **, Py_ssize_t *, Py_ssize_t *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *, void **, Py_ssize_t *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *, Py_ssize_t, int); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *, int); /*proto*/
+
+/* Module declarations from 'zmq.backend.cython.context' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7context_Context = 0;
+
+/* Module declarations from 'zmq.backend.cython.socket' */
+static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_6socket_Socket = 0;
+
+/* Module declarations from 'libc.errno' */
+
+/* Module declarations from 'cpython.version' */
+
+/* Module declarations from 'cpython.ref' */
+
+/* Module declarations from 'cpython.exc' */
+
+/* Module declarations from 'cpython.module' */
+
+/* Module declarations from 'cpython.mem' */
+
+/* Module declarations from 'cpython.tuple' */
+
+/* Module declarations from 'cpython.list' */
+
+/* Module declarations from 'libc.stdio' */
+
+/* Module declarations from 'cpython.object' */
+
+/* Module declarations from 'cpython.sequence' */
+
+/* Module declarations from 'cpython.mapping' */
+
+/* Module declarations from 'cpython.iterator' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
+
+/* Module declarations from 'cpython.number' */
+
+/* Module declarations from 'cpython.int' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.bool' */
+static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
+
+/* Module declarations from 'cpython.long' */
+
+/* Module declarations from 'cpython.float' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.complex' */
+static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
+
+/* Module declarations from 'cpython.string' */
+
+/* Module declarations from 'cpython.unicode' */
+
+/* Module declarations from 'cpython.dict' */
+
+/* Module declarations from 'cpython.instance' */
+
+/* Module declarations from 'cpython.function' */
+
+/* Module declarations from 'cpython.method' */
+
+/* Module declarations from 'cpython.weakref' */
+
+/* Module declarations from 'cpython.getargs' */
+
+/* Module declarations from 'cpython.pythread' */
+
+/* Module declarations from 'cpython.pystate' */
+
+/* Module declarations from 'cpython.cobject' */
+
+/* Module declarations from 'cpython.oldbuffer' */
+
+/* Module declarations from 'cpython.set' */
+
+/* Module declarations from 'cpython.buffer' */
+
+/* Module declarations from 'cpython.bytes' */
+
+/* Module declarations from 'cpython.pycapsule' */
+
+/* Module declarations from 'cpython' */
+
+/* Module declarations from 'zmq.backend.cython.libzmq' */
+
+/* Module declarations from 'zmq.backend.cython.checkrc' */
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int); /*proto*/
+
+/* Module declarations from 'zmq.devices.monitoredqueue' */
+static CYTHON_INLINE int __pyx_f_3zmq_7devices_14monitoredqueue__relay(void *, void *, void *, zmq_msg_t, zmq_msg_t, zmq_msg_t, int); /*proto*/
+static CYTHON_INLINE int __pyx_f_3zmq_7devices_14monitoredqueue_c_monitored_queue(void *, void *, void *, zmq_msg_t *, zmq_msg_t *, int); /*proto*/
+#define __Pyx_MODULE_NAME "zmq.devices.monitoredqueue"
+int __pyx_module_is_main_zmq__devices__monitoredqueue = 0;
+
+/* Implementation of 'zmq.devices.monitoredqueue' */
+static PyObject *__pyx_builtin_TypeError;
+static PyObject *__pyx_builtin_AttributeError;
+static PyObject *__pyx_builtin_NotImplementedError;
+static PyObject *__pyx_pf_3zmq_7devices_14monitoredqueue_monitored_queue(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_in_socket, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_out_socket, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_mon_socket, PyObject *__pyx_v_in_prefix, PyObject *__pyx_v_out_prefix); /* proto */
+static char __pyx_k_B[] = "B";
+static char __pyx_k__2[] = "";
+static char __pyx_k_in[] = "in";
+static char __pyx_k_rc[] = "rc";
+static char __pyx_k_all[] = "__all__";
+static char __pyx_k_ins[] = "ins";
+static char __pyx_k_out[] = "out";
+static char __pyx_k_zmq[] = "zmq";
+static char __pyx_k_char[] = "char";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_mons[] = "mons";
+static char __pyx_k_outs[] = "outs";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_type[] = "type";
+static char __pyx_k_Again[] = "Again";
+static char __pyx_k_ascii[] = "ascii";
+static char __pyx_k_dtype[] = "dtype";
+static char __pyx_k_msg_c[] = "msg_c";
+static char __pyx_k_ROUTER[] = "ROUTER";
+static char __pyx_k_decode[] = "decode";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_in_msg[] = "in_msg";
+static char __pyx_k_out_msg[] = "out_msg";
+static char __pyx_k_ZMQError[] = "ZMQError";
+static char __pyx_k_itemsize[] = "itemsize";
+static char __pyx_k_swap_ids[] = "swap_ids";
+static char __pyx_k_typecode[] = "typecode";
+static char __pyx_k_TypeError[] = "TypeError";
+static char __pyx_k_in_prefix[] = "in_prefix";
+static char __pyx_k_in_socket[] = "in_socket";
+static char __pyx_k_msg_c_len[] = "msg_c_len";
+static char __pyx_k_zmq_error[] = "zmq.error";
+static char __pyx_k_mon_socket[] = "mon_socket";
+static char __pyx_k_out_prefix[] = "out_prefix";
+static char __pyx_k_out_socket[] = "out_socket";
+static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static char __pyx_k_AttributeError[] = "AttributeError";
+static char __pyx_k_monitored_queue[] = "monitored_queue";
+static char __pyx_k_ContextTerminated[] = "ContextTerminated";
+static char __pyx_k_NotImplementedError[] = "NotImplementedError";
+static char __pyx_k_InterruptedSystemCall[] = "InterruptedSystemCall";
+static char __pyx_k_zmq_devices_monitoredqueue[] = "zmq.devices.monitoredqueue";
+static char __pyx_k_Old_style_buffers_not_available[] = "Old style buffers not available.";
+static char __pyx_k_private_tmp_pyzmq_release_zmq_d[] = "/private/tmp/pyzmq-release/zmq/devices/monitoredqueue.pyx";
+static char __pyx_k_r_does_not_provide_a_buffer_int[] = "%r does not provide a buffer interface.";
+static char __pyx_k_MonitoredQueue_classes_and_funct[] = "MonitoredQueue classes and functions.\n\nAuthors\n-------\n* MinRK\n* Brian Granger\n";
+static PyObject *__pyx_n_s_Again;
+static PyObject *__pyx_n_s_AttributeError;
+static PyObject *__pyx_n_b_B;
+static PyObject *__pyx_n_s_ContextTerminated;
+static PyObject *__pyx_n_s_InterruptedSystemCall;
+static PyObject *__pyx_n_s_NotImplementedError;
+static PyObject *__pyx_kp_s_Old_style_buffers_not_available;
+static PyObject *__pyx_n_s_ROUTER;
+static PyObject *__pyx_n_s_TypeError;
+static PyObject *__pyx_n_s_ZMQError;
+static PyObject *__pyx_kp_s__2;
+static PyObject *__pyx_n_s_all;
+static PyObject *__pyx_n_s_ascii;
+static PyObject *__pyx_n_s_char;
+static PyObject *__pyx_n_s_decode;
+static PyObject *__pyx_n_s_dtype;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_b_in;
+static PyObject *__pyx_n_s_in_msg;
+static PyObject *__pyx_n_s_in_prefix;
+static PyObject *__pyx_n_s_in_socket;
+static PyObject *__pyx_n_s_ins;
+static PyObject *__pyx_n_s_itemsize;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_mon_socket;
+static PyObject *__pyx_n_s_monitored_queue;
+static PyObject *__pyx_n_s_mons;
+static PyObject *__pyx_n_s_msg_c;
+static PyObject *__pyx_n_s_msg_c_len;
+static PyObject *__pyx_n_b_out;
+static PyObject *__pyx_n_s_out_msg;
+static PyObject *__pyx_n_s_out_prefix;
+static PyObject *__pyx_n_s_out_socket;
+static PyObject *__pyx_n_s_outs;
+static PyObject *__pyx_kp_s_private_tmp_pyzmq_release_zmq_d;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_kp_s_r_does_not_provide_a_buffer_int;
+static PyObject *__pyx_n_s_rc;
+static PyObject *__pyx_n_s_swap_ids;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_type;
+static PyObject *__pyx_n_s_typecode;
+static PyObject *__pyx_n_s_zmq;
+static PyObject *__pyx_n_s_zmq_devices_monitoredqueue;
+static PyObject *__pyx_n_s_zmq_error;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__4;
+static PyObject *__pyx_codeobj__5;
+
+/* "zmq/devices/monitoredqueue.pyx":41
+ *
+ *
+ * def monitored_queue(Socket in_socket, Socket out_socket, Socket mon_socket, # <<<<<<<<<<<<<<
+ * bytes in_prefix=b'in', bytes out_prefix=b'out'):
+ * """monitored_queue(in_socket, out_socket, mon_socket,
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_3zmq_7devices_14monitoredqueue_1monitored_queue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_3zmq_7devices_14monitoredqueue_monitored_queue[] = "monitored_queue(in_socket, out_socket, mon_socket,\n in_prefix=b'in', out_prefix=b'out')\n \n Start a monitored queue device.\n \n A monitored queue is very similar to the zmq.proxy device (monitored queue came first).\n \n Differences from zmq.proxy:\n \n - monitored_queue supports both in and out being ROUTER sockets\n (via swapping IDENTITY prefixes).\n - monitor messages are prefixed, making in and out messages distinguishable.\n \n Parameters\n ----------\n in_socket : Socket\n One of the sockets to the Queue. Its messages will be prefixed with\n 'in'.\n out_socket : Socket\n One of the sockets to the Queue. Its messages will be prefixed with\n 'out'. The only difference between in/out socket is this prefix.\n mon_socket : Socket\n This socket sends out every message received by each of the others\n with an in/out prefix specifying which one it was.\n in_prefix : str\n Prefix added to broadcast messages from in_socket.\n out_prefix : str\n Prefix added to broadcast messages from out_socket.\n ";
+static PyMethodDef __pyx_mdef_3zmq_7devices_14monitoredqueue_1monitored_queue = {"monitored_queue", (PyCFunction)__pyx_pw_3zmq_7devices_14monitoredqueue_1monitored_queue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3zmq_7devices_14monitoredqueue_monitored_queue};
+static PyObject *__pyx_pw_3zmq_7devices_14monitoredqueue_1monitored_queue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_in_socket = 0;
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_out_socket = 0;
+ struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_mon_socket = 0;
+ PyObject *__pyx_v_in_prefix = 0;
+ PyObject *__pyx_v_out_prefix = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("monitored_queue (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_in_socket,&__pyx_n_s_out_socket,&__pyx_n_s_mon_socket,&__pyx_n_s_in_prefix,&__pyx_n_s_out_prefix,0};
+ PyObject* values[5] = {0,0,0,0,0};
+ values[3] = ((PyObject*)__pyx_n_b_in);
+ values[4] = ((PyObject*)__pyx_n_b_out);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+ case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_socket)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out_socket)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("monitored_queue", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mon_socket)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("monitored_queue", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ case 3:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_in_prefix);
+ if (value) { values[3] = value; kw_args--; }
+ }
+ case 4:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out_prefix);
+ if (value) { values[4] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "monitored_queue") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+ case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_in_socket = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)values[0]);
+ __pyx_v_out_socket = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)values[1]);
+ __pyx_v_mon_socket = ((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)values[2]);
+ __pyx_v_in_prefix = ((PyObject*)values[3]);
+ __pyx_v_out_prefix = ((PyObject*)values[4]);
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("monitored_queue", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("zmq.devices.monitoredqueue.monitored_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_socket), __pyx_ptype_3zmq_7backend_6cython_6socket_Socket, 1, "in_socket", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_socket), __pyx_ptype_3zmq_7backend_6cython_6socket_Socket, 1, "out_socket", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mon_socket), __pyx_ptype_3zmq_7backend_6cython_6socket_Socket, 1, "mon_socket", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_prefix), (&PyBytes_Type), 1, "in_prefix", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out_prefix), (&PyBytes_Type), 1, "out_prefix", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = __pyx_pf_3zmq_7devices_14monitoredqueue_monitored_queue(__pyx_self, __pyx_v_in_socket, __pyx_v_out_socket, __pyx_v_mon_socket, __pyx_v_in_prefix, __pyx_v_out_prefix);
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_3zmq_7devices_14monitoredqueue_monitored_queue(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_in_socket, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_out_socket, struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_mon_socket, PyObject *__pyx_v_in_prefix, PyObject *__pyx_v_out_prefix) {
+ void *__pyx_v_ins;
+ void *__pyx_v_outs;
+ void *__pyx_v_mons;
+ zmq_msg_t __pyx_v_in_msg;
+ zmq_msg_t __pyx_v_out_msg;
+ int __pyx_v_swap_ids;
+ char *__pyx_v_msg_c;
+ Py_ssize_t __pyx_v_msg_c_len;
+ int __pyx_v_rc;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ void *__pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("monitored_queue", 0);
+
+ /* "zmq/devices/monitoredqueue.pyx":73
+ * """
+ *
+ * cdef void *ins=in_socket.handle # <<<<<<<<<<<<<<
+ * cdef void *outs=out_socket.handle
+ * cdef void *mons=mon_socket.handle
+ */
+ __pyx_t_1 = __pyx_v_in_socket->handle;
+ __pyx_v_ins = __pyx_t_1;
+
+ /* "zmq/devices/monitoredqueue.pyx":74
+ *
+ * cdef void *ins=in_socket.handle
+ * cdef void *outs=out_socket.handle # <<<<<<<<<<<<<<
+ * cdef void *mons=mon_socket.handle
+ * cdef zmq_msg_t in_msg
+ */
+ __pyx_t_1 = __pyx_v_out_socket->handle;
+ __pyx_v_outs = __pyx_t_1;
+
+ /* "zmq/devices/monitoredqueue.pyx":75
+ * cdef void *ins=in_socket.handle
+ * cdef void *outs=out_socket.handle
+ * cdef void *mons=mon_socket.handle # <<<<<<<<<<<<<<
+ * cdef zmq_msg_t in_msg
+ * cdef zmq_msg_t out_msg
+ */
+ __pyx_t_1 = __pyx_v_mon_socket->handle;
+ __pyx_v_mons = __pyx_t_1;
+
+ /* "zmq/devices/monitoredqueue.pyx":79
+ * cdef zmq_msg_t out_msg
+ * cdef bint swap_ids
+ * cdef char *msg_c = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t msg_c_len
+ * cdef int rc
+ */
+ __pyx_v_msg_c = NULL;
+
+ /* "zmq/devices/monitoredqueue.pyx":84
+ *
+ * # force swap_ids if both ROUTERs
+ * swap_ids = (in_socket.type == ROUTER and out_socket.type == ROUTER) # <<<<<<<<<<<<<<
+ *
+ * # build zmq_msg objects from str prefixes
+ */
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_in_socket), __pyx_n_s_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ROUTER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_6) {
+ } else {
+ __pyx_t_2 = __pyx_t_6;
+ goto __pyx_L3_bool_binop_done;
+ }
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_out_socket), __pyx_n_s_type); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ROUTER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_t_6;
+ __pyx_L3_bool_binop_done:;
+ __pyx_v_swap_ids = __pyx_t_2;
+
+ /* "zmq/devices/monitoredqueue.pyx":87
+ *
+ * # build zmq_msg objects from str prefixes
+ * asbuffer_r(in_prefix, <void **>&msg_c, &msg_c_len) # <<<<<<<<<<<<<<
+ * rc = zmq_msg_init_size(&in_msg, msg_c_len)
+ * _check_rc(rc)
+ */
+ __pyx_t_3 = __pyx_f_7buffers_asbuffer_r(__pyx_v_in_prefix, ((void **)(&__pyx_v_msg_c)), (&__pyx_v_msg_c_len)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "zmq/devices/monitoredqueue.pyx":88
+ * # build zmq_msg objects from str prefixes
+ * asbuffer_r(in_prefix, <void **>&msg_c, &msg_c_len)
+ * rc = zmq_msg_init_size(&in_msg, msg_c_len) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_msg_init_size((&__pyx_v_in_msg), __pyx_v_msg_c_len);
+
+ /* "zmq/devices/monitoredqueue.pyx":89
+ * asbuffer_r(in_prefix, <void **>&msg_c, &msg_c_len)
+ * rc = zmq_msg_init_size(&in_msg, msg_c_len)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * memcpy(zmq_msg_data(&in_msg), msg_c, zmq_msg_size(&in_msg))
+ */
+ __pyx_t_7 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/devices/monitoredqueue.pyx":91
+ * _check_rc(rc)
+ *
+ * memcpy(zmq_msg_data(&in_msg), msg_c, zmq_msg_size(&in_msg)) # <<<<<<<<<<<<<<
+ *
+ * asbuffer_r(out_prefix, <void **>&msg_c, &msg_c_len)
+ */
+ memcpy(zmq_msg_data((&__pyx_v_in_msg)), __pyx_v_msg_c, zmq_msg_size((&__pyx_v_in_msg)));
+
+ /* "zmq/devices/monitoredqueue.pyx":93
+ * memcpy(zmq_msg_data(&in_msg), msg_c, zmq_msg_size(&in_msg))
+ *
+ * asbuffer_r(out_prefix, <void **>&msg_c, &msg_c_len) # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_msg_init_size(&out_msg, msg_c_len)
+ */
+ __pyx_t_3 = __pyx_f_7buffers_asbuffer_r(__pyx_v_out_prefix, ((void **)(&__pyx_v_msg_c)), (&__pyx_v_msg_c_len)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "zmq/devices/monitoredqueue.pyx":95
+ * asbuffer_r(out_prefix, <void **>&msg_c, &msg_c_len)
+ *
+ * rc = zmq_msg_init_size(&out_msg, msg_c_len) # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ *
+ */
+ __pyx_v_rc = zmq_msg_init_size((&__pyx_v_out_msg), __pyx_v_msg_c_len);
+
+ /* "zmq/devices/monitoredqueue.pyx":96
+ *
+ * rc = zmq_msg_init_size(&out_msg, msg_c_len)
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ *
+ * while True:
+ */
+ __pyx_t_7 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/devices/monitoredqueue.pyx":98
+ * _check_rc(rc)
+ *
+ * while True: # <<<<<<<<<<<<<<
+ * with nogil:
+ * memcpy(zmq_msg_data(&out_msg), msg_c, zmq_msg_size(&out_msg))
+ */
+ while (1) {
+
+ /* "zmq/devices/monitoredqueue.pyx":99
+ *
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * memcpy(zmq_msg_data(&out_msg), msg_c, zmq_msg_size(&out_msg))
+ * rc = c_monitored_queue(ins, outs, mons, &in_msg, &out_msg, swap_ids)
+ */
+ {
+ #ifdef WITH_THREAD
+ PyThreadState *_save;
+ Py_UNBLOCK_THREADS
+ #endif
+ /*try:*/ {
+
+ /* "zmq/devices/monitoredqueue.pyx":100
+ * while True:
+ * with nogil:
+ * memcpy(zmq_msg_data(&out_msg), msg_c, zmq_msg_size(&out_msg)) # <<<<<<<<<<<<<<
+ * rc = c_monitored_queue(ins, outs, mons, &in_msg, &out_msg, swap_ids)
+ * try:
+ */
+ memcpy(zmq_msg_data((&__pyx_v_out_msg)), __pyx_v_msg_c, zmq_msg_size((&__pyx_v_out_msg)));
+
+ /* "zmq/devices/monitoredqueue.pyx":101
+ * with nogil:
+ * memcpy(zmq_msg_data(&out_msg), msg_c, zmq_msg_size(&out_msg))
+ * rc = c_monitored_queue(ins, outs, mons, &in_msg, &out_msg, swap_ids) # <<<<<<<<<<<<<<
+ * try:
+ * _check_rc(rc)
+ */
+ __pyx_v_rc = __pyx_f_3zmq_7devices_14monitoredqueue_c_monitored_queue(__pyx_v_ins, __pyx_v_outs, __pyx_v_mons, (&__pyx_v_in_msg), (&__pyx_v_out_msg), __pyx_v_swap_ids);
+ }
+
+ /* "zmq/devices/monitoredqueue.pyx":99
+ *
+ * while True:
+ * with nogil: # <<<<<<<<<<<<<<
+ * memcpy(zmq_msg_data(&out_msg), msg_c, zmq_msg_size(&out_msg))
+ * rc = c_monitored_queue(ins, outs, mons, &in_msg, &out_msg, swap_ids)
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ #ifdef WITH_THREAD
+ Py_BLOCK_THREADS
+ #endif
+ goto __pyx_L11;
+ }
+ __pyx_L11:;
+ }
+ }
+
+ /* "zmq/devices/monitoredqueue.pyx":102
+ * memcpy(zmq_msg_data(&out_msg), msg_c, zmq_msg_size(&out_msg))
+ * rc = c_monitored_queue(ins, outs, mons, &in_msg, &out_msg, swap_ids)
+ * try: # <<<<<<<<<<<<<<
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ /*try:*/ {
+
+ /* "zmq/devices/monitoredqueue.pyx":103
+ * rc = c_monitored_queue(ins, outs, mons, &in_msg, &out_msg, swap_ids)
+ * try:
+ * _check_rc(rc) # <<<<<<<<<<<<<<
+ * except InterruptedSystemCall:
+ * continue
+ */
+ __pyx_t_7 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
+ }
+ /*else:*/ {
+
+ /* "zmq/devices/monitoredqueue.pyx":107
+ * continue
+ * else:
+ * break # <<<<<<<<<<<<<<
+ * return rc
+ *
+ */
+ goto __pyx_L17_try_break;
+ }
+ __pyx_L12_error:;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "zmq/devices/monitoredqueue.pyx":104
+ * try:
+ * _check_rc(rc)
+ * except InterruptedSystemCall: # <<<<<<<<<<<<<<
+ * continue
+ * else:
+ */
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = PyErr_ExceptionMatches(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_7) {
+ __Pyx_AddTraceback("zmq.devices.monitoredqueue.monitored_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_5);
+
+ /* "zmq/devices/monitoredqueue.pyx":105
+ * _check_rc(rc)
+ * except InterruptedSystemCall:
+ * continue # <<<<<<<<<<<<<<
+ * else:
+ * break
+ */
+ goto __pyx_L21_except_continue;
+ __pyx_L21_except_continue:;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L18_try_continue;
+ }
+ goto __pyx_L14_except_error;
+ __pyx_L14_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ goto __pyx_L1_error;
+ __pyx_L17_try_break:;
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ goto __pyx_L6_break;
+ __pyx_L18_try_continue:;
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ goto __pyx_L5_continue;
+ }
+ __pyx_L5_continue:;
+ }
+ __pyx_L6_break:;
+
+ /* "zmq/devices/monitoredqueue.pyx":108
+ * else:
+ * break
+ * return rc # <<<<<<<<<<<<<<
+ *
+ * __all__ = ['monitored_queue']
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ goto __pyx_L0;
+
+ /* "zmq/devices/monitoredqueue.pyx":41
+ *
+ *
+ * def monitored_queue(Socket in_socket, Socket out_socket, Socket mon_socket, # <<<<<<<<<<<<<<
+ * bytes in_prefix=b'in', bytes out_prefix=b'out'):
+ * """monitored_queue(in_socket, out_socket, mon_socket,
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("zmq.devices.monitoredqueue.monitored_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int __pyx_v_rc) {
+ int __pyx_v_errno;
+ PyObject *__pyx_v_InterruptedSystemCall = NULL;
+ PyObject *__pyx_v_Again = NULL;
+ PyObject *__pyx_v_ContextTerminated = NULL;
+ PyObject *__pyx_v_ZMQError = NULL;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_check_rc", 0);
+
+ /* "zmq/backend/cython/checkrc.pxd":11
+ * and raising the appropriate Exception class
+ * """
+ * cdef int errno = zmq_errno() # <<<<<<<<<<<<<<
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ */
+ __pyx_v_errno = zmq_errno();
+
+ /* "zmq/backend/cython/checkrc.pxd":12
+ * """
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals() # <<<<<<<<<<<<<<
+ * if rc < 0:
+ * if errno == EINTR:
+ */
+ __pyx_t_1 = PyErr_CheckSignals(); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "zmq/backend/cython/checkrc.pxd":13
+ * cdef int errno = zmq_errno()
+ * PyErr_CheckSignals()
+ * if rc < 0: # <<<<<<<<<<<<<<
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ */
+ __pyx_t_2 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_2) {
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ switch (__pyx_v_errno) {
+
+ /* "zmq/backend/cython/checkrc.pxd":14
+ * PyErr_CheckSignals()
+ * if rc < 0:
+ * if errno == EINTR: # <<<<<<<<<<<<<<
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ */
+ case EINTR:
+
+ /* "zmq/backend/cython/checkrc.pxd":15
+ * if rc < 0:
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ */
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_4 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_InterruptedSystemCall = __pyx_t_3;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":16
+ * if errno == EINTR:
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno) # <<<<<<<<<<<<<<
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ */
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_InterruptedSystemCall);
+ __pyx_t_5 = __pyx_v_InterruptedSystemCall; __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":17
+ * from zmq.error import InterruptedSystemCall
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN: # <<<<<<<<<<<<<<
+ * from zmq.error import Again
+ * raise Again(errno)
+ */
+ case EAGAIN:
+
+ /* "zmq/backend/cython/checkrc.pxd":18
+ * raise InterruptedSystemCall(errno)
+ * elif errno == EAGAIN:
+ * from zmq.error import Again # <<<<<<<<<<<<<<
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ */
+ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_Again);
+ PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Again);
+ __Pyx_GIVEREF(__pyx_n_s_Again);
+ __pyx_t_5 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Again); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v_Again = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":19
+ * elif errno == EAGAIN:
+ * from zmq.error import Again
+ * raise Again(errno) # <<<<<<<<<<<<<<
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ */
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_Again);
+ __pyx_t_7 = __pyx_v_Again; __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+
+ /* "zmq/backend/cython/checkrc.pxd":20
+ * from zmq.error import Again
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM: # <<<<<<<<<<<<<<
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno)
+ */
+ case ETERM:
+
+ /* "zmq/backend/cython/checkrc.pxd":21
+ * raise Again(errno)
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated # <<<<<<<<<<<<<<
+ * raise ContextTerminated(errno)
+ * else:
+ */
+ __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_ContextTerminated);
+ PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_ContextTerminated);
+ __Pyx_GIVEREF(__pyx_n_s_ContextTerminated);
+ __pyx_t_7 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_5, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_ContextTerminated); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_v_ContextTerminated = __pyx_t_5;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":22
+ * elif errno == ZMQ_ETERM:
+ * from zmq.error import ContextTerminated
+ * raise ContextTerminated(errno) # <<<<<<<<<<<<<<
+ * else:
+ * from zmq.error import ZMQError
+ */
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_v_ContextTerminated);
+ __pyx_t_6 = __pyx_v_ContextTerminated; __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_t_7, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ default:
+
+ /* "zmq/backend/cython/checkrc.pxd":24
+ * raise ContextTerminated(errno)
+ * else:
+ * from zmq.error import ZMQError # <<<<<<<<<<<<<<
+ * raise ZMQError(errno)
+ * return 0
+ */
+ __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __pyx_t_6 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_7, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_7);
+ __pyx_v_ZMQError = __pyx_t_7;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "zmq/backend/cython/checkrc.pxd":25
+ * else:
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno) # <<<<<<<<<<<<<<
+ * return 0
+ */
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_errno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_v_ZMQError);
+ __pyx_t_3 = __pyx_v_ZMQError; __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_6);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ break;
+ }
+ }
+
+ /* "zmq/backend/cython/checkrc.pxd":26
+ * from zmq.error import ZMQError
+ * raise ZMQError(errno)
+ * return 0 # <<<<<<<<<<<<<<
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "zmq/backend/cython/checkrc.pxd":6
+ *
+ *
+ * cdef inline int _check_rc(int rc) except -1: # <<<<<<<<<<<<<<
+ * """internal utility for checking zmq return condition
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("zmq.backend.cython.checkrc._check_rc", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_InterruptedSystemCall);
+ __Pyx_XDECREF(__pyx_v_Again);
+ __Pyx_XDECREF(__pyx_v_ContextTerminated);
+ __Pyx_XDECREF(__pyx_v_ZMQError);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":88
+ *
+ *
+ * cdef inline int memoryview_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ __Pyx_RefNannySetupContext("memoryview_available", 0);
+
+ /* "buffers.pxd":89
+ *
+ * cdef inline int memoryview_available():
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7) # <<<<<<<<<<<<<<
+ *
+ * cdef inline int oldstyle_available():
+ */
+ __pyx_t_2 = (PY_MAJOR_VERSION >= 3);
+ if (!__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L3_bool_binop_done;
+ }
+ __pyx_t_2 = (PY_MAJOR_VERSION >= 2);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L3_bool_binop_done;
+ }
+ __pyx_t_2 = (PY_MINOR_VERSION >= 7);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L3_bool_binop_done:;
+ __pyx_r = __pyx_t_1;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":88
+ *
+ *
+ * cdef inline int memoryview_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":91
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ * cdef inline int oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION < 3
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("oldstyle_available", 0);
+
+ /* "buffers.pxd":92
+ *
+ * cdef inline int oldstyle_available():
+ * return PY_MAJOR_VERSION < 3 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = (PY_MAJOR_VERSION < 3);
+ goto __pyx_L0;
+
+ /* "buffers.pxd":91
+ * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
+ *
+ * cdef inline int oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PY_MAJOR_VERSION < 3
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":95
+ *
+ *
+ * cdef inline int check_buffer(object ob): # <<<<<<<<<<<<<<
+ * """Version independent check for whether an object is a buffer.
+ *
+ */
+
+static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *__pyx_v_ob) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ __Pyx_RefNannySetupContext("check_buffer", 0);
+
+ /* "buffers.pxd":107
+ * int : 0 if no buffer interface, 3 if newstyle buffer interface, 2 if oldstyle.
+ * """
+ * if PyObject_CheckBuffer(ob): # <<<<<<<<<<<<<<
+ * return 3
+ * if oldstyle_available():
+ */
+ __pyx_t_1 = (PyObject_CheckBuffer(__pyx_v_ob) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":108
+ * """
+ * if PyObject_CheckBuffer(ob):
+ * return 3 # <<<<<<<<<<<<<<
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2
+ */
+ __pyx_r = 3;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":109
+ * if PyObject_CheckBuffer(ob):
+ * return 3
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * return PyObject_CheckReadBuffer(ob) and 2
+ * return 0
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":110
+ * return 3
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2 # <<<<<<<<<<<<<<
+ * return 0
+ *
+ */
+ __pyx_t_3 = PyObject_CheckReadBuffer(__pyx_v_ob);
+ if (__pyx_t_3) {
+ } else {
+ __pyx_t_2 = __pyx_t_3;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_2 = 2;
+ __pyx_L5_bool_binop_done:;
+ __pyx_r = __pyx_t_2;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":111
+ * if oldstyle_available():
+ * return PyObject_CheckReadBuffer(ob) and 2
+ * return 0 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":95
+ *
+ *
+ * cdef inline int check_buffer(object ob): # <<<<<<<<<<<<<<
+ * """Version independent check for whether an object is a buffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":114
+ *
+ *
+ * cdef inline object asbuffer(object ob, int writable, int format, # <<<<<<<<<<<<<<
+ * void **base, Py_ssize_t *size,
+ * Py_ssize_t *itemsize):
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *__pyx_v_ob, int __pyx_v_writable, int __pyx_v_format, void **__pyx_v_base, Py_ssize_t *__pyx_v_size, Py_ssize_t *__pyx_v_itemsize) {
+ void *__pyx_v_bptr;
+ Py_ssize_t __pyx_v_blen;
+ Py_ssize_t __pyx_v_bitemlen;
+ Py_buffer __pyx_v_view;
+ int __pyx_v_flags;
+ int __pyx_v_mode;
+ PyObject *__pyx_v_bfmt = NULL;
+ PyObject *__pyx_v_dtype = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ void *__pyx_t_5;
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ int __pyx_t_17;
+ int __pyx_t_18;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer", 0);
+
+ /* "buffers.pxd":141
+ * """
+ *
+ * cdef void *bptr = NULL # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t blen = 0, bitemlen = 0
+ * cdef Py_buffer view
+ */
+ __pyx_v_bptr = NULL;
+
+ /* "buffers.pxd":142
+ *
+ * cdef void *bptr = NULL
+ * cdef Py_ssize_t blen = 0, bitemlen = 0 # <<<<<<<<<<<<<<
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE
+ */
+ __pyx_v_blen = 0;
+ __pyx_v_bitemlen = 0;
+
+ /* "buffers.pxd":144
+ * cdef Py_ssize_t blen = 0, bitemlen = 0
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE # <<<<<<<<<<<<<<
+ * cdef int mode = 0
+ *
+ */
+ __pyx_v_flags = PyBUF_SIMPLE;
+
+ /* "buffers.pxd":145
+ * cdef Py_buffer view
+ * cdef int flags = PyBUF_SIMPLE
+ * cdef int mode = 0 # <<<<<<<<<<<<<<
+ *
+ * bfmt = None
+ */
+ __pyx_v_mode = 0;
+
+ /* "buffers.pxd":147
+ * cdef int mode = 0
+ *
+ * bfmt = None # <<<<<<<<<<<<<<
+ *
+ * mode = check_buffer(ob)
+ */
+ __Pyx_INCREF(Py_None);
+ __pyx_v_bfmt = Py_None;
+
+ /* "buffers.pxd":149
+ * bfmt = None
+ *
+ * mode = check_buffer(ob) # <<<<<<<<<<<<<<
+ * if mode == 0:
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ */
+ __pyx_v_mode = __pyx_f_7buffers_check_buffer(__pyx_v_ob);
+
+ /* "buffers.pxd":150
+ *
+ * mode = check_buffer(ob)
+ * if mode == 0: # <<<<<<<<<<<<<<
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_mode == 0) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":151
+ * mode = check_buffer(ob)
+ * if mode == 0:
+ * raise TypeError("%r does not provide a buffer interface."%ob) # <<<<<<<<<<<<<<
+ *
+ * if mode == 3:
+ */
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_r_does_not_provide_a_buffer_int, __pyx_v_ob); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "buffers.pxd":153
+ * raise TypeError("%r does not provide a buffer interface."%ob)
+ *
+ * if mode == 3: # <<<<<<<<<<<<<<
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable:
+ */
+ __pyx_t_1 = ((__pyx_v_mode == 3) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":154
+ *
+ * if mode == 3:
+ * flags = PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
+ * if writable:
+ * flags |= PyBUF_WRITABLE
+ */
+ __pyx_v_flags = PyBUF_ANY_CONTIGUOUS;
+
+ /* "buffers.pxd":155
+ * if mode == 3:
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable: # <<<<<<<<<<<<<<
+ * flags |= PyBUF_WRITABLE
+ * if format:
+ */
+ __pyx_t_1 = (__pyx_v_writable != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":156
+ * flags = PyBUF_ANY_CONTIGUOUS
+ * if writable:
+ * flags |= PyBUF_WRITABLE # <<<<<<<<<<<<<<
+ * if format:
+ * flags |= PyBUF_FORMAT
+ */
+ __pyx_v_flags = (__pyx_v_flags | PyBUF_WRITABLE);
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "buffers.pxd":157
+ * if writable:
+ * flags |= PyBUF_WRITABLE
+ * if format: # <<<<<<<<<<<<<<
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags)
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":158
+ * flags |= PyBUF_WRITABLE
+ * if format:
+ * flags |= PyBUF_FORMAT # <<<<<<<<<<<<<<
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf
+ */
+ __pyx_v_flags = (__pyx_v_flags | PyBUF_FORMAT);
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "buffers.pxd":159
+ * if format:
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags) # <<<<<<<<<<<<<<
+ * bptr = view.buf
+ * blen = view.len
+ */
+ __pyx_t_4 = PyObject_GetBuffer(__pyx_v_ob, (&__pyx_v_view), __pyx_v_flags); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "buffers.pxd":160
+ * flags |= PyBUF_FORMAT
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf # <<<<<<<<<<<<<<
+ * blen = view.len
+ * if format:
+ */
+ __pyx_t_5 = __pyx_v_view.buf;
+ __pyx_v_bptr = __pyx_t_5;
+
+ /* "buffers.pxd":161
+ * PyObject_GetBuffer(ob, &view, flags)
+ * bptr = view.buf
+ * blen = view.len # <<<<<<<<<<<<<<
+ * if format:
+ * if view.format != NULL:
+ */
+ __pyx_t_6 = __pyx_v_view.len;
+ __pyx_v_blen = __pyx_t_6;
+
+ /* "buffers.pxd":162
+ * bptr = view.buf
+ * blen = view.len
+ * if format: # <<<<<<<<<<<<<<
+ * if view.format != NULL:
+ * bfmt = view.format
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":163
+ * blen = view.len
+ * if format:
+ * if view.format != NULL: # <<<<<<<<<<<<<<
+ * bfmt = view.format
+ * bitemlen = view.itemsize
+ */
+ __pyx_t_1 = ((__pyx_v_view.format != NULL) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":164
+ * if format:
+ * if view.format != NULL:
+ * bfmt = view.format # <<<<<<<<<<<<<<
+ * bitemlen = view.itemsize
+ * PyBuffer_Release(&view)
+ */
+ __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_view.format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":165
+ * if view.format != NULL:
+ * bfmt = view.format
+ * bitemlen = view.itemsize # <<<<<<<<<<<<<<
+ * PyBuffer_Release(&view)
+ * else: # oldstyle
+ */
+ __pyx_t_6 = __pyx_v_view.itemsize;
+ __pyx_v_bitemlen = __pyx_t_6;
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "buffers.pxd":166
+ * bfmt = view.format
+ * bitemlen = view.itemsize
+ * PyBuffer_Release(&view) # <<<<<<<<<<<<<<
+ * else: # oldstyle
+ * if writable:
+ */
+ PyBuffer_Release((&__pyx_v_view));
+ goto __pyx_L4;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":168
+ * PyBuffer_Release(&view)
+ * else: # oldstyle
+ * if writable: # <<<<<<<<<<<<<<
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_writable != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":169
+ * else: # oldstyle
+ * if writable:
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen) # <<<<<<<<<<<<<<
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ */
+ __pyx_t_4 = PyObject_AsWriteBuffer(__pyx_v_ob, (&__pyx_v_bptr), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L9;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":171
+ * PyObject_AsWriteBuffer(ob, &bptr, &blen)
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen) # <<<<<<<<<<<<<<
+ * if format:
+ * try: # numpy.ndarray
+ */
+ __pyx_t_4 = PyObject_AsReadBuffer(__pyx_v_ob, ((const void **)(&__pyx_v_bptr)), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_L9:;
+
+ /* "buffers.pxd":172
+ * else:
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ * if format: # <<<<<<<<<<<<<<
+ * try: # numpy.ndarray
+ * dtype = ob.dtype
+ */
+ __pyx_t_1 = (__pyx_v_format != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":173
+ * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
+ * if format:
+ * try: # numpy.ndarray # <<<<<<<<<<<<<<
+ * dtype = ob.dtype
+ * bfmt = dtype.char
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ /*try:*/ {
+
+ /* "buffers.pxd":174
+ * if format:
+ * try: # numpy.ndarray
+ * dtype = ob.dtype # <<<<<<<<<<<<<<
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v_dtype = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":175
+ * try: # numpy.ndarray
+ * dtype = ob.dtype
+ * bfmt = dtype.char # <<<<<<<<<<<<<<
+ * bitemlen = dtype.itemsize
+ * except AttributeError:
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_char); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "buffers.pxd":176
+ * dtype = ob.dtype
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize # <<<<<<<<<<<<<<
+ * except AttributeError:
+ * try: # array.array
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_bitemlen = __pyx_t_6;
+ }
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L18_try_end;
+ __pyx_L11_error:;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "buffers.pxd":177
+ * bfmt = dtype.char
+ * bitemlen = dtype.itemsize
+ * except AttributeError: # <<<<<<<<<<<<<<
+ * try: # array.array
+ * bfmt = ob.typecode
+ */
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_10);
+
+ /* "buffers.pxd":178
+ * bitemlen = dtype.itemsize
+ * except AttributeError:
+ * try: # array.array # <<<<<<<<<<<<<<
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize
+ */
+ {
+ __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ /*try:*/ {
+
+ /* "buffers.pxd":179
+ * except AttributeError:
+ * try: # array.array
+ * bfmt = ob.typecode # <<<<<<<<<<<<<<
+ * bitemlen = ob.itemsize
+ * except AttributeError:
+ */
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_typecode); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_t_14);
+ __pyx_t_14 = 0;
+
+ /* "buffers.pxd":180
+ * try: # array.array
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize # <<<<<<<<<<<<<<
+ * except AttributeError:
+ * if isinstance(ob, bytes):
+ */
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_ob, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_14); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_v_bitemlen = __pyx_t_6;
+ }
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ goto __pyx_L28_try_end;
+ __pyx_L21_error:;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "buffers.pxd":181
+ * bfmt = ob.typecode
+ * bitemlen = ob.itemsize
+ * except AttributeError: # <<<<<<<<<<<<<<
+ * if isinstance(ob, bytes):
+ * bfmt = b"B"
+ */
+ __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
+ if (__pyx_t_4) {
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_16);
+
+ /* "buffers.pxd":182
+ * bitemlen = ob.itemsize
+ * except AttributeError:
+ * if isinstance(ob, bytes): # <<<<<<<<<<<<<<
+ * bfmt = b"B"
+ * bitemlen = 1
+ */
+ __pyx_t_1 = PyBytes_Check(__pyx_v_ob);
+ __pyx_t_17 = (__pyx_t_1 != 0);
+ if (__pyx_t_17) {
+
+ /* "buffers.pxd":183
+ * except AttributeError:
+ * if isinstance(ob, bytes):
+ * bfmt = b"B" # <<<<<<<<<<<<<<
+ * bitemlen = 1
+ * else:
+ */
+ __Pyx_INCREF(__pyx_n_b_B);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, __pyx_n_b_B);
+
+ /* "buffers.pxd":184
+ * if isinstance(ob, bytes):
+ * bfmt = b"B"
+ * bitemlen = 1 # <<<<<<<<<<<<<<
+ * else:
+ * # nothing found
+ */
+ __pyx_v_bitemlen = 1;
+ goto __pyx_L31;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":187
+ * else:
+ * # nothing found
+ * bfmt = None # <<<<<<<<<<<<<<
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_DECREF_SET(__pyx_v_bfmt, Py_None);
+
+ /* "buffers.pxd":188
+ * # nothing found
+ * bfmt = None
+ * bitemlen = 0 # <<<<<<<<<<<<<<
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen
+ */
+ __pyx_v_bitemlen = 0;
+ }
+ __pyx_L31:;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ goto __pyx_L22_exception_handled;
+ }
+ goto __pyx_L23_except_error;
+ __pyx_L23_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ goto __pyx_L13_except_error;
+ __pyx_L22_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ __pyx_L28_try_end:;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ goto __pyx_L12_exception_handled;
+ }
+ goto __pyx_L13_except_error;
+ __pyx_L13_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ goto __pyx_L1_error;
+ __pyx_L12_exception_handled:;
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ __pyx_L18_try_end:;
+ }
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+ }
+ __pyx_L4:;
+
+ /* "buffers.pxd":189
+ * bfmt = None
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr # <<<<<<<<<<<<<<
+ * if size: size[0] = <Py_ssize_t>blen
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ */
+ __pyx_t_17 = (__pyx_v_base != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_base[0]) = ((void *)__pyx_v_bptr);
+ goto __pyx_L32;
+ }
+ __pyx_L32:;
+
+ /* "buffers.pxd":190
+ * bitemlen = 0
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen # <<<<<<<<<<<<<<
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ *
+ */
+ __pyx_t_17 = (__pyx_v_size != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_size[0]) = ((Py_ssize_t)__pyx_v_blen);
+ goto __pyx_L33;
+ }
+ __pyx_L33:;
+
+ /* "buffers.pxd":191
+ * if base: base[0] = <void *>bptr
+ * if size: size[0] = <Py_ssize_t>blen
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen # <<<<<<<<<<<<<<
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ */
+ __pyx_t_17 = (__pyx_v_itemsize != 0);
+ if (__pyx_t_17) {
+ (__pyx_v_itemsize[0]) = ((Py_ssize_t)__pyx_v_bitemlen);
+ goto __pyx_L34;
+ }
+ __pyx_L34:;
+
+ /* "buffers.pxd":193
+ * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None: # <<<<<<<<<<<<<<
+ * return bfmt.decode('ascii')
+ * return bfmt
+ */
+ __pyx_t_1 = ((PY_MAJOR_VERSION >= 3) != 0);
+ if (__pyx_t_1) {
+ } else {
+ __pyx_t_17 = __pyx_t_1;
+ goto __pyx_L36_bool_binop_done;
+ }
+ __pyx_t_1 = (__pyx_v_bfmt != Py_None);
+ __pyx_t_18 = (__pyx_t_1 != 0);
+ __pyx_t_17 = __pyx_t_18;
+ __pyx_L36_bool_binop_done:;
+ if (__pyx_t_17) {
+
+ /* "buffers.pxd":194
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii') # <<<<<<<<<<<<<<
+ * return bfmt
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bfmt, __pyx_n_s_decode); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":195
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii')
+ * return bfmt # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_bfmt);
+ __pyx_r = __pyx_v_bfmt;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":114
+ *
+ *
+ * cdef inline object asbuffer(object ob, int writable, int format, # <<<<<<<<<<<<<<
+ * void **base, Py_ssize_t *size,
+ * Py_ssize_t *itemsize):
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_14);
+ __Pyx_XDECREF(__pyx_t_15);
+ __Pyx_XDECREF(__pyx_t_16);
+ __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_bfmt);
+ __Pyx_XDECREF(__pyx_v_dtype);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":198
+ *
+ *
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer_r", 0);
+
+ /* "buffers.pxd":200
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size):
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL) # <<<<<<<<<<<<<<
+ * return ob
+ *
+ */
+ __pyx_t_1 = __pyx_f_7buffers_asbuffer(__pyx_v_ob, 0, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "buffers.pxd":201
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ * return ob # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ob);
+ __pyx_r = __pyx_v_ob;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":198
+ *
+ *
+ * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a readonly buffer."""
+ * asbuffer(ob, 0, 0, base, size, NULL)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.asbuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":204
+ *
+ *
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_w(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("asbuffer_w", 0);
+
+ /* "buffers.pxd":206
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size):
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL) # <<<<<<<<<<<<<<
+ * return ob
+ *
+ */
+ __pyx_t_1 = __pyx_f_7buffers_asbuffer(__pyx_v_ob, 1, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "buffers.pxd":207
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ * return ob # <<<<<<<<<<<<<<
+ *
+ * #------------------------------------------------------------------------------
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ob);
+ __pyx_r = __pyx_v_ob;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":204
+ *
+ *
+ * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
+ * """Wrapper for standard calls to asbuffer with a writable buffer."""
+ * asbuffer(ob, 1, 0, base, size, NULL)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.asbuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":214
+ *
+ *
+ * cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 3 version of frombuffer.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ Py_buffer __pyx_v_pybuf;
+ Py_ssize_t *__pyx_v_shape;
+ PyObject *__pyx_v_astr = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ Py_ssize_t __pyx_t_1[1];
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_3", 0);
+
+ /* "buffers.pxd":221
+ * """
+ * cdef Py_buffer pybuf
+ * cdef Py_ssize_t *shape = [s] # <<<<<<<<<<<<<<
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ */
+ __pyx_t_1[0] = __pyx_v_s;
+ __pyx_v_shape = __pyx_t_1;
+
+ /* "buffers.pxd":222
+ * cdef Py_buffer pybuf
+ * cdef Py_ssize_t *shape = [s]
+ * cdef str astr="" # <<<<<<<<<<<<<<
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B"
+ */
+ __Pyx_INCREF(__pyx_kp_s__2);
+ __pyx_v_astr = __pyx_kp_s__2;
+
+ /* "buffers.pxd":223
+ * cdef Py_ssize_t *shape = [s]
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE) # <<<<<<<<<<<<<<
+ * pybuf.format = "B"
+ * pybuf.shape = shape
+ */
+ __pyx_t_2 = PyBuffer_FillInfo((&__pyx_v_pybuf), __pyx_v_astr, __pyx_v_ptr, __pyx_v_s, __pyx_v_readonly, PyBUF_SIMPLE); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "buffers.pxd":224
+ * cdef str astr=""
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B" # <<<<<<<<<<<<<<
+ * pybuf.shape = shape
+ * pybuf.ndim = 1
+ */
+ __pyx_v_pybuf.format = __pyx_k_B;
+
+ /* "buffers.pxd":225
+ * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
+ * pybuf.format = "B"
+ * pybuf.shape = shape # <<<<<<<<<<<<<<
+ * pybuf.ndim = 1
+ * return PyMemoryView_FromBuffer(&pybuf)
+ */
+ __pyx_v_pybuf.shape = __pyx_v_shape;
+
+ /* "buffers.pxd":226
+ * pybuf.format = "B"
+ * pybuf.shape = shape
+ * pybuf.ndim = 1 # <<<<<<<<<<<<<<
+ * return PyMemoryView_FromBuffer(&pybuf)
+ *
+ */
+ __pyx_v_pybuf.ndim = 1;
+
+ /* "buffers.pxd":227
+ * pybuf.shape = shape
+ * pybuf.ndim = 1
+ * return PyMemoryView_FromBuffer(&pybuf) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_3 = PyMemoryView_FromBuffer((&__pyx_v_pybuf)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":214
+ *
+ *
+ * cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 3 version of frombuffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("buffers.frombuffer_3", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_astr);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":230
+ *
+ *
+ * cdef inline object frombuffer_2(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 2 version of frombuffer.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_2", 0);
+
+ /* "buffers.pxd":236
+ * """
+ *
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * if readonly:
+ * return PyBuffer_FromMemory(ptr, s)
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":237
+ *
+ * if oldstyle_available():
+ * if readonly: # <<<<<<<<<<<<<<
+ * return PyBuffer_FromMemory(ptr, s)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_readonly != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":238
+ * if oldstyle_available():
+ * if readonly:
+ * return PyBuffer_FromMemory(ptr, s) # <<<<<<<<<<<<<<
+ * else:
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":240
+ * return PyBuffer_FromMemory(ptr, s)
+ * else:
+ * return PyBuffer_FromReadWriteMemory(ptr, s) # <<<<<<<<<<<<<<
+ * else:
+ * raise NotImplementedError("Old style buffers not available.")
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromReadWriteMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":242
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ * else:
+ * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[2]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+
+ /* "buffers.pxd":230
+ *
+ *
+ * cdef inline object frombuffer_2(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Python 2 version of frombuffer.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.frombuffer_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":245
+ *
+ *
+ * cdef inline object frombuffer(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Create a Python Buffer/View of a C array.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer", 0);
+
+ /* "buffers.pxd":262
+ * """
+ * # oldstyle first priority for now
+ * if oldstyle_available(): # <<<<<<<<<<<<<<
+ * return frombuffer_2(ptr, s, readonly)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_f_7buffers_oldstyle_available() != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":263
+ * # oldstyle first priority for now
+ * if oldstyle_available():
+ * return frombuffer_2(ptr, s, readonly) # <<<<<<<<<<<<<<
+ * else:
+ * return frombuffer_3(ptr, s, readonly)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_f_7buffers_frombuffer_2(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":265
+ * return frombuffer_2(ptr, s, readonly)
+ * else:
+ * return frombuffer_3(ptr, s, readonly) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_f_7buffers_frombuffer_3(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":245
+ *
+ *
+ * cdef inline object frombuffer(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
+ * """Create a Python Buffer/View of a C array.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.frombuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":268
+ *
+ *
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_r(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_r", 0);
+
+ /* "buffers.pxd":270
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s):
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":268
+ *
+ *
+ * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly view frombuffer."""
+ * return frombuffer(ptr, s, 1)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.frombuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":273
+ *
+ *
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_w(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("frombuffer_w", 0);
+
+ /* "buffers.pxd":275
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s):
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0) # <<<<<<<<<<<<<<
+ *
+ * #------------------------------------------------------------------------------
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":273
+ *
+ *
+ * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
+ * """Wrapper for writable view frombuffer."""
+ * return frombuffer(ptr, s, 0)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.frombuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":282
+ * #------------------------------------------------------------------------------
+ *
+ * cdef inline object viewfromobject(object obj, int readonly): # <<<<<<<<<<<<<<
+ * """Construct a Python Buffer/View object from another Python object.
+ *
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *__pyx_v_obj, int __pyx_v_readonly) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject", 0);
+
+ /* "buffers.pxd":298
+ * Buffer/View of the original object.
+ * """
+ * if not memoryview_available(): # <<<<<<<<<<<<<<
+ * if readonly:
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ */
+ __pyx_t_1 = ((!(__pyx_f_7buffers_memoryview_available() != 0)) != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":299
+ * """
+ * if not memoryview_available():
+ * if readonly: # <<<<<<<<<<<<<<
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_readonly != 0);
+ if (__pyx_t_1) {
+
+ /* "buffers.pxd":300
+ * if not memoryview_available():
+ * if readonly:
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
+ * else:
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromObject(__pyx_v_obj, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":302
+ * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
+ * else:
+ * return PyMemoryView_FromObject(obj)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyBuffer_FromReadWriteObject(__pyx_v_obj, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+ }
+ /*else*/ {
+
+ /* "buffers.pxd":304
+ * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
+ * else:
+ * return PyMemoryView_FromObject(obj) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = PyMemoryView_FromObject(__pyx_v_obj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "buffers.pxd":282
+ * #------------------------------------------------------------------------------
+ *
+ * cdef inline object viewfromobject(object obj, int readonly): # <<<<<<<<<<<<<<
+ * """Construct a Python Buffer/View object from another Python object.
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("buffers.viewfromobject", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":307
+ *
+ *
+ * cdef inline object viewfromobject_r(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *__pyx_v_obj) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject_r", 0);
+
+ /* "buffers.pxd":309
+ * cdef inline object viewfromobject_r(object obj):
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_viewfromobject(__pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":307
+ *
+ *
+ * cdef inline object viewfromobject_r(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for readonly viewfromobject."""
+ * return viewfromobject(obj, 1)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.viewfromobject_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "buffers.pxd":312
+ *
+ *
+ * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0)
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_w(PyObject *__pyx_v_obj) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("viewfromobject_w", 0);
+
+ /* "buffers.pxd":314
+ * cdef inline object viewfromobject_w(object obj):
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0) # <<<<<<<<<<<<<<
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_f_7buffers_viewfromobject(__pyx_v_obj, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "buffers.pxd":312
+ *
+ *
+ * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
+ * """Wrapper for writable viewfromobject."""
+ * return viewfromobject(obj, 0)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("buffers.viewfromobject_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "zmq/devices/monitoredqueue.pxd":39
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef inline int _relay(void *insocket_, void *outsocket_, void *sidesocket_, # <<<<<<<<<<<<<<
+ * zmq_msg_t msg, zmq_msg_t side_msg, zmq_msg_t id_msg,
+ * bint swap_ids) nogil:
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7devices_14monitoredqueue__relay(void *__pyx_v_insocket_, void *__pyx_v_outsocket_, void *__pyx_v_sidesocket_, zmq_msg_t __pyx_v_msg, zmq_msg_t __pyx_v_side_msg, zmq_msg_t __pyx_v_id_msg, int __pyx_v_swap_ids) {
+ int __pyx_v_rc;
+ pyzmq_int64_t __pyx_v_flag_2;
+ int __pyx_v_flag_3;
+ int __pyx_v_flags;
+ size_t __pyx_v_flagsz;
+ void *__pyx_v_flag_ptr;
+ int __pyx_r;
+ int __pyx_t_1;
+
+ /* "zmq/devices/monitoredqueue.pxd":50
+ * cdef void * flag_ptr
+ *
+ * if ZMQ_VERSION_MAJOR < 3: # <<<<<<<<<<<<<<
+ * flagsz = sizeof (int64_t)
+ * flag_ptr = &flag_2
+ */
+ __pyx_t_1 = ((ZMQ_VERSION_MAJOR < 3) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":51
+ *
+ * if ZMQ_VERSION_MAJOR < 3:
+ * flagsz = sizeof (int64_t) # <<<<<<<<<<<<<<
+ * flag_ptr = &flag_2
+ * else:
+ */
+ __pyx_v_flagsz = (sizeof(pyzmq_int64_t));
+
+ /* "zmq/devices/monitoredqueue.pxd":52
+ * if ZMQ_VERSION_MAJOR < 3:
+ * flagsz = sizeof (int64_t)
+ * flag_ptr = &flag_2 # <<<<<<<<<<<<<<
+ * else:
+ * flagsz = sizeof (int)
+ */
+ __pyx_v_flag_ptr = (&__pyx_v_flag_2);
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "zmq/devices/monitoredqueue.pxd":54
+ * flag_ptr = &flag_2
+ * else:
+ * flagsz = sizeof (int) # <<<<<<<<<<<<<<
+ * flag_ptr = &flag_3
+ *
+ */
+ __pyx_v_flagsz = (sizeof(int));
+
+ /* "zmq/devices/monitoredqueue.pxd":55
+ * else:
+ * flagsz = sizeof (int)
+ * flag_ptr = &flag_3 # <<<<<<<<<<<<<<
+ *
+ * if swap_ids:# both router, must send second identity first
+ */
+ __pyx_v_flag_ptr = (&__pyx_v_flag_3);
+ }
+ __pyx_L3:;
+
+ /* "zmq/devices/monitoredqueue.pxd":57
+ * flag_ptr = &flag_3
+ *
+ * if swap_ids:# both router, must send second identity first # <<<<<<<<<<<<<<
+ * # recv two ids into msg, id_msg
+ * rc = zmq_msg_recv(&msg, insocket_, 0)
+ */
+ __pyx_t_1 = (__pyx_v_swap_ids != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":59
+ * if swap_ids:# both router, must send second identity first
+ * # recv two ids into msg, id_msg
+ * rc = zmq_msg_recv(&msg, insocket_, 0) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ *
+ */
+ __pyx_v_rc = zmq_msg_recv((&__pyx_v_msg), __pyx_v_insocket_, 0);
+
+ /* "zmq/devices/monitoredqueue.pxd":60
+ * # recv two ids into msg, id_msg
+ * rc = zmq_msg_recv(&msg, insocket_, 0)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ *
+ * rc = zmq_msg_recv(&id_msg, insocket_, 0)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":62
+ * if rc < 0: return rc
+ *
+ * rc = zmq_msg_recv(&id_msg, insocket_, 0) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ *
+ */
+ __pyx_v_rc = zmq_msg_recv((&__pyx_v_id_msg), __pyx_v_insocket_, 0);
+
+ /* "zmq/devices/monitoredqueue.pxd":63
+ *
+ * rc = zmq_msg_recv(&id_msg, insocket_, 0)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ *
+ * # send second id (id_msg) first
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":67
+ * # send second id (id_msg) first
+ * #!!!! always send a copy before the original !!!!
+ * rc = zmq_msg_copy(&side_msg, &id_msg) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE)
+ */
+ __pyx_v_rc = zmq_msg_copy((&__pyx_v_side_msg), (&__pyx_v_id_msg));
+
+ /* "zmq/devices/monitoredqueue.pxd":68
+ * #!!!! always send a copy before the original !!!!
+ * rc = zmq_msg_copy(&side_msg, &id_msg)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":69
+ * rc = zmq_msg_copy(&side_msg, &id_msg)
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&id_msg, sidesocket_, ZMQ_SNDMORE)
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_side_msg), __pyx_v_outsocket_, ZMQ_SNDMORE);
+
+ /* "zmq/devices/monitoredqueue.pxd":70
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&id_msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":71
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&id_msg, sidesocket_, ZMQ_SNDMORE) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * # send first id (msg) second
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_id_msg), __pyx_v_sidesocket_, ZMQ_SNDMORE);
+
+ /* "zmq/devices/monitoredqueue.pxd":72
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&id_msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * # send first id (msg) second
+ * rc = zmq_msg_copy(&side_msg, &msg)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":74
+ * if rc < 0: return rc
+ * # send first id (msg) second
+ * rc = zmq_msg_copy(&side_msg, &msg) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE)
+ */
+ __pyx_v_rc = zmq_msg_copy((&__pyx_v_side_msg), (&__pyx_v_msg));
+
+ /* "zmq/devices/monitoredqueue.pxd":75
+ * # send first id (msg) second
+ * rc = zmq_msg_copy(&side_msg, &msg)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":76
+ * rc = zmq_msg_copy(&side_msg, &msg)
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&msg, sidesocket_, ZMQ_SNDMORE)
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_side_msg), __pyx_v_outsocket_, ZMQ_SNDMORE);
+
+ /* "zmq/devices/monitoredqueue.pxd":77
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":78
+ * rc = zmq_msg_send(&side_msg, outsocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&msg, sidesocket_, ZMQ_SNDMORE) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * while (True):
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_msg), __pyx_v_sidesocket_, ZMQ_SNDMORE);
+
+ /* "zmq/devices/monitoredqueue.pxd":79
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * while (True):
+ * rc = zmq_msg_recv(&msg, insocket_, 0)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "zmq/devices/monitoredqueue.pxd":80
+ * rc = zmq_msg_send(&msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ * while (True): # <<<<<<<<<<<<<<
+ * rc = zmq_msg_recv(&msg, insocket_, 0)
+ * if rc < 0: return rc
+ */
+ while (1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":81
+ * if rc < 0: return rc
+ * while (True):
+ * rc = zmq_msg_recv(&msg, insocket_, 0) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * # assert (rc == 0)
+ */
+ __pyx_v_rc = zmq_msg_recv((&__pyx_v_msg), __pyx_v_insocket_, 0);
+
+ /* "zmq/devices/monitoredqueue.pxd":82
+ * while (True):
+ * rc = zmq_msg_recv(&msg, insocket_, 0)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * # assert (rc == 0)
+ * rc = zmq_getsockopt (insocket_, ZMQ_RCVMORE, flag_ptr, &flagsz)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":84
+ * if rc < 0: return rc
+ * # assert (rc == 0)
+ * rc = zmq_getsockopt (insocket_, ZMQ_RCVMORE, flag_ptr, &flagsz) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * flags = 0
+ */
+ __pyx_v_rc = zmq_getsockopt(__pyx_v_insocket_, ZMQ_RCVMORE, __pyx_v_flag_ptr, (&__pyx_v_flagsz));
+
+ /* "zmq/devices/monitoredqueue.pxd":85
+ * # assert (rc == 0)
+ * rc = zmq_getsockopt (insocket_, ZMQ_RCVMORE, flag_ptr, &flagsz)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * flags = 0
+ * if ZMQ_VERSION_MAJOR < 3:
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":86
+ * rc = zmq_getsockopt (insocket_, ZMQ_RCVMORE, flag_ptr, &flagsz)
+ * if rc < 0: return rc
+ * flags = 0 # <<<<<<<<<<<<<<
+ * if ZMQ_VERSION_MAJOR < 3:
+ * if flag_2:
+ */
+ __pyx_v_flags = 0;
+
+ /* "zmq/devices/monitoredqueue.pxd":87
+ * if rc < 0: return rc
+ * flags = 0
+ * if ZMQ_VERSION_MAJOR < 3: # <<<<<<<<<<<<<<
+ * if flag_2:
+ * flags |= ZMQ_SNDMORE
+ */
+ __pyx_t_1 = ((ZMQ_VERSION_MAJOR < 3) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":88
+ * flags = 0
+ * if ZMQ_VERSION_MAJOR < 3:
+ * if flag_2: # <<<<<<<<<<<<<<
+ * flags |= ZMQ_SNDMORE
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_flag_2 != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":89
+ * if ZMQ_VERSION_MAJOR < 3:
+ * if flag_2:
+ * flags |= ZMQ_SNDMORE # <<<<<<<<<<<<<<
+ * else:
+ * if flag_3:
+ */
+ __pyx_v_flags = (__pyx_v_flags | ZMQ_SNDMORE);
+ goto __pyx_L18;
+ }
+ __pyx_L18:;
+ goto __pyx_L17;
+ }
+ /*else*/ {
+
+ /* "zmq/devices/monitoredqueue.pxd":91
+ * flags |= ZMQ_SNDMORE
+ * else:
+ * if flag_3: # <<<<<<<<<<<<<<
+ * flags |= ZMQ_SNDMORE
+ * # LABEL has been removed:
+ */
+ __pyx_t_1 = (__pyx_v_flag_3 != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":92
+ * else:
+ * if flag_3:
+ * flags |= ZMQ_SNDMORE # <<<<<<<<<<<<<<
+ * # LABEL has been removed:
+ * # rc = zmq_getsockopt (insocket_, ZMQ_RCVLABEL, flag_ptr, &flagsz)
+ */
+ __pyx_v_flags = (__pyx_v_flags | ZMQ_SNDMORE);
+ goto __pyx_L19;
+ }
+ __pyx_L19:;
+ }
+ __pyx_L17:;
+
+ /* "zmq/devices/monitoredqueue.pxd":99
+ * # assert (rc == 0)
+ *
+ * rc = zmq_msg_copy(&side_msg, &msg) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * if flags:
+ */
+ __pyx_v_rc = zmq_msg_copy((&__pyx_v_side_msg), (&__pyx_v_msg));
+
+ /* "zmq/devices/monitoredqueue.pxd":100
+ *
+ * rc = zmq_msg_copy(&side_msg, &msg)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * if flags:
+ * rc = zmq_msg_send(&side_msg, outsocket_, flags)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":101
+ * rc = zmq_msg_copy(&side_msg, &msg)
+ * if rc < 0: return rc
+ * if flags: # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&side_msg, outsocket_, flags)
+ * if rc < 0: return rc
+ */
+ __pyx_t_1 = (__pyx_v_flags != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":102
+ * if rc < 0: return rc
+ * if flags:
+ * rc = zmq_msg_send(&side_msg, outsocket_, flags) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * # only SNDMORE for side-socket
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_side_msg), __pyx_v_outsocket_, __pyx_v_flags);
+
+ /* "zmq/devices/monitoredqueue.pxd":103
+ * if flags:
+ * rc = zmq_msg_send(&side_msg, outsocket_, flags)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * # only SNDMORE for side-socket
+ * rc = zmq_msg_send(&msg, sidesocket_, ZMQ_SNDMORE)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":105
+ * if rc < 0: return rc
+ * # only SNDMORE for side-socket
+ * rc = zmq_msg_send(&msg, sidesocket_, ZMQ_SNDMORE) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * else:
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_msg), __pyx_v_sidesocket_, ZMQ_SNDMORE);
+
+ /* "zmq/devices/monitoredqueue.pxd":106
+ * # only SNDMORE for side-socket
+ * rc = zmq_msg_send(&msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * else:
+ * rc = zmq_msg_send(&side_msg, outsocket_, 0)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+ goto __pyx_L21;
+ }
+ /*else*/ {
+
+ /* "zmq/devices/monitoredqueue.pxd":108
+ * if rc < 0: return rc
+ * else:
+ * rc = zmq_msg_send(&side_msg, outsocket_, 0) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&msg, sidesocket_, 0)
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_side_msg), __pyx_v_outsocket_, 0);
+
+ /* "zmq/devices/monitoredqueue.pxd":109
+ * else:
+ * rc = zmq_msg_send(&side_msg, outsocket_, 0)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&msg, sidesocket_, 0)
+ * if rc < 0: return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":110
+ * rc = zmq_msg_send(&side_msg, outsocket_, 0)
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&msg, sidesocket_, 0) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * break
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_msg), __pyx_v_sidesocket_, 0);
+
+ /* "zmq/devices/monitoredqueue.pxd":111
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&msg, sidesocket_, 0)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * break
+ * return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":112
+ * rc = zmq_msg_send(&msg, sidesocket_, 0)
+ * if rc < 0: return rc
+ * break # <<<<<<<<<<<<<<
+ * return rc
+ *
+ */
+ goto __pyx_L14_break;
+ }
+ __pyx_L21:;
+ }
+ __pyx_L14_break:;
+
+ /* "zmq/devices/monitoredqueue.pxd":113
+ * if rc < 0: return rc
+ * break
+ * return rc # <<<<<<<<<<<<<<
+ *
+ * # the MonitoredQueue C function, adapted from zmq::queue.cpp :
+ */
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+
+ /* "zmq/devices/monitoredqueue.pxd":39
+ * #-----------------------------------------------------------------------------
+ *
+ * cdef inline int _relay(void *insocket_, void *outsocket_, void *sidesocket_, # <<<<<<<<<<<<<<
+ * zmq_msg_t msg, zmq_msg_t side_msg, zmq_msg_t id_msg,
+ * bint swap_ids) nogil:
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "zmq/devices/monitoredqueue.pxd":116
+ *
+ * # the MonitoredQueue C function, adapted from zmq::queue.cpp :
+ * cdef inline int c_monitored_queue (void *insocket_, void *outsocket_, # <<<<<<<<<<<<<<
+ * void *sidesocket_, zmq_msg_t *in_msg_ptr,
+ * zmq_msg_t *out_msg_ptr, int swap_ids) nogil:
+ */
+
+static CYTHON_INLINE int __pyx_f_3zmq_7devices_14monitoredqueue_c_monitored_queue(void *__pyx_v_insocket_, void *__pyx_v_outsocket_, void *__pyx_v_sidesocket_, zmq_msg_t *__pyx_v_in_msg_ptr, zmq_msg_t *__pyx_v_out_msg_ptr, int __pyx_v_swap_ids) {
+ zmq_msg_t __pyx_v_msg;
+ int __pyx_v_rc;
+ zmq_msg_t __pyx_v_id_msg;
+ zmq_msg_t __pyx_v_side_msg;
+ zmq_pollitem_t __pyx_v_items[2];
+ int __pyx_r;
+ int __pyx_t_1;
+
+ /* "zmq/devices/monitoredqueue.pxd":125
+ *
+ * cdef zmq_msg_t msg
+ * cdef int rc = zmq_msg_init (&msg) # <<<<<<<<<<<<<<
+ * cdef zmq_msg_t id_msg
+ * rc = zmq_msg_init (&id_msg)
+ */
+ __pyx_v_rc = zmq_msg_init((&__pyx_v_msg));
+
+ /* "zmq/devices/monitoredqueue.pxd":127
+ * cdef int rc = zmq_msg_init (&msg)
+ * cdef zmq_msg_t id_msg
+ * rc = zmq_msg_init (&id_msg) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * cdef zmq_msg_t side_msg
+ */
+ __pyx_v_rc = zmq_msg_init((&__pyx_v_id_msg));
+
+ /* "zmq/devices/monitoredqueue.pxd":128
+ * cdef zmq_msg_t id_msg
+ * rc = zmq_msg_init (&id_msg)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * cdef zmq_msg_t side_msg
+ * rc = zmq_msg_init (&side_msg)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":130
+ * if rc < 0: return rc
+ * cdef zmq_msg_t side_msg
+ * rc = zmq_msg_init (&side_msg) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ *
+ */
+ __pyx_v_rc = zmq_msg_init((&__pyx_v_side_msg));
+
+ /* "zmq/devices/monitoredqueue.pxd":131
+ * cdef zmq_msg_t side_msg
+ * rc = zmq_msg_init (&side_msg)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ *
+ * cdef zmq_pollitem_t items [2]
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":134
+ *
+ * cdef zmq_pollitem_t items [2]
+ * items [0].socket = insocket_ # <<<<<<<<<<<<<<
+ * items [0].fd = 0
+ * items [0].events = ZMQ_POLLIN
+ */
+ (__pyx_v_items[0]).socket = __pyx_v_insocket_;
+
+ /* "zmq/devices/monitoredqueue.pxd":135
+ * cdef zmq_pollitem_t items [2]
+ * items [0].socket = insocket_
+ * items [0].fd = 0 # <<<<<<<<<<<<<<
+ * items [0].events = ZMQ_POLLIN
+ * items [0].revents = 0
+ */
+ (__pyx_v_items[0]).fd = 0;
+
+ /* "zmq/devices/monitoredqueue.pxd":136
+ * items [0].socket = insocket_
+ * items [0].fd = 0
+ * items [0].events = ZMQ_POLLIN # <<<<<<<<<<<<<<
+ * items [0].revents = 0
+ * items [1].socket = outsocket_
+ */
+ (__pyx_v_items[0]).events = ZMQ_POLLIN;
+
+ /* "zmq/devices/monitoredqueue.pxd":137
+ * items [0].fd = 0
+ * items [0].events = ZMQ_POLLIN
+ * items [0].revents = 0 # <<<<<<<<<<<<<<
+ * items [1].socket = outsocket_
+ * items [1].fd = 0
+ */
+ (__pyx_v_items[0]).revents = 0;
+
+ /* "zmq/devices/monitoredqueue.pxd":138
+ * items [0].events = ZMQ_POLLIN
+ * items [0].revents = 0
+ * items [1].socket = outsocket_ # <<<<<<<<<<<<<<
+ * items [1].fd = 0
+ * items [1].events = ZMQ_POLLIN
+ */
+ (__pyx_v_items[1]).socket = __pyx_v_outsocket_;
+
+ /* "zmq/devices/monitoredqueue.pxd":139
+ * items [0].revents = 0
+ * items [1].socket = outsocket_
+ * items [1].fd = 0 # <<<<<<<<<<<<<<
+ * items [1].events = ZMQ_POLLIN
+ * items [1].revents = 0
+ */
+ (__pyx_v_items[1]).fd = 0;
+
+ /* "zmq/devices/monitoredqueue.pxd":140
+ * items [1].socket = outsocket_
+ * items [1].fd = 0
+ * items [1].events = ZMQ_POLLIN # <<<<<<<<<<<<<<
+ * items [1].revents = 0
+ * # I don't think sidesocket should be polled?
+ */
+ (__pyx_v_items[1]).events = ZMQ_POLLIN;
+
+ /* "zmq/devices/monitoredqueue.pxd":141
+ * items [1].fd = 0
+ * items [1].events = ZMQ_POLLIN
+ * items [1].revents = 0 # <<<<<<<<<<<<<<
+ * # I don't think sidesocket should be polled?
+ * # items [2].socket = sidesocket_
+ */
+ (__pyx_v_items[1]).revents = 0;
+
+ /* "zmq/devices/monitoredqueue.pxd":148
+ * # items [2].revents = 0
+ *
+ * while (True): # <<<<<<<<<<<<<<
+ *
+ * # // Wait while there are either requests or replies to process.
+ */
+ while (1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":151
+ *
+ * # // Wait while there are either requests or replies to process.
+ * rc = zmq_poll (&items [0], 2, -1) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * # // The algorithm below asumes ratio of request and replies processed
+ */
+ __pyx_v_rc = zmq_poll((&(__pyx_v_items[0])), 2, -1);
+
+ /* "zmq/devices/monitoredqueue.pxd":152
+ * # // Wait while there are either requests or replies to process.
+ * rc = zmq_poll (&items [0], 2, -1)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * # // The algorithm below asumes ratio of request and replies processed
+ * # // under full load to be 1:1. Although processing requests replies
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":159
+ * #
+ * # // Process a request.
+ * if (items [0].revents & ZMQ_POLLIN): # <<<<<<<<<<<<<<
+ * # send in_prefix to side socket
+ * rc = zmq_msg_copy(&side_msg, in_msg_ptr)
+ */
+ __pyx_t_1 = (((__pyx_v_items[0]).revents & ZMQ_POLLIN) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":161
+ * if (items [0].revents & ZMQ_POLLIN):
+ * # send in_prefix to side socket
+ * rc = zmq_msg_copy(&side_msg, in_msg_ptr) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, sidesocket_, ZMQ_SNDMORE)
+ */
+ __pyx_v_rc = zmq_msg_copy((&__pyx_v_side_msg), __pyx_v_in_msg_ptr);
+
+ /* "zmq/devices/monitoredqueue.pxd":162
+ * # send in_prefix to side socket
+ * rc = zmq_msg_copy(&side_msg, in_msg_ptr)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&side_msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":163
+ * rc = zmq_msg_copy(&side_msg, in_msg_ptr)
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, sidesocket_, ZMQ_SNDMORE) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * # relay the rest of the message
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_side_msg), __pyx_v_sidesocket_, ZMQ_SNDMORE);
+
+ /* "zmq/devices/monitoredqueue.pxd":164
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * # relay the rest of the message
+ * rc = _relay(insocket_, outsocket_, sidesocket_, msg, side_msg, id_msg, swap_ids)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":166
+ * if rc < 0: return rc
+ * # relay the rest of the message
+ * rc = _relay(insocket_, outsocket_, sidesocket_, msg, side_msg, id_msg, swap_ids) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * if (items [1].revents & ZMQ_POLLIN):
+ */
+ __pyx_v_rc = __pyx_f_3zmq_7devices_14monitoredqueue__relay(__pyx_v_insocket_, __pyx_v_outsocket_, __pyx_v_sidesocket_, __pyx_v_msg, __pyx_v_side_msg, __pyx_v_id_msg, __pyx_v_swap_ids);
+
+ /* "zmq/devices/monitoredqueue.pxd":167
+ * # relay the rest of the message
+ * rc = _relay(insocket_, outsocket_, sidesocket_, msg, side_msg, id_msg, swap_ids)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * if (items [1].revents & ZMQ_POLLIN):
+ * # send out_prefix to side socket
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "zmq/devices/monitoredqueue.pxd":168
+ * rc = _relay(insocket_, outsocket_, sidesocket_, msg, side_msg, id_msg, swap_ids)
+ * if rc < 0: return rc
+ * if (items [1].revents & ZMQ_POLLIN): # <<<<<<<<<<<<<<
+ * # send out_prefix to side socket
+ * rc = zmq_msg_copy(&side_msg, out_msg_ptr)
+ */
+ __pyx_t_1 = (((__pyx_v_items[1]).revents & ZMQ_POLLIN) != 0);
+ if (__pyx_t_1) {
+
+ /* "zmq/devices/monitoredqueue.pxd":170
+ * if (items [1].revents & ZMQ_POLLIN):
+ * # send out_prefix to side socket
+ * rc = zmq_msg_copy(&side_msg, out_msg_ptr) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, sidesocket_, ZMQ_SNDMORE)
+ */
+ __pyx_v_rc = zmq_msg_copy((&__pyx_v_side_msg), __pyx_v_out_msg_ptr);
+
+ /* "zmq/devices/monitoredqueue.pxd":171
+ * # send out_prefix to side socket
+ * rc = zmq_msg_copy(&side_msg, out_msg_ptr)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * rc = zmq_msg_send(&side_msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":172
+ * rc = zmq_msg_copy(&side_msg, out_msg_ptr)
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, sidesocket_, ZMQ_SNDMORE) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * # relay the rest of the message
+ */
+ __pyx_v_rc = zmq_msg_send((&__pyx_v_side_msg), __pyx_v_sidesocket_, ZMQ_SNDMORE);
+
+ /* "zmq/devices/monitoredqueue.pxd":173
+ * if rc < 0: return rc
+ * rc = zmq_msg_send(&side_msg, sidesocket_, ZMQ_SNDMORE)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * # relay the rest of the message
+ * rc = _relay(outsocket_, insocket_, sidesocket_, msg, side_msg, id_msg, swap_ids)
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":175
+ * if rc < 0: return rc
+ * # relay the rest of the message
+ * rc = _relay(outsocket_, insocket_, sidesocket_, msg, side_msg, id_msg, swap_ids) # <<<<<<<<<<<<<<
+ * if rc < 0: return rc
+ * return rc
+ */
+ __pyx_v_rc = __pyx_f_3zmq_7devices_14monitoredqueue__relay(__pyx_v_outsocket_, __pyx_v_insocket_, __pyx_v_sidesocket_, __pyx_v_msg, __pyx_v_side_msg, __pyx_v_id_msg, __pyx_v_swap_ids);
+
+ /* "zmq/devices/monitoredqueue.pxd":176
+ * # relay the rest of the message
+ * rc = _relay(outsocket_, insocket_, sidesocket_, msg, side_msg, id_msg, swap_ids)
+ * if rc < 0: return rc # <<<<<<<<<<<<<<
+ * return rc
+ */
+ __pyx_t_1 = ((__pyx_v_rc < 0) != 0);
+ if (__pyx_t_1) {
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+ }
+ goto __pyx_L12;
+ }
+ __pyx_L12:;
+ }
+
+ /* "zmq/devices/monitoredqueue.pxd":177
+ * rc = _relay(outsocket_, insocket_, sidesocket_, msg, side_msg, id_msg, swap_ids)
+ * if rc < 0: return rc
+ * return rc # <<<<<<<<<<<<<<
+ */
+ __pyx_r = __pyx_v_rc;
+ goto __pyx_L0;
+
+ /* "zmq/devices/monitoredqueue.pxd":116
+ *
+ * # the MonitoredQueue C function, adapted from zmq::queue.cpp :
+ * cdef inline int c_monitored_queue (void *insocket_, void *outsocket_, # <<<<<<<<<<<<<<
+ * void *sidesocket_, zmq_msg_t *in_msg_ptr,
+ * zmq_msg_t *out_msg_ptr, int swap_ids) nogil:
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+static PyMethodDef __pyx_methods[] = {
+ {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+ #if PY_VERSION_HEX < 0x03020000
+ { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+ #else
+ PyModuleDef_HEAD_INIT,
+ #endif
+ "monitoredqueue",
+ __pyx_k_MonitoredQueue_classes_and_funct, /* m_doc */
+ -1, /* m_size */
+ __pyx_methods /* m_methods */,
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_n_s_Again, __pyx_k_Again, sizeof(__pyx_k_Again), 0, 0, 1, 1},
+ {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
+ {&__pyx_n_b_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 0, 1},
+ {&__pyx_n_s_ContextTerminated, __pyx_k_ContextTerminated, sizeof(__pyx_k_ContextTerminated), 0, 0, 1, 1},
+ {&__pyx_n_s_InterruptedSystemCall, __pyx_k_InterruptedSystemCall, sizeof(__pyx_k_InterruptedSystemCall), 0, 0, 1, 1},
+ {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
+ {&__pyx_kp_s_Old_style_buffers_not_available, __pyx_k_Old_style_buffers_not_available, sizeof(__pyx_k_Old_style_buffers_not_available), 0, 0, 1, 0},
+ {&__pyx_n_s_ROUTER, __pyx_k_ROUTER, sizeof(__pyx_k_ROUTER), 0, 0, 1, 1},
+ {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
+ {&__pyx_n_s_ZMQError, __pyx_k_ZMQError, sizeof(__pyx_k_ZMQError), 0, 0, 1, 1},
+ {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
+ {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
+ {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
+ {&__pyx_n_s_char, __pyx_k_char, sizeof(__pyx_k_char), 0, 0, 1, 1},
+ {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
+ {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_b_in, __pyx_k_in, sizeof(__pyx_k_in), 0, 0, 0, 1},
+ {&__pyx_n_s_in_msg, __pyx_k_in_msg, sizeof(__pyx_k_in_msg), 0, 0, 1, 1},
+ {&__pyx_n_s_in_prefix, __pyx_k_in_prefix, sizeof(__pyx_k_in_prefix), 0, 0, 1, 1},
+ {&__pyx_n_s_in_socket, __pyx_k_in_socket, sizeof(__pyx_k_in_socket), 0, 0, 1, 1},
+ {&__pyx_n_s_ins, __pyx_k_ins, sizeof(__pyx_k_ins), 0, 0, 1, 1},
+ {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_mon_socket, __pyx_k_mon_socket, sizeof(__pyx_k_mon_socket), 0, 0, 1, 1},
+ {&__pyx_n_s_monitored_queue, __pyx_k_monitored_queue, sizeof(__pyx_k_monitored_queue), 0, 0, 1, 1},
+ {&__pyx_n_s_mons, __pyx_k_mons, sizeof(__pyx_k_mons), 0, 0, 1, 1},
+ {&__pyx_n_s_msg_c, __pyx_k_msg_c, sizeof(__pyx_k_msg_c), 0, 0, 1, 1},
+ {&__pyx_n_s_msg_c_len, __pyx_k_msg_c_len, sizeof(__pyx_k_msg_c_len), 0, 0, 1, 1},
+ {&__pyx_n_b_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 0, 1},
+ {&__pyx_n_s_out_msg, __pyx_k_out_msg, sizeof(__pyx_k_out_msg), 0, 0, 1, 1},
+ {&__pyx_n_s_out_prefix, __pyx_k_out_prefix, sizeof(__pyx_k_out_prefix), 0, 0, 1, 1},
+ {&__pyx_n_s_out_socket, __pyx_k_out_socket, sizeof(__pyx_k_out_socket), 0, 0, 1, 1},
+ {&__pyx_n_s_outs, __pyx_k_outs, sizeof(__pyx_k_outs), 0, 0, 1, 1},
+ {&__pyx_kp_s_private_tmp_pyzmq_release_zmq_d, __pyx_k_private_tmp_pyzmq_release_zmq_d, sizeof(__pyx_k_private_tmp_pyzmq_release_zmq_d), 0, 0, 1, 0},
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
+ {&__pyx_kp_s_r_does_not_provide_a_buffer_int, __pyx_k_r_does_not_provide_a_buffer_int, sizeof(__pyx_k_r_does_not_provide_a_buffer_int), 0, 0, 1, 0},
+ {&__pyx_n_s_rc, __pyx_k_rc, sizeof(__pyx_k_rc), 0, 0, 1, 1},
+ {&__pyx_n_s_swap_ids, __pyx_k_swap_ids, sizeof(__pyx_k_swap_ids), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
+ {&__pyx_n_s_typecode, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq, __pyx_k_zmq, sizeof(__pyx_k_zmq), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_devices_monitoredqueue, __pyx_k_zmq_devices_monitoredqueue, sizeof(__pyx_k_zmq_devices_monitoredqueue), 0, 0, 1, 1},
+ {&__pyx_n_s_zmq_error, __pyx_k_zmq_error, sizeof(__pyx_k_zmq_error), 0, 0, 1, 1},
+ {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+ __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+ /* "buffers.pxd":194
+ *
+ * if PY_MAJOR_VERSION >= 3 and bfmt is not None:
+ * return bfmt.decode('ascii') # <<<<<<<<<<<<<<
+ * return bfmt
+ *
+ */
+ __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
+
+ /* "buffers.pxd":242
+ * return PyBuffer_FromReadWriteMemory(ptr, s)
+ * else:
+ * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Old_style_buffers_not_available); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
+
+ /* "zmq/devices/monitoredqueue.pyx":41
+ *
+ *
+ * def monitored_queue(Socket in_socket, Socket out_socket, Socket mon_socket, # <<<<<<<<<<<<<<
+ * bytes in_prefix=b'in', bytes out_prefix=b'out'):
+ * """monitored_queue(in_socket, out_socket, mon_socket,
+ */
+ __pyx_tuple__4 = PyTuple_Pack(14, __pyx_n_s_in_socket, __pyx_n_s_out_socket, __pyx_n_s_mon_socket, __pyx_n_s_in_prefix, __pyx_n_s_out_prefix, __pyx_n_s_ins, __pyx_n_s_outs, __pyx_n_s_mons, __pyx_n_s_in_msg, __pyx_n_s_out_msg, __pyx_n_s_swap_ids, __pyx_n_s_msg_c, __pyx_n_s_msg_c_len, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__4);
+ __Pyx_GIVEREF(__pyx_tuple__4);
+ __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_d, __pyx_n_s_monitored_queue, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_RefNannyFinishContext();
+ return 0;
+ __pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
+ return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initmonitoredqueue(void); /*proto*/
+PyMODINIT_FUNC initmonitoredqueue(void)
+#else
+PyMODINIT_FUNC PyInit_monitoredqueue(void); /*proto*/
+PyMODINIT_FUNC PyInit_monitoredqueue(void)
+#endif
+{
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ #if CYTHON_REFNANNY
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+ if (!__Pyx_RefNanny) {
+ PyErr_Clear();
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+ if (!__Pyx_RefNanny)
+ Py_FatalError("failed to import 'refnanny' module");
+ }
+ #endif
+ __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_monitoredqueue(void)", 0);
+ if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __Pyx_CyFunction_USED
+ if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ #ifdef __Pyx_Generator_USED
+ if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ /*--- Library function declarations ---*/
+ /*--- Threads initialization code ---*/
+ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+ #ifdef WITH_THREAD /* Python build with threading support? */
+ PyEval_InitThreads();
+ #endif
+ #endif
+ /*--- Module creation code ---*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_m = Py_InitModule4("monitoredqueue", __pyx_methods, __pyx_k_MonitoredQueue_classes_and_funct, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ #else
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
+ #endif
+ if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ Py_INCREF(__pyx_d);
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if CYTHON_COMPILING_IN_PYPY
+ Py_INCREF(__pyx_b);
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ /*--- Initialize various global constants etc. ---*/
+ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ if (__pyx_module_is_main_zmq__devices__monitoredqueue) {
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "zmq.devices.monitoredqueue")) {
+ if (unlikely(PyDict_SetItemString(modules, "zmq.devices.monitoredqueue", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ }
+ #endif
+ /*--- Builtin init code ---*/
+ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Global init code ---*/
+ /*--- Variable export code ---*/
+ /*--- Function export code ---*/
+ /*--- Type init code ---*/
+ /*--- Type import code ---*/
+ __pyx_ptype_3zmq_7backend_6cython_7context_Context = __Pyx_ImportType("zmq.backend.cython.context", "Context", sizeof(struct __pyx_obj_3zmq_7backend_6cython_7context_Context), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_7context_Context)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_3zmq_7backend_6cython_7context_Context = (struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context*)__Pyx_GetVtable(__pyx_ptype_3zmq_7backend_6cython_7context_Context->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_7backend_6cython_7context_Context)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_3zmq_7backend_6cython_6socket_Socket = __Pyx_ImportType("zmq.backend.cython.socket", "Socket", sizeof(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket), 1); if (unlikely(!__pyx_ptype_3zmq_7backend_6cython_6socket_Socket)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket = (struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket*)__Pyx_GetVtable(__pyx_ptype_3zmq_7backend_6cython_6socket_Socket->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
+ #if CYTHON_COMPILING_IN_PYPY
+ sizeof(PyTypeObject),
+ #else
+ sizeof(PyHeapTypeObject),
+ #endif
+ 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Variable import code ---*/
+ /*--- Function import code ---*/
+ /*--- Execution code ---*/
+
+ /* "zmq/devices/monitoredqueue.pyx":33
+ * from zmq.backend.cython.checkrc cimport _check_rc
+ *
+ * from zmq import ROUTER, ZMQError # <<<<<<<<<<<<<<
+ * from zmq.error import InterruptedSystemCall
+ *
+ */
+ __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_ROUTER);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ROUTER);
+ __Pyx_GIVEREF(__pyx_n_s_ROUTER);
+ __Pyx_INCREF(__pyx_n_s_ZMQError);
+ PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ZMQError);
+ __Pyx_GIVEREF(__pyx_n_s_ZMQError);
+ __pyx_t_2 = __Pyx_Import(__pyx_n_s_zmq, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ROUTER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ROUTER, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZMQError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "zmq/devices/monitoredqueue.pyx":34
+ *
+ * from zmq import ROUTER, ZMQError
+ * from zmq.error import InterruptedSystemCall # <<<<<<<<<<<<<<
+ *
+ * #-----------------------------------------------------------------------------
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_n_s_InterruptedSystemCall);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_InterruptedSystemCall);
+ __Pyx_GIVEREF(__pyx_n_s_InterruptedSystemCall);
+ __pyx_t_1 = __Pyx_Import(__pyx_n_s_zmq_error, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_InterruptedSystemCall); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_InterruptedSystemCall, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/devices/monitoredqueue.pyx":41
+ *
+ *
+ * def monitored_queue(Socket in_socket, Socket out_socket, Socket mon_socket, # <<<<<<<<<<<<<<
+ * bytes in_prefix=b'in', bytes out_prefix=b'out'):
+ * """monitored_queue(in_socket, out_socket, mon_socket,
+ */
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7devices_14monitoredqueue_1monitored_queue, NULL, __pyx_n_s_zmq_devices_monitoredqueue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_monitored_queue, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/devices/monitoredqueue.pyx":110
+ * return rc
+ *
+ * __all__ = ['monitored_queue'] # <<<<<<<<<<<<<<
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_monitored_queue);
+ PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_monitored_queue);
+ __Pyx_GIVEREF(__pyx_n_s_monitored_queue);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/devices/monitoredqueue.pyx":1
+ * """MonitoredQueue classes and functions. # <<<<<<<<<<<<<<
+ *
+ * Authors
+ */
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "zmq/devices/monitoredqueue.pxd":116
+ *
+ * # the MonitoredQueue C function, adapted from zmq::queue.cpp :
+ * cdef inline int c_monitored_queue (void *insocket_, void *outsocket_, # <<<<<<<<<<<<<<
+ * void *sidesocket_, zmq_msg_t *in_msg_ptr,
+ * zmq_msg_t *out_msg_ptr, int swap_ids) nogil:
+ */
+
+ /*--- Wrapped vars code ---*/
+
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ if (__pyx_m) {
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init zmq.devices.monitoredqueue", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ }
+ Py_DECREF(__pyx_m); __pyx_m = 0;
+ } else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ImportError, "init zmq.devices.monitoredqueue");
+ }
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ #if PY_MAJOR_VERSION < 3
+ return;
+ #else
+ return __pyx_m;
+ #endif
+}
+
+/* --- Runtime support code --- */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+ PyObject *m = NULL, *p = NULL;
+ void *r = NULL;
+ m = PyImport_ImportModule((char *)modname);
+ if (!m) goto end;
+ p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+ if (!p) goto end;
+ r = PyLong_AsVoidPtr(p);
+end:
+ Py_XDECREF(p);
+ Py_XDECREF(m);
+ return (__Pyx_RefNannyAPIStruct *)r;
+}
+#endif
+
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *more_or_less;
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ func_name, more_or_less, num_expected,
+ (num_expected == 1) ? "" : "s", num_found);
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+ const char* func_name,
+ PyObject* kw_name)
+{
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION >= 3
+ "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+ #else
+ "%s() got multiple values for keyword argument '%s'", func_name,
+ PyString_AsString(kw_name));
+ #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+ PyObject *kwds,
+ PyObject **argnames[],
+ PyObject *kwds2,
+ PyObject *values[],
+ Py_ssize_t num_pos_args,
+ const char* function_name)
+{
+ PyObject *key = 0, *value = 0;
+ Py_ssize_t pos = 0;
+ PyObject*** name;
+ PyObject*** first_kw_arg = argnames + num_pos_args;
+ while (PyDict_Next(kwds, &pos, &key, &value)) {
+ name = first_kw_arg;
+ while (*name && (**name != key)) name++;
+ if (*name) {
+ values[name-argnames] = value;
+ continue;
+ }
+ name = first_kw_arg;
+ #if PY_MAJOR_VERSION < 3
+ if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+ while (*name) {
+ if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**name, key)) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ if ((**argname == key) || (
+ (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+ && _PyString_Eq(**argname, key))) {
+ goto arg_passed_twice;
+ }
+ argname++;
+ }
+ }
+ } else
+ #endif
+ if (likely(PyUnicode_Check(key))) {
+ while (*name) {
+ int cmp = (**name == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**name, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) {
+ values[name-argnames] = value;
+ break;
+ }
+ name++;
+ }
+ if (*name) continue;
+ else {
+ PyObject*** argname = argnames;
+ while (argname != first_kw_arg) {
+ int cmp = (**argname == key) ? 0 :
+ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+ (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+ #endif
+ PyUnicode_Compare(**argname, key);
+ if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+ if (cmp == 0) goto arg_passed_twice;
+ argname++;
+ }
+ }
+ } else
+ goto invalid_keyword_type;
+ if (kwds2) {
+ if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+ } else {
+ goto invalid_keyword;
+ }
+ }
+ return 0;
+arg_passed_twice:
+ __Pyx_RaiseDoubleKeywordsError(function_name, key);
+ goto bad;
+invalid_keyword_type:
+ PyErr_Format(PyExc_TypeError,
+ "%.200s() keywords must be strings", function_name);
+ goto bad;
+invalid_keyword:
+ PyErr_Format(PyExc_TypeError,
+ #if PY_MAJOR_VERSION < 3
+ "%.200s() got an unexpected keyword argument '%.200s'",
+ function_name, PyString_AsString(key));
+ #else
+ "%s() got an unexpected keyword argument '%U'",
+ function_name, key);
+ #endif
+bad:
+ return -1;
+}
+
+static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
+ name, type->tp_name, Py_TYPE(obj)->tp_name);
+}
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact)
+{
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
+ return 0;
+ }
+ if (none_allowed && obj == Py_None) return 1;
+ else if (exact) {
+ if (likely(Py_TYPE(obj) == type)) return 1;
+ #if PY_MAJOR_VERSION == 2
+ else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
+ #endif
+ }
+ else {
+ if (likely(PyObject_TypeCheck(obj, type))) return 1;
+ }
+ __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
+ return 0;
+}
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+ if (unlikely(!result)) {
+ PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+ "name '%U' is not defined", name);
+#else
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
+#endif
+ }
+ return result;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+ PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+ result = PyDict_GetItem(__pyx_d, name);
+ if (likely(result)) {
+ Py_INCREF(result);
+ } else {
+#else
+ result = PyObject_GetItem(__pyx_d, name);
+ if (!result) {
+ PyErr_Clear();
+#endif
+ result = __Pyx_GetBuiltinName(name);
+ }
+ return result;
+}
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+#else
+ PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ local_type = tstate->curexc_type;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
+ PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
+ goto bad;
+ #if PY_MAJOR_VERSION >= 3
+ if (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
+ return 0;
+bad:
+ *type = 0;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+ PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+ if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Format(PyExc_ImportError,
+ #if PY_MAJOR_VERSION < 3
+ "cannot import name %.230s", PyString_AS_STRING(name));
+ #else
+ "cannot import name %S", name);
+ #endif
+ }
+ return value;
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_Restore(type, value, tb);
+#endif
+}
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->curexc_type;
+ *value = tstate->curexc_value;
+ *tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+ CYTHON_UNUSED PyObject *cause) {
+ Py_XINCREF(type);
+ if (!value || value == Py_None)
+ value = NULL;
+ else
+ Py_INCREF(value);
+ if (!tb || tb == Py_None)
+ tb = NULL;
+ else {
+ Py_INCREF(tb);
+ if (!PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ }
+ if (PyType_Check(type)) {
+#if CYTHON_COMPILING_IN_PYPY
+ if (!value) {
+ Py_INCREF(Py_None);
+ value = Py_None;
+ }
+#endif
+ PyErr_NormalizeException(&type, &value, &tb);
+ } else {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ }
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+#else
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+ PyObject* owned_instance = NULL;
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (PyExceptionClass_Check(type)) {
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+#if PY_VERSION_HEX >= 0x03030000
+ if (cause) {
+#else
+ if (cause && cause != Py_None) {
+#endif
+ PyObject *fixed_cause;
+ if (cause == Py_None) {
+ fixed_cause = NULL;
+ } else if (PyExceptionClass_Check(cause)) {
+ fixed_cause = PyObject_CallObject(cause, NULL);
+ if (fixed_cause == NULL)
+ goto bad;
+ } else if (PyExceptionInstance_Check(cause)) {
+ fixed_cause = cause;
+ Py_INCREF(fixed_cause);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "exception causes must derive from "
+ "BaseException");
+ goto bad;
+ }
+ PyException_SetCause(value, fixed_cause);
+ }
+ PyErr_SetObject(type, value);
+ if (tb) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
+ Py_INCREF(tb);
+ PyErr_Restore(tmp_type, tmp_value, tb);
+ Py_XDECREF(tmp_tb);
+#else
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+#endif
+ }
+bad:
+ Py_XDECREF(owned_instance);
+ return;
+}
+#endif
+
+static void* __Pyx_GetVtable(PyObject *dict) {
+ void* ptr;
+ PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
+ if (!ob)
+ goto bad;
+#if PY_VERSION_HEX >= 0x02070000
+ ptr = PyCapsule_GetPointer(ob, 0);
+#else
+ ptr = PyCObject_AsVoidPtr(ob);
+#endif
+ if (!ptr && !PyErr_Occurred())
+ PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
+ Py_DECREF(ob);
+ return ptr;
+bad:
+ Py_XDECREF(ob);
+ return NULL;
+}
+
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
+ }
+ }
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
+ }
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
+#endif
+
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (long) -1;
+ }
+ } else {
+ long val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_Check(x))) {
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
+ }
+ } else
+#endif
+ if (likely(PyLong_Check(x))) {
+ if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (unlikely(Py_SIZE(x) < 0)) {
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
+ }
+ } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
+ }
+ #endif
+#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
+#endif
+ return (int) -1;
+ }
+ } else {
+ int val;
+ PyObject *tmp = __Pyx_PyNumber_Int(x);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
+ Py_DECREF(tmp);
+ return val;
+ }
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
+}
+
+static int __Pyx_check_binary_version(void) {
+ char ctversion[4], rtversion[4];
+ PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
+ if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char message[200];
+ PyOS_snprintf(message, sizeof(message),
+ "compiletime version %s of module '%.100s' "
+ "does not match runtime version %s",
+ ctversion, __Pyx_MODULE_NAME, rtversion);
+ return PyErr_WarnEx(NULL, message, 1);
+ }
+ return 0;
+}
+
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+ PyObject *py_name = 0;
+ PyObject *py_module = 0;
+ py_name = __Pyx_PyIdentifier_FromString(name);
+ if (!py_name)
+ goto bad;
+ py_module = PyImport_Import(py_name);
+ Py_DECREF(py_name);
+ return py_module;
+bad:
+ Py_XDECREF(py_name);
+ return 0;
+}
+#endif
+
+#ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
+ size_t size, int strict)
+{
+ PyObject *py_module = 0;
+ PyObject *result = 0;
+ PyObject *py_name = 0;
+ char warning[200];
+ Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+ PyObject *py_basicsize;
+#endif
+ py_module = __Pyx_ImportModule(module_name);
+ if (!py_module)
+ goto bad;
+ py_name = __Pyx_PyIdentifier_FromString(class_name);
+ if (!py_name)
+ goto bad;
+ result = PyObject_GetAttr(py_module, py_name);
+ Py_DECREF(py_name);
+ py_name = 0;
+ Py_DECREF(py_module);
+ py_module = 0;
+ if (!result)
+ goto bad;
+ if (!PyType_Check(result)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s.%.200s is not a type object",
+ module_name, class_name);
+ goto bad;
+ }
+#ifndef Py_LIMITED_API
+ basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+ py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+ if (!py_basicsize)
+ goto bad;
+ basicsize = PyLong_AsSsize_t(py_basicsize);
+ Py_DECREF(py_basicsize);
+ py_basicsize = 0;
+ if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+ goto bad;
+#endif
+ if (!strict && (size_t)basicsize > size) {
+ PyOS_snprintf(warning, sizeof(warning),
+ "%s.%s size changed, may indicate binary incompatibility",
+ module_name, class_name);
+ if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
+ }
+ else if ((size_t)basicsize != size) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.%.200s has the wrong size, try recompiling",
+ module_name, class_name);
+ goto bad;
+ }
+ return (PyTypeObject *)result;
+bad:
+ Py_XDECREF(py_module);
+ Py_XDECREF(result);
+ return NULL;
+}
+#endif
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ #if PY_MAJOR_VERSION < 3
+ if (t->is_unicode) {
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+ } else if (t->intern) {
+ *t->p = PyString_InternFromString(t->s);
+ } else {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ }
+ #else
+ if (t->is_unicode | t->is_str) {
+ if (t->intern) {
+ *t->p = PyUnicode_InternFromString(t->s);
+ } else if (t->encoding) {
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+ } else {
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+ }
+ } else {
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+ }
+ #endif
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+ Py_ssize_t ignore;
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+ if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+ PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+ char* defenc_c;
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+ if (!defenc) return NULL;
+ defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ {
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+ char* c;
+ for (c = defenc_c; c < end; c++) {
+ if ((unsigned char) (*c) >= 128) {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+ }
+ }
+#endif
+ *length = PyBytes_GET_SIZE(defenc);
+ return defenc_c;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+ if (PyUnicode_IS_ASCII(o)) {
+ *length = PyUnicode_GET_LENGTH(o);
+ return PyUnicode_AsUTF8(o);
+ } else {
+ PyUnicode_AsASCIIString(o);
+ return NULL;
+ }
+#else
+ return PyUnicode_AsUTF8AndSize(o, length);
+#endif
+#endif
+ } else
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
+ {
+ char* result;
+ int r = PyBytes_AsStringAndSize(o, &result, length);
+ if (unlikely(r < 0)) {
+ return NULL;
+ } else {
+ return result;
+ }
+ }
+}
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+ else return PyObject_IsTrue(x);
+}
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+ PyNumberMethods *m;
+ const char *name = NULL;
+ PyObject *res = NULL;
+#if PY_MAJOR_VERSION < 3
+ if (PyInt_Check(x) || PyLong_Check(x))
+#else
+ if (PyLong_Check(x))
+#endif
+ return Py_INCREF(x), x;
+ m = Py_TYPE(x)->tp_as_number;
+#if PY_MAJOR_VERSION < 3
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Int(x);
+ }
+ else if (m && m->nb_long) {
+ name = "long";
+ res = PyNumber_Long(x);
+ }
+#else
+ if (m && m->nb_int) {
+ name = "int";
+ res = PyNumber_Long(x);
+ }
+#endif
+ if (res) {
+#if PY_MAJOR_VERSION < 3
+ if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+ if (!PyLong_Check(res)) {
+#endif
+ PyErr_Format(PyExc_TypeError,
+ "__%.4s__ returned non-%.4s (type %.200s)",
+ name, name, Py_TYPE(res)->tp_name);
+ Py_DECREF(res);
+ return NULL;
+ }
+ }
+ else if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "an integer is required");
+ }
+ return res;
+}
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+ Py_ssize_t ival;
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
+ if (!x) return -1;
+ ival = PyInt_AsSsize_t(x);
+ Py_DECREF(x);
+ return ival;
+}
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+ return PyInt_FromSize_t(ival);
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/external_libs/python/zmq/devices/monitoredqueue.pxd b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.pxd
index 1e26ed86..1e26ed86 100644
--- a/external_libs/python/zmq/devices/monitoredqueue.pxd
+++ b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.pxd
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.py b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.py
new file mode 100644
index 00000000..c6d91429
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.py
@@ -0,0 +1,37 @@
+"""pure Python monitored_queue function
+
+For use when Cython extension is unavailable (PyPy).
+
+Authors
+-------
+* MinRK
+"""
+
+# Copyright (C) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+
+import zmq
+
+def _relay(ins, outs, sides, prefix, swap_ids):
+ msg = ins.recv_multipart()
+ if swap_ids:
+ msg[:2] = msg[:2][::-1]
+ outs.send_multipart(msg)
+ sides.send_multipart([prefix] + msg)
+
+def monitored_queue(in_socket, out_socket, mon_socket,
+ in_prefix=b'in', out_prefix=b'out'):
+
+ swap_ids = in_socket.type == zmq.ROUTER and out_socket.type == zmq.ROUTER
+
+ poller = zmq.Poller()
+ poller.register(in_socket, zmq.POLLIN)
+ poller.register(out_socket, zmq.POLLIN)
+ while True:
+ events = dict(poller.poll())
+ if in_socket in events:
+ _relay(in_socket, out_socket, mon_socket, in_prefix, swap_ids)
+ if out_socket in events:
+ _relay(out_socket, in_socket, mon_socket, out_prefix, swap_ids)
+
+__all__ = ['monitored_queue']
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.pyx b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.pyx
new file mode 100644
index 00000000..f12394fa
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueue.pyx
@@ -0,0 +1,110 @@
+"""MonitoredQueue classes and functions.
+
+Authors
+-------
+* MinRK
+* Brian Granger
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2010-2012 Brian Granger, Min Ragan-Kelley
+#
+# This file is part of pyzmq
+#
+# Distributed under the terms of the New BSD License. The full license is in
+# the file COPYING.BSD, distributed as part of this software.
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Imports
+#-----------------------------------------------------------------------------
+
+cdef extern from "Python.h":
+ ctypedef int Py_ssize_t
+
+from libc.string cimport memcpy
+
+from buffers cimport asbuffer_r
+from libzmq cimport *
+
+from zmq.backend.cython.socket cimport Socket
+from zmq.backend.cython.checkrc cimport _check_rc
+
+from zmq import ROUTER, ZMQError
+from zmq.error import InterruptedSystemCall
+
+#-----------------------------------------------------------------------------
+# MonitoredQueue functions
+#-----------------------------------------------------------------------------
+
+
+def monitored_queue(Socket in_socket, Socket out_socket, Socket mon_socket,
+ bytes in_prefix=b'in', bytes out_prefix=b'out'):
+ """monitored_queue(in_socket, out_socket, mon_socket,
+ in_prefix=b'in', out_prefix=b'out')
+
+ Start a monitored queue device.
+
+ A monitored queue is very similar to the zmq.proxy device (monitored queue came first).
+
+ Differences from zmq.proxy:
+
+ - monitored_queue supports both in and out being ROUTER sockets
+ (via swapping IDENTITY prefixes).
+ - monitor messages are prefixed, making in and out messages distinguishable.
+
+ Parameters
+ ----------
+ in_socket : Socket
+ One of the sockets to the Queue. Its messages will be prefixed with
+ 'in'.
+ out_socket : Socket
+ One of the sockets to the Queue. Its messages will be prefixed with
+ 'out'. The only difference between in/out socket is this prefix.
+ mon_socket : Socket
+ This socket sends out every message received by each of the others
+ with an in/out prefix specifying which one it was.
+ in_prefix : str
+ Prefix added to broadcast messages from in_socket.
+ out_prefix : str
+ Prefix added to broadcast messages from out_socket.
+ """
+
+ cdef void *ins=in_socket.handle
+ cdef void *outs=out_socket.handle
+ cdef void *mons=mon_socket.handle
+ cdef zmq_msg_t in_msg
+ cdef zmq_msg_t out_msg
+ cdef bint swap_ids
+ cdef char *msg_c = NULL
+ cdef Py_ssize_t msg_c_len
+ cdef int rc
+
+ # force swap_ids if both ROUTERs
+ swap_ids = (in_socket.type == ROUTER and out_socket.type == ROUTER)
+
+ # build zmq_msg objects from str prefixes
+ asbuffer_r(in_prefix, <void **>&msg_c, &msg_c_len)
+ rc = zmq_msg_init_size(&in_msg, msg_c_len)
+ _check_rc(rc)
+
+ memcpy(zmq_msg_data(&in_msg), msg_c, zmq_msg_size(&in_msg))
+
+ asbuffer_r(out_prefix, <void **>&msg_c, &msg_c_len)
+
+ rc = zmq_msg_init_size(&out_msg, msg_c_len)
+ _check_rc(rc)
+
+ while True:
+ with nogil:
+ memcpy(zmq_msg_data(&out_msg), msg_c, zmq_msg_size(&out_msg))
+ rc = c_monitored_queue(ins, outs, mons, &in_msg, &out_msg, swap_ids)
+ try:
+ _check_rc(rc)
+ except InterruptedSystemCall:
+ continue
+ else:
+ break
+ return rc
+
+__all__ = ['monitored_queue']
diff --git a/external_libs/python/zmq/devices/monitoredqueuedevice.py b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueuedevice.py
index 9723f866..9723f866 100644
--- a/external_libs/python/zmq/devices/monitoredqueuedevice.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/devices/monitoredqueuedevice.py
diff --git a/external_libs/python/zmq/devices/proxydevice.py b/external_libs/python/pyzmq-14.7.0/zmq/devices/proxydevice.py
index 68be3f15..68be3f15 100644
--- a/external_libs/python/zmq/devices/proxydevice.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/devices/proxydevice.py
diff --git a/external_libs/python/zmq/error.py b/external_libs/python/pyzmq-14.7.0/zmq/error.py
index 48cdaafa..098dd7b7 100644
--- a/external_libs/python/zmq/error.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/error.py
@@ -3,6 +3,8 @@
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
+from errno import EINTR
+
class ZMQBaseError(Exception):
"""Base exception class for 0MQ errors in Python."""
@@ -56,7 +58,7 @@ class ZMQError(ZMQBaseError):
return self.strerror
def __repr__(self):
- return "ZMQError('%s')"%self.strerror
+ return "%s('%s')" % (self.__class__.__name__, str(self))
class ZMQBindError(ZMQBaseError):
@@ -94,6 +96,24 @@ class Again(ZMQError):
"""
pass
+try:
+ InterruptedError
+except NameError:
+ InterruptedError = OSError
+
+class InterruptedSystemCall(ZMQError, InterruptedError):
+ """Wrapper for EINTR
+
+ This exception should be caught internally in pyzmq
+ to retry system calls, and not propagate to the user.
+
+ .. versionadded:: 14.7
+ """
+
+ def __str__(self):
+ s = super(InterruptedSystemCall, self).__str__()
+ return s + ": This call should have been retried. Please report this to pyzmq."
+
def _check_rc(rc, errno=None):
"""internal utility for checking zmq return condition
@@ -101,11 +121,13 @@ def _check_rc(rc, errno=None):
and raising the appropriate Exception class
"""
if rc < 0:
- from zmq.backend import zmq_errno
if errno is None:
+ from zmq.backend import zmq_errno
errno = zmq_errno()
from zmq import EAGAIN, ETERM
- if errno == EAGAIN:
+ if errno == EINTR:
+ raise InterruptedSystemCall(errno)
+ elif errno == EAGAIN:
raise Again(errno)
elif errno == ETERM:
raise ContextTerminated(errno)
@@ -159,6 +181,7 @@ __all__ = [
'ZMQError',
'NotDone',
'ContextTerminated',
+ 'InterruptedSystemCall',
'Again',
'ZMQVersionError',
]
diff --git a/external_libs/python/zmq/eventloop/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/__init__.py
index 568e8e8d..568e8e8d 100644
--- a/external_libs/python/zmq/eventloop/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/__init__.py
diff --git a/external_libs/python/zmq/eventloop/ioloop.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/ioloop.py
index 35f4c418..35f4c418 100644
--- a/external_libs/python/zmq/eventloop/ioloop.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/ioloop.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/__init__.py
index e69de29b..e69de29b 100644
--- a/external_libs/python/zmq/eventloop/minitornado/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/__init__.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/concurrent.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/concurrent.py
index 519b23d5..519b23d5 100644
--- a/external_libs/python/zmq/eventloop/minitornado/concurrent.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/concurrent.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/ioloop.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/ioloop.py
index 710a3ecb..710a3ecb 100644
--- a/external_libs/python/zmq/eventloop/minitornado/ioloop.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/ioloop.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/log.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/log.py
index 49051e89..49051e89 100644
--- a/external_libs/python/zmq/eventloop/minitornado/log.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/log.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/platform/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/__init__.py
index e69de29b..e69de29b 100644
--- a/external_libs/python/zmq/eventloop/minitornado/platform/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/__init__.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/platform/auto.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/auto.py
index b40ccd94..b40ccd94 100644
--- a/external_libs/python/zmq/eventloop/minitornado/platform/auto.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/auto.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/platform/common.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/common.py
index 2d75dc1e..2d75dc1e 100644
--- a/external_libs/python/zmq/eventloop/minitornado/platform/common.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/common.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/platform/interface.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/interface.py
index 07da6bab..07da6bab 100644
--- a/external_libs/python/zmq/eventloop/minitornado/platform/interface.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/interface.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/platform/posix.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/posix.py
index ccffbb66..ccffbb66 100644
--- a/external_libs/python/zmq/eventloop/minitornado/platform/posix.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/posix.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/platform/windows.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/windows.py
index 817bdca1..817bdca1 100644
--- a/external_libs/python/zmq/eventloop/minitornado/platform/windows.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/platform/windows.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/stack_context.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/stack_context.py
index 226d8042..226d8042 100644
--- a/external_libs/python/zmq/eventloop/minitornado/stack_context.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/stack_context.py
diff --git a/external_libs/python/zmq/eventloop/minitornado/util.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/util.py
index c1e2eb95..c1e2eb95 100644
--- a/external_libs/python/zmq/eventloop/minitornado/util.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/minitornado/util.py
diff --git a/external_libs/python/zmq/eventloop/zmqstream.py b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/zmqstream.py
index 86a97e44..86a97e44 100644
--- a/external_libs/python/zmq/eventloop/zmqstream.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/eventloop/zmqstream.py
diff --git a/external_libs/python/zmq/green/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/green/__init__.py
index ff7e5965..ff7e5965 100644
--- a/external_libs/python/zmq/green/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/green/__init__.py
diff --git a/external_libs/python/zmq/green/core.py b/external_libs/python/pyzmq-14.7.0/zmq/green/core.py
index 9fc73e32..79b34ebb 100644
--- a/external_libs/python/zmq/green/core.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/green/core.py
@@ -67,8 +67,8 @@ class _Socket(_original_Socket):
_debug_gevent = False # turn on if you think gevent is missing events
_poller_class = _Poller
- def __init__(self, context, socket_type):
- _original_Socket.__init__(self, context, socket_type)
+ def __init__(self, *a, **kw):
+ super(_Socket, self).__init__(*a, **kw)
self.__in_send_multipart = False
self.__in_recv_multipart = False
self.__setup_events()
diff --git a/external_libs/python/zmq/green/device.py b/external_libs/python/pyzmq-14.7.0/zmq/green/device.py
index 4b070237..4b070237 100644
--- a/external_libs/python/zmq/green/device.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/green/device.py
diff --git a/external_libs/python/zmq/green/eventloop/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/__init__.py
index c5150efe..c5150efe 100644
--- a/external_libs/python/zmq/green/eventloop/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/__init__.py
diff --git a/external_libs/python/zmq/green/eventloop/ioloop.py b/external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/ioloop.py
index e12fd5e9..e12fd5e9 100644
--- a/external_libs/python/zmq/green/eventloop/ioloop.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/ioloop.py
diff --git a/external_libs/python/zmq/green/eventloop/zmqstream.py b/external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/zmqstream.py
index 90fbd1f5..90fbd1f5 100644
--- a/external_libs/python/zmq/green/eventloop/zmqstream.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/green/eventloop/zmqstream.py
diff --git a/external_libs/python/zmq/green/poll.py b/external_libs/python/pyzmq-14.7.0/zmq/green/poll.py
index 8f016129..8f016129 100644
--- a/external_libs/python/zmq/green/poll.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/green/poll.py
diff --git a/external_libs/python/zmq/log/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/log/__init__.py
index e69de29b..e69de29b 100644
--- a/external_libs/python/zmq/log/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/log/__init__.py
diff --git a/external_libs/python/zmq/log/handlers.py b/external_libs/python/pyzmq-14.7.0/zmq/log/handlers.py
index 5ff21bf3..5ff21bf3 100644
--- a/external_libs/python/zmq/log/handlers.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/log/handlers.py
diff --git a/external_libs/python/zmq/ssh/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/ssh/__init__.py
index 57f09568..57f09568 100644
--- a/external_libs/python/zmq/ssh/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/ssh/__init__.py
diff --git a/external_libs/python/zmq/ssh/forward.py b/external_libs/python/pyzmq-14.7.0/zmq/ssh/forward.py
index 2d619462..2d619462 100644
--- a/external_libs/python/zmq/ssh/forward.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/ssh/forward.py
diff --git a/external_libs/python/zmq/ssh/tunnel.py b/external_libs/python/pyzmq-14.7.0/zmq/ssh/tunnel.py
index 5a0c5433..5a0c5433 100644
--- a/external_libs/python/zmq/ssh/tunnel.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/ssh/tunnel.py
diff --git a/external_libs/python/zmq/sugar/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/__init__.py
index d0510a44..d0510a44 100644
--- a/external_libs/python/zmq/sugar/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/__init__.py
diff --git a/external_libs/python/zmq/sugar/attrsettr.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/attrsettr.py
index 4bbd36d6..4bbd36d6 100644
--- a/external_libs/python/zmq/sugar/attrsettr.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/attrsettr.py
diff --git a/external_libs/python/zmq/sugar/constants.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/constants.py
index 88281176..88281176 100644
--- a/external_libs/python/zmq/sugar/constants.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/constants.py
diff --git a/external_libs/python/zmq/sugar/context.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/context.py
index 86a9c5dc..ea94693e 100644
--- a/external_libs/python/zmq/sugar/context.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/context.py
@@ -55,6 +55,12 @@ class Context(ContextBase, AttributeSetter):
def __exit__(self, *args, **kwargs):
self.term()
+ def __copy__(self, memo=None):
+ """Copying a Context creates a shadow copy"""
+ return self.__class__.shadow(self.underlying)
+
+ __deepcopy__ = __copy__
+
@classmethod
def shadow(cls, address):
"""Shadow an existing libzmq context
diff --git a/external_libs/python/zmq/sugar/frame.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/frame.py
index 9f556c86..9f556c86 100644
--- a/external_libs/python/zmq/sugar/frame.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/frame.py
diff --git a/external_libs/python/zmq/sugar/poll.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/poll.py
index c7b1d1bb..c7b1d1bb 100644
--- a/external_libs/python/zmq/sugar/poll.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/poll.py
diff --git a/external_libs/python/zmq/sugar/socket.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/socket.py
index c91589d7..5373796a 100644
--- a/external_libs/python/zmq/sugar/socket.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/socket.py
@@ -5,8 +5,9 @@
# Distributed under the terms of the Modified BSD License.
-import codecs
+import errno
import random
+import sys
import warnings
import zmq
@@ -38,6 +39,10 @@ try:
except AttributeError:
DEFAULT_PROTOCOL = pickle.HIGHEST_PROTOCOL
+try:
+ _buffer_type = memoryview
+except NameError:
+ _buffer_type = buffer
class Socket(SocketBase, AttributeSetter):
"""The ZMQ socket object
@@ -53,6 +58,13 @@ class Socket(SocketBase, AttributeSetter):
"""
_shadow = False
+ def __init__(self, *a, **kw):
+ super(Socket, self).__init__(*a, **kw)
+ if 'shadow' in kw:
+ self._shadow = True
+ else:
+ self._shadow = False
+
def __del__(self):
if not self._shadow:
self.close()
@@ -72,6 +84,12 @@ class Socket(SocketBase, AttributeSetter):
# Socket creation
#-------------------------------------------------------------------------
+ def __copy__(self, memo=None):
+ """Copying a Socket creates a shadow copy"""
+ return self.__class__.shadow(self.underlying)
+
+ __deepcopy__ = __copy__
+
@classmethod
def shadow(cls, address):
"""Shadow an existing libzmq socket
@@ -164,6 +182,8 @@ class Socket(SocketBase, AttributeSetter):
def bind_to_random_port(self, addr, min_port=49152, max_port=65536, max_tries=100):
"""bind this socket to a random port in a range
+ If the port range is unspecified, the system will choose the port.
+
Parameters
----------
addr : str
@@ -185,12 +205,25 @@ class Socket(SocketBase, AttributeSetter):
ZMQBindError
if `max_tries` reached before successful bind
"""
+ if hasattr(constants, 'LAST_ENDPOINT') and min_port == 49152 and max_port == 65536:
+ # if LAST_ENDPOINT is supported, and min_port / max_port weren't specified,
+ # we can bind to port 0 and let the OS do the work
+ self.bind("%s:0" % addr)
+ url = self.last_endpoint.decode('ascii', 'replace')
+ _, port_s = url.rsplit(':', 1)
+ return int(port_s)
+
for i in range(max_tries):
try:
port = random.randrange(min_port, max_port)
self.bind('%s:%s' % (addr, port))
except ZMQError as exception:
- if not exception.errno == zmq.EADDRINUSE:
+ en = exception.errno
+ if en == zmq.EADDRINUSE:
+ continue
+ elif sys.platform == 'win32' and en == errno.EACCES:
+ continue
+ else:
raise
else:
return port
@@ -217,6 +250,12 @@ class Socket(SocketBase, AttributeSetter):
"""set the High Water Mark
On libzmq ≥ 3, this sets both SNDHWM and RCVHWM
+
+
+ .. warning::
+
+ New values only take effect for subsequent socket
+ bind/connects.
"""
major = zmq.zmq_version_info()[0]
if major >= 3:
@@ -227,7 +266,7 @@ class Socket(SocketBase, AttributeSetter):
raised = e
try:
self.rcvhwm = value
- except Exception:
+ except Exception as e:
raised = e
if raised:
@@ -272,6 +311,20 @@ class Socket(SocketBase, AttributeSetter):
a MessageTracker object, whose `pending` property will
be True until the last send is completed.
"""
+ # typecheck parts before sending:
+ for i,msg in enumerate(msg_parts):
+ if isinstance(msg, (zmq.Frame, bytes, _buffer_type)):
+ continue
+ try:
+ _buffer_type(msg)
+ except Exception as e:
+ rmsg = repr(msg)
+ if len(rmsg) > 32:
+ rmsg = rmsg[:32] + '...'
+ raise TypeError(
+ "Frame %i (%s) does not support the buffer interface." % (
+ i, rmsg,
+ ))
for msg in msg_parts[:-1]:
self.send(msg, SNDMORE|flags, copy=copy, track=track)
# Send the last part without the extra SNDMORE flag.
@@ -361,7 +414,7 @@ class Socket(SocketBase, AttributeSetter):
flags : int
Any valid send flag.
protocol : int
- The pickle protocol number to use. The default is pickle.DEFAULT_PROTOCOl
+ The pickle protocol number to use. The default is pickle.DEFAULT_PROTOCOL
where defined, and pickle.HIGHEST_PROTOCOL elsewhere.
"""
msg = pickle.dumps(obj, protocol)
diff --git a/external_libs/python/zmq/sugar/tracker.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/tracker.py
index fb8c007f..fb8c007f 100644
--- a/external_libs/python/zmq/sugar/tracker.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/tracker.py
diff --git a/external_libs/python/zmq/sugar/version.py b/external_libs/python/pyzmq-14.7.0/zmq/sugar/version.py
index ea8fbbc4..817c10b4 100644
--- a/external_libs/python/zmq/sugar/version.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/sugar/version.py
@@ -8,13 +8,13 @@ from zmq.backend import zmq_version_info
VERSION_MAJOR = 14
-VERSION_MINOR = 5
+VERSION_MINOR = 7
VERSION_PATCH = 0
VERSION_EXTRA = ""
__version__ = '%i.%i.%i' % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
if VERSION_EXTRA:
- __version__ = "%s-%s" % (__version__, VERSION_EXTRA)
+ __version__ = "%s.%s" % (__version__, VERSION_EXTRA)
version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, float('inf'))
else:
version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
diff --git a/external_libs/python/zmq/tests/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/__init__.py
index 325a3f19..325a3f19 100644
--- a/external_libs/python/zmq/tests/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/__init__.py
diff --git a/external_libs/python/zmq/tests/test_auth.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_auth.py
index d350f61f..d350f61f 100644
--- a/external_libs/python/zmq/tests/test_auth.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_auth.py
diff --git a/external_libs/python/zmq/tests/test_cffi_backend.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_cffi_backend.py
index 1f85eebf..f51cad0d 100644
--- a/external_libs/python/zmq/tests/test_cffi_backend.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_cffi_backend.py
@@ -22,8 +22,8 @@ except ImportError:
class TestCFFIBackend(TestCase):
def setUp(self):
- if not have_ffi_backend or not 'PyPy' in sys.version:
- raise SkipTest('PyPy Tests Only')
+ if not have_ffi_backend:
+ raise SkipTest('CFFI not available')
def test_zmq_version_info(self):
version = zmq_version_info()
@@ -49,7 +49,7 @@ class TestCFFIBackend(TestCase):
ctx = C.zmq_ctx_new()
socket = C.zmq_socket(ctx, PUSH)
- identity = ffi.new('char[3]', 'zmq')
+ identity = ffi.new('char[3]', b'zmq')
ret = C.zmq_setsockopt(socket, IDENTITY, ffi.cast('void*', identity), 3)
assert ret == 0
@@ -62,7 +62,7 @@ class TestCFFIBackend(TestCase):
ctx = C.zmq_ctx_new()
socket = C.zmq_socket(ctx, PUSH)
- identity = ffi.new('char[]', 'zmq')
+ identity = ffi.new('char[]', b'zmq')
ret = C.zmq_setsockopt(socket, IDENTITY, ffi.cast('void*', identity), 3)
assert ret == 0
@@ -74,9 +74,9 @@ class TestCFFIBackend(TestCase):
option_len)
assert ret == 0
- assert ffi.string(ffi.cast('char*', option))[0] == "z"
- assert ffi.string(ffi.cast('char*', option))[1] == "m"
- assert ffi.string(ffi.cast('char*', option))[2] == "q"
+ assert ffi.string(ffi.cast('char*', option))[0:1] == b"z"
+ assert ffi.string(ffi.cast('char*', option))[1:2] == b"m"
+ assert ffi.string(ffi.cast('char*', option))[2:3] == b"q"
assert ctx != ffi.NULL
assert ffi.NULL != socket
assert 0 == C.zmq_close(socket)
@@ -86,7 +86,7 @@ class TestCFFIBackend(TestCase):
ctx = C.zmq_ctx_new()
socket = C.zmq_socket(ctx, 8)
- assert 0 == C.zmq_bind(socket, 'tcp://*:4444')
+ assert 0 == C.zmq_bind(socket, b'tcp://*:4444')
assert ctx != ffi.NULL
assert ffi.NULL != socket
assert 0 == C.zmq_close(socket)
@@ -98,8 +98,8 @@ class TestCFFIBackend(TestCase):
socket1 = C.zmq_socket(ctx, PUSH)
socket2 = C.zmq_socket(ctx, PULL)
- assert 0 == C.zmq_bind(socket1, 'tcp://*:4444')
- assert 0 == C.zmq_connect(socket2, 'tcp://127.0.0.1:4444')
+ assert 0 == C.zmq_bind(socket1, b'tcp://*:4444')
+ assert 0 == C.zmq_connect(socket2, b'tcp://127.0.0.1:4444')
assert ctx != ffi.NULL
assert ffi.NULL != socket1
assert ffi.NULL != socket2
@@ -123,7 +123,7 @@ class TestCFFIBackend(TestCase):
def test_zmq_msg_init_data(self):
zmq_msg = ffi.new('zmq_msg_t*')
- message = ffi.new('char[5]', 'Hello')
+ message = ffi.new('char[5]', b'Hello')
assert 0 == C.zmq_msg_init_data(zmq_msg,
ffi.cast('void*', message),
@@ -136,7 +136,7 @@ class TestCFFIBackend(TestCase):
def test_zmq_msg_data(self):
zmq_msg = ffi.new('zmq_msg_t*')
- message = ffi.new('char[]', 'Hello')
+ message = ffi.new('char[]', b'Hello')
assert 0 == C.zmq_msg_init_data(zmq_msg,
ffi.cast('void*', message),
5,
@@ -146,7 +146,7 @@ class TestCFFIBackend(TestCase):
data = C.zmq_msg_data(zmq_msg)
assert ffi.NULL != zmq_msg
- assert ffi.string(ffi.cast("char*", data)) == 'Hello'
+ assert ffi.string(ffi.cast("char*", data)) == b'Hello'
assert 0 == C.zmq_msg_close(zmq_msg)
@@ -156,13 +156,13 @@ class TestCFFIBackend(TestCase):
sender = C.zmq_socket(ctx, REQ)
receiver = C.zmq_socket(ctx, REP)
- assert 0 == C.zmq_bind(receiver, 'tcp://*:7777')
- assert 0 == C.zmq_connect(sender, 'tcp://127.0.0.1:7777')
+ assert 0 == C.zmq_bind(receiver, b'tcp://*:7777')
+ assert 0 == C.zmq_connect(sender, b'tcp://127.0.0.1:7777')
time.sleep(0.1)
zmq_msg = ffi.new('zmq_msg_t*')
- message = ffi.new('char[5]', 'Hello')
+ message = ffi.new('char[5]', b'Hello')
C.zmq_msg_init_data(zmq_msg,
ffi.cast('void*', message),
@@ -182,13 +182,13 @@ class TestCFFIBackend(TestCase):
sender = C.zmq_socket(ctx, REQ)
receiver = C.zmq_socket(ctx, REP)
- assert 0 == C.zmq_bind(receiver, 'tcp://*:2222')
- assert 0 == C.zmq_connect(sender, 'tcp://127.0.0.1:2222')
+ assert 0 == C.zmq_bind(receiver, b'tcp://*:2222')
+ assert 0 == C.zmq_connect(sender, b'tcp://127.0.0.1:2222')
time.sleep(0.1)
zmq_msg = ffi.new('zmq_msg_t*')
- message = ffi.new('char[5]', 'Hello')
+ message = ffi.new('char[5]', b'Hello')
C.zmq_msg_init_data(zmq_msg,
ffi.cast('void*', message),
@@ -214,11 +214,11 @@ class TestCFFIBackend(TestCase):
sender = C.zmq_socket(ctx, REQ)
receiver = C.zmq_socket(ctx, REP)
- r1 = C.zmq_bind(receiver, 'tcp://*:3333')
- r2 = C.zmq_connect(sender, 'tcp://127.0.0.1:3333')
+ r1 = C.zmq_bind(receiver, b'tcp://*:3333')
+ r2 = C.zmq_connect(sender, b'tcp://127.0.0.1:3333')
zmq_msg = ffi.new('zmq_msg_t*')
- message = ffi.new('char[5]', 'Hello')
+ message = ffi.new('char[5]', b'Hello')
C.zmq_msg_init_data(zmq_msg,
ffi.cast('void*', message),
@@ -270,7 +270,7 @@ class TestCFFIBackend(TestCase):
assert ret == 0
zmq_msg_again = ffi.new('zmq_msg_t*')
- message_again = ffi.new('char[11]', 'Hello Again')
+ message_again = ffi.new('char[11]', b'Hello Again')
C.zmq_msg_init_data(zmq_msg_again,
ffi.cast('void*', message_again),
diff --git a/external_libs/python/zmq/tests/test_constants.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_constants.py
index d32b2b48..d32b2b48 100644
--- a/external_libs/python/zmq/tests/test_constants.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_constants.py
diff --git a/external_libs/python/zmq/tests/test_context.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_context.py
index e3280778..26c07d66 100644
--- a/external_libs/python/zmq/tests/test_context.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_context.py
@@ -1,6 +1,7 @@
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
+import copy
import gc
import sys
import time
@@ -213,6 +214,20 @@ class TestContext(BaseZMQTestCase):
self.assertEqual(ctx.max_sockets, 100)
self.assertEqual(ctx.get(zmq.MAX_SOCKETS), 100)
+ def test_copy(self):
+ c1 = self.Context()
+ c2 = copy.copy(c1)
+ c2b = copy.deepcopy(c1)
+ c3 = copy.deepcopy(c2)
+ self.assert_(c2._shadow)
+ self.assert_(c3._shadow)
+ self.assertEqual(c1.underlying, c2.underlying)
+ self.assertEqual(c1.underlying, c3.underlying)
+ self.assertEqual(c1.underlying, c2b.underlying)
+ s = c3.socket(zmq.PUB)
+ s.close()
+ c1.term()
+
def test_shadow(self):
ctx = self.Context()
ctx2 = self.Context.shadow(ctx.underlying)
diff --git a/external_libs/python/zmq/tests/test_device.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_device.py
index f8305074..0ad9cfe7 100644
--- a/external_libs/python/zmq/tests/test_device.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_device.py
@@ -28,16 +28,9 @@ class TestDevice(BaseZMQTestCase):
self.assertEqual(dev.daemon, True)
del dev
- def test_tsdevice_attributes(self):
- dev = devices.Device(zmq.QUEUE, zmq.SUB, zmq.PUB)
- self.assertEqual(dev.in_type, zmq.SUB)
- self.assertEqual(dev.out_type, zmq.PUB)
- self.assertEqual(dev.device_type, zmq.QUEUE)
- self.assertEqual(dev.daemon, True)
- del dev
-
-
def test_single_socket_forwarder_connect(self):
+ if zmq.zmq_version() in ('4.1.1', '4.0.6'):
+ raise SkipTest("libzmq-%s broke single-socket devices" % zmq.zmq_version())
dev = devices.ThreadDevice(zmq.QUEUE, zmq.REP, -1)
req = self.context.socket(zmq.REQ)
port = req.bind_to_random_port('tcp://127.0.0.1')
@@ -62,6 +55,8 @@ class TestDevice(BaseZMQTestCase):
req.close()
def test_single_socket_forwarder_bind(self):
+ if zmq.zmq_version() in ('4.1.1', '4.0.6'):
+ raise SkipTest("libzmq-%s broke single-socket devices" % zmq.zmq_version())
dev = devices.ThreadDevice(zmq.QUEUE, zmq.REP, -1)
# select random port:
binder = self.context.socket(zmq.REQ)
diff --git a/external_libs/python/zmq/tests/test_error.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_error.py
index a2eee14a..a2eee14a 100644
--- a/external_libs/python/zmq/tests/test_error.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_error.py
diff --git a/external_libs/python/zmq/tests/test_etc.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_etc.py
index ad224064..ad224064 100644
--- a/external_libs/python/zmq/tests/test_etc.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_etc.py
diff --git a/external_libs/python/zmq/tests/test_imports.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_imports.py
index c0ddfaac..c0ddfaac 100644
--- a/external_libs/python/zmq/tests/test_imports.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_imports.py
diff --git a/external_libs/python/zmq/tests/test_ioloop.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_ioloop.py
index 2a8b1153..2a8b1153 100644
--- a/external_libs/python/zmq/tests/test_ioloop.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_ioloop.py
diff --git a/external_libs/python/zmq/tests/test_log.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_log.py
index 9206f095..9206f095 100644
--- a/external_libs/python/zmq/tests/test_log.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_log.py
diff --git a/external_libs/python/zmq/tests/test_message.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_message.py
index d8770bdf..063768cc 100644
--- a/external_libs/python/zmq/tests/test_message.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_message.py
@@ -226,6 +226,23 @@ class TestFrame(BaseZMQTestCase):
self.assert_(outb is m.buffer)
self.assert_(m.buffer is m.buffer)
+ @skip_pypy
+ def test_memoryview_shape(self):
+ """memoryview shape info"""
+ if sys.version_info < (3,):
+ raise SkipTest("only test memoryviews on Python 3")
+ data = b("§§¶•ªº˜µ¬˚…∆˙åß∂©œ∑´†≈ç√")
+ n = len(data)
+ f = zmq.Frame(data)
+ view1 = f.buffer
+ self.assertEqual(view1.ndim, 1)
+ self.assertEqual(view1.shape, (n,))
+ self.assertEqual(view1.tobytes(), data)
+ view2 = memoryview(f)
+ self.assertEqual(view2.ndim, 1)
+ self.assertEqual(view2.shape, (n,))
+ self.assertEqual(view2.tobytes(), data)
+
def test_multisend(self):
"""ensure that a message remains intact after multiple sends"""
a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR)
diff --git a/external_libs/python/zmq/tests/test_monitor.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_monitor.py
index 4f035388..4f035388 100644
--- a/external_libs/python/zmq/tests/test_monitor.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_monitor.py
diff --git a/external_libs/python/zmq/tests/test_monqueue.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_monqueue.py
index e855602e..e855602e 100644
--- a/external_libs/python/zmq/tests/test_monqueue.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_monqueue.py
diff --git a/external_libs/python/zmq/tests/test_multipart.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_multipart.py
index 24d41be0..24d41be0 100644
--- a/external_libs/python/zmq/tests/test_multipart.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_multipart.py
diff --git a/external_libs/python/zmq/tests/test_pair.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_pair.py
index e88c1e8b..e88c1e8b 100644
--- a/external_libs/python/zmq/tests/test_pair.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_pair.py
diff --git a/external_libs/python/zmq/tests/test_poll.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_poll.py
index 57346c89..57346c89 100644
--- a/external_libs/python/zmq/tests/test_poll.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_poll.py
diff --git a/external_libs/python/zmq/tests/test_pubsub.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_pubsub.py
index a3ee22aa..a3ee22aa 100644
--- a/external_libs/python/zmq/tests/test_pubsub.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_pubsub.py
diff --git a/external_libs/python/zmq/tests/test_reqrep.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_reqrep.py
index de17f2b3..de17f2b3 100644
--- a/external_libs/python/zmq/tests/test_reqrep.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_reqrep.py
diff --git a/external_libs/python/pyzmq-14.7.0/zmq/tests/test_retry_eintr.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_retry_eintr.py
new file mode 100644
index 00000000..6da854dd
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_retry_eintr.py
@@ -0,0 +1,92 @@
+# -*- coding: utf8 -*-
+# Copyright (C) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+
+import signal
+import time
+from threading import Thread
+
+import zmq
+from zmq.tests import (
+ BaseZMQTestCase, SkipTest, skip_pypy, skip_if
+)
+from zmq.utils.strtypes import b
+
+
+# Partially based on EINTRBaseTest from CPython 3.5 eintr_tester
+
+class TestEINTRSysCall(BaseZMQTestCase):
+ """ Base class for EINTR tests. """
+
+ # delay for initial signal delivery
+ signal_delay = 0.1
+ # timeout for tests. Must be > signal_delay
+ timeout = .25
+ timeout_ms = int(timeout * 1e3)
+
+ @skip_if(not hasattr(signal, 'setitimer'), 'EINTR tests require setitimer')
+ def alarm(self, t=None):
+ """start a timer to fire only once
+
+ like signal.alarm, but with better resolution than integer seconds.
+ """
+ if t is None:
+ t = self.signal_delay
+ self.timer_fired = False
+ self.orig_handler = signal.signal(signal.SIGALRM, self.stop_timer)
+ # signal_period ignored, since only one timer event is allowed to fire
+ signal.setitimer(signal.ITIMER_REAL, t, 1000)
+
+ def stop_timer(self, *args):
+ self.timer_fired = True
+ signal.setitimer(signal.ITIMER_REAL, 0, 0)
+ signal.signal(signal.SIGALRM, self.orig_handler)
+
+ @skip_if(not hasattr(zmq, 'RCVTIMEO'))
+ def test_retry_recv(self):
+ pull = self.socket(zmq.PULL)
+ pull.rcvtimeo = self.timeout_ms
+ self.alarm()
+ self.assertRaises(zmq.Again, pull.recv)
+ assert self.timer_fired
+
+ @skip_if(not hasattr(zmq, 'SNDTIMEO'))
+ def test_retry_send(self):
+ push = self.socket(zmq.PUSH)
+ push.sndtimeo = self.timeout_ms
+ self.alarm()
+ self.assertRaises(zmq.Again, push.send, b('buf'))
+ assert self.timer_fired
+
+ def test_retry_poll(self):
+ x, y = self.create_bound_pair()
+ poller = zmq.Poller()
+ poller.register(x, zmq.POLLIN)
+ self.alarm()
+ def send():
+ time.sleep(2 * self.signal_delay)
+ y.send(b('ping'))
+ t = Thread(target=send)
+ t.start()
+ evts = dict(poller.poll(2 * self.timeout_ms))
+ t.join()
+ assert x in evts
+ assert self.timer_fired
+ x.recv()
+
+ def test_retry_term(self):
+ push = self.socket(zmq.PUSH)
+ push.linger = self.timeout_ms
+ push.connect('tcp://127.0.0.1:5555')
+ push.send(b('ping'))
+ time.sleep(0.1)
+ self.alarm()
+ self.context.destroy()
+ assert self.timer_fired
+ assert self.context.closed
+
+ def test_retry_getsockopt(self):
+ raise SkipTest("TODO: find a way to interrupt getsockopt")
+
+ def test_retry_setsockopt(self):
+ raise SkipTest("TODO: find a way to interrupt setsockopt")
diff --git a/external_libs/python/zmq/tests/test_security.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_security.py
index 687b7e0f..687b7e0f 100644
--- a/external_libs/python/zmq/tests/test_security.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_security.py
diff --git a/external_libs/python/zmq/tests/test_socket.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_socket.py
index 5c842edc..000983ac 100644
--- a/external_libs/python/zmq/tests/test_socket.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_socket.py
@@ -2,6 +2,7 @@
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
+import copy
import time
import warnings
@@ -193,6 +194,15 @@ class TestSocket(BaseZMQTestCase):
s = b.recv_unicode(encoding='utf16')
self.assertEqual(s,u)
+ def test_send_multipart_check_type(self):
+ "check type on all frames in send_multipart"
+ a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR)
+ self.sockets.extend([a,b])
+ self.assertRaises(TypeError, a.send_multipart, [b'a', 5])
+ a.send_multipart([b'b'])
+ rcvd = b.recv_multipart()
+ self.assertEqual(rcvd, [b'b'])
+
@skip_pypy
def test_tracker(self):
"test the MessageTracker object for tracking when zmq is done with a buffer"
@@ -382,6 +392,16 @@ class TestSocket(BaseZMQTestCase):
pass
s.close()
+ def test_copy(self):
+ s = self.socket(zmq.PUB)
+ scopy = copy.copy(s)
+ sdcopy = copy.deepcopy(s)
+ self.assert_(scopy._shadow)
+ self.assert_(sdcopy._shadow)
+ self.assertEqual(s.underlying, scopy.underlying)
+ self.assertEqual(s.underlying, sdcopy.underlying)
+ s.close()
+
def test_shadow(self):
p = self.socket(zmq.PUSH)
p.bind("tcp://127.0.0.1:5555")
diff --git a/external_libs/python/zmq/tests/test_stopwatch.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_stopwatch.py
index 49fb79f2..49fb79f2 100644
--- a/external_libs/python/zmq/tests/test_stopwatch.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_stopwatch.py
diff --git a/external_libs/python/zmq/tests/test_version.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_version.py
index 6ebebf30..6ebebf30 100644
--- a/external_libs/python/zmq/tests/test_version.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_version.py
diff --git a/external_libs/python/zmq/tests/test_win32_shim.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_win32_shim.py
index 55657bda..55657bda 100644
--- a/external_libs/python/zmq/tests/test_win32_shim.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_win32_shim.py
diff --git a/external_libs/python/zmq/tests/test_z85.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_z85.py
index 8a73cb4d..8a73cb4d 100644
--- a/external_libs/python/zmq/tests/test_z85.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_z85.py
diff --git a/external_libs/python/zmq/tests/test_zmqstream.py b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_zmqstream.py
index cdb3a171..cdb3a171 100644
--- a/external_libs/python/zmq/tests/test_zmqstream.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/tests/test_zmqstream.py
diff --git a/external_libs/python/zmq/utils/__init__.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/__init__.py
index e69de29b..e69de29b 100644
--- a/external_libs/python/zmq/utils/__init__.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/__init__.py
diff --git a/external_libs/python/zmq/utils/buffers.pxd b/external_libs/python/pyzmq-14.7.0/zmq/utils/buffers.pxd
index 998aa551..cba5af7e 100644
--- a/external_libs/python/zmq/utils/buffers.pxd
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/buffers.pxd
@@ -223,6 +223,7 @@ cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly):
PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
pybuf.format = "B"
pybuf.shape = shape
+ pybuf.ndim = 1
return PyMemoryView_FromBuffer(&pybuf)
diff --git a/external_libs/python/zmq/utils/constant_names.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/constant_names.py
index 47da9dc2..d790d614 100644
--- a/external_libs/python/zmq/utils/constant_names.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/constant_names.py
@@ -29,6 +29,8 @@ new_in = {
'MAX_SOCKETS_DFLT',
# socket opts
+ 'IPV4ONLY',
+ 'LAST_ENDPOINT',
'ROUTER_BEHAVIOR',
'ROUTER_MANDATORY',
'FAIL_UNROUTABLE',
@@ -104,7 +106,6 @@ new_in = {
'GSSAPI_SERVICE_PRINCIPAL',
'GSSAPI_PLAINTEXT',
'HANDSHAKE_IVL',
- 'IDENTITY_FD',
'XPUB_NODROP',
'SOCKS_PROXY',
@@ -267,7 +268,6 @@ bytes_sockopt_names = [
fd_sockopt_names = [
'FD',
- 'IDENTITY_FD',
]
int_sockopt_names = [
diff --git a/external_libs/python/zmq/utils/garbage.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/garbage.py
index 80a8725a..80a8725a 100644
--- a/external_libs/python/zmq/utils/garbage.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/garbage.py
diff --git a/external_libs/python/zmq/utils/getpid_compat.h b/external_libs/python/pyzmq-14.7.0/zmq/utils/getpid_compat.h
index 47ce90fa..47ce90fa 100644
--- a/external_libs/python/zmq/utils/getpid_compat.h
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/getpid_compat.h
diff --git a/external_libs/python/zmq/utils/interop.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/interop.py
index 26c01969..26c01969 100644
--- a/external_libs/python/zmq/utils/interop.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/interop.py
diff --git a/external_libs/python/zmq/utils/ipcmaxlen.h b/external_libs/python/pyzmq-14.7.0/zmq/utils/ipcmaxlen.h
index 7218db78..7218db78 100644
--- a/external_libs/python/zmq/utils/ipcmaxlen.h
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/ipcmaxlen.h
diff --git a/external_libs/python/zmq/utils/jsonapi.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/jsonapi.py
index 865ca6d5..865ca6d5 100644
--- a/external_libs/python/zmq/utils/jsonapi.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/jsonapi.py
diff --git a/external_libs/python/zmq/utils/monitor.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/monitor.py
index 734d54b1..734d54b1 100644
--- a/external_libs/python/zmq/utils/monitor.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/monitor.py
diff --git a/external_libs/python/zmq/utils/pyversion_compat.h b/external_libs/python/pyzmq-14.7.0/zmq/utils/pyversion_compat.h
index fac09046..fac09046 100644
--- a/external_libs/python/zmq/utils/pyversion_compat.h
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/pyversion_compat.h
diff --git a/external_libs/python/zmq/utils/sixcerpt.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/sixcerpt.py
index 5492fd59..5492fd59 100644
--- a/external_libs/python/zmq/utils/sixcerpt.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/sixcerpt.py
diff --git a/external_libs/python/zmq/utils/strtypes.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/strtypes.py
index 548410dc..548410dc 100644
--- a/external_libs/python/zmq/utils/strtypes.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/strtypes.py
diff --git a/external_libs/python/zmq/utils/win32.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/win32.py
index ea758299..ea758299 100644
--- a/external_libs/python/zmq/utils/win32.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/win32.py
diff --git a/external_libs/python/zmq/utils/z85.py b/external_libs/python/pyzmq-14.7.0/zmq/utils/z85.py
index 1bb1784e..1bb1784e 100644
--- a/external_libs/python/zmq/utils/z85.py
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/z85.py
diff --git a/external_libs/python/zmq/utils/zmq_compat.h b/external_libs/python/pyzmq-14.7.0/zmq/utils/zmq_compat.h
index 81c57b69..c263cbd8 100644
--- a/external_libs/python/zmq/utils/zmq_compat.h
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/zmq_compat.h
@@ -22,7 +22,7 @@
// define fd type (from libzmq's fd.hpp)
#ifdef _WIN32
- #ifdef _MSC_VER && _MSC_VER <= 1400
+ #if defined(_MSC_VER) && _MSC_VER <= 1400
#define ZMQ_FD_T UINT_PTR
#else
#define ZMQ_FD_T SOCKET
diff --git a/external_libs/python/zmq/utils/zmq_constants.h b/external_libs/python/pyzmq-14.7.0/zmq/utils/zmq_constants.h
index 97683022..56c5691a 100644
--- a/external_libs/python/zmq/utils/zmq_constants.h
+++ b/external_libs/python/pyzmq-14.7.0/zmq/utils/zmq_constants.h
@@ -398,10 +398,6 @@
#define ZMQ_FD (_PYZMQ_UNDEFINED)
#endif
-#ifndef ZMQ_IDENTITY_FD
- #define ZMQ_IDENTITY_FD (_PYZMQ_UNDEFINED)
-#endif
-
#ifndef ZMQ_RECONNECT_IVL_MAX
#define ZMQ_RECONNECT_IVL_MAX (_PYZMQ_UNDEFINED)
#endif
diff --git a/external_libs/python/pyzmq-14.7.0/zmqversion.py b/external_libs/python/pyzmq-14.7.0/zmqversion.py
new file mode 100644
index 00000000..0b98ca13
--- /dev/null
+++ b/external_libs/python/pyzmq-14.7.0/zmqversion.py
@@ -0,0 +1,119 @@
+"""A simply script to scrape zmq.h for the zeromq version.
+This is similar to the version.sh script in a zeromq source dir, but
+it searches for an installed header, rather than in the current dir.
+"""
+
+# Copyright (c) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+
+from __future__ import with_statement
+
+import os
+import sys
+import re
+import traceback
+
+from warnings import warn
+try:
+ from configparser import ConfigParser
+except:
+ from ConfigParser import ConfigParser
+
+pjoin = os.path.join
+
+MAJOR_PAT='^#define +ZMQ_VERSION_MAJOR +[0-9]+$'
+MINOR_PAT='^#define +ZMQ_VERSION_MINOR +[0-9]+$'
+PATCH_PAT='^#define +ZMQ_VERSION_PATCH +[0-9]+$'
+
+def include_dirs_from_path():
+ """Check the exec path for include dirs."""
+ include_dirs = []
+ for p in os.environ['PATH'].split(os.path.pathsep):
+ if p.endswith('/'):
+ p = p[:-1]
+ if p.endswith('bin'):
+ include_dirs.append(p[:-3]+'include')
+ return include_dirs
+
+def default_include_dirs():
+ """Default to just /usr/local/include:/usr/include"""
+ return ['/usr/local/include', '/usr/include']
+
+def find_zmq_version():
+ """check setup.cfg, then /usr/local/include, then /usr/include for zmq.h.
+ Then scrape zmq.h for the version tuple.
+
+ Returns
+ -------
+ ((major,minor,patch), "/path/to/zmq.h")"""
+ include_dirs = []
+
+ if os.path.exists('setup.cfg'):
+ cfg = ConfigParser()
+ cfg.read('setup.cfg')
+ if 'build_ext' in cfg.sections():
+ items = cfg.items('build_ext')
+ for name,val in items:
+ if name == 'include_dirs':
+ include_dirs = val.split(os.path.pathsep)
+
+ if not include_dirs:
+ include_dirs = default_include_dirs()
+
+ for include in include_dirs:
+ zmq_h = pjoin(include, 'zmq.h')
+ if os.path.isfile(zmq_h):
+ with open(zmq_h) as f:
+ contents = f.read()
+ else:
+ continue
+
+ line = re.findall(MAJOR_PAT, contents, re.MULTILINE)[0]
+ major = int(re.findall('[0-9]+',line)[0])
+ line = re.findall(MINOR_PAT, contents, re.MULTILINE)[0]
+ minor = int(re.findall('[0-9]+',line)[0])
+ line = re.findall(PATCH_PAT, contents, re.MULTILINE)[0]
+ patch = int(re.findall('[0-9]+',line)[0])
+ return ((major,minor,patch), zmq_h)
+
+ raise IOError("Couldn't find zmq.h")
+
+def ver_str(version):
+ """version tuple as string"""
+ return '.'.join(map(str, version))
+
+def check_zmq_version(min_version):
+ """Check that zmq.h has an appropriate version."""
+ sv = ver_str(min_version)
+ try:
+ found, zmq_h = find_zmq_version()
+ sf = ver_str(found)
+ if found < min_version:
+ print ("This pyzmq requires zeromq >= %s"%sv)
+ print ("but it appears you are building against %s"%zmq_h)
+ print ("which has zeromq %s"%sf)
+ sys.exit(1)
+ except IOError:
+ msg = '\n'.join(["Couldn't find zmq.h to check for version compatibility.",
+ "If you see 'undeclared identifier' errors, your ZeroMQ is likely too old.",
+ "This pyzmq requires zeromq >= %s"%sv])
+ warn(msg)
+ except IndexError:
+ msg = '\n'.join(["Couldn't find ZMQ_VERSION macros in zmq.h to check for version compatibility.",
+ "This probably means that you have ZeroMQ <= 2.0.9",
+ "If you see 'undeclared identifier' errors, your ZeroMQ is likely too old.",
+ "This pyzmq requires zeromq >= %s"%sv])
+ warn(msg)
+ except Exception:
+ traceback.print_exc()
+ msg = '\n'.join(["Unexpected Error checking for zmq version.",
+ "If you see 'undeclared identifier' errors, your ZeroMQ is likely too old.",
+ "This pyzmq requires zeromq >= %s"%sv])
+ warn(msg)
+
+if __name__ == '__main__':
+ v,h = find_zmq_version()
+ print (h)
+ print (ver_str(v))
+
+
diff --git a/external_libs/python/zmq/backend/cython/_device.py b/external_libs/python/zmq/backend/cython/_device.py
deleted file mode 100644
index 3368ca2c..00000000
--- a/external_libs/python/zmq/backend/cython/_device.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'_device.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/backend/cython/_poll.py b/external_libs/python/zmq/backend/cython/_poll.py
deleted file mode 100644
index cb1d5d77..00000000
--- a/external_libs/python/zmq/backend/cython/_poll.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'_poll.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/backend/cython/_version.py b/external_libs/python/zmq/backend/cython/_version.py
deleted file mode 100644
index 08262706..00000000
--- a/external_libs/python/zmq/backend/cython/_version.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'_version.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/backend/cython/constants.py b/external_libs/python/zmq/backend/cython/constants.py
deleted file mode 100644
index ea772ac0..00000000
--- a/external_libs/python/zmq/backend/cython/constants.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'constants.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/backend/cython/context.py b/external_libs/python/zmq/backend/cython/context.py
deleted file mode 100644
index 19f8ec7c..00000000
--- a/external_libs/python/zmq/backend/cython/context.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'context.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/backend/cython/error.py b/external_libs/python/zmq/backend/cython/error.py
deleted file mode 100644
index d3a4ea0e..00000000
--- a/external_libs/python/zmq/backend/cython/error.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'error.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/backend/cython/message.py b/external_libs/python/zmq/backend/cython/message.py
deleted file mode 100644
index 5e423b62..00000000
--- a/external_libs/python/zmq/backend/cython/message.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'message.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/backend/cython/socket.py b/external_libs/python/zmq/backend/cython/socket.py
deleted file mode 100644
index faef8bee..00000000
--- a/external_libs/python/zmq/backend/cython/socket.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'socket.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/backend/cython/utils.py b/external_libs/python/zmq/backend/cython/utils.py
deleted file mode 100644
index fe928300..00000000
--- a/external_libs/python/zmq/backend/cython/utils.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'utils.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/devices/monitoredqueue.py b/external_libs/python/zmq/devices/monitoredqueue.py
deleted file mode 100644
index 6d714e51..00000000
--- a/external_libs/python/zmq/devices/monitoredqueue.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def __bootstrap__():
- global __bootstrap__, __loader__, __file__
- import sys, pkg_resources, imp
- __file__ = pkg_resources.resource_filename(__name__,'monitoredqueue.so')
- __loader__ = None; del __bootstrap__, __loader__
- imp.load_dynamic(__name__,__file__)
-__bootstrap__()
diff --git a/external_libs/python/zmq/utils/compiler.json b/external_libs/python/zmq/utils/compiler.json
deleted file mode 100644
index e58fc130..00000000
--- a/external_libs/python/zmq/utils/compiler.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "extra_link_args": [],
- "define_macros": [
- [
- "HAVE_SYS_UN_H",
- 1
- ]
- ],
- "runtime_library_dirs": [
- "$ORIGIN/.."
- ],
- "libraries": [
- "zmq"
- ],
- "library_dirs": [
- "zmq"
- ],
- "include_dirs": [
- "/auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/bpsim/main/src/zmq/include",
- "zmq/utils",
- "zmq/backend/cython",
- "zmq/devices"
- ]
-} \ No newline at end of file
diff --git a/external_libs/python/zmq/utils/config.json b/external_libs/python/zmq/utils/config.json
deleted file mode 100644
index 1e4611f9..00000000
--- a/external_libs/python/zmq/utils/config.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "have_sys_un_h": true,
- "zmq_prefix": "/auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/bpsim/main/src/zmq",
- "no_libzmq_extension": true,
- "libzmq_extension": false,
- "easy_install": {},
- "bdist_egg": {},
- "skip_check_zmq": false,
- "build_ext": {}
-} \ No newline at end of file