Odil
A C++11 library for the DICOM standard
AssociationParameters.h
Go to the documentation of this file.
1/*************************************************************************
2 * odil - Copyright (C) Universite de Strasbourg
3 * Distributed under the terms of the CeCILL-B license, as published by
4 * the CEA-CNRS-INRIA. Refer to the LICENSE file or to
5 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
6 * for details.
7 ************************************************************************/
8
9#ifndef _061fafd4_982e_4a7e_9eb0_29e06443ebf3
10#define _061fafd4_982e_4a7e_9eb0_29e06443ebf3
11
12#include <cstdint>
13#include <string>
14#include <vector>
15
16#include "odil/odil.h"
21
22namespace odil
23{
24
27{
28public:
34 {
36 enum class Result
37 {
38 Acceptance = 0,
39 UserRejection = 1,
40 NoReason = 2,
41 AbstractSyntaxNotSupported = 3,
42 TransferSyntaxesNotSupported = 4,
43 };
44
45 enum class Role
46 {
47 Unspecified, // No information specified in a query
48 None, // No role accepted in a response
49 SCU,
50 SCP,
51 Both,
52 };
53
56 uint8_t id,
57 std::string const & abstract_syntax,
58 std::vector<std::string> const & transfer_syntaxes,
59 Role role,
60 Result result=Result::NoReason);
61
64 std::string const & abstract_syntax,
65 std::vector<std::string> const & transfer_syntaxes,
66 Role role,
67 Result result=Result::NoReason);
68
70 uint8_t id;
71
73 std::string abstract_syntax;
74
76 std::vector<std::string> transfer_syntaxes;
77
80
83
85 bool operator==(PresentationContext const & other) const;
86 };
87
90 {
92 enum class Type
93 {
94 None = 0,
95 Username = 1,
96 UsernameAndPassword = 2,
97 Kerberos = 3,
98 SAML = 4
99 };
100
102
104 Type type, std::string const & primary_field,
105 std::string const & secondary_field);
106
109
111 std::string primary_field;
112
114 std::string secondary_field;
115
117 bool operator==(UserIdentity const & other) const;
118 };
119
122
125
128 pdu::AAssociateAC const & pdu, AssociationParameters const & request);
129
131 std::string const & get_called_ae_title() const;
132
139 AssociationParameters & set_called_ae_title(std::string const & value);
140
142 std::string const & get_calling_ae_title() const;
143
150 AssociationParameters & set_calling_ae_title(std::string const & value);
151
153 std::vector<PresentationContext> const & get_presentation_contexts() const;
154
157 set_presentation_contexts(std::vector<PresentationContext> const & value);
158
161
164
167 set_user_identity_to_username(std::string const & username);
168
172 std::string const & username, std::string const & password);
173
176 set_user_identity_to_kerberos(std::string const & ticket);
177
180 set_user_identity_to_saml(std::string const & assertion);
181
183 uint32_t get_maximum_length() const;
184
190
193
199
202
208
210 std::vector<pdu::SOPClassExtendedNegotiation>
212
218 std::vector<pdu::SOPClassExtendedNegotiation> const & value);
219
221 std::vector<pdu::SOPClassCommonExtendedNegotiation>
223
229 std::vector<pdu::SOPClassCommonExtendedNegotiation> const & value);
230
233
236
238 bool operator==(AssociationParameters const & other) const;
239
240private:
241 std::string _called_ae_title;
242 std::string _calling_ae_title;
243 std::vector<PresentationContext> _presentation_contexts;
244 UserIdentity _user_identity;
245 uint32_t _maximum_length;
246 uint16_t _maximum_number_operations_invoked;
247 uint16_t _maximum_number_operations_performed;
248 std::vector<pdu::SOPClassExtendedNegotiation>
249 _sop_class_extended_negotiation;
250 std::vector<pdu::SOPClassCommonExtendedNegotiation>
251 _sop_class_common_extended_negotiation;
252
254 AssociationParameters & _set_user_identity(UserIdentity const & value);
255};
256
257}
258
259#endif // _061fafd4_982e_4a7e_9eb0_29e06443ebf3
Encapsulate association parameters.
Definition: AssociationParameters.h:27
std::vector< PresentationContext > const & get_presentation_contexts() const
Return the presentation contexts, default to empty.
AssociationParameters & set_user_identity_to_none()
Do no authenticate user.
AssociationParameters()
Constructor.
AssociationParameters & set_user_identity_to_saml(std::string const &assertion)
Authenticate user using a SAML assertion.
AssociationParameters & set_maximum_length(uint32_t value)
Set the maximum length of a PDU, the value 0 meaning no maximum length.
std::vector< pdu::SOPClassExtendedNegotiation > get_sop_class_extended_negotiation() const
Return the list of SOP Class Extended Negotiation items.
uint16_t get_maximum_number_operations_invoked() const
Return the maximum number of outstanding operations invoked.
std::string const & get_calling_ae_title() const
Return the calling AE title, default to empty.
AssociationParameters & set_user_identity_to_username(std::string const &username)
Authenticate user using only a username.
AssociationParameters(pdu::AAssociateRQ const &pdu)
Constructor from an A-ASSOCIATE-RQ PDU.
void set_sop_class_common_extended_negotiation(std::vector< pdu::SOPClassCommonExtendedNegotiation > const &value)
Set the list of SOP Class Common Extend Negotiation items, default to an empty list.
bool operator==(AssociationParameters const &other) const
Member-wise equality.
uint16_t get_maximum_number_operations_performed() const
Return the maximum number of outstanding operations performed.
AssociationParameters & set_user_identity_to_username_and_password(std::string const &username, std::string const &password)
Authenticate user using a username and a password.
UserIdentity const & get_user_identity() const
Return the user identity, default to None.
std::string const & get_called_ae_title() const
Return the called AE title, default to empty.
pdu::AAssociateRQ as_a_associate_rq() const
Create an A-ASSOCIATE-RQ PDU.
AssociationParameters & set_presentation_contexts(std::vector< PresentationContext > const &value)
Set the presentation contexts. All ids must be odd and unique.
AssociationParameters & set_maximum_number_operations_performed(uint16_t value)
Set the maximum number of outstanding operations performed, default to 1.
uint32_t get_maximum_length() const
Return the maximum length of a PDU, default to 16384.
pdu::AAssociateAC as_a_associate_ac() const
Create an A-ASSOCIATE-AC PDU.
AssociationParameters & set_maximum_number_operations_invoked(uint16_t value)
Set the maximum number of outstanding operations invoked, default to 1.
AssociationParameters & set_user_identity_to_kerberos(std::string const &ticket)
Authenticate user using a Kerberos ticket.
std::vector< pdu::SOPClassCommonExtendedNegotiation > get_sop_class_common_extended_negotiation() const
Return the list of SOP Class Extended Negotiation items.
void set_sop_class_extended_negotiation(std::vector< pdu::SOPClassExtendedNegotiation > const &value)
Set the list of SOP Class Extended Negotiation items, default to an empty list.
AssociationParameters & set_called_ae_title(std::string const &value)
Set the called AE title.
AssociationParameters(pdu::AAssociateAC const &pdu, AssociationParameters const &request)
Constructor from an A-ASSOCIATE-RQ PDU.
AssociationParameters & set_calling_ae_title(std::string const &value)
Set the calling AE title.
Base class for all Service Class Providers.
Definition: SCP.h:25
Base class for all Service Class Users.
Definition: SCU.h:22
A-ASSOCIATE-AC PDU, cf. PS 3.8, 9.3.3.
Definition: AAssociateAC.h:26
A-ASSOCIATE-RQ, cf. PS 3.8, 9.3.2.
Definition: AAssociateRQ.h:26
Definition: Association.h:25
#define ODIL_API
Definition: odil.h:28
Presentation Context, cf. PS 3.8, 9.3.2.2, PS 3.8, 9.3.3.2, PS 3.7, D.3.3.4.1 and PS 3....
Definition: AssociationParameters.h:34
Role
Definition: AssociationParameters.h:46
Result
Result of the presentation context negotiation.
Definition: AssociationParameters.h:37
bool operator==(PresentationContext const &other) const
Member-wise equality.
Role role
SCU/SCP role negotiation.
Definition: AssociationParameters.h:79
PresentationContext(std::string const &abstract_syntax, std::vector< std::string > const &transfer_syntaxes, Role role, Result result=Result::NoReason)
Simplified constructor, sets the id to the invalid value 0.
Result result
Result of the negotiation.
Definition: AssociationParameters.h:82
std::string abstract_syntax
Proposed abstract syntax.
Definition: AssociationParameters.h:73
uint8_t id
Identifier of the presentation context, must be odd.
Definition: AssociationParameters.h:70
std::vector< std::string > transfer_syntaxes
Proposed transfer syntaxes or accepted transfer syntax.
Definition: AssociationParameters.h:76
PresentationContext(uint8_t id, std::string const &abstract_syntax, std::vector< std::string > const &transfer_syntaxes, Role role, Result result=Result::NoReason)
Constructor.
User Identity, cf. PS3.8 D.3.3.7.
Definition: AssociationParameters.h:90
Type type
Identity type.
Definition: AssociationParameters.h:108
bool operator==(UserIdentity const &other) const
Member-wise equality.
Type
User identity type.
Definition: AssociationParameters.h:93
std::string primary_field
Primary identity field.
Definition: AssociationParameters.h:111
std::string secondary_field
Secondary identity field.
Definition: AssociationParameters.h:114
UserIdentity(Type type, std::string const &primary_field, std::string const &secondary_field)