+
    üÐjî&  ã                   óŽ   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ]! ]P                  4       ! R R]P                  4      4       t
R# )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                   óÜ   a € ] tR t^t o Rt]! 4       tRtRR ltV 3R lR lt	V 3R lR lt
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tV 3R ltRtV tR# )Ú
SSHChannelaF  
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}
Nc                ó  € T;'       g    R V n         V P                   V n        T;'       g    RV n        W0n        W@n        ^V n        WPn        W`n        Wpn        RV n	        RV n
        . V n        ^ V n        ^ V n        ^ V n        RV n        R# )i   i €  ó    N)ÚlocalWindowSizeÚlocalWindowLeftÚlocalMaxPacketÚremoteWindowLeftÚremoteMaxPacketÚ
areWritingÚconnÚdataÚavatarÚspecificDataÚbufÚextBufÚclosingÚlocalClosedÚremoteClosedÚid)ÚselfÚlocalWindowr   ÚremoteWindowr   r   r   r   s   &&&&&&&&Ú;/usr/lib/python3/dist-packages/twisted/conch/ssh/channel.pyÚ__init__ÚSSHChannel.__init__9   sˆ   € ð  +×4Ð4¨fˆÔØ#×3Ñ3ˆÔØ,×5Ð5°ˆÔØ ,ÔØ.ÔØˆŒØŒ	ØŒ	ØŒØˆÔØˆŒØˆŒØˆŒØˆÔØˆÔØˆŽr	   c                ó    <€ V ^8„  d   QhRS[ /# ©é   Úreturn)Ústr)ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚSSHChannel.__annotate__T   s   ø€ ÷ 0ñ 0™ñ 0r	   c                ó@   € V P                  4       P                  R 4      # )Úascii)Ú	__bytes__Údecode©r   s   &r   Ú__str__ÚSSHChannel.__str__T   s   € Ø�~‰~Ó×&Ñ& wÓ/Ð/r	   c                ó    <€ V ^8„  d   QhRS[ /# r!   ©Úbytes)r%   r&   s   "€r   r'   r(   W   s   ø€ ÷ 
ñ 
™5ñ 
r	   c                ón   € V P                   pV'       g   RpRVV P                  V P                  3,          # )z4
Return a byte string representation of the channel
s   Nones   <SSHChannel %b (lw %d rw %d)>)Únamer   r   )r   r4   s   & r   r+   ÚSSHChannel.__bytes__W   s<   € ð �y‰yˆßØˆDà/ØØ× Ñ Ø×!Ñ!ð3
õ 
ð 	
r	   c                ó  € V P                   R J;'       d    \        V P                   4      ;'       g    RpV P                  '       d   V P                  P                  R4      pMRpRV RV RV P                  P                  4        2# )NÚunknownr*   ÚNonezSSHChannel z (z) on )r   r$   r4   r,   r   Ú	logPrefix)r   r   r4   s   &  r   r9   ÚSSHChannel.logPrefixe   sq   € Ø�g‰g˜TÐ!×2Ð2¤c¨$¯'©'£l×@Ð@°yˆØ�9�9ˆ9Ø—9‘9×#Ñ# GÓ,‰DàˆDØ˜T˜F " R D¨¨d¯i©i×.AÑ.AÓ.CÐ-DÐEÐEr	   c                ó<   € V P                   P                  R4       R# )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                ó@   € V P                   P                  RVR7       R# )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)r=   Úerror)r   rB   s   &&r   Ú
openFailedÚSSHChannel.openFailedv   s   € ð 	�	‰	�‰ÐCÈFˆÖSr	   c                óž  € V P                   V,           V n         V P                  '       g*   V P                  '       g   RV n        V P                  4        V P                  '       d%   V P                  pRV n        V P                  V4       V P                  '       d2   V P                  p. V n        V F  w  r1V P                  W14       K  	  R# R# )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ˆ8Ø—‘ˆAØˆDŒHØ�J‰J�qŒMØ�;�;ˆ;Ø—‘ˆAØˆDŒKÛ‘
�Ø×"Ñ" 4Ö.ó  ñ r	   c                óÊ   € VP                  RR4      P                  R4      p\        V RV,           R4      pV'       d	   V! V4      # V P                  P	                  RVR7       ^ # )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})ÚrequestType)Úreplacer,   Úgetattrr=   r>   )r   rR   r   ÚfooÚfs   &&&  r   ÚrequestReceivedÚSSHChannel.requestReceived”   sX   € ð ×!Ñ! $¨Ó-×4Ñ4°WÓ=ˆÜ�D˜* sÕ*¨DÓ1ˆßÙ�T“7ˆNØ�	‰	�‰Ð<È+ˆÔVÙr	   c                ó@   € V P                   P                  RVR7       R# )z4
Called when we receive data.

@type data: L{bytes}
zgot data {data})r   N©r=   Údebug©r   r   s   &&r   ÚdataReceivedÚSSHChannel.dataReceived¦   s   € ð 	�	‰	�‰Ð)°ˆÖ5r	   c                ó@   € V P                   P                  RWR7       R# )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   NrZ   ©r   r`   r   s   &&&r   ÚextReceivedÚSSHChannel.extReceived®   s   € ð 	�	‰	�‰Ø3¸hð 	ö 	
r	   c                ó<   € V P                   P                  R4       R# )z4
Called when the other side will send no more data.
z
remote eofNr<   r-   s   &r   ÚeofReceivedÚSSHChannel.eofReceived¹   s   € ð 	�	‰	�‰�|Ö$r	   c                ó\   € V P                   P                  R4       V P                  4        R# )z4
Called when the other side has closed the channel.
zremote closeN)r=   r>   ÚloseConnectionr-   s   &r   ÚcloseReceivedÚSSHChannel.closeReceived¿   s    € ð 	�	‰	�‰�~Ô&Ø×ÑÖr	   c                ó<   € V P                   P                  R4       R# )zp
Called when the channel is closed.  This means that both our side and
the remote side have closed the channel.
ÚclosedNr<   r-   s   &r   rl   ÚSSHChannel.closedÆ   s   € ð
 	�	‰	�‰�xÖ r	   c                óR  € V P                   '       d   V ;P                   V,          un         R# \        V4      pW P                  8”  dF   VRV P                   WP                  R uqn         ^ V n        V P	                  4        V P                  pV P
                  pV P                  P                  p\        ^ W#4      pV F  pV! WWfV,            4       K  	  V ;P                  V,          un        V P                  '       d'   V P                   '       g   V P                  4        R# R# R# )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}
