+
        [                     X   ^ RI Ht ^ RIHtHtHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHtHt  ! R R	4      t]! 4       tR
 tR tR tR tR tR tR tR tR t]! RRR7       ! R R4      4       t]! RRR7       ! R R4      4       t]! RRR7       ! R R4      4       t]! RRR7       ! R R4      4       t]! RRR7       ! R R4      4       t]! RRR7       ! R R 4      4       t ]! RR!7       ! R" R#4      4       t!]! RRR7       ! R$ R%4      4       t"]! RRR7       ! R& R'4      4       t#]! RRR7       ! R( R)4      4       t$]! RRR7       ! R* R+4      4       t%R,^R-^<R.RCR/RD/t&]! RRR7       ! R0 R14      4       t']! RR!7       ! R2 R34      4       t(]! RR!7       ! R4 R54      4       t)]! RR!7       ! R6 R74      4       t*]! RR!7       ! R8 R94      4       t+]! RR!7       ! R: R;4      4       t,]! RR!7       ! R< R=4      4       t-]! RR!7       ! R> R?4      4       t.]! RR!7       ! R@ RA4      4       t/RB# )E    )ClassVar)	dataclassfieldInitVar)	functions)check_ipset_name)REJECT_TYPES)errors)FirewallErrorBugErrorc                   &   a  ] tR t^t o R tRtV tR# )_EOLTypec                    R # )zfirewall.core.rich.EOL selfs   &7/usr/lib/python3.14/site-packages/firewall/core/rich.py__repr___EOLType.__repr__   s    '    r   N)__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__s   @r   r   r      s     ( (r   r   c                     V f   Ve   R# V e   Vf   R# V f   Vf   R# \        V 4      \        V4      J d   W8  # \        V 4      P                  \        V4      P                  8  # )NTF)typer   leftrights   &&r   
