+
        -                         ^ RI Ht ^ RIt^ RIt^ RIt^ RIHt ^ RIHtH	t	H
t
HtHtHtHt ^ RIHt ^ RIHt ^ RIHt  ! R R]4      t ! R	 R
]	4      tR tRR ltR# )    N)config)	IO_ObjectIO_Object_ContentHandlerIO_Object_XMLGenerator
check_portcheck_tcpudpcheck_protocolcheck_address)log)errors)FirewallErrorc                      a a ] tR t^t oRRRRRRRR.RR.RRR/RR.R	R.R
R.RR./
tRR.tRRRRRR/tRRR.RRR.RR.RR.RRR.RRR.RR.RR./tV 3R ltR t	R t
RtVtV ;t# )Serviceversion shortdescriptionportsmodulesdestination	protocolssource_portsincludeshelpers_-Nservicenameportprotocolvaluemoduleipv4ipv6source-portincludehelperc                   < \         \        V `  4        R V n        R V n        R V n        . V n        . V n        . V n        / V n	        . V n
        . V n        . V n        R# )r   N)superr   __init__r   r   r   r   r   r   r   r   r   r   )self	__class__s   &=/usr/lib/python3.14/site-packages/firewall/core/io/service.pyr*   Service.__init__:   sY    gt%'

    c                    R V n         R V n        R V n        V P                  R V P                  R V P
                  R V P                  P                  4        V P                  R V P                  R V P                  R R# )r   :NNNN)r   r   r   r   r   r   r   clearr   r   r   )r+   s   &r-   cleanupService.cleanupG   sq    
JJqMNN1LLO a MM!LLOr/   c                   VR 8X  dR   V FI  pV^ ,          R8w  d'   \        V^ ,          4       \        V^,          4       K7  \        V^,          4       KK  	  R# VR8X  d   V F  p\        V4       K  	  R# VR8X  d0   V F'  p\        V^ ,          4       \        V^,          4       K)  	  R# VR8X  dF   V F=  pVR9  d"   \        \        P
                  RV,          4      h\        WqV,          4       K?  	  R# VR8X  dx   V Fo  pVP                  R4      '       d,   VP                  RR4      pRV9   d   VP                  RR	4      p\        V4      ^8  g   KW  \        \        P                  V4      h	  R# VR
8X  dM   V FD  p	WR,          9  g   K  \        \        P                  RP                  V P                  V	4      4      h	  R# R# )r   r   r   r   r   z'%s' not in {'ipv4'|'ipv6'}r   nf_conntrack_r   r   r   servicesz.Service '{}': Included service '{}' not found.Nr#   r$   )r   r   r	   r   r   INVALID_DESTINATIONr
   
startswithreplacelenINVALID_MODULEINVALID_SERVICEformatr   )
r+   r   item
all_configall_io_objectsr   protor   r"   r&   s
   &&&&&     r-   _check_configService._check_configS   s   7?7b=tAw' a) #47+  [ u%   ^#47#T!W%  ]"%&66'225C  k++>?  & Y $$_55#^^OR@Ff}!'S!9v;?'(=(=vFF ! Z!"<<'..HOO IIw  "  r/   )
