
    8j                        d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddl
mZmZ eeee         f         ZeZdZ ed	          Zeez  ZeZ G d
 d          Z G d d          ZddZddZd dZdS )!a  Multicast DNS Service Discovery for Python, v0.14-wmcbrine
Copyright 2003 Paul Scott-Murphy, 2014 William McBrine

This module provides a framework for the use of DNS Service Discovery
using IP multicast.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
    )annotations)
attrgetter   )DNSQuestion	DNSRecord)DNSOutgoing)	_FLAGS_AA_FLAGS_QR_RESPONSE)   x   namec                  &    e Zd ZdZdZdd
ZddZdS )QuestionAnswersz!A group of answers to a question.)mcast_aggregatemcast_aggregate_last_second	mcast_nowucastr   _AnswerWithAdditionalsTyper   r   r   returnNonec                >    || _         || _        || _        || _        dS )zInitialize a QuestionAnswers.Nr   r   r   r   )selfr   r   r   r   s        P/home/user/adhan/venv/lib/python3.11/site-packages/zeroconf/_handlers/answers.py__init__zQuestionAnswers.__init__2   s(     
".+F(((    strc           	     H    d| j          d| j         d| j         d| j         d	S )z7Return a string representation of this QuestionAnswers.zQuestionAnswers(ucast=z, mcast_now=z, mcast_aggregate=z, mcast_aggregate_last_second=)r   )r   s    r   __repr__zQuestionAnswers.__repr__?   sW    OTZ O OT^ O O#3O O+/+KO O O	
r   N)
r   r   r   r   r   r   r   r   r   r   )r   r   )__name__
__module____qualname____doc__	__slots__r   r     r   r   r   r   -   sK        ++XIG G G G
 
 
 
 
 
r   r   c                      e Zd ZdZdZdd
ZdS )AnswerGroupz9A group of answers scheduled to be sent at the same time.)answers
send_aftersend_beforer*   float_r+   r)   r   r   r   c                0    || _         || _        || _        d S )N)r*   r+   r)   )r   r*   r+   r)   s       r   r   zAnswerGroup.__init__M   s     %&r   N)r*   r,   r+   r,   r)   r   r   r   )r!   r"   r#   r$   r%   r   r&   r   r   r(   r(   H   s3        CC8I     r   r(   r)   r   r   r   c                P    t          t          d          }t          ||            |S )-Add answers and additionals to a DNSOutgoing.T)r   _FLAGS_QR_RESPONSE_AA_add_answers_additionals)r)   outs     r   $construct_outgoing_multicast_answersr3   X   s)     +T
2
2CS'***Jr   ucast_sourcebool	questionslist[DNSQuestion]id_int_c                    t          t          d|          }|r|D ]}|                    |           t          ||            |S )r/   F)r   r0   add_questionr1   )r)   r4   r6   r8   r2   questions         r   "construct_outgoing_unicast_answersr=   a   sY     +UC
8
8C '! 	' 	'HX&&&&S'***Jr   r2   r   c                    t          |          }t          |t                    D ]S}|                     |d           ||         }|D ]0}||vr*|                     |           |                    |           1Td S )N)keyr   )setsortedNAME_GETTERadd_answer_at_timeadd_additional_answeradd)r2   r)   sendingansweradditionals
additionals         r   r1   r1   q   s    !'llG k222 ( (vq)))fo% 	( 	(J(())*555J'''	(( (r   N)r)   r   r   r   )
r)   r   r4   r5   r6   r7   r8   r9   r   r   )r2   r   r)   r   r   r   )r$   
__future__r   operatorr   _dnsr   r   _protocol.outgoingr   constr	   r
   dictr@   r   intr9   MULTICAST_DELAY_RANDOM_INTERVALrB   r0   floatr,   r   r(   r3   r=   r1   r&   r   r   <module>rS      sM   , # " " " " "       ) ) ) ) ) ) ) ) , , , , , , 1 1 1 1 1 1 1 1!)S^";< 
 #, j  *Y6 	
 
 
 
 
 
 
 
6               ( ( ( ( ( (r   