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eƒZPG dhdi„ die1eƒZQG djdk„ dke1eƒZRG dldm„ dme1eƒZSejTd‚i doe<“d]eK“dpeJ“dqe2“d_eL“dre?“dieQ“dseG“dkeR“dte:“due=“dve9“dweC“deeO“dmeS“dxeF“dye2“dzeB“d{eD“d|eH“d}e@“d~e>“dceN“deE“d€eA“daeM“deI“dgeP“Ž dS )ƒé    )Úint2octÚoct2int)Úerror)ÚsockfixNÚ	inet_ntopÚ	inet_ptonÚwin32)Ú	inet_ntoaÚ	inet_atonc                 C   ó   t |ƒS ©N)r	   ©ÚxÚy© r   úG/usr/lib/python3/dist-packages/pysnmp/smi/mibs/TRANSPORT-ADDRESS-MIB.pyÚ<lambda>   ó    r   c                 C   r   r   )r
   r   r   r   r   r      r   Fc                 C   sŒ  | t jkr
t  |¡S | t jkrt  d| f ¡‚| d¡}| d¡}d|d v r;dd„ t dt  |d ¡¡D ƒ|dd …< |d	krV| 	d¡}d
gdt
|ƒ d	  |||d	 …< nM|dkr…d
gdt
|ƒ d  }| d¡rq||d d…< n2| d¡r}||dd …< n&t  d|f ¡‚|dkr—|dkr•t  d|f ¡‚dS |dkr£t  d|f ¡‚dd„ dd„ |D ƒD ƒ}t
|ƒdkr½t  d|f ¡‚tjdg|¢R Ž S )NúUnknown address family %sú:Ú Ú.éÿÿÿÿc                 S   s   g | ]}d | ‘qS )ú%xr   ©Ú.0r   r   r   r   Ú
<listcomp>1   ó    zinet_pton.<locals>.<listcomp>z!HHé   Ú0é   é   z::éþÿÿÿzInvalid IPv6 address: "%s"é   z                c                 S   s   g | ]
}|d @ |kr|‘qS )iÿÿ  r   ©r   Útr   r   r   r   K   s    c                 S   s   g | ]}t |d ƒ‘qS )é   )Úintr$   r   r   r   r   K   s    ú!8H)ÚsocketÚAF_INETr
   ÚAF_INET6r   ÚsplitÚcountÚstructÚunpackÚindexÚlenÚ
startswithÚendswithZpack)Úaddress_familyZ	ip_stringÚgroupsÚspacesÚidxZzerosr   r   r   r   %   sL   


ÿ

(
$

ÿÿÿÿc                    sX  | t jkr
t  |¡S | t jkrt  d| f ¡‚t|ƒdkr&t  dt|ƒ ¡‚tt d|¡ƒ}d } } }}t	dƒD ](}|| rT|dkrS|dksL||krQ||}}d}q:|dkr^|d}}q:|d7 }q:|dkrt|dkso||krt||}}|dkr…|dkr…dg|||| …< |d	 dkr‘| 
d	d¡ |d dkrœ| d¡ d
d„ ‰ d ‡ fdd„|D ƒ¡S )Nr   r&   zincorrect address length: %sr(   r   r    r   r   r   c                 S   s   | dkrd|  p	dS )Nr   r   r   r   )r   r   r   r   r   ~   r   zinet_ntop.<locals>.<lambda>c                    s   g | ]}ˆ |ƒ‘qS r   r   r   ©Úfr   r   r   €   r   zinet_ntop.<locals>.<listcomp>)r)   r*   r   r+   r   r1   Úlistr.   r/   ÚrangeÚinsertÚappendÚjoin)r4   Z	packed_ipr5   Zcur_baseZ	best_baseZcur_lenZbest_lenr7   r   r8   r   r   U   sB   


ÿ
ÿ
€