lt_objectsr$      s_    |)		em	%-	dtE{	"|Dz""T%[%9%999r   c                 4    V P                   VP                   8  # N)familyr!   s   &&r   	lt_familyr(   +   s    ;;%%r   c                 4    V P                   VP                   8  # r&   )priorityr!   s   &&r   lt_priorityr+   /   s    ==5>>))r   c                 B    \        V P                  VP                  4      # r&   )r$   sourcer!   s   &&r   	lt_sourcer.   3       dkk5<<00r   c                 B    \        V P                  VP                  4      # r&   )r$   destinationr!   s   &&r   lt_destinationr2   7   s    d&&(9(9::r   c                 B    \        V P                  VP                  4      # r&   )r$   elementr!   s   &&r   
lt_elementr5   ;   s    dllEMM22r   c                 B    \        V P                  VP                  4      # r&   )r$   logr!   s   &&r   lt_logr8   ?   s    dhh		**r   c                 B    \        V P                  VP                  4      # r&   )r$   auditr!   s   &&r   lt_auditr;   C   s    djj%++..r   c                 B    \        V P                  VP                  4      # r&   )r$   actionr!   s   &&r   	lt_actionr>   G   r/   r   T)frozenorderc                   @   a  ] tR t^Kt o RtRtR tR tV 3R ltRt	V t
R# )Rich_SourceqThis object only holds data and is read-only after init. It is also
hashable and can be used as a dictionary key.Fc                2   \        V P                  V P                  V P                  .4      '       g   \	        \
        P                  R 4      hV P                  f   \        P                  V RR4       V P                  f   \        P                  V RR4       V P                  f   \        P                  V RR4       V P                  '       d[   V P                  '       d   \	        \
        P                  R4      hV P                  '       d   \	        \
        P                  R4      hR# V P                  '       d   V P                  '       d   \	        \
        P                  R4      h\        P                  ! V P                  4      '       g.   \	        \
        P                  \        V P                  4      4      hR# V P                  '       dK   \        V P                  4      '       g.   \	        \
        P                  \        V P                  4      4      hR# R# )	zno address, mac and ipsetNaddr macipsetzaddress and macaddress and ipsetzmac and ipset)anyrE   rG   rH   r   r
   INVALID_RULEobject__setattr__r   	check_macINVALID_MACstrr   INVALID_IPSETr   s   &r   __post_init__Rich_Source.__post_init__U   sg   DIItxx455 3 35PQQ99tVR088tUB/::tWb1999xxx#F$7$79JKKzzz#F$7$79LMM XXXzzz#F$7$7II&&txx00#F$6$6DHHFF 1ZZZ#DJJ//#F$8$8#djj/JJ 0 r   c                H   R V P                   '       d   RMR,          pV P                  '       d   VRV P                  ,          ,           # V P                  '       d   VRV P                  ,          ,           # V P                  '       d   VRV P                  ,          ,           # R# )z	source%s  NOTrF   address="%s"zmac="%s"
ipset="%s"N)invertrE   rG   rH   r   rets   & r   __str__Rich_Source.__str__n   sr    t{{{V;999$))333XXXdhh...ZZZ

222 r   c                J   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[;R&   # )   rE   rG   rH   rX   rP   bool)formatr   s   "r   __annotate__Rich_Source.__annotate__K   s6     
 I  
H  J   r   r   Nr   r   r   r   __doc__rX   rR   r[   __annotate_func__r   r   r   s   @r   rB   rB   K   s$     5 FK23G  r   rB   c                   @   a  ] tR t^xt o RtRtR tR tV 3R ltRt	V t
R# )Rich_DestinationrC   Fc                T   \        V P                  V P                  .4      '       g   \        \        P
                  R 4      hV P                  f   \        P                  V RR4       V P                  f   \        P                  V RR4       V P                  '       d/   V P                  '       d   \        \        P
                  R4      hR# V P                  '       dK   \        V P                  4      '       g.   \        \        P                  \        V P                  4      4      hR# R# )zno address or ipsetNrE   rF   rH   rI   )rJ   rE   rH   r   r
   INVALID_DESTINATIONrL   rM   r   rQ   rP   r   s   &r   rR   Rich_Destination.__post_init__   s    DIItzz*++ : :<QRR99tVR0::tWb1999zzz#F$>$>@STT ZZZ#DJJ//#F$8$8#djj/JJ 0 r   c                    R V P                   '       d   RMR,          pV P                  '       d   VRV P                  ,          ,           # V P                  '       d   VRV P                  ,          ,           # R# )zdestination%s rU   rF   rV   rW   N)rX   rE   rH   rY   s   & r   r[   Rich_Destination.__str__   sU    DKKK&R@999$))333ZZZ

222 r   c                >   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[;R&   # )r^   rE   rH   rX   r_   )ra   r   s   "r   rb   Rich_Destination.__annotate__x   s*     
 I  J   r   r   Nrd   r   s   @r   rh   rh   x   s#     5
 FK 33  r   rh   c                   6   a  ] tR t^t o RtR tV 3R ltRtV tR# )Rich_ServicerC   c                (    R V P                   ,          # )zservice name="%s"namer   s   &r   r[   Rich_Service.__str__   s    "dii00r   c                &   < V ^8  d   Qh/ S[ ;R&   # r^   rt   rP   )ra   r   s   "r   rb   Rich_Service.__annotate__        
 I r   r   N)	r   r   r   r   re   r[   rf   r   r   r   s   @r   rq   rq      s     5
1  r   rq   c                   <   a  ] tR t^t o RtR tR tV 3R ltRtV t	R# )	Rich_PortrC   c                   \         P                  ! V P                  4      '       g%   \        \        P
                  V P                  4      hV P                  R9  d%   \        \        P                  V P                  4      hR# tcpNr   udpsctpdccpr   
check_portportr   r
   INVALID_PORTprotocolINVALID_PROTOCOLr   s   &r   rR   Rich_Port.__post_init__   W    ##DII.. 3 3TYY??== >> 7 7GG ?r   c                @    R V P                   : RV P                  : R2# )zport port="" protocol=""r   r   r   s   &r   r[   Rich_Port.__str__   s    15DMMJJr   c                2   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   # r^   r   r   rx   )ra   r   s   "r   rb   Rich_Port.__annotate__        
 I  M r   r   N
r   r   r   r   re   rR   r[   rf   r   r   r   s   @r   r|   r|      s     5HK  r   r|   c                   <   a  ] tR t^t o RtR tR tV 3R ltRtV t	R# )Rich_SourcePortrC   c                   \         P                  ! V P                  4      '       g%   \        \        P
                  V P                  4      hV P                  R9  d%   \        \        P                  V P                  4      hR# r~   r   r   s   &r   rR   Rich_SourcePort.__post_init__   r   r   c                @    R V P                   : RV P                  : R2# )zsource-port port="r   r   r   r   s   &r   r[   Rich_SourcePort.__str__   s    8<		4==QQr   c                2   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   # r   rx   )ra   r   s   "r   rb   Rich_SourcePort.__annotate__   r   r   r   Nr   r   s   @r   r   r      s     5HR  r   r   c                   <   a  ] tR t^t o RtR tR tV 3R ltRtV t	R# )Rich_ProtocolrC   c                    \         P                  ! V P                  4      '       g%   \        \        P
                  V P                  4      hR # r&   )r   checkProtocolvaluer   r
   r   r   s   &r   rR   Rich_Protocol.__post_init__   s3    &&tzz22 7 7DD 3r   c                (    R V P                   ,          # )zprotocol value="%s"r   r   s   &r   r[   Rich_Protocol.__str__   s    $

33r   c                &   < V ^8  d   Qh/ S[ ;R&   # r^   r   rx   )ra   r   s   "r   rb   Rich_Protocol.__annotate__        
 J r   r   Nr   r   s   @r   r   r      s     5
E4  r   r   )r?   c                   *   a  ] tR t^t o RtR tRtV tR# )Rich_MasqueraderC   c                    R # )
masquerader   r   s   &r   r[   Rich_Masquerade.__str__   s    r   r   N)r   r   r   r   re   r[   r   r   r   s   @r   r   r      s     5 r   r   c                   <   a  ] tR t^t o RtR tR tV 3R ltRtV t	R# )Rich_IcmpBlockrC   c                    V P                   e   \        V P                   4      ^8  d.   \        \        P                  \        V P                   4      4      hR # r&   rt   lenr   r
   INVALID_ICMPTYPErP   r   s   &r   rR   Rich_IcmpBlock.__post_init__   ;    99DII 2 7 7TYYHH !3r   c                (    R V P                   ,          # )zicmp-block name="%s"rs   r   s   &r   r[   Rich_IcmpBlock.__str__   s    %33r   c                &   < V ^8  d   Qh/ S[ ;R&   # rw   rx   )ra   r   s   "r   rb   Rich_IcmpBlock.__annotate__   rz   r   r   Nr   r   s   @r   r   r      s     5
I4  r   r   c                   <   a  ] tR t^t o RtR tR tV 3R ltRtV t	R# )Rich_IcmpTyperC   c                    V P                   e   \        V P                   4      ^8  d.   \        \        P                  \        V P                   4      4      hR # r&   r   r   s   &r   rR   Rich_IcmpType.__post_init__   r   r   c                (    R V P                   ,          # )zicmp-type name="%s"rs   r   s   &r   r[   Rich_IcmpType.__str__   s    $		22r   c                &   < V ^8  d   Qh/ S[ ;R&   # rw   rx   )ra   r   s   "r   rb   Rich_IcmpType.__annotate__   rz   r   r   Nr   r   s   @r   r   r      s     5
I3  r   r   c                   <   a  ] tR t^t o RtR tR tV 3R ltRtV t	R# )Rich_Tcp_Mss_ClamprC   c                
   V P                   f   \        P                  V RR4       V P                   '       dL   \        P                  ! V P                   4      '       g$   \        \        P                  \        V 4      4      hR # R # )Nr   rF   )	r   rL   rM   r   checkTcpMssClampr   r
   rK   rP   r   s   &r   rR    Rich_Tcp_Mss_Clamp.__post_init__  s]    ::tWb1:::--djj99#F$7$7TCC : r   c                P    V P                   '       d   R V P                   ,          # R# )ztcp-mss-clamp value="%s"tcp-mss-clampr   r   s   &r   r[   Rich_Tcp_Mss_Clamp.__str__  s    :::-<<"r   c                &   < V ^8  d   Qh/ S[ ;R&   # r   rx   )ra   r   s   "r   rb   Rich_Tcp_Mss_Clamp.__annotate__   r   r   r   Nr   r   s   @r   r   r      s     5
