lfU ddlZddlZddlmZddlmZmZmZdZdZ dZ dZ Gdd e Z Gd d e ZGd d eZeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZeeZdZeeZGdd eZGd!d"eZeed#dZGd$d%e ZGd&d'eZ Gd(d)e Z!Gd*d+e Z"Gd,d-eZ#d4d.Z$d4d/Z%eZ&ej'Z(d0Z)d1Z*d2Z+d3Z,dS)5N) allocate_lock) CDefErrorVerificationErrorVerificationMissingc|tzrd|z}|tzrd|z}|tzrd|z}|S)Nz const z volatile z __restrict )Q_CONSTlstrip Q_VOLATILE Q_RESTRICT)quals replace_withs l/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/cffi/model.pyqualifyr sr w9 <#6#6#8#88  z<#l&9&9&;&;;  z>& (;(;(=(== cDeZdZdZdZd dZdZdZdZdd Z d Z d Z d S)BaseTypeByIdentityFa C filercv|j}|ddksJ|}|r.|dr d|vrd|z}n|ddvrd|z}t ||}|d|}d |vr(t d |d |d |S) N&r*z&[z(%s)rz[( $zcannot generate 'z' in z: unknown type name)c_name_with_markercountstrip startswithrreplacer _get_c_name)selfrcontextrresults r get_c_namezBaseTypeByIdentity.get_c_names(||C  A%%%%#))++  2&&s++ 2% 4 !!_,,"\1 ul33 \22 &==####%%%%www011 1 rc8|jddS)Nrr)rr!r#s rr"zBaseTypeByIdentity._get_c_name/s&..sB777rc.d|vS)Nrr"r(s r has_c_namezBaseTypeByIdentity.has_c_name2s$**,,,,rcdSNFr(s ris_integer_typez"BaseTypeByIdentity.is_integer_type5urc |j|}nG#t$r:|||}|j||}||usJYnwxYw|SN)_cached_btypesKeyErrorbuild_backend_type setdefault)r#ffi finishlist can_delayBTypeBType2s rget_cached_btypez#BaseTypeByIdentity.get_cached_btype8sv #&t,EE # # #++C<r*r(s r__repr__zBaseTypeByIdentity.__repr__As))++++--rc*fdjDS)Nc4g|]}|t|fSr.)getattr).0namer#s r z1BaseTypeByIdentity._get_items..Es(EEEwtT**+EEEr)_attrs_r(s`r _get_itemszBaseTypeByIdentity._get_itemsDsEEEE EEEErN)rrrF) __name__ __module__ __qualname__ is_array_typeis_raw_functionr&r"r+r/r<r@rHr.rrrrsMO$888---...FFFFFrrc eZdZdZdZdZdS)BaseTypecv|j|jko)||kSr2) __class__rHr#others r__eq__zBaseType.__eq__Js6%/18!!U%5%5%7%77 9rc||k Sr2r.rSs r__ne__zBaseType.__ne__Ns5=  rclt|jt|fSr2)hashrRtuplerHr(s r__hash__zBaseType.__hash__Qs)T^U4??+<+<%=%=>???rN)rJrKrLrUrWr[r.rrrPrPHsF999!!!@@@@@rrPceZdZdZdZdZdS)VoidTyper.cd|_dS)Nzvoid&)rr(s r__init__zVoidType.__init__Xs")rc$t||dS)N new_void_type global_cacher#r7r8s rr5zVoidType.build_backend_type[sD#777rNrJrKrLrGr_r5r.rrr]r]Us7G***88888rr]ceZdZdZdS)BasePrimitiveTypecdSr-r.r(s ris_complex_typez!BasePrimitiveType.is_complex_typebr0rN)rJrKrLrir.rrrgrgas#rrgcteZdZdZiddddddddddd dd dd dd dd dddddddddddddddiddddddddddddddddddd dd!dd"dd#dd$dd%dd&dd'did(dd)dd*dd+dd,dd-dd.dd/dd0dd1dd2dd3dd4dd5dd6dd7dd8dZd9Zd:Zd;Zd<Zd=Z d>Z d?S)@ PrimitiveTyperEcharcshortiintlongz long longz signed charz unsigned charzunsigned short unsigned int unsigned longzunsigned long longfloatfdoublez long doublezfloat _Complexjzdouble _Complex_Boolwchar_tchar16_tchar32_tint8_tuint8_tint16_tuint16_tint32_tuint32_tint64_tuint64_t int_least8_t uint_least8_t int_least16_tuint_least16_t int_least32_tuint_least32_t int_least64_tuint_least64_t int_fast8_t uint_fast8_t int_fast16_t uint_fast16_t int_fast32_t uint_fast32_t int_fast64_t uint_fast64_tintptr_t uintptr_tintmax_t uintmax_t ptrdiff_tsize_tssize_tc>||jvsJ||_|dz|_dSNr)ALL_PRIMITIVE_TYPESrErr#rEs rr_zPrimitiveType.__init__s/t///// "&*rc.|j|jdkS)NrnrrEr(s r is_char_typezPrimitiveType.is_char_type' 2c99rc.|j|jdkS)Nrprr(s rr/zPrimitiveType.is_integer_typerrc.|j|jdkS)Nrvrr(s r is_float_typezPrimitiveType.is_float_typerrc.|j|jdkS)Nrxrr(s rrizPrimitiveType.is_complex_typerrc0t||d|jS)Nnew_primitive_type)rcrErds rr5z PrimitiveType.build_backend_typesD#';TYGGGrN) rJrKrLrGrr_rr/rrir5r.rrrkrkfsG5 c5 c5  c5  c 5 c 5 c 5  c5  c5  c5  c5  c5  c5  c5  c5  c5 c!5 " c#5 5 & c'5 ( c)5 * c+5 , c-5 . c/5 0 c15 2 c35 4 c55 6 c75 8 c95 : c;5 < c=5 > c?5 @ cA5 B cC5 D cE5 F cG5 5 5 H cI5 J cK5 L cM5 N cO5 P cQ5 R cS5 T cU5 V cW5 X cY5 Z c[5 \ c]5 ^ c_5 ` ca5 b cc5 d ce5 f cg5 h ci5 5 n--- ::::::::::::HHHHHrrkc$eZdZdZdZdZdZdS)UnknownIntegerTyperlc(||_|dz|_dSrrErrs rr_zUnknownIntegerType.__init__ "&*rcdS)NTr.r(s rr/z"UnknownIntegerType.is_integer_typestrc0td|jz)Nz4integer type '%s' can only be used after compilationNotImplementedErrorrErds rr5z%UnknownIntegerType.build_backend_type#!#026)#<== =rN)rJrKrLrGr_r/r5r.rrrrsFG---=====rrceZdZdZdZdZdS)UnknownFloatTyperlc(||_|dz|_dSrrrs rr_zUnknownFloatType.__init__rrc0td|jz)Nz2float type '%s' can only be used after compilationrrds rr5z#UnknownFloatType.build_backend_typerrNrer.rrrrs7G---=====rrceZdZdZddZdS)BaseFunctionType)argsr%ellipsisabiNcb||_||_||_||_d|jD}|jr|d|pdg}|jd|fz}||dd|zdz|ddz}|jjd||_dS)Nc6g|]}|Sr.r*)rDargs rrFz-BaseFunctionType.__init__..s";;;#COO%%;;;r...voidz, rrr) rr%rrappend _base_patternjoinrr!)r#rr%rrreprargsrs rr_zBaseFunctionType.__init__s    ;;;;; = # OOE " " "'x)TYYx-@-@,BB ?'+c1C7,qrr:JJL K * 2 23 E E rr2rJrKrLrGr_r.rrrrs33GGGGGGGrrc"eZdZdZdZdZdZdS)RawFunctionTypez(&)(%s)Tc(td|d)Ncannot render the type z7: it is a function type, not a pointer-to-function type)rrds rr5z"RawFunctionType.build_backend_types&iBF$$IJJ JrcNt|j|j|j|jSr2)FunctionPtrTyperr%rrr(s ras_function_pointerz#RawFunctionType.as_function_pointerty$+t}dhOOOrN)rJrKrLrrNr5rr.rrrrsFMOJJJPPPPPrrceZdZdZdZdZdS)rz(*&)(%s)cP|j||}g}|jD]+}||||,d}|jdkr&|js |jjf}n#t$rYnwxYwt||dt|||jg|RS)Nr. __stdcallnew_function_type) r%r<rrrr_backend FFI_STDCALLAttributeErrorrcrZ)r#r7r8r%rtpabi_argss rr5z"FunctionPtrType.build_backend_types--c:>>) > >B KK++C<< = = = = 8{ " "=  # 8:HH%DD#':!$KKKAIKKK Ks& A44 BBcNt|j|j|j|jSr2)rrr%rrr(s ras_raw_functionzFunctionPtrType.as_raw_functionrrN)rJrKrLrr5rr.rrrrs?M K K KPPPPPrrc eZdZdZddZdZdS) PointerType)totyperrc||_||_t|d}|jrd|d}|jd||_dS)Nz *&()r)rrrrMr rr!)r#rrextras rr_zPointerType.__init__sd  u%%   / /#llnnnn.E"(";"C"CC"O"Orc`|j||d}t||d|S)NT)r9new_pointer_type)rr<rc)r#r7r8BItems rr5zPointerType.build_backend_types3 ,,S*,MMD#'95AAArNrrer.rrrrsE!GPPPPBBBBBrrc,t|tSr2)rr )rs rConstPointerTypers vw ' ''rceZdZdZddZdS)NamedPointerType)rrErc`t|||||_|dz|_dSr)rr_rEr)r#rrErs rr_zNamedPointerType.__init__s3T65111 "&*rNrrr.rrrrs- G------rrc.eZdZdZdZdZdZdZdZdS) ArrayType)itemlengthTc||_||_|d}n|dkrd}nd|z}|jjd||_dS)Nz&[]rz &[/*...*/]z&[%s]r)rrrr!)r#rrbracketss rr_zArrayType.__init__)s\  >HH u__#HH'H I ( 0 0h ? ? rc6t|jtSr2) isinstancerstrr(s rlength_is_unknownzArrayType.length_is_unknown6s$+s+++rc,t|j|Sr2)rr)r# newlengths rresolve_lengthzArrayType.resolve_length9sI...rc|rtd|d|j||t |j||}t ||d||jS)Nrz: unknown lengthnew_array_type)rrrr<rrcr)r#r7r8BPtrItems rr5zArrayType.build_backend_type<s  ! ! # # %)!TT$%% % ""3 333ty))::3 KKD#'74;OOOrN) rJrKrLrGrMr_rrr5r.rrrr%sb GM A A A,,,///PPPPPrrrmc(eZdZdZdZdZdZdZdS)StructOrUnionOrEnumrlNcJ|jp|jd|j}|dz|_dS)Nrr) forcenamekindrErrs rbuild_c_name_with_markerz,StructOrUnionOrEnum.build_c_name_with_markerKs/~ADIIItyy!A"&*rc<||_|dSr2)rr)r#rs rforce_the_namez"StructOrUnionOrEnum.force_the_nameOs!" %%'''''rcX|jdsJ|jddS)Nr)rendswithr(s rget_official_namez%StructOrUnionOrEnum.get_official_nameSs1&//44444&ss++r)rJrKrLrGrrrrr.rrrrGsKGI---(((,,,,,rrcZeZdZdZdZdZdZddZdZddZ dZ dd Z d Z d Z d Zd ZdS) StructOrUnionNrFct||_||_||_||_||_|dSr2)rEfldnamesfldtypes fldbitsizefldqualsr)r#rEr r r r s rr_zStructOrUnion.__init__^s=     $   %%'''''rc#K|j?t|j|jD]&\}}|dkrt|tr|V%dSdS)Nr)r zipr rr)r#rEtypes ranonymous_struct_fieldsz%StructOrUnion.anonymous_struct_fieldsfsb = $!$-??   d2::*T="A"A:JJJ % $  rTc#K|j}|dt|jz}t|j|j|j|D]H\}}}}|dkr3t |tr|r|D]}|V@||||fVIdS)Nrr) r lenr rr r rr enumfields)r#expand_anonymous_struct_unionr rErbitsizerr%s rrzStructOrUnion.enumfieldsls=  c$-000H*-dmT].2ox+I+I 3 3 &D$ z$ >> 5#oo//!!F LLLL!T7E22222 3 3rcg}g}g}g}|D]V\}}}}|||j|||||Wt||_t||_t||_t||_dSr2)rrrZr r r r ) r#namestypesbitsizesr rErrrs r force_flattenzStructOrUnion.force_flattenzs*.//*;*; # # &D$ LL    EL    OOG $ $ $ OOE " " " "e  e  //h rcpt||||}|s||||Sr2)rr<finish_backend_type)r#r7r8r9r:s rr<zStructOrUnion.get_cached_btypesE#44T3 5>@@ 6  $ $S* 5 5 5 rc|jr%|jdkrtd|jddSj|}d|_|jn|jufd|jD}t t|j||j }d}|j r|j dkrd}n d|j f}j j |||d d g|Rng}|j\}}} } tt|jD]} || } |j| } t| t r| r| j}t)| |\}}|dkr.|d |jd |j| pd d | |} |jd| | fz|j| dzdz|_| }t| t r| j | dksJnI|}|| kr.|d|j|j| pd || fz||t t|j||j |}j |||| | d|_dS)Nrz%recursive structure declaration for ''rc<g|]}|Sr.)r<)rDrr7r8s rrFz5StructOrUnion.finish_backend_type..s9111++C<<111rr.)rrzfield '.z{}z' has a bogus size?z=field '%s.%s' is declared as %d bytes, but is really %d bytes) completedrrEr3r  fixedlayoutlistrr r packedrcomplete_struct_or_unionrangerrrrrr<divmodsizeof_verification_errorrrr)r#r7r8r:r lst extra_flagsfieldofs fieldsize totalsizetotalalignmentrpfsizeftype BItemTypenlennrest BFieldType bitemsizes `` rrz!StructOrUnion.finish_backend_typesh > ~""))8< +DEEE F"4( =    %11111"&-111Hs4=(DODDEECK{ 3;!##"&KK#$dk"2K 1CL 1%d24b H;F H H H H HH=A=M :HiN3t}--.. , ,!!  a(eY// :E4K4K4M4M : % ; ;C L LI"( 90E0E"F"FKD%zz000 IIIt}Q'7'?4'?'?ABBB"0066E%)]2A2%6%%A%)]1Q344%8&9DM#33CDD eY// DEL4H A::::: # : 6 6I E))00.1515q1A1IT1:E1CCDDD  ++++s4=(DOXNNOOC L 1 1%d2;^ M M Mrc t|r2)r)r#msgs rr*z!StructOrUnion._verification_errors$$$rch|jr(|j#t|dSdSr2)partialr#rr"r(s rcheck_not_partialzStructOrUnion.check_not_partials> < :D,4%d&6&6&8&899 9 : :44rc|||t||d|jz||S)Nz new_%s_typekey)r<rrcrrrds rr5z StructOrUnion.build_backend_typesa    $D#}ty'@ 2244$@@@ @rr2)TrI)rJrKrLr#r"r;r%r_rrrr<rr*r<r5r.rrrrXsKIG F(((( 3 3 3 3((($===~%%%:::@@@@@rrceZdZdZdS) StructTypestructNrJrKrLrr.rrrArAs DDDrrAceZdZdZdS) UnionTypeunionNrCr.rrrErEs DDDrrEc:eZdZdZdZdZd dZdZdZdZ dZ dS) EnumTypeenumFNcf||_||_||_||_|dSr2)rE enumerators enumvalues baseinttyper)r#rErKrLrMs rr_zEnumType.__init__s8 &$& %%'''''rct|||j4|}d|ddz|_dSdS)Nrr_)rrrrr!)r#rrEs rrzEnumType.force_the_namesW**4;;; > !))++D 4<<S#9#99DNNN " !rch|jr(|js#t|dSdSr2)r;partial_resolvedrr"r(s rr<zEnumType.check_not_partialsD < : 5 :%d&6&6&8&899 9 : : : :rc ||||}t||d||j|j||S)N new_enum_typer>)r<build_baseinttypercrrKrL)r#r7r8 base_btypes rr5zEnumType.build_backend_typesd    ++C<< D# 2244 ,do&D222 2rcb|j|j||S|jr)t|j}t |j}n]ddl} t n#t$rYnwxYw| d| zdx}}|dkr!d}td}td}n d}td}td}|||} |||} | | } | | } |dd | zdz zkr|dd | z|z zkr| S|dd | zdz zkr|dd | z|z zkr| Std | z) NrzU%r has no values explicitly defined; guessing that it is equivalent to 'unsigned int'rrqrrrsrtrr z=%s values don't all fit into either 'long' or 'unsigned long')rMr<rLminmaxwarnings__warningregistry__clear NameErrorwarnr"rkr)r) r#r7r8smallest_value largest_valuerYsign candidate1 candidate2btype1btype2size1size2s rrTzEnumType.build_baseinttypes   '#44S*EE E ? / 11N00MM OOO $))++++     MMM ,,../ 0 0 0./ .N] A  D&u--J&v..JJD&~66J&77J,,S*==,,S*== 6"" 6"" % 2 3 3 Q1U74<0 1 1M % 2 3 3 Q1U74<0 1 1M-/3/?/?/A/ABCC CsA22 A?>A?r2) rJrKrLrr;rQr_rr<r5rTr.rrrHrHsy DG((((::: :::222'C'C'C'C'CrrHcp|d|z}t|ddd}||d|_|S)Nz$%s unknown_type)rAroriginrE structnamers rrhrh0sDT\ JdD 1 1BdBI IrcT|d|z}t|ddd}t||S)Nz$$%s)rArrjs runknown_ptr_typerm8s4d] JdD 1 1B B % %%rc2t|tjrtSt5t t |ds%tjt |_ t |j cdddS#1swxYwYdS)N __typecache) rr ModuleType_typecache_cffi_backend global_lockhasattrrweakrefWeakValueDictionaryro)backends r get_typecacherwBs'5+,,'&& ))tG}}m44 F(/(C(E(EDMM %G}}())))))))))))))))))sAB  BBc|d||f}|rJ |j|S#t$rYnwxYw t|j||}n)#t $r}t |d|d|d}~wwxYw|j}t 5||} | |||<|cdddS| cdddS#1swxYwYdS)Nr?: )pop _typecacher4rCrrrrget) srctyper7funcnamerkwdsr?resecacheres1s rrcrcMsw ((58T* + +COO8 ~c""      I-gclH--t4 III!(((GGGQQ"GHHHI NE yy~~ <E#J   s; + 88A A;A66A; C7CC  C c&td|d|S)N?rrb)r7r:s r pointer_cacherds S"4e < <$qvay//S(("ddAF1II.016!"":=>>((rr2)-rrtlockrerrorrrrr rr robjectrrPr] void_typergrkrrrrrr voidp_typerconst_voidp_typerrchar_array_typerrrArErHrhrmrrrurqrwrcrrr.rrrs DDDDDDDDDD      ,F,F,F,F,F,F,F,F^ @ @ @ @ @! @ @ @88888x888 HJJ  IHIHIHIHIH%IHIHIHX = = = = =* = = = = = = = =( = = =GGGGGxGGG( P P P P P& P P PPPPPP&PPP, B B B B B( B B B[ # # ((($#I..-----{---PPPPPPPP>)MM&11488,,,,,,,,,"F@F@F@F@F@'F@F@F@R ECECECECEC"ECECECN&&&&moo 5'577 ) ) ).===>>>>>r