+
    Df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     19 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   