r   r   r   r   r   r   r   r   r   r   )r   r   )__name__
__module____qualname____firstlineno__IMPORT_EXPORT_STRUCTUREADDITIONAL_ALNUM_CHARSPARSER_REQUIRED_ELEMENT_ATTRSPARSER_OPTIONAL_ELEMENT_ATTRSr*   r2   rC   __static_attributes____classdictcell____classcell__)r,   __classdict__s   @@r-   r   r      s     2r(B4BxbT
RDB4 "3Zt4%! 	FI&$WI6('
+I;6(	%!
- -r/   r   c                   &   a  ] tR t^t o R tRtV tR# )service_ContentHandlerc                (
   \         P                  ! WV4       V P                  P                  W4       VR 8X  dI   RV9   d   \        P
                  ! RVR,          4       RV9   d   VR,          V P                  n        R# R# VR8X  d   R# VR8X  d   R# VR8X  Ed0   VR,          R8w  d   \        VR,          4       \        VR,          4       VR,          VR,          3pW0P                  P                  9  d(   V P                  P                  P                  V4       R# \        P
                  ! R	VR,          VR,          4       R# \        VR,          4       VR,          V P                  P                  9  d/   V P                  P                  P                  VR,          4       R# \        P
                  ! R
VR,          4       R# VR8X  d   \        VR,          4       VR,          V P                  P                  9  d/   V P                  P                  P                  VR,          4       R# \        P
                  ! R
VR,          4       R# VR8X  d   \        VR,          4       \        VR,          4       VR,          VR,          3pW0P                  P                  9  d(   V P                  P                  P                  V4       R# \        P
                  ! RVR,          VR,          4       R# VR8X  dx   R Fo  pWB9   g   K  \        WBV,          4       W@P                  P                  9   d   \        P
                  ! RV4       KP  W$,          V P                  P                  V&   Kq  	  R# VR8X  d   VR,          pVP!                  R4      '       d,   VP#                  RR4      pRV9   d   VP#                  RR4      pWPP                  P$                  9  d(   V P                  P$                  P                  V4       R# \        P
                  ! RV4       R# VR8X  dq   VR ,          V P                  P&                  9  d/   V P                  P&                  P                  VR ,          4       R# \        P
                  ! RVR ,          4       R# VR8X  dq   VR,          V P                  P(                  9  d/   V P                  P(                  P                  VR,          4       R# \        P
                  ! RVR,          4       R# R# )r   r   z'Ignoring deprecated attribute name='%s'r   r   r   r   r   r    z#Port '%s/%s' already set, ignoring.z$Protocol '%s' already set, ignoring.r!   r%   z)SourcePort '%s/%s' already set, ignoring.r   z2Destination address for '%s' already set, ignoringr"   r5   r   r   z"Module '%s' already set, ignoring.r&   z#Include '%s' already set, ignoring.r'   z"Helper '%s' already set, ignoring.Nr7   )r   startElementr?   parser_check_element_attrsr   warningr   r   r   r   appendr	   r   r   r
   r   r9   r:   r   r   r   )r+   r   attrsentryxr"   s   &&&   r-   rT   #service_ContentHandler.startElement   s    --d%@		,,T99EuV}UE!$))$4		! "W_]"V^V}"5=)U:./vj(9:		/IIOO**51KK=fj) uZ01$DII,?,??II''..uZ/@AKK>j@Q Z5>*W~TYY%8%88		##**5>:BE'NS]"uV}%z*+6]E*$56EII222		&&--e4?&M*%
 ]"%:!!1X.II111PRS 498		--a0 & X6]F  11<&=#^^C5FYY...		!!((0@&IYYtyy'9'99		""))%	*:;A5CSTXV}DII$5$55		!!((v7@%-P	 r/    N)rE   rF   rG   rH   rT   rM   rN   )rP   s   @r-   rR   rR      s     PQ PQr/   rR   c           	      T   \        4       pV P                  R 4      '       g"   \        \        P                  RV ,          4      hV RR Vn        VP                  VP
                  4       Wn        Wn        VP                  \        P                  4      '       d   RMRVn        VP                  Vn        \        V4      p\        P                   ! 4       pVP#                  V4       V: RV : 2p\%        VR4      ;_uu_ 4       p\        P&                  ! R4      pVP)                  V4        VP+                  V4        RRR4       ??T#   \        P,                   d5   p\        \        P.                  RTP1                  4       ,          4      hRp?ii ; i  + '       g   i     ??T# ; i)	.xmlz'%s' is missing .xml suffixNFT/rbznot a valid service file: %s)r   endswithr   r   INVALID_NAMEr   