D#  r   r   c                   <   a  ] tR tRt o RtR tR tV 3R ltRtV t	R# )Rich_ForwardPorti  rC   c                   V P                   f   \        P                  V RR4       V P                  f   \        P                  V RR4       \        P
                  ! V P                  4      '       g%   \        \        P                  V P                  4      hV P                  R9  d%   \        \        P                  V P                  4      hV P                   '       g7   V P                  '       g%   \        \        P                  V P                   4      hV P                   '       dM   \        P
                  ! V P                   4      '       g%   \        \        P                  V P                   4      hR # R # )Nto_portrF   
to_addressr   )r   rL   rM   r   r   r   r   r   r
   r   r   r   r   s   &r   rR   Rich_ForwardPort.__post_init__  s    <<tY3??"t\26##DII.. 3 3TYY??== >> 7 7GG|||DOOO 3 3T\\BB<<<	 4 4T\\ B B 3 3T\\BB !C<r   c                    R V P                   : RV P                  : RV P                  R8w  d   RV P                  ,          MR: V P                  R8w  d   RV P                  ,          : 2# R: 2# )zforward-port port="r   r   rF   z to-port="%s"z to-addr="%s")r   r   r   r   r   s   &r   r[   Rich_ForwardPort.__str__-  sd    IIMM.2llb.@Odll*bH15B1FOdoo-N	
 	
 MON	
 	
r   c                J   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   # )r^   r   r   r   r   rx   )ra   r   s   "r   rb   Rich_ForwardPort.__annotate__  s5     
 I  M  L  O r   r   Nr   r   s   @r   r   r     s     5C
3  r   r   smhdc                   p   a  ] tR tRt o Rt^ t]! RR7      t]! RR7      tR t	R t
R tR tV 3R	 ltR
tV tR# )
Rich_Limiti>  rC   F)initc                H   V P                  V4      w  r#\        P                  V R V4       \        P                  V RV4       \        P                  V RV P                  V P                  4      4       \        P                  V RV P
                   RV P                   24       R# )ratedurationburstr   /N)_value_parserL   rM   _burst_parser   r   r   )r   r   r   r   s   &&  r   rR   Rich_Limit.__post_init__H  s~    **514.4X64$*;*;DJJ*GH4TYYKq*HIr   c                ^   R pRV9   d   VP                  R4      pV'       d   \        V4      ^8w  d   \        \        P                  V4      hVw  r4 \        V4      pTP                  4       pTR9   d
   TR,          pT^8  g   TR9  d   \        \        P                  T4      hR\        T,          ,          T,          ^ 8X  d   \        \        P                  T R24      hT^8X  d%   TR8X  d   \        \        P                  T R24      hY43#    \        \        P                  T4      h; i)	Nr   :N   Nr   i'  z	 too fastz	 too slow)secondminutehourday)r   r   r   r   )splitr   r   r
   INVALID_LIMITintstripDURATION_TO_MULT)r   r   splitsr   r   s   &&   r   r   Rich_Limit._value_parseO  s   %<[[%FV) 4 4e<<!	=t9D >>#::|H!8x';; 4 4e<<#H--5: 4 4y6IJJ19S 4 4y6IJJ~%	= 4 4e<<s   D D,c                    Vf   ^ #  \        V4      pT^ 8  g   TR8  d   \        \        P                  T4      hT#    \        \        P                  T4      h; i)Ni )r   r   r
   r   )r   r   bs   && r   r   Rich_Limit._burst_parsel  sY    =	=E
A q5A
N 4 4e<<	= 4 4e<<s	   = Ac                v    R V P                    R2pV P                  '       d   VRV P                   2,          pV# )zlimit value="r   z burst=r   r   )r   r   s   & r   r[   Rich_Limit.__str__z  s7    DJJ<q):::74::,''Ar   c                Z   < V ^8  d   Qh/ S[ S[,          ;R&   S[;R&   S[;R&   S[;R&   # )r^   r   r   r   r   )r   rP   r   )ra   r   s   "r   rb   Rich_Limit.__annotate__>  s<     
 3<  N  !  % r   r   N)r   r   r   r   re   r   r   r   r   rR   r   r   r[   rf   r   r   r   s   @r   r   r   >  sB     5 E5!Du%HJ:y  r   r   c                   N   a  ] tR tRt o RtRtRtRtR tR t	R t
