o
    `                     @   s   d Z ddlmZmZmZ ddlmZmZ g dZG dd dZ	G dd deZ
e
 ZG d	d
 d
eZG dd deZG dd dZdS )zcMessages for talking to the DBus daemon itself

Generated by jeepney.bindgen and modified by hand.
   )MessageMessageTypeHeaderFields)MessageGeneratornew_method_call)DBusNameFlagsDBusmessage_bus
MonitoringStats	MatchRulec                   @   s   e Zd ZdZdZdZdS )r   r         N)__name__
__module____qualname__Zallow_replacementZreplace_existingZdo_not_queue r   r   6/usr/lib/python3/dist-packages/jeepney/bus_messages.pyr      s    r   c                       s   e Zd ZdZdZ		d- fdd	Zdd Zd.d	d
Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Z  ZS )/r   z(Messages to talk to the message bus
    org.freedesktop.DBus/org/freedesktop/DBusc                       t  j||d d S N)object_pathbus_namesuper__init__selfr   r   	__class__r   r   r         zDBus.__init__c                 C   
   t | dS )NHellor   r   r   r   r   r#         
z
DBus.Hello    c                 C   s   t | dd||fS )NRequestNamesur$   )r   nameflagsr   r   r   r(   "   s   zDBus.RequestNamec                 C      t | dd|fS )NReleaseNamesr$   r   r*   r   r   r   r-   %      zDBus.ReleaseNamec                 C      t | dd|dfS )NStartServiceByNamer)   r'   r$   r/   r   r   r   r2   (   s   zDBus.StartServiceByNamec                 C   r,   )NUpdateActivationEnvironmentza{ss}r$   )r   envr   r   r   r3   ,      z DBus.UpdateActivationEnvironmentc                 C   r,   )NNameHasOwnerr.   r$   r/   r   r   r   r6   0   r0   zDBus.NameHasOwnerc                 C   r"   )N	ListNamesr$   r%   r   r   r   r7   3   r&   zDBus.ListNamesc                 C   r"   )NListActivatableNamesr$   r%   r   r   r   r8   6   r&   zDBus.ListActivatableNamesc                 C   "   t |tr	| }t| dd|fS )z4*rule* can be a str or a :class:`MatchRule` instanceAddMatchr.   
isinstancer   	serialiser   r   Zruler   r   r   r:   9   s   
zDBus.AddMatchc                 C   r9   )NRemoveMatchr.   r;   r>   r   r   r   r?   ?   s   
zDBus.RemoveMatchc                 C   r,   )NGetNameOwnerr.   r$   r/   r   r   r   r@   D   r0   zDBus.GetNameOwnerc                 C   r,   )NListQueuedOwnersr.   r$   r/   r   r   r   rA   G   r0   zDBus.ListQueuedOwnersc                 C   r,   )NGetConnectionUnixUserr.   r$   r/   r   r   r   rB   J   r0   zDBus.GetConnectionUnixUserc                 C   r,   )NGetConnectionUnixProcessIDr.   r$   r/   r   r   r   rC   M   r0   zDBus.GetConnectionUnixProcessIDc                 C   r,   )NGetAdtAuditSessionDatar.   r$   r/   r   r   r   rD   P   r0   zDBus.GetAdtAuditSessionDatac                 C   r,   )N#GetConnectionSELinuxSecurityContextr.   r$   r/   r   r   r   rE   S   r5   z(DBus.GetConnectionSELinuxSecurityContextc                 C   r"   )NReloadConfigr$   r%   r   r   r   rF   W   r&   zDBus.ReloadConfigc                 C   r"   )NGetIdr$   r%   r   r   r   rG   Z   r&   z
DBus.GetIdc                 C   r,   )NGetConnectionCredentialsr.   r$   r/   r   r   r   rH   ]   r0   zDBus.GetConnectionCredentialsr   r   )r'   )r   r   r   __doc__	interfacer   r#   r(   r-   r2   r3   r6   r7   r8   r:   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   __classcell__r   r   r   r   r      s2    
r   c                       s.   e Zd ZdZ		d fdd	Zdd Z  ZS )	r
   zorg.freedesktop.DBus.Monitoringr   r   c                    r   r   r   r   r   r   r   r   e   r!   zMonitoring.__init__c                 C   r1   )z:Convert this connection to a monitor connection (advanced)BecomeMonitorZasur'   r$   )r   Zrulesr   r   r   rM   i   s   zMonitoring.BecomeMonitorrI   )r   r   r   rK   r   rM   rL   r   r   r   r   r
   b   s    r
   c                       s>   e Zd ZdZ		d fdd	Zdd Zdd	 Zd
d Z  ZS )r   z org.freedesktop.DBus.Debug.Statsr   r   c                    r   r   r   r   r   r   r   r   p   r!   zStats.__init__c                 C   r"   )NGetStatsr$   r%   r   r   r   rN   t   r&   zStats.GetStatsc                 C   r,   )NGetConnectionStatsr.   r$   )r   Zarg0r   r   r   rO   w   r5   zStats.GetConnectionStatsc                 C   r"   )NGetAllMatchRulesr$   r%   r   r   r   rP   {   r&   zStats.GetAllMatchRulesrI   )	r   r   r   rK   r   rN   rO   rP   rL   r   r   r   r   r   m   s    r   c                	   @   s`   e Zd ZdZdddddddddddZdded	efd
dZdefddZde	de
fddZdS )r   a>  Construct a match rule to subscribe to DBus messages.
    
    e.g.::
    
        mr = MatchRule(
            interface='org.freedesktop.DBus',
            member='NameOwnerChanged',
            type='signal'
        )
        msg = message_bus.AddMatch(mr)
        # Send this message to subscribe to the signal
    NF)typesenderrK   memberpathpath_namespacedestination	eavesdropc          
      C   sR   t |tr	t| }|| _|||||d}	dd |	 D | _|| _|| _i | _d S )N)rR   rK   rS   rT   rV   c                 S   s   i | ]\}}|d ur||qS )Nr   .0kvr   r   r   
