509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
 Ü³j ã            $   @   s†  d dl mZ edskr&dd„ Zeƒ Z[n"edtkr@dd„ Zeƒ Z[nd dlZ[yeZW n ek
rf   Y nX yd dlZ	W n e
k
r�   d dl	Z	Y nX dud
d„Zdd„ Zdd„ Zdd„ ZyeZd	ZW n( e	jk
rè   G dd„ dƒZd ZY nX d dlZyd dlZW n e
k
�r   d dl	ZY nX deƒ k�r.eZdd„ Zdd„ ZejZejZejZejZejZejZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%ej&Z&ej'Z'ej(Z(ej)Z)ej*Z*ej+Z+ej,Z,ej-Z-ej.Z.ej/Z/ej0Z0ej1Z1ej2Z2ej3Z3ej4Z4ej5Z5ej6Z6ej7Z7ej8Z8ej9Z9ej:Z:ej;Z;ej<Z<ej=Z=ej>Z>ej?Z?ej@Z@ejAZAejBZBejCZCejDZDejEZEejFZFejGZGejHZHejIZIejJZJejKZKejLZLejMZMejNZNejOZOejPZPejQZQejRZRejSZSejTZTejUZUejVZVejWZWejXZXejYZYejZZZej[Z[ej\Z\ej]Z]dd„ Z^ej^Z^ej_Z_ej`Z`ejaZaejbZbejcZcejdZdejeZeejfZfejgZgejhZhejiZiG dd„ dƒZjejkZkejlZlejmZmejnZnejoZoejpZpG dd„ deƒZqejrZrereqƒ ejsZsejtZtejuZuejvZvejwZwejxZxejyZyejzZzej{Z{ej|Z|ej}Z}dd „ Z~ej~Z~d!d"„ ZejZd#d$„ Z€ej€Z€d%d&„ Z�ej�Z�d'd(„ Z‚ej‚Z‚d)d*„ ZƒejƒZƒd+d,„ Z„ej„Z„d-d.„ Z…ej…Z…d/d0„ Z†ej†Z†d1d2„ Z‡ej‡Z‡d3d4„ ZˆejˆZˆd5d6„ Z‰ej‰Z‰d7d8„ ZŠejŠZŠd9d:„ Z‹ej‹Z‹d;d<„ ZŒejŒZŒd=d>„ Z�ej�Z�d?d@„ ZŽejŽZŽdAdB„ Z�ej�Z�dCdD„ Z�ej�Z�dEdF„ Z‘ej‘Z‘dGdH„ Z’ej’Z’dIdJ„ Z“ej“Z“dKdL„ Z”ej”Z”dMdN„ Z•ej•Z•dOdP„ Z–ej–Z–dQdR„ Z—ej—Z—dSdT„ Z˜ej˜Z˜dUdV„ Z™ej™Z™dWdX„ ZšejšZšdYdZ„ Z›ej›Z›d[d\„ ZœejœZœG d]d^„ d^eƒZ�ejžZžeže�ƒ G d_d`„ d`eƒZŸej Z e eŸƒ G dadb„ dbeƒZ¡ej¢Z¢e¢e¡ƒ ej£Z£ej¤Z¤ej¥Z¥ej¦Z¦ej§Z§ej¨Z¨G dcdd„ ddeƒZ©ejªZªeªe©ƒ G dedf„ dfeƒZ«ej¬Z¬e¬e«ƒ G dgdh„ dheƒZ­ej®Z®e®e­ƒ didj„ Z¯ej¯Z¯dkdl„ Z°ej°Z°ej°Z“dmdn„ Z±dodp„ Z²dqdr„ Z³dS )vé    )Úversion_infoé   é   c              C   sT   dd l } tjdƒd }dj|dfƒjdƒ}y
| j|ƒS  tk
rN   | jdƒS X d S )Nr   Ú.Ú_unbound)Ú	importlibÚ__name__Ú
rpartitionÚjoinÚlstripÚimport_moduleÚImportError)r   ZpkgZmname© r   ú/usr/lib64/python3.6/unbound.pyÚswig_import_helper	   s    
r   é   c              C   s~   ddl m}  dd l}d }y|jd| tƒgƒ\}}}W n tk
rP   dd l}|S X z|jd|||ƒ}W d |d k	rx|jƒ  X |S )Nr   )Údirnamer   )	Zos.pathr   ÚimpÚfind_moduleÚ__file__r   r   Úload_moduleÚclose)r   r   ÚfpÚpathnameÚdescriptionr   Z_modr   r   r   r      s    
Né   c             C   sˆ   |dkr| j j|ƒS |dkr8t|ƒjdkr8|| j|< d S |jj|d ƒ}|rT|| |ƒS |sxtrltj	| ||ƒ q„|| j|< nt
d|  ƒ‚d S )NÚthisownÚthisZSwigPyObjectzYou cannot add attributes to %s)r   ÚownÚtyper   Ú__dict__Ú__swig_setmethods__ÚgetÚ	_newclassÚobjectÚ__setattr__ÚAttributeError)ÚselfÚ
class_typeÚnameÚvalueZstaticÚmethodr   r   r   Ú_swig_setattr_nondynamic3   s    

r,   c             C   s   t | |||dƒS )Nr   )r,   )r'   r(   r)   r*   r   r   r   Ú_swig_setattrF   s    r-   c             C   sB   |dkr| j jƒ S |jj|d ƒ}|r,|| ƒS td|j|f ƒ‚d S )Nr   z!'%s' object has no attribute '%s')r   r   Ú__swig_getmethods__r"   r&   r   )r'   r(   r)   r+   r   r   r   Ú_swig_getattrJ   s    
r/   c             C   sD   yd| j jƒ  }W n tjk
r,   d}Y nX d| jj| jj|f S )Nz	proxy of Ú z<%s.%s; %s >)r   Ú__repr__Ú__builtin__Ú	ExceptionÚ	__class__Ú
__module__r   )r'   Zstrthisr   r   r   Ú
_swig_reprS   s
    
r6   c               @   s   e Zd ZdS )Ú_objectN)r   r5   Ú__qualname__r   r   r   r   r7   ^   s   r7   Úbytesc             C   s   t | tƒr| S tj| ƒS )N)Ú
isinstanceÚintÚbuiltinsÚord)Úsr   r   r   r=   m   s    
r=   c             C   s
   t j| ƒS )N)r   Úub_ctx_free_dbg)Úcr   r   r   r?   s   s    r?   c             C   s
   t j| ƒS )N)r   Úub_resolve_free_dbg)Úrr   r   r   rA   »   s    rA   c               @   s¦   e Zd ZdZdd„ Zdd„ Zeddd„ƒZd	d
„ Ze	edd�Z
dd„ Ze	edd�Zdd„ Ze	edd�Zdd„ Ze	edd�Zdd„ Ze	edd�Zdd„ Ze	edd�ZdS )Úub_dataz3Class which makes the resolution results accessiblec             C   s   |dkrt dƒ‚|| _dS )zZCreates ub_data class
         :param data: a list of the result data in RAW format
      Nzub_data init: No data)r3   Údata)r'   rD   r   r   r   Ú__init__Ì   s    zub_data.__init__c             C   s   dj dd„ | jD ƒƒS )zRepresents data as stringú;c             S   s    g | ]}d j tdd„ |ƒƒ‘qS )ú c             S   s   dt | ƒ S )Nz%02X)r=   )Úxr   r   r   Ú<lambda>Ö   s    z,ub_data.__str__.<locals>.<listcomp>.<lambda>)r
   Úmap)Ú.0Úar   r   r   ú
<listcomp>Ö   s    z#ub_data.__str__.<locals>.<listcomp>)r
   rD   )r'   r   r   r   Ú__str__Ô   s    zub_data.__str__r   c             C   sz   | sg S g }t | ƒ}|dkr&t||ƒ}|}xJ||k rtt| | ƒ}|jt| |d |d | … jƒ ƒƒ ||d 7 }q,W |S )zäParses DNAME and produces a list of labels

         :param ofs: where the conversion should start to parse data
         :param maxlen: maximum length (0 means parse to the end)
         :returns: list of labels (string)
      r   r   )ÚlenÚminr=   ÚappendÚstrÚdecode)r>   ZofsÚmaxlenÚresZslenÚidxZcomplenr   r   r   Ú	dname2strØ   s    

