|
||||
File indexing completed on 2025-01-30 10:27:52
0001 #ifndef __XRDTCPMONPIN_H__ 0002 #define __XRDTCPMONPIN_H__ 0003 /******************************************************************************/ 0004 /* */ 0005 /* X r d T c p M o n P i n . h h */ 0006 /* */ 0007 /* (c) 2020 by the Board of Trustees of the Leland Stanford, Jr., University */ 0008 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 0009 /* DE-AC02-76-SFO0515 with the Department of Energy */ 0010 /* */ 0011 /* This file is part of the XRootD software suite. */ 0012 /* */ 0013 /* XRootD is free software: you can redistribute it and/or modify it under */ 0014 /* the terms of the GNU Lesser General Public License as published by the */ 0015 /* Free Software Foundation, either version 3 of the License, or (at your */ 0016 /* option) any later version. */ 0017 /* */ 0018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 0019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 0020 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 0021 /* License for more details. */ 0022 /* */ 0023 /* You should have received a copy of the GNU Lesser General Public License */ 0024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 0025 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 0026 /* */ 0027 /* The copyright holder's institutional names and contributor's names may not */ 0028 /* be used to endorse or promote products derived from this software without */ 0029 /* specific prior written permission of the institution or contributor. */ 0030 /******************************************************************************/ 0031 0032 /*! This class defines the XrdLink TCP post monitoring plugin. This plugin is 0033 used to generate additional moinitoring information, as needed, when the 0034 connection is about to be closed. The plugin should use the g-stream object 0035 recorded in the passed environment. If not found, the getInstance() method 0036 should return failure as this plugin should not be loaded unless such an 0037 object exists in the environment. You get the g-stream object specific 0038 to this plugin by executing the following (assume envR is the environment): 0039 0040 @code {.cpp} 0041 XrdXrootdGStream *gS = (XrdXrootdGStream *)envR.GetPtr("TcpMon.gStream*"); 0042 @endcode 0043 */ 0044 0045 class XrdNetAddrInfo; 0046 0047 class XrdTcpMonPin 0048 { 0049 public: 0050 0051 //------------------------------------------------------------------------------ 0052 //! Produce monitoring information upon connection termination. 0053 //! 0054 //! @param netInfo Reference to the network object associated with link. 0055 //! @param lnkInfo Reference to link-specific information. 0056 //! @param liLen Byte length of lnkInfo being passed. 0057 //------------------------------------------------------------------------------ 0058 0059 struct LinkInfo 0060 {const char *tident; //!< Pointer to the client's trace identifier 0061 int fd; //!< Socket file descriptor 0062 int consec; //!< Seconds connected 0063 long long bytesIn; //!< Bytes read from the socket 0064 long long bytesOut; //!< Bytes written to the socket 0065 }; 0066 0067 virtual void Monitor(XrdNetAddrInfo &netInfo, LinkInfo &lnkInfo, int liLen) = 0; 0068 0069 XrdTcpMonPin() {} 0070 virtual ~XrdTcpMonPin() {} 0071 }; 0072 0073 /*! An instance of the plugin is obtained by the plugin manager using the 0074 XrdOucPinObject class. The most straightforward way to implement this 0075 is to inherit the XrdOucPinObject class by a class of your choosing 0076 that defines a file level object named TcpMonPin, as follows: 0077 0078 class myPinObject : public XrdOucPinObject<XrdTcpMonPin> 0079 {public: 0080 0081 XrdTcpMonPin *getInstance(...) {provide concrete implementation} 0082 0083 } TcpMonPin; 0084 0085 see XrdOucPinObject.hh for additional details and the definition of the 0086 getInstance() method. There are many other ways to accomplish this 0087 including inheriting this class along with the XrdTcpMonPin class by 0088 the implementation class. 0089 0090 You should also specify the compilation version. That is, the XRootD 0091 version you used to compile your plug-in. Declare it as: 0092 0093 #include "XrdVersion.hh" 0094 XrdVERSIONINFO(TcpMonPin,<name>); 0095 0096 where <name> is a 1- to 15-character unquoted name identifying your plugin. 0097 */ 0098 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |