ó
    Ö›‘hî&  ã                   óŒ   • S r SSKJr  SSKJr  SSKJr  SSKJr  \" \R                  5       " S S\R                  5      5       r
g)	z‘
The parent class for all the SSH Channels.  Currently implemented channels
are session, direct-tcp, and forwarded-tcp.

Maintainer: Paul Swartz
é    )Úimplementer)Ú
interfaces)ÚLogger)Úlogc                   óÖ   • \ rS rSr% Sr\" 5       rSr\\	S'          SS jr
S\4S jrS\4S jrS	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rSr g)Ú
SSHChannelé   aF  
A class that represents a multiplexed channel over an SSH connection.
The channel has a local window which is the maximum amount of data it will
receive, and a remote which is the maximum amount of data the remote side
will accept.  There is also a maximum packet size for any individual data
packet going each way.

@ivar name: the name of the channel.
@type name: L{bytes}
@ivar localWindowSize: the maximum size of the local window in bytes.
@type localWindowSize: L{int}
@ivar localWindowLeft: how many bytes are left in the local window.
@type localWindowLeft: L{int}
@ivar localMaxPacket: the maximum size of packet we will accept in bytes.
@type localMaxPacket: L{int}
@ivar remoteWindowLeft: how many bytes are left in the remote window.
@type remoteWindowLeft: L{int}
@ivar remoteMaxPacket: the maximum size of a packet the remote side will
    accept in bytes.
@type remoteMaxPacket: L{int}
@ivar conn: the connection this channel is multiplexed through.
@type conn: L{SSHConnection}
@ivar data: any data to send to the other side when the channel is
    requested.
