# 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 C, ffi, cdef

__doc__ = """
The zsocket class provides helper functions for 0MQ sockets. It
doesn't wrap the 0MQ socket type, to avoid breaking all libzmq
socket-related calls.
"""

# This port range is defined by IANA for dynamic or private ports
# We use this when choosing a port for dynamic binding.
DYNFROM = 49152
DYNTO = 65535


@cdef('void zsocket_destroy (zctx_t *self, void *socket);')
def destroy(ctx, socket):
    """Destroy a socket within our CZMQ context.

    'pyczmq.zsocket.new' automatically registers this destructor with
    the garbage collector, so this is normally not necessary to use,
    unless you need to destroy sockets created by some other means
    (like a call directly to 'pyczmq.C.zsocket_new')
    """

# 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/zsocket.py
from pyczmq._cffi import C, ffi, cdef


__doc__ = """
The zsocket class provides helper functions for 0MQ sockets. It
doesn't wrap the 0MQ socket type, to avoid breaking all libzmq
socket-related calls.
"""

# This port range is defined by IANA for dynamic or private ports
# We use this when choosing a port for dynamic binding.
DYNFROM = 49152
DYNTO = 65535


@cdef('void zsocket_destroy (zctx_t *self, void *socket);')
def destroy(ctx, socket):
    """Destroy a socket within our CZMQ context.

    'pyczmq.zsocket.new' automatically registers this destructor with
    the garbage collector, so this is normally not necessary to use,
    unless you need to destroy sockets created by some other means
    (like a call directly to 'pyczmq.C.zsocket_new')
    """

    C.zsocket_destroy(ctx, socket)