![]() |
|
|||
File indexing completed on 2025-09-17 09:19:45
0001 //------------------------------------------------------------------------------ 0002 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN) 0003 // Author: Lukasz Janyst <ljanyst@cern.ch> 0004 //------------------------------------------------------------------------------ 0005 // XRootD is free software: you can redistribute it and/or modify 0006 // it under the terms of the GNU Lesser General Public License as published by 0007 // the Free Software Foundation, either version 3 of the License, or 0008 // (at your option) any later version. 0009 // 0010 // XRootD is distributed in the hope that it will be useful, 0011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 // GNU General Public License for more details. 0014 // 0015 // You should have received a copy of the GNU Lesser General Public License 0016 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 0017 //------------------------------------------------------------------------------ 0018 0019 #ifndef __XRD_CL_MESSAGE_HH__ 0020 #define __XRD_CL_MESSAGE_HH__ 0021 0022 #include "XrdCl/XrdClBuffer.hh" 0023 #include "XrdOuc/XrdOucUtils.hh" 0024 #include "XrdOuc/XrdOucPrivateUtils.hh" 0025 0026 namespace XrdCl 0027 { 0028 //---------------------------------------------------------------------------- 0029 //! The message representation used throughout the system 0030 //---------------------------------------------------------------------------- 0031 class Message: public Buffer 0032 { 0033 public: 0034 //------------------------------------------------------------------------ 0035 //! Constructor 0036 //------------------------------------------------------------------------ 0037 Message( uint32_t size = 0 ): 0038 Buffer( size ), pIsMarshalled( false ), pSessionId(0), pVirtReqID( 0 ) 0039 { 0040 if( size ) 0041 Zero(); 0042 } 0043 0044 //------------------------------------------------------------------------ 0045 //! Move Constructor 0046 //------------------------------------------------------------------------ 0047 Message( Message && msg ): 0048 Buffer( std::move( msg ) ), pIsMarshalled( msg.pIsMarshalled ), 0049 pSessionId( std::move( msg.pSessionId ) ), pVirtReqID( msg.pVirtReqID ) 0050 { 0051 } 0052 0053 //------------------------------------------------------------------------ 0054 //! Move assignment operator 0055 //------------------------------------------------------------------------ 0056 Message& operator=( Message && msg ) 0057 { 0058 Steal( std::move( msg ) ); 0059 pIsMarshalled = msg.pIsMarshalled; 0060 pSessionId = std::move( msg.pSessionId ); 0061 pVirtReqID = msg.pVirtReqID; 0062 return *this; 0063 } 0064 0065 //------------------------------------------------------------------------ 0066 //! Destructor 0067 //------------------------------------------------------------------------ 0068 virtual ~Message() {} 0069 0070 //------------------------------------------------------------------------ 0071 //! Check if the message is marshalled 0072 //------------------------------------------------------------------------ 0073 bool IsMarshalled() const 0074 { 0075 return pIsMarshalled; 0076 } 0077 0078 //------------------------------------------------------------------------ 0079 //! Set the marshalling status 0080 //------------------------------------------------------------------------ 0081 void SetIsMarshalled( bool isMarshalled ) 0082 { 0083 pIsMarshalled = isMarshalled; 0084 } 0085 0086 //------------------------------------------------------------------------ 0087 //! Set the description of the message 0088 //------------------------------------------------------------------------ 0089 void SetDescription( const std::string &description ) 0090 { 0091 pDescription = description; 0092 pObfuscatedDescription = obfuscateAuth(description); 0093 } 0094 0095 //------------------------------------------------------------------------ 0096 //! Get the description of the message 0097 //------------------------------------------------------------------------ 0098 const std::string &GetDescription() const 0099 { 0100 return pDescription; 0101 } 0102 0103 //------------------------------------------------------------------------ 0104 //! Get the description of the message with authz parameter obfuscated 0105 //------------------------------------------------------------------------ 0106 const std::string & GetObfuscatedDescription() const 0107 { 0108 return pObfuscatedDescription; 0109 } 0110 0111 //------------------------------------------------------------------------ 0112 //! Set the session ID which this message is meant for 0113 //------------------------------------------------------------------------ 0114 void SetSessionId( uint64_t sessionId ) 0115 { 0116 pSessionId = sessionId; 0117 } 0118 0119 //------------------------------------------------------------------------ 0120 //! Get the session ID the message is meant for 0121 //------------------------------------------------------------------------ 0122 uint64_t GetSessionId() const 0123 { 0124 return pSessionId; 0125 } 0126 0127 //------------------------------------------------------------------------ 0128 //! Set virtual request ID for the message 0129 //------------------------------------------------------------------------ 0130 void SetVirtReqID( uint16_t virtReqID ) 0131 { 0132 pVirtReqID = virtReqID; 0133 } 0134 0135 //------------------------------------------------------------------------ 0136 //! Get virtual request ID for the message 0137 //------------------------------------------------------------------------ 0138 uint16_t GetVirtReqID() const 0139 { 0140 return pVirtReqID; 0141 } 0142 0143 private: 0144 bool pIsMarshalled; 0145 uint64_t pSessionId; 0146 std::string pDescription; 0147 uint16_t pVirtReqID; 0148 std::string pObfuscatedDescription; 0149 }; 0150 } 0151 0152 #endif // __XRD_CL_MESSAGE_HH__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |