00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Base Library 00005 * Module : CCTPRequest 00006 * Package : Zeus.ZeusBase.Net.Protocols 00007 * Author : Benjamin Hadorn 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 #ifndef CCTPRequestH 00033 #define CCTPRequestH 00034 00035 #include <zeusbase/System/Interfaces/IZUnknown.hpp> 00036 #include <zeusbase/Net/Protocols/CCTPDefines.hpp> 00037 #include <zeusbase/System/ZObject.h> 00038 #include <zeusbase/System/String.h> 00039 #include <zeusbase/System/ByteArray.hpp> 00040 #include <zeusbase/System/Queue.hpp> 00041 00042 BEGIN_NAMESPACE_Zeus 00043 00044 #define DISPATCH_Method 0 00045 #define DISPATCH_Message 1 00046 00047 /***************************************************************************/ 00050 /***************************************************************************/ 00051 zeusbase_class TCCTPRequest : public TZObject 00052 { 00053 public: 00054 TCCTPRequest(); 00055 virtual ~TCCTPRequest(); 00056 00057 const TByteArray& getData() const; 00058 Uint getMethod() const; 00059 Uint getDispatchType() const; 00060 00061 void setData(const TByteArray& rData); 00062 void setMethod(Uint uiMethod); 00063 void setDispatchType(Uint uiDispType); 00064 00065 Retval parse(const TByteArray& rIn); 00066 Retval toStream(TByteArray& rArray) const; 00067 00068 private: 00070 Uint m_uiVersion; 00072 Uint m_uiMethod; 00074 Uint m_uiDispType; 00076 TByteArray m_aData; 00077 }; 00078 00079 //INLINE METHODS 00080 /***************************************************************************/ 00083 /***************************************************************************/ 00084 inline const TByteArray& TCCTPRequest::getData() const 00085 { return m_aData; } 00086 00087 /***************************************************************************/ 00090 /***************************************************************************/ 00091 inline Uint TCCTPRequest::getMethod() const 00092 { return m_uiMethod; } 00093 00094 /***************************************************************************/ 00098 /***************************************************************************/ 00099 inline Uint TCCTPRequest::getDispatchType() const 00100 { 00101 return m_uiDispType; 00102 } 00103 00104 00105 /***************************************************************************/ 00108 /***************************************************************************/ 00109 inline void TCCTPRequest::setData(const TByteArray& data) 00110 { 00111 m_aData.setArray(data.getArray(), data.getCount()); 00112 } 00113 00114 /***************************************************************************/ 00117 /***************************************************************************/ 00118 inline void TCCTPRequest::setMethod(Uint uiMethod) 00119 { 00120 m_uiMethod = uiMethod; 00121 } 00122 00123 /***************************************************************************/ 00127 /***************************************************************************/ 00128 inline void TCCTPRequest::setDispatchType(Uint uiDispType) 00129 { 00130 m_uiDispType = uiDispType; 00131 } 00132 00133 00134 00135 END_NAMESPACE_Zeus 00136 00137 #endif