GDCM
2.2.3
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 #ifndef GDCMAASSOCIATERQPDU_H 00015 #define GDCMAASSOCIATERQPDU_H 00016 00017 #include "gdcmTypes.h" 00018 #include "gdcmVR.h" // AEComp 00019 #include "gdcmApplicationContext.h" 00020 #include "gdcmPresentationContextRQ.h" 00021 #include "gdcmUserInformation.h" 00022 #include "gdcmBasePDU.h" 00023 00024 namespace gdcm 00025 { 00026 00027 namespace network 00028 { 00029 00030 class AAssociateACPDU; 00035 class AAssociateRQPDU : public BasePDU 00036 { 00037 public: 00038 AAssociateRQPDU(); 00039 std::istream &Read(std::istream &is); 00040 const std::ostream &Write(std::ostream &os) const; 00041 size_t Size() const; 00042 void AddPresentationContext( PresentationContextRQ const &pc ); 00043 00045 void SetCalledAETitle(const char calledaetitle[16]); 00046 std::string GetCalledAETitle() const { return std::string(CalledAETitle,16); } 00047 00049 void SetCallingAETitle(const char callingaetitle[16]); 00050 std::string GetCallingAETitle() const { return std::string(CallingAETitle,16); } 00051 00053 static bool IsAETitleValid(const char title[16]); 00054 00057 //void InitFromRQ( AAssociateACPDU & acpdu ); 00058 00059 void Print(std::ostream &os) const; 00060 00061 AAssociateRQPDU(const AAssociateRQPDU &pdu):BasePDU(pdu) 00062 { 00063 assert( 0 ); 00064 } 00065 //this function fails to compile on windows. 00066 // AAssociateRQPDU &operator=(const AAssociateRQPDU &_val) 00067 // { 00068 // assert( 0 ); 00069 // } 00070 00071 typedef std::vector<PresentationContextRQ>::size_type SizeType; 00072 SizeType GetNumberOfPresentationContext() const { 00073 return PresContext.size(); 00074 } 00075 PresentationContextRQ const &GetPresentationContext(SizeType i) const { 00076 assert( !PresContext.empty() && i < PresContext.size() ); 00077 return PresContext[i]; 00078 } 00079 typedef std::vector<PresentationContextRQ> PresentationContextArrayType; 00080 PresentationContextArrayType const &GetPresentationContexts() { return PresContext; } 00081 00082 const PresentationContextRQ *GetPresentationContextByID(uint8_t i) const; 00083 const PresentationContextRQ *GetPresentationContextByAbstractSyntax(AbstractSyntax const & as ) const; 00084 bool IsLastFragment() const { return true; } 00085 00086 protected: 00087 friend class AAssociateACPDU; 00088 std::string GetReserved43_74() const; 00089 00090 private: 00091 // 1 PDU-type 01H 00092 static const uint8_t ItemType; // PDUType ? 00093 // 2 Reserved This reserved field shall be sent with a value 00H but not tested to this value when received. 00094 static const uint8_t Reserved2; 00095 /* 3-6 PDU-length This PDU-length shall be the number of bytes from the first byte of the 00096 following field to the last byte of the variable field. It shall be encoded as 00097 an unsigned binary number 00098 */ 00099 uint32_t ItemLength; // PDU Length 00100 /* 00101 7-8 Protocol-version This two byte field shall use one bit to identify each version of the 00102 DICOM UL protocol supported by the calling end-system. This is 00103 Version 1 and shall be identified with bit 0 set. A receiver of this PDU 00104 implementing only this version of the DICOM UL protocol shall only test 00105 that bit 0 is set. 00106 */ 00107 static const uint16_t ProtocolVersion; 00108 /* 00109 9-10 Reserved This reserved field shall be sent with a value 0000H but not tested to 00110 this value when received. 00111 */ 00112 static const uint16_t Reserved9_10; 00113 /* 00114 11-26 Called-AE-title Destination DICOM Application Name. It shall be encoded as 16 00115 characters as defined by the ISO 646:1990-Basic G0 Set with leading 00116 and trailing spaces (20H) being non-significant. The value made of 16 00117 spaces (20H) meaning "no Application Name specified" shall not be 00118 used. For a complete description of the use of this field, see Section 00119 7.1.1.4. 00120 */ 00121 char CalledAETitle[16]; 00122 /* 00123 27-42 Calling-AE-title Source DICOM Application Name. It shall be encoded as 16 00124 characters as defined by the ISO 646:1990-Basic G0 Set with leading 00125 and trailing spaces (20H) being non-significant. The value made of 16 00126 spaces (20H) meaning "no Application Name specified" shall not be 00127 used. For a complete description of the use of this field, see Section 00128 7.1.1.3. 00129 */ 00130 char CallingAETitle[16]; 00131 /* 00132 43-74 Reserved This reserved field shall be sent with a value 00H for all bytes but not 00133 tested to this value when received 00134 */ 00135 char Reserved43_74[32]; // { 0 } 00136 /* 00137 75-xxx Variable items This variable field shall contain the following items: one Application 00138 Context Item, one or more Presentation Context Items and one User 00139 Information Item. For a complete description of the use of these items 00140 see Sections 7.1.1.2, 7.1.1.13, and 7.1.1.6. 00141 */ 00142 ApplicationContext AppContext; 00143 std::vector<PresentationContextRQ> PresContext; 00144 UserInformation UserInfo; 00145 }; 00146 00147 } // end namespace network 00148 } // end namespace gdcm 00149 00150 #endif //GDCMAASSOCIATERQPDU_H