N)r   Úlenr   r   ÚstopWritingr   r   ÚsendDataÚranger   rh   )r   r   ÚtopÚrmprH   ÚrÚoffsets   &&     r   rH   ÚSSHChannel.writeÍ   sò   € ð �8�8ˆ8Ø�HŠH˜Õ�HÙÜ�$‹iˆØ×&Ñ&Ô&àÐ,�t×,Ñ,Ð-Ø×*Ñ*Ð,Ð-ð ˆD”(ð  ˆDŒOØ×ÑÔØ×'Ñ'ˆCØ×"Ñ"ˆØ—	‘	×"Ñ"ˆÜ�!�SÓˆÛˆFÙ�$˜V¨s¥lÐ3Ö4ñ à×Ò Õ$ÕØ�<�<ˆ< §§ Ø×ÑÖ!ñ !)‰<r	   c                ó`  € V P                   '       df   V P                   R,          ^ ,          V8X  d)   V P                   R,          ^;;,          V,          uu&   R# V P                   P                  W.4       R# \        V4      V P                  8”  d=   VRV P                   WV P                  R ..uq n         ^ V n        V P                  4        \        V4      V P                  8”  d]   V P                  P                  WVRV P                   4       W P                  R pV ;P                  V P                  ,          un        Kv  V'       d?   V P                  P                  WV4       V ;P                  \        V4      ,          un        V P                  '       d   V P                  4        R# R# )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}
Néÿÿÿÿ)r   Úappendro   r   r   rp   r   r   ÚsendExtendedDatar   rh   ra   s   &&&r   rI   ÚSSHChannel.writeExtendedê   sS  € ð �;�;ˆ;Ø�{‰{˜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×&Ñ& t°tÔ<Ø×!Ò!¤S¨£YÕ.Õ!Ø�<�<ˆ<Ø×ÑÖ!ñ r	   c                óF   € V P                  RP                  V4      4       R# )zj
Part of the Transport interface.  Write a list of strings to the
channel.

@type data: C{list} of L{str}
r	   N)rH   Újoinr\   s   &&r   ÚwriteSequenceÚSSHChannel.writeSequence
  s   € ð 	�
‰
�3—8‘8˜D“>Ö"r	   c                óš   € ^V n         V P                  '       g2   V P                  '       g   V P                  P	                  V 4       R# R# R# )zZ
Close the channel if there is no buferred data.  Otherwise, note the
request and return.
N)r   r   r   r   Ú	sendCloser-   s   &r   rh   ÚSSHChannel.loseConnection  s5   € ð
 ˆŒØ�x�xˆx §§ Ø�I‰I×Ñ Ö%ñ !,‰xr	   c                óJ   € V P                   P                  P                  4       # )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   € V P                   P                  P                  4       # )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                ó   € R# )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   rp   ÚSSHChannel.stopWriting.  ó   ‚ r	   c                ó   € R# )zM
Called when the remote buffer has more room, as a hint to continue
writing.
Nr�   r-   s   &r   rG   ÚSSHChannel.startWriting4  r�   r	   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )r"   r4   r1   )r%   r&   s   "€r   r'   r(      s   ø‡ ‚ ñF ÑòG 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   r=   r4   r   r.   r+   r9   r?   rD   rL   rW   r]   rb   re   ri   rl   rH   rI   r   rh   r†   rŠ   rp   rG   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r&   s   @r   r   r      s—   ø‡ € ññ@ ‹8€DØ€Dô÷60ð 0÷
ð 
òFò'òTò/ò*ò$6ò	
ò%òò!ò"ò:"ò@#ò&ò-ò-òò÷A	 ƒ r	   r   N)r˜   Úzope.interfacer   Útwisted.internetr   Útwisted.loggerr   Útwisted.pythonr   Ú
ITransportr   r�   r	   r   Ú<module>r¡      sE   ðñ
õ 'å 'Ý !Ý ñ ˆZ×"Ñ"Ó#ôc�—‘ó có $òcr	   