ZASN1ÚIntegerÚOctetStringÚObjectIdentifierzASN1-ENUMERATIONÚNamedValueszASN1-REFINEMENTÚConstraintsIntersectionÚConstraintsUnionÚValueRangeConstraintÚValueSizeConstraintÚSingleValueConstraintzSNMPv2-CONFÚNotificationGroupÚModuleCompliancez
SNMPv2-SMIÚ	Integer32Ú
Unsigned32ÚMibIdentifierÚ	Counter32ÚModuleIdentityÚ	MibScalarÚMibTableÚMibTableRowÚMibTableColumnÚNotificationTypeÚBitsÚ	TimeTicksÚObjectIdentityÚ	Counter64ÚGauge32Ú	IpAddressÚisozmib-2z	SNMPv2-TCÚDisplayStringÚTextualConvention)r   r#   é   r   r!   r   éd   )z2002-11-01 00:00Z200211010000Zz#IETF Operations and Management Areaz¸Juergen Schoenwaelder (Editor) TU Braunschweig Bueltenweg 74/75 38106 Braunschweig, Germany Phone: +49 531 391-3289 EMail: schoenw@ibr.cs.tu-bs.de Send comments to <mibs@ops.ietf.org>.zÐThis MIB module provides commonly used transport address definitions. Copyright (C) The Internet Society (2002). This version of this MIB module is part of RFC 3419; see the RFC itself for full legal notices.)r   r#   r]   r   r!   r   r^   r   )	r   r#   r]   r   r!   r   r^   r   r   Úcurrentz‚The UDP over IPv4 transport domain. The corresponding transport address is of type TransportAddressIPv4 for global IPv4 addresses.)	r   r#   r]   r   r!   r   r^   r   r!   z‚The UDP over IPv6 transport domain. The corresponding transport address is of type TransportAddressIPv6 for global IPv6 addresses.)	r   r#   r]   r   r!   r   r^   r   r#   z•The UDP over IPv4 transport domain. The corresponding transport address is of type TransportAddressIPv4z for scoped IPv4 addresses with a zone index.)	r   r#   r]   r   r!   r   r^   r   é   z•The UDP over IPv6 transport domain. The corresponding transport address is of type TransportAddressIPv6z for scoped IPv6 addresses with a zone index.)	r   r#   r]   r   r!   r   r^   r   é   z‚The TCP over IPv4 transport domain. The corresponding transport address is of type TransportAddressIPv4 for global IPv4 addresses.)	r   r#   r]   r   r!   r   r^   r   r]   z‚The TCP over IPv6 transport domain. The corresponding transport address is of type TransportAddressIPv6 for global IPv6 addresses.)	r   r#   r]   r   r!   r   r^   r   é   z•The TCP over IPv4 transport domain. The corresponding transport address is of type TransportAddressIPv4z for scoped IPv4 addresses with a zone index.)	r   r#   r]   r   r!   r   r^   r   r    z•The TCP over IPv6 transport domain. The corresponding transport address is of type TransportAddressIPv6z for scoped IPv6 addresses with a zone index.)	r   r#   r]   r   r!   r   r^   r   é	   zÞThe SCTP over IPv4 transport domain. The corresponding transport address is of type TransportAddressIPv4 for global IPv4 addresses. This transport domain usually represents the primary address on multihomed SCTP endpoints.)	r   r#   r]   r   r!   r   r^   r   é
   zÞThe SCTP over IPv6 transport domain. The corresponding transport address is of type TransportAddressIPv6 for global IPv6 addresses. This transport domain usually represents the primary address on multihomed SCTP endpoints.)	r   r#   r]   r   r!   r   r^   r   é   zñThe SCTP over IPv4 transport domain. The corresponding transport address is of type TransportAddressIPv4z for scoped IPv4 addresses with a zone index. This transport domain usually represents the primary address on multihomed SCTP endpoints.)	r   r#   r]   r   r!   r   r^   r   é   zñThe SCTP over IPv6 transport domain. The corresponding transport address is of type TransportAddressIPv6z for scoped IPv6 addresses with a zone index. This transport domain usually represents the primary address on multihomed SCTP endpoints.)	r   r#   r]   r   r!   r   r^   r   é   zÁThe Posix Local IPC transport domain. The corresponding transport address is of type TransportAddressLocal. The Posix Local IPC transport domain incorporates the well-known UNIX domain sockets.)	r   r#   r]   r   r!   r   r^   r   é   z€The UDP transport domain using fully qualified domain names. The corresponding transport address is of type TransportAddressDns.)	r   r#   r]   r   r!   r   r^   r   é   z€The TCP transport domain using fully qualified domain names. The corresponding transport address is of type TransportAddressDns.)	r   r#   r]   r   r!   r   r^   r   r&   zThe SCTP transport domain using fully qualified domain names. The corresponding transport address is of type TransportAddressDns.c                   @   s   e Zd ZdZdZdS )ÚTransportDomainz¸A value that represents a transport domain. Some possible values, such as transportDomainUdpIpv4, are defined in this module. Other possible values can be defined in other MIB modules.r_   N)Ú__name__Ú
