# 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, ptop


CURVE_ALLOW_ANY = "*"


cdef('typedef struct _zauth_t zauth_t;')


@cdef('void zauth_destroy (zauth_t **self_p);')
def destroy(auth):
    """ Destructor """
    C.zauth_destroy(ptop('zauth_t', auth))


@cdef('zauth_t * zauth_new (zctx_t *ctx);')
def new(ctx):
    """
    Install authentication for the specified context. Returns a new
    zauth object that you can use to configure authentication. Note
    that until you add policies, all incoming NULL connections are
    allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE
    connections are denied. If there was an error during
    initialization, returns NULL.
    """

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



CURVE_ALLOW_ANY = "*"


cdef('typedef struct _zauth_t zauth_t;')


@cdef('void zauth_destroy (zauth_t **self_p);')
def destroy(auth):
    """ Destructor """
    C.zauth_destroy(ptop('zauth_t', auth))


@cdef('zauth_t * zauth_new (zctx_t *ctx);')
def new(ctx):
    """
    Install authentication for the specified context. Returns a new
    zauth object that you can use to configure authentication. Note
    that until you add policies, all incoming NULL connections are
    allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE
    connections are denied. If there was an error during
    initialization, returns NULL.
    """

    return ffi.gc(C.zauth_new(ctx), destroy)