XrdXrootdMonData.hh

Go to the documentation of this file.
00001 #ifndef __XRDXROOTDMONDATA__
00002 #define __XRDXROOTDMONDATA__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                   X r d X r o o t d M o n D a t a . h h                    */
00006 /*                                                                            */
00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
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 
00033 #include "XProtocol/XPtypes.hh"
00034 
00035 /******************************************************************************/
00036 /*                    P a c k e t   D e f i n i t i o n s                     */
00037 /******************************************************************************/
00038   
00039 struct XrdXrootdMonHeader
00040        {kXR_char   code;         // '='|'d'|'f'|'i'|'p'|'r'|'t'|'u'|'x'
00041         kXR_char   pseq;         // packet sequence
00042         kXR_unt16  plen;         // packet length
00043         kXR_int32  stod;         // Unix time at Server Start
00044        };
00045 
00046 struct XrdXrootdMonTrace
00047        {union {kXR_int64  val;
00048                kXR_char   id[8];
00049                kXR_unt16  sVal[4];
00050                kXR_unt32  rTot[2]; } arg0;
00051         union {kXR_int32  buflen;
00052                kXR_int32  Window;
00053                kXR_unt32  wTot;    } arg1;
00054         union {kXR_unt32  dictid;
00055                kXR_int32  Window;  } arg2;
00056        };
00057 
00058 struct XrdXrootdMonBuff
00059        {XrdXrootdMonHeader hdr;
00060         XrdXrootdMonTrace  info[sizeof(XrdXrootdMonTrace)]; //This is really [n]
00061        };
00062 
00063 struct XrdXrootdMonRedir
00064       {union   {kXR_int32 Window;
00065        struct  {kXR_char  Type;
00066                 kXR_char  Dent;
00067                 kXR_int16 Port;
00068                }          rdr;     } arg0;
00069        union   {kXR_unt32 dictid;
00070                 kXR_int32 Window;  } arg1;
00071       };
00072 
00073 struct XrdXrootdMonBurr
00074        {XrdXrootdMonHeader hdr;
00075         union {kXR_int64   sID;
00076                kXR_char    sXX[8]; };
00077         XrdXrootdMonRedir  info[sizeof(XrdXrootdMonRedir)]; //This is really [n]
00078        };
00079 
00080 struct XrdXrootdMonMap
00081        {XrdXrootdMonHeader hdr;
00082         kXR_unt32          dictid;
00083         char               info[1024+256];
00084        };
00085   
00086 const kXR_char XROOTD_MON_APPID         = 0xa0;
00087 const kXR_char XROOTD_MON_CLOSE         = 0xc0;
00088 const kXR_char XROOTD_MON_DISC          = 0xd0;
00089 const kXR_char XROOTD_MON_OPEN          = 0x80;
00090 const kXR_char XROOTD_MON_READV         = 0x90;
00091 const kXR_char XROOTD_MON_READU         = 0x91;
00092 const kXR_char XROOTD_MON_REDHOST       = 0xf0; // No   Modifier
00093 const kXR_char XROOTD_MON_WINDOW        = 0xe0;
00094 
00095 
00096 const kXR_char XROOTD_MON_MAPIDNT       = '=';
00097 const kXR_char XROOTD_MON_MAPPATH       = 'd';
00098 const kXR_char XROOTD_MON_MAPFSTA       = 'f'; // The "f" stream
00099 const kXR_char XROOTD_MON_MAPINFO       = 'i';
00100 const kXR_char XROOTD_MON_MAPMIGR       = 'm'; // Internal use only!
00101 const kXR_char XROOTD_MON_MAPPURG       = 'p';
00102 const kXR_char XROOTD_MON_MAPREDR       = 'r';
00103 const kXR_char XROOTD_MON_MAPSTAG       = 's'; // Internal use only!
00104 const kXR_char XROOTD_MON_MAPTRCE       = 't';
00105 const kXR_char XROOTD_MON_MAPUSER       = 'u';
00106 const kXR_char XROOTD_MON_MAPXFER       = 'x';
00107 
00108 // The following bits are insert in the low order 4 bits of the MON_REDIRECT
00109 // entry code to indicate the actual operation that was requestded.
00110 //
00111 const kXR_char XROOTD_MON_REDSID        = 0xf0; // Server Identification
00112 const kXR_char XROOTD_MON_REDTIME       = 0x00; // Timing mark
00113 
00114 const kXR_char XROOTD_MON_REDIRECT      = 0x80; // With Modifier below!
00115 const kXR_char XROOTD_MON_REDLOCAL      = 0x90; // With Modifier below!
00116 
00117 const kXR_char XROOTD_MON_CHMOD         = 0x01; // Modifiers for the above
00118 const kXR_char XROOTD_MON_LOCATE        = 0x02;
00119 const kXR_char XROOTD_MON_OPENDIR       = 0x03;
00120 const kXR_char XROOTD_MON_OPENC         = 0x04;
00121 const kXR_char XROOTD_MON_OPENR         = 0x05;
00122 const kXR_char XROOTD_MON_OPENW         = 0x06;
00123 const kXR_char XROOTD_MON_MKDIR         = 0x07;
00124 const kXR_char XROOTD_MON_MV            = 0x08;
00125 const kXR_char XROOTD_MON_PREP          = 0x09;
00126 const kXR_char XROOTD_MON_QUERY         = 0x0a;
00127 const kXR_char XROOTD_MON_RM            = 0x0b;
00128 const kXR_char XROOTD_MON_RMDIR         = 0x0c;
00129 const kXR_char XROOTD_MON_STAT          = 0x0d;
00130 const kXR_char XROOTD_MON_TRUNC         = 0x0e;
00131 
00132 const kXR_char XROOTD_MON_FORCED        = 0x01;
00133 const kXR_char XROOTD_MON_BOUNDP        = 0x02;
00134 
00135 const int      XROOTD_MON_SRCMASK       = 0x000000f;
00136 const int      XROOTD_MON_TRGMASK       = 0x7fffff0;
00137 const int      XROOTD_MON_NEWSTID       = 0x8000000;
00138 
00139 /******************************************************************************/
00140 /*           " f "   S t r e a m   S p e c i f i c   R e c o r d s            */
00141 /******************************************************************************/
00142 
00143 // The UDP buffer layout is as follows:
00144 //
00145 // XrdXrootdMonHeader    with Code    ==  XROOTD_MON_MAPFSTA
00146 // XrdXrootdMonFileTOD   with recType == isTime
00147 // XrdXrootdMonFileHdr   with recType == one of recTval   (variable length)
00148 // ...                   additional XrdXrootdMonFileHdr's (variable length)
00149 // XrdXrootdMonFileTOD   with recType == isTime
00150   
00151 struct XrdXrootdMonFileHdr    // 8
00152 {
00153 enum  recTval {isClose = 0,   // Record for close
00154                isOpen,        // Record for open
00155                isTime,        // Record for time
00156                isXfr,         // Record for transfers
00157                isDisc         // Record for disconnection
00158               };
00159 
00160 enum  recFval {forced  =0x01, // If recFlag == isClose close due to disconnect
00161                hasOPS  =0x02, // If recFlag == isClose MonStatXFR + MonStatOPS
00162                hasSSQ  =0x04, // If recFlag == isClose XFR + OPS  + MonStatSSQ
00163                hasLFN  =0x01, // If recFlag == isOpen  the lfn is present
00164                hasRW   =0x02  // If recFlag == isOpen  file opened r/w
00165               };
00166 
00167 char      recType;  // RecTval: isClose | isOpen | isTime | isXfr
00168 char      recFlag;  // RecFval: Record type-specific flags
00169 short     recSize;  // Size of this record in bytes
00170 union
00171 {
00172 kXR_unt32 fileID;   // dictid  of file for all rectypes except "disc" & "time"
00173 kXR_unt32 userID;   // dictid  of user for     rectypes equal  "disc"
00174 short     nRecs[2]; // isTime: nRecs[0] == isXfr recs nRecs[1] == total recs
00175 };
00176 };
00177 
00178 // The following record is always be present as the first record in the udp
00179 // udp packet and should be used to establish the recording window.
00180 //
00181 struct XrdXrootdMonFileTOD
00182 {
00183 XrdXrootdMonFileHdr Hdr;      //  8
00184 int                 tBeg;     // time(0) of following record
00185 int                 tEnd;     // time(0) when packet was sent
00186 };
00187 
00188 // The following variable length structure exists in XrdXrootdMonFileOPN if
00189 // "lfn" has been specified. It exists only when recFlag & hasLFN is TRUE.
00190 // The user's dictid will be zero (missing) if user monitoring is not enabled.
00191 //
00192 struct XrdXrootdMonFileLFN
00193 {
00194 kXR_unt32           user;     // Monitoring dictid for the user, may be 0.
00195 char                lfn[1028];// Variable length, use recSize!
00196 };
00197 
00198 // The following is reported when a file is opened. If "lfn" was specified and
00199 // Hdr.recFlag & hasLFN is TRUE the XrdXrootdMonFileLFN structure is present.
00200 // However, it variable in size and the next record will be found using recSize.
00201 // The lfn is gauranteed to end with at least one null byte.
00202 //
00203 struct XrdXrootdMonFileOPN
00204 {
00205 XrdXrootdMonFileHdr Hdr;      //  8
00206 long long           fsz;      //  8 file size at time of open
00207 XrdXrootdMonFileLFN ufn;      //  Present ONLY if recFlag & hasLFN is TRUE
00208 };
00209 
00210 // The following data is collected on a per file basis
00211 //
00212 struct XrdXrootdMonStatOPS    // 48 Bytes
00213 {
00214 int                 read;     // Number of read()  calls
00215 int                 readv;    // Number of readv() calls
00216 int                 write;    // Number of write() calls
00217 short               rsMin;    // Smallest  readv() segment count
00218 short               rsMax;    // Largest   readv() segment count
00219 long long           rsegs;    // Number of readv() segments
00220 int                 rdMin;    // Smallest  read()  request size
00221 int                 rdMax;    // Largest   read()  request size
00222 int                 rvMin;    // Smallest  readv() request size
00223 int                 rvMax;    // Largest   readv() request size
00224 int                 wrMin;    // Smallest  write() request size
00225 int                 wrMax;    // Largest   write() request size
00226 };
00227 
00228 union XrdXrootdMonDouble
00229 {
00230 long long           dlong;
00231 double              dreal;
00232 };
00233 
00234 struct XrdXrootdMonStatSSQ    // 32 Bytes (all values net ordered IEEE754)
00235 {
00236 XrdXrootdMonDouble  read;     // Sum (all read  requests)**2 (size)
00237 XrdXrootdMonDouble  readv;    // Sum (all readv requests)**2 (size  as a unit)
00238 XrdXrootdMonDouble  rsegs;    // Sum (all readv segments)**2 (count as a unit)
00239 XrdXrootdMonDouble  write;    // Sum (all write requests)**2 (size)
00240 };
00241 
00242 // The following transfer data is collected for each open file.
00243 //
00244 struct XrdXrootdMonStatXFR
00245 {
00246 long long           read;     // Bytes read  from file so far using read()
00247 long long           readv;    // Bytes read  from file so far using readv()
00248 long long           write;    // Bytes written to file so far
00249 };
00250 
00251 // The following is reported upon file close. This is a variable length record.
00252 // The record always contains XrdXrootdMonStatXFR after   XrdXrootdMonFileHdr.
00253 // If (recFlag & hasOPS) TRUE XrdXrootdMonStatOPS follows XrdXrootdMonStatXFR
00254 // If (recFlag & hasSSQ) TRUE XrdXrootdMonStatSQV follows XrdXrootdMonStatOPS
00255 // The XrdXrootdMonStatSSQ information is present only if "ssq" was specified.
00256 //
00257 struct XrdXrootdMonFileCLS    // 32 | 80 | 96 Bytes
00258 {
00259 XrdXrootdMonFileHdr Hdr;      // Always present (recSize has full length)
00260 XrdXrootdMonStatXFR Xfr;      // Always present
00261 XrdXrootdMonStatOPS Ops;      // Only   present when (recFlag & hasOPS) is True
00262 XrdXrootdMonStatSSQ Ssq;      // Only   present when (recFlag & hasSSQ) is True
00263 };
00264 
00265 // The following is reported when a user ends a session.
00266 //
00267 struct XrdXrootdMonFileDSC
00268 {
00269 XrdXrootdMonFileHdr Hdr;      //  8
00270 };
00271 
00272 // The following is reported each interval*count for each open file when "xfr"
00273 // is specified. These records may be interspersed with other records.
00274 //
00275 struct XrdXrootdMonFileXFR    // 32 Bytes
00276 {
00277 XrdXrootdMonFileHdr Hdr;      // Always present with recType == isXFR
00278 XrdXrootdMonStatXFR Xfr;      // Always present
00279 };
00280 #endif

Generated on 16 Jan 2014 for xrootd by  doxygen 1.4.7