+
    i-  c                   s    ^ 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# )i    N)config)	IO_ObjectIO_Object_ContentHandlerIO_Object_XMLGenerator
check_portcheck_tcpudpcheck_protocolcheck_address)log)errors)FirewallErrorc                   s   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                s   < \         \        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)Z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$   ZService.__init__:   sY    gt%'

    c                s    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   Zclearr   r   r   )r%   s   &r'   cleanupZService.cleanupG   sq    
JJqMNN1LLO a MM!LLOr(   c                s   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   Zservicesz.Service '{}': Included service '{}' not found.Nr   r    )r   r   r   r
   r	   ZINVALID_DESTINATIONr   
startswithreplacelenZINVALID_MODULEINVALID_SERVICEZformatr   )
r%   r    itemZ
all_configZall_io_objectsr   Zprotor   r   r"   s
   &&&&&     r'   _check_configZ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__ZIMPORT_EXPORT_STRUCTUREZADDITIONAL_ALNUM_CHARSZPARSER_REQUIRED_ELEMENT_ATTRSZPARSER_OPTIONAL_ELEMENT_ATTRSr$   r)   r1   __static_attributes____classdictcell__Z__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                   s&   a  ] tR t^t o R tRtV tR# )service_ContentHandlerc                s(
   \         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   r*   r   r   z"Module '%s' already set, ignoring.r"   z#Include '%s' already set, ignoring.r#   z"Helper '%s' already set, ignoring.Nr+   )r   startElementr0   Zparser_check_element_attrsr   Zwarningr   r   r   r   Zappendr   r   r   r   r   r,   r-   r   r   r   )r%   r   attrsZentryZxr   s   &&&   r'   r:   Z#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)r2   r3   r4   r5   r:   r6   r7   )r8   s   @r'   r9   r9      s     PQ PQr(   r9   c           	      sT   \        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/Zrbznot a valid service file: %si)r   Zendswithr
   r	   ZINVALID_NAMEr   Z
check_namefilenamepathr,   r    ETC_FIREWALLDZbuiltinZdefaultr9   saxZmake_parserZsetContentHandleropenZInputSourceZsetByteStreamZparseZSAXParseExceptionr/   ZgetException)	r?   r@   r   handlerZparserr   fZsourcemsgs	   &&       r'   service_readerrG      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           	      sB   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  ZwtzUTF-8)ZmodeZencodingr   r   r   Z
z  r   r   r   r   r   r!   r   r   r   r"   r#   )%r@   r?   r   osZexistsshutilZcopy2Z	Exceptionr   ZerrorZdirnamer,   r    rA   ZmkdiriorC   r   ZstartDocumentr   r:   ZignorableWhitespacer   Z
charactersZ
endElementr   r   ZsimpleElementr   r   r   r.   r   r   r   ZendDocumentZclose)r   r@   Z_pathr   rF   ZdirpathrE   rD   r;   r   r   r   r"   r#   s   &&            r'   service_writerrK      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)Zxml.saxrB   rH   rJ   rI   Zfirewallr    Zfirewall.core.io.io_objectr   r   r   r   r   r   r   Zfirewall.core.loggerr   r	   Zfirewall.errorsr
   r   r9   rG   rK   r<   r(   r'   <module>rL      s\     	 	     %  )di dTQQ5 QQh>^r(   