|
xrootd
|
00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN) 00003 // Author: Lukasz Janyst <ljanyst@cern.ch> 00004 //------------------------------------------------------------------------------ 00005 // XRootD is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU Lesser General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // XRootD is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00017 //------------------------------------------------------------------------------ 00018 00019 #ifndef __XRD_CL_IN_QUEUE_HH__ 00020 #define __XRD_CL_IN_QUEUE_HH__ 00021 00022 #include <XrdSys/XrdSysPthread.hh> 00023 #include <list> 00024 #include <utility> 00025 #include "XrdCl/XrdClStatus.hh" 00026 #include "XrdCl/XrdClPostMasterInterfaces.hh" 00027 00028 namespace XrdCl 00029 { 00030 class Message; 00031 00032 //---------------------------------------------------------------------------- 00034 //---------------------------------------------------------------------------- 00035 class InQueue 00036 { 00037 public: 00038 //------------------------------------------------------------------------ 00040 //------------------------------------------------------------------------ 00041 bool AddMessage( Message *msg ); 00042 00043 //------------------------------------------------------------------------ 00048 //------------------------------------------------------------------------ 00049 void AddMessageHandler( IncomingMsgHandler *handler, time_t expires ); 00050 00051 //------------------------------------------------------------------------ 00060 //------------------------------------------------------------------------ 00061 IncomingMsgHandler *GetHandlerForMessage( Message *msg, 00062 time_t &expires, 00063 uint16_t &action ); 00064 00065 //------------------------------------------------------------------------ 00067 //------------------------------------------------------------------------ 00068 void ReAddMessageHandler( IncomingMsgHandler *handler, time_t expires ); 00069 00070 //------------------------------------------------------------------------ 00072 //------------------------------------------------------------------------ 00073 void RemoveMessageHandler( IncomingMsgHandler *handler ); 00074 00075 //------------------------------------------------------------------------ 00077 //------------------------------------------------------------------------ 00078 void ReportStreamEvent( IncomingMsgHandler::StreamEvent event, 00079 uint16_t streamNum, 00080 Status status ); 00081 00082 //------------------------------------------------------------------------ 00084 //------------------------------------------------------------------------ 00085 void ReportTimeout( time_t now = 0 ); 00086 00087 private: 00088 typedef std::pair<IncomingMsgHandler *, time_t> HandlerAndExpire; 00089 typedef std::list<HandlerAndExpire> HandlerList; 00090 std::list<Message *> pMessages; 00091 HandlerList pHandlers; 00092 XrdSysMutex pMutex; 00093 }; 00094 } 00095 00096 #endif // __XRD_CL_IN_QUEUE_HH__
1.7.6.1