__module__Ú__qualname__ÚdescriptionÚstatusr   r   r   r   rj   À   s    rj   c                   @   sn   e Zd ZdZdZejeeddddddd	d
dddddddddƒƒ Ze	ddddddddddddd d!d"d#d$ƒZ
d%S )&ÚTransportAddressTypea÷  A value that represents a transport domain. This is the enumerated version of the transport domain registrations in this MIB module. The enumerated values have the following meaning: unknown(0) unknown transport address type udpIpv4(1) transportDomainUdpIpv4 udpIpv6(2) transportDomainUdpIpv6 udpIpv4z(3) transportDomainUdpIpv4z udpIpv6z(4) transportDomainUdpIpv6z tcpIpv4(5) transportDomainTcpIpv4 tcpIpv6(6) transportDomainTcpIpv6 tcpIpv4z(7) transportDomainTcpIpv4z tcpIpv6z(8) transportDomainTcpIpv6z sctpIpv4(9) transportDomainSctpIpv4 sctpIpv6(10) transportDomainSctpIpv6 sctpIpv4z(11) transportDomainSctpIpv4z sctpIpv6z(12) transportDomainSctpIpv6z local(13) transportDomainLocal udpDns(14) transportDomainUdpDns tcpDns(15) transportDomainTcpDns sctpDns(16) transportDomainSctpDns This textual convention can be used to represent transport domains in situations where a syntax of TransportDomain is unwieldy (for example, when used as an index). The usage of this textual convention implies that additional transport domains can only be supported by updating this MIB module. This extensibility restriction does not apply for the TransportDomain textual convention which allows MIB authors to define additional transport domains independently in other MIB modules.r_   r   r   r!   r#   r`   ra   r]   rb   r    rc   rd   re   rf   rg   rh   ri   r&   )Úunknownr   )ZudpIpv4r   )ZudpIpv6r!   )ZudpIpv4zr#   )ZudpIpv6zr`   )ZtcpIpv4ra   )ZtcpIpv6r]   )ZtcpIpv4zrb   )ZtcpIpv6zr    )ZsctpIpv4rc   )ZsctpIpv6rd   )Z	sctpIpv4zre   )Z	sctpIpv6zrf   )Zlocalrg   )ZudpDnsrh   )ZtcpDnsri   )ZsctpDnsr&   N)rk   rl   rm   rn   ro   rJ   ÚsubtypeSpecrD   rG   rB   ZnamedValuesr   r   r   r   rp   Ä   s
    2,rp   c                   @   s$   e Zd ZdZdZejeddƒ ZdS )ÚTransportAddressaÙ  Denotes a generic transport address. A TransportAddress value is always interpreted within the context of a TransportAddressType or TransportDomain value. Every usage of the TransportAddress textual convention MUST specify the TransportAddressType or TransportDomain object which provides the context. Furthermore, MIB authors SHOULD define a separate TransportAddressType or TransportDomain object for each TransportAddress object. It is suggested that the TransportAddressType or TransportDomain is logically registered before the object(s) which use the TransportAddress textual convention if they appear in the same logical row. The value of a TransportAddress object must always be consistent with the value of the associated TransportAddressType or TransportDomain object. Attempts to set a TransportAddress object to a value which is inconsistent with the associated TransportAddressType or TransportDomain must fail with an inconsistentValue error. When this textual convention is used as a syntax of an index object, there may be issues with the limit of 128 sub-identifiers specified in SMIv2, STD 58. In this case, the OBJECT-TYPE declaration MUST include a 'SIZE' clause to limit the number of potential instance sub-identifiers.r_   r   éÿ   N)rk   rl   rm   rn   ro   r@   rr   rF   r   r   r   r   rs   Ê   s    rs   c                   @   óL   e Zd ZdZdZdZejeddƒ ZdZ	dd„ Z
