odil
C++11libraryfortheDICOMstandard
AssociationParameters.h
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"
17 #include "odil/pdu/AAssociateAC.h"
18 #include "odil/pdu/AAssociateRQ.h"
19 #include "odil/pdu/SOPClassCommonExtendedNegotiation.h"
20 #include "odil/pdu/SOPClassExtendedNegotiation.h"
21 
22 namespace odil
23 {
24 
26 class ODIL_API AssociationParameters
27 {
28 public:
33  struct ODIL_API PresentationContext
34  {
36  enum class Result
37  {
38  Acceptance = 0,
39  UserRejection = 1,
40  NoReason = 2,
41  AbstractSyntaxNotSupported = 3,
42  TransferSyntaxesNotSupported = 4,
43  };
44 
46  uint8_t id,
47  std::string const & abstract_syntax,
48  std::vector<std::string> const & transfer_syntaxes,
49  bool scu_role_support, bool scp_role_support,
50  Result result=Result::NoReason);
51 
53  uint8_t id;
54 
56  std::string abstract_syntax;
57 
59  std::vector<std::string> transfer_syntaxes;
60 
63 
66 
69 
71  bool operator==(PresentationContext const & other) const;
72  };
73 
75  struct ODIL_API UserIdentity
76  {
78  enum class Type
79  {
80  None = 0,
81  Username = 1,
82  UsernameAndPassword = 2,
83  Kerberos = 3,
84  SAML = 4
85  };
86 
87  UserIdentity();
88 
90  Type type, std::string const & primary_field,
91  std::string const & secondary_field);
92 
95 
97  std::string primary_field;
98 
100  std::string secondary_field;
101 
103  bool operator==(UserIdentity const & other) const;
104  };
105 
108 
110  AssociationParameters(pdu::AAssociateRQ const & pdu);
111 
114  pdu::AAssociateAC const & pdu, AssociationParameters const & request);
115 
117  std::string const & get_called_ae_title() const;
118 
125  AssociationParameters & set_called_ae_title(std::string const & value);
126 
128  std::string const & get_calling_ae_title() const;
129 
136  AssociationParameters & set_calling_ae_title(std::string const & value);
137 
139  std::vector<PresentationContext> const & get_presentation_contexts() const;
140 
143  set_presentation_contexts(std::vector<PresentationContext> const & value);
144 
146  UserIdentity const & get_user_identity() const;
147 
149  AssociationParameters & set_user_identity_to_none();
150 
153  set_user_identity_to_username(std::string const & username);
154 
157  set_user_identity_to_username_and_password(
158  std::string const & username, std::string const & password);
159 
162  set_user_identity_to_kerberos(std::string const & ticket);
163 
166  set_user_identity_to_saml(std::string const & assertion);
167 
169  uint32_t get_maximum_length() const;
170 
175  AssociationParameters & set_maximum_length(uint32_t value);
176 
178  uint16_t get_maximum_number_operations_invoked() const;
179 
184  AssociationParameters & set_maximum_number_operations_invoked(uint16_t value);
185 
187  uint16_t get_maximum_number_operations_performed() const;
188 
193  AssociationParameters & set_maximum_number_operations_performed(uint16_t value);
194 
196  std::vector<pdu::SOPClassExtendedNegotiation>
197  get_sop_class_extended_negotiation() const;
198 
203  void set_sop_class_extended_negotiation(
204  std::vector<pdu::SOPClassExtendedNegotiation> const & value);
205 
207  std::vector<pdu::SOPClassCommonExtendedNegotiation>
208  get_sop_class_common_extended_negotiation() const;
209 
214  void set_sop_class_common_extended_negotiation(
215  std::vector<pdu::SOPClassCommonExtendedNegotiation> const & value);
216 
218  pdu::AAssociateRQ as_a_associate_rq() const;
219 
221  pdu::AAssociateAC as_a_associate_ac() const;
222 
224  bool operator==(AssociationParameters const & other) const;
225 
226 private:
227  std::string _called_ae_title;
228  std::string _calling_ae_title;
229  std::vector<PresentationContext> _presentation_contexts;
230  UserIdentity _user_identity;
231  uint32_t _maximum_length;
232  uint16_t _maximum_number_operations_invoked;
233  uint16_t _maximum_number_operations_performed;
234  std::vector<pdu::SOPClassExtendedNegotiation>
235  _sop_class_extended_negotiation;
236  std::vector<pdu::SOPClassCommonExtendedNegotiation>
237  _sop_class_common_extended_negotiation;
238 
240  AssociationParameters & _set_user_identity(UserIdentity const & value);
241 };
242 
243 }
244 
245 #endif // _061fafd4_982e_4a7e_9eb0_29e06443ebf3
std::string abstract_syntax
Proposed abstract syntax.
Definition: AssociationParameters.h:56
uint8_t id
Identifier of the presentation context, must be odd.
Definition: AssociationParameters.h:53
bool scu_role_support
Support for SCU role.
Definition: AssociationParameters.h:62
bool scp_role_support
Support for SCP role.
Definition: AssociationParameters.h:65
Definition: Association.cpp:39
Encapsulate association parameters.
Definition: AssociationParameters.h:26
Result
Result of the presentation context negotiation.
Definition: AssociationParameters.h:36
Type
User identity type.
Definition: AssociationParameters.h:78
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:33
std::string secondary_field
Secondary identity field.
Definition: AssociationParameters.h:100
Type type
Identity type.
Definition: AssociationParameters.h:94
Result result
Result of the negotiation.
Definition: AssociationParameters.h:68
std::string primary_field
Primary identity field.
Definition: AssociationParameters.h:97
User Identity, cf. PS3.8 D.3.3.7.
Definition: AssociationParameters.h:75
std::vector< std::string > transfer_syntaxes
Proposed transfer syntaxes or accepted transfer syntax.
Definition: AssociationParameters.h:59