&zub_data.dname2strc             C   s   | j S )zReturns a list of RAW strings)rD   )r'   r   r   r   Úas_raw_datañ   s    zub_data.as_raw_datazLReturns RAW data (a list of binary encoded strings). See :meth:`as_raw_data`)Údocc                s   ‡ fdd„ˆ j D ƒS )zzRepresents data as a list of MX records (query for RR_TYPE_MX)

         :returns: list of tuples (priority, dname)
      c                sD   g | ]<}d t |d ƒ t |d ƒ djdd„ ˆ j|dƒD ƒƒf‘qS )é   r   r   r   c             S   s   g | ]}|‘qS r   r   )rK   rL   r   r   r   rM   ü   s    z1ub_data.as_mx_list.<locals>.<listcomp>.<listcomp>r   )r=   r
   rW   )rK   Úrdf)r'   r   r   rM   ü   s    z&ub_data.as_mx_list.<locals>.<listcomp>)rD   )r'   r   )r'   r   Ú
as_mx_list÷   s    zub_data.as_mx_listzUReturns a list of tuples containing priority and domain names. See :meth:`as_mx_list`c                s   ‡ fdd„ˆ j D ƒS )z‚Represents data as a list of MX records (query for RR_TYPE_MX)

         :returns: list of tuples (priority, unicode dname)
      c                sD   g | ]<}d t |d ƒ t |d ƒ djdd„ ˆ j|dƒD ƒƒf‘qS )rZ   r   r   r   c             S   s   g | ]}t jj|ƒ‘qS r   )Ú	encodingsÚidnaÚ	ToUnicode)rK   rL   r   r   r   rM     s    z5ub_data.as_idn_mx_list.<locals>.<listcomp>.<listcomp>r   )r=   r
   rW   )rK   r[   )r'   r   r   rM     s    z*ub_data.as_idn_mx_list.<locals>.<listcomp>)rD   )r'   r   )r'   r   Úas_idn_mx_list   s    zub_data.as_idn_mx_listz]Returns a list of tuples containing priority and IDN domain names. See :meth:`as_idn_mx_list`c             C   s   dd„ | j D ƒS )zlRepresents data as a list of IP addresses (query for RR_TYPE_PTR)

         :returns: list of strings
      c             S   s    g | ]}d j tdd„ |ƒƒ‘qS )r   c             S   s   t t| ƒƒS )N)rR   r=   )rH   r   r   r   rI     s    z4ub_data.as_address_list.<locals>.<listcomp>.<lambda>)r
   rJ   )rK   rL   r   r   r   rM     s    z+ub_data.as_address_list.<locals>.<listcomp>)rD   )r'   r   r   r   Úas_address_list	  s    zub_data.as_address_listz;Returns a list of IP addresses. See :meth:`as_address_list`c                s   t ‡ fdd„ˆ jƒS )zjRepresents data as a list of domain names (query for RR_TYPE_A)

         :returns: list of strings
      c                s   dj ˆ j| ƒƒS )Nr   )r
   rW   )rH   )r'   r   r   rI     s    z(ub_data.as_domain_list.<locals>.<lambda>)rJ   rD   )r'   r   )r'   r   Úas_domain_list  s    zub_data.as_domain_listz:Returns a list of domain names. See :meth:`as_domain_list`c                s   t ‡ fdd„ˆ jƒS )zrRepresents data as a list of unicode domain names (query for RR_TYPE_A)

         :returns: list of strings
      c                s   dj dd„ ˆ j| ƒD ƒƒS )Nr   c             S   s   g | ]}t jj|ƒ‘qS r   )r]   r^   r_   )rK   rL   r   r   r   rM      s    z@ub_data.as_idn_domain_list.<locals>.<lambda>.<locals>.<listcomp>)r
   rW   )rH   )r'   r   r   rI      s    z,ub_data.as_idn_domain_list.<locals>.<lambda>)rJ   rD   )r'   r   )r'   r   Úas_idn_domain_list  s    zub_data.as_idn_domain_listzBReturns a list of IDN domain names. See :meth:`as_idn_domain_list`N)r   r   )r   r5   r8   Ú__doc__rE   rN   ÚstaticmethodrW   rX   ÚpropertyÚrawr\   Zmx_listr`   Zmx_list_idnra   Zaddress_listrb   Zdomain_listrc   Zdomain_list_idnr   r   r   r   rC   Ê   s"   rC   c               @   s8  e Zd ZdZi Zdd„ Zi Zdd„ Zdd„ Ze	Z
ejed< ejed< erVeejejƒZejed< ejed< er|eejejƒZejed	< ejed	< er¢eejejƒZejed
< ejed
< erÈeejejƒZejed< ejed< erîeejejƒZejed< ejed< e�reejejƒZej ed< ej!ed< e�r>eej!ej ƒZ"ej#ed< ej$ed< e�rfeej$ej#ƒZ%ej&ed< ej'ed< e�rŽeej'ej&ƒZ(ej)ed< ej*ed< e�r¶eej*ej)ƒZ+ej,ed< ej-ed< e�rÞeej-ej,ƒZ.ej/ed< ej0ed< e�reej0ej/ƒZ1ej2ed< ej3ed< e�r.eej3ej2ƒZ4ej5ed< ej6ed< e�rVeej6ej5ƒZ7ej8ed< ej9ed< e�r~eej9ej8ƒZ:ej;ed< ej<ed< e�r¦eej<ej;ƒZ=dd„ Z>dd„ Z?dd„ Zej@ZAeBdeCdeDdeEdeFd eGd!eHd"eId#eJd$eKd%eLd&iZMd'd(„ ZNeOeNƒZPd)d*„ ZQeOeQd+d,�ZRd-d.„ ZSeOe?ƒZTeOeSd/d,�ZUd0S )1Ú	ub_resultz&The validation and resolution results.c             C   s   t | t||ƒS )N)r-   rh   )r'   r)   r*   r   r   r   rI   .  s    zub_result.<lambda>c             C   s   t | t|ƒS )N)r/   rh   )r'   r)   r   r   r   rI   0  s    c             O   s   t dƒ‚d S )NzNo constructor defined)r&   )r'   ÚargsÚkwargsr   r   r   rE   2  s    zub_result.__init__ÚqnameÚqtypeÚqclassÚ_datarO   Ú	canonnameÚrcodeÚanswer_packetÚ
answer_lenÚhavedataÚnxdomainÚsecureÚbogusÚ	why_bogusÚttlÚwas_ratelimitedc             C   s   t j| |ƒS )N)r   Zub_result__ub_result_data)r'   Úresultr   r   r   Ú_ub_result_datav  s    zub_result._ub_result_datac             C   s
   t j| ƒS )N)r   Zub_result__packet)r'   r   r   r   Ú_packety  s    zub_result._packetc             C   s   t dƒ‚d S )Nz%This class can't be created directly.)r3   )r'   r   r   r   rE   |  s    zno errorz
form errorz	serv failz	nx domainznot implementedZrefusedZyxdomainZyxrrsetZnxrrsetznot authznot zonec             C   s   | j | j S )zRReturns rcode in display representation form

           :returns: string
        )Ú	rcode2strrp   )r'   r   r   r   Ú_get_rcode_str†  s    zub_result._get_rcode_strc             C   s
   | j | ƒS )a  Result data, a list of network order DNS rdata items. 

           Data are represented as a list of strings. To decode RAW data to the list of IP addresses use :attr:`data` attribute which returns an :class:`ub_data` instance containing conversion function.
        )r{   )r'   r   r   r   Ú_get_raw_data�  s    zub_result._get_raw_dataz­Returns raw data, a list of rdata items. To decode RAW data use the :attr:`data` attribute which returns an instance of :class:`ub_data` containing the conversion functions.)rY   c             C   s   | j s