V 3R ltR	tV tR# )
Rich_Logi  rC   rF   Nc                   V P                   f   \        P                  V RR4       V P                  f   \        P                  V RR4       V P                   '       d5   \	        V P                   4      ^8  d   \        \        P                  R4      hV P                  '       d8   V P                  R9  d%   \        \        P                  V P                  4      hR # R # )NprefixrF   level+maximum accepted length of 'prefix' is 127.)emergalertcriterrorwarningnoticeinfodebug)	r   rL   rM   r   r   r   r
   INVALID_LOG_PREFIXINVALID_LOG_LEVELr   s   &r   rR   Rich_Log.__post_init__  s    ;;tXr2::tWb1;;;3t{{+c1))+X  :::$** 	-
 	
   8 8$**EE	
:r   c                    V P                   VP                   8  d   R # V P                  VP                  8  d   R # \        V P                  VP                  4      '       d   R # R# TF)r   r   r$   limitr   others   &&r   __lt__Rich_Log.__lt__  sC    ;;%ZZ%++%

EKK00r   c                    R V P                   '       d   RV P                   ,          MR: V P                  '       d   RV P                  ,          MR: V P                  '       d   RV P                  ,          : 2# R: 2# )r7    prefix="%s"rF   z level="%s" %s)r   r   r  r   s   &r   r[   Rich_Log.__str__  sg    .2kkkNdkk*rA,0JJJMTZZ(B>"&***EDJJ4
 	
 354
 	
