Documentation
¶
Overview ¶
Package pdu implements DICOM Upper Layer Protocol Data Units (PS3.8).
Encoding is big-endian. Behaviour aligns with pynetdicom's pdu module; golden fixtures live in fixtures_test.go (from pynetdicom tests).
Index ¶
- Constants
- Variables
- func PadAETitle(ae string) ([16]byte, error)
- func TrimAETitle(b []byte) string
- func Write(w io.Writer, p PDU) error
- type AAbort
- type AAssociateAC
- type AAssociateRJ
- type AAssociateRQ
- type AReleaseRP
- type AReleaseRQ
- type PDU
- type PDV
- type PDataTF
- type PresentationContextAC
- type PresentationContextRQ
- type RoleSelection
- type UserIdentityAC
- type UserIdentityRQ
- type UserInformation
Constants ¶
const ( MCHCommand byte = 0x01 MCHLastFragment byte = 0x02 )
Message control header bits (PS3.8 Annex E).
const ( TypeAAssociateRQ = 0x01 TypeAAssociateAC = 0x02 TypeAAssociateRJ = 0x03 TypePDataTF = 0x04 TypeAReleaseRQ = 0x05 TypeAReleaseRP = 0x06 TypeAAbort = 0x07 )
PDU type values (PS3.8 Table 9-1).
const ( ItemApplicationContext = 0x10 ItemPresentationContextRQ = 0x20 ItemPresentationContextAC = 0x21 ItemAbstractSyntax = 0x30 ItemTransferSyntax = 0x40 ItemUserInformation = 0x50 ItemMaxLength = 0x51 ItemImplementationClassUID = 0x52 ItemRoleSelection = 0x54 ItemImplementationVersion = 0x55 ItemUserIdentityRQ = 0x58 ItemUserIdentityAC = 0x59 )
Item type values for A-ASSOCIATE variable items.
const ( UserIdentityUsername = 1 UserIdentityUsernamePasscode = 2 UserIdentityKerberos = 3 UserIdentitySAML = 4 UserIdentityJWT = 5 )
User Identity Type values (PS3.7 Annex D.3.3.7).
const ( ApplicationContextName = "1.2.840.10008.3.1.1.1" VerificationSOPClass = "1.2.840.10008.1.1" ImplicitVRLittleEndian = "1.2.840.10008.1.2" )
Standard UIDs used during association.
const DefaultMaxPDULength = 16382
DefaultMaxPDULength is a common Maximum Length Received default (16382).
Variables ¶
var ErrUnexpectedType = errors.New("pdu: unexpected type")
ErrUnexpectedType is returned when a PDU type does not match expectations.
Functions ¶
func PadAETitle ¶
PadAETitle returns a 16-byte AE title (trailing spaces).
func TrimAETitle ¶
TrimAETitle strips trailing spaces from a 16-byte AE title field.
Types ¶
type AAssociateAC ¶
type AAssociateAC struct {
ProtocolVersion uint16
CalledAETitle string
CallingAETitle string
ApplicationContextName string
PresentationContexts []PresentationContextAC
UserInformation UserInformation
}
AAssociateAC is an A-ASSOCIATE-AC PDU.
func DecodeAAssociateAC ¶
func DecodeAAssociateAC(raw []byte) (*AAssociateAC, error)
DecodeAAssociateAC parses an A-ASSOCIATE-AC PDU.
func (*AAssociateAC) Encode ¶
func (p *AAssociateAC) Encode() ([]byte, error)
Encode serializes the PDU.
func (*AAssociateAC) Type ¶
func (p *AAssociateAC) Type() byte
type AAssociateRJ ¶
AAssociateRJ is an A-ASSOCIATE-RJ PDU.
func DecodeAAssociateRJ ¶
func DecodeAAssociateRJ(raw []byte) (*AAssociateRJ, error)
DecodeAAssociateRJ parses an A-ASSOCIATE-RJ PDU.
func (*AAssociateRJ) Encode ¶
func (p *AAssociateRJ) Encode() ([]byte, error)
Encode serializes the PDU.
func (*AAssociateRJ) Type ¶
func (p *AAssociateRJ) Type() byte
type AAssociateRQ ¶
type AAssociateRQ struct {
ProtocolVersion uint16
CalledAETitle string
CallingAETitle string
ApplicationContextName string
PresentationContexts []PresentationContextRQ
UserInformation UserInformation
}
AAssociateRQ is an A-ASSOCIATE-RQ PDU.
func DecodeAAssociateRQ ¶
func DecodeAAssociateRQ(raw []byte) (*AAssociateRQ, error)
DecodeAAssociateRQ parses an A-ASSOCIATE-RQ PDU.
func (*AAssociateRQ) Encode ¶
func (p *AAssociateRQ) Encode() ([]byte, error)
Encode serializes the PDU.
func (*AAssociateRQ) Type ¶
func (p *AAssociateRQ) Type() byte
type AReleaseRP ¶
type AReleaseRP struct{}
AReleaseRP is an A-RELEASE-RP PDU.
func DecodeAReleaseRP ¶
func DecodeAReleaseRP(raw []byte) (*AReleaseRP, error)
DecodeAReleaseRP parses an A-RELEASE-RP PDU.
func (*AReleaseRP) Encode ¶
func (p *AReleaseRP) Encode() ([]byte, error)
Encode serializes the PDU.
func (*AReleaseRP) Type ¶
func (p *AReleaseRP) Type() byte
type AReleaseRQ ¶
type AReleaseRQ struct{}
AReleaseRQ is an A-RELEASE-RQ PDU.
func DecodeAReleaseRQ ¶
func DecodeAReleaseRQ(raw []byte) (*AReleaseRQ, error)
DecodeAReleaseRQ parses an A-RELEASE-RQ PDU.
func (*AReleaseRQ) Encode ¶
func (p *AReleaseRQ) Encode() ([]byte, error)
Encode serializes the PDU.
func (*AReleaseRQ) Type ¶
func (p *AReleaseRQ) Type() byte
type PDV ¶
PDV is a Presentation Data Value item inside a P-DATA-TF PDU. Value is Message Control Header + fragment (command or dataset).
func NewCommandPDV ¶
NewCommandPDV builds a single last-fragment command PDV.
func NewDataPDV ¶
NewDataPDV builds a single last-fragment dataset PDV.
type PDataTF ¶
type PDataTF struct {
PDVs []PDV
}
PDataTF is a P-DATA-TF PDU.
func DecodePDataTF ¶
DecodePDataTF parses a P-DATA-TF PDU.
func FragmentMessage ¶
func FragmentMessage(contextID byte, command, dataset []byte, maxPDULength uint32) ([]*PDataTF, error)
FragmentMessage builds P-DATA-TF PDUs for a command set and optional dataset.
maxPDULength is the peer's Maximum Length Received (0 = unlimited). Each P-DATA-TF PDV list is kept within that limit (PS3.8 Annex D), matching pynetdicom's encode_msg fragmentation.
type PresentationContextAC ¶
PresentationContextAC is an accepted/rejected context in A-ASSOCIATE-AC.
type PresentationContextRQ ¶
PresentationContextRQ is a proposed presentation context in A-ASSOCIATE-RQ.
type RoleSelection ¶ added in v0.4.0
RoleSelection is an SCP/SCU Role Selection Negotiation sub-item (0x54). Aligned with pynetdicom SCP_SCU_RoleSelectionNegotiation.
type UserIdentityAC ¶ added in v0.6.0
type UserIdentityAC struct {
ServerResponse []byte
}
UserIdentityAC is a User Identity Negotiation response sub-item (0x59). Aligned with pynetdicom UserIdentitySubItemAC.
type UserIdentityRQ ¶ added in v0.6.0
type UserIdentityRQ struct {
Type byte
PositiveResponseRequested bool
PrimaryField []byte
SecondaryField []byte // used when Type == UserIdentityUsernamePasscode
}
UserIdentityRQ is a User Identity Negotiation request sub-item (0x58). Aligned with pynetdicom UserIdentitySubItemRQ.
type UserInformation ¶
type UserInformation struct {
MaxLength uint32
ImplementationClassUID string
ImplementationVersionName string
RoleSelections []RoleSelection
UserIdentityRQ *UserIdentityRQ // A-ASSOCIATE-RQ only
UserIdentityAC *UserIdentityAC // A-ASSOCIATE-AC only
}
UserInformation carries association negotiation user items.