xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XrdXrootdGSReal.hh
Go to the documentation of this file.
1 #ifndef __XRDXROOTDGSREAL_HH_
2 #define __XRDXROOTDGSREAL_HH_
3 /******************************************************************************/
4 /* */
5 /* X r d X r o o t d G S R e a l . h h */
6 /* */
7 /* (c) 2019 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include "Xrd/XrdJob.hh"
34 #include "XrdSys/XrdSysPthread.hh"
38 
39 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
44 
45 class XrdNetMsg;
46 class XrdSysError;
47 
48 class XrdXrootdGSReal : public XrdJob, public XrdXrootdGStream,
50 {
51 public:
52 
53 void DoIt(); // XrdJob override
54 
55 void Flush();
56 
57 uint32_t GetDictID(const char *text, bool isPath=false);
58 
59 bool HasHdr();
60 
61 void Ident();
62 
63 bool Insert(const char *data, int dlen);
64 
65 bool Insert(int dlen);
66 
67 char *Reserve(int dlen);
68 
69 int SetAutoFlush(int afsec);
70 
71 int Space();
72 
73 //-----------------------------------------------------------------------------
79 //-----------------------------------------------------------------------------
80 
81  static const int fmtNone = 0;
82  static const int fmtBin = 1;
83  static const int fmtCgi = 2;
84  static const int fmtJson = 3;
85 
86  static const int hdrNone = 0;
87  static const int hdrNorm = 1;
88  static const int hdrSite = 2;
89  static const int hdrHost = 3;
90  static const int hdrInst = 4;
91  static const int hdrFull = 5;
92 
93  static const int optNoID = 0x01;
94 
95  struct GSParms {const char *pin;
96  const char *dest;
97  int Mode;
98  int maxL;
99  int flsT;
101  char Opt;
102  char Fmt;
103  char Hdr;
104  };
105 
106  XrdXrootdGSReal(const GSParms &gsParms, bool &aOK);
107 
108 //-----------------------------------------------------------------------------
110 //-----------------------------------------------------------------------------
111 
113 
114 private:
115 
116 
117 void AutoFlush();
118 void Expel(int dlen);
119 int hdrBIN(const GSParms &gs);
120 int hdrCGI(const GSParms &gs, char *buff, int blen);
121 int hdrJSN(const GSParms &gs, char *buff, int blen);
122 
123 struct HdrInfo
124  {char *pseq;
125  char *tbeg;
126  char *tend;
127  } hInfo;
128 
129 char *dictHdr;
130 char *idntHdr0;
131 char *idntHdr1;
133 int pSeq;
134 int pSeqID; // For ident records
135 int pSeqDID; // For dict records
139 char *udpBuffer;
140 char *udpBFirst;
141 char *udpBNext;
142 char *udpBEnd;
143 int tBeg;
144 int tEnd;
147 int afTime;
149 bool isCGI;
150 
152 };
153 #endif
unsigned char kXR_char
Definition: XPtypes.hh:65
Definition: XrdXrootdGSReal.hh:48
char * udpBEnd
Definition: XrdXrootdGSReal.hh:142
XrdNetMsg * udpDest
Definition: XrdXrootdGSReal.hh:137
Definition: XrdSysPthread.hh:241
static const int fmtNone
Definition: XrdXrootdGSReal.hh:81
static const int fmtBin
Do not include info.
Definition: XrdXrootdGSReal.hh:82
char * tend
Definition: XrdXrootdGSReal.hh:126
static const int optNoID
Don&#39;t send ident records.
Definition: XrdXrootdGSReal.hh:93
char * tbeg
Definition: XrdXrootdGSReal.hh:125
static const int hdrSite
Include site.
Definition: XrdXrootdGSReal.hh:88
int tBeg
Definition: XrdXrootdGSReal.hh:143
int afTime
Definition: XrdXrootdGSReal.hh:147
uint32_t GetDictID(const char *text, bool isPath=false)
char Fmt
How to handle the records.
Definition: XrdXrootdGSReal.hh:102
char Opt
Options.
Definition: XrdXrootdGSReal.hh:101
char * idntHdr1
Definition: XrdXrootdGSReal.hh:131
bool Insert(const char *data, int dlen)
int monType
Definition: XrdXrootdGSReal.hh:146
Definition: XrdNetMsg.hh:48
XrdXrootdMonitor::User gMon
Definition: XrdXrootdGSReal.hh:151
int tEnd
Definition: XrdXrootdGSReal.hh:144
int flsT
Flush time (default from monitor)
Definition: XrdXrootdGSReal.hh:99
const char * pin
the plugin name.
Definition: XrdXrootdGSReal.hh:95
char * idntHdr0
Definition: XrdXrootdGSReal.hh:130
static const int fmtJson
Format as CGI info.
Definition: XrdXrootdGSReal.hh:84
Definition: XrdSysError.hh:89
void Expel(int dlen)
int hdrBIN(const GSParms &gs)
Definition: XrdXrootdMonitor.hh:169
struct XrdXrootdGSReal::HdrInfo hInfo
int pSeqDID
Definition: XrdXrootdGSReal.hh:135
kXR_char Type
the specific G-Stream identifier
Definition: XrdXrootdGSReal.hh:100
Definition: XrdXrootdGSReal.hh:123
int pSeqID
Definition: XrdXrootdGSReal.hh:134
int rsvbytes
Definition: XrdXrootdGSReal.hh:145
static const int fmtCgi
Format as binary info.
Definition: XrdXrootdGSReal.hh:83
bool afRunning
Definition: XrdXrootdGSReal.hh:148
~XrdXrootdGSReal()
Destructor. Normally, this object is never deleted.
Definition: XrdXrootdGSReal.hh:112
char * udpBNext
Definition: XrdXrootdGSReal.hh:141
static const int hdrInst
Include site, host, port, inst.
Definition: XrdXrootdGSReal.hh:90
int Mode
the monitor type for send routing.
Definition: XrdXrootdGSReal.hh:97
int idntHsz1
Definition: XrdXrootdGSReal.hh:132
Definition: XrdXrootdMonData.hh:80
Definition: XrdXrootdGStream.hh:43
int maxL
Maximum packet length (default 32K)
Definition: XrdXrootdGSReal.hh:98
int hdrCGI(const GSParms &gs, char *buff, int blen)
char * dictHdr
Definition: XrdXrootdGSReal.hh:129
char Hdr
Hdr type.
Definition: XrdXrootdGSReal.hh:103
int SetAutoFlush(int afsec)
XrdXrootdGSReal(const GSParms &gsParms, bool &aOK)
XrdXrootdMonGS * binHdr
Definition: XrdXrootdGSReal.hh:138
static const int hdrNone
Format as JSON info.
Definition: XrdXrootdGSReal.hh:86
static const int hdrNorm
Include standard header.
Definition: XrdXrootdGSReal.hh:87
static const int hdrHost
Include site, host.
Definition: XrdXrootdGSReal.hh:89
Definition: XrdXrootdGSReal.hh:95
char * udpBuffer
Definition: XrdXrootdGSReal.hh:139
int pSeq
Definition: XrdXrootdGSReal.hh:133
const char * dest
Destination for records.
Definition: XrdXrootdGSReal.hh:96
char * Reserve(int dlen)
XrdSysRecMutex gMutex
Definition: XrdXrootdGSReal.hh:136
int hdrJSN(const GSParms &gs, char *buff, int blen)
Definition: XrdXrootdMonitor.hh:148
static const int hdrFull
Include site, host, port, inst, pgm.
Definition: XrdXrootdGSReal.hh:91
char * udpBFirst
Definition: XrdXrootdGSReal.hh:140
Definition: XrdJob.hh:42
char * pseq
Definition: XrdXrootdGSReal.hh:124
bool isCGI
Definition: XrdXrootdGSReal.hh:149