r   c                >   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[;R&   # )r^   r   r   r  rP   r   )ra   r   s   "r   rb   Rich_Log.__annotate__  s+     
   O   r   r   )r   r   r   r   re   r   r   r  rR   r  r[   rf   r   r   r   s   @r   r   r     s3     5 FEEF.
U  r   r   c                   F   a  ] tR tRt o RtRtR tR tR tV 3R lt	Rt
V tR# )	
Rich_NFLogi  rC   Nc           	        V P                   f   \        P                  V R^ 4       V P                  f   \        P                  V RR4       V P                  f   \        P                  V R^ 4       V P                   '       dA   \
        P                  ! V P                   4      '       g   \        \        P                  R4      h\        P                  V R\        \        V P                   4      ^ 4      4       V P                  '       d5   \        V P                  4      ^8  d   \        \        P                  R4      hV P                  '       dA   \
        P                  ! V P                  4      '       g   \        \        P                  R4      h\        P                  V R\        \        V P                  4      ^ 4      4       R # )Ngroupr   rF   	thresholdz5nflog 'group' must be an integer between 0 and 65535.r  z:nflog 'queue-size' must be an integer between 0 and 65535.)r  rL   rM   r   r  r   checkUINT16r   r
   INVALID_NFLOG_GROUPr   rP   r   r
  INVALID_NFLOG_QUEUEr   s   &r   rR   Rich_NFLog.__post_init__  s=   ::tWa0;;tXr2>>!t[!4:::i33DJJ??**G  	4#c$**oq*AB;;;3t{{+c1))+X  >>>)"7"7"G"G**L  	4c#dnn2Eq.IJr   c                   V P                   VP                   8  d   R # V P                  VP                  8  d   R # V P                  VP                  8  d   R # \        V P                  VP                  4      '       d   R # R# r  )r  r   r  r$   r  r  s   &&r   r  Rich_NFLog.__lt__  sV    ::#[[5<<'^^eoo-

EKK00r   c                N   R V P                   '       d   RV P                   ,          MR: V P                  '       d   RV P                  ,          MR: V P                  '       d   RV P                  ,          MR: V P                  '       d   RV P                  ,          : 2# R: 2# )nflogz group="%s"rF   r  z queue-size="%s"r  )r  r   r  r  r   s   &r   r[   Rich_NFLog.__str__  s    ,0JJJMTZZ(B>.2kkkNdkk*rA59^^^$..1K"&***EDJJ4	
 	
 354	
 	
r   c                J   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[ ;R&   S[;R&   # )r^   r  r   r  r  )r   rP   r   )ra   r   s   "r   rb   Rich_NFLog.__annotate__  s6     
 J  K  N   r   r   r   r   r   r   re   r  rR   r  r[   rf   r   r   r   s   @r   r  r    s)     5 EK6

c  r   r  c                   @   a  ] tR tRt o RtRtR tR tV 3R ltRt	V t
R# )
Rich_Auditi  rC   Nc                V    \        V P                  VP                  4      '       d   R # R# r  r$   r  r  s   &&r   r  Rich_Audit.__lt__      djj%++..r   c                j    R V P                   '       d   RV P                   ,          ,          # R,          # )zaudit%sr  rF   r  r   s   &r   r[   Rich_Audit.__str__  s&    $***EDJJ.EE"EEr   c                &   < V ^8  d   Qh/ S[ ;R&   # r^   r  r   )ra   r   s   "r   rb   Rich_Audit.__annotate__       
  r   r   r   r   r   r   re   r  r  r[   rf   r   r   r   s   @r   r-  r-    s#     5 EF  r   r-  c                   @   a  ] tR tRt o RtRtR tR tV 3R ltRt	V t
R# )Rich_Accepti  rC   Nc                V    \        V P                  VP                  4      '       d   R # R# r  r/  r  s   &&r   r  Rich_Accept.__lt__  r1  r   c                j    R V P                   '       d   RV P                   ,          ,          # R,          # )zaccept%sr  rF   r3  r   s   &r   r[   Rich_Accept.__str__  s&    4:::UTZZ/FF2FFr   c                &   < V ^8  d   Qh/ S[ ;R&   # r6  r7  )ra   r   s   "r   rb   Rich_Accept.__annotate__  r9  r   r   r:  r   s   @r   r<  r<    s#     5 EG  r   r<  c                   D   a  ] tR tRt o RtRtRtR tR tV 3R lt	Rt
V tR# )	Rich_Rejecti  rC   rF   Nc                    V P                   VP                   8  d   R # \        V P                  VP                  4      '       d   R # R# r  )r    r$   r  r  s   &&r   r  Rich_Reject.__lt__  s0    99uzz!

EKK00r   c                    R V P                   '       d   RV P                   ,          MR: V P                  '       d   RV P                  ,          : 2# R: 2# )rejectz
 type="%s"rF   r  )r    r  r   s   &r   r[   Rich_Reject.__str__  sL    (,			L499$r9"&***EDJJ4
 	
244
 	
r   c                2   < V ^8  d   Qh/ S[ ;R&   S[;R&   # )r^   r    r  r  )ra   r   s   "r   rb   Rich_Reject.__annotate__  s     
 N   r   r   )r   r   r   r   re   r    r  r  r[   rf   r   r   r   s   @r   rD  rD    s'     5 DE
!  r   rD  c                   @   a  ] tR tRt o RtRtR tR tV 3R ltRt	V t
R# )	Rich_Dropi&  rC   Nc                V    \        V P                  VP                  4      '       d   R # R# r  r/  r  s   &&r   r  Rich_Drop.__lt__-  r1  r   c                j    R V P                   '       d   RV P                   ,          ,          # R,          # )zdrop%sr  rF   r3  r   s   &r   r[   Rich_Drop.__str__3  s&    54::-DDDDr   c                &   < V ^8  d   Qh/ S[ ;R&   # r6  r7  )ra   r   s   "r   rb   Rich_Drop.__annotate__&  r9  r   r   r:  r   s   @r   rM  rM  &  s#     5 EE  r   rM  c                   F   a  ] tR tRt o RtRtR tR tR tV 3R lt	Rt
V tR# )		Rich_Marki7  rC   Nc                $   V P                   e   V P                   pM\        \        P                  R4      hRV9   d   VP	                  R4      p\        V4      ^8w  d   \        \        P                  V4      h\        P                  ! V^ ,          4      '       d$   \        P                  ! V^,          4      '       g   \        \        P                  V4      hR # \        P                  ! V4      '       g   \        \        P                  V4      hR # )Nzno value setr   )setr   r
   INVALID_MARKr   r   r   checkUINT32)r   xr   s   &  r   rR   Rich_Mark.__post_init__?  s    88A 3 3^DD!8WWS\F6{a#F$7$7;;((339;P;Pq	< < $F$7$7;;	< ((++#F$7$7;; ,r   c                    V P                   VP                   8  d   R # \        V P                  VP                  4      '       d   R # R# r  )rW  r$   r  r  s   &&r   r  Rich_Mark.__lt__S  s0    88eii

EKK00r   c                x    R V P                   : V P                  '       d   RV P                  ,          : 2# R: 2# )z	mark set=r  rF   )rW  r  r   s   &r   r[   Rich_Mark.__str__[  s1    "&(($***EDJJ,>,TUURT,TUUr   c                2   < V ^8  d   Qh/ S[ ;R&   S[;R&   # )r^   rW  r  r  )ra   r   s   "r   rb   Rich_Mark.__annotate__7  s     
 
H   r   r   r+  r   s   @r   rU  rU  7  s)     5 E<(VI  r   rU  c                      a  ] tR tRt o RtRtRtRtRt^ t	Rt
RtRtRtRtRtR tR t]R 4       tR	 tR
 tR tV 3R ltRtV tR# )	Rich_Rulei_  rC   i  NrF   c           
        V P                   f   \        P                  V RR4       V P                  f   \        P                  V R^ 4       Ve   \	        V P                   V P                  V P
                  V P                  V P                  V P                  V P                  V P                  .4      '       d   \        R4      hV P                  V4       V P                  4        R # R # )Nr'   rF   r*   zHMay not specify other arguments if constructing object using 'rule_str'.)r'   rL   rM   r*   rJ   r-   r1   r4   r7   r:   r=   r   _import_from_stringcheck)r   rule_strs   &&r   rR   Rich_Rule.__post_init__{  s    ;;tXr2== tZ3 KKMMKK$$LLHHJJKK	  ^  $$X.JJL)  r   c                    \         \        \        \        \        \
        \        \        .pV F%  pV! W4      '       d    R # V! W4      '       g   K$   R# 	  R# r  )r+   r(   r.   r2   r5   r8   r;   r>   )r   r  lt_functions_lts   &&  r   r  Rich_Rule.__lt__  sN    	
  C4U!!	   r   c                   . p\         P                  ! V 4       F  pRV9   d   VP                  R4      p\        V4      ^8w  g   V^ ,          '       d   V^,          '       g"   \	        \
        P                  RV,          4      hVP                  RV^ ,          RV^,          /4       K  VP                  RV/4       K  	  VP                  R\        /4       V# )zLexical analysis=zinternal error in _lexer(): %s	attr_name
attr_valuer4   )	r   	splitArgsr   r   r   r
   rK   appendEOL)rg  tokensrattrs   &   r   _lexerRich_Rule._lexer  s     $$X.Aaxwws|t9>aQ'++-MPQ-Q  {DG\47KLy!n- / 	y#&'r   c                   V'       g   \        \        P                  R 4      h\        P                  ! V4      pV P                  V4      pV'       d;   V^ ,          P                  R4      \        J d   \        \        P                  R 4      h/ p. p^ pW%,          P                  R4      \        J d
   VR.8X  Egl   W%,          P                  R4      pW%,          P                  R4      pW%,          P                  R4      pV'       d+   VRL9  d"   \        \        P                  RV,          4      hEMVRRRRRRRRRRRR R!R"R#R$R%R&R'R(R)\        R*39   EdZ   VR8X  d-   V P                  '       d   \        \        P                  R+4      hVR8X  d-   V P                  '       d   \        \        P                  R,4      hVRM9   d@   V P                  '       d.   \        \        P                  R-V: R.V P                  : R/24      hVRN9   d-   V P                  '       d   \        \        P                  R04      hVR"8X  d-   V P                  '       d   \        \        P                  R14      hVRO9   d@   V P                  '       d.   \        \        P                  R2V: R.V P                  : R/24      hM!\        \        P                  R3V,          4      h\        V4      ^ 8  d   V\        V4      ^,
          ,          MR4p	V	R48X  d   V'       gn   V'       df   VR8X  d   \        \        P                  R54      hVR8X  d   \        \        P                  R64      h\        \        P                  R7V: R8V: R924      hRV9  d$   \        \        P                  R7V: R:V: R;24      hVP                  R4       E