d S t| j| ƒƒS )N)rs   rC   r{   )r'   r   r   r   Ú	_get_data˜  s     zub_result._get_datazOReturns :class:`ub_data` instance containing various decoding functions or NoneN)Vr   r5   r8   rd   r!   r%   r.   Ú__getattr__rE   r6   r1   r   Zub_result_qname_setZub_result_qname_getr#   Ú_swig_propertyrk   Zub_result_qtype_setZub_result_qtype_getrl   Zub_result_qclass_setZub_result_qclass_getrm   Zub_result__data_setZub_result__data_getrn   Zub_result_len_setZub_result_len_getrO   Zub_result_canonname_setZub_result_canonname_getro   Zub_result_rcode_setZub_result_rcode_getrp   Zub_result_answer_packet_setZub_result_answer_packet_getrq   Zub_result_answer_len_setZub_result_answer_len_getrr   Zub_result_havedata_setZub_result_havedata_getrs   Zub_result_nxdomain_setZub_result_nxdomain_getrt   Zub_result_secure_setZub_result_secure_getru   Zub_result_bogus_setZub_result_bogus_getrv   Zub_result_why_bogus_setZub_result_why_bogus_getrw   Zub_result_ttl_setZub_result_ttl_getrx   Zub_result_was_ratelimited_setZub_result_was_ratelimited_getry   r{   r|   Ú_ub_resolve_freeÚ__swig_destroy__ÚRCODE_NOERRORÚRCODE_FORMERRÚRCODE_SERVFAILÚRCODE_NXDOMAINÚRCODE_NOTIMPLÚRCODE_REFUSEDÚRCODE_YXDOMAINÚRCODE_YXRRSETÚRCODE_NXRRSETÚRCODE_NOTAUTHÚRCODE_NOTZONEr}   r~   rf   Z	rcode_strr   Zrawdatar€   ZpacketrD   r   r   r   r   rh   *  s¦   































0rh   c               C   s   t jƒ S )N)r   Úub_ctx_creater   r   r   r   r�   ¯  s    r�   c             C   s
   t j| ƒS )N)r   Ú_ub_ctx_delete)Úctxr   r   r   r‘   ³  s    r‘   c             C   s   t j| ||ƒS )N)r   Úub_ctx_set_option)r’   ÚoptÚvalr   r   r   r“   ·  s    r“   c             C   s   t j| ||ƒS )N)r   Úub_ctx_get_option)r’   r”   rR   r   r   r   r–   »  s    r–   c             C   s   t j| |ƒS )N)r   Úub_ctx_config)r’   Úfnamer   r   r   r—   ¿  s    r—   c             C   s   t j| |ƒS )N)r   Úub_ctx_set_fwd)r’   Úaddrr   r   r   r™   Ã  s    r™   c             C   s   t j| |ƒS )N)r   Úub_ctx_set_tls)r’   Ztlsr   r   r   r›   Ç  s    r›   c             C   s   t j| |||ƒS )N)r   Úub_ctx_set_stub)r’   Zzonerš   Zisprimer   r   r   rœ   Ë  s    rœ   c             C   s   t j| |ƒS )N)r   Úub_ctx_resolvconf)r’   r˜   r   r   r   r�   Ï  s    r�   c             C   s   t j| |ƒS )N)r   Úub_ctx_hosts)r’   r˜   r   r   r   rž   Ó  s    rž   c             C   s   t j| |ƒS )N)r   Úub_ctx_add_ta)r’   Útar   r   r   rŸ   ×  s    rŸ   c             C   s   t j| |ƒS )N)r   Úub_ctx_add_ta_file)r’   r˜   r   r   r   r¡   Û  s    r¡   c             C   s   t j| |ƒS )N)r   Úub_ctx_add_ta_autr)r’   r˜   r   r   r   r¢   ß  s    r¢   c             C   s   t j| |ƒS )N)r   Úub_ctx_trustedkeys)r’   r˜   r   r   r   r£   ã  s    r£   c             C   s   t j| |ƒS )N)r   Úub_ctx_debuglevel)r’   Údr   r   r   r¤   ç  s    r¤   c             C   s   t j| |ƒS )N)r   Úub_ctx_async)r’   Údothreadr   r   r   r¦   ë  s    r¦   c             C   s
   t j| ƒS )N)r   Úub_poll)r’   r   r   r   r¨   ï  s    r¨   c             C   s
   t j| ƒS )N)r   Úub_wait)r’   r   r   r   r©   ó  s    r©   c             C   s
   t j| ƒS )N)r   Úub_fd)r’   r   r   r   rª   ÷  s    rª   c             C   s
   t j| ƒS )N)r   Ú
ub_process)r’   r   r   r   r«   û  s    r«   c             C   s   t j| |||ƒS )N)r   Ú
ub_resolve)r’   r)   ÚrrtypeÚrrclassr   r   r   r¬   ÿ  s    r¬   c             C   s   t j| ||||||ƒS )N)r   Úub_resolve_async)r’   r)   r­   r®   ÚmydataÚcallbackÚasync_idr   r   r   r¯     s    r¯   c             C   s   t j| |ƒS )N)r   Ú	ub_cancel)r’   r²   r   r   r   r³     s    r³   c             C   s
   t j| ƒS )N)r   rƒ   )rz   r   r   r   rƒ     s    rƒ   c             C   s
   t j| ƒS )N)r   Úub_strerror)Úerrr   r   r   r´     s    r´   c             C   s
   t j| ƒS )N)r   Úub_ctx_print_local_zones)r’   r   r   r   r¶     s    r¶   c             C   s   t j| ||ƒS )N)r   Úub_ctx_zone_add)r’   Ú	zone_nameZ	zone_typer   r   r   r·     s    r·   c             C   s   t j| |ƒS )N)r   Úub_ctx_zone_remove)r’   r¸   r   r   r   r¹     s    r¹   c             C   s   t j| |ƒS )N)r   Úub_ctx_data_add)r’   rD   r   r   r   rº     s    rº   c             C   s   t j| |ƒS )N)r   Úub_ctx_data_remove)r’   rD   r   r   r   r»   #  s    r»   c               C   s   t jƒ S )N)r   Ú
ub_versionr   r   r   r   r¼   '  s    r¼   c               @   s”   e Zd Zi Zdd„ Zi Zdd„ ZeZe	j
ed< e	jed< erJee	je	j
ƒZe	jed< erbee	jƒZe	jed< erzee	jƒZdd„ Ze	jZd	d„ Zd
S )Úub_shm_stat_infoc             C   s   t | t||ƒS )N)r-   r½   )r'   r)   r*   r   r   r   rI   ,  s    zub_shm_stat_info.<lambda>c             C   s   t | t|ƒS )N)r/   r½   )r'   r)   r   r   r   rI   .  s    Únum_threadsÚtimeÚmemc             C   s:   t jƒ }y| jj|ƒ W n tjk
r4   || _Y nX d S )N)r   Znew_ub_shm_stat_infor   rQ   r2   r3   )r'   r   r   r   r   rE   ;  s
    zub_shm_stat_info.__init__c             C   s   d S )Nr   )r'   r   r   r   rI   B  s    N)r   r5   r8   r!   r%   r.   r�   r6   r1   r   Z ub_shm_stat_info_num_threads_setZ ub_shm_stat_info_num_threads_getr#   r‚   r¾   Zub_shm_stat_info_time_getr¿   Zub_shm_stat_info_mem_getrÀ   rE   Zdelete_ub_shm_stat_infor„   Ú__del__r   r   r   r   r½   *  s$   