<dictcomp>   s
    z&MatchRule.__init__.<locals>.<dictcomp>)	r<   strr   message_typeitemsheader_fieldsrU   rW   arg_conditions)
r   rQ   rR   rK   rS   rT   rU   rV   rW   fieldsr   r   r   r      s   

zMatchRule.__init__stringargnovaluec                 C   s@   |dvrt d||dkr|dkrt d||f| j|< dS )zAdd a condition for a particular argument
        
        argno: int, 0-63
        kind: 'string', 'path', 'namespace'
        >   rT   rc   	namespacez	kind={!r}rf   r'   z$argno must be 0 for kind='namespace'N)
ValueErrorformatra   )r   rd   re   kindr   r   r   add_arg_condition   s
   zMatchRule.add_arg_conditionreturnc                 C   s   t | j }| jr|d| jjf | jr|d | j D ]\}\}}|dkr,d}|d| | |f q ddd |D S )	zAConvert to a string to use in an AddMatch call to the message busrQ   )rW   truerc    arg,c                 s   s(    | ]\}}d  ||ddV  qdS )z{}='{}''z'\''N)rh   replacerX   r   r   r   	<genexpr>   s    
z&MatchRule.serialise.<locals>.<genexpr>)	listr`   r_   r^   appendr*   rW   ra   join)r   Zpairsrd   valri   r   r   r   r=      s   

zMatchRule.serialisemsgc           
      C   sV  |j }| jdur|j| jkrdS | j D ]\}}|jt| d|kr' dS q| jdurH|jtjd}| j	d}||ksH|
|d sHdS | j D ][\}\}}|t|jkr] dS |j| }	t|	tsj dS |dkrv|	|kru dS qM|dkr|	|ks|dr|	
|s|	dr|
|	s dS qM|dkr|	|ks|	
|d s dS qMd	S )
z%Returns True if msg matches this ruleNF /rc   rT   rf   .T)headerr^   r`   r_   rb   getr   rU   rT   rstrip
startswithra   lenbodyr<   r]   endswith)
r   rw   hZfieldZexpectedrT   Zpath_nsrd   ri   rn   r   r   r   matches   sV   


zMatchRule.matches)rc   )r   r   r   rJ   r   intr]   rj   r=   r   boolr   r   r   r   r   r      s    r   N)rJ   Z	low_levelr   r   r   Zwrappersr   r   __all__r   r   r	   r
   r   r   r   r   r   r   <module>   s    	J