U
     T‚g  ã                   @   s.   d Z ddlmZ ddlmZ G dd„ dƒZdS )zŠ
The parent class for all the SSH services.  Currently implemented services
are ssh-userauth and ssh-connection.

Maintainer: Paul Swartz
é    )ÚDict)ÚLoggerc                   @   sX   e Zd ZU dZeed< i Zeee	f ed< dZ
eƒ Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )Ú
SSHServiceNÚnameÚprotocolMessagesc                 C   s   dS )zE
        called when the service is active on the transport.
        N© ©Úselfr   r   ú=/tmp/pip-unpacked-wheel-1_7di8ic/twisted/conch/ssh/service.pyÚserviceStarted   s    zSSHService.serviceStartedc                 C   s   dS )z�
        called when the service is stopped, either by the connection ending
        or by another service being started
        Nr   r   r   r   r
   ÚserviceStopped   s    zSSHService.serviceStoppedc                 C   s   d  | j| jj ¡ ¡S )NzSSHService {!r} on {})Úformatr   Ú	transportÚ	logPrefixr   r   r   r
   r   $   s     
ÿzSSHService.logPrefixc                 C   s\   || j kr<| j | }t| d|dd…  dƒ}|dk	r<||ƒS | jjd||d� | j ¡  dS )zB
        called when we receive a packet on the transport
        zssh_%sé   Nz'couldn't handle {messageNum} {packet!r})Ú
messageNumÚpacket)r   ÚgetattrÚ_logÚinfor   ZsendUnimplemented)r	   r   r   ZmessageTypeÚfr   r   r
   ÚpacketReceived)   s    

ýzSSHService.packetReceived)Ú__name__Ú
__module__Ú__qualname__r   ÚbytesÚ__annotations__r   r   ÚintÚstrr   r   r   r   r   r   r   r   r   r   r
   r      s   
r   N)Ú__doc__Útypingr   Ztwisted.loggerr   r   r   r   r   r
   Ú<module>   s   