00001 00010 #include "ResponseFlags.h" 00011 #include "components.h" 00012 #include "ToolkitUtils.h" 00013 #include "Buffer.h" 00014 #include "SCVPException.h" 00015 #include "ASN1Helper.h" 00016 #include "SCVP.h" 00017 00019 00020 struct CPKIFResponseFlagsImpl 00021 { 00022 bool m_fullRequestInResponse; 00023 bool m_responseValidationPolByRef; 00024 bool m_protectResponse; 00025 bool m_cachedResponse; 00026 }; 00027 00029 00038 CPKIFResponseFlags::CPKIFResponseFlags() :m_impl(new CPKIFResponseFlagsImpl) 00039 { 00040 LOG_STRING_DEBUG("CPKIFResponseFlags::CPKIFResponseFlags()", TOOLKIT_SCVP_ASN, 0, this); 00041 00042 m_impl->m_fullRequestInResponse = false; 00043 m_impl->m_responseValidationPolByRef = true; 00044 m_impl->m_protectResponse = true; 00045 m_impl->m_cachedResponse = true; 00046 00047 } 00048 00059 CPKIFResponseFlags::CPKIFResponseFlags( 00061 const CPKIFBufferPtr& responseFlags) 00062 :m_impl (new CPKIFResponseFlagsImpl) 00063 { 00064 if(responseFlags == (CPKIFBuffer*)NULL || 0 == responseFlags->GetLength()) 00065 { 00066 throw CPKIFSCVPException(TOOLKIT_SCVP_ASN, COMMON_INVALID_INPUT); 00067 } 00068 00069 CACASNWRAPPER_CREATE(ResponseFlags, objPDU); 00070 objPDU.Decode(responseFlags->GetBuffer(), responseFlags->GetLength()); 00071 00072 m_impl->m_fullRequestInResponse = objPDU->fullRequestInResponse; 00073 m_impl->m_responseValidationPolByRef = objPDU->responseValidationPolByRef; 00074 m_impl->m_protectResponse = objPDU->protectResponse; 00075 m_impl->m_cachedResponse = objPDU->cachedResponse; 00076 00077 } 00078 00086 CPKIFResponseFlags::~CPKIFResponseFlags() 00087 { 00088 LOG_STRING_DEBUG("CPKIFResponseFlags::~CPKIFResponseFlags()", TOOLKIT_SCVP_ASN, 0, this); 00089 00090 if (m_impl) { 00091 delete m_impl; 00092 } 00093 } 00101 void CPKIFResponseFlags::SetFullRequestInResponse( 00103 bool fullRequestInResponse) 00104 { 00105 m_impl->m_fullRequestInResponse = fullRequestInResponse; 00106 } 00114 const bool CPKIFResponseFlags::GetFullRequestInResponse() const 00115 { 00116 return m_impl->m_fullRequestInResponse; 00117 } 00118 00126 void CPKIFResponseFlags::SetResponseValidationPolByRef( 00128 bool responseValidationPolByRef) 00129 { 00130 m_impl->m_responseValidationPolByRef = responseValidationPolByRef; 00131 } 00139 const bool CPKIFResponseFlags::GetResponseValidationPolByRef() const 00140 { 00141 return m_impl->m_responseValidationPolByRef; 00142 } 00143 00151 void CPKIFResponseFlags::SetProtectResponse( 00153 bool protectResponse) 00154 { 00155 m_impl->m_protectResponse = protectResponse; 00156 } 00164 const bool CPKIFResponseFlags::GetProtectResponse() const 00165 { 00166 return m_impl->m_protectResponse; 00167 } 00168 00176 void CPKIFResponseFlags::SetcachedResponse( 00178 bool cachedResponse) 00179 { 00180 m_impl->m_cachedResponse = cachedResponse; 00181 } 00189 const bool CPKIFResponseFlags::GetCachedResponse() const 00190 { 00191 return m_impl->m_cachedResponse; 00192 } 00200 bool CPKIFResponseFlags::DefaultsSet() 00201 { 00202 if(m_impl->m_fullRequestInResponse == false && m_impl->m_responseValidationPolByRef == true 00203 && m_impl->m_protectResponse == true && m_impl->m_cachedResponse == true) 00204 { 00205 return true; 00206 } 00207 00208 return false; 00209 }