r½   c               @   sÄ  e Zd Zi Zdd„ Zi Zdd„ ZeZe	j
ed< e	jed< erJee	je	j
ƒZe	jed< e	jed< erpee	je	jƒZe	jed< e	jed< er–ee	je	jƒZe	jed< e	jed< er¼ee	je	jƒZe	jed< e	jed< erâee	je	jƒZe	jed	< e	jed	< e�r
ee	je	jƒZe	jed
< e	jed
< e�r2ee	je	jƒZ e	j!ed< e	j"ed< e�rZee	j"e	j!ƒZ#e	j$ed< e	j%ed< e�r‚ee	j%e	j$ƒZ&e	j'ed< e	j(ed< e�rªee	j(e	j'ƒZ)dd„ Z*e	j+Z,dd„ Z-dS )Úub_shm_stat_info_memc             C   s   t | t||ƒS )N)r-   rÂ   )r'   r)   r*   r   r   r   rI   H  s    zub_shm_stat_info_mem.<lambda>c             C   s   t | t|ƒS )N)r/   rÂ   )r'   r)   r   r   r   rI   J  s    ÚmsgÚrrsetr•   ÚiterÚsubnetÚipsecmodÚrespipÚdnscrypt_shared_secretÚdnscrypt_nonceÚdynlibc             C   s:   t jƒ }y| jj|ƒ W n tjk
r4   || _Y nX d S )N)r   Znew_ub_shm_stat_info_memr   rQ   r2   r3   )r'   r   r   r   r   rE   u  s
    zub_shm_stat_info_mem.__init__c             C   s   d S )Nr   )r'   r   r   r   rI   |  s    N).r   r5   r8   r!   r%   r.   r�   r6   r1   r   Zub_shm_stat_info_mem_msg_setZub_shm_stat_info_mem_msg_getr#   r‚   rÃ   Zub_shm_stat_info_mem_rrset_setZub_shm_stat_info_mem_rrset_getrÄ   Zub_shm_stat_info_mem_val_setZub_shm_stat_info_mem_val_getr•   Zub_shm_stat_info_mem_iter_setZub_shm_stat_info_mem_iter_getrÅ   Zub_shm_stat_info_mem_subnet_setZub_shm_stat_info_mem_subnet_getrÆ   Z!ub_shm_stat_info_mem_ipsecmod_setZ!ub_shm_stat_info_mem_ipsecmod_getrÇ   Zub_shm_stat_info_mem_respip_setZub_shm_stat_info_mem_respip_getrÈ   Z/ub_shm_stat_info_mem_dnscrypt_shared_secret_setZ/ub_shm_stat_info_mem_dnscrypt_shared_secret_getrÉ   Z'ub_shm_stat_info_mem_dnscrypt_nonce_setZ'ub_shm_stat_info_mem_dnscrypt_nonce_getrÊ   Zub_shm_stat_info_mem_dynlib_setZub_shm_stat_info_mem_dynlib_getrË   rE   Zdelete_ub_shm_stat_info_memr„   rÁ   r   r   r   r   rÂ   F  s`   



















rÂ   c               @   s$  e Zd Zi Zdd„ Zi Zdd„ ZeZe	j
ed< e	jed< erJee	je	j
ƒZe	jed< e	jed< erpee	je	jƒZe	jed< e	jed< er–ee	je	jƒZe	jed< e	jed< er¼ee	je	jƒZe	jed< e	jed< erâee	je	jƒZe	jed	< e	jed	< e�r
ee	je	jƒZd
d„ Ze	jZ dd„ Z!dS )Úub_shm_stat_info_timec             C   s   t | t||ƒS )N)r-   rÌ   )r'   r)   r*   r   r   r   rI   ‚  s    zub_shm_stat_info_time.<lambda>c             C   s   t | t|ƒS )N)r/   rÌ   )r'   r)   r   r   r   rI   „  s    Únow_secÚnow_usecÚup_secÚup_usecÚelapsed_secÚelapsed_usecc             C   s:   t jƒ }y| jj|ƒ W n tjk
r4   || _Y nX d S )N)r   Znew_ub_shm_stat_info_timer   rQ   r2   r3   )r'   r   r   r   r   rE   Ÿ  s
    zub_shm_stat_info_time.__init__c             C   s   d S )Nr   )r'   r   r   r   rI   ¦  s    N)"r   r5   r8   r!   r%   r.   r�   r6   r1   r   Z!ub_shm_stat_info_time_now_sec_setZ!ub_shm_stat_info_time_now_sec_getr#   r‚   rÍ   Z"ub_shm_stat_info_time_now_usec_setZ"ub_shm_stat_info_time_now_usec_getrÎ   Z ub_shm_stat_info_time_up_sec_setZ ub_shm_stat_info_time_up_sec_getrÏ   Z!ub_shm_stat_info_time_up_usec_setZ!ub_shm_stat_info_time_up_usec_getrÐ   Z%ub_shm_stat_info_time_elapsed_sec_setZ%ub_shm_stat_info_time_elapsed_sec_getrÑ   Z&ub_shm_stat_info_time_elapsed_usec_setZ&ub_shm_stat_info_time_elapsed_usec_getrÒ   rE   Zdelete_ub_shm_stat_info_timer„   rÁ   r   r   r   r   rÌ   €  s@   











