9 #ifndef _a52696bc_5c6e_402d_a343_6cb085eb0138 10 #define _a52696bc_5c6e_402d_a343_6cb085eb0138 18 #include "odil/AssociationAcceptor.h" 19 #include "odil/AssociationParameters.h" 20 #include "odil/dul/StateMachine.h" 21 #include "odil/message/Message.h" 44 ULServiceProviderACSERelatedFunction=2,
45 ULServiceProvderPresentationRelatedFunction=3,
56 ApplicationContextNameNotSupported=2,
57 CallingAETitleNotRecognized=3,
58 CallingAPInvocationIdentifierNotRecognized=4,
59 CallingAEQualifierNotRecognized=5,
60 CallingAEInvocationIdentifierNotRecognized=6,
61 CalledAETitleNotRecognized=7,
62 CalledAPInvocationIdentifierNotRecognized=8,
63 CalledAEQualifierNotRecognized=9,
64 CalledAEInvocationIdentifierNotRecognized=10,
70 TemporaryCongestion=1,
72 CalledPresentationAddressUnknown=3,
73 PresentationProtocolVersionNotSupported=4,
74 NoPresentationServiceAccessPointAvailable=7,
150 boost::asio::ip::tcp
const & protocol,
unsigned short port,
151 AssociationAcceptor acceptor=default_association_acceptor);
159 void abort(
int source,
int reason);
176 message::Message
const & message, std::string
const & abstract_syntax);
184 dul::StateMachine _state_machine;
186 std::string _peer_host;
192 std::map<std::string, std::pair<uint8_t, std::string>>
193 _transfer_syntaxes_by_abstract_syntax;
194 std::map<uint8_t, std::string> _transfer_syntaxes_by_id;
196 uint16_t _next_message_id;
228 :
Exception(
"Association aborted"), source(source), reason(reason)
236 #endif // _a52696bc_5c6e_402d_a343_6cb085eb0138 void set_tcp_timeout(duration_type const &duration)
Set the timeout.
Definition: Association.cpp:175
message::Message receive_message()
Receive a generic DIMSE message.
Definition: Association.cpp:356
void set_peer_port(uint16_t port)
Set the port of the peer.
Definition: Association.cpp:118
void associate()
Request an association with the peer.
Definition: Association.cpp:203
Association & operator=(Association const &other)
Assing an un-associated association; it remains un-associated.
Definition: Association.cpp:78
uint16_t get_peer_port() const
Return the port of the peer. Defaults to 104.
Definition: Association.cpp:111
Exception reported when receiving a message after the association was released.
Definition: Association.h:203
dul::Transport & get_transport()
Return the TCP transport.
Definition: Association.cpp:71
void set_peer_host(std::string const &host)
Set the host name of the peer.
Definition: Association.cpp:99
Base class for odil exceptions.
Definition: Exception.h:19
~Association()
Destroy the association, release it if necessary.
Definition: Association.cpp:64
Definition: Association.cpp:39
duration_type get_message_timeout() const
Return the DIMSE timeout, default to 30s.
Definition: Association.cpp:182
void abort(int source, int reason)
Forcefully release the association. Throws an exception if not associated.
Definition: Association.cpp:341
AssociationParameters const & get_negotiated_parameters() const
Return the negotiated association parameters.
Definition: Association.cpp:161
ResultSource
Source of association result (PS 3.8, 7.1.1.8 and PS 3.8, 9.3.4).
Definition: Association.h:41
uint16_t next_message_id()
Return the next available message id.
Definition: Association.cpp:529
Encapsulate association parameters.
Definition: AssociationParameters.h:23
Result
Association result (ITU-T X.227, PS 3.8, 7.1.1.7 and PS 3.8, 9.3.4).
Definition: Association.h:33
AssociationParameters & update_parameters()
Return the association parameters.
Definition: Association.cpp:137
Exception reported when receiving a message after the association was aborted.
Definition: Association.h:217
bool is_associated() const
Test whether the object is currently associated to its peer.
Definition: Association.cpp:196
void release()
Gracefully release the association. Throws an exception if not associated.
Definition: Association.cpp:319
duration_type get_tcp_timeout() const
Return the TCP timeout, default to infinity.
Definition: Association.cpp:168
Diagnostic
Diagnostic of association result.
Definition: Association.h:52
dul::StateMachine::duration_type duration_type
Duration of the timeout.
Definition: Association.h:78
AssociationAborted(unsigned char source, unsigned char reason)
Constructor.
Definition: Association.h:227
uint8_t reason
Reason of the error.
Definition: Association.h:224
AssociationParameters const & get_parameters() const
Return the association parameters.
Definition: Association.cpp:130
Association.
Definition: Association.h:29
Association()
Create a default, un-associated, association.
Definition: Association.cpp:43
uint8_t source
Source of the error.
Definition: Association.h:221
std::string const & get_peer_host() const
Return the host name of the peer. Defaults to "".
Definition: Association.cpp:92
void set_message_timeout(duration_type const &duration)
Set the DIMSE timeout.
Definition: Association.cpp:189
void reject(Result result, ResultSource result_source, Diagnostic diagnostic)
Reject the received association request.
void set_parameters(AssociationParameters const &value)
Set the association parameters, throw an exception when associated.
Definition: Association.cpp:149
void receive_association(boost::asio::ip::tcp const &protocol, unsigned short port, AssociationAcceptor acceptor=default_association_acceptor)
Receive an association from a peer.
Definition: Association.cpp:264
void send_message(message::Message const &message, std::string const &abstract_syntax)
Send a DIMSE message.
Definition: Association.cpp:446