# Path: pyczmq/_cffi.py
# C = ffi.dlopen('czmq')
# Z = ffi.dlopen('zmq')
# def ptop(typ, val):
# def cdef(decl, returns_string=False, nullable=False):
#     def wrap(f):
#         def inner_f(*args):


from pyczmq._cffi import ffi, Z, cdef
PLAIN_PASSWORD = 46
CURVE_SERVER = 47
CURVE_PUBLICKEY = 48
CURVE_SECRETKEY = 49
CURVE_SERVERKEY = 50
PROBE_ROUTER = 51
REQ_CORRELATE = 52
REQ_RELAXED = 53
CONFLATE = 54
ZAP_DOMAIN = 55

MORE = 1

DONTWAIT = 1
SNDMORE = 2

NULL = 0
PLAIN = 1
CURVE = 2


@cdef('int zmq_errno (void);')
def errno():
    """
    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.
    """

# Path: pyczmq/_cffi.py
# C = ffi.dlopen('czmq')
# Z = ffi.dlopen('zmq')
# def ptop(typ, val):
# def cdef(decl, returns_string=False, nullable=False):
#     def wrap(f):
#         def inner_f(*args):


# Path: pyczmq/zmq.py
from pyczmq._cffi import ffi, Z, cdef

PLAIN_PASSWORD = 46
CURVE_SERVER = 47
CURVE_PUBLICKEY = 48
CURVE_SECRETKEY = 49
CURVE_SERVERKEY = 50
PROBE_ROUTER = 51
REQ_CORRELATE = 52
REQ_RELAXED = 53
CONFLATE = 54
ZAP_DOMAIN = 55

MORE = 1

DONTWAIT = 1
SNDMORE = 2

NULL = 0
PLAIN = 1
CURVE = 2


@cdef('int zmq_errno (void);')
def errno():
    """
    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.
    """

    return Z.zmq_errno()