rÌ   c               @   sä	  e Zd Zi Zdd„ Zi Zdd„ ZeZe	j
ed< e	jed< erJee	je	j
ƒZe	jed< e	jed< erpee	je	jƒZe	jed< e	jed< er–ee	je	jƒZe	jed< e	jed< er¼ee	je	jƒZe	jed< e	jed< erâee	je	jƒZe	jed	< e	jed	< e�r
ee	je	jƒZe	jed
< e	jed
< e�r2ee	je	jƒZ e	j!ed< e	j"ed< e�rZee	j"e	j!ƒZ#e	j$ed< e	j%ed< e�r‚ee	j%e	j$ƒZ&e	j'ed< e	j(ed< e�rªee	j(e	j'ƒZ)e	j*ed< e	j+ed< e�rÒee	j+e	j*ƒZ,e	j-ed< e	j.ed< e�rúee	j.e	j-ƒZ/e	j0ed< e	j1ed< e�r"ee	j1e	j0ƒZ2e	j3ed< e	j4ed< e�rJee	j4e	j3ƒZ5e	j6ed< e	j7ed< e�rree	j7e	j6ƒZ8e	j9ed< e	j:ed< e�ršee	j:e	j9ƒZ;e	j<ed< e	j=ed< e�rÂee	j=e	j<ƒZ>e	j?ed< e	j@ed< e�rêee	j@e	j?ƒZAe	jBed< e	jCed< e�ree	jCe	jBƒZDe	jEed< e	jFed< e�r:ee	jFe	jEƒZGe	jHed< e	jIed< e�rbee	jIe	jHƒZJe	jKed< e	jLed< e�rŠee	jLe	jKƒZMe	jNed< e	jOed< e�r²ee	jOe	jNƒZPe	jQed< e	jRed< e�rÚee	jRe	jQƒZSe	jTed< e	jUed< e�ree	jUe	jTƒZVe	jWed< e	jXed< e�r*ee	jXe	jWƒZYe	jZed< e	j[ed< e�rRee	j[e	jZƒZ\e	j]ed< e	j^ed< e�rzee	j^e	j]ƒZ_e	j`ed < e	jaed < e�r¢ee	jae	j`ƒZbe	jced!< e	jded!< e�rÊee	jde	jcƒZee	jfed"< e	jged"< e�ròee	jge	jfƒZhe	jied#< e	jjed#< e�ree	jje	jiƒZke	jled$< e	jmed$< e�rBee	jme	jlƒZne	joed%< e	jped%< e�rjee	jpe	joƒZqe	jred&< e	jsed&< e�r’ee	jse	jrƒZte	jued'< e	jved'< e�rºee	jve	juƒZwe	jxed(< e	jyed(< e�râee	jye	jxƒZze	j{ed)< e	j|ed)< e�r
ee	j|e	j{ƒZ}e	j~ed*< e	jed*< e�r2ee	je	j~ƒZ€e	j�ed+< e	j‚ed+< e�rZee	j‚e	j�ƒZƒe	j„ed,< e	j…ed,< e�r‚ee	j…e	j„ƒZ†e	j‡ed-< e	jˆed-< e�rªee	jˆe	j‡ƒZ‰e	jŠed.< e	j‹ed.< e�rÒee	j‹e	jŠƒZŒe	j�ed/< e	jŽed/< e�rúee	jŽe	j�ƒZ�e	j�ed0< e	j‘ed0< e�r"ee	j‘e	j�ƒZ’e	j“ed1< e	j”ed1< e�rJee	j”e	j“ƒZ•e	j–ed2< e	j—ed2< e�rree	j—e	j–ƒZ˜e	j™ed3< e	jšed3< e�ršee	jše	j™ƒZ›e	jœed4< e	j�ed4< e�rÂee	j�e	jœƒZže	jŸed5< e	j ed5< e�rêee	j e	jŸƒZ¡e	j¢ed6< e	j£ed6< e�ree	j£e	j¢ƒZ¤e	j¥ed7< e	j¦ed7< e�r:ee	j¦e	j¥ƒZ§e	j¨ed8< e	j©ed8< e�rbee	j©e	j¨ƒZªe	j«ed9< e	j¬ed9< e�rŠee	j¬e	j«ƒZ­e	j®ed:< e	j¯ed:< e�r²ee	j¯e	j®ƒZ°e	j±ed;< e	j²ed;< e�rÚee	j²e	j±ƒZ³e	j´ed<< e	jµed<< e�	ree	jµe	j´ƒZ¶e	j·ed=< e	j¸ed=< e�	r*ee	j¸e	j·ƒZ¹e	jºed>< e	j»ed>< e�	rRee	j»e	jºƒZ¼e	j½ed?< e	j¾ed?< e�	rzee	j¾e	j½ƒZ¿e	jÀed@< e	jÁed@< e�	r¢ee	jÁe	jÀƒZÂe	jÃedA< e	jÄedA< e�	rÊee	jÄe	jÃƒZÅdBdC„ ZÆe	jÇZÈdDd„ ZÉdES )FÚub_server_statsc             C   s   t | t||ƒS )N)r-   rÓ   )r'   r)   r*   r   r   r   rI   ²  s    zub_server_stats.<lambda>c             C   s   t | t|ƒS )N)r/   rÓ   )r'   r)   r   r   r   rI   ´  s    Únum_queriesÚnum_queries_ip_ratelimitedÚnum_queries_missed_cacheÚnum_queries_prefetchÚsum_query_list_sizeÚmax_query_list_sizeÚextendedrl   Ú	qtype_bigrm   Ú
qclass_bigÚqopcodeÚqtcpÚqtcp_outgoingÚqudp_outgoingÚqtlsÚqhttpsÚqipv6Úqbit_QRÚqbit_AAÚqbit_TCÚqbit_RDÚqbit_RAÚqbit_ZÚqbit_ADÚqbit_CDÚqEDNSÚqEDNS_DOÚ	ans_rcodeÚans_rcode_nodataÚ
ans_secureÚ	ans_bogusÚrrset_bogusÚqueries_ratelimitedÚunwanted_repliesÚunwanted_queriesÚtcp_accept_usageÚans_expiredÚhistÚmsg_cache_countÚrrset_cache_countÚinfra_cache_countÚkey_cache_countÚnum_query_dnscrypt_cryptedÚnum_query_dnscrypt_certÚnum_query_dnscrypt_cleartextÚ$num_query_dnscrypt_crypted_malformedÚ&num_query_dnscrypt_secret_missed_cacheÚshared_secret_cache_countÚnum_query_dnscrypt_replayÚnonce_cache_countÚnum_query_authzone_upÚnum_query_authzone_downÚnum_neg_cache_noerrorÚnum_neg_cache_nxdomainÚnum_query_subnetÚnum_query_subnet_cacheÚmem_stream_waitÚmem_http2_query_bufferÚmem_http2_response_bufferÚqtls_resumeÚ
rpz_actionc             C   s:   t jƒ }y| jj|ƒ W n tjk
r4   || _Y nX d S )N)r   Znew_ub_server_statsr   rQ   r2   r3   )r'   r   r   r   r   rE   ¯  s
    zub_server_stats.__init__c             C   s   d S )Nr   )r'   r   r   r   rI   ¶  s    N)Êr   r5   r8   r!   r%   r.   r�   r6   r1   r   Zub_server_stats_num_queries_setZub_server_stats_num_queries_getr#   r‚   rÔ   Z.ub_server_stats_num_queries_ip_ratelimited_setZ.ub_server_stats_num_queries_ip_ratelimited_getrÕ   Z,ub_server_stats_num_queries_missed_cache_setZ,ub_server_stats_num_queries_missed_cache_getrÖ   Z(ub_server_stats_num_queries_prefetch_setZ(ub_server_stats_num_queries_prefetch_getr×   Z'ub_server_stats_sum_query_list_size_setZ'ub_server_stats_sum_query_list_size_getrØ   Z'ub_server_stats_max_query_list_size_setZ'ub_server_stats_max_query_list_size_getrÙ   Zub_server_stats_extended_setZub_server_stats_extended_getrÚ   Zub_server_stats_qtype_setZub_server_stats_qtype_getrl   Zub_server_stats_qtype_big_setZub_server_stats_qtype_big_getrÛ   Zub_server_stats_qclass_setZub_server_stats_qclass_getrm   Zub_server_stats_qclass_big_setZub_server_stats_qclass_big_getrÜ   Zub_server_stats_qopcode_setZub_server_stats_qopcode_getrÝ   Zub_server_stats_qtcp_setZub_server_stats_qtcp_getrÞ   Z!ub_server_stats_qtcp_outgoing_setZ!ub_server_stats_qtcp_outgoing_getrß   Z!ub_server_stats_qudp_outgoing_setZ!ub_server_stats_qudp_outgoing_getrà   Zub_server_stats_qtls_setZub_server_stats_qtls_getrá   Zub_server_stats_qhttps_setZub_server_stats_qhttps_getrâ   Zub_server_stats_qipv6_setZub_server_stats_qipv6_getrã   Zub_server_stats_qbit_QR_setZub_server_stats_qbit_QR_geträ   Zub_server_stats_qbit_AA_setZub_server_stats_qbit_AA_getrå   Zub_server_stats_qbit_TC_setZub_server_stats_qbit_TC_getræ   Zub_server_stats_qbit_RD_setZub_server_stats_qbit_RD_getrç   Zub_server_stats_qbit_RA_setZub_server_stats_qbit_RA_getrè   Zub_server_stats_qbit_Z_setZub_server_stats_qbit_Z_getré   Zub_server_stats_qbit_AD_setZub_server_stats_qbit_AD_getrê   Zub_server_stats_qbit_CD_setZub_server_stats_qbit_CD_getrë   Zub_server_stats_qEDNS_setZub_server_stats_qEDNS_getrì   Zub_server_stats_qEDNS_DO_setZub_server_stats_qEDNS_DO_getrí   Zub_server_stats_ans_rcode_setZub_server_stats_ans_rcode_getrî   Z$ub_server_stats_ans_rcode_nodata_setZ$ub_server_stats_ans_rcode_nodata_getrï   Zub_server_stats_ans_secure_setZub_server_stats_ans_secure_getrð   Zub_server_stats_ans_bogus_setZub_server_stats_ans_bogus_getrñ   Zub_server_stats_rrset_bogus_setZub_server_stats_rrset_bogus_getrò   Z'ub_server_stats_queries_ratelimited_setZ'ub_server_stats_queries_ratelimited_getró   Z$ub_server_stats_unwanted_replies_setZ$ub_server_stats_unwanted_replies_getrô   Z$ub_server_stats_unwanted_queries_setZ$ub_server_stats_unwanted_queries_getrõ   Z$ub_server_stats_tcp_accept_usage_setZ$ub_server_stats_tcp_accept_usage_getrö   Zub_server_stats_ans_expired_setZub_server_stats_ans_expired_getr÷   Zub_server_stats_hist_setZub_server_stats_hist_getrø   Z#ub_server_stats_msg_cache_count_setZ#ub_server_stats_msg_cache_count_getrù   Z%ub_server_stats_rrset_cache_count_setZ%ub_server_stats_rrset_cache_count_getrú   Z%ub_server_stats_infra_cache_count_setZ%ub_server_stats_infra_cache_count_getrû   Z#ub_server_stats_key_cache_count_setZ#ub_server_stats_key_cache_count_getrü   Z.ub_server_stats_num_query_dnscrypt_crypted_setZ.ub_server_stats_num_query_dnscrypt_crypted_getrý   Z+ub_server_stats_num_query_dnscrypt_cert_setZ+ub_server_stats_num_query_dnscrypt_cert_getrþ   Z0ub_server_stats_num_query_dnscrypt_cleartext_setZ0ub_server_stats_num_query_dnscrypt_cleartext_getrÿ   Z8ub_server_stats_num_query_dnscrypt_crypted_malformed_setZ8ub_server_stats_num_query_dnscrypt_crypted_malformed_getr   Z:ub_server_stats_num_query_dnscrypt_secret_missed_cache_setZ:ub_server_stats_num_query_dnscrypt_secret_missed_cache_getr  Z-ub_server_stats_shared_secret_cache_count_setZ-ub_server_stats_shared_secret_cache_count_getr  Z-ub_server_stats_num_query_dnscrypt_replay_setZ-ub_server_stats_num_query_dnscrypt_replay_getr  Z%ub_server_stats_nonce_cache_count_setZ%ub_server_stats_nonce_cache_count_getr  Z)ub_server_stats_num_query_authzone_up_setZ)ub_server_stats_num_query_authzone_up_getr  Z+ub_server_stats_num_query_authzone_down_setZ+ub_server_stats_num_query_authzone_down_getr  Z)ub_server_stats_num_neg_cache_noerror_setZ)ub_server_stats_num_neg_cache_noerror_getr  Z*ub_server_stats_num_neg_cache_nxdomain_setZ*ub_server_stats_num_neg_cache_nxdomain_getr  Z$ub_server_stats_num_query_subnet_setZ$ub_server_stats_num_query_subnet_getr	  Z*ub_server_stats_num_query_subnet_cache_setZ*ub_server_stats_num_query_subnet_cache_getr
  Z#ub_server_stats_mem_stream_wait_setZ#ub_server_stats_mem_stream_wait_getr  Z*ub_server_stats_mem_http2_query_buffer_setZ*ub_server_stats_mem_http2_query_buffer_getr  Z-ub_server_stats_mem_http2_response_buffer_setZ-ub_server_stats_mem_http2_response_buffer_getr  Zub_server_stats_qtls_resume_setZub_server_stats_qtls_resume_getr  Zub_server_stats_rpz_action_setZub_server_stats_rpz_action_getr  rE   Zdelete_ub_server_statsr„   rÁ   r   r   r   r   rÓ   °  s   



























































































































