ó
    &ÝNj¸$  ã                   ó\   • S r SSKrSSKJr  SSKJr  SSKJrJrJ	r	  SSK
Jr   " S S5      rg)	z&
Implementation of an SSH2 "message".
é    N)ÚBytesIO)Úutil)Úmax_byteÚone_byteÚ	zero_byte)Úuc                   óÎ   • \ rS rSrSrSrS#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S rS rS rS rS rS rS r S  r!S! r"S"r#g)$ÚMessageé   ab  
An SSH2 message is a stream of bytes that encodes some combination of
strings, integers, bools, and infinite-precision integers.  This class
builds or breaks down such a byte stream.

Normally you don't need to deal with anything this low-level, but it's
exposed for people implementing custom extensions, or features that
paramiko doesn't support yet.
l      ~ Nc                 óJ   • Ub  [        U5      U l        g[        5       U l        g)z–
Create a new SSH2 message.

:param bytes content:
    the byte stream to use as the message content (passed in only when
    decomposing a message).
N)r   Úpacket)ÚselfÚcontents     ÚM/home/mande/repo/quber/.venv/lib/python3.13/site-packages/paramiko/message.pyÚ__init__ÚMessage.__init__,   s   € ð ÑÜ! 'Ó*ˆD�Kä!›)ˆD�Kó    c                 ó"   • U R                  5       $ ©N)Úasbytes©r   s    r   Ú	__bytes__ÚMessage.__bytes__9   s   € Ø�|‰|‹~Ðr   c                 óT   • S[        U R                  R                  5       5      -   S-   $ )z@
Returns a string representation of this object, for debugging.
zparamiko.Message(Ú))Úreprr   Úgetvaluer   s    r   Ú__repr__ÚMessage.__repr__<   s&   € ð #¤T¨$¯+©+×*>Ñ*>Ó*@Ó%AÑAÀCÑGÐGr   c                 ó6   • U R                   R                  5       $ )z?
Return the byte stream content of this Message, as a `bytes`.
)r   r   r   s    r   r   ÚMessage.asbytesC   s   € ð �{‰{×#Ñ#Ó%Ð%r   c                 ó:   • U R                   R                  S5        g)zS
Rewind the message to the beginning as if no items had been parsed
out of it yet.
r   N)r   Úseekr   s    r   ÚrewindÚMessage.rewindI   s   € ð
 	�‰×Ñ˜Õr   c                 ó¤   • U R                   R                  5       nU R                   R                  5       nU R                   R                  U5        U$ )zS
Return the `bytes` of this message that haven't already been parsed and
returned.
)r   ÚtellÚreadr#   )r   ÚpositionÚ	remainders      r   Úget_remainderÚMessage.get_remainderP   s@   € ð
 —;‘;×#Ñ#Ó%ˆØ—K‘K×$Ñ$Ó&ˆ	Ø�‰×Ñ˜Ô"ØÐr   c                 óŒ   • U R                   R                  5       nU R                  5         U R                   R                  U5      $ )zÀ
Returns the `bytes` of this message that have been parsed and
returned. The string passed into a message's constructor can be
regenerated by concatenating ``get_so_far`` and `get_remainder`.
)r   r'   r$   r(   )r   r)   s     r   Ú
get_so_farÚMessage.get_so_farZ   s4   € ð —;‘;×#Ñ#Ó%ˆØ�‰ŒØ�{‰{×Ñ Ó)Ð)r   c                 ó¤   • U R                   R                  U5      nSn[        U5      Us=:  a  U:  a  O  U$ U[        U[        U5      -
  -  -   $ U$ )zá
Return the next ``n`` bytes of the message, without decomposing into an
int, decoded string, etc.  Just the raw bytes are returned. Returns a
string of ``n`` zero bytes if there weren't ``n`` bytes remaining in
the message.
i   )r   r(   Úlenr   )r   ÚnÚbÚmax_pad_sizes       r   Ú	get_bytesÚMessage.get_bytesd   sR   € ð �K‰K×Ñ˜QÓˆØˆÜˆq‹6�AÕ$˜Õ$àˆð ”y A¬¨A«¡JÑ/Ñ/Ð/Øˆr   c                 ó$   • U R                  S5      $ )zÜ
Return the next byte of the message, without decomposing it.  This
is equivalent to `get_bytes(1) <get_bytes>`.

