o
    ṏiL                     @   sp   U d Z ddlmZmZmZ ddlmZ ddlmZ dd Z	dd	 Z
d
d Zdd ZeejZeed< g dZdS )z miscellaneous zmq_utils wrapping    )InterruptedSystemCall	_check_rc_check_version   )ffi)libc                 C   s,   t dd t| tr| d} tt| S )zxCheck for zmq capability by name (e.g. 'ipc', 'curve')

    .. versionadded:: libzmq-4.1
    .. versionadded:: 14.1
    )   r   zzmq.hasutf8)r   
isinstancestrencodeboolCzmq_has)
capability r   S/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/zmq/backend/cffi/utils.pyhas   s   


r   c                  C   sL   t d} t d}t| |}t| t | dd t |dd fS )u  generate a Z85 key pair for use with zmq.CURVE security

    Requires libzmq (≥ 4.0) to have been built with CURVE support.

    Returns
    -------
    (public, secret) : two bytestrings
        The public and private key pair as 40 byte z85-encoded bytestrings.
    char[64]N(   )r   newr   zmq_curve_keypairr   buffer)publicprivatercr   r   r   curve_keypair   s
   


$r   c                 C   sN   t | tr
| d} tdd td}t|| }t| t	|dd S )un  Compute the public key corresponding to a private key for use
    with zmq.CURVE security

    Requires libzmq (≥ 4.2) to have been built with CURVE support.

    Parameters
    ----------
    private
        The private key as a 40 byte z85-encoded bytestring
    Returns
    -------
    bytestring
        The public key as a 40 byte z85-encoded bytestring.
    r	   )r      curve_publicr   Nr   )
r
   r   r   r   r   r   r   zmq_curve_publicr   r   )r   r   r   r   r   r   r   )   s   



r   c                 O   s.   	 | | }zt | W 	 |S  ty   Y q w )z/make a call, retrying if interrupted with EINTR)r   r   )fargskwargsr   r   r   r   _retry_sys_callA   s   
r#   PYZMQ_DRAFT_API)r   r   r   r$   N)__doc__	zmq.errorr   r   r   _cffir   r   r   r   r   r   r#   r   r$   __annotations____all__r   r   r   r   <module>   s    