+
    üÐjý  ã                   óÜ   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHtHt ^ RIHt ]! ]4       ! R R	4      4       t]! ]]4       ]! ]4       ! R
 R]4      4       t]! ]]4       R# )z$
Utilities for Twisted.names tests.
)Ú	randrange)Úimplementer)ÚverifyClass)ÚIPv4Address)Úsucceed)ÚIReactorUDPÚIUDPTransport)ÚClockc                   óR   a € ] tR t^t o RtR tR tR tRR ltR t	R t
R	 tR
tV tR# )ÚMemoryDatagramTransporta€  
This L{IUDPTransport} implementation enforces the usual connection rules
and captures sent traffic in a list for later inspection.

@ivar _host: The host address to which this transport is bound.
@ivar _protocol: The protocol connected to this transport.
@ivar _sentPackets: A C{list} of two-tuples of the datagrams passed to
    C{write} and the addresses to which they are destined.

@ivar _connectedTo: L{None} if this transport is unconnected, otherwise an
    address to which all traffic is supposedly sent.

@ivar _maxPacketSize: An C{int} giving the maximum length of a datagram
    which will be successfully handled by C{write}.
c                óF   € Wn         W n        . V n        R V n        W0n        R # ©N)Ú_hostÚ	_protocolÚ_sentPacketsÚ_connectedToÚ_maxPacketSize)ÚselfÚhostÚprotocolÚmaxPacketSizes   &&&&Ú>/usr/lib/python3/dist-packages/twisted/names/test/test_util.pyÚ__init__Ú MemoryDatagramTransport.__init__&   s"   € ØŒ
Ø!ŒØˆÔØ ˆÔØ+Öó    c                ó0   € \        R.V P                  O5!  # )zG
Return the address which this transport is pretending to be bound
to.
ÚUDP)r   r   ©r   s   &r   ÚgetHostÚMemoryDatagramTransport.getHost-   s   € ô
 ˜5Ð. 4§:¡:Ó.Ð.r   c                óH   € V P                   e   \        R4      hW3V n         R# )z.
Connect this transport to the given address.
NzAlready connected)r   Ú
ValueError)r   r   Úports   &&&r   ÚconnectÚMemoryDatagramTransport.connect4   s&   € ð ×ÑÒ(ÜÐ0Ó1Ð1Ø!˜LˆÖr   Nc                óÆ   € Vf   V P                   pVf   \        R4      h\        V4      V P                  8”  d   \        R4      hV P                  P                  W34       R# )z
Send the given datagram.
NzNeed an addresszPacket too big)r   r!   Úlenr   r   Úappend)r   ÚdatagramÚaddrs   &&&r   ÚwriteÚMemoryDatagramTransport.write<   sZ   € ð Š<Ø×$Ñ$ˆDØŠ<ÜÐ.Ó/Ð/Üˆx‹=˜4×.Ñ.Ô.ÜÐ-Ó.Ð.Ø×Ñ× Ñ  (Ð!1Ö2r   c                óL   € V P                   P                  4        \        R4      # )z
Shut down this transport.
N)r   ÚstopProtocolr   r   s   &r   ÚstopListeningÚ%MemoryDatagramTransport.stopListeningH   s   € ð 	�‰×#Ñ#Ô%Ü�t‹}Ðr   c                ó   € R# ©z3
Dummy implementation to satisfy L{IUDPTransport}.
N© )r   Úenableds   &&r   ÚsetBroadcastAllowedÚ+MemoryDatagramTransport.setBroadcastAllowedO   ó   € ñ 	r   c                ó   € R# r1   r2   r   s   &r   ÚgetBroadcastAllowedÚ+MemoryDatagramTransport.getBroadcastAllowedU   r6   r   )r   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r#   r*   r.   r4   r8   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s2   ø‡ € ñò ,ò/ò)ô
3òò÷ð r   r   c                   ó4   a € ] tR t^_t o RtR tRR ltRtV tR# )ÚMemoryReactora3  
An L{IReactorTime} and L{IReactorUDP} provider.

Time is controlled deterministically via the base class, L{Clock}.  UDP is
handled in-memory by connecting protocols to instances of
L{MemoryDatagramTransport}.

@ivar udpPorts: A C{dict} mapping port numbers to instances of
    L{MemoryDatagramTransport}.
c                ó@   € \         P                  ! V 4       / V n        R # r   )r	   r   ÚudpPortsr   s   &r   r   ÚMemoryReactor.__init__l   s   € Ü�Š�tÔØˆŽr   c                óâ   € V^ 8X  d!    \        ^R4      pWP                  9  g   K   WP                  9   d   \        R4      h\        W13W$4      pWPP                  V&   VP	                  V4       V# )zB
Pretend to bind a UDP port and connect the given protocol to it.
zAddress in usei   )r   rF   r!   r   ÚmakeConnection)r   r"   r   Ú	interfacer   Ú	transports   &&&&& r   Ú	listenUDPÚMemoryReactor.listenUDPp   sl   € ð �1Œ9ØÜ   EÓ*�ØŸ}™}Ö,ØØ—=‘=Ô ÜÐ-Ó.Ð.Ü+¨YÐ,=¸xÓWˆ	Ø'�‰�dÑØ×Ñ 	Ô*ØÐr   )rF   N)Ú i    )	r:   r;   r<   r=   r>   r   rL   r?   r@   rA   s   @r   rD   rD   _   s   ø‡ € ñ	ò÷ò r   rD   N)r>   Úrandomr   Úzope.interfacer   Úzope.interface.verifyr   Útwisted.internet.addressr   Útwisted.internet.deferr   Útwisted.internet.interfacesr   r   Útwisted.internet.taskr	   r   rD   r2   r   r   Ú<module>rV      s}   ðñõ
 å &Ý -å 0Ý *ß BÝ 'ñ ˆ]Ó÷Dð Dó ðDñN ˆMÐ2Ô 3ñ ˆ[Óô�Eó ó ðñB ˆK˜Ö 'r   