:return:
    the next (`bytes`) byte of the message, or ``b' '`` if there
    aren't any bytes remaining.
é   )r5   r   s    r   Úget_byteÚMessage.get_byteq   s   € ð �~‰~˜aÓ Ð r   c                 ó6   • U R                  S5      nU[        :g  $ )z"
Fetch a boolean from the stream.
r8   )r5   r   ©r   r3   s     r   Úget_booleanÚMessage.get_boolean|   s   € ð �N‰N˜1ÓˆØ”I‰~Ðr   c                 óÚ   • U R                  S5      nU[        :X  a$  [        R                  " U R	                  5       5      $ XR                  S5      -  n[
        R                  " SU5      S   $ )zB
Fetch an int from the stream.

:return: a 32-bit unsigned `int`.
r8   é   ú>Ir   )r5   r   r   Úinflate_longÚ
get_binaryÚstructÚunpack)r   Úbytes     r   Úget_adaptive_intÚMessage.get_adaptive_intƒ   sY   € ð �~‰~˜aÓ ˆØ”8ÓÜ×$Ò$ T§_¡_Ó%6Ó7Ð7Ø—‘˜qÓ!Ñ!ˆÜ�}Š}˜T 4Ó(¨Ñ+Ð+r   c                 óT   • [         R                  " SU R                  S5      5      S   $ )z
Fetch an int from the stream.
rA   é   r   ©rD   rE   r5   r   s    r   Úget_intÚMessage.get_int�   s#   € ô �}Š}˜T 4§>¡>°!Ó#4Ó5°aÑ8Ð8r   c                 óT   • [         R                  " SU R                  S5      5      S   $ )zR
Fetch a 64-bit int from the stream.

:return: a 64-bit unsigned integer (`int`).
ú>Qé   r   rK   r   s    r   Ú	get_int64ÚMessage.get_int64•   s#   € ô �}Š}˜T 4§>¡>°!Ó#4Ó5°aÑ8Ð8r   c                 óJ   • [         R                  " U R                  5       5      $ )zZ
Fetch a long int (mpint) from the stream.

:return: an arbitrary-length integer (`int`).
)r   rB   rC   r   s    r   Ú	get_mpintÚMessage.get_mpint�   s   € ô × Ò  §¡Ó!2Ó3Ð3r   c                 ó@   • U R                  U R                  5       5      $ )zÀ
Fetch a "string" from the stream.  This will actually be a `bytes`
object, and may contain unprintable characters.  (It's not unheard of
for a string to contain another byte-stream message.)
©r5   rL   r   s    r   Ú
get_stringÚMessage.get_string§   s   € ð �~‰~˜dŸl™l›nÓ-Ð-r   c                 ó4   • [        U R                  5       5      $ )zz
Fetch a Unicode string from the stream.

This currently operates by attempting to encode the next "string" as
``utf-8``.
)r   rX   r   s    r   Úget_textÚMessage.get_text±   s   € ô �—‘Ó"Ó#Ð#r   c                 ó@   • U R                  U R                  5       5      $ )z0
Alias for `get_string` (obtains a bytestring).
rW   r   s    r   rC   ÚMessage.get_binaryº   s   € ð �~‰~˜dŸl™l›nÓ-Ð-r   c                 ó@   • U R                  5       R                  S5      $ )zv
Fetch a list of `strings <str>` from the stream.

These are trivially encoded as comma-separated values in a string.
Ú,)r[   Úsplitr   s    r   Úget_listÚMessage.get_listÀ   s   € ð �}‰}‹×$Ñ$ SÓ)Ð)r   c                 ó<   • U R                   R                  U5        U $ )zR
Write bytes to the stream, without any formatting.

:param bytes b: bytes to add
©r   Úwriter<   s     r   Ú	add_bytesÚMessage.add_bytesÈ   ó   € ð 	�‰×Ñ˜!ÔØˆr   c                 ó<   • U R                   R                  U5        U $ )zY
Write a single byte to the stream, without any formatting.

