U
    ˆj¯  ã                   @  sN   d Z ddlmZ ddlmZmZ ddlmZ er<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
é    )Úannotations)ÚTYPE_CHECKINGÚDict)ÚLogger)ÚSSHTransportBasec                   @  sX   e Zd ZU dZded< i Zded< dZded< eƒ Zdd	„ Z	d
d„ Z
dd„ Zdd„ ZdS )Ú
SSHServiceNÚbytesÚnamezDict[int, str]ÚprotocolMessageszSSHTransportBase | NoneÚ	transportc                 C  s   dS )zE
        called when the service is active on the transport.
        N© ©Úselfr   r   ú=/tmp/pip-unpacked-wheel-j5h_c8_q/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	   r   Ú	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	   Ú__annotations__r
   r   r   r   r   r   r   r   r   r   r   r   r      s   
r   N)Ú__doc__Ú
__future__r   Útypingr   r   Ztwisted.loggerr   Ztwisted.conch.ssh.transportr   r   r   r   r   r   Ú<module>   s   