XrdClientUnsolMsg.hh

Go to the documentation of this file.
00001 #ifndef XRC_UNSOLMSG_H
00002 #define XRC_UNSOLMSG_H
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                X r d C l i e n t U n s o l M s g . h h                     */
00006 /*                                                                            */
00007 /* Author: Fabrizio Furano (INFN Padova, 2004)                                */
00008 /* Adapted from TXNetFile (root.cern.ch) originally done by                   */
00009 /*  Alvise Dorigo, Fabrizio Furano                                            */
00010 /*          INFN Padova, 2003                                                 */
00011 /*                                                                            */
00012 /* This file is part of the XRootD software suite.                            */
00013 /*                                                                            */
00014 /* XRootD is free software: you can redistribute it and/or modify it under    */
00015 /* the terms of the GNU Lesser General Public License as published by the     */
00016 /* Free Software Foundation, either version 3 of the License, or (at your     */
00017 /* option) any later version.                                                 */
00018 /*                                                                            */
00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00022 /* License for more details.                                                  */
00023 /*                                                                            */
00024 /* You should have received a copy of the GNU Lesser General Public License   */
00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00027 /*                                                                            */
00028 /* The copyright holder's institutional names and contributor's names may not */
00029 /* be used to endorse or promote products derived from this software without  */
00030 /* specific prior written permission of the institution or contributor.       */
00031 /******************************************************************************/
00032 
00034 //                                                                      //
00035 // Base classes for unsolicited msg senders/receivers                   //
00036 //                                                                      //
00038 
00039 class XrdClientMessage;
00040 class XrdClientUnsolMsgSender;
00041 
00042 // The processing result for an unsolicited response
00043 enum UnsolRespProcResult {
00044    kUNSOL_CONTINUE = 0, // Dispatching must continue to other interested handlers
00045    kUNSOL_KEEP,         // Dispatching ended, but stream still alive (must keep the SID)
00046    kUNSOL_DISPOSE       // Dispatching ended, stream no more to be used
00047 };
00048 
00049 // Handler
00050 
00051 class XrdClientAbsUnsolMsgHandler {
00052  public:
00053   
00054    virtual ~XrdClientAbsUnsolMsgHandler() { }
00055    // To be called when an unsolicited response arrives from the lower layers
00056    virtual UnsolRespProcResult ProcessUnsolicitedMsg(XrdClientUnsolMsgSender *sender, 
00057                                       XrdClientMessage *unsolmsg) = 0;
00058 
00059 };
00060 
00061 // Sender
00062 
00063 class XrdClientUnsolMsgSender {
00064 
00065  public:
00066 
00067    virtual ~XrdClientUnsolMsgSender() { }
00068 
00069    // The upper level handler for unsolicited responses
00070    XrdClientAbsUnsolMsgHandler *UnsolicitedMsgHandler;
00071 
00072    inline UnsolRespProcResult SendUnsolicitedMsg(XrdClientUnsolMsgSender *sender, XrdClientMessage *unsolmsg) {
00073       // We simply send the event
00074       if (UnsolicitedMsgHandler)
00075          return (UnsolicitedMsgHandler->ProcessUnsolicitedMsg(sender, unsolmsg));
00076 
00077       return kUNSOL_CONTINUE;
00078    }
00079 
00080    inline XrdClientUnsolMsgSender() { UnsolicitedMsgHandler = 0; }
00081 };
00082 #endif

Generated on 5 Oct 2016 for xrootd by  doxygen 1.4.7