:param bytes b: byte to add
re   r<   s     r   Úadd_byteÚMessage.add_byteÑ   ri   r   c                 ó”   • U(       a!  U R                   R                  [        5        U $ U R                   R                  [        5        U $ )zI
Add a boolean value to the stream.

:param bool b: boolean value to add
)r   rf   r   r   r<   s     r   Úadd_booleanÚMessage.add_booleanÚ   s9   € ö Ø�K‰K×ÑœhÔ'ð ˆð �K‰K×ÑœiÔ(Øˆr   c                 óf   • U R                   R                  [        R                  " SU5      5        U $ ©z=
Add an integer to the stream.

:param int n: integer to add
rA   ©r   rf   rD   Úpack©r   r2   s     r   Úadd_intÚMessage.add_intæ   ó&   € ð 	�‰×Ñœ&Ÿ+š+ d¨AÓ.Ô/Øˆr   c                 ó  • U[         R                  :¼  aF  U R                  R                  [        5        U R                  [        R                  " U5      5        U $ U R                  R                  [        R                  " SU5      5        U $ rq   )
r
   Úbig_intr   rf   r   Ú
add_stringr   Údeflate_longrD   rs   rt   s     r   Úadd_adaptive_intÚMessage.add_adaptive_intï   sd   € ð ”—‘ÓØ�K‰K×ÑœhÔ'Ø�O‰OœD×-Ò-¨aÓ0Ô1ð ˆð �K‰K×ÑœfŸkšk¨$°Ó2Ô3Øˆr   c                 óf   • U R                   R                  [        R                  " SU5      5        U $ )z@
Add a 64-bit int to the stream.

:param int n: long int to add
rO   rr   rt   s     r   Ú	add_int64ÚMessage.add_int64ü   rw   r   c                 óP   • U R                  [        R                  " U5      5        U $ )z•
Add a long int to the stream, encoded as an infinite-precision
integer.  This method only works on positive numbers.

:param int z: long int to add
)rz   r   r{   )r   Úzs     r   Ú	add_mpintÚMessage.add_mpint  s    € ð 	�‰œ×)Ò)¨!Ó,Ô-Øˆr   c                 óœ   • [         R                  " U5      nU R                  [        U5      5        U R                  R                  U5        U $ )zC
Add a bytestring to the stream.

:param byte s: bytestring to add
)r   r   ru   r1   r   rf   )r   Úss     r   rz   ÚMessage.add_string  s8   € ô �LŠL˜‹OˆØ�‰”S˜“VÔØ�‰×Ñ˜!ÔØˆr   c                 óF   • U R                  SR                  U5      5        U $ )zÁ
Add a list of strings to the stream.  They are encoded identically to
a single string of values separated by commas.  (Yes, really, that's
how SSH2 does it.)

:param l: list of strings to add
r`   )rz   Újoin)r   Úls     r   Úadd_listÚMessage.add_list  s   € ð 	�‰˜Ÿ™ ›Ô$Øˆr   c                 óü   • [        U5      [        L a  U R                  U5      $ [        U[        5      (       a  U R                  U5      $ [        U5      [        L a  U R                  U5      $ U R                  U5      $ r   )	ÚtypeÚboolrn   Ú
isinstanceÚintr|   Úlistr‹   rz   )r   Úis     r   Ú_addÚMessage._add'  se   € Ü�‹7”dŠ?Ø×#Ñ# AÓ&Ð&Ü˜œ3×ÑØ×(Ñ(¨Ó+Ð+Ü�!‹WœŠ_Ø—=‘= Ó#Ð#à—?‘? 1Ó%Ð%r   c                 ó8   • U H  nU R                  U5        M     g)zë
Add a sequence of items to the stream.  The values are encoded based
on their type: bytes, str, int, bool, or list.

.. warning::
    Longs are encoded non-deterministically.  Don't use this method.

:param seq: the sequence of items
N)r”   )r   ÚseqÚitems      r   ÚaddÚMessage.add3  s   € ó ˆDØ�I‰I�dŽOò r   )r   r   )$Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ry   r   r   r   r   r$   r+   r.   r5   r9   r=   rG   rL   rQ   rT   rX   r[   rC   rb   rg   rk   rn   ru   r|   r   rƒ   rz   r‹   r”   r™   Ú__static_attributes__© r   r   r
   r
      s    † ñð €Gô$òòHò&òòò*òò	!òò
,ò9ò9ò4ò.ò$ò.ò*òòò
òòòòò	ò	ò&õr   r
   )rŸ   rD   Úior   Úparamikor   Úparamiko.commonr   r   r   Úparamiko.utilr   r
   r¡   r   r   Ú<module>r¦      s*   ðñ&ó Ý å ß 9Ñ 9Ý ÷_ò _r   