dd„ Zd	d
„ Zdd„ ZdS )ÚTransportAddressIPv4aÚ  Represents a transport address consisting of an IPv4 address and a port number (as used for example by UDP, TCP and SCTP): octets contents encoding 1-4 IPv4 address network-byte order 5-6 port number network-byte order This textual convention SHOULD NOT be used directly in object definitions since it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with TransportAddressType or TransportDomain as a pair.r_   z1d.1d.1d.1d:2dr]   c                 C   sJ   t |tƒrttj|d ƒt|d d? d@ ƒ t|d d@ ƒ }t | |¡S )Nr   r   r    rt   )Ú
isinstanceÚtupler   r)   r*   r   r@   ÚprettyIn©ÚselfÚvaluer   r   r   ry   Ö   s   
4zTransportAddressIPv4.prettyInc                 C   sJ   t | dƒs"|  ¡ }ttj|d d… ƒt|d ƒd> t|d ƒB f| _| jS )NÚ__tuple_valuer`   r    ra   )ÚhasattrÚasOctetsr   r)   r*   r   Z"_TransportAddressIPv4__tuple_value©r{   Úvr   r   r   Ú__asSocketAddressÝ   s   
þz&TransportAddressIPv4.__asSocketAddressc                 C   ó   t |  ¡ ƒS r   )ÚiterÚ&_TransportAddressIPv4__asSocketAddress©r{   r   r   r   Ú__iter__æ   ó   zTransportAddressIPv4.__iter__c                 C   ó   |   ¡ | S r   )r…   ©r{   Úitemr   r   r   Ú__getitem__é   rˆ   z TransportAddressIPv4.__getitem__N)rk   rl   rm   rn   ro   ÚdisplayHintr@   rr   rF   ÚfixedLengthry   r…   r‡   rŒ   r   r   r   r   rv   Ï   s    	rv   c                   @   ru   )ÚTransportAddressIPv6aÝ  Represents a transport address consisting of an IPv6 address and a port number (as used for example by UDP, TCP and SCTP): octets contents encoding 1-16 IPv6 address network-byte order 17-18 port number network-byte order This textual convention SHOULD NOT be used directly in object definitions since it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with TransportAddressType or TransportDomain as a pair.r_   z 0a[2x:2x:2x:2x:2x:2x:2x:2x]0a:2dé   c                 C   sX   t st d¡‚t|tƒr&ttj|d ƒt|d d? d@ ƒ t|d d@ ƒ }t	 
| |¡S )NúIPv6 not supported by platformr   r   r    rt   )Úhas_ipv6r   ÚPySnmpErrorrw   rx   r   r)   r+   r   r@   ry   rz   r   r   r   ry   ô   s
   

4zTransportAddressIPv6.prettyInc                 C   s\   t | dƒs+tst d¡‚|  ¡ }ttj|d d… ƒt|d ƒd> t|d ƒB ddf| _	| j	S )Nr}   r‘   r&   r    é   r   )
r~   r’   r   r“   r   r   r)   r+   r   Z"_TransportAddressIPv6__tuple_valuer€   r   r   r   r‚   ü   s   

