+
    DfjB                        R t ^ RIHt ^ RIt^ RI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 ]R	8X  d4   ^ R
IHt ^ RIHt ^ RIHtHtHtHtHtHtHt ]]]].t]]]].t]t]t]t ]t!M^ RIH t HtH!t!HtHtH"t" ] ]!]".t].t^ RI#H$t$H%t%H&t&H't'H(t(H)t) ^ RI*H+t+ ]! ])PX                  ])PZ                  ])P\                  4       ! R R]&P^                  4      4       t0]! ])Pb                  4       ! R R]
]04      4       t2R# )a  
Various asynchronous UDP classes.

Please do not use this module directly.

@var _sockErrReadIgnore: list of symbolic error constants (from the C{errno}
    module) representing socket errors where the error is temporary and can be
    ignored.

@var _sockErrReadRefuse: list of symbolic error constants (from the C{errno}
    module) representing socket errors that indicate connection refused.
)annotationsN)Optional)implementer)MulticastMixin)IReactorMulticast)AbstractDatagramProtocol)platformTypewin32)WSAEINPROGRESS)WSAEWOULDBLOCK)WSAECONNREFUSEDWSAECONNRESETWSAEINTRWSAEMSGSIZEWSAENETRESETWSAENOPROTOOPTWSAETIMEDOUT)EAGAINECONNREFUSEDEINTREMSGSIZEENOPROTOOPTEWOULDBLOCK)abstractaddressbasedefererror
interfaces)logc                     ] tR t^@t$ Rt]P                  tR]R&   ]P                  t
R]R&   R tRtR]R&   RtR!R	 lt]R
 4       tR R ltR tR tR tR tR tR"R ltR tR tR tR tR tR"R ltR tR tR t R t!R t"R t#Rt$R# )#Portay  
UDP port, listening for packets.

@ivar maxThroughput: Maximum number of bytes read in one event
    loop iteration.

@ivar addressFamily: L{socket.AF_INET} or L{socket.AF_INET6}, depending on
    whether this port is listening on an IPv4 address or an IPv6 address.

@ivar _realPortNumber: Actual port number being listened on. The
    value will be L{None} until this L{Port} is listening.

@ivar _preexistingSocket: If not L{None}, a L{socket.socket} instance which
    was created and initialized outside of the reactor and will be used to
    listen for connections (instead of a new socket being created by this
    L{Port}).
zsocket.AddressFamilyaddressFamilyzsocket.SocketKind
socketTypeNzOptional[int]_realPortNumberc                    \         P                  P                  W4       Wn        W n        W@n        W0n        V P                  4        RV n        V P                  4        R# )a  
@param port: A port number on which to listen.
@type port: L{int}

@param proto: A C{DatagramProtocol} instance which will be
    connected to the given C{port}.
@type proto: L{twisted.internet.protocol.DatagramProtocol}

@param interface: The local IPv4 or IPv6 address to which to bind;
    defaults to '', ie all IPv4 addresses.
@type interface: L{str}

@param maxPacketSize: The maximum packet size to accept.
@type maxPacketSize: L{int}

@param reactor: A reactor which will notify this C{Port} when
    its socket is ready for reading or writing. Defaults to
    L{None}, ie the default global reactor.
@type reactor: L{interfaces.IReactorFDSet}
N)
r   BasePort__init__portprotocolmaxPacketSize	interface	setLogStr_connectedAddr_setAddressFamily)selfr(   protor+   r*   reactors   &&&&&&6/usr/lib/python3/dist-packages/twisted/internet/udp.pyr'   Port.__init__]   sI    * 	t-	*""     c                    \         P                  ! W#V P                  4      pVP                  4       ^ ,          pV ! RVVVVR7      pWhn        V# )a  
Create a new L{Port} based on an existing listening
I{SOCK_DGRAM} socket.

@param reactor: A reactor which will notify this L{Port} when
    its socket is ready for reading or writing. Defaults to
    L{None}, ie the default global reactor.
@type reactor: L{interfaces.IReactorFDSet}

@param fd: An integer file descriptor associated with a listening
    socket.  The socket must be in non-blocking mode.  Any additional
    attributes desired, such as I{FD_CLOEXEC}, must also be set already.
@type fd: L{int}

@param addressFamily: The address family (sometimes called I{domain}) of
    the existing socket.  For example, L{socket.AF_INET}.
@type addressFamily: L{int}

@param protocol: A C{DatagramProtocol} instance which will be
    connected to the C{port}.
@type protocol: L{twisted.internet.protocol.DatagramProtocol}

@param maxPacketSize: The maximum packet size to accept.
@type maxPacketSize: L{int}

@return: A new instance of C{cls} wrapping the socket given by C{fd}.
@rtype: L{Port}
N)r+   r1   r*   )socketfromfdr#   getsockname_preexistingSocket)	clsr1   fdr"   r)   r*   r(   r+   r/   s	   &&&&&&   r2   _fromListeningDescriptorPort._fromListeningDescriptor{   sR    @ }}R?$$&q)	'
 #'r4   c                   V ^8  d   QhRR/# )   returnstr )formats   "r2   __annotate__Port.__annotate__   s     @ @# @r4   c                	    V P                   e(   RV P                  P                   RV P                    R2# RV P                  P                   R2# )N<z on >z not connected>)r$   r)   	__class__r/   s   &r2   __repr__Port.__repr__   sO    +t}}../tD4H4H3IKKt}}../??r4   c                    V P                   # )z