rÓ   c               @   sœ  e Zd Zi Zdd„ Zi Zdd„ ZeZe	j
ed< e	jed< erJee	je	j
ƒZe	jed< e	jed< erpee	je	jƒZe	jed< e	jed< er–ee	je	jƒZe	jed< e	jed< er¼ee	je	jƒZe	jed< e	jed< erâee	je	jƒZe	jed	< e	jed	< e�r
ee	je	jƒZe	jed
< e	jed
< e�r2ee	je	jƒZ e	j!ed< e	j"ed< e�rZee	j"e	j!ƒZ#e	j$ed< e	j%ed< e�r‚ee	j%e	j$ƒZ&dd„ Z'e	j(Z)dd„ Z*dS )Úub_stats_infoc             C   s   t | t||ƒS )N)r-   r  )r'   r)   r*   r   r   r   rI   ¼  s    zub_stats_info.<lambda>c             C   s   t | t|ƒS )N)r/   r  )r'   r)   r   r   r   rI   ¾  s    ÚsvrÚmesh_num_statesÚmesh_num_reply_statesÚmesh_jostledÚmesh_droppedÚmesh_replies_sentÚmesh_replies_sum_wait_secÚmesh_replies_sum_wait_usecÚmesh_time_medianc             C   s:   t jƒ }y| jj|ƒ W n tjk
r4   || _Y nX d S )N)r   Znew_ub_stats_infor   rQ   r2   r3   )r'   r   r   r   r   rE   å  s
    zub_stats_info.__init__c             C   s   d S )Nr   )r'   r   r   r   rI   ì  s    N)+r   r5   r8   r!   r%   r.   r�   r6   r1   r   Zub_stats_info_svr_setZub_stats_info_svr_getr#   r‚   r  Z!ub_stats_info_mesh_num_states_setZ!ub_stats_info_mesh_num_states_getr  Z'ub_stats_info_mesh_num_reply_states_setZ'ub_stats_info_mesh_num_reply_states_getr  Zub_stats_info_mesh_jostled_setZub_stats_info_mesh_jostled_getr  Zub_stats_info_mesh_dropped_setZub_stats_info_mesh_dropped_getr  Z#ub_stats_info_mesh_replies_sent_setZ#ub_stats_info_mesh_replies_sent_getr  Z+ub_stats_info_mesh_replies_sum_wait_sec_setZ+ub_stats_info_mesh_replies_sum_wait_sec_getr  Z,ub_stats_info_mesh_replies_sum_wait_usec_setZ,ub_stats_info_mesh_replies_sum_wait_usec_getr  Z"ub_stats_info_mesh_time_median_setZ"ub_stats_info_mesh_time_median_getr  rE   Zdelete_ub_stats_infor„   rÁ   r   r   r   r   r  º  sX   

















r  c               @   s  e Zd ZdZi Zdd„ Zi Zdd„ Zdd„ Ze	Z
dd„ ZejZdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zd;dd„Zdd„ Zd<dd„Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Z d0d1„ Z!d2d3„ Z"e#e$fd4d5„Z%e#e$fd6d7„Z&d8d9„ Z'd:S )=Úub_ctxam  
    Unbound resolving and validation context. 

    The validation context is created to hold the resolver status, validation keys and a small cache (containing messages, rrsets, roundtrip times, trusted keys, lameness information).

    **Usage**

    >>> import unbound
    >>> ctx = unbound.ub_ctx()
    >>> ctx.resolvconf("/etc/resolv.conf")
    >>> status, result = ctx.resolve("www.google.com", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
    >>> if status==0 and result.havedata:
    >>>    print "Result:",result.data.address_list
    Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']

    c             C   s   t | t||ƒS )N)r-   r  )r'   r)   r*   r   r   r   rI     s    zub_ctx.<lambda>c             C   s   t | t|ƒS )N)r/   r  )r'   r)   r   r   r   rI     s    c             O   s   t dƒ‚d S )NzNo constructor defined)r&   )r'   ri   rj   r   r   r   rE     s    zub_ctx.__init__c             C   s   t jƒ | _| jstdƒ‚dS )z�Creates a resolving and validation context.

           An exception is invoked if the process of creation an ub_ctx instance fails.
        z2Fatal error: unbound context initialization failedN)r   r�   r   r3   )r'   r   r   r   rE     s    
c             C   s   t j| |ƒS )aP  Add a trust anchor to the given context.

           The trust anchor is a string, on one line, that holds a valid DNSKEY or DS RR.

           :param ta:
               string, with zone-format RR on one line. [domainname] [TTL optional] [type] [class optional] [rdata contents]
           :returns: (int) 0 if OK, else error.
        )r   rŸ   )r'   r    r   r   r   Úadd_ta  s    	zub_ctx.add_tac             C   s   t j| |ƒS )a  Add trust anchors to the given context.

           Pass name of a file with DS and DNSKEY records (like from dig or drill).

           :param fname:
               filename of file with keyfile with trust anchors.
           :returns: (int) 0 if OK, else error.
        )r   r¡   )r'   r˜   r   r   r   Úadd_ta_file%  s    	zub_ctx.add_ta_filec             C   s   t j| |ƒS )a\  setup configuration for the given context.

           :param fname:
               unbound config file (not all settings applicable). This is a power-users interface that lets you specify all sorts of options. For some specific options, such as adding trust anchors, special routines exist.
           :returns: (int) 0 if OK, else error.
        )r   r—   )r'   r˜   r   r   r   Úconfig2  s    zub_ctx.configc             C   s   t j| |ƒS )zçSet debug verbosity for the context Output is directed to stderr.

           :param d:
               debug level, 0 is off, 1 is very minimal, 2 is detailed, and 3 is lots.
           :returns: (int) 0 if OK, else error.
        )r   r¤   )r'   r¥   r   r   r   Ú
