pynetdicom.pdu.A_ASSOCIATE_AC

class pynetdicom.pdu.A_ASSOCIATE_AC(primitive: A_ASSOCIATE | None = None)[source]

An A-ASSOCIATE-AC PDU.

An A-ASSOCIATE-AC PDU is sent by an association acceptor to indicate that association negotiation has been successful.

pdu_type

The PDU Type field value (0x02).

Type:

int

protocol_version

The Protocol Version field value (default 0x01).

Type:

int

variable_items

A list containing the A-ASSOCIATE-AC’s ‘Variable Items’. Contains one Application Context item, one or more Presentation Context items and one User Information item. The order of the items is not guaranteed.

Type:

list

Notes

An A-ASSOCIATE-AC PDU requires the following parameters:

  • PDU type (1, fixed value, 0x02)

  • PDU length (1)

  • Protocol version (1, default value, 0x01)

  • Variable items (1)

    • Application Context Item (1)

      • Item type (1, fixed value, 0x10)

      • Item length (1)

      • Application Context Name (1, fixed in an application)

    • Presentation Context Item(s) (1 or more)

      • Item type (1, fixed value, 0x21)

      • Item length (1)

      • Context ID (1)

      • Result/reason (1)

      • Transfer Syntax Sub-items (1)

        • Item type (1, fixed, 0x40)

        • Item length (1)

        • Transfer syntax name(s) (1)

    • User Information Item (1)

      • Item type (1, fixed, 0x50)

      • Item length (1)

      • User data Sub-items (2 or more)

        • Maximum Length Received Sub-item (1)

        • Implementation Class UID Sub-item (1)

        • Optional User Data Sub-items (0 or more)

Encoding

When encoded, an A-ASSOCIATE-AC PDU has the following structure, taken from Table 9-17 (offsets shown with Python indexing). PDUs are always encoded using Big Endian.

Offset

Length

Description

0

1

PDU type

1

1

Reserved

2

4

PDU length

6

2

Protocol version

8

2

Reserved

10

16

Reserved^

26

16

Reserved^

42

32

Reserved

74

Variable

Variable items

^ The reserved fields shall be sent with a value identical to the value received in the A-ASSOCIATE-RQ but their values shall not be tested.

References

__init__(primitive: A_ASSOCIATE | None = None) None[source]

Initialise a new A-ASSOCIATE-AC PDU.

Parameters:

primitive (pynetdicom.pdu_primitive.A_ASSOCIATE) – The primitive to use to initialise the PDU.

Methods

__init__([primitive])

Initialise a new A-ASSOCIATE-AC PDU.

decode(bytestream)

Decode bytestream and use the result to set the field values of the PDU.

encode()

Return the encoded PDU as bytes.

from_primitive(primitive)

Setup the current PDU using an A-ASSOCIATE (accept) primitive.

to_primitive()

Return an A-ASSOCIATE (accept) primitive from the current PDU.

Attributes

application_context_name

Return the Application Context Name, if available.

called_ae_title

Return the value sent in the Called AE Title reserved space.

calling_ae_title

Return the value sent in the Calling AE Title reserved space.

pdu_length

Return the PDU Length field value as an int.

pdu_type

Return the PDU Type field value as int.

presentation_context

Return a list of the Presentation Context Items.

reserved_aec

Get or set the A-ASSOCIATE-AC's reserved Calling AE Title value.

reserved_aet

Get or set the A-ASSOCIATE-AC's reserved Called AE Title value.

user_information

Return the User Information Item, if available.

property application_context_name: UID | None

Return the Application Context Name, if available.

Returns:

The acceptor’s Application Context Name or None if not available.

Return type:

pydicom.uid.UID or None

property called_ae_title: str

Return the value sent in the Called AE Title reserved space.

While the standard says this value should match the A-ASSOCIATE-RQ value there is no guarantee and this should not be used as a check value.

Returns:

The value the A-ASSOCIATE-AC sent in the Called AE Title reserved space. May be an empty string if unable to decode the value.

Return type:

str

property calling_ae_title: str

Return the value sent in the Calling AE Title reserved space.

While the standard says this value should match the A-ASSOCIATE-RQ value there is no guarantee and this should not be used as a check value.

Returns:

The value the A-ASSOCIATE-AC sent in the Calling AE Title reserved space. May be an empty string if unable to decode the value.

Return type:

bytes

from_primitive(primitive: A_ASSOCIATE) None[source]

Setup the current PDU using an A-ASSOCIATE (accept) primitive.

Parameters:

primitive (pdu_primitives.A_ASSOCIATE) – The primitive to use to set the current PDU field values.

property pdu_length: int

Return the PDU Length field value as an int.

property presentation_context: List[PresentationContextItemAC]

Return a list of the Presentation Context Items.

Returns:

The Presentation Context Items.

Return type:

list of pdu_items.PresentationContextItemAC

property reserved_aec: str

Get or set the A-ASSOCIATE-AC’s reserved Calling AE Title value.

Parameters:

value (str or bytes) – The value at offset 27-42 in the A-ASSOCIATE-AC PDU, usually the same value as the Calling AE Title.

Returns:

The decoded value at offset 27-42 in the A-ASSOCIATE-AC PDU, usually the same value as the Calling AE Title, or '' if unable to decode the value.

Return type:

str

property reserved_aet: str

Get or set the A-ASSOCIATE-AC’s reserved Called AE Title value.

Parameters:

value (str or bytes) – The value at offset 11-26 in the A-ASSOCIATE-AC PDU, usually the same value as the Called AE Title.

Returns:

The decoded value at offset 11-26 in the A-ASSOCIATE-AC PDU, usually the same value as the Called AE Title, or '' if unable to decode the value.

Return type:

str

to_primitive() A_ASSOCIATE[source]

Return an A-ASSOCIATE (accept) primitive from the current PDU.

Returns:

The primitive representation of the current PDU.

Return type:

pdu_primitives.A_ASSOCIATE

property user_information: UserInformationItem | None

Return the User Information Item, if available.

Returns:

The acceptor’s User Information object or None, if not available.

Return type:

pdu_items.UserInformationItem or None