Return a socket object.
)r6   rJ   s   &r2   	getHandlePort.getHandle        {{r4   c                F    V P                  4        V P                  4        R# )z
Create and bind my socket, and begin listening on it.

This is called on unserialization, and must be called after creating a
server to begin listening on the specified port.
N)_bindSocket_connectToProtocolrJ   s   &r2   startListeningPort.startListening   s     	!r4   c                @   V P                   f:    V P                  4       pVP                  V P                  V P                  34       MV P                   pRV n         VP                  4       ^,          V n	        \        P                  ! V P                  V P                  4      : RV P                  : 24       ^V n        Wn        V P                  P                   V n        R#   \
         d2   p\        P                  ! T P                  T P                  T4      hRp?ii ; i)a  
Prepare and assign a L{socket.socket} instance to
C{self.socket}.

Either creates a new SOCK_DGRAM L{socket.socket} bound to
C{self.interface} and C{self.port} or takes an existing
L{socket.socket} provided via the
L{interfaces.IReactorSocket.adoptDatagramPort} interface.
Nz starting on )r9   createInternetSocketbindr+   r(   OSErrorr   CannotListenErrorr8   r$   r   msg_getLogPrefixr)   	connectedr6   filenor/   sktles   &  r2   rR   Port._bindSocket   s     ""*M//1$..$))45
 ))C&*D#  #03!!$--0$2F2FH	

 kk((%  M--dnndiiLLMs   7C! !D,,DDc                	\    V P                   P                  V 4       V P                  4        R # N)r)   makeConnectionstartReadingrJ   s   &r2   rS   Port._connectToProtocol   s     $$T*r4   c                b   ^ pWP                   8  d    V P                  P                  V P                  4      w  r#V\	        V4      ,          pV P
                  \        P                  8X  d
   VR,          p V P                  P                  W#4       K  R#   \         d    \        P                  ! 4         K  i ; i  \         dh   pTP                  ^ ,          pT\        9   d    Rp?R# T\        9   d3   T P                   '       d   T P                  P#                  4         Rp?R# h Rp?ii ; i)z-
Called when my socket is ready for reading.
Nr?   NN)maxThroughputr6   recvfromr*   lenr"   AF_INET6r)   datagramReceivedBaseExceptionr   errrY   args_sockErrReadIgnore_sockErrReadRefuser-   connectionRefused)r/   readdataaddrsenos   &     r2   doReadPort.doRead   s     '''![[11$2D2DE
 D	!%%8  8DMM224>/ (0 % GGI+  WWQZ++++***779s;   'B< 6B  B98B9<D.D)+D)D)(D))D.c                n   V P                   '       d2   VRV P                   39   g   Q h V P                  P                  V4      # VR8w  g   Q h\        P                  ! V^ ,          4      '       gP   \        P                  ! V^ ,          4      '       g-   V^ ,          R8w  d   \        P                   ! V^ ,          R4      h\        P                  ! V^ ,          4      '       g   V^ ,          R8X  d>   V P"                  \        P$                  8X  d   \        P                   ! V^ ,          R4      h\        P                  ! V^ ,          4      '       d>   V P"                  \        P&                  8X  d   \        P                   ! V^ ,          R4      h V P                  P)                  W4      #   \         d   pTP                  ^ ,          pT\
        8X  d   T P                  T4      u Rp?# T\        8X  d   \        P                  ! R4      hT\        8X  d!   T P                  P                  4         Rp?R# h Rp?ii ; i  \         dm   pTP                  ^ ,          pT\
        8X  d   T P                  Y4      u Rp?# T\        8X  d   \        P                  ! R4      hT\        8X  d    Rp?R# h Rp?ii ; i)a:  
Write a datagram.

@type datagram: L{bytes}
@param datagram: The datagram to be sent.

@type addr: L{tuple} containing L{str} as first element and L{int} as
    second element, or L{None}
@param addr: A tuple of (I{stringified IPv4 or IPv6 address},
    I{integer port number}); can be L{None} in connected mode.
Nzmessage too longz<broadcast>z0write() only accepts IP addresses, not hostnamesz7IPv6 port write() called with IPv4 or broadcast addressz*IPv4 port write() called with IPv6 address)r-   r6   sendrY   rq   r   writer   r   MessageLengthErrorr   r)   rt   r   isIPAddressisIPv6AddressInvalidAddressErrorr"   rm   AF_INETsendto)r/   datagramrw   rx   ry   s   &&&  r2   r~   
Port.write  s    D$"5"56666{{''11 4<<((a11 ..tAw77G},//GO  $$T!W--aM1I$$7//GV  %%d1g..43E3E3W//GI {{))(99?  	WWQZ;::h//8^223EFF<'MM3355	@  WWQZ;::h558^223EFF<' sT   F) H= )H:4.H5"H:(AH54H55H:=J4.J/6J4<,J/.J//J4c                H    V P                  RP                  V4      V4       R# )a  
Write a datagram constructed from an iterable of L{bytes}.

@param seq: The data that will make up the complete datagram to be
    written.
@type seq: an iterable of L{bytes}

@type addr: L{tuple} containing L{str} as first element and L{int} as
    second element, or L{None}
@param addr: A tuple of (I{stringified IPv4 or IPv6 address},
    I{integer port number}); can be L{None} in connected mode.
r4   N)r~   join)r/   seqrw   s   &&&r2   writeSequencePort.writeSequenceB  s     	

388C=$'r4   c                &   V P                   '       d   \        R4      h\        P                  ! V4      '       g4   \        P                  ! V4      '       g   \
        P                  ! VR4      hW3V n         V P                  P                  W34       R# )z
'Connect' to remote server.
z:already connected, reconnecting is not currently supportednot an IPv4 or IPv6 address.N)	r-   RuntimeErrorr   r   r   r   r   r6   connect)r/   hostr(   s   &&&r2   r   Port.connectQ  su     L  ##D))(2H2H2N2N++D2PQQ#lTL)r4   c                	    V P                  4        V P                  '       d)   V P                  P                  ^ V P                  4       R# R# )    N)stopReadingr]   r1   	callLaterconnectionLostrJ   s   &r2   _loseConnectionPort._loseConnection^  s6    >>>LL""1d&9&9: r4   c                	    V P                   '       d   \        P                  ! 4       ;qn        MR pV P	                  4        V# rd   )r]   r   Deferreddr   )r/   results   & r2   stopListeningPort.stopListeningc  s2    >>>#nn..FVFr4   c                	`    \         P                  ! R \        ^R7       V P                  4        R# )z-Please use stopListening() to disconnect port)
stacklevelN)warningswarnDeprecationWarningr   rJ   s   &r2   loseConnectionPort.loseConnectionk  s%    ;	

 	r4   c                   \         P                  ! RV P                  ,          4       RV n        RV n        \        P
                  P                  W4       V P                  P                  4        V P                  P                  4        V =	V =\        V R4      '       d    V P                  P                  R4       V =R# R# )z
