|
|
|||
File indexing completed on 2026-03-31 08:33:53
0001 #ifndef __XRDNETPMARK__ 0002 #define __XRDNETPMARK__ 0003 /******************************************************************************/ 0004 /* */ 0005 /* X r d N e t P M a r k . h h */ 0006 /* */ 0007 /* (c) 2021 by the Board of Trustees of the Leland Stanford, Jr., University */ 0008 /* All Rights Reserved */ 0009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 0010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 0011 /* */ 0012 /* This file is part of the XRootD software suite. */ 0013 /* */ 0014 /* XRootD is free software: you can redistribute it and/or modify it under */ 0015 /* the terms of the GNU Lesser General Public License as published by the */ 0016 /* Free Software Foundation, either version 3 of the License, or (at your */ 0017 /* option) any later version. */ 0018 /* */ 0019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 0020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 0021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 0022 /* License for more details. */ 0023 /* */ 0024 /* You should have received a copy of the GNU Lesser General Public License */ 0025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 0026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 0027 /* */ 0028 /* The copyright holder's institutional names and contributor's names may not */ 0029 /* be used to endorse or promote products derived from this software without */ 0030 /* specific prior written permission of the institution or contributor. */ 0031 /******************************************************************************/ 0032 0033 #include <cstring> 0034 0035 #include <stdlib.h> 0036 0037 class XrdNetAddrInfo; 0038 class XrdSecEntity; 0039 0040 class XrdNetPMark 0041 { 0042 public: 0043 0044 class Handle 0045 {public: 0046 0047 bool getEA(int &ec, int &ac) 0048 {if (Valid()) {ec = eCode; ac = aCode; return true;} 0049 ec = ac = 0; return false; 0050 } 0051 // According to the specifications, ExpID and actID can be equal to 0 for HTTP-TPC. 0052 bool Valid() {return (eCode == 0 && aCode == 0) 0053 || (eCode >= minExpID && eCode <= maxExpID 0054 && aCode >= minActID && aCode <= maxActID);} 0055 0056 Handle(const char *app=0, int ecode=0, int acode=0) 0057 : appName(strdup(app ? app : "unknown")), 0058 eCode(ecode), aCode(acode) {} 0059 0060 Handle(Handle &h) 0061 : appName(strdup(h.appName)), eCode(h.eCode), 0062 aCode(h.aCode) {} 0063 0064 virtual ~Handle() {if(appName) free(appName);} 0065 0066 protected: 0067 char* appName; 0068 int eCode; 0069 int aCode; 0070 }; 0071 0072 virtual Handle *Begin(XrdSecEntity &Client, const char *path=0, 0073 const char *cgi=0, 0074 const char *app=0) = 0; 0075 0076 virtual Handle *Begin(XrdNetAddrInfo &addr, Handle &handle, 0077 const char *tident) = 0; 0078 0079 static bool getEA(const char *cgi, int &ecode, int &acode); 0080 0081 XrdNetPMark() {} 0082 virtual ~XrdNetPMark() {} // This object cannot be deleted! 0083 0084 // ID limits and specifications 0085 // 0086 /** 0087 * From the specifications: Valid value for scitag is a single positive integer > 64 and <65536 (16bit). Any other value is considered invalid. 0088 */ 0089 static const int minTotID = 65; 0090 static const int maxTotID = 65535; 0091 0092 protected: 0093 0094 static const int btsActID = 6; 0095 static const int mskActID = 63; 0096 static const int minExpID = minTotID >> btsActID; 0097 static const int minActID = minTotID & mskActID; 0098 static const int maxExpID = maxTotID >> btsActID; 0099 static const int maxActID = maxTotID & mskActID; 0100 0101 }; 0102 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|