check_namefilenamepathr9   r   ETC_FIREWALLDbuiltindefaultrR   saxmake_parsersetContentHandleropenInputSourcesetByteStreamparseSAXParseExceptionr=   getException)	re   rf   r   handlerparserr   fsourcemsgs	   &&       r-   service_readerrx      s]   iGV$$!>!I
 	
 CR=GLw||$L#v/C/CDDe$GOooGO$W-G__F
W%H%D	dD		Q&Q	LL 	 
 	N $$ 	&&.1A1A1CC 	 
	 	Ns*   (F*EF/FFFF'	c           	      B   V'       d   TMV P                   pV P                  '       d   V: R V P                  : 2pMV: R V P                  : R2p\        P                   P	                  V4      '       d     \
        P                  ! VRV,          4       \        P                   P                  V4      pVP                  \        P                  4      '       d   \        P                   P	                  V4      '       gp   \        P                   P	                  \        P                  4      '       g&   \        P                  ! \        P                  R4       \        P                  ! VR4       \        P                   ! VRRR7      p\#        V4      pVP%                  4        / pV P&                  '       d!   V P&                  R	8w  d   V P&                  VR
&   VP)                  RV4       VP+                  R4       V P,                  '       dr   V P,                  R	8w  da   VP+                  R4       VP)                  R/ 4       VP/                  V P,                  4       VP1                  R4       VP+                  R4       V P2                  '       dr   V P2                  R	8w  da   VP+                  R4       VP)                  R/ 4       VP/                  V P2                  4       VP1                  R4       VP+                  R4       V P4                   FI  p	VP+                  R4       VP7                  RRV	^ ,          RV	^,          /4       VP+                  R4       KK  	  V P8                   F9  p
VP+                  R4       VP7                  RRV
/4       VP+                  R4       K;  	  V P:                   FI  p	VP+                  R4       VP7                  RRV	^ ,          RV	^,          /4       VP+                  R4       KK  	  V P<                   F9  pVP+                  R4       VP7                  RRV/4       VP+                  R4       K;  	  \?        V P@                  4      ^ 8  d?   VP+                  R4       VP7                  RV P@                  4       VP+                  R4       V PB                   F9  pVP+                  R4       VP7                  RRV/4       VP+                  R4       K;  	  V PD                   F9  pVP+                  R4       VP7                  RRV/4       VP+                  R4       K;  	  VP1                  R4       VP+                  R4       VPG                  4        VPI                  4        ?R#   \         d#   p\        P                  ! RY44        Rp?ELRp?ii ; i)r_   r^   z%s.oldzBackup of file '%s' failed: %sNi  wtzUTF-8)modeencodingr   r   r   
z  r   r   r   r    r!   r%   r"   r   r   r&   r'   )%rf   re   r   osexistsshutilcopy2	Exceptionr   errordirnamer9   r   rg   mkdiriorm   r   startDocumentr   rT   ignorableWhitespacer   
characters
endElementr   r   simpleElementr   r   r   r;   r   r   r   endDocumentclose)r   rf   _pathr   rw   dirpathru   rs   rX   r   r    r"   r&   r'   s   &&            r-   service_writerr      s_   DgllE!1!12#W\\2	ww~~d	CLLx$/ ggood#G&..//w8O8Oww~~f2233HHV))51
% 
4'2A$Q'G E7??b0"??iE*% }}}",##D)Wb)7==)7###D) w22b8##D)]B/7../=)##D) ##D)fvtAw
DG&LM##D)  %%##D)j7H*=>##D) & $$##D)mfd1gz4PQ7-ST##D) % //##D)h(89##D) " 7!###D)mW-@-@A##D) ####D)i)W)=>##D) $ //##D)h(89##D) " y!%GGIg  	CII6BB	Cs   7U1 1V<VV)N)xml.saxrj   r~   r   r   firewallr   firewall.core.io.io_objectr   r   r   r   r   r	   r
   firewall.core.loggerr   r   firewall.errorsr   r   rR   rx   r   r\   r/   r-   <module>r      s\     	 	     %  )di dTQQ5 QQh>^r/   