debuglevel=  s    zub_ctx.debuglevelc             C   s   t j| |ƒS )aª  Set debug output (and error output) to the specified stream.

           Pass None to disable. Default is stderr.

           :param out:
               File stream to log to.
           :returns: (int) 0 if OK, else error.

           **Usage:**

              In order to log into file, use

              ::

                ctx = unbound.ub_ctx()
                fw = fopen("debug.log")
                ctx.debuglevel(3)
                ctx.debugout(fw)

              Another option is to print the debug information to stderr output

              ::

                ctx = unbound.ub_ctx()
                ctx.debuglevel(10)
                ctx.debugout(sys.stderr) 
        )r   Úub_ctx_debugout)r'   Úoutr   r   r   ÚdebugoutH  s    zub_ctx.debugoutú
/etc/hostsc             C   s   t j| |ƒS )a"  Read list of hosts from the filename given.

           Usually "/etc/hosts". These addresses are not flagged as DNSSEC secure when queried for.

           :param fname:
               file name string. If None "/etc/hosts" is used.
           :returns: (int) 0 if OK, else error.
        )r   rž   )r'   r˜   r   r   r   Úhostsh  s    	zub_ctx.hostsc             C   s
   t j| ƒS )z€Print the local zones and their content (RR data) to the debug output.

           :returns: (int) 0 if OK, else error.
        )r   r¶   )r'   r   r   r   Úprint_local_zonesu  s    zub_ctx.print_local_zonesú/etc/resolv.confc             C   s   t j| |ƒS )aÏ  Read list of nameservers to use from the filename given.

           Usually "/etc/resolv.conf". Uses those nameservers as caching proxies. If they do not support DNSSEC, validation may fail.

           Only nameservers are picked up, the searchdomain, ndots and other settings from resolv.conf(5) are ignored.

           :param fname:
               file name string. If None "/etc/resolv.conf" is used.
           :returns: (int) 0 if OK, else error.
        )r   r�   )r'   r˜   r   r   r   Ú
resolvconf~  s    zub_ctx.resolvconfc             C   s   t j| |ƒS )aå  Set a context behaviour for asynchronous action.

           :param dothread:
               if True, enables threading and a call to :meth:`resolve_async` creates a thread to handle work in the background. 
               If False, a process is forked to handle work in the background. 
               Changes to this setting after :meth:`async` calls have been made have no effect (delete and re-create the context to change).
           :returns: (int) 0 if OK, else error.
        )r   r¦   )r'   r§   r   r   r   Ú	set_async�  s    	zub_ctx.set_asyncc             C   s   t j| |ƒS )ao  Set machine to forward DNS queries to, the caching resolver to use.

           IP4 or IP6 address. Forwards all DNS requests to that machine, which is expected to run a recursive resolver. If the  is not DNSSEC-capable, validation may fail. Can be called several times, in that case the addresses are used as backup servers.

           To read the list of nameservers from /etc/resolv.conf (from DHCP or so), use the call :meth:`resolvconf`.

           :param addr:
               address, IP4 or IP6 in string format. If the addr is None, forwarding is disabled.
           :returns: (int) 0 if OK, else error.
        )r   r™   )r'   rš   r   r   r   Úset_fwdš  s    zub_ctx.set_fwdc             C   s   t j| ||ƒS )aÞ  Set an option for the context.

           Changes to the options after :meth:`resolve`, :meth:`resolve_async`, :meth:`zone_add`, :meth:`zone_remove`, :meth:`data_add` or :meth:`data_remove` have no effect (you have to delete and re-create the context).

           :param opt:
               option name from the unbound.conf config file format. (not all settings applicable). The name includes the trailing ':' for example set_option("logfile:", "mylog.txt"); This is a power-users interface that lets you specify all sorts of options. For some specific options, such as adding trust anchors, special routines exist.
           :param val:
               value of the option.
           :returns: (int) 0 if OK, else error.
        )r   r“   )r'   r”   r•   r   r   r   Ú
set_option©  s    zub_ctx.set_optionc             C   s   t j| |ƒS )a  Add trust anchors to the given context.

           Pass the name of a bind-style config file with trusted-keys{}.

           :param fname:
               filename of file with bind-style config entries with trust anchors.
           :returns: (int) 0 if OK, else error.
        )r   r£   )r'   r˜   r   r   r   Útrustedkeys¸  s    	zub_ctx.trustedkeysc             C   s   t j| ƒ dS )z Print local zones using debugoutN)r   r¶   )r'   r   r   r   Ú
zone_printÆ  s    zub_ctx.zone_printc             C   s   t j| ||ƒS )zÆAdd new local zone

           :param zonename: zone domain name (e.g. myzone.)
           :param zonetype: type of the zone ("static",...) 
           :returns: (int) 0 if OK, else error. 
        )r   r·   )r'   ÚzonenameZzonetyper   r   r   Úzone_addÊ  s    zub_ctx.zone_addc             C   s   t j| |ƒS )zµRemove local zone

           If exists, removes local zone with all the RRs.

           :param zonename: zone domain name
           :returns: (int) 0 if OK, else error. 
        )r   r¹   )r'   r,  r   r   r   Úzone_removeÕ  s    zub_ctx.zone_removec             C   s   t j| |ƒS )aÝ  Add new local RR data

           :param rrdata: string, in zone-format on one line. [domainname] [TTL optional] [type] [class optional] [rdata contents]
           :returns: (int) 0 if OK, else error. 

           **Usage**
              The local data ...

              ::

                >>> ctx = unbound.ub_ctx()
                >>> ctx.zone_add("mydomain.net.","static")
                0
                >>> status = ctx.data_add("test.mydomain.net. IN A 192.168.1.1")
                0
                >>> status, result = ctx.resolve("test.mydomain.net")
                >>> if status==0 and result.havedata:
                >>>    print "Result:",result.data.address_list
                Result: ['192.168.1.1']

        )r   rº   )r'   Úrrdatar   r   r   Údata_addá  s    zub_ctx.data_addc             C   s   t j| |ƒS )a  Remove local RR data

           If exists, remove resource record from local zone

           :param rrdata: string, in zone-format on one line. [domainname] [TTL optional] [type] [class optional] [rdata contents]
           :returns: (int) 0 if OK, else error. 
        )r   r»   )r'   r/  r   r   r   Údata_removeû  s    zub_ctx.data_removec             C   s   t j| |ƒS )zËCancel an async query in progress.

           Its callback will not be called.

           :param async_id:
               which query to cancel.
           :returns: (int) 0 if OK, else error.
        )r   r³   )r'   r²   r   r   r   Úcancel  s    	zub_ctx.cancelc             C   s
   t j| ƒS )aj  Get file descriptor.

           Wait for it to become readable, at this point answers are returned from the asynchronous validating resolver. Then call the ub_process to continue processing. This routine works immediately after context creation, the fd does not change.

           :returns: (int) -1 on error, or file descriptor to use select(2) with.
        )r   rª   )r'   r   r   r   Úget_fd  s    zub_ctx.get_fdc             C   s
   t j| ƒS )a:  Poll a context to see if it has any new results Do not poll in a loop, instead extract the fd below to poll for readiness, and then check, or wait using the wait routine.

           :returns: (int) 0 if nothing to read, or nonzero if a result is available. If nonzero, call ctx_process() to do callbacks.
        )r   r¨   )r'   r   r   r   Úpoll   s    zub_ctx.pollc             C   s
   t j| ƒS )zÕCall this routine to continue processing results from the validating resolver (when the fd becomes readable).

           Will perform necessary callbacks.

           :returns: (int) 0 if OK, else error.
        )r   r«   )r'   r   r   r   Úprocess)  s    zub_ctx.processc             C   s2   t |tƒrtj| |||ƒS tj| t|ƒ||ƒS dS )aÐ  Perform resolution and validation of the target name. 

           :param name:
               domain name in text format (a string or unicode string). IDN domain name have to be passed as a unicode string.
           :param rrtype:
               type of RR in host order (optional argument). Default value is RR_TYPE_A (A class).
           :param rrclass:
               class of RR in host order (optional argument). Default value is RR_CLASS_IN (for internet).
           :returns: * (int) 0 if OK, else error.
                     * (:class:`ub_result`) the result data is returned in a newly allocated result structure. May be None on return, return value is set to an error in that case (out of memory).
        N)r:   r9   r   r¬   Ú	idn2dname)r'   r)   r­   r®   r   r   r   Úresolve4  s    
