fQiYldZddlZddlmZmZddlmZdZGddeZ Gdd eZ dS) z PDU moduleN) command_codesconsts) SMPP_ESME_ROKcptjd|ddd}tj|S)zExtract command from a PDUz>Lr)structunpackrget_command_name)pducodes [/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/smpplib/pdu.pyextract_commandrs3 =s1Q3x ( ( +D  )$ / //ceZdZdZdZdS)default_clientz Dummy clientrN)__name__ __module__ __qualname____doc__sequencerrrr#sHHHrrceZdZdZdZdZdZdZefdZ dZ dZ e e e Z dZdZd Zd Zd Zdd Zd ZdZdS)PDUz PDU classrNc B|t|_dS||_dS)z.Singleton dummy client will be used if omittedN)r_client)selfclientkwargss r__init__z PDU.__init__0s# >)++DLLL!DLLLrc6|j|jn |jjS)zReturn global sequence number) _sequencerrrs r _get_sequencezPDU._get_sequence7s!%!;t~~ L ! "rc||_dS)zSetter for sequenceN)r")rrs r _set_sequencezPDU._set_sequence<s !rc4|jS)zReturn next sequence number)r next_sequencer#s r _next_seqz PDU._next_seqBs|))+++rc"t|dS)z4Return True if this is a vendor PDU, False otherwisevendor)hasattrr#s r is_vendorz PDU.is_vendorFstX&&&rc,| S)z5Return True if this is a request PDU, False otherwise) is_responser#s r is_requestzPDU.is_requestJs##%%%%rcBtj|jdzrdSdS)z6Return True if this is a response PDU, False otherwiselTF)rget_command_codecommandr#s rr/zPDU.is_responseNs&  )$, 7 7* D 4urc*|jtkrdSdS)z9Return True if this is an error response, False otherwiseTF)statusrr#s ris_errorz PDU.is_errorTs ;- ' '4urcj||j} tj|}n#t$rd|zcYSwxYw|S)zReturn status descriptionNz&Description for status 0x%x not found!)r5r DESCRIPTIONSKeyError)rr5descs rget_status_desczPDU.get_status_descZs\ >[F E&v.DD E E E;fD D D D E s 00c|dd}tjd|}|d|_t||_|d|_|d|_t|dkr||dddSdS)z Parse raw PDUr>LLLLN) r r lengthrr3r5rlen parse_params)rdataheaderchunkss rparsez PDU.parsegs adw//Qi &t,, Qi q  t99r>>   d233i ( ( ( ( ( >rc|}t|dz|_tj|j}t jd|j||j|j }||zS)zGenerate raw PDUr=r>) generate_paramsrB_lengthrr2r3r packr5r)rbody command_coderEs rgeneratez PDU.generates_##%%4yy2~ $5dlCC WdlL$+t}]]}r)N)rrrrrAr3r5r"rr r$r&propertyrr)r-r0r/r6r;rGrNrrrrr(sO FG FI,n..""""""" """x }55H,,,'''&&&     )))4     rr) rr smpplibrrsmpplib.constsrrobjectrrrrrrSs& ))))))))((((((000V ddddd&dddddr