Service State Machine (fsm)¶
Implementation of the OSI Upper Layer Services DICOM, Part 8, Section 7
-
class
pynetdicom2.fsm.States¶ Services states enumeration.
-
STA_1= 0¶ Idle
-
STA_2= 1¶ Transport Connection Open (Awaiting A-ASSOCIATE-RQ PDU)
-
STA_3= 2¶ Awaiting Local A-ASSOCIATE response primitive (from local user)
-
STA_4= 3¶ Awaiting transport connection opening to complete (from local transport service)
-
STA_5= 4¶ Awaiting A-ASSOCIATE-AC or A-ASSOCIATE-RJ PDU
-
STA_6= 5¶ Association established and ready for data transfer
-
STA_7= 6¶ Awaiting A-RELEASE-RP PDU
-
STA_8= 7¶ Awaiting local A-RELEASE response primitive (from local user)
-
STA_9= 8¶ Release collision requestor side; awaiting A-RELEASE response (from local user)
-
STA_10= 9¶ Release collision acceptor side; awaiting A-RELEASE-RP PDU
-
STA_11= 10¶ Release collision requestor side; awaiting A-RELEASE-RP PDU
-
STA_12= 11¶ Release collision acceptor side; awaiting A-RELEASE response primitive (from local user)
-
STA_13= 12¶ Awaiting Transport Connection Close Indication (Association no longer exists)
-
-
class
pynetdicom2.fsm.Events¶ Events enumeration.
-
EVT_1= 0¶ A-ASSOCIATE request (local user)
-
EVT_2= 1¶ Transport connect confirmation (local transport service)
-
EVT_3= 2¶ A-ASSOCIATE-AC PDU (received on transport connection)
-
EVT_4= 3¶ A-ASSOCIATE-RJ PDU (received on transport connection)
-
EVT_5= 4¶ Transport connection indication (local transport service)
-
EVT_6= 5¶ A-ASSOCIATE-RQ PDU (on tranport connection)
-
EVT_7= 6¶ A-ASSOCIATE response primitive (accept)
-
EVT_8= 7¶ A-ASSOCIATE response primitive (reject)
-
EVT_9= 8¶ P-DATA request primitive
-
EVT_10= 9¶ P-DATA-TF PDU (on transport connection)
-
EVT_11= 10¶ A-RELEASE request primitive
-
EVT_12= 11¶ A-RELEASE-RQ PDU (on transport)
-
EVT_13= 12¶ A-RELEASE-RP PDU (on transport)
-
EVT_14= 13¶ A-RELEASE response primitive
-
EVT_15= 14¶ A-ABORT request primitive
-
EVT_16= 15¶ A-ABORT PDU (on transport)
-
EVT_17= 16¶ Transport connection closed
-
EVT_18= 17¶ ARTIM timer expired (rej/rel)
-
EVT_19= 18¶ Unrecognized/invalid PDU
-
-
class
pynetdicom2.fsm.StateMachine(provider, timer, store_in_file, get_file_cb)¶ Service State Machine implementation.
Variables: - current_state – current state
- provider – DUL provider
- timer –
- store_in_file – set of SOP Class UIDs, for which incoming datasets should be stored in a file, rather than in-memory
- get_file_cb – callback for getting a file object for storage
- accepted_contexts – accepted presentation contexts in current association
- dimse_decoder – decoder for incoming P-DATA-TF PDUs, used to re-create incoming DIMSE message
- transition_table – state machine transition table
-
primitive¶ Current PDU.
-
dul_socket¶ TCP Socket
-
to_service_user¶ Outgoing PDU/DIMSE message queue
-
action(event)¶ Execute the action triggered by event
-
ae_1()¶ Issue TransportConnect request primitive to local transport service.
-
ae_2()¶ Send A_ASSOCIATE-RQ PDU.
-
ae_3()¶ Issue A-ASSOCIATE confirmation (accept) primitive.
-
ae_4()¶ Issue A-ASSOCIATE confirmation (reject) primitive and close transport connection.
-
ae_5()¶ Issue transport connection response primitive; start ARTIM timer.
-
ae_6()¶ Check A-ASSOCIATE-RQ.
Stop ARTIM timer and if A-ASSOCIATE-RQ acceptable by service provider - issue A-ASSOCIATE indication primitive.
-
ae_7()¶ Send A-ASSOCIATE-AC PDU.
-
ae_8()¶ Send A-ASSOCIATE-RJ PDU.
-
dt_1()¶ Send P-DATA-TF PDU.
-
dt_2()¶ Send P-DATA indication primitive.
-
ar_1()¶ Send A-RELEASE-RQ PDU.
-
ar_2()¶ Send A-RELEASE indication primitive.
-
ar_3()¶ Issue A-RELEASE confirmation primitive and close transport connection.
-
ar_4()¶ Issue A-RELEASE-RP PDU and start ARTIM timer.
-
ar_5()¶ Stop ARTIM timer.
-
ar_6()¶ Issue P-DATA indication.
-
ar_7()¶ Issue P-DATA-TF PDU.
-
ar_8()¶ Issue A-RELEASE indication (release collision).
-
ar_9()¶ Send A-RELEASE-RP PDU.
-
ar_10()¶ Issue A-RELEASE confirmation primitive.
-
aa_1()¶ Send A-ABORT PDU (service-user source) and start (or restart) ARTIM timer.
-
aa_2()¶ Stop ARTIM timer if running. Close transport connection.
-
aa_3()¶ Issue A-ABORT or A-P-ABORT indication and close transport connection.
If (service-user initiated abort):
- Issue A-ABORT indication and close transport connection.
Otherwise (service-provider initiated abort):
- Issue A-P-ABORT indication and close transport connection.
This action is triggered by the reception of an A-ABORT PDU.
-
aa_4()¶ Issue A-P-ABORT indication primitive.
-
aa_5()¶ Stop ARTIM timer.
-
aa_6()¶ Ignore PDU.
-
aa_7()¶ Send A-ABORT PDU.
-
aa_8()¶ Send A-ABORT PDU, issue an A-P-ABORT indication and start ARTIM timer.
-
class
pynetdicom2.fsm.DIMSEDecoder(accepted_contexts, store_in_file, get_file_cb)¶ DIMSE Message decoder.
Decodes incoming P-DATA-TF PDUs into DIMSE message instance.
Variables: - accepted_contexts – accepted presentation contexts in current association
- store_in_file – set of SOP Class UIDs, for which incoming datasets should be stored in a file, rather than in-memory
- get_file_cb – callback for getting a file object for storage
- receiving – True if
DIMSEDecoderinstnace has not received all P-DATA-TF PDUs for the current DIMSE message - command_set_received – True if Command Set for DIMSE message is received
- data_set_received – True if Dataset for DIMSE message is received
- pc_id – Presentation Context ID
- msg – decoded DIMSE message
-
process(p_data)¶ Processes new incoming P-DATA-TF PDU
Parameters: p_data – incoming P-DATA-TF PDU Raises: exceptions.DIMSEProcessingError – raised if unknown PDV type is encountered