MgV	R8X  d   VR8X  dB   VRP9  d"   \        \        P                  R<V,          4      h\         P#                  V RV4       E
MVR8X  d$    \         P#                  V R\%        V4      4       E	MV'       d0   VR8X  d   R>p
MR?V: R8V: R92p
\        \        P                  V
4      hVP                  V4       E	MV	R8X  d   VRQ9   d   WV&   E	MVRR9   d   R@VR
&   E	M\         P#                  V R\+        VP                  R4      VP                  R4      VP                  R	4      VP                  R
RA4      4      4       VP-                  4        VP/                  4        V^,
          pEMV	R8X  d   VRS9   d   WV&   EMVRR9   d   R@VR
&   EM\         P#                  V R\1        VP                  R4      VP                  R	4      VP                  R
RA4      4      4       VP-                  4        VP/                  4        V^,
          pEMZV	R8X  dT   VR8X  d3   \         P#                  V R\3        V4      4       VP-                  4        EM\        \        P                  RB4      hV	R*8X  dh   VR8X  d   WV&   EM\         P#                  V R\5        VP                  R4      4      4       VP-                  4        VP/                  4        V^,
          pEMV	R8X  dT   VR8X  d3   \         P#                  V R\7        V4      4       VP-                  4        EMR\        \        P                  RC4      hV	R8X  dx   VRT9   d   WV&   EM$\         P#                  V R\9        VP                  R4      VP                  R4      4      4       VP-                  4        VP/                  4        V^,
          pEMV	R8X  dT   VR8X  d3   \         P#                  V R\;        V4      4       VP-                  4        EMz\        \        P                  RD4      hV	R8X  dT   VR8X  d3   \         P#                  V R\=        V4      4       VP-                  4        EM \        \        P                  RE4      hV	R8X  dK   \         P#                  V R\?        4       4       VP-                  4        VP/                  4        V^,
          pEMV	R8X  d   VRU9   d   WV&   EM\         P#                  V R\A        VP                  R4      VP                  R4      VP                  R4      VP                  R4      4      4       VP-                  4        VP/                  4        V^,
          pEMV	R8X  dx   VRT9   d   WV&   EM\         P#                  V R\C        VP                  R4      VP                  R4      4      4       VP-                  4        VP/                  4        V^,
          pEMV	R 8X  d   VRV9   d   WV&   EMVR'8X  d   VP                  R'4       EMk\         P#                  V R \E        VP                  R4      VP                  R4      VP                  R'4      4      4       VP-                  4        VP/                  4        V^,
          pEMV	R!8X  d   VRW9   d   WV&   EMVR'8X  d   VP                  R'4       EM\         P#                  V R \G        VP                  R4      VP                  R4      VP                  R4      VP                  R'4      4      4       VP-                  4        VP/                  4        V^,
          pEM9V	R"8X  du   VR'8X  d   VP                  R'4       EM\         P#                  V R"\I        VP                  R'4      4      4       VP-                  4        VP/                  4        V^,
          pEMV	R#8X  du   VR'8X  d   VP                  R'4       EM\         P#                  V RF\K        VP                  R'4      4      4       VP-                  4        VP/                  4        V^,
          pEMCV	R$8X  du   VR'8X  d   VP                  R'4       EM"\         P#                  V RF\M        VP                  R'4      4      4       VP-                  4        VP/                  4        V^,
          pEMV	R%8X  d   VR8X  d   WV&   EMVR'8X  d   VP                  R'4       EM\         P#                  V RF\O        VP                  R4      VP                  R'4      4      4       VP-                  4        VP/                  4        V^,
          pEM0V	R&8X  d   VR8X  d   WV&   EMVR'8X  d   VP                  R'4       EM\         P#                  V RF\Q        VP                  R4      VP                  R'4      4      4       VP-                  4        VP/                  4        V^,
          pMV	R'8X  d   VRX9   d	   WRGV 2&   MRHV9  d   \        \        P                  RI4      h\S        VRH,          VP                  RJ4      4      VR'&   VP-                  RHR44       VP-                  RJR44       VP-                  4        V^,
          pV^,           pEK  RK#   \&         d#    \        \        P(                  R=T,          4      hi ; i)Yz