zub_ctx.resolvec             C   s:   t |tƒrtj| |||||ƒS tj| t|ƒ||||ƒS dS )aK  Perform resolution and validation of the target name.

           Asynchronous, after a while, the callback will be called with your data and the result. 
           If an error happens during processing, your callback will be called with error set to a nonzero value (and result==None).

           :param name:
               domain name in text format (a string or unicode string). IDN domain name have to be passed as a unicode string.
           :param mydata:
               this data is your own data (you can pass arbitrary python object or None) which are passed on to the callback function.
           :param callback:
               call-back function which is called on completion of the resolution. 
           :param rrtype:
               type of RR in host order (optional argument). Default value is RR_TYPE_A (A class).
           :param rrclass:
               class of RR in host order (optional argument). Default value is RR_CLASS_IN (for internet).
           :returns: * (int) 0 if OK, else error.
                     * (int) async_id, an identifier number is returned for the query as it is in progress. It can be used to cancel the query.

           **Call-back function:**
                The call-back function looks as the follows::

                    def call_back(mydata, status, result):
                        pass

                **Parameters:** 
                    * `mydata` - mydata object
                    * `status` - 0 when a result has been found
                    * `result` - the result structure. The result may be None, in that case err is set.

        N)r:   r9   r   Ú_ub_resolve_asyncr6  )r'   r)   r°   r±   r­   r®   r   r   r   Úresolve_asyncG  s    
zub_ctx.resolve_asyncc             C   s
   t j| ƒS )zÓWait for a context to finish with results.

           Calls  after the wait for you. After the wait, there are no more outstanding asynchronous queries.

           :returns: (int) 0 if OK, else error.
        )r   r©   )r'   r   r   r   Úwaitm  s    zub_ctx.waitN)r"  )r%  )(r   r5   r8   rd   r!   r%   r.   r�   rE   r6   r1   r   r‘   r„   r  r  r  r  r!  r#  r$  r&  r'  r(  r)  r*  r+  r-  r.  r0  r1  r2  r3  r4  r5  Ú	RR_TYPE_AÚRR_CLASS_INr7  r9  r:  r   r   r   r   r  ð  sB   
 
	
	&r  c              G   s
   t j| Ž S )N)r   r  )ri   r   r   r   r  ~  s    r  c             C   s   t j| |||||ƒS )N)r   r8  )r’   r)   r­   r®   r°   Zpyfuncr   r   r   r8  ‚  s    r8  c             C   s$   dj dd„ | jdƒD ƒddd… ƒS )zbReverse domain name

       Usable for reverse lookups when the IP address should be reversed
    r   c             S   s   g | ]}|‘qS r   r   )rK   rL   r   r   r   rM   �  s    zreverse.<locals>.<listcomp>Nr   éÿÿÿÿ)r
   Úsplit)Zdomainr   r   r   Úreverseˆ  s    r?  c             C   s   dj dd„ | jdƒD ƒƒS )z–Converts domain name in IDN format to canonic domain name

       :param idnname: (unicode string) IDN name
       :returns: (string) domain name
    r   c             S   s    g | ]}|rt jj|ƒnd ‘qS )r0   )r]   r^   ZToASCII)rK   rL   r   r   r   rM   •  s    zidn2dname.<locals>.<listcomp>)r
   r>  )Zidnnamer   r   r   r6  �  s    r6  c             C   s   dj dd„ | jdƒD ƒƒS )z›Converts canonic domain name in IDN format to unicode string

        :param name: (string) domain name
        :returns: (unicode string) domain name
    r   c             S   s   g | ]}t jj|ƒ‘qS r   )r]   r^   r_   )rK   rL   r   r   r   rM   �  s    zdname2idn.<locals>.<listcomp>)r
   r>  )r)   r   r   r   Ú	dname2idn—  s    r@  )r   r   r   )r   r   r   )r   )´Úsysr   Z_swig_python_version_infor   r   rf   r‚   Ú	NameErrorr<   r2   r   r,   r-   r/   r6   r$   r7   r#   r3   Zencodings.idnar]   ÚvarsrR   r9   r=   r?   r;  Z
RR_TYPE_NSZ
RR_TYPE_MDZ
RR_TYPE_MFZRR_TYPE_CNAMEZRR_TYPE_SOAZ
RR_TYPE_MBZ
RR_TYPE_MGZ
RR_TYPE_MRZRR_TYPE_NULLZRR_TYPE_WKSZRR_TYPE_PTRZRR_TYPE_HINFOZRR_TYPE_MINFOZ
RR_TYPE_MXZRR_TYPE_TXTZ
RR_TYPE_RPZRR_TYPE_AFSDBZRR_TYPE_X25ZRR_TYPE_ISDNZ
RR_TYPE_RTZRR_TYPE_NSAPZRR_TYPE_NSAP_PTRZRR_TYPE_SIGZRR_TYPE_KEYZ
RR_TYPE_PXZRR_TYPE_GPOSZRR_TYPE_AAAAZRR_TYPE_LOCZRR_TYPE_NXTZRR_TYPE_EIDZRR_TYPE_NIMLOCZRR_TYPE_SRVZRR_TYPE_ATMAZRR_TYPE_NAPTRZ
RR_TYPE_KXZRR_TYPE_CERTZ
RR_TYPE_A6ZRR_TYPE_DNAMEZRR_TYPE_SINKZRR_TYPE_OPTZRR_TYPE_APLZ
RR_TYPE_DSZRR_TYPE_SSHFPZRR_TYPE_IPSECKEYZRR_TYPE_RRSIGZRR_TYPE_NSECZRR_TYPE_DNSKEYZRR_TYPE_DHCIDZRR_TYPE_NSEC3ZRR_TYPE_NSEC3PARAMSZRR_TYPE_UINFOZRR_TYPE_UIDZRR_TYPE_GIDZRR_TYPE_UNSPECZRR_TYPE_TSIGZRR_TYPE_IXFRZRR_TYPE_AXFRZRR_TYPE_MAILBZRR_TYPE_MAILAZRR_TYPE_ANYZRR_TYPE_CAAZRR_TYPE_DLVr<  ZRR_CLASS_CHZRR_CLASS_HSZRR_CLASS_NONEZRR_CLASS_ANYrA   r…   r†   r‡   rˆ   r‰   rŠ   r‹   rŒ   r�   rŽ   r�   rC   ZUNBOUND_VERSION_MAJORZUNBOUND_VERSION_MINORZUNBOUND_VERSION_MICROZUNBOUND_VERSION_MAJOR_REALZUNBOUND_VERSION_MINOR_REALZUNBOUND_VERSION_MICRO_REALrh   Zub_result_swigregisterZ
UB_NOERRORZ	UB_SOCKETZUB_NOMEMZ	UB_SYNTAXZUB_SERVFAILZUB_FORKFAILZUB_AFTERFINALZUB_INITFAILZUB_PIPEZUB_READFILEZUB_NOIDr�   r‘   r“   r–   r—   r™   r›   rœ   r�   rž   rŸ   r¡   r¢   r£   r¤   r¦   r¨   r©   rª   r«   r¬   r¯   r³   rƒ   r´   r¶   r·   r¹   rº   r»   r¼   r½   Zub_shm_stat_info_swigregisterrÂ   Z!ub_shm_stat_info_mem_swigregisterrÌ   Z"ub_shm_stat_info_time_swigregisterZUB_STATS_QTYPE_NUMZUB_STATS_QCLASS_NUMZUB_STATS_RCODE_NUMZUB_STATS_OPCODE_NUMZUB_STATS_BUCKET_NUMZUB_STATS_RPZ_ACTION_NUMrÓ   Zub_server_stats_swigregisterr  Zub_stats_info_swigregisterr  Zub_ctx_swigregisterr  r8  r?  r6  r@  r   r   r   r   Ú<module>   sÞ  
	
Zv7'  	3   