@type data: L{bytes}
@ivar avatar: an avatar for the logged-in user (if a server channel)
@ivar localClosed: True if we aren't accepting more data.
@type localClosed: L{bool}
@ivar remoteClosed: True if the other side isn't accepting more data.
@type remoteClosed: L{bool}
NÚnamec                 ó  • U=(       d    SU l         U R                   U l        U=(       d    SU l        X0l        X@l        SU l        XPl        X`l        Xpl        SU l	        SU l
        / U l        SU l        SU l        SU l        S U l        g )Ni   i €  é   ó    r   )ÚlocalWindowSizeÚlocalWindowLeftÚlocalMaxPacketÚremoteWindowLeftÚremoteMaxPacketÚ
areWritingÚconnÚdataÚavatarÚspecificDataÚbufÚextBufÚclosingÚlocalClosedÚremoteClosedÚid)ÚselfÚlocalWindowr   ÚremoteWindowr   r   r   r   s           Ú]C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/conch/ssh/channel.pyÚ__init__ÚSSHChannel.__init__9   s‚   € ð  +×4¨fˆÔØ#×3Ñ3ˆÔØ,×5°ˆÔØ ,ÔØ.ÔØˆŒØŒ	ØŒ	ØŒØˆÔØˆŒØˆŒØˆŒØˆÔØˆÔØˆ�r   Úreturnc                 ó@   • U R                  5       R                  S5      $ )NÚascii)Ú	__bytes__Údecode©r   s    r!   Ú__str__ÚSSHChannel.__str__T   s   € Ø�~‰~Ó×&Ñ& wÓ/Ð/r   c                 ód   • U R                   nU(       d  SnSUU R                  U R                  4-  $ )z4
Return a byte string representation of the channel
s   Nones   <SSHChannel %b (lw %d rw %d)>)r
   r   r   )r   r
   s     r!   r'   ÚSSHChannel.__bytes__W   s<   € ð �y‰yˆÞØˆDà/ØØ× Ñ Ø×!Ñ!ð3
ñ 
ð 	
r   c                 ó  • U R                   S L=(       a    [        U R                   5      =(       d    SnU R                  (       a  U R                  R                  S5      nOSnSU SU SU R                  R                  5        3$ )NÚunknownr&   ÚNonezSSHChannel z (z) on )r   Ústrr
   r(   r   Ú	logPrefix)r   r   r
   s      r!   r2   ÚSSHChannel.logPrefixe   si   € Ø�g‰g˜TÐ!×2¤c¨$¯'©'£l×@°yˆØ�9�9Ø—9‘9×#Ñ# GÓ,‰DàˆDØ˜T˜F " R D¨¨d¯i©i×.AÑ.AÓ.CÐ-DÐEÐEr   c                 ó:   • U R                   R                  S5        g)z’
Called when the channel is opened.  specificData is any data that the
other side sent us when opening the channel.

@type specificData: L{bytes}
zchannel openN©Ú_logÚinfo)r   r   s     r!   ÚchannelOpenÚSSHChannel.channelOpenm   s   € ð 	�	‰	�‰�~Õ&r   c                 ó8   • U R                   R                  SUS9  g)z•
Called when the open failed for some reason.
reason.desc is a string descrption, reason.code the SSH error code.

@type reason: L{error.ConchError}
z(other side refused open
reason: {reason})ÚreasonN)r6   Úerror)r   r;   s     r!   Ú
openFailedÚSSHChannel.openFailedv   s   € ð 	�	‰	�‰ÐCÈFˆÒSr   c                 óŠ  • U R                   U-   U l         U R                  (       d(  U R                  (       d  SU l        U R                  5         U R                  (       a$  U R                  nSU l        U R                  U5        U R                  (       a0  U R                  n/ U l        U H  u  p1U R                  X15        M     gg)zt
Called when bytes are added to the remote window.  By default it clears
the data buffers.

@type data:    L{bytes}
Tr   N)r   r   r   ÚstartWritingr   Úwriter   ÚwriteExtended)r   r   ÚbÚtypes       r!   ÚaddWindowBytesÚSSHChannel.addWindowBytes   s�   € ð !%× 5Ñ 5¸Ñ <ˆÔØ�� t§|§|Ø"ˆDŒOØ×ÑÔØ�8�8Ø—‘ˆAØˆDŒHØ�J‰J�qŒMØ�;�;Ø—‘ˆAØˆDŒKÛ‘
�Ø×"Ñ" 4Ö.ò  ð r   c                 ó¸   • UR                  SS5      R                  S5      n[        U SU-   S5      nU(       a  U" U5      $ U R                  R	                  SUS9  g)	a
  
Called when a request is sent to this channel.  By default it delegates
to self.request_<requestType>.
If this function returns true, the request succeeded, otherwise it
failed.

@type requestType:  L{bytes}
@type data:         L{bytes}
@rtype:             L{bool}
ó   -ó   _r&   Úrequest_Nz#unhandled request for {requestType})ÚrequestTyper   )Úreplacer(   Úgetattrr6   r7   )r   rK   r   ÚfooÚfs        r!   ÚrequestReceivedÚSSHChannel.requestReceived”   sX   € ð ×!Ñ! $¨Ó-×4Ñ4°WÓ=ˆÜ�D˜* sÑ*¨DÓ1ˆÞÙ�T“7ˆNØ�	‰	�‰Ð<È+ˆÑVØr   c                 ó8   • U R                   R                  SUS9  g)z4
Called when we receive data.

@type data: L{bytes}
zgot data {data})r   N©r6   Údebug©r   r   s     r!   ÚdataReceivedÚSSHChannel.dataReceived¦   s   € ð 	�	‰	�‰Ð)°ˆÒ5r   c                 ó8   • U R                   R                  SXS9  g)zo
Called when we receive extended data (usually standard error).

@type dataType: L{int}
@type data:     L{str}
z%got extended data {dataType} {data!r})ÚdataTyper   NrS   ©r   rY   r   s      r!   ÚextReceivedÚSSHChannel.extReceived®   s   € ð 	�	‰	�‰Ø3¸hð 	ò 	
r   c                 ó:   • U R                   R                  S5        g)z4
Called when the other side will send no more data.
z
remote eofNr5   r)   s    r!   ÚeofReceivedÚSSHChannel.eofReceived¹   s   € ð 	�	‰	�‰�|Õ$r   c                 óZ   • U R                   R                  S5        U R                  5         g)z4
Called when the other side has closed the channel.
zremote closeN)r6   r7   ÚloseConnectionr)   s    r!   ÚcloseReceivedÚSSHChannel.closeReceived¿   s    € ð 	�	‰	�‰�~Ô&Ø×ÑÕr   c                 ó:   • U R                   R                  S5        g)zp
Called when the channel is closed.  This means that both our side and
the remote side have closed the channel.
ÚclosedNr5   r)   s    r!   re   ÚSSHChannel.closedÆ   s   € ð
 	�	‰	�‰�xÕ r   c                 ó*  • U R                   (       a  U =R                   U-  sl         g[        U5      nX R                  :”  aE  USU R                   XR                  S sol         SU l        U R	                  5         U R                  nU R
                  nU R                  R                  n[        SX#5      nU H  nU" XXfU-    5        M     U =R                  U-  sl        U R                  (       a#  U R                   (       d  U R                  5         ggg)zÍ
Write some data to the channel.  If there is not enough remote window
available, buffer until it is.  Otherwise, split the data into
packets of length remoteMaxPacket and send them.

@type data: L{bytes}
Nr   )r   Úlenr   r   ÚstopWritingr   r   ÚsendDataÚranger   ra   )r   r   ÚtopÚrmprA   ÚrÚoffsets          r!   rA   ÚSSHChannel.writeÍ   sì   € ð �8�8Ø�HŠH˜Ñ�HØÜ�$‹iˆØ×&Ñ&Ó&àÐ,�t×,Ñ,Ð-Ø×*Ñ*Ð,Ð-ð ˆD”(ð  ˆDŒOØ×ÑÔØ×'Ñ'ˆCØ×"Ñ"ˆØ—	‘	×"Ñ"ˆÜ�!�SÓˆÛˆFÙ�$˜V¨s¡lÐ3Ö4ñ à×Ò Ñ$ÕØ�<�< §§Ø×ÑÕ!ð !)ˆ<r   c                 óF  • U R                   (       aN  U R                   S   S   U:X  a  U R                   S   S==   U-  ss'   gU R                   R                  X/5        g[        U5      U R                  :”  a<  USU R                   XU R                  S //so l         SU l        U R                  5         [        U5      U R                  :”  aq  U R                  R                  XUSU R                   5        X R                  S nU =R                  U R                  -  sl        [        U5      U R                  :”  a  Mq  U(       a:  U R                  R                  XU5        U =R                  [        U5      -  sl        U R                  (       a  U R                  5         gg)zï
Send extended data to this channel.  If there is not enough remote
window available, buffer until there is.  Otherwise, split the data
into packets of length remoteMaxPacket and send them.

@type dataType: L{int}
@type data:     L{bytes}
éÿÿÿÿr   r   N)r   Úappendrh   r   r   ri   r   r   ÚsendExtendedDatar   ra   rZ   s      r!   rB   ÚSSHChannel.writeExtendedê   se  € ð �;�;Ø�{‰{˜2‰˜qÑ! XÓ-Ø—‘˜B‘ Ó" dÑ*Ó"ð ð —‘×"Ñ" HÐ#3Ô4ØÜˆt‹9�t×,Ñ,Ó,àÐ,�t×,Ñ,Ð-Ø ×!6Ñ!6Ð!8Ð9Ð:Ð;ð ˆD”+ð  ˆDŒOØ×ÑÔÜ�$‹i˜$×.Ñ.Ó.Ø�I‰I×&Ñ& t°tÐ<R¸d×>RÑ>RÐ7SÔTØ×,Ñ,Ð.Ð/ˆDØ×!Ò! T×%9Ñ%9Ñ9Õ!ô �$‹i˜$×.Ñ.Õ.ö Ø�I‰I×&Ñ& t°tÔ<Ø×!Ò!¤S¨£YÑ.Õ!Ø�<�<Ø×ÑÕ!ð r   c                 óD   • U R                  SR                  U5      5        g)zj
Part of the Transport interface.  Write a list of strings to the
channel.

@type data: C{list} of L{str}
r   N)rA   ÚjoinrU   s     r!   ÚwriteSequenceÚSSHChannel.writeSequence
  s   € ð 	�
‰
�3—8‘8˜D“>Õ"r   c                 ó�   • SU l         U R                  (       d.  U R                  (       d  U R                  R	                  U 5        ggg)zZ
Close the channel if there is no buferred data.  Otherwise, note the
request and return.
r   N)r   r   r   r   Ú	sendCloser)   s    r!   ra   ÚSSHChannel.loseConnection  s1   € ð
 ˆŒØ�x�x §§Ø�I‰I×Ñ Õ%ð !,ˆxr   c                 óJ   • U R                   R                  R                  5       $ )zm
See: L{ITransport.getPeer}

@return: The remote address of this connection.
@rtype: L{SSHTransportAddress}.
)r   Ú	transportÚgetPeerr)   s    r!   r   ÚSSHChannel.getPeer  ó   € ð �y‰y×"Ñ"×*Ñ*Ó,Ð,r   c                 óJ   • U R                   R                  R                  5       $ )zy
See: L{ITransport.getHost}

@return: An address describing this side of the connection.
@rtype: L{SSHTransportAddress}.
)r   r~   ÚgetHostr)   s    r!   rƒ   ÚSSHChannel.getHost%  r�   r   c                 ó   • g)zo
Called when the remote buffer is full, as a hint to stop writing.
This can be ignored, but it can be helpful.
N© r)   s    r!   ri   ÚSSHChannel.stopWriting.  ó   � r   c                 ó   • g)zM
Called when the remote buffer has more room, as a hint to continue
writing.
Nr†   r)   s    r!   r@   ÚSSHChannel.startWriting4  rˆ   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   NNN)!Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r6   r
   ÚbytesÚ__annotations__r"   r1   r*   r'   r2   r8   r=   rE   rP   rV   r[   r^   rb   re   rA   rB   rx   ra   r   rƒ   ri   r@   Ú__static_attributes__r†   r   r!   r   r      s¬   ‡ ññ@ ‹8€DØ€Dˆ%Óð ØØØØØØôð60˜ô 0ð
˜5ô 
òFò'òTò/ò*ò$6ò	
ò%òò!ò"ò:"ò@#ò&ò-ò-òõr   r   N)r�   Úzope.interfacer   Útwisted.internetr   Útwisted.loggerr   Útwisted.pythonr   Ú
ITransportr   r†   r   r!   Ú<module>r˜      sE   ðñ
õ 'å 'Ý !Ý ñ ˆZ×"Ñ"Ó#ôc�—‘ó có $ñcr   