empty ruler4   rulero  rp  r*   r'   addressrG   rH   rX   r   r   r   to-portto-addrrt   r  r   r   
queue-sizer    rW  zbad attribute '%s'r-   r1   service
icmp-block	icmp-typer   forward-portsource-portr7   r'  r:   acceptdroprH  markr  notNOTr   zmore than one 'source' elementz#more than one 'destination' elementz-more than one element. There cannot be both 'z' and 'z' in one rule.zmore than one logging elementzmore than one 'audit' elementz6more than one 'action' element. There cannot be both 'zunknown element %srF   z0'family' outside of rule. Use 'rule family=...'.z4'priority' outside of rule. Use 'rule priority=...'.'z.' outside of any element. Use 'rule <element> z= ...'.z!' outside of rule. Use 'rule ... z ...'.zH'family' attribute cannot have '%s' value. Use 'ipv4' or 'ipv6' instead.z(invalid 'priority' attribute value '%s'.zdwrong 'protocol' usage. Use either 'rule protocol value=...' or  'rule [forward-]port protocol=...'.zattribute 'TFzinvalid 'protocol' elementzinvalid 'service' elementzinvalid 'icmp-block' elementzinvalid 'icmp-type' elementr=   zlimit.zlimit.valuezinvalid 'limit' elementzlimit.burstN)r*   r'   r{  rG   rH   rX   r   r   r   r|  r}  rt   r  r   r   r~  r    rW  r   )r   r  r   r  r  r   r  r  )r7   r'  )r  r  rH  r  ipv4ipv6)r{  rG   rH   rX   )r  r  )r{  rH   rX   r   )r   r   r|  r}  )r   r   )r  r   r~  r   )*r   r
   rK   r   stripNonPrintableCharactersrw  getrs  r-   r1   r4   r7   r:   r=   r   rr  rL   rM   r   
ValueErrorINVALID_PRIORITYrB   popclearrh   r   r   rq   r|   r   r   r   r   r   r   r  r-  r<  rM  rD  rU  r   )r   rg  rt  attrsin_elementsindexcurrent_elementro  rp  
in_elementerr_msgs   &&         r   re  Rich_Rule._import_from_string  s[    3 3\BB88BX&fQimmI.#5 3 3\BB=$$Y/36;6(;R$m//	:O))+6I**<8J  % * (++-AI-M +2 #!  "!#/' 2 '(2t{{{+"//1Q  )M9d>N>N>N+"//1V  (	
 !LLL+"//.> 
 ),<<+"//1P  )G3