üz&TransportAddressIPv6.__asSocketAddressc                 C   rƒ   r   )r„   Ú&_TransportAddressIPv6__asSocketAddressr†   r   r   r   r‡     rˆ   zTransportAddressIPv6.__iter__c                 C   r‰   r   )r•   rŠ   r   r   r   rŒ     rˆ   z TransportAddressIPv6.__getitem__N)rk   rl   rm   rn   ro   r   r@   rr   rF   rŽ   ry   r•   r‡   rŒ   r   r   r   r   r   í   s    r   c                   @   ó,   e Zd ZdZdZdZejeddƒ ZdZ	dS )ÚTransportAddressIPv4za  Represents a transport address consisting of an IPv4 address, a zone index and a port number (as used for example by UDP, TCP and SCTP): octets contents encoding 1-4 IPv4 address network-byte order 5-8 zone index network-byte order 9-10 port number network-byte order This textual convention SHOULD NOT be used directly in object definitions since it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with TransportAddressType or TransportDomain as a pair.r_   z1d.1d.1d.1d%4d:2drd   N©
rk   rl   rm   rn   ro   r   r@   rr   rF   rŽ   r   r   r   r   r—     ó    r—   c                   @   r–   )ÚTransportAddressIPv6za  Represents a transport address consisting of an IPv6 address, a zone index and a port number (as used for example by UDP, TCP and SCTP): octets contents encoding 1-16 IPv6 address network-byte order 17-20 zone index network-byte order 21-22 port number network-byte order This textual convention SHOULD NOT be used directly in object definitions since it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with TransportAddressType or TransportDomain as a pair.r_   z#0a[2x:2x:2x:2x:2x:2x:2x:2x%4d]0a:2dé   Nr˜   r   r   r   r   rš     r™   rš   c                   @   s,   e Zd ZdZdZdZdZeje	ddƒ ZdS )ÚTransportAddressLocalz4Protocol Independent Interfaces (IEEE POSIX 1003.1g)aË  Represents a POSIX Local IPC transport address: octets contents encoding all POSIX Local IPC address string The Posix Local IPC transport domain subsumes UNIX domain sockets. This textual convention SHOULD NOT be used directly in object definitions since it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with TransportAddressType or TransportDomain as a pair. When this textual convention is used as a syntax of an index object, there may be issues with the limit of 128 sub-identifiers specified in SMIv2, STD 58. In this case, the OBJECT-TYPE declaration MUST include a 'SIZE' clause to limit the number of potential instance sub-identifiers.r_   Ú1ar   rt   N)
rk   rl   rm   Z	referencern   ro   r   r@   rr   rF   r   r   r   r   rœ     s    rœ   c                   @   s(   e Zd ZdZdZdZejeddƒ ZdS )ÚTransportAddressDnsaÀ  Represents a DNS domain name followed by a colon ':' (ASCII character 0x3A) and a port number in ASCII. The name SHOULD be fully qualified whenever possible. Values of this textual convention are not directly useable as transport-layer addressing information, and require runtime resolution. As such, applications that write them must be prepared for handling errors if such values are not supported, or cannot be resolved (if resolution occurs at the time of the management operation). The DESCRIPTION clause of TransportAddress objects that may have TransportAddressDns values must fully describe how (and when) such names are to be resolved to IP addresses and vice versa. This textual convention SHOULD NOT be used directly in object definitions since it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with TransportAddressType or TransportDomain as a pair. When this textual convention is used as a syntax of an index object, there may be issues with the limit of 128 sub-identifiers specified in SMIv2, STD 58. In this case, the OBJECT-TYPE declaration MUST include a 'SIZE' clause to limit the number of potential instance sub-identifiers.r_   r   r   rt   N)	rk   rl   rm   rn   ro   r   r@   rr   rF   r   r   r   r   rž   #  s
    rž   úTRANSPORT-ADDRESS-MIBÚtransportDomainUdpIpv6ÚtransportDomainSctpDnsZPYSNMP_MODULE_IDÚtransportDomainTcpIpv4ÚtransportDomainLocalÚtransportDomainUdpIpv4ÚtransportDomainUdpIpv4zÚtransportDomainsÚtransportDomainSctpIpv4ÚtransportDomainSctpIpv6zÚtransportAddressMIBÚtransportDomainTcpIpv6zÚtransportDomainSctpIpv6ÚtransportDomainUdpDnsÚtransportDomainTcpIpv6ÚtransportDomainUdpIpv6zÚtransportDomainSctpIpv4zÚtransportDomainTcpIpv4zÚtransportDomainTcpDns)rŸ   )UZpyasn1.compat.octetsr   r   Zpysnmpr   Zpysnmp.carrierr   r)   r’   r~   r   r   ÚsysÚplatformr	   r
   r.   Z
mibBuilderZimportSymbolsr?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   Zmib_2r[   r\   r©   Z	loadTextsZsetRevisionsZsetLastUpdatedZsetOrganizationZsetContactInfoZsetDescriptionr¦   r¤   Z	setStatusr    r¥   r®   r¢   r­   r°   rª   r§   r«   r¯   r¨   r£   r¬   r±   r¡   rj   rp   rs   rv   r   r—   rš   rœ   rž   ZexportSymbolsr   r   r   r   Ú<module>   s²   
0-R!¸