GDCM
2.2.3
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef GDCMULCONNECTION_H 00019 #define GDCMULCONNECTION_H 00020 00021 #include "gdcmNetworkStateID.h" 00022 #include "gdcmARTIMTimer.h" 00023 #include "gdcmULConnectionInfo.h" 00024 #include "gdcmPresentationContextRQ.h" 00025 #include "gdcmDataElement.h" 00026 #include "gdcmPresentationContextAC.h" 00027 #include "gdcmPresentationContext.h" 00028 00029 class iosockinet; 00030 class echo; 00031 namespace gdcm{ 00032 namespace network{ 00033 00057 class ULConnection 00058 { 00059 ULConnectionInfo mInfo; 00060 //this is a dirty dirty hack 00061 //but to establish an outgoing connection (scu), we need the echo service 00062 //to establish incoming, we just need a port and localhost, so an iosockinet works while an 00063 //echo would fail (probably because one already exists) 00064 echo* mEcho; 00065 iosockinet* mSocket;//of the three protocols offered by socket++-- echo, smtp, and ftp-- 00066 //echo most closely matches what the DICOM standard describes as a network connection 00067 ARTIMTimer mTimer; 00068 00069 ULConnection(ULConnection& inConnection); //no copy construction allowed 00070 00071 EStateID mCurrentState; 00072 00073 std::vector<PresentationContextRQ> mPresentationContexts; 00074 //this is our list of presentation contexts of what we can send 00075 uint32_t mMaxPDUSize; 00076 00077 std::vector<PresentationContextAC> mAcceptedPresentationContexts;//these come back from the server 00078 //and tell us what can be sent over this connection 00079 00080 public: 00081 00082 ULConnection(const ULConnectionInfo& inUserInformation); 00083 //destructors are virtual to prevent memory leaks by inherited classes 00084 virtual ~ULConnection(); 00085 00086 EStateID GetState() const; 00087 void SetState(const EStateID& inState);//must be able to update state... 00088 00089 //echo* GetProtocol(); 00090 std::iostream* GetProtocol(); 00091 void StopProtocol(); 00092 00093 ARTIMTimer& GetTimer(); 00094 00095 const ULConnectionInfo &GetConnectionInfo() const; 00096 00097 //when the connection is first associated, the connection is told 00098 //the max packet/PDU size and the way in which to present data 00099 //(presentation contexts, etc). Store that here. 00100 void SetMaxPDUSize(uint32_t inSize); 00101 uint32_t GetMaxPDUSize() const; 00102 00103 const PresentationContextAC *GetPresentationContextACByID(uint8_t id) const; 00104 const PresentationContextRQ *GetPresentationContextRQByID(uint8_t id) const; 00105 00107 uint8_t GetPresentationContextIDFromPresentationContext(PresentationContextRQ const & pc) const; 00108 00109 std::vector<PresentationContextRQ> const & GetPresentationContexts() const; 00110 void SetPresentationContexts(const std::vector<PresentationContextRQ>& inContexts); 00111 00112 void SetPresentationContexts(const std::vector<PresentationContext>& inContexts); 00113 00114 //given a particular data element, presumably the SOP class, 00115 //find the presentation context for that SOP 00116 //NOT YET IMPLEMENTED 00117 PresentationContextRQ FindContext(const DataElement& de) const; 00118 00119 std::vector<PresentationContextAC> const & GetAcceptedPresentationContexts() const; 00120 std::vector<PresentationContextAC> & GetAcceptedPresentationContexts(); 00121 void AddAcceptedPresentationContext(const PresentationContextAC& inPC); 00122 00124 bool InitializeConnection(); 00125 00127 bool InitializeIncomingConnection(); 00128 private: 00129 ULConnection(const ULConnection&); // Not implemented. 00130 void operator=(const ULConnection&); // Not implemented. 00131 00132 }; 00133 } 00134 } 00135 00136 #endif // ULCONNECTION_H