+"//1P  (+OO KKK+"//.=  (++-AO-S 
 695E5IC,q01r  R&9 H,+"//N  #j0+"//R 
 ,"//()5 
 ?2'++*O=   &&v.v%(!)99+"//f() 
 &&tXzB*,**4S_M  J. #I /
  ))5   ((;(;WEE&&7x' EE'1)$$6&*E(O&& #!IIi0!IIe,!IIg.!IIh6		  OO%KKM!AIE}, >>'1)$$6&*E(O&&%(!IIi0!IIg.!IIh6  OO%KKM!AIEz)'&&tYj8QROO%'++-I  .''1)$&&i);EIIg<N)O  OO%KKM!AIEy(&&&tYZ8PQOO%'++-H  v% 44'1)$&&!!%))F"3UYYz5JK
  OO%KKM!AIE|+&&&tYz8RSOO%'++-K  {*&&&tYj8QROO%'++-J  |+""4O4EF!	~- JJ'1)$&&!(!IIf-!IIj1!IIi0!IIi0		  OO%KKM!AIE}, 44'1)$&&!'		&(9599Z;PQ
  OO%KKM!AIEu$ 33'1)$$/&&w/&& !IIh/71CUYYwEW  OO%KKM!AIEw& AA'1)$$/&&w/&&"!IIg.!IIh/!IIl3!IIg.		  OO%KKM!AIEw&"g-&&w/&&tWj7AS6TUOO%KKM!AIEx'"g-&&w/&&tX{599WCU7VWOO%KKM!AIEv%"g-&&w/&&tXy7AS7TUOO%KKM!AIEx'&'1)$$/&&w/&& #EIIf$5uyy7IJ
  OO%KKM!AIEv%%'1)$$/&&w/&&h	%))E2BEIIgDV(W  OO%KKM!AIEw& 222<F9+./$E1+"//1J  &0m,eii.F&E'N IImR0IImR0OO%!AIEAIEM <Sh & +"33FS s   	 x' '-yc                   V P                   '       d7   V P                   R9  d%   \        \        P                  V P                   4      hMV P                  e   V P                  P
                  '       g   V P                  e   \        \        P                  4      h\        V P                  \        4      '       d   \        \        P                  4      hV P                  V P                  8  g   V P                  V P                  8  d8   \        \        P                  RV P                  V P                  3,          4      hV P                  f   V P                  e    V P                  e   V P                  ^ 8X  dp   V P                   f   \        \        P"                  R4      hV P                  f:   V P                  f,   V P                  ^ 8X  d   \        \        P"                  R4      h\%        V P                  4      \&        \        \(        \*        39  dE   V P                  f7   V P,                  f)   V P                   f   \        \        P"                  R4      hV P                  '       d   V P                  P
                  '       d   V P                   '       g   \        \        P                  4      h\.        P0                  ! V P                   V P                  P
                  4      '       g8   \        \        P2                  \5        V P                  P
                  4      4      hV P                  '       d   V P                  P
                  '       ds   \.        P0                  ! V P                   V P                  P
                  4      '       g8   \        \        P2                  \5        V P                  P
                  4      4      h\        V P                  \(        4      '       do   V P                   e   \        \        P"                  R4      hV P                  e7   V P                  P6                  '       d   \        \        P"                  R4      hEM\        V P                  \&        4      '       d/   V P                   '       d   \        \        P"                  R4      hEMQ\        V P                  \        4      '       d   V P                  P8                  R	8w  dj   \.        P:                  ! V P                   V P                  P8                  4      '       g/   \        \        P2                  V P                  P8                  4      hV P                   '       g   \        \        P                  4      hV P                   e   \        \        P"                  R
4      hMY\        V P                  \*        4      '       d:   V P                   e,   \        \        P"                  RV P                   ,          4      hV P,                  eW   \%        V P                   4      \<        \>        \@        39  d.   \        \        PB                  \%        V P                   4      4      h\        V P                   \>        4      '       d   V P                   P$                  '       d   V P                   R9  d   \        \        P"                  R4      hV P                   P$                  \D        V P                   ,          9  d^   RPG                  \D        V P                   ,          4      p\        \        P"                  RV P                   P$                  : RV: R24      hR# R# R# )r  Nz/'priority' attribute must be between %d and %d.zno element, no actionz%no element, no source, no destinationzno action, no log, no auditzmasquerade and actionzmasquerade and mac sourcezicmp-block and actionrF   zforward-port and actionz+tcp-mss-clamp and %s are mutually exclusivez9When using reject type you must specify also rule family.z, zWrong reject type z.
Use one of: .r  )$r'   r   r
   INVALID_FAMILYr-   rE   r1   MISSING_FAMILY
isinstancer4   r   r*   priority_minpriority_maxr  r7   r=   rK   r    r   r   r   r:   r   check_addressINVALID_ADDRrP   rG   r   check_single_addressr<  rD  rM  INVALID_AUDIT_TYPEr	   join)r   valid_typess   & r   rf  Rich_Rule.checkS  s   ;;;{{"22#F$9$94;;GG 3 'DKK,<,<,<!!-#F$9$9::$,,(899#F$9$9::==4,,,@Q@Q0Q''A$$d&7&789  <<HH!5$--1:L{{"#F$7$79PQQ{{"t'7'7'?DMMUVDV#'')P  	&
 
 xxDJJ$64;;;N#F$7$79VWW;;;4;;+++;;;#F$9$9::**4;;8H8HII#F$7$7T[[=M=M9NOO 0 0 5 5 5**4;;8H8H8M8MNN#F$7$7T=M=M=R=R9STTdllO44{{&#F$7$79PQQ{{&4;;???#F$7$79TUUn55{{{#F$7$79PQQ &677||&&",Y5S5ST\\446 6 $F$7$79P9PQQ;;;#F$9$9::{{&#F$7$79RSS '&899{{&#''ADKKO 
 ::!DKK k9(MM#F$=$=tDKK?PQQdkk;//{{;;&66'++S  ;;##<+DD"&))L,E"FK'++;;++[:  E   0r   c                   R pV P                   '       d   VRV P                   ,          ,          pV P                  '       d   VRV P                  ,          ,          pV P                  '       d   VRV P                  ,          ,          pV P                  '       d   VRV P                  ,          ,          pV P                  '       d   VRV P                  ,          ,          pV P
                  '       d   VRV P
                  ,          ,          pV P                  '       d   VRV P                  ,          ,          pV P                  '       d   VRV P                  ,          ,          pV# )rz  z priority="%d"z family="%s"r  )r*   r'   r-   r1   r4   r7   r:   r=   rY   s   & r   r[   Rich_Rule.__str__  s    ===#dmm33C;;;>DKK//C;;;54;;&&C54++++C<<<54<<''C8885488##C:::54::%%C;;;54;;&&C
r   c          
         < V ^8  d   Qh/ S[ S[,          ;R&   S[ S[,          ;R&   S[S[,          ;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[S[S[S[	S[
S[S[S[S[.	;R&   S[;R	&   S[;R
&   S[S[S[S[.;R&   # )r^   r  r  rg  r'   r*   r-   r1   r4   r7   r:   r=   )r   r   r   rP   rB   rh   r   r   rq   r|   r   r   r   r   r   r   r-  r<  rD  rM  rU  )ra   r   s   "r   rb   Rich_Rule.__annotate___  s     
 3-(  3-'  cl!        "(  	
 
 0 
1 2 3 4 +y)<C5 r   r   i )r   r   r   r   re   r  r  rg  r'   r*   r-   r1   r4   r7   r:   r=   rR   r  staticmethodrw  re  rf  r[   rf   r   r   r   s   @r   rc  rc  _  s     5 #)L"'L!HFHF$(K 	  CE?CF8(  $SjYv_  r   rc  Ni  iQ )0typingr   dataclassesr   r   r   firewallr   firewall.core.ipsetr   firewall.core.baser	   r
   firewall.errorsr   r   r   rs  r$   r(   r+   r.   r2   r5   r8   r;   r>   rB   rh   rq   r|   r   r   r   r   r   r   r   r   r   r   r  r-  r<  rD  rM  rU  rc  r   r   r   <module>r     s    1 1  0 +  3
( ( j
:&*1;3+/1 $d#)3 )3 $)3X $d#3 3 $3@ $d#1 1 $1 $d#K K $K" $d#R R $R" $d#4 4 $4 $   $d#4 4 $4 $d#3 3 $3 $d## # $#* $d#
 
 $
D 	  $d#? ? $?D $.
 .
 .
b $6
 6
 6
r $F F F  $G G G  $
 
 
, $E E E  $$V $V $VN $a	 a	 a	r   