Cleans up my socket.
z(UDP Port %s Closed)Nr   )r   r[   r$   rj   r   r&   r   r)   doStopr6   closer^   hasattrr   callback)r/   reasons   &&r2   r   Port.connectionLosts  s     	&)=)==>#$$T2KK4FFOOD! r4   c                X    V P                  V P                  4      pRV,          V n        R# )z@
Initialize the C{logstr} attribute to be used by C{logPrefix}.
z%s (UDP)N)r\   r)   logstr)r/   	logPrefixs   & r2   r,   Port.setLogStr  s$     &&t}}5	 9,r4   c                `   \         P                  ! V P                  4      '       d   \        P                  V n        R# \         P                  ! V P                  4      '       d   \        P                  V n        R# V P                  '       d"   \        P                  ! V P                  R4      hR# )z(
Resolve address family for the socket.
r   N)
r   r   r+   r6   rm   r"   r   r   r   r   rJ   s   &r2   r.   Port._setAddressFamily  sq     !!$..11!'D!!$..11!'D^^^++ >  r4   c                    V P                   # )z 
Return the prefix to log with.
)r   rJ   s   &r2   r   Port.logPrefix  rP   r4   c                $   V P                   P                  4       pV P                  \         P                  8X  d   \        P
                  ! R.VO5!  # V P                  \         P                  8X  d    \        P                  ! R.VR,          O5!  # R# )z
Return the local address of the UDP connection

@returns: the local address of the UDP connection
@rtype: L{IPv4Address} or L{IPv6Address}
UDPri   N)r6   r8   r"   r   r   IPv4Addressrm   IPv6Address)r/   rw   s   & r2   getHostPort.getHost  so     {{&&(/&&u4t446??2&&u:R:: 3r4   c                x    V P                   P                  \         P                  \         P                  V4       R# )z
Set whether this port may broadcast. This is disabled by default.

@param enabled: Whether the port may broadcast.
@type enabled: L{bool}
N)r6   
setsockopt
SOL_SOCKETSO_BROADCAST)r/   enableds   &&r2   setBroadcastAllowedPort.setBroadcastAllowed  s&     	v00&2E2EwOr4   c                    \        V P                  P                  \        P                  \        P                  4      4      # )zs
Checks if broadcast is currently allowed on this port.

@return: Whether this port may broadcast.
@rtype: L{bool}
)boolr6   
getsockoptr   r   rJ   s   &r2   getBroadcastAllowedPort.getBroadcastAllowed  s,     DKK**6+<+<f>Q>QRSSr4   )r-   r9   r$   r"   r]   r   r^   r+   r   r*   rj   r(   r)   r6   i   )     Nrd   )%__name__
__module____qualname____firstlineno____doc__r6   r   r"   __annotations__
SOCK_DGRAMr#   rj   r$   r9   r'   classmethodr<   rK   rN   rT   rR   rS   rz   r~   r   r   r   r   r   r   r,   r.   r   r   r   r   __static_attributes__rB   r4   r2   r!   r!   @   s    $ +1..M'8$*$5$5J!5M%)O])!< ) )V@"!)F@<|(*;
 -;PTr4   r!   c                  6    ] tR tRtRtR	R R lltR R ltRtR# )
MulticastPorti  z&
UDP Port that supports multicasting.
Nc               4    V ^8  d   QhRRRRRRRRRR	R
RRR/# )r?   r(   intr0   r   r+   rA   r*   r1   zIReactorMulticast | NonelistenMultipler   r@   NonerB   )rC   s   "r2   rD   MulticastPort.__annotate__  sP     - -- (- 	-
 - *- - 
-r4   c                @    \         P                  WW#WE4       W`n        R# )zH
@see: L{twisted.internet.interfaces.IReactorMulticast.listenMulticast}
N)r!   r'   r   )r/   r(   r0   r+   r*   r1   r   s   &&&&&&&r2   r'   MulticastPort.__init__  s     	d%MK,r4   c                   V ^8  d   QhRR/# )r?   r@   zsocket.socketrB   )rC   s   "r2   rD   r     s      m r4   c                   \         P                  V 4      pV P                  '       dx   VP                  \        P
                  \        P                  ^4       \        \        R4      '       d3    VP                  \        P
                  \        P                  ^4       V# V#   \         d"   pTP                  \        8X  d    Rp?T# h Rp?ii ; i)z
Override L{Port.createInternetSocket} to configure the socket to honor
the C{listenMultiple} argument to L{IReactorMulticast.listenMultiple}.
SO_REUSEPORTN)r!   rW   r   r   r6   r   SO_REUSEADDRr   r   rY   errnor   r_   s   &  r2   rW   "MulticastPort.createInternetSocket  s    
 ''-NN6,,f.A.A1Ev~..NN6#4#4f6I6I1M 
s
  xx;. 
 s   ./B! !C,CCC)r   )r   r   NF)r   r   r   r   r   r'   rW   r   rB   r4   r2   r   r     s    - r4   r   )3r   
__future__r   r6   r   typingr   zope.interfacer   twisted.internet._multicastr   twisted.internet.interfacesr   twisted.internet.protocolr   twisted.python.runtimer   r   r
   r   r   r   r   r   r   r   r   r   rr   rs   r   r   r   r   r   twisted.internetr   r   r   r   r   r   twisted.pythonr   IListeningPortIUDPTransportISystemHandler&   r!   IMulticastTransportr   rB   r4   r2   <module>r      s  
 #    & 6 9 > /7$$   #NKP)=,U H"LFEUU %5& O N  z779Q9QwT4== wTwTt Z++,%ND % -%r4   