dcmtkpp
Association.h
1 /*************************************************************************
2  * dcmtkpp - 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 _a52696bc_5c6e_402d_a343_6cb085eb0138
10 #define _a52696bc_5c6e_402d_a343_6cb085eb0138
11 
12 #include <string>
13 #include <utility>
14 #include <vector>
15 
16 #include <dcmtk/config/osconfig.h>
17 #include <dcmtk/dcmnet/assoc.h>
18 
19 #include "dcmtkpp/Network.h"
20 
21 namespace dcmtkpp
22 {
23 
25 enum class UserIdentityType
26 {
27  None = 0,
28  Username = 1,
29  UsernameAndPassword = 2,
30  Kerberos = 3,
31  SAML = 4
32 };
33 
40 {
41 public:
43  Association();
44 
46  Association(Association const & other);
47 
49  ~Association();
50 
52  Association & operator=(Association const & other);
53 
55  std::string const & get_own_ae_title() const;
57  void set_own_ae_title(std::string const & ae_title);
58 
61 
63  std::string const & get_peer_host_name() const;
65  void set_peer_host_name(std::string const & host_name);
66 
68  uint16_t get_peer_port() const;
70  void set_peer_port(uint16_t port);
71 
73  std::string const & get_peer_ae_title() const;
75  void set_peer_ae_title(std::string const & ae_title);
76 
78 
81 
82  void add_presentation_context(std::string const & abstract_syntax,
83  std::vector<std::string> const & transfer_syntaxes,
84  T_ASC_SC_ROLE role=ASC_SC_ROLE_DEFAULT);
85 
87 
90 
92  UserIdentityType get_user_identity_type() const;
94  void set_user_identity_type(UserIdentityType type);
95 
97  std::string const & get_user_identity_primary_field() const;
99  void set_user_identity_primary_field(std::string const & value);
100 
102  std::string const & get_user_identity_secondary_field() const;
104  void set_user_identity_secondary_field(std::string const & value);
105 
107  void set_user_identity_to_none();
108 
110  void set_user_identity_to_username(std::string const & username);
111 
113  void set_user_identity_to_username_and_password(
114  std::string const & username, std::string const & password);
115 
117  void set_user_identity_to_kerberos(std::string const & ticket);
118 
120  void set_user_identity_to_saml(std::string const & assertion);
121 
123 
126 
128  bool is_associated() const;
129 
136  void associate(Network & network);
137 
144  void receive(Network & network, bool accept_all=false);
145 
147  T_ASC_Association * get_association();
148 
150  void release();
152  void abort();
153 
155  void drop();
156 
158 
159 private:
160  std::string _own_ae_title;
161 
162  std::string _peer_host_name;
163  uint16_t _peer_port;
164  std::string _peer_ae_title;
165 
166  struct PresentationContext
167  {
168  std::string abstract_syntax;
169  std::vector<std::string> transfer_syntaxes;
170  T_ASC_SC_ROLE role;
171  };
172 
173  std::vector<PresentationContext> _presentation_contexts;
174 
175  UserIdentityType _user_identity_type;
176  std::string _user_identity_primary_field;
177  std::string _user_identity_secondary_field;
178 
179  T_ASC_Association * _association;
180 };
181 
182 }
183 
184 #endif // _a52696bc_5c6e_402d_a343_6cb085eb0138
Wrapper around the T_ASC_Network class.
Definition: Network.h:23
Definition: Association.cpp:22
Wrapper around the T_ASC_Association class.
Definition: Association.h:39